1997-08-28 02:21:56 +08:00
|
|
|
#! /bin/sh
|
|
|
|
# quote.test - make sure that shell metacharacters do not blow up libtool
|
|
|
|
|
Since the bootstrap process requires that several of the rules for
files generated in doc and tests already lived in
$top_srcdir/Makefile.am, along with proxy rules in sub-Makefiles,
this changeset consolidates almost everything into the top
Makefile.am, simplifying things considerably:
* doc/Makefile.am, tests/Makefile.am: Removed. All rules moved...
* Makefile.am: ...to here and adjusted to run from $top_builddir.
Some reformatting to group rules and declarations by purpose, and
simplify with respect to removing much of the make recursion.
Add `doc/PLATFORMS', `doc/fdl.texi' and `doc/notes.texi'.
`defs.in' and `defs.m4sh' are in directory `tests'.
(uninstall-hook): Don't forget to uninstall libtoolize's libltdl
source tree.
* bootstrap: Simplified dirty makefile management, and bootstrap
file creation in light of having only a single pertinent
Makefile.
* configure.ac (CONF_SUBDIRS): Add tests/ prefix to each subdir to
compensate.
(DIST_MAKEFILE_LIST): Adjust.
(AC_CONFIG_FILES): Remove doc/Makefile and tests/Makefile.
* tests/defs.m4sh (LIBTOOL, scripts): Adjust paths.
* tests/cdemo-conf.test, tests/cdemo-exec.test,
tests/cdemo-make.test, tests/cdemo-shared.test,
tests/cdemo-static.test, tests/cdemo-undef.test,
tests/demo-conf.test, tests/demo-deplibs.test,
tests/demo-exec.test, tests/demo-hardcode.test,
tests/demo-inst.test, tests/demo-make.test,
tests/demo-nofast.test, tests/demo-noinst-link.test,
tests/demo-nopic.test, tests/demo-pic.test,
tests/demo-relink.test, tests/demo-shared.test,
tests/demo-static.test, tests/demo-unst.test,
tests/depdemo-conf.test, tests/depdemo-exec.test,
tests/depdemo-inst.test, tests/depdemo-make.test,
tests/depdemo-nofast.test, tests/depdemo-relink.test,
tests/depdemo-shared.test, tests/depdemo-static.test,
tests/depdemo-unst.test, tests/f77demo-conf.test,
tests/f77demo-exec.test, tests/f77demo-make.test,
tests/f77demo-shared.test, tests/f77demo-static.test,
tests/link-2.test, tests/link.test, tests/mdemo-conf.test,
tests/mdemo-dryrun.test, tests/mdemo-exec.test,
tests/mdemo-inst.test, tests/mdemo-make.test,
tests/mdemo-shared.test, tests/mdemo-static.test,
tests/mdemo-unst.test, tests/mdemo2-conf.test,
tests/mdemo2-exec.test, tests/mdemo2-make.test, tests/nomode.test,
tests/objectlist.test, tests/pdemo-conf.test,
tests/pdemo-exec.test, tests/pdemo-inst.test,
tests/pdemo-make.test, tests/quote.test, tests/sh.test,
tests/suffix.test, tests/tagdemo-conf.test,
tests/tagdemo-exec.test, tests/tagdemo-make.test,
tests/tagdemo-shared.test, tests/tagdemo-static.test,
tests/tagdemo-undef.test, tests/tagtrace.test (func_cd,
func_require): Adjust paths..
2005-04-13 20:24:35 +08:00
|
|
|
# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
|
2003-10-15 05:46:13 +08:00
|
|
|
# This is free software; see the source for copying conditions. There is NO
|
|
|
|
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
# This program 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.
|
|
|
|
#
|
|
|
|
# This program 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 this program; if not, a copy can be downloaded from
|
|
|
|
# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
|
2005-04-22 18:10:31 +08:00
|
|
|
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
|
|
# MA 02110-1301, USA.
|
2003-10-15 05:46:13 +08:00
|
|
|
|
Since the bootstrap process requires that several of the rules for
files generated in doc and tests already lived in
$top_srcdir/Makefile.am, along with proxy rules in sub-Makefiles,
this changeset consolidates almost everything into the top
Makefile.am, simplifying things considerably:
* doc/Makefile.am, tests/Makefile.am: Removed. All rules moved...
* Makefile.am: ...to here and adjusted to run from $top_builddir.
Some reformatting to group rules and declarations by purpose, and
simplify with respect to removing much of the make recursion.
Add `doc/PLATFORMS', `doc/fdl.texi' and `doc/notes.texi'.
`defs.in' and `defs.m4sh' are in directory `tests'.
(uninstall-hook): Don't forget to uninstall libtoolize's libltdl
source tree.
* bootstrap: Simplified dirty makefile management, and bootstrap
file creation in light of having only a single pertinent
Makefile.
* configure.ac (CONF_SUBDIRS): Add tests/ prefix to each subdir to
compensate.
(DIST_MAKEFILE_LIST): Adjust.
(AC_CONFIG_FILES): Remove doc/Makefile and tests/Makefile.
* tests/defs.m4sh (LIBTOOL, scripts): Adjust paths.
* tests/cdemo-conf.test, tests/cdemo-exec.test,
tests/cdemo-make.test, tests/cdemo-shared.test,
tests/cdemo-static.test, tests/cdemo-undef.test,
tests/demo-conf.test, tests/demo-deplibs.test,
tests/demo-exec.test, tests/demo-hardcode.test,
tests/demo-inst.test, tests/demo-make.test,
tests/demo-nofast.test, tests/demo-noinst-link.test,
tests/demo-nopic.test, tests/demo-pic.test,
tests/demo-relink.test, tests/demo-shared.test,
tests/demo-static.test, tests/demo-unst.test,
tests/depdemo-conf.test, tests/depdemo-exec.test,
tests/depdemo-inst.test, tests/depdemo-make.test,
tests/depdemo-nofast.test, tests/depdemo-relink.test,
tests/depdemo-shared.test, tests/depdemo-static.test,
tests/depdemo-unst.test, tests/f77demo-conf.test,
tests/f77demo-exec.test, tests/f77demo-make.test,
tests/f77demo-shared.test, tests/f77demo-static.test,
tests/link-2.test, tests/link.test, tests/mdemo-conf.test,
tests/mdemo-dryrun.test, tests/mdemo-exec.test,
tests/mdemo-inst.test, tests/mdemo-make.test,
tests/mdemo-shared.test, tests/mdemo-static.test,
tests/mdemo-unst.test, tests/mdemo2-conf.test,
tests/mdemo2-exec.test, tests/mdemo2-make.test, tests/nomode.test,
tests/objectlist.test, tests/pdemo-conf.test,
tests/pdemo-exec.test, tests/pdemo-inst.test,
tests/pdemo-make.test, tests/quote.test, tests/sh.test,
tests/suffix.test, tests/tagdemo-conf.test,
tests/tagdemo-exec.test, tests/tagdemo-make.test,
tests/tagdemo-shared.test, tests/tagdemo-static.test,
tests/tagdemo-undef.test, tests/tagtrace.test (func_cd,
func_require): Adjust paths..
2005-04-13 20:24:35 +08:00
|
|
|
. tests/defs || exit 1
|
1997-08-28 02:21:56 +08:00
|
|
|
|
|
|
|
# Do the torture test.
|
2003-10-15 05:46:13 +08:00
|
|
|
status=$EXIT_SUCCESS
|
1997-08-28 02:21:56 +08:00
|
|
|
|
2005-02-01 01:20:47 +08:00
|
|
|
case $1 in
|
2004-12-28 18:28:21 +08:00
|
|
|
--no-reexec)
|
|
|
|
;;
|
|
|
|
*)
|
Since the bootstrap process requires that several of the rules for
files generated in doc and tests already lived in
$top_srcdir/Makefile.am, along with proxy rules in sub-Makefiles,
this changeset consolidates almost everything into the top
Makefile.am, simplifying things considerably:
* doc/Makefile.am, tests/Makefile.am: Removed. All rules moved...
* Makefile.am: ...to here and adjusted to run from $top_builddir.
Some reformatting to group rules and declarations by purpose, and
simplify with respect to removing much of the make recursion.
Add `doc/PLATFORMS', `doc/fdl.texi' and `doc/notes.texi'.
`defs.in' and `defs.m4sh' are in directory `tests'.
(uninstall-hook): Don't forget to uninstall libtoolize's libltdl
source tree.
* bootstrap: Simplified dirty makefile management, and bootstrap
file creation in light of having only a single pertinent
Makefile.
* configure.ac (CONF_SUBDIRS): Add tests/ prefix to each subdir to
compensate.
(DIST_MAKEFILE_LIST): Adjust.
(AC_CONFIG_FILES): Remove doc/Makefile and tests/Makefile.
* tests/defs.m4sh (LIBTOOL, scripts): Adjust paths.
* tests/cdemo-conf.test, tests/cdemo-exec.test,
tests/cdemo-make.test, tests/cdemo-shared.test,
tests/cdemo-static.test, tests/cdemo-undef.test,
tests/demo-conf.test, tests/demo-deplibs.test,
tests/demo-exec.test, tests/demo-hardcode.test,
tests/demo-inst.test, tests/demo-make.test,
tests/demo-nofast.test, tests/demo-noinst-link.test,
tests/demo-nopic.test, tests/demo-pic.test,
tests/demo-relink.test, tests/demo-shared.test,
tests/demo-static.test, tests/demo-unst.test,
tests/depdemo-conf.test, tests/depdemo-exec.test,
tests/depdemo-inst.test, tests/depdemo-make.test,
tests/depdemo-nofast.test, tests/depdemo-relink.test,
tests/depdemo-shared.test, tests/depdemo-static.test,
tests/depdemo-unst.test, tests/f77demo-conf.test,
tests/f77demo-exec.test, tests/f77demo-make.test,
tests/f77demo-shared.test, tests/f77demo-static.test,
tests/link-2.test, tests/link.test, tests/mdemo-conf.test,
tests/mdemo-dryrun.test, tests/mdemo-exec.test,
tests/mdemo-inst.test, tests/mdemo-make.test,
tests/mdemo-shared.test, tests/mdemo-static.test,
tests/mdemo-unst.test, tests/mdemo2-conf.test,
tests/mdemo2-exec.test, tests/mdemo2-make.test, tests/nomode.test,
tests/objectlist.test, tests/pdemo-conf.test,
tests/pdemo-exec.test, tests/pdemo-inst.test,
tests/pdemo-make.test, tests/quote.test, tests/sh.test,
tests/suffix.test, tests/tagdemo-conf.test,
tests/tagdemo-exec.test, tests/tagdemo-make.test,
tests/tagdemo-shared.test, tests/tagdemo-static.test,
tests/tagdemo-undef.test, tests/tagtrace.test (func_cd,
func_require): Adjust paths..
2005-04-13 20:24:35 +08:00
|
|
|
func_get_config "SHELL" "$LIBTOOL --config"
|
2004-12-28 18:28:21 +08:00
|
|
|
exec $SHELL "$0" --no-reexec ${1+"$@"}
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
Since the bootstrap process requires that several of the rules for
files generated in doc and tests already lived in
$top_srcdir/Makefile.am, along with proxy rules in sub-Makefiles,
this changeset consolidates almost everything into the top
Makefile.am, simplifying things considerably:
* doc/Makefile.am, tests/Makefile.am: Removed. All rules moved...
* Makefile.am: ...to here and adjusted to run from $top_builddir.
Some reformatting to group rules and declarations by purpose, and
simplify with respect to removing much of the make recursion.
Add `doc/PLATFORMS', `doc/fdl.texi' and `doc/notes.texi'.
`defs.in' and `defs.m4sh' are in directory `tests'.
(uninstall-hook): Don't forget to uninstall libtoolize's libltdl
source tree.
* bootstrap: Simplified dirty makefile management, and bootstrap
file creation in light of having only a single pertinent
Makefile.
* configure.ac (CONF_SUBDIRS): Add tests/ prefix to each subdir to
compensate.
(DIST_MAKEFILE_LIST): Adjust.
(AC_CONFIG_FILES): Remove doc/Makefile and tests/Makefile.
* tests/defs.m4sh (LIBTOOL, scripts): Adjust paths.
* tests/cdemo-conf.test, tests/cdemo-exec.test,
tests/cdemo-make.test, tests/cdemo-shared.test,
tests/cdemo-static.test, tests/cdemo-undef.test,
tests/demo-conf.test, tests/demo-deplibs.test,
tests/demo-exec.test, tests/demo-hardcode.test,
tests/demo-inst.test, tests/demo-make.test,
tests/demo-nofast.test, tests/demo-noinst-link.test,
tests/demo-nopic.test, tests/demo-pic.test,
tests/demo-relink.test, tests/demo-shared.test,
tests/demo-static.test, tests/demo-unst.test,
tests/depdemo-conf.test, tests/depdemo-exec.test,
tests/depdemo-inst.test, tests/depdemo-make.test,
tests/depdemo-nofast.test, tests/depdemo-relink.test,
tests/depdemo-shared.test, tests/depdemo-static.test,
tests/depdemo-unst.test, tests/f77demo-conf.test,
tests/f77demo-exec.test, tests/f77demo-make.test,
tests/f77demo-shared.test, tests/f77demo-static.test,
tests/link-2.test, tests/link.test, tests/mdemo-conf.test,
tests/mdemo-dryrun.test, tests/mdemo-exec.test,
tests/mdemo-inst.test, tests/mdemo-make.test,
tests/mdemo-shared.test, tests/mdemo-static.test,
tests/mdemo-unst.test, tests/mdemo2-conf.test,
tests/mdemo2-exec.test, tests/mdemo2-make.test, tests/nomode.test,
tests/objectlist.test, tests/pdemo-conf.test,
tests/pdemo-exec.test, tests/pdemo-inst.test,
tests/pdemo-make.test, tests/quote.test, tests/sh.test,
tests/suffix.test, tests/tagdemo-conf.test,
tests/tagdemo-exec.test, tests/tagdemo-make.test,
tests/tagdemo-shared.test, tests/tagdemo-static.test,
tests/tagdemo-undef.test, tests/tagtrace.test (func_cd,
func_require): Adjust paths..
2005-04-13 20:24:35 +08:00
|
|
|
func_get_config "ECHO" "$LIBTOOL --config"
|
|
|
|
func_get_config "wl" "$LIBTOOL --config"
|
1997-08-29 11:09:18 +08:00
|
|
|
|
1997-08-28 02:21:56 +08:00
|
|
|
for mode in compile link install; do
|
2004-10-03 19:20:53 +08:00
|
|
|
$ECHO "== $mode mode"
|
1997-08-28 02:21:56 +08:00
|
|
|
|
|
|
|
# Unfortunately, without an array data type, it is nearly impossible
|
|
|
|
# to protect libtool from metacharacters in filenames. So, we just
|
|
|
|
# try metacharacters in the options it needs to pass to other programs.
|
|
|
|
|
|
|
|
# preargs and postargs need to go through libtool unmodified.
|
|
|
|
case "$mode" in
|
|
|
|
compile)
|
2001-07-01 04:31:34 +08:00
|
|
|
preargs="$CC -c"
|
1999-12-18 15:50:04 +08:00
|
|
|
preflag=
|
2005-02-01 01:25:22 +08:00
|
|
|
match_preflag=
|
1997-08-28 02:21:56 +08:00
|
|
|
flag="-DVAR="
|
|
|
|
postargs="foo.c"
|
|
|
|
;;
|
|
|
|
|
|
|
|
link)
|
2001-07-01 04:31:34 +08:00
|
|
|
preargs="$CC -o hell -g -O"
|
1999-12-18 15:50:04 +08:00
|
|
|
preflag=-Wl,
|
2005-02-01 01:25:22 +08:00
|
|
|
match_preflag="$wl"
|
1999-12-18 15:50:04 +08:00
|
|
|
flag="-someflag="
|
1997-08-28 02:21:56 +08:00
|
|
|
postargs="foo.o"
|
|
|
|
;;
|
|
|
|
|
|
|
|
install)
|
|
|
|
preargs="install -c"
|
1999-12-18 15:50:04 +08:00
|
|
|
preflag=
|
2005-02-01 01:25:22 +08:00
|
|
|
match_preflag=
|
1997-08-28 02:21:56 +08:00
|
|
|
flag="--something="
|
|
|
|
postargs="hell /usr/local/bin/hell"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# Trivial.
|
2004-10-03 19:20:53 +08:00
|
|
|
$ECHO "= trying: no quoting"
|
2004-09-03 08:26:37 +08:00
|
|
|
result=`$LIBTOOL -n --mode=$mode $preargs ${preflag}"${flag}test" $postargs` || status=$EXIT_FAILURE
|
2000-09-04 05:37:32 +08:00
|
|
|
# We used to have the contents of $match in the case statement,
|
|
|
|
# without an intermediate variable, but it would fail on at least
|
|
|
|
# Solaris' and HP-UX's /bin/sh. Ugh!
|
2004-10-11 23:15:00 +08:00
|
|
|
# We must not attempt to match $preargs in the output, because libtool
|
|
|
|
# may modify them. For example, on Cygwin, ``libtool --mode=link gcc -o
|
|
|
|
# foo foo.o'' becomes ``gcc -o foo.exe foo.o''.
|
2005-02-01 01:25:22 +08:00
|
|
|
match="${match_preflag}${flag}test "
|
1997-08-28 02:21:56 +08:00
|
|
|
case "$result" in
|
2000-09-04 05:37:32 +08:00
|
|
|
*"$match"*)
|
2004-10-03 19:20:53 +08:00
|
|
|
$ECHO "= passed: $result"
|
1997-08-28 02:21:56 +08:00
|
|
|
;;
|
|
|
|
*)
|
2004-10-03 19:20:53 +08:00
|
|
|
$ECHO "= failed: $result"
|
2003-10-15 05:46:13 +08:00
|
|
|
status=$EXIT_FAILURE
|
1997-08-28 02:21:56 +08:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# Metacharacters that should be backslashified.
|
1997-11-15 02:04:44 +08:00
|
|
|
for mchar in \\ \" \` \$; do
|
2004-10-03 19:20:53 +08:00
|
|
|
$ECHO "= trying: \\$mchar quoting"
|
2004-09-03 08:26:37 +08:00
|
|
|
result=`$LIBTOOL -n --mode=$mode $preargs ${preflag}"${flag}${mchar}test${mchar}" $postargs` || status=$EXIT_FAILURE
|
2005-02-01 01:25:22 +08:00
|
|
|
match="${match_preflag}${flag}\\${mchar}test\\${mchar} "
|
1997-08-28 02:21:56 +08:00
|
|
|
case "$result" in
|
2000-09-04 05:37:32 +08:00
|
|
|
*"$match"*)
|
2004-10-03 19:20:53 +08:00
|
|
|
$ECHO "= passed: $result"
|
1997-08-28 02:21:56 +08:00
|
|
|
;;
|
|
|
|
*)
|
2004-10-03 19:20:53 +08:00
|
|
|
$ECHO "= failed: $result"
|
2003-10-15 05:46:13 +08:00
|
|
|
status=$EXIT_FAILURE
|
1997-08-28 02:21:56 +08:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
# Metacharacters that should be double quoted.
|
|
|
|
for mchar in "[" "]" "~" "#" "^" "&" "*" "(" ")" "{" "}" "|" ";" "<" ">" "?" \
|
|
|
|
"'" " " " "; do
|
|
|
|
|
2004-10-03 19:20:53 +08:00
|
|
|
$ECHO "= trying: \"$mchar\" quoting"
|
2004-09-03 08:26:37 +08:00
|
|
|
result=`$LIBTOOL -n --mode=$mode $preargs ${preflag}"${flag}${mchar}test${mchar}" $postargs` || status=$EXIT_FAILURE
|
2005-02-01 01:25:22 +08:00
|
|
|
match="${match_preflag}\"${flag}${mchar}test${mchar}\" "
|
1997-08-28 02:21:56 +08:00
|
|
|
case "$result" in
|
2000-09-04 05:37:32 +08:00
|
|
|
*"$match"*)
|
2004-10-03 19:20:53 +08:00
|
|
|
$ECHO "= passed: $result"
|
1997-08-28 02:21:56 +08:00
|
|
|
;;
|
|
|
|
*)
|
2004-10-03 19:20:53 +08:00
|
|
|
$ECHO "= failed: $result"
|
2003-10-15 05:46:13 +08:00
|
|
|
status=$EXIT_FAILURE
|
1997-08-28 02:21:56 +08:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
exit $status
|