+2005-12-03 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * libltdl/config/general.m4sh (func_show_eval):
+ Rewrite use the failure expression, because the exit status of
+ the previous command may not be preserved in the next `eval' by
+ some shells, such as pdksh.
+ * libltdl/config/ltmain.m4sh (func_extract_an_archive):
+ Use func_show_eval correctly.
+ (func_mode_link): Likewise. Also, do not use `$status'.
+ * tests/fail.at: New set of tests to ensure libtool fails.
+ * Makefile.am, tests/testsuite.at: Adjusted.
+
2005-11-26 Peter O'Gorman <peter@pogma.com>
* libltdl/m4/libtool.m4 [darwin]: Use $LTCC $LTCFLAGS to create
$opt_debug
f_ex_an_ar_dir="$1"; shift
f_ex_an_ar_oldlib="$1"
- func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
+ func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" 'exit $?'
if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
:
else
link_command="$compile_command$compile_rpath"
# We have no uninstalled library dependencies, so finalize right now.
- func_show_eval "$link_command"
- status=$?
+ exit_status=0
+ func_show_eval "$link_command" 'exit_status=$?'
# Delete the generated files.
if test -f "$output_objdir/${outputname}S.${objext}"; then
func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
fi
- exit $status
+ exit $exit_status
fi
if test -n "$compile_shlibpath$finalize_shlibpath"; then
--- /dev/null
+# Hand crafted tests for GNU Libtool. -*- Autotest -*-
+# Copyright 2005 Free Software Foundation, Inc.
+
+# 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, 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, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# Test that libtool really fails when it should.
+# TODO: many possible failure cases missing. (But how to simulate a full disk?)
+
+AT_SETUP([Failure tests])
+eval `$LIBTOOL --config | $EGREP '^(pic_mode|pic_flag|build_old_libs|build_libtool_libs)='`
+LDFLAGS="$LDFLAGS -no-undefined"
+
+m4_pushdef([FAIL_CHECK],
+[AT_CHECK([if $1; then (exit 1); else :; fi], [0], [ignore], [ignore])
+])
+
+# compile failure
+echo 'choke me' > a.c
+FAIL_CHECK([$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c])
+AT_CHECK([test -f a.lo], [1])
+
+# non-PIC compile failure
+case $pic_mode in default | yes)
+ case $build_old_libs,$pic_flag in yes,*-DPIC*)
+ AT_DATA([a.c], [[
+#ifndef PIC
+ choke me
+#endif
+]])
+ FAIL_CHECK([$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -no-suppress -c a.c])
+ AT_CHECK([test -f a.lo], [1])
+ ;;
+ esac
+ ;;
+esac
+
+# program creation failure
+echo 'int not_main(void) { return 0; }' > a.c
+$CC $CPPFLAGS $CFLAGS -c a.c
+FAIL_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o a a.$OBJEXT])
+AT_CHECK([test -f a || test -f a$EXEEXT], [1])
+FAIL_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o a a.$OBJEXT -static])
+AT_CHECK([test -f a || test -f a$EXEEXT], [1])
+
+# shared library creation failure
+case $build_libtool_libs in yes)
+ echo 'int duplicate_name(void) { return 0; }' > a.c
+ echo 'double duplicate_name(double x) { return 2.*x; }' > b.c
+ $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c
+ $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c b.c
+ FAIL_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la a.lo b.lo -rpath /foo])
+ AT_CHECK([test -f liba.la], [1])
+ ;;
+esac
+
+m4_popdef([FAIL_CHECK])
+AT_CLEANUP