* NEWS: Mention new powerpc ld support.
[deliverable/binutils-gdb.git] / binutils / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 dnl
3 AC_PREREQ(2.57)
4 AC_INIT(ar.c)
5
6 AC_CANONICAL_SYSTEM
7 AC_ISC_POSIX
8
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})
13
14 AM_PROG_LIBTOOL
15
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
31
32 dnl FIXME: The following is bfd/warning.m4 contents expanded
33 dnl When converting to current autotools, please replace with
34 dnl AM_BINUTILS_WARNINGS
35 WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
36
37 AC_ARG_ENABLE(werror,
38 [ --enable-werror treat compile warnings as errors],
39 [case "${enableval}" in
40 yes | y) ERROR_ON_WARNING="yes" ;;
41 no | n) ERROR_ON_WARNING="no" ;;
42 *) AC_MSG_ERROR(bad value ${enableval} for --enable-werror) ;;
43 esac])
44
45 # Enable -Werror by default when using gcc
46 if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
47 ERROR_ON_WARNING=yes
48 fi
49
50 NO_WERROR=
51 if test "${ERROR_ON_WARNING}" = yes ; then
52 WARN_CFLAGS="$WARN_CFLAGS -Werror"
53 NO_WERROR="-Wno-error"
54 fi
55
56 AC_ARG_ENABLE(build-warnings,
57 [ --enable-build-warnings Enable build-time compiler warnings],
58 [case "${enableval}" in
59 yes) ;;
60 no) WARN_CFLAGS="-w";;
61 ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
62 WARN_CFLAGS="${WARN_CFLAGS} ${t}";;
63 *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
64 WARN_CFLAGS="${t} ${WARN_CFLAGS}";;
65 *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
66 esac])
67
68 if test x"$silent" != x"yes" && test x"$WARN_CFLAGS" != x""; then
69 echo "Setting warning flags = $WARN_CFLAGS" 6>&1
70 fi
71
72 AC_SUBST(WARN_CFLAGS)
73 AC_SUBST(NO_WERROR)
74
75 AM_CONFIG_HEADER(config.h:config.in)
76
77 if test -z "$target" ; then
78 AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
79 fi
80 if test -z "$host" ; then
81 AC_MSG_ERROR(Unrecognized host system type; please check config.sub.)
82 fi
83
84 AC_PROG_CC
85
86 AC_PROG_YACC
87 AM_PROG_LEX
88
89 ALL_LINGUAS="fr tr ja es sv da zh_CN ru ro rw zh_TW"
90 CY_GNU_GETTEXT
91
92 AM_MAINTAINER_MODE
93 AC_EXEEXT
94 if test -n "$EXEEXT"; then
95 AC_DEFINE(HAVE_EXECUTABLE_SUFFIX, 1,
96 [Does the platform use an executable suffix?])
97 fi
98 AC_DEFINE_UNQUOTED(EXECUTABLE_SUFFIX, "${EXEEXT}",
99 [Suffix used for executables, if any.])
100
101 # host-specific stuff:
102
103 HDEFINES=
104
105 . ${srcdir}/../bfd/configure.host
106
107 AC_SUBST(HDEFINES)
108 AR=${AR-ar}
109 AC_SUBST(AR)
110 AC_PROG_RANLIB
111 AC_PROG_INSTALL
112
113 BFD_CC_FOR_BUILD
114
115 DEMANGLER_NAME=c++filt
116 case "${host}" in
117 *-*-go32* | *-*-msdos*)
118 DEMANGLER_NAME=cxxfilt
119 esac
120 AC_SUBST(DEMANGLER_NAME)
121
122 AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h)
123 AC_HEADER_SYS_WAIT
124 AC_FUNC_ALLOCA
125 AC_CHECK_FUNCS(sbrk utimes setmode getc_unlocked strcoll)
126
127 # Check whether fopen64 is available and whether _LARGEFILE64_SOURCE
128 # needs to be defined for it
129 AC_MSG_CHECKING([for fopen64])
130 AC_CACHE_VAL(bu_cv_have_fopen64,
131 [AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");],
132 bu_cv_have_fopen64=yes,
133 [saved_CPPFLAGS=$CPPFLAGS
134 CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
135 AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");],
136 bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE",
137 bu_cv_have_fopen64=no)
138 CPPFLAGS=$saved_CPPFLAGS])])
139 AC_MSG_RESULT($bu_cv_have_fopen64)
140 if test "$bu_cv_have_fopen64" != no; then
141 AC_DEFINE([HAVE_FOPEN64], 1,
142 [Is fopen64 available?])
143 fi
144 AC_MSG_CHECKING([for stat64])
145 AC_CACHE_VAL(bu_cv_have_stat64,
146 [AC_TRY_LINK([#include <sys/stat.h>], [struct stat64 st; stat64 ("/tmp/foo", &st);],
147 bu_cv_have_stat64=yes,
148 [saved_CPPFLAGS=$CPPFLAGS
149 CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
150 AC_TRY_LINK([#include <sys/stat.h>], [struct stat64 st; stat64 ("/tmp/foo", &st);],
151 bu_cv_have_stat64="need -D_LARGEFILE64_SOURCE",
152 bu_cv_have_stat64=no)
153 CPPFLAGS=$saved_CPPFLAGS])])
154 AC_MSG_RESULT($bu_cv_have_stat64)
155 if test "$bu_cv_have_stat64" != no; then
156 AC_DEFINE([HAVE_STAT64], 1,
157 [Is stat64 available?])
158 fi
159 if test "$bu_cv_have_fopen64" = "need -D_LARGEFILE64_SOURCE" \
160 || test "$bu_cv_have_stat64" = "need -D_LARGEFILE64_SOURCE"; then
161 AC_DEFINE([_LARGEFILE64_SOURCE], 1,
162 [Enable LFS])
163 CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
164 fi
165
166 # Some systems have frexp only in -lm, not in -lc.
167 AC_SEARCH_LIBS(frexp, m)
168
169 AC_MSG_CHECKING(for time_t in time.h)
170 AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
171 [AC_TRY_COMPILE([#include <time.h>], [time_t i;],
172 bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)])
173 AC_MSG_RESULT($bu_cv_decl_time_t_time_h)
174 if test $bu_cv_decl_time_t_time_h = yes; then
175 AC_DEFINE([HAVE_TIME_T_IN_TIME_H], 1,
176 [Is the type time_t defined in <time.h>?])
177 fi
178
179 AC_MSG_CHECKING(for time_t in sys/types.h)
180 AC_CACHE_VAL(bu_cv_decl_time_t_types_h,
181 [AC_TRY_COMPILE([#include <sys/types.h>], [time_t i;],
182 bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)])
183 AC_MSG_RESULT($bu_cv_decl_time_t_types_h)
184 if test $bu_cv_decl_time_t_types_h = yes; then
185 AC_DEFINE([HAVE_TIME_T_IN_TYPES_H], 1,
186 [Is the type time_t defined in <sys/types.h>?])
187 fi
188
189 AC_MSG_CHECKING(for a known getopt prototype in unistd.h)
190 AC_CACHE_VAL(bu_cv_decl_getopt_unistd_h,
191 [AC_TRY_COMPILE([#include <unistd.h>], [extern int getopt (int, char *const*, const char *);],
192 bu_cv_decl_getopt_unistd_h=yes, bu_cv_decl_getopt_unistd_h=no)])
193 AC_MSG_RESULT($bu_cv_decl_getopt_unistd_h)
194 if test $bu_cv_decl_getopt_unistd_h = yes; then
195 AC_DEFINE([HAVE_DECL_GETOPT], 1,
196 [Is the prototype for getopt in <unistd.h> in the expected format?])
197 fi
198
199 # Under Next 3.2 <utime.h> apparently does not define struct utimbuf
200 # by default.
201 AC_MSG_CHECKING([for utime.h])
202 AC_CACHE_VAL(bu_cv_header_utime_h,
203 [AC_TRY_COMPILE([#include <sys/types.h>
204 #ifdef HAVE_TIME_H
205 #include <time.h>
206 #endif
207 #include <utime.h>],
208 [struct utimbuf s;],
209 bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)])
210 AC_MSG_RESULT($bu_cv_header_utime_h)
211 if test $bu_cv_header_utime_h = yes; then
212 AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does <utime.h> define struct utimbuf?])
213 fi
214
215 BFD_NEED_DECLARATION(fprintf)
216 BFD_NEED_DECLARATION(strstr)
217 BFD_NEED_DECLARATION(sbrk)
218 BFD_NEED_DECLARATION(getenv)
219 BFD_NEED_DECLARATION(environ)
220 AC_CHECK_DECLS(getc_unlocked)
221
222 BFD_BINARY_FOPEN
223
224 # target-specific stuff:
225
226 # Canonicalize the secondary target names.
227 if test -n "$enable_targets"; then
228 for targ in `echo $enable_targets | sed 's/,/ /g'`
229 do
230 result=`$ac_config_sub $targ 2>/dev/null`
231 if test -n "$result"; then
232 canon_targets="$canon_targets $result"
233 else
234 # Allow targets that config.sub doesn't recognize, like "all".
235 canon_targets="$canon_targets $targ"
236 fi
237 done
238 fi
239
240 all_targets=false
241 BUILD_NLMCONV=
242 NLMCONV_DEFS=
243 BUILD_SRCONV=
244 BUILD_DLLTOOL=
245 DLLTOOL_DEFS=
246 BUILD_WINDRES=
247 BUILD_DLLWRAP=
248 BUILD_MISC=
249 OBJDUMP_DEFS=
250
251 for targ in $target $canon_targets
252 do
253 if test "x$targ" = "xall"; then
254 all_targets=true
255 BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
256 BUILD_SRCONV='$(SRCONV_PROG)'
257 NLMCONV_DEFS="-DNLMCONV_I386 -DNLMCONV_ALPHA -DNLMCONV_POWERPC -DNLMCONV_SPARC"
258 else
259 case $targ in
260 changequote(,)dnl
261 i[3-7]86*-*-netware*)
262 changequote([,])dnl
263 BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
264 NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_I386"
265 ;;
266 alpha*-*-netware*)
267 BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
268 NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_ALPHA"
269 ;;
270 powerpc*-*-netware*)
271 BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
272 NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_POWERPC"
273 ;;
274 sparc*-*-netware*)
275 BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
276 NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_SPARC"
277 ;;
278 esac
279 case $targ in
280 *-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;;
281 esac
282 case $targ in
283 arm-epoc-pe*)
284 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
285 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_EPOC -DDLLTOOL_ARM"
286 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
287 ;;
288 arm-*-pe* | arm-*-wince)
289 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
290 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
291 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
292 ;;
293 thumb-*-pe*)
294 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
295 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
296 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
297 ;;
298 arm*-* | xscale-* | strongarm-* | d10v-*)
299 OBJDUMP_DEFS="-DDISASSEMBLER_NEEDS_RELOCS"
300 ;;
301 changequote(,)dnl
302 i[3-7]86-*-pe* | i[3-7]86-*-cygwin* | i[3-7]86-*-mingw32** | i[3-7]86-*-netbsdpe*)
303 changequote([,])dnl
304 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
305 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
306 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
307 BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
308 ;;
309 changequote(,)dnl
310 i[3-7]86-*-interix)
311 changequote([,])dnl
312 BUILD_DLLTOOL='$(DLLTOOL_PROG)'
313 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
314 ;;
315 changequote(,)dnl
316 powerpc*-aix5.[01])
317 changequote([,])dnl
318 ;;
319 powerpc*-aix5.*)
320 OBJDUMP_DEFS="-DAIX_WEAK_SUPPORT"
321 ;;
322 powerpc*-*-pe* | powerpc*-*-cygwin*)
323 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
324 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_PPC"
325 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
326 ;;
327 sh*-*-pe)
328 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
329 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_SH"
330 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
331 ;;
332 mips*-*-pe)
333 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
334 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MIPS"
335 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
336 ;;
337 mcore-*-pe)
338 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
339 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE"
340 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
341 ;;
342 mcore-*-elf)
343 BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
344 DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF"
345 ;;
346 esac
347 fi
348 done
349
350 if test "${with_windres+set}" = set; then
351 BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
352 fi
353
354 AC_SUBST(NLMCONV_DEFS)
355 AC_SUBST(BUILD_NLMCONV)
356 AC_SUBST(BUILD_SRCONV)
357 AC_SUBST(BUILD_DLLTOOL)
358 AC_SUBST(DLLTOOL_DEFS)
359 AC_SUBST(BUILD_WINDRES)
360 AC_SUBST(BUILD_DLLWRAP)
361 AC_SUBST(BUILD_MISC)
362 AC_SUBST(OBJDUMP_DEFS)
363
364 AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.])
365
366 targ=$target
367 . $srcdir/../bfd/config.bfd
368 if test "x$targ_underscore" = "xyes"; then
369 UNDERSCORE=1
370 else
371 UNDERSCORE=0
372 fi
373 AC_DEFINE_UNQUOTED(TARGET_PREPENDS_UNDERSCORE, $UNDERSCORE,
374 [Define to 1 if user symbol names have a leading underscore, 0 if not.])
375
376 # Emulation
377 for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'`
378 do
379 # Canonicalize the secondary target names.
380 result=`$ac_config_sub $targ_alias 2>/dev/null`
381 if test -n "$result"; then
382 targ=$result
383 else
384 targ=$targ_alias
385 fi
386
387 . ${srcdir}/configure.tgt
388
389 EMULATION=$targ_emul
390 EMULATION_VECTOR=$targ_emul_vector
391 done
392
393 AC_SUBST(EMULATION)
394 AC_SUBST(EMULATION_VECTOR)
395
396 AC_OUTPUT(Makefile doc/Makefile po/Makefile.in:po/Make-in,
397 [
398 case "x$CONFIG_FILES" in
399 *) sed -e '/POTFILES =/r po/POTFILES' po/Makefile.in > po/Makefile ;;
400 esac
401 ])
This page took 0.037794 seconds and 4 git commands to generate.