changeset 112302:c428fb33aede

Automate syncing from gnulib.
author Paul Eggert <eggert@cs.ucla.edu>
date Sat, 08 Jan 2011 13:02:38 -0800
parents afa244de82cd
children 16ae11ee4ab8
files ChangeLog INSTALL Makefile.in README configure.in lib-src/ChangeLog lib-src/Makefile.in lib/Makefile.am make-dist src/ChangeLog src/Makefile.in
diffstat 11 files changed, 152 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Jan 08 14:19:55 2011 -0500
+++ b/ChangeLog	Sat Jan 08 13:02:38 2011 -0800
@@ -1,3 +1,32 @@
+2011-01-08  Paul Eggert  <eggert@cs.ucla.edu>
+
+	Automate syncing from gnulib.
+	* INSTALL, README: Document new subdirectory 'lib'.
+	* Makefile.in (SUBDIR): Add lib.
+	(SUBDIR_MAKEFILES): Add lib/Makefile.
+	(lib-src, src, TAGS, tags): Depend on lib.
+	(gnulib_srcdir, GNULIB_MODULES, GNULIB_TOOL_FLAGS): New macros.
+	($(gnulib_srcdir)): New rule.
+	(sync-from-gnulib): New rule, which is .PHONY.
+	(lib): New rule, which is like lib-src.
+	(Makefile): Depend on lib/Makefile.in.
+	(AUTOCONF_INPUTS): Depend on aclocal.m4.
+	(ACLOCAL_INPUTS, AUTOMAKE_INPUTS): New macros.
+	($(srcdir)/aclocal.m4, $(srcdir)/lib/Makefile.in): New rules.
+	(am--refresh): New rule, to pacify Automake.
+	(mostlyclean, clean, distclean, bootstrap-clean, maintainer-clean):
+	Clean lib, too.
+	(top_maintainer_clean): New macro, to remove gnulib-tool and Automake
+	droppings.
+	(maintainer-clean, extraclean): Use it.
+	* configure.in: Initialize for automake and gnulib, by invoking
+	AM_INIT_AUTOMAKE, AM_PROG_CC_C_O, gl_EARLY, and gl_INIT.  Output
+	lib/Makefile, too.  Use automake to build gnulib, as gnulib works
+	more conveniently with automake.
+	* lib/Makefile.am: New file.
+	* make-dist: Also put into the distribution aclocal.m4,
+	compile, depcomp, missing, and the files under lib/.
+
 2011-01-07  Paul Eggert  <eggert@cs.ucla.edu>
 
 	* install-sh, mkinstalldirs, move-if-change: Update from master
--- a/INSTALL	Sat Jan 08 14:19:55 2011 -0500
+++ b/INSTALL	Sat Jan 08 13:02:38 2011 -0800
@@ -675,12 +675,15 @@
 `./src/epaths.h' from the template file `./src/epaths.in', changing
 the paths to the values specified in `./Makefile'.
 
-2) Go to directory `./lib-src' and run `make'.  This creates
+2) Go to directory `./lib' and run `make'.  This creates include files
+and libraries used in later steps.
+
+3) Go to directory `./lib-src' and run `make'.  This creates
 executables named `etags', `make-docfile', and others.
 
-3) Go to directory `./src' and run `make'.  This refers to files in
-the `./lisp' and `./lib-src' subdirectories using names `../lisp' and
-`../lib-src'.
+4) Go to directory `./src' and run `make'.  This refers to files in
+the `./lisp', `./lib', and `./lib-src' subdirectories using names
+`../lisp', `../lib', and `../lib-src'.
 
 This creates a file `./src/emacs' which is the runnable Emacs,
 which has another name that contains a version number.
--- a/Makefile.in	Sat Jan 08 14:19:55 2011 -0500
+++ b/Makefile.in	Sat Jan 08 13:02:38 2011 -0800
@@ -264,10 +264,10 @@
 # Actually, we now include `lisp' as well, since the compiled files
 # are not included any more in case of bootstrap or in case Emacs was
 # checked out from a VCS.
