2010-11-17 Tristan Gingold <gingold@adacore.com>
[binutils.git] / binutils / configure.in
blob99fc22d6f392dd65b9d6102382afc55956c084e5
1 dnl Process this file with autoconf to produce a configure script.
2 dnl
3 AC_PREREQ(2.59)
4 AC_INIT
5 AC_CONFIG_SRCDIR(ar.c)
7 AC_CANONICAL_TARGET
8 AC_ISC_POSIX
10 changequote(,)dnl
11 BFD_VERSION=`sed -n -e 's/^.._INIT_AUTOMAKE.*,[         ]*\([^  ]*\)[   ]*).*/\1/p' < ${srcdir}/../bfd/configure.in`
12 changequote([,])dnl
13 AM_INIT_AUTOMAKE(binutils, ${BFD_VERSION})
15 AC_PROG_CC
16 AC_GNU_SOURCE
17 AC_USE_SYSTEM_EXTENSIONS
19 ACX_LARGEFILE
20 LT_INIT
22 AC_ARG_ENABLE(targets,
23 [  --enable-targets        alternative target configurations],
24 [case "${enableval}" in
25   yes | "") AC_MSG_ERROR(enable-targets option must specify target names or 'all')
26             ;;
27   no)       enable_targets= ;;
28   *)        enable_targets=$enableval ;;
29 esac])dnl
31 AM_BINUTILS_WARNINGS
32                    
33 AC_CONFIG_HEADERS(config.h:config.in)
35 if test -z "$target" ; then
36     AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
38 if test -z "$host" ; then
39     AC_MSG_ERROR(Unrecognized host system type; please check config.sub.)
42 AC_PROG_YACC
43 AM_PROG_LEX
45 ALL_LINGUAS="da es fi fr id ja ro ru rw sk sv tr uk vi zh_CN zh_TW bg"
46 ZW_GNU_GETTEXT_SISTER_DIR
47 AM_PO_SUBDIRS
49 AM_MAINTAINER_MODE
50 AM_CONDITIONAL(GENINSRC_NEVER, false)
51 AC_EXEEXT
52 if test -n "$EXEEXT"; then
53   AC_DEFINE(HAVE_EXECUTABLE_SUFFIX, 1,
54             [Does the platform use an executable suffix?])
56 AC_DEFINE_UNQUOTED(EXECUTABLE_SUFFIX, "${EXEEXT}",
57                    [Suffix used for executables, if any.])
59 # host-specific stuff:
61 HDEFINES=
63 . ${srcdir}/../bfd/configure.host
65 AC_SUBST(HDEFINES)
66 AR=${AR-ar}
67 AC_SUBST(AR)
68 AC_PROG_RANLIB
69 AC_PROG_INSTALL
71 BFD_CC_FOR_BUILD
73 DEMANGLER_NAME=c++filt
74 case "${host}" in
75   *-*-go32* | *-*-msdos*)
76     DEMANGLER_NAME=cxxfilt
77 esac
78 AC_SUBST(DEMANGLER_NAME)
80 AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h limits.h sys/param.h)
81 AC_HEADER_SYS_WAIT
82 AC_FUNC_ALLOCA
83 AC_CHECK_FUNCS(sbrk utimes setmode getc_unlocked strcoll)
84 AC_CHECK_FUNC([mkstemp],
85               AC_DEFINE([HAVE_MKSTEMP], 1,
86               [Define to 1 if you have the `mkstemp' function.]))
87 AC_CHECK_FUNC([mkdtemp],
88               AC_DEFINE([HAVE_MKDTEMP], 1,
89               [Define to 1 if you have the `mkdtemp' function.]))
91 # Some systems have frexp only in -lm, not in -lc.
92 AC_SEARCH_LIBS(frexp, m)
94 AC_MSG_CHECKING(for time_t in time.h)
95 AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
96 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <time.h>], [time_t i;])],
97 bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)])
98 AC_MSG_RESULT($bu_cv_decl_time_t_time_h)
99 if test $bu_cv_decl_time_t_time_h = yes; then
100   AC_DEFINE([HAVE_TIME_T_IN_TIME_H], 1,
101             [Is the type time_t defined in <time.h>?])
104 AC_MSG_CHECKING(for time_t in sys/types.h)
105 AC_CACHE_VAL(bu_cv_decl_time_t_types_h,
106 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>], [time_t i;])],
107 bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)])
108 AC_MSG_RESULT($bu_cv_decl_time_t_types_h)
109 if test $bu_cv_decl_time_t_types_h = yes; then
110   AC_DEFINE([HAVE_TIME_T_IN_TYPES_H], 1,
111             [Is the type time_t defined in <sys/types.h>?])
114 AC_MSG_CHECKING(for a known getopt prototype in unistd.h)
115 AC_CACHE_VAL(bu_cv_decl_getopt_unistd_h,
116 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <unistd.h>], [extern int getopt (int, char *const*, const char *);])],
117 bu_cv_decl_getopt_unistd_h=yes, bu_cv_decl_getopt_unistd_h=no)])
118 AC_MSG_RESULT($bu_cv_decl_getopt_unistd_h)
119 if test $bu_cv_decl_getopt_unistd_h = yes; then
120   AC_DEFINE([HAVE_DECL_GETOPT], 1,
121             [Is the prototype for getopt in <unistd.h> in the expected format?])
124 # Under Next 3.2 <utime.h> apparently does not define struct utimbuf
125 # by default.
126 AC_MSG_CHECKING([for utime.h])
127 AC_CACHE_VAL(bu_cv_header_utime_h,
128 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
129 #ifdef HAVE_TIME_H
130 #include <time.h>
131 #endif
132 #include <utime.h>],
133 [struct utimbuf s;])],
134 bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)])
135 AC_MSG_RESULT($bu_cv_header_utime_h)
136 if test $bu_cv_header_utime_h = yes; then
137   AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does <utime.h> define struct utimbuf?])
140 AC_CHECK_DECLS([fprintf, stpcpy, strstr, sbrk, getenv, environ, getc_unlocked,
141                 snprintf, vsnprintf])
143 # Link in zlib if we can.  This allows us to read compressed debug
144 # sections.  This is used only by readelf.c (objdump uses bfd for
145 # reading compressed sections).
146 AC_SEARCH_LIBS(zlibVersion, z, [AC_CHECK_HEADERS(zlib.h)])
148 BFD_BINARY_FOPEN
150 # target-specific stuff:
152 # Canonicalize the secondary target names.
153 if test -n "$enable_targets"; then
154     for targ in `echo $enable_targets | sed 's/,/ /g'`
155     do
156         result=`$ac_config_sub $targ 2>/dev/null`
157         if test -n "$result"; then
158             canon_targets="$canon_targets $result"
159         else
160             # Allow targets that config.sub doesn't recognize, like "all".
161             canon_targets="$canon_targets $targ"
162         fi
163     done
166 AC_CHECK_HEADER(iconv.h)
167 AM_ICONV
169 all_targets=false
170 BUILD_NLMCONV=
171 NLMCONV_DEFS=
172 BUILD_SRCONV=
173 BUILD_DLLTOOL=
174 DLLTOOL_DEFS=
175 DLLTOOL_DEFAULT=
176 BUILD_WINDRES=
177 BUILD_WINDMC=
178 BUILD_DLLWRAP=
179 BUILD_MISC=
180 BUILD_INSTALL_MISC=
181 OBJDUMP_DEFS=
183 for targ in $target $canon_targets
185     if test "x$targ" = "xall"; then
186         all_targets=true
187         BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
188         BUILD_SRCONV='$(SRCONV_PROG)'
189         NLMCONV_DEFS="-DNLMCONV_I386 -DNLMCONV_ALPHA -DNLMCONV_POWERPC -DNLMCONV_SPARC"
190         BUILD_MISC="${BUILD_MISC} "'bin2c$(EXEEXT_FOR_BUILD)'
191         BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
192         BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
193         BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
194         if test -z "$DLLTOOL_DEFAULT"; then
195           DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
196         fi
197         DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
198         BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
199     else
200         case $targ in
201 changequote(,)dnl
202         i[3-7]86*-*-netware*) 
203 changequote([,])dnl
204           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
205           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_I386"
206           ;;
207         alpha*-*-netware*)
208           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
209           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_ALPHA"
210           ;;
211         powerpc*-*-netware*)
212           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
213           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_POWERPC"
214           ;;
215         sparc*-*-netware*)
216           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
217           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_SPARC"
218           ;;
219         esac
220         case $targ in
221         *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;;
222         esac
223         case $targ in
224         arm-epoc-pe*)
225           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
226           if test -z "$DLLTOOL_DEFAULT"; then
227             DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM_EPOC"
228           fi
229           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_EPOC -DDLLTOOL_ARM"
230           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
231           BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
232           ;;
233         arm-wince-pe* | arm-*-wince | arm*-*-cegcc* | arm*-*-mingw32ce*)
234           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
235           if test -z "$DLLTOOL_DEFAULT"; then
236             DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM_WINCE"
237           fi
238           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_WINCE -DDLLTOOL_ARM"
239           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
240           BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
241           ;;
242         arm-*-pe*)
243           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
244           if test -z "$DLLTOOL_DEFAULT"; then
245             DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM"
246           fi
247           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
248           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
249           BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
250           ;;
251         thumb-*-pe*)
252           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
253           if test -z "$DLLTOOL_DEFAULT"; then
254             DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM"
255           fi
256           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
257           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
258           BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
259           ;;
260         x86_64-*-mingw*)
261           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
262           if test -z "$DLLTOOL_DEFAULT"; then
263             DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MX86_64"
264           fi
265           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MX86_64"
266           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
267           BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
268           BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
269           ;;
270 changequote(,)dnl
271         i[3-7]86-*-pe* | i[3-7]86-*-cygwin* | i[3-7]86-*-mingw32** | i[3-7]86-*-netbsdpe*)
272 changequote([,])dnl
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_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
279           BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
280           BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
281           ;;
282 changequote(,)dnl
283         i[3-7]86-*-interix)
284 changequote([,])dnl
285           BUILD_DLLTOOL='$(DLLTOOL_PROG)'
286           if test -z "$DLLTOOL_DEFAULT"; then
287             DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
288           fi
289           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
290           ;;
291 changequote(,)dnl
292         powerpc*-aix5.[01])
293 changequote([,])dnl
294           ;;
295 changequote(,)dnl
296         powerpc*-aix[5-9].*)
297 changequote([,])dnl
298           OBJDUMP_DEFS="-DAIX_WEAK_SUPPORT"
299           ;;
300         powerpc*-*-pe* | powerpc*-*-cygwin*)
301           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
302           if test -z "$DLLTOOL_DEFAULT"; then
303             DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_PPC"
304           fi
305           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_PPC"
306           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
307           BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
308           ;;
309         powerpc*-*-linux* | powerpc*-*-elf* | powerpc*-*-eabi*)
310           BUILD_INSTALL_MISC="${BUILD_INSTALL_MISC} embedspu"
311           ;;
312         sh*-*-pe)
313           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
314           if test -z "$DLLTOOL_DEFAULT"; then
315             DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_SH"
316           fi
317           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_SH"
318           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
319           BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
320           ;;
321         spu-*-*)
322           BUILD_MISC="${BUILD_MISC} "'bin2c$(EXEEXT_FOR_BUILD)'
323           ;;
324         mips*-*-pe)
325           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
326           if test -z "$DLLTOOL_DEFAULT"; then
327             DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MIPS"
328           fi
329           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MIPS"
330           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
331           BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
332           ;;
333         mcore-*-pe)
334           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
335           if test -z "$DLLTOOL_DEFAULT"; then
336             DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MCORE"
337           fi
338           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE"
339           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
340           BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
341           ;;
342         mcore-*-elf)
343           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
344           if test -z "$DLLTOOL_DEFAULT"; then
345             DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MCORE_ELF"
346           fi
347           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF"
348           ;;
349         mep-*)
350           OBJDUMP_DEFS="-DSKIP_ZEROES=256 -DSKIP_ZEROES_AT_END=0"
351           ;;
352         esac
353     fi
354 done
356 DLLTOOL_DEFS="$DLLTOOL_DEFS $DLLTOOL_DEFAULT"
358 if test "${with_windres+set}" = set; then
359           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
362 if test "${with_windmc+set}" = set; then
363           BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
366 AC_SUBST(NLMCONV_DEFS)
367 AC_SUBST(BUILD_NLMCONV)
368 AC_SUBST(BUILD_SRCONV)
369 AC_SUBST(BUILD_DLLTOOL)
370 AC_SUBST(DLLTOOL_DEFS)
371 AC_SUBST(BUILD_WINDRES)
372 AC_SUBST(BUILD_WINDMC)
373 AC_SUBST(BUILD_DLLWRAP)
374 AC_SUBST(BUILD_MISC)
375 AC_SUBST(BUILD_INSTALL_MISC)
376 AC_SUBST(OBJDUMP_DEFS)
378 AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.])
380 targ=$target
381 . $srcdir/../bfd/config.bfd
382 if test "x$targ_underscore" = "xyes"; then
383     UNDERSCORE=1
384 else
385     UNDERSCORE=0
387 AC_DEFINE_UNQUOTED(TARGET_PREPENDS_UNDERSCORE, $UNDERSCORE,
388  [Define to 1 if user symbol names have a leading underscore, 0 if not.])
390 # Emulation 
391 targ=$target
392 . ${srcdir}/configure.tgt
393 EMULATION=$targ_emul
394 EMULATION_VECTOR=$targ_emul_vector      
396 AC_SUBST(EMULATION)
397 AC_SUBST(EMULATION_VECTOR)
399 # Required for html and install-html
400 AC_SUBST(datarootdir)
401 AC_SUBST(docdir)
402 AC_SUBST(htmldir)
403 AC_SUBST(pdfdir)
405 AC_CONFIG_FILES(Makefile doc/Makefile po/Makefile.in:po/Make-in)
406 AC_OUTPUT