http://packetstormsecurity.org/UNIX/admin/xscreensaver-3.32.tar.gz
[xscreensaver] / configure.in
index 205480884039f217ff1927372f523fb6fb90a7a7..9fbdfe306982b546950a86c456d8b9b19eec1551 100644 (file)
@@ -46,7 +46,7 @@ AC_DEFUN(AC_PROG_CC_ANSI,
       ;;
 
       *-dec-* )
-        AC_MSG_RESULT(DEC: adding -std1)
+        AC_MSG_RESULT(DEC: adding -std1 -ieee)
         CC="$CC -std1"
       ;;
 
@@ -66,8 +66,6 @@ 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]* )
@@ -85,6 +83,63 @@ AC_DEFUN(AC_PROG_CC_ANSI,
 ])
 
 
+###############################################################################
+#
+#       Functions to figure out how to disable // comments in ANSI C code.
+#
+#       (With recent gcc, this is done with "-std=c89".  With older gcc, this
+#       is done by passing "-lang-c89" to cpp, by passing "-Wp,-lang-c89" to
+#       gcc.  Old gcc doesn't support -std, and new gcc doesn't support -lang.
+#       so much for compatibility!)
+#
+###############################################################################
+
+AC_DEFUN(AC_GCC_ACCEPTS_STD,
+ [if test -n "$GCC"; then
+   AC_CACHE_CHECK([whether gcc accepts -std],
+     ac_cv_gcc_accepts_std,
+    [if ( gcc -E -std=c89 - </dev/null 2>&1 >/dev/null | \
+          grep unrecognized >/dev/null ); then
+       ac_cv_gcc_accepts_std=no
+     else
+       ac_cv_gcc_accepts_std=yes
+     fi])
+   ac_gcc_accepts_std="$ac_cv_gcc_accepts_std"
+  fi
+])
+
+AC_DEFUN(AC_NO_CPLUSPLUS_COMMENTS_IN_C_CODE,
+ [if test -n "$GCC"; then
+   AC_GCC_ACCEPTS_STD
+   AC_MSG_RESULT(Disabling C++ comments in ANSI C code.)
+   #
+   # The reason that // comments are banned from xscreensaver is that gcc is
+   # basically the only compiler in the world that supports them in C code.
+   # All other vendors support them only in their C++ compilers, not in their
+   # ANSI C compilers.  This means that it's a portability problem: every time
+   # these comments have snuck into the xscreensaver source code, I've gotten
+   # complaints about it the next day.  So we turn off support for them in gcc
+   # as well to prevent them from accidentially slipping in.
+   #
+   if test "$ac_gcc_accepts_std" = yes ; then
+     #
+     # -std=c89 defines __STRICT_ANSI__, which we don't want.
+     # (That appears to be the only additional preprocessor symbol
+     # it defines, in addition to the syntax changes it makes.)
+     #
+     # -std=gnu89 is no good, because // comments were a GNU extension
+     # before they were in the ANSI C 99 spec...  (gcc 2.96 permits //
+     # with -std=gnu89 but not with -std=c89.)
+     #
+     CC="$CC -std=c89 -U__STRICT_ANSI__"
+   else
+     # The old way:
+     CC="$CC -Wp,-lang-c89"
+   fi
+  fi
+])
+
+
 ###############################################################################
 #
 #       Function to figure out how to create directory trees.
@@ -250,7 +305,12 @@ AC_DEFUN(AC_CHECK_ICMP,
                    i.icmp_id = 0;
                    i.icmp_seq = 0;
                    si.sin_family = AF_INET;
-                   ip.ip_hl = 0;],
+                   #if defined(__DECC) || defined(_IP_VHL)
+                   ip.ip_vhl = 0;
+                   #else
+                   ip.ip_hl = 0;
+                   #endif
+                   ],
                   [ac_cv_have_icmp=yes],
                   [ac_cv_have_icmp=no])])
  if test "$ac_cv_have_icmp" = yes ; then
