+###############################################################################
+#
+# Check for -lgdk_pixbuf.
+#
+###############################################################################
+
+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])
+
+HANDLE_X_PATH_ARG(with_gdk_pixbuf, --with-pixbuf, GDK_PIXBUF)
+
+if test "$with_gdk_pixbuf" = yes; then
+
+ if test "$have_gtk" = yes; then
+
+ ac_save_gdk_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $ac_gtk_config_cflags"
+
+ have_gdk_pixbuf=no
+ AC_CHECK_X_HEADER(gdk-pixbuf/gdk-pixbuf.h, [have_gdk_pixbuf=yes])
+ if test "$have_gdk_pixbuf" = yes; then
+ have_gdk_pixbuf=no
+ AC_CHECK_X_HEADER(gdk-pixbuf/gdk-pixbuf-xlib.h, [have_gdk_pixbuf=yes])
+ fi
+
+ CPPFLAGS="$ac_save_gdk_CPPFLAGS"
+
+ if test "$have_gdk_pixbuf" = yes; then
+ AC_DEFINE(HAVE_GDK_PIXBUF)
+ XPM_LIBS="-lgdk_pixbuf -lgdk_pixbuf_xlib"
+ fi
+ fi
+
+elif test "$with_gdk_pixbuf" != no; then
+ echo "error: must be yes or no: --with-pixbuf=$with_gdk_pixbuf"
+ exit 1
+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 in some demos,
+ which will make it possible for them to read JPEG
+ files as well.],
+ [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
+
+