]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Support CONFIG_SITE being a list of entries.
authorRoss Burton <ross.burton@arm.com>
Wed, 11 Nov 2020 16:19:41 +0000 (11:19 -0500)
committerZack Weinberg <zackw@panix.com>
Wed, 11 Nov 2020 16:19:41 +0000 (11:19 -0500)
Instead of treating CONFIG_SITE as a single path, treat it as a
space-separated list of paths and load them in order.

Also remove the special-casing of entries starting with a dash, this is
redundant as they'll be caught by the wildcard case.

Finally add a test case to verify that multiple files are loaded
correctly.

* lib/autoconf/general.m4 (AC_SITE_LOAD): Treat CONFIG_SITE as a
  space-separated list of scripts to be sourced.  Simplify handling
  of default config.site locations using this capability.
* tests/base.at (AC_CACHE_CHECK): Test loading of multiple site files.
* doc/autoconf.texi (Site Defaults): Update documentation of CONFIG_SITE.

doc/autoconf.texi
lib/autoconf/general.m4
tests/base.at

index b875c25a2e105e79d7db780b736ae4f082b794d6..da050b475690b421483d639c05f7bcc5fdccfacc 100644 (file)
@@ -22943,8 +22943,8 @@ site- and system-wide initialization files.
 
 @evindex CONFIG_SITE
 If the environment variable @code{CONFIG_SITE} is set, @command{configure}
-uses its value as the name of a shell script to read; it is recommended
-that this be an absolute file name.  Otherwise, it
+uses its value as a space-separated list of shell scripts to read;
+it is recommended that these be absolute file names.  Otherwise, it
 reads the shell script @file{@var{prefix}/share/config.site} if it exists,
 then @file{@var{prefix}/etc/config.site} if it exists.  Thus,
 settings in machine-specific files override those in machine-independent
index b74a441f0d6bc3f9fab917804b0ab1bc0b00b35c..90cb5a5af4c2c1a101bbb71cdb2b43a1e45ab4da 100644 (file)
@@ -2105,26 +2105,20 @@ AU_DEFUN([AC_VALIDATE_CACHED_SYSTEM_TUPLE], [])
 # Look for site- or system-specific initialization scripts.
 m4_define([AC_SITE_LOAD],
 [# Prefer an explicitly selected file to automatically selected ones.
-ac_site_file1=NONE
-ac_site_file2=NONE
 if test -n "$CONFIG_SITE"; then
-  # We do not want a PATH search for config.site.
-  case $CONFIG_SITE in @%:@((
-    -*)  ac_site_file1=./$CONFIG_SITE;;
-    */*) ac_site_file1=$CONFIG_SITE;;
-    *)   ac_site_file1=./$CONFIG_SITE;;
-  esac
+  ac_site_files="$CONFIG_SITE"
 elif test "x$prefix" != xNONE; then
-  ac_site_file1=$prefix/share/config.site
-  ac_site_file2=$prefix/etc/config.site
+  ac_site_files="$prefix/share/config.site $prefix/etc/config.site"
 else
-  ac_site_file1=$ac_default_prefix/share/config.site
-  ac_site_file2=$ac_default_prefix/etc/config.site
+  ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
 fi
-for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+
+for ac_site_file in $ac_site_files
 do
-  test "x$ac_site_file" = xNONE && continue
-  if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
+  AS_CASE([$ac_site_file],
+    [*/*], [],
+    [ac_site_file=./$ac_site_file])
+  if test -f "$ac_site_file" && test -r "$ac_site_file"; then
     AC_MSG_NOTICE([loading site script $ac_site_file])
     sed 's/^/| /' "$ac_site_file" >&AS_MESSAGE_LOG_FD
     . "$ac_site_file" \
index 6a1d97422cbed42e8e4852d14c42eff083e35a31..2c5c4bdf4689ca33798445fb5a5f1b8c25aaf299 100644 (file)
@@ -571,6 +571,17 @@ AT_CHECK([grep 'failed to load site script' stderr], [], [ignore], [ignore],
 CONFIG_SITE=./no-such-file
 AT_CHECK_CONFIGURE
 
+# Check that multiple files are loaded
+AT_DATA([first.site],
+[[my_cv_shell_true_works=no
+]])
+AT_DATA([second.site],
+[[my_cv_shell_true_works=maybe
+]])
+CONFIG_SITE="$PWD/first.site $PWD/second.site"
+AT_CHECK_CONFIGURE([], [], [stdout])
+AT_CHECK([grep 'whether true.*works.*cached.*maybe' stdout], [], [ignore])
+
 AT_CLEANUP