2 # Copyright (C) 2005, 2006, 2007, 2010, 2011 Free Software Foundation,
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 # Check support for AC_CONFIG_LIBOBJ_DIR vs LTLIBOBJS.
19 # (pr401.test and pr401c.test do the same for LIBOBJS and ALLOCA)
22 required='gcc libtoolize'
27 cat >lib/feep.c <<'EOF'
35 cat >src/main.c <<'EOF'
41 main (int argc, char **argv)
48 cat >>configure.in << 'EOF'
49 ## These lines are activated for later tests
50 #: AC_CONFIG_LIBOBJ_DIR([lib])
54 AC_LIBSOURCE([feep.c])
56 AC_CONFIG_FILES([lib/Makefile src/Makefile])
60 ## -------------------------------------------- ##
61 ## First a test of traditional LTLIBOBJS usage. ##
62 ## -------------------------------------------- ##
64 cat >Makefile.am <<'EOF'
68 cat >lib/Makefile.am <<'EOF'
69 noinst_LTLIBRARIES = libfeep.la
71 libfeep_la_LIBADD = $(LTLIBOBJS)
74 cat >src/Makefile.am <<'EOF'
76 main_LDADD = ../lib/libfeep.la
89 ## ------------------------------------------ ##
90 ## Traditional LIBOBJS with LIBOBJDIR set. ##
91 ## ------------------------------------------ ##
93 # Invocation of AC_CONFIG_LIBOBJ_DIR may be necessary for reasons
94 # unrelated to Automake or Makefile.am layout.
96 sed 's/#: //' configure.in >configure.int
97 mv -f configure.int configure.in
106 ## -------------------------------------------- ##
107 ## Error message with usage in wrong directory. ##
108 ## -------------------------------------------- ##
110 mv -f src/Makefile.am src/t
111 sed 's/LDADD = .*/LDADD = @LTLIBOBJS@/' src/t > src/Makefile.am
113 grep 'cannot be used outside.*lib' stderr
114 mv -f src/t src/Makefile.am
116 ## ---------------------------------------------- ##
117 ## Test using LTLIBOBJS from a sibling directory. ##
118 ## ---------------------------------------------- ##
120 sed 's/#x //; s/lib\/Makefile //' configure.in >configure.int
121 mv -f configure.int configure.in
123 cat >Makefile.am <<'EOF'
127 cat > src/Makefile.am <<'EOF'
128 AUTOMAKE_OPTIONS = subdir-objects
130 noinst_LTLIBRARIES = libfeep.la
132 libfeep_la_LIBADD = $(LTLIBOBJS)
134 check_PROGRAMS = main
135 main_LDADD = libfeep.la
142 $AUTOMAKE --add-missing
145 test ! -d 'src/$(top_builddir)'
151 ## ------------------------------------------- ##
152 ## Test using LTLIBOBJS from parent directory. ##
153 ## ------------------------------------------- ##
155 sed 's/^.*src\/Makefile.*$//' configure.in >configure.int
156 mv -f configure.int configure.in
158 cat >Makefile.am <<'EOF'
159 AUTOMAKE_OPTIONS = subdir-objects
161 noinst_LTLIBRARIES = lib/libfeep.la
162 lib_libfeep_la_SOURCES =
163 lib_libfeep_la_LIBADD = $(LTLIBOBJS)
165 check_PROGRAMS = src/main
166 src_main_SOURCES = src/main.c
167 src_main_LDADD = lib/libfeep.la
172 test -f src/main.$(OBJEXT)
174 test ! -f src/$(DEPDIR)/feep.Po