+lesstif_version=unknown
+lesstif_version_string=unknown
+
+if test "$have_lesstif" = yes ; then
+ ltv=unknown
+ echo unknown > conftest-lt
+ AC_CACHE_CHECK([LessTif version number],
+ ac_cv_lesstif_version_string,
+ [AC_TRY_X_RUN([#include <stdio.h>
+ #include <Xm/Xm.h>
+ int main() {
+ FILE *f = fopen("conftest-lt", "w");
+ if (!f) exit(1);
+ fprintf(f, "%d %d.%d\n", LesstifVersion,
+ LESSTIF_VERSION, LESSTIF_REVISION);
+ fclose(f);
+ exit(0);
+ }],
+ [ltv=`cat conftest-lt`
+ ac_cv_lesstif_version=`echo $ltv | sed 's/ .*//'`
+ ac_cv_lesstif_version_string=`echo $ltv | sed 's/.* //'`],
+ [ac_cv_lesstif_version=unknown
+ ac_cv_lesstif_version_string=unknown],
+ [ac_cv_lesstif_version=unknown
+ ac_cv_lesstif_version_string=unknown])])
+ rm -f conftest-lt
+ lesstif_version=$ac_cv_lesstif_version
+ lesstif_version_string=$ac_cv_lesstif_version_string
+
+fi
+
+
+if test "$have_motif" = yes ; then
+ mtv=unknown
+ echo unknown > conftest-mt
+ AC_CACHE_CHECK([Motif version number],
+ ac_cv_motif_version_string,
+ [AC_TRY_X_RUN([#include <stdio.h>
+ #include <Xm/Xm.h>
+ int main() {
+ FILE *f = fopen("conftest-mt", "w");
+ if (!f) exit(1);
+ fprintf(f, "%d %d.%d\n", XmVersion,
+ XmVERSION, XmREVISION);
+ fclose(f);
+ exit(0);
+ }],
+ [mtv=`cat conftest-mt`
+ ac_cv_motif_version=`echo $mtv | sed 's/ .*//'`
+ ac_cv_motif_version_string=`echo $mtv | sed 's/.* //'`],
+ [ac_cv_motif_version=unknown
+ ac_cv_motif_version_string=unknown],
+ [ac_cv_motif_version=unknown
+ ac_cv_motif_version_string=unknown])])
+ rm -f conftest-mt
+ motif_version=$ac_cv_motif_version
+ motif_version_string=$ac_cv_motif_version_string
+
+fi
+
+
+###############################################################################
+#
+# Checking whether Motif requires -lXpm.
+#
+# If this is Motif 2.x, and we have XPM, then link against XPM as well.
+# The deal is, Motif 2.x requires XPM -- but it's a compilation option
+# of the library whether to build the XPM code into libXm, or whether
+# to rely on an external libXm. So the only way to tell whether XPM is
+# a link-time requirement is to examine libXm.a, which is very
+# difficult to do in an autoconf script. So... if it's Motif 2.x, we
+# always link against XPM if the XPM lib exists (and this will be a
+# no-op if libXm happens to already have the XPM code in it.)
+#
+###############################################################################
+
+motif_requires_xpm=no
+if test "$have_motif" = yes ; then
+ AC_MSG_CHECKING(whether Motif requires XPM)
+ if test "$motif_version" = "unknown" || test "$motif_version" -ge 2000
+ then
+ motif_requires_xpm=yes
+ AC_MSG_RESULT(maybe)
+ else
+ AC_MSG_RESULT(no)
+ fi
+fi
+
+
+###############################################################################
+#
+# Checking whether Motif requires -lXp.
+#
+# Some versions of Motif (2.1.0, at least) require -lXp, the "X Printing
+# Extension". Why this extension isn't in -lXext with all the others,
+# I have no idea.
+#
+###############################################################################
+
+have_xp_ext=no
+if test "$have_motif" = yes ; then
+ have_xp_ext=no
+ AC_CHECK_X_LIB(Xp, XpQueryExtension,
+ [have_xp_ext=yes; MOTIF_LIBS="$MOTIF_LIBS -lXp"],
+ [true], -lX11 -lXext -lm)
+fi
+
+
+###############################################################################
+#
+# Checking whether Motif requires -lXintl (for _Xsetlocale.)
+#
+###############################################################################
+
+have_xintl=no
+if test "$have_motif" = yes ; then
+ AC_CHECK_X_LIB(Xintl, _Xsetlocale, [have_xintl=yes], [have_xintl=no],
+ -lX11 -lXext -lm)
+ if test "$have_xintl" = yes; then
+ MOTIF_LIBS="$MOTIF_LIBS -lXintl"
+ fi
+fi
+
+
+###############################################################################
+#
+# Check for -lGL or -lMesaGL.
+#
+###############################################################################
+
+have_gl=no
+ac_have_mesa_gl=no
+with_gl_req=unspecified
+gl_halfassed=no
+AC_ARG_WITH(gl,[
+Graphics options:
+
+ --with-gl Build those demos which depend on OpenGL.],
+ [with_gl="$withval"; with_gl_req="$withval"],[with_gl=yes])
+
+HANDLE_X_PATH_ARG(with_gl, --with-gl, GL)
+
+ac_mesagl_version=unknown
+ac_mesagl_version_string=unknown
+
+if test "$with_gl" = yes; then
+ AC_CHECK_X_HEADER(GL/gl.h, have_gl=yes, have_gl=no)
+ if test "$have_gl" = yes ; then
+ AC_CHECK_X_HEADER(GL/glx.h, have_gl=yes, have_gl=no,
+ [#include <GL/gl.h>])
+ fi
+
+ # If we have the headers, try and figure out which vendor it's from.
+ #
+ if test "$have_gl" = yes ; then
+
+ # We need to know whether it's MesaGL so that we know which libraries
+ # to link against.
+ #
+ AC_CACHE_CHECK([whether GL is really MesaGL], ac_cv_have_mesa_gl,
+ [ac_cv_have_mesa_gl=no
+ if test "$ac_macosx" = no; then
+ # WTF! MacOS 10.5.0 ships the Mesa GL headers!
+ # It's not really Mesa, is it?
+ AC_EGREP_X_HEADER(Mesa|MESA, GL/glx.h, [ac_cv_have_mesa_gl=yes])
+ fi])
+ ac_have_mesa_gl=$ac_cv_have_mesa_gl
+
+ gl_lib_1=""
+ GL_LIBS=""
+
+ if test "$ac_macosx" = yes; then
+
+ # Without these, every link against libGL gets a bunch of useless
+ # warnings.
+ #
+ osx_crud="-bind_at_load -multiply_defined suppress"
+ AC_MSG_RESULT(adding "$osx_crud" to GL_LIBS)
+ GL_LIBS="$GL_LIBS $osx_crud"
+ unset osx_crud
+
+ # New lossage in 10.5.0: without this, we get:
+ # ld: cycle in dylib re-exports with /usr/X11/lib/libGL.dylib
+ #
+ osx_crud="/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib"
+ osx_crud="-Wl,-dylib_file,${osx_crud}:${osx_crud}"
+
+ AC_MSG_RESULT(adding "$osx_crud" to GL_LIBS)
+ GL_LIBS="$GL_LIBS $osx_crud"
+ unset osx_crud
+
+ # New lossage in 10.6.8: we can't allow -L/opt/local/lib to be in the
+ # link line, or at runtime XQueryExtension gets a segv due to some kind
+ # of library version skew. Libs must come from /usr/X11/lib even if
+ # $prefix and/or $exec_prefix are set to /opt/local/.
+ #
+ AC_MSG_RESULT(omitting "$libdir" from LDFLAGS)
+ libdir=''
+
+ fi
+
+
+ # Some versions of MesaGL are compiled to require -lpthread.
+ # So if the Mesa headers exist, and -lpthread exists, then always
+ # link -lpthread after the Mesa libs (be they named -lGL or -lMesaGL.)
+ #
+ # Oftentimes, AX_PTHREAD will bring in -lpthread as well; but that ends
+ # up before -l(Mesa)GL, instead of after where it would belong.
+ #
+ if test "$ac_have_mesa_gl" = yes; then
+ AC_CHECK_LIB(pthread, pthread_create, [GL_LIBS="-lpthread"], [],)
+ fi
+
+
+ # If we have Mesa headers, check to see if we can link against -lMesaGL.
+ # If we don't have Mesa headers, or we don't have -lMesaGL, try -lGL.
+ # Else, warn that GL is busted. (We have the headers, but no libs.)
+ #
+
+ if test "$ac_have_mesa_gl" = yes ; then
+ AC_CHECK_X_LIB(MesaGL, glXCreateContext,
+ [gl_lib_1="MesaGL"
+ GL_LIBS="-lMesaGL -lMesaGLU $VIDMODE_LIBS $GL_LIBS"],
+ [], -lMesaGLU $GL_LIBS -lX11 -lXext $VIDMODE_LIBS -lm)
+ fi
+
+ if test "$gl_lib_1" = "" ; then
+ AC_CHECK_X_LIB(GL, glXCreateContext,
+ [gl_lib_1="GL"
+ GL_LIBS="-lGL -lGLU $VIDMODE_LIBS $GL_LIBS"],
+ [], -lGLU $GL_LIBS -lX11 -lXext $VIDMODE_LIBS -lm)
+ fi
+
+ if test "$gl_lib_1" = "" ; then
+ # we have headers, but no libs -- bail.
+ have_gl=no
+ ac_have_mesa_gl=no
+ gl_halfassed=yes
+ else
+ # linking works -- we can build the GL hacks.
+ AC_DEFINE(HAVE_GL)
+ if test "$ac_have_mesa_gl" = yes ; then
+ AC_DEFINE(HAVE_MESA_GL)
+ fi
+ fi
+ fi
+
+
+ # Now that we know we have GL headers and libs, do some more GL testing.
+ #
+
+ if test "$have_gl" = yes ; then
+ # If it's MesaGL, we'd like to issue a warning if the version number
+ # is less than or equal to 2.6, because that version had a security bug.
+ #
+ if test "$ac_have_mesa_gl" = yes; then
+
+ AC_CACHE_CHECK([MesaGL version number], ac_cv_mesagl_version_string,
+ [cat > conftest.$ac_ext <<EOF
+#line __oline__ "configure"
+#include "confdefs.h"
+#include <GL/gl.h>
+#ifndef MESA_MAJOR_VERSION
+# include <GL/xmesa.h>
+# ifdef XMESA_MAJOR_VERSION
+ /* Around Mesa 3.2, they took out the Mesa version number, so instead,
+ we have to check the XMesa version number (the number of the X protocol
+ support, which seems to be the same as the Mesa version number.)
+ */
+# define MESA_MAJOR_VERSION XMESA_MAJOR_VERSION
+# define MESA_MINOR_VERSION XMESA_MINOR_VERSION
+# else
+ /* Oh great. Some time after 3.4, they took out the xmesa.h header file,
+ so we have no way of telling what version of Mesa this is at all.
+ So, we'll guess that the osmesa version (the "offscreen protocol")
+ is less than or equal to the real mesa version number. Except that
+ if OSmesa is 3.3, assume at least Mesa 3.4, since OSmesa was 3.3 in
+ Mesa 3.4. And Mesa 3.3 had xmesa.h. What a complete load of shit!
+ */
+# include <GL/osmesa.h>
+# define MESA_MAJOR_VERSION OSMESA_MAJOR_VERSION
+# define MESA_MINOR_VERSION OSMESA_MINOR_VERSION or newer, probably?
+# if OSMESA_MAJOR_VERSION == 3 && OSMESA_MINOR_VERSION == 3
+# undef MESA_MINOR_VERSION
+# define MESA_MINOR_VERSION 4 or newer, probably?
+# endif
+# endif
+#endif
+configure: MESA_MAJOR_VERSION MESA_MINOR_VERSION
+EOF
+
+ ac_save_CPPFLAGS="$CPPFLAGS"
+ if test \! -z "$includedir" ; then
+ CPPFLAGS="$CPPFLAGS -I$includedir"
+ fi
+ CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+
+ mglv=`(eval "$ac_cpp conftest.$ac_ext") 2>&AC_FD_CC | grep configure:`
+
+ # M4 sucks!!
+ changequote(X,Y)
+ mglv=`echo "$mglv" | sed -n \
+ 's/^configure: *\([0-9][0-9]*\) *\([0-9].*\)$/\1.\2/p'`
+ changequote([,])
+
+ rm -f conftest.$ac_ext
+
+ CPPFLAGS="$ac_save_CPPFLAGS"
+
+ if test "$mglv" = ""; then
+ ac_mesagl_version=unknown
+ ac_mesagl_version_string=unknown
+ else
+ ac_mesagl_version_string="$mglv"
+ # M4 sucks!!
+ changequote(X,Y)
+ maj=`echo "$mglv" | sed -n 's/^\([0-9][0-9]*\)\..*$/\1/p'`
+ min=`echo "$mglv" | sed -n 's/^.*\.\([0-9][0-9]*\).*$/\1/p'`
+ changequote([,])
+ ac_mesagl_version=`echo "$maj * 1000 + $min" | bc`
+ if test -z "$ac_mesagl_version"; then
+ ac_mesagl_version=unknown
+ ac_mesagl_version_string=unknown
+ fi
+ fi
+ ac_cv_mesagl_version=$ac_mesagl_version
+ ac_cv_mesagl_version_string=$ac_mesagl_version_string
+ ])
+ ac_mesagl_version=$ac_cv_mesagl_version
+ ac_mesagl_version_string=$ac_cv_mesagl_version_string
+ fi
+
+
+ # Check for OpenGL 1.1 features.
+ #
+ AC_CHECK_X_LIB($gl_lib_1, glBindTexture, [AC_DEFINE(HAVE_GLBINDTEXTURE)],
+ [true], $GL_LIBS -lX11 -lXext -lm)
+ fi
+
+elif test "$with_gl" != no; then
+ echo "error: must be yes or no: --with-gl=$with_gl"
+ exit 1
+fi
+
+
+###############################################################################
+#
+# Check for -lgle.
+#
+###############################################################################
+
+have_gle=no
+with_gle_req=unspecified
+gle_halfassed=no
+AC_ARG_WITH(gle,
+[ --with-gle Build those demos which depend on GLE
+ (the OpenGL "extrusion" library.)],
+ [with_gle="$withval"; with_gle_req="$withval"],[with_gle=yes])
+
+HANDLE_X_PATH_ARG(with_gle, --with-gle, GLE)
+
+GLE_LIBS=""
+
+if test "$have_gl" = no ; then
+ true
+elif test "$with_gle" = yes; then
+
+ AC_CHECK_X_HEADER(GL/gle.h, have_gle3=yes, have_gle3=no,
+ [#include <GL/gl.h>])
+ if test "$have_gle3" = yes ; then
+ have_gle=yes;
+ else
+ AC_CHECK_X_HEADER(GL/gutil.h, have_gle=yes, have_gle=no,
+ [#include <GL/gl.h>])
+ if test "$have_gle" = yes ; then
+ AC_CHECK_X_HEADER(GL/tube.h, have_gle=yes, have_gle=no,
+ [#include <GL/gl.h>])
+ fi
+ fi
+
+ if test "$have_gle" = yes ; then
+ have_gle=no
+ gle_halfassed=yes
+ AC_CHECK_X_LIB(gle, gleCreateGC,
+ [have_gle=yes; gle_halfassed=no; GLE_LIBS="-lgle"],
+ [], $GL_LIBS -lX11 -lXext -lm)
+ fi
+ if test "$have_gle" = yes ; then
+ have_gle=no
+ gle_halfassed=yes
+
+ # sometimes the libmatrix stuff is included in libgle. look there first.
+#
+# I don't get it. For some reason, this test passes on SGI, as if
+# uview_direction_d() was in libgle -- but it's not, it's in libmatrix.
+# Yet the link is succeeding. Why???
+#
+# AC_CHECK_X_LIB(gle, uview_direction_d,
+# [have_gle=yes; gle_halfassed=no],
+# [], $GL_LIBS -lX11 -lXext -lm)
+
+ # As of GLE 3 this is in libgle, and has changed name to uview_direction!
+ # *sigh*
+ if test "$have_gle3" = yes ; then
+ AC_CHECK_X_LIB(gle, uview_direction,
+ [have_gle=yes; gle_halfassed=no],
+ [], $GL_LIBS -lX11 -lXext -lm)
+ fi
+ # if it wasn't in libgle, then look in libmatrix.
+ if test "$have_gle" = no ; then
+ AC_CHECK_X_LIB(matrix, uview_direction_d,
+ [have_gle=yes; gle_halfassed=no;
+ GLE_LIBS="$GLE_LIBS -lmatrix"],
+ [], $GL_LIBS -lX11 -lXext -lm)
+ fi
+ fi
+
+ if test "$have_gle" = yes ; then
+ AC_DEFINE(HAVE_GLE)
+ if test "$have_gle3" = yes ; then
+ AC_DEFINE(HAVE_GLE3)
+ fi
+ fi
+
+elif test "$with_gle" != no; then
+ echo "error: must be yes or no: --with-gle=$with_gle"
+ exit 1
+
+fi
+
+
+###############################################################################
+#
+# Handle --with-gles
+#
+###############################################################################
+
+with_gles_req=unspecified
+AC_ARG_WITH(gles,
+[ --with-gles Target OpenGL ES 1.x API instead of OpenGL 1.3.],
+ [with_gles="$withval"; with_gles_req="$withval"],[with_gles=no])
+
+HANDLE_X_PATH_ARG(with_gles, --with-gles, JWZGLES)
+
+if test "$with_gles" = yes; then
+ have_gles=yes
+ AC_DEFINE(HAVE_JWZGLES)
+ JWZGLES_OBJS="jwzgles.o"
+ AC_MSG_RESULT(using OpenGL ES compatiblity shim)
+elif test "$with_gles" != no; then
+ echo "error: must be yes or no: --with-gles=$with_xpm"
+ exit 1
+fi
+
+###############################################################################
+#
+# Check for -lgdk_pixbuf.
+# These tests are for gdk_pixbuf usage of the hacks,
+# not xscreensaver-demo (thus we have to test again to get
+# the libraries right: don't want to pull in all of GTK
+# for the hacks.)
+#
+###############################################################################
+
+have_gdk_pixbuf=no
+with_gdk_pixbuf_req=unspecified
+AC_ARG_WITH(pixbuf,
+[ --with-pixbuf Include support for the GDK-Pixbuf library in some
+ demos, which will make it possible for them to read
+ GIF, JPEG, and PNG files as well.],
+ [with_gdk_pixbuf="$withval"; with_gdk_pixbuf_req="$withval"],
+ [with_gdk_pixbuf=yes])
+
+# if --with-pixbuf=/directory/ was specified, remember that directory so that
+# we can also look for the `gdk-pixbuf-config' program in that directory.
+case "$with_gdk_pixbuf" in
+ /*)
+ gdk_pixbuf_dir="$with_gdk_pixbuf"
+ ;;
+ *)
+ gdk_pixbuf_dir=""
+ ;;
+esac
+
+HANDLE_X_PATH_ARG(with_gdk_pixbuf, --with-pixbuf, GDK_PIXBUF)
+
+if test "$with_gdk_pixbuf" != yes -a "$with_gdk_pixbuf" != no ; then
+ echo "error: must be yes or no: --with-pixbuf=$with_gdk_pixbuf"
+ exit 1
+fi
+
+if test "$with_gdk_pixbuf" = yes; then
+ have_gdk_pixbuf=no
+
+ pkgs=''
+ ok="yes"
+
+ pkg_check_version gdk-pixbuf-2.0 2.0.0
+ pkg_check_version gdk-pixbuf-xlib-2.0 2.0.0
+ have_gdk_pixbuf="$ok"
+
+ if test "$have_gdk_pixbuf" = yes; then
+ AC_CACHE_CHECK([for gdk-pixbuf includes], ac_cv_gdk_pixbuf_config_cflags,
+ [ac_cv_gdk_pixbuf_config_cflags=`$pkg_config --cflags $pkgs`])
+ AC_CACHE_CHECK([for gdk-pixbuf libs], ac_cv_gdk_pixbuf_config_libs,
+ [ac_cv_gdk_pixbuf_config_libs=`$pkg_config --libs $pkgs`])
+ fi
+
+ ac_gdk_pixbuf_config_cflags=$ac_cv_gdk_pixbuf_config_cflags
+ ac_gdk_pixbuf_config_libs=$ac_cv_gdk_pixbuf_config_libs
+
+
+ if test "$have_gdk_pixbuf" = yes; then
+ #
+ # we appear to have pixbuf; check for headers/libs to be sure.
+ #
+ ac_save_gdk_pixbuf_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $ac_gdk_pixbuf_config_cflags"
+
+ have_gdk_pixbuf=no
+
+ # check for header A...
+ AC_CHECK_X_HEADER(gdk-pixbuf/gdk-pixbuf.h, [have_gdk_pixbuf=yes])
+
+ # if that worked, check for header B...
+ if test "$have_gdk_pixbuf" = yes; then
+ have_gdk_pixbuf=no
+ gdk_pixbuf_halfassed=yes
+ AC_CHECK_X_HEADER(gdk-pixbuf/gdk-pixbuf-xlib.h,
+ [have_gdk_pixbuf=yes
+ gdk_pixbuf_halfassed=no])
+
+ # yay, it has a new name in Gtk 2.x...
+ if test "$have_gdk_pixbuf" = no; then
+ have_gdk_pixbuf=no
+ gdk_pixbuf_halfassed=yes
+ AC_CHECK_X_HEADER(gdk-pixbuf-xlib/gdk-pixbuf-xlib.h,
+ [have_gdk_pixbuf=yes
+ gdk_pixbuf_halfassed=no])
+ fi
+ fi
+ CPPFLAGS="$ac_save_gdk_pixbuf_CPPFLAGS"
+ fi
+
+ if test "$have_gdk_pixbuf" = yes; then
+ # we have the headers, now check for the libraries
+ have_gdk_pixbuf=no
+ gdk_pixbuf_halfassed=yes
+
+ AC_MSG_RESULT(checking for gdk_pixbuf usability...)
+
+ # library A...
+ AC_CHECK_X_LIB(c, gdk_pixbuf_new_from_file, [have_gdk_pixbuf=yes],,
+ $ac_gdk_pixbuf_config_libs -lX11 -lXext -lm)
+ # library B...
+ if test "$have_gdk_pixbuf" = yes; then
+ have_gdk_pixbuf=no
+ AC_CHECK_X_LIB(c, gdk_pixbuf_xlib_init,
+ [have_gdk_pixbuf=yes
+ gdk_pixbuf_halfassed=no],,
+ $ac_gdk_pixbuf_config_libs -lX11 -lXext -lm)
+ fi
+ fi
+
+ if test "$have_gdk_pixbuf" = yes; then
+ INCLUDES="$INCLUDES $ac_gdk_pixbuf_config_cflags"
+ XPM_LIBS="$ac_gdk_pixbuf_config_libs"
+ AC_DEFINE(HAVE_GDK_PIXBUF)
+ else
+ AC_MSG_RESULT(checking for gdk_pixbuf usability... no)
+ fi
+
+ if test "$have_gdk_pixbuf" = yes; then
+ AC_CHECK_X_LIB(c, gdk_pixbuf_apply_embedded_orientation,
+ [AC_DEFINE(HAVE_GDK_PIXBUF_APPLY_EMBEDDED_ORIENTATION)],,
+ $ac_gdk_pixbuf_config_libs -lX11 -lXext -lm)
+ fi
+fi
+
+
+###############################################################################
+#
+# Check for -lXpm.
+#
+###############################################################################
+
+have_xpm=no
+with_xpm_req=unspecified
+AC_ARG_WITH(xpm,
+[ --with-xpm Include support for XPM files in some demos.
+ (Not needed if Pixbuf is used.)],
+ [with_xpm="$withval"; with_xpm_req="$withval"],[with_xpm=yes])
+
+HANDLE_X_PATH_ARG(with_xpm, --with-xpm, XPM)
+
+if test "$with_xpm" = yes; then
+ AC_CHECK_X_HEADER(X11/xpm.h,
+ [have_xpm=yes
+ AC_DEFINE(HAVE_XPM)
+ XPM_LIBS="-lXpm $XPM_LIBS"],,
+ [#include <X11/Xlib.h>])
+elif test "$with_xpm" != no; then
+ echo "error: must be yes or no: --with-xpm=$with_xpm"
+ exit 1
+fi
+
+# See comment near $motif_requires_xpm, above.
+# Need to do this here, after both Motif and XPM have been checked for.
+#
+if test "$have_motif" = yes -a "$have_xpm" = yes ; then
+ if test "$motif_requires_xpm" = yes ; then
+ MOTIF_LIBS="$MOTIF_LIBS $XPM_LIBS"
+ fi
+fi
+
+if test "$XPM_LIBS" = "" ; then
+ XPM_LIBS=$(MINIXPM)
+fi
+
+
+###############################################################################
+#
+# Check for -ljpeg
+#
+###############################################################################
+
+have_jpeg=no
+with_jpeg_req=unspecified
+jpeg_halfassed=no
+AC_ARG_WITH(jpeg,
+[ --with-jpeg Include support for the JPEG library.],
+ [with_jpeg="$withval"; with_jpeg_req="$withval"],
+ [with_jpeg=yes])
+
+HANDLE_X_PATH_ARG(with_jpeg, --with-jpeg, JPEG)
+
+if test "$with_jpeg" != yes -a "$with_jpeg" != no ; then
+ echo "error: must be yes or no: --with-jpeg=$with_jpeg"
+ exit 1
+fi
+
+if test "$with_jpeg" = yes; then
+
+ have_jpeg=no
+ AC_CHECK_X_HEADER(jpeglib.h, [have_jpeg=yes])
+
+ if test "$have_jpeg" = yes; then
+ # we have the header, now check for the library
+ have_jpeg=no
+ jpeg_halfassed=yes
+ AC_CHECK_X_LIB(jpeg, jpeg_start_compress,
+ [have_jpeg=yes
+ jpeg_halfassed=no
+ JPEG_LIBS="-ljpeg"
+ AC_DEFINE(HAVE_JPEGLIB)])
+ fi
+fi
+
+
+###############################################################################
+#
+# Check for -lXft
+#
+###############################################################################
+
+have_xutf8drawstring=no
+AC_CHECK_X_LIB(X11, Xutf8DrawString,
+ [have_xutf8drawstring=yes],
+ [true], -lX11 -lXext -lm)
+if test "$have_xutf8drawstring" = yes ; then
+ AC_DEFINE(HAVE_XUTF8DRAWSTRING)
+fi
+
+
+have_xft=no
+with_xft_req=unspecified
+xft_halfassed=no
+AC_ARG_WITH(xft,
+[ --with-xft Include support for the X Freetype library.],
+ [with_xft="$withval"; with_xft_req="$withval"],
+ [with_xft=yes])
+
+HANDLE_X_PATH_ARG(with_xft, --with-xft, Xft)
+
+if test "$with_xft" != yes -a "$with_xft" != no ; then
+ echo "error: must be yes or no: --with-xft=$with_xft"
+ exit 1
+fi
+
+if test "$with_xft" = yes; then
+
+ pkgs=''
+ ok="yes"
+ pkg_check_version xft 2.1.0
+ have_xft="$ok"
+
+ if test "$have_xft" = yes; then
+ AC_CACHE_CHECK([for Xft includes], ac_cv_xft_config_cflags,
+ [ac_cv_xft_config_cflags=`$pkg_config --cflags $pkgs`])
+ AC_CACHE_CHECK([for Xft libs], ac_cv_xft_config_libs,
+ [ac_cv_xft_config_libs=`$pkg_config --libs $pkgs`])
+ fi
+
+ ac_xft_config_cflags=$ac_cv_xft_config_cflags
+ ac_xft_config_libs=$ac_cv_xft_config_libs
+
+ if test "$have_xft" = yes; then
+ #
+ # we appear to have Xft; check for headers/libs to be sure.
+ #
+ ac_save_xft_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $ac_xft_config_cflags"
+
+ have_xft=no
+ AC_CHECK_X_HEADER(X11/Xft/Xft.h, [have_xft=yes])
+
+ CPPFLAGS="$ac_save_xft_CPPFLAGS"
+ fi
+
+ if test "$have_xft" = yes; then
+ # we have the headers, now check for the libraries
+ have_xft=no
+ xft_halfassed=yes
+
+ AC_MSG_RESULT(checking for Xft usability...)
+ AC_CHECK_X_LIB(c, XftDrawStringUtf8, [have_xft=yes],,
+ $ac_xft_config_libs -lX11 -lXext -lm)
+ fi
+
+ if test "$have_xft" = no; then
+ AC_MSG_RESULT(checking for Xft usability... no)
+ fi
+fi
+
+if test "$have_xft" = yes; then
+ INCLUDES="$INCLUDES $ac_xft_config_cflags"
+ XFT_LIBS="$ac_xft_config_libs"
+ XFT_SRCS=''
+ XFT_OBJS=''
+ AC_DEFINE(HAVE_XFT)
+else
+ XFT_LIBS=''
+ XFT_SRCS='$(UTILS_SRC)/xft.c'
+ XFT_OBJS='$(UTILS_BIN)/xft.o'
+fi
+
+
+###############################################################################
+#
+# Check for pty support: this allows 'phosphor' and 'apple2'
+# to run curses-based programs, or be used as terminal windows.
+#
+###############################################################################
+
+PTY_LIBS=
+AC_CHECK_HEADERS(pty.h util.h)
+AC_CHECK_X_LIB(util, forkpty,
+ [PTY_LIBS="-lutil"
+ ac_have_forkpty=yes
+ AC_DEFINE(HAVE_FORKPTY)])
+
+if test "$ac_have_forkpty" != yes ; then
+ # we don't need (or have) -lutil on MacOS 10.4.2...
+ AC_CHECK_X_LIB(c, forkpty,
+ [PTY_LIBS=""
+ AC_DEFINE(HAVE_FORKPTY)])
+fi
+
+###############################################################################
+#
+# Check for the XSHM server extension.
+#
+###############################################################################
+
+have_xshm=no
+with_xshm_req=unspecified
+AC_ARG_WITH(xshm-ext,
+[ --with-xshm-ext Include support for the Shared Memory extension.],
+ [with_xshm="$withval"; with_xshm_req="$withval"],[with_xshm=yes])
+
+HANDLE_X_PATH_ARG(with_xshm, --with-xshm-ext, XSHM)
+
+if test "$with_xshm" = yes; then
+
+ # first check for Xshm.h.
+ AC_CHECK_X_HEADER(X11/extensions/XShm.h, [have_xshm=yes],,
+ [#include <X11/Xlib.h>])
+
+ # if that succeeded, then check for sys/ipc.h.
+ if test "$have_xshm" = yes; then
+ have_xshm=no
+ AC_CHECK_X_HEADER(sys/ipc.h, [have_xshm=yes])
+ fi
+
+ # if that succeeded, then check for sys/shm.h.
+ if test "$have_xshm" = yes; then
+ have_xshm=no
+ AC_CHECK_X_HEADER(sys/shm.h, [have_xshm=yes])
+ fi
+
+ # AIX is pathological, as usual: apparently it's normal for the Xshm headers
+ # to exist, but the library code to not exist. And even better, the library
+ # code is in its own library: libXextSam.a. So, if we're on AIX, and that
+ # lib doesn't exist, give up. (This lib gets added to X_EXTRA_LIBS, and
+ # that's not quite right, but close enough.)
+ #
+ case "$host" in
+ *-aix*)
+ if [ `uname -v` -eq 3 ]; then
+ have_xshm=no
+ AC_CHECK_X_LIB(XextSam, XShmQueryExtension,
+ [have_xshm=yes; X_EXTRA_LIBS="$X_EXTRA_LIBS -lXextSam"],
+ [true], -lX11 -lXext -lm)
+ fi
+ ;;
+ esac
+
+ # if that succeeded, then we've really got it.
+ if test "$have_xshm" = yes; then
+ AC_DEFINE(HAVE_XSHM_EXTENSION)
+ fi
+
+elif test "$with_xshm" != no; then
+ echo "error: must be yes or no: --with-xshm-ext=$with_xshm"
+ exit 1
+fi
+
+
+###############################################################################
+#
+# Check for the DOUBLE-BUFFER server extension.
+#
+###############################################################################
+
+have_xdbe=no
+with_xdbe_req=unspecified
+AC_ARG_WITH(xdbe-ext,
+[ --with-xdbe-ext Include support for the DOUBLE-BUFFER extension.],
+ [with_xdbe="$withval"; with_xdbe_req="$withval"],[with_xdbe=yes])
+
+HANDLE_X_PATH_ARG(with_xdbe, --with-xdbe-ext, DOUBLE-BUFFER)
+
+if test "$with_xdbe" = yes; then
+
+ AC_CHECK_X_HEADER(X11/extensions/Xdbe.h, [have_xdbe=yes],,
+ [#include <X11/Xlib.h>])
+ if test "$have_xdbe" = yes; then
+ AC_DEFINE(HAVE_DOUBLE_BUFFER_EXTENSION)
+ fi
+
+elif test "$with_xdbe" != no; then
+ echo "error: must be yes or no: --with-xdbe-ext=$with_xshm"
+ exit 1
+fi
+
+
+###############################################################################
+#
+# Check for the SGI XReadDisplay server extension.
+#
+# Note: this has to be down here, rather than up with the other server
+# extension tests, so that the output of `configure --help' is in the
+# right order. Arrgh!
+#
+###############################################################################
+
+have_readdisplay=no
+with_readdisplay_req=unspecified
+AC_ARG_WITH(readdisplay,
+[ --with-readdisplay Include support for the XReadDisplay extension.],
+ [with_readdisplay="$withval"; with_readdisplay_req="$withval"],
+ [with_readdisplay=yes])
+
+HANDLE_X_PATH_ARG(with_readdisplay, --with-readdisplay, XReadDisplay)
+
+if test "$with_readdisplay" = yes; then
+ AC_CHECK_X_HEADER(X11/extensions/readdisplay.h,
+ AC_DEFINE(HAVE_READ_DISPLAY_EXTENSION),,
+ [#include <X11/Xlib.h>])
+elif test "$with_readdisplay" != no; then
+ echo "error: must be yes or no: --with-readdisplay=$with_readdisplay"
+ exit 1
+fi
+
+
+###############################################################################
+#
+# Check for a directory full of images to use as the default value
+# of the "imageDirectory" preference.
+#
+###############################################################################
+
+have_imagedir=no
+with_imagedir_req=unspecified
+
+AC_ARG_WITH(image-directory,
+[ --with-image-directory Arg is the default directory from which some demos
+ will choose random images to display.],
+ [with_imagedir="$withval"; with_imagedir_req="$withval"],
+ [with_imagedir=yes])
+# no HANDLE_X_PATH_ARG for this one
+
+case "$with_imagedir" in
+ /*)
+ # absolute path
+ AC_MSG_CHECKING([for image directory $with_imagedir])
+ if test -d "$with_imagedir" ; then
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
+ with_imagedir=""
+ fi
+ ;;
+ yes)
+ with_imagedir=""
+
+ #### Could use some more defaults here...
+ for dd in \
+ "/usr/share/backgrounds/images/" \
+ "/usr/share/wallpapers/" \
+ "/Library/Desktop Pictures/" \
+ ; do
+ if test -z "$with_imagedir"; then
+ AC_MSG_CHECKING([for image directory $dd])
+ if test -d "$dd" ; then
+ AC_MSG_RESULT(yes)
+ with_imagedir="$dd"
+ else
+ AC_MSG_RESULT(no)
+ fi
+ fi
+ done
+
+ ;;
+ no)
+ with_imagedir=""
+ ;;
+
+ *)
+ echo "error: must be an absolute path: --with-image-directory=$with_imagedir_req"
+ exit 1
+ ;;
+esac
+ac_cv_imagedir="$with_imagedir"
+
+DEFAULT_IMAGES_P='True'
+DEFAULT_IMAGE_DIRECTORY="$ac_cv_imagedir"
+
+if test -z "$DEFAULT_IMAGE_DIRECTORY" ; then
+ DEFAULT_IMAGES_P='False'
+fi