zsh-workers
 help / color / mirror / code / Atom feed
* redo of 16845
@ 2004-02-28 20:22 Clint Adams
  2004-02-28 20:53 ` Clint Adams
  2004-02-29 19:22 ` Peter Stephenson
  0 siblings, 2 replies; 10+ messages in thread
From: Clint Adams @ 2004-02-28 20:22 UTC (permalink / raw)
  To: zsh-workers

This appears to work for GNU make.  FreeBSD 4.9's make chokes before the
included file has been created.  I haven't tested with Solaris's make
yet.

Index: aclocal.m4
===================================================================
RCS file: /cvsroot/zsh/zsh/aclocal.m4,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 aclocal.m4
--- aclocal.m4	6 Aug 1999 18:01:38 -0000	1.1.1.3
+++ aclocal.m4	28 Feb 2004 19:59:39 -0000
@@ -1,59 +1,5 @@
-# Local additions to Autoconf macros.
-# Copyright (C) 1992, 1994 Free Software Foundation, Inc.
-# Francois Pinard <pinard@iro.umontreal.ca>, 1992.
-
-# @defmac fp_PROG_CC_STDC
-# @maindex PROG_CC_STDC
-# @ovindex CC
-# If the C compiler in not in ANSI C mode by default, try to add an option
-# to output variable @code{CC} to make it so.  This macro tries various
-# options that select ANSI C on some system or another.  It considers the
-# compiler to be in ANSI C mode if it defines @code{__STDC__} to 1 and
-# handles function prototypes correctly.
-# 
-# If you use this macro, you should check after calling it whether the C
-# compiler has been set to accept ANSI C; if not, the shell variable
-# @code{fp_cv_prog_cc_stdc} is set to @samp{no}.  If you wrote your source
-# code in ANSI C, you can make an un-ANSIfied copy of it by using the
-# program @code{ansi2knr}, which comes with Ghostscript.
-# @end defmac
-
-define(fp_PROG_CC_STDC,
-[AC_CACHE_CHECK(for ${CC-cc} option to accept ANSI C,
-fp_cv_prog_cc_stdc,
-[fp_cv_prog_cc_stdc=no
-ac_save_CFLAGS="$CFLAGS"
-# Don't try gcc -ansi; that turns off useful extensions and
-# breaks some systems' header files.
-# AIX			-qlanglvl=ansi
-# Ultrix and OSF/1	-std1
-# HP-UX			-Ae  or  -Aa -D_HPUX_SOURCE
-# SVR4			-Xc
-#  For HP-UX, we try -Ae first; this turns on ANSI but also extensions,
-#  as well as defining _HPUX_SOURCE, and we can then use long long.
-#  We keep the old version for backward compatibility.
-for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" -Xc
-do
-  CFLAGS="$ac_save_CFLAGS $ac_arg"
-  AC_TRY_COMPILE(
-[#ifndef __STDC__
-choke me
-#endif	
-], [int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};],
-[fp_cv_prog_cc_stdc="$ac_arg"; break])
-done
-CFLAGS="$ac_save_CFLAGS"
-])
-case "x$fp_cv_prog_cc_stdc" in
-  x|xno) ;;
-  *) CC="$CC $fp_cv_prog_cc_stdc" ;;
-esac
-])
-
-AC_DEFUN(AC_PROG_LN,
-[AC_MSG_CHECKING(whether ln works)
+AC_DEFUN([AC_PROG_LN],
+[AC_MSG_CHECKING([whether ln works])
 AC_CACHE_VAL(ac_cv_prog_LN,
 [rm -f conftestdata conftestlink
 echo > conftestdata
@@ -74,4 +20,67 @@
 AC_SUBST(LN)dnl
 ])
 
+# Check to see how 'make' treats includes.	-*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 2
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+	@echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+   am__include=include
+   am__quote=
+   _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+      am__include=.include
+      am__quote="\""
+      _am_result=BSD
+   fi
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
 builtin(include, aczsh.m4)
Index: configure.ac
===================================================================
RCS file: /cvsroot/zsh/zsh/configure.ac,v
retrieving revision 1.10
diff -u -r1.10 configure.ac
--- configure.ac	27 Feb 2004 10:17:38 -0000	1.10
+++ configure.ac	28 Feb 2004 19:59:40 -0000
@@ -402,7 +402,6 @@
 AC_PROG_GCC_TRADITIONAL     dnl Do we need -traditional flag for gcc.
 AC_C_CONST                  dnl Does compiler support `const'.
 
-fp_PROG_CC_STDC
 AC_MSG_CHECKING([whether to use prototypes])
 if test ."$ansi2knr" = .yes || test ."$ansi2knr" = .no; then
   msg="(overridden) "
@@ -494,22 +493,12 @@
 AC_HEADER_STAT
 AC_HEADER_SYS_WAIT
 
-oldcflags="$CFLAGS"
-AC_CHECK_PROG([PCRECONF], pcre-config, pcre-config)
-dnl Typically (meaning on this single RedHat 9 box in front of me)
-dnl pcre-config --cflags produces a -I output which needs to go into
-dnl CPPFLAGS else configure's preprocessor tests don't pick it up,
-dnl producing a warning.
-if test "x$ac_cv_prog_PCRECONF" = xpcre-config; then
-  CPPFLAGS="$CPPFLAGS `pcre-config --cflags`"
-fi
-
 AC_CHECK_HEADERS(sys/time.h sys/times.h sys/select.h termcap.h termio.h \
 		 termios.h sys/param.h sys/filio.h string.h memory.h \
 		 limits.h fcntl.h libc.h sys/utsname.h sys/resource.h \
 		 locale.h errno.h stdio.h stdlib.h unistd.h sys/capability.h \
 		 utmp.h utmpx.h sys/types.h pwd.h grp.h poll.h sys/mman.h \
-		 netinet/in_systm.h pcre.h langinfo.h wchar.h stddef.h \
+		 netinet/in_systm.h langinfo.h wchar.h stddef.h \
 		 sys/stropts.h)
 if test $dynamic = yes; then
   AC_CHECK_HEADERS(dlfcn.h)
@@ -708,9 +697,6 @@
 
 AC_CHECK_LIB(iconv, iconv)
 
-dnl pcre-config should probably be employed here
-AC_SEARCH_LIBS(pcre_compile, pcre)
-
 dnl ---------------------
 dnl CHECK TERMCAP LIBRARY
 dnl ---------------------
@@ -1029,7 +1015,6 @@
 	       brk sbrk \
 	       pathconf sysconf \
 	       tgetent tigetflag tigetnum tigetstr setupterm \
-	       pcre_compile pcre_study pcre_exec \
 	       nl_langinfo \
 	       erand48 open_memstream \
 	       wctomb iconv \
@@ -2367,9 +2352,13 @@
 AC_SUBST_FILE(DEFS_MK)dnl
 AC_SUBST_FILE(VERSION_MK)dnl
 
+AM_MAKE_INCLUDE
+
 AC_CONFIG_FILES(Config/defs.mk Makefile Doc/Makefile Etc/Makefile \
-Src/Makefile Test/Makefile)
+Src/Makefile Test/Makefile Src/mkmakemod.sh.in)
 AC_CONFIG_COMMANDS([config.modules], [. ./config.modules.sh])
+AC_CONFIG_COMMANDS([Src/mkmakemod.sh],
+ [sed "s/_@_/@/g" Src/mkmakemod.sh.in >Src/mkmakemod.sh])
 
 AC_OUTPUT
 
@@ -2410,4 +2399,3 @@
 echo "See config.modules for installed modules and functions.
 "
 
-
Index: Src/Makefile.in
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Makefile.in,v
retrieving revision 1.12
diff -u -r1.12 Makefile.in
--- Src/Makefile.in	20 Dec 2001 23:48:39 -0000	1.12
+++ Src/Makefile.in	28 Feb 2004 19:59:40 -0000
@@ -109,16 +109,16 @@
 
 @CONFIG_MK@
 
-Makemod prep: $(CONFIG_INCS) $(dir_top)/config.modules
+Makemod prep: $(CONFIG_INCS) $(dir_top)/config.modules mkmakemod.sh
 	@case $(sdir_top) in \
 	    /*) top_srcdir=$(sdir_top) ;; \
 	    *) top_srcdir=$(subdir)/$(sdir_top) ;; \
 	esac; \
 	export top_srcdir; \
 	echo 'cd $(dir_top) && $(SHELL)' \
-	    '$$top_srcdir/$(subdir)/mkmakemod.sh $(subdir) Makemod'; \
+	    '$(subdir)/mkmakemod.sh $(subdir) Makemod'; \
 	cd $(dir_top) && \
-	    $(SHELL) $$top_srcdir/$(subdir)/mkmakemod.sh $(subdir) Makemod
+	    $(SHELL) $(subdir)/mkmakemod.sh $(subdir) Makemod
 	@$(MAKE) -f Makemod $(MAKEDEFS) prep || rm -f Makemod
 .PHONY: prep
 
@@ -191,6 +191,7 @@
 clean-here:
 	rm -f modules.stamp zsh$(EXEEXT)
 	rm -f libzsh-*.$(DL_EXT)
+	rm -f mkmakemod.sh.in mkmakemod.sh
 .PHONY: clean-here
 
 distclean-here:
Index: Src/Makemod.in.in
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Makemod.in.in,v
retrieving revision 1.5
diff -u -r1.5 Makemod.in.in
--- Src/Makemod.in.in	20 Dec 2001 23:48:39 -0000	1.5
+++ Src/Makemod.in.in	28 Feb 2004 19:59:41 -0000
@@ -111,7 +111,7 @@
 	for subdir in $$subdirs; do \
 	    dir=$(subdir)/$$subdir; \
 	    test -d $$dir || mkdir $$dir; \
-	    $(SHELL) $$top_srcdir/Src/mkmakemod.sh $$dir Makefile || exit 1; \
+	    $(SHELL) Src/mkmakemod.sh $$dir Makefile || exit 1; \
 	    ( cd $$dir && $(MAKE) $(MAKEDEFS) $@ ) || exit 1; \
 	done
 .PHONY: prep
@@ -149,7 +149,8 @@
 .PHONY: mostlyclean-here
 
 clean-here:
-	rm -f *.o.c *.syms *.pro *.epro *.mdh *.mdhi *.mdhs *.mdh.tmp
+	rm -f *.o.c *.syms *.pro *.epro *.mdh *.mdhi *.mdhs *.mdh.tmp \
+	*.configure *.ach config.cache config.status config.log *.rules
 .PHONY: clean-here
 
 distclean-here:
@@ -173,11 +174,11 @@
 	esac; \
 	export top_srcdir; \
 	echo 'cd $(dir_top) && $(SHELL)' \
-	    '$$top_srcdir/Src/mkmakemod.sh -m $(subdir) $(makefile)'; \
+	    'Src/mkmakemod.sh -m $(subdir) $(makefile)'; \
 	cd $(dir_top) && \
-	    $(SHELL) $$top_srcdir/Src/mkmakemod.sh -m $(subdir) $(makefile)
+	    $(SHELL) Src/mkmakemod.sh -m $(subdir) $(makefile)
 
-$(makefile).in: $(sdir_src)/mkmakemod.sh $(sdir_src)/Makemod.in.in $(MDDS) \
+$(makefile).in: $(dir_top)/Src/mkmakemod.sh $(sdir_src)/Makemod.in.in $(MDDS) \
 	$(dir_top)/config.modules
 	@case $(sdir_top) in \
 	    /*) top_srcdir=$(sdir_top) ;; \
@@ -185,7 +186,6 @@
 	esac; \
 	export top_srcdir; \
 	echo 'cd $(dir_top) && $(SHELL)' \
-	    '$$top_srcdir/Src/mkmakemod.sh -i $(subdir) $(makefile)'; \
+	    'Src/mkmakemod.sh -i $(subdir) $(makefile)'; \
 	cd $(dir_top) && \
-	    $(SHELL) $$top_srcdir/Src/mkmakemod.sh -i $(subdir) $(makefile)
-
+	    $(SHELL) Src/mkmakemod.sh -i $(subdir) $(makefile)
Index: Src/mkmakemod.sh
===================================================================
RCS file: Src/mkmakemod.sh
diff -N Src/mkmakemod.sh
--- Src/mkmakemod.sh	14 Feb 2004 18:50:17 -0000	1.13
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,476 +0,0 @@
-#!/bin/sh
-#
-# mkmakemod.sh: generate Makefile.in files for module building
-#
-# Options:
-#   -m = file is already generated; only build the second stage
-#   -i = do not build second stage
-#
-# Args:
-#   $1 = subdirectory to look in, relative to $top_srcdir
-#   $2 = final output filename, within the $1 directory
-#
-# This script must be run from the top-level build directory, and $top_srcdir
-# must be set correctly in the environment.
-#
-# This looks in $1, and uses all the *.mdd files there.  Each .mdd file
-# defines one module.  The .mdd file is actually a shell script, which will
-# be sourced.  It may define the following shell variables:
-#
-#   name            name of this module
-#   moddeps         modules on which this module depends (default none)
-#   nozshdep        non-empty indicates no dependence on the `zsh/main' pseudo-module
-#   alwayslink      if non-empty, always link the module into the executable
-#   autobins        builtins defined by the module, for autoloading
-#   autoinfixconds  infix condition codes defined by the module, for
-#                   autoloading (without the leading `-')
-#   autoprefixconds like autoinfixconds, but for prefix condition codes
-#   autoparams      parameters defined by the module, for autoloading
-#   automathfuncs   math functions defined by the module, for autoloading
-#   objects         .o files making up this module (*must* be defined)
-#   proto           .syms files for this module (default generated from $objects)
-#   headers         extra headers for this module (default none)
-#   hdrdeps         extra headers on which the .mdh depends (default none)
-#   otherincs       extra headers that are included indirectly (default none)
-#
-# The .mdd file may also include a Makefile.in fragment between lines
-# `:<<\Make' and `Make' -- this will be copied into Makemod.in.
-#
-# The resulting Makemod.in knows how to build each module that is defined.
-# For each module in also knows how to build a .mdh file.  Each source file
-# should #include the .mdh file for the module it is a part of.  The .mdh
-# file #includes the .mdh files for any module dependencies, then each of
-# $headers, and then each .epro (for global declarations).  It will
-# be recreated if any of the dependency .mdh files changes, or if any of
-# $headers or $hdrdeps changes.  When anything depends on it, all the .epros
-# and $otherincs will be made up to date, but the .mdh file won't actually
-# be rebuilt if those files change.
-#
-# The order of sections of the output file is thus:
-#   simple generated macros
-#   macros generated from *.mdd
-#   included Makemod.in.in
-#   rules generated from *.mdd
-# The order dependencies are basically that the generated macros are required
-# in Makemod.in.in, but some of the macros that it creates are needed in the
-# later rules.
-#
-
-# sed script to normalise a pathname
-sed_normalise='
-    s,^,/,
-    s,$,/,
-    :1
-    s,/\./,/,
-    t1
-    :2
-    s,/[^/.][^/]*/\.\./,/,
-    s,/\.[^/.][^/]*/\.\./,/,
-    s,/\.\.[^/][^/]*/\.\./,/,
-    t2
-    s,^/$,.,
-    s,^/,,
-    s,\(.\)/$,\1,
-'
-
-# decide which stages to process
-first_stage=true
-second_stage=true
-if test ."$1" = .-m; then
-    shift
-    first_stage=false
-elif test ."$1" = .-i; then
-    shift
-    second_stage=false
-fi
-
-top_srcdir=`echo $top_srcdir | sed "$sed_normalise"`
-the_subdir=$1
-the_makefile=$2
-
-if $first_stage; then
-
-    dir_top=`echo $the_subdir | sed 's,[^/][^/]*,..,g'`
-
-    trap "rm -f $the_subdir/${the_makefile}.in" 1 2 15
-    echo "creating $the_subdir/${the_makefile}.in"
-    exec 3>&1 >$the_subdir/${the_makefile}.in
-    echo "##### ${the_makefile}.in generated automatically by mkmakemod.sh"
-    echo "##### DO NOT EDIT!"
-    echo
-    echo "##### ===== DEFINITIONS ===== #####"
-    echo
-    echo "makefile = ${the_makefile}"
-    echo "dir_top = ${dir_top}"
-    echo "subdir = ${the_subdir}"
-    echo
-
-    bin_mods=`grep link=static ./config.modules | \
-    sed -e '/^#/d' -e 's/ .*/ /' -e 's/^name=/ /'`
-    dyn_mods="`grep link=dynamic ./config.modules | \
-    sed -e '/^#/d' -e 's/ .*/ /' -e 's/^name=/ /'`"
-    module_list="${bin_mods}${dyn_mods}"
-
-    # check both 2.13 and 2.50 syntax
-    if grep '%@D@%D%' config.status >/dev/null ||
-       grep ',@D@,D,' config.status >/dev/null; then
-	is_dynamic=true
-    else
-	is_dynamic=false
-    fi
-
-    here_mddnames=
-    all_subdirs=
-    all_modobjs=
-    all_modules=
-    all_mdds=
-    all_mdhs=
-    all_proto=
-    lastsub=//
-    for module in $module_list; do
-        modfile="`grep '^name='$module' ' ./config.modules | \
-	  sed -e 's/^.* modfile=//' -e 's/ .*//'`"
-	case $modfile in
-	    $the_subdir/$lastsub/*) ;;
-	    $the_subdir/*/*)
-		lastsub=`echo $modfile | sed 's,^'$the_subdir'/,,;s,/[^/]*$,,'`
-		case "$all_subdirs " in
-		    *" $lastsub "* ) ;;
-		    * )
-			all_subdirs="$all_subdirs $lastsub"
-		    ;;
-		esac
-		;;
-	    $the_subdir/*)
-		mddname=`echo $modfile | sed 's,^.*/,,;s,\.mdd$,,'`
-		here_mddnames="$here_mddnames $mddname"
-		build=$is_dynamic
-		case $is_dynamic@$bin_mods in
-		    *" $module "*)
-			build=true
-			all_modobjs="$all_modobjs modobjs.${mddname}" ;;
-		    true@*)
-			all_modules="$all_modules ${mddname}.\$(DL_EXT)" ;;
-		esac
-		all_mdds="$all_mdds ${mddname}.mdd"
-		$build && all_mdhs="$all_mdhs ${mddname}.mdh"
-		$build && all_proto="$all_proto proto.${mddname}"
-		;;
-	esac
-    done
-    echo "MODOBJS =$all_modobjs"
-    echo "MODULES =$all_modules"
-    echo "MDDS    =$all_mdds"
-    echo "MDHS    =$all_mdhs"
-    echo "PROTOS  =$all_proto"
-    echo "SUBDIRS =$all_subdirs"
-    echo
-    echo "ENTRYOBJ = \$(dir_src)/modentry..o"
-    echo "NNTRYOBJ ="
-    echo "ENTRYOPT = -emodentry"
-    echo "NNTRYOPT ="
-    echo
-
-    echo "##### ===== INCLUDING Makemod.in.in ===== #####"
-    echo
-    cat $top_srcdir/Src/Makemod.in.in
-    echo
-
-    case $the_subdir in
-	Src) modobjs_sed= ;;
-	Src/*) modobjs_sed="| sed 's\" \" "`echo $the_subdir | sed 's,^Src/,,'`"/\"g' " ;;
-	*) modobjs_sed="| sed 's\" \" ../$the_subdir/\"g' " ;;
-    esac
-
-    other_mdhs=
-    remote_mdhs=
-    other_exports=
-    remote_exports=
-    other_modules=
-    remote_modules=
-    for mddname in $here_mddnames; do
-
-	unset name moddeps nozshdep alwayslink hasexport
-	unset autobins autoinfixconds autoprefixconds autoparams automathfuncs
-	unset objects proto headers hdrdeps otherincs
-	. $top_srcdir/$the_subdir/${mddname}.mdd
-	q_name=`echo $name | sed 's,Q,Qq,g;s,_,Qu,g;s,/,Qs,g'`
-	test -n "${moddeps+set}" || moddeps=
-	test -n "$nozshdep" || moddeps="$moddeps zsh/main"
-	test -n "${proto+set}" ||
-	    proto=`echo $objects '' | sed 's,\.o ,.syms ,g'`
-
-	dobjects=`echo $objects '' | sed 's,\.o ,..o ,g'`
-	modhdeps=
-	mododeps=
-	exportdeps=
-	imports=
-	q_moddeps=
-	for dep in $moddeps; do
-	    depfile="`grep '^name='$dep' ' ./config.modules | \
-	      sed -e 's/^.* modfile=//' -e 's/ .*//'`"
-	    q_dep=`echo $dep | sed 's,Q,Qq,g;s,_,Qu,g;s,/,Qs,g'`
-	    q_moddeps="$q_moddeps $q_dep"
-	    eval `echo $depfile | sed 's,/\([^/]*\)\.mdd$,;depbase=\1,;s,^,loc=,'`
-	    case "$binmod" in
-		*" $dep "* )
-		    dep=zsh/main
-		;;
-	    esac
-
-	    case $the_subdir in
-		$loc)
-		    mdh="${depbase}.mdh"
-		    export="${depbase}.export"
-		    case "$dep" in
-			zsh/main )
-			    mdll="\$(dir_top)/Src/libzsh-\$(VERSION).\$(DL_EXT) "
-			;;
-			* )
-			    mdll="${depbase}.\$(DL_EXT) "
-			;;
-		    esac
-		    ;;
-		$loc/*)
-		    mdh="\$(dir_top)/$loc/${depbase}.mdh"
-		    case "$other_mdhs " in
-			*" $mdh "*) ;;
-			*) other_mdhs="$other_mdhs $mdh" ;;
-		    esac
-		    export="\$(dir_top)/$loc/${depbase}.export"
-		    case "$other_exports " in
-			*" $export "*) ;;
-			*) other_exports="$other_exports $export" ;;
-		    esac
-		    case "$dep" in
-			zsh/main )
-			    mdll="\$(dir_top)/Src/libzsh-\$(VERSION).\$(DL_EXT) "
-			;;
-			* )
-			    mdll="\$(dir_top)/$loc/${depbase}.\$(DL_EXT) "
-			;;
-		    esac
-		    case "$other_modules " in
-			*" $mdll "*) ;;
-			*) other_modules="$other_modules $mdll" ;;
-		    esac
-		    ;;
-		*)
-		    mdh="\$(dir_top)/$loc/${depbase}.mdh"
-		    case "$remote_mdhs " in
-			*" $mdh "*) ;;
-			*) remote_mdhs="$remote_mdhs $mdh" ;;
-		    esac
-		    export="\$(dir_top)/$loc/${depbase}.export"
-		    case "$remote_exports " in
-			*" $export "*) ;;
-			*) remote_exports="$remote_exports $export" ;;
-		    esac
-		    case "$dep" in
-			zsh/main )
-			    mdll="\$(dir_top)/Src/libzsh-\$(VERSION).\$(DL_EXT) "
-			;;
-			* )
-			    mdll="\$(dir_top)/$loc/${depbase}.\$(DL_EXT) "
-			;;
-		    esac
-		    case "$remote_modules " in
-			*" $mdll "*) ;;
-			*) remote_modules="$remote_modules $mdll" ;;
-		    esac
-		    ;;
-	    esac
-	    modhdeps="$modhdeps $mdh"
-	    exportdeps="$exportdeps $export"
-	    imports="$imports \$(IMPOPT)$export"
-	    case "$mododeps " in
-		*" $mdll "* )
-		    :
-		;;
-		* )
-		    mododeps="$mododeps $mdll"
-		;;
-	    esac
-	done
-
-	echo "##### ===== DEPENDENCIES GENERATED FROM ${mddname}.mdd ===== #####"
-	echo
-	echo "MODOBJS_${mddname} = $objects"
-	echo "MODDOBJS_${mddname} = $dobjects \$(@E@NTRYOBJ)"
-	echo "SYMS_${mddname} = $proto"
-	echo "EPRO_${mddname} = "`echo $proto '' | sed 's,\.syms ,.epro ,g'`
-	echo "INCS_${mddname} = \$(EPRO_${mddname}) $otherincs"
-	echo "EXPIMP_${mddname} = $imports \$(EXPOPT)$mddname.export"
-	echo "NXPIMP_${mddname} ="
-	echo "LINKMODS_${mddname} = $mododeps"
-	echo "NOLINKMODS_${mddname} = "
-	echo
-	echo "proto.${mddname}: \$(EPRO_${mddname})"
-	echo "\$(SYMS_${mddname}): \$(PROTODEPS)"
-	echo
-	echo "${mddname}.export: \$(SYMS_${mddname})"
-	echo "	( echo '#!'; cat \$(SYMS_${mddname}) | sed -n '/^X/{s/^X//;p;}' | sort -u ) > \$@"
-	echo
-	echo "modobjs.${mddname}: \$(MODOBJS_${mddname})"
-	echo "	echo '' \$(MODOBJS_${mddname}) $modobjs_sed>> \$(dir_src)/stamp-modobjs.tmp"
-	echo
-	if test -z "$alwayslink"; then
-	    case " $all_modules" in *" ${mddname}."*)
-		echo "install.modules-here: install.modules.${mddname}"
-		echo "uninstall.modules-here: uninstall.modules.${mddname}"
-		echo
-	    ;; esac
-	    instsubdir=`echo $name | sed 's,^,/,;s,/[^/]*$,,'`
-	    echo "install.modules.${mddname}: ${mddname}.\$(DL_EXT)"
-	    echo "	\$(SHELL) \$(sdir_top)/mkinstalldirs \$(DESTDIR)\$(MODDIR)${instsubdir}"
-	    echo "	\$(INSTALL_PROGRAM) \$(STRIPFLAGS) ${mddname}.\$(DL_EXT) \$(DESTDIR)\$(MODDIR)/${name}.\$(DL_EXT)"
-	    echo
-	    echo "uninstall.modules.${mddname}:"
-	    echo "	rm -f \$(DESTDIR)\$(MODDIR)/${name}.\$(DL_EXT)"
-	    echo
-	    echo "${mddname}.\$(DL_EXT): \$(MODDOBJS_${mddname}) ${mddname}.export $exportdeps \$(@LINKMODS@_${mddname})"
-	    echo '	rm -f $@'
-	    echo "	\$(DLLINK) \$(@E@XPIMP_$mddname) \$(@E@NTRYOPT) \$(MODDOBJS_${mddname}) \$(@LINKMODS@_${mddname}) \$(LIBS) "
-	    echo
-	fi
-	echo "${mddname}.mdhi: ${mddname}.mdhs \$(INCS_${mddname})"
-	echo "	@test -f \$@ || echo 'do not delete this file' > \$@"
-	echo
-	echo "${mddname}.mdhs: ${mddname}.mdd"
-	echo "	@\$(MAKE) -f \$(makefile) \$(MAKEDEFS) ${mddname}.mdh.tmp"
-	echo "	@if cmp -s ${mddname}.mdh ${mddname}.mdh.tmp; then \\"
-	echo "	    rm -f ${mddname}.mdh.tmp; \\"
-	echo "	    echo \"\\\`${mddname}.mdh' is up to date.\"; \\"
-	echo "	else \\"
-	echo "	    mv -f ${mddname}.mdh.tmp ${mddname}.mdh; \\"
-	echo "	    echo \"Updated \\\`${mddname}.mdh'.\"; \\"
-	echo "	fi"
-	echo "	echo 'timestamp for ${mddname}.mdh against ${mddname}.mdd' > \$@"
-	echo
-	echo "${mddname}.mdh: ${modhdeps} ${headers} ${hdrdeps} ${mddname}.mdhi"
-	echo "	@\$(MAKE) -f \$(makefile) \$(MAKEDEFS) ${mddname}.mdh.tmp"
-	echo "	@mv -f ${mddname}.mdh.tmp ${mddname}.mdh"
-	echo "	@echo \"Updated \\\`${mddname}.mdh'.\""
-	echo
-	echo "${mddname}.mdh.tmp:"
-	echo "	@( \\"
-	echo "	    echo '#ifndef have_${q_name}_module'; \\"
-	echo "	    echo '#define have_${q_name}_module'; \\"
-	echo "	    echo; \\"
-	echo "	    echo '# ifndef IMPORTING_MODULE_${q_name}'; \\"
-	echo "	    if test @SHORTBOOTNAMES@ = yes; then \\"
-	echo "		echo '#  ifndef MODULE'; \\"
-	echo "	    fi; \\"
-	echo "	    echo '#   define boot_ boot_${q_name}'; \\"
-	echo "	    echo '#   define cleanup_ cleanup_${q_name}'; \\"
-	echo "	    echo '#   define setup_ setup_${q_name}'; \\"
-	echo "	    echo '#   define finish_ finish_${q_name}'; \\"
-	echo "	    if test @SHORTBOOTNAMES@ = yes; then \\"
-	echo "		echo '#  endif /* !MODULE */'; \\"
-	echo "	    fi; \\"
-	echo "	    echo '# endif /* !IMPORTING_MODULE_${q_name} */'; \\"
-	echo "	    echo; \\"
-	if test -n "$moddeps"; then (
-	    set x $q_moddeps
-	    echo "	    echo '/* Module dependencies */'; \\"
-	    for hdep in $modhdeps; do
-		shift
-		echo "	    echo '# define IMPORTING_MODULE_${1} 1'; \\"
-		echo "	    echo '# include \"${hdep}\"'; \\"
-	    done
-	    echo "	    echo; \\"
-	) fi
-	if test -n "$headers"; then
-	    echo "	    echo '/* Extra headers for this module */'; \\"
-	    echo "	    for hdr in $headers; do \\"
-	    echo "		if test -f \$\$hdr; then \\"
-	    echo "		    echo '# include \"'\$\$hdr'\"'; \\"
-	    echo "		else \\"
-	    echo "		    echo '# include \"\$(sdir)/'\$\$hdr'\"'; \\"
-	    echo "		fi; \\"
-	    echo "	    done; \\"
-	    echo "	    echo; \\"
-	fi
-	if test -n "$proto"; then
-	    echo "	    echo '# undef mod_import_variable'; \\"
-	    echo "	    echo '# undef mod_import_function'; \\"
-	    echo "	    echo '# if defined(IMPORTING_MODULE_${q_name}) &&  defined(MODULE)'; \\"
-	    echo "	    echo '#  define mod_import_variable @MOD_IMPORT_VARIABLE@'; \\"
-	    echo "	    echo '#  define mod_import_function @MOD_IMPORT_FUNCTION@'; \\"
-	    echo "	    echo '# else'; \\"
-	    echo "	    echo '#  define mod_import_function'; \\"
-	    echo "	    echo '#  define mod_import_variable'; \\"
-	    echo "	    echo '# endif /* IMPORTING_MODULE_${q_name} && MODULE */'; \\"
-	    echo "	    for epro in \$(EPRO_${mddname}); do \\"
-	    echo "		echo '# include \"'\$\$epro'\"'; \\"
-	    echo "	    done; \\"
-	    echo "	    echo '# undef mod_import_variable'; \\"
-	    echo "	    echo '# define mod_import_variable'; \\"
-	    echo "	    echo '# undef mod_import_variable'; \\"
-	    echo "	    echo '# define mod_import_variable'; \\"
-	    echo "	    echo '# ifndef mod_export'; \\"
-	    echo "	    echo '#  define mod_export @MOD_EXPORT@'; \\"
-	    echo "	    echo '# endif /* mod_export */'; \\"
-	    echo "	    echo; \\"
-	fi
-	echo "	    echo '#endif /* !have_${q_name}_module */'; \\"
-	echo "	) > \$@"
-	echo
-	echo "\$(MODOBJS_${mddname}) \$(MODDOBJS_${mddname}): ${mddname}.mdh"
-	sed -e '/^ *: *<< *\\Make *$/,/^Make$/!d' \
-	    -e 's/^ *: *<< *\\Make *$//; /^Make$/d' \
-	    < $top_srcdir/$the_subdir/${mddname}.mdd
-	echo
-
-    done
-
-    if test -n "$remote_mdhs$other_mdhs$remote_exports$other_exports$remote_modules$other_modules"; then
-	echo "##### ===== DEPENDENCIES FOR REMOTE MODULES ===== #####"
-	echo
-	for mdh in $remote_mdhs; do
-	    echo "$mdh: FORCE"
-	    echo "	@cd @%@ && \$(MAKE) \$(MAKEDEFS) @%@$mdh"
-	    echo
-	done | sed 's,^\(.*\)@%@\(.*\)@%@\(.*\)/\([^/]*\)$,\1\3\2\4,'
-	if test -n "$other_mdhs"; then
-	    echo "${other_mdhs}:" | sed 's,^ ,,'
-	    echo "	false # should only happen with make -n"
-	    echo
-	fi
-	for export in $remote_exports; do
-	    echo "$export: FORCE"
-	    echo "	@cd @%@ && \$(MAKE) \$(MAKEDEFS) @%@$export"
-	    echo
-	done | sed 's,^\(.*\)@%@\(.*\)@%@\(.*\)/\([^/]*\)$,\1\3\2\4,'
-	if test -n "$other_exports"; then
-	    echo "${other_exports}:" | sed 's,^ ,,'
-	    echo "	false # should only happen with make -n"
-	    echo
-	fi
-	for mdll in $remote_modules; do
-	    echo "$mdll: FORCE"
-	    echo "	@cd @%@ && \$(MAKE) \$(MAKEDEFS) @%@$mdll"
-	    echo
-	done | sed 's,^\(.*\)@%@\(.*\)@%@\(.*\)/\([^/]*\)$,\1\3\2\4,'
-	if test -n "$other_modules"; then
-	    echo "${other_modules}:" | sed 's,^ ,,'
-	    echo "	false # should only happen with make -n"
-	    echo
-	fi
-    fi
-
-    echo "##### End of ${the_makefile}.in"
-
-    exec >&3 3>&-
-
-fi
-
-if $second_stage ; then
-    trap "rm -f $the_subdir/${the_makefile}" 1 2 15
-
-    ${CONFIG_SHELL-/bin/sh} ./config.status \
-	--file=$the_subdir/${the_makefile}:$the_subdir/${the_makefile}.in ||
-    return 1
-fi
-
-exit 0
Index: Src/mkmakemod.sh.in.in
===================================================================
RCS file: Src/mkmakemod.sh.in.in
diff -N Src/mkmakemod.sh.in.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Src/mkmakemod.sh.in.in	28 Feb 2004 19:59:41 -0000
@@ -0,0 +1,492 @@
+#!/bin/sh
+#
+# mkmakemod.sh: generate Makefile.in files for module building
+#
+# Options:
+#   -m = file is already generated; only build the second stage
+#   -i = do not build second stage
+#
+# Args:
+#   $1 = subdirectory to look in, relative to $top_srcdir
+#   $2 = final output filename, within the $1 directory
+#
+# This script must be run from the top-level build directory, and $top_srcdir
+# must be set correctly in the environment.
+#
+# This looks in $1, and uses all the *.mdd files there.  Each .mdd file
+# defines one module.  The .mdd file is actually a shell script, which will
+# be sourced.  It may define the following shell variables:
+#
+#   name            name of this module
+#   moddeps         modules on which this module depends (default none)
+#   nozshdep        non-empty indicates no dependence on the `zsh/main' pseudo-module
+#   alwayslink      if non-empty, always link the module into the executable
+#   autobins        builtins defined by the module, for autoloading
+#   autoinfixconds  infix condition codes defined by the module, for
+#                   autoloading (without the leading `-')
+#   autoprefixconds like autoinfixconds, but for prefix condition codes
+#   autoparams      parameters defined by the module, for autoloading
+#   automathfuncs   math functions defined by the module, for autoloading
+#   objects         .o files making up this module (*must* be defined)
+#   proto           .syms files for this module (default generated from $objects)
+#   headers         extra headers for this module (default none)
+#   hdrdeps         extra headers on which the .mdh depends (default none)
+#   otherincs       extra headers that are included indirectly (default none)
+#
+# The .mdd file may also include a Makefile.in fragment between lines
+# `:<<\Make' and `Make' -- this will be copied into Makemod.in.
+#
+# The resulting Makemod.in knows how to build each module that is defined.
+# For each module in also knows how to build a .mdh file.  Each source file
+# should #include the .mdh file for the module it is a part of.  The .mdh
+# file #includes the .mdh files for any module dependencies, then each of
+# $headers, and then each .epro (for global declarations).  It will
+# be recreated if any of the dependency .mdh files changes, or if any of
+# $headers or $hdrdeps changes.  When anything depends on it, all the .epros
+# and $otherincs will be made up to date, but the .mdh file won't actually
+# be rebuilt if those files change.
+#
+# The order of sections of the output file is thus:
+#   simple generated macros
+#   macros generated from *.mdd
+#   included Makemod.in.in
+#   rules generated from *.mdd
+# The order dependencies are basically that the generated macros are required
+# in Makemod.in.in, but some of the macros that it creates are needed in the
+# later rules.
+#
+
+# sed script to normalise a pathname
+sed_normalise='
+    s,^,/,
+    s,$,/,
+    :1
+    s,/\./,/,
+    t1
+    :2
+    s,/[^/.][^/]*/\.\./,/,
+    s,/\.[^/.][^/]*/\.\./,/,
+    s,/\.\.[^/][^/]*/\.\./,/,
+    t2
+    s,^/$,.,
+    s,^/,,
+    s,\(.\)/$,\1,
+'
+
+# decide which stages to process
+first_stage=true
+second_stage=true
+if test ."$1" = .-m; then
+    shift
+    first_stage=false
+elif test ."$1" = .-i; then
+    shift
+    second_stage=false
+fi
+
+top_srcdir=`echo $top_srcdir | sed "$sed_normalise"`
+the_subdir=$1
+the_makefile=$2
+
+if $first_stage; then
+
+    dir_top=`echo $the_subdir | sed 's,[^/][^/]*,..,g'`
+
+    trap "rm -f $the_subdir/${the_makefile}.in" 1 2 15
+    echo "creating $the_subdir/${the_makefile}.in"
+    exec 3>&1 >$the_subdir/${the_makefile}.in
+    echo "##### ${the_makefile}.in generated automatically by mkmakemod.sh"
+    echo "##### DO NOT EDIT!"
+    echo
+    echo "##### ===== DEFINITIONS ===== #####"
+    echo
+    echo "makefile = ${the_makefile}"
+    echo "dir_top = ${dir_top}"
+    echo "subdir = ${the_subdir}"
+    echo
+
+    bin_mods=`grep link=static ./config.modules | \
+    sed -e '/^#/d' -e 's/ .*/ /' -e 's/^name=/ /'`
+    dyn_mods="`grep link=dynamic ./config.modules | \
+    sed -e '/^#/d' -e 's/ .*/ /' -e 's/^name=/ /'`"
+    module_list="${bin_mods}${dyn_mods}"
+
+    # check both 2.13 and 2.50 syntax
+    if grep '%_@_D_@_%D%' config.status >/dev/null ||
+       grep ',_@_D_@_,D,' config.status >/dev/null; then
+	is_dynamic=true
+    else
+	is_dynamic=false
+    fi
+
+    here_mddnames=
+    all_subdirs=
+    all_modobjs=
+    all_modules=
+    all_mdds=
+    all_mdhs=
+    all_proto=
+    lastsub=//
+    for module in $module_list; do
+        modfile="`grep '^name='$module' ' ./config.modules | \
+	  sed -e 's/^.* modfile=//' -e 's/ .*//'`"
+	case $modfile in
+	    $the_subdir/$lastsub/*) ;;
+	    $the_subdir/*/*)
+		lastsub=`echo $modfile | sed 's,^'$the_subdir'/,,;s,/[^/]*$,,'`
+		case "$all_subdirs " in
+		    *" $lastsub "* ) ;;
+		    * )
+			all_subdirs="$all_subdirs $lastsub"
+		    ;;
+		esac
+		;;
+	    $the_subdir/*)
+		mddname=`echo $modfile | sed 's,^.*/,,;s,\.mdd$,,'`
+		here_mddnames="$here_mddnames $mddname"
+		build=$is_dynamic
+		case $is_dynamic_@_$bin_mods in
+		    *" $module "*)
+			build=true
+			all_modobjs="$all_modobjs modobjs.${mddname}" ;;
+		    true_@_*)
+			all_modules="$all_modules ${mddname}.\$(DL_EXT)" ;;
+		esac
+		all_mdds="$all_mdds ${mddname}.mdd"
+		$build && all_mdhs="$all_mdhs ${mddname}.mdh"
+		$build && all_proto="$all_proto proto.${mddname}"
+		;;
+	esac
+    done
+    echo "MODOBJS =$all_modobjs"
+    echo "MODULES =$all_modules"
+    echo "MDDS    =$all_mdds"
+    echo "MDHS    =$all_mdhs"
+    echo "PROTOS  =$all_proto"
+    echo "SUBDIRS =$all_subdirs"
+    echo
+    echo "ENTRYOBJ = \$(dir_src)/modentry..o"
+    echo "NNTRYOBJ ="
+    echo "ENTRYOPT = -emodentry"
+    echo "NNTRYOPT ="
+    echo
+
+    echo "##### ===== INCLUDING Makemod.in.in ===== #####"
+    echo
+    cat $top_srcdir/Src/Makemod.in.in
+    echo
+
+    case $the_subdir in
+	Src) modobjs_sed= ;;
+	Src/*) modobjs_sed="| sed 's\" \" "`echo $the_subdir | sed 's,^Src/,,'`"/\"g' " ;;
+	*) modobjs_sed="| sed 's\" \" ../$the_subdir/\"g' " ;;
+    esac
+
+    other_mdhs=
+    remote_mdhs=
+    other_exports=
+    remote_exports=
+    other_modules=
+    remote_modules=
+    for mddname in $here_mddnames; do
+
+	unset name moddeps nozshdep alwayslink hasexport
+	unset autobins autoinfixconds autoprefixconds autoparams automathfuncs
+	unset objects proto headers hdrdeps otherincs autoconf achfile
+	. $top_srcdir/$the_subdir/${mddname}.mdd
+	q_name=`echo $name | sed 's,Q,Qq,g;s,_,Qu,g;s,/,Qs,g'`
+	test -n "${moddeps+set}" || moddeps=
+	test -n "$nozshdep" || moddeps="$moddeps zsh/main"
+	test -n "${proto+set}" ||
+	    proto=`echo $objects '' | sed 's,\.o ,.syms ,g'`
+
+	dobjects=`echo $objects '' | sed 's,\.o ,..o ,g'`
+	modhdeps=
+	mododeps=
+	exportdeps=
+	imports=
+	q_moddeps=
+	for dep in $moddeps; do
+	    depfile="`grep '^name='$dep' ' ./config.modules | \
+	      sed -e 's/^.* modfile=//' -e 's/ .*//'`"
+	    q_dep=`echo $dep | sed 's,Q,Qq,g;s,_,Qu,g;s,/,Qs,g'`
+	    q_moddeps="$q_moddeps $q_dep"
+	    eval `echo $depfile | sed 's,/\([^/]*\)\.mdd$,;depbase=\1,;s,^,loc=,'`
+	    case "$binmod" in
+		*" $dep "* )
+		    dep=zsh/main
+		;;
+	    esac
+
+	    case $the_subdir in
+		$loc)
+		    mdh="${depbase}.mdh"
+		    export="${depbase}.export"
+		    case "$dep" in
+			zsh/main )
+			    mdll="\$(dir_top)/Src/libzsh-\$(VERSION).\$(DL_EXT) "
+			;;
+			* )
+			    mdll="${depbase}.\$(DL_EXT) "
+			;;
+		    esac
+		    ;;
+		$loc/*)
+		    mdh="\$(dir_top)/$loc/${depbase}.mdh"
+		    case "$other_mdhs " in
+			*" $mdh "*) ;;
+			*) other_mdhs="$other_mdhs $mdh" ;;
+		    esac
+		    export="\$(dir_top)/$loc/${depbase}.export"
+		    case "$other_exports " in
+			*" $export "*) ;;
+			*) other_exports="$other_exports $export" ;;
+		    esac
+		    case "$dep" in
+			zsh/main )
+			    mdll="\$(dir_top)/Src/libzsh-\$(VERSION).\$(DL_EXT) "
+			;;
+			* )
+			    mdll="\$(dir_top)/$loc/${depbase}.\$(DL_EXT) "
+			;;
+		    esac
+		    case "$other_modules " in
+			*" $mdll "*) ;;
+			*) other_modules="$other_modules $mdll" ;;
+		    esac
+		    ;;
+		*)
+		    mdh="\$(dir_top)/$loc/${depbase}.mdh"
+		    case "$remote_mdhs " in
+			*" $mdh "*) ;;
+			*) remote_mdhs="$remote_mdhs $mdh" ;;
+		    esac
+		    export="\$(dir_top)/$loc/${depbase}.export"
+		    case "$remote_exports " in
+			*" $export "*) ;;
+			*) remote_exports="$remote_exports $export" ;;
+		    esac
+		    case "$dep" in
+			zsh/main )
+			    mdll="\$(dir_top)/Src/libzsh-\$(VERSION).\$(DL_EXT) "
+			;;
+			* )
+			    mdll="\$(dir_top)/$loc/${depbase}.\$(DL_EXT) "
+			;;
+		    esac
+		    case "$remote_modules " in
+			*" $mdll "*) ;;
+			*) remote_modules="$remote_modules $mdll" ;;
+		    esac
+		    ;;
+	    esac
+	    modhdeps="$modhdeps $mdh"
+	    exportdeps="$exportdeps $export"
+	    imports="$imports \$(IMPOPT)$export"
+	    case "$mododeps " in
+		*" $mdll "* )
+		    :
+		;;
+		* )
+		    mododeps="$mododeps $mdll"
+		;;
+	    esac
+	done
+
+	echo "##### ===== DEPENDENCIES GENERATED FROM ${mddname}.mdd ===== #####"
+	echo
+	echo "MODOBJS_${mddname} = $objects"
+	echo "MODDOBJS_${mddname} = $dobjects \$(_@_E_@_NTRYOBJ)"
+	echo "SYMS_${mddname} = $proto"
+	echo "EPRO_${mddname} = "`echo $proto '' | sed 's,\.syms ,.epro ,g'`
+	echo "INCS_${mddname} = \$(EPRO_${mddname}) $otherincs"
+	echo "EXPIMP_${mddname} = $imports \$(EXPOPT)$mddname.export"
+	echo "NXPIMP_${mddname} ="
+	echo "LINKMODS_${mddname} = $mododeps"
+	echo "NOLINKMODS_${mddname} = "
+	echo
+	echo "proto.${mddname}: \$(EPRO_${mddname})"
+	echo "\$(SYMS_${mddname}): \$(PROTODEPS)"
+	echo
+	echo "${mddname}.export: \$(SYMS_${mddname})"
+	echo "	( echo '#!'; cat \$(SYMS_${mddname}) | sed -n '/^X/{s/^X//;p;}' | sort -u ) > \$_@_"
+	echo
+	echo "modobjs.${mddname}: \$(MODOBJS_${mddname})"
+	echo "	echo '' \$(MODOBJS_${mddname}) $modobjs_sed>> \$(dir_src)/stamp-modobjs.tmp"
+	echo
+
+	if test -n "$autoconf"; then
+	    echo "@am__include@ @am__quote@${mddname}.rules@am__quote@"
+	    echo
+	    echo "${mddname}.ach ${mddname}.rules: \$(sdir_src)/Modules/${mddname}.configure"
+	    echo "	\$(sdir_src)/Modules/${mddname}.configure"
+	    echo
+	    echo "\$(sdir_src)/Modules/${mddname}.configure: ${mddname}.configure.ac ${mddname}.ach.in"
+	    echo "	cd \$(sdir_src)/Modules && autoconf ${mddname}.configure.ac >${mddname}.configure"
+	    echo "	chmod +x \$(sdir_src)/Modules/pcre.configure"
+	    echo
+	    echo "${mddname}.ach.in:"
+	    echo "	cd \$(sdir_src)/Modules && autoheader ${mddname}.configure.ac"
+	achfile="${mddname}.ach"
+	fi
+
+	if test -z "$alwayslink"; then
+	    case " $all_modules" in *" ${mddname}."*)
+		echo "install.modules-here: install.modules.${mddname}"
+		echo "uninstall.modules-here: uninstall.modules.${mddname}"
+		echo
+	    ;; esac
+	    instsubdir=`echo $name | sed 's,^,/,;s,/[^/]*$,,'`
+	    echo "install.modules.${mddname}: ${mddname}.\$(DL_EXT)"
+	    echo "	\$(SHELL) \$(sdir_top)/mkinstalldirs \$(DESTDIR)\$(MODDIR)${instsubdir}"
+	    echo "	\$(INSTALL_PROGRAM) \$(STRIPFLAGS) ${mddname}.\$(DL_EXT) \$(DESTDIR)\$(MODDIR)/${name}.\$(DL_EXT)"
+	    echo
+	    echo "uninstall.modules.${mddname}:"
+	    echo "	rm -f \$(DESTDIR)\$(MODDIR)/${name}.\$(DL_EXT)"
+	    echo
+	    echo "${mddname}.\$(DL_EXT): \$(MODDOBJS_${mddname}) ${mddname}.export $exportdeps \$(_@_LINKMODS_@__${mddname})"
+	    echo '	rm -f $_@_'
+	    echo "	\$(DLLINK) \$(_@_E_@_XPIMP_$mddname) \$(_@_E_@_NTRYOPT) \$(MODDOBJS_${mddname}) \$(_@_LINKMODS_@__${mddname}) \$(LIBS) \$(EXTRALIBS_${mddname}) "
+	    echo
+	fi
+	echo "${mddname}.mdhi: ${mddname}.mdhs \$(INCS_${mddname})"
+	echo "	_@_test -f \$_@_ || echo 'do not delete this file' > \$_@_"
+	echo
+	echo "${mddname}.mdhs: ${mddname}.mdd"
+	echo "	_@_\$(MAKE) -f \$(makefile) \$(MAKEDEFS) ${mddname}.mdh.tmp"
+	echo "	_@_if cmp -s ${mddname}.mdh ${mddname}.mdh.tmp; then \\"
+	echo "	    rm -f ${mddname}.mdh.tmp; \\"
+	echo "	    echo \"\\\`${mddname}.mdh' is up to date.\"; \\"
+	echo "	else \\"
+	echo "	    mv -f ${mddname}.mdh.tmp ${mddname}.mdh; \\"
+	echo "	    echo \"Updated \\\`${mddname}.mdh'.\"; \\"
+	echo "	fi"
+	echo "	echo 'timestamp for ${mddname}.mdh against ${mddname}.mdd' > \$_@_"
+	echo
+	echo "${mddname}.mdh: ${modhdeps} ${headers} ${hdrdeps} ${mddname}.mdhi"
+	echo "	_@_\$(MAKE) -f \$(makefile) \$(MAKEDEFS) ${mddname}.mdh.tmp"
+	echo "	_@_mv -f ${mddname}.mdh.tmp ${mddname}.mdh"
+	echo "	_@_echo \"Updated \\\`${mddname}.mdh'.\""
+	echo
+	echo "${mddname}.mdh.tmp:"
+	echo "	_@_( \\"
+	echo "	    echo '#ifndef have_${q_name}_module'; \\"
+	echo "	    echo '#define have_${q_name}_module'; \\"
+	echo "	    echo; \\"
+	echo "	    echo '# ifndef IMPORTING_MODULE_${q_name}'; \\"
+	echo "	    if test _@_SHORTBOOTNAMES_@_ = yes; then \\"
+	echo "		echo '#  ifndef MODULE'; \\"
+	echo "	    fi; \\"
+	echo "	    echo '#   define boot_ boot_${q_name}'; \\"
+	echo "	    echo '#   define cleanup_ cleanup_${q_name}'; \\"
+	echo "	    echo '#   define setup_ setup_${q_name}'; \\"
+	echo "	    echo '#   define finish_ finish_${q_name}'; \\"
+	echo "	    if test _@_SHORTBOOTNAMES_@_ = yes; then \\"
+	echo "		echo '#  endif /* !MODULE */'; \\"
+	echo "	    fi; \\"
+	echo "	    echo '# endif /* !IMPORTING_MODULE_${q_name} */'; \\"
+	echo "	    echo; \\"
+	if test -n "$moddeps"; then (
+	    set x $q_moddeps
+	    echo "	    echo '/* Module dependencies */'; \\"
+	    for hdep in $modhdeps; do
+		shift
+		echo "	    echo '# define IMPORTING_MODULE_${1} 1'; \\"
+		echo "	    echo '# include \"${hdep}\"'; \\"
+	    done
+	    echo "	    echo; \\"
+	) fi
+	if test -n "$headers"; then
+	    echo "	    echo '/* Extra headers for this module */'; \\"
+	    echo "	    for hdr in $headers; do \\"
+	    echo "		if test -f \$\$hdr; then \\"
+	    echo "		    echo '# include \"'\$\$hdr'\"'; \\"
+	    echo "		else \\"
+	    echo "		    echo '# include \"\$(sdir)/'\$\$hdr'\"'; \\"
+	    echo "		fi; \\"
+	    echo "	    done; \\"
+	    echo "	    echo; \\"
+	fi
+	if test -n "$proto"; then
+	    echo "	    echo '# undef mod_import_variable'; \\"
+	    echo "	    echo '# undef mod_import_function'; \\"
+	    echo "	    echo '# if defined(IMPORTING_MODULE_${q_name}) &&  defined(MODULE)'; \\"
+	    echo "	    echo '#  define mod_import_variable _@_MOD_IMPORT_VARIABLE_@_'; \\"
+	    echo "	    echo '#  define mod_import_function _@_MOD_IMPORT_FUNCTION_@_'; \\"
+	    echo "	    echo '# else'; \\"
+	    echo "	    echo '#  define mod_import_function'; \\"
+	    echo "	    echo '#  define mod_import_variable'; \\"
+	    echo "	    echo '# endif /* IMPORTING_MODULE_${q_name} && MODULE */'; \\"
+	    echo "	    for epro in \$(EPRO_${mddname}); do \\"
+	    echo "		echo '# include \"'\$\$epro'\"'; \\"
+	    echo "	    done; \\"
+	    echo "	    echo '# undef mod_import_variable'; \\"
+	    echo "	    echo '# define mod_import_variable'; \\"
+	    echo "	    echo '# undef mod_import_variable'; \\"
+	    echo "	    echo '# define mod_import_variable'; \\"
+	    echo "	    echo '# ifndef mod_export'; \\"
+	    echo "	    echo '#  define mod_export _@_MOD_EXPORT_@_'; \\"
+	    echo "	    echo '# endif /* mod_export */'; \\"
+	    echo "	    echo; \\"
+	fi
+	echo "	    echo '#endif /* !have_${q_name}_module */'; \\"
+	echo "	) > \$_@_"
+	echo
+	echo "\$(MODOBJS_${mddname}) \$(MODDOBJS_${mddname}): ${mddname}.mdh $achfile"
+	sed -e '/^ *: *<< *\\Make *$/,/^Make$/!d' \
+	    -e 's/^ *: *<< *\\Make *$//; /^Make$/d' \
+	    < $top_srcdir/$the_subdir/${mddname}.mdd
+	echo
+
+    done
+
+    if test -n "$remote_mdhs$other_mdhs$remote_exports$other_exports$remote_modules$other_modules"; then
+	echo "##### ===== DEPENDENCIES FOR REMOTE MODULES ===== #####"
+	echo
+	for mdh in $remote_mdhs; do
+	    echo "$mdh: FORCE"
+	    echo "	_@_cd _@_%_@_ && \$(MAKE) \$(MAKEDEFS) _@_%_@_$mdh"
+	    echo
+	done | sed 's,^\(.*\)_@_%_@_\(.*\)_@_%_@_\(.*\)/\([^/]*\)$,\1\3\2\4,'
+	if test -n "$other_mdhs"; then
+	    echo "${other_mdhs}:" | sed 's,^ ,,'
+	    echo "	false # should only happen with make -n"
+	    echo
+	fi
+	for export in $remote_exports; do
+	    echo "$export: FORCE"
+	    echo "	_@_cd _@_%_@_ && \$(MAKE) \$(MAKEDEFS) _@_%_@_$export"
+	    echo
+	done | sed 's,^\(.*\)_@_%_@_\(.*\)_@_%_@_\(.*\)/\([^/]*\)$,\1\3\2\4,'
+	if test -n "$other_exports"; then
+	    echo "${other_exports}:" | sed 's,^ ,,'
+	    echo "	false # should only happen with make -n"
+	    echo
+	fi
+	for mdll in $remote_modules; do
+	    echo "$mdll: FORCE"
+	    echo "	_@_cd _@_%_@_ && \$(MAKE) \$(MAKEDEFS) _@_%_@_$mdll"
+	    echo
+	done | sed 's,^\(.*\)_@_%_@_\(.*\)_@_%_@_\(.*\)/\([^/]*\)$,\1\3\2\4,'
+	if test -n "$other_modules"; then
+	    echo "${other_modules}:" | sed 's,^ ,,'
+	    echo "	false # should only happen with make -n"
+	    echo
+	fi
+    fi
+
+    echo "##### End of ${the_makefile}.in"
+
+    exec >&3 3>&-
+
+fi
+
+if $second_stage ; then
+    trap "rm -f $the_subdir/${the_makefile}" 1 2 15
+
+    ${CONFIG_SHELL-/bin/sh} ./config.status \
+	--file=$the_subdir/${the_makefile}:$the_subdir/${the_makefile}.in ||
+    return 1
+fi
+
+exit 0
Index: Src/Modules/.cvsignore
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/.cvsignore,v
retrieving revision 1.4
diff -u -r1.4 .cvsignore
--- Src/Modules/.cvsignore	3 Nov 2003 02:51:21 -0000	1.4
+++ Src/Modules/.cvsignore	28 Feb 2004 19:59:41 -0000
@@ -15,3 +15,4 @@
 *.swp
 errnames.c errcount.h
 *.dll
