From 293f0a04096fa52e88545f31f7c36bac6eb77d43 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sat, 10 Aug 1996 23:15:36 +0000 Subject: [PATCH] ansi2knr rework. strtod fix. aclocal fixes --- ChangeLog | 21 +++++++++++++++++++++ Makefile.am | 2 +- Makefile.in | 4 ++-- NEWS | 1 + TODO | 6 ------ aclocal.in | 31 ++++++++++++++++++++++++------- automake.in | 32 ++++++++++++++++++++++++++------ automake.texi | 26 +++++++++++++------------- kr-vars.am => kr-extra.am | 15 +++++++++++++-- lib/am/Makefile.am | 2 +- tests/ChangeLog | 6 ++++++ tests/Makefile.am | 2 +- tests/Makefile.in | 4 ++-- tests/defun.test | 13 +++++++++++++ tests/dup.test | 16 ++++++++++++++++ tests/mkinstall2.test | 3 ++- version.texi | 2 +- 17 files changed, 143 insertions(+), 43 deletions(-) rename kr-vars.am => kr-extra.am (81%) create mode 100755 tests/defun.test create mode 100755 tests/dup.test diff --git a/ChangeLog b/ChangeLog index 9441717..ec8e77c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +Sat Aug 10 10:29:30 1996 Tom Tromey + + * aclocal.in (macro_seen): New global. + (add_file): Set macro_seen entry. Only push required macro on + @rlist if not already seen. Test defun.test. + + * automake.in (get_object_extension): Handle directory prefix on + `ansi2knr' option. + + * kr-extra.am: New file. + + * kr-vars.am: Removed. + + * automake.in (handle_options): Handle directory prefix on + `ansi2knr' option. + + * automake.in (scan_configure): Recognize AM_FUNC_STRTOD. + + * aclocal.in (add_file): Error if macro is duplicated. Test + dup.test. + Fri Aug 9 09:18:46 1996 Tom Tromey * automake.in (handle_programs): Substitute @XLINK@. Make sure diff --git a/Makefile.am b/Makefile.am index a0dde7f..f27786c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -13,7 +13,7 @@ info_TEXINFOS = automake.texi pkgdata_DATA = clean-kr.am clean.am compile-kr.am compile-vars.am \ compile.am data.am dejagnu.am depend.am dist-vars.am footer.am \ -header.am header-vars.am kr-vars.am libraries.am library.am \ +header.am header-vars.am kr-extra.am libraries.am library.am \ mans-vars.am program.am programs.am remake-hdr.am remake-subd.am \ remake.am scripts.am subdirs.am tags.am tags-subd.am tags-clean.am \ texi-version.am texinfos-vars.am texinfos.am libraries-clean.am \ diff --git a/Makefile.in b/Makefile.in index 588b739..3935c33 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated automatically by automake 1.1b from Makefile.am +# Makefile.in generated automatically by automake 1.1c from Makefile.am # Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation @@ -51,7 +51,7 @@ info_TEXINFOS = automake.texi pkgdata_DATA = clean-kr.am clean.am compile-kr.am compile-vars.am \ compile.am data.am dejagnu.am depend.am dist-vars.am footer.am \ -header.am header-vars.am kr-vars.am libraries.am library.am \ +header.am header-vars.am kr-extra.am libraries.am library.am \ mans-vars.am program.am programs.am remake-hdr.am remake-subd.am \ remake.am scripts.am subdirs.am tags.am tags-subd.am tags-clean.am \ texi-version.am texinfos-vars.am texinfos.am libraries-clean.am \ diff --git a/NEWS b/NEWS index d2f5b42..02d139f 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,7 @@ New in 1.1b: * Included `aclocal' program * Automake will now generate rules to regenerate aclocal.m4, if appropriate * Now uses `AM_' macro names everywhere +* ansi2knr option can have directory prefix (eg `../lib/ansi2knr') New in 1.0: * Bug fixes diff --git a/TODO b/TODO index 33b146f..efee476 100644 --- a/TODO +++ b/TODO @@ -147,12 +147,6 @@ Omit program transform vars from header if no program installed. This is currently pretty hard to do. (But with beautification code it would probably be easy) -It should be possible to have ansi2knr in just one place in a package. -Jim Meyering says just rely on configure to make links as appropriate. -Maybe introduce syntax like this: - AUTOMAKE_OPTIONS = ../ansi2knr -? Consider putting it into AC_CONFIG_AUX_DIR - Lex, yacc support: * It would be nice to automatically support using bison's better features to rename the output files. This requires autoconf support diff --git a/aclocal.in b/aclocal.in index 457c777..4180c34 100644 --- a/aclocal.in +++ b/aclocal.in @@ -24,6 +24,9 @@ $output = ''; # Output file name. $output_file = 'aclocal.m4'; +# Which macros have been seen. +%macro_seen = (); + # Which files have been seen. %file_seen = (); @@ -44,12 +47,13 @@ $verbosity = 0; 'fp_WITH_REGEX', 'gm_PROG_LIBTOOL', 'jm_MAINTAINER_MODE', - 'md_PATH_PROG', - 'md_TYPE_PTRDIFF_T', - 'ud_GNU_GETTEXT', - 'ud_LC_MESSAGES', - 'ud_PATH_LISPDIR', - 'ud_WITH_NLS' +# These aren't quite obsolete. +# 'md_PATH_PROG', +# 'md_TYPE_PTRDIFF_T', +# 'ud_GNU_GETTEXT', +# 'ud_LC_MESSAGES', +# 'ud_PATH_LISPDIR', +# 'ud_WITH_NLS' ); $obsolete_rx = '(' . join ('|', @obsolete_macros) . ')'; @@ -211,10 +215,23 @@ sub add_file while () { $output .= $_; + + # See if we're defining a macro that was already seen. This + # is mostly a special case for `acinclude.m4'. + if (/AC_DEFUN\(\[?([^])]*)\]?/) + { + if ($1 ne $file && $file_seen{$1}) + { + warn "$fullfile: $.: duplicated macro \`$1'\n"; + $exit_status = 1; + } + $macro_seen{$1} = 1; + } + # See if some other macro is required. if (/AC_REQUIRE\(\[?([^])]*)\]?\)/) { - push (@rlist, $1); + push (@rlist, $1) unless defined $macro_seen{$1}; } } $output .= "\n"; diff --git a/automake.in b/automake.in index 553df4f..7f21d18 100755 --- a/automake.in +++ b/automake.in @@ -456,10 +456,16 @@ sub handle_options { &set_strictness ($_); } - elsif ($_ eq 'no-installman' || $_ eq 'ansi2knr' + elsif (/ansi2knr/) + { + # An option like "../lib/ansi2knr" is allowed. With no + # path prefix, we assume the required programs are in this + # directory. We save the actual option for later. + $options{'ansi2knr'} = $_; + } + elsif ($_ eq 'no-installman' || $_ eq 'no-installinfo' || $_ eq 'dist-shar' || $_ eq 'dist-zip' - || $_ eq 'dist-tarZ' || $_ eq 'dejagnu' - || $_ eq 'no-installinfo') + || $_ eq 'dist-tarZ' || $_ eq 'dejagnu') { # Explicitly recognize these. } @@ -536,10 +542,20 @@ sub get_object_extension $dir_holds_sources = '$o'; push (@suffixes, '._c', '._o'); - &require_file_with_line ('AUTOMAKE_OPTIONS', $FOREIGN, - 'ansi2knr.c', 'ansi2knr.1'); + # Only require ansi2knr files if they should appear in + # this directory. + if ($options{'ansi2knr'} eq 'ansi2knr') + { + &require_file_with_line ('AUTOMAKE_OPTIONS', $FOREIGN, + 'ansi2knr.c', 'ansi2knr.1'); + $output_rules .= &file_contents ('kr-extra'); + push (@clean, 'krextra'); + &push_phony_cleaners ('krextra'); + } + + $output_vars .= "o = .\@U\@o\n"; + $output_vars .= "ANSI2KNR = " . $options{'ansi2knr'} . "\n"; - $output_vars .= &file_contents ('kr-vars'); $output_rules .= &file_contents ('compile-kr'); $output_rules .= &file_contents ('clean-kr'); @@ -2286,6 +2302,10 @@ sub scan_configure $libsources{'getopt.c'} = 1; $libsources{'getopt1.c'} = 1; } + elsif (/AM_FUNC_STRTOD/) + { + $libsources{'strtod.c'} = 1; + } elsif (/LIBOBJS="(.*)\s+\$LIBOBJS"/ || /LIBOBJS="\$LIBOBJS\s+(.*)"/) { diff --git a/automake.texi b/automake.texi index bcdcf36..52bcdeb 100644 --- a/automake.texi +++ b/automake.texi @@ -472,8 +472,9 @@ exist. @item AC_FUNC_GETLOADAVG @item AC_FUNC_MEMCMP @item AC_STRUCT_ST_BLOCKS -@item fp_FUNC_FNMATCH +@item AM_FUNC_FNMATCH @item AC_FUNC_FNMATCH +@item AM_FUNC_STRTOD @item AC_REPLACE_FUNCS @item AC_REPLACE_GNU_GETOPT Automake will ensure that the appropriate source files are part of the @@ -484,10 +485,11 @@ information. @cvindex AC_FUNC_GETLOADAVG @cvindex AC_FUNC_MEMCMP @cvindex AC_STRUCT_ST_BLOCKS -@cvindex fp_FUNC_FNMATCH +@cvindex AM_FUNC_FNMATCH @cvindex AC_FUNC_FNMATCH @cvindex AC_REPLACE_FUNCS @cvindex AC_REPLACE_GNU_GETOPT +@cvindex AM_FUNC_STRTOD Automake will also detect statements which put @samp{.o} files into @code{LIBOBJS}, and will treat these additional files in a similar way. @@ -498,12 +500,15 @@ This is required if any libraries are built in the package. @cvindex AC_PROG_RANLIB @item AC_PROG_INSTALL -@item fp_PROG_INSTALL -@code{fp_PROG_INSTALL} is required if any scripts (@pxref{Scripts}) are +@item AM_PROG_INSTALL + +@code{AM_PROG_INSTALL} is required if any scripts (@pxref{Scripts}) are installed by the package. Otherwise, @code{AC_PROG_INSTALL} is -required. +required. @code{AM_INIT_AUTOMAKE} automatically calls +@code{AM_PROG_INSTALL}. @cvindex AC_PROG_INSTALL -@cvindex fp_PROG_INSTALL +@cvindex AM_PROG_INSTALL +@cvindex AM_INIT_AUTOMAKE @item AM_PROG_LIBTOOL Automake will turn on processing for @code{libtool} (@pxref{Top, , The @@ -518,9 +523,9 @@ will check the @file{po} directory to ensure that all the named named. @cvindex ALL_LINGUAS -@item fp_C_PROTOTYPES +@item AM_C_PROTOTYPES This is required when using automatic de-ANSI-fication, see @ref{ANSI}. -@cvindex fp_C_PROTOTYPES +@cvindex AM_C_PROTOTYPES @item ud_GNU_GETTEXT This macro is required for packages which use GNU gettext (FIXME xref). @@ -536,11 +541,6 @@ This macro adds a @samp{--enable-maintainer-mode} option to @cvindex jm_MAINTAINER_MODE @end table -The @samp{fp_} macros are from @value{Francois} Pinard, the @samp{jm_} -macro is from Jim Meyering, and the @samp{ud_} macro is from Ulrich -Drepper.. Both sets are included with Automake. @code{automake} will -tell where the macros can be found if they are missing. - @node Top level @chapter The top-level @file{Makefile.am} diff --git a/kr-vars.am b/kr-extra.am similarity index 81% rename from kr-vars.am rename to kr-extra.am index 2102715..cf4fab4 100644 --- a/kr-vars.am +++ b/kr-extra.am @@ -15,5 +15,16 @@ ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA ## 02111-1307, USA. -ANSI2KNR = @ANSI2KNR@ -o = .@U@o +ansi2knr: ansi2knr.o + $(LINK) ansi2knr.o $(LIBS) + +ansi2knr.o: $(CONFIG_HEADER) + +mostlyclean-krextra: + +clean-krextra: + +distclean-krextra: + rm -f ansi2knr + +maintainer-clean-krextra: diff --git a/lib/am/Makefile.am b/lib/am/Makefile.am index a0dde7f..f27786c 100644 --- a/lib/am/Makefile.am +++ b/lib/am/Makefile.am @@ -13,7 +13,7 @@ info_TEXINFOS = automake.texi pkgdata_DATA = clean-kr.am clean.am compile-kr.am compile-vars.am \ compile.am data.am dejagnu.am depend.am dist-vars.am footer.am \ -header.am header-vars.am kr-vars.am libraries.am library.am \ +header.am header-vars.am kr-extra.am libraries.am library.am \ mans-vars.am program.am programs.am remake-hdr.am remake-subd.am \ remake.am scripts.am subdirs.am tags.am tags-subd.am tags-clean.am \ texi-version.am texinfos-vars.am texinfos.am libraries-clean.am \ diff --git a/tests/ChangeLog b/tests/ChangeLog index fa6bd1e..1b10f90 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,9 @@ +Sat Aug 10 10:09:45 1996 Tom Tromey + + * defun.test: New file. + + * dup.test: New file. + Fri Aug 9 09:18:07 1996 Tom Tromey * canon4.test: New file. diff --git a/tests/Makefile.am b/tests/Makefile.am index cccbc9d..3994ee5 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -12,6 +12,6 @@ insh2.test outdir.test fpinstall.test fpinst2.test texinfo.test dejagnu.test \ yacc.test mkinstall2.test texinfo2.test ansi.test depacl.test depacl2.test \ 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 +exsource.test canon4.test dup.test defun.test EXTRA_DIST = defs $(TESTS) diff --git a/tests/Makefile.in b/tests/Makefile.in index 9db317b..8ba411d 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated automatically by automake 1.1b from Makefile.am +# Makefile.in generated automatically by automake 1.1c from Makefile.am # Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation @@ -50,7 +50,7 @@ insh2.test outdir.test fpinstall.test fpinst2.test texinfo.test dejagnu.test \ yacc.test mkinstall2.test texinfo2.test ansi.test depacl.test depacl2.test \ 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 +exsource.test canon4.test dup.test defun.test EXTRA_DIST = defs $(TESTS) mkinstalldirs = $(top_srcdir)/mkinstalldirs diff --git a/tests/defun.test b/tests/defun.test new file mode 100755 index 0000000..dae8540 --- /dev/null +++ b/tests/defun.test @@ -0,0 +1,13 @@ +#! /bin/sh + +# Make sure aclocal picks up on all macro definitions. + +. $srcdir/defs || exit 1 + +cat > acinclude.m4 << 'END' +AC_DEFUN([AM_FUNC_TWO],) +AC_DEFUN([AM_FUNC_STRTOD], +AC_REQUIRE([AM_FUNC_TWO])) +END + +$ACLOCAL diff --git a/tests/dup.test b/tests/dup.test new file mode 100755 index 0000000..e873839 --- /dev/null +++ b/tests/dup.test @@ -0,0 +1,16 @@ +#! /bin/sh + +# Make sure aclocal catches duplicate definitions in acinclude.m4. + +. $srcdir/defs || exit 1 + +cat > configure.in << 'END' +AM_FUNC_STRTOD +END + +cat > acinclude.m4 << 'END' +AC_DEFUN([AM_FUNC_STRTOD]) +END + +$ACLOCAL && exit 1 +exit 0 diff --git a/tests/mkinstall2.test b/tests/mkinstall2.test index 4d64b2e..bda84a2 100755 --- a/tests/mkinstall2.test +++ b/tests/mkinstall2.test @@ -19,4 +19,5 @@ chmod +x mkinstalldirs $AUTOMAKE || exit 1 -make -s -f Makefile.in installdirs | grep -v man +(make -s -f Makefile.in installdirs | grep man) && exit 1 +exit 0 diff --git a/version.texi b/version.texi index 262db4f..5321dba 100644 --- a/version.texi +++ b/version.texi @@ -1,3 +1,3 @@ -@set UPDATED 4 August 1996 +@set UPDATED 10 August 1996 @set EDITION 1.1c @set VERSION 1.1c -- 2.7.4