1# configure.in --- xscreensaver, Copyright © 1997-2021 Jamie Zawinski.
2#
3
4# Note: upgrading past 2.69_5 breaks the world.
5AC_PREREQ([2.69])
6
7AC_INIT
8AC_CONFIG_SRCDIR([driver/subprocs.c])
9AC_CONFIG_HEADERS([config.h])
10
11echo "current directory: `pwd`"
12echo "command line was: $0 $@"
13
14###############################################################################
15#
16#       Autoheader stuff
17#
18###############################################################################
19
20AH_TOP([
21/* xscreensaver, Copyright © 1991-2021 Jamie Zawinski.
22 * Generate this file by running 'configure' rather than editing it by hand.
23 */
24])
25
26# Defines in config.h are dumped out alphabetically rather than in any kind
27# of sane order, sigh.
28
29#
30# OS stuff.
31#
32AH_TEMPLATE([HAVE_PTHREAD],
33	    [Define this if you have POSIX threads.])
34
35AH_TEMPLATE([HAVE_SIGTIMEDWAIT],
36	    [Define to 1 if you have the `sigtimedwait' function.])
37
38AH_TEMPLATE([HAVE_FORKPTY],
39	    [Define this if you have forkpty.])
40
41AH_TEMPLATE([HAVE_GETTIMEOFDAY],
42	    [Define this if you have gettimeofday.])
43
44AH_TEMPLATE([GETTIMEOFDAY_TWO_ARGS],
45	    [Define this if gettimeofday takes two arguments.])
46
47AH_TEMPLATE([HAVE_ICMP],
48	    [Define this if ping uses struct icmp.icmp_id.])
49
50AH_TEMPLATE([HAVE_ICMPHDR],
51	    [Define this if ping uses struct icmphdr.un.echo.id.])
52
53AH_TEMPLATE([HAVE_GETIFADDRS],
54	    [Define this if you have getifaddrs.])
55
56AH_TEMPLATE([HAVE_LIBCAP],
57	    [Define this if your system has libcap.])
58
59#
60# X11 server stuff.
61#
62AH_TEMPLATE([XPointer],
63            [Stare into the void.])
64
65AH_TEMPLATE([HAVE_READ_DISPLAY_EXTENSION],
66	    [Define this if you have the SGI XReadDisplay extension.])
67
68AH_TEMPLATE([HAVE_XINPUT],
69	    [Define this if you have the XInput2 extension.])
70
71# This only ever existed in X11R4 and X11R5.
72AH_TEMPLATE([HAVE_XIDLE_EXTENSION],
73	    [Define this if you have the X11R5 XIDLE extension.])
74
75# This only ever existed on SGI hardware.
76AH_TEMPLATE([HAVE_SGI_SAVER_EXTENSION],
77	    [Define this if you have the SGI SCREEN_SAVER extension.])
78
79# This only ever existed on SGI hardware.
80AH_TEMPLATE([HAVE_SGI_VC_EXTENSION],
81	    [Define this if you have the SGI-VIDEO-CONTROL extension.])
82
83AH_TEMPLATE([HAVE_MIT_SAVER_EXTENSION],
84	    [Using the MIT-SCREEN-SAVER extension means that the X server
85            will crash at random times, and fading and hysteresis won't work.
86            Don't use this.  You'll be sorry.  See comment in xscreensaver.c.])
87
88AH_TEMPLATE([HAVE_DPMS_EXTENSION],
89	    [Define this if you have the XDPMS extension.])
90
91AH_TEMPLATE([HAVE_XF86VMODE],
92	    [Define this if you have XF86VidModeGetViewPort, for
93            virtual desktops.])
94
95AH_TEMPLATE([HAVE_XF86VMODE_GAMMA],
96	    [Define this if you have XF86VidModeSetGamma, for fading.])
97
98AH_TEMPLATE([HAVE_XF86VMODE_GAMMA_RAMP],
99	    [Define this if you have XF86VidModeSetGammaRamp, for fading.])
100
101AH_TEMPLATE([HAVE_XINERAMA],
102	    [Define this if you have the Xinerama extension.])
103
104AH_TEMPLATE([HAVE_XHPDISABLERESET],
105	    [Define this if you have XHPDisableReset, which allows
106	    Ctrl-Sh-Reset to be temporarily disabled.])
107
108AH_TEMPLATE([HAVE_RANDR],
109	    [Define this if you have the Resize and Rotate extension.])
110
111AH_TEMPLATE([HAVE_RANDR_12],
112	    [Define this if the RANDR library is version 1.2 or newer.])
113
114AH_TEMPLATE([HAVE_XSHM_EXTENSION],
115	    [Define this if you have the X Shared Memory Extension.])
116
117AH_TEMPLATE([HAVE_DOUBLE_BUFFER_EXTENSION],
118	    [Define this if you have the X Double Buffer Extension.])
119
120#AH_TEMPLATE([HAVE_XCOMPOSITE_EXTENSION],
121#	    [Define this if you have the X Composite Extension.])
122
123AH_TEMPLATE([HAVE_XKB],
124	    [Define this if you have the X Keyboard Extension.])
125
126AH_TEMPLATE([HAVE_LIBSYSTEMD],
127	    [Define this if you have libsystemd.])
128
129AH_TEMPLATE([HAVE_LIBELOGIND],
130	    [Define this if you have libelogind.])
131
132AH_TEMPLATE([HAVE_PROC_INTERRUPTS],
133	    [Define this if you have a Linux-like /proc/interrupts file which
134	    can be examined to determine when keyboard activity has
135	    occurred, and you use PS/2 input devices instead of USB.])
136
137AH_TEMPLATE([HAVE_PROC_OOM],
138	    [Define this if you have a Linux-like /proc/.../oom_score_adj file
139	    which can be adjusted by root to exempt us from the out-of-memory
140	    killer.])
141
142#
143# GUI stuff.
144#
145AH_TEMPLATE([HAVE_MOTIF],
146            [Define this if you have Motif.])
147
148AH_TEMPLATE([HAVE_XMCOMBOBOX],
149	    [Define this if you have the XmComboBox Motif 2.0 widget.])
150
151AH_TEMPLATE([HAVE_GTK],
152            [Define this if you have Gtk])
153AH_TEMPLATE([HAVE_GTK2],
154            [Define this if you have Gtk 2.x.])
155
156AH_TEMPLATE([HAVE_CRAPPLET],
157	    [Define this if you have Gnome and want to build support for the
158	    xscreensaver control panel in the Gtk 1.x Gnome Control Center.])
159
160AH_TEMPLATE([HAVE_CRAPPLET_IMMEDIATE],
161	    [Define this if HAVE_CRAPPLET is defined, and the function
162	    capplet_widget_changes_are_immediate is available.])
163
164AH_TEMPLATE([HAVE_XML],
165            [Define this if you have the XML library.])
166
167AH_TEMPLATE([HAVE_OLD_XML_HEADERS],
168	    [Define this if you the XML library headers lack the
169            gnome-xml/libxml symlink.])
170
171AH_TEMPLATE([HAVE_GDK_PIXBUF],
172	    [Define this if you have GDK_Pixbuf.])
173
174AH_TEMPLATE([HAVE_GDK_PIXBUF_APPLY_EMBEDDED_ORIENTATION],
175	    [Define this if you have the gdk_pixbuf_apply_embedded_orientation
176	    function (gdk-pixbuf 2.12).])
177
178#
179# Image loading.
180#
181AH_TEMPLATE([HAVE_JPEGLIB],
182	    [Define this if you have the JPEG Group's JPEG library.])
183
184AH_TEMPLATE([HAVE_LIBPNG],
185	    [Define this if you have the Portable Network Graphics library.])
186
187AH_TEMPLATE([HAVE_XUTF8DRAWSTRING],
188	    [Define this if you have the function Xutf8DrawString.])
189
190AH_TEMPLATE([HAVE_XFT],
191	    [Define this if you have libXft2.])
192
193#
194# Graphics libraries.
195#
196AH_TEMPLATE([HAVE_GL],
197	    [Define this if you have OpenGL.])
198
199AH_TEMPLATE([HAVE_GLES],
200	    [Define this if the native OpenGL library is OpenGLES 1.x.])
201
202AH_TEMPLATE([HAVE_GLES2],
203	    [Define this if the native OpenGL library is OpenGLES 2.x.])
204
205AH_TEMPLATE([HAVE_GLES3],
206	    [Define this if the native OpenGL library is OpenGLES 3.x.])
207
208AH_TEMPLATE([HAVE_JWZGLES],
209            [Define this to emulate OpenGL 1.3 in terms of OpenGLES 1.x.])
210
211AH_TEMPLATE([HAVE_EGL],
212	    [Define this if OpenGL bindings are via EGL instead of GLX.])
213
214AH_TEMPLATE([HAVE_GLSL],
215	    [Define this if OpenGL supports the OpenGL Shading Language.])
216
217AH_TEMPLATE([HAVE_GLBINDTEXTURE],
218	    [Define this if the OpenGL version is 1.1 or newer.])
219
220AH_TEMPLATE([HAVE_GLE],
221	    [Define this if you have the GL Extrusion library.])
222
223AH_TEMPLATE([HAVE_GLE3],
224            [Define this if GL Extrusion is version 3.])
225
226
227AH_TEMPLATE([HAVE_RECORD_ANIM],
228	    [Define this to enable recording of videos.])
229
230#
231# Locking.
232#
233AH_TEMPLATE([NO_LOCKING],
234	    [Define this to remove the option of locking the screen at all.])
235
236AH_TEMPLATE([HAVE_PAM],
237	    [Define this if you have Pluggable Authentication Modules.])
238
239AH_TEMPLATE([PAM_SERVICE_NAME],
240	    [The name of the "xscreensaver" PAM service.])
241
242AH_TEMPLATE([HAVE_PAM_FAIL_DELAY],
243	    [Define this if you have pam_fail_delay.])
244
245AH_TEMPLATE([PAM_CHECK_ACCOUNT_TYPE],
246            [Whether PAM should check the result of account modules
247	    when authenticating.])
248
249AH_TEMPLATE([PAM_STRERROR_TWO_ARGS],
250	    [Define if pam_strerror requires two arguments.])
251
252AH_TEMPLATE([HAVE_KERBEROS],
253	    [Define this if you want to use Kerberos authentication to
254	    lock/unlock the screen instead of PAM.])
255
256AH_TEMPLATE([HAVE_KERBEROS5],
257	    [Define this if you have Kerberos 5.])
258
259AH_TEMPLATE([ALLOW_ROOT_PASSWD],
260	    [Define this to allow root to unlock, when not using PAM.])
261
262AH_TEMPLATE([HAVE_SHADOW_PASSWD],
263	    [Define this if your system uses /etc/shadow.])
264
265AH_TEMPLATE([HAVE_PWNAM_SHADOW_PASSWD],
266	    [Define this if your system uses getpwnam_shadow.])
267
268AH_TEMPLATE([HAVE_ENHANCED_PASSWD],
269	    [Define this for DEC/SCO "Enhanced Security" with getprpwnam.])
270
271AH_TEMPLATE([HAVE_ADJUNCT_PASSWD],
272	    [Define this for Solaris getpwanam.])
273
274AH_TEMPLATE([HAVE_HPUX_PASSWD],
275	    [Define this for HPUX so-called "Secure Passwords".])
276
277#AH_TEMPLATE([PASSWD_HELPER_PROGRAM],
278#	    [Define this to use a third-party password helper program.])
279
280AH_TEMPLATE([HAVE_SYSLOG],
281	    [Define this if you have openlog/syslog/closelog.])
282
283
284# After checking to see that --srcdir is correct (which AC_INIT does)
285# check for some random other files that come later in the tar file,
286# to make sure everything is here.
287#
288for d in utils jwxyz hacks xlockmore/xlock xlockmore/modes xlockmore/modes/glx hacks/glx driver ; do
289  f=$srcdir/$d/Makefile.in
290  if test \! -r $f ; then
291    echo ""
292    echo "ERROR: The package is incomplete: $f does not exist."
293    echo "       This probably means that your download was truncated."
294    echo ""
295    exit 1
296  fi
297done
298
299###############################################################################
300#
301#       Check for availability of various gcc command-line options.
302#
303###############################################################################
304
305AC_DEFUN([AC_CHECK_GCC_ARG],
306 [if test -n "$GCC"; then
307   AC_CACHE_CHECK([whether gcc accepts [$2]],
308     ac_cv_gcc_accepts_[$1],
309    [rm -rf conftest.$ac_ext
310     touch conftest.$ac_ext
311     if ( ( gcc -c [$2] conftest.$ac_ext -o/dev/null >/dev/null ) 2>&1 | \
312          grep unrecognized >/dev/null ); then
313       ac_cv_gcc_accepts_[$1]=no
314     else
315       ac_cv_gcc_accepts_[$1]=yes
316       CC="$CC [$2]"
317     fi])
318   ac_gcc_accepts_[$1]="$ac_cv_gcc_accepts_[$1]"
319  fi
320])
321
322
323###############################################################################
324#
325#       Function to figure out how to run the compiler.
326#
327###############################################################################
328
329AC_DEFUN([AC_PROG_CC_ANSI],
330 [AC_REQUIRE([AC_PROG_CC])
331
332  if test -z "$GCC"; then
333    # not using GCC
334    AC_MSG_CHECKING(how to request ANSI compilation)
335    case "$host" in
336      *-hpux* )
337        AC_MSG_RESULT(HPUX: adding -Ae)
338        CC="$CC -Ae"
339      ;;
340      *-aix* )
341        AC_MSG_RESULT(AIX: adding -qlanglvl=ansi -qhalt=e)
342        CC="$CC -qlanglvl=ansi -qhalt=e"
343      ;;
344      *-dec-* )
345        AC_MSG_RESULT(DEC: adding -std1 -ieee)
346        CC="$CC -std1"
347      ;;
348      *)
349        AC_MSG_RESULT(no idea)
350      ;;
351    esac
352  else
353    # using GCC
354    case "$host" in
355      *-solaris*)
356        AC_MSG_RESULT(Solaris: adding -D__EXTENSIONS__)
357        CC="$CC -D__EXTENSIONS__"
358      ;;
359    esac
360
361    # Prior to 1996, XScreenSaver was written in K&R C, because ANSI C
362    # compilers (function prototypes!) were not yet universally deployed.
363    # And even after the conversion to ANSI C, GNU C's various non-standard
364    # extensions (such as allowing C++ style "//" comments in C code, and
365    # declarations after statements) were not supported by non-gcc compilers
366    # for many years, so we continued to use "-std=c89" to prevent those
367    # GNU-isms from sneaking in to the code.  Well, these days various
368    # vendors have sloppily allowed non-ANSI syntax to slip into their
369    # library header files.  GTK and OpenGL have been major offenders in this
370    # way.  So... as of 2021, I guess we are forced to use "-std=gnu89", to
371    # allow those extensions, and hope that the warnings generated by
372    # "-pedantic" are heeded.
373    #
374    AC_CHECK_GCC_ARG(gnu89, -std=gnu89)
375    AC_CHECK_GCC_ARG(pedantic, -pedantic)
376    AC_CHECK_GCC_ARG(Wall, -Wall)
377    AC_CHECK_GCC_ARG(wnested_externs,       -Wnested-externs)
378    AC_CHECK_GCC_ARG(wstrict_prototypes,    -Wstrict-prototypes)
379    AC_CHECK_GCC_ARG(wmissing_prototypes,   -Wmissing-prototypes)
380    AC_CHECK_GCC_ARG(declaration_after,     -Wdeclaration-after-statement)
381    # "string length is greater than ISO C89 compilers required to support"
382    AC_CHECK_GCC_ARG(no_overlength_strings, -Wno-overlength-strings)
383    # Ignore warnings about using "inline"
384    AC_CHECK_GCC_ARG(no_language_ext_token, -Wno-language-extension-token)
385    # Xlib headers use named variadic macros.
386    AC_CHECK_GCC_ARG(no_variadic_macros,    -Wno-variadic-macros)
387  fi
388])
389
390
391###############################################################################
392#
393#       Function to figure out how to create directory trees.
394#
395###############################################################################
396
397AC_DEFUN([AC_PROG_INSTALL_DIRS],
398 [AC_CACHE_CHECK([whether "\${INSTALL} -d" creates intermediate directories],
399    ac_cv_install_d_creates_dirs,
400    [ac_cv_install_d_creates_dirs=no
401     rm -rf conftestdir
402     if mkdir conftestdir; then
403       cd conftestdir 2>/dev/null
404       ${INSTALL} -d `pwd`/dir1/dir2 >/dev/null 2>&1
405       if test -d dir1/dir2/. ; then
406         ac_cv_install_d_creates_dirs=yes
407       fi
408       cd .. 2>/dev/null
409       rm -rf conftestdir
410     fi
411    ])
412
413  if test "$ac_cv_install_d_creates_dirs" = no ; then
414    AC_CACHE_CHECK([whether "mkdir -p" creates intermediate directories],
415      ac_cv_mkdir_p_creates_dirs,
416      [ac_cv_mkdir_p_creates_dirs=no
417       rm -rf conftestdir
418       if mkdir conftestdir; then
419         cd conftestdir 2>/dev/null
420         mkdir -p dir1/dir2 >/dev/null 2>&1
421         if test -d dir1/dir2/. ; then
422           ac_cv_mkdir_p_creates_dirs=yes
423         fi
424         cd .. 2>/dev/null
425         rm -rf conftestdir
426       fi
427      ])
428  fi
429
430  if test "$ac_cv_install_d_creates_dirs" = yes ; then
431    INSTALL_DIRS='${INSTALL} -d'
432  elif test "$ac_cv_mkdir_p_creates_dirs" = yes ; then
433    INSTALL_DIRS='mkdir -p'
434  else
435    # any other ideas?
436    INSTALL_DIRS='${INSTALL} -d'
437  fi
438])
439
440
441###############################################################################
442#
443#       Function to check whether gettimeofday() exists, and how to call it.
444#	This may define HAVE_GETTIMEOFDAY and GETTIMEOFDAY_TWO_ARGS.
445#
446###############################################################################
447
448AC_DEFUN([AC_GETTIMEOFDAY_ARGS],
449 [AC_MSG_CHECKING(how to call gettimeofday)
450  AC_CACHE_VAL(ac_cv_gettimeofday_args,
451   [AC_COMPILE_IFELSE(
452    [AC_LANG_PROGRAM([#include <stdlib.h>
453                    #include <sys/time.h>],
454                      [struct timeval tv; struct timezone tzp;
455                    gettimeofday(&tv, &tzp);])],
456    [ac_gettimeofday_args=2],
457    [ac_gettimeofday_args=1])
458    ac_cv_gettimeofday_args=$ac_gettimeofday_args])
459  ac_gettimeofday_args=$ac_cv_gettimeofday_args
460  if test "$ac_gettimeofday_args" = 1 ; then
461    AC_DEFINE(HAVE_GETTIMEOFDAY)
462    AC_MSG_RESULT(one argument)
463  elif test "$ac_gettimeofday_args" = 2 ; then
464    AC_DEFINE(HAVE_GETTIMEOFDAY)
465    AC_DEFINE(GETTIMEOFDAY_TWO_ARGS)
466    AC_MSG_RESULT(two arguments)
467  else
468    AC_MSG_RESULT(unknown)
469  fi
470])
471
472
473###############################################################################
474#
475#       Function to find perl5 (defines PERL and PERL_VERSION.)
476#
477###############################################################################
478
479# M4 sucks!!  perl sucks too!!
480changequote(X,Y)
481perl_version_cmd='print $]'
482changequote([,])
483
484AC_DEFUN([AC_PROG_PERL],
485 [AC_PATH_PROGS(PERL, [perl5 perl],,)
486  if test -z "$PERL" ; then
487    PERL_VERSION=0
488  else
489    AC_CACHE_CHECK([perl version], ac_cv_perl_version,
490                   [ac_cv_perl_version=`$PERL -e "$perl_version_cmd"`])
491    PERL_VERSION=$ac_cv_perl_version
492  fi
493 ])
494
495
496###############################################################################
497#
498#       Functions to check how to do ICMP PING requests.
499#
500###############################################################################
501
502AC_DEFUN([AC_CHECK_ICMP],
503 [AC_CACHE_CHECK([for struct icmp], ac_cv_have_icmp,
504  [AC_COMPILE_IFELSE(
505    [AC_LANG_PROGRAM([#include <stdlib.h>
506                   #include <stdio.h>
507                   #include <math.h>
508                   #include <unistd.h>
509                   #include <limits.h>
510                   #include <signal.h>
511                   #include <fcntl.h>
512                   #include <sys/types.h>
513                   #include <sys/time.h>
514                   #include <sys/ipc.h>
515                   #include <sys/shm.h>
516                   #include <sys/socket.h>
517                   #include <netinet/in_systm.h>
518                   #include <netinet/in.h>
519                   #include <netinet/ip.h>
520                   #include <netinet/ip_icmp.h>
521                   #include <netinet/udp.h>
522                   #include <arpa/inet.h>
523                   #include <netdb.h>],
524                  [struct icmp i;
525                   struct sockaddr s;
526                   struct sockaddr_in si;
527                   struct ip ip;
528                   i.icmp_type = ICMP_ECHO;
529                   i.icmp_code = 0;
530                   i.icmp_cksum = 0;
531                   i.icmp_id = 0;
532                   i.icmp_seq = 0;
533                   si.sin_family = AF_INET;
534                   #if defined(__DECC) || defined(_IP_VHL)
535                   ip.ip_vhl = 0;
536                   #else
537                   ip.ip_hl = 0;
538                   #endif
539                   ])],
540   [ac_cv_have_icmp=yes],
541   [ac_cv_have_icmp=no])])
542 if test "$ac_cv_have_icmp" = yes ; then
543   AC_DEFINE(HAVE_ICMP)
544 fi])
545
546AC_DEFUN([AC_CHECK_ICMPHDR],
547 [AC_CACHE_CHECK([for struct icmphdr], ac_cv_have_icmphdr,
548  [AC_COMPILE_IFELSE(
549    [AC_LANG_PROGRAM([#include <stdlib.h>
550                   #include <stdio.h>
551                   #include <math.h>
552                   #include <unistd.h>
553                   #include <limits.h>
554                   #include <signal.h>
555                   #include <fcntl.h>
556                   #include <sys/types.h>
557                   #include <sys/time.h>
558                   #include <sys/ipc.h>
559                   #include <sys/shm.h>
560                   #include <sys/socket.h>
561                   #include <netinet/in_systm.h>
562                   #include <netinet/in.h>
563                   #include <netinet/ip.h>
564                   #include <netinet/ip_icmp.h>
565                   #include <netinet/udp.h>
566                   #include <arpa/inet.h>
567                   #include <netdb.h>],
568                  [struct icmphdr i;
569                   struct sockaddr s;
570                   struct sockaddr_in si;
571                   struct ip ip;
572                   i.type = ICMP_ECHO;
573                   i.code = 0;
574                   i.checksum = 0;
575                   i.un.echo.id = 0;
576                   i.un.echo.sequence = 0;
577                   si.sin_family = AF_INET;
578                   ip.ip_hl = 0;])],
579    [ac_cv_have_icmphdr=yes],
580    [ac_cv_have_icmphdr=no])])
581 if test "$ac_cv_have_icmphdr" = yes ; then
582   AC_DEFINE(HAVE_ICMPHDR)
583 fi])
584
585
586###############################################################################
587#
588#       Functions to check for various X11 crap.
589#
590###############################################################################
591
592# Try and find the app-defaults directory.
593# It sucks that autoconf doesn't do this already...
594# (AC_PATH_X_APP_DEFAULTS_XMKMF is no longer used.)
595#
596AC_DEFUN([AC_PATH_X_APP_DEFAULTS_XMKMF],[
597  rm -fr conftestdir
598  if mkdir conftestdir; then
599    cd conftestdir 2>/dev/null
600    # Make sure to not put "make" in the Imakefile rules, since we grep it out.
601    cat > Imakefile <<'EOF'
602acfindx:
603	@echo 'ac_x_app_defaults="${XAPPLOADDIR}"'
604EOF
605    if (xmkmf) >/dev/null 2>&1 && test -f Makefile; then
606      # GNU make sometimes prints "make[1]: Entering...", which'd confuse us.
607      eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
608    fi
609    cd .. 2>/dev/null
610    rm -fr conftestdir
611  fi])
612
613AC_DEFUN([AC_PATH_X_APP_DEFAULTS_DIRECT],[
614  # Look for the directory under a standard set of common directories.
615  # Check X11 before X11Rn because it's often a symlink to the current release.
616  for ac_dir in                                 \
617                                                \
618    /usr/share/X11/app-defaults                 \
619                                                \
620    /usr/X11/lib/app-defaults                   \
621    /usr/X11R6/lib/app-defaults                 \
622    /usr/X11R6/lib/X11/app-defaults             \
623    /usr/X11R5/lib/app-defaults                 \
624    /usr/X11R5/lib/X11/app-defaults             \
625    /usr/X11R4/lib/app-defaults                 \
626    /usr/X11R4/lib/X11/app-defaults             \
627                                                \
628    /usr/lib/X11/app-defaults                   \
629    /usr/lib/X11R6/app-defaults                 \
630    /usr/lib/X11R5/app-defaults                 \
631    /usr/lib/X11R4/app-defaults                 \
632                                                \
633    /etc/X11/app-defaults                       \
634                                                \
635    /usr/local/X11/lib/app-defaults             \
636    /usr/local/X11R6/lib/app-defaults           \
637    /usr/local/X11R5/lib/app-defaults           \
638    /usr/local/X11R4/lib/app-defaults           \
639                                                \
640    /usr/local/lib/X11/app-defaults             \
641    /usr/local/lib/X11R6/app-defaults           \
642    /usr/local/lib/X11R6/X11/app-defaults       \
643    /usr/local/lib/X11R5/app-defaults           \
644    /usr/local/lib/X11R5/X11/app-defaults       \
645    /usr/local/lib/X11R4/app-defaults           \
646    /usr/local/lib/X11R4/X11/app-defaults       \
647                                                \
648    /usr/X386/lib/X11/app-defaults              \
649    /usr/x386/lib/X11/app-defaults              \
650    /usr/XFree86/lib/X11/app-defaults           \
651                                                \
652    /usr/lib/X11/app-defaults                   \
653    /usr/local/lib/X11/app-defaults             \
654    /usr/unsupported/lib/X11/app-defaults       \
655    /usr/athena/lib/X11/app-defaults            \
656    /usr/local/x11r5/lib/X11/app-defaults       \
657    /usr/lpp/Xamples/lib/X11/app-defaults       \
658    /lib/usr/lib/X11/app-defaults               \
659                                                \
660    /usr/openwin/lib/app-defaults               \
661    /usr/openwin/lib/X11/app-defaults           \
662    /usr/openwin/share/lib/app-defaults         \
663    /usr/openwin/share/lib/X11/app-defaults     \
664                                                \
665    /X11R6/lib/app-defaults                     \
666    /X11R5/lib/app-defaults                     \
667    /X11R4/lib/app-defaults                     \
668    ; \
669  do
670    if test -d "$ac_dir"; then
671      ac_x_app_defaults=$ac_dir
672      break
673    fi
674  done
675])
676
677AC_DEFUN([AC_PATH_X_APP_DEFAULTS],
678  [AC_REQUIRE_CPP()
679    AC_CACHE_CHECK([for X app-defaults directory], ac_cv_x_app_defaults,
680     [# skip this, it's always wrong these days.
681      #  AC_PATH_X_APP_DEFAULTS_XMKMF
682      if test x"$ac_x_app_defaults" = x; then
683        true AC_PATH_X_APP_DEFAULTS_DIRECT
684      fi
685      if test x"$ac_x_app_defaults" = x; then
686        /bin/echo -n 'fallback: '
687        ac_cv_x_app_defaults="/usr/lib/X11/app-defaults"
688      else
689        # Record where we found app-defaults for the cache.
690        ac_cv_x_app_defaults="$ac_x_app_defaults"
691      fi])
692    eval ac_x_app_defaults="$ac_cv_x_app_defaults"])
693
694
695AC_DEFUN([AC_XPOINTER],
696 [AC_CACHE_CHECK([for XPointer], ac_cv_xpointer,
697                 [AC_TRY_X_COMPILE([#include <X11/Xlib.h>],
698                                   [XPointer foo = (XPointer) 0;],
699                                   [ac_cv_xpointer=yes],
700                                   [ac_cv_xpointer=no])])
701  if test "$ac_cv_xpointer" != yes; then
702   AC_DEFINE(XPointer,[char*])
703  fi])
704
705AC_DEFUN([AC_XT],
706 [AC_CACHE_CHECK([for Xt], ac_cv_libxt,
707                 [AC_TRY_X_COMPILE([#include <X11/Xlib.h>
708                                    #include <X11/Intrinsic.h>],
709                                   [Widget foo = (Widget) 0;],
710                                   [ac_cv_libxt=yes],
711                                   [ac_cv_libxt=no])])])
712
713
714# Random special-cases for X on certain pathological OSes.
715# You know who you are.
716#
717AC_DEFUN([AC_X_RANDOM_PATHS],
718 [case "$host" in
719    *-hpux*)
720
721      # The following arcana was gleaned from conversations with
722      # Eric Schwartz <erics@col.hp.com>:
723      #
724      # On HPUX 10.x, the parts of X that HP considers "standard" live in
725      # /usr/{include,lib}/X11R6/.  The parts that HP doesn't consider
726      # "standard", notably, Xaw and Xmu, live in /usr/contrib/X11R6/.
727      # Yet /usr/contrib/X11R6/ comes preinstalled on all HPUX systems.
728      # Also, there are symlinks from /usr/include/ and /usr/lib/ into
729      # /usr/{include,lib}/X11R6/, so that (if you don't use Xmu at all)
730      # you don't need any -I or -L arguments.
731      #
732      # On HPUX 9.x, /usr/{include,lib}/X11R5/ and /usr/contrib/X11R5/
733      # are the same division as 10.x.  However, there are no symlinks to
734      # the X stuff from /usr/include/ and /usr/lib/, so -I and -L
735      # arguments are always necessary.
736      #
737      # However, X11R6 was available on HPUX 9.x as a patch: if that
738      # patch was installed, then all of X11R6 went in to
739      # /usr/contrib/X11R6/ (there was no /usr/{include,lib}/X11R6/.)
740      #
741      # HPUX 8.x was the same as 9.x, but was X11R4 instead (I don't know
742      # whether R5 was available as a patch; R6 undoubtedly was not.)
743      #
744      # So.  We try and use the highest numbered pair of
745      # /usr/{include,lib}/X11R?/ and /usr/contrib/X11R?/{include,lib}/
746      # that are available.  We do not mix and match different versions
747      # of X.
748      #
749      # Question I still don't know the answer to: (do you?)
750      #
751      #   * On HPUX 9.x, where /usr/include/X11R5/ was standard, and
752      #     /usr/contrib/X11R6/ could be installed as a patch, what was in
753      #     that contrib directory?  Did it contain so-called "standard"
754      #     X11R6, or did it include Xaw and Xmu as well?  If the former,
755      #     where did one find Xaw and Xmu on 9.x R6 systems?  Would this
756      #     be a situation where one had to reach into the R5 headers and
757      #     libs to find Xmu?  That is, must both R6 and R5 directories
758      #     be on the -I and -L lists in that case?
759      #
760      for version in X11R6 X11R5 X11R4 ; do
761        # if either pair of directories exists...
762        if test -d /usr/include/$version || test -d /usr/contrib/$version/include
763        then
764           # if contrib exists, use it...
765           if test -d /usr/contrib/$version/include ; then
766             X_CFLAGS="$X_CFLAGS -I/usr/contrib/$version/include"
767             X_LIBS="$X_LIBS -L/usr/contrib/$version/lib"
768           fi
769           # if the "standard" one exists, use it.
770           if test -d /usr/include/$version ; then
771             X_CFLAGS="$X_CFLAGS -I/usr/include/$version"
772             X_LIBS="$X_LIBS -L/usr/lib/$version"
773           fi
774           # since at least one of the pair exists, go no farther.
775           break
776        fi
777      done
778
779      # Now find Motif.  Thanks for not making xmkmf find this by
780      # default, you losers.
781      #
782      if test -d /usr/include/Motif2.1 ; then
783        X_CFLAGS="$X_CFLAGS -I/usr/include/Motif2.1"
784        X_LIBS="$X_LIBS -L/usr/lib/Motif2.1"
785      elif test -d /usr/include/Motif1.2 ; then
786        X_CFLAGS="$X_CFLAGS -I/usr/include/Motif1.2"
787        X_LIBS="$X_LIBS -L/usr/lib/Motif1.2"
788      elif test -d /usr/include/Motif1.1 ; then
789        X_CFLAGS="$X_CFLAGS -I/usr/include/Motif1.1"
790        X_LIBS="$X_LIBS -L/usr/lib/Motif1.1"
791      fi
792
793      # Now let's check for the pseudo-standard locations for OpenGL.
794      #
795      if test -d /opt/graphics/OpenGL/include ; then
796        # HP-UX 10.20 puts it here
797        X_CFLAGS="-I/opt/graphics/OpenGL/include $X_CFLAGS"
798        X_LIBS="-L/opt/graphics/OpenGL/lib $X_LIBS"
799      elif test -d /opt/Mesa/lib ; then
800        X_CFLAGS="-I/opt/Mesa/include $X_CFLAGS"
801        X_LIBS="-L/opt/Mesa/lib $X_LIBS"
802      fi
803
804
805      # On HPUX, default to installing in /opt/xscreensaver/ instead of
806      # in /usr/local/, unless there is already an xscreensaver in
807      # /usr/local/bin/.  This can be overridden with the --prefix arg
808      # to configure.  I'm not sure this is the right thing to do, but
809      # Richard Lloyd says so...
810      #
811      if test \! -x /usr/local/bin/xscreensaver ; then
812        ac_default_prefix=/opt/xscreensaver
813      fi
814
815    ;;
816    *-solaris*)
817
818      # Thanks for not making xmkmf find this by default, pinheads.
819      # And thanks for moving things around again, too.  Is this
820      # really the standard location now?  What happened to the
821      # joke that this kind of thing went in /opt?
822      # cthomp says "answer: CDE (Common Disorganized Environment)"
823      #
824      if test -f /usr/dt/include/Xm/Xm.h ; then
825        X_CFLAGS="$X_CFLAGS -I/usr/dt/include"
826        MOTIF_LIBS="$MOTIF_LIBS -L/usr/dt/lib -R/usr/dt/lib"
827
828        # Some versions of Slowlaris Motif require -lgen.  But not all.  Why?
829        AC_CHECK_LIB(gen, regcmp, [MOTIF_LIBS="$MOTIF_LIBS -lgen"])
830      fi
831
832    ;;
833    *-darwin*)
834
835      # MacPorts on macOS
836      if test -d /opt/local/include ; then
837        X_CFLAGS="-I/opt/local/include $X_CFLAGS"
838          X_LIBS="-L/opt/local/lib $X_LIBS"
839      fi
840
841      # Fink on macOS
842      if test -d /sw/include ; then
843        X_CFLAGS="-I/sw/include $X_CFLAGS"
844          X_LIBS="-L/sw/lib $X_LIBS"
845      fi
846
847      # Homebrew on macOS Intel
848      if test -d /usr/local/include ; then
849        X_CFLAGS="-I/usr/local/include $X_CFLAGS"
850          X_LIBS="-L/usr/local/lib $X_LIBS"
851      fi
852
853      # Homebrew on macOS ARM
854      if test -d /opt/homebrew/include ; then
855        X_CFLAGS="-I/opt/homebrew/include $X_CFLAGS"
856          X_LIBS="-L/opt/homebrew/lib $X_LIBS"
857      fi
858    ;;
859  esac])
860
861AC_DEFUN([AC_CHECK_GETIFADDRS],
862 [AC_CACHE_CHECK([for getifaddrs], ac_cv_have_getifaddrs,
863  [AC_COMPILE_IFELSE(
864    [AC_LANG_PROGRAM([#include <stdlib.h>
865                   #include <unistd.h>
866                   #include <arpa/inet.h>
867                   #include <ifaddrs.h>],
868                  [struct ifaddrs *ifa;
869                   getifaddrs (&ifa);
870                   ifa->ifa_next = 0;
871                   ifa->ifa_addr->sa_family = 0;])],
872    [ac_cv_have_getifaddrs=yes],
873    [ac_cv_have_getifaddrs=no])])
874 if test "$ac_cv_have_getifaddrs" = yes ; then
875   AC_DEFINE(HAVE_GETIFADDRS)
876 fi])
877
878AC_DEFUN([AC_TYPE_SOCKLEN_T],
879 [AC_CACHE_CHECK([for socklen_t], ac_cv_type_socklen_t,
880  [AC_COMPILE_IFELSE(
881    [AC_LANG_PROGRAM([
882      #include <sys/types.h>
883      #include <sys/socket.h>],
884     [socklen_t socklen;])],
885    [ac_cv_type_socklen_t=yes],
886    [ac_cv_type_socklen_t=no])])
887  if test "$ac_cv_type_socklen_t" != yes; then
888    AC_DEFINE(socklen_t, int,
889  [Define to `int' if <sys/types.h> or <sys/socket.h> does not define.])
890  fi])
891
892###############################################################################
893#
894#       Some utility functions to make checking for X things easier.
895#
896###############################################################################
897
898# Like AC_CHECK_HEADER, but it uses the already-computed -I directories.
899#
900AC_DEFUN([AC_CHECK_X_HEADER], [
901  ac_save_CPPFLAGS="$CPPFLAGS"
902  if test \! -z "$includedir" ; then
903    CPPFLAGS="$CPPFLAGS -I$includedir"
904  fi
905  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
906  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
907  AC_CHECK_HEADER([$1],[$2],[$3],[$4])
908  CPPFLAGS="$ac_save_CPPFLAGS"])
909
910# Like AC_EGREP_HEADER, but it uses the already-computed -I directories.
911#
912AC_DEFUN([AC_EGREP_X_HEADER], [
913  ac_save_CPPFLAGS="$CPPFLAGS"
914  if test \! -z "$includedir" ; then
915    CPPFLAGS="$CPPFLAGS -I$includedir"
916  fi
917  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
918  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
919  AC_EGREP_HEADER([$1], [$2], [$3], [$4])
920  CPPFLAGS="$ac_save_CPPFLAGS"])
921
922# Like AC_COMPILE_IFELSE but it uses the already-computed -I directories.
923#
924AC_DEFUN([AC_TRY_X_COMPILE], [
925  ac_save_CPPFLAGS="$CPPFLAGS"
926  if test \! -z "$includedir" ; then
927    CPPFLAGS="$CPPFLAGS -I$includedir"
928  fi
929  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
930  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
931  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$1], [$2])],[$3],[$4])
932  CPPFLAGS="$ac_save_CPPFLAGS"])
933
934
935# Like AC_CHECK_LIB, but it uses the already-computed -I and -L directories.
936# Use this sparingly; it probably doesn't work very well on X programs.
937#
938AC_DEFUN([AC_CHECK_X_LIB], [
939  ac_save_CPPFLAGS="$CPPFLAGS"
940  ac_save_LDFLAGS="$LDFLAGS"
941#  ac_save_LIBS="$LIBS"
942
943  if test \! -z "$includedir" ; then
944    CPPFLAGS="$CPPFLAGS -I$includedir"
945  fi
946  # note: $X_CFLAGS includes $x_includes
947  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
948
949  if test \! -z "$libdir" ; then
950    LDFLAGS="$LDFLAGS -L$libdir"
951  fi
952  # note: $X_LIBS includes $x_libraries
953  LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS"
954
955  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
956  LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS`
957  AC_CHECK_LIB([$1], [$2], [$3], [$4], [$5])
958  CPPFLAGS="$ac_save_CPPFLAGS"
959  LDFLAGS="$ac_save_LDFLAGS"
960#  LIBS="$ac_save_LIBS"
961  ])
962
963# Like AC_RUN_IFELSE but it uses the already-computed -I directories.
964# (But not the -L directories!)
965#
966AC_DEFUN([AC_TRY_X_RUN], [
967  ac_save_CPPFLAGS="$CPPFLAGS"
968  if test \! -z "$includedir" ; then
969    CPPFLAGS="$CPPFLAGS -I$includedir"
970  fi
971  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
972  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
973  AC_RUN_IFELSE([AC_LANG_SOURCE([$1])],[$2],[$3],[$4])
974  CPPFLAGS="$ac_save_CPPFLAGS"])
975
976
977
978# Usage: HANDLE_X_PATH_ARG([variable_name],
979#                          [--command-line-option],
980#                          [descriptive string])
981#
982# All of the --with options take three forms:
983#
984#   --with-foo (or --with-foo=yes)
985#   --without-foo (or --with-foo=no)
986#   --with-foo=/DIR
987#
988# This function, HANDLE_X_PATH_ARG, deals with the /DIR case.  When it sees
989# a directory (string beginning with a slash) it checks to see whether
990# /DIR/include and /DIR/lib exist, and adds them to $X_CFLAGS and $X_LIBS
991# as appropriate.
992#
993AC_DEFUN([HANDLE_X_PATH_ARG], [
994   case "$[$1]" in
995    yes) ;;
996    no)  ;;
997
998    /*)
999     AC_MSG_CHECKING([for [$3] headers])
1000     d=$[$1]/include
1001     if test -d $d; then
1002       X_CFLAGS="-I$d $X_CFLAGS"
1003       AC_MSG_RESULT($d)
1004     else
1005       AC_MSG_RESULT(not found ($d: no such directory))
1006     fi
1007
1008     AC_MSG_CHECKING([for [$3] libs])
1009     d=$[$1]/lib
1010     if test -d $d; then
1011       X_LIBS="-L$d $X_LIBS"
1012       AC_MSG_RESULT($d)
1013     else
1014       AC_MSG_RESULT(not found ($d: no such directory))
1015     fi
1016
1017     # replace the directory string with "yes".
1018     [$1]_req="yes"
1019     [$1]=$[$1]_req
1020     ;;
1021
1022    *)
1023     echo ""
1024     echo "error: argument to [$2] must be \"yes\", \"no\", or a directory."
1025     echo "       If it is a directory, then \`DIR/include' will be added to"
1026     echo "       the -I list, and \`DIR/lib' will be added to the -L list."
1027     exit 1
1028     ;;
1029   esac
1030  ])
1031
1032
1033###############################################################################
1034###############################################################################
1035#
1036#       End of function definitions.  Now start actually executing stuff.
1037#
1038###############################################################################
1039###############################################################################
1040
1041# Default $PATH might not contain /sbin and thus miss /sbin/setcap.
1042#
1043export PATH="$PATH:/usr/bin:/bin:/usr/sbin:/sbin"
1044
1045
1046# WTF!  autoconf emits this *way* too late.  Do it earlier.
1047test "x$prefix" = xNONE && prefix=$ac_default_prefix
1048test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
1049
1050# random compiler setup
1051AC_CANONICAL_HOST
1052
1053ac_original_cc=$CC
1054AC_PROG_CC
1055AC_PROG_CC_ANSI
1056AC_PROG_CPP
1057AC_C_CONST
1058AC_C_INLINE
1059AC_EXEEXT
1060
1061# stuff for Makefiles
1062AC_PROG_INSTALL
1063AC_PROG_INSTALL_DIRS
1064AC_PROG_MAKE_SET
1065
1066# By default, autoconf sets INSTALL_SCRIPT to '${INSTALL_PROGRAM}'.
1067# That's wrong: it should be set to '${INSTALL}', so that one can
1068# implement the "install-strip" target properly (strip executables,
1069# but do not try to strip scripts.)
1070#
1071INSTALL_SCRIPT='${INSTALL}'
1072
1073# random libc stuff
1074AC_CHECK_HEADERS(unistd.h inttypes.h)
1075AC_TYPE_MODE_T
1076AC_TYPE_PID_T
1077AC_TYPE_SIZE_T
1078AC_DEFINE_UNQUOTED([RETSIGTYPE],[void],[Return type of signal handlers])
1079AC_HEADER_SYS_WAIT
1080AC_HEADER_DIRENT
1081AC_GETTIMEOFDAY_ARGS
1082AC_SYS_LARGEFILE
1083AC_CHECK_FUNCS(select fcntl uname nice setpriority getcwd getwd putenv sbrk)
1084AC_CHECK_FUNCS(sigaction syslog realpath setrlimit)
1085AC_CHECK_FUNCS(setlocale sqrtf)
1086AC_CHECK_FUNCS(getaddrinfo)
1087AC_CHECK_MEMBERS([struct sockaddr.sa_len],,, [#include <sys/socket.h>])
1088AC_CHECK_ICMP
1089AC_CHECK_ICMPHDR
1090AC_CHECK_GETIFADDRS
1091AC_TYPE_SOCKLEN_T
1092AC_CHECK_HEADERS(crypt.h sys/select.h)
1093AC_PROG_PERL
1094
1095if test -z "$PERL" ; then
1096  # don't let it be blank...
1097  PERL=/usr/bin/perl
1098fi
1099
1100AC_PATH_XTRA
1101
1102if test "$have_x" != yes; then
1103  AC_MSG_ERROR(Couldn't find X11 headers/libs.  Try `$0 --help'.)
1104fi
1105
1106AC_X_RANDOM_PATHS
1107AC_XPOINTER
1108AC_XT
1109
1110
1111AC_MSG_CHECKING(whether this is macOS)
1112  ac_macosx=no
1113  ac_irix=no
1114  case "$host" in
1115    *-apple-darwin* )
1116      ac_macosx=yes
1117    ;;
1118    *-irix* )
1119      ac_irix=yes
1120    ;;
1121  esac
1122AC_MSG_RESULT($ac_macosx)
1123
1124
1125###############################################################################
1126#
1127#       pkg-config
1128#
1129###############################################################################
1130
1131AC_PATH_TOOL(pkg_config, pkg-config)
1132
1133if test -z "$pkg_config" ; then
1134  AC_MSG_WARN([pkg-config not found!])
1135  pkg_config="false"
1136fi
1137
1138
1139# Utility function for running pkg-config-based tests...
1140#
1141pkgs=''
1142pkg_check_version() {
1143  if test "$ok" = yes ; then
1144    req="$1"
1145    min="$2"
1146    AC_MSG_CHECKING(for $req)
1147    if $pkg_config --exists "$req" ; then
1148      vers=`$pkg_config --modversion "$req"`
1149      if $pkg_config --exists "$req >= $min" ; then
1150        AC_MSG_RESULT($vers)
1151        pkgs="$pkgs $req"
1152        return 1
1153      else
1154        AC_MSG_RESULT($vers (wanted >= $min))
1155        ok=no
1156        return 0
1157      fi
1158    else
1159      AC_MSG_RESULT(no)
1160      ok=no
1161      return 0
1162    fi
1163  fi
1164}
1165
1166
1167###############################################################################
1168#
1169#       Gettext support
1170#
1171###############################################################################
1172
1173# Wow, this is complete madness.  Why does po/Makefile.in.in exist??  Why does
1174# aclocal.m4 exist??  Why can't I upgrade it without everything breaking??
1175# This IT_PROG_INTLTOOL nonsense has so many self-modifying levels of insanity
1176# that it *must* have been written by RMS.  Or an equally demented protégé.
1177# Won't someone please have mercy on us all and write a normal po/Makefile.in
1178# that uses wildcards, and write a sane set of rules to detect gettext(3) and
1179# msgfmt(1) and just do the obviously straightforward thing?
1180
1181IT_PROG_INTLTOOL
1182GETTEXT_PACKAGE=xscreensaver
1183AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",
1184		   [This is the name of the gettext package to use.])
1185AC_SUBST(GETTEXT_PACKAGE)
1186
1187ALL_LINGUAS="da de es et fi fr hu it ja ko nb nl pl pt pt_BR ru sk sv vi wa zh_CN zh_TW"
1188AM_GLIB_GNU_GETTEXT
1189MKINSTALLDIRS="$INSTALL_DIRS"
1190
1191
1192###############################################################################
1193#
1194#       The --with-x-app-defaults option
1195#
1196###############################################################################
1197
1198#### H1
1199
1200AC_ARG_WITH(app-defaults,[
1201Installation Options:
1202
1203  --prefix=PREFIX         Install root of architecture-independent files.
1204  --exec-prefix=EPREFIX   Install root of architecture-dependent files.
1205  --with-app-defaults=DIR Where to install the default settings file.],
1206	[ac_cv_x_app_defaults="$withval"],
1207	[eval ac_x_app_defaults="$withval"])
1208AC_PATH_X_APP_DEFAULTS
1209
1210
1211###############################################################################
1212#
1213#       Handle the --with-hackdir option
1214#
1215###############################################################################
1216
1217have_hackdir=yes
1218with_hackdir_req=unspecified
1219AC_ARG_WITH(hackdir,
1220[  --with-hackdir=DIR      Where to install the hundreds of demo executables.],
1221  [with_hackdir="$withval"; with_hackdir_req="$withval"],[with_hackdir=yes])
1222
1223if test x"$with_hackdir" = xyes; then
1224  HACKDIR='${libexecdir}/xscreensaver'
1225elif test x"$with_hackdir" = xno; then
1226  HACKDIR='${bindir}'
1227else
1228  HACKDIR=$with_hackdir
1229fi
1230
1231# canonicalize slashes.
1232HACKDIR=`echo "${HACKDIR}" | sed 's@/$@@;s@//*@/@g'`
1233
1234# Expand HACKDIR as HACKDIR_FULL
1235HACKDIR_FULL=`eval eval eval eval eval eval eval eval eval echo $HACKDIR`
1236
1237# This option used to be called --enable-subdir; make sure that is no longer
1238# used, since configure brain-damagedly ignores unknown --enable options.
1239
1240obsolete_enable=
1241AC_ARG_ENABLE(subdir,,[obsolete_enable=yes])
1242if test -n "$obsolete_enable"; then
1243  echo "error: the --enable-subdir option has been replaced with"
1244  echo "       the new --with-hackdir option; see \`configure --help'"
1245  echo "       for more information."
1246  exit 1
1247fi
1248
1249
1250###############################################################################
1251#
1252#       Handle the --with-configdir option
1253#
1254###############################################################################
1255
1256have_configdir=yes
1257with_configdir_req=unspecified
1258AC_ARG_WITH(configdir,
1259[  --with-configdir=DIR    Where to install the GUI configuration files.],
1260  [with_configdir="$withval"; with_configdir_req="$withval"],
1261  [with_configdir=yes])
1262
1263if test x"$with_configdir" = xyes; then
1264  HACK_CONF_DIR='${datadir}/xscreensaver/config'
1265elif test x"$with_configdir" = xno; then
1266  echo "error: must be yes, or a pathname: --with-configdir=$with_configdir"
1267  exit 1
1268else
1269  # there must be a better way than this...
1270  if test -z "`echo $with_configdir | sed 's@^/.*@@'`" ; then
1271    # absolute path
1272    HACK_CONF_DIR=$with_configdir
1273  else
1274    # relative path
1275    HACK_CONF_DIR="\${exec_prefix}$with_configdir"
1276  fi
1277fi
1278
1279
1280
1281###############################################################################
1282#
1283#       Handle the --with-fontdir option
1284#
1285###############################################################################
1286
1287have_fontdir=yes
1288with_fontdir_req=unspecified
1289AC_ARG_WITH(fontdir,
1290[  --with-fontdir=DIR      Where to install the extra font files.],
1291  [with_fontdir="$withval"; with_fontdir_req="$withval"],
1292  [with_fontdir=yes])
1293
1294if test x"$with_fontdir" = xyes; then
1295  FONT_DIR='${datarootdir}/fonts/xscreensaver'
1296  if test "$ac_macosx" = yes; then
1297    FONT_DIR='/Library/Fonts'
1298  fi
1299elif test x"$with_fontdir" = xno; then
1300  FONT_DIR=''
1301else
1302  # there must be a better way than this...
1303  if test -z "`echo $with_fontdir | sed 's@^/.*@@'`" ; then
1304    # absolute path
1305    FONT_DIR="$with_fontdir"
1306  else
1307    # relative path
1308    FONT_DIR='${datarootdir}/fonts/'"$with_fontdir"
1309  fi
1310fi
1311
1312
1313
1314###############################################################################
1315#
1316#       Check for the DPMS server extension.
1317#
1318###############################################################################
1319
1320#### H1
1321
1322have_dpms=no
1323with_dpms_req=unspecified
1324AC_ARG_WITH(dpms-ext,
1325[
1326Server Extension Options:
1327
1328  --with-dpms-ext         Include support for power management.],
1329  [with_dpms="$withval"; with_dpms_req="$withval"],[with_dpms=yes])
1330
1331HANDLE_X_PATH_ARG(with_dpms, --with-dpms-ext, DPMS)
1332
1333if test "$with_dpms" = yes; then
1334
1335  # first check for dpms.h
1336  AC_CHECK_X_HEADER(X11/extensions/dpms.h, [have_dpms=yes],,
1337                    [#include <X11/Xlib.h>
1338		     #include <X11/Xmd.h>])
1339
1340  # if that succeeded, then check for the DPMS code in the libraries
1341  if test "$have_dpms" = yes; then
1342
1343    # first look in -lXext (this is where it is with XFree86 4.0)
1344    have_dpms=no
1345    AC_CHECK_X_LIB(Xext, DPMSInfo, [have_dpms=yes], [true], -lXext -lX11)
1346
1347    # if that failed, look in -lXdpms (this is where it was in XFree86 3.x)
1348    if test "$have_dpms" = no; then
1349      AC_CHECK_X_LIB(Xdpms, DPMSInfo,
1350                    [have_dpms=yes; XDPMS_LIBS="-lXdpms"], [true],
1351                    -lXext -lX11)
1352    fi
1353  fi
1354
1355
1356  # if that succeeded, then we've really got it.
1357  if test "$have_dpms" = yes; then
1358    AC_DEFINE(HAVE_DPMS_EXTENSION)
1359  fi
1360
1361elif test "$with_dpms" != no; then
1362  echo "error: must be yes or no: --with-dpms-ext=$with_dpms"
1363  exit 1
1364fi
1365
1366
1367###############################################################################
1368#
1369#       Check for the XF86VMODE server extension (for virtual screens.)
1370#
1371###############################################################################
1372
1373have_xf86vmode=no
1374with_xf86vmode_req=unspecified
1375AC_ARG_WITH(xf86vmode-ext,
1376[  --with-xf86vmode-ext    Include support for virtual screens.],
1377  [with_xf86vmode="$withval"; with_xf86vmode_req="$withval"],
1378  [with_xf86vmode=yes])
1379
1380HANDLE_X_PATH_ARG(with_xf86vmode, --with-xf86vmode-ext, xf86vmode)
1381
1382VIDMODE_LIBS=""
1383
1384if test "$with_xf86vmode" = yes; then
1385
1386  # first check for xf86vmode.h
1387  AC_CHECK_X_HEADER(X11/extensions/xf86vmode.h, [have_xf86vmode=yes],,
1388                    [#include <X11/Xlib.h>])
1389
1390  # if that succeeded, then check for the -lXxf86vm
1391  if test "$have_xf86vmode" = yes; then
1392    have_xf86vmode=no
1393    AC_CHECK_X_LIB(Xxf86vm, XF86VidModeGetViewPort,
1394                  [have_xf86vmode=yes;
1395                   VIDMODE_LIBS="-lXxf86vm";
1396                   SAVER_LIBS="$SAVER_LIBS $VIDMODE_LIBS"],
1397                   [true], -lXext -lX11)
1398  fi
1399
1400  # if that succeeded, then we've really got it.
1401  if test "$have_xf86vmode" = yes; then
1402    AC_DEFINE(HAVE_XF86VMODE)
1403  fi
1404
1405elif test "$with_xf86vmode" != no; then
1406  echo "error: must be yes or no: --with-xf86vmode-ext=$with_xf86vmode"
1407  exit 1
1408fi
1409
1410
1411###############################################################################
1412#
1413#       Check for the XINERAMA server extension.
1414#
1415###############################################################################
1416
1417have_xinerama=no
1418with_xinerama_req=unspecified
1419AC_ARG_WITH(xinerama-ext,
1420[  --with-xinerama-ext     Include support for multiple monitors.],
1421  [with_xinerama="$withval"; with_xinerama_req="$withval"],[with_xinerama=yes])
1422
1423HANDLE_X_PATH_ARG(with_xinerama, --with-xinerama-ext, XINERAMA)
1424
1425if test "$with_xinerama" = yes; then
1426
1427  # first check for Xinerama.h
1428  AC_CHECK_X_HEADER(X11/extensions/Xinerama.h, [have_xinerama=yes],,
1429                    [#include <X11/Xlib.h>])
1430
1431  # if that succeeded, then check for the XINERAMA code in the libraries
1432  if test "$have_xinerama" = yes; then
1433
1434    # first look in -lXext
1435    have_xinerama=no
1436    AC_CHECK_X_LIB(Xext, XineramaQueryScreens, [have_xinerama=yes], [true],
1437                  -lXext -lX11)
1438
1439    # if that failed, look in -lXinerama (this is where it is in XFree86 4.1.)
1440    if test "$have_xinerama" = no; then
1441      AC_CHECK_X_LIB(Xinerama, XineramaQueryScreens,
1442                     [have_xinerama=yes; XINERAMA_LIBS="-lXinerama"],
1443                     [true], -lXext -lX11)
1444    fi
1445  fi
1446
1447  # if that succeeded, then we've really got it.
1448  if test "$have_xinerama" = yes; then
1449    AC_DEFINE(HAVE_XINERAMA)
1450  fi
1451
1452elif test "$with_xinerama" != no; then
1453  echo "error: must be yes or no: --with-xinerama-ext=$with_xinerama"
1454  exit 1
1455fi
1456
1457
1458###############################################################################
1459#
1460#       Check for the RANDR (Resize and Rotate) server extension.
1461#
1462#       We need this to detect when the resolution of the desktop
1463#       has changed out from under us (this is a newer, different
1464#       mechanism than the XF86VMODE virtual viewports.)
1465#
1466###############################################################################
1467
1468have_randr=no
1469with_randr_req=unspecified
1470AC_ARG_WITH(randr-ext,
1471[  --with-randr-ext        Include support for multiple monitors.],
1472  [with_randr="$withval"; with_randr_req="$withval"],[with_randr=yes])
1473
1474HANDLE_X_PATH_ARG(with_randr, --with-randr-ext, RANDR)
1475
1476if test "$with_randr" = yes; then
1477
1478  # first check for Xrandr.h
1479  AC_CHECK_X_HEADER(X11/extensions/Xrandr.h, [have_randr=yes],,
1480                    [#include <X11/Xlib.h>])
1481
1482  # if that succeeded, then check for the XRR code in the libraries
1483  if test "$have_randr" = yes; then
1484
1485    # RANDR probably needs -lXrender
1486    xrender_libs=
1487    AC_CHECK_X_LIB(Xrender, XRenderSetSubpixelOrder,
1488                   [xrender_libs="-lXrender"], [true], -lXext -lX11)
1489
1490    # first look for RANDR in -lXext
1491    have_randr=no
1492    AC_CHECK_X_LIB(Xext, XRRGetScreenInfo,
1493                   [have_randr=yes; SAVER_LIBS="$SAVER_LIBS $xrender_libs"],
1494                   [true], $xrender_libs -lXext -lX11)
1495
1496    # if that failed, look in -lXrandr
1497    if test "$have_randr" = no; then
1498      AC_CHECK_X_LIB(Xrandr, XRRGetScreenInfo,
1499             [have_randr=yes; SAVER_LIBS="$SAVER_LIBS -lXrandr $xrender_libs"],
1500                     [true], $xrender_libs -lXext -lX11)
1501    fi
1502  fi
1503
1504  # if that succeeded, then we've really got it.
1505  if test "$have_randr" = yes; then
1506    AC_DEFINE(HAVE_RANDR)
1507
1508    # Now check for version 1.2 in the same libs.
1509    # Try to compile, since on macOS 10.5.7, headers are older than libs!
1510    AC_CACHE_CHECK([for XRRGetScreenResources], ac_cv_randr_12,
1511      [ac_cv_randr_12=no
1512       AC_TRY_X_COMPILE([#include <stdlib.h>
1513                         #include <X11/Xlib.h>
1514                         #include <X11/extensions/Xrandr.h>],
1515                        [XRRScreenResources *res =
1516                           XRRGetScreenResources (0, 0);],
1517                        [ac_cv_randr_12=yes],
1518                        [ac_cv_randr_12=no])])
1519    if test "$ac_cv_randr_12" = yes ; then
1520      AC_DEFINE(HAVE_RANDR_12)
1521    fi
1522#   AC_CHECK_X_LIB(c, XRRGetOutputInfo, [AC_DEFINE(HAVE_RANDR_12)],
1523#                  [true], $SAVER_LIBS)
1524  fi
1525
1526
1527elif test "$with_randr" != no; then
1528  echo "error: must be yes or no: --with-randr-ext=$with_randr"
1529  exit 1
1530fi
1531
1532
1533###############################################################################
1534#
1535#       Check for the XINPUT server extension.
1536#
1537###############################################################################
1538
1539have_xinput=no
1540with_xinput_req=unspecified
1541xinput_halfassed=no
1542AC_ARG_WITH(xinput-ext,
1543[  --with-xinput-ext       Include support for the XInput2 extension.],
1544  [with_xinput="$withval"; with_xinput_req="$withval"], [with_xinput=yes])
1545
1546HANDLE_X_PATH_ARG(with_xinput, --with-xinput-ext, XINPUT)
1547
1548if test "$with_xinput" = yes; then
1549
1550  # first check for Xinput2.h
1551  AC_CHECK_X_HEADER(X11/extensions/XInput2.h, [have_xinput=yes],,
1552                    [#include <X11/Xlib.h>])
1553
1554  # if that succeeded, then check for libXi
1555  if test "$have_xinput" = yes; then
1556    have_xinput=no
1557    xinput_halfassed=yes
1558    AC_CHECK_X_LIB(Xi, XISelectEvents,
1559                   [have_xinput=yes; xinput_halfassed=no;
1560                    SAVER_LIBS="$SAVER_LIBS -lXi"],
1561                   [true], -lXext -lX11)
1562  fi
1563
1564  # if that succeeded, then we've really got it.
1565  if test "$have_xinput" = yes; then
1566    AC_DEFINE(HAVE_XINPUT)
1567  fi
1568
1569elif test "$with_xinput" != no; then
1570  echo "error: must be yes or no: --with-xinput-ext=$with_xinput"
1571  exit 1
1572fi
1573
1574
1575###############################################################################
1576#
1577#       Check for the XF86VMODE server extension (for gamma fading.)
1578#
1579###############################################################################
1580
1581have_xf86gamma=no
1582have_xf86gamma_ramp=no
1583with_xf86gamma_req=unspecified
1584AC_ARG_WITH(xf86gamma-ext,
1585[  --with-xf86gamma-ext    Include support for XFree86 gamma fading.],
1586  [with_xf86gamma="$withval"; with_xf86gamma_req="$withval"],
1587  [with_xf86gamma=yes])
1588
1589HANDLE_X_PATH_ARG(with_xf86gamma, --with-xf86gamma-ext, xf86gamma)
1590
1591if test "$with_xf86gamma" = yes; then
1592
1593  # first check for xf86vmode.h, if we haven't already
1594  if test "$have_xf86vmode" = yes; then
1595    have_xf86gamma=yes
1596  else
1597    AC_CHECK_X_HEADER(X11/extensions/xf86vmode.h, [have_xf86gamma=yes],,
1598                      [#include <X11/Xlib.h>])
1599  fi
1600
1601  # if that succeeded, then check for the -lXxf86vm
1602  if test "$have_xf86gamma" = yes; then
1603    have_xf86gamma=no
1604    AC_CHECK_X_LIB(Xxf86vm, XF86VidModeSetGamma,
1605                  [have_xf86gamma=yes],
1606                   [true], -lXext -lX11)
1607  fi
1608
1609  # check for the Ramp versions of the functions too.
1610  if test "$have_xf86gamma" = yes; then
1611    have_xf86gamma_ramp=no
1612    AC_CHECK_X_LIB(Xxf86vm, XF86VidModeSetGammaRamp,
1613                  [have_xf86gamma_ramp=yes],
1614                   [true], -lXext -lX11)
1615  fi
1616
1617  # if those tests succeeded, then we've really got the functions.
1618  if test "$have_xf86gamma" = yes; then
1619    AC_DEFINE(HAVE_XF86VMODE_GAMMA)
1620  fi
1621
1622  if test "$have_xf86gamma_ramp" = yes; then
1623    AC_DEFINE(HAVE_XF86VMODE_GAMMA_RAMP)
1624  fi
1625
1626  # pull in the lib, if we haven't already
1627  if test "$have_xf86gamma" = yes -a "$have_xf86vmode" = no; then
1628    SAVER_LIBS="$SAVER_LIBS -lXxf86vm"
1629  fi
1630
1631elif test "$with_xf86gamma" != no; then
1632  echo "error: must be yes or no: --with-xf86gamma-ext=$with_xf86vmode"
1633  exit 1
1634fi
1635
1636
1637###############################################################################
1638#
1639#       Check for the XIDLE server extension.
1640#
1641###############################################################################
1642
1643have_xidle=no
1644with_xidle_req=unspecified
1645AC_ARG_WITH(xidle-ext,
1646[  --with-xidle-ext        Include support for the X11R5 XIDLE extension.],
1647  [with_xidle="$withval"; with_xidle_req="$withval"],[with_xidle=yes])
1648
1649HANDLE_X_PATH_ARG(with_xidle, --with-xidle-ext, XIDLE)
1650
1651if test "$with_xidle" = yes; then
1652  AC_CHECK_X_HEADER(X11/extensions/xidle.h,
1653                    [have_xidle=yes
1654                     AC_DEFINE(HAVE_XIDLE_EXTENSION)],,
1655                    [#include <X11/Xlib.h>])
1656elif test "$with_xidle" != no; then
1657  echo "error: must be yes or no: --with-xidle-ext=$with_xidle"
1658  exit 1
1659fi
1660
1661
1662###############################################################################
1663#
1664#       Check for the MIT-SCREEN-SAVER server extension.
1665#
1666###############################################################################
1667
1668have_mit=no
1669with_mit=no
1670with_mit_req=unspecified
1671#AC_ARG_WITH(mit-ext,
1672#[  --with-mit-ext          Include support for the MIT-SCREEN-SAVER extension.],
1673#  [with_mit="$withval"; with_mit_req="$withval"],[with_mit=no])
1674#HANDLE_X_PATH_ARG(with_mit, --with-mit-ext, MIT-SCREEN-SAVER)
1675
1676if test "$with_mit" = yes; then
1677  AC_CHECK_X_HEADER(X11/extensions/scrnsaver.h, [have_mit=yes],,
1678                    [#include <X11/Xlib.h>])
1679
1680  # Now check to see if it's really in the library; XF86Free-3.3 ships
1681  # scrnsaver.h, but doesn't include the code in libXext.a, the idiots!
1682  #
1683  if test "$have_mit" = yes; then
1684    AC_CHECK_X_LIB(Xext, XScreenSaverRegister, [true], [have_mit=no], -lm)
1685
1686    if test "$have_mit" = no; then
1687      # Fuck!  Looks like XF86Free-3.3 actually puts it in XExExt instead
1688      # of in Xext.  Thank you master, may I have another.
1689      AC_CHECK_X_LIB(XExExt, XScreenSaverRegister,
1690                     [have_mit=yes; SAVER_LIBS="$SAVER_LIBS -lXExExt"],
1691                     [true], -lX11 -lXext -lm)
1692    fi
1693
1694    if test "$have_mit" = no; then
1695      # Double fuck!  Looks like some versions of XFree86 (whichever version
1696      # it is that comes with RedHat Linux 2.0 -- I can't find a version
1697      # number) put this garbage in Xss instead of Xext.  Thank you master,
1698      #  may I have another.
1699      AC_CHECK_X_LIB(Xss, XScreenSaverRegister,
1700                     [have_mit=yes; SAVER_LIBS="$SAVER_LIBS -lXss"],
1701                     [true], -lX11 -lXext -lm)
1702    fi
1703
1704    if test "$have_mit" = yes; then
1705#     AC_DEFINE(HAVE_MIT_SAVER_EXTENSION)
1706      echo "Using the MIT-SCREEN-SAVER extension will crash your server. Don't."
1707      exit 1
1708    fi
1709
1710  fi
1711
1712elif test "$with_mit" != no; then
1713  echo "error: must be yes or no: --with-mit-ext=$with_mit"
1714  exit 1
1715fi
1716
1717
1718###############################################################################
1719#
1720#       Check for the SGI SCREEN_SAVER server extension.
1721#
1722###############################################################################
1723
1724have_sgi=no
1725with_sgi_req=unspecified
1726AC_ARG_WITH(sgi-ext,
1727[  --with-sgi-ext          Include support for the SGI SCREEN_SAVER extension.],
1728  [with_sgi="$withval"; with_sgi_req="$withval"],[with_sgi=$ac_irix])
1729
1730HANDLE_X_PATH_ARG(with_sgi, --with-sgi-ext, SGI SCREEN_SAVER)
1731
1732if test "$with_sgi" = yes; then
1733  AC_CHECK_X_HEADER(X11/extensions/XScreenSaver.h,
1734                    [have_sgi=yes
1735                     AC_DEFINE(HAVE_SGI_SAVER_EXTENSION)],,
1736                    [#include <X11/Xlib.h>])
1737
1738elif test "$with_sgi" != no; then
1739  echo "error: must be yes or no: --with-sgi-ext=$with_sgi"
1740  exit 1
1741fi
1742
1743
1744###############################################################################
1745#
1746#       Check for the SGI-VIDEO-CONTROL server extension.
1747#
1748###############################################################################
1749
1750have_sgivc=no
1751with_sgivc_req=unspecified
1752AC_ARG_WITH(sgivc-ext,
1753[  --with-sgivc-ext        Include support for the SGI-VIDEO-CONTROL extension.],
1754  [with_sgivc="$withval"; with_sgivc_req="$withval"],[with_sgivc=$ac_irix])
1755
1756HANDLE_X_PATH_ARG(with_sgivc, --with-sgivc-ext, SGI-VIDEO-CONTROL)
1757
1758if test "$with_sgivc" = yes; then
1759
1760  # first check for XSGIvc.h
1761  AC_CHECK_X_HEADER(X11/extensions/XSGIvc.h, [have_sgivc=yes],,
1762                    [#include <X11/Xlib.h>])
1763
1764  # if that succeeded, then check for the -lXsgivc
1765  if test "$have_sgivc" = yes; then
1766    have_sgivc=no
1767    AC_CHECK_X_LIB(Xsgivc, XSGIvcQueryGammaMap,
1768                  [have_sgivc=yes; SAVER_LIBS="$SAVER_LIBS -lXsgivc"], [true],
1769                  -lXext -lX11)
1770  fi
1771
1772  # if that succeeded, then we've really got it.
1773  if test "$have_sgivc" = yes; then
1774    AC_DEFINE(HAVE_SGI_VC_EXTENSION)
1775  fi
1776
1777elif test "$with_sgivc" != no; then
1778  echo "error: must be yes or no: --with-sgivc-ext=$with_sgivc"
1779  exit 1
1780fi
1781
1782
1783###############################################################################
1784#
1785#       Check for the SGI XReadDisplay server extension.
1786#
1787###############################################################################
1788
1789have_readdisplay=no
1790with_readdisplay_req=unspecified
1791AC_ARG_WITH(readdisplay,
1792[  --with-readdisplay      Include support for the SGI XReadDisplay extension.],
1793  [with_readdisplay="$withval"; with_readdisplay_req="$withval"],
1794  [with_readdisplay=$ac_irix])
1795
1796HANDLE_X_PATH_ARG(with_readdisplay, --with-readdisplay, XReadDisplay)
1797
1798if test "$with_readdisplay" = yes; then
1799  AC_CHECK_X_HEADER(X11/extensions/readdisplay.h,
1800                    AC_DEFINE(HAVE_READ_DISPLAY_EXTENSION),,
1801                    [#include <X11/Xlib.h>])
1802elif test "$with_readdisplay" != no; then
1803  echo "error: must be yes or no: --with-readdisplay=$with_readdisplay"
1804  exit 1
1805fi
1806
1807
1808###############################################################################
1809#
1810#       Check for the XSHM server extension.
1811#
1812###############################################################################
1813
1814have_xshm=no
1815with_xshm_req=unspecified
1816AC_ARG_WITH(xshm-ext,
1817[  --with-xshm-ext         Include support for the Shared Memory extension.],
1818  [with_xshm="$withval"; with_xshm_req="$withval"],[with_xshm=yes])
1819
1820HANDLE_X_PATH_ARG(with_xshm, --with-xshm-ext, XSHM)
1821
1822if test "$with_xshm" = yes; then
1823
1824  # first check for Xshm.h.
1825  AC_CHECK_X_HEADER(X11/extensions/XShm.h, [have_xshm=yes],,
1826                    [#include <X11/Xlib.h>])
1827
1828  # if that succeeded, then check for sys/ipc.h.
1829  if test "$have_xshm" = yes; then
1830    have_xshm=no
1831    AC_CHECK_X_HEADER(sys/ipc.h, [have_xshm=yes])
1832  fi
1833
1834  # if that succeeded, then check for sys/shm.h.
1835  if test "$have_xshm" = yes; then
1836    have_xshm=no
1837    AC_CHECK_X_HEADER(sys/shm.h, [have_xshm=yes])
1838  fi
1839
1840  # AIX is pathological, as usual: apparently it's normal for the Xshm headers
1841  # to exist, but the library code to not exist.  And even better, the library
1842  # code is in its own library: libXextSam.a.  So, if we're on AIX, and that
1843  # lib doesn't exist, give up.  (This lib gets added to X_EXTRA_LIBS, and
1844  # that's not quite right, but close enough.)
1845  #
1846  case "$host" in
1847    *-aix*)
1848      if [ `uname -v` -eq 3 ]; then
1849        have_xshm=no
1850        AC_CHECK_X_LIB(XextSam, XShmQueryExtension,
1851                       [have_xshm=yes; X_EXTRA_LIBS="$X_EXTRA_LIBS -lXextSam"],
1852                       [true], -lX11 -lXext -lm)
1853      fi
1854    ;;
1855  esac
1856
1857  # if that succeeded, then we've really got it.
1858  if test "$have_xshm" = yes; then
1859    AC_DEFINE(HAVE_XSHM_EXTENSION)
1860  fi
1861
1862elif test "$with_xshm" != no; then
1863  echo "error: must be yes or no: --with-xshm-ext=$with_xshm"
1864  exit 1
1865fi
1866
1867
1868###############################################################################
1869#
1870#       Check for the DOUBLE-BUFFER server extension.
1871#
1872###############################################################################
1873
1874have_xdbe=no
1875with_xdbe_req=unspecified
1876AC_ARG_WITH(xdbe-ext,
1877[  --with-xdbe-ext         Include support for the DOUBLE-BUFFER extension.],
1878  [with_xdbe="$withval"; with_xdbe_req="$withval"],[with_xdbe=yes])
1879
1880HANDLE_X_PATH_ARG(with_xdbe, --with-xdbe-ext, DOUBLE-BUFFER)
1881
1882if test "$with_xdbe" = yes; then
1883
1884  AC_CHECK_X_HEADER(X11/extensions/Xdbe.h, [have_xdbe=yes],,
1885                    [#include <X11/Xlib.h>])
1886  if test "$have_xdbe" = yes; then
1887    AC_DEFINE(HAVE_DOUBLE_BUFFER_EXTENSION)
1888  fi
1889
1890elif test "$with_xdbe" != no; then
1891  echo "error: must be yes or no: --with-xdbe-ext=$with_xshm"
1892  exit 1
1893fi
1894
1895
1896###############################################################################
1897#
1898#       Check for the COMPOSITE server extension.
1899#
1900###############################################################################
1901
1902#have_xcomposite=no
1903#with_xcomposite_req=unspecified
1904#AC_ARG_WITH(xcomposite-ext,
1905#[  --with-xcomposite-ext   Include support for the XCOMPOSITE extension.],
1906#  [with_xcomposite="$withval"; with_xcomposite_req="$withval"],
1907#  [with_xcomposite=yes])
1908#
1909#HANDLE_X_PATH_ARG(with_xcomposite, --with-xcomposite-ext, XCOMPOSITE)
1910#
1911#if test "$with_xcomposite" = yes; then
1912#
1913#  AC_CHECK_X_HEADER(X11/extensions/Xcomposite.h, [have_xcomposite=yes],,
1914#                    [#include <X11/Xlib.h>])
1915#  if test "$have_xcomposite" = yes; then
1916#    AC_DEFINE(HAVE_XCOMPOSITE_EXTENSION)
1917#    SAVER_LIBS="-lXcomposite $SAVER_LIBS"
1918#  fi
1919#
1920#elif test "$with_xcomposite" != no; then
1921#  echo "error: must be yes or no: --with-xcomposite-ext=$with_xshm"
1922#  exit 1
1923#fi
1924
1925
1926###############################################################################
1927#
1928#       Check for the XKB server extension.
1929#
1930###############################################################################
1931
1932have_xkb=no
1933with_xkb_req=unspecified
1934AC_ARG_WITH(xkb-ext,
1935[  --with-xkb-ext          Include support for the X Keyboard extension.],
1936  [with_xkb="$withval"; with_xkb_req="$withval"],
1937  [with_xkb=yes])
1938
1939HANDLE_X_PATH_ARG(with_xkb, --with-xkb-ext, XKB)
1940
1941if test "$with_xkb" = yes; then
1942
1943  AC_CHECK_X_HEADER(X11/XKBlib.h, [have_xkb=yes],,
1944                    [#include <X11/Xlib.h>])
1945  if test "$have_xkb" = yes; then
1946    AC_DEFINE(HAVE_XKB)
1947  fi
1948
1949elif test "$with_xkb" != no; then
1950  echo "error: must be yes or no: --with-xkb-ext=$with_xshm"
1951  exit 1
1952fi
1953
1954
1955###############################################################################
1956#
1957#       Check for HP XHPDisableReset and XHPEnableReset.
1958#
1959###############################################################################
1960
1961AC_MSG_CHECKING([for XHPDisableReset in X11/XHPlib.h])
1962AC_EGREP_X_HEADER(XHPDisableReset, X11/XHPlib.h,
1963                  [AC_DEFINE(HAVE_XHPDISABLERESET)
1964                   SAVER_LIBS="-lXhp11 $SAVER_LIBS"
1965                   AC_MSG_RESULT(yes)],
1966                  [AC_MSG_RESULT(no)])
1967
1968
1969###############################################################################
1970#
1971#       Check for /proc/interrupts.
1972#
1973###############################################################################
1974
1975have_proc_interrupts=no
1976with_proc_interrupts_req=unspecified
1977AC_ARG_WITH(proc-interrupts,
1978[  --with-proc-interrupts  Include support for consulting /proc/interrupts to
1979                          notice activity on PS/2 keyboards and mice.],
1980  [with_proc_interrupts="$withval"; with_proc_interrupts_req="$withval"],
1981  [with_proc_interrupts=no])
1982
1983if test "$with_proc_interrupts" = yes; then
1984
1985  # Note that we may be building in an environment (e.g. Debian buildd chroot)
1986  # without a proper /proc filesystem. If /proc/interrupts exists, then we'll
1987  # check that it has the bits we need, but otherwise we'll just go on faith.
1988  #
1989  have_proc_interrupts=yes
1990
1991  if test -f /proc/interrupts; then
1992   AC_CACHE_CHECK([whether /proc/interrupts contains keyboard data],
1993    ac_cv_have_proc_interrupts,
1994    [ac_cv_have_proc_interrupts=no
1995     if grep 'keyboard\|i8042' /proc/interrupts >/dev/null 2>&1 ; then
1996       ac_cv_have_proc_interrupts=yes
1997     fi
1998    ])
1999   have_proc_interrupts=$ac_cv_have_proc_interrupts
2000  fi
2001
2002  if test "$have_proc_interrupts" = yes; then
2003    AC_DEFINE(HAVE_PROC_INTERRUPTS)
2004  fi
2005
2006elif test "$with_proc_interrupts" != no; then
2007  echo "error: must be yes or no: --with-proc-interrupts=$with_proc_interrupts"
2008  exit 1
2009fi
2010
2011
2012###############################################################################
2013#
2014#       Check for /proc/*/oom_score_adj.
2015#
2016###############################################################################
2017
2018setuid_auth=no
2019have_proc_oom=no
2020with_proc_oom_req=unspecified
2021AC_ARG_WITH(proc-oom,
2022[  --with-proc-oom         Include support to duck the out-of-memory killer.],
2023  [with_proc_oom="$withval"; with_proc_oom_req="$withval"],
2024  [with_proc_oom=yes])
2025
2026if test "$with_proc_oom_req" = yes; then
2027
2028  # Note that we may be building in an environment (e.g. Debian buildd chroot)
2029  # without a proper /proc filesystem.
2030  #
2031  have_proc_oom=yes
2032  AC_DEFINE(HAVE_PROC_OOM)
2033
2034elif test "$with_proc_oom_req" = unspecified; then
2035
2036  have_proc_oom=no
2037  AC_CACHE_CHECK([whether /proc/$$/oom_score_adj exists],
2038    ac_cv_have_proc_oom,
2039    [ac_cv_have_proc_oom=no
2040     if test -f /proc/$$/oom_score_adj; then
2041       ac_cv_have_proc_oom=yes
2042     fi
2043    ])
2044  have_proc_oom=$ac_cv_have_proc_oom
2045
2046  if test "$have_proc_oom" = yes; then
2047    AC_DEFINE(HAVE_PROC_OOM)
2048    # Only root can write to /proc/$$/oom_score_adj, even though it's us.
2049    AC_MSG_RESULT(enabling setuid to opt out of OOM-killer.)
2050    setuid_auth=yes
2051  fi
2052
2053elif test "$with_proc_oom" != no; then
2054  echo "error: must be yes or no: --with-proc-oom=$with_proc_oom"
2055  exit 1
2056fi
2057
2058
2059###############################################################################
2060#
2061#       Check for -lsystemd
2062#
2063###############################################################################
2064
2065have_systemd=no
2066with_systemd_req=unspecified
2067systemd_halfassed=no
2068systemd_too_old=no
2069AC_ARG_WITH(systemd,
2070[  --with-systemd          Support systemd requests to lock on suspend, and to
2071                          allow video players to inhibit the screen saver.],
2072  [with_systemd="$withval"; with_systemd_req="$withval"],
2073  [with_systemd=yes])
2074
2075HANDLE_X_PATH_ARG(with_systemd, --with-systemd, systemd)
2076
2077if test "$with_systemd" != yes -a "$with_systemd" != no ; then
2078  echo "error: must be yes or no: --with-systemd=$with_systemd"
2079  exit 1
2080fi
2081
2082if test "$with_systemd" = yes; then
2083
2084  pkgs=''
2085  ok="yes"
2086  pkg_check_version libsystemd 221
2087  have_systemd="$ok"
2088
2089  if test "$have_systemd" = no; then
2090    if $pkg_config --exists libsystemd ; then
2091      systemd_too_old=yes
2092    fi
2093  fi
2094
2095  if test "$have_systemd" = yes; then
2096    AC_CACHE_CHECK([for libsystemd includes], ac_cv_systemd_config_cflags,
2097               [ac_cv_systemd_config_cflags=`$pkg_config --cflags $pkgs`])
2098    AC_CACHE_CHECK([for libsystemd libs], ac_cv_systemd_config_libs,
2099               [ac_cv_systemd_config_libs=`$pkg_config --libs $pkgs`])
2100  fi
2101
2102  ac_systemd_config_cflags=$ac_cv_systemd_config_cflags
2103  ac_systemd_config_libs=$ac_cv_systemd_config_libs
2104
2105  if test "$have_systemd" = yes; then
2106    #
2107    # we appear to have libsystemd; check for headers/libs to be sure.
2108    #
2109    ac_save_systemd_CPPFLAGS="$CPPFLAGS"
2110    CPPFLAGS="$CPPFLAGS $ac_systemd_config_cflags"
2111
2112    have_systemd=no
2113    AC_CHECK_X_HEADER(systemd/sd-bus.h, [have_systemd=yes])
2114
2115    CPPFLAGS="$ac_save_systemd_CPPFLAGS"
2116  fi
2117
2118  if test "$have_systemd" = yes; then
2119    # we have the headers, now check for the libraries
2120    have_systemd=no
2121    systemd_halfassed=yes
2122    AC_MSG_RESULT(checking for libsystemd usability...)
2123    AC_CHECK_X_LIB(c, sd_bus_open_system,
2124                   [have_systemd=yes; systemd_halfassed=no],,
2125                   $ac_systemd_config_libs -lX11 -lXext -lm)
2126  fi
2127
2128  if test "$have_systemd" = no; then
2129    AC_MSG_RESULT(checking for libsystemd usability... no)
2130  fi
2131fi
2132
2133if test "$have_systemd" = yes; then
2134  INCLUDES="$INCLUDES $ac_systemd_config_cflags"
2135  EXES_SYSTEMD='$(EXES_SYSTEMD)'
2136  SYSTEMD_LIBS="$ac_systemd_config_libs"
2137  AC_DEFINE(HAVE_LIBSYSTEMD)
2138else
2139  EXES_SYSTEMD=''
2140  SYSTEMD_LIBS=''
2141fi
2142
2143
2144###############################################################################
2145#
2146#       Check for -lelogind, a stripped down subset of systemd.
2147#
2148###############################################################################
2149
2150have_elogind=no
2151with_elogind_req=unspecified
2152elogind_halfassed=no
2153elogind_too_old=no
2154AC_ARG_WITH(elogind,
2155[  --with-elogind          Use elogind instead of systemd.],
2156  [with_elogind="$withval"; with_elogind_req="$withval"],
2157  [with_elogind=yes])
2158
2159HANDLE_X_PATH_ARG(with_elogind, --with-elogind, elogind)
2160
2161if test "$with_elogind" != yes -a "$with_elogind" != no ; then
2162  echo "error: must be yes or no: --with-elogind=$with_elogind"
2163  exit 1
2164fi
2165
2166if test "$with_elogind" = yes; then
2167
2168  pkgs=''
2169  ok="yes"
2170  pkg_check_version libelogind 221
2171  have_elogind="$ok"
2172
2173  if test "$have_elogind" = no; then
2174    if $pkg_config --exists libelogind ; then
2175      elogind_too_old=yes
2176    fi
2177  fi
2178
2179  if test "$have_elogind" = yes; then
2180    AC_CACHE_CHECK([for libelogind includes], ac_cv_elogind_config_cflags,
2181               [ac_cv_elogind_config_cflags=`$pkg_config --cflags $pkgs`])
2182    AC_CACHE_CHECK([for libelogind libs], ac_cv_elogind_config_libs,
2183               [ac_cv_elogind_config_libs=`$pkg_config --libs $pkgs`])
2184  fi
2185
2186  ac_elogind_config_cflags=$ac_cv_elogind_config_cflags
2187  ac_elogind_config_libs=$ac_cv_elogind_config_libs
2188
2189  if test "$have_elogind" = yes; then
2190    #
2191    # we appear to have libelogind; check for headers/libs to be sure.
2192    #
2193    ac_save_elogind_CPPFLAGS="$CPPFLAGS"
2194    CPPFLAGS="$CPPFLAGS $ac_elogind_config_cflags"
2195
2196    have_elogind=no
2197    AC_CHECK_X_HEADER(elogind/sd-bus.h, [have_elogind=yes])
2198
2199    CPPFLAGS="$ac_save_elogind_CPPFLAGS"
2200  fi
2201
2202  if test "$have_elogind" = yes; then
2203    # we have the headers, now check for the libraries
2204    have_elogind=no
2205    elogind_halfassed=yes
2206    AC_MSG_RESULT(checking for libelogind usability...)
2207    AC_CHECK_X_LIB(c, sd_bus_open_system,
2208                   [have_elogind=yes; elogind_halfassed=no],,
2209                   $ac_elogind_config_libs -lX11 -lXext -lm)
2210  fi
2211
2212  if test "$have_elogind" = no; then
2213    AC_MSG_RESULT(checking for libelogind usability... no)
2214  fi
2215fi
2216
2217if test "$have_elogind" = yes; then
2218  INCLUDES="$INCLUDES $ac_elogind_config_cflags"
2219  EXES_SYSTEMD='$(EXES_SYSTEMD)'
2220  SYSTEMD_LIBS="$ac_elogind_config_libs"
2221  AC_DEFINE(HAVE_LIBELOGIND)
2222fi
2223
2224
2225###############################################################################
2226#
2227#       The --enable-locking option
2228#
2229#	Note: "configure --help" list all "--enable" options before any
2230#	"--with" options, so we document the --enable options inline with
2231#	the --with options where it looks better, instead of in AC_ARG_ENABLE
2232#	where it would make sense, sigh...
2233#
2234###############################################################################
2235
2236AC_ARG_ENABLE(locking,
2237[],  # This is documented elsewhere because of --enable/--with option sorting.
2238  [enable_locking="$enableval"],
2239  [if test "$ac_macosx" = yes; then
2240    # We can't lock on macOS, so default to not compiling in support for it.
2241    # But allow --enable-locking to override that, so I can debug Linux locking
2242    # under macOS X11.
2243    enable_locking=no
2244   else
2245    enable_locking=yes
2246   fi])
2247if test "$enable_locking" = yes; then
2248  true
2249elif test "$enable_locking" = no; then
2250  AC_DEFINE(NO_LOCKING)
2251else
2252  echo "error: must be yes or no: --enable-locking=$enable_locking"
2253  exit 1
2254fi
2255
2256
2257##############################################################################
2258#
2259#       Whether to allow root password to unblank.
2260#
2261###############################################################################
2262
2263AC_ARG_ENABLE(root-passwd,
2264[],  # This is documented elsewhere because of --enable/--with option sorting.
2265  [enable_root_passwd="$enableval"],[enable_root_passwd=no])
2266if test "$enable_root_passwd" = yes; then
2267  AC_DEFINE(ALLOW_ROOT_PASSWD)
2268  true
2269elif test "$enable_root_passwd" != no; then
2270  echo "error: must be yes or no: --enable-root-passwd=$enable_root_passwd"
2271  exit 1
2272fi
2273
2274
2275###############################################################################
2276#
2277#       Check for PAM.
2278#
2279###############################################################################
2280
2281case "$host" in
2282  *-solaris*)
2283   # Solaris systems tend to have the PAM runtime misconfigured and unusable.
2284   with_pam_default=no
2285   ;;
2286  *-freebsd* )
2287   # FreeBSD's PAM implementation requires the calling process to be setuid
2288   # the whole time, which is unacceptable.
2289   with_pam_default=no
2290   ;;
2291  *)
2292   # Default to building PAM support on all other systems, if it exists.
2293   with_pam_default=yes
2294  ;;
2295esac
2296
2297#### H1
2298
2299have_pam=no
2300with_pam_req=unspecified
2301
2302AC_ARG_WITH(pam,[
2303Screen Locking Options:
2304
2305  --disable-locking       Do not allow locking of the display at all.
2306  --with-pam              Include support for PAM (Pluggable Auth Modules).],
2307  [with_pam="$withval"; with_pam_req="$withval"],[with_pam=$with_pam_default])
2308
2309AC_ARG_WITH([pam_service_name],
2310[  --with-pam-service-name Set the name of the xscreensaver PAM service.
2311  --enable-pam-account    Whether PAM should check the result of account
2312	    		  modules when authenticating.  Only do this if you
2313	    		  have "account" modules configured on your system.
2314  --enable-root-passwd	  Allow the root passwd to unlock, if not using PAM.],
2315  [pam_service_name="$withval"],[pam_service_name="xscreensaver"])
2316
2317AC_ARG_ENABLE(pam-check-account-type,
2318[],  # This is documented elsewhere because of --enable/--with option sorting.
2319  [enable_pam_check_account_type="$enableval"],[enable_pam_check_account_type=no])
2320if test "$enable_pam_check_account_type" = yes ; then
2321  AC_DEFINE(PAM_CHECK_ACCOUNT_TYPE)
2322  true
2323elif test "$enable_pam_check_account_type" != no ; then
2324  echo "error: must be yes or no: --enable-pam-check-account-type=$enable_pam_check_account_type"
2325  exit 1
2326fi
2327
2328HANDLE_X_PATH_ARG(with_pam, --with-pam, PAM)
2329
2330if test "$enable_locking" = yes -a "$with_pam" = yes; then
2331  AC_CACHE_CHECK([for PAM], ac_cv_pam,
2332                 [AC_TRY_X_COMPILE([#include <security/pam_appl.h>],,
2333                                   [ac_cv_pam=yes],
2334                                   [ac_cv_pam=no])])
2335  if test "$ac_cv_pam" = yes ; then
2336    have_pam=yes
2337    AC_DEFINE(HAVE_PAM)
2338    AC_DEFINE_UNQUOTED(PAM_SERVICE_NAME,"$pam_service_name")
2339
2340    PASSWD_LIBS="${PASSWD_LIBS} -lpam"
2341
2342    # libpam typically requires dlopen and dlsym.  On FreeBSD,
2343    # those are in libc.  On Linux and Solaris, they're in libdl.
2344    AC_CHECK_LIB(dl, dlopen, [PASSWD_LIBS="${PASSWD_LIBS} -ldl"])
2345
2346    # On Linux, sigtimedwait() is in libc; on Solaris, it's in librt.
2347    have_timedwait=no
2348    AC_CHECK_LIB(c, sigtimedwait,
2349                 [have_timedwait=yes
2350                  AC_DEFINE(HAVE_SIGTIMEDWAIT)])
2351    if test "$have_timedwait" = no ; then
2352      AC_CHECK_LIB(rt, sigtimedwait, [have_timedwait=yes
2353                                      AC_DEFINE(HAVE_SIGTIMEDWAIT)
2354                                      PASSWD_LIBS="${PASSWD_LIBS} -lrt"])
2355    fi
2356
2357    AC_MSG_CHECKING(how to call pam_strerror)
2358    AC_CACHE_VAL(ac_cv_pam_strerror_args,
2359     [AC_TRY_X_COMPILE([#include <stdio.h>
2360                        #include <stdlib.h>
2361                        #include <security/pam_appl.h>],
2362                       [pam_handle_t *pamh = 0;
2363                        char *s = pam_strerror(pamh, PAM_SUCCESS);],
2364                       [ac_pam_strerror_args=2],
2365                       [AC_TRY_X_COMPILE([#include <stdio.h>
2366                                          #include <stdlib.h>
2367                                          #include <security/pam_appl.h>],
2368                                         [char *s =
2369                                           pam_strerror(PAM_SUCCESS);],
2370                                         [ac_pam_strerror_args=1],
2371                                         [ac_pam_strerror_args=0])])
2372      ac_cv_pam_strerror_args=$ac_pam_strerror_args])
2373    ac_pam_strerror_args=$ac_cv_pam_strerror_args
2374    if test "$ac_pam_strerror_args" = 1 ; then
2375      AC_MSG_RESULT(one argument)
2376    elif test "$ac_pam_strerror_args" = 2 ; then
2377      AC_DEFINE(PAM_STRERROR_TWO_ARGS)
2378      AC_MSG_RESULT(two arguments)
2379    else
2380      AC_MSG_RESULT(unknown)
2381    fi
2382
2383# Check pam_fail_delay
2384    AC_MSG_CHECKING(pam_fail_delay in -lpam)
2385    AC_CACHE_VAL(ac_cv_pam_fail_delay,
2386     [ac_save_LDFLAGS="$LDFLAGS"
2387      LDFLAGS="-lpam"
2388      AC_LINK_IFELSE(
2389        [AC_LANG_PROGRAM([#include <security/pam_appl.h>],
2390                         [pam_handle_t *pamh = 0;
2391		   unsigned int usec = 1;
2392		   int status = pam_fail_delay (pamh, usec);])],
2393        [ac_pam_fail_delay=yes],
2394        [ac_pam_fail_delay=no])
2395      ac_cv_pam_fail_delay=$ac_pam_fail_delay,
2396      LDFLAGS=$ac_save_LDFLAGS])
2397
2398      if test "$ac_pam_fail_delay" = yes ; then
2399        AC_MSG_RESULT(yes)
2400        AC_DEFINE(HAVE_PAM_FAIL_DELAY)
2401      else
2402        AC_MSG_RESULT(no)
2403      fi
2404
2405  fi
2406fi
2407
2408
2409###############################################################################
2410#
2411#       Check for Kerberos.
2412#
2413###############################################################################
2414
2415have_kerberos=no
2416have_kerberos5=no
2417with_kerberos_req=unspecified
2418
2419AC_ARG_WITH(kerberos,
2420[  --with-kerberos         Include support for Kerberos authentication.],
2421  [with_kerberos="$withval"; with_kerberos_req="$withval"],[with_kerberos=yes])
2422
2423HANDLE_X_PATH_ARG(with_kerberos, --with-kerberos, Kerberos)
2424
2425if test "$enable_locking" = yes -a "$with_kerberos" = yes; then
2426  AC_CACHE_CHECK([for Kerberos 4], ac_cv_kerberos,
2427                 [AC_TRY_X_COMPILE([#include <krb.h>],,
2428                                   [ac_cv_kerberos=yes],
2429                                   [ac_cv_kerberos=no])])
2430  AC_CACHE_CHECK([for Kerberos 5], ac_cv_kerberos5,
2431                 [AC_TRY_X_COMPILE([#include <kerberosIV/krb.h>],,
2432                                   [ac_cv_kerberos5=yes],
2433                                   [ac_cv_kerberos5=no])])
2434
2435  if test "$ac_cv_kerberos" = yes ; then
2436    have_kerberos=yes
2437    AC_DEFINE(HAVE_KERBEROS)
2438  fi
2439
2440  if test "$ac_cv_kerberos5" = yes ; then
2441
2442    # Andrew Snare <ajs@pigpond.com> wrote:
2443    #
2444    # You were assuming that if kerberosV (krb5) was found, then kerberosIV
2445    # (krb4) was also available.  This turns out not to be the case with
2446    # mit-krb-1.2.7; apparently backwards-compatibility with KerberosIV
2447    # is optional.
2448    #
2449    # So, disable kerberosV support if libkrb4 can't be found.
2450    # This is not the best solution, but it makes the compile not fail.
2451    #
2452    AC_CHECK_X_LIB(krb4, krb_get_tf_realm,
2453                   [have_kerberos=yes],
2454                   [have_kerberos=no])
2455    if test "$have_kerberos" = yes ; then
2456      have_kerberos5=yes
2457      AC_DEFINE(HAVE_KERBEROS)
2458      AC_DEFINE(HAVE_KERBEROS5)
2459    else
2460      have_kerberos5=no
2461      AC_MSG_WARN([Cannot find compat lib (libkrb4) needed to use Kerberos 5])
2462    fi
2463
2464  fi
2465
2466  if test "$have_kerberos5" = yes ; then
2467    # from Matt Knopp <mhat@infocalypse.netlag.com>
2468    # (who got it from amu@mit.edu)
2469
2470    PASSWD_LIBS="$PASSWD_LIBS -lkrb4 -ldes425 -lkrb5 -lk5crypto -lcom_err"
2471
2472    # jwz: macOS uses -lkrb5, but not -lcrypt
2473    AC_CHECK_X_LIB(crypt, crypt, [PASSWD_LIBS="$PASSWD_LIBS -lcrypt"])
2474
2475  elif test "$have_kerberos" = yes ; then
2476    # from Tim Showalter <tjs@psaux.com> for FreeBSD 4.2
2477    PASSWD_LIBS="$PASSWD_LIBS -lkrb -ldes -lcom_err"
2478  fi
2479
2480  if test "$have_kerberos" = yes ; then
2481    AC_CHECK_FUNC(res_search,,
2482      AC_CHECK_LIB(resolv,res_search,PASSWD_LIBS="${PASSWD_LIBS} -lresolv",
2483        AC_MSG_WARN([Can't find DNS resolver libraries needed for Kerberos])
2484      ))
2485  fi
2486fi
2487
2488
2489###############################################################################
2490#
2491#       Check for the nine billion variants of shadow passwords...
2492#
2493###############################################################################
2494
2495have_shadow=no
2496with_shadow_req=unspecified
2497
2498AC_ARG_WITH(shadow,
2499[  --with-shadow           Include support for shadow password authentication.],
2500  [with_shadow="$withval"; with_shadow_req="$withval"],[with_shadow=yes])
2501
2502HANDLE_X_PATH_ARG(with_shadow, --with-shadow, shadow password)
2503
2504if test "$enable_locking" = no ; then
2505  with_shadow_req=no
2506  with_shadow=no
2507fi
2508
2509
2510###############################################################################
2511#
2512#       Check for Sun "adjunct" passwords.
2513#
2514###############################################################################
2515
2516if test "$with_shadow" = yes ; then
2517  AC_CACHE_CHECK([for Sun-style shadow passwords], ac_cv_sun_adjunct,
2518                 [AC_TRY_X_COMPILE([#include <stdlib.h>
2519                                    #include <unistd.h>
2520                                    #include <sys/types.h>
2521                                    #include <sys/label.h>
2522                                    #include <sys/audit.h>
2523                                    #include <pwdadj.h>],
2524                      [struct passwd_adjunct *p = getpwanam("nobody");
2525                       const char *pw = p->pwa_passwd;],
2526                      [ac_cv_sun_adjunct=yes],
2527                      [ac_cv_sun_adjunct=no])])
2528  if test "$ac_cv_sun_adjunct" = yes; then
2529    have_shadow_adjunct=yes
2530    have_shadow=yes
2531    setuid_auth=yes
2532  fi
2533fi
2534
2535
2536###############################################################################
2537#
2538#       Check for DEC and SCO so-called "enhanced" security.
2539#
2540###############################################################################
2541
2542if test "$with_shadow" = yes ; then
2543  AC_CACHE_CHECK([for DEC-style shadow passwords], ac_cv_enhanced_passwd,
2544                 [AC_TRY_X_COMPILE([#include <stdlib.h>
2545                                    #include <unistd.h>
2546                                    #include <sys/types.h>
2547                                    #include <pwd.h>
2548                                    #include <sys/security.h>
2549                                    #include <prot.h>],
2550                      [struct pr_passwd *p;
2551                       const char *pw;
2552                       set_auth_parameters(0, 0);
2553                       check_auth_parameters();
2554                       p = getprpwnam("nobody");
2555                       pw = p->ufld.fd_encrypt;],
2556                      [ac_cv_enhanced_passwd=yes],
2557                      [ac_cv_enhanced_passwd=no])])
2558  if test $ac_cv_enhanced_passwd = yes; then
2559    have_shadow_enhanced=yes
2560    have_shadow=yes
2561    setuid_auth=yes
2562
2563    # On SCO, getprpwnam() is in -lprot (which uses nap() from -lx)
2564    # (I'm told it needs -lcurses too, but I don't understand why.)
2565    # But on DEC, it's in -lsecurity.
2566    #
2567    AC_CHECK_LIB(prot, getprpwnam,
2568                 [PASSWD_LIBS="$PASSWD_LIBS -lprot -lcurses -lx"],
2569                 [AC_CHECK_LIB(security, getprpwnam,
2570                               [PASSWD_LIBS="$PASSWD_LIBS -lsecurity"])],
2571                 [-lx])
2572  fi
2573fi
2574
2575###############################################################################
2576#
2577#       Check for HP's entry in the "Not Invented Here" Sweepstakes.
2578#
2579###############################################################################
2580
2581if test "$with_shadow" = yes ; then
2582  AC_CACHE_CHECK([for HP-style shadow passwords], ac_cv_hpux_passwd,
2583                 [AC_TRY_X_COMPILE([#include <stdlib.h>
2584                                    #include <unistd.h>
2585                                    #include <sys/types.h>
2586                                    #include <pwd.h>
2587                                    #include <hpsecurity.h>
2588                                    #include <prot.h>],
2589                      [struct s_passwd *p = getspwnam("nobody");
2590                       const char *pw = p->pw_passwd;],
2591                      [ac_cv_hpux_passwd=yes],
2592                      [ac_cv_hpux_passwd=no])])
2593  if test "$ac_cv_hpux_passwd" = yes; then
2594    have_shadow_hpux=yes
2595    have_shadow=yes
2596    setuid_auth=yes
2597
2598    # on HPUX, bigcrypt is in -lsec
2599    AC_CHECK_LIB(sec, bigcrypt, [PASSWD_LIBS="$PASSWD_LIBS -lsec"])
2600  fi
2601fi
2602
2603
2604###############################################################################
2605#
2606#       Check for FreeBSD-style shadow passwords.
2607#
2608#       On FreeBSD, getpwnam() and friends work just like on non-shadow-
2609#       password systems -- except you only get stuff in the pw_passwd field
2610#       if the running program is setuid.  So, guess that we've got this
2611#       lossage to contend with if /etc/master.passwd exists, and default to
2612#       a setuid installation.
2613#
2614###############################################################################
2615
2616if test "$with_shadow" = yes ; then
2617  AC_CACHE_CHECK([for FreeBSD-style shadow passwords], ac_cv_master_passwd,
2618                 [if test -f /etc/master.passwd ; then
2619                    ac_cv_master_passwd=yes
2620                  else
2621                    ac_cv_master_passwd=no
2622                  fi])
2623  if test "$ac_cv_master_passwd" = yes; then
2624    setuid_auth=yes
2625  fi
2626fi
2627
2628
2629###############################################################################
2630#
2631#       Check for OpenBSD-style shadow passwords.
2632#       It's getpwnam_shadow instead of getpwnam, and it only works as root.
2633#
2634###############################################################################
2635
2636if test "$with_shadow" = yes ; then
2637  AC_CACHE_CHECK([for OpenBSD-style shadow passwords], ac_cv_pwnam_shadow,
2638                 [AC_TRY_X_COMPILE([#include <stdlib.h>
2639                                    #include <unistd.h>
2640                                    #include <sys/types.h>
2641                                    #include <pwd.h>],
2642                      [struct spwd *p = getspnam_shadow("nobody");
2643                       const char *pw = p->pw_passwd;],
2644                      [ac_cv_pwnam_shadow=yes],
2645                      [ac_cv_pwnam_shadow=no])])
2646  if test "$ac_cv_pwnam_shadow" = yes; then
2647    have_pwnam_shadow=yes
2648
2649    # If we also have PAM, assume that we don't need to be setuid.
2650    if test $have_pam != yes; then
2651      setuid_auth=yes
2652    fi
2653  fi
2654fi
2655
2656
2657###############################################################################
2658#
2659#       Check for traditional (ha!) shadow passwords.
2660#
2661###############################################################################
2662
2663if test "$with_shadow" = yes ; then
2664  AC_CACHE_CHECK([for generic shadow passwords], ac_cv_shadow,
2665                 [AC_TRY_X_COMPILE([#include <stdlib.h>
2666                                    #include <unistd.h>
2667                                    #include <sys/types.h>
2668                                    #include <pwd.h>
2669                                    #include <shadow.h>],
2670                      [struct spwd *p = getspnam("nobody");
2671                       const char *pw = p->sp_pwdp;],
2672                      [ac_cv_shadow=yes],
2673                      [ac_cv_shadow=no])])
2674  if test "$ac_cv_shadow" = yes; then
2675    have_shadow=yes
2676
2677    # If we also have PAM, assume that we don't need to be setuid.
2678    if test $have_pam != yes; then
2679      setuid_auth=yes
2680    fi
2681
2682    # On some systems (UnixWare 2.1), getspnam() is in -lgen instead of -lc.
2683    have_getspnam=no
2684    AC_CHECK_LIB(c, getspnam, [have_getspnam=yes])
2685    if test "$have_getspnam" = no ; then
2686      AC_CHECK_LIB(gen, getspnam,
2687                   [have_getspnam=yes; PASSWD_LIBS="$PASSWD_LIBS -lgen"])
2688    fi
2689  fi
2690fi
2691
2692
2693###############################################################################
2694#
2695#       Check for other libraries needed for non-shadow passwords.
2696#
2697###############################################################################
2698
2699if test "$enable_locking" = yes ; then
2700
2701  # On some systems (UnixWare 2.1), crypt() is in -lcrypt instead of -lc.
2702  have_crypt=no
2703  AC_CHECK_LIB(c, crypt, [have_crypt=yes])
2704  if test "$have_crypt" = no ; then
2705    AC_CHECK_LIB(crypt, crypt,
2706                 [have_crypt=yes; PASSWD_LIBS="$PASSWD_LIBS -lcrypt"])
2707  fi
2708fi
2709
2710
2711###############################################################################
2712#
2713#       Strongly suspect that this hasn't been used in years.  Also, the same
2714#       goal is achieved by xscreensaver-auth in XScreenSaver 6.  -- jwz, 2021
2715#
2716#       Check for external password helper
2717#	On SuSE in 1993, instead of having xscreensaver be a setuid program,
2718#	they fork an external program that takes the password on stdin, and
2719#	returns true if that password is a valid one.  Then only that smaller
2720#	program needs to be setuid.
2721#
2722#       (Note that this external program is not a GUI: the GUI is still
2723#	all in xscreensaver itself; the external program just does auth.)
2724#
2725###############################################################################
2726
2727#have_passwd_helper=no
2728#with_passwd_helper_req=unspecified
2729#
2730#AC_ARG_WITH(passwd-helper,
2731#[  --with-passwd-helper    Include support for external password verification.],
2732#  [with_passwd_helper="$withval"; with_passwd_helper_req="$withval"],[with_passwd_helper=no])
2733## no HANDLE_X_PATH_ARG for this one
2734#
2735#if test "$enable_locking" = no ; then
2736#  with_passwd_helper_req=no
2737#  with_passwd_helper=no
2738#fi
2739#
2740#case "$with_passwd_helper" in
2741#  ""|no) : ;;
2742#  /*)
2743#    AC_DEFINE_UNQUOTED(PASSWD_HELPER_PROGRAM, "$with_passwd_helper")
2744#    have_passwd_helper=yes;;
2745#  *)
2746#    echo "error: --with-passwd-helper needs full pathname of helper (not '$with_passwd_helper')." >&2
2747#    exit 1
2748#esac
2749
2750
2751
2752# Most of the above shadow mechanisms will have set setuid_auth to yes,
2753# if they were found.  But, on some systems, we need setuid even when
2754# using plain old vanilla passwords.
2755#
2756if test "$enable_locking" = yes -a "$have_pam" = no ; then
2757  case "$host" in
2758    *-hpux* | *-aix* | *-netbsd* | *-freebsd* )
2759      setuid_auth=yes
2760    ;;
2761  esac
2762fi
2763
2764
2765if test "$have_shadow_adjunct" = yes ; then
2766  AC_DEFINE(HAVE_ADJUNCT_PASSWD)
2767elif test "$have_shadow_enhanced" = yes ; then
2768  AC_DEFINE(HAVE_ENHANCED_PASSWD)
2769elif test "$have_shadow_hpux" = yes ; then
2770  AC_DEFINE(HAVE_HPUX_PASSWD)
2771elif test "$have_shadow" = yes ; then
2772  AC_DEFINE(HAVE_SHADOW_PASSWD)
2773elif test "$have_pwnam_shadow" = yes ; then
2774  AC_DEFINE(HAVE_PWNAM_SHADOW_PASSWD)
2775fi
2776
2777
2778###############################################################################
2779#
2780#       Check for -lgtk (and Gnome stuff)
2781#
2782###############################################################################
2783
2784#### H1
2785
2786have_gtk=no
2787with_gtk_req=unspecified
2788AC_ARG_WITH(gtk,
2789[
2790User Interface Options:
2791
2792  --with-gtk              Use the Gtk toolkit for the user interface.],
2793  [with_gtk="$withval"; with_gtk_req="$withval"],[with_gtk=yes])
2794
2795# if --with-gtk=/directory/ was specified, remember that directory so that
2796# we can also look for the `gtk-config' program in that directory.
2797case "$with_gtk" in
2798  /*)
2799    gtk_dir="$with_gtk"
2800    ;;
2801  *)
2802    gtk_dir=""
2803    ;;
2804esac
2805
2806HANDLE_X_PATH_ARG(with_gtk, --with-gtk, Gtk)
2807
2808if test "$with_gtk" != yes -a "$with_gtk" != no ; then
2809  echo "error: must be yes or no: --with-gtk=$with_gtk"
2810  exit 1
2811fi
2812
2813
2814gtk_halfassed=no
2815
2816if test "$with_gtk" = yes; then
2817  have_gtk=no
2818
2819  ok="yes"
2820  pkg_check_version            gtk+-2.0  2.22.0 ; ac_gtk_version_string="$vers"
2821  pkg_check_version         gmodule-2.0  2.0.0
2822  pkg_check_version          libxml-2.0  2.4.6
2823  pkg_check_version      gdk-pixbuf-2.0  2.0.0
2824  pkg_check_version gdk-pixbuf-xlib-2.0  2.0.0
2825  have_gtk="$ok"
2826
2827  if test "$have_gtk" = no; then
2828    if test -n "$ac_gtk_version_string" ; then
2829      gtk_halfassed=yes
2830      gtk_halfassed_lib="$req"
2831    fi
2832  fi
2833
2834  if test "$have_gtk" = yes; then
2835    AC_CACHE_CHECK([for Gtk includes], ac_cv_gtk_config_cflags,
2836                   [ac_cv_gtk_config_cflags=`$pkg_config --cflags $pkgs`])
2837    AC_CACHE_CHECK([for Gtk libs], ac_cv_gtk_config_libs,
2838                   [ac_cv_gtk_config_libs=`$pkg_config --libs $pkgs`])
2839  fi
2840
2841  ac_gtk_config_cflags=$ac_cv_gtk_config_cflags
2842  ac_gtk_config_libs=$ac_cv_gtk_config_libs
2843
2844  GTK_DATADIR=""
2845  if test "$have_gtk" = yes; then
2846    GTK_DATADIR=`$pkg_config --variable=prefix gtk+-2.0`
2847    GTK_DATADIR="$GTK_DATADIR/share"
2848  fi
2849
2850  if test "$have_gtk" = yes; then
2851    INCLUDES="$INCLUDES $ac_gtk_config_cflags"
2852    GTK_LIBS="$GTK_LIBS $ac_gtk_config_libs"
2853    AC_DEFINE(HAVE_GTK)
2854    AC_DEFINE(HAVE_GTK2)
2855    AC_DEFINE(HAVE_XML)
2856  fi
2857fi
2858
2859
2860# Check for the various Gnome help and URL loading programs.
2861#
2862WITH_BROWSER=gnome-open
2863if test "$have_gtk" = yes; then
2864  AC_CHECK_PROGS(gnome_open_program,     gnome-open)
2865  AC_CHECK_PROGS(gnome_url_show_program, gnome-url-show)
2866fi
2867
2868
2869###############################################################################
2870#
2871#       Check for -lXm.
2872#
2873###############################################################################
2874
2875have_motif=no
2876with_motif_req=unspecified
2877AC_ARG_WITH(motif,
2878[  --with-motif            Use the Motif toolkit for the user interface.],
2879  [with_motif="$withval"; with_motif_req="$withval"],[with_motif=no])
2880
2881HANDLE_X_PATH_ARG(with_motif, --with-motif, Motif)
2882
2883if test "$with_motif" != yes -a "$with_motif" != no ; then
2884  echo "error: must be yes or no: --with-motif=$with_motif"
2885  exit 1
2886fi
2887
2888if test "$with_motif" = yes; then
2889  have_motif=no
2890  AC_CHECK_X_HEADER(Xm/Xm.h,
2891                    [have_motif=yes
2892                     AC_DEFINE(HAVE_MOTIF)
2893                     MOTIF_LIBS="$MOTIF_LIBS -lXm"],,
2894                    [#include <stdlib.h>
2895                     #include <stdio.h>
2896                     #include <X11/Intrinsic.h>])
2897fi
2898
2899
2900if test "$have_motif" = yes; then
2901  AC_CHECK_X_HEADER(Xm/ComboBox.h, [AC_DEFINE(HAVE_XMCOMBOBOX)],,
2902                    [#include <stdlib.h>
2903                     #include <stdio.h>
2904                     #include <X11/Intrinsic.h>])
2905fi
2906
2907
2908###############################################################################
2909#
2910#       Checking whether Motif is really Lesstif.
2911#
2912###############################################################################
2913
2914have_lesstif=no
2915if test "$have_motif" = yes ; then
2916  AC_CACHE_CHECK([whether Motif is really LessTif],
2917                 ac_cv_have_lesstif,
2918                 [AC_TRY_X_COMPILE([#include <Xm/Xm.h>],
2919                                   [long vers = LesstifVersion;],
2920                                   [ac_cv_have_lesstif=yes],
2921                                   [ac_cv_have_lesstif=no])])
2922  have_lesstif=$ac_cv_have_lesstif
2923fi
2924
2925
2926lesstif_version=unknown
2927lesstif_version_string=unknown
2928
2929if test "$have_lesstif" = yes ; then
2930  ltv=unknown
2931  echo unknown > conftest-lt
2932  AC_CACHE_CHECK([LessTif version number],
2933                 ac_cv_lesstif_version_string,
2934      [AC_TRY_X_RUN([#include <stdio.h>
2935                     #include <Xm/Xm.h>
2936                     int main() {
2937                       FILE *f = fopen("conftest-lt", "w");
2938                       if (!f) exit(1);
2939                       fprintf(f, "%d %d.%d\n", LesstifVersion,
2940                          LESSTIF_VERSION, LESSTIF_REVISION);
2941                       fclose(f);
2942                       exit(0);
2943                     }],
2944                    [ltv=`cat conftest-lt`
2945                     ac_cv_lesstif_version=`echo $ltv | sed 's/ .*//'`
2946                     ac_cv_lesstif_version_string=`echo $ltv | sed 's/.* //'`],
2947                    [ac_cv_lesstif_version=unknown
2948                     ac_cv_lesstif_version_string=unknown],
2949                    [ac_cv_lesstif_version=unknown
2950                     ac_cv_lesstif_version_string=unknown])])
2951  rm -f conftest-lt
2952  lesstif_version=$ac_cv_lesstif_version
2953  lesstif_version_string=$ac_cv_lesstif_version_string
2954
2955fi
2956
2957
2958if test "$have_motif" = yes ; then
2959  mtv=unknown
2960  echo unknown > conftest-mt
2961  AC_CACHE_CHECK([Motif version number],
2962                 ac_cv_motif_version_string,
2963      [AC_TRY_X_RUN([#include <stdio.h>
2964                     #include <Xm/Xm.h>
2965                     int main() {
2966                       FILE *f = fopen("conftest-mt", "w");
2967                       if (!f) exit(1);
2968                       fprintf(f, "%d %d.%d\n", XmVersion,
2969                          XmVERSION, XmREVISION);
2970                       fclose(f);
2971                       exit(0);
2972                     }],
2973                    [mtv=`cat conftest-mt`
2974                     ac_cv_motif_version=`echo $mtv | sed 's/ .*//'`
2975                     ac_cv_motif_version_string=`echo $mtv | sed 's/.* //'`],
2976                    [ac_cv_motif_version=unknown
2977                     ac_cv_motif_version_string=unknown],
2978                    [ac_cv_motif_version=unknown
2979                     ac_cv_motif_version_string=unknown])])
2980  rm -f conftest-mt
2981  motif_version=$ac_cv_motif_version
2982  motif_version_string=$ac_cv_motif_version_string
2983
2984fi
2985
2986
2987###############################################################################
2988#
2989#       Checking whether Motif requires -lXp.
2990#
2991#       Some versions of Motif (2.1.0, at least) require -lXp, the "X Printing
2992#       Extension".   Why this extension isn't in -lXext with all the others,
2993#       I have no idea.
2994#
2995###############################################################################
2996
2997have_xp_ext=no
2998if test "$have_motif" = yes ; then
2999   have_xp_ext=no
3000   AC_CHECK_X_LIB(Xp, XpQueryExtension,
3001                  [have_xp_ext=yes; MOTIF_LIBS="$MOTIF_LIBS -lXp"],
3002                  [true], -lX11 -lXext -lm)
3003fi
3004
3005
3006###############################################################################
3007#
3008#       Checking whether Motif requires -lXintl (for _Xsetlocale.)
3009#
3010###############################################################################
3011
3012have_xintl=no
3013if test "$have_motif" = yes ; then
3014  AC_CHECK_X_LIB(Xintl, _Xsetlocale, [have_xintl=yes], [have_xintl=no],
3015                 -lX11 -lXext -lm)
3016  if test "$have_xintl" = yes; then
3017    MOTIF_LIBS="$MOTIF_LIBS -lXintl"
3018  fi
3019fi
3020
3021
3022###############################################################################
3023#
3024#       Check for a login manager for a "New Login" button on the lock dialog.
3025#	Usually this will be "/usr/bin/gdmflexiserver".
3026#
3027###############################################################################
3028
3029with_login_manager_req=unspecified
3030default_login_manager_1='gdmflexiserver -ls'
3031default_login_manager_2='kdmctl reserve'
3032default_login_manager_3='lxdm -c USER_SWITCH'
3033default_login_manager_4='dm-tool switch-to-greeter'
3034
3035AC_ARG_WITH(login-manager,
3036[  --with-login-manager    Put a "New Login" button on the unlock dialog that
3037                          runs a login manager like gdmflexiserver or kdmctl.],
3038  [with_login_manager="$withval"; with_login_manager_req="$withval"],
3039  [with_login_manager=yes])
3040# no HANDLE_X_PATH_ARG for this one
3041
3042if test "$enable_locking" = no ; then
3043  with_login_manager_req=no
3044  with_login_manager=no
3045fi
3046
3047case "$with_login_manager_req" in
3048  no)
3049    with_login_manager=""
3050  ;;
3051
3052  yes|unspecified)
3053    # Try various defaults, use the first one that exists.
3054
3055    with_login_manager=""
3056
3057    if test -z "$with_login_manager" ; then
3058      set dummy $default_login_manager_1 ; login_manager_tmp=$2
3059      unset ac_cv_path_login_manager_tmp  # don't cache
3060      AC_PATH_PROG(login_manager_tmp, $login_manager_tmp, [])
3061      if test ! -z "$login_manager_tmp" ; then
3062        with_login_manager="$default_login_manager_1"
3063      fi
3064    fi
3065
3066    if test -z "$with_login_manager" ; then
3067      set dummy $default_login_manager_2 ; login_manager_tmp=$2
3068      unset ac_cv_path_login_manager_tmp  # don't cache
3069      AC_PATH_PROG(login_manager_tmp, $login_manager_tmp, [])
3070      if test ! -z "$login_manager_tmp" ; then
3071        with_login_manager="$default_login_manager_2"
3072      fi
3073    fi
3074
3075    if test -z "$with_login_manager" ; then
3076      set dummy $default_login_manager_3 ; login_manager_tmp=$2
3077      unset ac_cv_path_login_manager_tmp  # don't cache
3078      AC_PATH_PROG(login_manager_tmp, $login_manager_tmp, [])
3079      if test ! -z "$login_manager_tmp" ; then
3080        with_login_manager="$default_login_manager_3"
3081      fi
3082    fi
3083
3084    if test -z "$with_login_manager" ; then
3085      set dummy $default_login_manager_4 ; login_manager_tmp=$2
3086      unset ac_cv_path_login_manager_tmp  # don't cache
3087      AC_PATH_PROG(login_manager_tmp, $login_manager_tmp, [])
3088      if test ! -z "$login_manager_tmp" ; then
3089        with_login_manager="$default_login_manager_4"
3090      fi
3091    fi
3092
3093  ;;
3094
3095  *)
3096    # Just believe whatever command was specified.
3097    with_login_manager="$with_login_manager_req"
3098  ;;
3099esac
3100ac_cv_login_manager_program="$with_login_manager"
3101
3102NEW_LOGIN_COMMAND_P=''
3103NEW_LOGIN_COMMAND="$ac_cv_login_manager_program"
3104
3105AC_MSG_CHECKING(for login manager)
3106if test -z "$NEW_LOGIN_COMMAND" ; then
3107  NEW_LOGIN_COMMAND="$default_login_manager_1"
3108  NEW_LOGIN_COMMAND_P='! '
3109  AC_MSG_RESULT($NEW_LOGIN_COMMAND (disabled))
3110else
3111  AC_MSG_RESULT($NEW_LOGIN_COMMAND)
3112fi
3113
3114
3115
3116###############################################################################
3117#
3118#       Check for a directory full of images to use as the default value
3119#	of the "imageDirectory" preference.
3120#
3121###############################################################################
3122
3123have_imagedir=no
3124with_imagedir_req=unspecified
3125
3126AC_ARG_WITH(image-directory,
3127[  --with-image-directory  Some demos will display random images from here.],
3128  [with_imagedir="$withval"; with_imagedir_req="$withval"],
3129  [with_imagedir=yes])
3130# no HANDLE_X_PATH_ARG for this one
3131
3132case "$with_imagedir" in
3133  /*)
3134    # absolute path
3135    AC_MSG_CHECKING([for image directory $with_imagedir])
3136    if test -d "$with_imagedir" ; then
3137      AC_MSG_RESULT(yes)
3138    else
3139      AC_MSG_RESULT(no)
3140      with_imagedir=""
3141    fi
3142  ;;
3143  yes)
3144    with_imagedir=""
3145
3146    fallback_imgdir=""
3147    for dd in \
3148      "/usr/share/rpd-wallpaper/"		\
3149      "/usr/share/backgrounds/images/"		\
3150      "/usr/share/wallpapers/"			\
3151      "/usr/share/backgrounds/"			\
3152      "/usr/share/pixmaps/backgrounds/"		\
3153      "/usr/share/lxde/wallpapers/"		\
3154      "/Library/Desktop Pictures/"		\
3155    ; do
3156      if test -z "$with_imagedir"; then
3157        AC_MSG_CHECKING([for image directory $dd])
3158        if test -d "$dd"; then
3159          if ( ls "$dd" | grep -q ... ) >&- 2>&- ; then
3160            AC_MSG_RESULT(yes)
3161            with_imagedir="$dd"
3162          else
3163            AC_MSG_RESULT(empty)
3164            if test -z "$fallback_imgdir"; then
3165              fallback_imgdir="$dd"
3166            fi
3167          fi
3168        else
3169          AC_MSG_RESULT(no)
3170        fi
3171      fi
3172    done
3173    if test -z "$with_imagedir"; then
3174      with_imagedir="$fallback_imgdir"
3175    fi
3176;;
3177  no)
3178    with_imagedir=""
3179  ;;
3180
3181  *)
3182    echo "error: must be an absolute path: --with-image-directory=$with_imagedir_req"
3183    exit 1
3184  ;;
3185esac
3186ac_cv_imagedir="$with_imagedir"
3187
3188DEFAULT_IMAGES_P='True'
3189DEFAULT_IMAGE_DIRECTORY="$ac_cv_imagedir"
3190
3191if test -z "$DEFAULT_IMAGE_DIRECTORY" ; then
3192  DEFAULT_IMAGES_P='False'
3193fi
3194
3195
3196###############################################################################
3197#
3198#       Pick a text file to use as the default of the "textFile" preference.
3199#	Any old file will do, but preferably one that will make interesting
3200#	shapes when displayed by "starwars" and "fontglide".
3201#
3202###############################################################################
3203
3204have_textfile=no
3205with_textfile_req=unspecified
3206
3207AC_ARG_WITH(text-file,
3208[  --with-text-file=FILE   Some demos will use this as a source of text.],
3209  [with_textfile="$withval"; with_textfile_req="$withval"],
3210  [with_textfile=yes])
3211# no HANDLE_X_PATH_ARG for this one
3212
3213case "$with_textfile" in
3214  /*)
3215    # absolute path
3216    AC_MSG_CHECKING([for text file $with_textfile])
3217    if test -f "$with_textfile" ; then
3218      AC_MSG_RESULT(yes)
3219    else
3220      AC_MSG_RESULT(no)
3221      with_textfile=""
3222    fi
3223  ;;
3224  yes)
3225    with_textfile=""
3226
3227    #### Could use some more defaults here...
3228    for f in \
3229      "/usr/X11R6/lib/X11/doc/README"		   \
3230      "/usr/share/doc/xserver-common/copyright"	   \
3231      "/usr/share/doc/xserver-xorg-core/copyright" \
3232      "/usr/X11R6/README"			   \
3233      "/usr/share/doc/libX11*/COPYING"		   \
3234      "/usr/X11/share/X11/doc/README*"		   \
3235      "/usr/share/doc/debian/debian-manifesto"     \
3236    ; do
3237      if test -z "$with_textfile"; then
3238        AC_MSG_CHECKING([for text file $f])
3239	f=`/bin/ls $f 2>&- | head -1`
3240        if test -f "$f" ; then
3241          AC_MSG_RESULT(yes)
3242          with_textfile="$f"
3243        else
3244          AC_MSG_RESULT(no)
3245        fi
3246      fi
3247    done
3248
3249  ;;
3250  no)
3251    with_textfile=""
3252  ;;
3253
3254  *)
3255    echo "error: must be an absolute path: --with-text-file=$with_textfile_req"
3256    exit 1
3257  ;;
3258esac
3259ac_cv_textfile="$with_textfile"
3260
3261DEFAULT_TEXT_FILE="$ac_cv_textfile"
3262
3263
3264###############################################################################
3265#
3266#       Check the browser to see help URL
3267#
3268###############################################################################
3269
3270have_browser=no
3271with_browser_req=unspecified
3272
3273AC_ARG_WITH(browser,
3274[  --with-browser=BROWSER  The web browser used to open the "Help" URL.],
3275  [with_browser="$withval"; with_browser_req="$withval"],
3276  [with_browser=no ])
3277# no HANDLE_X_PATH_ARG for this one
3278
3279case "$with_browser" in
3280  no )
3281  ;;
3282  * )
3283    WITH_BROWSER=$with_browser
3284    gnome_open_program=$with_browser
3285    AC_MSG_CHECKING([for browser $with_browser])
3286    with_browser_fullpath=`which $with_browser 2>/dev/null`
3287    case $with_browser_fullpath in
3288	 /* )
3289	        AC_MSG_RESULT(yes)
3290		 have_browser=yes
3291		 ;;
3292	* )
3293	       AC_MSG_RESULT(no)
3294# Only warning: we don't want to install all packages for the
3295# dependency of the browser in building stage...
3296	       echo "WARNING: browser not found: --with-browser=$with_browser"
3297	       ;;
3298    esac
3299  ;;
3300esac
3301ac_cv_browser="$with_browser"
3302
3303
3304###############################################################################
3305#
3306#       Check for pthreads. Must come before checking for OpenGL,
3307#       since some versions of OpenGL require it.
3308#
3309###############################################################################
3310
3311have_pthread=no
3312with_pthread_req=unspecified
3313
3314# AX_PTHREAD is from the GNU Autoconf Archive.
3315# https://savannah.gnu.org/projects/autoconf-archive/
3316m4_include(ax_pthread.m4)
3317
3318AC_ARG_WITH([pthread],
3319[],  # This is documented after --with-gl in --with-xft.
3320  [with_pthread="$withval"; with_pthread_req="$withval"],
3321  [with_pthread=yes])
3322
3323if test "$with_pthread" = yes; then
3324  # AX_PTHREAD might want a different compiler.
3325  AX_PTHREAD(
3326   [if test "$CC" = "$PTHREAD_CC" -o -z "$ac_original_cc"; then
3327      have_pthread=yes
3328    else
3329      ac_prog_cc_no_pthread=yes
3330    fi
3331  ])
3332
3333  if test "$have_pthread" = yes; then
3334    AC_DEFINE([HAVE_PTHREAD])
3335    CC="$PTHREAD_CC"
3336  fi
3337fi
3338
3339
3340###############################################################################
3341#
3342#       Handle --with-gles
3343#	Must come before --with-gl
3344#
3345###############################################################################
3346
3347with_jwzgles_req=unspecified
3348have_jwzgles=no
3349AC_ARG_WITH(gles,
3350[],  # This is documented after --with-gl
3351  [with_jwzgles="$withval"; with_jwzgles_req="$withval"],[with_jwzgles=no])
3352
3353HANDLE_X_PATH_ARG(with_jwzgles, --with-gles, JWZGLES)
3354
3355if test "$with_jwzgles" = yes; then
3356  have_jwzgles=yes
3357  JWZGLES_OBJS='$(JWXYZ_BIN)/jwzgles.o'
3358  AC_MSG_RESULT(emulating OpenGL 1.3 in terms of OpenGLES 1.x.)
3359elif test "$with_jwzgles" != no; then
3360  echo "error: must be yes or no: --with-gles=$with_jwzgles"
3361  exit 1
3362fi
3363
3364
3365###############################################################################
3366#
3367#       Check for -lGL or -lMesaGL.
3368#
3369###############################################################################
3370
3371#### H1
3372
3373have_gl=no
3374ac_have_mesa_gl=no
3375with_gl_req=unspecified
3376gl_halfassed=no
3377have_glext=no
3378AC_ARG_WITH(gl,
3379[
3380Graphics Options:
3381
3382  --with-gl               Build those demos which depend on OpenGL.
3383  --with-gles             Emulate OpenGL 1.3 in terms of OpenGL ES 1.x.],
3384  [with_gl="$withval"; with_gl_req="$withval"],[with_gl=yes])
3385
3386HANDLE_X_PATH_ARG(with_gl, --with-gl, GL)
3387
3388# Some GL libraries require pthreads, so use the pthreads flags when
3389# testing them, then set them back after.
3390#
3391ac_save_pthreads_CFLAGS="$CFLAGS"
3392ac_save_pthreads_LIBS="$LIBS"
3393CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
3394LIBS="$PTHREAD_LIBS $LIBS"
3395
3396if test "$with_gl" = yes; then
3397  AC_CHECK_X_HEADER(GL/gl.h, have_gl=yes, have_gl=no);
3398  if test "$have_gl" = yes; then
3399    AC_CHECK_X_HEADER(GL/glu.h, have_gl=yes, have_gl=no);
3400  fi
3401fi
3402
3403if test "$with_gl" = yes; then
3404  #
3405  # Since the OpenGL and GLES specifications are a complete dumpster fire,
3406  # it's not easy to figure out how what libraries to use.
3407  #
3408  # OpenGLES library names:
3409  #
3410  #   1.x: libGLESv1_CM
3411  #   2.x: libGLESv2
3412  #   3.x: libGLESv2 on Windows, libGLESv3 on Android
3413  #
3414  # On modern Linux systems, these libraries exist:
3415  #
3416  #   libGL        - a superset of everything up to and including OpenGL 4.6
3417  #   libGLESv1_CM - OpenGLES 1.1, meaning it omits much of OpenGL 1.3
3418  #   libGLESv2    - OpenGLES 2 and 3, meaning it omits even more of OpenGL 1.3
3419  #
3420  # Since Linux systems support OpenGL 1.3, those link against only libGL.
3421  #
3422  # Unless we are using --with-gles on Linux, in which case we are attempting
3423  # to simulate a system that does not natively support OpenGL 1.3.  In that
3424  # case, we use the v1 and/or v2 libraries instead.
3425  #
3426  # Common practice on Android seems to be to link against the v1, v2 and v3
3427  # libraries in order, and then do runtime checks to see which set of
3428  # functions is actually supported by the runtime.  Just because you linked
3429  # against a GLES3 library doesn't mean that the hardware supports it: most
3430  # of these functions are just syscall-like stubs.
3431  #
3432  # See the commentary atop jwxyz/jwzgles.c for discussion of OpenGL versions.
3433  #
3434  if test "$have_gl" = yes; then
3435    have_gl=no
3436
3437    if test "$have_jwzgles" = yes; then
3438
3439      # Only check for the v1/2/3 libraries on Linux when using --with-gles
3440      # to emulate a system that does not natively support OpenGL 1.3.
3441
3442      # Check for GLES 3.x
3443      AC_CHECK_X_LIB(GLESv3, glDrawElements,
3444                     [have_gl=yes
3445                      gl_lib_1="GLESv3"
3446                      GL_LIBS="-lGLESv3 $GL_LIBS"],
3447                     [], $GL_LIBS -lm)
3448
3449      # Check for GLES 2.x
3450      AC_CHECK_X_LIB(GLESv2, glDrawElements,
3451                     [have_gl=yes
3452                      gl_lib_1="GLESv2"
3453                      GL_LIBS="-lGLESv2 $GL_LIBS"],
3454                     [], $GL_LIBS -lm)
3455
3456      # Check for GLES 1.x
3457      AC_CHECK_X_LIB(GLESv1_CM, glDrawElements,
3458                     [have_gl=yes
3459                      gl_lib_1="GLESv1_CM"
3460                      GL_LIBS="-lGLESv1_CM $GL_LIBS"],
3461                     [], $GL_LIBS -lm)
3462
3463    else   # $have_jwzgles = no
3464
3465      # Check for OpenGL 1.x and/or OpenGL 4.x
3466      AC_CHECK_X_LIB(GL, glEnable,
3467                     [have_gl=yes
3468                      gl_lib_1="GL"
3469                      GL_LIBS="-lGL $GL_LIBS"],
3470                     [], $GL_LIBS -lm)
3471
3472      # Check for MesaGL 1.x, but only if libGL doesn't exist.
3473      if test "$have_gl" = no; then
3474        AC_CHECK_X_LIB(MesaGL, glEnable,
3475                       [have_gl=yes
3476                       gl_lib_1="MesaGL"
3477                       GL_LIBS="-lMesaGL $GL_LIBS"],
3478                       [], $GL_LIBS -lm)
3479      fi
3480    fi
3481  fi
3482
3483  # Figure out whether the GLU functions are in the main GL libraries or
3484  # in -lGLU.  Since Android does not have GLU, we don't link against libGLU
3485  # when using --with-gles on Linux.
3486  #
3487  if test "$have_gl" = yes -a "$have_jwzgles" = no; then
3488    AC_CHECK_X_LIB($gl_lib_1, gluBuild2DMipmaps,
3489                   [],
3490                   [have_gl=no], $GL_LIBS -lm)
3491    if test "$have_gl" = no; then
3492      AC_CHECK_X_LIB(GLU, gluBuild2DMipmaps,
3493                     [have_gl=yes
3494                      GL_LIBS="-lGLU $GL_LIBS"],
3495                     [have_gl=no
3496                      gl_halfassed=yes],
3497                      $GL_LIBS -lm)
3498    fi
3499  fi
3500
3501  if test "$have_gl" = yes; then
3502
3503    AC_DEFINE(HAVE_GL)
3504
3505    # OpenGL 1.0 didn't have multiple textures.
3506    AC_CHECK_X_LIB($gl_lib_1, glBindTexture, [AC_DEFINE(HAVE_GLBINDTEXTURE)],
3507                   [true], $GL_LIBS -lX11 -lXext -lm)
3508
3509    # Check for native GLES1
3510    AC_CHECK_X_LIB($gl_lib_1, glBindBuffer,
3511                   [AC_DEFINE(HAVE_GLES)],
3512                   [true], $GL_LIBS -lX11 -lXext -lm)
3513
3514    # Check for GLSL and GLES2
3515    AC_CHECK_X_HEADER(GL/glext.h, have_glext=yes, have_glext=no,
3516                      [#include <GL/gl.h>])
3517    if test "$have_glext" = yes ; then
3518      AC_CHECK_X_LIB($gl_lib_1, glUseProgram,
3519                     [AC_DEFINE(HAVE_GLSL)
3520                      AC_DEFINE(HAVE_GLES2)],
3521                     [],
3522                     $GL_LIBS -lX11 -lXext -lm)
3523    fi
3524
3525    # Check for GLES3
3526    AC_CHECK_X_LIB($gl_lib_1, glBlitFramebuffer,
3527                   [AC_DEFINE(HAVE_GLES3)],
3528                   [],
3529                   $GL_LIBS -lX11 -lXext -lm)
3530
3531    if test "$have_jwzgles" = yes; then
3532      AC_DEFINE(HAVE_JWZGLES)
3533      AC_DEFINE(HAVE_GLES)
3534    fi
3535
3536  fi
3537
3538
3539elif test "$with_gl" != no; then
3540  echo "error: must be yes or no: --with-gl=$with_gl"
3541  exit 1
3542fi
3543
3544
3545###############################################################################
3546#
3547#       Handle --with-glx
3548#
3549###############################################################################
3550
3551have_glx=no
3552have_egl=no
3553with_egl_req=unspecified
3554AC_ARG_WITH(glx,
3555[  --with-glx              Use GLX to interface OpenGL and X11 instead of EGL.],
3556  [with_egl="$withval"; with_egl_req="$withval"],
3557  [with_glx=no])
3558
3559HANDLE_X_PATH_ARG(with_glx, --with-glx, GLX)
3560
3561if test "$with_glx" = yes; then
3562  AC_CHECK_X_HEADER(GLX/glx.h, have_glx=yes, have_glx=no)
3563elif test "$with_glx" != no; then
3564  echo "error: must be yes or no: --with-glx=$with_glx"
3565  exit 1
3566fi
3567
3568if test "$have_gl" = yes; then
3569
3570  # See if GLX functions are in -LGL.
3571  AC_CHECK_X_LIB($gl_lib_1, glXCreateContext,
3572                 [have_glx=yes],
3573                 [have_glx=no],
3574                 $GL_LIBS -lm)
3575
3576  # See if EGL functions are in -LGL.
3577  egl_lib=""
3578  AC_CHECK_X_LIB($gl_lib_1, eglCreatePlatformWindowSurface,
3579                 [have_egl=yes],
3580                 [have_egl=no],
3581                 $GL_LIBS -lm)
3582  if test "$have_egl" = no; then
3583    # See if EGL functions are in -lEGL.
3584    AC_CHECK_X_LIB(EGL, eglCreatePlatformWindowSurface,
3585                   [have_egl=yes
3586                    egl_lib="EGL"],
3587                   [have_egl=no],
3588                   $GL_LIBS -lm)
3589  fi
3590
3591  # If both GLX and EGL exist, use GLX only if requested.
3592  if test "$with_glx" = yes -a "$have_glx" = yes; then
3593    have_egl=no
3594  fi
3595
3596  if test "$have_egl" = yes; then
3597    AC_DEFINE(HAVE_EGL)
3598    if test \! -z "$egl_lib"; then
3599      GL_LIBS="-l$egl_lib $GL_LIBS"
3600    fi
3601  fi
3602
3603  # One of them is required
3604  if test "$have_egl" = no -a "$have_glx" = no; then
3605    have_gl=no
3606    gl_halfassed=yes
3607  fi
3608
3609  # --with-gles means that we are emulating a system that supports GLES but
3610  # does not support OpenGL 1.3 (e.g., using Linux to simulate an Android-like
3611  # environment).  On such a system, GLE is required and GLX wouldn't exist.
3612  # There is no way to request a GLES 3.0 runtime context using GLX.
3613  #
3614  if test "$have_jwzgles" = yes -a "$have_egl" = no; then
3615    AC_MSG_WARN([Using --with-glx and --with-gles together is a bad idea.])
3616  fi
3617
3618fi
3619
3620
3621# Restore flags after testing OpenGL libraries.
3622#
3623CFLAGS="$ac_save_pthreads_CFLAGS"
3624LIBS="$ac_save_pthreads_LIBS"
3625
3626
3627###############################################################################
3628#
3629#       Check for -lgle.
3630#
3631###############################################################################
3632
3633have_gle=no
3634with_gle_req=unspecified
3635gle_halfassed=no
3636AC_ARG_WITH(gle,
3637[  --with-gle              Include support for the GL Extrusion library.],
3638  [with_gle="$withval"; with_gle_req="$withval"],[with_gle=yes])
3639
3640HANDLE_X_PATH_ARG(with_gle, --with-gle, GLE)
3641
3642GLE_LIBS=""
3643
3644if test "$have_gl" = no ; then
3645 true
3646elif test "$with_gle" = yes; then
3647
3648  AC_CHECK_X_HEADER(GL/gle.h, have_gle3=yes, have_gle3=no,
3649                    [#include <GL/gl.h>])
3650  if test "$have_gle3" = yes ; then
3651    have_gle=yes;
3652  else
3653    AC_CHECK_X_HEADER(GL/gutil.h, have_gle=yes, have_gle=no,
3654                    [#include <GL/gl.h>])
3655    if test "$have_gle" = yes ; then
3656      AC_CHECK_X_HEADER(GL/tube.h, have_gle=yes, have_gle=no,
3657                        [#include <GL/gl.h>])
3658    fi
3659  fi
3660
3661  if test "$have_gle" = yes ; then
3662    have_gle=no
3663    gle_halfassed=yes
3664    AC_CHECK_X_LIB(gle, gleCreateGC,
3665                   [have_gle=yes; gle_halfassed=no; GLE_LIBS="-lgle"],
3666                   [], $GL_LIBS -lX11 -lXext -lm)
3667  fi
3668  if test "$have_gle" = yes ; then
3669    have_gle=no
3670    gle_halfassed=yes
3671
3672    # sometimes the libmatrix stuff is included in libgle.  look there first.
3673#
3674# I don't get it.  For some reason, this test passes on SGI, as if
3675# uview_direction_d() was in libgle -- but it's not, it's in libmatrix.
3676# Yet the link is succeeding.  Why???
3677#
3678#    AC_CHECK_X_LIB(gle, uview_direction_d,
3679#                   [have_gle=yes; gle_halfassed=no],
3680#                   [], $GL_LIBS -lX11 -lXext -lm)
3681
3682    # As of GLE 3 this is in libgle, and has changed name to uview_direction!
3683    # *sigh*
3684    if test "$have_gle3" = yes ; then
3685      AC_CHECK_X_LIB(gle, uview_direction,
3686                     [have_gle=yes; gle_halfassed=no],
3687                    [], $GL_LIBS -lX11 -lXext -lm)
3688    fi
3689    # if it wasn't in libgle, then look in libmatrix.
3690    if test "$have_gle" = no ; then
3691      AC_CHECK_X_LIB(matrix, uview_direction_d,
3692                     [have_gle=yes; gle_halfassed=no;
3693                      GLE_LIBS="$GLE_LIBS -lmatrix"],
3694                    [], $GL_LIBS -lX11 -lXext -lm)
3695    fi
3696  fi
3697
3698  if test "$have_gle" = yes ; then
3699    AC_DEFINE(HAVE_GLE)
3700    if test "$have_gle3" = yes ; then
3701      AC_DEFINE(HAVE_GLE3)
3702    fi
3703  fi
3704
3705elif test "$with_gle" != no; then
3706  echo "error: must be yes or no: --with-gle=$with_gle"
3707  exit 1
3708
3709fi
3710
3711
3712###############################################################################
3713#
3714#       Check for -ljpeg
3715#
3716###############################################################################
3717
3718have_jpeg=no
3719with_jpeg_req=unspecified
3720jpeg_halfassed=no
3721AC_ARG_WITH(jpeg,
3722[  --with-jpeg             Include support for the JPEG library.],
3723  [with_jpeg="$withval"; with_jpeg_req="$withval"],
3724  [with_jpeg=yes])
3725
3726HANDLE_X_PATH_ARG(with_jpeg, --with-jpeg, JPEG)
3727
3728if test "$with_jpeg" != yes -a "$with_jpeg" != no ; then
3729  echo "error: must be yes or no: --with-jpeg=$with_jpeg"
3730  exit 1
3731fi
3732
3733if test "$with_jpeg" = yes; then
3734
3735  have_jpeg=no
3736  AC_CHECK_X_HEADER(jpeglib.h, [have_jpeg=yes])
3737
3738  if test "$have_jpeg" = yes; then
3739    # we have the header, now check for the library
3740    have_jpeg=no
3741    jpeg_halfassed=yes
3742    AC_CHECK_X_LIB(jpeg, jpeg_start_compress,
3743                   [have_jpeg=yes
3744                    jpeg_halfassed=no
3745                    JPEG_LIBS="-ljpeg"
3746                    AC_DEFINE(HAVE_JPEGLIB)])
3747  fi
3748fi
3749
3750
3751###############################################################################
3752#
3753#       Check for -lpng
3754#
3755###############################################################################
3756
3757have_png=no
3758with_png_req=unspecified
3759png_halfassed=no
3760AC_ARG_WITH(png,
3761[  --with-png              Include support for the PNG library.],
3762  [with_png="$withval"; with_png_req="$withval"],
3763  [with_png=yes])
3764
3765HANDLE_X_PATH_ARG(with_png, --with-png, PNG)
3766
3767if test "$with_png" != yes -a "$with_png" != no ; then
3768  echo "error: must be yes or no: --with-png=$with_png"
3769  exit 1
3770fi
3771
3772if test "$with_png" = yes; then
3773
3774  have_png=no
3775  AC_CHECK_X_HEADER(png.h, [have_png=yes])
3776
3777  if test "$have_png" = yes; then
3778    # we have the header, now check for the library
3779    have_png=no
3780    png_halfassed=yes
3781    AC_CHECK_X_LIB(png, png_create_read_struct,
3782                   [have_png=yes
3783                    png_halfassed=no
3784                    PNG_LIBS="-lpng"
3785                    AC_DEFINE(HAVE_LIBPNG)])
3786  fi
3787fi
3788
3789
3790###############################################################################
3791#
3792#       Check for -lgdk_pixbuf.
3793#       These tests are for gdk_pixbuf usage of the hacks,
3794#       not xscreensaver-settings (thus we have to test again to get
3795#       the libraries right: don't want to pull in all of GTK
3796#       for the hacks.)
3797#
3798###############################################################################
3799
3800have_gdk_pixbuf=no
3801with_gdk_pixbuf_req=unspecified
3802AC_ARG_WITH(pixbuf,
3803[  --with-pixbuf           Include support for the GDK-Pixbuf library, which
3804                          allows the display of JPEG, PNG, GIF and SVG images.],
3805  [with_gdk_pixbuf="$withval"; with_gdk_pixbuf_req="$withval"],
3806  [with_gdk_pixbuf=yes])
3807
3808# if --with-pixbuf=/directory/ was specified, remember that directory so that
3809# we can also look for the `gdk-pixbuf-config' program in that directory.
3810case "$with_gdk_pixbuf" in
3811  /*)
3812    gdk_pixbuf_dir="$with_gdk_pixbuf"
3813    ;;
3814  *)
3815    gdk_pixbuf_dir=""
3816    ;;
3817esac
3818
3819HANDLE_X_PATH_ARG(with_gdk_pixbuf, --with-pixbuf, GDK_PIXBUF)
3820
3821if test "$with_gdk_pixbuf" != yes -a "$with_gdk_pixbuf" != no ; then
3822  echo "error: must be yes or no: --with-pixbuf=$with_gdk_pixbuf"
3823  exit 1
3824fi
3825
3826if test "$with_gdk_pixbuf" = yes; then
3827  have_gdk_pixbuf=no
3828
3829  pkgs=''
3830  ok="yes"
3831
3832  pkg_check_version gdk-pixbuf-2.0      2.0.0
3833  pkg_check_version gdk-pixbuf-xlib-2.0 2.0.0
3834  pkg_check_version gio-2.0             2.0.0
3835  have_gdk_pixbuf="$ok"
3836
3837  if test "$have_gdk_pixbuf" = yes; then
3838    AC_CACHE_CHECK([for gdk-pixbuf includes], ac_cv_gdk_pixbuf_config_cflags,
3839               [ac_cv_gdk_pixbuf_config_cflags=`$pkg_config --cflags $pkgs`])
3840    AC_CACHE_CHECK([for gdk-pixbuf libs], ac_cv_gdk_pixbuf_config_libs,
3841               [ac_cv_gdk_pixbuf_config_libs=`$pkg_config --libs $pkgs`])
3842  fi
3843
3844  ac_gdk_pixbuf_config_cflags=$ac_cv_gdk_pixbuf_config_cflags
3845  ac_gdk_pixbuf_config_libs=$ac_cv_gdk_pixbuf_config_libs
3846
3847
3848  if test "$have_gdk_pixbuf" = yes; then
3849    #
3850    # we appear to have pixbuf; check for headers/libs to be sure.
3851    #
3852    ac_save_gdk_pixbuf_CPPFLAGS="$CPPFLAGS"
3853    CPPFLAGS="$CPPFLAGS $ac_gdk_pixbuf_config_cflags"
3854
3855    have_gdk_pixbuf=no
3856
3857    # check for header A...
3858    AC_CHECK_X_HEADER(gdk-pixbuf/gdk-pixbuf.h, [have_gdk_pixbuf=yes])
3859
3860    # if that worked, check for header B...
3861    if test "$have_gdk_pixbuf" = yes; then
3862      have_gdk_pixbuf=no
3863      gdk_pixbuf_halfassed=yes
3864      AC_CHECK_X_HEADER(gdk-pixbuf/gdk-pixbuf-xlib.h,
3865                        [have_gdk_pixbuf=yes
3866                         gdk_pixbuf_halfassed=no])
3867
3868      # yay, it has a new name in Gtk 2.x...
3869      if test "$have_gdk_pixbuf" = no; then
3870        have_gdk_pixbuf=no
3871        gdk_pixbuf_halfassed=yes
3872        AC_CHECK_X_HEADER(gdk-pixbuf-xlib/gdk-pixbuf-xlib.h,
3873                          [have_gdk_pixbuf=yes
3874                           gdk_pixbuf_halfassed=no])
3875      fi
3876    fi
3877    CPPFLAGS="$ac_save_gdk_pixbuf_CPPFLAGS"
3878  fi
3879
3880  if test "$have_gdk_pixbuf" = yes; then
3881    # we have the headers, now check for the libraries
3882    have_gdk_pixbuf=no
3883    gdk_pixbuf_halfassed=yes
3884
3885    AC_MSG_RESULT(checking for gdk_pixbuf usability...)
3886
3887    # library A...
3888    AC_CHECK_X_LIB(c, gdk_pixbuf_new_from_file, [have_gdk_pixbuf=yes],,
3889                   $ac_gdk_pixbuf_config_libs -lX11 -lXext -lm)
3890    # library B...
3891    if test "$have_gdk_pixbuf" = yes; then
3892      have_gdk_pixbuf=no
3893      AC_CHECK_X_LIB(c, gdk_pixbuf_xlib_init,
3894                     [have_gdk_pixbuf=yes
3895                      gdk_pixbuf_halfassed=no],,
3896                     $ac_gdk_pixbuf_config_libs -lX11 -lXext -lm)
3897    fi
3898  fi
3899
3900  if test "$have_gdk_pixbuf" = yes; then
3901    INCLUDES="$INCLUDES $ac_gdk_pixbuf_config_cflags"
3902    PNG_LIBS="$ac_gdk_pixbuf_config_libs"
3903    AC_DEFINE(HAVE_GDK_PIXBUF)
3904  else
3905    AC_MSG_RESULT(checking for gdk_pixbuf usability... no)
3906  fi
3907
3908  if test "$have_gdk_pixbuf" = yes; then
3909    AC_CHECK_X_LIB(c, gdk_pixbuf_apply_embedded_orientation,
3910                     [AC_DEFINE(HAVE_GDK_PIXBUF_APPLY_EMBEDDED_ORIENTATION)],,
3911                     $ac_gdk_pixbuf_config_libs -lX11 -lXext -lm)
3912  fi
3913fi
3914
3915
3916###############################################################################
3917#
3918#       Check for -lXft
3919#
3920###############################################################################
3921
3922have_xutf8drawstring=no
3923AC_CHECK_X_LIB(X11, Xutf8DrawString,
3924               [have_xutf8drawstring=yes],
3925               [true], -lX11 -lXext -lm)
3926if test "$have_xutf8drawstring" = yes ; then
3927  AC_DEFINE(HAVE_XUTF8DRAWSTRING)
3928fi
3929
3930
3931have_xft=no
3932with_xft_req=unspecified
3933xft_halfassed=no
3934AC_ARG_WITH(xft,
3935[  --with-xft              Include support for the X Freetype library.
3936  --with-pthread          Enables POSIX threads, for SMP support.],
3937  [with_xft="$withval"; with_xft_req="$withval"],
3938  [with_xft=yes])
3939
3940HANDLE_X_PATH_ARG(with_xft, --with-xft, Xft)
3941
3942if test "$with_xft" != yes -a "$with_xft" != no ; then
3943  echo "error: must be yes or no: --with-xft=$with_xft"
3944  exit 1
3945fi
3946
3947if test "$with_xft" = yes; then
3948
3949  pkgs=''
3950  ok="yes"
3951  pkg_check_version xft 2.1.0
3952  have_xft="$ok"
3953
3954  if test "$have_xft" = yes; then
3955    AC_CACHE_CHECK([for Xft includes], ac_cv_xft_config_cflags,
3956               [ac_cv_xft_config_cflags=`$pkg_config --cflags $pkgs`])
3957    AC_CACHE_CHECK([for Xft libs], ac_cv_xft_config_libs,
3958               [ac_cv_xft_config_libs=`$pkg_config --libs $pkgs`])
3959  fi
3960
3961  ac_xft_config_cflags=$ac_cv_xft_config_cflags
3962  ac_xft_config_libs=$ac_cv_xft_config_libs
3963
3964  if test "$have_xft" = yes; then
3965    #
3966    # we appear to have Xft; check for headers/libs to be sure.
3967    #
3968    ac_save_xft_CPPFLAGS="$CPPFLAGS"
3969    CPPFLAGS="$CPPFLAGS $ac_xft_config_cflags"
3970
3971    have_xft=no
3972    AC_CHECK_X_HEADER(X11/Xft/Xft.h, [have_xft=yes])
3973
3974    CPPFLAGS="$ac_save_xft_CPPFLAGS"
3975  fi
3976
3977  if test "$have_xft" = yes; then
3978    # we have the headers, now check for the libraries
3979    have_xft=no
3980    xft_halfassed=yes
3981
3982    AC_MSG_RESULT(checking for Xft usability...)
3983    AC_CHECK_X_LIB(c, XftDrawStringUtf8, [have_xft=yes],,
3984                   $ac_xft_config_libs -lX11 -lXext -lm)
3985  fi
3986
3987  if test "$have_xft" = no; then
3988    AC_MSG_RESULT(checking for Xft usability... no)
3989  fi
3990fi
3991
3992if test "$have_xft" = yes; then
3993  INCLUDES="$INCLUDES $ac_xft_config_cflags"
3994  XFT_LIBS="$ac_xft_config_libs"
3995  XFT_SRCS=''
3996  XFT_OBJS=''
3997  AC_DEFINE(HAVE_XFT)
3998else
3999  XFT_LIBS=''
4000  XFT_SRCS='$(UTILS_SRC)/xft.c'
4001  XFT_OBJS='$(UTILS_BIN)/xft.o'
4002fi
4003
4004
4005###############################################################################
4006#
4007#       Check for pty support: this allows 'phosphor' and 'apple2'
4008#	to run curses-based programs, or be used as terminal windows.
4009#
4010###############################################################################
4011
4012PTY_LIBS=
4013AC_CHECK_HEADERS(pty.h util.h sys/termios.h)
4014AC_CHECK_X_LIB(util, forkpty,
4015               [PTY_LIBS="-lutil"
4016                ac_have_forkpty=yes
4017                AC_DEFINE(HAVE_FORKPTY)])
4018
4019if test "$ac_have_forkpty" != yes ; then
4020  # we don't need (or have) -lutil on macOS 10.4.2...
4021  AC_CHECK_X_LIB(c, forkpty,
4022                 [PTY_LIBS=""
4023                  AC_DEFINE(HAVE_FORKPTY)])
4024fi
4025
4026
4027###############################################################################
4028#
4029#       Check for libcap, which allows "sonar" to work without setuid.
4030#       Except, nevermind, that's bad.  See comments in sonar-icmp.c.
4031#
4032###############################################################################
4033
4034have_libcap=no
4035setcap_hacks_default=no
4036setcap_hacks="$setcap_hacks_default"
4037setcap_hacks_req=unspecified
4038
4039#AC_ARG_WITH(setcap-hacks,
4040#[  --with-setcap-hacks     Build the "sonar" demo with libcap, which allows
4041#                          it to ping other hosts without being setuid.],
4042#  [setcap_hacks="$withval"; setcap_hacks_req="$withval"],
4043#  [setcap_hacks=yes])
4044#
4045#HANDLE_X_PATH_ARG(setcap_hacks, --with-setcap-hacks, setcap hacks)
4046#
4047#if test "$setcap_hacks" != yes -a "$setcap_hacks" != no ; then
4048#  echo "error: must be yes or no: --with-setcap-hacks=$setcap_hacks"
4049#  exit 1
4050#fi
4051#
4052#if test "$setcap_hacks" = yes; then
4053#
4054#  AC_CHECK_PROGS(setcap_program, setcap)
4055#  if test "$setcap_program" != ''; then
4056#    AC_CHECK_X_HEADER(sys/capability.h, [have_setcap=yes])
4057#  fi
4058#  if test "$have_setcap" = yes; then
4059#    AC_CHECK_X_LIB(cap, cap_set_flag,
4060#                   [have_libcap=yes
4061#                    PROG_SETCAP="$setcap_program"
4062#                    LIBCAP_LIBS="-lcap"
4063#                    AC_DEFINE(HAVE_LIBCAP)])
4064#  fi
4065#fi
4066
4067
4068###############################################################################
4069#
4070#       Sonar must be setuid to be able to ping other hosts.
4071#
4072###############################################################################
4073
4074if test "$have_libcap" = yes; then
4075  setuid_hacks_default=no
4076else
4077  setuid_hacks_default=yes
4078fi
4079
4080setuid_hacks="$setuid_hacks_default"
4081AC_ARG_WITH(setuid-hacks,
4082[  --with-setuid-hacks     Install the "sonar" demo as setuid root, which is
4083                          needed in order to ping other hosts.],
4084  [setuid_hacks="$withval"], [setuid_hacks="$setuid_hacks_default"])
4085
4086HANDLE_X_PATH_ARG(setuid_hacks, --with-setuid-hacks, setuid hacks)
4087
4088if test "$setuid_hacks" = yes; then
4089  true
4090elif test "$setuid_hacks" != no; then
4091  echo "error: must be yes or no: --with-setuid-hacks=$setuid_hacks"
4092  exit 1
4093fi
4094
4095
4096###############################################################################
4097#
4098#       Check for --with-record-animation
4099#
4100###############################################################################
4101
4102record_anim_default=no
4103record_anim="$record_anim_default"
4104AC_ARG_WITH(record-animation,
4105[  --with-record-animation Include code for generating MP4 videos.],
4106  [record_anim="$withval"], [record_anim="$record_anim_default"])
4107
4108HANDLE_X_PATH_ARG(record_anim, --with-record-animation, record animation)
4109
4110if test "$record_anim" = yes; then
4111  true
4112elif test "$record_anim" != no; then
4113  echo "error: must be yes or no: --with-record-animation=$record_anim"
4114  exit 1
4115fi
4116
4117if test "$record_anim" = yes; then
4118  if test "$have_gdk_pixbuf" != yes; then
4119    AC_MSG_ERROR(--with-record-animation requires GDK-Pixbuf)
4120  else
4121    AC_MSG_RESULT(enabling --with-record-animation)
4122    AC_DEFINE(HAVE_RECORD_ANIM)
4123    ANIM_OBJS='$(ANIM_OBJS)'
4124    ANIM_LIBS='$(ANIM_LIBS)'
4125  fi
4126fi
4127
4128
4129###############################################################################
4130#
4131#       Done testing.  Now, set up the various -I and -L variables,
4132#       and decide which GUI program to build by default.
4133#
4134###############################################################################
4135
4136DEPEND=makedepend
4137DEPEND_FLAGS=
4138DEPEND_DEFINES=
4139
4140
4141if test \! -z "$includedir" ; then
4142  INCLUDES="$INCLUDES -I$includedir"
4143fi
4144
4145if test \! -z "$libdir" ; then
4146  LDFLAGS="$LDFLAGS -L$libdir"
4147fi
4148
4149
4150PREFERRED_DEMO_PROGRAM=''
4151ALL_DEMO_PROGRAMS=
4152if test "$have_motif" = yes; then
4153  PREFERRED_DEMO_PROGRAM=xscreensaver-settings-Xm
4154  ALL_DEMO_PROGRAMS="$PREFERRED_DEMO_PROGRAM $ALL_DEMO_PROGRAMS"
4155fi
4156if test "$have_gtk" = yes; then
4157  PREFERRED_DEMO_PROGRAM=xscreensaver-settings-Gtk
4158  ALL_DEMO_PROGRAMS="$PREFERRED_DEMO_PROGRAM $ALL_DEMO_PROGRAMS"
4159fi
4160
4161
4162if test "$have_kerberos" = yes; then
4163  PASSWD_SRCS="$PASSWD_SRCS \$(KERBEROS_SRCS)"
4164  PASSWD_OBJS="$PASSWD_OBJS \$(KERBEROS_OBJS)"
4165fi
4166if test "$have_pam" = yes; then
4167  PASSWD_SRCS="$PASSWD_SRCS \$(PAM_SRCS)"
4168  PASSWD_OBJS="$PASSWD_OBJS \$(PAM_OBJS)"
4169  INSTALL_PAM="install-pam"
4170fi
4171if test "$enable_pam_check_account_type" = yes; then
4172  COMMENT_PAM_CHECK_ACCOUNT=""
4173else
4174  COMMENT_PAM_CHECK_ACCOUNT="#"
4175fi
4176#if test "$have_passwd_helper" = yes; then
4177#  PASSWD_SRCS="$PASSWD_SRCS \$(PWHELPER_SRCS)"
4178#  PASSWD_OBJS="$PASSWD_OBJS \$(PWHELPER_OBJS)"
4179#fi
4180  PASSWD_SRCS="$PASSWD_SRCS \$(PWENT_SRCS)"
4181  PASSWD_OBJS="$PASSWD_OBJS \$(PWENT_OBJS)"
4182
4183
4184if test "$enable_locking" = yes; then
4185  LOCK_SRCS='$(LOCK_SRCS_1) $(PASSWD_SRCS)'
4186  LOCK_OBJS='$(LOCK_OBJS_1) $(PASSWD_OBJS)'
4187else
4188  LOCK_SRCS='$(NOLOCK_SRCS_1)'
4189  LOCK_OBJS='$(NOLOCK_OBJS_1)'
4190fi
4191
4192if test "$ac_macosx" = yes; then
4193  EXES_OSX='$(EXES_OSX)'
4194  SCRIPTS_OSX='$(SCRIPTS_OSX)'
4195  MEN_OSX='$(MEN_OSX)'
4196else
4197  EXES_OSX=
4198  SCRIPTS_OSX=
4199  MEN_OSX=
4200fi
4201
4202
4203if test "$setuid_auth" = yes; then
4204  SETUID_AUTH=yes
4205else
4206  SETUID_AUTH=no
4207fi
4208
4209if test "$setuid_hacks" = yes; then
4210  SETUID_HACKS=yes
4211else
4212  SETUID_HACKS=no
4213fi
4214
4215if test "$have_libcap" = yes; then
4216  SETCAP_HACKS=yes
4217else
4218  SETCAP_HACKS=no
4219fi
4220
4221tab='	'
4222if test "$have_gl" = yes; then
4223  GL_EXES='$(GL_EXES)'
4224  SUID_EXES='$(SUID_EXES)'
4225  RETIRED_GL_EXES='$(RETIRED_GL_EXES)'
4226  GL_UTIL_EXES='$(GL_UTIL_EXES)'
4227  GL_MEN='$(GL_MEN)'
4228  GL_KLUDGE=" "
4229else
4230  GL_KLUDGE="-"
4231fi
4232
4233if test "$have_gle" = yes; then
4234  GLE_EXES='$(GLE_EXES)'
4235  GLE_KLUDGE=" "
4236else
4237  GLE_KLUDGE="-"
4238fi
4239
4240if test "$have_jpeg" = yes -a "$have_gdk_pixbuf" = yes; then
4241 JPEG_EXES='$(JPEG_EXES)'
4242fi
4243
4244
4245# Another substitution in the XScreenSaver.ad.in file:
4246#
4247if test "$gnome_open_program" != ''; then
4248  GNOME24=''
4249  GNOME22='!	'
4250  NOGNOME='!	'
4251elif test "$gnome_url_show_program" != ''; then
4252  GNOME24='!	'
4253  GNOME22=''
4254  NOGNOME='!	'
4255else
4256  GNOME24='!	'
4257  GNOME22='!	'
4258  NOGNOME=''
4259fi
4260
4261
4262# Set PO_DATADIR to something sensible.
4263#
4264AC_MSG_CHECKING([for locale directory])
4265if test -n "$GTK_DATADIR" ; then
4266  PO_DATADIR="$GTK_DATADIR"
4267elif test "$have_gtk" = yes; then
4268  PO_DATADIR=`$pkg_config --variable=prefix gtk+-2.0`
4269  PO_DATADIR="$PO_DATADIR/share"
4270fi
4271
4272if test -z "$PO_DATADIR" ; then
4273  #
4274  # #### Total fucking kludge --
4275  # Map /build/prefix/usr/X11R6/share/ to /build/prefix/usr/share/
4276  # but of course we need to expand all the nested variables to do that...
4277  #
4278  dd=`eval eval eval eval eval eval eval eval eval eval eval echo $datadir`
4279  PO_DATADIR=`echo $dd | sed 's@/X11R6/@/@'`
4280fi
4281
4282AC_MSG_RESULT($PO_DATADIR/locale)
4283
4284
4285# canonicalize slashes.
4286HACK_CONF_DIR=`echo "${HACK_CONF_DIR}" | sed 's@/$@@;s@//*@/@g'`
4287FONT_DIR=`echo "${FONT_DIR}" | sed 's@/$@@;s@//*@/@g'`
4288
4289# gcc 3.0 likes to issue this warning for every file:
4290#
4291# cc1: warning: changing search order for system directory "/usr/local/include"
4292# cc1: warning:   as it has already been specified as a non-system directory
4293#
4294# Yay.  We can only avoid that by deleting "-I${prefix}/include" from the list.
4295# Which *should* be totally redundant, and thus an ok thing to delete?
4296#
4297INCLUDES=`echo "$INCLUDES" | sed 's@ -I${prefix}/include@@g;'`
4298
4299
4300###############################################################################
4301#
4302#       Perform substitutions and write Makefiles.
4303#
4304###############################################################################
4305
4306AC_SUBST(INCLUDES)
4307
4308AC_SUBST(PREFERRED_DEMO_PROGRAM)
4309AC_SUBST(ALL_DEMO_PROGRAMS)
4310AC_SUBST(SAVER_LIBS)
4311AC_SUBST(MOTIF_LIBS)
4312AC_SUBST(GTK_LIBS)
4313AC_SUBST(XML_LIBS)
4314AC_SUBST(PNG_LIBS)
4315AC_SUBST(JPEG_LIBS)
4316AC_SUBST(HACK_LIBS)
4317AC_SUBST(PTY_LIBS)
4318AC_SUBST(GL_LIBS)
4319AC_SUBST(GLE_LIBS)
4320AC_SUBST(XDPMS_LIBS)
4321AC_SUBST(PTHREAD_LIBS)
4322AC_SUBST(XINERAMA_LIBS)
4323AC_SUBST(PASSWD_LIBS)
4324AC_SUBST(LIBCAP_CFLAGS)
4325AC_SUBST(LIBCAP_LIBS)
4326AC_SUBST(PROG_SETCAP)
4327AC_SUBST(SETUID_AUTH)
4328AC_SUBST(SETUID_HACKS)
4329AC_SUBST(SETCAP_HACKS)
4330AC_SUBST(INSTALL_DIRS)
4331AC_SUBST(INSTALL_PAM)
4332AC_SUBST(HAVE_PAM_FAIL_DELAY)
4333AC_SUBST(COMMENT_PAM_CHECK_ACCOUNT)
4334AC_SUBST(NEW_LOGIN_COMMAND)
4335AC_SUBST(NEW_LOGIN_COMMAND_P)
4336AC_SUBST(DEFAULT_IMAGES_P)
4337AC_SUBST(DEFAULT_IMAGE_DIRECTORY)
4338AC_SUBST(DEFAULT_TEXT_FILE)
4339AC_SUBST(WITH_BROWSER)
4340
4341AC_SUBST(EXES_OSX)
4342AC_SUBST(EXES_SYSTEMD)
4343AC_SUBST(SYSTEMD_LIBS)
4344AC_SUBST(SCRIPTS_OSX)
4345AC_SUBST(MEN_OSX)
4346
4347AC_SUBST(PASSWD_SRCS)
4348AC_SUBST(PASSWD_OBJS)
4349AC_SUBST(XFT_SRCS)
4350AC_SUBST(XFT_OBJS)
4351AC_SUBST(XFT_LIBS)
4352AC_SUBST(LOCK_SRCS)
4353AC_SUBST(LOCK_OBJS)
4354AC_SUBST(JPEG_EXES)
4355AC_SUBST(GL_EXES)
4356AC_SUBST(RETIRED_GL_EXES)
4357AC_SUBST(SUID_EXES)
4358AC_SUBST(GL_UTIL_EXES)
4359AC_SUBST(GL_MEN)
4360AC_SUBST(GL_KLUDGE)
4361AC_SUBST(GLE_EXES)
4362AC_SUBST(GLE_KLUDGE)
4363AC_SUBST(JWZGLES_OBJS)
4364AC_SUBST(GNOME24)
4365AC_SUBST(GNOME22)
4366AC_SUBST(NOGNOME)
4367AC_SUBST(HACKDIR)
4368AC_SUBST(HACKDIR_FULL)
4369AC_SUBST(GTK_DATADIR)
4370AC_SUBST(PO_DATADIR)
4371AC_SUBST(HACK_CONF_DIR)
4372AC_SUBST(FONT_DIR)
4373AC_SUBST(ANIM_OBJS)
4374AC_SUBST(ANIM_LIBS)
4375
4376APPDEFAULTS=$ac_x_app_defaults
4377AC_SUBST(APPDEFAULTS)
4378
4379AC_SUBST(DEPEND)
4380AC_SUBST(DEPEND_FLAGS)
4381AC_SUBST(DEPEND_DEFINES)
4382AC_SUBST(PERL)
4383
4384AC_CONFIG_FILES([Makefile
4385          utils/Makefile
4386          jwxyz/Makefile
4387          hacks/Makefile
4388          xlockmore/xlock/Makefile
4389          xlockmore/modes/Makefile
4390          xlockmore/modes/glx/Makefile
4391          hacks/fonts/Makefile
4392          hacks/images/Makefile
4393          hacks/glx/Makefile
4394          po/Makefile.in
4395          driver/Makefile
4396          driver/xscreensaver.pam
4397          driver/XScreenSaver.ad])
4398AC_OUTPUT
4399
4400###############################################################################
4401#
4402#       Print some warnings at the end.
4403#
4404###############################################################################
4405
4406warn_prefix_1="    Warning:"
4407warn_prefix_2="       Note:"
4408warn_prefix="$warn_prefix_1"
4409
4410warning=no
4411warnsep='    #################################################################'
4412
4413warnpre() {
4414  if test "$warning" = no ; then
4415    echo '' ; echo "$warnsep" ; echo ''
4416    warning=yes
4417  fi
4418}
4419
4420warn() {
4421  warnpre
4422  if test "$warning" = long ; then echo '' ; fi
4423  warning=yes
4424  rest="$@"
4425  echo "$warn_prefix $rest"
4426}
4427
4428warnL() {
4429  was=$warning
4430  warnpre
4431  warning=yes
4432  if test "$was" != no ; then echo '' ; fi
4433  rest="$@"
4434  echo "$warn_prefix $rest"
4435}
4436
4437warn2() {
4438  rest="$@"
4439  echo "             $rest"
4440  warning=long
4441}
4442
4443note() {
4444  warn_prefix="$warn_prefix_2"
4445  warn $@
4446  warn_prefix="$warn_prefix_1"
4447}
4448
4449noteL() {
4450  warn_prefix="$warn_prefix_2"
4451  warnL $@
4452  warn_prefix="$warn_prefix_1"
4453}
4454
4455
4456# ac_prog_cc_no_pthread normally only happens on AIX, because according
4457# to AX_PTHREAD, AIX needs CC=xlc_r or CC=cc_r to do threads.
4458# If CC is specified, it takes precedence over --with-pthread.
4459if test "$ac_prog_cc_no_pthread" ; then
4460  warnL "You requested $ac_original_cc for the C compiler, but it doesn't"
4461  warn2 "support POSIX threads."
4462  echo ""
4463  warn2 "If you have multiple CPU cores, try CC=$PTHREAD_CC."
4464elif test "$with_pthread_req" = yes -a "$have_pthread" = no ; then
4465  warn 'POSIX threads were requested, but were not found.'
4466fi
4467
4468if test "$with_sgi_req" = yes -a "$have_sgi" = no ; then
4469  warn 'The SGI saver extension was requested, but was not found.'
4470fi
4471
4472if test "$with_xidle_req" = yes -a "$have_xidle" = no ; then
4473  warn 'The XIdle extension was requested, but was not found.'
4474fi
4475
4476if test "$with_mit_req" = yes -a "$have_mit" = no ; then
4477  warn 'The MIT-SCREEN-SAVER extension was requested, but was not found.'
4478fi
4479
4480if test "$with_xshm_req" = yes -a "$have_xshm" = no ; then
4481  warn 'The XSHM extension was requested, but was not found.'
4482fi
4483
4484if test "$with_xdbe_req" = yes -a "$have_xdbe" = no ; then
4485  warn 'The DOUBLE-BUFFER extension was requested, but was not found.'
4486fi
4487
4488#if test "$with_xcomposite_req" = yes -a "$have_xcomposite" = no ; then
4489#  warn 'The XCOMPOSITE extension was requested, but was not found.'
4490#fi
4491
4492if test "$with_xkb_req" = yes -a "$have_xkb" = no ; then
4493  warn 'The X Keyboard extension was requested, but was not found.'
4494fi
4495
4496if test "$with_sgivc_req" = yes -a "$have_sgivc" = no ; then
4497  warn 'The SGI-VIDEO-CONTROL extension was requested, but was not found.'
4498fi
4499
4500if test "$with_dpms_req" = yes -a "$have_dpms" = no ; then
4501  warn 'The DPMS extension was requested, but was not found.'
4502fi
4503
4504if test "$with_xinerama_req" = yes -a "$have_xinerama" = no ; then
4505  warn 'The Xinerama extension was requested, but was not found.'
4506fi
4507
4508if test "$with_xf86vmode_req" = yes -a "$have_xf86vmode" = no ; then
4509  warn 'The XF86VMODE extension was requested, but was not found.'
4510fi
4511
4512if test "$with_randr_req" = yes -a "$have_randr" = no ; then
4513  warn 'The RANDR extension was requested, but was not found.'
4514fi
4515
4516if test "$with_proc_interrupts_req" = yes -a "$have_proc_interrupts" = no; then
4517  warn "Checking of /proc/interrupts was requested, but it's bogus."
4518fi
4519
4520if test "$pkg_config" = false ; then
4521  warnL 'The "pkg-config" program was not found.  Without that,'
4522  warn2 "detection of the various GTK libraries won't work."
4523else
4524  pkgerr=`$pkg_config --list-all 2>&1 >/dev/null`
4525  if test "x$pkgerr" != "x" ; then
4526    warnL 'The "pkg-config" program produces errors.  This often causes'
4527    warn2 "detection of the various GTK libraries to malfunction."
4528    warn2 "The errors are:"
4529    echo ''
4530    echo "$pkgerr" | sed 's/^/             > /g'
4531  fi
4532fi
4533
4534if test "$gtk_halfassed" != no ; then
4535  warnL "GTK was found, but $gtk_halfassed_lib was not, so GTK can't be used."
4536fi
4537
4538motif_warn2() {
4539  warn2 'Though the Motif front-end to xscreensaver is still'
4540  warn2 'maintained, it is no longer being updated with new'
4541  warn2 'features: all new development on the xscreensaver-settings'
4542  warn2 'program is happening in the GTK version, and not in the'
4543  warn2 'Motif version.  It is recommended that you build against'
4544  warn2 'GTK instead of Motif.  See <http://www.gtk.org/>.'
4545}
4546
4547if test "$have_motif" = no -a "$have_gtk" = no; then
4548
4549  if test "$with_motif" = yes; then
4550    warnL "Neither the GTK nor Motif libraries were found; the"
4551    warn2 "\`xscreensaver-settings' program requires one of these."
4552    echo ''
4553    motif_warn2
4554  else
4555    warnL "The GTK libraries do not seem to be available; the"
4556    warn2 "\`xscreensaver-settings' program requires them."
4557#   echo ''
4558#   warn2 'You can use Motif or Lesstif instead of GTK (use the'
4559#   warn2 "\`--with-motif' option) but that is NOT recommended."
4560#   motif_warn2
4561  fi
4562
4563elif test "$with_motif_req" = yes -a "$have_motif" = no ; then
4564  warnL "Use of Motif was requested, but it wasn't found;"
4565  warn2 "Gtk will be used instead."
4566
4567elif test "$with_gtk_req" = yes -a "$have_gtk" = no ; then
4568  warnL "Use of Gtk was requested, but it wasn't found."
4569fi
4570
4571
4572if test "$ac_cv_libxt" != yes ; then
4573  warnL 'The Xt library was not found.  It is required.'
4574fi
4575
4576if test "$have_gtk" = yes -a "$have_gdk_pixbuf" = no ; then
4577  warn  "GTK is being used, but the GDK-Pixbuf library and/or"
4578  warn2 "headers were not found.  That can't be good.  Please"
4579  warn2 "install the GDK-Pixbuf development kit and re-configure."
4580fi
4581
4582if test "$have_motif" = yes -a "$have_lesstif" = yes ; then
4583
4584  preferred_lesstif=0.92
4585
4586  if test "$lesstif_version" = unknown; then
4587    warnL "Unable to determine the LessTif version number!"
4588    warn2 "Make sure you are using version $preferred_lesstif or newer."
4589    warn2 "See <http://www.lesstif.org/>."
4590
4591  elif test \! $lesstif_version -gt 82; then
4592    warnL "LessTif version $lesstif_version_string is being used."
4593    warn2 "LessTif versions 0.82 and earlier are too buggy to"
4594    warn2 "use with XScreenSaver; it is strongly recommended"
4595    warn2 "that you upgrade to at least version $preferred_lesstif!"
4596    warn2 "See <http://www.lesstif.org/>."
4597  fi
4598fi
4599
4600
4601if test "$have_motif" = yes -a "$have_gtk" = no ; then
4602  warn  'Motif is being used, and GTK is not.'
4603  echo  ''
4604  motif_warn2
4605fi
4606
4607halfassery() {
4608  echo ''
4609  warn2 "More specifically, we found the headers but not the"
4610  warn2 "libraries.  Possibly a 'devel' package is needed."
4611}
4612
4613if test "$with_gdk_pixbuf_req" = yes  -a "$have_gdk_pixbuf" = no; then
4614  warnL 'Use of GDK-Pixbuf was requested, but it was not found.'
4615fi
4616
4617if test "$have_gdk_pixbuf" = no -o "$gdk_pixbuf_halfassed" = yes || \
4618   test "$have_gdk_pixbuf" = no ; then
4619
4620  if test "$with_gdk_pixbuf_req" = yes ; then
4621    true
4622  elif test "$with_gdk_pixbuf_req" = no ; then
4623    warnL 'The GDK-Pixbuf library is not being used.'
4624  else
4625    warnL 'The GDK-Pixbuf library was not found.'
4626  fi
4627
4628  if test "$gdk_pixbuf_halfassed" = yes ; then halfassery ; fi
4629  if test "$have_png" = yes ; then
4630    echo ''
4631    warn2 'The PNG library is being used instead.'
4632  fi
4633
4634  echo ''
4635  warn2 'Some of the demos will not use images as much as they could.'
4636  warn2 'You should consider installing GDK-Pixbuf and re-running'
4637  warn2 'configure.'
4638fi
4639
4640
4641if test "$have_jpeg" = no ; then
4642  if test "$with_jpeg_req" = yes ; then
4643    warnL 'Use of libjpeg was requested, but it was not found.'
4644  elif test "$with_jpeg_req" = no ; then
4645    warnL 'The JPEG library is not being used.'
4646  else
4647    warnL 'The JPEG library was not found.'
4648  fi
4649
4650  if test "$jpeg_halfassed" = yes ; then halfassery ; fi
4651  if test "$have_gdk_pixbuf" = no ; then
4652    echo ''
4653    warn2 "This means that it won't be possible for the image-manipulating"
4654    warn2 "display modes to load files from disk; and it also means that"
4655    warn2 "the \`webcollage' program will be much slower."
4656  else
4657    warn2 "This means the \`webcollage' program will be much slower."
4658  fi
4659fi
4660
4661
4662if test "$have_png" = no ; then
4663  if test "$with_png_req" = yes ; then
4664    warnL 'Use of libpng was requested, but it was not found.'
4665  elif test "$with_png_req" = no ; then
4666    warnL 'The PNG library is not being used.'
4667  else
4668    warnL 'The PNG library was not found.'
4669  fi
4670
4671  if test "$png_halfassed" = yes ; then halfassery ; fi
4672  warn2 "Many things aren't going to work right."
4673fi
4674
4675
4676if test "$have_xinput" = no ; then
4677  warnL 'The XInput2 library was not found.  It is required.'
4678  if test "$xinput_halfassed" = yes ; then halfassery ; else echo '' ; fi
4679fi
4680
4681
4682if test "$have_xft" = no ; then
4683  warnL 'The XFreeType library was not found.  It is required.'
4684  if test "$xft_halfassed" = yes ; then halfassery ; else echo '' ; fi
4685fi
4686
4687
4688if test "$have_systemd" = no ; then
4689  systemd_warned=no
4690  if test "$systemd_too_old" = yes ; then
4691    warnL "The systemd library is too old."
4692    systemd_warned=yes
4693  elif test "$with_systemd_req" = yes ; then
4694    warnL "Use of systemd was requested, but it was not found."
4695    systemd_warned=yes
4696  elif test "$ac_macosx" = yes; then
4697    true
4698  elif test "$with_systemd_req" = no ; then
4699    noteL 'The systemd library is not being used.'
4700    systemd_warned=yes
4701  else
4702    warnL "The systemd library was not found."
4703    systemd_warned=yes
4704  fi
4705
4706  if test "$systemd_halfassed" = yes ; then
4707    halfassery
4708    systemd_warned=yes
4709  fi
4710
4711  if test "$systemd_warned" = yes; then
4712    echo ''
4713    warn2 "This means that xscreensaver-systemd won't be built."
4714    warn2 "Without that, xscreensaver will not be able to auto-lock"
4715    warn2 "before the system is suspended (e.g., closing laptop lid)"
4716    warn2 "and might activate while video playback is in progress."
4717  fi
4718fi
4719
4720
4721if test "$have_gl" = no ; then
4722  if test "$with_gl_req" = yes ; then
4723    warnL 'Use of GL was requested, but it was not found.'
4724  elif test "$with_gl_req" = no ; then
4725    noteL 'The OpenGL 3D library is not being used.'
4726  else
4727    noteL 'The OpenGL 3D library was not found.'
4728  fi
4729
4730  if test "$gl_halfassed" = yes ; then
4731    halfassery
4732    if test "$have_glx" = no -a "$have_egl" = no; then
4733      echo ''
4734      warn2 'Neither EGL nor GLX were found.'
4735    fi
4736  fi
4737
4738  echo ''
4739  warn2 'Those demos which use 3D will not be built or installed.'
4740  warn2 'You might want to consider installing OpenGL and'
4741  warn2 're-running configure.'
4742
4743fi
4744
4745if test "$have_gl" = yes -a "$have_gle" = no ; then
4746
4747 # nobody cares about this; don't print the warning unless it was
4748 # requested and not found, or halfway-found.
4749 if test "$with_gle_req" = yes -o "$gle_halfassed" = yes ; then
4750
4751  if test "$with_gle_req" = yes ; then
4752    noteL 'Use of the GLE (GL Extrusion) library was requested, but'
4753    warn2 'it was not found (though the OpenGL library was found, and'
4754    warn2 'is being used.)'
4755  elif test "$with_gle_req" = no ; then
4756    noteL 'The OpenGL Library is being used, but the GLE (GL Extrusion)'
4757    warn2 'library is not.'
4758  else
4759    noteL 'The OpenGL Library was found, but the GLE (GL Extrusion)'
4760    warn2 'library was not.'
4761  fi
4762
4763  if test "$gle_halfassed" = yes ; then halfassery ; fi
4764
4765  echo ''
4766  warn2 'Some of the OpenGL (3D) demos (those that depend on GLE)'
4767  warn2 'will not be built or installed.  You might want to consider'
4768  warn2 'installing GLE and re-running configure.  You can find the'
4769  warn2 'GLE library at <http://www.linas.org/gle/>'
4770
4771 fi
4772fi
4773
4774
4775if test "$with_readdisplay_req" = yes -a "$have_readdisplay" = no ; then
4776  warn 'Use of XReadDisplay was requested, but it was not found.'
4777fi
4778
4779if test "$with_kerberos_req" = yes -a "$have_kerberos" = no ; then
4780  warn 'Use of Kerberos was requested, but it was not found.'
4781fi
4782
4783if test "$with_pam_req" = yes -a "$have_pam" = no ; then
4784  warn 'Use of PAM was requested, but it was not found.'
4785elif test "$have_pam" = no ; then
4786  if test -d /etc/pam.d -o -f /etc/pam.conf ; then
4787    warn  "Your system seems to have PAM, but PAM is not being used."
4788    warn2 "That is probably not going to work out well."
4789
4790  fi
4791fi
4792
4793if test "$with_shadow_req" = yes -a "$have_shadow" = no ; then
4794  warn 'Use of shadow passwords was requested, but they were not found.'
4795fi
4796
4797if test "$setcap_hacks_req" = yes -a "$have_libcap" = no ; then
4798  warn 'Use of libcap was requested, but it was not found.'
4799fi
4800
4801if test "$ac_macosx" = yes -a "$enable_locking" = yes ; then
4802  warn  "You have specified --enable-locking on macOS."
4803  warn2 "THIS DOES NOT WORK!  Don't do this!"
4804fi
4805
4806
4807# You are in a twisty maze of namespaces and syntaxes, all alike.
4808# Expand all of these as the Makefile will probably expand them.
4809# Fuck the skull of Unix.
4810#
4811bindir=`eval eval eval eval eval eval eval echo $bindir`
4812HACKDIR=`eval eval eval eval eval eval eval echo $HACKDIR`
4813HACK_CONF_DIR=`eval eval eval eval eval eval eval echo $HACK_CONF_DIR`
4814FONT_DIR=`eval eval eval eval eval eval eval echo $FONT_DIR`
4815
4816# canonicalize slashes.
4817bindir=`echo  "${bindir}"              | sed 's@/$@@;s@//*@/@g'`
4818HACKDIR=`echo "${HACKDIR}"             | sed 's@/$@@;s@//*@/@g'`
4819HACK_CONF_DIR=`echo "${HACK_CONF_DIR}" | sed 's@/$@@;s@//*@/@g'`
4820FONT_DIR=`echo "${FONT_DIR}"           | sed 's@/$@@;s@//*@/@g'`
4821
4822if test -z "$FONT_DIR" ; then
4823  FONT_DIR='not installed';
4824else
4825  FONT_DIR="${FONT_DIR}/"
4826fi
4827
4828# Sanity check the hackdir
4829for bad_choice in xscreensaver xscreensaver-settings xscreensaver-command ; do
4830  if test "${HACKDIR}" = "${bindir}/${bad_choice}" ; then
4831    echo ""
4832    AC_MSG_ERROR(["--with-hackdir=${bindir}/${bad_choice}" won't work.
4833                   There will be an executable installed with that name, so
4834                   that can't be the name of a directory as well.  Please
4835                   re-configure with a different directory name.])
4836  fi
4837done
4838
4839
4840# Warn if there's a previous RPM package installed.
4841
4842rpm_vers=
4843if test -z "$RPM_PACKAGE_VERSION" ; then
4844  # Don't bother with this test if we are currently *building* an RPM.
4845  rpmnames="xscreensaver xscreensaver-base xscreensaver-extras
4846            xscreensaver-data xscreensaver-data-extra"
4847
4848  # M4 sucks!!
4849  changequote(X,Y)
4850  pkg_vers=`(rpm -qv $rpmnames) 2>&- | \
4851        sed -n 's/^[-a-z]*-\([0-9][0-9]*[.].*\)/\1/p' | head -1`
4852  rpm_vers="$pkg_vers"
4853  changequote([,])
4854fi
4855
4856if test \! -z "$rpm_vers" ; then
4857
4858  # M4 sucks!!
4859  changequote(A,B)
4860  pkg_bindir=`rpm  -ql $rpmnames | sed -n 's@^\(.*/\)xscreensaver-settings$@\1@p'`
4861  pkg_bindir2=`rpm -ql $rpmnames | sed -n 's@^\(.*/\)xscreensaver-demo$@\1@p'`
4862  pkg_hackdir=`rpm -ql $rpmnames | sed -n 's@^\(.*/\)popsquares$@\1@p'`
4863  pkg_confdir=`rpm -ql $rpmnames | sed -n 's@^\(.*/\)popsquares\.xml$@\1@p'`
4864  pkg_fontdir=`rpm -ql $rpmnames | sed -n 's@^\(.*/\).*\.ttf$@\1@p' | head -1`
4865  pkg_addir=`rpm   -ql $rpmnames | sed -n 's@^\(.*/\)XScreenSaver$@\1@p'`
4866
4867  if test -z "$pkg_bindir" ; then pkg_bindir="$pkg_bindir2" ; fi
4868  changequote([,])
4869fi
4870
4871
4872# Warn if there's a previous Debian package installed.
4873#
4874deb_vers=
4875if test -z "$pkg_vers" ; then
4876  debnames="xscreensaver xscreensaver-data xscreensaver-data-extra"
4877  pkg_vers=''
4878  for dpkg in $debnames ; do
4879    if test -z "$pkg_vers"; then
4880      pkg_vers=`dpkg -s $dpkg 2>/dev/null | sed -n 's/^Version: \(.*\)$/\1/p'`
4881      deb_vers="$pkg_vers"
4882    fi
4883  done
4884fi
4885
4886if test \! -z "$deb_vers" ; then
4887
4888  # M4 sucks!!
4889  changequote(A,B)
4890  pkg_bindir=`dpkg  -L $debnames 2>&- | sed -n 's@^\(.*/\)xscreensaver-settings$@\1@p'`
4891  pkg_bindir2=`dpkg -L $debnames 2>&- | sed -n 's@^\(.*/\)xscreensaver-demo$@\1@p'`
4892  pkg_hackdir=`dpkg -L $debnames 2>&- | sed -n 's@^\(.*/\)popsquares$@\1@p'`
4893  pkg_confdir=`dpkg -L $debnames 2>&- | sed -n 's@^\(.*/\)popsquares\.xml$@\1@p'`
4894  pkg_fontdir=`dpkg -L $debnames 2>&- | sed -n 's@^\(.*/\).*\.ttf$@\1@p' | head -1`
4895  pkg_addir=`dpkg   -L $debnames 2>&- | sed -n 's@^\(.*/\)XScreenSaver[^/]*$@\1@p'`
4896  changequote([,])
4897
4898  if test -z "$pkg_bindir" ; then pkg_bindir="$pkg_bindir2" ; fi
4899fi
4900
4901bindir_err=
4902hackdir_err=
4903confdir_err=
4904fontdir_err=
4905addir_err=
4906if ! test -z "$pkg_vers" ; then
4907
4908  err=" (DIFFERS)"
4909
4910  if test -z "$pkg_bindir"  ; then pkg_bindir='???'
4911  elif test "$pkg_bindir"  != "${bindir}/"        ; then bindir_err="$err" ; fi
4912
4913  if test -z "$pkg_hackdir" ; then pkg_hackdir='???'
4914  elif test "$pkg_hackdir" != "${HACKDIR}/"       ; then hackdir_err="$err"; fi
4915
4916  if test -z "$pkg_confdir" ; then pkg_confdir='???'
4917  elif test "$pkg_confdir" != "${HACK_CONF_DIR}/" ; then confdir_err="$err"; fi
4918
4919  if test -z "$pkg_fontdir" ; then pkg_fontdir='none'
4920  elif test "$pkg_fontdir/" != "${FONT_DIR}"      ; then fontdir_err="$err"; fi
4921
4922  if test -z "$pkg_addir"   ; then pkg_addir='???'
4923  elif test "$pkg_addir"   != "${APPDEFAULTS}/"   ; then addir_err="$err"  ; fi
4924
4925  warning=no
4926  warnL "There is already an installed package of xscreensaver"
4927  warn2 "version \"$pkg_vers\", in these directories:"
4928  echo ""
4929  warn2 "User programs: $pkg_bindir$bindir_err"
4930  warn2 "Screen savers: $pkg_hackdir$hackdir_err"
4931  warn2 "Configuration: $pkg_confdir$confdir_err"
4932  warn2 "Extra fonts:   $pkg_fontdir$fontdir_err"
4933  warn2 "App Defaults:  $pkg_addir$addir_err"
4934fi
4935
4936echo ""
4937echo "$warnsep"
4938echo ""
4939echo "    XScreenSaver will be installed in these directories:"
4940echo ""
4941echo "             User programs: ${bindir}/$bindir_err"
4942echo "             Screen savers: ${HACKDIR}/$hackdir_err"
4943echo "             Configuration: ${HACK_CONF_DIR}/$confdir_err"
4944echo "             Extra Fonts:   ${FONT_DIR}$fontdir_err"
4945echo "             App Defaults:  ${APPDEFAULTS}/$addir_err"
4946echo ""
4947