about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog17
-rw-r--r--Config/defs.mk.in3
-rw-r--r--Etc/zsh-development-guide13
-rw-r--r--INSTALL67
-rw-r--r--Src/.distfiles4
-rw-r--r--Src/Builtins/rlimits.mdd2
-rw-r--r--Src/Builtins/sched.mdd4
-rw-r--r--Src/Makefile.in34
-rw-r--r--Src/Makemod.in.in5
-rw-r--r--Src/Modules/cap.mdd4
-rw-r--r--Src/Modules/clone.mdd4
-rw-r--r--Src/Modules/example.mdd9
-rw-r--r--Src/Modules/files.mdd6
-rw-r--r--Src/Modules/mapfile.mdd4
-rw-r--r--Src/Modules/mathfunc.mdd4
-rw-r--r--Src/Modules/parameter.mdd6
-rw-r--r--Src/Modules/stat.mdd4
-rw-r--r--Src/Modules/zftp.mdd4
-rw-r--r--Src/Modules/zprof.mdd4
-rw-r--r--Src/Modules/zpty.mdd2
-rw-r--r--Src/Modules/zutil.mdd8
-rw-r--r--Src/Zle/compctl.mdd2
-rw-r--r--Src/Zle/complete.mdd2
-rw-r--r--Src/Zle/complist.mdd6
-rw-r--r--Src/Zle/computil.mdd2
-rw-r--r--Src/Zle/deltochar.mdd6
-rw-r--r--Src/Zle/zle.mdd4
-rw-r--r--Src/Zle/zleparameter.mdd8
-rw-r--r--Src/mkbltnmlst.sh90
-rw-r--r--Src/mkmakemod.sh21
-rw-r--r--Src/mkmodindex.sh43
-rw-r--r--Src/xmods.conf10
-rw-r--r--Src/zsh.mdd36
-rw-r--r--configure.in91
34 files changed, 332 insertions, 197 deletions
diff --git a/ChangeLog b/ChangeLog
index f7522a984..0f673b7c4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2000-11-26  Peter Stephenson  <pws@pwstephenson.fsnet.co.uk>
+
+	* 13194: INSTALL, configure.in, Config/defs.mk.in,
+	Etc/zsh-development-guide, Src/.distfiles, Src/Makefile.in,
+	Src/Makemod.in.in, Src/mkbltnmlst.sh, Src/mkmakemod.sh,
+	Src/zsh.mdd, Src/Builtins/rlimits.mdd, Src/Builtins/sched.mdd,
+	Src/Modules/cap.mdd, Src/Modules/clone.mdd,
+	Src/Modules/example.mdd, Src/Modules/files.mdd,
+	Src/Modules/mapfile.mdd, Src/Modules/mathfunc.mdd,
+	Src/Modules/parameter.mdd, Src/Modules/stat.mdd,
+	Src/Modules/zftp.mdd, Src/Modules/zprof.mdd, Src/Modules/zpty.mdd,
+	Src/Modules/zutil.mdd, Src/Zle/compctl.mdd, Src/Zle/complete.mdd,
+	Src/Zle/complist.mdd, Src/Zle/computil.mdd, Src/Zle/deltochar.mdd,
+	Src/Zle/zle.mdd, Src/Zle/zleparameter.mdd: New module
+	configuration system using file config.modules set up by
+	configure.
+
 2000-11-25  Bart Schaefer  <schaefer@zsh.org>
 
 	* 13192: Completion/Core/compinit, Src/params.c: Turn off
diff --git a/Config/defs.mk.in b/Config/defs.mk.in
index e586cea18..fbdb7f9f9 100644
--- a/Config/defs.mk.in
+++ b/Config/defs.mk.in
@@ -63,9 +63,6 @@ DLLD            = @DLLD@
 EXPOPT          = @EXPOPT@
 IMPOPT          = @IMPOPT@
 
-# choose modules not to compile and install
-OMIT_MODULES    = @OMIT_MODULES@
-
 # utilities
 AWK             = @AWK@
 YODL            = @YODL@
diff --git a/Etc/zsh-development-guide b/Etc/zsh-development-guide
index 0fc83d9b5..2815a91e4 100644
--- a/Etc/zsh-development-guide
+++ b/Etc/zsh-development-guide
@@ -7,7 +7,7 @@ This development takes place by mailing list.  Check the META-FAQ for the
 various zsh mailing lists and how to subscribe to them.  The development
 is very open and anyone is welcomed and encouraged to join and contribute.
 Because zsh is a very large package whose development can sometimes
-be very rapid, I kindly ask that people observe a few guidelines when
+be very rapid, we kindly ask that people observe a few guidelines when
 contributing patches and feedback to the mailing list.  These guidelines
 are very simple and hopefully should make for a more orderly development
 of zsh.
@@ -181,6 +181,17 @@ sourced when zsh is built. To describe the module it can/should set the
 following shell variables:
 
   - name            name of the module
