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