ftp://ftp.demon.nl/disk1/redhat-contrib/libc5/SRPMS/xscreensaver-2.14-1.src.rpm
[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       AC_MSG_RESULT(no idea)
23     ;;
24   esac
25 fi
26
27
28 AC_MSG_CHECKING([whether the compiler works on ANSI C])
29 AC_TRY_RUN([ main(int ac, char **av) { return 0; } ],
30    AC_MSG_RESULT(yes),
31    AC_MSG_RESULT(no)
32    AC_MSG_ERROR(Couldn't build even a trivial ANSI C program: check CC.),
33    AC_MSG_ERROR(Couldn't build even a trivial ANSI C program: check CC.))
34
35 case "$host" in
36   *-irix*)
37   if test -n "$GCC"; then
38     AC_MSG_RESULT(Turning on gcc compiler warnings.)
39     CC="$CC -Wall -Wstrict-prototypes -Wnested-externs -Wno-format"
40   else
41     # not gcc
42     AC_MSG_RESULT(Turning on SGI compiler warnings.)
43     CC="$CC -fullwarn -use_readonly_const -rdata_shared -g3"
44   fi
45   ;;
46 esac
47
48
49 AC_PROG_CPP
50 AC_PROG_INSTALL
51 AC_PROG_MAKE_SET
52
53 AC_C_CONST
54 AC_C_INLINE
55
56 AC_HEADER_STDC
57 AC_HEADER_TIME
58 AC_HEADER_SYS_WAIT
59 AC_HEADER_DIRENT
60
61 AC_TYPE_MODE_T
62 AC_TYPE_PID_T
63 AC_TYPE_SIGNAL
64 AC_TYPE_SIZE_T
65
66
67 AC_MSG_CHECKING(how to call gettimeofday)
68 AC_CACHE_VAL(ac_cv_gettimeofday_args,
69  [AC_TRY_COMPILE([#include <stdlib.h>
70                   #include <sys/time.h>],
71                  [struct timeval tv; gettimeofday(&tv);],
72                  [ac_gettimeofday_args=1],
73                  [AC_TRY_COMPILE([#include <stdlib.h>
74                                   #include <sys/time.h>],
75                                  [struct timeval tv; struct timezone tzp;
76                                   gettimeofday(&tv, &tzp);],
77                                  [ac_gettimeofday_args=2],
78                                  [ac_gettimeofday_args=0])])
79   ac_cv_gettimeofday_args=$ac_gettimeofday_args])
80 ac_gettimeofday_args=$ac_cv_gettimeofday_args
81 if test $ac_gettimeofday_args = 1 ; then
82   AC_DEFINE(HAVE_GETTIMEOFDAY)
83   AC_MSG_RESULT(one argument)
84 elif test $ac_gettimeofday_args = 2 ; then
85   AC_DEFINE(HAVE_GETTIMEOFDAY)
86   AC_DEFINE(GETTIMEOFDAY_TWO_ARGS)
87   AC_MSG_RESULT(two arguments)
88 else
89   AC_MSG_RESULT(unknown)
90 fi
91
92
93 AC_CHECK_FUNCS(select fcntl uname nice setpriority getcwd getwd putenv)
94 AC_CHECK_HEADERS(unistd.h)
95
96 dnl     /usr/local/src/ssh-1.2.17/putenv.c -- AC_REPLACE_FUNCS(putenv)
97
98
99 AC_ARG_ENABLE(subdir,[
100 Installation options:
101
102   --enable-subdir=DIR     Put the demo programs in a subdirectory of \`bindir',
103                           instead of putting them in bindir itself.  You can
104                           specify the name of the subdirectory.  For example,
105                           --exec-prefix=/usr/local/bin --enable-subdir=demos
106                           would put xscreensaver in /usr/local/bin/, and would
107                           put the demos in /usr/local/bin/demos/.  Note that if
108                           you do this, you must make sure that the directory
109                           is on your \$PATH before xscreensaver is started: the
110                           directory name is not hardcoded into the program.
111                           This merely sets the default installation location.
112
113   --disable-subdir        Just put the demos in \`bindir' (this is the default.)
114 ],
115   [enable_subdir="$enableval"],[enable_subdir=no])
116 if test x"$enable_subdir" = xno; then
117   HACKDIR='$(bindir)'
118 elif test x"$enable_subdir" = xyes -o x"$enable_subdir" = x ; then
119   echo "error: must be a subdirectory name: --enable-subdir=$enable_subdir"
120   exit 1
121 else
122   HACKDIR='$(bindir)/'$enable_subdir
123 fi
124
125
126 AC_PATH_XTRA
127
128 # Try and find the app-defaults directory.
129 # It sucks that autoconf doesn't do this already...
130 #
131 AC_DEFUN(AC_PATH_X_APP_DEFAULTS_XMKMF,
132   [
133   rm -fr conftestdir
134   if mkdir conftestdir; then
135     cd conftestdir
136     # Make sure to not put "make" in the Imakefile rules, since we grep it out.
137     cat > Imakefile <<'EOF'
138 acfindx:
139         @echo 'ac_x_app_defaults="${XAPPLOADDIR}"'
140 EOF
141     if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
142       # GNU make sometimes prints "make[1]: Entering...", which'd confuse us.
143       eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
144     fi
145     cd ..
146     rm -fr conftestdir
147   fi])
148
149 AC_DEFUN(AC_PATH_X_APP_DEFAULTS_DIRECT,
150 [  # Look for the directory under a standard set of common directories.
151   # Check X11 before X11Rn because it's often a symlink to the current release.
152   for ac_dir in                                 \
153     /usr/X11/lib/app-defaults                   \
154     /usr/X11R6/lib/app-defaults                 \
155     /usr/X11R6/lib/X11/app-defaults             \
156     /usr/X11R5/lib/app-defaults                 \
157     /usr/X11R5/lib/X11/app-defaults             \
158     /usr/X11R4/lib/app-defaults                 \
159     /usr/X11R4/lib/X11/app-defaults             \
160                                                 \
161     /usr/lib/X11/app-defaults                   \
162     /usr/lib/X11R6/app-defaults                 \
163     /usr/lib/X11R5/app-defaults                 \
164     /usr/lib/X11R4/app-defaults                 \
165                                                 \
166     /usr/local/X11/lib/app-defaults             \
167     /usr/local/X11R6/lib/app-defaults           \
168     /usr/local/X11R5/lib/app-defaults           \
169     /usr/local/X11R4/lib/app-defaults           \
170                                                 \
171     /usr/local/lib/X11/app-defaults             \
172     /usr/local/lib/X11R6/app-defaults           \
173     /usr/local/lib/X11R6/X11/app-defaults       \
174     /usr/local/lib/X11R5/app-defaults           \
175     /usr/local/lib/X11R5/X11/app-defaults       \
176     /usr/local/lib/X11R4/app-defaults           \
177     /usr/local/lib/X11R4/X11/app-defaults       \
178                                                 \
179     /usr/X386/lib/X11/app-defaults              \
180     /usr/x386/lib/X11/app-defaults              \
181     /usr/XFree86/lib/X11/app-defaults           \
182                                                 \
183     /usr/lib/X11/app-defaults                   \
184     /usr/local/lib/X11/app-defaults             \
185     /usr/unsupported/lib/X11/app-defaults       \
186     /usr/athena/lib/X11/app-defaults            \
187     /usr/local/x11r5/lib/X11/app-defaults       \
188     /usr/lpp/Xamples/lib/X11/app-defaults       \
189     /lib/usr/lib/X11/app-defaults               \
190                                                 \
191     /usr/openwin/lib/app-defaults               \
192     /usr/openwin/lib/X11/app-defaults           \
193     /usr/openwin/share/lib/app-defaults         \
194     /usr/openwin/share/lib/X11/app-defaults     \
195                                                 \
196     /X11R6/lib/app-defaults                     \
197     /X11R5/lib/app-defaults                     \
198     /X11R4/lib/app-defaults                     \
199     ; \
200   do
201     if test -d "$ac_dir"; then
202       ac_x_app_defaults=$ac_dir
203       break
204     fi
205   done
206 ])
207
208
209 AC_DEFUN(AC_PATH_X_APP_DEFAULTS,
210   [AC_REQUIRE_CPP()
211     AC_CACHE_CHECK([for X app-defaults directory], ac_cv_x_app_defaults,
212      [AC_PATH_X_APP_DEFAULTS_XMKMF
213       AC_PATH_X_APP_DEFAULTS_DIRECT
214       if test x"$ac_x_app_defaults" = x; then
215         ac_cv_x_app_defaults="/usr/lib/X11/app-defaults"
216       else
217         # Record where we found app-defaults for the cache.
218         ac_cv_x_app_defaults="$ac_x_app_defaults"
219       fi])
220     eval ac_x_app_defaults="$ac_cv_x_app_defaults"])
221
222 AC_PATH_X_APP_DEFAULTS
223
224 APPDEFAULTS=$ac_x_app_defaults
225
226
227 # Like AC_CHECK_HEADER, but it uses the already-computed -I directories.
228 #
229 AC_DEFUN(AC_CHECK_X_HEADER, [
230   ac_save_CPPFLAGS="$CPPFLAGS"
231   if test \! -z "$includedir" ; then 
232     CPPFLAGS="$CPPFLAGS -I$includedir"
233   fi
234   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
235   AC_CHECK_HEADER([$1], [$2])
236   CPPFLAGS="$ac_save_CPPFLAGS"])
237
238 # Like AC_EGREP_HEADER, but it uses the already-computed -I directories.
239 #
240 AC_DEFUN(AC_EGREP_X_HEADER, [
241   ac_save_CPPFLAGS="$CPPFLAGS"
242   if test \! -z "$includedir" ; then 
243     CPPFLAGS="$CPPFLAGS -I$includedir"
244   fi
245   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
246   AC_EGREP_HEADER([$1], [$2], [$3], [$4])
247   CPPFLAGS="$ac_save_CPPFLAGS"])
248
249 # Like AC_TRY_COMPILE, but it uses the already-computed -I directories.
250 #
251 AC_DEFUN(AC_TRY_X_COMPILE, [
252   ac_save_CPPFLAGS="$CPPFLAGS"
253   if test \! -z "$includedir" ; then 
254     CPPFLAGS="$CPPFLAGS -I$includedir"
255   fi
256   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
257   AC_TRY_COMPILE([$1], [$2], [$3], [$4])
258   CPPFLAGS="$ac_save_CPPFLAGS"])
259
260
261 # Like AC_CHECK_LIB, but it uses the already-computed -I and -L directories.
262 # Use this sparingly; it probably doesn't work very well on X programs.
263 #
264 AC_DEFUN(AC_CHECK_X_LIB, [
265   ac_save_CPPFLAGS="$CPPFLAGS"
266   ac_save_LDFLAGS="$LDFLAGS"
267   if test \! -z "$includedir" ; then 
268     CPPFLAGS="$CPPFLAGS -I$includedir"
269   fi
270   if test \! -z "$includedir" ; then 
271     CPPFLAGS="$CPPFLAGS -I$includedir"
272   fi
273   if test \! -z "$libdir" ; then
274     LDFLAGS="$LDFLAGS -L$libdir"
275   fi
276   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
277   if test \! -z "$x_libraries" ; then
278     LDFLAGS="$LDFLAGS -L$x_libraries"
279   fi
280   AC_CHECK_LIB([$1], [$2], [$3], [$4], [$5])
281   CPPFLAGS="$ac_save_CPPFLAGS"
282   LDFLAGS="$ac_save_LDFLAGS"])
283
284 # Like AC_TRY_RUN, but it uses the already-computed -I directories.
285 # (But not the -L directories!)
286 #
287 AC_DEFUN(AC_TRY_X_RUN, [
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_TRY_RUN([$1], [$2], [$3], [$4])
294   CPPFLAGS="$ac_save_CPPFLAGS"])
295
296
297
298
299
300 # check for the HP XHPDisableReset server extension headers.
301 #
302 AC_EGREP_X_HEADER(XHPDisableReset, X11/XHPlib.h,
303                   [AC_DEFINE(HAVE_XHPDISABLERESET)
304                    SAVER_LIBS="-lXhp11 $SAVER_LIBS"])
305
306
307 # Check for the availability of the XPointer typedef, and define it otherwise.
308 #
309 AC_CACHE_CHECK([for XPointer], ac_cv_xpointer,
310                 [AC_TRY_X_COMPILE([#include <X11/Xlib.h>],
311                                   [XPointer foo = (XPointer) 0;],
312                                   [ac_cv_xpointer=yes],
313                                   [ac_cv_xpointer=no])])
314 if test $ac_cv_xpointer != yes; then
315   AC_DEFINE(XPointer,[char*])
316 fi
317
318
319 case "$host" in
320   *-hpux*)
321     # Thanks for not making xmkmf find this by default, you losers.
322     if test -d /usr/lib/Motif1.2 ; then
323       X_CFLAGS="-I/usr/include/Motif1.2 $X_CFLAGS"
324       X_LIBS="-L/usr/lib/Motif1.2 $X_LIBS"
325     elif test -d /usr/lib/Motif1.1 ; then
326       X_CFLAGS="-I/usr/include/Motif1.1 $X_CFLAGS"
327       X_LIBS="-L/usr/lib/Motif1.1 $X_LIBS"
328     fi
329
330     # This too.  You losers.
331     if test -d /usr/contrib/X11R6/include ; then
332       X_CFLAGS="-I/usr/contrib/X11R6/include $X_CFLAGS"
333       X_LIBS="-L/usr/contrib/X11R6/lib $X_LIBS"
334     elif test -d /usr/contrib/X11R5/include ; then
335       X_CFLAGS="-I/usr/contrib/X11R5/include $X_CFLAGS"
336       X_LIBS="-L/usr/contrib/X11R5/lib $X_LIBS"
337     fi
338
339   ;;
340   *-solaris*)
341     # Same to you, pinheads.  (Is this really the standard location now?
342     # What happened to the joke that this kind of thing went in /opt?)
343     if test -f /usr/dt/include/Xm/Xm.h ; then
344       X_CFLAGS="$X_CFLAGS -I/usr/dt/include"
345       X_LIBS="$X_LIBS -L/usr/dt/lib -R:/usr/dt/lib"
346
347       # Some versions of Slowlaris Motif require -lgen.  But not all.  Why?
348       AC_CHECK_LIB(gen, regcmp, [X_LIBS="$X_LIBS -lgen"])
349     fi
350   ;;
351 esac
352
353
354
355 # Check for Xmu (some fucked up vendors don't ship it...)
356 #
357 have_xmu=no
358 AC_CHECK_X_HEADER(X11/Xmu/Error.h, [have_xmu=yes])
359 if test $have_xmu = no ; then
360   XMU_SRCS='$(UTILS_SRC)/xmu.c'
361   XMU_OBJS='$(UTILS_BIN)/xmu.o'
362 else
363   XMU_SRCS=''
364   XMU_OBJS=''
365   SAVER_LIBS="-lXmu $SAVER_LIBS"
366   HACK_LIBS="-lXmu $HACK_LIBS"
367   AC_DEFINE(HAVE_XMU)
368 fi
369
370
371 # See comp.windows.x FAQ question 124 about _get_wmShellWidgetClass on 4.1.x.
372 # The right fix is to get OpenWindows 3.0 patches 100512-02 and 100573-03.
373 #
374 if test $have_xmu = yes ; then
375   case "$host" in
376     *-sunos4*)
377     AC_CACHE_CHECK([for the SunOS 4.1.x _get_wmShellWidgetClass bug],
378                    ac_cv_sunos_xmu_bug,
379                    [ac_save_LDFLAGS="$LDFLAGS"
380                     if test \! -z "$x_libraries" ; then
381                       LDFLAGS="$LDFLAGS -L$x_libraries"
382                     fi
383                     # Note: this trick never works!  (Generally.)
384                     # We're only getting away with using AC_TRY_LINK
385                     # with X libraries because we know it's SunOS.
386                     LDFLAGS="$LDFLAGS -lXmu -lXt -lX11 -lXext -lm"
387                     AC_TRY_LINK(,,
388                                 [ac_cv_sunos_xmu_bug=no],
389                                 [ac_cv_sunos_xmu_bug=yes])
390                     LDFLAGS="$ac_save_LDFLAGS"])
391     if test $ac_cv_sunos_xmu_bug = yes ; then
392       AC_CACHE_CHECK([whether the compiler understands -static], 
393                      ac_cv_ld_static,
394                      [ac_save_LDFLAGS="$LDFLAGS"
395                       LDFLAGS="$LDFLAGS -static"
396                       AC_TRY_LINK(,,[ac_cv_ld_static=yes],[ac_cv_ld_static=no])
397                     LDFLAGS="$ac_save_LDFLAGS"])
398       if test $ac_cv_ld_static = yes ; then
399         LDFLAGS="$LDFLAGS -static"
400       else
401         LDFLAGS="$LDFLAGS -Bstatic"
402       fi
403     fi
404     ;;
405   esac
406 fi
407
408
409 # Check for the SGI SCREEN_SAVER server extension header.
410 #
411 have_sgi=no
412 with_sgi_req=unspecified
413 AC_ARG_WITH(sgi-ext,[
414 Server options:
415
416   --with-sgi-ext          Include support for the SGI SCREEN_SAVER
417                           server extension, if possible (this is the default).
418   --without-sgi-ext       Do not compile in support for this extension.],
419   [with_sgi="$withval"; with_sgi_req="$withval"],[with_sgi=yes])
420 if test $with_sgi = yes; then
421   AC_CHECK_X_HEADER(X11/extensions/XScreenSaver.h,
422                     [have_sgi=yes
423                      AC_DEFINE(HAVE_SGI_SAVER_EXTENSION)])
424
425 elif test $with_sgi != no; then
426   echo "error: must be yes or no: --with-sgi-ext=$with_sgi"
427   exit 1
428 fi
429
430 # Check for the MIT-SCREEN-SAVER server extension header,
431 # unless the SGI extension has already been found.
432 #
433 have_mit=no
434 with_mit_req=unspecified
435 AC_ARG_WITH(mit-ext,
436 [  --with-mit-ext          Include support for the MIT-SCREEN-SAVER
437                           server extension, if possible (this is the default).
438   --without-mit-ext       Do not compile in support for this extension.],
439   [with_mit="$withval"; with_mit_req="$withval"],[with_mit=yes])
440 if test $have_sgi != yes; then
441   if test $with_mit = yes; then
442     AC_CHECK_X_HEADER(X11/extensions/scrnsaver.h, [have_mit=yes])
443
444     # Now check to see if it's really in the library; XF86Free-3.3 ships
445     # scrnsaver.h, but doesn't include the code in libXext.a, the idiots!
446     #
447     if test $have_mit = yes; then
448       AC_CHECK_X_LIB(Xext, XScreenSaverRegister, [], [have_mit=no], -lm)
449
450       if test $have_mit = no; then
451         # Fuck!  Looks like XF86Free-3.3 actually puts it in XExExt instead
452         # of in Xext.  Thank you master, may I have another.
453         AC_CHECK_X_LIB(XExExt, XScreenSaverRegister,
454                        [have_mit=yes; SAVER_LIBS="$SAVER_LIBS -lXExExt"],
455                        [], -lX11 -lXext -lm)
456       fi
457
458       if test $have_mit = no; then
459         # Double fuck!  Looks like some versions of XFree86 (whichever version
460         # it is that comes with RedHat Linux 2.0 -- I can't find a version 
461         # number) put this garbage in Xss instead of Xext.  Thank you master,
462         #  may I have another.
463         AC_CHECK_X_LIB(Xss, XScreenSaverRegister,
464                        [have_mit=yes; SAVER_LIBS="$SAVER_LIBS -lXss"],
465                        [], -lX11 -lXext -lm)
466       fi
467
468     if test $have_mit = yes; then
469       AC_DEFINE(HAVE_MIT_SAVER_EXTENSION)
470     fi
471
472     fi
473
474   elif test $with_mit != no; then
475     echo "error: must be yes or no: --with-mit-ext=$with_mit"
476     exit 1
477   fi
478 fi
479
480
481 # Check for the XIDLE server extension header.
482 #
483 have_xidle=no
484 with_xidle_req=unspecified
485 AC_ARG_WITH(xidle-ext,
486 [  --with-xidle-ext        Include support for the XIDLE server extension,
487                           if possible (this is the default).
488   --without-xidle-ext     Do not compile in support for this extension.],
489   [with_xidle="$withval"; with_xidle_req="$withval"],[with_xidle=yes])
490 if test $with_xidle = yes; then
491   AC_CHECK_X_HEADER(X11/extensions/xidle.h,
492                     [have_xidle=yes
493                      AC_DEFINE(HAVE_XIDLE_EXTENSION)])
494 elif test $with_xidle != no; then
495   echo "error: must be yes or no: --with-xidle-ext=$with_xidle"
496   exit 1
497 fi
498
499
500 # Check for the XSHM server extension header.
501 #
502 have_xshm=no
503 with_xshm_req=unspecified
504 AC_ARG_WITH(xshm-ext,
505 [  --with-xshm-ext         Include support for the XSHM (Shared Memory) server
506                           extension, if possible (this is the default).
507   --without-xshm-ext      Do not compile in support for this extension.],
508   [with_xshm="$withval"; with_xshm_req="$withval"],[with_xshm=yes])
509 if test $with_xshm = yes; then
510
511   # first check for Xshm.h.
512   AC_CHECK_X_HEADER(X11/extensions/XShm.h, [have_xshm=yes])
513
514   # if that succeeded, then check for sys/ipc.h.
515   if test $have_xshm = yes; then
516     have_xshm=no
517     AC_CHECK_X_HEADER(sys/ipc.h, [have_xshm=yes])
518   fi
519
520   # if that succeeded, then check for sys/shm.h.
521   if test $have_xshm = yes; then
522     have_xshm=no
523     AC_CHECK_X_HEADER(sys/shm.h, [have_xshm=yes])
524   fi
525
526   # if that succeeded, then we've really got it.
527   if test $have_xshm = yes; then
528     AC_DEFINE(HAVE_XSHM_EXTENSION)
529   fi
530
531 elif test $with_xshm != no; then
532   echo "error: must be yes or no: --with-xshm-ext=$with_xshm"
533   exit 1
534 fi
535
536
537 # Check for the SGI-VIDEO-CONTROL server extension header.
538 #
539 have_sgivc=no
540 with_sgivc_req=unspecified
541 AC_ARG_WITH(sgivc-ext,
542 [  --with-sgivc-ext        Include support for the SGI-VIDEO-CONTROL server
543                           extension, if possible (this is the default).
544   --without-sgivc-ext     Do not compile in support for this extension.],
545   [with_sgivc="$withval"; with_sgivc_req="$withval"],[with_sgivc=yes])
546 if test $with_sgivc = yes; then
547
548   # first check for XSGIvc.h
549   AC_CHECK_X_HEADER(X11/extensions/XSGIvc.h, [have_sgivc=yes])
550
551   # if that succeeded, then check for the -lXsgivc
552   if test $have_sgivc = yes; then
553     have_sgivc=no
554     AC_CHECK_X_LIB(Xsgivc, XSGIvcQueryGammaMap,
555                   [have_sgivc=yes; SAVER_LIBS="$SAVER_LIBS -lXsgivc"], [],
556                   -lXext -lX11)
557   fi
558
559   # if that succeeded, then we've really got it.
560   if test $have_sgivc = yes; then
561     AC_DEFINE(HAVE_SGI_VC_EXTENSION)
562   fi
563
564 elif test $with_sgivc != no; then
565   echo "error: must be yes or no: --with-sgivc-ext=$with_sgivc"
566   exit 1
567 fi
568
569
570
571
572
573
574
575
576 # Check for Motif and Athena --with and --without arguments.
577 #
578 have_motif=no
579 have_athena=no
580 with_motif_req=unspecified
581 with_athena_req=unspecified
582
583 AC_ARG_WITH(motif,[
584 Toolkit options:
585
586   --with-motif            Use the Motif toolkit for the user interface,
587                           if possible (this is the default).
588   --without-motif         Do not use Motif.],
589   [with_motif="$withval"; with_motif_req="$withval"],[with_motif=no])
590
591 AC_ARG_WITH(athena,
592 [  --with-athena           Use the Athena toolkit for the user interface, if
593                           possible (this is the default if Motif isn't used.)
594   --without-athena        Do not use Athena.],
595   [with_athena="$withval"; with_athena_req="$withval"],[with_athena=no])
596
597 if test $with_motif != yes -a $with_motif != no ; then
598   echo "error: must be yes or no: --with-motif=$with_motif"
599   exit 1
600 fi
601
602 if test $with_athena != yes -a $with_athena != no ; then
603   echo "error: must be yes or no: --with-athena=$with_athena"
604   exit 1
605 fi
606
607
608 # Saying --without-motif is the same as saying --with-athena.
609 if test $with_motif_req = no ; then
610   with_athena_req=yes
611   with_athena=yes
612 fi
613
614 # Saying --without-athena is the same as saying --with-motif.
615 if test $with_athena_req = no ; then
616   with_motif_req=yes
617   with_motif=yes
618 fi
619
620 # Check for Motif and Athena headers.
621
622 check_motif() {
623   AC_CHECK_X_HEADER(Xm/Xm.h,
624                     [have_motif=yes
625                      AC_DEFINE(HAVE_MOTIF)
626                      SAVER_LIBS="-lXm $SAVER_LIBS"])
627 }
628
629 check_athena() {
630   AC_CHECK_X_HEADER(X11/Xaw/Dialog.h,
631                    [have_athena=yes
632                     AC_DEFINE(HAVE_ATHENA)
633                     SAVER_LIBS="-lXaw $SAVER_LIBS"])
634 }
635
636
637 # If they asked for both motif and athena, check motif then athena.
638 # If they asked for only motif, check motif then athena.
639 # If they asked for only athena, check athena then motif.
640 # If they asked for neither, check motif then athena.
641
642 proselytize_motif=yes
643 if test $with_motif = yes; then
644   # asked for both, or for motif only
645   check_motif
646   if test $have_motif = yes; then
647     with_athena=no
648     with_athena_req=no
649   else
650     check_athena
651   fi
652
653 elif test $with_athena = yes; then
654   # asked for athena only
655   check_athena
656   if test $have_athena = yes; then
657     with_motif=no
658     proselytize_motif=no
659   else
660     check_motif
661   fi
662
663 else
664   # asked for neither
665   check_motif
666   if test $have_motif = yes; then
667     with_athena=no
668   else
669     check_athena
670   fi
671
672 fi
673
674 if test $have_motif = yes; then
675   proselytize_motif=no
676 fi
677
678 # If we have Athena, check whether it's a version that includes
679 # XawViewportSetCoordinates in Viewport.h (R3 (or R4?) don't.)
680 if test $have_athena = yes ; then
681   AC_CACHE_CHECK([for XawViewportSetCoordinates in Viewport.h], 
682                  ac_cv_have_XawViewportSetCoordinates,
683                  [ac_cv_have_XawViewportSetCoordinates=no
684                   AC_EGREP_X_HEADER(XawViewportSetCoordinates, 
685                                     X11/Xaw/Viewport.h,
686                                     ac_cv_have_XawViewportSetCoordinates=yes)])
687   if test $ac_cv_have_XawViewportSetCoordinates = yes ; then
688     AC_DEFINE(HAVE_XawViewportSetCoordinates)
689   fi
690 fi
691
692
693 # If we have Motif, check whether it's really LessTif.
694 #
695 have_lesstif=no
696 if test $have_motif = yes ; then
697   AC_CACHE_CHECK([whether Motif is really LessTif], 
698                  ac_cv_have_lesstif,
699                  [AC_TRY_X_COMPILE([#include <Xm/Xm.h>],
700                                    [long vers = LesstifVersion;],
701                                    [ac_cv_have_lesstif=yes],
702                                    [ac_cv_have_lesstif=no])])
703   have_lesstif=$ac_cv_have_lesstif
704 fi
705
706 # don't cache this
707 unset ac_cv_good_lesstif
708
709 good_lesstif=no
710 if test $have_lesstif = yes ; then
711   # It must be at least "GNU Lesstif 0.82".
712   # #### If you change this, also sync the warning message lower down.
713   AC_CACHE_CHECK([whether LessTif is of a recent enough vintage],
714                  ac_cv_good_lesstif,
715                  [AC_TRY_X_RUN([#include <Xm/Xm.h>
716                                 int main() { exit(LesstifVersion < 82); }],
717                                [ac_cv_good_lesstif=yes],
718                                [ac_cv_good_lesstif=no],
719                                # cross compiling?  Make an ass out of umption.
720                                [ac_cv_good_lesstif=yes])])
721   good_lesstif=$ac_cv_good_lesstif
722 fi
723
724
725 # check for XPM header.
726 #
727 have_xpm=no
728 with_xpm_req=unspecified
729 AC_ARG_WITH(xpm,[
730 Demo options:
731
732   --with-xpm              Include support for XPM files in some demos,
733                           if possible (this is the default).
734   --without-xpm           Do not compile in support for XPM files.],
735   [with_xpm="$withval"; with_xpm_req="$withval"],[with_xpm=yes])
736 if test $with_xpm = yes; then
737   AC_CHECK_X_HEADER(X11/xpm.h,
738                    [have_xpm=yes
739                     AC_DEFINE(HAVE_XPM)
740                     XPM_LIBS="-lXpm"])
741 elif test $with_xpm != no; then
742   echo "error: must be yes or no: --with-xpm=$with_xpm"
743   exit 1
744 fi
745
746
747 # check for the GL header
748 #
749 have_gl=no
750 with_gl_req=unspecified
751 AC_ARG_WITH(gl,
752 [  --with-gl               Build those demos which depend on OpenGL,
753                           if possible (this is the default).
754   --without-gl            Do not build the OpenGL demos.],
755   [with_gl="$withval"; with_gl_req="$withval"],[with_gl=yes])
756
757 if test $with_gl = yes; then
758   AC_CHECK_X_HEADER(GL/gl.h, have_gl=yes, have_gl=no)
759   if test $have_gl = yes ; then
760     AC_CHECK_X_HEADER(GL/glx.h, have_gl=yes, have_gl=no)
761   fi
762
763   # If we have the headers, try and figure out which vendor it's from.
764   #
765   if test $have_gl = yes ; then
766
767     AC_DEFINE(HAVE_GL)
768     have_mesa_gl=no
769     AC_EGREP_X_HEADER(Mesa, GL/glx.h, [have_mesa_gl=yes])
770     if test $have_mesa_gl = no ; then
771       GL_LIBS="-lGL -lGLU"
772     else
773       AC_DEFINE(HAVE_MESA_GL)
774       GL_LIBS="-lMesaGL -lMesaGLU"
775     fi
776   fi
777
778 elif test $with_gl != no; then
779   echo "error: must be yes or no: --with-gl=$with_gl"
780   exit 1
781 fi
782
783
784 # check for SGI XReadDisplay server extension header.
785 #
786 have_readdisplay=no
787 with_readdisplay_req=unspecified
788 AC_ARG_WITH(readdisplay,
789 [  --with-readdisplay      Include support for the XReadDisplay server
790                           extension if possible (this is the default).
791   --without-readdisplay   Do not compile in support for this extension.],
792   [with_readdisplay="$withval"; with_readdisplay_req="$withval"],
793   [with_readdisplay=yes])
794 if test $with_readdisplay = yes; then
795   AC_CHECK_X_HEADER(X11/extensions/readdisplay.h,
796                     AC_DEFINE(HAVE_READ_DISPLAY_EXTENSION))
797 elif test $with_readdisplay != no; then
798   echo "error: must be yes or no: --with-readdisplay=$with_readdisplay"
799   exit 1
800 fi
801
802
803 # check for SGI's Iris Video Library header.
804 #
805 have_sgivideo=no
806 with_sgivideo_req=unspecified
807 AC_ARG_WITH(sgivideo,
808 [  --with-sgivideo         Include support for SGI's Iris Video Library
809                           if possible (this is the default).
810   --without-sgivideo       Do not compile in support for this library.],
811   [with_sgivideo="$withval"; with_sgivideo_req="$withval"],
812   [with_sgivideo=yes])
813 if test $with_sgivideo = yes; then
814   AC_CHECK_X_HEADER(dmedia/vl.h, have_sgivideo=yes)
815   if test $have_sgivideo = yes; then
816     have_sgivideo=no
817     AC_CHECK_LIB(vl, vlOpenVideo, have_sgivideo=yes)
818     if test $have_sgivideo = yes; then
819       SGI_VIDEO_OBJS="$(UTILS_SRC)/sgivideo.o"
820       SGI_VIDEO_LIBS="-lvl"
821       AC_DEFINE(HAVE_SGI_VIDEO)
822     fi
823   fi
824 elif test $with_sgivideo != no; then
825   echo "error: must be yes or no: --with-sgivideo=$with_sgivideo"
826   exit 1
827 fi
828
829
830
831 # Try to find a program to generate random text.
832 #
833 # Zippy is funnier than the idiocy generally spat out by `fortune',
834 # so try to find that, by invoking Emacs and asking it where its 
835 # libexec directory is ("yow" lives in there.)
836 #
837 # If that doesn't work, see if fortune, zippy, or yow are on $PATH,
838 # and if so, use them.
839 #
840 # If that doesn't work, look in /usr/games, and if it's there, use
841 # the full pathname.
842 #
843 with_zippy_req=""
844 AC_ARG_WITH(zippy,
845 [  --with-zippy=PROGRAM    Some demos are able to run an external program and
846                           display its text; this names the program to use by
847                           default (though it can be overridden with X
848                           resources.)  If you don't specify this, the default
849                           is to use \"yow\" from the Emacs distribution (if you
850                           have it) or else to use \"fortune\".],
851   [ with_zippy_req="$withval"; with_zippy="$withval" ],
852   [ with_zippy_req="$withval"; with_zippy="$withval" ])
853
854 if test "$with_zippy" = no || test "$with_zippy" = yes ; then
855   with_zippy=""
856   with_zippy_req=""
857 fi
858
859 if test -n "$with_zippy_req" ; then
860   ac_cv_zippy_program=""
861   case "$with_zippy_req" in
862     /*)
863       AC_MSG_CHECKING([for $with_zippy_req])
864       if test -x "$with_zippy_req" ; then
865         AC_MSG_RESULT(yes)
866       else
867         AC_MSG_RESULT(no)
868         with_zippy=""
869       fi
870     ;;
871     *)
872       # don't cache
873       unset ac_cv_path_zip2
874       AC_PATH_PROG(zip2, $with_zippy_req, [])
875       if test "$zip2" = ""; then
876         with_zippy=""
877       fi
878     ;;
879   esac
880   ac_cv_zippy_program="$with_zippy"
881
882 elif test -n "$ac_cv_zippy_program"; then
883   AC_MSG_RESULT([checking for zippy... (cached) $ac_cv_zippy_program])
884 fi
885
886 if test ! -n "$ac_cv_zippy_program"; then
887
888   AC_CHECK_PROGS(emacs_exe, emacs)
889   AC_CHECK_PROGS(xemacs_exe, xemacs)
890
891   ac_cv_zippy_program=""
892   eargs='-batch -q -nw --eval'
893
894   if test -n "$emacs_exe" ; then
895     AC_MSG_CHECKING([for emacs yow])
896     #
897     # get emacs to tell us where the libexec directory is.
898     #
899     dir=`$emacs_exe $eargs '(princ (concat exec-directory "\n"))' \
900          2>/dev/null | tail -1`
901     dir=`echo "$dir" | sed 's@///*@/@g;s@/$@@'`
902     #
903     # try running libexec/yow and see if it exits without error.
904     #
905     if test x"$dir" != x -a -x $dir/yow ; then
906       if $dir/yow >&- 2>&- ; then
907         ac_cv_zippy_program="$dir/yow"
908         AC_MSG_RESULT($ac_cv_zippy_program)
909       else
910         AC_MSG_RESULT(no)
911       fi
912     fi
913   fi
914
915   if test -z "$ac_cv_zippy_program" ; then
916     AC_MSG_CHECKING([for xemacs yow])
917     if test -n "$xemacs_exe" ; then
918       #
919       # get xemacs to tell us where the libexec directory is.
920       #
921       dir=`$xemacs_exe $eargs '(princ (concat exec-directory "\n"))' \
922            2>/dev/null | tail -1`
923       dir=`echo "$dir" | sed 's@///*@/@g;s@/$@@'`
924       #
925       # try running libexec/yow and see if it exits without error.
926       #
927       if test x"$dir" != x -a -x $dir/yow ; then
928         if $dir/yow >&- 2>&- ; then
929           ac_cv_zippy_program="$dir/yow"
930           AC_MSG_RESULT($ac_cv_zippy_program)
931         else
932           #
933           # in some xemacs installations, the pathname of the yow.lines file
934           # isn't hardcoded into the yow executable, and must be passed on 
935           # the command line.  See if it's in libexec/../etc/.
936
937           # M4 sucks!!
938           changequote(X,Y)
939           dir_up=`echo "$dir" | sed 's@/[^/]*$@@'`
940           changequote([,])
941
942           yow="yow -f $dir_up/etc/yow.lines"
943           if $dir/$yow >&- 2>&- ; then
944             ac_cv_zippy_program="$dir/$yow"
945             AC_MSG_RESULT($ac_cv_zippy_program)
946           else
947             AC_MSG_RESULT(no)
948           fi
949         fi
950       fi
951     fi
952   fi
953
954   # if that didn't work, try for some other programs...
955   if test -z "$ac_cv_zippy_program" ; then
956     fortune=''
957     AC_CHECK_PROGS(fortune, [fortune zippy yow])
958     # if that didn't work, try for those programs in /usr/games...
959     if test -z "$fortune" ; then
960       AC_PATH_PROGS(fortune, [fortune zippy yow], fortune,
961                     /usr/games:/usr/local/games)
962     fi
963   fi
964 fi
965
966 if test -z "$ac_cv_zippy_program" ; then
967   ac_cv_zippy_program=fortune
968 fi
969
970 AC_DEFINE_UNQUOTED(ZIPPY_PROGRAM, "$ac_cv_zippy_program")
971
972
973
974
975 # Allow locking to be disabled at compile-time.
976 #
977 have_locking=yes
978 have_kerberos=no
979 with_kerberos_req=unspecified
980 have_shadow=no
981 with_shadow_req=unspecified
982 need_setuid=no
983
984 AC_ARG_ENABLE(locking,[
985 Locking options:
986
987   --enable-locking        Compile in support for locking the display
988                           (this is the default.)
989   --disable-locking       Do not allow locking at all.],
990   [enable_locking="$enableval"],[enable_locking=yes])
991 if test $enable_locking = yes; then
992
993   # Check for Kerberos.
994   #
995   AC_ARG_WITH(kerberos, [
996   --with-kerberos         Include support for Kerberos authentication,
997                           if possible (this is the default.)
998   --without-kerberos      Do not compile in support for Kerberos.],
999   [with_kerberos="$withval"; with_kerberos_req="$withval"],[with_kerberos=yes])
1000   if test $with_kerberos = yes; then
1001     AC_CACHE_CHECK([for Kerberos], ac_cv_kerberos,
1002                    [AC_TRY_X_COMPILE([#include <krb.h>],,
1003                                      [ac_cv_kerberos=yes],
1004                                      [ac_cv_kerberos=no])])
1005     if test $ac_cv_kerberos = yes ; then
1006       have_kerberos=yes
1007       AC_DEFINE(HAVE_KERBEROS)
1008       PASSWD_LIBS="$PASSWD_LIBS -lkrb -ldes -lnsl -lsocket"
1009     fi
1010   elif test $with_kerberos != no; then
1011     echo "error: must be yes or no: --with-kerberos=$with_kerberos"
1012     exit 1
1013   fi
1014
1015   # Next, check for the nine billion variants of shadow passwords...
1016
1017   passwd_cruft_done=no
1018   AC_ARG_WITH(shadow,
1019 [  --with-shadow           Include support for shadow password authentication,
1020                           if possible (this is the default, if no Kerberos.)
1021   --without-shadow        Do not compile in support for shadow passwords.
1022 ],
1023   [with_shadow="$withval"; with_shadow_req="$withval"],[with_shadow=yes])
1024   if test $with_shadow = no; then
1025     passwd_cruft_done=yes
1026   elif test $with_shadow != yes; then
1027     echo "error: must be yes or no: --with-shadow=$with_shadow"
1028     exit 1
1029   fi
1030
1031
1032   # Sun's "adjunct" passwords.
1033   #
1034   if test $passwd_cruft_done = no ; then
1035     AC_CACHE_CHECK([for Sun-style shadow passwords], ac_cv_sun_adjunct,
1036                    [AC_TRY_X_COMPILE([#include <stdlib.h>
1037                                       #include <unistd.h>
1038                                       #include <sys/types.h>
1039                                       #include <sys/label.h>
1040                                       #include <sys/audit.h>
1041                                       #include <pwdadj.h>],
1042                         [struct passwd_adjunct *p = getpwanam("nobody");
1043                          const char *pw = p->pwa_passwd;],
1044                         [ac_cv_sun_adjunct=yes],
1045                         [ac_cv_sun_adjunct=no])])
1046     if test $ac_cv_sun_adjunct = yes; then
1047       have_shadow=yes
1048       need_setuid=yes
1049       passwd_cruft_done=yes
1050       AC_DEFINE(HAVE_ADJUNCT_PASSWD)
1051     fi
1052   fi
1053
1054   # DEC and SCO so-called "enhanced" security.
1055   #
1056   if test $passwd_cruft_done = no ; then
1057     AC_CACHE_CHECK([for DEC-style shadow passwords], ac_cv_enhanced_passwd,
1058                    [AC_TRY_X_COMPILE([#include <stdlib.h>
1059                                       #include <unistd.h>
1060                                       #include <sys/types.h>
1061                                       #include <pwd.h>
1062                                       #include <sys/security.h>
1063                                       #include <prot.h>],
1064                         [struct pr_passwd *p;
1065                          const char *pw;
1066                          set_auth_parameters(0, 0);
1067                          check_auth_parameters();
1068                          p = getprpwnam("nobody");
1069                          pw = p->ufld.fd_encrypt;],
1070                         [ac_cv_enhanced_passwd=yes],
1071                         [ac_cv_enhanced_passwd=no])])
1072     if test $ac_cv_enhanced_passwd = yes; then
1073       have_shadow=yes
1074       need_setuid=yes
1075       passwd_cruft_done=yes
1076       AC_DEFINE(HAVE_ENHANCED_PASSWD)
1077
1078       # On SCO, getprpwnam() is in -lprot (which uses nap() from -lx)
1079       # (I'm told it needs -lcurses too, but I don't understand why.)
1080       AC_CHECK_LIB(prot, getprpwnam, 
1081                    [PASSWD_LIBS="$PASSWD_LIBS -lprot -lcurses -lx"],
1082                    [# On DEC, getprpwnam() is in -lsecurity
1083                     AC_CHECK_LIB(security, getprpwnam, 
1084                                  [PASSWD_LIBS="$PASSWD_LIBS -lsecurity"])],
1085                    [-lx])
1086     fi
1087   fi
1088
1089   # HP's entry in the "Not Invented Here" Sweepstakes.
1090   #
1091   if test $passwd_cruft_done = no ; then
1092     AC_CACHE_CHECK([for HP-style shadow passwords], ac_cv_hpux_passwd,
1093                    [AC_TRY_X_COMPILE([#include <stdlib.h>
1094                                       #include <unistd.h>
1095                                       #include <sys/types.h>
1096                                       #include <pwd.h>
1097                                       #include <hpsecurity.h>
1098                                       #include <prot.h>],
1099                         [struct s_passwd *p = getspwnam("nobody");
1100                          const char *pw = p->pw_passwd;],
1101                         [ac_cv_hpux_passwd=yes],
1102                         [ac_cv_hpux_passwd=no])])
1103     if test $ac_cv_hpux_passwd = yes; then
1104       have_shadow=yes
1105       need_setuid=yes
1106       passwd_cruft_done=yes
1107       AC_DEFINE(HAVE_HPUX_PASSWD)
1108
1109       # on HPUX, bigcrypt is in -lsec
1110       AC_CHECK_LIB(sec, bigcrypt, [PASSWD_LIBS="$PASSWD_LIBS -lsec"])
1111     fi
1112   fi
1113
1114   # Traditional (ha!) shadow passwords.
1115   #
1116   if test $passwd_cruft_done = no ; then
1117     AC_CACHE_CHECK([for generic shadow passwords], ac_cv_shadow,
1118                    [AC_TRY_X_COMPILE([#include <stdlib.h>
1119                                       #include <unistd.h>
1120                                       #include <sys/types.h>
1121                                       #include <pwd.h>
1122                                       #include <shadow.h>],
1123                         [struct spwd *p = getspnam("nobody");
1124                          const char *pw = p->sp_pwdp;],
1125                         [ac_cv_shadow=yes],
1126                         [ac_cv_shadow=no])])
1127     if test $ac_cv_shadow = yes; then
1128       have_shadow=yes
1129       need_setuid=yes
1130       passwd_cruft_done=yes
1131       AC_DEFINE(HAVE_SHADOW_PASSWD)
1132
1133       # On some systems (UnixWare 2.1), getspnam() is in -lgen instead of -lc.
1134       have_getspnam=no
1135       AC_CHECK_LIB(c, getspnam, [have_getspnam=yes])
1136       if test $have_getspnam = no ; then
1137         AC_CHECK_LIB(gen, getspnam,
1138                      [have_getspnam=yes; PASSWD_LIBS="$PASSWD_LIBS -lgen"])
1139       fi
1140     fi
1141   fi
1142
1143   # On some systems (UnixWare 2.1), crypt() is in -lcrypt instead of -lc.
1144   have_crypt=no
1145   AC_CHECK_LIB(c, crypt, [have_crypt=yes])
1146   if test $have_crypt = no ; then
1147     AC_CHECK_LIB(crypt, crypt,
1148                  [have_crypt=yes; PASSWD_LIBS="$PASSWD_LIBS -lcrypt"])
1149   fi
1150
1151
1152   # Most of the above shadow mechanisms will have set need_setuid to yes,
1153   # if they were found.  But, on some systems, we need setuid even when
1154   # using plain old vanilla passwords.
1155   #
1156   if test $need_setuid = no ; then
1157     case "$host" in
1158       *-hpux* | *-aix* | *-netbsd* | *-freebsd* | *-openbsd* )
1159         need_setuid=yes
1160       ;;
1161     esac
1162   fi
1163
1164 elif test $enable_locking = no; then
1165   AC_DEFINE(NO_LOCKING)
1166 else
1167   echo "error: must be yes or no: --enable-locking=$enable_locking"
1168   exit 1
1169 fi
1170
1171
1172
1173 if test \! -z "$includedir" ; then 
1174   INCLUDES="-I$includedir"
1175 fi
1176
1177 if test \! -z "$libdir" ; then
1178   LDFLAGS="$LDFLAGS -L$libdir"
1179 fi
1180
1181
1182 ##### should have options to override the DEPEND crap, I guess...
1183 DEPEND=makedepend
1184 DEPEND_FLAGS=
1185 DEPEND_DEFINES=
1186
1187
1188
1189 # Done testing things -- now substitute in some stuff for the Makefiles.
1190 #
1191 if test $have_motif = yes; then
1192   AC_DEFINE(HAVE_MOTIF)
1193   DIALOG_SRCS='$(MOTIF_SRCS)'
1194   DIALOG_OBJS='$(MOTIF_OBJS)'
1195 elif test $have_athena = yes; then
1196   AC_DEFINE(HAVE_ATHENA)
1197   DIALOG_SRCS='$(ATHENA_SRCS)'
1198   DIALOG_OBJS='$(ATHENA_OBJS)'
1199 else
1200   DIALOG_SRCS=''
1201   DIALOG_OBJS=''
1202 fi
1203
1204 if test $have_kerberos = yes; then
1205   PASSWD_SRCS='$(KERBEROS_SRCS)'
1206   PASSWD_OBJS='$(KERBEROS_OBJS)'
1207 else
1208   PASSWD_SRCS='$(PWENT_SRCS)'
1209   PASSWD_OBJS='$(PWENT_OBJS)'
1210 fi
1211
1212 if test $enable_locking = yes; then
1213   LOCK_SRCS='$(LOCK_SRCS_1) $(PASSWD_SRCS)'
1214   LOCK_OBJS='$(LOCK_OBJS_1) $(PASSWD_OBJS)'
1215 else
1216   LOCK_SRCS=''
1217   LOCK_OBJS=''
1218 fi
1219
1220 if test $need_setuid = yes; then
1221   NEED_SETUID=yes
1222   INSTALL_SETUID='$(INSTALL) $(SUID_FLAGS)'
1223 else
1224   NEED_SETUID=no
1225   INSTALL_SETUID='$(INSTALL_PROGRAM)'
1226 fi
1227
1228 tab='   '
1229 if test $have_gl = yes; then
1230   GL_EXES='$(GL_EXES)'
1231   GL_KLUDGE_1=${tab}${tab}${tab}${tab}${tab}${tab}${tab}${tab}${tab}'  \'
1232   GL_KLUDGE_2=${tab}
1233 else
1234   GL_KLUDGE_1=${tab}${tab}${tab}${tab}${tab}${tab}${tab}${tab}${tab}'\n'
1235   GL_KLUDGE_2='!'${tab}
1236 fi
1237
1238 AC_SUBST(INCLUDES)
1239
1240 AC_SUBST(SAVER_LIBS)
1241 AC_SUBST(HACK_LIBS)
1242 AC_SUBST(XPM_LIBS)
1243 AC_SUBST(GL_LIBS)
1244 AC_SUBST(PASSWD_LIBS)
1245 AC_SUBST(INSTALL_SETUID)
1246 AC_SUBST(NEED_SETUID)
1247 AC_SUBST(SGI_VIDEO_OBJS)
1248 AC_SUBST(SGI_VIDEO_LIBS)
1249
1250 AC_SUBST(DIALOG_SRCS)
1251 AC_SUBST(DIALOG_OBJS)
1252 AC_SUBST(PASSWD_SRCS)
1253 AC_SUBST(PASSWD_OBJS)
1254 AC_SUBST(XMU_SRCS)
1255 AC_SUBST(XMU_OBJS)
1256 AC_SUBST(LOCK_SRCS)
1257 AC_SUBST(LOCK_OBJS)
1258 AC_SUBST(GL_EXES)
1259 AC_SUBST(GL_KLUDGE_1)
1260 AC_SUBST(GL_KLUDGE_2)
1261 AC_SUBST(HACKDIR)
1262 AC_SUBST(APPDEFAULTS)
1263
1264 AC_SUBST(DEPEND)
1265 AC_SUBST(DEPEND_FLAGS)
1266 AC_SUBST(DEPEND_DEFINES)
1267
1268 # Print some warnings before emitting the Makefiles.
1269 #
1270 warning=no
1271 warnsep='    #################################################################'
1272 warnpre() {
1273   if test $warning = no ; then
1274     echo '' ; echo "$warnsep" ; echo ''
1275     warning=yes
1276   fi
1277 }
1278
1279 warn() {
1280   warnpre
1281   if test $warning = long ; then echo '' ; fi
1282   warning=yes
1283   echo "    Warning: $@"
1284 }
1285
1286 warnL() {
1287   was=$warning
1288   warnpre
1289   warning=yes
1290   if test $was != no ; then echo '' ; fi
1291   echo "    Warning: $@"
1292 }
1293
1294 warn2() {
1295   echo "             $@"
1296   warning=long
1297 }
1298
1299 if test $with_sgi_req = yes -a $have_sgi = no ; then
1300   warn 'The SGI saver extension was requested, but was not found.'
1301 fi
1302
1303 if test $with_mit_req = yes -a $have_mit = no ; then
1304   warn 'The MIT saver extension was requested, but was not found.'
1305 fi
1306
1307 if test $with_xidle_req = yes -a $have_xidle = no ; then
1308   warn 'The XIdle extension was requested, but was not found.'
1309 fi
1310
1311 if test $with_xshm_req = yes -a $have_xshm = no ; then
1312   warn 'The XSHM extension was requested, but was not found.'
1313 fi
1314
1315 if test $with_sgivc_req = yes -a $have_sgivc = no ; then
1316   warn 'The SGI-VIDEO-CONTROL extension was requested, but was not found.'
1317 fi
1318
1319 if test $have_motif = no -a $have_athena = no ; then
1320   warnL "Neither Motif nor Athena widgets seem to be available;"
1321   warn2 "one or the other is required."
1322   proselytize_motif=no
1323
1324 elif test $with_motif_req = yes -a $have_motif = no ; then
1325   warnL "Use of Motif was requested, but it wasn't found;"
1326   warn2 "Athena will be used instead."
1327
1328 elif test $with_athena_req = yes -a $have_athena = no ; then
1329   warnL "Use of Athena was requested, but it wasn't found;"
1330   warn2 "Motif will be used instead."
1331 fi
1332
1333 if test $have_motif = yes -a $have_lesstif = yes ; then
1334   if test $good_lesstif != yes ; then
1335     warnL "Motif is being used, but it appears to actually be"
1336     warn2 "LessTif, and the version number is less than 0.82!"
1337     warn2 "Such old versions of LessTif are too buggy to use"
1338     warn2 "with XScreenSaver; it is strongly recommended that"
1339     warn2 "you upgrade!  See <http://www.lesstif.org/>."
1340   fi
1341 fi
1342
1343 if test $proselytize_motif = yes ; then
1344     warnL "Athena widgets are being used instead of Motif."
1345     warn2 "XScreenSaver looks much better with Motif, and has"
1346     warn2 "a few extra features as well.  Wouldn't you rather"
1347     warn2 "be using Motif?  It is shipped by every commercial"
1348     warn2 "Unix vendor; and there is a free implementation"
1349     warn2 "available as well: see <http://www.lesstif.org/>."
1350 fi
1351
1352 if test $with_xpm_req = yes -a $have_xpm = no ; then
1353   warn 'Use of XPM was requested, but it was not found.'
1354 fi
1355
1356 if test $with_gl_req = yes -a $have_gl = no ; then
1357   warn 'Use of GL was requested, but it was not found.'
1358 fi
1359
1360 if test $with_readdisplay_req = yes -a $have_readdisplay = no ; then
1361   warn 'Use of XReadDisplay was requested, but it was not found.'
1362 fi
1363
1364 if test $with_sgivideo_req = yes -a $have_sgivideo = no ; then
1365   warn 'Use of the Iris Video Library was requested, but it was not found.'
1366 fi
1367
1368 if test $with_kerberos_req = yes -a $have_kerberos = no ; then
1369   warn 'Use of Kerberos was requested, but it was not found.'
1370 fi
1371
1372 if test $with_shadow_req = yes -a $have_shadow = no ; then
1373   warn 'Use of shadow passwords was requested, but they were not found.'
1374 fi
1375
1376 if test -n "$with_zippy_req"; then
1377   if test "$with_zippy_req" != "$ac_cv_zippy_program" ; then
1378     warnL "$with_zippy_req was requested as the Zippy program,"
1379     warn2 "but was not found.  The default will be used instead."
1380   fi
1381 fi
1382
1383 if test $warning != no; then
1384   echo '' ; echo "$warnsep" ; echo ''
1385 fi
1386
1387
1388 AC_OUTPUT(Makefile
1389           utils/Makefile
1390           driver/Makefile
1391           hacks/Makefile
1392           hacks/glx/Makefile
1393           driver/XScreenSaver.ad)