OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [configure.ac] - Blame information for rev 860

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
# configure.ac for GCC
2
# Process this file with autoconf to generate a configuration script.
3
 
4
# Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
5
# Free Software Foundation, Inc.
6
 
7
#This file is part of GCC.
8
 
9
#GCC is free software; you can redistribute it and/or modify it under
10
#the terms of the GNU General Public License as published by the Free
11
#Software Foundation; either version 3, or (at your option) any later
12
#version.
13
 
14
#GCC is distributed in the hope that it will be useful, but WITHOUT
15
#ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16
#FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
17
#for more details.
18
 
19
#You should have received a copy of the GNU General Public License
20
#along with GCC; see the file COPYING3.  If not see
21
#.
22
 
23
# --------------------------------
24
# Initialization and sanity checks
25
# --------------------------------
26
 
27
AC_PREREQ(2.59)
28
AC_INIT
29
AC_CONFIG_SRCDIR(tree.c)
30
AC_CONFIG_HEADER(auto-host.h:config.in)
31
 
32
gcc_version=`cat $srcdir/BASE-VER`
33
 
34
# Determine the host, build, and target systems
35
AC_CANONICAL_BUILD
36
AC_CANONICAL_HOST
37
AC_CANONICAL_TARGET
38
 
39
# Determine the noncanonical target name, for directory use.
40
ACX_NONCANONICAL_TARGET
41
 
42
# Determine the target- and build-specific subdirectories
43
GCC_TOPLEV_SUBDIRS
44
 
45
# Set program_transform_name
46
AC_ARG_PROGRAM
47
 
48
# Check for bogus environment variables.
49
# Test if LIBRARY_PATH contains the notation for the current directory
50
# since this would lead to problems installing/building glibc.
51
# LIBRARY_PATH contains the current directory if one of the following
52
# is true:
53
# - one of the terminals (":" and ";") is the first or last sign
54
# - two terminals occur directly after each other
55
# - the path contains an element with a dot in it
56
AC_MSG_CHECKING(LIBRARY_PATH variable)
57
changequote(,)dnl
58
case ${LIBRARY_PATH} in
59
  [:\;]* | *[:\;] | *[:\;][:\;]* |  *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
60
    library_path_setting="contains current directory"
61
    ;;
62
  *)
63
    library_path_setting="ok"
64
    ;;
65
esac
66
changequote([,])dnl
67
AC_MSG_RESULT($library_path_setting)
68
if test "$library_path_setting" != "ok"; then
69
AC_MSG_ERROR([
70
*** LIBRARY_PATH shouldn't contain the current directory when
71
*** building gcc. Please change the environment variable
72
*** and run configure again.])
73
fi
74
 
75
# Test if GCC_EXEC_PREFIX contains the notation for the current directory
76
# since this would lead to problems installing/building glibc.
77
# GCC_EXEC_PREFIX contains the current directory if one of the following
78
# is true:
79
# - one of the terminals (":" and ";") is the first or last sign
80
# - two terminals occur directly after each other
81
# - the path contains an element with a dot in it
82
AC_MSG_CHECKING(GCC_EXEC_PREFIX variable)
83
changequote(,)dnl
84
case ${GCC_EXEC_PREFIX} in
85
  [:\;]* | *[:\;] | *[:\;][:\;]* |  *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
86
    gcc_exec_prefix_setting="contains current directory"
87
    ;;
88
  *)
89
    gcc_exec_prefix_setting="ok"
90
    ;;
91
esac
92
changequote([,])dnl
93
AC_MSG_RESULT($gcc_exec_prefix_setting)
94
if test "$gcc_exec_prefix_setting" != "ok"; then
95
AC_MSG_ERROR([
96
*** GCC_EXEC_PREFIX shouldn't contain the current directory when
97
*** building gcc. Please change the environment variable
98
*** and run configure again.])
99
fi
100
 
101
# -----------
102
# Directories
103
# -----------
104
 
105
# Specify the local prefix
106
local_prefix=
107
AC_ARG_WITH(local-prefix,
108
[  --with-local-prefix=DIR specifies directory to put local include],
109
[case "${withval}" in
110
yes)    AC_MSG_ERROR(bad value ${withval} given for local include directory prefix) ;;
111
no)     ;;
112
*)      local_prefix=$with_local_prefix ;;
113
esac])
114
 
115
# Default local prefix if it is empty
116
if test x$local_prefix = x; then
117
        local_prefix=/usr/local
118
fi
119
 
120
# Don't set gcc_gxx_include_dir to gxx_include_dir since that's only
121
# passed in by the toplevel make and thus we'd get different behavior
122
# depending on where we built the sources.
123
gcc_gxx_include_dir=
124
# Specify the g++ header file directory
125
AC_ARG_WITH(gxx-include-dir,
126
[  --with-gxx-include-dir=DIR
127
                          specifies directory to put g++ header files],
128
[case "${withval}" in
129
yes)    AC_MSG_ERROR(bad value ${withval} given for g++ include directory) ;;
130
no)     ;;
131
*)      gcc_gxx_include_dir=$with_gxx_include_dir ;;
132
esac])
133
 
134
# This logic must match libstdc++-v3/acinclude.m4:GLIBCXX_EXPORT_INSTALL_INFO.
135
if test x${gcc_gxx_include_dir} = x; then
136
  if test x${enable_version_specific_runtime_libs} = xyes; then
137
    gcc_gxx_include_dir='${libsubdir}/include/c++'
138
  else
139
    libstdcxx_incdir='include/c++/$(version)'
140
    if test x$host != x$target; then
141
       libstdcxx_incdir="$target_alias/$libstdcxx_incdir"
142
    fi
143
changequote(<<, >>)dnl
144
    gcc_gxx_include_dir="\$(libsubdir)/\$(unlibsubdir)/..\`echo \$(exec_prefix) | sed -e 's|^\$(prefix)||' -e 's|/[^/]*|/..|g'\`/$libstdcxx_incdir"
145
changequote([, ])dnl
146
  fi
147
fi
148
 
149
AC_ARG_WITH(cpp_install_dir,
150
[  --with-cpp-install-dir=DIR
151
                          install the user visible C preprocessor in DIR
152
                          (relative to PREFIX) as well as PREFIX/bin],
153
[if test x$withval = xyes; then
154
  AC_MSG_ERROR([option --with-cpp-install-dir requires an argument])
155
elif test x$withval != xno; then
156
  cpp_install_dir=$withval
157
fi])
158
 
159
# We would like to our source tree to be readonly.  However when releases or
160
# pre-releases are generated, the flex/bison generated files as well as the
161
# various formats of manuals need to be included along with the rest of the
162
# sources.  Therefore we have --enable-generated-files-in-srcdir to do
163
# just that.
164
 
165
AC_MSG_CHECKING([whether to place generated files in the source directory])
166
  dnl generated-files-in-srcdir is disabled by default
167
  AC_ARG_ENABLE(generated-files-in-srcdir,
168
[  --enable-generated-files-in-srcdir
169
                          put copies of generated files in source dir
170
                          intended for creating source tarballs for users
171
                          without texinfo bison or flex.],
172
      generated_files_in_srcdir=$enableval,
173
      generated_files_in_srcdir=no)
174
 
175
AC_MSG_RESULT($generated_files_in_srcdir)
176
 
177
if test "$generated_files_in_srcdir" = "yes"; then
178
  GENINSRC=''
179
else
180
  GENINSRC='#'
181
fi
182
AC_SUBST(GENINSRC)
183
 
184
# -------------------
185
# Find default linker
186
# -------------------
187
 
188
# With GNU ld
189
AC_ARG_WITH(gnu-ld,
190
[  --with-gnu-ld           arrange to work with GNU ld.],
191
gnu_ld_flag="$with_gnu_ld",
192
gnu_ld_flag=no)
193
 
194
# With pre-defined ld
195
AC_ARG_WITH(ld,
196
[  --with-ld               arrange to use the specified ld (full pathname)],
197
DEFAULT_LINKER="$with_ld")
198
if test x"${DEFAULT_LINKER+set}" = x"set"; then
199
  if test ! -x "$DEFAULT_LINKER"; then
200
    AC_MSG_ERROR([cannot execute: $DEFAULT_LINKER: check --with-ld or env. var. DEFAULT_LINKER])
201
  elif $DEFAULT_LINKER -v < /dev/null 2>&1 | grep GNU > /dev/null; then
202
    gnu_ld_flag=yes
203
  fi
204
  AC_DEFINE_UNQUOTED(DEFAULT_LINKER,"$DEFAULT_LINKER",
205
        [Define to enable the use of a default linker.])
206
fi
207
 
208
AC_MSG_CHECKING([whether a default linker was specified])
209
if test x"${DEFAULT_LINKER+set}" = x"set"; then
210
  if test x"$gnu_ld_flag" = x"no"; then
211
    AC_MSG_RESULT([yes ($DEFAULT_LINKER)])
212
  else
213
    AC_MSG_RESULT([yes ($DEFAULT_LINKER - GNU ld)])
214
  fi
215
else
216
  AC_MSG_RESULT(no)
217
fi
218
 
219
# With demangler in GNU ld
220
AC_ARG_WITH(demangler-in-ld,
221
[  --with-demangler-in-ld  try to use demangler in GNU ld.],
222
demangler_in_ld="$with_demangler_in_ld",
223
demangler_in_ld=no)
224
 
225
# ----------------------
226
# Find default assembler
227
# ----------------------
228
 
229
# With GNU as
230
AC_ARG_WITH(gnu-as,
231
[  --with-gnu-as           arrange to work with GNU as],
232
gas_flag="$with_gnu_as",
233
gas_flag=no)
234
 
235
AC_ARG_WITH(as,
236
[  --with-as               arrange to use the specified as (full pathname)],
237
DEFAULT_ASSEMBLER="$with_as")
238
if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then
239
  if test ! -x "$DEFAULT_ASSEMBLER"; then
240
    AC_MSG_ERROR([cannot execute: $DEFAULT_ASSEMBLER: check --with-as or env. var. DEFAULT_ASSEMBLER])
241
  elif $DEFAULT_ASSEMBLER -v < /dev/null 2>&1 | grep GNU > /dev/null; then
242
    gas_flag=yes
243
  fi
244
  AC_DEFINE_UNQUOTED(DEFAULT_ASSEMBLER,"$DEFAULT_ASSEMBLER",
245
        [Define to enable the use of a default assembler.])
246
fi
247
 
248
AC_MSG_CHECKING([whether a default assembler was specified])
249
if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then
250
  if test x"$gas_flag" = x"no"; then
251
    AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER)])
252
  else
253
    AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER - GNU as)])
254
  fi
255
else
256
  AC_MSG_RESULT(no)
257
fi
258
 
259
# ---------------
260
# Find C compiler
261
# ---------------
262
 
263
# If a non-executable a.out is present (e.g. created by GNU as above even if
264
# invoked with -v only), the IRIX 6 native ld just overwrites the existing
265
# file, even when creating an executable, so an execution test fails.
266
# Remove possible default executable files to avoid this.
267
#
268
# FIXME: This really belongs into AC_PROG_CC and can be removed once
269
# Autoconf includes it.
270
rm -f a.out a.exe b.out
271
 
272
# Find the native compiler
273
AC_PROG_CC
274
AM_PROG_CC_C_O
275
# autoconf is lame and doesn't give us any substitution variable for this.
276
if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
277
  NO_MINUS_C_MINUS_O=yes
278
else
279
  OUTPUT_OPTION='-o $@'
280
fi
281
AC_SUBST(NO_MINUS_C_MINUS_O)
282
AC_SUBST(OUTPUT_OPTION)
283
 
284
# Remove the -O2: for historical reasons, unless bootstrapping we prefer
285
# optimizations to be activated explicitly by the toplevel.
286
case "$CC" in
287
  */prev-gcc/xgcc*) ;;
288
  *) CFLAGS=`echo $CFLAGS | sed "s/-O[[s0-9]]* *//" ` ;;
289
esac
290
AC_SUBST(CFLAGS)
291
 
292
# -------------------------
293
# Check C compiler features
294
# -------------------------
295
 
296
AC_PROG_CPP
297
AC_C_INLINE
298
 
299
# sizeof(char) is 1 by definition.
300
AC_CHECK_SIZEOF(void *)
301
AC_CHECK_SIZEOF(short)
302
AC_CHECK_SIZEOF(int)
303
AC_CHECK_SIZEOF(long)
304
AC_CHECK_TYPES([long long], [AC_CHECK_SIZEOF(long long)])
305
AC_CHECK_TYPES([__int64], [AC_CHECK_SIZEOF(__int64)])
306
 
307
# ---------------------
308
# Warnings and checking
309
# ---------------------
310
 
311
# Check $CC warning features (if it's GCC).
312
# We want to use -pedantic, but we don't want warnings about
313
# * 'long long'
314
# * variadic macros
315
# * overlong strings
316
# So, we only use -pedantic if we can disable those warnings.
317
 
318
AC_CACHE_CHECK(
319
  [whether ${CC} accepts -Wno-long-long],
320
  [ac_cv_prog_cc_w_no_long_long],
321
  [save_CFLAGS="$CFLAGS"
322
  CFLAGS="-Wno-long-long"
323
  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])],
324
                    [ac_cv_prog_cc_w_no_long_long=yes],
325
                    [ac_cv_prog_cc_w_no_long_long=no])
326
  CFLAGS="$save_CFLAGS"
327
  ])
328
 
329
AC_CACHE_CHECK(
330
  [whether ${CC} accepts -Wno-variadic-macros],
331
  [ac_cv_prog_cc_w_no_variadic_macros],
332
  [save_CFLAGS="$CFLAGS"
333
  CFLAGS="-Wno-variadic-macros"
334
  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])],
335
                    [ac_cv_prog_cc_w_no_variadic_macros=yes],
336
                    [ac_cv_prog_cc_w_no_variadic_macros=no])
337
  CFLAGS="$save_CFLAGS"
338
  ])
339
 
340
AC_CACHE_CHECK(
341
  [whether ${CC} accepts -Wno-overlength-strings],
342
  [ac_cv_prog_cc_w_no_overlength_strings],
343
  [save_CFLAGS="$CFLAGS"
344
  CFLAGS="-Wno-overlength-strings"
345
  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])],
346
                    [ac_cv_prog_cc_w_no_overlength_strings=yes],
347
                    [ac_cv_prog_cc_w_no_overlength_strings=no])
348
  CFLAGS="$save_CFLAGS"
349
  ])
350
 
351
strict1_warn=
352
if test $ac_cv_prog_cc_w_no_long_long = yes \
353
   && test $ac_cv_prog_cc_w_no_variadic_macros = yes \
354
   && test $ac_cv_prog_cc_w_no_overlength_strings = yes ; then
355
  strict1_warn="-pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings"
356
fi
357
 
358
# Add -Wold-style-definition if it's accepted
359
AC_CACHE_CHECK(
360
  [whether ${CC} accepts -Wold-style-definition],
361
  [ac_cv_prog_cc_w_old_style_definition],
362
  [save_CFLAGS="$CFLAGS"
363
  CFLAGS="-Wold-style-definition"
364
  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])],
365
                    [ac_cv_prog_cc_w_old_style_definition=yes],
366
                    [ac_cv_prog_cc_w_old_style_definition=no])
367
  CFLAGS="$save_CFLAGS"
368
  ])
369
if test $ac_cv_prog_cc_w_old_style_definition = yes ; then
370
  strict1_warn="${strict1_warn} -Wold-style-definition"
371
fi
372
 
373
# Add -Wmissing-format-attribute if it's accepted
374
AC_CACHE_CHECK(
375
  [whether ${CC} accepts -Wmissing-format-attribute],
376
  [ac_cv_prog_cc_w_missing_format_attribute],
377
  [save_CFLAGS="$CFLAGS"
378
  CFLAGS="-Wmissing-format-attribute"
379
  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])],
380
                    [ac_cv_prog_cc_w_missing_format_attribute=yes],
381
                    [ac_cv_prog_cc_w_missing_format_attribute=no])
382
  CFLAGS="$save_CFLAGS"
383
  ])
384
if test $ac_cv_prog_cc_w_missing_format_attribute = yes ; then
385
  strict1_warn="${strict1_warn} -Wmissing-format-attribute"
386
fi
387
 
388
# Enable -Werror, period.
389
AC_ARG_ENABLE(werror_always,
390
[  --enable-werror-always         enable -Werror always], [],
391
[enable_werror_always=no])
392
if test x${enable_werror_always} = xyes ; then
393
  strict1_warn="${strict1_warn} -Werror"
394
  WERROR=-Werror
395
fi
396
 
397
AC_SUBST(strict1_warn)
398
 
399
# Get C++ compatibility warning flag, if supported.
400
AC_CACHE_CHECK(
401
  [whether ${CC} accepts -Wc++-compat],
402
  [ac_cv_prog_cc_w_cxx_compat],
403
  [save_CFLAGS="$CFLAGS"
404
  CFLAGS="-Wc++-compat"
405
  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])],
406
                    [ac_cv_prog_cc_w_cxx_compat=yes],
407
                    [ac_cv_prog_cc_w_cxx_compat=no])
408
  CFLAGS="$save_CFLAGS"
409
  ])
410
if test x${ac_cv_prog_cc_w_cxx_compat} = xyes; then
411
  cxx_compat_warn="-Wc++-compat"
412
fi
413
AC_SUBST(cxx_compat_warn)
414
 
415
 
416
# If the native compiler is GCC, we can enable warnings even in stage1.
417
# That's useful for people building cross-compilers, or just running a
418
# quick `make'.
419
warn_cflags=
420
if test "x$GCC" = "xyes"; then
421
  warn_cflags='$(GCC_WARN_CFLAGS)'
422
fi
423
AC_SUBST(warn_cflags)
424
 
425
# Enable -Werror in bootstrap stage2 and later.
426
is_release=
427
if test x"`cat $srcdir/DEV-PHASE`" != xexperimental; then
428
  is_release=yes
429
fi
430
AC_ARG_ENABLE(werror,
431
[  --enable-werror         enable -Werror in bootstrap stage2 and later], [],
432
[if test x$is_release = x ; then
433
  # Default to "yes" on development branches.
434
  enable_werror=yes
435
else
436
  # Default to "no" on release branches.
437
  enable_werror=no
438
fi])
439
if test x$enable_werror = xyes ; then
440
  WERROR=-Werror
441
fi
442
AC_SUBST(WERROR)
443
 
444
# Enable expensive internal checks
445
AC_ARG_ENABLE(checking,
446
[  --enable-checking[=LIST]
447
                          enable expensive run-time checks.  With LIST,
448
                          enable only specific categories of checks.
449
                          Categories are: yes,no,all,none,release.
450
                          Flags are: assert,fold,gc,gcac,misc,
451
                          rtlflag,rtl,runtime,tree,valgrind.],
452
[ac_checking_flags="${enableval}"],[
453
# Determine the default checks.
454
if test x$is_release = x ; then
455
  ac_checking_flags=yes
456
else
457
  ac_checking_flags=release
458
fi])
459
ac_assert_checking=1
460
ac_checking=
461
ac_fold_checking=
462
ac_gc_checking=
463
ac_gc_always_collect=
464
ac_rtl_checking=
465
ac_rtlflag_checking=
466
ac_runtime_checking=1
467
ac_tree_checking=
468
ac_valgrind_checking=
469
IFS="${IFS=     }"; ac_save_IFS="$IFS"; IFS="$IFS,"
470
for check in $ac_checking_flags
471
do
472
        case $check in
473
        # these set all the flags to specific states
474
        yes)            ac_assert_checking=1 ; ac_checking=1 ;
475
                        ac_fold_checking= ; ac_gc_checking=1 ;
476
                        ac_gc_always_collect= ; ac_rtl_checking= ;
477
                        ac_rtlflag_checking=1 ; ac_runtime_checking=1 ;
478
                        ac_tree_checking=1 ; ac_valgrind_checking= ;;
479
        no|none)        ac_assert_checking= ; ac_checking= ;
480
                        ac_fold_checking= ; ac_gc_checking= ;
481
                        ac_gc_always_collect= ; ac_rtl_checking= ;
482
                        ac_rtlflag_checking= ; ac_runtime_checking= ;
483
                        ac_tree_checking= ; ac_valgrind_checking= ;;
484
        all)            ac_assert_checking=1 ; ac_checking=1 ;
485
                        ac_fold_checking=1 ; ac_gc_checking=1 ;
486
                        ac_gc_always_collect=1 ; ac_rtl_checking=1 ;
487
                        ac_rtlflag_checking=1 ; ac_runtime_checking=1 ;
488
                        ac_tree_checking=1 ; ac_valgrind_checking= ;;
489
        release)        ac_assert_checking=1 ; ac_checking= ;
490
                        ac_fold_checking= ; ac_gc_checking= ;
491
                        ac_gc_always_collect= ; ac_rtl_checking= ;
492
                        ac_rtlflag_checking= ; ac_runtime_checking=1 ;
493
                        ac_tree_checking= ; ac_valgrind_checking= ;;
