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