Some modernization of the legacy testsuite.
* tests/sh.test: Remove.
* Makefile.am (COMMON_TESTS): Adjust.
* cfg.mk (sc_libtool_m4_cc_basename, sc_prohibit_bracket_as_test)
(sc_prohibit_nested_quotes, sc_prohibit_set_dummy_without_shift)
(sc_prohibit_set_minus_minus, sc_prohibit_test_binary_operators)
(sc_prohibit_test_dollar, sc_prohibit_test_minus_e)
(sc_prohibit_test_unary_operators, sc_prohibit_test_X)
(sc_prohibit_Xsed_withou_X, sc_require_function_nl_brace):
Functionally identical tests to what used to be performed by
sh.test, only with coverage of all files.
* bootstrap, build-aux/edit-readme-alpha,
build-aux/extract-trace, build-aux/getopt.m4sh,
build-aux/ltmain.m4sh, configure.ac, m4/libtool.m4, m4/ltdl.m4,
tests/bindir.at, tests/configure-iface.at, tests/cwrapper.at,
tests/darwin.at, tests/defs.m4sh, tests/demo-hardcode.test,
tests/dlloader-api.at, tests/exceptions.at,
tests/getopt-m4sh.at, tests/lalib-syntax.at, tests/link-2.test,
tests/link-order2.at, tests/loadlibrary.at,
tests/lt_dladvise.at, tests/lt_dlexit.at, tests/lt_dlopen_a.at,
tests/lt_dlopenext.at, tests/need_lib_prefix.at,
tests/nonrecursive.at, tests/recursive.at, tests/resident.at,
tests/standalone.at, tests/static.at, tests/stresstest.at,
tests/subproject.at, tests/sysroot.at, tests/tagtrace.test,
tests/testsuite.at: Fix violations of the new syntax checks.

Signed-off-by: Gary V. Vaughan <g...@gnu.org>
---
 Makefile.am                 |    3 +-
 bootstrap                   |   21 ++++---
 build-aux/edit-readme-alpha |    4 +-
 build-aux/extract-trace     |    6 +-
 build-aux/getopt.m4sh       |    2 +-
 build-aux/ltmain.m4sh       |    2 +-
 cfg.mk                      |  104 +++++++++++++++++++++++++++++++++
 configure.ac                |    2 +-
 m4/libtool.m4               |   50 ++++++++--------
 m4/ltdl.m4                  |    2 +-
 tests/bindir.at             |   10 ++--
 tests/configure-iface.at    |    8 +-
 tests/cwrapper.at           |    2 +-
 tests/darwin.at             |    2 +-
 tests/defs.m4sh             |    4 +-
 tests/demo-hardcode.test    |    6 +-
 tests/dlloader-api.at       |    2 +-
 tests/exceptions.at         |    2 +-
 tests/getopt-m4sh.at        |    2 +-
 tests/lalib-syntax.at       |    2 +-
 tests/link-2.test           |    2 +-
 tests/link-order2.at        |    8 +-
 tests/loadlibrary.at        |    2 +-
 tests/lt_dladvise.at        |    4 +-
 tests/lt_dlexit.at          |    2 +-
 tests/lt_dlopen_a.at        |    2 +-
 tests/lt_dlopenext.at       |    4 +-
 tests/need_lib_prefix.at    |    2 +-
 tests/nonrecursive.at       |    4 +-
 tests/recursive.at          |    4 +-
 tests/resident.at           |    2 +-
 tests/sh.test               |  134 -------------------------------------------
 tests/standalone.at         |    4 +-
 tests/static.at             |    2 +-
 tests/stresstest.at         |    2 +-
 tests/subproject.at         |    4 +-
 tests/sysroot.at            |    4 +-
 tests/tagtrace.test         |    4 +-
 tests/testsuite.at          |    4 +-
 39 files changed, 200 insertions(+), 230 deletions(-)
 delete mode 100755 tests/sh.test

diff --git a/Makefile.am b/Makefile.am
index 2c6cf81..31d286e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -557,7 +557,7 @@ changelog           = $(distdir)/ChangeLog
 # date is updated to the following year.
 changelog_start_date = 2011-01-01
 $(changelog): FORCE
-       $(AM_V_GEN)if test -d $(srcdir)/.git; then \
+       $(AM_V_GEN)if test -d '$(srcdir)/.git'; then \
          $(gitlog_to_changelog) --amend=$(git_log_fix) \
              --since=$(changelog_start_date) > '$@T'; \
          rm -f '$@'; mv '$@T' '$@'; \
@@ -874,7 +874,6 @@ COMMON_TESTS = \
        tests/nomode.test \
        tests/objectlist.test \
        tests/quote.test \
-       tests/sh.test \
        tests/suffix.test \
        tests/tagtrace.test \
        tests/cdemo-static.test \
diff --git a/bootstrap b/bootstrap
index 9a9e94b..4dbdf72 100755
--- a/bootstrap
+++ b/bootstrap
@@ -738,20 +738,20 @@ func_clean_unused_macros ()
 
       # We use `ls|grep' instead of `ls *.m4' to avoid exceeding
       # command line length limits in some shells.
-      for file in `cd $macro_dir && ls -1 |grep '\.m4$'`; do
+      for file in `cd "$macro_dir" && ls -1 |grep '\.m4$'`; do
 
        # Remove a macro file when aclocal.m4 does not m4_include it...
         func_grep_q 'm4_include([[]'$macro_dir/$file'])' $aclocal_m4s \
-            || test ! -f $gnulib_path/m4/$file || {
+            || test ! -f "$gnulib_path/m4/$file" || {
 
               # ...and there is an identical file in gnulib...
-              if func_cmp_s $gnulib_path/m4/$file $macro_dir/$file; then
+              if func_cmp_s "$gnulib_path/m4/$file" "$macro_dir/$file"; then
 
                 # ...and it's not in the precious list (`echo' is needed
                 # here to squash whitespace for the match expression).
                 case " "`echo $gnulib_precious`" " in
                   *" $file "*) ;;
-                  *) rm -f $macro_dir/$file
+                  *) rm -f "$macro_dir/$file"
                      func_verbose \
                        "removing unused gnulib file \`$macro_dir/$file'"
                 esac
@@ -1619,7 +1619,7 @@ func_gnulib_tool has installed the \`git-version-gen' 
script."
 # `gnulib-cache.m4' if possible.
 require_source_base=func_require_source_base
 func_require_source_base ()
-  {
+{
     $debug_cmd
 
     $require_gnulib_cache
@@ -2027,7 +2027,7 @@ func_truncate_cmd ()
       case $_G_opt in
         -*) _G_last_arg_opt_p=: ;;
         *)  $_G_last_arg_opt_p \
-                || test $min_cmd_len -gt $func_len_result \
+                || test "$min_cmd_len" -gt "$func_len_result" \
                 || break
             _G_last_arg_opt_p=false
             ;;
@@ -2051,7 +2051,7 @@ func_insert_sorted_if_absent ()
 
     for file
     do
-      test -f $file || touch $file
+      test -f "$file" || touch $file
 
       func_grep_q "$str" "$file" \
           && func_verbose "inserting \`$str' into \`$file'"
@@ -2065,13 +2065,14 @@ func_insert_sorted_if_absent ()
 
 # func_sort_ver VER1 VER2
 # -----------------------
+# `sort -V' is not generally available.
 # Note this deviates from the version comparison in automake
 # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
 # but this should suffice as we won't be specifying old
 # version formats or redundant trailing .0 in bootstrap.conf.
 # If we did want full compatibility then we should probably
 # use m4_version_compare from autoconf.
