zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: Module configuration changes
@ 2000-11-26 19:55 Peter Stephenson
  2000-11-27  9:02 ` Andrej Borsenkow
  2000-11-27 11:20 ` Peter Stephenson
  0 siblings, 2 replies; 4+ messages in thread
From: Peter Stephenson @ 2000-11-26 19:55 UTC (permalink / raw)
  To: Zsh hackers list

Here is the first stage in an improvement in the way modules are
configured.  The new system revolves around the file config.modules,
created by configure.  This means you need to rerun configure when you add
a new module (`config.status --recheck' will do).  This was the only way to
allow system-specific configuration of modules.

The INSTALL guide and the comments at the top of config.modules describe
how to use it, so I won't go into the details.  It replaces the files
xmods.conf, mymods.conf, a couple of temporary files, and the
--enable-omit-modules configure option, so its no use trying to use those
any more.  The new way allows you to set `auto=no' in config.modules to say
that a line should not be overwritten, so I hope this will be powerful
enough to replace the old system without any difficulties.

The intention is to add support for module-specific functions, so that
e.g. the zftp functions are installed if and only zftp is installed
(although you will be able to edit the appropriate line in config.modules
for more control).

I have tested this on my own setup --- but there are a lot of possible
variations, so it will need a good deal of testing by other people over the
next few days.  To encourage this, I shall commit it straight away.  Until
you report the bugs you won't be able to compile the shell.  This sounds
like a good incentive.

I also need to add a few more tests in the configure code, which I haven't
got around to yet.

Index: INSTALL
===================================================================
RCS file: /cvsroot/zsh/zsh/INSTALL,v
retrieving revision 1.3
diff -u -r1.3 INSTALL
--- INSTALL	2000/08/11 18:27:04	1.3
+++ INSTALL	2000/11/26 19:46:25
@@ -66,53 +66,44 @@
 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.
+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.
 
-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
------------------------------------------------------
-
 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
 ----------------------------------------------
Index: configure.in
===================================================================
RCS file: /cvsroot/zsh/zsh/configure.in,v
retrieving revision 1.32
diff -u -r1.32 configure.in
--- configure.in	2000/09/18 14:22:48	1.32
+++ configure.in	2000/11/26 19:46:32
@@ -189,16 +189,6 @@
 [  --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],
@@ -1712,6 +1702,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"
Index: Config/defs.mk.in
===================================================================
RCS file: /cvsroot/zsh/zsh/Config/defs.mk.in,v
retrieving revision 1.2
diff -u -r1.2 defs.mk.in
--- Config/defs.mk.in	2000/05/26 09:47:28	1.2
+++ Config/defs.mk.in	2000/11/26 19:46:35
@@ -63,9 +63,6 @@
 EXPOPT          = @EXPOPT@
 IMPOPT          = @IMPOPT@
 
-# choose modules not to compile and install
-OMIT_MODULES    = @OMIT_MODULES@
-
 # utilities
 AWK             = @AWK@
 YODL            = @YODL@
Index: Etc/zsh-development-guide
===================================================================
RCS file: /cvsroot/zsh/zsh/Etc/zsh-development-guide,v
retrieving revision 1.3
diff -u -r1.3 zsh-development-guide
--- Etc/zsh-development-guide	2000/05/01 03:53:05	1.3
+++ Etc/zsh-development-guide	2000/11/26 19:46:40
@@ -7,7 +7,7 @@
 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 @@
 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
Index: Src/.distfiles
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/.distfiles,v
retrieving revision 1.3
diff -u -r1.3 .distfiles
--- Src/.distfiles	2000/09/19 15:54:31	1.3
+++ Src/.distfiles	2000/11/26 19:46:42
@@ -5,9 +5,9 @@
     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
 '
Index: Src/Makefile.in
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Makefile.in,v
retrieving revision 1.6
diff -u -r1.6 Makefile.in
--- Src/Makefile.in	2000/08/16 13:23:37	1.6
+++ Src/Makefile.in	2000/11/26 19:46:42
@@ -109,17 +109,7 @@
 
 @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 @@
 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 @@
 .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 @@
 .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; \
Index: Src/Makemod.in.in
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Makemod.in.in,v
retrieving revision 1.3
diff -u -r1.3 Makemod.in.in
--- Src/Makemod.in.in	2000/07/28 10:13:26	1.3
+++ Src/Makemod.in.in	2000/11/26 19:46:44
@@ -177,7 +177,8 @@
 	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 @@
 	cd $(dir_top) && \
 	    $(SHELL) $$top_srcdir/Src/mkmakemod.sh -i $(subdir) $(makefile)
 
-$(dir_src)/modules-bltin:
-	@cd $(dir_src) && $(MAKE) $(MAKEDEFS) modules-bltin
Index: Src/mkbltnmlst.sh
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/mkbltnmlst.sh,v
retrieving revision 1.1.1.15
diff -u -r1.1.1.15 mkbltnmlst.sh
--- Src/mkbltnmlst.sh	1999/12/22 16:16:51	1.1.1.15
+++ Src/mkbltnmlst.sh	2000/11/26 19:46:44
@@ -8,22 +8,23 @@
 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=" zsh/main "`sed 's/^/ /;s/$/ /' $MODBINS`
-x_mods=`sed 's/^.* //' $XMODCF`
-. ./modules.index
+bin_mods="`grep ' link=static' $CFMOD | sed -e '/^#/d' \
+-e 's/ .*/ /' -e 's/^name=/ /'`"
 
+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
 
 for x_mod in $x_mods; do
-    q_x_mod=`echo $x_mod | sed 's,Q,Qq,g;s,_,Qu,g;s,/,Qs,g'`
-    eval "modfile=\$modfile_$q_x_mod"
+    modfile="`grep '^name='$x_mod' ' $CFMOD | sed -e 's/^.* modfile=//' \
+      -e 's/ .*//'`"
     if test "x$modfile" = x; then
-	echo >&2 "WARNING: $XMODCF lists non-existent module \`$x_mod' (ignored)"
+	echo >&2 "WARNING: no name for \`$x_mod' in $CFMOD (ignored)"
 	continue
     fi
     case "$bin_mods" in
@@ -64,12 +65,16 @@
 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 "modfile=\$modfile_$q_bin_mod"
     unset moddeps
     . $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'"
Index: Src/mkmakemod.sh
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/mkmakemod.sh,v
retrieving revision 1.4
diff -u -r1.4 mkmakemod.sh
--- Src/mkmakemod.sh	2000/08/15 05:13:41	1.4
+++ Src/mkmakemod.sh	2000/11/26 19:46:46
@@ -90,6 +90,8 @@
 
 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 @@
     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
+
+    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}"
 
