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"
# A direct link to libGL may not be necessary on e.g., linux.
for lib in "" $ac_cv_search_glBegin; do
unset ac_cv_search_glutMainLoop
AC_SEARCH_LIBS([glutMainLoop], [glut], [glut_support=yes], [], [$lib])
GLUT_SAVED_LIBS="$LIBS"
for lib in "" "-lglut" "-lglut $ac_cv_search_glBegin"; do
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
GL_LIBS="$LDFLAGS"
if test "$ac_cv_search_glutMainLoop" != "none required"; then
GL_LIBS="$GL_LIBS $ac_cv_search_glutMainLoop"
fi
GL_LIBS="$GL_LIBS $lib"
GL_LIBS="$LDFLAGS $lib"
break
fi
done
LIBS="$GLUT_SAVED_LIBS"
LDFLAGS="$GLUT_SAVED_LDFLAGS"
test "$glut_support" = "yes" && break
done