1dnl Process this file with autoconf to produce a configure script.
2dnl configure.in for xlockmore.  Various things were taken from xscreensaver's
3dnl configure.in --- xscreensaver, Copyright (c) 1997 Jamie Zawinski.
4dnl
5
6AC_INIT(config.h.in)
7AC_CANONICAL_HOST
8canonical=$host
9
10ac_original_cc="$CC"
11AC_PROG_CC
12
13###############################################################################
14#
15#       Query AX_PTHREAD, and figure out which compiler gets used.
16#
17###############################################################################
18
19AC_DEFUN([AC_PROG_CC_PTHREAD],
20 [have_pthread=no
21  with_pthread_req=unspecified
22
23  # AX_PTHREAD is from the GNU Autoconf Archive.
24  # https://savannah.gnu.org/projects/autoconf-archive/
25  m4_include(ax_pthread.m4)
26
27  # This affects CC, LIBS, and CFLAGS, instead of defining new variables.
28
29  AC_ARG_WITH([pthread],
30    [  --without-pthread       do not use POSIX threads],
31    [with_pthread="$withval"; with_pthread_req="$withval"],
32    [with_pthread=yes])
33
34  if test "$with_pthread" = yes; then
35    # AX_PTHREAD might want a different compiler.
36    AX_PTHREAD(
37     [if test -n "$ac_original_cc"; then
38        AC_MSG_CHECKING([if $ac_original_cc supports POSIX threads])
39        if test "$CC" = "$PTHREAD_CC"; then
40          have_pthread=yes
41        else
42          have_pthread=no
43        fi
44        AC_MSG_RESULT($have_pthread)
45      else
46        have_pthread=yes
47      fi
48
49      if test "$CC" = "$PTHREAD_CC" -o -z "$ac_original_cc"; then
50        have_pthread=yes
51      else
52        ac_prog_cc_no_pthread=yes
53      fi
54    ])
55
56    if test "$have_pthread" = yes; then
57      AC_DEFINE([HAVE_PTHREAD], [1],
58                [Define this if your system supports POSIX threads.])
59      LIBS="$PTHREAD_LIBS $LIBS"
60      CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
61      CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
62      CC="$PTHREAD_CC"
63    elif test "$with_pthread_req" = yes; then
64      AC_MSG_ERROR([POSIX threads were requested, but were not found.])
65    fi
66  fi
67])
68
69AC_PROG_CC_PTHREAD # Needs ac_original_cc.
70
71dnl Check if C++ compiler is present. If not set CXX to the C-compiler used
72dnl for the other compilations.
73if test "$CC" = gcc; then
74  AC_CHECK_PROGS(CXX, $CCC g++ CC C++ c++ cxx cc++ xlC $CC, gcc)
75else
76  AC_CHECK_PROGS(CXX, $CCC CC C++ g++ c++ cxx cc++ xlC $CC, gcc)
77fi
78AC_PROG_CXX
79if test "${CXX}" = "xlC" ; then
80  CXXFLAGS="${CXXFLAGS} -+"
81fi
82
83dnl If you're using g++-2.95 or later and have old X11 includes, you may need
84dnl to use "g++ -fpermissive" in the Makefiles
85dnl if test "${CXX}" = "g++" ; then
86dnl   gpp_major_version=`g++ --version | cut -f1 -d.`
87dnl   if test "${gpp_major_version}" -gt "2" ; then
88dnl     AC_MSG_RESULT([enabling -fpermissive option for g++])
89dnl     CXXFLAGS="${CXXFLAGS} -fpermissive"
90dnl   fi
91dnl   if test "${gpp_major_version}" -eq "2" ; then
92dnl     gpp_minor_version=`g++ --version | cut -f2 -d.`
93dnl     if test "${gpp_minor_version}" -ge "95" ; then
94dnl       AC_MSG_RESULT([enabling -fpermissive option for g++])
95dnl       CXXFLAGS="${CXXFLAGS} -fpermissive"
96dnl     fi
97dnl   fi
98dnl fi
99
100dnl These 2 assume for now c++ exists....
101AC_DEFINE([HAVE_CXX], [1], [C++ is available])
102CCC=
103
104PACKAGE=xlockmore
105AC_SUBST(PACKAGE)
106AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [package])
107VERSION=m4_esyscmd([grep VERSION xlock/version.h | cut -f2 -d\" | tr -d '\n'])
108AC_SUBST(VERSION)
109AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [version file])
110
111dnl Checks for programs.
112dnl AC_ARG_WITH(gcc,
113dnl[  --without-gcc           use CC to compile])
114
115dnl test -n "$CC" && cc_specified=yes
116dnl case ${with_gcc} in
117dnl   yes ) CC=gcc ;;
118dnl dnl yes ) CC=g++ ;;
119dnl  no  ) CC=cc ;;
120dnl  *   ) AC_PROG_CC;;
121dnl  *   ) AC_PROG_CXX ;;
122dnl esac
123
124if test -n "$GCC"; then
125  AC_MSG_RESULT(Turning on GNU compiler warnings.)
126dnl This creates a lot of noise.
127dnl CFLAGS="${CFLAGS} -W -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings"
128dnl -Wall -Wmissing-prototypes -Wstrict-prototypes
129dnl -Waggregate-return
130  CC="$CC -Wnested-externs -Wno-format"
131fi
132
133###############################################################################
134#
135#       Functions to figure out how to disable // comments in ANSI C code.
136#
137#       (With recent gcc, this is done with "-std=c89".  With older gcc, this
138#       is done by passing "-lang-c89" to cpp, by passing "-Wp,-lang-c89" to
139#       gcc.  Old gcc doesn't support -std, and new gcc doesn't support -lang.
140#       so much for compatibility!)
141#
142###############################################################################
143
144AC_DEFUN([AC_GCC_ACCEPTS_STD],
145 [if test -n "$GCC"; then
146   AC_CACHE_CHECK([whether gcc accepts -std],
147     ac_cv_gcc_accepts_std,
148    [if ( gcc -E -std=c89 - </dev/null 2>&1 >/dev/null | \
149          grep unrecognized >/dev/null ); then
150       ac_cv_gcc_accepts_std=no
151     else
152       ac_cv_gcc_accepts_std=yes
153     fi])
154   ac_gcc_accepts_std="$ac_cv_gcc_accepts_std"
155  fi
156])
157
158AC_DEFUN([AC_NO_CPLUSPLUS_COMMENTS_IN_C_CODE],
159 [if test -n "$GCC"; then
160   AC_GCC_ACCEPTS_STD
161   AC_MSG_RESULT(Disabling C++ comments in ANSI C code.)
162   #
163   # The reason that // comments are banned is that gcc is
164   # basically the only compiler in the world that supports them in C code.
165   # All other vendors support them only in their C++ compilers, not in their
166   # ANSI C compilers.  This means that it's a portability problem: every time
167   # these comments have snuck into the source code, I've gotten
168   # complaints about it the next day.  So we turn off support for them in gcc
169   # as well to prevent them from accidentally slipping in.
170   #
171   if test "$ac_gcc_accepts_std" = yes ; then
172     #
173     # -std=c89 defines __STRICT_ANSI__, which we don't want.
174     # (That appears to be the only additional preprocessor symbol
175     # it defines, in addition to the syntax changes it makes.)
176     #
177     # -std=gnu89 is no good, because // comments were a GNU extension
178     # before they were in the ANSI C 99 spec...  (gcc 2.96 permits //
179     # with -std=gnu89 but not with -std=c89.)
180     #
181     # -U__STRICT_ANSI__ broken on Redhat 7.1
182     CC="$CC -std=c89 -U__STRICT_ANSI__"
183   else
184     # The old way:
185     CC="$CC -Wp,-lang-c89"
186   fi
187  fi
188])
189
190
191opt_purify=no
192AC_ARG_WITH(purify, [  --with-purify           configure to postprocess with purify], opt_purify=$withval)
193if test "$opt_purify" = yes; then
194  AC_MSG_RESULT([enabling purify])
195  PURIFY="purify"
196else
197  PURIFY=
198fi
199
200#AC_NO_CPLUSPLUS_COMMENTS_IN_C_CODE
201AC_PROG_LN_S
202AC_PROG_CPP
203AC_AIX
204AC_PROG_INSTALL
205AC_PROG_MAKE_SET
206ac_link_test="-L"
207# test test
208AC_MSG_CHECKING([test -h])
209if (test \! -h /) >/dev/null 2>/dev/null ; then
210  ac_link_test="-h"
211  AC_MSG_RESULT($ac_link_test)
212else
213  AC_MSG_RESULT($ac_link_test)
214fi
215
216dnl Optional features.
217dnl add copious amounts of debugging with gcc
218
219dnl Checks for header files.
220dnl AC_HEADER_STDC /* If its not ansi, its not going to go */
221AC_ISC_POSIX
222dnl AC_HEADER_SYS_WAIT
223dnl AC_CHECK_HEADERS(poll.h sys/poll.h)
224AC_CHECK_HEADERS(fcntl.h limits.h sys/resource.h sys/select.h sys/time.h syslog.h unistd.h memory.h sys/param.h)
225
226dnl Checks for typedefs, structures, and compiler characteristics.
227AC_C_CONST
228dnl AC_HEADER_SYS_WAIT
229AC_TYPE_MODE_T
230AC_TYPE_UID_T
231AC_TYPE_PID_T
232AC_TYPE_SIZE_T
233AC_HEADER_TIME
234AC_STRUCT_TM
235
236AC_MSG_CHECKING([for getenv declaration])
237AC_EGREP_HEADER(getenv, stdlib.h,
238	AC_DEFINE([DECLARED_GETENV], [1], [Declared GetEnv]) AC_MSG_RESULT(yes),
239	AC_MSG_RESULT(no))
240
241dnl Checks for library functions.
242dnl AC_TYPE_GETGROUPS
243dnl AC_TYPE_SIGNAL
244dnl AC_CHECK_FUNCS(poll)
245dnl AC_CHECK_FUNCS(signal)
246AC_CHECK_FUNCS(gethostname select strdup)
247
248AC_CHECK_FUNC(vfork, AC_DEFINE([HAVE_VFORK], [1], [vfork is available]))
249AC_CHECK_FUNC(seteuid, AC_DEFINE([HAVE_SETEUID], [1], [seteuid is available]))
250if test $ac_cv_func_seteuid = no; then
251AC_CHECK_FUNC(setreuid, AC_DEFINE([HAVE_SETREUID], [1], [setreuid is available]))
252fi
253
254# Configure paths for GTK+
255# Owen Taylor     97-11-3
256
257dnl AC_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
258dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
259dnl
260AC_DEFUN([AC_PATH_GTK],
261[dnl
262dnl Get the cflags and libraries from the gtk-config script
263dnl
264AC_ARG_WITH(gtk-prefix,[  --with-gtk-prefix=DIR   Prefix where GTK is installed (optional)],
265            gtk_config_prefix="$withval", gtk_config_prefix="")
266AC_ARG_WITH(gtk-exec-prefix,[  --with-gtk-exec-prefix=DIR
267                          Exec prefix where GTK is installed (optional)],
268            gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
269AC_ARG_ENABLE(gtktest, [  --disable-gtktest       do not try to compile and run a test GTK program],
270		    , enable_gtktest=yes)
271
272  if test x$gtk_config_exec_prefix != x ; then
273     gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
274     if test x${GTK_CONFIG+set} != xset ; then
275        GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
276     fi
277  fi
278  if test x$gtk_config_prefix != x ; then
279     gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
280     if test x${GTK_CONFIG+set} != xset ; then
281        GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
282     fi
283  fi
284
285  AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
286  min_gtk_version=ifelse([$1], ,0.99.7,$1)
287  AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
288  no_gtk=""
289  if test "$GTK_CONFIG" = "no" ; then
290    no_gtk=yes
291  else
292    GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
293    GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
294    gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
295           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
296    gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
297           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
298    gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
299           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
300    if test "x$enable_gtktest" = "xyes" ; then
301      ac_save_CFLAGS="$CFLAGS"
302      ac_save_LIBS="$LIBS"
303      CFLAGS="$CFLAGS $GTK_CFLAGS"
304      LIBS="$LIBS $GTK_LIBS"
305dnl
306dnl Now check if the installed GTK is sufficiently new. (Also sanity
307dnl checks the results of gtk-config to some extent
308dnl
309      rm -f conf.gtktest
310      AC_TRY_RUN([
311#include <gtk/gtk.h>
312#include <stdio.h>
313
314int
315main ()
316{
317  int major, minor, micro;
318  char *tmp_version;
319
320  system ("touch conf.gtktest");
321
322  /* HP/UX 9 (%@#!) writes to sscanf strings */
323  tmp_version = g_strdup("$min_gtk_version");
324  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
325     printf("%s, bad version string\n", "$min_gtk_version");
326     exit(1);
327   }
328
329  if ((gtk_major_version != $gtk_config_major_version) ||
330      (gtk_minor_version != $gtk_config_minor_version) ||
331      (gtk_micro_version != $gtk_config_micro_version))
332    {
333      printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
334             $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
335             gtk_major_version, gtk_minor_version, gtk_micro_version);
336      printf ("*** was found! If gtk-config was correct, then it is best\n");
337      printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
338      printf("*** by modifying your LD_LIBRARY_PATH environment variable, or by editing\n");
339      printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
340      printf("*** required on your system.\n");
341      printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
342      printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
343      printf("*** before re-running configure\n");
344    }
345  else
346    {
347      if ((gtk_major_version > major) ||
348        ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
349        ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
350      {
351        return 0;
352       }
353     else
354      {
355        printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
356               gtk_major_version, gtk_minor_version, gtk_micro_version);
357        printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
358	       major, minor, micro);
359        printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
360        printf("***\n");
361        printf("*** If you have already installed a sufficiently new version, this error\n");
362        printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
363        printf("*** being found. The easiest way to fix this is to remove the old version\n");
364        printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
365        printf("*** correct copy of gtk-config. (In this case, you will have to\n");
366        printf("*** modify your LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf\n");
367        printf("*** so that the correct libraries are found at run-time))\n");
368      }
369    }
370  return 1;
371}
372],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
373       CFLAGS="$ac_save_CFLAGS"
374       LIBS="$ac_save_LIBS"
375     fi
376  fi
377  if test "x$no_gtk" = x ; then
378     AC_MSG_RESULT(yes)
379     ifelse([$2], , :, [$2])
380  else
381     AC_MSG_RESULT(no)
382     if test "$GTK_CONFIG" = "no" ; then
383       echo "*** The gtk-config script installed by GTK could not be found"
384       echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
385       echo "*** your path, or set the GTK_CONFIG environment variable to the"
386       echo "*** full path to gtk-config."
387     else
388       if test -f conf.gtktest ; then
389        :
390       else
391          echo "*** Could not run GTK test program, checking why..."
392          CFLAGS="$CFLAGS $GTK_CFLAGS"
393          LIBS="$LIBS $GTK_LIBS"
394          AC_TRY_LINK([
395#include <gtk/gtk.h>
396#include <stdio.h>
397],      [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
398        [ echo "*** The test program compiled, but did not run. This usually means"
399          echo "*** that the run-time linker is not finding GTK or finding the wrong"
400          echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
401          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
402          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
403          echo "*** is required on your system"
404	  echo "***"
405          echo "*** If you have an old version installed, it is best to remove it, although"
406          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
407          echo "***"
408          echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
409          echo "*** came with the system with the command"
410          echo "***"
411          echo "***    rpm --erase --nodeps gtk gtk-devel" ],
412        [ echo "*** The test program failed to compile or link. See the file config.log for the"
413          echo "*** exact error that occurred. This usually means GTK was incorrectly installed"
414          echo "*** or that you have moved GTK since it was installed. In the latter case, you"
415          echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
416          CFLAGS="$ac_save_CFLAGS"
417          LIBS="$ac_save_LIBS"
418       fi
419     fi
420     GTK_CFLAGS=""
421     GTK_LIBS=""
422     ifelse([$3], , :, [$3])
423  fi
424  AC_SUBST(GTK_CFLAGS)
425  AC_SUBST(GTK_LIBS)
426  rm -f conf.gtktest
427])
428
429dnl X Window System files.
430AC_PATH_XTRA
431if test "$no_x" = yes; then
432  XLIBS=NONE
433else
434  if test -n "${x_includes}"; then
435    XLOCKINC="-I${x_includes} ${XLOCKINC}"
436    XMLOCKINC="-I${x_includes} ${XMLOCKINC}"
437    if test "${CXX}" = "g++" ; then
438dnl   Do not warn me about anything here
439      XLOCKINC="-isystem ${x_includes} ${XLOCKINC}"
440      XMLOCKINC="-isystem ${x_includes} ${XMLOCKINC}"
441    fi
442  fi
443  XLIBS="${x_libraries}"
444  if test -n "${x_libraries}"; then
445    XLOCK_LDFLAGS="/usr/lib:${x_libraries}"
446    XMLOCK_LDFLAGS="/usr/lib:${x_libraries}"
447    XLOCKLIBPATHS="-L${x_libraries} ${XLOCKLIBPATHS}"
448    XMLOCKLIBPATHS="-L${x_libraries} ${XMLOCKLIBPATHS}"
449  fi
450  XLOCKLIBS="${X_PRE_LIBS} ${X_EXTRA_LIBS} ${XLOCKLIBS}"
451  case "${canonical}" in
452    *-*-sco* )
453      XLOCKLIBS="${X_PRE_LIBS} ${XLOCKLIBS} ${X_EXTRA_LIBS}"
454    ;;
455    *-*-cygwin* )
456      XLOCKLIBS="${XLOCKLIBS} -lcrypt"
457      XMLOCKLIBS="-lSM -lICE ${XMLOCKLIBS}"
458    ;;
459  esac
460  XMLOCKLIBS="-lXt ${XMLOCKLIBS}"
461#  if you need regex and regcmp
462#  XMLOCKLIBS="-lXt ${XMLOCKLIBS} -lgen"
463fi
464
465# Try and find the app-defaults directory.
466AC_DEFUN([AC_PATH_X_APP_DEFAULTS_XMKMF],
467  [
468  rm -fr conftestdir
469  if mkdir conftestdir; then
470    cd conftestdir
471    # Make sure to not put "make" in the Imakefile rules, since we grep it out.
472    cat > Imakefile <<'EOF'
473acfindx:
474  @echo 'ac_x_app_defaults="${XAPPLOADDIR}"'
475EOF
476    if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
477      # GNU make sometimes prints "make[1]: Entering...", which'd confuse us.
478      eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
479    fi
480    cd ..
481    rm -fr conftestdir
482  fi])
483
484AC_DEFUN([AC_PATH_X_APP_DEFAULTS_DIRECT],
485[  # Look for the directory under a standard set of common directories.
486  # Check X11 before X11Rn because it's often a symlink to the current release.
487  for ac_dir in         \
488    /lib/X11/app-defaults \
489    /lib/app-defaults \
490    /lib/X11R6.5.1/app-defaults \
491    /lib/X11R6.5.1/X11/app-defaults \
492    /lib/X11R6.4/app-defaults \
493    /lib/X11R6.4/X11/app-defaults \
494    /lib/X11R6.3/app-defaults \
495    /lib/X11R6.3/X11/app-defaults \
496    /lib/X11R6.2/app-defaults \
497    /lib/X11R6.2/X11/app-defaults \
498    /lib/X11R6.1/app-defaults \
499    /lib/X11R6.1/X11/app-defaults \
500    /lib/X11R6/app-defaults \
501    /lib/X11R6/X11/app-defaults \
502    /lib/X11R5/app-defaults \
503    /lib/X11R5/X11/app-defaults \
504    /lib/X11R4/app-defaults \
505    /lib/X11R4/X11/app-defaults \
506    ; \
507  do
508    found=""
509    if test -d "${prefix}$ac_dir"; then
510      ac_x_app_defaults=\\\$\\\{prefix\\\}$ac_dir
511    found="1"
512      break
513    fi
514  done
515  if test -z "$found"; then
516  for ac_dir in         \
517    /usr/X11/lib/app-defaults     \
518    /lib/X11R6.5.1/lib/app-defaults \
519    /lib/X11R6.5.1/lib/X11/app-defaults \
520    /lib/X11R6.4/lib/app-defaults \
521    /lib/X11R6.4/lib/X11/app-defaults \
522    /usr/X11R6.3/lib/app-defaults     \
523    /usr/X11R6.3/lib/X11/app-defaults   \
524    /usr/X11R6.2/lib/app-defaults     \
525    /usr/X11R6.2/lib/X11/app-defaults   \
526    /usr/X11R6.1/lib/app-defaults     \
527    /usr/X11R6.1/lib/X11/app-defaults   \
528    /usr/X11R6/lib/app-defaults     \
529    /usr/X11R6/lib/X11/app-defaults   \
530    /usr/X11R5/lib/app-defaults     \
531    /usr/X11R5/lib/X11/app-defaults   \
532    /usr/X11R4/lib/app-defaults     \
533    /usr/X11R4/lib/X11/app-defaults   \
534            \
535    /usr/lib/X11/app-defaults     \
536    /usr/lib/X11R6.5.1/app-defaults \
537    /usr/lib/X11R6.4/app-defaults \
538    /usr/lib/X11R6.3/app-defaults     \
539    /usr/lib/X11R6.2/app-defaults     \
540    /usr/lib/X11R6.1/app-defaults     \
541    /usr/lib/X11R6/app-defaults     \
542    /usr/lib/X11R5/app-defaults     \
543    /usr/lib/X11R4/app-defaults     \
544            \
545    /usr/local/X11/lib/app-defaults   \
546    /usr/remote/X11/lib/app-defaults   \
547    /usr/local/X11R6.5.1/lib/app-defaults   \
548    /usr/local/X11R6.5.1/lib/X11/app-defaults   \
549    /usr/local/X11R6.4/lib/app-defaults   \
550    /usr/local/X11R6.4/lib/X11/app-defaults   \
551    /usr/local/X11R6.3/lib/app-defaults   \
552    /usr/local/X11R6.3/lib/X11/app-defaults   \
553    /usr/local/X11R6.2/lib/app-defaults   \
554    /usr/local/X11R6.2/lib/X11/app-defaults   \
555    /usr/local/X11R6.1/lib/app-defaults   \
556    /usr/local/X11R6.1/lib/X11/app-defaults   \
557    /usr/local/X11R6/lib/app-defaults   \
558    /usr/local/X11R6/lib/X11/app-defaults   \
559    /usr/local/X11R5/lib/app-defaults   \
560    /usr/local/X11R5/lib/X11/app-defaults   \
561    /usr/local/X11R4/lib/app-defaults   \
562    /usr/local/X11R4/lib/X11/app-defaults   \
563            \
564    /usr/local/lib/X11/app-defaults   \
565    /usr/remote/lib/X11/app-defaults   \
566    /usr/local/lib/X11R6.5.1/app-defaults   \
567    /usr/local/lib/X11R6.5.1/X11/app-defaults \
568    /usr/local/lib/X11R6.4/app-defaults   \
569    /usr/local/lib/X11R6.4/X11/app-defaults \
570    /usr/local/lib/X11R6.3/app-defaults   \
571    /usr/local/lib/X11R6.3/X11/app-defaults \
572    /usr/local/lib/X11R6.2/app-defaults   \
573    /usr/local/lib/X11R6.2/X11/app-defaults \
574    /usr/local/lib/X11R6.1/app-defaults   \
575    /usr/local/lib/X11R6.1/X11/app-defaults \
576    /usr/local/lib/X11R6/app-defaults   \
577    /usr/local/lib/X11R6/X11/app-defaults \
578    /usr/local/lib/X11R5/app-defaults   \
579    /usr/local/lib/X11R5/X11/app-defaults \
580    /usr/local/lib/X11R4/app-defaults   \
581    /usr/local/lib/X11R4/X11/app-defaults \
582            \
583    /usr/X386/lib/X11/app-defaults    \
584    /usr/x386/lib/X11/app-defaults    \
585    /usr/XFree86/lib/X11/app-defaults   \
586    /usr/pkg/lib/app-defaults          \
587            \
588    /usr/lib/X11/app-defaults     \
589    /usr/unsupported/lib/X11/app-defaults \
590    /usr/athena/lib/X11/app-defaults    \
591    /usr/local/x11r5/lib/X11/app-defaults \
592    /usr/lpp/Xamples/lib/X11/app-defaults \
593    /lib/usr/lib/X11/app-defaults   \
594    /usr/local/lib/app-defaults   \
595    /usr/remote/lib/app-defaults   \
596            \
597    /usr/openwin/lib/app-defaults   \
598    /usr/openwin/lib/X11/app-defaults   \
599    /usr/openwin/share/lib/app-defaults   \
600    /usr/openwin/share/lib/X11/app-defaults \
601            \
602    /X11R6.5.1/lib/app-defaults   \
603    /X11R6.4/lib/app-defaults     \
604    /X11R6.3/lib/app-defaults     \
605    /X11R6.2/lib/app-defaults     \
606    /X11R6.1/lib/app-defaults     \
607    /X11R6/lib/app-defaults     \
608    /X11R5/lib/app-defaults     \
609    /X11R4/lib/app-defaults     \
610    ; \
611  do
612    if test -d "$ac_dir"; then
613      ac_x_app_defaults=$ac_dir
614      break
615    fi
616  done
617    fi
618])
619
620
621AC_DEFUN([AC_PATH_X_APP_DEFAULTS],
622  [AC_REQUIRE_CPP()
623    AC_CACHE_CHECK([for X app-defaults directory], ac_cv_x_app_defaults,
624     [AC_PATH_X_APP_DEFAULTS_XMKMF
625      AC_PATH_X_APP_DEFAULTS_DIRECT
626      if test x"$ac_x_app_defaults" = x; then
627        ac_cv_x_app_defaults="/usr/lib/X11/app-defaults"
628      else
629        # Record where we found app-defaults for the cache.
630        ac_cv_x_app_defaults="$ac_x_app_defaults"
631      fi])
632    eval ac_x_app_defaults="$ac_cv_x_app_defaults"])
633
634AC_PATH_X_APP_DEFAULTS
635
636APPDEFAULTS=$ac_x_app_defaults
637
638AC_ARG_WITH(includes, [  --with-includes=DIR     search include DIR for optional packages below])
639case "x$withval" in
640x/*|x.*)
641  extra_include=$withval
642  AC_MSG_RESULT([adding $extra_include to include search path for following packages])
643  if test ! -d $extra_include; then
644    AC_MSG_RESULT([Warning: Directory $extra_include does not exist])
645  fi
646  ;;
647*)
648  extra_include=""
649  ;;
650esac
651
652AC_ARG_WITH(libraries, [  --with-libraries=DIR    search library DIR for optional packages below])
653case "x$withval" in
654x/*|x.*)
655  extra_lib=$withval
656  AC_MSG_RESULT([adding $extra_lib to library search path for following packages])
657  if test ! -d $extra_lib; then
658    AC_MSG_RESULT([Warning: Directory $extra_lib does not exist])
659  fi
660  ;;
661*)
662  extra_lib=""
663  ;;
664esac
665
666dnl Xm MOTIF Motif motif
667
668AC_DEFUN([AC_PATH_MOTIF_DIRECT],
669[test -z "$motif_direct_test_library" && motif_direct_test_library=Xm
670test -z "$motif_direct_test_function" && motif_direct_test_function=XmCreatePushButton
671test -z "$motif_direct_test_include" && motif_direct_test_include=Xm/Xm.h
672  for ac_dir in               \
673    /usr/include/Motif1.2     \
674    /usr/Motif1.2/include     \
675                              \
676    /usr/motif/include        \
677                              \
678    /usr/X11R6.5.1/include    \
679    /usr/X11R6.4/include      \
680    /usr/X11R6.3/include      \
681    /usr/X11R6.2/include      \
682    /usr/X11R6.1/include      \
683    /usr/X11R6/include        \
684    /usr/X11R5/include        \
685    /usr/X11R4/include        \
686                              \
687    /usr/include/X11R6.5.1    \
688    /usr/include/X11R6.4      \
689    /usr/include/X11R6.3      \
690    /usr/include/X11R6.2      \
691    /usr/include/X11R6.1      \
692    /usr/include/X11R6        \
693    /usr/include/X11R5        \
694    /usr/include/X11R4        \
695                              \
696    /usr/local/X11R6.5.1/include  \
697    /usr/local/X11R6.4/include  \
698    /usr/local/X11R6.3/include  \
699    /usr/local/X11R6.2/include  \
700    /usr/local/X11R6.1/include  \
701    /usr/local/X11R6/include  \
702    /usr/local/X11R5/include  \
703    /usr/local/X11R4/include  \
704                              \
705    /usr/local/include/X11R6.5.1  \
706    /usr/local/include/X11R6.4  \
707    /usr/local/include/X11R6.3  \
708    /usr/local/include/X11R6.2  \
709    /usr/local/include/X11R6.1  \
710    /usr/local/include/X11R6  \
711    /usr/local/include/X11R5  \
712    /usr/local/include/X11R4  \
713                              \
714    /usr/X11/include          \
715    /usr/include/X11          \
716    /usr/local/X11/include    \
717    /usr/local/include/X11    \
718                              \
719    /usr/X386/include         \
720    /usr/x386/include         \
721    /usr/XFree86/include/X11  \
722    /usr/pkg/include          \
723                              \
724    /usr/dt/include           \
725                              \
726    /usr/local/include        \
727    /usr/remote/include       \
728    /usr/include              \
729    /usr/unsupported/include  \
730    /usr/athena/include       \
731    /usr/local/x11r5/include  \
732    /usr/lpp/Xamples/include  \
733    $extra_include            \
734    ; \
735  do
736    if test -r "$ac_dir/$motif_direct_test_include"; then
737      no_motif= ac_motif_includes=$ac_dir
738      break
739    fi
740  done
741
742# Check for the libraries.
743# See if we find them without any special options.
744# Do not add to $LIBS permanently.
745ac_save_LIBS="$LIBS"
746LIBS="-l$motif_direct_test_library $LIBS"
747# First see if replacing the include by lib works.
748for ac_dir in `echo "$ac_motif_includes" | sed s/include/lib/` \
749    /usr/lib/Motif1.2     \
750    /usr/Motif1.2/lib     \
751                          \
752    /usr/motif/lib        \
753                          \
754    /usr/X11R6.5.1/lib    \
755    /usr/X11R6.4/lib      \
756    /usr/X11R6.3/lib      \
757    /usr/X11R6.2/lib      \
758    /usr/X11R6.1/lib      \
759    /usr/X11R6/lib        \
760    /usr/X11R5/lib        \
761    /usr/X11R4/lib        \
762                          \
763    /usr/lib/X11R6.5.1    \
764    /usr/lib/X11R6.4      \
765    /usr/lib/X11R6.3      \
766    /usr/lib/X11R6.2      \
767    /usr/lib/X11R6.1      \
768    /usr/lib/X11R6        \
769    /usr/lib/X11R5        \
770    /usr/lib/X11R4        \
771                          \
772    /usr/local/X11R6.5.1/lib  \
773    /usr/local/X11R6.4/lib  \
774    /usr/local/X11R6.3/lib  \
775    /usr/local/X11R6.2/lib  \
776    /usr/local/X11R6.1/lib  \
777    /usr/local/X11R6/lib  \
778    /usr/local/X11R5/lib  \
779    /usr/local/X11R4/lib  \
780                          \
781    /usr/local/lib/X11R6.5.1  \
782    /usr/local/lib/X11R6.4  \
783    /usr/local/lib/X11R6.3  \
784    /usr/local/lib/X11R6.2  \
785    /usr/local/lib/X11R6.1  \
786    /usr/local/lib/X11R6  \
787    /usr/local/lib/X11R5  \
788    /usr/local/lib/X11R4  \
789                          \
790    /usr/X11/lib          \
791    /usr/lib/X11          \
792    /usr/local/X11/lib    \
793                          \
794    /usr/X386/lib         \
795    /usr/x386/lib         \
796    /usr/XFree86/lib/X11  \
797    /usr/pkg/lib          \
798                          \
799    /usr/lib              \
800    /usr/local/lib        \
801    /usr/remote/lib       \
802    /usr/unsupported/lib  \
803    /usr/athena/lib       \
804    /usr/local/x11r5/lib  \
805    /usr/lpp/Xamples/lib  \
806    $extra_lib            \
807    ; \
808do
809  for ac_extension in a so sl; do
810    if test -r $ac_dir/lib${motif_direct_test_library}.$ac_extension; then
811      no_motif= ac_motif_libraries=$ac_dir
812      break 2
813    fi
814  done
815done
816LIBS="$ac_save_LIBS"])
817AC_DEFUN([AC_PATH_MOTIF],
818[AC_REQUIRE_CPP()dnl
819
820motif_includes=NONE
821motif_libraries=NONE
822
823AC_MSG_CHECKING(for Motif)
824AC_ARG_WITH(motif, [  --without-motif         disable Motif (for xmlock)])
825if test "x$with_motif" = xno; then
826  no_motif=yes
827else
828  if test "x$motif_includes" != xNONE && test "x$motif_libraries" != xNONE; then
829    no_motif=
830  else
831AC_CACHE_VAL(ac_cv_path_motif,
832[# One or both of these vars are not set, and there is no cached value.
833no_motif=yes
834AC_PATH_MOTIF_DIRECT
835
836if test "$no_motif" = yes; then
837  ac_cv_path_motif="no_motif=yes"
838else
839  ac_cv_path_motif="no_motif= ac_motif_includes=$ac_motif_includes ac_motif_libraries=$ac_motif_libraries"
840fi])dnl
841  fi
842  eval "$ac_cv_path_motif"
843fi # with_motif != no
844
845if test "$no_motif" = yes; then
846  AC_MSG_RESULT(no)
847  XMLOCK=""
848  INSTALL_XMLOCK=""
849  UNINSTALL_XMLOCK=""
850else
851  XMLOCKLIBS="-lXm ${XMLOCKLIBS}"
852  XMLOCK="xmlock"
853  INSTALL_XMLOCK="install_xmlock"
854  UNINSTALL_XMLOCK="uninstall_xmlock"
855  test "x$motif_includes" = xNONE && motif_includes=$ac_motif_includes
856  test "x$motif_libraries" = xNONE && motif_libraries=$ac_motif_libraries
857  ac_cv_path_motif="no_motif= ac_motif_includes=$motif_includes ac_motif_libraries=$motif_libraries"
858  AC_MSG_RESULT([libraries $motif_libraries, headers $motif_includes])
859fi
860])
861
862AC_PATH_MOTIF
863
864if test "x$motif_libraries" != x && test "x$motif_libraries" != xNONE ; then
865  XMLOCK_LDFLAGS="${XMLOCK_LDFLAGS}:$motif_libraries"
866  XMLOCKLIBPATHS="${XMLOCKLIBPATHS} -L$motif_libraries"
867fi
868if test "x$motif_includes" != x && test "x$motif_includes" != xNONE ; then
869  XMLOCKINC="${XMLOCKINC} -I$motif_includes"
870fi
871
872dnl Xmu EDITRES Editres editres
873
874AC_DEFUN([AC_PATH_EDITRES_DIRECT],
875[test -z "$editres_direct_test_library" && editres_direct_test_library=Xmu
876test -z "$editres_direct_test_function" && editres_direct_test_function=_XEditResCheckMessages
877test -z "$editres_direct_test_include" && editres_direct_test_include=X11/Xmu/Editres.h
878  for ac_dir in               \
879    /usr/include/X11R6.5.1    \
880    /usr/include/X11R6.4      \
881    /usr/include/X11R6.3      \
882    /usr/include/X11R6.2      \
883    /usr/include/X11R6.1      \
884    /usr/X11R6/include        \
885    /usr/X11R5/include        \
886    /usr/X11R4/include        \
887    /usr/X11/include          \
888                              \
889    /usr/include/X11          \
890    /usr/include/X11R6.5.1    \
891    /usr/include/X11R6.4      \
892    /usr/include/X11R6.3      \
893    /usr/include/X11R6.2      \
894    /usr/include/X11R6.1      \
895    /usr/include/X11R6        \
896    /usr/include/X11R5        \
897    /usr/include/X11R4        \
898                              \
899    /usr/local/X11/include    \
900    /usr/local/X11R6.5.1/include  \
901    /usr/local/X11R6.4/include  \
902    /usr/local/X11R6.3/include  \
903    /usr/local/X11R6.2/include  \
904    /usr/local/X11R6.1/include  \
905    /usr/local/X11R6/include  \
906    /usr/local/X11R5/include  \
907    /usr/local/X11R4/include  \
908                              \
909    /usr/local/include/X11    \
910    /usr/local/include/X11R6.5.1  \
911    /usr/local/include/X11R6.4  \
912    /usr/local/include/X11R6.3  \
913    /usr/local/include/X11R6.2  \
914    /usr/local/include/X11R6.1  \
915    /usr/local/include/X11R6  \
916    /usr/local/include/X11R5  \
917    /usr/local/include/X11R4  \
918                              \
919    /usr/X386/include         \
920    /usr/x386/include         \
921    /usr/XFree86/include      \
922    /usr/pkg/include          \
923                              \
924    /usr/local/include        \
925    /usr/remote/include       \
926    /usr/include              \
927    /usr/unsupported/include  \
928    /usr/athena/include       \
929    /usr/local/x11r5/include  \
930    /usr/lpp/Xamples/include  \
931                              \
932    /usr/openwin/include      \
933    /usr/openwin/share/include \
934    $extra_include            \
935    ; \
936  do
937    if test -r "$ac_dir/$editres_direct_test_include"; then
938      no_editres= ac_editres_includes=$ac_dir
939      break
940    fi
941  done
942
943# Check for the libraries.
944# See if we find them without any special options.
945# Do not add to $LIBS permanently.
946ac_save_LIBS="$LIBS"
947LIBS="-l$editres_direct_test_library $LIBS"
948# First see if replacing the include by lib works.
949for ac_dir in `echo "$ac_editres_includes" | sed s/include/lib/` \
950                          \
951    /usr/X11/lib          \
952    /usr/X11R6.5.1/lib      \
953    /usr/X11R6.4/lib        \
954    /usr/X11R6.3/lib        \
955    /usr/X11R6.2/lib        \
956    /usr/X11R6.1/lib        \
957    /usr/X11R6/lib        \
958    /usr/X11R5/lib        \
959    /usr/X11R4/lib        \
960                          \
961    /usr/lib/X11          \
962    /usr/lib/X11R6.5.1      \
963    /usr/lib/X11R6.4        \
964    /usr/lib/X11R6.3        \
965    /usr/lib/X11R6.2        \
966    /usr/lib/X11R6.1        \
967    /usr/lib/X11R6        \
968    /usr/lib/X11R5        \
969    /usr/lib/X11R4        \
970                          \
971    /usr/local/X11/lib    \
972    /usr/local/X11R6.5.1/lib  \
973    /usr/local/X11R6.4/lib  \
974    /usr/local/X11R6.3/lib  \
975    /usr/local/X11R6.2/lib  \
976    /usr/local/X11R6.1/lib  \
977    /usr/local/X11R6/lib  \
978    /usr/local/X11R5/lib  \
979    /usr/local/X11R4/lib  \
980                          \
981    /usr/local/lib/X11    \
982    /usr/local/lib/X11R6.5.1  \
983    /usr/local/lib/X11R6.4  \
984    /usr/local/lib/X11R6.3  \
985    /usr/local/lib/X11R6.2  \
986    /usr/local/lib/X11R6.1  \
987    /usr/local/lib/X11R6  \
988    /usr/local/lib/X11R5  \
989    /usr/local/lib/X11R4  \
990                          \
991    /usr/X386/lib         \
992    /usr/x386/lib         \
993    /usr/XFree86/lib/X11  \
994    /usr/pkg/lib          \
995                          \
996    /usr/lib              \
997    /usr/local/lib        \
998    /usr/remote/lib       \
999    /usr/unsupported/lib  \
1000    /usr/athena/lib       \
1001    /usr/local/x11r5/lib  \
1002    /usr/lpp/Xamples/lib  \
1003    /lib/usr/lib/X11      \
1004                          \
1005    /usr/openwin/lib      \
1006    /usr/openwin/share/lib \
1007    $extra_lib            \
1008    ; \
1009do
1010  for ac_extension in a so sl; do
1011    if test -r $ac_dir/lib${editres_direct_test_library}.$ac_extension; then
1012      no_editres= ac_editres_libraries=$ac_dir
1013      break 2
1014    fi
1015  done
1016done
1017LIBS="$ac_save_LIBS"])
1018AC_DEFUN([AC_PATH_EDITRES],
1019[AC_REQUIRE_CPP()dnl
1020
1021editres_includes=NONE
1022editres_libraries=NONE
1023
1024AC_MSG_CHECKING(for Editres)
1025AC_ARG_WITH(editres, [  --without-editres       disable debugger (for x?lock)])
1026if test "x$with_editres" = xno; then
1027  no_editres=yes
1028else
1029  if test "x$editres_includes" != xNONE && test "x$editres_libraries" != xNONE; then
1030    no_editres=
1031  else
1032AC_CACHE_VAL(ac_cv_path_editres,
1033[# One or both of these vars are not set, and there is no cached value.
1034no_editres=yes
1035AC_PATH_EDITRES_DIRECT
1036
1037if test "$no_editres" = yes; then
1038  ac_cv_path_editres="no_editres=yes"
1039else
1040  ac_cv_path_editres="no_editres= ac_editres_includes=$ac_editres_includes ac_editres_libraries=$ac_editres_libraries"
1041fi])dnl
1042  fi
1043  eval "$ac_cv_path_editres"
1044fi # with_editres != no
1045
1046if test "$no_editres" = yes; then
1047  AC_MSG_RESULT(no)
1048else
1049  AC_DEFINE([USE_XMU], [1], [using X11 miscellaneous utilities])
1050  XLOCKLIBS="${XLOCKLIBS} -lXmu"
1051  XMLOCKLIBS="-lXmu ${XMLOCKLIBS}"
1052  test "x$editres_includes" = xNONE && editres_includes=$ac_editres_includes
1053  test "x$editres_libraries" = xNONE && editres_libraries=$ac_editres_libraries
1054  ac_cv_path_editres="no_editres= ac_editres_includes=$editres_includes ac_editres_libraries=$editres_libraries"
1055  AC_MSG_RESULT([libraries $editres_libraries, headers $editres_includes])
1056fi
1057])
1058
1059AC_PATH_EDITRES
1060
1061if test "x$editres_libraries" != x && test "x$editres_libraries" != xNONE ; then
1062  XMLOCK_LDFLAGS="${XMLOCK_LDFLAGS}:$editres_libraries"
1063  XMLOCKLIBPATHS="${XMLOCKLIBPATHS} -L$editres_libraries"
1064fi
1065if test "x$editres_includes" != x && test "x$editres_includes" != xNONE ; then
1066  XMLOCKINC="${XMLOCKINC} -I$editres_includes"
1067fi
1068
1069xpm=no
1070dnl Xpm XPM xpm
1071
1072AC_DEFUN([AC_PATH_XPM_DIRECT],
1073[test -z "$xpm_direct_test_library" && xpm_direct_test_library=Xpm
1074test -z "$xpm_direct_test_function" && xpm_direct_test_function=XpmCreateImageFromData
1075test -z "$xpm_direct_test_include" && xpm_direct_test_include=X11/xpm.h
1076  for ac_dir in               \
1077    /usr/X11R6.5.1/include    \
1078    /usr/X11R6.4/include      \
1079    /usr/X11R6.3/include      \
1080    /usr/X11R6.2/include      \
1081    /usr/X11R6.1/include      \
1082    /usr/X11R6/include        \
1083    /usr/X11R5/include        \
1084    /usr/X11R4/include        \
1085    /usr/X11/include          \
1086                              \
1087    /usr/include/X11          \
1088    /usr/include/X11R6.5.1    \
1089    /usr/include/X11R6.4      \
1090    /usr/include/X11R6.3      \
1091    /usr/include/X11R6.2      \
1092    /usr/include/X11R6.1      \
1093    /usr/include/X11R6        \
1094    /usr/include/X11R5        \
1095    /usr/include/X11R4        \
1096                              \
1097    /usr/local/X11/include    \
1098    /usr/local/X11R6.5.1/include  \
1099    /usr/local/X11R6.4/include  \
1100    /usr/local/X11R6.3/include  \
1101    /usr/local/X11R6.2/include  \
1102    /usr/local/X11R6.1/include  \
1103    /usr/local/X11R6/include  \
1104    /usr/local/X11R5/include  \
1105    /usr/local/X11R4/include  \
1106                              \
1107    /usr/local/include/X11    \
1108    /usr/local/include/X11R6.5.1  \
1109    /usr/local/include/X11R6.4  \
1110    /usr/local/include/X11R6.3  \
1111    /usr/local/include/X11R6.2  \
1112    /usr/local/include/X11R6.1  \
1113    /usr/local/include/X11R6  \
1114    /usr/local/include/X11R5  \
1115    /usr/local/include/X11R4  \
1116                              \
1117    /usr/X386/include         \
1118    /usr/x386/include         \
1119    /usr/XFree86/include/X11  \
1120    /usr/pkg/include          \
1121                              \
1122    /usr/local/include        \
1123    /usr/remote/include       \
1124    /usr/include              \
1125    /usr/unsupported/include  \
1126    /usr/athena/include       \
1127    /usr/local/x11r5/include  \
1128    /usr/lpp/Xamples/include  \
1129                              \
1130    /usr/openwin/include      \
1131    /usr/openwin/share/include \
1132    /usr/openwin/include      \
1133                              \
1134    /usr/include/Vk           \
1135    $extra_include            \
1136    ; \
1137  do
1138    if test -r "$ac_dir/$xpm_direct_test_include"; then
1139      no_xpm= ac_xpm_includes=$ac_dir
1140      break
1141    fi
1142  done
1143
1144# Check for the libraries.
1145# See if we find them without any special options.
1146# Do not add to $LIBS permanently.
1147ac_save_LIBS="$LIBS"
1148LIBS="-l$xpm_direct_test_library $LIBS"
1149# First see if replacing the include by lib works.
1150for ac_dir in `echo "$ac_xpm_includes" | sed s%/X11$%% | sed s/include/lib/` \
1151                          \
1152    /usr/X11/lib          \
1153    /usr/X11R6.5.1/lib    \
1154    /usr/X11R6.4/lib      \
1155    /usr/X11R6.3/lib      \
1156    /usr/X11R6.2/lib      \
1157    /usr/X11R6.1/lib      \
1158    /usr/X11R6/lib        \
1159    /usr/X11R5/lib        \
1160    /usr/X11R4/lib        \
1161                          \
1162    /usr/lib/X11          \
1163    /usr/lib/X11R6.5.1    \
1164    /usr/lib/X11R6.4      \
1165    /usr/lib/X11R6.3      \
1166    /usr/lib/X11R6.2      \
1167    /usr/lib/X11R6.1      \
1168    /usr/lib/X11R6        \
1169    /usr/lib/X11R5        \
1170    /usr/lib/X11R4        \
1171                          \
1172    /usr/local/X11/lib    \
1173    /usr/local/X11R6/lib  \
1174    /usr/local/X11R5/lib  \
1175    /usr/local/X11R4/lib  \
1176                          \
1177    /usr/local/lib/X11    \
1178    /usr/local/X11R6.5.1/lib  \
1179    /usr/local/X11R6.4/lib  \
1180    /usr/local/X11R6.3/lib  \
1181    /usr/local/X11R6.2/lib  \
1182    /usr/local/X11R6.1/lib  \
1183    /usr/local/lib/X11R6  \
1184    /usr/local/lib/X11R5  \
1185    /usr/local/lib/X11R4  \
1186                          \
1187    /usr/X386/lib         \
1188    /usr/x386/lib         \
1189    /usr/XFree86/lib/X11  \
1190    /usr/pkg/lib          \
1191                          \
1192    /usr/lib              \
1193    /usr/local/lib        \
1194    /usr/remote/lib       \
1195    /usr/unsupported/lib  \
1196    /usr/athena/lib       \
1197    /usr/local/x11r5/lib  \
1198    /usr/lpp/Xamples/lib  \
1199    /lib/usr/lib/X11      \
1200                          \
1201    /usr/openwin/lib      \
1202    /usr/openwin/share/lib \
1203    $extra_lib            \
1204    ; \
1205do
1206  for ac_extension in a so sl; do
1207    if test -r $ac_dir/lib${xpm_direct_test_library}.$ac_extension; then
1208      no_xpm= ac_xpm_libraries=$ac_dir
1209      break 2
1210    fi
1211  done
1212done
1213LIBS="$ac_save_LIBS"])
1214AC_DEFUN([AC_PATH_XPM],
1215[AC_REQUIRE_CPP()dnl
1216
1217xpm_includes=NONE
1218xpm_libraries=NONE
1219
1220AC_MSG_CHECKING(for XPM)
1221AC_ARG_WITH(xpm, [  --without-xpm           disable color pixmap XPM mode(s)])
1222if test "x$with_xpm" = xno; then
1223  no_xpm=yes
1224else
1225  if test "x$xpm_includes" != xNONE && test "x$xpm_libraries" != xNONE; then
1226    no_xpm=
1227  else
1228AC_CACHE_VAL(ac_cv_path_xpm,
1229[# One or both of these vars are not set, and there is no cached value.
1230no_xpm=yes
1231AC_PATH_XPM_DIRECT
1232
1233if test "$no_xpm" = yes; then
1234  ac_cv_path_xpm="no_xpm=yes"
1235else
1236  ac_cv_path_xpm="no_xpm= ac_xpm_includes=$ac_xpm_includes ac_xpm_libraries=$ac_xpm_libraries"
1237fi])dnl
1238  fi
1239  eval "$ac_cv_path_xpm"
1240fi # with_xpm != no
1241
1242if test "$no_xpm" = yes; then
1243  AC_MSG_RESULT(no)
1244  XPM="#"
1245else
1246  xpm=yes
1247  AC_DEFINE([HAVE_XPM], [1], [XPM color images])
1248  XLOCKLIBS="${XLOCKLIBS} -lXpm"
1249  XMLOCKLIBS="-lXpm ${XMLOCKLIBS}"
1250  test "x$xpm_includes" = xNONE && xpm_includes=$ac_xpm_includes
1251  test "x$xpm_libraries" = xNONE && xpm_libraries=$ac_xpm_libraries
1252  ac_cv_path_xpm="no_xpm= ac_xpm_includes=$xpm_includes ac_xpm_libraries=$xpm_libraries"
1253  AC_MSG_RESULT([libraries $xpm_libraries, headers $xpm_includes])
1254  XPM=""
1255fi
1256])
1257
1258AC_PATH_XPM
1259
1260if test "x$xpm_libraries" != x && test "x$xpm_libraries" != xNONE ; then
1261  XLOCK_LDFLAGS="${XLOCK_LDFLAGS}:$xpm_libraries"
1262  XMLOCK_LDFLAGS="${XMLOCK_LDFLAGS}:$xpm_libraries"
1263  XLOCKLIBPATHS="${XLOCKLIBPATHS} -L$xpm_libraries"
1264  XMLOCKLIBPATHS="${XMLOCKLIBPATHS} -L$xpm_libraries"
1265fi
1266if test "x$xpm_includes" != x && test "x$xpm_includes" != xNONE ; then
1267  XLOCKINC="${XLOCKINC} -I$xpm_includes"
1268fi
1269
1270png=no
1271dnl png LIBPNG
1272
1273AC_DEFUN([AC_PATH_LIBPNG_DIRECT],
1274[test -z "$png_direct_test_library" && png_direct_test_library=png
1275test -z "$png_direct_test_include" && png_direct_test_include=png.h
1276  for ac_dir in               \
1277    /usr/X11R6.5.1/include    \
1278    /usr/X11R6.4/include      \
1279    /usr/X11R6.3/include      \
1280    /usr/X11R6.2/include      \
1281    /usr/X11R6.1/include      \
1282    /usr/X11R6/include        \
1283    /usr/X11R5/include        \
1284    /usr/X11R4/include        \
1285    /usr/X11/include          \
1286                              \
1287    /usr/include/X11          \
1288    /usr/include/X11R6.5.1    \
1289    /usr/include/X11R6.4      \
1290    /usr/include/X11R6.3      \
1291    /usr/include/X11R6.2      \
1292    /usr/include/X11R6.1      \
1293    /usr/include/X11R6        \
1294    /usr/include/X11R5        \
1295    /usr/include/X11R4        \
1296                              \
1297    /usr/local/X11/include    \
1298    /usr/local/X11R6.5.1/include  \
1299    /usr/local/X11R6.4/include  \
1300    /usr/local/X11R6.3/include  \
1301    /usr/local/X11R6.2/include  \
1302    /usr/local/X11R6.1/include  \
1303    /usr/local/X11R6/include  \
1304    /usr/local/X11R5/include  \
1305    /usr/local/X11R4/include  \
1306                              \
1307    /usr/local/include/X11    \
1308    /usr/local/include/X11R6.5.1  \
1309    /usr/local/include/X11R6.4  \
1310    /usr/local/include/X11R6.3  \
1311    /usr/local/include/X11R6.2  \
1312    /usr/local/include/X11R6.1  \
1313    /usr/local/include/X11R6  \
1314    /usr/local/include/X11R5  \
1315    /usr/local/include/X11R4  \
1316                              \
1317    /usr/X386/include         \
1318    /usr/x386/include         \
1319    /usr/XFree86/include/X11  \
1320    /usr/pkg/include          \
1321                              \
1322    /usr/local/include        \
1323    /usr/remote/include       \
1324    /usr/include              \
1325    /usr/unsupported/include  \
1326    /usr/athena/include       \
1327    /usr/local/x11r5/include  \
1328    /usr/lpp/Xamples/include  \
1329                              \
1330    /usr/openwin/include      \
1331    /usr/openwin/share/include \
1332    /usr/openwin/include      \
1333                              \
1334    /usr/include/Vk           \
1335    $extra_include            \
1336    ; \
1337  do
1338    if test -r "$ac_dir/$png_direct_test_include"; then
1339      no_libpng= ac_png_includes=$ac_dir
1340      break
1341    fi
1342  done
1343
1344# Check for the libraries.
1345# See if we find them without any special options.  # Do not add to $LIBS permanently.
1346ac_save_LIBS="$LIBS"
1347LIBS="-l$png_direct_test_library $LIBS"
1348# First see if replacing the include by lib works.
1349for ac_dir in `echo "$ac_png_includes" | sed s/include/lib/` \
1350                          \
1351    /usr/X11/lib          \
1352    /usr/X11R6.5.1/lib    \
1353    /usr/X11R6.4/lib      \
1354    /usr/X11R6.3/lib      \
1355    /usr/X11R6.2/lib      \
1356    /usr/X11R6.1/lib      \
1357    /usr/X11R6/lib        \
1358    /usr/X11R5/lib        \
1359    /usr/X11R4/lib        \
1360                          \
1361    /usr/lib/X11          \
1362    /usr/lib/X11R6.5.1    \
1363    /usr/lib/X11R6.4      \
1364    /usr/lib/X11R6.3      \
1365    /usr/lib/X11R6.2      \
1366    /usr/lib/X11R6.1      \
1367    /usr/lib/X11R6        \
1368    /usr/lib/X11R5        \
1369    /usr/lib/X11R4        \
1370                          \
1371    /usr/local/X11/lib    \
1372    /usr/local/X11R6/lib  \
1373    /usr/local/X11R5/lib  \
1374    /usr/local/X11R4/lib  \
1375                          \
1376    /usr/local/lib/X11    \
1377    /usr/local/X11R6.5.1/lib  \
1378    /usr/local/X11R6.4/lib  \
1379    /usr/local/X11R6.3/lib  \
1380    /usr/local/X11R6.2/lib  \
1381    /usr/local/X11R6.1/lib  \
1382    /usr/local/lib/X11R6  \
1383    /usr/local/lib/X11R5  \
1384    /usr/local/lib/X11R4  \
1385                          \
1386    /usr/X386/lib         \
1387    /usr/x386/lib         \
1388    /usr/XFree86/lib/X11  \
1389    /usr/pkg/lib          \
1390                          \
1391    /usr/lib              \
1392    /usr/local/lib        \
1393    /usr/remote/lib       \
1394    /usr/unsupported/lib  \
1395    /usr/athena/lib       \
1396    /usr/local/x11r5/lib  \
1397    /usr/lpp/Xamples/lib  \
1398    /lib/usr/lib/X11      \
1399                          \
1400    /usr/openwin/lib      \
1401    /usr/openwin/share/lib \
1402    $extra_lib            \
1403    ; \
1404do
1405  for ac_extension in a so sl; do
1406    if test -r $ac_dir/lib${png_direct_test_library}.$ac_extension; then
1407      no_libpng= ac_png_libraries=$ac_dir
1408      break 2
1409    fi
1410  done
1411done
1412LIBS="$ac_save_LIBS"])
1413AC_DEFUN([AC_PATH_LIBPNG],
1414[AC_REQUIRE_CPP()dnl
1415
1416png_includes=NONE
1417png_libraries=NONE
1418
1419AC_MSG_CHECKING(for LIBPNG)
1420AC_ARG_WITH(libpng, [  --without-libpng         disable color pixmap LIBPNG mode(s)])
1421if test "x$with_libpng" = xno; then
1422  no_libpng=yes
1423else
1424  if test "x$png_includes" != xNONE && test "x$png_libraries" != xNONE; then
1425    no_libpng=
1426  else
1427AC_CACHE_VAL(ac_cv_path_png,
1428[# One or both of these vars are not set, and there is no cached value.
1429no_libpng=yes
1430AC_PATH_LIBPNG_DIRECT
1431
1432if test "$no_libpng" = yes; then
1433  ac_cv_path_png="no_libpng=yes"
1434else
1435  ac_cv_path_png="no_libpng= ac_png_includes=$ac_png_includes ac_png_libraries=$ac_png_libraries"
1436fi])dnl
1437  fi
1438  eval "$ac_cv_path_png"
1439fi # with_libpng != no
1440
1441if test "$no_libpng" = yes; then
1442  AC_MSG_RESULT(no)
1443  LIBPNG="#"
1444else
1445  libpng=yes
1446  AC_DEFINE([HAVE_LIBPNG], [1], [PNG images])
1447  XLOCKLIBS="${XLOCKLIBS} -lpng"
1448  test "x$png_includes" = xNONE && png_includes=$ac_png_includes
1449  test "x$png_libraries" = xNONE && png_libraries=$ac_png_libraries
1450  ac_cv_path_png="no_libpng= ac_png_includes=$png_includes ac_png_libraries=$png_libraries"
1451  AC_MSG_RESULT([libraries $png_libraries, headers $png_includes])
1452  LIBPNG=""
1453fi
1454])
1455
1456AC_PATH_LIBPNG
1457
1458if test "x$png_libraries" != x && test "x$png_libraries" != xNONE ; then
1459  XLOCK_LDFLAGS="${XLOCK_LDFLAGS}:$png_libraries"
1460  XLOCKLIBPATHS="${XLOCKLIBPATHS} -L$png_libraries"
1461fi
1462if test "x$png_includes" != x && test "x$png_includes" != xNONE ; then
1463  XLOCKINC="${XLOCKINC} -I$png_includes"
1464fi
1465
1466dnl MAGICK ImageMagick
1467
1468AC_DEFUN([AC_PATH_MAGICK],
1469[AC_REQUIRE_CPP()dnl
1470
1471magick_includes=NONE
1472magick_libraries=NONE
1473
1474AC_MSG_CHECKING(for MAGICK)
1475AC_ARG_WITH(magick,            [  --without-magick        disable ImageMagick])
1476AC_ARG_WITH(magick_config,     [  --with-magick-config    use this configator for ImageMagick])
1477AC_ARG_WITH(magick_prefix,     [  --with-magick-prefix    use this prefix for ImageMagick])
1478AC_ARG_WITH(magick_includes,   [  --with-magick-includes  use this dir for ImageMagick headers])
1479AC_ARG_WITH(magick_libraries,  [  --with-magick-libraries use this dir for ImageMagick libs])
1480if test "x$with_magick" = xno; then
1481  no_magick=yes
1482else
1483  if test "x$magick_includes" != xNONE && test "x$magick_libraries" != xNONE; then
1484    no_magick=
1485    if test "x$magick_config" = "x"; then
1486      if test "x$magick_prefix" != "x"; then
1487        magick_config="$magick_prefix/bin/Magick-config"
1488      else
1489        magick_config="Magick-config"
1490     fi
1491   else
1492     if test "x$magick_prefix" = "x"; then
1493        magick_prefix=`($magick_config --prefix) 2>/dev/null`
1494     fi
1495   fi
1496  else
1497    if test "x$magick_config" = "x"; then
1498      if test "x$magick_prefix" != "x"; then
1499        magick_config="$magick_prefix/bin/Magick-config"
1500      else
1501        magick_config="Magick-config"
1502     fi
1503   else
1504     if test "x$magick_prefix" = "x"; then
1505        magick_prefix=`($magick_config --prefix) 2>/dev/null`
1506     fi
1507   fi
1508dnl need magick/MagickCore.h, magick/api.h (Magick-config --version 1.3.28) is not going to work
1509AC_CACHE_VAL(ac_cv_path_magick,
1510[# One or both of these vars are not set, and there is no cached value.
1511no_magick=yes
1512no_magick_config=yes
1513if test "x$magick_prefix" != "x"; then
1514  ac_magick_prefix=$magick_prefix
1515  ac_magick_includes=$ac_magick_prefix/include
1516  ac_magick_libraries=$ac_magick_prefix/lib
1517  no_magick="ac_magick_config=$ac_magick_config ac_magick_prefix=$ac_magick_prefix ac_magick_includes=$ac_magick_includes ac_magick_libraries=$ac_magick_libraries"
1518else
1519  ac_magick_config="$magick_config"
1520  ac_magick_prefix=`($magick_config --prefix) 2>/dev/null`
1521  if test $? != 0; then
1522    no_magick=yes
1523    no_magick_config=yes
1524    ac_magick_config=""
1525    ac_magick_prefix=""
1526  else
1527    no_magick=
1528    no_magick_config=
1529    ac_magick_includes=$ac_magick_prefix/include
1530    ac_magick_libraries=$ac_magick_prefix/lib
1531  fi
1532fi
1533if test "$no_magick" = yes; then
1534  ac_cv_path_magick="no_magick=yes"
1535else
1536  ac_cv_path_magick="no_magick= ac_magick_config=\"$ac_magick_config\" ac_magick_prefix=\"$ac_magick_prefix\" ac_magick_includes=\"$ac_magick_includes\" ac_magick_libraries=\"$ac_magick_libraries\""
1537fi])dnl
1538  fi
1539  eval "$ac_cv_path_magick"
1540fi # with_magick != no
1541
1542if test "$no_magick_config" = yes; then
1543  AC_MSG_RESULT(no Magick-config)
1544else
1545  if test "$no_magick" = yes; then
1546    AC_MSG_RESULT(no)
1547  else
1548    AC_DEFINE([USE_MAGICK], [1], [Image Magick])
1549    test "x$magick_config" = xNONE && magick_config=$ac_magick_config
1550    test "x$magick_prefix" = xNONE && magick_prefix=$ac_magick_prefix
1551    test "x$magick_includes" = xNONE && magick_includes=$ac_magick_includes
1552    test "x$magick_libraries" = xNONE && magick_libraries=$ac_magick_libraries
1553    ac_cv_path_magick="no_magick= ac_magick_config=$magick_config ac_magick_prefix=$magick_prefix ac_magick_includes=$magick_includes ac_magick_libraries=$magick_libraries"
1554    AC_MSG_RESULT([libraries $magick_libraries, headers $magick_includes])
1555  fi
1556fi
1557])
1558
1559AC_PATH_MAGICK
1560
1561if test "x$magick_libraries" != x && test "x$magick_libraries" != xNONE ; then
1562  XLOCKLIBS="${XLOCKLIBS} `$magick_config --libs`"
1563  XLOCK_LDFLAGS="${XLOCK_LDFLAGS}:$magick_libraries"
1564  XLOCKLIBPATHS="${XLOCKLIBPATHS} -L$magick_libraries"
1565fi
1566if test "x$magick_includes" != x && test "x$magick_includes" != xNONE ; then
1567  XLOCKINC="${XLOCKINC} -I$magick_includes `$magick_config --cppflags`"
1568fi
1569
1570gltt=no
1571dnl gltt GLTT
1572
1573AC_DEFUN([AC_PATH_GLTT_DIRECT],
1574[test -z "$gltt_direct_test_library" && gltt_direct_test_library=gltt
1575# test -z "$gltt_direct_test_function" && gltt_direct_test_function=glttCreateImageFromData
1576test -z "$gltt_direct_test_include" && gltt_direct_test_include=gltt/GLTTFont.h
1577  for ac_dir in               \
1578    /usr/X11R6.5.1/include    \
1579    /usr/X11R6.4/include      \
1580    /usr/X11R6.3/include      \
1581    /usr/X11R6.2/include      \
1582    /usr/X11R6.1/include      \
1583    /usr/X11R6/include        \
1584    /usr/X11R5/include        \
1585    /usr/X11R4/include        \
1586    /usr/X11/include          \
1587                              \
1588    /usr/include/X11          \
1589    /usr/include/X11R6.5.1    \
1590    /usr/include/X11R6.4      \
1591    /usr/include/X11R6.3      \
1592    /usr/include/X11R6.2      \
1593    /usr/include/X11R6.1      \
1594    /usr/include/X11R6        \
1595    /usr/include/X11R5        \
1596    /usr/include/X11R4        \
1597                              \
1598    /usr/local/X11/include    \
1599    /usr/local/X11R6.5.1/include  \
1600    /usr/local/X11R6.4/include  \
1601    /usr/local/X11R6.3/include  \
1602    /usr/local/X11R6.2/include  \
1603    /usr/local/X11R6.1/include  \
1604    /usr/local/X11R6/include  \
1605    /usr/local/X11R5/include  \
1606    /usr/local/X11R4/include  \
1607                              \
1608    /usr/local/include/X11    \
1609    /usr/local/include/X11R6.5.1  \
1610    /usr/local/include/X11R6.4  \
1611    /usr/local/include/X11R6.3  \
1612    /usr/local/include/X11R6.2  \
1613    /usr/local/include/X11R6.1  \
1614    /usr/local/include/X11R6  \
1615    /usr/local/include/X11R5  \
1616    /usr/local/include/X11R4  \
1617                              \
1618    /usr/X386/include         \
1619    /usr/x386/include         \
1620    /usr/XFree86/include/X11  \
1621    /usr/pkg/include          \
1622                              \
1623    /usr/local/include        \
1624    /usr/remote/include       \
1625    /usr/include              \
1626    /usr/unsupported/include  \
1627    /usr/athena/include       \
1628    /usr/local/x11r5/include  \
1629    /usr/lpp/Xamples/include  \
1630                              \
1631    /usr/openwin/include      \
1632    /usr/openwin/share/include \
1633    /usr/openwin/include      \
1634                              \
1635    $extra_include            \
1636    ; \
1637  do
1638    if test -r "$ac_dir/$gltt_direct_test_include"; then
1639      no_gltt= ac_gltt_includes=$ac_dir
1640      break
1641    fi
1642  done
1643
1644# Check for the libraries.
1645# See if we find them without any special options.
1646# Do not add to $LIBS permanently.
1647ac_save_LIBS="$LIBS"
1648LIBS="-l$gltt_direct_test_library $LIBS"
1649# First see if replacing the include by lib works.
1650for ac_dir in `echo "$ac_gltt_includes" | sed s%/X11$%% | sed s/include/lib/` \
1651                          \
1652    /usr/X11/lib          \
1653    /usr/X11R6.5.1/lib      \
1654    /usr/X11R6.4/lib        \
1655    /usr/X11R6.3/lib        \
1656    /usr/X11R6.2/lib        \
1657    /usr/X11R6.1/lib        \
1658    /usr/X11R6/lib        \
1659    /usr/X11R5/lib        \
1660    /usr/X11R4/lib        \
1661                          \
1662    /usr/lib/X11          \
1663    /usr/lib/X11R6.5.1      \
1664    /usr/lib/X11R6.4        \
1665    /usr/lib/X11R6.3        \
1666    /usr/lib/X11R6.2        \
1667    /usr/lib/X11R6.1        \
1668    /usr/lib/X11R6        \
1669    /usr/lib/X11R5        \
1670    /usr/lib/X11R4        \
1671                          \
1672    /usr/local/X11/lib    \
1673    /usr/local/X11R6/lib  \
1674    /usr/local/X11R5/lib  \
1675    /usr/local/X11R4/lib  \
1676                          \
1677    /usr/local/lib/X11    \
1678    /usr/local/X11R6.5.1/lib  \
1679    /usr/local/X11R6.4/lib  \
1680    /usr/local/X11R6.3/lib  \
1681    /usr/local/X11R6.2/lib  \
1682    /usr/local/X11R6.1/lib  \
1683    /usr/local/lib/X11R6  \
1684    /usr/local/lib/X11R5  \
1685    /usr/local/lib/X11R4  \
1686                          \
1687    /usr/X386/lib         \
1688    /usr/x386/lib         \
1689    /usr/XFree86/lib/X11  \
1690    /usr/pkg/lib          \
1691                          \
1692    /usr/lib              \
1693    /usr/local/lib        \
1694    /usr/remote/lib       \
1695    /usr/unsupported/lib  \
1696    /usr/athena/lib       \
1697    /usr/local/x11r5/lib  \
1698    /usr/lpp/Xamples/lib  \
1699    /lib/usr/lib/X11      \
1700                          \
1701    /usr/openwin/lib      \
1702    /usr/openwin/share/lib \
1703    $extra_lib            \
1704    ; \
1705do
1706  for ac_extension in a so sl; do
1707    if test -r $ac_dir/lib${gltt_direct_test_library}.$ac_extension; then
1708      no_gltt= ac_gltt_libraries=$ac_dir
1709      break 2
1710   fi
1711  done
1712done
1713LIBS="$ac_save_LIBS"])
1714AC_DEFUN([AC_PATH_GLTT],
1715[AC_REQUIRE_CPP()dnl
1716
1717gltt_includes=NONE
1718gltt_libraries=NONE
1719
1720AC_MSG_CHECKING(for GLTT)
1721AC_ARG_WITH(gltt, [  --without-gltt          disable GL True Text library])
1722if test "x$with_gltt" = xno; then
1723  no_gltt=yes
1724else
1725  if test "x$gltt_includes" != xNONE && test "x$gltt_libraries" != xNONE; then
1726    no_gltt=
1727  else
1728AC_CACHE_VAL(ac_cv_path_gltt,
1729[# One or both of these vars are not set, and there is no cached value.
1730no_gltt=yes
1731AC_PATH_GLTT_DIRECT
1732
1733if test "$no_gltt" = yes; then
1734  ac_cv_path_gltt="no_gltt=yes"
1735else
1736  ac_cv_path_gltt="no_gltt= ac_gltt_includes=$ac_gltt_includes ac_gltt_libraries=$ac_gltt_libraries"
1737fi])dnl
1738  fi
1739  eval "$ac_cv_path_gltt"
1740fi # with_gltt != no
1741
1742if test "$no_gltt" = yes; then
1743  AC_MSG_RESULT(no)
1744  GLTT="#"
1745else
1746  gltt=yes
1747  AC_DEFINE([HAVE_GLTT], [1], [GL True Text])
1748  XLOCKLIBS="${XLOCKLIBS} -lgltt"
1749  test "x$gltt_includes" = xNONE && gltt_includes=$ac_gltt_includes
1750  test "x$gltt_libraries" = xNONE && gltt_libraries=$ac_gltt_libraries
1751  ac_cv_path_gltt="no_gltt= ac_gltt_includes=$gltt_includes ac_gltt_libraries=$gltt_libraries"
1752  AC_MSG_RESULT([libraries $gltt_libraries, headers $gltt_includes])
1753  GLTT=""
1754fi
1755])
1756
1757AC_PATH_GLTT
1758
1759if test "x$gltt_libraries" != x && test "x$gltt_libraries" != xNONE ; then
1760  XLOCK_LDFLAGS="${XLOCK_LDFLAGS}:$gltt_libraries"
1761  XLOCKLIBPATHS="${XLOCKLIBPATHS} -L$gltt_libraries"
1762fi
1763if test "x$gltt_includes" != x && test "x$gltt_includes" != xNONE ; then
1764  XLOCKINC="${XLOCKINC} -I$gltt_includes"
1765fi
1766
1767ttf=no
1768dnl ttf TTF
1769
1770AC_DEFUN([AC_PATH_TTF_DIRECT],
1771[test -z "$ttf_direct_test_library" && ttf_direct_test_library=ttf
1772test -z "$ttf_direct_test_function" && ttf_direct_test_function=TT_Init_FreeType
1773test -z "$ttf_direct_test_include" && ttf_direct_test_include=gltt/FTFace.h
1774  for ac_dir in               \
1775    /usr/X11R6.5.1/include    \
1776    /usr/X11R6.4/include      \
1777    /usr/X11R6.3/include      \
1778    /usr/X11R6.2/include      \
1779    /usr/X11R6.1/include      \
1780    /usr/X11R6/include        \
1781    /usr/X11R5/include        \
1782    /usr/X11R4/include        \
1783    /usr/X11/include          \
1784                              \
1785    /usr/include/X11          \
1786    /usr/include/X11R6.5.1    \
1787    /usr/include/X11R6.4      \
1788    /usr/include/X11R6.3      \
1789    /usr/include/X11R6.2      \
1790    /usr/include/X11R6.1      \
1791    /usr/include/X11R6        \
1792    /usr/include/X11R5        \
1793    /usr/include/X11R4        \
1794                              \
1795    /usr/local/X11/include    \
1796    /usr/local/X11R6.5.1/include  \
1797    /usr/local/X11R6.4/include  \
1798    /usr/local/X11R6.3/include  \
1799    /usr/local/X11R6.2/include  \
1800    /usr/local/X11R6.1/include  \
1801    /usr/local/X11R6/include  \
1802    /usr/local/X11R5/include  \
1803    /usr/local/X11R4/include  \
1804                              \
1805    /usr/local/include/X11    \
1806    /usr/local/include/X11R6.5.1  \
1807    /usr/local/include/X11R6.4  \
1808    /usr/local/include/X11R6.3  \
1809    /usr/local/include/X11R6.2  \
1810    /usr/local/include/X11R6.1  \
1811    /usr/local/include/X11R6  \
1812    /usr/local/include/X11R5  \
1813    /usr/local/include/X11R4  \
1814                              \
1815    /usr/X386/include         \
1816    /usr/x386/include         \
1817    /usr/XFree86/include/X11  \
1818    /usr/pkg/include          \
1819                              \
1820    /usr/local/include        \
1821    /usr/remote/include       \
1822    /usr/include/X11          \
1823    /usr/unsupported/include  \
1824    /usr/athena/include       \
1825    /usr/local/x11r5/include  \
1826    /usr/lpp/Xamples/include  \
1827                              \
1828    /usr/openwin/include      \
1829    /usr/openwin/share/include \
1830    /usr/openwin/include      \
1831                              \
1832    $extra_include            \
1833    ; \
1834  do
1835    if test -r "$ac_dir/$ttf_direct_test_include"; then
1836      no_ttf= ac_ttf_includes=$ac_dir
1837      break
1838    fi
1839  done
1840
1841# Check for the libraries.
1842# See if we find them without any special options.
1843# Do not add to $LIBS permanently.
1844ac_save_LIBS="$LIBS"
1845LIBS="-l$ttf_direct_test_library $LIBS"
1846# First see if replacing the include by lib works.
1847for ac_dir in `echo "$ac_ttf_includes" | sed s%/X11$%% | sed s/include/lib/` \
1848                          \
1849    /usr/X11/lib          \
1850    /usr/X11R6.5.1/lib      \
1851    /usr/X11R6.4/lib        \
1852    /usr/X11R6.3/lib        \
1853    /usr/X11R6.2/lib        \
1854    /usr/X11R6.1/lib        \
1855    /usr/X11R6/lib        \
1856    /usr/X11R5/lib        \
1857    /usr/X11R4/lib        \
1858                          \
1859    /usr/lib/X11          \
1860    /usr/lib/X11R6.5.1      \
1861    /usr/lib/X11R6.4        \
1862    /usr/lib/X11R6.3        \
1863    /usr/lib/X11R6.2        \
1864    /usr/lib/X11R6.1        \
1865    /usr/lib/X11R6        \
1866    /usr/lib/X11R5        \
1867    /usr/lib/X11R4        \
1868                          \
1869    /usr/local/X11/lib    \
1870    /usr/local/X11R6/lib  \
1871    /usr/local/X11R5/lib  \
1872    /usr/local/X11R4/lib  \
1873                          \
1874    /usr/local/lib/X11    \
1875    /usr/local/X11R6.5.1/lib  \
1876    /usr/local/X11R6.4/lib  \
1877    /usr/local/X11R6.3/lib  \
1878    /usr/local/X11R6.2/lib  \
1879    /usr/local/X11R6.1/lib  \
1880    /usr/local/lib/X11R6  \
1881    /usr/local/lib/X11R5  \
1882    /usr/local/lib/X11R4  \
1883                          \
1884    /usr/X386/lib         \
1885    /usr/x386/lib         \
1886    /usr/XFree86/lib/X11  \
1887    /usr/pkg/lib          \
1888                          \
1889    /usr/lib              \
1890    /usr/local/lib        \
1891    /usr/remote/lib       \
1892    /usr/unsupported/lib  \
1893    /usr/athena/lib       \
1894    /usr/local/x11r5/lib  \
1895    /usr/lpp/Xamples/lib  \
1896    /lib/usr/lib/X11      \
1897                          \
1898    /usr/openwin/lib      \
1899    /usr/openwin/share/lib \
1900    $extra_lib            \
1901    ; \
1902do
1903  for ac_extension in a so sl; do
1904    if test -r $ac_dir/lib${ttf_direct_test_library}.$ac_extension; then
1905      no_ttf= ac_ttf_libraries=$ac_dir
1906      break 2
1907   fi
1908  done
1909done
1910LIBS="$ac_save_LIBS"])
1911AC_DEFUN([AC_PATH_TTF],
1912[AC_REQUIRE_CPP()dnl
1913
1914ttf_includes=NONE
1915ttf_libraries=NONE
1916
1917AC_MSG_CHECKING(for TTF)
1918AC_ARG_WITH(ttf, [  --without-ttf           disable True Text Font mode(s)])
1919if test "x$with_ttf" = xno; then
1920  no_ttf=yes
1921else
1922  if test "x$ttf_includes" != xNONE && test "x$ttf_libraries" != xNONE; then
1923    no_ttf=
1924  else
1925AC_CACHE_VAL(ac_cv_path_ttf,
1926[# One or both of these vars are not set, and there is no cached value.
1927no_ttf=yes
1928AC_PATH_TTF_DIRECT
1929
1930if test "$no_ttf" = yes; then
1931  ac_cv_path_ttf="no_ttf=yes"
1932else
1933  ac_cv_path_ttf="no_ttf= ac_ttf_includes=$ac_ttf_includes ac_ttf_libraries=$ac_ttf_libraries"
1934fi])dnl
1935  fi
1936  eval "$ac_cv_path_ttf"
1937fi # with_ttf != no
1938
1939if test "$no_ttf" = yes; then
1940  AC_MSG_RESULT(no)
1941  TTF="#"
1942else
1943  ttf=yes
1944  AC_DEFINE([HAVE_TTF], [1], [True Text Font])
1945  if test "x$prefix" = "xNONE"; then
1946    AC_DEFINE_UNQUOTED([DEF_TTFONT], ["/usr/lib/X11/xlock/fonts/"], [True Text Font])
1947  else
1948    AC_DEFINE_UNQUOTED([DEF_TTFONT], ["${prefix}/lib/X11/xlock/fonts/"], [True Text Font])
1949  fi
1950  XLOCKLIBS="${XLOCKLIBS} -lttf"
1951  test "x$ttf_includes" = xNONE && ttf_includes=$ac_ttf_includes
1952  test "x$ttf_libraries" = xNONE && ttf_libraries=$ac_ttf_libraries
1953  ac_cv_path_ttf="no_ttf= ac_ttf_includes=$ttf_includes ac_ttf_libraries=$ttf_libraries"
1954  AC_MSG_RESULT([libraries $ttf_libraries, headers $ttf_includes])
1955  TTF=""
1956fi
1957])
1958
1959AC_PATH_TTF
1960
1961if test "x$ttf_libraries" != x && test "x$ttf_libraries" != xNONE ; then
1962  XLOCK_LDFLAGS="${XLOCK_LDFLAGS}:$ttf_libraries"
1963  XLOCKLIBPATHS="${XLOCKLIBPATHS} -L$ttf_libraries"
1964fi
1965if test "x$ttf_includes" != x && test "x$ttf_includes" != xNONE ; then
1966  XLOCKINC="${XLOCKINC} -I$ttf_includes"
1967fi
1968
1969ftgl=no
1970dnl ftgl FTGL
1971
1972AC_DEFUN([AC_PATH_FTGL_DIRECT],
1973[test -z "$ftgl_direct_test_library" && ftgl_direct_test_library=ftgl
1974# test -z "$ftgl_direct_test_function" && ftgl_direct_test_function=ftglCreateImageFromData
1975test -z "$ftgl_direct_test_include" && ftgl_direct_test_include=FTGL/FTFont.h
1976  for ac_dir in               \
1977    /usr/X11R6.5.1/include    \
1978    /usr/X11R6.4/include      \
1979    /usr/X11R6.3/include      \
1980    /usr/X11R6.2/include      \
1981    /usr/X11R6.1/include      \
1982    /usr/X11R6/include        \
1983    /usr/X11R5/include        \
1984    /usr/X11R4/include        \
1985    /usr/X11/include          \
1986                              \
1987    /usr/include/X11          \
1988    /usr/include/X11R6.5.1    \
1989    /usr/include/X11R6.4      \
1990    /usr/include/X11R6.3      \
1991    /usr/include/X11R6.2      \
1992    /usr/include/X11R6.1      \
1993    /usr/include/X11R6        \
1994    /usr/include/X11R5        \
1995    /usr/include/X11R4        \
1996                              \
1997    /usr/local/X11/include    \
1998    /usr/local/X11R6.5.1/include  \
1999    /usr/local/X11R6.4/include  \
2000    /usr/local/X11R6.3/include  \
2001    /usr/local/X11R6.2/include  \
2002    /usr/local/X11R6.1/include  \
2003    /usr/local/X11R6/include  \
2004    /usr/local/X11R5/include  \
2005    /usr/local/X11R4/include  \
2006                              \
2007    /usr/local/include/X11    \
2008    /usr/local/include/X11R6.5.1  \
2009    /usr/local/include/X11R6.4  \
2010    /usr/local/include/X11R6.3  \
2011    /usr/local/include/X11R6.2  \
2012    /usr/local/include/X11R6.1  \
2013    /usr/local/include/X11R6  \
2014    /usr/local/include/X11R5  \
2015    /usr/local/include/X11R4  \
2016                              \
2017    /usr/X386/include         \
2018    /usr/x386/include         \
2019    /usr/XFree86/include/X11  \
2020    /usr/pkg/include          \
2021                              \
2022    /usr/local/include        \
2023    /usr/remote/include       \
2024    /usr/include              \
2025    /usr/unsupported/include  \
2026    /usr/athena/include       \
2027    /usr/local/x11r5/include  \
2028    /usr/lpp/Xamples/include  \
2029                              \
2030    /usr/openwin/include      \
2031    /usr/openwin/share/include \
2032    /usr/openwin/include      \
2033                              \
2034    $extra_include            \
2035    ; \
2036  do
2037    if test -r "$ac_dir/$ftgl_direct_test_include"; then
2038      no_ftgl= ac_ftgl_includes=$ac_dir
2039      break
2040    fi
2041  done
2042
2043# Check for the libraries.
2044# See if we find them without any special options.
2045# Do not add to $LIBS permanently.
2046ac_save_LIBS="$LIBS"
2047LIBS="-l$ftgl_direct_test_library $LIBS"
2048# First see if replacing the include by lib works.
2049for ac_dir in `echo "$ac_ftgl_includes" | sed s%/X11$%% | sed s/include/lib/` \
2050                          \
2051    /usr/X11/lib          \
2052    /usr/X11R6.5.1/lib      \
2053    /usr/X11R6.4/lib        \
2054    /usr/X11R6.3/lib        \
2055    /usr/X11R6.2/lib        \
2056    /usr/X11R6.1/lib        \
2057    /usr/X11R6/lib        \
2058    /usr/X11R5/lib        \
2059    /usr/X11R4/lib        \
2060                          \
2061    /usr/lib/X11          \
2062    /usr/lib/X11R6.5.1      \
2063    /usr/lib/X11R6.4        \
2064    /usr/lib/X11R6.3        \
2065    /usr/lib/X11R6.2        \
2066    /usr/lib/X11R6.1        \
2067    /usr/lib/X11R6        \
2068    /usr/lib/X11R5        \
2069    /usr/lib/X11R4        \
2070                          \
2071    /usr/local/X11/lib    \
2072    /usr/local/X11R6/lib  \
2073    /usr/local/X11R5/lib  \
2074    /usr/local/X11R4/lib  \
2075                          \
2076    /usr/local/lib/X11    \
2077    /usr/local/X11R6.5.1/lib  \
2078    /usr/local/X11R6.4/lib  \
2079    /usr/local/X11R6.3/lib  \
2080    /usr/local/X11R6.2/lib  \
2081    /usr/local/X11R6.1/lib  \
2082    /usr/local/lib/X11R6  \
2083    /usr/local/lib/X11R5  \
2084    /usr/local/lib/X11R4  \
2085                          \
2086    /usr/X386/lib         \
2087    /usr/x386/lib         \
2088    /usr/XFree86/lib/X11  \
2089    /usr/pkg/lib          \
2090                          \
2091    /usr/lib              \
2092    /usr/local/lib        \
2093    /usr/remote/lib       \
2094    /usr/unsupported/lib  \
2095    /usr/athena/lib       \
2096    /usr/local/x11r5/lib  \
2097    /usr/lpp/Xamples/lib  \
2098    /lib/usr/lib/X11      \
2099                          \
2100    /usr/openwin/lib      \
2101    /usr/openwin/share/lib \
2102    $extra_lib            \
2103    ; \
2104do
2105  for ac_extension in a so sl; do
2106    if test -r $ac_dir/lib${ftgl_direct_test_library}.$ac_extension; then
2107      no_ftgl= ac_ftgl_libraries=$ac_dir
2108      break 2
2109   fi
2110  done
2111done
2112LIBS="$ac_save_LIBS"])
2113AC_DEFUN([AC_PATH_FTGL],
2114[AC_REQUIRE_CPP()dnl
2115
2116ftgl_includes=NONE
2117ftgl_libraries=NONE
2118
2119AC_MSG_CHECKING(for FTGL)
2120AC_ARG_WITH(ftgl, [  --without-ftgl          disable GL font rendering library])
2121if test "x$with_ftgl" = xno; then
2122  no_ftgl=yes
2123else
2124  if test "x$ftgl_includes" != xNONE && test "x$ftgl_libraries" != xNONE; then
2125    no_ftgl=
2126  else
2127AC_CACHE_VAL(ac_cv_path_ftgl,
2128[# One or both of these vars are not set, and there is no cached value.
2129no_ftgl=yes
2130AC_PATH_FTGL_DIRECT
2131
2132if test "$no_ftgl" = yes; then
2133  ac_cv_path_ftgl="no_ftgl=yes"
2134else
2135  ac_cv_path_ftgl="no_ftgl= ac_ftgl_includes=$ac_ftgl_includes ac_ftgl_libraries=$ac_ftgl_libraries"
2136fi])dnl
2137  fi
2138  eval "$ac_cv_path_ftgl"
2139fi # with_ftgl != no
2140
2141if test "$no_ftgl" = yes; then
2142  AC_MSG_RESULT(no)
2143  FTGL="#"
2144else
2145  ftgl=yes
2146  AC_DEFINE([HAVE_FTGL], [1], [GL Font Rendering Library])
2147  XLOCKLIBS="${XLOCKLIBS} -lftgl"
2148  test "x$ftgl_includes" = xNONE && ftgl_includes=$ac_ftgl_includes
2149  test "x$ftgl_libraries" = xNONE && ftgl_libraries=$ac_ftgl_libraries
2150  ac_cv_path_ftgl="no_ftgl= ac_ftgl_includes=$ftgl_includes ac_ftgl_libraries=$ftgl_libraries"
2151  AC_MSG_RESULT([libraries $ftgl_libraries, headers $ftgl_includes])
2152  FTGL=""
2153fi
2154])
2155
2156AC_PATH_FTGL
2157
2158if test "x$ftgl_libraries" != x && test "x$ftgl_libraries" != xNONE ; then
2159  XLOCK_LDFLAGS="${XLOCK_LDFLAGS}:$ftgl_libraries"
2160  XLOCKLIBPATHS="${XLOCKLIBPATHS} -L$ftgl_libraries"
2161fi
2162if test "x$ftgl_includes" != x && test "x$ftgl_includes" != xNONE ; then
2163  XLOCKINC="${XLOCKINC} -I$ftgl_includes"
2164fi
2165
2166freetype=no
2167dnl freetype FREETYPE
2168
2169AC_DEFUN([AC_PATH_FREETYPE_DIRECT],
2170[test -z "$freetype_direct_test_library" && freetype_direct_test_library=freetype
2171test -z "$freetype_direct_test_function" && freetype_direct_test_function=FT_Init_FreeType
2172test -z "$freetype_direct_test_include" && freetype_direct_test_include=freetype2/freetype.h
2173  for ac_dir in               \
2174    /usr/X11R6.5.1/include	    \
2175    /usr/X11R6.4/include	      \
2176    /usr/X11R6.3/include	      \
2177    /usr/X11R6.2/include	      \
2178    /usr/X11R6.1/include	      \
2179    /usr/X11R6/include	        \
2180    /usr/X11R5/include	        \
2181    /usr/X11R4/include	        \
2182    /usr/X11/include	          \
2183                              \
2184    /usr/include/X11	          \
2185    /usr/include/X11R6.5.1	    \
2186    /usr/include/X11R6.4	      \
2187    /usr/include/X11R6.3	      \
2188    /usr/include/X11R6.2	      \
2189    /usr/include/X11R6.1	      \
2190    /usr/include/X11R6	        \
2191    /usr/include/X11R5	        \
2192    /usr/include/X11R4	        \
2193                              \
2194    /usr/local/X11/include	    \
2195    /usr/local/X11R6.5.1/include	  \
2196    /usr/local/X11R6.4/include	  \
2197    /usr/local/X11R6.3/include	  \
2198    /usr/local/X11R6.2/include	  \
2199    /usr/local/X11R6.1/include	  \
2200    /usr/local/X11R6/include	  \
2201    /usr/local/X11R5/include	  \
2202    /usr/local/X11R4/include	  \
2203                              \
2204    /usr/local/include/X11	    \
2205    /usr/local/include/X11R6.5.1	  \
2206    /usr/local/include/X11R6.4	  \
2207    /usr/local/include/X11R6.3	  \
2208    /usr/local/include/X11R6.2	  \
2209    /usr/local/include/X11R6.1	  \
2210    /usr/local/include/X11R6	  \
2211    /usr/local/include/X11R5	  \
2212    /usr/local/include/X11R4	  \
2213                              \
2214    /usr/X386/include	         \
2215    /usr/x386/include	         \
2216    /usr/XFree86/include/X11	  \
2217    /usr/pkg/include          \
2218                              \
2219    /usr/include	        \
2220    /usr/local/include	        \
2221    /usr/remote/include	       \
2222    /usr/include/X11	          \
2223    /usr/unsupported/include	  \
2224    /usr/athena/include	       \
2225    /usr/local/x11r5/include	  \
2226    /usr/lpp/Xamples/include	  \
2227                              \
2228    /usr/openwin/include	      \
2229    /usr/openwin/share/include	 \
2230    /usr/openwin/include	      \
2231                              \
2232    $extra_include	            \
2233    ; \
2234  do
2235    if test -r "$ac_dir/$freetype_direct_test_include"; then
2236      no_freetype= ac_freetype_includes=$ac_dir/freetype2
2237      break
2238    fi
2239  done
2240
2241# Check for the libraries.
2242# See if we find them without any special options.
2243# Do not add to $LIBS permanently.
2244ac_save_LIBS="$LIBS"
2245LIBS="-l$freetype_direct_test_library $LIBS"
2246# First see if replacing the include by lib works.
2247for ac_dir in `echo "$ac_freetype_includes" | sed s%/X11$%% | sed s/include/lib/` \
2248                          \
2249    /usr/X11/lib          \
2250    /usr/X11R6.5.1/lib      \
2251    /usr/X11R6.4/lib        \
2252    /usr/X11R6.3/lib        \
2253    /usr/X11R6.2/lib        \
2254    /usr/X11R6.1/lib        \
2255    /usr/X11R6/lib        \
2256    /usr/X11R5/lib        \
2257    /usr/X11R4/lib        \
2258                          \
2259    /usr/lib/X11          \
2260    /usr/lib/X11R6.5.1      \
2261    /usr/lib/X11R6.4        \
2262    /usr/lib/X11R6.3        \
2263    /usr/lib/X11R6.2        \
2264    /usr/lib/X11R6.1        \
2265    /usr/lib/X11R6        \
2266    /usr/lib/X11R5        \
2267    /usr/lib/X11R4        \
2268                          \
2269    /usr/local/X11/lib    \
2270    /usr/local/X11R6/lib  \
2271    /usr/local/X11R5/lib  \
2272    /usr/local/X11R4/lib  \
2273                          \
2274    /usr/local/lib/X11    \
2275    /usr/local/X11R6.5.1/lib  \
2276    /usr/local/X11R6.4/lib  \
2277    /usr/local/X11R6.3/lib  \
2278    /usr/local/X11R6.2/lib  \
2279    /usr/local/X11R6.1/lib  \
2280    /usr/local/lib/X11R6  \
2281    /usr/local/lib/X11R5  \
2282    /usr/local/lib/X11R4  \
2283                          \
2284    /usr/X386/lib         \
2285    /usr/x386/lib         \
2286    /usr/XFree86/lib/X11  \
2287    /usr/pkg/lib          \
2288                          \
2289    /usr/lib              \
2290    /usr/local/lib        \
2291    /usr/remote/lib       \
2292    /usr/unsupported/lib  \
2293    /usr/athena/lib       \
2294    /usr/local/x11r5/lib  \
2295    /usr/lpp/Xamples/lib  \
2296    /lib/usr/lib/X11      \
2297                          \
2298    /usr/openwin/lib      \
2299    /usr/openwin/share/lib \
2300    $extra_lib            \
2301    ; \
2302do
2303  for ac_extension in a so sl; do
2304    if test -r $ac_dir/lib${freetype_direct_test_library}.$ac_extension; then
2305      no_freetype= ac_freetype_libraries=$ac_dir
2306      break 2
2307   fi
2308  done
2309done
2310LIBS="$ac_save_LIBS"])
2311AC_DEFUN([AC_PATH_FREETYPE],
2312[AC_REQUIRE_CPP()dnl
2313
2314freetype_includes=NONE
2315freetype_libraries=NONE
2316
2317AC_MSG_CHECKING(for FREETYPE2)
2318AC_ARG_WITH(freetype, [  --without-freetype      disable Freetype2 mode(s)])
2319if test "x$with_freetype" = xno; then
2320  no_freetype=yes
2321else
2322  if test "x$freetype_includes" != xNONE && test "x$freetype_libraries" != xNONE; then
2323    no_freetype=
2324  else
2325AC_CACHE_VAL(ac_cv_path_freetype,
2326[# One or both of these vars are not set, and there is no cached value.
2327no_freetype=yes
2328AC_PATH_FREETYPE_DIRECT
2329
2330if test "$no_freetype" = yes; then
2331  ac_cv_path_freetype="no_freetype=yes"
2332else
2333  ac_cv_path_freetype="no_freetype= ac_freetype_includes=$ac_freetype_includes ac_freetype_libraries=$ac_freetype_libraries"
2334fi])dnl
2335  fi
2336  eval "$ac_cv_path_freetype"
2337fi # with_freetype != no
2338
2339if test "$no_freetype" = yes; then
2340  AC_MSG_RESULT(no)
2341  FREETYPE="#"
2342else
2343  freetype=yes
2344  AC_DEFINE([HAVE_FREETYPE], [1], [Free Type])
2345  if test "x$prefix" = "xNONE"; then
2346    AC_DEFINE_UNQUOTED([DEF_TTFONT], ["/usr/lib/X11/xlock/fonts/"], [True Text Font])
2347  else
2348    AC_DEFINE_UNQUOTED([DEF_TTFONT], ["${prefix}/lib/X11/xlock/fonts/"], [True Text Font])
2349  fi
2350  XLOCKLIBS="${XLOCKLIBS} -lfreetype"
2351  test "x$freetype_includes" = xNONE && freetype_includes=$ac_freetype_includes
2352  test "x$freetype_libraries" = xNONE && freetype_libraries=$ac_freetype_libraries
2353  ac_cv_path_freetype="no_freetype= ac_freetype_includes=$freetype_includes ac_freetype_libraries=$freetype_libraries"
2354  AC_MSG_RESULT([libraries $freetype_libraries, headers $freetype_includes])
2355  FREETYPE=""
2356fi
2357])
2358
2359AC_PATH_FREETYPE
2360
2361if test "x$freetype_libraries" != x && test "x$freetype_libraries" != xNONE ; then
2362  XLOCK_LDFLAGS="${XLOCK_LDFLAGS}:$freetype_libraries"
2363  XLOCKLIBPATHS="${XLOCKLIBPATHS} -L$freetype_libraries"
2364fi
2365if test "x$freetype_includes" != x && test "x$freetype_includes" != xNONE ; then
2366  XLOCKINC="${XLOCKINC} -I$freetype_includes"
2367fi
2368
2369gl=no
2370dnl OpenGL opengl
2371
2372dnl test -z "$opengl_direct_test_library" && opengl_direct_test_library=opengl
2373AC_DEFUN([AC_PATH_OPENGL_DIRECT],
2374[test -z "$opengl_direct_test_library" && opengl_direct_test_library=GL
2375test -z "$opengl_direct_test_library" && opengl_direct_test_library=GLU
2376test -z "$opengl_direct_test_function" && opengl_direct_test_function=glXCreateContext
2377test -z "$opengl_direct_test_include" && opengl_direct_test_include=GL/gl.h
2378  for ac_dir in               \
2379    /usr/include              \
2380    /usr/openwin/include      \
2381    /usr/openwin/share/include \
2382                              \
2383    /usr/X11R6.5.1/include    \
2384    /usr/X11R6.4/include      \
2385    /usr/X11R6.3/include      \
2386    /usr/X11R6.2/include      \
2387    /usr/X11R6.1/include      \
2388    /usr/X11R6/include        \
2389    /usr/X11R5/include        \
2390    /usr/X11/include          \
2391                              \
2392    /usr/include/X11          \
2393    /usr/include/X11R6.5.1    \
2394    /usr/include/X11R6.4      \
2395    /usr/include/X11R6.3      \
2396    /usr/include/X11R6.2      \
2397    /usr/include/X11R6.1      \
2398    /usr/include/X11R6        \
2399    /usr/include/X11R5        \
2400                              \
2401    /usr/local/X11/include    \
2402    /usr/local/X11R6.5.1/include  \
2403    /usr/local/X11R6.4/include  \
2404    /usr/local/X11R6.3/include  \
2405    /usr/local/X11R6.2/include  \
2406    /usr/local/X11R6.1/include  \
2407    /usr/local/X11R6/include  \
2408    /usr/local/X11R5/include  \
2409                              \
2410    /usr/local/include/X11    \
2411    /usr/local/include/X11R6.5.1  \
2412    /usr/local/include/X11R6.4  \
2413    /usr/local/include/X11R6.3  \
2414    /usr/local/include/X11R6.2  \
2415    /usr/local/include/X11R6.1  \
2416    /usr/local/include/X11R6  \
2417    /usr/local/include/X11R5  \
2418                              \
2419    /usr/X386/include         \
2420    /usr/x386/include         \
2421    /usr/XFree86/include/X11  \
2422    /usr/pkg/include          \
2423                              \
2424    /usr/local/include        \
2425    /usr/remote/include       \
2426    /usr/unsupported/include  \
2427    /usr/local/x11r5/include  \
2428    /usr/lpp/Xamples/include  \
2429                              \
2430    $extra_include            \
2431    ; \
2432  do
2433dnl # Make sure this is not Mesa
2434dnl    if test -r "$ac_dir/$opengl_direct_test_include" && test ! -r "$ac_dir/GL/xmesa.h"; then
2435    if test -r "$ac_dir/$opengl_direct_test_include"; then
2436      no_opengl= ac_opengl_includes=$ac_dir
2437      break
2438    fi
2439  done
2440
2441# Check for the libraries.
2442# See if we find them without any special options.
2443# Do not add to $LIBS permanently.
2444ac_save_LIBS="$LIBS"
2445LIBS="-l$opengl_direct_test_library $LIBS"
2446# First see if replacing the include by lib works.
2447for ac_dir in `echo "$ac_opengl_includes" | sed s/include/lib/` \
2448                          \
2449    /usr/lib              \
2450    /usr/openwin/lib      \
2451    /usr/openwin/share/lib \
2452                          \
2453    /usr/X11/lib          \
2454    /usr/X11R6.5.1/lib    \
2455    /usr/X11R6.4/lib      \
2456    /usr/X11R6.3/lib      \
2457    /usr/X11R6.2/lib      \
2458    /usr/X11R6.1/lib      \
2459    /usr/X11R6/lib        \
2460    /usr/X11R5/lib        \
2461                          \
2462    /usr/lib/X11          \
2463    /usr/lib/X11R6.5.1    \
2464    /usr/lib/X11R6.4      \
2465    /usr/lib/X11R6.3      \
2466    /usr/lib/X11R6.2      \
2467    /usr/lib/X11R6.1      \
2468    /usr/lib/X11R6        \
2469    /usr/lib/X11R5        \
2470                          \
2471    /usr/local/X11/lib    \
2472    /usr/local/X11R6.5.1/lib  \
2473    /usr/local/X11R6.4/lib  \
2474    /usr/local/X11R6.3/lib  \
2475    /usr/local/X11R6.2/lib  \
2476    /usr/local/X11R6.1/lib  \
2477    /usr/local/X11R6/lib  \
2478    /usr/local/X11R5/lib  \
2479                          \
2480    /usr/local/lib/X11    \
2481    /usr/local/lib/X11R6.5.1  \
2482    /usr/local/lib/X11R6.4  \
2483    /usr/local/lib/X11R6.3  \
2484    /usr/local/lib/X11R6.2  \
2485    /usr/local/lib/X11R6.1  \
2486    /usr/local/lib/X11R6  \
2487    /usr/local/lib/X11R5  \
2488                          \
2489    /usr/X386/lib         \
2490    /usr/x386/lib         \
2491    /usr/XFree86/lib/X11  \
2492    /usr/pkg/lib          \
2493                          \
2494    /usr/local/lib        \
2495    /usr/remote/lib       \
2496    /usr/unsupported/lib  \
2497    /usr/athena/lib       \
2498    /usr/local/x11r5/lib  \
2499    /usr/lpp/Xamples/lib  \
2500    /lib/usr/lib/X11      \
2501                          \
2502    $extra_lib            \
2503    ; \
2504do
2505  for ac_extension in a so sl; do
2506# Make sure its not a symbolic link to MesaGL library
2507
2508    if test -r $ac_dir/lib${opengl_direct_test_library}.$ac_extension && test ! $ac_link_test $ac_dir/lib${opengl_direct_test_library}.$ac_extension && test ! -r $ac_dir/libMesa${opengl_direct_test_library}.$ac_extension; then
2509      no_opengl= ac_opengl_libraries=$ac_dir
2510      break 2
2511    fi
2512  done
2513done
2514LIBS="$ac_save_LIBS"])
2515AC_DEFUN([AC_PATH_OPENGL],
2516[AC_REQUIRE_CPP()dnl
2517
2518opengl_includes=NONE
2519opengl_libraries=NONE
2520
2521AC_MSG_CHECKING(for OpenGL (OK if this is Mesa))
2522AC_ARG_WITH(opengl, [  --without-opengl        disable 3D OpenGL (for GL modes)])
2523if test "x$with_opengl" = xno; then
2524  no_opengl=yes
2525else
2526  if test "x$opengl_includes" != xNONE && test "x$opengl_libraries" != xNONE; then
2527    no_opengl=
2528  else
2529AC_CACHE_VAL(ac_cv_path_opengl,
2530[# One or both of these vars are not set, and there is no cached value.
2531no_opengl=yes
2532AC_PATH_OPENGL_DIRECT
2533
2534if test "$no_opengl" = yes; then
2535  ac_cv_path_opengl="no_opengl=yes"
2536else
2537  ac_cv_path_opengl="no_opengl= ac_opengl_includes=$ac_opengl_includes ac_opengl_libraries=$ac_opengl_libraries"
2538
2539fi])dnl
2540  fi
2541  eval "$ac_cv_path_opengl"
2542fi # with_opengl != no
2543
2544if test "$no_opengl" = yes; then
2545  AC_MSG_RESULT(no)
2546else
2547  gl=yes
2548  AC_DEFINE([USE_GL], [1], [using GL])
2549  XLOCKLIBS="${XLOCKLIBS} -lGL -lGLU"
2550  test "x$opengl_includes" = xNONE && opengl_includes=$ac_opengl_includes
2551  test "x$opengl_libraries" = xNONE && opengl_libraries=$ac_opengl_libraries
2552  case "${canonical}" in
2553    *-*-solaris2* )
2554      AC_DEFINE([SUN_OGL_NO_VERTEX_MACROS], [1], [Sun OGL No Vertex Macros])
2555      if test "x$opengl_includes" = "x/usr/include"; then
2556        opengl_includes=""
2557      fi
2558    ;;
2559    *-*-irix5* | *-*-irix6* )
2560      XLOCKLIBS="${XLOCKLIBS} -lgl"
2561    ;;
2562  esac
2563  ac_cv_path_opengl="no_opengl= ac_opengl_includes=$opengl_includes ac_opengl_libraries=$opengl_libraries"
2564  AC_MSG_RESULT([libraries $opengl_libraries, headers $opengl_includes])
2565  GL=""
2566fi
2567])
2568
2569AC_PATH_OPENGL
2570
2571if test "x$opengl_libraries" != x && test "x$opengl_libraries" != xNONE ; then
2572  XLOCK_LDFLAGS="${XLOCK_LDFLAGS}:$opengl_libraries"
2573  XLOCKLIBPATHS="${XLOCKLIBPATHS} -L$opengl_libraries"
2574fi
2575if test "x$opengl_includes" != x && test "x$opengl_includes" != xNONE ; then
2576  XLOCKINC="${XLOCKINC} -I$opengl_includes"
2577fi
2578
2579dnl Mesa mesa
2580
2581dnl test -z "$mesa_direct_test_library" && mesa_direct_test_library=MesaGLU
2582AC_DEFUN([AC_PATH_MESA_DIRECT],
2583[test -z "$mesa_direct_test_library" && mesa_direct_test_library=MesaGL
2584test -z "$mesa_direct_test_library" && mesa_direct_test_library=MesaGLU
2585test -z "$mesa_direct_test_function" && mesa_direct_test_function=glXCreateContext
2586test -z "$mesa_direct_test_include" && mesa_direct_test_include=GL/gl.h
2587  for ac_dir in               \
2588    /usr/X11R6.5.1/include    \
2589    /usr/X11R6.4/include      \
2590    /usr/X11R6.3/include      \
2591    /usr/X11R6.2/include      \
2592    /usr/X11R6.1/include      \
2593    /usr/X11R6/include        \
2594    /usr/X11R5/include        \
2595    /usr/X11/include          \
2596                              \
2597    /usr/include/X11          \
2598    /usr/include/X11R6.5.1    \
2599    /usr/include/X11R6.4      \
2600    /usr/include/X11R6.3      \
2601    /usr/include/X11R6.2      \
2602    /usr/include/X11R6.1      \
2603    /usr/include/X11R6        \
2604    /usr/include/X11R5        \
2605                              \
2606    /usr/local/X11/include    \
2607    /usr/local/X11R6.5.1/include  \
2608    /usr/local/X11R6.4/include  \
2609    /usr/local/X11R6.3/include  \
2610    /usr/local/X11R6.2/include  \
2611    /usr/local/X11R6.1/include  \
2612    /usr/local/X11R6/include  \
2613    /usr/local/X11R5/include  \
2614                              \
2615    /usr/local/include/X11    \
2616    /usr/local/include/X11R6.5.1  \
2617    /usr/local/include/X11R6.4  \
2618    /usr/local/include/X11R6.3  \
2619    /usr/local/include/X11R6.2  \
2620    /usr/local/include/X11R6.1  \
2621    /usr/local/include/X11R6  \
2622    /usr/local/include/X11R5  \
2623                              \
2624    /usr/X386/include         \
2625    /usr/x386/include         \
2626    /usr/XFree86/include/X11  \
2627    /usr/pkg/include          \
2628                              \
2629    /usr/local/include        \
2630    /usr/remote/include       \
2631    /usr/include              \
2632    /usr/unsupported/include  \
2633    /usr/local/x11r5/include  \
2634    /usr/lpp/Xamples/include  \
2635                              \
2636    /usr/openwin/include      \
2637    /usr/openwin/share/include \
2638    $extra_include            \
2639    ; \
2640  do
2641    if test -r "$ac_dir/$mesa_direct_test_include"; then
2642      no_mesa= ac_mesa_includes=$ac_dir
2643      break
2644    fi
2645  done
2646
2647# Check for the libraries.
2648# See if we find them without any special options.
2649# Do not add to $LIBS permanently.
2650ac_save_LIBS="$LIBS"
2651LIBS="-l$mesa_direct_test_library $LIBS"
2652# First see if replacing the include by lib works.
2653for ac_dir in `echo "$ac_mesa_includes" | sed s/include/lib/` \
2654                          \
2655    /usr/X11/lib          \
2656    /usr/X11R6.5.1/lib    \
2657    /usr/X11R6.4/lib      \
2658    /usr/X11R6.3/lib      \
2659    /usr/X11R6.2/lib      \
2660    /usr/X11R6.1/lib      \
2661    /usr/X11R6/lib        \
2662    /usr/X11R5/lib        \
2663                          \
2664    /usr/lib/X11          \
2665    /usr/lib/X11R6.5.1    \
2666    /usr/lib/X11R6.4      \
2667    /usr/lib/X11R6.3      \
2668    /usr/lib/X11R6.2      \
2669    /usr/lib/X11R6.1      \
2670    /usr/lib/X11R6        \
2671    /usr/lib/X11R5        \
2672                          \
2673    /usr/local/X11/lib    \
2674    /usr/local/X11R6.5.1/lib  \
2675    /usr/local/X11R6.4/lib  \
2676    /usr/local/X11R6.3/lib  \
2677    /usr/local/X11R6.2/lib  \
2678    /usr/local/X11R6.1/lib  \
2679    /usr/local/X11R6/lib  \
2680    /usr/local/X11R5/lib  \
2681                          \
2682    /usr/local/lib/X11    \
2683    /usr/local/lib/X11R6.5.1  \
2684    /usr/local/lib/X11R6.4  \
2685    /usr/local/lib/X11R6.3  \
2686    /usr/local/lib/X11R6.2  \
2687    /usr/local/lib/X11R6.1  \
2688    /usr/local/lib/X11R6  \
2689    /usr/local/lib/X11R5  \
2690                          \
2691    /usr/X386/lib         \
2692    /usr/x386/lib         \
2693    /usr/XFree86/lib/X11  \
2694    /usr/pkg/lib          \
2695                          \
2696    /usr/lib              \
2697    /usr/local/lib        \
2698    /usr/remote/lib       \
2699    /usr/unsupported/lib  \
2700    /usr/athena/lib       \
2701    /usr/local/x11r5/lib  \
2702    /usr/lpp/Xamples/lib  \
2703    /lib/usr/lib/X11      \
2704                          \
2705    /usr/openwin/lib      \
2706    /usr/openwin/share/lib \
2707    $extra_lib            \
2708    ; \
2709do
2710  for ac_extension in a so sl; do
2711    if test -r $ac_dir/lib${mesa_direct_test_library}.$ac_extension; then
2712      no_mesa= ac_mesa_libraries=$ac_dir
2713      break 2
2714    fi
2715  done
2716done
2717LIBS="$ac_save_LIBS"])
2718AC_DEFUN([AC_PATH_MESA],
2719[AC_REQUIRE_CPP()dnl
2720
2721mesa_includes=NONE
2722mesa_libraries=NONE
2723
2724AC_MSG_CHECKING(for Mesa)
2725AC_ARG_WITH(mesa, [  --without-mesa          disable Mesa 3D (for GL modes)])
2726if test "x$with_mesa" = xno; then
2727  no_mesa=yes
2728else
2729  if test "x$mesa_includes" != xNONE && test "x$mesa_libraries" != xNONE; then
2730    no_mesa=
2731  else
2732AC_CACHE_VAL(ac_cv_path_mesa,
2733[# One or both of these vars are not set, and there is no cached value.
2734no_mesa=yes
2735AC_PATH_MESA_DIRECT
2736
2737if test "$no_mesa" = yes -a "$no_opengl" = yes ; then
2738  ac_cv_path_mesa="no_mesa=yes"
2739else
2740  ac_cv_path_mesa="no_mesa= ac_mesa_includes=$ac_mesa_includes ac_mesa_libraries=$ac_mesa_libraries"
2741fi])dnl
2742  fi
2743  eval "$ac_cv_path_mesa"
2744fi # with_mesa != no
2745
2746if test "$no_mesa" = yes; then
2747  AC_MSG_RESULT(no)
2748  GL="#"
2749else
2750  if test "$gl" = no; then
2751    gl=yes
2752    AC_DEFINE([USE_GL], [1], [using GL])
2753    XLOCKLIBS="${XLOCKLIBS} -lMesaGL -lMesaGLU"
2754    test "x$mesa_includes" = xNONE && mesa_includes=$ac_mesa_includes
2755    test "x$mesa_libraries" = xNONE && mesa_libraries=$ac_mesa_libraries
2756    case "${canonical}" in
2757      *-*-solaris2* )
2758        if test "x$mesa_includes" = "x/usr/include"; then
2759          mesa_includes=""
2760        fi
2761      ;;
2762    esac
2763    ac_cv_path_mesa="no_mesa= ac_mesa_includes=$mesa_includes ac_mesa_libraries=$mesa_libraries"
2764    AC_MSG_RESULT([libraries $mesa_libraries, headers $mesa_includes])
2765    # Issue a warning if the version number of Mesa is less than 3.0 since
2766    # 2.6 and earlier had a security bug and 2.2 and earlier had memory leaks.
2767    # pre-3.4 Mesa will core dump with the -showfps option. A patch must be
2768    # applied to 3.4 and 3.4.1 Mesa to correct a memory leak in the molecule
2769    # mode and the -showfps option. This memory leak is fixed in Mesa 3.4.2
2770    AC_CACHE_CHECK([Mesa version number], ac_cv_mesa_version_string,
2771        [cat > conftest.$ac_ext <<EOF
2772#line __oline__ "configure"
2773#include "confdefs.h"
2774#include <GL/xmesa.h>
2775configure: XMESA_MAJOR_VERSION XMESA_MINOR_VERSION
2776EOF
2777         ac_save_CPPFLAGS="$CPPFLAGS"
2778         if test \! -z "$ac_mesa_includes" ; then
2779           CPPFLAGS="$CPPFLAGS -I$ac_mesa_includes"
2780         fi
2781         CPPFLAGS="$CPPFLAGS $X_CFLAGS"
2782         changequote(X,Y)
2783
2784         mglv=`(eval "$ac_cpp conftest.$ac_ext") | sed -n \
2785               's/^configure:.*\([0-9][0-9]*\).*\([0-9][0-9]*\).*$/\1.\2/p'`
2786dnl autoconf-4.53 really hates this next line
2787dnl         mglv=`(eval "$ac_cpp conftest.$ac_ext") 2>&AC_FD_CC | sed -n \
2788dnl               's/^configure:.*\([0-9][0-9]*\).*\([0-9][0-9]*\).*$/\1.\2/p'`
2789         changequote([,])
2790
2791         rm -f conftest.$ac_ext
2792
2793         CPPFLAGS="$ac_save_CPPFLAGS"
2794
2795         if test "$mglv" = ""; then
2796           ac_mesa_version=unknown
2797           ac_mesa_version_string=unknown
2798         else
2799           ac_mesa_version_string=$mglv
2800           maj=`echo $mglv | sed -n 's/\..*//p'`
2801           min=`echo $mglv | sed -n 's/.*\.//p'`
2802           ac_mesa_version=`echo "$maj * 1000 + $min" | bc`
2803           if test -z "$ac_mesa_version"; then
2804             ac_mesa_version=unknown
2805             ac_mesa_version_string=unknown
2806           fi
2807         fi
2808         ac_cv_mesa_version=$ac_mesa_version
2809         ac_cv_mesa_version_string=$ac_mesa_version_string
2810      ])
2811    ac_mesa_version=$ac_cv_mesa_version
2812    ac_mesa_version_string=$ac_cv_mesa_version_string
2813    preferred_mesa="3.4.2"
2814    if test "$ac_mesa_version" = unknown; then
2815      AC_MSG_RESULT(!!!WARNING!!! Unable to determine the Mesa version number!)
2816      AC_MSG_RESULT(!!!WARNING!!! Make sure you are using Mesa version $preferred_mesa or newer.)
2817    elif test \! "$ac_mesa_version" -gt 3004; then
2818      AC_MSG_RESULT(!!!WARNING!!! Mesa version $ac_mesa_version_string is being used.)
2819      AC_MSG_RESULT(!!!WARNING!!! Mesa versions 3.4.1 and earlier have a memory leak when using)
2820      AC_MSG_RESULT(!!!WARNING!!! molecule mode or the -showfps option. This can be corrected by)
2821      AC_MSG_RESULT(!!!WARNING!!! applying the Mesa.patch file to Mesa 3.4 or 3.4.1 using patch)
2822      AC_MSG_RESULT(!!!WARNING!!! or by using Mesa 3.4.2 or newer.)
2823      if test \! "$ac_mesa_version" -gt 3003; then
2824        AC_MSG_RESULT(!!!WARNING!!! Mesa version $ac_mesa_version_string is being used.)
2825        AC_MSG_RESULT(!!!WARNING!!! Mesa versions 3.3 and earlier will SEGV with the -showfps option.)
2826        if test \! "$ac_mesa_version" -gt 2006; then
2827          AC_MSG_RESULT(!!!WARNING!!! Mesa versions 2.6 and earlier have a security bug.)
2828          if test \! "$ac_mesa_version" -gt 2002; then
2829            AC_MSG_RESULT(!!!WARNING!!! Mesa versions 2.2 and earlier have memory leaks.)
2830          fi
2831        fi
2832      fi
2833      AC_MSG_RESULT(!!!WARNING!!! It is strongly recommended that you upgrade to Mesa V$preferred_mesa or newer.)
2834    fi
2835
2836    case "${canonical}" in
2837      *-*-linux* )
2838        # Testing if Mesa was compiled against VGA
2839        if test -f $mesa_libraries/libMesaGL.so; then
2840          have_mesa_svga=`nm $mesa_libraries/libMesaGL.so | grep SVGAMesa | wc -l`
2841        else
2842          have_mesa_svga=0
2843        fi
2844        if eval "test $have_mesa_svga -ge 1"; then
2845          AC_MSG_RESULT([Mesa library is linked against SVGA: adding -lvga])
2846          XLOCKLIBS="${XLOCKLIBS} -lvga"
2847        fi
2848        # Testing if Mesa was compiled against glide
2849        if test -f $mesa_libraries/libMesaGL.so; then
2850          have_mesa_glide=`nm $mesa_libraries/libMesaGL.so | grep grGlideInit | wc -l`
2851        else
2852          have_mesa_glide=0
2853        fi
2854        if eval "test $have_mesa_glide -ge 1"; then
2855          AC_MSG_RESULT([Mesa library is linked against GLIDE: adding -lglide2x])
2856          XLOCKLIBS="${XLOCKLIBS} -lglide2x"
2857
2858        fi
2859#  Causes major errors for maintainer.  xlock refuses to run.
2860#  I am not able to reproduce the problem ? What is it ?
2861# Does a new glibc version fix this problem ?
2862        # Testing if Mesa was compiled against pthread
2863        if test -f $mesa_libraries/libMesaGL.so; then
2864          have_mesa_pthread=`nm $mesa_libraries/libMesaGL.so | grep pthread_once | wc -l`
2865        else
2866          have_mesa_pthread=0
2867        fi
2868        if eval "test $have_mesa_pthread -ge 1"; then
2869          AC_MSG_RESULT([Mesa library is linked against PTHREAD: adding -lpthread])
2870          XLOCKLIBS="${XLOCKLIBS} -lpthread"
2871        fi
2872        ;;
2873    esac
2874    GL=""
2875  else
2876    AC_MSG_RESULT(ignored - using OpenGL)
2877  fi
2878
2879fi
2880])
2881
2882AC_PATH_MESA
2883
2884if test "x$mesa_libraries" != x && test "x$mesa_libraries" != xNONE ; then
2885  XLOCK_LDFLAGS="$mesa_libraries:${XLOCK_LDFLAGS}"
2886  XLOCKLIBPATHS="-L$mesa_libraries ${XLOCKLIBPATHS}"
2887fi
2888if test "x$mesa_includes" != x && test "x$mesa_includes" != xNONE ; then
2889  XLOCKINC="-I$mesa_includes ${XLOCKINC}"
2890fi
2891
2892# Test if Mesa or OpenGL has GL1.1 features
2893# (Should this test be performed only if (Mesa)GL is used? In that case
2894# it fails anyway.)
2895AC_MSG_CHECKING([for GL >=1.1])
2896ac_save_CFLAGS="$CFLAGS"
2897ac_save_LIBS="$LIBS"
2898CFLAGS="${CFLAGS} ${XLOCKINC}"
2899LIBS="${XLOCKLIBPATHS} ${XLOCKLIBS} -lX11 -lXext -lm"
2900AC_CACHE_VAL(ac_cv_c_gl1_1,[
2901AC_TRY_LINK([#define _XOPEN_SOURCE 1
2902#include <GL/gl.h>], [
2903GLint texture;
2904glBindTexture(GL_TEXTURE_2D, texture);
2905], ac_cv_c_gl1_1=yes, ac_cv_c_gl1_1=no)])
2906dnl This does not seem to work on Sun's OpenGL
2907dnl if test x"$ac_cv_c_gl1_1" = xyes; then
2908    AC_DEFINE([HAVE_GLBINDTEXTURE], [1], [GL Bind Texture])
2909    AC_MSG_RESULT(yes)
2910dnl else
2911dnl    AC_MSG_RESULT(no)
2912dnl fi
2913CFLAGS="$ac_save_CFLAGS"
2914LIBS="$ac_save_LIBS"
2915
2916dnl DTSAVER DtSaver dtsaver DtSvc
2917
2918AC_DEFUN([AC_PATH_DTSAVER_DIRECT],
2919[test -z "$dtsaver_direct_test_library" && dtsaver_direct_test_library=DtSvc
2920test -z "$dtsaver_direct_test_function" && dtsaver_direct_test_function=DtSaverGetWindows
2921test -z "$dtsaver_direct_test_include" && dtsaver_direct_test_include=Dt/Saver.h
2922  for ac_dir in            \
2923    /usr/dt/include        \
2924    $extra_include         \
2925    ; \
2926  do
2927    if test -r "$ac_dir/$dtsaver_direct_test_include"; then
2928      no_dtsaver= ac_dtsaver_includes=$ac_dir
2929      break
2930    fi
2931  done
2932
2933# Check for the libraries.
2934# See if we find them without any special options.
2935# Do not add to $LIBS permanently.
2936ac_save_LIBS="$LIBS"
2937LIBS="-l$dtsaver_direct_test_library $LIBS"
2938# First see if replacing the include by lib works.
2939for ac_dir in `echo "$ac_dtsaver_includes" | sed s/include/lib/` \
2940    $extra_lib         \
2941    ; \
2942do
2943  for ac_extension in a so sl; do
2944    if test -r $ac_dir/lib${dtsaver_direct_test_library}.$ac_extension; then
2945      no_dtsaver= ac_dtsaver_libraries=$ac_dir
2946      break 2
2947    fi
2948  done
2949done
2950LIBS="$ac_save_LIBS"])
2951AC_DEFUN([AC_PATH_DTSAVER],
2952[AC_REQUIRE_CPP()dnl
2953
2954dtsaver_includes=NONE
2955dtsaver_libraries=NONE
2956
2957AC_MSG_CHECKING(for DtSaver)
2958AC_ARG_WITH(dtsaver, [  --without-dtsaver       disable -dtsaver option])
2959if test "x$with_dtsaver" = xno; then
2960  no_dtsaver=yes
2961else
2962  if test "x$dtsaver_includes" != xNONE && test "x$dtsaver_libraries" != xNONE; then
2963    no_dtsaver=
2964  else
2965AC_CACHE_VAL(ac_cv_path_dtsaver,
2966[# One or both of these vars are not set, and there is no cached value.
2967no_dtsaver=yes
2968AC_PATH_DTSAVER_DIRECT
2969
2970if test "$no_dtsaver" = yes; then
2971  ac_cv_path_dtsaver="no_dtsaver=yes"
2972else
2973  ac_cv_path_dtsaver="no_dtsaver= ac_dtsaver_includes=$ac_dtsaver_includes ac_dtsaver_libraries=$ac_dtsaver_libraries"
2974fi])dnl
2975  fi
2976  eval "$ac_cv_path_dtsaver"
2977fi # with_dtsaver != no
2978
2979if test "$no_dtsaver" = yes; then
2980  AC_MSG_RESULT(no)
2981else
2982  AC_DEFINE([USE_DTSAVER], [1], [Desktop Saver])
2983  XLOCKLIBS="${XLOCKLIBS} -lDtSvc"
2984  test "x$dtsaver_includes" = xNONE && dtsaver_includes=$ac_dtsaver_includes
2985  test "x$dtsaver_libraries" = xNONE && dtsaver_libraries=$ac_dtsaver_libraries
2986  ac_cv_path_dtsaver="no_dtsaver= ac_dtsaver_includes=$dtsaver_includes ac_dtsaver_libraries=$dtsaver_libraries"
2987  AC_MSG_RESULT([libraries $dtsaver_libraries, headers $dtsaver_includes])
2988fi
2989])
2990
2991AC_PATH_DTSAVER
2992
2993if test "x$dtsaver_libraries" != x && test "x$dtsaver_libraries" != xNONE ; then
2994  XLOCK_LDFLAGS="${XLOCK_LDFLAGS}:$dtsaver_libraries"
2995  XLOCKLIBPATHS="${XLOCKLIBPATHS} -L$dtsaver_libraries"
2996fi
2997if test "x$dtsaver_includes" != x && test "x$dtsaver_includes" != xNONE ; then
2998  XLOCKINC="${XLOCKINC} -I$dtsaver_includes"
2999fi
3000
3001dnl Xext
3002
3003AC_DEFUN([AC_PATH_EXT_DIRECT],
3004[test -z "$ext_direct_test_library" && ext_direct_test_library=Xext
3005test -z "$ext_direct_test_function" && ext_direct_test_function=DPMSSetTimeouts
3006test -z "$dpms_direct_test_include" && ext_direct_test_include=X11/extensions/dpms.h
3007  for ac_dir in               \
3008    /usr/X11R6.5.1/include    \
3009    /usr/X11R6.4/include      \
3010    /usr/X11R6.3/include      \
3011    /usr/X11R6.2/include      \
3012    /usr/X11R6.1/include      \
3013    /usr/X11R6/include        \
3014    /usr/X11R5/include        \
3015    /usr/X11R4/include        \
3016                              \
3017    /usr/include/X11R6.5.1    \
3018    /usr/include/X11R6.4      \
3019    /usr/include/X11R6.3      \
3020    /usr/include/X11R6.2      \
3021    /usr/include/X11R6.1      \
3022    /usr/include/X11R6        \
3023    /usr/include/X11R5        \
3024    /usr/include/X11R4        \
3025                              \
3026    /usr/local/X11R6.5.1/include  \
3027    /usr/local/X11R6.4/include  \
3028    /usr/local/X11R6.3/include  \
3029    /usr/local/X11R6.2/include  \
3030    /usr/local/X11R6.1/include  \
3031    /usr/local/X11R6/include  \
3032    /usr/local/X11R5/include  \
3033    /usr/local/X11R4/include  \
3034                              \
3035    /usr/local/include/X11R6.5.1  \
3036    /usr/local/include/X11R6.4  \
3037    /usr/local/include/X11R6.3  \
3038    /usr/local/include/X11R6.2  \
3039    /usr/local/include/X11R6.1  \
3040    /usr/local/include/X11R6  \
3041    /usr/local/include/X11R5  \
3042    /usr/local/include/X11R4  \
3043                              \
3044    /usr/X11/include          \
3045    /usr/include/X11          \
3046    /usr/local/X11/include    \
3047    /usr/local/include/X11    \
3048                              \
3049    /usr/X386/include         \
3050    /usr/x386/include         \
3051    /usr/XFree86/include/X11  \
3052    /usr/pkg/include          \
3053                              \
3054    /usr/dt/include           \
3055                              \
3056    /usr/local/include        \
3057    /usr/remote/include       \
3058    /usr/include              \
3059    /usr/unsupported/include  \
3060    /usr/dpms/include         \
3061    /usr/local/x11r5/include  \
3062    /usr/lpp/Xamples/include  \
3063                              \
3064    /usr/openwin/include      \
3065    /usr/openwin/share/include \
3066    $extra_include            \
3067    ; \
3068  do
3069    if test -r "$ac_dir/$ext_direct_test_include"; then
3070      no_ext= ac_ext_includes=$ac_dir
3071      break
3072    fi
3073  done
3074
3075# Check for the libraries.
3076# See if we find them without any special options.
3077# Do not add to $LIBS permanently.
3078ac_save_LIBS="$LIBS"
3079LIBS="-l$ext_direct_test_library $LIBS"
3080# First see if replacing the include by lib works.
3081for ac_dir in `echo "$ac_ext_includes" | sed s/include/lib/` \
3082                          \
3083    /usr/X11R6.5.1/lib    \
3084    /usr/X11R6.4/lib      \
3085    /usr/X11R6.3/lib      \
3086    /usr/X11R6.2/lib      \
3087    /usr/X11R6.1/lib      \
3088    /usr/X11R6/lib        \
3089    /usr/X11R5/lib        \
3090    /usr/X11R4/lib        \
3091                          \
3092    /usr/lib/X11R6.5.1    \
3093    /usr/lib/X11R6.4      \
3094    /usr/lib/X11R6.3      \
3095    /usr/lib/X11R6.2      \
3096    /usr/lib/X11R6.1      \
3097    /usr/lib/X11R6        \
3098    /usr/lib/X11R5        \
3099    /usr/lib/X11R4        \
3100                          \
3101    /usr/local/X11R6.5.1/lib  \
3102    /usr/local/X11R6.4/lib  \
3103    /usr/local/X11R6.3/lib  \
3104    /usr/local/X11R6.2/lib  \
3105    /usr/local/X11R6.1/lib  \
3106    /usr/local/X11R6/lib  \
3107    /usr/local/X11R5/lib  \
3108    /usr/local/X11R4/lib  \
3109                          \
3110    /usr/local/lib/X11R6.5.1  \
3111    /usr/local/lib/X11R6.4  \
3112    /usr/local/lib/X11R6.3  \
3113    /usr/local/lib/X11R6.2  \
3114    /usr/local/lib/X11R6.1  \
3115    /usr/local/lib/X11R6  \
3116    /usr/local/lib/X11R5  \
3117    /usr/local/lib/X11R4  \
3118                          \
3119    /usr/X11/lib          \
3120    /usr/lib/X11          \
3121    /usr/local/X11/lib    \
3122                          \
3123    /usr/X386/lib         \
3124    /usr/x386/lib         \
3125    /usr/XFree86/lib/X11  \
3126    /usr/pkg/lib          \
3127                          \
3128    /usr/lib              \
3129    /usr/local/lib        \
3130    /usr/remote/lib       \
3131    /usr/unsupported/lib  \
3132    /usr/dpms/lib       \
3133    /usr/local/x11r5/lib  \
3134    /usr/lpp/Xamples/lib  \
3135                          \
3136    /usr/openwin/lib      \
3137    /usr/openwin/share/lib \
3138    /shlib                \
3139    /usr/shlib            \
3140    /usr/shlib/X11        \
3141    $extra_lib            \
3142    ; \
3143do
3144  for ac_extension in a so sl; do
3145    if test -r $ac_dir/lib${ext_direct_test_library}.$ac_extension; then
3146      no_ext= ac_ext_libraries=$ac_dir
3147      break 2
3148    fi
3149  done
3150done
3151LIBS="$ac_save_LIBS"])
3152AC_DEFUN([AC_PATH_EXT],
3153[AC_REQUIRE_CPP()dnl
3154
3155ext_includes=NONE
3156ext_libraries=NONE
3157
3158AC_MSG_CHECKING(for EXT)
3159AC_ARG_WITH(ext, [  --without-ext           disable EXT])
3160extlib=no
3161if test "x$with_ext" = xno; then
3162  no_ext=yes
3163else
3164  if test "x$ext_includes" != xNONE && test "x$ext_libraries" != xNONE; then
3165    no_ext=
3166  else
3167AC_CACHE_VAL(ac_cv_path_ext,
3168[# One or both of these vars are not set, and there is no cached value.
3169no_EXT=yes
3170AC_PATH_EXT_DIRECT
3171
3172if test "$no_ext" = yes; then
3173  ac_cv_path_ext="no_ext=yes"
3174else
3175  ac_cv_path_ext="no_ext= ac_ext_includes=$ac_ext_includes ac_ext_libraries=$ac_ext_libraries"
3176fi])dnl
3177  fi
3178  eval "$ac_cv_path_ext"
3179fi # with_ext != no
3180
3181if test "$no_ext" = yes; then
3182  AC_MSG_RESULT(no)
3183else
3184  AC_DEFINE([USE_EXT], [1], [Extension Libraries])
3185dnl test needed for Digital Unix machines
3186  if test "x$ac_ext_libraries" != x && test "x$ac_ext_libraries" != xNONE ; then
3187    XLOCKLIBS="${XLOCKLIBS} -lXext"
3188  fi
3189  test "x$ext_includes" = xNONE && ext_includes=$ac_ext_includes
3190  test "x$ext_libraries" = xNONE && ext_libraries=$ac_ext_libraries
3191  ac_cv_path_ext="no_ext= ac_ext_includes=$ext_includes ac_ext_libraries=$ext_libraries"
3192  AC_MSG_RESULT([libraries $ext_libraries, headers $ext_includes])
3193fi
3194])
3195
3196AC_PATH_EXT
3197
3198dnl Hard coded to bring Xext
3199dnl if test "x$ext_libraries" != x && test "x$ext_libraries" != xNONE ; then
3200dnl   XLOCK_LDFLAGS="${XLOCK_LDFLAGS}:$ext_libraries"
3201dnl   XLOCKLIBPATHS="${XLOCKLIBPATHS} -L$ext_libraries"
3202dnl fi
3203if test "x$ext_includes" != x && test "x$ext_includes" != xNONE ; then
3204  XLOCKINC="${XLOCKINC} -I$ext_includes"
3205fi
3206
3207dnl Xdpms DPMS
3208
3209AC_DEFUN([AC_PATH_DPMS_DIRECT],
3210[test -z "$dpms_direct_test_library" && dpms_direct_test_library=Xdpms
3211test -z "$dpms_direct_test_function" && dpms_direct_test_function=DPMSSetTimeouts
3212test -z "$dpms_direct_test_include" && dpms_direct_test_include=X11/extensions/dpms.h
3213  for ac_dir in               \
3214    /usr/X11R6.5.1/include    \
3215    /usr/X11R6.4/include      \
3216    /usr/X11R6.3/include      \
3217    /usr/X11R6.2/include      \
3218    /usr/X11R6.1/include      \
3219    /usr/X11R6/include        \
3220    /usr/X11R5/include        \
3221    /usr/X11R4/include        \
3222                              \
3223    /usr/include/X11R6.5.1    \
3224    /usr/include/X11R6.4      \
3225    /usr/include/X11R6.3      \
3226    /usr/include/X11R6.2      \
3227    /usr/include/X11R6.1      \
3228    /usr/include/X11R6        \
3229    /usr/include/X11R5        \
3230    /usr/include/X11R4        \
3231                              \
3232    /usr/local/X11R6.5.1/include  \
3233    /usr/local/X11R6.4/include  \
3234    /usr/local/X11R6.3/include  \
3235    /usr/local/X11R6.2/include  \
3236    /usr/local/X11R6.1/include  \
3237    /usr/local/X11R6/include  \
3238    /usr/local/X11R5/include  \
3239    /usr/local/X11R4/include  \
3240                              \
3241    /usr/local/include/X11R6.5.1  \
3242    /usr/local/include/X11R6.4  \
3243    /usr/local/include/X11R6.3  \
3244    /usr/local/include/X11R6.2  \
3245    /usr/local/include/X11R6.1  \
3246    /usr/local/include/X11R6  \
3247    /usr/local/include/X11R5  \
3248    /usr/local/include/X11R4  \
3249                              \
3250    /usr/X11/include          \
3251    /usr/include/X11          \
3252    /usr/local/X11/include    \
3253    /usr/local/include/X11    \
3254                              \
3255    /usr/X386/include         \
3256    /usr/x386/include         \
3257    /usr/XFree86/include/X11  \
3258    /usr/pkg/include          \
3259                              \
3260    /usr/dt/include           \
3261                              \
3262    /usr/local/include        \
3263    /usr/remote/include       \
3264    /usr/include              \
3265    /usr/unsupported/include  \
3266    /usr/dpms/include         \
3267    /usr/local/x11r5/include  \
3268    /usr/lpp/Xamples/include  \
3269                              \
3270    /usr/openwin/include      \
3271    /usr/openwin/share/include \
3272    $extra_include            \
3273    ; \
3274  do
3275    if test -r "$ac_dir/$dpms_direct_test_include"; then
3276      no_dpms= ac_dpms_includes=$ac_dir
3277      break
3278    fi
3279  done
3280
3281# Check for the libraries.
3282# See if we find them without any special options.
3283# Do not add to $LIBS permanently.
3284ac_save_LIBS="$LIBS"
3285LIBS="-l$dpms_direct_test_library $LIBS"
3286# First see if replacing the include by lib works.
3287for ac_dir in `echo "$ac_dpms_includes" | sed s/include/lib/` \
3288                          \
3289    /usr/X11R6.5.1/lib    \
3290    /usr/X11R6.4/lib      \
3291    /usr/X11R6.3/lib      \
3292    /usr/X11R6.2/lib      \
3293    /usr/X11R6.1/lib      \
3294    /usr/X11R6/lib        \
3295    /usr/X11R5/lib        \
3296    /usr/X11R4/lib        \
3297                          \
3298    /usr/lib/X11R6.5.1    \
3299    /usr/lib/X11R6.4      \
3300    /usr/lib/X11R6.3      \
3301    /usr/lib/X11R6.2      \
3302    /usr/lib/X11R6.1      \
3303    /usr/lib/X11R6        \
3304    /usr/lib/X11R5        \
3305    /usr/lib/X11R4        \
3306                          \
3307    /usr/local/X11R6.5.1/lib  \
3308    /usr/local/X11R6.4/lib  \
3309    /usr/local/X11R6.3/lib  \
3310    /usr/local/X11R6.2/lib  \
3311    /usr/local/X11R6.1/lib  \
3312    /usr/local/X11R6/lib  \
3313    /usr/local/X11R5/lib  \
3314    /usr/local/X11R4/lib  \
3315                          \
3316    /usr/local/lib/X11R6.5.1  \
3317    /usr/local/lib/X11R6.4  \
3318    /usr/local/lib/X11R6.3  \
3319    /usr/local/lib/X11R6.2  \
3320    /usr/local/lib/X11R6.1  \
3321    /usr/local/lib/X11R6  \
3322    /usr/local/lib/X11R5  \
3323    /usr/local/lib/X11R4  \
3324                          \
3325    /usr/X11/lib          \
3326    /usr/lib/X11          \
3327    /usr/local/X11/lib    \
3328                          \
3329    /usr/X386/lib         \
3330    /usr/x386/lib         \
3331    /usr/XFree86/lib/X11  \
3332    /usr/pkg/lib          \
3333                          \
3334    /usr/lib              \
3335    /usr/local/lib        \
3336    /usr/remote/lib       \
3337    /usr/unsupported/lib  \
3338    /usr/dpms/lib       \
3339    /usr/local/x11r5/lib  \
3340    /usr/lpp/Xamples/lib  \
3341                          \
3342    /usr/openwin/lib      \
3343    /usr/openwin/share/lib \
3344    /shlib                \
3345    /usr/shlib            \
3346    /usr/shlib/X11        \
3347    $extra_lib            \
3348    ; \
3349do
3350  for ac_extension in a so sl; do
3351    if test -r $ac_dir/lib${dpms_direct_test_library}.$ac_extension; then
3352      no_dpms= ac_dpms_libraries=$ac_dir
3353      break 2
3354    fi
3355  done
3356done
3357LIBS="$ac_save_LIBS"])
3358AC_DEFUN([AC_PATH_DPMS],
3359[AC_REQUIRE_CPP()dnl
3360
3361dpms_includes=NONE
3362dpms_libraries=NONE
3363
3364AC_MSG_CHECKING(for DPMS)
3365AC_ARG_WITH(dpms, [  --without-dpms          disable DPMS])
3366dpmslib=no
3367if test "x$with_dpms" = xno; then
3368  no_dpms=yes
3369else
3370  if test "x$dpms_includes" != xNONE && test "x$dpms_libraries" != xNONE; then
3371    no_dpms=
3372  else
3373AC_CACHE_VAL(ac_cv_path_dpms,
3374[# One or both of these vars are not set, and there is no cached value.
3375no_dpms=yes
3376AC_PATH_DPMS_DIRECT
3377
3378if test "$no_dpms" = yes; then
3379  ac_cv_path_dpms="no_dpms=yes"
3380else
3381  ac_cv_path_dpms="no_dpms= ac_dpms_includes=$ac_dpms_includes ac_dpms_libraries=$ac_dpms_libraries"
3382fi])dnl
3383  fi
3384  eval "$ac_cv_path_dpms"
3385fi # with_dpms != no
3386
3387if test "$no_dpms" = yes; then
3388  AC_MSG_RESULT(no)
3389else
3390  AC_DEFINE([USE_DPMS], [1], [Display Power Management System])
3391dnl test needed for Digital Unix machines
3392  if test "x$ac_dpms_libraries" != x && test "x$ac_dpms_libraries" != xNONE ; then
3393    XLOCKLIBS="${XLOCKLIBS} -lXdpms"
3394  fi
3395  test "x$dpms_includes" = xNONE && dpms_includes=$ac_dpms_includes
3396  test "x$dpms_libraries" = xNONE && dpms_libraries=$ac_dpms_libraries
3397  ac_cv_path_dpms="no_dpms= ac_dpms_includes=$dpms_includes ac_dpms_libraries=$dpms_libraries"
3398  AC_MSG_RESULT([libraries $dpms_libraries, headers $dpms_includes])
3399fi
3400])
3401
3402AC_PATH_DPMS
3403
3404if test "x$dpms_libraries" != x && test "x$dpms_libraries" != xNONE ; then
3405  XLOCK_LDFLAGS="${XLOCK_LDFLAGS}:$dpms_libraries"
3406  XLOCKLIBPATHS="${XLOCKLIBPATHS} -L$dpms_libraries"
3407fi
3408if test "x$dpms_includes" != x && test "x$dpms_includes" != xNONE ; then
3409  XLOCKINC="${XLOCKINC} -I$dpms_includes"
3410fi
3411
3412xinerama=no
3413dnl xinerama Xinerama extension
3414
3415AC_DEFUN([AC_PATH_XINERAMA_DIRECT],
3416[test -z "$xinerama_direct_test_library" && xinerama_direct_test_library=Xinerama
3417test -z "$xinerama_direct_test_function" && xinerama_direct_test_function=XineramaQueryExtension
3418test -z "$xinerama_direct_test_include" && xinerama_direct_test_include=X11/extensions/Xinerama.h
3419  for ac_dir in               \
3420    /usr/X11R6.5.1/include	    \
3421    /usr/X11R6.4/include	      \
3422    /usr/X11R6.3/include	      \
3423    /usr/X11R6.2/include	      \
3424    /usr/X11R6.1/include	      \
3425    /usr/X11R6/include	        \
3426    /usr/X11R5/include	        \
3427    /usr/X11R4/include	        \
3428    /usr/X11/include	          \
3429                              \
3430    /usr/include/X11	          \
3431    /usr/include/X11R6.5.1	    \
3432    /usr/include/X11R6.4	      \
3433    /usr/include/X11R6.3	      \
3434    /usr/include/X11R6.2	      \
3435    /usr/include/X11R6.1	      \
3436    /usr/include/X11R6	        \
3437    /usr/include/X11R5	        \
3438    /usr/include/X11R4	        \
3439                              \
3440    /usr/local/X11/include	    \
3441    /usr/local/X11R6.5.1/include	  \
3442    /usr/local/X11R6.4/include	  \
3443    /usr/local/X11R6.3/include	  \
3444    /usr/local/X11R6.2/include	  \
3445    /usr/local/X11R6.1/include	  \
3446    /usr/local/X11R6/include	  \
3447    /usr/local/X11R5/include	  \
3448    /usr/local/X11R4/include	  \
3449                              \
3450    /usr/local/include/X11	    \
3451    /usr/local/include/X11R6.5.1	  \
3452    /usr/local/include/X11R6.4	  \
3453    /usr/local/include/X11R6.3	  \
3454    /usr/local/include/X11R6.2	  \
3455    /usr/local/include/X11R6.1	  \
3456    /usr/local/include/X11R6	  \
3457    /usr/local/include/X11R5	  \
3458    /usr/local/include/X11R4	  \
3459                              \
3460    /usr/X386/include	         \
3461    /usr/x386/include	         \
3462    /usr/XFree86/include/X11	  \
3463    /usr/pkg/include          \
3464                              \
3465    /usr/include	        \
3466    /usr/local/include	        \
3467    /usr/remote/include	       \
3468    /usr/include/X11	          \
3469    /usr/unsupported/include	  \
3470    /usr/athena/include	       \
3471    /usr/local/x11r5/include	  \
3472    /usr/lpp/Xamples/include	  \
3473                              \
3474    /usr/openwin/include	      \
3475    /usr/openwin/share/include	 \
3476    /usr/openwin/include	      \
3477                              \
3478    $extra_include	            \
3479    ; \
3480  do
3481    if test -r "$ac_dir/$xinerama_direct_test_include"; then
3482      no_xinerama= ac_xinerama_includes=$ac_dir
3483      break
3484    fi
3485  done
3486
3487# Check for the libraries.
3488# See if we find them without any special options.
3489# Do not add to $LIBS permanently.
3490ac_save_LIBS="$LIBS"
3491LIBS="-l$xinerama_direct_test_library $LIBS"
3492# First see if replacing the include by lib works.
3493for ac_dir in `echo "$ac_xinerama_includes" | sed s/include/lib/` \
3494                          \
3495    /usr/X11/lib          \
3496    /usr/X11R6.5.1/lib      \
3497    /usr/X11R6.4/lib        \
3498    /usr/X11R6.3/lib        \
3499    /usr/X11R6.2/lib        \
3500    /usr/X11R6.1/lib        \
3501    /usr/X11R6/lib        \
3502    /usr/X11R5/lib        \
3503    /usr/X11R4/lib        \
3504                          \
3505    /usr/lib/X11          \
3506    /usr/lib/X11R6.5.1      \
3507    /usr/lib/X11R6.4        \
3508    /usr/lib/X11R6.3        \
3509    /usr/lib/X11R6.2        \
3510    /usr/lib/X11R6.1        \
3511    /usr/lib/X11R6        \
3512    /usr/lib/X11R5        \
3513    /usr/lib/X11R4        \
3514                          \
3515    /usr/local/X11/lib    \
3516    /usr/local/X11R6/lib  \
3517    /usr/local/X11R5/lib  \
3518    /usr/local/X11R4/lib  \
3519                          \
3520    /usr/local/lib/X11    \
3521    /usr/local/X11R6.5.1/lib  \
3522    /usr/local/X11R6.4/lib  \
3523    /usr/local/X11R6.3/lib  \
3524    /usr/local/X11R6.2/lib  \
3525    /usr/local/X11R6.1/lib  \
3526    /usr/local/lib/X11R6  \
3527    /usr/local/lib/X11R5  \
3528    /usr/local/lib/X11R4  \
3529                          \
3530    /usr/X386/lib         \
3531    /usr/x386/lib         \
3532    /usr/XFree86/lib/X11  \
3533    /usr/pkg/lib          \
3534                          \
3535    /usr/lib              \
3536    /usr/local/lib        \
3537    /usr/remote/lib       \
3538    /usr/unsupported/lib  \
3539    /usr/athena/lib       \
3540    /usr/local/x11r5/lib  \
3541    /usr/lpp/Xamples/lib  \
3542    /lib/usr/lib/X11      \
3543                          \
3544    /usr/openwin/lib      \
3545    /usr/openwin/share/lib \
3546    $extra_lib            \
3547    ; \
3548do
3549  for ac_extension in a so sl; do
3550    if test -r $ac_dir/lib${xinerama_direct_test_library}.$ac_extension; then
3551      no_xinerama= ac_xinerama_libraries=$ac_dir
3552      break 2
3553   fi
3554  done
3555done
3556LIBS="$ac_save_LIBS"])
3557AC_DEFUN([AC_PATH_XINERAMA],
3558[AC_REQUIRE_CPP()dnl
3559
3560xinerama_includes=NONE
3561xinerama_libraries=NONE
3562
3563AC_MSG_CHECKING(for XINERAMA)
3564AC_ARG_WITH(xinerama, [  --without-xinerama      disable Xinerama support])
3565if test "x$with_xinerama" = xno; then
3566  no_xinerama=yes
3567else
3568  if test "x$xinerama_includes" != xNONE && test "x$xinerama_libraries" != xNONE; then
3569    no_xinerama=
3570  else
3571AC_CACHE_VAL(ac_cv_path_xinerama,
3572[# One or both of these vars are not set, and there is no cached value.
3573no_xinerama=yes
3574AC_PATH_XINERAMA_DIRECT
3575
3576if test "$no_xinerama" = yes; then
3577  ac_cv_path_xinerama="no_xinerama=yes"
3578else
3579  ac_cv_path_xinerama="no_xinerama= ac_xinerama_includes=$ac_xinerama_includes ac_xinerama_libraries=$ac_xinerama_libraries"
3580fi])dnl
3581  fi
3582  eval "$ac_cv_path_xinerama"
3583fi # with_xinerama != no
3584
3585if test "$no_xinerama" = yes; then
3586  AC_MSG_RESULT(no)
3587  XINERAMA="#"
3588else
3589  xinerama=yes
3590  AC_DEFINE([USE_XINERAMA], [1], [Xinemara to combine separate displays])
3591  XLOCKLIBS="${XLOCKLIBS} -lXinerama"
3592  test "x$xinerama_includes" = xNONE && xinerama_includes=$ac_xinerama_includes
3593  test "x$xinerama_libraries" = xNONE && xinerama_libraries=$ac_xinerama_libraries
3594  ac_cv_path_xinerama="no_xinerama= ac_xinerama_includes=$xinerama_includes ac_xinerama_libraries=$xinerama_libraries"
3595  AC_MSG_RESULT([libraries $xinerama_libraries, headers $xinerama_includes])
3596  XINERAMA=""
3597fi
3598])
3599
3600AC_PATH_XINERAMA
3601
3602if test "x$xinerama_libraries" != x && test "x$xinerama_libraries" != xNONE ; then
3603  XLOCK_LDFLAGS="${XLOCK_LDFLAGS}:$xinerama_libraries"
3604  XLOCKLIBPATHS="${XLOCKLIBPATHS} -L$xinerama_libraries"
3605fi
3606if test "x$xinerama_includes" != x && test "x$xinerama_includes" != xNONE ; then
3607  XLOCKINC="${XLOCKINC} -I$xinerama_includes"
3608fi
3609
3610sound=none
3611
3612NOPLAY="#"
3613if test "$sound" = none; then
3614  AC_MSG_CHECKING(for DEF_PLAY)
3615  AC_ARG_ENABLE(def_play, [  --disable-def-play=program
3616                          set def-play to program that plays sounds],def_play=$enableval,def_play=yes)
3617  if test "$def_play" = "yes"; then
3618    def_play=play.sh # yes is a bad default here
3619  fi
3620  if test "$def_play" != no; then
3621    AC_MSG_RESULT([defining option DEF_PLAY = "$def_play"])
3622    AC_DEFINE_UNQUOTED([DEF_PLAY], ["$def_play"], [program to play sounds])
3623    sound=$def_play
3624    NOPLAY=""
3625  else
3626    AC_MSG_RESULT(no)
3627  fi
3628fi
3629
3630dnl RPLAY RPlay rplay
3631
3632AC_DEFUN([AC_PATH_RPLAY_DIRECT],
3633[test -z "$rplay_direct_test_library" && rplay_direct_test_library=rplay
3634test -z "$rplay_direct_test_function" && rplay_direct_test_function=rplay_open_default
3635test -z "$rplay_direct_test_include" && rplay_direct_test_include=rplay.h
3636  for ac_dir in               \
3637    /usr/X11R6.5.1/include    \
3638    /usr/X11R6.4/include      \
3639    /usr/X11R6.3/include      \
3640    /usr/X11R6.2/include      \
3641    /usr/X11R6.1/include      \
3642    /usr/X11R6/include        \
3643    /usr/X11R5/include        \
3644    /usr/X11/include          \
3645    /usr/local/include        \
3646    /usr/remote/include       \
3647    /usr/pkg/include          \
3648    /usr/include              \
3649    $extra_include            \
3650    ; \
3651  do
3652    if test -r "$ac_dir/$rplay_direct_test_include"; then
3653      no_rplay= ac_rplay_includes=$ac_dir
3654      break
3655    fi
3656  done
3657
3658# Check for the libraries.
3659# See if we find them without any special options.
3660# Do not add to $LIBS permanently.
3661ac_save_LIBS="$LIBS"
3662LIBS="-l$rplay_direct_test_library $LIBS"
3663# First see if replacing the include by lib works.
3664for ac_dir in `echo "$ac_rplay_includes" | sed s/include/lib/` \
3665                          \
3666    /usr/X11R6.5.1/lib    \
3667    /usr/X11R6.4/lib      \
3668    /usr/X11R6.3/lib      \
3669    /usr/X11R6.2/lib      \
3670    /usr/X11R6.1/lib      \
3671    /usr/X11R6/lib        \
3672    /usr/X11R5/lib        \
3673    /usr/X11/lib          \
3674    /usr/lib              \
3675    /usr/local/lib        \
3676    /usr/remote/lib       \
3677    /usr/pkg/lib          \
3678    $extra_lib            \
3679    ; \
3680do
3681  for ac_extension in a so sl; do
3682    if test -r $ac_dir/lib${rplay_direct_test_library}.$ac_extension; then
3683      no_rplay= ac_rplay_libraries=$ac_dir
3684      break 2
3685    fi
3686  done
3687done
3688LIBS="$ac_save_LIBS"])
3689AC_DEFUN([AC_PATH_RPLAY],
3690[AC_REQUIRE_CPP()dnl
3691
3692rplay_includes=NONE
3693rplay_libraries=NONE
3694
3695AC_MSG_CHECKING(for RPLAY)
3696AC_ARG_WITH(rplay, [  --without-rplay         disable RPLAY sounds])
3697if test "x$with_rplay" = xno; then
3698  no_rplay=yes
3699else
3700  if test "x$rplay_includes" != xNONE && test "x$rplay_libraries" != xNONE; then
3701    no_rplay=
3702  else
3703AC_CACHE_VAL(ac_cv_path_rplay,
3704[# One or both of these vars are not set, and there is no cached value.
3705no_rplay=yes
3706AC_PATH_RPLAY_DIRECT
3707
3708if test "$no_rplay" = yes; then
3709  ac_cv_path_rplay="no_rplay=yes"
3710else
3711  ac_cv_path_rplay="no_rplay= ac_rplay_includes=$ac_rplay_includes ac_rplay_libraries=$ac_rplay_libraries"
3712fi])dnl
3713  fi
3714  eval "$ac_cv_path_rplay"
3715fi # with_rplay != no
3716
3717if test "$no_rplay" = yes; then
3718  AC_MSG_RESULT(no)
3719else
3720dnl  solaris26=no
3721dnl  case "${canonical}" in
3722dnl    *-*-solaris2.6 )
3723dnl    solaris26=yes
3724dnl    ;;
3725dnl  esac
3726dnl  if test "$CC" = gcc && test "$solaris26" = yes; then
3727dnl    AC_MSG_RESULT(ignored - problems here with gcc and solaris2.6)
3728dnl  else
3729  if test "$sound" = none; then
3730    sound=rplay
3731    AC_DEFINE([USE_RPLAY], [1], [using RPLAY audio])
3732    XLOCKLIBS="${XLOCKLIBS} -lrplay"
3733    test "x$rplay_includes" = xNONE && rplay_includes=$ac_rplay_includes
3734    test "x$rplay_libraries" = xNONE && rplay_libraries=$ac_rplay_libraries
3735    ac_cv_path_rplay="no_rplay= ac_rplay_includes=$rplay_includes ac_rplay_libraries=$rplay_libraries"
3736    AC_MSG_RESULT([libraries $rplay_libraries, headers $rplay_includes])
3737  else
3738    AC_MSG_RESULT(ignored - using previous definition for sound)
3739  fi
3740dnl  fi
3741fi
3742])
3743
3744AC_PATH_RPLAY
3745
3746if test "x$rplay_libraries" != x && test "x$rplay_libraries" != xNONE ; then
3747  XLOCK_LDFLAGS="${XLOCK_LDFLAGS}:$rplay_libraries"
3748  XLOCKLIBPATHS="${XLOCKLIBPATHS} -L$rplay_libraries"
3749fi
3750if test "x$rplay_includes" != x && test "x$rplay_includes" != xNONE ; then
3751  XLOCKINC="${XLOCKINC} -I$rplay_includes"
3752fi
3753
3754dnl ESOUND Enlightenment sound daemon
3755
3756AC_DEFUN([AC_PATH_ESOUND],
3757[AC_REQUIRE_CPP()dnl
3758
3759esound_includes=NONE
3760esound_libraries=NONE
3761
3762AC_MSG_CHECKING(for ESOUND)
3763AC_ARG_WITH(esound,            [  --with-esound           enable Enlightenment Sound Daemon sounds])
3764AC_ARG_WITH(esound_config,     [  --with-esound-config    use this configator for Enlightenment Sound Daemon])
3765AC_ARG_WITH(esound_prefix,     [  --with-esound-prefix    use this prefix for Enlightenment Sound Daemon])
3766AC_ARG_WITH(esound_includes,   [  --with-esound-includes  use this dir for Enlightenment Sound Daemon headers])
3767AC_ARG_WITH(esound_libraries,  [  --with-esound-libraries use this dir for Enlightenment Sound Daemon libs])
3768if test "x$with_esound" = xno; then
3769  no_esound=yes
3770else
3771  if test "x$esound_includes" != xNONE && test "x$esound_libraries" != xNONE; then
3772    no_esound=
3773    if test "x$esound_config" = "x"; then
3774      if test "x$esound_prefix" != "x"; then
3775        esound_config="$esound_prefix/bin/esd-config"
3776      else
3777        esound_config="esd-config"
3778     fi
3779   else
3780     if test "x$esound_prefix" = "x"; then
3781        esound_prefix=`($esound_config --prefix) 2>/dev/null`
3782     fi
3783   fi
3784  else
3785    if test "x$esound_config" = "x"; then
3786      if test "x$esound_prefix" != "x"; then
3787        esound_config="$esound_prefix/bin/esd-config"
3788      else
3789        esound_config="esd-config"
3790     fi
3791   else
3792     if test "x$esound_prefix" = "x"; then
3793        esound_prefix=`($esound_config --prefix) 2>/dev/null`
3794     fi
3795   fi
3796AC_CACHE_VAL(ac_cv_path_esound,
3797[# One or both of these vars are not set, and there is no cached value.
3798no_esound=yes
3799no_esound_config=yes
3800if test "x$esound_prefix" != "x"; then
3801  ac_esound_prefix=$esound_prefix
3802  ac_esound_includes=$ac_esound_prefix/include
3803  ac_esound_libraries=$ac_esound_prefix/lib
3804  no_esound="ac_esound_config=$ac_esound_config ac_esound_prefix=$ac_esound_prefix ac_esound_includes=$ac_esound_includes ac_esound_libraries=$ac_esound_libraries"
3805else
3806  ac_esound_config="$esound_config"
3807  ac_esound_prefix=`($esound_config --prefix) 2>/dev/null`
3808  if test $? != 0; then
3809    no_esound=yes
3810    no_esound_config=yes
3811    ac_esound_config=""
3812    ac_esound_prefix=""
3813  else
3814    no_esound=
3815    no_esound_config=
3816    ac_esound_includes=$ac_esound_prefix/include
3817    ac_esound_libraries=$ac_esound_prefix/lib
3818  fi
3819fi
3820if test "$no_esound" = yes; then
3821  ac_cv_path_esound="no_esound=yes"
3822else
3823  ac_cv_path_esound="no_esound= ac_esound_config=\"$ac_esound_config\" ac_esound_prefix=\"$ac_esound_prefix\" ac_esound_includes=\"$ac_esound_includes\" ac_esound_libraries=\"$ac_esound_libraries\""
3824fi])dnl
3825  fi
3826  eval "$ac_cv_path_esound"
3827fi # with_esound != no
3828
3829if test "$no_esound_config" = yes; then
3830  AC_MSG_RESULT(no esd-config)
3831else
3832  if test "$no_esound" = yes; then
3833    AC_MSG_RESULT(no)
3834  else
3835    if test "$sound" = none; then
3836      sound=esound
3837      AC_DEFINE([USE_ESOUND], [1], [using ESOUND audio])
3838      AC_DEFINE([HAVE_LIBESD], [1], [LIBESD audio is available])
3839      test "x$esound_config" = xNONE && esound_config=$ac_esound_config
3840      test "x$esound_prefix" = xNONE && esound_prefix=$ac_esound_prefix
3841      test "x$esound_includes" = xNONE && esound_includes=$ac_esound_includes
3842      test "x$esound_libraries" = xNONE && esound_libraries=$ac_esound_libraries
3843      ac_cv_path_esound="no_esound= ac_esound_config=$esound_config ac_esound_prefix=$esound_prefix ac_esound_includes=$esound_includes ac_esound_libraries=$esound_libraries"
3844      AC_MSG_RESULT([libraries $esound_libraries, headers $esound_includes])
3845    else
3846      AC_MSG_RESULT(ignored - using previous definition for sound)
3847    fi
3848  fi
3849fi
3850])
3851
3852AC_PATH_ESOUND
3853
3854if test "x$esound_libraries" != x && test "x$esound_libraries" != xNONE ; then
3855  XLOCKLIBS="${XLOCKLIBS} `$esound_config --libs`"
3856  XLOCK_LDFLAGS="${XLOCK_LDFLAGS}:$esound_libraries"
3857  XLOCKLIBPATHS="${XLOCKLIBPATHS} -L$esound_libraries"
3858fi
3859if test "x$esound_includes" != x && test "x$esound_includes" != xNONE ; then
3860  XLOCKINC="${XLOCKINC} -I$esound_includes `$esound_config --cflags`"
3861fi
3862
3863dnl NAS audio
3864
3865AC_DEFUN([AC_PATH_NAS_DIRECT],
3866[test -z "$nas_direct_test_library" && nas_direct_test_library=audio
3867test -z "$nas_direct_test_function" && nas_direct_test_function=AuOpenServer
3868test -z "$nas_direct_test_include" && nas_direct_test_include=audio/audio.h
3869  for ac_dir in               \
3870    /usr/X11R6.5.1/include    \
3871    /usr/X11R6.4/include      \
3872    /usr/X11R6.3/include      \
3873    /usr/X11R6.2/include      \
3874    /usr/X11R6.1/include      \
3875    /usr/X11R6/include        \
3876    /usr/X11R5/include        \
3877    /usr/X11/include          \
3878    /usr/local/include        \
3879    /usr/remote/include       \
3880    /usr/pkg/include          \
3881    /usr/include              \
3882    $extra_include            \
3883    ; \
3884  do
3885    if test -r "$ac_dir/$nas_direct_test_include"; then
3886      no_nas= ac_nas_includes=$ac_dir
3887      break
3888    fi
3889  done
3890
3891# Check for the libraries.
3892# See if we find them without any special options.
3893# Do not add to $LIBS permanently.
3894ac_save_LIBS="$LIBS"
3895LIBS="-l$nas_direct_test_library $LIBS"
3896# First see if replacing the include by lib works.
3897for ac_dir in `echo "$ac_nas_includes" | sed s/include/lib/` \
3898                          \
3899    /usr/X11R6.5.1/lib    \
3900    /usr/X11R6.4/lib      \
3901    /usr/X11R6.3/lib      \
3902    /usr/X11R6.2/lib      \
3903    /usr/X11R6.1/lib      \
3904    /usr/X11R6/lib        \
3905    /usr/X11R5/lib        \
3906    /usr/X11/lib          \
3907    /usr/lib              \
3908    /usr/local/lib        \
3909    /usr/remote/lib       \
3910    /usr/pkg/lib          \
3911    $extra_lib            \
3912    ; \
3913do
3914  for ac_extension in a so sl; do
3915    if test -r $ac_dir/lib${nas_direct_test_library}.$ac_extension; then
3916      no_nas= ac_nas_libraries=$ac_dir
3917      break 2
3918    fi
3919  done
3920done
3921LIBS="$ac_save_LIBS"])
3922AC_DEFUN([AC_PATH_NAS],
3923[AC_REQUIRE_CPP()dnl
3924
3925nas_includes=NONE
3926nas_libraries=NONE
3927
3928AC_MSG_CHECKING(for NAS)
3929AC_ARG_WITH(nas, [  --without-nas           disable NAS sounds])
3930if test "x$with_nas" = xno; then
3931  no_nas=yes
3932else
3933  if test "x$nas_includes" != xNONE && test "x$nas_libraries" != xNONE; then
3934    no_nas=
3935  else
3936AC_CACHE_VAL(ac_cv_path_nas,
3937[# One or both of these vars are not set, and there is no cached value.
3938no_nas=yes
3939AC_PATH_NAS_DIRECT
3940
3941if test "$no_nas" = yes; then
3942  ac_cv_path_nas="no_nas=yes"
3943else
3944  ac_cv_path_nas="no_nas= ac_nas_includes=$ac_nas_includes ac_nas_libraries=$ac_nas_libraries"
3945fi])dnl
3946  fi
3947  eval "$ac_cv_path_nas"
3948fi # with_nas != no
3949
3950if test "$no_nas" = yes; then
3951  AC_MSG_RESULT(no)
3952else
3953  if test "$sound" = none; then
3954    sgi=no
3955    case "${canonical}" in
3956      *-*-irix5* | *-*-irix6* )
3957        sgi=yes
3958      ;;
3959    esac
3960    if test "$sgi" = yes; then
3961      AC_MSG_RESULT(ignored - problems here with audio and nas)
3962    else
3963      sound=nas
3964      AC_DEFINE([USE_NAS], [1], [using NAS audio])
3965      XLOCKLIBS="${XLOCKLIBS} -laudio"
3966dnl    XLOCKLIBS="${XLOCKLIBS} -lnas"
3967      test "x$nas_includes" = xNONE && nas_includes=$ac_nas_includes
3968      test "x$nas_libraries" = xNONE && nas_libraries=$ac_nas_libraries
3969      ac_cv_path_nas="no_nas= ac_nas_includes=$nas_includes ac_nas_libraries=$nas_libraries"
3970      AC_MSG_RESULT([libraries $nas_libraries, headers $nas_includes])
3971    fi
3972  else
3973    AC_MSG_RESULT(ignored - using previous definition for sound)
3974  fi
3975fi
3976])
3977
3978AC_PATH_NAS
3979
3980if test "x$nas_libraries" != x && test "x$nas_libraries" != xNONE ; then
3981  XLOCK_LDFLAGS="${XLOCK_LDFLAGS}:$nas_libraries"
3982  XLOCKLIBPATHS="${XLOCKLIBPATHS} -L$nas_libraries"
3983fi
3984if test "x$nas_includes" != x && test "x$nas_includes" != xNONE ; then
3985  XLOCKINC="${XLOCKINC} -I$nas_includes"
3986fi
3987
3988if test "$sound" != none; then
3989  if test "x$prefix" = "xNONE"; then
3990    AC_DEFINE_UNQUOTED([SOUNDPATH], "/usr/local/share/xlock/sounds", [sound path])
3991  else
3992    AC_DEFINE_UNQUOTED([SOUNDPATH], "${prefix}/share/xlock/sounds", [sound path])
3993  fi
3994fi
3995
3996dnl crypt CRYPT
3997
3998AC_DEFUN([AC_PATH_CRYPT_DIRECT],
3999[test -z "$crypt_direct_test_library" && crypt_direct_test_library=crypt
4000
4001# Check for the libraries.
4002# See if we find them without any special options.
4003# Do not add to $LIBS permanently.
4004ac_save_LIBS="$LIBS"
4005LIBS="-l$crypt_direct_test_library $LIBS"
4006for ac_dir in \
4007    /usr/lib              \
4008    /usr/local/lib        \
4009    /usr/remote/lib       \
4010    /usr/pkg/lib          \
4011    $extra_lib            \
4012    ; \
4013do
4014  for ac_extension in a so sl; do
4015    if test -r $ac_dir/lib${crypt_direct_test_library}.$ac_extension; then
4016      no_crypt= ac_crypt_libraries=$ac_dir
4017      break 2
4018    fi
4019  done
4020done
4021LIBS="$ac_save_LIBS"])
4022AC_DEFUN([AC_PATH_CRYPT],
4023[AC_REQUIRE_CPP()dnl
4024
4025crypt_libraries=NONE
4026
4027AC_MSG_CHECKING(for CRYPT)
4028AC_ARG_WITH(crypt, [  --without-crypt         disable CRYPT])
4029if test "x$with_crypt" = xno; then
4030  no_crypt=yes
4031else
4032  if test "x$crypt_libraries" != xNONE; then
4033    no_crypt=
4034  else
4035AC_CACHE_VAL(ac_cv_path_crypt,
4036[# One or both of these vars are not set, and there is no cached value.
4037no_crypt=yes
4038AC_PATH_CRYPT_DIRECT
4039
4040if test "$no_crypt" = yes; then
4041  ac_cv_path_crypt="no_crypt=yes"
4042else
4043  ac_cv_path_crypt="no_crypt= ac_crypt_libraries=$ac_crypt_libraries"
4044fi])dnl
4045  fi
4046  eval "$ac_cv_path_crypt"
4047fi # with_crypt != no
4048
4049if test "$no_crypt" = yes; then
4050  AC_MSG_RESULT(no)
4051  # Fallback for AC_PATH_CRYPT_DIRECT.
4052  AC_SEARCH_LIBS([crypt], [crypt],
4053  [if test "x$ac_cv_search_crypt" != 'xnone required'; then
4054    XLOCKLIBS="${XLOCKLIBS} $ac_cv_search_crypt"
4055  fi])
4056else
4057  XLOCKLIBS="${XLOCKLIBS} -lcrypt"
4058  test "x$crypt_libraries" = xNONE && crypt_libraries=$ac_crypt_libraries
4059  ac_cv_path_crypt="no_crypt= ac_crypt_libraries=$crypt_libraries"
4060  AC_MSG_RESULT([libraries $crypt_libraries])
4061fi
4062])
4063
4064AC_PATH_CRYPT
4065
4066if test "x$crypt_libraries" != x && test "x$crypt_libraries" != xNONE ; then
4067  XLOCK_LDFLAGS="${XLOCK_LDFLAGS}:$crypt_libraries"
4068  XLOCKLIBPATHS="${XLOCKLIBPATHS} -L$crypt_libraries"
4069fi
4070
4071
4072XGLOCK=""
4073XGLOCKDIR=""
4074INSTALL_XGLOCK=""
4075UNINSTALL_XGLOCK=""
4076
4077dnl
4078dnl Check pkg-config borrowed from xscreensaver
4079dnl
4080
4081AC_PATH_PROGS(pkg_config, pkg-config,, $PATH)
4082
4083if test -n "$pkg_config" ; then
4084    #
4085    # the new way...
4086    # run pkg-config based tests.
4087    #
4088    pkgs=''
4089    pkg_check_version() {
4090      if test "$ok" = yes ; then
4091        req="$1"
4092        min="$2"
4093        AC_MSG_CHECKING(for $req)
4094        if $pkg_config --exists "$req" 2> /dev/null ; then
4095          vers=`$pkg_config --modversion "$req"`
4096          if $pkg_config --exists "$req >= $min" ; then
4097            AC_MSG_RESULT($vers)
4098            pkgs="$pkgs $req"
4099            return 1
4100          else
4101            AC_MSG_RESULT($vers (wanted >= $min))
4102            ok=no
4103            return 0
4104          fi
4105        else
4106          AC_MSG_RESULT(no)
4107          ok=no
4108          return 0
4109        fi
4110      fi
4111    }
4112
4113  AC_ARG_WITH(gtk2, [  --without-gtk2          disable GTK2 (no xglock build)],)
4114  if test "x$with_gtk2" != "xno" ; then
4115    #AC_MSG_RESULT(checking for GTK 2.x with pkg-config based tests...)
4116    ok="yes"
4117    pkg_check_version       gtk+-2.0  2.0.1  ; ac_gtk_version_string="$vers"
4118    have_gtk="$ok"
4119
4120    if test "$have_gtk" = yes; then
4121       XGLOCK="xglock"
4122       INSTALL_XGLOCK="install_xglock"
4123       UNINSTALL_XGLOCK="uninstall_xglock"
4124       XGLOCKINC=`$pkg_config --cflags gtk+-x11-2.0`
4125       XGLOCKLDFLAGS=`$pkg_config --libs gtk+-x11-2.0`" ${LDFLAGS}"
4126       with_gtk="no"
4127    fi
4128  fi
4129fi
4130
4131AC_ARG_WITH(gtk, [  --without-gtk           disable GTK (no xglock build)],)
4132if test "x$with_gtk" != "xno" ; then
4133   AC_PATH_GTK(1.2.0,
4134               have_gtk="yes",
4135               have_gtk="no")
4136   if test "$have_gtk" = yes; then
4137     XGLOCK="xglock"
4138     INSTALL_XGLOCK="install_xglock"
4139     UNINSTALL_XGLOCK="uninstall_xglock"
4140   fi
4141fi
4142
4143dnl Should have a tester for XHPUX Xhp
4144
4145dnl Now we handle the various system dependent problems
4146dnl that are not addressed in the X header files, or things dealing
4147dnl with utility quirks on some systems.
4148
4149aixv3=no
4150dirent=yes
4151FORTUNE="#"
4152FORTUNE_PATH="/usr/bin/fortune"
4153if test -x $FORTUNE_PATH; then
4154  FORTUNE=""
4155else
4156  FORTUNE_PATH="/usr/games/fortune"
4157  if test -x $FORTUNE_PATH; then
4158    FORTUNE=""
4159  fi
4160fi
4161
4162case "${canonical}" in
4163
4164  *-*-aix* )
4165    BITMAPTYPE="ibm"
4166    PIXMAPTYPE="ibm"
4167    AC_DEFINE([AIXV3], [1], [AIX Version 3 OS])
4168    aixv3=yes
4169    case "${canonical}" in
4170      *-*-aix2* | *-*-aix3.0* | *-*-aix3.1* )
4171        AC_DEFINE([LESS_THAN_AIX3_2], [1], [less than AIX Version 3.2])
4172      ;;
4173    esac
4174  ;;
4175
4176  *-*-freebsd* | *-*-openbsd* | *-*-netbsd* | *-*-dragonfly* )
4177    BITMAPTYPE="bsd"
4178    PIXMAPTYPE="bsd"
4179    FORTUNE=""
4180    INSTPGMFLAGS="-s -o root -m 4111"
4181    cpp_name=`echo $CC | cut -f1 -d' '`
4182    if test "$cpp_name" = "gcc"; then
4183        dirname=`which gcc`
4184        dirname=`dirname $dirname`
4185        dirname=`dirname $dirname`/lib
4186	if test "$dirname" != "/lib"; then
4187  	    XLOCK_LDFLAGS="${XLOCK_LDFLAGS}:$dirname"
4188  	    XMLOCK_LDFLAGS="${XMLOCK_LDFLAGS}:$dirname"
4189	fi
4190    fi
4191    case "${canonical}" in
4192      *-*-freebsd* )
4193        FORTUNE_PATH="/usr/bin/fortune"
4194      ;;
4195    esac
4196    XLOCKLDFLAGS="-Wl,-R${XLOCK_LDFLAGS}"
4197    XMLOCKLDFLAGS="-Wl,-R${XMLOCK_LDFLAGS}"
4198  ;;
4199
4200  *-*-dgux5* )
4201    BITMAPTYPE="x11"
4202    PIXMAPTYPE="x11"
4203  ;;
4204
4205  *-*-hpux* )
4206    if test "${CC}" = "cc" ; then
4207dnl      CFLAGS="${CFLAGS} -O -Aa -z -D_HPUX_SOURCE" # -O sometimes problems
4208      CFLAGS="${CFLAGS} -Aa -z -D_HPUX_SOURCE"
4209      GPROF_CFLAGS="${GPROF_CFLAGS} -Aa -z -D_HPUX_SOURCE"
4210    fi
4211dnl    LDFLAGS=-Wl,-B,immediate
4212    XLOCKLIBS="-lXhp11 ${XLOCKLIBS}"
4213    AC_DEFINE([SYSV], [1], [System 5])
4214    AC_DEFINE([SVR4], [1], [System 5 Release 4])
4215    BITMAPTYPE="hp"
4216    PIXMAPTYPE="hp"
4217  ;;
4218
4219  *-*-irix5* | *-*-irix6* )
4220    if test "${CC}" = "cc" ; then
4221      CFLAGS="${CFLAGS} -fullwarn"
4222    fi
4223    AC_DEFINE_UNQUOTED([glGenTextures], ["glGenTexturesEXT"], [GL Generic Textures])
4224    AC_DEFINE_UNQUOTED([glDeleteTextures], ["glDeleteTexturesEXT"], [GL Delete Textures])
4225    AC_DEFINE_UNQUOTED([glBindTextures], ["glBindTexturesEXT"], [GL Bind Textures])
4226    BITMAPTYPE="sgi"
4227    PIXMAPTYPE="sgi"
4228  ;;
4229
4230  *-*-linux* )
4231    AC_CHECK_HEADER(elf.h, AC_DEFINE([HAVE_SHADOW], [1], [use Shadow passwording]))
4232dnl    CFLAGS="${CFLAGS} -ansi -pedantic"
4233    AC_DEFINE([linux], [1], [Linux OS])
4234dnl    AC_DEFINE([__i386__], [1], [Intel 386 machine])
4235    AC_DEFINE([_POSIX_SOURCE], [1], [POSIX source])
4236    AC_DEFINE([_BSD_SOURCE], [1], [BSD source])
4237    AC_DEFINE([_DEFAULT_SOURCE], [1], [DEFAULT source])
4238    AC_DEFINE([_GNU_SOURCE], [1], [GNU source])
4239dnl    AC_DEFINE([DX_LOCALE], [1], [DX Locale])
4240    if test -e /etc/shadow ; then
4241      INSTPGMFLAGS="-g shadow -m 2111"
4242      case `ls -l /etc/shadow` in
4243        -???r?????\ *\ shadow\ *\ /etc/shadow)  # group shadow can read it
4244          INSTPGMFLAGS="-g shadow -m 2111"
4245          ;;
4246        *)
4247          INSTPGMFLAGS="-o root -m 4111"
4248          ;;
4249      esac
4250    fi
4251    INSTPGMFLAGS="-s $INSTPGMFLAGS"
4252    BITMAPTYPE="linux"
4253    PIXMAPTYPE="linux"
4254dnl if Shadow and not elf
4255dnl XLOCKLIBS="${XLOCKLIBS} -lgdbm"
4256  ;;
4257
4258  *-*-cygwin* )
4259    BITMAPTYPE="cygwin"
4260    PIXMAPTYPE="cygwin"
4261  ;;
4262
4263  *-*-osf* )
4264    BITMAPTYPE="dec"
4265    PIXMAPTYPE="dec"
4266    AC_MSG_CHECKING([for Digital/Tru64 Unix Enhanced Security])
4267    # This section should check for the presence of the newer Enhanced
4268    # security routines, and use them if they're available.
4269    if test -f /usr/sbin/rcmgr && test -f /etc/rc.config ; then
4270      if test X`/usr/sbin/rcmgr get SECURITY` = XENHANCED ; then
4271        AC_MSG_RESULT(yes)
4272        AC_DEFINE([OSF1_ENH_SEC], [1], [OSF1 Enhanced Security])
4273        AC_SUBST(OSF1_ENH_SEC)
4274        XLOCKLIBS="${XLOCKLIBS} -lsecurity"
4275        # SETGID auth may not be enough for Tru64 5.x.
4276        INSTPGMFLAGS="-s -g auth -m 2111"
4277      else
4278        AC_MSG_RESULT(no)
4279      fi
4280    fi
4281  ;;
4282
4283  *-*-sco* )
4284    BITMAPTYPE="sco"
4285    PIXMAPTYPE="sco"
4286    AC_DEFINE([HAVE_SHADOW], [1], [Shadow passwording])
4287    AC_DEFINE([SYSV], [1], [System 5])
4288  ;;
4289
4290  *-*-solaris2* )
4291    AC_DEFINE([SOLARIS2], [1], [Solaris2 OS])
4292    PIXMAPTYPE="solaris"
4293    case "${canonical}" in
4294      *-*-solaris2.0* | *-*-solaris2.1* | *-*-solaris2.2* | *-*-solaris2.3* | *-*-solaris2.4* )
4295        AC_DEFINE([LESS_THAN_SOLARIS2_5], [1], [Less than Solaris 2.5 OS])
4296        PIXMAPTYPE="sol"
4297      ;;
4298      *-*-solaris2.5* | *-*-solaris2.6*)
4299        PIXMAPTYPE="sol"
4300      ;;
4301    esac
4302    INSTPGMFLAGS="-s -o root -m 4111"
4303    AC_DEFINE([HAVE_SHADOW], [1], [Shadow passwording])
4304    AC_DEFINE([SYSV], [1], [System 5])
4305    AC_DEFINE([SVR4], [1], [System 5 Release 4])
4306    BITMAPTYPE="sun"
4307dnl    XLOCKLIBS="${XLOCKLIBS} -lsocket -lnsl -lposix4"
4308    XLOCKLIBS="${XLOCKLIBS} -lposix4"
4309    LIBS="${LIBS} -lsocket -lnsl -lposix4"
4310    cpp_name=`echo $CC | cut -f1 -d' '`
4311    if test "$cpp_name" = "gcc"; then
4312        dirname=`which gcc`
4313        dirname=`dirname $dirname`
4314        dirname=`dirname $dirname`/lib
4315	if test "$dirname" != "/lib"; then
4316  	    XLOCK_LDFLAGS="${XLOCK_LDFLAGS}:$dirname"
4317  	    XMLOCK_LDFLAGS="${XMLOCK_LDFLAGS}:$dirname"
4318	fi
4319    fi
4320    XLOCKLDFLAGS="-R${XLOCK_LDFLAGS}"
4321    XMLOCKLDFLAGS="-R${XMLOCK_LDFLAGS}"
4322  ;;
4323
4324  *-*-sunos4* )
4325    AC_DEFINE([SUNOS4], [1], [SunOS4 OS])
4326    BITMAPTYPE="sun"
4327    PIXMAPTYPE="sun"
4328  ;;
4329
4330  *-*-sysv5* )
4331    INSTPGMFLAGS="-s -o root -m 4111"
4332    AC_DEFINE([HAVE_SHADOW], [1], [Shadow passwording])
4333    AC_DEFINE([SYSV], [1], [System 5])
4334    AC_DEFINE([SVR4], [1], [System 5 Release 4])
4335    XLOCKLIBS="${XLOCKLIBS} -lgen"
4336    XMLOCKLIBS="${XMLOCKLIBS} -lgen"
4337    LIBS="${LIBS} -lsocket -lnsl"
4338    BITMAPTYPE="x11"
4339    PIXMAPTYPE="x11"
4340  ;;
4341
4342  *)
4343    BITMAPTYPE="x11"
4344    PIXMAPTYPE="x11"
4345  ;;
4346esac
4347
4348if test "$dirent" = yes; then
4349  AC_HEADER_DIRENT
4350fi
4351
4352dnl Rather have a usleep
4353AC_CHECK_FUNC(usleep, AC_DEFINE([HAVE_USLEEP], [1], [microsecond sleep is available]))
4354if test $ac_cv_func_usleep = no; then
4355AC_CHECK_FUNC(nanosleep, AC_DEFINE([HAVE_NANOSLEEP], [1], [nanosecond sleep is available]))
4356fi
4357
4358dnl AC_CHECK_FUNCS(gettimeofday)
4359AC_MSG_CHECKING(how to call gettimeofday)
4360AC_CACHE_VAL(ac_cv_gettimeofday_args,
4361 [AC_TRY_COMPILE([#include <stdlib.h>
4362#include <sys/time.h>],
4363     [struct timeval tv; struct timezone tzp;
4364      gettimeofday(&tv, &tzp);],
4365     [ac_gettimeofday_args=2],
4366     [AC_TRY_COMPILE([#include <stdlib.h>
4367#include <sys/time.h>],
4368         [struct timeval tv; gettimeofday(&tv);],
4369         [ac_gettimeofday_args=1],
4370         [ac_gettimeofday_args=0])])
4371  ac_cv_gettimeofday_args=$ac_gettimeofday_args])
4372ac_gettimeofday_args=$ac_cv_gettimeofday_args
4373if test $ac_gettimeofday_args = 2 ; then
4374  AC_DEFINE([HAVE_GETTIMEOFDAY], [1], [get time of day])
4375  AC_DEFINE([GETTIMEOFDAY_TWO_ARGS], [1], [get time of day is 2 arguments])
4376  AC_MSG_RESULT(two arguments)
4377elif test $ac_gettimeofday_args = 1 ; then
4378  AC_DEFINE([HAVE_GETTIMEOFDAY], [1], [get time of day])
4379  AC_MSG_RESULT(one argument)
4380else
4381  AC_MSG_RESULT(unknown)
4382fi
4383
4384AC_CHECK_FUNCS(tzset timelocal)
4385
4386AC_C_INLINE
4387
4388srand=no
4389AC_CHECK_FUNC(srand48,
4390  [AC_DEFINE([HAVE_RAND48], [1], [Random Number Generator using 48 bits is available])
4391   AC_MSG_CHECKING([for srand48 declaration])
4392   AC_EGREP_HEADER(srand48, stdlib.h,
4393     AC_DEFINE([DECLARED_SRAND48], [1], [Declared SRAND48 is available]) AC_MSG_RESULT(yes),
4394     AC_MSG_RESULT(no))])
4395  if test $ac_cv_func_srand48 = no; then
4396    AC_CHECK_FUNC(srandom, AC_DEFINE([HAVE_RANDOM], [1], [Random Number Generator using 32 bits is available]))
4397    if  test $ac_cv_func_srandom = no; then
4398       AC_CHECK_FUNC(random, AC_DEFINE([HAVE_RAND], [1], [Low quality Random Number Generator using 32 bits is available]) srand=yes)
4399    fi
4400  fi
4401if test "$srand" = yes; then
4402  if test "$aixv3" = yes; then
4403    AC_DEFINE([MAXRAND], [2147483648.0], [Maximum random number])
4404  else
4405    AC_DEFINE([MAXRAND], [32768.0], [Maximum random number])
4406  fi
4407fi
4408
4409AC_MSG_CHECKING([matherr support])
4410AC_CACHE_VAL(ac_cv_c_matherr,[
4411AC_TRY_COMPILE([#define _XOPEN_SOURCE 1
4412#include <math.h>], [
4413struct exception x;
4414x.type = DOMAIN;
4415x.type = SING;
4416], ac_cv_c_matherr=yes, ac_cv_c_matherr=no)])
4417if test x"$ac_cv_c_matherr" = xyes; then
4418    AC_DEFINE([USE_MATHERR], [1], [math error])
4419    AC_MSG_RESULT(yes)
4420else
4421    AC_MSG_RESULT(no)
4422fi
4423
4424dnl Problems here if -I/usr/include used with gcc on Solaris
4425AC_MSG_CHECKING([struct sigset_t])
4426AC_CACHE_VAL(ac_cv_c_sigset_t,[
4427AC_TRY_COMPILE([/*#define _XOPEN_SOURCE 1*/
4428#include <signal.h>], [
4429typedef struct {unsigned long __sigbits[4];} sigset_t;
4430sigset_t sigmask;
4431], ac_cv_c_sigset_t=yes, ac_cv_c_sigset_t=no)])
4432if test x"$ac_cv_c_sigset_t" = xyes; then
4433  case "${canonical}" in
4434    *-*-solaris2.0* | *-*-solaris2.1* | *-*-solaris2.2* | *-*-solaris2.3* | *-*-solaris2.4* | *-*-solaris2.5*)
4435        AC_MSG_RESULT(yes)
4436        AC_DEFINE([HAVE_STRUCT_SIGSET_T], [1], [Struct Sigset Type])
4437      ;;
4438    *)
4439      AC_MSG_RESULT(no)
4440      ;;
4441  esac
4442else
4443  AC_MSG_RESULT(no)
4444fi
4445
4446dnl Problems here if -I/usr/include/stddef.h used with g++ on Solaris
4447AC_LANG_CPLUSPLUS
4448ac_save_CPPFLAGS="$CPPFLAGS"
4449CPPFLAGS="$CPPFLAGS -I/usr/include"
4450AC_MSG_CHECKING([whether wchar_t is defined internal to C++])
4451AC_CACHE_VAL(ac_cv_c_wchar_t,[
4452AC_TRY_COMPILE([
4453#include <stddef.h>], [
4454], ac_cv_c_wchar_t=no, ac_cv_c_wchar_t=yes)])
4455if test x"$ac_cv_c_wchar_t" = xyes; then
4456  AC_DEFINE([_WCHAR_T], [1], [wide character type defined])
4457  AC_MSG_RESULT(yes)
4458else
4459  AC_MSG_RESULT(no)
4460fi
4461CPPFLAGS="$ac_save_CPPFLAGS"
4462AC_LANG_C
4463
4464AC_ARG_ENABLE(bitmapdir, [  --enable-bitmapdir=DIR  set directory for bitmaps, default is ./bitmaps],bitmap_dir=$enableval,bitmap_dir=no)
4465case "x$bitmap_dir" in
4466x/*|x.*)
4467  AC_MSG_RESULT([setting BITMAPDIR = $enableval])
4468  BITMAPDIR=$enableval
4469  if test ! -d $bitmap_dir; then
4470    AC_MSG_RESULT([Warning: Directory $enableval does not exist])
4471  fi
4472  ;;
4473*)
4474  BITMAPDIR='$(top_srcdir)/bitmaps'
4475  bitmap_dir='$top_srcdir/bitmaps'
4476  ;;
4477esac
4478
4479AC_ARG_ENABLE(bitmaptype, [  --enable-bitmaptype=name
4480                          set name for bitmap type],bitmap_type=$enableval,bitmap_type=no)
4481case "x$bitmap_type" in
4482xyes*|xno*)
4483  ;;
4484*)
4485  AC_MSG_RESULT([setting BITMAPTYPE = $enableval])
4486  BITMAPTYPE=$enableval
4487  if test ! -f $bitmap_dir/l-$BITMAPTYPE.xbm; then
4488    AC_MSG_RESULT([Warning: Bitmap $BITMAPDIR/l-$BITMAPTYPE.xbm does not exist])
4489  fi
4490  ;;
4491esac
4492
4493AC_ARG_ENABLE(pixmapdir, [  --enable-pixmapdir=DIR  set directory for pixmaps, default is ./pixmaps],pixmap_dir=$enableval,pixmap_dir=no)
4494case "x$pixmap_dir" in
4495x/*|x.*)
4496  AC_MSG_RESULT([setting PIXMAPDIR = $enableval])
4497  PIXMAPDIR=$enableval
4498  if test ! -d $pixmap_dir; then
4499    AC_MSG_RESULT([Warning: Directory $enableval does not exist])
4500  fi
4501  ;;
4502*)
4503  PIXMAPDIR='$(top_srcdir)/pixmaps'
4504  pixmap_dir='$top_srcdir/pixmaps'
4505  ;;
4506esac
4507
4508AC_ARG_ENABLE(pixmaptype, [  --enable-pixmaptype=name
4509                          set name for pixmap type],pixmap_type=$enableval,pixmap_type=no)
4510case "x$pixmap_type" in
4511xyes*|xno*)
4512  ;;
4513*)
4514  AC_MSG_RESULT([setting PIXMAPTYPE = $enableval])
4515  PIXMAPTYPE=$enableval
4516  if test ! -f $pixmap_dir/m-$PIXMAPTYPE.xpm; then
4517    AC_MSG_RESULT([Warning: Pixmap $PIXMAPDIR/m-$PIXMAPTYPE.xpm does not exist])
4518  fi
4519  ;;
4520esac
4521
4522AC_ARG_ENABLE(mapdir, [  --enable-mapdir=DIR     set directory for bitmaps and pixmaps],map_dir=$enableval,map_dir=no)
4523case "x$map_dir" in
4524x/*|x.*)
4525  AC_MSG_RESULT([setting BITMAPDIR = $enableval])
4526  BITMAPDIR=$enableval
4527  AC_MSG_RESULT([setting PIXMAPDIR = $enableval])
4528  PIXMAPDIR=$enableval
4529  if test ! -d $map_dir; then
4530    AC_MSG_RESULT([Warning: Directory $enableval does not exist])
4531  fi
4532  ;;
4533*)
4534  BITMAPDIR='$(top_srcdir)/bitmaps'
4535  bitmap_dir='$top_srcdir/bitmaps'
4536  PIXMAPDIR='$(top_srcdir)/pixmaps'
4537  pixmap_dir='$top_srcdir/pixmaps'
4538  ;;
4539esac
4540
4541AC_ARG_ENABLE(maptype, [  --enable-maptype=name   set name for bitmap and pixmap type],map_type=$enableval,map_type=no)
4542case "x$map_type" in
4543xyes*|xno*)
4544  ;;
4545*)
4546  AC_MSG_RESULT([setting BITMAPTYPE = $enableval])
4547  BITMAPTYPE=$enableval
4548  if test ! -f $map_dir/l-$BITMAPTYPE.xbm; then
4549    AC_MSG_RESULT([Warning: Bitmap $BITMAPDIR/l-$BITMAPTYPE.xbm does not exist])
4550  fi
4551  AC_MSG_RESULT([setting PIXMAPTYPE = $enableval])
4552  PIXMAPTYPE=$enableval
4553  if test ! -f $map_dir/m-$PIXMAPTYPE.xpm; then
4554    AC_MSG_RESULT([Warning: Pixmap $PIXMAPDIR/m-$PIXMAPTYPE.xpm does not exist])
4555  fi
4556  ;;
4557esac
4558
4559AC_ARG_ENABLE(vroot, [  --disable-vroot         disables xlock from being able to run in root window
4560                          (some window managers have problems)],use_vroot=$enableval,use_vroot=yes)
4561if test "$use_vroot" = yes; then
4562  AC_MSG_RESULT([defining option USE_VROOT])
4563  AC_DEFINE([USE_VROOT], [1], [virtual root window])
4564fi
4565
4566case ${canonical} in
4567      *-*-cygwin* )
4568        ;;
4569      * )
4570        AC_ARG_ENABLE(allow-root, [  --disable-allow-root    allows users to turn off allowroot (default is to
4571                          always allow root to be able to unlock xlock)],allow_root=$enableval,allow_root=yes)
4572        if test "$allow_root" = yes; then
4573          AC_MSG_RESULT([defining option ALWAYS_ALLOW_ROOT])
4574          AC_DEFINE([ALWAYS_ALLOW_ROOT], [1], [root is always allowed])
4575        fi
4576        ;;
4577esac
4578
4579case ${canonical} in
4580    *-*-linux* | *-*-freebsd* | *-*-openbsd* | *-*-netbsd* | *-*-dragonfly* )
4581      AC_ARG_ENABLE(vtlock, [  --enable-vtlock         allows to turn on VT switch lock (default is to be
4582                          able to switch to another VT)],vtlock=$enableval,vtlock=no)
4583      if test "$vtlock" = yes; then
4584        AC_MSG_RESULT([defining option USE_VTLOCK])
4585        AC_DEFINE([USE_VTLOCK], [1], [VT lock])
4586      fi
4587      ;;
4588    *)
4589      ;;
4590esac
4591
4592AC_ARG_ENABLE(syslog, [  --enable-syslog         enable syslog logging],use_syslog=$enableval,use_syslog=no)
4593if test "$use_syslog" = yes; then
4594  AC_MSG_RESULT([defining option USE_SYSLOG])
4595  AC_DEFINE([USE_SYSLOG], [1], [using syslog])
4596fi
4597
4598AC_ARG_ENABLE(multiple-user, [  --enable-multiple-user  enable multiple users],use_multiple_user=$enableval,use_multiple_user=no)
4599if test "$use_multiple_user" = yes; then
4600  AC_MSG_RESULT([defining option USE_MULTIPLE_USER])
4601  AC_DEFINE([USE_MULTIPLE_USER], [1], [multiple user])
4602fi
4603
4604AC_ARG_ENABLE(multiple-root, [  --enable-multiple-root  enable multiple root users],use_multiple_root=$enableval,use_multiple_root=no)
4605if test "$use_multiple_root" = yes; then
4606  AC_MSG_RESULT([defining option USE_MULTIPLE_ROOT])
4607  AC_DEFINE([USE_MULTIPLE_ROOT], [1], [multiple root users])
4608fi
4609
4610AC_ARG_ENABLE(xlock-group, [  --enable-xlock-group    enable all in xlock group to unlock],use_xlock_group=$enableval,use_xlock_group=no)
4611if test "$use_xlock_group" = yes; then
4612  AC_MSG_RESULT([defining option USE_XLOCK_GROUP])
4613  AC_DEFINE([USE_XLOCK_GROUP], [1], [xlock group])
4614fi
4615
4616AC_ARG_ENABLE(window-visibility, [  --enable-window-visibility
4617                          allow a window to be displayed over xlock],use_window_visiblity=$enableval,use_window_visibility=no)
4618if test "$use_window_visibility" = yes; then
4619  AC_MSG_RESULT([defining option USE_WINDOW_VISIBILITY])
4620  AC_DEFINE([USE_WINDOW_VISIBLITY], [1], [window visibility])
4621fi
4622
4623AC_ARG_ENABLE(old-event-loop, [  --enable-old-event-loop some machines may still need this
4624                          (fd_set errors may be a sign)],use_old_event_loop=$enableval,use_old_event_loop=no)
4625if test "$use_old_event_loop" = yes; then
4626  AC_MSG_RESULT([defining option USE_OLD_EVENT_LOOP])
4627  AC_DEFINE([USE_OLD_EVENT_LOOP], [1], [old event loop])
4628fi
4629
4630dnl AC_ARG_ENABLE(vmsutils, [  --enable-vmsutils       patches up old __VMS_VER < 70000000],use_vmsutils=$enableval,use_vmsutils=no)
4631dnl if test "$use_vmsutils" = yes; then
4632dnl   AC_MSG_RESULT([defining option USE_VMSUTILS])
4633dnl   AC_DEFINE([USE_VMSUTILS], [1], [VMS utilities])
4634dnl fi
4635
4636AC_ARG_ENABLE(xlockrc, [  --enable-xlockrc        for unknown shadow passwd algorithm],use_xlockrc=$enableval,use_xlockrc=maybe)
4637if test "$use_xlockrc" = yes; then
4638  AC_MSG_RESULT([defining option USE_XLOCKRC])
4639  AC_DEFINE([USE_XLOCKRC], [1], [encrypted password in .xlockrc file])
4640else
4641  who_am_i=`whoami`
4642  if ! test -f /etc/passwd || cat /etc/passwd | grep "unused" | grep $who_am_i > /dev/null 2>&1
4643  then
4644    case "${canonical}" in
4645      *-*-cygwin* )
4646        if test "$use_xlockrc" = maybe; then
4647          AC_MSG_RESULT([*** No password in /etc/passwd, enabling xlockrc])
4648          AC_MSG_RESULT([defining option USE_XLOCKRC])
4649          AC_DEFINE([USE_XLOCKRC], [1], [encrypted password in .xlockrc file])
4650        else
4651          AC_MSG_RESULT([*** Use --enable-xlockrc or write an encrypted password])
4652          AC_MSG_RESULT([***             to /etc/passwd replacing "unused" for $who_am_i])
4653        fi
4654      ;;
4655      esac
4656  fi
4657fi
4658
4659AC_ARG_ENABLE(auto-logout, [  --enable-auto-logout=time
4660                          enable auto-logout code for lab use (time in minutes)],use_auto_logout=$enableval,use_auto_logout=no)
4661case "x$use_auto_logout" in
4662x|xyes*)
4663  AC_MSG_RESULT([defining option USE_AUTO_LOGOUT = 240 minutes])
4664  AC_DEFINE([USE_AUTO_LOGOUT], [240], [auto logout in minutes])
4665  ;;
4666x[[0-9]]*)
4667  AC_MSG_RESULT([defining option USE_AUTO_LOGOUT = $enableval minutes])
4668  AC_DEFINE_UNQUOTED([USE_AUTO_LOGOUT], [$enableval], [auto logout in minutes])
4669  ;;
4670xno*)
4671  ;;
4672*)
4673  AC_MSG_RESULT([Warning: Illegal time value "$use_auto_logout" given])
4674  AC_MSG_RESULT([defining option USE_AUTO_LOGOUT = 240 minutes])
4675  AC_DEFINE([USE_AUTO_LOGOUT], [240], [auto logout in minutes])
4676  ;;
4677esac
4678
4679AC_ARG_ENABLE(default-auto-logout, [  --enable-default-auto-logout=time
4680                          set default-auto-logout (time in minutes)],
4681              def_auto_logout=$enableval,
4682              def_auto_logout=no)
4683case "x$def_auto_logout" in
4684x|xyes*)
4685  AC_MSG_RESULT([defining option DEF_AUTO_LOGOUT = 120 minutes])
4686  AC_DEFINE([DEF_AUTO_LOGOUT], ["120"], [default auto logout in minutes])
4687  ;;
4688x[[0-9]]*)
4689  AC_MSG_RESULT([defining option DEF_AUTO_LOGOUT = $enableval minutes])
4690  AC_DEFINE_UNQUOTED([DEF_AUTO_LOGOUT], ["$enableval"], [default auto logout in minutes])
4691  ;;
4692xno*)
4693  ;;
4694*)
4695  AC_MSG_RESULT([Warning: Illegal time value "$def_auto_logout" given])
4696  AC_MSG_RESULT([defining option DEF_AUTO_LOGOUT = 120 minutes])
4697  AC_DEFINE([DEF_AUTO_LOGOUT], ["120"], [default auto logout in minutes])
4698  ;;
4699esac
4700
4701AC_ARG_ENABLE(button-logout, [  --enable-button-logout=time
4702                          enable button logout for lab use (time in minutes)],
4703              use_button_logout=$enableval,
4704              use_button_logout=no)
4705case "x$use_button_logout" in
4706x|xyes*)
4707  AC_MSG_RESULT([defining option USE_BUTTON_LOGOUT = 10 minutes])
4708  AC_DEFINE([USE_BUTTON_LOGOUT], [10], [button logout in minutes])
4709  ;;
4710x[[0-9]]*|x-[0-9]*)
4711  AC_MSG_RESULT([defining option USE_BUTTON_LOGOUT = $enableval minutes])
4712  AC_DEFINE_UNQUOTED([USE_BUTTON_LOGOUT], $enableval, [button logout in minutes])
4713  ;;
4714xno*)
4715  ;;
4716*)
4717  AC_MSG_RESULT([Warning: Illegal time value "$use_button_logout" given])
4718  AC_MSG_RESULT([defining option USE_BUTTON_LOGOUT = 10 minutes])
4719  AC_DEFINE([USE_BUTTON_LOGOUT], [10], [button logout in minutes])
4720  ;;
4721esac
4722
4723AC_ARG_ENABLE(default-button-logout, [  --enable-default-button-logout=time
4724                          set default-button-logout (time in minutes)],
4725              def_button_logout=$enableval,
4726              def_button_logout=no)
4727case "x$def_button_logout" in
4728x|xyes*)
4729  AC_MSG_RESULT([defining option DEF_BUTTON_LOGOUT = 5 minutes])
4730  AC_DEFINE([DEF_BUTTON_LOGOUT], ["5"], [default button logout in minutes])
4731  ;;
4732x[[0-9]]*)
4733  AC_MSG_RESULT([defining option DEF_BUTTON_LOGOUT = $enableval minutes])
4734  AC_DEFINE_UNQUOTED([DEF_BUTTON_LOGOUT], ["$enableval"], [default button logout in minutes])
4735  ;;
4736xno*)
4737  ;;
4738*)
4739  AC_MSG_RESULT([Warning: Illegal time value "$def_button_logout" given])
4740  AC_MSG_RESULT([defining option DEF_BUTTON_LOGOUT = 5 minutes])
4741  AC_DEFINE([DEF_BUTTON_LOGOUT], ["5"], [default button logout in minutes])
4742  ;;
4743esac
4744
4745dnl Maybe soon
4746dnl AC_ARG_ENABLE(button-up, [  --enable-button-up      force button password screen to stay up],
4747dnl              use_button_up=$enableval,
4748dnl               use_button_up=no)
4749dnl if test "$use_button_up" = yes; then
4750dnl   AC_MSG_RESULT([defining option USE_BUTTON_UP])
4751dnl   AC_DEFINE([USE_BUTTON_UP], [1], [Button password])
4752dnl fi
4753
4754AC_ARG_ENABLE(bomb, [  --disable-bomb          disable automatic logout mode],
4755              use_bomb=$enableval,
4756              use_bomb=yes)
4757if test "$use_bomb" = yes; then
4758  AC_MSG_RESULT([defining option USE_BOMB])
4759  AC_DEFINE([USE_BOMB], [1], [special bomb mode, causes logout])
4760  BOMB=""
4761else
4762  BOMB="#"
4763fi
4764
4765AC_ARG_ENABLE(interactive, [  --disable-interactive   disables interactive modes (useful for prod env)],
4766              no_interactive=$enableval,
4767              no_interactive=yes)
4768if test "$no_interactive" = no; then
4769  AC_MSG_RESULT([defining option DISABLE_INTERACTIVE])
4770  AC_DEFINE([DISABLE_INTERACTIVE], [1], [disable interactive modes])
4771  INTERACTIVE=""
4772else
4773  INTERACTIVE="#"
4774fi
4775
4776AC_ARG_ENABLE(unstable, [  --enable-unstable       enables unstable (alpha) modes],
4777              use_unstable=$enableval,
4778              use_unstable=no)
4779if test "$use_unstable" = yes; then
4780  AC_MSG_RESULT([defining option USE_UNSTABLE])
4781  AC_DEFINE([USE_UNSTABLE], [1], [use unstable modes])
4782  UNSTABLE=""
4783else
4784  UNSTABLE="#"
4785fi
4786
4787AC_ARG_ENABLE(negative-logout, [  --disable-negative-logout
4788                          allows users to deny logout button and autologout],
4789              negative-logout=$enableval,
4790              negative_logout=yes)
4791if test "$negative_logout" = no; then
4792  AC_MSG_RESULT([defining option NO_NEGATIVE_LOGOUT])
4793  AC_DEFINE([NO_NEGATIVE_LOGOUT], [1], [deny logout button and autologout])
4794fi
4795
4796AC_ARG_ENABLE(closedown-logout, [  --enable-closedown-logout
4797                          define this one or next, with enable-auto-logout],
4798              closedown_logout=$enableval,
4799              closedown_logout=no)
4800if test "$closedown_logout" = yes; then
4801  AC_MSG_RESULT([defining option CLOSEDOWN_LOGOUT])
4802  AC_DEFINE([CLOSEDOWN_LOGOUT], [1], [allow a user to close down session for lab use])
4803fi
4804
4805AC_ARG_ENABLE(session-logout, [  --enable-session-logout enable-button-logout, and/or enable-bomb, for xdm],
4806              session_logout=$enableval,
4807              session_logout=no)
4808if test "$session_logout" = yes; then
4809  AC_MSG_RESULT([defining option SESSION_LOGOUT])
4810  AC_DEFINE([SESSION_LOGOUT], [1], [allow a user to kill an X session for lab use])
4811fi
4812
4813AC_ARG_ENABLE(staff-file, [  --enable-staff-file=filename
4814                          set file of staff who are exempt from auto-logout],
4815              use_staff_file=$enableval,
4816              use_staff_file=no)
4817case "x$use_staff_file" in
4818x|xyes*)
4819  AC_MSG_RESULT([defining option STAFF_FILE = "/usr/remote/etc/xlock.staff"])
4820  AC_DEFINE_UNQUOTED([STAFF_FILE], ["/usr/remote/etc/xlock.staff"], [file for staff exempt from auto-logout])
4821  if test ! -f /usr/remote/etc/xlock.staff; then
4822    AC_MSG_RESULT([Warning: File /usr/remote/etc/xlock.staff does not exist])
4823  fi
4824  ;;
4825x/*)
4826  AC_MSG_RESULT([defining option STAFF_FILE = "$enableval"])
4827  AC_DEFINE_UNQUOTED([STAFF_FILE], ["$enableval"], [file for staff exempt from auto-logout])
4828  if test ! -f $use_staff_file; then
4829    AC_MSG_RESULT([Warning: File $enableval does not exist])
4830  fi
4831  ;;
4832esac
4833
4834AC_ARG_ENABLE(staff-netgroup, [  --enable-staff-netgroup=netgroup
4835                          set netgroup of staff who are exempt from auto-logout],
4836              use_staff_netgroup=$enableval,
4837              use_staff_netgroup=no)
4838if test "$use_staff_netgroup" != no; then
4839  AC_MSG_RESULT([defining option STAFF_NETGROUP = "$enableval"])
4840  AC_DEFINE_UNQUOTED([STAFF_NETGROUP], ["$enableval"], [netgroup of staff exempt from auto-logout])
4841fi
4842
4843AC_ARG_ENABLE(kerberos4, [  --enable-kerberos4      enable Kerberos 4],
4844              kerberos4=$enableval,
4845              kerberos4=no)
4846if test "$kerberos4" = yes; then
4847  AC_MSG_RESULT([defining option HAVE_KRB4])
4848  AC_DEFINE([HAVE_KRB4], [1], [Kerberos 4 available])
4849  XLOCKINC="${XLOCKINC} -I/usr/athena/include"
4850  XLOCKLIBS="${XLOCKLIBS} -L/usr/athena/lib -lkrb -ldes"
4851fi
4852
4853AC_ARG_ENABLE(kerberos5, [  --enable-kerberos5      enable Kerberos 5],
4854              kerberos5=$enableval,
4855              kerberos5=no)
4856if test "$kerberos5" = yes; then
4857  AC_MSG_RESULT([defining option HAVE_KRB5])
4858  AC_DEFINE([HAVE_KRB5], [1], [Kerberos 5 available])
4859fi
4860
4861AC_ARG_WITH(krb5-config, [  --with-krb5-config=PATH Location of krb5-config script],[
4862  if test $withval = yes; then
4863    AC_PATH_PROG(krb5_config, krb5-config, not_found)
4864    if test X$krb5_config = Xnot_found; then
4865      AC_MSG_ERROR(unable to find krb5-config)
4866    fi
4867  else
4868    krb5_config=$withval
4869    if test ! -x $krb5_config; then
4870      AC_MSG_ERROR([unable to find krb5-config at $krb5_config])
4871    fi
4872  fi
4873  krb5_cflags=`$krb5_config --cflags krb5`
4874  retval=$?
4875  if test $retval -ne 0; then
4876    AC_MSG_ERROR($krb5_config failed with error code of $retval)
4877  fi
4878  krb5_libs=`$krb5_config --libs krb5`
4879  retval=$?
4880  if test $retval -ne 0; then
4881    AC_MSG_ERROR($krb5_config failed with error code of $retval)
4882  fi
4883  AC_MSG_RESULT(Adding $krb5_cflags to XLOCKINC)
4884  AC_MSG_RESULT(Adding $krb5_libs to XLOCKLIBS)
4885  XLOCKINC="$XLOCKINC $krb5_cflags"
4886  XLOCKLIBS="$XLOCKLIBS $krb5_libs"
4887])dnl
4888
4889AC_ARG_ENABLE(write_krb5, [  --enable-write-krb5     write new krb5 credentials to credential cache],
4890              write_krb5=$enableval,
4891              write_krb5=no)
4892if test "$write_krb5" = yes; then
4893  AC_MSG_RESULT(Will write out krb5 credentials to credential cache)
4894  AC_DEFINE([KRB5_WRITE_NEW_CCACHE], [1], [Kerberos 5 write new credential cache])
4895fi
4896
4897AC_ARG_ENABLE(dce_passwd, [  --enable-dce-passwd     enable DCE passwording],
4898              dce_passwd=$enableval,
4899              dce_passwd=no)
4900if test "$dce_passwd" = yes; then
4901  AC_MSG_RESULT([defining option DCE_PASSWD])
4902  AC_DEFINE([DCE_PASSWD], [1], [use DCE passwording])
4903  XLOCKINC="${XLOCKINC} -I/usr/include/reentrant"
4904  XLOCKLIBS="${XLOCKLIBS} -ldce -lc_r"
4905fi
4906
4907AC_ARG_ENABLE(pam, [  --enable-pam            enable PAM],
4908              pam=$enableval,
4909              pam=no)
4910if test "$pam" = yes; then
4911  if test "$use_xlockrc" = yes; then
4912    AC_MSG_RESULT([not defining option USE_PAM (mutually exclusive with xlockrc)])
4913  else
4914    AC_MSG_RESULT([defining option USE_PAM])
4915    AC_DEFINE([USE_PAM], [1], [using Pluggable Authentication Module])
4916    AC_CHECK_FUNC(dlsym, [ XLOCKLIBS="${XLOCKLIBS} -lpam" ], [ XLOCKLIBS="${XLOCKLIBS} -lpam -ldl"])
4917  fi
4918fi
4919
4920AC_ARG_ENABLE(bad_pam, [  --enable-bad-pam        enable BAD_PAM],
4921              bad_pam=$enableval,
4922              bad_pam=no)
4923if test "$bad_pam" = yes; then
4924  if test "$pam" = no; then
4925    AC_MSG_RESULT([not defining option BAD_PAM (need PAM)])
4926  else
4927    AC_MSG_RESULT([defining option BAD_PAM])
4928    AC_DEFINE([BAD_PAM], [1], [using deprecated PAM])
4929  fi
4930fi
4931
4932AC_ARG_ENABLE(good_pam, [  --enable-good-pam       enable GOOD_PAM],
4933              good_pam=$enableval,
4934              good_pam=no)
4935if test "$good_pam" = yes; then
4936  if test "$pam" = no; then
4937    AC_MSG_RESULT([not defining option GOOD_PAM (need PAM)])
4938  else
4939    AC_MSG_RESULT([defining option GOOD_PAM])
4940    AC_DEFINE([GOOD_PAM], [1], [using another version of PAM])
4941  fi
4942fi
4943
4944AC_ARG_ENABLE(afs, [  --enable-afs            enable AFS],
4945              afs=$enableval,
4946              afs=no)
4947if test "$afs" = yes; then
4948  AC_MSG_RESULT([defining option AFS])
4949  AC_DEFINE([AFS], [1], [Andrew File System, a distributed file system])
4950  XLOCKINC="${XLOCKINC} -I/usr/afsws/include"
4951  case "${canonical}" in
4952    *-*-solaris2.* )
4953      XLOCKLIBS="${XLOCKLIBS} -lucb -L/usr/afsws/lib -L/usr/afsws/lib/afs -lkauth.krb -lprot -lubik -lauth.krb -lrxkad -lsys -ldes -lrx -llwp -lcom_err -lcmd /usr/afsws/lib/afs/util.a -laudit -lsys"
4954    ;;
4955    *-*-osf* )
4956      XLOCKLIBS="${XLOCKLIBS} -L/usr/afsws/lib -L/usr/afsws/lib/afs -laudit -lkauth -lafsrpc -lrxkad -lubik -lprot -lrxkad -lrx -llwp -lauth -lsys -ldes -lcmd -lcom_err /usr/afsws/lib/afs/util.a -lpthread -laudit -llwp"
4957    ;;
4958    * )
4959      XLOCKLIBS="${XLOCKLIBS} -L/usr/afsws/lib -L/usr/afsws/lib/afs -lkauth -lubik -lprot -lrxkad -lrx -llwp -lauth -lsys -ldes -lcmd -lcom_err /usr/afsws/lib/afs/util.a -laudit"
4960    ;;
4961  esac
4962fi
4963
4964AC_ARG_ENABLE(sia, [  --enable-sia            enable SIA],
4965              sia=$enableval,
4966              sia=no)
4967if test "$sia" = yes; then
4968  AC_MSG_RESULT([defining option SIA])
4969  AC_DEFINE([SIA], [1], [Security Innovation Alliance])
4970  XLOCKLIBS="${XLOCKLIBS} -lsecurity"
4971fi
4972
4973AC_ARG_ENABLE(sunos_adjunct_passwd, [  --enable-sunos-adjunct-passwd
4974                          enable SUNOS Adjunct passwording],
4975              sunos_adjunct_passwd=$enableval,
4976              sunos_adjunct_passwd=no)
4977if test "$sunos_adjunct_passwd" = yes; then
4978  AC_MSG_RESULT([defining option SUNOS_ADJUNCT_PASSWD])
4979  AC_DEFINE([SUNOS_ADJUNCT_PASSWD], [1], [SunOS Adjunct Passwording])
4980fi
4981
4982AC_ARG_WITH(passwd-helper,
4983	[  --with-passwd-helper=/path Use external helper program for authentication],
4984	passwd_helper=$withval)
4985if test "$passwd_helper" != ""; then
4986  AC_MSG_RESULT([using password helper $passwd_helper])
4987  AC_DEFINE_UNQUOTED([PASSWD_HELPER_PROGRAM], [1], ["$passwd_helper"])
4988fi
4989
4990AC_ARG_ENABLE(mb, [  --disable-mb            disable Xmb function series so will only display ASCII],
4991              mb=$enableval,
4992              mb=yes)
4993if test "$mb" = yes; then
4994  AC_MSG_RESULT([defining option USE_MB])
4995  AC_DEFINE([USE_MB], [1], [Mb fonts])
4996fi
4997
4998AC_ARG_ENABLE(customization, [  --enable-customization  enable customization of XResource],
4999              customization=$enableval,
5000              customization=no)
5001if test "$customization" = yes; then
5002  AC_MSG_RESULT([defining option CUSTOMIZATION])
5003  AC_DEFINE([CUSTOMIZATION], [1], [allow customization of XResoure])
5004fi
5005
5006AC_ARG_ENABLE(modules, [  --enable-modules        enable modules (better to use xmkmf for this)],
5007              modules=$enableval,
5008              modules=no)
5009if test "$modules" = yes; then
5010  AC_MSG_RESULT([enabling xlk modules])
5011  MODULES=""
5012  NOMODULES="#"
5013  AC_DEFINE([USE_MODULES], [1], [using modules])
5014case ${canonical} in
5015    *-*-linux* )
5016      MODULEFLAGS="-rdynamic"
5017      CFLAGS="$CFLAGS -fPIC"
5018      CXXFLAGS="$CXXFLAGS -fPIC"
5019      ;;
5020    *)
5021      MODULEFLAGS=""
5022      ;;
5023esac
5024else
5025  MODULES="#"
5026  NOMODULES=""
5027  MODULEFLAGS=""
5028fi
5029
5030AC_ARG_ENABLE(blank_only, [  --enable-blank-only     enable blank mode only (boring)],
5031              blank_only=$enableval,
5032              blank_only=no)
5033if test "$blank_only" = "yes"; then
5034  AC_MSG_RESULT([enabling blank mode only])
5035  AC_DEFINE([BLANK_ONLY], [1], [only blank mode will be available])
5036else
5037  AC_ARG_ENABLE(nice_only, [  --enable-nice-only      enable only low cpu modes ],
5038              nice_only=$enableval,
5039              nice_only=no)
5040  if test "$nice_only" = "yes"; then
5041    AC_MSG_RESULT([enabling nice modes only])
5042    AC_DEFINE([NICE_ONLY], [1], [nice modes only])
5043  fi
5044fi
5045
5046AC_ARG_ENABLE(check, [  --enable-check          enable check (experimental)],check=$enableval,check=no)
5047if test "$check" = yes; then
5048  AC_MSG_RESULT([enabling memory debug checking])
5049  CHECK=""
5050else
5051  CHECK="#"
5052fi
5053
5054AC_ARG_WITH(lang, [  --with-lang=lang        use a foreign language (nl/fr/de/ja)],lang=$withval,lang=none)
5055case "$lang" in
5056  nl|NL|Nl)
5057    AC_MSG_RESULT([enabling some reporting in Dutch])
5058    AC_DEFINE([NL], [1], [support reporting in Dutch])
5059    ;;
5060  fr|FR|Fr)
5061    AC_MSG_RESULT([enabling some reporting in French])
5062    AC_DEFINE([FR], [1], [support reporting in French])
5063    ;;
5064  de|DE|De)
5065    AC_MSG_RESULT([enabling some reporting in German])
5066    AC_DEFINE([DE], [1], [support reporting in German])
5067    ;;
5068  ja|JA|Ja)
5069    AC_MSG_RESULT([enabling some reporting in Japanese])
5070    AC_DEFINE([JA], [1], [support reporting in Japanese])
5071    ;;
5072  none)
5073    AC_MSG_RESULT([using default language (English)])
5074    ;;
5075  *)
5076    AC_MSG_RESULT([unknown language $lang. using default language (English)])
5077    ;;
5078esac
5079
5080AC_ARG_ENABLE(orig_xpm_patch, [  --enable-orig-xpm-patch use the original pixmap patch for mail icon
5081                          (have colormap problems in 8 bits depth visuals)],
5082              orig_xpm_patch=$enableval,
5083              orig_xpm_patch=no)
5084if test "$orig_xpm_patch" = "yes"; then
5085  AC_MSG_RESULT([enabling original mail icon xpm patch])
5086  AC_DEFINE([ORIGINAL_XPM_PATCH], [1], [original XPM patch for mail icon])
5087fi
5088
5089AC_ARG_ENABLE(appdefaultdir, [  --enable-appdefaultdir=DIR
5090                          set directory installation of appdefaults,
5091			  default is where X is installed],appdefault_dir=$enableval,appdefault_dir=no)
5092case "x$appdefault_dir" in
5093x/*|x.*)
5094  AC_MSG_RESULT([setting APPDEFAULTS = $enableval])
5095  APPDEFAULTS=$enableval
5096  if test ! -d $appdefault_dir; then
5097    AC_MSG_RESULT([Warning: Directory $enableval does not exist])
5098  fi
5099  ;;
5100esac
5101
5102if test "x$INSTPGMFLAGS" != x; then
5103AC_ARG_ENABLE(setuid, [  --disable-setuid        disables setuid installation if automatically chosen],setuid=$enableval,setuid=yes)
5104case "x$setuid" in
5105xno*)
5106  case ${canonical} in
5107  *-*-linux*)
5108    if test "$vtlock" = "yes"; then
5109      INSTPGMFLAGS="-s -o root -g bin -m 4111"
5110      AC_MSG_RESULT([defining install options (setuid/setgid) = "$INSTPGMFLAGS" for vtlock])
5111       echo "experimental: Big buffer overrun security risk"
5112    else
5113  INSTPGMFLAGS=""
5114  AC_MSG_RESULT([no setuid/setgid install])
5115    fi
5116    ;;
5117  *)
5118  INSTPGMFLAGS=""
5119  AC_MSG_RESULT([no setuid/setgid install])
5120  ;;
5121  esac
5122  ;;
5123x|xyes*)
5124  case ${canonical} in
5125  *-*-linux*)
5126    if test "$vtlock" = "yes"; then
5127      INSTPGMFLAGS="-s -o root -g bin -m 4111"
5128      AC_MSG_RESULT([defining install options (setuid/setgid) = "$INSTPGMFLAGS" for vtlock])
5129    else
5130  AC_MSG_RESULT([defining install options (setuid/setgid) = "$INSTPGMFLAGS"])
5131    fi
5132    ;;
5133  *)
5134  AC_MSG_RESULT([defining install options (setuid/setgid) = "$INSTPGMFLAGS"])
5135  ;;
5136  esac
5137  ;;
5138x*)
5139  INSTPGMFLAGS=$enableval
5140  AC_MSG_RESULT([defining install options (setuid/setgid) = "$enableval"])
5141  ;;
5142esac
5143else
5144  AC_MSG_RESULT([no setuid/setgid install])
5145fi
5146
5147DEPEND=makedepend
5148DEPEND_FLAGS=
5149DEPEND_DEFINES=
5150
5151case "${canonical}" in
5152  *-*-irix5* | *-*-irix6* )
5153    XLOCKLIBPATHS="-L/usr/lib32 ${XLOCKLIBPATHS}"
5154    XMLOCKLIBPATHS="-L/usr/lib32 ${XMLOCKLIBPATHS}"
5155    XGLOCKLIBPATHS="-L/usr/lib32 ${XGLOCKLIBPATHS}"
5156  ;;
5157esac
5158XLOCKLIBS="${XLOCKLIBPATHS} ${XLOCKLIBS} -lX11 -lXext -lm"
5159XMLOCKLIBS="${XMLOCKLIBPATHS} ${XMLOCKLIBS} -lX11"
5160XGLOCKLIBS="${XGLOCKLIBPATHS} ${XGLOCKLIBS} ${GTK_LIBS} -lX11"
5161AC_SUBST(XLOCKLDFLAGS)
5162AC_SUBST(XMLOCKLDFLAGS)
5163AC_SUBST(XGLOCKLDFLAGS)
5164AC_SUBST(INSTPGMFLAGS)
5165AC_SUBST(MODULEFLAGS)
5166AC_SUBST(GTK_CFLAGS)
5167AC_SUBST(XLOCKINC)
5168AC_SUBST(XMLOCKINC)
5169AC_SUBST(XGLOCKINC)
5170AC_SUBST(GTK_LIBS)
5171AC_SUBST(XLIBS)
5172AC_SUBST(BITMAPTYPE)
5173AC_SUBST(PIXMAPTYPE)
5174AC_SUBST(BITMAPDIR)
5175AC_SUBST(PIXMAPDIR)
5176AC_SUBST(XLOCKLIBS)
5177AC_SUBST(XMLOCKLIBS)
5178AC_SUBST(XGLOCKLIBS)
5179AC_SUBST(XMLOCK)
5180AC_SUBST(XGLOCK)
5181AC_SUBST(XGLOCKDIR)
5182AC_SUBST(INSTALL_XMLOCK)
5183AC_SUBST(INSTALL_XGLOCK)
5184AC_SUBST(UNINSTALL_XMLOCK)
5185AC_SUBST(UNINSTALL_XGLOCK)
5186AC_SUBST(APPDEFAULTS)
5187AC_SUBST(LINT)
5188AC_SUBST(CHECK)
5189AC_SUBST(PURIFY)
5190AC_SUBST(XPM)
5191AC_SUBST(GL)
5192AC_SUBST(GLTT)
5193AC_SUBST(FTGL)
5194AC_SUBST(BOMB)
5195AC_SUBST(INTERACTIVE)
5196AC_SUBST(UNSTABLE)
5197AC_SUBST(DEPEND)
5198AC_SUBST(DEPEND_FLAGS)
5199AC_SUBST(DEPEND_DEFINES)
5200AC_SUBST(CXX)
5201AC_SUBST(CCC)
5202AC_SUBST(MODULES)
5203AC_SUBST(NOMODULES)
5204AC_SUBST(FORTUNE)
5205AC_SUBST(FORTUNE_PATH)
5206AC_SUBST(NOPLAY)
5207
5208AC_CONFIG_HEADER(config.h)
5209AC_CONFIG_FILES([Makefile xlock/Makefile modes/Makefile modes/glx/Makefile
5210  xmlock/Makefile xglock/Makefile])
5211AC_OUTPUT
5212