* automake.in (libtool_new_api): Fix a typo in the comment.
[automake/plouj.git] / tests / pr401.test
blobd26301e1e456c834b358423f90c06c7d87688f62
1 #! /bin/sh
2 # Copyright (C) 2005 Free Software Foundation, Inc.
4 # This file is part of GNU Automake.
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.
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.
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.
21 # Check support for AC_CONFIG_LIBOBJ_DIR vs LIBOBJS.
22 # (pr401b.test and pr401c.test do the same for LTLIBOBJS and ALLOCA)
24 required=gcc
25 . ./defs || exit 1
27 set -e
29 mkdir lib src
31 cat >lib/feep.c <<'EOF'
32 char *
33 feep ()
35 return "feep";
37 EOF
39 cat >src/feep.c <<'EOF'
40 #include <stdio.h>
42 extern char *feep ();
44 int
45 main (int argc, char **argv)
47 puts (feep ());
48 return 0;
50 EOF
52 cat >>configure.in << 'EOF'
53 ## These lines are activated for later tests
54 #: AC_CONFIG_LIBOBJ_DIR([lib])
55 AC_PROG_CC
56 #: AM_PROG_CC_C_O
57 AC_LIBOBJ([feep])
58 AC_LIBSOURCE([feep.c])
59 AC_PROG_RANLIB
60 AC_CONFIG_FILES([lib/Makefile src/Makefile])
61 AC_OUTPUT
62 EOF
64 ## ------------------------------------------ ##
65 ## First a test of traditional LIBOBJS usage. ##
66 ## ------------------------------------------ ##
68 cat >Makefile.am <<'EOF'
69 SUBDIRS = lib src
70 EOF
72 cat >lib/Makefile.am <<'EOF'
73 noinst_LIBRARIES = libfeep.a
74 libfeep_a_SOURCES =
75 libfeep_a_LIBADD = $(LIBOBJS)
76 EOF
78 cat >src/Makefile.am <<'EOF'
79 check_PROGRAMS = feep
80 feep_LDADD = ../lib/libfeep.a
82 TESTS = feep
83 EOF
85 $ACLOCAL
86 $AUTOCONF
87 $AUTOMAKE
88 ./configure
89 $MAKE distcheck
92 ## -------------------------------------------- ##
93 ## Test using LIBOBJS from a sibling directory. ##
94 ## -------------------------------------------- ##
96 $PERL -pi -e 's/#: //' configure.in
97 $PERL -pi -e 's/lib\/Makefile //' configure.in
99 cat >Makefile.am <<'EOF'
100 SUBDIRS = src
103 cat > src/Makefile.am <<'EOF'
104 AUTOMAKE_OPTIONS = subdir-objects
106 noinst_LIBRARIES = libfeep.a
107 libfeep_a_SOURCES =
108 libfeep_a_LIBADD = $(LIBOBJS)
110 check_PROGRAMS = feep
111 feep_LDADD = libfeep.a
113 TESTS = feep
116 $ACLOCAL
117 $AUTOCONF
118 $AUTOMAKE --add-missing
119 ./configure
120 $MAKE
121 $MAKE check
122 $MAKE distclean
125 ## ----------------------------------------- ##
126 ## Test using LIBOBJS from parent directory. ##
127 ## ----------------------------------------- ##
129 $PERL -pi -e 's/^.*src\/Makefile.*$//' configure.in
131 cat >Makefile.am <<'EOF'
132 AUTOMAKE_OPTIONS = subdir-objects
134 noinst_LIBRARIES = lib/libfeep.a
135 lib_libfeep_a_SOURCES =
136 lib_libfeep_a_LIBADD = $(LIBOBJS)
138 check_PROGRAMS = src/feep
139 src_feep_SOURCES = src/feep.c
140 src_feep_LDADD = lib/libfeep.a
142 TESTS = src/feep
144 check-local:
145 test -f src/feep.$(OBJEXT)
148 $ACLOCAL
149 $AUTOCONF
150 $AUTOMAKE
151 ./configure
152 $MAKE distcheck