Commit 1bb599e1fe343ef93ba27fbaf3ccbd348c12265a

sammy 2008-07-11T13:01:46

* m4/gl.m4: GLU detection fixes, courtesy of Coleman Kane (fixes SF ticket #2007989). * AUTHORS: minor changes.

diff --git a/AUTHORS b/AUTHORS
index 41f599d..1f0ffba 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,4 +1,9 @@
 						-*- coding: utf-8 -*-
+Maintainers:
+
+   Sam Hocevar <sam@zoy.org>
+   Christopher Sean Morrison <learner@brlcad.org>
+
 Original author:
 
    Henry Maddocks <ftgl@opengl.geek.nz>
@@ -14,11 +19,10 @@ Contributors:
    Sébastien Barré (containers and optimisations)
    Marcelo E. Magallon <mmagallo@debian.org> (original autoconf, bug fixes)
    Robert Bell (pixmap font modifications)
-   Sam Hocevar <sam@zoy.org> (build system, new maintainer)
    Éric Beets <ericbeets@free.fr> (C bindings)
-   Christopher Sean Morrison <learner@brlcad.org> (bug fixes, new maintainer)
    Jeff Myers (JeffM2501) <JeffM2501@users.sourceforge.net> (Windows fixes)
    Daniel Remenak <dtremenak@users.sourceforge.net> (Windows fixes)
+   Coleman Kane (build system fixes)
 
 Portions derived from ConvertUTF.c Copyright (C) 2001-2004 Unicode, Inc.
 
diff --git a/m4/gl.m4 b/m4/gl.m4
index ed583ac..6ff6a2e 100644
--- a/m4/gl.m4
+++ b/m4/gl.m4
@@ -11,6 +11,8 @@ AC_ARG_WITH([--with-gl-inc],
     AC_HELP_STRING([--with-gl-inc=DIR],[Directory where GL/gl.h is installed]))
 AC_ARG_WITH([--with-gl-lib],
     AC_HELP_STRING([--with-gl-lib=DIR],[Directory where OpenGL libraries are installed]))
+AC_ARG_WITH([--with-glu-lib],
+    AC_HELP_STRING([--with-glu-lib=DIR],[Directory where OpenGL GLU library is installed]))
 
 AC_LANG_SAVE
 AC_LANG_C
@@ -48,7 +50,9 @@ LIBS="$LIBS -Xlinker -framework -Xlinker OpenGL"
 # -Xlinker is used because libtool is busted prior to 1.6 wrt frameworks
 AC_TRY_LINK([#include <OpenGL/gl.h>], [glBegin(GL_POINTS)],
     [FRAMEWORK_OPENGL="-Xlinker -framework -Xlinker OpenGL" ; ac_cv_search_glBegin="-Xlinker -framework -Xlinker OpenGL" ; AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])
-with_gl_lib="$FRAMEWORK_OPENGL"
+if test x"$FRAMEWORK_OPENGL" != "x"; then
+  with_gl_lib="$FRAMEWORK_OPENGL"
+fi
 AC_SUBST(FRAMEWORK_OPENGL)
 LIBS="$PRELIBS"
 
@@ -62,7 +66,12 @@ if test "x$with_gl_lib" != "x" ; then
 else
     LIBS="-lGL"
 fi
-AC_LINK_IFELSE([AC_LANG_CALL([],[glBegin])],[HAVE_GL=yes], [HAVE_GL=no])
+AC_LINK_IFELSE([AC_LANG_CALL([],[glBegin])],[HAVE_GL=yes],[
+dnl This is done here so that we can check for the Win32 version of the
+dnl GL library, which may not use cdecl calling convention.
+ AC_TRY_LINK([#include <GL/gl.h>],[glBegin(GL_POINTS)],[HAVE_GL=yes],[HAVE_GL=no])]
+)
+
 if test "x$HAVE_GL" = xno ; then
     if test "x$GL_X_LIBS" != x ; then
         LIBS="-lGL $GL_X_LIBS"
@@ -103,8 +112,20 @@ AC_TRY_COMPILE([
 if test "x$FRAMEWORK_OPENGL" = "x" ; then
 
 AC_MSG_CHECKING([for GLU library])
-LIBS="-lGLU $GL_LIBS"
-AC_LINK_IFELSE([AC_LANG_CALL([],[gluNewTess])],[HAVE_GLU=yes], [HAVE_GLU=no])
+if test "x$with_glu_lib" != "x" ; then
+    if test -d "$with_glu_lib" ; then
+        LIBS="$GL_LIBS -L$with_glu_lib -lGLU"
+    else
+        LIBS="$GL_LIBS $with_glu_lib"
+    fi
+else
+    LIBS="$GL_LIBS -lGLU"
+fi
+AC_LINK_IFELSE([AC_LANG_CALL([],[gluNewTess])],[HAVE_GLU=yes], [
+dnl This is done here so that we can check for the Win32 version of the
+dnl GL library, which may not use cdecl calling convention.
+ AC_TRY_LINK([#include <GL/glu.h>],[gluNewTess()],[HAVE_GLU=yes],[HAVE_GLU=no])]
+)
 if test "x$HAVE_GLU" = xno ; then
     if test "x$GL_X_LIBS" != x ; then
         LIBS="-lGLU $GL_LIBS $GL_X_LIBS"