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