494
        # these enable particular checks
495
        assert)         ac_assert_checking=1 ;;
496
        fold)           ac_fold_checking=1 ;;
497
        gc)             ac_gc_checking=1 ;;
498
        gcac)           ac_gc_always_collect=1 ;;
499
        misc)           ac_checking=1 ;;
500
        rtl)            ac_rtl_checking=1 ;;
501
        rtlflag)        ac_rtlflag_checking=1 ;;
502
        runtime)        ac_runtime_checking=1 ;;
503
        tree)           ac_tree_checking=1 ;;
504
        valgrind)       ac_valgrind_checking=1 ;;
505
        *)      AC_MSG_ERROR(unknown check category $check) ;;
506
        esac
507
done
508
IFS="$ac_save_IFS"
509
 
510
nocommon_flag=""
511
if test x$ac_checking != x ; then
512
  AC_DEFINE(ENABLE_CHECKING, 1,
513
[Define if you want more run-time sanity checks.  This one gets a grab
514
   bag of miscellaneous but relatively cheap checks.])
515
  nocommon_flag=-fno-common
516
fi
517
AC_SUBST(nocommon_flag)
518
if test x$ac_assert_checking != x ; then
519
  AC_DEFINE(ENABLE_ASSERT_CHECKING, 1,
520
[Define if you want assertions enabled.  This is a cheap check.])
521
fi
522
GCC_TARGET_TEMPLATE(ENABLE_RUNTIME_CHECKING)
523
if test x$ac_runtime_checking != x ; then
524
  AC_DEFINE(ENABLE_RUNTIME_CHECKING, 1,
525
[Define if you want runtime assertions enabled.  This is a cheap check.])
526
fi
527
if test x$ac_tree_checking != x ; then
528
  AC_DEFINE(ENABLE_TREE_CHECKING, 1,
529
[Define if you want all operations on trees (the basic data
530
   structure of the front ends) to be checked for dynamic type safety
531
   at runtime.  This is moderately expensive.  The tree browser debugging
532
   routines will also be enabled by this option.
533
   ])
534
  TREEBROWSER=tree-browser.o
535
fi
536
AC_SUBST(TREEBROWSER)
537
if test x$ac_rtl_checking != x ; then
538
  AC_DEFINE(ENABLE_RTL_CHECKING, 1,
539
[Define if you want all operations on RTL (the basic data structure
540
   of the optimizer and back end) to be checked for dynamic type safety
541
   at runtime.  This is quite expensive.])
542
fi
543
if test x$ac_rtlflag_checking != x ; then
544
  AC_DEFINE(ENABLE_RTL_FLAG_CHECKING, 1,
545
[Define if you want RTL flag accesses to be checked against the RTL
546
   codes that are supported for each access macro.  This is relatively
547
   cheap.])
548
fi
549
if test x$ac_gc_checking != x ; then
550
  AC_DEFINE(ENABLE_GC_CHECKING, 1,
551
[Define if you want the garbage collector to do object poisoning and
552
   other memory allocation checks.  This is quite expensive.])
553
fi
554
if test x$ac_gc_always_collect != x ; then
555
  AC_DEFINE(ENABLE_GC_ALWAYS_COLLECT, 1,
556
[Define if you want the garbage collector to operate in maximally
557
   paranoid mode, validating the entire heap and collecting garbage at
558
   every opportunity.  This is extremely expensive.])
559
fi
560
if test x$ac_fold_checking != x ; then
561
  AC_DEFINE(ENABLE_FOLD_CHECKING, 1,
562
[Define if you want fold checked that it never destructs its argument.
563
   This is quite expensive.])
564
fi
565
valgrind_path_defines=
566
valgrind_command=
567
 
568
dnl # This check AC_REQUIREs various stuff, so it *must not* be inside
569
dnl # an if statement.  This was the source of very frustrating bugs
570
dnl # in converting to autoconf 2.5x!
571
AC_CHECK_HEADER(valgrind.h, have_valgrind_h=yes, have_valgrind_h=no)
572
 
573
if test x$ac_valgrind_checking != x ; then
574
  # It is certainly possible that there's valgrind but no valgrind.h.
575
  # GCC relies on making annotations so we must have both.
576
  AC_MSG_CHECKING(for VALGRIND_DISCARD in )
577
  AC_PREPROC_IFELSE([AC_LANG_SOURCE(
578
    [[#include 
579
#ifndef VALGRIND_DISCARD
580
#error VALGRIND_DISCARD not defined
581
#endif]])],
582
  [gcc_cv_header_valgrind_memcheck_h=yes],
583
  [gcc_cv_header_valgrind_memcheck_h=no])
584
  AC_MSG_RESULT($gcc_cv_header_valgrind_memcheck_h)
585
  AC_MSG_CHECKING(for VALGRIND_DISCARD in )
586
  AC_PREPROC_IFELSE([AC_LANG_SOURCE(
587
    [[#include 
588
#ifndef VALGRIND_DISCARD
589
#error VALGRIND_DISCARD not defined
590
#endif]])],
591
  [gcc_cv_header_memcheck_h=yes],
592
  [gcc_cv_header_memcheck_h=no])
593
  AC_MSG_RESULT($gcc_cv_header_memcheck_h)
594
  AM_PATH_PROG_WITH_TEST(valgrind_path, valgrind,
595
        [$ac_dir/$ac_word --version | grep valgrind- >/dev/null 2>&1])
596
  if test "x$valgrind_path" = "x" \
597
    || (test $have_valgrind_h = no \
598
        && test $gcc_cv_header_memcheck_h = no \
599
        && test $gcc_cv_header_valgrind_memcheck_h = no); then
600
        AC_MSG_ERROR([*** Can't find both valgrind and valgrind/memcheck.h, memcheck.h or valgrind.h])
601
  fi
602
  valgrind_path_defines=-DVALGRIND_PATH='\"'$valgrind_path'\"'
603
  valgrind_command="$valgrind_path -q"
604
  AC_DEFINE(ENABLE_VALGRIND_CHECKING, 1,
605
[Define if you want to run subprograms and generated programs
606
   through valgrind (a memory checker).  This is extremely expensive.])
607
  if test $gcc_cv_header_valgrind_memcheck_h = yes; then
608
    AC_DEFINE(HAVE_VALGRIND_MEMCHECK_H, 1,
609
        [Define if valgrind's valgrind/memcheck.h header is installed.])
610
  fi
611
  if test $gcc_cv_header_memcheck_h = yes; then
612
    AC_DEFINE(HAVE_MEMCHECK_H, 1,
613
        [Define if valgrind's memcheck.h header is installed.])
614
  fi
615
fi
616
AC_SUBST(valgrind_path_defines)
617
AC_SUBST(valgrind_command)
618
 
619
AC_ARG_ENABLE(mapped-location,
620
[  --enable-mapped-location   location_t is fileline integer cookie],,
621
enable_mapped_location=no)
622
 
623
if test "$enable_mapped_location" = yes ; then
624
  AC_DEFINE(USE_MAPPED_LOCATION, 1,
625
[Define if location_t is fileline integer cookie.])
626
fi
627
 
628
# Enable code coverage collection
629
AC_ARG_ENABLE(coverage,
630
[  --enable-coverage[=LEVEL]
631
                          enable compiler's code coverage collection.
632
                          Use to measure compiler performance and locate
633
                          unused parts of the compiler. With LEVEL, specify
634
                          optimization. Values are opt, noopt,
635
                          default is noopt],
636
[case "${enableval}" in
637
  yes|noopt)
638
    coverage_flags="-fprofile-arcs -ftest-coverage -frandom-seed=\$@ -O0"
639
    ;;
640
  opt)
641
    coverage_flags="-fprofile-arcs -ftest-coverage -frandom-seed=\$@ -O2"
642
    ;;
643
  no)
644
    # a.k.a. --disable-coverage
645
    coverage_flags=""
646
    ;;
647
  *)
648
    AC_MSG_ERROR(unknown coverage setting $enableval)
649
    ;;
650
esac],
651
[coverage_flags=""])
652
AC_SUBST(coverage_flags)
653
 
654
AC_ARG_ENABLE(gather-detailed-mem-stats,
655
[  --enable-gather-detailed-mem-stats         enable detailed memory allocation stats gathering], [],
656
[enable_gather_detailed_mem_stats=no])
657
if test x$enable_gather_detailed_mem_stats = xyes ; then
658
  AC_DEFINE(GATHER_STATISTICS, 1,
659
        [Define to enable detailed memory allocation stats gathering.])
660
fi
661
 
662
# -------------------------------
663
# Miscenalleous configure options
664
# -------------------------------
665
 
666
# With stabs
667
AC_ARG_WITH(stabs,
668
[  --with-stabs            arrange to use stabs instead of host debug format],
669
stabs="$with_stabs",
670
stabs=no)
671
 
672
# Determine whether or not multilibs are enabled.
673
AC_ARG_ENABLE(multilib,
674
[  --enable-multilib       enable library support for multiple ABIs],
675
[], [enable_multilib=yes])
676
AC_SUBST(enable_multilib)
677
 
678
# Enable __cxa_atexit for C++.
679
AC_ARG_ENABLE(__cxa_atexit,
680
[  --enable-__cxa_atexit   enable __cxa_atexit for C++],
681
[], [])
682
 
683
# Enable C extension for decimal float if target supports it.
684
AC_ARG_ENABLE(decimal-float,
685
[  --enable-decimal-float  enable decimal float extension to C],
686
[
687
  if test x$enablevar = xyes ; then
688
    case $target in
689
    powerpc*-*-linux* | i?86*-*-linux*)
690
      enable_decimal_float=yes
691
      ;;
692
    *)
693
      AC_MSG_WARN(decimal float is not supported for this target, ignored)
694
      enable_decimal_float=no
695
      ;;
696
    esac
697
  fi
698
], [enable_decimal_float=no])
699
 
700
AC_SUBST(enable_decimal_float)
701
 
702
dfp=`if test $enable_decimal_float = yes; then echo 1; else echo 0; fi`
703
AC_DEFINE_UNQUOTED(ENABLE_DECIMAL_FLOAT, $dfp,
704
[Define to 1 to enable decimal float extension to C.])
705
 
706
# Enable threads
707
# Pass with no value to take the default
708
# Pass with a value to specify a thread package
709
AC_ARG_ENABLE(threads,
710
[  --enable-threads        enable thread usage for target GCC
711
  --enable-threads=LIB    use LIB thread package for target GCC],,
712
[enable_threads=''])
713
 
714
AC_ARG_ENABLE(tls,
715
[  --enable-tls            enable or disable generation of tls code
716
                          overriding the assembler check for tls support],
717
[
718
  case $enable_tls in
719
    yes | no) ;;
720
    *) AC_MSG_ERROR(['$enable_tls' is an invalid value for --enable-tls.
721
Valid choices are 'yes' and 'no'.]) ;;
722
  esac
723
], [enable_tls=''])
724
 
725
AC_ARG_ENABLE(objc-gc,
726
[  --enable-objc-gc       enable the use of Boehm's garbage collector with
727
                          the GNU Objective-C runtime],
728
if test x$enable_objc_gc = xno; then
729
        objc_boehm_gc=''
730
else
731
        objc_boehm_gc=1
732
fi,
733
objc_boehm_gc='')
734
 
735
AC_ARG_WITH(dwarf2,
736
[  --with-dwarf2           force the default debug format to be DWARF 2],
737
dwarf2="$with_dwarf2",
738
dwarf2=no)
739
 
740
AC_ARG_ENABLE(shared,
741
[  --disable-shared        don't provide a shared libgcc],
742
[
743
  case $enable_shared in
744
  yes | no) ;;
745
  *)
746
    enable_shared=no
747
    IFS="${IFS=         }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
748
    for pkg in $enableval; do
749
      if test "X$pkg" = "Xgcc" || test "X$pkg" = "Xlibgcc"; then
750
        enable_shared=yes
751
      fi
752
    done
753
    IFS="$ac_save_ifs"
754
    ;;
755
  esac
756
], [enable_shared=yes])
757
AC_SUBST(enable_shared)
758
 
759
AC_ARG_WITH(build-sysroot,
760
  [  --with-build-sysroot=sysroot
761
                          use sysroot as the system root during the build])
762
 
763
AC_ARG_WITH(sysroot,
764
[  --with-sysroot[=DIR] Search for usr/lib, usr/include, et al, within DIR.],
765
[
766
 case ${with_sysroot} in
767
 yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_noncanonical}/sys-root' ;;
768
 *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
769
 esac
770
 
771
 TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
772
 CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$(NATIVE_SYSTEM_HEADER_DIR)'
773
 
774
 if test "x$exec_prefix" = xNONE; then
775
  if test "x$prefix" = xNONE; then
776
   test_prefix=/usr/local
777
  else
778
   test_prefix=$prefix
779
  fi
780
 else
781
  test_prefix=$exec_prefix
782
 fi
783
 case ${TARGET_SYSTEM_ROOT} in
784
 "${test_prefix}"|"${test_prefix}/"*|\
785
 '${exec_prefix}'|'${exec_prefix}/'*)
786
   t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE"
787
   TARGET_SYSTEM_ROOT_DEFINE="$t"
788
   ;;
789
 esac
790
], [
791
 TARGET_SYSTEM_ROOT=
792
 TARGET_SYSTEM_ROOT_DEFINE=
793
 CROSS_SYSTEM_HEADER_DIR='$(gcc_tooldir)/sys-include'
794
])
795
AC_SUBST(TARGET_SYSTEM_ROOT)
796
AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
797
AC_SUBST(CROSS_SYSTEM_HEADER_DIR)
798
 
799
# Build with intermodule optimisations
800
AC_ARG_ENABLE(intermodule,
801
[  --enable-intermodule    build the compiler in one step],
802
[case ${enable_intermodule} in
803
  yes) onestep="-onestep";;
804
  *) onestep="";;
805
esac],
806
[onestep=""])
807
AC_SUBST(onestep)
808
 
809
# Sanity check enable_languages in case someone does not run the toplevel
810
# configure # script.
811
AC_ARG_ENABLE(languages,
812
[  --enable-languages=LIST specify which front-ends to build],
813
[case ,${enable_languages}, in
814
       ,,|,yes,)
815
                # go safe -- we cannot be much sure without the toplevel
816
                # configure's
817
                # analysis of which target libs are present and usable
818
                enable_languages=c
819
                ;;
820
         *,all,*)
821
                AC_MSG_ERROR([only the toplevel supports --enable-languages=all])
822
                ;;
823
        *,c,*)
824
                ;;
825
        *)
826
                enable_languages=c,${enable_languages}
827
                ;;
828
esac],
829
[enable_languages=c])
830
 
831
# Used by documentation targets
832
AC_SUBST(datarootdir)
833
AC_SUBST(docdir)
834
AC_SUBST(htmldir)
835
 
836
# -------------------------
837
# Checks for other programs
838
# -------------------------
839
 
840
AC_PROG_MAKE_SET
841
 
842
# Find some useful tools
843
AC_PROG_AWK
844
# We need awk to create options.c and options.h.
845
# Bail out if it's missing.
846
case ${AWK} in
847
  "") AC_MSG_ERROR([can't build without awk, bailing out]) ;;
848
esac
849
 
850
gcc_AC_PROG_LN_S
851
ACX_PROG_LN($LN_S)
852
AC_PROG_RANLIB
853
case "${host}" in
854
*-*-darwin*)
855
  # By default, the Darwin ranlib will not treat common symbols as
856
  # definitions when  building the archive table of contents.  Other
857
  # ranlibs do that; pass an option to the Darwin ranlib that makes
858
  # it behave similarly.
859
  ranlib_flags="-c"
860
  ;;
861
*)
862
  ranlib_flags=""
863
esac
864
AC_SUBST(ranlib_flags)
865
 
866
gcc_AC_PROG_INSTALL
867
 
868
# See if cmp has --ignore-initial.
869
gcc_AC_PROG_CMP_IGNORE_INITIAL
870
 
871
# See if we have the mktemp command.
872
AC_CHECK_PROG(have_mktemp_command, mktemp, yes, no)
873
 
874
MISSING="${CONFIG_SHELL-/bin/sh} $srcdir/../missing"
875
 
876
# See if makeinfo has been installed and is modern enough
877
# that we can use it.
878
gcc_AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
879
  [GNU texinfo.* \([0-9][0-9.]*\)],
880
  [4.[4-9]*|4.[1-9][0-9]*|[5-9]*|[1-9][0-9]*])
881
if test $gcc_cv_prog_makeinfo_modern = no; then
882
  MAKEINFO="$MISSING makeinfo"
883
  AC_MSG_WARN([
884
*** Makeinfo is missing or too old.
885
*** Info documentation will not be built.])
886
  BUILD_INFO=
887
else
888
  BUILD_INFO=info
889
fi
890
AC_SUBST(BUILD_INFO)
891
 
892
# Is pod2man recent enough to regenerate manpages?
893
AC_MSG_CHECKING([for recent Pod::Man])
894
if (perl -e 'use 1.10 Pod::Man') >/dev/null 2>&1; then
895
  AC_MSG_RESULT(yes)
896
  GENERATED_MANPAGES=generated-manpages
897
else
898
  AC_MSG_RESULT(no)
899
  GENERATED_MANPAGES=
900
fi
901
AC_SUBST(GENERATED_MANPAGES)
902
 
903
# How about lex?
904
dnl Don't use AC_PROG_LEX; we insist on flex.
905
dnl LEXLIB is not useful in gcc.
906
AC_CHECK_PROGS([FLEX], flex, [$MISSING flex])
907
 
908
# Bison?
909
AC_CHECK_PROGS([BISON], bison, [$MISSING bison])
910
 
911
# Binutils are not build modules, unlike bison/flex/makeinfo.  So we
912
# check for build == host before using them.
913
 
914
# NM
915
if test x${build} = x${host} && test -f $srcdir/../binutils/nm.c \
916
  && test -d ../binutils ; then
917
  NM='$(objdir)/../binutils/nm-new'
918
else
919
  AC_CHECK_PROG(NM, nm, nm, ${CONFIG_SHELL-/bin/sh} ${srcdir}/../missing nm)
920
fi
921
 
922
# AR
923
if test x${build} = x${host} && test -f $srcdir/../binutils/ar.c \
924
  && test -d ../binutils ; then
925
  AR='$(objdir)/../binutils/ar'
926
else
927
  AC_CHECK_PROG(AR, ar, ar, ${CONFIG_SHELL-/bin/sh} ${srcdir}/../missing ar)
928
fi
929
 
930
 
931
# --------------------
932
# Checks for C headers
933
# --------------------
934
 
935
AC_MSG_CHECKING(for GNU C library)
936
AC_CACHE_VAL(gcc_cv_glibc,
937
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
938
  [[#include ]], [[
939
#if ! (defined __GLIBC__ || defined __GNU_LIBRARY__)
940
#error Not a GNU C library system
941
#endif]])],
942
  [gcc_cv_glibc=yes],
943
  [gcc_cv_glibc=no])])
944
AC_MSG_RESULT($gcc_cv_glibc)
945
if test $gcc_cv_glibc = yes; then
946
  AC_DEFINE(_GNU_SOURCE, 1, [Always define this when using the GNU C Library])
947
fi
948
 
949
# Need to reject headers which give warnings, so that the -Werror bootstrap
950
# works later. *sigh*  This needs to come before all header checks.
951
AC_PROG_CPP_WERROR
952
 
953
AC_HEADER_STDC
954
AC_HEADER_TIME
955
ACX_HEADER_STRING
956
AC_HEADER_SYS_WAIT
957
AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h iconv.h \
958
                 fcntl.h unistd.h sys/file.h sys/time.h sys/mman.h \
959
                 sys/resource.h sys/param.h sys/times.h sys/stat.h \
960
                 direct.h malloc.h langinfo.h ldfcn.h locale.h wchar.h)
961
 
962
# Check for thread headers.
963
AC_CHECK_HEADER(thread.h, [have_thread_h=yes], [have_thread_h=])
964
AC_CHECK_HEADER(pthread.h, [have_pthread_h=yes], [have_pthread_h=])
965
 
966
# These tests can't be done till we know if we have limits.h.
967
gcc_AC_C_CHAR_BIT
968
AC_C_BIGENDIAN
969
 
970
# --------
971
# UNSORTED
972
# --------
973
 
974
# Stage specific cflags for build.
975
stage1_cflags=
976
case $build in
977
vax-*-*)
978
  if test x$GCC = xyes
979
  then
980
    stage1_cflags="-Wa,-J"
981
  else
982
    stage1_cflags="-J"
983
  fi
984
  ;;
985
esac
986
AC_SUBST(stage1_cflags)
987
 
