[gtkglext] Update AX_CHECK_GL and AX_CHECK_GLU to the 2010-03-21 release.



commit b9b59224955786c00e888f5c5f86a447c3fd1954
Author: Braden McDaniel <braden endoframe com>
Date:   Sun Apr 25 04:24:36 2010 -0400

    Update AX_CHECK_GL and AX_CHECK_GLU to the 2010-03-21 release.

 m4macros/ax_check_gl.m4  |   69 +++++++++++++++++++++++++++++++++------------
 m4macros/ax_check_glu.m4 |   28 ++++++++++--------
 2 files changed, 65 insertions(+), 32 deletions(-)
---
diff --git a/m4macros/ax_check_gl.m4 b/m4macros/ax_check_gl.m4
index c7b1e41..808e0f4 100644
--- a/m4macros/ax_check_gl.m4
+++ b/m4macros/ax_check_gl.m4
@@ -11,7 +11,7 @@
 # "OpenGL/gl.h" is found, HAVE_OPENGL_GL_H is defined.  These preprocessor
 # definitions may not be mutually exclusive.
 #
-# version: 2.5
+# version: 2.6
 # author: Braden McDaniel <braden endoframe com>
 #
 # This program is free software; you can redistribute it and/or modify
@@ -43,17 +43,14 @@ AC_REQUIRE([AX_PTHREAD])dnl
 AC_LANG_PUSH([C])
 AX_LANG_COMPILER_MS
 AS_IF([test X$ax_compiler_ms = Xno],
-      [GL_CFLAGS="${PTHREAD_CFLAGS}"; GL_LIBS="${PTHREAD_LIBS} -lm"])
+      [GL_CFLAGS="${PTHREAD_CFLAGS}"; GL_LIBS="${PTHREAD_LIBS}"])
 
 #
 # Use x_includes and x_libraries if they have been set (presumably by
 # AC_PATH_X).
 #
-AS_IF([test X$no_x != Xyes],
-      [AS_IF([test -n "$x_includes"],
-             [GL_CFLAGS="-I$x_includes $GL_CFLAGS"])]
-       AS_IF([test -n "$x_libraries"],
-             [GL_LIBS="-L$x_libraries -lX11 $GL_LIBS"]))
+AS_IF([test X$no_x != Xyes -a -n "$x_includes"],
+      [GL_CFLAGS="-I$x_includes $GL_CFLAGS"])
 
 AC_CHECK_HEADERS([windows.h])
 
@@ -80,6 +77,20 @@ m4_define([AX_CHECK_GL_PROGRAM],
 # endif]],
                            [[glBegin(0)]])])
 
