#! /bin/sh # Copyright (C) 2001, 2002, 2003, 2004, 2006, 2007 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 . # Test to make sure ylwrap put in right location. # Report from Tim Van Holder. # Also make sure depcomp does not needlessly update headers. # Report from Paolo Bonzini. required='gcc bison GNUmake' . ./defs || Exit 1 set -e cat > configure.in << 'END' AC_INIT([yacc6], [1.0]) AC_CONFIG_AUX_DIR([aux1]) AM_INIT_AUTOMAKE AC_CONFIG_FILES([Makefile]) AC_PROG_CC AM_PROG_CC_C_O AC_PROG_YACC AC_CONFIG_FILES([sub/Makefile]) AC_OUTPUT END cat > Makefile.am << 'END' SUBDIRS = sub test-time-unchanged: test `ls -1t sub/main.$(OBJEXT) z | sed 1q` = z test-time-changed: test `ls -1t sub/main.$(OBJEXT) z | sed 1q` = sub/main.$(OBJEXT) END mkdir aux1 sub cat > sub/Makefile.am << 'END' bin_PROGRAMS = foo bar AM_YFLAGS = -d foo_SOURCES = foo.y main.c foo_CPPFLAGS = -DFOO bar_SOURCES = bar.y main.c BUILT_SOURCES = foo.h bar.h END cat > sub/foo.y << 'END' %{ int yylex () {return 0;} void yyerror (char *s) {} %} %token TOKEN %% foobar : 'f' 'o' 'o' 'b' 'a' 'r' {}; END cp sub/foo.y sub/bar.y cat >sub/main.c <<'EOF' #ifdef FOO # include "foo.h" #else # include "bar.h" #endif int main() { return 0; } EOF $ACLOCAL $AUTOCONF $AUTOMAKE -a test -f aux1/ylwrap test ! -f ylwrap test ! -f sub/ylwrap $FGREP '(top_srcdir)/aux1/ylwrap' sub/Makefile.in ./configure $MAKE grep '#.*line.*foo.y' sub/foo.c grep '#.*line.*bar.y' sub/bar.c $sleep : > z $sleep touch sub/bar.y $MAKE $MAKE test-time-unchanged $sleep sed s/TOKEN/TEKON/g sub/bar.y >sub/bar.yt mv -f sub/bar.yt sub/bar.y $MAKE $MAKE test-time-changed