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" |
20e95c23 DJ |
50 | ZW_GNU_GETTEXT_SISTER_DIR |
51 | AM_PO_SUBDIRS | |
252b5132 RH |
52 | |
53 | AM_MAINTAINER_MODE | |
d5fbea21 | 54 | AM_CONDITIONAL(GENINSRC_NEVER, false) |
252b5132 | 55 | AC_EXEEXT |
2481e6a2 ILT |
56 | if test -n "$EXEEXT"; then |
57 | AC_DEFINE(HAVE_EXECUTABLE_SUFFIX, 1, | |
58 | [Does the platform use an executable suffix?]) | |
59 | fi | |
bb0cb4db ILT |
60 | AC_DEFINE_UNQUOTED(EXECUTABLE_SUFFIX, "${EXEEXT}", |
61 | [Suffix used for executables, if any.]) | |
252b5132 RH |
62 | |
63 | # host-specific stuff: | |
64 | ||
65 | HDEFINES= | |
66 | ||
67 | . ${srcdir}/../bfd/configure.host | |
68 | ||
69 | AC_SUBST(HDEFINES) | |
70 | AR=${AR-ar} | |
71 | AC_SUBST(AR) | |
72 | AC_PROG_RANLIB | |
73 | AC_PROG_INSTALL | |
74 | ||
75 | BFD_CC_FOR_BUILD | |
76 | ||
8a965946 ILT |
77 | DEMANGLER_NAME=c++filt |
78 | case "${host}" in | |
79 | *-*-go32* | *-*-msdos*) | |
80 | DEMANGLER_NAME=cxxfilt | |
81 | esac | |
82 | AC_SUBST(DEMANGLER_NAME) | |
83 | ||
f8eae8b2 | 84 | AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h limits.h sys/param.h) |
252b5132 RH |
85 | AC_HEADER_SYS_WAIT |
86 | AC_FUNC_ALLOCA | |
9710509e | 87 | AC_CHECK_FUNCS(sbrk utimes setmode getc_unlocked strcoll) |
f9c026a8 NC |
88 | AC_CHECK_FUNC([mkstemp], |
89 | AC_DEFINE([HAVE_MKSTEMP], 1, | |
90 | [Define to 1 if you have the `mkstemp' function.])) | |
91 | AC_CHECK_FUNC([mkdtemp], | |
92 | AC_DEFINE([HAVE_MKDTEMP], 1, | |
93 | [Define to 1 if you have the `mkdtemp' function.])) | |
cedd9a58 JJ |
94 | |
95 | # Check whether fopen64 is available and whether _LARGEFILE64_SOURCE | |
96 | # needs to be defined for it | |
97 | AC_MSG_CHECKING([for fopen64]) | |
98 | AC_CACHE_VAL(bu_cv_have_fopen64, | |
99 | [AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");], | |
100 | bu_cv_have_fopen64=yes, | |
101 | [saved_CPPFLAGS=$CPPFLAGS | |
102 | CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE" | |
103 | AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");], | |
104 | bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE", | |
105 | bu_cv_have_fopen64=no) | |
106 | CPPFLAGS=$saved_CPPFLAGS])]) | |
107 | AC_MSG_RESULT($bu_cv_have_fopen64) | |
6db7a086 | 108 | if test "$bu_cv_have_fopen64" != no; then |
cedd9a58 JJ |
109 | AC_DEFINE([HAVE_FOPEN64], 1, |
110 | [Is fopen64 available?]) | |
fb5b5478 JJ |
111 | fi |
112 | AC_MSG_CHECKING([for stat64]) | |
113 | AC_CACHE_VAL(bu_cv_have_stat64, | |
114 | [AC_TRY_LINK([#include <sys/stat.h>], [struct stat64 st; stat64 ("/tmp/foo", &st);], | |
115 | bu_cv_have_stat64=yes, | |
116 | [saved_CPPFLAGS=$CPPFLAGS | |
117 | CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE" | |
118 | AC_TRY_LINK([#include <sys/stat.h>], [struct stat64 st; stat64 ("/tmp/foo", &st);], | |
119 | bu_cv_have_stat64="need -D_LARGEFILE64_SOURCE", | |
120 | bu_cv_have_stat64=no) | |
121 | CPPFLAGS=$saved_CPPFLAGS])]) | |
122 | AC_MSG_RESULT($bu_cv_have_stat64) | |
123 | if test "$bu_cv_have_stat64" != no; then | |
124 | AC_DEFINE([HAVE_STAT64], 1, | |
125 | [Is stat64 available?]) | |
126 | fi | |
127 | if test "$bu_cv_have_fopen64" = "need -D_LARGEFILE64_SOURCE" \ | |
128 | || test "$bu_cv_have_stat64" = "need -D_LARGEFILE64_SOURCE"; then | |
129 | AC_DEFINE([_LARGEFILE64_SOURCE], 1, | |
130 | [Enable LFS]) | |
131 | CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE" | |
cedd9a58 | 132 | fi |
252b5132 | 133 | |
f353eb8a | 134 | # Some systems have frexp only in -lm, not in -lc. |
07735828 | 135 | AC_SEARCH_LIBS(frexp, m) |
f353eb8a | 136 | |
252b5132 RH |
137 | AC_MSG_CHECKING(for time_t in time.h) |
138 | AC_CACHE_VAL(bu_cv_decl_time_t_time_h, | |
139 | [AC_TRY_COMPILE([#include <time.h>], [time_t i;], | |
140 | bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)]) | |
141 | AC_MSG_RESULT($bu_cv_decl_time_t_time_h) | |
142 | if test $bu_cv_decl_time_t_time_h = yes; then | |
143 | AC_DEFINE([HAVE_TIME_T_IN_TIME_H], 1, | |
144 | [Is the type time_t defined in <time.h>?]) | |
145 | fi | |
146 | ||
147 | AC_MSG_CHECKING(for time_t in sys/types.h) | |
148 | AC_CACHE_VAL(bu_cv_decl_time_t_types_h, | |
149 | [AC_TRY_COMPILE([#include <sys/types.h>], [time_t i;], | |
150 | bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)]) | |
151 | AC_MSG_RESULT($bu_cv_decl_time_t_types_h) | |
152 | if test $bu_cv_decl_time_t_types_h = yes; then | |
153 | AC_DEFINE([HAVE_TIME_T_IN_TYPES_H], 1, | |
154 | [Is the type time_t defined in <sys/types.h>?]) | |
155 | fi | |
156 | ||
e46eba98 NC |
157 | AC_MSG_CHECKING(for a known getopt prototype in unistd.h) |
158 | AC_CACHE_VAL(bu_cv_decl_getopt_unistd_h, | |
159 | [AC_TRY_COMPILE([#include <unistd.h>], [extern int getopt (int, char *const*, const char *);], | |
160 | bu_cv_decl_getopt_unistd_h=yes, bu_cv_decl_getopt_unistd_h=no)]) | |
161 | AC_MSG_RESULT($bu_cv_decl_getopt_unistd_h) | |
162 | if test $bu_cv_decl_getopt_unistd_h = yes; then | |
163 | AC_DEFINE([HAVE_DECL_GETOPT], 1, | |
164 | [Is the prototype for getopt in <unistd.h> in the expected format?]) | |
165 | fi | |
166 | ||
252b5132 RH |
167 | # Under Next 3.2 <utime.h> apparently does not define struct utimbuf |
168 | # by default. | |
169 | AC_MSG_CHECKING([for utime.h]) | |
170 | AC_CACHE_VAL(bu_cv_header_utime_h, | |
171 | [AC_TRY_COMPILE([#include <sys/types.h> | |
172 | #ifdef HAVE_TIME_H | |
173 | #include <time.h> | |
174 | #endif | |
175 | #include <utime.h>], | |
176 | [struct utimbuf s;], | |
177 | bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)]) | |
178 | AC_MSG_RESULT($bu_cv_header_utime_h) | |
179 | if test $bu_cv_header_utime_h = yes; then | |
180 | AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does <utime.h> define struct utimbuf?]) | |
181 | fi | |
182 | ||
db50c840 EB |
183 | AC_CHECK_DECLS([fprintf, stpcpy, strstr, sbrk, getenv, environ, getc_unlocked, |
184 | snprintf, vsnprintf]) | |
252b5132 RH |
185 | |
186 | BFD_BINARY_FOPEN | |
187 | ||
188 | # target-specific stuff: | |
189 | ||
190 | # Canonicalize the secondary target names. | |
191 | if test -n "$enable_targets"; then | |
192 | for targ in `echo $enable_targets | sed 's/,/ /g'` | |
193 | do | |
6d83c84b | 194 | result=`$ac_config_sub $targ 2>/dev/null` |
252b5132 RH |
195 | if test -n "$result"; then |
196 | canon_targets="$canon_targets $result" | |
197 | else | |
198 | # Allow targets that config.sub doesn't recognize, like "all". | |
199 | canon_targets="$canon_targets $targ" | |
200 | fi | |
201 | done | |
202 | fi | |
203 | ||
204 | all_targets=false | |
205 | BUILD_NLMCONV= | |
206 | NLMCONV_DEFS= | |
207 | BUILD_SRCONV= | |
208 | BUILD_DLLTOOL= | |
209 | DLLTOOL_DEFS= | |
210 | BUILD_WINDRES= | |
211 | BUILD_DLLWRAP= | |
212 | BUILD_MISC= | |
8b1e6df3 | 213 | OBJDUMP_DEFS= |
252b5132 RH |
214 | |
215 | for targ in $target $canon_targets | |
216 | do | |
217 | if test "x$targ" = "xall"; then | |
218 | all_targets=true | |
219 | BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)' | |
220 | BUILD_SRCONV='$(SRCONV_PROG)' | |
221 | NLMCONV_DEFS="-DNLMCONV_I386 -DNLMCONV_ALPHA -DNLMCONV_POWERPC -DNLMCONV_SPARC" | |
222 | else | |
223 | case $targ in | |
224 | changequote(,)dnl | |
80c7c40a | 225 | i[3-7]86*-*-netware*) |
252b5132 RH |
226 | changequote([,])dnl |
227 | BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)' | |
228 | NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_I386" | |
229 | ;; | |
230 | alpha*-*-netware*) | |
231 | BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)' | |
232 | NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_ALPHA" | |
233 | ;; | |
234 | powerpc*-*-netware*) | |
235 | BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)' | |
236 | NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_POWERPC" | |
237 | ;; | |
238 | sparc*-*-netware*) | |
239 | BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)' | |
240 | NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_SPARC" | |
241 | ;; | |
242 | esac | |
243 | case $targ in | |
244 | *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;; | |
245 | esac | |
246 | case $targ in | |
a8c548cb NC |
247 | arm-epoc-pe*) |
248 | BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' | |
249 | DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_EPOC -DDLLTOOL_ARM" | |
250 | BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' | |
251 | ;; | |
7148cc28 NC |
252 | arm-wince-pe* | arm-*-wince) |
253 | BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' | |
254 | DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_WINCE -DDLLTOOL_ARM" | |
255 | BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' | |
256 | ;; | |
257 | arm-*-pe*) | |
252b5132 RH |
258 | BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' |
259 | DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM" | |
260 | BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' | |
7a7b06ef | 261 | ;; |
27a710e5 | 262 | thumb-*-pe*) |
252b5132 RH |
263 | BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' |
264 | DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM" | |
265 | BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' | |
7a7b06ef | 266 | ;; |
99ad8390 | 267 | x86_64-*-mingw64*) |
99ad8390 NC |
268 | BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' |
269 | DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MX86_64" | |
270 | BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' | |
271 | BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)' | |
272 | ;; | |
252b5132 | 273 | changequote(,)dnl |
80c7c40a | 274 | i[3-7]86-*-pe* | i[3-7]86-*-cygwin* | i[3-7]86-*-mingw32** | i[3-7]86-*-netbsdpe*) |
252b5132 RH |
275 | changequote([,])dnl |
276 | BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' | |
277 | DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386" | |
278 | BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' | |
279 | BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)' | |
7a7b06ef | 280 | ;; |
80c7c40a NC |
281 | changequote(,)dnl |
282 | i[3-7]86-*-interix) | |
283 | changequote([,])dnl | |
7a7b06ef ILT |
284 | BUILD_DLLTOOL='$(DLLTOOL_PROG)' |
285 | DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386" | |
286 | ;; | |
f0660b73 NC |
287 | changequote(,)dnl |
288 | powerpc*-aix5.[01]) | |
289 | changequote([,])dnl | |
290 | ;; | |
291 | powerpc*-aix5.*) | |
292 | OBJDUMP_DEFS="-DAIX_WEAK_SUPPORT" | |
293 | ;; | |
e1d5b1e7 | 294 | powerpc*-*-pe* | powerpc*-*-cygwin*) |
252b5132 RH |
295 | BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' |
296 | DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_PPC" | |
297 | BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' | |
7a7b06ef | 298 | ;; |
e1d5b1e7 | 299 | sh*-*-pe) |
8a0e0f38 NC |
300 | BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' |
301 | DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_SH" | |
302 | BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' | |
303 | ;; | |
e1d5b1e7 | 304 | mips*-*-pe) |
8a0e0f38 NC |
305 | BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' |
306 | DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MIPS" | |
307 | BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' | |
308 | ;; | |
27a710e5 | 309 | mcore-*-pe) |
661016bb NC |
310 | BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' |
311 | DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE" | |
312 | BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' | |
7a7b06ef | 313 | ;; |
27a710e5 | 314 | mcore-*-elf) |
661016bb NC |
315 | BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' |
316 | DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF" | |
7a7b06ef | 317 | ;; |
252b5132 RH |
318 | esac |
319 | fi | |
320 | done | |
321 | ||
c918cb96 DD |
322 | if test "${with_windres+set}" = set; then |
323 | BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' | |
324 | fi | |
325 | ||
252b5132 RH |
326 | AC_SUBST(NLMCONV_DEFS) |
327 | AC_SUBST(BUILD_NLMCONV) | |
328 | AC_SUBST(BUILD_SRCONV) | |
329 | AC_SUBST(BUILD_DLLTOOL) | |
330 | AC_SUBST(DLLTOOL_DEFS) | |
331 | AC_SUBST(BUILD_WINDRES) | |
332 | AC_SUBST(BUILD_DLLWRAP) | |
333 | AC_SUBST(BUILD_MISC) | |
8b1e6df3 | 334 | AC_SUBST(OBJDUMP_DEFS) |
252b5132 RH |
335 | |
336 | AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.]) | |
337 | ||
338 | targ=$target | |
339 | . $srcdir/../bfd/config.bfd | |
340 | if test "x$targ_underscore" = "xyes"; then | |
341 | UNDERSCORE=1 | |
342 | else | |
343 | UNDERSCORE=0 | |
344 | fi | |
bb279dc0 ZW |
345 | AC_DEFINE_UNQUOTED(TARGET_PREPENDS_UNDERSCORE, $UNDERSCORE, |
346 | [Define to 1 if user symbol names have a leading underscore, 0 if not.]) | |
252b5132 | 347 | |
eb1e0e80 NC |
348 | # Emulation |
349 | for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'` | |
350 | do | |
351 | # Canonicalize the secondary target names. | |
352 | result=`$ac_config_sub $targ_alias 2>/dev/null` | |
353 | if test -n "$result"; then | |
354 | targ=$result | |
355 | else | |
356 | targ=$targ_alias | |
357 | fi | |
358 | ||
359 | . ${srcdir}/configure.tgt | |
360 | ||
361 | EMULATION=$targ_emul | |
362 | EMULATION_VECTOR=$targ_emul_vector | |
363 | done | |
364 | ||
365 | AC_SUBST(EMULATION) | |
366 | AC_SUBST(EMULATION_VECTOR) | |
367 | ||
108a6f8e CD |
368 | # Required for html and install-html |
369 | AC_SUBST(datarootdir) | |
370 | AC_SUBST(docdir) | |
371 | AC_SUBST(htmldir) | |
372 | ||
20e95c23 | 373 | AC_OUTPUT(Makefile doc/Makefile po/Makefile.in:po/Make-in) |