+*.rules
Index: Src/Modules/pcre.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/pcre.c,v
retrieving revision 1.5
diff -u -r1.5 pcre.c
--- Src/Modules/pcre.c	27 Aug 2002 21:10:34 -0000	1.5
+++ Src/Modules/pcre.c	28 Feb 2004 19:59:41 -0000
@@ -30,6 +30,7 @@
 
 #include "pcre.mdh"
 #include "pcre.pro"
+#include "pcre.ach"
 
 /**/
 #if defined(HAVE_PCRE_COMPILE) && defined(HAVE_PCRE_EXEC)
Index: Src/Modules/pcre.configure.ac
===================================================================
RCS file: Src/Modules/pcre.configure.ac
diff -N Src/Modules/pcre.configure.ac
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Src/Modules/pcre.configure.ac	28 Feb 2004 19:59:41 -0000
@@ -0,0 +1,46 @@
+dnl
+dnl  pcre.ac: Configure template for zsh/pcre module.
+dnl  Process this file with autoconf to produce a configure script.
+dnl
+dnl  Copyright (c) 2002, 2004 Clint Adams
+dnl
+dnl  Permission is hereby granted, without written agreement and without
+dnl  license or royalty fees, to use, copy, modify, and distribute this
+dnl  software and to distribute modified versions of this software for any
+dnl  purpose, provided that the above copyright notice and the following
+dnl  two paragraphs appear in all copies of this software.
+dnl
+dnl  In no event shall Clint Adams or the Zsh Development Group be liable
+dnl  to any party for direct, indirect, special, incidental, or consequential
+dnl  damages arising out of the use of this software and its documentation,
+dnl  even if Clint Adams and the Zsh Development Group have been advised of
+dnl  the possibility of such damage.
+dnl
+dnl  Clint Adams and the Zsh Development Group specifically disclaim any
+dnl  warranties, including, but not limited to, the implied warranties of
+dnl  merchantability and fitness for a particular purpose.  The software
+dnl  provided hereunder is on an "as is" basis, and Clint Adams and
+the
+dnl  Zsh Development Group have no obligation to provide maintenance,
+dnl  support, updates, enhancements, or modifications.
+dnl
+
+AC_INIT
+AC_CONFIG_SRCDIR([pcre.c])
+AC_PREREQ(2.59)
+
+AC_CONFIG_HEADER(pcre.ach)
+
+oldcflags="$CFLAGS"
+AC_CHECK_PROG([PCRECONF], pcre-config, pcre-config)
+if test "x$ac_cv_prog_PCRECONF" = xpcre-config; then
+  CPPFLAGS="$CPPFLAGS `pcre-config --cflags`"
+fi
+
+AC_CHECK_HEADERS(pcre.h)
+
+AC_SEARCH_LIBS(pcre_compile, pcre)
+AC_CHECK_FUNCS(pcre_compile pcre_study pcre_exec)
+
+AC_CONFIG_FILES([pcre.rules])
+AC_OUTPUT
Index: Src/Modules/pcre.mdd
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/pcre.mdd,v
retrieving revision 1.2
diff -u -r1.2 pcre.mdd
--- Src/Modules/pcre.mdd	6 Jul 2001 08:32:16 -0000	1.2
+++ Src/Modules/pcre.mdd	28 Feb 2004 19:59:41 -0000
@@ -5,3 +5,5 @@
 autobins="pcre_compile pcre_study pcre_match"
 
 objects="pcre.o"
