import of gcc-2.8
[official-gcc.git] / gcc / aclocal.m4
blob07424f1e9a00d0b290d4a00a22ed6c75112911dd
1 dnl See whether we need a declaration for a function.
2 AC_DEFUN(GCC_NEED_DECLARATION,
3 [AC_MSG_CHECKING([whether $1 must be declared])
4 AC_CACHE_VAL(gcc_cv_decl_needed_$1,
5 [AC_TRY_COMPILE([
6 #include <stdio.h>
7 #ifdef HAVE_STRING_H
8 #include <string.h>
9 #else
10 #ifdef HAVE_STRINGS_H
11 #include <strings.h>
12 #endif
13 #endif
14 #ifdef HAVE_STDLIB_H
15 #include <stdlib.h>
16 #endif
17 #ifdef HAVE_UNISTD_H
18 #include <unistd.h>
19 #endif
20 #ifndef HAVE_RINDEX
21 #define rindex strrchr
22 #endif
23 #ifndef HAVE_INDEX
24 #define index strchr
25 #endif],
26 [char *(*pfn) = (char *(*)) $1],
27 gcc_cv_decl_needed_$1=no, gcc_cv_decl_needed_$1=yes)])
28 AC_MSG_RESULT($gcc_cv_decl_needed_$1)
29 if test $gcc_cv_decl_needed_$1 = yes; then
30   gcc_tr_decl=NEED_DECLARATION_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
31   AC_DEFINE_UNQUOTED($gcc_tr_decl)
33 ])dnl