http://ftp.x.org/contrib/applications/xscreensaver-3.19.tar.gz
[xscreensaver] / configure.in
index 07fb76e98386a52397f77d74e19dbd82837f5870..ed3a8193ef71517050cad4eaa218a3f7ed1c5705 100644 (file)
@@ -180,8 +180,7 @@ perl_version_cmd='print $]'
 changequote([,])
 
 AC_DEFUN(AC_PROG_PERL,
- [PERL=''
-  AC_PATH_PROGS(PERL, [perl5 perl],,)
+ [AC_PATH_PROGS(PERL, [perl5 perl],,)
   if test -z "$PERL" ; then
     PERL_VERSION=0
   else
@@ -1781,7 +1780,7 @@ fi
 
 ###############################################################################
 #
-#       Check for -lGL or -lMesa.
+#       Check for -lGL or -lMesaGL.
 #
 ###############################################################################
 
@@ -1809,8 +1808,6 @@ if test "$with_gl" = yes; then
   #
   if test "$have_gl" = yes ; then
 
-    AC_DEFINE(HAVE_GL)
-
     # We need to know whether it's MesaGL so that we know which libraries
     # to link against.
     #
@@ -1820,16 +1817,46 @@ if test "$with_gl" = yes; then
       ])
     ac_have_mesa_gl=$ac_cv_have_mesa_gl
  
-    if test "$ac_have_mesa_gl" = no ; then
-      gl_lib_1="GL"
-      GL_LIBS="-lGL -lGLU"
+
+    # If we have Mesa headers, check to see if we can link against -lMesaGL.
+    # If we don't have Mesa headers, or we don't have -lMesaGL, try -lGL.
+    # Else, warn that GL is busted.  (We have the headers, but no libs.)
+    #
+    gl_lib_1=""
+    GL_LIBS=""
+
+    if test "$ac_have_mesa_gl" = yes ; then
+      AC_CHECK_X_LIB(MesaGL, glXCreateContext, 
+                     [gl_lib_1="MesaGL"
+                      GL_LIBS="-lMesaGL -lMesaGLU"],
+                     [], -lMesaGLU -lX11 -lXext -lm)
+    fi
+
+    if test "$gl_lib_1" = "" ; then
+      AC_CHECK_X_LIB(GL, glXCreateContext, 
+                     [gl_lib_1="GL"
+                      GL_LIBS="-lGL -lGLU"],
+                     [], -lGLU -lX11 -lXext -lm)
+    fi
+
+    if test "$gl_lib_1" = "" ; then
+      # we have headers, but no libs -- bail.
+      have_gl=no
+      ac_have_mesa_gl=no
     else
-      AC_DEFINE(HAVE_MESA_GL)
-      gl_lib_1="MesaGL"
-      GL_LIBS="-lMesaGL -lMesaGLU"
+      # linking works -- we can build the GL hacks.
+      AC_DEFINE(HAVE_GL)
+      if test "$ac_have_mesa_gl" = yes ; then
+        AC_DEFINE(HAVE_MESA_GL)
+      fi
     fi
+  fi
 
 
+  # Now that we know we have GL headers and libs, do some more GL testing.
+  #
+
+  if test "$have_gl" = yes ; then
     # If it's MesaGL, we'd like to issue a warning if the version number
     # is less than or equal to 2.6, because that version had a security bug.
     #
@@ -1932,6 +1959,58 @@ elif test "$with_gl" != no; then
 fi
 
 
+###############################################################################
+#
+#       Check for -lgle.
+#
+###############################################################################
+
+have_gle=no
+with_gle_req=unspecified
+AC_ARG_WITH(gle,
+[  --with-gle              Build those demos which depend on GLE
+                          (the OpenGL "extrusion" library.)],
+  [with_gle="$withval"; with_gle_req="$withval"],[with_gle=yes])
+
+HANDLE_X_PATH_ARG(with_gle, --with-gle, GLE)
+
+GLE_LIBS=""
+
+if test "$with_gle" = yes; then
+
+  AC_CHECK_X_HEADER(GL/gutil.h, have_gle=yes, have_gle=no)
+  if test "$have_gle" = yes ; then
+    AC_CHECK_X_HEADER(GL/tube.h, have_gle=yes, have_gle=no)
+  fi
+
+#          /usr/local/lib/GL/libgle.a
+#          /usr/local/lib/GL/libmatrix.a
+
+  if test "$have_gle" = yes ; then
+    have_gle=no
+    AC_CHECK_X_LIB(gle, gleCreateGC, 
+                   [have_gle=yes; GLE_LIBS="-lgle"],
+                   [], $GL_LIBS -lX11 -lXext -lm)
+  fi
+  if test "$have_gle" = yes ; then
+    have_gle=no
+    AC_CHECK_X_LIB(matrix, uview_direction_d, 
+                   [have_gle=yes; GLE_LIBS="$GLE_LIBS -lmatrix"],
+                   [], $GL_LIBS -lX11 -lXext -lm)
+  fi
+
+  if test "$have_gle" = yes ; then
+    AC_DEFINE(HAVE_GLE)
+  fi
+
+elif test "$with_gle" != no; then
+  echo "error: must be yes or no: --with-gle=$with_gle"
+  exit 1
+
+fi
+
+
+
 ###############################################################################
 #
 #       Check for -lXpm.
@@ -2326,8 +2405,8 @@ if test "$enable_locking" = yes; then
   LOCK_SRCS='$(LOCK_SRCS_1) $(PASSWD_SRCS)'
   LOCK_OBJS='$(LOCK_OBJS_1) $(PASSWD_OBJS)'
 else
-  LOCK_SRCS=''
-  LOCK_OBJS=''
+  LOCK_SRCS='$(NOLOCK_SRCS_1)'
+  LOCK_OBJS='$(NOLOCK_SRCS_1)'
 fi
 
 if test "$need_setuid" = yes; then
@@ -2347,6 +2426,14 @@ else
   GL_KLUDGE="  -${tab}  "
 fi
 
+if test "$have_gle" = yes; then
+  GLE_EXES='$(GLE_EXES)'
+  GLE_MEN='$(GLE_MEN)'
+  GLE_KLUDGE="${tab}  "
+else
+  GLE_KLUDGE="  -${tab}  "
+fi
+
 
 ###############################################################################
 #
@@ -2366,6 +2453,7 @@ AC_SUBST(ATHENA3D_LIBS)
 AC_SUBST(HACK_LIBS)
 AC_SUBST(XPM_LIBS)
 AC_SUBST(GL_LIBS)
+AC_SUBST(GLE_LIBS)
 AC_SUBST(PASSWD_LIBS)
 AC_SUBST(INSTALL_SETUID)
 AC_SUBST(INSTALL_DIRS)
@@ -2386,6 +2474,9 @@ AC_SUBST(LOCK_OBJS)
 AC_SUBST(GL_EXES)
 AC_SUBST(GL_MEN)
 AC_SUBST(GL_KLUDGE)
+AC_SUBST(GLE_EXES)
+AC_SUBST(GLE_MEN)
+AC_SUBST(GLE_KLUDGE)
 AC_SUBST(HACKDIR)
 
 APPDEFAULTS=$ac_x_app_defaults
@@ -2627,6 +2718,26 @@ if test "$have_gl" = no ; then
 
 fi
 
+
+if test "$have_gl" = yes -a "$have_gle" = no ; then
+  if test "$with_gle_req" = yes ; then
+    warnL 'Use of GLE was requested, but it was not found.'
+  elif test "$with_gle_req" = no ; then
+    noteL 'The GLE (GL Extrusion) library is not being used.'
+  else
+    noteL 'The GLE (GL Extrusion) library was not found.'
+  fi
+
+  echo ''
+  warn2 'Some of the OpenGL (3D) demos will not be built or installed.'
+  warn2 'You might want to consider installing GLE and re-running'
+  warn2 'configure.  (Remember to delete the config.cache file first.)'
+  warn2 'You can find the GLE library at <http://www.linas.org/gle/>.'
+  warn2 'For general OpenGL info, see <http://www.opengl.org/>.'
+
+fi
+
+
 if test "$with_readdisplay_req" = yes -a "$have_readdisplay" = no ; then
   warn 'Use of XReadDisplay was requested, but it was not found.'
 fi
@@ -2749,7 +2860,7 @@ if test "$do_dir_warning" = yes; then
   echo '      "xscreensaver-demo", and "xscreensaver-command" executables'
   echo "      will be installed in ${bindir}."
   echo ""
-  echo "      The various graphics demos (90+ different executables) will"
+  echo "      The various graphics demos (100+ different executables) will"
   echo "      also be installed in ${HACKDIR}."
   echo ""
   echo "      If you would prefer the demos to be installed elsewhere"