+
+autoconf=yes
Index: Src/Modules/pcre.rules.in
===================================================================
RCS file: Src/Modules/pcre.rules.in
diff -N Src/Modules/pcre.rules.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Src/Modules/pcre.rules.in	28 Feb 2004 19:59:41 -0000
@@ -0,0 +1 @@
+EXTRALIBS_pcre = @LIBS@


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: redo of 16845
  2004-02-28 20:22 redo of 16845 Clint Adams
@ 2004-02-28 20:53 ` Clint Adams
  2004-02-28 21:44   ` Clint Adams
  2004-02-29 19:22 ` Peter Stephenson
  1 sibling, 1 reply; 10+ messages in thread
From: Clint Adams @ 2004-02-28 20:53 UTC (permalink / raw)
  To: zsh-workers

> This appears to work for GNU make.  FreeBSD 4.9's make chokes before the
> included file has been created.  I haven't tested with Solaris's make
> yet.

This works with GNU make and FreeBSD; still haven't tried Solaris.


Index: aclocal.m4
===================================================================
RCS file: /cvsroot/zsh/zsh/aclocal.m4,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 aclocal.m4
--- aclocal.m4	6 Aug 1999 18:01:38 -0000	1.1.1.3
+++ aclocal.m4	28 Feb 2004 20:45:38 -0000
@@ -1,59 +1,5 @@
-# Local additions to Autoconf macros.
-# Copyright (C) 1992, 1994 Free Software Foundation, Inc.
-# Francois Pinard <pinard@iro.umontreal.ca>, 1992.
-
-# @defmac fp_PROG_CC_STDC
-# @maindex PROG_CC_STDC
-# @ovindex CC
-# If the C compiler in not in ANSI C mode by default, try to add an option
-# to output variable @code{CC} to make it so.  This macro tries various
-# options that select ANSI C on some system or another.  It considers the
-# compiler to be in ANSI C mode if it defines @code{__STDC__} to 1 and
-# handles function prototypes correctly.
-# 
-# If you use this macro, you should check after calling it whether the C
-# compiler has been set to accept ANSI C; if not, the shell variable
-# @code{fp_cv_prog_cc_stdc} is set to @samp{no}.  If you wrote your source
-# code in ANSI C, you can make an un-ANSIfied copy of it by using the
-# program @code{ansi2knr}, which comes with Ghostscript.
-# @end defmac
-
-define(fp_PROG_CC_STDC,
-[AC_CACHE_CHECK(for ${CC-cc} option to accept ANSI C,
-fp_cv_prog_cc_stdc,
-[fp_cv_prog_cc_stdc=no
-ac_save_CFLAGS="$CFLAGS"
-# Don't try gcc -ansi; that turns off useful extensions and
-# breaks some systems' header files.
-# AIX			-qlanglvl=ansi
-# Ultrix and OSF/1	-std1
-# HP-UX			-Ae  or  -Aa -D_HPUX_SOURCE
-# SVR4			-Xc
-#  For HP-UX, we try -Ae first; this turns on ANSI but also extensions,
-#  as well as defining _HPUX_SOURCE, and we can then use long long.
-#  We keep the old version for backward compatibility.
-for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" -Xc
-do
-  CFLAGS="$ac_save_CFLAGS $ac_arg"
-  AC_TRY_COMPILE(
-[#ifndef __STDC__
-choke me
-#endif	
-], [int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};],
-[fp_cv_prog_cc_stdc="$ac_arg"; break])
-done
-CFLAGS="$ac_save_CFLAGS"
-])
-case "x$fp_cv_prog_cc_stdc" in
-  x|xno) ;;
-  *) CC="$CC $fp_cv_prog_cc_stdc" ;;
-esac
-])
-
-AC_DEFUN(AC_PROG_LN,
-[AC_MSG_CHECKING(whether ln works)
+AC_DEFUN([AC_PROG_LN],
+[AC_MSG_CHECKING([whether ln works])
 AC_CACHE_VAL(ac_cv_prog_LN,
 [rm -f conftestdata conftestlink
 echo > conftestdata
@@ -74,4 +20,67 @@
 AC_SUBST(LN)dnl
 ])
 
+# Check to see how 'make' treats includes.	-*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 2
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+	@echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+   am__include=include
+   am__quote=
+   _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+      am__include=.include
+      am__quote="\""
+      _am_result=BSD
+   fi
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
 builtin(include, aczsh.m4)
Index: configure.ac
===================================================================
RCS file: /cvsroot/zsh/zsh/configure.ac,v
retrieving revision 1.10
diff -u -r1.10 configure.ac
--- configure.ac	27 Feb 2004 10:17:38 -0000	1.10
+++ configure.ac	28 Feb 2004 20:45:39 -0000
@@ -402,7 +402,6 @@
 AC_PROG_GCC_TRADITIONAL     dnl Do we need -traditional flag for gcc.
 AC_C_CONST                  dnl Does compiler support `const'.
 
