2 # Copyright (C) 2011 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)
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 <http://www.gnu.org/licenses/>.
17 # Check support for AM_DISTCHECK_CONFIGURE_FLAGS at "make distcheck"
18 # time, and its interactions with DISTCHECK_CONFIGURE_FLAGS.
24 cat >> configure.in << 'END'
25 AC_ARG_ENABLE([success], [], [success=$enableval], [success=no])
26 AS_IF([test $success = yes && test "$sentence" = 'it works :-)'],
28 [AC_MSG_ERROR([success='$success', sentence='$sentence'])])
34 cat > Makefile.am << 'END'
35 AM_DISTCHECK_CONFIGURE_FLAGS = $(dc_flags1) $(dc_flags2)
36 dc_flags1 = --enable-success sentence='it works :-)'
42 $FGREP '$(DISTCHECK_CONFIGURE_FLAGS)' Makefile.in
43 $FGREP '$(AM_DISTCHECK_CONFIGURE_FLAGS)' Makefile.in
44 grep 'DISTCHECK_CONFIGURE_FLAGS.*AM_DISTCHECK_CONFIGURE_FLAGS' Makefile.in \
48 ./configure --enable-success sentence='it works :-)'
50 # The configure call in "make distcheck" should honour
51 # $(AM_DISTCHECK_CONFIGURE_FLAGS).
55 # $(DISTCHECK_CONFIGURE_FLAGS) takes precedence over
56 # $(AM_DISTCHECK_CONFIGURE_FLAGS)
58 cat >> Makefile.am << 'END'
59 dc_flags2 += --disable-success
62 ./config.status Makefile
64 $MAKE distcheck >output 2>&1 && { cat output; Exit 1; }
66 grep "^configure:.* success='no', sentence='it works :-)'" output
68 $MAKE distcheck DISTCHECK_CONFIGURE_FLAGS="--enable-success=yes"