@@ -674,6 +734,7 @@ AC_DEFUN(HANDLE_X_PATH_ARG, [
 # random compiler setup
 AC_CANONICAL_HOST
 AC_PROG_CC_ANSI
+AC_NO_CPLUSPLUS_COMMENTS_IN_C_CODE
 AC_PROG_CPP
 AC_C_CONST
 AC_C_INLINE
@@ -684,6 +745,13 @@ AC_PROG_INSTALL
 AC_PROG_INSTALL_DIRS
 AC_PROG_MAKE_SET
 
+# By default, autoconf sets INSTALL_SCRIPT to '${INSTALL_PROGRAM}'.
+# That's wrong: it should be set to '${INSTALL}', so that one can
+# implement the "install-strip" target properly (strip executables,
+# but do not try to strip scripts.)
+#
+INSTALL_SCRIPT='${INSTALL}'
+
 # random libc stuff
 AC_HEADER_STDC
 AC_CHECK_HEADERS(unistd.h)
@@ -705,7 +773,7 @@ AC_PROG_PERL
 
 if test -z "$PERL" ; then
   # don't let it be blank...
-  PERL=/usr/local/bin/perl5
+  PERL=/usr/bin/perl
 fi
 
 AC_PATH_XTRA
@@ -731,13 +799,11 @@ AC_CHECK_X_HEADER(X11/Xmu/Error.h, [have_xmu=yes])
 if test "$have_xmu" = no ; then
   XMU_SRCS='$(UTILS_SRC)/xmu.c'
   XMU_OBJS='$(UTILS_BIN)/xmu.o'
+  XMU_LIBS=''
 else
   XMU_SRCS=''
   XMU_OBJS=''
-  SAVER_LIBS="-lXmu $SAVER_LIBS"
-  HACK_LIBS="-lXmu $HACK_LIBS"
-  MOTIF_LIBS="-lXmu $MOTIF_LIBS"
-  GTK_LIBS="-lXmu $GTK_LIBS"
+  XMU_LIBS='-lXmu'
   AC_DEFINE(HAVE_XMU)
 fi
 
@@ -1007,7 +1073,7 @@ if test "$with_dpms" = yes; then
     # if that failed, look in -lXdpms (this is where it was in XFree86 3.x)
     if test "$have_dpms" = no; then
       AC_CHECK_X_LIB(Xdpms, DPMSInfo,
-                    [have_dpms=yes; SAVER_LIBS="$SAVER_LIBS -lXdpms"], [true],
+                    [have_dpms=yes; XDPMS_LIBS="-lXdpms"], [true],
                     -lXext -lX11)
     fi
   fi
@@ -1026,7 +1092,7 @@ fi
 
 ###############################################################################
 #
-#       Check for the XF86VMODE server extension.
+#       Check for the XF86VMODE server extension (for virtual screens.)
 #
 ###############################################################################
 
@@ -1063,6 +1129,54 @@ elif test "$with_xf86vmode" != no; then
 fi
 
 
+###############################################################################
+#
+#       Check for the XF86VMODE server extension (for gamma fading.)
+#
+###############################################################################
+
+have_xf86gamma=no
+with_xf86gamma_req=unspecified
+AC_ARG_WITH(xf86gamma-ext,
+[  --with-xf86gamma-ext    Include support for XFree86 gamma fading.],
+  [with_xf86gamma="$withval"; with_xf86gamma_req="$withval"],
+  [with_xf86gamma=yes])
+
+HANDLE_X_PATH_ARG(with_xf86gamma, --with-xf86gamma-ext, xf86gamma)
+
+if test "$with_xf86gamma" = yes; then
+
+  # first check for xf86vmode.h, if we haven't already
+  if test "$have_xf86vmode" = yes; then
+    have_xf86gamma=yes
+  else
+    AC_CHECK_X_HEADER(X11/extensions/xf86vmode.h, [have_xf86gamma=yes])
+  fi
+
+  # if that succeeded, then check for the -lXxf86vm
+  if test "$have_xf86gamma" = yes; then
+    have_xf86gamma=no
+    AC_CHECK_X_LIB(Xxf86vm, XF86VidModeSetGamma,
+                  [have_xf86gamma=yes],
+                   [true], -lXext -lX11)
+  fi
+
+  # pull in the lib, if we haven't already
+  if test "$have_xf86gamma" = yes -a "$have_xf86vmode" = no; then
+    SAVER_LIBS="$SAVER_LIBS -lXxf86vm"
+  fi
+
+  # if that succeeded, then we've really got it.
+  if test "$have_xf86gamma" = yes; then
+    AC_DEFINE(HAVE_XF86VMODE_GAMMA)
+  fi
+
+elif test "$with_xf86gamma" != no; then
+  echo "error: must be yes or no: --with-xf86gamma-ext=$with_xf86vmode"
+  exit 1
+fi
+
+
 ###############################################################################
 #
 #       Check for HP XHPDisableReset and XHPEnableReset.
@@ -1914,7 +2028,7 @@ if test "$with_gl" = yes; then
     #
     AC_CACHE_CHECK([whether GL is really MesaGL], ac_cv_have_mesa_gl,
       [ac_cv_have_mesa_gl=no
-       AC_EGREP_X_HEADER(Mesa, GL/glx.h, [ac_cv_have_mesa_gl=yes])
+       AC_EGREP_X_HEADER(Mesa|MESA, GL/glx.h, [ac_cv_have_mesa_gl=yes])
       ])
     ac_have_mesa_gl=$ac_cv_have_mesa_gl
  
@@ -1980,6 +2094,11 @@ if test "$with_gl" = yes; then
 #line __oline__ "configure"
 #include "confdefs.h"
 #include <GL/gl.h>
+#ifndef MESA_MAJOR_VERSION
+# include <GL/xmesa.h>
+# define MESA_MAJOR_VERSION XMESA_MAJOR_VERSION
+# define MESA_MINOR_VERSION XMESA_MINOR_VERSION
+#endif
 configure: MESA_MAJOR_VERSION MESA_MINOR_VERSION
 EOF
 
@@ -2262,38 +2381,6 @@ elif test "$with_readdisplay" != no; then
 fi
 
 
-###############################################################################
-#
-#       Check for the SGI Iris Video Library.
-#
-###############################################################################
-
-have_sgivideo=no
-with_sgivideo_req=unspecified
-AC_ARG_WITH(sgivideo,
-[  --with-sgivideo         Include support for SGI's Iris Video Library.],
-  [with_sgivideo="$withval"; with_sgivideo_req="$withval"],
-  [with_sgivideo=yes])
-
-HANDLE_X_PATH_ARG(with_sgivideo, --with-sgivideo, Iris Video)
-
-if test "$with_sgivideo" = yes; then
-  AC_CHECK_X_HEADER(dmedia/vl.h, have_sgivideo=yes)
-  if test "$have_sgivideo" = yes; then
-    have_sgivideo=no
-    AC_CHECK_LIB(vl, vlOpenVideo, [have_sgivideo=yes])
-    if test "$have_sgivideo" = yes; then
-      SGI_VIDEO_OBJS="$(UTILS_BIN)/sgivideo.o"
-      SGI_VIDEO_LIBS="-lvl"
-      AC_DEFINE(HAVE_SGI_VIDEO)
-    fi
-  fi
-elif test "$with_sgivideo" != no; then
-  echo "error: must be yes or no: --with-sgivideo=$with_sgivideo"
-  exit 1
-fi
-
-
 ###############################################################################
 #
 #       Check for a program to generate random text.
@@ -2317,8 +2404,7 @@ AC_ARG_WITH(zippy,[
                           default (though it can be overridden with X
                           resources.)  If you don't specify this, the default
                           is to use \"yow\" from the Emacs distribution (if you
-                          have it) or else to use \"fortune\".
-],
+                          have it) or else to use \"fortune\".],
   [with_zippy_req="$withval"; with_zippy="$withval"],[with_zippy=yes])
 
 if test "$with_zippy" = no || test "$with_zippy" = yes ; then
@@ -2453,6 +2539,31 @@ fi
 AC_DEFINE_UNQUOTED(ZIPPY_PROGRAM, "$ac_cv_zippy_program")
 
 
+###############################################################################
+#
+#       Check whether it's ok to install some hacks as setuid (e.g., "sonar")
+#       This should be safe, but let's give people the option.
+#
+###############################################################################
+
+setuid_hacks_default=no
+setuid_hacks="$setuid_hacks_default"
+AC_ARG_WITH(setuid-hacks,
+[  --with-setuid-hacks     Allow some demos to be installed \`setuid root'
+                          (which is needed in order to ping other hosts.)
+],
+  [setuid_hacks="$withval"], [setuid_hacks="$setuid_hacks_default"])
+
+HANDLE_X_PATH_ARG(setuid_hacks, --with-setuid-hacks, setuid hacks)
+
+if test "$setuid_hacks" = yes; then
+  true
+elif test "$setuid_hacks" != no; then
+  echo "error: must be yes or no: --with-setuid-hacks=$setuid_hacks"
+  exit 1
+fi
+
+
 ###############################################################################
 #
 #       Done testing.  Now, set up the various -I and -L variables,
@@ -2507,12 +2618,18 @@ else
   LOCK_OBJS='$(NOLOCK_OBJS_1)'
 fi
 
+INSTALL_SETUID='$(INSTALL_PROGRAM) $(SUID_FLAGS)'
+
 if test "$need_setuid" = yes; then
   NEED_SETUID=yes
-  INSTALL_SETUID='$(INSTALL) $(SUID_FLAGS)'
 else
   NEED_SETUID=no
-  INSTALL_SETUID='$(INSTALL_PROGRAM)'
+fi
+
+if test "$setuid_hacks" = yes; then
+  SETUID_HACKS=yes
+else
+  SETUID_HACKS=no
 fi
 
 tab='  '
@@ -2550,18 +2667,19 @@ AC_SUBST(HACK_LIBS)
 AC_SUBST(XPM_LIBS)
 AC_SUBST(GL_LIBS)
 AC_SUBST(GLE_LIBS)
+AC_SUBST(XDPMS_LIBS)
 AC_SUBST(PASSWD_LIBS)
 AC_SUBST(INSTALL_SETUID)
+AC_SUBST(SETUID_HACKS)
 AC_SUBST(INSTALL_DIRS)
 AC_SUBST(NEED_SETUID)
 AC_SUBST(INSTALL_PAM)
-AC_SUBST(SGI_VIDEO_OBJS)
-AC_SUBST(SGI_VIDEO_LIBS)
 
 AC_SUBST(PASSWD_SRCS)
 AC_SUBST(PASSWD_OBJS)
 AC_SUBST(XMU_SRCS)
 AC_SUBST(XMU_OBJS)
+AC_SUBST(XMU_LIBS)
 AC_SUBST(SAVER_GL_SRCS)
 AC_SUBST(SAVER_GL_OBJS)
 AC_SUBST(SAVER_GL_LIBS)
@@ -2615,7 +2733,8 @@ warn() {
   warnpre
   if test "$warning" = long ; then echo '' ; fi
   warning=yes
-  echo "$warn_prefix $@"
+  rest="$@"
+  echo "$warn_prefix $rest"
 }
 
 warnL() {
@@ -2623,11 +2742,13 @@ warnL() {
   warnpre
   warning=yes
   if test "$was" != no ; then echo '' ; fi
-  echo "$warn_prefix $@"
+  rest="$@"
+  echo "$warn_prefix $rest"
 }
 
 warn2() {
-  echo "             $@"
+  rest="$@"
+  echo "             $rest"
   warning=long
 }
 
@@ -2835,10 +2956,6 @@ if test "$with_readdisplay_req" = yes -a "$have_readdisplay" = no ; then
   warn 'Use of XReadDisplay was requested, but it was not found.'
 fi
 
-if test "$with_sgivideo_req" = yes -a "$have_sgivideo" = no ; then
-  warn 'Use of the Iris Video Library was requested, but it was not found.'
-fi
-
 if test -n "$with_zippy_req"; then
   if test "$with_zippy_req" != "$ac_cv_zippy_program" ; then
     warnL "$with_zippy_req was requested as the Zippy program,"
@@ -2899,7 +3016,7 @@ do_dir_warning=no
 # M4 sucks!!
 changequote(X,Y)
 rpmv=`(rpm -qv xscreensaver) 2>&- | \
-      sed 's/^xscreensaver-\([0-9][0-9]*[.][0-9][0-9]*\)-.*$/\1/'`
+      sed -n 's/^xscreensaver-\([0-9][0-9]*[.][0-9][0-9]*\)-.*$/\1/p'`
 changequote([,])
 
 if test \! -z "$rpmv" ; then
@@ -2953,7 +3070,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 (100+ different executables) will"
+  echo "      The various graphics demos (120+ different executables) will"
   echo "      also be installed in ${HACKDIR}."
   echo ""
   echo "      If you would prefer the demos to be installed elsewhere"