about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
Diffstat (limited to 'Src')
-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
29 files changed, 193 insertions, 145 deletions
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