-fp_PROG_CC_STDC
 AC_MSG_CHECKING([whether to use prototypes])
 if test ."$ansi2knr" = .yes || test ."$ansi2knr" = .no; then
   msg="(overridden) "
@@ -494,22 +493,12 @@
 AC_HEADER_STAT
 AC_HEADER_SYS_WAIT
 
-oldcflags="$CFLAGS"
-AC_CHECK_PROG([PCRECONF], pcre-config, pcre-config)
-dnl Typically (meaning on this single RedHat 9 box in front of me)
-dnl pcre-config --cflags produces a -I output which needs to go into
-dnl CPPFLAGS else configure's preprocessor tests don't pick it up,
-dnl producing a warning.
-if test "x$ac_cv_prog_PCRECONF" = xpcre-config; then
-  CPPFLAGS="$CPPFLAGS `pcre-config --cflags`"
-fi
-
 AC_CHECK_HEADERS(sys/time.h sys/times.h sys/select.h termcap.h termio.h \
 		 termios.h sys/param.h sys/filio.h string.h memory.h \
 		 limits.h fcntl.h libc.h sys/utsname.h sys/resource.h \
 		 locale.h errno.h stdio.h stdlib.h unistd.h sys/capability.h \
 		 utmp.h utmpx.h sys/types.h pwd.h grp.h poll.h sys/mman.h \
-		 netinet/in_systm.h pcre.h langinfo.h wchar.h stddef.h \
+		 netinet/in_systm.h langinfo.h wchar.h stddef.h \
 		 sys/stropts.h)
 if test $dynamic = yes; then
   AC_CHECK_HEADERS(dlfcn.h)