988
# These libraries may be used by collect2.
989
# We may need a special search path to get them linked.
990
AC_CACHE_CHECK(for collect2 libraries, gcc_cv_collect2_libs,
991
[save_LIBS="$LIBS"
992
for libs in '' -lld -lmld \
993
                '-L/usr/lib/cmplrs/cc2.11 -lmld' \
994
                '-L/usr/lib/cmplrs/cc3.11 -lmld'
995
do
996
        LIBS="$libs"
997
        AC_TRY_LINK_FUNC(ldopen,
998
                [gcc_cv_collect2_libs="$libs"; break])
999
done
1000
LIBS="$save_LIBS"
1001
test -z "$gcc_cv_collect2_libs" && gcc_cv_collect2_libs='none required'])
1002
case $gcc_cv_collect2_libs in
1003
        "none required")        ;;
1004
        *)      COLLECT2_LIBS=$gcc_cv_collect2_libs ;;
1005
esac
1006
AC_SUBST(COLLECT2_LIBS)
1007
 
1008
# When building Ada code on Alpha, we need exc_resume which is usually in
1009
# -lexc.  So test for it.
1010
save_LIBS="$LIBS"
1011
LIBS=
1012
AC_SEARCH_LIBS(exc_resume, exc)
1013
GNAT_LIBEXC="$LIBS"
1014
LIBS="$save_LIBS"
1015
AC_SUBST(GNAT_LIBEXC)
1016
 
1017
# Some systems put ldexp and frexp in libm instead of libc; assume
1018
# they're both in the same place.  jcf-dump needs them.
1019
save_LIBS="$LIBS"
1020
LIBS=
1021
AC_SEARCH_LIBS(ldexp, m)
1022
LDEXP_LIB="$LIBS"
1023
LIBS="$save_LIBS"
1024
AC_SUBST(LDEXP_LIB)
1025
 
1026
# Use  only if it exists,
1027
# doesn't clash with , and declares intmax_t.
1028
AC_MSG_CHECKING(for inttypes.h)
1029
AC_CACHE_VAL(gcc_cv_header_inttypes_h,
1030
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1031
[[#include 
1032
#include ]],
1033
  [[intmax_t i = -1;]])],
1034
  [gcc_cv_header_inttypes_h=yes],
1035
  [gcc_cv_header_inttypes_h=no])])
1036
AC_MSG_RESULT($gcc_cv_header_inttypes_h)
1037
if test $gcc_cv_header_inttypes_h = yes; then
1038
  AC_DEFINE(HAVE_INTTYPES_H, 1,
1039
        [Define if you have a working  header file.])
1040
fi
1041
 
1042
dnl Disabled until we have a complete test for buggy enum bitfields.
1043
dnl gcc_AC_C_ENUM_BF_UNSIGNED
1044
 
1045
define(gcc_UNLOCKED_FUNCS, clearerr_unlocked feof_unlocked dnl
1046
  ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked dnl
1047
  fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked dnl
1048
  fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked dnl
1049
  putchar_unlocked putc_unlocked)
1050
AC_CHECK_FUNCS(times clock kill getrlimit setrlimit atoll atoq \
1051
        sysconf strsignal getrusage nl_langinfo scandir alphasort \
1052
        gettimeofday mbstowcs wcswidth mmap mincore setlocale \
1053
        gcc_UNLOCKED_FUNCS)
1054
 
1055
if test x$ac_cv_func_mbstowcs = xyes; then
1056
  AC_CACHE_CHECK(whether mbstowcs works, gcc_cv_func_mbstowcs_works,
1057
[    AC_RUN_IFELSE([AC_LANG_SOURCE([[#include 
1058
int main()
1059
{
1060
  mbstowcs(0, "", 0);
1061
  return 0;
1062
}]])],
1063
    [gcc_cv_func_mbstowcs_works=yes],
1064
    [gcc_cv_func_mbstowcs_works=no],
1065
    [gcc_cv_func_mbstowcs_works=yes])])
1066
  if test x$gcc_cv_func_mbstowcs_works = xyes; then
1067
    AC_DEFINE(HAVE_WORKING_MBSTOWCS, 1,
1068
  [Define this macro if mbstowcs does not crash when its
1069
   first argument is NULL.])
1070
  fi
1071
fi
1072
 
1073
AC_CHECK_TYPE(ssize_t, int)
1074
 
1075
# Try to determine the array type of the second argument of getgroups
1076
# for the target system (int or gid_t).
1077
AC_TYPE_GETGROUPS
1078
if test "${target}" = "${build}"; then
1079
  TARGET_GETGROUPS_T=$ac_cv_type_getgroups
1080
else
1081
  case "${target}" in
1082
        # This condition may need some tweaking.  It should include all
1083
        # targets where the array type of the second argument of getgroups
1084
        # is int and the type of gid_t is not equivalent to int.
1085
        *-*-sunos* | *-*-ultrix*)
1086
                TARGET_GETGROUPS_T=int
1087
                ;;
1088
        *)
1089
                TARGET_GETGROUPS_T=gid_t
1090
                ;;
1091
  esac
1092
fi
1093
AC_SUBST(TARGET_GETGROUPS_T)
1094
 
1095
gcc_AC_FUNC_MMAP_BLACKLIST
1096
 
1097
case "${host}" in
1098
*-*-*vms*)
1099
  # Under VMS, vfork works very differently than on Unix. The standard test
1100
  # won't work, and it isn't easily adaptable. It makes more sense to
1101
  # just force it.
1102
  ac_cv_func_vfork_works=yes
1103
  ;;
1104
esac
1105
AC_FUNC_FORK
1106
 
1107
AM_ICONV
1108
# Until we have in-tree GNU iconv:
1109
LIBICONV_DEP=
1110
AC_SUBST(LIBICONV_DEP)
1111
 
1112
AM_LC_MESSAGES
1113
 
1114
AM_LANGINFO_CODESET
1115
 
