source: trunk/essentials/sys-devel/automake-1.10/tests/pr401b.test

Last change on this file was 3147, checked in by bird, 18 years ago

automake 1.10

File size: 3.6 KB
Line 
1#! /bin/sh
2# Copyright (C) 2005, 2006 Free Software Foundation, Inc.
3#
4# This file is part of GNU Automake.
5#
6# GNU Automake is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 2, or (at your option)
9# any later version.
10#
11# GNU Automake is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with Automake; see the file COPYING. If not, write to
18# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19# Boston, MA 02110-1301, USA.
20
21# Check support for AC_CONFIG_LIBOBJ_DIR vs LTLIBOBJS.
22# (pr401.test and pr401c.test do the same for LIBOBJS and ALLOCA)
23
24required='gcc libtoolize'
25. ./defs || exit 1
26
27set -e
28
29mkdir lib src
30
31cat >lib/feep.c <<'EOF'
32char *
33feep ()
34{
35 return "feep";
36}
37EOF
38
39cat >src/main.c <<'EOF'
40#include <stdio.h>
41
42extern char *feep ();
43
44int
45main (int argc, char **argv)
46{
47 puts (feep ());
48 return 0;
49}
50EOF
51
52cat >>configure.in << 'EOF'
53## These lines are activated for later tests
54#: AC_CONFIG_LIBOBJ_DIR([lib])
55AC_PROG_CC
56#x AM_PROG_CC_C_O
57AC_LIBOBJ([feep])
58AC_LIBSOURCE([feep.c])
59AC_PROG_LIBTOOL
60AC_CONFIG_FILES([lib/Makefile src/Makefile])
61AC_OUTPUT
62EOF
63
64## -------------------------------------------- ##
65## First a test of traditional LTLIBOBJS usage. ##
66## -------------------------------------------- ##
67
68cat >Makefile.am <<'EOF'
69SUBDIRS = lib src
70EOF
71
72cat >lib/Makefile.am <<'EOF'
73noinst_LTLIBRARIES = libfeep.la
74libfeep_la_SOURCES =
75libfeep_la_LIBADD = $(LTLIBOBJS)
76EOF
77
78cat >src/Makefile.am <<'EOF'
79check_PROGRAMS = main
80main_LDADD = ../lib/libfeep.la
81
82TESTS = main
83EOF
84
85libtoolize
86$ACLOCAL
87$AUTOCONF
88$AUTOMAKE -a
89./configure
90$MAKE distcheck
91
92
93## ------------------------------------------ ##
94## Traditional LIBOBJS with LIBOBJDIR set. ##
95## ------------------------------------------ ##
96
97# Invocation of AC_CONFIG_LIBOBJ_DIR may be necessary for reasons
98# unrelated to Automake or Makefile.am layout.
99
100sed 's/#: //' configure.in >configure.int
101mv -f configure.int configure.in
102
103$ACLOCAL
104$AUTOCONF
105$AUTOMAKE -a
106./configure
107test ! -d lib/lib
108$MAKE distcheck
109
110
111## ---------------------------------------------- ##
112## Test using LTLIBOBJS from a sibling directory. ##
113## ---------------------------------------------- ##
114
115sed 's/#x //; s/lib\/Makefile //' configure.in >configure.int
116mv -f configure.int configure.in
117
118cat >Makefile.am <<'EOF'
119SUBDIRS = src
120EOF
121
122cat > src/Makefile.am <<'EOF'
123AUTOMAKE_OPTIONS = subdir-objects
124
125noinst_LTLIBRARIES = libfeep.la
126libfeep_la_SOURCES =
127libfeep_la_LIBADD = $(LTLIBOBJS)
128
129check_PROGRAMS = main
130main_LDADD = libfeep.la
131
132TESTS = main
133EOF
134
135$ACLOCAL
136$AUTOCONF
137$AUTOMAKE --add-missing
138./configure
139test ! -d src/lib
140test ! -d 'src/$(top_builddir)'
141$MAKE
142$MAKE check
143$MAKE distclean
144
145
146## ------------------------------------------- ##
147## Test using LTLIBOBJS from parent directory. ##
148## ------------------------------------------- ##
149
150sed 's/^.*src\/Makefile.*$//' configure.in >configure.int
151mv -f configure.int configure.in
152
153cat >Makefile.am <<'EOF'
154AUTOMAKE_OPTIONS = subdir-objects
155
156noinst_LTLIBRARIES = lib/libfeep.la
157lib_libfeep_la_SOURCES =
158lib_libfeep_la_LIBADD = $(LTLIBOBJS)
159
160check_PROGRAMS = src/main
161src_main_SOURCES = src/main.c
162src_main_LDADD = lib/libfeep.la
163
164TESTS = src/main
165
166check-local:
167 test -f src/main.$(OBJEXT)
168 test -f lib/feep.lo
169 test ! -f src/$(DEPDIR)/feep.Po
170EOF
171
172$ACLOCAL
173$AUTOCONF
174$AUTOMAKE
175./configure
176$MAKE distcheck
Note: See TracBrowser for help on using the repository browser.