OSDN Git Service

Daily bump.
[pf3gnuchains/gcc-fork.git] / gcc / aclocal.m4
1 dnl See whether we can include both string.h and strings.h.
2 AC_DEFUN(GCC_HEADER_STRING,
3 [AC_CACHE_CHECK([whether string.h and strings.h may both be included],
4   gcc_cv_header_string,
5 [AC_TRY_COMPILE([#include <string.h>
6 #include <strings.h>], , gcc_cv_header_string=yes, gcc_cv_header_string=no)])
7 if test $gcc_cv_header_string = yes; then
8   AC_DEFINE(STRING_WITH_STRINGS)
9 fi
10 ])
11
12 dnl See whether we need a declaration for a function.
13 dnl GCC_NEED_DECLARATION(FUNCTION [, EXTRA-HEADER-FILES])
14 AC_DEFUN(GCC_NEED_DECLARATION,
15 [AC_MSG_CHECKING([whether $1 must be declared])
16 AC_CACHE_VAL(gcc_cv_decl_needed_$1,
17 [AC_TRY_COMPILE([
18 #include <stdio.h>
19 #ifdef STRING_WITH_STRINGS
20 # include <string.h>
21 # include <strings.h>
22 #else
23 # ifdef HAVE_STRING_H
24 #  include <string.h>
25 # else
26 #  ifdef HAVE_STRINGS_H
27 #   include <strings.h>
28 #  endif
29 # endif
30 #endif
31 #ifdef HAVE_STDLIB_H
32 #include <stdlib.h>
33 #endif
34 #ifdef HAVE_UNISTD_H
35 #include <unistd.h>
36 #endif
37 #ifndef HAVE_RINDEX
38 #define rindex strrchr
39 #endif
40 #ifndef HAVE_INDEX
41 #define index strchr
42 #endif
43 $2],
44 [char *(*pfn) = (char *(*)) $1],
45 eval "gcc_cv_decl_needed_$1=no", eval "gcc_cv_decl_needed_$1=yes")])
46 if eval "test \"`echo '$gcc_cv_decl_needed_'$1`\" = yes"; then
47   AC_MSG_RESULT(yes)
48   gcc_tr_decl=NEED_DECLARATION_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
49   AC_DEFINE_UNQUOTED($gcc_tr_decl)
50 else
51   AC_MSG_RESULT(no)
52 fi
53 ])dnl
54
55 dnl Check multiple functions to see whether each needs a declaration.
56 dnl GCC_NEED_DECLARATIONS(FUNCTION... [, EXTRA-HEADER-FILES])
57 AC_DEFUN(GCC_NEED_DECLARATIONS,
58 [for ac_func in $1
59 do
60 GCC_NEED_DECLARATION($ac_func, $2)
61 done
62 ])
63
64 dnl Check if we have vprintf and possibly _doprnt.
65 dnl Note autoconf checks for vprintf even though we care about vfprintf.
66 AC_DEFUN(GCC_FUNC_VFPRINTF_DOPRNT,
67 [AC_FUNC_VPRINTF
68 vfprintf=
69 doprint=
70 if test $ac_cv_func_vprintf != yes ; then
71   vfprintf=vfprintf.o
72   if test $ac_cv_func__doprnt != yes ; then
73     doprint=doprint.o
74   fi
75 fi
76 AC_SUBST(vfprintf)
77 AC_SUBST(doprint)
78 ])    
79
80 dnl See if the printf functions in libc support %p in format strings.
81 AC_DEFUN(GCC_FUNC_PRINTF_PTR,
82 [AC_CACHE_CHECK(whether the printf functions support %p,
83   gcc_cv_func_printf_ptr,
84 [AC_TRY_RUN([#include <stdio.h>
85
86 main()
87 {
88   char buf[64];
89   char *p = buf, *q = NULL;
90   sprintf(buf, "%p", p);
91   sscanf(buf, "%p", &q);
92   exit (p != q);
93 }], gcc_cv_func_printf_ptr=yes, gcc_cv_func_printf_ptr=no,
94         gcc_cv_func_printf_ptr=no)
95 rm -f core core.* *.core])
96 if test $gcc_cv_func_printf_ptr = yes ; then
97   AC_DEFINE(HAVE_PRINTF_PTR)
98 fi
99 ])
100
101 dnl See if symbolic links work and if not, try to substitute either hard links or simple copy.
102 AC_DEFUN(GCC_PROG_LN_S,
103 [AC_MSG_CHECKING(whether ln -s works)
104 AC_CACHE_VAL(gcc_cv_prog_LN_S,
105 [rm -f conftestdata_t
106 echo >conftestdata_f
107 if ln -s conftestdata_f conftestdata_t 2>/dev/null
108 then
109   gcc_cv_prog_LN_S="ln -s"
110 else
111   if ln conftestdata_f conftestdata_t 2>/dev/null
112   then
113     gcc_cv_prog_LN_S=ln
114   else
115     gcc_cv_prog_LN_S=cp
116   fi
117 fi
118 rm -f conftestdata_f conftestdata_t
119 ])dnl
120 LN_S="$gcc_cv_prog_LN_S"
121 if test "$gcc_cv_prog_LN_S" = "ln -s"; then
122   AC_MSG_RESULT(yes)
123 else
124   if test "$gcc_cv_prog_LN_S" = "ln"; then
125     AC_MSG_RESULT([no, using ln])
126   else
127     AC_MSG_RESULT([no, and neither does ln, so using cp])
128   fi
129 fi
130 AC_SUBST(LN_S)dnl
131 ])
132
133 dnl See if hard links work and if not, try to substitute either symbolic links or simple copy.
134 AC_DEFUN(GCC_PROG_LN,
135 [AC_MSG_CHECKING(whether ln works)
136 AC_CACHE_VAL(gcc_cv_prog_LN,
137 [rm -f conftestdata_t
138 echo >conftestdata_f
139 if ln conftestdata_f conftestdata_t 2>/dev/null
140 then
141   gcc_cv_prog_LN="ln"
142 else
143   if ln -s conftestdata_f conftestdata_t 2>/dev/null
144   then
145     gcc_cv_prog_LN="ln -s"
146   else
147     gcc_cv_prog_LN=cp
148   fi
149 fi
150 rm -f conftestdata_f conftestdata_t
151 ])dnl
152 LN="$gcc_cv_prog_LN"
153 if test "$gcc_cv_prog_LN" = "ln"; then
154   AC_MSG_RESULT(yes)
155 else
156   if test "$gcc_cv_prog_LN" = "ln -s"; then
157     AC_MSG_RESULT([no, using ln -s])
158   else
159     AC_MSG_RESULT([no, and neither does ln -s, so using cp])
160   fi
161 fi
162 AC_SUBST(LN)dnl
163 ])
164
165 dnl See whether the stage1 host compiler accepts the volatile keyword.
166 AC_DEFUN(GCC_C_VOLATILE,
167 [AC_CACHE_CHECK([for volatile], gcc_cv_c_volatile,
168 [AC_TRY_COMPILE(, [volatile int foo;],
169         gcc_cv_c_volatile=yes, gcc_cv_c_volatile=no)])
170 if test $gcc_cv_c_volatile = yes ; then
171   AC_DEFINE(HAVE_VOLATILE)
172 fi
173 ])
174
175 AC_DEFUN(EGCS_PROG_INSTALL,
176 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
177 # Find a good install program.  We prefer a C program (faster),
178 # so one script is as good as another.  But avoid the broken or
179 # incompatible versions:
180 # SysV /etc/install, /usr/sbin/install
181 # SunOS /usr/etc/install
182 # IRIX /sbin/install
183 # AIX /bin/install
184 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
185 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
186 # ./install, which can be erroneously created by make from ./install.sh.
187 AC_MSG_CHECKING(for a BSD compatible install)
188 if test -z "$INSTALL"; then
189 AC_CACHE_VAL(ac_cv_path_install,
190 [  IFS="${IFS=  }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
191   for ac_dir in $PATH; do
192     # Account for people who put trailing slashes in PATH elements.
193     case "$ac_dir/" in
194     /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
195     *)
196       # OSF1 and SCO ODT 3.0 have their own names for install.
197       for ac_prog in ginstall scoinst install; do
198         if test -f $ac_dir/$ac_prog; then
199           if test $ac_prog = install &&
200             grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
201             # AIX install.  It has an incompatible calling convention.
202             # OSF/1 installbsd also uses dspmsg, but is usable.
203             :
204           else
205             ac_cv_path_install="$ac_dir/$ac_prog -c"
206             break 2
207           fi
208         fi
209       done
210       ;;
211     esac
212   done
213   IFS="$ac_save_IFS"
214 ])dnl
215   if test "${ac_cv_path_install+set}" = set; then
216     INSTALL="$ac_cv_path_install"
217   else
218     # As a last resort, use the slow shell script.  We don't cache a
219     # path for INSTALL within a source directory, because that will
220     # break other packages using the cache if that directory is
221     # removed, or if the path is relative.
222     INSTALL="$ac_install_sh"
223   fi
224 fi
225 dnl We do special magic for INSTALL instead of AC_SUBST, to get
226 dnl relative paths right.
227 AC_MSG_RESULT($INSTALL)
228 AC_SUBST(INSTALL)dnl
229
230 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
231 # It thinks the first close brace ends the variable substitution.
232 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
233 AC_SUBST(INSTALL_PROGRAM)dnl
234
235 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
236 AC_SUBST(INSTALL_DATA)dnl
237 ])