doc: typos in test file.
[automake.git] / t / distcheck-configure-flags-am.sh
blob7ad30c55c35e03557a3bbb3a5870ed1fa43b1ac5
1 #! /bin/sh
2 # Copyright (C) 2011-2024 Free Software Foundation, Inc.
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.
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.
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/>.
17 # Check support for AM_DISTCHECK_CONFIGURE_FLAGS at "make distcheck"
18 # time, and its interactions with DISTCHECK_CONFIGURE_FLAGS.
20 . test-init.sh
22 cat >> configure.ac << 'END'
23 AC_ARG_ENABLE([success], [], [success=$enableval], [success=no])
24 AS_IF([test $success = yes && test "$sentence" = 'it works :-)'],
25 [:],
26 [AC_MSG_ERROR([success='$success', sentence='$sentence'])])
27 AC_OUTPUT
28 END
30 unset sentence
32 cat > Makefile.am << 'END'
33 AM_DISTCHECK_CONFIGURE_FLAGS = $(dc_flags1) $(dc_flags2)
34 dc_flags1 = --enable-success sentence='it works :-)'
35 dc_flags2 =
36 END
38 $ACLOCAL
39 $AUTOMAKE
40 $FGREP '$(DISTCHECK_CONFIGURE_FLAGS)' Makefile.in
41 $FGREP '$(AM_DISTCHECK_CONFIGURE_FLAGS)' Makefile.in
42 grep 'DISTCHECK_CONFIGURE_FLAGS.*AM_DISTCHECK_CONFIGURE_FLAGS' Makefile.in \
43 && exit 1
45 $AUTOCONF
46 ./configure --enable-success sentence='it works :-)'
48 # The configure call in "make distcheck" should honour
49 # $(AM_DISTCHECK_CONFIGURE_FLAGS).
51 $MAKE distcheck
53 # $(DISTCHECK_CONFIGURE_FLAGS) takes precedence over
54 # $(AM_DISTCHECK_CONFIGURE_FLAGS)
56 cat >> Makefile.am << 'END'
57 dc_flags2 += --disable-success
58 END
59 $AUTOMAKE Makefile
60 ./config.status Makefile
62 run_make -e FAIL -M distcheck
63 grep "^configure:.* success='no', sentence='it works :-)'" output
65 $MAKE distcheck DISTCHECK_CONFIGURE_FLAGS="--enable-success=yes"