Commit | Line | Data |
---|---|---|
252b5132 RH |
1 | dnl Process this file with autoconf to produce a configure script. |
2 | dnl | |
42ecbf5e | 3 | AC_PREREQ(2.57) |
252b5132 RH |
4 | AC_INIT(ar.c) |
5 | ||
6 | AC_CANONICAL_SYSTEM | |
5d64ca4e | 7 | AC_ISC_POSIX |
252b5132 | 8 | |
27b7e12d AM |
9 | changequote(,)dnl |
10 | BFD_VERSION=`sed -n -e 's/^.._INIT_AUTOMAKE.*,[ ]*\([^ ]*\)[ ]*).*/\1/p' < ${srcdir}/../bfd/configure.in` | |
11 | changequote([,])dnl | |
12 | AM_INIT_AUTOMAKE(binutils, ${BFD_VERSION}) | |
252b5132 RH |
13 | |
14 | AM_PROG_LIBTOOL | |
15 | ||
16 | AC_ARG_ENABLE(targets, | |
17 | [ --enable-targets alternative target configurations], | |
18 | [case "${enableval}" in | |
19 | yes | "") AC_ERROR(enable-targets option must specify target names or 'all') | |
20 | ;; | |
21 | no) enable_targets= ;; | |
22 | *) enable_targets=$enableval ;; | |
23 | esac])dnl | |
24 | AC_ARG_ENABLE(commonbfdlib, | |
25 | [ --enable-commonbfdlib build shared BFD/opcodes/libiberty library], | |
26 | [case "${enableval}" in | |
27 | yes) commonbfdlib=true ;; | |
28 | no) commonbfdlib=false ;; | |
29 | *) AC_MSG_ERROR([bad value ${enableval} for BFD commonbfdlib option]) ;; | |
30 | esac])dnl | |
31 | ||
398ee8f1 | 32 | AM_BINUTILS_WARNINGS |
9e9b66a9 | 33 | |
252b5132 RH |
34 | AM_CONFIG_HEADER(config.h:config.in) |
35 | ||
36 | if test -z "$target" ; then | |
37 | AC_MSG_ERROR(Unrecognized target system type; please check config.sub.) | |
38 | fi | |
39 | if test -z "$host" ; then | |
40 | AC_MSG_ERROR(Unrecognized host system type; please check config.sub.) | |
41 | fi | |
42 | ||
43 | AC_PROG_CC | |
3e321448 | 44 | AC_GNU_SOURCE |
252b5132 RH |
45 | |
46 | AC_PROG_YACC | |
47 | AM_PROG_LEX | |
48 | ||
bdcfeba5 | 49 | ALL_LINGUAS="fr tr ja es sv da zh_CN ru ro rw zh_TW fi vi" |
252b5132 RH |
50 | CY_GNU_GETTEXT |
51 | ||
52 | AM_MAINTAINER_MODE | |
53 | AC_EXEEXT | |
2481e6a2 ILT |
54 | if test -n "$EXEEXT"; then |
55 | AC_DEFINE(HAVE_EXECUTABLE_SUFFIX, 1, | |
56 | [Does the platform use an executable suffix?]) | |
57 | fi | |
bb0cb4db ILT |
58 | AC_DEFINE_UNQUOTED(EXECUTABLE_SUFFIX, "${EXEEXT}", |
59 | [Suffix used for executables, if any.]) | |
252b5132 RH |
60 | |
61 | # host-specific stuff: | |
62 | ||
63 | HDEFINES= | |
64 | ||
65 | . ${srcdir}/../bfd/configure.host | |
66 | ||
67 | AC_SUBST(HDEFINES) | |
68 | AR=${AR-ar} | |
69 | AC_SUBST(AR) | |
70 | AC_PROG_RANLIB | |
71 | AC_PROG_INSTALL | |
72 | ||
73 | BFD_CC_FOR_BUILD | |
74 | ||
8a965946 ILT |
75 | DEMANGLER_NAME=c++filt |
76 | case "${host}" in | |
77 | *-*-go32* | *-*-msdos*) | |
78 | DEMANGLER_NAME=cxxfilt | |
79 | esac | |
80 | AC_SUBST(DEMANGLER_NAME) | |
81 | ||
252b5132 RH |
82 | AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h) |
83 | AC_HEADER_SYS_WAIT | |
84 | AC_FUNC_ALLOCA | |
9710509e | 85 | AC_CHECK_FUNCS(sbrk utimes setmode getc_unlocked strcoll) |
cedd9a58 JJ |
86 | |
87 | # Check whether fopen64 is available and whether _LARGEFILE64_SOURCE | |
88 | # needs to be defined for it | |
89 | AC_MSG_CHECKING([for fopen64]) | |
90 | AC_CACHE_VAL(bu_cv_have_fopen64, | |
91 | [AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");], | |
92 | bu_cv_have_fopen64=yes, | |
93 | [saved_CPPFLAGS=$CPPFLAGS | |
94 | CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE" | |
95 | AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");], | |
96 | bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE", | |
97 | bu_cv_have_fopen64=no) | |
98 | CPPFLAGS=$saved_CPPFLAGS])]) | |
99 | AC_MSG_RESULT($bu_cv_have_fopen64) | |
6db7a086 | 100 | if test "$bu_cv_have_fopen64" != no; then |
cedd9a58 JJ |
101 | AC_DEFINE([HAVE_FOPEN64], 1, |
102 | [Is fopen64 available?]) | |
fb5b5478 JJ |
103 | fi |
104 | AC_MSG_CHECKING([for stat64]) | |
105 | AC_CACHE_VAL(bu_cv_have_stat64, | |
106 | [AC_TRY_LINK([#include <sys/stat.h>], [struct stat64 st; stat64 ("/tmp/foo", &st);], | |
107 | bu_cv_have_stat64=yes, | |
108 | [saved_CPPFLAGS=$CPPFLAGS | |
109 | CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE" | |
110 | AC_TRY_LINK([#include <sys/stat.h>], [struct stat64 st; stat64 ("/tmp/foo", &st);], | |
111 | bu_cv_have_stat64="need -D_LARGEFILE64_SOURCE", | |
112 | bu_cv_have_stat64=no) | |
113 | CPPFLAGS=$saved_CPPFLAGS])]) | |
114 | AC_MSG_RESULT($bu_cv_have_stat64) | |
115 | if test "$bu_cv_have_stat64" != no; then | |
116 | AC_DEFINE([HAVE_STAT64], 1, | |
117 | [Is stat64 available?]) | |
118 | fi | |
119 | if test "$bu_cv_have_fopen64" = "need -D_LARGEFILE64_SOURCE" \ | |
120 | || test "$bu_cv_have_stat64" = "need -D_LARGEFILE64_SOURCE"; then | |
121 | AC_DEFINE([_LARGEFILE64_SOURCE], 1, | |
122 | [Enable LFS]) | |
123 | CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE" | |
cedd9a58 | 124 | fi |
252b5132 | 125 | |
f353eb8a | 126 | # Some systems have frexp only in -lm, not in -lc. |
07735828 | 127 | AC_SEARCH_LIBS(frexp, m) |
f353eb8a | 128 | |
252b5132 RH |
129 | AC_MSG_CHECKING(for time_t in time.h) |
130 | AC_CACHE_VAL(bu_cv_decl_time_t_time_h, | |
131 | [AC_TRY_COMPILE([#include <time.h>], [time_t i;], | |
132 | bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)]) | |
133 | AC_MSG_RESULT($bu_cv_decl_time_t_time_h) | |
134 | if test $bu_cv_decl_time_t_time_h = yes; then | |
135 | AC_DEFINE([HAVE_TIME_T_IN_TIME_H], 1, | |
136 | [Is the type time_t defined in <time.h>?]) | |
137 | fi | |
138 | ||
139 | AC_MSG_CHECKING(for time_t in sys/types.h) | |
140 | AC_CACHE_VAL(bu_cv_decl_time_t_types_h, | |
141 | [AC_TRY_COMPILE([#include <sys/types.h>], [time_t i;], | |
142 | bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)]) | |
143 | AC_MSG_RESULT($bu_cv_decl_time_t_types_h) | |
144 | if test $bu_cv_decl_time_t_types_h = yes; then | |
145 | AC_DEFINE([HAVE_TIME_T_IN_TYPES_H], 1, | |
146 | [Is the type time_t defined in <sys/types.h>?]) | |
147 | fi | |
148 | ||
e46eba98 NC |
149 | AC_MSG_CHECKING(for a known getopt prototype in unistd.h) |
150 | AC_CACHE_VAL(bu_cv_decl_getopt_unistd_h, | |
151 | [AC_TRY_COMPILE([#include <unistd.h>], [extern int getopt (int, char *const*, const char *);], | |
152 | bu_cv_decl_getopt_unistd_h=yes, bu_cv_decl_getopt_unistd_h=no)]) | |
153 | AC_MSG_RESULT($bu_cv_decl_getopt_unistd_h) | |
154 | if test $bu_cv_decl_getopt_unistd_h = yes; then | |
155 | AC_DEFINE([HAVE_DECL_GETOPT], 1, | |
156 | [Is the prototype for getopt in <unistd.h> in the expected format?]) | |
157 | fi | |
158 | ||
252b5132 RH |
159 | # Under Next 3.2 <utime.h> apparently does not define struct utimbuf |
160 | # by default. | |
161 | AC_MSG_CHECKING([for utime.h]) | |
162 | AC_CACHE_VAL(bu_cv_header_utime_h, | |
163 | [AC_TRY_COMPILE([#include <sys/types.h> | |
164 | #ifdef HAVE_TIME_H | |
165 | #include <time.h> | |
166 | #endif | |
167 | #include <utime.h>], | |
168 | [struct utimbuf s;], | |
169 | bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)]) | |
170 | AC_MSG_RESULT($bu_cv_header_utime_h) | |
171 | if test $bu_cv_header_utime_h = yes; then | |
172 | AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does <utime.h> define struct utimbuf?]) | |
173 | fi | |
174 | ||
db50c840 EB |
175 | AC_CHECK_DECLS([fprintf, stpcpy, strstr, sbrk, getenv, environ, getc_unlocked, |
176 | snprintf, vsnprintf]) | |
252b5132 RH |
177 | |
178 | BFD_BINARY_FOPEN | |
179 | ||
180 | # target-specific stuff: | |
181 | ||
182 | # Canonicalize the secondary target names. | |
183 | if test -n "$enable_targets"; then | |
184 | for targ in `echo $enable_targets | sed 's/,/ /g'` | |
185 | do | |
6d83c84b | 186 | result=`$ac_config_sub $targ 2>/dev/null` |
252b5132 RH |
187 | if test -n "$result"; then |
188 | canon_targets="$canon_targets $result" | |
189 | else | |
190 | # Allow targets that config.sub doesn't recognize, like "all". | |
191 | canon_targets="$canon_targets $targ" | |
192 | fi | |
193 | done | |
194 | fi | |
195 | ||
196 | all_targets=false | |
197 | BUILD_NLMCONV= | |
198 | NLMCONV_DEFS= | |
199 | BUILD_SRCONV= | |
200 | BUILD_DLLTOOL= | |
201 | DLLTOOL_DEFS= | |
202 | BUILD_WINDRES= | |
203 | BUILD_DLLWRAP= | |
204 | BUILD_MISC= | |
8b1e6df3 | 205 | OBJDUMP_DEFS= |
252b5132 RH |
206 | |
207 | for targ in $target $canon_targets | |
208 | do | |
209 | if test "x$targ" = "xall"; then | |
210 | all_targets=true | |
211 | BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)' | |
212 | BUILD_SRCONV='$(SRCONV_PROG)' | |
213 | NLMCONV_DEFS="-DNLMCONV_I386 -DNLMCONV_ALPHA -DNLMCONV_POWERPC -DNLMCONV_SPARC" | |
214 | else | |
215 | case $targ in | |
216 | changequote(,)dnl | |
80c7c40a | 217 | i[3-7]86*-*-netware*) |
252b5132 RH |
218 | changequote([,])dnl |
219 | BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)' | |
220 | NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_I386" | |
221 | ;; | |
222 | alpha*-*-netware*) | |
223 | BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)' | |
224 | NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_ALPHA" | |
225 | ;; | |
226 | powerpc*-*-netware*) | |
227 | BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)' | |
228 | NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_POWERPC" | |
229 | ;; | |
230 | sparc*-*-netware*) | |
231 | BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)' | |
232 | NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_SPARC" | |
233 | ;; | |
234 | esac | |
235 | case $targ in | |
236 | *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;; | |
237 | esac | |
238 | case $targ in | |
a8c548cb NC |
239 | arm-epoc-pe*) |
240 | BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' | |
241 | DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_EPOC -DDLLTOOL_ARM" | |
242 | BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' | |
243 | ;; | |
27a710e5 | 244 | arm-*-pe* | arm-*-wince) |
252b5132 RH |
245 | BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' |
246 | DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM" | |
247 | BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' | |
7a7b06ef | 248 | ;; |
27a710e5 | 249 | thumb-*-pe*) |
252b5132 RH |
250 | BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' |
251 | DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM" | |
252 | BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' | |
7a7b06ef | 253 | ;; |
252b5132 | 254 | changequote(,)dnl |
80c7c40a | 255 | i[3-7]86-*-pe* | i[3-7]86-*-cygwin* | i[3-7]86-*-mingw32** | i[3-7]86-*-netbsdpe*) |
252b5132 RH |
256 | changequote([,])dnl |
257 | BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' | |
258 | DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386" | |
259 | BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' | |
260 | BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)' | |
7a7b06ef | 261 | ;; |
80c7c40a NC |
262 | changequote(,)dnl |
263 | i[3-7]86-*-interix) | |
264 | changequote([,])dnl | |
7a7b06ef ILT |
265 | BUILD_DLLTOOL='$(DLLTOOL_PROG)' |
266 | DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386" | |
267 | ;; | |
f0660b73 NC |
268 | changequote(,)dnl |
269 | powerpc*-aix5.[01]) | |
270 | changequote([,])dnl | |
271 | ;; | |
272 | powerpc*-aix5.*) | |
273 | OBJDUMP_DEFS="-DAIX_WEAK_SUPPORT" | |
274 | ;; | |
e1d5b1e7 | 275 | powerpc*-*-pe* | powerpc*-*-cygwin*) |
252b5132 RH |
276 | BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' |
277 | DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_PPC" | |
278 | BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' | |
7a7b06ef | 279 | ;; |
e1d5b1e7 | 280 | sh*-*-pe) |
8a0e0f38 NC |
281 | BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' |
282 | DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_SH" | |
283 | BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' | |
284 | ;; | |
e1d5b1e7 | 285 | mips*-*-pe) |
8a0e0f38 NC |
286 | BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' |
287 | DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MIPS" | |
288 | BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' | |
289 | ;; | |
27a710e5 | 290 | mcore-*-pe) |
661016bb NC |
291 | BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' |
292 | DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE" | |
293 | BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' | |
7a7b06ef | 294 | ;; |
27a710e5 | 295 | mcore-*-elf) |
661016bb NC |
296 | BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' |
297 | DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF" | |
7a7b06ef | 298 | ;; |
252b5132 RH |
299 | esac |
300 | fi | |
301 | done | |
302 | ||
c918cb96 DD |
303 | if test "${with_windres+set}" = set; then |
304 | BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' | |
305 | fi | |
306 | ||
252b5132 RH |
307 | AC_SUBST(NLMCONV_DEFS) |
308 | AC_SUBST(BUILD_NLMCONV) | |
309 | AC_SUBST(BUILD_SRCONV) | |
310 | AC_SUBST(BUILD_DLLTOOL) | |
311 | AC_SUBST(DLLTOOL_DEFS) | |
312 | AC_SUBST(BUILD_WINDRES) | |
313 | AC_SUBST(BUILD_DLLWRAP) | |
314 | AC_SUBST(BUILD_MISC) | |
8b1e6df3 | 315 | AC_SUBST(OBJDUMP_DEFS) |
252b5132 RH |
316 | |
317 | AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.]) | |
318 | ||
319 | targ=$target | |
320 | . $srcdir/../bfd/config.bfd | |
321 | if test "x$targ_underscore" = "xyes"; then | |
322 | UNDERSCORE=1 | |
323 | else | |
324 | UNDERSCORE=0 | |
325 | fi | |
bb279dc0 ZW |
326 | AC_DEFINE_UNQUOTED(TARGET_PREPENDS_UNDERSCORE, $UNDERSCORE, |
327 | [Define to 1 if user symbol names have a leading underscore, 0 if not.]) | |
252b5132 | 328 | |
eb1e0e80 NC |
329 | # Emulation |
330 | for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'` | |
331 | do | |
332 | # Canonicalize the secondary target names. | |
333 | result=`$ac_config_sub $targ_alias 2>/dev/null` | |
334 | if test -n "$result"; then | |
335 | targ=$result | |
336 | else | |
337 | targ=$targ_alias | |
338 | fi | |
339 | ||
340 | . ${srcdir}/configure.tgt | |
341 | ||
342 | EMULATION=$targ_emul | |
343 | EMULATION_VECTOR=$targ_emul_vector | |
344 | done | |
345 | ||
346 | AC_SUBST(EMULATION) | |
347 | AC_SUBST(EMULATION_VECTOR) | |
348 | ||
c45021f2 | 349 | AC_OUTPUT(Makefile doc/Makefile po/Makefile.in:po/Make-in, |
252b5132 RH |
350 | [ |
351 | case "x$CONFIG_FILES" in | |
352 | *) sed -e '/POTFILES =/r po/POTFILES' po/Makefile.in > po/Makefile ;; | |
353 | esac | |
354 | ]) |