(coff_link_hash_entry): Only define for non WINCE targets.
[binutils.git] / binutils / configure.in
blob767d237f9ba52f4fae604b6ed94fd865db4996c4
1 dnl Process this file with autoconf to produce a configure script.
2 dnl
3 AC_PREREQ(2.13)
4 AC_INIT(ar.c)
6 AC_CANONICAL_SYSTEM
7 AC_ISC_POSIX
9 changequote(,)dnl
10 BFD_VERSION=`sed -n -e 's/^.._INIT_AUTOMAKE.*,[         ]*\([^  ]*\)[   ]*).*/\1/p' < ${srcdir}/../bfd/configure.in`
11 changequote([,])dnl
12 AM_INIT_AUTOMAKE(binutils, ${BFD_VERSION})
14 AM_PROG_LIBTOOL
16 AC_ARG_ENABLE(targets,
17 [  --enable-targets        alternative target configurations],
18 [case "${enableval}" in
19   yes | "") AC_ERROR(enable-targets option must specify target names or 'all')
20             ;;
21   no)       enable_targets= ;;
22   *)        enable_targets=$enableval ;;
23 esac])dnl
24 AC_ARG_ENABLE(commonbfdlib,
25 [  --enable-commonbfdlib   build shared BFD/opcodes/libiberty library],
26 [case "${enableval}" in
27   yes) commonbfdlib=true ;;
28   no)  commonbfdlib=false ;;
29   *)   AC_MSG_ERROR([bad value ${enableval} for BFD commonbfdlib option]) ;;
30 esac])dnl
32 build_warnings="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
34 AC_ARG_ENABLE(werror,
35   [  --enable-werror    treat compile warnings as errors],
36   [case "${enableval}" in
37      yes | y) ERROR_ON_WARNING="yes" ;;
38      no | n)  ERROR_ON_WARNING="no" ;;
39      *) AC_MSG_ERROR(bad value ${enableval} for --enable-werror) ;;
40    esac])
42 # Enable -Werror by default, suppressing it only for --disable-werror
43 # or --disable-build-warnings.
44 if test "${ERROR_ON_WARNING}" != no
45 then
46   build_warnings="$build_warnings -Werror"
49 AC_ARG_ENABLE(build-warnings,
50 [  --enable-build-warnings Enable build-time compiler warnings if gcc is used],
51 [case "${enableval}" in
52   yes)  ;;
53   no)   build_warnings="-w";;
54   ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
55         build_warnings="${build_warnings} ${t}";;
56   *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
57         build_warnings="${t} ${build_warnings}";;
58   *)    build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
59 esac
60 if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
61   echo "Setting warning flags = $build_warnings" 6>&1
62 fi])dnl
63 WARN_CFLAGS=""
64 if test "x${build_warnings}" != x -a "x$GCC" = xyes ; then
65     WARN_CFLAGS="${build_warnings}"
67 AC_SUBST(WARN_CFLAGS)
69 AM_CONFIG_HEADER(config.h:config.in)
71 if test -z "$target" ; then
72     AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
74 if test -z "$host" ; then
75     AC_MSG_ERROR(Unrecognized host system type; please check config.sub.)
78 AC_PROG_CC
80 AC_PROG_YACC
81 AM_PROG_LEX
83 ALL_LINGUAS="fr tr ja es sv da zh_CN ru ro"
84 CY_GNU_GETTEXT
86 AM_MAINTAINER_MODE
87 AC_EXEEXT
88 if test -n "$EXEEXT"; then
89   AC_DEFINE(HAVE_EXECUTABLE_SUFFIX, 1,
90             [Does the platform use an executable suffix?])
92 AC_DEFINE_UNQUOTED(EXECUTABLE_SUFFIX, "${EXEEXT}",
93                    [Suffix used for executables, if any.])
95 # host-specific stuff:
97 HDEFINES=
99 . ${srcdir}/../bfd/configure.host
101 AC_SUBST(HDEFINES)
102 AR=${AR-ar}
103 AC_SUBST(AR)
104 AC_PROG_RANLIB
105 AC_PROG_INSTALL
107 BFD_CC_FOR_BUILD
109 DEMANGLER_NAME=c++filt
110 case "${host}" in
111   *-*-go32* | *-*-msdos*)
112     DEMANGLER_NAME=cxxfilt
113 esac
114 AC_SUBST(DEMANGLER_NAME)
116 AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h)
117 AC_HEADER_SYS_WAIT
118 AC_FUNC_ALLOCA
119 AC_CHECK_FUNCS(sbrk utimes setmode getc_unlocked strcoll)
121 # Check whether fopen64 is available and whether _LARGEFILE64_SOURCE
122 # needs to be defined for it
123 AC_MSG_CHECKING([for fopen64])
124 AC_CACHE_VAL(bu_cv_have_fopen64,
125 [AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");],
126 bu_cv_have_fopen64=yes,
127 [saved_CPPFLAGS=$CPPFLAGS
128  CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
129  AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");],
130 bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE",
131 bu_cv_have_fopen64=no)
132  CPPFLAGS=$saved_CPPFLAGS])])
133 AC_MSG_RESULT($bu_cv_have_fopen64)
134 if test "$bu_cv_have_fopen64" != no; then
135   AC_DEFINE([HAVE_FOPEN64], 1,
136             [Is fopen64 available?])
138 AC_MSG_CHECKING([for stat64])
139 AC_CACHE_VAL(bu_cv_have_stat64,
140 [AC_TRY_LINK([#include <sys/stat.h>], [struct stat64 st; stat64 ("/tmp/foo", &st);],
141 bu_cv_have_stat64=yes,
142 [saved_CPPFLAGS=$CPPFLAGS
143  CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
144  AC_TRY_LINK([#include <sys/stat.h>], [struct stat64 st; stat64 ("/tmp/foo", &st);],
145 bu_cv_have_stat64="need -D_LARGEFILE64_SOURCE",
146 bu_cv_have_stat64=no)
147  CPPFLAGS=$saved_CPPFLAGS])])
148 AC_MSG_RESULT($bu_cv_have_stat64)
149 if test "$bu_cv_have_stat64" != no; then
150   AC_DEFINE([HAVE_STAT64], 1,
151             [Is stat64 available?])
153 if test "$bu_cv_have_fopen64" = "need -D_LARGEFILE64_SOURCE" \
154    || test "$bu_cv_have_stat64" = "need -D_LARGEFILE64_SOURCE"; then
155   AC_DEFINE([_LARGEFILE64_SOURCE], 1,
156             [Enable LFS])
157   CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
160 # Some systems have frexp only in -lm, not in -lc.
161 AC_SEARCH_LIBS(frexp, m)
163 AC_MSG_CHECKING(for time_t in time.h)
164 AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
165 [AC_TRY_COMPILE([#include <time.h>], [time_t i;],
166 bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)])
167 AC_MSG_RESULT($bu_cv_decl_time_t_time_h)
168 if test $bu_cv_decl_time_t_time_h = yes; then
169   AC_DEFINE([HAVE_TIME_T_IN_TIME_H], 1,
170             [Is the type time_t defined in <time.h>?])
173 AC_MSG_CHECKING(for time_t in sys/types.h)
174 AC_CACHE_VAL(bu_cv_decl_time_t_types_h,
175 [AC_TRY_COMPILE([#include <sys/types.h>], [time_t i;],
176 bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)])
177 AC_MSG_RESULT($bu_cv_decl_time_t_types_h)
178 if test $bu_cv_decl_time_t_types_h = yes; then
179   AC_DEFINE([HAVE_TIME_T_IN_TYPES_H], 1,
180             [Is the type time_t defined in <sys/types.h>?])
183 # Under Next 3.2 <utime.h> apparently does not define struct utimbuf
184 # by default.
185 AC_MSG_CHECKING([for utime.h])
186 AC_CACHE_VAL(bu_cv_header_utime_h,
187 [AC_TRY_COMPILE([#include <sys/types.h>
188 #ifdef HAVE_TIME_H
189 #include <time.h>
190 #endif
191 #include <utime.h>],
192 [struct utimbuf s;],
193 bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)])
194 AC_MSG_RESULT($bu_cv_header_utime_h)
195 if test $bu_cv_header_utime_h = yes; then
196   AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does <utime.h> define struct utimbuf?])
199 BFD_NEED_DECLARATION(fprintf)
200 BFD_NEED_DECLARATION(strstr)
201 BFD_NEED_DECLARATION(sbrk)
202 BFD_NEED_DECLARATION(getenv)
203 BFD_NEED_DECLARATION(environ)
205 BFD_BINARY_FOPEN
207 # target-specific stuff:
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
223 all_targets=false
224 BUILD_NLMCONV=
225 NLMCONV_DEFS=
226 BUILD_SRCONV=
227 BUILD_DLLTOOL=
228 DLLTOOL_DEFS=
229 BUILD_WINDRES=
230 BUILD_DLLWRAP=
231 BUILD_MISC=
232 OBJDUMP_DEFS=
234 for targ in $target $canon_targets
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     else
242         case $targ in
243 changequote(,)dnl
244         i[3-7]86*-*-netware*) 
245 changequote([,])dnl
246           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
247           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_I386"
248           ;;
249         alpha*-*-netware*)
250           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
251           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_ALPHA"
252           ;;
253         powerpc*-*-netware*)
254           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
255           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_POWERPC"
256           ;;
257         sparc*-*-netware*)
258           BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
259           NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_SPARC"
260           ;;
261         esac
262         case $targ in
263         *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;;
264         esac
265         case $targ in
266         arm-epoc-pe*)
267           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
268           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_EPOC -DDLLTOOL_ARM"
269           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
270           ;;
271         arm-*-pe* | arm-*-wince)
272           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
273           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
274           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
275           ;;
276         thumb-*-pe*)
277           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
278           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
279           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
280           ;;
281         arm*-* | xscale-* | strongarm-* | d10v-*)
282           OBJDUMP_DEFS="-DDISASSEMBLER_NEEDS_RELOCS"
283           ;;
284 changequote(,)dnl
285         i[3-7]86-*-pe* | i[3-7]86-*-cygwin* | i[3-7]86-*-mingw32** | i[3-7]86-*-netbsdpe*)
286 changequote([,])dnl
287           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
288           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
289           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
290           BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
291           ;;
292 changequote(,)dnl
293         i[3-7]86-*-interix)
294 changequote([,])dnl
295           BUILD_DLLTOOL='$(DLLTOOL_PROG)'
296           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
297           ;;
298 changequote(,)dnl
299         powerpc*-aix5.[01])
300 changequote([,])dnl
301           ;;
302         powerpc*-aix5.*)
303           OBJDUMP_DEFS="-DAIX_WEAK_SUPPORT"
304           ;;
305         powerpc*-*-pe* | powerpc*-*-cygwin*)
306           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
307           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_PPC"
308           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
309           ;;
310         sh*-*-pe)
311           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
312           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_SH"
313           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
314           ;;
315         mips*-*-pe)
316           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
317           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MIPS"
318           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
319           ;;
320         mcore-*-pe)
321           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
322           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE"
323           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
324           ;;
325         mcore-*-elf)
326           BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
327           DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF"
328           ;;
329         esac
330     fi
331 done
333 if test "${with_windres+set}" = set; then
334           BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
337 AC_SUBST(NLMCONV_DEFS)
338 AC_SUBST(BUILD_NLMCONV)
339 AC_SUBST(BUILD_SRCONV)
340 AC_SUBST(BUILD_DLLTOOL)
341 AC_SUBST(DLLTOOL_DEFS)
342 AC_SUBST(BUILD_WINDRES)
343 AC_SUBST(BUILD_DLLWRAP)
344 AC_SUBST(BUILD_MISC)
345 AC_SUBST(OBJDUMP_DEFS)
347 AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.])
349 targ=$target
350 . $srcdir/../bfd/config.bfd
351 if test "x$targ_underscore" = "xyes"; then
352     UNDERSCORE=1
353 else
354     UNDERSCORE=0
356 AC_DEFINE_UNQUOTED(TARGET_PREPENDS_UNDERSCORE, $UNDERSCORE,
357  [Define to 1 if user symbol names have a leading underscore, 0 if not.])
359 # Emulation 
360 for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'`
362   # Canonicalize the secondary target names.
363  result=`$ac_config_sub $targ_alias 2>/dev/null`
364  if test -n "$result"; then
365    targ=$result
366  else
367    targ=$targ_alias
368  fi
370  . ${srcdir}/configure.tgt
372   EMULATION=$targ_emul
373   EMULATION_VECTOR=$targ_emul_vector    
374 done
376 AC_SUBST(EMULATION)
377 AC_SUBST(EMULATION_VECTOR)
379 AC_OUTPUT(Makefile doc/Makefile po/Makefile.in:po/Make-in,
381 case "x$CONFIG_FILES" in
382 *) sed -e '/POTFILES =/r po/POTFILES' po/Makefile.in > po/Makefile ;;
383 esac