aclocal.m4 revision 302408
1dnl RCSid: 2dnl $Id: aclocal.m4,v 1.5 2003/03/06 21:21:30 sjg Exp $ 3dnl 4 5dnl 6dnl AC_CHECK_HEADER_HAS(HEADER, PATTERN, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])) 7 8AC_DEFUN(AC_CHECK_HEADER_HAS, 9[dnl first check if header exists and if so, see if it contains PATTERN 10ac_has_hdr=`echo "ac_cv_header_$1" | sed 'y%./+-%__p_%'` 11ac_has_it=`echo "ac_cv_header_$1"_$2 | sed 'y%./+-%__p_%'` 12if eval "test \"`echo x'$'$ac_has_hdr`\" = x"; then 13 AC_CHECK_HEADER($1) 14fi 15if 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")]) 22 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 33fi 34]) 35 36dnl AC_EGREP(PATTERN, FILE, ACTION-IF-FOUND [, 37dnl ACTION-IF-NOT-FOUND]) 38AC_DEFUN(AC_EGREP, 39[ 40dnl Prevent m4 from eating character classes: 41changequote(, )dnl 42if egrep "$1" $2 >/dev/null 2>&1; then 43changequote([, ])dnl 44 ifelse([$3], , :, [$3]) 45ifelse([$4], , , [else 46 $4 47])dnl 48fi 49]) 50 51dnl 52dnl Test for __attribute__ 53dnl 54 55AC_DEFUN(AC_C___ATTRIBUTE__, [ 56AC_MSG_CHECKING(for __attribute__) 57AC_CACHE_VAL(ac_cv___attribute__, [ 58AC_TRY_COMPILE([ 59#include <stdlib.h> 60], 61[ 62static void foo(void) __attribute__ ((noreturn)); 63 64static void 65foo(void) 66{ 67 exit(1); 68} 69], 70ac_cv___attribute__=yes, 71ac_cv___attribute__=no)]) 72if test "$ac_cv___attribute__" = "yes"; then 73 AC_DEFINE(HAVE___ATTRIBUTE__, 1, [define if your compiler has __attribute__]) 74fi 75AC_MSG_RESULT($ac_cv___attribute__) 76]) 77 78