-    . Src/modules.index
-    bin_mods=" zsh/main "`sed 's/^/ /;s/$/ /' Src/modules-bltin`
     if grep '%@D@%D%' config.status >/dev/null; then
 	is_dynamic=true
     else
@@ -120,8 +126,8 @@
     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 @@
 	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 "* )
Index: Src/zsh.mdd
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/zsh.mdd,v
retrieving revision 1.3
diff -u -r1.3 zsh.mdd
--- Src/zsh.mdd	2000/09/19 15:54:31	1.3
+++ Src/zsh.mdd	2000/11/26 19:46:46
@@ -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 @@
 	    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
Index: Src/Builtins/rlimits.mdd
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Builtins/rlimits.mdd,v
retrieving revision 1.2
diff -u -r1.2 rlimits.mdd
--- Src/Builtins/rlimits.mdd	2000/07/07 17:12:17	1.2
+++ Src/Builtins/rlimits.mdd	2000/11/26 19:46:46
@@ -1,4 +1,6 @@
 name=zsh/rlimits
+link=either
+load=yes
 
 autobins="limit ulimit unlimit"
 
Index: Src/Builtins/sched.mdd
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Builtins/sched.mdd,v
retrieving revision 1.1.1.4
diff -u -r1.1.1.4 sched.mdd
--- Src/Builtins/sched.mdd	1999/12/16 14:26:36	1.1.1.4
+++ Src/Builtins/sched.mdd	2000/11/26 19:46:46
@@ -1,4 +1,6 @@
 name=zsh/sched
+link=either
+load=yes
 
 autobins="sched"
 
Index: Src/Modules/cap.mdd
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/cap.mdd,v
retrieving revision 1.1.1.4
diff -u -r1.1.1.4 cap.mdd
--- Src/Modules/cap.mdd	1999/12/16 14:26:36	1.1.1.4
+++ Src/Modules/cap.mdd	2000/11/26 19:46:46
@@ -1,4 +1,6 @@
 name=zsh/cap
+link=dynamic
+load=no
 
 autobins="cap getcap setcap"
 
