configure: improve gl/glut library test

add a check for a libGL function (glOrtho) in addition to glutMainLoop
when establishing the need for libGL at link time.

fixes vwebp link failure on ubuntu 13.04+

Change-Id: I537e9a5cab5cf4cd8875e06268d2107f377e625e
This commit is contained in:
James Zern 2013-06-07 20:02:44 -07:00
parent c2113ad4f9
commit 2ccf58d648

View File

@ -170,18 +170,31 @@ if test "$glut_headers" = "yes"; then
LIBS="$GL_SAVED_LIBS" LIBS="$GL_SAVED_LIBS"
# A direct link to libGL may not be necessary on e.g., linux. # A direct link to libGL may not be necessary on e.g., linux.
for lib in "" $ac_cv_search_glBegin; do GLUT_SAVED_LIBS="$LIBS"
unset ac_cv_search_glutMainLoop for lib in "" "-lglut" "-lglut $ac_cv_search_glBegin"; do
AC_SEARCH_LIBS([glutMainLoop], [glut], [glut_support=yes], [], [$lib]) LIBS="$lib"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([
#ifdef __cplusplus
# define EXTERN_C extern "C"
#else
# define EXTERN_C
#endif
EXTERN_C char glOrtho();
EXTERN_C char glutMainLoop();
],[
glOrtho();
glutMainLoop();
])
],
[glut_support=yes], []
)
if test "$glut_support" = "yes"; then if test "$glut_support" = "yes"; then
GL_LIBS="$LDFLAGS" GL_LIBS="$LDFLAGS $lib"
if test "$ac_cv_search_glutMainLoop" != "none required"; then
GL_LIBS="$GL_LIBS $ac_cv_search_glutMainLoop"
fi
GL_LIBS="$GL_LIBS $lib"
break break
fi fi
done done
LIBS="$GLUT_SAVED_LIBS"
LDFLAGS="$GLUT_SAVED_LDFLAGS" LDFLAGS="$GLUT_SAVED_LDFLAGS"
test "$glut_support" = "yes" && break test "$glut_support" = "yes" && break
done done