-SUBDIR = lib-src src lisp
+SUBDIR = lib lib-src src lisp
 
 # The subdir makefiles created by config.status.
-SUBDIR_MAKEFILES = lib-src/Makefile doc/emacs/Makefile doc/misc/Makefile doc/lispref/Makefile doc/lispintro/Makefile src/Makefile oldXMenu/Makefile lwlib/Makefile leim/Makefile lisp/Makefile
+SUBDIR_MAKEFILES = lib/Makefile lib-src/Makefile doc/emacs/Makefile doc/misc/Makefile doc/lispref/Makefile doc/lispintro/Makefile src/Makefile oldXMenu/Makefile lwlib/Makefile leim/Makefile lisp/Makefile
 
 # Subdirectories to install, and where they'll go.
 # lib-src's makefile knows how to install it, so we don't do that here.
@@ -313,6 +313,8 @@
 	  CC='${CC}' CFLAGS='${CFLAGS}' CPPFLAGS='${CPPFLAGS}' \
 	  LDFLAGS='${LDFLAGS}' MAKE='${MAKE}')
 
+lib-src src: lib
+
 src:	lib-src FRC
 
 .RECURSIVE: ${SUBDIR} leim
@@ -320,8 +322,32 @@
 # We need to build `emacs' in `src' to compile the *.elc files in `lisp'.
 lisp: src
 
+# Maintainers can put a copy of gnulib into $(gnulib_srcdir).
+gnulib_srcdir = ../gnulib
+$(gnulib_srcdir):
+	git clone git://git.savannah.gnu.org/gnulib.git $@
+
+# Update modules from gnulib, for maintainers, who should have it in
+# $(gnulib_srcdir) (relative to $(srcdir) and should have build tools
+# as per $(gnulib_srcdir)/DEPENDENCIES.
+GNULIB_MODULES = dummy # Just a dummy for now, to establish the mechanism.
+GNULIB_TOOL_FLAGS = \
+ --import --no-changelog --no-vc-files --makefile-name=gnulib.mk
+sync-from-gnulib: $(gnulib_srcdir)
+	cd $(srcdir) && \
+	  $(gnulib_srcdir)/gnulib-tool $(GNULIB_TOOL_FLAGS) $(GNULIB_MODULES)
+	cp $(gnulib_srcdir)/build-aux/texinfo.tex $(srcdir)/doc/misc
+	cp \
+	  $(gnulib_srcdir)/build-aux/config.sub \
+	  $(gnulib_srcdir)/build-aux/config.guess \
+	  $(gnulib_srcdir)/build-aux/install-sh \
+	  $(gnulib_srcdir)/build-aux/mkinstalldirs \
+	  $(gnulib_srcdir)/build-aux/move-if-change \
+	  $(srcdir)
+.PHONY: sync-from-gnulib
+
 # These targets should be "${SUBDIR} without `src'".
-lib-src lisp: Makefile FRC
+lib lib-src lisp: Makefile FRC
 	cd $@; $(MAKE) all $(MFLAGS)                           \
 	  CC='${CC}' CFLAGS='${CFLAGS}' CPPFLAGS='${CPPFLAGS}' \
 	  LDFLAGS='${LDFLAGS}' MAKE='${MAKE}'
@@ -360,6 +386,7 @@
 Makefile: config.status $(srcdir)/src/config.in \
           $(srcdir)/Makefile.in \
           $(srcdir)/src/Makefile.in \
+          $(srcdir)/lib/Makefile.in \
           $(srcdir)/lib-src/Makefile.in \
           $(srcdir)/doc/emacs/Makefile.in \
           $(srcdir)/doc/misc/Makefile.in \
@@ -374,11 +401,20 @@
 config.status: ${srcdir}/configure ${srcdir}/lisp/version.el
 	./config.status --recheck
 
