about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2004-02-14 18:50:15 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2004-02-14 18:50:15 +0000
commitd83af1a97e652d4a5cd14cd49251f626d74c7a57 (patch)
treea6767f7e182f81698788bb580d905a2cf2dacc79
parentc3b929c6340834dacf7888a96ce505325c3a85af (diff)
downloadzsh-d83af1a97e652d4a5cd14cd49251f626d74c7a57.tar.gz
zsh-d83af1a97e652d4a5cd14cd49251f626d74c7a57.tar.xz
zsh-d83af1a97e652d4a5cd14cd49251f626d74c7a57.zip
19420: Update configure.ac for better Autconf 2.50 support.
-rw-r--r--ChangeLog5
-rw-r--r--Config/config.mk4
-rw-r--r--Makefile.in10
-rw-r--r--Src/Modules/system.mdd4
-rw-r--r--Src/mkmakemod.sh16
-rw-r--r--acconfig.h369
-rw-r--r--aczsh.m420
-rw-r--r--configure.ac319
8 files changed, 297 insertions, 450 deletions
diff --git a/ChangeLog b/ChangeLog
index bb980eebb..38c84f705 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-02-14  Peter Stephenson  <pws@pwstephenson.fsnet.co.uk>
+
+	* 19420: acconfig.h, aczsh.m4, configure.ac, Makefile.in,
+	Config/config.mk, Src/mkmakemod.sh, Src/Modules/system.mdd
+
 2004-02-13  Oliver Kiddle  <opk@zsh.org>
 
 	* 19418: Completion/Linux/Command/_modutils,
diff --git a/Config/config.mk b/Config/config.mk
index 476ced11d..fd9abf6ad 100644
--- a/Config/config.mk
+++ b/Config/config.mk
@@ -35,8 +35,8 @@ $(dir_top)/Config/defs.mk $(dir_top)/Config/version.mk
 
 Makefile: Makefile.in $(dir_top)/config.status $(CONFIG_INCS)
 	cd $(dir_top) && \
-	  CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+	  $(SHELL) ./config.status `echo $(subdir)/$@ | sed 's%^./%%'`
 
 $(dir_top)/Config/defs.mk: $(sdir_top)/Config/defs.mk.in $(dir_top)/config.status
 	cd $(dir_top) && \
-	  CONFIG_FILES=Config/defs.mk CONFIG_HEADERS= $(SHELL) ./config.status
+	  $(SHELL) ./config.status Config/defs.mk
diff --git a/Makefile.in b/Makefile.in
index b0a021be6..dcb04e8ac 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -117,7 +117,7 @@ check test:
 @CLEAN_MK@
 
 distclean-here:
-	rm -f Makefile config.h config.status config.log config.cache config.modules stamp-h Config/defs.mk
+	rm -f Makefile config.h config.status config.log config.cache config.modules config.modules.sh stamp-h Config/defs.mk
 
 realclean-here:
 	cd $(sdir) && rm -f config.h.in stamp-h.in configure
@@ -134,13 +134,11 @@ config.status: $(sdir)/configure
 $(sdir)/configure: $(sdir)/aclocal.m4 $(sdir)/aczsh.m4 $(sdir)/configure.ac
 	cd $(sdir) && autoconf
 
-config.h: stamp-h
-stamp-h: $(sdir)/config.h.in config.status
-	cd $(dir_top) && \
-	  CONFIG_FILES= CONFIG_HEADERS=$(subdir)/config.h $(SHELL) ./config.status
+config.h config.modules: $(sdir)/config.h.in config.status
+	cd $(dir_top) && $(SHELL) ./config.status $@
 
 $(sdir)/config.h.in: $(sdir)/stamp-h.in
-$(sdir)/stamp-h.in: $(sdir)/configure.ac $(sdir)/acconfig.h \
+$(sdir)/stamp-h.in: $(sdir)/configure.ac \
 		$(sdir)/aclocal.m4 $(sdir)/aczsh.m4
 	cd $(sdir) && autoheader
 	echo > $(sdir)/stamp-h.in
diff --git a/Src/Modules/system.mdd b/Src/Modules/system.mdd
index 61950994a..51e96a46f 100644
--- a/Src/Modules/system.mdd
+++ b/Src/Modules/system.mdd
@@ -23,5 +23,9 @@ errnames.c: errnames1.awk errnames2.awk $(dir_top)/config.h @ERRNO_H@
 
 errcount.h: errnames.c
 	grep 'define.*ERRCOUNT' errnames.c > $@
+
+clean-here: clean.system
+clean.system:
+	rm -f errcount.h errnames.c
 Make
 
diff --git a/Src/mkmakemod.sh b/Src/mkmakemod.sh
index 7ecd25e26..38c5e72e1 100644
--- a/Src/mkmakemod.sh
+++ b/Src/mkmakemod.sh
@@ -466,21 +466,11 @@ if $first_stage; then
 fi
 
 if $second_stage ; then
-    if grep 'Hack for autoconf-2.13' ./config.status > /dev/null 2>&1 ; then
-        bang=\!
-    else
-	bang=
-    fi
-
     trap "rm -f $the_subdir/${the_makefile}" 1 2 15
 
-    # The standard config.status requires the pathname for the .in file to
-    # be relative to the top of the source tree.  As we have it in the build
-    # tree, this is a problem.  zsh's configure script edits config.status,
-    # adding the feature that an input filename starting with "!" has the
-    # "!" removed and is not mangled further.
-    CONFIG_FILES=$the_subdir/${the_makefile}:$bang$the_subdir/${the_makefile}.in CONFIG_HEADERS= ${CONFIG_SHELL-/bin/sh} ./config.status
-
+    ${CONFIG_SHELL-/bin/sh} ./config.status \
+	--file=$the_subdir/${the_makefile}:$the_subdir/${the_makefile}.in ||
+    return 1
 fi
 
 exit 0
