| 1 | #! /bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | # Copyright (C) 1997-2025 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 | # Test to make sure Yacc + C++ is not obviously broken. |
| 18 | # See also related tests 'yacc-cxx.sh' and 'yacc-d-cxx.sh', |
| 19 | # which does much more in-depth checks (but requires an actual |
| 20 | # Yacc program and a working C++ compiler). |
| 21 | |
| 22 | . test-init.shscip-shell source . . `test-init.sh`. |
| 23 | |
| 24 | catscip-shell system . . cat. >> configure.ac << 'END' |
| 25 | AC_PROG_CXX |
| 26 | AC_PROG_YACC |
| 27 | END |
| 28 | |
| 29 | catscip-shell system . . cat. > Makefile.am << 'END' |
| 30 | AM_LFLAGS = --never-interactive |
| 31 | |
| 32 | bin_PROGRAMS = foo bar baz qux |
| 33 | foo_SOURCES = foo.y++ |
| 34 | bar_SOURCES = bar.ypp |
| 35 | baz_SOURCES = baz.yy |
| 36 | qux_SOURCES = qux.yxx |
| 37 | END |
| 38 | |
| 39 | $ACLOCAL |
| 40 | $AUTOMAKE -a |
| 41 | |
| 42 | $EGREP '(\.[ch]|foo|bar|baz|qux)' Makefile.in # For debugging. |
| 43 | |
| 44 | $EGREP '(foo|bar|baz|qux)\.h' Makefile.in && exit 1 |
| 45 | |
| 46 | sedscip-shell system . . sed. -e 's/^/ /' -e 's/$/ /' Makefile.in >mk |
| 47 | |
| 48 | $FGREP ' foo.c++ ' mk |
| 49 | $FGREP ' bar.cpp ' mk |
| 50 | $FGREP ' baz.cc ' mk |
| 51 | $FGREP ' qux.cxx ' mk |
| 52 | |
| 53 | catscip-shell system . . cat. >> Makefile.am <<END |
| 54 | AM_YFLAGS = -d |
| 55 | qux_YFLAGS = foo |
| 56 | END |
| 57 | |
| 58 | $AUTOMAKE |
| 59 | |
| 60 | $EGREP '(\.[ch]|foo|bar|baz|qux)' Makefile.in # For debugging. |
| 61 | |
| 62 | sedscip-shell system . . sed. -e 's/^/ /' -e 's/$/ /' Makefile.in >mk |
| 63 | |
| 64 | $FGREP ' foo.c++ ' mk |
| 65 | $FGREP ' foo.h++ ' mk |
| 66 | $FGREP ' bar.cpp ' mk |
| 67 | $FGREP ' bar.hpp ' mk |
| 68 | $FGREP ' baz.cc ' mk |
| 69 | $FGREP ' baz.hh ' mk |
| 70 | |
| 71 | $EGREP '(^| )foo\.h\+\+(:| .*:)' Makefile.in |
| 72 | $EGREP '(^| )bar\.hpp(:| .*:)' Makefile.in |
| 73 | $EGREP '(^| )baz\.hh(:| .*:)' Makefile.in |
| 74 | |
| 75 | grepscip-shell system . . grep. ' foo\.h[ :]' mk && exit 1 |
| 76 | grepscip-shell system . . grep. ' bar\.h[ :]' mk && exit 1 |
| 77 | grepscip-shell system . . grep. ' baz\.h[ :]' mk && exit 1 |
| 78 | |
| 79 | $FGREP ' qux-qux.cxx ' mk |
| 80 | $EGREP '(^| )qux-qux\.cxx(:| .*:)' Makefile.in |
| 81 | grepscip-shell system . . grep. 'qux\.h.*:' Makefile.in && exit 1 |
| 82 | |
| 83 | : |