1 # configure.in --- xscreensaver, Copyright (c) 1997 Jamie Zawinski.
4 AC_INIT(driver/subprocs.c)
5 AC_CONFIG_HEADER(config.h)
10 if test -z "$GCC"; then
11 AC_MSG_CHECKING(how to request ANSI compilation)
14 AC_MSG_RESULT(HPUX: adding -Ae)
18 AC_MSG_RESULT(AIX: adding -qlanglvl=ansi -qhalt=e)
19 CC="$CC -qlanglvl=ansi -qhalt=e"
22 AC_MSG_RESULT(no idea)
28 AC_MSG_CHECKING([whether the compiler works on ANSI C])
29 AC_TRY_RUN([ main(int ac, char **av) { return 0; } ],
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.))
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"
42 AC_MSG_RESULT(Turning on SGI compiler warnings.)
43 CC="$CC -fullwarn -use_readonly_const -rdata_shared -g3"
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)
89 AC_MSG_RESULT(unknown)
93 AC_CHECK_FUNCS(select fcntl uname nice setpriority getcwd getwd putenv)
94 AC_CHECK_HEADERS(unistd.h)
96 dnl /usr/local/src/ssh-1.2.17/putenv.c -- AC_REPLACE_FUNCS(putenv)
99 AC_ARG_ENABLE(subdir,[
100 Installation options:
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.
113 --disable-subdir Just put the demos in \`bindir' (this is the default.)
115 [enable_subdir="$enableval"],[enable_subdir=no])
116 if test x"$enable_subdir" = xno; then
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"
122 HACKDIR='$(bindir)/'$enable_subdir
128 # Try and find the app-defaults directory.
129 # It sucks that autoconf doesn't do this already...
131 AC_DEFUN(AC_PATH_X_APP_DEFAULTS_XMKMF,
134 if mkdir conftestdir; then
136 # Make sure to not put "make" in the Imakefile rules, since we grep it out.
137 cat > Imakefile <<'EOF'
139 @echo 'ac_x_app_defaults="${XAPPLOADDIR}"'
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`
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.
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 \
161 /usr/lib/X11/app-defaults \
162 /usr/lib/X11R6/app-defaults \
163 /usr/lib/X11R5/app-defaults \
164 /usr/lib/X11R4/app-defaults \
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 \
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 \
179 /usr/X386/lib/X11/app-defaults \
180 /usr/x386/lib/X11/app-defaults \
181 /usr/XFree86/lib/X11/app-defaults \
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 \
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 \
196 /X11R6/lib/app-defaults \
197 /X11R5/lib/app-defaults \
198 /X11R4/lib/app-defaults \
201 if test -d "$ac_dir"; then
202 ac_x_app_defaults=$ac_dir
209 AC_DEFUN(AC_PATH_X_APP_DEFAULTS,
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"
217 # Record where we found app-defaults for the cache.
218 ac_cv_x_app_defaults="$ac_x_app_defaults"
220 eval ac_x_app_defaults="$ac_cv_x_app_defaults"])
222 AC_PATH_X_APP_DEFAULTS
224 APPDEFAULTS=$ac_x_app_defaults
227 # Like AC_CHECK_HEADER, but it uses the already-computed -I directories.
229 AC_DEFUN(AC_CHECK_X_HEADER, [
230 ac_save_CPPFLAGS="$CPPFLAGS"
231 if test \! -z "$includedir" ; then
232 CPPFLAGS="$CPPFLAGS -I$includedir"
234 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
235 AC_CHECK_HEADER([$1], [$2])
236 CPPFLAGS="$ac_save_CPPFLAGS"])
238 # Like AC_EGREP_HEADER, but it uses the already-computed -I directories.
240 AC_DEFUN(AC_EGREP_X_HEADER, [
241 ac_save_CPPFLAGS="$CPPFLAGS"
242 if test \! -z "$includedir" ; then
243 CPPFLAGS="$CPPFLAGS -I$includedir"
245 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
246 AC_EGREP_HEADER([$1], [$2], [$3], [$4])
247 CPPFLAGS="$ac_save_CPPFLAGS"])
249 # Like AC_TRY_COMPILE, but it uses the already-computed -I directories.
251 AC_DEFUN(AC_TRY_X_COMPILE, [
252 ac_save_CPPFLAGS="$CPPFLAGS"
253 if test \! -z "$includedir" ; then
254 CPPFLAGS="$CPPFLAGS -I$includedir"
256 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
257 AC_TRY_COMPILE([$1], [$2], [$3], [$4])
258 CPPFLAGS="$ac_save_CPPFLAGS"])
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.
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"
270 if test \! -z "$includedir" ; then
271 CPPFLAGS="$CPPFLAGS -I$includedir"
273 if test \! -z "$libdir" ; then
274 LDFLAGS="$LDFLAGS -L$libdir"
276 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
277 LDFLAGS="$LDFLAGS -L$x_libraries"
278 AC_CHECK_LIB([$1], [$2], [$3], [$4], [$5])
279 CPPFLAGS="$ac_save_CPPFLAGS"
280 LDFLAGS="$ac_save_LDFLAGS"])
285 # check for the HP XHPDisableReset server extension headers.
287 AC_EGREP_X_HEADER(XHPDisableReset, X11/XHPlib.h,
288 [AC_DEFINE(HAVE_XHPDISABLERESET)
289 SAVER_LIBS="-lXhp11 $SAVER_LIBS"])
292 # Check for the availability of the XPointer typedef, and define it otherwise.
294 AC_CACHE_CHECK([for XPointer], ac_cv_xpointer,
295 [AC_TRY_X_COMPILE([#include <X11/Xlib.h>],
296 [XPointer foo = (XPointer) 0;],
297 [ac_cv_xpointer=yes],
298 [ac_cv_xpointer=no])])
299 if test $ac_cv_xpointer != yes; then
300 AC_DEFINE(XPointer,[char*])
306 # Thanks for not making xmkmf find this by default, you losers.
307 if test -d /usr/lib/Motif1.2 ; then
308 X_CFLAGS="-I/usr/include/Motif1.2 $X_CFLAGS"
309 X_LIBS="-L/usr/lib/Motif1.2 $X_LIBS"
310 elif test -d /usr/lib/Motif1.1 ; then
311 X_CFLAGS="-I/usr/include/Motif1.1 $X_CFLAGS"
312 X_LIBS="-L/usr/lib/Motif1.1 $X_LIBS"
315 # This too. You losers.
316 if test -d /usr/contrib/X11R6/include ; then
317 X_CFLAGS="-I/usr/contrib/X11R6/include $X_CFLAGS"
318 X_LIBS="-L/usr/contrib/X11R6/lib $X_LIBS"
319 elif test -d /usr/contrib/X11R5/include ; then
320 X_CFLAGS="-I/usr/contrib/X11R5/include $X_CFLAGS"
321 X_LIBS="-L/usr/contrib/X11R5/lib $X_LIBS"
326 # Same to you, pinheads. (Is this really the standard location now?
327 # What happened to the joke that this kind of thing went in /opt?)
328 if test -f /usr/dt/include/Xm/Xm.h ; then
329 X_CFLAGS="$X_CFLAGS -I/usr/dt/include"
330 X_LIBS="$X_LIBS -L/usr/dt/lib -R:/usr/dt/lib"
332 # Some versions of Slowlaris Motif require -lgen. But not all. Why?
333 AC_CHECK_LIB(gen, regcmp, [X_LIBS="$X_LIBS -lgen"])
340 # Check for Xmu (some fucked up vendors don't ship it...)
343 AC_CHECK_X_HEADER(X11/Xmu/Error.h, [have_xmu=yes])
344 if test $have_xmu = no ; then
345 XMU_SRCS='$(UTILS_SRC)/xmu.c'
346 XMU_OBJS='$(UTILS_BIN)/xmu.o'
350 SAVER_LIBS="-lXmu $SAVER_LIBS"
351 HACK_LIBS="-lXmu $HACK_LIBS"
356 # See comp.windows.x FAQ question 124 about _get_wmShellWidgetClass on 4.1.x.
357 # The right fix is to get OpenWindows 3.0 patches 100512-02 and 100573-03.
359 if test $have_xmu = yes ; then
362 AC_CACHE_CHECK([for the SunOS 4.1.x _get_wmShellWidgetClass bug],
364 [ac_save_LDFLAGS="$LDFLAGS"
365 if test \! -z "$x_libraries" ; then
366 LDFLAGS="$LDFLAGS -L$x_libraries"
368 # Note: this trick never works! (Generally.)
369 # We're only getting away with using AC_TRY_LINK
370 # with X libraries because we know it's SunOS.
371 LDFLAGS="$LDFLAGS -lXmu -lXt -lX11 -lXext -lm"
373 [ac_cv_sunos_xmu_bug=no],
374 [ac_cv_sunos_xmu_bug=yes])
375 LDFLAGS="$ac_save_LDFLAGS"])
376 if test $ac_cv_sunos_xmu_bug = yes ; then
377 AC_CACHE_CHECK([whether the compiler understands -static],
379 [ac_save_LDFLAGS="$LDFLAGS"
380 LDFLAGS="$LDFLAGS -static"
381 AC_TRY_LINK(,,[ac_cv_ld_static=yes],[ac_cv_ld_static=no])
382 LDFLAGS="$ac_save_LDFLAGS"])
383 if test $ac_cv_ld_static = yes ; then
384 LDFLAGS="$LDFLAGS -static"
386 LDFLAGS="$LDFLAGS -Bstatic"
394 # Check for the SGI SCREEN_SAVER server extension header.
397 with_sgi_req=unspecified
398 AC_ARG_WITH(sgi-ext,[
401 --with-sgi-ext Include support for the SGI SCREEN_SAVER
402 server extension, if possible (this is the default).
403 --without-sgi-ext Do not compile in support for this extension.],
404 [with_sgi="$withval"; with_sgi_req="$withval"],[with_sgi=yes])
405 if test $with_sgi = yes; then
406 AC_CHECK_X_HEADER(X11/extensions/XScreenSaver.h,
408 AC_DEFINE(HAVE_SGI_SAVER_EXTENSION)])
410 elif test $with_sgi != no; then
411 echo "error: must be yes or no: --with-sgi-ext=$with_sgi"
415 # Check for the MIT-SCREEN-SAVER server extension header,
416 # unless the SGI extension has already been found.
419 with_mit_req=unspecified
421 [ --with-mit-ext Include support for the MIT-SCREEN-SAVER
422 server extension, if possible (this is the default).
423 --without-mit-ext Do not compile in support for this extension.],
424 [with_mit="$withval"; with_mit_req="$withval"],[with_mit=yes])
425 if test $have_sgi != yes; then
426 if test $with_mit = yes; then
427 AC_CHECK_X_HEADER(X11/extensions/scrnsaver.h, [have_mit=yes])
429 # Now check to see if it's really in the library; XF86Free-3.3 ships
430 # scrnsaver.h, but doesn't include the code in libXext.a, the idiots!
432 if test $have_mit = yes; then
433 AC_CHECK_X_LIB(Xext, XScreenSaverRegister, [], [have_mit=no], -lm)
435 if test $have_mit = no; then
436 # Fuck! Looks like XF86Free-3.3 actually puts it in XExExt instead
437 # of in Xext. Thank you master, may I have another.
438 AC_CHECK_X_LIB(XExExt, XScreenSaverRegister,
439 [have_mit=yes; SAVER_LIBS="$SAVER_LIBS -lXExExt"],
440 [], -lX11 -lXext -lm)
443 if test $have_mit = no; then
444 # Double fuck! Looks like some versions of XFree86 (whichever version
445 # it is that comes with RedHat Linux 2.0 -- I can't find a version
446 # number) put this garbage in Xss instead of Xext. Thank you master,
447 # may I have another.
448 AC_CHECK_X_LIB(Xss, XScreenSaverRegister,
449 [have_mit=yes; SAVER_LIBS="$SAVER_LIBS -lXss"],
450 [], -lX11 -lXext -lm)
453 if test $have_mit = yes; then
454 AC_DEFINE(HAVE_MIT_SAVER_EXTENSION)
459 elif test $with_mit != no; then
460 echo "error: must be yes or no: --with-mit-ext=$with_mit"
466 # Check for the XIDLE server extension header.
469 with_xidle_req=unspecified
470 AC_ARG_WITH(xidle-ext,
471 [ --with-xidle-ext Include support for the XIDLE server extension,
472 if possible (this is the default).
473 --without-xidle-ext Do not compile in support for this extension.],
474 [with_xidle="$withval"; with_xidle_req="$withval"],[with_xidle=yes])
475 if test $with_xidle = yes; then
476 AC_CHECK_X_HEADER(X11/extensions/xidle.h,
478 AC_DEFINE(HAVE_XIDLE_EXTENSION)])
479 elif test $with_xidle != no; then
480 echo "error: must be yes or no: --with-xidle-ext=$with_xidle"
485 # Check for the XSHM server extension header.
488 with_xshm_req=unspecified
489 AC_ARG_WITH(xshm-ext,
490 [ --with-xshm-ext Include support for the XSHM (Shared Memory) server
491 extension, if possible (this is the default).
492 --without-xshm-ext Do not compile in support for this extension.],
493 [with_xshm="$withval"; with_xshm_req="$withval"],[with_xshm=yes])
494 if test $with_xshm = yes; then
496 # first check for Xshm.h.
497 AC_CHECK_X_HEADER(X11/extensions/XShm.h, [have_xshm=yes])
499 # if that succeeded, then check for sys/ipc.h.
500 if test $have_xshm = yes; then
502 AC_CHECK_X_HEADER(sys/ipc.h, [have_xshm=yes])
505 # if that succeeded, then check for sys/shm.h.
506 if test $have_xshm = yes; then
508 AC_CHECK_X_HEADER(sys/shm.h, [have_xshm=yes])
511 # if that succeeded, then we've really got it.
512 if test $have_xshm = yes; then
513 AC_DEFINE(HAVE_XSHM_EXTENSION)
516 elif test $with_xshm != no; then
517 echo "error: must be yes or no: --with-xshm-ext=$with_xshm"
522 # Check for Motif and Athena --with and --without arguments.
526 with_motif_req=unspecified
527 with_athena_req=unspecified
532 --with-motif Use the Motif toolkit for the user interface,
533 if possible (this is the default).
534 --without-motif Do not use Motif.],
535 [with_motif="$withval"; with_motif_req="$withval"],[with_motif=no])
538 [ --with-athena Use the Athena toolkit for the user interface, if
539 possible (this is the default if Motif isn't used.)
540 --without-athena Do not use Athena.],
541 [with_athena="$withval"; with_athena_req="$withval"],[with_athena=no])
543 if test $with_motif != yes -a $with_motif != no ; then
544 echo "error: must be yes or no: --with-motif=$with_motif"
548 if test $with_athena != yes -a $with_athena != no ; then
549 echo "error: must be yes or no: --with-athena=$with_athena"
554 # Saying --without-motif is the same as saying --with-athena.
555 if test $with_motif_req = no ; then
560 # Saying --without-athena is the same as saying --with-motif.
561 if test $with_athena_req = no ; then
566 # Check for Motif and Athena headers.
569 AC_CHECK_X_HEADER(Xm/Xm.h,
571 AC_DEFINE(HAVE_MOTIF)
572 SAVER_LIBS="-lXm $SAVER_LIBS"])
576 AC_CHECK_X_HEADER(X11/Xaw/Dialog.h,
578 AC_DEFINE(HAVE_ATHENA)
579 SAVER_LIBS="-lXaw $SAVER_LIBS"])
583 # If they asked for both motif and athena, check motif then athena.
584 # If they asked for only motif, check motif then athena.
585 # If they asked for only athena, check athena then motif.
586 # If they asked for neither, check motif then athena.
588 if test $with_motif = yes; then
589 # asked for both, or for motif only
591 if test $have_motif = yes; then
598 elif test $with_athena = yes; then
599 # asked for athena only
601 if test $have_athena = yes; then
610 if test $have_motif = yes; then
619 # If we have Athena, check whether it's a version that includes
620 # XawViewportSetCoordinates in Viewport.h (R3 (or R4?) don't.)
621 if test $have_athena = yes ; then
622 AC_CACHE_CHECK([for XawViewportSetCoordinates in Viewport.h],
623 ac_cv_have_XawViewportSetCoordinates,
624 [ac_cv_have_XawViewportSetCoordinates=no
625 AC_EGREP_X_HEADER(XawViewportSetCoordinates,
627 ac_cv_have_XawViewportSetCoordinates=yes)])
628 if test $ac_cv_have_XawViewportSetCoordinates = yes ; then
629 AC_DEFINE(HAVE_XawViewportSetCoordinates)
634 # If we have Motif, check whether it's really LessTif.
637 if test $have_motif = yes ; then
638 AC_CACHE_CHECK([whether Motif is really LessTif],
640 [AC_TRY_X_COMPILE([#include <Xm/Xm.h>],
641 [long vers = LesstifVersion;],
642 [ac_cv_have_lesstif=yes],
643 [ac_cv_have_lesstif=no])])
644 have_lesstif=$ac_cv_have_lesstif
648 # check for XPM header.
651 with_xpm_req=unspecified
655 --with-xpm Include support for XPM files in some demos,
656 if possible (this is the default).
657 --without-xpm Do not compile in support for XPM files.],
658 [with_xpm="$withval"; with_xpm_req="$withval"],[with_xpm=yes])
659 if test $with_xpm = yes; then
660 AC_CHECK_X_HEADER(X11/xpm.h,
664 elif test $with_xpm != no; then
665 echo "error: must be yes or no: --with-xpm=$with_xpm"
670 # check for the GL header
673 with_gl_req=unspecified
675 [ --with-gl Build those demos which depend on OpenGL,
676 if possible (this is the default).
677 --without-gl Do not build the OpenGL demos.],
678 [with_gl="$withval"; with_gl_req="$withval"],[with_gl=yes])
680 if test $with_gl = yes; then
681 AC_CHECK_X_HEADER(GL/gl.h, have_gl=yes, have_gl=no)
682 if test $have_gl = yes ; then
683 AC_CHECK_X_HEADER(GL/glx.h, have_gl=yes, have_gl=no)
686 # If we have the headers, try and figure out which vendor it's from.
688 if test $have_gl = yes ; then
692 AC_EGREP_X_HEADER(Mesa, GL/glx.h, [have_mesa_gl=yes])
693 if test $have_mesa_gl = no ; then
696 AC_DEFINE(HAVE_MESA_GL)
697 GL_LIBS="-lMesaGL -lMesaGLU"
701 elif test $with_gl != no; then
702 echo "error: must be yes or no: --with-gl=$with_gl"
707 # check for SGI XReadDisplay server extension header.
710 with_readdisplay_req=unspecified
711 AC_ARG_WITH(readdisplay,
712 [ --with-readdisplay Include support for the XReadDisplay server
713 extension if possible (this is the default).
714 --without-readdisplay Do not compile in support for this extension.],
715 [with_readdisplay="$withval"; with_readdisplay_req="$withval"],
716 [with_readdisplay=yes])
717 if test $with_readdisplay = yes; then
718 AC_CHECK_X_HEADER(X11/extensions/readdisplay.h,
719 AC_DEFINE(HAVE_READ_DISPLAY_EXTENSION))
720 elif test $with_readdisplay != no; then
721 echo "error: must be yes or no: --with-readdisplay=$with_readdisplay"
727 # Try to find a program to generate random text.
729 # Zippy is funnier than the idiocy generally spat out by `fortune',
730 # so try to find that, by invoking Emacs and asking it where its
731 # libexec directory is ("yow" lives in there.)
733 # If that doesn't work, see if fortune, zippy, or yow are on $PATH,
734 # and if so, use them.
736 # If that doesn't work, look in /usr/games, and if it's there, use
741 [ --with-zippy=PROGRAM Some demos are able to run an external program and
742 display its text; this names the program to use by
743 default (though it can be overridden with X
744 resources.) If you don't specify this, the default
745 is to use \"yow\" from the Emacs distribution (if you
746 have it) or else to use \"fortune\".],
747 [with_zippy="$withval"])
749 if test "$with_zippy" = no || test "$with_zippy" = yes ; then
753 if test -n "$with_zippy" ; then
754 ac_cv_zippy_program="$with_zippy"
756 elif test -n "$ac_cv_zippy_program"; then
757 AC_MSG_RESULT([checking for zippy... (cached) $ac_cv_zippy_program])
761 AC_CHECK_PROGS(emacs_exe, emacs)
762 AC_CHECK_PROGS(xemacs_exe, xemacs)
764 ac_cv_zippy_program=""
765 eargs='-batch -q -nw --eval'
767 if test -n "$emacs_exe" ; then
768 AC_MSG_CHECKING([for emacs yow])
770 # get emacs to tell us where the libexec directory is.
772 dir=`$emacs_exe $eargs '(princ (concat exec-directory "\n"))' \
773 2>/dev/null | tail -1`
774 dir=`echo "$dir" | sed 's@///*@/@g;s@/$@@'`
776 # try running libexec/yow and see if it exits without error.
778 if test x"$dir" != x -a -x $dir/yow ; then
779 if $dir/yow >&- 2>&- ; then
780 ac_cv_zippy_program="$dir/yow"
781 AC_MSG_RESULT($ac_cv_zippy_program)
788 if test -z "$ac_cv_zippy_program" ; then
789 AC_MSG_CHECKING([for xemacs yow])
790 if test -n "$xemacs_exe" ; then
792 # get xemacs to tell us where the libexec directory is.
794 dir=`$xemacs_exe $eargs '(princ (concat exec-directory "\n"))' \
795 2>/dev/null | tail -1`
796 dir=`echo "$dir" | sed 's@///*@/@g;s@/$@@'`
798 # try running libexec/yow and see if it exits without error.
800 if test x"$dir" != x -a -x $dir/yow ; then
801 if $dir/yow >&- 2>&- ; then
802 ac_cv_zippy_program="$dir/yow"
803 AC_MSG_RESULT($ac_cv_zippy_program)
806 # in some xemacs installations, the pathname of the yow.lines file
807 # isn't hardcoded into the yow executable, and must be passed on
808 # the command line. See if it's in libexec/../etc/.
812 dir_up=`echo "$dir" | sed 's@/[^/]*$@@'`
815 yow="yow -f $dir_up/etc/yow.lines"
816 if $dir/$yow >&- 2>&- ; then
817 ac_cv_zippy_program="$dir/$yow"
818 AC_MSG_RESULT($ac_cv_zippy_program)
827 # if that didn't work, try for some other programs...
828 if test -z "$ac_cv_zippy_program" ; then
830 AC_CHECK_PROGS(fortune, [fortune zippy yow])
831 # if that didn't work, try for those programs in /usr/games...
832 if test -z "$fortune" ; then
833 AC_PATH_PROGS(fortune, [fortune zippy yow], fortune,
834 /usr/games:/usr/local/games)
839 if test -z "$ac_cv_zippy_program" ; then
840 ac_cv_zippy_program=fortune
843 AC_DEFINE_UNQUOTED(ZIPPY_PROGRAM, "$ac_cv_zippy_program")
848 # Allow locking to be disabled at compile-time.
852 with_kerberos_req=unspecified
854 with_shadow_req=unspecified
857 AC_ARG_ENABLE(locking,[
860 --enable-locking Compile in support for locking the display
861 (this is the default.)
862 --disable-locking Do not allow locking at all.],
863 [enable_locking="$enableval"],[enable_locking=yes])
864 if test $enable_locking = yes; then
866 # Check for Kerberos.
868 AC_ARG_WITH(kerberos, [
869 --with-kerberos Include support for Kerberos authentication,
870 if possible (this is the default.)
871 --without-kerberos Do not compile in support for Kerberos.],
872 [with_kerberos="$withval"; with_kerberos_req="$withval"],[with_kerberos=yes])
873 if test $with_kerberos = yes; then
874 AC_CACHE_CHECK([for Kerberos], ac_cv_kerberos,
875 [AC_TRY_X_COMPILE([#include <krb.h>],,
876 [ac_cv_kerberos=yes],
877 [ac_cv_kerberos=no])])
878 if test $ac_cv_kerberos = yes ; then
880 AC_DEFINE(HAVE_KERBEROS)
881 PASSWD_LIBS="$PASSWD_LIBS -lkrb -ldes -lnsl -lsocket"
883 elif test $with_kerberos != no; then
884 echo "error: must be yes or no: --with-kerberos=$with_kerberos"
888 # Next, check for the nine billion variants of shadow passwords...
892 [ --with-shadow Include support for shadow password authentication,
893 if possible (this is the default, if no Kerberos.)
894 --without-shadow Do not compile in support for shadow passwords.
896 [with_shadow="$withval"; with_shadow_req="$withval"],[with_shadow=yes])
897 if test $with_shadow = no; then
898 passwd_cruft_done=yes
899 elif test $with_shadow != yes; then
900 echo "error: must be yes or no: --with-shadow=$with_shadow"
905 # Sun's "adjunct" passwords.
907 if test $passwd_cruft_done = no ; then
908 AC_CACHE_CHECK([for Sun-style shadow passwords], ac_cv_sun_adjunct,
909 [AC_TRY_X_COMPILE([#include <stdlib.h>
911 #include <sys/types.h>
912 #include <sys/label.h>
913 #include <sys/audit.h>
914 #include <pwdadj.h>],
915 [struct passwd_adjunct *p = getpwanam("nobody");
916 const char *pw = p->pwa_passwd;],
917 [ac_cv_sun_adjunct=yes],
918 [ac_cv_sun_adjunct=no])])
919 if test $ac_cv_sun_adjunct = yes; then
922 passwd_cruft_done=yes
923 AC_DEFINE(HAVE_ADJUNCT_PASSWD)
927 # DEC and SCO so-called "enhanced" security.
929 if test $passwd_cruft_done = no ; then
930 AC_CACHE_CHECK([for DEC-style shadow passwords], ac_cv_enhanced_passwd,
931 [AC_TRY_X_COMPILE([#include <stdlib.h>
933 #include <sys/types.h>
935 #include <sys/security.h>
937 [struct pr_passwd *p;
939 set_auth_parameters(0, 0);
940 check_auth_parameters();
941 p = getprpwnam("nobody");
942 pw = p->ufld.fd_encrypt;],
943 [ac_cv_enhanced_passwd=yes],
944 [ac_cv_enhanced_passwd=no])])
945 if test $ac_cv_enhanced_passwd = yes; then
948 passwd_cruft_done=yes
949 AC_DEFINE(HAVE_ENHANCED_PASSWD)
951 # On SCO, getprpwnam() is in -lprot (which uses nap() from -lx)
952 # (I'm told it needs -lcurses too, but I don't understand why.)
953 AC_CHECK_LIB(prot, getprpwnam,
954 [PASSWD_LIBS="$PASSWD_LIBS -lprot -lcurses -lx"],
955 [# On DEC, getprpwnam() is in -lsecurity
956 AC_CHECK_LIB(security, getprpwnam,
957 [PASSWD_LIBS="$PASSWD_LIBS -lsecurity"])],
962 # HP's entry in the "Not Invented Here" Sweepstakes.
964 if test $passwd_cruft_done = no ; then
965 AC_CACHE_CHECK([for HP-style shadow passwords], ac_cv_hpux_passwd,
966 [AC_TRY_X_COMPILE([#include <stdlib.h>
968 #include <sys/types.h>
970 #include <hpsecurity.h>
972 [struct s_passwd *p = getspwnam("nobody");
973 const char *pw = p->pw_passwd;],
974 [ac_cv_hpux_passwd=yes],
975 [ac_cv_hpux_passwd=no])])
976 if test $ac_cv_hpux_passwd = yes; then
979 passwd_cruft_done=yes
980 AC_DEFINE(HAVE_HPUX_PASSWD)
982 # on HPUX, bigcrypt is in -lsec
983 AC_CHECK_LIB(sec, bigcrypt, [PASSWD_LIBS="$PASSWD_LIBS -lsec"])
987 # Traditional (ha!) shadow passwords.
989 if test $passwd_cruft_done = no ; then
990 AC_CACHE_CHECK([for generic shadow passwords], ac_cv_shadow,
991 [AC_TRY_X_COMPILE([#include <stdlib.h>
993 #include <sys/types.h>
995 #include <shadow.h>],
996 [struct spwd *p = getspnam("nobody");
997 const char *pw = p->sp_pwdp;],
1000 if test $ac_cv_shadow = yes; then
1003 passwd_cruft_done=yes
1004 AC_DEFINE(HAVE_SHADOW_PASSWD)
1006 # On some systems (UnixWare 2.1), getspnam() is in -lgen instead of -lc.
1008 AC_CHECK_LIB(c, getspnam, [have_getspnam=yes])
1009 if test $have_getspnam = no ; then
1010 AC_CHECK_LIB(gen, getspnam,
1011 [have_getspnam=yes; PASSWD_LIBS="$PASSWD_LIBS -lgen"])
1016 # On some systems (UnixWare 2.1), crypt() is in -lcrypt instead of -lc.
1018 AC_CHECK_LIB(c, crypt, [have_crypt=yes])
1019 if test $have_crypt = no ; then
1020 AC_CHECK_LIB(crypt, crypt,
1021 [have_crypt=yes; PASSWD_LIBS="$PASSWD_LIBS -lcrypt"])
1025 # Most of the above shadow mechanisms will have set need_setuid to yes,
1026 # if they were found. But, on some systems, we need setuid even when
1027 # using plain old vanilla passwords.
1029 if test $need_setuid = no ; then
1031 *-hpux* | *-aix* | *-netbsd* | *-freebsd* | *-openbsd* )
1037 elif test $enable_locking = no; then
1038 AC_DEFINE(NO_LOCKING)
1040 echo "error: must be yes or no: --enable-locking=$enable_locking"
1046 if test \! -z "$includedir" ; then
1047 INCLUDES="-I$includedir"
1050 if test \! -z "$libdir" ; then
1051 LDFLAGS="$LDFLAGS -L$libdir"
1055 ##### should have options to override the DEPEND crap, I guess...
1062 # Done testing things -- now substitute in some stuff for the Makefiles.
1064 if test $have_motif = yes; then
1065 AC_DEFINE(HAVE_MOTIF)
1066 DIALOG_SRCS='$(MOTIF_SRCS)'
1067 DIALOG_OBJS='$(MOTIF_OBJS)'
1068 elif test $have_athena = yes; then
1069 AC_DEFINE(HAVE_ATHENA)
1070 DIALOG_SRCS='$(ATHENA_SRCS)'
1071 DIALOG_OBJS='$(ATHENA_OBJS)'
1077 if test $have_kerberos = yes; then
1078 PASSWD_SRCS='$(KERBEROS_SRCS)'
1079 PASSWD_OBJS='$(KERBEROS_OBJS)'
1081 PASSWD_SRCS='$(PWENT_SRCS)'
1082 PASSWD_OBJS='$(PWENT_OBJS)'
1085 if test $enable_locking = yes; then
1086 LOCK_SRCS='$(LOCK_SRCS_1) $(PASSWD_SRCS)'
1087 LOCK_OBJS='$(LOCK_OBJS_1) $(PASSWD_OBJS)'
1093 if test $need_setuid = yes; then
1095 INSTALL_SETUID='$(INSTALL) $(SUID_FLAGS)'
1098 INSTALL_SETUID='$(INSTALL_PROGRAM)'
1102 if test $have_gl = yes; then
1103 GL_EXES='$(GL_EXES)'
1104 GL_KLUDGE_1=${tab}${tab}${tab}${tab}${tab}${tab}${tab}${tab}${tab}' \'
1107 GL_KLUDGE_1=${tab}${tab}${tab}${tab}${tab}${tab}${tab}${tab}${tab}'\n'
1108 GL_KLUDGE_2='!'${tab}
1113 AC_SUBST(SAVER_LIBS)
1117 AC_SUBST(PASSWD_LIBS)
1118 AC_SUBST(INSTALL_SETUID)
1119 AC_SUBST(NEED_SETUID)
1121 AC_SUBST(DIALOG_SRCS)
1122 AC_SUBST(DIALOG_OBJS)
1123 AC_SUBST(PASSWD_SRCS)
1124 AC_SUBST(PASSWD_OBJS)
1130 AC_SUBST(GL_KLUDGE_1)
1131 AC_SUBST(GL_KLUDGE_2)
1133 AC_SUBST(APPDEFAULTS)
1136 AC_SUBST(DEPEND_FLAGS)
1137 AC_SUBST(DEPEND_DEFINES)
1139 # Print some warnings before emitting the Makefiles.
1142 warnsep=' #################################################################'
1144 if test $warning = no ; then
1145 echo '' ; echo "$warnsep" ; echo ''
1155 if test $with_sgi_req = yes -a $have_sgi = no ; then
1156 warn 'The SGI saver extension was requested, but was not found.'
1159 if test $with_mit_req = yes -a $have_mit = no ; then
1160 warn 'The MIT saver extension was requested, but was not found.'
1163 if test $with_xidle_req = yes -a $have_xidle = no ; then
1164 warn 'The XIdle extension was requested, but was not found.'
1167 if test $with_xshm_req = yes -a $have_xshm = no ; then
1168 warn 'The XSHM extension was requested, but was not found.'
1171 if test $have_motif = no -a $have_athena = no ; then
1172 warn "Neither Motif nor Athena widgets seem to be available;"
1173 warn2 "one or the other is required."
1175 elif test $with_motif_req = yes -a $have_motif = no ; then
1176 warn "Use of Motif was requested, but it wasn't found;"
1177 warn2 "Athena will be used instead."
1179 elif test $with_athena_req = yes -a $have_athena = no ; then
1180 warn "Use of Athena was requested, but it wasn't found;"
1181 warn2 "Motif will be used instead."
1184 if test $have_motif = yes -a $have_lesstif = yes ; then
1185 warn "Motif is being used, but it appears to actually be LessTif."
1186 warn2 "XScreenSaver has been reported to have problems with some"
1187 warn2 "versions of LessTif (notably 0.79). You might want to use"
1188 warn2 "Athena instead."
1191 if test $with_xpm_req = yes -a $have_xpm = no ; then
1192 warn 'Use of XPM was requested, but it was not found.'
1195 if test $with_gl_req = yes -a $have_gl = no ; then
1196 warn 'Use of GL was requested, but it was not found.'
1199 if test $with_readdisplay_req = yes -a $have_readdisplay = no ; then
1200 warn 'Use of XReadDisplay was requested, but it was not found.'
1203 if test $with_kerberos_req = yes -a $have_kerberos = no ; then
1204 warn 'Use of Kerberos was requested, but it was not found.'
1207 if test $with_shadow_req = yes -a $have_shadow = no ; then
1208 warn 'Use of shadow passwords was requested, but they were not found.'
1211 if test $warning = yes; then
1212 echo '' ; echo "$warnsep" ; echo ''
1221 driver/XScreenSaver.ad)