Index: Src/Modules/clone.mdd
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/clone.mdd,v
retrieving revision 1.1.1.4
diff -u -r1.1.1.4 clone.mdd
--- Src/Modules/clone.mdd	1999/12/16 14:26:36	1.1.1.4
+++ Src/Modules/clone.mdd	2000/11/26 19:46:46
@@ -1,4 +1,6 @@
 name=zsh/clone
+link=dynamic
+load=no
 
 autobins="clone"
 
Index: Src/Modules/example.mdd
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/example.mdd,v
retrieving revision 1.1.1.7
diff -u -r1.1.1.7 example.mdd
--- Src/Modules/example.mdd	1999/12/16 14:26:36	1.1.1.7
+++ Src/Modules/example.mdd	2000/11/26 19:46:46
@@ -1,4 +1,6 @@
 name=zsh/example
+link=dynamic
+load=no
 
 autobins="example"
 
Index: Src/Modules/files.mdd
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/files.mdd,v
retrieving revision 1.1.1.5
diff -u -r1.1.1.5 files.mdd
--- Src/Modules/files.mdd	1999/12/16 14:26:36	1.1.1.5
+++ Src/Modules/files.mdd	2000/11/26 19:46:46
@@ -1,4 +1,6 @@
 name=zsh/files
+link=dynamic
+load=no
 
 autobins="chgrp chown ln mkdir mv rm rmdir sync"
 
Index: Src/Modules/mapfile.mdd
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/mapfile.mdd,v
retrieving revision 1.1.1.4
diff -u -r1.1.1.4 mapfile.mdd
--- Src/Modules/mapfile.mdd	1999/12/16 14:26:36	1.1.1.4
+++ Src/Modules/mapfile.mdd	2000/11/26 19:46:47
@@ -1,4 +1,6 @@
 name=zsh/mapfile
+link=dynamic
+load=no
 
 autoparams="mapfile"
 
Index: Src/Modules/mathfunc.mdd
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/mathfunc.mdd,v
retrieving revision 1.1.1.4
diff -u -r1.1.1.4 mathfunc.mdd
--- Src/Modules/mathfunc.mdd	1999/12/16 14:26:36	1.1.1.4
+++ Src/Modules/mathfunc.mdd	2000/11/26 19:46:47
@@ -1,4 +1,6 @@
 name=zsh/mathfunc
+link=dynamic
+load=no
 
 autobins="mathfunc"
 
Index: Src/Modules/parameter.mdd
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/parameter.mdd,v
retrieving revision 1.1.1.12
diff -u -r1.1.1.12 parameter.mdd
--- Src/Modules/parameter.mdd	1999/12/16 14:26:36	1.1.1.12
+++ Src/Modules/parameter.mdd	2000/11/26 19:46:47
@@ -1,4 +1,6 @@
 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"
 
Index: Src/Modules/stat.mdd
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/stat.mdd,v
retrieving revision 1.1.1.4
diff -u -r1.1.1.4 stat.mdd
--- Src/Modules/stat.mdd	1999/12/16 14:26:36	1.1.1.4
+++ Src/Modules/stat.mdd	2000/11/26 19:46:47
@@ -1,4 +1,6 @@
 name=zsh/stat
+link=dynamic
+load=no
 
 autobins="stat"
 
Index: Src/Modules/zftp.mdd
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/zftp.mdd,v
retrieving revision 1.1.1.4
diff -u -r1.1.1.4 zftp.mdd
--- Src/Modules/zftp.mdd	1999/12/16 14:26:37	1.1.1.4
+++ Src/Modules/zftp.mdd	2000/11/26 19:46:47
@@ -1,4 +1,6 @@
 name=zsh/zftp
+link=dynamic
+load=no
 
 autobins="zftp"
 
Index: Src/Modules/zprof.mdd
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/zprof.mdd,v
retrieving revision 1.1.1.4
diff -u -r1.1.1.4 zprof.mdd
--- Src/Modules/zprof.mdd	1999/12/16 14:26:37	1.1.1.4
+++ Src/Modules/zprof.mdd	2000/11/26 19:46:47
@@ -1,4 +1,6 @@
 name=zsh/zprof
+link=dynamic
+load=no
 
 autobins="zprof"
 
Index: Src/Modules/zpty.mdd
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/zpty.mdd,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 zpty.mdd
--- Src/Modules/zpty.mdd	2000/01/20 18:45:06	1.1.1.1
+++ Src/Modules/zpty.mdd	2000/11/26 19:46:47
@@ -1,4 +1,6 @@
 name=zsh/zpty
