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