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"
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)
88 AC_MSG_RESULT(unknown)
92 AC_CHECK_FUNCS(select fcntl uname nice setpriority getcwd getwd putenv)
93 AC_CHECK_FUNCS(sigaction)
95 AC_CHECK_HEADERS(unistd.h)
97 dnl /usr/local/src/ssh-1.2.17/putenv.c -- AC_REPLACE_FUNCS(putenv)
100 AC_ARG_ENABLE(subdir,[
101 Installation options:
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.
114 --disable-subdir Just put the demos in \`bindir' (this is the default.)
116 [enable_subdir="$enableval"],[enable_subdir=no])
117 if test x"$enable_subdir" = xno; then
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"
123 HACKDIR='$(bindir)/'$enable_subdir
129 # Try and find the app-defaults directory.
130 # It sucks that autoconf doesn't do this already...
132 AC_DEFUN(AC_PATH_X_APP_DEFAULTS_XMKMF,
135 if mkdir conftestdir; then
137 # Make sure to not put "make" in the Imakefile rules, since we grep it out.
138 cat > Imakefile <<'EOF'
140 @echo 'ac_x_app_defaults="${XAPPLOADDIR}"'
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`
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.
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 \
162 /usr/lib/X11/app-defaults \
163 /usr/lib/X11R6/app-defaults \
164 /usr/lib/X11R5/app-defaults \
165 /usr/lib/X11R4/app-defaults \
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 \
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 \
180 /usr/X386/lib/X11/app-defaults \
181 /usr/x386/lib/X11/app-defaults \
182 /usr/XFree86/lib/X11/app-defaults \
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 \
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 \
197 /X11R6/lib/app-defaults \
198 /X11R5/lib/app-defaults \
199 /X11R4/lib/app-defaults \
202 if test -d "$ac_dir"; then
203 ac_x_app_defaults=$ac_dir
210 AC_DEFUN(AC_PATH_X_APP_DEFAULTS,
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"
218 # Record where we found app-defaults for the cache.
219 ac_cv_x_app_defaults="$ac_x_app_defaults"
221 eval ac_x_app_defaults="$ac_cv_x_app_defaults"])
223 AC_PATH_X_APP_DEFAULTS
225 APPDEFAULTS=$ac_x_app_defaults
228 # Like AC_CHECK_HEADER, but it uses the already-computed -I directories.
230 AC_DEFUN(AC_CHECK_X_HEADER, [
231 ac_save_CPPFLAGS="$CPPFLAGS"
232 if test \! -z "$includedir" ; then
233 CPPFLAGS="$CPPFLAGS -I$includedir"
235 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
236 AC_CHECK_HEADER([$1], [$2])
237 CPPFLAGS="$ac_save_CPPFLAGS"])
239 # Like AC_EGREP_HEADER, but it uses the already-computed -I directories.
241 AC_DEFUN(AC_EGREP_X_HEADER, [
242 ac_save_CPPFLAGS="$CPPFLAGS"
243 if test \! -z "$includedir" ; then
244 CPPFLAGS="$CPPFLAGS -I$includedir"
246 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
247 AC_EGREP_HEADER([$1], [$2], [$3], [$4])
248 CPPFLAGS="$ac_save_CPPFLAGS"])
250 # Like AC_TRY_COMPILE, but it uses the already-computed -I directories.
252 AC_DEFUN(AC_TRY_X_COMPILE, [
253 ac_save_CPPFLAGS="$CPPFLAGS"
254 if test \! -z "$includedir" ; then
255 CPPFLAGS="$CPPFLAGS -I$includedir"
257 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
258 AC_TRY_COMPILE([$1], [$2], [$3], [$4])
259 CPPFLAGS="$ac_save_CPPFLAGS"])
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.
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"
271 if test \! -z "$includedir" ; then
272 CPPFLAGS="$CPPFLAGS -I$includedir"
274 if test \! -z "$libdir" ; then
275 LDFLAGS="$LDFLAGS -L$libdir"
277 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
278 if test \! -z "$x_libraries" ; then
279 LDFLAGS="$LDFLAGS -L$x_libraries"
281 AC_CHECK_LIB([$1], [$2], [$3], [$4], [$5])
282 CPPFLAGS="$ac_save_CPPFLAGS"
283 LDFLAGS="$ac_save_LDFLAGS"])
285 # Like AC_TRY_RUN, but it uses the already-computed -I directories.
286 # (But not the -L directories!)
288 AC_DEFUN(AC_TRY_X_RUN, [
289 ac_save_CPPFLAGS="$CPPFLAGS"
290 if test \! -z "$includedir" ; then
291 CPPFLAGS="$CPPFLAGS -I$includedir"
293 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
294 AC_TRY_RUN([$1], [$2], [$3], [$4])
295 CPPFLAGS="$ac_save_CPPFLAGS"])
301 # check for the HP XHPDisableReset server extension headers.
303 AC_EGREP_X_HEADER(XHPDisableReset, X11/XHPlib.h,
304 [AC_DEFINE(HAVE_XHPDISABLERESET)
305 SAVER_LIBS="-lXhp11 $SAVER_LIBS"])
308 # Check for the availability of the XPointer typedef, and define it otherwise.
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*])
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"
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"
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"
355 # Some versions of Slowlaris Motif require -lgen. But not all. Why?
356 AC_CHECK_LIB(gen, regcmp, [X_LIBS="$X_LIBS -lgen"])
363 # Check for Xmu (some fucked up vendors don't ship it...)
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'
373 SAVER_LIBS="-lXmu $SAVER_LIBS"
374 HACK_LIBS="-lXmu $HACK_LIBS"
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.
382 if test $have_xmu = yes ; then
385 AC_CACHE_CHECK([for the SunOS 4.1.x _get_wmShellWidgetClass bug],
387 [ac_save_LDFLAGS="$LDFLAGS"
388 if test \! -z "$x_libraries" ; then
389 LDFLAGS="$LDFLAGS -L$x_libraries"
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"
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],
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"
409 LDFLAGS="$LDFLAGS -Bstatic"
417 # Check for the SGI SCREEN_SAVER server extension header.
420 with_sgi_req=unspecified
421 AC_ARG_WITH(sgi-ext,[
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,
431 AC_DEFINE(HAVE_SGI_SAVER_EXTENSION)])
433 elif test $with_sgi != no; then
434 echo "error: must be yes or no: --with-sgi-ext=$with_sgi"
438 # Check for the MIT-SCREEN-SAVER server extension header,
439 # unless the SGI extension has already been found.
442 with_mit_req=unspecified
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])
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!
455 if test $have_mit = yes; then
456 AC_CHECK_X_LIB(Xext, XScreenSaverRegister, [], [have_mit=no], -lm)
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)
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)
476 if test $have_mit = yes; then
477 AC_DEFINE(HAVE_MIT_SAVER_EXTENSION)
482 elif test $with_mit != no; then
483 echo "error: must be yes or no: --with-mit-ext=$with_mit"
489 # Check for the XIDLE server extension header.
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,
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"
508 # Check for the XSHM server extension header.
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
519 # first check for Xshm.h.
520 AC_CHECK_X_HEADER(X11/extensions/XShm.h, [have_xshm=yes])
522 # if that succeeded, then check for sys/ipc.h.
523 if test $have_xshm = yes; then
525 AC_CHECK_X_HEADER(sys/ipc.h, [have_xshm=yes])
528 # if that succeeded, then check for sys/shm.h.
529 if test $have_xshm = yes; then
531 AC_CHECK_X_HEADER(sys/shm.h, [have_xshm=yes])
534 # if that succeeded, then we've really got it.
535 if test $have_xshm = yes; then
536 AC_DEFINE(HAVE_XSHM_EXTENSION)
539 elif test $with_xshm != no; then
540 echo "error: must be yes or no: --with-xshm-ext=$with_xshm"
545 # Check for the SGI-VIDEO-CONTROL server extension header.
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
556 # first check for XSGIvc.h
557 AC_CHECK_X_HEADER(X11/extensions/XSGIvc.h, [have_sgivc=yes])
559 # if that succeeded, then check for the -lXsgivc
560 if test $have_sgivc = yes; then
562 AC_CHECK_X_LIB(Xsgivc, XSGIvcQueryGammaMap,
563 [have_sgivc=yes; SAVER_LIBS="$SAVER_LIBS -lXsgivc"], [],
567 # if that succeeded, then we've really got it.
568 if test $have_sgivc = yes; then
569 AC_DEFINE(HAVE_SGI_VC_EXTENSION)
572 elif test $with_sgivc != no; then
573 echo "error: must be yes or no: --with-sgivc-ext=$with_sgivc"
584 # Check for Motif and Athena --with and --without arguments.
588 with_motif_req=unspecified
589 with_athena_req=unspecified
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])
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])
605 if test $with_motif != yes -a $with_motif != no ; then
606 echo "error: must be yes or no: --with-motif=$with_motif"
610 if test $with_athena != yes -a $with_athena != no ; then
611 echo "error: must be yes or no: --with-athena=$with_athena"
616 # Saying --without-motif is the same as saying --with-athena.
617 if test $with_motif_req = no ; then
622 # Saying --without-athena is the same as saying --with-motif.
623 if test $with_athena_req = no ; then
628 # Check for Motif and Athena headers.
631 AC_CHECK_X_HEADER(Xm/Xm.h,
633 AC_DEFINE(HAVE_MOTIF)
634 SAVER_LIBS="-lXm $SAVER_LIBS"])
638 AC_CHECK_X_HEADER(X11/Xaw/Dialog.h,
640 AC_DEFINE(HAVE_ATHENA)
641 SAVER_LIBS="-lXaw $SAVER_LIBS"])
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.
650 proselytize_motif=yes
651 if test $with_motif = yes; then
652 # asked for both, or for motif only
654 if test $have_motif = yes; then
661 elif test $with_athena = yes; then
662 # asked for athena only
664 if test $have_athena = yes; then
674 if test $have_motif = yes; then
682 if test $have_motif = yes; then
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,
694 ac_cv_have_XawViewportSetCoordinates=yes)])
695 if test $ac_cv_have_XawViewportSetCoordinates = yes ; then
696 AC_DEFINE(HAVE_XawViewportSetCoordinates)
701 # If we have Motif, check whether it's really LessTif.
704 if test $have_motif = yes ; then
705 AC_CACHE_CHECK([whether Motif is really 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
715 unset ac_cv_good_lesstif
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],
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
733 # check for XPM header.
736 with_xpm_req=unspecified
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,
749 elif test $with_xpm != no; then
750 echo "error: must be yes or no: --with-xpm=$with_xpm"
755 # check for the GL header
758 with_gl_req=unspecified
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])
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)
771 # If we have the headers, try and figure out which vendor it's from.
773 if test $have_gl = yes ; then
777 AC_EGREP_X_HEADER(Mesa, GL/glx.h, [have_mesa_gl=yes])
778 if test $have_mesa_gl = no ; then
781 AC_DEFINE(HAVE_MESA_GL)
782 GL_LIBS="-lMesaGL -lMesaGLU"
786 elif test $with_gl != no; then
787 echo "error: must be yes or no: --with-gl=$with_gl"
792 # check for SGI XReadDisplay server extension header.
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"
811 # check for SGI's Iris Video Library header.
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"],
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
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)
832 elif test $with_sgivideo != no; then
833 echo "error: must be yes or no: --with-sgivideo=$with_sgivideo"
839 # Try to find a program to generate random text.
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.)
845 # If that doesn't work, see if fortune, zippy, or yow are on $PATH,
846 # and if so, use them.
848 # If that doesn't work, look in /usr/games, and if it's there, use
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" ])
862 if test "$with_zippy" = no || test "$with_zippy" = yes ; then
867 if test -n "$with_zippy_req" ; then
868 ac_cv_zippy_program=""
869 case "$with_zippy_req" in
871 AC_MSG_CHECKING([for $with_zippy_req])
872 if test -x "$with_zippy_req" ; then
881 unset ac_cv_path_zip2
882 AC_PATH_PROG(zip2, $with_zippy_req, [])
883 if test "$zip2" = ""; then
888 ac_cv_zippy_program="$with_zippy"
890 elif test -n "$ac_cv_zippy_program"; then
891 AC_MSG_RESULT([checking for zippy... (cached) $ac_cv_zippy_program])
894 if test ! -n "$ac_cv_zippy_program"; then
896 AC_CHECK_PROGS(emacs_exe, emacs)
897 AC_CHECK_PROGS(xemacs_exe, xemacs)
899 ac_cv_zippy_program=""
900 eargs='-batch -q -nw --eval'
902 if test -n "$emacs_exe" ; then
903 AC_MSG_CHECKING([for emacs yow])
905 # get emacs to tell us where the libexec directory is.
907 dir=`$emacs_exe $eargs '(princ (concat exec-directory "\n"))' \
908 2>/dev/null | tail -1`
909 dir=`echo "$dir" | sed 's@///*@/@g;s@/$@@'`
911 # try running libexec/yow and see if it exits without error.
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)
923 if test -z "$ac_cv_zippy_program" ; then
924 AC_MSG_CHECKING([for xemacs yow])
925 if test -n "$xemacs_exe" ; then
927 # get xemacs to tell us where the libexec directory is.
929 dir=`$xemacs_exe $eargs '(princ (concat exec-directory "\n"))' \
930 2>/dev/null | tail -1`
931 dir=`echo "$dir" | sed 's@///*@/@g;s@/$@@'`
933 # try running libexec/yow and see if it exits without error.
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)
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/.
947 dir_up=`echo "$dir" | sed 's@/[^/]*$@@'`
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)
962 # if that didn't work, try for some other programs...
963 if test -z "$ac_cv_zippy_program" ; then
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)
974 if test -z "$ac_cv_zippy_program" ; then
975 ac_cv_zippy_program=fortune
978 AC_DEFINE_UNQUOTED(ZIPPY_PROGRAM, "$ac_cv_zippy_program")
983 # Allow locking to be disabled at compile-time.
987 with_kerberos_req=unspecified
989 with_shadow_req=unspecified
992 AC_ARG_ENABLE(locking,[
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
1001 # Check for Kerberos.
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
1015 AC_DEFINE(HAVE_KERBEROS)
1016 PASSWD_LIBS="$PASSWD_LIBS -lkrb -ldes -lnsl -lsocket"
1018 elif test $with_kerberos != no; then
1019 echo "error: must be yes or no: --with-kerberos=$with_kerberos"
1023 # Next, check for the nine billion variants of shadow passwords...
1025 passwd_cruft_done=no
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.
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"
1040 # Sun's "adjunct" passwords.
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>
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
1057 passwd_cruft_done=yes
1058 AC_DEFINE(HAVE_ADJUNCT_PASSWD)
1062 # DEC and SCO so-called "enhanced" security.
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>
1068 #include <sys/types.h>
1070 #include <sys/security.h>
1072 [struct pr_passwd *p;
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
1083 passwd_cruft_done=yes
1084 AC_DEFINE(HAVE_ENHANCED_PASSWD)
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"])],
1097 # HP's entry in the "Not Invented Here" Sweepstakes.
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>
1103 #include <sys/types.h>
1105 #include <hpsecurity.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
1114 passwd_cruft_done=yes
1115 AC_DEFINE(HAVE_HPUX_PASSWD)
1117 # on HPUX, bigcrypt is in -lsec
1118 AC_CHECK_LIB(sec, bigcrypt, [PASSWD_LIBS="$PASSWD_LIBS -lsec"])
1122 # Traditional (ha!) shadow passwords.
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>
1128 #include <sys/types.h>
1130 #include <shadow.h>],
1131 [struct spwd *p = getspnam("nobody");
1132 const char *pw = p->sp_pwdp;],
1134 [ac_cv_shadow=no])])
1135 if test $ac_cv_shadow = yes; then
1138 passwd_cruft_done=yes
1139 AC_DEFINE(HAVE_SHADOW_PASSWD)
1141 # On some systems (UnixWare 2.1), getspnam() is in -lgen instead of -lc.
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"])
1151 # On some systems (UnixWare 2.1), crypt() is in -lcrypt instead of -lc.
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"])
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.
1164 if test $need_setuid = no ; then
1166 *-hpux* | *-aix* | *-netbsd* | *-freebsd* | *-openbsd* )
1172 elif test $enable_locking = no; then
1173 AC_DEFINE(NO_LOCKING)
1175 echo "error: must be yes or no: --enable-locking=$enable_locking"
1181 if test \! -z "$includedir" ; then
1182 INCLUDES="-I$includedir"
1185 if test \! -z "$libdir" ; then
1186 LDFLAGS="$LDFLAGS -L$libdir"
1190 ##### should have options to override the DEPEND crap, I guess...
1197 # Done testing things -- now substitute in some stuff for the Makefiles.
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)'
1212 if test $have_kerberos = yes; then
1213 PASSWD_SRCS='$(KERBEROS_SRCS)'
1214 PASSWD_OBJS='$(KERBEROS_OBJS)'
1216 PASSWD_SRCS='$(PWENT_SRCS)'
1217 PASSWD_OBJS='$(PWENT_OBJS)'
1220 if test $enable_locking = yes; then
1221 LOCK_SRCS='$(LOCK_SRCS_1) $(PASSWD_SRCS)'
1222 LOCK_OBJS='$(LOCK_OBJS_1) $(PASSWD_OBJS)'
1228 if test $need_setuid = yes; then
1230 INSTALL_SETUID='$(INSTALL) $(SUID_FLAGS)'
1233 INSTALL_SETUID='$(INSTALL_PROGRAM)'
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}' \'
1242 GL_KLUDGE_1=${tab}${tab}${tab}${tab}${tab}${tab}${tab}${tab}${tab}'\n'
1243 GL_KLUDGE_2='!'${tab}
1248 AC_SUBST(SAVER_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)
1258 AC_SUBST(DIALOG_SRCS)
1259 AC_SUBST(DIALOG_OBJS)
1260 AC_SUBST(PASSWD_SRCS)
1261 AC_SUBST(PASSWD_OBJS)
1267 AC_SUBST(GL_KLUDGE_1)
1268 AC_SUBST(GL_KLUDGE_2)
1270 AC_SUBST(APPDEFAULTS)
1273 AC_SUBST(DEPEND_FLAGS)
1274 AC_SUBST(DEPEND_DEFINES)
1276 # Print some warnings before emitting the Makefiles.
1279 warnsep=' #################################################################'
1281 if test $warning = no ; then
1282 echo '' ; echo "$warnsep" ; echo ''
1289 if test $warning = long ; then echo '' ; fi
1298 if test $was != no ; then echo '' ; fi
1307 if test $with_sgi_req = yes -a $have_sgi = no ; then
1308 warn 'The SGI saver extension was requested, but was not found.'
1311 if test $with_mit_req = yes -a $have_mit = no ; then
1312 warn 'The MIT saver extension was requested, but was not found.'
1315 if test $with_xidle_req = yes -a $have_xidle = no ; then
1316 warn 'The XIdle extension was requested, but was not found.'
1319 if test $with_xshm_req = yes -a $have_xshm = no ; then
1320 warn 'The XSHM extension was requested, but was not found.'
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.'
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
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."
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."
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/>."
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/>."
1360 if test $with_xpm_req = yes -a $have_xpm = no ; then
1361 warn 'Use of XPM was requested, but it was not found.'
1364 if test $with_gl_req = yes -a $have_gl = no ; then
1365 warn 'Use of GL was requested, but it was not found.'
1368 if test $with_readdisplay_req = yes -a $have_readdisplay = no ; then
1369 warn 'Use of XReadDisplay was requested, but it was not found.'
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.'
1376 if test $with_kerberos_req = yes -a $have_kerberos = no ; then
1377 warn 'Use of Kerberos was requested, but it was not found.'
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.'
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."
1391 if test $warning != no; then
1392 echo '' ; echo "$warnsep" ; echo ''
1401 driver/XScreenSaver.ad)