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