| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187 | #! /bin/sh# Copyright (C) 2005-2017 Free Software Foundation, Inc.## This program is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 2, or (at your option)# any later version.## This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# GNU General Public License for more details.## You should have received a copy of the GNU General Public License# along with this program.  If not, see <http://www.gnu.org/licenses/>.# Check support for AC_CONFIG_LIBOBJ_DIR vs LTLIBOBJS.# (pr401.sh and pr401c.sh do the same for LIBOBJS and ALLOCA)required='cc libtoolize'. test-init.shmkdir lib srccat >lib/feep.c <<'EOF'const char *feep (void){  return "feep";}EOFcat >src/main.c <<'EOF'#include <stdio.h>extern const char *feep (void);int main (void){  puts (feep ());  return 0;}EOFcat >>configure.ac << 'EOF'## These lines are activated for later tests#: AC_CONFIG_LIBOBJ_DIR([lib])AC_PROG_CCAC_LIBOBJ([feep])AC_LIBSOURCE([feep.c])AM_PROG_ARAC_PROG_LIBTOOLAC_CONFIG_FILES([lib/Makefile src/Makefile])AM_CONDITIONAL([CROSS_COMPILING], [test $cross_compiling = yes])AC_OUTPUTEOF## -------------------------------------------- #### First a test of traditional LTLIBOBJS usage. #### -------------------------------------------- ##cat >Makefile.am <<'EOF'SUBDIRS = lib srcEOFcat >lib/Makefile.am <<'EOF'noinst_LTLIBRARIES = libfeep.lalibfeep_la_SOURCES =libfeep_la_LIBADD = $(LTLIBOBJS)EOFcat >src/Makefile.am <<'EOF'check_PROGRAMS = mainmain_LDADD = ../lib/libfeep.laif !CROSS_COMPILINGTESTS = mainendifEOFcp "$am_scriptdir/ar-lib" . || fatal_ "fetching auxiliary script 'ar-lib'"libtoolize$ACLOCAL$AUTOCONF$AUTOMAKE -a./configure$MAKE distcheck## ----------------------------------------- #### Traditional LTLIBOBJS with LIBOBJDIR set. #### ----------------------------------------- ### Invocation of AC_CONFIG_LIBOBJ_DIR may be necessary for reasons# unrelated to Automake or Makefile.am layout.sed 's/#: //' configure.ac >configure.tmpmv -f configure.tmp configure.ac$ACLOCAL$AUTOCONF$AUTOMAKE -a./configuretest ! -e lib/lib$MAKE distcheck## -------------------------------------------- #### Error message with usage in wrong directory. #### -------------------------------------------- ##mv -f src/Makefile.am src/tsed 's/LDADD = .*/LDADD = @LTLIBOBJS@/' src/t > src/Makefile.amAUTOMAKE_failsgrep 'cannot be used outside.*lib' stderrmv -f src/t src/Makefile.am## ---------------------------------------------- #### Test using LTLIBOBJS from a sibling directory. #### ---------------------------------------------- ##sed 's/lib\/Makefile //' configure.ac >configure.tmpmv -f configure.tmp configure.accat >Makefile.am <<'EOF'SUBDIRS = srcEOFcat > src/Makefile.am <<'EOF'AUTOMAKE_OPTIONS = subdir-objectsnoinst_LTLIBRARIES = libfeep.lalibfeep_la_SOURCES =libfeep_la_LIBADD = $(LTLIBOBJS)check_PROGRAMS = mainmain_LDADD = libfeep.laif !CROSS_COMPILINGTESTS = mainendifEOF$ACLOCAL$AUTOCONF$AUTOMAKE --add-missing./configuretest ! -e src/libtest ! -e 'src/$(top_builddir)'$MAKE$MAKE check$MAKE distclean## ------------------------------------------- #### Test using LTLIBOBJS from parent directory. #### ------------------------------------------- ##sed 's/^.*src\/Makefile.*$//' configure.ac >configure.tmpmv -f configure.tmp configure.accat >Makefile.am <<'EOF'AUTOMAKE_OPTIONS = subdir-objectsnoinst_LTLIBRARIES = lib/libfeep.lalib_libfeep_la_SOURCES =lib_libfeep_la_LIBADD = $(LTLIBOBJS)check_PROGRAMS = src/mainsrc_main_SOURCES = src/main.csrc_main_LDADD = lib/libfeep.laif !CROSS_COMPILINGTESTS = src/mainendifcheck-local:	test -f src/main.$(OBJEXT)	test -f lib/feep.lo	test ! -f src/$(DEPDIR)/feep.PoEOF$ACLOCAL$AUTOCONF$AUTOMAKE./configure$MAKE distcheck:
 |