+ HAVE_LIBXP=no
+ AC_DEFINE(HAVE_MOTIF_2_1, 1,
+ [Define to 1 if you have Motif 2.1 or newer.])
+ AC_CHECK_LIB(Xp, XpCreateContext, HAVE_LIBXP=yes)
+ if test ${HAVE_LIBXP} = yes; then
+ AC_DEFINE(HAVE_LIBXP, 1,
+ [Define to 1 if you have the Xp library (-lXp).])
+ fi
+ fi
+fi
+
+### Is -lXaw3d available?
+HAVE_XAW3D=no
+if test "${HAVE_X11}" = "yes"; then
+ if test "${USE_X_TOOLKIT}" != "none"; then
+ dnl Fixme: determine what Scrollbar.h needs to avoid compilation
+ dnl errors from the test without the `-'.
+ AC_CHECK_HEADER(X11/Xaw3d/Scrollbar.h,
+ [AC_CHECK_LIB(Xaw3d, XawScrollbarSetThumb, HAVE_XAW3D=yes)], , -)
+ if test "${HAVE_XAW3D}" = "yes"; then
+ AC_DEFINE(HAVE_XAW3D, 1,
+ [Define to 1 if you have the Xaw3d library (-lXaw3d).])
+ fi
+ fi
+fi
+
+dnl Use toolkit scroll bars if configured for GTK or X toolkit and either
+dnl using Motif or Xaw3d is available, and unless
+dnl --with-toolkit-scroll-bars=no was specified.
+
+AH_TEMPLATE(USE_TOOLKIT_SCROLL_BARS,
+ [Define to 1 if we should use toolkit scroll bars.])dnl
+USE_TOOLKIT_SCROLL_BARS=no
+if test "${with_toolkit_scroll_bars}" != "no"; then
+ if test "${USE_X_TOOLKIT}" != "none"; then
+ if test "${USE_X_TOOLKIT}" = "MOTIF"; then
+ AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
+ HAVE_XAW3D=no
+ USE_TOOLKIT_SCROLL_BARS=yes
+ elif test "${HAVE_XAW3D}" = "yes"; then
+ AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
+ USE_TOOLKIT_SCROLL_BARS=yes
+ fi
+ elif test "${HAVE_GTK}" = "yes"; then
+ AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
+ USE_TOOLKIT_SCROLL_BARS=yes
+ fi
+fi
+
+dnl See if XIM is available.
+AC_TRY_COMPILE([
+ #include <X11/Xlib.h>
+ #include <X11/Xresource.h>],
+ [XIMProc callback;],
+ HAVE_XIM=yes
+ AC_DEFINE(HAVE_XIM, 1, [Define to 1 if XIM is available]),
+ HAVE_XIM=no)
+
+dnl `--with-xim' now controls only the initial value of use_xim at run time.
+
+if test "${with_xim}" != "no"; then
+ AC_DEFINE(USE_XIM, 1,
+ [Define to 1 if we should use XIM, if it is available.])
+fi
+
+
+if test "${HAVE_XIM}" != "no"; then
+ late_CFLAGS=$CFLAGS
+ if test "$GCC" = yes; then
+ CFLAGS="$CFLAGS --pedantic-errors"
+ fi
+ AC_TRY_COMPILE([
+#include <X11/Xlib.h>
+#include <X11/Xresource.h>],
+[Display *display;
+XrmDatabase db;
+char *res_name;
+char *res_class;
+XIMProc callback;
+XPointer *client_data;
+#ifndef __GNUC__
+/* If we're not using GCC, it's probably not XFree86, and this is
+ probably right, but we can't use something like --pedantic-errors. */
+extern Bool XRegisterIMInstantiateCallback(Display*, XrmDatabase, char*,
+ char*, XIMProc, XPointer*);
+#endif
+(void)XRegisterIMInstantiateCallback(display, db, res_name, res_class, callback,
+ client_data);],
+ [emacs_cv_arg6_star=yes])
+ AH_TEMPLATE(XRegisterIMInstantiateCallback_arg6,
+ [Define to the type of the 6th arg of XRegisterIMInstantiateCallback,
+either XPointer or XPointer*.])dnl
+ if test "$emacs_cv_arg6_star" = yes; then
+ AC_DEFINE(XRegisterIMInstantiateCallback_arg6, [XPointer*])
+ else
+ AC_DEFINE(XRegisterIMInstantiateCallback_arg6, [XPointer])
+ fi
+ CFLAGS=$late_CFLAGS
+fi
+
+### Use -lXpm if available, unless `--with-xpm=no'.
+HAVE_XPM=no
+if test "${HAVE_X11}" = "yes"; then
+ if test "${with_xpm}" != "no"; then
+ AC_CHECK_HEADER(X11/xpm.h,
+ AC_CHECK_LIB(Xpm, XpmReadFileToPixmap, HAVE_XPM=yes, , -lX11))
+ if test "${HAVE_XPM}" = "yes"; then
+ AC_MSG_CHECKING(for XpmReturnAllocPixels preprocessor define)
+ AC_EGREP_CPP(no_return_alloc_pixels,
+ [#include "X11/xpm.h"
+#ifndef XpmReturnAllocPixels
+no_return_alloc_pixels
+#endif
+ ], HAVE_XPM=no, HAVE_XPM=yes)
+
+ if test "${HAVE_XPM}" = "yes"; then
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
+ fi
+ fi
+ fi
+
+ if test "${HAVE_XPM}" = "yes"; then
+ AC_DEFINE(HAVE_XPM, 1, [Define to 1 if you have the Xpm libary (-lXpm).])
+ fi
+fi
+
+### Use -ljpeg if available, unless `--with-jpeg=no'.
+HAVE_JPEG=no
+if test "${HAVE_X11}" = "yes"; then
+ if test "${with_jpeg}" != "no"; then
+ dnl Checking for jpeglib.h can lose because of a redefinition of
+ dnl HAVE_STDLIB_H.
+ AC_CHECK_HEADER(jerror.h,
+ AC_CHECK_LIB(jpeg, jpeg_destroy_compress, HAVE_JPEG=yes))
+ fi
+
+ AH_TEMPLATE(HAVE_JPEG, [Define to 1 if you have the jpeg library (-ljpeg).])dnl
+ if test "${HAVE_JPEG}" = "yes"; then
+ AC_DEFINE(HAVE_JPEG)
+ AC_EGREP_CPP([version= *(6[2-9]|[7-9][0-9])],
+ [#include <jpeglib.h>
+ version=JPEG_LIB_VERSION
+],
+ AC_DEFINE(HAVE_JPEG),
+ [AC_MSG_WARN([libjpeg found, but not version 6b or later])
+ HAVE_JPEG=no])
+ fi
+fi
+
+### Use -lpng if available, unless `--with-png=no'.
+HAVE_PNG=no
+if test "${HAVE_X11}" = "yes"; then
+ if test "${with_png}" != "no"; then
+ # Debian unstable as of July 2003 has multiple libpngs, and puts png.h
+ # in /usr/include/libpng.
+ AC_CHECK_HEADERS(png.h libpng/png.h)
+ if test "$ac_cv_header_png_h" = yes || test "$ac_cv_header_libpng_png_h" = yes ; then
+ AC_CHECK_LIB(png, png_get_channels, HAVE_PNG=yes, , -lz -lm)
+ fi
+ fi
+
+ if test "${HAVE_PNG}" = "yes"; then
+ AC_DEFINE(HAVE_PNG, 1, [Define to 1 if you have the png library (-lpng).])
+ fi
+fi
+
+### Use -ltiff if available, unless `--with-tiff=no'.
+HAVE_TIFF=no
+if test "${HAVE_X11}" = "yes"; then
+ if test "${with_tiff}" != "no"; then
+ AC_CHECK_HEADER(tiffio.h,
+ tifflibs="-lz -lm"
+ # At least one tiff package requires the jpeg library.
+ if test "${HAVE_JPEG}" = yes; then tifflibs="-ljpeg $tifflibs"; fi
+ AC_CHECK_LIB(tiff, TIFFGetVersion, HAVE_TIFF=yes, , $tifflibs))
+ fi
+
+ if test "${HAVE_TIFF}" = "yes"; then
+ AC_DEFINE(HAVE_TIFF, 1, [Define to 1 if you have the tiff library (-ltiff).])
+ fi
+fi
+
+### Use -lgif if available, unless `--with-gif=no'.
+HAVE_GIF=no
+if test "${HAVE_X11}" = "yes"; then
+ if test "${with_gif}" != "no"; then
+ AC_CHECK_HEADER(gif_lib.h,
+# EGifPutExtensionLast only exists from version libungif-4.1.0b1.
+# Earlier versions can crash Emacs.
+ AC_CHECK_LIB(ungif, EGifPutExtensionLast, HAVE_GIF=yes))
+ fi
+
+ if test "${HAVE_GIF}" = "yes"; then
+ AC_DEFINE(HAVE_GIF, 1, [Define to 1 if you have the ungif library (-lungif).])
+ fi
+fi
+
+### Use Mac OS X Carbon API to implement GUI.
+HAVE_CARBON=no
+if test "${with_carbon}" != "no"; then
+ AC_CHECK_HEADER(Carbon/Carbon.h, HAVE_CARBON=yes)
+fi
+
+if test "${HAVE_CARBON}" = "yes"; then
+ AC_DEFINE(HAVE_CARBON, 1, [Define to 1 if you are using the Carbon API on Mac OS X.])
+ window_system=mac
+ ## Specify the install directory
+ carbon_appdir=
+ if test "${carbon_appdir_x}" != ""; then
+ case ${carbon_appdir_x} in
+ y | ye | yes) carbon_appdir=/Applications ;;
+ * ) carbon_appdir=${carbon_appdir_x} ;;
+ esac
+ fi
+ # We also have mouse menus.
+ HAVE_MENUS=yes
+fi
+
+### Use session management (-lSM -lICE) if available
+HAVE_X_SM=no
+if test "${HAVE_X11}" = "yes"; then
+ AC_CHECK_HEADER(X11/SM/SMlib.h,
+ AC_CHECK_LIB(SM, SmcOpenConnection, HAVE_X_SM=yes, , -lICE))
+
+ if test "${HAVE_X_SM}" = "yes"; then
+ AC_DEFINE(HAVE_X_SM, 1, [Define to 1 if you have the SM library (-lSM).])
+ case "$LIBS" in
+ *-lSM*) ;;
+ *) LIBS="-lSM -lICE $LIBS" ;;
+ esac