+  - link            `static', `dynamic' or `no', as described in INSTALL.
+		    May also be a command string, which will be run within
+		    configure and whose output is used to set the value
+		    of `link' in config.modules.  This allows a
+		    system-specific choice of modules.  For example,
+		    link='case $host in *-hpux*) echo dynamic; ;;
+		                        *) echo no; ;; esac'
+  - load            `yes' or `no': whether the shell should include hooks
+		    for loading the module automatically as necessary.
+		    (This corresponds to an `L' in xmods.conf in the
+		    old mechanism.)
   - moddeps         modules on which this module depends (default none)
   - nozshdep        non-empty indicates no dependence on the `zsh/main'
                     pseudo-module
diff --git a/INSTALL b/INSTALL
index 4b95f8a54..f64c6e805 100644
--- a/INSTALL
+++ b/INSTALL
@@ -66,53 +66,44 @@ The zsh distribution contains several modules, in the Src/Builtins,
 Src/Modules and Src/Zle directories.  If you have any additional zsh
 modules that you wish to compile for this version of zsh, create another
 subdirectory of the Src directory and put them there.  You can create
-as many extra subdirectory hierarchies as you need.  The subdirectories
-must be actual directories; symbolic links will not work.
-
-If you wish to add or remove modules or module directories after you
-have already run make, then after adding or removing the modules run:
-    make prep
-
-You can also instruct the configuration process that a certain module
-should neither be compiled nor installed without modifying any files.  To
-do this, give the argument `--enable-omit-modules=mod1,mod2,...' to
-configure.  The module arguments are the full names of the modules,
-probably including the prefix `zsh/'.  For example,
-`configure --enable-omit-modules=zsh/zpty,zsh/example' says that the
-modules zsh/zpty and zsh/example are not to be compiled nor installed.
-Note that it is up to you to make sure the modules in question are not going
-to be compiled into the main zsh binary, as described in the next section.
-It is unlikely you would want to omit any of the modules liable to be
-compiled in by default.
-
-Controlling what is compiled into the main zsh binary
------------------------------------------------------
+as many extra subdirectories as you need, but currently configure will only
+search in immediate subdirectories of Src.  The subdirectories must be
+actual directories; symbolic links will not work.  You will then need to
+rerun configure; the easiest way is to run `config.status --recheck' from
+the top-level build directory which retains the existing configuration as
+much as possible.
+
+The key to the module system is the file config.modules, created in the
+configuration process.  Each module has a line in the file.  It may be
+edited to change the following values for each module; be careful to retain
+the (strict) format for the file:
+link - `dynamic', if the module is to be dynamically linked -- meaningless
+           if this is not available on your system.
+       `static' if the module is to be linked directly into the executable.
+       `no' if the module is not to be linked at all.  In this case it will
+           not even be compiled.
+load - `yes' if the module is to be visible to the user.  This will make
+           builtins, parameters etc. visible to the user without any need
+           to use the zmodload builtin.
+       `no' if an explicit zmodload command is to be required to load the
+           utilities in the module.  Note that this applies both to
+	   statically and dynamically linked modules.
+auto - `yes' if the entry is to be regenerated whenever configure is run.
+       `no' if you wish to retain your hand-edited version.
+Do not edit the entry for the pseudo-module zsh/main, which is the main
+shell.  After you have edited this file, run `make prep' in the Src
+subdirectory.
 
 By default the complete, compctl, zle, computil, complist, sched, parameter,
 zleparameter and rlimits modules are compiled into non-dynamic zsh and no
 modules are compiled into the main binary if dynamic loading is available.
-This can be overridden by creating the file mymods.conf in the compilation
-directory (Src, unless you have told configure to use another directory)
-with the list of modules which are to be compiled into the main binary, one
-module name per line with no punctuation and no suffix.  See the zshmodules
-manual page for the list of available modules.
-
-Note that mymods.conf replaces the standard list of linked-in modules from
-Src/xmods.conf.  If you wish to add to the standard list, copy the lines
-that begin with "L " from xmods.conf into mymods.conf and remove the "L "
-from each such line in mymods.conf.  Then add the names of other modules
-that you want to link.  Module names typically must begin with "zsh/";
-see the ".mdd" file for the module for the actual name.  The modules must
-be listed in dependency order, e.g., "zsh/zle" must precede "zsh/complete",
-"zsh/complete" must precede "zsh/compctl", and similarly for any other
-dependencies.
 
 Note that the modules depending on zle or complete (e.g.: complist and
 deltochar) cannot be loaded dynamically on systems which do not allow symbols
 in one dynamically loaded library to be visible from another; this is true,
 for example, of version 4 of SunOS.  The most convenient workaround is to
-compile zle and complete into the base executable by including them in
-mymods.conf as described above.
+compile zle and complete into the base executable by setting their `link'
+entries in config.modules to `static' as described above.
 
 Compiler Options or Using a Different Compiler
 ----------------------------------------------
diff --git a/Src/.distfiles b/Src/.distfiles
index d35b54232..2a0f1d276 100644
--- a/Src/.distfiles
+++ b/Src/.distfiles
@@ -5,9 +5,9 @@ DISTFILES_SRC='
     ansi2knr.c modentry.c
     builtin.c compat.c cond.c exec.c glob.c hashtable.c hashtable.h
     hist.c init.c input.c jobs.c lex.c linklist.c loop.c main.c makepro.awk
-    math.c mem.c mkbltnmlst.sh mkmakemod.sh mkmodindex.sh
+    math.c mem.c mkbltnmlst.sh mkmakemod.sh
     module.c options.c params.c parse.c pattern.c prompt.c prototypes.h
     signals.c signals.h string.c subst.c system.h text.c utils.c
-    watch.c xmods.conf zsh.h zsh.mdd ztype.h
+    watch.c zsh.h zsh.mdd ztype.h
     zsh.rc zsh.ico
 '
diff --git a/Src/Builtins/rlimits.mdd b/Src/Builtins/rlimits.mdd
index 61e7113f3..98a80b09c 100644
--- a/Src/Builtins/rlimits.mdd
+++ b/Src/Builtins/rlimits.mdd
@@ -1,4 +1,6 @@
 name=zsh/rlimits
+link=either
+load=yes
 
 autobins="limit ulimit unlimit"
 
diff --git a/Src/Builtins/sched.mdd b/Src/Builtins/sched.mdd
index 6ed749f32..5fa22dddd 100644
--- a/Src/Builtins/sched.mdd
+++ b/Src/Builtins/sched.mdd
@@ -1,3 +1,7 @@
+name=zsh/sched
+link=either
+load=yes
+
 autobins="sched"
 
 objects="sched.o"
diff --git a/Src/Makefile.in b/Src/Makefile.in
index 440254005..faa10cbfe 100644
--- a/Src/Makefile.in
+++ b/Src/Makefile.in
@@ -109,17 +109,7 @@ rm-modobjs-tmp:
 
 @CONFIG_MK@
 
-Makemod modules.index prep: modules-bltin $(CONFIG_INCS)
-	( cd $(sdir_top) && OMIT_MODULES="$(OMIT_MODULES)" \
-	$(SHELL) $(subdir)/mkmodindex.sh $(subdir) ) \
-	    > modules.index.tmp
-	@if cmp -s modules.index.tmp modules.index; then \
-	    rm -f modules.index.tmp; \
-	    echo "\`modules.index' is up to date."; \
-	else \
-	    mv -f modules.index.tmp modules.index; \
-	    echo "Updated \`modules.index'."; \
-	fi
+Makemod prep: $(CONFIG_INCS) $(dir_top)/config.modules
 	@case $(sdir_top) in \
 	    /*) top_srcdir=$(sdir_top) ;; \
 	    *) top_srcdir=$(subdir)/$(sdir_top) ;; \
@@ -140,21 +130,6 @@ FORCE:
 mymods.conf:
 	@echo Linking with the standard modules.
 
-modules-bltin:: mymods.conf
-	@if test -f mymods.conf; then \
-	    echo cat mymods.conf \> $@; \
-	    cat mymods.conf > $@; \
-	fi
-
-modules-bltin:: $(dir_top)/config.status $(sdir)/xmods.conf
-	if test -f mymods.conf; then \
-	    cat mymods.conf > $@; \
-	elif test @D@ = N; then \
-	    sed -n '/L.* /{s/^.* //;p;}' < $(sdir)/xmods.conf > $@; \
-	else \
-	    echo > $@; \
-	fi
-
 modules: $(@E@NTRYOBJ)
 
 $(ENTRYOBJ): FORCE
@@ -228,14 +203,13 @@ mostlyclean-here:
 .PHONY: mostlyclean-here
 
 clean-here:
-	rm -f modules.index.tmp modules.stamp zsh$(EXEEXT) ansi2knr.o ansi2knr
+	rm -f modules.stamp zsh$(EXEEXT) ansi2knr.o ansi2knr
 	rm -f libzsh-*.$(DL_EXT)
 .PHONY: clean-here
 
 distclean-here:
 	rm -f TAGS tags
-	rm -f modules.index modules-bltin
-	rm -f Makefile mymods.conf
+	rm -f Makefile
 .PHONY: distclean-here
 
 mostlyclean: mostlyclean-modules
@@ -245,7 +219,7 @@ realclean: realclean-modules
 .PHONY: mostlyclean clean distclean realclean
 
 # Don't remake Makemod just to delete things, even if it doesn't exist.
-mostlyclean-modules clean-modules distclean-modules realclean-modules: modules.index
+mostlyclean-modules clean-modules distclean-modules realclean-modules:
 	if test -f Makemod; then \
 	  $(MAKE) -f Makemod $(MAKEDEFS) `echo $@ | sed 's/-modules//'`; \
 	fi; \
diff --git a/Src/Makemod.in.in b/Src/Makemod.in.in
index 1d4045ff1..e5266e222 100644
--- a/Src/Makemod.in.in
+++ b/Src/Makemod.in.in
@@ -177,7 +177,8 @@ $(makefile): $(makefile).in $(dir_top)/config.status
 	cd $(dir_top) && \
 	    $(SHELL) $$top_srcdir/Src/mkmakemod.sh -m $(subdir) $(makefile)
 
-$(makefile).in: $(sdir_src)/mkmakemod.sh $(sdir_src)/Makemod.in.in $(MDDS) $(dir_src)/modules-bltin
+$(makefile).in: $(sdir_src)/mkmakemod.sh $(sdir_src)/Makemod.in.in $(MDDS) \
+	$(dir_top)/config.modules
 	@case $(sdir_top) in \
 	    /*) top_srcdir=$(sdir_top) ;; \
 	    *) top_srcdir=$(subdir)/$(sdir_top) ;; \
@@ -188,5 +189,3 @@ $(makefile).in: $(sdir_src)/mkmakemod.sh $(sdir_src)/Makemod.in.in $(MDDS) $(dir
 	cd $(dir_top) && \
 	    $(SHELL) $$top_srcdir/Src/mkmakemod.sh -i $(subdir) $(makefile)
 
-$(dir_src)/modules-bltin:
-	@cd $(dir_src) && $(MAKE) $(MAKEDEFS) modules-bltin
diff --git a/Src/Modules/cap.mdd b/Src/Modules/cap.mdd
index 97f377e9d..4e7ee7216 100644
--- a/Src/Modules/cap.mdd
+++ b/Src/Modules/cap.mdd
@@ -1,3 +1,7 @@
+name=zsh/cap
+link=dynamic
+load=no
+
 autobins="cap getcap setcap"
 
 objects="cap.o"
diff --git a/Src/Modules/clone.mdd b/Src/Modules/clone.mdd
index 5277d3151..8e4181bd4 100644
--- a/Src/Modules/clone.mdd
+++ b/Src/Modules/clone.mdd
@@ -1,3 +1,7 @@
+name=zsh/clone
+link=dynamic
+load=no
+
 autobins="clone"
 
 objects="clone.o"
diff --git a/Src/Modules/example.mdd b/Src/Modules/example.mdd
index 89f12097c..b3fcc92f7 100644
--- a/Src/Modules/example.mdd
+++ b/Src/Modules/example.mdd
@@ -1,3 +1,12 @@
+name=zsh/example
+link=dynamic
+load=no
+
 autobins="example"
 
+autoinfixconds="ex"
+autoprefixconds="len"
+autoparams="exint exstr exarr"
+automathfuncs="sum length"
+
 objects="example.o"
diff --git a/Src/Modules/files.mdd b/Src/Modules/files.mdd
index 236ca2d5a..18e69a45c 100644
--- a/Src/Modules/files.mdd
+++ b/Src/Modules/files.mdd
@@ -1,3 +1,7 @@
-autobins="ln mkdir mv rm rmdir sync"
+name=zsh/files
+link=dynamic
+load=no
+
+autobins="chgrp chown ln mkdir mv rm rmdir sync"
 
 objects="files.o"
diff --git a/Src/Modules/mapfile.mdd b/Src/Modules/mapfile.mdd
index 9adb36162..0a96caa0a 100644
--- a/Src/Modules/mapfile.mdd
+++ b/Src/Modules/mapfile.mdd
@@ -1,3 +1,7 @@
+name=zsh/mapfile
+link=dynamic
+load=no
+
 autoparams="mapfile"
 
 objects="mapfile.o"
diff --git a/Src/Modules/mathfunc.mdd b/Src/Modules/mathfunc.mdd
index 33a861f77..4d3dd934a 100644
--- a/Src/Modules/mathfunc.mdd
+++ b/Src/Modules/mathfunc.mdd
@@ -1,3 +1,7 @@
+name=zsh/mathfunc
+link=dynamic
+load=no
+
 autobins="mathfunc"
 
 objects="mathfunc.o"
diff --git a/Src/Modules/parameter.mdd b/Src/Modules/parameter.mdd
index e2820aa9c..a24d1b2c5 100644
--- a/Src/Modules/parameter.mdd
+++ b/Src/Modules/parameter.mdd
@@ -1,3 +1,7 @@
-autoparams="parameters commands functions options"
+name=zsh/parameter
+link=either
+load=yes
+
+autoparams="parameters commands functions dis_functions funcstack builtins dis_builtins reswords dis_reswords options modules dirstack history historywords jobtexts jobdirs jobstates nameddirs userdirs aliases dis_aliases galiases dis_galiases"
 
 objects="parameter.o"
diff --git a/Src/Modules/stat.mdd b/Src/Modules/stat.mdd
index b775fda09..2534b1bdb 100644
--- a/Src/Modules/stat.mdd
+++ b/Src/Modules/stat.mdd
@@ -1,3 +1,7 @@
+name=zsh/stat
+link=dynamic
+load=no
+
 autobins="stat"
 
 objects="stat.o"
diff --git a/Src/Modules/zftp.mdd b/Src/Modules/zftp.mdd
index 83051ae54..e295f254a 100644
--- a/Src/Modules/zftp.mdd
+++ b/Src/Modules/zftp.mdd
@@ -1,3 +1,7 @@
+name=zsh/zftp
+link=dynamic
+load=no
+
 autobins="zftp"
 
 objects="zftp.o"
diff --git a/Src/Modules/zprof.mdd b/Src/Modules/zprof.mdd
index de473cbba..c6cf563fa 100644
--- a/Src/Modules/zprof.mdd
+++ b/Src/Modules/zprof.mdd
@@ -1,3 +1,7 @@
+name=zsh/zprof
+link=dynamic
+load=no
+
 autobins="zprof"
 
 objects="zprof.o"
diff --git a/Src/Modules/zpty.mdd b/Src/Modules/zpty.mdd
index eeef7cdcc..c6a9c5a7f 100644
--- a/Src/Modules/zpty.mdd
+++ b/Src/Modules/zpty.mdd
@@ -1,4 +1,6 @@
 name=zsh/zpty
+link=dynamic
+load=no
 
 autobins="zpty"
 
diff --git a/Src/Modules/zutil.mdd b/Src/Modules/zutil.mdd
index edc1f0d32..587677dc2 100644
--- a/Src/Modules/zutil.mdd
+++ b/Src/Modules/zutil.mdd
@@ -1,3 +1,9 @@
+name=zsh/zutil
+link=either
+load=yes
+
+moddeps="zsh/complete"
+
 objects="zutil.o"
 
-autobins="zformat zstyle"
+autobins="zformat zstyle zregexparse zparseopts"
diff --git a/Src/Zle/compctl.mdd b/Src/Zle/compctl.mdd
index b4e1756fb..f4fc1d0b4 100644
--- a/Src/Zle/compctl.mdd
+++ b/Src/Zle/compctl.mdd
@@ -1,4 +1,6 @@
 name=zsh/compctl
+link=either
+load=yes
 
 moddeps="zsh/complete zsh/zle"
 
diff --git a/Src/Zle/complete.mdd b/Src/Zle/complete.mdd
index 8d4a59d66..a8ed9a484 100644
--- a/Src/Zle/complete.mdd
+++ b/Src/Zle/complete.mdd
@@ -1,4 +1,6 @@
 name=zsh/complete
+link=either
+load=yes
 
 moddeps="zsh/zle"
 
diff --git a/Src/Zle/complist.mdd b/Src/Zle/complist.mdd
index 8ea60b0a8..936a7fd77 100644
--- a/Src/Zle/complist.mdd
+++ b/Src/Zle/complist.mdd
@@ -1,3 +1,7 @@
-moddeps="comp1 zle"
+name=zsh/complist
+link=either
+load=yes
+
+moddeps="zsh/complete zsh/zle"
 
 objects="complist.o"
diff --git a/Src/Zle/computil.mdd b/Src/Zle/computil.mdd
index 318fbbcd6..161177859 100644
--- a/Src/Zle/computil.mdd
+++ b/Src/Zle/computil.mdd
@@ -1,4 +1,6 @@
 name=zsh/computil
+link=either
+load=yes
 
 moddeps="zsh/complete zsh/zle"
 
diff --git a/Src/Zle/deltochar.mdd b/Src/Zle/deltochar.mdd
index 4d1f89d1c..6b68b63fe 100644
--- a/Src/Zle/deltochar.mdd
+++ b/Src/Zle/deltochar.mdd
@@ -1,3 +1,7 @@
-moddeps="zle"
+name=zsh/deltochar
+link=dynamic
+load=no
+
+moddeps="zsh/zle"
 
 objects="deltochar.o"
diff --git a/Src/Zle/zle.mdd b/Src/Zle/zle.mdd
index 29f39d363..c5675cb03 100644
--- a/Src/Zle/zle.mdd
+++ b/Src/Zle/zle.mdd
@@ -1,4 +1,6 @@
-moddeps="comp1"
+name=zsh/zle
+link=either
+load=yes
 
 autobins="bindkey vared zle"
 
diff --git a/Src/Zle/zleparameter.mdd b/Src/Zle/zleparameter.mdd
index f9d528661..ef3e1d5f5 100644
--- a/Src/Zle/zleparameter.mdd
+++ b/Src/Zle/zleparameter.mdd
@@ -1,5 +1,9 @@
-moddeps="zle"
+name=zsh/zleparameter
+link=either
+load=yes
 
-autoparams="zlewidgets zlekeymaps"
+moddeps="zsh/zle"
+
+autoparams="widgets keymaps"
 
 objects="zleparameter.o"
diff --git a/Src/mkbltnmlst.sh b/Src/mkbltnmlst.sh
index 4a90ecd20..3eda6b448 100644
--- a/Src/mkbltnmlst.sh
+++ b/Src/mkbltnmlst.sh
@@ -4,50 +4,77 @@
 #
 # Written by Andrew Main
 #
+
 srcdir=${srcdir-`echo $0|sed 's%/[^/][^/]*$%%'`}
 test "x$srcdir" = "x$0" && srcdir=.
 test "x$srcdir" = "x"   && srcdir=.
-MODBINS=${MODBINS-modules-bltin}
-XMODCF=${XMODCF-$srcdir/xmods.conf}
+CFMOD=${CFMOD-$srcdir/../config.modules}
+
+bin_mods="`grep ' link=static' $CFMOD | sed -e '/^#/d' \
+-e 's/ .*/ /' -e 's/^name=/ /'`"
 
-bin_mods=" zsh "`sed 's/^/ /;s/$/ /' $MODBINS`
-x_mods=`cat $XMODCF`
-. ./modules.index
+x_mods="`grep ' load=yes' $CFMOD | sed -e '/^#/d' -e '/ link=no/d' \
+-e 's/ .*/ /' -e 's/^name=/ /'`"
 
 trap "rm -f $1; exit 1" 1 2 15
 
 exec > $1
 
-echo "#ifdef DYNAMIC"
 for x_mod in $x_mods; do
-    case $bin_mods in
-	*" $x_mod "*) ;;
-	*)  echo "/* non-linked-in known module \`$x_mod' */"
-	    eval "loc=\$loc_$x_mod"
-	    unset moddeps autobins
-	    . $srcdir/../$loc/${x_mod}.mdd
-	    for bin in $autobins; do
-		echo "    add_autobin(\"$bin\", \"$x_mod\");"
-	    done
-	    for dep in $moddeps; do
-		case $bin_mods in
-		    *" $dep "*)
-			echo "    /* depends on \`$dep' */" ;;
-		    *)	echo "    add_dep(\"$x_mod\", \"$dep\");" ;;
-		esac
-	    done ;;
+    modfile="`grep '^name='$x_mod' ' $CFMOD | sed -e 's/^.* modfile=//' \
+      -e 's/ .*//'`"
+    if test "x$modfile" = x; then
+	echo >&2 "WARNING: no name for \`$x_mod' in $CFMOD (ignored)"
+	continue
+    fi
+    case "$bin_mods" in
+    *" $x_mod "*)
+        echo "/* linked-in known module \`$x_mod' */"
+	linked=yes
+	;;
+    *)
+        echo "#ifdef DYNAMIC"
+        echo "/* non-linked-in known module \`$x_mod' */"
+	linked=no
     esac