+m4_define([AX_CHECK_GL_GLX_PROGRAM],
+          [AC_LANG_PROGRAM([[
+# if defined(HAVE_WINDOWS_H) && defined(_WIN32)
+#   include <windows.h>
+# endif
+# ifdef HAVE_GL_GL_H
+#   include <GL/gl.h>
+# elif defined(HAVE_OPENGL_GL_H)
+#   include <OpenGL/gl.h>
+# else
+#   error no gl.h
+# endif]],
+                           [[glXQueryVersion(0, 0, 0)]])])
+
 AC_CACHE_CHECK([for OpenGL library], [ax_cv_check_gl_libgl],
 [ax_cv_check_gl_libgl=no
 case $host_cpu in
@@ -87,31 +98,51 @@ case $host_cpu in
   *)      ax_check_gl_libdir=lib ;;
 esac
 ax_save_CPPFLAGS=$CPPFLAGS
-CPPFLAGS="$GL_CFLAGS $CPPFLAGS"
+CPPFLAGS="$CPPFLAGS $GL_CFLAGS"
+ax_save_LDFLAGS=$LDFLAGS
+AS_IF([test X$no_x != Xyes -a -n "$x_libraries"],
+      [LDFLAGS="$LDFLAGS -L$x_libraries"])
 ax_save_LIBS=$LIBS
-LIBS=""
 ax_check_libs="-lopengl32 -lGL"
 for ax_lib in $ax_check_libs; do
   AS_IF([test X$ax_compiler_ms = Xyes],
         [ax_try_lib=`echo $ax_lib | $SED -e 's/^-l//' -e 's/$/.lib/'`],
         [ax_try_lib=$ax_lib])
-  LIBS="$ax_try_lib $GL_LIBS $ax_save_LIBS"
+  LDFLAGS="$ax_save_LDFLAGS $GL_LIBS"
+  LIBS="$ax_try_lib $ax_save_LIBS"
 AC_LINK_IFELSE([AX_CHECK_GL_PROGRAM],
                [ax_cv_check_gl_libgl=$ax_try_lib; break],
-               [ax_check_gl_nvidia_flags="-L/usr/$ax_check_gl_libdir/nvidia" LIBS="$ax_try_lib $ax_check_gl_nvidia_flags $GL_LIBS $ax_save_LIBS"
-               AC_LINK_IFELSE([AX_CHECK_GL_PROGRAM],
-                              [ax_cv_check_gl_libgl="$ax_try_lib $ax_check_gl_nvidia_flags"; break],
-                              [ax_check_gl_dylib_flag='-dylib_file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib' LIBS="$ax_try_lib $ax_check_gl_dylib_flag $GL_LIBS $ax_save_LIBS"
-                              AC_LINK_IFELSE([AX_CHECK_GL_PROGRAM],
-                                             [ax_cv_check_gl_libgl="$ax_try_lib $ax_check_gl_dylib_flag"; break])])])
+               [ax_check_gl_nvidia_flags="-L/usr/$ax_check_gl_libdir/nvidia"
+                LDFLAGS="$ax_save_LDFLAGS $GL_LIBS $ax_check_gl_nvidia_flags"
+                AC_LINK_IFELSE([AX_CHECK_GL_PROGRAM],
+                               [ax_cv_check_gl_libgl="$ax_check_gl_nvidia_flags $ax_try_lib"; break],
+                               [ax_check_gl_dylib_flag='-dylib_file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib'
+                                LDFLAGS="$ax_save_LDFLAGS $GL_LIBS $ax_check_gl_dylib_flag"
+                                AC_LINK_IFELSE([AX_CHECK_GL_PROGRAM],
+                                               [ax_cv_check_gl_libgl="$ax_check_gl_dylib_flag $ax_try_lib"; break])])])
 done
 
+#
+# If no_x is "yes", we don't want to wind up using a libGL that is
+# linked with X11.  Test to see if the found libGL includes GLX
+# functions.  If it does and no_x is "yes", we want to reset
+# ax_cv_check_gl_libgl back to "no".
+#
+# Note that LDFLAGS and LIBS should still have whatever values they
+# had when we broke out of the test loop above; use that.
+#
+AS_IF([test "X$ax_cv_check_gl_libgl" != Xno],
+      [AC_LINK_IFELSE([AX_CHECK_GL_GLX_PROGRAM],
+                      [AS_IF([test X$no_x = Xyes],
+                             [ax_cv_check_gl_libgl=no])])])
+
+LIBS=$ax_save_LIBS
 AS_IF([test "X$ax_cv_check_gl_libgl" = Xno -a X$no_x = Xyes],
-      [LIBS='-framework OpenGL'
+      [LDFLAGS="$ax_save_LDFLAGS -framework OpenGL"
       AC_LINK_IFELSE([AX_CHECK_GL_PROGRAM],
-                     [ax_cv_check_gl_libgl=$LIBS])])
+                     [ax_cv_check_gl_libgl='-framework OpenGL'])])
 