1116
# We will need to find libiberty.h and ansidecl.h
1117
saved_CFLAGS="$CFLAGS"
1118
CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include"
1119
gcc_AC_CHECK_DECLS(getenv atol asprintf sbrk abort atof getcwd getwd \
1120
        strsignal strstr strverscmp \
1121
        errno snprintf vsnprintf vasprintf malloc realloc calloc \
1122
        free basename getopt clock getpagesize gcc_UNLOCKED_FUNCS, , ,[
1123
#include "ansidecl.h"
1124
#include "system.h"])
1125
 
1126
gcc_AC_CHECK_DECLS(getrlimit setrlimit getrusage, , ,[
1127
#include "ansidecl.h"
1128
#include "system.h"
1129
#ifdef HAVE_SYS_RESOURCE_H
1130
#include 
1131
#endif
1132
])
1133
 
1134
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1135
#include "ansidecl.h"
1136
#include "system.h"
1137
#ifdef HAVE_SYS_RESOURCE_H
1138
#include 
1139
#endif
1140
]], [[rlim_t l = 0;]])],[],[AC_DEFINE([rlim_t],[long],
1141
[Define to \`long' if  doesn't define.])])
1142
 
1143
# On AIX 5.2,  conflicts with , as both define incompatible
1144
# FREAD and FWRITE macros.  Fortunately, for GCC's single usage of ldgetname
1145
# in collect2.c,  isn't visible, but the configure test below needs
1146
# to undef these macros to get the correct value for HAVE_DECL_LDGETNAME.
1147
gcc_AC_CHECK_DECLS(ldgetname, , ,[
1148
#include "ansidecl.h"
1149
#include "system.h"
1150
#ifdef HAVE_LDFCN_H
1151
#undef FREAD
1152
#undef FWRITE
1153
#include 
1154
#endif
1155
])
1156
 
1157
gcc_AC_CHECK_DECLS(times, , ,[
1158
#include "ansidecl.h"
1159
#include "system.h"
1160
#ifdef HAVE_SYS_TIMES_H
1161
#include 
1162
#endif
1163
])
1164
 
1165
gcc_AC_CHECK_DECLS(sigaltstack, , ,[
1166
#include "ansidecl.h"
1167
#include "system.h"
1168
#include 
1169
])
1170
 
1171
# More time-related stuff.
1172
AC_CACHE_CHECK(for struct tms, ac_cv_struct_tms, [
1173
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1174
#include "ansidecl.h"
1175
#include "system.h"
1176
#ifdef HAVE_SYS_TIMES_H
1177
#include 
1178
#endif
1179
]], [[struct tms tms;]])],[ac_cv_struct_tms=yes],[ac_cv_struct_tms=no])])
1180
if test $ac_cv_struct_tms = yes; then
1181
  AC_DEFINE(HAVE_STRUCT_TMS, 1,
1182
  [Define if  defines struct tms.])
1183
fi
1184
 
1185
# use gcc_cv_* here because this doesn't match the behavior of AC_CHECK_TYPE.
1186
# revisit after autoconf 2.50.
1187
AC_CACHE_CHECK(for clock_t, gcc_cv_type_clock_t, [
1188
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1189
#include "ansidecl.h"
1190
#include "system.h"
1191
]], [[clock_t x;]])],[gcc_cv_type_clock_t=yes],[gcc_cv_type_clock_t=no])])
1192
if test $gcc_cv_type_clock_t = yes; then
1193
  AC_DEFINE(HAVE_CLOCK_T, 1,
1194
  [Define if  defines clock_t.])
1195
fi
1196
 
1197
# Restore CFLAGS from before the gcc_AC_NEED_DECLARATIONS tests.
1198
CFLAGS="$saved_CFLAGS"
1199
 
1200
gcc_AC_INITFINI_ARRAY
1201
 
1202
# mkdir takes a single argument on some systems.
1203
gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG
1204
 
1205
# File extensions
1206
manext='.1'
1207
objext='.o'
1208
AC_SUBST(manext)
1209
AC_SUBST(objext)
1210
 
1211
# With Setjmp/Longjmp based exception handling.
1212
AC_ARG_ENABLE(sjlj-exceptions,
1213
[  --enable-sjlj-exceptions
1214
                          arrange to use setjmp/longjmp exception handling],
1215
[sjlj=`if test $enableval = yes; then echo 1; else echo 0; fi`
1216
AC_DEFINE_UNQUOTED(CONFIG_SJLJ_EXCEPTIONS, $sjlj,
1217
  [Define 0/1 to force the choice for exception handling model.])])
1218
 
1219
# For platforms with the unwind ABI which includes an unwind library,
1220
# libunwind, we can choose to use the system libunwind.
1221
AC_ARG_WITH(system-libunwind,
1222
[  --with-system-libunwind use installed libunwind])
1223
 
1224
# config.gcc also contains tests of with_system_libunwind.
1225
if test x$with_system_libunwind = xyes; then
1226
        AC_DEFINE(HAVE_GETIPINFO, 1,
1227
[Define to 1 if system unwind library has _Unwind_GetIPInfo.])
1228
fi
1229
 
1230
# --------------------------------------------------------
1231
# Build, host, and target specific configuration fragments
1232
# --------------------------------------------------------
1233
 
1234
# Collect build-machine-specific information.
1235
. ${srcdir}/config.build
1236
 
1237
# Collect host-machine-specific information.
1238
. ${srcdir}/config.host
1239
 
1240
target_gtfiles=
1241
 
1242
# Collect target-machine-specific information.
1243
. ${srcdir}/config.gcc
1244
 
1245
extra_objs="${host_extra_objs} ${extra_objs}"
1246
extra_gcc_objs="${host_extra_gcc_objs} ${extra_gcc_objs}"
1247
 
1248
# Default the target-machine variables that were not explicitly set.
1249
if test x"$tm_file" = x
1250
then tm_file=$cpu_type/$cpu_type.h; fi
1251
 
1252
if test x"$extra_headers" = x
1253
then extra_headers=; fi
1254
 
1255
if test x$md_file = x
1256
then md_file=$cpu_type/$cpu_type.md; fi
1257
 
1258
if test x$out_file = x
1259
then out_file=$cpu_type/$cpu_type.c; fi
1260
 
1261
if test x"$tmake_file" = x
1262
then tmake_file=$cpu_type/t-$cpu_type
1263
fi
1264
 
1265
if test x"$dwarf2" = xyes
1266
then tm_file="$tm_file tm-dwarf2.h"
1267
fi
1268
 
1269
# Say what files are being used for the output code and MD file.
1270
echo "Using \`$srcdir/config/$out_file' for machine-specific logic."
1271
echo "Using \`$srcdir/config/$md_file' as machine description file."
1272
 
1273
# If any of the xm_file variables contain nonexistent files, warn
1274
# about them and drop them.
1275
 
1276
bx=
1277
for x in $build_xm_file; do
1278
  if    test -f $srcdir/config/$x
1279
  then      bx="$bx $x"
1280
  else      AC_MSG_WARN($srcdir/config/$x does not exist.)
1281
  fi
1282
done
1283
build_xm_file="$bx"
1284
 
1285
hx=
1286
for x in $host_xm_file; do
1287
  if    test -f $srcdir/config/$x
1288
  then      hx="$hx $x"
1289
  else      AC_MSG_WARN($srcdir/config/$x does not exist.)
1290
  fi
1291
done
1292
host_xm_file="$hx"
1293
 
1294
tx=
1295
for x in $xm_file; do
1296
  if    test -f $srcdir/config/$x
1297
  then      tx="$tx $x"
1298
  else      AC_MSG_WARN($srcdir/config/$x does not exist.)
1299
  fi
1300
done
1301
xm_file="$tx"
1302
 
1303
count=a
1304
for f in $tm_file; do
1305
        count=${count}x
1306
done
1307
if test $count = ax; then
1308
        echo "Using \`$srcdir/config/$tm_file' as target machine macro file."
1309
else
1310
        echo "Using the following target machine macro files:"
1311
        for f in $tm_file; do
1312
                echo "  $srcdir/config/$f"
1313
        done
1314
fi
1315
 
1316
if test x$need_64bit_hwint = xyes; then
1317
        AC_DEFINE(NEED_64BIT_HOST_WIDE_INT, 1,
1318
[Define to 1 if HOST_WIDE_INT must be 64 bits wide (see hwint.h).])
1319
fi
1320
 
1321
if test x$use_long_long_for_widest_fast_int = xyes; then
1322
        AC_DEFINE(USE_LONG_LONG_FOR_WIDEST_FAST_INT, 1,
1323
[Define to 1 if the 'long long' (or '__int64') is wider than 'long' but still
1324
efficiently supported by the host hardware.])
1325
fi
1326
 
1327
count=a
1328
for f in $host_xm_file; do
1329
        count=${count}x
1330
done
1331
if test $count = a; then
1332
        :
1333
elif test $count = ax; then
1334
        echo "Using \`$srcdir/config/$host_xm_file' as host machine macro file."
1335
else
1336
        echo "Using the following host machine macro files:"
1337
        for f in $host_xm_file; do
1338
                echo "  $srcdir/config/$f"
1339
        done
1340
fi
1341
echo "Using ${out_host_hook_obj} for host machine hooks."
1342
 
1343
if test "$host_xm_file" != "$build_xm_file"; then
1344
        count=a
1345
        for f in $build_xm_file; do
1346
                count=${count}x
1347
        done
1348
        if test $count = a; then
1349
                :
1350
        elif test $count = ax; then
1351
                echo "Using \`$srcdir/config/$build_xm_file' as build machine macro file."
1352
        else
1353
                echo "Using the following build machine macro files:"
1354
                for f in $build_xm_file; do
1355
                        echo "  $srcdir/config/$f"
1356
                done
1357
        fi
1358
fi
1359
 
1360
case ${host} in
1361
  powerpc*-*-darwin*)
1362
    AC_CACHE_CHECK([whether mcontext_t fields have underscores],
1363
      gcc_cv_mcontext_underscores,
1364
      AC_COMPILE_IFELSE([
1365
#include 
1366
#include 
1367
int main() { mcontext_t m; if (m->ss.srr0) return 0; return 0; }
1368
],
1369
        gcc_cv_mcontext_underscores=no, gcc_cv_mcontext_underscores=yes))
1370
      if test $gcc_cv_mcontext_underscores = yes; then
1371
        AC_DEFINE(HAS_MCONTEXT_T_UNDERSCORES,,dnl
1372
          [mcontext_t fields start with __])
1373
      fi
1374
    ;;
1375
esac
1376
 
1377
# ---------
1378
# Threading
1379
# ---------
1380
 
1381
# Check if a valid thread package
1382
case ${enable_threads} in
1383
  "" | no)
1384
    # No threads
1385
    target_thread_file='single'
1386
    ;;
1387
  yes)
1388
    # default
1389
    target_thread_file='single'
1390
    ;;
1391
  aix | dce | gnat | irix | posix | posix95 | rtems | \
1392
  single | solaris | vxworks | win32 )
1393
    target_thread_file=${enable_threads}
1394
    ;;
1395
  *)
1396
    echo "${enable_threads} is an unknown thread package" 1>&2
1397
    exit 1
1398
    ;;
1399
esac
1400
 
1401
if test x${thread_file} = x; then
1402
  # No thread file set by target-specific clauses in config.gcc,
1403
  # so use file chosen by default logic above
1404
  thread_file=${target_thread_file}
1405
fi
1406
 
1407
# Make gthr-default.h if we have a thread file.
1408
gthread_flags=
1409
if test $thread_file != single; then
1410
  rm -f gthr-default.h
1411
  echo "#include \"gthr-${thread_file}.h\"" > gthr-default.h
1412
  gthread_flags=-DHAVE_GTHR_DEFAULT
1413
fi
1414
AC_SUBST(gthread_flags)
1415
 
1416
# --------
1417
# UNSORTED
1418
# --------
1419
 
1420
use_cxa_atexit=no
1421
if test x$enable___cxa_atexit = xyes || \
1422
   test x$enable___cxa_atexit = x -a x$default_use_cxa_atexit = xyes; then
1423
  if test x$host = x$target; then
1424
    AC_CHECK_FUNC(__cxa_atexit,[use_cxa_atexit=yes],
1425
        [echo "__cxa_atexit can't be enabled on this target"])
1426
  else
1427
    # We can't check for __cxa_atexit when building a cross, so assume
1428
    # it is available
1429
    use_cxa_atexit=yes
1430
  fi
1431
  if test x$use_cxa_atexit = xyes; then
1432
    AC_DEFINE(DEFAULT_USE_CXA_ATEXIT, 2,
1433
      [Define if you want to use __cxa_atexit, rather than atexit, to
1434
      register C++ destructors for local statics and global objects.
1435
      This is essential for fully standards-compliant handling of
1436
      destructors, but requires __cxa_atexit in libc.])
1437
  fi
1438
fi
1439
 
1440
use_getipinfo=yes
1441
if test x$with_system_libunwind = xyes; then
1442
   if test x$host = x$target; then
1443
     AC_SEARCH_LIBS(_Unwind_GetIPInfo, unwind,, [use_getipinfo=no])
1444
   fi
1445
fi
1446
GCC_TARGET_TEMPLATE(HAVE_GETIPINFO)
1447
if test x$use_getipinfo = xyes; then
1448
   AC_DEFINE(HAVE_GETIPINFO, 1,
1449
        [Define to 1 if system unwind library has _Unwind_GetIPInfo.])
1450
else
1451
   echo "The system unwind library does not support _Unwind_GetIPInfo."
1452
fi
1453
 
1454
# Look for a file containing extra machine modes.
1455
if test -n "$extra_modes" && test -f $srcdir/config/$extra_modes; then
1456
  extra_modes_file='$(srcdir)'/config/${extra_modes}
1457
  AC_SUBST(extra_modes_file)
1458
  AC_DEFINE_UNQUOTED(EXTRA_MODES_FILE, "config/$extra_modes",
1459
  [Define to the name of a file containing a list of extra machine modes
1460
   for this architecture.])
1461
fi
1462
 
1463
# Convert extra_options into a form suitable for Makefile use.
1464
extra_opt_files=
1465
for f in $extra_options; do
1466
  extra_opt_files="$extra_opt_files \$(srcdir)/config/$f"
1467
done
1468
AC_SUBST(extra_opt_files)
1469
 
1470
# auto-host.h is the file containing items generated by autoconf and is
1471
# the first file included by config.h.
1472
# If host=build, it is correct to have bconfig include auto-host.h
1473
# as well.  If host!=build, we are in error and need to do more
1474
# work to find out the build config parameters.
1475
if test x$host = x$build
1476
then
1477
        build_auto=auto-host.h
1478
else
1479
        # We create a subdir, then run autoconf in the subdir.
1480
        # To prevent recursion we set host and build for the new
1481
        # invocation of configure to the build for this invocation
1482
        # of configure.
1483
        tempdir=build.$$
1484
        rm -rf $tempdir
1485
        mkdir $tempdir
1486
        cd $tempdir
1487
        case ${srcdir} in
1488
        /* | [A-Za-z]:[\\/]* ) realsrcdir=${srcdir};;
1489
        *) realsrcdir=../${srcdir};;
1490
        esac
1491
        saved_CFLAGS="${CFLAGS}"
1492
        CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
1493
        ${realsrcdir}/configure \
1494
                --enable-languages=${enable_languages-all} \
1495
                --target=$target_alias --host=$build_alias --build=$build_alias
1496
        CFLAGS="${saved_CFLAGS}"
1497
 
1498
        # We just finished tests for the build machine, so rename
1499
        # the file auto-build.h in the gcc directory.
1500
        mv auto-host.h ../auto-build.h
1501
        cd ..
1502
        rm -rf $tempdir
1503
        build_auto=auto-build.h
1504
fi
1505
AC_SUBST(build_subdir)
1506
 
1507
tm_file="${tm_file} defaults.h"
1508
tm_p_file="${tm_p_file} tm-preds.h"
1509
host_xm_file="auto-host.h ansidecl.h ${host_xm_file}"
1510
build_xm_file="${build_auto} ansidecl.h ${build_xm_file}"
1511
# We don't want ansidecl.h in target files, write code there in ISO/GNU C.
1512
# put this back in temporarily.
1513
xm_file="auto-host.h ansidecl.h ${xm_file}"
1514
 
1515
# --------
1516
# UNSORTED
1517
# --------
1518
 
1519
changequote(,)dnl
1520
# Compile in configure arguments.
1521
if test -f configargs.h ; then
1522
        # Being re-configured.
1523
        gcc_config_arguments=`grep configuration_arguments configargs.h | sed -e 's/.*"\([^"]*\)".*/\1/'`
1524
        gcc_config_arguments="$gcc_config_arguments : (reconfigured) $TOPLEVEL_CONFIGURE_ARGUMENTS"
1525
else
1526
        gcc_config_arguments="$TOPLEVEL_CONFIGURE_ARGUMENTS"
1527
fi
1528
 
1529
# Double all backslashes and backslash all quotes to turn
1530
# gcc_config_arguments into a C string.
1531
sed -e 's/\\/\\\\/g; s/"/\\"/g' <conftest.out
1532
$gcc_config_arguments
1533
EOF
1534
gcc_config_arguments_str=`cat conftest.out`
1535
rm -f conftest.out
1536
 
1537
cat > configargs.h <
1538
/* Generated automatically. */
1539
static const char configuration_arguments[] = "$gcc_config_arguments_str";
1540
static const char thread_model[] = "$thread_file";
1541
 
1542
static const struct {
1543
  const char *name, *value;
1544
} configure_default_options[] = $configure_default_options;
1545
EOF
1546
changequote([,])dnl
1547
 
1548
# Internationalization
1549
ZW_GNU_GETTEXT_SISTER_DIR
1550
 
1551
# If LIBINTL contains LIBICONV, then clear LIBICONV so we don't get
1552
# -liconv on the link line twice.
1553
case "$LIBINTL" in *$LIBICONV*)
1554
        LIBICONV= ;;
1555
esac
1556
 
1557
AC_ARG_ENABLE(secureplt,
1558
[  --enable-secureplt      enable -msecure-plt by default for PowerPC],
1559
[], [])
1560
 
1561
# Windows32 Registry support for specifying GCC installation paths.
1562
AC_ARG_ENABLE(win32-registry,
1563
[  --disable-win32-registry
1564
                          disable lookup of installation paths in the
1565
                          Registry on Windows hosts
1566
  --enable-win32-registry enable registry lookup (default)
1567
  --enable-win32-registry=KEY
1568
                          use KEY instead of GCC version as the last portion
1569
                          of the registry key],,)
1570
 
1571
case $host_os in
1572
  win32 | pe | cygwin* | mingw32* | uwin*)
1573
    if test "x$enable_win32_registry" != xno; then
1574
      AC_SEARCH_LIBS(RegOpenKeyExA, advapi32,, [enable_win32_registry=no])
1575
    fi
1576
 
1577
    if test "x$enable_win32_registry" != xno; then
1578
      AC_DEFINE(ENABLE_WIN32_REGISTRY, 1,
1579
  [Define to 1 if installation paths should be looked up in the Windows
1580
   Registry. Ignored on non-Windows hosts.])
1581
 
1582
      if test "x$enable_win32_registry" != xyes \
1583
         && test "x$enable_win32_registry" != x; then
1584
        AC_DEFINE_UNQUOTED(WIN32_REGISTRY_KEY, "$enable_win32_registry",
1585
  [Define to be the last component of the Windows registry key under which
1586
   to look for installation paths.  The full key used will be
1587
   HKEY_LOCAL_MACHINE/SOFTWARE/Free Software Foundation/{WIN32_REGISTRY_KEY}.
1588
   The default is the GCC version number.])
1589
      fi
1590
    fi
1591
  ;;
1592
esac
1593
 
1594
# Get an absolute path to the GCC top-level source directory
1595
holddir=`${PWDCMD-pwd}`
1596
cd $srcdir
1597
topdir=`${PWDCMD-pwd}`
1598
cd $holddir
1599
 
1600
# Conditionalize the makefile for this host machine.
1601
xmake_file=
1602
for f in ${host_xmake_file}
1603
do
1604
        if test -f ${srcdir}/config/$f
1605
        then
1606
                xmake_file="${xmake_file} \$(srcdir)/config/$f"
1607
        fi
1608
done
1609
 
1610
# Conditionalize the makefile for this target machine.
1611
tmake_file_=
1612
for f in ${tmake_file}
1613
do
1614
        if test -f ${srcdir}/config/$f
1615
        then
1616
                tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
1617
        fi
1618
done
1619
tmake_file="${tmake_file_}"
1620
 
1621
# If the host doesn't support symlinks, modify CC in
1622
# FLAGS_TO_PASS so CC="stage1/xgcc -Bstage1/" works.
1623
# Otherwise, we can use "CC=$(CC)".
1624
rm -f symtest.tem
1625
case "$LN_S" in
1626
        *-s*)
1627
                cc_set_by_configure="\$(CC)"
1628
                quoted_cc_set_by_configure="\$(CC)"
1629
                stage_prefix_set_by_configure="\$(STAGE_PREFIX)"
1630
                quoted_stage_prefix_set_by_configure="\$(STAGE_PREFIX)"
1631
                ;;
1632
        *)
1633
                cc_set_by_configure="\`case '\$(CC)' in stage*) echo '\$(CC)' | sed -e 's|stage|../stage|g';; *) echo '\$(CC)';; esac\`"
1634
                quoted_cc_set_by_configure="\\\`case '\\\$(CC)' in stage*) echo '\\\$(CC)' | sed -e 's|stage|../stage|g';; *) echo '\\\$(CC)';; esac\\\`"
1635
                stage_prefix_set_by_configure="\`case '\$(STAGE_PREFIX)' in stage*) echo '\$(STAGE_PREFIX)' | sed -e 's|stage|../stage|g';; *) echo '\$(STAGE_PREFIX)';; esac\`"
1636
                quoted_stage_prefix_set_by_configure="\\\`case '\\\$(STAGE_PREFIX)' in stage*) echo '\\\$(STAGE_PREFIX)' | sed -e 's|stage|../stage|g';; *) echo '\\\$(STAGE_PREFIX)';; esac\\\`"
1637
                ;;
1638
esac
1639
 
1640
# This is a terrible hack which will go away some day.
1641
host_cc_for_libada=${CC}
1642
AC_SUBST(host_cc_for_libada)
1643
 
1644
out_object_file=`basename $out_file .c`.o
1645
 
1646
tm_file_list="options.h"
1647
tm_include_list="options.h"
1648
for f in $tm_file; do
1649
  case $f in
1650
    defaults.h )
1651
       tm_file_list="${tm_file_list} \$(srcdir)/$f"
1652
       tm_include_list="${tm_include_list} $f"
1653
       ;;
1654
    * )
1655
       tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
1656
       tm_include_list="${tm_include_list} config/$f"
1657
       ;;
1658
  esac
1659
done
1660
 
1661
tm_p_file_list=
1662
tm_p_include_list=
1663
for f in $tm_p_file; do
1664
  case $f in
1665
    tm-preds.h )
1666
       tm_p_file_list="${tm_p_file_list} $f"
1667
       tm_p_include_list="${tm_p_include_list} $f"
1668
       ;;
1669
    * )
1670
       tm_p_file_list="${tm_p_file_list} \$(srcdir)/config/$f"
1671
       tm_p_include_list="${tm_p_include_list} config/$f"
1672
  esac
1673
done
1674
 
1675
xm_file_list=
1676
xm_include_list=
1677
for f in $xm_file; do
1678
  case $f in
1679
    ansidecl.h )
1680
       xm_file_list="${xm_file_list} \$(srcdir)/../include/$f"
1681
       xm_include_list="${xm_include_list} $f"
1682
       ;;
1683
    auto-host.h )
1684
       xm_file_list="${xm_file_list} $f"
1685
       xm_include_list="${xm_include_list} $f"
1686
       ;;
1687
    * )
1688
       xm_file_list="${xm_file_list} \$(srcdir)/config/$f"
1689
       xm_include_list="${xm_include_list} config/$f"
1690
       ;;
1691
  esac
1692
done
1693
 
1694
host_xm_file_list=
1695
host_xm_include_list=
1696
for f in $host_xm_file; do
1697
  case $f in
1698
    ansidecl.h )
1699
       host_xm_file_list="${host_xm_file_list} \$(srcdir)/../include/$f"
1700
       host_xm_include_list="${host_xm_include_list} $f"
1701
       ;;
1702
    auto-host.h )
1703
       host_xm_file_list="${host_xm_file_list} $f"
1704
       host_xm_include_list="${host_xm_include_list} $f"
1705
       ;;
1706
    * )
1707
       host_xm_file_list="${host_xm_file_list} \$(srcdir)/config/$f"
1708
       host_xm_include_list="${host_xm_include_list} config/$f"
1709
       ;;
1710
  esac
1711
done
1712
 
1713
build_xm_file_list=
1714
for f in $build_xm_file; do
1715
  case $f in
1716
    ansidecl.h )
1717
       build_xm_file_list="${build_xm_file_list} \$(srcdir)/../include/$f"
1718
       build_xm_include_list="${build_xm_include_list} $f"
1719
       ;;
1720
    auto-build.h | auto-host.h )
1721
       build_xm_file_list="${build_xm_file_list} $f"
1722
       build_xm_include_list="${build_xm_include_list} $f"
1723
       ;;
1724
    * )
1725
       build_xm_file_list="${build_xm_file_list} \$(srcdir)/config/$f"
1726
       build_xm_include_list="${build_xm_include_list} config/$f"
1727
       ;;
1728
  esac
1729
done
1730
 
1731
# Define macro CROSS_COMPILE in compilation if this is a cross-compiler.
1732
# Also use all.cross instead of all.internal and adjust SYSTEM_HEADER_DIR.
1733
CROSS=                                          AC_SUBST(CROSS)
1734
ALL=all.internal                                AC_SUBST(ALL)
1735
SYSTEM_HEADER_DIR='$(NATIVE_SYSTEM_HEADER_DIR)' AC_SUBST(SYSTEM_HEADER_DIR)
1736
 
1737
if test "x$with_build_sysroot" != x; then
1738
  build_system_header_dir=$with_build_sysroot'$(NATIVE_SYSTEM_HEADER_DIR)'
1739
else
1740
  # This value is used, even on a native system, because
1741
  # CROSS_SYSTEM_HEADER_DIR is just
1742
  # $(TARGET_SYSTEM_ROOT)$(NATIVE_SYSTEM_HEADER_DIR).
1743
  build_system_header_dir='$(CROSS_SYSTEM_HEADER_DIR)'
1744
fi
1745
 
1746
if test x$host != x$target
1747
then
1748
        CROSS="-DCROSS_COMPILE"
1749
        ALL=all.cross
1750
        SYSTEM_HEADER_DIR=$build_system_header_dir
1751
        case "$host","$target" in
1752
        # Darwin crosses can use the host system's libraries and headers,
1753
        # because of the fat library support.  Of course, it must be the
1754
        # same version of Darwin on both sides.  Allow the user to
1755
        # just say --target=foo-darwin without a version number to mean
1756
        # "the version on this system".
1757
            *-*-darwin*,*-*-darwin*)
1758
                hostos=`echo $host | sed 's/.*-darwin/darwin/'`
1759
                targetos=`echo $target | sed 's/.*-darwin/darwin/'`
1760
                if test $hostos = $targetos -o $targetos = darwin ; then
1761
                    CROSS=
1762
                    SYSTEM_HEADER_DIR='$(NATIVE_SYSTEM_HEADER_DIR)'
1763
                    with_headers=yes
1764
                fi
1765
                ;;
1766
 
1767
            i?86-*-*,x86_64-*-* \
1768
            | powerpc*-*-*,powerpc64*-*-*)
1769
                CROSS="$CROSS -DNATIVE_CROSS" ;;
1770
        esac
1771
elif test "x$TARGET_SYSTEM_ROOT" != x; then
1772
        SYSTEM_HEADER_DIR=$build_system_header_dir
1773
fi
1774
 
1775
# If this is a cross-compiler that does not
1776
# have its own set of headers then define
1777
# inhibit_libc
1778
 
1779
# If this is using newlib, without having the headers available now,
1780
# then define inhibit_libc in LIBGCC2_CFLAGS.
1781
# This prevents libgcc2 from containing any code which requires libc
1782
# support.
1783
inhibit_libc=false
1784
if { { test x$host != x$target && test "x$with_sysroot" = x ; } ||
1785
       test x$with_newlib = xyes ; } &&
1786
     { test "x$with_headers" = x || test "x$with_headers" = xno ; } ; then
1787
       inhibit_libc=true
1788
fi
1789
AC_SUBST(inhibit_libc)
1790
 
1791
# When building gcc with a cross-compiler, we need to adjust things so
1792
# that the generator programs are still built with the native compiler.
1793
# Also, we cannot run fixincludes or fix-header.
1794
 
1795
# These are the normal (build=host) settings:
1796
CC_FOR_BUILD='$(CC)'            AC_SUBST(CC_FOR_BUILD)
1797
BUILD_CFLAGS='$(ALL_CFLAGS)'    AC_SUBST(BUILD_CFLAGS)
1798
STMP_FIXINC=stmp-fixinc         AC_SUBST(STMP_FIXINC)
1799
 
1800
# Possibly disable fixproto, on a per-target basis.
1801
case ${use_fixproto} in
1802
  no)
1803
    STMP_FIXPROTO=
1804
    ;;
1805
  yes)
1806
    STMP_FIXPROTO=stmp-fixproto
1807
    ;;
1808
esac
1809
AC_SUBST(STMP_FIXPROTO)
1810
 
1811
# And these apply if build != host, or we are generating coverage data
1812
if test x$build != x$host || test "x$coverage_flags" != x
1813
then
1814
    BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)'
1815
 
1816
    if test "x$TARGET_SYSTEM_ROOT" = x; then
1817
        if test "x$STMP_FIXPROTO" != x; then
1818
          STMP_FIXPROTO=stmp-install-fixproto
1819
        fi
1820
    fi
1821
fi
1822
 
1823
# Expand extra_headers to include complete path.
1824
# This substitutes for lots of t-* files.
1825
extra_headers_list=
1826
# Prepend $(srcdir)/config/${cpu_type}/ to every entry in extra_headers.
1827
for file in ${extra_headers} ; do
1828
  extra_headers_list="${extra_headers_list} \$(srcdir)/config/${cpu_type}/${file}"
1829
done
1830
 
1831
# Define collect2 in Makefile.
1832
case $host_can_use_collect2 in
1833
  no) collect2= ;;
1834
  *) collect2='collect2$(exeext)' ;;
1835
esac
1836
AC_SUBST([collect2])
1837
 
1838
# Add a definition of USE_COLLECT2 if system wants one.
1839
case $use_collect2 in
1840
  no) use_collect2= ;;
1841
  "") ;;
1842
  *)
1843
    host_xm_defines="${host_xm_defines} USE_COLLECT2"
1844
    xm_defines="${xm_defines} USE_COLLECT2"
1845
    case $host_can_use_collect2 in
1846
      no)
1847
        AC_MSG_ERROR([collect2 is required but cannot be built on this system])
1848
        ;;
1849
    esac
1850
    ;;
1851
esac
1852
 
1853
# ---------------------------
1854
# Assembler & linker features
1855
# ---------------------------
1856
 
1857
# Identify the assembler which will work hand-in-glove with the newly
1858
# built GCC, so that we can examine its features.  This is the assembler
1859
# which will be driven by the driver program.
1860
#
1861
# If build != host, and we aren't building gas in-tree, we identify a
1862
# build->target assembler and hope that it will have the same features
1863
# as the host->target assembler we'll be using.
1864
gcc_cv_gas_major_version=
1865
gcc_cv_gas_minor_version=
1866
gcc_cv_as_gas_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/gas
1867
 
1868
m4_pattern_allow([AS_FOR_TARGET])dnl
1869
AS_VAR_SET_IF(gcc_cv_as,, [
1870
if test -x "$DEFAULT_ASSEMBLER"; then
1871
        gcc_cv_as="$DEFAULT_ASSEMBLER"
1872
elif test -f $gcc_cv_as_gas_srcdir/configure.in \
1873
     && test -f ../gas/Makefile \
1874
     && test x$build = x$host; then
1875
        gcc_cv_as=../gas/as-new$build_exeext
1876
elif test -x as$build_exeext; then
1877
        # Build using assembler in the current directory.
1878
        gcc_cv_as=./as$build_exeext
1879
elif test -x $AS_FOR_TARGET; then
1880
        gcc_cv_as="$AS_FOR_TARGET"
1881
else
1882
        AC_PATH_PROG(gcc_cv_as, $AS_FOR_TARGET)
1883
fi])
1884
 
1885
ORIGINAL_AS_FOR_TARGET=$gcc_cv_as
1886
AC_SUBST(ORIGINAL_AS_FOR_TARGET)
1887
 
1888
AC_MSG_CHECKING(what assembler to use)
1889
if test "$gcc_cv_as" = ../gas/as-new$build_exeext; then
1890
  # Single tree build which includes gas.  We want to prefer it
1891
  # over whatever linker top-level may have detected, since
1892
  # we'll use what we're building after installation anyway.
1893
  AC_MSG_RESULT(newly built gas)
1894
  in_tree_gas=yes
1895
  _gcc_COMPUTE_GAS_VERSION
1896
  in_tree_gas_is_elf=no
1897
  if grep 'obj_format = elf' ../gas/Makefile > /dev/null \
1898
     || (grep 'obj_format = multi' ../gas/Makefile \
1899
         && grep 'extra_objects =.* obj-elf' ../gas/Makefile) > /dev/null
1900
  then
1901
    in_tree_gas_is_elf=yes
1902
  fi
1903
else
1904
  AC_MSG_RESULT($gcc_cv_as)
1905
  in_tree_gas=no
1906
fi
1907
 
1908
# Identify the linker which will work hand-in-glove with the newly
1909
# built GCC, so that we can examine its features.  This is the linker
1910
# which will be driven by the driver program.
1911
#
1912
# If build != host, and we aren't building gas in-tree, we identify a
1913
# build->target linker and hope that it will have the same features
1914
# as the host->target linker we'll be using.
1915
gcc_cv_gld_major_version=
1916
gcc_cv_gld_minor_version=
1917
gcc_cv_ld_gld_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/ld
1918
gcc_cv_ld_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd
1919
 
1920
AS_VAR_SET_IF(gcc_cv_ld,, [
1921
if test -x "$DEFAULT_LINKER"; then
1922
        gcc_cv_ld="$DEFAULT_LINKER"
1923
elif test -f $gcc_cv_ld_gld_srcdir/configure.in \
1924
     && test -f ../ld/Makefile \
1925
     && test x$build = x$host; then
1926
        gcc_cv_ld=../ld/ld-new$build_exeext
1927
elif test -x collect-ld$build_exeext; then
1928
        # Build using linker in the current directory.
1929
        gcc_cv_ld=./collect-ld$build_exeext
1930
elif test -x $LD_FOR_TARGET; then
1931
        gcc_cv_ld="$LD_FOR_TARGET"
1932
else
1933
        AC_PATH_PROG(gcc_cv_ld, $LD_FOR_TARGET)
1934
fi])
1935
 
1936
ORIGINAL_LD_FOR_TARGET=$gcc_cv_ld
1937
AC_SUBST(ORIGINAL_LD_FOR_TARGET)
1938
 
1939
AC_MSG_CHECKING(what linker to use)
1940
if test "$gcc_cv_ld" = ../ld/ld-new$build_exeext; then
1941
        # Single tree build which includes ld.  We want to prefer it
1942
        # over whatever linker top-level may have detected, since
1943
        # we'll use what we're building after installation anyway.
1944
        AC_MSG_RESULT(newly built ld)
1945
        in_tree_ld=yes
1946
        in_tree_ld_is_elf=no
1947
        if (grep 'EMUL = .*elf' ../ld/Makefile \
1948
            || grep 'EMUL = .*linux' ../ld/Makefile \
1949
            || grep 'EMUL = .*lynx' ../ld/Makefile) > /dev/null; then
1950
          in_tree_ld_is_elf=yes
1951
        fi
1952
        for f in $gcc_cv_ld_bfd_srcdir/configure $gcc_cv_ld_gld_srcdir/configure $gcc_cv_ld_gld_srcdir/configure.in $gcc_cv_ld_gld_srcdir/Makefile.in
1953
        do
1954
changequote(,)dnl
1955
                gcc_cv_gld_version=`sed -n -e 's/^[     ]*\(VERSION=[0-9]*\.[0-9]*.*\)/\1/p' < $f`
1956
                if test x$gcc_cv_gld_version != x; then
1957
                        break
1958
                fi
1959
        done
1960
        gcc_cv_gld_major_version=`expr "$gcc_cv_gld_version" : "VERSION=\([0-9]*\)"`
1961
        gcc_cv_gld_minor_version=`expr "$gcc_cv_gld_version" : "VERSION=[0-9]*\.\([0-9]*\)"`
1962
changequote([,])dnl
1963
else
1964
        AC_MSG_RESULT($gcc_cv_ld)
1965
        in_tree_ld=no
1966
fi
1967
 
1968
# Figure out what nm we will be using.
1969
gcc_cv_binutils_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/binutils
1970
AS_VAR_SET_IF(gcc_cv_nm,, [
1971
if test -f $gcc_cv_binutils_srcdir/configure.in \
1972
     && test -f ../binutils/Makefile \
1973
     && test x$build = x$host; then
1974
        gcc_cv_nm=../binutils/nm-new$build_exeext
1975
elif test -x nm$build_exeext; then
1976
        gcc_cv_nm=./nm$build_exeext
1977
elif test -x $NM_FOR_TARGET; then
1978
        gcc_cv_nm="$NM_FOR_TARGET"
1979
else
1980
        AC_PATH_PROG(gcc_cv_nm, $NM_FOR_TARGET)
1981
fi])
1982
 
1983
AC_MSG_CHECKING(what nm to use)
1984
if test "$gcc_cv_nm" = ../binutils/nm-new$build_exeext; then
1985
        # Single tree build which includes binutils.
1986
        AC_MSG_RESULT(newly built nm)
1987
        in_tree_nm=yes
1988
else
1989
        AC_MSG_RESULT($gcc_cv_nm)
1990
        in_tree_nm=no
1991
fi
1992
 
1993
ORIGINAL_NM_FOR_TARGET=$gcc_cv_nm
1994
AC_SUBST(ORIGINAL_NM_FOR_TARGET)
1995
 
1996
# Figure out what objdump we will be using.
1997
AS_VAR_SET_IF(gcc_cv_objdump,, [
1998
if test -f $gcc_cv_binutils_srcdir/configure.in \
1999
     && test -f ../binutils/Makefile \
2000
     && test x$build = x$host; then
2001
        # Single tree build which includes binutils.
2002
        gcc_cv_objdump=../binutils/objdump$build_exeext
2003
elif test -x objdump$build_exeext; then
2004
        gcc_cv_objdump=./objdump$build_exeext
2005
elif test -x $OBJDUMP_FOR_TARGET; then
2006
        gcc_cv_objdump="$OBJDUMP_FOR_TARGET"
2007
else
2008
        AC_PATH_PROG(gcc_cv_objdump, $OBJDUMP_FOR_TARGET)
2009
fi])
2010
 
2011
AC_MSG_CHECKING(what objdump to use)
2012
if test "$gcc_cv_objdump" = ../binutils/objdump$build_exeext; then
2013
        # Single tree build which includes binutils.
2014
        AC_MSG_RESULT(newly built objdump)
2015
elif test x$gcc_cv_objdump = x; then
2016
        AC_MSG_RESULT(not found)
2017
else
2018
        AC_MSG_RESULT($gcc_cv_objdump)
2019
fi
2020
 
2021
# Figure out what assembler alignment features are present.
2022
gcc_GAS_CHECK_FEATURE([.balign and .p2align], gcc_cv_as_balign_and_p2align,
2023
 [2,6,0],,
2024
[.balign 4
2025
.p2align 2],,
2026
[AC_DEFINE(HAVE_GAS_BALIGN_AND_P2ALIGN, 1,
2027
  [Define if your assembler supports .balign and .p2align.])])
2028
 
2029
gcc_GAS_CHECK_FEATURE([.p2align with maximum skip], gcc_cv_as_max_skip_p2align,
2030
 [2,8,0],,
2031
 [.p2align 4,,7],,
2032
[AC_DEFINE(HAVE_GAS_MAX_SKIP_P2ALIGN, 1,
2033
  [Define if your assembler supports specifying the maximum number
2034
   of bytes to skip when using the GAS .p2align command.])])
2035
 
2036
gcc_GAS_CHECK_FEATURE([working .subsection -1], gcc_cv_as_subsection_m1,
2037
 [elf,2,9,0],,
2038
 [conftest_label1: .word 0
2039
.subsection -1
2040
conftest_label2: .word 0
2041
.previous],
2042
 [if test x$gcc_cv_nm != x; then
2043
    $gcc_cv_nm conftest.o | grep conftest_label1 > conftest.nm1
2044
    $gcc_cv_nm conftest.o | grep conftest_label2 | sed -e 's/label2/label1/' > conftest.nm2
2045
    if cmp conftest.nm1 conftest.nm2 > /dev/null 2>&1
2046
    then :
2047
    else gcc_cv_as_subsection_m1=yes
2048
    fi
2049
    rm -f conftest.nm1 conftest.nm2
2050
  fi],
2051
 [AC_DEFINE(HAVE_GAS_SUBSECTION_ORDERING, 1,
2052
  [Define if your assembler supports .subsection and .subsection -1 starts
2053
   emitting at the beginning of your section.])])
2054
 
2055
gcc_GAS_CHECK_FEATURE([.weak], gcc_cv_as_weak,
2056
 [2,2,0],,
2057
 [      .weak foobar],,
2058
[AC_DEFINE(HAVE_GAS_WEAK, 1, [Define if your assembler supports .weak.])])
2059
 
2060
gcc_GAS_CHECK_FEATURE([.weakref], gcc_cv_as_weakref,
2061
 [2,17,0],,
2062
 [      .weakref foobar, barfnot],,
2063
[AC_DEFINE(HAVE_GAS_WEAKREF, 1, [Define if your assembler supports .weakref.])])
2064
 
2065
gcc_GAS_CHECK_FEATURE([.nsubspa comdat], gcc_cv_as_nsubspa_comdat,
2066
 [2,15,91],,
2067
 [      .SPACE $TEXT$
2068
        .NSUBSPA $CODE$,COMDAT],,
2069
[AC_DEFINE(HAVE_GAS_NSUBSPA_COMDAT, 1, [Define if your assembler supports .nsubspa comdat option.])])
2070
 
2071
# .hidden needs to be supported in both the assembler and the linker,
2072
# because GNU LD versions before 2.12.1 have buggy support for STV_HIDDEN.
2073
# This is irritatingly difficult to feature test for; we have to check the
2074
# date string after the version number.  If we've got an in-tree
2075
# ld, we don't know its patchlevel version, so we set the baseline at 2.13
2076
# to be safe.
2077
# The gcc_GAS_CHECK_FEATURE call just sets a cache variable.
2078
gcc_GAS_CHECK_FEATURE([.hidden], gcc_cv_as_hidden,
2079
 [elf,2,13,0],,
2080
[       .hidden foobar
2081
foobar:])
2082
 
2083
AC_CACHE_CHECK(linker for .hidden support, gcc_cv_ld_hidden,
2084
[if test $in_tree_ld = yes ; then
2085
  gcc_cv_ld_hidden=no
2086
  if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 13 -o "$gcc_cv_gld_major_version" -gt 2 \
2087
     && test $in_tree_ld_is_elf = yes; then
2088
     gcc_cv_ld_hidden=yes
2089
  fi
2090
else
2091
  gcc_cv_ld_hidden=yes
2092
  ld_ver=`$gcc_cv_ld --version 2>/dev/null | sed 1q`
2093
  if echo "$ld_ver" | grep GNU > /dev/null; then
2094
changequote(,)dnl
2095
    ld_vers=`echo $ld_ver | sed -n \
2096
        -e 's,^.*[       ]\([0-9][0-9]*\.[0-9][0-9]*.*\)$,\1,p' \
2097
        -e 's,^.*[       ]\([0-9][0-9]*\.[0-9][0-9]*\)[  ].*$,\1,p' \
2098
        -e 's,^.*[       ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[     ].*$,\1,p' \
2099
        -e 's,^.*[       ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[       ].*$,\1,p' \
2100
        -e 's,^.*[       ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[   -].*$,\1,p'`
2101
    ld_date=`echo $ld_ver | sed -n 's,^.*\([2-9][0-9][0-9][0-9]\)[-]*\([01][0-9]\)[-]*\([0-3][0-9]\).*$,\1\2\3,p'`
2102
    ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
2103
    ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
2104
    ld_vers_patch=`expr "$ld_vers" : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
2105
    if test 0"$ld_date" -lt 20020404; then
2106
      if test -n "$ld_date"; then
2107
        # If there was date string, but was earlier than 2002-04-04, fail
2108
        gcc_cv_ld_hidden=no
2109
      elif test -z "$ld_vers"; then
2110
        # If there was no date string nor ld version number, something is wrong
2111
        gcc_cv_ld_hidden=no
2112
      else
2113
        test -z "$ld_vers_patch" && ld_vers_patch=0
2114
        if test "$ld_vers_major" -lt 2; then
2115
          gcc_cv_ld_hidden=no
2116
        elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 12; then
2117
          gcc_cv_ld_hidden="no"
2118
        elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -eq 12 -a "$ld_vers_patch" -eq 0; then
2119
          gcc_cv_ld_hidden=no
2120
        fi
2121
      fi
2122
changequote([,])dnl
2123
    fi
2124
  else
2125
    case "${target}" in
2126
      hppa64*-*-hpux* | ia64*-*-hpux*)
2127
        gcc_cv_ld_hidden=yes
2128
        ;;
2129
      *)
2130
        gcc_cv_ld_hidden=no
2131
        ;;
2132
    esac
2133
  fi
2134
fi])
2135
libgcc_visibility=no
2136
AC_SUBST(libgcc_visibility)
2137
GCC_TARGET_TEMPLATE([HAVE_GAS_HIDDEN])
2138
if test $gcc_cv_as_hidden = yes && test $gcc_cv_ld_hidden = yes; then
2139
  libgcc_visibility=yes