+    unset moddeps autobins autoinfixconds autoprefixconds autoparams
+    unset automathfuncs
+    . $srcdir/../$modfile
+    for bin in $autobins; do
+	echo "    add_autobin(\"$bin\", \"$x_mod\");"
+    done
+    for cond in $autoinfixconds; do
+	echo "    add_autocond(\"$cond\", 1, \"$x_mod\");"
+    done
+    for cond in $autoprefixconds; do
+	echo "    add_autocond(\"$cond\", 0, \"$x_mod\");"
+    done
+    for param in $autoparams; do
+	echo "    add_autoparam(\"$param\", \"$x_mod\");"
+    done
+    for mfunc in $automathfuncs; do
+	echo "    add_automath(\"$mfunc\", \"$x_mod\");"
+    done
+    for dep in $moddeps; do
+	echo "    add_dep(\"$x_mod\", \"$dep\");"
+    done
+    test "x$linked" = xno && echo "#endif"
 done
-echo "#endif /* DYNAMIC */"
+
 echo
 done_mods=" "
 for bin_mod in $bin_mods; do
+    q_bin_mod=`echo $bin_mod | sed 's,Q,Qq,g;s,_,Qu,g;s,/,Qs,g'`
+    modfile="`grep '^name='$bin_mod' ' $CFMOD | sed -e 's/^.* modfile=//' \
+      -e 's/ .*//'`"
     echo "/* linked-in module \`$bin_mod' */"