diff --git a/acconfig.h b/acconfig.h
deleted file mode 100644
index 7d6f9187c..000000000
--- a/acconfig.h
+++ /dev/null
@@ -1,369 +0,0 @@
-
-/***** begin user configuration section *****/
-
-/* Define this to be the location of your password file */
-#define PASSWD_FILE "/etc/passwd"
-
-/* Define this to be the name of your NIS/YP password *
- * map (if applicable)                                */
-#define PASSWD_MAP "passwd.byname"
-
-/* Define to 1 if you want user names to be cached */
-#define CACHE_USERNAMES 1
-
-/* Define to 1 if system supports job control */
-#define JOB_CONTROL 1
-
-/* Define this if you use "suspended" instead of "stopped" */
-#define USE_SUSPENDED 1
- 
-/* The default history buffer size in lines */
-#define DEFAULT_HISTSIZE 30
-
-/* The default editor for the fc builtin */
-#define DEFAULT_FCEDIT "vi"
-
-/* The default prefix for temporary files */
-#define DEFAULT_TMPPREFIX "/tmp/zsh"
-
-
-/***** end of user configuration section            *****/
-/***** shouldn't have to change anything below here *****/
-@TOP@
-
-/* The global file to source absolutely first whenever zsh is run; *
- * if undefined, don't source anything                             */
-#undef GLOBAL_ZSHENV
-
-/* The global file to source whenever zsh is run; *
- * if undefined, don't source anything            */
-#undef GLOBAL_ZSHRC
-
-/* The global file to source whenever zsh is run as a login shell; *
- * if undefined, don't source anything                             */
-#undef GLOBAL_ZLOGIN
-
-/* The global file to source whenever zsh is run as a login shell, *
- * before zshrc is read; if undefined, don't source anything       */
-#undef GLOBAL_ZPROFILE
-
-/* The global file to source whenever zsh was run as a login shell.  *
- * This is sourced right before exiting.  If undefined, don't source *
- * anything                                                          */
-#undef GLOBAL_ZLOGOUT
-
-/* The default path; used when running commands with command -p */
-#undef DEFAULT_PATH
-
-/* Define to 1 if compiler could initialise a union */
-#undef HAVE_UNION_INIT
-
-/* Define to 1 if compiler incorrectly cast signed to unsigned */
-#undef BROKEN_SIGNED_TO_UNSIGNED_CASTING
-
-/* Define to 1 if compiler supports variable-length arrays */
-#undef HAVE_VARIABLE_LENGTH_ARRAYS
-
-/* Define if your system defines TIOCGWINSZ in sys/ioctl.h.  */
-#undef GWINSZ_IN_SYS_IOCTL
-
-/* Define to 1 if you have NIS */
-#undef HAVE_NIS
-
-/* Define to 1 if you have NISPLUS */
-#undef HAVE_NIS_PLUS
-
-/* Define to 1 if you have RFS superroot directory. */
-#undef HAVE_SUPERROOT
-
-/* Define to 1 if you need to use the native getcwd */
-#undef USE_GETCWD
-
-/* Define to the path of the /dev/fd filesystem */
-#undef PATH_DEV_FD
-
-/* Define if sys/time.h and sys/select.h cannot be both included */
-#undef TIME_H_SELECT_H_CONFLICTS
-
-/* Define to be the machine type (microprocessor class or machine model) */
-#undef MACHTYPE
-
-/* Define to be the name of the operating system */
-#undef OSTYPE
-
-/* Define to 1 if ANSI function prototypes are usable.  */
-#undef PROTOTYPES
-
-/* Define to be location of utmp file. */
-#undef PATH_UTMP_FILE
-
-/* Define to be location of utmpx file. */
-#undef PATH_UTMPX_FILE
-
-/* Define to be location of wtmp file. */
-#undef PATH_WTMP_FILE
-
-/* Define to be location of wtmpx file. */
-#undef PATH_WTMPX_FILE
-
-/* Define to 1 if struct utmp is defined by a system header */
-#undef HAVE_STRUCT_UTMP
-
-/* Define to 1 if struct utmpx is defined by a system header */
-#undef HAVE_STRUCT_UTMPX
-
-/* Define if your system's struct utmp has a member named ut_host.  */
-#undef HAVE_STRUCT_UTMP_UT_HOST
-
-/* Define if your system's struct utmpx has a member named ut_host.  */
-#undef HAVE_STRUCT_UTMPX_UT_HOST
-
-/* Define if your system's struct utmpx has a member named ut_xtime.  */
-#undef HAVE_STRUCT_UTMPX_UT_XTIME
-
-/* Define if your system's struct utmpx has a member named ut_tv.  */
-#undef HAVE_STRUCT_UTMPX_UT_TV
-
-/* Define if your system's struct dirent has a member named d_ino.  */
-#undef HAVE_STRUCT_DIRENT_D_INO
-
-/* Define if your system's struct dirent has a member named d_stat.  */
-#undef HAVE_STRUCT_DIRENT_D_STAT
-
-/* Define if your system's struct direct has a member named d_ino.  */
-#undef HAVE_STRUCT_DIRECT_D_INO
-
-/* Define if your system's struct direct has a member named d_stat.  */
-#undef HAVE_STRUCT_DIRECT_D_STAT
-
-/* Define if your system's struct sockaddr_in6 has a member named sin6_scope_id.  */
-#undef HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID
-
-/* Define to be a string corresponding the vendor of the machine */
-#undef VENDOR
-
-/* Define if your system defines `struct winsize' in sys/ptem.h.  */
-#undef WINSIZE_IN_PTEM
-
-/* Define to 1 if you want to debug zsh */
-#undef DEBUG
-
-/* Define to 1 if you want to use zsh's own memory allocation routines */
-#undef ZSH_MEM
-
-/* Define to 1 if you want to debug zsh memory allocation routines */
-#undef ZSH_MEM_DEBUG
-
-/* Define to 1 if you want to turn on warnings of memory allocation errors */
-#undef ZSH_MEM_WARNING
-
-/* Define to 1 if you want to turn on memory checking for free() */
-#undef ZSH_SECURE_FREE
-
-/* Define to 1 if you want to get debugging information on internal *
- * hash tables.  This turns on the `hashinfo' builtin.              */
-#undef ZSH_HASH_DEBUG
-
-/* Undefine this if you don't want to get a restricted shell *
- * when zsh is exec'd with basename that starts with r.      *
- * By default this is defined.                               */
-#undef RESTRICTED_R
-
-/* Define for Maildir support */
-#undef MAILDIR_SUPPORT
-
-/* Define for function depth limits */
-#undef MAX_FUNCTION_DEPTH
-
-/* Define if you want locale features.  By default this is defined. */
-#undef CONFIG_LOCALE
-
-/* Define to 1 if your termcap library has the ospeed variable */
-#undef HAVE_OSPEED
-/* Define to 1 if you have ospeed, but it is not defined in termcap.h */
-#undef MUST_DEFINE_OSPEED
-
-/* Define to 1 if tgetent() accepts NULL as a buffer */
-#undef TGETENT_ACCEPTS_NULL
-
-/* Define to what tgetent() returns on success (0 on HP-UX X/Open curses) */
-#define TGETENT_SUCCESS 1
-
-/* Define to 1 if you use POSIX style signal handling */
-#undef POSIX_SIGNALS
-
-/* Define to 1 if you use BSD style signal handling (and can block signals) */
-#undef BSD_SIGNALS
-
-/* Define to 1 if you use SYS style signal handling (and can block signals) */
-#undef SYSV_SIGNALS
-
-/* Define to 1 if you have no signal blocking at all (bummer) */
-#undef NO_SIGNAL_BLOCKING
-
-/* Define to `unsigned int' if <sys/types.h> or <signal.h> doesn't define */
-#undef sigset_t
-
-/* Define to 1 if struct timezone is defined by a system header */
-#undef HAVE_STRUCT_TIMEZONE
-
-/* Define to 1 if there is a prototype defined for brk() on your system */
-#undef HAVE_BRK_PROTO
-
-/* Define to 1 if there is a prototype defined for sbrk() on your system */
-#undef HAVE_SBRK_PROTO
-
-/* Define to 1 if there is a prototype defined for ioctl() on your system */
-#undef HAVE_IOCTL_PROTO
-
-/* Define to 1 if there is a prototype defined for mknod() on your system */
-#undef HAVE_MKNOD_PROTO
-
-/* Define to 1 if select() is defined in <sys/socket.h>, ie BeOS R4.51*/
-#undef SELECT_IN_SYS_SOCKET_H
-
-/* Define to 1 if system has working FIFO's */
-#undef HAVE_FIFOS
-
-/* Define to 1 if struct rlimit uses quad_t */
-#undef RLIM_T_IS_QUAD_T
-
-/* Define to 1 if struct rlimit uses long long */
-#undef RLIM_T_IS_LONG_LONG
-
-/* Define to 1 if rlimit uses unsigned */
-#undef RLIM_T_IS_UNSIGNED
-
-/* Define to the type used in struct rlimit */
-#undef rlim_t
-
-/* Define to 1 if RLIMIT_AIO_MEM is present (whether or not as a macro) */
-#undef HAVE_RLIMIT_AIO_MEM
-
-/* Define to 1 if RLIMIT_AIO_OPS is present (whether or not as a macro) */
-#undef HAVE_RLIMIT_AIO_OPS
-
-/* Define to 1 if RLIMIT_AS is present (whether or not as a macro) */
-#undef HAVE_RLIMIT_AS
-
-/* Define to 1 if RLIMIT_LOCKS is present (whether or not as a macro) */
-#undef HAVE_RLIMIT_LOCKS
-
-/* Define to 1 if RLIMIT_MEMLOCK is present (whether or not as a macro) */
-#undef HAVE_RLIMIT_MEMLOCK
-
-/* Define to 1 if RLIMIT_NPROC is present (whether or not as a macro) */
-#undef HAVE_RLIMIT_NPROC
-
-/* Define to 1 if RLIMIT_NOFILE is present (whether or not as a macro) */
-#undef HAVE_RLIMIT_NOFILE
-
-/* Define to 1 if RLIMIT_PTHREAD is present (whether or not as a macro) */
-#undef HAVE_RLIMIT_PTHREAD
-
-/* Define to 1 if RLIMIT_RSS is present (whether or not as a macro) */
-#undef HAVE_RLIMIT_RSS
-
-/* Define to 1 if RLIMIT_SBSIZE is present (whether or not as a macro) */
-#undef HAVE_RLIMIT_SBSIZE
-
-/* Define to 1 if RLIMIT_TCACHE is present (whether or not as a macro) */
-#undef HAVE_RLIMIT_TCACHE
-
-/* Define to 1 if RLIMIT_VMEM is present (whether or not as a macro) */
-#undef HAVE_RLIMIT_VMEM
-
-/* Define to 1 if RLIMIT_VMEM and RLIMIT_RSS both exist and are equal */
-#undef RLIMIT_VMEM_IS_RSS
-
-/* Define to 1 if RLIMIT_VMEM and RLIMIT_AS both exist and are equal */
-#undef RLIMIT_VMEM_IS_AS
-
-/* Define to 1 if /bin/sh does not interpret \ escape sequences */
-#undef SH_USE_BSD_ECHO
-
-/* Define to 1 if system has working link() */
-#undef HAVE_LINK
-
-/* Define to 1 if kill(pid, 0) doesn't return ESRCH, ie BeOS R4.51 */
-#undef BROKEN_KILL_ESRCH
-
-/* Define to 1 if sigsuspend() is broken, ie BeOS R4.51 */
-#undef BROKEN_POSIX_SIGSUSPEND
-
-/* Define to 1 if getpwnam() is faked, ie BeOS R4.51 */
-#undef GETPWNAM_FAKED
-
-/* Define to 1 if tcsetpgrp() doesn't work, ie BeOS R4.51 */
-#undef BROKEN_TCSETPGRP
-
-/* Define to 1 if an underscore has to be prepended to dlsym() argument */
-#undef DLSYM_NEEDS_UNDERSCORE
-
-/* Define to 1 if multiple modules defining the same symbol are OK */
-#undef DYNAMIC_NAME_CLASH_OK
-
-/* The extension used for dynamically loaded modules */
-#undef DL_EXT
-
-/* Define to 1 if you want to use dynamically loaded modules */
-#undef DYNAMIC
-
-/* Define to 1 if you want to use dynamically loaded modules on AIX */
-#undef AIXDYNAMIC
-
-/* Define to 1 if you want to use dynamically loaded modules on HPUX 10 */
-#undef HPUXDYNAMIC
-
-/* Define to `unsigned long' if <sys/types.h> doesn't define. */
-#undef ino_t
-
-/*
- * Definitions used when a long is less than eight byte, to try to
- * provide some support for eight byte operations.
- *
- * Note that ZSH_64_BIT_TYPE, OFF_T_IS_64_BIT, INO_T_IS_64_BIT do *not* get
- * defined if long is already 64 bits, since in that case no special handling
- * is required.
- */
-/* Define to 1 if long is 64 bits */
-#undef LONG_IS_64_BIT
-
-/* Define to a 64 bit integer type if there is one, but long is shorter */
-#undef ZSH_64_BIT_TYPE
-
-/* Define to an unsigned variant of ZSH_64_BIT_TYPE if that is defined */
-#undef ZSH_64_BIT_UTYPE
-
-/* Define to 1 if off_t is 64 bit (for large file support) */
-#undef OFF_T_IS_64_BIT
-
-/* Define to 1 if ino_t is 64 bit (for large file support) */
-#undef INO_T_IS_64_BIT
-
-/* Define to 1 if h_errno is not defined by the system */
-#undef USE_LOCAL_H_ERRNO
-
-/* Define if you have the termcap boolcodes symbol.  */
-#undef HAVE_BOOLCODES
-
-/* Define if you have the termcap numcodes symbol.  */
-#undef HAVE_NUMCODES
-
-/* Define if you have the termcap strcodes symbol.  */
-#undef HAVE_STRCODES
-
-/* Define if you have the terminfo boolnames symbol.  */
-#undef HAVE_BOOLNAMES
-
-/* Define if you have the terminfo numnames symbol.  */
-#undef HAVE_NUMNAMES
-
-/* Define if you have the terminfo strnames symbol.  */
-#undef HAVE_STRNAMES
-
-/* Define if term.h chokes without curses.h */
-#undef TERM_H_NEEDS_CURSES_H
-
-/* Define to the base type of the third argument of accept */
-#undef SOCKLEN_T
diff --git a/aczsh.m4 b/aczsh.m4
index b59001b51..5dd85fba9 100644
--- a/aczsh.m4
+++ b/aczsh.m4
@@ -594,8 +594,11 @@ AC_DEFUN(zsh_PATH_UTMP,
   zsh_cv_path_$1=no
 done
 ])