2140
  AC_DEFINE(HAVE_GAS_HIDDEN, 1,
2141
  [Define if your assembler and linker support .hidden.])
2142
fi
2143
 
2144
# Check if we have .[us]leb128, and support symbol arithmetic with it.
2145
gcc_GAS_CHECK_FEATURE([.sleb128 and .uleb128], gcc_cv_as_leb128,
2146
  [elf,2,11,0],,
2147
[       .data
2148
        .uleb128 L2 - L1
2149
L1:
2150
        .uleb128 1280
2151
        .sleb128 -1010
2152
L2:],
2153
 [# GAS versions before 2.11 do not support uleb128,
2154
  # despite appearing to.
2155
  # ??? There exists an elf-specific test that will crash
2156
  # the assembler.  Perhaps it's better to figure out whether
2157
  # arbitrary sections are supported and try the test.
2158
  as_ver=`$gcc_cv_as --version 2>/dev/null | sed 1q`
2159
  if echo "$as_ver" | grep GNU > /dev/null; then
2160
changequote(,)dnl
2161
    as_ver=`echo $as_ver | sed -e 's/GNU assembler \([0-9.][0-9.]*\).*/\1/'`
2162
    as_major=`echo $as_ver | sed 's/\..*//'`
2163
    as_minor=`echo $as_ver | sed 's/[^.]*\.\([0-9]*\).*/\1/'`
2164
changequote([,])dnl
2165
    if test $as_major -eq 2 && test $as_minor -lt 11
2166
    then :
2167
    else gcc_cv_as_leb128=yes
2168
    fi
2169
  fi],
2170
  [AC_DEFINE(HAVE_AS_LEB128, 1,
2171
    [Define if your assembler supports .sleb128 and .uleb128.])])
2172
 
2173
# GAS versions up to and including 2.11.0 may mis-optimize
2174
# .eh_frame data.
2175
gcc_GAS_CHECK_FEATURE(eh_frame optimization, gcc_cv_as_eh_frame,
2176
  [elf,2,12,0],,
2177
[       .text
2178
.LFB1:
2179
        .4byte  0
2180
.L1:
2181
        .4byte  0
2182
.LFE1:
2183
        .section        .eh_frame,"aw",@progbits
2184
__FRAME_BEGIN__:
2185
        .4byte  .LECIE1-.LSCIE1
2186
.LSCIE1:
2187
        .4byte  0x0
2188
        .byte   0x1
2189
        .ascii "z\0"
2190
        .byte   0x1
2191
        .byte   0x78
2192
        .byte   0x1a
2193
        .byte   0x0
2194
        .byte   0x4
2195
        .4byte  1
2196
        .p2align 1
2197
.LECIE1:
2198
.LSFDE1:
2199
        .4byte  .LEFDE1-.LASFDE1
2200
.LASFDE1:
2201
        .4byte  .LASFDE1-__FRAME_BEGIN__
2202
        .4byte  .LFB1
2203
        .4byte  .LFE1-.LFB1
2204
        .byte   0x4
2205
        .4byte  .LFE1-.LFB1
2206
        .byte   0x4
2207
        .4byte  .L1-.LFB1
2208
.LEFDE1:],
2209
[  dnl # For autoconf 2.5x, must protect trailing spaces with @&t@.
2210
cat > conftest.lit <
2211
 0000 10000000 00000000 017a0001 781a0004  .........z..x...
2212
 0010 01000000 12000000 18000000 00000000  ................
2213
 0020 08000000 04080000 0044               .........D      @&t@
2214
EOF
2215
cat > conftest.big <
2216
 0000 00000010 00000000 017a0001 781a0004  .........z..x...
2217
 0010 00000001 00000012 00000018 00000000  ................
2218
 0020 00000008 04000000 0844               .........D      @&t@
2219
EOF
2220
  # If the assembler didn't choke, and we can objdump,
2221
  # and we got the correct data, then succeed.
2222
  # The text in the here-document typically retains its unix-style line
2223
  # endings, while the output of objdump will use host line endings.
2224
  # Therefore, use diff -b for the comparisons.
2225
  if test x$gcc_cv_objdump != x \
2226
  && $gcc_cv_objdump -s -j .eh_frame conftest.o 2>/dev/null \
2227
     | tail -3 > conftest.got \
2228
  && { diff -b conftest.lit conftest.got > /dev/null 2>&1 \
2229
    || diff -b conftest.big conftest.got > /dev/null 2>&1; }
2230
  then
2231
    gcc_cv_as_eh_frame=yes
2232
  elif AC_TRY_COMMAND($gcc_cv_as -o conftest.o --traditional-format /dev/null); then
2233
    gcc_cv_as_eh_frame=buggy
2234
  else
2235
    # Uh oh, what do we do now?
2236
    gcc_cv_as_eh_frame=no
2237
  fi])
2238
 
2239
if test $gcc_cv_as_eh_frame = buggy; then
2240
  AC_DEFINE(USE_AS_TRADITIONAL_FORMAT, 1,
2241
  [Define if your assembler mis-optimizes .eh_frame data.])
2242
fi
2243
 
2244
gcc_GAS_CHECK_FEATURE(section merging support, gcc_cv_as_shf_merge,
2245
 [elf,2,12,0], [--fatal-warnings],
2246
 [.section .rodata.str, "aMS", @progbits, 1])
2247
if test $gcc_cv_as_shf_merge = no; then
2248
  gcc_GAS_CHECK_FEATURE(section merging support, gcc_cv_as_shf_merge,
2249
    [elf,2,12,0], [--fatal-warnings],
2250
    [.section .rodata.str, "aMS", %progbits, 1])
2251
fi
2252
AC_DEFINE_UNQUOTED(HAVE_GAS_SHF_MERGE,
2253
  [`if test $gcc_cv_as_shf_merge = yes; then echo 1; else echo 0; fi`],
2254
[Define 0/1 if your assembler supports marking sections with SHF_MERGE flag.])
2255
 
2256
gcc_GAS_CHECK_FEATURE(COMDAT group support, gcc_cv_as_comdat_group,
2257
 [elf,2,16,0], [--fatal-warnings],
2258
 [.section .text,"axG",@progbits,.foo,comdat])
2259
if test $gcc_cv_as_comdat_group = yes; then
2260
  gcc_cv_as_comdat_group_percent=no
2261
else
2262
 gcc_GAS_CHECK_FEATURE(COMDAT group support, gcc_cv_as_comdat_group_percent,
2263
   [elf,2,16,0], [--fatal-warnings],
2264
   [.section .text,"axG",%progbits,.foo,comdat])
2265
fi
2266
if test $in_tree_ld != yes && test x"$ld_vers" != x; then
2267
  comdat_group=yes
2268
  if test 0"$ld_date" -lt 20050308; then
2269
    if test -n "$ld_date"; then
2270
      # If there was date string, but was earlier than 2005-03-08, fail
2271
      comdat_group=no
2272
    elif test "$ld_vers_major" -lt 2; then
2273
      comdat_group=no
2274
    elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 16; then
2275
      comdat_group=no
2276
    fi
2277
  fi
2278
else
2279
  # assume linkers other than GNU ld don't support COMDAT group
2280
  comdat_group=no
2281
fi
2282
if test $comdat_group = no; then
2283
  gcc_cv_as_comdat_group=no
2284
  gcc_cv_as_comdat_group_percent=no
2285
fi
2286
AC_DEFINE_UNQUOTED(HAVE_COMDAT_GROUP,
2287
  [`if test $gcc_cv_as_comdat_group = yes || test $gcc_cv_as_comdat_group_percent = yes; then echo 1; else echo 0; fi`],
2288
[Define 0/1 if your assembler and linker support COMDAT groups.])
2289
 
2290
# Thread-local storage - the check is heavily parametrized.
2291
conftest_s=
2292
tls_first_major=
2293
tls_first_minor=
2294
tls_as_opt=
2295
case "$target" in
2296
changequote(,)dnl
2297
  alpha*-*-*)
2298
    conftest_s='
2299
        .section ".tdata","awT",@progbits
2300
foo:    .long   25
2301
        .text
2302
        ldq     $27,__tls_get_addr($29)         !literal!1
2303
        lda     $16,foo($29)                    !tlsgd!1
2304
        jsr     $26,($27),__tls_get_addr        !lituse_tlsgd!1
2305
        ldq     $27,__tls_get_addr($29)         !literal!2
2306
        lda     $16,foo($29)                    !tlsldm!2
2307
        jsr     $26,($27),__tls_get_addr        !lituse_tlsldm!2
2308
        ldq     $1,foo($29)                     !gotdtprel
2309
        ldah    $2,foo($29)                     !dtprelhi
2310
        lda     $3,foo($2)                      !dtprello
2311
        lda     $4,foo($29)                     !dtprel
2312
        ldq     $1,foo($29)                     !gottprel
2313
        ldah    $2,foo($29)                     !tprelhi
2314
        lda     $3,foo($2)                      !tprello
2315
        lda     $4,foo($29)                     !tprel'
2316
        tls_first_major=2
2317
        tls_first_minor=13
2318
        tls_as_opt=--fatal-warnings
2319
        ;;
2320
  frv*-*-*)
2321
    conftest_s='
2322
        .section ".tdata","awT",@progbits
2323
x:      .long   25
2324
        .text
2325
        call    #gettlsoff(x)'
2326
        tls_first_major=2
2327
        tls_first_minor=14
2328
        ;;
2329
  hppa*-*-linux*)
2330
    conftest_s='
2331
t1:     .reg    %r20
2332
t2:     .reg    %r21
2333
gp:     .reg    %r19
2334
        .section ".tdata","awT",@progbits
2335
foo:    .long   25
2336
        .text
2337
        .align  4
2338
        addil LT%foo-$tls_gdidx$,gp
2339
        ldo RT%foo-$tls_gdidx$(%r1),%arg0
2340
        b __tls_get_addr
2341
        nop
2342
        addil LT%foo-$tls_ldidx$,gp
2343
        b __tls_get_addr
2344
        ldo RT%foo-$tls_ldidx$(%r1),%arg0
2345
        addil LR%foo-$tls_dtpoff$,%ret0
2346
        ldo RR%foo-$tls_dtpoff$(%r1),%t1
2347
        mfctl %cr27,%t1
2348
        addil LT%foo-$tls_ieoff$,gp
2349
        ldw RT%foo-$tls_ieoff$(%r1),%t2
2350
        add %t1,%t2,%t3
2351
        mfctl %cr27,%t1
2352
        addil LR%foo-$tls_leoff$,%t1
2353
        ldo RR%foo-$tls_leoff$(%r1),%t2'
2354
        tls_first_major=2
2355
        tls_first_minor=15
2356
        tls_as_opt=--fatal-warnings
2357
        ;;
2358
  arm*-*-*)
2359
    conftest_s='
2360
        .section ".tdata","awT",%progbits
2361
foo:    .long   25
2362
        .text
2363
.word foo(gottpoff)
2364
.word foo(tpoff)
2365
.word foo(tlsgd)
2366
.word foo(tlsldm)
2367
.word foo(tlsldo)'
2368
        tls_first_major=2
