Remove INSTALL reference to s/ and m/ files.
[bpt/emacs.git] / configure.ac
index 24ad6b5..6776c09 100644 (file)
@@ -365,9 +365,6 @@ case "${srcdir}" in
   *  ) srcdir="`(cd ${srcdir}; pwd)`" ;;
 esac
 
-#### Given the configuration name, set opsysfile to the
-#### name of s/*.h file we should use.
-
 ### Canonicalize the configuration name.
 
 AC_CANONICAL_HOST
@@ -555,8 +552,6 @@ if test $unported = yes; then
 Check `etc/MACHINES' for recognized configuration names.])
 fi
 
-opsysfile="s/${opsys}.h"
-
 
 #### Choose a compiler.
 
@@ -1104,12 +1099,8 @@ case $opsys in
 esac
 
 
-# Configure gnulib before invoking PKG_CHECK_MODULES, as the latter might
-# for example add -lrt to RSVG_LIBS, which would then cause gnulib to
-# incorrectly conclude that -lrt is not needed to link clock_gettime.
-gl_ASSERT_NO_GNULIB_POSIXCHECK
-gl_ASSERT_NO_GNULIB_TESTS
-gl_INIT
+pre_PKG_CONFIG_CFLAGS=$CFLAGS
+pre_PKG_CONFIG_LIBS=$LIBS
 
 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
 
@@ -1302,19 +1293,6 @@ AC_CHECK_MEMBERS([struct ifreq.ifr_flags, struct ifreq.ifr_hwaddr,
 dnl Check for endianness.
 dnl AC_C_BIGENDIAN is done by gnulib.
 
-AC_CACHE_CHECK([for  __attribute__ ((__aligned__ (expr)))],
-  [emacs_cv_attribute_aligned],
-  [AC_COMPILE_IFELSE(
-     [AC_LANG_PROGRAM(
-       [[char __attribute__ ((__aligned__ (1 << 3))) c;]],
-       [[]])],
-     [emacs_cv_attribute_aligned=yes],
-     [emacs_cv_attribute_aligned=no])])
-if test $emacs_cv_attribute_aligned = yes; then
-  AC_DEFINE([HAVE_ATTRIBUTE_ALIGNED], 1,
-    [Define to 1 if GCC-style __attribute__ ((__aligned__ (expr))) works.])
-fi
-
 dnl check for Make feature
 dnl AC_PROG_MAKE_SET is done by Automake.
 
@@ -3156,7 +3134,7 @@ case $opsys in
   aix4-2)
     dnl Unfortunately without libXmu we cannot support EditRes.
     if test x$ac_cv_lib_Xmu_XmuConvertStandardSelection != xyes; then
-      AC_DEFINE(NO_EDITRES, 1)    
+      AC_DEFINE(NO_EDITRES, 1)
     fi
     ;;
 
@@ -3171,7 +3149,15 @@ esac
 case $opsys in
   darwin | gnu | hpux* | *bsd )
     AC_DEFINE(NO_TERMIO, 1, [Define if termio.h should not be included.])
-  ;;
+    ;;
+
+  irix6-5 | sol2* | unixware )
+    dnl Some SVr4s don't define NSIG in sys/signal.h for ANSI environments;
+    dnl instead, there's a system variable _sys_nsig.  Unfortunately, we
+    dnl need the constant to dimension an array.  So wire in the appropriate
+    dnl value here.
+    AC_DEFINE(NSIG_MINIMUM, 32, [Minimum value of NSIG.])
+    ;;
 esac
 
 
@@ -3397,17 +3383,13 @@ case $opsys in
     dnl Not used, because PTY_ITERATION is defined.
     AC_DEFINE(FIRST_PTY_LETTER, ['q'])
     AC_DEFINE(PTY_OPEN, [ { struct sigaction ocstat, cstat; struct stat stb; char * name; sigemptyset(&cstat.sa_mask); cstat.sa_handler = SIG_DFL; cstat.sa_flags = 0; sigaction(SIGCLD, &cstat, &ocstat); name = _getpty (&fd, O_RDWR | O_NDELAY, 0600, 0); sigaction(SIGCLD, &ocstat, (struct sigaction *)0); if (name == 0) return -1; if (fd < 0) return -1; if (fstat (fd, &stb) < 0) return -1; strcpy (pty_name, name); }] )
-    dnl No need to get the pty name at all. 
+    dnl No need to get the pty name at all.
     AC_DEFINE(PTY_NAME_SPRINTF, [] )
     dnl No need to use sprintf to get the tty name--we get that from _getpty.
     AC_DEFINE(PTY_TTY_NAME_SPRINTF, [] )
     ;;
 
   sol2* )
-    dnl This change means that we don't loop through allocate_pty too
-    dnl many times in the (rare) event of a failure.
-    AC_DEFINE(FIRST_PTY_LETTER, ['z'])
-    AC_DEFINE(PTY_NAME_SPRINTF, [strcpy (pty_name, "/dev/ptmx");] )
     dnl Uses sigblock/sigunblock rather than sighold/sigrelse,
     dnl which appear to be BSD4.1 specific.  It may also be appropriate
     dnl for SVR4.x (x<2) but I'm not sure.   fnf@cygnus.com
@@ -3417,11 +3399,21 @@ case $opsys in
     AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptsname (int), *ptyname; sigblock (sigmask (SIGCLD)); if (grantpt (fd) == -1) { emacs_close (fd); return -1; } sigunblock (sigmask (SIGCLD)); if (unlockpt (fd) == -1) { emacs_close (fd); return -1; } if (!(ptyname = ptsname (fd))) { emacs_close (fd); return -1; } snprintf (pty_name, sizeof pty_name, "%s", ptyname); }] )
     ;;
 
-  dnl Comments are as per sol2*.
   unixware )
+    dnl Comments are as per sol2*.
+    AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptsname (int), *ptyname; sigblock(sigmask(SIGCLD)); if (grantpt(fd) == -1) fatal("could not grant slave pty"); sigunblock(sigmask(SIGCLD)); if (unlockpt(fd) == -1) fatal("could not unlock slave pty"); if (!(ptyname = ptsname(fd))) fatal ("could not enable slave pty"); snprintf (pty_name, sizeof pty_name, "%s", ptyname); }] )
+    ;;
+esac
+
+
+case $opsys in
+  sol2* | unixware )
+    dnl This change means that we don't loop through allocate_pty too
+    dnl many times in the (rare) event of a failure.
     AC_DEFINE(FIRST_PTY_LETTER, ['z'])
     AC_DEFINE(PTY_NAME_SPRINTF, [strcpy (pty_name, "/dev/ptmx");] )
-    AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptsname (int), *ptyname; sigblock(sigmask(SIGCLD)); if (grantpt(fd) == -1) fatal("could not grant slave pty"); sigunblock(sigmask(SIGCLD)); if (unlockpt(fd) == -1) fatal("could not unlock slave pty"); if (!(ptyname = ptsname(fd))) fatal ("could not enable slave pty"); snprintf (pty_name, sizeof pty_name, "%s", ptyname); }] )
+    dnl Push various streams modules onto a PTY channel.  Used in process.c.
+    AC_DEFINE(SETUP_SLAVE_PTY, [if (ioctl (xforkin, I_PUSH, "ptem") == -1) fatal ("ioctl I_PUSH ptem"); if (ioctl (xforkin, I_PUSH, "ldterm") == -1) fatal ("ioctl I_PUSH ldterm"); if (ioctl (xforkin, I_PUSH, "ttcompat") == -1) fatal ("ioctl I_PUSH ttcompat");], [How to set up a slave PTY, if needed.])
     ;;
 esac
 
@@ -3436,7 +3428,7 @@ case $opsys in
     AC_DEFINE(SIGNALS_VIA_CHARACTERS, 1)
     ;;
 
-  dnl 21 Jun 06: Eric Hanchrow <offby1@blarg.net> says this works. 
+  dnl 21 Jun 06: Eric Hanchrow <offby1@blarg.net> says this works.
   dnl FIXME Does gnu-kfreebsd have linux/version.h?  It seems unlikely...
   gnu-linux | gnu-kfreebsd )
 
@@ -3473,7 +3465,7 @@ case $opsys in
 
   gnu | gnu-linux | gnu-kfreebsd )
     AC_MSG_CHECKING([for style of pending output formalism])
-    dnl In autoconf 2.67 (?) and later, we could use a single test
+    dnl In autoconf 2.67 and later, we could use a single test
     dnl since the preprocessed output is accessible in "conftest.i".
     AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
 #include <stdio.h>
@@ -3545,6 +3537,7 @@ case $opsys in
 esac
 
 
+AH_TEMPLATE(ULIMIT_BREAK_VALUE, [Undocumented.])
 AH_TEMPLATE(TAB3, [Undocumented.])
 
 case $opsys in
@@ -3555,19 +3548,214 @@ case $opsys in
     AC_DEFINE(TAB3, OXTABS)
     ;;
 
+  gnu-linux | gnu-kfreebsd )
+    dnl libc-linux/sysdeps/linux/i386/ulimit.c says that due to shared
+    dnl library, we cannot get the maximum address for brk.
+    AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
+#ifndef __i386__
+# error "not i386"
+#endif
+      ]], [[]])], AC_DEFINE(ULIMIT_BREAK_VALUE, [(32*1024*1024)]), [])
+
+    AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
+#ifndef __ia64__
+# error "not ia64"
+#endif
+      ]], [[]])], AC_DEFINE(GC_MARK_SECONDARY_STACK(),
+        [do { extern void *__libc_ia64_register_backing_store_base; __builtin_ia64_flushrs (); mark_memory (__libc_ia64_register_backing_store_base, __builtin_ia64_bsp ());} while (0)],
+        [Mark a secondary stack, like the register stack on the ia64.]), [])
+    ;;
+
   hpux*)
     AC_DEFINE(RUN_TIME_REMAP, 1, [Define if emacs.c needs to call
       run_time_remap; for HPUX.])
     ;;
+
+  irix6-5)
+    dnl Ulimit(UL_GMEMLIM) is busted...
+    AC_DEFINE(ULIMIT_BREAK_VALUE, [0x14000000])
+    ;;
+esac
+
+
+dnl These won't be used automatically yet.  We also need to know, at least,
+dnl that the stack is continuous.
+AH_TEMPLATE(GC_SETJMP_WORKS, [Define if setjmp is known to save all
+  registers relevant for conservative garbage collection in the jmp_buf.])
+
+AH_TEMPLATE(GC_MARK_STACK, [Define to GC_USE_GCPROS_AS_BEFORE if
+  conservative garbage collection is not known to work.])
+
+
+case $opsys in
+  aix4-2 | hpux* | unixware)
+    dnl Conservative garbage collection has not been tested, so for now
+    dnl play it safe and stick with the old-fashioned way of marking.
+    AC_DEFINE(GC_MARK_STACK, [GC_USE_GCPROS_AS_BEFORE])
+    ;;
+
+  dnl Not all the architectures are tested, but there are Debian packages
+  dnl for SCM and/or Guile on them, so the technique must work.  See also
+  dnl comments in alloc.c concerning setjmp and gcc.
+  dnl Fixme: it's probably safe to just use the GCC conditional below.
+  gnu-linux | gnu-kfreebsd )
+    AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
+#if defined __i386__ || defined __sparc__ || defined __mc68000__ \
+  || defined __alpha__ || defined __mips__ || defined __s390__ \
+  || defined __arm__ || defined __powerpc__ || defined __amd64__ \
+  || defined __ia64__ || defined __sh__
+/* ok */
+#else
+# error "setjmp not known to work on this arch"
+#endif
+    ]], [[]])], AC_DEFINE(GC_SETJMP_WORKS, 1),
+      AC_DEFINE(GC_MARK_STACK, [GC_USE_GCPROS_AS_BEFORE]) )
+    ;;
+esac
+
+
+if test x$GCC = xyes; then
+   dnl GC_SETJMP_WORKS is nearly always appropriate for GCC.
+   AC_DEFINE(GC_SETJMP_WORKS, 1)
+else
+  case $opsys in
+    dnl irix: Tested on Irix 6.5.  SCM worked on earlier versions.
+    freebsd | netbsd | openbsd | irix6-5 | sol2* )
+      AC_DEFINE(GC_SETJMP_WORKS, 1)
+      ;;
+  esac
+fi                              dnl GCC?
+
+
+case $opsys in
+  sol2* | unixware )
+    dnl setjmp and longjmp can safely replace _setjmp and _longjmp,
+    dnl but they will run more slowly.
+    AC_DEFINE(_setjmp, setjmp, [Some platforms redefine this.])
+    AC_DEFINE(_longjmp, longjmp, [Some platforms redefine this.])
+    dnl TIOCGPGRP is broken in SysVr4, so we can't send signals to PTY
+    dnl subprocesses the usual way.  But TIOCSIGNAL does work for PTYs,
+    dnl and this is all we need.
+    AC_DEFINE(TIOCSIGSEND, TIOCSIGNAL, [Some platforms redefine this.])
+    ;;
+esac
+
+dnl Used in process.c.
+case $opsys in
+  irix6-5 | sol2* | unixware )
+    dnl It is possible to receive SIGCHLD when there are no children
+    dnl waiting, because a previous waitsys(2) cleaned up the carcass
+    dnl of child without clearing the SIGCHLD pending info.  So, use a
+    dnl non-blocking wait3 instead, which maps to waitpid(2) in SysVr4.
+    AC_DEFINE(wait3(status, options, rusage),
+      [waitpid ((pid_t) -1, (status), (options))],
+      [Some platforms redefine this.])
+    dnl FIXME this makes no sense, because WRETCODE is only used in
+    dnl process.c, which includes syswait.h aftet config.h, and the
+    dnl former unconditionally redefines WRETCODE.
+    AC_DEFINE(WRETCODE(w), [(w >> 8)], [Some platforms redefine this.])
+    ;;
 esac
 
 
-dnl Used in xfaces.c.
 case $opsys in
   hpux* | sol2* )
+    dnl Used in xfaces.c.
     AC_DEFINE(XOS_NEEDS_TIME_H, 1, [Compensate for a bug in Xos.h on
       some systems, where it requires time.h.])
     ;;
+
+  netbsd | openbsd )
+    dnl Greg A. Woods <woods@weird.com> says we must include signal.h
+    dnl before syssignal.h is included, to work around interface conflicts
+    dnl that are handled with CPP __RENAME() macro in signal.h.
+    AC_DEFINE(SIGNAL_H_AHB, 1, [Define if AH_BOTTOM should include signal.h.])
+    ;;
+esac
+
+
+dnl Define symbols to identify the version of Unix this is.
+dnl Define all the symbols that apply correctly.
+AH_TEMPLATE(BSD4_2, [Define if the system is compatible with BSD 4.2.])
+AH_TEMPLATE(BSD_SYSTEM, [Define if the system is compatible with BSD 4.2.])
+AH_TEMPLATE(USG, [Define if the system is compatible with System III.])
+AH_TEMPLATE(USG5, [Define if the system is compatible with System V.])
+AH_TEMPLATE(USG5_4, [Define if the system is compatible with System V Release 4.])
+
+case $opsys in
+  aix4-2)
+    AC_DEFINE(USG, [])
+    AC_DEFINE(USG5, [])
+    dnl This symbol should be defined on AIX Version 3  ???????
+    AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
+#ifndef _AIX
+# error "_AIX not defined"
+#endif
+    ]], [[]])], [], AC_DEFINE(_AIX, [], [Define if the system is AIX.]))
+    ;;
+
+  cygwin)
+    AC_DEFINE(CYGWIN, 1, [Define if the system is Cygwin.])
+    ;;
+
+  darwin)
+    dnl BSD4_3 and BSD4_4 are already defined in sys/param.h.
+    AC_DEFINE(BSD4_2, [])
+    AC_DEFINE(BSD_SYSTEM, [])
+    dnl More specific than the above two.  We cannot use __APPLE__ as this
+    dnl may not be defined on non-OSX Darwin, and we cannot define DARWIN
+    dnl here because Panther and lower CoreFoundation.h uses DARWIN to
+    dnl distinguish OS X from pure Darwin.
+    AC_DEFINE(DARWIN_OS, [], [Define if the system is Darwin.])
+    ;;
+
+  freebsd)
+    AC_DEFINE(BSD4_2, [])
+    dnl Hack to avoid calling AC_PREPROC_IFELSE multiple times.
+    dnl Would not be needed with autoconf >= 2.67, where the
+    dnl preprocessed output is accessible in "conftest.i".
+    AC_DEFINE(BSD_SYSTEM_AHB, 1, [Define if AH_BOTTOM should change BSD_SYSTEM.])
+    ;;
+
+  gnu | netbsd | openbsd )
+    AC_DEFINE(BSD4_2, [])
+    AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
+#ifndef BSD_SYSTEM
+# error "BSD_SYSTEM not defined"
+#endif
+    ]], [[]])], [], AC_DEFINE(BSD_SYSTEM, 43) )
+    ;;
+
+  gnu-linux | gnu-kfreebsd )
+    AC_DEFINE(USG, [])
+    AC_DEFINE(GNU_LINUX, [], [Define if ths system is compatible with GNU/Linux.])
+    ;;
+
+  hpux*)
+    AC_DEFINE(USG, [])
+    AC_DEFINE(USG5, [])
+    AC_DEFINE(HPUX, [], [Define if the system is HPUX.])
+    ;;
+
+  irix6-5)
+    AC_DEFINE(USG, [])
+    AC_DEFINE(USG5, [])
+    AC_DEFINE(USG5_4, [])
+    AC_DEFINE(IRIX6_5, [], [Define if the system is IRIX.])
+    ;;
+
+  sol2*)
+    AC_DEFINE(USG, [])
+    AC_DEFINE(USG5, [])
+    AC_DEFINE(USG5_4, [])
+    AC_DEFINE(SOLARIS2, [], [Define if the system is Solaris.])
+    ;;
+
+  unixware)
+    AC_DEFINE(USG, [])
+    AC_DEFINE(USG5, [])
+    AC_DEFINE(USG5_4, [])
+    ;;
 esac
 
 
@@ -3582,10 +3770,6 @@ case $opsys in
       using GTK.])
     ;;
 
-  gnu) opsysfile="s/bsd-common.h" ;;
-
-  gnu-kfreebsd) opsysfile="s/gnu-linux.h" ;;
-
   hpux11)
     dnl See comments in sysdep.c:sys_signal.
     dnl SA_RESTART resets the timeout of `select' on hpux11.
