source: trunk/essentials/sys-devel/automake-1.10/tests/pr401c.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 ALLOCA.
22# (pr401.test and pr401b.test do the same for LIBOBJS and LTLIBOBJS)
23
24required=gcc
25. ./defs || exit 1
26
27set -e
28
29mkdir lib src
30
31ac_cv_func_alloca_works=no
32export ac_cv_func_alloca_works
33
34cat >lib/alloca.c <<'EOF'
35char *
36feep ()
37{
38 return "feep";
39}
40EOF
41
42cat >src/main.c <<'EOF'
43#include <stdio.h>
44
45extern char *feep ();
46
47int
48main (int argc, char **argv)
49{
50 puts (feep ());
51 return 0;
52}
53EOF
54
55cat >>configure.in << 'EOF'
56## These lines are activated for later tests
57#: AC_CONFIG_LIBOBJ_DIR([lib])
58AC_PROG_CC
59#x AM_PROG_CC_C_O
60AC_PROG_RANLIB
61AC_FUNC_ALLOCA
62AC_CONFIG_FILES([lib/Makefile src/Makefile])
63AC_OUTPUT
64EOF
65
66## ----------------------------------------- ##
67## First a test of traditional ALLOCA usage. ##
68## ----------------------------------------- ##
69
70cat >Makefile.am <<'EOF'
71SUBDIRS = lib src
72EOF
73
74cat >lib/Makefile.am <<'EOF'
75noinst_LIBRARIES = libfeep.a
76libfeep_a_SOURCES =
77libfeep_a_LIBADD = $(ALLOCA)
78EOF
79
80cat >src/Makefile.am <<'EOF'
81check_PROGRAMS = main
82main_LDADD = ../lib/libfeep.a
83
84TESTS = main
85EOF
86
87$ACLOCAL
88$AUTOCONF
89$AUTOMAKE
90./configure
91$MAKE distcheck
92
93
94## ------------------------------------------ ##
95## Traditional LIBOBJS with LIBOBJDIR set. ##
96## ------------------------------------------ ##
97
98# Invocation of AC_CONFIG_LIBOBJ_DIR may be necessary for reasons
99# unrelated to Automake or Makefile.am layout.
100
101sed 's/#: //' configure.in >configure.int
102mv -f configure.int configure.in
103
104$ACLOCAL
105$AUTOCONF
106$AUTOMAKE
107./configure
108test ! -d lib/lib
109$MAKE distcheck
110
111
112## ------------------------------------------- ##
113## Test using ALLOCA from a sibling directory. ##
114## ------------------------------------------- ##
115
116sed 's/#x //; s/lib\/Makefile //' configure.in >configure.int
117mv -f configure.int configure.in
118
119cat >Makefile.am <<'EOF'
120SUBDIRS = src
121EOF
122
123cat > src/Makefile.am <<'EOF'
124AUTOMAKE_OPTIONS = subdir-objects
125
126noinst_LIBRARIES = libfeep.a
127libfeep_a_SOURCES =
128libfeep_a_LIBADD = $(ALLOCA) $(LIBOBJS) # Add LIBOBJS for fun
129
130check_PROGRAMS = main
131main_LDADD = libfeep.a
132
133TESTS = main
134EOF
135
136$ACLOCAL
137$AUTOCONF
138$AUTOMAKE --add-missing
139./configure
140$MAKE
141test ! -d src/lib
142test ! -d 'src/$(top_builddir)'
143$MAKE check
144$MAKE distclean
145
146
147## ---------------------------------------- ##
148## Test using ALLOCA from parent directory. ##
149## ---------------------------------------- ##
150
151sed 's/^.*src\/Makefile.*$//' configure.in >configure.int
152mv -f configure.int configure.in
153
154cat >Makefile.am <<'EOF'
155AUTOMAKE_OPTIONS = subdir-objects
156
157noinst_LIBRARIES = lib/libfeep.a
158lib_libfeep_a_SOURCES =
159lib_libfeep_a_LIBADD = $(ALLOCA)
160
161check_PROGRAMS = src/main
162src_main_SOURCES = src/main.c
163src_main_LDADD = lib/libfeep.a
164
165TESTS = src/main
166
167check-local:
168 test -f src/main.$(OBJEXT)
169 test -f lib/alloca.$(OBJEXT)
170 test ! -f src/$(DEPDIR)/alloca.Po
171EOF
172
173$ACLOCAL
174$AUTOCONF
175$AUTOMAKE
176./configure
177$MAKE distcheck
Note: See TracBrowser for help on using the repository browser.