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