From d59053569fb37f80487810f6e18da0ac9030a0da Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 4 Jan 2017 19:13:14 -0800 Subject: [PATCH] Use GNU Make instead of sed+Automake for nt lib Problem reported by Angelo Graziosi. Instead of continuing to hack something in autogen.sh, which is a pain to port and which is a prepass to Automake, this patch uses GNU Make instead, so that there is no need to have anything in autogen.sh and no need for an nt/gnulib.mk file. * .gitignore: Remove nt/gnulib.mk. * Makefile.in (gnulib_mk, $(srcdir)/nt/gnulib.mk): Remove. (AUTOMAKE_INPUTS): Use $(srcdir)/lib/gnulib.mk, not gnulib_mk. * autogen.sh: Do not build nt/gnulib.mk. * configure.ac (GNULIB_MK): Remove. (SYSTEM_TYPE): Subst. (MT): New macro. Subst it. * lib/Makefile.am: Do not include ../nt/gnulib.mk. Use $(SYSTEM_TYPE), not BUILDING_FOR_WINDOWSNT. (libgnu_a_SOURCES_not, EXTRA_libgnu_a_SOURCES_not): New macros. (libgnu_a_SOURCES, EXTRA_libgnu_a_SOURCES) [windows-nt]: Filter out unwanted modules. * make-dist: Omit removed files. * nt/Makefile.in (AM_V_GEN, am__v_GEN_, am__v_GEN_0) (am__v_GEN_1, ${srcdir}/gnulib.mk): Remove. * nt/gnulib-modules-to-delete.cfg: Remove. --- .gitignore | 1 - Makefile.in | 8 +---- autogen.sh | 10 +------ configure.ac | 22 ++++---------- lib/Makefile.am | 19 ++++++++---- make-dist | 2 +- nt/Makefile.in | 10 ------- nt/gnulib-modules-to-delete.cfg | 66 ----------------------------------------- 8 files changed, 23 insertions(+), 115 deletions(-) delete mode 100644 nt/gnulib-modules-to-delete.cfg diff --git a/.gitignore b/.gitignore index e8eb4fd..85c06c9 100644 --- a/.gitignore +++ b/.gitignore @@ -288,6 +288,5 @@ lib/SYS/ /site-lisp/ nt/emacs.rc nt/emacsclient.rc -nt/gnulib.mk src/gdb.ini /var/ diff --git a/Makefile.in b/Makefile.in index b9aaf5b..3cb1f5e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -98,9 +98,6 @@ configuration= ### The nt/ subdirectory gets built only for MinGW address@hidden@ -### $(srcdir)/nt/gnulib.mk for MinGW, else $(srcdir)/lib/gnulib.mk address@hidden@ - # 'make' verbosity. AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ @@ -454,13 +451,10 @@ $(srcdir)/aclocal.m4: cd $(srcdir) && ACLOCAL_PATH='$(ACLOCAL_PATH)' $(ACLOCAL) -I m4 AUTOMAKE_INPUTS = $(srcdir)/aclocal.m4 $(srcdir)/lib/Makefile.am \ - $(gnulib_mk) + $(srcdir)/lib/gnulib.mk $(srcdir)/lib/Makefile.in: $(AUTOMAKE_INPUTS) cd $(srcdir) && $(AUTOMAKE) --gnu -a -c lib/Makefile -$(srcdir)/nt/gnulib.mk: $(srcdir)/lib/Makefile.in - $(MAKE) -C $(srcdir)/nt gnulib.mk - # Regenerate files that this makefile would have made, if this makefile # had been built by Automake. The name 'am--refresh' is for # compatibility with subsidiary Automake-generated makefiles. diff --git a/autogen.sh b/autogen.sh index f6bfde6..7381bc3 100755 --- a/autogen.sh +++ b/autogen.sh @@ -220,17 +220,9 @@ do_git= fi echo 'Your system has the required tools.' - - ## Create nt/gnulib.mk if it doesn't exist, as autoreconf will need it. - if test ! -f nt/gnulib.mk; then - echo 'Inferring nt/gnulib.mk from lib/gnulib.mk ...' - metascript='/^[^#]/s|^.*$|/^## begin *gnulib module &/,/^## end *gnulib module &/c ## gnulib module & removed|' - script=`sed "$metascript" nt/gnulib-modules-to-delete.cfg` || exit - sed "$script" lib/gnulib.mk > nt/gnulib.mk || exit - fi - echo "Running 'autoreconf -fi -I m4' ..." + ## Let autoreconf figure out what, if anything, needs doing. ## Use autoreconf's -f option in case autoreconf itself has changed. autoreconf -fi -I m4 || exit $? diff --git a/configure.ac b/configure.ac index 262f367..7fd4988 100644 --- a/configure.ac +++ b/configure.ac @@ -771,22 +771,6 @@ AC_DEFUN test "x$GCC_TEST_OPTIONS" != x && CC="$CC $GCC_TEST_OPTIONS" fi -dnl This is used in lib/Makefile.am to use nt/gnulib.mk, the -dnl alternative to lib/gnulib.mk, so as to avoid generating header files -dnl that clash with MinGW. -case $opsys in - mingw32 ) - GNULIB_MK='$(srcdir)/nt/gnulib.mk' - ;; - * ) - GNULIB_MK='$(srcdir)/lib/gnulib.mk' - ;; - -esac -AC_SUBST([GNULIB_MK]) - -AM_CONDITIONAL([BUILDING_FOR_WINDOWSNT], [test "x$opsys" = "xmingw32"]) - # Avoid gnulib's tests for -lcrypto, so that there's no static dependency on it. AC_DEFUN([gl_CRYPTO_CHECK]) # Avoid gnulib's tests for HAVE_WORKING_O_NOATIME and HAVE_WORKING_O_NOFOLLOW, @@ -1555,7 +1539,13 @@ AC_DEFUN AC_SUBST(LIB_MATH) AC_DEFINE_UNQUOTED(SYSTEM_TYPE, "$SYSTEM_TYPE", [The type of system you are compiling for; sets 'system-type'.]) +AC_SUBST([SYSTEM_TYPE]) +# The empty (MT) string. +# Use this in Makefile.am before GNU Make conditionals; +# otherwise, Automake gets confused. +MT= +AC_SUBST([MT]) pre_PKG_CONFIG_CFLAGS=$CFLAGS pre_PKG_CONFIG_LIBS=$LIBS diff --git a/lib/Makefile.am b/lib/Makefile.am index e6d90dd..141838c 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -29,13 +29,22 @@ SUFFIXES = AM_CFLAGS = $(PROFILING_CFLAGS) $(GNULIB_WARN_CFLAGS) $(WERROR_CFLAGS) DEFAULT_INCLUDES = -I. -I$(top_srcdir)/lib -I../src -I$(top_srcdir)/src -if BUILDING_FOR_WINDOWSNT -include ../nt/gnulib.mk -else include gnulib.mk -libgnu_a_SOURCES += openat-die.c save-cwd.c -endif address@hidden@ifeq ($(SYSTEM_TYPE), windows-nt) address@hidden@ libgnu_a_SOURCES_not = \ address@hidden@ acl-errno-valid.c acl-internal.c allocator.c \ address@hidden@ careadlinkat.c get-permissions.c pipe2.c \ address@hidden@ set-permissions.c tempname.c unistd.c address@hidden@ libgnu_a_SOURCES := \ address@hidden@ $(filter-out $(libgnu_a_SOURCES_not), $(libgnu_a_SOURCES)) address@hidden@ EXTRA_libgnu_a_SOURCES_not = \ address@hidden@ acl_entries.c dirfd.c fcntl.c mkostemp.c openat-proc.c secure_getenv.c address@hidden@ EXTRA_libgnu_a_SOURCES := \ address@hidden@ $(filter-out $(EXTRA_libgnu_a_SOURCES_not), $(EXTRA_libgnu_a_SOURCES)) address@hidden@else address@hidden@ libgnu_a_SOURCES += openat-die.c save-cwd.c address@hidden@endif if HYBRID_MALLOC_LIB noinst_LIBRARIES += libegnu.a diff --git a/make-dist b/make-dist index 41203b2..2d1a218 100755 --- a/make-dist +++ b/make-dist @@ -482,7 +482,7 @@ files= (cd nt ln emacs-x86.manifest emacs-x64.manifest ../${tempdir}/nt ln [a-z]*.bat [a-z]*.[ch] ../${tempdir}/nt - ln *.in gnulib.mk gnulib-modules-to-delete.cfg ../${tempdir}/nt + ln *.in ../${tempdir}/nt ln mingw-cfg.site epaths.nt INSTALL.W64 ../${tempdir}/nt ln ChangeLog.*[0-9] INSTALL README README.W32 ../${tempdir}/nt) diff --git a/nt/Makefile.in b/nt/Makefile.in index 89f4460..7e911db 100644 --- a/nt/Makefile.in +++ b/nt/Makefile.in @@ -54,11 +54,6 @@ am__v_CCLD_ = am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = -AM_V_GEN = $(address@hidden@) -am__v_GEN_ = $(address@hidden@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = - AM_V_RC = $(address@hidden@) am__v_RC_ = $(address@hidden@) am__v_RC_0 = @echo " RC " $@; @@ -260,8 +255,3 @@ runemacs${EXEEXT}: emacs.res ../src/emacs.res: emacs.rc ${srcdir}/icons/emacs.ico \ ${srcdir}/icons/hand.cur ${srcdir}/$(EMACS_MANIFEST) $(AM_V_RC)${WINDRES} -I ${srcdir} -O coff -o $@ $< - -${srcdir}/gnulib.mk: ${srcdir}/gnulib-modules-to-delete.cfg ${srcdir}/../lib/gnulib.mk - $(AM_V_GEN)sed '/^[^#]/s|^.*$$|/^## begin *gnulib module &/,/^## end *gnulib module &/c ## gnulib module & removed|' < $< | \ - sed -f- ${srcdir}/../lib/gnulib.mk > address@hidden && \ - ${srcdir}/../build-aux/move-if-change address@hidden $@ diff --git a/nt/gnulib-modules-to-delete.cfg b/nt/gnulib-modules-to-delete.cfg deleted file mode 100644 index 09bea0e..0000000 --- a/nt/gnulib-modules-to-delete.cfg +++ /dev/null @@ -1,66 +0,0 @@ -# This is the list of modules to be deleted from ../lib/gnulib.mk. -# -# We delete them because they either conflict with MinGW headers or -# headers in nt/inc, or because those modules won't compile with -# MinGW, or because Emacs already has the corresponding facilities as -# part of Emacs sources, and their implementation is incompatible with -# Gnulib's. -# -# In general, do NOT remove anything from ../lib/gnulib.mk that -# doesn't need to be removed, to minimize the differences from -# upstream gnulib.mk and thus make the maintenance easier. Every -# header file whose generation is controlled by configure-time tests -# does NOT need to be removed; instead, force the configure script to -# accept whatever MinGW has to offer, by defining the appropriate -# Autoconf variable in the nt/mingw-cfg.site file. Headers that are -# generated conditionally have the tell-tale "if GL_GENERATE_foo_H" -# condition before their Makefile snippet in this file. Likewise, do -# NOT remove gnulib modules which introduce header files that don't -# exist in MinGW and in nt/inc/, since they cannot possibly clash -# with anything. Gnulib modules that introduce source *.c files also -# need not be removed; if they define functions that could clash with -# the w32 substitutes in Emacs, disable their compilation by defining -# suitable variables in nt/mingw-cfg.site. -# ---------------------------------------------------------------------- -# -# Copyright (C) 2017 Free Software Foundation, Inc. -# -# This file is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This file is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this file. If not, see . -# -# As a special exception to the GNU General Public License, -# this file may be distributed as part of a program that -# contains a configuration script generated by Autoconf, under -# the same distribution terms as the rest of that program. -# -acl-permissions -allocator -at-internal -careadlinkat -dirent -dirfd -fcntl -fcntl-h -inttypes-incomplete -mkostemp -pipe2 -secure_getenv -signal-h -stdio -stdlib -sys_select -sys_stat -sys_time -sys_types -tempname -unistd -- 2.7.4