OSDN Git Service

Use datarootdir for locales.
[pf3gnuchains/pf3gnuchains4x.git] / sid / component / cgen-cpu / acinclude.m4
1 dnl See whether we need a declaration for a function.
2 dnl The result is highly dependent on the INCLUDES passed in, so make sure
3 dnl to use a different cache variable name in this macro if it is invoked
4 dnl in a different context somewhere else.
5 dnl gcc_AC_CHECK_DECL(SYMBOL,
6 dnl     [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, INCLUDES]]])
7 AC_DEFUN([gcc_AC_CHECK_DECL],
8 [AC_MSG_CHECKING([whether $1 is declared])
9 AC_CACHE_VAL(gcc_cv_have_decl_$1,
10 [AC_TRY_COMPILE([$4],
11 [#ifndef $1
12 char *(*pfn)(char *) = (char *(*)(char *)) $1 ;
13 #endif], eval "gcc_cv_have_decl_$1=yes", eval "gcc_cv_have_decl_$1=no")])
14 if eval "test \"`echo '$gcc_cv_have_decl_'$1`\" = yes"; then
15   AC_MSG_RESULT(yes) ; ifelse([$2], , :, [$2])
16 else
17   AC_MSG_RESULT(no) ; ifelse([$3], , :, [$3])
18 fi
19 ])dnl
20
21 dnl Check multiple functions to see whether each needs a declaration.
22 dnl Arrange to define HAVE_DECL_<FUNCTION> to 0 or 1 as appropriate.
23 dnl gcc_AC_CHECK_DECLS(SYMBOLS,
24 dnl     [ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED [, INCLUDES]]])
25 AC_DEFUN([gcc_AC_CHECK_DECLS],
26 [for ac_func in $1
27 do
28 changequote(, )dnl
29   ac_tr_decl=HAVE_DECL_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
30 changequote([, ])dnl
31 gcc_AC_CHECK_DECL($ac_func,
32   [AC_DEFINE_UNQUOTED($ac_tr_decl, 1) $2],
33   [AC_DEFINE_UNQUOTED($ac_tr_decl, 0) $3],
34 dnl It is possible that the include files passed in here are local headers
35 dnl which supply a backup declaration for the relevant prototype based on
36 dnl the definition of (or lack of) the HAVE_DECL_ macro.  If so, this test
37 dnl will always return success.  E.g. see libiberty.h's handling of
38 dnl `basename'.  To avoid this, we define the relevant HAVE_DECL_ macro to
39 dnl 1 so that any local headers used do not provide their own prototype
40 dnl during this test.
41 #undef $ac_tr_decl
42 #define $ac_tr_decl 1
43   $4
44 )
45 done
46 dnl Automatically generate config.h entries via autoheader.
47 if test x = y ; then
48   patsubst(translit([$1], [a-z], [A-Z]), [\w+],
49     [AC_DEFINE([HAVE_DECL_\&], 1,
50       [Define to 1 if we found this declaration otherwise define to 0.])])dnl
51 fi
52 ])