2 # Copyright (C) 2011-2012 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.
22 cat >> configure.ac << 'END'
23 AC_ARG_ENABLE([success], [], [success=$enableval], [success=no])
24 AS_IF([test $success = yes && test "$sentence" = 'it works :-)'],
26 [AC_MSG_ERROR([success='$success', sentence='$sentence'])])
32 cat > Makefile.am << 'END'
33 AM_DISTCHECK_CONFIGURE_FLAGS = $(dc_flags1) $(dc_flags2)
34 dc_flags1 = --enable-success sentence='it works :-)'
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 \
46 ./configure --enable-success sentence='it works :-)'
48 # The configure call in "make distcheck" should honour
49 # $(AM_DISTCHECK_CONFIGURE_FLAGS).
53 # $(DISTCHECK_CONFIGURE_FLAGS) takes precedence over
54 # $(AM_DISTCHECK_CONFIGURE_FLAGS)
56 cat >> Makefile.am << 'END'
57 dc_flags2 += --disable-success
60 ./config.status Makefile
62 $MAKE distcheck >output 2>&1 && { cat output; exit 1; }
64 grep "^configure:.* success='no', sentence='it works :-)'" output
66 $MAKE distcheck DISTCHECK_CONFIGURE_FLAGS="--enable-success=yes"