PR gas/3812
[deliverable/binutils-gdb.git] / binutils / configure.in
CommitLineData
252b5132
RH
1dnl Process this file with autoconf to produce a configure script.
2dnl
42ecbf5e 3AC_PREREQ(2.57)
252b5132
RH
4AC_INIT(ar.c)
5
6AC_CANONICAL_SYSTEM
5d64ca4e 7AC_ISC_POSIX
252b5132 8
27b7e12d
AM
9changequote(,)dnl
10BFD_VERSION=`sed -n -e 's/^.._INIT_AUTOMAKE.*,[ ]*\([^ ]*\)[ ]*).*/\1/p' < ${srcdir}/../bfd/configure.in`
11changequote([,])dnl
12AM_INIT_AUTOMAKE(binutils, ${BFD_VERSION})
252b5132
RH
13
14AM_PROG_LIBTOOL
15
16AC_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 ;;
23esac])dnl
24AC_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]) ;;
30esac])dnl
31
398ee8f1 32AM_BINUTILS_WARNINGS
9e9b66a9 33
252b5132
RH
34AM_CONFIG_HEADER(config.h:config.in)
35
36if test -z "$target" ; then
37 AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
38fi
39if test -z "$host" ; then
40 AC_MSG_ERROR(Unrecognized host system type; please check config.sub.)
41fi
42
43AC_PROG_CC
3e321448 44AC_GNU_SOURCE
252b5132
RH
45
46AC_PROG_YACC
47AM_PROG_LEX
48
bdcfeba5 49ALL_LINGUAS="fr tr ja es sv da zh_CN ru ro rw zh_TW fi vi"
20e95c23
DJ
50ZW_GNU_GETTEXT_SISTER_DIR
51AM_PO_SUBDIRS
252b5132
RH
52
53AM_MAINTAINER_MODE
d5fbea21 54AM_CONDITIONAL(GENINSRC_NEVER, false)
252b5132 55AC_EXEEXT
2481e6a2
ILT
56if test -n "$EXEEXT"; then
57 AC_DEFINE(HAVE_EXECUTABLE_SUFFIX, 1,
58 [Does the platform use an executable suffix?])
59fi
bb0cb4db
ILT
60AC_DEFINE_UNQUOTED(EXECUTABLE_SUFFIX, "${EXEEXT}",
61 [Suffix used for executables, if any.])
252b5132
RH
62
63# host-specific stuff:
64
65HDEFINES=
66
67. ${srcdir}/../bfd/configure.host
68
69AC_SUBST(HDEFINES)
70AR=${AR-ar}
71AC_SUBST(AR)
72AC_PROG_RANLIB
73AC_PROG_INSTALL
74
75BFD_CC_FOR_BUILD
76
8a965946
ILT
77DEMANGLER_NAME=c++filt
78case "${host}" in
79 *-*-go32* | *-*-msdos*)
80 DEMANGLER_NAME=cxxfilt
81esac
82AC_SUBST(DEMANGLER_NAME)
83
f8eae8b2 84AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h limits.h sys/param.h)
252b5132
RH
85AC_HEADER_SYS_WAIT
86AC_FUNC_ALLOCA
9710509e 87AC_CHECK_FUNCS(sbrk utimes setmode getc_unlocked strcoll)
f9c026a8
NC
88AC_CHECK_FUNC([mkstemp],
89 AC_DEFINE([HAVE_MKSTEMP], 1,
90 [Define to 1 if you have the `mkstemp' function.]))
91AC_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
97AC_MSG_CHECKING([for fopen64])
98AC_CACHE_VAL(bu_cv_have_fopen64,
99[AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");],
100bu_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");],
104bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE",
105bu_cv_have_fopen64=no)
106 CPPFLAGS=$saved_CPPFLAGS])])
107AC_MSG_RESULT($bu_cv_have_fopen64)
6db7a086 108if test "$bu_cv_have_fopen64" != no; then
cedd9a58
JJ
109 AC_DEFINE([HAVE_FOPEN64], 1,
110 [Is fopen64 available?])
fb5b5478
JJ
111fi
112AC_MSG_CHECKING([for stat64])
113AC_CACHE_VAL(bu_cv_have_stat64,
114[AC_TRY_LINK([#include <sys/stat.h>], [struct stat64 st; stat64 ("/tmp/foo", &st);],
115bu_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);],
119bu_cv_have_stat64="need -D_LARGEFILE64_SOURCE",
120bu_cv_have_stat64=no)
121 CPPFLAGS=$saved_CPPFLAGS])])
122AC_MSG_RESULT($bu_cv_have_stat64)
123if test "$bu_cv_have_stat64" != no; then
124 AC_DEFINE([HAVE_STAT64], 1,
125 [Is stat64 available?])
126fi
127if 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 132fi
252b5132 133
f353eb8a 134# Some systems have frexp only in -lm, not in -lc.
07735828 135AC_SEARCH_LIBS(frexp, m)
f353eb8a 136
252b5132
RH
137AC_MSG_CHECKING(for time_t in time.h)
138AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
139[AC_TRY_COMPILE([#include <time.h>], [time_t i;],
140bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)])
141AC_MSG_RESULT($bu_cv_decl_time_t_time_h)
142if 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>?])
145fi
146
147AC_MSG_CHECKING(for time_t in sys/types.h)
148AC_CACHE_VAL(bu_cv_decl_time_t_types_h,
149[AC_TRY_COMPILE([#include <sys/types.h>], [time_t i;],
150bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)])
151AC_MSG_RESULT($bu_cv_decl_time_t_types_h)
152if 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>?])
155fi
156
e46eba98
NC
157AC_MSG_CHECKING(for a known getopt prototype in unistd.h)
158AC_CACHE_VAL(bu_cv_decl_getopt_unistd_h,
159[AC_TRY_COMPILE([#include <unistd.h>], [extern int getopt (int, char *const*, const char *);],
160bu_cv_decl_getopt_unistd_h=yes, bu_cv_decl_getopt_unistd_h=no)])
161AC_MSG_RESULT($bu_cv_decl_getopt_unistd_h)
162if 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?])
165fi
166
252b5132
RH
167# Under Next 3.2 <utime.h> apparently does not define struct utimbuf
168# by default.
169AC_MSG_CHECKING([for utime.h])
170AC_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;],
177bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)])
178AC_MSG_RESULT($bu_cv_header_utime_h)
179if test $bu_cv_header_utime_h = yes; then
180 AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does <utime.h> define struct utimbuf?])
181fi
182
db50c840
EB
183AC_CHECK_DECLS([fprintf, stpcpy, strstr, sbrk, getenv, environ, getc_unlocked,
184 snprintf, vsnprintf])
252b5132
RH
185
186BFD_BINARY_FOPEN
187
188# target-specific stuff:
189
190# Canonicalize the secondary target names.
191if 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
202fi
203
204all_targets=false
205BUILD_NLMCONV=
206NLMCONV_DEFS=
207BUILD_SRCONV=
208BUILD_DLLTOOL=
209DLLTOOL_DEFS=
210BUILD_WINDRES=
211BUILD_DLLWRAP=
212BUILD_MISC=
8b1e6df3 213OBJDUMP_DEFS=
252b5132
RH
214
215for targ in $target $canon_targets
216do
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
224changequote(,)dnl
80c7c40a 225 i[3-7]86*-*-netware*)
252b5132
RH
226changequote([,])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 ;;
42037fe5 267 x86_64-*-mingw*)
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 273changequote(,)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
275changequote([,])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
281changequote(,)dnl
282 i[3-7]86-*-interix)
283changequote([,])dnl
7a7b06ef
ILT
284 BUILD_DLLTOOL='$(DLLTOOL_PROG)'
285 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
286 ;;
f0660b73
NC
287changequote(,)dnl
288 powerpc*-aix5.[01])
289changequote([,])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 ;;
669a9a2a
AM
299 powerpc*-*-linux* | powerpc*-*-elf*)
300 BUILD_MISC=embedspu
301 ;;
e1d5b1e7 302 sh*-*-pe)
8a0e0f38
NC
303 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
304 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_SH"
305 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
306 ;;
e1d5b1e7 307 mips*-*-pe)
8a0e0f38
NC
308 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
309 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MIPS"
310 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
311 ;;
27a710e5 312 mcore-*-pe)
661016bb
NC
313 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
314 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE"
315 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
7a7b06ef 316 ;;
27a710e5 317 mcore-*-elf)
661016bb
NC
318 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
319 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF"
7a7b06ef 320 ;;
252b5132
RH
321 esac
322 fi
323done
324
c918cb96
DD
325if test "${with_windres+set}" = set; then
326 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
327fi
328
252b5132
RH
329AC_SUBST(NLMCONV_DEFS)
330AC_SUBST(BUILD_NLMCONV)
331AC_SUBST(BUILD_SRCONV)
332AC_SUBST(BUILD_DLLTOOL)
333AC_SUBST(DLLTOOL_DEFS)
334AC_SUBST(BUILD_WINDRES)
335AC_SUBST(BUILD_DLLWRAP)
336AC_SUBST(BUILD_MISC)
8b1e6df3 337AC_SUBST(OBJDUMP_DEFS)
252b5132
RH
338
339AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.])
340
341targ=$target
342. $srcdir/../bfd/config.bfd
343if test "x$targ_underscore" = "xyes"; then
344 UNDERSCORE=1
345else
346 UNDERSCORE=0
347fi
bb279dc0
ZW
348AC_DEFINE_UNQUOTED(TARGET_PREPENDS_UNDERSCORE, $UNDERSCORE,
349 [Define to 1 if user symbol names have a leading underscore, 0 if not.])
252b5132 350
eb1e0e80
NC
351# Emulation
352for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'`
353do
354 # Canonicalize the secondary target names.
355 result=`$ac_config_sub $targ_alias 2>/dev/null`
356 if test -n "$result"; then
357 targ=$result
358 else
359 targ=$targ_alias
360 fi
361
362 . ${srcdir}/configure.tgt
363
364 EMULATION=$targ_emul
365 EMULATION_VECTOR=$targ_emul_vector
366done
367
368AC_SUBST(EMULATION)
369AC_SUBST(EMULATION_VECTOR)
370
108a6f8e
CD
371# Required for html and install-html
372AC_SUBST(datarootdir)
373AC_SUBST(docdir)
374AC_SUBST(htmldir)
375
20e95c23 376AC_OUTPUT(Makefile doc/Makefile po/Makefile.in:po/Make-in)
This page took 0.291814 seconds and 4 git commands to generate.