"Fossies" - the Fresh Open Source Software Archive

Member "xscreensaver-6.01/configure.ac" (20 May 2021, 153639 Bytes) of package /linux/misc/xscreensaver-6.01.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "configure.ac": 6.00_vs_6.01.

    1 # configure.in --- xscreensaver, Copyright © 1997-2021 Jamie Zawinski.
    2 #
    3 
    4 # Note: upgrading past 2.69_5 breaks the world.
    5 AC_PREREQ([2.69])
    6 
    7 AC_INIT
    8 AC_CONFIG_SRCDIR([driver/subprocs.c])
    9 AC_CONFIG_HEADERS([config.h])
   10 
   11 echo "current directory: `pwd`"
   12 echo "command line was: $0 $@"
   13 
   14 ###############################################################################
   15 #
   16 #       Autoheader stuff
   17 #
   18 ###############################################################################
   19 
   20 AH_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 #
   32 AH_TEMPLATE([HAVE_PTHREAD],
   33 	    [Define this if you have POSIX threads.])
   34 
   35 AH_TEMPLATE([HAVE_SIGTIMEDWAIT],
   36 	    [Define to 1 if you have the `sigtimedwait' function.])
   37 
   38 AH_TEMPLATE([HAVE_FORKPTY],
   39 	    [Define this if you have forkpty.])
   40 
   41 AH_TEMPLATE([HAVE_GETTIMEOFDAY],
   42 	    [Define this if you have gettimeofday.])
   43 
   44 AH_TEMPLATE([GETTIMEOFDAY_TWO_ARGS],
   45 	    [Define this if gettimeofday takes two arguments.])
   46 
   47 AH_TEMPLATE([HAVE_ICMP],
   48 	    [Define this if ping uses struct icmp.icmp_id.])
   49 
   50 AH_TEMPLATE([HAVE_ICMPHDR],
   51 	    [Define this if ping uses struct icmphdr.un.echo.id.])
   52 
   53 AH_TEMPLATE([HAVE_GETIFADDRS],
   54 	    [Define this if you have getifaddrs.])
   55 
   56 AH_TEMPLATE([HAVE_LIBCAP],
   57 	    [Define this if your system has libcap.])
   58 
   59 #
   60 # X11 server stuff.
   61 #
   62 AH_TEMPLATE([XPointer],
   63             [Stare into the void.])
   64 
   65 AH_TEMPLATE([HAVE_READ_DISPLAY_EXTENSION],
   66 	    [Define this if you have the SGI XReadDisplay extension.])
   67 
   68 AH_TEMPLATE([HAVE_XINPUT],
   69 	    [Define this if you have the XInput2 extension.])
   70 
   71 # This only ever existed in X11R4 and X11R5.
   72 AH_TEMPLATE([HAVE_XIDLE_EXTENSION],
   73 	    [Define this if you have the X11R5 XIDLE extension.])
   74 
   75 # This only ever existed on SGI hardware.
   76 AH_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.
   80 AH_TEMPLATE([HAVE_SGI_VC_EXTENSION],
   81 	    [Define this if you have the SGI-VIDEO-CONTROL extension.])
   82 
   83 AH_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 
   88 AH_TEMPLATE([HAVE_DPMS_EXTENSION],
   89 	    [Define this if you have the XDPMS extension.])
   90 
   91 AH_TEMPLATE([HAVE_XF86VMODE],
   92 	    [Define this if you have XF86VidModeGetViewPort, for
   93             virtual desktops.])
   94 
   95 AH_TEMPLATE([HAVE_XF86VMODE_GAMMA],
   96 	    [Define this if you have XF86VidModeSetGamma, for fading.])
   97 
   98 AH_TEMPLATE([HAVE_XF86VMODE_GAMMA_RAMP],
   99 	    [Define this if you have XF86VidModeSetGammaRamp, for fading.])
  100 
  101 AH_TEMPLATE([HAVE_XINERAMA],
  102 	    [Define this if you have the Xinerama extension.])
  103 
  104 AH_TEMPLATE([HAVE_XHPDISABLERESET],
  105 	    [Define this if you have XHPDisableReset, which allows
  106 	    Ctrl-Sh-Reset to be temporarily disabled.])
  107 
  108 AH_TEMPLATE([HAVE_RANDR],
  109 	    [Define this if you have the Resize and Rotate extension.])
  110 
  111 AH_TEMPLATE([HAVE_RANDR_12],
  112 	    [Define this if the RANDR library is version 1.2 or newer.])
  113 
  114 AH_TEMPLATE([HAVE_XSHM_EXTENSION],
  115 	    [Define this if you have the X Shared Memory Extension.])
  116 
  117 AH_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 
  123 AH_TEMPLATE([HAVE_XKB],
  124 	    [Define this if you have the X Keyboard Extension.])
  125 
  126 AH_TEMPLATE([HAVE_LIBSYSTEMD],
  127 	    [Define this if you have libsystemd.])
  128 
  129 AH_TEMPLATE([HAVE_LIBELOGIND],
  130 	    [Define this if you have libelogind.])
  131 
  132 AH_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 
  137 AH_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 #
  145 AH_TEMPLATE([HAVE_MOTIF],
  146             [Define this if you have Motif.])
  147 
  148 AH_TEMPLATE([HAVE_XMCOMBOBOX],
  149 	    [Define this if you have the XmComboBox Motif 2.0 widget.])
  150 
  151 AH_TEMPLATE([HAVE_GTK],
  152             [Define this if you have Gtk])
  153 AH_TEMPLATE([HAVE_GTK2],
  154             [Define this if you have Gtk 2.x.])
  155 
  156 AH_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 
  160 AH_TEMPLATE([HAVE_CRAPPLET_IMMEDIATE],
  161 	    [Define this if HAVE_CRAPPLET is defined, and the function
  162 	    capplet_widget_changes_are_immediate is available.])
  163 
  164 AH_TEMPLATE([HAVE_XML],
  165             [Define this if you have the XML library.])
  166 
  167 AH_TEMPLATE([HAVE_OLD_XML_HEADERS],
  168 	    [Define this if you the XML library headers lack the
  169             gnome-xml/libxml symlink.])
  170 
  171 AH_TEMPLATE([HAVE_GDK_PIXBUF],
  172 	    [Define this if you have GDK_Pixbuf.])
  173 
  174 AH_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 #
  181 AH_TEMPLATE([HAVE_JPEGLIB],
  182 	    [Define this if you have the JPEG Group's JPEG library.])
  183 
  184 AH_TEMPLATE([HAVE_LIBPNG],
  185 	    [Define this if you have the Portable Network Graphics library.])
  186 
  187 AH_TEMPLATE([HAVE_XUTF8DRAWSTRING],
  188 	    [Define this if you have the function Xutf8DrawString.])
  189 
  190 AH_TEMPLATE([HAVE_XFT],
  191 	    [Define this if you have libXft2.])
  192 
  193 #
  194 # Graphics libraries.
  195 #
  196 AH_TEMPLATE([HAVE_GL],
  197 	    [Define this if you have OpenGL.])
  198 
  199 AH_TEMPLATE([HAVE_GLES],
  200 	    [Define this if the native OpenGL library is OpenGLES 1.x.])
  201 
  202 AH_TEMPLATE([HAVE_GLES2],
  203 	    [Define this if the native OpenGL library is OpenGLES 2.x.])
  204 
  205 AH_TEMPLATE([HAVE_GLES3],
  206 	    [Define this if the native OpenGL library is OpenGLES 3.x.])
  207 
  208 AH_TEMPLATE([HAVE_JWZGLES],
  209             [Define this to emulate OpenGL 1.3 in terms of OpenGLES 1.x.])
  210 
  211 AH_TEMPLATE([HAVE_EGL],
  212 	    [Define this if OpenGL bindings are via EGL instead of GLX.])
  213 
  214 AH_TEMPLATE([HAVE_GLSL],
  215 	    [Define this if OpenGL supports the OpenGL Shading Language.])
  216 
  217 AH_TEMPLATE([HAVE_GLBINDTEXTURE],
  218 	    [Define this if the OpenGL version is 1.1 or newer.])
  219 
  220 AH_TEMPLATE([HAVE_GLE],
  221 	    [Define this if you have the GL Extrusion library.])
  222 
  223 AH_TEMPLATE([HAVE_GLE3],
  224             [Define this if GL Extrusion is version 3.])
  225 
  226 
  227 AH_TEMPLATE([HAVE_RECORD_ANIM],
  228 	    [Define this to enable recording of videos.])
  229 
  230 #
  231 # Locking.
  232 #
  233 AH_TEMPLATE([NO_LOCKING],
  234 	    [Define this to remove the option of locking the screen at all.])
  235 
  236 AH_TEMPLATE([HAVE_PAM],
  237 	    [Define this if you have Pluggable Authentication Modules.])
  238 
  239 AH_TEMPLATE([PAM_SERVICE_NAME],
  240 	    [The name of the "xscreensaver" PAM service.])
  241 
  242 AH_TEMPLATE([HAVE_PAM_FAIL_DELAY],
  243 	    [Define this if you have pam_fail_delay.])
  244 
  245 AH_TEMPLATE([PAM_CHECK_ACCOUNT_TYPE],
  246             [Whether PAM should check the result of account modules
  247 	    when authenticating.])
  248 
  249 AH_TEMPLATE([PAM_STRERROR_TWO_ARGS],
  250 	    [Define if pam_strerror requires two arguments.])
  251 
  252 AH_TEMPLATE([HAVE_KERBEROS],
  253 	    [Define this if you want to use Kerberos authentication to
  254 	    lock/unlock the screen instead of PAM.])
  255 
  256 AH_TEMPLATE([HAVE_KERBEROS5],
  257 	    [Define this if you have Kerberos 5.])
  258 
  259 AH_TEMPLATE([ALLOW_ROOT_PASSWD],
  260 	    [Define this to allow root to unlock, when not using PAM.])
  261 
  262 AH_TEMPLATE([HAVE_SHADOW_PASSWD],
  263 	    [Define this if your system uses /etc/shadow.])
  264 
  265 AH_TEMPLATE([HAVE_PWNAM_SHADOW_PASSWD],
  266 	    [Define this if your system uses getpwnam_shadow.])
  267 
  268 AH_TEMPLATE([HAVE_ENHANCED_PASSWD],
  269 	    [Define this for DEC/SCO "Enhanced Security" with getprpwnam.])
  270 
  271 AH_TEMPLATE([HAVE_ADJUNCT_PASSWD],
  272 	    [Define this for Solaris getpwanam.])
  273 
  274 AH_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 
  280 AH_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 #
  288 for d in utils jwxyz hacks 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
  297 done
  298 
  299 ###############################################################################
  300 #
  301 #       Check for availability of various gcc command-line options.
  302 #
  303 ###############################################################################
  304 
  305 AC_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 
  329 AC_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 
  397 AC_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 
  448 AC_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!!
  480 changequote(X,Y)
  481 perl_version_cmd='print $]'
  482 changequote([,])
  483 
  484 AC_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 
  502 AC_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 
  546 AC_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 #
  596 AC_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'
  602 acfindx:
  603 	@echo 'ac_x_app_defaults="${XAPPLOADDIR}"'
  604 EOF
  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 
  613 AC_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 
  677 AC_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 
  695 AC_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 
  705 AC_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 #
  717 AC_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 
  861 AC_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 
  878 AC_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 #
  900 AC_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 #
  912 AC_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 #
  924 AC_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 #
  938 AC_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 #
  966 AC_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 #
  993 AC_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 #
 1043 export PATH="$PATH:/usr/bin:/bin:/usr/sbin:/sbin"
 1044 
 1045 
 1046 # WTF!  autoconf emits this *way* too late.  Do it earlier.
 1047 test "x$prefix" = xNONE && prefix=$ac_default_prefix
 1048 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
 1049 
 1050 # random compiler setup
 1051 AC_CANONICAL_HOST
 1052 
 1053 ac_original_cc=$CC
 1054 AC_PROG_CC
 1055 AC_PROG_CC_ANSI
 1056 AC_PROG_CPP
 1057 AC_C_CONST
 1058 AC_C_INLINE
 1059 AC_EXEEXT
 1060 
 1061 # stuff for Makefiles
 1062 AC_PROG_INSTALL
 1063 AC_PROG_INSTALL_DIRS
 1064 AC_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 #
 1071 INSTALL_SCRIPT='${INSTALL}'
 1072 
 1073 # random libc stuff
 1074 AC_CHECK_HEADERS(unistd.h inttypes.h)
 1075 AC_TYPE_MODE_T
 1076 AC_TYPE_PID_T
 1077 AC_TYPE_SIZE_T
 1078 AC_DEFINE_UNQUOTED([RETSIGTYPE],[void],[Return type of signal handlers])
 1079 AC_HEADER_SYS_WAIT
 1080 AC_HEADER_DIRENT
 1081 AC_GETTIMEOFDAY_ARGS
 1082 AC_SYS_LARGEFILE
 1083 AC_CHECK_FUNCS(select fcntl uname nice setpriority getcwd getwd putenv sbrk)
 1084 AC_CHECK_FUNCS(sigaction syslog realpath setrlimit)
 1085 AC_CHECK_FUNCS(setlocale sqrtf)
 1086 AC_CHECK_FUNCS(getaddrinfo)
 1087 AC_CHECK_MEMBERS([struct sockaddr.sa_len],,, [#include <sys/socket.h>])
 1088 AC_CHECK_ICMP
 1089 AC_CHECK_ICMPHDR
 1090 AC_CHECK_GETIFADDRS
 1091 AC_TYPE_SOCKLEN_T
 1092 AC_CHECK_HEADERS(crypt.h sys/select.h)
 1093 AC_PROG_PERL
 1094 
 1095 if test -z "$PERL" ; then
 1096   # don't let it be blank...
 1097   PERL=/usr/bin/perl
 1098 fi
 1099 
 1100 AC_PATH_XTRA
 1101 
 1102 if test "$have_x" != yes; then
 1103   AC_MSG_ERROR(Couldn't find X11 headers/libs.  Try `$0 --help'.)
 1104 fi
 1105 
 1106 AC_X_RANDOM_PATHS
 1107 AC_XPOINTER
 1108 AC_XT
 1109 
 1110 
 1111 AC_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
 1122 AC_MSG_RESULT($ac_macosx)
 1123 
 1124 
 1125 ###############################################################################
 1126 #
 1127 #       pkg-config
 1128 #
 1129 ###############################################################################
 1130 
 1131 AC_PATH_TOOL(pkg_config, pkg-config)
 1132 
 1133 if test -z "$pkg_config" ; then
 1134   AC_MSG_WARN([pkg-config not found!])
 1135   pkg_config="false"
 1136 fi
 1137 
 1138 
 1139 # Utility function for running pkg-config-based tests...
 1140 #
 1141 pkgs=''
 1142 pkg_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 
 1181 IT_PROG_INTLTOOL
 1182 GETTEXT_PACKAGE=xscreensaver
 1183 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",
 1184 		   [This is the name of the gettext package to use.])
 1185 AC_SUBST(GETTEXT_PACKAGE)
 1186 
 1187 ALL_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"
 1188 AM_GLIB_GNU_GETTEXT
 1189 MKINSTALLDIRS="$INSTALL_DIRS"
 1190 
 1191 
 1192 ###############################################################################
 1193 #
 1194 #       The --with-x-app-defaults option
 1195 #
 1196 ###############################################################################
 1197 
 1198 #### H1
 1199 
 1200 AC_ARG_WITH(app-defaults,[
 1201 Installation 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"])
 1208 AC_PATH_X_APP_DEFAULTS
 1209 
 1210 
 1211 ###############################################################################
 1212 #
 1213 #       Handle the --with-hackdir option
 1214 #
 1215 ###############################################################################
 1216 
 1217 have_hackdir=yes
 1218 with_hackdir_req=unspecified
 1219 AC_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 
 1223 if test x"$with_hackdir" = xyes; then
 1224   HACKDIR='${libexecdir}/xscreensaver'
 1225 elif test x"$with_hackdir" = xno; then
 1226   HACKDIR='${bindir}'
 1227 else
 1228   HACKDIR=$with_hackdir
 1229 fi
 1230 
 1231 # canonicalize slashes.
 1232 HACKDIR=`echo "${HACKDIR}" | sed 's@/$@@;s@//*@/@g'`
 1233 
 1234 # Expand HACKDIR as HACKDIR_FULL
 1235 HACKDIR_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 
 1240 obsolete_enable=
 1241 AC_ARG_ENABLE(subdir,,[obsolete_enable=yes])
 1242 if 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
 1247 fi
 1248 
 1249 
 1250 ###############################################################################
 1251 #
 1252 #       Handle the --with-configdir option
 1253 #
 1254 ###############################################################################
 1255 
 1256 have_configdir=yes
 1257 with_configdir_req=unspecified
 1258 AC_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 
 1263 if test x"$with_configdir" = xyes; then
 1264   HACK_CONF_DIR='${datadir}/xscreensaver/config'
 1265 elif test x"$with_configdir" = xno; then
 1266   echo "error: must be yes, or a pathname: --with-configdir=$with_configdir"
 1267   exit 1
 1268 else
 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
 1277 fi
 1278 
 1279 
 1280 
 1281 ###############################################################################
 1282 #
 1283 #       Handle the --with-fontdir option
 1284 #
 1285 ###############################################################################
 1286 
 1287 have_fontdir=yes
 1288 with_fontdir_req=unspecified
 1289 AC_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 
 1294 if 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
 1299 elif test x"$with_fontdir" = xno; then
 1300   FONT_DIR=''
 1301 else
 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
 1310 fi
 1311 
 1312 
 1313 
 1314 ###############################################################################
 1315 #
 1316 #       Check for the DPMS server extension.
 1317 #
 1318 ###############################################################################
 1319 
 1320 #### H1
 1321 
 1322 have_dpms=no
 1323 with_dpms_req=unspecified
 1324 AC_ARG_WITH(dpms-ext,
 1325 [
 1326 Server Extension Options:
 1327 
 1328   --with-dpms-ext         Include support for power management.],
 1329   [with_dpms="$withval"; with_dpms_req="$withval"],[with_dpms=yes])
 1330 
 1331 HANDLE_X_PATH_ARG(with_dpms, --with-dpms-ext, DPMS)
 1332 
 1333 if 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 
 1361 elif test "$with_dpms" != no; then
 1362   echo "error: must be yes or no: --with-dpms-ext=$with_dpms"
 1363   exit 1
 1364 fi
 1365 
 1366 
 1367 ###############################################################################
 1368 #
 1369 #       Check for the XF86VMODE server extension (for virtual screens.)
 1370 #
 1371 ###############################################################################
 1372 
 1373 have_xf86vmode=no
 1374 with_xf86vmode_req=unspecified
 1375 AC_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 
 1380 HANDLE_X_PATH_ARG(with_xf86vmode, --with-xf86vmode-ext, xf86vmode)
 1381 
 1382 VIDMODE_LIBS=""
 1383 
 1384 if 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 
 1405 elif test "$with_xf86vmode" != no; then
 1406   echo "error: must be yes or no: --with-xf86vmode-ext=$with_xf86vmode"
 1407   exit 1
 1408 fi
 1409 
 1410 
 1411 ###############################################################################
 1412 #
 1413 #       Check for the XINERAMA server extension.
 1414 #
 1415 ###############################################################################
 1416 
 1417 have_xinerama=no
 1418 with_xinerama_req=unspecified
 1419 AC_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 
 1423 HANDLE_X_PATH_ARG(with_xinerama, --with-xinerama-ext, XINERAMA)
 1424 
 1425 if 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 
 1452 elif test "$with_xinerama" != no; then
 1453   echo "error: must be yes or no: --with-xinerama-ext=$with_xinerama"
 1454   exit 1
 1455 fi
 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 
 1468 have_randr=no
 1469 with_randr_req=unspecified
 1470 AC_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 
 1474 HANDLE_X_PATH_ARG(with_randr, --with-randr-ext, RANDR)
 1475 
 1476 if 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 
 1527 elif test "$with_randr" != no; then
 1528   echo "error: must be yes or no: --with-randr-ext=$with_randr"
 1529   exit 1
 1530 fi
 1531 
 1532 
 1533 ###############################################################################
 1534 #
 1535 #       Check for the XINPUT server extension.
 1536 #
 1537 ###############################################################################
 1538 
 1539 have_xinput=no
 1540 with_xinput_req=unspecified
 1541 xinput_halfassed=no
 1542 AC_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 
 1546 HANDLE_X_PATH_ARG(with_xinput, --with-xinput-ext, XINPUT)
 1547 
 1548 if 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 
 1569 elif test "$with_xinput" != no; then
 1570   echo "error: must be yes or no: --with-xinput-ext=$with_xinput"
 1571   exit 1
 1572 fi
 1573 
 1574 
 1575 ###############################################################################
 1576 #
 1577 #       Check for the XF86VMODE server extension (for gamma fading.)
 1578 #
 1579 ###############################################################################
 1580 
 1581 have_xf86gamma=no
 1582 have_xf86gamma_ramp=no
 1583 with_xf86gamma_req=unspecified
 1584 AC_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 
 1589 HANDLE_X_PATH_ARG(with_xf86gamma, --with-xf86gamma-ext, xf86gamma)
 1590 
 1591 if 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 
 1631 elif test "$with_xf86gamma" != no; then
 1632   echo "error: must be yes or no: --with-xf86gamma-ext=$with_xf86vmode"
 1633   exit 1
 1634 fi
 1635 
 1636 
 1637 ###############################################################################
 1638 #
 1639 #       Check for the XIDLE server extension.
 1640 #
 1641 ###############################################################################
 1642 
 1643 have_xidle=no
 1644 with_xidle_req=unspecified
 1645 AC_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 
 1649 HANDLE_X_PATH_ARG(with_xidle, --with-xidle-ext, XIDLE)
 1650 
 1651 if 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>])
 1656 elif test "$with_xidle" != no; then
 1657   echo "error: must be yes or no: --with-xidle-ext=$with_xidle"
 1658   exit 1
 1659 fi
 1660 
 1661 
 1662 ###############################################################################
 1663 #
 1664 #       Check for the MIT-SCREEN-SAVER server extension.
 1665 #
 1666 ###############################################################################
 1667 
 1668 have_mit=no
 1669 with_mit=no
 1670 with_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 
 1676 if 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 
 1712 elif test "$with_mit" != no; then
 1713   echo "error: must be yes or no: --with-mit-ext=$with_mit"
 1714   exit 1
 1715 fi
 1716 
 1717 
 1718 ###############################################################################
 1719 #
 1720 #       Check for the SGI SCREEN_SAVER server extension.
 1721 #
 1722 ###############################################################################
 1723 
 1724 have_sgi=no
 1725 with_sgi_req=unspecified
 1726 AC_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 
 1730 HANDLE_X_PATH_ARG(with_sgi, --with-sgi-ext, SGI SCREEN_SAVER)
 1731 
 1732 if 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 
 1738 elif test "$with_sgi" != no; then
 1739   echo "error: must be yes or no: --with-sgi-ext=$with_sgi"
 1740   exit 1
 1741 fi
 1742 
 1743 
 1744 ###############################################################################
 1745 #
 1746 #       Check for the SGI-VIDEO-CONTROL server extension.
 1747 #
 1748 ###############################################################################
 1749 
 1750 have_sgivc=no
 1751 with_sgivc_req=unspecified
 1752 AC_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 
 1756 HANDLE_X_PATH_ARG(with_sgivc, --with-sgivc-ext, SGI-VIDEO-CONTROL)
 1757 
 1758 if 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 
 1777 elif test "$with_sgivc" != no; then
 1778   echo "error: must be yes or no: --with-sgivc-ext=$with_sgivc"
 1779   exit 1
 1780 fi
 1781 
 1782 
 1783 ###############################################################################
 1784 #
 1785 #       Check for the SGI XReadDisplay server extension.
 1786 #
 1787 ###############################################################################
 1788 
 1789 have_readdisplay=no
 1790 with_readdisplay_req=unspecified
 1791 AC_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 
 1796 HANDLE_X_PATH_ARG(with_readdisplay, --with-readdisplay, XReadDisplay)
 1797 
 1798 if 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>])
 1802 elif test "$with_readdisplay" != no; then
 1803   echo "error: must be yes or no: --with-readdisplay=$with_readdisplay"
 1804   exit 1
 1805 fi
 1806 
 1807 
 1808 ###############################################################################
 1809 #
 1810 #       Check for the XSHM server extension.
 1811 #
 1812 ###############################################################################
 1813 
 1814 have_xshm=no
 1815 with_xshm_req=unspecified
 1816 AC_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 
 1820 HANDLE_X_PATH_ARG(with_xshm, --with-xshm-ext, XSHM)
 1821 
 1822 if 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 
 1862 elif test "$with_xshm" != no; then
 1863   echo "error: must be yes or no: --with-xshm-ext=$with_xshm"
 1864   exit 1
 1865 fi
 1866 
 1867 
 1868 ###############################################################################
 1869 #
 1870 #       Check for the DOUBLE-BUFFER server extension.
 1871 #
 1872 ###############################################################################
 1873 
 1874 have_xdbe=no
 1875 with_xdbe_req=unspecified
 1876 AC_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 
 1880 HANDLE_X_PATH_ARG(with_xdbe, --with-xdbe-ext, DOUBLE-BUFFER)
 1881 
 1882 if 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 
 1890 elif test "$with_xdbe" != no; then
 1891   echo "error: must be yes or no: --with-xdbe-ext=$with_xshm"
 1892   exit 1
 1893 fi
 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 
 1932 have_xkb=no
 1933 with_xkb_req=unspecified
 1934 AC_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 
 1939 HANDLE_X_PATH_ARG(with_xkb, --with-xkb-ext, XKB)
 1940 
 1941 if 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 
 1949 elif test "$with_xkb" != no; then
 1950   echo "error: must be yes or no: --with-xkb-ext=$with_xshm"
 1951   exit 1
 1952 fi
 1953 
 1954 
 1955 ###############################################################################
 1956 #
 1957 #       Check for HP XHPDisableReset and XHPEnableReset.
 1958 #
 1959 ###############################################################################
 1960 
 1961 AC_MSG_CHECKING([for XHPDisableReset in X11/XHPlib.h])
 1962 AC_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 
 1975 have_proc_interrupts=no
 1976 with_proc_interrupts_req=unspecified
 1977 AC_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 
 1983 if 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 
 2006 elif test "$with_proc_interrupts" != no; then
 2007   echo "error: must be yes or no: --with-proc-interrupts=$with_proc_interrupts"
 2008   exit 1
 2009 fi
 2010 
 2011 
 2012 ###############################################################################
 2013 #
 2014 #       Check for /proc/*/oom_score_adj.
 2015 #
 2016 ###############################################################################
 2017 
 2018 setuid_auth=no
 2019 have_proc_oom=no
 2020 with_proc_oom_req=unspecified
 2021 AC_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 
 2026 if 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 
 2034 elif 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 
 2053 elif test "$with_proc_oom" != no; then
 2054   echo "error: must be yes or no: --with-proc-oom=$with_proc_oom"
 2055   exit 1
 2056 fi
 2057 
 2058 
 2059 ###############################################################################
 2060 #
 2061 #       Check for -lsystemd
 2062 #
 2063 ###############################################################################
 2064 
 2065 have_systemd=no
 2066 with_systemd_req=unspecified
 2067 systemd_halfassed=no
 2068 systemd_too_old=no
 2069 AC_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 
 2075 HANDLE_X_PATH_ARG(with_systemd, --with-systemd, systemd)
 2076 
 2077 if test "$with_systemd" != yes -a "$with_systemd" != no ; then
 2078   echo "error: must be yes or no: --with-systemd=$with_systemd"
 2079   exit 1
 2080 fi
 2081 
 2082 if 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
 2131 fi
 2132 
 2133 if 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)
 2138 else
 2139   EXES_SYSTEMD=''
 2140   SYSTEMD_LIBS=''
 2141 fi
 2142 
 2143 
 2144 ###############################################################################
 2145 #
 2146 #       Check for -lelogind, a stripped down subset of systemd.
 2147 #
 2148 ###############################################################################
 2149 
 2150 have_elogind=no
 2151 with_elogind_req=unspecified
 2152 elogind_halfassed=no
 2153 elogind_too_old=no
 2154 AC_ARG_WITH(elogind,
 2155 [  --with-elogind          Use elogind instead of systemd.],
 2156   [with_elogind="$withval"; with_elogind_req="$withval"],
 2157   [with_elogind=yes])
 2158 
 2159 HANDLE_X_PATH_ARG(with_elogind, --with-elogind, elogind)
 2160 
 2161 if test "$with_elogind" != yes -a "$with_elogind" != no ; then
 2162   echo "error: must be yes or no: --with-elogind=$with_elogind"
 2163   exit 1
 2164 fi
 2165 
 2166 if 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
 2215 fi
 2216 
 2217 if 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)
 2222 fi
 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 
 2236 AC_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])
 2247 if test "$enable_locking" = yes; then
 2248   true
 2249 elif test "$enable_locking" = no; then
 2250   AC_DEFINE(NO_LOCKING)
 2251 else
 2252   echo "error: must be yes or no: --enable-locking=$enable_locking"
 2253   exit 1
 2254 fi
 2255 
 2256 
 2257 ##############################################################################
 2258 #
 2259 #       Whether to allow root password to unblank.
 2260 #
 2261 ###############################################################################
 2262 
 2263 AC_ARG_ENABLE(root-passwd,
 2264 [],  # This is documented elsewhere because of --enable/--with option sorting.
 2265   [enable_root_passwd="$enableval"],[enable_root_passwd=no])
 2266 if test "$enable_root_passwd" = yes; then
 2267   AC_DEFINE(ALLOW_ROOT_PASSWD)
 2268   true
 2269 elif test "$enable_root_passwd" != no; then
 2270   echo "error: must be yes or no: --enable-root-passwd=$enable_root_passwd"
 2271   exit 1
 2272 fi
 2273 
 2274 
 2275 ###############################################################################
 2276 #
 2277 #       Check for PAM.
 2278 #
 2279 ###############################################################################
 2280 
 2281 case "$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   ;;
 2295 esac
 2296 
 2297 #### H1
 2298 
 2299 have_pam=no
 2300 with_pam_req=unspecified
 2301 
 2302 AC_ARG_WITH(pam,[
 2303 Screen 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 
 2309 AC_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 
 2317 AC_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])
 2320 if test "$enable_pam_check_account_type" = yes ; then
 2321   AC_DEFINE(PAM_CHECK_ACCOUNT_TYPE)
 2322   true
 2323 elif 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
 2326 fi
 2327 
 2328 HANDLE_X_PATH_ARG(with_pam, --with-pam, PAM)
 2329 
 2330 if 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
 2406 fi
 2407 
 2408 
 2409 ###############################################################################
 2410 #
 2411 #       Check for Kerberos.
 2412 #
 2413 ###############################################################################
 2414 
 2415 have_kerberos=no
 2416 have_kerberos5=no
 2417 with_kerberos_req=unspecified
 2418 
 2419 AC_ARG_WITH(kerberos, 
 2420 [  --with-kerberos         Include support for Kerberos authentication.],
 2421   [with_kerberos="$withval"; with_kerberos_req="$withval"],[with_kerberos=yes])
 2422 
 2423 HANDLE_X_PATH_ARG(with_kerberos, --with-kerberos, Kerberos)
 2424 
 2425 if 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
 2486 fi
 2487 
 2488 
 2489 ###############################################################################
 2490 #
 2491 #       Check for the nine billion variants of shadow passwords...
 2492 #
 2493 ###############################################################################
 2494 
 2495 have_shadow=no
 2496 with_shadow_req=unspecified
 2497 
 2498 AC_ARG_WITH(shadow,
 2499 [  --with-shadow           Include support for shadow password authentication.],
 2500   [with_shadow="$withval"; with_shadow_req="$withval"],[with_shadow=yes])
 2501 
 2502 HANDLE_X_PATH_ARG(with_shadow, --with-shadow, shadow password)
 2503 
 2504 if test "$enable_locking" = no ; then
 2505   with_shadow_req=no
 2506   with_shadow=no
 2507 fi
 2508 
 2509 
 2510 ###############################################################################
 2511 #
 2512 #       Check for Sun "adjunct" passwords.
 2513 #
 2514 ###############################################################################
 2515 
 2516 if 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
 2533 fi
 2534 
 2535 
 2536 ###############################################################################
 2537 #
 2538 #       Check for DEC and SCO so-called "enhanced" security.
 2539 #
 2540 ###############################################################################
 2541 
 2542 if 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
 2573 fi
 2574 
 2575 ###############################################################################
 2576 #
 2577 #       Check for HP's entry in the "Not Invented Here" Sweepstakes.
 2578 #
 2579 ###############################################################################
 2580 
 2581 if 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
 2601 fi
 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 
 2616 if 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
 2626 fi
 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 
 2636 if 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
 2654 fi
 2655 
 2656 
 2657 ###############################################################################
 2658 #
 2659 #       Check for traditional (ha!) shadow passwords.
 2660 #
 2661 ###############################################################################
 2662 
 2663 if 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
 2690 fi
 2691 
 2692 
 2693 ###############################################################################
 2694 #
 2695 #       Check for other libraries needed for non-shadow passwords.
 2696 #
 2697 ###############################################################################
 2698 
 2699 if 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
 2708 fi
 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 #
 2756 if 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
 2762 fi
 2763 
 2764 
 2765 if test "$have_shadow_adjunct" = yes ; then
 2766   AC_DEFINE(HAVE_ADJUNCT_PASSWD)
 2767 elif test "$have_shadow_enhanced" = yes ; then
 2768   AC_DEFINE(HAVE_ENHANCED_PASSWD)
 2769 elif test "$have_shadow_hpux" = yes ; then
 2770   AC_DEFINE(HAVE_HPUX_PASSWD)
 2771 elif test "$have_shadow" = yes ; then
 2772   AC_DEFINE(HAVE_SHADOW_PASSWD)
 2773 elif test "$have_pwnam_shadow" = yes ; then
 2774   AC_DEFINE(HAVE_PWNAM_SHADOW_PASSWD)
 2775 fi
 2776 
 2777 
 2778 ###############################################################################
 2779 #
 2780 #       Check for -lgtk (and Gnome stuff)
 2781 #
 2782 ###############################################################################
 2783 
 2784 #### H1
 2785 
 2786 have_gtk=no
 2787 with_gtk_req=unspecified
 2788 AC_ARG_WITH(gtk,
 2789 [
 2790 User 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.
 2797 case "$with_gtk" in
 2798   /*)
 2799     gtk_dir="$with_gtk"
 2800     ;;
 2801   *)
 2802     gtk_dir=""
 2803     ;;
 2804 esac
 2805 
 2806 HANDLE_X_PATH_ARG(with_gtk, --with-gtk, Gtk)
 2807 
 2808 if test "$with_gtk" != yes -a "$with_gtk" != no ; then
 2809   echo "error: must be yes or no: --with-gtk=$with_gtk"
 2810   exit 1
 2811 fi
 2812 
 2813 
 2814 gtk_halfassed=no
 2815 
 2816 if 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
 2857 fi
 2858 
 2859 
 2860 # Check for the various Gnome help and URL loading programs.
 2861 #
 2862 WITH_BROWSER=gnome-open
 2863 if 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)
 2866 fi
 2867 
 2868 
 2869 ###############################################################################
 2870 #
 2871 #       Check for -lXm.
 2872 #
 2873 ###############################################################################
 2874 
 2875 have_motif=no
 2876 with_motif_req=unspecified
 2877 AC_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 
 2881 HANDLE_X_PATH_ARG(with_motif, --with-motif, Motif)
 2882 
 2883 if test "$with_motif" != yes -a "$with_motif" != no ; then
 2884   echo "error: must be yes or no: --with-motif=$with_motif"
 2885   exit 1
 2886 fi
 2887 
 2888 if 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>])
 2897 fi
 2898 
 2899 
 2900 if 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>])
 2905 fi
 2906 
 2907 
 2908 ###############################################################################
 2909 #
 2910 #       Checking whether Motif is really Lesstif.
 2911 #
 2912 ###############################################################################
 2913 
 2914 have_lesstif=no
 2915 if 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
 2923 fi
 2924 
 2925 
 2926 lesstif_version=unknown
 2927 lesstif_version_string=unknown
 2928 
 2929 if 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 
 2955 fi
 2956 
 2957 
 2958 if 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 
 2984 fi
 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 
 2997 have_xp_ext=no
 2998 if 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)
 3003 fi
 3004 
 3005 
 3006 ###############################################################################
 3007 #
 3008 #       Checking whether Motif requires -lXintl (for _Xsetlocale.)
 3009 #
 3010 ###############################################################################
 3011 
 3012 have_xintl=no
 3013 if 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
 3019 fi
 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 
 3029 with_login_manager_req=unspecified
 3030 default_login_manager_1='gdmflexiserver -ls'
 3031 default_login_manager_2='kdmctl reserve'
 3032 default_login_manager_3='lxdm -c USER_SWITCH'
 3033 default_login_manager_4='dm-tool switch-to-greeter'
 3034 
 3035 AC_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 
 3042 if test "$enable_locking" = no ; then
 3043   with_login_manager_req=no
 3044   with_login_manager=no
 3045 fi
 3046 
 3047 case "$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   ;;
 3099 esac
 3100 ac_cv_login_manager_program="$with_login_manager"
 3101 
 3102 NEW_LOGIN_COMMAND_P=''
 3103 NEW_LOGIN_COMMAND="$ac_cv_login_manager_program"
 3104 
 3105 AC_MSG_CHECKING(for login manager)
 3106 if 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))
 3110 else
 3111   AC_MSG_RESULT($NEW_LOGIN_COMMAND)
 3112 fi
 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 
 3123 have_imagedir=no
 3124 with_imagedir_req=unspecified
 3125 
 3126 AC_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 
 3132 case "$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   ;;
 3185 esac
 3186 ac_cv_imagedir="$with_imagedir"
 3187 
 3188 DEFAULT_IMAGES_P='True'
 3189 DEFAULT_IMAGE_DIRECTORY="$ac_cv_imagedir"
 3190 
 3191 if test -z "$DEFAULT_IMAGE_DIRECTORY" ; then
 3192   DEFAULT_IMAGES_P='False'
 3193 fi
 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 
 3204 have_textfile=no
 3205 with_textfile_req=unspecified
 3206 
 3207 AC_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 
 3213 case "$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   ;;
 3258 esac
 3259 ac_cv_textfile="$with_textfile"
 3260 
 3261 DEFAULT_TEXT_FILE="$ac_cv_textfile"
 3262 
 3263 
 3264 ###############################################################################
 3265 #
 3266 #       Check the browser to see help URL
 3267 #
 3268 ###############################################################################
 3269 
 3270 have_browser=no
 3271 with_browser_req=unspecified
 3272 
 3273 AC_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 
 3279 case "$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   ;;
 3300 esac
 3301 ac_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 
 3311 have_pthread=no
 3312 with_pthread_req=unspecified
 3313 
 3314 # AX_PTHREAD is from the GNU Autoconf Archive.
 3315 # https://savannah.gnu.org/projects/autoconf-archive/
 3316 m4_include(ax_pthread.m4)
 3317 
 3318 AC_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 
 3323 if 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
 3337 fi
 3338 
 3339 
 3340 ###############################################################################
 3341 #
 3342 #       Handle --with-gles
 3343 #	Must come before --with-gl
 3344 #
 3345 ###############################################################################
 3346 
 3347 with_jwzgles_req=unspecified
 3348 have_jwzgles=no
 3349 AC_ARG_WITH(gles,
 3350 [],  # This is documented after --with-gl
 3351   [with_jwzgles="$withval"; with_jwzgles_req="$withval"],[with_jwzgles=no])
 3352 
 3353 HANDLE_X_PATH_ARG(with_jwzgles, --with-gles, JWZGLES)
 3354 
 3355 if 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.)
 3359 elif test "$with_jwzgles" != no; then
 3360   echo "error: must be yes or no: --with-gles=$with_jwzgles"
 3361   exit 1
 3362 fi
 3363 
 3364 
 3365 ###############################################################################
 3366 #
 3367 #       Check for -lGL or -lMesaGL.
 3368 #
 3369 ###############################################################################
 3370 
 3371 #### H1
 3372 
 3373 have_gl=no
 3374 ac_have_mesa_gl=no
 3375 with_gl_req=unspecified
 3376 gl_halfassed=no
 3377 have_glext=no
 3378 AC_ARG_WITH(gl,
 3379 [
 3380 Graphics 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 
 3386 HANDLE_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 #
 3391 ac_save_pthreads_CFLAGS="$CFLAGS"
 3392 ac_save_pthreads_LIBS="$LIBS"
 3393 CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
 3394 LIBS="$PTHREAD_LIBS $LIBS"
 3395 
 3396 if 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
 3401 fi
 3402 
 3403 if 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 
 3539 elif test "$with_gl" != no; then
 3540   echo "error: must be yes or no: --with-gl=$with_gl"
 3541   exit 1
 3542 fi
 3543 
 3544 
 3545 ###############################################################################
 3546 #
 3547 #       Handle --with-glx
 3548 #
 3549 ###############################################################################
 3550 
 3551 have_glx=no
 3552 have_egl=no
 3553 with_egl_req=unspecified
 3554 AC_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 
 3559 HANDLE_X_PATH_ARG(with_glx, --with-glx, GLX)
 3560 
 3561 if test "$with_glx" = yes; then
 3562   AC_CHECK_X_HEADER(GLX/glx.h, have_glx=yes, have_glx=no)
 3563 elif test "$with_glx" != no; then
 3564   echo "error: must be yes or no: --with-glx=$with_glx"
 3565   exit 1
 3566 fi
 3567 
 3568 if 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 
 3618 fi
 3619 
 3620 
 3621 # Restore flags after testing OpenGL libraries.
 3622 #
 3623 CFLAGS="$ac_save_pthreads_CFLAGS"
 3624 LIBS="$ac_save_pthreads_LIBS"
 3625 
 3626 
 3627 ###############################################################################
 3628 #
 3629 #       Check for -lgle.
 3630 #
 3631 ###############################################################################
 3632 
 3633 have_gle=no
 3634 with_gle_req=unspecified
 3635 gle_halfassed=no
 3636 AC_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 
 3640 HANDLE_X_PATH_ARG(with_gle, --with-gle, GLE)
 3641 
 3642 GLE_LIBS=""
 3643 
 3644 if test "$have_gl" = no ; then
 3645  true
 3646 elif 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 
 3705 elif test "$with_gle" != no; then
 3706   echo "error: must be yes or no: --with-gle=$with_gle"
 3707   exit 1
 3708 
 3709 fi
 3710 
 3711 
 3712 ###############################################################################
 3713 #
 3714 #       Check for -ljpeg
 3715 #
 3716 ###############################################################################
 3717 
 3718 have_jpeg=no
 3719 with_jpeg_req=unspecified
 3720 jpeg_halfassed=no
 3721 AC_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 
 3726 HANDLE_X_PATH_ARG(with_jpeg, --with-jpeg, JPEG)
 3727 
 3728 if test "$with_jpeg" != yes -a "$with_jpeg" != no ; then
 3729   echo "error: must be yes or no: --with-jpeg=$with_jpeg"
 3730   exit 1
 3731 fi
 3732 
 3733 if 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
 3748 fi
 3749 
 3750 
 3751 ###############################################################################
 3752 #
 3753 #       Check for -lpng
 3754 #
 3755 ###############################################################################
 3756 
 3757 have_png=no
 3758 with_png_req=unspecified
 3759 png_halfassed=no
 3760 AC_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 
 3765 HANDLE_X_PATH_ARG(with_png, --with-png, PNG)
 3766 
 3767 if test "$with_png" != yes -a "$with_png" != no ; then
 3768   echo "error: must be yes or no: --with-png=$with_png"
 3769   exit 1
 3770 fi
 3771 
 3772 if 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
 3787 fi
 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 
 3800 have_gdk_pixbuf=no
 3801 with_gdk_pixbuf_req=unspecified
 3802 AC_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.
 3810 case "$with_gdk_pixbuf" in
 3811   /*)
 3812     gdk_pixbuf_dir="$with_gdk_pixbuf"
 3813     ;;
 3814   *)
 3815     gdk_pixbuf_dir=""
 3816     ;;
 3817 esac
 3818 
 3819 HANDLE_X_PATH_ARG(with_gdk_pixbuf, --with-pixbuf, GDK_PIXBUF)
 3820 
 3821 if 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
 3824 fi
 3825 
 3826 if 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
 3913 fi
 3914 
 3915 
 3916 ###############################################################################
 3917 #
 3918 #       Check for -lXft
 3919 #
 3920 ###############################################################################
 3921 
 3922 have_xutf8drawstring=no
 3923 AC_CHECK_X_LIB(X11, Xutf8DrawString,
 3924                [have_xutf8drawstring=yes],
 3925                [true], -lX11 -lXext -lm)
 3926 if test "$have_xutf8drawstring" = yes ; then
 3927   AC_DEFINE(HAVE_XUTF8DRAWSTRING)
 3928 fi
 3929 
 3930 
 3931 have_xft=no
 3932 with_xft_req=unspecified
 3933 xft_halfassed=no
 3934 AC_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 
 3940 HANDLE_X_PATH_ARG(with_xft, --with-xft, Xft)
 3941 
 3942 if test "$with_xft" != yes -a "$with_xft" != no ; then
 3943   echo "error: must be yes or no: --with-xft=$with_xft"
 3944   exit 1
 3945 fi
 3946 
 3947 if 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
 3990 fi
 3991 
 3992 if 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)
 3998 else
 3999   XFT_LIBS=''
 4000   XFT_SRCS='$(UTILS_SRC)/xft.c'
 4001   XFT_OBJS='$(UTILS_BIN)/xft.o'
 4002 fi
 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 
 4012 PTY_LIBS=
 4013 AC_CHECK_HEADERS(pty.h util.h sys/termios.h)
 4014 AC_CHECK_X_LIB(util, forkpty,
 4015                [PTY_LIBS="-lutil"
 4016                 ac_have_forkpty=yes
 4017                 AC_DEFINE(HAVE_FORKPTY)])
 4018 
 4019 if 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)])
 4024 fi
 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 
 4034 have_libcap=no
 4035 setcap_hacks_default=no
 4036 setcap_hacks="$setcap_hacks_default"
 4037 setcap_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 
 4074 if test "$have_libcap" = yes; then
 4075   setuid_hacks_default=no
 4076 else
 4077   setuid_hacks_default=yes
 4078 fi
 4079 
 4080 setuid_hacks="$setuid_hacks_default"
 4081 AC_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 
 4086 HANDLE_X_PATH_ARG(setuid_hacks, --with-setuid-hacks, setuid hacks)
 4087 
 4088 if test "$setuid_hacks" = yes; then
 4089   true
 4090 elif test "$setuid_hacks" != no; then
 4091   echo "error: must be yes or no: --with-setuid-hacks=$setuid_hacks"
 4092   exit 1
 4093 fi
 4094 
 4095 
 4096 ###############################################################################
 4097 #
 4098 #       Check for --with-record-animation
 4099 #
 4100 ###############################################################################
 4101 
 4102 record_anim_default=no
 4103 record_anim="$record_anim_default"
 4104 AC_ARG_WITH(record-animation,
 4105 [  --with-record-animation Include code for generating MP4 videos.],
 4106   [record_anim="$withval"], [record_anim="$record_anim_default"])
 4107 
 4108 HANDLE_X_PATH_ARG(record_anim, --with-record-animation, record animation)
 4109 
 4110 if test "$record_anim" = yes; then
 4111   true
 4112 elif test "$record_anim" != no; then
 4113   echo "error: must be yes or no: --with-record-animation=$record_anim"
 4114   exit 1
 4115 fi
 4116 
 4117 if 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
 4126 fi
 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 
 4136 DEPEND=makedepend
 4137 DEPEND_FLAGS=
 4138 DEPEND_DEFINES=
 4139 
 4140 
 4141 if test \! -z "$includedir" ; then 
 4142   INCLUDES="$INCLUDES -I$includedir"
 4143 fi
 4144 
 4145 if test \! -z "$libdir" ; then
 4146   LDFLAGS="$LDFLAGS -L$libdir"
 4147 fi
 4148 
 4149 
 4150 PREFERRED_DEMO_PROGRAM=''
 4151 ALL_DEMO_PROGRAMS=
 4152 if test "$have_motif" = yes; then
 4153   PREFERRED_DEMO_PROGRAM=xscreensaver-settings-Xm
 4154   ALL_DEMO_PROGRAMS="$PREFERRED_DEMO_PROGRAM $ALL_DEMO_PROGRAMS"
 4155 fi
 4156 if test "$have_gtk" = yes; then
 4157   PREFERRED_DEMO_PROGRAM=xscreensaver-settings-Gtk
 4158   ALL_DEMO_PROGRAMS="$PREFERRED_DEMO_PROGRAM $ALL_DEMO_PROGRAMS"
 4159 fi
 4160 
 4161 
 4162 if test "$have_kerberos" = yes; then
 4163   PASSWD_SRCS="$PASSWD_SRCS \$(KERBEROS_SRCS)"
 4164   PASSWD_OBJS="$PASSWD_OBJS \$(KERBEROS_OBJS)"
 4165 fi
 4166 if test "$have_pam" = yes; then
 4167   PASSWD_SRCS="$PASSWD_SRCS \$(PAM_SRCS)"
 4168   PASSWD_OBJS="$PASSWD_OBJS \$(PAM_OBJS)"
 4169   INSTALL_PAM="install-pam"
 4170 fi
 4171 if test "$enable_pam_check_account_type" = yes; then
 4172   COMMENT_PAM_CHECK_ACCOUNT=""
 4173 else
 4174   COMMENT_PAM_CHECK_ACCOUNT="#"
 4175 fi
 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 
 4184 if test "$enable_locking" = yes; then
 4185   LOCK_SRCS='$(LOCK_SRCS_1) $(PASSWD_SRCS)'
 4186   LOCK_OBJS='$(LOCK_OBJS_1) $(PASSWD_OBJS)'
 4187 else
 4188   LOCK_SRCS='$(NOLOCK_SRCS_1)'
 4189   LOCK_OBJS='$(NOLOCK_OBJS_1)'
 4190 fi
 4191 
 4192 if test "$ac_macosx" = yes; then
 4193   EXES_OSX='$(EXES_OSX)'
 4194   SCRIPTS_OSX='$(SCRIPTS_OSX)'
 4195   MEN_OSX='$(MEN_OSX)'
 4196 else
 4197   EXES_OSX=
 4198   SCRIPTS_OSX=
 4199   MEN_OSX=
 4200 fi
 4201 
 4202 
 4203 if test "$setuid_auth" = yes; then
 4204   SETUID_AUTH=yes
 4205 else
 4206   SETUID_AUTH=no
 4207 fi
 4208 
 4209 if test "$setuid_hacks" = yes; then
 4210   SETUID_HACKS=yes
 4211 else
 4212   SETUID_HACKS=no
 4213 fi
 4214 
 4215 if test "$have_libcap" = yes; then
 4216   SETCAP_HACKS=yes
 4217 else
 4218   SETCAP_HACKS=no
 4219 fi
 4220 
 4221 tab='	'
 4222 if 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=" "
 4229 else
 4230   GL_KLUDGE="-"
 4231 fi
 4232 
 4233 if test "$have_gle" = yes; then
 4234   GLE_EXES='$(GLE_EXES)'
 4235   GLE_KLUDGE=" "
 4236 else
 4237   GLE_KLUDGE="-"
 4238 fi
 4239 
 4240 if test "$have_jpeg" = yes -a "$have_gdk_pixbuf" = yes; then
 4241  JPEG_EXES='$(JPEG_EXES)'
 4242 fi
 4243 
 4244 
 4245 # Another substitution in the XScreenSaver.ad.in file:
 4246 #
 4247 if test "$gnome_open_program" != ''; then
 4248   GNOME24=''
 4249   GNOME22='!	'
 4250   NOGNOME='!	'
 4251 elif test "$gnome_url_show_program" != ''; then
 4252   GNOME24='!	'
 4253   GNOME22=''
 4254   NOGNOME='!	'
 4255 else
 4256   GNOME24='!	'
 4257   GNOME22='!	'
 4258   NOGNOME=''
 4259 fi
 4260 
 4261 
 4262 # Set PO_DATADIR to something sensible.
 4263 #
 4264 AC_MSG_CHECKING([for locale directory])
 4265 if test -n "$GTK_DATADIR" ; then
 4266   PO_DATADIR="$GTK_DATADIR"
 4267 elif test "$have_gtk" = yes; then
 4268   PO_DATADIR=`$pkg_config --variable=prefix gtk+-2.0`
 4269   PO_DATADIR="$PO_DATADIR/share"
 4270 fi
 4271 
 4272 if 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/@/@'`
 4280 fi
 4281 
 4282 AC_MSG_RESULT($PO_DATADIR/locale)
 4283 
 4284 
 4285 # canonicalize slashes.
 4286 HACK_CONF_DIR=`echo "${HACK_CONF_DIR}" | sed 's@/$@@;s@//*@/@g'`
 4287 FONT_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 #
 4297 INCLUDES=`echo "$INCLUDES" | sed 's@ -I${prefix}/include@@g;'`
 4298 
 4299 
 4300 ###############################################################################
 4301 #
 4302 #       Perform substitutions and write Makefiles.
 4303 #
 4304 ###############################################################################
 4305 
 4306 AC_SUBST(INCLUDES)
 4307 
 4308 AC_SUBST(PREFERRED_DEMO_PROGRAM)
 4309 AC_SUBST(ALL_DEMO_PROGRAMS)
 4310 AC_SUBST(SAVER_LIBS)
 4311 AC_SUBST(MOTIF_LIBS)
 4312 AC_SUBST(GTK_LIBS)
 4313 AC_SUBST(XML_LIBS)
 4314 AC_SUBST(PNG_LIBS)
 4315 AC_SUBST(JPEG_LIBS)
 4316 AC_SUBST(HACK_LIBS)
 4317 AC_SUBST(PTY_LIBS)
 4318 AC_SUBST(GL_LIBS)
 4319 AC_SUBST(GLE_LIBS)
 4320 AC_SUBST(XDPMS_LIBS)
 4321 AC_SUBST(PTHREAD_LIBS)
 4322 AC_SUBST(XINERAMA_LIBS)
 4323 AC_SUBST(PASSWD_LIBS)
 4324 AC_SUBST(LIBCAP_CFLAGS)
 4325 AC_SUBST(LIBCAP_LIBS)
 4326 AC_SUBST(PROG_SETCAP)
 4327 AC_SUBST(SETUID_AUTH)
 4328 AC_SUBST(SETUID_HACKS)
 4329 AC_SUBST(SETCAP_HACKS)
 4330 AC_SUBST(INSTALL_DIRS)
 4331 AC_SUBST(INSTALL_PAM)
 4332 AC_SUBST(HAVE_PAM_FAIL_DELAY)
 4333 AC_SUBST(COMMENT_PAM_CHECK_ACCOUNT)
 4334 AC_SUBST(NEW_LOGIN_COMMAND)
 4335 AC_SUBST(NEW_LOGIN_COMMAND_P)
 4336 AC_SUBST(DEFAULT_IMAGES_P)
 4337 AC_SUBST(DEFAULT_IMAGE_DIRECTORY)
 4338 AC_SUBST(DEFAULT_TEXT_FILE)
 4339 AC_SUBST(WITH_BROWSER)
 4340 
 4341 AC_SUBST(EXES_OSX)
 4342 AC_SUBST(EXES_SYSTEMD)
 4343 AC_SUBST(SYSTEMD_LIBS)
 4344 AC_SUBST(SCRIPTS_OSX)
 4345 AC_SUBST(MEN_OSX)
 4346 
 4347 AC_SUBST(PASSWD_SRCS)
 4348 AC_SUBST(PASSWD_OBJS)
 4349 AC_SUBST(XFT_SRCS)
 4350 AC_SUBST(XFT_OBJS)
 4351 AC_SUBST(XFT_LIBS)
 4352 AC_SUBST(LOCK_SRCS)
 4353 AC_SUBST(LOCK_OBJS)
 4354 AC_SUBST(JPEG_EXES)
 4355 AC_SUBST(GL_EXES)
 4356 AC_SUBST(RETIRED_GL_EXES)
 4357 AC_SUBST(SUID_EXES)
 4358 AC_SUBST(GL_UTIL_EXES)
 4359 AC_SUBST(GL_MEN)
 4360 AC_SUBST(GL_KLUDGE)
 4361 AC_SUBST(GLE_EXES)
 4362 AC_SUBST(GLE_KLUDGE)
 4363 AC_SUBST(JWZGLES_OBJS)
 4364 AC_SUBST(GNOME24)
 4365 AC_SUBST(GNOME22)
 4366 AC_SUBST(NOGNOME)
 4367 AC_SUBST(HACKDIR)
 4368 AC_SUBST(HACKDIR_FULL)
 4369 AC_SUBST(GTK_DATADIR)
 4370 AC_SUBST(PO_DATADIR)
 4371 AC_SUBST(HACK_CONF_DIR)
 4372 AC_SUBST(FONT_DIR)
 4373 AC_SUBST(ANIM_OBJS)
 4374 AC_SUBST(ANIM_LIBS)
 4375 
 4376 APPDEFAULTS=$ac_x_app_defaults
 4377 AC_SUBST(APPDEFAULTS)
 4378 
 4379 AC_SUBST(DEPEND)
 4380 AC_SUBST(DEPEND_FLAGS)
 4381 AC_SUBST(DEPEND_DEFINES)
 4382 AC_SUBST(PERL)
 4383 
 4384 AC_CONFIG_FILES([Makefile
 4385           utils/Makefile
 4386           jwxyz/Makefile
 4387           hacks/Makefile
 4388           hacks/fonts/Makefile
 4389           hacks/images/Makefile
 4390           hacks/glx/Makefile
 4391           po/Makefile.in
 4392           driver/Makefile
 4393           driver/xscreensaver.pam
 4394           driver/XScreenSaver.ad])
 4395 AC_OUTPUT
 4396 
 4397 ###############################################################################
 4398 #
 4399 #       Print some warnings at the end.
 4400 #
 4401 ###############################################################################
 4402 
 4403 warn_prefix_1="    Warning:"
 4404 warn_prefix_2="       Note:"
 4405 warn_prefix="$warn_prefix_1"
 4406 
 4407 warning=no
 4408 warnsep='    #################################################################'
 4409 
 4410 warnpre() {
 4411   if test "$warning" = no ; then
 4412     echo '' ; echo "$warnsep" ; echo ''
 4413     warning=yes
 4414   fi
 4415 }
 4416 
 4417 warn() {
 4418   warnpre
 4419   if test "$warning" = long ; then echo '' ; fi
 4420   warning=yes
 4421   rest="$@"
 4422   echo "$warn_prefix $rest"
 4423 }
 4424 
 4425 warnL() {
 4426   was=$warning
 4427   warnpre
 4428   warning=yes
 4429   if test "$was" != no ; then echo '' ; fi
 4430   rest="$@"
 4431   echo "$warn_prefix $rest"
 4432 }
 4433 
 4434 warn2() {
 4435   rest="$@"
 4436   echo "             $rest"
 4437   warning=long
 4438 }
 4439 
 4440 note() {
 4441   warn_prefix="$warn_prefix_2"
 4442   warn $@
 4443   warn_prefix="$warn_prefix_1"
 4444 }
 4445 
 4446 noteL() {
 4447   warn_prefix="$warn_prefix_2"
 4448   warnL $@
 4449   warn_prefix="$warn_prefix_1"
 4450 }
 4451 
 4452 
 4453 # ac_prog_cc_no_pthread normally only happens on AIX, because according
 4454 # to AX_PTHREAD, AIX needs CC=xlc_r or CC=cc_r to do threads.
 4455 # If CC is specified, it takes precedence over --with-pthread.
 4456 if test "$ac_prog_cc_no_pthread" ; then
 4457   warnL "You requested $ac_original_cc for the C compiler, but it doesn't"
 4458   warn2 "support POSIX threads."
 4459   echo ""
 4460   warn2 "If you have multiple CPU cores, try CC=$PTHREAD_CC."
 4461 elif test "$with_pthread_req" = yes -a "$have_pthread" = no ; then
 4462   warn 'POSIX threads were requested, but were not found.'
 4463 fi
 4464 
 4465 if test "$with_sgi_req" = yes -a "$have_sgi" = no ; then
 4466   warn 'The SGI saver extension was requested, but was not found.'
 4467 fi
 4468 
 4469 if test "$with_xidle_req" = yes -a "$have_xidle" = no ; then
 4470   warn 'The XIdle extension was requested, but was not found.'
 4471 fi
 4472 
 4473 if test "$with_mit_req" = yes -a "$have_mit" = no ; then
 4474   warn 'The MIT-SCREEN-SAVER extension was requested, but was not found.'
 4475 fi
 4476 
 4477 if test "$with_xshm_req" = yes -a "$have_xshm" = no ; then
 4478   warn 'The XSHM extension was requested, but was not found.'
 4479 fi
 4480 
 4481 if test "$with_xdbe_req" = yes -a "$have_xdbe" = no ; then
 4482   warn 'The DOUBLE-BUFFER extension was requested, but was not found.'
 4483 fi
 4484 
 4485 #if test "$with_xcomposite_req" = yes -a "$have_xcomposite" = no ; then
 4486 #  warn 'The XCOMPOSITE extension was requested, but was not found.'
 4487 #fi
 4488 
 4489 if test "$with_xkb_req" = yes -a "$have_xkb" = no ; then
 4490   warn 'The X Keyboard extension was requested, but was not found.'
 4491 fi
 4492 
 4493 if test "$with_sgivc_req" = yes -a "$have_sgivc" = no ; then
 4494   warn 'The SGI-VIDEO-CONTROL extension was requested, but was not found.'
 4495 fi
 4496 
 4497 if test "$with_dpms_req" = yes -a "$have_dpms" = no ; then
 4498   warn 'The DPMS extension was requested, but was not found.'
 4499 fi
 4500 
 4501 if test "$with_xinerama_req" = yes -a "$have_xinerama" = no ; then
 4502   warn 'The Xinerama extension was requested, but was not found.'
 4503 fi
 4504 
 4505 if test "$with_xf86vmode_req" = yes -a "$have_xf86vmode" = no ; then
 4506   warn 'The XF86VMODE extension was requested, but was not found.'
 4507 fi
 4508 
 4509 if test "$with_randr_req" = yes -a "$have_randr" = no ; then
 4510   warn 'The RANDR extension was requested, but was not found.'
 4511 fi
 4512 
 4513 if test "$with_proc_interrupts_req" = yes -a "$have_proc_interrupts" = no; then
 4514   warn "Checking of /proc/interrupts was requested, but it's bogus."
 4515 fi
 4516 
 4517 if test "$pkg_config" = false ; then
 4518   warnL 'The "pkg-config" program was not found.  Without that,'
 4519   warn2 "detection of the various GTK libraries won't work."
 4520 else
 4521   pkgerr=`$pkg_config --list-all 2>&1 >/dev/null`
 4522   if test "x$pkgerr" != "x" ; then
 4523     warnL 'The "pkg-config" program produces errors.  This often causes'
 4524     warn2 "detection of the various GTK libraries to malfunction."
 4525     warn2 "The errors are:"
 4526     echo ''
 4527     echo "$pkgerr" | sed 's/^/             > /g'
 4528   fi
 4529 fi
 4530 
 4531 if test "$gtk_halfassed" != no ; then
 4532   warnL "GTK was found, but $gtk_halfassed_lib was not, so GTK can't be used."
 4533 fi
 4534 
 4535 motif_warn2() {
 4536   warn2 'Though the Motif front-end to xscreensaver is still'
 4537   warn2 'maintained, it is no longer being updated with new'
 4538   warn2 'features: all new development on the xscreensaver-settings'
 4539   warn2 'program is happening in the GTK version, and not in the'
 4540   warn2 'Motif version.  It is recommended that you build against'
 4541   warn2 'GTK instead of Motif.  See <http://www.gtk.org/>.'
 4542 }
 4543 
 4544 if test "$have_motif" = no -a "$have_gtk" = no; then
 4545 
 4546   if test "$with_motif" = yes; then
 4547     warnL "Neither the GTK nor Motif libraries were found; the"
 4548     warn2 "\`xscreensaver-settings' program requires one of these."
 4549     echo ''
 4550     motif_warn2
 4551   else
 4552     warnL "The GTK libraries do not seem to be available; the"
 4553     warn2 "\`xscreensaver-settings' program requires them."
 4554 #   echo ''
 4555 #   warn2 'You can use Motif or Lesstif instead of GTK (use the'
 4556 #   warn2 "\`--with-motif' option) but that is NOT recommended."
 4557 #   motif_warn2
 4558   fi
 4559 
 4560 elif test "$with_motif_req" = yes -a "$have_motif" = no ; then
 4561   warnL "Use of Motif was requested, but it wasn't found;"
 4562   warn2 "Gtk will be used instead."
 4563 
 4564 elif test "$with_gtk_req" = yes -a "$have_gtk" = no ; then
 4565   warnL "Use of Gtk was requested, but it wasn't found."
 4566 fi
 4567 
 4568 
 4569 if test "$ac_cv_libxt" != yes ; then
 4570   warnL 'The Xt library was not found.  It is required.'
 4571 fi
 4572 
 4573 if test "$have_gtk" = yes -a "$have_gdk_pixbuf" = no ; then
 4574   warn  "GTK is being used, but the GDK-Pixbuf library and/or"
 4575   warn2 "headers were not found.  That can't be good.  Please"
 4576   warn2 "install the GDK-Pixbuf development kit and re-configure."
 4577 fi
 4578 
 4579 if test "$have_motif" = yes -a "$have_lesstif" = yes ; then
 4580 
 4581   preferred_lesstif=0.92
 4582 
 4583   if test "$lesstif_version" = unknown; then
 4584     warnL "Unable to determine the LessTif version number!"
 4585     warn2 "Make sure you are using version $preferred_lesstif or newer."
 4586     warn2 "See <http://www.lesstif.org/>."
 4587 
 4588   elif test \! $lesstif_version -gt 82; then
 4589     warnL "LessTif version $lesstif_version_string is being used."
 4590     warn2 "LessTif versions 0.82 and earlier are too buggy to"
 4591     warn2 "use with XScreenSaver; it is strongly recommended"
 4592     warn2 "that you upgrade to at least version $preferred_lesstif!"
 4593     warn2 "See <http://www.lesstif.org/>."
 4594   fi
 4595 fi
 4596 
 4597 
 4598 if test "$have_motif" = yes -a "$have_gtk" = no ; then
 4599   warn  'Motif is being used, and GTK is not.'
 4600   echo  ''
 4601   motif_warn2
 4602 fi
 4603 
 4604 halfassery() {
 4605   echo ''
 4606   warn2 "More specifically, we found the headers but not the"
 4607   warn2 "libraries.  Possibly a 'devel' package is needed."
 4608 }
 4609 
 4610 if test "$with_gdk_pixbuf_req" = yes  -a "$have_gdk_pixbuf" = no; then
 4611   warnL 'Use of GDK-Pixbuf was requested, but it was not found.'
 4612 fi
 4613 
 4614 if test "$have_gdk_pixbuf" = no -o "$gdk_pixbuf_halfassed" = yes || \
 4615    test "$have_gdk_pixbuf" = no ; then
 4616 
 4617   if test "$with_gdk_pixbuf_req" = yes ; then
 4618     true
 4619   elif test "$with_gdk_pixbuf_req" = no ; then
 4620     warnL 'The GDK-Pixbuf library is not being used.'
 4621   else
 4622     warnL 'The GDK-Pixbuf library was not found.'
 4623   fi
 4624 
 4625   if test "$gdk_pixbuf_halfassed" = yes ; then halfassery ; fi
 4626   if test "$have_png" = yes ; then
 4627     echo ''
 4628     warn2 'The PNG library is being used instead.'
 4629   fi
 4630 
 4631   echo ''
 4632   warn2 'Some of the demos will not use images as much as they could.'
 4633   warn2 'You should consider installing GDK-Pixbuf and re-running'
 4634   warn2 'configure.'
 4635 fi
 4636 
 4637 
 4638 if test "$have_jpeg" = no ; then
 4639   if test "$with_jpeg_req" = yes ; then
 4640     warnL 'Use of libjpeg was requested, but it was not found.'
 4641   elif test "$with_jpeg_req" = no ; then
 4642     warnL 'The JPEG library is not being used.'
 4643   else
 4644     warnL 'The JPEG library was not found.'
 4645   fi
 4646 
 4647   if test "$jpeg_halfassed" = yes ; then halfassery ; fi
 4648   if test "$have_gdk_pixbuf" = no ; then
 4649     echo ''
 4650     warn2 "This means that it won't be possible for the image-manipulating"
 4651     warn2 "display modes to load files from disk; and it also means that"
 4652     warn2 "the \`webcollage' program will be much slower."
 4653   else
 4654     warn2 "This means the \`webcollage' program will be much slower."
 4655   fi
 4656 fi
 4657 
 4658 
 4659 if test "$have_png" = no ; then
 4660   if test "$with_png_req" = yes ; then
 4661     warnL 'Use of libpng was requested, but it was not found.'
 4662   elif test "$with_png_req" = no ; then
 4663     warnL 'The PNG library is not being used.'
 4664   else
 4665     warnL 'The PNG library was not found.'
 4666   fi
 4667 
 4668   if test "$png_halfassed" = yes ; then halfassery ; fi
 4669   warn2 "Many things aren't going to work right."
 4670 fi
 4671 
 4672 
 4673 if test "$have_xinput" = no ; then
 4674   warnL 'The XInput2 library was not found.  It is required.'
 4675   if test "$xinput_halfassed" = yes ; then halfassery ; else echo '' ; fi
 4676 fi
 4677 
 4678 
 4679 if test "$have_xft" = no ; then
 4680   warnL 'The XFreeType library was not found.  It is required.'
 4681   if test "$xft_halfassed" = yes ; then halfassery ; else echo '' ; fi
 4682 fi
 4683 
 4684 
 4685 if test "$have_systemd" = no ; then
 4686   systemd_warned=no
 4687   if test "$systemd_too_old" = yes ; then
 4688     warnL "The systemd library is too old."
 4689     systemd_warned=yes
 4690   elif test "$with_systemd_req" = yes ; then
 4691     warnL "Use of systemd was requested, but it was not found."
 4692     systemd_warned=yes
 4693   elif test "$ac_macosx" = yes; then
 4694     true
 4695   elif test "$with_systemd_req" = no ; then
 4696     noteL 'The systemd library is not being used.'
 4697     systemd_warned=yes
 4698   else
 4699     warnL "The systemd library was not found."
 4700     systemd_warned=yes
 4701   fi
 4702 
 4703   if test "$systemd_halfassed" = yes ; then
 4704     halfassery
 4705     systemd_warned=yes
 4706   fi
 4707 
 4708   if test "$systemd_warned" = yes; then
 4709     echo ''
 4710     warn2 "This means that xscreensaver-systemd won't be built."
 4711     warn2 "Without that, xscreensaver will not be able to auto-lock"
 4712     warn2 "before the system is suspended (e.g., closing laptop lid)"
 4713     warn2 "and might activate while video playback is in progress."
 4714   fi
 4715 fi
 4716 
 4717 
 4718 if test "$have_gl" = no ; then
 4719   if test "$with_gl_req" = yes ; then
 4720     warnL 'Use of GL was requested, but it was not found.'
 4721   elif test "$with_gl_req" = no ; then
 4722     noteL 'The OpenGL 3D library is not being used.'
 4723   else
 4724     noteL 'The OpenGL 3D library was not found.'
 4725   fi
 4726 
 4727   if test "$gl_halfassed" = yes ; then
 4728     halfassery
 4729     if test "$have_glx" = no -a "$have_egl" = no; then
 4730       echo ''
 4731       warn2 'Neither EGL nor GLX were found.'
 4732     fi
 4733   fi
 4734 
 4735   echo ''
 4736   warn2 'Those demos which use 3D will not be built or installed.'
 4737   warn2 'You might want to consider installing OpenGL and'
 4738   warn2 're-running configure.'
 4739 
 4740 fi
 4741 
 4742 if test "$have_gl" = yes -a "$have_gle" = no ; then
 4743 
 4744  # nobody cares about this; don't print the warning unless it was
 4745  # requested and not found, or halfway-found.
 4746  if test "$with_gle_req" = yes -o "$gle_halfassed" = yes ; then
 4747 
 4748   if test "$with_gle_req" = yes ; then
 4749     noteL 'Use of the GLE (GL Extrusion) library was requested, but'
 4750     warn2 'it was not found (though the OpenGL library was found, and'
 4751     warn2 'is being used.)'
 4752   elif test "$with_gle_req" = no ; then
 4753     noteL 'The OpenGL Library is being used, but the GLE (GL Extrusion)'
 4754     warn2 'library is not.'
 4755   else
 4756     noteL 'The OpenGL Library was found, but the GLE (GL Extrusion)'
 4757     warn2 'library was not.'
 4758   fi
 4759 
 4760   if test "$gle_halfassed" = yes ; then halfassery ; fi
 4761 
 4762   echo ''
 4763   warn2 'Some of the OpenGL (3D) demos (those that depend on GLE)'
 4764   warn2 'will not be built or installed.  You might want to consider'
 4765   warn2 'installing GLE and re-running configure.  You can find the'
 4766   warn2 'GLE library at <http://www.linas.org/gle/>'
 4767 
 4768  fi
 4769 fi
 4770 
 4771 
 4772 if test "$with_readdisplay_req" = yes -a "$have_readdisplay" = no ; then
 4773   warn 'Use of XReadDisplay was requested, but it was not found.'
 4774 fi
 4775 
 4776 if test "$with_kerberos_req" = yes -a "$have_kerberos" = no ; then
 4777   warn 'Use of Kerberos was requested, but it was not found.'
 4778 fi
 4779 
 4780 if test "$with_pam_req" = yes -a "$have_pam" = no ; then
 4781   warn 'Use of PAM was requested, but it was not found.'
 4782 elif test "$have_pam" = no ; then
 4783   if test -d /etc/pam.d -o -f /etc/pam.conf ; then
 4784     warn  "Your system seems to have PAM, but PAM is not being used."
 4785     warn2 "That is probably not going to work out well."
 4786     
 4787   fi
 4788 fi
 4789 
 4790 if test "$with_shadow_req" = yes -a "$have_shadow" = no ; then
 4791   warn 'Use of shadow passwords was requested, but they were not found.'
 4792 fi
 4793 
 4794 if test "$setcap_hacks_req" = yes -a "$have_libcap" = no ; then
 4795   warn 'Use of libcap was requested, but it was not found.'
 4796 fi
 4797 
 4798 if test "$ac_macosx" = yes -a "$enable_locking" = yes ; then
 4799   warn  "You have specified --enable-locking on macOS."
 4800   warn2 "THIS DOES NOT WORK!  Don't do this!"
 4801 fi
 4802 
 4803 
 4804 # You are in a twisty maze of namespaces and syntaxes, all alike.
 4805 # Expand all of these as the Makefile will probably expand them.
 4806 # Fuck the skull of Unix.
 4807 #
 4808 bindir=`eval eval eval eval eval eval eval echo $bindir`
 4809 HACKDIR=`eval eval eval eval eval eval eval echo $HACKDIR`
 4810 HACK_CONF_DIR=`eval eval eval eval eval eval eval echo $HACK_CONF_DIR`
 4811 FONT_DIR=`eval eval eval eval eval eval eval echo $FONT_DIR`
 4812 
 4813 # canonicalize slashes.
 4814 bindir=`echo  "${bindir}"              | sed 's@/$@@;s@//*@/@g'`
 4815 HACKDIR=`echo "${HACKDIR}"             | sed 's@/$@@;s@//*@/@g'`
 4816 HACK_CONF_DIR=`echo "${HACK_CONF_DIR}" | sed 's@/$@@;s@//*@/@g'`
 4817 FONT_DIR=`echo "${FONT_DIR}"           | sed 's@/$@@;s@//*@/@g'`
 4818 
 4819 if test -z "$FONT_DIR" ; then
 4820   FONT_DIR='not installed';
 4821 else
 4822   FONT_DIR="${FONT_DIR}/"
 4823 fi
 4824 
 4825 # Sanity check the hackdir
 4826 for bad_choice in xscreensaver xscreensaver-settings xscreensaver-command ; do
 4827   if test "${HACKDIR}" = "${bindir}/${bad_choice}" ; then
 4828     echo ""
 4829     AC_MSG_ERROR(["--with-hackdir=${bindir}/${bad_choice}" won't work.
 4830                    There will be an executable installed with that name, so
 4831                    that can't be the name of a directory as well.  Please
 4832                    re-configure with a different directory name.])
 4833   fi
 4834 done
 4835 
 4836 
 4837 # Warn if there's a previous RPM package installed.
 4838 
 4839 rpm_vers=
 4840 if test -z "$RPM_PACKAGE_VERSION" ; then
 4841   # Don't bother with this test if we are currently *building* an RPM.
 4842   rpmnames="xscreensaver xscreensaver-base xscreensaver-extras
 4843             xscreensaver-data xscreensaver-data-extra"
 4844 
 4845   # M4 sucks!!
 4846   changequote(X,Y)
 4847   pkg_vers=`(rpm -qv $rpmnames) 2>&- | \
 4848         sed -n 's/^[-a-z]*-\([0-9][0-9]*[.].*\)/\1/p' | head -1`
 4849   rpm_vers="$pkg_vers"
 4850   changequote([,])
 4851 fi
 4852 
 4853 if test \! -z "$rpm_vers" ; then
 4854 
 4855   # M4 sucks!!
 4856   changequote(A,B)
 4857   pkg_bindir=`rpm  -ql $rpmnames | sed -n 's@^\(.*/\)xscreensaver-settings$@\1@p'`
 4858   pkg_bindir2=`rpm -ql $rpmnames | sed -n 's@^\(.*/\)xscreensaver-demo$@\1@p'`
 4859   pkg_hackdir=`rpm -ql $rpmnames | sed -n 's@^\(.*/\)popsquares$@\1@p'`
 4860   pkg_confdir=`rpm -ql $rpmnames | sed -n 's@^\(.*/\)popsquares\.xml$@\1@p'`
 4861   pkg_fontdir=`rpm -ql $rpmnames | sed -n 's@^\(.*/\).*\.ttf$@\1@p' | head -1`
 4862   pkg_addir=`rpm   -ql $rpmnames | sed -n 's@^\(.*/\)XScreenSaver$@\1@p'`
 4863 
 4864   if test -z "$pkg_bindir" ; then pkg_bindir="$pkg_bindir2" ; fi
 4865   changequote([,])
 4866 fi
 4867 
 4868 
 4869 # Warn if there's a previous Debian package installed.
 4870 #
 4871 deb_vers=
 4872 if test -z "$pkg_vers" ; then
 4873   debnames="xscreensaver xscreensaver-data xscreensaver-data-extra"
 4874   pkg_vers=''
 4875   for dpkg in $debnames ; do
 4876     if test -z "$pkg_vers"; then
 4877       pkg_vers=`dpkg -s $dpkg 2>/dev/null | sed -n 's/^Version: \(.*\)$/\1/p'`
 4878       deb_vers="$pkg_vers"
 4879     fi
 4880   done
 4881 fi
 4882 
 4883 if test \! -z "$deb_vers" ; then
 4884 
 4885   # M4 sucks!!
 4886   changequote(A,B)
 4887   pkg_bindir=`dpkg  -L $debnames 2>&- | sed -n 's@^\(.*/\)xscreensaver-settings$@\1@p'`
 4888   pkg_bindir2=`dpkg -L $debnames 2>&- | sed -n 's@^\(.*/\)xscreensaver-demo$@\1@p'`
 4889   pkg_hackdir=`dpkg -L $debnames 2>&- | sed -n 's@^\(.*/\)popsquares$@\1@p'`
 4890   pkg_confdir=`dpkg -L $debnames 2>&- | sed -n 's@^\(.*/\)popsquares\.xml$@\1@p'`
 4891   pkg_fontdir=`dpkg -L $debnames 2>&- | sed -n 's@^\(.*/\).*\.ttf$@\1@p' | head -1`
 4892   pkg_addir=`dpkg   -L $debnames 2>&- | sed -n 's@^\(.*/\)XScreenSaver[^/]*$@\1@p'`
 4893   changequote([,])
 4894 
 4895   if test -z "$pkg_bindir" ; then pkg_bindir="$pkg_bindir2" ; fi
 4896 fi
 4897 
 4898 bindir_err=
 4899 hackdir_err=
 4900 confdir_err=
 4901 fontdir_err=
 4902 addir_err=
 4903 if ! test -z "$pkg_vers" ; then
 4904 
 4905   err=" (DIFFERS)"
 4906 
 4907   if test -z "$pkg_bindir"  ; then pkg_bindir='???'
 4908   elif test "$pkg_bindir"  != "${bindir}/"        ; then bindir_err="$err" ; fi
 4909 
 4910   if test -z "$pkg_hackdir" ; then pkg_hackdir='???'
 4911   elif test "$pkg_hackdir" != "${HACKDIR}/"       ; then hackdir_err="$err"; fi
 4912 
 4913   if test -z "$pkg_confdir" ; then pkg_confdir='???'
 4914   elif test "$pkg_confdir" != "${HACK_CONF_DIR}/" ; then confdir_err="$err"; fi
 4915 
 4916   if test -z "$pkg_fontdir" ; then pkg_fontdir='none'
 4917   elif test "$pkg_fontdir/" != "${FONT_DIR}"      ; then fontdir_err="$err"; fi
 4918 
 4919   if test -z "$pkg_addir"   ; then pkg_addir='???'
 4920   elif test "$pkg_addir"   != "${APPDEFAULTS}/"   ; then addir_err="$err"  ; fi
 4921 
 4922   warning=no
 4923   warnL "There is already an installed package of xscreensaver"
 4924   warn2 "version \"$pkg_vers\", in these directories:"
 4925   echo ""
 4926   warn2 "User programs: $pkg_bindir$bindir_err"
 4927   warn2 "Screen savers: $pkg_hackdir$hackdir_err"
 4928   warn2 "Configuration: $pkg_confdir$confdir_err"
 4929   warn2 "Extra fonts:   $pkg_fontdir$fontdir_err"
 4930   warn2 "App Defaults:  $pkg_addir$addir_err"
 4931 fi
 4932 
 4933 echo ""
 4934 echo "$warnsep"
 4935 echo ""
 4936 echo "    XScreenSaver will be installed in these directories:"
 4937 echo ""
 4938 echo "             User programs: ${bindir}/$bindir_err"
 4939 echo "             Screen savers: ${HACKDIR}/$hackdir_err"
 4940 echo "             Configuration: ${HACK_CONF_DIR}/$confdir_err"
 4941 echo "             Extra Fonts:   ${FONT_DIR}$fontdir_err"
 4942 echo "             App Defaults:  ${APPDEFAULTS}/$addir_err"
 4943 echo ""