From 54c01922a4a95ca37ef50e441471bad2c817ba85 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 20 Sep 1996 15:55:22 +0000 Subject: [PATCH] Allow config.h in subdir; other config.h cleanups --- ChangeLog | 23 +++++++++++ TODO | 9 ++--- automake.in | 106 ++++++++++++++++++++++++++++++++------------------- automake.texi | 4 +- clean.am | 2 +- lib/am/clean.am | 2 +- lib/am/remake-hdr.am | 14 ++++++- lib/am/tags.am | 4 +- remake-hdr.am | 14 ++++++- tags.am | 4 +- tests/ChangeLog | 4 ++ tests/Makefile.am | 3 +- tests/Makefile.in | 3 +- tests/confsub.test | 28 ++++++++++++++ version.texi | 2 +- 15 files changed, 161 insertions(+), 61 deletions(-) create mode 100755 tests/confsub.test diff --git a/ChangeLog b/ChangeLog index 8661b78..2bd647b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +Fri Sep 20 09:06:37 1996 Tom Tromey + + * tags.am (TAGS): Minor cleanup. + + * clean.am (distclean-generic): Don't remove CONFIG_HEADER. + + * remake-hdr.am (mostlyclean-hdr, clean-hdr, distclean-hdr, + maintainer-clean-hdr): New targets. + + * automake.in (handle_configure): Define CONFIG_HEADER correctly + when it is in current directory. + (handle_configure): Push "hdr" on @clean. + + * remake-hdr.am (stamp-h): Run config.status in top_builddir. + ($(srcdir)/stamp-h.in): Run autoheader in top_srcdir. + + * automake.in (scan_configure): Check for install.sh here. + (basename): New sub. + (handle_configure): Handle case where config.h is in subdir. + (handle_configure): Make stamp-in.h for user if it doesn't already + exist. + (touch): New sub. + Tue Sep 17 23:35:14 1996 Tom Tromey * Makefile.am (EXTRA_DIST): Include pkgdata_DATA. diff --git a/TODO b/TODO index 086285a..89aad9c 100644 --- a/TODO +++ b/TODO @@ -1,9 +1,9 @@ Priorities for release: [ none ] -support config.h in subdir +must move CONFIG_HEADER from tags.am... allow it to work in subdir. -consider auto-creating stamp-h.in for user +if @...@ substitution in _PROGRAMS, then require EXTRA_PROGRAMS! take diff-n-query code from libit @@ -288,9 +288,6 @@ some support for this. Here are some of the issues: * can do this by looking at subdirs, seeing configure.in and auto-running Automake there -dejagnu support: -* use RUNTEST_FOR_TARGET in some cases? - These can both be handled via dist-hook: . Consider supporting guile-style PLUGIN directories automatically? . Consider allowing eg "foo/bar" to appear in EXTRA_DIST, and generating @@ -353,6 +350,8 @@ This is insufficiently clear must document the targets required for integration with non-automake-using subdirs +use of (eg) EXTRA_PROGRAMS is not very clear right now + ================================================================ Libraries: diff --git a/automake.in b/automake.in index 10a49b6..33bb046 100755 --- a/automake.in +++ b/automake.in @@ -1983,48 +1983,43 @@ sub handle_configure . $strictness_name . '/g', 'remake'); + $top_reldir = ''; + } - &am_error - ("\`install.sh' is an anachronism; use \`install-sh' instead") - if -f $relative_dir . '/install.sh'; - - # If we have a configure header, require it. - if ($config_header) - { - # FIXME: this restriction should be lifted. - # FIXME: first see if it is even needed as-is. - &am_conf_line_error ($config_header_line, - "argument to AC_CONFIG_HEADER contains \`/'\n") - if ($config_header =~ /\//); - - &require_file_with_conf_line ($config_header_line, - $FOREIGN, $config_header); - - # Header defined and in this directory. - if (-f 'acconfig.h') - { - &define_variable ("ACCONFIG", "acconfig.h"); - &push_dist_common ('acconfig.h'); - } - if (-f $config_name . '.top') - { - &define_variable ("CONFIG_TOP", "${config_name}.top"); - &push_dist_common ($config_name . '.top'); - } - if (-f $config_name . '.bot') - { - &define_variable ("CONFIG_BOT", "${config_name}.bot"); - &push_dist_common ($config_name . '.bot'); - } + # If we have a configure header, require it. + if ($config_header && $relative_dir eq &dirname ($config_header)) + { + local ($ch_sans_dir) = &basename ($config_header); + local ($cn_sans_dir) = &basename ($config_name); - &require_file_with_conf_line ($config_header_line, $FOREIGN, - 'stamp-h.in'); + &require_file_with_conf_line ($config_header_line, + $FOREIGN, $ch_sans_dir); - $output_rules .= &file_contents ('remake-hdr'); - &define_variable ("CONFIG_HEADER_IN", "${config_header}"); + # Header defined and in this directory. + if (-f $relative_dir . '/acconfig.h') + { + &define_variable ("ACCONFIG", "acconfig.h"); + &push_dist_common ('acconfig.h'); + } + if (-f $config_name . '.top') + { + &define_variable ("CONFIG_TOP", "${cn_sans_dir}.top"); + &push_dist_common ($cn_sans_dir . '.top'); + } + if (-f $config_name . '.bot') + { + &define_variable ("CONFIG_BOT", "${cn_sans_dir}.bot"); + &push_dist_common ($cn_sans_dir . '.bot'); } - $top_reldir = ''; + &touch ($relative_dir . '/stamp-h.in'); + &require_file_with_conf_line ($config_header_line, $FOREIGN, + 'stamp-h.in'); + + $output_rules .= &file_contents ('remake-hdr'); + push (@clean, 'hdr'); + &push_phony_cleaners ('hdr'); + &define_variable ("CONFIG_HEADER_IN", "${ch_sans_dir}"); } # Set location of mkinstalldirs. @@ -2041,9 +2036,19 @@ sub handle_configure "\`CONFIG_HEADER' is an anachronism; now determined from \`configure.in'") if &variable_defined ('CONFIG_HEADER'); - # Generate CONFIG_HEADER define. - &define_variable ("CONFIG_HEADER", "${top_builddir}/${config_name}") - if $config_name; + if ($config_name) + { + # Generate CONFIG_HEADER define. + if ($relative_dir eq &dirname ($config_name)) + { + &define_variable ("CONFIG_HEADER", &basename ($config_name)); + } + else + { + &define_variable ("CONFIG_HEADER", + "${top_builddir}/${config_name}"); + } + } # Now look for other files in this directory which must be remade # by config.status, and generate rules for them. @@ -2853,6 +2858,8 @@ sub scan_configure # the file-finding machinery works. local ($relative_dir) = '.'; &require_config_file ($FOREIGN, 'install-sh', 'mkinstalldirs'); + &am_error ("\`install.sh' is an anachronism; use \`install-sh' instead") + if -f $config_aux_path[0] . '/install.sh'; } ################################################################ @@ -3934,6 +3941,25 @@ sub dirname return $sub; } +# Return file name of a file. +sub basename +{ + local ($file) = @_; + local ($sub); + + ($sub = $file) =~s,^.*/+,,g; + return $sub; +} + +# Touch a file. +sub touch +{ + local ($file) = @_; + + open (TOUCH, ">> $file"); + close (TOUCH); +} + ################################################################ # Print an error message and set exit status. diff --git a/automake.texi b/automake.texi index 7664c8f..7e83dfc 100644 --- a/automake.texi +++ b/automake.texi @@ -1402,7 +1402,9 @@ current directory, are automatically included. This list is printed by Still, sometimes there are files which must be distributed, but which are not covered in the automatic rules. These files should be listed in -the @code{EXTRA_DIST} variable. +the @code{EXTRA_DIST} variable. Note that @code{EXTRA_DIST} can only +handle files in the current directory; files in other directories will +cause @code{make dist} runtime failures. @vindex EXTRA_DIST Occasionally it is useful to be able to change the distribution before diff --git a/clean.am b/clean.am index 387d245..165f115 100644 --- a/clean.am +++ b/clean.am @@ -27,7 +27,7 @@ clean-generic: distclean-generic: rm -f Makefile $(DISTCLEANFILES) - rm -f config.cache config.log $(CONFIG_HEADER) stamp-h + rm -f config.cache config.log stamp-h test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: diff --git a/lib/am/clean.am b/lib/am/clean.am index 387d245..165f115 100644 --- a/lib/am/clean.am +++ b/lib/am/clean.am @@ -27,7 +27,7 @@ clean-generic: distclean-generic: rm -f Makefile $(DISTCLEANFILES) - rm -f config.cache config.log $(CONFIG_HEADER) stamp-h + rm -f config.cache config.log stamp-h test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: diff --git a/lib/am/remake-hdr.am b/lib/am/remake-hdr.am index f7fad83..efc60c7 100644 --- a/lib/am/remake-hdr.am +++ b/lib/am/remake-hdr.am @@ -17,9 +17,19 @@ ## 02111-1307, USA. $(CONFIG_HEADER): stamp-h stamp-h: $(CONFIG_HEADER_IN) config.status - CONFIG_FILES= CONFIG_HEADERS=$(CONFIG_HEADER) ./config.status + cd $(top_builddir) \ + && CONFIG_FILES= CONFIG_HEADERS=$(CONFIG_HEADER) ./config.status @echo timestamp > stamp-h $(srcdir)/$(CONFIG_HEADER_IN): @MAINT@stamp-h.in $(srcdir)/stamp-h.in: configure.in $(ACLOCAL) $(ACCONFIG) $(CONFIG_TOP) $(CONFIG_BOT) - cd $(srcdir) && autoheader + cd $(top_srcdir) && autoheader echo timestamp > $(srcdir)/stamp-h.in + +mostlyclean-hdr: + +clean-hdr: + +distclean-hdr: + rm -f $(CONFIG_HEADER) + +maintainer-clean-hdr: diff --git a/lib/am/tags.am b/lib/am/tags.am index 68e2bd5..6da6509 100644 --- a/lib/am/tags.am +++ b/lib/am/tags.am @@ -28,9 +28,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(CONFIG_HEADER) \ tags=; \ here=`pwd`; \ for subdir in $(SUBDIRS); do \ - test -f $$subdir/TAGS && { \ - tags="$$tags -i $$here/$$subdir/TAGS"; \ - } \ + test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ done; \ ## Make sure we have something to run etags on. test -z "$(ETAGS_ARGS)$(CONFIG_HEADER)$(SOURCES)$(HEADERS)$$tags" \ diff --git a/remake-hdr.am b/remake-hdr.am index f7fad83..efc60c7 100644 --- a/remake-hdr.am +++ b/remake-hdr.am @@ -17,9 +17,19 @@ ## 02111-1307, USA. $(CONFIG_HEADER): stamp-h stamp-h: $(CONFIG_HEADER_IN) config.status - CONFIG_FILES= CONFIG_HEADERS=$(CONFIG_HEADER) ./config.status + cd $(top_builddir) \ + && CONFIG_FILES= CONFIG_HEADERS=$(CONFIG_HEADER) ./config.status @echo timestamp > stamp-h $(srcdir)/$(CONFIG_HEADER_IN): @MAINT@stamp-h.in $(srcdir)/stamp-h.in: configure.in $(ACLOCAL) $(ACCONFIG) $(CONFIG_TOP) $(CONFIG_BOT) - cd $(srcdir) && autoheader + cd $(top_srcdir) && autoheader echo timestamp > $(srcdir)/stamp-h.in + +mostlyclean-hdr: + +clean-hdr: + +distclean-hdr: + rm -f $(CONFIG_HEADER) + +maintainer-clean-hdr: diff --git a/tags.am b/tags.am index 68e2bd5..6da6509 100644 --- a/tags.am +++ b/tags.am @@ -28,9 +28,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(CONFIG_HEADER) \ tags=; \ here=`pwd`; \ for subdir in $(SUBDIRS); do \ - test -f $$subdir/TAGS && { \ - tags="$$tags -i $$here/$$subdir/TAGS"; \ - } \ + test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ done; \ ## Make sure we have something to run etags on. test -z "$(ETAGS_ARGS)$(CONFIG_HEADER)$(SOURCES)$(HEADERS)$$tags" \ diff --git a/tests/ChangeLog b/tests/ChangeLog index 3239930..b14501e 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,7 @@ +Fri Sep 20 09:39:27 1996 Tom Tromey + + * confsub.test: New file. + Mon Sep 16 00:05:52 1996 Tom Tromey * spell2.test: New file. diff --git a/tests/Makefile.am b/tests/Makefile.am index 1207bbe..102e9b9 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -14,6 +14,7 @@ error.test colon.test vtexi2.test tags.test comment.test libfiles.test \ man.test info.test obsolete.test lex.test scripts.test subdir2.test \ exsource.test canon4.test dup.test defun.test cxxlink.test cxxnoc.test \ order.test libobj2.test interp.test alllib.test block.test libobj3.test \ -gnits.test interp2.test colneq.test implicit.test spell.test spell2.test +gnits.test interp2.test colneq.test implicit.test spell.test spell2.test \ +confsub.test EXTRA_DIST = defs $(TESTS) diff --git a/tests/Makefile.in b/tests/Makefile.in index 25cf3a7..c940a5f 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -52,7 +52,8 @@ error.test colon.test vtexi2.test tags.test comment.test libfiles.test \ man.test info.test obsolete.test lex.test scripts.test subdir2.test \ exsource.test canon4.test dup.test defun.test cxxlink.test cxxnoc.test \ order.test libobj2.test interp.test alllib.test block.test libobj3.test \ -gnits.test interp2.test colneq.test implicit.test spell.test spell2.test +gnits.test interp2.test colneq.test implicit.test spell.test spell2.test \ +confsub.test EXTRA_DIST = defs $(TESTS) mkinstalldirs = $(top_srcdir)/mkinstalldirs diff --git a/tests/confsub.test b/tests/confsub.test new file mode 100755 index 0000000..0d935d4 --- /dev/null +++ b/tests/confsub.test @@ -0,0 +1,28 @@ +#! /bin/sh + +# Test to make sure config.h can be in subdir. + +. $srcdir/defs || exit 1 + +cat > configure.in << 'END' +AC_PROG_MAKE_SET +AC_CONFIG_HEADER(subdir/config.h) +PACKAGE=nonesuch +VERSION=nonesuch +AC_ARG_PROGRAM +AM_PROG_INSTALL +AC_OUTPUT(Makefile subdir/Makefile) +END + +cat > Makefile.am << 'END' +SUBDIRS = subdir +END + +mkdir subdir +cat > subdir/Makefile.am << 'END' +bin_PROGRAMS = fred +END + +: > subdir/config.h.in + +$AUTOMAKE diff --git a/version.texi b/version.texi index cc88283..3513c74 100644 --- a/version.texi +++ b/version.texi @@ -1,3 +1,3 @@ -@set UPDATED 17 September 1996 +@set UPDATED 20 September 1996 @set EDITION 1.1f @set VERSION 1.1f -- 2.7.4