+AH_TEMPLATE([PATH_]translit($1, [a-z], [A-Z])[_FILE],
+[Define to be location of ]$1[ file.])
 if test $zsh_cv_path_$1 != no; then
-  AC_DEFINE_UNQUOTED(PATH_[]translit($1, [a-z], [A-Z])[]_FILE, "$zsh_cv_path_$1")
+  AC_DEFINE_UNQUOTED([PATH_]translit($1, [a-z], [A-Z])[_FILE],
+  "$zsh_cv_path_$1")
 fi
 ])
 
@@ -610,8 +613,10 @@ AC_DEFUN(zsh_TYPE_EXISTS,
 [zsh_cv_type_exists_[]translit($2, [ ], [_])=yes],
 [zsh_cv_type_exists_[]translit($2, [ ], [_])=no])
 ])
+AH_TEMPLATE([HAVE_]translit($2, [ a-z], [_A-Z]),
+[Define to 1 if ]$2[ is defined by a system header])
 if test $zsh_cv_type_exists_[]translit($2, [ ], [_]) = yes; then
-  AC_DEFINE(HAVE_[]translit($2, [ a-z], [_A-Z]))
+  AC_DEFINE([HAVE_]translit($2, [ a-z], [_A-Z]))
 fi
 ])
 
@@ -627,8 +632,10 @@ AC_DEFUN(zsh_STRUCT_MEMBER,
 [zsh_cv_struct_member_[]translit($2, [ ], [_])_$3=yes],
 [zsh_cv_struct_member_[]translit($2, [ ], [_])_$3=no])
 ])
+AH_TEMPLATE([HAVE_]translit($2_$3, [ a-z], [_A-Z]),
+[Define if your system's ]$2[ has a member named ]$3[.])
 if test $zsh_cv_struct_member_[]translit($2, [ ], [_])_$3 = yes; then
-  AC_DEFINE(HAVE_[]translit($2_$3, [ a-z], [_A-Z]))
+  AC_DEFINE([HAVE_]translit($2_$3, [ a-z], [_A-Z]))
 fi
 ])
 
@@ -707,12 +714,15 @@ AC_DEFUN([zsh_CHECK_SOCKLEN_T],[
       zsh_cv_type_socklen_t=int
     fi]
   )
