http://ftp.x.org/contrib/applications/xscreensaver-3.02.tar.gz
[xscreensaver] / configure.in
1 # configure.in --- xscreensaver, Copyright (c) 1997 Jamie Zawinski.
2 #
3
4 AC_INIT(driver/subprocs.c)
5
6 echo -n "current directory: "
7 pwd
8 echo "command line was: $0 $@"
9
10 AC_CONFIG_HEADER(config.h)
11 AC_CANONICAL_HOST
12
13 AC_PROG_CC
14
15 if test -z "$GCC"; then
16   AC_MSG_CHECKING(how to request ANSI compilation)
17   case "$host" in
18     *-hpux*)
19       AC_MSG_RESULT(HPUX: adding -Ae)
20       CC="$CC -Ae"
21     ;;
22     *-aix*)
23       AC_MSG_RESULT(AIX: adding -qlanglvl=ansi -qhalt=e)
24       CC="$CC -qlanglvl=ansi -qhalt=e"
25     ;;
26
27     *-dec-*)
28       AC_MSG_RESULT(DEC: adding -std1)
29       CC="$CC -std1"
30     ;;
31
32     *)
33       AC_MSG_RESULT(no idea)
34     ;;
35   esac
36 fi
37
38
39 AC_MSG_CHECKING([whether the compiler works on ANSI C])
40 AC_TRY_RUN([ main(int ac, char **av) { return 0; } ],
41    AC_MSG_RESULT(yes),
42    AC_MSG_RESULT(no)
43    AC_MSG_ERROR(Couldn't build even a trivial ANSI C program: check CC.),
44    AC_MSG_ERROR(Couldn't build even a trivial ANSI C program: check CC.))
45
46 case "$host" in
47   *-irix5* |*-irix6.[0-3]* )
48     if test -n "$GCC"; then
49       AC_MSG_RESULT(Turning on gcc compiler warnings.)
50       CC="$CC -Wall -Wstrict-prototypes -Wnested-externs -Wno-format"
51     else
52       # not gcc
53       AC_MSG_RESULT(Turning on SGI compiler warnings.)
54       CC="$CC -fullwarn -use_readonly_const -rdata_shared -g3"
55     fi
56   ;;
57
58     *-linux-*)
59       AC_MSG_RESULT(Turning on gcc compiler warnings.)
60       CC="$CC -Wall -Wstrict-prototypes -Wnested-externs -Wno-format"
61   ;;
62
63 #  *-dec-osf*)
64 #    if test -z "$GCC"; then
65 #      AC_MSG_RESULT(Turning on DEC C compiler warnings.)
66 #      CC="$CC -migrate -w0 -verbose -warnprotos"
67 #    fi
68 #  ;;
69
70 esac
71
72
73 # Try and determine whether ${INSTALL} can create intermediate directories,
74 # and if not, whether "mkdir -p" works instead.  This sets ${INSTALL_DIRS}.
75 # (But autoconf should earn its keep and do this for us!)
76 #
77 AC_DEFUN(AC_PROG_INSTALL_DIRS,
78   [INSTALL_DIRS='${INSTALL} -d'
79    AC_MSG_CHECKING(whether \"\${INSTALL} -d\" creates intermediate directories)
80    rm -rf conftestdir
81    if mkdir conftestdir; then
82       cd conftestdir >&-
83
84       ${INSTALL} -d `pwd`/dir1/dir2 >&- 2>&-
85       if test -d dir1/dir2 ; then
86         AC_MSG_RESULT(yes)
87       else
88         AC_MSG_RESULT(no)
89         AC_MSG_CHECKING(whether \"mkdir -p\" creates intermediate directories)
90         rm -rf dir1
91         mkdir -p dir1/dir2 >&- 2>&-
92         if test -d dir1/dir2/. ; then
93           AC_MSG_RESULT(yes)
94           INSTALL_DIRS='mkdir -p'
95         else
96           AC_MSG_RESULT(no)
97         fi
98       fi
99       cd .. >&-
100       rm -rf conftestdir
101    fi
102 ])
103
104
105 AC_PROG_CPP
106 AC_PROG_INSTALL
107 AC_PROG_INSTALL_DIRS
108 AC_PROG_MAKE_SET
109
110 AC_C_CONST
111 AC_C_INLINE
112
113 AC_HEADER_STDC
114 AC_HEADER_TIME
115 AC_HEADER_SYS_WAIT
116 AC_HEADER_DIRENT
117
118 AC_TYPE_MODE_T
119 AC_TYPE_PID_T
120 AC_TYPE_SIZE_T
121 AC_TYPE_SIGNAL
122
123 AC_MSG_CHECKING(how to call gettimeofday)
124 AC_CACHE_VAL(ac_cv_gettimeofday_args,
125  [AC_TRY_COMPILE([#include <stdlib.h>
126                   #include <sys/time.h>],
127                  [struct timeval tv; struct timezone tzp;
128                   gettimeofday(&tv, &tzp);],
129                  [ac_gettimeofday_args=2],
130                  [AC_TRY_COMPILE([#include <stdlib.h>
131                                   #include <sys/time.h>],
132                                  [struct timeval tv; gettimeofday(&tv);],
133                                  [ac_gettimeofday_args=1],
134                                  [ac_gettimeofday_args=0])])
135   ac_cv_gettimeofday_args=$ac_gettimeofday_args])
136 ac_gettimeofday_args=$ac_cv_gettimeofday_args
137 if test "$ac_gettimeofday_args" = 1 ; then
138   AC_DEFINE(HAVE_GETTIMEOFDAY)
139   AC_MSG_RESULT(one argument)
140 elif test "$ac_gettimeofday_args" = 2 ; then
141   AC_DEFINE(HAVE_GETTIMEOFDAY)
142   AC_DEFINE(GETTIMEOFDAY_TWO_ARGS)
143   AC_MSG_RESULT(two arguments)
144 else
145   AC_MSG_RESULT(unknown)
146 fi
147
148
149 AC_CHECK_FUNCS(select fcntl uname nice setpriority getcwd getwd putenv)
150 AC_CHECK_FUNCS(sigaction syslog)
151
152 AC_CHECK_HEADERS(unistd.h crypt.h sys/select.h)
153
154 dnl     /usr/local/src/ssh-1.2.17/putenv.c -- AC_REPLACE_FUNCS(putenv)
155
156
157 AC_ARG_ENABLE(subdir,[
158 Installation options:
159
160   --enable-subdir=DIR     Put the demo programs in a subdirectory of \`bindir',
161                           instead of putting them in bindir itself.  You can
162                           specify the name of the subdirectory.  For example,
163                           --exec-prefix=/usr/local/bin --enable-subdir=demos
164                           would put xscreensaver in /usr/local/bin/, and would
165                           put the demos in /usr/local/bin/demos/.  (If DIR
166                           begins with /, then bindir will not be prepended.)
167
168   --disable-subdir        Just put the demos in \`bindir' (this is the default.)
169 ],
170   [enable_subdir="$enableval"],[enable_subdir=no])
171 if test x"$enable_subdir" = xno; then
172   HACKDIR='${bindir}'
173 elif test x"$enable_subdir" = xyes -o x"$enable_subdir" = x ; then
174   echo "error: must be a subdirectory name: --enable-subdir=$enable_subdir"
175   exit 1
176 else
177   # there must be a better way than this...
178   if test -z "`echo $enable_subdir | sed 's@^/.*@@'`" ; then
179     # absolute path
180     HACKDIR=$enable_subdir
181   else
182     # relative path
183     HACKDIR='${bindir}/'$enable_subdir
184   fi
185 fi
186
187
188 AC_PATH_XTRA
189
190 # Try and find the app-defaults directory.
191 # It sucks that autoconf doesn't do this already...
192 #
193 AC_DEFUN(AC_PATH_X_APP_DEFAULTS_XMKMF,[
194   rm -fr conftestdir
195   if mkdir conftestdir; then
196     cd conftestdir >&-
197     # Make sure to not put "make" in the Imakefile rules, since we grep it out.
198     cat > Imakefile <<'EOF'
199 acfindx:
200         @echo 'ac_x_app_defaults="${XAPPLOADDIR}"'
201 EOF
202     if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
203       # GNU make sometimes prints "make[1]: Entering...", which'd confuse us.
204       eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
205     fi
206     cd .. >&-
207     rm -fr conftestdir
208   fi])
209
210 AC_DEFUN(AC_PATH_X_APP_DEFAULTS_DIRECT,[
211   # Look for the directory under a standard set of common directories.
212   # Check X11 before X11Rn because it's often a symlink to the current release.
213   for ac_dir in                                 \
214     /usr/X11/lib/app-defaults                   \
215     /usr/X11R6/lib/app-defaults                 \
216     /usr/X11R6/lib/X11/app-defaults             \
217     /usr/X11R5/lib/app-defaults                 \
218     /usr/X11R5/lib/X11/app-defaults             \
219     /usr/X11R4/lib/app-defaults                 \
220     /usr/X11R4/lib/X11/app-defaults             \
221                                                 \
222     /usr/lib/X11/app-defaults                   \
223     /usr/lib/X11R6/app-defaults                 \
224     /usr/lib/X11R5/app-defaults                 \
225     /usr/lib/X11R4/app-defaults                 \
226                                                 \
227     /usr/local/X11/lib/app-defaults             \
228     /usr/local/X11R6/lib/app-defaults           \
229     /usr/local/X11R5/lib/app-defaults           \
230     /usr/local/X11R4/lib/app-defaults           \
231                                                 \
232     /usr/local/lib/X11/app-defaults             \
233     /usr/local/lib/X11R6/app-defaults           \
234     /usr/local/lib/X11R6/X11/app-defaults       \
235     /usr/local/lib/X11R5/app-defaults           \
236     /usr/local/lib/X11R5/X11/app-defaults       \
237     /usr/local/lib/X11R4/app-defaults           \
238     /usr/local/lib/X11R4/X11/app-defaults       \
239                                                 \
240     /usr/X386/lib/X11/app-defaults              \
241     /usr/x386/lib/X11/app-defaults              \
242     /usr/XFree86/lib/X11/app-defaults           \
243                                                 \
244     /usr/lib/X11/app-defaults                   \
245     /usr/local/lib/X11/app-defaults             \
246     /usr/unsupported/lib/X11/app-defaults       \
247     /usr/athena/lib/X11/app-defaults            \
248     /usr/local/x11r5/lib/X11/app-defaults       \
249     /usr/lpp/Xamples/lib/X11/app-defaults       \
250     /lib/usr/lib/X11/app-defaults               \
251                                                 \
252     /usr/openwin/lib/app-defaults               \
253     /usr/openwin/lib/X11/app-defaults           \
254     /usr/openwin/share/lib/app-defaults         \
255     /usr/openwin/share/lib/X11/app-defaults     \
256                                                 \
257     /X11R6/lib/app-defaults                     \
258     /X11R5/lib/app-defaults                     \
259     /X11R4/lib/app-defaults                     \
260     ; \
261   do
262     if test -d "$ac_dir"; then
263       ac_x_app_defaults=$ac_dir
264       break
265     fi
266   done
267 ])
268
269
270 AC_DEFUN(AC_PATH_X_APP_DEFAULTS,
271   [AC_REQUIRE_CPP()
272     AC_CACHE_CHECK([for X app-defaults directory], ac_cv_x_app_defaults,
273      [AC_PATH_X_APP_DEFAULTS_XMKMF
274       if test x"$ac_x_app_defaults" = x; then
275         AC_PATH_X_APP_DEFAULTS_DIRECT
276       fi
277       if test x"$ac_x_app_defaults" = x; then
278         ac_cv_x_app_defaults="/usr/lib/X11/app-defaults"
279       else
280         # Record where we found app-defaults for the cache.
281         ac_cv_x_app_defaults="$ac_x_app_defaults"
282       fi])
283     eval ac_x_app_defaults="$ac_cv_x_app_defaults"])
284
285 AC_PATH_X_APP_DEFAULTS
286
287 APPDEFAULTS=$ac_x_app_defaults
288
289
290 # Like AC_CHECK_HEADER, but it uses the already-computed -I directories.
291 #
292 AC_DEFUN(AC_CHECK_X_HEADER, [
293   ac_save_CPPFLAGS="$CPPFLAGS"
294   if test \! -z "$includedir" ; then 
295     CPPFLAGS="$CPPFLAGS -I$includedir"
296   fi
297   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
298   AC_CHECK_HEADER([$1], [$2])
299   CPPFLAGS="$ac_save_CPPFLAGS"])
300
301 # Like AC_EGREP_HEADER, but it uses the already-computed -I directories.
302 #
303 AC_DEFUN(AC_EGREP_X_HEADER, [
304   ac_save_CPPFLAGS="$CPPFLAGS"
305   if test \! -z "$includedir" ; then 
306     CPPFLAGS="$CPPFLAGS -I$includedir"
307   fi
308   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
309   AC_EGREP_HEADER([$1], [$2], [$3], [$4])
310   CPPFLAGS="$ac_save_CPPFLAGS"])
311
312 # Like AC_TRY_COMPILE, but it uses the already-computed -I directories.
313 #
314 AC_DEFUN(AC_TRY_X_COMPILE, [
315   ac_save_CPPFLAGS="$CPPFLAGS"
316   if test \! -z "$includedir" ; then 
317     CPPFLAGS="$CPPFLAGS -I$includedir"
318   fi
319   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
320   AC_TRY_COMPILE([$1], [$2], [$3], [$4])
321   CPPFLAGS="$ac_save_CPPFLAGS"])
322
323
324 # Like AC_CHECK_LIB, but it uses the already-computed -I and -L directories.
325 # Use this sparingly; it probably doesn't work very well on X programs.
326 #
327 AC_DEFUN(AC_CHECK_X_LIB, [
328   ac_save_CPPFLAGS="$CPPFLAGS"
329   ac_save_LDFLAGS="$LDFLAGS"
330
331   if test \! -z "$includedir" ; then 
332     CPPFLAGS="$CPPFLAGS -I$includedir"
333   fi
334   # note: $X_CFLAGS includes $x_includes
335   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
336
337   if test \! -z "$libdir" ; then
338     LDFLAGS="$LDFLAGS -L$libdir"
339   fi
340   # note: $X_LIBS includes $x_libraries
341   LDFLAGS="$LDFLAGS $X_LIBS"
342
343   AC_CHECK_LIB([$1], [$2], [$3], [$4], [$5])
344   CPPFLAGS="$ac_save_CPPFLAGS"
345   LDFLAGS="$ac_save_LDFLAGS"])
346
347 # Like AC_TRY_RUN, but it uses the already-computed -I directories.
348 # (But not the -L directories!)
349 #
350 AC_DEFUN(AC_TRY_X_RUN, [
351   ac_save_CPPFLAGS="$CPPFLAGS"
352   if test \! -z "$includedir" ; then 
353     CPPFLAGS="$CPPFLAGS -I$includedir"
354   fi
355   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
356   AC_TRY_RUN([$1], [$2], [$3], [$4])
357   CPPFLAGS="$ac_save_CPPFLAGS"])
358
359
360
361 # Usage: HANDLE_X_PATH_ARG([variable_name],
362 #                          [--command-line-option],
363 #                          [descriptive string])
364 #
365 # All of the --with options take three forms:
366 #
367 #   --with-foo (or --with-foo=yes)
368 #   --without-foo (or --with-foo=no)
369 #   --with-foo=/DIR
370 #
371 # This function, HANDLE_X_PATH_ARG, deals with the /DIR case.  When it sees
372 # a directory (string beginning with a slash) it checks to see whether
373 # /DIR/include and /DIR/lib exist, and adds them to $X_CFLAGS and $X_LIBS
374 # as appropriate.
375 #
376 AC_DEFUN(HANDLE_X_PATH_ARG, [
377    case "$[$1]" in
378     yes) ;;
379     no)  ;;
380
381     /*)
382      AC_MSG_CHECKING([for [$3] headers])
383      d=$[$1]/include
384      if test -d $d; then
385        X_CFLAGS="-I$d $X_CFLAGS"
386        AC_MSG_RESULT($d)
387      else
388        AC_MSG_RESULT(not found ($d: no such directory))
389      fi
390
391      AC_MSG_CHECKING([for [$3] libs])
392      d=$[$1]/lib
393      if test -d $d; then
394        X_LIBS="-L$d $X_LIBS"
395        AC_MSG_RESULT($d)
396      else
397        AC_MSG_RESULT(not found ($d: no such directory))
398      fi
399
400      # replace the directory string with "yes".
401      [$1]_req="yes"
402      [$1]=$[$1]_req
403      ;;
404
405     *)
406      echo ""
407      echo "error: argument to [$2] must be \"yes\", \"no\", or a directory."
408      echo "       If it is a directory, then \`DIR/include' will be added to"
409      echo "       the -I list, and \`DIR/lib' will be added to the -L list."
410      exit 1
411      ;;
412    esac
413
414    # why is this necessary?
415    # if we don't do this, then "./configure --with-motif=/usr/local/lesstif"
416    # behaves as if "--with-zippy=/usr/local/lesstif" was also present!
417    withval=
418   ])
419
420
421
422 # check for the HP XHPDisableReset server extension headers.
423 #
424 AC_EGREP_X_HEADER(XHPDisableReset, X11/XHPlib.h,
425                   [AC_DEFINE(HAVE_XHPDISABLERESET)
426                    SAVER_LIBS="-lXhp11 $SAVER_LIBS"])
427
428
429 # Check for the availability of the XPointer typedef, and define it otherwise.
430 #
431 AC_CACHE_CHECK([for XPointer], ac_cv_xpointer,
432                 [AC_TRY_X_COMPILE([#include <X11/Xlib.h>],
433                                   [XPointer foo = (XPointer) 0;],
434                                   [ac_cv_xpointer=yes],
435                                   [ac_cv_xpointer=no])])
436 if test "$ac_cv_xpointer" != yes; then
437   AC_DEFINE(XPointer,[char*])
438 fi
439
440
441 # Random special-cases for certain pathological OSes.  You know who you are.
442 #
443 case "$host" in
444   *-hpux*)
445
446     # The following arcana was gleaned from conversations with
447     # Eric Schwartz <erics@col.hp.com>:
448     #
449     # On HPUX 10.x, the parts of X that HP considers "standard" live in
450     # /usr/{include,lib}/X11R6/.  The parts that HP doesn't consider
451     # "standard", notably, Xaw and Xmu, live in /usr/contrib/X11R6/.
452     # Also, there are symlinks from /usr/include/ and /usr/lib/ into
453     # /usr/{include,lib}/X11R6/, so that (if you don't use Xmu at all)
454     # you don't need any -I or -L arguments.
455     #
456     # On HPUX 9.x, /usr/{include,lib}/X11R5/ and /usr/contrib/X11R5/
457     # are the same division as 10.x.  However, there are no symlinks to
458     # the X stuff from /usr/include/ and /usr/lib/, so -I and -L
459     # arguments are always necessary.
460     #
461     # However, X11R6 was available on HPUX 9.x as a patch: if that
462     # patch was installed, then all of X11R6 went in to
463     # /usr/contrib/X11R6/ (there was no /usr/{include,lib}/X11R6/.)
464     #
465     # HPUX 8.x was the same as 9.x, but was X11R4 instead (I don't know
466     # whether R5 was available as a patch; R6 undoubtedly was not.)
467     #
468     # So.  We try and use the highest numbered pair of
469     # /usr/{include,lib}/X11R?/ and /usr/contrib/X11R?/{include,lib}/
470     # that are available.  We do not mix and match different versions
471     # of X.
472     #
473     # Questions I still don't know the answers to: (do you?)
474     #
475     #   * Does HPUX 10.x come with /usr/contrib/X11R6/ standard?  
476     #     Or does that need to be installed separately?
477     #
478     #   * On HPUX 9.x, where /usr/include/X11R5/ was standard, and
479     #     /usr/contrib/X11R6/ could be installed as a patch, what was in
480     #     that contrib directory?  Did it contain so-called "standard"
481     #     X11R6, or did it include Xaw and Xmu as well?  If the former,
482     #     where did one find Xaw and Xmu on 9.x R6 systems?  Would this
483     #     be a situation where one had to reach into the R5 headers and
484     #     libs to find Xmu?  That is, must both R6 and R5 directories
485     #     be on the -I and -L lists in that case?
486     #
487     for version in X11R6 X11R5 X11R4 ; do
488       # if either pair of directories exists...
489       if test -d /usr/lib/$version || test -d /usr/contrib/$version/lib ; then
490          # if contrib exists, use it...
491          if test -d /usr/contrib/$version/lib ; then
492            X_CFLAGS="$X_CFLAGS -I/usr/contrib/$version/include"
493            X_LIBS="$X_LIBS -L/usr/contrib/$version/lib"
494          fi
495          # if the "standard" one exists, use it.
496          if test -d /usr/lib/$version ; then
497            X_CFLAGS="$X_CFLAGS -I/usr/include/$version"
498            X_LIBS="$X_LIBS -L/usr/lib/$version"
499          fi
500          # since at least one of the pair exists, go no farther.
501          break
502       fi
503     done
504
505     # Now find Motif.  Thanks for not making xmkmf find this by
506     # default, you losers.
507     #
508     if test -d /usr/lib/Motif1.2 ; then
509       X_CFLAGS="$X_CFLAGS -I/usr/include/Motif1.2"
510       X_LIBS="$X_LIBS -L/usr/lib/Motif1.2"
511     elif test -d /usr/lib/Motif1.1 ; then
512       X_CFLAGS="$X_CFLAGS -I/usr/include/Motif1.1"
513       X_LIBS="$X_LIBS -L/usr/lib/Motif1.1"
514     fi
515
516     # Now let's check for the pseudo-standard locations for OpenGL and XPM.
517     #
518     if test -d /opt/Mesa/lib ; then
519       X_CFLAGS="-I/opt/Mesa/include $X_CFLAGS"
520       X_LIBS="-L/opt/Mesa/lib $X_LIBS"
521     fi
522
523     if test -d /opt/xpm/lib/X11 ; then
524       X_CFLAGS="-I/opt/xpm/include $X_CFLAGS"
525       X_LIBS="-L/opt/xpm/lib/X11 $X_LIBS"
526     fi
527
528     # On HPUX, default to installing in /opt/xscreensaver/ instead of
529     # in /usr/local/, unless there is already an xscreensaver in
530     # /usr/local/bin/.  This can be overridden with the --prefix arg
531     # to configure.  I'm not sure this is the right thing to do, but
532     # Richard Lloyd says so...
533     #
534     if test \! -x /usr/local/bin/xscreensaver ; then
535       ac_default_prefix=/opt/xscreensaver
536     fi
537
538   ;;
539   *-solaris*)
540
541     # Thanks for not making xmkmf find this by default, pinheads.
542     # And thanks for moving things around again, too.  Is this
543     # really the standard location now?  What happened to the
544     # joke that this kind of thing went in /opt?
545     # cthomp says "answer: CDE (Common Disorganized Environment)"
546     #
547     if test -f /usr/dt/include/Xm/Xm.h ; then
548       X_CFLAGS="$X_CFLAGS -I/usr/dt/include"
549       X_LIBS="$X_LIBS -L/usr/dt/lib -R:/usr/dt/lib"
550
551       # Some versions of Slowlaris Motif require -lgen.  But not all.  Why?
552       AC_CHECK_LIB(gen, regcmp, [X_LIBS="$X_LIBS -lgen"])
553     fi
554   ;;
555 esac
556
557
558
559 # Check for Xmu (some fucked up vendors don't ship it...)
560 #
561 have_xmu=no
562 AC_CHECK_X_HEADER(X11/Xmu/Error.h, [have_xmu=yes])
563 if test "$have_xmu" = no ; then
564   XMU_SRCS='$(UTILS_SRC)/xmu.c'
565   XMU_OBJS='$(UTILS_BIN)/xmu.o'
566 else
567   XMU_SRCS=''
568   XMU_OBJS=''
569   SAVER_LIBS="-lXmu $SAVER_LIBS"
570   HACK_LIBS="-lXmu $HACK_LIBS"
571   AC_DEFINE(HAVE_XMU)
572 fi
573
574
575 # See comp.windows.x FAQ question 124 about _get_wmShellWidgetClass on 4.1.x.
576 # The right fix is to get OpenWindows 3.0 patches 100512-02 and 100573-03.
577 #
578 if test "$have_xmu" = yes ; then
579   case "$host" in
580     *-sunos4*)
581     AC_CACHE_CHECK([for the SunOS 4.1.x _get_wmShellWidgetClass bug],
582                    ac_cv_sunos_xmu_bug,
583                    [ac_save_LDFLAGS="$LDFLAGS"
584                     if test \! -z "$x_libraries" ; then
585                       LDFLAGS="$LDFLAGS -L$x_libraries"
586                     fi
587                     # Note: this trick never works!  (Generally.)
588                     # We're only getting away with using AC_TRY_LINK
589                     # with X libraries because we know it's SunOS.
590                     LDFLAGS="$LDFLAGS -lXmu -lXt -lX11 -lXext -lm"
591                     AC_TRY_LINK(,,
592                                 [ac_cv_sunos_xmu_bug=no],
593                                 [ac_cv_sunos_xmu_bug=yes])
594                     LDFLAGS="$ac_save_LDFLAGS"])
595     if test "$ac_cv_sunos_xmu_bug" = yes ; then
596       AC_CACHE_CHECK([whether the compiler understands -static], 
597                      ac_cv_ld_static,
598                      [ac_save_LDFLAGS="$LDFLAGS"
599                       LDFLAGS="$LDFLAGS -static"
600                       AC_TRY_LINK(,,[ac_cv_ld_static=yes],[ac_cv_ld_static=no])
601                     LDFLAGS="$ac_save_LDFLAGS"])
602       if test "$ac_cv_ld_static" = yes ; then
603         LDFLAGS="$LDFLAGS -static"
604       else
605         LDFLAGS="$LDFLAGS -Bstatic"
606       fi
607     fi
608     ;;
609   esac
610 fi
611
612
613 # Check for the SGI SCREEN_SAVER server extension header.
614 #
615 have_sgi=no
616 with_sgi_req=unspecified
617 AC_ARG_WITH(sgi-ext,
618 [Except where noted, all of the --with options below can also take a
619 directory argument: for example, --with-motif=/opt/Motif.  That would
620 cause /opt/Motif/include/ to be added to the -I list, and /opt/Motif/lib/
621 to be added to the -L list, assuming those directories exist.
622
623 X Server Extension options:
624
625   --with-sgi-ext          Include support for the SGI SCREEN_SAVER
626                           server extension, if possible (this is the default).
627   --without-sgi-ext       Do not compile in support for this extension.],
628   [with_sgi="$withval"; with_sgi_req="$withval"],[with_sgi=yes])
629
630 HANDLE_X_PATH_ARG(with_sgi, --with-sgi-ext, SGI SCREEN_SAVER)
631
632 if test "$with_sgi" = yes; then
633   AC_CHECK_X_HEADER(X11/extensions/XScreenSaver.h,
634                     [have_sgi=yes
635                      AC_DEFINE(HAVE_SGI_SAVER_EXTENSION)])
636
637 elif test "$with_sgi" != no; then
638   echo "error: must be yes or no: --with-sgi-ext=$with_sgi"
639   exit 1
640 fi
641
642 # Check for the MIT-SCREEN-SAVER server extension header,
643 # unless the SGI extension has already been found.
644 #
645 have_mit=no
646 with_mit_req=unspecified
647 AC_ARG_WITH(mit-ext,
648 [  --with-mit-ext          Include support for the MIT-SCREEN-SAVER
649                           server extension, if possible (this is the default).
650   --without-mit-ext       Do not compile in support for this extension.],
651   [with_mit="$withval"; with_mit_req="$withval"],[with_mit=yes])
652
653 HANDLE_X_PATH_ARG(with_mit, --with-mit-ext, MIT-SCREEN-SAVER)
654
655 if test "$have_sgi" != yes; then
656   if test "$with_mit" = yes; then
657     AC_CHECK_X_HEADER(X11/extensions/scrnsaver.h, [have_mit=yes])
658
659     # Now check to see if it's really in the library; XF86Free-3.3 ships
660     # scrnsaver.h, but doesn't include the code in libXext.a, the idiots!
661     #
662     if test "$have_mit" = yes; then
663       AC_CHECK_X_LIB(Xext, XScreenSaverRegister, [], [have_mit=no], -lm)
664
665       if test "$have_mit" = no; then
666         # Fuck!  Looks like XF86Free-3.3 actually puts it in XExExt instead
667         # of in Xext.  Thank you master, may I have another.
668         AC_CHECK_X_LIB(XExExt, XScreenSaverRegister,
669                        [have_mit=yes; SAVER_LIBS="$SAVER_LIBS -lXExExt"],
670                        [], -lX11 -lXext -lm)
671       fi
672
673       if test "$have_mit" = no; then
674         # Double fuck!  Looks like some versions of XFree86 (whichever version
675         # it is that comes with RedHat Linux 2.0 -- I can't find a version 
676         # number) put this garbage in Xss instead of Xext.  Thank you master,
677         #  may I have another.
678         AC_CHECK_X_LIB(Xss, XScreenSaverRegister,
679                        [have_mit=yes; SAVER_LIBS="$SAVER_LIBS -lXss"],
680                        [], -lX11 -lXext -lm)
681       fi
682
683     if test "$have_mit" = yes; then
684       AC_DEFINE(HAVE_MIT_SAVER_EXTENSION)
685     fi
686
687     fi
688
689   elif test "$with_mit" != no; then
690     echo "error: must be yes or no: --with-mit-ext=$with_mit"
691     exit 1
692   fi
693 fi
694
695
696 # Check for the XIDLE server extension header.
697 #
698 have_xidle=no
699 with_xidle_req=unspecified
700 AC_ARG_WITH(xidle-ext,
701 [  --with-xidle-ext        Include support for the XIDLE server extension,
702                           if possible (this is the default).
703   --without-xidle-ext     Do not compile in support for this extension.],
704   [with_xidle="$withval"; with_xidle_req="$withval"],[with_xidle=yes])
705
706 HANDLE_X_PATH_ARG(with_xidle, --with-xidle-ext, XIDLE)
707
708 if test "$with_xidle" = yes; then
709   AC_CHECK_X_HEADER(X11/extensions/xidle.h,
710                     [have_xidle=yes
711                      AC_DEFINE(HAVE_XIDLE_EXTENSION)])
712 elif test "$with_xidle" != no; then
713   echo "error: must be yes or no: --with-xidle-ext=$with_xidle"
714   exit 1
715 fi
716
717
718 # Check for the XSHM server extension header.
719 #
720 have_xshm=no
721 with_xshm_req=unspecified
722 AC_ARG_WITH(xshm-ext,
723 [  --with-xshm-ext         Include support for the XSHM (Shared Memory) server
724                           extension, if possible (this is the default).
725   --without-xshm-ext      Do not compile in support for this extension.],
726   [with_xshm="$withval"; with_xshm_req="$withval"],[with_xshm=yes])
727
728 HANDLE_X_PATH_ARG(with_xshm, --with-xshm-ext, XSHM)
729
730 if test "$with_xshm" = yes; then
731
732   # first check for Xshm.h.
733   AC_CHECK_X_HEADER(X11/extensions/XShm.h, [have_xshm=yes])
734
735   # if that succeeded, then check for sys/ipc.h.
736   if test "$have_xshm" = yes; then
737     have_xshm=no
738     AC_CHECK_X_HEADER(sys/ipc.h, [have_xshm=yes])
739   fi
740
741   # if that succeeded, then check for sys/shm.h.
742   if test "$have_xshm" = yes; then
743     have_xshm=no
744     AC_CHECK_X_HEADER(sys/shm.h, [have_xshm=yes])
745   fi
746
747   # AIX is pathological, as usual: apparently it's normal for the Xshm headers
748   # to exist, but the library code to not exist.  And even better, the library
749   # code is in its own library: libXextSam.a.  So, if we're on AIX, and that
750   # lib doesn't exist, give up.
751   #
752   case "$host" in
753     *-aix*)
754       have_xshm=no
755       AC_CHECK_X_LIB(XextSam, XShmQueryExtension,
756                      [have_xshm=yes; SAVER_LIBS="$SAVER_LIBS -lXextSam"],
757                        [], -lX11 -lXext -lm)
758     ;;
759   esac
760
761   # if that succeeded, then we've really got it.
762   if test "$have_xshm" = yes; then
763     AC_DEFINE(HAVE_XSHM_EXTENSION)
764   fi
765
766 elif test "$with_xshm" != no; then
767   echo "error: must be yes or no: --with-xshm-ext=$with_xshm"
768   exit 1
769 fi
770
771
772 # Check for the SGI-VIDEO-CONTROL server extension header.
773 #
774 have_sgivc=no
775 with_sgivc_req=unspecified
776 AC_ARG_WITH(sgivc-ext,
777 [  --with-sgivc-ext        Include support for the SGI-VIDEO-CONTROL server
778                           extension, if possible (this is the default).
779   --without-sgivc-ext     Do not compile in support for this extension.],
780   [with_sgivc="$withval"; with_sgivc_req="$withval"],[with_sgivc=yes])
781
782 HANDLE_X_PATH_ARG(with_sgivc, --with-sgivc-ext, SGI-VIDEO-CONTROL)
783
784 if test "$with_sgivc" = yes; then
785
786   # first check for XSGIvc.h
787   AC_CHECK_X_HEADER(X11/extensions/XSGIvc.h, [have_sgivc=yes])
788
789   # if that succeeded, then check for the -lXsgivc
790   if test "$have_sgivc" = yes; then
791     have_sgivc=no
792     AC_CHECK_X_LIB(Xsgivc, XSGIvcQueryGammaMap,
793                   [have_sgivc=yes; SAVER_LIBS="$SAVER_LIBS -lXsgivc"], [],
794                   -lXext -lX11)
795   fi
796
797   # if that succeeded, then we've really got it.
798   if test "$have_sgivc" = yes; then
799     AC_DEFINE(HAVE_SGI_VC_EXTENSION)
800   fi
801
802 elif test "$with_sgivc" != no; then
803   echo "error: must be yes or no: --with-sgivc-ext=$with_sgivc"
804   exit 1
805 fi
806
807
808 # Check for the DPMS server extension header.
809 #
810 have_dpms=no
811 with_dpms_req=unspecified
812 AC_ARG_WITH(dpms-ext,
813 [  --with-dpms-ext         Include support for the DPMS server extension,
814                           if possible (this is the default).
815   --without-dpms-ext      Do not compile in support for this extension.],
816   [with_dpms="$withval"; with_dpms_req="$withval"],[with_dpms=yes])
817
818 HANDLE_X_PATH_ARG(with_dpms, --with-dpms-ext, DPMS)
819
820 if test "$with_dpms" = yes; then
821
822   # first check for dpms.h
823   AC_CHECK_X_HEADER(X11/extensions/dpms.h, [have_dpms=yes])
824
825   # if that succeeded, then check for the -lXdpms
826   if test "$have_dpms" = yes; then
827     have_dpms=no
828     AC_CHECK_X_LIB(Xdpms, DPMSInfo,
829                   [have_dpms=yes; SAVER_LIBS="$SAVER_LIBS -lXdpms"], [],
830                   -lXext -lX11)
831   fi
832
833   # if that succeeded, then we've really got it.
834   if test "$have_dpms" = yes; then
835     AC_DEFINE(HAVE_DPMS_EXTENSION)
836   fi
837
838 elif test "$with_dpms" != no; then
839   echo "error: must be yes or no: --with-dpms-ext=$with_dpms"
840   exit 1
841 fi
842
843
844
845 # Check for Motif and Athena --with and --without arguments.
846 #
847 have_motif=no
848 have_athena=no
849 have_athena3d=no
850 with_motif_req=unspecified
851 with_athena_req=unspecified
852
853 AC_ARG_WITH(motif,[
854 X Client Toolkit options:
855
856   --with-motif            Use the Motif toolkit for the user interface, if
857                           possible (this is the default).
858   --without-motif         Do not use Motif.],
859   [with_motif="$withval"; with_motif_req="$withval"],[with_motif=no])
860
861 HANDLE_X_PATH_ARG(with_motif, --with-motif, Motif)
862
863 AC_ARG_WITH(athena,
864 [  --with-athena           Use the Athena toolkit for the user interface, if
865                           possible (this is the default if Motif isn't used.)
866   --without-athena        Do not use Athena.],
867   [with_athena="$withval"; with_athena_req="$withval"],[with_athena=no])
868
869 HANDLE_X_PATH_ARG(with_athena, --with-athena, Athena)
870
871 if test "$with_motif" != yes -a "$with_motif" != no ; then
872   echo "error: must be yes or no: --with-motif=$with_motif"
873   exit 1
874 fi
875
876 if test "$with_athena" != yes -a "$with_athena" != no ; then
877   echo "error: must be yes or no: --with-athena=$with_athena"
878   exit 1
879 fi
880
881
882 # Saying --without-motif is the same as saying --with-athena.
883 if test "$with_motif_req" = no ; then
884   with_athena_req=yes
885   with_athena=yes
886 fi
887
888 # Saying --without-athena is the same as saying --with-motif.
889 if test "$with_athena_req" = no ; then
890   with_motif_req=yes
891   with_motif=yes
892 fi
893
894 # Check for Motif and Athena headers.
895
896 check_motif() {
897   AC_CHECK_X_HEADER(Xm/Xm.h,
898                     [have_motif=yes
899                      AC_DEFINE(HAVE_MOTIF)
900                      TOOLKIT_LIBS="-lXm $TOOLKIT_LIBS"])
901 }
902
903 check_athena() {
904   have_athena=no
905   have_athena3d=no
906   AC_CHECK_X_HEADER(X11/Xaw/Dialog.h, [have_athena=yes])
907   if test "$have_athena" = yes; then
908     AC_CHECK_X_LIB(Xaw3d, Xaw3dComputeTopShadowRGB,
909                    [have_athena=yes; have_athena3d=yes], [],
910                    -lXt -lXmu -lXext -lX11)
911   fi
912
913   if test "$have_athena3d" = yes; then
914     TOOLKIT_LIBS="-lXaw3d $TOOLKIT_LIBS"
915   elif test "$have_athena" = yes; then
916     TOOLKIT_LIBS="-lXaw $TOOLKIT_LIBS"
917   fi
918 }
919
920
921 # If they asked for both motif and athena, check motif then athena.
922 # If they asked for only motif, check motif then athena.
923 # If they asked for only athena, check athena then motif.
924 # If they asked for neither, check motif then athena.
925
926 proselytize_motif=yes
927 if test "$with_motif" = yes; then
928   # asked for both, or for motif only
929   check_motif
930   if test "$have_motif" = yes; then
931     with_athena=no
932     with_athena_req=no
933   else
934     check_athena
935   fi
936
937 elif test "$with_athena" = yes; then
938   # asked for athena only
939   check_athena
940   if test "$have_athena" = yes; then
941     with_motif=no
942     proselytize_motif=no
943   else
944     check_motif
945   fi
946
947 else
948   # asked for neither
949   check_motif
950   if test "$have_motif" = yes; then
951     with_athena=no
952   else
953     check_athena
954   fi
955
956 fi
957
958 if test "$have_motif" = yes; then
959   proselytize_motif=no
960 fi
961
962 # If we have Athena, check whether it's a version that includes
963 # XawViewportSetCoordinates in Viewport.h (R3 (or R4?) don't.)
964 if test "$have_athena" = yes ; then
965   AC_CACHE_CHECK([for XawViewportSetCoordinates in Viewport.h], 
966                  ac_cv_have_XawViewportSetCoordinates,
967                  [ac_cv_have_XawViewportSetCoordinates=no
968                   AC_EGREP_X_HEADER(XawViewportSetCoordinates, 
969                                     X11/Xaw/Viewport.h,
970                                     ac_cv_have_XawViewportSetCoordinates=yes)])
971   if test "$ac_cv_have_XawViewportSetCoordinates" = yes ; then
972     AC_DEFINE(HAVE_XawViewportSetCoordinates)
973   fi
974 fi
975
976
977 # If we have Motif, check whether it's really LessTif.
978 #
979 have_lesstif=no
980 if test "$have_motif" = yes ; then
981   AC_CACHE_CHECK([whether Motif is really LessTif], 
982                  ac_cv_have_lesstif,
983                  [AC_TRY_X_COMPILE([#include <Xm/Xm.h>],
984                                    [long vers = LesstifVersion;],
985                                    [ac_cv_have_lesstif=yes],
986                                    [ac_cv_have_lesstif=no])])
987   have_lesstif=$ac_cv_have_lesstif
988 fi
989
990 # don't cache these
991 unset ac_cv_lesstif_version
992 unset ac_cv_lesstif_version_string
993
994 lesstif_version=unknown
995 lesstif_version_string=unknown
996
997 if test "$have_lesstif" = yes ; then
998   ltv=unknown
999   echo unknown > conftest-lt
1000   AC_CACHE_CHECK([LessTif version number],
1001                  ac_cv_lesstif_version_string,
1002       [AC_TRY_X_RUN([#include <stdio.h>
1003                      #include <Xm/Xm.h>
1004                      int main() {
1005                        FILE *f = fopen("conftest-lt", "w");
1006                        if (!f) exit(1);
1007                        fprintf(f, "%d %d.%d\n", LesstifVersion,
1008                           LESSTIF_VERSION, LESSTIF_REVISION);
1009                        fclose(f);
1010                        exit(0);
1011                      }],
1012                     [ltv=`cat conftest-lt`
1013                      ac_cv_lesstif_version=`echo $ltv | sed 's/ .*//'`
1014                      ac_cv_lesstif_version_string=`echo $ltv | sed 's/.* //'`],
1015                     [ac_cv_lesstif_version=unknown
1016                      ac_cv_lesstif_version_string=unknown],
1017                     [ac_cv_lesstif_version=unknown
1018                      ac_cv_lesstif_version_string=unknown])])
1019   rm -f conftest-lt
1020   lesstif_version=$ac_cv_lesstif_version
1021   lesstif_version_string=$ac_cv_lesstif_version_string
1022
1023 fi
1024
1025
1026 # Some versions of Motif (2.1.0, at least) require -lXp, the "X Printing
1027 # Extension".   Why this extension isn't in -lXext with all the others,
1028 # I have no idea.
1029 #
1030 have_xp_ext=no
1031 if test "$have_motif" = yes ; then
1032    have_xp_ext=no
1033    AC_CHECK_X_LIB(Xp, XpQueryExtension,
1034                   [have_xp_ext=yes; TOOLKIT_LIBS="$TOOLKIT_LIBS -lXp"],
1035                   [], -lX11 -lXext -lm)
1036 fi
1037
1038
1039 # check for XPM header.
1040 #
1041 have_xpm=no
1042 with_xpm_req=unspecified
1043 AC_ARG_WITH(xpm,[
1044 Graphics Demo options:
1045
1046   --with-xpm              Include support for XPM files in some demos,
1047                           if possible (this is the default).
1048   --without-xpm           Do not compile in support for XPM files.],
1049   [with_xpm="$withval"; with_xpm_req="$withval"],[with_xpm=yes])
1050
1051 HANDLE_X_PATH_ARG(with_xpm, --with-xpm, XPM)
1052
1053 if test "$with_xpm" = yes; then
1054   AC_CHECK_X_HEADER(X11/xpm.h,
1055                    [have_xpm=yes
1056                     AC_DEFINE(HAVE_XPM)
1057                     XPM_LIBS="-lXpm"])
1058 elif test "$with_xpm" != no; then
1059   echo "error: must be yes or no: --with-xpm=$with_xpm"
1060   exit 1
1061 fi
1062
1063
1064 # check for the GL header
1065 #
1066 have_gl=no
1067 ac_have_mesa_gl=no
1068 with_gl_req=unspecified
1069 AC_ARG_WITH(gl,
1070 [  --with-gl               Build those demos which depend on OpenGL,
1071                           if possible (this is the default).
1072   --without-gl            Do not build the OpenGL demos.],
1073   [with_gl="$withval"; with_gl_req="$withval"],[with_gl=yes])
1074
1075 HANDLE_X_PATH_ARG(with_gl, --with-gl, GL)
1076
1077 ac_mesagl_version=unknown
1078 ac_mesagl_version_string=unknown
1079
1080 if test "$with_gl" = yes; then
1081   AC_CHECK_X_HEADER(GL/gl.h, have_gl=yes, have_gl=no)
1082   if test "$have_gl" = yes ; then
1083     AC_CHECK_X_HEADER(GL/glx.h, have_gl=yes, have_gl=no)
1084   fi
1085
1086   # If we have the headers, try and figure out which vendor it's from.
1087   #
1088   if test "$have_gl" = yes ; then
1089
1090     AC_DEFINE(HAVE_GL)
1091
1092     # We need to know whether it's MesaGL so that we know which libraries
1093     # to link against.
1094     #
1095     AC_MSG_CHECKING(whether GL is really MesaGL)
1096     AC_CACHE_VAL(ac_cv_have_mesa_gl,
1097       [ac_cv_have_mesa_gl=no
1098        AC_EGREP_X_HEADER(Mesa, GL/glx.h, [ac_cv_have_mesa_gl=yes])
1099       ])
1100     ac_have_mesa_gl=$ac_cv_have_mesa_gl
1101     AC_MSG_RESULT($ac_have_mesa_gl)
1102
1103     if test "$ac_have_mesa_gl" = no ; then
1104       gl_lib_1="GL"
1105       GL_LIBS="-lGL -lGLU"
1106     else
1107       AC_DEFINE(HAVE_MESA_GL)
1108       gl_lib_1="MesaGL"
1109       GL_LIBS="-lMesaGL -lMesaGLU"
1110     fi
1111
1112
1113     # If it's MesaGL, we'd like to issue a warning if the version number
1114     # is less than or equal to 2.6, because that version had a security bug.
1115     #
1116     if test "$ac_have_mesa_gl" = yes; then
1117
1118       # don't cache these.
1119       unset ac_cv_mesagl_version
1120       unset ac_cv_mesagl_version_string
1121
1122       AC_MSG_CHECKING(MesaGL version number)
1123       AC_CACHE_VAL(ac_cv_mesagl_version_string,
1124         [cat > conftest.$ac_ext <<EOF
1125 #line __oline__ "configure"
1126 #include "confdefs.h"
1127 #include <GL/gl.h>
1128 #configure: MESA_MAJOR_VERSION MESA_MINOR_VERSION
1129 EOF
1130
1131          ac_save_CPPFLAGS="$CPPFLAGS"
1132          if test \! -z "$includedir" ; then 
1133            CPPFLAGS="$CPPFLAGS -I$includedir"
1134          fi
1135          CPPFLAGS="$CPPFLAGS $X_CFLAGS"
1136
1137          mglv=`(eval "$ac_cpp conftest.$ac_ext") 2>&AC_FD_CC | sed -n \
1138               's/^#configure:.*\([0-9][0-9]*\).*\([0-9][0-9]*\).*$/\1.\2/p'`
1139          rm -f conftest.$ac_ext
1140
1141          CPPFLAGS="$ac_save_CPPFLAGS"
1142
1143          if test "$mglv" = ""; then
1144            ac_mesagl_version=unknown
1145            ac_mesagl_version_string=unknown
1146          else
1147            ac_mesagl_version_string=$mglv
1148            maj=`echo $mglv | sed -n 's/\..*//p'`
1149            min=`echo $mglv | sed -n 's/.*\.//p'`
1150            ac_mesagl_version=`echo "$maj * 1000 + $min" | bc`
1151            if test -z "$ac_mesagl_version"; then
1152              ac_mesagl_version=unknown
1153              ac_mesagl_version_string=unknown
1154            fi
1155          fi
1156          ac_cv_mesagl_version=$ac_mesagl_version
1157          ac_cv_mesagl_version_string=$ac_mesagl_version_string
1158       ])
1159       ac_mesagl_version=$ac_cv_mesagl_version
1160       ac_mesagl_version_string=$ac_cv_mesagl_version_string
1161       AC_MSG_RESULT($ac_cv_mesagl_version_string)
1162     fi
1163
1164
1165     # Check for OpenGL 1.1 features.
1166     #
1167     AC_CHECK_X_LIB($gl_lib_1, glBindTexture, [AC_DEFINE(HAVE_GLBINDTEXTURE)],
1168                    [], $GL_LIBS -lX11 -lXext -lm)
1169
1170   fi
1171
1172 elif test "$with_gl" != no; then
1173   echo "error: must be yes or no: --with-gl=$with_gl"
1174   exit 1
1175 fi
1176
1177
1178 # check for SGI XReadDisplay server extension header.
1179 #
1180 have_readdisplay=no
1181 with_readdisplay_req=unspecified
1182 AC_ARG_WITH(readdisplay,
1183 [  --with-readdisplay      Include support for the XReadDisplay server
1184                           extension if possible (this is the default).
1185   --without-readdisplay   Do not compile in support for this extension.],
1186   [with_readdisplay="$withval"; with_readdisplay_req="$withval"],
1187   [with_readdisplay=yes])
1188
1189 HANDLE_X_PATH_ARG(with_readdisplay, --with-readdisplay, XReadDisplay)
1190
1191 if test "$with_readdisplay" = yes; then
1192   AC_CHECK_X_HEADER(X11/extensions/readdisplay.h,
1193                     AC_DEFINE(HAVE_READ_DISPLAY_EXTENSION))
1194 elif test "$with_readdisplay" != no; then
1195   echo "error: must be yes or no: --with-readdisplay=$with_readdisplay"
1196   exit 1
1197 fi
1198
1199
1200 # check for SGI's Iris Video Library header.
1201 #
1202 have_sgivideo=no
1203 with_sgivideo_req=unspecified
1204 AC_ARG_WITH(sgivideo,
1205 [  --with-sgivideo         Include support for SGI's Iris Video Library
1206                           if possible (this is the default).
1207   --without-sgivideo       Do not compile in support for this library.],
1208   [with_sgivideo="$withval"; with_sgivideo_req="$withval"],
1209   [with_sgivideo=yes])
1210
1211 HANDLE_X_PATH_ARG(with_sgivideo, --with-sgivideo, Iris Video)
1212
1213 if test "$with_sgivideo" = yes; then
1214   AC_CHECK_X_HEADER(dmedia/vl.h, have_sgivideo=yes)
1215   if test "$have_sgivideo" = yes; then
1216     have_sgivideo=no
1217     AC_CHECK_LIB(vl, vlOpenVideo, have_sgivideo=yes)
1218     if test "$have_sgivideo" = yes; then
1219       SGI_VIDEO_OBJS="$(UTILS_BIN)/sgivideo.o"
1220       SGI_VIDEO_LIBS="-lvl"
1221       AC_DEFINE(HAVE_SGI_VIDEO)
1222     fi
1223   fi
1224 elif test "$with_sgivideo" != no; then
1225   echo "error: must be yes or no: --with-sgivideo=$with_sgivideo"
1226   exit 1
1227 fi
1228
1229
1230
1231 # Try to find a program to generate random text.
1232 #
1233 # Zippy is funnier than the idiocy generally spat out by `fortune',
1234 # so try to find that, by invoking Emacs and asking it where its 
1235 # libexec directory is ("yow" lives in there.)
1236 #
1237 # If that doesn't work, see if fortune, zippy, or yow are on $PATH,
1238 # and if so, use them.
1239 #
1240 # If that doesn't work, look in /usr/games, and if it's there, use
1241 # the full pathname.
1242 #
1243 with_zippy_req=""
1244 AC_ARG_WITH(zippy,
1245 [  --with-zippy=PROGRAM    Some demos are able to run an external program and
1246                           display its text; this names the program to use by
1247                           default (though it can be overridden with X
1248                           resources.)  If you don't specify this, the default
1249                           is to use \"yow\" from the Emacs distribution (if you
1250                           have it) or else to use \"fortune\".],
1251   [ with_zippy_req="$withval"; with_zippy="$withval" ],
1252   [ with_zippy_req="$withval"; with_zippy="$withval" ])
1253
1254 if test "$with_zippy" = no || test "$with_zippy" = yes ; then
1255   with_zippy=""
1256   with_zippy_req=""
1257 fi
1258
1259 if test -n "$with_zippy_req" ; then
1260   ac_cv_zippy_program=""
1261   case "$with_zippy_req" in
1262     /*)
1263       AC_MSG_CHECKING([for $with_zippy_req])
1264       if test -x "$with_zippy_req" ; then
1265         AC_MSG_RESULT(yes)
1266       else
1267         AC_MSG_RESULT(no)
1268         with_zippy=""
1269       fi
1270     ;;
1271     *)
1272       # don't cache
1273       unset ac_cv_path_zip2
1274       AC_PATH_PROG(zip2, $with_zippy_req, [])
1275       if test "$zip2" = ""; then
1276         with_zippy=""
1277       fi
1278     ;;
1279   esac
1280   ac_cv_zippy_program="$with_zippy"
1281
1282 elif test -n "$ac_cv_zippy_program"; then
1283   AC_MSG_RESULT([checking for zippy... (cached) $ac_cv_zippy_program])
1284 fi
1285
1286 if test ! -n "$ac_cv_zippy_program"; then
1287
1288   AC_CHECK_PROGS(emacs_exe, emacs)
1289   AC_CHECK_PROGS(xemacs_exe, xemacs)
1290
1291   ac_cv_zippy_program=""
1292   eargs='-batch -q -nw --eval'
1293
1294   if test -n "$emacs_exe" ; then
1295     AC_MSG_CHECKING([for emacs yow])
1296     #
1297     # get emacs to tell us where the libexec directory is.
1298     #
1299     dir=`$emacs_exe $eargs '(princ (concat exec-directory "\n"))' \
1300          2>/dev/null | tail -1`
1301     dir=`echo "$dir" | sed 's@///*@/@g;s@/$@@'`
1302     #
1303     # try running libexec/yow and see if it exits without error.
1304     #
1305     if test x"$dir" != x -a -x "$dir/yow" ; then
1306       if $dir/yow >&- 2>&- ; then
1307         ac_cv_zippy_program="$dir/yow"
1308         AC_MSG_RESULT($ac_cv_zippy_program)
1309       else
1310         AC_MSG_RESULT(no)
1311       fi
1312     fi
1313   fi
1314
1315   if test -z "$ac_cv_zippy_program" ; then
1316     AC_MSG_CHECKING([for xemacs yow])
1317     if test -n "$xemacs_exe" ; then
1318       #
1319       # get xemacs to tell us where the libexec directory is.
1320       #
1321       dir=`$xemacs_exe $eargs '(princ (concat exec-directory "\n"))' \
1322            2>/dev/null | tail -1`
1323       dir=`echo "$dir" | sed 's@///*@/@g;s@/$@@'`
1324       #
1325       # try running libexec/yow and see if it exits without error.
1326       #
1327       if test x"$dir" != x -a -x "$dir/yow" ; then
1328         if $dir/yow >&- 2>&- ; then
1329           ac_cv_zippy_program="$dir/yow"
1330           AC_MSG_RESULT($ac_cv_zippy_program)
1331         else
1332           #
1333           # in some xemacs installations, the pathname of the yow.lines file
1334           # isn't hardcoded into the yow executable, and must be passed on 
1335           # the command line.  See if it's in libexec/../etc/.
1336
1337           # M4 sucks!!
1338           changequote(X,Y)
1339           dir_up=`echo "$dir" | sed 's@/[^/]*$@@'`
1340           changequote([,])
1341
1342           yow="yow -f $dir_up/etc/yow.lines"
1343           if $dir/$yow >&- 2>&- ; then
1344             ac_cv_zippy_program="$dir/$yow"
1345             AC_MSG_RESULT($ac_cv_zippy_program)
1346           else
1347             AC_MSG_RESULT(no)
1348           fi
1349         fi
1350       fi
1351     fi
1352   fi
1353
1354   # if that didn't work, try for some other programs...
1355   if test -z "$ac_cv_zippy_program" ; then
1356     fortune=''
1357     AC_CHECK_PROGS(fortune, [fortune zippy yow])
1358     # if that didn't work, try for those programs in /usr/games...
1359     if test -z "$fortune" ; then
1360       AC_PATH_PROGS(fortune, [fortune zippy yow], fortune,
1361                     /usr/games:/usr/local/games)
1362     fi
1363   fi
1364 fi
1365
1366 if test -z "$ac_cv_zippy_program" ; then
1367   ac_cv_zippy_program=fortune
1368 fi
1369
1370 AC_DEFINE_UNQUOTED(ZIPPY_PROGRAM, "$ac_cv_zippy_program")
1371
1372
1373
1374
1375 # Allow locking to be disabled at compile-time.
1376 #
1377 have_kerberos=no
1378 with_kerberos_req=unspecified
1379 have_shadow=no
1380 with_shadow_req=unspecified
1381 need_setuid=no
1382
1383 AC_ARG_ENABLE(locking,[
1384 Screen Locking options:
1385
1386   --enable-locking        Compile in support for locking the display
1387                           (this is the default.)
1388   --disable-locking       Do not allow locking at all.],
1389   [enable_locking="$enableval"],[enable_locking=yes])
1390 if test "$enable_locking" = yes; then
1391   true
1392 elif test "$enable_locking" = no; then
1393   AC_DEFINE(NO_LOCKING)
1394 else
1395   echo "error: must be yes or no: --enable-locking=$enable_locking"
1396   exit 1
1397 fi
1398
1399
1400
1401 # Check to see if we can lock Virtual-Terminal switching, but allow that 
1402 # to be disabled at compile-time.
1403 #
1404 ac_vt_lockswitch=no
1405 AC_ARG_ENABLE(vt-locking,[
1406   --enable-vt-locking     Compile in support for locking Virtual Terminals.
1407                           This is the default if the system supports it, and
1408                           if locking support is included (--enable-locking.)
1409   --disable-vt-locking    Do not allow locking of VTs, even if locking is
1410                           enabled.],
1411   [enable_vt_locking="$enableval"],[enable_vt_locking=yes])
1412 if test "$enable_vt_locking" = yes; then
1413
1414   AC_MSG_CHECKING(for the VT_LOCKSWITCH ioctl)
1415   AC_CACHE_VAL(ac_cv_vt_lockswitch,
1416    [AC_TRY_COMPILE([#include <fcntl.h>
1417                     #include <sys/ioctl.h>
1418                     #include <sys/vt.h>],
1419                    [int x = VT_LOCKSWITCH; int y = VT_UNLOCKSWITCH;],
1420                    [ac_cv_vt_lockswitch=yes],
1421                    [ac_cv_vt_lockswitch=no])])
1422   ac_vt_lockswitch=$ac_cv_vt_lockswitch
1423   AC_MSG_RESULT($ac_vt_lockswitch)
1424
1425 elif test "$enable_locking" = no; then
1426   true
1427 else
1428   echo "error: must be yes or no: --enable-vt-locking=$enable_vt_locking"
1429   exit 1
1430 fi
1431
1432 if test "$ac_vt_lockswitch" = yes; then
1433   AC_DEFINE(HAVE_VT_LOCKSWITCH)
1434   # the VT_LOCKSWITCH ioctl can only be used when running as root.
1435   # #### but it doesn't work yet, so don't worry about that for now.
1436 #  need_setuid=yes
1437 fi
1438
1439
1440
1441 if test "$enable_locking" = yes; then
1442
1443   # Check for Kerberos.
1444   #
1445   AC_ARG_WITH(kerberos, [
1446   --with-kerberos         Include support for Kerberos authentication,
1447                           if possible (this is the default.)
1448   --without-kerberos      Do not compile in support for Kerberos.],
1449   [with_kerberos="$withval"; with_kerberos_req="$withval"],[with_kerberos=yes])
1450
1451   HANDLE_X_PATH_ARG(with_kerberos, --with-kerberos, Kerberos)
1452
1453   if test "$with_kerberos" = yes; then
1454     AC_CACHE_CHECK([for Kerberos], ac_cv_kerberos,
1455                    [AC_TRY_X_COMPILE([#include <krb.h>],,
1456                                      [ac_cv_kerberos=yes],
1457                                      [ac_cv_kerberos=no])])
1458     if test "$ac_cv_kerberos" = yes ; then
1459       have_kerberos=yes
1460       AC_DEFINE(HAVE_KERBEROS)
1461
1462       # from Tim Showalter <tjs+@andrew.cmu.edu>
1463       PASSWD_LIBS="$PASSWD_LIBS -lkrb -ldes"
1464       AC_CHECK_FUNC(res_search,,
1465         AC_CHECK_LIB(resolv,res_search,PASSWD_LIBS="${PASSWD_LIBS} -lresolv",
1466           AC_MSG_WARN([Can't find DNS resolver libraries needed for Kerberos])
1467         ))
1468
1469     fi
1470   elif test "$with_kerberos" != no; then
1471     echo "error: must be yes or no: --with-kerberos=$with_kerberos"
1472     exit 1
1473   fi
1474
1475   # Next, check for the nine billion variants of shadow passwords...
1476
1477   passwd_cruft_done=no
1478   AC_ARG_WITH(shadow,
1479 [  --with-shadow           Include support for shadow password authentication,
1480                           if possible (this is the default, if no Kerberos.)
1481   --without-shadow        Do not compile in support for shadow passwords.
1482 ],
1483   [with_shadow="$withval"; with_shadow_req="$withval"],[with_shadow=yes])
1484
1485   HANDLE_X_PATH_ARG(with_shadow, --with-shadow, shadow password)
1486
1487   if test "$with_shadow" = no; then
1488     passwd_cruft_done=yes
1489   elif test "$with_shadow" != yes; then
1490     echo "error: must be yes or no: --with-shadow=$with_shadow"
1491     exit 1
1492   fi
1493
1494
1495   # Sun's "adjunct" passwords.
1496   #
1497   if test "$passwd_cruft_done" = no ; then
1498     AC_CACHE_CHECK([for Sun-style shadow passwords], ac_cv_sun_adjunct,
1499                    [AC_TRY_X_COMPILE([#include <stdlib.h>
1500                                       #include <unistd.h>
1501                                       #include <sys/types.h>
1502                                       #include <sys/label.h>
1503                                       #include <sys/audit.h>
1504                                       #include <pwdadj.h>],
1505                         [struct passwd_adjunct *p = getpwanam("nobody");
1506                          const char *pw = p->pwa_passwd;],
1507                         [ac_cv_sun_adjunct=yes],
1508                         [ac_cv_sun_adjunct=no])])
1509     if test "$ac_cv_sun_adjunct" = yes; then
1510       have_shadow=yes
1511       need_setuid=yes
1512       passwd_cruft_done=yes
1513       AC_DEFINE(HAVE_ADJUNCT_PASSWD)
1514     fi
1515   fi
1516
1517   # DEC and SCO so-called "enhanced" security.
1518   #
1519   if test "$passwd_cruft_done" = no ; then
1520     AC_CACHE_CHECK([for DEC-style shadow passwords], ac_cv_enhanced_passwd,
1521                    [AC_TRY_X_COMPILE([#include <stdlib.h>
1522                                       #include <unistd.h>
1523                                       #include <sys/types.h>
1524                                       #include <pwd.h>
1525                                       #include <sys/security.h>
1526                                       #include <prot.h>],
1527                         [struct pr_passwd *p;
1528                          const char *pw;
1529                          set_auth_parameters(0, 0);
1530                          check_auth_parameters();
1531                          p = getprpwnam("nobody");
1532                          pw = p->ufld.fd_encrypt;],
1533                         [ac_cv_enhanced_passwd=yes],
1534                         [ac_cv_enhanced_passwd=no])])
1535     if test $ac_cv_enhanced_passwd = yes; then
1536       have_shadow=yes
1537       need_setuid=yes
1538       passwd_cruft_done=yes
1539       AC_DEFINE(HAVE_ENHANCED_PASSWD)
1540
1541       # On SCO, getprpwnam() is in -lprot (which uses nap() from -lx)
1542       # (I'm told it needs -lcurses too, but I don't understand why.)
1543       AC_CHECK_LIB(prot, getprpwnam, 
1544                    [PASSWD_LIBS="$PASSWD_LIBS -lprot -lcurses -lx"],
1545                    [# On DEC, getprpwnam() is in -lsecurity
1546                     AC_CHECK_LIB(security, getprpwnam, 
1547                                  [PASSWD_LIBS="$PASSWD_LIBS -lsecurity"])],
1548                    [-lx])
1549     fi
1550   fi
1551
1552   # HP's entry in the "Not Invented Here" Sweepstakes.
1553   #
1554   if test "$passwd_cruft_done" = no ; then
1555     AC_CACHE_CHECK([for HP-style shadow passwords], ac_cv_hpux_passwd,
1556                    [AC_TRY_X_COMPILE([#include <stdlib.h>
1557                                       #include <unistd.h>
1558                                       #include <sys/types.h>
1559                                       #include <pwd.h>
1560                                       #include <hpsecurity.h>
1561                                       #include <prot.h>],
1562                         [struct s_passwd *p = getspwnam("nobody");
1563                          const char *pw = p->pw_passwd;],
1564                         [ac_cv_hpux_passwd=yes],
1565                         [ac_cv_hpux_passwd=no])])
1566     if test "$ac_cv_hpux_passwd" = yes; then
1567       have_shadow=yes
1568       need_setuid=yes
1569       passwd_cruft_done=yes
1570       AC_DEFINE(HAVE_HPUX_PASSWD)
1571
1572       # on HPUX, bigcrypt is in -lsec
1573       AC_CHECK_LIB(sec, bigcrypt, [PASSWD_LIBS="$PASSWD_LIBS -lsec"])
1574     fi
1575   fi
1576
1577   # Traditional (ha!) shadow passwords.
1578   #
1579   if test "$passwd_cruft_done" = no ; then
1580     AC_CACHE_CHECK([for generic shadow passwords], ac_cv_shadow,
1581                    [AC_TRY_X_COMPILE([#include <stdlib.h>
1582                                       #include <unistd.h>
1583                                       #include <sys/types.h>
1584                                       #include <pwd.h>
1585                                       #include <shadow.h>],
1586                         [struct spwd *p = getspnam("nobody");
1587                          const char *pw = p->sp_pwdp;],
1588                         [ac_cv_shadow=yes],
1589                         [ac_cv_shadow=no])])
1590     if test "$ac_cv_shadow" = yes; then
1591       have_shadow=yes
1592       need_setuid=yes
1593       passwd_cruft_done=yes
1594       AC_DEFINE(HAVE_SHADOW_PASSWD)
1595
1596       # On some systems (UnixWare 2.1), getspnam() is in -lgen instead of -lc.
1597       have_getspnam=no
1598       AC_CHECK_LIB(c, getspnam, [have_getspnam=yes])
1599       if test "$have_getspnam" = no ; then
1600         AC_CHECK_LIB(gen, getspnam,
1601                      [have_getspnam=yes; PASSWD_LIBS="$PASSWD_LIBS -lgen"])
1602       fi
1603     fi
1604   fi
1605
1606   # On FreeBSD, getpwnam() and friends work just like on non-shadow-password
1607   # systems -- except you only get stuff in the pw_passwd field if the running
1608   # program is setuid.  So, guess that we've got this lossage to contend with
1609   # if /etc/master.passwd exists, and default to a setuid installation.
1610   #
1611   if test "$passwd_cruft_done" = no ; then
1612     AC_CACHE_CHECK([for FreeBSD-style shadow passwords], ac_cv_master_passwd,
1613                    [if test -f /etc/master.passwd ; then
1614                       ac_cv_master_passwd=yes
1615                     else
1616                       ac_cv_master_passwd=no
1617                     fi])
1618     if test "$ac_cv_master_passwd" = yes; then
1619       need_setuid=yes
1620       passwd_cruft_done=yes
1621     fi
1622   fi
1623
1624   # On some systems (UnixWare 2.1), crypt() is in -lcrypt instead of -lc.
1625   have_crypt=no
1626   AC_CHECK_LIB(c, crypt, [have_crypt=yes])
1627   if test "$have_crypt" = no ; then
1628     AC_CHECK_LIB(crypt, crypt,
1629                  [have_crypt=yes; PASSWD_LIBS="$PASSWD_LIBS -lcrypt"])
1630   fi
1631
1632
1633   # Most of the above shadow mechanisms will have set need_setuid to yes,
1634   # if they were found.  But, on some systems, we need setuid even when
1635   # using plain old vanilla passwords.
1636   #
1637   if test "$need_setuid" = no ; then
1638     case "$host" in
1639       *-hpux* | *-aix* | *-netbsd* | *-freebsd* | *-openbsd* )
1640         need_setuid=yes
1641       ;;
1642     esac
1643   fi
1644
1645 fi
1646
1647
1648
1649 if test \! -z "$includedir" ; then 
1650   INCLUDES="-I$includedir"
1651 fi
1652
1653 if test \! -z "$libdir" ; then
1654   LDFLAGS="$LDFLAGS -L$libdir"
1655 fi
1656
1657
1658 ##### should have options to override the DEPEND crap, I guess...
1659 DEPEND=makedepend
1660 DEPEND_FLAGS=
1661 DEPEND_DEFINES=
1662
1663
1664 # Done testing things -- now substitute in some stuff for the Makefiles.
1665 #
1666 if test "$have_motif" = yes; then
1667   AC_DEFINE(HAVE_MOTIF)
1668   TOOLKIT_SRCS='$(MOTIF_SRCS)'
1669   TOOLKIT_OBJS='$(MOTIF_OBJS)'
1670 elif test "$have_athena" = yes; then
1671   AC_DEFINE(HAVE_ATHENA)
1672   TOOLKIT_SRCS='$(ATHENA_SRCS)'
1673   TOOLKIT_OBJS='$(ATHENA_OBJS)'
1674 else
1675   TOOLKIT_SRCS=''
1676   TOOLKIT_OBJS=''
1677 fi
1678
1679 if test "$have_kerberos" = yes; then
1680   PASSWD_SRCS='$(KERBEROS_SRCS)'
1681   PASSWD_OBJS='$(KERBEROS_OBJS)'
1682 else
1683   PASSWD_SRCS='$(PWENT_SRCS)'
1684   PASSWD_OBJS='$(PWENT_OBJS)'
1685 fi
1686
1687 if test "$enable_locking" = yes; then
1688   LOCK_SRCS='$(LOCK_SRCS_1) $(PASSWD_SRCS)'
1689   LOCK_OBJS='$(LOCK_OBJS_1) $(PASSWD_OBJS)'
1690 else
1691   LOCK_SRCS=''
1692   LOCK_OBJS=''
1693 fi
1694
1695 if test "$need_setuid" = yes; then
1696   NEED_SETUID=yes
1697   INSTALL_SETUID='$(INSTALL) $(SUID_FLAGS)'
1698 else
1699   NEED_SETUID=no
1700   INSTALL_SETUID='$(INSTALL_PROGRAM)'
1701 fi
1702
1703 tab='   '
1704 if test "$have_gl" = yes; then
1705   GL_EXES='$(GL_EXES)'
1706   GL_KLUDGE=${tab}
1707 else
1708   GL_KLUDGE='  -'${tab}
1709 fi
1710
1711 AC_SUBST(INCLUDES)
1712
1713 AC_SUBST(SAVER_LIBS)
1714 AC_SUBST(TOOLKIT_LIBS)
1715 AC_SUBST(HACK_LIBS)
1716 AC_SUBST(XPM_LIBS)
1717 AC_SUBST(GL_LIBS)
1718 AC_SUBST(PASSWD_LIBS)
1719 AC_SUBST(INSTALL_SETUID)
1720 AC_SUBST(INSTALL_DIRS)
1721 AC_SUBST(NEED_SETUID)
1722 AC_SUBST(SGI_VIDEO_OBJS)
1723 AC_SUBST(SGI_VIDEO_LIBS)
1724
1725 AC_SUBST(TOOLKIT_SRCS)
1726 AC_SUBST(TOOLKIT_OBJS)
1727 AC_SUBST(PASSWD_SRCS)
1728 AC_SUBST(PASSWD_OBJS)
1729 AC_SUBST(XMU_SRCS)
1730 AC_SUBST(XMU_OBJS)
1731 AC_SUBST(LOCK_SRCS)
1732 AC_SUBST(LOCK_OBJS)
1733 AC_SUBST(GL_EXES)
1734 AC_SUBST(GL_KLUDGE)
1735 AC_SUBST(HACKDIR)
1736 AC_SUBST(APPDEFAULTS)
1737
1738 AC_SUBST(DEPEND)
1739 AC_SUBST(DEPEND_FLAGS)
1740 AC_SUBST(DEPEND_DEFINES)
1741
1742 # Print some warnings before emitting the Makefiles.
1743 #
1744 warn_prefix_1="    Warning:"
1745 warn_prefix_2="       Note:"
1746 warn_prefix="$warn_prefix_1"
1747
1748 warning=no
1749 warnsep='    #################################################################'
1750
1751 warnpre() {
1752   if test "$warning" = no ; then
1753     echo '' ; echo "$warnsep" ; echo ''
1754     warning=yes
1755   fi
1756 }
1757
1758 warn() {
1759   warnpre
1760   if test "$warning" = long ; then echo '' ; fi
1761   warning=yes
1762   echo "$warn_prefix $@"
1763 }
1764
1765 warnL() {
1766   was=$warning
1767   warnpre
1768   warning=yes
1769   if test "$was" != no ; then echo '' ; fi
1770   echo "$warn_prefix $@"
1771 }
1772
1773 warn2() {
1774   echo "             $@"
1775   warning=long
1776 }
1777
1778 note() {
1779   warn_prefix="$warn_prefix_2"
1780   warn $@
1781   warn_prefix="$warn_prefix_1"
1782 }
1783
1784 noteL() {
1785   warn_prefix="$warn_prefix_2"
1786   warnL $@
1787   warn_prefix="$warn_prefix_1"
1788 }
1789
1790
1791 if test "$with_sgi_req" = yes -a "$have_sgi" = no ; then
1792   warn 'The SGI saver extension was requested, but was not found.'
1793 fi
1794
1795 if test "$with_mit_req" = yes -a "$have_mit" = no ; then
1796   warn 'The MIT saver extension was requested, but was not found.'
1797 fi
1798
1799 if test "$with_xidle_req" = yes -a "$have_xidle" = no ; then
1800   warn 'The XIdle extension was requested, but was not found.'
1801 fi
1802
1803 if test "$with_xshm_req" = yes -a "$have_xshm" = no ; then
1804   warn 'The XSHM extension was requested, but was not found.'
1805 fi
1806
1807 if test "$with_sgivc_req" = yes -a "$have_sgivc" = no ; then
1808   warn 'The SGI-VIDEO-CONTROL extension was requested, but was not found.'
1809 fi
1810
1811 if test "$with_dpms_req" = yes -a "$have_dpms" = no ; then
1812   warn 'The DPMS extension was requested, but was not found.'
1813 fi
1814
1815 if test "$have_motif" = no -a "$have_athena" = no ; then
1816   warnL "Neither Motif nor Athena widgets seem to be available;"
1817   warn2 "the \`xscreensaver-demo' program requires one or the"
1818   warn2 "other."
1819   proselytize_motif=no
1820
1821 elif test "$with_motif_req" = yes -a "$have_motif" = no ; then
1822   warnL "Use of Motif was requested, but it wasn't found;"
1823   warn2 "Athena will be used instead."
1824
1825 elif test "$with_athena_req" = yes -a "$have_athena" = no ; then
1826   warnL "Use of Athena was requested, but it wasn't found;"
1827   warn2 "Motif will be used instead."
1828 fi
1829
1830 if test "$have_motif" = yes -a "$have_lesstif" = yes ; then
1831
1832   preferred_lesstif=0.86
1833
1834   if test "$lesstif_version" = unknown; then
1835     warnL "Unable to determine the LessTif version number!"
1836     warn2 "Make sure you are using version $preferred_lesstif or newer."
1837     warn2 "See <http://www.lesstif.org/>."
1838
1839   elif test \! $lesstif_version -gt 82; then
1840     warnL "LessTif version $lesstif_version_string is being used."
1841     warn2 "LessTif versions 0.82 and earlier are too buggy to"
1842     warn2 "use with XScreenSaver; it is strongly recommended"
1843     warn2 "that you upgrade to at least version $preferred_lesstif!"
1844     warn2 "See <http://www.lesstif.org/>."
1845   fi
1846 fi
1847
1848 if test "$proselytize_motif" = yes ; then
1849     warnL "Athena widgets are being used instead of Motif."
1850     warn2 "The \`xscreensaver-demo' program looks much better"
1851     warn2 "with Motif.  Wouldn't you rather be using Motif?"
1852     warn2 "It is shipped by every commercial Unix vendor;"
1853     warn2 "and there is a free implementation available as"
1854     warn2 "well: see <http://www.lesstif.org/>."
1855 fi
1856
1857
1858 if test "$have_gl" = yes -a "$ac_have_mesa_gl" = yes ; then
1859   preferred_mesagl=2.7
1860
1861   if test "$ac_mesagl_version" = unknown; then
1862     warnL "Unable to determine the MesaGL version number!"
1863     warn2 "Make sure you are using version $preferred_mesagl or newer."
1864
1865   elif test \! "$ac_mesagl_version" -gt 2006; then
1866     warnL "MesaGL version $ac_mesagl_version_string is being used."
1867     warn2 "MesaGL versions 2.6 and earlier have a security bug."
1868     warn2 "It is strongly recommended that you upgrade to at"
1869     warn2 "least version $preferred_mesagl."
1870   fi
1871 fi
1872
1873
1874 if test "$have_xpm" = no ; then
1875   if test "$with_xpm_req" = yes ; then
1876     warnL 'Use of XPM was requested, but it was not found.'
1877   elif test "$with_xpm_req" = no ; then
1878     noteL 'The XPM library is not being used.'
1879   else
1880     noteL 'The XPM library was not found.'
1881   fi
1882
1883   echo ''
1884   warn2 'Some of the demos will not be as colorful as they'
1885   warn2 'could be.  You might want to consider installing XPM'
1886   warn2 'and re-running configure.  (Remember to delete the'
1887   warn2 'config.cache file first.)  You can find XPM at most'
1888   warn2 'X11 archive sites, such as <http://sunsite.unc.edu/>.'
1889 fi
1890
1891 if test "$have_gl" = no ; then
1892   if test "$with_gl_req" = yes ; then
1893     warnL 'Use of GL was requested, but it was not found.'
1894   elif test "$with_gl_req" = no ; then
1895     noteL 'The OpenGL 3D library is not being used.'
1896   else
1897     noteL 'The OpenGL 3D library was not found.'
1898   fi
1899
1900   echo ''
1901   warn2 'Those demos which use 3D will not be built or installed.'
1902   warn2 'You might want to consider installing OpenGL and'
1903   warn2 're-running configure.  (Remember to delete the'
1904   warn2 "config.cache file first.)  If your vendor doesn't ship"
1905   warn2 'their own implementation of OpenGL, you can get a free'
1906   warn2 'version at <http://www.ssec.wisc.edu/~brianp/Mesa.html>.'
1907   warn2 'For general OpenGL info, see <http://www.opengl.org/>.'
1908
1909 fi
1910
1911 if test "$with_readdisplay_req" = yes -a "$have_readdisplay" = no ; then
1912   warn 'Use of XReadDisplay was requested, but it was not found.'
1913 fi
1914
1915 if test "$with_sgivideo_req" = yes -a "$have_sgivideo" = no ; then
1916   warn 'Use of the Iris Video Library was requested, but it was not found.'
1917 fi
1918
1919 if test "$with_kerberos_req" = yes -a "$have_kerberos" = no ; then
1920   warn 'Use of Kerberos was requested, but it was not found.'
1921 fi
1922
1923 if test "$with_shadow_req" = yes -a "$have_shadow" = no ; then
1924   warn 'Use of shadow passwords was requested, but they were not found.'
1925 fi
1926
1927 if test -n "$with_zippy_req"; then
1928   if test "$with_zippy_req" != "$ac_cv_zippy_program" ; then
1929     warnL "$with_zippy_req was requested as the Zippy program,"
1930     warn2 "but was not found.  The default will be used instead."
1931   fi
1932 fi
1933
1934 if test "$warning" != no; then
1935   echo '' ; echo "$warnsep" ; echo ''
1936 fi
1937
1938
1939 AC_OUTPUT(Makefile
1940           utils/Makefile
1941           driver/Makefile
1942           hacks/Makefile
1943           hacks/glx/Makefile
1944           driver/XScreenSaver.ad)
1945
1946 # You are in a twisty maze of namespaces and syntaxes, all alike.
1947 # Fuck the skull of Unix.
1948 #
1949 eval bindir=${bindir}
1950 eval bindir=${bindir}
1951 eval bindir=${bindir}
1952 eval bindir=${bindir}
1953 eval bindir=${bindir}
1954 eval bindir=${bindir}
1955 eval HACKDIR=${HACKDIR}
1956 eval HACKDIR=${HACKDIR}
1957 eval HACKDIR=${HACKDIR}
1958 eval HACKDIR=${HACKDIR}
1959 eval HACKDIR=${HACKDIR}
1960 eval HACKDIR=${HACKDIR}
1961
1962 echo ""
1963 echo "$warnsep"
1964 echo ""
1965 echo '      When you run "make install", the "xscreensaver",'
1966 echo '      "xscreensaver-demo", and "xscreensaver-command" executables'
1967 echo "      will be installed in ${bindir}."
1968 echo ""
1969 echo "      The various graphics demos (80+ different executables) will"
1970 echo "      be installed in ${HACKDIR}."
1971 echo ""
1972 echo "      If you would prefer the demos to be installed elsewhere"
1973 echo "      (for example, in a dedicated directory) you should re-run"
1974 echo "      configure with the --enable-subdir=DIR option.  For more"
1975 echo "      information, run $0 --help."
1976 echo ""
1977 echo "$warnsep"
1978 echo ""