From 4e40bb2d16d1393c3c239f25c3a35c2992269d02 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Tue, 17 Oct 2000 07:55:44 +0000 Subject: [PATCH] Fix autoupdate: updating `AC_OUTPUT_COMMANDS' was failing because it includes another AU defined macro. * autoupdate.sh (input.m4:_au_defun): New macro. (au.m4): Use it instead of inlining _au_enable/_au_disable invocations in the definition of all these macros. (input.m4:__au_enable, input.m4:__au_disable): New macros. (input.m4:_au_enable, input.m4:_au_disable): Use them. * tests/mktests.sh (update_exclude_list): Add `AC_OUTPUT'. Running it twice in a configure.in is not valid. Add `AC_LINK_FILES' since it requires arguments. * tests/tools.m4 (autoupdating AC_LINK_FILES): New test. --- ChangeLog | 28 ++++++++++++++++++++++++++++ Makefile.am | 29 ++++++++++++++++++++++++++--- Makefile.in | 24 +++++++++++++++++------- configure | 45 +++++++++++++++++++++++---------------------- configure.in | 2 +- tests/Makefile.am | 8 ++++---- tests/Makefile.in | 8 ++++---- tests/atspecific.m4 | 2 +- tests/syntax.m4 | 4 ++-- tests/tools.m4 | 27 ++++++++++++++++++++++++++- 10 files changed, 132 insertions(+), 45 deletions(-) diff --git a/ChangeLog b/ChangeLog index 215170dc..453320b9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,31 @@ +2000-10-17 Akim Demaille + + Fix autoupdate: updating `AC_OUTPUT_COMMANDS' was failing because + it includes another AU defined macro. + + * autoupdate.sh (input.m4:_au_defun): New macro. + (au.m4): Use it instead of inlining _au_enable/_au_disable + invocations in the definition of all these macros. + (input.m4:__au_enable, input.m4:__au_disable): New macros. + (input.m4:_au_enable, input.m4:_au_disable): Use them. + * tests/mktests.sh (update_exclude_list): Add `AC_OUTPUT'. + Running it twice in a configure.in is not valid. + Add `AC_LINK_FILES' since it requires arguments. + * tests/tools.m4 (autoupdating AC_LINK_FILES): New test. + +2000-10-17 Raja R Harinath + + * Makefile.am (MAINTAINERCLEANFILES): Add acversion.m4. + (INSTALL.txt): Put into $(srcdir). + (acversion.m4): Build here ... + * configure.in (AC_OUTPUT): Not here. + + * tests/Makefile.am (MACRO_FILES): Don't use $(top_srcdir). + (syntax.m4): Create in $(srcdir). + (update.m4): Likewise. + * tests/atspecific.m4 (AT_CHECK_UPDATE): Look for autoconf + macros in the top source directory. + 2000-10-16 Akim Demaille * aclang.m4 (_AC_LANG_COMPILER_GNU): New macro, which unifies... diff --git a/Makefile.am b/Makefile.am index 39518e92..0abf833f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -54,9 +54,25 @@ $(distpkgdataDATA) CLEANFILES = autoconf.m4f \ $(bin_SCRIPTS) -## --------- ## + +## ------------------ ## +## Maintainer rules. ## +## ------------------ ## + +## acversion.m4. ## + +# - acversion.m4 needs to be updated only once, since it depends on +# configure.in, not on the results of a 'configure' run. +# - It is guaranteed (with GNU Make) that when the version in configure.in +# is changed, acversion.m4 is built only after the new version number is +# propagated to the Makefile. (Libtool uses the same guarantee.) + +acversion.m4: $(srcdir)/acversion.m4.in $(srcdir)/configure.in + sed -e 's,@''VERSION@,$(VERSION),' $(srcdir)/acversion.m4.in > acversion.tm4 + cp acversion.tm4 $(srcdir)/acversion.m4 + rm -f acversion.tm4 + ## INSTALL. ## -## --------- ## # INSTALL is a special case. Automake seems to have a single name space # for both targets and variables. If we just use INSTALL, then the var @@ -64,6 +80,14 @@ CLEANFILES = autoconf.m4f \ INSTALL.txt: $(top_srcdir)/doc/install.texi $(MAKEINFO) $< --no-headers --no-validate --no-split --output=$@ + if test '$(srcdir)' != '.'; then cp $@ $(srcdir); rm -f $@; fi + +MAINTAINERCLEANFILES = acversion.m4 INSTALL.txt + + +## ----------------------------------- ## +## Special installation instructions. ## +## ----------------------------------- ## install-data-hook: INSTALL.txt @$(NORMAL_INSTALL) @@ -74,7 +98,6 @@ install-data-hook: INSTALL.txt $(INSTALL_DATA) $$d$$p.txt $(DESTDIR)$(pkgdatadir)/$$f; \ done -MAINTAINERCLEANFILES = INSTALL.txt ## ------------- ## ## The scripts. ## diff --git a/Makefile.in b/Makefile.in index 968270b7..ee3a61b2 100644 --- a/Makefile.in +++ b/Makefile.in @@ -96,7 +96,7 @@ EXTRA_DIST = $(OLDCHANGELOGS) autoconf.sh autoheader.sh autoreconf.sh autoupdate CLEANFILES = autoconf.m4f $(bin_SCRIPTS) -MAINTAINERCLEANFILES = INSTALL.txt +MAINTAINERCLEANFILES = acversion.m4 INSTALL.txt editsh = sed -e 's,@datadir\@,$(pkgdatadir),g' -e 's,@M4\@,$(M4),g' -e 's,@AWK\@,$(AWK),g' -e 's,@SHELL\@,$(SHELL),g' -e 's,@VERSION\@,$(VERSION),g' -e 's,@PACKAGE\@,$(PACKAGE),g' -e 's,@bindir\@,$(bindir),g' -e 's,@autoconf-name\@,'`echo autoconf | sed '$(transform)'`',g' -e 's,@autoheader-name\@,'`echo autoheader | sed '$(transform)'`',g' @@ -108,15 +108,15 @@ common = libm4.m4 acgeneral.m4 acspecific.m4 acoldnames.m4 acversion.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_CLEAN_FILES = acversion.m4 +CONFIG_CLEAN_FILES = SCRIPTS = $(bin_SCRIPTS) DATA = $(pkgdata_DATA) DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \ -Makefile.in NEWS README-alpha THANKS TODO aclocal.m4 acversion.m4.in \ -config.guess config.sub configure configure.in install-sh mdate-sh \ -missing mkinstalldirs +Makefile.in NEWS README-alpha THANKS TODO aclocal.m4 config.guess \ +config.sub configure configure.in install-sh mdate-sh missing \ +mkinstalldirs PACKAGE = @PACKAGE@ @@ -141,8 +141,6 @@ config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) cd $(srcdir) && $(AUTOCONF) -acversion.m4: $(top_builddir)/config.status acversion.m4.in - cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status install-binSCRIPTS: $(bin_SCRIPTS) @$(NORMAL_INSTALL) @@ -415,12 +413,24 @@ installdirs mostlyclean-generic distclean-generic clean-generic \ maintainer-clean-generic clean mostlyclean distclean maintainer-clean +# - acversion.m4 needs to be updated only once, since it depends on +# configure.in, not on the results of a 'configure' run. +# - It is guaranteed (with GNU Make) that when the version in configure.in +# is changed, acversion.m4 is built only after the new version number is +# propagated to the Makefile. (Libtool uses the same guarantee.) + +acversion.m4: $(srcdir)/acversion.m4.in $(srcdir)/configure.in + sed -e 's,@''VERSION@,$(VERSION),' $(srcdir)/acversion.m4.in > acversion.tm4 + cp acversion.tm4 $(srcdir)/acversion.m4 + rm -f acversion.tm4 + # INSTALL is a special case. Automake seems to have a single name space # for both targets and variables. If we just use INSTALL, then the var # $(INSTALL) is not defined, and the install target fails. INSTALL.txt: $(top_srcdir)/doc/install.texi $(MAKEINFO) $< --no-headers --no-validate --no-split --output=$@ + if test '$(srcdir)' != '.'; then cp $@ $(srcdir); rm -f $@; fi install-data-hook: INSTALL.txt @$(NORMAL_INSTALL) diff --git a/configure b/configure index 79fc89d1..5286f7cd 100755 --- a/configure +++ b/configure @@ -735,7 +735,7 @@ ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='${CC-cc} -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_gnu_compiler=$ac_cv_prog_gcc +ac_compiler_gnu=$ac_cv_c_compiler_gnu case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' @@ -1027,7 +1027,7 @@ AT_TESTPATH=.. # autoheader scripts. for ac_prog in gm4 gnum4 m4 do -# Extract the first word of "$ac_prog", so it can be a program name with args. + # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "configure:1032: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 @@ -1054,19 +1054,20 @@ done esac fi M4=$ac_cv_path_M4 + if test -n "$M4"; then - echo "configure:1058: result: $M4" >&5 + echo "configure:1059: result: $M4" >&5 echo "${ECHO_T}$M4" >&6 else - echo "configure:1061: result: no" >&5 + echo "configure:1062: result: no" >&5 echo "${ECHO_T}no" >&6 fi -test -n "$M4" && break + test -n "$M4" && break done test -n "$M4" || M4="m4" -echo "configure:1069: checking whether m4 supports frozen files" >&5 +echo "configure:1070: checking whether m4 supports frozen files" >&5 echo $ECHO_N "checking whether m4 supports frozen files... $ECHO_C" >&6 if test "${ac_cv_prog_gnu_m4+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1078,7 +1079,7 @@ if test x"$M4" != x; then esac fi fi -echo "configure:1081: result: $ac_cv_prog_gnu_m4" >&5 +echo "configure:1082: result: $ac_cv_prog_gnu_m4" >&5 echo "${ECHO_T}$ac_cv_prog_gnu_m4" >&6 if test x"$ac_cv_prog_gnu_m4" != xyes; then { echo "configure: error: GNU m4 1.4 is required" >&2; exit 1; } @@ -1089,9 +1090,9 @@ fi # `autoconf' and `ifnames' use AWK. for ac_prog in mawk gawk nawk awk do -# Extract the first word of "$ac_prog", so it can be a program name with args. + # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo "configure:1094: checking for $ac_word" >&5 +echo "configure:1095: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AWK+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1113,36 +1114,36 @@ fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then - echo "configure:1116: result: $AWK" >&5 + echo "configure:1117: result: $AWK" >&5 echo "${ECHO_T}$AWK" >&6 else - echo "configure:1119: result: no" >&5 + echo "configure:1120: result: no" >&5 echo "${ECHO_T}no" >&6 fi -test -n "$AWK" && break + test -n "$AWK" && break done # Generating man pages. -echo "configure:1127: checking for working help2man" >&5 +echo "configure:1128: checking for working help2man" >&5 echo $ECHO_N "checking for working help2man... $ECHO_C" >&6 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (help2man --version) < /dev/null > /dev/null 2>&1; then HELP2MAN=help2man - echo "configure:1134: result: found" >&5 + echo "configure:1135: result: found" >&5 echo "${ECHO_T}found" >&6 else HELP2MAN="$SHELL $missing_dir/missing help2man" - echo "configure:1138: result: missing" >&5 + echo "configure:1139: result: missing" >&5 echo "${ECHO_T}missing" >&6 fi # We use a path for perl so the #! line in autoscan will work. # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 -echo "configure:1145: checking for $ac_word" >&5 +echo "configure:1146: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_PERL+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1168,11 +1169,12 @@ done esac fi PERL=$ac_cv_path_PERL + if test -n "$PERL"; then - echo "configure:1172: result: $PERL" >&5 + echo "configure:1174: result: $PERL" >&5 echo "${ECHO_T}$PERL" >&6 else - echo "configure:1175: result: no" >&5 + echo "configure:1177: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1194,7 +1196,7 @@ fi # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. -echo "configure:1197: checking for a BSD compatible install" >&5 +echo "configure:1199: checking for a BSD compatible install" >&5 echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then @@ -1243,7 +1245,7 @@ fi INSTALL=$ac_install_sh fi fi -echo "configure:1246: result: $INSTALL" >&5 +echo "configure:1248: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. @@ -1259,7 +1261,7 @@ if test -f $srcdir/standards.texi; then standards_texi=standards.texi fi -ac_config_files="$ac_config_files acversion.m4 Makefile m4/Makefile man/Makefile doc/Makefile +ac_config_files="$ac_config_files Makefile m4/Makefile man/Makefile doc/Makefile tests/Makefile tests/atconfig" trap '' 1 2 15 cat >confcache <<\EOF @@ -1525,7 +1527,6 @@ Try \`$me --help' for more information."; exit 1 ;; ac_need_defaults=false;; # Handling of arguments. - 'acversion.m4' ) CONFIG_FILES="$CONFIG_FILES acversion.m4" ;; 'Makefile' ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; 'm4/Makefile' ) CONFIG_FILES="$CONFIG_FILES m4/Makefile" ;; 'man/Makefile' ) CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; diff --git a/configure.in b/configure.in index 22aad3ee..44b0bd56 100644 --- a/configure.in +++ b/configure.in @@ -42,5 +42,5 @@ if test -f $srcdir/standards.texi; then AC_SUBST(standards_texi, standards.texi)dnl fi -AC_OUTPUT(acversion.m4 Makefile m4/Makefile man/Makefile doc/Makefile +AC_OUTPUT(Makefile m4/Makefile man/Makefile doc/Makefile tests/Makefile tests/atconfig) diff --git a/tests/Makefile.am b/tests/Makefile.am index a81cbf2a..6155db76 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -39,14 +39,14 @@ testsuite: atgeneral.m4 atspecific.m4 suite.m4 $(SUITE) # The files which contains macro we check for syntax. -MACRO_FILES = $(top_srcdir)/acgeneral.m4 $(top_srcdir)/acspecific.m4 \ - $(top_srcdir)/acfunctions.m4 $(top_srcdir)/aclang.m4 +MACRO_FILES = ../acgeneral.m4 ../acspecific.m4 \ + ../acfunctions.m4 ../aclang.m4 syntax.m4: mktests.sh $(MACRO_FILES) - ./mktests.sh $(MACRO_FILES) + cd $(srcdir) && ./mktests.sh $(MACRO_FILES) update.m4: mktests.sh $(MACRO_FILES) - ./mktests.sh $(MACRO_FILES) + cd $(srcdir) && ./mktests.sh $(MACRO_FILES) CLEANFILES = debug-*.sh macro configure configure.in config.status \ config.cache config.log config.h.in config.h diff --git a/tests/Makefile.in b/tests/Makefile.in index b3cff9e5..b372f45b 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -74,7 +74,7 @@ EXTRA_DIST = atgeneral.m4 atspecific.m4 suite.m4 aclocal.m4 $(SUITE # The files which contains macro we check for syntax. -MACRO_FILES = $(top_srcdir)/acgeneral.m4 $(top_srcdir)/acspecific.m4 $(top_srcdir)/acfunctions.m4 $(top_srcdir)/aclang.m4 +MACRO_FILES = ../acgeneral.m4 ../acspecific.m4 ../acfunctions.m4 ../aclang.m4 CLEANFILES = debug-*.sh macro configure configure.in config.status config.cache config.log config.h.in config.h @@ -82,7 +82,7 @@ CLEANFILES = debug-*.sh macro configure configure.in config.status config.cache DISTCLEANFILES = atconfig testsuite mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_CLEAN_FILES = atconfig -DIST_COMMON = Makefile.am Makefile.in atconfig.in +DIST_COMMON = Makefile.am Makefile.in atconfig.in configure.in PACKAGE = @PACKAGE@ @@ -202,10 +202,10 @@ testsuite: atgeneral.m4 atspecific.m4 suite.m4 $(SUITE) mv $@-tmp $@ syntax.m4: mktests.sh $(MACRO_FILES) - ./mktests.sh $(MACRO_FILES) + cd $(srcdir) && ./mktests.sh $(MACRO_FILES) update.m4: mktests.sh $(MACRO_FILES) - ./mktests.sh $(MACRO_FILES) + cd $(srcdir) && ./mktests.sh $(MACRO_FILES) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/tests/atspecific.m4 b/tests/atspecific.m4 index 354e75b6..984a8aab 100644 --- a/tests/atspecific.m4 +++ b/tests/atspecific.m4 @@ -131,7 +131,7 @@ AT_DEFINE([AT_CHECK_UPDATE], [AT_SETUP([the autoupdating of $1]) _AT_CHECK_AC_MACRO([$1], -[AT_CHECK([autoupdate --autoconf-dir ..], 0, +[AT_CHECK([autoupdate --autoconf-dir $at_top_srcdir], 0, [], [autoupdate: `configure.in' is updated ])]) diff --git a/tests/syntax.m4 b/tests/syntax.m4 index 3ae1c759..b7a5dce9 100644 --- a/tests/syntax.m4 +++ b/tests/syntax.m4 @@ -13,12 +13,12 @@ AT_CHECK_MACRO([AC_ARG_ENABLE]) AT_CHECK_MACRO([AC_ARG_PROGRAM]) AT_CHECK_MACRO([AC_ARG_WITH]) AT_CHECK_MACRO([AC_CANONICAL_TARGET]) +AT_CHECK_MACRO([AC_CHECK_TOOL_PREFIX]) +AT_CHECK_MACRO([AC_COMPILE_CHECK]) AT_CHECK_MACRO([AC_C_BIGENDIAN]) AT_CHECK_MACRO([AC_C_CHAR_UNSIGNED]) AT_CHECK_MACRO([AC_C_CROSS]) -AT_CHECK_MACRO([AC_CHECK_TOOL_PREFIX]) AT_CHECK_MACRO([AC_C_LONG_DOUBLE]) -AT_CHECK_MACRO([AC_COMPILE_CHECK]) AT_CHECK_MACRO([AC_C_PROTOTYPES]) AT_CHECK_MACRO([AC_C_STRINGIZE]) AT_CHECK_MACRO([AC_DECL_SYS_SIGLIST]) diff --git a/tests/tools.m4 b/tests/tools.m4 index 2a712da7..96580b86 100644 --- a/tests/tools.m4 +++ b/tests/tools.m4 @@ -160,7 +160,7 @@ AT_CLEANUP ## autoupdate. ## ## ------------ ## -# Check that AC_LINK_FILES and AC_OUTPUT are properly updated. +# Check that AC_CANONICAL_SYSTEM and AC_OUTPUT are properly updated. AT_SETUP(autoupdate) AT_DATA(configure.in, @@ -185,6 +185,31 @@ AC_OUTPUT AT_CLEANUP +AT_SETUP([autoupdating AC_LINK FILES]) + +AT_DATA(configure.in, +[[AC_INIT +AC_LINK_FILES(dst1 dst2, src1 src2) +AC_OUTPUT +]]) + +AT_DATA(dst1, dst1 +) +AT_DATA(dst2, dst2 +) + +# Checking `autoupdate'. +AT_CHECK([../autoupdate --autoconf-dir $top_srcdir], 0, [], + [autoupdate: `configure.in' is updated +]) +AT_CHECK([../autoconf --autoconf-dir $top_srcdir], 0) +AT_CHECK([./configure], 0, ignore) +AT_CHECK([cat src1], 0, [dst1 +]) +AT_CHECK([cat src2], 0, [dst2 +]) + +AT_CLEANUP ## ------------------ ##