aboutsummaryrefslogtreecommitdiff
path: root/binutils/configure.in
blob: d38b67753782657f0ca63d0d5c16075bfd0cd188 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
dnl Process this file with autoconf to produce a configure script.
dnl
AC_PREREQ(2.59)
AC_INIT
AC_CONFIG_SRCDIR(ar.c)

AC_CANONICAL_TARGET
AC_ISC_POSIX

changequote(,)dnl
BFD_VERSION=`sed -n -e 's/^.._INIT_AUTOMAKE.*,[ 	]*\([^ 	]*\)[ 	]*).*/\1/p' < ${srcdir}/../bfd/configure.in`
changequote([,])dnl
AM_INIT_AUTOMAKE(binutils, ${BFD_VERSION})

AC_PROG_CC
AC_GNU_SOURCE
AC_USE_SYSTEM_EXTENSIONS

ACX_LARGEFILE
LT_INIT

AC_ARG_ENABLE(targets,
[  --enable-targets        alternative target configurations],
[case "${enableval}" in
  yes | "") AC_MSG_ERROR(enable-targets option must specify target names or 'all')
            ;;
  no)       enable_targets= ;;
  *)        enable_targets=$enableval ;;
esac])dnl

AC_ARG_ENABLE(deterministic-archives,
[AS_HELP_STRING([--enable-deterministic-archives],
		[ar and ranlib default to -D behavior])], [
if test "${enableval}" = no; then
  default_ar_deterministic=0
else
  default_ar_deterministic=1
fi], [default_ar_deterministic=0])

AC_DEFINE_UNQUOTED(DEFAULT_AR_DETERMINISTIC, $default_ar_deterministic,
		   [Should ar and ranlib use -D behavior by default?])

AM_BINUTILS_WARNINGS

AC_CONFIG_HEADERS(config.h:config.in)

if test -z "$target" ; then
    AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
fi
if test -z "$host" ; then
    AC_MSG_ERROR(Unrecognized host system type; please check config.sub.)
fi

AC_PROG_YACC
AM_PROG_LEX

ALL_LINGUAS="da es fi fr id ja ro ru rw sk sv tr uk vi zh_CN zh_TW bg"
ZW_GNU_GETTEXT_SISTER_DIR
AM_PO_SUBDIRS

AM_MAINTAINER_MODE
AM_CONDITIONAL(GENINSRC_NEVER, false)
AC_EXEEXT
if test -n "$EXEEXT"; then
  AC_DEFINE(HAVE_EXECUTABLE_SUFFIX, 1,
	    [Does the platform use an executable suffix?])
fi
AC_DEFINE_UNQUOTED(EXECUTABLE_SUFFIX, "${EXEEXT}",
		   [Suffix used for executables, if any.])

# host-specific stuff:

HDEFINES=

. ${srcdir}/../bfd/configure.host

AC_SUBST(HDEFINES)
AR=${AR-ar}
AC_SUBST(AR)
AC_PROG_RANLIB
AC_PROG_INSTALL

BFD_CC_FOR_BUILD

DEMANGLER_NAME=c++filt
case "${host}" in
  *-*-go32* | *-*-msdos*)
    DEMANGLER_NAME=cxxfilt
esac
AC_SUBST(DEMANGLER_NAME)

AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h limits.h sys/param.h)
AC_HEADER_SYS_WAIT
AC_FUNC_ALLOCA
AC_CHECK_FUNCS(sbrk utimes setmode getc_unlocked strcoll)
AC_CHECK_FUNC([mkstemp],
	      AC_DEFINE([HAVE_MKSTEMP], 1,
	      [Define to 1 if you have the `mkstemp' function.]))
AC_CHECK_FUNC([mkdtemp],
              AC_DEFINE([HAVE_MKDTEMP], 1,
              [Define to 1 if you have the `mkdtemp' function.]))

# Some systems have frexp only in -lm, not in -lc.
AC_SEARCH_LIBS(frexp, m)

AC_MSG_CHECKING(for time_t in time.h)
AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <time.h>], [time_t i;])],
bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)])
AC_MSG_RESULT($bu_cv_decl_time_t_time_h)
if test $bu_cv_decl_time_t_time_h = yes; then
  AC_DEFINE([HAVE_TIME_T_IN_TIME_H], 1,
	    [Is the type time_t defined in <time.h>?])
