]> git.saurik.com Git - bison.git/blob - m4/bison-decl.m4
* tests/calc.m4 (calc.y): Do not assign to stdin, as it's not
[bison.git] / m4 / bison-decl.m4
1 dnl FIXME: This should be soon obsoleted by AC_CHECK_DECL.
2
3 dnl See whether we need a declaration for a function.
4 dnl BISON_NEED_DECLARATION(FUNCTION [, EXTRA-HEADER-FILES])
5 AC_DEFUN(BISON_NEED_DECLARATION,
6 [AC_MSG_CHECKING([whether $1 must be declared])
7 AC_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],
31 eval "bison_cv_decl_needed_$1=no", eval "bison_cv_decl_needed_$1=yes")])
32 if 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)
36 else
37 AC_MSG_RESULT(no)
38 fi
39 ])dnl
40
41 dnl Check multiple functions to see whether each needs a declaration.
42 dnl BISON_NEED_DECLARATIONS(FUNCTION... [, EXTRA-HEADER-FILES])
43 AC_DEFUN(BISON_NEED_DECLARATIONS,
44 [for ac_func in $1
45 do
46 BISON_NEED_DECLARATION($ac_func, $2)
47 done
48 ])