-func_sort_ver ()  # sort -V is not generally available
+func_sort_ver ()
 {
     $debug_cmd
 
@@ -2141,7 +2142,7 @@ func_get_version ()
     func_tool_version_output $_G_app >/dev/null
     _G_status=$?
 
-    test $_G_status -ne 0 \
+    test "$_G_status" -ne 0 \
       || $_G_app --version 2>&1 |$SED -n "$sed_get_version"
 
     (exit $_G_status)
@@ -2234,7 +2235,7 @@ func_update_po_files ()
     # Usually contains *.s1 checksum files.
     _G_ref_po_dir=$_G_po_dir/.reference
 
-    test -d $_G_ref_po_dir || mkdir $_G_ref_po_dir || return
+    test -d "$_G_ref_po_dir" || mkdir $_G_ref_po_dir || return
     func_download_po_files $_G_ref_po_dir $_G_domain \
       && ls "$_G_ref_po_dir"/*.po 2>/dev/null \
          |$SED 's|.*/||; s|\.po$||' > "$_G_po_dir/LINGUAS" || return
diff --git a/build-aux/edit-readme-alpha b/build-aux/edit-readme-alpha
index b154974..c759998 100755
--- a/build-aux/edit-readme-alpha
+++ b/build-aux/edit-readme-alpha
@@ -57,7 +57,7 @@ func_fatal_error ()
 for file in "$@"; do
   # Assume that read-only README indicates that we are running inside
   # the latter part of a `make distcheck'.
-  test -w $file || {
+  test -w "$file" || {
     echo "$progname: not editing non-writeable \`$file' (distcheck?)" >&2
     continue
   }
@@ -85,7 +85,7 @@ support script.  Libtool hides the complexity of using shared 
libraries\
 behind a consistent, portable interface.' $file > $file.T
 
   # Diagnose redirection failure.
-  test -f $file.T || func_fatal_error "Unable to write $file.T"
+  test -f "$file.T" || func_fatal_error "Unable to write $file.T"
 
   # Overwrite the original file with our edited version.
   mv $file.T $file || func_fatal_error "Unable to edit $file"
diff --git a/build-aux/extract-trace b/build-aux/extract-trace
index a4322ec..6c92d5f 100755
--- a/build-aux/extract-trace
+++ b/build-aux/extract-trace
@@ -1,7 +1,7 @@
 #! /bin/sh
 
 # Make sure we've evaluated the option-parser library.
-test -n "$progpath" || . `echo "$0" |${SED-sed} 's,[^/]*$,,'`"/options-parser"
+test -n "$progpath" || . `echo "$0" |${SED-sed} 's,[^/]*$,,'`/options-parser
 
 # Set a version string.
 scriptversion=2011-11-04.09; # UTC
@@ -86,7 +86,7 @@ func_autoconf_configure ()
     test -n "$_G_ac_init"
     _G_status=$?
 
-    test $_G_status -ne 0 \
+    test "$_G_status" -ne 0 \
       && func_verbose "\`$1' not using Autoconf"
 
     (exit $_G_status)
@@ -161,7 +161,7 @@ func_tool_version_output ()
     { $_G_cmd --version </dev/null || $_G_cmd --version; } 2>/dev/null
     _G_status=$?
 
-    test $_G_status -ne 0 && test -n "$_G_fatal_error_msg" \
+    test "$_G_status" -ne 0 && test -n "$_G_fatal_error_msg" \
         && func_fatal_error "$_G_fatal_error_msg"
 
     (exit $_G_status)
diff --git a/build-aux/getopt.m4sh b/build-aux/getopt.m4sh
index 568db29..27a8352 100644
--- a/build-aux/getopt.m4sh
+++ b/build-aux/getopt.m4sh
@@ -239,7 +239,7 @@ m4_define([m4go_shortnoargs], [-\?*|-h*])
 #      injecting new arguments into the command line before the
 #      processing loop terminates.  For example:
 #
-#              `eval set -- `cat $rcfile` ${1+"$@"}'
+#            eval set dummy `cat $rcfile` ${1+"$@"}; shift
 #
 #      Note that, because we look inside the content of INITn to
 #      determine whether there are newlines to be stripped, double
diff --git a/build-aux/ltmain.m4sh b/build-aux/ltmain.m4sh
index b0b2a62..02ff034 100644
--- a/build-aux/ltmain.m4sh
+++ b/build-aux/ltmain.m4sh
@@ -7901,7 +7901,7 @@ EOF
       test "$build_libtool_libs" != yes && libobjs=$non_pic_objects
 
       # Create the old-style object.
-      reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED 
"/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### 
testsuite: skip nested quoting test
+      reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED 
"/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs
 
       output=$obj
       func_execute_cmds "$reload_cmds" 'exit $?'
diff --git a/cfg.mk b/cfg.mk
index 58c01cc..3d2e2a6 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -55,6 +55,110 @@ local-checks-to-skip =                              \
 # trailing_blank: flags valid rfc3676 separators
 # unmarked_diagnostics: libtool isn't internationalized
 
+
+# Check for correct usage of $cc_basename in libtool.m4.
+sc_libtool_m4_cc_basename:
+       @sed -n '/case \$$cc_basename in/,/esac/ {                      \
+         /^[    ]*[a-zA-Z][a-zA-Z0-9+]*[^*][    ]*)/p;                 \
+       }' '$(srcdir)/$(macro_dir)/libtool.m4' | grep . && {            \
+         msg="\$$cc_basename matches should include a trailing \`*'."  \
+         $(_sc_say_and_exit) } || :
+
+# Check for uses of Xsed without corresponding echo "X
+exclude_file_name_regexp--sc_prohibit_Xsed_without_X = ^cfg.mk$$
+sc_prohibit_Xsed_without_X:
+       @files=$$($(VC_LIST_EXCEPT));                                   \
+       if test -n "$$files"; then                                      \
+         grep -nE '\$$Xsed' $$files | grep -vE '(func_echo_all|\$$ECHO) \\*"X' 
&& {    \
+           msg='occurrences of `$$Xsed'\'' without `$$ECHO "X'\'' on the same 
line' \
+           $(_sc_say_and_exit) } || :;                                 \
+       else :;                                                         \
+       fi || :
+
+# Check for using `[' instead of `test'.
+exclude_file_name_regexp--sc_prohibit_bracket_as_test = ^cfg.mk$$
+sc_prohibit_bracket_as_test:
+       @prohibit='if[   ]+\['                                          \
+       halt="use \`if test' instead of \`if ['"                        \
+         $(_sc_search_regexp)
+
+# Check for quotes within backquotes within quotes "`"bar"`"
+exclude_file_name_regexp--sc_prohibit_nested_quotes = ^cfg.mk$$
+sc_prohibit_nested_quotes:
+       @prohibit='"[^`"]*`[^"`]*"[^"`]*".*`[^`"]*"'                    \
+       halt='found nested double quotes'                               \
+         $(_sc_search_regexp_or_exclude)
+
+# Check for using shift after set dummy (same or following line).
+exclude_file_name_regexp--sc_prohibit_set_dummy_without_shift = ^cfg.mk$$
+sc_prohibit_set_dummy_without_shift:
+       @files=$$($(VC_LIST_EXCEPT));                                   \
+       if test -n "$$files"; then                                      \
+         grep -nE '(set dummy|shift)' $$files |                        \
+           sed -n '/set[        ][      ]*dummy/{                      \
+             /set.*dummy.*;.*shift/d;                                  \
+             N;                                                        \
+             /\n.*shift/D;                                             \
+             p;                                                        \
+            }' | grep -n . && {                                                
\
+           msg="use \`shift' after \`set dummy'"                       \
+           $(_sc_say_and_exit) } || :;                                 \
+       else :;                                                         \
+       fi || :
+
+# Check for using set -- instead of set dummy
+exclude_file_name_regexp--sc_prohibit_set_minus_minus = ^cfg.mk$$
+sc_prohibit_set_minus_minus:
+       @prohibit='set[  ]+--[   ]+'                                    \
+       halt="use \`set dummy ...' instead of \`set -- ...'"            \
+         $(_sc_search_regexp)
+
+# Check for using test X"... instead of test "X...
+exclude_file_name_regexp--sc_prohibit_test_X = ^cfg.mk$$
+sc_prohibit_test_X:
+       @prohibit='test[         ]+(![   ])?(-.[         ]+)?X["'\'']'  \
+       halt='use `test "X..."'\'' instead of `test X"'\'               \
+         $(_sc_search_regexp)
+
+# Check for bad binary operators.
+sc_prohibit_test_binary_operators:
+       @prohibit='if[   ]+["'\'']?\$$[^         ]+[     
]+(=|-[lg][te]|-eq|-ne)' \
+       halt="Use \`if test \$$something =' instead of \`if \$$something ='" \
+         $(_sc_search_regexp)
+
+# Check for using test $... instead of test "$...
+exclude_file_name_regexp--sc_prohibit_test_dollar = ^cfg.mk$$
+sc_prohibit_test_dollar:
+       @prohibit='test[         ]+(![   ])?(-.[         ]+)?X?\$$[^?#]' \
+       halt='use `test "$$..."'\'' instead of `test $$'\'              \
+         $(_sc_search_regexp)
+
+# Never use test -e.
+exclude_file_name_regexp--sc_prohibit_test_minus_e = ^cfg.mk$$
+sc_prohibit_test_minus_e:
+       @prohibit='test[         ]+(![   ])?-e'                         \
+       halt="use \`test -f' instead of \`test -e'"                     \
+         $(_sc_search_regexp)
+
+# Check for bad unary operators.
+sc_prohibit_test_unary_operators:
+       @prohibit='if[   ]+-[a-z]'                                      \
+       halt="use \`if test -X' instead of \`if -X'"                    \
+         $(_sc_search_regexp)
+
+# Check for opening brace on next line in shell function definition.
+exclude_file_name_regexp--sc_require_function_nl_brace = (^HACKING|\.[ch])$$
+sc_require_function_nl_brace:
+       @for file in $$($(VC_LIST_EXCEPT)); do                          \
+         sed -n '/^func_[^      ]*[     ]*(/{                          \
+           N;                                                          \
+           /^func_[^    ]* ()\n{$$/d;                                  \
+           p;                                                          \
+         }' $$file | grep -E . && {                                    \
+           msg="found malformed function_definition in $$file"         \
+           $(_sc_say_and_exit) } || :;                                 \
+       done
+
 sc_trailing_blank-non-rfc3676:
        @prohibit='([^-][^-][    ][      ]*|^[   ][      ]*)$$'         \
        halt='found trailing blank(s)'                                  \
diff --git a/configure.ac b/configure.ac
index 39d06f4..2eb315c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -200,7 +200,7 @@ END
    cd ..
    rm -rf conftest.dir
 ])
-if test $lt_cv_make_order_only = yes; then
+if test yes = "$lt_cv_make_order_only"; then
   ORDER='|'
 else
   ORDER=''
diff --git a/m4/libtool.m4 b/m4/libtool.m4
index eb2964c..cca0f9d 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -547,7 +547,7 @@ for var in lt_decl_all_varnames([[ \
 ]], lt_decl_quote_varnames); do
     case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
     *[[\\\\\\\`\\"\\\$]]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED 
\\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED 
\\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes
       ;;
     *)
       eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
@@ -560,7 +560,7 @@ for var in lt_decl_all_varnames([[ \
 ]], lt_decl_dquote_varnames); do
     case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
     *[[\\\\\\\`\\"\\\$]]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e 
\\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e 
\\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e 
\\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e 
\\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from 
sc_prohibit_nested_quotes
       ;;
     *)
       eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
@@ -598,7 +598,7 @@ AS_SHELL_SANITIZE
 _AS_PREPARE
 exec AS_MESSAGE_FD>&1
 _ASEOF
-test $lt_write_fail = 0 && chmod +x $1[]dnl
+test 0 = "$lt_write_fail" && chmod +x $1[]dnl
 m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT
 
 # LT_OUTPUT
@@ -643,7 +643,7 @@ Copyright (C) 2011 Free Software Foundation, Inc.
 This config.lt script is free software; the Free Software Foundation
 gives unlimited permision to copy, distribute and modify it."
 
-while test $[#] != 0
+while test 0 != $[#]
 do
   case $[1] in
     --version | --v* | -V )
@@ -991,7 +991,7 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
          cat conftest.err >&AS_MESSAGE_LOG_FD
        # Otherwise, if the output was created with a 0 exit code from
        # the compiler, it worked.
-       elif test -f libconftest.dylib && test $_lt_result -eq 0; then
+       elif test -f libconftest.dylib && test 0 = "$_lt_result"; then
          lt_cv_apple_cc_single_mod=yes
        else
          cat conftest.err >&AS_MESSAGE_LOG_FD
@@ -1031,7 +1031,7 @@ _LT_EOF
       _lt_result=$?
       if test -s conftest.err && $GREP force_load conftest.err; then
        cat conftest.err >&AS_MESSAGE_LOG_FD
-      elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load 
conftest >/dev/null 2>&1 ; then
+      elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load 
conftest >/dev/null 2>&1 ; then
        lt_cv_ld_force_load=yes
       else
        cat conftest.err >&AS_MESSAGE_LOG_FD
@@ -1702,7 +1702,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
       # we can't tell.
       while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
                 = "X$teststring$teststring"; } >/dev/null 2>&1 &&
-             test $i != 17 # 1/2 MB should be enough
+             test 17 != "$i" # 1/2 MB should be enough
       do
         i=`expr $i + 1`
         teststring=$teststring$teststring
@@ -1718,7 +1718,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
     ;;
   esac
 ])
-if test -n $lt_cv_sys_max_cmd_len ; then
+if test -n "$lt_cv_sys_max_cmd_len" ; then
   AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
 else
   AC_MSG_RESULT(none)
@@ -2308,7 +2308,7 @@ amigaos*)
   m68k)
     library_names_spec='$libname.ixlibrary $libname.a'
     # Create ${libname}_ixlibrary.a entries in /sys/libs.
-    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do 
libname=`func_echo_all "$lib" | $SED 
'\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM 
/sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib 
${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || 
exit 1; done'
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do 
libname=`func_echo_all "$lib" | $SED 
'\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; $RM 
/sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib 
${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || 
exit 1; done'
     ;;
   esac
   ;;
@@ -2944,7 +2944,7 @@ dnl not every word.  This closes a longstanding sh 
security hole.
   for ac_dir in $ac_dummy; do
     IFS=$lt_save_ifs
     test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$1; then
+    if test -f "$ac_dir/$1"; then
       lt_cv_path_MAGIC_CMD=$ac_dir/"$1"
       if test -n "$file_magic_test_file"; then
        case $deplibs_check_method in
@@ -4986,7 +4986,7 @@ _LT_EOF
        # need to do runtime linking.
        case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
          for ld_flag in $LDFLAGS; do
-         if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+         if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then
            aix_use_runtimelinking=yes
            break
          fi
@@ -5064,7 +5064,7 @@ _LT_EOF
         # empty executable.
         _LT_SYS_MODULE_PATH_AIX([$1])
         _LT_TAGVAR(hardcode_libdir_flag_spec, 
$1)='${wl}-blibpath:$libdir:'"$aix_libpath"
-        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname 
$libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test 
"x${allow_undefined_flag}" != "x"; then func_echo_all 
"${wl}${allow_undefined_flag}"; else :; fi` 
'"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname 
$libobjs $deplibs ${wl}'$no_entry_flag' $compiler_flags `if test 
"x${allow_undefined_flag}" != "x"; then func_echo_all 
"${wl}${allow_undefined_flag}"; else :; fi` 
${wl}'$exp_sym_flag:\$export_symbols' '$shared_flag
       else
        if test "$host_cpu" = ia64; then
          _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R 
$libdir:/usr/lib:/lib'
@@ -5216,9 +5216,9 @@ _LT_EOF
 
     hpux9*)
       if test "$GCC" = yes; then
-       _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared 
$pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs 
$deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv 
$output_objdir/$soname $lib'
+       _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared 
$pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs 
$deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv 
$output_objdir/$soname $lib'
       else
-       _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b 
$install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test 
$output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+       _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b 
$install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test 
"x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib'
       fi
       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
       _LT_TAGVAR(hardcode_libdir_separator, $1)=:
@@ -6063,7 +6063,7 @@ if test "$_lt_caught_CXX_error" != yes; then
           _LT_SYS_MODULE_PATH_AIX([$1])
           _LT_TAGVAR(hardcode_libdir_flag_spec, 
$1)='${wl}-blibpath:$libdir:'"$aix_libpath"
 
-          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname 
$libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test 
"x${allow_undefined_flag}" != "x"; then func_echo_all 
"${wl}${allow_undefined_flag}"; else :; fi` 
'"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname 
$libobjs $deplibs ${wl}'$no_entry_flag' $compiler_flags `if test 
"x${allow_undefined_flag}" != "x"; then func_echo_all 
"${wl}${allow_undefined_flag}"; else :; fi` 
${wl}'$exp_sym_flag:\$export_symbols' '$shared_flag
         else
           if test "$host_cpu" = ia64; then
            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R 
$libdir:/usr/lib:/lib'
@@ -6244,7 +6244,7 @@ if test "$_lt_caught_CXX_error" != yes; then
             _LT_TAGVAR(ld_shlibs, $1)=no
             ;;
           aCC*)
-            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b 
${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs 
$deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || 
mv $output_objdir/$soname $lib'
+            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b 
${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs 
$deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = 
"x$lib" || mv $output_objdir/$soname $lib'
             # Commands to make compiler produce verbose output that lists
             # what "hidden" libraries, object files and flags are used when
             # linking a shared library.
@@ -6257,7 +6257,7 @@ if test "$_lt_caught_CXX_error" != yes; then
             ;;
           *)
             if test "$GXX" = yes; then
-              _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC 
-shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o 
$output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects 
$compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname 
$lib'
+              _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC 
-shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o 
$output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects 
$compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv 
$output_objdir/$soname $lib'
             else
               # FIXME: insert proper C++ library support
               _LT_TAGVAR(ld_shlibs, $1)=no
@@ -6267,7 +6267,7 @@ if test "$_lt_caught_CXX_error" != yes; then
         ;;
 
       hpux10*|hpux11*)
-        if test $with_gnu_ld = no; then
+        if test no = "$with_gnu_ld"; then
          _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
          _LT_TAGVAR(hardcode_libdir_separator, $1)=:
 
@@ -6322,7 +6322,7 @@ if test "$_lt_caught_CXX_error" != yes; then
            ;;
           *)
            if test "$GXX" = yes; then
-             if test $with_gnu_ld = no; then
+             if test no = "$with_gnu_ld"; then
                case $host_cpu in
                  hppa*64*)
                    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC 
${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects 
$compiler_flags'
@@ -6996,8 +6996,8 @@ if AC_TRY_EVAL(ac_compile); then
     -L* | -R* | -l*)
        # Some compilers place space between "-{L,R}" and the path.
        # Remove the space.
-       if test $p = "-L" ||
-          test $p = "-R"; then
+       if test x-L = "$p" ||
+          test x-R = "$p"; then
         prev=$p
         continue
        fi
@@ -7733,7 +7733,7 @@ lt_ac_count=0
 # Add /usr/xpg4/bin/sed as it is typically found on Solaris
 # along with /bin/sed that truncates output.
 for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
-  test ! -f $lt_ac_sed && continue
+  test ! -f "$lt_ac_sed" && continue
   cat /dev/null > conftest.in
   lt_ac_count=0
   echo $ECHO_N "0123456789$ECHO_C" >conftest.in
@@ -7750,9 +7750,9 @@ for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
     $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
     cmp -s conftest.out conftest.nl || break
     # 10000 chars as input seems more than enough
-    test $lt_ac_count -gt 10 && break
+    test "$lt_ac_count" -gt 10 && break
     lt_ac_count=`expr $lt_ac_count + 1`
-    if test $lt_ac_count -gt $lt_ac_max; then
+    if test "$lt_ac_count" -gt "$lt_ac_max"; then
       lt_ac_max=$lt_ac_count
       lt_cv_path_SED=$lt_ac_sed
     fi
@@ -7782,7 +7782,7 @@ xsi_shell=no
 ( _lt_dummy=a/b/c
   test 
"${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
       = c,a/b,b/c, \
-    && eval 'test $(( 1 + 1 )) -eq 2 \
+    && eval 'test 2 -eq $(( 1 + 1 )) \
     && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
   && xsi_shell=yes
 AC_MSG_RESULT([$xsi_shell])
diff --git a/m4/ltdl.m4 b/m4/ltdl.m4
index 6a6f45f..2787669 100644
--- a/m4/ltdl.m4
+++ b/m4/ltdl.m4
@@ -146,7 +146,7 @@ dnl AC_DEFUN([AC_LIBLTDL_INSTALLABLE], [])
 # -----------------
 # Code shared by LTDL_INSTALLABLE and LTDL_INIT([installable]).
 m4_defun([_LTDL_INSTALLABLE],
-[if test -f $prefix/lib/libltdl.la; then
+[if test -f "$prefix/lib/libltdl.la"; then
   lt_save_LDFLAGS=$LDFLAGS
   LDFLAGS="-L$prefix/lib $LDFLAGS"
   AC_CHECK_LIB([ltdl], [lt_dlinit], [lt_lib_ltdl=yes])
diff --git a/tests/bindir.at b/tests/bindir.at
index a3684a9..5d76f8b 100644
--- a/tests/bindir.at
+++ b/tests/bindir.at
@@ -276,7 +276,7 @@ do
   # simplify this check by taking advantage of the fact that if it's a DLL,
   # it has to go in bindir, so we'll not check for both forms in libdir.
   if $bindirneeded; then
-    AT_CHECK([test -f $libdir/../bin/???foo-0.dll || ls 
$libdir/../bin/*foo*0*], [], [ignore], [ignore])
+    AT_CHECK([test -f "$libdir"/../bin/???foo-0.dll || ls 
"$libdir"/../bin/*foo*0*], [], [ignore], [ignore])
   else
     AT_CHECK([ls $libdir/*foo*], [], [ignore], [ignore])
   fi
@@ -335,14 +335,14 @@ do
     # Recreate directories (bindir already done) and install.
     AS_MKDIR_P($libdir)
     AS_MKDIR_P($curdir/sbin)
-    AT_CHECK([$LIBTOOL --mode=install $lt_INSTALL libfoo.la $libdir], [], 
[ignore], [ignore])
-    AT_CHECK([$LIBTOOL --mode=install $lt_INSTALL main$EXEEXT 
$curdir/sbin/main$EXEEXT], [], [ignore], [ignore])
+    AT_CHECK([$LIBTOOL --mode=install $lt_INSTALL libfoo.la "$libdir"], [], 
[ignore], [ignore])
+    AT_CHECK([$LIBTOOL --mode=install $lt_INSTALL main$EXEEXT 
"$curdir/sbin/main$EXEEXT"], [], [ignore], [ignore])
 
     # Ensure it went to bindir rather than default dir this time.
     if $bindirneeded; then
-      AT_CHECK([test -f $bindir/???foo-0.dll || ls $bindir/*foo*0*], [], 
[ignore], [ignore])
+      AT_CHECK([test -f "$bindir"/???foo-0.dll || ls "$bindir"/*foo*0*], [], 
[ignore], [ignore])
     else
-      AT_CHECK([ls $libdir/*foo*], [], [ignore], [ignore])
+      AT_CHECK([ls "$libdir"/*foo*], [], [ignore], [ignore])
     fi
 
     # And that it can be executed.
diff --git a/tests/configure-iface.at b/tests/configure-iface.at
index 2071646..e63b5c6 100644
--- a/tests/configure-iface.at
+++ b/tests/configure-iface.at
@@ -145,8 +145,8 @@ LT_AT_BOOTSTRAP([--ltdl], [-I libltdl/m4], [], 
[--add-missing], [],
         [--with-included-ltdl --prefix=$prefix], [all install])
 
 # TODO: Check that the installed program `main' is linked against our libltdl
-AT_CHECK([test -f $prefix/lib/libltdl.la])
-AT_CHECK([test -f $prefix/include/ltdl.h])
+AT_CHECK([test -f "$prefix/lib/libltdl.la"])
+AT_CHECK([test -f "$prefix/include/ltdl.h"])
 
 # Check that main is rebuilt if libltdl.la is newer
 rm -f libltdl/libltdl.la
@@ -175,8 +175,8 @@ LT_AT_MAKE([all install])
 # Remove build files
 rm -rf ltdl/
 
-AT_CHECK([test -f $prefix/lib/libltdl.la])
-AT_CHECK([test -f $prefix/include/ltdl.h])
+AT_CHECK([test -f "$prefix/lib/libltdl.la"])
+AT_CHECK([test -f "$prefix/include/ltdl.h"])
 
 _LT_AT_LTDL_SETUP
 
diff --git a/tests/cwrapper.at b/tests/cwrapper.at
index cb89a40..b08a61a 100644
--- a/tests/cwrapper.at
+++ b/tests/cwrapper.at
@@ -187,7 +187,7 @@ AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS 
-no-fast-install ]dnl
         [], [ignore], [ignore])
 
 # Skip if no cwrapper is generated.