fi

AC_MSG_CHECKING(for time_t in sys/types.h)
AC_CACHE_VAL(bu_cv_decl_time_t_types_h,
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>], [time_t i;])],
bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)])
AC_MSG_RESULT($bu_cv_decl_time_t_types_h)
if test $bu_cv_decl_time_t_types_h = yes; then
  AC_DEFINE([HAVE_TIME_T_IN_TYPES_H], 1,
	    [Is the type time_t defined in <sys/types.h>?])
fi

AC_MSG_CHECKING(for a known getopt prototype in unistd.h)
AC_CACHE_VAL(bu_cv_decl_getopt_unistd_h,
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <unistd.h>], [extern int getopt (int, char *const*, const char *);])],
bu_cv_decl_getopt_unistd_h=yes, bu_cv_decl_getopt_unistd_h=no)])
AC_MSG_RESULT($bu_cv_decl_getopt_unistd_h)
if test $bu_cv_decl_getopt_unistd_h = yes; then
  AC_DEFINE([HAVE_DECL_GETOPT], 1,
	    [Is the prototype for getopt in <unistd.h> in the expected format?])
fi

# Under Next 3.2 <utime.h> apparently does not define struct utimbuf
# by default.
AC_MSG_CHECKING([for utime.h])
AC_CACHE_VAL(bu_cv_header_utime_h,
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
#ifdef HAVE_TIME_H
#include <time.h>
#endif
#include <utime.h>],
[struct utimbuf s;])],
bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)])
AC_MSG_RESULT($bu_cv_header_utime_h)
if test $bu_cv_header_utime_h = yes; then
  AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does <utime.h> define struct utimbuf?])
fi

AC_CHECK_DECLS([fprintf, stpcpy, strstr, sbrk, getenv, environ, getc_unlocked,
		snprintf, vsnprintf])

# Link in zlib if we can.  This allows us to read compressed debug
# sections.  This is used only by readelf.c (objdump uses bfd for
# reading compressed sections).
AC_SEARCH_LIBS(zlibVersion, z, [AC_CHECK_HEADERS(zlib.h)])

BFD_BINARY_FOPEN

# target-specific stuff:

# Canonicalize the secondary target names.
if test -n "$enable_targets"; then
    for targ in `echo $enable_targets | sed 's/,/ /g'`
    do
	result=`$ac_config_sub $targ 2>/dev/null`
	if test -n "$result"; then
	    canon_targets="$canon_targets $result"
	else
	    # Allow targets that config.sub doesn't recognize, like "all".
	    canon_targets="$canon_targets $targ"
	fi
    done
fi

AC_CHECK_HEADER(iconv.h)
AM_ICONV

all_targets=false
BUILD_NLMCONV=
NLMCONV_DEFS=
BUILD_SRCONV=
BUILD_DLLTOOL=
DLLTOOL_DEFS=
DLLTOOL_DEFAULT=
BUILD_WINDRES=
BUILD_WINDMC=
BUILD_DLLWRAP=
BUILD_MISC=
BUILD_INSTALL_MISC=
OBJDUMP_DEFS=
OBJDUMP_PRIVATE_VECTORS=
OBJDUMP_PRIVATE_OFILES=
od_vectors=