-LIBS=$ax_save_LIBS
+LDFLAGS=$ax_save_LDFLAGS
 CPPFLAGS=$ax_save_CPPFLAGS])
 
 AS_IF([test "X$ax_cv_check_gl_libgl" = Xno],
diff --git a/m4macros/ax_check_glu.m4 b/m4macros/ax_check_glu.m4
index 6abad40..1680f3c 100644
--- a/m4macros/ax_check_glu.m4
+++ b/m4macros/ax_check_glu.m4
@@ -15,7 +15,7 @@
 # rather than the standard "GLvoid (*)()".  If the former condition is
 # detected, this macro defines "HAVE_VARARGS_GLU_TESSCB".
 #
-# version: 2.3
+# version: 2.4
 # author: Braden McDaniel <braden endoframe com>
 #
 # This program is free software; you can redistribute it and/or modify
@@ -70,13 +70,14 @@ AC_CACHE_CHECK([for OpenGL Utility library], [ax_cv_check_glu_libglu],
 [ax_cv_check_glu_libglu=no
 ax_save_CPPFLAGS=$CPPFLAGS
 CPPFLAGS="$GL_CFLAGS $CPPFLAGS"
+ax_save_LDFLAGS=$LDFLAGS
 ax_save_LIBS=$LIBS
 
 #
 # First, check for the possibility that everything we need is already in
 # GL_LIBS.
 #
-LIBS="$GL_LIBS $ax_save_LIBS"
+LDFLAGS="$ax_save_LDFLAGS $GL_LIBS"
 #
 # libGLU typically links with libstdc++ on POSIX platforms.
 # However, setting the language to C++ means that test program
@@ -89,26 +90,27 @@ AS_IF([test X$ax_compiler_ms = Xyes],
 AC_LINK_IFELSE([AX_CHECK_GLU_PROGRAM],
                [ax_cv_check_glu_libglu=yes],
                [LIBS=""
-               ax_check_libs="-lglu32 -lGLU"
-               for ax_lib in ${ax_check_libs}; do
-                 AS_IF([test X$ax_compiler_ms = Xyes],
-                       [ax_try_lib=`echo $ax_lib | $SED -e 's/^-l//' -e 's/$/.lib/'`],
-                       [ax_try_lib=$ax_lib])
-                 LIBS="$ax_try_lib $GL_LIBS $ax_save_LIBS"
-                 AC_LINK_IFELSE([AX_CHECK_GLU_PROGRAM],
-                                [ax_cv_check_glu_libglu=$ax_try_lib; break])
-               done])
+                ax_check_libs="-lglu32 -lGLU"
+                for ax_lib in ${ax_check_libs}; do
+                  AS_IF([test X$ax_compiler_ms = Xyes],
+                        [ax_try_lib=`echo $ax_lib | $SED -e 's/^-l//' -e 's/$/.lib/'`],
+                        [ax_try_lib=$ax_lib])
+                  LIBS="$ax_try_lib $ax_save_LIBS"
+                  AC_LINK_IFELSE([AX_CHECK_GLU_PROGRAM],
+                                 [ax_cv_check_glu_libglu=$ax_try_lib; break])
+                done])
 AS_IF([test X$ax_compiler_ms = Xyes],
       [AC_LANG_POP([C])])
 AC_LANG_POP([C++])
 
 LIBS=$ax_save_LIBS
+LDFLAGS=$ax_save_LDFLAGS
 CPPFLAGS=$ax_save_CPPFLAGS])
 AS_IF([test "X$ax_cv_check_glu_libglu" = Xno],
       [no_glu=yes; GLU_CFLAGS=""; GLU_LIBS=""],
       [AS_IF([test "X$ax_cv_check_glu_libglu" = Xyes],
-             [GLU_LIBS=$GL_LIBS],
-             [GLU_LIBS="$ax_cv_check_glu_libglu $GL_LIBS"])])
+             [GLU_LIBS=""],
+             [GLU_LIBS="$ax_cv_check_glu_libglu"])])
 AC_SUBST([GLU_CFLAGS])
 AC_SUBST([GLU_LIBS])
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]