]> git.saurik.com Git - bison.git/blame - m4/bison-decl.m4
Change the handling of @s so that they behave exactly like $s.
[bison.git] / m4 / bison-decl.m4
CommitLineData
8c44d3ec 1dnl FIXME: This should be soon obsoleted by AC_CHECK_DECL.
f9b730cd
JT
2
3dnl See whether we need a declaration for a function.
4dnl BISON_NEED_DECLARATION(FUNCTION [, EXTRA-HEADER-FILES])
5AC_DEFUN(BISON_NEED_DECLARATION,
6[AC_MSG_CHECKING([whether $1 must be declared])
7AC_CACHE_VAL(bison_cv_decl_needed_$1,
8[AC_TRY_COMPILE([
9#include <stdio.h>
10#ifdef HAVE_STRING_H
11#include <string.h>
12#else
13#ifdef HAVE_STRINGS_H
14#include <strings.h>
15#endif
16#endif
17#ifdef HAVE_STDLIB_H
18#include <stdlib.h>
19#endif
20#ifdef HAVE_UNISTD_H
21#include <unistd.h>
22#endif
23#ifndef HAVE_RINDEX
24#define rindex strrchr
25#endif
26#ifndef HAVE_INDEX
27#define index strchr
28#endif
29$2],
30[char *(*pfn) = (char *(*)) $1],
31eval "bison_cv_decl_needed_$1=no", eval "bison_cv_decl_needed_$1=yes")])
32if eval "test \"`echo '$bison_cv_decl_needed_'$1`\" = yes"; then
33 AC_MSG_RESULT(yes)
34 bison_tr_decl=NEED_DECLARATION_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
35 AC_DEFINE_UNQUOTED($bison_tr_decl)
36else
37 AC_MSG_RESULT(no)
38fi
39])dnl
40
41dnl Check multiple functions to see whether each needs a declaration.
42dnl BISON_NEED_DECLARATIONS(FUNCTION... [, EXTRA-HEADER-FILES])
43AC_DEFUN(BISON_NEED_DECLARATIONS,
44[for ac_func in $1
45do
46BISON_NEED_DECLARATION($ac_func, $2)
47done
48])