From: Paul Eggert Date: Wed, 17 Jul 2002 08:30:42 +0000 (+0000) Subject: 2002-07-17 Mark D. Roth X-Git-Tag: AUTOCONF-2.53b~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=66d5f073b51090ee302c08033181fc56bbcd2b7b;p=thirdparty%2Fautoconf.git 2002-07-17 Mark D. Roth * configure.ac: Add --enable-site-macro-dir option. * bin/Makefile.am: Expand @SITE_MACRO_DIR@. * bin/autom4te.in: Add --prepend-include, --include-envvar, and --site-macro-subdir options. * bin/autoconf.in: Add --prepend-include option. * bin/autoheader.in: Add --prepend-include option. * bin/autoreconf.in: Add --prepend-include option. * bin/autoscan.in: Add --prepend-include option. * bin/autoupdate.in: Add --prepend-include option. * doc/autoconf.texi: Document use of $AC_MACRO_PATH and site macro directory, remove note that include path directories are used in reverse order, and document --prepend-include option. * lib/autom4te.in: Use --prepend-include instead of --include. * tests/wrapsh.in: Use --prepend-include instead of --include. --- diff --git a/ChangeLog b/ChangeLog index 4094bb428..307ac0b4d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2002-07-17 Mark D. Roth + + * configure.ac: Add --enable-site-macro-dir option. + * bin/Makefile.am: Expand @SITE_MACRO_DIR@. + * bin/autom4te.in: Add --prepend-include, --include-envvar, and + --site-macro-subdir options. + * bin/autoconf.in: Add --prepend-include option. + * bin/autoheader.in: Add --prepend-include option. + * bin/autoreconf.in: Add --prepend-include option. + * bin/autoscan.in: Add --prepend-include option. + * bin/autoupdate.in: Add --prepend-include option. + * doc/autoconf.texi: Document use of $AC_MACRO_PATH and site + macro directory, remove note that include path directories are + used in reverse order, and document --prepend-include option. + * lib/autom4te.in: Use --prepend-include instead of --include. + * tests/wrapsh.in: Use --prepend-include instead of --include. + 2002-07-17 Akim Demaille * lib/autoconf/general.m4 (_AC_INIT_PACKAGE): `_' is allowed in diff --git a/bin/Makefile.am b/bin/Makefile.am index 16ec64c57..ee77975a9 100644 --- a/bin/Makefile.am +++ b/bin/Makefile.am @@ -45,7 +45,8 @@ edit = sed \ -e 's,@M4\@,$(M4),g' \ -e 's,@AWK\@,$(AWK),g' \ -e 's,@VERSION\@,$(VERSION),g' \ - -e 's,@PACKAGE_NAME\@,$(PACKAGE_NAME),g' + -e 's,@PACKAGE_NAME\@,$(PACKAGE_NAME),g' \ + -e 's,@SITE_MACRO_DIR\@,$(SITE_MACRO_DIR),g' # autoconf is written in M4sh. AUTOM4SH = $(top_builddir)/tests/autom4te --language M4sh diff --git a/bin/autoconf.in b/bin/autoconf.in index 7f36a4587..a433838af 100644 --- a/bin/autoconf.in +++ b/bin/autoconf.in @@ -107,7 +107,8 @@ Operation modes: -V, --version print version number, then exit -v, --verbose verbosely report processing -d, --debug don't remove temporary files - -I, --include=DIR look for input files in DIR (cumulative) + -B, --prepend-include=DIR prepend directory DIR to search path + -I, --include=DIR append directory DIR to search path -f, --force consider all files obsolete -o, --output=FILE save output in FILE (stdout is the default) -W, --warnings=CATEGORY report the warnings falling in CATEGORY [syntax] @@ -195,11 +196,13 @@ while test $# -gt 0 ; do --debug | -d | \ --force | -f | \ --include=* | -I?* | \ + --prepend-include=* | -B?* | \ --warnings=* | -W?* ) AUTOM4TE="$AUTOM4TE $1"; shift ;; # Options with separated arg passed as is to autom4te. --include | -I | \ + --prepend-include | -B | \ --warnings | -W ) test $# = 1 && eval "$exit_missing_arg" AUTOM4TE="$AUTOM4TE $option $2" diff --git a/bin/autoheader.in b/bin/autoheader.in index 5187fb462..0a3f24f9f 100644 --- a/bin/autoheader.in +++ b/bin/autoheader.in @@ -44,6 +44,7 @@ use vars qw ($config_h %verbatim %symbol); my $autom4te = $ENV{'AUTOM4TE'} || '@bindir@/@autom4te-name@'; local $config_h; my $config_h_in; +my @prepend_include; my @include; my @warning; @@ -72,7 +73,8 @@ Warning categories include: \`error\' warnings are error Library directories: - -I, --include=DIR look for files in DIR (cumulative) + -B, --prepend-include=DIR prepend directory DIR to search path + -I, --include=DIR append directory DIR to search path Report bugs to . END @@ -103,6 +105,7 @@ sub parse_args () my $srcdir; getopt ('I|include|A|autoconf-dir|m|macrodir|l|localdir=s' => \@include, + 'B|prepend-include=s' => \@prepend_include, 'W|warning=s' => \@warning); if (! @ARGV) @@ -123,9 +126,12 @@ mktmpdir ('ah'); parse_args; # Preach. -my $config_h_top = find_file ("config.h.top?", @include); -my $config_h_bot = find_file ("config.h.bot?", @include); -my $acconfig_h = find_file ("acconfig.h?", @include); +my $config_h_top = find_file ("config.h.top?", + reverse(@prepend_include), @include); +my $config_h_bot = find_file ("config.h.bot?", + reverse(@prepend_include), @include); +my $acconfig_h = find_file ("acconfig.h?", + reverse(@prepend_include), @include); if ($config_h_top || $config_h_bot || $acconfig_h) { my $msg = << "END"; @@ -150,6 +156,7 @@ END # Set up autoconf. my $autoconf = "$autom4te --language=autoconf "; $autoconf .= join (' ', map { "--include=$_" } @include); +$autoconf .= join (' ', map { "--prepend-include=$_" } @prepend_include); $autoconf .= ' --debug' if $debug; $autoconf .= ' --force' if $force; $autoconf .= ' --verbose' if $verbose; diff --git a/bin/autom4te.in b/bin/autom4te.in index 11973d6c4..90d377bf8 100644 --- a/bin/autom4te.in +++ b/bin/autom4te.in @@ -389,7 +389,8 @@ Warning categories include: The environment variable \`WARNINGS\' is honored. Library directories: - -I, --include=DIR look for FILES in DIR (cumulative) + -B, --prepend-include=DIR prepend directory DIR to search path + -I, --include=DIR append directory DIR to search path Tracing: -t, --trace=MACRO report the MACRO invocations @@ -484,6 +485,9 @@ sub parse_args () # Process the arguments for real this time. my @trace; + my @prepend_include; + my $include_envvar; + my @site_macro_subdirs; getopt ( # Operation modes: @@ -493,7 +497,10 @@ sub parse_args () "M|melt" => \$melt, # Library directories: + "B|prepend-include=s" => \@prepend_include, "I|include=s" => \@include, + "include-envvar=s" => \$include_envvar, + "site-macro-subdir=s" => \@site_macro_subdirs, # Tracing: # Using a hash for traces is seducing. Unfortunately, upon `-t FOO', @@ -521,11 +528,19 @@ Try `$me --help' for more information.\n" $melt = 1 if $freeze; + # Add directories from the appropriate env var to the include path. + @include = (@include, split(/:/, $ENV{$include_envvar})) + if defined($include_envvar) && exists($ENV{$include_envvar}); + + # Also add the site macro directory, if applicable. + map { @include = (@include, "@SITE_MACRO_DIR@/$_"); } @site_macro_subdirs + if ('@SITE_MACRO_DIR@' ne 'no') && @site_macro_subdirs; + # Normalize the includes: the first occurrence is enough, several is # a pain since it introduces a useless difference in the path which # invalidates the cache. And strip `.' which is implicit and always # first. - @include = grep { !/^\.$/ } uniq (@include); + @include = grep { !/^\.$/ } uniq (reverse(@prepend_include), @include); # Convert @trace to %trace, and work around the M4 builtins tracing # problem. @@ -599,13 +614,10 @@ sub handle_m4 ($@) # # Neutralize its stdin, so that GNU M4 1.5 doesn't neutralize SIGINT. # - # Be extremely cautious to reverse the includes when talking to M4: - # it doesn't speak the same --include as we do. - # # We don't output directly to the cache files, to avoid problems # when we are interrupted (that leaves corrupted files). my $command = ("$m4" - . join (' --include=', '', reverse @include) + . join (' --include=', '', @include) . " --define=m4_warnings=$m4_warnings" . ' --debug=aflq' . " --error-output=$tcache" . $req->id . "t" @@ -1056,7 +1068,7 @@ sub freeze ($) # output but comments and empty lines. my $command = ("$m4" . ' --fatal-warning' - . join (' --include=', '', reverse @include) + . join (' --include=', '', @include) . ' --define=divert' . " @ARGV" . ' \@include, + 'B|prepend-include=s' => \@prepend_include, 'i|install' => \$install, 's|symlink' => \$symlink); @@ -145,7 +148,9 @@ sub parse_args () # Dispatch autoreconf's option to the tools. # --include; $autoconf .= join (' --include=', '', @include); + $autoconf .= join (' --prepend-include=', '', @prepend_include); $autoheader .= join (' --include=', '', @include); + $autoheader .= join (' --prepend-include=', '', @prepend_include); # --install and --symlink; if ($install) diff --git a/bin/autoscan.in b/bin/autoscan.in index 9696bb8dd..e4455612c 100644 --- a/bin/autoscan.in +++ b/bin/autoscan.in @@ -80,6 +80,7 @@ my $log = new Autom4te::XFile ">$me.log"; # Autoconf and lib files. my $autom4te = $ENV{'AUTOM4TE'} || '@bindir@/@autom4te-name@'; my $autoconf = "$autom4te --language=autoconf"; +my @prepend_include; my @include = ('@datadir@'); # $help @@ -96,7 +97,8 @@ preliminary `configure.ac' for that package. -V, --version print version number, then exit -v, --verbose verbosely report processing -d, --debug don't remove temporary files - -I, --include=DIR look for input files in DIR (cumulative) + -B, --prepend-include=DIR prepend directory DIR to search path + -I, --include=DIR append directory DIR to search path Report bugs to .\n"; @@ -121,7 +123,8 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"; # Process any command line arguments. sub parse_args () { - getopt ("I|include|A|autoconf-dir|m|macrodir=s" => \@include); + getopt ('I|include|A|autoconf-dir|m|macrodir=s' => \@include, + 'B|prepend-include=s' => @prepend_include); die "$me: too many arguments Try `$me --help' for more information.\n" @@ -151,7 +154,8 @@ sub init_tables () my $tables_are_consistent = 1; foreach my $kind (@kinds) { - my $file = find_file ("autoscan/$kind", @include); + my $file = find_file ("autoscan/$kind", + reverse(@prepend_include), @include); my $table = new Autom4te::XFile $file; while ($_ = $table->getline) { @@ -586,6 +590,7 @@ parse_args; $autoconf .= " --debug" if $debug; $autoconf .= " --verbose" if $verbose; $autoconf .= join (' --include=', '', @include); +$autoconf .= join (' --prepend-include=', '', @prepend_include); my $configure_ac = find_configure_ac; init_tables; diff --git a/bin/autoupdate.in b/bin/autoupdate.in index 4cabe586a..417f0b504 100644 --- a/bin/autoupdate.in +++ b/bin/autoupdate.in @@ -39,6 +39,7 @@ use strict; my $autom4te = $ENV{'AUTOM4TE'} || '@bindir@/@autom4te-name@'; my $autoconf = "$autom4te --language=autoconf"; # We need to find m4sugar. +my @prepend_include; my @include = ('@datadir@'); my $force = 0; # m4. @@ -58,7 +59,8 @@ Operation modes: -V, --version print version number, then exit -v, --verbose verbosely report processing -d, --debug don't remove temporary files - -I, --include=DIR look for input files in DIR (cumulative) + -B, --prepend-include=DIR prepend directory DIR to search path + -I, --include=DIR append directory DIR to search path -f, --force consider all files obsolete Report bugs to . @@ -87,6 +89,7 @@ sub parse_args () my $srcdir; getopt ('I|include|A|autoconf-dir|m|macrodir|l|localdir=s' => \@include, + 'B|prepend-include=s' => \@prepend_include, 'f|force' => \$force); if (! @ARGV) @@ -226,6 +229,7 @@ $autoconf .= " --debug" if $debug; $autoconf .= " --force" if $force; $autoconf .= " --verbose" if $verbose; $autoconf .= join (' --include=', '', @include); +$autoconf .= join (' --prepend-include=', '', @prepend_include); mktmpdir ('au'); handle_m4_macros; @@ -382,9 +386,9 @@ EOF or die "$me: cannot close $tmp/input.m4: $!\n"; # Now ask m4 to perform the update. - # M4 and I don't agree on the associativity of `--include': reverse! - xsystem ("$m4" - . join (' --include=', '', reverse (@include, $tmp)) + xsystem ("$m4 --include=$tmp" + . join (' --include=', '', reverse (@prepend_include)) + . join (' --include=', '', @include) . " $tmp/input.m4 >$tmp/updated"); update_file ("$tmp/updated", "$file" eq "$tmp/stdin" ? '-' : "$file"); diff --git a/configure.ac b/configure.ac index b36abb03c..e38078500 100644 --- a/configure.ac +++ b/configure.ac @@ -31,6 +31,13 @@ AC_CONFIG_FILES([config/Makefile]) AM_INIT_AUTOMAKE +AC_ARG_ENABLE([site-macro-dir], + AC_HELP_STRING([--enable-site-macro-dir=DIR], + [use site macro directory DIR @<:@DATADIR/autoconf/site_macros@:>@]), + , + [enable_site_macro_dir='${datadir}/autoconf/site_macros']) +AC_SUBST([SITE_MACRO_DIR], "${enable_site_macro_dir}") + # Initialize the test suite and build position independent wrappers. AC_CONFIG_TESTDIR([tests]) AC_CONFIG_FILES([tests/Makefile tests/atlocal]) diff --git a/doc/autoconf.texi b/doc/autoconf.texi index c0d6d97b9..2046bbe38 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -1089,8 +1089,11 @@ symbols it finds in them. This output can be voluminous. @item --include=@var{dir} @itemx -I @var{dir} -Also look for input files in @var{dir}. Multiple invocations -accumulate. Directories are browsed from last to first. +Append @var{dir} to the include path. Multiple invocations accumulate. + +@item --prepend-include=@var{dir} +@item -B @var{dir} +Prepend @var{dir} to the include path. Multiple invocations accumulate. @end table @node ifnames Invocation @@ -1174,8 +1177,18 @@ Remake @file{configure} even if newer than its input files. @item --include=@var{dir} @itemx -I @var{dir} -Also look for input files in @var{dir}. Multiple invocations -accumulate. Directories are browsed from last to first. +Append @var{dir} to the include path. Multiple invocations accumulate. + +@item --prepend-include=@var{dir} +@item -B @var{dir} +Prepend @var{dir} to the include path. Multiple invocations accumulate. + +After searching any directories specified using @option{--prepend-include} +or @option{--include}, @command{autoconf} will also search the directories +specified in the @code{AC_MACRO_PATH} environment variable, if set. +And finally, @command{autoconf} will also search the system-wide site +macro directory, which is set to +@samp{$@{datadir@}/autoconf/site_macros/autoconf} by default. @item --output=@var{file} @itemx -o @var{file} @@ -1447,8 +1460,11 @@ Instead of copying missing auxiliary files, install symbolic links. @item --include=@var{dir} @itemx -I @var{dir} -Also look for input files in @var{dir}. Multiple invocations -accumulate. Directories are browsed from last to first. +Append @var{dir} to the include path. Multiple invocations accumulate. + +@item --prepend-include=@var{dir} +@item -B @var{dir} +Prepend @var{dir} to the include path. Multiple invocations accumulate. @end table @@ -2533,8 +2549,11 @@ Remake the template file even if newer than its input files. @item --include=@var{dir} @itemx -I @var{dir} -Also look for input files in @var{dir}. Multiple invocations accumulate. -Directories are browsed from last to first. +Append @var{dir} to include path. Multiple invocations accumulate. + +@item --prepend-include=@var{dir} +@item -B @var{dir} +Prepend @var{dir} to include path. Multiple invocations accumulate. @item --warnings=@var{category} @itemx -W @var{category} @@ -7114,8 +7133,7 @@ Don't remove the temporary files and be even more verbose. @item --include=@var{dir} @itemx -I @var{dir} Also look for input files in @var{dir}. Multiple invocations -accumulate. Contrary to M4 but in agreement with common sense, -directories are browsed from last to first. +accumulate. @item --output=@var{file} @itemx -o @var{file} @@ -7375,18 +7393,31 @@ create Autotest executable test suites. @item Autoconf create Autoconf executable configure scripts. @end table + +@item --prepend-include=@var{dir} +@item -B @var{dir} +Prepend directory @var{dir} to the search path. This is used to include +the language-specific files before any third-party macros. + +@item --include-envvar=@var{envvar} +Add directories specified in the environment variable @var{envvar} to +the search path. + +@item --site-macro-subdir=@var{subdir} +If the site macro directory is set, add the subdirectory @var{subdir} +of the site macro directory to the search path. @end table @cindex @file{autom4te.cfg} As an example, if Autoconf is installed in its default location, -@file{/usr/local}, running @samp{autom4te -l m4sugar foo.m4} is strictly -equivalent to running @samp{autom4te --include /usr/local/share/autoconf -m4sugar/m4sugar.m4f --warning syntax foo.m4}. Recursive expansion -applies: running @samp{autom4te -l m4sh foo.m4}, is the same as -@samp{autom4te --language M4sugar m4sugar/m4sh.m4f foo.m4}, i.e., -@samp{autom4te --include /usr/local/share/autoconf m4sugar/m4sugar.m4f -m4sugar/m4sh.m4f --mode 777 foo.m4}. The definition of the languages is -stored in @file{autom4te.cfg}. +@file{/usr/local}, running @samp{autom4te -l m4sugar foo.m4} is +strictly equivalent to running @samp{autom4te --prepend-include +/usr/local/share/autoconf m4sugar/m4sugar.m4f --warning syntax foo.m4}. +Recursive expansion applies: running @samp{autom4te -l m4sh foo.m4}, +is the same as @samp{autom4te --language M4sugar m4sugar/m4sh.m4f +foo.m4}, i.e., @samp{autom4te --prepend-include /usr/local/share/autoconf +m4sugar/m4sugar.m4f m4sugar/m4sh.m4f --mode 777 foo.m4}. The definition +of the languages is stored in @file{autom4te.cfg}. @node Programming in M4sugar diff --git a/lib/autom4te.in b/lib/autom4te.in index fc4436910..c156a89c7 100644 --- a/lib/autom4te.in +++ b/lib/autom4te.in @@ -126,7 +126,9 @@ end-language: "Autoscan-preselections" ## ---------- ## begin-language: "Autoconf" -args: --include @datadir@ +args: --prepend-include @datadir@ +args: --site-macro-subdir autoconf +args: --include-envvar AC_MACRO_PATH args: autoconf/autoconf.m4f args: acsite.m4? args: aclocal.m4? @@ -144,7 +146,9 @@ end-language: "Autoconf" ## -------- ## begin-language: "Autotest" -args: --include @datadir@ +args: --prepend-include @datadir@ +args: --site-macro-subdir autotest +args: --include-envvar AT_MACRO_PATH args: autotest/autotest.m4f args: package.m4? args: --mode 777 @@ -157,7 +161,9 @@ end-language: "Autotest" ## ---- ## begin-language: "M4sh" -args: --include @datadir@ +args: --prepend-include @datadir@ +args: --site-macro-subdir m4sh +args: --include-envvar M4SH_MACRO_PATH args: m4sugar/m4sh.m4f args: --mode 777 args: --language M4sugar @@ -169,7 +175,9 @@ end-language: "M4sh" ## ------- ## begin-language: "M4sugar" -args: --include @datadir@ +args: --prepend-include @datadir@ +args: --site-macro-subdir m4sugar +args: --include-envvar M4SUGAR_MACRO_PATH args: m4sugar/m4sugar.m4f args: --warning syntax end-language: "M4sugar" diff --git a/tests/wrapsh.in b/tests/wrapsh.in index 005603fd9..bb09a3b0f 100644 --- a/tests/wrapsh.in +++ b/tests/wrapsh.in @@ -77,4 +77,4 @@ echo X/"$0" | # @configure_input@ # Running `$0' as if it were installed. -exec @abs_top_builddir@/bin/$as_me --include @abs_top_builddir@/lib ${1+"$@"} +exec @abs_top_builddir@/bin/$as_me --prepend-include @abs_top_builddir@/lib ${1+"$@"}