-  AC_DEFINE_UNQUOTED([SOCKLEN_T], [$zsh_cv_type_socklen_t])]
+  AC_DEFINE_UNQUOTED([SOCKLEN_T], [$zsh_cv_type_socklen_t],
+  [Define to the base type of the third argument of accept])]
 )
 
 dnl Check for limit $1 e.g. RLIMIT_RSS.
 AC_DEFUN(zsh_LIMIT_PRESENT,
-[AC_CACHE_CHECK([for limit $1],
+[AH_TEMPLATE([HAVE_]$1,
+[Define to 1 if ]$1[ is present (whether or not as a macro).])
+AC_CACHE_CHECK([for limit $1],
 zsh_cv_have_$1,
 [AC_TRY_COMPILE([
 #include <sys/types.h>
diff --git a/configure.ac b/configure.ac
index d2ac27ff7..71d2fcb99 100644
--- a/configure.ac
+++ b/configure.ac
@@ -39,9 +39,12 @@ dnl ----------------------------------------------
 dnl Find out machine type, vendor, and operating system
 dnl What type of host is this?
 AC_CANONICAL_HOST
-AC_DEFINE_UNQUOTED(MACHTYPE, "$host_cpu")
-AC_DEFINE_UNQUOTED(VENDOR,   "$host_vendor")
-AC_DEFINE_UNQUOTED(OSTYPE,   "$host_os")
+AC_DEFINE_UNQUOTED(MACHTYPE, "$host_cpu",
+[Define to be the machine type (microprocessor class or machine model).])
+AC_DEFINE_UNQUOTED(VENDOR,   "$host_vendor",
+[Define to be a string corresponding the vendor of the machine.])
+AC_DEFINE_UNQUOTED(OSTYPE,   "$host_os",
+[Define to be the name of the operating system.])
 
 dnl -----------------------------
 dnl CHECKING COMMAND LINE OPTIONS
@@ -54,6 +57,8 @@ zsh_COMPILE_FLAGS($CPPFLAGS, $CFLAGS, $LDFLAGS, $LIBS)
 
 dnl Do you want to debug zsh?
 ifdef([zsh-debug],[undefine([zsh-debug])])dnl
+AH_TEMPLATE([DEBUG],
+[Define to 1 if you want to debug zsh.])
 AC_ARG_ENABLE(zsh-debug,
 [  --enable-zsh-debug         compile with debug code and debugger symbols],
 [if test x$enableval = xyes; then
@@ -62,6 +67,8 @@ fi])
 
 dnl Do you want zsh memory allocation routines.
 ifdef([zsh-mem],[undefine([zsh-mem])])dnl
+AH_TEMPLATE([ZSH_MEM],
+[Define to 1 if you want to use zsh's own memory allocation routines])
 AC_ARG_ENABLE(zsh-mem,
 [  --enable-zsh-mem           compile with zsh memory allocation routines],
 [if test x$enableval = xyes; then
@@ -70,6 +77,8 @@ fi])
 
 dnl Do you want to debug zsh memory allocation routines.
 ifdef([zsh-mem-debug],[undefine([zsh-mem-debug])])dnl
+AH_TEMPLATE([ZSH_MEM_DEBUG],
+[Define to 1 if you want to debug zsh memory allocation routines.])
 AC_ARG_ENABLE(zsh-mem-debug,
 [  --enable-zsh-mem-debug     debug zsh memory allocation routines],
 [if test x$enableval = xyes; then
@@ -77,6 +86,8 @@ AC_ARG_ENABLE(zsh-mem-debug,
 fi])
 
 dnl Do you want to print warnings when errors in memory allocation.
+AH_TEMPLATE([ZSH_MEM_WARNING],
+[Define to 1 if you want to turn on warnings of memory allocation errors])
 ifdef([zsh-mem-warning],[undefine([zsh-mem-warning])])dnl
 AC_ARG_ENABLE(zsh-mem-warning,
 [  --enable-zsh-mem-warning   print warnings for errors in memory allocation],
@@ -86,6 +97,8 @@ fi])
 
 dnl Do you want to turn on error checking for free().
 ifdef([zsh-secure-free],[undefine([zsh-secure-free])])dnl
+AH_TEMPLATE([ZSH_SECURE_FREE],
+[Define to 1 if you want to turn on memory checking for free().])
 AC_ARG_ENABLE(zsh-secure-free,
 [  --enable-zsh-secure-free   turn on error checking for free()],
 [if test x$enableval = xyes; then
@@ -95,6 +108,9 @@ fi])
 dnl Do you want debugging information on internal hash tables.
 dnl This turns on the `hashinfo' builtin command.
 ifdef([zsh-hash-debug],[undefine([zsh-hash-debug])])dnl
+AH_TEMPLATE([ZSH_HASH_DEBUG],
+[Define to 1 if you want to get debugging information on internal
+ hash tables.  This turns on the `hashinfo' builtin.])
 AC_ARG_ENABLE(zsh-hash-debug,
 [  --enable-zsh-hash-debug    turn on debugging of internal hash tables],
 [if test x$enableval = xyes; then
@@ -116,6 +132,9 @@ AC_ARG_ENABLE(zshenv,
 else
   zshenv="$etcdir/zshenv"
 fi])
+AH_TEMPLATE([GLOBAL_ZSHENV],
+[The global file to source absolutely first whenever zsh is run;
+ if undefined, don't source anything.])
 if test "x$zshenv" != xno; then
   AC_DEFINE_UNQUOTED(GLOBAL_ZSHENV, "$zshenv")
 fi
@@ -129,6 +148,9 @@ AC_ARG_ENABLE(zshrc,
 else
   zshrc="$etcdir/zshrc"
 fi])
+AH_TEMPLATE([GLOBAL_ZSHRC],
+[The global file to source whenever zsh is run;
+ if undefined, don't source anything])
 if test "x$zshrc" != xno; then
   AC_DEFINE_UNQUOTED(GLOBAL_ZSHRC, "$zshrc")
 fi
@@ -142,6 +164,9 @@ AC_ARG_ENABLE(zprofile,
 else
   zprofile="$etcdir/zprofile"
 fi])
+AH_TEMPLATE([GLOBAL_ZPROFILE],
+[The global file to source whenever zsh is run as a login shell,
+ before zshrc is read; if undefined, don't source anything.])
 if test "x$zprofile" != xno; then
   AC_DEFINE_UNQUOTED(GLOBAL_ZPROFILE, "$zprofile")
 fi
@@ -155,6 +180,9 @@ AC_ARG_ENABLE(zlogin,
 else
   zlogin="$etcdir/zlogin"
 fi])
+AH_TEMPLATE([GLOBAL_ZLOGIN],
+[The global file to source whenever zsh is run as a login shell;
+ if undefined, don't source anything])
 if test "x$zlogin" != xno; then
   AC_DEFINE_UNQUOTED(GLOBAL_ZLOGIN, "$zlogin")
 fi
@@ -168,6 +196,10 @@ AC_ARG_ENABLE(zlogout,
 else
   zlogout="$etcdir/zlogout"
 fi])
+AH_TEMPLATE([GLOBAL_ZLOGOUT],
+[The global file to source whenever zsh was run as a login shell.
+ This is sourced right before exiting.  If undefined, don't source
+ anything.])
 if test "x$zlogout" != xno; then
   AC_DEFINE_UNQUOTED(GLOBAL_ZLOGOUT, "$zlogout")
 fi
@@ -192,6 +224,10 @@ AC_ARG_ENABLE(dynamic,
 
 dnl Do you want to disable restricted on r* commands
 ifdef([restricted-r],[undefine([restricted-r])])dnl
+AH_TEMPLATE([RESTRICTED_R],
+[Undefine this if you don't want to get a restricted shell
+ when zsh is exec'd with basename that starts with r.
+ By default this is defined.])
 AC_ARG_ENABLE(restricted-r,
 [  --disable-restricted-r     turn off r* invocation for restricted shell],
 [if test x$enableval = xyes; then
@@ -201,6 +237,8 @@ AC_DEFINE(RESTRICTED_R)
 )
 
 dnl Do you want to disable use of locale functions
+AH_TEMPLATE([CONFIG_LOCALE],
+[Undefine if you don't want local features.  By default this is defined.])
 AC_ARG_ENABLE([locale],
 [  --disable-locale           turn off locale features],
 [if test x$enableval = xyes; then
@@ -250,6 +288,8 @@ AC_SUBST(FUNCTIONS_SUBDIRS)dnl
 
 dnl Do you want maildir support?
 ifdef([maildir_support],[undefine([maildir_support])])dnl
+AH_TEMPLATE([MAILDIR_SUPPORT],
+[Define for Maildir support])
 AC_ARG_ENABLE(maildir-support,
 [  --enable-maildir-support   enable maildir support in MAIL and MAILPATH],
 [if test x$enableval = xyes; then
@@ -258,6 +298,8 @@ fi])
 
 dnl Do you want to set a maximum function depth?
 ifdef([max_function_depth],[undefine([max_function_depth])])dnl
+AH_TEMPLATE([MAX_FUNCTION_DEPTH],
+[Define for function depth limits])
 AC_ARG_ENABLE(max-function-depth,
 [  --enable-max-function-depth=MAX   limit function depth to MAX],
 [if test x$enableval = xyes; then
@@ -360,10 +402,6 @@ AC_PROG_CPP                 dnl Figure out how to run C preprocessor.
 AC_PROG_GCC_TRADITIONAL     dnl Do we need -traditional flag for gcc.
 AC_C_CONST                  dnl Does compiler support `const'.
 
-AC_CYGWIN                   dnl Check for cygwin environment
-
-AC_EXEEXT                   dnl Check for executable extension, e.g. .exe
-
 fp_PROG_CC_STDC
 AC_MSG_CHECKING([whether to use prototypes])
 if test ."$ansi2knr" = .yes || test ."$ansi2knr" = .no; then
@@ -376,6 +414,8 @@ else
     ansi2knr=no
   fi
 fi
+AH_TEMPLATE([PROTOTYPES],
+[Define to 1 if ANSI function prototypes are usable.])
 if test "$ansi2knr" = yes; then
   AC_MSG_RESULT(${msg}no)
   U=_
@@ -394,6 +434,8 @@ zsh_cv_c_have_union_init,
 [AC_TRY_COMPILE([union{void *p;long l;}u={0};], [u.l=1;],
   zsh_cv_c_have_union_init=yes,
   zsh_cv_c_have_union_init=no)])
+AH_TEMPLATE([HAVE_UNION_INIT],
+[Define to 1 if the compiler can initialise a union.])
 if test $zsh_cv_c_have_union_init = yes; then
   AC_DEFINE(HAVE_UNION_INIT)
 fi
@@ -405,6 +447,8 @@ zsh_cv_c_broken_signed_to_unsigned_casting,
   zsh_cv_c_broken_signed_to_unsigned_casting=yes,
   zsh_cv_c_broken_signed_to_unsigned_casting=no,
   zsh_cv_c_broken_signed_to_unsigned_casting=no)])
+AH_TEMPLATE([BROKEN_SIGNED_TO_UNSIGNED_CASTING],
+[Define to 1 if compiler incorrectly cast signed to unsigned.])
 if test $zsh_cv_c_broken_signed_to_unsigned_casting = yes; then
   AC_DEFINE(BROKEN_SIGNED_TO_UNSIGNED_CASTING)
 fi
@@ -415,6 +459,8 @@ zsh_cv_c_variable_length_arrays,
 [AC_TRY_COMPILE([int foo(), n;], [int i[foo()], a[n+1];],
   zsh_cv_c_variable_length_arrays=yes,
   zsh_cv_c_variable_length_arrays=no)])
+AH_TEMPLATE([HAVE_VARIABLE_LENGTH_ARRAYS],
+[Define to 1 if compiler supports variable-length arrays])
 if test $zsh_cv_c_variable_length_arrays = yes; then
   AC_DEFINE(HAVE_VARIABLE_LENGTH_ARRAYS)
 fi
@@ -466,6 +512,8 @@ if test $dynamic = yes; then
 fi
 
 dnl Some SCO systems cannot include both sys/time.h and sys/select.h
+AH_TEMPLATE([TIME_H_SELECT_H_CONFLICTS],
+[Define if sys/time.h and sys/select.h cannot be both included.])
 if test $ac_cv_header_sys_time_h = yes && test $ac_cv_header_sys_select_h = yes; then
   AC_CACHE_CHECK(for conflicts in sys/time.h and sys/select.h,
   zsh_cv_header_time_h_select_h_conflicts,
@@ -498,6 +546,8 @@ else
   zsh_cv_header_termios_h_tiocgwinsz=no
 fi
  
+AH_TEMPLATE([GWINSZ_IN_SYS_IOCTL],
+[Define if your system defines TIOCGWINSZ in sys/ioctl.h.])
 if test $zsh_cv_header_termios_h_tiocgwinsz = no; then
   AC_CACHE_CHECK(TIOCGWINSZ in sys/ioctl.h,
   zsh_cv_header_sys_ioctl_h_tiocgwinsz,
@@ -511,6 +561,8 @@ if test $zsh_cv_header_termios_h_tiocgwinsz = no; then
   fi
 fi
  
+AH_TEMPLATE([WINSIZE_IN_PTEM],
+[Define if your system defines `struct winsize' in sys/ptem.h.])
 AC_CHECK_HEADER([sys/ptem.h], AC_DEFINE(WINSIZE_IN_PTEM))
 
 dnl -------------------
@@ -543,6 +595,20 @@ fi],
   *)             termcap_curses_order="tinfo termcap curses ncurses" ;;
 esac])dnl
 
+AH_TEMPLATE([HAVE_BOOLCODES],
+[Define if you have the termcap boolcodes symbol.])
+AH_TEMPLATE([HAVE_NUMCODES],
+[Define if you have the termcap numcodes symbol.])
+AH_TEMPLATE([HAVE_STRCODES],
+[Define if you have the termcap strcodes symbol.])
+AH_TEMPLATE([HAVE_BOOLNAMES],
+[Define if you have the terminfo boolnames symbol.])
+AH_TEMPLATE([HAVE_NUMNAMES],
+[Define if you have the terminfo numnames symbol.])
+AH_TEMPLATE([HAVE_STRNAMES],
+[Define if you have the terminfo strnames symbol.])
+AH_TEMPLATE([TERM_H_NEEDS_CURSES_H],
+[Define if term.h chokes without curses.h.])
 AC_SEARCH_LIBS(tgetent, [$termcap_curses_order])
 case "$LIBS" in
 *curses*)
@@ -658,6 +724,10 @@ if test $zsh_cv_decl_ospeed_include_defines = no; then
   zsh_cv_decl_ospeed_must_define=no)])
 fi
 
+AH_TEMPLATE([HAVE_OSPEED],
+[Define to 1 if your termcap library has the ospeed variable])
+AH_TEMPLATE([MUST_DEFINE_OSPEED],
+[Define to 1 if you have ospeed, but it is not defined in termcap.h])
 if test $zsh_cv_decl_ospeed_include_defines = yes; then
   AC_DEFINE(HAVE_OSPEED)
 elif test $zsh_cv_decl_ospeed_must_define = yes; then
@@ -688,6 +758,25 @@ zsh_cv_long_is_64_bit=yes,
 zsh_cv_long_is_64_bit=no,
 zsh_cv_long_is_64_bit=no)])
 
+AH_TEMPLATE([ino_t],
+[Define to `unsigned long' if <sys/types.h> doesn't define.])
+AH_TEMPLATE([LONG_IS_64_BIT],
+[Definitions used when a long is less than eight byte, to try to
+ provide some support for eight byte operations.
+
+ Note that ZSH_64_BIT_TYPE, OFF_T_IS_64_BIT, INO_T_IS_64_BIT do *not* get
+ defined if long is already 64 bits, since in that case no special handling
+ is required.
+
+ Define to 1 if long is 64 bits])
+AH_TEMPLATE([ZSH_64_BIT_TYPE],
+[Define to a 64 bit integer type if there is one, but long is shorter.])
+AH_TEMPLATE([ZSH_64_BIT_UTYPE],
+[Define to an unsigned variant of ZSH_64_BIT_TYPE if that is defined.])
+AH_TEMPLATE([OFF_T_IS_64_BIT],
+[Define to 1 if off_t is 64 bit (for large file support)])
+AH_TEMPLATE([INO_T_IS_64_BIT],
+[Define to 1 if ino_t is 64 bit (for large file support).])
 if test $zsh_cv_long_is_64_bit = yes; then
   AC_DEFINE(LONG_IS_64_BIT)
 else
@@ -765,6 +854,8 @@ AC_CACHE_CHECK(for sigset_t, zsh_cv_type_sigset_t,
 [#include <sys/types.h>
 #include <signal.h>], [sigset_t tempsigset;],
   zsh_cv_type_sigset_t=yes, zsh_cv_type_sigset_t=no)])
+AH_TEMPLATE([sigset_t],
+[Define to `unsigned int' if <sys/types.h> or <signal.h> doesn't define])
 if test $zsh_cv_type_sigset_t = no; then
   AC_DEFINE(sigset_t, unsigned int)
 fi
@@ -883,6 +974,8 @@ zsh_STRUCT_MEMBER([
 ], struct sockaddr_in6, sin6_scope_id)
 
 dnl Check for h_errno external variable
+AH_TEMPLATE([USE_LOCAL_H_ERRNO],
+[Define to 1 if h_errno is not defined by the system.])
 AC_CACHE_CHECK(if we need our own h_errno,
   zsh_cv_decl_h_errno_use_local,
   [AC_TRY_LINK( ,[extern int h_errno; h_errno = 0;],
@@ -935,6 +1028,8 @@ dnl  Some termcaps reportedly accept a zero buffer, but then dump core
 dnl  in tgetstr().
 dnl  Under Cygwin test program crashes but exit code is still 0. So,
 dnl  we test for a file that porgram should create
+AH_TEMPLATE([TGETENT_ACCEPTS_NULL],
+[Define to 1 if tgetent() accepts NULL as a buffer.])
 AC_CACHE_CHECK(if tgetent accepts NULL,
 zsh_cv_func_tgetent_accepts_null,
 [AC_TRY_RUN([
@@ -986,6 +1081,8 @@ main()
   fi,
   zsh_cv_func_tgetent_zero_success=no,
   zsh_cv_func_tgetent_zero_success=no)])
+AH_TEMPLATE([TGETENT_SUCCESS],
+[Define to what tgetent() returns on success (0 on HP-UX X/Open curses).])
 if test $zsh_cv_func_tgetent_zero_success = yes; then
   AC_DEFINE(TGETENT_SUCCESS, 0)
 else
@@ -1018,6 +1115,14 @@ dnl -------------
 dnl CHECK SIGNALS
 dnl -------------
 dnl What style of signal do you have (POSIX, BSD, or SYSV)?
+AH_TEMPLATE([POSIX_SIGNALS],
+[Define to 1 if you use POSIX style signal handling.])
+AH_TEMPLATE([BSD_SIGNALS],
+[Define to 1 if you use BSD style signal handling (and can block signals).])
+AH_TEMPLATE([SYSV_SIGNALS],
+[Define to 1 if you use SYS style signal handling (and can block signals).])
+AH_TEMPLATE([NO_SIGNAL_BLOCKING],
+[Define to 1 if you have no signal blocking at all (bummer).])
 AC_MSG_CHECKING(what style of signals to use)
 if test $ac_cv_func_sigaction = yes && test $ac_cv_func_sigprocmask = yes; then
   signals_style=POSIX_SIGNALS
@@ -1151,6 +1256,14 @@ AC_SUBST(RLIMITS_INC_H)dnl
 dnl ------------------
 dnl rlimit type checks
 dnl ------------------
+AH_TEMPLATE([RLIM_T_IS_QUAD_T],
+[Define to 1 if struct rlimit uses quad_t.])
+AH_TEMPLATE([RLIM_T_IS_LONG_LONG],
+[Define to 1 if struct rlimit uses long long])
+AH_TEMPLATE([RLIM_T_IS_UNSIGNED],
+[Define to 1 if struct rlimit uses unsigned.])
+AH_TEMPLATE([rlim_t],
+[Define to the type used in struct rlimit.])
 DEFAULT_RLIM_T=long
 AC_CACHE_CHECK(if rlim_t is longer than a long,
 zsh_cv_rlim_t_is_longer,
@@ -1240,6 +1353,8 @@ zsh_LIMIT_PRESENT(RLIMIT_SBSIZE)
 zsh_LIMIT_PRESENT(RLIMIT_TCACHE)
 zsh_LIMIT_PRESENT(RLIMIT_VMEM)
 
+AH_TEMPLATE([RLIMIT_VMEM_IS_RSS],
+[Define to 1 if RLIMIT_VMEM and RLIMIT_RSS both exist and are equal.])
 AC_CACHE_CHECK(if RLIMIT_VMEM and RLIMIT_RSS are the same,
 zsh_cv_rlimit_vmem_is_rss,
 [AC_TRY_RUN([
@@ -1265,6 +1380,8 @@ if test $zsh_cv_rlimit_vmem_is_rss = yes; then
 fi
 
 
+AH_TEMPLATE([RLIMIT_VMEM_IS_AS],
+[Define to 1 if RLIMIT_VMEM and RLIMIT_AS both exist and are equal.])
 AC_CACHE_CHECK(if RLIMIT_VMEM and RLIMIT_AS are the same,
 zsh_cv_rlimit_vmem_is_as,
 [AC_TRY_RUN([
@@ -1301,12 +1418,15 @@ elif getconf CS_PATH >/dev/null 2>&1; then
 else
   zsh_cv_cs_path="/bin:/usr/bin"
 fi])
-AC_DEFINE_UNQUOTED(DEFAULT_PATH, "$zsh_cv_cs_path")
+AC_DEFINE_UNQUOTED(DEFAULT_PATH, "$zsh_cv_cs_path",
+[The default path; used when running commands with command -p])
 
 
 dnl ----------------------------
 dnl CHECK FOR /dev/fd FILESYSTEM
 dnl ----------------------------
+AH_TEMPLATE([PATH_DEV_FD],
+[Define to the path of the /dev/fd filesystem.])
 AC_CACHE_CHECK(for /dev/fd filesystem, zsh_cv_sys_path_dev_fd,
 [for zsh_cv_sys_path_dev_fd in /proc/self/fd /dev/fd no; do
    test x`echo ok|cat $zsh_cv_sys_path_dev_fd/0 2>/dev/null` = xok && break
@@ -1320,6 +1440,8 @@ dnl CHECK FOR RFS SUPERROOT DIRECTORY
 dnl ---------------------------------
 AC_CACHE_CHECK(for RFS superroot directory, zsh_cv_sys_superroot,
 [test -d /../.LOCALROOT && zsh_cv_sys_superroot=yes || zsh_cv_sys_superroot=no])
+AH_TEMPLATE([HAVE_SUPERROOT],
+[Define to 1 if you have RFS superroot directory.])
 if test $zsh_cv_sys_superroot = yes; then
   AC_DEFINE(HAVE_SUPERROOT)
 fi
@@ -1331,6 +1453,8 @@ zsh_cv_use_getcwd,
     *QNX*) zsh_cv_use_getcwd=yes ;;
     *) zsh_cv_use_getcwd=no ;;
  esac])
+AH_TEMPLATE([USE_GETCWD],
+[Define to 1 if you need to use the native getcwd.])
 if test $zsh_cv_use_getcwd = yes; then
   AC_DEFINE(USE_GETCWD)
 fi
@@ -1338,6 +1462,8 @@ fi
 dnl -------------
 dnl CHECK FOR NIS
 dnl -------------
+AH_TEMPLATE([HAVE_NIS],
+[Define to 1 if you have NIS.])
 AC_CACHE_CHECK(for NIS, zsh_cv_sys_nis,
 [test -f /usr/bin/ypcat && /usr/bin/ypcat passwd.byname > /dev/null 2>&1 && \
 zsh_cv_sys_nis=yes || zsh_cv_sys_nis=no])
@@ -1348,6 +1474,8 @@ fi
 dnl -----------------
 dnl CHECK FOR NISPLUS
 dnl -----------------
+AH_TEMPLATE([HAVE_NIS_PLUS],
+[Define to 1 if you have NISPLUS.])
 AC_CACHE_CHECK(for NIS+, zsh_cv_sys_nis_plus,
 [test $ac_cv_func_nis_list = yes && test -f /usr/bin/nisls && \
  /usr/bin/nisls > /dev/null 2>&1 && \
@@ -1372,6 +1500,8 @@ zsh_cv_header_unistd_h_brk_proto,
 [AC_TRY_COMPILE([#include <unistd.h>
 double brk();], [int i;],
 zsh_cv_header_unistd_h_brk_proto=no, zsh_cv_header_unistd_h_brk_proto=yes)])
+AH_TEMPLATE([HAVE_BRK_PROTO],
+[Define to 1 if there is a prototype defined for brk() on your system.])
 if test $zsh_cv_header_unistd_h_brk_proto = yes; then
   AC_DEFINE(HAVE_BRK_PROTO)
 fi
@@ -1381,6 +1511,8 @@ zsh_cv_header_unistd_h_sbrk_proto,
 [AC_TRY_COMPILE([#include <unistd.h>
 double sbrk();], [int i;],
 zsh_cv_header_unistd_h_sbrk_proto=no, zsh_cv_header_unistd_h_sbrk_proto=yes)])
+AH_TEMPLATE([HAVE_SBRK_PROTO],
+[Define to 1 if there is a prototype defined for sbrk() on your system.])
 if test $zsh_cv_header_unistd_h_sbrk_proto = yes; then
   AC_DEFINE(HAVE_SBRK_PROTO)
 fi
@@ -1389,6 +1521,10 @@ dnl ----------------------------------
 dnl ioctl and mknod prototypes for OSF
 dnl ----------------------------------
 
+AH_TEMPLATE([HAVE_IOCTL_PROTO],
+[Define to 1 if there is a prototype defined for ioctl() on your system])
+AH_TEMPLATE([HAVE_MKNOD_PROTO],
+[Define to 1 if there is a prototype defined for mknod() on your system])
 if test "$ac_cv_prog_cc_stdc" != no; then
   AC_CACHE_CHECK(for ioctl prototype in <sys/ioctl.h>,
   zsh_cv_header_sys_ioctl_h_ioctl_proto,
@@ -1413,6 +1549,8 @@ fi
 dnl -------------------
 dnl select() defined in <sys/socket.h>, ie BeOS R4.51
 dnl -------------------
+AH_TEMPLATE([SELECT_IN_SYS_SOCKET_H],
+[Define to 1 if select() is defined in <sys/socket.h>, ie BeOS R4.51])
 if test $ac_cv_header_sys_select_h != yes; then
   AC_CACHE_CHECK(for select() in <sys/socket.h>,
   zsh_cv_header_socket_h_select_proto,
@@ -1460,6 +1598,8 @@ main()
   zsh_cv_sys_fifo=yes,
   zsh_cv_sys_fifo=no,
   zsh_cv_sys_fifo=yes)])
+AH_TEMPLATE([HAVE_FIFOS],
+[Define to 1 if system has working FIFOs.])
 if test $zsh_cv_sys_fifo = yes; then
   AC_DEFINE(HAVE_FIFOS)
 fi
@@ -1473,6 +1613,8 @@ zsh_cv_prog_sh_echo_escape,
 else
   zsh_cv_prog_sh_echo_escape=yes
 fi])
+AH_TEMPLATE([SH_USE_BSD_ECHO],
+[Define to 1 if /bin/sh does not interpret \ escape sequences.])
 if test $zsh_cv_prog_sh_echo_escape = no; then
   AC_DEFINE(SH_USE_BSD_ECHO)
 fi
@@ -1505,6 +1647,8 @@ main()
   zsh_cv_sys_link=yes,
   zsh_cv_sys_link=no,
   zsh_cv_sys_link=yes)])
+AH_TEMPLATE([HAVE_LINK],
+[Define to 1 if system has working link().])
 if test $zsh_cv_sys_link = yes; then
   AC_DEFINE(HAVE_LINK)
 fi
@@ -1529,6 +1673,8 @@ main()
   zsh_cv_sys_killesrch=yes,
   zsh_cv_sys_killesrch=no,
   zsh_cv_sys_killesrch=yes)])
+AH_TEMPLATE([BROKEN_KILL_ESRCH],
+[Define to 1 if kill(pid, 0) doesn't return ESRCH, ie BeOS R4.51.])
 if test $zsh_cv_sys_killesrch = no; then
   AC_DEFINE(BROKEN_KILL_ESRCH)
 fi
@@ -1537,6 +1683,8 @@ dnl -----------
 dnl if POSIX, test for working sigsuspend().
 dnl for instance, BeOS R4.51 is broken.
 dnl -----------
+AH_TEMPLATE([BROKEN_POSIX_SIGSUSPEND],
+Define to 1 if sigsuspend() is broken, ie BeOS R4.51.])
 if test $signals_style = POSIX_SIGNALS; then
     AC_CACHE_CHECK(if POSIX sigsuspend() works,
     zsh_cv_sys_sigsuspend,
@@ -1578,6 +1726,8 @@ dnl -----------
 dnl if found tcsetpgrp, test to see if it actually works
 dnl for instance, BeOS R4.51 does not support it yet
 dnl -----------
+AH_TEMPLATE([BROKEN_TCSETPGRP],
+[Define to 1 if tcsetpgrp() doesn't work, ie BeOS R4.51.])
 if test -t 0 && test $ac_cv_func_tcsetpgrp = yes; then
     AC_CACHE_CHECK(if tcsetpgrp() actually works,
     zsh_cv_sys_tcsetpgrp,
@@ -1603,6 +1753,8 @@ dnl test for faked getpwnam() entry, ie a single entry returned for any username
 dnl for instance, BeOS R4.51 is not multiuser yet, and fakes getpwnam()
 dnl test by looking up two usernames that shouldn't succeed, and compare entry
 dnl -----------
+AH_TEMPLATE([GETPWNAM_FAKED],
+[Define to 1 if getpwnam() is faked, ie BeOS R4.51.])
 if test $ac_cv_func_getpwnam = yes; then
     AC_CACHE_CHECK(if getpwnam() is faked,
     zsh_cv_sys_getpwnam_faked,
@@ -1637,6 +1789,8 @@ zsh_CHECK_SOCKLEN_T
 dnl ---------------
 dnl dynamic loading
 dnl ---------------
+AH_TEMPLATE([HPUXDYNAMIC],
+[Define to 1 if you want to use dynamically loaded modules on HPUX 10.])
 L=N
 INSTLIB="install.bin-\$(L)"
 UNINSTLIB="uninstall.bin-\$(L)"
@@ -1674,6 +1828,10 @@ fi
 
 test -n "$GCC" && LDARG=-Wl,
 
+AH_TEMPLATE([DLSYM_NEEDS_UNDERSCORE],
+[Define to 1 if an underscore has to be prepended to dlsym() argument.])
+AH_TEMPLATE([DYNAMIC_NAME_CLASH_OK],
+[Define to 1 if multiple modules defining the same symbol are OK.])
 if test "x$aixdynamic" = xyes; then
   DL_EXT="${DL_EXT=so}"
   DLLD="${DLLD=$CC}"
@@ -1943,6 +2101,8 @@ else
   RTLD_GLOBAL_OK=no
 fi
 
+AH_TEMPLATE([DYNAMIC],
+[Define to 1 if you want to use dynamically loaded modules.])
 if test "x$dynamic" = xyes; then
   D=D
   AC_DEFINE(DYNAMIC)dnl
@@ -1950,6 +2110,8 @@ else
   D=N
 fi
 
+AH_TEMPLATE([AIXDYNAMIC],
+[Define to 1 if you want to use dynamically loaded modules on AIX.])
 if test "x$aixdynamic" = xyes; then
   E=E
   AC_DEFINE(AIXDYNAMIC)dnl
@@ -1971,7 +2133,8 @@ if test "$host_os" = cygwin; then
   EXTRAZSHOBJS="$EXTRAZSHOBJS zsh.res.o"
 fi
 
-AC_DEFINE_UNQUOTED(DL_EXT, "$DL_EXT")dnl
+AC_DEFINE_UNQUOTED(DL_EXT, "$DL_EXT",
+[The extension used for dynamically loaded modules.])dnl
 AC_SUBST(D)dnl
 AC_SUBST(DL_EXT)dnl
 AC_SUBST(DLLD)dnl
@@ -2004,6 +2167,9 @@ if test -f ${CONFIG_MODULES}; then
   userlist="`sed -e '/^#/d' -e '/auto=y/d' -e 's/ .*/ /' -e 's/^name=/ /' \
         ${CONFIG_MODULES}`"
   mv ${CONFIG_MODULES} ${CONFIG_MODULES}.old
+else
+  # Save testing for existence each time.
+  echo > ${CONFIG_MODULES}.old
 fi
 (echo "# Edit this file to change the way modules are loaded."
 echo "# The format is strict; do not break lines or add extra spaces."
@@ -2032,65 +2198,106 @@ echo "# module."
 echo "#"
 echo "# You should not change the values for the pseudo-module zsh/main,"
 echo "# which is the main shell (apart from the functions entry)."
+EOM
+dnl The autoconf macros are only available in configure, not
+dnl config.status, and only change when configure is rerun.
+dnl So we need to run the autoconf tests here and store the results.
+dnl We then generate config.modules, preserving any user-generated
+dnl information, from config.status.
 for modfile in `cd ${srcdir}; echo */*.mdd */*/*.mdd`; do
   name=
   link=
   load=
   functions=
+  result=
   . ${srcdir}/$modfile
   if test x$name != x && test x"$link" != x; then
-    case "$userlist" in
-    *" $name "*) # not autogenerated, keep original
-                grep "^name=$name " ${CONFIG_MODULES}.old
-		;;
-    *) case "$link" in
-	  *\ *) eval "link=\`$link\`"
-	       ;;
-       esac
-       case "${load}" in
-	y*) load=" load=yes"
+    case "$link" in
+      *\ *) eval "link=\`$link\`"
 	    ;;
-	 *) load=" load=no"
-	    ;;
-       esac
-       if test "x$functions" != x; then
-         # N.B. no additional quotes
-         f=" functions=$functions"
-       else
-         f=
-       fi
-       case "$link" in
-	 static) echo "name=$name modfile=$modfile link=static auto=yes${load}$f"
-	         ;;
-	 dynamic) if test $dynamic != no; then
-		    echo "name=$name modfile=$modfile link=dynamic\
+    esac
+    case "${load}" in
+      y*) load=" load=yes"
+	  ;;
+      *) load=" load=no"
+	 ;;
+    esac
+    if test "x$functions" != x; then
+      # N.B. no additional quotes
+      f=" functions=$functions"
+    else
+      f=
+    fi
+    case "$link" in
+      static) result="name=$name modfile=$modfile link=static auto=yes${load}$f"
+	      ;;
+      dynamic) if test $dynamic != no; then
+		  result="name=$name modfile=$modfile link=dynamic\
  auto=yes${load}$f"
-		  else
-		    echo "name=$name modfile=$modfile link=no\
+	       else
+		 result="name=$name modfile=$modfile link=no\
  auto=yes load=no$f"
-		  fi
-		  ;;
-	 either) if test $dynamic != no; then
-		   echo "name=$name modfile=$modfile link=dynamic\
+	       fi
+	       ;;
+      either) if test $dynamic != no; then
+		result="name=$name modfile=$modfile link=dynamic\
  auto=yes${load}$f"
-		 else
-		   echo "name=$name modfile=$modfile link=static\
+	      else
+		result="name=$name modfile=$modfile link=static\
  auto=yes${load}$f"
-		 fi
-		 ;;
-	      *) echo "name=$name modfile=$modfile link=no auto=yes load=no$f"
-		 ;;
-       esac
-       ;;
+	      fi
+	      ;;
+       *) result="name=$name modfile=$modfile link=no auto=yes load=no$f"
+	  ;;
     esac
+dnl $result is the default output for config.modules.  We generate
+dnl code to check if we should use this.
+cat <<EOM >> ${CONFIG_MODULES}.sh
+case "\$userlist" in
+  *" $name "*) grep "^name=$name " \${CONFIG_MODULES}.old;;
+  *) echo "$result";;
+esac
+EOM
   fi
-done) >${CONFIG_MODULES}
+done
+cat <<\EOM >> ${CONFIG_MODULES}.sh
+) >${CONFIG_MODULES}
 rm -f ${CONFIG_MODULES}.old
 EOM
