diff options
author | Alexandre Duret-Lutz <adl@gnu.org> | 2005-05-14 19:01:44 +0000 |
---|---|---|
committer | Alexandre Duret-Lutz <adl@gnu.org> | 2005-05-14 19:01:44 +0000 |
commit | 2ff80273fdd430c250584650c2f37fda1a9e83d4 (patch) | |
tree | 30d7f110a27ece40d58c8266ef0775eb1896970e /tests/pr401.test | |
parent | 5bdcf40b665069805a56080b983035ce5517dc89 (diff) | |
download | automake-2ff80273fdd430c250584650c2f37fda1a9e83d4.tar.gz |
Alexandre Duret-Lutz <adl@gnu.org>
Support for remote LIBOBJS (and friends) with subdir-objects.
Fixes PR automake/401.
* automake.in (config_libobj_dir): New variable.
(scan_autoconf_traces): Set config_libobj_dir from AC_CONFIG_LIBOBJ_DIR.
(handle_LIBOBJS_or_ALLOCA, require_libsource_with_macro): New functions.
(handle_LIBOBJS, handle_ALLOCA): Use them. Adjust location of
dependency files, possibly in a subdirectory.
* tests/pr401.test, tests/pr401b.test, tests/pr401c.test: New tests.
* tests/Makefile.am (TESTS): Add them.
* doc/automake.texi (Optional) <AC_CONFIG_LIBOBJ_DIR>: Document.
(LIBOBJS): Document changes in behaviour of
LIBOBJS, ALLOCA, LTLIBOBJS & LTALLOCA in the presence of
subdir-objects and an invocation of AC_CONFIG_LIBOBJ_DIR.
Diffstat (limited to 'tests/pr401.test')
-rwxr-xr-x | tests/pr401.test | 152 |
1 files changed, 152 insertions, 0 deletions
diff --git a/tests/pr401.test b/tests/pr401.test new file mode 100755 index 000000000..d15d23dec --- /dev/null +++ b/tests/pr401.test @@ -0,0 +1,152 @@ +#! /bin/sh +# Copyright (C) 2005 Free Software Foundation, Inc. +# +# This file is part of GNU Automake. +# +# GNU Automake 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. +# +# GNU Automake 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 Automake; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# Check support for AC_CONFIG_LIBOBJ_DIR vs LIBOBJS. +# (pr401b.test and pr401c.test do the same for LTLIBOBJS and ALLOCA) + +required=gcc +. ./defs || exit 1 + +set -e + +mkdir lib src + +cat >lib/feep.c <<'EOF' +char * +feep () +{ + return "feep"; +} +EOF + +cat >src/feep.c <<'EOF' +#include <stdio.h> + +extern char *feep (); + +int +main (int argc, char **argv) +{ + puts (feep ()); + return 0; +} +EOF + +cat >>configure.in << 'EOF' +## These lines are activated for later tests +#: AC_CONFIG_LIBOBJ_DIR([lib]) +AC_PROG_CC +#: AM_PROG_CC_C_O +AC_LIBOBJ([feep]) +AC_LIBSOURCE([feep.c]) +AC_PROG_RANLIB +AC_CONFIG_FILES([lib/Makefile src/Makefile]) +AC_OUTPUT +EOF + +## ------------------------------------------ ## +## First a test of traditional LIBOBJS usage. ## +## ------------------------------------------ ## + +cat >Makefile.am <<'EOF' +SUBDIRS = lib src +EOF + +cat >lib/Makefile.am <<'EOF' +noinst_LIBRARIES = libfeep.a +libfeep_a_SOURCES = +libfeep_a_LIBADD = $(LIBOBJS) +EOF + +cat >src/Makefile.am <<'EOF' +check_PROGRAMS = feep +feep_LDADD = ../lib/libfeep.a + +TESTS = feep +EOF + +$ACLOCAL +$AUTOCONF +$AUTOMAKE +./configure +$MAKE distcheck + + +## -------------------------------------------- ## +## Test using LIBOBJS from a sibling directory. ## +## -------------------------------------------- ## + +$PERL -pi -e 's/#: //' configure.in +$PERL -pi -e 's/lib\/Makefile //' configure.in + +cat >Makefile.am <<'EOF' +SUBDIRS = src +EOF + +cat > src/Makefile.am <<'EOF' +AUTOMAKE_OPTIONS = subdir-objects + +noinst_LIBRARIES = libfeep.a +libfeep_a_SOURCES = +libfeep_a_LIBADD = $(LIBOBJS) + +check_PROGRAMS = feep +feep_LDADD = libfeep.a + +TESTS = feep +EOF + +$ACLOCAL +$AUTOCONF +$AUTOMAKE --add-missing +./configure +$MAKE +$MAKE check +$MAKE distclean + + +## ----------------------------------------- ## +## Test using LIBOBJS from parent directory. ## +## ----------------------------------------- ## + +$PERL -pi -e 's/^.*src\/Makefile.*$//' configure.in + +cat >Makefile.am <<'EOF' +AUTOMAKE_OPTIONS = subdir-objects + +noinst_LIBRARIES = lib/libfeep.a +lib_libfeep_a_SOURCES = +lib_libfeep_a_LIBADD = $(LIBOBJS) + +check_PROGRAMS = src/feep +src_feep_SOURCES = src/feep.c +src_feep_LDADD = lib/libfeep.a + +TESTS = src/feep + +check-local: + test -f src/feep.$(OBJEXT) +EOF + +$ACLOCAL +$AUTOCONF +$AUTOMAKE +./configure +$MAKE distcheck |