2369
        tls_first_minor=17
2370
        ;;
2371
  i[34567]86-*-*)
2372
    conftest_s='
2373
        .section ".tdata","awT",@progbits
2374
foo:    .long   25
2375
        .text
2376
        movl    %gs:0, %eax
2377
        leal    foo@TLSGD(,%ebx,1), %eax
2378
        leal    foo@TLSLDM(%ebx), %eax
2379
        leal    foo@DTPOFF(%eax), %edx
2380
        movl    foo@GOTTPOFF(%ebx), %eax
2381
        subl    foo@GOTTPOFF(%ebx), %eax
2382
        addl    foo@GOTNTPOFF(%ebx), %eax
2383
        movl    foo@INDNTPOFF, %eax
2384
        movl    $foo@TPOFF, %eax
2385
        subl    $foo@TPOFF, %eax
2386
        leal    foo@NTPOFF(%ecx), %eax'
2387
        tls_first_major=2
2388
        tls_first_minor=14
2389
        tls_as_opt=--fatal-warnings
2390
        ;;
2391
  x86_64-*-*)
2392
    conftest_s='
2393
        .section ".tdata","awT",@progbits
2394
foo:    .long   25
2395
        .text
2396
        movq    %fs:0, %rax
2397
        leaq    foo@TLSGD(%rip), %rdi
2398
        leaq    foo@TLSLD(%rip), %rdi
2399
        leaq    foo@DTPOFF(%rax), %rdx
2400
        movq    foo@GOTTPOFF(%rip), %rax
2401
        movq    $foo@TPOFF, %rax'
2402
        tls_first_major=2
2403
        tls_first_minor=14
2404
        tls_as_opt=--fatal-warnings
2405
        ;;
2406
  ia64-*-*)
2407
    conftest_s='
2408
        .section ".tdata","awT",@progbits
2409
foo:    data8   25
2410
        .text
2411
        addl    r16 = @ltoff(@dtpmod(foo#)), gp
2412
        addl    r17 = @ltoff(@dtprel(foo#)), gp
2413
        addl    r18 = @ltoff(@tprel(foo#)), gp
2414
        addl    r19 = @dtprel(foo#), gp
2415
        adds    r21 = @dtprel(foo#), r13
2416
        movl    r23 = @dtprel(foo#)
2417
        addl    r20 = @tprel(foo#), gp
2418
        adds    r22 = @tprel(foo#), r13
2419
        movl    r24 = @tprel(foo#)'
2420
        tls_first_major=2
2421
        tls_first_minor=13
2422
        tls_as_opt=--fatal-warnings
2423
        ;;
2424
  mips*-*-*)
2425
    conftest_s='
2426
        .section .tdata,"awT",@progbits
2427
x:
2428
        .word 2
2429
        .text
2430
        addiu $4, $28, %tlsgd(x)
2431
        addiu $4, $28, %tlsldm(x)
2432
        lui $4, %dtprel_hi(x)
2433
        addiu $4, $4, %dtprel_lo(x)
2434
        lw $4, %gottprel(x)($28)
2435
        lui $4, %tprel_hi(x)
2436
        addiu $4, $4, %tprel_lo(x)'
2437
        tls_first_major=2
2438
        tls_first_minor=16
2439
        tls_as_opt='-32 --fatal-warnings'
2440
        ;;
2441
  powerpc-*-*)
2442
    conftest_s='
2443
        .section ".tdata","awT",@progbits
2444
        .align 2
2445
ld0:    .space 4
2446
ld1:    .space 4
2447
x1:     .space 4
2448
x2:     .space 4
2449
x3:     .space 4
2450
        .text
2451
        addi 3,31,ld0@got@tlsgd
2452
        bl __tls_get_addr
2453
        addi 3,31,x1@got@tlsld
2454
        bl __tls_get_addr
2455
        addi 9,3,x1@dtprel
2456
        addis 9,3,x2@dtprel@ha
2457
        addi 9,9,x2@dtprel@l
2458
        lwz 9,x3@got@tprel(31)
2459
        add 9,9,x@tls
2460
        addi 9,2,x1@tprel
2461
        addis 9,2,x2@tprel@ha
2462
        addi 9,9,x2@tprel@l'
2463
        tls_first_major=2
2464
        tls_first_minor=14
2465
        tls_as_opt="-a32 --fatal-warnings"
2466
        ;;
2467
  powerpc64-*-*)
2468
    conftest_s='
2469
        .section ".tdata","awT",@progbits
2470
        .align 3
2471
ld0:    .space 8
2472
ld1:    .space 8
2473
x1:     .space 8
2474
x2:     .space 8
2475
x3:     .space 8
2476
        .text
2477
        addi 3,2,ld0@got@tlsgd
2478
        bl .__tls_get_addr
2479
        nop
2480
        addi 3,2,ld1@toc
2481
        bl .__tls_get_addr
2482
        nop
2483
        addi 3,2,x1@got@tlsld
2484
        bl .__tls_get_addr
2485
        nop
2486
        addi 9,3,x1@dtprel
2487
        bl .__tls_get_addr
2488
        nop
2489
        addis 9,3,x2@dtprel@ha
2490
        addi 9,9,x2@dtprel@l
2491
        bl .__tls_get_addr
2492
        nop
2493
        ld 9,x3@got@dtprel(2)
2494
        add 9,9,3
2495
        bl .__tls_get_addr
2496
        nop'
2497
        tls_first_major=2
2498
        tls_first_minor=14
2499
        tls_as_opt="-a64 --fatal-warnings"
2500
        ;;
2501
  s390-*-*)
2502
    conftest_s='
2503
        .section ".tdata","awT",@progbits
2504
foo:    .long   25
2505
        .text
2506
        .long   foo@TLSGD
2507
        .long   foo@TLSLDM
2508
        .long   foo@DTPOFF
2509
        .long   foo@NTPOFF
2510
        .long   foo@GOTNTPOFF
2511
        .long   foo@INDNTPOFF
2512
        l       %r1,foo@GOTNTPOFF(%r12)
2513
        l       %r1,0(%r1):tls_load:foo
2514
        bas     %r14,0(%r1,%r13):tls_gdcall:foo
2515
        bas     %r14,0(%r1,%r13):tls_ldcall:foo'
2516
        tls_first_major=2
2517
        tls_first_minor=14
2518
        tls_as_opt="-m31 --fatal-warnings"
2519
        ;;
2520
  s390x-*-*)
2521
    conftest_s='
2522
        .section ".tdata","awT",@progbits
2523
foo:    .long   25
2524
        .text
2525
        .quad   foo@TLSGD
2526
        .quad   foo@TLSLDM
2527
        .quad   foo@DTPOFF
2528
        .quad   foo@NTPOFF
2529
        .quad   foo@GOTNTPOFF
2530
        lg      %r1,foo@GOTNTPOFF(%r12)
2531
        larl    %r1,foo@INDNTPOFF
2532
        brasl   %r14,__tls_get_offset@PLT:tls_gdcall:foo
2533
        brasl   %r14,__tls_get_offset@PLT:tls_ldcall:foo'
2534
        tls_first_major=2
2535
        tls_first_minor=14
2536
        tls_as_opt="-m64 -Aesame --fatal-warnings"
2537
        ;;
2538
  sh-*-* | sh[34]-*-*)
2539
    conftest_s='
2540
        .section ".tdata","awT",@progbits
2541
foo:    .long   25
2542
        .text
2543
        .long   foo@TLSGD
2544
        .long   foo@TLSLDM
2545
        .long   foo@DTPOFF
2546
        .long   foo@GOTTPOFF
2547
        .long   foo@TPOFF'
2548
        tls_first_major=2
2549
        tls_first_minor=13
2550
        tls_as_opt=--fatal-warnings
2551
        ;;
2552
  sparc*-*-*)
2553
    case "$target" in
2554
      sparc*-sun-solaris2.[56789]*)
2555
        # TLS was introduced in the Solaris 9 4/04 release but
2556
        # we do not enable it by default on Solaris 9 either.
2557
        if test "x$enable_tls" = xyes ; then
2558
          on_solaris=yes
2559
        else
2560
          enable_tls=no;
2561
        fi
2562
        ;;
2563
      sparc*-sun-solaris2.*)
2564
        on_solaris=yes
2565
        ;;
2566
      *)
2567
        on_solaris=no
2568
        ;;
2569
    esac
2570
    if test x$on_solaris = xyes && test x$gas_flag = xno; then
2571
      conftest_s='
2572
        .section ".tdata",#alloc,#write,#tls
2573
foo:    .long   25
2574
        .text
2575
        sethi   %tgd_hi22(foo), %o0
2576
        add     %o0, %tgd_lo10(foo), %o1
2577
        add     %l7, %o1, %o0, %tgd_add(foo)
2578
        call    __tls_get_addr, %tgd_call(foo)
2579
        sethi   %tldm_hi22(foo), %l1
2580
        add     %l1, %tldm_lo10(foo), %l2
2581
        add     %l7, %l2, %o0, %tldm_add(foo)
2582
        call    __tls_get_addr, %tldm_call(foo)
2583
        sethi   %tldo_hix22(foo), %l3
2584
        xor     %l3, %tldo_lox10(foo), %l4
2585
        add     %o0, %l4, %l5, %tldo_add(foo)
2586
        sethi   %tie_hi22(foo), %o3
2587
        add     %o3, %tie_lo10(foo), %o3
2588
        ld      [%l7 + %o3], %o2, %tie_ld(foo)
2589
        add     %g7, %o2, %o4, %tie_add(foo)
2590
        sethi   %tle_hix22(foo), %l1
2591
        xor     %l1, %tle_lox10(foo), %o5
2592
        ld      [%g7 + %o5], %o1'
2593
        tls_first_major=0
2594
        tls_first_minor=0
2595
    else
2596
      conftest_s='
2597
        .section ".tdata","awT",@progbits
2598
foo:    .long   25
2599
        .text
2600
        sethi   %tgd_hi22(foo), %o0
2601
        add     %o0, %tgd_lo10(foo), %o1
2602
        add     %l7, %o1, %o0, %tgd_add(foo)
2603
        call    __tls_get_addr, %tgd_call(foo)
2604
        sethi   %tldm_hi22(foo), %l1
2605
        add     %l1, %tldm_lo10(foo), %l2
2606
        add     %l7, %l2, %o0, %tldm_add(foo)
2607
        call    __tls_get_addr, %tldm_call(foo)
2608
        sethi   %tldo_hix22(foo), %l3
2609
        xor     %l3, %tldo_lox10(foo), %l4
2610
        add     %o0, %l4, %l5, %tldo_add(foo)
2611
        sethi   %tie_hi22(foo), %o3
2612
        add     %o3, %tie_lo10(foo), %o3
2613
        ld      [%l7 + %o3], %o2, %tie_ld(foo)
2614
        add     %g7, %o2, %o4, %tie_add(foo)
2615
        sethi   %tle_hix22(foo), %l1
2616
        xor     %l1, %tle_lox10(foo), %o5
2617
        ld      [%g7 + %o5], %o1'
2618
        tls_first_major=2
2619
        tls_first_minor=14
2620
        tls_as_opt="-32 --fatal-warnings"
2621
      fi
2622
        ;;
2623
changequote([,])dnl
2624
esac
2625
set_have_as_tls=no
2626
if test "x$enable_tls" = xno ; then
2627
  : # TLS explicitly disabled.
2628
elif test "x$enable_tls" = xyes ; then
2629
  set_have_as_tls=yes # TLS explicitly enabled.
2630
elif test -z "$tls_first_major"; then
2631
  : # If we don't have a check, assume no support.
2632
else
2633
  gcc_GAS_CHECK_FEATURE(thread-local storage support, gcc_cv_as_tls,
2634
  [$tls_first_major,$tls_first_minor,0], [$tls_as_opt], [$conftest_s],,
2635
  [set_have_as_tls=yes])
2636
fi
2637
if test $set_have_as_tls = yes ; then
2638
  AC_DEFINE(HAVE_AS_TLS, 1,
2639
            [Define if your assembler supports thread-local storage.])
2640
fi
2641
 
2642
# Target-specific assembler checks.
2643
 
2644
AC_MSG_CHECKING(linker -Bstatic/-Bdynamic option)
2645
gcc_cv_ld_static_dynamic=no
2646
if test $in_tree_ld = yes ; then
2647
  if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 10; then
2648
    gcc_cv_ld_static_dynamic=yes
2649
  fi
2650
elif test x$gcc_cv_ld != x; then
2651
        # Check if linker supports -Bstatic/-Bdynamic option
2652
        if $gcc_cv_ld --help 2>/dev/null | grep -- -Bstatic > /dev/null \
2653
          && $gcc_cv_ld --help 2>/dev/null | grep -- -Bdynamic > /dev/null; then
2654
                gcc_cv_ld_static_dynamic=yes
2655
        fi
2656
fi
2657
if test x"$gcc_cv_ld_static_dynamic" = xyes; then
2658
        AC_DEFINE(HAVE_LD_STATIC_DYNAMIC, 1,
2659
[Define if your linker supports -Bstatic/-Bdynamic option.])
2660
fi
2661
AC_MSG_RESULT($gcc_cv_ld_static_dynamic)
2662
 
2663
if test x"$demangler_in_ld" = xyes; then
2664
  AC_MSG_CHECKING(linker --demangle support)
2665
  gcc_cv_ld_demangle=no
2666
  if test $in_tree_ld = yes; then
2667
    if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 14 -o "$gcc_cv_gld_major_version" -gt 2; then \
2668
      gcc_cv_ld_demangle=yes
2669
    fi
2670
  elif test x$gcc_cv_ld != x -a x"$gnu_ld" = xyes; then
2671
    # Check if the GNU linker supports --demangle option
2672
    if $gcc_cv_ld --help 2>/dev/null | grep no-demangle > /dev/null; then
2673
      gcc_cv_ld_demangle=yes
2674
    fi
2675
  fi
2676
  if test x"$gcc_cv_ld_demangle" = xyes; then
2677
    AC_DEFINE(HAVE_LD_DEMANGLE, 1,
2678
[Define if your linker supports --demangle option.])
2679
  fi
2680
  AC_MSG_RESULT($gcc_cv_ld_demangle)
2681
fi
2682
 
2683
case "$target" in
2684
  # All TARGET_ABI_OSF targets.
2685
  alpha*-*-osf* | alpha*-*-linux* | alpha*-*-*bsd*)
2686
    gcc_GAS_CHECK_FEATURE([explicit relocation support],
2687
        gcc_cv_as_alpha_explicit_relocs, [2,12,0],,
2688
[       .set nomacro
2689
        .text
2690
        extbl   $3, $2, $3      !lituse_bytoff!1
2691
        ldq     $2, a($29)      !literal!1
2692
        ldq     $4, b($29)      !literal!2
2693
        ldq_u   $3, 0($2)       !lituse_base!1
2694
        ldq     $27, f($29)     !literal!5
2695
        jsr     $26, ($27), f   !lituse_jsr!5
2696
        ldah    $29, 0($26)     !gpdisp!3
2697
        lda     $0, c($29)      !gprel
2698
        ldah    $1, d($29)      !gprelhigh
2699
        lda     $1, d($1)       !gprellow
2700
        lda     $29, 0($29)     !gpdisp!3],,
2701
    [AC_DEFINE(HAVE_AS_EXPLICIT_RELOCS, 1,
2702
  [Define if your assembler supports explicit relocations.])])
2703
    gcc_GAS_CHECK_FEATURE([jsrdirect relocation support],
2704
        gcc_cv_as_alpha_jsrdirect_relocs, [2,16,90],,
2705
[       .set nomacro
2706
        .text
2707
        ldq     $27, a($29)     !literal!1
2708
        jsr     $26, ($27), a   !lituse_jsrdirect!1],,
2709
    [AC_DEFINE(HAVE_AS_JSRDIRECT_RELOCS, 1,
2710
  [Define if your assembler supports the lituse_jsrdirect relocation.])])
2711
    ;;
2712
 
2713
  cris-*-*)
2714
    gcc_GAS_CHECK_FEATURE([-no-mul-bug-abort option],
2715
      gcc_cv_as_cris_no_mul_bug,[2,15,91],
2716
      [-no-mul-bug-abort], [.text],,
2717
      [AC_DEFINE(HAVE_AS_NO_MUL_BUG_ABORT_OPTION, 1,
2718
                [Define if your assembler supports the -no-mul-bug-abort option.])])
2719
    ;;
2720
 
2721
  sparc*-*-*)
2722
    gcc_GAS_CHECK_FEATURE([.register], gcc_cv_as_sparc_register_op,,,
2723
      [.register %g2, #scratch],,
2724
      [AC_DEFINE(HAVE_AS_REGISTER_PSEUDO_OP, 1,
2725
                [Define if your assembler supports .register.])])
2726
 
2727
    gcc_GAS_CHECK_FEATURE([-relax option], gcc_cv_as_sparc_relax,,
2728
      [-relax], [.text],,
2729
      [AC_DEFINE(HAVE_AS_RELAX_OPTION, 1,
2730
                [Define if your assembler supports -relax option.])])
2731
 
2732
    gcc_GAS_CHECK_FEATURE([unaligned pcrel relocs],
2733
      gcc_cv_as_sparc_ua_pcrel,,
2734
      [-K PIC],
2735
[.text
2736
foo:
2737
        nop
2738
.data
2739
.align 4
2740
.byte 0
2741
.uaword %r_disp32(foo)],
2742
      [if test x$gcc_cv_ld != x \
2743
       && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1; then
2744
         gcc_cv_as_sparc_ua_pcrel=yes
2745
       fi
2746
       rm -f conftest],
2747
      [AC_DEFINE(HAVE_AS_SPARC_UA_PCREL, 1,
2748
                [Define if your assembler and linker support unaligned PC relative relocs.])
2749
 
2750
      gcc_GAS_CHECK_FEATURE([unaligned pcrel relocs against hidden symbols],
2751
        gcc_cv_as_sparc_ua_pcrel_hidden,,
2752
        [-K PIC],
2753
[.data
2754
.align 4
2755
.byte 0x31
2756
.uaword %r_disp32(foo)
2757
.byte 0x32, 0x33, 0x34
2758
.global foo
2759
.hidden foo
2760
foo:
2761
.skip 4],
2762
        [if test x$gcc_cv_ld != x && test x$gcc_cv_objdump != x \
2763
         && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1 \
2764
         && $gcc_cv_objdump -s -j .data conftest 2> /dev/null \
2765
            | grep ' 31000000 07323334' > /dev/null 2>&1; then
2766
            if $gcc_cv_objdump -R conftest 2> /dev/null \
2767
               | grep 'DISP32' > /dev/null 2>&1; then
2768
                :
2769
            else
2770
                gcc_cv_as_sparc_ua_pcrel_hidden=yes
2771
            fi
2772
         fi
2773
         rm -f conftest],
2774
         [AC_DEFINE(HAVE_AS_SPARC_UA_PCREL_HIDDEN, 1,
2775
                   [Define if your assembler and linker support unaligned PC relative relocs against hidden symbols.])])
2776
    ]) # unaligned pcrel relocs
2777
 
2778
    gcc_GAS_CHECK_FEATURE([offsetable %lo()],
2779
      gcc_cv_as_sparc_offsetable_lo10,,
2780
      [-xarch=v9],
2781
[.text
2782
        or %g1, %lo(ab) + 12, %g1
2783
        or %g1, %lo(ab + 12), %g1],
2784
      [if test x$gcc_cv_objdump != x \
2785
       && $gcc_cv_objdump -s -j .text conftest.o 2> /dev/null \
2786
          | grep ' 82106000 82106000' > /dev/null 2>&1; then
2787
         gcc_cv_as_sparc_offsetable_lo10=yes
2788
       fi],
2789
       [AC_DEFINE(HAVE_AS_OFFSETABLE_LO10, 1,
2790
                 [Define if your assembler supports offsetable %lo().])])
2791
    ;;
2792
 
2793
changequote(,)dnl
2794
  i[34567]86-*-* | x86_64-*-*)
2795
changequote([,])dnl
2796
    case $target_os in
2797
      cygwin* | pe | mingw32*)
2798
        # Used for DWARF 2 in PE
2799
        gcc_GAS_CHECK_FEATURE([.secrel32 relocs],
2800
          gcc_cv_as_ix86_pe_secrel32,
2801
          [2,15,91],,
2802
[.text
2803
foo:    nop
2804
.data
2805
        .secrel32 foo],
2806
          [if test x$gcc_cv_ld != x \
2807
           && $gcc_cv_ld -o conftest conftest.o > /dev/null 2>&1; then
2808
             gcc_cv_as_ix86_pe_secrel32=yes
2809
           fi
2810
           rm -f conftest],
2811
          [AC_DEFINE(HAVE_GAS_PE_SECREL32_RELOC, 1,
2812
            [Define if your assembler and linker support 32-bit section relative relocs via '.secrel32 label'.])])
2813
        ;;
2814
    esac
2815
 