-AT_CHECK([test -f $objdir/lt-usea.c || exit 77])
+AT_CHECK([test -f "$objdir/lt-usea.c" || exit 77])
 
 # Try to make sure the test is relevant.
 AT_CHECK([grep ' *fputs' $objdir/lt-usea.c > /dev/null])
diff --git a/tests/darwin.at b/tests/darwin.at
index e2abe1a..11be3aa 100644
--- a/tests/darwin.at
+++ b/tests/darwin.at
@@ -251,7 +251,7 @@ AT_CHECK([test "$shared_ext" != "$module_ext" || exit 77])
 # Skip this test when called from:
 #    make distcheck DISTCHECK_CONFIGURE_FLAGS=--disable-ltdl-install
 AT_CHECK([case $LIBLTDL in #(
- */_inst/lib/*) test -f $LIBLTDL || (exit 77) ;;
+ */_inst/lib/*) test -f "$LIBLTDL" || (exit 77) ;;
 esac], [], [ignore])
 
 prefix=`pwd`/inst
diff --git a/tests/defs.m4sh b/tests/defs.m4sh
index 4d66cec..0943d23 100644
--- a/tests/defs.m4sh
+++ b/tests/defs.m4sh
@@ -141,7 +141,7 @@ func_rmprefixdir ()
 {
     $debug_cmd
 
-    test -d $prefix && rm -rf $prefix
+    test -d "$prefix" && rm -rf "$prefix"
     prefix=NONE
 }
 
@@ -338,7 +338,7 @@ func_exec ()
        exec_status=$EXIT_SKIP
       else
        # Simple check to see if they are superuser.
-       if test $exec_status = $EXIT_FAILURE || test -w /; then :
+       if test "$exec_status" = "$EXIT_FAILURE" || test -w /; then :
        else
          func_msg "You may need to run $0 as the superuser."
        fi
diff --git a/tests/demo-hardcode.test b/tests/demo-hardcode.test
index 0e48690..269c2ff 100755
--- a/tests/demo-hardcode.test
+++ b/tests/demo-hardcode.test
@@ -98,7 +98,7 @@ for file in hc-*; do
   # Check the result.
   case $hardcoded in
   yes)
-    if test $expected = yes; then
+    if test yes = "$expected"; then
       echo "$objdir was hardcoded in \`$file', as libtool expected"
     else
       echo "$objdir was hardcoded in \`$file', which fooled libtool" 1>&2
@@ -107,7 +107,7 @@ for file in hc-*; do
     ;;
 
   no)
-    if test $expected = no; then
+    if test no = "$expected"; then
       echo "$objdir was not hardcoded in \`$file', as libtool expected"
     else
       echo "$objdir was not hardcoded in \`$file', which fooled libtool" 1>&2
@@ -116,7 +116,7 @@ for file in hc-*; do
     ;;
 
   unsupported)
-    if test $expected = unsupported; then
+    if test unsupported = "$expected"; then
       echo "\`$file' was not linked properly, as libtool expected"
     else
       echo "\`$file' was not linked properly, which fooled libtool" 1>&2
diff --git a/tests/dlloader-api.at b/tests/dlloader-api.at
index 3215c3b..c277e08 100644
--- a/tests/dlloader-api.at
+++ b/tests/dlloader-api.at
@@ -415,7 +415,7 @@ last_exit: last_ctx
 # Skip this test when called from:
 #    make distcheck DISTCHECK_CONFIGURE_FLAGS=--disable-ltdl-install
 AT_CHECK([case $LIBLTDL in #(
- */_inst/lib/*) test -f $LIBLTDL || (exit 77) ;;
+ */_inst/lib/*) test -f "$LIBLTDL" || (exit 77) ;;
 esac], [], [ignore])
 
 CPPFLAGS="$LTDLINCL $CPPFLAGS"
diff --git a/tests/exceptions.at b/tests/exceptions.at
index c1dcce1..fdb341f 100644
--- a/tests/exceptions.at
+++ b/tests/exceptions.at
@@ -31,7 +31,7 @@ AT_KEYWORDS([libltdl])
 # Skip this test when called from:
 #    make distcheck DISTCHECK_CONFIGURE_FLAGS=--disable-ltdl-install
 AT_CHECK([case $LIBLTDL in #(
- */_inst/lib/*) test -f $LIBLTDL || (exit 77) ;;
+ */_inst/lib/*) test -f "$LIBLTDL" || (exit 77) ;;
 esac], [], [ignore])
 
 CPPFLAGS="$LTDLINCL $CPPFLAGS"
diff --git a/tests/getopt-m4sh.at b/tests/getopt-m4sh.at
index 4c11dbf..0728760 100644
--- a/tests/getopt-m4sh.at
+++ b/tests/getopt-m4sh.at
@@ -48,7 +48,7 @@ m4_pattern_forbid([m4_include])
 m4_pattern_forbid([AS_INIT])
 AT_CHECK([$M4SH --version || exit 77], [], [ignore], [ignore])
 AT_CHECK([$M4SH -B $abs_top_srcdir/build-aux options.m4sh > t-options],
-        [], [], [], [AT_CHECK([test $at_status -eq 63 && exit 77])])
+        [], [], [], [AT_CHECK([test "$at_status" -eq 63 && exit 77])])
 $SED "s,@LN_S\@,$LN_S,g;s,@SED\@,$SED,g" t-options > options
 ])# _LT_AT_GETOPT_M4SH_SETUP
 
diff --git a/tests/lalib-syntax.at b/tests/lalib-syntax.at
index 2eea98f..eca9ba5 100644
--- a/tests/lalib-syntax.at
+++ b/tests/lalib-syntax.at
@@ -73,7 +73,7 @@ AT_DATA([module.c],
 # Skip this test when called from:
 #    make distcheck DISTCHECK_CONFIGURE_FLAGS=--disable-ltdl-install
 AT_CHECK([case $LIBLTDL in #(
- */_inst/lib/*) test -f $LIBLTDL || (exit 77) ;;
+ */_inst/lib/*) test -f "$LIBLTDL" || (exit 77) ;;
 esac], [], [ignore])
 
 CPPFLAGS="$CPPFLAGS $LTDLINCL"
diff --git a/tests/link-2.test b/tests/link-2.test
index 9c7c8c6..1418c01 100755
--- a/tests/link-2.test
+++ b/tests/link-2.test
@@ -38,7 +38,7 @@ res=$?
 
 rm -f hell.lo
 
-test $res -eq 0 || exit $EXIT_FAILURE
+test "$res" -eq 0 || exit $EXIT_FAILURE
 
 echo "$linkresult"
 case $linkresult in
diff --git a/tests/link-order2.at b/tests/link-order2.at
index a6eea0e..2f0096b 100644
--- a/tests/link-order2.at
+++ b/tests/link-order2.at
@@ -100,7 +100,7 @@ $LIBTOOL --mode=clean rm -f liba0.la
 
 for type_of_depdepl in libtool non-libtool; do
   echo "type of depdepl: $type_of_depdepl"
-  if test $type_of_depdepl = non-libtool; then
+  if test non-libtool = "$type_of_depdepl"; then
     # Simulate a non-Libtool system library.
     rm $deflibdir/liba1.la
     addpath=$deflibdir
@@ -126,7 +126,7 @@ for type_of_depdepl in libtool non-libtool; do
     # Now test that if we reverse the link order, the program fails.
     AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS $static -o 
wrong$EXEEXT main.$OBJEXT -la0 libb.la],
             [], [ignore], [ignore])
-    if test $shared_fails,$static != yes,; then
+    if test yes, != "$shared_fails,$static"; then
       LT_AT_EXEC_CHECK([./wrong], [1], [], [ignore], [|| (exit 1)])
     fi
 
@@ -136,13 +136,13 @@ for type_of_depdepl in libtool non-libtool; do
     $LIBTOOL --mode=install cp wrong$EXEEXT $bindir/wrong$EXEEXT
     $LIBTOOL --mode=clean rm -f liba1.la libb.la
     LT_AT_EXEC_CHECK([$bindir/main])
-    if test $shared_fails,$static != yes,; then
+    if test yes, = "$shared_fails,$static"; then
       LT_AT_EXEC_CHECK([$bindir/wrong], [1], [], [ignore], [|| (exit 1)])
     fi
   done
 done
 
-AT_CHECK([test $shared_fails = no || (exit 77)])
+AT_CHECK([test no = "$shared_fails" || (exit 77)])
 
 # Now the converse: if both the program and the library need libm, then
 # it needs to be sorted last.  (TODO)
diff --git a/tests/loadlibrary.at b/tests/loadlibrary.at
index e87cb90..58b8463 100644
--- a/tests/loadlibrary.at
+++ b/tests/loadlibrary.at
@@ -215,7 +215,7 @@ barsym (void)
 # Skip this test when called from:
 #    make distcheck DISTCHECK_CONFIGURE_FLAGS=--disable-ltdl-install
 AT_CHECK([case $LIBLTDL in #(
- */_inst/lib/*) test -f $LIBLTDL || (exit 77) ;;
+ */_inst/lib/*) test -f "$LIBLTDL" || (exit 77) ;;
 esac], [], [ignore])
 
 CPPFLAGS="$LTDLINCL $CPPFLAGS"
diff --git a/tests/lt_dladvise.at b/tests/lt_dladvise.at
index 48cf5e9..9bcc73d 100644
--- a/tests/lt_dladvise.at
+++ b/tests/lt_dladvise.at
@@ -313,7 +313,7 @@ preload: 6
 # Skip this test when called from:
 #    make distcheck DISTCHECK_CONFIGURE_FLAGS=--disable-ltdl-install
 AT_CHECK([case $LIBLTDL in #(
- */_inst/lib/*) test -f $LIBLTDL || (exit 77) ;;
+ */_inst/lib/*) test -f "$LIBLTDL" || (exit 77) ;;
 esac], [], [ignore])
 
 CPPFLAGS="$LTDLINCL $CPPFLAGS"
@@ -357,7 +357,7 @@ $CC $CPPFLAGS $CFLAGS -c main.c
 for name in resident local global preload; do
   # FIXME: adding -static to libpreload shouldn't be necessary.
   #        Fix this properly in ltmain, then remove this workaround.
-  if test $name = preload; then
+  if test preload = "$name"; then
     st=-static
   else
     st=
diff --git a/tests/lt_dlexit.at b/tests/lt_dlexit.at
index 9441f8a..d2fc58e 100644
--- a/tests/lt_dlexit.at
+++ b/tests/lt_dlexit.at
@@ -139,7 +139,7 @@ int vb1 = 3;
 # Skip this test when called from:
 #    make distcheck DISTCHECK_CONFIGURE_FLAGS=--disable-ltdl-install
 AT_CHECK([case $LIBLTDL in #(
- */_inst/lib/*) test -f $LIBLTDL || (exit 77) ;;
+ */_inst/lib/*) test -f "$LIBLTDL" || (exit 77) ;;
 esac], [], [ignore])
 
 CPPFLAGS="$LTDLINCL $CPPFLAGS"
diff --git a/tests/lt_dlopen_a.at b/tests/lt_dlopen_a.at
index 4844d06..f1c82b5 100644
--- a/tests/lt_dlopen_a.at
+++ b/tests/lt_dlopen_a.at
@@ -91,7 +91,7 @@ mkdir -p $bindir
 
 AT_CHECK([$LIBTOOL --mode=install cp plugin.la $libdir],[], [ignore], [ignore])
 AT_CHECK([$LIBTOOL --mode=install cp main$EXEEXT $bindir],[], [ignore], 
[ignore])
-AT_CHECK([test -f $libdir/plugin.a || exit 77])
+AT_CHECK([test -f "$libdir/plugin.a" || exit 77])
 LT_AT_EXEC_CHECK([$bindir/main], [], [ignore], [ignore],[$libdir/plugin.la])
 
 AT_CLEANUP
diff --git a/tests/lt_dlopenext.at b/tests/lt_dlopenext.at
index 16b5b75..bf5d04f 100644
--- a/tests/lt_dlopenext.at
+++ b/tests/lt_dlopenext.at
@@ -186,7 +186,7 @@ dlerrordup (char *errormsg)
 # Skip this test when called from:
 #    make distcheck DISTCHECK_CONFIGURE_FLAGS=--disable-ltdl-install
 AT_CHECK([case $LIBLTDL in #(
- */_inst/lib/*) test -f $LIBLTDL || (exit 77) ;;
+ */_inst/lib/*) test -f "$LIBLTDL" || (exit 77) ;;
 esac], [], [ignore])
 
 CPPFLAGS="$LTDLINCL $CPPFLAGS"
@@ -227,7 +227,7 @@ if test "$shlibpath_var" = PATH; then
 fi
 
 for lafile in $have_lafile; do
-  if test $lafile = without; then
+  if test without = "$lafile"; then
     rm $libdir/simple-module.la
   fi
 
diff --git a/tests/need_lib_prefix.at b/tests/need_lib_prefix.at
index 02610f1..2b162eb 100644
--- a/tests/need_lib_prefix.at
+++ b/tests/need_lib_prefix.at
@@ -147,7 +147,7 @@ libfoo2: 3
 # Skip this test when called from:
 #    make distcheck DISTCHECK_CONFIGURE_FLAGS=--disable-ltdl-install
 AT_CHECK([case $LIBLTDL in #(
- */_inst/lib/*) test -f $LIBLTDL || (exit 77) ;;
+ */_inst/lib/*) test -f "$LIBLTDL" || (exit 77) ;;
 esac], [], [ignore])
 
 CPPFLAGS="$LTDLINCL $CPPFLAGS"
diff --git a/tests/nonrecursive.at b/tests/nonrecursive.at
index fa8cfb6..92af12f 100644
--- a/tests/nonrecursive.at
+++ b/tests/nonrecursive.at
@@ -140,8 +140,8 @@ done
 LT_AT_BOOTSTRAP([ignore], [-I ltdl/m4], [], [--add-missing --copy],
        [], [--enable-ltdl-install --prefix=$prefix], [all install $tst_dist])
 
-AT_CHECK([test -f $prefix/lib/libltdl.la])
-AT_CHECK([test -f $prefix/include/ltdl.h])
+AT_CHECK([test -f "$prefix/lib/libltdl.la"])
+AT_CHECK([test -f "$prefix/include/ltdl.h"])
 
 AT_CLEANUP
 
diff --git a/tests/recursive.at b/tests/recursive.at
index f279398..eec9e63 100644
--- a/tests/recursive.at
+++ b/tests/recursive.at
@@ -110,8 +110,8 @@ LT_AT_AUTORECONF([--force --verbose --install])
 LT_AT_CONFIGURE([--enable-ltdl-install --prefix=$prefix])
 LT_AT_MAKE([all install $tst_dist])
 
-AT_CHECK([test -f $prefix/lib/libltdl.la])
-AT_CHECK([test -f $prefix/include/ltdl.h])
+AT_CHECK([test -f "$prefix/lib/libltdl.la"])
+AT_CHECK([test -f "$prefix/include/ltdl.h"])
 
 AT_CLEANUP
 
diff --git a/tests/resident.at b/tests/resident.at
index cf00688..508cbfe 100644
--- a/tests/resident.at
+++ b/tests/resident.at
@@ -126,7 +126,7 @@ setup_plugin (void)
 # Skip this test when called from:
 #    make distcheck DISTCHECK_CONFIGURE_FLAGS=--disable-ltdl-install
 AT_CHECK([case $LIBLTDL in #(
- */_inst/lib/*) test -f $LIBLTDL || (exit 77) ;;
+ */_inst/lib/*) test -f "$LIBLTDL" || (exit 77) ;;
 esac], [], [ignore])
 
 CPPFLAGS="$LTDLINCL $CPPFLAGS"
diff --git a/tests/sh.test b/tests/sh.test
deleted file mode 100755
index 5c6d675..0000000
--- a/tests/sh.test
+++ /dev/null
@@ -1,134 +0,0 @@
-#! /bin/sh
-# sh.test - check for some nonportable or dubious or undesired shell
-#           constructs in shell scripts.
-#
-#   Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2010 Free
-#   Software Foundation, Inc.
-#   Written by Gary V. Vaughan, 2003
-#
-#   This file is part of GNU Libtool.
-#
-# GNU Libtool is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# GNU Libtool is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Libtool; see the file COPYING.  If not, a copy
-# can be downloaded from  http://www.gnu.org/licenses/gpl.html,
-# or obtained by writing to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-####
-
-. tests/defs || exit 1
-
-# Check all the "portable" shell scripts.
-status=$EXIT_SUCCESS
-
-# Check for bad binary operators.
-if $EGREP -n -e 'if[    ]+["'\'']?\$[^  ]+[     ]+(=|-[lg][te]|-eq|-ne)' 
$scripts; then
-  echo "use \`if test \$something =' instead of \`if \$something ='"
-  status=$EXIT_FAILURE
-fi
-
-# Check for bad unary operators.
-if $EGREP -n -e 'if[    ]+-' $scripts; then
-  echo "use \`if test -X' instead of \`if -X'"
-  status=$EXIT_FAILURE
-fi
-
-# Check for using `[' instead of `test'.
-if $EGREP -n -e 'if[    ]+\[' $scripts; then
-  echo "use \`if test' instead of \`if ['"
-  status=$EXIT_FAILURE
-fi
-
-# Check for using test X... instead of test "X...
-if $EGREP -n -e 'test[  ]+(![   ])?(-.[         ]+)?X' $scripts; then
-  echo "use \`test \"X...\"' instead of \`test X'"
-  status=$EXIT_FAILURE
-fi
-
-# Check for using test $... instead of test "$...
-if $EGREP -n -e 'test[  ]+(![   ])?(-.[         ]+)?X?\$' $scripts; then
-  echo "use \`test \"\$...\"' instead of \`test \$'"
-  status=$EXIT_FAILURE
-fi
-
-# Never use test -e.
-if $EGREP -n -e 'test[  ]+(![   ])?-e' $scripts; then
-  echo "use \`test -f' instead of \`test -e'"
-  status=$EXIT_FAILURE
-fi
-
-# Check for uses of Xsed without corresponding echo "X
-if $EGREP -n -e '\$Xsed' $scripts | $EGREP -v -n -e '\$ECHO \\*"X'; then
-  echo "occurrences of \`\$Xsed\' without \`echo \"X\' on the same line"
-  status=$EXIT_FAILURE
-fi
-
-# Check for quotes within backquotes within quotes "`"bar"`"
-if $EGREP -n -e '"[^`"]*`[^"`]*"[^"`]*".*`[^`"]*"' $scripts | \
-   $EGREP -v "### testsuite: skip nested quoting test$"; then
-  echo "nested quotes are dangerous"
-  status=$EXIT_FAILURE
-fi
-
-# Check for using set -- instead of set dummy
-if $EGREP -n -e 'set[   ]+--[   ]+' $scripts; then
-  echo "use \`set dummy ...' instead of \`set -- ...'"
-  status=$EXIT_FAILURE
-fi
-
-# Check for using shift after set dummy (same or following line).
-for s in $scripts
-do
-  if $SED -n '
-      /set[     ][      ]*dummy/{
-         /set.*dummy.*;.*shift/d
-         N
-         /\n.*shift/D
-         p
-      }' "$s" | $EGREP .; then
-    echo "use \`shift' after \`set dummy' in $s"
-    status=$EXIT_FAILURE
-  fi
-done
-
-# Check for opening brace on next line in shell function definition.
-# redirect stderr so we also barf when sed issues diagnostics.
-for s in $scripts
-do
-  if $SED -n '
-      /^func_.*(/{
-         N
-         /^func_[^      ]* ()\n{$/d
-         p
-      }' "$s" 2>&1 | $EGREP .; then
-    echo "Function definitions should look like this in $s:
-func_foo ()
-{
-  # ...
-}"
-    status=$EXIT_FAILURE
-  fi
-done
-
-# Check for correct usage of $cc_basename.
-# redirect stderr so we also barf when sed issues diagnostics.
-for s in "$abs_macro_dir/libtool.m4"
-do
-  if $SED -n '/case \$cc_basename in/,/esac/ {
-             /^[        ]*[a-zA-Z][a-zA-Z0-9+]*[^*][    ]*)/p
-             }'  $s 2>&1 | $EGREP .; then
-    echo "\$cc_basename matches should include a trailing \`*' in $s."
-    status=$EXIT_FAILURE
-  fi
-done
-
-exit $status
diff --git a/tests/standalone.at b/tests/standalone.at
index 39b77c4..50c98d6 100644
--- a/tests/standalone.at
+++ b/tests/standalone.at
@@ -66,8 +66,8 @@ LT_AT_CHECK_LIBTOOLIZE([--copy --ltdl=.], [], [ignore])
 LT_AT_CONFIGURE([--enable-ltdl-install --prefix=$prefix])
 LT_AT_MAKE([all install $tst_dist])
 
-AT_CHECK([test -f $prefix/lib/libltdl.la])
-AT_CHECK([test -f $prefix/include/ltdl.h])
+AT_CHECK([test -f "$prefix/lib/libltdl.la"])
+AT_CHECK([test -f "$prefix/include/ltdl.h"])
 
 AT_CLEANUP
 
diff --git a/tests/static.at b/tests/static.at
index 5b779e6..6007898 100644
--- a/tests/static.at
+++ b/tests/static.at
@@ -327,7 +327,7 @@ for withdep in no yes; do
   # - remove the library images to catch failure to link 
statically/dynamically,
   # - add false other deplibs in the paths to catch (some) wrongly added run 
paths.
 
-  # if -all-static does not work, do not exercise it any more.
+  # if `-all-static' does not work, do not exercise it any more.
   all_static=-all-static
   test -z "$link_static_flag" && all_static=
 
diff --git a/tests/stresstest.at b/tests/stresstest.at
index 4722ffd..28e7191 100644
--- a/tests/stresstest.at
+++ b/tests/stresstest.at
@@ -264,7 +264,7 @@ do
                 [0],[ignore],[ignore])
        for st in '' '-static' '-no-install'
        do
-         # if -static is not passed, and the library is shared, then we have
+         # if `-static' is not passed, and the library is shared, then we have
          # to use -DLIBA_DLL_IMPORT, thus main.lo (and not main-static.lo).
          case $st,$l3 in
          -static,*) mst=-static ;;
diff --git a/tests/subproject.at b/tests/subproject.at
index 0e003a3..11c0d69 100644
--- a/tests/subproject.at
+++ b/tests/subproject.at
@@ -96,8 +96,8 @@ LT_AT_BOOTSTRAP([--copy --ltdl], [-I sub/ltdl/m4], [ignore],
        [--add-missing --copy], [], [--enable-ltdl-install --prefix=$prefix],
        [all install $tst_dist])
 
-AT_CHECK([test -f $prefix/lib/libltdl.la])
-AT_CHECK([test -f $prefix/include/ltdl.h])
+AT_CHECK([test -f "$prefix/lib/libltdl.la"])
+AT_CHECK([test -f "$prefix/include/ltdl.h"])
 
 AT_CLEANUP
 
diff --git a/tests/sysroot.at b/tests/sysroot.at
index 90aab6f..524db5e 100644
--- a/tests/sysroot.at
+++ b/tests/sysroot.at
@@ -144,7 +144,7 @@ LT_AT_BOOTSTRAP([], [-I $abs_top_srcdir/libltdl/m4], 
[ignore],
                [--add-missing], [], [], [all])
 
 AT_CHECK([$MAKE install DESTDIR=$sysroot], [0], [ignore], [ignore])
-AT_CHECK([test -f $sysroot/$prefix/lib/lib2.la])
+AT_CHECK([test -f "$sysroot/$prefix/lib/lib2.la"])
 AT_CHECK([grep -F "$sysroot" "$sysroot/$prefix/lib/lib2.la"], [1])
 cd ..
 
@@ -184,7 +184,7 @@ LT_AT_BOOTSTRAP([], [-I $abs_top_srcdir/libltdl/m4], 
[ignore],
                [--add-missing], [], [], [all])
 
 AT_CHECK([$MAKE install DESTDIR=$sysroot], [0], [ignore], [ignore])
-AT_CHECK([test -f $sysroot/$prefix/bin/prog$EXEEXT])
+AT_CHECK([test -f "$sysroot/$prefix/bin/prog$EXEEXT"])
 AT_CHECK([grep -F "$sysroot" "$sysroot/$prefix/bin/prog$EXEEXT"], [1])
 AT_CHECK([grep "'.*=" $sysroot/$prefix/lib/lib2.la], [0], [ignore])
 AT_CHECK([./libtool --mode=finish $sysroot/$prefix/lib/lib@<:@12@:>@.la], [0], 
[ignore])
diff --git a/tests/tagtrace.test b/tests/tagtrace.test
index 3c32333..9b737e8 100755
--- a/tests/tagtrace.test
+++ b/tests/tagtrace.test
@@ -35,10 +35,10 @@ fi
 
 ( cd "$abs_srcdir" && $AUTOCONF --trace 'LT_SUPPORTED_TAG:$1' ) >/dev/null
 ret=$?
-if test $ret -eq 63 || test $ret -eq 1; then
+if test "$ret" -eq 63 || test "$ret" -eq 1; then
   func_error "This test requires the same Autoconf version"
   func_skip  "as the one that was used to bootstrap Libtool"
-elif test $ret -ne 0; then
+elif test "$ret" -ne 0; then
   func_fatal_error "\`$AUTOCONF --trace' exited $ret"
 fi
 
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 0c2ffcf..84894e1 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -262,7 +262,7 @@ LT_AT_UNIFY_NL([$1.t], [m4_default([$2], [$1])])[]dnl
 m4_define([LT_AT_EXEC_CHECK],
 [lt_exe=$1; if test -f "$1$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
 AT_CHECK([if "$lt_exe" $5; then :; else lt_status=$?; ]dnl
-        [  m4_ifval([$2], [test $lt_status != $2 && ])]dnl
+        [  m4_ifval([$2], [test "$lt_status" != $2 && ])]dnl
         [  test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; ]dnl
         [  exit $lt_status; fi],[$2],[$3],[$4])
 ])
@@ -281,7 +281,7 @@ AT_CHECK([if "$lt_exe" $5; then :; else lt_status=$?; ]dnl
 m4_define([LT_AT_NOINST_EXEC_CHECK],
 [lt_exe=$1; if test -f "$1$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
 AT_CHECK([if $LIBTOOL --mode=execute $2 "$lt_exe" $6; then :; else 
lt_status=$?; ]dnl
-        [  m4_ifval([$3], [test $lt_status != $3 && ])]dnl
+        [  m4_ifval([$3], [test "$lt_status" != $3 && ])]dnl
         [  test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; ]dnl
         [  exit $lt_status; fi],[$3],[$4],[$5])
 ])
-- 
1.7.7.4

Cheers,
-- 
Gary V. Vaughan (gary AT gnu DOT org)

Reply via email to