2 dnl $Id: aclocal.m4,v 1.5 2003/03/06 21:21:30 sjg Exp $
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
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,
21 AC_EGREP_HEADER($2, $1, eval "$ac_has_it=yes")])
23 if eval "test \"`echo '$'$ac_has_it`\" = yes"; then
25 ac_x=HAVE_`echo "$1"_$2 | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
26 AC_DEFINE_UNQUOTED($ac_x)
27 ifelse([$3], , :, [$3])
36 dnl AC_EGREP(PATTERN, FILE, ACTION-IF-FOUND [,
37 dnl ACTION-IF-NOT-FOUND])
40 dnl Prevent m4 from eating character classes:
42 if egrep "$1" $2 >/dev/null 2>&1; then
44 ifelse([$3], , :, [$3])
45 ifelse([$4], , , [else
52 dnl Test for __attribute__
55 AC_DEFUN(AC_C___ATTRIBUTE__, [
56 AC_MSG_CHECKING(for __attribute__)
57 AC_CACHE_VAL(ac_cv___attribute__, [
62 static void foo(void) __attribute__ ((noreturn));
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__)