for targ in $target $canon_targets
do
    if test "x$targ" = "xall"; then
        all_targets=true
	BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
	BUILD_SRCONV='$(SRCONV_PROG)'
	NLMCONV_DEFS="-DNLMCONV_I386 -DNLMCONV_ALPHA -DNLMCONV_POWERPC -DNLMCONV_SPARC"
	BUILD_MISC="${BUILD_MISC} "'bin2c$(EXEEXT_FOR_BUILD)'
	BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
	BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
	BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
	if test -z "$DLLTOOL_DEFAULT"; then
	  DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
	fi
	DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
	BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
	od_vectors="$od_vectors objdump_private_desc_xcoff"
    else
	case $targ in
changequote(,)dnl
	i[3-7]86*-*-netware*)
changequote([,])dnl
	  BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
	  NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_I386"
	  ;;
	alpha*-*-netware*)
	  BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
	  NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_ALPHA"
	  ;;
	powerpc*-*-netware*)
	  BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
	  NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_POWERPC"
	  ;;
	sparc*-*-netware*)
	  BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
	  NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_SPARC"
	  ;;
	esac

	case $targ in
	*-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;;
	esac

	case $targ in
	arm-epoc-pe*)
  	  BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
	  if test -z "$DLLTOOL_DEFAULT"; then
	    DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM_EPOC"
	  fi
	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_EPOC -DDLLTOOL_ARM"
	  BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
	  BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
	  ;;
	arm-wince-pe* | arm-*-wince | arm*-*-cegcc* | arm*-*-mingw32ce*)
  	  BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
	  if test -z "$DLLTOOL_DEFAULT"; then
	    DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM_WINCE"
	  fi
	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_WINCE -DDLLTOOL_ARM"
	  BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
	  BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
	  ;;
	arm-*-pe*)
  	  BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
	  if test -z "$DLLTOOL_DEFAULT"; then
	    DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM"
	  fi
	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
	  BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
	  BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
	  ;;
	x86_64-*-mingw*)
  	  BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
	  if test -z "$DLLTOOL_DEFAULT"; then
	    DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MX86_64"
	  fi
	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MX86_64"
	  BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
	  BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
	  BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
	  ;;
changequote(,)dnl
	i[3-7]86-*-pe* | i[3-7]86-*-cygwin* | i[3-7]86-*-mingw32** | i[3-7]86-*-netbsdpe*)
changequote([,])dnl
  	  BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
	  if test -z "$DLLTOOL_DEFAULT"; then
	    DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
	  fi
	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
	  BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
	  BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
	  BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
	  ;;
changequote(,)dnl
	i[3-7]86-*-interix)
changequote([,])dnl
	  BUILD_DLLTOOL='$(DLLTOOL_PROG)'
	  if test -z "$DLLTOOL_DEFAULT"; then
	    DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
	  fi
	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
	  ;;
changequote(,)dnl
	powerpc*-aix5.[01])
changequote([,])dnl
	  ;;
changequote(,)dnl
	powerpc*-aix[5-9].*)
changequote([,])dnl
	  OBJDUMP_DEFS="-DAIX_WEAK_SUPPORT"
	  ;;
	powerpc*-*-pe* | powerpc*-*-cygwin*)
  	  BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
	  if test -z "$DLLTOOL_DEFAULT"; then
	    DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_PPC"
	  fi
	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_PPC"
	  BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
	  BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
	  ;;
	powerpc*-*-linux* | powerpc*-*-elf* | powerpc*-*-eabi*)
	  case "$BUILD_INSTALL_MISC" in
	    *embedspu*) ;;
	    *) BUILD_INSTALL_MISC="${BUILD_INSTALL_MISC} embedspu"
	  esac
	  ;;
	sh*-*-pe)
  	  BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
	  if test -z "$DLLTOOL_DEFAULT"; then
	    DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_SH"
	  fi
	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_SH"
	  BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
	  BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
	  ;;
	spu-*-*)
	  BUILD_MISC="${BUILD_MISC} "'bin2c$(EXEEXT_FOR_BUILD)'
	  ;;
	mips*-*-pe)
  	  BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
	  if test -z "$DLLTOOL_DEFAULT"; then
	    DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MIPS"
	  fi
	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MIPS"
	  BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
	  BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
	  ;;
	mcore-*-pe)
  	  BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
	  if test -z "$DLLTOOL_DEFAULT"; then
	    DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MCORE"
	  fi
	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE"
	  BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
	  BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
	  ;;
	mcore-*-elf)
  	  BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
	  if test -z "$DLLTOOL_DEFAULT"; then
	    DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MCORE_ELF"
	  fi
	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF"
	  ;;
  	mep-*)
	  OBJDUMP_DEFS="-DSKIP_ZEROES=256 -DSKIP_ZEROES_AT_END=0"
	  ;;
	esac

	# Add objdump private vectors.
	case $targ in
	powerpc-*-aix*)
	  od_vectors="$od_vectors objdump_private_desc_xcoff"
	  ;;
        *-*-darwin*)
	  od_vectors="$od_vectors objdump_private_desc_mach_o"
	  ;;
	esac
    fi
