Home | History | Annotate | Line # | Download | only in m4
      1 dnl Like AC_CHECK_FUNCS, but allows the function definition to be
      2 dnl a macro.  This allows for detection of functions which are renamed
      3 dnl with macros to something other than the name we are testing with.
      4 AC_DEFUN([AX_CHECK_FUNCS_COMP],[
      5   dnl This is magic to make autoheader pick up the config.h.in templates
      6   dnl automatically.  This uses macros which are probably not public
      7   dnl (not documented anyway) but this works at least with Automake 2.59.
      8   AC_FOREACH([AX_Func], [$1],
      9     [AH_TEMPLATE(AS_TR_CPP(HAVE_[]AX_Func),
     10                  [Define to 1 if you have the `]AX_Func[' function or macro.])])dnl
     11   for ax_func in $1; do
     12     ax_fname=`echo $ax_func | sed "s/@<:@^a-zA-Z0-9_@:>@/_/g"`
     13     ax_symbolname=`echo $ax_func | sed "s/@<:@^a-zA-Z0-9_@:>@/_/g" | tr "@<:@a-z@:>@" "@<:@A-Z@:>@"`
     14     AC_CACHE_CHECK([for $ax_func], ax_cv_func_${ax_fname}, [
     15       AC_LINK_IFELSE(
     16         [ AC_LANG_PROGRAM(
     17             [$4
     18 void *foo = $ax_func;
     19 ],
     20             [  return foo != $ax_func; ])],
     21 	[ eval "ax_cv_func_${ax_fname}=\"yes\"" ],
     22 	[ eval "ax_cv_func_${ax_fname}=\"no\"" ])])
     23     if eval "test \"\${ax_cv_func_${ax_fname}}\" = \"yes\""; then
     24       AC_DEFINE_UNQUOTED(HAVE_${ax_symbolname}, 1,
     25         [Define to 1 if you have the $ax_func() function.])
     26       $2
     27     else
     28       true
     29       $3
     30     fi
     31   done
     32 ])dnl
     33