@@ -598,15 +587,15 @@
 AC_ARG_WITH(curses-terminfo,
 [  --with-curses-terminfo     use terminfo support from curses library],
 [if test x$withval = xyes; then
-  termcap_curses_order="tinfo curses ncurses termcap"
+  termcap_curses_order="curses ncurses termcap"
   AC_SEARCH_LIBS(tigetstr, [$termcap_curses_order])
 else
-  termcap_curses_order="tinfo termcap curses ncurses"
+  termcap_curses_order="termcap curses ncurses"
 fi],
 [case "$host_os" in
   hpux10.*|hpux11.*|solaris*)
       termcap_curses_order="Hcurses curses ncurses termcap" ;;
-  *)             termcap_curses_order="tinfo termcap curses ncurses" ;;
+  *)             termcap_curses_order="termcap curses ncurses" ;;
 esac])dnl
 
 AH_TEMPLATE([HAVE_BOOLCODES],
@@ -708,9 +697,6 @@
 
 AC_CHECK_LIB(iconv, iconv)
 
-dnl pcre-config should probably be employed here
-AC_SEARCH_LIBS(pcre_compile, pcre)
-
 dnl ---------------------
 dnl CHECK TERMCAP LIBRARY
 dnl ---------------------
@@ -1029,7 +1015,6 @@
 	       brk sbrk \
 	       pathconf sysconf \
 	       tgetent tigetflag tigetnum tigetstr setupterm \
-	       pcre_compile pcre_study pcre_exec \
 	       nl_langinfo \
 	       erand48 open_memstream \
 	       wctomb iconv \
@@ -2367,9 +2352,13 @@
 AC_SUBST_FILE(DEFS_MK)dnl
 AC_SUBST_FILE(VERSION_MK)dnl
 
+AM_MAKE_INCLUDE
+
 AC_CONFIG_FILES(Config/defs.mk Makefile Doc/Makefile Etc/Makefile \
-Src/Makefile Test/Makefile)
+Src/Makefile Test/Makefile Src/mkmakemod.sh.in)
 AC_CONFIG_COMMANDS([config.modules], [. ./config.modules.sh])
+AC_CONFIG_COMMANDS([Src/mkmakemod.sh],
+ [sed "s/_@_/@/g" Src/mkmakemod.sh.in >Src/mkmakemod.sh])
 
 AC_OUTPUT
 
@@ -2410,4 +2399,3 @@
 echo "See config.modules for installed modules and functions.
 "
 
-
Index: Src/Makefile.in
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Makefile.in,v
retrieving revision 1.12
diff -u -r1.12 Makefile.in
--- Src/Makefile.in	20 Dec 2001 23:48:39 -0000	1.12
+++ Src/Makefile.in	28 Feb 2004 20:45:40 -0000
@@ -109,16 +109,16 @@
 
 @CONFIG_MK@
 
