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