[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2] general: support CONFIG_SITE being a list of entries

From: Ross Burton
Subject: [PATCH v2] general: support CONFIG_SITE being a list of entries
Date: Wed, 11 Nov 2020 15:54:53 +0000

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

Signed-off-by: Ross Burton <>
 doc/autoconf.texi       |  4 ++--
 lib/autoconf/general.m4 | 23 +++++++++--------------
 tests/           | 11 +++++++++++
 3 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index b875c25a..fb578408 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -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 list of shell script to read; it is recommended
+that these be absolute file names.  Otherwise, it
 reads the shell script @file{@var{prefix}/share/} if it exists,
 then @file{@var{prefix}/etc/} if it exists.  Thus,
 settings in machine-specific files override those in machine-independent
diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4
index b74a441f..77713c2b 100644
--- a/lib/autoconf/general.m4
+++ b/lib/autoconf/general.m4
@@ -2105,25 +2105,20 @@ AU_DEFUN([AC_VALIDATE_CACHED_SYSTEM_TUPLE], [])
 # Look for site- or system-specific initialization scripts.
 [# Prefer an explicitly selected file to automatically selected ones.
 if test -n "$CONFIG_SITE"; then
-  # We do not want a PATH search for
-  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/
-  ac_site_file2=$prefix/etc/
+  ac_site_files="$prefix/share/ $prefix/etc/"
-  ac_site_file1=$ac_default_prefix/share/
-  ac_site_file2=$ac_default_prefix/etc/
+  ac_site_files="$ac_default_prefix/share/ 
-for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+for ac_site_file in $ac_site_files
-  test "x$ac_site_file" = xNONE && continue
+  case $ac_site_file in
+  */*) ;;
+  *) ac_site_file=./$ac_site_file;;
+  esac
   if test /dev/null != "$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
diff --git a/tests/ b/tests/
index 6a1d9742..2c5c4bdf 100644
--- a/tests/
+++ b/tests/
@@ -571,6 +571,17 @@ AT_CHECK([grep 'failed to load site script' stderr], [], 
[ignore], [ignore],
+# Check that multiple files are loaded
+AT_CHECK_CONFIGURE([], [], [stdout])
+AT_CHECK([grep 'whether true.*works.*cached.*maybe' stdout], [], [ignore])

reply via email to

[Prev in Thread] Current Thread [Next in Thread]