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