Split out ada_atr_size
[deliverable/binutils-gdb.git] / binutils / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2 dnl
3 dnl Copyright (C) 2012-2021 Free Software Foundation, Inc.
4 dnl
5 dnl This file is free software; you can redistribute it and/or modify
6 dnl it under the terms of the GNU General Public License as published by
7 dnl the Free Software Foundation; either version 3 of the License, or
8 dnl (at your option) any later version.
9 dnl
10 dnl This program is distributed in the hope that it will be useful,
11 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 dnl GNU General Public License for more details.
14 dnl
15 dnl You should have received a copy of the GNU General Public License
16 dnl along with this program; see the file COPYING3. If not see
17 dnl <http://www.gnu.org/licenses/>.
18 dnl
19
20 m4_include([../bfd/version.m4])
21 m4_include([../config/debuginfod.m4])
22 AC_INIT([binutils], BFD_VERSION)
23 AC_CONFIG_SRCDIR(ar.c)
24
25 AC_CANONICAL_TARGET
26 AC_ISC_POSIX
27
28 AM_INIT_AUTOMAKE
29
30 AC_PROG_CC
31 AC_GNU_SOURCE
32 AC_USE_SYSTEM_EXTENSIONS
33
34 LT_INIT
35 ACX_LARGEFILE
36
37 AC_ARG_ENABLE(targets,
38 [ --enable-targets alternative target configurations],
39 [case "${enableval}" in
40 yes | "") AC_MSG_ERROR(enable-targets option must specify target names or 'all')
41 ;;
42 no) enable_targets= ;;
43 *) enable_targets=$enableval ;;
44 esac])dnl
45
46
47 AC_ARG_ENABLE(deterministic-archives,
48 [AS_HELP_STRING([--enable-deterministic-archives],
49 [ar and ranlib default to -D behavior])], [
50 if test "${enableval}" = no; then
51 default_ar_deterministic=0
52 else
53 default_ar_deterministic=1
54 fi], [default_ar_deterministic=0])
55
56 AC_DEFINE_UNQUOTED(DEFAULT_AR_DETERMINISTIC, $default_ar_deterministic,
57 [Should ar and ranlib use -D behavior by default?])
58
59
60 AC_ARG_ENABLE(default-strings-all,
61 [AS_HELP_STRING([--disable-default-strings-all],
62 [strings defaults to --data behavior])], [
63 if test "${enableval}" = no; then
64 default_strings_all=0
65 else
66 default_strings_all=1
67 fi], [default_strings_all=1])
68
69 AC_DEFINE_UNQUOTED(DEFAULT_STRINGS_ALL, $default_strings_all,
70 [Should strings use -a behavior by default?])
71
72
73 AC_ARG_ENABLE(f-for-ifunc-symbols,
74 [AS_HELP_STRING([--enable-f-for-ifunc-symbols],
75 [Have nm use F and f for global and local ifunc symbols])], [
76 if test "${enableval}" = no; then
77 default_f_for_ifunc=0
78 else
79 default_f_for_ifunc=1
80 fi], [default_f_for_ifunc=0])
81
82 AC_DEFINE_UNQUOTED(DEFAULT_F_FOR_IFUNC_SYMBOLS, $default_f_for_ifunc,
83 [Have nm use F and f for global and local ifunc symbols])
84
85
86 AC_ARG_ENABLE(follow-debug-links,
87 [AS_HELP_STRING([--enable-follow-debug-links],
88 [Have readelf and objdump follow debug links by default])], [
89 if test "${enableval}" = no; then
90 default_for_follow_links=0
91 else
92 default_for_follow_links=1
93 fi], [default_for_follow_links=1])
94
95 AC_DEFINE_UNQUOTED(DEFAULT_FOR_FOLLOW_LINKS, $default_for_follow_links,
96 [Have readelf and objdump follow debug links by default])
97
98
99 AC_DEBUGINFOD
100
101 GCC_ENABLE([libctf], [yes], [], [Handle .ctf type-info sections])
102 if test "${enable_libctf}" = yes; then
103 AC_DEFINE(ENABLE_LIBCTF, 1, [Handle .ctf type-info sections])
104 fi
105 AM_CONDITIONAL(ENABLE_LIBCTF, test "${enable_libctf}" = yes)
106
107 AM_BINUTILS_WARNINGS
108
109 AC_CONFIG_HEADERS(config.h:config.in)
110
111 AH_VERBATIM([00_CONFIG_H_CHECK],
112 [/* Check that config.h is #included before system headers
113 (this works only for glibc, but that should be enough). */
114 #if defined(__GLIBC__) && !defined(__FreeBSD_kernel__) && !defined(__CONFIG_H__)
115 # error config.h must be #included before system headers
116 #endif
117 #define __CONFIG_H__ 1])
118
119 if test -z "$target" ; then
120 AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
121 fi
122 if test -z "$host" ; then
123 AC_MSG_ERROR(Unrecognized host system type; please check config.sub.)
124 fi
125
126 AC_PROG_YACC
127 AM_PROG_LEX
128
129 ALL_LINGUAS="bg ca da es fi fr hr id it ja pt ro ru rw sk sr sv tr uk vi zh_CN zh_TW"
130 ZW_GNU_GETTEXT_SISTER_DIR
131 AM_PO_SUBDIRS
132
133 AM_MAINTAINER_MODE
134 AM_CONDITIONAL(GENINSRC_NEVER, false)
135 AC_EXEEXT
136 if test -n "$EXEEXT"; then
137 AC_DEFINE(HAVE_EXECUTABLE_SUFFIX, 1,
138 [Does the platform use an executable suffix?])
139 fi
140 AC_DEFINE_UNQUOTED(EXECUTABLE_SUFFIX, "${EXEEXT}",
141 [Suffix used for executables, if any.])
142
143 # host-specific stuff:
144
145 HDEFINES=
146
147 . ${srcdir}/../bfd/configure.host
148
149 AC_SUBST(HDEFINES)
150 AR=${AR-ar}
151 AC_SUBST(AR)
152 AC_PROG_RANLIB
153 AC_PROG_INSTALL
154
155 BFD_CC_FOR_BUILD
156
157 DEMANGLER_NAME=c++filt
158 case "${host}" in
159 *-*-go32* | *-*-msdos*)
160 DEMANGLER_NAME=cxxfilt
161 esac
162 AC_SUBST(DEMANGLER_NAME)
163
164 AC_CHECK_SIZEOF([long])
165 AC_CHECK_TYPES([long long], [AC_CHECK_SIZEOF(long long)])
166
167 AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h limits.h locale.h sys/param.h wchar.h)
168 AC_HEADER_SYS_WAIT
169 ACX_HEADER_STRING
170 AC_FUNC_ALLOCA
171 AC_FUNC_MMAP
172 AC_CHECK_FUNCS(sbrk utimes setmode getc_unlocked strcoll setlocale)
173 AC_CHECK_FUNC([mkstemp],
174 AC_DEFINE([HAVE_MKSTEMP], 1,
175 [Define to 1 if you have the `mkstemp' function.]))
176 AC_CHECK_FUNC([mkdtemp],
177 AC_DEFINE([HAVE_MKDTEMP], 1,
178 [Define to 1 if you have the `mkdtemp' function.]))
179 AC_MSG_CHECKING([for mbstate_t])
180 AC_TRY_COMPILE([#include <wchar.h>],
181 [mbstate_t teststate;],
182 have_mbstate_t=yes, have_mbstate_t=no)
183 AC_MSG_RESULT($have_mbstate_t)
184 if test x"$have_mbstate_t" = xyes; then
185 AC_DEFINE(HAVE_MBSTATE_T,1,[Define if mbstate_t exists in wchar.h.])
186 fi
187
188 # Some systems have frexp only in -lm, not in -lc.
189 AC_SEARCH_LIBS(frexp, m)
190
191 AM_LC_MESSAGES
192
193 AC_MSG_CHECKING(for time_t in time.h)
194 AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
195 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <time.h>], [time_t i;])],
196 bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)])
197 AC_MSG_RESULT($bu_cv_decl_time_t_time_h)
198 if test $bu_cv_decl_time_t_time_h = yes; then
199 AC_DEFINE([HAVE_TIME_T_IN_TIME_H], 1,
200 [Is the type time_t defined in <time.h>?])
201 fi
202
203 AC_MSG_CHECKING(for time_t in sys/types.h)
204 AC_CACHE_VAL(bu_cv_decl_time_t_types_h,
205 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>], [time_t i;])],
206 bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)])
207 AC_MSG_RESULT($bu_cv_decl_time_t_types_h)
208 if test $bu_cv_decl_time_t_types_h = yes; then
209 AC_DEFINE([HAVE_TIME_T_IN_TYPES_H], 1,
210 [Is the type time_t defined in <sys/types.h>?])
211 fi
212
213 AC_MSG_CHECKING(for a known getopt prototype in unistd.h)
214 AC_CACHE_VAL(bu_cv_decl_getopt_unistd_h,
215 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <unistd.h>], [extern int getopt (int, char *const*, const char *);])],
216 bu_cv_decl_getopt_unistd_h=yes, bu_cv_decl_getopt_unistd_h=no)])
217 AC_MSG_RESULT($bu_cv_decl_getopt_unistd_h)
218 if test $bu_cv_decl_getopt_unistd_h = yes; then
219 AC_DEFINE([HAVE_DECL_GETOPT], 1,
220 [Is the prototype for getopt in <unistd.h> in the expected format?])
221 fi
222
223 # Under Next 3.2 <utime.h> apparently does not define struct utimbuf
224 # by default.
225 AC_MSG_CHECKING([for utime.h])
226 AC_CACHE_VAL(bu_cv_header_utime_h,
227 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
228 #ifdef HAVE_TIME_H
229 #include <time.h>
230 #endif
231 #include <utime.h>],
232 [struct utimbuf s;])],
233 bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)])
234 AC_MSG_RESULT($bu_cv_header_utime_h)
235 if test $bu_cv_header_utime_h = yes; then
236 AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does <utime.h> define struct utimbuf?])
237 fi
238
239 AC_CHECK_DECLS([asprintf, environ, fprintf, getc_unlocked, getenv,
240 sbrk, snprintf, stpcpy, strnlen, strstr, vsnprintf])
241
242 # Link in zlib if we can. This allows us to read compressed debug
243 # sections. This is used only by readelf.c (objdump uses bfd for
244 # reading compressed sections).
245 AM_ZLIB
246
247 BFD_BINARY_FOPEN
248
249 # target-specific stuff:
250
251 # Canonicalize the secondary target names.
252 if test -n "$enable_targets"; then
253 for targ in `echo $enable_targets | sed 's/,/ /g'`
254 do
255 result=`$ac_config_sub $targ 2>/dev/null`
256 if test -n "$result"; then
257 canon_targets="$canon_targets $result"
258 else
259 # Allow targets that config.sub doesn't recognize, like "all".
260 canon_targets="$canon_targets $targ"
261 fi
262 done
263 fi
264
265 AC_CHECK_HEADER(iconv.h)
266 AM_ICONV
267
268 all_targets=false
269 BUILD_SRCONV=
270 BUILD_DLLTOOL=
271 DLLTOOL_DEFS=
272 DLLTOOL_DEFAULT=
273 BUILD_WINDRES=
274 BUILD_WINDMC=
275 BUILD_DLLWRAP=
276 BUILD_MISC=
277 BUILD_INSTALL_MISC=
278 OBJDUMP_DEFS=
279 OBJDUMP_PRIVATE_VECTORS=
280 OBJDUMP_PRIVATE_OFILES=
281 od_vectors=
282
283 for targ in $target $canon_targets
284 do
285 if test "x$targ" = "xall"; then
286 all_targets=true
287 BUILD_SRCONV='$(SRCONV_PROG)'
288 BUILD_MISC="${BUILD_MISC} "'bin2c$(EXEEXT_FOR_BUILD)'
289 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
290 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
291 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
292 if test -z "$DLLTOOL_DEFAULT"; then
293 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
294 fi
295 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
296 BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
297 od_vectors="$od_vectors objdump_private_desc_xcoff"
298 else
299 case $targ in
300 *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;;
301 esac
302
303 case $targ in
304 arm-wince-pe* | arm-*-wince | arm*-*-cegcc* | arm*-*-mingw32ce*)
305 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
306 if test -z "$DLLTOOL_DEFAULT"; then
307 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM_WINCE"
308 fi
309 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_WINCE -DDLLTOOL_ARM"
310 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
311 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
312 ;;
313 arm-*-pe*)
314 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
315 if test -z "$DLLTOOL_DEFAULT"; then
316 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM"
317 fi
318 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
319 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
320 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
321 ;;
322 x86_64-*-mingw* | x86_64-*-cygwin*)
323 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
324 if test -z "$DLLTOOL_DEFAULT"; then
325 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MX86_64"
326 fi
327 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MX86_64"
328 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
329 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
330 BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
331 ;;
332 changequote(,)dnl
333 i[3-7]86-*-pe* | i[3-7]86-*-cygwin* | i[3-7]86-*-mingw32** | i[3-7]86-*-netbsdpe*)
334 changequote([,])dnl
335 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
336 if test -z "$DLLTOOL_DEFAULT"; then
337 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
338 fi
339 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
340 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
341 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
342 BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
343 ;;
344 changequote(,)dnl
345 i[3-7]86-*-interix)
346 changequote([,])dnl
347 BUILD_DLLTOOL='$(DLLTOOL_PROG)'
348 if test -z "$DLLTOOL_DEFAULT"; then
349 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
350 fi
351 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
352 ;;
353 changequote(,)dnl
354 powerpc*-aix5.[01])
355 changequote([,])dnl
356 ;;
357 changequote(,)dnl
358 powerpc*-aix[5-9].*)
359 changequote([,])dnl
360 OBJDUMP_DEFS="-DAIX_WEAK_SUPPORT"
361 ;;
362 powerpc*-*-linux* | powerpc*-*-elf* | powerpc*-*-eabi*)
363 case "$BUILD_INSTALL_MISC" in
364 *embedspu*) ;;
365 *) BUILD_INSTALL_MISC="${BUILD_INSTALL_MISC} embedspu"
366 esac
367 ;;
368 sh*-*-pe)
369 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
370 if test -z "$DLLTOOL_DEFAULT"; then
371 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_SH"
372 fi
373 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_SH"
374 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
375 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
376 ;;
377 spu-*-*)
378 BUILD_MISC="${BUILD_MISC} "'bin2c$(EXEEXT_FOR_BUILD)'
379 ;;
380 mips*-*-pe)
381 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
382 if test -z "$DLLTOOL_DEFAULT"; then
383 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MIPS"
384 fi
385 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MIPS"
386 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
387 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
388 ;;
389 mcore-*-pe)
390 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
391 if test -z "$DLLTOOL_DEFAULT"; then
392 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MCORE"
393 fi
394 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE"
395 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
396 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
397 ;;
398 mcore-*-elf)
399 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
400 if test -z "$DLLTOOL_DEFAULT"; then
401 DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MCORE_ELF"
402 fi
403 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF"
404 ;;
405 mep-*)
406 OBJDUMP_DEFS="-DSKIP_ZEROES=256 -DSKIP_ZEROES_AT_END=0"
407 ;;
408 esac
409
410 # Add objdump private vectors.
411 case $targ in
412 avr-*-*)
413 od_vectors="$od_vectors objdump_private_desc_elf32_avr"
414 ;;
415 powerpc*-*-aix* | rs6000-*-aix*)
416 od_vectors="$od_vectors objdump_private_desc_xcoff"
417 ;;
418 *-*-darwin*)
419 od_vectors="$od_vectors objdump_private_desc_mach_o"
420 ;;
421 esac
422 fi
423 done
424
425 # Uniq objdump private vector, build objdump target ofiles.
426 od_files=
427 f=""
428 for i in $od_vectors ; do
429 case " $f " in
430 *" $i "*) ;;
431 *)
432 f="$f $i"
433 OBJDUMP_PRIVATE_VECTORS="$OBJDUMP_PRIVATE_VECTORS &$i,"
434 case $i in
435 objdump_private_desc_elf32_avr)
436 od_files="$od_files od-elf32_avr" ;;
437 objdump_private_desc_xcoff)
438 od_files="$od_files od-xcoff" ;;
439 objdump_private_desc_mach_o)
440 od_files="$od_files od-macho" ;;
441 *) AC_MSG_ERROR(*** unknown private vector $i) ;;
442 esac
443 ;;
444 esac
445 done
446
447 # Uniq objdump target ofiles
448 f=""
449 for i in $od_files ; do
450 case " $f " in
451 *" $i "*) ;;
452 *)
453 f="$f $i"
454 OBJDUMP_PRIVATE_OFILES="$OBJDUMP_PRIVATE_OFILES $i.$objext"
455 ;;
456 esac
457 done
458
459 DLLTOOL_DEFS="$DLLTOOL_DEFS $DLLTOOL_DEFAULT"
460
461 if test "${with_windres+set}" = set; then
462 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
463 fi
464
465 if test "${with_windmc+set}" = set; then
466 BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
467 fi
468
469 OBJDUMP_DEFS="${OBJDUMP_DEFS} -DOBJDUMP_PRIVATE_VECTORS=\"${OBJDUMP_PRIVATE_VECTORS}\""
470
471 AC_SUBST(BUILD_SRCONV)
472 AC_SUBST(BUILD_DLLTOOL)
473 AC_SUBST(DLLTOOL_DEFS)
474 AC_SUBST(BUILD_WINDRES)
475 AC_SUBST(BUILD_WINDMC)
476 AC_SUBST(BUILD_DLLWRAP)
477 AC_SUBST(BUILD_MISC)
478 AC_SUBST(BUILD_INSTALL_MISC)
479 AC_SUBST(OBJDUMP_DEFS)
480 AC_SUBST(OBJDUMP_PRIVATE_OFILES)
481
482 AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.])
483
484 targ=$target
485 . $srcdir/../bfd/config.bfd
486 if test "x$targ_underscore" = "xyes"; then
487 UNDERSCORE=1
488 else
489 UNDERSCORE=0
490 fi
491 AC_DEFINE_UNQUOTED(TARGET_PREPENDS_UNDERSCORE, $UNDERSCORE,
492 [Define to 1 if user symbol names have a leading underscore, 0 if not.])
493
494 # Emulation
495 targ=$target
496 . ${srcdir}/configure.tgt
497 EMULATION=$targ_emul
498 EMULATION_VECTOR=$targ_emul_vector
499
500 AC_SUBST(EMULATION)
501 AC_SUBST(EMULATION_VECTOR)
502
503 # Required for html and install-html
504 AC_SUBST(datarootdir)
505 AC_SUBST(docdir)
506 AC_SUBST(htmldir)
507 AC_SUBST(pdfdir)
508
509 AC_CONFIG_FILES(Makefile doc/Makefile po/Makefile.in:po/Make-in)
510 AC_OUTPUT
511
512 GNU_MAKE_JOBSERVER
This page took 0.03948 seconds and 4 git commands to generate.