-Makemod prep: $(CONFIG_INCS) $(dir_top)/config.modules
+Makemod prep: $(CONFIG_INCS) $(dir_top)/config.modules mkmakemod.sh
 	@case $(sdir_top) in \
 	    /*) top_srcdir=$(sdir_top) ;; \
 	    *) top_srcdir=$(subdir)/$(sdir_top) ;; \
 	esac; \
 	export top_srcdir; \
 	echo 'cd $(dir_top) && $(SHELL)' \
-	    '$$top_srcdir/$(subdir)/mkmakemod.sh $(subdir) Makemod'; \
+	    '$(subdir)/mkmakemod.sh $(subdir) Makemod'; \
 	cd $(dir_top) && \
-	    $(SHELL) $$top_srcdir/$(subdir)/mkmakemod.sh $(subdir) Makemod
+	    $(SHELL) $(subdir)/mkmakemod.sh $(subdir) Makemod
 	@$(MAKE) -f Makemod $(MAKEDEFS) prep || rm -f Makemod
 .PHONY: prep
 
@@ -191,6 +191,7 @@
 clean-here:
 	rm -f modules.stamp zsh$(EXEEXT)
 	rm -f libzsh-*.$(DL_EXT)
+	rm -f mkmakemod.sh.in mkmakemod.sh
 .PHONY: clean-here
 
 distclean-here:
Index: Src/Makemod.in.in
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Makemod.in.in,v
retrieving revision 1.5
diff -u -r1.5 Makemod.in.in
--- Src/Makemod.in.in	20 Dec 2001 23:48:39 -0000	1.5
+++ Src/Makemod.in.in	28 Feb 2004 20:45:40 -0000
@@ -111,7 +111,7 @@
 	for subdir in $$subdirs; do \
 	    dir=$(subdir)/$$subdir; \
 	    test -d $$dir || mkdir $$dir; \
-	    $(SHELL) $$top_srcdir/Src/mkmakemod.sh $$dir Makefile || exit 1; \
+	    $(SHELL) Src/mkmakemod.sh $$dir Makefile || exit 1; \
 	    ( cd $$dir && $(MAKE) $(MAKEDEFS) $@ ) || exit 1; \
 	done
 .PHONY: prep
@@ -149,7 +149,8 @@
 .PHONY: mostlyclean-here
 
 clean-here:
-	rm -f *.o.c *.syms *.pro *.epro *.mdh *.mdhi *.mdhs *.mdh.tmp
+	rm -f *.o.c *.syms *.pro *.epro *.mdh *.mdhi *.mdhs *.mdh.tmp \
+	*.configure *.ach config.cache config.status config.log *.rules
 .PHONY: clean-here
 
 distclean-here:
@@ -173,11 +174,11 @@
 	esac; \
 	export top_srcdir; \
 	echo 'cd $(dir_top) && $(SHELL)' \
-	    '$$top_srcdir/Src/mkmakemod.sh -m $(subdir) $(makefile)'; \
+	    'Src/mkmakemod.sh -m $(subdir) $(makefile)'; \
 	cd $(dir_top) && \
-	    $(SHELL) $$top_srcdir/Src/mkmakemod.sh -m $(subdir) $(makefile)
+	    $(SHELL) Src/mkmakemod.sh -m $(subdir) $(makefile)
 
-$(makefile).in: $(sdir_src)/mkmakemod.sh $(sdir_src)/Makemod.in.in $(MDDS) \
+$(makefile).in: $(dir_top)/Src/mkmakemod.sh $(sdir_src)/Makemod.in.in $(MDDS) \
 	$(dir_top)/config.modules
 	@case $(sdir_top) in \
 	    /*) top_srcdir=$(sdir_top) ;; \
@@ -185,7 +186,6 @@
 	esac; \
 	export top_srcdir; \
 	echo 'cd $(dir_top) && $(SHELL)' \
-	    '$$top_srcdir/Src/mkmakemod.sh -i $(subdir) $(makefile)'; \
+	    'Src/mkmakemod.sh -i $(subdir) $(makefile)'; \
 	cd $(dir_top) && \
-	    $(SHELL) $$top_srcdir/Src/mkmakemod.sh -i $(subdir) $(makefile)
-
+	    $(SHELL) Src/mkmakemod.sh -i $(subdir) $(makefile)
Index: Src/mkmakemod.sh
===================================================================
RCS file: Src/mkmakemod.sh
diff -N Src/mkmakemod.sh
--- Src/mkmakemod.sh	14 Feb 2004 18:50:17 -0000	1.13
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,476 +0,0 @@
-#!/bin/sh
-#
-# mkmakemod.sh: generate Makefile.in files for module building
-#
-# Options:
-#   -m = file is already generated; only build the second stage
-#   -i = do not build second stage
-#
-# Args:
-#   $1 = subdirectory to look in, relative to $top_srcdir
-#   $2 = final output filename, within the $1 directory
-#
-# This script must be run from the top-level build directory, and $top_srcdir
-# must be set correctly in the environment.
-#
-# This looks in $1, and uses all the *.mdd files there.  Each .mdd file
-# defines one module.  The .mdd file is actually a shell script, which will
-# be sourced.  It may define the following shell variables:
-#
-#   name            name of this module
-#   moddeps         modules on which this module depends (default none)
-#   nozshdep        non-empty indicates no dependence on the `zsh/main' pseudo-module
-#   alwayslink      if non-empty, always link the module into the executable
-#   autobins        builtins defined by the module, for autoloading
-#   autoinfixconds  infix condition codes defined by the module, for
-#                   autoloading (without the leading `-')
-#   autoprefixconds like autoinfixconds, but for prefix condition codes
-#   autoparams      parameters defined by the module, for autoloading
-#   automathfuncs   math functions defined by the module, for autoloading
-#   objects         .o files making up this module (*must* be defined)
-#   proto           .syms files for this module (default generated from $objects)
-#   headers         extra headers for this module (default none)
-#   hdrdeps         extra headers on which the .mdh depends (default none)
-#   otherincs       extra headers that are included indirectly (default none)
-#
-# The .mdd file may also include a Makefile.in fragment between lines
-# `:<<\Make' and `Make' -- this will be copied into Makemod.in.
-#
-# The resulting Makemod.in knows how to build each module that is defined.
-# For each module in also knows how to build a .mdh file.  Each source file
-# should #include the .mdh file for the module it is a part of.  The .mdh
-# file #includes the .mdh files for any module dependencies, then each of
-# $headers, and then each .epro (for global declarations).  It will
-# be recreated if any of the dependency .mdh files changes, or if any of
-# $headers or $hdrdeps changes.  When anything depends on it, all the .epros
-# and $otherincs will be made up to date, but the .mdh file won't actually
-# be rebuilt if those files change.
-#
-# The order of sections of the output file is thus:
-#   simple generated macros
-#   macros generated from *.mdd
-#   included Makemod.in.in
-#   rules generated from *.mdd
-# The order dependencies are basically that the generated macros are required
-# in Makemod.in.in, but some of the macros that it creates are needed in the
-# later rules.
-#
-
-# sed script to normalise a pathname
-sed_normalise='
-    s,^,/,
-    s,$,/,
-    :1
-    s,/\./,/,
-    t1
-    :2
-    s,/[^/.][^/]*/\.\./,/,
-    s,/\.[^/.][^/]*/\.\./,/,
-    s,/\.\.[^/][^/]*/\.\./,/,
-    t2
-    s,^/$,.,
-    s,^/,,
-    s,\(.\)/$,\1,
-'
-
-# decide which stages to process
-first_stage=true
-second_stage=true
-if test ."$1" = .-m; then
-    shift
-    first_stage=false
-elif test ."$1" = .-i; then
-    shift
-    second_stage=false
-fi
-
-top_srcdir=`echo $top_srcdir | sed "$sed_normalise"`
-the_subdir=$1
-the_makefile=$2
-
-if $first_stage; then
-
-    dir_top=`echo $the_subdir | sed 's,[^/][^/]*,..,g'`
-
-    trap "rm -f $the_subdir/${the_makefile}.in" 1 2 15
-    echo "creating $the_subdir/${the_makefile}.in"
-    exec 3>&1 >$the_subdir/${the_makefile}.in
-    echo "##### ${the_makefile}.in generated automatically by mkmakemod.sh"
-    echo "##### DO NOT EDIT!"
-    echo
-    echo "##### ===== DEFINITIONS ===== #####"
-    echo
-    echo "makefile = ${the_makefile}"
-    echo "dir_top = ${dir_top}"
-    echo "subdir = ${the_subdir}"
-    echo
-
-    bin_mods=`grep link=static ./config.modules | \
-    sed -e '/^#/d' -e 's/ .*/ /' -e 's/^name=/ /'`
-    dyn_mods="`grep link=dynamic ./config.modules | \
-    sed -e '/^#/d' -e 's/ .*/ /' -e 's/^name=/ /'`"
-    module_list="${bin_mods}${dyn_mods}"
-
-    # check both 2.13 and 2.50 syntax
-    if grep '%@D@%D%' config.status >/dev/null ||
-       grep ',@D@,D,' config.status >/dev/null; then
-	is_dynamic=true
-    else
-	is_dynamic=false
-    fi
-
-    here_mddnames=
-    all_subdirs=
-    all_modobjs=
-    all_modules=
-    all_mdds=
-    all_mdhs=
-    all_proto=
-    lastsub=//
-    for module in $module_list; do
-        modfile="`grep '^name='$module' ' ./config.modules | \
-	  sed -e 's/^.* modfile=//' -e 's/ .*//'`"
-	case $modfile in
-	    $the_subdir/$lastsub/*) ;;
-	    $the_subdir/*/*)
-		lastsub=`echo $modfile | sed 's,^'$the_subdir'/,,;s,/[^/]*$,,'`
-		case "$all_subdirs " in
-		    *" $lastsub "* ) ;;
-		    * )
-			all_subdirs="$all_subdirs $lastsub"
-		    ;;
-		esac
-		;;
-	    $the_subdir/*)
-		mddname=`echo $modfile | sed 's,^.*/,,;s,\.mdd$,,'`
-		here_mddnames="$here_mddnames $mddname"
-		build=$is_dynamic
-		case $is_dynamic@$bin_mods in
-		    *" $module "*)
-			build=true
-			all_modobjs="$all_modobjs modobjs.${mddname}" ;;
-		    true@*)
-			all_modules="$all_modules ${mddname}.\$(DL_EXT)" ;;
-		esac
-		all_mdds="$all_mdds ${mddname}.mdd"
-		$build && all_mdhs="$all_mdhs ${mddname}.mdh"
-		$build && all_proto="$all_proto proto.${mddname}"
-		;;
-	esac
-    done
-    echo "MODOBJS =$all_modobjs"
-    echo "MODULES =$all_modules"
-    echo "MDDS    =$all_mdds"
-    echo "MDHS    =$all_mdhs"
-    echo "PROTOS  =$all_proto"
-    echo "SUBDIRS =$all_subdirs"
-    echo
-    echo "ENTRYOBJ = \$(dir_src)/modentry..o"
-    echo "NNTRYOBJ ="
-    echo "ENTRYOPT = -emodentry"
-    echo "NNTRYOPT ="
-    echo
-
-    echo "##### ===== INCLUDING Makemod.in.in ===== #####"
-    echo
-    cat $top_srcdir/Src/Makemod.in.in
-    echo
-
-    case $the_subdir in
-	Src) modobjs_sed= ;;
-	Src/*) modobjs_sed="| sed 's\" \" "`echo $the_subdir | sed 's,^Src/,,'`"/\"g' " ;;
-	*) modobjs_sed="| sed 's\" \" ../$the_subdir/\"g' " ;;
-    esac
-
-    other_mdhs=
-    remote_mdhs=
-    other_exports=
-    remote_exports=
-    other_modules=
-    remote_modules=
-    for mddname in $here_mddnames; do
-
-	unset name moddeps nozshdep alwayslink hasexport
-	unset autobins autoinfixconds autoprefixconds autoparams automathfuncs
-	unset objects proto headers hdrdeps otherincs
-	. $top_srcdir/$the_subdir/${mddname}.mdd
-	q_name=`echo $name | sed 's,Q,Qq,g;s,_,Qu,g;s,/,Qs,g'`
-	test -n "${moddeps+set}" || moddeps=
-	test -n "$nozshdep" || moddeps="$moddeps zsh/main"
-	test -n "${proto+set}" ||
-	    proto=`echo $objects '' | sed 's,\.o ,.syms ,g'`
-
-	dobjects=`echo $objects '' | sed 's,\.o ,..o ,g'`
-	modhdeps=
-	mododeps=
-	exportdeps=
-	imports=
-	q_moddeps=
-	for dep in $moddeps; do
-	    depfile="`grep '^name='$dep' ' ./config.modules | \
-	      sed -e 's/^.* modfile=//' -e 's/ .*//'`"
-	    q_dep=`echo $dep | sed 's,Q,Qq,g;s,_,Qu,g;s,/,Qs,g'`
-	    q_moddeps="$q_moddeps $q_dep"
-	    eval `echo $depfile | sed 's,/\([^/]*\)\.mdd$,;depbase=\1,;s,^,loc=,'`
-	    case "$binmod" in
-		*" $dep "* )
-		    dep=zsh/main
-		;;
-	    esac
-
-	    case $the_subdir in
-		$loc)
-		    mdh="${depbase}.mdh"
-		    export="${depbase}.export"
-		    case "$dep" in
-			zsh/main )
-			    mdll="\$(dir_top)/Src/libzsh-\$(VERSION).\$(DL_EXT) "
-			;;
-			* )
-			    mdll="${depbase}.\$(DL_EXT) "
-			;;
-		    esac
-		    ;;
-		$loc/*)
-		    mdh="\$(dir_top)/$loc/${depbase}.mdh"
-		    case "$other_mdhs " in
-			*" $mdh "*) ;;
-			*) other_mdhs="$other_mdhs $mdh" ;;
-		    esac
-		    export="\$(dir_top)/$loc/${depbase}.export"
-		    case "$other_exports " in
-			*" $export "*) ;;
-			*) other_exports="$other_exports $export" ;;
-		    esac
-		    case "$dep" in
-			zsh/main )
-			    mdll="\$(dir_top)/Src/libzsh-\$(VERSION).\$(DL_EXT) "
-			;;
-			* )
-			    mdll="\$(dir_top)/$loc/${depbase}.\$(DL_EXT) "
-			;;
-		    esac
-		    case "$other_modules " in
-			*" $mdll "*) ;;
-			*) other_modules="$other_modules $mdll" ;;
-		    esac
-		    ;;
-		*)
-		    mdh="\$(dir_top)/$loc/${depbase}.mdh"
-		    case "$remote_mdhs " in
-			*" $mdh "*) ;;
-			*) remote_mdhs="$remote_mdhs $mdh" ;;
-		    esac
-		    export="\$(dir_top)/$loc/${depbase}.export"
-		    case "$remote_exports " in
-			*" $export "*) ;;
-			*) remote_exports="$remote_exports $export" ;;
-		    esac
-		    case "$dep" in
-			zsh/main )
-			    mdll="\$(dir_top)/Src/libzsh-\$(VERSION).\$(DL_EXT) "
-			;;
-			* )
-			    mdll="\$(dir_top)/$loc/${depbase}.\$(DL_EXT) "
-			;;
-		    esac
-		    case "$remote_modules " in
-			*" $mdll "*) ;;
-			*) remote_modules="$remote_modules $mdll" ;;
-		    esac
-		    ;;
-	    esac
-	    modhdeps="$modhdeps $mdh"
-	    exportdeps="$exportdeps $export"
-	    imports="$imports \$(IMPOPT)$export"
-	    case "$mododeps " in
-		*" $mdll "* )
-		    :
-		;;
-		* )
-		    mododeps="$mododeps $mdll"
-		;;
-	    esac
-	done
-
-	echo "##### ===== DEPENDENCIES GENERATED FROM ${mddname}.mdd ===== #####"
-	echo
-	echo "MODOBJS_${mddname} = $objects"
-	echo "MODDOBJS_${mddname} = $dobjects \$(@E@NTRYOBJ)"
-	echo "SYMS_${mddname} = $proto"
-	echo "EPRO_${mddname} = "`echo $proto '' | sed 's,\.syms ,.epro ,g'`
-	echo "INCS_${mddname} = \$(EPRO_${mddname}) $otherincs"
-	echo "EXPIMP_${mddname} = $imports \$(EXPOPT)$mddname.export"
-	echo "NXPIMP_${mddname} ="
-	echo "LINKMODS_${mddname} = $mododeps"
-	echo "NOLINKMODS_${mddname} = "
-	echo
-	echo "proto.${mddname}: \$(EPRO_${mddname})"
-	echo "\$(SYMS_${mddname}): \$(PROTODEPS)"
-	echo
-	echo "${mddname}.export: \$(SYMS_${mddname})"
-	echo "	( echo '#!'; cat \$(SYMS_${mddname}) | sed -n '/^X/{s/^X//;p;}' | sort -u ) > \$@"
-	echo
-	echo "modobjs.${mddname}: \$(MODOBJS_${mddname})"
-	echo "	echo '' \$(MODOBJS_${mddname}) $modobjs_sed>> \$(dir_src)/stamp-modobjs.tmp"
-	echo
-	if test -z "$alwayslink"; then
-	    case " $all_modules" in *" ${mddname}."*)
-		echo "install.modules-here: install.modules.${mddname}"
-		echo "uninstall.modules-here: uninstall.modules.${mddname}"
-		echo
-	    ;; esac
-	    instsubdir=`echo $name | sed 's,^,/,;s,/[^/]*$,,'`
-	    echo "install.modules.${mddname}: ${mddname}.\$(DL_EXT)"
-	    echo "	\$(SHELL) \$(sdir_top)/mkinstalldirs \$(DESTDIR)\$(MODDIR)${instsubdir}"
-	    echo "	\$(INSTALL_PROGRAM) \$(STRIPFLAGS) ${mddname}.\$(DL_EXT) \$(DESTDIR)\$(MODDIR)/${name}.\$(DL_EXT)"
-	    echo
-	    echo "uninstall.modules.${mddname}:"
-	    echo "	rm -f \$(DESTDIR)\$(MODDIR)/${name}.\$(DL_EXT)"
-	    echo
-	    echo "${mddname}.\$(DL_EXT): \$(MODDOBJS_${mddname}) ${mddname}.export $exportdeps \$(@LINKMODS@_${mddname})"
-	    echo '	rm -f $@'
-	    echo "	\$(DLLINK) \$(@E@XPIMP_$mddname) \$(@E@NTRYOPT) \$(MODDOBJS_${mddname}) \$(@LINKMODS@_${mddname}) \$(LIBS) "
-	    echo
-	fi
-	echo "${mddname}.mdhi: ${mddname}.mdhs \$(INCS_${mddname})"
-	echo "	@test -f \$@ || echo 'do not delete this file' > \$@"
-	echo
-	echo "${mddname}.mdhs: ${mddname}.mdd"
-	echo "	@\$(MAKE) -f \$(makefile) \$(MAKEDEFS) ${mddname}.mdh.tmp"
-	echo "	@if cmp -s ${mddname}.mdh ${mddname}.mdh.tmp; then \\"
-	echo "	    rm -f ${mddname}.mdh.tmp; \\"
-	echo "	    echo \"\\\`${mddname}.mdh' is up to date.\"; \\"
-	echo "	else \\"
-	echo "	    mv -f ${mddname}.mdh.tmp ${mddname}.mdh; \\"
-	echo "	    echo \"Updated \\\`${mddname}.mdh'.\"; \\"
-	echo "	fi"
-	echo "	echo 'timestamp for ${mddname}.mdh against ${mddname}.mdd' > \$@"
-	echo
-	echo "${mddname}.mdh: ${modhdeps} ${headers} ${hdrdeps} ${mddname}.mdhi"
-	echo "	@\$(MAKE) -f \$(makefile) \$(MAKEDEFS) ${mddname}.mdh.tmp"
-	echo "	@mv -f ${mddname}.mdh.tmp ${mddname}.mdh"
-	echo "	@echo \"Updated \\\`${mddname}.mdh'.\""
-	echo
-	echo "${mddname}.mdh.tmp:"
-	echo "	@( \\"
-	echo "	    echo '#ifndef have_${q_name}_module'; \\"
-	echo "	    echo '#define have_${q_name}_module'; \\"
-	echo "	    echo; \\"
-	echo "	    echo '# ifndef IMPORTING_MODULE_${q_name}'; \\"
-	echo "	    if test @SHORTBOOTNAMES@ = yes; then \\"
-	echo "		echo '#  ifndef MODULE'; \\"
-	echo "	    fi; \\"
-	echo "	    echo '#   define boot_ boot_${q_name}'; \\"
-	echo "	    echo '#   define cleanup_ cleanup_${q_name}'; \\"
-	echo "	    echo '#   define setup_ setup_${q_name}'; \\"
-	echo "	    echo '#   define finish_ finish_${q_name}'; \\"
-	echo "	    if test @SHORTBOOTNAMES@ = yes; then \\"
-	echo "		echo '#  endif /* !MODULE */'; \\"
-	echo "	    fi; \\"
-	echo "	    echo '# endif /* !IMPORTING_MODULE_${q_name} */'; \\"
-	echo "	    echo; \\"
-	if test -n "$moddeps"; then (
-	    set x $q_moddeps
-	    echo "	    echo '/* Module dependencies */'; \\"
-	    for hdep in $modhdeps; do
-		shift
-		echo "	    echo '# define IMPORTING_MODULE_${1} 1'; \\"
-		echo "	    echo '# include \"${hdep}\"'; \\"
-	    done
-	    echo "	    echo; \\"
-	) fi
-	if test -n "$headers"; then
-	    echo "	    echo '/* Extra headers for this module */'; \\"
-	    echo "	    for hdr in $headers; do \\"
-	    echo "		if test -f \$\$hdr; then \\"
-	    echo "		    echo '# include \"'\$\$hdr'\"'; \\"
-	    echo "		else \\"
-	    echo "		    echo '# include \"\$(sdir)/'\$\$hdr'\"'; \\"
-	    echo "		fi; \\"
-	    echo "	    done; \\"
-	    echo "	    echo; \\"
-	fi
-	if test -n "$proto"; then
-	    echo "	    echo '# undef mod_import_variable'; \\"
-	    echo "	    echo '# undef mod_import_function'; \\"
-	    echo "	    echo '# if defined(IMPORTING_MODULE_${q_name}) &&  defined(MODULE)'; \\"
-	    echo "	    echo '#  define mod_import_variable @MOD_IMPORT_VARIABLE@'; \\"
-	    echo "	    echo '#  define mod_import_function @MOD_IMPORT_FUNCTION@'; \\"
-	    echo "	    echo '# else'; \\"
-	    echo "	    echo '#  define mod_import_function'; \\"
-	    echo "	    echo '#  define mod_import_variable'; \\"
-	    echo "	    echo '# endif /* IMPORTING_MODULE_${q_name} && MODULE */'; \\"
-	    echo "	    for epro in \$(EPRO_${mddname}); do \\"
-	    echo "		echo '# include \"'\$\$epro'\"'; \\"
-	    echo "	    done; \\"
-	    echo "	    echo '# undef mod_import_variable'; \\"
-	    echo "	    echo '# define mod_import_variable'; \\"
-	    echo "	    echo '# undef mod_import_variable'; \\"
-	    echo "	    echo '# define mod_import_variable'; \\"
-	    echo "	    echo '# ifndef mod_export'; \\"
-	    echo "	    echo '#  define mod_export @MOD_EXPORT@'; \\"
-	    echo "	    echo '# endif /* mod_export */'; \\"
-	    echo "	    echo; \\"
-	fi
-	echo "	    echo '#endif /* !have_${q_name}_module */'; \\"
-	echo "	) > \$@"
-	echo
-	echo "\$(MODOBJS_${mddname}) \$(MODDOBJS_${mddname}): ${mddname}.mdh"
-	sed -e '/^ *: *<< *\\Make *$/,/^Make$/!d' \
-	    -e 's/^ *: *<< *\\Make *$//; /^Make$/d' \
-	    < $top_srcdir/$the_subdir/${mddname}.mdd
-	echo
-
-    done
-
-    if test -n "$remote_mdhs$other_mdhs$remote_exports$other_exports$remote_modules$other_modules"; then
-	echo "##### ===== DEPENDENCIES FOR REMOTE MODULES ===== #####"
-	echo
-	for mdh in $remote_mdhs; do
-	    echo "$mdh: FORCE"
-	    echo "	@cd @%@ && \$(MAKE) \$(MAKEDEFS) @%@$mdh"
-	    echo
-	done | sed 's,^\(.*\)@%@\(.*\)@%@\(.*\)/\([^/]*\)$,\1\3\2\4,'
-	if test -n "$other_mdhs"; then
-	    echo "${other_mdhs}:" | sed 's,^ ,,'
-	    echo "	false # should only happen with make -n"
-	    echo
-	fi
-	for export in $remote_exports; do
-	    echo "$export: FORCE"
-	    echo "	@cd @%@ && \$(MAKE) \$(MAKEDEFS) @%@$export"
-	    echo
-	done | sed 's,^\(.*\)@%@\(.*\)@%@\(.*\)/\([^/]*\)$,\1\3\2\4,'
-	if test -n "$other_exports"; then
-	    echo "${other_exports}:" | sed 's,^ ,,'
-	    echo "	false # should only happen with make -n"
-	    echo
-	fi
-	for mdll in $remote_modules; do
-	    echo "$mdll: FORCE"
-	    echo "	@cd @%@ && \$(MAKE) \$(MAKEDEFS) @%@$mdll"
-	    echo
-	done | sed 's,^\(.*\)@%@\(.*\)@%@\(.*\)/\([^/]*\)$,\1\3\2\4,'
-	if test -n "$other_modules"; then
-	    echo "${other_modules}:" | sed 's,^ ,,'
-	    echo "	false # should only happen with make -n"
-	    echo
-	fi
-    fi
-
-    echo "##### End of ${the_makefile}.in"
-
-    exec >&3 3>&-
-
-fi
-
-if $second_stage ; then
-    trap "rm -f $the_subdir/${the_makefile}" 1 2 15
-
-    ${CONFIG_SHELL-/bin/sh} ./config.status \
-	--file=$the_subdir/${the_makefile}:$the_subdir/${the_makefile}.in ||
-    return 1
-fi
-
-exit 0
Index: Src/mkmakemod.sh.in.in
===================================================================
RCS file: Src/mkmakemod.sh.in.in
diff -N Src/mkmakemod.sh.in.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Src/mkmakemod.sh.in.in	28 Feb 2004 20:45:40 -0000
@@ -0,0 +1,493 @@
+#!/bin/sh
+#
+# mkmakemod.sh: generate Makefile.in files for module building
+#
+# Options:
+#   -m = file is already generated; only build the second stage
+#   -i = do not build second stage
+#
+# Args:
+#   $1 = subdirectory to look in, relative to $top_srcdir
+#   $2 = final output filename, within the $1 directory
+#
+# This script must be run from the top-level build directory, and $top_srcdir
+# must be set correctly in the environment.
+#
+# This looks in $1, and uses all the *.mdd files there.  Each .mdd file
+# defines one module.  The .mdd file is actually a shell script, which will
+# be sourced.  It may define the following shell variables:
+#
+#   name            name of this module
+#   moddeps         modules on which this module depends (default none)
+#   nozshdep        non-empty indicates no dependence on the `zsh/main' pseudo-module
+#   alwayslink      if non-empty, always link the module into the executable
+#   autobins        builtins defined by the module, for autoloading
+#   autoinfixconds  infix condition codes defined by the module, for
+#                   autoloading (without the leading `-')
+#   autoprefixconds like autoinfixconds, but for prefix condition codes
+#   autoparams      parameters defined by the module, for autoloading
+#   automathfuncs   math functions defined by the module, for autoloading
+#   objects         .o files making up this module (*must* be defined)
+#   proto           .syms files for this module (default generated from $objects)
+#   headers         extra headers for this module (default none)
+#   hdrdeps         extra headers on which the .mdh depends (default none)
+#   otherincs       extra headers that are included indirectly (default none)
+#
+# The .mdd file may also include a Makefile.in fragment between lines
+# `:<<\Make' and `Make' -- this will be copied into Makemod.in.
+#
+# The resulting Makemod.in knows how to build each module that is defined.
+# For each module in also knows how to build a .mdh file.  Each source file
+# should #include the .mdh file for the module it is a part of.  The .mdh
+# file #includes the .mdh files for any module dependencies, then each of
+# $headers, and then each .epro (for global declarations).  It will
+# be recreated if any of the dependency .mdh files changes, or if any of
+# $headers or $hdrdeps changes.  When anything depends on it, all the .epros
+# and $otherincs will be made up to date, but the .mdh file won't actually
+# be rebuilt if those files change.
+#
+# The order of sections of the output file is thus:
+#   simple generated macros
+#   macros generated from *.mdd
+#   included Makemod.in.in
+#   rules generated from *.mdd
+# The order dependencies are basically that the generated macros are required
+# in Makemod.in.in, but some of the macros that it creates are needed in the
+# later rules.
+#
+
+# sed script to normalise a pathname
+sed_normalise='
+    s,^,/,
+    s,$,/,
+    :1
+    s,/\./,/,
+    t1
+    :2
+    s,/[^/.][^/]*/\.\./,/,
+    s,/\.[^/.][^/]*/\.\./,/,
+    s,/\.\.[^/][^/]*/\.\./,/,
+    t2
+    s,^/$,.,
+    s,^/,,
+    s,\(.\)/$,\1,
+'
+
+# decide which stages to process
+first_stage=true
+second_stage=true
+if test ."$1" = .-m; then
+    shift
+    first_stage=false
+elif test ."$1" = .-i; then
+    shift
+    second_stage=false
+fi
+
+top_srcdir=`echo $top_srcdir | sed "$sed_normalise"`
+the_subdir=$1
+the_makefile=$2
+
+if $first_stage; then
+
+    dir_top=`echo $the_subdir | sed 's,[^/][^/]*,..,g'`
+
+    trap "rm -f $the_subdir/${the_makefile}.in" 1 2 15
+    echo "creating $the_subdir/${the_makefile}.in"
+    exec 3>&1 >$the_subdir/${the_makefile}.in
+    echo "##### ${the_makefile}.in generated automatically by mkmakemod.sh"
+    echo "##### DO NOT EDIT!"
+    echo
+    echo "##### ===== DEFINITIONS ===== #####"
+    echo
+    echo "makefile = ${the_makefile}"
+    echo "dir_top = ${dir_top}"
+    echo "subdir = ${the_subdir}"
+    echo
+
+    bin_mods=`grep link=static ./config.modules | \
+    sed -e '/^#/d' -e 's/ .*/ /' -e 's/^name=/ /'`
+    dyn_mods="`grep link=dynamic ./config.modules | \
+    sed -e '/^#/d' -e 's/ .*/ /' -e 's/^name=/ /'`"
+    module_list="${bin_mods}${dyn_mods}"
+
+    # check both 2.13 and 2.50 syntax
+    if grep '%_@_D_@_%D%' config.status >/dev/null ||
+       grep ',_@_D_@_,D,' config.status >/dev/null; then
+	is_dynamic=true
+    else
+	is_dynamic=false
+    fi
+
+    here_mddnames=
+    all_subdirs=
+    all_modobjs=
+    all_modules=
+    all_mdds=
+    all_mdhs=
+    all_proto=
+    lastsub=//
+    for module in $module_list; do
+        modfile="`grep '^name='$module' ' ./config.modules | \
+	  sed -e 's/^.* modfile=//' -e 's/ .*//'`"
+	case $modfile in
+	    $the_subdir/$lastsub/*) ;;
+	    $the_subdir/*/*)
+		lastsub=`echo $modfile | sed 's,^'$the_subdir'/,,;s,/[^/]*$,,'`
+		case "$all_subdirs " in
+		    *" $lastsub "* ) ;;
+		    * )
+			all_subdirs="$all_subdirs $lastsub"
+		    ;;
+		esac
+		;;
+	    $the_subdir/*)
+		mddname=`echo $modfile | sed 's,^.*/,,;s,\.mdd$,,'`
+		here_mddnames="$here_mddnames $mddname"
+		build=$is_dynamic
+		case $is_dynamic_@_$bin_mods in
+		    *" $module "*)
+			build=true
+			all_modobjs="$all_modobjs modobjs.${mddname}" ;;
+		    true_@_*)
+			all_modules="$all_modules ${mddname}.\$(DL_EXT)" ;;
+		esac
+		all_mdds="$all_mdds ${mddname}.mdd"
+		$build && all_mdhs="$all_mdhs ${mddname}.mdh"
+		$build && all_proto="$all_proto proto.${mddname}"
+		;;
+	esac
+    done
+    echo "MODOBJS =$all_modobjs"
+    echo "MODULES =$all_modules"
+    echo "MDDS    =$all_mdds"
+    echo "MDHS    =$all_mdhs"
+    echo "PROTOS  =$all_proto"
+    echo "SUBDIRS =$all_subdirs"
+    echo
+    echo "ENTRYOBJ = \$(dir_src)/modentry..o"
+    echo "NNTRYOBJ ="
+    echo "ENTRYOPT = -emodentry"
+    echo "NNTRYOPT ="
+    echo
+
+    echo "##### ===== INCLUDING Makemod.in.in ===== #####"
+    echo
+    cat $top_srcdir/Src/Makemod.in.in
+    echo
+
+    case $the_subdir in
+	Src) modobjs_sed= ;;
+	Src/*) modobjs_sed="| sed 's\" \" "`echo $the_subdir | sed 's,^Src/,,'`"/\"g' " ;;
+	*) modobjs_sed="| sed 's\" \" ../$the_subdir/\"g' " ;;
+    esac
+
+    other_mdhs=
+    remote_mdhs=
+    other_exports=
+    remote_exports=
+    other_modules=
+    remote_modules=
+    for mddname in $here_mddnames; do
+
+	unset name moddeps nozshdep alwayslink hasexport
+	unset autobins autoinfixconds autoprefixconds autoparams automathfuncs
+	unset objects proto headers hdrdeps otherincs autoconf achfile
+	. $top_srcdir/$the_subdir/${mddname}.mdd
+	q_name=`echo $name | sed 's,Q,Qq,g;s,_,Qu,g;s,/,Qs,g'`
+	test -n "${moddeps+set}" || moddeps=
+	test -n "$nozshdep" || moddeps="$moddeps zsh/main"
+	test -n "${proto+set}" ||
+	    proto=`echo $objects '' | sed 's,\.o ,.syms ,g'`
+
+	dobjects=`echo $objects '' | sed 's,\.o ,..o ,g'`
+	modhdeps=
+	mododeps=
+	exportdeps=
+	imports=
+	q_moddeps=
+	for dep in $moddeps; do
+	    depfile="`grep '^name='$dep' ' ./config.modules | \
+	      sed -e 's/^.* modfile=//' -e 's/ .*//'`"
+	    q_dep=`echo $dep | sed 's,Q,Qq,g;s,_,Qu,g;s,/,Qs,g'`
+	    q_moddeps="$q_moddeps $q_dep"
+	    eval `echo $depfile | sed 's,/\([^/]*\)\.mdd$,;depbase=\1,;s,^,loc=,'`
+	    case "$binmod" in
+		*" $dep "* )
+		    dep=zsh/main
+		;;
+	    esac
+
+	    case $the_subdir in
+		$loc)
+		    mdh="${depbase}.mdh"
+		    export="${depbase}.export"
+		    case "$dep" in
+			zsh/main )
+			    mdll="\$(dir_top)/Src/libzsh-\$(VERSION).\$(DL_EXT) "
+			;;
+			* )
+			    mdll="${depbase}.\$(DL_EXT) "
+			;;
+		    esac
+		    ;;
+		$loc/*)
+		    mdh="\$(dir_top)/$loc/${depbase}.mdh"
+		    case "$other_mdhs " in
+			*" $mdh "*) ;;
+			*) other_mdhs="$other_mdhs $mdh" ;;
+		    esac
+		    export="\$(dir_top)/$loc/${depbase}.export"
+		    case "$other_exports " in
+			*" $export "*) ;;
+			*) other_exports="$other_exports $export" ;;
+		    esac
+		    case "$dep" in
+			zsh/main )
+			    mdll="\$(dir_top)/Src/libzsh-\$(VERSION).\$(DL_EXT) "
+			;;
+			* )
+			    mdll="\$(dir_top)/$loc/${depbase}.\$(DL_EXT) "
+			;;
+		    esac
+		    case "$other_modules " in
+			*" $mdll "*) ;;
+			*) other_modules="$other_modules $mdll" ;;
+		    esac
+		    ;;
+		*)
+		    mdh="\$(dir_top)/$loc/${depbase}.mdh"
+		    case "$remote_mdhs " in
+			*" $mdh "*) ;;
+			*) remote_mdhs="$remote_mdhs $mdh" ;;
+		    esac
+		    export="\$(dir_top)/$loc/${depbase}.export"
+		    case "$remote_exports " in
+			*" $export "*) ;;
+			*) remote_exports="$remote_exports $export" ;;
+		    esac
+		    case "$dep" in
+			zsh/main )
+			    mdll="\$(dir_top)/Src/libzsh-\$(VERSION).\$(DL_EXT) "
+			;;
+			* )
+			    mdll="\$(dir_top)/$loc/${depbase}.\$(DL_EXT) "
+			;;
+		    esac
+		    case "$remote_modules " in
+			*" $mdll "*) ;;
+			*) remote_modules="$remote_modules $mdll" ;;
+		    esac
+		    ;;
+	    esac
+	    modhdeps="$modhdeps $mdh"
+	    exportdeps="$exportdeps $export"
+	    imports="$imports \$(IMPOPT)$export"
+	    case "$mododeps " in
+		*" $mdll "* )
+		    :
+		;;
+		* )
+		    mododeps="$mododeps $mdll"
+		;;
+	    esac
+	done
+
+	echo "##### ===== DEPENDENCIES GENERATED FROM ${mddname}.mdd ===== #####"
+	echo
+	echo "MODOBJS_${mddname} = $objects"
+	echo "MODDOBJS_${mddname} = $dobjects \$(_@_E_@_NTRYOBJ)"
+	echo "SYMS_${mddname} = $proto"
+	echo "EPRO_${mddname} = "`echo $proto '' | sed 's,\.syms ,.epro ,g'`
+	echo "INCS_${mddname} = \$(EPRO_${mddname}) $otherincs"
+	echo "EXPIMP_${mddname} = $imports \$(EXPOPT)$mddname.export"
+	echo "NXPIMP_${mddname} ="
+	echo "LINKMODS_${mddname} = $mododeps"
+	echo "NOLINKMODS_${mddname} = "
+	echo
+	echo "proto.${mddname}: \$(EPRO_${mddname})"
+	echo "\$(SYMS_${mddname}): \$(PROTODEPS)"
+	echo
+	echo "${mddname}.export: \$(SYMS_${mddname})"
+	echo "	( echo '#!'; cat \$(SYMS_${mddname}) | sed -n '/^X/{s/^X//;p;}' | sort -u ) > \$_@_"
+	echo
+	echo "modobjs.${mddname}: \$(MODOBJS_${mddname})"
+	echo "	echo '' \$(MODOBJS_${mddname}) $modobjs_sed>> \$(dir_src)/stamp-modobjs.tmp"
+	echo
+
+	if test -n "$autoconf"; then
+	    touch ${the_subdir}/${mddname}.rules
+	    echo "@am__include@ @am__quote@${mddname}.rules@am__quote@"
+	    echo
+	    echo "${mddname}.ach ${mddname}.rules: \$(sdir_src)/Modules/${mddname}.configure"
+	    echo "	\$(sdir_src)/Modules/${mddname}.configure"
+	    echo
+	    echo "\$(sdir_src)/Modules/${mddname}.configure: ${mddname}.configure.ac ${mddname}.ach.in"
+	    echo "	cd \$(sdir_src)/Modules && autoconf ${mddname}.configure.ac >${mddname}.configure"
+	    echo "	chmod +x \$(sdir_src)/Modules/pcre.configure"
+	    echo
+	    echo "\$(sdir_src)/Modules/${mddname}.ach.in:"
+	    echo "	cd \$(sdir_src)/Modules && autoheader ${mddname}.configure.ac"
+	achfile="${mddname}.ach"
+	fi
+
+	if test -z "$alwayslink"; then
+	    case " $all_modules" in *" ${mddname}."*)
+		echo "install.modules-here: install.modules.${mddname}"
+		echo "uninstall.modules-here: uninstall.modules.${mddname}"
+		echo
+	    ;; esac
+	    instsubdir=`echo $name | sed 's,^,/,;s,/[^/]*$,,'`
+	    echo "install.modules.${mddname}: ${mddname}.\$(DL_EXT)"
+	    echo "	\$(SHELL) \$(sdir_top)/mkinstalldirs \$(DESTDIR)\$(MODDIR)${instsubdir}"
+	    echo "	\$(INSTALL_PROGRAM) \$(STRIPFLAGS) ${mddname}.\$(DL_EXT) \$(DESTDIR)\$(MODDIR)/${name}.\$(DL_EXT)"
+	    echo
+	    echo "uninstall.modules.${mddname}:"
+	    echo "	rm -f \$(DESTDIR)\$(MODDIR)/${name}.\$(DL_EXT)"
+	    echo
+	    echo "${mddname}.\$(DL_EXT): \$(MODDOBJS_${mddname}) ${mddname}.export $exportdeps \$(_@_LINKMODS_@__${mddname})"
+	    echo '	rm -f $_@_'
+	    echo "	\$(DLLINK) \$(_@_E_@_XPIMP_$mddname) \$(_@_E_@_NTRYOPT) \$(MODDOBJS_${mddname}) \$(_@_LINKMODS_@__${mddname}) \$(LIBS) \$(EXTRALIBS_${mddname}) "
+	    echo
+	fi
+	echo "${mddname}.mdhi: ${mddname}.mdhs \$(INCS_${mddname})"
+	echo "	_@_test -f \$_@_ || echo 'do not delete this file' > \$_@_"
+	echo
+	echo "${mddname}.mdhs: ${mddname}.mdd"
+	echo "	_@_\$(MAKE) -f \$(makefile) \$(MAKEDEFS) ${mddname}.mdh.tmp"
+	echo "	_@_if cmp -s ${mddname}.mdh ${mddname}.mdh.tmp; then \\"
+	echo "	    rm -f ${mddname}.mdh.tmp; \\"
+	echo "	    echo \"\\\`${mddname}.mdh' is up to date.\"; \\"
+	echo "	else \\"
+	echo "	    mv -f ${mddname}.mdh.tmp ${mddname}.mdh; \\"
+	echo "	    echo \"Updated \\\`${mddname}.mdh'.\"; \\"
+	echo "	fi"
+	echo "	echo 'timestamp for ${mddname}.mdh against ${mddname}.mdd' > \$_@_"
+	echo
+	echo "${mddname}.mdh: ${modhdeps} ${headers} ${hdrdeps} ${mddname}.mdhi"
+	echo "	_@_\$(MAKE) -f \$(makefile) \$(MAKEDEFS) ${mddname}.mdh.tmp"
+	echo "	_@_mv -f ${mddname}.mdh.tmp ${mddname}.mdh"
+	echo "	_@_echo \"Updated \\\`${mddname}.mdh'.\""
+	echo
+	echo "${mddname}.mdh.tmp:"
+	echo "	_@_( \\"
+	echo "	    echo '#ifndef have_${q_name}_module'; \\"
+	echo "	    echo '#define have_${q_name}_module'; \\"
+	echo "	    echo; \\"
+	echo "	    echo '# ifndef IMPORTING_MODULE_${q_name}'; \\"
+	echo "	    if test _@_SHORTBOOTNAMES_@_ = yes; then \\"
+	echo "		echo '#  ifndef MODULE'; \\"
+	echo "	    fi; \\"
+	echo "	    echo '#   define boot_ boot_${q_name}'; \\"
+	echo "	    echo '#   define cleanup_ cleanup_${q_name}'; \\"
+	echo "	    echo '#   define setup_ setup_${q_name}'; \\"
+	echo "	    echo '#   define finish_ finish_${q_name}'; \\"
+	echo "	    if test _@_SHORTBOOTNAMES_@_ = yes; then \\"
+	echo "		echo '#  endif /* !MODULE */'; \\"
+	echo "	    fi; \\"
+	echo "	    echo '# endif /* !IMPORTING_MODULE_${q_name} */'; \\"
+	echo "	    echo; \\"
+	if test -n "$moddeps"; then (
+	    set x $q_moddeps
+	    echo "	    echo '/* Module dependencies */'; \\"
+	    for hdep in $modhdeps; do
+		shift
+		echo "	    echo '# define IMPORTING_MODULE_${1} 1'; \\"
+		echo "	    echo '# include \"${hdep}\"'; \\"
+	    done
+	    echo "	    echo; \\"
+	) fi
+	if test -n "$headers"; then
+	    echo "	    echo '/* Extra headers for this module */'; \\"
+	    echo "	    for hdr in $headers; do \\"
+	    echo "		if test -f \$\$hdr; then \\"
+	    echo "		    echo '# include \"'\$\$hdr'\"'; \\"
+	    echo "		else \\"
+	    echo "		    echo '# include \"\$(sdir)/'\$\$hdr'\"'; \\"
+	    echo "		fi; \\"
+	    echo "	    done; \\"
+	    echo "	    echo; \\"
+	fi
+	if test -n "$proto"; then
+	    echo "	    echo '# undef mod_import_variable'; \\"
+	    echo "	    echo '# undef mod_import_function'; \\"
+	    echo "	    echo '# if defined(IMPORTING_MODULE_${q_name}) &&  defined(MODULE)'; \\"
+	    echo "	    echo '#  define mod_import_variable _@_MOD_IMPORT_VARIABLE_@_'; \\"
+	    echo "	    echo '#  define mod_import_function _@_MOD_IMPORT_FUNCTION_@_'; \\"
+	    echo "	    echo '# else'; \\"
+	    echo "	    echo '#  define mod_import_function'; \\"
+	    echo "	    echo '#  define mod_import_variable'; \\"
+	    echo "	    echo '# endif /* IMPORTING_MODULE_${q_name} && MODULE */'; \\"
+	    echo "	    for epro in \$(EPRO_${mddname}); do \\"
+	    echo "		echo '# include \"'\$\$epro'\"'; \\"
+	    echo "	    done; \\"
+	    echo "	    echo '# undef mod_import_variable'; \\"
+	    echo "	    echo '# define mod_import_variable'; \\"
+	    echo "	    echo '# undef mod_import_variable'; \\"
+	    echo "	    echo '# define mod_import_variable'; \\"
+	    echo "	    echo '# ifndef mod_export'; \\"
+	    echo "	    echo '#  define mod_export _@_MOD_EXPORT_@_'; \\"
+	    echo "	    echo '# endif /* mod_export */'; \\"
+	    echo "	    echo; \\"
+	fi
+	echo "	    echo '#endif /* !have_${q_name}_module */'; \\"
+	echo "	) > \$_@_"
+	echo
+	echo "\$(MODOBJS_${mddname}) \$(MODDOBJS_${mddname}): ${mddname}.mdh $achfile"
+	sed -e '/^ *: *<< *\\Make *$/,/^Make$/!d' \
+	    -e 's/^ *: *<< *\\Make *$//; /^Make$/d' \
+	    < $top_srcdir/$the_subdir/${mddname}.mdd
+	echo
+
+    done
+
+    if test -n "$remote_mdhs$other_mdhs$remote_exports$other_exports$remote_modules$other_modules"; then
+	echo "##### ===== DEPENDENCIES FOR REMOTE MODULES ===== #####"
+	echo
+	for mdh in $remote_mdhs; do
+	    echo "$mdh: FORCE"
+	    echo "	_@_cd _@_%_@_ && \$(MAKE) \$(MAKEDEFS) _@_%_@_$mdh"
+	    echo
+	done | sed 's,^\(.*\)_@_%_@_\(.*\)_@_%_@_\(.*\)/\([^/]*\)$,\1\3\2\4,'
+	if test -n "$other_mdhs"; then
+	    echo "${other_mdhs}:" | sed 's,^ ,,'
+	    echo "	false # should only happen with make -n"
+	    echo
+	fi
+	for export in $remote_exports; do
+	    echo "$export: FORCE"
+	    echo "	_@_cd _@_%_@_ && \$(MAKE) \$(MAKEDEFS) _@_%_@_$export"
+	    echo
+	done | sed 's,^\(.*\)_@_%_@_\(.*\)_@_%_@_\(.*\)/\([^/]*\)$,\1\3\2\4,'
+	if test -n "$other_exports"; then
+	    echo "${other_exports}:" | sed 's,^ ,,'
+	    echo "	false # should only happen with make -n"
+	    echo
+	fi
+	for mdll in $remote_modules; do
+	    echo "$mdll: FORCE"
+	    echo "	_@_cd _@_%_@_ && \$(MAKE) \$(MAKEDEFS) _@_%_@_$mdll"
+	    echo
+	done | sed 's,^\(.*\)_@_%_@_\(.*\)_@_%_@_\(.*\)/\([^/]*\)$,\1\3\2\4,'
+	if test -n "$other_modules"; then
+	    echo "${other_modules}:" | sed 's,^ ,,'
+	    echo "	false # should only happen with make -n"
+	    echo
+	fi
+    fi
+
+    echo "##### End of ${the_makefile}.in"
+
+    exec >&3 3>&-
+
+fi
+
+if $second_stage ; then
+    trap "rm -f $the_subdir/${the_makefile}" 1 2 15
+
+    ${CONFIG_SHELL-/bin/sh} ./config.status \
+	--file=$the_subdir/${the_makefile}:$the_subdir/${the_makefile}.in ||
+    return 1
+fi
+
+exit 0
Index: Src/Modules/.cvsignore
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/.cvsignore,v
retrieving revision 1.4
diff -u -r1.4 .cvsignore
--- Src/Modules/.cvsignore	3 Nov 2003 02:51:21 -0000	1.4
+++ Src/Modules/.cvsignore	28 Feb 2004 20:45:40 -0000
@@ -15,3 +15,4 @@
 *.swp
 errnames.c errcount.h
 *.dll
