1#! /bin/sh 2# Copyright (C) 2002-2021 Free Software Foundation, Inc. 3# 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) 7# any later version. 8# 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. 13# 14# You should have received a copy of the GNU General Public License 15# along with this program. If not, see <https://www.gnu.org/licenses/>. 16 17# Make sure that derivations work with .lo too. 18# (related to PR/37) 19 20required='cc libtoolize yacc' 21. test-init.sh 22 23plan_ 7 24 25cat >>configure.ac <<EOF 26AC_PROG_CC 27AC_PROG_YACC 28AM_PROG_AR 29AC_PROG_LIBTOOL 30AC_OUTPUT 31EOF 32 33cat >Makefile.am << 'END' 34lib_LTLIBRARIES = libfoo.la 35libfoo_la_SOURCES = foo.x_ 36.x_.y: 37 rm -f $@ $@-t 38## The leading ':;' works around a bug in bash <= 3.2. 39 :; { echo '/* autogenerated */' \ 40 && echo '%{' \ 41 && echo 'int yylex () {return 0;}' \ 42 && echo 'void yyerror (const char *s) {}' \ 43 && echo '%}' \ 44 && echo '%%' \ 45 && echo "foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};" \ 46 && echo '%%' \ 47## Account for VPATH issues on weaker make implementations. 48 && cat `test -f '$<' || echo $(srcdir)/`$<; \ 49 } > $@-t 50 mv -f $@-t $@ 51.PHONY: test 52test: 53 echo $(libfoo_la_OBJECTS) | grep '^foo\.lo$$' 54END 55 56cat > foo.x_ << 'END' 57int foo (void) { return yyparse(); } 58END 59 60# We must protect the TAP driver from the output of configure, since 61# that might output a stray "ok" on a line of its own (due to a 62# libtool bug on Mac OS X), thus causing a spurious test result to 63# be seen. See automake bug#11897. 64run_configure () 65{ 66 st=0; ./configure >output 2>&1 || st=1 67 sed 's/^/ /' output 68 test $st -eq 0 69} 70 71command_ok_ "libtoolize" libtoolize --force 72command_ok_ "aclocal" $ACLOCAL 73command_ok_ "autoconf" $AUTOCONF 74command_ok_ "automake" $AUTOMAKE --add-missing 75command_ok_ "configure" run_configure 76command_ok_ "make test" $MAKE test 77 78directive=''; make_can_chain_suffix_rules || directive=TODO 79command_ok_ "make all" -D "$directive" -r "suffix rules not chained" \ 80 $MAKE all 81 82: 83