done

# Uniq objdump private vector, build objdump target ofiles.
od_files=
f=""
for i in $od_vectors ; do
    case " $f " in
    *" $i "*) ;;
    *)
	f="$f $i"
	OBJDUMP_PRIVATE_VECTORS="$OBJDUMP_PRIVATE_VECTORS &$i,"
	case $i in
	objdump_private_desc_xcoff)
	    od_files="$od_files od-xcoff" ;;
	objdump_private_desc_mach_o)
	    od_files="$od_files od-macho" ;;
	*) AC_MSG_ERROR(*** unknown private vector $i) ;;
	esac
	;;
    esac
done

# Uniq objdump target ofiles
f=""
for i in $od_files ; do
    case " $f " in
    *" $i "*) ;;
    *)
	f="$f $i"
	OBJDUMP_PRIVATE_OFILES="$OBJDUMP_PRIVATE_OFILES $i.$objext"
	;;
    esac
done

DLLTOOL_DEFS="$DLLTOOL_DEFS $DLLTOOL_DEFAULT"

if test "${with_windres+set}" = set; then
	  BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
fi

if test "${with_windmc+set}" = set; then
	  BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
fi

OBJDUMP_DEFS="${OBJDUMP_DEFS} -DOBJDUMP_PRIVATE_VECTORS=\"${OBJDUMP_PRIVATE_VECTORS}\""

AC_SUBST(NLMCONV_DEFS)
AC_SUBST(BUILD_NLMCONV)
AC_SUBST(BUILD_SRCONV)
AC_SUBST(BUILD_DLLTOOL)
AC_SUBST(DLLTOOL_DEFS)
AC_SUBST(BUILD_WINDRES)
AC_SUBST(BUILD_WINDMC)
AC_SUBST(BUILD_DLLWRAP)
AC_SUBST(BUILD_MISC)
AC_SUBST(BUILD_INSTALL_MISC)
AC_SUBST(OBJDUMP_DEFS)
AC_SUBST(OBJDUMP_PRIVATE_OFILES)

AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.])

targ=$target
. $srcdir/../bfd/config.bfd
if test "x$targ_underscore" = "xyes"; then
    UNDERSCORE=1
else
    UNDERSCORE=0
fi
AC_DEFINE_UNQUOTED(TARGET_PREPENDS_UNDERSCORE, $UNDERSCORE,
 [Define to 1 if user symbol names have a leading underscore, 0 if not.])

# Emulation
targ=$target
. ${srcdir}/configure.tgt
EMULATION=$targ_emul
EMULATION_VECTOR=$targ_emul_vector

AC_SUBST(EMULATION)
AC_SUBST(EMULATION_VECTOR)

# Required for html and install-html
AC_SUBST(datarootdir)
AC_SUBST(docdir)
AC_SUBST(htmldir)
AC_SUBST(pdfdir)

AC_CONFIG_FILES(Makefile doc/Makefile po/Makefile.in:po/Make-in)
AC_OUTPUT