]> git.saurik.com Git - bison.git/blame - acinclude.m4
Added ChangeLog to the repository.
[bison.git] / acinclude.m4
CommitLineData
9eceb6c6
JT
1dnl BISON_DEFINE_FILE(VARNAME, FILE)
2dnl Defines (with AC_DEFINE) VARNAME to the expansion of the FILE
3dnl variable, expanding ${prefix} and such.
4dnl Example: BISON_DEFINE_FILE(DATADIR, datadir)
5dnl By Alexandre Oliva <oliva@dcc.unicamp.br>
6AC_DEFUN(BISON_DEFINE_FILE, [
7 ac_expanded=`(
8 test "x$prefix" = xNONE && prefix="$ac_default_prefix"
9 test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
10 eval echo \""[$]$2"\"
11 )`
12 AC_DEFINE_UNQUOTED($1, "$ac_expanded")
13])
f9b730cd
JT
14
15dnl See whether we need a declaration for a function.
16dnl BISON_NEED_DECLARATION(FUNCTION [, EXTRA-HEADER-FILES])
17AC_DEFUN(BISON_NEED_DECLARATION,
18[AC_MSG_CHECKING([whether $1 must be declared])
19AC_CACHE_VAL(bison_cv_decl_needed_$1,
20[AC_TRY_COMPILE([
21#include <stdio.h>
22#ifdef HAVE_STRING_H
23#include <string.h>
24#else
25#ifdef HAVE_STRINGS_H
26#include <strings.h>
27#endif
28#endif
29#ifdef HAVE_STDLIB_H
30#include <stdlib.h>
31#endif
32#ifdef HAVE_UNISTD_H
33#include <unistd.h>
34#endif
35#ifndef HAVE_RINDEX
36#define rindex strrchr
37#endif
38#ifndef HAVE_INDEX
39#define index strchr
40#endif
41$2],
42[char *(*pfn) = (char *(*)) $1],
43eval "bison_cv_decl_needed_$1=no", eval "bison_cv_decl_needed_$1=yes")])
44if eval "test \"`echo '$bison_cv_decl_needed_'$1`\" = yes"; then
45 AC_MSG_RESULT(yes)
46 bison_tr_decl=NEED_DECLARATION_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
47 AC_DEFINE_UNQUOTED($bison_tr_decl)
48else
49 AC_MSG_RESULT(no)
50fi
51])dnl
52
53dnl Check multiple functions to see whether each needs a declaration.
54dnl BISON_NEED_DECLARATIONS(FUNCTION... [, EXTRA-HEADER-FILES])
55AC_DEFUN(BISON_NEED_DECLARATIONS,
56[for ac_func in $1
57do
58BISON_NEED_DECLARATION($ac_func, $2)
59done
60])