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