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