Fix for PR automake/175:
[automake.git] / m4 / make.m4
blob392e1d5f278a03f55ba26c1ba1ca8fcd45f675a2
1 # AM_MAKE_INCLUDE()
2 # -----------------
3 # Check to see how make treats includes.
4 AC_DEFUN([AM_MAKE_INCLUDE],
5 [am_make=${MAKE-make}
6 cat > confinc << 'END'
7 doit:
8         @echo done
9 END
10 # If we don't find an include directive, just comment out the code.
11 AC_MSG_CHECKING([for style of include used by $am_make])
12 _am_include='#'
13 _am_quote=
14 _am_result=none
15 # First try GNU make style include.
16 echo "include confinc" > confmf
17 # We grep out `Entering directory' and `Leaving directory'
18 # messages which can occur if `w' ends up in MAKEFLAGS.
19 # In particular we don't look at `^make:' because GNU make might
20 # be invoked under some other name (usually "gmake"), in which
21 # case it prints its new name instead of `make'.
22 if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then
23    _am_include=include
24    _am_quote=
25    _am_result=GNU
27 # Now try BSD make style include.
28 if test "$_am_include" = "#"; then
29    echo '.include "confinc"' > confmf
30    if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
31       _am_include=.include
32       _am_quote='"'
33       _am_result=BSD
34    fi
36 AC_SUBST(_am_include)
37 AC_SUBST(_am_quote)
38 AC_MSG_RESULT($_am_result)
39 rm -f confinc confmf