1 # configure.in --- xscreensaver, Copyright (c) 1997-2000 Jamie Zawinski.
4 AC_INIT(driver/subprocs.c)
5 AC_CONFIG_HEADER(config.h)
7 echo "current directory: `pwd`"
8 echo "command line was: $0 $@"
11 # After checking to see that --srcdir is correct (which AC_INIT does)
12 # check for some random other files that come later in the tar file,
13 # to make sure everything is here.
15 for d in driver utils hacks hacks/glx ; do
16 f=$srcdir/$d/Makefile.in
17 if test \! -r $f ; then
19 echo "ERROR: The package is incomplete: $f does not exist."
20 echo " This probably means that your download was truncated."
27 ###############################################################################
29 # Function to figure out how to run the compiler.
31 ###############################################################################
33 AC_DEFUN(AC_PROG_CC_ANSI,
36 if test -z "$GCC"; then
37 AC_MSG_CHECKING(how to request ANSI compilation)
40 AC_MSG_RESULT(HPUX: adding -Ae)
44 AC_MSG_RESULT(AIX: adding -qlanglvl=ansi -qhalt=e)
45 CC="$CC -qlanglvl=ansi -qhalt=e"
49 AC_MSG_RESULT(DEC: adding -std1)
54 AC_MSG_RESULT(no idea)
59 AC_MSG_CHECKING([whether the compiler works on ANSI C])
60 AC_TRY_RUN([ main(int ac, char **av) { return 0; } ],
63 AC_MSG_ERROR(Couldn't build even a trivial ANSI C program: check CC.),
64 AC_MSG_ERROR(Couldn't build even a trivial ANSI C program: check CC.))
66 if test -n "$GCC"; then
67 AC_MSG_RESULT(Turning on gcc compiler warnings.)
68 CC="$CC -Wall -Wstrict-prototypes -Wnested-externs -Wno-format"
69 AC_MSG_RESULT(Disabling C++ comments in ANSI C code.)
70 CC="$CC -Wp,-lang-c89"
73 *-irix5* |*-irix6.[0-3]* )
74 AC_MSG_RESULT(Turning on SGI compiler warnings.)
75 CC="$CC -fullwarn -use_readonly_const -rdata_shared -g3"
78 # if test -z "$GCC"; then
79 # AC_MSG_RESULT(Turning on DEC C compiler warnings.)
80 # CC="$CC -migrate -w0 -verbose -warnprotos"
88 ###############################################################################
90 # Function to work around the fucked up gcc 2.96 included in Red Hat 7.0
92 ###############################################################################
94 AC_DEFUN(AC_ESCHEW_REDHAT_GCC_LOSSAGE,
95 [if test -n "$GCC"; then
96 AC_MSG_CHECKING(for Red Hat GCC lossage)
97 AC_CACHE_VAL(ac_cv_red_hat_gcc_lossage,
98 [ac_cv_red_hat_gcc_lossage=no
101 #if !defined(__USE_POSIX) || !defined(__USE_SVID) || !defined(__USE_BSD)
104 ], ac_cv_red_hat_gcc_lossage=yes)
107 ac_red_hat_gcc_lossage=$ac_cv_red_hat_gcc_lossage
108 if test "$ac_cv_red_hat_gcc_lossage" = yes ; then
109 rh_defines="-D_POSIX_SOURCE -D_SVID_SOURCE -D_BSD_SOURCE";
111 AC_MSG_RESULT(yes: need $rh_defines)
119 ###############################################################################
121 # Function to figure out how to create directory trees.
123 ###############################################################################
125 AC_DEFUN(AC_PROG_INSTALL_DIRS,
126 [AC_CACHE_CHECK([whether \"\${INSTALL} -d\" creates intermediate directories],
127 ac_cv_install_d_creates_dirs,
128 [ac_cv_install_d_creates_dirs=no
130 if mkdir conftestdir; then
132 ${INSTALL} -d `pwd`/dir1/dir2 >&- 2>&-
133 if test -d dir1/dir2/. ; then
134 ac_cv_install_d_creates_dirs=yes
141 if test "$ac_cv_install_d_creates_dirs" = no ; then
142 AC_CACHE_CHECK([whether \"mkdir -p\" creates intermediate directories],
143 ac_cv_mkdir_p_creates_dirs,
144 [ac_cv_mkdir_p_creates_dirs=no
146 if mkdir conftestdir; then
148 mkdir -p dir1/dir2 >&- 2>&-
149 if test -d dir1/dir2/. ; then
150 ac_cv_mkdir_p_creates_dirs=yes
158 if test "$ac_cv_install_d_creates_dirs" = yes ; then
159 INSTALL_DIRS='${INSTALL} -d'
160 elif test "$ac_cv_mkdir_p_creates_dirs" = yes ; then
161 INSTALL_DIRS='mkdir -p'
164 INSTALL_DIRS='${INSTALL} -d'
169 ###############################################################################
171 # Function to check whether gettimeofday() exists, and how to call it.
172 # This may define HAVE_GETTIMEOFDAY and GETTIMEOFDAY_TWO_ARGS.
174 ###############################################################################
176 AC_DEFUN(AC_GETTIMEOFDAY_ARGS,
177 [AC_MSG_CHECKING(how to call gettimeofday)
178 AC_CACHE_VAL(ac_cv_gettimeofday_args,
179 [AC_TRY_COMPILE([#include <stdlib.h>
180 #include <sys/time.h>],
181 [struct timeval tv; struct timezone tzp;
182 gettimeofday(&tv, &tzp);],
183 [ac_gettimeofday_args=2],
184 [AC_TRY_COMPILE([#include <stdlib.h>
185 #include <sys/time.h>],
186 [struct timeval tv; gettimeofday(&tv);],
187 [ac_gettimeofday_args=1],
188 [ac_gettimeofday_args=0])])
189 ac_cv_gettimeofday_args=$ac_gettimeofday_args])
190 ac_gettimeofday_args=$ac_cv_gettimeofday_args
191 if test "$ac_gettimeofday_args" = 1 ; then
192 AC_DEFINE(HAVE_GETTIMEOFDAY)
193 AC_MSG_RESULT(one argument)
194 elif test "$ac_gettimeofday_args" = 2 ; then
195 AC_DEFINE(HAVE_GETTIMEOFDAY)
196 AC_DEFINE(GETTIMEOFDAY_TWO_ARGS)
197 AC_MSG_RESULT(two arguments)
199 AC_MSG_RESULT(unknown)
204 ###############################################################################
206 # Function to find perl5 (defines PERL and PERL_VERSION.)
208 ###############################################################################
210 # M4 sucks!! perl sucks too!!
212 perl_version_cmd='print $]'
215 AC_DEFUN(AC_PROG_PERL,
216 [AC_PATH_PROGS(PERL, [perl5 perl],,)
217 if test -z "$PERL" ; then
220 AC_CACHE_CHECK([perl version], ac_cv_perl_version,
221 [ac_cv_perl_version=`$PERL -e "$perl_version_cmd"`])
222 PERL_VERSION=$ac_cv_perl_version
227 ###############################################################################
229 # Function to demand "bc". Losers.
231 ###############################################################################
233 AC_DEFUN(AC_DEMAND_BC,
234 [ac_bc_result=`echo 6+9 | bc 2>/dev/null`
235 AC_MSG_CHECKING([for bc])
236 if test "$ac_bc_result" = "15" ; then
241 AC_MSG_ERROR([Your system doesn't have \"bc\", which has been a standard
242 part of Unix since the 1970s. Come back when your vendor
247 ###############################################################################
249 # Functions to check how to do ICMP PING requests.
251 ###############################################################################
253 AC_DEFUN(AC_CHECK_ICMP,
254 [AC_CACHE_CHECK([for struct icmp], ac_cv_have_icmp,
255 [AC_TRY_COMPILE([#include <stdlib.h>
262 #include <sys/types.h>
263 #include <sys/time.h>
266 #include <sys/socket.h>
267 #include <netinet/in_systm.h>
268 #include <netinet/in.h>
269 #include <netinet/ip.h>
270 #include <netinet/ip_icmp.h>
271 #include <netinet/udp.h>
272 #include <arpa/inet.h>
276 struct sockaddr_in si;
278 i.icmp_type = ICMP_ECHO;
283 si.sin_family = AF_INET;
285 [ac_cv_have_icmp=yes],
286 [ac_cv_have_icmp=no])])
287 if test "$ac_cv_have_icmp" = yes ; then
291 AC_DEFUN(AC_CHECK_ICMPHDR,
292 [AC_CACHE_CHECK([for struct icmphdr], ac_cv_have_icmphdr,
293 [AC_TRY_COMPILE([#include <stdlib.h>
300 #include <sys/types.h>
301 #include <sys/time.h>
304 #include <sys/socket.h>
305 #include <netinet/in_systm.h>
306 #include <netinet/in.h>
307 #include <netinet/ip.h>
308 #include <netinet/ip_icmp.h>
309 #include <netinet/udp.h>
310 #include <arpa/inet.h>
314 struct sockaddr_in si;
320 i.un.echo.sequence = 0;
321 si.sin_family = AF_INET;
323 [ac_cv_have_icmphdr=yes],
324 [ac_cv_have_icmphdr=no])])
325 if test "$ac_cv_have_icmphdr" = yes ; then
326 AC_DEFINE(HAVE_ICMPHDR)
330 ###############################################################################
332 # Functions to check for various X11 crap.
334 ###############################################################################
336 # Try and find the app-defaults directory.
337 # It sucks that autoconf doesn't do this already...
339 AC_DEFUN(AC_PATH_X_APP_DEFAULTS_XMKMF,[
341 if mkdir conftestdir; then
343 # Make sure to not put "make" in the Imakefile rules, since we grep it out.
344 cat > Imakefile <<'EOF'
346 @echo 'ac_x_app_defaults="${XAPPLOADDIR}"'
348 if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
349 # GNU make sometimes prints "make[1]: Entering...", which'd confuse us.
350 eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
356 AC_DEFUN(AC_PATH_X_APP_DEFAULTS_DIRECT,[
357 # Look for the directory under a standard set of common directories.
358 # Check X11 before X11Rn because it's often a symlink to the current release.
360 /usr/X11/lib/app-defaults \
361 /usr/X11R6/lib/app-defaults \
362 /usr/X11R6/lib/X11/app-defaults \
363 /usr/X11R5/lib/app-defaults \
364 /usr/X11R5/lib/X11/app-defaults \
365 /usr/X11R4/lib/app-defaults \
366 /usr/X11R4/lib/X11/app-defaults \
368 /usr/lib/X11/app-defaults \
369 /usr/lib/X11R6/app-defaults \
370 /usr/lib/X11R5/app-defaults \
371 /usr/lib/X11R4/app-defaults \
373 /usr/local/X11/lib/app-defaults \
374 /usr/local/X11R6/lib/app-defaults \
375 /usr/local/X11R5/lib/app-defaults \
376 /usr/local/X11R4/lib/app-defaults \
378 /usr/local/lib/X11/app-defaults \
379 /usr/local/lib/X11R6/app-defaults \
380 /usr/local/lib/X11R6/X11/app-defaults \
381 /usr/local/lib/X11R5/app-defaults \
382 /usr/local/lib/X11R5/X11/app-defaults \
383 /usr/local/lib/X11R4/app-defaults \
384 /usr/local/lib/X11R4/X11/app-defaults \
386 /usr/X386/lib/X11/app-defaults \
387 /usr/x386/lib/X11/app-defaults \
388 /usr/XFree86/lib/X11/app-defaults \
390 /usr/lib/X11/app-defaults \
391 /usr/local/lib/X11/app-defaults \
392 /usr/unsupported/lib/X11/app-defaults \
393 /usr/athena/lib/X11/app-defaults \
394 /usr/local/x11r5/lib/X11/app-defaults \
395 /usr/lpp/Xamples/lib/X11/app-defaults \
396 /lib/usr/lib/X11/app-defaults \
398 /usr/openwin/lib/app-defaults \
399 /usr/openwin/lib/X11/app-defaults \
400 /usr/openwin/share/lib/app-defaults \
401 /usr/openwin/share/lib/X11/app-defaults \
403 /X11R6/lib/app-defaults \
404 /X11R5/lib/app-defaults \
405 /X11R4/lib/app-defaults \
408 if test -d "$ac_dir"; then
409 ac_x_app_defaults=$ac_dir
415 AC_DEFUN(AC_PATH_X_APP_DEFAULTS,
417 AC_CACHE_CHECK([for X app-defaults directory], ac_cv_x_app_defaults,
418 [AC_PATH_X_APP_DEFAULTS_XMKMF
419 if test x"$ac_x_app_defaults" = x; then
420 AC_PATH_X_APP_DEFAULTS_DIRECT
422 if test x"$ac_x_app_defaults" = x; then
423 ac_cv_x_app_defaults="/usr/lib/X11/app-defaults"
425 # Record where we found app-defaults for the cache.
426 ac_cv_x_app_defaults="$ac_x_app_defaults"
428 eval ac_x_app_defaults="$ac_cv_x_app_defaults"])
431 AC_DEFUN(AC_XPOINTER,
432 [AC_CACHE_CHECK([for XPointer], ac_cv_xpointer,
433 [AC_TRY_X_COMPILE([#include <X11/Xlib.h>],
434 [XPointer foo = (XPointer) 0;],
435 [ac_cv_xpointer=yes],
436 [ac_cv_xpointer=no])])
437 if test "$ac_cv_xpointer" != yes; then
438 AC_DEFINE(XPointer,[char*])
442 # Random special-cases for X on certain pathological OSes.
443 # You know who you are.
445 AC_DEFUN(AC_X_RANDOM_PATHS,
449 # The following arcana was gleaned from conversations with
450 # Eric Schwartz <erics@col.hp.com>:
452 # On HPUX 10.x, the parts of X that HP considers "standard" live in
453 # /usr/{include,lib}/X11R6/. The parts that HP doesn't consider
454 # "standard", notably, Xaw and Xmu, live in /usr/contrib/X11R6/.
455 # Yet /usr/contrib/X11R6/ comes preinstalled on all HPUX systems.
456 # Also, there are symlinks from /usr/include/ and /usr/lib/ into
457 # /usr/{include,lib}/X11R6/, so that (if you don't use Xmu at all)
458 # you don't need any -I or -L arguments.
460 # On HPUX 9.x, /usr/{include,lib}/X11R5/ and /usr/contrib/X11R5/
461 # are the same division as 10.x. However, there are no symlinks to
462 # the X stuff from /usr/include/ and /usr/lib/, so -I and -L
463 # arguments are always necessary.
465 # However, X11R6 was available on HPUX 9.x as a patch: if that
466 # patch was installed, then all of X11R6 went in to
467 # /usr/contrib/X11R6/ (there was no /usr/{include,lib}/X11R6/.)
469 # HPUX 8.x was the same as 9.x, but was X11R4 instead (I don't know
470 # whether R5 was available as a patch; R6 undoubtedly was not.)
472 # So. We try and use the highest numbered pair of
473 # /usr/{include,lib}/X11R?/ and /usr/contrib/X11R?/{include,lib}/
474 # that are available. We do not mix and match different versions
477 # Question I still don't know the answer to: (do you?)
479 # * On HPUX 9.x, where /usr/include/X11R5/ was standard, and
480 # /usr/contrib/X11R6/ could be installed as a patch, what was in
481 # that contrib directory? Did it contain so-called "standard"
482 # X11R6, or did it include Xaw and Xmu as well? If the former,
483 # where did one find Xaw and Xmu on 9.x R6 systems? Would this
484 # be a situation where one had to reach into the R5 headers and
485 # libs to find Xmu? That is, must both R6 and R5 directories
486 # be on the -I and -L lists in that case?
488 for version in X11R6 X11R5 X11R4 ; do
489 # if either pair of directories exists...
490 if test -d /usr/lib/$version || test -d /usr/contrib/$version/lib
492 # if contrib exists, use it...
493 if test -d /usr/contrib/$version/lib ; then
494 X_CFLAGS="$X_CFLAGS -I/usr/contrib/$version/include"
495 X_LIBS="$X_LIBS -L/usr/contrib/$version/lib"
497 # if the "standard" one exists, use it.
498 if test -d /usr/lib/$version ; then
499 X_CFLAGS="$X_CFLAGS -I/usr/include/$version"
500 X_LIBS="$X_LIBS -L/usr/lib/$version"
502 # since at least one of the pair exists, go no farther.
507 # Now find Motif. Thanks for not making xmkmf find this by
508 # default, you losers.
510 if test -d /usr/lib/Motif1.2 ; then
511 X_CFLAGS="$X_CFLAGS -I/usr/include/Motif1.2"
512 X_LIBS="$X_LIBS -L/usr/lib/Motif1.2"
513 elif test -d /usr/lib/Motif1.1 ; then
514 X_CFLAGS="$X_CFLAGS -I/usr/include/Motif1.1"
515 X_LIBS="$X_LIBS -L/usr/lib/Motif1.1"
518 # Now let's check for the pseudo-standard locations for OpenGL and XPM.
520 if test -d /opt/Mesa/lib ; then
521 X_CFLAGS="-I/opt/Mesa/include $X_CFLAGS"
522 X_LIBS="-L/opt/Mesa/lib $X_LIBS"
525 if test -d /opt/xpm/lib/X11 ; then
526 X_CFLAGS="-I/opt/xpm/include $X_CFLAGS"
527 X_LIBS="-L/opt/xpm/lib/X11 $X_LIBS"
530 # On HPUX, default to installing in /opt/xscreensaver/ instead of
531 # in /usr/local/, unless there is already an xscreensaver in
532 # /usr/local/bin/. This can be overridden with the --prefix arg
533 # to configure. I'm not sure this is the right thing to do, but
534 # Richard Lloyd says so...
536 if test \! -x /usr/local/bin/xscreensaver ; then
537 ac_default_prefix=/opt/xscreensaver
543 # Thanks for not making xmkmf find this by default, pinheads.
544 # And thanks for moving things around again, too. Is this
545 # really the standard location now? What happened to the
546 # joke that this kind of thing went in /opt?
547 # cthomp says "answer: CDE (Common Disorganized Environment)"
549 if test -f /usr/dt/include/Xm/Xm.h ; then
550 X_CFLAGS="$X_CFLAGS -I/usr/dt/include"
551 X_LIBS="$X_LIBS -L/usr/dt/lib -R:/usr/dt/lib"
553 # Some versions of Slowlaris Motif require -lgen. But not all. Why?
554 AC_CHECK_LIB(gen, regcmp, [X_LIBS="$X_LIBS -lgen"])
561 ###############################################################################
563 # Some utility functions to make checking for X things easier.
565 ###############################################################################
567 # Like AC_CHECK_HEADER, but it uses the already-computed -I directories.
569 AC_DEFUN(AC_CHECK_X_HEADER, [
570 ac_save_CPPFLAGS="$CPPFLAGS"
571 if test \! -z "$includedir" ; then
572 CPPFLAGS="$CPPFLAGS -I$includedir"
574 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
575 AC_CHECK_HEADER([$1], [$2])
576 CPPFLAGS="$ac_save_CPPFLAGS"])
578 # Like AC_EGREP_HEADER, but it uses the already-computed -I directories.
580 AC_DEFUN(AC_EGREP_X_HEADER, [
581 ac_save_CPPFLAGS="$CPPFLAGS"
582 if test \! -z "$includedir" ; then
583 CPPFLAGS="$CPPFLAGS -I$includedir"
585 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
586 AC_EGREP_HEADER([$1], [$2], [$3], [$4])
587 CPPFLAGS="$ac_save_CPPFLAGS"])
589 # Like AC_TRY_COMPILE, but it uses the already-computed -I directories.
591 AC_DEFUN(AC_TRY_X_COMPILE, [
592 ac_save_CPPFLAGS="$CPPFLAGS"
593 if test \! -z "$includedir" ; then
594 CPPFLAGS="$CPPFLAGS -I$includedir"
596 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
597 AC_TRY_COMPILE([$1], [$2], [$3], [$4])
598 CPPFLAGS="$ac_save_CPPFLAGS"])
601 # Like AC_CHECK_LIB, but it uses the already-computed -I and -L directories.
602 # Use this sparingly; it probably doesn't work very well on X programs.
604 AC_DEFUN(AC_CHECK_X_LIB, [
605 ac_save_CPPFLAGS="$CPPFLAGS"
606 ac_save_LDFLAGS="$LDFLAGS"
607 # ac_save_LIBS="$LIBS"
609 if test \! -z "$includedir" ; then
610 CPPFLAGS="$CPPFLAGS -I$includedir"
612 # note: $X_CFLAGS includes $x_includes
613 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
615 if test \! -z "$libdir" ; then
616 LDFLAGS="$LDFLAGS -L$libdir"
618 # note: $X_LIBS includes $x_libraries
619 LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS"
621 AC_CHECK_LIB([$1], [$2], [$3], [$4], [$5])
622 CPPFLAGS="$ac_save_CPPFLAGS"
623 LDFLAGS="$ac_save_LDFLAGS"
624 # LIBS="$ac_save_LIBS"
627 # Like AC_TRY_RUN, but it uses the already-computed -I directories.
628 # (But not the -L directories!)
630 AC_DEFUN(AC_TRY_X_RUN, [
631 ac_save_CPPFLAGS="$CPPFLAGS"
632 if test \! -z "$includedir" ; then
633 CPPFLAGS="$CPPFLAGS -I$includedir"
635 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
636 AC_TRY_RUN([$1], [$2], [$3], [$4])
637 CPPFLAGS="$ac_save_CPPFLAGS"])
641 # Usage: HANDLE_X_PATH_ARG([variable_name],
642 # [--command-line-option],
643 # [descriptive string])
645 # All of the --with options take three forms:
647 # --with-foo (or --with-foo=yes)
648 # --without-foo (or --with-foo=no)
651 # This function, HANDLE_X_PATH_ARG, deals with the /DIR case. When it sees
652 # a directory (string beginning with a slash) it checks to see whether
653 # /DIR/include and /DIR/lib exist, and adds them to $X_CFLAGS and $X_LIBS
656 AC_DEFUN(HANDLE_X_PATH_ARG, [
662 AC_MSG_CHECKING([for [$3] headers])
665 X_CFLAGS="-I$d $X_CFLAGS"
668 AC_MSG_RESULT(not found ($d: no such directory))
671 AC_MSG_CHECKING([for [$3] libs])
674 X_LIBS="-L$d $X_LIBS"
677 AC_MSG_RESULT(not found ($d: no such directory))
680 # replace the directory string with "yes".
687 echo "error: argument to [$2] must be \"yes\", \"no\", or a directory."
688 echo " If it is a directory, then \`DIR/include' will be added to"
689 echo " the -I list, and \`DIR/lib' will be added to the -L list."
697 ###############################################################################
698 ###############################################################################
700 # End of function definitions. Now start actually executing stuff.
702 ###############################################################################
703 ###############################################################################
705 # random compiler setup
708 AC_ESCHEW_REDHAT_GCC_LOSSAGE
714 # stuff for Makefiles
721 AC_CHECK_HEADERS(unistd.h)
730 AC_CHECK_FUNCS(select fcntl uname nice setpriority getcwd getwd putenv)
732 AC_CHECK_FUNCS(sigaction syslog realpath)
735 AC_CHECK_HEADERS(crypt.h sys/select.h)
738 if test -z "$PERL" ; then
739 # don't let it be blank...
740 PERL=/usr/local/bin/perl5
745 if test "$have_x" != yes; then
746 AC_MSG_ERROR(Couldn't find X11 headers/libs. Try \`$0 --help'.)
749 AC_PATH_X_APP_DEFAULTS
755 ###############################################################################
757 # Check for -lXmu (some fucked up vendors don't ship it...)
759 ###############################################################################
762 AC_CHECK_X_HEADER(X11/Xmu/Error.h, [have_xmu=yes])
763 if test "$have_xmu" = no ; then
764 XMU_SRCS='$(UTILS_SRC)/xmu.c'
765 XMU_OBJS='$(UTILS_BIN)/xmu.o'
769 SAVER_LIBS="-lXmu $SAVER_LIBS"
770 HACK_LIBS="-lXmu $HACK_LIBS"
771 MOTIF_LIBS="-lXmu $MOTIF_LIBS"
772 GTK_LIBS="-lXmu $GTK_LIBS"
777 ###############################################################################
779 # Check for the SunOS 4.1.x _get_wmShellWidgetClass bug.
780 # See comp.windows.x FAQ question 124. The right fix is to
781 # get OpenWindows 3.0 patches 100512-02 and 100573-03.
783 ###############################################################################
785 if test "$have_xmu" = yes ; then
788 AC_CACHE_CHECK([for the SunOS 4.1.x _get_wmShellWidgetClass bug],
790 [ac_save_LDFLAGS="$LDFLAGS"
791 if test \! -z "$x_libraries" ; then
792 LDFLAGS="$LDFLAGS -L$x_libraries"
794 # Note: this trick never works! (Generally.)
795 # We're only getting away with using AC_TRY_LINK
796 # with X libraries because we know it's SunOS.
797 LDFLAGS="$LDFLAGS -lXmu -lXt -lX11 -lXext -lm"
799 [ac_cv_sunos_xmu_bug=no],
800 [ac_cv_sunos_xmu_bug=yes])
801 LDFLAGS="$ac_save_LDFLAGS"])
802 if test "$ac_cv_sunos_xmu_bug" = yes ; then
803 AC_CACHE_CHECK([whether the compiler understands -static],
805 [ac_save_LDFLAGS="$LDFLAGS"
806 LDFLAGS="$LDFLAGS -static"
807 AC_TRY_LINK(,,[ac_cv_ld_static=yes],[ac_cv_ld_static=no])
808 LDFLAGS="$ac_save_LDFLAGS"])
809 if test "$ac_cv_ld_static" = yes ; then
810 LDFLAGS="$LDFLAGS -static"
812 LDFLAGS="$LDFLAGS -Bstatic"
820 ###############################################################################
822 # Handle the --enable-subdir option
824 ###############################################################################
826 AC_ARG_ENABLE(subdir,[
827 Installation options:
829 --enable-subdir=DIR Put the demo programs in a subdirectory of \`bindir',
830 instead of putting them in bindir itself. You can
831 specify the name of the subdirectory. For example,
832 \`--exec-prefix=/usr/local --enable-subdir=demos'
833 would put xscreensaver in /usr/local/bin/, and would
834 put the demos in /usr/local/bin/demos/. (If DIR
835 begins with /, then bindir will not be prepended.)
837 --disable-subdir Just put the demos in \`bindir' (this is the default.)
839 [enable_subdir="$enableval"],[enable_subdir=no])
840 if test x"$enable_subdir" = xno; then
842 elif test x"$enable_subdir" = xyes -o x"$enable_subdir" = x ; then
843 echo "error: must be a subdirectory name: --enable-subdir=$enable_subdir"
846 # there must be a better way than this...
847 if test -z "`echo $enable_subdir | sed 's@^/.*@@'`" ; then
849 HACKDIR=$enable_subdir
852 HACKDIR='${bindir}/'$enable_subdir
856 # canonicalize slashes.
857 HACKDIR=`echo "${HACKDIR}" | sed 's@/$@@;s@//*@/@g'`
860 ###############################################################################
862 # Check for the SGI SCREEN_SAVER server extension.
864 ###############################################################################
867 with_sgi_req=unspecified
869 [Except where noted, all of the --with options below can also take a
870 directory argument: for example, \`--with-motif=/opt/Motif'. That would
871 cause /opt/Motif/include/ to be added to the -I list, and /opt/Motif/lib/
872 to be added to the -L list, assuming those directories exist.
874 By default, support for each of these options will be built in, if the
875 relevant library routines exist. At run time, they will then be used
876 only if the X server being used supports them. Each --with option has
877 a corresponding --without option, to override building support for them
880 Screen blanking and idle-detection options:
882 --with-sgi-ext Include support for the SGI SCREEN_SAVER extension.],
883 [with_sgi="$withval"; with_sgi_req="$withval"],[with_sgi=yes])
885 HANDLE_X_PATH_ARG(with_sgi, --with-sgi-ext, SGI SCREEN_SAVER)
887 if test "$with_sgi" = yes; then
888 AC_CHECK_X_HEADER(X11/extensions/XScreenSaver.h,
890 AC_DEFINE(HAVE_SGI_SAVER_EXTENSION)])
892 elif test "$with_sgi" != no; then
893 echo "error: must be yes or no: --with-sgi-ext=$with_sgi"
898 ###############################################################################
900 # Check for the MIT-SCREEN-SAVER server extension.
902 ###############################################################################
905 with_mit_req=unspecified
907 [ --with-mit-ext Include support for the MIT-SCREEN-SAVER extension.],
908 [with_mit="$withval"; with_mit_req="$withval"],[with_mit=yes])
910 HANDLE_X_PATH_ARG(with_mit, --with-mit-ext, MIT-SCREEN-SAVER)
912 if test "$with_mit" = yes; then
913 AC_CHECK_X_HEADER(X11/extensions/scrnsaver.h, [have_mit=yes])
915 # Now check to see if it's really in the library; XF86Free-3.3 ships
916 # scrnsaver.h, but doesn't include the code in libXext.a, the idiots!
918 if test "$have_mit" = yes; then
919 AC_CHECK_X_LIB(Xext, XScreenSaverRegister, [true], [have_mit=no], -lm)
921 if test "$have_mit" = no; then
922 # Fuck! Looks like XF86Free-3.3 actually puts it in XExExt instead
923 # of in Xext. Thank you master, may I have another.
924 AC_CHECK_X_LIB(XExExt, XScreenSaverRegister,
925 [have_mit=yes; SAVER_LIBS="$SAVER_LIBS -lXExExt"],
926 [true], -lX11 -lXext -lm)
929 if test "$have_mit" = no; then
930 # Double fuck! Looks like some versions of XFree86 (whichever version
931 # it is that comes with RedHat Linux 2.0 -- I can't find a version
932 # number) put this garbage in Xss instead of Xext. Thank you master,
933 # may I have another.
934 AC_CHECK_X_LIB(Xss, XScreenSaverRegister,
935 [have_mit=yes; SAVER_LIBS="$SAVER_LIBS -lXss"],
936 [true], -lX11 -lXext -lm)
939 if test "$have_mit" = yes; then
940 AC_DEFINE(HAVE_MIT_SAVER_EXTENSION)
945 elif test "$with_mit" != no; then
946 echo "error: must be yes or no: --with-mit-ext=$with_mit"
951 ###############################################################################
953 # Check for the XIDLE server extension.
955 ###############################################################################
958 with_xidle_req=unspecified
959 AC_ARG_WITH(xidle-ext,
960 [ --with-xidle-ext Include support for the XIDLE extension.],
961 [with_xidle="$withval"; with_xidle_req="$withval"],[with_xidle=yes])
963 HANDLE_X_PATH_ARG(with_xidle, --with-xidle-ext, XIDLE)
965 if test "$with_xidle" = yes; then
966 AC_CHECK_X_HEADER(X11/extensions/xidle.h,
968 AC_DEFINE(HAVE_XIDLE_EXTENSION)])
969 elif test "$with_xidle" != no; then
970 echo "error: must be yes or no: --with-xidle-ext=$with_xidle"
975 ###############################################################################
977 # Check for the SGI-VIDEO-CONTROL server extension.
979 ###############################################################################
982 with_sgivc_req=unspecified
983 AC_ARG_WITH(sgivc-ext,
984 [ --with-sgivc-ext Include support for the SGI-VIDEO-CONTROL extension.],
985 [with_sgivc="$withval"; with_sgivc_req="$withval"],[with_sgivc=yes])
987 HANDLE_X_PATH_ARG(with_sgivc, --with-sgivc-ext, SGI-VIDEO-CONTROL)
989 if test "$with_sgivc" = yes; then
991 # first check for XSGIvc.h
992 AC_CHECK_X_HEADER(X11/extensions/XSGIvc.h, [have_sgivc=yes])
994 # if that succeeded, then check for the -lXsgivc
995 if test "$have_sgivc" = yes; then
997 AC_CHECK_X_LIB(Xsgivc, XSGIvcQueryGammaMap,
998 [have_sgivc=yes; SAVER_LIBS="$SAVER_LIBS -lXsgivc"], [true],
1002 # if that succeeded, then we've really got it.
1003 if test "$have_sgivc" = yes; then
1004 AC_DEFINE(HAVE_SGI_VC_EXTENSION)
1007 elif test "$with_sgivc" != no; then
1008 echo "error: must be yes or no: --with-sgivc-ext=$with_sgivc"
1013 ###############################################################################
1015 # Check for the DPMS server extension.
1017 ###############################################################################
1020 with_dpms_req=unspecified
1021 AC_ARG_WITH(dpms-ext,
1022 [ --with-dpms-ext Include support for the DPMS extension.],
1023 [with_dpms="$withval"; with_dpms_req="$withval"],[with_dpms=yes])
1025 HANDLE_X_PATH_ARG(with_dpms, --with-dpms-ext, DPMS)
1027 if test "$with_dpms" = yes; then
1029 # first check for dpms.h
1030 AC_CHECK_X_HEADER(X11/extensions/dpms.h, [have_dpms=yes])
1032 # if that succeeded, then check for the DPMS code in the libraries
1033 if test "$have_dpms" = yes; then
1035 # first look in -lXext (this is where it is with XFree86 4.0)
1037 AC_CHECK_X_LIB(Xext, DPMSInfo, [have_dpms=yes], [true], -lXext -lX11)
1039 # if that failed, look in -lXdpms (this is where it was in XFree86 3.x)
1040 if test "$have_dpms" = no; then
1041 AC_CHECK_X_LIB(Xdpms, DPMSInfo,
1042 [have_dpms=yes; SAVER_LIBS="$SAVER_LIBS -lXdpms"], [true],
1048 # if that succeeded, then we've really got it.
1049 if test "$have_dpms" = yes; then
1050 AC_DEFINE(HAVE_DPMS_EXTENSION)
1053 elif test "$with_dpms" != no; then
1054 echo "error: must be yes or no: --with-dpms-ext=$with_dpms"
1059 ###############################################################################
1061 # Check for the XF86VMODE server extension.
1063 ###############################################################################
1066 with_xf86vmode_req=unspecified
1067 AC_ARG_WITH(xf86vmode-ext,
1068 [ --with-xf86vmode-ext Include support for XFree86 virtual screens.],
1069 [with_xf86vmode="$withval"; with_xf86vmode_req="$withval"],
1070 [with_xf86vmode=yes])
1072 HANDLE_X_PATH_ARG(with_xf86vmode, --with-xf86vmode-ext, xf86vmode)
1074 if test "$with_xf86vmode" = yes; then
1076 # first check for xf86vmode.h
1077 AC_CHECK_X_HEADER(X11/extensions/xf86vmode.h, [have_xf86vmode=yes])
1079 # if that succeeded, then check for the -lXxf86vm
1080 if test "$have_xf86vmode" = yes; then
1082 AC_CHECK_X_LIB(Xxf86vm, XF86VidModeGetViewPort,
1083 [have_xf86vmode=yes; SAVER_LIBS="$SAVER_LIBS -lXxf86vm"],
1084 [true], -lXext -lX11)
1087 # if that succeeded, then we've really got it.
1088 if test "$have_xf86vmode" = yes; then
1089 AC_DEFINE(HAVE_XF86VMODE)
1092 elif test "$with_xf86vmode" != no; then
1093 echo "error: must be yes or no: --with-xf86vmode-ext=$with_xf86vmode"
1098 ###############################################################################
1100 # Check for HP XHPDisableReset and XHPEnableReset.
1102 ###############################################################################
1104 AC_EGREP_X_HEADER(XHPDisableReset, X11/XHPlib.h,
1105 [AC_DEFINE(HAVE_XHPDISABLERESET)
1106 SAVER_LIBS="-lXhp11 $SAVER_LIBS"])
1109 ###############################################################################
1111 # Check for /proc/interrupts.
1113 ###############################################################################
1115 have_proc_interrupts=no
1116 with_proc_interrupts_req=unspecified
1117 AC_ARG_WITH(proc-interrupts,
1118 [ --with-proc-interrupts Include support for consulting the /proc/interrupts
1119 file to notice keyboard activity.],
1120 [with_proc_interrupts="$withval"; with_proc_interrupts_req="$withval"],
1121 [with_proc_interrupts=yes])
1123 if test "$with_proc_interrupts" = yes; then
1125 AC_CACHE_CHECK([whether /proc/interrupts contains keyboard data],
1126 ac_cv_have_proc_interrupts,
1127 [ac_cv_have_proc_interrupts=no
1128 if grep keyboard /proc/interrupts >/dev/null 2>&1 ; then
1129 ac_cv_have_proc_interrupts=yes
1132 have_proc_interrupts=$ac_cv_have_proc_interrupts
1134 if test "$have_proc_interrupts" = yes; then
1135 AC_DEFINE(HAVE_PROC_INTERRUPTS)
1138 elif test "$with_proc_interrupts" != no; then
1139 echo "error: must be yes or no: --with-proc-interrupts=$with_proc_interrupts"
1144 ###############################################################################
1146 # The --enable-locking option
1148 ###############################################################################
1150 AC_ARG_ENABLE(locking,[
1151 Screen locking options:
1153 --enable-locking Compile in support for locking the display.
1154 --disable-locking Do not allow locking at all.
1156 [enable_locking="$enableval"],[enable_locking=yes])
1157 if test "$enable_locking" = yes; then
1159 elif test "$enable_locking" = no; then
1160 AC_DEFINE(NO_LOCKING)
1162 echo "error: must be yes or no: --enable-locking=$enable_locking"
1168 ###############################################################################
1170 # The --enable-vt-locking option
1172 ###############################################################################
1174 #ac_vt_lockswitch=no
1175 #AC_ARG_ENABLE(vt-locking,[
1176 # --enable-vt-locking Compile in support for locking Virtual Terminals.
1177 # This is the default if the system supports it, and
1178 # if locking support is included (--enable-locking.)
1179 # --disable-vt-locking Do not allow locking of VTs, even if locking is
1181 # [enable_vt_locking="$enableval"],[enable_vt_locking=yes])
1182 #if test "$enable_vt_locking" = yes; then
1184 # AC_CACHE_CHECK([for the VT_LOCKSWITCH ioctl], ac_cv_vt_lockswitch,
1185 # [AC_TRY_COMPILE([#include <fcntl.h>
1186 # #include <sys/ioctl.h>
1187 # #include <sys/vt.h>],
1188 # [int x = VT_LOCKSWITCH; int y = VT_UNLOCKSWITCH;],
1189 # [ac_cv_vt_lockswitch=yes],
1190 # [ac_cv_vt_lockswitch=no])])
1191 # ac_vt_lockswitch=$ac_cv_vt_lockswitch
1193 #elif test "$enable_vt_locking" = no; then
1196 # echo "error: must be yes or no: --enable-vt-locking=$enable_vt_locking"
1200 #if test "$ac_vt_lockswitch" = yes; then
1201 # AC_DEFINE(HAVE_VT_LOCKSWITCH)
1202 # # the VT_LOCKSWITCH ioctl can only be used when running as root.
1203 # # #### but it doesn't work yet, so don't worry about that for now.
1209 ###############################################################################
1213 ###############################################################################
1217 # Solaris systems tend to come with PAM misconfigured.
1218 # Don't build it by default, even if the headers exist.
1222 # Default to building PAM support on all other systems, if it exists.
1223 with_pam_default=yes
1228 with_pam_req=unspecified
1231 [ --with-pam Include support for PAM (Pluggable Auth Modules.)],
1232 [with_pam="$withval"; with_pam_req="$withval"],[with_pam=$with_pam_default])
1234 HANDLE_X_PATH_ARG(with_pam, --with-pam, PAM)
1236 if test "$enable_locking" = yes -a "$with_pam" = yes; then
1237 AC_CACHE_CHECK([for PAM], ac_cv_pam,
1238 [AC_TRY_X_COMPILE([#include <security/pam_appl.h>],,
1241 if test "$ac_cv_pam" = yes ; then
1244 PASSWD_LIBS="${PASSWD_LIBS} -lpam"
1246 # libpam typically requires dlopen and dlsym. On FreeBSD,
1247 # those are in libc. On Linux and Solaris, they're in libdl.
1248 AC_CHECK_LIB(dl, dlopen, [PASSWD_LIBS="${PASSWD_LIBS} -ldl"])
1250 AC_MSG_CHECKING(how to call pam_strerror)
1251 AC_CACHE_VAL(ac_cv_pam_strerror_args,
1252 [AC_TRY_COMPILE([#include <stdio.h>
1254 #include <security/pam_appl.h>],
1255 [pam_handle_t *pamh = 0;
1256 char *s = pam_strerror(pamh, PAM_SUCCESS);],
1257 [ac_pam_strerror_args=2],
1258 [AC_TRY_COMPILE([#include <stdio.h>
1260 #include <security/pam_appl.h>],
1262 pam_strerror(PAM_SUCCESS);],
1263 [ac_pam_strerror_args=1],
1264 [ac_pam_strerror_args=0])])
1265 ac_cv_pam_strerror_args=$ac_pam_strerror_args])
1266 ac_pam_strerror_args=$ac_cv_pam_strerror_args
1267 if test "$ac_pam_strerror_args" = 1 ; then
1268 AC_MSG_RESULT(one argument)
1269 elif test "$ac_pam_strerror_args" = 2 ; then
1270 AC_DEFINE(PAM_STRERROR_TWO_ARGS)
1271 AC_MSG_RESULT(two arguments)
1273 AC_MSG_RESULT(unknown)
1279 ###############################################################################
1281 # Check for Kerberos.
1283 ###############################################################################
1287 with_kerberos_req=unspecified
1289 AC_ARG_WITH(kerberos,
1290 [ --with-kerberos Include support for Kerberos authentication.],
1291 [with_kerberos="$withval"; with_kerberos_req="$withval"],[with_kerberos=yes])
1293 HANDLE_X_PATH_ARG(with_kerberos, --with-kerberos, Kerberos)
1295 if test "$enable_locking" = yes -a "$with_kerberos" = yes; then
1296 AC_CACHE_CHECK([for Kerberos 4], ac_cv_kerberos,
1297 [AC_TRY_X_COMPILE([#include <krb.h>],,
1298 [ac_cv_kerberos=yes],
1299 [ac_cv_kerberos=no])])
1300 AC_CACHE_CHECK([for Kerberos 5], ac_cv_kerberos5,
1301 [AC_TRY_X_COMPILE([#include <kerberosIV/krb.h>],,
1302 [ac_cv_kerberos5=yes],
1303 [ac_cv_kerberos5=no])])
1305 if test "$ac_cv_kerberos" = yes ; then
1307 AC_DEFINE(HAVE_KERBEROS)
1310 if test "$ac_cv_kerberos5" = yes ; then
1313 AC_DEFINE(HAVE_KERBEROS)
1314 AC_DEFINE(HAVE_KERBEROS5)
1317 if test "$have_kerberos5" = yes ; then
1318 # from Matt Knopp <mhat@infocalypse.netlag.com>
1319 # (who got it from amu@mit.edu)
1320 PASSWD_LIBS="$PASSWD_LIBS -lkrb4 -ldes425 -lkrb5 -lk5crypto -lcrypt -lcom_err"
1321 elif test "$have_kerberos" = yes ; then
1322 # from Tim Showalter <tjs+@andrew.cmu.edu>
1323 PASSWD_LIBS="$PASSWD_LIBS -lkrb -ldes"
1326 if test "$have_kerberos" = yes ; then
1327 AC_CHECK_FUNC(res_search,,
1328 AC_CHECK_LIB(resolv,res_search,PASSWD_LIBS="${PASSWD_LIBS} -lresolv",
1329 AC_MSG_WARN([Can't find DNS resolver libraries needed for Kerberos])
1335 ###############################################################################
1337 # Check for the nine billion variants of shadow passwords...
1339 ###############################################################################
1344 with_shadow_req=unspecified
1347 [ --with-shadow Include support for shadow password authentication.],
1348 [with_shadow="$withval"; with_shadow_req="$withval"],[with_shadow=yes])
1350 HANDLE_X_PATH_ARG(with_shadow, --with-shadow, shadow password)
1352 if test "$enable_locking" = no ; then
1358 ###############################################################################
1360 # Check for Sun "adjunct" passwords.
1362 ###############################################################################
1364 if test "$with_shadow" = yes ; then
1365 AC_CACHE_CHECK([for Sun-style shadow passwords], ac_cv_sun_adjunct,
1366 [AC_TRY_X_COMPILE([#include <stdlib.h>
1368 #include <sys/types.h>
1369 #include <sys/label.h>
1370 #include <sys/audit.h>
1371 #include <pwdadj.h>],
1372 [struct passwd_adjunct *p = getpwanam("nobody");
1373 const char *pw = p->pwa_passwd;],
1374 [ac_cv_sun_adjunct=yes],
1375 [ac_cv_sun_adjunct=no])])
1376 if test "$ac_cv_sun_adjunct" = yes; then
1377 have_shadow_adjunct=yes
1384 ###############################################################################
1386 # Check for DEC and SCO so-called "enhanced" security.
1388 ###############################################################################
1390 if test "$with_shadow" = yes ; then
1391 AC_CACHE_CHECK([for DEC-style shadow passwords], ac_cv_enhanced_passwd,
1392 [AC_TRY_X_COMPILE([#include <stdlib.h>
1394 #include <sys/types.h>
1396 #include <sys/security.h>
1398 [struct pr_passwd *p;
1400 set_auth_parameters(0, 0);
1401 check_auth_parameters();
1402 p = getprpwnam("nobody");
1403 pw = p->ufld.fd_encrypt;],
1404 [ac_cv_enhanced_passwd=yes],
1405 [ac_cv_enhanced_passwd=no])])
1406 if test $ac_cv_enhanced_passwd = yes; then
1407 have_shadow_enhanced=yes
1411 # On SCO, getprpwnam() is in -lprot (which uses nap() from -lx)
1412 # (I'm told it needs -lcurses too, but I don't understand why.)
1413 # But on DEC, it's in -lsecurity.
1415 AC_CHECK_LIB(prot, getprpwnam,
1416 [PASSWD_LIBS="$PASSWD_LIBS -lprot -lcurses -lx"],
1417 [AC_CHECK_LIB(security, getprpwnam,
1418 [PASSWD_LIBS="$PASSWD_LIBS -lsecurity"])],
1423 ###############################################################################
1425 # Check for HP's entry in the "Not Invented Here" Sweepstakes.
1427 ###############################################################################
1429 if test "$with_shadow" = yes ; then
1430 AC_CACHE_CHECK([for HP-style shadow passwords], ac_cv_hpux_passwd,
1431 [AC_TRY_X_COMPILE([#include <stdlib.h>
1433 #include <sys/types.h>
1435 #include <hpsecurity.h>
1437 [struct s_passwd *p = getspwnam("nobody");
1438 const char *pw = p->pw_passwd;],
1439 [ac_cv_hpux_passwd=yes],
1440 [ac_cv_hpux_passwd=no])])
1441 if test "$ac_cv_hpux_passwd" = yes; then
1442 have_shadow_hpux=yes
1446 # on HPUX, bigcrypt is in -lsec
1447 AC_CHECK_LIB(sec, bigcrypt, [PASSWD_LIBS="$PASSWD_LIBS -lsec"])
1452 ###############################################################################
1454 # Check for FreeBSD-style shadow passwords.
1456 # On FreeBSD, getpwnam() and friends work just like on non-shadow-
1457 # password systems -- except you only get stuff in the pw_passwd field
1458 # if the running program is setuid. So, guess that we've got this
1459 # lossage to contend with if /etc/master.passwd exists, and default to
1460 # a setuid installation.
1462 ###############################################################################
1464 if test "$with_shadow" = yes ; then
1465 AC_CACHE_CHECK([for FreeBSD-style shadow passwords], ac_cv_master_passwd,
1466 [if test -f /etc/master.passwd ; then
1467 ac_cv_master_passwd=yes
1469 ac_cv_master_passwd=no
1471 if test "$ac_cv_master_passwd" = yes; then
1477 ###############################################################################
1479 # Check for traditional (ha!) shadow passwords.
1481 ###############################################################################
1483 if test "$with_shadow" = yes ; then
1484 AC_CACHE_CHECK([for generic shadow passwords], ac_cv_shadow,
1485 [AC_TRY_X_COMPILE([#include <stdlib.h>
1487 #include <sys/types.h>
1489 #include <shadow.h>],
1490 [struct spwd *p = getspnam("nobody");
1491 const char *pw = p->sp_pwdp;],
1493 [ac_cv_shadow=no])])
1494 if test "$ac_cv_shadow" = yes; then
1498 # On some systems (UnixWare 2.1), getspnam() is in -lgen instead of -lc.
1500 AC_CHECK_LIB(c, getspnam, [have_getspnam=yes])
1501 if test "$have_getspnam" = no ; then
1502 AC_CHECK_LIB(gen, getspnam,
1503 [have_getspnam=yes; PASSWD_LIBS="$PASSWD_LIBS -lgen"])
1509 ###############################################################################
1511 # Check for other libraries needed for non-shadow passwords.
1513 ###############################################################################
1515 if test "$enable_locking" = yes ; then
1517 # On some systems (UnixWare 2.1), crypt() is in -lcrypt instead of -lc.
1519 AC_CHECK_LIB(c, crypt, [have_crypt=yes])
1520 if test "$have_crypt" = no ; then
1521 AC_CHECK_LIB(crypt, crypt,
1522 [have_crypt=yes; PASSWD_LIBS="$PASSWD_LIBS -lcrypt"])
1527 # Most of the above shadow mechanisms will have set need_setuid to yes,
1528 # if they were found. But, on some systems, we need setuid even when
1529 # using plain old vanilla passwords.
1531 if test "$enable_locking" = yes ; then
1533 *-hpux* | *-aix* | *-netbsd* | *-freebsd* | *-openbsd* )
1540 if test "$have_shadow_adjunct" = yes ; then
1541 AC_DEFINE(HAVE_ADJUNCT_PASSWD)
1542 elif test "$have_shadow_enhanced" = yes ; then
1543 AC_DEFINE(HAVE_ENHANCED_PASSWD)
1544 elif test "$have_shadow_hpux" = yes ; then
1545 AC_DEFINE(HAVE_HPUX_PASSWD)
1546 elif test "$have_shadow" = yes ; then
1547 AC_DEFINE(HAVE_SHADOW_PASSWD)
1551 ###############################################################################
1555 ###############################################################################
1558 with_motif_req=unspecified
1560 User interface options:
1562 --with-motif Use the Motif toolkit for the user interface.],
1563 [with_motif="$withval"; with_motif_req="$withval"],[with_motif=yes])
1565 HANDLE_X_PATH_ARG(with_motif, --with-motif, Motif)
1567 if test "$with_motif" != yes -a "$with_motif" != no ; then
1568 echo "error: must be yes or no: --with-motif=$with_motif"
1572 if test "$with_motif" = yes; then
1574 AC_CHECK_X_HEADER(Xm/Xm.h,
1576 AC_DEFINE(HAVE_MOTIF)
1577 MOTIF_LIBS="$MOTIF_LIBS -lXm"])
1581 if test "$have_motif" = yes; then
1582 AC_CHECK_X_HEADER(Xm/ComboBox.h, [AC_DEFINE(HAVE_XMCOMBOBOX)])
1586 ###############################################################################
1588 # Check for -lgtk (and Gnome stuff)
1590 ###############################################################################
1593 with_gtk_req=unspecified
1595 [ --with-gtk Use the Gtk toolkit for the user interface.],
1596 [with_gtk="$withval"; with_gtk_req="$withval"],[with_gtk=yes])
1598 # if --with-gtk=/directory/ was specified, remember that directory so that
1599 # we can also look for the `gtk-config' program in that directory.
1609 HANDLE_X_PATH_ARG(with_gtk, --with-gtk, Gtk)
1611 if test "$with_gtk" != yes -a "$with_gtk" != no ; then
1612 echo "error: must be yes or no: --with-gtk=$with_gtk"
1617 with_gnome_req=unspecified
1619 [ --with-gnome Include support for the Gnome Control Center.],
1620 [with_gnome="$withval"; with_gnome_req="$withval"],[with_gnome=yes])
1622 # if --with-gnome=/directory/ was specified, remember that directory so that
1623 # we can also look for the `gnome-config' program in that directory.
1624 case "$with_gnome" in
1626 gnome_dir="$with_gnome"
1633 HANDLE_X_PATH_ARG(with_gnome, --with-gnome, Gnome)
1635 if test "$with_gnome" != yes -a "$with_gnome" != no ; then
1636 echo "error: must be yes or no: --with-gnome=$with_gnome"
1642 if test "$with_gtk" = yes; then
1645 # if the user specified --with-gtk=/foo/ then look in /foo/bin/
1646 # for glib-config and gtk-config.
1650 if test ! -z "$gtk_dir"; then
1651 # canonicalize slashes.
1652 gtk_dir=`echo "${gtk_dir}/bin" | sed 's@//*@/@g'`
1653 gtk_path="$gtk_dir:$gtk_path"
1656 if test ! -z "gnome_dir"; then
1657 # canonicalize slashes.
1658 gnome_dir=`echo "${gnome_dir}/bin" | sed 's@//*@/@g'`
1659 gtk_path="$gnome_dir:$gtk_path"
1662 AC_PATH_PROGS(glib_config, glib12-config glib-config,, $gtk_path)
1663 AC_PATH_PROGS(gtk_config, gtk12-config gtk-config,, $gtk_path)
1665 if test "$with_gnome" = yes; then
1666 AC_PATH_PROGS(gnome_config, gnome-config,, $gtk_path)
1669 if test -n "$glib_config" -a -n "gtk_config" ; then
1671 if test "$with_gnome" = yes -a -n "$gnome_config" ; then
1676 if test "$have_gtk" = yes; then
1677 AC_CACHE_CHECK([Gtk version number], ac_cv_gtk_version_string,
1678 [ac_cv_gtk_version_string=`$gtk_config --version`])
1679 ac_gtk_version_string=$ac_cv_gtk_version_string
1682 maj=`echo $ac_gtk_version_string | sed -n 's/\..*//p'`
1683 min=`echo $ac_gtk_version_string | sed -n 's/[^.]*\.\([^.]*\).*/\1/p'`
1685 ac_gtk_version=`echo "$maj * 1000 + $min" | bc`
1686 if test -z "$ac_gtk_version"; then
1687 ac_gtk_version=unknown
1688 ac_gtk_version_string=unknown
1690 if test "$ac_gtk_version" = "unknown" || test "$ac_gtk_version" -lt 1002
1698 if test "$have_gtk" = yes; then
1699 AC_CACHE_CHECK([for Gtk includes], ac_cv_gtk_config_cflags,
1700 [ac_cv_gtk_config_cflags=`$gtk_config --cflags`])
1701 AC_CACHE_CHECK([for Gtk libs], ac_cv_gtk_config_libs,
1702 [ac_cv_gtk_config_libs=`$gtk_config --libs`])
1704 ac_gtk_config_cflags=$ac_cv_gtk_config_cflags
1705 ac_gtk_config_libs=$ac_cv_gtk_config_libs
1707 # Check for Gnome Capplet support.
1709 if test "$have_gnome" = yes -a "$have_gtk" = yes; then
1710 gnome_config_libs="capplet gnomeui"
1711 AC_MSG_CHECKING(for Gnome capplet includes)
1712 AC_CACHE_VAL(ac_cv_gnome_config_cflags,
1713 [if ( $gnome_config --cflags $gnome_config_libs 2>&1 >/dev/null | \
1714 grep Unknown >/dev/null ) ; then
1715 ac_cv_gnome_config_cflags=''
1717 ac_cv_gnome_config_cflags=`$gnome_config --cflags $gnome_config_libs`
1719 ac_gnome_config_cflags=$ac_cv_gnome_config_cflags
1720 if test "$ac_gnome_config_cflags" = "" ; then
1724 AC_MSG_RESULT($ac_gnome_config_cflags)
1728 if test "$have_gnome" = yes -a "$have_gtk" = yes; then
1729 AC_MSG_CHECKING(for Gnome capplet libs)
1730 AC_CACHE_VAL(ac_cv_gnome_config_libs,
1731 [if ( $gnome_config --libs $gnome_config_libs 2>&1 >/dev/null |
1732 grep Unknown >/dev/null ) ; then
1733 ac_cv_gnome_config_libs=''
1735 ac_cv_gnome_config_libs=`$gnome_config --libs $gnome_config_libs`
1737 ac_gnome_config_libs=$ac_cv_gnome_config_libs
1738 if test "$ac_gnome_config_libs" = "" ; then
1742 AC_MSG_RESULT($ac_gnome_config_libs)
1747 if test "$have_gnome" = yes -a "$have_gtk" = yes; then
1748 GNOME_DATADIR=`$gnome_config --datadir`
1752 # If we have Gnome, then override the gtk-config values with
1753 # the gnome-config values.
1755 if test "$have_gnome" = yes -a "$have_gtk" = yes; then
1756 ac_gtk_config_cflags=$ac_gnome_config_cflags
1757 ac_gtk_config_libs=$ac_gnome_config_libs
1758 AC_DEFINE(HAVE_CRAPPLET)
1762 if test "$have_gtk" = yes; then
1763 INCLUDES="$INCLUDES $ac_gtk_config_cflags"
1764 GTK_LIBS="$GTK_LIBS $ac_gtk_config_libs"
1771 ###############################################################################
1773 # Checking whether Motif is really Lesstif.
1775 ###############################################################################
1778 if test "$have_motif" = yes ; then
1779 AC_CACHE_CHECK([whether Motif is really LessTif],
1781 [AC_TRY_X_COMPILE([#include <Xm/Xm.h>],
1782 [long vers = LesstifVersion;],
1783 [ac_cv_have_lesstif=yes],
1784 [ac_cv_have_lesstif=no])])
1785 have_lesstif=$ac_cv_have_lesstif
1789 lesstif_version=unknown
1790 lesstif_version_string=unknown
1792 if test "$have_lesstif" = yes ; then
1794 echo unknown > conftest-lt
1795 AC_CACHE_CHECK([LessTif version number],
1796 ac_cv_lesstif_version_string,
1797 [AC_TRY_X_RUN([#include <stdio.h>
1800 FILE *f = fopen("conftest-lt", "w");
1802 fprintf(f, "%d %d.%d\n", LesstifVersion,
1803 LESSTIF_VERSION, LESSTIF_REVISION);
1807 [ltv=`cat conftest-lt`
1808 ac_cv_lesstif_version=`echo $ltv | sed 's/ .*//'`
1809 ac_cv_lesstif_version_string=`echo $ltv | sed 's/.* //'`],
1810 [ac_cv_lesstif_version=unknown
1811 ac_cv_lesstif_version_string=unknown],
1812 [ac_cv_lesstif_version=unknown
1813 ac_cv_lesstif_version_string=unknown])])
1815 lesstif_version=$ac_cv_lesstif_version
1816 lesstif_version_string=$ac_cv_lesstif_version_string
1821 if test "$have_motif" = yes ; then
1823 echo unknown > conftest-mt
1824 AC_CACHE_CHECK([Motif version number],
1825 ac_cv_motif_version_string,
1826 [AC_TRY_X_RUN([#include <stdio.h>
1829 FILE *f = fopen("conftest-mt", "w");
1831 fprintf(f, "%d %d.%d\n", XmVersion,
1832 XmVERSION, XmREVISION);
1836 [mtv=`cat conftest-mt`
1837 ac_cv_motif_version=`echo $mtv | sed 's/ .*//'`
1838 ac_cv_motif_version_string=`echo $mtv | sed 's/.* //'`],
1839 [ac_cv_motif_version=unknown
1840 ac_cv_motif_version_string=unknown],
1841 [ac_cv_motif_version=unknown
1842 ac_cv_motif_version_string=unknown])])
1844 motif_version=$ac_cv_motif_version
1845 motif_version_string=$ac_cv_motif_version_string
1850 ###############################################################################
1852 # Checking whether Motif requires -lXpm.
1854 # If this is Motif 2.x, and we have XPM, then link against XPM as well.
1855 # The deal is, Motif 2.x requires XPM -- but it's a compilation option
1856 # of the library whether to build the XPM code into libXm, or whether
1857 # to rely on an external libXm. So the only way to tell whether XPM is
1858 # a link-time requirement is to examine libXm.a, which is very
1859 # difficult to do in an autoconf script. So... if it's Motif 2.x, we
1860 # always link against XPM if the XPM lib exists (and this will be a
1861 # no-op if libXm happens to already have the XPM code in it.)
1863 ###############################################################################
1865 motif_requires_xpm=no
1866 if test "$have_motif" = yes ; then
1867 AC_MSG_CHECKING(whether Motif requires XPM)
1868 if test "$motif_version" = "unknown" || test "$motif_version" -ge 2000
1870 motif_requires_xpm=yes
1871 AC_MSG_RESULT(maybe)
1878 ###############################################################################
1880 # Checking whether Motif requires -lXp.
1882 # Some versions of Motif (2.1.0, at least) require -lXp, the "X Printing
1883 # Extension". Why this extension isn't in -lXext with all the others,
1886 ###############################################################################
1889 if test "$have_motif" = yes ; then
1891 AC_CHECK_X_LIB(Xp, XpQueryExtension,
1892 [have_xp_ext=yes; MOTIF_LIBS="$MOTIF_LIBS -lXp"],
1893 [true], -lX11 -lXext -lm)
1897 ###############################################################################
1899 # Checking whether Motif requires -lXintl (for _Xsetlocale.)
1901 ###############################################################################
1904 if test "$have_motif" = yes ; then
1905 AC_CHECK_X_LIB(Xintl, _Xsetlocale, [have_xintl=yes], [have_xintl=no],
1907 if test "$have_xintl" = yes; then
1908 MOTIF_LIBS="$MOTIF_LIBS -lXintl"
1913 ###############################################################################
1915 # Check for -lGL or -lMesaGL.
1917 ###############################################################################
1921 with_gl_req=unspecified
1926 --with-gl Build those demos which depend on OpenGL.],
1927 [with_gl="$withval"; with_gl_req="$withval"],[with_gl=yes])
1929 HANDLE_X_PATH_ARG(with_gl, --with-gl, GL)
1931 ac_mesagl_version=unknown
1932 ac_mesagl_version_string=unknown
1934 if test "$with_gl" = yes; then
1935 AC_CHECK_X_HEADER(GL/gl.h, have_gl=yes, have_gl=no)
1936 if test "$have_gl" = yes ; then
1937 AC_CHECK_X_HEADER(GL/glx.h, have_gl=yes, have_gl=no)
1940 # If we have the headers, try and figure out which vendor it's from.
1942 if test "$have_gl" = yes ; then
1944 # We need to know whether it's MesaGL so that we know which libraries
1947 AC_CACHE_CHECK([whether GL is really MesaGL], ac_cv_have_mesa_gl,
1948 [ac_cv_have_mesa_gl=no
1949 AC_EGREP_X_HEADER(Mesa, GL/glx.h, [ac_cv_have_mesa_gl=yes])
1951 ac_have_mesa_gl=$ac_cv_have_mesa_gl
1958 # Some versions of MesaGL are compiled to require -lpthread.
1959 # So if the Mesa headers exist, and -lpthread exists, then always
1960 # link -lpthread after the Mesa libs (be they named -lGL or -lMesaGL.)
1962 if test "$ac_have_mesa_gl" = yes; then
1963 AC_CHECK_LIB(pthread, pthread_create, [GL_LIBS="-lpthread"], [],)
1967 # If we have Mesa headers, check to see if we can link against -lMesaGL.
1968 # If we don't have Mesa headers, or we don't have -lMesaGL, try -lGL.
1969 # Else, warn that GL is busted. (We have the headers, but no libs.)
1972 if test "$ac_have_mesa_gl" = yes ; then
1973 AC_CHECK_X_LIB(MesaGL, glXCreateContext,
1975 GL_LIBS="-lMesaGL -lMesaGLU $GL_LIBS"],
1976 [], -lMesaGLU $GL_LIBS -lX11 -lXext -lm)
1979 if test "$gl_lib_1" = "" ; then
1980 AC_CHECK_X_LIB(GL, glXCreateContext,
1982 GL_LIBS="-lGL -lGLU $GL_LIBS"],
1983 [], -lGLU $GL_LIBS -lX11 -lXext -lm)
1986 if test "$gl_lib_1" = "" ; then
1987 # we have headers, but no libs -- bail.
1992 # linking works -- we can build the GL hacks.
1994 if test "$ac_have_mesa_gl" = yes ; then
1995 AC_DEFINE(HAVE_MESA_GL)
2001 # Now that we know we have GL headers and libs, do some more GL testing.
2004 if test "$have_gl" = yes ; then
2005 # If it's MesaGL, we'd like to issue a warning if the version number
2006 # is less than or equal to 2.6, because that version had a security bug.
2008 if test "$ac_have_mesa_gl" = yes; then
2010 AC_CACHE_CHECK([MesaGL version number], ac_cv_mesagl_version_string,
2011 [cat > conftest.$ac_ext <<EOF
2012 #line __oline__ "configure"
2013 #include "confdefs.h"
2015 configure: MESA_MAJOR_VERSION MESA_MINOR_VERSION
2018 ac_save_CPPFLAGS="$CPPFLAGS"
2019 if test \! -z "$includedir" ; then
2020 CPPFLAGS="$CPPFLAGS -I$includedir"
2022 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
2026 mglv=`(eval "$ac_cpp conftest.$ac_ext") 2>&AC_FD_CC | sed -n \
2027 's/^configure:.*\([0-9][0-9]*\).*\([0-9][0-9]*\).*$/\1.\2/p'`
2030 rm -f conftest.$ac_ext
2032 CPPFLAGS="$ac_save_CPPFLAGS"
2034 if test "$mglv" = ""; then
2035 ac_mesagl_version=unknown
2036 ac_mesagl_version_string=unknown
2038 ac_mesagl_version_string=$mglv
2039 maj=`echo $mglv | sed -n 's/\..*//p'`
2040 min=`echo $mglv | sed -n 's/.*\.//p'`
2041 ac_mesagl_version=`echo "$maj * 1000 + $min" | bc`
2042 if test -z "$ac_mesagl_version"; then
2043 ac_mesagl_version=unknown
2044 ac_mesagl_version_string=unknown
2047 ac_cv_mesagl_version=$ac_mesagl_version
2048 ac_cv_mesagl_version_string=$ac_mesagl_version_string
2050 ac_mesagl_version=$ac_cv_mesagl_version
2051 ac_mesagl_version_string=$ac_cv_mesagl_version_string
2055 # Check for OpenGL 1.1 features.
2057 AC_CHECK_X_LIB($gl_lib_1, glBindTexture, [AC_DEFINE(HAVE_GLBINDTEXTURE)],
2058 [true], $GL_LIBS -lX11 -lXext -lm)
2061 elif test "$with_gl" != no; then
2062 echo "error: must be yes or no: --with-gl=$with_gl"
2067 ###############################################################################
2071 ###############################################################################
2074 with_gle_req=unspecified
2077 [ --with-gle Build those demos which depend on GLE
2078 (the OpenGL "extrusion" library.)],
2079 [with_gle="$withval"; with_gle_req="$withval"],[with_gle=yes])
2081 HANDLE_X_PATH_ARG(with_gle, --with-gle, GLE)
2085 if test "$with_gle" = yes; then
2087 AC_CHECK_X_HEADER(GL/gle.h, have_gle3=yes, have_gle3=no)
2088 if test "$have_gle3" = yes ; then
2091 AC_CHECK_X_HEADER(GL/gutil.h, have_gle=yes, have_gle=no)
2092 if test "$have_gle" = yes ; then
2093 AC_CHECK_X_HEADER(GL/tube.h, have_gle=yes, have_gle=no)
2097 if test "$have_gle" = yes ; then
2100 AC_CHECK_X_LIB(gle, gleCreateGC,
2101 [have_gle=yes; gle_halfassed=no; GLE_LIBS="-lgle"],
2102 [], $GL_LIBS -lX11 -lXext -lm)
2104 if test "$have_gle" = yes ; then
2108 # sometimes the libmatrix stuff is included in libgle. look there first.
2110 # I don't get it. For some reason, this test passes on SGI, as if
2111 # uview_direction_d() was in libgle -- but it's not, it's in libmatrix.
2112 # Yet the link is succeeding. Why???
2114 # AC_CHECK_X_LIB(gle, uview_direction_d,
2115 # [have_gle=yes; gle_halfassed=no],
2116 # [], $GL_LIBS -lX11 -lXext -lm)
2118 # As of GLE 3 this is in libgle, and has changed name to uview_direction!
2120 if test "$have_gle3" = yes ; then
2121 AC_CHECK_X_LIB(gle, uview_direction,
2122 [have_gle=yes; gle_halfassed=no],
2123 [], $GL_LIBS -lX11 -lXext -lm)
2125 # if it wasn't in libgle, then look in libmatrix.
2126 if test "$have_gle" = no ; then
2127 AC_CHECK_X_LIB(matrix, uview_direction_d,
2128 [have_gle=yes; gle_halfassed=no;
2129 GLE_LIBS="$GLE_LIBS -lmatrix"],
2130 [], $GL_LIBS -lX11 -lXext -lm)
2134 if test "$have_gle" = yes ; then
2136 if test "$have_gle3" = yes ; then
2137 AC_DEFINE(HAVE_GLE3)
2141 elif test "$with_gle" != no; then
2142 echo "error: must be yes or no: --with-gle=$with_gle"
2149 ###############################################################################
2153 ###############################################################################
2156 with_xpm_req=unspecified
2158 [ --with-xpm Include support for XPM files in some demos.],
2159 [with_xpm="$withval"; with_xpm_req="$withval"],[with_xpm=yes])
2161 HANDLE_X_PATH_ARG(with_xpm, --with-xpm, XPM)
2163 if test "$with_xpm" = yes; then
2164 AC_CHECK_X_HEADER(X11/xpm.h,
2168 elif test "$with_xpm" != no; then
2169 echo "error: must be yes or no: --with-xpm=$with_xpm"
2173 # See comment near $motif_requires_xpm, above.
2174 # Need to do this here, after both Motif and XPM have been checked for.
2176 if test "$have_motif" = yes -a "$have_xpm" = yes ; then
2177 if test "$motif_requires_xpm" = yes ; then
2178 MOTIF_LIBS="$MOTIF_LIBS $XPM_LIBS"
2183 ###############################################################################
2185 # Check for the XSHM server extension.
2187 ###############################################################################
2190 with_xshm_req=unspecified
2191 AC_ARG_WITH(xshm-ext,
2192 [ --with-xshm-ext Include support for the XSHM extension.],
2193 [with_xshm="$withval"; with_xshm_req="$withval"],[with_xshm=yes])
2195 HANDLE_X_PATH_ARG(with_xshm, --with-xshm-ext, XSHM)
2197 if test "$with_xshm" = yes; then
2199 # first check for Xshm.h.
2200 AC_CHECK_X_HEADER(X11/extensions/XShm.h, [have_xshm=yes])
2202 # if that succeeded, then check for sys/ipc.h.
2203 if test "$have_xshm" = yes; then
2205 AC_CHECK_X_HEADER(sys/ipc.h, [have_xshm=yes])
2208 # if that succeeded, then check for sys/shm.h.
2209 if test "$have_xshm" = yes; then
2211 AC_CHECK_X_HEADER(sys/shm.h, [have_xshm=yes])
2214 # AIX is pathological, as usual: apparently it's normal for the Xshm headers
2215 # to exist, but the library code to not exist. And even better, the library
2216 # code is in its own library: libXextSam.a. So, if we're on AIX, and that
2217 # lib doesn't exist, give up. (This lib gets added to X_EXTRA_LIBS, and
2218 # that's not quite right, but close enough.)
2222 if [ `uname -v` -eq 3 ]; then
2224 AC_CHECK_X_LIB(XextSam, XShmQueryExtension,
2225 [have_xshm=yes; X_EXTRA_LIBS="$X_EXTRA_LIBS -lXextSam"],
2226 [true], -lX11 -lXext -lm)
2231 # if that succeeded, then we've really got it.
2232 if test "$have_xshm" = yes; then
2233 AC_DEFINE(HAVE_XSHM_EXTENSION)
2236 elif test "$with_xshm" != no; then
2237 echo "error: must be yes or no: --with-xshm-ext=$with_xshm"
2242 ###############################################################################
2244 # Check for the DOUBLE-BUFFER server extension.
2246 ###############################################################################
2249 with_xdbe_req=unspecified
2250 AC_ARG_WITH(xdbe-ext,
2251 [ --with-xdbe-ext Include support for the DOUBLE-BUFFER extension.],
2252 [with_xdbe="$withval"; with_xdbe_req="$withval"],[with_xdbe=yes])
2254 HANDLE_X_PATH_ARG(with_xdbe, --with-xdbe-ext, DOUBLE-BUFFER)
2256 if test "$with_xdbe" = yes; then
2258 AC_CHECK_X_HEADER(X11/extensions/Xdbe.h, [have_xdbe=yes])
2259 if test "$have_xdbe" = yes; then
2260 AC_DEFINE(HAVE_DOUBLE_BUFFER_EXTENSION)
2263 elif test "$with_xdbe" != no; then
2264 echo "error: must be yes or no: --with-xdbe-ext=$with_xshm"
2269 ###############################################################################
2271 # Check for the SGI XReadDisplay server extension.
2273 # Note: this has to be down here, rather than up with the other server
2274 # extension tests, so that the output of `configure --help' is in the
2275 # right order. Arrgh!
2277 ###############################################################################
2280 with_readdisplay_req=unspecified
2281 AC_ARG_WITH(readdisplay,
2282 [ --with-readdisplay Include support for the XReadDisplay extension.],
2283 [with_readdisplay="$withval"; with_readdisplay_req="$withval"],
2284 [with_readdisplay=yes])
2286 HANDLE_X_PATH_ARG(with_readdisplay, --with-readdisplay, XReadDisplay)
2288 if test "$with_readdisplay" = yes; then
2289 AC_CHECK_X_HEADER(X11/extensions/readdisplay.h,
2290 AC_DEFINE(HAVE_READ_DISPLAY_EXTENSION))
2291 elif test "$with_readdisplay" != no; then
2292 echo "error: must be yes or no: --with-readdisplay=$with_readdisplay"
2297 ###############################################################################
2299 # Check for the SGI Iris Video Library.
2301 ###############################################################################
2304 with_sgivideo_req=unspecified
2305 AC_ARG_WITH(sgivideo,
2306 [ --with-sgivideo Include support for SGI's Iris Video Library.],
2307 [with_sgivideo="$withval"; with_sgivideo_req="$withval"],
2308 [with_sgivideo=yes])
2310 HANDLE_X_PATH_ARG(with_sgivideo, --with-sgivideo, Iris Video)
2312 if test "$with_sgivideo" = yes; then
2313 AC_CHECK_X_HEADER(dmedia/vl.h, have_sgivideo=yes)
2314 if test "$have_sgivideo" = yes; then
2316 AC_CHECK_LIB(vl, vlOpenVideo, [have_sgivideo=yes])
2317 if test "$have_sgivideo" = yes; then
2318 SGI_VIDEO_OBJS="$(UTILS_BIN)/sgivideo.o"
2319 SGI_VIDEO_LIBS="-lvl"
2320 AC_DEFINE(HAVE_SGI_VIDEO)
2323 elif test "$with_sgivideo" != no; then
2324 echo "error: must be yes or no: --with-sgivideo=$with_sgivideo"
2329 ###############################################################################
2331 # Check for a program to generate random text.
2333 # Zippy is funnier than the idiocy generally spat out by `fortune',
2334 # so try to find that, by invoking Emacs and asking it where its
2335 # libexec directory is ("yow" lives in there.)
2337 # If that doesn't work, see if fortune, zippy, or yow are on $PATH,
2338 # and if so, use them.
2340 # If that doesn't work, look in /usr/games, and if it's there, use
2341 # the full pathname.
2343 ###############################################################################
2347 --with-zippy=PROGRAM Some demos are able to run an external program and
2348 display its text; this names the program to use by
2349 default (though it can be overridden with X
2350 resources.) If you don't specify this, the default
2351 is to use \"yow\" from the Emacs distribution (if you
2352 have it) or else to use \"fortune\".
2354 [with_zippy_req="$withval"; with_zippy="$withval"],[with_zippy=yes])
2356 if test "$with_zippy" = no || test "$with_zippy" = yes ; then
2361 if test -n "$with_zippy_req" ; then
2362 ac_cv_zippy_program=""
2363 case "$with_zippy_req" in
2365 AC_MSG_CHECKING([for $with_zippy_req])
2366 if test -x "$with_zippy_req" ; then
2375 unset ac_cv_path_zip2
2376 AC_PATH_PROG(zip2, $with_zippy_req, [])
2377 if test "$zip2" = ""; then
2382 ac_cv_zippy_program="$with_zippy"
2384 elif test -n "$ac_cv_zippy_program"; then
2385 AC_MSG_RESULT([checking for zippy... (cached) $ac_cv_zippy_program])
2388 if test ! -n "$ac_cv_zippy_program"; then
2390 AC_CHECK_PROGS(emacs_exe, emacs)
2391 AC_CHECK_PROGS(xemacs_exe, xemacs)
2393 ac_cv_zippy_program=""
2394 eargs='-batch -q -nw --eval'
2396 if test -n "$emacs_exe" ; then
2397 AC_MSG_CHECKING([for emacs yow])
2399 # get emacs to tell us where the libexec directory is.
2401 dir=`$emacs_exe $eargs '(princ (concat exec-directory "\n"))' \
2402 2>/dev/null | tail -1`
2403 dir=`echo "$dir" | sed 's@///*@/@g;s@/$@@'`
2405 # try running libexec/yow and see if it exits without error.
2407 if test x"$dir" != x -a -x "$dir/yow" ; then
2408 if $dir/yow >&- 2>&- ; then
2409 ac_cv_zippy_program="$dir/yow"
2410 AC_MSG_RESULT($ac_cv_zippy_program)
2417 if test -z "$ac_cv_zippy_program" ; then
2418 AC_MSG_CHECKING([for xemacs yow])
2419 if test -n "$xemacs_exe" ; then
2421 # get xemacs to tell us where the libexec directory is.
2423 dir=`$xemacs_exe $eargs '(princ (concat exec-directory "\n"))' \
2424 2>/dev/null | tail -1`
2425 dir=`echo "$dir" | sed 's@///*@/@g;s@/$@@'`
2427 # try running libexec/yow and see if it exits without error.
2429 if test x"$dir" != x -a -x "$dir/yow" ; then
2430 if $dir/yow >&- 2>&- ; then
2431 ac_cv_zippy_program="$dir/yow"
2432 AC_MSG_RESULT($ac_cv_zippy_program)
2435 # in some xemacs installations, the pathname of the yow.lines file
2436 # isn't hardcoded into the yow executable, and must be passed on
2437 # the command line. See if it's in libexec/../etc/.
2441 dir_up=`echo "$dir" | sed 's@/[^/]*$@@'`
2444 yowlines="$dir_up/etc/yow.lines"
2445 if $dir/yow -f $yowlines >&- 2>&- ; then
2446 ac_cv_zippy_program="$dir/yow -f $yowlines"
2447 AC_MSG_RESULT($ac_cv_zippy_program)
2450 # In newer XEmacs releases, yow.lines is in a different place,
2451 # and the easiest way to get it is by calling the new function
2452 # `locate-data-file'.
2454 yowlines=`$xemacs_exe $eargs \
2455 '(princ (concat (locate-data-file "yow.lines") "\n"))' \
2456 2>/dev/null | tail -1`
2457 if $dir/yow -f $yowlines >&- 2>&- ; then
2458 ac_cv_zippy_program="$dir/yow -f $yowlines"
2459 AC_MSG_RESULT($ac_cv_zippy_program)
2469 # if that didn't work, try for some other programs...
2470 if test -z "$ac_cv_zippy_program" ; then
2472 AC_CHECK_PROGS(fortune, [fortune zippy yow])
2473 # if that didn't work, try for those programs in /usr/games...
2474 if test -z "$fortune" ; then
2475 AC_PATH_PROGS(fortune, [fortune zippy yow], fortune,
2476 /usr/games:/usr/local/games:$PATH)
2481 if test -z "$ac_cv_zippy_program" ; then
2482 ac_cv_zippy_program=fortune
2485 AC_DEFINE_UNQUOTED(ZIPPY_PROGRAM, "$ac_cv_zippy_program")
2488 ###############################################################################
2490 # Done testing. Now, set up the various -I and -L variables,
2491 # and decide which GUI program to build by default.
2493 ###############################################################################
2500 if test \! -z "$includedir" ; then
2501 INCLUDES="$INCLUDES -I$includedir"
2504 if test \! -z "$libdir" ; then
2505 LDFLAGS="$LDFLAGS -L$libdir"
2509 PREFERRED_DEMO_PROGRAM=xscreensaver-demo-Xm
2511 if test "$have_motif" = yes; then
2512 PREFERRED_DEMO_PROGRAM=xscreensaver-demo-Xm
2513 ALL_DEMO_PROGRAMS="$PREFERRED_DEMO_PROGRAM $ALL_DEMO_PROGRAMS"
2515 if test "$have_gtk" = yes; then
2516 PREFERRED_DEMO_PROGRAM=xscreensaver-demo-Gtk
2517 ALL_DEMO_PROGRAMS="$PREFERRED_DEMO_PROGRAM $ALL_DEMO_PROGRAMS"
2521 if test "$have_kerberos" = yes; then
2522 PASSWD_SRCS="$PASSWD_SRCS \$(KERBEROS_SRCS)"
2523 PASSWD_OBJS="$PASSWD_OBJS \$(KERBEROS_OBJS)"
2525 if test "$have_pam" = yes; then
2526 PASSWD_SRCS="$PASSWD_SRCS \$(PAM_SRCS)"
2527 PASSWD_OBJS="$PASSWD_OBJS \$(PAM_OBJS)"
2528 INSTALL_PAM="install-pam"
2530 PASSWD_SRCS="$PASSWD_SRCS \$(PWENT_SRCS)"
2531 PASSWD_OBJS="$PASSWD_OBJS \$(PWENT_OBJS)"
2534 if test "$enable_locking" = yes; then
2535 LOCK_SRCS='$(LOCK_SRCS_1) $(PASSWD_SRCS)'
2536 LOCK_OBJS='$(LOCK_OBJS_1) $(PASSWD_OBJS)'
2538 LOCK_SRCS='$(NOLOCK_SRCS_1)'
2539 LOCK_OBJS='$(NOLOCK_OBJS_1)'
2542 if test "$need_setuid" = yes; then
2544 INSTALL_SETUID='$(INSTALL) $(SUID_FLAGS)'
2547 INSTALL_SETUID='$(INSTALL_PROGRAM)'
2551 if test "$have_gl" = yes; then
2552 GL_EXES='$(GL_EXES)'
2556 GL_KLUDGE="-${tab} "
2559 if test "$have_gle" = yes; then
2560 GLE_EXES='$(GLE_EXES)'
2561 GLE_MEN='$(GLE_MEN)'
2562 GLE_KLUDGE="${tab} "
2564 GLE_KLUDGE="-${tab} "
2568 ###############################################################################
2570 # Perform substitutions and write Makefiles.
2572 ###############################################################################
2576 AC_SUBST(PREFERRED_DEMO_PROGRAM)
2577 AC_SUBST(ALL_DEMO_PROGRAMS)
2578 AC_SUBST(SAVER_LIBS)
2579 AC_SUBST(MOTIF_LIBS)
2585 AC_SUBST(PASSWD_LIBS)
2586 AC_SUBST(INSTALL_SETUID)
2587 AC_SUBST(INSTALL_DIRS)
2588 AC_SUBST(NEED_SETUID)
2589 AC_SUBST(INSTALL_PAM)
2590 AC_SUBST(SGI_VIDEO_OBJS)
2591 AC_SUBST(SGI_VIDEO_LIBS)
2593 AC_SUBST(PASSWD_SRCS)
2594 AC_SUBST(PASSWD_OBJS)
2597 AC_SUBST(SAVER_GL_SRCS)
2598 AC_SUBST(SAVER_GL_OBJS)
2599 AC_SUBST(SAVER_GL_LIBS)
2607 AC_SUBST(GLE_KLUDGE)
2609 AC_SUBST(GNOME_DATADIR)
2611 APPDEFAULTS=$ac_x_app_defaults
2612 AC_SUBST(APPDEFAULTS)
2615 AC_SUBST(DEPEND_FLAGS)
2616 AC_SUBST(DEPEND_DEFINES)
2624 driver/XScreenSaver.ad)
2626 ###############################################################################
2628 # Print some warnings at the end.
2630 ###############################################################################
2632 warn_prefix_1=" Warning:"
2633 warn_prefix_2=" Note:"
2634 warn_prefix="$warn_prefix_1"
2637 warnsep=' #################################################################'
2640 if test "$warning" = no ; then
2641 echo '' ; echo "$warnsep" ; echo ''
2648 if test "$warning" = long ; then echo '' ; fi
2651 echo "$warn_prefix $rest"
2658 if test "$was" != no ; then echo '' ; fi
2660 echo "$warn_prefix $rest"
2670 warn_prefix="$warn_prefix_2"
2672 warn_prefix="$warn_prefix_1"
2676 warn_prefix="$warn_prefix_2"
2678 warn_prefix="$warn_prefix_1"
2682 if test "$with_sgi_req" = yes -a "$have_sgi" = no ; then
2683 warn 'The SGI saver extension was requested, but was not found.'
2686 if test "$with_mit_req" = yes -a "$have_mit" = no ; then
2687 warn 'The MIT saver extension was requested, but was not found.'
2690 if test "$with_xidle_req" = yes -a "$have_xidle" = no ; then
2691 warn 'The XIdle extension was requested, but was not found.'
2694 if test "$with_xshm_req" = yes -a "$have_xshm" = no ; then
2695 warn 'The XSHM extension was requested, but was not found.'
2698 if test "$with_xdbe_req" = yes -a "$have_xdbe" = no ; then
2699 warn 'The DOUBLE-BUFFER extension was requested, but was not found.'
2702 if test "$with_sgivc_req" = yes -a "$have_sgivc" = no ; then
2703 warn 'The SGI-VIDEO-CONTROL extension was requested, but was not found.'
2706 if test "$with_dpms_req" = yes -a "$have_dpms" = no ; then
2707 warn 'The DPMS extension was requested, but was not found.'
2710 if test "$with_xf86vmode_req" = yes -a "$have_xf86vmode" = no ; then
2711 warn 'The XF86VMODE extension was requested, but was not found.'
2714 if test "$with_proc_interrupts_req" = yes -a "$have_proc_interrupts" = no; then
2715 warn "Checking of /proc/interrupts was requested, but it's bogus."
2719 if test "$have_motif" = no -a "$have_gtk" = no; then
2720 warnL "Neither Motif nor Gtk seem to be available;"
2721 warn2 "the \`xscreensaver-demo' program requires one of these."
2723 elif test "$with_motif_req" = yes -a "$have_motif" = no ; then
2724 warnL "Use of Motif was requested, but it wasn't found;"
2725 warn2 "Gtk will be used instead."
2727 elif test "$jurassic_gtk" = yes ; then
2731 v="$ac_gtk_version_string"
2732 if test "$with_gtk_req" = yes -a "$ac_gtk_version" = "unknown" ; then
2733 warnL "Use of Gtk was requested, but its version number is unknown;"
2734 elif test "$with_gtk_req" = yes ; then
2735 warnL "Use of Gtk was requested, but it is version $v;"
2737 warnL "Gtk was found on this system, but it is version $v;"
2740 warn2 "Gtk $pref_gtk or newer is required. Motif will be used instead."
2742 elif test "$with_gtk_req" = yes -a "$have_gtk" = no ; then
2743 warnL "Use of Gtk was requested, but it wasn't found;"
2744 warn2 "Motif will be used instead."
2749 if test "$with_gnome_req" = yes -a "$have_gnome" = no ; then
2750 warn 'Use of the Gnome Control Panel was requested, but the necessary'
2751 warn2 'headers and/or libraries were not found.'
2755 if test "$have_motif" = yes -a "$have_lesstif" = yes ; then
2757 preferred_lesstif=0.86
2759 if test "$lesstif_version" = unknown; then
2760 warnL "Unable to determine the LessTif version number!"
2761 warn2 "Make sure you are using version $preferred_lesstif or newer."
2762 warn2 "See <http://www.lesstif.org/>."
2764 elif test \! $lesstif_version -gt 82; then
2765 warnL "LessTif version $lesstif_version_string is being used."
2766 warn2 "LessTif versions 0.82 and earlier are too buggy to"
2767 warn2 "use with XScreenSaver; it is strongly recommended"
2768 warn2 "that you upgrade to at least version $preferred_lesstif!"
2769 warn2 "See <http://www.lesstif.org/>."
2775 if test "$have_xpm" = no ; then
2776 if test "$with_xpm_req" = yes ; then
2777 warnL 'Use of XPM was requested, but it was not found.'
2778 elif test "$with_xpm_req" = no ; then
2779 noteL 'The XPM library is not being used.'
2781 noteL 'The XPM library was not found.'
2785 warn2 'Some of the demos will not be as colorful as they'
2786 warn2 'could be. You might want to consider installing XPM'
2787 warn2 'and re-running configure. (Remember to delete the'
2788 warn2 'config.cache file first.) You can find XPM at most'
2789 warn2 'X11 archive sites, such as <http://sunsite.unc.edu/>.'
2793 if test "$have_gl" = yes -a "$ac_have_mesa_gl" = yes ; then
2794 preferred_mesagl=3.0
2796 if test "$ac_mesagl_version" = unknown; then
2797 warnL "Unable to determine the MesaGL version number!"
2798 warn2 "Make sure you are using version $preferred_mesagl or newer."
2800 elif test \! "$ac_mesagl_version" -gt 2006; then
2801 warnL "MesaGL version $ac_mesagl_version_string is being used."
2802 warn2 "MesaGL versions 2.6 and earlier have a security bug."
2803 warn2 "It is strongly recommended that you upgrade to at"
2804 warn2 "least version $preferred_mesagl."
2808 if test "$have_gl" = no ; then
2809 if test "$with_gl_req" = yes ; then
2810 warnL 'Use of GL was requested, but it was not found.'
2811 elif test "$with_gl_req" = no ; then
2812 noteL 'The OpenGL 3D library is not being used.'
2814 noteL 'The OpenGL 3D library was not found.'
2817 if test "$gl_halfassed" = yes ; then
2819 warn2 'More specifically, we found the headers, but not the'
2820 warn2 'libraries; so either GL is half-installed on this'
2821 warn2 "system, or something else went wrong. The \`config.log'"
2822 warn2 'file might contain some clues.'
2826 warn2 'Those demos which use 3D will not be built or installed.'
2827 warn2 'You might want to consider installing OpenGL and'
2828 warn2 're-running configure. (Remember to delete the'
2829 warn2 "config.cache file first.) If your vendor doesn't ship"
2830 warn2 'their own implementation of OpenGL, you can get a free'
2831 warn2 'version at <http://www.mesa3d.org/>. For general OpenGL'
2832 warn2 'info, see <http://www.opengl.org/>.'
2837 if test "$have_gl" = yes -a "$have_gle" = no ; then
2838 if test "$with_gle_req" = yes ; then
2839 noteL 'Use of the GLE (GL Extrusion) library was requested, but'
2840 warn2 'it was not found (though the OpenGL library was found, and'
2841 warn2 'is being used.)'
2842 elif test "$with_gle_req" = no ; then
2843 noteL 'The OpenGL Library is being used, but the GLE (GL Extrusion)'
2844 warn2 'library is not.'
2846 noteL 'The OpenGL Library was found, but the GLE (GL Extrusion)'
2850 if test "$gle_halfassed" = yes ; then
2852 warn2 'More specifically, we found the headers, but not the'
2853 warn2 'libraries; so either GLE is half-installed on this'
2854 warn2 "system, or something else went wrong. The \`config.log'"
2855 warn2 'file might contain some clues.'
2859 warn2 'Some of the OpenGL (3D) demos (those that depend on GLE)'
2860 warn2 'will not be built or installed. You might want to consider'
2861 warn2 'installing GLE and re-running configure. (Remember to delete'
2862 warn2 'the config.cache file first.) You can find the GLE library'
2863 warn2 'at <http://www.linas.org/gle/>. For general OpenGL info,'
2864 warn2 'see <http://www.opengl.org/>.'
2869 if test "$with_readdisplay_req" = yes -a "$have_readdisplay" = no ; then
2870 warn 'Use of XReadDisplay was requested, but it was not found.'
2873 if test "$with_sgivideo_req" = yes -a "$have_sgivideo" = no ; then
2874 warn 'Use of the Iris Video Library was requested, but it was not found.'
2877 if test -n "$with_zippy_req"; then
2878 if test "$with_zippy_req" != "$ac_cv_zippy_program" ; then
2879 warnL "$with_zippy_req was requested as the Zippy program,"
2880 warn2 "but was not found. The default will be used instead."
2884 if test "$with_kerberos_req" = yes -a "$have_kerberos" = no ; then
2885 warn 'Use of Kerberos was requested, but it was not found.'
2888 if test "$with_pam_req" = yes -a "$have_pam" = no ; then
2889 warn 'Use of PAM was requested, but it was not found.'
2892 if test "$with_shadow_req" = yes -a "$have_shadow" = no ; then
2893 warn 'Use of shadow passwords was requested, but they were not found.'
2897 # You are in a twisty maze of namespaces and syntaxes, all alike.
2898 # Fuck the skull of Unix.
2900 eval bindir=${bindir}
2901 eval bindir=${bindir}
2902 eval bindir=${bindir}
2903 eval bindir=${bindir}
2904 eval bindir=${bindir}
2905 eval bindir=${bindir}
2906 eval HACKDIR=${HACKDIR}
2907 eval HACKDIR=${HACKDIR}
2908 eval HACKDIR=${HACKDIR}
2909 eval HACKDIR=${HACKDIR}
2910 eval HACKDIR=${HACKDIR}
2911 eval HACKDIR=${HACKDIR}
2913 # canonicalize slashes.
2914 bindir=`echo "${bindir}" | sed 's@/$@@;s@//*@/@g'`
2915 HACKDIR=`echo "${HACKDIR}" | sed 's@/$@@;s@//*@/@g'`
2918 # Sanity check the subdir
2919 for bad_choice in xscreensaver xscreensaver-demo xscreensaver-command ; do
2920 if test "${HACKDIR}" = "${bindir}/${bad_choice}" ; then
2922 AC_MSG_ERROR([\"--enable-subdir=${bindir}/${bad_choice}\" won't work.
2923 There will be an executable installed with that name, so
2924 that can't be the name of a directory as well. Please
2925 re-configure with a different directory name.])
2932 # Now let's see if there's a previous RPM version already installed. Blargh!
2936 rpmv=`(rpm -qv xscreensaver) 2>&- | \
2937 sed 's/^xscreensaver-\([0-9][0-9]*[.][0-9][0-9]*\)-.*$/\1/'`
2940 if test \! -z "$rpmv" ; then
2941 rpmbdir=`rpm -ql xscreensaver | sed -n 's@^\(.*\)/xscreensaver-demo$@\1@p'`
2942 rpmhdir=`rpm -ql xscreensaver | sed -n 's@^\(.*\)/attraction$@\1@p'`
2945 warnL "There is already an installed RPM of xscreensaver $rpmv"
2946 warn2 "on this system. You might want to remove it (with"
2947 warn2 '"rpm -ve xscreensaver") before running "make install"'
2948 warn2 "from this directory."
2950 warn2 "Alternately, you could build this version of xscreensaver"
2951 warn2 'as an RPM, and then install that. An "xscreensaver.spec"'
2952 warn2 "file is included. See the RPM documentation for more info."
2955 if test "$rpmbdir" = "$rpmhdir" ; then
2956 warn2 "The RPM version was installed in $rpmbdir."
2958 warn2 "The RPM version was installed in $rpmbdir,"
2959 warn2 "with demos in $rpmhdir."
2966 # Warn about egregious GNOME bogosity.
2968 #if (rpm -qv control-center) >&- 2>&- ; then
2970 # warnL "The Gnome Control Center seems to be installed."
2972 # warn2 "Note that simply installing this version of xscreensaver"
2973 # warn2 "will not cause GNOME to know about the newly-added display"
2974 # warn2 "modes -- GNOME is just lame that way. Instead of using the"
2975 # warn2 "Control Center, try using the \`xscreensaver-demo' command."
2979 if test "${bindir}" = "${HACKDIR}" ; then
2983 if test "$do_dir_warning" = yes; then
2987 echo ' When you run "make install", the "xscreensaver",'
2988 echo ' "xscreensaver-demo", and "xscreensaver-command" executables'
2989 echo " will be installed in ${bindir}."
2991 echo " The various graphics demos (100+ different executables) will"
2992 echo " also be installed in ${HACKDIR}."
2994 echo " If you would prefer the demos to be installed elsewhere"
2995 echo " (for example, in a dedicated directory) you should re-run"
2996 echo " configure with the --enable-subdir=DIR option. For more"
2997 echo " information, run $0 --help."
3001 if test "$warning" != no; then
3002 echo '' ; echo "$warnsep" ; echo ''