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 if test \! -z "$x_libraries" ; then
278 LDFLAGS="$LDFLAGS -L$x_libraries"
280 AC_CHECK_LIB([$1], [$2], [$3], [$4], [$5])
281 CPPFLAGS="$ac_save_CPPFLAGS"
282 LDFLAGS="$ac_save_LDFLAGS"])
284 # Like AC_TRY_RUN, but it uses the already-computed -I directories.
285 # (But not the -L directories!)
287 AC_DEFUN(AC_TRY_X_RUN, [
288 ac_save_CPPFLAGS="$CPPFLAGS"
289 if test \! -z "$includedir" ; then
290 CPPFLAGS="$CPPFLAGS -I$includedir"
292 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
293 AC_TRY_RUN([$1], [$2], [$3], [$4])
294 CPPFLAGS="$ac_save_CPPFLAGS"])
300 # check for the HP XHPDisableReset server extension headers.
302 AC_EGREP_X_HEADER(XHPDisableReset, X11/XHPlib.h,
303 [AC_DEFINE(HAVE_XHPDISABLERESET)
304 SAVER_LIBS="-lXhp11 $SAVER_LIBS"])
307 # Check for the availability of the XPointer typedef, and define it otherwise.
309 AC_CACHE_CHECK([for XPointer], ac_cv_xpointer,
310 [AC_TRY_X_COMPILE([#include <X11/Xlib.h>],
311 [XPointer foo = (XPointer) 0;],
312 [ac_cv_xpointer=yes],
313 [ac_cv_xpointer=no])])
314 if test $ac_cv_xpointer != yes; then
315 AC_DEFINE(XPointer,[char*])
321 # Thanks for not making xmkmf find this by default, you losers.
322 if test -d /usr/lib/Motif1.2 ; then
323 X_CFLAGS="-I/usr/include/Motif1.2 $X_CFLAGS"
324 X_LIBS="-L/usr/lib/Motif1.2 $X_LIBS"
325 elif test -d /usr/lib/Motif1.1 ; then
326 X_CFLAGS="-I/usr/include/Motif1.1 $X_CFLAGS"
327 X_LIBS="-L/usr/lib/Motif1.1 $X_LIBS"
330 # This too. You losers.
331 if test -d /usr/contrib/X11R6/include ; then
332 X_CFLAGS="-I/usr/contrib/X11R6/include $X_CFLAGS"
333 X_LIBS="-L/usr/contrib/X11R6/lib $X_LIBS"
334 elif test -d /usr/contrib/X11R5/include ; then
335 X_CFLAGS="-I/usr/contrib/X11R5/include $X_CFLAGS"
336 X_LIBS="-L/usr/contrib/X11R5/lib $X_LIBS"
341 # Same to you, pinheads. (Is this really the standard location now?
342 # What happened to the joke that this kind of thing went in /opt?)
343 if test -f /usr/dt/include/Xm/Xm.h ; then
344 X_CFLAGS="$X_CFLAGS -I/usr/dt/include"
345 X_LIBS="$X_LIBS -L/usr/dt/lib -R:/usr/dt/lib"
347 # Some versions of Slowlaris Motif require -lgen. But not all. Why?
348 AC_CHECK_LIB(gen, regcmp, [X_LIBS="$X_LIBS -lgen"])
355 # Check for Xmu (some fucked up vendors don't ship it...)
358 AC_CHECK_X_HEADER(X11/Xmu/Error.h, [have_xmu=yes])
359 if test $have_xmu = no ; then
360 XMU_SRCS='$(UTILS_SRC)/xmu.c'
361 XMU_OBJS='$(UTILS_BIN)/xmu.o'
365 SAVER_LIBS="-lXmu $SAVER_LIBS"
366 HACK_LIBS="-lXmu $HACK_LIBS"
371 # See comp.windows.x FAQ question 124 about _get_wmShellWidgetClass on 4.1.x.
372 # The right fix is to get OpenWindows 3.0 patches 100512-02 and 100573-03.
374 if test $have_xmu = yes ; then
377 AC_CACHE_CHECK([for the SunOS 4.1.x _get_wmShellWidgetClass bug],
379 [ac_save_LDFLAGS="$LDFLAGS"
380 if test \! -z "$x_libraries" ; then
381 LDFLAGS="$LDFLAGS -L$x_libraries"
383 # Note: this trick never works! (Generally.)
384 # We're only getting away with using AC_TRY_LINK
385 # with X libraries because we know it's SunOS.
386 LDFLAGS="$LDFLAGS -lXmu -lXt -lX11 -lXext -lm"
388 [ac_cv_sunos_xmu_bug=no],
389 [ac_cv_sunos_xmu_bug=yes])
390 LDFLAGS="$ac_save_LDFLAGS"])
391 if test $ac_cv_sunos_xmu_bug = yes ; then
392 AC_CACHE_CHECK([whether the compiler understands -static],
394 [ac_save_LDFLAGS="$LDFLAGS"
395 LDFLAGS="$LDFLAGS -static"
396 AC_TRY_LINK(,,[ac_cv_ld_static=yes],[ac_cv_ld_static=no])
397 LDFLAGS="$ac_save_LDFLAGS"])
398 if test $ac_cv_ld_static = yes ; then
399 LDFLAGS="$LDFLAGS -static"
401 LDFLAGS="$LDFLAGS -Bstatic"
409 # Check for the SGI SCREEN_SAVER server extension header.
412 with_sgi_req=unspecified
413 AC_ARG_WITH(sgi-ext,[
416 --with-sgi-ext Include support for the SGI SCREEN_SAVER
417 server extension, if possible (this is the default).
418 --without-sgi-ext Do not compile in support for this extension.],
419 [with_sgi="$withval"; with_sgi_req="$withval"],[with_sgi=yes])
420 if test $with_sgi = yes; then
421 AC_CHECK_X_HEADER(X11/extensions/XScreenSaver.h,
423 AC_DEFINE(HAVE_SGI_SAVER_EXTENSION)])
425 elif test $with_sgi != no; then
426 echo "error: must be yes or no: --with-sgi-ext=$with_sgi"
430 # Check for the MIT-SCREEN-SAVER server extension header,
431 # unless the SGI extension has already been found.
434 with_mit_req=unspecified
436 [ --with-mit-ext Include support for the MIT-SCREEN-SAVER
437 server extension, if possible (this is the default).
438 --without-mit-ext Do not compile in support for this extension.],
439 [with_mit="$withval"; with_mit_req="$withval"],[with_mit=yes])
440 if test $have_sgi != yes; then
441 if test $with_mit = yes; then
442 AC_CHECK_X_HEADER(X11/extensions/scrnsaver.h, [have_mit=yes])
444 # Now check to see if it's really in the library; XF86Free-3.3 ships
445 # scrnsaver.h, but doesn't include the code in libXext.a, the idiots!
447 if test $have_mit = yes; then
448 AC_CHECK_X_LIB(Xext, XScreenSaverRegister, [], [have_mit=no], -lm)
450 if test $have_mit = no; then
451 # Fuck! Looks like XF86Free-3.3 actually puts it in XExExt instead
452 # of in Xext. Thank you master, may I have another.
453 AC_CHECK_X_LIB(XExExt, XScreenSaverRegister,
454 [have_mit=yes; SAVER_LIBS="$SAVER_LIBS -lXExExt"],
455 [], -lX11 -lXext -lm)
458 if test $have_mit = no; then
459 # Double fuck! Looks like some versions of XFree86 (whichever version
460 # it is that comes with RedHat Linux 2.0 -- I can't find a version
461 # number) put this garbage in Xss instead of Xext. Thank you master,
462 # may I have another.
463 AC_CHECK_X_LIB(Xss, XScreenSaverRegister,
464 [have_mit=yes; SAVER_LIBS="$SAVER_LIBS -lXss"],
465 [], -lX11 -lXext -lm)
468 if test $have_mit = yes; then
469 AC_DEFINE(HAVE_MIT_SAVER_EXTENSION)
474 elif test $with_mit != no; then
475 echo "error: must be yes or no: --with-mit-ext=$with_mit"
481 # Check for the XIDLE server extension header.
484 with_xidle_req=unspecified
485 AC_ARG_WITH(xidle-ext,
486 [ --with-xidle-ext Include support for the XIDLE server extension,
487 if possible (this is the default).
488 --without-xidle-ext Do not compile in support for this extension.],
489 [with_xidle="$withval"; with_xidle_req="$withval"],[with_xidle=yes])
490 if test $with_xidle = yes; then
491 AC_CHECK_X_HEADER(X11/extensions/xidle.h,
493 AC_DEFINE(HAVE_XIDLE_EXTENSION)])
494 elif test $with_xidle != no; then
495 echo "error: must be yes or no: --with-xidle-ext=$with_xidle"
500 # Check for the XSHM server extension header.
503 with_xshm_req=unspecified
504 AC_ARG_WITH(xshm-ext,
505 [ --with-xshm-ext Include support for the XSHM (Shared Memory) server
506 extension, if possible (this is the default).
507 --without-xshm-ext Do not compile in support for this extension.],
508 [with_xshm="$withval"; with_xshm_req="$withval"],[with_xshm=yes])
509 if test $with_xshm = yes; then
511 # first check for Xshm.h.
512 AC_CHECK_X_HEADER(X11/extensions/XShm.h, [have_xshm=yes])
514 # if that succeeded, then check for sys/ipc.h.
515 if test $have_xshm = yes; then
517 AC_CHECK_X_HEADER(sys/ipc.h, [have_xshm=yes])
520 # if that succeeded, then check for sys/shm.h.
521 if test $have_xshm = yes; then
523 AC_CHECK_X_HEADER(sys/shm.h, [have_xshm=yes])
526 # if that succeeded, then we've really got it.
527 if test $have_xshm = yes; then
528 AC_DEFINE(HAVE_XSHM_EXTENSION)
531 elif test $with_xshm != no; then
532 echo "error: must be yes or no: --with-xshm-ext=$with_xshm"
537 # Check for the SGI-VIDEO-CONTROL server extension header.
540 with_sgivc_req=unspecified
541 AC_ARG_WITH(sgivc-ext,
542 [ --with-sgivc-ext Include support for the SGI-VIDEO-CONTROL server
543 extension, if possible (this is the default).
544 --without-sgivc-ext Do not compile in support for this extension.],
545 [with_sgivc="$withval"; with_sgivc_req="$withval"],[with_sgivc=yes])
546 if test $with_sgivc = yes; then
548 # first check for XSGIvc.h
549 AC_CHECK_X_HEADER(X11/extensions/XSGIvc.h, [have_sgivc=yes])
551 # if that succeeded, then check for the -lXsgivc
552 if test $have_sgivc = yes; then
554 AC_CHECK_X_LIB(Xsgivc, XSGIvcQueryGammaMap,
555 [have_sgivc=yes; SAVER_LIBS="$SAVER_LIBS -lXsgivc"], [],
559 # if that succeeded, then we've really got it.
560 if test $have_sgivc = yes; then
561 AC_DEFINE(HAVE_SGI_VC_EXTENSION)
564 elif test $with_sgivc != no; then
565 echo "error: must be yes or no: --with-sgivc-ext=$with_sgivc"
576 # Check for Motif and Athena --with and --without arguments.
580 with_motif_req=unspecified
581 with_athena_req=unspecified
586 --with-motif Use the Motif toolkit for the user interface,
587 if possible (this is the default).
588 --without-motif Do not use Motif.],
589 [with_motif="$withval"; with_motif_req="$withval"],[with_motif=no])
592 [ --with-athena Use the Athena toolkit for the user interface, if
593 possible (this is the default if Motif isn't used.)
594 --without-athena Do not use Athena.],
595 [with_athena="$withval"; with_athena_req="$withval"],[with_athena=no])
597 if test $with_motif != yes -a $with_motif != no ; then
598 echo "error: must be yes or no: --with-motif=$with_motif"
602 if test $with_athena != yes -a $with_athena != no ; then
603 echo "error: must be yes or no: --with-athena=$with_athena"
608 # Saying --without-motif is the same as saying --with-athena.
609 if test $with_motif_req = no ; then
614 # Saying --without-athena is the same as saying --with-motif.
615 if test $with_athena_req = no ; then
620 # Check for Motif and Athena headers.
623 AC_CHECK_X_HEADER(Xm/Xm.h,
625 AC_DEFINE(HAVE_MOTIF)
626 SAVER_LIBS="-lXm $SAVER_LIBS"])
630 AC_CHECK_X_HEADER(X11/Xaw/Dialog.h,
632 AC_DEFINE(HAVE_ATHENA)
633 SAVER_LIBS="-lXaw $SAVER_LIBS"])
637 # If they asked for both motif and athena, check motif then athena.
638 # If they asked for only motif, check motif then athena.
639 # If they asked for only athena, check athena then motif.
640 # If they asked for neither, check motif then athena.
642 proselytize_motif=yes
643 if test $with_motif = yes; then
644 # asked for both, or for motif only
646 if test $have_motif = yes; then
653 elif test $with_athena = yes; then
654 # asked for athena only
656 if test $have_athena = yes; then
666 if test $have_motif = yes; then
674 if test $have_motif = yes; then
678 # If we have Athena, check whether it's a version that includes
679 # XawViewportSetCoordinates in Viewport.h (R3 (or R4?) don't.)
680 if test $have_athena = yes ; then
681 AC_CACHE_CHECK([for XawViewportSetCoordinates in Viewport.h],
682 ac_cv_have_XawViewportSetCoordinates,
683 [ac_cv_have_XawViewportSetCoordinates=no
684 AC_EGREP_X_HEADER(XawViewportSetCoordinates,
686 ac_cv_have_XawViewportSetCoordinates=yes)])
687 if test $ac_cv_have_XawViewportSetCoordinates = yes ; then
688 AC_DEFINE(HAVE_XawViewportSetCoordinates)
693 # If we have Motif, check whether it's really LessTif.
696 if test $have_motif = yes ; then
697 AC_CACHE_CHECK([whether Motif is really LessTif],
699 [AC_TRY_X_COMPILE([#include <Xm/Xm.h>],
700 [long vers = LesstifVersion;],
701 [ac_cv_have_lesstif=yes],
702 [ac_cv_have_lesstif=no])])
703 have_lesstif=$ac_cv_have_lesstif
707 unset ac_cv_good_lesstif
710 if test $have_lesstif = yes ; then
711 # It must be at least "GNU Lesstif 0.82".
712 # #### If you change this, also sync the warning message lower down.
713 AC_CACHE_CHECK([whether LessTif is of a recent enough vintage],
715 [AC_TRY_X_RUN([#include <Xm/Xm.h>
716 int main() { exit(LesstifVersion < 82); }],
717 [ac_cv_good_lesstif=yes],
718 [ac_cv_good_lesstif=no],
719 # cross compiling? Make an ass out of umption.
720 [ac_cv_good_lesstif=yes])])
721 good_lesstif=$ac_cv_good_lesstif
725 # check for XPM header.
728 with_xpm_req=unspecified
732 --with-xpm Include support for XPM files in some demos,
733 if possible (this is the default).
734 --without-xpm Do not compile in support for XPM files.],
735 [with_xpm="$withval"; with_xpm_req="$withval"],[with_xpm=yes])
736 if test $with_xpm = yes; then
737 AC_CHECK_X_HEADER(X11/xpm.h,
741 elif test $with_xpm != no; then
742 echo "error: must be yes or no: --with-xpm=$with_xpm"
747 # check for the GL header
750 with_gl_req=unspecified
752 [ --with-gl Build those demos which depend on OpenGL,
753 if possible (this is the default).
754 --without-gl Do not build the OpenGL demos.],
755 [with_gl="$withval"; with_gl_req="$withval"],[with_gl=yes])
757 if test $with_gl = yes; then
758 AC_CHECK_X_HEADER(GL/gl.h, have_gl=yes, have_gl=no)
759 if test $have_gl = yes ; then
760 AC_CHECK_X_HEADER(GL/glx.h, have_gl=yes, have_gl=no)
763 # If we have the headers, try and figure out which vendor it's from.
765 if test $have_gl = yes ; then
769 AC_EGREP_X_HEADER(Mesa, GL/glx.h, [have_mesa_gl=yes])
770 if test $have_mesa_gl = no ; then
773 AC_DEFINE(HAVE_MESA_GL)
774 GL_LIBS="-lMesaGL -lMesaGLU"
778 elif test $with_gl != no; then
779 echo "error: must be yes or no: --with-gl=$with_gl"
784 # check for SGI XReadDisplay server extension header.
787 with_readdisplay_req=unspecified
788 AC_ARG_WITH(readdisplay,
789 [ --with-readdisplay Include support for the XReadDisplay server
790 extension if possible (this is the default).
791 --without-readdisplay Do not compile in support for this extension.],
792 [with_readdisplay="$withval"; with_readdisplay_req="$withval"],
793 [with_readdisplay=yes])
794 if test $with_readdisplay = yes; then
795 AC_CHECK_X_HEADER(X11/extensions/readdisplay.h,
796 AC_DEFINE(HAVE_READ_DISPLAY_EXTENSION))
797 elif test $with_readdisplay != no; then
798 echo "error: must be yes or no: --with-readdisplay=$with_readdisplay"
803 # check for SGI's Iris Video Library header.
806 with_sgivideo_req=unspecified
807 AC_ARG_WITH(sgivideo,
808 [ --with-sgivideo Include support for SGI's Iris Video Library
809 if possible (this is the default).
810 --without-sgivideo Do not compile in support for this library.],
811 [with_sgivideo="$withval"; with_sgivideo_req="$withval"],
813 if test $with_sgivideo = yes; then
814 AC_CHECK_X_HEADER(dmedia/vl.h, have_sgivideo=yes)
815 if test $have_sgivideo = yes; then
817 AC_CHECK_LIB(vl, vlOpenVideo, have_sgivideo=yes)
818 if test $have_sgivideo = yes; then
819 SGI_VIDEO_OBJS="$(UTILS_SRC)/sgivideo.o"
820 SGI_VIDEO_LIBS="-lvl"
821 AC_DEFINE(HAVE_SGI_VIDEO)
824 elif test $with_sgivideo != no; then
825 echo "error: must be yes or no: --with-sgivideo=$with_sgivideo"
831 # Try to find a program to generate random text.
833 # Zippy is funnier than the idiocy generally spat out by `fortune',
834 # so try to find that, by invoking Emacs and asking it where its
835 # libexec directory is ("yow" lives in there.)
837 # If that doesn't work, see if fortune, zippy, or yow are on $PATH,
838 # and if so, use them.
840 # If that doesn't work, look in /usr/games, and if it's there, use
845 [ --with-zippy=PROGRAM Some demos are able to run an external program and
846 display its text; this names the program to use by
847 default (though it can be overridden with X
848 resources.) If you don't specify this, the default
849 is to use \"yow\" from the Emacs distribution (if you
850 have it) or else to use \"fortune\".],
851 [ with_zippy_req="$withval"; with_zippy="$withval" ],
852 [ with_zippy_req="$withval"; with_zippy="$withval" ])
854 if test "$with_zippy" = no || test "$with_zippy" = yes ; then
859 if test -n "$with_zippy_req" ; then
860 ac_cv_zippy_program=""
861 case "$with_zippy_req" in
863 AC_MSG_CHECKING([for $with_zippy_req])
864 if test -x "$with_zippy_req" ; then
873 unset ac_cv_path_zip2
874 AC_PATH_PROG(zip2, $with_zippy_req, [])
875 if test "$zip2" = ""; then
880 ac_cv_zippy_program="$with_zippy"
882 elif test -n "$ac_cv_zippy_program"; then
883 AC_MSG_RESULT([checking for zippy... (cached) $ac_cv_zippy_program])
886 if test ! -n "$ac_cv_zippy_program"; then
888 AC_CHECK_PROGS(emacs_exe, emacs)
889 AC_CHECK_PROGS(xemacs_exe, xemacs)
891 ac_cv_zippy_program=""
892 eargs='-batch -q -nw --eval'
894 if test -n "$emacs_exe" ; then
895 AC_MSG_CHECKING([for emacs yow])
897 # get emacs to tell us where the libexec directory is.
899 dir=`$emacs_exe $eargs '(princ (concat exec-directory "\n"))' \
900 2>/dev/null | tail -1`
901 dir=`echo "$dir" | sed 's@///*@/@g;s@/$@@'`
903 # try running libexec/yow and see if it exits without error.
905 if test x"$dir" != x -a -x $dir/yow ; then
906 if $dir/yow >&- 2>&- ; then
907 ac_cv_zippy_program="$dir/yow"
908 AC_MSG_RESULT($ac_cv_zippy_program)
915 if test -z "$ac_cv_zippy_program" ; then
916 AC_MSG_CHECKING([for xemacs yow])
917 if test -n "$xemacs_exe" ; then
919 # get xemacs to tell us where the libexec directory is.
921 dir=`$xemacs_exe $eargs '(princ (concat exec-directory "\n"))' \
922 2>/dev/null | tail -1`
923 dir=`echo "$dir" | sed 's@///*@/@g;s@/$@@'`
925 # try running libexec/yow and see if it exits without error.
927 if test x"$dir" != x -a -x $dir/yow ; then
928 if $dir/yow >&- 2>&- ; then
929 ac_cv_zippy_program="$dir/yow"
930 AC_MSG_RESULT($ac_cv_zippy_program)
933 # in some xemacs installations, the pathname of the yow.lines file
934 # isn't hardcoded into the yow executable, and must be passed on
935 # the command line. See if it's in libexec/../etc/.
939 dir_up=`echo "$dir" | sed 's@/[^/]*$@@'`
942 yow="yow -f $dir_up/etc/yow.lines"
943 if $dir/$yow >&- 2>&- ; then
944 ac_cv_zippy_program="$dir/$yow"
945 AC_MSG_RESULT($ac_cv_zippy_program)
954 # if that didn't work, try for some other programs...
955 if test -z "$ac_cv_zippy_program" ; then
957 AC_CHECK_PROGS(fortune, [fortune zippy yow])
958 # if that didn't work, try for those programs in /usr/games...
959 if test -z "$fortune" ; then
960 AC_PATH_PROGS(fortune, [fortune zippy yow], fortune,
961 /usr/games:/usr/local/games)
966 if test -z "$ac_cv_zippy_program" ; then
967 ac_cv_zippy_program=fortune
970 AC_DEFINE_UNQUOTED(ZIPPY_PROGRAM, "$ac_cv_zippy_program")
975 # Allow locking to be disabled at compile-time.
979 with_kerberos_req=unspecified
981 with_shadow_req=unspecified
984 AC_ARG_ENABLE(locking,[
987 --enable-locking Compile in support for locking the display
988 (this is the default.)
989 --disable-locking Do not allow locking at all.],
990 [enable_locking="$enableval"],[enable_locking=yes])
991 if test $enable_locking = yes; then
993 # Check for Kerberos.
995 AC_ARG_WITH(kerberos, [
996 --with-kerberos Include support for Kerberos authentication,
997 if possible (this is the default.)
998 --without-kerberos Do not compile in support for Kerberos.],
999 [with_kerberos="$withval"; with_kerberos_req="$withval"],[with_kerberos=yes])
1000 if test $with_kerberos = yes; then
1001 AC_CACHE_CHECK([for Kerberos], ac_cv_kerberos,
1002 [AC_TRY_X_COMPILE([#include <krb.h>],,
1003 [ac_cv_kerberos=yes],
1004 [ac_cv_kerberos=no])])
1005 if test $ac_cv_kerberos = yes ; then
1007 AC_DEFINE(HAVE_KERBEROS)
1008 PASSWD_LIBS="$PASSWD_LIBS -lkrb -ldes -lnsl -lsocket"
1010 elif test $with_kerberos != no; then
1011 echo "error: must be yes or no: --with-kerberos=$with_kerberos"
1015 # Next, check for the nine billion variants of shadow passwords...
1017 passwd_cruft_done=no
1019 [ --with-shadow Include support for shadow password authentication,
1020 if possible (this is the default, if no Kerberos.)
1021 --without-shadow Do not compile in support for shadow passwords.
1023 [with_shadow="$withval"; with_shadow_req="$withval"],[with_shadow=yes])
1024 if test $with_shadow = no; then
1025 passwd_cruft_done=yes
1026 elif test $with_shadow != yes; then
1027 echo "error: must be yes or no: --with-shadow=$with_shadow"
1032 # Sun's "adjunct" passwords.
1034 if test $passwd_cruft_done = no ; then
1035 AC_CACHE_CHECK([for Sun-style shadow passwords], ac_cv_sun_adjunct,
1036 [AC_TRY_X_COMPILE([#include <stdlib.h>
1038 #include <sys/types.h>
1039 #include <sys/label.h>
1040 #include <sys/audit.h>
1041 #include <pwdadj.h>],
1042 [struct passwd_adjunct *p = getpwanam("nobody");
1043 const char *pw = p->pwa_passwd;],
1044 [ac_cv_sun_adjunct=yes],
1045 [ac_cv_sun_adjunct=no])])
1046 if test $ac_cv_sun_adjunct = yes; then
1049 passwd_cruft_done=yes
1050 AC_DEFINE(HAVE_ADJUNCT_PASSWD)
1054 # DEC and SCO so-called "enhanced" security.
1056 if test $passwd_cruft_done = no ; then
1057 AC_CACHE_CHECK([for DEC-style shadow passwords], ac_cv_enhanced_passwd,
1058 [AC_TRY_X_COMPILE([#include <stdlib.h>
1060 #include <sys/types.h>
1062 #include <sys/security.h>
1064 [struct pr_passwd *p;
1066 set_auth_parameters(0, 0);
1067 check_auth_parameters();
1068 p = getprpwnam("nobody");
1069 pw = p->ufld.fd_encrypt;],
1070 [ac_cv_enhanced_passwd=yes],
1071 [ac_cv_enhanced_passwd=no])])
1072 if test $ac_cv_enhanced_passwd = yes; then
1075 passwd_cruft_done=yes
1076 AC_DEFINE(HAVE_ENHANCED_PASSWD)
1078 # On SCO, getprpwnam() is in -lprot (which uses nap() from -lx)
1079 # (I'm told it needs -lcurses too, but I don't understand why.)
1080 AC_CHECK_LIB(prot, getprpwnam,
1081 [PASSWD_LIBS="$PASSWD_LIBS -lprot -lcurses -lx"],
1082 [# On DEC, getprpwnam() is in -lsecurity
1083 AC_CHECK_LIB(security, getprpwnam,
1084 [PASSWD_LIBS="$PASSWD_LIBS -lsecurity"])],
1089 # HP's entry in the "Not Invented Here" Sweepstakes.
1091 if test $passwd_cruft_done = no ; then
1092 AC_CACHE_CHECK([for HP-style shadow passwords], ac_cv_hpux_passwd,
1093 [AC_TRY_X_COMPILE([#include <stdlib.h>
1095 #include <sys/types.h>
1097 #include <hpsecurity.h>
1099 [struct s_passwd *p = getspwnam("nobody");
1100 const char *pw = p->pw_passwd;],
1101 [ac_cv_hpux_passwd=yes],
1102 [ac_cv_hpux_passwd=no])])
1103 if test $ac_cv_hpux_passwd = yes; then
1106 passwd_cruft_done=yes
1107 AC_DEFINE(HAVE_HPUX_PASSWD)
1109 # on HPUX, bigcrypt is in -lsec
1110 AC_CHECK_LIB(sec, bigcrypt, [PASSWD_LIBS="$PASSWD_LIBS -lsec"])
1114 # Traditional (ha!) shadow passwords.
1116 if test $passwd_cruft_done = no ; then
1117 AC_CACHE_CHECK([for generic shadow passwords], ac_cv_shadow,
1118 [AC_TRY_X_COMPILE([#include <stdlib.h>
1120 #include <sys/types.h>
1122 #include <shadow.h>],
1123 [struct spwd *p = getspnam("nobody");
1124 const char *pw = p->sp_pwdp;],
1126 [ac_cv_shadow=no])])
1127 if test $ac_cv_shadow = yes; then
1130 passwd_cruft_done=yes
1131 AC_DEFINE(HAVE_SHADOW_PASSWD)
1133 # On some systems (UnixWare 2.1), getspnam() is in -lgen instead of -lc.
1135 AC_CHECK_LIB(c, getspnam, [have_getspnam=yes])
1136 if test $have_getspnam = no ; then
1137 AC_CHECK_LIB(gen, getspnam,
1138 [have_getspnam=yes; PASSWD_LIBS="$PASSWD_LIBS -lgen"])
1143 # On some systems (UnixWare 2.1), crypt() is in -lcrypt instead of -lc.
1145 AC_CHECK_LIB(c, crypt, [have_crypt=yes])
1146 if test $have_crypt = no ; then
1147 AC_CHECK_LIB(crypt, crypt,
1148 [have_crypt=yes; PASSWD_LIBS="$PASSWD_LIBS -lcrypt"])
1152 # Most of the above shadow mechanisms will have set need_setuid to yes,
1153 # if they were found. But, on some systems, we need setuid even when
1154 # using plain old vanilla passwords.
1156 if test $need_setuid = no ; then
1158 *-hpux* | *-aix* | *-netbsd* | *-freebsd* | *-openbsd* )
1164 elif test $enable_locking = no; then
1165 AC_DEFINE(NO_LOCKING)
1167 echo "error: must be yes or no: --enable-locking=$enable_locking"
1173 if test \! -z "$includedir" ; then
1174 INCLUDES="-I$includedir"
1177 if test \! -z "$libdir" ; then
1178 LDFLAGS="$LDFLAGS -L$libdir"
1182 ##### should have options to override the DEPEND crap, I guess...
1189 # Done testing things -- now substitute in some stuff for the Makefiles.
1191 if test $have_motif = yes; then
1192 AC_DEFINE(HAVE_MOTIF)
1193 DIALOG_SRCS='$(MOTIF_SRCS)'
1194 DIALOG_OBJS='$(MOTIF_OBJS)'
1195 elif test $have_athena = yes; then
1196 AC_DEFINE(HAVE_ATHENA)
1197 DIALOG_SRCS='$(ATHENA_SRCS)'
1198 DIALOG_OBJS='$(ATHENA_OBJS)'
1204 if test $have_kerberos = yes; then
1205 PASSWD_SRCS='$(KERBEROS_SRCS)'
1206 PASSWD_OBJS='$(KERBEROS_OBJS)'
1208 PASSWD_SRCS='$(PWENT_SRCS)'
1209 PASSWD_OBJS='$(PWENT_OBJS)'
1212 if test $enable_locking = yes; then
1213 LOCK_SRCS='$(LOCK_SRCS_1) $(PASSWD_SRCS)'
1214 LOCK_OBJS='$(LOCK_OBJS_1) $(PASSWD_OBJS)'
1220 if test $need_setuid = yes; then
1222 INSTALL_SETUID='$(INSTALL) $(SUID_FLAGS)'
1225 INSTALL_SETUID='$(INSTALL_PROGRAM)'
1229 if test $have_gl = yes; then
1230 GL_EXES='$(GL_EXES)'
1231 GL_KLUDGE_1=${tab}${tab}${tab}${tab}${tab}${tab}${tab}${tab}${tab}' \'
1234 GL_KLUDGE_1=${tab}${tab}${tab}${tab}${tab}${tab}${tab}${tab}${tab}'\n'
1235 GL_KLUDGE_2='!'${tab}
1240 AC_SUBST(SAVER_LIBS)
1244 AC_SUBST(PASSWD_LIBS)
1245 AC_SUBST(INSTALL_SETUID)
1246 AC_SUBST(NEED_SETUID)
1247 AC_SUBST(SGI_VIDEO_OBJS)
1248 AC_SUBST(SGI_VIDEO_LIBS)
1250 AC_SUBST(DIALOG_SRCS)
1251 AC_SUBST(DIALOG_OBJS)
1252 AC_SUBST(PASSWD_SRCS)
1253 AC_SUBST(PASSWD_OBJS)
1259 AC_SUBST(GL_KLUDGE_1)
1260 AC_SUBST(GL_KLUDGE_2)
1262 AC_SUBST(APPDEFAULTS)
1265 AC_SUBST(DEPEND_FLAGS)
1266 AC_SUBST(DEPEND_DEFINES)
1268 # Print some warnings before emitting the Makefiles.
1271 warnsep=' #################################################################'
1273 if test $warning = no ; then
1274 echo '' ; echo "$warnsep" ; echo ''
1281 if test $warning = long ; then echo '' ; fi
1290 if test $was != no ; then echo '' ; fi
1299 if test $with_sgi_req = yes -a $have_sgi = no ; then
1300 warn 'The SGI saver extension was requested, but was not found.'
1303 if test $with_mit_req = yes -a $have_mit = no ; then
1304 warn 'The MIT saver extension was requested, but was not found.'
1307 if test $with_xidle_req = yes -a $have_xidle = no ; then
1308 warn 'The XIdle extension was requested, but was not found.'
1311 if test $with_xshm_req = yes -a $have_xshm = no ; then
1312 warn 'The XSHM extension was requested, but was not found.'
1315 if test $with_sgivc_req = yes -a $have_sgivc = no ; then
1316 warn 'The SGI-VIDEO-CONTROL extension was requested, but was not found.'
1319 if test $have_motif = no -a $have_athena = no ; then
1320 warnL "Neither Motif nor Athena widgets seem to be available;"
1321 warn2 "one or the other is required."
1322 proselytize_motif=no
1324 elif test $with_motif_req = yes -a $have_motif = no ; then
1325 warnL "Use of Motif was requested, but it wasn't found;"
1326 warn2 "Athena will be used instead."
1328 elif test $with_athena_req = yes -a $have_athena = no ; then
1329 warnL "Use of Athena was requested, but it wasn't found;"
1330 warn2 "Motif will be used instead."
1333 if test $have_motif = yes -a $have_lesstif = yes ; then
1334 if test $good_lesstif != yes ; then
1335 warnL "Motif is being used, but it appears to actually be"
1336 warn2 "LessTif, and the version number is less than 0.82!"
1337 warn2 "Such old versions of LessTif are too buggy to use"
1338 warn2 "with XScreenSaver; it is strongly recommended that"
1339 warn2 "you upgrade! See <http://www.lesstif.org/>."
1343 if test $proselytize_motif = yes ; then
1344 warnL "Athena widgets are being used instead of Motif."
1345 warn2 "XScreenSaver looks much better with Motif, and has"
1346 warn2 "a few extra features as well. Wouldn't you rather"
1347 warn2 "be using Motif? It is shipped by every commercial"
1348 warn2 "Unix vendor; and there is a free implementation"
1349 warn2 "available as well: see <http://www.lesstif.org/>."
1352 if test $with_xpm_req = yes -a $have_xpm = no ; then
1353 warn 'Use of XPM was requested, but it was not found.'
1356 if test $with_gl_req = yes -a $have_gl = no ; then
1357 warn 'Use of GL was requested, but it was not found.'
1360 if test $with_readdisplay_req = yes -a $have_readdisplay = no ; then
1361 warn 'Use of XReadDisplay was requested, but it was not found.'
1364 if test $with_sgivideo_req = yes -a $have_sgivideo = no ; then
1365 warn 'Use of the Iris Video Library was requested, but it was not found.'
1368 if test $with_kerberos_req = yes -a $have_kerberos = no ; then
1369 warn 'Use of Kerberos was requested, but it was not found.'
1372 if test $with_shadow_req = yes -a $have_shadow = no ; then
1373 warn 'Use of shadow passwords was requested, but they were not found.'
1376 if test -n "$with_zippy_req"; then
1377 if test "$with_zippy_req" != "$ac_cv_zippy_program" ; then
1378 warnL "$with_zippy_req was requested as the Zippy program,"
1379 warn2 "but was not found. The default will be used instead."
1383 if test $warning != no; then
1384 echo '' ; echo "$warnsep" ; echo ''
1393 driver/XScreenSaver.ad)