http://ftp.x.org/contrib/applications/xscreensaver-3.20.tar.gz
[xscreensaver] / configure.in
index 6c9c4d0d3fe8589fd50084698a8a687c8a8ee84f..322862f6dd55af18720a4a99551ce9e7830be6d3 100644 (file)
@@ -66,6 +66,8 @@ AC_DEFUN(AC_PROG_CC_ANSI,
   if test -n "$GCC"; then
     AC_MSG_RESULT(Turning on gcc compiler warnings.)
     CC="$CC -Wall -Wstrict-prototypes -Wnested-externs -Wno-format"
+    AC_MSG_RESULT(Disabling C++ comments in ANSI C code.)
+    CC="$CC -Wp,-lang-c89"
   else
     case "$host" in
       *-irix5* |*-irix6.[0-3]* )
@@ -180,8 +182,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
@@ -564,7 +565,7 @@ AC_DEFUN(AC_CHECK_X_LIB, [
     LDFLAGS="$LDFLAGS -L$libdir"
   fi
   # note: $X_LIBS includes $x_libraries
-  LDFLAGS="$LDFLAGS $X_LIBS"
+  LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS"
 
   AC_CHECK_LIB([$1], [$2], [$3], [$4], [$5])
   CPPFLAGS="$ac_save_CPPFLAGS"
@@ -1781,7 +1782,7 @@ fi
 
 ###############################################################################
 #
-#       Check for -lGL or -lMesa.
+#       Check for -lGL or -lMesaGL.
 #
 ###############################################################################
 
@@ -1819,25 +1820,36 @@ if test "$with_gl" = yes; then
     ac_have_mesa_gl=$ac_cv_have_mesa_gl
  
 
+    gl_lib_1=""
+    GL_LIBS=""
+
+
+    # Some versions of MesaGL are compiled to require -lpthread.
+    # So if the Mesa headers exist, and -lpthread exists, then always
+    # link -lpthread after the Mesa libs (be they named -lGL or -lMesaGL.)
+    #
+    if test "$ac_have_mesa_gl" = yes; then
+      AC_CHECK_LIB(pthread, pthread_create, [GL_LIBS="-lpthread"], [],)
+    fi
+
+
     # 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)
+                      GL_LIBS="-lMesaGL -lMesaGLU $GL_LIBS"],
+                     [], -lMesaGLU $GL_LIBS -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)
+                      GL_LIBS="-lGL -lGLU $GL_LIBS"],
+                     [], -lGLU $GL_LIBS -lX11 -lXext -lm)
     fi
 
     if test "$gl_lib_1" = "" ; then
@@ -1908,24 +1920,6 @@ EOF
     fi
 
 
-    # If it's MesaGL, check to see if it requires -lpthread.
-    #
-    have_pthread=no
-    mesa_requires_pthread=no
-    if test "$ac_have_mesa_gl" = yes; then
-
-      AC_CHECK_LIB(pthread, pthread_create, [have_pthread=yes], [],)
-      if test "$have_pthread" = yes; then
-        AC_CHECK_X_LIB($gl_lib_1, gl_get_thread_context,
-                       [mesa_requires_pthread=yes], [true],
-                       $GL_LIBS -lpthread -lX11 -lXext -lm)
-      fi
-
-      if test "$mesa_requires_pthread" = yes; then
-        GL_LIBS="$GL_LIBS -lpthread"
-      fi
-    fi
-
     # Check for OpenGL 1.1 features.
     #
     AC_CHECK_X_LIB($gl_lib_1, glBindTexture, [AC_DEFINE(HAVE_GLBINDTEXTURE)],
@@ -1960,6 +1954,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.
@@ -2318,23 +2364,25 @@ if test \! -z "$libdir" ; then
 fi
 
 
+DEMO_MAN="xscreensaver-demo-old.man"
 ALL_DEMO_PROGRAMS=
-if test "$have_athena3d" = yes; then
-  PREFERRED_DEMO_PROGRAM=xscreensaver-demo-Xaw3d
-  ALL_DEMO_PROGRAMS="$PREFERRED_DEMO_PROGRAM $ALL_DEMO_PROGRAMS"
-fi
 if test "$have_athena" = yes; then
   PREFERRED_DEMO_PROGRAM=xscreensaver-demo-Xaw
   ALL_DEMO_PROGRAMS="$PREFERRED_DEMO_PROGRAM $ALL_DEMO_PROGRAMS"
 fi
-if test "$have_gtk" = yes; then
-  PREFERRED_DEMO_PROGRAM=xscreensaver-demo-Gtk
+if test "$have_athena3d" = yes; then
+  PREFERRED_DEMO_PROGRAM=xscreensaver-demo-Xaw3d
   ALL_DEMO_PROGRAMS="$PREFERRED_DEMO_PROGRAM $ALL_DEMO_PROGRAMS"
 fi
 if test "$have_motif" = yes; then
   PREFERRED_DEMO_PROGRAM=xscreensaver-demo-Xm
   ALL_DEMO_PROGRAMS="$PREFERRED_DEMO_PROGRAM $ALL_DEMO_PROGRAMS"
 fi
+if test "$have_gtk" = yes; then
+  PREFERRED_DEMO_PROGRAM=xscreensaver-demo-Gtk
+  ALL_DEMO_PROGRAMS="$PREFERRED_DEMO_PROGRAM $ALL_DEMO_PROGRAMS"
+  DEMO_MAN="xscreensaver-demo.man"
+fi
 
 
 if test "$have_kerberos" = yes; then
@@ -2354,8 +2402,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_OBJS_1)'
 fi
 
 if test "$need_setuid" = yes; then
@@ -2372,7 +2420,15 @@ if test "$have_gl" = yes; then
   GL_MEN='$(GL_MEN)'
   GL_KLUDGE="${tab}  "
 else
-  GL_KLUDGE="  -${tab}  "
+  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
 
 
@@ -2386,6 +2442,7 @@ AC_SUBST(INCLUDES)
 
 AC_SUBST(PREFERRED_DEMO_PROGRAM)
 AC_SUBST(ALL_DEMO_PROGRAMS)
+AC_SUBST(DEMO_MAN)
 AC_SUBST(SAVER_LIBS)
 AC_SUBST(MOTIF_LIBS)
 AC_SUBST(GTK_LIBS)
@@ -2394,6 +2451,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)
@@ -2414,6 +2472,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
@@ -2655,6 +2716,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