1dnl $Id: acinclude.m4,v 1.4 2005/09/30 10:53:53 dan Exp $
2dnl
3dnl Copyright (c) 2003, 2005 Dan McMahill
4dnl All rights reserved.
5dnl
6dnl This code is derived from software written by Dan McMahill
7dnl
8dnl Redistribution and use in source and binary forms, with or without
9dnl modification, are permitted provided that the following conditions
10dnl are met:
11dnl 1. Redistributions of source code must retain the above copyright
12dnl    notice, this list of conditions and the following disclaimer.
13dnl 2. Redistributions in binary form must reproduce the above copyright
14dnl    notice, this list of conditions and the following disclaimer in the
15dnl    documentation and/or other materials provided with the distribution.
16dnl 3. All advertising materials mentioning features or use of this software
17dnl    must display the following acknowledgement:
18dnl        This product includes software developed by Dan McMahill
19dnl 4. The name of the author may not be used to endorse or promote products
20dnl    derived from this software without specific prior written permission.
21dnl
22dnl THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23dnl IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24dnl OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25dnl IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26dnl INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27dnl BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28dnl LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29dnl AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30dnl OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31dnl OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32dnl SUCH DAMAGE.
33dnl
34
35# Look for GNU make
36
37AC_DEFUN([AC_PATH_GNU_MAKE],
38[#AC_MSG_CHECKING([for GNU make])
39gnu_make=
40for mk in "$GMAKE" "$MAKE" gmake make gnumake ; do
41	if test -n "$mk" ; then
42		AC_MSG_CHECKING([if $mk is GNU make >= 3.80])
43		tmp=`sh -c "$mk --version" 2> /dev/null | grep GNU`
44		if test -z "$tmp" ; then
45			AC_MSG_RESULT([no])
46		else
47			case $tmp in
48	                *\ 3.[[8-9]][[0-9]]*|*\ [[4-9]].[[0-9]]*)
49				AC_MSG_RESULT([yes])
50				gnu_make="$mk"
51				break
52                	        ;;
53
54			* )
55				AC_MSG_RESULT([no])
56				;;
57	                esac
58		fi
59	fi
60done
61if test -z "$gnu_make" ; then
62	AC_MSG_NOTICE([No suitable GNU make found.])
63	GMAKE=none
64	AC_SUBST(GMAKE)
65else
66	AC_PATH_PROG(GMAKE, $gnu_make)
67fi
68])dnl
69
70
71# Look for BSD make
72AC_DEFUN([AC_PATH_BSD_MAKE],
73[
74cat > tmp.mk << EOF
75# include some of the "." commands that we need from a
76# BSD make.
77MYVAR= BSDmake
78MYFLAG= #defined
79test:
80.for __tmp__ in \${MYVAR}
81.if defined(MYFLAG)
82	@echo \${__tmp__}
83.endif
84.endfor
85
86EOF
87bsd_make=
88for mk in "$BMAKE" "$MAKE" make bmake nbmake ; do
89	if test -n "$mk" ; then
90		AC_MSG_CHECKING([if $mk is BSD make])
91		tmp=`sh -c "$mk -f tmp.mk test" 2> /dev/null | grep BSDmake`
92		if test "X$tmp" = "XBSDmake" ; then
93			AC_MSG_RESULT([yes])
94			bsd_make="$mk"
95			break
96		else
97			AC_MSG_RESULT([no])
98		fi
99	fi
100done
101if test -f tmp.mk ; then rm tmp.mk ; fi
102if test -z "$bsd_make" ; then
103	AC_MSG_NOTICE([No suitable BSD make found.])
104	BMAKE=none
105	AC_SUBST(BMAKE)
106else
107	AC_PATH_PROG(BMAKE, $bsd_make)
108fi
109])dnl
110
111
112