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)
21 required='gcc libtoolize'
26 cat >lib/feep.c <<'EOF'
34 cat >src/main.c <<'EOF'
40 main (int argc, char **argv)
47 cat >>configure.in << 'EOF'
48 ## These lines are activated for later tests
49 #: AC_CONFIG_LIBOBJ_DIR([lib])
53 AC_LIBSOURCE([feep.c])
55 AC_CONFIG_FILES([lib/Makefile src/Makefile])
59 ## -------------------------------------------- ##
60 ## First a test of traditional LTLIBOBJS usage. ##
61 ## -------------------------------------------- ##
63 cat >Makefile.am <<'EOF'
67 cat >lib/Makefile.am <<'EOF'
68 noinst_LTLIBRARIES = libfeep.la
70 libfeep_la_LIBADD = $(LTLIBOBJS)
73 cat >src/Makefile.am <<'EOF'
75 main_LDADD = ../lib/libfeep.la
88 ## ------------------------------------------ ##
89 ## Traditional LIBOBJS with LIBOBJDIR set. ##
90 ## ------------------------------------------ ##
92 # Invocation of AC_CONFIG_LIBOBJ_DIR may be necessary for reasons
93 # unrelated to Automake or Makefile.am layout.
95 sed 's/#: //' configure.in >configure.int
96 mv -f configure.int configure.in
105 ## -------------------------------------------- ##
106 ## Error message with usage in wrong directory. ##
107 ## -------------------------------------------- ##
109 mv -f src/Makefile.am src/t
110 sed 's/LDADD = .*/LDADD = @LTLIBOBJS@/' src/t > src/Makefile.am
112 grep 'cannot be used outside.*lib' stderr
113 mv -f src/t src/Makefile.am
115 ## ---------------------------------------------- ##
116 ## Test using LTLIBOBJS from a sibling directory. ##
117 ## ---------------------------------------------- ##
119 sed 's/#x //; s/lib\/Makefile //' configure.in >configure.int
120 mv -f configure.int configure.in
122 cat >Makefile.am <<'EOF'
126 cat > src/Makefile.am <<'EOF'
127 AUTOMAKE_OPTIONS = subdir-objects
129 noinst_LTLIBRARIES = libfeep.la
131 libfeep_la_LIBADD = $(LTLIBOBJS)
133 check_PROGRAMS = main
134 main_LDADD = libfeep.la
141 $AUTOMAKE --add-missing
144 test ! -d 'src/$(top_builddir)'
150 ## ------------------------------------------- ##
151 ## Test using LTLIBOBJS from parent directory. ##
152 ## ------------------------------------------- ##
154 sed 's/^.*src\/Makefile.*$//' configure.in >configure.int
155 mv -f configure.int configure.in
157 cat >Makefile.am <<'EOF'
158 AUTOMAKE_OPTIONS = subdir-objects
160 noinst_LTLIBRARIES = lib/libfeep.la
161 lib_libfeep_la_SOURCES =
162 lib_libfeep_la_LIBADD = $(LTLIBOBJS)
164 check_PROGRAMS = src/main
165 src_main_SOURCES = src/main.c
166 src_main_LDADD = lib/libfeep.la
171 test -f src/main.$(OBJEXT)
173 test ! -f src/$(DEPDIR)/feep.Po