1dnl @synopsis AC_CHECK_SYMBOL(SYMBOL, HEADER... [,ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]])
2dnl
3dnl a wrapper around AC_EGREP_HEADER the shellvar $ac_found will hold
4dnl the HEADER-name that had been containing the symbol. This value is
5dnl shown to the user.
6dnl
7dnl @category C
8dnl @author Guido U. Draheim <guidod@gmx.de>
9dnl @version 2006-10-13
10dnl @license GPLWithACException
11
12AC_DEFUN([AC_CHECK_SYMBOL],
13[AC_MSG_CHECKING([for $1 in $2])
14AC_CACHE_VAL(ac_cv_func_$1,
15[AC_REQUIRE_CPP()dnl
16changequote(, )dnl
17symbol="[^a-zA-Z_0-9]$1[^a-zA-Z_0-9]"
18changequote([, ])dnl
19ac_found=no
20for ac_header in $2 ; do
21  ac_safe=`echo "$ac_header" | sed 'y%./+-%__p_%' `
22  if test $ac_found != "yes" ; then
23      if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
24            AC_EGREP_HEADER( $symbol, $ac_header, [ac_found="$ac_header"] )
25      fi
26  fi
27done
28if test "$ac_found" != "no" ; then
29  AC_MSG_RESULT($ac_found)
30  ifelse([$3], , :, [$3])
31else
32  AC_MSG_RESULT(no)
33  ifelse([$4], , , [$4
34])dnl
35fi
36])])
37
38dnl AC_CHECK_SYMBOLS( symbol..., header... [, action-if-found [, action-if-not-found]])
39AC_DEFUN([AC_CHECK_SYMBOLS],
40[for ac_func in $1
41do
42P4_CHECK_SYMBOL($ac_func, $2,
43[changequote(, )dnl
44  ac_tr_func=HAVE_`echo $ac_func | sed -e 'y:abcdefghijklmnopqrstuvwxyz:ABCDEFGHIJKLMNOPQRSTUVWXYZ:' -e 's:[[^A-Z0-9]]:_:'`
45changequote([, ])dnl
46  AC_DEFINE_UNQUOTED($ac_tr_func) $2], $3)dnl
47done
48])
49