>From e2a28c6ec8caab33beead9f9f156b36ae0b437ac Mon Sep 17 00:00:00 2001 From: Torsten Landschoff Date: Sun, 15 Nov 2009 01:24:41 +0100 Subject: [PATCH 1/5] Add a test case: Undefined symbols are an error with -no-undefined set. --- Makefile.am | 3 +- tests/noundefined.at | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletions(-) create mode 100644 tests/noundefined.at diff --git a/Makefile.am b/Makefile.am index d2033c5..f3ef5c4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -496,7 +496,8 @@ TESTSUITE_AT = tests/testsuite.at \ tests/configure-iface.at \ tests/stresstest.at \ tests/cmdline_wrap.at \ - tests/darwin.at + tests/darwin.at \ + tests/noundefined.at EXTRA_DIST += $(srcdir)/$(TESTSUITE) $(TESTSUITE_AT) $(srcdir)/tests/package.m4 diff --git a/tests/noundefined.at b/tests/noundefined.at new file mode 100644 index 0000000..a32e4b6 --- /dev/null +++ b/tests/noundefined.at @@ -0,0 +1,53 @@ +# noundefined.at -- test -no-undefined handling -*- Autotest -*- + +# Copyright (C) 2009 Free Software Foundation, Inc. +# Written by Torsten Landschoff, 2009. +# +# 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. +#### + +AT_SETUP([Check undefined symbols vs. -no-undefined]) +AT_KEYWORDS([libtool noundefined]) + +# When creating shared libraries, I prefer to know of undefined symbols +# before installation. I would expect the libtool -no-undefined flag +# to report any undefined symbols, for two reasons: +# a) I would like to be told before installation that I have a typo or a +# missing library. +# b) For portability, I'd rather note on systems that allow undefined symbols +# that my code is not portable to a system disallowing them. +# This test is to check that undefined symbols are noticed when building +# a shared library when declaring that all symbols should be defined. + +AT_CHECK([$LIBTOOL --features | grep 'disable shared libraries' && (exit 77)], + [1], [ignore]) + +AT_DATA(problem.c, +[[ +extern int undef_func(int a); +int ref_undef() +{ + undef_func(42); +} +]]) + +LT_AT_CHECK([$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c -o problem.lo problem.c],[0],[ignore],[ignore]) +LT_AT_CHECK([$LIBTOOL --mode=link $CC $CPPFLAGS $CFLAGS -shared -no-undefined -o libproblem.la -rpath /foo problem.lo],[1],[stdout],[stderr]) + +AT_CLEANUP -- 1.6.5.2