From aa4f24915e201ee3184ffcd311a4465d04778881 Mon Sep 17 00:00:00 2001 From: Andrey Kiselev Date: Thu, 23 Jun 2005 11:46:47 +0000 Subject: [PATCH] Updated to latest OpenGL test macros versions. --- acinclude.m4 | 72 +++++++++++++++++++++++++++++----------------------- 1 file changed, 40 insertions(+), 32 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 27079e3d..dc93c294 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -120,7 +120,7 @@ EOF dnl --------------------------------------------------------------------------- dnl Available from the GNU Autoconf Macro Archive at: -dnl http://www.gnu.org/software/ac-archive/htmldoc/ax_check_gl.html +dnl http://www.gnu.org/software/ac-archive/ax_check_gl.html dnl --------------------------------------------------------------------------- AC_DEFUN([AX_CHECK_GL], [AC_REQUIRE([AC_PATH_X])dnl @@ -137,10 +137,15 @@ AC_ARG_WITH([apple-opengl-framework], if test "X$with_apple_opengl_framework" = "Xyes"; then AC_DEFINE([HAVE_APPLE_OPENGL_FRAMEWORK], [1], [Use the Apple OpenGL framework.]) - GL_CFLAGS="-framework OpenGL" + GL_LIBS="-framework OpenGL" else - GL_CFLAGS="${PTHREAD_CFLAGS}" - GL_LIBS="${PTHREAD_LIBS} -lm" + AC_LANG_PUSH(C) + + AX_LANG_COMPILER_MS + if test X$ax_compiler_ms = Xno; then + GL_CFLAGS="${PTHREAD_CFLAGS}" + GL_LIBS="${PTHREAD_LIBS} -lm" + fi # # Use x_includes and x_libraries if they have been set (presumably by @@ -155,8 +160,6 @@ else fi fi - AC_LANG_PUSH(C) - AC_CHECK_HEADERS([windows.h]) AC_CACHE_CHECK([for OpenGL library], [ax_cv_check_gl_libgl], @@ -166,20 +169,20 @@ else ax_save_LIBS="${LIBS}" LIBS="" ax_check_libs="-lopengl32 -lGL" - for ax_lib in ${ax_check_libs}; do - if test "X$CC" = "Xcl"; then + for ax_lib in ${ax_check_libs}; do + if test X$ax_compiler_ms = Xyes; then ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'` else ax_try_lib="${ax_lib}" fi LIBS="${ax_try_lib} ${GL_LIBS} ${ax_save_LIBS}" - AC_TRY_LINK([ + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[ # if HAVE_WINDOWS_H && defined(_WIN32) # include # endif -# include -], - [glBegin(0)], +# include ]], + [[glBegin(0)]])], [ax_cv_check_gl_libgl="${ax_try_lib}"; break]) done LIBS=${ax_save_LIBS} @@ -201,10 +204,11 @@ AC_SUBST([GL_LIBS]) dnl --------------------------------------------------------------------------- dnl Available from the GNU Autoconf Macro Archive at: -dnl http://www.gnu.org/software/ac-archive/htmldoc/ax_check_glu.html +dnl http://www.gnu.org/software/ac-archive/ax_check_glu.html dnl --------------------------------------------------------------------------- AC_DEFUN([AX_CHECK_GLU], [AC_REQUIRE([AX_CHECK_GL])dnl +AC_REQUIRE([AC_PROG_CXX])dnl GLU_CFLAGS="${GL_CFLAGS}" if test "X${with_apple_opengl_framework}" != "Xyes"; then AC_CACHE_CHECK([for OpenGL Utility library], [ax_cv_check_glu_libglu], @@ -215,7 +219,7 @@ if test "X${with_apple_opengl_framework}" != "Xyes"; then LIBS="" ax_check_libs="-lglu32 -lGLU" for ax_lib in ${ax_check_libs}; do - if test "X$CC" = "Xcl"; then + if test X$ax_compiler_ms = Xyes; then ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'` else ax_try_lib="${ax_lib}" @@ -227,25 +231,27 @@ if test "X${with_apple_opengl_framework}" != "Xyes"; then # "conftest.cc"; and Microsoft cl doesn't know what to do with such a # file. # - if test "X$CXX" != "Xcl"; then - AC_LANG_PUSH([C++]) + AC_LANG_PUSH([C++]) + if test X$ax_compiler_ms = Xyes; then + AC_LANG_PUSH([C]) fi - AC_TRY_LINK([ + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[ # if HAVE_WINDOWS_H && defined(_WIN32) # include # endif -# include -], - [gluBeginCurve(0)], +# include ]], + [[gluBeginCurve(0)]])], [ax_cv_check_glu_libglu="${ax_try_lib}"; break]) - if test "X$CXX" != "Xcl"; then - AC_LANG_POP([C++]) + if test X$ax_compiler_ms = Xyes; then + AC_LANG_POP([C]) fi + AC_LANG_POP([C++]) done LIBS=${ax_save_LIBS} CPPFLAGS=${ax_save_CPPFLAGS}]) if test "X${ax_cv_check_glu_libglu}" = "Xno"; then - no_gl="yes" + no_glu="yes" GLU_CFLAGS="" GLU_LIBS="" else @@ -258,23 +264,25 @@ AC_SUBST([GLU_LIBS]) dnl --------------------------------------------------------------------------- dnl Available from the GNU Autoconf Macro Archive at: -dnl http://www.gnu.org/software/ac-archive/htmldoc/ax_check_glut.html +dnl http://www.gnu.org/software/ac-archive/ax_check_glut.html dnl --------------------------------------------------------------------------- + AC_DEFUN([AX_CHECK_GLUT], [AC_REQUIRE([AX_CHECK_GLU])dnl AC_REQUIRE([AC_PATH_XTRA])dnl if test "X$with_apple_opengl_framework" = "Xyes"; then - GLUT_CFLAGS="-framework GLUT ${GLU_CFLAGS}" - GLUT_LIBS="-lobjc ${GL_LIBS}" + GLUT_CFLAGS="${GLU_CFLAGS}" + GLUT_LIBS="-framework GLUT -lobjc ${GL_LIBS}" else GLUT_CFLAGS=${GLU_CFLAGS} + GLUT_LIBS=${GLU_LIBS} # # If X is present, assume GLUT depends on it. # if test "X${no_x}" != "Xyes"; then - GLUT_LIBS="${X_PRE_LIBS} -lXmu -lXi ${X_EXTRA_LIBS} ${GLU_LIBS}" + GLUT_LIBS="${X_PRE_LIBS} -lXmu -lXi ${X_EXTRA_LIBS} ${GLUT_LIBS}" fi AC_LANG_PUSH(C) @@ -288,19 +296,19 @@ else LIBS="" ax_check_libs="-lglut32 -lglut" for ax_lib in ${ax_check_libs}; do - if test "X$CC" = "Xcl"; then + if test X$ax_compiler_ms = Xyes; then ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'` else ax_try_lib="${ax_lib}" fi LIBS="${ax_try_lib} ${GLUT_LIBS} ${ax_save_LIBS}" - AC_TRY_LINK([ + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[ # if HAVE_WINDOWS_H && defined(_WIN32) # include # endif -# include - ], - [glutMainLoop()], +# include ]], + [[glutMainLoop()]])], [ax_cv_check_glut_libglut="${ax_try_lib}"; break]) done