]>
Commit | Line | Data |
---|---|---|
ca9bc441 | 1 | # configure.ac for GCC |
46f18e7b RK |
2 | # Process this file with autoconf to generate a configuration script. |
3 | ||
23a5b65a | 4 | # Copyright (C) 1997-2014 Free Software Foundation, Inc. |
46f18e7b | 5 | |
1322177d | 6 | #This file is part of GCC. |
46f18e7b | 7 | |
1322177d LB |
8 | #GCC is free software; you can redistribute it and/or modify it under |
9 | #the terms of the GNU General Public License as published by the Free | |
9dcd6f09 | 10 | #Software Foundation; either version 3, or (at your option) any later |
1322177d | 11 | #version. |
46f18e7b | 12 | |
1322177d LB |
13 | #GCC is distributed in the hope that it will be useful, but WITHOUT |
14 | #ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 | #FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 | #for more details. | |
46f18e7b RK |
17 | |
18 | #You should have received a copy of the GNU General Public License | |
9dcd6f09 NC |
19 | #along with GCC; see the file COPYING3. If not see |
20 | #<http://www.gnu.org/licenses/>. | |
46f18e7b | 21 | |
34a86c2b NN |
22 | # -------------------------------- |
23 | # Initialization and sanity checks | |
24 | # -------------------------------- | |
25 | ||
df58e648 | 26 | AC_PREREQ(2.64) |
914c5af7 NN |
27 | AC_INIT |
28 | AC_CONFIG_SRCDIR(tree.c) | |
b7cb92ad | 29 | AC_CONFIG_HEADER(auto-host.h:config.in) |
cdcc6a01 | 30 | |
9f18db39 PB |
31 | gcc_version=`cat $srcdir/BASE-VER` |
32 | ||
34a86c2b | 33 | # Determine the host, build, and target systems |
914c5af7 NN |
34 | AC_CANONICAL_BUILD |
35 | AC_CANONICAL_HOST | |
36 | AC_CANONICAL_TARGET | |
34a86c2b | 37 | |
caa55b1e | 38 | # Determine the noncanonical target name, for directory use. |
392765bf | 39 | ACX_NONCANONICAL_TARGET |
caa55b1e | 40 | |
4665e56c NN |
41 | # Determine the target- and build-specific subdirectories |
42 | GCC_TOPLEV_SUBDIRS | |
43 | ||
34a86c2b NN |
44 | # Set program_transform_name |
45 | AC_ARG_PROGRAM | |
46f18e7b | 46 | |
75a39864 JL |
47 | # Check for bogus environment variables. |
48 | # Test if LIBRARY_PATH contains the notation for the current directory | |
49 | # since this would lead to problems installing/building glibc. | |
50 | # LIBRARY_PATH contains the current directory if one of the following | |
51 | # is true: | |
52 | # - one of the terminals (":" and ";") is the first or last sign | |
53 | # - two terminals occur directly after each other | |
54 | # - the path contains an element with a dot in it | |
55 | AC_MSG_CHECKING(LIBRARY_PATH variable) | |
56 | changequote(,)dnl | |
57 | case ${LIBRARY_PATH} in | |
58 | [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* ) | |
59 | library_path_setting="contains current directory" | |
60 | ;; | |
61 | *) | |
62 | library_path_setting="ok" | |
63 | ;; | |
64 | esac | |
65 | changequote([,])dnl | |
66 | AC_MSG_RESULT($library_path_setting) | |
67 | if test "$library_path_setting" != "ok"; then | |
68 | AC_MSG_ERROR([ | |
69 | *** LIBRARY_PATH shouldn't contain the current directory when | |
079bd08e | 70 | *** building gcc. Please change the environment variable |
75a39864 JL |
71 | *** and run configure again.]) |
72 | fi | |
73 | ||
74 | # Test if GCC_EXEC_PREFIX contains the notation for the current directory | |
75 | # since this would lead to problems installing/building glibc. | |
76 | # GCC_EXEC_PREFIX contains the current directory if one of the following | |
77 | # is true: | |
78 | # - one of the terminals (":" and ";") is the first or last sign | |
79 | # - two terminals occur directly after each other | |
80 | # - the path contains an element with a dot in it | |
81 | AC_MSG_CHECKING(GCC_EXEC_PREFIX variable) | |
82 | changequote(,)dnl | |
83 | case ${GCC_EXEC_PREFIX} in | |
84 | [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* ) | |
85 | gcc_exec_prefix_setting="contains current directory" | |
86 | ;; | |
87 | *) | |
88 | gcc_exec_prefix_setting="ok" | |
89 | ;; | |
90 | esac | |
91 | changequote([,])dnl | |
92 | AC_MSG_RESULT($gcc_exec_prefix_setting) | |
93 | if test "$gcc_exec_prefix_setting" != "ok"; then | |
94 | AC_MSG_ERROR([ | |
95 | *** GCC_EXEC_PREFIX shouldn't contain the current directory when | |
079bd08e | 96 | *** building gcc. Please change the environment variable |
75a39864 JL |
97 | *** and run configure again.]) |
98 | fi | |
99 | ||
34a86c2b NN |
100 | # ----------- |
101 | # Directories | |
102 | # ----------- | |
103 | ||
104 | # Specify the local prefix | |
105 | local_prefix= | |
106 | AC_ARG_WITH(local-prefix, | |
b88ecf55 AS |
107 | [AS_HELP_STRING([--with-local-prefix=DIR], |
108 | [specifies directory to put local include])], | |
34a86c2b NN |
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, | |
b88ecf55 AS |
126 | [AS_HELP_STRING([--with-gxx-include-dir=DIR], |
127 | [specifies directory to put g++ header files])], | |
34a86c2b NN |
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 | ||
0f57bf40 | 134 | # This logic must match libstdc++-v3/acinclude.m4:GLIBCXX_EXPORT_INSTALL_INFO. |
34a86c2b NN |
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 | |
0f57bf40 MM |
139 | libstdcxx_incdir='include/c++/$(version)' |
140 | if test x$host != x$target; then | |
141 | libstdcxx_incdir="$target_alias/$libstdcxx_incdir" | |
142 | fi | |
15c723f3 | 143 | gcc_gxx_include_dir="\$(libsubdir)/\$(libsubdir_to_prefix)$libstdcxx_incdir" |
34a86c2b NN |
144 | fi |
145 | fi | |
146 | ||
17719d09 HS |
147 | gcc_gxx_include_dir_add_sysroot=0 |
148 | if test "${with_sysroot+set}" = set; then | |
149 | gcc_gxx_without_sysroot=`expr "${gcc_gxx_include_dir}" : "${with_sysroot}"'\(.*\)'` | |
150 | if test "${gcc_gxx_without_sysroot}"; then | |
151 | gcc_gxx_include_dir="${gcc_gxx_without_sysroot}" | |
152 | gcc_gxx_include_dir_add_sysroot=1 | |
153 | fi | |
154 | fi | |
155 | ||
34a86c2b | 156 | AC_ARG_WITH(cpp_install_dir, |
b88ecf55 AS |
157 | [AC_HELP_STRING([--with-cpp-install-dir=DIR], |
158 | [install the user visible C preprocessor in DIR | |
159 | (relative to PREFIX) as well as PREFIX/bin])], | |
34a86c2b NN |
160 | [if test x$withval = xyes; then |
161 | AC_MSG_ERROR([option --with-cpp-install-dir requires an argument]) | |
162 | elif test x$withval != xno; then | |
163 | cpp_install_dir=$withval | |
164 | fi]) | |
165 | ||
51b9ff45 KC |
166 | # We would like to our source tree to be readonly. However when releases or |
167 | # pre-releases are generated, the flex/bison generated files as well as the | |
168 | # various formats of manuals need to be included along with the rest of the | |
169 | # sources. Therefore we have --enable-generated-files-in-srcdir to do | |
170 | # just that. | |
171 | ||
03787dfd KC |
172 | AC_MSG_CHECKING([whether to place generated files in the source directory]) |
173 | dnl generated-files-in-srcdir is disabled by default | |
174 | AC_ARG_ENABLE(generated-files-in-srcdir, | |
b88ecf55 AS |
175 | [AS_HELP_STRING([--enable-generated-files-in-srcdir], |
176 | [put copies of generated files in source dir | |
177 | intended for creating source tarballs for users | |
178 | without texinfo bison or flex])], | |
03787dfd KC |
179 | generated_files_in_srcdir=$enableval, |
180 | generated_files_in_srcdir=no) | |
181 | ||
182 | AC_MSG_RESULT($generated_files_in_srcdir) | |
183 | ||
184 | if test "$generated_files_in_srcdir" = "yes"; then | |
185 | GENINSRC='' | |
03787dfd KC |
186 | else |
187 | GENINSRC='#' | |
03787dfd KC |
188 | fi |
189 | AC_SUBST(GENINSRC) | |
51b9ff45 | 190 | |
34a86c2b NN |
191 | # ------------------- |
192 | # Find default linker | |
193 | # ------------------- | |
46f18e7b RK |
194 | |
195 | # With GNU ld | |
196 | AC_ARG_WITH(gnu-ld, | |
b88ecf55 | 197 | [AS_HELP_STRING([--with-gnu-ld], [arrange to work with GNU ld])], |
df6faf79 JW |
198 | gnu_ld_flag="$with_gnu_ld", |
199 | gnu_ld_flag=no) | |
46f18e7b | 200 | |
ab339d62 AO |
201 | # With pre-defined ld |
202 | AC_ARG_WITH(ld, | |
b88ecf55 | 203 | [AS_HELP_STRING([--with-ld], [arrange to use the specified ld (full pathname)])], |
3ccc3a56 AO |
204 | DEFAULT_LINKER="$with_ld") |
205 | if test x"${DEFAULT_LINKER+set}" = x"set"; then | |
206 | if test ! -x "$DEFAULT_LINKER"; then | |
99c012a8 | 207 | AC_MSG_ERROR([cannot execute: $DEFAULT_LINKER: check --with-ld or env. var. DEFAULT_LINKER]) |
e154a394 | 208 | elif $DEFAULT_LINKER -v < /dev/null 2>&1 | grep GNU > /dev/null; then |
ab339d62 AO |
209 | gnu_ld_flag=yes |
210 | fi | |
119d24d1 KG |
211 | AC_DEFINE_UNQUOTED(DEFAULT_LINKER,"$DEFAULT_LINKER", |
212 | [Define to enable the use of a default linker.]) | |
ab339d62 AO |
213 | fi |
214 | ||
34a86c2b NN |
215 | AC_MSG_CHECKING([whether a default linker was specified]) |
216 | if test x"${DEFAULT_LINKER+set}" = x"set"; then | |
217 | if test x"$gnu_ld_flag" = x"no"; then | |
218 | AC_MSG_RESULT([yes ($DEFAULT_LINKER)]) | |
219 | else | |
220 | AC_MSG_RESULT([yes ($DEFAULT_LINKER - GNU ld)]) | |
221 | fi | |
222 | else | |
223 | AC_MSG_RESULT(no) | |
224 | fi | |
225 | ||
d594623a L |
226 | # With demangler in GNU ld |
227 | AC_ARG_WITH(demangler-in-ld, | |
b88ecf55 | 228 | [AS_HELP_STRING([--with-demangler-in-ld], [try to use demangler in GNU ld])], |
d594623a | 229 | demangler_in_ld="$with_demangler_in_ld", |
df45fc34 | 230 | demangler_in_ld=yes) |
d594623a | 231 | |
34a86c2b NN |
232 | # ---------------------- |
233 | # Find default assembler | |
234 | # ---------------------- | |
235 | ||
46f18e7b RK |
236 | # With GNU as |
237 | AC_ARG_WITH(gnu-as, | |
b88ecf55 | 238 | [AS_HELP_STRING([--with-gnu-as], [arrange to work with GNU as])], |
df6faf79 JW |
239 | gas_flag="$with_gnu_as", |
240 | gas_flag=no) | |
46f18e7b | 241 | |
ab339d62 | 242 | AC_ARG_WITH(as, |
b88ecf55 | 243 | [AS_HELP_STRING([--with-as], [arrange to use the specified as (full pathname)])], |
3ccc3a56 AO |
244 | DEFAULT_ASSEMBLER="$with_as") |
245 | if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then | |
246 | if test ! -x "$DEFAULT_ASSEMBLER"; then | |
99c012a8 | 247 | AC_MSG_ERROR([cannot execute: $DEFAULT_ASSEMBLER: check --with-as or env. var. DEFAULT_ASSEMBLER]) |
e154a394 | 248 | elif $DEFAULT_ASSEMBLER -v < /dev/null 2>&1 | grep GNU > /dev/null; then |
ab339d62 AO |
249 | gas_flag=yes |
250 | fi | |
119d24d1 KG |
251 | AC_DEFINE_UNQUOTED(DEFAULT_ASSEMBLER,"$DEFAULT_ASSEMBLER", |
252 | [Define to enable the use of a default assembler.]) | |
3ccc3a56 | 253 | fi |
ab339d62 | 254 | |
34a86c2b NN |
255 | AC_MSG_CHECKING([whether a default assembler was specified]) |
256 | if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then | |
257 | if test x"$gas_flag" = x"no"; then | |
258 | AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER)]) | |
4e88d51b | 259 | else |
34a86c2b | 260 | AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER - GNU as)]) |
4e88d51b | 261 | fi |
34a86c2b NN |
262 | else |
263 | AC_MSG_RESULT(no) | |
4e88d51b | 264 | fi |
46f18e7b | 265 | |
34a86c2b NN |
266 | # --------------- |
267 | # Find C compiler | |
268 | # --------------- | |
13c22933 | 269 | |
426ca3ca RO |
270 | # If a non-executable a.out is present (e.g. created by GNU as above even if |
271 | # invoked with -v only), the IRIX 6 native ld just overwrites the existing | |
272 | # file, even when creating an executable, so an execution test fails. | |
273 | # Remove possible default executable files to avoid this. | |
274 | # | |
275 | # FIXME: This really belongs into AC_PROG_CC and can be removed once | |
276 | # Autoconf includes it. | |
277 | rm -f a.out a.exe b.out | |
278 | ||
414d23ae HPN |
279 | # Find the native compiler |
280 | AC_PROG_CC | |
00020c16 | 281 | AC_PROG_CXX |
3d4e720a ST |
282 | ACX_PROG_GNAT([-I"$srcdir"/ada]) |
283 | ||
ec6c7392 PB |
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*) ;; | |
dadbefd3 JJ |
288 | *) CFLAGS=`echo "$CFLAGS " | sed -e "s/-Ofast[[ ]]//" -e "s/-O[[gs]][[ ]]//" -e "s/-O[[0-9]]*[[ ]]//" ` |
289 | CXXFLAGS=`echo "$CXXFLAGS " | sed -e "s/-Ofast[[ ]]//" -e "s/-O[[gs]][[ ]]//" -e "s/-O[[0-9]]*[[ ]]//" ` ;; | |
ec6c7392 PB |
290 | esac |
291 | AC_SUBST(CFLAGS) | |
8bf4ee34 | 292 | AC_SUBST(CXXFLAGS) |
ec6c7392 | 293 | |
e3aa9eba RO |
294 | # Determine PICFLAG for target gnatlib. |
295 | GCC_PICFLAG_FOR_TARGET | |
296 | AC_SUBST(PICFLAG_FOR_TARGET) | |
297 | ||
73458fb7 NN |
298 | # ------------------------- |
299 | # Check C compiler features | |
300 | # ------------------------- | |
301 | ||
60d26958 | 302 | AC_USE_SYSTEM_EXTENSIONS |
34a86c2b NN |
303 | AC_PROG_CPP |
304 | AC_C_INLINE | |
34a86c2b | 305 | |
480767a9 ILT |
306 | AC_SYS_LARGEFILE |
307 | ||
34a86c2b | 308 | # sizeof(char) is 1 by definition. |
bf3b7cd3 JD |
309 | AC_CHECK_SIZEOF(void *) |
310 | AC_CHECK_SIZEOF(short) | |
311 | AC_CHECK_SIZEOF(int) | |
312 | AC_CHECK_SIZEOF(long) | |
5ec1c5e6 KC |
313 | AC_CHECK_TYPES([long long], [AC_CHECK_SIZEOF(long long)]) |
314 | AC_CHECK_TYPES([__int64], [AC_CHECK_SIZEOF(__int64)]) | |
7c2a2dbf | 315 | GCC_STDINT_TYPES |
34a86c2b | 316 | |
34a86c2b NN |
317 | # --------------------- |
318 | # Warnings and checking | |
319 | # --------------------- | |
320 | ||
b5472e1d NN |
321 | # Check $CC warning features (if it's GCC). |
322 | # We want to use -pedantic, but we don't want warnings about | |
323 | # * 'long long' | |
324 | # * variadic macros | |
89a42ac8 | 325 | # * overlong strings |
25339f10 | 326 | # * C++11 narrowing conversions in { } |
b5472e1d NN |
327 | # So, we only use -pedantic if we can disable those warnings. |
328 | ||
1652c6da JM |
329 | # In stage 1, disable -Wformat warnings from old GCCs about new % codes |
330 | AC_ARG_ENABLE(build-format-warnings, | |
331 | AS_HELP_STRING([--disable-build-format-warnings],[don't use -Wformat while building GCC]), | |
332 | [],[enable_build_format_warnings=yes]) | |
333 | AS_IF([test $enable_build_format_warnings = no], | |
334 | [wf_opt=-Wno-format],[wf_opt=]) | |
f6e377f8 | 335 | ACX_PROG_CC_WARNING_OPTS( |
1652c6da | 336 | m4_quote(m4_do([-W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual $wf_opt])), [loose_warn]) |
f6e377f8 | 337 | ACX_PROG_CC_WARNING_OPTS( |
00020c16 ILT |
338 | m4_quote(m4_do([-Wstrict-prototypes -Wmissing-prototypes])), |
339 | [c_loose_warn]) | |
340 | ACX_PROG_CC_WARNING_OPTS( | |
341 | m4_quote(m4_do([-Wmissing-format-attribute])), [strict_warn]) | |
45887209 TS |
342 | ACX_PROG_CC_WARNING_OPTS( |
343 | m4_quote(m4_do([-Woverloaded-virtual])), [strict_warn]) | |
00020c16 ILT |
344 | ACX_PROG_CC_WARNING_OPTS( |
345 | m4_quote(m4_do([-Wold-style-definition -Wc++-compat])), [c_strict_warn]) | |
f6e377f8 | 346 | ACX_PROG_CC_WARNING_ALMOST_PEDANTIC( |
75c9cbe3 AS |
347 | m4_quote(m4_do([-Wno-long-long -Wno-variadic-macros ], |
348 | [-Wno-overlength-strings])), [strict_warn]) | |
3bbd5a19 PB |
349 | ACX_PROG_CC_WARNINGS_ARE_ERRORS([manual], [strict_warn]) |
350 | ||
351 | # The above macros do nothing if the compiler is not GCC. However, the | |
00020c16 ILT |
352 | # Makefile has more goo to add other flags, so these variables are used |
353 | # to enable warnings only for GCC. | |
414d23ae | 354 | warn_cflags= |
00020c16 | 355 | warn_cxxflags= |
414d23ae HPN |
356 | if test "x$GCC" = "xyes"; then |
357 | warn_cflags='$(GCC_WARN_CFLAGS)' | |
00020c16 | 358 | warn_cxxflags='$(GCC_WARN_CXXFLAGS)' |
414d23ae HPN |
359 | fi |
360 | AC_SUBST(warn_cflags) | |
00020c16 | 361 | AC_SUBST(warn_cxxflags) |
414d23ae | 362 | |
e9411247 MM |
363 | # Disable exceptions and RTTI if building with g++ |
364 | ACX_PROG_CC_WARNING_OPTS( | |
3d47a53a UB |
365 | m4_quote(m4_do([-fno-exceptions -fno-rtti -fasynchronous-unwind-tables])), |
366 | [noexception_flags]) | |
e9411247 | 367 | |
8b1f719a | 368 | # Enable expensive internal checks |
a1286ef5 ZW |
369 | is_release= |
370 | if test x"`cat $srcdir/DEV-PHASE`" != xexperimental; then | |
371 | is_release=yes | |
372 | fi | |
dd859b8a | 373 | |
a494747c | 374 | AC_ARG_ENABLE(checking, |
b88ecf55 AS |
375 | [AS_HELP_STRING([[--enable-checking[=LIST]]], |
376 | [enable expensive run-time checks. With LIST, | |
377 | enable only specific categories of checks. | |
378 | Categories are: yes,no,all,none,release. | |
379 | Flags are: assert,df,fold,gc,gcac,gimple,misc, | |
380 | rtlflag,rtl,runtime,tree,valgrind,types])], | |
e1bbfc5c NS |
381 | [ac_checking_flags="${enableval}"],[ |
382 | # Determine the default checks. | |
383 | if test x$is_release = x ; then | |
384 | ac_checking_flags=yes | |
385 | else | |
386 | ac_checking_flags=release | |
387 | fi]) | |
e1bbfc5c | 388 | IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="$IFS," |
04c3028a | 389 | for check in release $ac_checking_flags |
e1bbfc5c NS |
390 | do |
391 | case $check in | |
cdce5c16 | 392 | # these set all the flags to specific states |
0d475361 | 393 | yes) ac_assert_checking=1 ; ac_checking=1 ; ac_df_checking= ; |
cdce5c16 | 394 | ac_fold_checking= ; ac_gc_checking=1 ; |
726a989a | 395 | ac_gc_always_collect= ; ac_gimple_checking=1 ; ac_rtl_checking= ; |
232b67d9 | 396 | ac_rtlflag_checking=1 ; ac_runtime_checking=1 ; |
7e98624c | 397 | ac_tree_checking=1 ; ac_valgrind_checking= ; |
1b24a790 | 398 | ac_types_checking=1 ;; |
3089f8b5 | 399 | no|none) ac_assert_checking= ; ac_checking= ; ac_df_checking= ; |
cdce5c16 | 400 | ac_fold_checking= ; ac_gc_checking= ; |
726a989a | 401 | ac_gc_always_collect= ; ac_gimple_checking= ; ac_rtl_checking= ; |
232b67d9 | 402 | ac_rtlflag_checking= ; ac_runtime_checking= ; |
7e98624c RG |
403 | ac_tree_checking= ; ac_valgrind_checking= ; |
404 | ac_types_checking= ;; | |
3089f8b5 | 405 | all) ac_assert_checking=1 ; ac_checking=1 ; ac_df_checking=1 ; |
cdce5c16 | 406 | ac_fold_checking=1 ; ac_gc_checking=1 ; |
726a989a | 407 | ac_gc_always_collect=1 ; ac_gimple_checking=1 ; ac_rtl_checking=1 ; |
cdce5c16 | 408 | ac_rtlflag_checking=1 ; ac_runtime_checking=1 ; |
7e98624c RG |
409 | ac_tree_checking=1 ; ac_valgrind_checking= ; |
410 | ac_types_checking=1 ;; | |
3089f8b5 | 411 | release) ac_assert_checking=1 ; ac_checking= ; ac_df_checking= ; |
cdce5c16 | 412 | ac_fold_checking= ; ac_gc_checking= ; |
726a989a | 413 | ac_gc_always_collect= ; ac_gimple_checking= ; ac_rtl_checking= ; |
cdce5c16 | 414 | ac_rtlflag_checking= ; ac_runtime_checking=1 ; |
7e98624c RG |
415 | ac_tree_checking= ; ac_valgrind_checking= ; |
416 | ac_types_checking= ;; | |
cdce5c16 | 417 | # these enable particular checks |
e1bbfc5c | 418 | assert) ac_assert_checking=1 ;; |
3089f8b5 | 419 | df) ac_df_checking=1 ;; |
e1bbfc5c NS |
420 | fold) ac_fold_checking=1 ;; |
421 | gc) ac_gc_checking=1 ;; | |
422 | gcac) ac_gc_always_collect=1 ;; | |
726a989a | 423 | gimple) ac_gimple_checking=1 ;; |
e1bbfc5c | 424 | misc) ac_checking=1 ;; |
e1bbfc5c | 425 | rtl) ac_rtl_checking=1 ;; |
cdce5c16 | 426 | rtlflag) ac_rtlflag_checking=1 ;; |
b53ef395 | 427 | runtime) ac_runtime_checking=1 ;; |
e1bbfc5c | 428 | tree) ac_tree_checking=1 ;; |
7e98624c | 429 | types) ac_types_checking=1 ;; |
cdce5c16 | 430 | valgrind) ac_valgrind_checking=1 ;; |
e1bbfc5c NS |
431 | *) AC_MSG_ERROR(unknown check category $check) ;; |
432 | esac | |
433 | done | |
434 | IFS="$ac_save_IFS" | |
435 | ||
204250d2 | 436 | nocommon_flag="" |
119d24d1 KG |
437 | if test x$ac_checking != x ; then |
438 | AC_DEFINE(ENABLE_CHECKING, 1, | |
439 | [Define if you want more run-time sanity checks. This one gets a grab | |
440 | bag of miscellaneous but relatively cheap checks.]) | |
204250d2 | 441 | nocommon_flag=-fno-common |
119d24d1 | 442 | fi |
204250d2 | 443 | AC_SUBST(nocommon_flag) |
3089f8b5 PB |
444 | if test x$ac_df_checking != x ; then |
445 | AC_DEFINE(ENABLE_DF_CHECKING, 1, | |
446 | [Define if you want more run-time sanity checks for dataflow.]) | |
447 | fi | |
06c37c96 NS |
448 | if test x$ac_assert_checking != x ; then |
449 | AC_DEFINE(ENABLE_ASSERT_CHECKING, 1, | |
450 | [Define if you want assertions enabled. This is a cheap check.]) | |
451 | fi | |
726a989a RB |
452 | if test x$ac_gimple_checking != x ; then |
453 | AC_DEFINE(ENABLE_GIMPLE_CHECKING, 1, | |
454 | [Define if you want operations on GIMPLE (the basic data structure of | |
455 | the high-level optimizers) to be checked for dynamic type safety at | |
456 | runtime. This is moderately expensive.]) | |
457 | fi | |
232b67d9 | 458 | GCC_TARGET_TEMPLATE(ENABLE_RUNTIME_CHECKING) |
b53ef395 NS |
459 | if test x$ac_runtime_checking != x ; then |
460 | AC_DEFINE(ENABLE_RUNTIME_CHECKING, 1, | |
461 | [Define if you want runtime assertions enabled. This is a cheap check.]) | |
462 | fi | |
119d24d1 KG |
463 | if test x$ac_tree_checking != x ; then |
464 | AC_DEFINE(ENABLE_TREE_CHECKING, 1, | |
465 | [Define if you want all operations on trees (the basic data | |
466 | structure of the front ends) to be checked for dynamic type safety | |
13f05fd0 BM |
467 | at runtime. This is moderately expensive. The tree browser debugging |
468 | routines will also be enabled by this option. | |
469 | ]) | |
470 | TREEBROWSER=tree-browser.o | |
7cb9fd07 | 471 | TREECHECKING=yes |
119d24d1 | 472 | fi |
7e98624c RG |
473 | if test x$ac_types_checking != x ; then |
474 | AC_DEFINE(ENABLE_TYPES_CHECKING, 1, | |
475 | [Define if you want all gimple types to be verified after gimplifiation. | |
476 | This is cheap. | |
477 | ]) | |
478 | fi | |
13f05fd0 | 479 | AC_SUBST(TREEBROWSER) |
7cb9fd07 | 480 | AC_SUBST(TREECHECKING) |
119d24d1 KG |
481 | if test x$ac_rtl_checking != x ; then |
482 | AC_DEFINE(ENABLE_RTL_CHECKING, 1, | |
483 | [Define if you want all operations on RTL (the basic data structure | |
484 | of the optimizer and back end) to be checked for dynamic type safety | |
485 | at runtime. This is quite expensive.]) | |
486 | fi | |
4c76f856 JJ |
487 | if test x$ac_rtlflag_checking != x ; then |
488 | AC_DEFINE(ENABLE_RTL_FLAG_CHECKING, 1, | |
489 | [Define if you want RTL flag accesses to be checked against the RTL | |
490 | codes that are supported for each access macro. This is relatively | |
491 | cheap.]) | |
492 | fi | |
119d24d1 KG |
493 | if test x$ac_gc_checking != x ; then |
494 | AC_DEFINE(ENABLE_GC_CHECKING, 1, | |
495 | [Define if you want the garbage collector to do object poisoning and | |
496 | other memory allocation checks. This is quite expensive.]) | |
497 | fi | |
498 | if test x$ac_gc_always_collect != x ; then | |
499 | AC_DEFINE(ENABLE_GC_ALWAYS_COLLECT, 1, | |
500 | [Define if you want the garbage collector to operate in maximally | |
501 | paranoid mode, validating the entire heap and collecting garbage at | |
502 | every opportunity. This is extremely expensive.]) | |
503 | fi | |
5dfa45d0 JJ |
504 | if test x$ac_fold_checking != x ; then |
505 | AC_DEFINE(ENABLE_FOLD_CHECKING, 1, | |
506 | [Define if you want fold checked that it never destructs its argument. | |
507 | This is quite expensive.]) | |
508 | fi | |
414d23ae HPN |
509 | valgrind_path_defines= |
510 | valgrind_command= | |
6938ec6c NN |
511 | |
512 | dnl # This check AC_REQUIREs various stuff, so it *must not* be inside | |
513 | dnl # an if statement. This was the source of very frustrating bugs | |
514 | dnl # in converting to autoconf 2.5x! | |
515 | AC_CHECK_HEADER(valgrind.h, have_valgrind_h=yes, have_valgrind_h=no) | |
516 | ||
279a935f RB |
517 | # It is certainly possible that there's valgrind but no valgrind.h. |
518 | # GCC relies on making annotations so we must have both. | |
519 | AC_MSG_CHECKING(for VALGRIND_DISCARD in <valgrind/memcheck.h>) | |
520 | AC_PREPROC_IFELSE([AC_LANG_SOURCE( | |
521 | [[#include <valgrind/memcheck.h> | |
a207b594 HPN |
522 | #ifndef VALGRIND_DISCARD |
523 | #error VALGRIND_DISCARD not defined | |
f04f1d2c | 524 | #endif]])], |
a207b594 HPN |
525 | [gcc_cv_header_valgrind_memcheck_h=yes], |
526 | [gcc_cv_header_valgrind_memcheck_h=no]) | |
279a935f RB |
527 | AC_MSG_RESULT($gcc_cv_header_valgrind_memcheck_h) |
528 | AC_MSG_CHECKING(for VALGRIND_DISCARD in <memcheck.h>) | |
529 | AC_PREPROC_IFELSE([AC_LANG_SOURCE( | |
530 | [[#include <memcheck.h> | |
14011ca4 AJ |
531 | #ifndef VALGRIND_DISCARD |
532 | #error VALGRIND_DISCARD not defined | |
f04f1d2c KC |
533 | #endif]])], |
534 | [gcc_cv_header_memcheck_h=yes], | |
535 | [gcc_cv_header_memcheck_h=no]) | |
279a935f RB |
536 | AC_MSG_RESULT($gcc_cv_header_memcheck_h) |
537 | if test $gcc_cv_header_valgrind_memcheck_h = yes; then | |
538 | AC_DEFINE(HAVE_VALGRIND_MEMCHECK_H, 1, | |
539 | [Define if valgrind's valgrind/memcheck.h header is installed.]) | |
540 | fi | |
541 | if test $gcc_cv_header_memcheck_h = yes; then | |
542 | AC_DEFINE(HAVE_MEMCHECK_H, 1, | |
543 | [Define if valgrind's memcheck.h header is installed.]) | |
544 | fi | |
545 | ||
546 | if test x$ac_valgrind_checking != x ; then | |
414d23ae HPN |
547 | AM_PATH_PROG_WITH_TEST(valgrind_path, valgrind, |
548 | [$ac_dir/$ac_word --version | grep valgrind- >/dev/null 2>&1]) | |
a207b594 HPN |
549 | if test "x$valgrind_path" = "x" \ |
550 | || (test $have_valgrind_h = no \ | |
551 | && test $gcc_cv_header_memcheck_h = no \ | |
552 | && test $gcc_cv_header_valgrind_memcheck_h = no); then | |
553 | AC_MSG_ERROR([*** Can't find both valgrind and valgrind/memcheck.h, memcheck.h or valgrind.h]) | |
414d23ae HPN |
554 | fi |
555 | valgrind_path_defines=-DVALGRIND_PATH='\"'$valgrind_path'\"' | |
556 | valgrind_command="$valgrind_path -q" | |
557 | AC_DEFINE(ENABLE_VALGRIND_CHECKING, 1, | |
558 | [Define if you want to run subprograms and generated programs | |
559 | through valgrind (a memory checker). This is extremely expensive.]) | |
560 | fi | |
561 | AC_SUBST(valgrind_path_defines) | |
562 | AC_SUBST(valgrind_command) | |
51d0e20c | 563 | |
22aa533e NS |
564 | # Enable code coverage collection |
565 | AC_ARG_ENABLE(coverage, | |
b88ecf55 AS |
566 | [AS_HELP_STRING([[--enable-coverage[=LEVEL]]], |
567 | [enable compiler's code coverage collection. | |
568 | Use to measure compiler performance and locate | |
569 | unused parts of the compiler. With LEVEL, specify | |
570 | optimization. Values are opt, noopt, | |
571 | default is noopt])], | |
22aa533e | 572 | [case "${enableval}" in |
6dd297da NN |
573 | yes|noopt) |
574 | coverage_flags="-fprofile-arcs -ftest-coverage -frandom-seed=\$@ -O0" | |
575 | ;; | |
576 | opt) | |
577 | coverage_flags="-fprofile-arcs -ftest-coverage -frandom-seed=\$@ -O2" | |
578 | ;; | |
579 | no) | |
580 | # a.k.a. --disable-coverage | |
581 | coverage_flags="" | |
582 | ;; | |
583 | *) | |
584 | AC_MSG_ERROR(unknown coverage setting $enableval) | |
585 | ;; | |
22aa533e | 586 | esac], |
2043c38e | 587 | [coverage_flags=""]) |
22aa533e NS |
588 | AC_SUBST(coverage_flags) |
589 | ||
439a7e54 | 590 | AC_ARG_ENABLE(gather-detailed-mem-stats, |
b88ecf55 AS |
591 | [AS_HELP_STRING([--enable-gather-detailed-mem-stats], |
592 | [enable detailed memory allocation stats gathering])], [], | |
439a7e54 | 593 | [enable_gather_detailed_mem_stats=no]) |
7aa6d18a SB |
594 | gather_stats=`if test $enable_gather_detailed_mem_stats != no; then echo 1; else echo 0; fi` |
595 | AC_DEFINE_UNQUOTED(GATHER_STATISTICS, $gather_stats, | |
596 | [Define to enable detailed memory allocation stats gathering.]) | |
439a7e54 | 597 | |
279a935f RB |
598 | AC_ARG_ENABLE(valgrind-annotations, |
599 | [AS_HELP_STRING([--enable-valgrind-annotations], | |
600 | [enable valgrind runtime interaction])], [], | |
601 | [enable_valgrind_annotations=no]) | |
602 | if test x$enable_valgrind_annotations != xno \ | |
603 | || test x$ac_valgrind_checking != x; then | |
604 | if (test $have_valgrind_h = no \ | |
605 | && test $gcc_cv_header_memcheck_h = no \ | |
606 | && test $gcc_cv_header_valgrind_memcheck_h = no); then | |
607 | AC_MSG_ERROR([*** Can't find valgrind/memcheck.h, memcheck.h or valgrind.h]) | |
608 | fi | |
609 | AC_DEFINE(ENABLE_VALGRIND_ANNOTATIONS, 1, | |
610 | [Define to get calls to the valgrind runtime enabled.]) | |
611 | fi | |
612 | ||
73458fb7 NN |
613 | # ------------------------------- |
614 | # Miscenalleous configure options | |
615 | # ------------------------------- | |
34a86c2b NN |
616 | |
617 | # With stabs | |
618 | AC_ARG_WITH(stabs, | |
b88ecf55 AS |
619 | [AS_HELP_STRING([--with-stabs], |
620 | [arrange to use stabs instead of host debug format])], | |
34a86c2b NN |
621 | stabs="$with_stabs", |
622 | stabs=no) | |
623 | ||
34a86c2b NN |
624 | # Determine whether or not multilibs are enabled. |
625 | AC_ARG_ENABLE(multilib, | |
b88ecf55 AS |
626 | [AS_HELP_STRING([--enable-multilib], |
627 | [enable library support for multiple ABIs])], | |
34a86c2b NN |
628 | [], [enable_multilib=yes]) |
629 | AC_SUBST(enable_multilib) | |
3ecc3258 | 630 | |
e0cdc09f MK |
631 | # Determine whether or not multiarch is enabled. |
632 | AC_ARG_ENABLE(multiarch, | |
633 | [AS_HELP_STRING([--enable-multiarch], | |
634 | [enable support for multiarch paths])], | |
5213f20c MK |
635 | [case "${enableval}" in |
636 | yes|no|auto) enable_multiarch=$enableval;; | |
637 | *) AC_MSG_ERROR(bad value ${enableval} given for --enable-multiarch option) ;; | |
e0cdc09f MK |
638 | esac], [enable_multiarch=auto]) |
639 | if test x${enable_multiarch} = xauto; then | |
640 | if test x${with_native_system_header_dir} != x; then | |
641 | ma_msg_suffix=", disabled auto check (configured with --native-system-header-dir)" | |
642 | enable_multiarch=no | |
643 | fi | |
644 | if test x$host != x$target && test "x$with_sysroot" = x; then | |
645 | ma_msg_suffix=", disabled auto check (cross build configured without --with-sysroot)" | |
646 | enable_multiarch=no | |
647 | fi | |
648 | fi | |
649 | AC_MSG_CHECKING(for multiarch configuration) | |
650 | AC_SUBST(enable_multiarch) | |
651 | AC_MSG_RESULT($enable_multiarch$ma_msg_suffix) | |
652 | ||
653 | # needed for setting the multiarch name for soft-float/hard-float ABIs | |
d757eae9 | 654 | AC_SUBST(with_cpu) |
e0cdc09f MK |
655 | AC_SUBST(with_float) |
656 | ||
4bafaa6f L |
657 | # Enable __cxa_atexit for C++. |
658 | AC_ARG_ENABLE(__cxa_atexit, | |
b88ecf55 | 659 | [AS_HELP_STRING([--enable-__cxa_atexit], [enable __cxa_atexit for C++])], |
4bafaa6f | 660 | [], []) |
2121a768 | 661 | |
486aa804 | 662 | # Enable C extension for decimal float if target supports it. |
3c39bca6 | 663 | GCC_AC_ENABLE_DECIMAL_FLOAT([$target]) |
486aa804 | 664 | |
79b87c74 | 665 | dfp=`if test $enable_decimal_float != no; then echo 1; else echo 0; fi` |
486aa804 BE |
666 | AC_DEFINE_UNQUOTED(ENABLE_DECIMAL_FLOAT, $dfp, |
667 | [Define to 1 to enable decimal float extension to C.]) | |
668 | ||
cc0ae0ca L |
669 | # Use default_decimal_float for dependency. |
670 | enable_decimal_float=$default_decimal_float | |
671 | ||
79b87c74 MM |
672 | bid=`if test $enable_decimal_float = bid; then echo 1; else echo 0; fi` |
673 | AC_DEFINE_UNQUOTED(ENABLE_DECIMAL_BID_FORMAT, $bid, | |
674 | [Define to 1 to specify that we are using the BID decimal floating | |
675 | point format instead of DPD]) | |
676 | ||
ab22c1fa CF |
677 | # Enable C extension for fixed-point arithmetic. |
678 | AC_ARG_ENABLE(fixed-point, | |
b88ecf55 AS |
679 | [AS_HELP_STRING([--enable-fixed-point], |
680 | [enable fixed-point arithmetic extension to C])], | |
681 | [], | |
ab22c1fa CF |
682 | [ |
683 | case $target in | |
655b30bf JB |
684 | arm*) |
685 | enable_fixed_point=yes | |
686 | ;; | |
687 | ||
ab22c1fa | 688 | mips*-*-*) |
b24513a1 | 689 | enable_fixed_point=yes |
ab22c1fa CF |
690 | ;; |
691 | *) | |
84f47d20 | 692 | AC_MSG_WARN([fixed-point is not supported for this target, ignored]) |
ab22c1fa CF |
693 | enable_fixed_point=no |
694 | ;; | |
695 | esac | |
696 | ]) | |
697 | AC_SUBST(enable_fixed_point) | |
698 | ||
699 | fixedpoint=`if test $enable_fixed_point = yes; then echo 1; else echo 0; fi` | |
700 | AC_DEFINE_UNQUOTED(ENABLE_FIXED_POINT, $fixedpoint, | |
701 | [Define to 1 to enable fixed-point arithmetic extension to C.]) | |
702 | ||
0bbb1697 RK |
703 | # Enable threads |
704 | # Pass with no value to take the default | |
705 | # Pass with a value to specify a thread package | |
706 | AC_ARG_ENABLE(threads, | |
b88ecf55 AS |
707 | [AS_HELP_STRING([[--enable-threads[=LIB]]], |
708 | [enable thread usage for target GCC, | |
709 | using LIB thread package])],, | |
615be2cf | 710 | [enable_threads='']) |
0bbb1697 | 711 | |
8dea1cca | 712 | AC_ARG_ENABLE(tls, |
b88ecf55 AS |
713 | [AS_HELP_STRING([--enable-tls], |
714 | [enable or disable generation of tls code | |
715 | overriding the assembler check for tls support])], | |
8dea1cca DD |
716 | [ |
717 | case $enable_tls in | |
718 | yes | no) ;; | |
719 | *) AC_MSG_ERROR(['$enable_tls' is an invalid value for --enable-tls. | |
720 | Valid choices are 'yes' and 'no'.]) ;; | |
721 | esac | |
722 | ], [enable_tls='']) | |
723 | ||
d8bb17c8 | 724 | AC_ARG_ENABLE(objc-gc, |
b88ecf55 AS |
725 | [AS_HELP_STRING([--enable-objc-gc], |
726 | [enable the use of Boehm's garbage collector with | |
727 | the GNU Objective-C runtime])], | |
2618c083 | 728 | if test x$enable_objc_gc = xno; then |
d8bb17c8 OP |
729 | objc_boehm_gc='' |
730 | else | |
731 | objc_boehm_gc=1 | |
732 | fi, | |
733 | objc_boehm_gc='') | |
734 | ||
90e6a802 | 735 | AC_ARG_WITH(dwarf2, |
b88ecf55 | 736 | [AS_HELP_STRING([--with-dwarf2], [force the default debug format to be DWARF 2])], |
87921b81 | 737 | dwarf2="$with_dwarf2", |
90e6a802 RL |
738 | dwarf2=no) |
739 | ||
50503ac8 | 740 | AC_ARG_ENABLE(shared, |
b88ecf55 | 741 | [AS_HELP_STRING([--disable-shared], [don't provide a shared libgcc])], |
c785e0fa AO |
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]) | |
50503ac8 RH |
757 | AC_SUBST(enable_shared) |
758 | ||
08b2bad2 SB |
759 | AC_ARG_WITH([native-system-header-dir], |
760 | [ --with-native-system-header-dir=dir | |
761 | use dir as the directory to look for standard | |
762 | system header files in. Defaults to /usr/include.], | |
763 | [ | |
764 | case ${with_native_system_header_dir} in | |
765 | yes|no) AC_MSG_ERROR([bad value ${withval} given for --with-native-system-header-dir]) ;; | |
766 | /* | [[A-Za-z]]:[[\\/]]*) ;; | |
767 | *) AC_MSG_ERROR([--with-native-system-header-dir argument ${withval} must be an absolute directory]) ;; | |
768 | esac | |
769 | configured_native_system_header_dir="${withval}" | |
770 | ], [configured_native_system_header_dir=]) | |
771 | ||
160633c6 | 772 | AC_ARG_WITH(build-sysroot, |
b88ecf55 | 773 | [AS_HELP_STRING([--with-build-sysroot=sysroot], |
c875f596 DN |
774 | [use sysroot as the system root during the build])], |
775 | [if test x"$withval" != x ; then | |
776 | SYSROOT_CFLAGS_FOR_TARGET="--sysroot=$withval" | |
777 | fi], | |
778 | [SYSROOT_CFLAGS_FOR_TARGET=]) | |
779 | AC_SUBST(SYSROOT_CFLAGS_FOR_TARGET) | |
160633c6 | 780 | |
755e0546 HPN |
781 | if test "x$prefix" = xNONE; then |
782 | test_prefix=/usr/local | |
783 | else | |
784 | test_prefix=$prefix | |
785 | fi | |
786 | if test "x$exec_prefix" = xNONE; then | |
787 | test_exec_prefix=$test_prefix | |
788 | else | |
789 | test_exec_prefix=$exec_prefix | |
790 | fi | |
791 | ||
4977bab6 | 792 | AC_ARG_WITH(sysroot, |
b88ecf55 AS |
793 | [AS_HELP_STRING([[--with-sysroot[=DIR]]], |
794 | [search for usr/lib, usr/include, et al, within DIR])], | |
4977bab6 ZW |
795 | [ |
796 | case ${with_sysroot} in | |
caa55b1e | 797 | yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_noncanonical}/sys-root' ;; |
4977bab6 ZW |
798 | *) TARGET_SYSTEM_ROOT=$with_sysroot ;; |
799 | esac | |
800 | ||
801 | TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"' | |
14da6073 | 802 | CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$${sysroot_headers_suffix}$(NATIVE_SYSTEM_HEADER_DIR)' |
b28250ab | 803 | |
047d636f | 804 | case ${TARGET_SYSTEM_ROOT} in |
91710e62 | 805 | "${test_prefix}"|"${test_prefix}/"*|\ |
748670c2 RS |
806 | "${test_exec_prefix}"|"${test_exec_prefix}/"*|\ |
807 | '${prefix}'|'${prefix}/'*|\ | |
91710e62 | 808 | '${exec_prefix}'|'${exec_prefix}/'*) |
047d636f DJ |
809 | t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE" |
810 | TARGET_SYSTEM_ROOT_DEFINE="$t" | |
811 | ;; | |
812 | esac | |
4977bab6 ZW |
813 | ], [ |
814 | TARGET_SYSTEM_ROOT= | |
db720d9a | 815 | TARGET_SYSTEM_ROOT_DEFINE= |
4977bab6 ZW |
816 | CROSS_SYSTEM_HEADER_DIR='$(gcc_tooldir)/sys-include' |
817 | ]) | |
818 | AC_SUBST(TARGET_SYSTEM_ROOT) | |
819 | AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE) | |
820 | AC_SUBST(CROSS_SYSTEM_HEADER_DIR) | |
821 | ||
e11ddaf5 NS |
822 | AC_ARG_WITH(specs, |
823 | [AS_HELP_STRING([--with-specs=SPECS], | |
824 | [add SPECS to driver command-line processing])], | |
825 | [CONFIGURE_SPECS=$withval], | |
826 | [CONFIGURE_SPECS=] | |
827 | ) | |
828 | AC_SUBST(CONFIGURE_SPECS) | |
829 | ||
2f41c1d6 PB |
830 | ACX_PKGVERSION([GCC]) |
831 | ACX_BUGURL([http://gcc.gnu.org/bugs.html]) | |
832 | ||
e4c9c075 PB |
833 | # Sanity check enable_languages in case someone does not run the toplevel |
834 | # configure # script. | |
835 | AC_ARG_ENABLE(languages, | |
b88ecf55 | 836 | [AS_HELP_STRING([--enable-languages=LIST], [specify which front-ends to build])], |
e4c9c075 PB |
837 | [case ,${enable_languages}, in |
838 | ,,|,yes,) | |
839 | # go safe -- we cannot be much sure without the toplevel | |
840 | # configure's | |
841 | # analysis of which target libs are present and usable | |
842 | enable_languages=c | |
843 | ;; | |
844 | *,all,*) | |
845 | AC_MSG_ERROR([only the toplevel supports --enable-languages=all]) | |
846 | ;; | |
847 | *,c,*) | |
848 | ;; | |
849 | *) | |
850 | enable_languages=c,${enable_languages} | |
851 | ;; | |
852 | esac], | |
853 | [enable_languages=c]) | |
854 | ||
aca600aa | 855 | AC_ARG_WITH(multilib-list, |
17a819cb | 856 | [AS_HELP_STRING([--with-multilib-list], [select multilibs (AArch64, SH and x86-64 only)])], |
aca600aa AS |
857 | :, |
858 | with_multilib_list=default) | |
859 | ||
73458fb7 NN |
860 | # ------------------------- |
861 | # Checks for other programs | |
862 | # ------------------------- | |
61842080 | 863 | |
e9a25f70 JL |
864 | AC_PROG_MAKE_SET |
865 | ||
46f18e7b RK |
866 | # Find some useful tools |
867 | AC_PROG_AWK | |
776dc15d | 868 | # We need awk to create options.c and options.h. |
2c4902b9 NN |
869 | # Bail out if it's missing. |
870 | case ${AWK} in | |
871 | "") AC_MSG_ERROR([can't build without awk, bailing out]) ;; | |
872 | esac | |
873 | ||
99e757d5 | 874 | gcc_AC_PROG_LN_S |
ad6717df | 875 | ACX_PROG_LN($LN_S) |
46f18e7b | 876 | AC_PROG_RANLIB |
10eb188c | 877 | ranlib_flags="" |
343a6100 MM |
878 | AC_SUBST(ranlib_flags) |
879 | ||
99e757d5 | 880 | gcc_AC_PROG_INSTALL |
46f18e7b | 881 | |
3a000df0 KC |
882 | # See if cmp has --ignore-initial. |
883 | gcc_AC_PROG_CMP_IGNORE_INITIAL | |
884 | ||
955be633 JM |
885 | # See if we have the mktemp command. |
886 | AC_CHECK_PROG(have_mktemp_command, mktemp, yes, no) | |
887 | ||
7c27e184 PB |
888 | # See if makeinfo has been installed and is modern enough |
889 | # that we can use it. | |
3bbd5a19 | 890 | ACX_CHECK_PROG_VER(MAKEINFO, makeinfo, --version, |
09fa0705 | 891 | [GNU texinfo.* \([0-9][0-9.]*\)], |
7326a39e | 892 | [4.[7-9]*|4.[1-9][0-9]*|[5-9]*|[1-9][0-9]*]) |
09fa0705 ZW |
893 | if test $gcc_cv_prog_makeinfo_modern = no; then |
894 | AC_MSG_WARN([ | |
895 | *** Makeinfo is missing or too old. | |
17db6582 | 896 | *** Info documentation will not be built.]) |
09fa0705 | 897 | BUILD_INFO= |
09fa0705 | 898 | else |
7c27e184 | 899 | BUILD_INFO=info |
09fa0705 | 900 | fi |
7c27e184 | 901 | AC_SUBST(BUILD_INFO) |
09fa0705 | 902 | |
3f896fc2 JM |
903 | # Is pod2man recent enough to regenerate manpages? |
904 | AC_MSG_CHECKING([for recent Pod::Man]) | |
7be33370 | 905 | if (perl -e 'use 1.10 Pod::Man') >/dev/null 2>&1; then |
fd939e46 | 906 | AC_MSG_RESULT(yes) |
7c27e184 | 907 | GENERATED_MANPAGES=generated-manpages |
fd939e46 JM |
908 | else |
909 | AC_MSG_RESULT(no) | |
910 | GENERATED_MANPAGES= | |
911 | fi | |
7c27e184 | 912 | AC_SUBST(GENERATED_MANPAGES) |
fd939e46 | 913 | |
3bbd5a19 PB |
914 | MISSING="${CONFIG_SHELL-/bin/sh} $ac_aux_dir/missing" |
915 | ||
1e608388 ZW |
916 | # How about lex? |
917 | dnl Don't use AC_PROG_LEX; we insist on flex. | |
918 | dnl LEXLIB is not useful in gcc. | |
7c27e184 | 919 | AC_CHECK_PROGS([FLEX], flex, [$MISSING flex]) |
1e608388 ZW |
920 | |
921 | # Bison? | |
7c27e184 PB |
922 | AC_CHECK_PROGS([BISON], bison, [$MISSING bison]) |
923 | ||
924 | # Binutils are not build modules, unlike bison/flex/makeinfo. So we | |
925 | # check for build == host before using them. | |
1e608388 | 926 | |
f6a874ac | 927 | # NM |
414adbdd GK |
928 | if test x${build} = x${host} && test -f $srcdir/../binutils/nm.c \ |
929 | && test -d ../binutils ; then | |
bfa912a8 | 930 | NM='${objdir}/../binutils/nm-new' |
f6a874ac JW |
931 | else |
932 | AC_CHECK_PROG(NM, nm, nm, ${CONFIG_SHELL-/bin/sh} ${srcdir}/../missing nm) | |
933 | fi | |
934 | ||
935 | # AR | |
414adbdd GK |
936 | if test x${build} = x${host} && test -f $srcdir/../binutils/ar.c \ |
937 | && test -d ../binutils ; then | |
bfa912a8 | 938 | AR='${objdir}/../binutils/ar' |
f6a874ac JW |
939 | else |
940 | AC_CHECK_PROG(AR, ar, ar, ${CONFIG_SHELL-/bin/sh} ${srcdir}/../missing ar) | |
941 | fi | |
942 | ||
943 | ||
73458fb7 NN |
944 | # -------------------- |
945 | # Checks for C headers | |
946 | # -------------------- | |
947 | ||
ca9bc441 NN |
948 | # Need to reject headers which give warnings, so that the -Werror bootstrap |
949 | # works later. *sigh* This needs to come before all header checks. | |
950 | AC_PROG_CPP_WERROR | |
951 | ||
73458fb7 NN |
952 | AC_HEADER_STDC |
953 | AC_HEADER_TIME | |
4f4e53dd | 954 | ACX_HEADER_STRING |
73458fb7 | 955 | AC_HEADER_SYS_WAIT |
c68a6e08 | 956 | AC_HEADER_TIOCGWINSZ |
dfb77e37 | 957 | AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h iconv.h \ |
1072ec3f | 958 | fcntl.h unistd.h sys/file.h sys/time.h sys/mman.h \ |
73458fb7 | 959 | sys/resource.h sys/param.h sys/times.h sys/stat.h \ |
4fbfcf44 | 960 | direct.h malloc.h langinfo.h ldfcn.h locale.h wchar.h) |
73458fb7 NN |
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 | |
9791c75c | 968 | AC_C_BIGENDIAN |
73458fb7 | 969 | |
5427046f ILT |
970 | # ---------------------- |
971 | # Checks for C++ headers | |
972 | # ---------------------- | |
973 | ||
c658f0ce ILT |
974 | dnl Autoconf will give an error in the configure script if there is no |
975 | dnl C++ preprocessor. Hack to prevent that. | |
976 | m4_pushdef([AC_MSG_ERROR], m4_defn([AC_MSG_WARN]))[]dnl | |
977 | AC_PROG_CXXCPP | |
978 | m4_popdef([AC_MSG_ERROR])[]dnl | |
979 | ||
5427046f ILT |
980 | AC_LANG_PUSH(C++) |
981 | ||
982 | AC_CHECK_HEADERS(unordered_map) | |
983 | AC_CHECK_HEADERS(tr1/unordered_map) | |
984 | AC_CHECK_HEADERS(ext/hash_map) | |
985 | ||
986 | AC_LANG_POP(C++) | |
043378c3 TT |
987 | |
988 | # -------- | |
989 | # Dependency checking. | |
990 | # -------- | |
991 | ||
992 | AC_LANG_PUSH(C++) | |
993 | ZW_CREATE_DEPDIR | |
994 | AC_CONFIG_COMMANDS([gccdepdir],[ | |
995 | ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/mkinstalldirs build/$DEPDIR | |
996 | for lang in $subdirs c-family common | |
997 | do | |
998 | ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/mkinstalldirs $lang/$DEPDIR | |
999 | done], [subdirs="$subdirs" ac_aux_dir=$ac_aux_dir DEPDIR=$DEPDIR]) | |
1000 | ||
54c09437 | 1001 | ZW_PROG_COMPILER_DEPENDENCIES([CXX]) |
043378c3 | 1002 | AC_LANG_POP(C++) |
5427046f | 1003 | |
73458fb7 NN |
1004 | # -------- |
1005 | # UNSORTED | |
1006 | # -------- | |
1007 | ||
73458fb7 | 1008 | |
4e70264f ZW |
1009 | # These libraries may be used by collect2. |
1010 | # We may need a special search path to get them linked. | |
1011 | AC_CACHE_CHECK(for collect2 libraries, gcc_cv_collect2_libs, | |
1012 | [save_LIBS="$LIBS" | |
7f2749d4 | 1013 | for libs in '' -lld -lmld \ |
4e70264f ZW |
1014 | '-L/usr/lib/cmplrs/cc2.11 -lmld' \ |
1015 | '-L/usr/lib/cmplrs/cc3.11 -lmld' | |
1016 | do | |
1017 | LIBS="$libs" | |
1018 | AC_TRY_LINK_FUNC(ldopen, | |
1019 | [gcc_cv_collect2_libs="$libs"; break]) | |
1020 | done | |
1021 | LIBS="$save_LIBS" | |
1022 | test -z "$gcc_cv_collect2_libs" && gcc_cv_collect2_libs='none required']) | |
1023 | case $gcc_cv_collect2_libs in | |
1024 | "none required") ;; | |
1025 | *) COLLECT2_LIBS=$gcc_cv_collect2_libs ;; | |
1026 | esac | |
1027 | AC_SUBST(COLLECT2_LIBS) | |
1028 | ||
7f2749d4 RK |
1029 | # When building Ada code on Alpha, we need exc_resume which is usually in |
1030 | # -lexc. So test for it. | |
1031 | save_LIBS="$LIBS" | |
1032 | LIBS= | |
1033 | AC_SEARCH_LIBS(exc_resume, exc) | |
1034 | GNAT_LIBEXC="$LIBS" | |
1035 | LIBS="$save_LIBS" | |
1036 | AC_SUBST(GNAT_LIBEXC) | |
1037 | ||
e3b3fa45 RO |
1038 | # To support -mcpu=native on Solaris/SPARC, we need libkstat. |
1039 | save_LIBS="$LIBS" | |
1040 | LIBS= | |
1041 | AC_SEARCH_LIBS(kstat_open, kstat) | |
1042 | EXTRA_GCC_LIBS="$LIBS" | |
1043 | LIBS="$save_LIBS" | |
1044 | AC_SUBST(EXTRA_GCC_LIBS) | |
1045 | ||
62c9aa5f ZW |
1046 | # Some systems put ldexp and frexp in libm instead of libc; assume |
1047 | # they're both in the same place. jcf-dump needs them. | |
1048 | save_LIBS="$LIBS" | |
1049 | LIBS= | |
1050 | AC_SEARCH_LIBS(ldexp, m) | |
1051 | LDEXP_LIB="$LIBS" | |
1052 | LIBS="$save_LIBS" | |
1053 | AC_SUBST(LDEXP_LIB) | |
1054 | ||
7636d567 JW |
1055 | # Use <inttypes.h> only if it exists, |
1056 | # doesn't clash with <sys/types.h>, and declares intmax_t. | |
1057 | AC_MSG_CHECKING(for inttypes.h) | |
1058 | AC_CACHE_VAL(gcc_cv_header_inttypes_h, | |
f04f1d2c KC |
1059 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM( |
1060 | [[#include <sys/types.h> | |
1061 | #include <inttypes.h>]], | |
1062 | [[intmax_t i = -1;]])], | |
9da0e39b | 1063 | [gcc_cv_header_inttypes_h=yes], |
f04f1d2c | 1064 | [gcc_cv_header_inttypes_h=no])]) |
7636d567 | 1065 | AC_MSG_RESULT($gcc_cv_header_inttypes_h) |
9da0e39b | 1066 | if test $gcc_cv_header_inttypes_h = yes; then |
119d24d1 KG |
1067 | AC_DEFINE(HAVE_INTTYPES_H, 1, |
1068 | [Define if you have a working <inttypes.h> header file.]) | |
9da0e39b | 1069 | fi |
cdcc6a01 | 1070 | |
9612ab65 ZW |
1071 | dnl Disabled until we have a complete test for buggy enum bitfields. |
1072 | dnl gcc_AC_C_ENUM_BF_UNSIGNED | |
c149cc37 | 1073 | |
0d667716 KG |
1074 | define(gcc_UNLOCKED_FUNCS, clearerr_unlocked feof_unlocked dnl |
1075 | ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked dnl | |
1076 | fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked dnl | |
1077 | fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked dnl | |
1078 | putchar_unlocked putc_unlocked) | |
52a6edcc | 1079 | AC_CHECK_FUNCS(times clock kill getrlimit setrlimit atoll atoq \ |
d2e506f2 | 1080 | sysconf strsignal getrusage nl_langinfo \ |
71f3e391 | 1081 | gettimeofday mbstowcs wcswidth mmap setlocale \ |
711a3d82 | 1082 | gcc_UNLOCKED_FUNCS madvise) |
a81fb89e | 1083 | |
39f6c4c8 KW |
1084 | if test x$ac_cv_func_mbstowcs = xyes; then |
1085 | AC_CACHE_CHECK(whether mbstowcs works, gcc_cv_func_mbstowcs_works, | |
f04f1d2c | 1086 | [ AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdlib.h> |
39f6c4c8 KW |
1087 | int main() |
1088 | { | |
1089 | mbstowcs(0, "", 0); | |
1090 | return 0; | |
f04f1d2c KC |
1091 | }]])], |
1092 | [gcc_cv_func_mbstowcs_works=yes], | |
1093 | [gcc_cv_func_mbstowcs_works=no], | |
1094 | [gcc_cv_func_mbstowcs_works=yes])]) | |
39f6c4c8 KW |
1095 | if test x$gcc_cv_func_mbstowcs_works = xyes; then |
1096 | AC_DEFINE(HAVE_WORKING_MBSTOWCS, 1, | |
1097 | [Define this macro if mbstowcs does not crash when its | |
1098 | first argument is NULL.]) | |
1099 | fi | |
1100 | fi | |
1101 | ||
78c9cb99 | 1102 | AC_CHECK_TYPE(ssize_t, int) |
bba09b5a | 1103 | AC_CHECK_TYPE(caddr_t, char *) |
56f48ce9 | 1104 | |
2f6935f4 | 1105 | GCC_AC_FUNC_MMAP_BLACKLIST |
b27d2bd5 MK |
1106 | |
1107 | case "${host}" in | |
ee262b6f | 1108 | *-*-*vms*) |
2c55543b | 1109 | # Under VMS, vfork works very differently than on Unix. The standard test |
ee262b6f DR |
1110 | # won't work, and it isn't easily adaptable. It makes more sense to |
1111 | # just force it. | |
1112 | ac_cv_func_vfork_works=yes | |
1113 | ;; | |
b27d2bd5 | 1114 | esac |
f04f1d2c | 1115 | AC_FUNC_FORK |
f1b54f9b | 1116 | |
5b6d595b RO |
1117 | # g++ on Solaris 10+ defines _XOPEN_SOURCE=600, which exposes a different |
1118 | # iconv() prototype. | |
0823efed DN |
1119 | AC_LANG_PUSH([C++]) |
1120 | AM_ICONV | |
1121 | AC_LANG_POP([C++]) | |
5b6d595b | 1122 | |
56694dd9 ZW |
1123 | # Until we have in-tree GNU iconv: |
1124 | LIBICONV_DEP= | |
1125 | AC_SUBST(LIBICONV_DEP) | |
1126 | ||
1127 | AM_LC_MESSAGES | |
f91abfce | 1128 | |
a03ea89b BM |
1129 | AM_LANGINFO_CODESET |
1130 | ||
86cf1cbd KG |
1131 | # We will need to find libiberty.h and ansidecl.h |
1132 | saved_CFLAGS="$CFLAGS" | |
b8f6a302 | 1133 | CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include $GMPINC" |
87fb500b | 1134 | saved_CXXFLAGS="$CXXFLAGS" |
b8f6a302 | 1135 | CXXFLAGS="$CXXFLAGS -I${srcdir} -I${srcdir}/../include $GMPINC" |
ed5b9f96 | 1136 | gcc_AC_CHECK_DECLS(getenv atol asprintf sbrk abort atof getcwd getwd \ |
123cd463 | 1137 | strsignal strstr stpcpy strverscmp \ |
ed5b9f96 | 1138 | errno snprintf vsnprintf vasprintf malloc realloc calloc \ |
19f75783 | 1139 | free basename getopt clock getpagesize ffs gcc_UNLOCKED_FUNCS, , ,[ |
d02af173 | 1140 | #include "ansidecl.h" |
86cf1cbd | 1141 | #include "system.h"]) |
c5c76735 | 1142 | |
f31e826b | 1143 | gcc_AC_CHECK_DECLS(getrlimit setrlimit getrusage, , ,[ |
d02af173 | 1144 | #include "ansidecl.h" |
86cf1cbd | 1145 | #include "system.h" |
d2cabf16 KG |
1146 | #ifdef HAVE_SYS_RESOURCE_H |
1147 | #include <sys/resource.h> | |
1148 | #endif | |
1149 | ]) | |
1150 | ||
f04f1d2c | 1151 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
b2522d2b HPN |
1152 | #include "ansidecl.h" |
1153 | #include "system.h" | |
1154 | #ifdef HAVE_SYS_RESOURCE_H | |
1155 | #include <sys/resource.h> | |
1156 | #endif | |
f04f1d2c | 1157 | ]], [[rlim_t l = 0;]])],[],[AC_DEFINE([rlim_t],[long], |
236ec2d7 | 1158 | [Define to `long' if <sys/resource.h> doesn't define.])]) |
b2522d2b | 1159 | |
2102b2fe RS |
1160 | # On AIX 5.2, <ldfcn.h> conflicts with <fcntl.h>, as both define incompatible |
1161 | # FREAD and FWRITE macros. Fortunately, for GCC's single usage of ldgetname | |
1162 | # in collect2.c, <fcntl.h> isn't visible, but the configure test below needs | |
1163 | # to undef these macros to get the correct value for HAVE_DECL_LDGETNAME. | |
351df804 KG |
1164 | gcc_AC_CHECK_DECLS(ldgetname, , ,[ |
1165 | #include "ansidecl.h" | |
1166 | #include "system.h" | |
1167 | #ifdef HAVE_LDFCN_H | |
2102b2fe RS |
1168 | #undef FREAD |
1169 | #undef FWRITE | |
351df804 KG |
1170 | #include <ldfcn.h> |
1171 | #endif | |
1172 | ]) | |
1173 | ||
c1800ec8 ZW |
1174 | gcc_AC_CHECK_DECLS(times, , ,[ |
1175 | #include "ansidecl.h" | |
1176 | #include "system.h" | |
1177 | #ifdef HAVE_SYS_TIMES_H | |
1178 | #include <sys/times.h> | |
1179 | #endif | |
1180 | ]) | |
1181 | ||
4f6d8cc8 GK |
1182 | gcc_AC_CHECK_DECLS(sigaltstack, , ,[ |
1183 | #include "ansidecl.h" | |
1184 | #include "system.h" | |
1185 | #include <signal.h> | |
1186 | ]) | |
1187 | ||
87fb500b RO |
1188 | # g++ on Solaris 10+ defines _XOPEN_SOURCE=600, which hides the madvise() |
1189 | # prototype. | |
0823efed DN |
1190 | AC_LANG_PUSH([C++]) |
1191 | gcc_AC_CHECK_DECLS(madvise, , ,[ | |
1192 | #include "ansidecl.h" | |
1193 | #include "system.h" | |
87fb500b | 1194 | ]) |
0823efed | 1195 | AC_LANG_POP([C++]) |
87fb500b | 1196 | |
c1800ec8 ZW |
1197 | # More time-related stuff. |
1198 | AC_CACHE_CHECK(for struct tms, ac_cv_struct_tms, [ | |
f04f1d2c | 1199 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
c1800ec8 ZW |
1200 | #include "ansidecl.h" |
1201 | #include "system.h" | |
1202 | #ifdef HAVE_SYS_TIMES_H | |
1203 | #include <sys/times.h> | |
1204 | #endif | |
f04f1d2c | 1205 | ]], [[struct tms tms;]])],[ac_cv_struct_tms=yes],[ac_cv_struct_tms=no])]) |
c1800ec8 ZW |
1206 | if test $ac_cv_struct_tms = yes; then |
1207 | AC_DEFINE(HAVE_STRUCT_TMS, 1, | |
1208 | [Define if <sys/times.h> defines struct tms.]) | |
1209 | fi | |
1210 | ||
1211 | # use gcc_cv_* here because this doesn't match the behavior of AC_CHECK_TYPE. | |
1212 | # revisit after autoconf 2.50. | |
1213 | AC_CACHE_CHECK(for clock_t, gcc_cv_type_clock_t, [ | |
f04f1d2c | 1214 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
c1800ec8 ZW |
1215 | #include "ansidecl.h" |
1216 | #include "system.h" | |
f04f1d2c | 1217 | ]], [[clock_t x;]])],[gcc_cv_type_clock_t=yes],[gcc_cv_type_clock_t=no])]) |
c1800ec8 ZW |
1218 | if test $gcc_cv_type_clock_t = yes; then |
1219 | AC_DEFINE(HAVE_CLOCK_T, 1, | |
1220 | [Define if <time.h> defines clock_t.]) | |
1221 | fi | |
1222 | ||
c1736aea TJ |
1223 | # Check if F_SETLKW is supported by fcntl. |
1224 | AC_CACHE_CHECK(for F_SETLKW, ac_cv_f_setlkw, [ | |
1225 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
1226 | #include <fcntl.h>]], [[ | |
1227 | struct flock fl; | |
1228 | fl.l_whence = 0; | |
1229 | fl.l_start = 0; | |
1230 | fl.l_len = 0; | |
1231 | fl.l_pid = 0; | |
1232 | return fcntl (1, F_SETLKW, &fl);]])], | |
1233 | [ac_cv_f_setlkw=yes],[ac_cv_f_setlkw=no])]) | |
1234 | if test $ac_cv_f_setlkw = yes; then | |
1235 | AC_DEFINE(HOST_HAS_F_SETLKW, 1, | |
1236 | [Define if F_SETLKW supported by fcntl.]) | |
1237 | fi | |
1238 | ||
87fb500b | 1239 | # Restore CFLAGS, CXXFLAGS from before the gcc_AC_NEED_DECLARATIONS tests. |
86cf1cbd | 1240 | CFLAGS="$saved_CFLAGS" |
87fb500b | 1241 | CXXFLAGS="$saved_CXXFLAGS" |
86cf1cbd | 1242 | |
75923b2f | 1243 | # mkdir takes a single argument on some systems. |
99e757d5 | 1244 | gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG |
75923b2f | 1245 | |
46f18e7b RK |
1246 | # File extensions |
1247 | manext='.1' | |
1248 | objext='.o' | |
46f18e7b RK |
1249 | AC_SUBST(manext) |
1250 | AC_SUBST(objext) | |
46f18e7b | 1251 | |
4977bab6 ZW |
1252 | # With Setjmp/Longjmp based exception handling. |
1253 | AC_ARG_ENABLE(sjlj-exceptions, | |
b88ecf55 AS |
1254 | [AS_HELP_STRING([--enable-sjlj-exceptions], |
1255 | [arrange to use setjmp/longjmp exception handling])], | |
399fe3e1 JDA |
1256 | [case $target in |
1257 | *-*-hpux10*) | |
1258 | if test $enableval != yes; then | |
1259 | AC_MSG_WARN([dwarf2 exceptions not supported, sjlj exceptions forced]) | |
1260 | enableval=yes | |
1261 | fi | |
1262 | ;; | |
1263 | esac | |
1264 | force_sjlj_exceptions=yes], | |
1265 | [case $target in | |
1266 | *-*-hpux10*) | |
1267 | force_sjlj_exceptions=yes | |
1268 | enableval=yes | |
1269 | ;; | |
9b0af790 JB |
1270 | lm32*-*-*) |
1271 | force_sjlj_exceptions=yes | |
1272 | enableval=yes | |
1273 | ;; | |
399fe3e1 JDA |
1274 | *) |
1275 | force_sjlj_exceptions=no | |
1276 | ;; | |
1277 | esac]) | |
1278 | if test $force_sjlj_exceptions = yes; then | |
1279 | sjlj=`if test $enableval = yes; then echo 1; else echo 0; fi` | |
1280 | AC_DEFINE_UNQUOTED(CONFIG_SJLJ_EXCEPTIONS, $sjlj, | |
1281 | [Define 0/1 to force the choice for exception handling model.]) | |
1282 | fi | |
4977bab6 | 1283 | |
34a86c2b NN |
1284 | # -------------------------------------------------------- |
1285 | # Build, host, and target specific configuration fragments | |
1286 | # -------------------------------------------------------- | |
1287 | ||
5b28c537 NN |
1288 | # Collect build-machine-specific information. |
1289 | . ${srcdir}/config.build | |
1290 | ||
a89ea0df NN |
1291 | # Collect host-machine-specific information. |
1292 | . ${srcdir}/config.host | |
1293 | ||
ef69da62 | 1294 | target_gtfiles= |
a89ea0df NN |
1295 | |
1296 | # Collect target-machine-specific information. | |
b01bc573 | 1297 | . ${srcdir}/config.gcc |
46f18e7b RK |
1298 | |
1299 | extra_objs="${host_extra_objs} ${extra_objs}" | |
30500d84 | 1300 | extra_gcc_objs="${host_extra_gcc_objs} ${extra_gcc_objs}" |
46f18e7b RK |
1301 | |
1302 | # Default the target-machine variables that were not explicitly set. | |
75bffa71 | 1303 | if test x"$tm_file" = x |
46f18e7b RK |
1304 | then tm_file=$cpu_type/$cpu_type.h; fi |
1305 | ||
6b2adea9 | 1306 | if test x"$extra_headers" = x |
46f18e7b RK |
1307 | then extra_headers=; fi |
1308 | ||
75bffa71 | 1309 | if test x$md_file = x |
e98e406f | 1310 | then md_file=$cpu_type/$cpu_type.md; fi |
46f18e7b | 1311 | |
75bffa71 | 1312 | if test x$out_file = x |
46f18e7b RK |
1313 | then out_file=$cpu_type/$cpu_type.c; fi |
1314 | ||
75bffa71 | 1315 | if test x"$tmake_file" = x |
46f18e7b RK |
1316 | then tmake_file=$cpu_type/t-$cpu_type |
1317 | fi | |
1318 | ||
e9c9f128 JJ |
1319 | # Support --enable-initfini-array. |
1320 | if test x$enable_initfini_array != xno; then | |
1321 | tm_file="${tm_file} initfini-array.h" | |
1322 | fi | |
1323 | ||
90e6a802 | 1324 | if test x"$dwarf2" = xyes |
756ee602 | 1325 | then tm_file="$tm_file tm-dwarf2.h" |
90e6a802 RL |
1326 | fi |
1327 | ||
46f18e7b | 1328 | # Say what files are being used for the output code and MD file. |
11642c3a | 1329 | echo "Using \`$srcdir/config/$out_file' for machine-specific logic." |
46f18e7b RK |
1330 | echo "Using \`$srcdir/config/$md_file' as machine description file." |
1331 | ||
11642c3a | 1332 | # If any of the xm_file variables contain nonexistent files, warn |
4dc0535b ZW |
1333 | # about them and drop them. |
1334 | ||
11642c3a ZW |
1335 | bx= |
1336 | for x in $build_xm_file; do | |
1337 | if test -f $srcdir/config/$x | |
1338 | then bx="$bx $x" | |
11642c3a ZW |
1339 | else AC_MSG_WARN($srcdir/config/$x does not exist.) |
1340 | fi | |
1341 | done | |
1342 | build_xm_file="$bx" | |
1343 | ||
1344 | hx= | |
1345 | for x in $host_xm_file; do | |
1346 | if test -f $srcdir/config/$x | |
1347 | then hx="$hx $x" | |
11642c3a ZW |
1348 | else AC_MSG_WARN($srcdir/config/$x does not exist.) |
1349 | fi | |
1350 | done | |
1351 | host_xm_file="$hx" | |
1352 | ||
1353 | tx= | |
1354 | for x in $xm_file; do | |
1355 | if test -f $srcdir/config/$x | |
1356 | then tx="$tx $x" | |
11642c3a ZW |
1357 | else AC_MSG_WARN($srcdir/config/$x does not exist.) |
1358 | fi | |
1359 | done | |
1360 | xm_file="$tx" | |
1361 | ||
46f18e7b RK |
1362 | count=a |
1363 | for f in $tm_file; do | |
1364 | count=${count}x | |
1365 | done | |
75bffa71 | 1366 | if test $count = ax; then |
46f18e7b RK |
1367 | echo "Using \`$srcdir/config/$tm_file' as target machine macro file." |
1368 | else | |
1369 | echo "Using the following target machine macro files:" | |
1370 | for f in $tm_file; do | |
1371 | echo " $srcdir/config/$f" | |
1372 | done | |
1373 | fi | |
1374 | ||
99fa8911 AP |
1375 | if test x$use_long_long_for_widest_fast_int = xyes; then |
1376 | AC_DEFINE(USE_LONG_LONG_FOR_WIDEST_FAST_INT, 1, | |
1377 | [Define to 1 if the 'long long' (or '__int64') is wider than 'long' but still | |
1378 | efficiently supported by the host hardware.]) | |
1379 | fi | |
1380 | ||
b993039f EB |
1381 | gnu_ld_bool=`if test x"$gnu_ld" = x"yes"; then echo 1; else echo 0; fi` |
1382 | AC_DEFINE_UNQUOTED(HAVE_GNU_LD, $gnu_ld_bool, [Define to 1 if using GNU ld.]) | |
1383 | ||
1384 | gnu_as_bool=`if test x"$gas" = x"yes"; then echo 1; else echo 0; fi` | |
1385 | AC_DEFINE_UNQUOTED(HAVE_GNU_AS, $gnu_as_bool, [Define to 1 if using GNU as.]) | |
1386 | ||
46f18e7b RK |
1387 | count=a |
1388 | for f in $host_xm_file; do | |
1389 | count=${count}x | |
1390 | done | |
11642c3a ZW |
1391 | if test $count = a; then |
1392 | : | |
1393 | elif test $count = ax; then | |
46f18e7b RK |
1394 | echo "Using \`$srcdir/config/$host_xm_file' as host machine macro file." |
1395 | else | |
1396 | echo "Using the following host machine macro files:" | |
1397 | for f in $host_xm_file; do | |
1398 | echo " $srcdir/config/$f" | |
1399 | done | |
1400 | fi | |
476d9098 | 1401 | echo "Using ${out_host_hook_obj} for host machine hooks." |
46f18e7b | 1402 | |
75bffa71 | 1403 | if test "$host_xm_file" != "$build_xm_file"; then |
46f18e7b RK |
1404 | count=a |
1405 | for f in $build_xm_file; do | |
1406 | count=${count}x | |
1407 | done | |
11642c3a ZW |
1408 | if test $count = a; then |
1409 | : | |
1410 | elif test $count = ax; then | |
46f18e7b RK |
1411 | echo "Using \`$srcdir/config/$build_xm_file' as build machine macro file." |
1412 | else | |
1413 | echo "Using the following build machine macro files:" | |
1414 | for f in $build_xm_file; do | |
1415 | echo " $srcdir/config/$f" | |
1416 | done | |
1417 | fi | |
1418 | fi | |
1419 | ||
08b2bad2 SB |
1420 | if test -n "$configured_native_system_header_dir"; then |
1421 | native_system_header_dir=$configured_native_system_header_dir | |
1422 | fi | |
1423 | NATIVE_SYSTEM_HEADER_DIR="$native_system_header_dir" | |
1424 | AC_SUBST(NATIVE_SYSTEM_HEADER_DIR) | |
1425 | ||
4f6d8cc8 | 1426 | case ${host} in |
b8ec3cc8 | 1427 | powerpc*-*-darwin*) |
4f6d8cc8 GK |
1428 | AC_CACHE_CHECK([whether mcontext_t fields have underscores], |
1429 | gcc_cv_mcontext_underscores, | |
1430 | AC_COMPILE_IFELSE([ | |
ba7da42a | 1431 | #include <sys/cdefs.h> |
de4fb767 | 1432 | #include <sys/signal.h> |
4f6d8cc8 GK |
1433 | #include <ucontext.h> |
1434 | int main() { mcontext_t m; if (m->ss.srr0) return 0; return 0; } | |
1435 | ], | |
1436 | gcc_cv_mcontext_underscores=no, gcc_cv_mcontext_underscores=yes)) | |
1437 | if test $gcc_cv_mcontext_underscores = yes; then | |
1438 | AC_DEFINE(HAS_MCONTEXT_T_UNDERSCORES,,dnl | |
1439 | [mcontext_t fields start with __]) | |
1440 | fi | |
1441 | ;; | |
1442 | esac | |
1443 | ||
8bb915b6 NN |
1444 | # --------- |
1445 | # Threading | |
1446 | # --------- | |
1447 | ||
c2e494a8 | 1448 | # Check if a valid thread package |
615be2cf | 1449 | case ${enable_threads} in |
c2e494a8 NN |
1450 | "" | no) |
1451 | # No threads | |
1452 | target_thread_file='single' | |
1453 | ;; | |
1454 | yes) | |
1455 | # default | |
1456 | target_thread_file='single' | |
1457 | ;; | |
ddaad3c8 | 1458 | aix | dce | lynx | mipssde | posix | rtems | \ |
da90c957 | 1459 | single | tpf | vxworks | win32) |
615be2cf | 1460 | target_thread_file=${enable_threads} |
c2e494a8 NN |
1461 | ;; |
1462 | *) | |
615be2cf | 1463 | echo "${enable_threads} is an unknown thread package" 1>&2 |
c2e494a8 NN |
1464 | exit 1 |
1465 | ;; | |
1466 | esac | |
1467 | ||
1468 | if test x${thread_file} = x; then | |
1469 | # No thread file set by target-specific clauses in config.gcc, | |
1470 | # so use file chosen by default logic above | |
1471 | thread_file=${target_thread_file} | |
46f18e7b | 1472 | fi |
46f18e7b | 1473 | |
8bb915b6 NN |
1474 | # -------- |
1475 | # UNSORTED | |
1476 | # -------- | |
1477 | ||
18fbf599 | 1478 | use_cxa_atexit=no |
2121a768 JT |
1479 | if test x$enable___cxa_atexit = xyes || \ |
1480 | test x$enable___cxa_atexit = x -a x$default_use_cxa_atexit = xyes; then | |
18fbf599 | 1481 | if test x$host = x$target; then |
97388150 DS |
1482 | case $host in |
1483 | # mingw32 doesn't have __cxa_atexit but uses atexit registration | |
1484 | # keyed to flag_use_cxa_atexit | |
1485 | *-*-mingw32*) | |
1486 | use_cxa_atexit=yes | |
1487 | ;; | |
99113dff DE |
1488 | powerpc-ibm-aix*) |
1489 | use_cxa_atexit=yes | |
1490 | ;; | |
97388150 DS |
1491 | *) |
1492 | AC_CHECK_FUNC(__cxa_atexit,[use_cxa_atexit=yes], | |
1493 | [echo "__cxa_atexit can't be enabled on this target"]) | |
5f60e48f | 1494 | ;; |
97388150 | 1495 | esac |
18fbf599 PB |
1496 | else |
1497 | # We can't check for __cxa_atexit when building a cross, so assume | |
1498 | # it is available | |
1499 | use_cxa_atexit=yes | |
1500 | fi | |
1501 | if test x$use_cxa_atexit = xyes; then | |
c7b5e395 | 1502 | AC_DEFINE(DEFAULT_USE_CXA_ATEXIT, 2, |
18fbf599 PB |
1503 | [Define if you want to use __cxa_atexit, rather than atexit, to |
1504 | register C++ destructors for local statics and global objects. | |
1505 | This is essential for fully standards-compliant handling of | |
1506 | destructors, but requires __cxa_atexit in libc.]) | |
1507 | fi | |
2121a768 JT |
1508 | fi |
1509 | ||
a5381466 | 1510 | # Look for a file containing extra machine modes. |
1c0ca89d ZW |
1511 | if test -n "$extra_modes" && test -f $srcdir/config/$extra_modes; then |
1512 | extra_modes_file='$(srcdir)'/config/${extra_modes} | |
a5381466 | 1513 | AC_SUBST(extra_modes_file) |
e22340b0 | 1514 | AC_DEFINE_UNQUOTED(EXTRA_MODES_FILE, "config/$extra_modes", |
a5381466 ZW |
1515 | [Define to the name of a file containing a list of extra machine modes |
1516 | for this architecture.]) | |
a5381466 ZW |
1517 | fi |
1518 | ||
75685792 RS |
1519 | # Convert extra_options into a form suitable for Makefile use. |
1520 | extra_opt_files= | |
fd438373 | 1521 | all_opt_files= |
75685792 RS |
1522 | for f in $extra_options; do |
1523 | extra_opt_files="$extra_opt_files \$(srcdir)/config/$f" | |
fd438373 | 1524 | all_opt_files="$all_opt_files $srcdir/config/$f" |
75685792 RS |
1525 | done |
1526 | AC_SUBST(extra_opt_files) | |
1527 | ||
b7cb92ad | 1528 | # auto-host.h is the file containing items generated by autoconf and is |
e9a25f70 | 1529 | # the first file included by config.h. |
4977bab6 | 1530 | # If host=build, it is correct to have bconfig include auto-host.h |
db81d74a RH |
1531 | # as well. If host!=build, we are in error and need to do more |
1532 | # work to find out the build config parameters. | |
75bffa71 | 1533 | if test x$host = x$build |
db81d74a | 1534 | then |
eaf4e618 | 1535 | build_auto=auto-host.h |
b7cb92ad JL |
1536 | else |
1537 | # We create a subdir, then run autoconf in the subdir. | |
1538 | # To prevent recursion we set host and build for the new | |
1539 | # invocation of configure to the build for this invocation | |
1540 | # of configure. | |
1541 | tempdir=build.$$ | |
1542 | rm -rf $tempdir | |
1543 | mkdir $tempdir | |
1544 | cd $tempdir | |
1545 | case ${srcdir} in | |
b86ecfa9 | 1546 | /* | [A-Za-z]:[\\/]* ) realsrcdir=${srcdir};; |
b7cb92ad JL |
1547 | *) realsrcdir=../${srcdir};; |
1548 | esac | |
2ceb362d AM |
1549 | # Clearing GMPINC is necessary to prevent host headers being |
1550 | # used by the build compiler. Defining GENERATOR_FILE stops | |
1551 | # system.h from including gmp.h. | |
d920e825 | 1552 | CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \ |
2ceb362d AM |
1553 | CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \ |
1554 | LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \ | |
1555 | GMPINC="" CPPFLAGS="${CPPFLAGS} -DGENERATOR_FILE" \ | |
d920e825 | 1556 | ${realsrcdir}/configure \ |
33e70558 | 1557 | --enable-languages=${enable_languages-all} \ |
534d0cc0 | 1558 | --target=$target_alias --host=$build_alias --build=$build_alias |
b7cb92ad JL |
1559 | |
1560 | # We just finished tests for the build machine, so rename | |
1561 | # the file auto-build.h in the gcc directory. | |
1562 | mv auto-host.h ../auto-build.h | |
1563 | cd .. | |
1564 | rm -rf $tempdir | |
eaf4e618 | 1565 | build_auto=auto-build.h |
db81d74a | 1566 | fi |
71b5d516 | 1567 | AC_SUBST(build_subdir) |
db81d74a | 1568 | |
eaf4e618 | 1569 | tm_file="${tm_file} defaults.h" |
4977bab6 ZW |
1570 | tm_p_file="${tm_p_file} tm-preds.h" |
1571 | host_xm_file="auto-host.h ansidecl.h ${host_xm_file}" | |
1572 | build_xm_file="${build_auto} ansidecl.h ${build_xm_file}" | |
49691411 | 1573 | # We don't want ansidecl.h in target files, write code there in ISO/GNU C. |
b4862477 | 1574 | # put this back in temporarily. |
232b67d9 | 1575 | xm_file="auto-host.h ansidecl.h ${xm_file}" |
0056a9b5 | 1576 | |
34a86c2b NN |
1577 | # -------- |
1578 | # UNSORTED | |
1579 | # -------- | |
1580 | ||
afabd8e6 | 1581 | changequote(,)dnl |
cc1e60ea | 1582 | # Compile in configure arguments. |
8105825d | 1583 | if test -f configargs.h ; then |
cc1e60ea | 1584 | # Being re-configured. |
022dae81 | 1585 | gcc_config_arguments=`grep configuration_arguments configargs.h | sed -e 's/.*"\([^"]*\)".*/\1/'` |
cc1e60ea JM |
1586 | gcc_config_arguments="$gcc_config_arguments : (reconfigured) $TOPLEVEL_CONFIGURE_ARGUMENTS" |
1587 | else | |
1588 | gcc_config_arguments="$TOPLEVEL_CONFIGURE_ARGUMENTS" | |
1589 | fi | |
eeae7b41 DJ |
1590 | |
1591 | # Double all backslashes and backslash all quotes to turn | |
1592 | # gcc_config_arguments into a C string. | |
1593 | sed -e 's/\\/\\\\/g; s/"/\\"/g' <<EOF >conftest.out | |
1594 | $gcc_config_arguments | |
1595 | EOF | |
1596 | gcc_config_arguments_str=`cat conftest.out` | |
1597 | rm -f conftest.out | |
1598 | ||
cc1e60ea JM |
1599 | cat > configargs.h <<EOF |
1600 | /* Generated automatically. */ | |
eeae7b41 | 1601 | static const char configuration_arguments[] = "$gcc_config_arguments_str"; |
a6687d2b | 1602 | static const char thread_model[] = "$thread_file"; |
7816bea0 DJ |
1603 | |
1604 | static const struct { | |
1605 | const char *name, *value; | |
1606 | } configure_default_options[] = $configure_default_options; | |
cc1e60ea | 1607 | EOF |
75bffa71 | 1608 | changequote([,])dnl |
46f18e7b | 1609 | |
0c463e16 | 1610 | changequote(,)dnl |
40540e68 RAE |
1611 | gcc_BASEVER=`cat $srcdir/BASE-VER` |
1612 | gcc_DEVPHASE=`cat $srcdir/DEV-PHASE` | |
1613 | gcc_DATESTAMP=`cat $srcdir/DATESTAMP` | |
0c463e16 | 1614 | if test -f $srcdir/REVISION ; then |
40540e68 | 1615 | gcc_REVISION=`cat $srcdir/REVISION` |
0c463e16 RAE |
1616 | else |
1617 | gcc_REVISION="" | |
1618 | fi | |
1619 | cat > plugin-version.h <<EOF | |
1620 | #include "configargs.h" | |
1621 | ||
bf588455 BS |
1622 | #define GCCPLUGIN_VERSION_MAJOR `echo $gcc_BASEVER | sed -e 's/^\([0-9]*\).*$/\1/'` |
1623 | #define GCCPLUGIN_VERSION_MINOR `echo $gcc_BASEVER | sed -e 's/^[0-9]*\.\([0-9]*\).*$/\1/'` | |
1624 | #define GCCPLUGIN_VERSION_PATCHLEVEL `echo $gcc_BASEVER | sed -e 's/^[0-9]*\.[0-9]*\.\([0-9]*\)$/\1/'` | |
1625 | #define GCCPLUGIN_VERSION (GCCPLUGIN_VERSION_MAJOR*1000 + GCCPLUGIN_VERSION_MINOR) | |
1626 | ||
0c463e16 RAE |
1627 | static char basever[] = "$gcc_BASEVER"; |
1628 | static char datestamp[] = "$gcc_DATESTAMP"; | |
1629 | static char devphase[] = "$gcc_DEVPHASE"; | |
1630 | static char revision[] = "$gcc_REVISION"; | |
1631 | ||
1632 | /* FIXME plugins: We should make the version information more precise. | |
1633 | One way to do is to add a checksum. */ | |
1634 | ||
1635 | static struct plugin_gcc_version gcc_version = {basever, datestamp, | |
1636 | devphase, revision, | |
1637 | configuration_arguments}; | |
1638 | EOF | |
1639 | changequote([,])dnl | |
1640 | ||
ab87f8c8 | 1641 | # Internationalization |
56694dd9 | 1642 | ZW_GNU_GETTEXT_SISTER_DIR |
dc6746e7 | 1643 | |
56694dd9 ZW |
1644 | # If LIBINTL contains LIBICONV, then clear LIBICONV so we don't get |
1645 | # -liconv on the link line twice. | |
1646 | case "$LIBINTL" in *$LIBICONV*) | |
1647 | LIBICONV= ;; | |
1648 | esac | |
ab87f8c8 | 1649 | |
7f970b70 | 1650 | AC_ARG_ENABLE(secureplt, |
b88ecf55 AS |
1651 | [AS_HELP_STRING([--enable-secureplt], |
1652 | [enable -msecure-plt by default for PowerPC])], | |
7f970b70 AM |
1653 | [], []) |
1654 | ||
ad211091 KT |
1655 | AC_ARG_ENABLE(leading-mingw64-underscores, |
1656 | AS_HELP_STRING([--enable-leading-mingw64-underscores], | |
b88ecf55 | 1657 | [enable leading underscores on 64 bit mingw targets]), |
ad211091 KT |
1658 | [],[]) |
1659 | AS_IF([ test x"$enable_leading_mingw64_underscores" = xyes ], | |
1660 | [AC_DEFINE(USE_MINGW64_LEADING_UNDERSCORES, 1, | |
1661 | [Define if we should use leading underscore on 64 bit mingw targets])]) | |
1662 | ||
922e3e33 | 1663 | AC_ARG_ENABLE(cld, |
b88ecf55 | 1664 | [AS_HELP_STRING([--enable-cld], [enable -mcld by default for 32bit x86])], [], |
922e3e33 UB |
1665 | [enable_cld=no]) |
1666 | ||
d79389af | 1667 | AC_ARG_ENABLE(frame-pointer, |
b88ecf55 AS |
1668 | [AS_HELP_STRING([--enable-frame-pointer], |
1669 | [enable -fno-omit-frame-pointer by default for 32bit x86])], [], | |
d79389af L |
1670 | [ |
1671 | case $target_os in | |
1b2d4118 JH |
1672 | linux* | darwin[[8912]]*) |
1673 | # Enable -fomit-frame-pointer by default for Linux and Darwin with | |
1674 | # DWARF2. | |
d79389af L |
1675 | enable_frame_pointer=no |
1676 | ;; | |
1677 | *) | |
1678 | enable_frame_pointer=yes | |
1679 | ;; | |
1680 | esac | |
1681 | ]) | |
1682 | ||
f4ab28e3 MK |
1683 | # Windows32 Registry support for specifying GCC installation paths. |
1684 | AC_ARG_ENABLE(win32-registry, | |
b88ecf55 AS |
1685 | [AS_HELP_STRING([--disable-win32-registry], |
1686 | [disable lookup of installation paths in the | |
1687 | Registry on Windows hosts]) | |
1688 | AS_HELP_STRING([--enable-win32-registry], [enable registry lookup (default)]) | |
1689 | AS_HELP_STRING([--enable-win32-registry=KEY], | |
1690 | [use KEY instead of GCC version as the last portion | |
1691 | of the registry key])],,) | |
a1286ef5 | 1692 | |
4e70264f | 1693 | case $host_os in |
a1286ef5 ZW |
1694 | win32 | pe | cygwin* | mingw32* | uwin*) |
1695 | if test "x$enable_win32_registry" != xno; then | |
1696 | AC_SEARCH_LIBS(RegOpenKeyExA, advapi32,, [enable_win32_registry=no]) | |
1697 | fi | |
f4ab28e3 | 1698 | |
a1286ef5 ZW |
1699 | if test "x$enable_win32_registry" != xno; then |
1700 | AC_DEFINE(ENABLE_WIN32_REGISTRY, 1, | |
1701 | [Define to 1 if installation paths should be looked up in the Windows | |
1702 | Registry. Ignored on non-Windows hosts.]) | |
1703 | ||
1704 | if test "x$enable_win32_registry" != xyes \ | |
1705 | && test "x$enable_win32_registry" != x; then | |
1706 | AC_DEFINE_UNQUOTED(WIN32_REGISTRY_KEY, "$enable_win32_registry", | |
1707 | [Define to be the last component of the Windows registry key under which | |
1708 | to look for installation paths. The full key used will be | |
1709 | HKEY_LOCAL_MACHINE/SOFTWARE/Free Software Foundation/{WIN32_REGISTRY_KEY}. | |
1710 | The default is the GCC version number.]) | |
1711 | fi | |
1712 | fi | |
f4ab28e3 MK |
1713 | ;; |
1714 | esac | |
1715 | ||
7fa10b25 | 1716 | # Get an absolute path to the GCC top-level source directory |
1e6347d8 | 1717 | holddir=`${PWDCMD-pwd}` |
7fa10b25 | 1718 | cd $srcdir |
1e6347d8 | 1719 | topdir=`${PWDCMD-pwd}` |
7fa10b25 RK |
1720 | cd $holddir |
1721 | ||
af5e4ada | 1722 | # Conditionalize the makefile for this host machine. |
2ed26f6b | 1723 | xmake_file= |
c406e779 | 1724 | for f in ${host_xmake_file} |
94f42018 | 1725 | do |
75bffa71 | 1726 | if test -f ${srcdir}/config/$f |
94f42018 | 1727 | then |
2ed26f6b | 1728 | xmake_file="${xmake_file} \$(srcdir)/config/$f" |
94f42018 DE |
1729 | fi |
1730 | done | |
46f18e7b | 1731 | |
af5e4ada | 1732 | # Conditionalize the makefile for this target machine. |
2ed26f6b | 1733 | tmake_file_= |
c406e779 | 1734 | for f in ${tmake_file} |
94f42018 | 1735 | do |
75bffa71 | 1736 | if test -f ${srcdir}/config/$f |
94f42018 | 1737 | then |
2ed26f6b | 1738 | tmake_file_="${tmake_file_} \$(srcdir)/config/$f" |
94f42018 DE |
1739 | fi |
1740 | done | |
2ed26f6b | 1741 | tmake_file="${tmake_file_}" |
5891b37d | 1742 | |
af5e4ada | 1743 | out_object_file=`basename $out_file .c`.o |
c49a6962 | 1744 | common_out_object_file=`basename $common_out_file .c`.o |
5891b37d | 1745 | |
75685792 | 1746 | tm_file_list="options.h" |
f938f60c | 1747 | tm_include_list="options.h insn-constants.h" |
af5e4ada | 1748 | for f in $tm_file; do |
64ccbc99 | 1749 | case $f in |
3ca43df7 RS |
1750 | ./* ) |
1751 | f=`echo $f | sed 's/^..//'` | |
1752 | tm_file_list="${tm_file_list} $f" | |
1753 | tm_include_list="${tm_include_list} $f" | |
1754 | ;; | |
d02af173 | 1755 | defaults.h ) |
e22340b0 ZW |
1756 | tm_file_list="${tm_file_list} \$(srcdir)/$f" |
1757 | tm_include_list="${tm_include_list} $f" | |
1758 | ;; | |
1759 | * ) | |
1760 | tm_file_list="${tm_file_list} \$(srcdir)/config/$f" | |
1761 | tm_include_list="${tm_include_list} config/$f" | |
1762 | ;; | |
64ccbc99 | 1763 | esac |
af5e4ada | 1764 | done |
46f18e7b | 1765 | |
11642c3a | 1766 | tm_p_file_list= |
e22340b0 | 1767 | tm_p_include_list= |
11642c3a | 1768 | for f in $tm_p_file; do |
4977bab6 ZW |
1769 | case $f in |
1770 | tm-preds.h ) | |
e22340b0 ZW |
1771 | tm_p_file_list="${tm_p_file_list} $f" |
1772 | tm_p_include_list="${tm_p_include_list} $f" | |
1773 | ;; | |
1774 | * ) | |
1775 | tm_p_file_list="${tm_p_file_list} \$(srcdir)/config/$f" | |
1776 | tm_p_include_list="${tm_p_include_list} config/$f" | |
1777 | esac | |
1778 | done | |
1779 | ||
1780 | xm_file_list= | |
1781 | xm_include_list= | |
1782 | for f in $xm_file; do | |
1783 | case $f in | |
1784 | ansidecl.h ) | |
1785 | xm_file_list="${xm_file_list} \$(srcdir)/../include/$f" | |
1786 | xm_include_list="${xm_include_list} $f" | |
1787 | ;; | |
1788 | auto-host.h ) | |
1789 | xm_file_list="${xm_file_list} $f" | |
1790 | xm_include_list="${xm_include_list} $f" | |
1791 | ;; | |
1792 | * ) | |
1793 | xm_file_list="${xm_file_list} \$(srcdir)/config/$f" | |
1794 | xm_include_list="${xm_include_list} config/$f" | |
1795 | ;; | |
4977bab6 | 1796 | esac |
11642c3a ZW |
1797 | done |
1798 | ||
af5e4ada | 1799 | host_xm_file_list= |
e22340b0 | 1800 | host_xm_include_list= |
af5e4ada | 1801 | for f in $host_xm_file; do |
64ccbc99 | 1802 | case $f in |
d02af173 | 1803 | ansidecl.h ) |
e22340b0 ZW |
1804 | host_xm_file_list="${host_xm_file_list} \$(srcdir)/../include/$f" |
1805 | host_xm_include_list="${host_xm_include_list} $f" | |
1806 | ;; | |
e2500fed | 1807 | auto-host.h ) |
e22340b0 ZW |
1808 | host_xm_file_list="${host_xm_file_list} $f" |
1809 | host_xm_include_list="${host_xm_include_list} $f" | |
1810 | ;; | |
1811 | * ) | |
1812 | host_xm_file_list="${host_xm_file_list} \$(srcdir)/config/$f" | |
1813 | host_xm_include_list="${host_xm_include_list} config/$f" | |
1814 | ;; | |
64ccbc99 | 1815 | esac |
af5e4ada DE |
1816 | done |
1817 | ||
1818 | build_xm_file_list= | |
1819 | for f in $build_xm_file; do | |
64ccbc99 | 1820 | case $f in |
d02af173 | 1821 | ansidecl.h ) |
e22340b0 ZW |
1822 | build_xm_file_list="${build_xm_file_list} \$(srcdir)/../include/$f" |
1823 | build_xm_include_list="${build_xm_include_list} $f" | |
1824 | ;; | |
e2500fed | 1825 | auto-build.h | auto-host.h ) |
e22340b0 ZW |
1826 | build_xm_file_list="${build_xm_file_list} $f" |
1827 | build_xm_include_list="${build_xm_include_list} $f" | |
1828 | ;; | |
1829 | * ) | |
1830 | build_xm_file_list="${build_xm_file_list} \$(srcdir)/config/$f" | |
1831 | build_xm_include_list="${build_xm_include_list} config/$f" | |
1832 | ;; | |
64ccbc99 | 1833 | esac |
af5e4ada | 1834 | done |
46f18e7b | 1835 | |
2989d30c GK |
1836 | # Define macro CROSS_DIRECTORY_STRUCTURE in compilation if this is a |
1837 | # cross-compiler which does not use the native headers and libraries. | |
a078a589 ZW |
1838 | # Also use all.cross instead of all.internal and adjust SYSTEM_HEADER_DIR. |
1839 | CROSS= AC_SUBST(CROSS) | |
1840 | ALL=all.internal AC_SUBST(ALL) | |
1841 | SYSTEM_HEADER_DIR='$(NATIVE_SYSTEM_HEADER_DIR)' AC_SUBST(SYSTEM_HEADER_DIR) | |
b28250ab MM |
1842 | |
1843 | if test "x$with_build_sysroot" != x; then | |
14da6073 | 1844 | build_system_header_dir=$with_build_sysroot'$${sysroot_headers_suffix}$(NATIVE_SYSTEM_HEADER_DIR)' |
b28250ab MM |
1845 | else |
1846 | # This value is used, even on a native system, because | |
1847 | # CROSS_SYSTEM_HEADER_DIR is just | |
1848 | # $(TARGET_SYSTEM_ROOT)$(NATIVE_SYSTEM_HEADER_DIR). | |
1849 | build_system_header_dir='$(CROSS_SYSTEM_HEADER_DIR)' | |
1850 | fi | |
1851 | ||
75bffa71 | 1852 | if test x$host != x$target |
af5e4ada | 1853 | then |
2989d30c | 1854 | CROSS="-DCROSS_DIRECTORY_STRUCTURE" |
a078a589 | 1855 | ALL=all.cross |
160633c6 | 1856 | SYSTEM_HEADER_DIR=$build_system_header_dir |
343f59d9 | 1857 | case "$host","$target" in |
3a7e8b87 GK |
1858 | # Darwin crosses can use the host system's libraries and headers, |
1859 | # because of the fat library support. Of course, it must be the | |
1860 | # same version of Darwin on both sides. Allow the user to | |
1861 | # just say --target=foo-darwin without a version number to mean | |
1862 | # "the version on this system". | |
1863 | *-*-darwin*,*-*-darwin*) | |
1864 | hostos=`echo $host | sed 's/.*-darwin/darwin/'` | |
1865 | targetos=`echo $target | sed 's/.*-darwin/darwin/'` | |
1866 | if test $hostos = $targetos -o $targetos = darwin ; then | |
1867 | CROSS= | |
1868 | SYSTEM_HEADER_DIR='$(NATIVE_SYSTEM_HEADER_DIR)' | |
1869 | with_headers=yes | |
1870 | fi | |
1871 | ;; | |
1872 | ||
343f59d9 AM |
1873 | i?86-*-*,x86_64-*-* \ |
1874 | | powerpc*-*-*,powerpc64*-*-*) | |
1875 | CROSS="$CROSS -DNATIVE_CROSS" ;; | |
1876 | esac | |
e1dbd4c8 KT |
1877 | |
1878 | case $target in | |
1879 | *-*-mingw*) | |
1880 | if test "x$with_headers" = x; then | |
1881 | with_headers=yes | |
1882 | fi | |
1883 | ;; | |
1884 | *) | |
1885 | ;; | |
1886 | esac | |
7a615b25 | 1887 | elif test "x$TARGET_SYSTEM_ROOT" != x; then |
b28250ab | 1888 | SYSTEM_HEADER_DIR=$build_system_header_dir |
af5e4ada | 1889 | fi |
46f18e7b | 1890 | |
b39d221a EC |
1891 | # If this is a cross-compiler that does not |
1892 | # have its own set of headers then define | |
1893 | # inhibit_libc | |
1894 | ||
dc06db20 R |
1895 | # If this is using newlib, without having the headers available now, |
1896 | # then define inhibit_libc in LIBGCC2_CFLAGS. | |
fecd6201 ZW |
1897 | # This prevents libgcc2 from containing any code which requires libc |
1898 | # support. | |
a929bc28 | 1899 | : ${inhibit_libc=false} |
dc06db20 R |
1900 | if { { test x$host != x$target && test "x$with_sysroot" = x ; } || |
1901 | test x$with_newlib = xyes ; } && | |
e50084fa | 1902 | { test "x$with_headers" = x || test "x$with_headers" = xno ; } ; then |
160633c6 | 1903 | inhibit_libc=true |
b39d221a EC |
1904 | fi |
1905 | AC_SUBST(inhibit_libc) | |
1906 | ||
a078a589 ZW |
1907 | # When building gcc with a cross-compiler, we need to adjust things so |
1908 | # that the generator programs are still built with the native compiler. | |
52c0e446 | 1909 | # Also, we cannot run fixincludes. |
a078a589 ZW |
1910 | |
1911 | # These are the normal (build=host) settings: | |
eaf9f3b2 | 1912 | CC_FOR_BUILD='$(CC)' AC_SUBST(CC_FOR_BUILD) |
bdd5dc28 | 1913 | CXX_FOR_BUILD='$(CXX)' AC_SUBST(CXX_FOR_BUILD) |
4977bab6 | 1914 | BUILD_CFLAGS='$(ALL_CFLAGS)' AC_SUBST(BUILD_CFLAGS) |
bdd5dc28 | 1915 | BUILD_CXXFLAGS='$(ALL_CXXFLAGS)' AC_SUBST(BUILD_CXXFLAGS) |
f8c33439 | 1916 | BUILD_LDFLAGS='$(LDFLAGS)' AC_SUBST(BUILD_LDFLAGS) |
a078a589 | 1917 | STMP_FIXINC=stmp-fixinc AC_SUBST(STMP_FIXINC) |
587dc9c6 | 1918 | |
83599948 NS |
1919 | # And these apply if build != host, or we are generating coverage data |
1920 | if test x$build != x$host || test "x$coverage_flags" != x | |
af5e4ada | 1921 | then |
b11e4747 | 1922 | BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)' |
c012dc48 | 1923 | BUILD_CXXFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CXXFLAGS_FOR_BUILD)' |
f8c33439 | 1924 | BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)' |
af5e4ada | 1925 | fi |
46f18e7b | 1926 | |
ae3a15bb DE |
1927 | # Expand extra_headers to include complete path. |
1928 | # This substitutes for lots of t-* files. | |
1929 | extra_headers_list= | |
b1ef58c8 NN |
1930 | # Prepend $(srcdir)/config/${cpu_type}/ to every entry in extra_headers. |
1931 | for file in ${extra_headers} ; do | |
1932 | extra_headers_list="${extra_headers_list} \$(srcdir)/config/${cpu_type}/${file}" | |
1933 | done | |
ae3a15bb | 1934 | |
1617e5ee GK |
1935 | # If use_gcc_tgmath is set, append ginclude/tgmath.h. |
1936 | if test x"$use_gcc_tgmath" = xyes | |
1937 | then extra_headers_list="${extra_headers_list} \$(srcdir)/ginclude/tgmath.h" | |
1938 | fi | |
1939 | ||
c38f02df ILT |
1940 | # Define collect2 in Makefile. |
1941 | case $host_can_use_collect2 in | |
1942 | no) collect2= ;; | |
1943 | *) collect2='collect2$(exeext)' ;; | |
1944 | esac | |
1945 | AC_SUBST([collect2]) | |
1946 | ||
af5e4ada | 1947 | # Add a definition of USE_COLLECT2 if system wants one. |
34a86c2b NN |
1948 | case $use_collect2 in |
1949 | no) use_collect2= ;; | |
1950 | "") ;; | |
1951 | *) | |
1952 | host_xm_defines="${host_xm_defines} USE_COLLECT2" | |
1953 | xm_defines="${xm_defines} USE_COLLECT2" | |
c38f02df ILT |
1954 | case $host_can_use_collect2 in |
1955 | no) | |
1956 | AC_MSG_ERROR([collect2 is required but cannot be built on this system]) | |
1957 | ;; | |
1958 | esac | |
34a86c2b NN |
1959 | ;; |
1960 | esac | |
af5e4ada | 1961 | |
1cd0b716 DK |
1962 | AC_DEFINE_UNQUOTED(LTOPLUGINSONAME,"${host_lto_plugin_soname}", |
1963 | [Define to the name of the LTO plugin DSO that must be | |
1964 | passed to the linker's -plugin=LIB option.]) | |
1965 | ||
630327c3 NN |
1966 | # --------------------------- |
1967 | # Assembler & linker features | |
1968 | # --------------------------- | |
1969 | ||
da0f6381 PB |
1970 | # During stage 2, ld is actually gcc/collect-ld, which is a small script to |
1971 | # discern between when to use prev-ld/ld-new and when to use ld/ld-new. | |
1972 | # However when ld-new is first executed from the build tree, libtool will | |
1973 | # relink it as .libs/lt-ld-new, so that it can give it an RPATH that refers | |
1974 | # to the build tree. While doing this we need to use the previous-stage | |
1975 | # linker, or we have an infinite loop. The presence of a shell script as | |
1976 | # ld/ld-new, and the fact that the script *uses ld itself*, is what confuses | |
1977 | # the gcc/collect-ld script. So we need to know how libtool works, or | |
1978 | # exec-tool will fail. | |
1979 | ||
1980 | m4_defun([_LT_CONFIG_COMMANDS], []) | |
1981 | AC_PROG_LIBTOOL | |
1982 | AC_SUBST(objdir) | |
1983 | AC_SUBST(enable_fast_install) | |
1984 | ||
d869a8c4 NN |
1985 | # Identify the assembler which will work hand-in-glove with the newly |
1986 | # built GCC, so that we can examine its features. This is the assembler | |
1987 | # which will be driven by the driver program. | |
1988 | # | |
1989 | # If build != host, and we aren't building gas in-tree, we identify a | |
1990 | # build->target assembler and hope that it will have the same features | |
1991 | # as the host->target assembler we'll be using. | |
981d4858 JM |
1992 | gcc_cv_gas_major_version= |
1993 | gcc_cv_gas_minor_version= | |
a2f319ea | 1994 | gcc_cv_as_gas_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/gas |
e8b05380 PB |
1995 | |
1996 | m4_pattern_allow([AS_FOR_TARGET])dnl | |
1997 | AS_VAR_SET_IF(gcc_cv_as,, [ | |
3ccc3a56 AO |
1998 | if test -x "$DEFAULT_ASSEMBLER"; then |
1999 | gcc_cv_as="$DEFAULT_ASSEMBLER" | |
34a86c2b | 2000 | elif test -f $gcc_cv_as_gas_srcdir/configure.in \ |
08d105fa AO |
2001 | && test -f ../gas/Makefile \ |
2002 | && test x$build = x$host; then | |
e8b05380 PB |
2003 | gcc_cv_as=../gas/as-new$build_exeext |
2004 | elif test -x as$build_exeext; then | |
2005 | # Build using assembler in the current directory. | |
2006 | gcc_cv_as=./as$build_exeext | |
4a150fc8 | 2007 | elif ( set dummy $AS_FOR_TARGET; test -x $[2] ); then |
e8b05380 PB |
2008 | gcc_cv_as="$AS_FOR_TARGET" |
2009 | else | |
2010 | AC_PATH_PROG(gcc_cv_as, $AS_FOR_TARGET) | |
2011 | fi]) | |
2012 | ||
2013 | ORIGINAL_AS_FOR_TARGET=$gcc_cv_as | |
2014 | AC_SUBST(ORIGINAL_AS_FOR_TARGET) | |
be0fe523 PB |
2015 | case "$ORIGINAL_AS_FOR_TARGET" in |
2016 | ./as | ./as$build_exeext) ;; | |
2017 | *) AC_CONFIG_FILES(as:exec-tool.in, [chmod +x as]) ;; | |
2018 | esac | |
e8b05380 PB |
2019 | |
2020 | AC_MSG_CHECKING(what assembler to use) | |
2021 | if test "$gcc_cv_as" = ../gas/as-new$build_exeext; then | |
08d105fa AO |
2022 | # Single tree build which includes gas. We want to prefer it |
2023 | # over whatever linker top-level may have detected, since | |
2024 | # we'll use what we're building after installation anyway. | |
e8b05380 | 2025 | AC_MSG_RESULT(newly built gas) |
ad9c4d9f NN |
2026 | in_tree_gas=yes |
2027 | _gcc_COMPUTE_GAS_VERSION | |
5408ac6c HPN |
2028 | in_tree_gas_is_elf=no |
2029 | if grep 'obj_format = elf' ../gas/Makefile > /dev/null \ | |
2030 | || (grep 'obj_format = multi' ../gas/Makefile \ | |
2031 | && grep 'extra_objects =.* obj-elf' ../gas/Makefile) > /dev/null | |
2032 | then | |
2033 | in_tree_gas_is_elf=yes | |
2034 | fi | |
e8b05380 PB |
2035 | else |
2036 | AC_MSG_RESULT($gcc_cv_as) | |
2037 | in_tree_gas=no | |
981d4858 JM |
2038 | fi |
2039 | ||
40f213e6 L |
2040 | default_ld= |
2041 | AC_ARG_ENABLE(ld, | |
2042 | [[ --enable-ld[=ARG] build ld [ARG={default,yes,no}]]], | |
2043 | [case "${enableval}" in | |
2044 | no) | |
2045 | default_ld=ld.gold | |
2046 | ;; | |
2047 | esac]) | |
2048 | ||
2049 | AC_ARG_ENABLE(gold, | |
2050 | [[ --enable-gold[=ARG] build gold [ARG={default,yes,no}]]], | |
2051 | [case "${enableval}" in | |
2052 | default) | |
2053 | install_gold_as_default=yes | |
2054 | ;; | |
2055 | yes) | |
2056 | if test x${default_ld} != x; then | |
2057 | install_gold_as_default=yes | |
2058 | fi | |
2059 | ;; | |
2060 | no) | |
2061 | ;; | |
2062 | *) | |
2063 | AC_MSG_ERROR([invalid --enable-gold argument]) | |
2064 | ;; | |
2065 | esac], | |
2066 | [install_gold_as_default=no]) | |
2067 | ||
d869a8c4 NN |
2068 | # Identify the linker which will work hand-in-glove with the newly |
2069 | # built GCC, so that we can examine its features. This is the linker | |
2070 | # which will be driven by the driver program. | |
2071 | # | |
2072 | # If build != host, and we aren't building gas in-tree, we identify a | |
2073 | # build->target linker and hope that it will have the same features | |
2074 | # as the host->target linker we'll be using. | |
275b60d6 JJ |
2075 | gcc_cv_gld_major_version= |
2076 | gcc_cv_gld_minor_version= | |
2077 | gcc_cv_ld_gld_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/ld | |
40f213e6 | 2078 | gcc_cv_ld_gold_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/gold |
275b60d6 | 2079 | gcc_cv_ld_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd |
e8b05380 PB |
2080 | |
2081 | AS_VAR_SET_IF(gcc_cv_ld,, [ | |
275b60d6 JJ |
2082 | if test -x "$DEFAULT_LINKER"; then |
2083 | gcc_cv_ld="$DEFAULT_LINKER" | |
40f213e6 L |
2084 | elif test $install_gold_as_default = yes \ |
2085 | && test -f $gcc_cv_ld_gold_srcdir/configure.ac \ | |
2086 | && test -f ../gold/Makefile \ | |
2087 | && test x$build = x$host; then | |
2088 | gcc_cv_ld=../gold/ld-new$build_exeext | |
34a86c2b | 2089 | elif test -f $gcc_cv_ld_gld_srcdir/configure.in \ |
08d105fa AO |
2090 | && test -f ../ld/Makefile \ |
2091 | && test x$build = x$host; then | |
e8b05380 PB |
2092 | gcc_cv_ld=../ld/ld-new$build_exeext |
2093 | elif test -x collect-ld$build_exeext; then | |
2094 | # Build using linker in the current directory. | |
2095 | gcc_cv_ld=./collect-ld$build_exeext | |
4a150fc8 | 2096 | elif ( set dummy $LD_FOR_TARGET; test -x $[2] ); then |
e8b05380 PB |
2097 | gcc_cv_ld="$LD_FOR_TARGET" |
2098 | else | |
2099 | AC_PATH_PROG(gcc_cv_ld, $LD_FOR_TARGET) | |
2100 | fi]) | |
2101 | ||
5938f74d | 2102 | ORIGINAL_PLUGIN_LD_FOR_TARGET=$gcc_cv_ld |
36d21883 | 2103 | PLUGIN_LD_SUFFIX=`basename $gcc_cv_ld | sed -e "s,$target_alias-,,"` |
01a88d35 AP |
2104 | # if the PLUGIN_LD is set ld-new, just have it as ld |
2105 | # as that is the installed named. | |
3cecbdfa TS |
2106 | if test x$PLUGIN_LD_SUFFIX = xld-new \ |
2107 | || test x$PLUGIN_LD_SUFFIX = xcollect-ld ; then | |
01a88d35 AP |
2108 | PLUGIN_LD_SUFFIX=ld |
2109 | fi | |
5938f74d | 2110 | AC_ARG_WITH(plugin-ld, |
b88ecf55 | 2111 | [AS_HELP_STRING([[--with-plugin-ld=[ARG]]], [specify the plugin linker])], |
5938f74d L |
2112 | [if test x"$withval" != x; then |
2113 | ORIGINAL_PLUGIN_LD_FOR_TARGET="$withval" | |
36d21883 | 2114 | PLUGIN_LD_SUFFIX=`echo $withval | sed -e "s,$target_alias-,,"` |
5938f74d L |
2115 | fi]) |
2116 | AC_SUBST(ORIGINAL_PLUGIN_LD_FOR_TARGET) | |
36d21883 | 2117 | AC_DEFINE_UNQUOTED(PLUGIN_LD_SUFFIX, "$PLUGIN_LD_SUFFIX", [Specify plugin linker]) |
5938f74d | 2118 | |
1dcc82c2 DK |
2119 | # Check to see if we are using gold instead of ld |
2120 | AC_MSG_CHECKING(whether we are using gold) | |
2121 | ld_is_gold=no | |
2122 | if test x$gcc_cv_ld != x; then | |
2123 | if $gcc_cv_ld --version 2>/dev/null | sed 1q \ | |
2124 | | grep "GNU gold" > /dev/null; then | |
2125 | ld_is_gold=yes | |
2126 | fi | |
2127 | fi | |
2128 | AC_MSG_RESULT($ld_is_gold) | |
2129 | ||
e8b05380 PB |
2130 | ORIGINAL_LD_FOR_TARGET=$gcc_cv_ld |
2131 | AC_SUBST(ORIGINAL_LD_FOR_TARGET) | |
be0fe523 PB |
2132 | case "$ORIGINAL_LD_FOR_TARGET" in |
2133 | ./collect-ld | ./collect-ld$build_exeext) ;; | |
2134 | *) AC_CONFIG_FILES(collect-ld:exec-tool.in, [chmod +x collect-ld]) ;; | |
2135 | esac | |
e8b05380 PB |
2136 | |
2137 | AC_MSG_CHECKING(what linker to use) | |
55b46574 RO |
2138 | if test "$gcc_cv_ld" = ../ld/ld-new$build_exeext \ |
2139 | || test "$gcc_cv_ld" = ../gold/ld-new$build_exeext; then | |
08d105fa AO |
2140 | # Single tree build which includes ld. We want to prefer it |
2141 | # over whatever linker top-level may have detected, since | |
2142 | # we'll use what we're building after installation anyway. | |
e8b05380 | 2143 | AC_MSG_RESULT(newly built ld) |
34a86c2b | 2144 | in_tree_ld=yes |
5408ac6c HPN |
2145 | in_tree_ld_is_elf=no |
2146 | if (grep 'EMUL = .*elf' ../ld/Makefile \ | |
8a45d680 AN |
2147 | || grep 'EMUL = .*linux' ../ld/Makefile \ |
2148 | || grep 'EMUL = .*lynx' ../ld/Makefile) > /dev/null; then | |
5408ac6c | 2149 | in_tree_ld_is_elf=yes |
55b46574 RO |
2150 | elif test "$ld_is_gold" = yes; then |
2151 | in_tree_ld_is_elf=yes | |
5408ac6c | 2152 | fi |
275b60d6 JJ |
2153 | 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 |
2154 | do | |
2155 | changequote(,)dnl | |
81179208 | 2156 | gcc_cv_gld_version=`sed -n -e 's/^[ ]*VERSION=[^0-9A-Za-z_]*\([0-9]*\.[0-9]*.*\)/VERSION=\1/p' < $f` |
275b60d6 JJ |
2157 | if test x$gcc_cv_gld_version != x; then |
2158 | break | |
2159 | fi | |
2160 | done | |
81179208 HPN |
2161 | case $gcc_cv_gld_version in |
2162 | VERSION=[0-9]*) ;; | |
2163 | changequote([,])dnl | |
2164 | *) AC_MSG_ERROR([[cannot find version of in-tree linker]]) ;; | |
2165 | changequote(,)dnl | |
2166 | esac | |
275b60d6 JJ |
2167 | gcc_cv_gld_major_version=`expr "$gcc_cv_gld_version" : "VERSION=\([0-9]*\)"` |
2168 | gcc_cv_gld_minor_version=`expr "$gcc_cv_gld_version" : "VERSION=[0-9]*\.\([0-9]*\)"` | |
2169 | changequote([,])dnl | |
40f213e6 L |
2170 | ORIGINAL_LD_BFD_FOR_TARGET=../ld/ld-new$build_exeext |
2171 | ORIGINAL_LD_GOLD_FOR_TARGET=../gold/ld-new$build_exeext | |
e8b05380 PB |
2172 | else |
2173 | AC_MSG_RESULT($gcc_cv_ld) | |
2174 | in_tree_ld=no | |
40f213e6 L |
2175 | gcc_cvs_ld_program=`dirname $gcc_cv_ld`/`basename $gcc_cv_ld $host_exeext` |
2176 | ORIGINAL_LD_BFD_FOR_TARGET=${gcc_cvs_ld_program}.bfd$host_exeext | |
2177 | ORIGINAL_LD_GOLD_FOR_TARGET=${gcc_cvs_ld_program}.gold$host_exeext | |
275b60d6 JJ |
2178 | fi |
2179 | ||
40f213e6 L |
2180 | AC_SUBST(ORIGINAL_LD_BFD_FOR_TARGET) |
2181 | AC_SUBST(ORIGINAL_LD_GOLD_FOR_TARGET) | |
2182 | ||
981d4858 | 2183 | # Figure out what nm we will be using. |
f9c1196a | 2184 | gcc_cv_binutils_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/binutils |
e8b05380 | 2185 | AS_VAR_SET_IF(gcc_cv_nm,, [ |
9f18db39 | 2186 | if test -f $gcc_cv_binutils_srcdir/configure.in \ |
c15b113b DD |
2187 | && test -f ../binutils/Makefile \ |
2188 | && test x$build = x$host; then | |
9f18db39 PB |
2189 | gcc_cv_nm=../binutils/nm-new$build_exeext |
2190 | elif test -x nm$build_exeext; then | |
57991eba | 2191 | gcc_cv_nm=./nm$build_exeext |
4a150fc8 | 2192 | elif ( set dummy $NM_FOR_TARGET; test -x $[2] ); then |
e8b05380 PB |
2193 | gcc_cv_nm="$NM_FOR_TARGET" |
2194 | else | |
2195 | AC_PATH_PROG(gcc_cv_nm, $NM_FOR_TARGET) | |
2196 | fi]) | |
9f18db39 | 2197 | |
9f18db39 | 2198 | AC_MSG_CHECKING(what nm to use) |
e8b05380 PB |
2199 | if test "$gcc_cv_nm" = ../binutils/nm-new$build_exeext; then |
2200 | # Single tree build which includes binutils. | |
2201 | AC_MSG_RESULT(newly built nm) | |
2202 | in_tree_nm=yes | |
2203 | else | |
2204 | AC_MSG_RESULT($gcc_cv_nm) | |
2205 | in_tree_nm=no | |
2206 | fi | |
2207 | ||
2208 | ORIGINAL_NM_FOR_TARGET=$gcc_cv_nm | |
2209 | AC_SUBST(ORIGINAL_NM_FOR_TARGET) | |
be0fe523 PB |
2210 | case "$ORIGINAL_NM_FOR_TARGET" in |
2211 | ./nm | ./nm$build_exeext) ;; | |
2212 | *) AC_CONFIG_FILES(nm:exec-tool.in, [chmod +x nm]) ;; | |
2213 | esac | |
2214 | ||
981d4858 | 2215 | |
3cae5780 | 2216 | # Figure out what objdump we will be using. |
e8b05380 | 2217 | AS_VAR_SET_IF(gcc_cv_objdump,, [ |
d739199a | 2218 | if test -f $gcc_cv_binutils_srcdir/configure.in \ |
c15b113b DD |
2219 | && test -f ../binutils/Makefile \ |
2220 | && test x$build = x$host; then | |
f9c1196a | 2221 | # Single tree build which includes binutils. |
9f18db39 | 2222 | gcc_cv_objdump=../binutils/objdump$build_exeext |
d739199a DJ |
2223 | elif test -x objdump$build_exeext; then |
2224 | gcc_cv_objdump=./objdump$build_exeext | |
4a150fc8 | 2225 | elif ( set dummy $OBJDUMP_FOR_TARGET; test -x $[2] ); then |
e8b05380 PB |
2226 | gcc_cv_objdump="$OBJDUMP_FOR_TARGET" |
2227 | else | |
2228 | AC_PATH_PROG(gcc_cv_objdump, $OBJDUMP_FOR_TARGET) | |
2229 | fi]) | |
d739199a | 2230 | |
d739199a | 2231 | AC_MSG_CHECKING(what objdump to use) |
e8b05380 PB |
2232 | if test "$gcc_cv_objdump" = ../binutils/objdump$build_exeext; then |
2233 | # Single tree build which includes binutils. | |
2234 | AC_MSG_RESULT(newly built objdump) | |
2235 | elif test x$gcc_cv_objdump = x; then | |
2236 | AC_MSG_RESULT(not found) | |
2237 | else | |
2238 | AC_MSG_RESULT($gcc_cv_objdump) | |
2239 | fi | |
3cae5780 | 2240 | |
6e97481b JJ |
2241 | # Figure out what readelf we will be using. |
2242 | AS_VAR_SET_IF(gcc_cv_readelf,, [ | |
2243 | if test -f $gcc_cv_binutils_srcdir/configure.in \ | |
2244 | && test -f ../binutils/Makefile \ | |
2245 | && test x$build = x$host; then | |
2246 | # Single tree build which includes binutils. | |
2247 | gcc_cv_readelf=../binutils/readelf$build_exeext | |
2248 | elif test -x readelf$build_exeext; then | |
2249 | gcc_cv_readelf=./readelf$build_exeext | |
2250 | else | |
2251 | AC_PATH_PROG(gcc_cv_readelf, readelf) | |
2252 | fi]) | |
2253 | ||
2254 | AC_MSG_CHECKING(what readelf to use) | |
2255 | if test "$gcc_cv_readelf" = ../binutils/readelf$build_exeext; then | |
2256 | # Single tree build which includes binutils. | |
2257 | AC_MSG_RESULT(newly built readelf) | |
2258 | elif test x$gcc_cv_readelf = x; then | |
2259 | AC_MSG_RESULT(not found) | |
2260 | else | |
2261 | AC_MSG_RESULT($gcc_cv_readelf) | |
2262 | fi | |
2263 | ||
981d4858 | 2264 | # Figure out what assembler alignment features are present. |
8ada417f ZW |
2265 | gcc_GAS_CHECK_FEATURE([.balign and .p2align], gcc_cv_as_balign_and_p2align, |
2266 | [2,6,0],, | |
2267 | [.balign 4 | |
2268 | .p2align 2],, | |
2269 | [AC_DEFINE(HAVE_GAS_BALIGN_AND_P2ALIGN, 1, | |
2270 | [Define if your assembler supports .balign and .p2align.])]) | |
2271 | ||
2272 | gcc_GAS_CHECK_FEATURE([.p2align with maximum skip], gcc_cv_as_max_skip_p2align, | |
2273 | [2,8,0],, | |
2274 | [.p2align 4,,7],, | |
2275 | [AC_DEFINE(HAVE_GAS_MAX_SKIP_P2ALIGN, 1, | |
2276 | [Define if your assembler supports specifying the maximum number | |
2277 | of bytes to skip when using the GAS .p2align command.])]) | |
2278 | ||
5708d18d MS |
2279 | gcc_GAS_CHECK_FEATURE([.literal16], gcc_cv_as_literal16, |
2280 | [2,8,0],, | |
2281 | [.literal16],, | |
2282 | [AC_DEFINE(HAVE_GAS_LITERAL16, 1, | |
2283 | [Define if your assembler supports .literal16.])]) | |
2284 | ||
8ada417f ZW |
2285 | gcc_GAS_CHECK_FEATURE([working .subsection -1], gcc_cv_as_subsection_m1, |
2286 | [elf,2,9,0],, | |
2287 | [conftest_label1: .word 0 | |
d1accaa3 JJ |
2288 | .subsection -1 |
2289 | conftest_label2: .word 0 | |
8ada417f ZW |
2290 | .previous], |
2291 | [if test x$gcc_cv_nm != x; then | |
2292 | $gcc_cv_nm conftest.o | grep conftest_label1 > conftest.nm1 | |
2293 | $gcc_cv_nm conftest.o | grep conftest_label2 | sed -e 's/label2/label1/' > conftest.nm2 | |
2294 | if cmp conftest.nm1 conftest.nm2 > /dev/null 2>&1 | |
2295 | then : | |
2296 | else gcc_cv_as_subsection_m1=yes | |
2297 | fi | |
2298 | rm -f conftest.nm1 conftest.nm2 | |
2299 | fi], | |
2300 | [AC_DEFINE(HAVE_GAS_SUBSECTION_ORDERING, 1, | |
2301 | [Define if your assembler supports .subsection and .subsection -1 starts | |
2302 | emitting at the beginning of your section.])]) | |
2303 | ||
2304 | gcc_GAS_CHECK_FEATURE([.weak], gcc_cv_as_weak, | |
2305 | [2,2,0],, | |
2306 | [ .weak foobar],, | |
2307 | [AC_DEFINE(HAVE_GAS_WEAK, 1, [Define if your assembler supports .weak.])]) | |
2308 | ||
a0203ca7 AO |
2309 | gcc_GAS_CHECK_FEATURE([.weakref], gcc_cv_as_weakref, |
2310 | [2,17,0],, | |
2311 | [ .weakref foobar, barfnot],, | |
2312 | [AC_DEFINE(HAVE_GAS_WEAKREF, 1, [Define if your assembler supports .weakref.])]) | |
2313 | ||
e41f3691 JDA |
2314 | gcc_GAS_CHECK_FEATURE([.nsubspa comdat], gcc_cv_as_nsubspa_comdat, |
2315 | [2,15,91],, | |
2316 | [ .SPACE $TEXT$ | |
2317 | .NSUBSPA $CODE$,COMDAT],, | |
2318 | [AC_DEFINE(HAVE_GAS_NSUBSPA_COMDAT, 1, [Define if your assembler supports .nsubspa comdat option.])]) | |
2319 | ||
8ada417f ZW |
2320 | # .hidden needs to be supported in both the assembler and the linker, |
2321 | # because GNU LD versions before 2.12.1 have buggy support for STV_HIDDEN. | |
2322 | # This is irritatingly difficult to feature test for; we have to check the | |
2323 | # date string after the version number. If we've got an in-tree | |
2324 | # ld, we don't know its patchlevel version, so we set the baseline at 2.13 | |
2325 | # to be safe. | |
2326 | # The gcc_GAS_CHECK_FEATURE call just sets a cache variable. | |
2327 | gcc_GAS_CHECK_FEATURE([.hidden], gcc_cv_as_hidden, | |
2328 | [elf,2,13,0],, | |
2329 | [ .hidden foobar | |
d9f069ab | 2330 | foobar:]) |
ee610fcd RO |
2331 | case "${target}" in |
2332 | *-*-darwin*) | |
2333 | # Darwin as has some visibility support, though with a different syntax. | |
2334 | gcc_cv_as_hidden=yes | |
2335 | ;; | |
2336 | esac | |
8ada417f | 2337 | |
ba885ec5 NS |
2338 | # gnu_indirect_function type is an extension proposed at |
2339 | # http://groups.google/com/group/generic-abi/files. It allows dynamic runtime | |
2340 | # selection of function implementation | |
f6c5fbfd NS |
2341 | AC_ARG_ENABLE(gnu-indirect-function, |
2342 | [AS_HELP_STRING([--enable-gnu-indirect-function], | |
2343 | [enable the use of the @gnu_indirect_function to glibc systems])], | |
2344 | [case $enable_gnu_indirect_function in | |
2345 | yes | no) ;; | |
2346 | *) AC_MSG_ERROR(['$enable_gnu_indirect_function' is an invalid value for --enable-gnu-indirect-function. | |
2347 | Valid choices are 'yes' and 'no'.]) ;; | |
2348 | esac], | |
2349 | [enable_gnu_indirect_function="$default_gnu_indirect_function"]) | |
2f251a05 AI |
2350 | |
2351 | gif=`if test x$enable_gnu_indirect_function = xyes; then echo 1; else echo 0; fi` | |
2352 | AC_DEFINE_UNQUOTED(HAVE_GNU_INDIRECT_FUNCTION, $gif, | |
2353 | [Define if your system supports gnu indirect functions.]) | |
2354 | ||
ba885ec5 | 2355 | |
10ca6198 JJ |
2356 | changequote(,)dnl |
2357 | if test $in_tree_ld != yes ; then | |
2358 | ld_ver=`$gcc_cv_ld --version 2>/dev/null | sed 1q` | |
55b46574 RO |
2359 | if echo "$ld_ver" | grep GNU > /dev/null; then |
2360 | if test x"$ld_is_gold" = xyes; then | |
2361 | # GNU gold --version looks like this: | |
2362 | # | |
2363 | # GNU gold (GNU Binutils 2.21.51.20110225) 1.11 | |
2364 | # | |
2365 | # We extract the binutils version which is more familiar and specific | |
2366 | # than the gold version. | |
2367 | ld_vers=`echo $ld_ver | sed -n \ | |
2368 | -e 's,^[^)]*[ ]\([0-9][0-9]*\.[0-9][0-9]*[^)]*\)) .*$,\1,p'` | |
2369 | else | |
2370 | # GNU ld --version looks like this: | |
2371 | # | |
2372 | # GNU ld (GNU Binutils) 2.21.51.20110225 | |
2373 | ld_vers=`echo $ld_ver | sed -n \ | |
2374 | -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*.*\)$,\1,p'` | |
2375 | fi | |
10ca6198 JJ |
2376 | 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'` |
2377 | ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'` | |
2378 | ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'` | |
2379 | ld_vers_patch=`expr "$ld_vers" : '[0-9]*\.[0-9]*\.\([0-9]*\)'` | |
55c4f715 RO |
2380 | else |
2381 | case "${target}" in | |
2382 | *-*-solaris2*) | |
e992fc2e RO |
2383 | # See acinclude.m4 (gcc_SUN_LD_VERSION) for the version number |
2384 | # format. | |
55c4f715 | 2385 | # |
e992fc2e RO |
2386 | # Don't reuse gcc_gv_sun_ld_vers_* in case a linker other than |
2387 | # /usr/ccs/bin/ld has been configured. | |
55c4f715 RO |
2388 | ld_ver=`$gcc_cv_ld -V 2>&1` |
2389 | if echo "$ld_ver" | grep 'Solaris Link Editors' > /dev/null; then | |
2390 | ld_vers=`echo $ld_ver | sed -n \ | |
2391 | -e 's,^.*: 5\.[0-9][0-9]*-\([0-9]\.[0-9][0-9]*\).*$,\1,p'` | |
2392 | ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'` | |
2393 | ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'` | |
2394 | fi | |
2395 | ;; | |
2396 | esac | |
10ca6198 JJ |
2397 | fi |
2398 | fi | |
2399 | changequote([,])dnl | |
2400 | ||
8ada417f | 2401 | AC_CACHE_CHECK(linker for .hidden support, gcc_cv_ld_hidden, |
e5dfb95f | 2402 | [[if test $in_tree_ld = yes ; then |
8ada417f ZW |
2403 | gcc_cv_ld_hidden=no |
2404 | 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 \ | |
2405 | && test $in_tree_ld_is_elf = yes; then | |
2406 | gcc_cv_ld_hidden=yes | |
2407 | fi | |
2408 | else | |
2409 | gcc_cv_ld_hidden=yes | |
55b46574 RO |
2410 | if test x"$ld_is_gold" = xyes; then |
2411 | : | |
2412 | elif echo "$ld_ver" | grep GNU > /dev/null; then | |
e2769e90 HPN |
2413 | case "${target}" in |
2414 | mmix-knuth-mmixware) | |
2415 | # The linker emits by default mmo, not ELF, so "no" is appropriate. | |
2416 | gcc_cv_ld_hidden=no | |
2417 | ;; | |
2418 | esac | |
8ada417f ZW |
2419 | if test 0"$ld_date" -lt 20020404; then |
2420 | if test -n "$ld_date"; then | |
2421 | # If there was date string, but was earlier than 2002-04-04, fail | |
2422 | gcc_cv_ld_hidden=no | |
2423 | elif test -z "$ld_vers"; then | |
2424 | # If there was no date string nor ld version number, something is wrong | |
2425 | gcc_cv_ld_hidden=no | |
2426 | else | |
8ada417f ZW |
2427 | test -z "$ld_vers_patch" && ld_vers_patch=0 |
2428 | if test "$ld_vers_major" -lt 2; then | |
2429 | gcc_cv_ld_hidden=no | |
2430 | elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 12; then | |
2431 | gcc_cv_ld_hidden="no" | |
2432 | elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -eq 12 -a "$ld_vers_patch" -eq 0; then | |
2433 | gcc_cv_ld_hidden=no | |
c72931a6 | 2434 | fi |
8ada417f | 2435 | fi |
789b7de5 | 2436 | fi |
8ada417f | 2437 | else |
28690784 | 2438 | case "${target}" in |
ee610fcd RO |
2439 | *-*-darwin*) |
2440 | # Darwin ld has some visibility support. | |
2441 | gcc_cv_ld_hidden=yes | |
2442 | ;; | |
b0fd7d27 | 2443 | hppa64*-*-hpux* | ia64*-*-hpux*) |
28690784 JDA |
2444 | gcc_cv_ld_hidden=yes |
2445 | ;; | |
d9f069ab | 2446 | *-*-solaris2.1[0-9]*) |
a93e1899 RO |
2447 | # Support for .hidden in Sun ld appeared in Solaris 9 FCS, but |
2448 | # .symbolic was only added in Solaris 9 12/02. | |
5e87dc23 RO |
2449 | gcc_cv_ld_hidden=yes |
2450 | ;; | |
28690784 JDA |
2451 | *) |
2452 | gcc_cv_ld_hidden=no | |
2453 | ;; | |
2454 | esac | |
8ada417f | 2455 | fi |
e5dfb95f | 2456 | fi]]) |
8ada417f | 2457 | libgcc_visibility=no |
9e944a16 | 2458 | AC_SUBST(libgcc_visibility) |
232b67d9 | 2459 | GCC_TARGET_TEMPLATE([HAVE_GAS_HIDDEN]) |
0f31374d | 2460 | if test $gcc_cv_as_hidden = yes && test $gcc_cv_ld_hidden = yes; then |
8ada417f ZW |
2461 | libgcc_visibility=yes |
2462 | AC_DEFINE(HAVE_GAS_HIDDEN, 1, | |
2463 | [Define if your assembler and linker support .hidden.]) | |
2464 | fi | |
6a9c5260 | 2465 | |
e73da78e RO |
2466 | AC_MSG_CHECKING(linker read-only and read-write section mixing) |
2467 | gcc_cv_ld_ro_rw_mix=unknown | |
2468 | if test $in_tree_ld = yes ; then | |
2469 | 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 \ | |
2470 | && test $in_tree_ld_is_elf = yes; then | |
2471 | gcc_cv_ld_ro_rw_mix=read-write | |
2472 | fi | |
2473 | elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then | |
2474 | echo '.section myfoosect, "a"' > conftest1.s | |
2475 | echo '.section myfoosect, "aw"' > conftest2.s | |
2476 | echo '.byte 1' >> conftest2.s | |
2477 | echo '.section myfoosect, "a"' > conftest3.s | |
2478 | echo '.byte 0' >> conftest3.s | |
2479 | if $gcc_cv_as -o conftest1.o conftest1.s > /dev/null 2>&1 \ | |
2480 | && $gcc_cv_as -o conftest2.o conftest2.s > /dev/null 2>&1 \ | |
2481 | && $gcc_cv_as -o conftest3.o conftest3.s > /dev/null 2>&1 \ | |
2482 | && $gcc_cv_ld -shared -o conftest1.so conftest1.o \ | |
2483 | conftest2.o conftest3.o > /dev/null 2>&1; then | |
2484 | gcc_cv_ld_ro_rw_mix=`$gcc_cv_objdump -h conftest1.so \ | |
2485 | | sed -e '/myfoosect/!d' -e N` | |
2486 | if echo "$gcc_cv_ld_ro_rw_mix" | grep CONTENTS > /dev/null; then | |
2487 | if echo "$gcc_cv_ld_ro_rw_mix" | grep READONLY > /dev/null; then | |
2488 | gcc_cv_ld_ro_rw_mix=read-only | |
2489 | else | |
2490 | gcc_cv_ld_ro_rw_mix=read-write | |
2491 | fi | |
2492 | fi | |
2493 | fi | |
2494 | changequote(,)dnl | |
2495 | rm -f conftest.* conftest[123].* | |
2496 | changequote([,])dnl | |
2497 | fi | |
2498 | if test x$gcc_cv_ld_ro_rw_mix = xread-write; then | |
2499 | AC_DEFINE(HAVE_LD_RO_RW_SECTION_MIXING, 1, | |
2500 | [Define if your linker links a mix of read-only | |
2501 | and read-write sections into a read-write section.]) | |
2502 | fi | |
2503 | AC_MSG_RESULT($gcc_cv_ld_ro_rw_mix) | |
2504 | ||
e9c9f128 JJ |
2505 | gcc_AC_INITFINI_ARRAY |
2506 | ||
8ada417f ZW |
2507 | # Check if we have .[us]leb128, and support symbol arithmetic with it. |
2508 | gcc_GAS_CHECK_FEATURE([.sleb128 and .uleb128], gcc_cv_as_leb128, | |
2509 | [elf,2,11,0],, | |
2510 | [ .data | |
b7460f24 RH |
2511 | .uleb128 L2 - L1 |
2512 | L1: | |
2513 | .uleb128 1280 | |
2514 | .sleb128 -1010 | |
8ada417f | 2515 | L2:], |
e5dfb95f | 2516 | [[# GAS versions before 2.11 do not support uleb128, |
8ada417f ZW |
2517 | # despite appearing to. |
2518 | # ??? There exists an elf-specific test that will crash | |
2519 | # the assembler. Perhaps it's better to figure out whether | |
2520 | # arbitrary sections are supported and try the test. | |
bace148a | 2521 | as_ver=`$gcc_cv_as --version 2>/dev/null | sed 1q` |
8ada417f | 2522 | if echo "$as_ver" | grep GNU > /dev/null; then |
ddcd0f6f | 2523 | as_vers=`echo $as_ver | sed -n \ |
115e6e55 | 2524 | -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*.*\)$,\1,p'` |
ddcd0f6f BS |
2525 | as_major=`expr "$as_vers" : '\([0-9]*\)'` |
2526 | as_minor=`expr "$as_vers" : '[0-9]*\.\([0-9]*\)'` | |
8ada417f ZW |
2527 | if test $as_major -eq 2 && test $as_minor -lt 11 |
2528 | then : | |
2529 | else gcc_cv_as_leb128=yes | |
2530 | fi | |
e5dfb95f | 2531 | fi]], |
8ada417f ZW |
2532 | [AC_DEFINE(HAVE_AS_LEB128, 1, |
2533 | [Define if your assembler supports .sleb128 and .uleb128.])]) | |
2534 | ||
d4ea4622 RH |
2535 | # Check if we have assembler support for unwind directives. |
2536 | gcc_GAS_CHECK_FEATURE([cfi directives], gcc_cv_as_cfi_directive, | |
6e60703f | 2537 | ,, |
d4ea4622 RH |
2538 | [ .text |
2539 | .cfi_startproc | |
2540 | .cfi_offset 0, 0 | |
2541 | .cfi_same_value 1 | |
2542 | .cfi_def_cfa 1, 2 | |
2543 | .cfi_escape 1, 2, 3, 4, 5 | |
e73da78e RO |
2544 | .cfi_endproc], |
2545 | [case "$target" in | |
2546 | *-*-solaris*) | |
2547 | # If the linker used on Solaris (like Sun ld) isn't capable of merging | |
2548 | # read-only and read-write sections, we need to make sure that the | |
2549 | # assembler used emits read-write .eh_frame sections. | |
2550 | if test "x$gcc_cv_ld_ro_rw_mix" != xread-write; then | |
2551 | if test "x$gcc_cv_objdump" != x; then | |
2552 | if $gcc_cv_objdump -h conftest.o 2>/dev/null | \ | |
2553 | sed -e /.eh_frame/!d -e N | grep READONLY > /dev/null; then | |
2554 | gcc_cv_as_cfi_directive=no | |
2555 | else | |
eb2573ee | 2556 | case "$target" in |
fbdd5d87 | 2557 | i?86-*-solaris2.1[[0-9]]* | x86_64-*-solaris2.1[[0-9]]*) |
ab0afae3 | 2558 | # On Solaris/x86, make sure that GCC and assembler agree on using |
eb2573ee | 2559 | # read-only .eh_frame sections for 64-bit. |
ab0afae3 RO |
2560 | if test x$gas = xyes; then |
2561 | as_ix86_64_opt="--64" | |
2562 | else | |
2563 | as_ix86_64_opt="-xarch=amd64" | |
2564 | fi | |
2565 | if $gcc_cv_as $as_ix86_64_opt -o conftest.o conftest.s > /dev/null 2>&1 && \ | |
eb2573ee RO |
2566 | $gcc_cv_objdump -h conftest.o 2>/dev/null | \ |
2567 | sed -e /.eh_frame/!d -e N | \ | |
2568 | grep READONLY > /dev/null; then | |
2569 | gcc_cv_as_cfi_directive=yes | |
2570 | else | |
2571 | gcc_cv_as_cfi_directive=no | |
2572 | fi | |
2573 | ;; | |
2574 | *) | |
2575 | gcc_cv_as_cfi_directive=yes | |
2576 | ;; | |
2577 | esac | |
e73da78e RO |
2578 | fi |
2579 | else | |
2580 | # no objdump, err on the side of caution | |
2581 | gcc_cv_as_cfi_directive=no | |
2582 | fi | |
2583 | else | |
2584 | gcc_cv_as_cfi_directive=yes | |
2585 | fi | |
2586 | ;; | |
2587 | *-*-*) | |
2588 | gcc_cv_as_cfi_directive=yes | |
2589 | ;; | |
2590 | esac]) | |
92053f38 | 2591 | if test $gcc_cv_as_cfi_directive = yes && test x$gcc_cv_objdump != x; then |
6e97481b JJ |
2592 | gcc_GAS_CHECK_FEATURE([working cfi advance], gcc_cv_as_cfi_advance_working, |
2593 | ,, | |
2594 | [ .text | |
2595 | .cfi_startproc | |
2596 | .cfi_adjust_cfa_offset 64 | |
7ac22e17 | 2597 | .skip 75040, 0 |
6e97481b JJ |
2598 | .cfi_adjust_cfa_offset 128 |
2599 | .cfi_endproc], | |
e5dfb95f | 2600 | [[ |
92053f38 | 2601 | if $gcc_cv_objdump -Wf conftest.o 2>/dev/null \ |
7ac22e17 | 2602 | | grep 'DW_CFA_advance_loc[24]:[ ][ ]*75040[ ]' >/dev/null; then |
6e97481b JJ |
2603 | gcc_cv_as_cfi_advance_working=yes |
2604 | fi | |
e5dfb95f | 2605 | ]]) |
6e97481b | 2606 | else |
92053f38 | 2607 | # no objdump, err on the side of caution |
66f91112 | 2608 | gcc_cv_as_cfi_advance_working=no |
6e97481b | 2609 | fi |
174425ad | 2610 | GCC_TARGET_TEMPLATE(HAVE_GAS_CFI_DIRECTIVE) |
d4ea4622 | 2611 | AC_DEFINE_UNQUOTED(HAVE_GAS_CFI_DIRECTIVE, |
6e97481b JJ |
2612 | [`if test $gcc_cv_as_cfi_directive = yes \ |
2613 | && test $gcc_cv_as_cfi_advance_working = yes; then echo 1; else echo 0; fi`], | |
058514b3 RH |
2614 | [Define 0/1 if your assembler supports CFI directives.]) |
2615 | ||
174425ad | 2616 | GCC_TARGET_TEMPLATE(HAVE_GAS_CFI_PERSONALITY_DIRECTIVE) |
058514b3 | 2617 | gcc_GAS_CHECK_FEATURE([cfi personality directive], |
6e60703f | 2618 | gcc_cv_as_cfi_personality_directive, ,, |
058514b3 | 2619 | [ .text |
042628f9 | 2620 | .cfi_startproc |
058514b3 RH |
2621 | .cfi_personality 0, symbol |
2622 | .cfi_endproc]) | |
2623 | AC_DEFINE_UNQUOTED(HAVE_GAS_CFI_PERSONALITY_DIRECTIVE, | |
2624 | [`if test $gcc_cv_as_cfi_personality_directive = yes; | |
2625 | then echo 1; else echo 0; fi`], | |
2626 | [Define 0/1 if your assembler supports .cfi_personality.]) | |
d4ea4622 | 2627 | |
7d45fb94 JJ |
2628 | gcc_GAS_CHECK_FEATURE([cfi sections directive], |
2629 | gcc_cv_as_cfi_sections_directive, ,, | |
2630 | [ .text | |
2631 | .cfi_sections .debug_frame, .eh_frame | |
2632 | .cfi_startproc | |
92053f38 RH |
2633 | .cfi_endproc], |
2634 | [case $target_os in | |
2635 | win32 | pe | cygwin* | mingw32* | uwin*) | |
2636 | # Need to check that we generated the correct relocation for the | |
2637 | # .debug_frame section. This was fixed for binutils 2.21. | |
2638 | gcc_cv_as_cfi_sections_directive=no | |
2639 | if test "x$gcc_cv_objdump" != x; then | |
2640 | if $gcc_cv_objdump -j .debug_frame -r conftest.o 2>/dev/null | \ | |
2641 | grep secrel > /dev/null; then | |
2642 | gcc_cv_as_cfi_sections_directive=yes | |
2643 | fi | |
2644 | fi | |
2645 | ;; | |
2646 | *) | |
2647 | gcc_cv_as_cfi_sections_directive=yes | |
2648 | ;; | |
2649 | esac]) | |
174425ad | 2650 | GCC_TARGET_TEMPLATE(HAVE_GAS_CFI_SECTIONS_DIRECTIVE) |
7d45fb94 JJ |
2651 | AC_DEFINE_UNQUOTED(HAVE_GAS_CFI_SECTIONS_DIRECTIVE, |
2652 | [`if test $gcc_cv_as_cfi_sections_directive = yes; | |
2653 | then echo 1; else echo 0; fi`], | |
2654 | [Define 0/1 if your assembler supports .cfi_sections.]) | |
2655 | ||
8ada417f ZW |
2656 | # GAS versions up to and including 2.11.0 may mis-optimize |
2657 | # .eh_frame data. | |
2658 | gcc_GAS_CHECK_FEATURE(eh_frame optimization, gcc_cv_as_eh_frame, | |
2659 | [elf,2,12,0],, | |
2660 | [ .text | |
c64688ae RH |
2661 | .LFB1: |
2662 | .4byte 0 | |
2663 | .L1: | |
2664 | .4byte 0 | |
2665 | .LFE1: | |
2666 | .section .eh_frame,"aw",@progbits | |
2667 | __FRAME_BEGIN__: | |
2668 | .4byte .LECIE1-.LSCIE1 | |
2669 | .LSCIE1: | |
2670 | .4byte 0x0 | |
2671 | .byte 0x1 | |
2672 | .ascii "z\0" | |
2673 | .byte 0x1 | |
2674 | .byte 0x78 | |
2675 | .byte 0x1a | |
2676 | .byte 0x0 | |
2677 | .byte 0x4 | |
2678 | .4byte 1 | |
2679 | .p2align 1 | |
2680 | .LECIE1: | |
2681 | .LSFDE1: | |
2682 | .4byte .LEFDE1-.LASFDE1 | |
2683 | .LASFDE1: | |
2684 | .4byte .LASFDE1-__FRAME_BEGIN__ | |
2685 | .4byte .LFB1 | |
2686 | .4byte .LFE1-.LFB1 | |
2687 | .byte 0x4 | |
2688 | .4byte .LFE1-.LFB1 | |
2689 | .byte 0x4 | |
2690 | .4byte .L1-.LFB1 | |
8ada417f | 2691 | .LEFDE1:], |
ba479fd2 NN |
2692 | [ dnl # For autoconf 2.5x, must protect trailing spaces with @&t@. |
2693 | cat > conftest.lit <<EOF | |
c64688ae RH |
2694 | 0000 10000000 00000000 017a0001 781a0004 .........z..x... |
2695 | 0010 01000000 12000000 18000000 00000000 ................ | |
ba479fd2 | 2696 | 0020 08000000 04080000 0044 .........D @&t@ |
01efb963 | 2697 | EOF |
ba479fd2 | 2698 | cat > conftest.big <<EOF |
01efb963 AS |
2699 | 0000 00000010 00000000 017a0001 781a0004 .........z..x... |
2700 | 0010 00000001 00000012 00000018 00000000 ................ | |
ba479fd2 | 2701 | 0020 00000008 04000000 0844 .........D @&t@ |
c64688ae | 2702 | EOF |
8ada417f ZW |
2703 | # If the assembler didn't choke, and we can objdump, |
2704 | # and we got the correct data, then succeed. | |
dbc02e7f AS |
2705 | # The text in the here-document typically retains its unix-style line |
2706 | # endings, while the output of objdump will use host line endings. | |
2707 | # Therefore, use diff -b for the comparisons. | |
8ada417f ZW |
2708 | if test x$gcc_cv_objdump != x \ |
2709 | && $gcc_cv_objdump -s -j .eh_frame conftest.o 2>/dev/null \ | |
2710 | | tail -3 > conftest.got \ | |
dbc02e7f AS |
2711 | && { diff -b conftest.lit conftest.got > /dev/null 2>&1 \ |
2712 | || diff -b conftest.big conftest.got > /dev/null 2>&1; } | |
8ada417f ZW |
2713 | then |
2714 | gcc_cv_as_eh_frame=yes | |
2715 | elif AC_TRY_COMMAND($gcc_cv_as -o conftest.o --traditional-format /dev/null); then | |
2716 | gcc_cv_as_eh_frame=buggy | |
2717 | else | |
2718 | # Uh oh, what do we do now? | |
2719 | gcc_cv_as_eh_frame=no | |
2720 | fi]) | |
2721 | ||
2722 | if test $gcc_cv_as_eh_frame = buggy; then | |
2723 | AC_DEFINE(USE_AS_TRADITIONAL_FORMAT, 1, | |
2724 | [Define if your assembler mis-optimizes .eh_frame data.]) | |
201556f0 | 2725 | fi |
201556f0 | 2726 | |
8ada417f ZW |
2727 | gcc_GAS_CHECK_FEATURE(section merging support, gcc_cv_as_shf_merge, |
2728 | [elf,2,12,0], [--fatal-warnings], | |
5d4856a0 | 2729 | [.section .rodata.str, "aMS", @progbits, 1]) |
c18a5b6c MM |
2730 | if test $gcc_cv_as_shf_merge = no; then |
2731 | gcc_GAS_CHECK_FEATURE(section merging support, gcc_cv_as_shf_merge, | |
2732 | [elf,2,12,0], [--fatal-warnings], | |
2733 | [.section .rodata.str, "aMS", %progbits, 1]) | |
2734 | fi | |
5d4856a0 RO |
2735 | AC_DEFINE_UNQUOTED(HAVE_GAS_SHF_MERGE, |
2736 | [`if test $gcc_cv_as_shf_merge = yes; then echo 1; else echo 0; fi`], | |
2737 | [Define 0/1 if your assembler supports marking sections with SHF_MERGE flag.]) | |
8ada417f | 2738 | |
2ca48caa RO |
2739 | gcc_GAS_CHECK_FEATURE([COMDAT group support (GNU as)], |
2740 | gcc_cv_as_comdat_group, | |
11176d2a | 2741 | [elf,2,16,0], [--fatal-warnings], |
c18a5b6c MM |
2742 | [.section .text,"axG",@progbits,.foo,comdat]) |
2743 | if test $gcc_cv_as_comdat_group = yes; then | |
2744 | gcc_cv_as_comdat_group_percent=no | |
2ca48caa | 2745 | gcc_cv_as_comdat_group_group=no |
c18a5b6c | 2746 | else |
2ca48caa RO |
2747 | gcc_GAS_CHECK_FEATURE([COMDAT group support (GNU as, %type)], |
2748 | gcc_cv_as_comdat_group_percent, | |
11176d2a | 2749 | [elf,2,16,0], [--fatal-warnings], |
c18a5b6c | 2750 | [.section .text,"axG",%progbits,.foo,comdat]) |
2ca48caa RO |
2751 | if test $gcc_cv_as_comdat_group_percent = yes; then |
2752 | gcc_cv_as_comdat_group_group=no | |
2753 | else | |
56626615 HPN |
2754 | if test -z "${gcc_cv_as_comdat_group_group+set}"; then |
2755 | gcc_cv_as_comdat_group_group=no | |
2756 | fi | |
2ca48caa RO |
2757 | case "${target}" in |
2758 | # Sun as uses a completely different syntax. | |
2759 | *-*-solaris2*) | |
2760 | case "${target}" in | |
2761 | sparc*-*-solaris2*) | |
2762 | conftest_s=' | |
2763 | .group foo,".text%foo",#comdat | |
2764 | .section ".text%foo", #alloc,#execinstr,#progbits | |
2765 | .globl foo | |
2766 | foo: | |
2767 | ' | |
2768 | ;; | |
fbdd5d87 | 2769 | i?86-*-solaris2* | x86_64-*-solaris2.1[[0-9]]*) |
2ca48caa RO |
2770 | conftest_s=' |
2771 | .group foo,.text%foo,#comdat | |
2772 | .section .text%foo, "ax", @progbits | |
2773 | .globl foo | |
2774 | foo: | |
2775 | ' | |
2776 | ;; | |
2777 | esac | |
2778 | gcc_GAS_CHECK_FEATURE([COMDAT group support (Sun as, .group)], | |
2779 | gcc_cv_as_comdat_group_group, | |
2780 | ,, [$conftest_s]) | |
2781 | ;; | |
2782 | esac | |
2783 | fi | |
c18a5b6c | 2784 | fi |
1dcc82c2 DK |
2785 | if test x"$ld_is_gold" = xyes; then |
2786 | comdat_group=yes | |
2787 | elif test $in_tree_ld = yes ; then | |
39ba7b7d JB |
2788 | comdat_group=no |
2789 | 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 \ | |
2790 | && test $in_tree_ld_is_elf = yes; then | |
2791 | comdat_group=yes | |
2792 | fi | |
55c4f715 | 2793 | elif echo "$ld_ver" | grep GNU > /dev/null; then |
11176d2a JB |
2794 | comdat_group=yes |
2795 | if test 0"$ld_date" -lt 20050308; then | |
2796 | if test -n "$ld_date"; then | |
2797 | # If there was date string, but was earlier than 2005-03-08, fail | |
2798 | comdat_group=no | |
2799 | elif test "$ld_vers_major" -lt 2; then | |
2800 | comdat_group=no | |
2801 | elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 16; then | |
2802 | comdat_group=no | |
2803 | fi | |
2804 | fi | |
1cf0118d | 2805 | else |
55c4f715 RO |
2806 | changequote(,)dnl |
2807 | case "${target}" in | |
2808 | *-*-solaris2.1[1-9]*) | |
2ca48caa | 2809 | comdat_group=no |
55c4f715 RO |
2810 | # Sun ld has COMDAT group support since Solaris 9, but it doesn't |
2811 | # interoperate with GNU as until Solaris 11 build 130, i.e. ld | |
2812 | # version 1.688. | |
2813 | # | |
2ca48caa RO |
2814 | # If using Sun as for COMDAT group as emitted by GCC, one needs at |
2815 | # least ld version 1.2267. | |
2816 | if test "$ld_vers_major" -gt 1; then | |
55c4f715 | 2817 | comdat_group=yes |
2ca48caa RO |
2818 | elif test "x$gas_flag" = xyes && test "$ld_vers_minor" -ge 1688; then |
2819 | comdat_group=yes | |
2820 | elif test "$ld_vers_minor" -ge 2267; then | |
2821 | comdat_group=yes | |
55c4f715 RO |
2822 | fi |
2823 | ;; | |
2824 | *) | |
2825 | # Assume linkers other than GNU ld don't support COMDAT group. | |
2826 | comdat_group=no | |
2827 | ;; | |
2828 | esac | |
2829 | changequote([,])dnl | |
1cf0118d | 2830 | fi |
55c4f715 RO |
2831 | # Allow overriding the automatic COMDAT group tests above. |
2832 | AC_ARG_ENABLE(comdat, | |
2833 | [AS_HELP_STRING([--enable-comdat], [enable COMDAT group support])], | |
2834 | [comdat_group="$enable_comdat"]) | |
1cf0118d RO |
2835 | if test $comdat_group = no; then |
2836 | gcc_cv_as_comdat_group=no | |
2837 | gcc_cv_as_comdat_group_percent=no | |
2ca48caa | 2838 | gcc_cv_as_comdat_group_group=no |
11176d2a JB |
2839 | fi |
2840 | AC_DEFINE_UNQUOTED(HAVE_COMDAT_GROUP, | |
2ca48caa RO |
2841 | [`if test $gcc_cv_as_comdat_group = yes \ |
2842 | || test $gcc_cv_as_comdat_group_percent = yes \ | |
2843 | || test $gcc_cv_as_comdat_group_group = yes; then echo 1; else echo 0; fi`], | |
11176d2a | 2844 | [Define 0/1 if your assembler and linker support COMDAT groups.]) |
c18a5b6c | 2845 | |
6c52e687 CC |
2846 | gcc_GAS_CHECK_FEATURE([line table discriminator support], |
2847 | gcc_cv_as_discriminator, | |
2848 | [2,19,51],, | |
2849 | [ .text | |
2850 | .file 1 "conf.c" | |
2851 | .loc 1 1 0 discriminator 1],, | |
2852 | [AC_DEFINE(HAVE_GAS_DISCRIMINATOR, 1, | |
2853 | [Define if your assembler supports the .loc discriminator sub-directive.])]) | |
2854 | ||
6a7a462c | 2855 | # Thread-local storage - the check is heavily parameterized. |
f996902d RH |
2856 | conftest_s= |
2857 | tls_first_major= | |
2858 | tls_first_minor= | |
9739c90c | 2859 | tls_as_opt= |
f996902d RH |
2860 | case "$target" in |
2861 | changequote(,)dnl | |
6f9b006d RH |
2862 | alpha*-*-*) |
2863 | conftest_s=' | |
2864 | .section ".tdata","awT",@progbits | |
2865 | foo: .long 25 | |
2866 | .text | |
2867 | ldq $27,__tls_get_addr($29) !literal!1 | |
2868 | lda $16,foo($29) !tlsgd!1 | |
2869 | jsr $26,($27),__tls_get_addr !lituse_tlsgd!1 | |
2870 | ldq $27,__tls_get_addr($29) !literal!2 | |
2871 | lda $16,foo($29) !tlsldm!2 | |
2872 | jsr $26,($27),__tls_get_addr !lituse_tlsldm!2 | |
2873 | ldq $1,foo($29) !gotdtprel | |
2874 | ldah $2,foo($29) !dtprelhi | |
2875 | lda $3,foo($2) !dtprello | |
2876 | lda $4,foo($29) !dtprel | |
2877 | ldq $1,foo($29) !gottprel | |
2878 | ldah $2,foo($29) !tprelhi | |
2879 | lda $3,foo($2) !tprello | |
2880 | lda $4,foo($29) !tprel' | |
2881 | tls_first_major=2 | |
2882 | tls_first_minor=13 | |
2f3321ca | 2883 | tls_as_opt=--fatal-warnings |
6f9b006d | 2884 | ;; |
ad9646c7 HPN |
2885 | cris-*-*|crisv32-*-*) |
2886 | conftest_s=' | |
2887 | .section ".tdata","awT",@progbits | |
2888 | x: .long 25 | |
2889 | .text | |
2890 | move.d x:IE,$r10 | |
2891 | nop' | |
2892 | tls_first_major=2 | |
2893 | tls_first_minor=20 | |
2894 | tls_as_opt=--fatal-warnings | |
2895 | ;; | |
e4dd71de AH |
2896 | frv*-*-*) |
2897 | conftest_s=' | |
2898 | .section ".tdata","awT",@progbits | |
2899 | x: .long 25 | |
2900 | .text | |
2901 | call #gettlsoff(x)' | |
2902 | tls_first_major=2 | |
2903 | tls_first_minor=14 | |
2904 | ;; | |
51076f96 RC |
2905 | hppa*-*-linux*) |
2906 | conftest_s=' | |
2907 | t1: .reg %r20 | |
2908 | t2: .reg %r21 | |
2909 | gp: .reg %r19 | |
2910 | .section ".tdata","awT",@progbits | |
2911 | foo: .long 25 | |
2912 | .text | |
2913 | .align 4 | |
2914 | addil LT%foo-$tls_gdidx$,gp | |
2915 | ldo RT%foo-$tls_gdidx$(%r1),%arg0 | |
2916 | b __tls_get_addr | |
2917 | nop | |
2918 | addil LT%foo-$tls_ldidx$,gp | |
2919 | b __tls_get_addr | |
2920 | ldo RT%foo-$tls_ldidx$(%r1),%arg0 | |
2921 | addil LR%foo-$tls_dtpoff$,%ret0 | |
2922 | ldo RR%foo-$tls_dtpoff$(%r1),%t1 | |
2923 | mfctl %cr27,%t1 | |
2924 | addil LT%foo-$tls_ieoff$,gp | |
2925 | ldw RT%foo-$tls_ieoff$(%r1),%t2 | |
2926 | add %t1,%t2,%t3 | |
2927 | mfctl %cr27,%t1 | |
2928 | addil LR%foo-$tls_leoff$,%t1 | |
2929 | ldo RR%foo-$tls_leoff$(%r1),%t2' | |
2930 | tls_first_major=2 | |
2931 | tls_first_minor=15 | |
2932 | tls_as_opt=--fatal-warnings | |
2933 | ;; | |
d3585b76 DJ |
2934 | arm*-*-*) |
2935 | conftest_s=' | |
2936 | .section ".tdata","awT",%progbits | |
2937 | foo: .long 25 | |
2938 | .text | |
2939 | .word foo(gottpoff) | |
2940 | .word foo(tpoff) | |
2941 | .word foo(tlsgd) | |
2942 | .word foo(tlsldm) | |
2943 | .word foo(tlsldo)' | |
2944 | tls_first_major=2 | |
2945 | tls_first_minor=17 | |
2946 | ;; | |
fe4e71e4 | 2947 | i[34567]86-*-* | x86_64-*-*) |
f1c26cad | 2948 | case "$target" in |
c02f59e2 | 2949 | i[34567]86-*-solaris2.* | x86_64-*-solaris2.1[0-9]*) |
f1c26cad | 2950 | on_solaris=yes |
fbdd5d87 | 2951 | ;; |
f1c26cad RO |
2952 | *) |
2953 | on_solaris=no | |
2954 | ;; | |
2955 | esac | |
2956 | if test x$on_solaris = xyes && test x$gas_flag = xno; then | |
2957 | conftest_s=' | |
2958 | .section .tdata,"awt",@progbits' | |
2959 | tls_first_major=0 | |
2960 | tls_first_minor=0 | |
caa16d41 | 2961 | tls_section_flag=t |
f1c26cad RO |
2962 | changequote([,])dnl |
2963 | AC_DEFINE(TLS_SECTION_ASM_FLAG, 't', | |
2964 | [Define to the flag used to mark TLS sections if the default (`T') doesn't work.]) | |
2965 | changequote(,)dnl | |
2966 | else | |
2967 | conftest_s=' | |
2968 | .section ".tdata","awT",@progbits' | |
2969 | tls_first_major=2 | |
2970 | tls_first_minor=14 | |
caa16d41 | 2971 | tls_section_flag=T |
f1c26cad RO |
2972 | tls_as_opt="--fatal-warnings" |
2973 | fi | |
fe4e71e4 RO |
2974 | case "$target" in |
2975 | i[34567]86-*-*) | |
2976 | conftest_s="$conftest_s | |
f996902d RH |
2977 | foo: .long 25 |
2978 | .text | |
2979 | movl %gs:0, %eax | |
f1c26cad RO |
2980 | leal foo@tlsgd(,%ebx,1), %eax |
2981 | leal foo@tlsldm(%ebx), %eax | |
2982 | leal foo@dtpoff(%eax), %edx | |
2983 | movl foo@gottpoff(%ebx), %eax | |
2984 | subl foo@gottpoff(%ebx), %eax | |
2985 | addl foo@gotntpoff(%ebx), %eax | |
2986 | movl foo@indntpoff, %eax | |
2987 | movl \$foo@tpoff, %eax | |
2988 | subl \$foo@tpoff, %eax | |
2989 | leal foo@ntpoff(%ecx), %eax" | |
fe4e71e4 RO |
2990 | ;; |
2991 | x86_64-*-*) | |
2992 | if test x$on_solaris = xyes; then | |
2993 | case $gas_flag in | |
2994 | yes) tls_as_opt="$tls_as_opt --64" ;; | |
2995 | no) tls_as_opt="$tls_as_opt -xarch=amd64" ;; | |
2996 | esac | |
2997 | fi | |
2998 | conftest_s="$conftest_s | |
75d38379 JJ |
2999 | foo: .long 25 |
3000 | .text | |
3001 | movq %fs:0, %rax | |
fe4e71e4 RO |
3002 | leaq foo@tlsgd(%rip), %rdi |
3003 | leaq foo@tlsld(%rip), %rdi | |
3004 | leaq foo@dtpoff(%rax), %rdx | |
3005 | movq foo@gottpoff(%rip), %rax | |
3006 | movq \$foo@tpoff, %rax" | |
3007 | ;; | |
3008 | esac | |
3009 | ;; | |
7b6e506e RH |
3010 | ia64-*-*) |
3011 | conftest_s=' | |
3012 | .section ".tdata","awT",@progbits | |
3013 | foo: data8 25 | |
3014 | .text | |
3015 | addl r16 = @ltoff(@dtpmod(foo#)), gp | |
3016 | addl r17 = @ltoff(@dtprel(foo#)), gp | |
3017 | addl r18 = @ltoff(@tprel(foo#)), gp | |
3018 | addl r19 = @dtprel(foo#), gp | |
3019 | adds r21 = @dtprel(foo#), r13 | |
3020 | movl r23 = @dtprel(foo#) | |
3021 | addl r20 = @tprel(foo#), gp | |
3022 | adds r22 = @tprel(foo#), r13 | |
3023 | movl r24 = @tprel(foo#)' | |
3024 | tls_first_major=2 | |
3025 | tls_first_minor=13 | |
2f3321ca | 3026 | tls_as_opt=--fatal-warnings |
7b6e506e | 3027 | ;; |
8cc9a5a5 EI |
3028 | microblaze*-*-*) |
3029 | conftest_s=' | |
3030 | .section .tdata,"awT",@progbits | |
3031 | x: | |
3032 | .word 2 | |
3033 | .text | |
3034 | addik r5,r20,x@TLSGD | |
3035 | addik r5,r20,x@TLSLDM' | |
3036 | tls_first_major=2 | |
3037 | tls_first_minor=20 | |
3038 | tls_as_opt='--fatal-warnings' | |
3039 | ;; | |
69229b81 DJ |
3040 | mips*-*-*) |
3041 | conftest_s=' | |
3042 | .section .tdata,"awT",@progbits | |
3043 | x: | |
3044 | .word 2 | |
3045 | .text | |
3046 | addiu $4, $28, %tlsgd(x) | |
3047 | addiu $4, $28, %tlsldm(x) | |
3048 | lui $4, %dtprel_hi(x) | |
3049 | addiu $4, $4, %dtprel_lo(x) | |
3050 | lw $4, %gottprel(x)($28) | |
3051 | lui $4, %tprel_hi(x) | |
3052 | addiu $4, $4, %tprel_lo(x)' | |
3053 | tls_first_major=2 | |
3054 | tls_first_minor=16 | |
3055 | tls_as_opt='-32 --fatal-warnings' | |
3056 | ;; | |
75df395f MK |
3057 | m68k-*-*) |
3058 | conftest_s=' | |
3059 | .section .tdata,"awT",@progbits | |
3060 | x: | |
3061 | .word 2 | |
3062 | .text | |
3063 | foo: | |
3064 | move.l x@TLSGD(%a5),%a0 | |
3065 | move.l x@TLSLDM(%a5),%a0 | |
3066 | move.l x@TLSLDO(%a5),%a0 | |
3067 | move.l x@TLSIE(%a5),%a0 | |
3068 | move.l x@TLSLE(%a5),%a0' | |
3069 | tls_first_major=2 | |
3070 | tls_first_minor=19 | |
3071 | tls_as_opt='--fatal-warnings' | |
3072 | ;; | |
e430824f CLT |
3073 | nios2-*-*) |
3074 | conftest_s=' | |
3075 | .section ".tdata","awT",@progbits' | |
3076 | tls_first_major=2 | |
3077 | tls_first_minor=23 | |
3078 | tls_as_opt="--fatal-warnings" | |
3079 | ;; | |
24034425 IB |
3080 | aarch64*-*-*) |
3081 | conftest_s=' | |
3082 | .section ".tdata","awT",%progbits | |
3083 | foo: .long 25 | |
3084 | .text | |
3085 | adrp x0, :tlsgd:x | |
3086 | add x0, x0, #:tlsgd_lo12:x | |
3087 | bl __tls_get_addr | |
3088 | nop' | |
3089 | tls_first_major=2 | |
3090 | tls_first_minor=20 | |
3091 | tls_as_opt='--fatal-warnings' | |
3092 | ;; | |
7a8b1ec4 DE |
3093 | powerpc-ibm-aix*) |
3094 | conftest_s=' | |
3095 | .extern __get_tpointer | |
3096 | .toc | |
3097 | LC..1: | |
3098 | .tc a[TC],a[TL]@le | |
3099 | .csect .text[PR] | |
3100 | .tlstest: | |
3101 | lwz 9,LC..1(2) | |
3102 | bla __get_tpointer | |
3103 | lwzx 3,9,3 | |
3104 | .globl a | |
3105 | .csect a[TL],4 | |
3106 | a: | |
3107 | .space 4' | |
3108 | tls_first_major=0 | |
3109 | tls_first_minor=0 | |
3110 | ;; | |
227eb343 | 3111 | powerpc64*-*-*) |
c4501e62 JJ |
3112 | conftest_s=' |
3113 | .section ".tdata","awT",@progbits | |
3114 | .align 3 | |
3115 | ld0: .space 8 | |
3116 | ld1: .space 8 | |
3117 | x1: .space 8 | |
3118 | x2: .space 8 | |
3119 | x3: .space 8 | |
3120 | .text | |
3121 | addi 3,2,ld0@got@tlsgd | |
3122 | bl .__tls_get_addr | |
3123 | nop | |
3124 | addi 3,2,ld1@toc | |
3125 | bl .__tls_get_addr | |
3126 | nop | |
3127 | addi 3,2,x1@got@tlsld | |
3128 | bl .__tls_get_addr | |
3129 | nop | |
3130 | addi 9,3,x1@dtprel | |
3131 | bl .__tls_get_addr | |
3132 | nop | |
3133 | addis 9,3,x2@dtprel@ha | |
3134 | addi 9,9,x2@dtprel@l | |
3135 | bl .__tls_get_addr | |
3136 | nop | |
3137 | ld 9,x3@got@dtprel(2) | |
3138 | add 9,9,3 | |
3139 | bl .__tls_get_addr | |
3140 | nop' | |
3141 | tls_first_major=2 | |
3142 | tls_first_minor=14 | |
2f3321ca | 3143 | tls_as_opt="-a64 --fatal-warnings" |
c4501e62 | 3144 | ;; |
01ae4861 AM |
3145 | powerpc*-*-*) |
3146 | conftest_s=' | |
3147 | .section ".tdata","awT",@progbits | |
3148 | .align 2 | |
3149 | ld0: .space 4 | |
3150 | ld1: .space 4 | |
3151 | x1: .space 4 | |
3152 | x2: .space 4 | |
3153 | x3: .space 4 | |
3154 | .text | |
3155 | addi 3,31,ld0@got@tlsgd | |
3156 | bl __tls_get_addr | |
3157 | addi 3,31,x1@got@tlsld | |
3158 | bl __tls_get_addr | |
3159 | addi 9,3,x1@dtprel | |
3160 | addis 9,3,x2@dtprel@ha | |
3161 | addi 9,9,x2@dtprel@l | |
3162 | lwz 9,x3@got@tprel(31) | |
3163 | add 9,9,x@tls | |
3164 | addi 9,2,x1@tprel | |
3165 | addis 9,2,x2@tprel@ha | |
3166 | addi 9,9,x2@tprel@l' | |
3167 | tls_first_major=2 | |
3168 | tls_first_minor=14 | |
3169 | tls_as_opt="-a32 --fatal-warnings" | |
3170 | ;; | |
fd3cd001 UW |
3171 | s390-*-*) |
3172 | conftest_s=' | |
3173 | .section ".tdata","awT",@progbits | |
3174 | foo: .long 25 | |
3175 | .text | |
3176 | .long foo@TLSGD | |
3177 | .long foo@TLSLDM | |
3178 | .long foo@DTPOFF | |
3179 | .long foo@NTPOFF | |
3180 | .long foo@GOTNTPOFF | |
3181 | .long foo@INDNTPOFF | |
3182 | l %r1,foo@GOTNTPOFF(%r12) | |
3183 | l %r1,0(%r1):tls_load:foo | |
3184 | bas %r14,0(%r1,%r13):tls_gdcall:foo | |
3185 | bas %r14,0(%r1,%r13):tls_ldcall:foo' | |
3186 | tls_first_major=2 | |
3187 | tls_first_minor=14 | |
2f3321ca | 3188 | tls_as_opt="-m31 --fatal-warnings" |
fd3cd001 UW |
3189 | ;; |
3190 | s390x-*-*) | |
3191 | conftest_s=' | |
3192 | .section ".tdata","awT",@progbits | |
3193 | foo: .long 25 | |
3194 | .text | |
3195 | .quad foo@TLSGD | |
3196 | .quad foo@TLSLDM | |
3197 | .quad foo@DTPOFF | |
3198 | .quad foo@NTPOFF | |
3199 | .quad foo@GOTNTPOFF | |
3200 | lg %r1,foo@GOTNTPOFF(%r12) | |
3201 | larl %r1,foo@INDNTPOFF | |
3202 | brasl %r14,__tls_get_offset@PLT:tls_gdcall:foo | |
3203 | brasl %r14,__tls_get_offset@PLT:tls_ldcall:foo' | |
3204 | tls_first_major=2 | |
3205 | tls_first_minor=14 | |
2f3321ca | 3206 | tls_as_opt="-m64 -Aesame --fatal-warnings" |
fd3cd001 | 3207 | ;; |
9ff13962 KK |
3208 | sh-*-* | sh[34]-*-*) |
3209 | conftest_s=' | |
3210 | .section ".tdata","awT",@progbits | |
3211 | foo: .long 25 | |
3212 | .text | |
3213 | .long foo@TLSGD | |
3214 | .long foo@TLSLDM | |
3215 | .long foo@DTPOFF | |
3216 | .long foo@GOTTPOFF | |
3217 | .long foo@TPOFF' | |
3218 | tls_first_major=2 | |
3219 | tls_first_minor=13 | |
2f3321ca | 3220 | tls_as_opt=--fatal-warnings |
9ff13962 | 3221 | ;; |
5751a10b | 3222 | sparc*-*-*) |
2f3321ca EB |
3223 | case "$target" in |
3224 | sparc*-sun-solaris2.*) | |
3225 | on_solaris=yes | |
3226 | ;; | |
3227 | *) | |
3228 | on_solaris=no | |
3229 | ;; | |
3230 | esac | |
3231 | if test x$on_solaris = xyes && test x$gas_flag = xno; then | |
3232 | conftest_s=' | |
16c9d3b1 | 3233 | .section ".tdata",#alloc,#write,#tls' |
2f3321ca EB |
3234 | tls_first_major=0 |
3235 | tls_first_minor=0 | |
3236 | else | |
3237 | conftest_s=' | |
16c9d3b1 RO |
3238 | .section ".tdata","awT",@progbits' |
3239 | tls_first_major=2 | |
3240 | tls_first_minor=14 | |
3241 | tls_as_opt="-32 --fatal-warnings" | |
3242 | fi | |
3243 | conftest_s="$conftest_s | |
5751a10b JJ |
3244 | foo: .long 25 |
3245 | .text | |
3246 | sethi %tgd_hi22(foo), %o0 | |
3247 | add %o0, %tgd_lo10(foo), %o1 | |
3248 | add %l7, %o1, %o0, %tgd_add(foo) | |
3249 | call __tls_get_addr, %tgd_call(foo) | |
3250 | sethi %tldm_hi22(foo), %l1 | |
3251 | add %l1, %tldm_lo10(foo), %l2 | |
3252 | add %l7, %l2, %o0, %tldm_add(foo) | |
3253 | call __tls_get_addr, %tldm_call(foo) | |
3254 | sethi %tldo_hix22(foo), %l3 | |
3255 | xor %l3, %tldo_lox10(foo), %l4 | |
3256 | add %o0, %l4, %l5, %tldo_add(foo) | |
3257 | sethi %tie_hi22(foo), %o3 | |
3258 | add %o3, %tie_lo10(foo), %o3 | |
3259 | ld [%l7 + %o3], %o2, %tie_ld(foo) | |
3260 | add %g7, %o2, %o4, %tie_add(foo) | |
3261 | sethi %tle_hix22(foo), %l1 | |
3262 | xor %l1, %tle_lox10(foo), %o5 | |
16c9d3b1 | 3263 | ld [%g7 + %o5], %o1" |
5751a10b | 3264 | ;; |
dd552284 WL |
3265 | tilepro*-*-*) |
3266 | conftest_s=' | |
3267 | .section ".tdata","awT",@progbits | |
3268 | foo: .long 25 | |
3269 | .text | |
3270 | addli r0, zero, tls_gd(foo) | |
3271 | auli r0, zero, tls_gd_ha16(foo) | |
3272 | addli r0, r0, tls_gd_lo16(foo) | |
3273 | jal __tls_get_addr | |
3274 | addli r0, zero, tls_ie(foo) | |
3275 | auli r0, r0, tls_ie_ha16(foo) | |
3276 | addli r0, r0, tls_ie_lo16(foo)' | |
3277 | tls_first_major=2 | |
3278 | tls_first_minor=22 | |
3279 | tls_as_opt="--fatal-warnings" | |
3280 | ;; | |
3281 | tilegx*-*-*) | |
3282 | conftest_s=' | |
3283 | .section ".tdata","awT",@progbits | |
3284 | foo: .long 25 | |
3285 | .text | |
3286 | shl16insli r0, zero, hw0_last_tls_gd(foo) | |
3287 | shl16insli r0, zero, hw1_last_tls_gd(foo) | |
3288 | shl16insli r0, r0, hw0_tls_gd(foo) | |
3289 | jal __tls_get_addr | |
3290 | shl16insli r0, zero, hw1_last_tls_ie(foo) | |
3291 | shl16insli r0, r0, hw0_tls_ie(foo)' | |
3292 | tls_first_major=2 | |
3293 | tls_first_minor=22 | |
3294 | tls_as_opt="--fatal-warnings" | |
3295 | ;; | |
6a7a462c BW |
3296 | xtensa*-*-*) |
3297 | conftest_s=' | |
3298 | .section ".tdata","awT",@progbits | |
3299 | foo: .long 25 | |
3300 | .text | |
3301 | movi a8, foo@TLSFUNC | |
3302 | movi a10, foo@TLSARG | |
3303 | callx8.tls a8, foo@TLSCALL' | |
3304 | tls_first_major=2 | |
3305 | tls_first_minor=19 | |
3306 | ;; | |
5751a10b | 3307 | changequote([,])dnl |
f996902d | 3308 | esac |
8dea1cca DD |
3309 | set_have_as_tls=no |
3310 | if test "x$enable_tls" = xno ; then | |
3311 | : # TLS explicitly disabled. | |
3312 | elif test "x$enable_tls" = xyes ; then | |
3313 | set_have_as_tls=yes # TLS explicitly enabled. | |
3314 | elif test -z "$tls_first_major"; then | |
8ada417f ZW |
3315 | : # If we don't have a check, assume no support. |
3316 | else | |
3317 | gcc_GAS_CHECK_FEATURE(thread-local storage support, gcc_cv_as_tls, | |
2f3321ca | 3318 | [$tls_first_major,$tls_first_minor,0], [$tls_as_opt], [$conftest_s],, |
8dea1cca DD |
3319 | [set_have_as_tls=yes]) |
3320 | fi | |
3321 | if test $set_have_as_tls = yes ; then | |
3322 | AC_DEFINE(HAVE_AS_TLS, 1, | |
16c9d3b1 | 3323 | [Define if your assembler and linker support thread-local storage.]) |
f996902d | 3324 | fi |
8ada417f ZW |
3325 | |
3326 | # Target-specific assembler checks. | |
f996902d | 3327 | |
7e9d8517 L |
3328 | AC_MSG_CHECKING(linker -Bstatic/-Bdynamic option) |
3329 | gcc_cv_ld_static_dynamic=no | |
c6092243 RO |
3330 | gcc_cv_ld_static_option='-Bstatic' |
3331 | gcc_cv_ld_dynamic_option='-Bdynamic' | |
7e9d8517 | 3332 | if test $in_tree_ld = yes ; then |
83f0ccb8 | 3333 | 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; then |
7e9d8517 L |
3334 | gcc_cv_ld_static_dynamic=yes |
3335 | fi | |
3336 | elif test x$gcc_cv_ld != x; then | |
bb127cd8 RO |
3337 | # Check if linker supports -Bstatic/-Bdynamic option |
3338 | if $gcc_cv_ld --help 2>/dev/null | grep -- -Bstatic > /dev/null \ | |
3339 | && $gcc_cv_ld --help 2>/dev/null | grep -- -Bdynamic > /dev/null; then | |
3340 | gcc_cv_ld_static_dynamic=yes | |
3341 | else | |
3342 | case "$target" in | |
478f60f9 MH |
3343 | # AIX ld uses -b flags |
3344 | *-*-aix4.[[23]]* | *-*-aix[[5-9]]*) | |
3345 | gcc_cv_ld_static_dynamic=yes | |
3346 | gcc_cv_ld_static_option="-bstatic" | |
3347 | gcc_cv_ld_dynamic_option="-bdynamic" | |
3348 | ;; | |
f903e000 SE |
3349 | # HP-UX ld uses -a flags to select between shared and archive. |
3350 | *-*-hpux*) | |
3351 | if test x"$gnu_ld" = xno; then | |
3352 | gcc_cv_ld_static_dynamic=yes | |
3353 | gcc_cv_ld_static_option="-aarchive_shared" | |
3354 | gcc_cv_ld_dynamic_option="-adefault" | |
3355 | fi | |
3356 | ;; | |
bb127cd8 RO |
3357 | # Solaris 2 ld always supports -Bstatic/-Bdynamic. |
3358 | *-*-solaris2*) | |
3359 | gcc_cv_ld_static_dynamic=yes | |
3360 | ;; | |
3361 | esac | |
3362 | fi | |
7e9d8517 L |
3363 | fi |
3364 | if test x"$gcc_cv_ld_static_dynamic" = xyes; then | |
3365 | AC_DEFINE(HAVE_LD_STATIC_DYNAMIC, 1, | |
c6092243 RO |
3366 | [Define if your linker supports -Bstatic/-Bdynamic or equivalent options.]) |
3367 | AC_DEFINE_UNQUOTED(LD_STATIC_OPTION, "$gcc_cv_ld_static_option", | |
3368 | [Define to the linker option to disable use of shared objects.]) | |
3369 | AC_DEFINE_UNQUOTED(LD_DYNAMIC_OPTION, "$gcc_cv_ld_dynamic_option", | |
3370 | [Define to the linker option to enable use of shared objects.]) | |
7e9d8517 L |
3371 | fi |
3372 | AC_MSG_RESULT($gcc_cv_ld_static_dynamic) | |
3373 | ||
d594623a L |
3374 | if test x"$demangler_in_ld" = xyes; then |
3375 | AC_MSG_CHECKING(linker --demangle support) | |
3376 | gcc_cv_ld_demangle=no | |
3377 | if test $in_tree_ld = yes; then | |
3378 | 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 \ | |
3379 | gcc_cv_ld_demangle=yes | |
3380 | fi | |
3381 | elif test x$gcc_cv_ld != x -a x"$gnu_ld" = xyes; then | |
3382 | # Check if the GNU linker supports --demangle option | |
3383 | if $gcc_cv_ld --help 2>/dev/null | grep no-demangle > /dev/null; then | |
3384 | gcc_cv_ld_demangle=yes | |
3385 | fi | |
3386 | fi | |
3387 | if test x"$gcc_cv_ld_demangle" = xyes; then | |
3388 | AC_DEFINE(HAVE_LD_DEMANGLE, 1, | |
3389 | [Define if your linker supports --demangle option.]) | |
3390 | fi | |
3391 | AC_MSG_RESULT($gcc_cv_ld_demangle) | |
3392 | fi | |
3393 | ||
96bdf9b4 | 3394 | AC_MSG_CHECKING(linker plugin support) |
55b46574 | 3395 | gcc_cv_lto_plugin=0 |
f3d533d3 | 3396 | if test -f liblto_plugin.la; then |
df33b41f RO |
3397 | save_ld_ver="$ld_ver" |
3398 | save_ld_vers_major="$ld_vers_major" | |
3399 | save_ld_vers_minor="$ld_vers_minor" | |
3400 | save_ld_is_gold="$ld_is_gold" | |
3401 | ||
3402 | ld_is_gold=no | |
55b46574 | 3403 | |
df33b41f RO |
3404 | if test $in_tree_ld = yes -a x"$ORIGINAL_PLUGIN_LD_FOR_TARGET" = x"$gcc_cv_ld"; then |
3405 | ld_ver="GNU ld" | |
3406 | # FIXME: ld_is_gold? | |
3407 | ld_vers_major="$gcc_cv_gld_major_version" | |
3408 | ld_vers_minor="$gcc_cv_gld_minor_version" | |
3409 | else | |
3410 | # Determine plugin linker version. | |
3411 | # FIXME: Partial duplicate from above, generalize. | |
3412 | changequote(,)dnl | |
3413 | ld_ver=`$ORIGINAL_PLUGIN_LD_FOR_TARGET --version 2>/dev/null | sed 1q` | |
3414 | if echo "$ld_ver" | grep GNU > /dev/null; then | |
3415 | if echo "$ld_ver" | grep "GNU gold" > /dev/null; then | |
3416 | ld_is_gold=yes | |
3417 | ld_vers=`echo $ld_ver | sed -n \ | |
3418 | -e 's,^[^)]*[ ]\([0-9][0-9]*\.[0-9][0-9]*[^)]*\)) .*$,\1,p'` | |
3419 | else | |
3420 | ld_vers=`echo $ld_ver | sed -n \ | |
3421 | -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*.*\)$,\1,p'` | |
3422 | fi | |
3423 | ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'` | |
3424 | ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'` | |
55b46574 | 3425 | fi |
df33b41f RO |
3426 | changequote([,])dnl |
3427 | fi | |
3428 | ||
3429 | # Determine plugin support. | |
3430 | if echo "$ld_ver" | grep GNU > /dev/null; then | |
55b46574 RO |
3431 | # Require GNU ld or gold 2.21+ for plugin support by default. |
3432 | if test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -ge 21; then | |
3433 | gcc_cv_lto_plugin=2 | |
3434 | # Allow -fuse-linker-plugin to enable plugin support in GNU gold 2.20. | |
3435 | elif test "$ld_is_gold" = yes -a "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -eq 20; then | |
3436 | gcc_cv_lto_plugin=1 | |
96bdf9b4 | 3437 | fi |
96bdf9b4 | 3438 | fi |
df33b41f RO |
3439 | |
3440 | ld_ver="$save_ld_ver" | |
3441 | ld_vers_major="$save_ld_vers_major" | |
3442 | ld_vers_minor="$save_ld_vers_minor" | |
3443 | ld_is_gold="$save_ld_is_gold" | |
96bdf9b4 | 3444 | fi |
55b46574 RO |
3445 | AC_DEFINE_UNQUOTED(HAVE_LTO_PLUGIN, $gcc_cv_lto_plugin, |
3446 | [Define to the level of your linker's plugin support.]) | |
96bdf9b4 JH |
3447 | AC_MSG_RESULT($gcc_cv_lto_plugin) |
3448 | ||
275b60d6 | 3449 | case "$target" in |
63892fa2 KV |
3450 | aarch64*-*-*) |
3451 | gcc_GAS_CHECK_FEATURE([-mabi option], gcc_cv_as_aarch64_mabi,, | |
3452 | [-mabi=lp64], [.text],,,) | |
3453 | if test x$gcc_cv_as_aarch64_mabi = xyes; then | |
3454 | AC_DEFINE(HAVE_AS_MABI_OPTION, 1, | |
3455 | [Define if your assembler supports the -mabi option.]) | |
3456 | else | |
3457 | if test x$with_abi = xilp32; then | |
3458 | AC_MSG_ERROR([Assembler does not support -mabi=ilp32.\ | |
3459 | Upgrade the Assembler.]) | |
3460 | fi | |
3461 | if test x"$with_multilib_list" = xdefault; then | |
3462 | TM_MULTILIB_CONFIG=lp64 | |
3463 | else | |
3464 | aarch64_multilibs=`echo $with_multilib_list | sed -e 's/,/ /g'` | |
3465 | for aarch64_multilib in ${aarch64_multilibs}; do | |
3466 | case ${aarch64_multilib} in | |
3467 | ilp32) | |
3468 | AC_MSG_ERROR([Assembler does not support -mabi=ilp32.\ | |
3469 | Upgrade the Assembler.]) | |
3470 | ;; | |
3471 | *) | |
3472 | ;; | |
3473 | esac | |
3474 | done | |
3475 | fi | |
3476 | fi | |
3477 | ;; | |
3478 | ||
3a37b08e | 3479 | # All TARGET_ABI_OSF targets. |
5c30094f | 3480 | alpha*-*-linux* | alpha*-*-*bsd*) |
8ada417f ZW |
3481 | gcc_GAS_CHECK_FEATURE([explicit relocation support], |
3482 | gcc_cv_as_alpha_explicit_relocs, [2,12,0],, | |
3483 | [ .set nomacro | |
3a37b08e RH |
3484 | .text |
3485 | extbl $3, $2, $3 !lituse_bytoff!1 | |
3486 | ldq $2, a($29) !literal!1 | |
3487 | ldq $4, b($29) !literal!2 | |
3488 | ldq_u $3, 0($2) !lituse_base!1 | |
3489 | ldq $27, f($29) !literal!5 | |
3490 | jsr $26, ($27), f !lituse_jsr!5 | |
3491 | ldah $29, 0($26) !gpdisp!3 | |
3492 | lda $0, c($29) !gprel | |
3493 | ldah $1, d($29) !gprelhigh | |
3494 | lda $1, d($1) !gprellow | |
8ada417f ZW |
3495 | lda $29, 0($29) !gpdisp!3],, |
3496 | [AC_DEFINE(HAVE_AS_EXPLICIT_RELOCS, 1, | |
3497 | [Define if your assembler supports explicit relocations.])]) | |
d006f5eb RH |
3498 | gcc_GAS_CHECK_FEATURE([jsrdirect relocation support], |
3499 | gcc_cv_as_alpha_jsrdirect_relocs, [2,16,90],, | |
3500 | [ .set nomacro | |
3501 | .text | |
3502 | ldq $27, a($29) !literal!1 | |
3503 | jsr $26, ($27), a !lituse_jsrdirect!1],, | |
3504 | [AC_DEFINE(HAVE_AS_JSRDIRECT_RELOCS, 1, | |
3505 | [Define if your assembler supports the lituse_jsrdirect relocation.])]) | |
3a37b08e | 3506 | ;; |
e95b1e6a | 3507 | |
682a45fc HPN |
3508 | cris-*-*) |
3509 | gcc_GAS_CHECK_FEATURE([-no-mul-bug-abort option], | |
3510 | gcc_cv_as_cris_no_mul_bug,[2,15,91], | |
3511 | [-no-mul-bug-abort], [.text],, | |
3512 | [AC_DEFINE(HAVE_AS_NO_MUL_BUG_ABORT_OPTION, 1, | |
3513 | [Define if your assembler supports the -no-mul-bug-abort option.])]) | |
3514 | ;; | |
3515 | ||
8ada417f ZW |
3516 | sparc*-*-*) |
3517 | gcc_GAS_CHECK_FEATURE([.register], gcc_cv_as_sparc_register_op,,, | |
3518 | [.register %g2, #scratch],, | |
3519 | [AC_DEFINE(HAVE_AS_REGISTER_PSEUDO_OP, 1, | |
3520 | [Define if your assembler supports .register.])]) | |
3521 | ||
20804d96 RO |
3522 | gcc_GAS_CHECK_FEATURE([@%:@nobits], gcc_cv_as_sparc_nobits,,, |
3523 | [.section "nobits",#alloc,#write,#nobits | |
3524 | .section "progbits",#alloc,#write,#progbits]) | |
3525 | AC_DEFINE_UNQUOTED(HAVE_AS_SPARC_NOBITS, | |
3526 | [`if test $gcc_cv_as_sparc_nobits = yes; then echo 1; else echo 0; fi`], | |
3527 | [Define to 1 if your assembler supports #nobits, 0 otherwise.]) | |
3528 | ||
8ada417f ZW |
3529 | gcc_GAS_CHECK_FEATURE([-relax option], gcc_cv_as_sparc_relax,, |
3530 | [-relax], [.text],, | |
3531 | [AC_DEFINE(HAVE_AS_RELAX_OPTION, 1, | |
3532 | [Define if your assembler supports -relax option.])]) | |
3533 | ||
878ee0ab DM |
3534 | gcc_GAS_CHECK_FEATURE([GOTDATA_OP relocs], |
3535 | gcc_cv_as_sparc_gotdata_op,, | |
3536 | [-K PIC], | |
3537 | [.text | |
6d7b45ad | 3538 | .align 4 |
878ee0ab DM |
3539 | foo: |
3540 | nop | |
3541 | bar: | |
3542 | sethi %gdop_hix22(foo), %g1 | |
3543 | xor %g1, %gdop_lox10(foo), %g1 | |
3544 | ld [[%l7 + %g1]], %g2, %gdop(foo)], | |
3545 | [if test x$gcc_cv_ld != x \ | |
46bc665f | 3546 | && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1; then |
7673c962 RO |
3547 | if test x$gcc_cv_objdump != x; then |
3548 | if $gcc_cv_objdump -s -j .text conftest 2> /dev/null \ | |
3549 | | grep ' 03000004 82186004 c405c001'> /dev/null 2>&1; then | |
46bc665f | 3550 | gcc_cv_as_sparc_gotdata_op=no |
7673c962 | 3551 | else |
46bc665f | 3552 | gcc_cv_as_sparc_gotdata_op=yes |
46bc665f | 3553 | fi |
46bc665f | 3554 | fi |
878ee0ab DM |
3555 | fi |
3556 | rm -f conftest], | |
3557 | [AC_DEFINE(HAVE_AS_SPARC_GOTDATA_OP, 1, | |
3558 | [Define if your assembler and linker support GOTDATA_OP relocs.])]) | |
3559 | ||
8ada417f ZW |
3560 | gcc_GAS_CHECK_FEATURE([unaligned pcrel relocs], |
3561 | gcc_cv_as_sparc_ua_pcrel,, | |
3562 | [-K PIC], | |
3563 | [.text | |
3564 | foo: | |
3565 | nop | |
3566 | .data | |
3567 | .align 4 | |
3568 | .byte 0 | |
3569 | .uaword %r_disp32(foo)], | |
3570 | [if test x$gcc_cv_ld != x \ | |
3571 | && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1; then | |
3572 | gcc_cv_as_sparc_ua_pcrel=yes | |
3573 | fi | |
3574 | rm -f conftest], | |
3575 | [AC_DEFINE(HAVE_AS_SPARC_UA_PCREL, 1, | |
17e9e88c | 3576 | [Define if your assembler and linker support unaligned PC relative relocs.]) |
cf7b8b0d | 3577 | |
8ada417f ZW |
3578 | gcc_GAS_CHECK_FEATURE([unaligned pcrel relocs against hidden symbols], |
3579 | gcc_cv_as_sparc_ua_pcrel_hidden,, | |
3580 | [-K PIC], | |
3581 | [.data | |
3582 | .align 4 | |
3583 | .byte 0x31 | |
3584 | .uaword %r_disp32(foo) | |
3585 | .byte 0x32, 0x33, 0x34 | |
3586 | .global foo | |
3587 | .hidden foo | |
3588 | foo: | |
3589 | .skip 4], | |
3590 | [if test x$gcc_cv_ld != x && test x$gcc_cv_objdump != x \ | |
3591 | && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1 \ | |
3592 | && $gcc_cv_objdump -s -j .data conftest 2> /dev/null \ | |
3593 | | grep ' 31000000 07323334' > /dev/null 2>&1; then | |
3594 | if $gcc_cv_objdump -R conftest 2> /dev/null \ | |
3595 | | grep 'DISP32' > /dev/null 2>&1; then | |
3596 | : | |
22252625 | 3597 | else |
8ada417f | 3598 | gcc_cv_as_sparc_ua_pcrel_hidden=yes |
5b68c389 | 3599 | fi |
8ada417f ZW |
3600 | fi |
3601 | rm -f conftest], | |
3602 | [AC_DEFINE(HAVE_AS_SPARC_UA_PCREL_HIDDEN, 1, | |
3603 | [Define if your assembler and linker support unaligned PC relative relocs against hidden symbols.])]) | |
3604 | ]) # unaligned pcrel relocs | |
3605 | ||
3606 | gcc_GAS_CHECK_FEATURE([offsetable %lo()], | |
3607 | gcc_cv_as_sparc_offsetable_lo10,, | |
3608 | [-xarch=v9], | |
3609 | [.text | |
3610 | or %g1, %lo(ab) + 12, %g1 | |
3611 | or %g1, %lo(ab + 12), %g1], | |
3612 | [if test x$gcc_cv_objdump != x \ | |
ecb0ccbc | 3613 | && $gcc_cv_objdump -s -j .text conftest.o 2> /dev/null \ |
8ada417f | 3614 | | grep ' 82106000 82106000' > /dev/null 2>&1; then |
1b5c0152 | 3615 | gcc_cv_as_sparc_offsetable_lo10=yes |
8ada417f ZW |
3616 | fi], |
3617 | [AC_DEFINE(HAVE_AS_OFFSETABLE_LO10, 1, | |
3618 | [Define if your assembler supports offsetable %lo().])]) | |
e8b141b5 DM |
3619 | |
3620 | gcc_GAS_CHECK_FEATURE([FMAF, HPC, and VIS 3.0 instructions], | |
3621 | gcc_cv_as_sparc_fmaf,, | |
3622 | [-xarch=v9d], | |
3623 | [.text | |
26e2f443 DM |
3624 | .register %g2, #scratch |
3625 | .register %g3, #scratch | |
e8b141b5 DM |
3626 | .align 4 |
3627 | fmaddd %f0, %f2, %f4, %f6 | |
3628 | addxccc %g1, %g2, %g3 | |
3629 | fsrl32 %f2, %f4, %f8 | |
3630 | fnaddd %f10, %f12, %f14],, | |
3631 | [AC_DEFINE(HAVE_AS_FMAF_HPC_VIS3, 1, | |
3632 | [Define if your assembler supports FMAF, HPC, and VIS 3.0 instructions.])]) | |
8b98b5fd DM |
3633 | |
3634 | gcc_GAS_CHECK_FEATURE([SPARC4 instructions], | |
3635 | gcc_cv_as_sparc_sparc4,, | |
3636 | [-xarch=sparc4], | |
3637 | [.text | |
3638 | .register %g2, #scratch | |
3639 | .register %g3, #scratch | |
3640 | .align 4 | |
3641 | cxbe %g2, %g3, 1f | |
3642 | 1: cwbneg %g2, %g3, 1f | |
3643 | 1: sha1 | |
3644 | md5 | |
3645 | aes_kexpand0 %f4, %f6, %f8 | |
3646 | des_round %f38, %f40, %f42, %f44 | |
3647 | camellia_f %f54, %f56, %f58, %f60 | |
3648 | kasumi_fi_xor %f46, %f48, %f50, %f52],, | |
3649 | [AC_DEFINE(HAVE_AS_SPARC4, 1, | |
3650 | [Define if your assembler supports SPARC4 instructions.])]) | |
1f65ae7a EB |
3651 | |
3652 | gcc_GAS_CHECK_FEATURE([LEON instructions], | |
3653 | gcc_cv_as_sparc_leon,, | |
3654 | [-Aleon], | |
3655 | [.text | |
3656 | .register %g2, #scratch | |
3657 | .register %g3, #scratch | |
3658 | .align 4 | |
3659 | smac %g2, %g3, %g1 | |
3660 | umac %g2, %g3, %g1 | |
ba21a04a | 3661 | casa [[%g2]] 0xb, %g3, %g1],, |
1f65ae7a EB |
3662 | [AC_DEFINE(HAVE_AS_LEON, 1, |
3663 | [Define if your assembler supports LEON instructions.])]) | |
1cb36a98 RH |
3664 | ;; |
3665 | ||
3666 | changequote(,)dnl | |
c307e6dd | 3667 | i[34567]86-*-* | x86_64-*-*) |
1cb36a98 | 3668 | changequote([,])dnl |
f7e413e2 DK |
3669 | case $target_os in |
3670 | cygwin*) | |
3671 | # Full C++ conformance when using a shared libstdc++-v3 requires some | |
3672 | # support from the Cygwin DLL, which in more recent versions exports | |
3673 | # wrappers to aid in interposing and redirecting operators new, delete, | |
3674 | # etc., as per n2800 #17.6.4.6 [replacement.functions]. Check if we | |
3675 | # are configuring for a version of Cygwin that exports the wrappers. | |
b802ae5c | 3676 | if test x$host = x$target && test x$host_cpu = xi686; then |
f7e413e2 DK |
3677 | AC_CHECK_FUNC([__wrap__Znaj],[gcc_ac_cygwin_dll_wrappers=yes],[gcc_ac_cygwin_dll_wrappers=no]) |
3678 | else | |
3679 | # Can't check presence of libc functions during cross-compile, so | |
3680 | # we just have to assume we're building for an up-to-date target. | |
3681 | gcc_ac_cygwin_dll_wrappers=yes | |
3682 | fi | |
3683 | AC_DEFINE_UNQUOTED(USE_CYGWIN_LIBSTDCXX_WRAPPERS, | |
3684 | [`if test $gcc_ac_cygwin_dll_wrappers = yes; then echo 1; else echo 0; fi`], | |
3685 | [Define if you want to generate code by default that assumes that the | |
3686 | Cygwin DLL exports wrappers to support libstdc++ function replacement.]) | |
3687 | esac | |
d38bc601 | 3688 | case $target_os in |
daecebc8 | 3689 | cygwin* | pe | mingw32* | interix*) |
233215fe DK |
3690 | # Recent binutils allows the three-operand form of ".comm" on PE. This |
3691 | # definition is used unconditionally to initialise the default state of | |
3692 | # the target option variable that governs usage of the feature. | |
3693 | gcc_GAS_CHECK_FEATURE([.comm with alignment], gcc_cv_as_comm_has_align, | |
3694 | [2,19,52],,[.comm foo,1,32]) | |
3695 | AC_DEFINE_UNQUOTED(HAVE_GAS_ALIGNED_COMM, | |
3696 | [`if test $gcc_cv_as_comm_has_align = yes; then echo 1; else echo 0; fi`], | |
3697 | [Define if your assembler supports specifying the alignment | |
3698 | of objects allocated using the GAS .comm command.]) | |
d38bc601 BF |
3699 | # Used for DWARF 2 in PE |
3700 | gcc_GAS_CHECK_FEATURE([.secrel32 relocs], | |
3701 | gcc_cv_as_ix86_pe_secrel32, | |
3702 | [2,15,91],, | |
3703 | [.text | |
3704 | foo: nop | |
3705 | .data | |
3706 | .secrel32 foo], | |
3707 | [if test x$gcc_cv_ld != x \ | |
3708 | && $gcc_cv_ld -o conftest conftest.o > /dev/null 2>&1; then | |
3709 | gcc_cv_as_ix86_pe_secrel32=yes | |
3710 | fi | |
3711 | rm -f conftest], | |
3712 | [AC_DEFINE(HAVE_GAS_PE_SECREL32_RELOC, 1, | |
3713 | [Define if your assembler and linker support 32-bit section relative relocs via '.secrel32 label'.])]) | |
3bec79c5 DK |
3714 | # Test if the assembler supports the extended form of the .section |
3715 | # directive that specifies section alignment. LTO support uses this, | |
3716 | # but normally only after installation, so we warn but don't fail the | |
3717 | # configure if LTO is enabled but the assembler does not support it. | |
3718 | gcc_GAS_CHECK_FEATURE([.section with alignment], gcc_cv_as_section_has_align, | |
3719 | [2,20,1],-fatal-warnings,[.section lto_test,"dr0"]) | |
3720 | if test x$gcc_cv_as_section_has_align != xyes; then | |
3721 | case ",$enable_languages," in | |
3722 | *,lto,*) | |
3723 | AC_MSG_WARN([LTO for $target requires binutils >= 2.20.1, but version found appears insufficient; LTO will not work until binutils is upgraded.]) | |
3724 | ;; | |
3725 | esac | |
3726 | fi | |
08c71c82 KT |
3727 | # Test if the assembler supports the section flag 'e' for specifying |
3728 | # an excluded section. | |
3729 | gcc_GAS_CHECK_FEATURE([.section with e], gcc_cv_as_section_has_e, | |
3730 | [2,22,51],, | |
3731 | [.section foo1,"e" | |
3732 | .byte 0,0,0,0]) | |
3733 | AC_DEFINE_UNQUOTED(HAVE_GAS_SECTION_EXCLUDE, | |
3734 | [`if test $gcc_cv_as_section_has_e = yes; then echo 1; else echo 0; fi`], | |
3735 | [Define if your assembler supports specifying the section flag e.]) | |
d38bc601 BF |
3736 | ;; |
3737 | esac | |
3738 | ||
8ada417f | 3739 | gcc_GAS_CHECK_FEATURE([filds and fists mnemonics], |
a3a5e3d1 UB |
3740 | gcc_cv_as_ix86_filds,,, |
3741 | [filds mem; fists mem],, | |
3742 | [AC_DEFINE(HAVE_AS_IX86_FILDS, 1, | |
3743 | [Define if your assembler uses filds and fists mnemonics.])]) | |
3744 | ||
3745 | gcc_GAS_CHECK_FEATURE([fildq and fistpq mnemonics], | |
3746 | gcc_cv_as_ix86_fildq,,, | |
3747 | [fildq mem; fistpq mem],, | |
3748 | [AC_DEFINE(HAVE_AS_IX86_FILDQ, 1, | |
3749 | [Define if your assembler uses fildq and fistq mnemonics.])]) | |
8ada417f | 3750 | |
f6f5dff2 RO |
3751 | gcc_GAS_CHECK_FEATURE([cmov syntax], |
3752 | gcc_cv_as_ix86_cmov_sun_syntax,,, | |
3753 | [cmovl.l %edx, %eax],, | |
3754 | [AC_DEFINE(HAVE_AS_IX86_CMOV_SUN_SYNTAX, 1, | |
3755 | [Define if your assembler supports the Sun syntax for cmov.])]) | |
3756 | ||
b6c03bcd RS |
3757 | gcc_GAS_CHECK_FEATURE([ffreep mnemonic], |
3758 | gcc_cv_as_ix86_ffreep,,, | |
3759 | [ffreep %st(1)],, | |
3760 | [AC_DEFINE(HAVE_AS_IX86_FFREEP, 1, | |
3761 | [Define if your assembler supports the ffreep mnemonic.])]) | |
3762 | ||
ed104137 RO |
3763 | gcc_GAS_CHECK_FEATURE([.quad directive], |
3764 | gcc_cv_as_ix86_quad,,, | |
3765 | [.quad 0],, | |
3766 | [AC_DEFINE(HAVE_AS_IX86_QUAD, 1, | |
3767 | [Define if your assembler supports the .quad directive.])]) | |
3768 | ||
38ca3765 UB |
3769 | gcc_GAS_CHECK_FEATURE([sahf mnemonic], |
3770 | gcc_cv_as_ix86_sahf,,, | |
953c29f7 UB |
3771 | [.code64 |
3772 | sahf],, | |
38ca3765 | 3773 | [AC_DEFINE(HAVE_AS_IX86_SAHF, 1, |
953c29f7 | 3774 | [Define if your assembler supports the sahf mnemonic in 64bit mode.])]) |
38ca3765 | 3775 | |
fe04878d UB |
3776 | gcc_GAS_CHECK_FEATURE([interunit movq mnemonic], |
3777 | gcc_cv_as_ix86_interunit_movq,,, | |
3778 | [.code64 | |
3779 | movq %mm0, %rax | |
13a26a7d UB |
3780 | movq %rax, %xmm0]) |
3781 | AC_DEFINE_UNQUOTED(HAVE_AS_IX86_INTERUNIT_MOVQ, | |
3782 | [`if test $gcc_cv_as_ix86_interunit_movq = yes; then echo 1; else echo 0; fi`], | |
3783 | [Define if your assembler supports interunit movq mnemonic.]) | |
fe04878d | 3784 | |
5dcfdccd KY |
3785 | gcc_GAS_CHECK_FEATURE([hle prefixes], |
3786 | gcc_cv_as_ix86_hle,,, | |
54af4523 | 3787 | [lock xacquire cmpxchg %esi, (%ecx)],, |
5dcfdccd KY |
3788 | [AC_DEFINE(HAVE_AS_IX86_HLE, 1, |
3789 | [Define if your assembler supports HLE prefixes.])]) | |
3790 | ||
afd2c302 SD |
3791 | gcc_GAS_CHECK_FEATURE([swap suffix], |
3792 | gcc_cv_as_ix86_swap,,, | |
3793 | [movl.s %esp, %ebp],, | |
3794 | [AC_DEFINE(HAVE_AS_IX86_SWAP, 1, | |
3795 | [Define if your assembler supports the swap suffix.])]) | |
3796 | ||
68b92f78 RS |
3797 | gcc_GAS_CHECK_FEATURE([different section symbol subtraction], |
3798 | gcc_cv_as_ix86_diff_sect_delta,,, | |
3799 | [.section .rodata | |
3800 | .L1: | |
3801 | .long .L2-.L1 | |
3802 | .long .L3-.L1 | |
3803 | .text | |
3804 | .L3: nop | |
3805 | .L2: nop],, | |
3806 | [AC_DEFINE(HAVE_AS_IX86_DIFF_SECT_DELTA, 1, | |
3807 | [Define if your assembler supports the subtraction of symbols in different sections.])]) | |
3808 | ||
2433310d | 3809 | # These two are used unconditionally by i386.[ch]; it is to be defined |
6f3ca281 | 3810 | # to 1 if the feature is present, 0 otherwise. |
0544c448 L |
3811 | as_ix86_gotoff_in_data_opt= |
3812 | if test x$gas = xyes; then | |
3813 | as_ix86_gotoff_in_data_opt="--32" | |
3814 | fi | |
8ada417f | 3815 | gcc_GAS_CHECK_FEATURE([GOTOFF in data], |
0544c448 L |
3816 | gcc_cv_as_ix86_gotoff_in_data, [2,11,0], |
3817 | [$as_ix86_gotoff_in_data_opt], | |
8ada417f | 3818 | [ .text |
f88c65f7 RH |
3819 | .L0: |
3820 | nop | |
3821 | .data | |
6f3ca281 ZW |
3822 | .long .L0@GOTOFF]) |
3823 | AC_DEFINE_UNQUOTED(HAVE_AS_GOTOFF_IN_DATA, | |
3824 | [`if test $gcc_cv_as_ix86_gotoff_in_data = yes; then echo 1; else echo 0; fi`], | |
3825 | [Define true if the assembler supports '.long foo@GOTOFF'.]) | |
2433310d RO |
3826 | |
3827 | gcc_GAS_CHECK_FEATURE([rep and lock prefix], | |
3828 | gcc_cv_as_ix86_rep_lock_prefix,,, | |
3829 | [rep movsl | |
43283548 UB |
3830 | rep ret |
3831 | rep nop | |
3832 | rep bsf %ecx, %eax | |
3833 | rep bsr %ecx, %eax | |
4bade865 | 3834 | lock addl %edi, (%eax,%esi) |
7085bfb6 UB |
3835 | lock orl $0, (%esp)],, |
3836 | [AC_DEFINE(HAVE_AS_IX86_REP_LOCK_PREFIX, 1, | |
3837 | [Define if the assembler supports 'rep <insn>, lock <insn>'.])]) | |
2433310d | 3838 | |
88f7c49a RM |
3839 | gcc_GAS_CHECK_FEATURE([ud2 mnemonic], |
3840 | gcc_cv_as_ix86_ud2,,, | |
3841 | [ud2],, | |
3842 | [AC_DEFINE(HAVE_AS_IX86_UD2, 1, | |
3843 | [Define if your assembler supports the 'ud2' mnemonic.])]) | |
3844 | ||
8950516e RO |
3845 | gcc_GAS_CHECK_FEATURE([R_386_TLS_GD_PLT reloc], |
3846 | gcc_cv_as_ix86_tlsgdplt,,, | |
0f24748c RO |
3847 | [call tls_gd@tlsgdplt], |
3848 | [if test x$gcc_cv_ld != x \ | |
3849 | && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1; then | |
3850 | gcc_cv_as_ix86_tlsgdplt=yes | |
3851 | fi | |
3852 | rm -f conftest], | |
8950516e | 3853 | [AC_DEFINE(HAVE_AS_IX86_TLSGDPLT, 1, |
0f24748c | 3854 | [Define if your assembler and linker support @tlsgdplt.])]) |
8950516e | 3855 | |
040c446d RO |
3856 | conftest_s=' |
3857 | .section .tdata,"aw'$tls_section_flag'",@progbits | |
3858 | tls_ld: | |
3859 | .section .text,"ax",@progbits | |
3860 | call tls_ld@tlsldmplt' | |
8950516e RO |
3861 | gcc_GAS_CHECK_FEATURE([R_386_TLS_LDM_PLT reloc], |
3862 | gcc_cv_as_ix86_tlsldmplt,,, | |
040c446d | 3863 | [$conftest_s], |
0f24748c RO |
3864 | [if test x$gcc_cv_ld != x \ |
3865 | && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1; then | |
3866 | gcc_cv_as_ix86_tlsldmplt=yes | |
3867 | fi | |
caa16d41 RO |
3868 | rm -f conftest]) |
3869 | AC_DEFINE_UNQUOTED(HAVE_AS_IX86_TLSLDMPLT, | |
3870 | [`if test $gcc_cv_as_ix86_tlsldmplt = yes; then echo 1; else echo 0; fi`], | |
3871 | [Define to 1 if your assembler and linker support @tlsldmplt.]) | |
3872 | ||
3873 | # Enforce 32-bit output with gas and gld. | |
3874 | if test x$gas = xyes; then | |
3875 | as_ix86_tls_ldm_opt="--32" | |
3876 | fi | |
3877 | if echo "$ld_ver" | grep GNU > /dev/null; then | |
3878 | if $gcc_cv_ld -V 2>/dev/null | grep elf_i386_sol2 > /dev/null; then | |
3879 | ld_ix86_tls_ldm_opt="-melf_i386_sol2" | |
3880 | else | |
3881 | ld_ix86_tls_ldm_opt="-melf_i386" | |
3882 | fi | |
3883 | fi | |
3884 | conftest_s=' | |
3885 | .section .text,"ax",@progbits | |
3886 | .globl _start | |
3887 | .type _start, @function | |
3888 | _start: | |
3889 | leal value@tlsldm(%ebx), %eax | |
3890 | call ___tls_get_addr@plt | |
3891 | ||
3892 | .section .tdata,"aw'$tls_section_flag'",@progbits | |
3893 | .type value, @object | |
3894 | value:' | |
3895 | gcc_GAS_CHECK_FEATURE([R_386_TLS_LDM reloc], | |
3896 | gcc_cv_as_ix86_tlsldm,, | |
3897 | [$as_ix86_tls_ldm_opt], | |
3898 | [$conftest_s], | |
3899 | [if test x$gcc_cv_ld != x && test x$gcc_cv_objdump != x \ | |
3900 | && $gcc_cv_ld $ld_ix86_tls_ldm_opt -o conftest conftest.o $ld_tls_libs -lc > /dev/null 2>&1; then | |
3901 | if $gcc_cv_objdump -d conftest 2>/dev/null | grep nop > /dev/null \ | |
3902 | || dis conftest 2>/dev/null | grep nop > /dev/null; then | |
3903 | gcc_cv_as_ix86_tlsldm=yes | |
3904 | fi | |
3905 | fi | |
3906 | rm -f conftest]) | |
3907 | AC_DEFINE_UNQUOTED(HAVE_AS_IX86_TLSLDM, | |
3908 | [`if test $gcc_cv_as_ix86_tlsldm = yes; then echo 1; else echo 0; fi`], | |
3909 | [Define to 1 if your assembler and linker support @tlsldm.]) | |
8950516e | 3910 | |
1cb36a98 | 3911 | ;; |
ef1ecf87 RH |
3912 | |
3913 | ia64*-*-*) | |
8ada417f ZW |
3914 | gcc_GAS_CHECK_FEATURE([ltoffx and ldxmov relocs], |
3915 | gcc_cv_as_ia64_ltoffx_ldxmov_relocs, [2,14,0],, | |
cfa9ee99 | 3916 | [ .text |
ef1ecf87 RH |
3917 | addl r15 = @ltoffx(x#), gp |
3918 | ;; | |
cfa9ee99 | 3919 | ld8.mov r16 = [[r15]], x#],, |
8ada417f ZW |
3920 | [AC_DEFINE(HAVE_AS_LTOFFX_LDXMOV_RELOCS, 1, |
3921 | [Define if your assembler supports ltoffx and ldxmov relocations.])]) | |
3922 | ||
ef1ecf87 | 3923 | ;; |
8ada417f | 3924 | |
2c4a9cff | 3925 | powerpc*-*-*) |
8ada417f | 3926 | case $target in |
432218ba DE |
3927 | *-*-aix*) conftest_s=' .machine "pwr5" |
3928 | .csect .text[[PR]] | |
6b37db3c | 3929 | mfcr 3,128';; |
8af4d362 PB |
3930 | *-*-darwin*) |
3931 | gcc_GAS_CHECK_FEATURE([.machine directive support], | |
3932 | gcc_cv_as_machine_directive,,, | |
3933 | [ .machine ppc7400]) | |
3934 | if test x$gcc_cv_as_machine_directive != xyes; then | |
3935 | echo "*** This target requires an assembler supporting \".machine\"" >&2 | |
3936 | echo you can get it from: ftp://gcc.gnu.org/pub/gcc/infrastructure/cctools-528.5.dmg >&2 | |
3937 | test x$build = x$target && exit 1 | |
3938 | fi | |
3939 | conftest_s=' .text | |
6b37db3c | 3940 | mfcr r3,128';; |
4c67db14 | 3941 | *) conftest_s=' .machine power4 |
d2ab3e37 | 3942 | .text |
6b37db3c | 3943 | mfcr 3,128';; |
8ada417f | 3944 | esac |
8ada417f ZW |
3945 | |
3946 | gcc_GAS_CHECK_FEATURE([mfcr field support], | |
3947 | gcc_cv_as_powerpc_mfcrf, [2,14,0],, | |
3948 | [$conftest_s],, | |
3949 | [AC_DEFINE(HAVE_AS_MFCRF, 1, | |
3950 | [Define if your assembler supports mfcr field.])]) | |
432218ba DE |
3951 | |
3952 | case $target in | |
3953 | *-*-aix*) conftest_s=' .machine "pwr5" | |
3954 | .csect .text[[PR]] | |
3955 | popcntb 3,3';; | |
3956 | *) conftest_s=' .machine power5 | |
3957 | .text | |
3958 | popcntb 3,3';; | |
3959 | esac | |
3960 | ||
3961 | gcc_GAS_CHECK_FEATURE([popcntb support], | |
3962 | gcc_cv_as_powerpc_popcntb, [2,17,0],, | |
3963 | [$conftest_s],, | |
3964 | [AC_DEFINE(HAVE_AS_POPCNTB, 1, | |
3965 | [Define if your assembler supports popcntb field.])]) | |
3966 | ||
9719f3b7 DE |
3967 | case $target in |
3968 | *-*-aix*) conftest_s=' .machine "pwr5x" | |
3969 | .csect .text[[PR]] | |
3970 | frin 1,1';; | |
1e04bfdc | 3971 | *) conftest_s=' .machine power5 |
9719f3b7 DE |
3972 | .text |
3973 | frin 1,1';; | |
3974 | esac | |
3975 | ||
3976 | gcc_GAS_CHECK_FEATURE([fp round support], | |
3977 | gcc_cv_as_powerpc_fprnd, [2,17,0],, | |
3978 | [$conftest_s],, | |
3979 | [AC_DEFINE(HAVE_AS_FPRND, 1, | |
3980 | [Define if your assembler supports fprnd.])]) | |
3981 | ||
44cd321e PS |
3982 | case $target in |
3983 | *-*-aix*) conftest_s=' .machine "pwr6" | |
3984 | .csect .text[[PR]] | |
3985 | mffgpr 1,3';; | |
3986 | *) conftest_s=' .machine power6 | |
3987 | .text | |
3988 | mffgpr 1,3';; | |
3989 | esac | |
3990 | ||
3991 | gcc_GAS_CHECK_FEATURE([move fp gpr support], | |
cacf1ca8 | 3992 | gcc_cv_as_powerpc_mfpgpr, [2,19,2],, |
44cd321e PS |
3993 | [$conftest_s],, |
3994 | [AC_DEFINE(HAVE_AS_MFPGPR, 1, | |
3995 | [Define if your assembler supports mffgpr and mftgpr.])]) | |
3996 | ||
7f970b70 AM |
3997 | case $target in |
3998 | *-*-aix*) conftest_s=' .csect .text[[PR]] | |
3999 | LCF..0: | |
4000 | addis 11,30,_GLOBAL_OFFSET_TABLE_-LCF..0@ha';; | |
4001 | *-*-darwin*) | |
4002 | conftest_s=' .text | |
4003 | LCF0: | |
4004 | addis r11,r30,_GLOBAL_OFFSET_TABLE_-LCF0@ha';; | |
4005 | *) conftest_s=' .text | |
4006 | .LCF0: | |
4007 | addis 11,30,_GLOBAL_OFFSET_TABLE_-.LCF0@ha';; | |
4008 | esac | |
4009 | ||
695d8830 AS |
4010 | gcc_GAS_CHECK_FEATURE([rel16 relocs], |
4011 | gcc_cv_as_powerpc_rel16, [2,17,0], -a32, | |
4012 | [$conftest_s],, | |
4013 | [AC_DEFINE(HAVE_AS_REL16, 1, | |
4014 | [Define if your assembler supports R_PPC_REL16 relocs.])]) | |
4015 | ||
b639c3c2 JJ |
4016 | case $target in |
4017 | *-*-aix*) conftest_s=' .machine "pwr6" | |
4018 | .csect .text[[PR]] | |
4019 | cmpb 3,4,5';; | |
4020 | *) conftest_s=' .machine power6 | |
4021 | .text | |
4022 | cmpb 3,4,5';; | |
4023 | esac | |
4024 | ||
4025 | gcc_GAS_CHECK_FEATURE([compare bytes support], | |
cacf1ca8 | 4026 | gcc_cv_as_powerpc_cmpb, [2,19,2], -a32, |
b639c3c2 JJ |
4027 | [$conftest_s],, |
4028 | [AC_DEFINE(HAVE_AS_CMPB, 1, | |
4029 | [Define if your assembler supports cmpb.])]) | |
4030 | ||
4031 | case $target in | |
4032 | *-*-aix*) conftest_s=' .machine "pwr6" | |
4033 | .csect .text[[PR]] | |
0d74c0ee | 4034 | dadd 1,2,3';; |
b639c3c2 JJ |
4035 | *) conftest_s=' .machine power6 |
4036 | .text | |
0d74c0ee | 4037 | dadd 1,2,3';; |
b639c3c2 JJ |
4038 | esac |
4039 | ||
4040 | gcc_GAS_CHECK_FEATURE([decimal float support], | |
cacf1ca8 | 4041 | gcc_cv_as_powerpc_dfp, [2,19,2], -a32, |
b639c3c2 JJ |
4042 | [$conftest_s],, |
4043 | [AC_DEFINE(HAVE_AS_DFP, 1, | |
4044 | [Define if your assembler supports DFP instructions.])]) | |
e51917ae | 4045 | |
d40c9e33 PB |
4046 | case $target in |
4047 | *-*-aix*) conftest_s=' .machine "pwr7" | |
4048 | .csect .text[[PR]] | |
4049 | lxvd2x 1,2,3';; | |
4050 | *) conftest_s=' .machine power7 | |
4051 | .text | |
4052 | lxvd2x 1,2,3';; | |
4053 | esac | |
4054 | ||
4055 | gcc_GAS_CHECK_FEATURE([vector-scalar support], | |
cacf1ca8 | 4056 | gcc_cv_as_powerpc_vsx, [2,19,2], -a32, |
d40c9e33 PB |
4057 | [$conftest_s],, |
4058 | [AC_DEFINE(HAVE_AS_VSX, 1, | |
4059 | [Define if your assembler supports VSX instructions.])]) | |
4060 | ||
cacf1ca8 MM |
4061 | case $target in |
4062 | *-*-aix*) conftest_s=' .machine "pwr7" | |
4063 | .csect .text[[PR]] | |
4064 | popcntd 3,3';; | |
4065 | *) conftest_s=' .machine power7 | |
4066 | .text | |
4067 | popcntd 3,3';; | |
4068 | esac | |
4069 | ||
4070 | gcc_GAS_CHECK_FEATURE([popcntd support], | |
4071 | gcc_cv_as_powerpc_popcntd, [2,19,2], -a32, | |
4072 | [$conftest_s],, | |
4073 | [AC_DEFINE(HAVE_AS_POPCNTD, 1, | |
4074 | [Define if your assembler supports POPCNTD instructions.])]) | |
4075 | ||
428bffcb PB |
4076 | case $target in |
4077 | *-*-aix*) conftest_s=' .machine "pwr8" | |
4078 | .csect .text[[PR]]';; | |
4079 | *) conftest_s=' .machine power8 | |
4080 | .text';; | |
4081 | esac | |
4082 | ||
4083 | gcc_GAS_CHECK_FEATURE([power8 support], | |
4084 | gcc_cv_as_powerpc_power8, [2,19,2], -a32, | |
4085 | [$conftest_s],, | |
4086 | [AC_DEFINE(HAVE_AS_POWER8, 1, | |
4087 | [Define if your assembler supports POWER8 instructions.])]) | |
4088 | ||
cacf1ca8 MM |
4089 | case $target in |
4090 | *-*-aix*) conftest_s=' .csect .text[[PR]] | |
4091 | lwsync';; | |
4092 | *) conftest_s=' .text | |
4093 | lwsync';; | |
4094 | esac | |
4095 | ||
4096 | gcc_GAS_CHECK_FEATURE([lwsync support], | |
4097 | gcc_cv_as_powerpc_lwsync, [2,19,2], -a32, | |
4098 | [$conftest_s],, | |
4099 | [AC_DEFINE(HAVE_AS_LWSYNC, 1, | |
4100 | [Define if your assembler supports LWSYNC instructions.])]) | |
4101 | ||
47f67e51 PB |
4102 | case $target in |
4103 | *-*-aix*) conftest_s=' .machine "476" | |
4104 | .csect .text[[PR]] | |
4105 | dci 0';; | |
4106 | *) conftest_s=' .machine "476" | |
4107 | .text | |
4108 | dci 0';; | |
4109 | esac | |
4110 | ||
4111 | gcc_GAS_CHECK_FEATURE([data cache invalidate support], | |
4112 | gcc_cv_as_powerpc_dci, [9,99,0], -a32, | |
4113 | [$conftest_s],, | |
4114 | [AC_DEFINE(HAVE_AS_DCI, 1, | |
4115 | [Define if your assembler supports the DCI/ICI instructions.])]) | |
4116 | ||
e51917ae JM |
4117 | gcc_GAS_CHECK_FEATURE([.gnu_attribute support], |
4118 | gcc_cv_as_powerpc_gnu_attribute, [2,18,0],, | |
4119 | [.gnu_attribute 4,1],, | |
4120 | [AC_DEFINE(HAVE_AS_GNU_ATTRIBUTE, 1, | |
4121 | [Define if your assembler supports .gnu_attribute.])]) | |
9752c4ad AM |
4122 | |
4123 | gcc_GAS_CHECK_FEATURE([tls marker support], | |
4124 | gcc_cv_as_powerpc_tls_markers, [2,20,0],, | |
4125 | [ bl __tls_get_addr(x@tlsgd)],, | |
4126 | [AC_DEFINE(HAVE_AS_TLS_MARKERS, 1, | |
4127 | [Define if your assembler supports arg info for __tls_get_addr.])]) | |
636cf8b1 RS |
4128 | |
4129 | case $target in | |
4130 | *-*-aix*) | |
4131 | gcc_GAS_CHECK_FEATURE([.ref support], | |
e8548a47 | 4132 | gcc_cv_as_aix_ref, [2,21,0],, |
636cf8b1 RS |
4133 | [ .csect stuff[[rw]] |
4134 | stuff: | |
4135 | .long 1 | |
4136 | .extern sym | |
4137 | .ref sym | |
4138 | ],, | |
4139 | [AC_DEFINE(HAVE_AS_REF, 1, | |
4140 | [Define if your assembler supports .ref])]) | |
4141 | ;; | |
4142 | esac | |
2c4a9cff | 4143 | ;; |
53b5ce19 | 4144 | |
8ada417f ZW |
4145 | mips*-*-*) |
4146 | gcc_GAS_CHECK_FEATURE([explicit relocation support], | |
4147 | gcc_cv_as_mips_explicit_relocs, [2,14,0],, | |
4148 | [ lw $4,%gp_rel(foo)($4)],, | |
4149 | [if test x$target_cpu_default = x | |
4150 | then target_cpu_default=MASK_EXPLICIT_RELOCS | |
4151 | else target_cpu_default="($target_cpu_default)|MASK_EXPLICIT_RELOCS" | |
4152 | fi]) | |
4551169f RS |
4153 | gcc_GAS_CHECK_FEATURE([-mno-shared support], |
4154 | gcc_cv_as_mips_no_shared, [2,16,0], [-mno-shared], [nop],, | |
4155 | [AC_DEFINE(HAVE_AS_NO_SHARED, 1, | |
4156 | [Define if the assembler understands -mno-shared.])]) | |
dcb957d9 JM |
4157 | |
4158 | gcc_GAS_CHECK_FEATURE([.gnu_attribute support], | |
4159 | gcc_cv_as_mips_gnu_attribute, [2,18,0],, | |
4160 | [.gnu_attribute 4,1],, | |
4161 | [AC_DEFINE(HAVE_AS_GNU_ATTRIBUTE, 1, | |
4162 | [Define if your assembler supports .gnu_attribute.])]) | |
a44380d2 | 4163 | |
22c4c869 | 4164 | gcc_GAS_CHECK_FEATURE([.micromips support], |
b1485a33 | 4165 | gcc_cv_as_micromips_support,,[--fatal-warnings], |
22c4c869 CM |
4166 | [.set micromips],, |
4167 | [AC_DEFINE(HAVE_GAS_MICROMIPS, 1, | |
4168 | [Define if your assembler supports the .set micromips directive])]) | |
4169 | ||
a44380d2 JM |
4170 | gcc_GAS_CHECK_FEATURE([.dtprelword support], |
4171 | gcc_cv_as_mips_dtprelword, [2,18,0],, | |
4172 | [.section .tdata,"awT",@progbits | |
4173 | x: | |
4174 | .word 2 | |
4175 | .text | |
4176 | .dtprelword x+0x8000],, | |
4177 | [AC_DEFINE(HAVE_AS_DTPRELWORD, 1, | |
4178 | [Define if your assembler supports .dtprelword.])]) | |
b53da244 | 4179 | |
293b77b0 CF |
4180 | gcc_GAS_CHECK_FEATURE([DSPR1 mult with four accumulators support], |
4181 | gcc_cv_as_mips_dspr1_mult,,, | |
4182 | [ .set mips32r2 | |
4183 | .set nodspr2 | |
4184 | .set dsp | |
4185 | madd $ac3,$4,$5 | |
4186 | maddu $ac3,$4,$5 | |
4187 | msub $ac3,$4,$5 | |
4188 | msubu $ac3,$4,$5 | |
4189 | mult $ac3,$4,$5 | |
4190 | multu $ac3,$4,$5],, | |
4191 | [AC_DEFINE(HAVE_AS_DSPR1_MULT, 1, | |
4192 | [Define if your assembler supports DSPR1 mult.])]) | |
4193 | ||
b53da244 AN |
4194 | AC_MSG_CHECKING(assembler and linker for explicit JALR relocation) |
4195 | gcc_cv_as_ld_jalr_reloc=no | |
4196 | if test $gcc_cv_as_mips_explicit_relocs = yes; then | |
4197 | if test $in_tree_ld = yes ; then | |
4198 | if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 20 -o "$gcc_cv_gld_major_version" -gt 2 \ | |
4199 | && test $in_tree_ld_is_elf = yes; then | |
4200 | gcc_cv_as_ld_jalr_reloc=yes | |
4201 | fi | |
4202 | elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x; then | |
4203 | echo ' .ent x' > conftest.s | |
1e1f96b5 CM |
4204 | echo 'x: lw $2,%got_disp(y)($3)' >> conftest.s |
4205 | echo ' lw $25,%call16(y)($28)' >> conftest.s | |
b53da244 AN |
4206 | echo ' .reloc 1f,R_MIPS_JALR,y' >> conftest.s |
4207 | echo '1: jalr $25' >> conftest.s | |
4208 | echo ' .reloc 1f,R_MIPS_JALR,x' >> conftest.s | |
4209 | echo '1: jalr $25' >> conftest.s | |
4210 | echo ' .end x' >> conftest.s | |
4211 | if $gcc_cv_as -o conftest.o conftest.s >/dev/null 2>&AS_MESSAGE_LOG_FD \ | |
4212 | && $gcc_cv_ld -shared -o conftest.so conftest.o >/dev/null 2>&AS_MESSAGE_LOG_FD; then | |
bc492e47 RO |
4213 | if $gcc_cv_objdump -d conftest.so | grep jalr >/dev/null 2>&1 \ |
4214 | && $gcc_cv_objdump -d conftest.so | grep "bal.*<x>" >/dev/null 2>&1; then | |
b53da244 AN |
4215 | gcc_cv_as_ld_jalr_reloc=yes |
4216 | fi | |
4217 | fi | |
4218 | rm -f conftest.* | |
4219 | fi | |
4220 | fi | |
4221 | if test $gcc_cv_as_ld_jalr_reloc = yes; then | |
4222 | if test x$target_cpu_default = x; then | |
4223 | target_cpu_default=MASK_RELAX_PIC_CALLS | |
4224 | else | |
4225 | target_cpu_default="($target_cpu_default)|MASK_RELAX_PIC_CALLS" | |
4226 | fi | |
4227 | fi | |
4228 | AC_MSG_RESULT($gcc_cv_as_ld_jalr_reloc) | |
49576e25 RS |
4229 | |
4230 | AC_CACHE_CHECK([linker for .eh_frame personality relaxation], | |
4231 | [gcc_cv_ld_mips_personality_relaxation], | |
4232 | [gcc_cv_ld_mips_personality_relaxation=no | |
4233 | if test $in_tree_ld = yes ; then | |
4234 | if test "$gcc_cv_gld_major_version" -eq 2 \ | |
4235 | -a "$gcc_cv_gld_minor_version" -ge 21 \ | |
4236 | -o "$gcc_cv_gld_major_version" -gt 2; then | |
4237 | gcc_cv_ld_mips_personality_relaxation=yes | |
4238 | fi | |
4239 | elif test x$gcc_cv_as != x \ | |
4240 | -a x$gcc_cv_ld != x \ | |
4241 | -a x$gcc_cv_readelf != x ; then | |
4242 | cat > conftest.s <<EOF | |
4243 | .cfi_startproc | |
4244 | .cfi_personality 0x80,indirect_ptr | |
4245 | .ent test | |
4246 | test: | |
4247 | nop | |
4248 | .end test | |
4249 | .cfi_endproc | |
4250 | ||
4251 | .section .data,"aw",@progbits | |
4252 | indirect_ptr: | |
4253 | .dc.a personality | |
4254 | EOF | |
4255 | if $gcc_cv_as -KPIC -o conftest.o conftest.s > /dev/null 2>&1 \ | |
4256 | && $gcc_cv_ld -o conftest conftest.o -shared > /dev/null 2>&1; then | |
4257 | if $gcc_cv_readelf -d conftest 2>&1 \ | |
4258 | | grep TEXTREL > /dev/null 2>&1; then | |
4259 | : | |
4260 | elif $gcc_cv_readelf --relocs conftest 2>&1 \ | |
4261 | | grep 'R_MIPS_REL32 *$' > /dev/null 2>&1; then | |
4262 | : | |
4263 | else | |
4264 | gcc_cv_ld_mips_personality_relaxation=yes | |
4265 | fi | |
4266 | fi | |
4267 | fi | |
4268 | rm -f conftest.s conftest.o conftest]) | |
4269 | if test x$gcc_cv_ld_mips_personality_relaxation = xyes; then | |
4270 | AC_DEFINE(HAVE_LD_PERSONALITY_RELAXATION, 1, | |
4271 | [Define if your linker can relax absolute .eh_frame personality | |
4272 | pointers into PC-relative form.]) | |
4273 | fi | |
ff3f3951 MR |
4274 | |
4275 | gcc_GAS_CHECK_FEATURE([-mnan= support], | |
4276 | gcc_cv_as_mips_nan,, | |
4277 | [-mnan=2008],,, | |
4278 | [AC_DEFINE(HAVE_AS_NAN, 1, | |
4279 | [Define if the assembler understands -mnan=.])]) | |
4280 | if test x$gcc_cv_as_mips_nan = xno \ | |
4281 | && test x$with_nan != x; then | |
4282 | AC_MSG_ERROR( | |
4283 | [Requesting --with-nan= requires assembler support for -mnan=]) | |
4284 | fi | |
dbad5e72 SE |
4285 | ;; |
4286 | esac | |
4287 | ||
4288 | # Mips and HP-UX need the GNU assembler. | |
4289 | # Linux on IA64 might be able to use the Intel assembler. | |
8ada417f | 4290 | |
dbad5e72 SE |
4291 | case "$target" in |
4292 | mips*-*-* | *-*-hpux* ) | |
82563d35 RS |
4293 | if test x$gas_flag = xyes \ |
4294 | || test x"$host" != x"$build" \ | |
4295 | || test ! -x "$gcc_cv_as" \ | |
4296 | || "$gcc_cv_as" -v < /dev/null 2>&1 | grep GNU > /dev/null; then | |
4297 | : | |
4298 | else | |
4299 | echo "*** This configuration requires the GNU assembler" >&2 | |
4300 | exit 1 | |
4301 | fi | |
8ada417f ZW |
4302 | ;; |
4303 | esac | |
dbad5e72 | 4304 | |
9d147085 RH |
4305 | # ??? Not all targets support dwarf2 debug_line, even within a version |
4306 | # of gas. Moreover, we need to emit a valid instruction to trigger any | |
4307 | # info to the output file. So, as supported targets are added to gas 2.11, | |
4308 | # add some instruction here to (also) show we expect this might work. | |
4309 | # ??? Once 2.11 is released, probably need to add first known working | |
4310 | # version to the per-target configury. | |
7fa2619a | 4311 | case "$cpu_type" in |
4f2a9f90 | 4312 | aarch64 | alpha | arm | avr | bfin | cris | i386 | m32c | m68k | microblaze \ |
e430824f CLT |
4313 | | mips | nios2 | pa | rs6000 | score | sparc | spu | tilegx | tilepro \ |
4314 | | xstormy16 | xtensa) | |
9d147085 RH |
4315 | insn="nop" |
4316 | ;; | |
7fa2619a | 4317 | ia64 | s390) |
9d147085 RH |
4318 | insn="nop 0" |
4319 | ;; | |
7fa2619a | 4320 | mmix) |
2853bc5a HPN |
4321 | insn="swym 0" |
4322 | ;; | |
8ada417f ZW |
4323 | esac |
4324 | if test x"$insn" != x; then | |
4325 | conftest_s="\ | |
4326 | .file 1 \"conftest.s\" | |
4327 | .loc 1 3 0 | |
4328 | $insn" | |
4329 | gcc_GAS_CHECK_FEATURE([dwarf2 debug_line support], | |
4330 | gcc_cv_as_dwarf2_debug_line, | |
4331 | [elf,2,11,0],, [$conftest_s], | |
080a5bb0 EB |
4332 | [if test x$gcc_cv_objdump != x \ |
4333 | && $gcc_cv_objdump -h conftest.o 2> /dev/null \ | |
4334 | | grep debug_line > /dev/null 2>&1; then | |
8ada417f ZW |
4335 | gcc_cv_as_dwarf2_debug_line=yes |
4336 | fi]) | |
4337 | ||
4338 | # The .debug_line file table must be in the exact order that | |
4339 | # we specified the files, since these indices are also used | |
4340 | # by DW_AT_decl_file. Approximate this test by testing if | |
4341 | # the assembler bitches if the same index is assigned twice. | |
4342 | gcc_GAS_CHECK_FEATURE([buggy dwarf2 .file directive], | |
4343 | gcc_cv_as_dwarf2_file_buggy,,, | |
4344 | [ .file 1 "foo.s" | |
4345 | .file 1 "bar.s"]) | |
4346 | ||
4347 | if test $gcc_cv_as_dwarf2_debug_line = yes \ | |
4348 | && test $gcc_cv_as_dwarf2_file_buggy = no; then | |
9d147085 | 4349 | AC_DEFINE(HAVE_AS_DWARF2_DEBUG_LINE, 1, |
8ada417f | 4350 | [Define if your assembler supports dwarf2 .file/.loc directives, |
eaec9b3d | 4351 | and preserves file table indices exactly as given.]) |
8ada417f ZW |
4352 | fi |
4353 | ||
4354 | gcc_GAS_CHECK_FEATURE([--gdwarf2 option], | |
4355 | gcc_cv_as_gdwarf2_flag, | |
4356 | [elf,2,11,0], [--gdwarf2], [$insn],, | |
4357 | [AC_DEFINE(HAVE_AS_GDWARF2_DEBUG_FLAG, 1, | |
4358 | [Define if your assembler supports the --gdwarf2 option.])]) | |
4359 | ||
4360 | gcc_GAS_CHECK_FEATURE([--gstabs option], | |
4361 | gcc_cv_as_gstabs_flag, | |
d9f069ab | 4362 | [elf,2,11,0], [--gstabs], [$insn],, |
8ada417f ZW |
4363 | [AC_DEFINE(HAVE_AS_GSTABS_DEBUG_FLAG, 1, |
4364 | [Define if your assembler supports the --gstabs option.])]) | |
c8aea42c PB |
4365 | |
4366 | gcc_GAS_CHECK_FEATURE([--debug-prefix-map option], | |
4367 | gcc_cv_as_debug_prefix_map_flag, | |
303a4698 | 4368 | [2,18,0], [--debug-prefix-map /a=/b], [$insn],, |
c8aea42c PB |
4369 | [AC_DEFINE(HAVE_AS_DEBUG_PREFIX_MAP, 1, |
4370 | [Define if your assembler supports the --debug-prefix-map option.])]) | |
9d147085 | 4371 | fi |
5f0e9ea2 | 4372 | |
28e6bb13 NC |
4373 | gcc_GAS_CHECK_FEATURE([.lcomm with alignment], gcc_cv_as_lcomm_with_alignment, |
4374 | ,, | |
4375 | [.lcomm bar,4,16],, | |
4376 | [AC_DEFINE(HAVE_GAS_LCOMM_WITH_ALIGNMENT, 1, | |
4377 | [Define if your assembler supports .lcomm with an alignment field.])]) | |
4378 | ||
75a2bcc0 JM |
4379 | if test x$with_sysroot = x && test x$host = x$target \ |
4380 | && test "$prefix" != "/usr" && test "x$prefix" != "x$local_prefix" \ | |
4381 | && test "$prefix" != "NONE"; then | |
4382 | AC_DEFINE_UNQUOTED(PREFIX_INCLUDE_DIR, "$prefix/include", | |
4383 | [Define to PREFIX/include if cpp should also search that directory.]) | |
4384 | fi | |
4385 | ||
4386 | if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x; then | |
4387 | if test "x$with_headers" != x; then | |
4388 | target_header_dir=$with_headers | |
4389 | elif test "x$with_sysroot" = x; then | |
4390 | target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-include" | |
4391 | elif test "x$with_build_sysroot" != "x"; then | |
4392 | target_header_dir="${with_build_sysroot}${native_system_header_dir}" | |
4393 | elif test "x$with_sysroot" = xyes; then | |
4394 | target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-root${native_system_header_dir}" | |
4395 | else | |
4396 | target_header_dir="${with_sysroot}${native_system_header_dir}" | |
4397 | fi | |
4398 | else | |
4399 | target_header_dir=${native_system_header_dir} | |
4400 | fi | |
4401 | ||
4402 | # Determine the version of glibc, if any, used on the target. | |
4403 | AC_MSG_CHECKING([for target glibc version]) | |
4404 | AC_ARG_WITH([glibc-version], | |
4405 | [AS_HELP_STRING([--with-glibc-version=M.N], | |
4406 | [assume GCC used with glibc version M.N or later])], [ | |
4407 | if [echo "$with_glibc_version" | grep '^[0-9][0-9]*\.[0-9][0-9]*$']; then | |
4408 | glibc_version_major=`echo "$with_glibc_version" | sed -e 's/\..*//'` | |
4409 | glibc_version_minor=`echo "$with_glibc_version" | sed -e 's/.*\.//'` | |
4410 | else | |
4411 | AC_MSG_ERROR([option --with-glibc-version requires a version number M.N]) | |
4412 | fi], [ | |
4413 | glibc_version_major=0 | |
4414 | glibc_version_minor=0 | |
4415 | [if test -f $target_header_dir/features.h \ | |
4416 | && glibc_version_major_define=`$EGREP '^[ ]*#[ ]*define[ ]+__GLIBC__[ ]+[0-9]' $target_header_dir/features.h` \ | |
4417 | && glibc_version_minor_define=`$EGREP '^[ ]*#[ ]*define[ ]+__GLIBC_MINOR__[ ]+[0-9]' $target_header_dir/features.h`; then | |
4418 | glibc_version_major=`echo "$glibc_version_major_define" | sed -e 's/.*__GLIBC__[ ]*//'` | |
4419 | glibc_version_minor=`echo "$glibc_version_minor_define" | sed -e 's/.*__GLIBC_MINOR__[ ]*//'` | |
4420 | fi]]) | |
4421 | AC_MSG_RESULT([$glibc_version_major.$glibc_version_minor]) | |
4422 | ||
e31bcd1b | 4423 | AC_ARG_ENABLE(gnu-unique-object, |
87e6d9dc TB |
4424 | [AS_HELP_STRING([--enable-gnu-unique-object], |
4425 | [enable the use of the @gnu_unique_object ELF extension on glibc systems])], | |
e31bcd1b JM |
4426 | [case $enable_gnu_unique_object in |
4427 | yes | no) ;; | |
4428 | *) AC_MSG_ERROR(['$enable_gnu_unique_object' is an invalid value for --enable-gnu-unique-object. | |
4429 | Valid choices are 'yes' and 'no'.]) ;; | |
4430 | esac], | |
4431 | [gcc_GAS_CHECK_FEATURE([gnu_unique_object], gcc_cv_as_gnu_unique_object, | |
4432 | [elf,2,19,52],, | |
5ab22850 RR |
4433 | [.type foo, '$target_type_format_char'gnu_unique_object],, |
4434 | # We need to unquote above to to use the definition from config.gcc. | |
e31bcd1b | 4435 | # Also check for ld.so support, i.e. glibc 2.11 or higher. |
75a2bcc0 JM |
4436 | [GCC_GLIBC_VERSION_GTE_IFELSE([2], [11], [enable_gnu_unique_object=yes], )] |
4437 | )]) | |
e31bcd1b JM |
4438 | if test x$enable_gnu_unique_object = xyes; then |
4439 | AC_DEFINE(HAVE_GAS_GNU_UNIQUE_OBJECT, 1, | |
4440 | [Define if your assembler supports @gnu_unique_object.]) | |
4441 | fi | |
4442 | ||
03943c05 AO |
4443 | AC_CACHE_CHECK([assembler for tolerance to line number 0], |
4444 | [gcc_cv_as_line_zero], | |
4445 | [gcc_cv_as_line_zero=no | |
4446 | if test $in_tree_gas = yes; then | |
cf0eb7a1 | 4447 | gcc_GAS_VERSION_GTE_IFELSE(2, 16, 91, [gcc_cv_as_line_zero=yes]) |
03943c05 AO |
4448 | elif test "x$gcc_cv_as" != x; then |
4449 | { echo '# 1 "test.s" 1'; echo '# 0 "" 2'; } > conftest.s | |
4450 | if AC_TRY_COMMAND([$gcc_cv_as -o conftest.o conftest.s >&AS_MESSAGE_LOG_FD 2>conftest.out]) && | |
4451 | test "x`cat conftest.out`" = x | |
4452 | then | |
4453 | gcc_cv_as_line_zero=yes | |
4454 | else | |
4455 | echo "configure: failed program was" >&AS_MESSAGE_LOG_FD | |
4456 | cat conftest.s >&AS_MESSAGE_LOG_FD | |
4457 | echo "configure: error output was" >&AS_MESSAGE_LOG_FD | |
4458 | cat conftest.out >&AS_MESSAGE_LOG_FD | |
4459 | fi | |
4460 | rm -f conftest.o conftest.s conftest.out | |
4461 | fi]) | |
4462 | if test "x$gcc_cv_as_line_zero" = xyes; then | |
4463 | AC_DEFINE([HAVE_AS_LINE_ZERO], 1, | |
4464 | [Define if the assembler won't complain about a line such as # 0 "" 2.]) | |
4465 | fi | |
4466 | ||
275b60d6 JJ |
4467 | AC_MSG_CHECKING(linker PT_GNU_EH_FRAME support) |
4468 | gcc_cv_ld_eh_frame_hdr=no | |
34a86c2b | 4469 | if test $in_tree_ld = yes ; then |
5408ac6c HPN |
4470 | 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 \ |
4471 | && test $in_tree_ld_is_elf = yes; then | |
275b60d6 JJ |
4472 | gcc_cv_ld_eh_frame_hdr=yes |
4473 | fi | |
4474 | elif test x$gcc_cv_ld != x; then | |
6961669f RO |
4475 | if echo "$ld_ver" | grep GNU > /dev/null; then |
4476 | # Check if linker supports --eh-frame-hdr option | |
4477 | if $gcc_cv_ld --help 2>/dev/null | grep eh-frame-hdr > /dev/null; then | |
4478 | gcc_cv_ld_eh_frame_hdr=yes | |
4479 | fi | |
4480 | else | |
4481 | case "$target" in | |
4482 | *-*-solaris2*) | |
e279edb0 RO |
4483 | # Sun ld has various bugs in .eh_frame_hdr support before version 1.2251. |
4484 | if test "$ld_vers_major" -gt 1 || test "$ld_vers_minor" -ge 2251; then | |
6961669f RO |
4485 | gcc_cv_ld_eh_frame_hdr=yes |
4486 | fi | |
4487 | ;; | |
4488 | esac | |
4489 | fi | |
275b60d6 | 4490 | fi |
232b67d9 | 4491 | GCC_TARGET_TEMPLATE([HAVE_LD_EH_FRAME_HDR]) |
275b60d6 JJ |
4492 | if test x"$gcc_cv_ld_eh_frame_hdr" = xyes; then |
4493 | AC_DEFINE(HAVE_LD_EH_FRAME_HDR, 1, | |
6961669f | 4494 | [Define if your linker supports .eh_frame_hdr.]) |
275b60d6 JJ |
4495 | fi |
4496 | AC_MSG_RESULT($gcc_cv_ld_eh_frame_hdr) | |
4497 | ||
5022315a RO |
4498 | AC_MSG_CHECKING(linker CIEv3 in .eh_frame support) |
4499 | gcc_cv_ld_eh_frame_ciev3=no | |
4500 | if test $in_tree_ld = yes ; then | |
4501 | 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 \ | |
4502 | && test $in_tree_ld_is_elf = yes; then | |
4503 | gcc_cv_ld_eh_frame_ciev3=yes | |
4504 | fi | |
4505 | elif test x$gcc_cv_ld != x; then | |
4506 | if echo "$ld_ver" | grep GNU > /dev/null; then | |
4507 | gcc_cv_ld_eh_frame_ciev3=yes | |
4508 | if test 0"$ld_date" -lt 20040513; then | |
4509 | if test -n "$ld_date"; then | |
4510 | # If there was date string, but was earlier than 2004-05-13, fail | |
4511 | gcc_cv_ld_eh_frame_ciev3=no | |
4512 | elif test "$ld_vers_major" -lt 2; then | |
4513 | gcc_cv_ld_eh_frame_ciev3=no | |
4514 | elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 16; then | |
4515 | gcc_cv_ld_eh_frame_ciev3=no | |
4516 | fi | |
4517 | fi | |
4518 | else | |
4519 | case "$target" in | |
4520 | *-*-solaris2*) | |
4521 | # Sun ld added support for CIE v3 in .eh_frame in Solaris 11.1. | |
4522 | if test "$ld_vers_major" -gt 1 || test "$ld_vers_minor" -ge 2324; then | |
4523 | gcc_cv_ld_eh_frame_ciev3=yes | |
4524 | fi | |
4525 | ;; | |
4526 | esac | |
4527 | fi | |
4528 | fi | |
4529 | AC_DEFINE_UNQUOTED(HAVE_LD_EH_FRAME_CIEV3, | |
4530 | [`if test x"$gcc_cv_ld_eh_frame_ciev3" = xyes; then echo 1; else echo 0; fi`], | |
4531 | [Define 0/1 if your linker supports CIE v3 in .eh_frame.]) | |
4532 | AC_MSG_RESULT($gcc_cv_ld_eh_frame_ciev3) | |
4533 | ||
24a4dd31 JJ |
4534 | AC_MSG_CHECKING(linker position independent executable support) |
4535 | gcc_cv_ld_pie=no | |
4536 | if test $in_tree_ld = yes ; then | |
5408ac6c HPN |
4537 | 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 \ |
4538 | && test $in_tree_ld_is_elf = yes; then | |
24a4dd31 JJ |
4539 | gcc_cv_ld_pie=yes |
4540 | fi | |
4541 | elif test x$gcc_cv_ld != x; then | |
4542 | # Check if linker supports -pie option | |
4543 | if $gcc_cv_ld --help 2>/dev/null | grep -- -pie > /dev/null; then | |
4544 | gcc_cv_ld_pie=yes | |
4545 | fi | |
4546 | fi | |
4547 | if test x"$gcc_cv_ld_pie" = xyes; then | |
4548 | AC_DEFINE(HAVE_LD_PIE, 1, | |
4549 | [Define if your linker supports -pie option.]) | |
4550 | fi | |
4551 | AC_MSG_RESULT($gcc_cv_ld_pie) | |
4552 | ||
22ba88ef EB |
4553 | AC_MSG_CHECKING(linker EH-compatible garbage collection of sections) |
4554 | gcc_cv_ld_eh_gc_sections=no | |
4555 | if test $in_tree_ld = yes ; then | |
4556 | if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 17 -o "$gcc_cv_gld_major_version" -gt 2 \ | |
4557 | && test $in_tree_ld_is_elf = yes; then | |
4558 | gcc_cv_ld_eh_gc_sections=yes | |
4559 | fi | |
4560 | elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then | |
4561 | cat > conftest.s <<EOF | |
4562 | .section .text | |
4563 | .globl _start | |
4564 | .type _start, @function | |
4565 | _start: | |
4566 | .long foo | |
4567 | .size _start, .-_start | |
4568 | .section .text.foo,"ax",@progbits | |
4569 | .type foo, @function | |
4570 | foo: | |
4571 | .long 0 | |
4572 | .size foo, .-foo | |
4573 | .section .gcc_except_table.foo,"a",@progbits | |
4574 | .L0: | |
4575 | .long 0 | |
4576 | .section .eh_frame,"a",@progbits | |
4577 | .long .L0 | |
4578 | EOF | |
4579 | if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then | |
4580 | if $gcc_cv_ld -o conftest conftest.o --entry=_start --gc-sections 2>&1 \ | |
4581 | | grep "gc-sections option ignored" > /dev/null; then | |
4582 | gcc_cv_ld_eh_gc_sections=no | |
2e2b183b RO |
4583 | elif $gcc_cv_objdump -h conftest 2> /dev/null \ |
4584 | | grep gcc_except_table > /dev/null; then | |
22ba88ef | 4585 | gcc_cv_ld_eh_gc_sections=yes |
e9d207d9 EB |
4586 | # If no COMDAT groups, the compiler will emit .gnu.linkonce.t. sections. |
4587 | if test x$gcc_cv_as_comdat_group != xyes; then | |
4588 | gcc_cv_ld_eh_gc_sections=no | |
4589 | cat > conftest.s <<EOF | |
4590 | .section .text | |
4591 | .globl _start | |
4592 | .type _start, @function | |
4593 | _start: | |
4594 | .long foo | |
4595 | .size _start, .-_start | |
4596 | .section .gnu.linkonce.t.foo,"ax",@progbits | |
4597 | .type foo, @function | |
4598 | foo: | |
4599 | .long 0 | |
4600 | .size foo, .-foo | |
4601 | .section .gcc_except_table.foo,"a",@progbits | |
4602 | .L0: | |
4603 | .long 0 | |
4604 | .section .eh_frame,"a",@progbits | |
4605 | .long .L0 | |
4606 | EOF | |
4607 | if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then | |
4608 | if $gcc_cv_ld -o conftest conftest.o --entry=_start --gc-sections 2>&1 \ | |
4609 | | grep "gc-sections option ignored" > /dev/null; then | |
4610 | gcc_cv_ld_eh_gc_sections=no | |
2e2b183b RO |
4611 | elif $gcc_cv_objdump -h conftest 2> /dev/null \ |
4612 | | grep gcc_except_table > /dev/null; then | |
e9d207d9 EB |
4613 | gcc_cv_ld_eh_gc_sections=yes |
4614 | fi | |
4615 | fi | |
4616 | fi | |
22ba88ef EB |
4617 | fi |
4618 | fi | |
4619 | rm -f conftest.s conftest.o conftest | |
4620 | fi | |
e9d207d9 EB |
4621 | case "$target" in |
4622 | hppa*-*-linux*) | |
4623 | # ??? This apparently exposes a binutils bug with PC-relative relocations. | |
4624 | gcc_cv_ld_eh_gc_sections=no | |
4625 | ;; | |
4626 | esac | |
22ba88ef EB |
4627 | if test x$gcc_cv_ld_eh_gc_sections = xyes; then |
4628 | AC_DEFINE(HAVE_LD_EH_GC_SECTIONS, 1, | |
4629 | [Define if your linker supports garbage collection of | |
4630 | sections in presence of EH frames.]) | |
4631 | fi | |
4632 | AC_MSG_RESULT($gcc_cv_ld_eh_gc_sections) | |
4633 | ||
1b500976 JJ |
4634 | AC_MSG_CHECKING(linker EH garbage collection of sections bug) |
4635 | gcc_cv_ld_eh_gc_sections_bug=no | |
4636 | if test $in_tree_ld = yes ; then | |
4637 | if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -lt 19 -o "$gcc_cv_gld_major_version" -lt 2 \ | |
4638 | && test $in_tree_ld_is_elf = yes; then | |
4639 | gcc_cv_ld_eh_gc_sections_bug=yes | |
4640 | fi | |
4641 | elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x -a x$gcc_cv_as_comdat_group = xyes; then | |
4642 | gcc_cv_ld_eh_gc_sections_bug=yes | |
4643 | cat > conftest.s <<EOF | |
4644 | .section .text | |
4645 | .globl _start | |
4646 | .type _start, @function | |
4647 | _start: | |
4648 | .long foo | |
4649 | .size _start, .-_start | |
4650 | .section .text.startup.foo,"ax",@progbits | |
4651 | .type foo, @function | |
4652 | foo: | |
4653 | .long 0 | |
4654 | .size foo, .-foo | |
4655 | .section .gcc_except_table.foo,"a",@progbits | |
4656 | .L0: | |
4657 | .long 0 | |
4658 | .section .eh_frame,"a",@progbits | |
4659 | .long .L0 | |
4660 | EOF | |
4661 | if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then | |
4662 | if $gcc_cv_ld -o conftest conftest.o --entry=_start --gc-sections 2>&1 \ | |
4663 | | grep "gc-sections option ignored" > /dev/null; then | |
4664 | : | |
4665 | elif $gcc_cv_objdump -h conftest 2> /dev/null \ | |
4666 | | grep gcc_except_table > /dev/null; then | |
4667 | gcc_cv_ld_eh_gc_sections_bug=no | |
4668 | fi | |
4669 | fi | |
4670 | rm -f conftest.s conftest.o conftest | |
4671 | fi | |
4672 | if test x$gcc_cv_ld_eh_gc_sections_bug = xyes; then | |
4673 | AC_DEFINE(HAVE_LD_EH_GC_SECTIONS_BUG, 1, | |
4674 | [Define if your linker has buggy garbage collection of | |
4675 | sections support when .text.startup.foo like sections are used.]) | |
4676 | fi | |
4677 | AC_MSG_RESULT($gcc_cv_ld_eh_gc_sections_bug) | |
4678 | ||
630327c3 NN |
4679 | # -------- |
4680 | # UNSORTED | |
4681 | # -------- | |
4682 | ||
82e923f6 RS |
4683 | AC_CACHE_CHECK(linker --as-needed support, |
4684 | gcc_cv_ld_as_needed, | |
4685 | [gcc_cv_ld_as_needed=no | |
e927b6ad RO |
4686 | gcc_cv_ld_as_needed_option='--as-needed' |
4687 | gcc_cv_ld_no_as_needed_option='--no-as-needed' | |
765f1bf9 AM |
4688 | if test $in_tree_ld = yes ; then |
4689 | 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 \ | |
4690 | && test $in_tree_ld_is_elf = yes; then | |
4691 | gcc_cv_ld_as_needed=yes | |
4692 | fi | |
4693 | elif test x$gcc_cv_ld != x; then | |
4694 | # Check if linker supports --as-needed and --no-as-needed options | |
4695 | if $gcc_cv_ld --help 2>/dev/null | grep as-needed > /dev/null; then | |
4696 | gcc_cv_ld_as_needed=yes | |
e927b6ad RO |
4697 | else |
4698 | case "$target" in | |
4699 | # Solaris 2 ld always supports -z ignore/-z record. | |
4700 | *-*-solaris2*) | |
4701 | gcc_cv_ld_as_needed=yes | |
4702 | gcc_cv_ld_as_needed_option="-z ignore" | |
4703 | gcc_cv_ld_no_as_needed_option="-z record" | |
4704 | ;; | |
4705 | esac | |
765f1bf9 AM |
4706 | fi |
4707 | fi | |
56cf7859 RO |
4708 | # --as-needed/-z ignore can only be used if libgcc_s.so.1 uses |
4709 | # dl_iterate_phdr, i.e. since Solaris 11. | |
4710 | case "$target" in | |
4711 | *-*-solaris2.1[[1-9]]*) | |
4712 | case "$target" in | |
4713 | i?86-*-* | x86_64-*-*) | |
4714 | if echo "$ld_ver" | grep GNU > /dev/null; then | |
4715 | # Doesn't work with gld on Solaris/x86 due to PR ld/12320. | |
4716 | gcc_cv_ld_as_needed=no | |
4717 | fi | |
4718 | ;; | |
4719 | esac | |
4720 | ;; | |
4721 | *-*-solaris2*) | |
4722 | gcc_cv_ld_as_needed=no | |
4723 | ;; | |
4724 | esac | |
82e923f6 | 4725 | ]) |
765f1bf9 AM |
4726 | if test x"$gcc_cv_ld_as_needed" = xyes; then |
4727 | AC_DEFINE(HAVE_LD_AS_NEEDED, 1, | |
e927b6ad RO |
4728 | [Define if your linker supports --as-needed/--no-as-needed or equivalent options.]) |
4729 | AC_DEFINE_UNQUOTED(LD_AS_NEEDED_OPTION, "$gcc_cv_ld_as_needed_option", | |
4730 | [Define to the linker option to ignore unused dependencies.]) | |
4731 | AC_DEFINE_UNQUOTED(LD_NO_AS_NEEDED_OPTION, "$gcc_cv_ld_no_as_needed_option", | |
4732 | [Define to the linker option to keep unused dependencies.]) | |
765f1bf9 | 4733 | fi |
765f1bf9 | 4734 | |
d82bf747 | 4735 | case "$target:$tm_file" in |
a26f86dc AT |
4736 | powerpc64-*-freebsd* | powerpc64*-*-linux* | powerpc*-*-linux*rs6000/biarch64.h*) |
4737 | case "$target" in | |
14523c25 AB |
4738 | *le-*-linux*) |
4739 | emul_name="-melf64lppc" | |
4740 | ;; | |
a26f86dc AT |
4741 | *-*-linux*) |
4742 | emul_name="-melf64ppc" | |
4743 | ;; | |
4744 | *-*-freebsd*) | |
4745 | emul_name="-melf64ppc_fbsd" | |
4746 | ;; | |
4747 | esac | |
85b776df AM |
4748 | AC_CACHE_CHECK(linker support for omitting dot symbols, |
4749 | gcc_cv_ld_no_dot_syms, | |
4750 | [gcc_cv_ld_no_dot_syms=no | |
38e1b75f AM |
4751 | if test x"$ld_is_gold" = xyes; then |
4752 | gcc_cv_ld_no_dot_syms=yes | |
4753 | elif test $in_tree_ld = yes ; then | |
85b776df AM |
4754 | 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 |
4755 | gcc_cv_ld_no_dot_syms=yes | |
4756 | fi | |
4757 | elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x ; then | |
4758 | cat > conftest1.s <<EOF | |
4759 | .text | |
4760 | bl .foo | |
4761 | EOF | |
4762 | cat > conftest2.s <<EOF | |
4763 | .section ".opd","aw" | |
4764 | .align 3 | |
4765 | .globl foo | |
4766 | .type foo,@function | |
4767 | foo: | |
4768 | .quad .LEfoo,.TOC.@tocbase,0 | |
4769 | .text | |
4770 | .LEfoo: | |
4771 | blr | |
4772 | .size foo,.-.LEfoo | |
4773 | EOF | |
4774 | if $gcc_cv_as -a64 -o conftest1.o conftest1.s > /dev/null 2>&1 \ | |
4775 | && $gcc_cv_as -a64 -o conftest2.o conftest2.s > /dev/null 2>&1 \ | |
a26f86dc | 4776 | && $gcc_cv_ld $emul_name -o conftest conftest1.o conftest2.o > /dev/null 2>&1; then |
85b776df AM |
4777 | gcc_cv_ld_no_dot_syms=yes |
4778 | fi | |
4779 | rm -f conftest conftest1.o conftest2.o conftest1.s conftest2.s | |
4780 | fi | |
4781 | ]) | |
4782 | if test x"$gcc_cv_ld_no_dot_syms" = xyes; then | |
4783 | AC_DEFINE(HAVE_LD_NO_DOT_SYMS, 1, | |
4784 | [Define if your PowerPC64 linker only needs function descriptor syms.]) | |
4785 | fi | |
070b27da AM |
4786 | |
4787 | AC_CACHE_CHECK(linker large toc support, | |
4788 | gcc_cv_ld_large_toc, | |
4789 | [gcc_cv_ld_large_toc=no | |
38e1b75f AM |
4790 | if test x"$ld_is_gold" = xyes; then |
4791 | gcc_cv_ld_large_toc=yes | |
4792 | elif test $in_tree_ld = yes ; then | |
070b27da AM |
4793 | if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 21 -o "$gcc_cv_gld_major_version" -gt 2; then |
4794 | gcc_cv_ld_large_toc=yes | |
4795 | fi | |
4796 | elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x ; then | |
4797 | cat > conftest.s <<EOF | |
4798 | .section ".tbss","awT",@nobits | |
4799 | .align 3 | |
4800 | ie0: .space 8 | |
4801 | .global _start | |
4802 | .text | |
4803 | _start: | |
4804 | addis 9,13,ie0@got@tprel@ha | |
4805 | ld 9,ie0@got@tprel@l(9) | |
4806 | EOF | |
4807 | if $gcc_cv_as -a64 -o conftest.o conftest.s > /dev/null 2>&1 \ | |
a26f86dc | 4808 | && $gcc_cv_ld $emul_name --no-toc-sort -o conftest conftest.o > /dev/null 2>&1; then |
070b27da AM |
4809 | gcc_cv_ld_large_toc=yes |
4810 | fi | |
4811 | rm -f conftest conftest.o conftest.s | |
4812 | fi | |
4813 | ]) | |
4814 | if test x"$gcc_cv_ld_large_toc" = xyes; then | |
4815 | AC_DEFINE(HAVE_LD_LARGE_TOC, 1, | |
4816 | [Define if your PowerPC64 linker supports a large TOC.]) | |
4817 | fi | |
85b776df AM |
4818 | ;; |
4819 | esac | |
4820 | ||
9e81cc8b DE |
4821 | case "$target" in |
4822 | *-*-aix*) | |
4823 | AC_CACHE_CHECK(linker large toc support, | |
4824 | gcc_cv_ld_large_toc, | |
4825 | [gcc_cv_ld_large_toc=no | |
4826 | if test x$gcc_cv_as != x ; then | |
4827 | cat > conftest.s <<EOF | |
4828 | .toc | |
4829 | LC..1: | |
4830 | .tc a[[TC]],a[[RW]] | |
4831 | .extern a[[RW]] | |
4832 | .csect .text[[PR]] | |
4833 | .largetoctest: | |
4834 | addis 9,LC..1@u(2) | |
4835 | ld 3,LC..1@l(9) | |
4836 | EOF | |
4837 | if $gcc_cv_as -a64 -o conftest.o conftest.s > /dev/null 2>&1; then | |
4838 | gcc_cv_ld_large_toc=yes | |
4839 | fi | |
4840 | rm -f conftest conftest.o conftest.s | |
4841 | fi | |
4842 | ]) | |
4843 | if test x"$gcc_cv_ld_large_toc" = xyes; then | |
4844 | AC_DEFINE(HAVE_LD_LARGE_TOC, 1, | |
01ae4861 | 4845 | [Define if your PowerPC64 linker supports a large TOC.]) |
9e81cc8b DE |
4846 | fi |
4847 | ;; | |
4848 | esac | |
4849 | ||
cd533689 PP |
4850 | AC_CACHE_CHECK(linker --build-id support, |
4851 | gcc_cv_ld_buildid, | |
4852 | [gcc_cv_ld_buildid=no | |
4853 | if test $in_tree_ld = yes ; then | |
4854 | if test "$gcc_cv_gld_major_version" -eq 2 -a \ | |
4855 | "$gcc_cv_gld_minor_version" -ge 18 -o \ | |
4856 | "$gcc_cv_gld_major_version" -gt 2 \ | |
4857 | && test $in_tree_ld_is_elf = yes; then | |
4858 | gcc_cv_ld_buildid=yes | |
4859 | fi | |
4860 | elif test x$gcc_cv_ld != x; then | |
4861 | if $gcc_cv_ld --help 2>/dev/null | grep build-id > /dev/null; then | |
4862 | gcc_cv_ld_buildid=yes | |
4863 | fi | |
4864 | fi]) | |
4865 | if test x"$gcc_cv_ld_buildid" = xyes; then | |
4866 | AC_DEFINE(HAVE_LD_BUILDID, 1, | |
4867 | [Define if your linker supports --build-id.]) | |
4868 | fi | |
4869 | ||
4870 | AC_ARG_ENABLE(linker-build-id, | |
b88ecf55 AS |
4871 | [AS_HELP_STRING([--enable-linker-build-id], |
4872 | [compiler will always pass --build-id to linker])], | |
cd533689 PP |
4873 | [], |
4874 | enable_linker_build_id=no) | |
4875 | ||
4876 | if test x"$enable_linker_build_id" = xyes; then | |
4877 | if test x"$gcc_cv_ld_buildid" = xyes; then | |
4878 | AC_DEFINE(ENABLE_LD_BUILDID, 1, | |
4879 | [Define if gcc should always pass --build-id to linker.]) | |
4880 | else | |
4881 | AC_MSG_WARN(--build-id is not supported by your linker; --enable-linker-build-id ignored) | |
4882 | fi | |
4883 | fi | |
4884 | ||
a6198222 RO |
4885 | # In binutils 2.21, GNU ld gained support for new emulations fully |
4886 | # supporting the Solaris 2 ABI. Detect their presence in the linker used. | |
4887 | AC_CACHE_CHECK(linker *_sol2 emulation support, | |
4888 | gcc_cv_ld_sol2_emulation, | |
4889 | [gcc_cv_ld_sol2_emulation=no | |
4890 | if test $in_tree_ld = yes ; then | |
4891 | if test "$gcc_cv_gld_major_version" -eq 2 -a \ | |
4892 | "$gcc_cv_gld_minor_version" -ge 21 -o \ | |
4893 | "$gcc_cv_gld_major_version" -gt 2 \ | |
4894 | && test $in_tree_ld_is_elf = yes; then | |
4895 | gcc_cv_ld_sol2_emulation=yes | |
4896 | fi | |
4897 | elif test x$gcc_cv_ld != x; then | |
4898 | if $gcc_cv_ld -V 2>/dev/null | sed -e '1,/Supported emulations/d;q' | \ | |
4899 | grep _sol2 > /dev/null; then | |
4900 | gcc_cv_ld_sol2_emulation=yes | |
4901 | fi | |
4902 | fi]) | |
4903 | if test x"$gcc_cv_ld_sol2_emulation" = xyes; then | |
4904 | AC_DEFINE(HAVE_LD_SOL2_EMULATION, 1, | |
4905 | [Define if your linker supports the *_sol2 emulations.]) | |
4906 | fi | |
4907 | ||
380e5ca4 MM |
4908 | AC_CACHE_CHECK(linker --sysroot support, |
4909 | gcc_cv_ld_sysroot, | |
4910 | [gcc_cv_ld_sysroot=no | |
4911 | if test $in_tree_ld = yes ; then | |
4912 | 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 | |
7032df40 | 4913 | gcc_cv_ld_sysroot=yes |
380e5ca4 MM |
4914 | fi |
4915 | elif test x$gcc_cv_ld != x; then | |
4916 | if $gcc_cv_ld --help 2>/dev/null | grep sysroot > /dev/null; then | |
4917 | gcc_cv_ld_sysroot=yes | |
4918 | fi | |
4919 | fi]) | |
4920 | if test x"$gcc_cv_ld_sysroot" = xyes; then | |
4921 | AC_DEFINE(HAVE_LD_SYSROOT, 1, | |
4922 | [Define if your linker supports --sysroot.]) | |
4923 | fi | |
4924 | ||
77008252 | 4925 | # Test for stack protector support in target C library. |
a6ccdbab | 4926 | AC_CACHE_CHECK(__stack_chk_fail in target C library, |
77008252 JJ |
4927 | gcc_cv_libc_provides_ssp, |
4928 | [gcc_cv_libc_provides_ssp=no | |
a6ccdbab | 4929 | case "$target" in |
22f96a0f | 4930 | *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu) |
75a2bcc0 | 4931 | # glibc 2.4 and later provides __stack_chk_fail and |
77008252 | 4932 | # either __stack_chk_guard, or TLS access to stack guard canary. |
75a2bcc0 JM |
4933 | GCC_GLIBC_VERSION_GTE_IFELSE([2], [4], [gcc_cv_libc_provides_ssp=yes], [ |
4934 | [if test -f $target_header_dir/features.h \ | |
1a242e3c | 4935 | && $EGREP '^[ ]*#[ ]*define[ ]+__GNU_LIBRARY__[ ]+([1-9][0-9]|[6-9])' \ |
6961669f | 4936 | $target_header_dir/features.h > /dev/null; then |
75a2bcc0 | 4937 | if $EGREP '^[ ]*#[ ]*define[ ]+__UCLIBC__[ ]+1' \ |
6961669f RO |
4938 | $target_header_dir/features.h > /dev/null && \ |
4939 | test -f $target_header_dir/bits/uClibc_config.h && \ | |
1a242e3c | 4940 | $EGREP '^[ ]*#[ ]*define[ ]+__UCLIBC_HAS_SSP__[ ]+1' \ |
6961669f | 4941 | $target_header_dir/bits/uClibc_config.h > /dev/null; then |
fed6d628 | 4942 | gcc_cv_libc_provides_ssp=yes |
77008252 | 4943 | fi |
40295cc7 IZ |
4944 | # all versions of Bionic support stack protector |
4945 | elif test -f $target_header_dir/sys/cdefs.h \ | |
4946 | && $EGREP '^[ ]*#[ ]*define[ ]+__BIONIC__[ ]+1' \ | |
4947 | $target_header_dir/sys/cdefs.h > /dev/null; then | |
4948 | gcc_cv_libc_provides_ssp=yes | |
75a2bcc0 | 4949 | fi]]) |
a6ccdbab | 4950 | ;; |
4cc115a2 TS |
4951 | *-*-gnu*) |
4952 | # Avoid complicated tests (see | |
4953 | # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now | |
4954 | # simply assert that glibc does provide this, which is true for all | |
4955 | # realistically usable GNU/Hurd configurations. | |
4956 | gcc_cv_libc_provides_ssp=yes;; | |
61e1d511 | 4957 | *-*-darwin* | *-*-freebsd*) |
a6ccdbab EC |
4958 | AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes], |
4959 | [echo "no __stack_chk_fail on this target"]) | |
4960 | ;; | |
77008252 | 4961 | *) gcc_cv_libc_provides_ssp=no ;; |
a6ccdbab EC |
4962 | esac]) |
4963 | ||
77008252 JJ |
4964 | if test x$gcc_cv_libc_provides_ssp = xyes; then |
4965 | AC_DEFINE(TARGET_LIBC_PROVIDES_SSP, 1, | |
4966 | [Define if your target C library provides stack protector support]) | |
4967 | fi | |
4968 | ||
f4e749b4 TT |
4969 | # Test for <sys/sdt.h> on the target. |
4970 | GCC_TARGET_TEMPLATE([HAVE_SYS_SDT_H]) | |
4971 | AC_MSG_CHECKING(sys/sdt.h in the target C library) | |
4972 | have_sys_sdt_h=no | |
4973 | if test -f $target_header_dir/sys/sdt.h; then | |
d11aaed7 | 4974 | have_sys_sdt_h=yes |
f4e749b4 TT |
4975 | AC_DEFINE(HAVE_SYS_SDT_H, 1, |
4976 | [Define if your target C library provides sys/sdt.h]) | |
4977 | fi | |
4978 | AC_MSG_RESULT($have_sys_sdt_h) | |
4979 | ||
ed965309 JJ |
4980 | # Check if TFmode long double should be used by default or not. |
4981 | # Some glibc targets used DFmode long double, but with glibc 2.4 | |
4982 | # and later they can use TFmode. | |
4983 | case "$target" in | |
f7cc5390 | 4984 | powerpc*-*-linux* | \ |
ed965309 JJ |
4985 | sparc*-*-linux* | \ |
4986 | s390*-*-linux* | \ | |
4987 | alpha*-*-linux*) | |
4988 | AC_ARG_WITH(long-double-128, | |
b88ecf55 AS |
4989 | [AS_HELP_STRING([--with-long-double-128], |
4990 | [use 128-bit long double by default])], | |
ed965309 | 4991 | gcc_cv_target_ldbl128="$with_long_double_128", |
75a2bcc0 JM |
4992 | [GCC_GLIBC_VERSION_GTE_IFELSE([2], [4], [gcc_cv_target_ldbl128=yes], [ |
4993 | [gcc_cv_target_ldbl128=no | |
ed965309 | 4994 | grep '^[ ]*#[ ]*define[ ][ ]*__LONG_DOUBLE_MATH_OPTIONAL' \ |
6961669f | 4995 | $target_header_dir/bits/wordsize.h > /dev/null 2>&1 \ |
65280f6c | 4996 | && gcc_cv_target_ldbl128=yes |
75a2bcc0 | 4997 | ]])]) |
ed965309 JJ |
4998 | ;; |
4999 | esac | |
5000 | if test x$gcc_cv_target_ldbl128 = xyes; then | |
5001 | AC_DEFINE(TARGET_DEFAULT_LONG_DOUBLE_128, 1, | |
5002 | [Define if TFmode long double should be the default]) | |
5003 | fi | |
5004 | ||
6961669f RO |
5005 | AC_MSG_CHECKING(dl_iterate_phdr in target C library) |
5006 | gcc_cv_target_dl_iterate_phdr=unknown | |
5007 | case "$target" in | |
26923657 RO |
5008 | # Restrict to Solaris 11+. While most of the Solaris 11 linker changes |
5009 | # were backported to Solaris 10 Update 10, dl_iterate_phdr only lives in | |
5010 | # libdl there, both complicating its use and breaking compatibility | |
5011 | # between Solaris 10 updates. | |
5012 | *-*-solaris2.1[[1-9]]*) | |
6961669f RO |
5013 | # <link.h> needs both a dl_iterate_phdr declaration and support for |
5014 | # compilation with largefile support. | |
5015 | if grep dl_iterate_phdr $target_header_dir/link.h > /dev/null 2>&1 \ | |
5016 | && grep 'large file capable' $target_header_dir/link.h > /dev/null 2>&1; then | |
5017 | gcc_cv_target_dl_iterate_phdr=yes | |
5018 | else | |
5019 | gcc_cv_target_dl_iterate_phdr=no | |
5020 | fi | |
5021 | ;; | |
dbed5a9b JM |
5022 | *-*-dragonfly* | *-*-freebsd*) |
5023 | if grep dl_iterate_phdr $target_header_dir/sys/link_elf.h > /dev/null 2>&1; then | |
5024 | gcc_cv_target_dl_iterate_phdr=yes | |
5025 | else | |
5026 | gcc_cv_target_dl_iterate_phdr=no | |
5027 | fi | |
5028 | ;; | |
6961669f RO |
5029 | esac |
5030 | GCC_TARGET_TEMPLATE([TARGET_DL_ITERATE_PHDR]) | |
5031 | if test x$gcc_cv_target_dl_iterate_phdr = xyes; then | |
5032 | AC_DEFINE(TARGET_DL_ITERATE_PHDR, 1, | |
5033 | [Define if your target C library provides the `dl_iterate_phdr' function.]) | |
5034 | fi | |
5035 | AC_MSG_RESULT($gcc_cv_target_dl_iterate_phdr) | |
5036 | ||
cd030c07 DN |
5037 | # We no longer support different GC mechanisms. Emit an error if |
5038 | # the user configures with --with-gc. | |
81bf3d9e | 5039 | AC_ARG_WITH(gc, |
b88ecf55 | 5040 | [AS_HELP_STRING([--with-gc={page,zone}], |
cd030c07 DN |
5041 | [this option is not supported anymore. It used to choose |
5042 | the garbage collection mechanism to use with the compiler])], | |
5043 | [AC_MSG_ERROR([Configure option --with-gc is only supported up to GCC 4.7.x])], | |
5044 | []) | |
81bf3d9e | 5045 | |
00020c16 ILT |
5046 | # Libraries to use on the host. This will normally be set by the top |
5047 | # level Makefile. Here we simply capture the value for our Makefile. | |
5048 | if test -z "${HOST_LIBS+set}"; then | |
5049 | HOST_LIBS= | |
5050 | fi | |
5051 | AC_SUBST(HOST_LIBS) | |
5052 | ||
3c809ba4 | 5053 | # Use the system's zlib library. |
b8dad04b ZW |
5054 | zlibdir=-L../zlib |
5055 | zlibinc="-I\$(srcdir)/../zlib" | |
3c809ba4 | 5056 | AC_ARG_WITH(system-zlib, |
b88ecf55 | 5057 | [AS_HELP_STRING([--with-system-zlib], [use installed libz])], |
3c809ba4 AG |
5058 | zlibdir= |
5059 | zlibinc= | |
5060 | ) | |
5061 | AC_SUBST(zlibdir) | |
5062 | AC_SUBST(zlibinc) | |
5063 | ||
dc6746e7 PT |
5064 | dnl Very limited version of automake's enable-maintainer-mode |
5065 | ||
5066 | AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) | |
5067 | dnl maintainer-mode is disabled by default | |
5068 | AC_ARG_ENABLE(maintainer-mode, | |
b88ecf55 AS |
5069 | [AS_HELP_STRING([--enable-maintainer-mode], |
5070 | [enable make rules and dependencies not useful | |
5071 | (and sometimes confusing) to the casual installer])], | |
dc6746e7 PT |
5072 | maintainer_mode=$enableval, |
5073 | maintainer_mode=no) | |
5074 | ||
5075 | AC_MSG_RESULT($maintainer_mode) | |
5076 | ||
5077 | if test "$maintainer_mode" = "yes"; then | |
5078 | MAINT='' | |
5079 | else | |
5080 | MAINT='#' | |
5081 | fi | |
5082 | AC_SUBST(MAINT)dnl | |
5083 | ||
427b248d JM |
5084 | dnl Whether to prevent multiple front-ends from linking at the same time |
5085 | ||
5086 | AC_MSG_CHECKING([whether to avoid linking multiple front-ends at once]) | |
5087 | AC_ARG_ENABLE(link-mutex, | |
5088 | [AS_HELP_STRING([--enable-link-mutex], | |
5089 | [avoid linking multiple front-ends at once to avoid thrashing | |
5090 | on the build machine])], | |
5091 | do_link_mutex=$enableval, | |
5092 | do_link_mutex=no) | |
5093 | AC_MSG_RESULT($do_link_mutex) | |
5094 | ||
5095 | if test "$do_link_mutex" = "yes"; then | |
5096 | DO_LINK_MUTEX=true | |
5097 | else | |
5098 | DO_LINK_MUTEX=false | |
5099 | fi | |
5100 | AC_SUBST(DO_LINK_MUTEX) | |
5101 | ||
630327c3 NN |
5102 | # -------------- |
5103 | # Language hooks | |
5104 | # -------------- | |
5105 | ||
571a8de5 DE |
5106 | # Make empty files to contain the specs and options for each language. |
5107 | # Then add #include lines to for a compiler that has specs and/or options. | |
5108 | ||
cc11cc9b | 5109 | subdirs= |
d7b42618 | 5110 | lang_opt_files= |
571a8de5 | 5111 | lang_specs_files= |
3103b7db | 5112 | lang_tree_files= |
571a8de5 DE |
5113 | # These (without "all_") are set in each config-lang.in. |
5114 | # `language' must be a single word so is spelled singularly. | |
5115 | all_languages= | |
571a8de5 | 5116 | all_compilers= |
fda9c731 | 5117 | all_outputs='Makefile' |
571a8de5 | 5118 | # List of language makefile fragments. |
2ed26f6b | 5119 | all_lang_makefrags= |
11a67599 | 5120 | # Additional files for gengtype |
ef69da62 | 5121 | all_gtfiles="$target_gtfiles" |
571a8de5 | 5122 | |
cc11cc9b PB |
5123 | # These are the languages that are set in --enable-languages, |
5124 | # and are available in the GCC tree. | |
5125 | all_selected_languages= | |
5126 | ||
571a8de5 DE |
5127 | # Add the language fragments. |
5128 | # Languages are added via two mechanisms. Some information must be | |
5129 | # recorded in makefile variables, these are defined in config-lang.in. | |
5130 | # We accumulate them and plug them into the main Makefile. | |
5131 | # The other mechanism is a set of hooks for each of the main targets | |
5132 | # like `clean', `install', etc. | |
5133 | ||
571a8de5 DE |
5134 | language_hooks="Make-hooks" |
5135 | ||
cc11cc9b | 5136 | for lang in ${srcdir}/*/config-lang.in |
571a8de5 | 5137 | do |
cc11cc9b | 5138 | changequote(,)dnl |
1546bb64 PB |
5139 | test "$lang" = "${srcdir}/*/config-lang.in" && continue |
5140 | ||
cc11cc9b PB |
5141 | lang_alias=`sed -n -e 's,^language=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^language=\([^ ]*\).*$,\1,p' $lang` |
5142 | if test "x$lang_alias" = x | |
5143 | then | |
5144 | echo "$lang doesn't set \$language." 1>&2 | |
5145 | exit 1 | |
5146 | fi | |
5147 | subdir="`echo $lang | sed -e 's,^.*/\([^/]*\)/config-lang.in$,\1,'`" | |
5148 | subdirs="$subdirs $subdir" | |
349c3166 OH |
5149 | |
5150 | # $gcc_subdir is where the gcc integration files are to be found | |
5151 | # for a language, both for internal compiler purposes (compiler | |
5152 | # sources implementing front-end to GCC tree converters), and for | |
5153 | # build infrastructure purposes (Make-lang.in, etc.) | |
5154 | # | |
5155 | # This will be <subdir> (relative to $srcdir) if a line like | |
5156 | # gcc_subdir="<subdir>" or gcc_subdir=<subdir> | |
5157 | # is found in <langdir>/config-lang.in, and will remain <langdir> | |
5158 | # otherwise. | |
5159 | # | |
5160 | # Except for the language alias (fetched above), the regular | |
5161 | # "config-lang.in" contents are always retrieved from $gcc_subdir, | |
5162 | # so a <langdir>/config-lang.in setting gcc_subdir typically sets | |
5163 | # only this and the language alias. | |
5164 | ||
5165 | gcc_subdir=`sed -n -e 's,^gcc_subdir=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^gcc_subdir=\([^ ]*\).*$,\1,p' $lang` | |
5166 | if [ "$gcc_subdir" = "" ]; then | |
5167 | gcc_subdir="$subdir" | |
5168 | fi | |
5169 | ||
cc11cc9b PB |
5170 | case ",$enable_languages," in |
5171 | *,$lang_alias,*) | |
5172 | all_selected_languages="$all_selected_languages $lang_alias" | |
349c3166 OH |
5173 | if test -f $srcdir/$gcc_subdir/lang-specs.h; then |
5174 | lang_specs_files="$lang_specs_files $srcdir/$gcc_subdir/lang-specs.h" | |
cc11cc9b PB |
5175 | fi |
5176 | ;; | |
5177 | esac | |
5178 | changequote([,])dnl | |
5179 | ||
cc11cc9b PB |
5180 | language= |
5181 | boot_language= | |
5182 | compilers= | |
cc11cc9b PB |
5183 | outputs= |
5184 | gtfiles= | |
1546bb64 | 5185 | subdir_requires= |
349c3166 | 5186 | . ${srcdir}/$gcc_subdir/config-lang.in |
cc11cc9b PB |
5187 | if test "x$language" = x |
5188 | then | |
349c3166 | 5189 | echo "${srcdir}/$gcc_subdir/config-lang.in doesn't set \$language." 1>&2 |
cc11cc9b PB |
5190 | exit 1 |
5191 | fi | |
1546bb64 PB |
5192 | |
5193 | ok=: | |
5194 | case ",$enable_languages," in | |
5195 | *,$lang_alias,*) ;; | |
5196 | *) | |
5197 | for i in $subdir_requires; do | |
b6348cb3 | 5198 | test -f "${srcdir}/$i/config-lang.in" && continue |
1546bb64 PB |
5199 | ok=false |
5200 | break | |
5201 | done | |
5202 | ;; | |
5203 | esac | |
5204 | $ok || continue | |
5205 | ||
349c3166 OH |
5206 | all_lang_makefrags="$all_lang_makefrags \$(srcdir)/$gcc_subdir/Make-lang.in" |
5207 | if test -f $srcdir/$gcc_subdir/lang.opt; then | |
5208 | lang_opt_files="$lang_opt_files $srcdir/$gcc_subdir/lang.opt" | |
fd438373 | 5209 | all_opt_files="$all_opt_files $srcdir/$gcc_subdir/lang.opt" |
1546bb64 | 5210 | fi |
349c3166 OH |
5211 | if test -f $srcdir/$gcc_subdir/$subdir-tree.def; then |
5212 | lang_tree_files="$lang_tree_files $srcdir/$gcc_subdir/$subdir-tree.def" | |
1546bb64 | 5213 | fi |
cc11cc9b | 5214 | all_languages="$all_languages $language" |
cc11cc9b | 5215 | all_compilers="$all_compilers $compilers" |
cc11cc9b | 5216 | all_outputs="$all_outputs $outputs" |
11a67599 | 5217 | all_gtfiles="$all_gtfiles [[$subdir]] $gtfiles" |
d7f09764 DN |
5218 | case ",$enable_languages," in |
5219 | *,lto,*) | |
5220 | AC_DEFINE(ENABLE_LTO, 1, [Define to enable LTO support.]) | |
5221 | enable_lto=yes | |
5222 | AC_SUBST(enable_lto) | |
5223 | ;; | |
5224 | *) ;; | |
5225 | esac | |
571a8de5 DE |
5226 | done |
5227 | ||
cbc59f01 | 5228 | check_languages= |
cc11cc9b | 5229 | for language in $all_selected_languages |
cbc59f01 | 5230 | do |
cc11cc9b | 5231 | check_languages="$check_languages check-$language" |
cbc59f01 DD |
5232 | done |
5233 | ||
62b81e45 | 5234 | # We link each language in with a set of hooks, reached indirectly via |
cc11cc9b | 5235 | # lang.${target}. Only do so for selected languages. |
571a8de5 DE |
5236 | |
5237 | rm -f Make-hooks | |
5238 | touch Make-hooks | |
bd97af06 | 5239 | target_list="all.cross start.encap rest.encap tags \ |
55bcd32b AJ |
5240 | install-common install-man install-info install-pdf install-html dvi \ |
5241 | pdf html uninstall info man srcextra srcman srcinfo \ | |
2a4c0366 | 5242 | mostlyclean clean distclean maintainer-clean install-plugin" |
cc11cc9b | 5243 | |
571a8de5 DE |
5244 | for t in $target_list |
5245 | do | |
5246 | x= | |
cc11cc9b | 5247 | for lang in $all_selected_languages |
571a8de5 | 5248 | do |
cc11cc9b | 5249 | x="$x $lang.$t" |
571a8de5 DE |
5250 | done |
5251 | echo "lang.$t: $x" >> Make-hooks | |
5252 | done | |
5253 | ||
fd438373 MM |
5254 | # -------- |
5255 | # Option include files | |
5256 | # -------- | |
5257 | ||
5258 | ${AWK} -f $srcdir/opt-include.awk $all_opt_files > option-includes.mk | |
5259 | option_includes="option-includes.mk" | |
5260 | AC_SUBST_FILE(option_includes) | |
5261 | ||
630327c3 NN |
5262 | # -------- |
5263 | # UNSORTED | |
5264 | # -------- | |
5265 | ||
cc06d68c | 5266 | # Create .gdbinit. |
296e46bd | 5267 | |
cc06d68c GP |
5268 | echo "dir ." > .gdbinit |
5269 | echo "dir ${srcdir}" >> .gdbinit | |
5270 | if test x$gdb_needs_out_file_path = xyes | |
5271 | then | |
5272 | echo "dir ${srcdir}/config/"`dirname ${out_file}` >> .gdbinit | |
5273 | fi | |
5274 | if test "x$subdirs" != x; then | |
5275 | for s in $subdirs | |
5276 | do | |
5277 | echo "dir ${srcdir}/$s" >> .gdbinit | |
5278 | done | |
296e46bd | 5279 | fi |
cc06d68c | 5280 | echo "source ${srcdir}/gdbinit.in" >> .gdbinit |
8dce4dbc | 5281 | echo "python import sys; sys.path.append('${srcdir}'); import gdbhooks" >> .gdbinit |
296e46bd | 5282 | |
3bd7b086 L |
5283 | # Put a breakpoint on __asan_report_error to help with debugging buffer |
5284 | # overflow. | |
5285 | case "$CFLAGS" in | |
5286 | *-fsanitize=address*) | |
5287 | echo "source ${srcdir}/gdbasan.in" >> .gdbinit | |
5288 | ;; | |
5289 | esac | |
5290 | ||
15c723f3 | 5291 | gcc_tooldir='$(libsubdir)/$(libsubdir_to_prefix)$(target_noncanonical)' |
d062c304 | 5292 | AC_SUBST(gcc_tooldir) |
4c112cda | 5293 | AC_SUBST(dollar) |
d062c304 | 5294 | |
2bbea3a6 RH |
5295 | # Find a directory in which to install a shared libgcc. |
5296 | ||
5297 | AC_ARG_ENABLE(version-specific-runtime-libs, | |
b88ecf55 AS |
5298 | [AS_HELP_STRING([--enable-version-specific-runtime-libs], |
5299 | [specify that runtime libraries should be | |
5300 | installed in a compiler-specific directory])]) | |
2bbea3a6 | 5301 | |
46f18e7b RK |
5302 | # Substitute configuration variables |
5303 | AC_SUBST(subdirs) | |
8ac9d31f | 5304 | AC_SUBST(srcdir) |
46f18e7b | 5305 | AC_SUBST(all_compilers) |
e2500fed | 5306 | AC_SUBST(all_gtfiles) |
2ed26f6b | 5307 | AC_SUBST(all_lang_makefrags) |
9f3d1bc2 | 5308 | AC_SUBST(all_languages) |
cc11cc9b | 5309 | AC_SUBST(all_selected_languages) |
9f3d1bc2 BK |
5310 | AC_SUBST(build_exeext) |
5311 | AC_SUBST(build_install_headers_dir) | |
5312 | AC_SUBST(build_xm_file_list) | |
e22340b0 | 5313 | AC_SUBST(build_xm_include_list) |
11642c3a | 5314 | AC_SUBST(build_xm_defines) |
a0e527e3 | 5315 | AC_SUBST(build_file_translate) |
cbc59f01 | 5316 | AC_SUBST(check_languages) |
9f3d1bc2 | 5317 | AC_SUBST(cpp_install_dir) |
2ed26f6b ZW |
5318 | AC_SUBST(xmake_file) |
5319 | AC_SUBST(tmake_file) | |
aca600aa AS |
5320 | AC_SUBST(TM_ENDIAN_CONFIG) |
5321 | AC_SUBST(TM_MULTILIB_CONFIG) | |
5322 | AC_SUBST(TM_MULTILIB_EXCEPTIONS_CONFIG) | |
30500d84 | 5323 | AC_SUBST(extra_gcc_objs) |
9b91e436 KT |
5324 | AC_SUBST(user_headers_inc_next_pre) |
5325 | AC_SUBST(user_headers_inc_next_post) | |
9f3d1bc2 | 5326 | AC_SUBST(extra_headers_list) |
46f18e7b | 5327 | AC_SUBST(extra_objs) |
9f3d1bc2 | 5328 | AC_SUBST(extra_programs) |
9f3d1bc2 | 5329 | AC_SUBST(float_h_file) |
cc1e60ea | 5330 | AC_SUBST(gcc_config_arguments) |
9f3d1bc2 | 5331 | AC_SUBST(gcc_gxx_include_dir) |
17719d09 | 5332 | AC_SUBST(gcc_gxx_include_dir_add_sysroot) |
9f3d1bc2 | 5333 | AC_SUBST(host_exeext) |
46f18e7b | 5334 | AC_SUBST(host_xm_file_list) |
e22340b0 | 5335 | AC_SUBST(host_xm_include_list) |
11642c3a | 5336 | AC_SUBST(host_xm_defines) |
476d9098 | 5337 | AC_SUBST(out_host_hook_obj) |
9f3d1bc2 | 5338 | AC_SUBST(install) |
d7b42618 | 5339 | AC_SUBST(lang_opt_files) |
9f3d1bc2 | 5340 | AC_SUBST(lang_specs_files) |
3103b7db | 5341 | AC_SUBST(lang_tree_files) |
46f18e7b | 5342 | AC_SUBST(local_prefix) |
9f3d1bc2 BK |
5343 | AC_SUBST(md_file) |
5344 | AC_SUBST(objc_boehm_gc) | |
5345 | AC_SUBST(out_file) | |
5346 | AC_SUBST(out_object_file) | |
c49a6962 JM |
5347 | AC_SUBST(common_out_file) |
5348 | AC_SUBST(common_out_object_file) | |
9f3d1bc2 | 5349 | AC_SUBST(tm_file_list) |
e22340b0 | 5350 | AC_SUBST(tm_include_list) |
d5355cb2 | 5351 | AC_SUBST(tm_defines) |
11642c3a | 5352 | AC_SUBST(tm_p_file_list) |
e22340b0 ZW |
5353 | AC_SUBST(tm_p_include_list) |
5354 | AC_SUBST(xm_file_list) | |
5355 | AC_SUBST(xm_include_list) | |
3d9d2476 | 5356 | AC_SUBST(xm_defines) |
207bf79d | 5357 | AC_SUBST(use_gcc_stdint) |
aac69a49 NC |
5358 | AC_SUBST(c_target_objs) |
5359 | AC_SUBST(cxx_target_objs) | |
c776a6d0 | 5360 | AC_SUBST(fortran_target_objs) |
11642c3a | 5361 | AC_SUBST(target_cpu_default) |
46f18e7b | 5362 | |
46f18e7b RK |
5363 | AC_SUBST_FILE(language_hooks) |
5364 | ||
7903cebc NN |
5365 | # Echo link setup. |
5366 | if test x${build} = x${host} ; then | |
5367 | if test x${host} = x${target} ; then | |
5368 | echo "Links are now set up to build a native compiler for ${target}." 1>&2 | |
5369 | else | |
5370 | echo "Links are now set up to build a cross-compiler" 1>&2 | |
5371 | echo " from ${host} to ${target}." 1>&2 | |
5372 | fi | |
46f18e7b | 5373 | else |
7903cebc NN |
5374 | if test x${host} = x${target} ; then |
5375 | echo "Links are now set up to build (on ${build}) a native compiler" 1>&2 | |
5376 | echo " for ${target}." 1>&2 | |
5377 | else | |
5378 | echo "Links are now set up to build (on ${build}) a cross-compiler" 1>&2 | |
5379 | echo " from ${host} to ${target}." 1>&2 | |
5380 | fi | |
46f18e7b RK |
5381 | fi |
5382 | ||
6de9cd9a DN |
5383 | AC_ARG_VAR(GMPLIBS,[How to link GMP]) |
5384 | AC_ARG_VAR(GMPINC,[How to find GMP include files]) | |
5385 | ||
33ad93b9 RG |
5386 | AC_ARG_VAR(ISLLIBS,[How to link ISL]) |
5387 | AC_ARG_VAR(ISLINC,[How to find ISL include files]) | |
f8bf9252 SP |
5388 | |
5389 | AC_ARG_VAR(CLOOGLIBS,[How to link CLOOG]) | |
5390 | AC_ARG_VAR(CLOOGINC,[How to find CLOOG include files]) | |
5391 | if test "x${CLOOGLIBS}" != "x" ; then | |
5392 | AC_DEFINE(HAVE_cloog, 1, [Define if cloog is in use.]) | |
5393 | fi | |
5394 | ||
68a607d8 DN |
5395 | # Check for plugin support |
5396 | AC_ARG_ENABLE(plugin, | |
b88ecf55 | 5397 | [AS_HELP_STRING([--enable-plugin], [enable plugin support])], |
68a607d8 DN |
5398 | enable_plugin=$enableval, |
5399 | enable_plugin=yes; default_plugin=yes) | |
5400 | ||
5401 | pluginlibs= | |
601fc26e | 5402 | |
709e26f0 MK |
5403 | case "${host}" in |
5404 | *-*-darwin*) | |
5405 | if test x$build = x$host; then | |
5406 | export_sym_check="nm${exeext} -g" | |
515871c7 | 5407 | elif test x$host = x$target; then |
9ec69d2e | 5408 | export_sym_check="$gcc_cv_nm -g" |
709e26f0 MK |
5409 | else |
5410 | export_sym_check= | |
5411 | fi | |
5412 | ;; | |
5413 | *) | |
5414 | if test x$build = x$host; then | |
5415 | export_sym_check="objdump${exeext} -T" | |
515871c7 | 5416 | elif test x$host = x$target; then |
9ec69d2e | 5417 | export_sym_check="$gcc_cv_objdump -T" |
709e26f0 MK |
5418 | else |
5419 | export_sym_check= | |
5420 | fi | |
5421 | ;; | |
5422 | esac | |
5423 | ||
5424 | if test x"$enable_plugin" = x"yes"; then | |
5425 | ||
601fc26e | 5426 | AC_MSG_CHECKING([for exported symbols]) |
709e26f0 MK |
5427 | if test "x$export_sym_check" != x; then |
5428 | echo "int main() {return 0;} int foobar() {return 0;}" > conftest.c | |
93acd176 K |
5429 | ${CC} ${CFLAGS} ${LDFLAGS} conftest.c -o conftest$ac_exeext > /dev/null 2>&1 |
5430 | if $export_sym_check conftest$ac_exeext | grep -q foobar > /dev/null; then | |
709e26f0 MK |
5431 | : # No need to use a flag |
5432 | AC_MSG_RESULT([yes]) | |
601fc26e | 5433 | else |
709e26f0 MK |
5434 | AC_MSG_RESULT([yes]) |
5435 | AC_MSG_CHECKING([for -rdynamic]) | |
93acd176 K |
5436 | ${CC} ${CFLAGS} ${LDFLAGS} -rdynamic conftest.c -o conftest$ac_exeext > /dev/null 2>&1 |
5437 | if $export_sym_check conftest$ac_exeext | grep -q foobar > /dev/null; then | |
709e26f0 MK |
5438 | plugin_rdynamic=yes |
5439 | pluginlibs="-rdynamic" | |
5440 | else | |
5441 | plugin_rdynamic=no | |
5442 | enable_plugin=no | |
5443 | fi | |
5444 | AC_MSG_RESULT([$plugin_rdynamic]) | |
601fc26e | 5445 | fi |
709e26f0 MK |
5446 | else |
5447 | AC_MSG_RESULT([unable to check]) | |
68a607d8 DN |
5448 | fi |
5449 | ||
5450 | # Check -ldl | |
30ce157e | 5451 | saved_LIBS="$LIBS" |
0c2edd9f ILT |
5452 | AC_SEARCH_LIBS([dlopen], [dl]) |
5453 | if test x"$ac_cv_search_dlopen" = x"-ldl"; then | |
68a607d8 DN |
5454 | pluginlibs="$pluginlibs -ldl" |
5455 | fi | |
30ce157e | 5456 | LIBS="$saved_LIBS" |
68a607d8 DN |
5457 | |
5458 | # Check that we can build shared objects with -fPIC -shared | |
30ce157e | 5459 | saved_LDFLAGS="$LDFLAGS" |
d8ed14ce | 5460 | saved_CFLAGS="$CFLAGS" |
9ec69d2e JH |
5461 | case "${host}" in |
5462 | *-*-darwin*) | |
d8ed14ce IS |
5463 | CFLAGS=`echo $CFLAGS | sed s/-mdynamic-no-pic//g` |
5464 | CFLAGS="$CFLAGS -fPIC" | |
5465 | LDFLAGS="$LDFLAGS -shared -undefined dynamic_lookup" | |
9ec69d2e JH |
5466 | ;; |
5467 | *) | |
d8ed14ce | 5468 | CFLAGS="$CFLAGS -fPIC" |
9ec69d2e JH |
5469 | LDFLAGS="$LDFLAGS -fPIC -shared" |
5470 | ;; | |
5471 | esac | |
68a607d8 DN |
5472 | AC_MSG_CHECKING([for -fPIC -shared]) |
5473 | AC_TRY_LINK( | |
5474 | [extern int X;],[return X == 0;], | |
5475 | [AC_MSG_RESULT([yes]); have_pic_shared=yes], | |
5476 | [AC_MSG_RESULT([no]); have_pic_shared=no]) | |
0c2edd9f | 5477 | if test x"$have_pic_shared" != x"yes" -o x"$ac_cv_search_dlopen" = x"no"; then |
68a607d8 DN |
5478 | pluginlibs= |
5479 | enable_plugin=no | |
5480 | fi | |
30ce157e | 5481 | LDFLAGS="$saved_LDFLAGS" |
d8ed14ce | 5482 | CFLAGS="$saved_CFLAGS" |
68a607d8 DN |
5483 | |
5484 | # If plugin support had been requested but not available, fail. | |
5485 | if test x"$enable_plugin" = x"no" ; then | |
5486 | if test x"$default_plugin" != x"yes"; then | |
5487 | AC_MSG_ERROR([ | |
5488 | Building GCC with plugin support requires a host that supports | |
5489 | -fPIC, -shared, -ldl and -rdynamic.]) | |
5490 | fi | |
5491 | fi | |
68a607d8 DN |
5492 | fi |
5493 | ||
5494 | AC_SUBST(pluginlibs) | |
5495 | AC_SUBST(enable_plugin) | |
5496 | if test x"$enable_plugin" = x"yes"; then | |
5497 | AC_DEFINE(ENABLE_PLUGIN, 1, [Define to enable plugin support.]) | |
5498 | fi | |
5499 | ||
87e6d9dc | 5500 | |
459260ec DM |
5501 | # Enable --enable-host-shared |
5502 | AC_ARG_ENABLE(host-shared, | |
5503 | [AS_HELP_STRING([--enable-host-shared], | |
5504 | [build host code as shared libraries])], | |
5505 | [PICFLAG=-fPIC], [PICFLAG=]) | |
5506 | AC_SUBST(enable_host_shared) | |
5507 | AC_SUBST(PICFLAG) | |
5508 | ||
5509 | ||
87e6d9dc TB |
5510 | AC_ARG_ENABLE(libquadmath-support, |
5511 | [AS_HELP_STRING([--disable-libquadmath-support], | |
5512 | [disable libquadmath support for Fortran])], | |
5513 | ENABLE_LIBQUADMATH_SUPPORT=$enableval, | |
5514 | ENABLE_LIBQUADMATH_SUPPORT=yes) | |
5515 | if test "${ENABLE_LIBQUADMATH_SUPPORT}" != "no" ; then | |
5516 | AC_DEFINE(ENABLE_LIBQUADMATH_SUPPORT, 1, | |
5517 | [Define to 1 to enable libquadmath support]) | |
5518 | fi | |
5519 | ||
5520 | ||
79bec923 ST |
5521 | # Specify what hash style to use by default. |
5522 | AC_ARG_WITH([linker-hash-style], | |
5523 | [AC_HELP_STRING([--with-linker-hash-style={sysv,gnu,both}], | |
5524 | [specify the linker hash style])], | |
5525 | [case x"$withval" in | |
5526 | xsysv) | |
5527 | LINKER_HASH_STYLE=sysv | |
5528 | ;; | |
5529 | xgnu) | |
5530 | LINKER_HASH_STYLE=gnu | |
5531 | ;; | |
5532 | xboth) | |
5533 | LINKER_HASH_STYLE=both | |
5534 | ;; | |
5535 | *) | |
5536 | AC_MSG_ERROR([$withval is an invalid option to --with-linker-hash-style]) | |
5537 | ;; | |
5538 | esac], | |
5539 | [LINKER_HASH_STYLE='']) | |
5540 | if test x"${LINKER_HASH_STYLE}" != x; then | |
5541 | AC_DEFINE_UNQUOTED(LINKER_HASH_STYLE, "$LINKER_HASH_STYLE", | |
5542 | [The linker hash style]) | |
5543 | fi | |
5544 | ||
46f18e7b RK |
5545 | # Configure the subdirectories |
5546 | # AC_CONFIG_SUBDIRS($subdirs) | |
5547 | ||
5548 | # Create the Makefile | |
5891b37d | 5549 | # and configure language subdirectories |
914c5af7 NN |
5550 | AC_CONFIG_FILES($all_outputs) |
5551 | ||
5552 | AC_CONFIG_COMMANDS([default], | |
cdcc6a01 | 5553 | [ |
f1faaabd NN |
5554 | case ${CONFIG_HEADERS} in |
5555 | *auto-host.h:config.in*) | |
5556 | echo > cstamp-h ;; | |
cdcc6a01 | 5557 | esac |
2ed26f6b | 5558 | # Make sure all the subdirs exist. |
c49a6962 | 5559 | for d in $subdirs doc build common c-family |
2ed26f6b | 5560 | do |
2ed26f6b | 5561 | test -d $d || mkdir $d |
2ed26f6b | 5562 | done |
0d24f4d1 | 5563 | ], |
35f06ae4 | 5564 | [subdirs='$subdirs']) |
914c5af7 | 5565 | AC_OUTPUT |
fd438373 | 5566 |