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