source: trunk/third/xscreensaver/configure.in @ 13826

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