http://ftp.x.org/contrib/applications/xscreensaver-3.07.tar.gz
[xscreensaver] / configure.in
1 # configure.in --- xscreensaver, Copyright (c) 1997 Jamie Zawinski.
2 #
3
4 AC_INIT(driver/subprocs.c)
5
6 echo "current directory: `pwd`"
7 echo "command line was: $0 $@"
8
9 AC_CONFIG_HEADER(config.h)
10 AC_CANONICAL_HOST
11
12 AC_PROG_CC
13
14 if test -z "$GCC"; then
15   AC_MSG_CHECKING(how to request ANSI compilation)
16   case "$host" in
17     *-hpux*)
18       AC_MSG_RESULT(HPUX: adding -Ae)
19       CC="$CC -Ae"
20     ;;
21     *-aix*)
22       AC_MSG_RESULT(AIX: adding -qlanglvl=ansi -qhalt=e)
23       CC="$CC -qlanglvl=ansi -qhalt=e"
24     ;;
25
26     *-dec-*)
27       AC_MSG_RESULT(DEC: adding -std1)
28       CC="$CC -std1"
29     ;;
30
31     *)
32       AC_MSG_RESULT(no idea)
33     ;;
34   esac
35 fi
36
37
38 AC_MSG_CHECKING([whether the compiler works on ANSI C])
39 AC_TRY_RUN([ main(int ac, char **av) { return 0; } ],
40    AC_MSG_RESULT(yes),
41    AC_MSG_RESULT(no)
42    AC_MSG_ERROR(Couldn't build even a trivial ANSI C program: check CC.),
43    AC_MSG_ERROR(Couldn't build even a trivial ANSI C program: check CC.))
44
45 case "$host" in
46   *-irix5* |*-irix6.[0-3]* )
47     if test -n "$GCC"; then
48       AC_MSG_RESULT(Turning on gcc compiler warnings.)
49       CC="$CC -Wall -Wstrict-prototypes -Wnested-externs -Wno-format"
50     else
51       # not gcc
52       AC_MSG_RESULT(Turning on SGI compiler warnings.)
53       CC="$CC -fullwarn -use_readonly_const -rdata_shared -g3"
54     fi
55   ;;
56
57     *-linux-*)
58       AC_MSG_RESULT(Turning on gcc compiler warnings.)
59       CC="$CC -Wall -Wstrict-prototypes -Wnested-externs -Wno-format"
60   ;;
61
62 #  *-dec-osf*)
63 #    if test -z "$GCC"; then
64 #      AC_MSG_RESULT(Turning on DEC C compiler warnings.)
65 #      CC="$CC -migrate -w0 -verbose -warnprotos"
66 #    fi
67 #  ;;
68
69 esac
70
71
72 # Try and determine whether ${INSTALL} can create intermediate directories,
73 # and if not, whether "mkdir -p" works instead.  This sets ${INSTALL_DIRS}.
74 # (But autoconf should earn its keep and do this for us!)
75 #
76 AC_DEFUN(AC_PROG_INSTALL_DIRS,
77   [INSTALL_DIRS='${INSTALL} -d'
78    AC_MSG_CHECKING(whether \"\${INSTALL} -d\" creates intermediate directories)
79    rm -rf conftestdir
80    if mkdir conftestdir; then
81       cd conftestdir >&-
82
83       ${INSTALL} -d `pwd`/dir1/dir2 >&- 2>&-
84       if test -d dir1/dir2 ; then
85         AC_MSG_RESULT(yes)
86       else
87         AC_MSG_RESULT(no)
88         AC_MSG_CHECKING(whether \"mkdir -p\" creates intermediate directories)
89         rm -rf dir1
90         mkdir -p dir1/dir2 >&- 2>&-
91         if test -d dir1/dir2/. ; then
92           AC_MSG_RESULT(yes)
93           INSTALL_DIRS='mkdir -p'
94         else
95           AC_MSG_RESULT(no)
96         fi
97       fi
98       cd .. >&-
99       rm -rf conftestdir
100    fi
101 ])
102
103
104 AC_PROG_CPP
105 AC_PROG_INSTALL
106 AC_PROG_INSTALL_DIRS
107 AC_PROG_MAKE_SET
108
109 AC_C_CONST
110 AC_C_INLINE
111
112 AC_HEADER_STDC
113 AC_HEADER_TIME
114 AC_HEADER_SYS_WAIT
115 AC_HEADER_DIRENT
116
117 AC_TYPE_MODE_T
118 AC_TYPE_PID_T
119 AC_TYPE_SIZE_T
120 AC_TYPE_SIGNAL
121
122 AC_MSG_CHECKING(how to call gettimeofday)
123 AC_CACHE_VAL(ac_cv_gettimeofday_args,
124  [AC_TRY_COMPILE([#include <stdlib.h>
125                   #include <sys/time.h>],
126                  [struct timeval tv; struct timezone tzp;
127                   gettimeofday(&tv, &tzp);],
128                  [ac_gettimeofday_args=2],
129                  [AC_TRY_COMPILE([#include <stdlib.h>
130                                   #include <sys/time.h>],
131                                  [struct timeval tv; gettimeofday(&tv);],
132                                  [ac_gettimeofday_args=1],
133                                  [ac_gettimeofday_args=0])])
134   ac_cv_gettimeofday_args=$ac_gettimeofday_args])
135 ac_gettimeofday_args=$ac_cv_gettimeofday_args
136 if test "$ac_gettimeofday_args" = 1 ; then
137   AC_DEFINE(HAVE_GETTIMEOFDAY)
138   AC_MSG_RESULT(one argument)
139 elif test "$ac_gettimeofday_args" = 2 ; then
140   AC_DEFINE(HAVE_GETTIMEOFDAY)
141   AC_DEFINE(GETTIMEOFDAY_TWO_ARGS)
142   AC_MSG_RESULT(two arguments)
143 else
144   AC_MSG_RESULT(unknown)
145 fi
146
147
148 AC_CHECK_FUNCS(select fcntl uname nice setpriority getcwd getwd putenv)
149 AC_CHECK_FUNCS(sigaction syslog)
150
151 AC_CHECK_HEADERS(unistd.h crypt.h sys/select.h)
152
153 dnl     /usr/local/src/ssh-1.2.17/putenv.c -- AC_REPLACE_FUNCS(putenv)
154
155
156 AC_ARG_ENABLE(subdir,[
157 Installation options:
158
159   --enable-subdir=DIR     Put the demo programs in a subdirectory of \`bindir',
160                           instead of putting them in bindir itself.  You can
161                           specify the name of the subdirectory.  For example,
162                           --exec-prefix=/usr/local/bin --enable-subdir=demos
163                           would put xscreensaver in /usr/local/bin/, and would
164                           put the demos in /usr/local/bin/demos/.  (If DIR
165                           begins with /, then bindir will not be prepended.)
166
167   --disable-subdir        Just put the demos in \`bindir' (this is the default.)
168 ],
169   [enable_subdir="$enableval"],[enable_subdir=no])
170 if test x"$enable_subdir" = xno; then
171   HACKDIR='${bindir}'
172 elif test x"$enable_subdir" = xyes -o x"$enable_subdir" = x ; then
173   echo "error: must be a subdirectory name: --enable-subdir=$enable_subdir"
174   exit 1
175 else
176   # there must be a better way than this...
177   if test -z "`echo $enable_subdir | sed 's@^/.*@@'`" ; then
178     # absolute path
179     HACKDIR=$enable_subdir
180   else
181     # relative path
182     HACKDIR='${bindir}/'$enable_subdir
183   fi
184 fi
185
186 # canonicalize slashes.
187 HACKDIR=`echo "${HACKDIR}" | sed 's@/$@@;s@//*@/@g'`
188
189
190 AC_PATH_XTRA
191
192 # Try and find the app-defaults directory.
193 # It sucks that autoconf doesn't do this already...
194 #
195 AC_DEFUN(AC_PATH_X_APP_DEFAULTS_XMKMF,[
196   rm -fr conftestdir
197   if mkdir conftestdir; then
198     cd conftestdir >&-
199     # Make sure to not put "make" in the Imakefile rules, since we grep it out.
200     cat > Imakefile <<'EOF'
201 acfindx:
202         @echo 'ac_x_app_defaults="${XAPPLOADDIR}"'
203 EOF
204     if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
205       # GNU make sometimes prints "make[1]: Entering...", which'd confuse us.
206       eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
207     fi
208     cd .. >&-
209     rm -fr conftestdir
210   fi])
211
212 AC_DEFUN(AC_PATH_X_APP_DEFAULTS_DIRECT,[
213   # Look for the directory under a standard set of common directories.
214   # Check X11 before X11Rn because it's often a symlink to the current release.
215   for ac_dir in                                 \
216     /usr/X11/lib/app-defaults                   \
217     /usr/X11R6/lib/app-defaults                 \
218     /usr/X11R6/lib/X11/app-defaults             \
219     /usr/X11R5/lib/app-defaults                 \
220     /usr/X11R5/lib/X11/app-defaults             \
221     /usr/X11R4/lib/app-defaults                 \
222     /usr/X11R4/lib/X11/app-defaults             \
223                                                 \
224     /usr/lib/X11/app-defaults                   \
225     /usr/lib/X11R6/app-defaults                 \
226     /usr/lib/X11R5/app-defaults                 \
227     /usr/lib/X11R4/app-defaults                 \
228                                                 \
229     /usr/local/X11/lib/app-defaults             \
230     /usr/local/X11R6/lib/app-defaults           \
231     /usr/local/X11R5/lib/app-defaults           \
232     /usr/local/X11R4/lib/app-defaults           \
233                                                 \
234     /usr/local/lib/X11/app-defaults             \
235     /usr/local/lib/X11R6/app-defaults           \
236     /usr/local/lib/X11R6/X11/app-defaults       \
237     /usr/local/lib/X11R5/app-defaults           \
238     /usr/local/lib/X11R5/X11/app-defaults       \
239     /usr/local/lib/X11R4/app-defaults           \
240     /usr/local/lib/X11R4/X11/app-defaults       \
241                                                 \
242     /usr/X386/lib/X11/app-defaults              \
243     /usr/x386/lib/X11/app-defaults              \
244     /usr/XFree86/lib/X11/app-defaults           \
245                                                 \
246     /usr/lib/X11/app-defaults                   \
247     /usr/local/lib/X11/app-defaults             \
248     /usr/unsupported/lib/X11/app-defaults       \
249     /usr/athena/lib/X11/app-defaults            \
250     /usr/local/x11r5/lib/X11/app-defaults       \
251     /usr/lpp/Xamples/lib/X11/app-defaults       \
252     /lib/usr/lib/X11/app-defaults               \
253                                                 \
254     /usr/openwin/lib/app-defaults               \
255     /usr/openwin/lib/X11/app-defaults           \
256     /usr/openwin/share/lib/app-defaults         \
257     /usr/openwin/share/lib/X11/app-defaults     \
258                                                 \
259     /X11R6/lib/app-defaults                     \
260     /X11R5/lib/app-defaults                     \
261     /X11R4/lib/app-defaults                     \
262     ; \
263   do
264     if test -d "$ac_dir"; then
265       ac_x_app_defaults=$ac_dir
266       break
267     fi
268   done
269 ])
270
271
272 AC_DEFUN(AC_PATH_X_APP_DEFAULTS,
273   [AC_REQUIRE_CPP()
274     AC_CACHE_CHECK([for X app-defaults directory], ac_cv_x_app_defaults,
275      [AC_PATH_X_APP_DEFAULTS_XMKMF
276       if test x"$ac_x_app_defaults" = x; then
277         AC_PATH_X_APP_DEFAULTS_DIRECT
278       fi
279       if test x"$ac_x_app_defaults" = x; then
280         ac_cv_x_app_defaults="/usr/lib/X11/app-defaults"
281       else
282         # Record where we found app-defaults for the cache.
283         ac_cv_x_app_defaults="$ac_x_app_defaults"
284       fi])
285     eval ac_x_app_defaults="$ac_cv_x_app_defaults"])
286
287 AC_PATH_X_APP_DEFAULTS
288
289 APPDEFAULTS=$ac_x_app_defaults
290
291
292 # Like AC_CHECK_HEADER, but it uses the already-computed -I directories.
293 #
294 AC_DEFUN(AC_CHECK_X_HEADER, [
295   ac_save_CPPFLAGS="$CPPFLAGS"
296   if test \! -z "$includedir" ; then 
297     CPPFLAGS="$CPPFLAGS -I$includedir"
298   fi
299   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
300   AC_CHECK_HEADER([$1], [$2])
301   CPPFLAGS="$ac_save_CPPFLAGS"])
302
303 # Like AC_EGREP_HEADER, but it uses the already-computed -I directories.
304 #
305 AC_DEFUN(AC_EGREP_X_HEADER, [
306   ac_save_CPPFLAGS="$CPPFLAGS"
307   if test \! -z "$includedir" ; then 
308     CPPFLAGS="$CPPFLAGS -I$includedir"
309   fi
310   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
311   AC_EGREP_HEADER([$1], [$2], [$3], [$4])
312   CPPFLAGS="$ac_save_CPPFLAGS"])
313
314 # Like AC_TRY_COMPILE, but it uses the already-computed -I directories.
315 #
316 AC_DEFUN(AC_TRY_X_COMPILE, [
317   ac_save_CPPFLAGS="$CPPFLAGS"
318   if test \! -z "$includedir" ; then 
319     CPPFLAGS="$CPPFLAGS -I$includedir"
320   fi
321   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
322   AC_TRY_COMPILE([$1], [$2], [$3], [$4])
323   CPPFLAGS="$ac_save_CPPFLAGS"])
324
325
326 # Like AC_CHECK_LIB, but it uses the already-computed -I and -L directories.
327 # Use this sparingly; it probably doesn't work very well on X programs.
328 #
329 AC_DEFUN(AC_CHECK_X_LIB, [
330   ac_save_CPPFLAGS="$CPPFLAGS"
331   ac_save_LDFLAGS="$LDFLAGS"
332
333   if test \! -z "$includedir" ; then 
334     CPPFLAGS="$CPPFLAGS -I$includedir"
335   fi
336   # note: $X_CFLAGS includes $x_includes
337   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
338
339   if test \! -z "$libdir" ; then
340     LDFLAGS="$LDFLAGS -L$libdir"
341   fi
342   # note: $X_LIBS includes $x_libraries
343   LDFLAGS="$LDFLAGS $X_LIBS"
344
345   AC_CHECK_LIB([$1], [$2], [$3], [$4], [$5])
346   CPPFLAGS="$ac_save_CPPFLAGS"
347   LDFLAGS="$ac_save_LDFLAGS"])
348
349 # Like AC_TRY_RUN, but it uses the already-computed -I directories.
350 # (But not the -L directories!)
351 #
352 AC_DEFUN(AC_TRY_X_RUN, [
353   ac_save_CPPFLAGS="$CPPFLAGS"
354   if test \! -z "$includedir" ; then 
355     CPPFLAGS="$CPPFLAGS -I$includedir"
356   fi
357   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
358   AC_TRY_RUN([$1], [$2], [$3], [$4])
359   CPPFLAGS="$ac_save_CPPFLAGS"])
360
361
362
363 # Usage: HANDLE_X_PATH_ARG([variable_name],
364 #                          [--command-line-option],
365 #                          [descriptive string])
366 #
367 # All of the --with options take three forms:
368 #
369 #   --with-foo (or --with-foo=yes)
370 #   --without-foo (or --with-foo=no)
371 #   --with-foo=/DIR
372 #
373 # This function, HANDLE_X_PATH_ARG, deals with the /DIR case.  When it sees
374 # a directory (string beginning with a slash) it checks to see whether
375 # /DIR/include and /DIR/lib exist, and adds them to $X_CFLAGS and $X_LIBS
376 # as appropriate.
377 #
378 AC_DEFUN(HANDLE_X_PATH_ARG, [
379    case "$[$1]" in
380     yes) ;;
381     no)  ;;
382
383     /*)
384      AC_MSG_CHECKING([for [$3] headers])
385      d=$[$1]/include
386      if test -d $d; then
387        X_CFLAGS="-I$d $X_CFLAGS"
388        AC_MSG_RESULT($d)
389      else
390        AC_MSG_RESULT(not found ($d: no such directory))
391      fi
392
393      AC_MSG_CHECKING([for [$3] libs])
394      d=$[$1]/lib
395      if test -d $d; then
396        X_LIBS="-L$d $X_LIBS"
397        AC_MSG_RESULT($d)
398      else
399        AC_MSG_RESULT(not found ($d: no such directory))
400      fi
401
402      # replace the directory string with "yes".
403      [$1]_req="yes"
404      [$1]=$[$1]_req
405      ;;
406
407     *)
408      echo ""
409      echo "error: argument to [$2] must be \"yes\", \"no\", or a directory."
410      echo "       If it is a directory, then \`DIR/include' will be added to"
411      echo "       the -I list, and \`DIR/lib' will be added to the -L list."
412      exit 1
413      ;;
414    esac
415
416    # why is this necessary?
417    # if we don't do this, then "./configure --with-motif=/usr/local/lesstif"
418    # behaves as if "--with-zippy=/usr/local/lesstif" was also present!
419    withval=
420   ])
421
422
423
424 # check for the HP XHPDisableReset server extension headers.
425 #
426 AC_EGREP_X_HEADER(XHPDisableReset, X11/XHPlib.h,
427                   [AC_DEFINE(HAVE_XHPDISABLERESET)
428                    SAVER_LIBS="-lXhp11 $SAVER_LIBS"])
429
430
431 # Check for the availability of the XPointer typedef, and define it otherwise.
432 #
433 AC_CACHE_CHECK([for XPointer], ac_cv_xpointer,
434                 [AC_TRY_X_COMPILE([#include <X11/Xlib.h>],
435                                   [XPointer foo = (XPointer) 0;],
436                                   [ac_cv_xpointer=yes],
437                                   [ac_cv_xpointer=no])])
438 if test "$ac_cv_xpointer" != yes; then
439   AC_DEFINE(XPointer,[char*])
440 fi
441
442
443 # Random special-cases for certain pathological OSes.  You know who you are.
444 #
445 case "$host" in
446   *-hpux*)
447
448     # The following arcana was gleaned from conversations with
449     # Eric Schwartz <erics@col.hp.com>:
450     #
451     # On HPUX 10.x, the parts of X that HP considers "standard" live in
452     # /usr/{include,lib}/X11R6/.  The parts that HP doesn't consider
453     # "standard", notably, Xaw and Xmu, live in /usr/contrib/X11R6/.
454     # Also, there are symlinks from /usr/include/ and /usr/lib/ into
455     # /usr/{include,lib}/X11R6/, so that (if you don't use Xmu at all)
456     # you don't need any -I or -L arguments.
457     #
458     # On HPUX 9.x, /usr/{include,lib}/X11R5/ and /usr/contrib/X11R5/
459     # are the same division as 10.x.  However, there are no symlinks to
460     # the X stuff from /usr/include/ and /usr/lib/, so -I and -L
461     # arguments are always necessary.
462     #
463     # However, X11R6 was available on HPUX 9.x as a patch: if that
464     # patch was installed, then all of X11R6 went in to
465     # /usr/contrib/X11R6/ (there was no /usr/{include,lib}/X11R6/.)
466     #
467     # HPUX 8.x was the same as 9.x, but was X11R4 instead (I don't know
468     # whether R5 was available as a patch; R6 undoubtedly was not.)
469     #
470     # So.  We try and use the highest numbered pair of
471     # /usr/{include,lib}/X11R?/ and /usr/contrib/X11R?/{include,lib}/
472     # that are available.  We do not mix and match different versions
473     # of X.
474     #
475     # Questions I still don't know the answers to: (do you?)
476     #
477     #   * Does HPUX 10.x come with /usr/contrib/X11R6/ standard?  
478     #     Or does that need to be installed separately?
479     #
480     #   * On HPUX 9.x, where /usr/include/X11R5/ was standard, and
481     #     /usr/contrib/X11R6/ could be installed as a patch, what was in
482     #     that contrib directory?  Did it contain so-called "standard"
483     #     X11R6, or did it include Xaw and Xmu as well?  If the former,
484     #     where did one find Xaw and Xmu on 9.x R6 systems?  Would this
485     #     be a situation where one had to reach into the R5 headers and
486     #     libs to find Xmu?  That is, must both R6 and R5 directories
487     #     be on the -I and -L lists in that case?
488     #
489     for version in X11R6 X11R5 X11R4 ; do
490       # if either pair of directories exists...
491       if test -d /usr/lib/$version || test -d /usr/contrib/$version/lib ; then
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"
496          fi
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"
501          fi
502          # since at least one of the pair exists, go no farther.
503          break
504       fi
505     done
506
507     # Now find Motif.  Thanks for not making xmkmf find this by
508     # default, you losers.
509     #
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"
516     fi
517
518     # Now let's check for the pseudo-standard locations for OpenGL and XPM.
519     #
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"
523     fi
524
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"
528     fi
529
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...
535     #
536     if test \! -x /usr/local/bin/xscreensaver ; then
537       ac_default_prefix=/opt/xscreensaver
538     fi
539
540   ;;
541   *-solaris*)
542
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)"
548     #
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"
552
553       # Some versions of Slowlaris Motif require -lgen.  But not all.  Why?
554       AC_CHECK_LIB(gen, regcmp, [X_LIBS="$X_LIBS -lgen"])
555     fi
556   ;;
557 esac
558
559
560
561 # Check for Xmu (some fucked up vendors don't ship it...)
562 #
563 have_xmu=no
564 AC_CHECK_X_HEADER(X11/Xmu/Error.h, [have_xmu=yes])
565 if test "$have_xmu" = no ; then
566   XMU_SRCS='$(UTILS_SRC)/xmu.c'
567   XMU_OBJS='$(UTILS_BIN)/xmu.o'
568 else
569   XMU_SRCS=''
570   XMU_OBJS=''
571   SAVER_LIBS="-lXmu $SAVER_LIBS"
572   HACK_LIBS="-lXmu $HACK_LIBS"
573   TOOLKIT_LIBS="-lXmu $TOOLKIT_LIBS"
574   AC_DEFINE(HAVE_XMU)
575 fi
576
577
578 # See comp.windows.x FAQ question 124 about _get_wmShellWidgetClass on 4.1.x.
579 # The right fix is to get OpenWindows 3.0 patches 100512-02 and 100573-03.
580 #
581 if test "$have_xmu" = yes ; then
582   case "$host" in
583     *-sunos4*)
584     AC_CACHE_CHECK([for the SunOS 4.1.x _get_wmShellWidgetClass bug],
585                    ac_cv_sunos_xmu_bug,
586                    [ac_save_LDFLAGS="$LDFLAGS"
587                     if test \! -z "$x_libraries" ; then
588                       LDFLAGS="$LDFLAGS -L$x_libraries"
589                     fi
590                     # Note: this trick never works!  (Generally.)
591                     # We're only getting away with using AC_TRY_LINK
592                     # with X libraries because we know it's SunOS.
593                     LDFLAGS="$LDFLAGS -lXmu -lXt -lX11 -lXext -lm"
594                     AC_TRY_LINK(,,
595                                 [ac_cv_sunos_xmu_bug=no],
596                                 [ac_cv_sunos_xmu_bug=yes])
597                     LDFLAGS="$ac_save_LDFLAGS"])
598     if test "$ac_cv_sunos_xmu_bug" = yes ; then
599       AC_CACHE_CHECK([whether the compiler understands -static], 
600                      ac_cv_ld_static,
601                      [ac_save_LDFLAGS="$LDFLAGS"
602                       LDFLAGS="$LDFLAGS -static"
603                       AC_TRY_LINK(,,[ac_cv_ld_static=yes],[ac_cv_ld_static=no])
604                     LDFLAGS="$ac_save_LDFLAGS"])
605       if test "$ac_cv_ld_static" = yes ; then
606         LDFLAGS="$LDFLAGS -static"
607       else
608         LDFLAGS="$LDFLAGS -Bstatic"
609       fi
610     fi
611     ;;
612   esac
613 fi
614
615
616 # Check for the SGI SCREEN_SAVER server extension header.
617 #
618 have_sgi=no
619 with_sgi_req=unspecified
620 AC_ARG_WITH(sgi-ext,
621 [Except where noted, all of the --with options below can also take a
622 directory argument: for example, --with-motif=/opt/Motif.  That would
623 cause /opt/Motif/include/ to be added to the -I list, and /opt/Motif/lib/
624 to be added to the -L list, assuming those directories exist.
625
626 X Server Extension options:
627
628   --with-sgi-ext          Include support for the SGI SCREEN_SAVER
629                           server extension, if possible (this is the default).
630   --without-sgi-ext       Do not compile in support for this extension.],
631   [with_sgi="$withval"; with_sgi_req="$withval"],[with_sgi=yes])
632
633 HANDLE_X_PATH_ARG(with_sgi, --with-sgi-ext, SGI SCREEN_SAVER)
634
635 if test "$with_sgi" = yes; then
636   AC_CHECK_X_HEADER(X11/extensions/XScreenSaver.h,
637                     [have_sgi=yes
638                      AC_DEFINE(HAVE_SGI_SAVER_EXTENSION)])
639
640 elif test "$with_sgi" != no; then
641   echo "error: must be yes or no: --with-sgi-ext=$with_sgi"
642   exit 1
643 fi
644
645 # Check for the MIT-SCREEN-SAVER server extension header,
646 # unless the SGI extension has already been found.
647 #
648 have_mit=no
649 with_mit_req=unspecified
650 AC_ARG_WITH(mit-ext,
651 [  --with-mit-ext          Include support for the MIT-SCREEN-SAVER
652                           server extension, if possible (this is the default).
653   --without-mit-ext       Do not compile in support for this extension.],
654   [with_mit="$withval"; with_mit_req="$withval"],[with_mit=yes])
655
656 HANDLE_X_PATH_ARG(with_mit, --with-mit-ext, MIT-SCREEN-SAVER)
657
658 if test "$have_sgi" != yes; then
659   if test "$with_mit" = yes; then
660     AC_CHECK_X_HEADER(X11/extensions/scrnsaver.h, [have_mit=yes])
661
662     # Now check to see if it's really in the library; XF86Free-3.3 ships
663     # scrnsaver.h, but doesn't include the code in libXext.a, the idiots!
664     #
665     if test "$have_mit" = yes; then
666       AC_CHECK_X_LIB(Xext, XScreenSaverRegister, [], [have_mit=no], -lm)
667
668       if test "$have_mit" = no; then
669         # Fuck!  Looks like XF86Free-3.3 actually puts it in XExExt instead
670         # of in Xext.  Thank you master, may I have another.
671         AC_CHECK_X_LIB(XExExt, XScreenSaverRegister,
672                        [have_mit=yes; SAVER_LIBS="$SAVER_LIBS -lXExExt"],
673                        [], -lX11 -lXext -lm)
674       fi
675
676       if test "$have_mit" = no; then
677         # Double fuck!  Looks like some versions of XFree86 (whichever version
678         # it is that comes with RedHat Linux 2.0 -- I can't find a version 
679         # number) put this garbage in Xss instead of Xext.  Thank you master,
680         #  may I have another.
681         AC_CHECK_X_LIB(Xss, XScreenSaverRegister,
682                        [have_mit=yes; SAVER_LIBS="$SAVER_LIBS -lXss"],
683                        [], -lX11 -lXext -lm)
684       fi
685
686     if test "$have_mit" = yes; then
687       AC_DEFINE(HAVE_MIT_SAVER_EXTENSION)
688     fi
689
690     fi
691
692   elif test "$with_mit" != no; then
693     echo "error: must be yes or no: --with-mit-ext=$with_mit"
694     exit 1
695   fi
696 fi
697
698
699 # Check for the XIDLE server extension header.
700 #
701 have_xidle=no
702 with_xidle_req=unspecified
703 AC_ARG_WITH(xidle-ext,
704 [  --with-xidle-ext        Include support for the XIDLE server extension,
705                           if possible (this is the default).
706   --without-xidle-ext     Do not compile in support for this extension.],
707   [with_xidle="$withval"; with_xidle_req="$withval"],[with_xidle=yes])
708
709 HANDLE_X_PATH_ARG(with_xidle, --with-xidle-ext, XIDLE)
710
711 if test "$with_xidle" = yes; then
712   AC_CHECK_X_HEADER(X11/extensions/xidle.h,
713                     [have_xidle=yes
714                      AC_DEFINE(HAVE_XIDLE_EXTENSION)])
715 elif test "$with_xidle" != no; then
716   echo "error: must be yes or no: --with-xidle-ext=$with_xidle"
717   exit 1
718 fi
719
720
721 # Check for the XSHM server extension header.
722 #
723 have_xshm=no
724 with_xshm_req=unspecified
725 AC_ARG_WITH(xshm-ext,
726 [  --with-xshm-ext         Include support for the XSHM (Shared Memory) server
727                           extension, if possible (this is the default).
728   --without-xshm-ext      Do not compile in support for this extension.],
729   [with_xshm="$withval"; with_xshm_req="$withval"],[with_xshm=yes])
730
731 HANDLE_X_PATH_ARG(with_xshm, --with-xshm-ext, XSHM)
732
733 if test "$with_xshm" = yes; then
734
735   # first check for Xshm.h.
736   AC_CHECK_X_HEADER(X11/extensions/XShm.h, [have_xshm=yes])
737
738   # if that succeeded, then check for sys/ipc.h.
739   if test "$have_xshm" = yes; then
740     have_xshm=no
741     AC_CHECK_X_HEADER(sys/ipc.h, [have_xshm=yes])
742   fi
743
744   # if that succeeded, then check for sys/shm.h.
745   if test "$have_xshm" = yes; then
746     have_xshm=no
747     AC_CHECK_X_HEADER(sys/shm.h, [have_xshm=yes])
748   fi
749
750   # AIX is pathological, as usual: apparently it's normal for the Xshm headers
751   # to exist, but the library code to not exist.  And even better, the library
752   # code is in its own library: libXextSam.a.  So, if we're on AIX, and that
753   # lib doesn't exist, give up.
754   #
755   case "$host" in
756     *-aix*)
757       have_xshm=no
758       AC_CHECK_X_LIB(XextSam, XShmQueryExtension,
759                      [have_xshm=yes; SAVER_LIBS="$SAVER_LIBS -lXextSam"],
760                        [], -lX11 -lXext -lm)
761     ;;
762   esac
763
764   # if that succeeded, then we've really got it.
765   if test "$have_xshm" = yes; then
766     AC_DEFINE(HAVE_XSHM_EXTENSION)
767   fi
768
769 elif test "$with_xshm" != no; then
770   echo "error: must be yes or no: --with-xshm-ext=$with_xshm"
771   exit 1
772 fi
773
774
775 # Check for the SGI-VIDEO-CONTROL server extension header.
776 #
777 have_sgivc=no
778 with_sgivc_req=unspecified
779 AC_ARG_WITH(sgivc-ext,
780 [  --with-sgivc-ext        Include support for the SGI-VIDEO-CONTROL server
781                           extension, if possible (this is the default).
782   --without-sgivc-ext     Do not compile in support for this extension.],
783   [with_sgivc="$withval"; with_sgivc_req="$withval"],[with_sgivc=yes])
784
785 HANDLE_X_PATH_ARG(with_sgivc, --with-sgivc-ext, SGI-VIDEO-CONTROL)
786
787 if test "$with_sgivc" = yes; then
788
789   # first check for XSGIvc.h
790   AC_CHECK_X_HEADER(X11/extensions/XSGIvc.h, [have_sgivc=yes])
791
792   # if that succeeded, then check for the -lXsgivc
793   if test "$have_sgivc" = yes; then
794     have_sgivc=no
795     AC_CHECK_X_LIB(Xsgivc, XSGIvcQueryGammaMap,
796                   [have_sgivc=yes; SAVER_LIBS="$SAVER_LIBS -lXsgivc"], [],
797                   -lXext -lX11)
798   fi
799
800   # if that succeeded, then we've really got it.
801   if test "$have_sgivc" = yes; then
802     AC_DEFINE(HAVE_SGI_VC_EXTENSION)
803   fi
804
805 elif test "$with_sgivc" != no; then
806   echo "error: must be yes or no: --with-sgivc-ext=$with_sgivc"
807   exit 1
808 fi
809
810
811 # Check for the DPMS server extension header.
812 #
813 have_dpms=no
814 with_dpms_req=unspecified
815 AC_ARG_WITH(dpms-ext,
816 [  --with-dpms-ext         Include support for the DPMS server extension,
817                           if possible (this is the default).
818   --without-dpms-ext      Do not compile in support for this extension.],
819   [with_dpms="$withval"; with_dpms_req="$withval"],[with_dpms=yes])
820
821 HANDLE_X_PATH_ARG(with_dpms, --with-dpms-ext, DPMS)
822
823 if test "$with_dpms" = yes; then
824
825   # first check for dpms.h
826   AC_CHECK_X_HEADER(X11/extensions/dpms.h, [have_dpms=yes])
827
828   # if that succeeded, then check for the -lXdpms
829   if test "$have_dpms" = yes; then
830     have_dpms=no
831     AC_CHECK_X_LIB(Xdpms, DPMSInfo,
832                   [have_dpms=yes; SAVER_LIBS="$SAVER_LIBS -lXdpms"], [],
833                   -lXext -lX11)
834   fi
835
836   # if that succeeded, then we've really got it.
837   if test "$have_dpms" = yes; then
838     AC_DEFINE(HAVE_DPMS_EXTENSION)
839   fi
840
841 elif test "$with_dpms" != no; then
842   echo "error: must be yes or no: --with-dpms-ext=$with_dpms"
843   exit 1
844 fi
845
846
847
848 # Check for Motif and Athena --with and --without arguments.
849 #
850 have_motif=no
851 have_athena=no
852 have_athena3d=no
853 with_motif_req=unspecified
854 with_athena_req=unspecified
855
856 AC_ARG_WITH(motif,[
857 X Client Toolkit options:
858
859   --with-motif            Use the Motif toolkit for the user interface, if
860                           possible (this is the default).
861   --without-motif         Do not use Motif.],
862   [with_motif="$withval"; with_motif_req="$withval"],[with_motif=no])
863
864 HANDLE_X_PATH_ARG(with_motif, --with-motif, Motif)
865
866 AC_ARG_WITH(athena,
867 [  --with-athena           Use the Athena toolkit for the user interface, if
868                           possible (this is the default if Motif isn't used.)
869   --without-athena        Do not use Athena.],
870   [with_athena="$withval"; with_athena_req="$withval"],[with_athena=no])
871
872 HANDLE_X_PATH_ARG(with_athena, --with-athena, Athena)
873
874 if test "$with_motif" != yes -a "$with_motif" != no ; then
875   echo "error: must be yes or no: --with-motif=$with_motif"
876   exit 1
877 fi
878
879 if test "$with_athena" != yes -a "$with_athena" != no ; then
880   echo "error: must be yes or no: --with-athena=$with_athena"
881   exit 1
882 fi
883
884
885 # Saying --without-motif is the same as saying --with-athena.
886 if test "$with_motif_req" = no ; then
887   with_athena_req=yes
888   with_athena=yes
889 fi
890
891 # Saying --without-athena is the same as saying --with-motif.
892 if test "$with_athena_req" = no ; then
893   with_motif_req=yes
894   with_motif=yes
895 fi
896
897 # Check for Motif and Athena headers.
898
899 check_motif() {
900   AC_CHECK_X_HEADER(Xm/Xm.h,
901                     [have_motif=yes
902                      AC_DEFINE(HAVE_MOTIF)
903                      TOOLKIT_LIBS="-lXm $TOOLKIT_LIBS"])
904 }
905
906 check_athena() {
907   have_athena=no
908   have_athena3d=no
909   AC_CHECK_X_HEADER(X11/Xaw/Dialog.h, [have_athena=yes])
910   if test "$have_athena" = yes; then
911     AC_CHECK_X_LIB(Xaw3d, Xaw3dComputeTopShadowRGB,
912                    [have_athena=yes; have_athena3d=yes], [],
913                    -lXt -lXmu -lXext -lX11)
914   fi
915
916   if test "$have_athena3d" = yes; then
917     TOOLKIT_LIBS="-lXaw3d $TOOLKIT_LIBS"
918   elif test "$have_athena" = yes; then
919     TOOLKIT_LIBS="-lXaw $TOOLKIT_LIBS"
920   fi
921 }
922
923
924 # If they asked for both motif and athena, check motif then athena.
925 # If they asked for only motif, check motif then athena.
926 # If they asked for only athena, check athena then motif.
927 # If they asked for neither, check motif then athena.
928
929 proselytize_motif=yes
930 if test "$with_motif" = yes; then
931   # asked for both, or for motif only
932   check_motif
933   if test "$have_motif" = yes; then
934     with_athena=no
935     with_athena_req=no
936   else
937     check_athena
938   fi
939
940 elif test "$with_athena" = yes; then
941   # asked for athena only
942   check_athena
943   if test "$have_athena" = yes; then
944     with_motif=no
945     proselytize_motif=no
946   else
947     check_motif
948   fi
949
950 else
951   # asked for neither
952   check_motif
953   if test "$have_motif" = yes; then
954     with_athena=no
955   else
956     check_athena
957   fi
958
959 fi
960
961 if test "$have_motif" = yes; then
962   proselytize_motif=no
963 fi
964
965 # If we have Athena, check whether it's a version that includes
966 # XawViewportSetCoordinates in Viewport.h (R3 (or R4?) don't.)
967 if test "$have_athena" = yes ; then
968   AC_CACHE_CHECK([for XawViewportSetCoordinates in Viewport.h], 
969                  ac_cv_have_XawViewportSetCoordinates,
970                  [ac_cv_have_XawViewportSetCoordinates=no
971                   AC_EGREP_X_HEADER(XawViewportSetCoordinates, 
972                                     X11/Xaw/Viewport.h,
973                                     ac_cv_have_XawViewportSetCoordinates=yes)])
974   if test "$ac_cv_have_XawViewportSetCoordinates" = yes ; then
975     AC_DEFINE(HAVE_XawViewportSetCoordinates)
976   fi
977 fi
978
979
980 # If we have Motif, check whether it's really LessTif.
981 #
982 have_lesstif=no
983 if test "$have_motif" = yes ; then
984   AC_CACHE_CHECK([whether Motif is really LessTif], 
985                  ac_cv_have_lesstif,
986                  [AC_TRY_X_COMPILE([#include <Xm/Xm.h>],
987                                    [long vers = LesstifVersion;],
988                                    [ac_cv_have_lesstif=yes],
989                                    [ac_cv_have_lesstif=no])])
990   have_lesstif=$ac_cv_have_lesstif
991 fi
992
993 # don't cache these
994 unset ac_cv_lesstif_version
995 unset ac_cv_lesstif_version_string
996
997 lesstif_version=unknown
998 lesstif_version_string=unknown
999
1000 if test "$have_lesstif" = yes ; then
1001   ltv=unknown
1002   echo unknown > conftest-lt
1003   AC_CACHE_CHECK([LessTif version number],
1004                  ac_cv_lesstif_version_string,
1005       [AC_TRY_X_RUN([#include <stdio.h>
1006                      #include <Xm/Xm.h>
1007                      int main() {
1008                        FILE *f = fopen("conftest-lt", "w");
1009                        if (!f) exit(1);
1010                        fprintf(f, "%d %d.%d\n", LesstifVersion,
1011                           LESSTIF_VERSION, LESSTIF_REVISION);
1012                        fclose(f);
1013                        exit(0);
1014                      }],
1015                     [ltv=`cat conftest-lt`
1016                      ac_cv_lesstif_version=`echo $ltv | sed 's/ .*//'`
1017                      ac_cv_lesstif_version_string=`echo $ltv | sed 's/.* //'`],
1018                     [ac_cv_lesstif_version=unknown
1019                      ac_cv_lesstif_version_string=unknown],
1020                     [ac_cv_lesstif_version=unknown
1021                      ac_cv_lesstif_version_string=unknown])])
1022   rm -f conftest-lt
1023   lesstif_version=$ac_cv_lesstif_version
1024   lesstif_version_string=$ac_cv_lesstif_version_string
1025
1026 fi
1027
1028
1029 # Some versions of Motif (2.1.0, at least) require -lXp, the "X Printing
1030 # Extension".   Why this extension isn't in -lXext with all the others,
1031 # I have no idea.
1032 #
1033 have_xp_ext=no
1034 if test "$have_motif" = yes ; then
1035    have_xp_ext=no
1036    AC_CHECK_X_LIB(Xp, XpQueryExtension,
1037                   [have_xp_ext=yes; TOOLKIT_LIBS="$TOOLKIT_LIBS -lXp"],
1038                   [], -lX11 -lXext -lm)
1039 fi
1040
1041
1042 # Check for _Xsetlocale in -lXintl, since at least some recent versions
1043 # of Motif (on Linux) need it.
1044 #
1045 have_xintl=no
1046 if test "$have_motif" = yes ; then
1047   AC_CHECK_X_LIB(Xintl, _Xsetlocale, [have_xintl=yes], [have_xintl=no],
1048                  -lX11 -lXext -lm)
1049   if test "$have_xintl" = yes; then
1050     TOOLKIT_LIBS="$TOOLKIT_LIBS -lXintl"
1051   fi
1052 fi
1053
1054
1055 # check for XPM header.
1056 #
1057 have_xpm=no
1058 with_xpm_req=unspecified
1059 AC_ARG_WITH(xpm,[
1060 Graphics Demo options:
1061
1062   --with-xpm              Include support for XPM files in some demos,
1063                           if possible (this is the default).
1064   --without-xpm           Do not compile in support for XPM files.],
1065   [with_xpm="$withval"; with_xpm_req="$withval"],[with_xpm=yes])
1066
1067 HANDLE_X_PATH_ARG(with_xpm, --with-xpm, XPM)
1068
1069 if test "$with_xpm" = yes; then
1070   AC_CHECK_X_HEADER(X11/xpm.h,
1071                    [have_xpm=yes
1072                     AC_DEFINE(HAVE_XPM)
1073                     XPM_LIBS="-lXpm"])
1074 elif test "$with_xpm" != no; then
1075   echo "error: must be yes or no: --with-xpm=$with_xpm"
1076   exit 1
1077 fi
1078
1079
1080 # check for the GL header
1081 #
1082 have_gl=no
1083 ac_have_mesa_gl=no
1084 with_gl_req=unspecified
1085 AC_ARG_WITH(gl,
1086 [  --with-gl               Build those demos which depend on OpenGL,
1087                           if possible (this is the default).
1088   --without-gl            Do not build the OpenGL demos.],
1089   [with_gl="$withval"; with_gl_req="$withval"],[with_gl=yes])
1090
1091 HANDLE_X_PATH_ARG(with_gl, --with-gl, GL)
1092
1093 ac_mesagl_version=unknown
1094 ac_mesagl_version_string=unknown
1095
1096 if test "$with_gl" = yes; then
1097   AC_CHECK_X_HEADER(GL/gl.h, have_gl=yes, have_gl=no)
1098   if test "$have_gl" = yes ; then
1099     AC_CHECK_X_HEADER(GL/glx.h, have_gl=yes, have_gl=no)
1100   fi
1101
1102   # If we have the headers, try and figure out which vendor it's from.
1103   #
1104   if test "$have_gl" = yes ; then
1105
1106     AC_DEFINE(HAVE_GL)
1107
1108     # We need to know whether it's MesaGL so that we know which libraries
1109     # to link against.
1110     #
1111     AC_MSG_CHECKING(whether GL is really MesaGL)
1112     AC_CACHE_VAL(ac_cv_have_mesa_gl,
1113       [ac_cv_have_mesa_gl=no
1114        AC_EGREP_X_HEADER(Mesa, GL/glx.h, [ac_cv_have_mesa_gl=yes])
1115       ])
1116     ac_have_mesa_gl=$ac_cv_have_mesa_gl
1117     AC_MSG_RESULT($ac_have_mesa_gl)
1118
1119     if test "$ac_have_mesa_gl" = no ; then
1120       gl_lib_1="GL"
1121       GL_LIBS="-lGL -lGLU"
1122     else
1123       AC_DEFINE(HAVE_MESA_GL)
1124       gl_lib_1="MesaGL"
1125       GL_LIBS="-lMesaGL -lMesaGLU"
1126     fi
1127
1128
1129     # If it's MesaGL, we'd like to issue a warning if the version number
1130     # is less than or equal to 2.6, because that version had a security bug.
1131     #
1132     if test "$ac_have_mesa_gl" = yes; then
1133
1134       # don't cache these.
1135       unset ac_cv_mesagl_version
1136       unset ac_cv_mesagl_version_string
1137
1138       AC_MSG_CHECKING(MesaGL version number)
1139       AC_CACHE_VAL(ac_cv_mesagl_version_string,
1140         [cat > conftest.$ac_ext <<EOF
1141 #line __oline__ "configure"
1142 #include "confdefs.h"
1143 #include <GL/gl.h>
1144 configure: MESA_MAJOR_VERSION MESA_MINOR_VERSION
1145 EOF
1146
1147          ac_save_CPPFLAGS="$CPPFLAGS"
1148          if test \! -z "$includedir" ; then 
1149            CPPFLAGS="$CPPFLAGS -I$includedir"
1150          fi
1151          CPPFLAGS="$CPPFLAGS $X_CFLAGS"
1152
1153           # M4 sucks!!
1154          changequote(X,Y)
1155          mglv=`(eval "$ac_cpp conftest.$ac_ext") 2>&AC_FD_CC | sed -n \
1156               's/^configure:.*\([0-9][0-9]*\).*\([0-9][0-9]*\).*$/\1.\2/p'`
1157          changequote([,])
1158
1159          rm -f conftest.$ac_ext
1160
1161          CPPFLAGS="$ac_save_CPPFLAGS"
1162
1163          if test "$mglv" = ""; then
1164            ac_mesagl_version=unknown
1165            ac_mesagl_version_string=unknown
1166          else
1167            ac_mesagl_version_string=$mglv
1168            maj=`echo $mglv | sed -n 's/\..*//p'`
1169            min=`echo $mglv | sed -n 's/.*\.//p'`
1170            ac_mesagl_version=`echo "$maj * 1000 + $min" | bc`
1171            if test -z "$ac_mesagl_version"; then
1172              ac_mesagl_version=unknown
1173              ac_mesagl_version_string=unknown
1174            fi
1175          fi
1176          ac_cv_mesagl_version=$ac_mesagl_version
1177          ac_cv_mesagl_version_string=$ac_mesagl_version_string
1178       ])
1179       ac_mesagl_version=$ac_cv_mesagl_version
1180       ac_mesagl_version_string=$ac_cv_mesagl_version_string
1181       AC_MSG_RESULT($ac_cv_mesagl_version_string)
1182     fi
1183
1184
1185     # If it's MesaGL, check to see if it requires -lpthread.
1186     #
1187     have_pthread=no
1188     mesa_requires_pthread=false
1189     if test "$ac_have_mesa_gl" = yes; then
1190
1191       AC_CHECK_LIB(pthread, pthread_create, [have_pthread=yes], [],)
1192       if test "$have_pthread" = yes; then
1193         AC_CHECK_X_LIB($gl_lib_1, gl_get_thread_context,
1194                        [mesa_requires_pthread=yes], [],
1195                        $GL_LIBS -lpthread -lX11 -lXext -lm)
1196       fi
1197
1198       if test "$mesa_requires_pthread" = yes; then
1199         GL_LIBS="$GL_LIBS -lpthread"
1200       fi
1201     fi
1202
1203     # Check for OpenGL 1.1 features.
1204     #
1205     AC_CHECK_X_LIB($gl_lib_1, glBindTexture, [AC_DEFINE(HAVE_GLBINDTEXTURE)],
1206                    [], $GL_LIBS -lX11 -lXext -lm)
1207
1208   fi
1209
1210 elif test "$with_gl" != no; then
1211   echo "error: must be yes or no: --with-gl=$with_gl"
1212   exit 1
1213 fi
1214
1215
1216 # check for SGI XReadDisplay server extension header.
1217 #
1218 have_readdisplay=no
1219 with_readdisplay_req=unspecified
1220 AC_ARG_WITH(readdisplay,
1221 [  --with-readdisplay      Include support for the XReadDisplay server
1222                           extension if possible (this is the default).
1223   --without-readdisplay   Do not compile in support for this extension.],
1224   [with_readdisplay="$withval"; with_readdisplay_req="$withval"],
1225   [with_readdisplay=yes])
1226
1227 HANDLE_X_PATH_ARG(with_readdisplay, --with-readdisplay, XReadDisplay)
1228
1229 if test "$with_readdisplay" = yes; then
1230   AC_CHECK_X_HEADER(X11/extensions/readdisplay.h,
1231                     AC_DEFINE(HAVE_READ_DISPLAY_EXTENSION))
1232 elif test "$with_readdisplay" != no; then
1233   echo "error: must be yes or no: --with-readdisplay=$with_readdisplay"
1234   exit 1
1235 fi
1236
1237
1238 # check for SGI's Iris Video Library header.
1239 #
1240 have_sgivideo=no
1241 with_sgivideo_req=unspecified
1242 AC_ARG_WITH(sgivideo,
1243 [  --with-sgivideo         Include support for SGI's Iris Video Library
1244                           if possible (this is the default).
1245   --without-sgivideo       Do not compile in support for this library.],
1246   [with_sgivideo="$withval"; with_sgivideo_req="$withval"],
1247   [with_sgivideo=yes])
1248
1249 HANDLE_X_PATH_ARG(with_sgivideo, --with-sgivideo, Iris Video)
1250
1251 if test "$with_sgivideo" = yes; then
1252   AC_CHECK_X_HEADER(dmedia/vl.h, have_sgivideo=yes)
1253   if test "$have_sgivideo" = yes; then
1254     have_sgivideo=no
1255     AC_CHECK_LIB(vl, vlOpenVideo, have_sgivideo=yes)
1256     if test "$have_sgivideo" = yes; then
1257       SGI_VIDEO_OBJS="$(UTILS_BIN)/sgivideo.o"
1258       SGI_VIDEO_LIBS="-lvl"
1259       AC_DEFINE(HAVE_SGI_VIDEO)
1260     fi
1261   fi
1262 elif test "$with_sgivideo" != no; then
1263   echo "error: must be yes or no: --with-sgivideo=$with_sgivideo"
1264   exit 1
1265 fi
1266
1267
1268
1269 # Try to find a program to generate random text.
1270 #
1271 # Zippy is funnier than the idiocy generally spat out by `fortune',
1272 # so try to find that, by invoking Emacs and asking it where its 
1273 # libexec directory is ("yow" lives in there.)
1274 #
1275 # If that doesn't work, see if fortune, zippy, or yow are on $PATH,
1276 # and if so, use them.
1277 #
1278 # If that doesn't work, look in /usr/games, and if it's there, use
1279 # the full pathname.
1280 #
1281 with_zippy_req=""
1282 AC_ARG_WITH(zippy,
1283 [  --with-zippy=PROGRAM    Some demos are able to run an external program and
1284                           display its text; this names the program to use by
1285                           default (though it can be overridden with X
1286                           resources.)  If you don't specify this, the default
1287                           is to use \"yow\" from the Emacs distribution (if you
1288                           have it) or else to use \"fortune\".],
1289   [ with_zippy_req="$withval"; with_zippy="$withval" ],
1290   [ with_zippy_req="$withval"; with_zippy="$withval" ])
1291
1292 if test "$with_zippy" = no || test "$with_zippy" = yes ; then
1293   with_zippy=""
1294   with_zippy_req=""
1295 fi
1296
1297 if test -n "$with_zippy_req" ; then
1298   ac_cv_zippy_program=""
1299   case "$with_zippy_req" in
1300     /*)
1301       AC_MSG_CHECKING([for $with_zippy_req])
1302       if test -x "$with_zippy_req" ; then
1303         AC_MSG_RESULT(yes)
1304       else
1305         AC_MSG_RESULT(no)
1306         with_zippy=""
1307       fi
1308     ;;
1309     *)
1310       # don't cache
1311       unset ac_cv_path_zip2
1312       AC_PATH_PROG(zip2, $with_zippy_req, [])
1313       if test "$zip2" = ""; then
1314         with_zippy=""
1315       fi
1316     ;;
1317   esac
1318   ac_cv_zippy_program="$with_zippy"
1319
1320 elif test -n "$ac_cv_zippy_program"; then
1321   AC_MSG_RESULT([checking for zippy... (cached) $ac_cv_zippy_program])
1322 fi
1323
1324 if test ! -n "$ac_cv_zippy_program"; then
1325
1326   AC_CHECK_PROGS(emacs_exe, emacs)
1327   AC_CHECK_PROGS(xemacs_exe, xemacs)
1328
1329   ac_cv_zippy_program=""
1330   eargs='-batch -q -nw --eval'
1331
1332   if test -n "$emacs_exe" ; then
1333     AC_MSG_CHECKING([for emacs yow])
1334     #
1335     # get emacs to tell us where the libexec directory is.
1336     #
1337     dir=`$emacs_exe $eargs '(princ (concat exec-directory "\n"))' \
1338          2>/dev/null | tail -1`
1339     dir=`echo "$dir" | sed 's@///*@/@g;s@/$@@'`
1340     #
1341     # try running libexec/yow and see if it exits without error.
1342     #
1343     if test x"$dir" != x -a -x "$dir/yow" ; then
1344       if $dir/yow >&- 2>&- ; then
1345         ac_cv_zippy_program="$dir/yow"
1346         AC_MSG_RESULT($ac_cv_zippy_program)
1347       else
1348         AC_MSG_RESULT(no)
1349       fi
1350     fi
1351   fi
1352
1353   if test -z "$ac_cv_zippy_program" ; then
1354     AC_MSG_CHECKING([for xemacs yow])
1355     if test -n "$xemacs_exe" ; then
1356       #
1357       # get xemacs to tell us where the libexec directory is.
1358       #
1359       dir=`$xemacs_exe $eargs '(princ (concat exec-directory "\n"))' \
1360            2>/dev/null | tail -1`
1361       dir=`echo "$dir" | sed 's@///*@/@g;s@/$@@'`
1362       #
1363       # try running libexec/yow and see if it exits without error.
1364       #
1365       if test x"$dir" != x -a -x "$dir/yow" ; then
1366         if $dir/yow >&- 2>&- ; then
1367           ac_cv_zippy_program="$dir/yow"
1368           AC_MSG_RESULT($ac_cv_zippy_program)
1369         else
1370           #
1371           # in some xemacs installations, the pathname of the yow.lines file
1372           # isn't hardcoded into the yow executable, and must be passed on 
1373           # the command line.  See if it's in libexec/../etc/.
1374
1375           # M4 sucks!!
1376           changequote(X,Y)
1377           dir_up=`echo "$dir" | sed 's@/[^/]*$@@'`
1378           changequote([,])
1379
1380           yow="yow -f $dir_up/etc/yow.lines"
1381           if $dir/$yow >&- 2>&- ; then
1382             ac_cv_zippy_program="$dir/$yow"
1383             AC_MSG_RESULT($ac_cv_zippy_program)
1384           else
1385             AC_MSG_RESULT(no)
1386           fi
1387         fi
1388       fi
1389     fi
1390   fi
1391
1392   # if that didn't work, try for some other programs...
1393   if test -z "$ac_cv_zippy_program" ; then
1394     fortune=''
1395     AC_CHECK_PROGS(fortune, [fortune zippy yow])
1396     # if that didn't work, try for those programs in /usr/games...
1397     if test -z "$fortune" ; then
1398       AC_PATH_PROGS(fortune, [fortune zippy yow], fortune,
1399                     /usr/games:/usr/local/games)
1400     fi
1401   fi
1402 fi
1403
1404 if test -z "$ac_cv_zippy_program" ; then
1405   ac_cv_zippy_program=fortune
1406 fi
1407
1408 AC_DEFINE_UNQUOTED(ZIPPY_PROGRAM, "$ac_cv_zippy_program")
1409
1410
1411
1412
1413 # Allow locking to be disabled at compile-time.
1414 #
1415 have_kerberos=no
1416 with_kerberos_req=unspecified
1417 have_shadow=no
1418 with_shadow_req=unspecified
1419 have_pam=no
1420 with_pam_req=unspecified
1421 need_setuid=no
1422
1423 AC_ARG_ENABLE(locking,[
1424 Screen Locking options:
1425
1426   --enable-locking        Compile in support for locking the display
1427                           (this is the default.)
1428   --disable-locking       Do not allow locking at all.],
1429   [enable_locking="$enableval"],[enable_locking=yes])
1430 if test "$enable_locking" = yes; then
1431   true
1432 elif test "$enable_locking" = no; then
1433   AC_DEFINE(NO_LOCKING)
1434 else
1435   echo "error: must be yes or no: --enable-locking=$enable_locking"
1436   exit 1
1437 fi
1438
1439
1440
1441 # Check to see if we can lock Virtual-Terminal switching, but allow that 
1442 # to be disabled at compile-time.
1443 #
1444 ac_vt_lockswitch=no
1445 AC_ARG_ENABLE(vt-locking,[
1446   --enable-vt-locking     Compile in support for locking Virtual Terminals.
1447                           This is the default if the system supports it, and
1448                           if locking support is included (--enable-locking.)
1449   --disable-vt-locking    Do not allow locking of VTs, even if locking is
1450                           enabled.],
1451   [enable_vt_locking="$enableval"],[enable_vt_locking=yes])
1452 if test "$enable_vt_locking" = yes; then
1453
1454   AC_MSG_CHECKING(for the VT_LOCKSWITCH ioctl)
1455   AC_CACHE_VAL(ac_cv_vt_lockswitch,
1456    [AC_TRY_COMPILE([#include <fcntl.h>
1457                     #include <sys/ioctl.h>
1458                     #include <sys/vt.h>],
1459                    [int x = VT_LOCKSWITCH; int y = VT_UNLOCKSWITCH;],
1460                    [ac_cv_vt_lockswitch=yes],
1461                    [ac_cv_vt_lockswitch=no])])
1462   ac_vt_lockswitch=$ac_cv_vt_lockswitch
1463   AC_MSG_RESULT($ac_vt_lockswitch)
1464
1465 elif test "$enable_locking" = no; then
1466   true
1467 else
1468   echo "error: must be yes or no: --enable-vt-locking=$enable_vt_locking"
1469   exit 1
1470 fi
1471
1472 if test "$ac_vt_lockswitch" = yes; then
1473   AC_DEFINE(HAVE_VT_LOCKSWITCH)
1474   # the VT_LOCKSWITCH ioctl can only be used when running as root.
1475   # #### but it doesn't work yet, so don't worry about that for now.
1476 #  need_setuid=yes
1477 fi
1478
1479
1480
1481 if test "$enable_locking" = yes; then
1482
1483   # Check for Kerberos.
1484   #
1485   AC_ARG_WITH(kerberos, [
1486   --with-kerberos         Include support for Kerberos authentication,
1487                           if possible (this is the default.)
1488   --without-kerberos      Do not compile in support for Kerberos.],
1489   [with_kerberos="$withval"; with_kerberos_req="$withval"],[with_kerberos=yes])
1490
1491   HANDLE_X_PATH_ARG(with_kerberos, --with-kerberos, Kerberos)
1492
1493   if test "$with_kerberos" = yes; then
1494     AC_CACHE_CHECK([for Kerberos], ac_cv_kerberos,
1495                    [AC_TRY_X_COMPILE([#include <krb.h>],,
1496                                      [ac_cv_kerberos=yes],
1497                                      [ac_cv_kerberos=no])])
1498     if test "$ac_cv_kerberos" = yes ; then
1499       have_kerberos=yes
1500       AC_DEFINE(HAVE_KERBEROS)
1501
1502       # from Tim Showalter <tjs+@andrew.cmu.edu>
1503       PASSWD_LIBS="$PASSWD_LIBS -lkrb -ldes"
1504       AC_CHECK_FUNC(res_search,,
1505         AC_CHECK_LIB(resolv,res_search,PASSWD_LIBS="${PASSWD_LIBS} -lresolv",
1506           AC_MSG_WARN([Can't find DNS resolver libraries needed for Kerberos])
1507         ))
1508
1509     fi
1510   elif test "$with_kerberos" != no; then
1511     echo "error: must be yes or no: --with-kerberos=$with_kerberos"
1512     exit 1
1513   fi
1514   
1515   # Check for PAM.
1516   AC_ARG_WITH(pam,
1517 [  --with-pam              Include support for PAM (Pluggable Authentication
1518                           Modules) if possible (this is the default.)
1519   --without-pam           Do not compile in support for PAM.],
1520   [with_pam="$withval"; with_pam_req="$withval"],[with_pam=no])
1521 #### Leave PAM off by default for now, since it's buggy on Solaris
1522 #### (and probably Linux, but it's so hard to tell...)
1523
1524   HANDLE_X_PATH_ARG(with_pam, --with-pam, PAM)
1525
1526   if test "$with_pam" = yes; then
1527     AC_CACHE_CHECK([for PAM], ac_cv_pam,
1528                    [AC_TRY_X_COMPILE([#include <security/pam_appl.h>],,
1529                                      [ac_cv_pam=yes],
1530                                      [ac_cv_pam=no])])
1531     if test "$ac_cv_pam" = yes ; then
1532           have_pam=yes
1533           AC_DEFINE(HAVE_PAM)
1534           PASSWD_LIBS="${PASSWD_LIBS} -lpam -ldl"
1535     fi
1536   elif test "$with_pam" != no; then
1537         echo "error: must be yes or no: --with-pam=$with_pam"
1538         exit 1
1539   fi
1540
1541   # Next, check for the nine billion variants of shadow passwords...
1542
1543   pwent_cruft_done=no
1544   AC_ARG_WITH(shadow,
1545 [  --with-shadow           Include support for shadow password authentication,
1546                           if possible (this is the default, if no Kerberos or
1547                           PAM.)
1548   --without-shadow        Do not compile in support for shadow passwords.
1549 ],
1550   [with_shadow="$withval"; with_shadow_req="$withval"],[with_shadow=yes])
1551
1552   HANDLE_X_PATH_ARG(with_shadow, --with-shadow, shadow password)
1553
1554   if test "$with_shadow" = no; then
1555     pwent_cruft_done=yes
1556   elif test "$with_shadow" != yes; then
1557     echo "error: must be yes or no: --with-shadow=$with_shadow"
1558     exit 1
1559   fi
1560
1561
1562   # Sun's "adjunct" passwords.
1563   #
1564   if test "$pwent_cruft_done" = no ; then
1565     AC_CACHE_CHECK([for Sun-style shadow passwords], ac_cv_sun_adjunct,
1566                    [AC_TRY_X_COMPILE([#include <stdlib.h>
1567                                       #include <unistd.h>
1568                                       #include <sys/types.h>
1569                                       #include <sys/label.h>
1570                                       #include <sys/audit.h>
1571                                       #include <pwdadj.h>],
1572                         [struct passwd_adjunct *p = getpwanam("nobody");
1573                          const char *pw = p->pwa_passwd;],
1574                         [ac_cv_sun_adjunct=yes],
1575                         [ac_cv_sun_adjunct=no])])
1576     if test "$ac_cv_sun_adjunct" = yes; then
1577       have_shadow=yes
1578       need_setuid=yes
1579       pwent_cruft_done=yes
1580       AC_DEFINE(HAVE_ADJUNCT_PASSWD)
1581     fi
1582   fi
1583
1584   # DEC and SCO so-called "enhanced" security.
1585   #
1586   if test "$pwent_cruft_done" = no ; then
1587     AC_CACHE_CHECK([for DEC-style shadow passwords], ac_cv_enhanced_passwd,
1588                    [AC_TRY_X_COMPILE([#include <stdlib.h>
1589                                       #include <unistd.h>
1590                                       #include <sys/types.h>
1591                                       #include <pwd.h>
1592                                       #include <sys/security.h>
1593                                       #include <prot.h>],
1594                         [struct pr_passwd *p;
1595                          const char *pw;
1596                          set_auth_parameters(0, 0);
1597                          check_auth_parameters();
1598                          p = getprpwnam("nobody");
1599                          pw = p->ufld.fd_encrypt;],
1600                         [ac_cv_enhanced_passwd=yes],
1601                         [ac_cv_enhanced_passwd=no])])
1602     if test $ac_cv_enhanced_passwd = yes; then
1603       have_shadow=yes
1604       need_setuid=yes
1605       pwent_cruft_done=yes
1606       AC_DEFINE(HAVE_ENHANCED_PASSWD)
1607
1608       # On SCO, getprpwnam() is in -lprot (which uses nap() from -lx)
1609       # (I'm told it needs -lcurses too, but I don't understand why.)
1610       AC_CHECK_LIB(prot, getprpwnam, 
1611                    [PASSWD_LIBS="$PASSWD_LIBS -lprot -lcurses -lx"],
1612                    [# On DEC, getprpwnam() is in -lsecurity
1613                     AC_CHECK_LIB(security, getprpwnam, 
1614                                  [PASSWD_LIBS="$PASSWD_LIBS -lsecurity"])],
1615                    [-lx])
1616     fi
1617   fi
1618
1619   # HP's entry in the "Not Invented Here" Sweepstakes.
1620   #
1621   if test "$pwent_cruft_done" = no ; then
1622     AC_CACHE_CHECK([for HP-style shadow passwords], ac_cv_hpux_passwd,
1623                    [AC_TRY_X_COMPILE([#include <stdlib.h>
1624                                       #include <unistd.h>
1625                                       #include <sys/types.h>
1626                                       #include <pwd.h>
1627                                       #include <hpsecurity.h>
1628                                       #include <prot.h>],
1629                         [struct s_passwd *p = getspwnam("nobody");
1630                          const char *pw = p->pw_passwd;],
1631                         [ac_cv_hpux_passwd=yes],
1632                         [ac_cv_hpux_passwd=no])])
1633     if test "$ac_cv_hpux_passwd" = yes; then
1634       have_shadow=yes
1635       need_setuid=yes
1636       pwent_cruft_done=yes
1637       AC_DEFINE(HAVE_HPUX_PASSWD)
1638
1639       # on HPUX, bigcrypt is in -lsec
1640       AC_CHECK_LIB(sec, bigcrypt, [PASSWD_LIBS="$PASSWD_LIBS -lsec"])
1641     fi
1642   fi
1643
1644   # Traditional (ha!) shadow passwords.
1645   #
1646   if test "$pwent_cruft_done" = no ; then
1647     AC_CACHE_CHECK([for generic shadow passwords], ac_cv_shadow,
1648                    [AC_TRY_X_COMPILE([#include <stdlib.h>
1649                                       #include <unistd.h>
1650                                       #include <sys/types.h>
1651                                       #include <pwd.h>
1652                                       #include <shadow.h>],
1653                         [struct spwd *p = getspnam("nobody");
1654                          const char *pw = p->sp_pwdp;],
1655                         [ac_cv_shadow=yes],
1656                         [ac_cv_shadow=no])])
1657     if test "$ac_cv_shadow" = yes; then
1658       have_shadow=yes
1659       need_setuid=yes
1660       pwent_cruft_done=yes
1661       AC_DEFINE(HAVE_SHADOW_PASSWD)
1662
1663       # On some systems (UnixWare 2.1), getspnam() is in -lgen instead of -lc.
1664       have_getspnam=no
1665       AC_CHECK_LIB(c, getspnam, [have_getspnam=yes])
1666       if test "$have_getspnam" = no ; then
1667         AC_CHECK_LIB(gen, getspnam,
1668                      [have_getspnam=yes; PASSWD_LIBS="$PASSWD_LIBS -lgen"])
1669       fi
1670     fi
1671   fi
1672
1673   # On FreeBSD, getpwnam() and friends work just like on non-shadow-password
1674   # systems -- except you only get stuff in the pw_passwd field if the running
1675   # program is setuid.  So, guess that we've got this lossage to contend with
1676   # if /etc/master.passwd exists, and default to a setuid installation.
1677   #
1678   if test "$pwent_cruft_done" = no ; then
1679     AC_CACHE_CHECK([for FreeBSD-style shadow passwords], ac_cv_master_passwd,
1680                    [if test -f /etc/master.passwd ; then
1681                       ac_cv_master_passwd=yes
1682                     else
1683                       ac_cv_master_passwd=no
1684                     fi])
1685     if test "$ac_cv_master_passwd" = yes; then
1686       need_setuid=yes
1687       pwent_cruft_done=yes
1688     fi
1689   fi
1690
1691   # On some systems (UnixWare 2.1), crypt() is in -lcrypt instead of -lc.
1692   have_crypt=no
1693   AC_CHECK_LIB(c, crypt, [have_crypt=yes])
1694   if test "$have_crypt" = no ; then
1695     AC_CHECK_LIB(crypt, crypt,
1696                  [have_crypt=yes; PASSWD_LIBS="$PASSWD_LIBS -lcrypt"])
1697   fi
1698
1699
1700   # Most of the above shadow mechanisms will have set need_setuid to yes,
1701   # if they were found.  But, on some systems, we need setuid even when
1702   # using plain old vanilla passwords.
1703   #
1704   if test "$need_setuid" = no ; then
1705     case "$host" in
1706       *-hpux* | *-aix* | *-netbsd* | *-freebsd* | *-openbsd* )
1707         need_setuid=yes
1708       ;;
1709     esac
1710   fi
1711
1712 fi
1713
1714
1715 if test \! -z "$includedir" ; then 
1716   INCLUDES="-I$includedir"
1717 fi
1718
1719 if test \! -z "$libdir" ; then
1720   LDFLAGS="$LDFLAGS -L$libdir"
1721 fi
1722
1723
1724 ##### should have options to override the DEPEND crap, I guess...
1725 DEPEND=makedepend
1726 DEPEND_FLAGS=
1727 DEPEND_DEFINES=
1728
1729
1730 # Done testing things -- now substitute in some stuff for the Makefiles.
1731 #
1732 if test "$have_motif" = yes; then
1733   AC_DEFINE(HAVE_MOTIF)
1734   TOOLKIT_SRCS='$(MOTIF_SRCS)'
1735   TOOLKIT_OBJS='$(MOTIF_OBJS)'
1736 elif test "$have_athena" = yes; then
1737   AC_DEFINE(HAVE_ATHENA)
1738   TOOLKIT_SRCS='$(ATHENA_SRCS)'
1739   TOOLKIT_OBJS='$(ATHENA_OBJS)'
1740 else
1741   TOOLKIT_SRCS=''
1742   TOOLKIT_OBJS=''
1743 fi
1744
1745 if test "$have_kerberos" = yes; then
1746   PASSWD_SRCS="$PASSWD_SRCS \$(KERBEROS_SRCS)"
1747   PASSWD_OBJS="$PASSWD_OBJS \$(KERBEROS_OBJS)"
1748 fi
1749 if test "$have_pam" = yes; then
1750   PASSWD_SRCS="$PASSWD_SRCS \$(PAM_SRCS)"
1751   PASSWD_OBJS="$PASSWD_OBJS \$(PAM_OBJS)"
1752   INSTALL_PAM="install-pam"
1753 fi
1754   PASSWD_SRCS="$PASSWD_SRCS \$(PWENT_SRCS)"
1755   PASSWD_OBJS="$PASSWD_OBJS \$(PWENT_OBJS)"
1756
1757
1758 if test "$enable_locking" = yes; then
1759   LOCK_SRCS='$(LOCK_SRCS_1) $(PASSWD_SRCS)'
1760   LOCK_OBJS='$(LOCK_OBJS_1) $(PASSWD_OBJS)'
1761 else
1762   LOCK_SRCS=''
1763   LOCK_OBJS=''
1764 fi
1765
1766 if test "$need_setuid" = yes; then
1767   NEED_SETUID=yes
1768   INSTALL_SETUID='$(INSTALL) $(SUID_FLAGS)'
1769 else
1770   NEED_SETUID=no
1771   INSTALL_SETUID='$(INSTALL_PROGRAM)'
1772 fi
1773
1774 tab='   '
1775 if test "$have_gl" = yes; then
1776   GL_EXES='$(GL_EXES)'
1777   GL_KLUDGE=${tab}
1778 else
1779   GL_KLUDGE='  -'${tab}
1780 fi
1781
1782 AC_SUBST(INCLUDES)
1783
1784 AC_SUBST(SAVER_LIBS)
1785 AC_SUBST(TOOLKIT_LIBS)
1786 AC_SUBST(HACK_LIBS)
1787 AC_SUBST(XPM_LIBS)
1788 AC_SUBST(GL_LIBS)
1789 AC_SUBST(PASSWD_LIBS)
1790 AC_SUBST(INSTALL_SETUID)
1791 AC_SUBST(INSTALL_DIRS)
1792 AC_SUBST(NEED_SETUID)
1793 AC_SUBST(INSTALL_PAM)
1794 AC_SUBST(SGI_VIDEO_OBJS)
1795 AC_SUBST(SGI_VIDEO_LIBS)
1796
1797 AC_SUBST(TOOLKIT_SRCS)
1798 AC_SUBST(TOOLKIT_OBJS)
1799 AC_SUBST(PASSWD_SRCS)
1800 AC_SUBST(PASSWD_OBJS)
1801 AC_SUBST(XMU_SRCS)
1802 AC_SUBST(XMU_OBJS)
1803 AC_SUBST(LOCK_SRCS)
1804 AC_SUBST(LOCK_OBJS)
1805 AC_SUBST(GL_EXES)
1806 AC_SUBST(GL_KLUDGE)
1807 AC_SUBST(HACKDIR)
1808 AC_SUBST(APPDEFAULTS)
1809
1810 AC_SUBST(DEPEND)
1811 AC_SUBST(DEPEND_FLAGS)
1812 AC_SUBST(DEPEND_DEFINES)
1813
1814 # Print some warnings before emitting the Makefiles.
1815 #
1816 warn_prefix_1="    Warning:"
1817 warn_prefix_2="       Note:"
1818 warn_prefix="$warn_prefix_1"
1819
1820 warning=no
1821 warnsep='    #################################################################'
1822
1823 warnpre() {
1824   if test "$warning" = no ; then
1825     echo '' ; echo "$warnsep" ; echo ''
1826     warning=yes
1827   fi
1828 }
1829
1830 warn() {
1831   warnpre
1832   if test "$warning" = long ; then echo '' ; fi
1833   warning=yes
1834   echo "$warn_prefix $@"
1835 }
1836
1837 warnL() {
1838   was=$warning
1839   warnpre
1840   warning=yes
1841   if test "$was" != no ; then echo '' ; fi
1842   echo "$warn_prefix $@"
1843 }
1844
1845 warn2() {
1846   echo "             $@"
1847   warning=long
1848 }
1849
1850 note() {
1851   warn_prefix="$warn_prefix_2"
1852   warn $@
1853   warn_prefix="$warn_prefix_1"
1854 }
1855
1856 noteL() {
1857   warn_prefix="$warn_prefix_2"
1858   warnL $@
1859   warn_prefix="$warn_prefix_1"
1860 }
1861
1862
1863 if test "$with_sgi_req" = yes -a "$have_sgi" = no ; then
1864   warn 'The SGI saver extension was requested, but was not found.'
1865 fi
1866
1867 if test "$with_mit_req" = yes -a "$have_mit" = no ; then
1868   warn 'The MIT saver extension was requested, but was not found.'
1869 fi
1870
1871 if test "$with_xidle_req" = yes -a "$have_xidle" = no ; then
1872   warn 'The XIdle extension was requested, but was not found.'
1873 fi
1874
1875 if test "$with_xshm_req" = yes -a "$have_xshm" = no ; then
1876   warn 'The XSHM extension was requested, but was not found.'
1877 fi
1878
1879 if test "$with_sgivc_req" = yes -a "$have_sgivc" = no ; then
1880   warn 'The SGI-VIDEO-CONTROL extension was requested, but was not found.'
1881 fi
1882
1883 if test "$with_dpms_req" = yes -a "$have_dpms" = no ; then
1884   warn 'The DPMS extension was requested, but was not found.'
1885 fi
1886
1887 if test "$have_motif" = no -a "$have_athena" = no ; then
1888   warnL "Neither Motif nor Athena widgets seem to be available;"
1889   warn2 "the \`xscreensaver-demo' program requires one or the"
1890   warn2 "other."
1891   proselytize_motif=no
1892
1893 elif test "$with_motif_req" = yes -a "$have_motif" = no ; then
1894   warnL "Use of Motif was requested, but it wasn't found;"
1895   warn2 "Athena will be used instead."
1896
1897 elif test "$with_athena_req" = yes -a "$have_athena" = no ; then
1898   warnL "Use of Athena was requested, but it wasn't found;"
1899   warn2 "Motif will be used instead."
1900 fi
1901
1902 if test "$have_motif" = yes -a "$have_lesstif" = yes ; then
1903
1904   preferred_lesstif=0.86
1905
1906   if test "$lesstif_version" = unknown; then
1907     warnL "Unable to determine the LessTif version number!"
1908     warn2 "Make sure you are using version $preferred_lesstif or newer."
1909     warn2 "See <http://www.lesstif.org/>."
1910
1911   elif test \! $lesstif_version -gt 82; then
1912     warnL "LessTif version $lesstif_version_string is being used."
1913     warn2 "LessTif versions 0.82 and earlier are too buggy to"
1914     warn2 "use with XScreenSaver; it is strongly recommended"
1915     warn2 "that you upgrade to at least version $preferred_lesstif!"
1916     warn2 "See <http://www.lesstif.org/>."
1917   fi
1918 fi
1919
1920 if test "$proselytize_motif" = yes ; then
1921     warnL "Athena widgets are being used instead of Motif."
1922     warn2 "The \`xscreensaver-demo' program looks much better"
1923     warn2 "with Motif.  Wouldn't you rather be using Motif?"
1924     warn2 "It is shipped by every commercial Unix vendor;"
1925     warn2 "and there is a free implementation available as"
1926     warn2 "well: see <http://www.lesstif.org/>."
1927 fi
1928
1929
1930 if test "$have_gl" = yes -a "$ac_have_mesa_gl" = yes ; then
1931   preferred_mesagl=2.7
1932
1933   if test "$ac_mesagl_version" = unknown; then
1934     warnL "Unable to determine the MesaGL version number!"
1935     warn2 "Make sure you are using version $preferred_mesagl or newer."
1936
1937   elif test \! "$ac_mesagl_version" -gt 2006; then
1938     warnL "MesaGL version $ac_mesagl_version_string is being used."
1939     warn2 "MesaGL versions 2.6 and earlier have a security bug."
1940     warn2 "It is strongly recommended that you upgrade to at"
1941     warn2 "least version $preferred_mesagl."
1942   fi
1943 fi
1944
1945
1946 if test "$have_xpm" = no ; then
1947   if test "$with_xpm_req" = yes ; then
1948     warnL 'Use of XPM was requested, but it was not found.'
1949   elif test "$with_xpm_req" = no ; then
1950     noteL 'The XPM library is not being used.'
1951   else
1952     noteL 'The XPM library was not found.'
1953   fi
1954
1955   echo ''
1956   warn2 'Some of the demos will not be as colorful as they'
1957   warn2 'could be.  You might want to consider installing XPM'
1958   warn2 'and re-running configure.  (Remember to delete the'
1959   warn2 'config.cache file first.)  You can find XPM at most'
1960   warn2 'X11 archive sites, such as <http://sunsite.unc.edu/>.'
1961 fi
1962
1963 if test "$have_gl" = no ; then
1964   if test "$with_gl_req" = yes ; then
1965     warnL 'Use of GL was requested, but it was not found.'
1966   elif test "$with_gl_req" = no ; then
1967     noteL 'The OpenGL 3D library is not being used.'
1968   else
1969     noteL 'The OpenGL 3D library was not found.'
1970   fi
1971
1972   echo ''
1973   warn2 'Those demos which use 3D will not be built or installed.'
1974   warn2 'You might want to consider installing OpenGL and'
1975   warn2 're-running configure.  (Remember to delete the'
1976   warn2 "config.cache file first.)  If your vendor doesn't ship"
1977   warn2 'their own implementation of OpenGL, you can get a free'
1978   warn2 'version at <http://www.ssec.wisc.edu/~brianp/Mesa.html>.'
1979   warn2 'For general OpenGL info, see <http://www.opengl.org/>.'
1980
1981 fi
1982
1983 if test "$with_readdisplay_req" = yes -a "$have_readdisplay" = no ; then
1984   warn 'Use of XReadDisplay was requested, but it was not found.'
1985 fi
1986
1987 if test "$with_sgivideo_req" = yes -a "$have_sgivideo" = no ; then
1988   warn 'Use of the Iris Video Library was requested, but it was not found.'
1989 fi
1990
1991 if test "$with_kerberos_req" = yes -a "$have_kerberos" = no ; then
1992   warn 'Use of Kerberos was requested, but it was not found.'
1993 fi
1994
1995 if test "$with_pam_req" = yes -a "$have_pam" = no ; then
1996   warn 'Use of PAM was requested, but it was not found.'
1997 fi
1998
1999 if test "$with_shadow_req" = yes -a "$have_shadow" = no ; then
2000   warn 'Use of shadow passwords was requested, but they were not found.'
2001 fi
2002
2003 if test -n "$with_zippy_req"; then
2004   if test "$with_zippy_req" != "$ac_cv_zippy_program" ; then
2005     warnL "$with_zippy_req was requested as the Zippy program,"
2006     warn2 "but was not found.  The default will be used instead."
2007   fi
2008 fi
2009
2010 if test "$warning" != no; then
2011   echo '' ; echo "$warnsep" ; echo ''
2012 fi
2013
2014
2015 AC_OUTPUT(Makefile
2016           utils/Makefile
2017           driver/Makefile
2018           hacks/Makefile
2019           hacks/glx/Makefile
2020           driver/XScreenSaver.ad)
2021
2022 # You are in a twisty maze of namespaces and syntaxes, all alike.
2023 # Fuck the skull of Unix.
2024 #
2025 eval bindir=${bindir}
2026 eval bindir=${bindir}
2027 eval bindir=${bindir}
2028 eval bindir=${bindir}
2029 eval bindir=${bindir}
2030 eval bindir=${bindir}
2031 eval HACKDIR=${HACKDIR}
2032 eval HACKDIR=${HACKDIR}
2033 eval HACKDIR=${HACKDIR}
2034 eval HACKDIR=${HACKDIR}
2035 eval HACKDIR=${HACKDIR}
2036 eval HACKDIR=${HACKDIR}
2037
2038 # canonicalize slashes.
2039 bindir=`echo  "${bindir}"  | sed 's@/$@@;s@//*@/@g'`
2040 HACKDIR=`echo "${HACKDIR}" | sed 's@/$@@;s@//*@/@g'`
2041
2042 if test "${bindir}" = "${HACKDIR}" ; then
2043   echo ""
2044   echo "$warnsep"
2045   echo ""
2046   echo '      When you run "make install", the "xscreensaver",'
2047   echo '      "xscreensaver-demo", and "xscreensaver-command" executables'
2048   echo "      will be installed in ${bindir}."
2049   echo ""
2050   echo "      The various graphics demos (80+ different executables) will"
2051   echo "      also be installed in ${HACKDIR}."
2052   echo ""
2053   echo "      If you would prefer the demos to be installed elsewhere"
2054   echo "      (for example, in a dedicated directory) you should re-run"
2055   echo "      configure with the --enable-subdir=DIR option.  For more"
2056   echo "      information, run $0 --help."
2057   echo ""
2058   echo "$warnsep"
2059   echo ""
2060 fi