-AUTOCONF_INPUTS = @MAINT@ $(srcdir)/configure.in $(srcdir)/m4/getopt.m4
+AUTOCONF_INPUTS = @MAINT@ $(srcdir)/configure.in $(srcdir)/m4/getopt.m4 $(srcdir)/aclocal.m4
 
 $(srcdir)/configure: $(AUTOCONF_INPUTS)
 	cd ${srcdir} && autoconf
 
+ACLOCAL_INPUTS = @MAINT@ $(srcdir)/m4/gnulib-comp.m4 
+$(srcdir)/aclocal.m4: $(ACLOCAL_INPUTS)
+	cd $(srcdir) && aclocal -I m4
+
+AUTOMAKE_INPUTS = @MAINT@ $(srcdir)/aclocal.m4 $(srcdir)/lib/Makefile.am
+$(srcdir)/lib/Makefile.in: $(AUTOMAKE_INPUTS)
+	cd $(srcdir) && automake --gnu -a -c lib/Makefile
+am--refresh:
+
 $(srcdir)/src/config.in: $(srcdir)/src/stamp-h.in
 	@ # Usually, there's no need to rebuild src/config.in just
 	@ # because stamp-h.in has changed (since building stamp-h.in
@@ -710,6 +746,7 @@
 	(cd src;      $(MAKE) $(MFLAGS) mostlyclean)
 	(cd oldXMenu; $(MAKE) $(MFLAGS) mostlyclean)
 	(cd lwlib;    $(MAKE) $(MFLAGS) mostlyclean)
+	(cd lib;      $(MAKE) $(MFLAGS) mostlyclean)
 	(cd lib-src;  $(MAKE) $(MFLAGS) mostlyclean)
 	-(cd doc/emacs &&   $(MAKE) $(MFLAGS) mostlyclean)
 	-(cd doc/misc &&   $(MAKE) $(MFLAGS) mostlyclean)
@@ -729,6 +766,7 @@
 	(cd src;      $(MAKE) $(MFLAGS) clean)
 	(cd oldXMenu; $(MAKE) $(MFLAGS) clean)
 	(cd lwlib;    $(MAKE) $(MFLAGS) clean)
+	(cd lib;      $(MAKE) $(MFLAGS) clean)
 	(cd lib-src;  $(MAKE) $(MFLAGS) clean)
 	-(cd doc/emacs &&   $(MAKE) $(MFLAGS) clean)
 	-(cd doc/misc &&   $(MAKE) $(MFLAGS) clean)
@@ -753,6 +791,7 @@
 	(cd src;      $(MAKE) $(MFLAGS) distclean)
 	(cd oldXMenu; $(MAKE) $(MFLAGS) distclean)
 	(cd lwlib;    $(MAKE) $(MFLAGS) distclean)
+	(cd lib;      $(MAKE) $(MFLAGS) distclean)
 	(cd lib-src;  $(MAKE) $(MFLAGS) distclean)
 	(cd doc/emacs &&    $(MAKE) $(MFLAGS) distclean)
 	(cd doc/misc &&    $(MAKE) $(MFLAGS) distclean)
@@ -769,6 +808,7 @@
 	(cd src;      $(MAKE) $(MFLAGS) bootstrap-clean)
 	(cd oldXMenu; $(MAKE) $(MFLAGS) maintainer-clean)
 	(cd lwlib;    $(MAKE) $(MFLAGS) maintainer-clean)
+	(cd lib;      $(MAKE) $(MFLAGS) maintainer-clean)
 	(cd lib-src;  $(MAKE) $(MFLAGS) maintainer-clean)
 	-(cd doc/emacs &&   $(MAKE) $(MFLAGS) maintainer-clean)
 	-(cd doc/misc &&   $(MAKE) $(MFLAGS) maintainer-clean)
@@ -789,10 +829,15 @@
 ###      Makefile.  More generally, `make maintainer-clean' should not delete
 ###      anything that needs to exist in order to run `configure' and then
 ###      begin to build the program.
+top_maintainer_clean=\
+	${top_distclean}; \
+	rm -fr autom4te.cache; \
+	rm -f aclocal.m4 lib/gnulib.mk m4/gnulib-cache.m4
 maintainer-clean: bootstrap-clean FRC
 	(cd src;      $(MAKE) $(MFLAGS) maintainer-clean)
