need-proto.m4 revision 1.1 1 1.1 elric dnl $Id: need-proto.m4,v 1.1 2011/04/13 18:14:32 elric Exp $
2 1.1 elric dnl
3 1.1 elric dnl
4 1.1 elric dnl Check if we need the prototype for a function
5 1.1 elric dnl
6 1.1 elric
7 1.1 elric dnl AC_NEED_PROTO(includes, function)
8 1.1 elric
9 1.1 elric AC_DEFUN([AC_NEED_PROTO], [
10 1.1 elric if test "$ac_cv_func_$2+set" != set -o "$ac_cv_func_$2" = yes; then
11 1.1 elric AC_CACHE_CHECK([if $2 needs a prototype], ac_cv_func_$2_noproto,
12 1.1 elric AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$1
13 1.1 elric struct foo { int foo; } xx;
14 1.1 elric extern int $2 (struct foo*);]],[[$2(&xx)]])],
15 1.1 elric [eval "ac_cv_func_$2_noproto=yes"],
16 1.1 elric [eval "ac_cv_func_$2_noproto=no"]))
17 1.1 elric if test "$ac_cv_func_$2_noproto" = yes; then
18 1.1 elric AC_DEFINE(AS_TR_CPP(NEED_[]$2[]_PROTO), 1,
19 1.1 elric [define if the system is missing a prototype for $2()])
20 1.1 elric fi
21 1.1 elric fi
22 1.1 elric ])
23