-    eval "loc=\$loc_$bin_mod"
     unset moddeps
-    . $srcdir/../$loc/${bin_mod}.mdd
+    . $srcdir/../$modfile
     for dep in $moddeps; do
-	case $done_mods in
+	# This assumes there are no circular dependencies in the builtin
+	# modules.  Better ordering of config.modules would be necessary
+	# to enforce stricter dependency checking.
+	case $bin_mods in
 	    *" $dep "*)
 		echo "    /* depends on \`$dep' */" ;;
 	    *)	echo >&2 "ERROR: linked-in module \`$bin_mod' depends on \`$dep'"
@@ -55,6 +82,15 @@ for bin_mod in $bin_mods; do
 		exit 1 ;;
 	esac
     done
-    echo "    mod.nam = \"$bin_mod\"; boot_$bin_mod(&mod);"
+    echo "    {"
+    echo "        extern int setup_${q_bin_mod} _((Module));"
+    echo "        extern int boot_${q_bin_mod} _((Module));"
+    echo "        extern int cleanup_${q_bin_mod} _((Module));"
+    echo "        extern int finish_${q_bin_mod} _((Module));"
+    echo
+    echo "        register_module(\"$bin_mod\","
+    echo "                        setup_${q_bin_mod}, boot_${q_bin_mod},"
+    echo "                        cleanup_${q_bin_mod}, finish_${q_bin_mod});"
+    echo "    }"
     done_mods="$done_mods$bin_mod "
 done
