1#! /bin/sh 2# Copyright (C) 1996-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# Some grep-based checks on yacc support: 18# 19# - Make sure intermediate .c file is built from yacc source. 20# Report from Thomas Morgan. 21# 22# - Make sure intermediate .h file is not generated nor removed 23# if (AM_)?YFLAGS do not contain '-d'. 24# Requested by Jim Meyering. 25 26. test-init.sh 27 28cat >> configure.ac << 'END' 29AC_PROG_CC 30AC_PROG_YACC 31END 32 33# Run it here once and for all, since we are not going to modify 34# configure.ac anymore. 35$ACLOCAL 36 37cat > Makefile.am <<'END' 38bin_PROGRAMS = zardoz 39zardoz_SOURCES = zardoz.y 40END 41 42# Don't redefine several times the same variable. 43cp Makefile.am Makefile.src 44 45$AUTOMAKE -a 46$FGREP 'zardoz.c' Makefile.in 47# If zardoz.h IS mentioned, fail. 48$FGREP 'zardoz.h' Makefile.in && exit 1 49 50cp Makefile.src Makefile.am 51echo 'AM_YFLAGS = -d' >> Makefile.am 52$AUTOMAKE 53$FGREP 'zardoz.c' Makefile.in 54# If zardoz.h is NOT mentioned, fail. 55$FGREP 'zardoz.h' Makefile.in 56 57cp Makefile.src Makefile.am 58echo 'AM_YFLAGS = ' >> Makefile.am 59$AUTOMAKE 60$FGREP 'zardoz.c' Makefile.in 61# If zardoz.h IS mentioned, fail. 62$FGREP 'zardoz.h' Makefile.in && exit 1 63 64cp Makefile.src Makefile.am 65echo 'YFLAGS = -d' >> Makefile.am 66# YFLAGS is a user variable. 67AUTOMAKE_fails 68grep 'YFLAGS.* user variable' stderr 69grep 'AM_YFLAGS.* instead' stderr 70$AUTOMAKE -Wno-gnu 71# If zardoz.h is NOT mentioned, fail. 72$FGREP 'zardoz.h' Makefile.in 73 74cp Makefile.src Makefile.am 75echo 'YFLAGS = ' >> Makefile.am 76$AUTOMAKE -Wno-gnu 77# If zardoz.h IS mentioned, fail. 78$FGREP 'zardoz.h' Makefile.in && exit 1 79 80: 81