2816
    gcc_GAS_CHECK_FEATURE([filds and fists mnemonics],
2817
       gcc_cv_as_ix86_filds_fists,
2818
      [2,9,0],, [filds mem; fists mem],,
2819
      [AC_DEFINE(HAVE_GAS_FILDS_FISTS, 1,
2820
        [Define if your assembler uses the new HImode fild and fist notation.])])
2821
 
2822
    gcc_GAS_CHECK_FEATURE([cmov syntax],
2823
      gcc_cv_as_ix86_cmov_sun_syntax,,,
2824
      [cmovl.l %edx, %eax],,
2825
      [AC_DEFINE(HAVE_AS_IX86_CMOV_SUN_SYNTAX, 1,
2826
        [Define if your assembler supports the Sun syntax for cmov.])])
2827
 
2828
    gcc_GAS_CHECK_FEATURE([ffreep mnemonic],
2829
      gcc_cv_as_ix86_ffreep,,,
2830
      [ffreep %st(1)],,
2831
      [AC_DEFINE(HAVE_AS_IX86_FFREEP, 1,
2832
        [Define if your assembler supports the ffreep mnemonic.])])
2833
 
2834
    # This one is used unconditionally by i386.[ch]; it is to be defined
2835
    # to 1 if the feature is present, 0 otherwise.
2836
    gcc_GAS_CHECK_FEATURE([GOTOFF in data],
2837
        gcc_cv_as_ix86_gotoff_in_data, [2,11,0],,
2838
[       .text
2839
.L0:
2840
        nop
2841
        .data
2842
        .long .L0@GOTOFF])
2843
    AC_DEFINE_UNQUOTED(HAVE_AS_GOTOFF_IN_DATA,
2844
      [`if test $gcc_cv_as_ix86_gotoff_in_data = yes; then echo 1; else echo 0; fi`],
2845
      [Define true if the assembler supports '.long foo@GOTOFF'.])
2846
    ;;
2847
 
2848
  ia64*-*-*)
2849
    gcc_GAS_CHECK_FEATURE([ltoffx and ldxmov relocs],
2850
        gcc_cv_as_ia64_ltoffx_ldxmov_relocs, [2,14,0],,
2851
[       .text
2852
        addl r15 = @ltoffx(x#), gp
2853
        ;;
2854
        ld8.mov r16 = [[r15]], x#],,
2855
    [AC_DEFINE(HAVE_AS_LTOFFX_LDXMOV_RELOCS, 1,
2856
          [Define if your assembler supports ltoffx and ldxmov relocations.])])
2857
 
2858
    ;;
2859
 
2860
  powerpc*-*-*)
2861
    case $target in
2862
      *-*-aix*) conftest_s='    .machine "pwr5"
2863
        .csect .text[[PR]]
2864
        mfcr 3,128';;
2865
      *-*-darwin*)
2866
        gcc_GAS_CHECK_FEATURE([.machine directive support],
2867
          gcc_cv_as_machine_directive,,,
2868
          [     .machine ppc7400])
2869
        if test x$gcc_cv_as_machine_directive != xyes; then
2870
          echo "*** This target requires an assembler supporting \".machine\"" >&2
2871
          echo you can get it from: ftp://gcc.gnu.org/pub/gcc/infrastructure/cctools-528.5.dmg >&2
2872
          test x$build = x$target && exit 1
2873
        fi
2874
        conftest_s='    .text
2875
        mfcr r3,128';;
2876
      *) conftest_s='   .machine power4
2877
        .text
2878
        mfcr 3,128';;
2879
    esac
2880
 
2881
    gcc_GAS_CHECK_FEATURE([mfcr field support],
2882
      gcc_cv_as_powerpc_mfcrf, [2,14,0],,
2883
      [$conftest_s],,
2884
      [AC_DEFINE(HAVE_AS_MFCRF, 1,
2885
          [Define if your assembler supports mfcr field.])])
2886
 
2887
    case $target in
2888
      *-*-aix*) conftest_s='    .machine "pwr5"
2889
        .csect .text[[PR]]
2890
        popcntb 3,3';;
2891
      *) conftest_s='   .machine power5
2892
        .text
2893
        popcntb 3,3';;
2894
    esac
2895
 
2896
    gcc_GAS_CHECK_FEATURE([popcntb support],
2897
      gcc_cv_as_powerpc_popcntb, [2,17,0],,
2898
      [$conftest_s],,
2899
      [AC_DEFINE(HAVE_AS_POPCNTB, 1,
2900
          [Define if your assembler supports popcntb field.])])
2901
 
2902
    case $target in
2903
      *-*-aix*) conftest_s='    .machine "pwr5x"
2904
        .csect .text[[PR]]
2905
        frin 1,1';;
2906
      *) conftest_s='   .machine power5
2907
        .text
2908
        frin 1,1';;
2909
    esac
2910
 
2911
    gcc_GAS_CHECK_FEATURE([fp round support],
2912
      gcc_cv_as_powerpc_fprnd, [2,17,0],,
2913
      [$conftest_s],,
2914
      [AC_DEFINE(HAVE_AS_FPRND, 1,
2915
          [Define if your assembler supports fprnd.])])
2916
 
2917
    case $target in
2918
      *-*-aix*) conftest_s='    .csect .text[[PR]]
2919
LCF..0:
2920
        addis 11,30,_GLOBAL_OFFSET_TABLE_-LCF..0@ha';;
2921
      *-*-darwin*)
2922
        conftest_s='    .text
2923
LCF0:
2924
        addis r11,r30,_GLOBAL_OFFSET_TABLE_-LCF0@ha';;
2925
      *) conftest_s='   .text
2926
.LCF0:
2927
        addis 11,30,_GLOBAL_OFFSET_TABLE_-.LCF0@ha';;
2928
    esac
2929
 
2930
    gcc_GAS_CHECK_FEATURE([rel16 relocs],
2931
      gcc_cv_as_powerpc_rel16, [2,17,0], -a32,
2932
      [$conftest_s],,
2933
      [AC_DEFINE(HAVE_AS_REL16, 1,
2934
          [Define if your assembler supports R_PPC_REL16 relocs.])])
2935
    ;;
2936
 
2937
  mips*-*-*)
2938
    gcc_GAS_CHECK_FEATURE([explicit relocation support],
2939
      gcc_cv_as_mips_explicit_relocs, [2,14,0],,
2940
[       lw $4,%gp_rel(foo)($4)],,
2941
      [if test x$target_cpu_default = x
2942
       then target_cpu_default=MASK_EXPLICIT_RELOCS
2943
       else target_cpu_default="($target_cpu_default)|MASK_EXPLICIT_RELOCS"
2944
       fi])
2945
    ;;
2946
esac
2947
 
2948
# Mips and HP-UX need the GNU assembler.
2949
# Linux on IA64 might be able to use the Intel assembler.
2950
 
2951
case "$target" in
2952
  mips*-*-* | *-*-hpux* )
2953
    if test x$gas_flag = xyes \
2954
       || test x"$host" != x"$build" \
2955
       || test ! -x "$gcc_cv_as" \
2956
       || "$gcc_cv_as" -v < /dev/null 2>&1 | grep GNU > /dev/null; then
2957
      :
2958
    else
2959
      echo "*** This configuration requires the GNU assembler" >&2
2960
      exit 1
2961
    fi
2962
    ;;
2963
esac
2964
 
2965
# ??? Not all targets support dwarf2 debug_line, even within a version
2966
# of gas.  Moreover, we need to emit a valid instruction to trigger any
2967
# info to the output file.  So, as supported targets are added to gas 2.11,
2968
# add some instruction here to (also) show we expect this might work.
2969
# ??? Once 2.11 is released, probably need to add first known working
2970
# version to the per-target configury.
2971
case "$target" in
2972
  i?86*-*-* | mips*-*-* | alpha*-*-* | powerpc*-*-* | sparc*-*-* | m68*-*-* \
2973
  | x86_64*-*-* | hppa*-*-* | arm*-*-* | strongarm*-*-* | xscale*-*-* \
2974
  | xstormy16*-*-* | cris-*-* | xtensa-*-* | bfin-*-* | score*-*-*)
2975
    insn="nop"
2976
    ;;
2977
  ia64*-*-* | s390*-*-*)
2978
    insn="nop 0"
2979
    ;;
2980
  mmix-*-*)
2981
    insn="swym 0"
2982
    ;;
2983
esac
2984
if test x"$insn" != x; then
2985
 conftest_s="\
2986
        .file 1 \"conftest.s\"
2987
        .loc 1 3 0
2988
        $insn"
2989
 gcc_GAS_CHECK_FEATURE([dwarf2 debug_line support],
2990
  gcc_cv_as_dwarf2_debug_line,
2991
  [elf,2,11,0],, [$conftest_s],
2992
  [if test x$gcc_cv_objdump != x \
2993
   && $gcc_cv_objdump -h conftest.o 2> /dev/null \
2994
      | grep debug_line > /dev/null 2>&1; then
2995
     gcc_cv_as_dwarf2_debug_line=yes
2996
   fi])
2997
 
2998
# The .debug_line file table must be in the exact order that
2999
# we specified the files, since these indices are also used
3000
# by DW_AT_decl_file.  Approximate this test by testing if
3001
# the assembler bitches if the same index is assigned twice.
3002
 gcc_GAS_CHECK_FEATURE([buggy dwarf2 .file directive],
3003
  gcc_cv_as_dwarf2_file_buggy,,,
3004
[       .file 1 "foo.s"
3005
        .file 1 "bar.s"])
3006
 
3007
 if test $gcc_cv_as_dwarf2_debug_line = yes \
3008
 && test $gcc_cv_as_dwarf2_file_buggy = no; then
3009
        AC_DEFINE(HAVE_AS_DWARF2_DEBUG_LINE, 1,
3010
  [Define if your assembler supports dwarf2 .file/.loc directives,
3011
   and preserves file table indices exactly as given.])
3012
 fi
3013
 
3014
 gcc_GAS_CHECK_FEATURE([--gdwarf2 option],
3015
  gcc_cv_as_gdwarf2_flag,
3016
  [elf,2,11,0], [--gdwarf2], [$insn],,
3017
  [AC_DEFINE(HAVE_AS_GDWARF2_DEBUG_FLAG, 1,
3018
[Define if your assembler supports the --gdwarf2 option.])])
3019
 
3020
 gcc_GAS_CHECK_FEATURE([--gstabs option],
3021
  gcc_cv_as_gstabs_flag,
3022
  [elf,2,11,0], [--gstabs], [$insn],
3023
  [# The native Solaris 9/Intel assembler doesn't understand --gstabs
3024
   # and warns about it, but still exits successfully.  So check for
3025
   # this.
3026
   if AC_TRY_COMMAND([$gcc_cv_as --gstabs -o conftest.o conftest.s 2>&1 | grep -i warning > /dev/null])
3027
   then :
3028
   else gcc_cv_as_gstabs_flag=yes
3029
   fi],
3030
  [AC_DEFINE(HAVE_AS_GSTABS_DEBUG_FLAG, 1,
3031
[Define if your assembler supports the --gstabs option.])])
3032
fi
3033
 
3034
AC_MSG_CHECKING(linker read-only and read-write section mixing)
3035
gcc_cv_ld_ro_rw_mix=unknown
3036
if test $in_tree_ld = yes ; then
3037
  if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 10 -o "$gcc_cv_gld_major_version" -gt 2 \
3038
     && test $in_tree_ld_is_elf = yes; then
3039
    gcc_cv_ld_ro_rw_mix=read-write
3040
  fi
3041
elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then
3042
  echo '.section myfoosect, "a"' > conftest1.s
3043
  echo '.section myfoosect, "aw"' > conftest2.s
3044
  echo '.byte 1' >> conftest2.s
3045
  echo '.section myfoosect, "a"' > conftest3.s
3046
  echo '.byte 0' >> conftest3.s
3047
  if $gcc_cv_as -o conftest1.o conftest1.s > /dev/null 2>&1 \
3048
     && $gcc_cv_as -o conftest2.o conftest2.s > /dev/null 2>&1 \
3049
     && $gcc_cv_as -o conftest3.o conftest3.s > /dev/null 2>&1 \
3050
     && $gcc_cv_ld -shared -o conftest1.so conftest1.o \
3051
        conftest2.o conftest3.o > /dev/null 2>&1; then
3052
    gcc_cv_ld_ro_rw_mix=`$gcc_cv_objdump -h conftest1.so \
3053
                         | sed -e '/myfoosect/!d' -e N`
3054
    if echo "$gcc_cv_ld_ro_rw_mix" | grep CONTENTS > /dev/null; then
3055
      if echo "$gcc_cv_ld_ro_rw_mix" | grep READONLY > /dev/null; then
3056
        gcc_cv_ld_ro_rw_mix=read-only
3057
      else
3058
        gcc_cv_ld_ro_rw_mix=read-write
3059
      fi
3060
    fi
3061
  fi
3062
changequote(,)dnl
3063
  rm -f conftest.* conftest[123].*
3064
changequote([,])dnl
3065
fi
3066
if test x$gcc_cv_ld_ro_rw_mix = xread-write; then
3067
        AC_DEFINE(HAVE_LD_RO_RW_SECTION_MIXING, 1,
3068
  [Define if your linker links a mix of read-only
3069
   and read-write sections into a read-write section.])
3070
fi
3071
AC_MSG_RESULT($gcc_cv_ld_ro_rw_mix)
3072
 
3073
AC_MSG_CHECKING(linker PT_GNU_EH_FRAME support)
3074
gcc_cv_ld_eh_frame_hdr=no
3075
if test $in_tree_ld = yes ; then
3076
  if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 12 -o "$gcc_cv_gld_major_version" -gt 2 \
3077
     && test $in_tree_ld_is_elf = yes; then
3078
    gcc_cv_ld_eh_frame_hdr=yes
3079
  fi
3080
elif test x$gcc_cv_ld != x; then
3081
        # Check if linker supports --eh-frame-hdr option
3082
        if $gcc_cv_ld --help 2>/dev/null | grep eh-frame-hdr > /dev/null; then
3083
                gcc_cv_ld_eh_frame_hdr=yes
3084
        fi
3085
fi
3086
GCC_TARGET_TEMPLATE([HAVE_LD_EH_FRAME_HDR])
3087
if test x"$gcc_cv_ld_eh_frame_hdr" = xyes; then
3088
        AC_DEFINE(HAVE_LD_EH_FRAME_HDR, 1,
3089
[Define if your linker supports --eh-frame-hdr option.])
3090
fi
3091
AC_MSG_RESULT($gcc_cv_ld_eh_frame_hdr)
3092
 
3093
AC_MSG_CHECKING(linker position independent executable support)
3094
gcc_cv_ld_pie=no
3095
if test $in_tree_ld = yes ; then
3096
  if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 15 -o "$gcc_cv_gld_major_version" -gt 2 \
3097
     && test $in_tree_ld_is_elf = yes; then
3098
    gcc_cv_ld_pie=yes
3099
  fi
3100
elif test x$gcc_cv_ld != x; then
3101
        # Check if linker supports -pie option
3102
        if $gcc_cv_ld --help 2>/dev/null | grep -- -pie > /dev/null; then
3103
                gcc_cv_ld_pie=yes
3104
        fi
3105
fi
3106
if test x"$gcc_cv_ld_pie" = xyes; then
3107
        AC_DEFINE(HAVE_LD_PIE, 1,
3108
[Define if your linker supports -pie option.])
3109
fi
3110
AC_MSG_RESULT($gcc_cv_ld_pie)
3111
 
3112
# --------
3113
# UNSORTED
3114
# --------
3115
 
3116
AC_CACHE_CHECK(linker --as-needed support,
3117
gcc_cv_ld_as_needed,
3118
[gcc_cv_ld_as_needed=no
3119
if test $in_tree_ld = yes ; then
3120
  if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 16 -o "$gcc_cv_gld_major_version" -gt 2 \
3121
     && test $in_tree_ld_is_elf = yes; then
3122
    gcc_cv_ld_as_needed=yes
3123
  fi
3124
elif test x$gcc_cv_ld != x; then
3125
        # Check if linker supports --as-needed and --no-as-needed options
3126
        if $gcc_cv_ld --help 2>/dev/null | grep as-needed > /dev/null; then
3127
                gcc_cv_ld_as_needed=yes
3128
        fi
3129
fi
3130
])
3131
if test x"$gcc_cv_ld_as_needed" = xyes; then
3132
        AC_DEFINE(HAVE_LD_AS_NEEDED, 1,
3133
[Define if your linker supports --as-needed and --no-as-needed options.])
3134
fi
3135
 
3136
case "$target:$tm_file" in
3137
  powerpc64*-*-linux* | powerpc*-*-linux*rs6000/biarch64.h*)
3138
    AC_CACHE_CHECK(linker support for omitting dot symbols,
3139
    gcc_cv_ld_no_dot_syms,
3140
    [gcc_cv_ld_no_dot_syms=no
3141
    if test $in_tree_ld = yes ; then
3142
      if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 16 -o "$gcc_cv_gld_major_version" -gt 2; then
3143
        gcc_cv_ld_no_dot_syms=yes
3144
      fi
3145
    elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x ; then
3146
      cat > conftest1.s <
3147
        .text
3148
        bl .foo
3149
EOF
3150
      cat > conftest2.s <
3151
        .section ".opd","aw"
3152
        .align 3
3153
        .globl foo
3154
        .type foo,@function
3155
foo:
3156
        .quad .LEfoo,.TOC.@tocbase,0
3157
        .text
3158
.LEfoo:
3159
        blr
3160
        .size foo,.-.LEfoo
3161
EOF
3162
      if $gcc_cv_as -a64 -o conftest1.o conftest1.s > /dev/null 2>&1 \
3163
         && $gcc_cv_as -a64 -o conftest2.o conftest2.s > /dev/null 2>&1 \
3164
         && $gcc_cv_ld -melf64ppc -o conftest conftest1.o conftest2.o > /dev/null 2>&1; then
3165
        gcc_cv_ld_no_dot_syms=yes
3166
      fi
3167
      rm -f conftest conftest1.o conftest2.o conftest1.s conftest2.s
3168
    fi
3169
    ])
3170
    if test x"$gcc_cv_ld_no_dot_syms" = xyes; then
3171
      AC_DEFINE(HAVE_LD_NO_DOT_SYMS, 1,
3172
    [Define if your PowerPC64 linker only needs function descriptor syms.])
3173
    fi
3174
    ;;
3175
esac
3176
 
3177
AC_CACHE_CHECK(linker --sysroot support,
3178
  gcc_cv_ld_sysroot,
3179
  [gcc_cv_ld_sysroot=no
3180
  if test $in_tree_ld = yes ; then
3181
      if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 16 -o "$gcc_cv_gld_major_version" -gt 2 ; then
3182
        gcc_cv_ld_sysroot=yes
3183
      fi
3184
  elif test x$gcc_cv_ld != x; then
3185
    if $gcc_cv_ld --help 2>/dev/null | grep sysroot > /dev/null; then
3186
      gcc_cv_ld_sysroot=yes
3187
    fi
3188
  fi])
3189
if test x"$gcc_cv_ld_sysroot" = xyes; then
3190
  AC_DEFINE(HAVE_LD_SYSROOT, 1,
3191
  [Define if your linker supports --sysroot.])
3192
fi
3193
 
3194
if test x$with_sysroot = x && test x$host = x$target \
3195
   && test "$prefix" != "/usr" && test "x$prefix" != "x$local_prefix" ; then
3196
  AC_DEFINE_UNQUOTED(PREFIX_INCLUDE_DIR, "$prefix/include",
3197
[Define to PREFIX/include if cpp should also search that directory.])
3198
fi
3199
 
3200
# Test for stack protector support in target C library.
3201
case "$target" in
3202
  *-*-linux*)
3203
    AC_CACHE_CHECK(__stack_chk_fail in target GNU C library,
3204
      gcc_cv_libc_provides_ssp,
3205
      [gcc_cv_libc_provides_ssp=no
3206
      if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x; then
3207
        if test "x$with_sysroot" = x; then
3208
          glibc_header_dir="${exec_prefix}/${target_noncanonical}/sys-include"
3209
        elif test "x$with_sysroot" = xyes; then
3210
          glibc_header_dir="${exec_prefix}/${target_noncanonical}/sys-root/usr/include"
3211
        else
3212
          glibc_header_dir="${with_sysroot}/usr/include"
3213
        fi
3214
      else
3215
        glibc_header_dir=/usr/include
3216
      fi
3217
      # glibc 2.4 and later provides __stack_chk_fail and
3218
      # either __stack_chk_guard, or TLS access to stack guard canary.
3219
      if test -f $glibc_header_dir/features.h \
3220
         && $EGREP '^@<:@ 	@:>@*#[      ]*define[       ]+__GNU_LIBRARY__[      ]+([1-9][0-9]|[6-9])' \
3221
            $glibc_header_dir/features.h > /dev/null; then
3222
        if $EGREP '^@<:@ 	@:>@*#[       ]*define[       ]+__GLIBC__[    ]+([1-9][0-9]|[3-9])' \
3223
           $glibc_header_dir/features.h > /dev/null; then
3224
          gcc_cv_libc_provides_ssp=yes
3225
        elif $EGREP '^@<:@ 	@:>@*#[     ]*define[       ]+__GLIBC__[    ]+2' \
3226
             $glibc_header_dir/features.h > /dev/null \
3227
             && $EGREP '^@<:@ 	@:>@*#[  ]*define[       ]+__GLIBC_MINOR__[      ]+([1-9][0-9]|[4-9])' \
3228
             $glibc_header_dir/features.h > /dev/null; then
3229
          gcc_cv_libc_provides_ssp=yes
3230
        fi
3231
      fi]) ;;