@@ -3597,8 +3781,6 @@ case $opsys in
     AC_DEFINE(USG_SUBTTY_WORKS, 1, [Define for USG systems where it
       works to open a pty's tty in the parent process, then close and
       reopen it in the child.])
-
-    opsysfile="s/hpux10-20.h"
     ;;
 
   irix6-5)
@@ -3608,12 +3790,9 @@ case $opsys in
       should not call setpgrp.])
     ;;
 
-  openbsd) opsysfile="s/netbsd.h" ;;
-
   sol2-10)
     AC_DEFINE(_STRUCTURED_PROC, 1, [Needed for system_process_attributes
       on Solaris.])
-    opsysfile="s/sol2-6.h"
     ;;
 esac
 
@@ -3667,11 +3846,7 @@ AC_SUBST(GNUSTEP_CFLAGS)
 AC_SUBST(CFLAGS)
 ## Used in lwlib/Makefile.in.
 AC_SUBST(X_TOOLKIT_TYPE)
-if test -n "${opsysfile}"; then
-  S_FILE="\$(srcdir)/${opsysfile}"
-else
-  S_FILE=
-fi
+S_FILE=
 AC_SUBST(S_FILE)
 AC_SUBST(ns_appdir)
 AC_SUBST(ns_appbindir)
@@ -3684,9 +3859,8 @@ AC_DEFINE_UNQUOTED(EMACS_CONFIGURATION,  "${canonical}",
                   [Define to the canonical Emacs configuration name.])
 AC_DEFINE_UNQUOTED(EMACS_CONFIG_OPTIONS, "${ac_configure_args}",
                   [Define to the options passed to configure.])