+link=dynamic
+load=no
 
 autobins="zpty"
 
Index: Src/Modules/zutil.mdd
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/zutil.mdd,v
retrieving revision 1.1.1.9
diff -u -r1.1.1.9 zutil.mdd
--- Src/Modules/zutil.mdd	2000/02/09 16:29:39	1.1.1.9
+++ Src/Modules/zutil.mdd	2000/11/26 19:46:47
@@ -1,4 +1,6 @@
 name=zsh/zutil
+link=either
+load=yes
 
 moddeps="zsh/complete"
 
Index: Src/Zle/compctl.mdd
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/compctl.mdd,v
retrieving revision 1.2
diff -u -r1.2 compctl.mdd
--- Src/Zle/compctl.mdd	2000/05/18 09:22:31	1.2
+++ Src/Zle/compctl.mdd	2000/11/26 19:46:47
@@ -1,4 +1,6 @@
 name=zsh/compctl
+link=either
+load=yes
 
 moddeps="zsh/complete zsh/zle"
 
Index: Src/Zle/complete.mdd
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/complete.mdd,v
retrieving revision 1.2
diff -u -r1.2 complete.mdd
--- Src/Zle/complete.mdd	2000/05/08 08:16:33	1.2
+++ Src/Zle/complete.mdd	2000/11/26 19:46:47
@@ -1,4 +1,6 @@
 name=zsh/complete
+link=either
+load=yes
 
 moddeps="zsh/zle"
 
Index: Src/Zle/complist.mdd
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/complist.mdd,v
retrieving revision 1.1.1.6
diff -u -r1.1.1.6 complist.mdd
--- Src/Zle/complist.mdd	1999/12/16 14:26:38	1.1.1.6
+++ Src/Zle/complist.mdd	2000/11/26 19:46:47
@@ -1,4 +1,6 @@
 name=zsh/complist
+link=either
+load=yes
 
 moddeps="zsh/complete zsh/zle"
 
Index: Src/Zle/computil.mdd
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/computil.mdd,v
retrieving revision 1.2
diff -u -r1.2 computil.mdd
--- Src/Zle/computil.mdd	2000/06/22 09:42:10	1.2
+++ Src/Zle/computil.mdd	2000/11/26 19:46:47
@@ -1,4 +1,6 @@
 name=zsh/computil
+link=either
+load=yes
 
 moddeps="zsh/complete zsh/zle"
 
Index: Src/Zle/deltochar.mdd
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/deltochar.mdd,v
retrieving revision 1.1.1.4
diff -u -r1.1.1.4 deltochar.mdd
--- Src/Zle/deltochar.mdd	1999/12/16 14:26:38	1.1.1.4
+++ Src/Zle/deltochar.mdd	2000/11/26 19:46:47
@@ -1,4 +1,6 @@
 name=zsh/deltochar
+link=dynamic
+load=no
 
 moddeps="zsh/zle"
 
Index: Src/Zle/zle.mdd
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle.mdd,v
retrieving revision 1.1.1.9
diff -u -r1.1.1.9 zle.mdd
--- Src/Zle/zle.mdd	1999/12/16 14:26:38	1.1.1.9
+++ Src/Zle/zle.mdd	2000/11/26 19:46:47
@@ -1,4 +1,6 @@
 name=zsh/zle
+link=either
+load=yes
 
 autobins="bindkey vared zle"
 
Index: Src/Zle/zleparameter.mdd
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zleparameter.mdd,v
retrieving revision 1.1.1.5
diff -u -r1.1.1.5 zleparameter.mdd
--- Src/Zle/zleparameter.mdd	1999/12/16 14:26:38	1.1.1.5
+++ Src/Zle/zleparameter.mdd	2000/11/26 19:46:47
@@ -1,4 +1,6 @@
 name=zsh/zleparameter
+link=either
+load=yes
 
 moddeps="zsh/zle"
 
-- 
Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
Work: pws@csr.com
Web: http://www.pwstephenson.fsnet.co.uk


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

* RE: PATCH: Module configuration changes
  2000-11-26 19:55 PATCH: Module configuration changes Peter Stephenson