3232
  *) gcc_cv_libc_provides_ssp=no ;;
3233
esac
3234
if test x$gcc_cv_libc_provides_ssp = xyes; then
3235
  AC_DEFINE(TARGET_LIBC_PROVIDES_SSP, 1,
3236
            [Define if your target C library provides stack protector support])
3237
fi
3238
 
3239
# Check if TFmode long double should be used by default or not.
3240
# Some glibc targets used DFmode long double, but with glibc 2.4
3241
# and later they can use TFmode.
3242
case "$target" in
3243
  powerpc*-*-*gnu* | \
3244
  sparc*-*-linux* | \
3245
  s390*-*-linux* | \
3246
  alpha*-*-linux*)
3247
    AC_ARG_WITH(long-double-128,
3248
[  --with-long-double-128  Use 128-bit long double by default.],
3249
      gcc_cv_target_ldbl128="$with_long_double_128",
3250
      [gcc_cv_target_ldbl128=no
3251
      if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x; then
3252
        if test "x$with_sysroot" = x; then
3253
          glibc_header_dir="${exec_prefix}/${target_noncanonical}/sys-include"
3254
        elif test "x$with_sysroot" = xyes; then
3255
          glibc_header_dir="${exec_prefix}/${target_noncanonical}/sys-root/usr/include"
3256
        else
3257
          glibc_header_dir="${with_sysroot}/usr/include"
3258
        fi
3259
      else
3260
        glibc_header_dir=/usr/include
3261
      fi
3262
changequote(,)dnl
3263
      grep '^[  ]*#[    ]*define[       ][      ]*__LONG_DOUBLE_MATH_OPTIONAL' \
3264
        $glibc_header_dir/bits/wordsize.h > /dev/null 2>&1 \
3265
      && gcc_cv_target_ldbl128=yes
3266
changequote([,])dnl
3267
      ])
3268
    ;;
3269
esac
3270
if test x$gcc_cv_target_ldbl128 = xyes; then
3271
  AC_DEFINE(TARGET_DEFAULT_LONG_DOUBLE_128, 1,
3272
            [Define if TFmode long double should be the default])
3273
fi
3274
 
3275
# Find out what GC implementation we want, or may, use.
3276
AC_ARG_WITH(gc,
3277
[  --with-gc={page,zone}   choose the garbage collection mechanism to use
3278
                          with the compiler],
3279
[case "$withval" in
3280
  page)
3281
    GGC=ggc-$withval
3282
    ;;
3283
  zone)
3284
    GGC=ggc-$withval
3285
    AC_DEFINE(GGC_ZONE, 1, [Define if the zone collector is in use])
3286
    ;;
3287
  *)
3288
    AC_MSG_ERROR([$withval is an invalid option to --with-gc])
3289
    ;;
3290
esac],
3291
[GGC=ggc-page])
3292
AC_SUBST(GGC)
3293
echo "Using $GGC for garbage collection."
3294
 
3295
# Use the system's zlib library.
3296
zlibdir=-L../zlib
3297
zlibinc="-I\$(srcdir)/../zlib"
3298
AC_ARG_WITH(system-zlib,
3299
[  --with-system-zlib      use installed libz],
3300
zlibdir=
3301
zlibinc=
3302
)
3303
AC_SUBST(zlibdir)
3304
AC_SUBST(zlibinc)
3305
 
3306
dnl Very limited version of automake's enable-maintainer-mode
3307
 
3308
AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
3309
  dnl maintainer-mode is disabled by default
3310
  AC_ARG_ENABLE(maintainer-mode,
3311
[  --enable-maintainer-mode
3312
                          enable make rules and dependencies not useful
3313
                          (and sometimes confusing) to the casual installer],
3314
      maintainer_mode=$enableval,
3315
      maintainer_mode=no)
3316
 
3317
AC_MSG_RESULT($maintainer_mode)
3318
 
3319
if test "$maintainer_mode" = "yes"; then
3320
  MAINT=''
3321
else
3322
  MAINT='#'
3323
fi
3324
AC_SUBST(MAINT)dnl
3325
 
3326
# --------------
3327
# Language hooks
3328
# --------------
3329
 
3330
# Make empty files to contain the specs and options for each language.
3331
# Then add #include lines to for a compiler that has specs and/or options.
3332
 
3333
subdirs=
3334
lang_opt_files=
3335
lang_specs_files=
3336
lang_tree_files=
3337
# These (without "all_") are set in each config-lang.in.
3338
# `language' must be a single word so is spelled singularly.
3339
all_languages=
3340
all_boot_languages=
3341
all_compilers=
3342
all_stagestuff=
3343
all_outputs='Makefile gccbug mklibgcc libada-mk'
3344
# List of language makefile fragments.
3345
all_lang_makefrags=
3346
# List of language subdirectory makefiles.  Deprecated.
3347
all_lang_makefiles=
3348
# Files for gengtype
3349
all_gtfiles="$target_gtfiles"
3350
# Files for gengtype with language
3351
all_gtfiles_files_langs=
3352
all_gtfiles_files_files=
3353
 
3354
# These are the languages that are set in --enable-languages,
3355
# and are available in the GCC tree.
3356
all_selected_languages=
3357
 
3358
# Add the language fragments.
3359
# Languages are added via two mechanisms.  Some information must be
3360
# recorded in makefile variables, these are defined in config-lang.in.
3361
# We accumulate them and plug them into the main Makefile.
3362
# The other mechanism is a set of hooks for each of the main targets
3363
# like `clean', `install', etc.
3364
 
3365
language_hooks="Make-hooks"
3366
 
3367
for lang in ${srcdir}/*/config-lang.in
3368
do
3369
changequote(,)dnl
3370
        test "$lang" = "${srcdir}/*/config-lang.in" && continue
3371
 
3372
        lang_alias=`sed -n -e 's,^language=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^language=\([^   ]*\).*$,\1,p' $lang`
3373
        if test "x$lang_alias" = x
3374
        then
3375
              echo "$lang doesn't set \$language." 1>&2
3376
              exit 1
3377
        fi
3378
        subdir="`echo $lang | sed -e 's,^.*/\([^/]*\)/config-lang.in$,\1,'`"
3379
        subdirs="$subdirs $subdir"
3380
        case ",$enable_languages," in
3381
        *,$lang_alias,*)
3382
            all_selected_languages="$all_selected_languages $lang_alias"
3383
            if test -f $srcdir/$subdir/lang-specs.h; then
3384
                lang_specs_files="$lang_specs_files $srcdir/$subdir/lang-specs.h"
3385
            fi
3386
            ;;
3387
        esac
3388
changequote([,])dnl
3389
 
3390
        language=
3391
        boot_language=
3392
        compilers=
3393
        stagestuff=
3394
        outputs=
3395
        gtfiles=
3396
        subdir_requires=
3397
        . ${srcdir}/$subdir/config-lang.in
3398
        if test "x$language" = x
3399
        then
3400
                echo "${srcdir}/$subdir/config-lang.in doesn't set \$language." 1>&2
3401
                exit 1
3402
        fi
3403
 
3404
        ok=:
3405
        case ",$enable_languages," in
3406
                *,$lang_alias,*) ;;
3407
                *)
3408
                        for i in $subdir_requires; do
3409
                                test -f "${srcdir}/$i/config-lang.in" && continue
3410
                                ok=false
3411
                                break
3412
                        done
3413
                ;;
3414
        esac
3415
        $ok || continue
3416
 
3417
        all_lang_makefrags="$all_lang_makefrags \$(srcdir)/$subdir/Make-lang.in"
3418
        if test -f $srcdir/$subdir/lang.opt; then
3419
            lang_opt_files="$lang_opt_files $srcdir/$subdir/lang.opt"
3420
        fi
3421
        if test -f $srcdir/$subdir/$subdir-tree.def; then
3422
            lang_tree_files="$lang_tree_files $srcdir/$subdir/$subdir-tree.def"
3423
        fi
3424
        if test -f ${srcdir}/$subdir/Makefile.in
3425
                then all_lang_makefiles="$subdir/Makefile"
3426
        fi
3427
        all_languages="$all_languages $language"
3428
        if test "x$boot_language" = xyes
3429
        then
3430
                all_boot_languages="$all_boot_languages $language"
3431
        fi
3432
        all_compilers="$all_compilers $compilers"
3433
        all_stagestuff="$all_stagestuff $stagestuff"
3434
        all_outputs="$all_outputs $outputs"
3435
        all_gtfiles="$all_gtfiles $gtfiles"
3436
        for f in $gtfiles
3437
        do
3438
                all_gtfiles_files_langs="$all_gtfiles_files_langs ${subdir} "
3439
                all_gtfiles_files_files="$all_gtfiles_files_files ${f} "
3440
        done
3441
done
3442
 
3443
# Pick up gtfiles for c
3444
gtfiles=
3445
subdir="c"
3446
. ${srcdir}/c-config-lang.in
3447
all_gtfiles="$all_gtfiles $gtfiles"
3448
for f in $gtfiles
3449
do
3450
        all_gtfiles_files_langs="$all_gtfiles_files_langs ${subdir} "
3451
        all_gtfiles_files_files="$all_gtfiles_files_files ${f} "
3452
done
3453
 
3454
check_languages=
3455
for language in $all_selected_languages
3456
do
3457
        check_languages="$check_languages check-$language"
3458
done
3459
 
3460
# We link each language in with a set of hooks, reached indirectly via
3461
# lang.${target}.  Only do so for selected languages.
3462
 
3463
rm -f Make-hooks
3464
touch Make-hooks
3465
target_list="all.cross start.encap rest.encap tags \
3466
        install-common install-man install-info dvi pdf html \
3467
        uninstall info man srcextra srcman srcinfo \
3468
        mostlyclean clean distclean maintainer-clean \
3469
        stage1 stage2 stage3 stage4 stageprofile stagefeedback"
3470
 
3471
for t in $target_list
3472
do
3473
        x=
3474
        for lang in $all_selected_languages
3475
        do
3476
                x="$x $lang.$t"
3477
        done
3478
        echo "lang.$t: $x" >> Make-hooks
3479
done
3480
 
3481
# --------
3482
# UNSORTED
3483
# --------
3484
 
3485
# Create .gdbinit.
3486
 
3487
echo "dir ." > .gdbinit
3488
echo "dir ${srcdir}" >> .gdbinit
3489
if test x$gdb_needs_out_file_path = xyes
3490
then
3491
        echo "dir ${srcdir}/config/"`dirname ${out_file}` >> .gdbinit
3492
fi
3493
if test "x$subdirs" != x; then
3494
        for s in $subdirs
3495
        do
3496
                echo "dir ${srcdir}/$s" >> .gdbinit
3497
        done
3498
fi
3499
echo "source ${srcdir}/gdbinit.in" >> .gdbinit
3500
 
3501
# If $(exec_prefix) exists and is not the same as $(prefix), then compute an
3502
# absolute path for gcc_tooldir based on inserting the number of up-directory
3503
# movements required to get from $(exec_prefix) to $(prefix) into the basic
3504
# $(libsubdir)/@(unlibsubdir) based path.
3505
# Don't set gcc_tooldir to tooldir since that's only passed in by the toplevel
3506
# make and thus we'd get different behavior depending on where we built the
3507
# sources.
3508
if test x$exec_prefix = xNONE -o x$exec_prefix = x$prefix; then
3509
    gcc_tooldir='$(libsubdir)/$(unlibsubdir)/../$(target_noncanonical)'
3510
else
3511
changequote(<<, >>)dnl
3512
# An explanation of the sed strings:
3513
#  -e 's|^\$(prefix)||'   matches and eliminates 'prefix' from 'exec_prefix'
3514
#  -e 's|/$||'            match a trailing forward slash and eliminates it
3515
#  -e 's|^[^/]|/|'        forces the string to start with a forward slash (*)
3516
#  -e 's|/[^/]*|../|g'    replaces each occurrence of / with ../
3517
#
3518
# (*) Note this pattern overwrites the first character of the string
3519
# with a forward slash if one is not already present.  This is not a
3520
# problem because the exact names of the sub-directories concerned is
3521
# unimportant, just the number of them matters.
3522
#
3523
# The practical upshot of these patterns is like this:
3524
#
3525
#  prefix     exec_prefix        result
3526
#  ------     -----------        ------
3527
#   /foo        /foo/bar          ../
3528
#   /foo/       /foo/bar          ../
3529
#   /foo        /foo/bar/         ../
3530
#   /foo/       /foo/bar/         ../
3531
#   /foo        /foo/bar/ugg      ../../
3532
#
3533
    dollar='$$'
3534
    gcc_tooldir="\$(libsubdir)/\$(unlibsubdir)/\`echo \$(exec_prefix) | sed -e 's|^\$(prefix)||' -e 's|/\$(dollar)||' -e 's|^[^/]|/|' -e 's|/[^/]*|../|g'\`\$(target_noncanonical)"
3535
changequote([, ])dnl
3536
fi
3537
AC_SUBST(gcc_tooldir)
3538
AC_SUBST(dollar)
3539
 
3540
# Find a directory in which to install a shared libgcc.
3541
 
3542
AC_ARG_ENABLE(version-specific-runtime-libs,
3543
[  --enable-version-specific-runtime-libs
3544
                          specify that runtime libraries should be
3545
                          installed in a compiler-specific directory])
3546
 
3547
AC_ARG_WITH(slibdir,
3548
[  --with-slibdir=DIR      shared libraries in DIR [[LIBDIR]]],
3549
slibdir="$with_slibdir",
3550
if test "${enable_version_specific_runtime_libs+set}" = set; then
3551
  slibdir='$(libsubdir)'
3552
elif test "$host" != "$target"; then
3553
  slibdir='$(build_tooldir)/lib'
3554
else
3555
  slibdir='$(libdir)'
3556
fi)
3557
AC_SUBST(slibdir)
3558
 
3559
objdir=`${PWDCMD-pwd}`
3560
AC_SUBST(objdir)
3561
 
3562
AC_ARG_WITH(datarootdir,
3563
[  --with-datarootdir=DIR  Use DIR as the data root [[PREFIX/share]]],
3564
datarootdir="\${prefix}/$with_datarootdir",
3565
datarootdir='$(prefix)/share')
3566
AC_SUBST(datarootdir)
3567
 
3568
AC_ARG_WITH(docdir,
3569
[  --with-docdir=DIR       Install documentation in DIR [[DATAROOTDIR]]],
3570
docdir="\${prefix}/$with_docdir",
3571
docdir='$(datarootdir)')
3572
AC_SUBST(docdir)
3573
 
3574
AC_ARG_WITH(htmldir,
3575
[  --with-htmldir=DIR      html documentation in in DIR [[DOCDIR]]],
3576
htmldir="\${prefix}/$with_htmldir",
3577
htmldir='$(docdir)')
3578
AC_SUBST(htmldir)
3579
 
3580
# Substitute configuration variables
3581
AC_SUBST(subdirs)
3582
AC_SUBST(srcdir)
3583
AC_SUBST(all_boot_languages)
3584
AC_SUBST(all_compilers)
3585
AC_SUBST(all_gtfiles)
3586
AC_SUBST(all_gtfiles_files_langs)
3587
AC_SUBST(all_gtfiles_files_files)
3588
AC_SUBST(all_lang_makefrags)
3589
AC_SUBST(all_lang_makefiles)
3590
AC_SUBST(all_languages)
3591
AC_SUBST(all_selected_languages)
3592
AC_SUBST(all_stagestuff)
3593
AC_SUBST(build_exeext)
3594
AC_SUBST(build_install_headers_dir)
3595
AC_SUBST(build_xm_file_list)
3596
AC_SUBST(build_xm_include_list)
3597
AC_SUBST(build_xm_defines)
3598
AC_SUBST(check_languages)
3599
AC_SUBST(cc_set_by_configure)
3600
AC_SUBST(quoted_cc_set_by_configure)
3601
AC_SUBST(cpp_install_dir)
3602
AC_SUBST(xmake_file)
3603
AC_SUBST(tmake_file)
3604
AC_SUBST(extra_gcc_objs)
3605
AC_SUBST(extra_headers_list)
3606
AC_SUBST(extra_objs)
3607
AC_SUBST(extra_parts)
3608
AC_SUBST(extra_passes)
3609
AC_SUBST(extra_programs)
3610
AC_SUBST(float_h_file)
3611
AC_SUBST(gcc_config_arguments)
3612
AC_SUBST(gcc_gxx_include_dir)
3613
AC_SUBST(host_exeext)
3614
AC_SUBST(host_xm_file_list)
3615
AC_SUBST(host_xm_include_list)
3616
AC_SUBST(host_xm_defines)
3617
AC_SUBST(out_host_hook_obj)
3618
AC_SUBST(install)
3619
AC_SUBST(lang_opt_files)
3620
AC_SUBST(lang_specs_files)
3621
AC_SUBST(lang_tree_files)
3622
AC_SUBST(local_prefix)
3623
AC_SUBST(md_file)
3624
AC_SUBST(objc_boehm_gc)
3625
AC_SUBST(out_file)
3626
AC_SUBST(out_object_file)
3627
AC_SUBST(stage_prefix_set_by_configure)
3628
AC_SUBST(quoted_stage_prefix_set_by_configure)
3629
AC_SUBST(thread_file)
3630
AC_SUBST(tm_file_list)
3631
AC_SUBST(tm_include_list)
3632
AC_SUBST(tm_defines)
3633
AC_SUBST(tm_p_file_list)
3634
AC_SUBST(tm_p_include_list)
3635
AC_SUBST(xm_file_list)
3636
AC_SUBST(xm_include_list)
3637
AC_SUBST(xm_defines)
3638
AC_SUBST(c_target_objs)
3639
AC_SUBST(cxx_target_objs)
3640
AC_SUBST(target_cpu_default)
3641
 
3642
AC_SUBST_FILE(language_hooks)
3643
 
3644
# Echo link setup.
3645
if test x${build} = x${host} ; then
3646
  if test x${host} = x${target} ; then
3647
    echo "Links are now set up to build a native compiler for ${target}." 1>&2
3648
  else
3649
    echo "Links are now set up to build a cross-compiler" 1>&2
3650
    echo " from ${host} to ${target}." 1>&2
3651
  fi
3652
else
3653
  if test x${host} = x${target} ; then
3654
    echo "Links are now set up to build (on ${build}) a native compiler" 1>&2
3655
    echo " for ${target}." 1>&2
3656
  else
3657
    echo "Links are now set up to build (on ${build}) a cross-compiler" 1>&2
3658
    echo " from ${host} to ${target}." 1>&2
3659
  fi
3660
fi
3661
 
3662
AC_ARG_VAR(GMPLIBS,[How to link GMP])
3663
AC_ARG_VAR(GMPINC,[How to find GMP include files])
3664
 
3665
# Configure the subdirectories
3666
# AC_CONFIG_SUBDIRS($subdirs)
3667
 
3668
# Create the Makefile
3669
# and configure language subdirectories
3670
AC_CONFIG_FILES($all_outputs)
3671
 
3672
AC_CONFIG_COMMANDS([default],
3673
[
3674
case ${CONFIG_HEADERS} in
3675
  *auto-host.h:config.in*)
3676
  echo > cstamp-h ;;
3677
esac
3678
# Make sure all the subdirs exist.
3679
for d in $subdirs doc build
3680
do
3681
    test -d $d || mkdir $d
3682
done
3683
# If the host supports symlinks, point stage[1234] at ../stage[1234] so
3684
# bootstrapping and the installation procedure can still use
3685
# CC="stage1/xgcc -Bstage1/".  If the host doesn't support symlinks,
3686
# FLAGS_TO_PASS has been modified to solve the problem there.
3687
# This is virtually a duplicate of what happens in configure.lang; we do
3688
# an extra check to make sure this only happens if ln -s can be used.
3689
case "$LN_S" in
3690
  *-s*)
3691
    for d in ${subdirs} ; do
3692
        STARTDIR=`${PWDCMD-pwd}`
3693
        cd $d
3694
        for t in stage1 stage2 stage3 stage4 stageprofile stagefeedback include
3695
        do
3696
                rm -f $t
3697
                $LN_S ../$t $t 2>/dev/null
3698
        done
3699
        cd $STARTDIR
3700
    done
3701
  ;;
3702
esac
3703
],
3704
[subdirs='$subdirs'])
3705
AC_OUTPUT

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.