diff --git a/Src/mkmakemod.sh b/Src/mkmakemod.sh
index e0ef05c9c..98b9199df 100644
--- a/Src/mkmakemod.sh
+++ b/Src/mkmakemod.sh
@@ -90,6 +90,8 @@ 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
@@ -99,12 +101,16 @@ if $first_stage; then
     echo "##### ===== DEFINITIONS ===== #####"
     echo
     echo "makefile = ${the_makefile}"
-    echo "dir_top = "`echo $the_subdir | sed 's,[^/][^/]*,..,g'`
-    echo "subdir = $the_subdir"
+    echo "dir_top = ${dir_top}"
+    echo "subdir = ${the_subdir}"
     echo
 
-    . Src/modules.index
-    bin_mods=" zsh/main "`sed 's/^/ /;s/$/ /' Src/modules-bltin`
+    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}"
+
     if grep '%@D@%D%' config.status >/dev/null; then
 	is_dynamic=true
     else
@@ -120,8 +126,8 @@ if $first_stage; then
     all_proto=
     lastsub=//
     for module in $module_list; do
-	q_module=`echo $module | sed 's,Q,Qq,g;s,_,Qu,g;s,/,Qs,g'`
-	eval "modfile=\$modfile_$q_module"
+        modfile="`grep '^name='$module' ' ./config.modules | \
+	  sed -e 's/^.* modfile=//' -e 's/ .*//'`"
 	case $modfile in
 	    $the_subdir/$lastsub/*) ;;
 	    $the_subdir/*/*)
