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