-AC_OUTPUT_COMMANDS(,[if test -z "\$CONFIG_FILES\$CONFIG_HEADERS"; then
-`cat ./${CONFIG_MODULES}.sh && rm -f ./${CONFIG_MODULES}.sh`
-fi])
-. ./${CONFIG_MODULES}.sh
+
+dnl AH_TOP replaces the code which used to appear at the top
+dnl of acconfig.h.
+AH_TOP([/***** begin user configuration section *****/
+
+/* Define this to be the location of your password file */
+#define PASSWD_FILE "/etc/passwd"
+
+/* Define this to be the name of your NIS/YP password *
+ * map (if applicable)                                */
+#define PASSWD_MAP "passwd.byname"
+
+/* Define to 1 if you want user names to be cached */
+#define CACHE_USERNAMES 1
+
+/* Define to 1 if system supports job control */
+#define JOB_CONTROL 1
+
+/* Define this if you use "suspended" instead of "stopped" */
+#define USE_SUSPENDED 1
+ 
+/* The default history buffer size in lines */
+#define DEFAULT_HISTSIZE 30
+
+/* The default editor for the fc builtin */
+#define DEFAULT_FCEDIT "vi"
+
+/* The default prefix for temporary files */
+#define DEFAULT_TMPPREFIX "/tmp/zsh"
+
+/***** end of user configuration section            *****/
+/***** shouldn't have to change anything below here *****/
+
+])
 
 CLEAN_MK="${srcdir}/Config/clean.mk"
 CONFIG_MK="${srcdir}/Config/config.mk"
@@ -2103,9 +2310,11 @@ AC_SUBST_FILE(CONFIG_MK)dnl
 AC_SUBST_FILE(DEFS_MK)dnl
 AC_SUBST_FILE(VERSION_MK)dnl
 
-AC_OUTPUT(Config/defs.mk Makefile Doc/Makefile Etc/Makefile Src/Makefile \
-Test/Makefile,
-[test -z "$CONFIG_HEADERS" || echo > stamp-h])
+AC_CONFIG_FILES(Config/defs.mk Makefile Doc/Makefile Etc/Makefile \
+Src/Makefile Test/Makefile)
+AC_CONFIG_COMMANDS([config.modules], [. config.modules.sh])
+
+AC_OUTPUT
 
 eval "zshbin1=${bindir}"
 eval "zshbin2=${zshbin1}"