1 |
dnl The following macros courtesy of: |
2 |
dnl http://www.gnu.org/software/ac-archive/Installed_Packages/check_gnu_make.html |
3 |
dnl |
4 |
dnl Copyrights are by the individual authors, as listed. |
5 |
dnl License: GPL |
6 |
dnl |
7 |
|
8 |
|
9 |
dnl CHECK_GNU_MAKE() |
10 |
dnl |
11 |
dnl This macro searches for a GNU version of make. If a match is found, the |
12 |
dnl makefile variable `ifGNUmake' is set to the empty string, otherwise it is |
13 |
dnl set to "#". This is useful for including a special features in a Makefile, |
14 |
dnl which cannot be handled by other versions of make. The variable |
15 |
dnl _cv_gnu_make_command is set to the command to invoke GNU make if it exists, |
16 |
dnl the empty string otherwise. |
17 |
dnl |
18 |
dnl Here is an example of its use: |
19 |
dnl |
20 |
dnl Makefile.in might contain: |
21 |
dnl |
22 |
dnl # A failsafe way of putting a dependency rule into a makefile |
23 |
dnl $(DEPEND): |
24 |
dnl $(CC) -MM $(srcdir)/*.c > $(DEPEND) |
25 |
dnl |
26 |
dnl @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND))) |
27 |
dnl @ifGNUmake@ include $(DEPEND) |
28 |
dnl @ifGNUmake@ endif |
29 |
dnl |
30 |
dnl Then configure.in would normally contain: |
31 |
dnl |
32 |
dnl CHECK_GNU_MAKE() |
33 |
dnl AC_OUTPUT(Makefile) |
34 |
dnl |
35 |
dnl Then perhaps to cause gnu make to override any other make, we could do |
36 |
dnl something like this (note that GNU make always looks for GNUmakefile first): |
37 |
dnl |
38 |
dnl if ! test x$_cv_gnu_make_command = x ; then |
39 |
dnl mv Makefile GNUmakefile |
40 |
dnl echo .DEFAULT: > Makefile ; |
41 |
dnl echo \ $_cv_gnu_make_command \$@ >> Makefile; |
42 |
dnl fi |
43 |
dnl |
44 |
dnl Then, if any (well almost any) other make is called, and GNU make also exists, |
45 |
dnl then the other make wraps the GNU make. |
46 |
dnl |
47 |
dnl John Darrington <j.darrington@elvis.murdoch.edu.au> |
48 |
dnl 1.3 (2002/01/04) |
49 |
dnl |
50 |
dnl Modified 18 Sep 2002 by Jon Nelson <jnelson@boa.org> |
51 |
|
52 |
AC_DEFUN([CHECK_GNU_MAKE], |
53 |
[ AC_CACHE_CHECK( for GNU make, _cv_gnu_make_command, |
54 |
[_cv_gnu_make_command='' |
55 |
dnl Search all the common names for GNU make |
56 |
for a in "$MAKE" make gmake gnumake ; do |
57 |
if test -z "$a" ; then continue ; fi |
58 |
if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ); then |
59 |
_cv_gnu_make_command=$a |
60 |
break; |
61 |
fi |
62 |
done |
63 |
if test "x$_cv_gnu_make_command" = "x"; then |
64 |
_cv_gnu_make_command="Not found" |
65 |
fi |
66 |
]) |
67 |
dnl If there was a GNU version, then set @ifGNUmake@ to the empty string, '#' otherwise |
68 |
if test "$_cv_gnu_make_command" != "Not found"; then |
69 |
ifGNUmake=''; |
70 |
else |
71 |
ifGNUmake='#'; |
72 |
_cv_gnu_make_command=''; |
73 |
fi |
74 |
AC_SUBST(ifGNUmake) |
75 |
]) |
76 |
|
77 |
dnl AC_CHECK_STRUCT_FOR(INCLUDES,STRUCT,MEMBER,DEFINE,[no]) |
78 |
dnl 1.1 (2000/09/19) |
79 |
dnl Wes Hardaker <wjhardaker@ucdavis.edu> |
80 |
|
81 |
dnl ---------------------------------------------------------- |
82 |
|
83 |
AC_DEFUN([AC_CHECK_STRUCT_FOR],[ |
84 |
ac_safe_struct=`echo "$2" | sed 'y%./+-%__p_%'` |
85 |
ac_safe_member=`echo "$3" | sed 'y%./+-%__p_%'` |
86 |
ac_safe_all="ac_cv_struct_${ac_safe_struct}_has_${ac_safe_member}" |
87 |
changequote(, )dnl |
88 |
ac_uc_define=STRUCT_`echo "${ac_safe_struct}_HAS_${ac_safe_member}" | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` |
89 |
changequote([, ])dnl |
90 |
|
91 |
AC_MSG_CHECKING([for $2.$3]) |
92 |
AC_CACHE_VAL($ac_safe_all, |
93 |
[ |
94 |
if test "x$4" = "x"; then |
95 |
defineit="= 0" |
96 |
elif test "x$4" = "xno"; then |
97 |
defineit="" |
98 |
else |
99 |
defineit="$4" |
100 |
fi |
101 |
AC_TRY_COMPILE([ |
102 |
$1 |
103 |
],[ |
104 |
struct $2 testit; |
105 |
testit.$3 $defineit; |
106 |
], eval "${ac_safe_all}=yes", eval "${ac_safe_all}=no" ) |
107 |
]) |
108 |
|
109 |
if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then |
110 |
AC_MSG_RESULT(yes) |
111 |
AC_DEFINE_UNQUOTED($ac_uc_define) |
112 |
else |
113 |
AC_MSG_RESULT(no) |
114 |
fi |
115 |
]) |
116 |
|