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