]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Move atlocal feature tests to configure
authorPaolo Bonzini <bonzini@gnu.org>
Sun, 12 Jul 2009 09:28:57 +0000 (11:28 +0200)
committerPaolo Bonzini <bonzini@gnu.org>
Mon, 13 Jul 2009 11:40:23 +0000 (13:40 +0200)
This test makes atlocal code use configure tests instead.  This
is best practice and could make diagnosing autoconf bugs easier.

2009-07-12  Paolo Bonzini  <bonzini@gnu.org>

* configure.ac: Test for unsupported characters in files and
directories here...
* tests/atlocal.in: ... and not here.

ChangeLog
configure.ac
tests/atlocal.in

index d256710600eaf482e7545b59338a5c3987396fff..2e5822decd9a86385821f25d67ee8e6da212a992 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-07-12  Paolo Bonzini  <bonzini@gnu.org>
+
+       Move atlocal feature tests to configure
+       * configure.ac: Test for unsupported characters in files and
+       directories here...
+       * tests/atlocal.in: ... and not here.
+
 2009-07-09  Eric Blake  <ebb9@byu.net>
 
        Fix test typo.
index a5fcad0ac9e3a5cecffa61e37ec0589f7ddc8a05..d5659e2c831491a95afcbbdcec004e27e6343057 100644 (file)
@@ -68,6 +68,37 @@ fi
 ])
 AC_SUBST([ac_cv_sh_n_works])
 
+AC_MSG_CHECKING([for characters that cannot appear in file names])
+AC_CACHE_VAL( [ac_cv_unsupported_fs_chars],
+[ac_cv_unsupported_fs_chars=
+for c in '\\' '"' '<' '>' '*' '?' '|'
+do
+  touch "conftest.t${c}t" 2>/dev/null
+  test -f "conftest.t${c}t" && rm -f "conftest.t${c}t" && continue
+  # $c cannot be used in a file name.
+  ac_cv_unsupported_fs_chars=$ac_cv_unsupported_fs_chars$c
+done
+])
+if test -n "$ac_cv_unsupported_fs_chars"; then
+  AC_MSG_RESULT([$ac_cv_unsupported_fs_chars])
+else
+  AC_MSG_RESULT([none])
+fi
+
+AC_SUBST([ac_cv_unsupported_fs_chars])
+
+AC_CACHE_CHECK([whether directories can have trailing spaces],
+              [ac_cv_dir_trailing_space],
+[rm -rf 'conftest.d ' && mkdir 'conftest.d ' && touch 'conftest.d /tfile' 2>/dev/null
+status=$?
+rm -rf 'conftest.d '
+case $status$? in #(
+   00) ac_cv_dir_trailing_space=yes ;; #(
+   *) ac_cv_dir_trailing_space=no ;;
+esac
+])
+AC_SUBST([ac_cv_dir_trailing_space])
+
 # Initialize the test suite.
 AC_CONFIG_TESTDIR([tests])
 AC_CONFIG_FILES([tests/Makefile tests/atlocal])
index ad72c374f9db367114581a673a92596ea4704d00..adce2bf8275e934ec3a803cef42595049d4b1bdf 100644 (file)
@@ -29,27 +29,16 @@ ac_cv_sh_n_works='@ac_cv_sh_n_works@'
 
 # Check whether the underlying system can manage some unusual
 # symbols in file names.
-unsupported_fs_chars=
-for c in '\\' '"' '<' '>' '*' '?' '|'
-do
-  touch "t${c}t" 2>/dev/null
-  test -f "t${c}t" && rm -f "t${c}t" && continue
-  # $c cannot be used in a file name.
-  unsupported_fs_chars=$unsupported_fs_chars$c
-done
-if test -z "$unsupported_fs_chars"; then
+if test -z '@ac_cv_unsupported_fs_chars@'; then
   func_sanitize_file_name () { echo "$@"; }
 else
-  func_sanitize_file_name () { echo "$@" | tr -d "$unsupported_fs_chars"; }
+  func_sanitize_file_name () { echo "$@" | tr -d '@ac_cv_unsupported_fs_chars@'; }
 fi
 
 # Can we create directories with trailing whitespaces in their name?
-rm -rf 'tdir ' && mkdir 'tdir ' && touch 'tdir /tfile' 2>/dev/null
-a=$?
-rm -rf 'tdir '
-case $a$? in #(
-00)
-  func_sanitize_dir_name () { echo "$@"; } ;; #(
-*)
-  func_sanitize_dir_name () { echo "$@" | sed 's/  *$//'; } ;;
-esac
+ac_cv_dir_trailing_space='@ac_cv_dir_trailing_space@'
+if test "$ac_cv_dir_trailing_space" = yes; then
+  func_sanitize_dir_name () { echo "$@"; }
+else
+  func_sanitize_dir_name () { echo "$@" | sed 's/  *$//'; }
+fi