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