+	(cd lib;      $(MAKE) $(MFLAGS) maintainer-clean)
 	(cd lisp;     $(MAKE) $(MFLAGS) maintainer-clean)
-	${top_distclean}
+	${top_maintainer_clean}
 
 ### This doesn't actually appear in the coding standards, but Karl
 ### says GCC supports it, and that's where the configuration part of
@@ -800,13 +845,13 @@
 ### it deletes backup and autosave files too.
 extraclean:
 	for i in ${SUBDIR} leim; do (cd $$i; $(MAKE) $(MFLAGS) extraclean); done
-	${top_distclean}
+	${top_maintainer_clean}
 	-rm -f config-tmp-*
 	-rm -f *~ \#*
 
 # The src subdir knows how to do the right thing
 # even when the build directory and source dir are different.
-TAGS tags: lib-src src
+TAGS tags: lib lib-src src
 	cd src; $(MAKE) tags
 
 check:
--- a/README	Sat Jan 08 14:19:55 2011 -0500
+++ b/README	Sat Jan 08 13:02:38 2011 -0800
@@ -63,6 +63,7 @@
 `leim'      holds the library of Emacs input methods, Lisp code and
             auxiliary data files required to type international characters
             which can't be directly produced by your keyboard.
+`lib'       holds source code for libraries used by Emacs and its utilities
 `lib-src'   holds the source code for some utility programs for use by or
             with Emacs, like movemail and etags.
 `etc'       holds miscellaneous architecture-independent data files Emacs
--- a/configure.in	Sat Jan 08 14:19:55 2011 -0500
+++ b/configure.in	Sat Jan 08 13:02:38 2011 -0800
@@ -27,6 +27,7 @@
 AC_INIT(emacs, 24.0.50)
 AC_CONFIG_HEADER(src/config.h:src/config.in)
 AC_CONFIG_SRCDIR(src/lisp.h)
+AM_INIT_AUTOMAKE
 
 dnl Support for --program-prefix, --program-suffix and
 dnl --program-transform-name options
@@ -638,6 +639,10 @@
 
 dnl Sets GCC=yes if using gcc.
 AC_PROG_CC
+AM_PROG_CC_C_O
+
+# Initialize gnulib right after verifying that the C compiler works.
+gl_EARLY
 
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
@@ -2668,6 +2673,9 @@
 
 AC_FUNC_GETPGRP
 
+# Configure gnulib.
+gl_INIT
+
 AC_FUNC_STRFTIME
 
 # UNIX98 PTYs.
