From e7109e6b366827c4ed47b680b7dc2be867d03ff5 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 8 Feb 1996 02:11:39 +0000 Subject: [PATCH] Many bug fixes --- ChangeLog | 24 ++++++++++++++++++++++++ NEWS | 4 +++- TODO | 18 ++++++------------ automake.in | 44 +++++++++++++++++++++++++++++--------------- automake.texi | 19 +++++-------------- depend.am | 11 ++++++----- lib/am/depend.am | 11 ++++++----- lib/am/subdirs.am | 2 +- subdirs.am | 2 +- 9 files changed, 81 insertions(+), 54 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0bd67ecf..0efde9e5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +Wed Feb 7 18:00:29 1996 Tom Tromey + + * automake.in (handle_source_transform): All dep_files are + relative to $(srcdir). + (handle_libraries): Ditto. + (scan_configure): Test for AC_PROG_INSTALL as well as + fp_PROG_INSTALL. Don't error here. + (seen_prog_install): Now global. + (scripts_installed): New global. + (handle_scripts): Set it. + Give error if appropriate install macro not seen. + (handle_subdirs): Ensure $seen_gettext before requiring + gettext-specific files. + + From Jim Meyering: + * automake.in (handle_source_transform): Use \W when quoting + regexp. When blah_SOURCES not explicitly defined, still create + entry in %deps. + * depend.am ($(srcdir)/.deps/%.P): Don't use \< in regexp. + * subdirs.am (maintainer-clean-recursive): Now depends on + $(CONFIG_HEADER) and Makefile. + + * automake.in (handle_source_transform): Skip macro references. + Mon Feb 5 14:58:58 1996 Tom Tromey * automake.in (handle_texinfo): Include "rm" when deleting files. diff --git a/NEWS b/NEWS index 93399833..78237d82 100644 --- a/NEWS +++ b/NEWS @@ -1,11 +1,13 @@ New in 0.29: -* Bug fixes +* Many bug fixes * More sophisticated configure.in scanning; now understands ALLOCA and LIBOBJS directly, handles AC_CONFIG_HEADER more precisely, etc. * TEXINFOS and MANS now obsolete; use info_TEXINFOS and man_MANS instead. * CONFIG_HEADER variable now obsolete * Can handle multiple Texinfo sources * Allow hierarchies deeper than 2. From Gord Matzigkeit. +* HEADERS variable no longer needed; now can put .h files directly into + foo_SOURCES variable. New in 0.28: * Added --gnu and --gnits options diff --git a/TODO b/TODO index d506d283..b4259685 100644 --- a/TODO +++ b/TODO @@ -8,6 +8,8 @@ Top priorities: Handle MAINT_CHARSET. Use recode in dist target. Handle dist-zoo and dist-zip. +If AC_PATH_X given, add extra stuff to generated Makefile.in. + Add support for html via an option. Use texi2html. Use "html_TEXINFOS", and htmldir = .../html. Include html files in distribution. Also allow "html_DATA", for raw .html files. @@ -20,6 +22,8 @@ uninstall and pkg-dirs should rm -rf the dir. a potential bug: configure puts "blah.o" into LIBOBJS, thus implying these files can't be de-ansified. Not a problem? +consider automatically adding -I$(srcdir) to INCLUDES. + In general most .am files should be merged into automake. For instance all the "clean" targets could be merged by keeping lists of things to be removed. This would be a lot nicer looking. Note that @@ -57,10 +61,6 @@ Should 'distclean' remove $(SCRIPTS)? 'maintainer-clean' should "rm -rf .deps". Ditto distclean Should look for clean-local targets in Makefile.am. -If 'foo' is in SCRIPTS, and 'foo.in' exists, generate code to rebuild -by running configure. Also, ensure that 'foo' is listed in AC_OUTPUT -line. - Think about writing a small tool to guess what the local Makefile.am should look like. @@ -80,8 +80,8 @@ right, but maybe it is so names can be rewritten uniformly? Must check look in configure.in's AC_OUTPUT command and include those files in -distribution. Or consider new CONFIGURED_FILES macro that lists files -generated by config.status. +distribution. Make sure to support the ":" notation. automatically +regenerate all files listed in AC_OUTPUT line. Auto-distribute "ChangeLog.[0-9]+"? @@ -121,12 +121,6 @@ would be equivalent to: foo_SOURCES = a.c b.c Is this worth implementing? -Get the list of Makefiles to create from configure.in AC_OUTPUT -if none are given. - [ right now we look for any Makefile.am's lying around - I think this is better, because it allows use of subdirs - which don't use automake -- eg, stuff from gettext ] - Should libexec programs have the name transform done on them? Order the output rules sensibly, so FOO_SOURCES and FOO_OBJECTS are diff --git a/automake.in b/automake.in index 56e68094..9f998ba3 100755 --- a/automake.in +++ b/automake.in @@ -97,6 +97,12 @@ $seen_make_set = 0; # Whether ud_GNU_GETTEXT has been seen in configure.in. $seen_gettext = 0; +# 1 if AC_PROG_INSTALL seen, 2 if fp_PROG_INSTALL seen. +$seen_prog_install = 0; + +# 1 if any scripts installed, 0 otherwise. +$scripts_installed = 0; + &initialize_global_constants; @@ -123,6 +129,10 @@ foreach $am_file (@input_files) } } +&am_conf_error ($scripts_installed ? 'fp_PROG_INSTALL' : 'AC_PROG_INSTALL' + . " must be used in configure.in") + unless $seen_prog_install > $scripts_installed; + exit $exit_status; @@ -369,7 +379,7 @@ sub handle_source_transform { local ($one_file, $obj) = @_; local ($objpat) = $obj; - $objpat =~ s/([.\$])/\\\1/g; + $objpat =~ s/(\W)/\\\1/g; # Look for file_SOURCES and file_OBJECTS. if (defined $contents{$one_file . "_SOURCES"}) @@ -381,8 +391,11 @@ sub handle_source_transform local (@result) = (); foreach (@files) { - # Just skip header files. + # Skip header files. next if /\.h$/; + # Skip things that look like macro references. + next if /^\$\(.*\)$/; + next if /^\$\{.*\}$/; if (/^(.*)\.[yl]$/) { @@ -399,7 +412,7 @@ sub handle_source_transform # Transform .o or $o file into .P file (for automatic # dependency code). s/$objpat$/.P/g; - $dep_files{'.deps/' . $_} = 1; + $dep_files{'$(srcdir)/.deps/' . $_} = 1; } &pretty_print ($one_file . "_OBJECTS =", '', @result); @@ -419,6 +432,7 @@ sub handle_source_transform . $obj . "\n"); push (@sources, $one_file . '.c'); push (@objects, $one_file . $obj); + $dep_files{'$(srcdir)/.deps/' . $one_file . '.P'} = 1; } if (defined $contents{'CONFIG_HEADER'}) @@ -507,7 +521,7 @@ sub handle_libraries if ($iter ne 'alloca.c') { ($rewrite = $iter) =~ s/\.c$/.P/; - $dep_files{'.deps/' . $rewrite} = 1; + $dep_files{'$(srcdir)/.deps/' . $rewrite} = 1; &require_file ($NORMAL, $iter); } } @@ -516,7 +530,7 @@ sub handle_libraries { &am_error ("\@ALLOCA\@ seen but \`AC_FUNC_ALLOCA' not in \`configure.in'") if ! defined $libsources{'alloca.c'}; - $dep_files{'.deps/alloca.P'} = 1; + $dep_files{'$(srcdir)/.deps/alloca.P'} = 1; &require_file ($NORMAL, 'alloca.c'); } } @@ -548,9 +562,11 @@ sub handle_libraries # Handle scripts. sub handle_scripts { - &am_install_var ('-clean', - 'scripts', 'SCRIPTS', - 'bin', 'sbin', 'libexec', 'noinst'); + # FIXME can't determine if these scripts are really being + # installed or not. + $scripts_installed = &am_install_var ('-clean', + 'scripts', 'SCRIPTS', + 'bin', 'sbin', 'libexec', 'noinst'); } # Search a file for a "version.texi" Texinfo include. Return the name @@ -1018,12 +1034,12 @@ sub handle_subdirs &am_conf_error ("ud_GNU_GETTEXT in configure.in but \`po' not in SUBDIRS") - if $contents{'SUBDIRS'} !~ /\bpo\b/; + if $seen_gettext && $contents{'SUBDIRS'} !~ /\bpo\b/; &am_conf_error ("ud_GNU_GETTEXT in configure.in but \`intl' not in SUBDIRS") - if $contents{'SUBDIRS'} !~ /\bintl\b/; + if $seen_gettext && $contents{'SUBDIRS'} !~ /\bintl\b/; - &require_file ($NORMAL, 'ABOUT-NLS'); + &require_file ($NORMAL, 'ABOUT-NLS') if $seen_gettext; return if ! defined $contents{'SUBDIRS'}; @@ -1401,7 +1417,6 @@ sub scan_configure %libsources = (); local ($in_ac_output, @make_list) = 0; - local ($seen_prog_install) = 0; local ($seen_arg_prog) = 0; local ($seen_canonical) = 0; while () @@ -1498,7 +1513,8 @@ sub scan_configure # we only really require AC_ARG_PROGRAM if any program is # installed. $seen_make_set = 1 if /AC_PROG_MAKE_SET/; - $seen_prog_install = 1 if /fp_PROG_INSTALL/; + $seen_prog_install = 1 if ! $seen_prog_install && /AC_PROG_INSTALL/; + $seen_prog_install = 2 if ! $seen_prog_install && /fp_PROG_INSTALL/; $seen_arg_prog = 1 if /AC_ARG_PROGRAM/; } @@ -1510,8 +1526,6 @@ sub scan_configure &require_file ($NORMAL, 'config.guess', 'config.sub') if $seen_canonical; - &am_conf_error ("fp_PROG_INSTALL must be used in configure.in") - unless $seen_prog_install; &am_conf_error ("AC_ARG_PROGRAM must be used in configure.in") unless $seen_arg_prog; diff --git a/automake.texi b/automake.texi index 3492e90f..cd31b476 100644 --- a/automake.texi +++ b/automake.texi @@ -180,17 +180,6 @@ AC_SUBST(PACKAGE) AC_SUBST(VERSION) @end example -If your @file{configure.in} uses @samp{AC_CONFIG_HEADER}, then in each -directory you should define the @samp{CONFIG_HEADER} variable to hold -the name of the header. - -For instance, in cpio's @file{src/Makefile.am}, we see: - -@example -CONFIG_HEADER = ../config.h -@end example - - @code{automake} also assumes that your @file{configure} script will define the variable @samp{INSTALL_SCRIPT}. Until this is incorporated in @code{autoconf}'s @samp{AC_PROG_INSTALL} macro, you can use this @@ -209,6 +198,8 @@ AC_SUBST(INSTALL_SCRIPT)dnl ]) @end example +@code{automake} requires this macro if you install any scripts. +Otherwise only @code{AC_PROG_INSTALL} is required. @code{automake} also assumes your @file{configure.in} calls @samp{AC_ARG_PROGRAM}. @@ -310,11 +301,11 @@ PROGRAMS = hello In this simple case, the resulting @file{Makefile.in} will contain code to generate a program named @code{hello}. The variable -@samp{@var{prog}_SOURCE} is used to specify which source files get built +@samp{@var{prog}_SOURCES} is used to specify which source files get built into an executable: @example -hello_SOURCE = hello.c +hello_SOURCES = hello.c @end example This causes @file{hello.o} to be built from @code{hello.c} at compile @@ -322,7 +313,7 @@ time, and then linked into @file{hello}. Multiple programs can be built in a single directory -- simply list them all in the @samp{PROGRAMS} definition. Multiple programs can share a -single source file. The source file must be listed in each ``_SOURCE'' +single source file. The source file must be listed in each ``_SOURCES'' definition. Sometimes it is useful to determine the programs that are to be built at diff --git a/depend.am b/depend.am index c596cc32..18d2d392 100644 --- a/depend.am +++ b/depend.am @@ -36,11 +36,12 @@ $(DEP_FILES): $(srcdir)/.deps/.P $(srcdir)/.deps/%.P: $(srcdir)/%.c @echo "mkdeps $< > $@" -## Need \< in regexp because otherwise when srcdir=. too much can be -## matched. Also we regexp-quote srcdir because "." is a matching -## operator, and commonly appears in filenames. - @re=`echo 's,\<$(srcdir),,g' | sed 's/\./\\./g'`; \ - $(MKDEP) $< | sed $$re > $@-tmp +## Use funny regexp because otherwise too much can be matched when +## srcdir begins with ".". Can't use \< since sed doesn't recognize +## "." as a word start. Regexp-quote srcdir because "." is a matching +## operator which commonly appears in filenames. + @re=`echo 's,^$(srcdir)/*,,g;s, $(srcdir)/*, ,g' | sed 's,\.,\\\\.,g'`; \ + $(MKDEP) $< | sed "$$re" > $@-tmp @if test -n "$o"; then \ sed 's/\.o:/$$o:/' $@-tmp > $@; \ rm $@-tmp; \ diff --git a/lib/am/depend.am b/lib/am/depend.am index c596cc32..18d2d392 100644 --- a/lib/am/depend.am +++ b/lib/am/depend.am @@ -36,11 +36,12 @@ $(DEP_FILES): $(srcdir)/.deps/.P $(srcdir)/.deps/%.P: $(srcdir)/%.c @echo "mkdeps $< > $@" -## Need \< in regexp because otherwise when srcdir=. too much can be -## matched. Also we regexp-quote srcdir because "." is a matching -## operator, and commonly appears in filenames. - @re=`echo 's,\<$(srcdir),,g' | sed 's/\./\\./g'`; \ - $(MKDEP) $< | sed $$re > $@-tmp +## Use funny regexp because otherwise too much can be matched when +## srcdir begins with ".". Can't use \< since sed doesn't recognize +## "." as a word start. Regexp-quote srcdir because "." is a matching +## operator which commonly appears in filenames. + @re=`echo 's,^$(srcdir)/*,,g;s, $(srcdir)/*, ,g' | sed 's,\.,\\\\.,g'`; \ + $(MKDEP) $< | sed "$$re" > $@-tmp @if test -n "$o"; then \ sed 's/\.o:/$$o:/' $@-tmp > $@; \ rm $@-tmp; \ diff --git a/lib/am/subdirs.am b/lib/am/subdirs.am index 85c037a6..a335ab6c 100644 --- a/lib/am/subdirs.am +++ b/lib/am/subdirs.am @@ -28,7 +28,7 @@ all-recursive install-data-recursive install-exec-recursive \ installdirs-recursive install-recursive uninstall-recursive \ check-recursive installcheck-recursive info-recursive dvi-recursive \ mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: +maintainer-clean-recursive: $(CONFIG_HEADER) Makefile for subdir in $(SUBDIRS); do \ target=`echo $@ | sed s/-recursive//`; \ echo making $$target in $$subdir; \ diff --git a/subdirs.am b/subdirs.am index 85c037a6..a335ab6c 100644 --- a/subdirs.am +++ b/subdirs.am @@ -28,7 +28,7 @@ all-recursive install-data-recursive install-exec-recursive \ installdirs-recursive install-recursive uninstall-recursive \ check-recursive installcheck-recursive info-recursive dvi-recursive \ mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: +maintainer-clean-recursive: $(CONFIG_HEADER) Makefile for subdir in $(SUBDIRS); do \ target=`echo $@ | sed s/-recursive//`; \ echo making $$target in $$subdir; \ -- 2.43.5