@@ -194,9 +200,10 @@ if $first_stage; then
 	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 "depfile=\$modfile_$q_dep"
 	    eval `echo $depfile | sed 's,/\([^/]*\)\.mdd$,;depbase=\1,;s,^,loc=,'`
 	    case "$binmod" in
 		*" $dep "* )
diff --git a/Src/mkmodindex.sh b/Src/mkmodindex.sh
deleted file mode 100644
index b4616f638..000000000
--- a/Src/mkmodindex.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/sh
-#
-# mkmodindex.sh: search for *.mdd files, and index the modules
-#
-# $@ = directories to search from
-#
-
-echo "# module index generated by mkmodindex.sh"
-echo
-
-module_list=' '
-while test $# -ne 0; do
-    dir=$1
-    shift
-    ( set $dir/*.mdd; test -f $1 ) || continue
-    dosubs=false
-    for mod in `echo '' $dir/*.mdd '' | sed 's, [^ ]*/, ,g;s,\.mdd , ,g'`; do
-	case `echo "$mod@ $module_list " | sed 's,^.*[^_0-9A-Za-z].*@,@@,'` in
-	    @@*)
-		echo >&2 "WARNING: illegally named module \`$mod' in $dir"
-		echo >&2 "         (ignoring it)"
-		;;
-	    *@*" $mod "*)
-		eval "loc=\$loc_$mod"
-		echo >&2 "WARNING: module \`$mod' (in $loc) duplicated in $dir"
-		echo >&2 "         (ignoring duplicate)"
-		dosubs=true
-		;;
-	    *)
-		module_list="$module_list$mod "
-		echo "loc_$mod=$dir"
-		eval "loc_$mod=\$dir"
-		dosubs=true
-		;;
-	esac
-    done
-    $dosubs && set `echo $dir/*/. '' | sed 's,/\. , ,g'` "$@"
-done
-
-echo
-echo $module_list | sed 's/^/module_list="/;s/$/"/'
-
-exit 0
diff --git a/Src/xmods.conf b/Src/xmods.conf
deleted file mode 100644
index 9cc5c4751..000000000
--- a/Src/xmods.conf
+++ /dev/null
@@ -1,10 +0,0 @@
-L zsh/rlimits
-L zsh/zle
-L zsh/complete
-L zsh/compctl
-L zsh/sched
-L zsh/complist
-L zsh/zutil
-L zsh/computil
-L zsh/parameter
-L zsh/zleparameter
diff --git a/Src/zsh.mdd b/Src/zsh.mdd
index 78746a873..56cd081e8 100644
--- a/Src/zsh.mdd
+++ b/Src/zsh.mdd
@@ -1,4 +1,7 @@
 name=zsh/main