-if test -n "$opsysfile"; then
-  AC_DEFINE_UNQUOTED(config_opsysfile, "${opsysfile}",
-                    [Define to the used os dependent file.])
+if test -z "No longer used"; then
+  AC_DEFINE(config_opsysfile, [], [Define to the used os dependent file.])
 fi
 
 XMENU_OBJ=
@@ -3837,6 +4011,24 @@ AC_SUBST(CYGWIN_OBJ)
 AC_SUBST(PRE_ALLOC_OBJ)
 AC_SUBST(POST_ALLOC_OBJ)
 
+# Configure gnulib.  Although this does not affect CFLAGS or LIBS permanently.
+# it temporarily reverts them to their pre-pkg-config values,
+# because gnulib needs to work with both src (which uses the
+# pkg-config stuff) and lib-src (which does not).  For example, gnulib
+# may need to determine whether LIB_CLOCK_GETTIME should contain -lrt,
+# and it therefore needs to run in an environment where LIBS does not
+# already contain -lrt merely because 'pkg-config --libs' printed '-lrt'
+# for some package unrelated to lib-src.
+SAVE_CFLAGS=$CFLAGS
+SAVE_LIBS=$LIBS
+CFLAGS=$pre_PKG_CONFIG_CFLAGS
+LIBS="$LIB_PTHREAD $pre_PKG_CONFIG_LIBS"
+gl_ASSERT_NO_GNULIB_POSIXCHECK
+gl_ASSERT_NO_GNULIB_TESTS
+gl_INIT
+CFLAGS=$SAVE_CFLAGS
+LIBS=$SAVE_LIBS
+
 case "$opsys" in
   aix4-2) LD_SWITCH_SYSTEM_TEMACS="-Wl,-bnodelcsect" ;;
 