+*.rules
Index: Src/Modules/pcre.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/pcre.c,v
retrieving revision 1.5
diff -u -r1.5 pcre.c
--- Src/Modules/pcre.c	27 Aug 2002 21:10:34 -0000	1.5
+++ Src/Modules/pcre.c	28 Feb 2004 20:45:40 -0000
@@ -30,6 +30,7 @@
 
 #include "pcre.mdh"
 #include "pcre.pro"
+#include "pcre.ach"
 
 /**/
 #if defined(HAVE_PCRE_COMPILE) && defined(HAVE_PCRE_EXEC)
Index: Src/Modules/pcre.configure.ac
===================================================================
RCS file: Src/Modules/pcre.configure.ac
diff -N Src/Modules/pcre.configure.ac
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Src/Modules/pcre.configure.ac	28 Feb 2004 20:45:40 -0000
@@ -0,0 +1,46 @@
+dnl
+dnl  pcre.ac: Configure template for zsh/pcre module.
+dnl  Process this file with autoconf to produce a configure script.
+dnl
+dnl  Copyright (c) 2002, 2004 Clint Adams
+dnl
+dnl  Permission is hereby granted, without written agreement and without
+dnl  license or royalty fees, to use, copy, modify, and distribute this
+dnl  software and to distribute modified versions of this software for any
+dnl  purpose, provided that the above copyright notice and the following
+dnl  two paragraphs appear in all copies of this software.
+dnl
+dnl  In no event shall Clint Adams or the Zsh Development Group be liable
+dnl  to any party for direct, indirect, special, incidental, or consequential
+dnl  damages arising out of the use of this software and its documentation,
+dnl  even if Clint Adams and the Zsh Development Group have been advised of
+dnl  the possibility of such damage.
+dnl
+dnl  Clint Adams and the Zsh Development Group specifically disclaim any
+dnl  warranties, including, but not limited to, the implied warranties of
+dnl  merchantability and fitness for a particular purpose.  The software
+dnl  provided hereunder is on an "as is" basis, and Clint Adams and
+the
+dnl  Zsh Development Group have no obligation to provide maintenance,
+dnl  support, updates, enhancements, or modifications.
+dnl
+
+AC_INIT
+AC_CONFIG_SRCDIR([pcre.c])
+AC_PREREQ(2.59)
+
+AC_CONFIG_HEADER(pcre.ach)
+
+oldcflags="$CFLAGS"
+AC_CHECK_PROG([PCRECONF], pcre-config, pcre-config)
+if test "x$ac_cv_prog_PCRECONF" = xpcre-config; then
+  CPPFLAGS="$CPPFLAGS `pcre-config --cflags`"
+fi
+
+AC_CHECK_HEADERS(pcre.h)
+
+AC_SEARCH_LIBS(pcre_compile, pcre)
+AC_CHECK_FUNCS(pcre_compile pcre_study pcre_exec)
+
+AC_CONFIG_FILES([pcre.rules])
+AC_OUTPUT
Index: Src/Modules/pcre.mdd
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/pcre.mdd,v
retrieving revision 1.2
diff -u -r1.2 pcre.mdd
--- Src/Modules/pcre.mdd	6 Jul 2001 08:32:16 -0000	1.2
+++ Src/Modules/pcre.mdd	28 Feb 2004 20:45:40 -0000
@@ -5,3 +5,5 @@
 autobins="pcre_compile pcre_study pcre_match"
 
 objects="pcre.o"
