+###############################################################################
+#
+# Check for -lgle.
+#
+###############################################################################
+
+have_gle=no
+with_gle_req=unspecified
+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 "$with_gle" = yes; then
+
+ AC_CHECK_X_HEADER(GL/gutil.h, have_gle=yes, have_gle=no)
+ if test "$have_gle" = yes ; then
+ AC_CHECK_X_HEADER(GL/tube.h, have_gle=yes, have_gle=no)
+ fi
+
+# /usr/local/lib/GL/libgle.a
+# /usr/local/lib/GL/libmatrix.a
+
+ if test "$have_gle" = yes ; then
+ have_gle=no
+ AC_CHECK_X_LIB(gle, gleCreateGC,
+ [have_gle=yes; GLE_LIBS="-lgle"],
+ [], $GL_LIBS -lX11 -lXext -lm)
+ fi
+ if test "$have_gle" = yes ; then
+ have_gle=no
+ AC_CHECK_X_LIB(matrix, uview_direction_d,
+ [have_gle=yes; GLE_LIBS="$GLE_LIBS -lmatrix"],
+ [], $GL_LIBS -lX11 -lXext -lm)
+ fi
+
+ if test "$have_gle" = yes ; then
+ AC_DEFINE(HAVE_GLE)
+ fi
+
+elif test "$with_gle" != no; then
+ echo "error: must be yes or no: --with-gle=$with_gle"
+ exit 1
+
+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.],
+ [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"])
+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
+
+
+###############################################################################
+#
+# 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 XSHM 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])
+
+ # 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*)
+ have_xshm=no
+ AC_CHECK_X_LIB(XextSam, XShmQueryExtension,
+ [have_xshm=yes; X_EXTRA_LIBS="$X_EXTRA_LIBS -lXextSam"],
+ [true], -lX11 -lXext -lm)
+ ;;
+ 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])
+ 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!