Correct buggy dispatch logic.
[bpt/emacs.git] / configure.in
index 963be14..2e3aa63 100644 (file)
@@ -24,7 +24,7 @@ dnl  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 dnl  Boston, MA 02110-1301, USA.
 
 AC_PREREQ(2.61)dnl
-AC_INIT(emacs, 23.0.50)
+AC_INIT(emacs, 23.0.60)
 AC_CONFIG_HEADER(src/config.h:src/config.in)
 AC_CONFIG_SRCDIR(src/lisp.h)
 
@@ -43,48 +43,68 @@ gamedir='${localstatedir}/games/emacs'
 
 gameuser=games
 
-dnl Autoconf is so much less fun under VMS, maybe
-dnl because everything is less fun under VMS. --ttn
-AC_DEFUN([EMACS_ARG_Y],[dnl
-AC_ARG_WITH([$1],[AS_HELP_STRING([--with-$1],[$2])],[$3],[$4])dnl
-])dnl
-AC_DEFUN([EMACS_ARG_N],[dnl
-AC_ARG_WITH([$1],[AS_HELP_STRING([--without-$1],[$2])],[$3],[$4])dnl
+dnl OPTION_DEFAULT_OFF(NAME, HELP-STRING)
+dnl Create a new --with option that defaults to being disabled.
+dnl NAME is the base name of the option.  The shell variable with_NAME
+dnl   will be set to either the user's value (if the option is
+dnl   specified; 'yes' for a plain --with-NAME) or to 'no' (if the
+dnl   option is not specified).  Note that the shell variable name is
+dnl   constructed as autoconf does, by replacing non-alphanumeric
+dnl   characters with "_".
+dnl HELP-STRING is the help text for the option.
+AC_DEFUN([OPTION_DEFAULT_OFF], [dnl
+  AC_ARG_WITH([$1],[AS_HELP_STRING([--with-$1],[$2])],[],[dnl
+    m4_bpatsubst([with_$1], [[^0-9a-z]], [_])=no])dnl
 ])dnl
 
-EMACS_ARG_N([gcc],[don't use GCC to compile Emacs if GCC is found])
+dnl OPTION_DEFAULT_ON(NAME, HELP-STRING)
+dnl Create a new --with option that defaults to being enabled.  NAME
+dnl   is the base name of the option.  The shell variable with_NAME
+dnl   will be set either to 'no' (for a plain --without-NAME) or to
+dnl   'yes' (if the option is not specified).  Note that the shell
+dnl   variable name is constructed as autoconf does, by replacing
+dnl   non-alphanumeric characters with "_".
+dnl HELP-STRING is the help text for the option.
+AC_DEFUN([OPTION_DEFAULT_ON], [dnl
+  AC_ARG_WITH([$1],[AS_HELP_STRING([--without-$1],[$2])],[],[dnl
+   m4_bpatsubst([with_$1], [[^0-9a-z]], [_])=yes])dnl
+])dnl
 
-EMACS_ARG_N([pop],[don't support POP mail retrieval with movemail],
-[if test "$withval" = yes; then
+OPTION_DEFAULT_ON([pop],[don't support POP mail retrieval with movemail])
+if test "$with_pop" = yes; then
    AC_DEFINE(MAIL_USE_POP)
-else :
-fi],
-AC_DEFINE(MAIL_USE_POP))
+fi
 AH_TEMPLATE(MAIL_USE_POP, [Define to support POP mail retrieval.])dnl
 
-EMACS_ARG_Y([kerberos],[support Kerberos-authenticated POP],
-[if test "$withval" = yes; then
+OPTION_DEFAULT_OFF([kerberos],[support Kerberos-authenticated POP])
+if test "$with_kerberos" = yes; then
    AC_DEFINE(KERBEROS)
-fi])
+fi
 AH_TEMPLATE(KERBEROS,
            [Define to support Kerberos-authenticated POP mail retrieval.])dnl
 
-EMACS_ARG_Y([kerberos5],[support Kerberos version 5 authenticated POP],
-[if test "${with_kerberos5+set}" = set; then
-  if test "${with_kerberos+set}" != set; then
+OPTION_DEFAULT_OFF([kerberos5],[support Kerberos version 5 authenticated POP])
+if test "${with_kerberos5}" = yes; then
+  if test "${with_kerberos}" != yes; then
     with_kerberos=yes
     AC_DEFINE(KERBEROS)
   fi
   AC_DEFINE(KERBEROS5, 1, [Define to use Kerberos 5 instead of Kerberos 4.])
-fi])
+fi
 
-EMACS_ARG_Y([hesiod],[support Hesiod to get the POP server host],
-[if test "$withval" = yes; then
+OPTION_DEFAULT_OFF([hesiod],[support Hesiod to get the POP server host])
+if test "$with_hesiod" = yes; then
   AC_DEFINE(HESIOD, 1, [Define to support using a Hesiod database to find the POP server.])
-fi])
+fi
+
+OPTION_DEFAULT_ON([sound],[don't compile with sound support])
 
-EMACS_ARG_N([sound],[don't compile with sound support])
+OPTION_DEFAULT_ON([sync-input],[Process async input synchronously])
+if test "$with_sync_input" = yes; then
+   AC_DEFINE(SYNC_INPUT, 1, [Process async input synchronously.])
+fi
 
+dnl FIXME currently it is not the last.
 dnl This should be the last --with option, because --with-x is
 dnl added later on when we find the path of X, and it's best to
 dnl keep them together visually.
@@ -106,24 +126,50 @@ this option's value should be `yes', `no', `lucid', `athena', `motif' or `gtk'.
          with_x_toolkit=$val
 ])
 
-EMACS_ARG_Y([xpm],[use -lXpm for displaying XPM images])
-EMACS_ARG_Y([jpeg],[use -ljpeg for displaying JPEG images])
-EMACS_ARG_Y([tiff],[use -ltiff for displaying TIFF images])
-EMACS_ARG_Y([gif],[use -lgif (or -lungif) for displaying GIF images])
-EMACS_ARG_Y([png],[use -lpng for displaying PNG images])
-EMACS_ARG_Y([freetype],[use -lfreetype for local fonts support])
-EMACS_ARG_Y([xft],[use -lXft for anti aliased fonts])
-EMACS_ARG_Y([gpm],[use -lgpm for mouse support on a GNU/Linux console])
-EMACS_ARG_Y([rsvg],[use -lrsvg-2 for displaying SVG images])
-EMACS_ARG_Y([gtk],[use GTK (same as --with-x-toolkit=gtk)])
-EMACS_ARG_Y([pkg-config-prog],[Path to pkg-config for finding GTK and librsvg])
-EMACS_ARG_N([toolkit-scroll-bars],[don't use Motif or Xaw3d scroll bars])
-EMACS_ARG_N([xaw3d],[don't use Xaw3d])
-EMACS_ARG_N([xim],[don't use X11 XIM])
-EMACS_ARG_N([carbon],[don't use Carbon GUI on Mac OS X])
-EMACS_ARG_Y([dbus],[use D-Bus])
-EMACS_ARG_N([libotf],[don't use libotf for OpenType font support])
-EMACS_ARG_N([m17n-flt],[don't use m17n-flt for text shaping])
+dnl _ON results in a '--without' option in the --help output, so
+dnl the help text should refer to "don't compile", etc.
+OPTION_DEFAULT_ON([xpm],[don't compile with XPM image support])
+OPTION_DEFAULT_ON([jpeg],[don't compile with JPEG image support])
+OPTION_DEFAULT_ON([tiff],[don't compile with TIFF image support])
+OPTION_DEFAULT_ON([gif],[don't compile with GIF image support])
+OPTION_DEFAULT_ON([png],[don't compile with PNG image support])
+OPTION_DEFAULT_ON([rsvg],[don't compile with SVG image support])
+
+OPTION_DEFAULT_ON([freetype],[don't use Freetype for local font support])
+OPTION_DEFAULT_ON([xft],[don't use XFT for anti aliased fonts])
+OPTION_DEFAULT_ON([libotf],[don't use libotf for OpenType font support])
+OPTION_DEFAULT_ON([m17n-flt],[don't use m17n-flt for text shaping])
+
+OPTION_DEFAULT_ON([toolkit-scroll-bars],[don't use Motif or Xaw3d scroll bars])
+OPTION_DEFAULT_ON([xaw3d],[don't use Xaw3d])
+OPTION_DEFAULT_ON([xim],[don't use X11 XIM])
+OPTION_DEFAULT_OFF([carbon],[use Carbon GUI on Mac OS X.  This is unsupported!])
+
+OPTION_DEFAULT_ON([gpm],[don't use -lgpm for mouse support on a GNU/Linux console])
+OPTION_DEFAULT_ON([dbus],[don't compile with D-Bus support])
+
+## For the times when you want to build Emacs but don't have
+## a suitable makeinfo, and can live without the manuals.
+dnl http://lists.gnu.org/archive/html/emacs-devel/2008-04/msg01844.html
+OPTION_DEFAULT_ON([makeinfo],[don't require makeinfo for building manuals])
+
+dnl Can remove these in Emacs 24.
+AC_ARG_WITH([gtk],,
+  AC_MSG_ERROR([--with-gtk has been removed.  Use --with-x-toolkit to
+specify a toolkit.]),,)
+
+AC_ARG_WITH([gcc],,
+  AC_MSG_ERROR([--with-gcc has been removed.  Set the `CC' environment
+  variable to specify a compiler.]),,)
+
+AC_ARG_WITH([pkg-config-prog],dnl
+[AS_HELP_STRING([--with-pkg-config-prog=PATH],
+                  [Path to pkg-config for finding GTK and librsvg])])
+if test "X${with_pkg_config_prog}" != X; then
+   if test "${with_pkg_config_prog}" != yes; then
+      PKG_CONFIG="${with_pkg_config_prog}"
+   fi
+fi
 
 AC_ARG_ENABLE(carbon-app,
 [AS_HELP_STRING([--enable-carbon-app@<:@=DIR@:>@],
@@ -131,10 +177,11 @@ AC_ARG_ENABLE(carbon-app,
                 [DIR=/Application]])],
 [ carbon_appdir_x=${enableval}])
 
+## Enabled by default.
 AC_ARG_ENABLE(font-backend,
-[  --enable-font-backend   compile code of font-backend support],
+[AS_HELP_STRING([--disable-font-backend],[don't compile font-backend support])],
       USE_FONT_BACKEND=$enableval,
-      USE_FONT_BACKEND=no)
+      USE_FONT_BACKEND=yes)
 
 AC_ARG_ENABLE(asserts,
 [AS_HELP_STRING([--enable-asserts], [compile code with asserts enabled])],
@@ -249,6 +296,7 @@ case "${canonical}" in
     opsys=freebsd
     case "${canonical}" in
       alpha*-*-freebsd*)       machine=alpha ;;
+      arm*-*-freebsd*)          machine=arm ;;
       ia64-*-freebsd*)         machine=ia64 ;;
       sparc64-*-freebsd*)      machine=sparc ;;
       powerpc-*-freebsd*)      machine=macppc ;;
@@ -306,7 +354,6 @@ dnl see the `changequote' comment above.
       hppa-*-openbsd*)         machine=hp9000s300 ;;
       i386-*-openbsd*)         machine=intel386 ;;
       m68k-*-openbsd*)         machine=hp9000s300 ;;
-      mips64-*-openbsd*)       machine=mips64 ;;
       powerpc-*-openbsd*)      machine=macppc ;;
       sparc*-*-openbsd*)       machine=sparc ;;
       vax-*-openbsd*)          machine=vax ;;
@@ -340,23 +387,6 @@ dnl see the `changequote' comment above.
     esac
   ;;
 
-  ## Alpha (DEC) machines.
-  alpha*-dec-osf* )
-    machine=alpha opsys=osf1
-    # This is needed to find X11R6.1 libraries for certain tests.
-    NON_GCC_LINK_TEST_OPTIONS=-Wl,-rpath,/usr/X11R6/lib
-    GCC_LINK_TEST_OPTIONS=-Wl,-rpath,/usr/X11R6/lib
-    # NON_GNU_CPP is necessary on 5.0 to avoid mangling src/Makefile
-    # due to non-traditional preprocessing with the current compiler
-    # defaults.  OSF 4 can also have that compiler version, and there
-    # seems always to have been a usable /usr/bin/cpp.
-    NON_GNU_CPP=/usr/bin/cpp
-    case "${canonical}" in
-    alpha*-dec-osf[5-9]*)
-      opsys=osf5-0 ;;
-    esac
-  ;;
-
   alpha*-*-linux-gnu* )
     machine=alpha opsys=gnu-linux
   ;;
@@ -383,11 +413,6 @@ dnl see the `changequote' comment above.
     fi
   ;;
 
-  ## Compaq Nonstop
-  mips-compaq-nonstopux* )
-    machine=nonstopux opsys=nonstopux
-    ;;
-
   ## Cubix QBx/386
   i[3456]86-cubix-sysv* )
     machine=intel386 opsys=usg5-3
@@ -402,13 +427,6 @@ dnl see the `changequote' comment above.
   mips-dec-ultrix* )
     machine=pmax opsys=ultrix4-3
   ;;
-  mips-dec-osf* )
-    machine=pmax opsys=osf1
-  ;;
-  mips-dec-mach_bsd4.3* )
-    machine=pmax opsys=mach-bsd4-3
-  ;;
-
   ## HP 9000 series 200 or 300
   m68*-hp-bsd* )
     machine=hp9000s300 opsys=bsd4-3
@@ -498,6 +516,9 @@ dnl see the `changequote' comment above.
   rs6000-ibm-aix5* | powerpc-ibm-aix5*  )
     machine=ibmrs6000 opsys=aix4-2
   ;;
+  rs6000-ibm-aix5* | powerpc-ibm-aix6*  )
+    machine=ibmrs6000 opsys=aix4-2
+  ;;
   rs6000-ibm-aix4.0* | powerpc-ibm-aix4.0*  )
     machine=ibmrs6000 opsys=aix4
   ;;
@@ -513,19 +534,6 @@ dnl see the `changequote' comment above.
     machine=i386 opsys=usg5-3
   ;;
 
-  ## Sequent Symmetry running ptx 4, which is a modified SVR4.
-  i[3456]86-sequent-ptx4* | i[3456]86-sequent-sysv4* )
-    machine=sequent-ptx opsys=ptx4
-    NON_GNU_CPP=/lib/cpp
-  ;;
-
-  ## Sequent Symmetry running DYNIX/ptx
-  ## Use the old cpp rather than the newer ANSI one.
-  i[3456]86-sequent-ptx* )
-    machine=sequent-ptx opsys=ptx
-    NON_GNU_CPP="/lib/cpp"
-  ;;
-
   ## ncr machine running svr4.3.
   i[3456]86-ncr-sysv4.3 )
     machine=ncr386 opsys=usg5-4-3
@@ -546,27 +554,6 @@ dnl see the `changequote' comment above.
   ## This is not necessarily all workstations using the MIPS processor -
   ## Irises are produced by SGI, and DECstations by DEC.
 
-  ## etc/MACHINES lists mips.h and mips4.h as possible machine files,
-  ## and usg5-2-2 and bsd4-3 as possible OS files.  The only guidance
-  ## it gives for choosing between the alternatives seems to be "Use
-  ## -machine=mips4 for RISCOS version 4; use -opsystem=bsd4-3 with
-  ## the BSD world."  I'll assume that these are instructions for
-  ## handling two odd situations, and that every other situation
-  ## should use mips.h and usg5-2-2, they being listed first.
-  mips-mips-usg* )
-    machine=mips4
-    ## Fall through to the general code at the bottom to decide on the OS.
-  ;;
-  mips-mips-riscos4* )
-    machine=mips4 opsys=bsd4-3
-    NON_GNU_CC="cc -systype bsd43"
-    NON_GNU_CPP="cc -systype bsd43 -E"
-  ;;
-  mips-mips-riscos5* )
-    machine=mips4 opsys=riscos5
-    NON_GNU_CC="cc -systype bsd43"
-    NON_GNU_CPP="cc -systype bsd43 -E"
-  ;;
   mips-mips-bsd* )
     machine=mips opsys=bsd4-3
   ;;
@@ -593,12 +580,6 @@ dnl see the `changequote' comment above.
 
   ## Silicon Graphics machines
   ## Iris 4D
-  mips-sgi-irix3* )
-    machine=iris4d opsys=irix3-3
-  ;;
-  mips-sgi-irix4* )
-    machine=iris4d opsys=irix4-0
-  ;;
   mips-sgi-irix6.5 )
     machine=iris4d opsys=irix6-5
     # Without defining _LANGUAGE_C, things get masked out in the headers
@@ -607,20 +588,6 @@ dnl see the `changequote' comment above.
     NON_GNU_CPP="/lib/cpp -D_LANGUAGE_C"
     NON_GCC_TEST_OPTIONS="-D_LANGUAGE_C"
   ;;
-  mips-sgi-irix6* )
-    machine=iris4d opsys=irix6-0
-    # It's not clear whether -D_LANGUAGE_C is necessary as it is for 6.5,
-    # but presumably it does no harm.
-    NON_GNU_CPP="/lib/cpp -D_LANGUAGE_C"
-    # -32 probably isn't necessary in later v.6s -- anyone know which?
-    NON_GCC_TEST_OPTIONS=-32
-  ;;
-  mips-sgi-irix5.[01]* )
-    machine=iris4d opsys=irix5-0
-  ;;
-  mips-sgi-irix5* | mips-sgi-irix* )
-    machine=iris4d opsys=irix5-2
-  ;;
 
   ## Suns
   sparc-*-linux-gnu* | sparc64-*-linux-gnu* )
@@ -713,7 +680,6 @@ dnl see the `changequote' comment above.
       *-darwin* )               opsys=darwin
                                 CPP="${CC-cc} -E -no-cpp-precomp"
                                ;;
-      *-xenix* )               opsys=xenix ;;
       *-linux-gnu* )           opsys=gnu-linux ;;
       *-sysv4.2uw* )           opsys=unixware; NON_GNU_CPP=/lib/cpp ;;
       *-sysv5uw* )             opsys=unixware; NON_GNU_CPP=/lib/cpp ;;
@@ -747,7 +713,7 @@ dnl see the `changequote' comment above.
   ;;
 
   ## Tensilica Xtensa Linux-based GNU system
-  xtensa-*-linux-gnu* )
+  xtensa*-*-linux-gnu* )
     machine=xtensa opsys=gnu-linux
     ;;
 
@@ -794,6 +760,30 @@ if test x"${opsys}" = x; then
   esac
 fi
 
+### Tests for sytems that we beleive are obsolete and should be desupported.
+
+case "${machine}" in
+     pmax | hp9000s300 | ibm370aix | ncr386 | ews4800 | mips-siemens | powerpcle | tandem-s2 )
+         echo "The system that you are configuring on: ${canonical} is considered to be obsolete"
+         echo "and it is planned to be desupported in the next version of Emacs"
+         echo "Please email emacs-devel@gnu.org as soon as possible if this system is still in use."
+         echo "The code is still functional, but you need to edit the 'configure' script and remove the"
+         echo "exit 33 line.  After that you can run configure again and 'complete' the build."
+         exit 33
+         ;;
+esac
+
+case "${opsys}" in
+     bsd386 | bsdos2-1 |  bsdos2 | bsdos3 | bsdos4 | bsd4-1 | bsd4-2 | bsd4-3 | usg5-0 | usg5-2-2 | usg5-2 | usg5-3 | ultrix4-3 | 386bsd | hpux | hpux8 | hpux9 | hpux9shr | hpux10 | aix3-1 | aix3-2-5 | aix3-2 | aix4-1 | nextstep | ux4800 | uxpds | uxpv )
+         echo "The system that you are configuring on: ${canonical} is considered to be obsolete"
+         echo "and it is planned to be desupported in the next version of Emacs"
+         echo "Please email emacs-devel@gnu.org as soon as possible if this system is still in use."
+         echo "The code is still functional, but you need to edit the 'configure' script and remove the"
+         echo "'exit 44' line.  After that you can run 'configure' again and complete the build."
+         exit 44
+         ;;
+esac
+
 ]
 dnl quotation ends
 
@@ -812,11 +802,7 @@ test -n "$CC" && cc_specified=yes
 # Save the value of CFLAGS that the user specified.
 SPECIFIED_CFLAGS="$CFLAGS"
 
-case ${with_gcc} in
-  "yes" ) CC="gcc" GCC=yes ;;
-  "no"  ) : ${CC=cc} ;;
-  * )
-esac
+dnl Sets GCC=yes if using gcc.
 AC_PROG_CC
 
 # On Suns, sometimes $CPP names a directory.
@@ -870,8 +856,7 @@ then
 fi
 
 dnl checks for Unix variants
-AC_AIX
-AC_GNU_SOURCE
+AC_USE_SYSTEM_EXTENSIONS
 
 ### Use -Wno-pointer-sign if the compiler supports it
 AC_MSG_CHECKING([whether gcc understands -Wno-pointer-sign])
@@ -911,10 +896,22 @@ if test "$MAKEINFO" != "no" && \
    MAKEINFO=no
 fi
 
-if test "$MAKEINFO" = "no"; then
-  AC_MSG_ERROR( [makeinfo >= 4.6 is required] )
-fi
+if test "$MAKEINFO" = "no" && test "x${with_makeinfo}" != "xno"; then
 
+   if test -e $srcdir/info/emacs; then
+      gotinfo="seems"
+   else
+      gotinfo="does NOT seem"
+   fi
+
+  AC_MSG_ERROR( [You do not seem to have makeinfo >= 4.6.
+You will not be able to build the Emacs manuals.
+In Emacs releases, they are prebuilt, so this might not be a problem.
+Your source tree $gotinfo to have manuals in the `info' directory.
+Either install a suitable version of makeinfo, or re-run configure
+with the `--without-makeinfo' option.] )
+
+fi
 
 dnl Add our options to ac_link now, after it is set up.
 
@@ -991,14 +988,10 @@ configure___ c_switch_machine=C_SWITCH_MACHINE
 #define LIB_X11_LIB -lX11
 #endif
 
-#ifndef LIBX11_MACHINE
-#define LIBX11_MACHINE
-#endif
-
 #ifndef LIBX11_SYSTEM
 #define LIBX11_SYSTEM
 #endif
-configure___ LIBX=LIB_X11_LIB LIBX11_MACHINE LIBX11_SYSTEM
+configure___ LIBX=LIB_X11_LIB LIBX11_SYSTEM
 
 #ifdef UNEXEC
 configure___ unexec=UNEXEC
@@ -1100,13 +1093,13 @@ dnl Do this early because it can frob feature test macros for Unix-98 &c.
 AC_SYS_LARGEFILE
 
 
-### The standard library on x86-64 GNU/Linux distributions can
+### The standard library on x86-64 and s390x GNU/Linux distributions can
 ### be located in either /usr/lib64 or /usr/lib.
 case "${canonical}" in
-  x86_64-*-linux-gnu* )
+  x86_64-*-linux-gnu* | s390x-*-linux-gnu* )
     if test -d /usr/lib64; then
-      AC_DEFINE(HAVE_X86_64_LIB64_DIR, 1,
-        [Define to 1 if the file /usr/lib64 exists.])
+      AC_DEFINE(HAVE_LIB64_DIR, 1,
+        [Define to 1 if the directory /usr/lib64 exists.])
 fi
 esac
 
@@ -1117,9 +1110,7 @@ dnl also defines GSTUFF_PKG_ERRORS on error
 AC_DEFUN([PKG_CHECK_MODULES], [
   succeeded=no
 
-  if test -z "$PKG_CONFIG"; then
-    AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
-  fi
+  AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
 
   if test "$PKG_CONFIG" = "no" ; then
      ifelse([$4], , [AC_MSG_ERROR([
@@ -1175,10 +1166,6 @@ if test "${with_sound}" != "no"; then
 
   ALSA_REQUIRED=1.0.0
   ALSA_MODULES="alsa >= $ALSA_REQUIRED"
-  dnl Check if --with-pkg-config-prog has been given.
-  if test "X${with_pkg_config_prog}" != X; then
-    PKG_CONFIG="${with_pkg_config_prog}"
-  fi
   PKG_CHECK_MODULES(ALSA, $ALSA_MODULES, HAVE_ALSA=yes, HAVE_ALSA=no)
   if test $HAVE_ALSA = yes; then
     SAVE_CFLAGS="$CFLAGS"
@@ -1369,6 +1356,16 @@ else
   window_system=x11
 fi
 
+## Workaround for bug in autoconf <= 2.62.
+## http://lists.gnu.org/archive/html/emacs-devel/2008-04/msg01551.html
+## No need to do anything special for these standard directories.
+## This is an experiment, take it out if it causes problems.
+if test -n "${x_libraries}" && test x"${x_libraries}" != xNONE; then
+   
+   x_libraries=`echo :${x_libraries}: | sed -e 's|:/usr/lib64:|:|g' -e 's|:/lib64:|:|g' -e 's|^:||' -e 's|:$||'`
+
+fi
+
 if test "${x_libraries}" != NONE; then
   if test -n "${x_libraries}"; then
     LD_SWITCH_X_SITE=-L`echo ${x_libraries} | sed -e "s/:/ -L/g"`
@@ -1424,7 +1421,7 @@ fi
 if test "${window_system}" = x11 && test "${HAVE_CARBON}" = yes; then
   if test "${with_carbon+set}" != set \
      && test "${carbon_appdir_x+set}" != set; then
-    for var in with_x with_x_toolkit with_gtk with_xim \
+    for var in with_x with_x_toolkit with_xim \
                with_xpm with_jpeg with_tiff with_gif with_png; do
       if eval test \"\${$var+set}\" = set; then
         HAVE_CARBON=no
@@ -1451,13 +1448,7 @@ dnl USE_X_TOOLKIT is set.
       no ) USE_X_TOOLKIT=none ;;
 dnl If user did not say whether to use a toolkit, make this decision later:
 dnl use the toolkit if we have gtk, or X11R5 or newer.
-      * )
-          if test x"$with_gtk" = xyes; then
-             USE_X_TOOLKIT=none
-          else
-             USE_X_TOOLKIT=maybe
-          fi
-          ;;
+      * ) USE_X_TOOLKIT=maybe ;;
     esac
   ;;
   mac | none )
@@ -1489,22 +1480,6 @@ case ${HAVE_X11} in
   yes ) HAVE_MENUS=yes ;;
 esac
 
-if test "${opsys}" = "hpux9"; then
-  case "${x_libraries}" in
-    *X11R4* )
-      opsysfile="s/hpux9-x11r4.h"
-      ;;
-  esac
-fi
-
-if test "${opsys}" = "hpux9shr"; then
-  case "${x_libraries}" in
-    *X11R4* )
-      opsysfile="s/hpux9shxr4.h"
-      ;;
-  esac
-fi
-
 ### Compute the unexec source name from the object name.
 UNEXEC_SRC="`echo ${unexec} | sed 's/\.o/.c/'`"
 
@@ -1563,15 +1538,6 @@ AC_CHECK_LIB(Xbsd, main, LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -lXbsd")
 
 AC_CHECK_LIB(pthreads, cma_open)
 
-AC_MSG_CHECKING(for XFree86 in /usr/X386)
-if test -d /usr/X386/include; then
-  HAVE_XFREE386=yes
-  : ${C_SWITCH_X_SITE="-I/usr/X386/include"}
-else
-  HAVE_XFREE386=no
-fi
-AC_MSG_RESULT($HAVE_XFREE386)
-
 dnl Check for need for bigtoc support on IBM AIX
 
 case ${host_os} in
@@ -1683,11 +1649,6 @@ fi
 HAVE_RSVG=no
 if test "${HAVE_X11}" = "yes" || test "${HAVE_CARBON}" = "yes"; then
   if test "${with_rsvg}" != "no"; then
-    dnl Check if `--with-pkg-config-prog' has been given.
-    if test "X${with_pkg_config_prog}" != X; then
-      PKG_CONFIG="${with_pkg_config_prog}"
-    fi
-
     RSVG_REQUIRED=2.0.0
     RSVG_MODULE="librsvg-2.0 >= $RSVG_REQUIRED"
 
@@ -1706,22 +1667,11 @@ fi
 
 
 HAVE_GTK=no
-if test "${with_gtk}" = "yes" && test "$USE_X_TOOLKIT" = "gtk"; then
-  USE_X_TOOLKIT=none
-fi
-if test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "gtk" || \
- test "$USE_X_TOOLKIT" = "maybe"; then
-  if test "$USE_X_TOOLKIT" != "none" && test "$USE_X_TOOLKIT" != "maybe"; then
-    AC_MSG_ERROR([Conflicting options, --with-gtk is incompatible with --with-x-toolkit=${with_x_toolkit}]);
-  fi
+if test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then
   GLIB_REQUIRED=2.6
   GTK_REQUIRED=2.6
   GTK_MODULES="gtk+-2.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
 
-  dnl Check if --with-pkg-config-prog has been given.
-  if test "X${with_pkg_config_prog}" != X; then
-    PKG_CONFIG="${with_pkg_config_prog}"
-  fi
   dnl Checks for libraries.
   PKG_CHECK_MODULES(GTK, $GTK_MODULES, pkg_check_gtk=yes, pkg_check_gtk=no)
   if test "$pkg_check_gtk" = "no" && test "$USE_X_TOOLKIT" != "maybe"; then
@@ -1746,8 +1696,17 @@ if test x"$pkg_check_gtk" = xyes; then
     fi
   else
     HAVE_GTK=yes
-    AC_DEFINE(HAVE_GTK, 1, [Define to 1 if using GTK.])
+    AC_DEFINE(USE_GTK, 1, [Define to 1 if using GTK.])
     USE_X_TOOLKIT=none
+    if $PKG_CONFIG --atleast-version=2.10 gtk+-2.0; then
+      :
+    else
+      AC_MSG_WARN([[Your version of Gtk+ will have problems with
+       closing open displays.  This is no problem if you just use
+       one display, but if you use more than one and close one of them
+       Emacs may crash.]])
+      sleep 3
+    fi
   fi
 
 fi
@@ -1806,7 +1765,7 @@ if test "${HAVE_GTK}" = "yes"; then
 fi
 
 dnl D-Bus has been tested under GNU/Linux only.  Must be adapted for
-dnl other platforms.  Support for higher D-Bus versions but 1.0 is
+dnl other platforms.  Support for higher D-Bus versions than 1.0 is
 dnl also not configured.
 HAVE_DBUS=no
 if test "${with_dbus}" = "yes"; then
@@ -2021,25 +1980,21 @@ either XPointer or XPointer*.])dnl
   CFLAGS=$late_CFLAGS
 fi
 
-#### For font-backend
-if test "${USE_FONT_BACKEND}" = "yes"; then
+### Start of font-backend section.
+if test "${HAVE_X11}" != "yes"; then
+  USE_FONT_BACKEND=no
+fi
 
-AC_DEFINE(USE_FONT_BACKEND, 1,
-          [Define to 1 if we should use font-backend.])
+if test "${USE_FONT_BACKEND}" = "yes"; then
+  AC_DEFINE(USE_FONT_BACKEND, 1, [Define to 1 if we should use font-backend.])
 
-### Use -lXft if available, unless `--with-freetype=no' nor `--with-xft=no'.
-HAVE_XFT=maybe
-if test "${HAVE_X11}" = "yes"; then
+  ## Use -lXft if available, unless `--with-freetype=no' nor `--with-xft=no'.
+  HAVE_XFT=maybe
   if test "x${with_freetype}" = "xno"; then
     with_xft="no";
   fi
   if test "x${with_xft}" != "xno"; then
 
-    dnl Check if --with-pkg-config-prog has been given.
-    if test "X${with_pkg_config_prog}" != X; then
-      PKG_CONFIG="${with_pkg_config_prog}"
-    fi
-
     PKG_CHECK_MODULES(XFT, xft >= 0.13.0, , HAVE_XFT=no)
     if test "$HAVE_XFT" != no; then
       OLD_CPPFLAGS="$CPPFLAGS"
@@ -2059,77 +2014,68 @@ if test "${HAVE_X11}" = "yes"; then
         CPPFLAGS="$OLD_CPPFLAGS"
         CFLAGS="$OLD_CFLAGS"
         LIBS="$OLD_LIBS"
+      fi                        # "${HAVE_XFT}" = "yes"
+    fi                          # "$HAVE_XFT" != no
+  fi                            # "x${with_xft}" != "xno"
+
+  dnl For the "Does Emacs use" message at the end.
+  if test "$HAVE_XFT" != "yes"; then
+     HAVE_XFT=no
+  fi
+  
+  
+  HAVE_FREETYPE=no
+  ### Use -lfreetype if available, unless `--with-freetype=no'.
+  if test "${HAVE_XFT}" = "yes"; then
+    dnl As we use Xft, we anyway use freetype.
+    dnl In this case, there's no need of additional CFLAGS and LIBS.
+    HAVE_FREETYPE=yes
+  elif test "x${with_freetype}" != "xno"; then
+  
+    PKG_CHECK_MODULES(FREETYPE, freetype2, HAVE_FREETYPE=yes, HAVE_FREETYPE=no)
+    if test "${HAVE_FREETYPE}" = "yes"; then
+      PKG_CHECK_MODULES(FONTCONFIG, fontconfig, HAVE_FC=yes, HAVE_FC=no)
+      if test "${HAVE_FC}" = "no"; then
+        dnl Without fontconfig, we can't use freetype at the moment.
+        HAVE_FREETYPE=no
       fi
     fi
   fi
-fi
-
-HAVE_FREETYPE=no
-### Use -lfreetype if available, unless `--with-freetype=no'.
-if test "${HAVE_XFT}" = "yes"; then
-  dnl As we use Xft, we anyway use freetype.
-  dnl In this case, there's no need of additional CFLAGS and LIBS.
-  HAVE_FREETYPE=yes
-elif test "x${with_freetype}" != "xno"; then
-  dnl Check if --with-pkg-config-prog has been given.
-  if test "X${with_pkg_config_prog}" != X; then
-    PKG_CONFIG="${with_pkg_config_prog}"
-  fi
-
-  PKG_CHECK_MODULES(FREETYPE, freetype2, HAVE_FREETYPE=yes, HAVE_FREETYPE=no)
+  
+  HAVE_LIBOTF=no
   if test "${HAVE_FREETYPE}" = "yes"; then
-    PKG_CHECK_MODULES(FONTCONFIG, fontconfig, HAVE_FC=yes, HAVE_FC=no)
-    if test "${HAVE_FC}" = "no"; then
-      dnl Witout fontconfig, we can't use freetype at the moment.
-      HAVE_FREETYPE=no
+    AC_DEFINE(HAVE_FREETYPE, 1,
+              [Define to 1 if using the freetype and fontconfig libraries.])
+    if test "${with_libotf}" != "no"; then
+      PKG_CHECK_MODULES(LIBOTF, libotf, HAVE_LIBOTF=yes, 
+                        HAVE_LIBOTF=no)
+      if test "$HAVE_LIBOTF" = "yes"; then
+        AC_DEFINE(HAVE_LIBOTF, 1, [Define to 1 if using libotf.])
+      fi
     fi
+dnl FIXME should there be an error if HAVE_FREETYPE != yes?
+dnl Does the new font backend require it, or can it work without it?
   fi
-fi
-
-HAVE_LIBOTF=no
-if test "${HAVE_FREETYPE}" = "yes"; then
-  AC_DEFINE(HAVE_FREETYPE, 1,
-            [Define to 1 if you have freetype and fontconfig libraries.])
-  if test "${with_libotf}" != "no"; then
-    dnl Check if --with-pkg-config-prog has been given.
-    if test "X${with_pkg_config_prog}" != X; then
-      PKG_CONFIG="${with_pkg_config_prog}"
-    fi
-    PKG_CHECK_MODULES(LIBOTF, libotf, pkg_check_libotf=yes, 
-                      pkg_check_libotf=no)
-    if test "$pkg_check_libotf" = "yes"; then
-      AC_DEFINE(HAVE_LIBOTF, 1,
-                [Define to 1 if you have libotf library.])
+  
+  HAVE_M17N_FLT=no
+  if test "${with_m17n_flt}" != "no"; then
+    PKG_CHECK_MODULES(M17N_FLT, m17n-flt, HAVE_M17N_FLT=yes, HAVE_M17N_FLT=no)
+    if test "$HAVE_M17N_FLT" = "yes"; then
+      AC_DEFINE(HAVE_M17N_FLT, 1, [Define to 1 if using libm17n-flt.])
     fi
   fi
-fi
-
-HAVE_M17N_FLT=no
-if test "${with_m17n_flt}" != "no"; then
-  dnl Check if --with-pkg-config-prog has been given.
-  if test "X${with_pkg_config_prog}" != X; then
-    PKG_CONFIG="${with_pkg_config_prog}"
-  fi
-  dnl Checks for libraries.
-  PKG_CHECK_MODULES(M17N_FLT, m17n-flt, pkg_check_m17n_flt=yes, 
-                    pkg_check_m17n_flt=no)
-  if test "$pkg_check_m17n_flt" = "yes"; then
-    AC_DEFINE(HAVE_M17N_FLT, 1,
-              [Define to 1 if you have m17n-flt library.])
-  fi
-fi
-
-AC_SUBST(FREETYPE_CFLAGS)
-AC_SUBST(FREETYPE_LIBS)
-AC_SUBST(FONTCONFIG_CFLAGS)
-AC_SUBST(FONTCONFIG_LIBS)
-AC_SUBST(LIBOTF_CFLAGS)
-AC_SUBST(LIBOTF_LIBS)
-AC_SUBST(M17N_FLT_CFLAGS)
-AC_SUBST(M17N_FLT_LIBS)
-
-fi
-#### End for font-backend
+  
+  AC_SUBST(FREETYPE_CFLAGS)
+  AC_SUBST(FREETYPE_LIBS)
+  AC_SUBST(FONTCONFIG_CFLAGS)
+  AC_SUBST(FONTCONFIG_LIBS)
+  AC_SUBST(LIBOTF_CFLAGS)
+  AC_SUBST(LIBOTF_LIBS)
+  AC_SUBST(M17N_FLT_CFLAGS)
+  AC_SUBST(M17N_FLT_LIBS)
+  
+fi                              # "${USE_FONT_BACKEND}" = "yes"
+### End of font-backend section.
 
 ### Use -lXpm if available, unless `--with-xpm=no'.
 HAVE_XPM=no
@@ -2284,6 +2230,7 @@ AC_CHECK_HEADER(malloc/malloc.h, [AC_DEFINE(HAVE_MALLOC_MALLOC_H, 1, [Define to
 ### Use Mac OS X Carbon API to implement GUI.
 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.])
+  AC_CHECK_HEADERS(AvailabilityMacros.h)
   ## Specify the install directory
   carbon_appdir=
   if test "${carbon_appdir_x}" != ""; then
@@ -2722,15 +2669,17 @@ if test "${HAVE_X_WINDOWS}" = "yes" ; then
 fi
 if test "${USE_X_TOOLKIT}" != "none" ; then
   AC_DEFINE(USE_X_TOOLKIT, 1, [Define to 1 if using an X toolkit.])
+  if test "${USE_X_TOOLKIT}" == "LUCID"; then
+    AC_DEFINE(USE_LUCID, 1, [Define to 1 if using the Lucid X toolkit.])
+  elif test "${USE_X_TOOLKIT}" == "MOTIF"; then
+    AC_DEFINE(USE_MOTIF, 1, [Define to 1 if using the Motif X toolkit.])
+  fi
 fi
 if test "${HAVE_X11}" = "yes" ; then
   AC_DEFINE(HAVE_X11, 1,
            [Define to 1 if you want to use version 11 of X windows.
             Otherwise, Emacs expects to use version 10.])
 fi
-if test "${HAVE_XFREE386}" = "yes" ; then
-  AC_DEFINE(HAVE_XFREE386, 1, [Define to 1 if you're using XFree386.])
-fi
 if test "${HAVE_MENUS}" = "yes" ; then
   AC_DEFINE(HAVE_MENUS, 1,
            [Define to 1 if you have mouse menus.
@@ -2786,8 +2735,7 @@ AH_BOTTOM([
 #endif
 
 /* Multi-tty support relies on MULTI_KBOARD.  It seems safe to turn it
-   on unconditionally.  Note that src/s/darwin.h disables this at
-   present.  */
+   on unconditionally. */
 #ifndef MULTI_KBOARD
 #define MULTI_KBOARD
 #endif
@@ -2851,17 +2799,6 @@ AH_BOTTOM([
 #include config_opsysfile
 #include config_machfile
 
-/* Load in the conversion definitions if this system
-   needs them and the source file being compiled has not
-   said to inhibit this.  There should be no need for you
-   to alter these lines.  */
-
-#ifdef SHORTNAMES
-#ifndef NO_SHORTNAMES
-#include "../shortnames/remap.h"
-#endif /* not NO_SHORTNAMES */
-#endif /* SHORTNAMES */
-
 /* If no remapping takes place, static variables cannot be dumped as
    pure, so don't worry about the `static' keyword. */
 #ifdef NO_REMAP
@@ -3086,15 +3023,25 @@ echo "  Does Emacs use a gif library?                           ${HAVE_GIF} $ac_
 echo "  Does Emacs use -lpng?                                   ${HAVE_PNG}"
 echo "  Does Emacs use -lrsvg-2?                                ${HAVE_RSVG}"
 echo "  Does Emacs use -lgpm?                                   ${HAVE_GPM}"
+echo "  Does Emacs use -ldbus?                                  ${HAVE_DBUS}"
+echo "  Does Emacs use a font backend?                          ${USE_FONT_BACKEND}"
+
+if test "${USE_FONT_BACKEND}" = "yes"; then
+  echo "  Does Emacs use -lfreetype?                              ${HAVE_FREETYPE}"
+  echo "  Does Emacs use -lm17n-flt?                              ${HAVE_M17N_FLT}"
+  echo "  Does Emacs use -lotf?                                   ${HAVE_LIBOTF}"
+  echo "  Does Emacs use -lxft?                                   ${HAVE_XFT}"
+fi
 echo "  Does Emacs use X toolkit scroll bars?                   ${USE_TOOLKIT_SCROLL_BARS}"
 echo
 
 if test $USE_XASSERTS = yes; then
    echo "  Compiling with asserts turned on."
    CPPFLAGS="$CPPFLAGS -DXASSERTS=1"
-   echo
 fi
 
+echo
+
 if test "$USE_X_TOOLKIT" = GTK; then
   case "$canonical" in
   *cygwin*)
@@ -3195,9 +3142,6 @@ echo creating src/Makefile
   sed -e '1,/start of cpp stuff/d'\
       -e 's,/\*\*/#\(.*\)$,/* \1 */,' \
       < Makefile.c > junk.c
-  if test -f ${srcdir}/admin/unidata/UnicodeData.txt; then
-    CPPFLAGS="$CPPFLAGS -DHAVE_UNIDATA"
-  fi
   $CPP $undefs -I. -I$srcdir/src $CPPFLAGS junk.c | \
       sed -e 's/^ /    /' -e '/^#/d' -e '/^[   \f]*$/d' > junk2.c
   cat junk1.c junk2.c > Makefile.new