| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 | #! /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 ALLOCA.# (pr401.sh and pr401b.sh do the same for LIBOBJS and LTLIBOBJS)required=cc. test-init.shmkdir lib srcac_cv_func_alloca_works=no; export ac_cv_func_alloca_workscat >lib/alloca.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_CCAM_PROG_ARAC_PROG_RANLIBAC_FUNC_ALLOCAAC_CONFIG_FILES([lib/Makefile src/Makefile])AM_CONDITIONAL([CROSS_COMPILING], [test $cross_compiling = yes])AC_OUTPUTEOF## ----------------------------------------- #### First a test of traditional ALLOCA usage. #### ----------------------------------------- ##cat >Makefile.am <<'EOF'SUBDIRS = lib srcEOFcat >lib/Makefile.am <<'EOF'noinst_LIBRARIES = libfeep.alibfeep_a_SOURCES =libfeep_a_LIBADD = $(ALLOCA)EOFcat >src/Makefile.am <<'EOF'check_PROGRAMS = mainmain_LDADD = ../lib/libfeep.aif !CROSS_COMPILINGTESTS = mainendifEOFcp "$am_scriptdir/ar-lib" . || fatal_ "fetching auxiliary script 'ar-lib'"$ACLOCAL$AUTOCONF$AUTOMAKE -a./configure$MAKE distcheck## --------------------------------------- #### Traditional ALLOCA 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./configuretest ! -e lib/lib$MAKE distcheck## -------------------------------------------- #### Error message with usage in wrong directory. #### -------------------------------------------- ##mv -f src/Makefile.am src/tsed 's/LDADD = .*/LDADD = @ALLOCA@/' src/t > src/Makefile.amAUTOMAKE_failsgrep 'cannot be used outside.*lib' stderrmv -f src/t src/Makefile.am## ------------------------------------------- #### Test using ALLOCA 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_LIBRARIES = libfeep.alibfeep_a_SOURCES =libfeep_a_LIBADD = $(ALLOCA) $(LIBOBJS) # Add LIBOBJS for fun.check_PROGRAMS = mainmain_LDADD = libfeep.aif !CROSS_COMPILINGTESTS = mainendifEOF$ACLOCAL$AUTOCONF$AUTOMAKE --add-missing./configure$MAKEtest ! -e src/libtest ! -e 'src/$(top_builddir)'$MAKE check$MAKE distclean## ---------------------------------------- #### Test using ALLOCA from parent directory. #### ---------------------------------------- ##sed 's/^.*src\/Makefile.*$//' configure.ac >configure.tmpmv -f configure.tmp configure.accat >Makefile.am <<'EOF'AUTOMAKE_OPTIONS = subdir-objectsnoinst_LIBRARIES = lib/libfeep.alib_libfeep_a_SOURCES =lib_libfeep_a_LIBADD = $(ALLOCA)check_PROGRAMS = src/mainsrc_main_SOURCES = src/main.csrc_main_LDADD = lib/libfeep.aif !CROSS_COMPILINGTESTS = src/mainendifcheck-local:	test -f src/main.$(OBJEXT)	test -f lib/alloca.$(OBJEXT)	test ! -f src/$(DEPDIR)/alloca.PoEOF$ACLOCAL$AUTOCONF$AUTOMAKE./configure$MAKE distcheck:
 |