From a2aed1d08c1f17be6165173c0e38f633ea37c4dd Mon Sep 17 00:00:00 2001 From: James Zern Date: Fri, 7 Jun 2013 20:02:44 -0700 Subject: [PATCH] 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 (cherry picked from commit 2ccf58d64810fcdf0ee42a9d53fa7034ffa62597) --- configure.ac | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index d6378d03..2d9cb37e 100644 --- a/configure.ac +++ b/configure.ac @@ -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