diff -ru xemacs-21.5.18.orig/configure.in xemacs-21.5.18/configure.in
--- xemacs-21.5.18.orig/configure.in	2004-09-29 17:38:31.000000000 +0200
+++ xemacs-21.5.18/configure.in	2004-12-10 12:31:46.053707788 +0100
@@ -1,5 +1,5 @@
 dnl Define our own header notice with own copyright
-define([AC_INIT_NOTICE],
+define([XE_AC_INIT_NOTICE],
 [#### Configuration script for XEmacs.  Largely divergent from FSF.
 #### Guess values for system-dependent variables and create Makefiles.
 #### Generated automatically using autoconf version] AC_ACVERSION [
@@ -44,6 +44,13 @@
 ### If configure fails after disturbing the status quo,
 ### 	config.status is removed.
 ])
+AC_DIVERT_PUSH(NOTICE)
+XE_AC_INIT_NOTICE
+define([_AC_INIT_PARSE_ARGS],
+[m4_divert_push([PARSE_ARGS])dnl
+m4_divert_pop([PARSE_ARGS])dnl
+])
+AC_DIVERT_POP
 
 dnl Since XEmacs has configuration requirements that autoconf cannot
 dnl meet, this file is an unholy marriage of custom-baked
@@ -52,7 +59,7 @@
 dnl We use the m4 quoting characters [ ] (as established by the
 dnl autoconf system), so quote them like this: [[foo]]
 
-AC_PREREQ(2.13)dnl
+AC_PREREQ(2.50)dnl
 
 dnl #### Doesn't work currently.  it would be really nice if we could
 dnl get this working, because many autoconfs v2.5 come with support for
@@ -91,14 +98,14 @@
 #include "confdefs.h"
 [$1]
 EOF
-if AC_TRY_EVAL(ac_link) && test -s conftest && (./conftest; exit $?) 2>&AC_FD_CC
+if AC_TRY_EVAL(ac_link) && test -s conftest && (./conftest; exit $?) 2>&AS_MESSAGE_LOG_FD
 then
 dnl Do not remove the temporary files here, so they can be examined.
   ifelse([$2], , :, [$2])
 else
   conftest_rc="$?"
-  echo "configure: failed program was:" >&AC_FD_CC
-  cat conftest.$ac_ext >&AC_FD_CC
+  echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
+  cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD
 ifelse([$3], , , [  rm -fr conftest*
   $3
 ])dnl
@@ -114,21 +121,25 @@
 dnl Set VARIABLE to VALUE, verbatim, or 1.
 dnl AC_DEFINE(VARIABLE [, VALUE])
 define([AC_DEFINE],
-[{ test "$extra_verbose" = "yes" && cat << \EOF
+[
+{ test "$extra_verbose" = "yes" && cat << \EOF
     Defining $1[]ifelse($#, 2, [ = $2],)
 EOF
-cat >> confdefs.h <<\EOF
-[#define] $1 ifelse($#, 2, [$2], 1)
+m4_ifval([$3], [AH_TEMPLATE([$1], [$3])])dnl
+cat >>confdefs.h <<\EOF
+[@%:@define] $1 m4_if($#, 2, [$2], $#, 3, [$2], 1)
 EOF
 }
 ])dnl AC_DEFINE
 
 define([AC_DEFINE_UNQUOTED],
-[{ test "$extra_verbose" = "yes" && cat << EOF
+[
+{ test "$extra_verbose" = "yes" && cat << EOF
     Defining $1[]ifelse($#, 2, [ = $2],)
 EOF
-cat >> confdefs.h <<EOF
-[#define] $1 ifelse($#, 2, [$2], 1)
+m4_ifval([$3], [AH_TEMPLATE([$1], [$3])])dnl
+cat >>confdefs.h <<EOF
+[@%:@define] $1 m4_if($#, 2, [$2], $#, 3, [$2], 1)
 EOF
 }
 ])dnl AC_DEFINE_UNQUOTED
@@ -167,7 +178,7 @@
 AC_TRY_LINK(dnl
 ifelse([$2], [main], , dnl Avoid conflicting decl of main.
 [/* Override any gcc2 internal prototype to avoid an error.  */
-]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus
+]ifelse(_AC_LANG, CPLUSPLUS, [#ifdef __cplusplus
 extern "C"
 #endif
 ])dnl
@@ -200,20 +211,21 @@
 
 dnl AC_LANG_C()
 define([AC_LANG_C],
-[define([AC_LANG], [C])dnl
+[define([_AC_LANG], [C])dnl
 ac_ext=c
 dnl CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
 dnl ac_cpp='$CPP $CPPFLAGS'
-dnl ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&AC_FD_CC'
-dnl ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC'
+dnl ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&AS_MESSAGE_LOG_FD'
+dnl ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AS_MESSAGE_LOG_FD'
 xe_cppflags='$CPPFLAGS $c_switch_site $c_switch_machine $c_switch_system $c_switch_x_site $X_CFLAGS'
 xe_ldflags='$LDFLAGS $ld_switch_site $ld_switch_machine $ld_switch_system $ld_switch_x_site $ld_switch_run'
 xe_libs='$ld_call_shared $xe_check_libs $X_EXTRA_LIBS $libs_x $libs_gtk $X_PRE_LIBS $LIBS $libs_machine $libs_system $libs_standard'
 ac_cpp='$CPP '"$xe_cppflags"
-ac_compile='${CC-cc} -c $CFLAGS '"$xe_cppflags"' conftest.$ac_ext 1>&AC_FD_CC'
-ac_link='${CC-cc} -o conftest $CFLAGS '"$xe_cppflags $xe_ldflags"' conftest.$ac_ext '"$xe_libs"' 1>&AC_FD_CC'
+ac_compile='${CC-cc} -c $CFLAGS '"$xe_cppflags"' conftest.$ac_ext 1>&AS_MESSAGE_LOG_FD'
+ac_link='${CC-cc} -o conftest $CFLAGS '"$xe_cppflags $xe_ldflags"' conftest.$ac_ext '"$xe_libs"' 1>&AS_MESSAGE_LOG_FD'
 cross_compiling=no
 ]) dnl AC_LANG_C
+define([AC_LANG(C)], [AC_LANG_C]);
 
 dnl The construct foo=`echo $w1 $w2 $w3` fails on some systems if $w1 = -e or -n
 dnl So we use the following instead.
@@ -254,7 +266,7 @@
 echo " " $1
 echo "  Use \`$progname --help' to show usage.") >&2 && exit 1])
 
-define([AC_INIT_PARSE_ARGS],[
+AC_DIVERT_PUSH(PARSE_ARGS)
 
 dnl Get sane consistent behavior from various shells
 dnl Avoid losing with weird user CDPATHs
@@ -289,8 +301,11 @@
 done
 
 dnl Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
 dnl The variables have the same names as the options, with
 dnl dashes changed to underlines.
+cache_file=/dev/null
 exec_prefix=NONE
 host=NONE
 no_create=
@@ -314,9 +329,9 @@
 SHELL=${CONFIG_SHELL-/bin/sh}
 dnl Maximum number of lines to put in a shell here document.
 ac_max_here_lines=12
-])dnl AC_INIT_PARSE_ARGS
+AC_DIVERT_POP
 
-AC_INIT(src/lisp.h)dnl
+AC_INIT(lisp/version.el)
 AC_CONFIG_HEADER(src/config.h lwlib/config.h)
 
 dnl Remove any more than one leading "." element from the path name.
@@ -1057,7 +1072,7 @@
 dnl names of the m/*.h and s/*.h files we should use.
 
 dnl Canonicalize the configuration name.
-AC_MSG_CHECKING("host system type")
+AS_MESSAGE([checking "host system type"...])
 dnl allow -workshop suffix on configuration name
 internal_configuration=`echo $configuration | sed 's/-\(workshop\)//'`
 canonical=`${CONFIG_SHELL-/bin/sh} $srcdir/config.sub "$internal_configuration"`
@@ -2784,7 +2799,7 @@
 AC_CHECK_FUNCS(mkstemp)
 
 dnl Determine type of mail locking from configure args and s&m headers
-AC_CHECKING(type of mail spool file locking)
+AS_MESSAGE([checking type of mail spool file locking...])
 AC_CHECK_FUNCS(lockf flock)
 dnl The mail_use_xxx variables are set according to the s&m headers.
 test -z "$mail_locking" -a "$mail_use_flock" = "yes" && mail_locking=flock
@@ -2846,7 +2861,7 @@
 dnl Choose a window system
 dnl ----------------------
 
-AC_CHECKING("for specified window system")
+AS_MESSAGE([checking "for specified window system"...])
 
 dnl Autodetection of Gdk libraries and includes
 dnl -------------------------------------------
@@ -3107,7 +3122,7 @@
   test ! -z "$bitmapdirs" && AC_DEFINE_UNQUOTED(BITMAPDIR, "$bitmapdirs")
 
   dnl Autodetect defines extracted from X config by xmkmf, e.g. NARROWPROTO
-  AC_CHECKING(for X defines extracted by xmkmf)
+  AS_MESSAGE([checking for X defines extracted by xmkmf...])
   rm -fr conftestdir
   if mkdir conftestdir; then
     cd conftestdir
@@ -3227,7 +3242,7 @@
 fi dnl $with_x11 = yes
 
 if test "$with_msw" != "no"; then
-  AC_CHECKING(for MS-Windows)
+  AS_MESSAGE([checking for MS-Windows...])
   AC_CHECK_LIB(gdi32,main,with_msw=yes)
   if test "$with_msw" = "yes"; then
     AC_DEFINE(HAVE_MS_WINDOWS)
@@ -3336,7 +3351,7 @@
 esac
 
 dnl Enable or disable proper handling of WM_COMMAND
-AC_CHECKING(for WM_COMMAND option);
+AS_MESSAGE([checking for WM_COMMAND option...]);
 dnl if test "$with_wmcommand" = "yes"; then
 if test "$with_wmcommand" != "no"; then
   AC_DEFINE(HAVE_WMCOMMAND)
@@ -3372,7 +3387,7 @@
 
 dnl This must come before the detection code for anything that is in a module
 if test "$with_modules" != "no"; then
-  AC_CHECKING(for module support)
+  AS_MESSAGE([checking for module support...])
 
   case "$opsys" in
     mingw* | cygwin* ) have_dl=yes ;;
@@ -3576,7 +3591,7 @@
 fi
 
 dnl Autodetect LDAP
-AC_CHECKING(for LDAP)
+AS_MESSAGE([checking for LDAP...])
 ldap_libs=
 test -z "$with_ldap" && { AC_CHECK_HEADER(ldap.h, ,with_ldap=no) }
 test -z "$with_ldap" && { AC_CHECK_HEADER(lber.h, ,with_ldap=no) }
@@ -3622,7 +3637,7 @@
 dnl that prefix must be specified using the --site-prefixes flag.
 postgresql_libs=
 if test "$with_postgresql" != "no"; then
-  AC_CHECKING(for PostgreSQL)
+  AS_MESSAGE([checking for PostgreSQL...])
 
 dnl Look for these standard header file locations, known to be used on Linux
   for header_dir in "" "pgsql/" "postgresql/"; do
@@ -3656,7 +3671,7 @@
 dnl ----------------------
 
 if test "$window_system" != "none"; then
-  AC_CHECKING(for graphics libraries)
+  AS_MESSAGE([checking for graphics libraries...])
 
   dnl add special code to handle xpm-nox on Cygwin (csw)
   dnl   -- should only happen if CYGWIN && WITH_XPM && WITH_MSW && !WITH_X
@@ -3843,7 +3858,7 @@
 dnl ----------------------
 
 if test "$with_x11" = "yes"; then
-  AC_CHECKING(for X11 graphics libraries)
+  AC_CHECKING([checking for X11 graphics libraries...])
 fi
 
 dnl We don't automatically trigger widgets if athena is present
@@ -3855,7 +3870,7 @@
 esac
 
 if test "$with_x11" = "yes" -a "$detect_athena" = "yes" ; then
-  AC_CHECKING(for the Athena widgets)
+  AC_CHECKING([for the Athena widgets...])
 
   dnl What in heck did the user actually want?
   case "$with_athena" in
@@ -3894,42 +3909,42 @@
   dnl Now we locate the Athena headers that we need.
   if test "$athena_3d" = "no"; then
     AC_CHECK_HEADER(X11/Xaw/ThreeD.h,
-      AC_MSG_WARN([Could not find a non-3d Athena header set.]),
-      AC_CHECK_HEADER(X11/Xaw/XawInit.h,
+      [AC_MSG_WARN("Could not find a non-3d Athena header set.")],
+      [AC_CHECK_HEADER(X11/Xaw/XawInit.h,
         athena_h_path=X11/Xaw,
-        AC_MSG_WARN([Could not find a non-3d Athena header set.])))
+        [AC_MSG_WARN("Could not find a non-3d Athena header set.")])])
   else
     dnl The three-d Athena headers are so much more slippery.
     dnl Curse this `Lets replace standard libraries' thing that they did. :/
     AC_CHECK_HEADER(X11/$athena_variant/XawInit.h,
-      AC_CHECK_HEADER(X11/$athena_variant/ThreeD.h,
-        athena_h_path=X11/$athena_variant,))
+      [AC_CHECK_HEADER(X11/$athena_variant/ThreeD.h,
+        athena_h_path=X11/$athena_variant,)])
 
     dnl Is the variant specific header directory directly under include?
     if test -z "$athena_h_path"; then
       AC_CHECK_HEADER($athena_variant/XawInit.h,
-        AC_CHECK_HEADER($athena_variant/ThreeD.h,
-          athena_h_path=$athena_variant,))
+        [AC_CHECK_HEADER($athena_variant/ThreeD.h,
+          athena_h_path=$athena_variant,)])
     fi
 
     dnl If we couldn't find the specific variant, try the generic Athena 3d headers
     if test -z "$athena_h_path" -a "$athena_variant" != "Xaw3d"; then
       AC_CHECK_HEADER(X11/Xaw3d/XawInit.h,
-        AC_CHECK_HEADER(X11/Xaw3d/ThreeD.h,
+        [AC_CHECK_HEADER(X11/Xaw3d/ThreeD.h,
           [
             AC_MSG_WARN([Assuming that X11/Xaw3d headers are suitable for $athena_variant.])
             athena_h_path=X11/Xaw3d
-          ],))
+          ],)])
     fi
 
     dnl Also generic 3d headers directly under include dir
     if test -z "$athena_h_path" -a "$athena_variant" != "Xaw3d"; then
       AC_CHECK_HEADER(Xaw3d/XawInit.h,
-        AC_CHECK_HEADER(Xaw3d/ThreeD.h,
+        [AC_CHECK_HEADER(Xaw3d/ThreeD.h,
           [
             AC_MSG_WARN([Assuming that Xaw3d headers are suitable for $athena_variant.])
             athena_h_path=Xaw3d
-          ],))
+         ],)])
     fi
 
     dnl If nothing yet found, see if Xaw is a 3d header set...
@@ -4105,19 +4120,19 @@
 fi
 
 if test "$with_mule" = "yes" ; then
-  AC_CHECKING(for Mule-related features)
+  AS_MESSAGE([checking for Mule-related features...])
   AC_DEFINE(MULE)
 
   dnl Use -lintl to get internationalized strerror for Mule
   AC_CHECK_HEADERS(libintl.h)
   AC_CHECK_LIB(intl, strerror)
 
-  AC_CHECKING(for Mule input methods)
+  AS_MESSAGE([checking for Mule input methods...])
   dnl Do we have the XmIm* routines?  And if so, do we want to use them?
   dnl XIM seems to be flaky except on Solaris...
   dnl test -z "$with_xim" -a "$opsys" != "sol2" && with_xim=no
   case "$with_xim" in "" | "yes" )
-    AC_CHECKING(for XIM)
+    AS_MESSAGE([checking for XIM...])
     AC_CHECK_LIB(X11, XOpenIM, with_xim=xlib, with_xim=no)
     dnl XIM + Lesstif is not (yet?) usable
     if test "$have_motif $have_lesstif" = "yes no"; then
@@ -4142,7 +4157,7 @@
 
   dnl "with_xfs" = "yes"
   if test "$with_xfs" = "yes" ; then
-    AC_CHECKING(for XFontSet)
+    AS_MESSAGE([checking for XFontSet...])
     AC_CHECK_LIB(X11, XmbDrawString, [:], with_xfs=no)
     if test "$with_xfs" = "yes" && test "$with_menubars" = "lucid"; then
       AC_DEFINE(USE_XFONTSET)
@@ -4583,7 +4598,7 @@
 dnl Check for sound of various sorts.
 
 dnl Autodetect native sound
-AC_CHECKING("for sound support")
+AS_MESSAGE([checking "for sound support"...])
 test -z "$with_native_sound" -a -n "$native_sound_lib" && with_native_sound=yes
 
 if test "$with_native_sound" != "no"; then
@@ -4725,7 +4740,7 @@
 test -z "$with_tty" && with_tty=yes
 
 if test "$with_tty" = "yes"  ; then
-  AC_CHECKING(for TTY-related features)
+  AS_MESSAGE([checking for TTY-related features...])
   AC_DEFINE(HAVE_TTY)
 
   dnl Autodetect ncurses.
@@ -4810,7 +4825,7 @@
 dnl By default, we check for DBM support in libgdbm, then libc, then libdbm.
 
 test "$with_database_gdbm $with_database_dbm $with_database_berkdb" \
-  != "no no no" && AC_CHECKING(for database support)
+  != "no no no" && AS_MESSAGE([checking for database support...])
 
 dnl Check for ndbm.h, required for either kind of DBM support.
 if test "$with_database_gdbm $with_database_dbm" != "no no"; then
@@ -5660,10 +5675,8 @@
 dnl Create a GNUmakefile and Makefile from Makefile.in.
 
 changequote(<<,>>)dnl
-dnl CPP_MAKEFILE(CPPFLAGS,filename)
-define(<<CPP_MAKEFILE>>,
-echo creating $dir/<<$2>>
-$CPP -I. -I${top_srcdir}/src <<$1>> junk.c \
+echo creating $dir/Makefile
+$CPP -I. -I${top_srcdir}/src -DUSE_GNU_MAKE junk.c \
 dnl Delete line directives inserted by $CPP
   | sed -e 's/^\#.*//'		\
 dnl Delete spurious blanks inserted by $CPP
@@ -5678,15 +5691,8 @@
 	s/\"[ TAB]*$//
 }' > Makefile.new
     chmod 444 Makefile.new
-    mv -f Makefile.new <<$2>>
-)dnl CPP_MAKEFILE
-
-    CPP_MAKEFILE(,Makefile)
-    CPP_MAKEFILE(-DUSE_GNU_MAKE,GNUmakefile)
-    if test -r "xemacs.def.in"; then
-      cp -f xemacs.def.in junk.c
-      CPP_MAKEFILE(,xemacs.def)
-    fi
+    mv -f Makefile.new Makefile; cp Makefile GNUmakefile
+dnl
 changequote([,])dnl
     rm -f junk.c
   )