+link=static
+load=yes
+# load=static should replace use of alwayslink
 
 nozshdep=1
 alwayslink=1
@@ -57,24 +60,27 @@ zshpaths.h: Makemod $(CONFIG_INCS)
 	    echo "Updated \`zshpaths.h'." ; \
 	fi
 
-bltinmods.list: modules.stamp modules-bltin xmods.conf mkbltnmlst.sh
-	srcdir='$(sdir)' MODBINS='modules-bltin' \
-	XMODCF='$(sdir)/xmods.conf' $(SHELL) $(sdir)/mkbltnmlst.sh $@
+bltinmods.list: modules.stamp mkbltnmlst.sh $(dir_top)/config.modules
+	srcdir='$(sdir)' CFMOD='$(dir_top)/config.modules' \
+	  $(SHELL) $(sdir)/mkbltnmlst.sh $@
 
-zshxmods.h: modules-bltin xmods.conf
+zshxmods.h: $(dir_top)/config.modules
 	@echo "Creating \`$@'."
 	@( \
-	    binmods=`sed 's/^/ /;s/$$/ /' modules-bltin`; \
-	    for mod in `sed 's/^.* //' $(sdir_src)/xmods.conf`; do \
-		q_mod=`echo $$mod | sed 's,Q,Qq,g;s,_,Qu,g;s,/,Qs,g'`; \
-		case $$binmods in \
-		    *" $$mod "*) \
-			echo "#define    LINKED_XMOD_$$q_mod 1" ;; \
-		    *)  echo "#ifdef DYNAMIC"; \
-			echo "# define UNLINKED_XMOD_$$q_mod 1"; \
-			echo "#endif" ;; \
-		esac; \
-	    done \
+	    for q_mod in `grep ' load=yes' $(dir_top)/config.modules | \
+	      grep ' link=static' | sed -e '/^#/d' -e 's/ .*//' \
+	        -e 's/^name=//' -e 's,Q,Qq,g;s,_,Qu,g;s,/,Qs,g'`; do \
+		test x$q_mod = xzshQsmain && continue; \
+	        echo "#define LINKED_XMOD_$$q_mod 1"; \
+	    done; \
+	    for q_mod in `grep ' load=yes' $(dir_top)/config.modules | \
+	      grep ' link=dynamic' | sed -e '/^#/d' -e 's/ .*//' \
+	        -e 's/^name=//' -e 's,Q,Qq,g;s,_,Qu,g;s,/,Qs,g'`; do \
+		test x$q_mod = x && continue; \
+	        echo "#ifdef DYNAMIC"; \
+		echo "# define UNLINKED_XMOD_$$q_mod 1"; \
+		echo "#endif"; \
+	    done; \
 	) > $@
 
 clean-here: clean.zsh
