2 # Copyright (C) 2005-2012 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # Check support for AC_CONFIG_LIBOBJ_DIR vs LIBOBJS.
18 # (pr401b.test and pr401c.test do the same for LTLIBOBJS and ALLOCA)
26 cat >lib/feep.c <<'EOF'
27 const char *feep (void)
33 cat >src/main.c <<'EOF'
36 extern const char *feep (void);
45 cat >>configure.ac << 'EOF'
46 ## These lines are activated for later tests
47 #: AC_CONFIG_LIBOBJ_DIR([lib])
51 AC_LIBSOURCE([feep.c])
54 AC_CONFIG_FILES([lib/Makefile src/Makefile])
55 AM_CONDITIONAL([CROSS_COMPILING], [test $cross_compiling = yes])
59 ## ------------------------------------------ ##
60 ## First a test of traditional LIBOBJS usage. ##
61 ## ------------------------------------------ ##
63 cat >Makefile.am <<'EOF'
67 cat >lib/Makefile.am <<'EOF'
68 noinst_LIBRARIES = libfeep.a
70 libfeep_a_LIBADD = $(LIBOBJS)
73 cat >src/Makefile.am <<'EOF'
75 main_LDADD = ../lib/libfeep.a
82 cp "$am_scriptdir/ar-lib" . || fatal_ "fetching auxiliary script 'ar-lib'"
90 ## ------------------------------------------ ##
91 ## Traditional LIBOBJS with LIBOBJDIR set. ##
92 ## ------------------------------------------ ##
94 # Invocation of AC_CONFIG_LIBOBJ_DIR may be necessary for reasons
95 # unrelated to Automake or Makefile.am layout.
97 sed 's/#: //' configure.ac >configure.int
98 mv -f configure.int configure.ac
107 ## -------------------------------------------- ##
108 ## Error message with usage in wrong directory. ##
109 ## -------------------------------------------- ##
111 mv -f src/Makefile.am src/t
112 sed 's/LDADD = .*/LDADD = @LIBOBJS@/' src/t > src/Makefile.am
114 grep 'cannot be used outside.*lib' stderr
115 mv -f src/t src/Makefile.am
118 ## -------------------------------------------- ##
119 ## Test using LIBOBJS from a sibling directory. ##
120 ## -------------------------------------------- ##
122 sed 's/#x //; s/lib\/Makefile //' configure.ac >configure.int
123 mv -f configure.int configure.ac
125 cat >Makefile.am <<'EOF'
129 cat > src/Makefile.am <<'EOF'
130 AUTOMAKE_OPTIONS = subdir-objects
132 noinst_LIBRARIES = libfeep.a
134 libfeep_a_LIBADD = $(LIBOBJS)
136 check_PROGRAMS = main
137 main_LDADD = libfeep.a
146 $AUTOMAKE --add-missing
149 test ! -d 'src/$(top_builddir)'
155 ## ----------------------------------------- ##
156 ## Test using LIBOBJS from parent directory. ##
157 ## ----------------------------------------- ##
159 sed 's/^.*src\/Makefile.*$//' configure.ac >configure.int
160 mv -f configure.int configure.ac
162 cat >Makefile.am <<'EOF'
163 AUTOMAKE_OPTIONS = subdir-objects
165 noinst_LIBRARIES = lib/libfeep.a
166 lib_libfeep_a_SOURCES =
167 lib_libfeep_a_LIBADD = $(LIBOBJS)
169 check_PROGRAMS = src/main
170 src_main_SOURCES = src/main.c
171 src_main_LDADD = lib/libfeep.a
178 test -f src/main.$(OBJEXT)
179 test -f lib/feep.$(OBJEXT)
180 test ! -f src/$(DEPDIR)/feep.Po