Correct math and limerick.
[dragonfly.git] / contrib / bmake / aclocal.m4
blob2adafba3dac555a38b773aab5dceb14640a5df07
1 dnl RCSid:
2 dnl     $Id: aclocal.m4,v 1.5 2003/03/06 21:21:30 sjg Exp $
3 dnl
5 dnl 
6 dnl AC_CHECK_HEADER_HAS(HEADER, PATTERN, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]))
8 AC_DEFUN(AC_CHECK_HEADER_HAS,
9 [dnl first check if header exists and if so, see if it contains PATTERN
10 ac_has_hdr=`echo "ac_cv_header_$1" | sed 'y%./+-%__p_%'`
11 ac_has_it=`echo "ac_cv_header_$1"_$2 | sed 'y%./+-%__p_%'`
12 if eval "test \"`echo x'$'$ac_has_hdr`\" = x"; then
13   AC_CHECK_HEADER($1)
15 if eval "test \"`echo '$'$ac_has_hdr`\" = yes"; then
16   ac_x=HAVE_`echo "$1" | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
17   AC_DEFINE_UNQUOTED($ac_x)
18   AC_MSG_CHECKING([if $1 has $2])
19   AC_CACHE_VAL($ac_has_it,
20                [eval $ac_has_it=no
21                 AC_EGREP_HEADER($2, $1, eval "$ac_has_it=yes")])
23   if eval "test \"`echo '$'$ac_has_it`\" = yes"; then
24     AC_MSG_RESULT(yes)
25     ac_x=HAVE_`echo "$1"_$2 | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
26     AC_DEFINE_UNQUOTED($ac_x)
27     ifelse([$3], , :, [$3])
28   else
29     AC_MSG_RESULT(no)
30     ifelse([$4], , , [$4
31 ])dnl
32   fi
36 dnl AC_EGREP(PATTERN, FILE, ACTION-IF-FOUND [,
37 dnl                 ACTION-IF-NOT-FOUND])
38 AC_DEFUN(AC_EGREP,
40 dnl Prevent m4 from eating character classes:
41 changequote(, )dnl
42 if egrep "$1" $2 >/dev/null 2>&1; then
43 changequote([, ])dnl
44   ifelse([$3], , :, [$3])
45 ifelse([$4], , , [else
46   $4
47 ])dnl
51 dnl
52 dnl Test for __attribute__
53 dnl
55 AC_DEFUN(AC_C___ATTRIBUTE__, [
56 AC_MSG_CHECKING(for __attribute__)
57 AC_CACHE_VAL(ac_cv___attribute__, [
58 AC_TRY_COMPILE([
59 #include <stdlib.h>
62 static void foo(void) __attribute__ ((noreturn));
64 static void
65 foo(void)
67   exit(1);
70 ac_cv___attribute__=yes,
71 ac_cv___attribute__=no)])
72 if test "$ac_cv___attribute__" = "yes"; then
73   AC_DEFINE(HAVE___ATTRIBUTE__, 1, [define if your compiler has __attribute__])
75 AC_MSG_RESULT($ac_cv___attribute__)