diff --git a/configure.in b/configure.in
index fa268707f..b14a15fbb 100644
--- a/configure.in
+++ b/configure.in
@@ -189,16 +189,6 @@ AC_ARG_ENABLE(dynamic,
 [  --disable-dynamic          turn off dynamically loaded binary modules],
 [dynamic="$enableval"], [dynamic=yes])
 
-dnl Do you want to disable a list of modules?
-dnl Unfortunately we can't give --disable-* a value, so we'll have
-dnl to do it as an `--enable-*', rather unnaturally.
-undefine([OMIT_MODULES])dnl
-AC_ARG_ENABLE(omit-modules,
-[  --enable-omit-modules      give comma-separated list of modules to ignore],
-[OMIT_MODULES="$enableval"], [OMIT_MODULES=])
-
-AC_SUBST(OMIT_MODULES)dnl
-
 dnl Do you want to compile as K&R C.
 AC_ARG_ENABLE(ansi2knr,
 [  --enable-ansi2knr          translate source to K&R C before compiling],
@@ -1713,6 +1703,87 @@ AC_SUBST(MOD_IMPORT_VARIABLE)dnl
 AC_SUBST(MOD_IMPORT_FUNCTION)dnl
 AC_SUBST(EXTRAZSHOBJS)dnl
 
+# Generate config.modules.  We look for *.mdd files in first and second
+# level subdirectories.  Any existing line not containing 'auto=y' will be
+# retained, provided the .mdd file itself was found.
+CONFIG_MODULES=./config.modules
+echo "creating ${CONFIG_MODULES}"
+userlist=" "
+if test -f config.modules; then
+  userlist=`sed -e '/^#/d' -e '/auto=y/d' -e 's/ .*/ /' -e 's/^name=/ /' \
+        ${CONFIG_MODULES}`
+  mv ${CONFIG_MODULES} ${CONFIG_MODULES}.old
+fi
+(cd ${srcdir}
+echo "# Edit this file to change the way modules are loaded."
+echo "# The format is strict; do not break lines or add extra spaces."
+echo "#"
+echo "# Values of \`link' are \`static', \`dynamic' or \`no' to compile the"
+echo "# module into the shell, link it in at run time, or not use it at all."
+echo "# In the final case, no attempt will be made to compile it."
+echo "# Use \`static' or \`no' if you do not have dynamic loading."
+echo "#"
+echo "# Values of \`load' are \`yes' or \`no'; if yes, any builtins etc."
+echo "# provided by the module will be autoloaded by the main shell"
+echo "# (so long as \`link' is not set to \`no')."
+echo "#"
+echo "# Values of \`auto' are \`yes' or \`no'. configure sets the value to"
+echo "# \`yes'.  If you set it by hand to \`no', the line will be retained"
+echo "# when the file is regenerated in future."
+echo "#"
+echo "# You will need to run \`config.status --recheck' if you add a new"
+echo "# module."
+echo "#"
+echo "# You should not change the values for the pseudo-module zsh/main,"
+echo "# which is the main shell."
+for modfile in */*.mdd */*/*.mdd; do
+  name=
+  link=
+  load=
+  . $modfile
+  if test x$name != x -a x$link != x; then
+    case $userlist in
+    *" $name "*) # not autogenerated, keep original
+                grep "^name=$name " ${CONFIG_MODULES}.old
+		;;
+    *) case $link in
+	  *\ *) eval 'link=`'$link'`'
+	       ;;
+       esac
+       case "${load}" in
+	y*) load=" load=yes"
+	    ;;
+	 *) load=" load=no"
+	    ;;
+       esac
+       case $link in
+	 static) echo "name=$name modfile=$modfile link=static auto=yes${load}"
+	         ;;
+	 dynamic) if test $dynamic != no; then
+		    echo "name=$name modfile=$modfile link=dynamic\
+ auto=yes${load}"
+		  else
+		    echo "name=$name modfile=$modfile link=no\
+ auto=no load=no"
+		  fi
+		  ;;
+	 either) if test $dynamic != no; then
+		   echo "name=$name modfile=$modfile link=dynamic\
+ auto=yes${load}"
+		 else
+		   echo "name=$name modfile=$modfile link=static\
+ auto=yes${load}"
+		 fi
+		 ;;
+	      *) echo "name=$name modfile=$modfile link=no auto=yes load=no"
+		 ;;
+       esac
+       ;;
+    esac
+  fi
+done) >${CONFIG_MODULES}
+rm -f ${CONFIG_MODULES}.old
+
 CLEAN_MK="${srcdir}/Config/clean.mk"
 CONFIG_MK="${srcdir}/Config/config.mk"
 dnl defs.mk is in the build tree, not the source tree