+
+autoconf=yes
Index: Src/Modules/pcre.rules.in
===================================================================
RCS file: Src/Modules/pcre.rules.in
diff -N Src/Modules/pcre.rules.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Src/Modules/pcre.rules.in	28 Feb 2004 20:45:40 -0000
@@ -0,0 +1 @@
+EXTRALIBS_pcre = @LIBS@


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: redo of 16845
  2004-02-28 20:53 ` Clint Adams
@ 2004-02-28 21:44   ` Clint Adams
  2004-02-29  1:28     ` Geoff Wing
  0 siblings, 1 reply; 10+ messages in thread
From: Clint Adams @ 2004-02-28 21:44 UTC (permalink / raw)
  To: zsh-workers

> This works with GNU make and FreeBSD; still haven't tried Solaris.

Works with Solaris make, as long as you don't try to use a VPATH.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: redo of 16845
  2004-02-28 21:44   ` Clint Adams
@ 2004-02-29  1:28     ` Geoff Wing
  0 siblings, 0 replies; 10+ messages in thread
From: Geoff Wing @ 2004-02-29  1:28 UTC (permalink / raw)
  To: zsh-workers

Clint Adams <clint@zsh.org> typed:
:> This works with GNU make and FreeBSD; still haven't tried Solaris.
: Works with Solaris make, as long as you don't try to use a VPATH.

Blew up under NetBSD with native make in Src/Modules.

    gcc   -Wl,-x -shared --whole-archive -o parameter.so   parameter..o    -ltermcap -lm  -lc
    make: don't know how to make pcre.ach.in. Stop

I haven't looked into it yet.

Regards,
Geoff


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: redo of 16845
  2004-02-28 20:22 redo of 16845 Clint Adams
  2004-02-28 20:53 ` Clint Adams
@ 2004-02-29 19:22 ` Peter Stephenson
  2004-03-01 10:31   ` Oliver Kiddle
  1 sibling, 1 reply; 10+ messages in thread
From: Peter Stephenson @ 2004-02-29 19:22 UTC (permalink / raw)
  To: zsh-workers

Clint Adams wrote:
> This appears to work for GNU make.  FreeBSD 4.9's make chokes before the
> included file has been created.  I haven't tested with Solaris's make
> yet.

We probably ought to leave this for 4.2.1, now (that doesn't need to
be quite as delayed as 4.2.0 was).  There's no point risking breaking
the make system somewhere at this point.

I will try to get 4.2.0 out of the way this week; if we really need
a small patch to it we can branch.

pws


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: redo of 16845
  2004-02-29 19:22 ` Peter Stephenson
@ 2004-03-01 10:31   ` Oliver Kiddle
  2004-03-01 10:41     ` Peter Stephenson
  2004-03-07 14:28     ` Alexey Tourbin
  0 siblings, 2 replies; 10+ messages in thread
From: Oliver Kiddle @ 2004-03-01 10:31 UTC (permalink / raw)
  To: zsh-workers

Peter wrote:
> 
> We probably ought to leave this for 4.2.1, now (that doesn't need to
> be quite as delayed as 4.2.0 was).  There's no point risking breaking
> the make system somewhere at this point.

Should we perhaps pull the pcre module from 4.2.0 then? Though having
zsh linked against a library in /usr won't affect most users, it'll be
bad for anyone who is affected.

Oliver


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: redo of 16845
  2004-03-01 10:31   ` Oliver Kiddle
@ 2004-03-01 10:41     ` Peter Stephenson
  2004-03-01 13:29       ` Oliver Kiddle
  2004-03-07 14:28     ` Alexey Tourbin
  1 sibling, 1 reply; 10+ messages in thread
From: Peter Stephenson @ 2004-03-01 10:41 UTC (permalink / raw)
  To: zsh-workers

Oliver Kiddle wrote:
> Peter wrote:
> > 
> > We probably ought to leave this for 4.2.1, now (that doesn't need to
> > be quite as delayed as 4.2.0 was).  There's no point risking breaking
> > the make system somewhere at this point.
> 
> Should we perhaps pull the pcre module from 4.2.0 then? Though having
> zsh linked against a library in /usr won't affect most users, it'll be
> bad for anyone who is affected.

Mentioning it in the installation notes should be good enough, since
you can just set `link=no auto=no' in config.modules to avoid the
problem completely.  (Alternatively, we could set link=no in pcre.mdd.)
Either of these should avoid the need to remove it.

If somebody would like to compose the text indicating the problem...

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited. 
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: redo of 16845
  2004-03-01 10:41     ` Peter Stephenson
@ 2004-03-01 13:29       ` Oliver Kiddle
  2004-03-01 13:56         ` Peter Stephenson
  0 siblings, 1 reply; 10+ messages in thread
From: Oliver Kiddle @ 2004-03-01 13:29 UTC (permalink / raw)
  To: zsh-workers

Peter wrote:
> 
> Mentioning it in the installation notes should be good enough, since
> you can just set `link=no auto=no' in config.modules to avoid the
> problem completely.  (Alternatively, we could set link=no in pcre.mdd.)
> Either of these should avoid the need to remove it.

That doesn't help. configure has already decided that it needs to link
against the pcre library because there is nothing in configure.ac which
links the pcre setup to having the pcre module.

Also, with a solution like that you suggest, people packaging for
Linux distributions are possibly going to enable the pcre module. Since
self-building zsh tends to result in an install in /usr/local, it is
going to be mostly packaged copies of zsh that people use before /usr
is mounted. We can always branch for 4.2.0 if we want to make changes
specific to it.

Oliver


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: redo of 16845
  2004-03-01 13:29       ` Oliver Kiddle
@ 2004-03-01 13:56         ` Peter Stephenson
  0 siblings, 0 replies; 10+ messages in thread
From: Peter Stephenson @ 2004-03-01 13:56 UTC (permalink / raw)
  To: Zsh hackers list

Oliver Kiddle wrote:
> Peter wrote:
> > 
> > Mentioning it in the installation notes should be good enough, since
> > you can just set `link=no auto=no' in config.modules to avoid the
> > problem completely.  (Alternatively, we could set link=no in pcre.mdd.)
> > Either of these should avoid the need to remove it.
> 
> That doesn't help. configure has already decided that it needs to link
> against the pcre library because there is nothing in configure.ac which
> links the pcre setup to having the pcre module.

You're right, we probably need an explicit --enable for now.  Putting
that around the pcre checks and setting a flag to test in the .mdd
file should be good enough.

> Also, with a solution like that you suggest, people packaging for
> Linux distributions are possibly going to enable the pcre module.

That then creates a dependency of the zsh package on the pcre package.
That would be rather nasty regardless of the library availability.
There should certainly be no need to install pcre to get zsh working.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited. 
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: redo of 16845
  2004-03-01 10:31   ` Oliver Kiddle
  2004-03-01 10:41     ` Peter Stephenson
@ 2004-03-07 14:28     ` Alexey Tourbin
  1 sibling, 0 replies; 10+ messages in thread
From: Alexey Tourbin @ 2004-03-07 14:28 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 1195 bytes --]

On Mon, Mar 01, 2004 at 11:31:02AM +0100, Oliver Kiddle wrote:
> Should we perhaps pull the pcre module from 4.2.0 then? Though having
> zsh linked against a library in /usr won't affect most users, it'll be
> bad for anyone who is affected.

Right.  JFYI: I build zsh-4.2.0-pre-2 RPM package like this:

%build
# Explicitely disable libnsl/NIS support.
export ac_cv_search_yp_all=no zsh_cv_sys_nis=no zsh_cv_sys_nis_plus=no

# YODL is not required, pre-generated man pages are shipped.
export YODL=false

%configure \
	--enable-etcdir=%_sysconfdir \
	--enable-fndir=%_datadir/%name/functions \
	--enable-site-fndir=/usr/local/%name/site-functions \
	--enable-function-subdirs \
	--enable-maildir-support \
	--with-curses-terminfo \
	--enable-pcre \
	%{?_enable_debug: --enable-zsh-{,mem-,hash-}debug }

# Eliminate pcre deps for a while.
LIBS=`%__perl -ne 'print if s/^LIBS *=// && s/-lpcre//' Makefile`
[ -n "$LIBS" ]

# SMP-incompatible.
%make MODDIR=%_libdir LIBS="$LIBS"

# Restore pcre deps.
cd Src/Modules/
%__rm -fv pcre.so
%make MODDIR=%_libdir
cd ../..

# XXX `make test' is always successful.
%make test


-- 
Alexey Tourbin
ALT Linux Team

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2004-03-07 14:29 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-28 20:22 redo of 16845 Clint Adams
2004-02-28 20:53 ` Clint Adams
2004-02-28 21:44   ` Clint Adams
2004-02-29  1:28     ` Geoff Wing
2004-02-29 19:22 ` Peter Stephenson
2004-03-01 10:31   ` Oliver Kiddle
2004-03-01 10:41     ` Peter Stephenson
2004-03-01 13:29       ` Oliver Kiddle
2004-03-01 13:56         ` Peter Stephenson
2004-03-07 14:28     ` Alexey Tourbin

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).