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,
21 #define rindex strrchr
26 [char *(*pfn) = (char *(*)) $1],
27 eval "gcc_cv_decl_needed_$1=no", eval "gcc_cv_decl_needed_$1=yes")])
28 if eval "test \"`echo '$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)
37 dnl Check multiple functions to see whether each needs a declaration.
38 AC_DEFUN(GCC_NEED_DECLARATIONS,
41 GCC_NEED_DECLARATION($ac_func)
45 dnl Check if we have vprintf and possibly _doprnt.
46 dnl Note autoconf checks for vprintf even though we care about vfprintf.
47 AC_DEFUN(GCC_FUNC_VFPRINTF_DOPRNT,
51 if test $ac_cv_func_vprintf != yes ; then
53 if test $ac_cv_func__doprnt != yes ; then
61 dnl See if the printf functions in libc support %p in format strings.
62 AC_DEFUN(GCC_FUNC_PRINTF_PTR,
63 [AC_CACHE_CHECK(whether the printf functions support %p,
64 gcc_cv_func_printf_ptr,
65 [AC_TRY_RUN([#include <stdio.h>
70 char *p = buf, *q = NULL;
71 sprintf(buf, "%p", p);
72 sscanf(buf, "%p", &q);
74 }], gcc_cv_func_printf_ptr=yes, gcc_cv_func_printf_ptr=no,
75 gcc_cv_func_printf_ptr=no)
76 rm -f core core.* *.core])
77 if test $gcc_cv_func_printf_ptr = yes ; then
78 AC_DEFINE(HOST_PTR_PRINTF, "%p")
82 dnl See if symbolic links work and if not, try to substitute either hard links or simple copy.
83 AC_DEFUN(GCC_PROG_LN_S,
84 [AC_MSG_CHECKING(whether ln -s works)
85 AC_CACHE_VAL(gcc_cv_prog_LN_S,
88 if ln -s conftestdata_f conftestdata_t 2>/dev/null
90 gcc_cv_prog_LN_S="ln -s"
92 if ln conftestdata_f conftestdata_t 2>/dev/null
99 rm -f conftestdata_f conftestdata_t
101 LN_S="$gcc_cv_prog_LN_S"
102 if test "$gcc_cv_prog_LN_S" = "ln -s"; then
105 if test "$gcc_cv_prog_LN_S" = "ln"; then
106 AC_MSG_RESULT([no, using ln])
108 AC_MSG_RESULT([no, and neither does ln, so using cp])
114 dnl See if hard links work and if not, try to substitute either symbolic links or simple copy.
115 AC_DEFUN(GCC_PROG_LN,
116 [AC_MSG_CHECKING(whether ln works)
117 AC_CACHE_VAL(gcc_cv_prog_LN,
118 [rm -f conftestdata_t
120 if ln conftestdata_f conftestdata_t 2>/dev/null
124 if ln -s conftestdata_f conftestdata_t 2>/dev/null
126 gcc_cv_prog_LN="ln -s"
131 rm -f conftestdata_f conftestdata_t
134 if test "$gcc_cv_prog_LN" = "ln"; then
137 if test "$gcc_cv_prog_LN" = "ln -s"; then
138 AC_MSG_RESULT([no, using ln -s])
140 AC_MSG_RESULT([no, and neither does ln -s, so using cp])
146 dnl See whether the stage1 host compiler accepts the volatile keyword.
147 AC_DEFUN(GCC_C_VOLATILE,
148 [AC_CACHE_CHECK([for volatile], gcc_cv_c_volatile,
149 [AC_TRY_COMPILE(, [volatile int foo;],
150 gcc_cv_c_volatile=yes, gcc_cv_c_volatile=no)])
151 if test $gcc_cv_c_volatile = yes ; then
152 AC_DEFINE(HAVE_VOLATILE)
156 AC_DEFUN(EGCS_PROG_INSTALL,
157 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
158 # Find a good install program. We prefer a C program (faster),
159 # so one script is as good as another. But avoid the broken or
160 # incompatible versions:
161 # SysV /etc/install, /usr/sbin/install
162 # SunOS /usr/etc/install
165 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
166 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
167 # ./install, which can be erroneously created by make from ./install.sh.
168 AC_MSG_CHECKING(for a BSD compatible install)
169 if test -z "$INSTALL"; then
170 AC_CACHE_VAL(ac_cv_path_install,
171 [ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
172 for ac_dir in $PATH; do
173 # Account for people who put trailing slashes in PATH elements.
175 /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
177 # OSF1 and SCO ODT 3.0 have their own names for install.
178 for ac_prog in ginstall scoinst install; do
179 if test -f $ac_dir/$ac_prog; then
180 if test $ac_prog = install &&
181 grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
182 # AIX install. It has an incompatible calling convention.
183 # OSF/1 installbsd also uses dspmsg, but is usable.
186 ac_cv_path_install="$ac_dir/$ac_prog -c"
196 if test "${ac_cv_path_install+set}" = set; then
197 INSTALL="$ac_cv_path_install"
199 # As a last resort, use the slow shell script. We don't cache a
200 # path for INSTALL within a source directory, because that will
201 # break other packages using the cache if that directory is
202 # removed, or if the path is relative.
203 INSTALL="$ac_install_sh"
206 dnl We do special magic for INSTALL instead of AC_SUBST, to get
207 dnl relative paths right.
208 AC_MSG_RESULT($INSTALL)
211 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
212 # It thinks the first close brace ends the variable substitution.
213 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
214 AC_SUBST(INSTALL_PROGRAM)dnl
216 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
217 AC_SUBST(INSTALL_DATA)dnl