Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: zsh/pcre module building



Here's a different method to avoid linking the zsh binary against
libpcre.

The impetus for doing so is that currently, one cannot use zsh as
/bin/sh (or whatever else executes startup scripts) on a system
where it is dynamically linked against libraries on partitions that
are not yet mounted.

I was thinking that for those systems which require all the libraries to
be linked into the main binary, the same .rules files could be included.

Index: zshconfig.ac
===================================================================
RCS file: /cvsroot/zsh/zsh/zshconfig.ac,v
retrieving revision 1.25
diff -u -r1.25 zshconfig.ac
--- zshconfig.ac	19 Feb 2002 02:14:08 -0000	1.25
+++ zshconfig.ac	15 Mar 2002 17:43:55 -0000
@@ -487,7 +487,7 @@
 		 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)
+		 netinet/in_systm.h langinfo.h)
 if test $dynamic = yes; then
   AC_CHECK_HEADERS(dlfcn.h)
   AC_CHECK_HEADERS(dl.h)
@@ -655,9 +655,6 @@
 
 AC_CHECK_LIB(socket, socket)
 
-dnl pcre-config should probably be employed here
-AC_SEARCH_LIBS(pcre_compile, pcre)
-
 dnl ---------------------
 dnl CHECK TERMCAP LIBRARY
 dnl ---------------------
@@ -949,7 +946,6 @@
 	       brk sbrk \
 	       pathconf sysconf \
 	       tgetent tigetflag tigetnum tigetstr setupterm \
-	       pcre_compile pcre_study pcre_exec \
 	       nl_langinfo \
 	       erand48)
 AC_FUNC_STRCOLL
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	15 Mar 2002 17:43:58 -0000
@@ -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:
Index: Src/mkmakemod.sh
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/mkmakemod.sh,v
retrieving revision 1.12
diff -u -r1.12 mkmakemod.sh
--- Src/mkmakemod.sh	6 Jun 2001 08:37:22 -0000	1.12
+++ Src/mkmakemod.sh	15 Mar 2002 17:44:00 -0000
@@ -192,7 +192,7 @@
 
 	unset name moddeps nozshdep alwayslink hasexport
 	unset autobins autoinfixconds autoprefixconds autoparams automathfuncs
-	unset objects proto headers hdrdeps otherincs
+	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=
@@ -314,6 +314,19 @@
 	echo "modobjs.${mddname}: \$(MODOBJS_${mddname})"
 	echo "	echo '' \$(MODOBJS_${mddname}) $modobjs_sed>> \$(dir_src)/stamp-modobjs.tmp"
 	echo
+	if test -n "$autoconf"; then
+	    echo "include ${mddname}.rules"
+	    echo
+	    echo "${mddname}.ach ${mddname}.rules: ${mddname}.configure"
+	    echo "	./${mddname}.configure"
+	    echo
+	    echo "${mddname}.configure: ${mddname}.configure.in ${mddname}.ach.in"
+	    echo "	autoheader ${mddname}.configure.in >pcre.ach.in"
+	    echo "	autoconf ${mddname}.configure.in >pcre.configure"
+	    echo "	chmod +x pcre.configure"
+	    achfile="${mddname}.ach"
+	fi
+
 	if test -z "$alwayslink"; then
 	    case " $all_modules" in *" ${mddname}."*)
 		echo "install.modules-here: install.modules.${mddname}"
@@ -330,7 +343,7 @@
 	    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 "	\$(DLLINK) \$(@E@XPIMP_$mddname) \$(@E@NTRYOPT) \$(MODDOBJS_${mddname}) \$(@LINKMODS@_${mddname}) \$(LIBS) \$(EXTRALIBS_${mddname})"
 	    echo
 	fi
 	echo "${mddname}.mdhi: ${mddname}.mdhs \$(INCS_${mddname})"
@@ -416,7 +429,7 @@
 	echo "	    echo '#endif /* !have_${q_name}_module */'; \\"
 	echo "	) > \$@"
 	echo
-	echo "\$(MODOBJS_${mddname}) \$(MODDOBJS_${mddname}): ${mddname}.mdh"
+	echo "\$(MODOBJS_${mddname}) \$(MODDOBJS_${mddname}): ${mddname}.mdh $achfile"
 	sed -e '/^ *: *<< *\\Make *$/,/^Make$/!d' \
 	    -e 's/^ *: *<< *\\Make *$//; /^Make$/d' \
 	    < $top_srcdir/$the_subdir/${mddname}.mdd
Index: Src/Modules/.cvsignore
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/.cvsignore,v
retrieving revision 1.1.1.4
diff -u -r1.1.1.4 .cvsignore
--- Src/Modules/.cvsignore	1 Dec 1999 18:36:06 -0000	1.1.1.4
+++ Src/Modules/.cvsignore	15 Mar 2002 17:44:00 -0000
@@ -12,3 +12,4 @@
 *.mdhi
 *.mdhs
 *.mdh.tmp
+*.rules
Index: Src/Modules/pcre.ach.in
===================================================================
RCS file: Src/Modules/pcre.ach.in
diff -N Src/Modules/pcre.ach.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Src/Modules/pcre.ach.in	15 Mar 2002 17:44:00 -0000
@@ -0,0 +1,13 @@
+/* pcre.ach.in.  Generated automatically from pcre.configure.in by autoheader 2.13.  */
+
+/* Define if you have the pcre_compile function.  */
+#undef HAVE_PCRE_COMPILE
+
+/* Define if you have the pcre_exec function.  */
+#undef HAVE_PCRE_EXEC
+
+/* Define if you have the pcre_study function.  */
+#undef HAVE_PCRE_STUDY
+
+/* Define if you have the <pcre.h> header file.  */
+#undef HAVE_PCRE_H
Index: Src/Modules/pcre.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/pcre.c,v
retrieving revision 1.4
diff -u -r1.4 pcre.c
--- Src/Modules/pcre.c	6 Jul 2001 18:04:39 -0000	1.4
+++ Src/Modules/pcre.c	15 Mar 2002 17:44:00 -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.in
===================================================================
RCS file: Src/Modules/pcre.configure.in
diff -N Src/Modules/pcre.configure.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Src/Modules/pcre.configure.in	15 Mar 2002 17:44:00 -0000
@@ -0,0 +1,38 @@
+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 Peter Stephenson
+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 Peter Stephenson 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 Richard Coleman and the Zsh Development Group have been advised of
+dnl  the possibility of such damage.
+dnl
+dnl  Peter Stephenson 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 Peter Stephenson and the
+dnl  Zsh Development Group have no obligation to provide maintenance,
+dnl  support, updates, enhancements, or modifications.
+dnl
+
+AC_INIT(pcre.c)
+AC_PREREQ(2.13)
+
+AC_CONFIG_HEADER(pcre.ach)
+
+AC_CHECK_HEADERS(pcre.h)
+
+dnl pcre-config should probably be employed here
+AC_SEARCH_LIBS(pcre_compile, pcre)
+AC_CHECK_FUNCS(pcre_compile pcre_study pcre_exec)
+
+AC_OUTPUT(pcre.rules)
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	15 Mar 2002 17:44:00 -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	15 Mar 2002 17:44:00 -0000
@@ -0,0 +1 @@
+EXTRALIBS_pcre = @LIBS@



Messages sorted by: Reverse Date, Date, Thread, Author