2 # Copyright (C) 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 # Due to how the handling of $(BUILT_SOURCES) is implemented in Automake-NG,
18 # a recursive make call in the recipe of any $(BUILT_SOURCES) (or of any of
19 # its prerequisites) might cause an infinite recursion (complete with fork
20 # bomb, yuck) if not handled correctly. Verify that this doesn't happen.
21 # For more background, see:
22 # <http://lists.gnu.org/archive/html/help-smalltalk/2012-08/msg00027.html>
23 # <http://lists.gnu.org/archive/html/automake-patches/2012-08/msg00052.html>
24 # Backported to improve coverage of mainline Automake.
29 echo AC_OUTPUT
>> configure.ac
31 cat > Makefile.am
<< 'END'
39 # If the bug is still present, we want this test to fail, not to actually
40 # go fork bomb and potentially crash the user machine. Take care of that.
42 is_too_deep
:= $
(shell
test $
(MAKELEVEL
) -lt 10 && echo no
)
44 ## Extra indentation here required to avoid confusing Automake.
45 ifeq
($
(is_too_deep
),no
)
48 $
(error
::OOPS
:: Recursion too deep
, $
(MAKELEVEL
) levels
)
53 $AUTOMAKE -Wno-portability
58 $MAKE -n foo
>output
2>&1 ||
{ cat output
; exit 1; }
61 # Guard against possible infinite recursion.
62 $FGREP '::OOPS::' output
&& exit 1
64 $MAKE foo
>output
2>&1 ||
{ cat output
; exit 1; }
67 # Guard against possible infinite recursion.
68 $FGREP '::OOPS::' output
&& exit 1