2005-03-20 H.J. Lu <hongjiu.lu@intel.com>
[deliverable/binutils-gdb.git] / binutils / configure.in
CommitLineData
252b5132
RH
1dnl Process this file with autoconf to produce a configure script.
2dnl
3AC_PREREQ(2.13)
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
0218d1e4 32build_warnings="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
1ad12f97 33
569acd2c
NC
34AC_ARG_ENABLE(werror,
35 [ --enable-werror treat compile warnings as errors],
1ad12f97
NC
36 [case "${enableval}" in
37 yes | y) ERROR_ON_WARNING="yes" ;;
38 no | n) ERROR_ON_WARNING="no" ;;
569acd2c 39 *) AC_MSG_ERROR(bad value ${enableval} for --enable-werror) ;;
1ad12f97
NC
40 esac])
41
569acd2c 42# Enable -Werror by default, suppressing it only for --disable-werror
1ad12f97
NC
43# or --disable-build-warnings.
44if test "${ERROR_ON_WARNING}" != no
45then
46 build_warnings="$build_warnings -Werror"
47fi
569acd2c 48
a2d91340
AC
49AC_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"`;;
59esac
60if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
61 echo "Setting warning flags = $build_warnings" 6>&1
62fi])dnl
63WARN_CFLAGS=""
64if test "x${build_warnings}" != x -a "x$GCC" = xyes ; then
65 WARN_CFLAGS="${build_warnings}"
66fi
67AC_SUBST(WARN_CFLAGS)
68
252b5132
RH
69AM_CONFIG_HEADER(config.h:config.in)
70
71if test -z "$target" ; then
72 AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
73fi
74if test -z "$host" ; then
75 AC_MSG_ERROR(Unrecognized host system type; please check config.sub.)
76fi
77
78AC_PROG_CC
79
80AC_PROG_YACC
81AM_PROG_LEX
82
953130a5 83ALL_LINGUAS="fr tr ja es sv da zh_CN ru ro"
252b5132
RH
84CY_GNU_GETTEXT
85
86AM_MAINTAINER_MODE
87AC_EXEEXT
2481e6a2
ILT
88if test -n "$EXEEXT"; then
89 AC_DEFINE(HAVE_EXECUTABLE_SUFFIX, 1,
90 [Does the platform use an executable suffix?])
91fi
bb0cb4db
ILT
92AC_DEFINE_UNQUOTED(EXECUTABLE_SUFFIX, "${EXEEXT}",
93 [Suffix used for executables, if any.])
252b5132
RH
94
95# host-specific stuff:
96
97HDEFINES=
98
99. ${srcdir}/../bfd/configure.host
100
101AC_SUBST(HDEFINES)
102AR=${AR-ar}
103AC_SUBST(AR)
104AC_PROG_RANLIB
105AC_PROG_INSTALL
106
107BFD_CC_FOR_BUILD
108
8a965946
ILT
109DEMANGLER_NAME=c++filt
110case "${host}" in
111 *-*-go32* | *-*-msdos*)
112 DEMANGLER_NAME=cxxfilt
113esac
114AC_SUBST(DEMANGLER_NAME)
115
252b5132
RH
116AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h)
117AC_HEADER_SYS_WAIT
118AC_FUNC_ALLOCA
9710509e 119AC_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
123AC_MSG_CHECKING([for fopen64])
124AC_CACHE_VAL(bu_cv_have_fopen64,
125[AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");],
126bu_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");],
130bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE",
131bu_cv_have_fopen64=no)
132 CPPFLAGS=$saved_CPPFLAGS])])
133AC_MSG_RESULT($bu_cv_have_fopen64)
6db7a086 134if test "$bu_cv_have_fopen64" != no; then
cedd9a58
JJ
135 AC_DEFINE([HAVE_FOPEN64], 1,
136 [Is fopen64 available?])
fb5b5478
JJ
137fi
138AC_MSG_CHECKING([for stat64])
139AC_CACHE_VAL(bu_cv_have_stat64,
140[AC_TRY_LINK([#include <sys/stat.h>], [struct stat64 st; stat64 ("/tmp/foo", &st);],
141bu_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);],
145bu_cv_have_stat64="need -D_LARGEFILE64_SOURCE",
146bu_cv_have_stat64=no)
147 CPPFLAGS=$saved_CPPFLAGS])])
148AC_MSG_RESULT($bu_cv_have_stat64)
149if test "$bu_cv_have_stat64" != no; then
150 AC_DEFINE([HAVE_STAT64], 1,
151 [Is stat64 available?])
152fi
153if 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 158fi
252b5132 159
f353eb8a 160# Some systems have frexp only in -lm, not in -lc.
07735828 161AC_SEARCH_LIBS(frexp, m)
f353eb8a 162
252b5132
RH
163AC_MSG_CHECKING(for time_t in time.h)
164AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
165[AC_TRY_COMPILE([#include <time.h>], [time_t i;],
166bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)])
167AC_MSG_RESULT($bu_cv_decl_time_t_time_h)
168if 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>?])
171fi
172
173AC_MSG_CHECKING(for time_t in sys/types.h)
174AC_CACHE_VAL(bu_cv_decl_time_t_types_h,
175[AC_TRY_COMPILE([#include <sys/types.h>], [time_t i;],
176bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)])
177AC_MSG_RESULT($bu_cv_decl_time_t_types_h)
178if 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>?])
181fi
182
183# Under Next 3.2 <utime.h> apparently does not define struct utimbuf
184# by default.
185AC_MSG_CHECKING([for utime.h])
186AC_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;],
193bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)])
194AC_MSG_RESULT($bu_cv_header_utime_h)
195if test $bu_cv_header_utime_h = yes; then
196 AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does <utime.h> define struct utimbuf?])
197fi
198
199BFD_NEED_DECLARATION(fprintf)
200BFD_NEED_DECLARATION(strstr)
201BFD_NEED_DECLARATION(sbrk)
202BFD_NEED_DECLARATION(getenv)
203BFD_NEED_DECLARATION(environ)
204
205BFD_BINARY_FOPEN
206
207# target-specific stuff:
208
209# Canonicalize the secondary target names.
210if 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
221fi
222
223all_targets=false
224BUILD_NLMCONV=
225NLMCONV_DEFS=
226BUILD_SRCONV=
227BUILD_DLLTOOL=
228DLLTOOL_DEFS=
229BUILD_WINDRES=
230BUILD_DLLWRAP=
231BUILD_MISC=
8b1e6df3 232OBJDUMP_DEFS=
252b5132
RH
233
234for targ in $target $canon_targets
235do
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
243changequote(,)dnl
80c7c40a 244 i[3-7]86*-*-netware*)
252b5132
RH
245changequote([,])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 284changequote(,)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
286changequote([,])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
292changequote(,)dnl
293 i[3-7]86-*-interix)
294changequote([,])dnl
7a7b06ef
ILT
295 BUILD_DLLTOOL='$(DLLTOOL_PROG)'
296 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
297 ;;
f0660b73
NC
298changequote(,)dnl
299 powerpc*-aix5.[01])
300changequote([,])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
331done
332
c918cb96
DD
333if test "${with_windres+set}" = set; then
334 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
335fi
336
252b5132
RH
337AC_SUBST(NLMCONV_DEFS)
338AC_SUBST(BUILD_NLMCONV)
339AC_SUBST(BUILD_SRCONV)
340AC_SUBST(BUILD_DLLTOOL)
341AC_SUBST(DLLTOOL_DEFS)
342AC_SUBST(BUILD_WINDRES)
343AC_SUBST(BUILD_DLLWRAP)
344AC_SUBST(BUILD_MISC)
8b1e6df3 345AC_SUBST(OBJDUMP_DEFS)
252b5132
RH
346
347AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.])
348
349targ=$target
350. $srcdir/../bfd/config.bfd
351if test "x$targ_underscore" = "xyes"; then
352 UNDERSCORE=1
353else
354 UNDERSCORE=0
355fi
bb279dc0
ZW
356AC_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
360for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'`
361do
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
374done
375
376AC_SUBST(EMULATION)
377AC_SUBST(EMULATION_VECTOR)
378
c45021f2 379AC_OUTPUT(Makefile doc/Makefile po/Makefile.in:po/Make-in,
252b5132
RH
380[
381case "x$CONFIG_FILES" in
382*) sed -e '/POTFILES =/r po/POTFILES' po/Makefile.in > po/Makefile ;;
383esac
384])
This page took 0.22822 seconds and 4 git commands to generate.