source: trunk/essentials/sys-devel/automake-1.10/tests/pr401.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 LIBOBJS.
22# (pr401b.test and pr401c.test do the same for LTLIBOBJS and ALLOCA)
23
24required=gcc
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_RANLIB
60AC_CONFIG_FILES([lib/Makefile src/Makefile])
61AC_OUTPUT
62EOF
63
64## ------------------------------------------ ##
65## First a test of traditional LIBOBJS usage. ##
66## ------------------------------------------ ##
67
68cat >Makefile.am <<'EOF'
69SUBDIRS = lib src
70EOF
71
72cat >lib/Makefile.am <<'EOF'
73noinst_LIBRARIES = libfeep.a
74libfeep_a_SOURCES =
75libfeep_a_LIBADD = $(LIBOBJS)
76EOF
77
78cat >src/Makefile.am <<'EOF'
79check_PROGRAMS = main
80main_LDADD = ../lib/libfeep.a
81
82TESTS = main
83EOF
84
85$ACLOCAL
86$AUTOCONF
87$AUTOMAKE
88./configure
89$MAKE distcheck
90
91
92## ------------------------------------------ ##
93## Traditional LIBOBJS with LIBOBJDIR set. ##
94## ------------------------------------------ ##
95
96# Invocation of AC_CONFIG_LIBOBJ_DIR may be necessary for reasons
97# unrelated to Automake or Makefile.am layout.
98
99sed 's/#: //' configure.in >configure.int
100mv -f configure.int configure.in
101
102$ACLOCAL
103$AUTOCONF
104$AUTOMAKE
105./configure
106test ! -d lib/lib
107$MAKE distcheck
108
109
110## -------------------------------------------- ##
111## Test using LIBOBJS from a sibling directory. ##
112## -------------------------------------------- ##
113
114sed 's/#x //; s/lib\/Makefile //' configure.in >configure.int
115mv -f configure.int configure.in
116
117cat >Makefile.am <<'EOF'
118SUBDIRS = src
119EOF
120
121cat > src/Makefile.am <<'EOF'
122AUTOMAKE_OPTIONS = subdir-objects
123
124noinst_LIBRARIES = libfeep.a
125libfeep_a_SOURCES =
126libfeep_a_LIBADD = $(LIBOBJS)
127
128check_PROGRAMS = main
129main_LDADD = libfeep.a
130
131TESTS = main
132EOF
133
134$ACLOCAL
135$AUTOCONF
136$AUTOMAKE --add-missing
137./configure
138test ! -d src/lib
139test ! -d 'src/$(top_builddir)'
140$MAKE
141$MAKE check
142$MAKE distclean
143
144
145## ----------------------------------------- ##
146## Test using LIBOBJS from parent directory. ##
147## ----------------------------------------- ##
148
149sed 's/^.*src\/Makefile.*$//' configure.in >configure.int
150mv -f configure.int configure.in
151
152cat >Makefile.am <<'EOF'
153AUTOMAKE_OPTIONS = subdir-objects
154
155noinst_LIBRARIES = lib/libfeep.a
156lib_libfeep_a_SOURCES =
157lib_libfeep_a_LIBADD = $(LIBOBJS)
158
159check_PROGRAMS = src/main
160src_main_SOURCES = src/main.c
161src_main_LDADD = lib/libfeep.a
162
163TESTS = src/main
164
165check-local:
166 test -f src/main.$(OBJEXT)
167 test -f lib/feep.$(OBJEXT)
168 test ! -f src/$(DEPDIR)/feep.Po
169EOF
170
171$ACLOCAL
172$AUTOCONF
173$AUTOMAKE
174./configure
175$MAKE distcheck
Note: See TracBrowser for help on using the repository browser.