@@ -3747,7 +3755,7 @@
 dnl to run `make prefix=/some/where/else' and override the values set
 dnl by configure.  This also explains the `move-if-change' test and
 dnl the use of force in the `epaths-force' rule in Makefile.in.
-AC_OUTPUT(Makefile lib-src/Makefile oldXMenu/Makefile \
+AC_OUTPUT(Makefile lib/Makefile lib-src/Makefile oldXMenu/Makefile \
 	doc/emacs/Makefile doc/misc/Makefile doc/lispintro/Makefile \
 	doc/lispref/Makefile src/Makefile \
 	lwlib/Makefile lisp/Makefile leim/Makefile, [
--- a/lib-src/ChangeLog	Sat Jan 08 14:19:55 2011 -0500
+++ b/lib-src/ChangeLog	Sat Jan 08 13:02:38 2011 -0800
@@ -1,3 +1,13 @@
+2011-01-08  Paul Eggert  <eggert@cs.ucla.edu>
+
+	Automate syncing from gnulib.
+	* Makefile.in (EXE_FILES): New macro.
+	(BASE_CFLAGS): Add -I../lib and -I${srcdir}/../lib,
+	for gnulib's .h files.
+	(LOADLIBES): Add ../lib/libgnu.a.
+	($(EXE_FILES)): Depend on ../lib/libgnu.a.
+	(../lib/libgnu.a): New rule.
+
 2011-01-08  Paul Eggert  <eggert@cs.ucla.edu>
 
 	* Makefile.in (EXECUTABLES): Remove; macro unused since 1993.
--- a/lib-src/Makefile.in	Sat Jan 08 14:19:55 2011 -0500
+++ b/lib-src/Makefile.in	Sat Jan 08 13:02:38 2011 -0800
@@ -128,6 +128,9 @@
 SCRIPTS= rcs2log vcdiff
 STAMP_SCRIPTS= stamp-rcs2log stamp-vcdiff
 
+# All files that are created by the linker, i.e., whose names end in ${EXEEXT}.
+EXE_FILES = ${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL}
+
 # Specify additional -D flags for movemail. Options:
 # -DMAIL_USE_FLOCK or -DMAIL_USE_LOCKF (use flock or lockf for file locking).
 # See the comments about locking in movemail.c.  Normally the values
@@ -166,13 +169,15 @@
 # defined before they know they can take advantage of the information
 # in ../src/config.h.
 BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) ${C_WARNINGS_SWITCH} \
-	      -DHAVE_CONFIG_H -I. -I../src -I${srcdir} -I${srcdir}/../src
+	      -DHAVE_CONFIG_H -I. -I../src -I../lib \
+	      -I${srcdir} -I${srcdir}/../src -I${srcdir}/../lib
 
 ALL_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
 LINK_CFLAGS = ${BASE_CFLAGS} ${LDFLAGS} ${CFLAGS}
 CPP_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS}
 
-LOADLIBES=$(LIBS_SYSTEM)
+LOADLIBES = ../lib/libgnu.a $(LIBS_SYSTEM)
+$(EXE_FILES): ../lib/libgnu.a
 
 ## This is the default compilation command.
 ## But we should never rely on it, because some make version failed to
@@ -320,6 +325,9 @@
 getopt1.o: ${srcdir}/getopt1.c $(GETOPT_H)
 	${CC} -c ${CPP_CFLAGS} ${srcdir}/getopt1.c
 
+../lib/libgnu.a: ../src/config.h
+	cd ../lib && $(MAKE) libgnu.a
+
 REGEXPOBJ = regex.o
 REGEXPDEPS = $(REGEXPOBJ) $(srcdir)/../src/regex.h
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/Makefile.am	Sat Jan 08 13:02:38 2011 -0800
@@ -0,0 +1,8 @@
+BUILT_SOURCES =
+EXTRA_DIST =
+MOSTLYCLEANFILES =
+noinst_LIBRARIES =
+
+DEFAULT_INCLUDES = -I. -I../src -I$(top_srcdir)/src
+
+include gnulib.mk
--- a/make-dist	Sat Jan 08 14:19:55 2011 -0500
+++ b/make-dist	Sat Jan 08 13:02:38 2011 -0800
@@ -286,12 +286,14 @@
 ln ChangeLog Makefile.in configure configure.in ${tempdir}
 ln config.bat make-dist update-subdirs vpath.sed .dir-locals.el ${tempdir}
 ln mkinstalldirs config.sub config.guess install-sh ${tempdir}
+ln aclocal.m4 ${tempdir}
+ln compile depcomp missing ${tempdir}
 
 echo "Creating subdirectories"
 for subdir in site-lisp \
 	      leim leim/CXTERM-DIC leim/MISC-DIC \
 	      leim/SKK-DIC leim/ja-dic leim/quail \
-	      src src/m src/s src/bitmaps lib-src oldXMenu lwlib \
+	      src src/m src/s src/bitmaps lib lib-src oldXMenu lwlib \
 	      nt nt/inc nt/inc/sys nt/inc/arpa nt/inc/netinet nt/icons \
 	      `find etc lisp -type d` \
 	      doc doc/emacs doc/misc doc/man doc/lispref doc/lispintro \
@@ -368,6 +370,14 @@
 (cd src/s
  ln README [a-zA-Z0-9]*.h ../../${tempdir}/src/s)
 
+echo "Making links to \`lib'"
+(build_aux_h=`(ls *.h)`
+ cd lib
+ ln [a-zA-Z]*.[ch] ../${tempdir}/lib
+ ln gnulib.mk Makefile.am Makefile.in ../${tempdir}/lib
+ cd ../${tempdir}/lib
+ rm -f `(echo "$build_aux_h"; ls *.in.h) | sed '/[*]/d; s/.in.h$/.h/'`)
+
 echo "Making links to \`lib-src'"
 (cd lib-src
  ln [a-zA-Z]*.[ch] ../${tempdir}/lib-src
@@ -477,7 +487,7 @@
 ### It would be nice if they could all be symlinks to top-level copy, but
 ### you're not supposed to have any symlinks in distribution tar files.
 echo "Making sure copying notices are all copies of \`COPYING'"
-for subdir in . etc info leim lib-src lisp lwlib msdos nt src; do
+for subdir in . etc info leim lib lib-src lisp lwlib msdos nt src; do
   rm -f ${tempdir}/${subdir}/COPYING
   cp COPYING ${tempdir}/${subdir}
 done
--- a/src/ChangeLog	Sat Jan 08 14:19:55 2011 -0500
+++ b/src/ChangeLog	Sat Jan 08 13:02:38 2011 -0800
@@ -1,3 +1,11 @@
+2011-01-08  Paul Eggert  <eggert@cs.ucla.edu>
+
+	Automate syncing from gnulib.
+	* Makefile.in (lib): New macro.
+	(ALL_CFLAGS): Add -I$(lib) -I$(srcdir)/../lib.
+	($(lib)/libgnu.a): New rule.
+	(temacs$(EXEEXT)): Also link $(lib)/libgnu.a.
+
 2011-01-08  Andreas Schwab  <schwab@linux-m68k.org>
 
 	* fns.c (Fyes_or_no_p): Add usage.
@@ -29483,4 +29491,3 @@
 
   You should have received a copy of the GNU General Public License
   along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
-
--- a/src/Makefile.in	Sat Jan 08 14:19:55 2011 -0500
+++ b/src/Makefile.in	Sat Jan 08 13:02:38 2011 -0800
@@ -47,6 +47,7 @@
 LIBOBJS = @LIBOBJS@
 
 lispsource = $(srcdir)/../lisp
+lib = ../lib
 libsrc = ../lib-src
 etc = ../etc
 oldXMenudir = ../oldXMenu
@@ -320,6 +321,7 @@
 ##
 ## FIXME? MYCPPFLAGS only referenced in etc/DEBUG.
 ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I$(srcdir) \
+  -I$(lib) -I$(srcdir)/../lib \
   $(C_SWITCH_MACHINE) $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) \
   $(C_SWITCH_X_SYSTEM) $(CFLAGS_SOUND) $(RSVG_CFLAGS) $(IMAGEMAGICK_CFLAGS) \
   $(LIBXML2_CFLAGS) $(DBUS_CFLAGS) \
@@ -644,10 +646,12 @@
 buildobj.h: Makefile
 	echo "#define BUILDOBJ \"$(obj) $(otherobj) " "\"" > buildobj.h
 
+$(lib)/libgnu.a: $(config_h)
+	cd $(lib) && $(MAKE) libgnu.a
 
-temacs$(EXEEXT): $(START_FILES) stamp-oldxmenu $(obj) $(otherobj)
+temacs$(EXEEXT): $(START_FILES) stamp-oldxmenu $(obj) $(otherobj) $(lib)/libgnu.a
 	$(CC) $(LD_FIRSTFLAG) $(ALL_CFLAGS) $(TEMACS_LDFLAGS) $(TEMACS_LDFLAGS2) \
-	  -o temacs $(START_FILES) $(obj) $(otherobj) $(LIBES)
+	  -o temacs $(START_FILES) $(obj) $(otherobj) $(lib)/libgnu.a $(LIBES)
 
 ## The following oldxmenu-related rules are only (possibly) used if
 ## HAVE_X11 && !USE_GTK, but there is no harm in always defining them