@@ -4004,98 +4196,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define EMACS_CONFIG_H
 ])dnl
 
-AH_BOTTOM([
-/* On AIX 3 this must be included before any other include file.  */
-#include <alloca.h>
-#if ! HAVE_ALLOCA
-# error "alloca not available on this machine"
-#endif
-
-/* Define AMPERSAND_FULL_NAME if you use the convention
-   that & in the full name stands for the login id.  */
-/* Turned on June 1996 supposing nobody will mind it.  */
-#define AMPERSAND_FULL_NAME
-
-/* `subprocesses' should be defined if you want to
-   have code for asynchronous subprocesses
-   (as used in M-x compile and M-x shell).
-   Only MSDOS does not support this (it overrides
-   this in its config_opsysfile below).  */
-
-#define subprocesses
-
-/* Include the os dependent file.  */
-#ifdef config_opsysfile
-# include config_opsysfile
-#endif
-
-/* Mac OS X / GNUstep need a bit more pure memory.  Of the existing knobs,
-   SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems.  */
-#ifdef HAVE_NS
-#if defined NS_IMPL_GNUSTEP
-#  define SYSTEM_PURESIZE_EXTRA 30000
-#elif defined DARWIN_OS
-#  define SYSTEM_PURESIZE_EXTRA 200000
-#endif
-#endif
-
-#ifdef emacs /* Don't do this for lib-src.  */
-/* Tell regex.c to use a type compatible with Emacs.  */
-#define RE_TRANSLATE_TYPE Lisp_Object
-#define RE_TRANSLATE(TBL, C) CHAR_TABLE_TRANSLATE (TBL, C)
-#ifdef make_number
-/* If make_number is a macro, use it.  */
-#define RE_TRANSLATE_P(TBL) (!EQ (TBL, make_number (0)))
-#else
-/* If make_number is a function, avoid it.  */
-#define RE_TRANSLATE_P(TBL) (!(INTEGERP (TBL) && XINT (TBL) == 0))
-#endif
-#endif
-
-#include <string.h>
-#include <stdlib.h>
-
-#if __GNUC__ >= 3  /* On GCC 3.0 we might get a warning.  */
-#define NO_INLINE __attribute__((noinline))
-#else
-#define NO_INLINE
-#endif
-
-#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1))
-#define EXTERNALLY_VISIBLE __attribute__((externally_visible))
-#else
-#define EXTERNALLY_VISIBLE
-#endif
-
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
-# define ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
-#else
-# define ATTRIBUTE_FORMAT(spec) /* empty */
-#endif
-
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
-# define ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \
-   ATTRIBUTE_FORMAT ((__gnu_printf__, formatstring_parameter, first_argument))
-#else
-# define ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \
-   ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument))
-#endif
-
-#define ATTRIBUTE_CONST _GL_ATTRIBUTE_CONST
-
-/* Some versions of GNU/Linux define noinline in their headers.  */
-#ifdef noinline
-#undef noinline
-#endif
-
-/* These won't be used automatically yet.  We also need to know, at least,
-   that the stack is continuous.  */
-#ifdef __GNUC__
-#  ifndef GC_SETJMP_WORKS
-  /* GC_SETJMP_WORKS is nearly always appropriate for GCC.  */
-#    define GC_SETJMP_WORKS 1
-#  endif
-#endif
+AH_BOTTOM([#include <conf_post.h>
 
 #endif /* EMACS_CONFIG_H */
 
@@ -4111,14 +4212,17 @@ End:
 #### It makes printing result more understandable as using GTK sets
 #### toolkit_scroll_bars to yes by default.
 if test "${HAVE_GTK}" = "yes"; then
-  USE_X_TOOLKIT=GTK
+  if test "${with_gtk3}" = "yes"; then
+    USE_X_TOOLKIT=GTK3
+  else
+    USE_X_TOOLKIT=GTK
+  fi
 fi
 
 echo "
 Configured for \`${canonical}'.
 
   Where should the build process find the source code?    ${srcdir}
-  What operating system file should Emacs use?            ${opsysfile-none}
   What compiler should emacs be built with?               ${CC} ${CFLAGS}
   Should Emacs use the GNU version of malloc?             ${GNU_MALLOC}${GNU_MALLOC_reason}
   Should Emacs use a relocating allocator for buffers?    ${REL_ALLOC}
@@ -4256,7 +4360,7 @@ dnl by configure.  This also explains the `move-if-change' test and
 dnl the use of force in the `epaths-force' rule in Makefile.in.
 AC_CONFIG_COMMANDS([epaths], [
 echo creating src/epaths.h
-${MAKE-make} epaths-force
+${MAKE-make} MAKEFILE_NAME=do-not-make-Makefile epaths-force
 ], [GCC="$GCC" CPPFLAGS="$CPPFLAGS"])
 
 AC_CONFIG_COMMANDS([gdbinit], [