+jurassic_gtk=no
+gtk_halfassed=no
+have_gtk_2_22_or_higher=no
+COMMENT_DEMO_GLADE2_GTK_2_22_HEAD=""
+COMMENT_DEMO_GLADE2_GTK_2_22_TAIL=""
+
+if test "$with_gtk" = yes; then
+ have_gtk=no
+
+ ok="yes"
+ pkg_check_version gtk+-2.0 2.0.1 ; ac_gtk_version_string="$vers"
+ pkg_check_version gmodule-2.0 2.0.0
+ pkg_check_version libxml-2.0 2.4.6
+ pkg_check_version libglade-2.0 1.99.0
+ pkg_check_version gdk-pixbuf-2.0 2.0.0
+ pkg_check_version gdk-pixbuf-xlib-2.0 2.0.0
+ have_gtk="$ok"
+
+ if test "$have_gtk" = no; then
+ if test -n "$ac_gtk_version_string" ; then
+ gtk_halfassed="$ac_gtk_version_string"
+ gtk_halfassed_lib="$req"
+ fi
+ fi
+
+ if test "$have_gtk" = yes; then
+ parse_gtk_version_string
+ jurassic_gtk=no
+ fi
+
+ if test "$have_gtk" = yes; then
+ AC_CACHE_CHECK([for Gtk includes], ac_cv_gtk_config_cflags,
+ [ac_cv_gtk_config_cflags=`$pkg_config --cflags $pkgs`])
+ AC_CACHE_CHECK([for Gtk libs], ac_cv_gtk_config_libs,
+ [ac_cv_gtk_config_libs=`$pkg_config --libs $pkgs`])
+ fi
+
+ ac_gtk_config_cflags=$ac_cv_gtk_config_cflags
+ ac_gtk_config_libs=$ac_cv_gtk_config_libs
+
+ GTK_EXTRA_OBJS=""
+ GTK_DATADIR=""
+ if test "$have_gtk" = yes; then
+ GTK_DATADIR=`$pkg_config --variable=prefix gtk+-2.0`
+ GTK_DATADIR="$GTK_DATADIR/share"
+ fi
+
+ if test "$have_gtk" = yes; then
+ INCLUDES="$INCLUDES $ac_gtk_config_cflags"
+ GTK_LIBS="$GTK_LIBS $ac_gtk_config_libs"
+ AC_DEFINE(HAVE_GTK)
+ AC_DEFINE(HAVE_GTK2)
+ AC_DEFINE(HAVE_XML)
+ fi
+
+ if test "$have_gtk" = yes; then
+ ok="yes"
+ pkg_check_version gtk+-2.0 2.22
+ have_gtk_2_22_or_higher="$ok"
+ if test "$have_gtk_2_22_or_higher" = yes; then
+ COMMENT_DEMO_GLADE2_GTK_2_22_HEAD="<!-- comment>"
+ COMMENT_DEMO_GLADE2_GTK_2_22_TAIL="</comment -->"
+ fi
+ fi
+fi
+
+
+# Check for the various Gnome help and URL loading programs.
+#
+WITH_BROWSER=gnome-open
+if test "$have_gtk" = yes; then
+ AC_CHECK_PROGS(gnome_open_program, gnome-open)
+ AC_CHECK_PROGS(gnome_url_show_program, gnome-url-show)
+fi
+
+
+###############################################################################
+#
+# Check for -lXm.
+#
+###############################################################################
+
+have_motif=no
+with_motif_req=unspecified
+AC_ARG_WITH(motif,[ --with-motif Use the Motif toolkit for the user interface
+ (no longer supported.)],
+ [with_motif="$withval"; with_motif_req="$withval"],[with_motif=no])
+
+HANDLE_X_PATH_ARG(with_motif, --with-motif, Motif)
+
+if test "$with_motif" != yes -a "$with_motif" != no ; then
+ echo "error: must be yes or no: --with-motif=$with_motif"
+ exit 1
+fi
+
+if test "$with_motif" = yes; then
+ have_motif=no
+ AC_CHECK_X_HEADER(Xm/Xm.h,
+ [have_motif=yes
+ AC_DEFINE(HAVE_MOTIF)
+ MOTIF_LIBS="$MOTIF_LIBS -lXm"],,
+ [#include <stdlib.h>
+ #include <stdio.h>
+ #include <X11/Intrinsic.h>])
+fi
+
+
+if test "$have_motif" = yes; then
+ AC_CHECK_X_HEADER(Xm/ComboBox.h, [AC_DEFINE(HAVE_XMCOMBOBOX)],,
+ [#include <stdlib.h>
+ #include <stdio.h>
+ #include <X11/Intrinsic.h>])
+fi
+
+
+###############################################################################
+#
+# Checking whether Motif is really Lesstif.
+#
+###############################################################################
+
+have_lesstif=no
+if test "$have_motif" = yes ; then
+ AC_CACHE_CHECK([whether Motif is really LessTif],
+ ac_cv_have_lesstif,
+ [AC_TRY_X_COMPILE([#include <Xm/Xm.h>],
+ [long vers = LesstifVersion;],
+ [ac_cv_have_lesstif=yes],
+ [ac_cv_have_lesstif=no])])
+ have_lesstif=$ac_cv_have_lesstif
+fi
+
+
+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 -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=''
+
+ # Looks like as of OSX 10.12, gcc can't do ObjC.
+ OBJCC="clang -Wall"
+
+ 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