From ec704849bd34e3ec06e6edff529149a8b2ee3d9d Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 28 Mar 1996 18:41:18 +0000 Subject: [PATCH] Find mdate-sh and mkinstalldirs in AC_CONFIG_AUX_DIR --- ChangeLog | 25 +++++ Makefile.am | 4 +- Makefile.in | 12 +-- NEWS | 4 + TODO | 13 ++- automake.in | 262 ++++++++++++++++++++++----------------------- automake.texi | 3 +- lib/am/Makefile.am | 4 +- texi-version.am | 4 +- version.texi | 2 +- 10 files changed, 178 insertions(+), 155 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7c082689..48979601 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,28 @@ +Thu Mar 28 08:33:21 1996 Tom Tromey + + * Makefile.am (maintainer-check): Do "make check" after all syntax + checks. + + * texi-version.am (stamp-@VTI@): Look for mdate-sh in appropriate + directory. + + * automake.in ($seen_arg_prog): New global. + (handle_programs): Error if AC_ARG_PROGRAM not seen. + (handle_scripts): Ditto. + (handle_configure): mkinstalldirs now a config file. + (handle_installdirs): Find mkinstalldirs in config_aux_dir. + (handle_dist_worker): Removed DIST_SUBDIRS. + (require_file_path): New variable. + (require_file_with_conf_line): Set it. + (require_file_with_line): Ditto. + (require_file): Ditto. + (require_file_internal): Incorporated code from + require_config_file. + (require_config_file): Rewrote. + (require_conf_file_with_line): New function. + (handle_texinfo): Use it for mdate-sh. + (handle_texinfo): Look for mdate-sh in appropriate directory. + Tue Mar 26 13:47:54 1996 Tom Tromey * Makefile.am (cvs-dist): Find NEWS in srcdir. diff --git a/Makefile.am b/Makefile.am index 15ca3c6f..f8ed73e7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -49,7 +49,8 @@ installcheck-local: # * make sure the scripts don't use 'true' # * expect no instances of '${...}' # These are only really guaranteed to work on my machine. -maintainer-check: automake check +maintainer-check: automake +## Do syntax, etc, checks before make check. $(PERL) -c -w automake @if grep '^[^#].*true' $(srcdir)/[a-z]*.am; then \ echo "can't use 'true' in GNU Makefile" 1>&2; \ @@ -62,6 +63,7 @@ maintainer-check: automake check if $(SHELL) -c 'perl4.036 -v' >/dev/null 2>&1; then \ perl4.036 -c -w automake; \ else :; fi + $(MAKE) check # Tag before making distribution. Also, don't make a distribution if # checks fail. Also, make sure the NEWS file is up-to-date. diff --git a/Makefile.in b/Makefile.in index c54590f6..7f8ec9e7 100644 --- a/Makefile.in +++ b/Makefile.in @@ -142,8 +142,8 @@ uninstall-pkgdataSCRIPTS: version.texi: stamp-vti stamp-vti: automake.texi $(top_srcdir)/configure.in - echo "@set UPDATED `cd $(srcdir) && $(SHELL) mdate-sh automake.texi`" \ - > vti.tmp + echo "@set UPDATED `cd $(srcdir) \ + && $(SHELL) ./mdate-sh automake.texi`" > vti.tmp echo "@set EDITION $(VERSION)" >> vti.tmp echo "@set VERSION $(VERSION)" >> vti.tmp if cmp -s vti.tmp $(srcdir)/version.texi; then \ @@ -258,7 +258,7 @@ maintainer-clean-tags: distdir = $(PACKAGE)-$(VERSION) dist: $(DEP_DISTFILES) - @if sed 15q NEWS | grep -e "$(VERSION)" > /dev/null; then :; else \ + @if sed 15q $(srcdir)/NEWS | grep -e "$(VERSION)" > /dev/null; then :; else \ echo "NEWS not updated; not releasing" 1>&2; \ exit 1; \ fi @@ -313,8 +313,7 @@ all: all-recursive all-am install-strip: $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install installdirs: installdirs-recursive - $(top_srcdir)/mkinstalldirs $(bindir) $(pkgdatadir) $(infodir) \ - $(pkgdatadir) + ./mkinstalldirs $(bindir) $(pkgdatadir) $(infodir) $(pkgdatadir) mostlyclean-generic: @@ -384,7 +383,7 @@ installcheck-local: # * make sure the scripts don't use 'true' # * expect no instances of '${...}' # These are only really guaranteed to work on my machine. -maintainer-check: automake check +maintainer-check: automake $(PERL) -c -w automake @if grep '^[^#].*true' $(srcdir)/[a-z]*.am; then \ echo "can't use 'true' in GNU Makefile" 1>&2; \ @@ -397,6 +396,7 @@ maintainer-check: automake check if $(SHELL) -c 'perl4.036 -v' >/dev/null 2>&1; then \ perl4.036 -c -w automake; \ else :; fi + $(MAKE) check # Tag before making distribution. Also, don't make a distribution if # checks fail. Also, make sure the NEWS file is up-to-date. diff --git a/NEWS b/NEWS index faa9c960..e918b98d 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,9 @@ New in 0.32: * Many bug fixes +* mkinstalldirs and mdate-sh now appear in directory specified by + AC_CONFIG_AUX_DIR. +* Removed DIST_SUBDIRS, DIST_OTHER +* AC_ARG_PROGRAM only required when an actual program exists New in 0.31: * Bug fixes diff --git a/TODO b/TODO index bc79e90b..d5c9f72d 100644 --- a/TODO +++ b/TODO @@ -1,8 +1,4 @@ Priorities for release: -* For 0.32: remove last mention of DIST_OTHER, DIST_SUBDIRS -* Only require AC_ARG_PROGRAM if a program installed - this requires omitting vars in this case as well -* Add test case for recent RULE_PATTERN change * Add Dieter's idea of dist-local target; document Other priorities: @@ -20,16 +16,19 @@ Consider supporting guile-style PLUGIN directories automatically? Consider allowing eg "foo/bar" to appear in EXTRA_DIST, and generating code to make directory foo at dist time -Consider allowing mkinstalldirs, mdate-sh, and others to be put in -AC_CONFIG_AUX_DIR. Maybe even ansi2knr? [ Do this! ] +Consider putting ansi2knr in AC_CONFIG_AUX_DIR -Check to make sure various scripts are executable. +Check to make sure various scripts are executable (IE when looking for +them in a directory) Testing: allow support for Cygnus-style dejagnu-based test suites via an option Think about ways to make automake fit better with Cygnus-style trees. +Omit program transform vars from header if no program installed. This +is currently pretty hard to do. + Use recode in dist target when MAINT_CHARSET specified. Read caveats in automake.in before doing this. Note the same problem used to apply to the no-dependencies option; maybe it still should? Note also that diff --git a/automake.in b/automake.in index c9773a77..ffea8ee0 100755 --- a/automake.in +++ b/automake.in @@ -138,6 +138,9 @@ $seen_canonical = 0; # TRUE if we've seen AC_PROG_RANLIB. $seen_ranlib = 0; +# TRUE if we've seen AC_ARG_PROGRAM. +$seen_arg_prog = 0; + # Charsets used by maintainer and in distribution. MAINT_CHARSET is # handled in a funny way: if seen in the top-level Makefile.am, it is # used for every directory which does not specify a different value. @@ -610,6 +613,12 @@ sub handle_programs 'noinst', 'check'); return if ! @proglist; + # If a program is installed, this is required. We only want this + # error to appear once. + &am_conf_error ("AC_ARG_PROGRAM must be used in configure.in") + unless $seen_arg_prog; + $seen_arg_prog = 1; + local ($obj) = &get_object_extension; local ($one_file, $xname, $munge); @@ -733,6 +742,15 @@ sub handle_scripts # We really only want a boolean value. $scripts_installed = 1 if $scripts_installed; + + if ($scripts_installed) + { + # If a program is installed, this is required. We only want this + # error to appear once. + &am_conf_error ("AC_ARG_PROGRAM must be used in configure.in") + unless $seen_arg_prog; + $seen_arg_prog = 1; + } } # Search a file for a "version.texi" Texinfo include. Return the name @@ -803,19 +821,21 @@ sub handle_texinfo &push_dist_common ($vtexi, 'stamp-' . $vti); push (@clean, $vti); + # Only require once. + &require_conf_file_with_line ('info_TEXINFOS', $FOREIGN, + 'mdate-sh') + if ! $done; + ++$done; + $output_rules .= &file_contents_with_transform ('s/\@TEXI\@/' . $info_cursor . '/g; ' . 's/\@VTI\@/' . $vti . '/g; ' - . 's/\@VTEXI\@/' . $vtexi . '/g', + . 's/\@VTEXI\@/' . $vtexi . '/g;' + . 's,\@MDDIR\@,' . $config_aux_dir . ',g;', 'texi-version'); &push_phony_cleaners ($vti); - - # Only require once. - &require_file_with_line ('info_TEXINFOS', $FOREIGN, 'mdate-sh') - if ! $done; - ++$done; } # If user specified file_TEXINFOS, then use that as explicit @@ -1079,20 +1099,6 @@ sub handle_dist_worker '; } - # Make verbatim copies of some subdirectories if required. This - # is a hack which might go away. - if (defined $contents{'DIST_SUBDIRS'}) - { - &am_line_error ('DIST_SUBDIRS', - "\`DIST_SUBDIRS' is deprecated; make a new \`Makefile.am' instead"); - - $output_rules .= ' @for dir in $(DIST_SUBDIRS); do \\ - echo copying directory $$dir; \\ - tar chf - $$dir | (cd $(distdir) && tar xBpf -); \\ - done -'; - } - # Finalize. if ($relative_dir eq '.') { @@ -1120,11 +1126,6 @@ sub handle_dist $maint_charset = $local_maint_charset if $relative_dir eq '.'; - &am_line_error - ('DIST_OTHER', - "\`DIST_OTHER' is an anachronism; use \`EXTRA_DIST' instead") - if defined $contents{'DIST_OTHER'}; - if (defined $contents{'DIST_CHARSET'}) { &am_line_error ('DIST_CHARSET', @@ -1301,8 +1302,7 @@ sub handle_configure $output_rules .= &file_contents ('remake'); # Look for some files we need. - &require_config_file ($FOREIGN, 'install-sh'); - &require_file ($FOREIGN, 'mkinstalldirs'); + &require_config_file ($FOREIGN, 'install-sh', 'mkinstalldirs'); &am_error ("\`install.sh' is an anachronism; use \`install-sh' instead") @@ -1493,7 +1493,7 @@ sub handle_installdirs push (@phony, 'installdirs'); if (@installdirs) { - &pretty_print_rule ("\t\$(top_srcdir)/mkinstalldirs ", "\t\t", + &pretty_print_rule ("\t$config_aux_dir/mkinstalldirs ", "\t\t", @installdirs); } $output_rules .= "\n"; @@ -1788,7 +1788,6 @@ sub scan_configure %libsources = (); local ($in_ac_output, @make_list) = 0; - local ($seen_arg_prog) = 0; local ($libobj_iter); while () { @@ -1911,8 +1910,7 @@ sub scan_configure || /AC_SUBST\(YACC\)/ || /AC_(PATH|CHECK)_PROGS?\(YACC/); - # Some things required by Automake. FIXME We only really - # require AC_ARG_PROGRAM if any program is installed. + # Some things required by Automake. $seen_make_set = 1 if /AC_PROG_MAKE_SET/; $seen_prog_install = 1 if ! $seen_prog_install && /AC_PROG_INSTALL/; $seen_prog_install = 2 if ! $seen_prog_install && /fp_PROG_INSTALL/; @@ -1923,9 +1921,6 @@ sub scan_configure # Set input files if not specified by user. @input_files = @make_list if (! @input_files); - &am_conf_error ("AC_ARG_PROGRAM must be used in configure.in") - unless $seen_arg_prog; - close (CONFIGURE); } @@ -2581,104 +2576,26 @@ sub am_install_var ################################################################ -# Verify that the file must exist in the current directory. -# Usage: require_file (isconfigure, line_number, strictness, file) -# strictness is the strictness level at which this file becomes -# required. +# This variable is local to the "require file" set of functions. +@require_file_paths = (); + +# Verify that the file must exist in the current directory. Usage: +# require_file (isconfigure, line_number, strictness, file) strictness +# is the strictness level at which this file becomes required. Must +# set require_file_paths before calling this function. +# require_file_paths is set to hold a single directory (the one in +# which the first file was found) before return. sub require_file_internal { local ($is_configure, $line, $mystrict, @files) = @_; local ($file, $fullfile); - - foreach $file (@files) - { - $fullfile = $relative_dir . "/" . $file; - - if (-f $fullfile) - { - &push_dist_common ($file); - } - elsif ($strictness >= $mystrict) - { - # Only install missing files according to our desired - # strictness level. - if ($add_missing && -f ($am_dir . '/' . $file)) - { - # Install the missing file. Symlink if we can, copy - # if we must. - if ($symlink_exists) - { - symlink ($am_dir . '/' . $file, $fullfile); - } - else - { - system ('cp', $am_dir . '/' . $file, $fullfile); - } - - # FIXME this is a hack. Should have am_warn. - local ($save) = $exit_status; - if ($is_configure) - { - &am_conf_line_error - ($line, - "required file \"$fullfile\" not found; installing"); - } - else - { - &am_line_error - ($line, - "required file \"$fullfile\" not found; installing"); - } - $exit_status = $save; - } - else - { - # Only an error if strictness constraint violated. - if ($is_configure) - { - &am_conf_line_error - ($line, "required file \"$fullfile\" not found"); - } - else - { - &am_line_error - ($line, "required file \"$fullfile\" not found"); - } - } - } - } -} - -# Like require_file_with_line, but error messages refer to -# configure.in, not the current Makefile.am. -sub require_file_with_conf_line -{ - &require_file_internal (1, @_); -} - -sub require_file_with_line -{ - &require_file_internal (0, @_); -} - -sub require_file -{ - &require_file_internal (0, '', @_); -} - -# Require a file that is also required by Autoconf. Looks in -# configuration path, as specified by AC_CONFIG_AUX_DIR. -sub require_config_file -{ - local ($mystrict, @files) = @_; - local ($file, $dir); - local ($found_it); - local ($errfile); + local ($found_it, $errfile); + local ($save_dir); foreach $file (@files) { $found_it = 0; - foreach $dir (@config_aux_path) + foreach $dir (@require_file_paths) { $fullfile = $dir . "/" . $file; @@ -2692,18 +2609,17 @@ sub require_config_file { $found_it = 1; &push_dist_common ($file) if $dir eq $relative_dir; - - # The first config file found set the config aux path - # for all other files. - @config_aux_path = $dir; - $config_aux_dir = '$(top_srcdir)'; - $config_aux_dir .= '/' . $dir - unless $dir eq '.'; - + $save_dir = $dir; last; } } - if (! $found_it) + + if ($found_it) + { + # Prune the path list. + @require_file_paths = $save_dir; + } + else { if ($strictness >= $mystrict) { @@ -2724,20 +2640,94 @@ sub require_config_file # FIXME this is a hack. Should have am_warn. local ($save) = $exit_status; - &am_error - ("required file \"$errfile\" not found; installing"); + if ($is_configure) + { + &am_conf_line_error + ($line, + "required file \"$errfile\" not found; installing"); + } + else + { + &am_line_error + ($line, + "required file \"$errfile\" not found; installing"); + } $exit_status = $save; } else { # Only an error if strictness constraint violated. - &am_error ("required file \"$errfile\" not found"); + if ($is_configure) + { + &am_conf_line_error + ($line, "required file \"$errfile\" not found"); + } + else + { + &am_line_error + ($line, "required file \"$errfile\" not found"); + } } } } } } +# Like require_file_with_line, but error messages refer to +# configure.in, not the current Makefile.am. +sub require_file_with_conf_line +{ + @require_file_paths = '.'; + &require_file_internal (1, @_); +} + +sub require_file_with_line +{ + @require_file_paths = '.'; + &require_file_internal (0, @_); +} + +sub require_file +{ + @require_file_paths = '.'; + &require_file_internal (0, '', @_); +} + +# Require a file that is also required by Autoconf. Looks in +# configuration path, as specified by AC_CONFIG_AUX_DIR. +sub require_config_file +{ + @require_file_paths = @config_aux_path; + &require_file_internal (0, '', @_); + local ($dir) = $require_file_paths[0]; + @config_aux_path = @require_file_paths; + if ($dir eq '.') + { + $config_aux_dir = '.'; + } + else + { + $config_aux_dir = '$(top_srcdir)/' . $dir; + } +} + +# Assumes that the line number is in configure.in. +sub require_conf_file_with_line +{ + @require_file_paths = @config_aux_path; + &require_file_internal (1, @_); + local ($dir) = $require_file_paths[0]; + @config_aux_path = @require_file_paths; + if ($dir eq '.') + { + $config_aux_dir = '.'; + } + else + { + $config_aux_dir = '$(top_srcdir)/' . $dir; + } +} + ################################################################ # Push a list of files onto dist_common. diff --git a/automake.texi b/automake.texi index 7b4114b3..1a993245 100644 --- a/automake.texi +++ b/automake.texi @@ -417,7 +417,8 @@ version number of the release that is being developed. We recommend that you make @file{configure.in} the only place in your package where the version number is defined; this makes releases simpler. -Automake also requires the use of the macros @code{AC_ARG_PROGRAM} +Automake requires the use of the macro @code{AC_ARG_PROGRAM} if a +program or script is installed. @cvindex AC_ARG_PROGRAM If your package is not a flat distribution, Automake requires the use of diff --git a/lib/am/Makefile.am b/lib/am/Makefile.am index 15ca3c6f..f8ed73e7 100644 --- a/lib/am/Makefile.am +++ b/lib/am/Makefile.am @@ -49,7 +49,8 @@ installcheck-local: # * make sure the scripts don't use 'true' # * expect no instances of '${...}' # These are only really guaranteed to work on my machine. -maintainer-check: automake check +maintainer-check: automake +## Do syntax, etc, checks before make check. $(PERL) -c -w automake @if grep '^[^#].*true' $(srcdir)/[a-z]*.am; then \ echo "can't use 'true' in GNU Makefile" 1>&2; \ @@ -62,6 +63,7 @@ maintainer-check: automake check if $(SHELL) -c 'perl4.036 -v' >/dev/null 2>&1; then \ perl4.036 -c -w automake; \ else :; fi + $(MAKE) check # Tag before making distribution. Also, don't make a distribution if # checks fail. Also, make sure the NEWS file is up-to-date. diff --git a/texi-version.am b/texi-version.am index fdc2dc70..51b9f659 100644 --- a/texi-version.am +++ b/texi-version.am @@ -20,8 +20,8 @@ ## Depend on configure.in so that version number updates cause a ## rebuild. stamp-@VTI@: @TEXI@ $(top_srcdir)/configure.in - echo "@set UPDATED `cd $(srcdir) && $(SHELL) mdate-sh @TEXI@`" \ - > @VTI@.tmp + echo "@set UPDATED `cd $(srcdir) \ + && $(SHELL) @MDDIR@/mdate-sh @TEXI@`" > @VTI@.tmp echo "@set EDITION $(VERSION)" >> @VTI@.tmp echo "@set VERSION $(VERSION)" >> @VTI@.tmp if cmp -s @VTI@.tmp $(srcdir)/@VTEXI@; then \ diff --git a/version.texi b/version.texi index 465dd2d6..221774ae 100644 --- a/version.texi +++ b/version.texi @@ -1,3 +1,3 @@ -@set UPDATED 11 March 1996 +@set UPDATED 28 March 1996 @set EDITION 0.32 @set VERSION 0.32 -- 2.43.5