http://ftp.x.org/contrib/applications/xscreensaver-2.24.tar.gz
[xscreensaver] / configure.in
index 76ce4d2edcc10ce498b13b64d7ced16e30bcbb7f..be98708834421d676a1d1a7ced0448feda9ce4b0 100644 (file)
@@ -18,6 +18,10 @@ if test -z "$GCC"; then
       AC_MSG_RESULT(AIX: adding -qlanglvl=ansi -qhalt=e)
       CC="$CC -qlanglvl=ansi -qhalt=e"
     ;;
+
+# NOTE:   for Digital, need to add -std1 to get ANSI, but I'm not sure
+#         yet what $host pattern we should be testing for...
+
     *)
       AC_MSG_RESULT(no idea)
     ;;
@@ -60,21 +64,20 @@ AC_HEADER_DIRENT
 
 AC_TYPE_MODE_T
 AC_TYPE_PID_T
-AC_TYPE_SIGNAL
 AC_TYPE_SIZE_T
-
+AC_TYPE_SIGNAL
 
 AC_MSG_CHECKING(how to call gettimeofday)
 AC_CACHE_VAL(ac_cv_gettimeofday_args,
  [AC_TRY_COMPILE([#include <stdlib.h>
                  #include <sys/time.h>],
-                [struct timeval tv; gettimeofday(&tv);],
-                [ac_gettimeofday_args=1],
+                [struct timeval tv; struct timezone tzp;
+                 gettimeofday(&tv, &tzp);],
+                [ac_gettimeofday_args=2],
                 [AC_TRY_COMPILE([#include <stdlib.h>
                                  #include <sys/time.h>],
-                                [struct timeval tv; struct timezone tzp;
-                                 gettimeofday(&tv, &tzp);],
-                                [ac_gettimeofday_args=2],
+                                [struct timeval tv; gettimeofday(&tv);],
+                                [ac_gettimeofday_args=1],
                                 [ac_gettimeofday_args=0])])
   ac_cv_gettimeofday_args=$ac_gettimeofday_args])
 ac_gettimeofday_args=$ac_cv_gettimeofday_args
@@ -91,6 +94,8 @@ fi
 
 
 AC_CHECK_FUNCS(select fcntl uname nice setpriority getcwd getwd putenv)
+AC_CHECK_FUNCS(sigaction)
+
 AC_CHECK_HEADERS(unistd.h)
 
 dnl    /usr/local/src/ssh-1.2.17/putenv.c -- AC_REPLACE_FUNCS(putenv)
@@ -104,22 +109,26 @@ Installation options:
                           specify the name of the subdirectory.  For example,
                           --exec-prefix=/usr/local/bin --enable-subdir=demos
                           would put xscreensaver in /usr/local/bin/, and would
-                          put the demos in /usr/local/bin/demos/.  Note that if
-                          you do this, you must make sure that the directory
-                          is on your \$PATH before xscreensaver is started: the
-                          directory name is not hardcoded into the program.
-                          This merely sets the default installation location.
+                          put the demos in /usr/local/bin/demos/.  (If DIR
+                          begins with /, then bindir will not be prepended.)
 
   --disable-subdir        Just put the demos in \`bindir' (this is the default.)
 ],
   [enable_subdir="$enableval"],[enable_subdir=no])
 if test x"$enable_subdir" = xno; then
-  HACKDIR='$(bindir)'
+  HACKDIR='${bindir}'
 elif test x"$enable_subdir" = xyes -o x"$enable_subdir" = x ; then
   echo "error: must be a subdirectory name: --enable-subdir=$enable_subdir"
   exit 1
 else
-  HACKDIR='$(bindir)/'$enable_subdir
+  # there must be a better way than this...
+  if test -z "`echo $enable_subdir | sed 's@^/.*@@'`" ; then
+    # absolute path
+    HACKDIR=$enable_subdir
+  else
+    # relative path
+    HACKDIR='${bindir}/'$enable_subdir
+  fi
 fi
 
 
@@ -210,7 +219,9 @@ AC_DEFUN(AC_PATH_X_APP_DEFAULTS,
   [AC_REQUIRE_CPP()
     AC_CACHE_CHECK([for X app-defaults directory], ac_cv_x_app_defaults,
      [AC_PATH_X_APP_DEFAULTS_XMKMF
-      AC_PATH_X_APP_DEFAULTS_DIRECT
+      if test x"$ac_x_app_defaults" = x; then
+        AC_PATH_X_APP_DEFAULTS_DIRECT
+      fi
       if test x"$ac_x_app_defaults" = x; then
         ac_cv_x_app_defaults="/usr/lib/X11/app-defaults"
       else
@@ -331,15 +342,22 @@ case "$host" in
     if test -d /usr/contrib/X11R6/include ; then
       X_CFLAGS="-I/usr/contrib/X11R6/include $X_CFLAGS"
       X_LIBS="-L/usr/contrib/X11R6/lib $X_LIBS"
+    elif test -d /usr/X11R6/include ; then
+      X_CFLAGS="-I/usr/X11R6/include $X_CFLAGS"
+      X_LIBS="-L/usr/X11R6/lib $X_LIBS"
     elif test -d /usr/contrib/X11R5/include ; then
       X_CFLAGS="-I/usr/contrib/X11R5/include $X_CFLAGS"
       X_LIBS="-L/usr/contrib/X11R5/lib $X_LIBS"
+    elif test -d /usr/X11R5/include ; then
+      X_CFLAGS="-I/usr/X11R5/include $X_CFLAGS"
+      X_LIBS="-L/usr/X11R5/lib $X_LIBS"
     fi
 
   ;;
   *-solaris*)
     # Same to you, pinheads.  (Is this really the standard location now?
     # What happened to the joke that this kind of thing went in /opt?)
+    # cthomp says "answer: CDE (Common Disorganized Environment)"
     if test -f /usr/dt/include/Xm/Xm.h ; then
       X_CFLAGS="$X_CFLAGS -I/usr/dt/include"
       X_LIBS="$X_LIBS -L/usr/dt/lib -R:/usr/dt/lib"
@@ -411,7 +429,7 @@ fi
 have_sgi=no
 with_sgi_req=unspecified
 AC_ARG_WITH(sgi-ext,[
-Server options:
+X Server Extension options:
 
   --with-sgi-ext          Include support for the SGI SCREEN_SAVER
                           server extension, if possible (this is the default).
@@ -523,6 +541,20 @@ if test $with_xshm = yes; then
     AC_CHECK_X_HEADER(sys/shm.h, [have_xshm=yes])
   fi
 
+  # AIX is pathological, as usual: apparently it's normal for the Xshm headers
+  # to exist, but the library code to not exist.  And even better, the library
+  # code is in its own library: libXextSam.a.  So, if we're on AIX, and that
+  # lib doesn't exist, give up.
+  #
+  case "$host" in
+    *-aix*)
+      have_xshm=no
+      AC_CHECK_X_LIB(XextSam, XShmQueryExtension,
+                    [have_xshm=yes; SAVER_LIBS="$SAVER_LIBS -lXextSam"],
+                      [], -lX11 -lXext -lm)
+    ;;
+  esac
+
   # if that succeeded, then we've really got it.
   if test $have_xshm = yes; then
     AC_DEFINE(HAVE_XSHM_EXTENSION)
@@ -567,9 +599,37 @@ elif test $with_sgivc != no; then
 fi
 
 
+# Check for the DPMS server extension header.
+#
+have_dpms=no
+with_dpms_req=unspecified
+AC_ARG_WITH(dpms-ext,
+[  --with-dpms-ext         Include support for the DPMS server extension,
+                          if possible (this is the default).
+  --without-dpms-ext      Do not compile in support for this extension.],
+  [with_dpms="$withval"; with_dpms_req="$withval"],[with_dpms=yes])
+if test $with_dpms = yes; then
+
+  # first check for dpms.h
+  AC_CHECK_X_HEADER(X11/extensions/dpms.h, [have_dpms=yes])
+
+  # if that succeeded, then check for the -lXdpms
+  if test $have_dpms = yes; then
+    have_dpms=no
+    AC_CHECK_X_LIB(Xdpms, DPMSInfo,
+                 [have_dpms=yes; SAVER_LIBS="$SAVER_LIBS -lXdpms"], [],
+                 -lXext -lX11)
+  fi
 
+  # if that succeeded, then we've really got it.
+  if test $have_dpms = yes; then
+    AC_DEFINE(HAVE_DPMS_EXTENSION)
+  fi
 
-
+elif test $with_dpms != no; then
+  echo "error: must be yes or no: --with-dpms-ext=$with_dpms"
+  exit 1
+fi
 
 
 
@@ -577,11 +637,12 @@ fi
 #
 have_motif=no
 have_athena=no
+have_athena3d=no
 with_motif_req=unspecified
 with_athena_req=unspecified
 
 AC_ARG_WITH(motif,[
-Toolkit options:
+X Client Toolkit options:
 
   --with-motif            Use the Motif toolkit for the user interface,
                           if possible (this is the default).
@@ -627,10 +688,18 @@ check_motif() {
 }
 
 check_athena() {
-  AC_CHECK_X_HEADER(X11/Xaw/Dialog.h,
-                  [have_athena=yes
-                   AC_DEFINE(HAVE_ATHENA)
-                   SAVER_LIBS="-lXaw $SAVER_LIBS"])
+  have_athena=no
+  have_athena3d=no
+  AC_CHECK_X_HEADER(X11/Xaw/Dialog.h, [have_athena=yes])
+  AC_CHECK_X_LIB(Xaw3d, Xaw3dComputeTopShadowRGB,
+                [have_athena=yes; have_athena3d=yes], [],
+                -lXt -lXmu -lXext -lX11)
+
+  if test $have_athena3d = yes; then
+    SAVER_LIBS="-lXaw3d $SAVER_LIBS"
+  elif test $have_athena = yes; then
+    SAVER_LIBS="-lXaw $SAVER_LIBS"
+  fi
 }
 
 
@@ -722,12 +791,25 @@ if test $have_lesstif = yes ; then
 fi
 
 
+# Some versions of Motif (2.1.0, at least) require -lXp, the "X Printing
+# Extension".   Why this extension isn't in -lXext with all the others,
+# I have no idea.
+#
+have_xp_ext=no
+if test $have_motif = yes ; then
+   have_xp_ext=no
+   AC_CHECK_X_LIB(Xp, XpQueryExtension,
+                 [have_xp_ext=yes; SAVER_LIBS="$SAVER_LIBS -lXp"],
+                 [], -lX11 -lXext -lm)
+fi
+
+
 # check for XPM header.
 #
 have_xpm=no
 with_xpm_req=unspecified
 AC_ARG_WITH(xpm,[
-Demo options:
+Graphics Demo options:
 
   --with-xpm              Include support for XPM files in some demos,
                           if possible (this is the default).
@@ -816,7 +898,7 @@ if test $with_sgivideo = yes; then
     have_sgivideo=no
     AC_CHECK_LIB(vl, vlOpenVideo, have_sgivideo=yes)
     if test $have_sgivideo = yes; then
-      SGI_VIDEO_OBJS="$(UTILS_SRC)/sgivideo.o"
+      SGI_VIDEO_OBJS="$(UTILS_BIN)/sgivideo.o"
       SGI_VIDEO_LIBS="-lvl"
       AC_DEFINE(HAVE_SGI_VIDEO)
     fi
@@ -982,7 +1064,7 @@ with_shadow_req=unspecified
 need_setuid=no
 
 AC_ARG_ENABLE(locking,[
-Locking options:
+Screen Locking options:
 
   --enable-locking        Compile in support for locking the display
                           (this is the default.)
@@ -1140,6 +1222,24 @@ if test $enable_locking = yes; then
     fi
   fi
 
+  # On FreeBSD, getpwnam() and friends work just like on non-shadow-password
+  # systems -- except you only get stuff in the pw_passwd field if the running
+  # program is setuid.  So, guess that we've got this lossage to contend with
+  # if /etc/master.passwd exists, and default to a setuid installation.
+  #
+  if test $passwd_cruft_done = no ; then
+    AC_CACHE_CHECK([for FreeBSD-style shadow passwords], ac_cv_master_passwd,
+                  [if test -f /etc/master.passwd ; then
+                     ac_cv_master_passwd=yes
+                   else
+                     ac_cv_master_passwd=no
+                   fi])
+    if test $ac_cv_master_passwd = yes; then
+      need_setuid=yes
+      passwd_cruft_done=yes
+    fi
+  fi
+
   # On some systems (UnixWare 2.1), crypt() is in -lcrypt instead of -lc.
   have_crypt=no
   AC_CHECK_LIB(c, crypt, [have_crypt=yes])
@@ -1185,6 +1285,8 @@ DEPEND_FLAGS=
 DEPEND_DEFINES=
 
 
+# Autoconf doesn't seem to have an INSTALL_DIRS, so let's define our own...
+INSTALL_DIRS='$(INSTALL) -d'
 
 # Done testing things -- now substitute in some stuff for the Makefiles.
 #
@@ -1243,6 +1345,7 @@ AC_SUBST(XPM_LIBS)
 AC_SUBST(GL_LIBS)
 AC_SUBST(PASSWD_LIBS)
 AC_SUBST(INSTALL_SETUID)
+AC_SUBST(INSTALL_DIRS)
 AC_SUBST(NEED_SETUID)
 AC_SUBST(SGI_VIDEO_OBJS)
 AC_SUBST(SGI_VIDEO_LIBS)
@@ -1316,6 +1419,10 @@ if test $with_sgivc_req = yes -a $have_sgivc = no ; then
   warn 'The SGI-VIDEO-CONTROL extension was requested, but was not found.'
 fi
 
+if test $with_dpms_req = yes -a $have_dpms = no ; then
+  warn 'The DPMS extension was requested, but was not found.'
+fi
+
 if test $have_motif = no -a $have_athena = no ; then
   warnL "Neither Motif nor Athena widgets seem to be available;"
   warn2 "one or the other is required."
@@ -1391,3 +1498,37 @@ AC_OUTPUT(Makefile
          hacks/Makefile
          hacks/glx/Makefile
          driver/XScreenSaver.ad)
+
+# You are in a twisty maze of namespaces and syntaxes, all alike.
+# Fuck the skull of Unix.
+#
+eval bindir=${bindir}
+eval bindir=${bindir}
+eval bindir=${bindir}
+eval bindir=${bindir}
+eval bindir=${bindir}
+eval bindir=${bindir}
+eval HACKDIR=${HACKDIR}
+eval HACKDIR=${HACKDIR}
+eval HACKDIR=${HACKDIR}
+eval HACKDIR=${HACKDIR}
+eval HACKDIR=${HACKDIR}
+eval HACKDIR=${HACKDIR}
+
+echo ""
+echo "$warnsep"
+echo ""
+echo '      When you run "make install", the "xscreensaver" and'
+echo '      "xscreensaver-command" executables will be installed in'
+echo "      ${bindir}."
+echo ""
+echo "      The various graphics demos (60+ different executables) will"
+echo "      be installed in ${HACKDIR}."
+echo ""
+echo "      If you would prefer the demos to be installed elsewhere"
+echo "      (for example, in a dedicated directory) you should re-run"
+echo "      configure with the --enable-subdir=DIR option.  For more"
+echo "      information, run $0 --help."
+echo ""
+echo "$warnsep"
+echo ""