@ 2000-11-27  9:02 ` Andrej Borsenkow
  2000-11-27 10:18   ` Peter Stephenson
  2000-11-27 11:20 ` Peter Stephenson
  1 sibling, 1 reply; 4+ messages in thread
From: Andrej Borsenkow @ 2000-11-27  9:02 UTC (permalink / raw)
  To: Zsh hackers list


> +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.


there seems to be one more value "either" that links dynamically if possible
else statically. Is it user visible? In this case better name is needed.
"auto"? Also, "dynamic" won't link a module
if compiled statically. That needs a word in documentation.


-andrej


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

* Re: PATCH: Module configuration changes
  2000-11-27  9:02 ` Andrej Borsenkow
@ 2000-11-27 10:18   ` Peter Stephenson
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Stephenson @ 2000-11-27 10:18 UTC (permalink / raw)
  To: Zsh hackers list

> there seems to be one more value "either" that links dynamically if possible
> else statically. Is it user visible? In this case better name is needed.

No, it doesn't work in config.modules, it just allows configure to choose.
It means it should be linked by whichever way we have.

> "auto"? Also, "dynamic" won't link a module
> if compiled statically. That needs a word in documentation.

But the dynamic and static object files have different names, probably
because of this, so running `make prep', as it says in INSTALL, then `make'
should recompile properly, shouldn't it?  If not, what goes wrong?

Index: Etc/zsh-development-guide
===================================================================
RCS file: /cvsroot/zsh/zsh/Etc/zsh-development-guide,v
retrieving revision 1.4
diff -u -r1.4 zsh-development-guide
--- Etc/zsh-development-guide	2000/11/26 20:01:03	1.4
+++ Etc/zsh-development-guide	2000/11/27 10:16:45
@@ -182,6 +182,9 @@
 
   - name            name of the module
   - link            `static', `dynamic' or `no', as described in INSTALL.
+		    In addition, the value `either' is allowed in the .mdd
+		    file, which will be converted by configure to `dynamic'
+		    if that is available, else `static'.
 		    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

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
Cambridge Silicon Radio, Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070


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

* Re: PATCH: Module configuration changes
  2000-11-26 19:55 PATCH: Module configuration changes Peter Stephenson
  2000-11-27  9:02 ` Andrej Borsenkow
@ 2000-11-27 11:20 ` Peter Stephenson
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Stephenson @ 2000-11-27 11:20 UTC (permalink / raw)
  To: Zsh hackers list

> Here is the first stage in an improvement in the way modules are
> configured.

Tweaks based on configuring here on Solaris (dynamic) and cygwin (static)
with separate source and build directories, some auto=no modules, and one
cygwin-only module.  Otherwise things look OK.

Index: configure.in
===================================================================
RCS file: /cvsroot/zsh/zsh/configure.in,v
retrieving revision 1.33
diff -u -r1.33 configure.in
--- configure.in	2000/11/26 20:01:01	1.33
+++ configure.in	2000/11/27 11:17:18
@@ -1710,13 +1710,15 @@
 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}`
+  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 "# Edit this file to change the way modules are loaded."
 echo "# The format is strict; do not break lines or add extra spaces."
+echo "# Run \`make prep' if you change anything here after compiling"
+echo "# (there is no need if you change this just after the first time"
+echo "# you run \`configure')."
 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."
@@ -1736,17 +1738,17 @@
 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
+for modfile in `cd ${srcdir}; echo */*.mdd */*/*.mdd`; do
   name=
   link=
   load=
-  . $modfile
-  if test x$name != x -a x$link != x; then
-    case $userlist in
+  . ${srcdir}/$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
+    *) case "$link" in
 	  *\ *) eval 'link=`'$link'`'
 	       ;;
        esac
@@ -1756,7 +1758,7 @@
 	 *) load=" load=no"
 	    ;;
        esac
-       case $link in
+       case "$link" in
 	 static) echo "name=$name modfile=$modfile link=static auto=yes${load}"
 	         ;;
 	 dynamic) if test $dynamic != no; then
@@ -1764,7 +1766,7 @@
  auto=yes${load}"
 		  else
 		    echo "name=$name modfile=$modfile link=no\
- auto=no load=no"
+ auto=yes load=no"
 		  fi
 		  ;;
 	 either) if test $dynamic != no; then

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
Cambridge Silicon Radio, Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070


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

end of thread, other threads:[~2000-11-27 11:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-11-26 19:55 PATCH: Module configuration changes Peter Stephenson
2000-11-27  9:02 ` Andrej Borsenkow
2000-11-27 10:18   ` Peter Stephenson
2000-11-27 11:20 ` Peter Stephenson

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).