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