* lib/autoconf/general.m4 (AC_SITE_LOAD): Make more robust. * tests/base.at (AC_CACHE_CHECK): Enhance test.
Signed-off-by: Eric Blake <ebl...@redhat.com> --- ...this fixes the broken semantics that triggered the test failure in the first place, and strengthens the test. Should I squash these patches into one before pushing? ChangeLog | 4 ++++ lib/autoconf/general.m4 | 9 +++++++-- tests/base.at | 10 +++++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6b5e87b..d5fb294 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2010-06-08 Eric Blake <ebl...@redhat.com> + Avoid PATH search for CONFIG_SITE. + * lib/autoconf/general.m4 (AC_SITE_LOAD): Make more robust. + * tests/base.at (AC_CACHE_CHECK): Enhance test. + Avoid spurious CONFIG_SITE test failure. * doc/autoconf.texi (Site Defaults): Mention that CONFIG_SITE works best as an absolute path. diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index f73673e..4ba9e68 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -1870,7 +1870,11 @@ m4_define([AC_SITE_LOAD], ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then - ac_site_file1=$CONFIG_SITE + # We do not want a PATH search for config.site. + case $CONFIG_SITE in @%:@(( + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site @@ -1884,7 +1888,8 @@ do 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 - . "$ac_site_file" + . "$ac_site_file" \ + || AC_MSG_FAILURE([failed to load site script $ac_site_file]) fi done ]) diff --git a/tests/base.at b/tests/base.at index e9fadb6..327ea68 100644 --- a/tests/base.at +++ b/tests/base.at @@ -401,7 +401,7 @@ AT_DATA([config.site], AT_DATA([sitecache], [[my_cv_some_preset_cache_var=yes ]]) -CONFIG_SITE=$PWD/config.site +CONFIG_SITE=config.site export CONFIG_SITE AT_CHECK_CONFIGURE AT_CHECK([grep my_cv_some_preset_cache_var sitecache], [], [ignore]) @@ -409,6 +409,14 @@ AT_CHECK([grep my_cv_shell_true_works sitecache], [], [ignore]) AT_CHECK_CONFIGURE([], [], [stdout]) AT_CHECK([grep 'whether true.*works.*cached' stdout], [], [ignore]) +# Check that config cache scripts must be well-formed. +AT_DATA([bad.site], +[[fi +]]) +CONFIG_SITE=$PWD/bad.site +AT_CHECK_CONFIGURE([], [1], [ignore], [stderr]) +AT_CHECK([grep 'failed to load site script' stderr], [], [ignore]) + AT_CLEANUP -- 1.7.0.1