configure.ac 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728
  1. dnl Process this file with autoconf to produce a configure script.
  2. sinclude(../config/enable.m4)
  3. sinclude(../config/tls.m4)
  4. sinclude(../config/toolexeclibdir.m4)
  5. sinclude(../config/acx.m4)
  6. sinclude(../config/no-executables.m4)
  7. sinclude(../config/lib-ld.m4)
  8. sinclude(../config/override.m4)
  9. sinclude(../config/picflag.m4)
  10. sinclude(../config/dfp.m4)
  11. sinclude(../config/unwind_ipinfo.m4)
  12. sinclude(../config/gthr.m4)
  13. sinclude(../config/sjlj.m4)
  14. sinclude(../config/cet.m4)
  15. AC_INIT([GNU C Runtime Library], 1.0,,[libgcc])
  16. AC_CONFIG_SRCDIR([static-object.mk])
  17. # The libgcc should not depend on any header files
  18. AC_DEFUN([_AC_INCLUDES_DEFAULT_REQUIREMENTS],
  19. [m4_divert_text([DEFAULTS],
  20. [ac_includes_default='/* none */'])])
  21. AC_ARG_WITH(target-subdir,
  22. [ --with-target-subdir=SUBDIR Configuring in a subdirectory for target])
  23. AC_ARG_WITH(cross-host,
  24. [ --with-cross-host=HOST Configuring with a cross compiler])
  25. AC_ARG_WITH(ld,
  26. [ --with-ld arrange to use the specified ld (full pathname)])
  27. if test "${srcdir}" = "."; then
  28. if test -n "${with_build_subdir}"; then
  29. libgcc_topdir="${srcdir}/../.."
  30. with_target_subdir=
  31. elif test -z "${with_target_subdir}"; then
  32. libgcc_topdir="${srcdir}/.."
  33. else
  34. if test "${with_target_subdir}" != "."; then
  35. libgcc_topdir="${srcdir}/${with_multisrctop}../.."
  36. else
  37. libgcc_topdir="${srcdir}/${with_multisrctop}.."
  38. fi
  39. fi
  40. else
  41. libgcc_topdir="${srcdir}/.."
  42. fi
  43. AC_SUBST(libgcc_topdir)
  44. AC_CONFIG_AUX_DIR($libgcc_topdir)
  45. AC_CONFIG_HEADER(auto-target.h:config.in)
  46. AC_ARG_ENABLE(shared,
  47. [ --disable-shared don't provide a shared libgcc],
  48. [
  49. case $enable_shared in
  50. yes | no) ;;
  51. *)
  52. enable_shared=no
  53. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
  54. for pkg in $enableval; do
  55. if test "X$pkg" = "Xgcc" || test "X$pkg" = "Xlibgcc"; then
  56. enable_shared=yes
  57. fi
  58. done
  59. IFS="$ac_save_ifs"
  60. ;;
  61. esac
  62. ], [enable_shared=yes])
  63. AC_SUBST(enable_shared)
  64. AC_ARG_ENABLE(vtable-verify,
  65. [ --enable-vtable-verify Enable vtable verification feature ],
  66. [case "$enableval" in
  67. yes) enable_vtable_verify=yes ;;
  68. no) enable_vtable_verify=no ;;
  69. *) enable_vtable_verify=no;;
  70. esac],
  71. [enable_vtable_verify=no])
  72. AC_SUBST(enable_vtable_verify)
  73. AC_ARG_WITH(aix-soname,
  74. [AS_HELP_STRING([--with-aix-soname=aix|svr4|both],
  75. [shared library versioning (aka "SONAME") variant to provide on AIX])],
  76. [case "${host}:${enable_shared}" in
  77. power*-*-aix[[5-9]]*:yes)
  78. AC_MSG_CHECKING([which variant of shared library versioning to provide for shared libgcc])
  79. case ${withval} in
  80. aix|svr4|both) ;;
  81. *) AC_MSG_ERROR([Unknown argument to --with-aix-soname]);;
  82. esac
  83. AC_MSG_RESULT($withval)
  84. ;;
  85. *) with_aix_soname=aix ;;
  86. esac
  87. ], [with_aix_soname=aix])
  88. AC_SUBST(with_aix_soname)
  89. GCC_PICFLAG
  90. AC_SUBST(PICFLAG)
  91. AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
  92. AC_ARG_ENABLE(version-specific-runtime-libs,
  93. [ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ],
  94. [case "$enableval" in
  95. yes) version_specific_libs=yes ;;
  96. no) version_specific_libs=no ;;
  97. *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
  98. esac],
  99. [version_specific_libs=no])
  100. AC_MSG_RESULT($version_specific_libs)
  101. GCC_WITH_TOOLEXECLIBDIR
  102. AC_ARG_WITH(slibdir,
  103. [ --with-slibdir=DIR shared libraries in DIR [LIBDIR]],
  104. slibdir="$with_slibdir",
  105. [if test "${version_specific_libs}" = yes; then
  106. slibdir='$(libsubdir)'
  107. elif test -n "$with_cross_host" && test x"$with_cross_host" != x"no"; then
  108. case ${with_toolexeclibdir} in
  109. no)
  110. slibdir='$(exec_prefix)/$(host_noncanonical)/lib'
  111. ;;
  112. *)
  113. slibdir=${with_toolexeclibdir}
  114. ;;
  115. esac
  116. else
  117. slibdir='$(libdir)'
  118. fi])
  119. AC_SUBST(slibdir)
  120. # Command-line options.
  121. # Very limited version of AC_MAINTAINER_MODE.
  122. AC_ARG_ENABLE([maintainer-mode],
  123. [AC_HELP_STRING([--enable-maintainer-mode],
  124. [enable make rules and dependencies not useful (and
  125. sometimes confusing) to the casual installer])],
  126. [case ${enable_maintainer_mode} in
  127. yes) MAINT='' ;;
  128. no) MAINT='#' ;;
  129. *) AC_MSG_ERROR([--enable-maintainer-mode must be yes or no]) ;;
  130. esac
  131. maintainer_mode=${enableval}],
  132. [MAINT='#'])
  133. AC_SUBST([MAINT])dnl
  134. AC_PROG_INSTALL
  135. AC_PROG_AWK
  136. # We need awk; bail out if it's missing.
  137. case ${AWK} in
  138. "") AC_MSG_ERROR([can't build without awk, bailing out]) ;;
  139. esac
  140. AC_CANONICAL_HOST
  141. ACX_NONCANONICAL_HOST
  142. ACX_NONCANONICAL_TARGET
  143. GCC_TOPLEV_SUBDIRS
  144. AC_ARG_ENABLE(gcov,
  145. [ --disable-gcov don't provide libgcov and related host tools],
  146. [], [case $target in
  147. bpf-*-*)
  148. enable_gcov=no
  149. ;;
  150. *)
  151. enable_gcov=yes
  152. ;;
  153. esac])
  154. AC_SUBST(enable_gcov)
  155. # Calculate toolexeclibdir
  156. # Also toolexecdir, though it's only used in toolexeclibdir
  157. case ${version_specific_libs} in
  158. yes)
  159. # Need the gcc compiler version to know where to install libraries
  160. # and header files if --enable-version-specific-runtime-libs option
  161. # is selected.
  162. toolexecdir='$(libdir)/gcc/$(target_noncanonical)'
  163. toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
  164. ;;
  165. no)
  166. if test -n "$with_cross_host" &&
  167. test x"$with_cross_host" != x"no"; then
  168. # Install a library built with a cross compiler in tooldir, not libdir.
  169. toolexecdir='$(exec_prefix)/$(target_noncanonical)'
  170. case ${with_toolexeclibdir} in
  171. no)
  172. toolexeclibdir='$(toolexecdir)/lib'
  173. ;;
  174. *)
  175. toolexeclibdir=${with_toolexeclibdir}
  176. ;;
  177. esac
  178. else
  179. toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)'
  180. toolexeclibdir='$(libdir)'
  181. fi
  182. multi_os_directory=`$CC -print-multi-os-directory`
  183. case $multi_os_directory in
  184. .) ;; # Avoid trailing /.
  185. *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
  186. esac
  187. ;;
  188. esac
  189. AC_SUBST(toolexecdir)
  190. AC_SUBST(toolexeclibdir)
  191. dnl These must be called before AM_PROG_LIBTOOL, because it may want
  192. dnl to call AC_CHECK_PROG.
  193. AC_CHECK_TOOL(AR, ar)
  194. AC_CHECK_TOOL(LIPO, lipo, :)
  195. AC_CHECK_TOOL(NM, nm)
  196. AC_CHECK_TOOL(RANLIB, ranlib, :)
  197. AC_CHECK_TOOL(STRIP, strip, :)
  198. AC_PROG_LN_S
  199. GCC_NO_EXECUTABLES
  200. AC_PROG_CC
  201. AC_PROG_CPP_WERROR
  202. AC_SYS_LARGEFILE
  203. AC_CHECK_SIZEOF([double])
  204. AC_CHECK_SIZEOF([long double])
  205. AS_VAR_ARITH([double_type_size], [$ac_cv_sizeof_double \* 8])
  206. AS_VAR_ARITH([long_double_type_size], [$ac_cv_sizeof_long_double \* 8])
  207. AC_SUBST(double_type_size)
  208. AC_SUBST(long_double_type_size)
  209. AC_CHECK_HEADERS(inttypes.h stdint.h stdlib.h ftw.h \
  210. unistd.h sys/stat.h sys/types.h \
  211. string.h strings.h memory.h sys/auxv.h sys/mman.h)
  212. AC_HEADER_STDC
  213. # Check for decimal float support.
  214. AC_CACHE_CHECK([whether decimal floating point is supported], [libgcc_cv_dfp],
  215. [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  216. #include <fenv.h>
  217. ]], [[
  218. _Decimal32 x;
  219. int fe_except =
  220. FE_INVALID|FE_DIVBYZERO|FE_OVERFLOW|FE_UNDERFLOW|FE_INEXACT;
  221. ]])],
  222. [libgcc_cv_dfp=yes],
  223. [libgcc_cv_dfp=no])])
  224. decimal_float=$libgcc_cv_dfp
  225. AC_SUBST(decimal_float)
  226. GCC_AC_ENABLE_DECIMAL_FLOAT([$host])
  227. # Check for fixed-point support.
  228. AC_CACHE_CHECK([whether fixed-point is supported], [libgcc_cv_fixed_point],
  229. [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_Sat _Fract x;])],
  230. [libgcc_cv_fixed_point=yes],
  231. [libgcc_cv_fixed_point=no])])
  232. fixed_point=$libgcc_cv_fixed_point
  233. AC_SUBST(fixed_point)
  234. # For platforms with the unwind ABI which includes an unwind library,
  235. # libunwind, we can choose to use the system libunwind.
  236. # config.gcc also contains tests of with_system_libunwind.
  237. GCC_CHECK_UNWIND_GETIPINFO
  238. # Check if the compiler is configured for setjmp/longjmp exceptions.
  239. GCC_CHECK_SJLJ_EXCEPTIONS
  240. GCC_CET_FLAGS(CET_FLAGS)
  241. AC_SUBST(CET_FLAGS)
  242. AC_ARG_ENABLE([explicit-exception-frame-registration],
  243. [AC_HELP_STRING([--enable-explicit-exception-frame-registration],
  244. [register exception tables explicitly at module start, for use
  245. e.g. for compatibility with installations without PT_GNU_EH_FRAME support])],
  246. [
  247. force_explicit_eh_registry=
  248. if test "$enable_explicit_exception_frame_registration" = yes; then
  249. if test $ac_cv_sjlj_exceptions = yes; then
  250. AC_MSG_ERROR([Can't --enable-explicit-exception-frame-registration
  251. with setjmp/longjmp exceptions])
  252. fi
  253. force_explicit_eh_registry=-DUSE_EH_FRAME_REGISTRY_ALWAYS
  254. fi
  255. ])
  256. AC_SUBST([force_explicit_eh_registry])
  257. AC_ARG_ENABLE([tm-clone-registry],
  258. [ --disable-tm-clone-registry disable TM clone registry],
  259. [
  260. use_tm_clone_registry=
  261. if test "$enable_tm_clone_registry" = no; then
  262. use_tm_clone_registry=-DUSE_TM_CLONE_REGISTRY=0
  263. fi
  264. ],
  265. [
  266. use_tm_clone_registry=
  267. case $target in
  268. msp430*elfbare)
  269. use_tm_clone_registry=-DUSE_TM_CLONE_REGISTRY=0
  270. ;;
  271. esac
  272. ])
  273. AC_SUBST([use_tm_clone_registry])
  274. AC_LIB_PROG_LD_GNU
  275. AC_MSG_CHECKING([for thread model used by GCC])
  276. target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
  277. AC_MSG_RESULT([$target_thread_file])
  278. # Check for assembler CFI support.
  279. AC_CACHE_CHECK([whether assembler supports CFI directives], [libgcc_cv_cfi],
  280. [AC_COMPILE_IFELSE(
  281. [AC_LANG_SOURCE([asm("\n\
  282. .text\n\
  283. .cfi_startproc\n\
  284. .cfi_personality 0, symbol\n\
  285. .cfi_endproc");])],
  286. [libgcc_cv_cfi=yes],
  287. [libgcc_cv_cfi=no])])
  288. # Check 32bit or 64bit. In the case of MIPS, this really determines the
  289. # word size rather than the address size.
  290. cat > conftest.c <<EOF
  291. #if defined(__x86_64__) || (!defined(__i386__) && defined(__LP64__)) \
  292. || defined(__mips64) || defined(__loongarch64)
  293. host_address=64
  294. #else
  295. host_address=32
  296. #endif
  297. EOF
  298. eval `${CC-cc} -E conftest.c | grep host_address=`
  299. rm -f conftest.c
  300. case ${host} in
  301. mips*-*-*)
  302. AC_CACHE_CHECK([whether the target is hard-float],
  303. [libgcc_cv_mips_hard_float],
  304. [AC_COMPILE_IFELSE(
  305. [AC_LANG_SOURCE([#ifndef __mips_hard_float
  306. #error FOO
  307. #endif
  308. ])],
  309. [libgcc_cv_mips_hard_float=yes],
  310. [libgcc_cv_mips_hard_float=no])])
  311. esac
  312. case ${host} in
  313. *-*-solaris2*)
  314. # Check for system-provided CRTs on Solaris 11.4.
  315. AC_CACHE_CHECK([system-provided CRTs on Solaris],
  316. [libgcc_cv_solaris_crts],
  317. [libgcc_cv_solaris_crts=no
  318. libgcc_sysroot="`${CC} -print-sysroot`"
  319. libgcc_libdir="$libgcc_sysroot/usr/lib"
  320. # At the time they were added, gcrt1.o became a symlink for backwards
  321. # compatibility on x86, while crt1.o was added on sparc, so check for that.
  322. case ${host} in
  323. i?86-*-solaris2* | x86_64-*-solaris2*)
  324. if test -h "$libgcc_libdir/gcrt1.o"; then libgcc_cv_solaris_crts=yes; fi
  325. ;;
  326. sparc*-*-solaris2*)
  327. if test -f "$libgcc_libdir/crt1.o"; then libgcc_cv_solaris_crts=yes; fi
  328. ;;
  329. esac])
  330. if test $libgcc_cv_solaris_crts = yes; then
  331. AC_DEFINE(HAVE_SOLARIS_CRTS, 1,
  332. [Define if the system-provided CRTs are present on Solaris.])
  333. fi
  334. ;;
  335. esac
  336. # Determine the version of glibc, if any, used on the target.
  337. AC_MSG_CHECKING([for target glibc version])
  338. AC_ARG_WITH([glibc-version],
  339. [AS_HELP_STRING([--with-glibc-version=M.N],
  340. [assume GCC used with glibc version M.N or later])], [
  341. if [echo "$with_glibc_version" | grep '^[0-9][0-9]*\.[0-9][0-9]*$']; then
  342. glibc_version_major=`echo "$with_glibc_version" | sed -e 's/\..*//'`
  343. glibc_version_minor=`echo "$with_glibc_version" | sed -e 's/.*\.//'`
  344. else
  345. AC_MSG_ERROR([option --with-glibc-version requires a version number M.N])
  346. fi], [
  347. AC_COMPUTE_INT([glibc_version_major], [__GLIBC__],
  348. [#include <features.h>],
  349. [glibc_version_major=0])
  350. AC_COMPUTE_INT([glibc_version_minor], [__GLIBC_MINOR__],
  351. [#include <features.h>],
  352. [glibc_version_minor=0])])
  353. AC_MSG_RESULT([$glibc_version_major.$glibc_version_minor])
  354. # Determine floating-point type for powerpc*-*-linux* or vxworks7*.
  355. # Single-precision-only FPRs are not a supported configuration for
  356. # this target, so are not allowed for in this test.
  357. case ${host} in
  358. powerpc*-*-linux* | powerpc*-*-vxworks7*)
  359. cat > conftest.c <<EOF
  360. #ifdef __powerpc64__
  361. ppc_fp_type=64
  362. #elif defined _SOFT_FLOAT
  363. ppc_fp_type=soft
  364. #elif defined _SOFT_DOUBLE
  365. ppc_fp_type=e500v1
  366. #elif defined __NO_FPRS__
  367. ppc_fp_type=e500v2
  368. #else
  369. ppc_fp_type=hard
  370. #endif
  371. EOF
  372. eval `${CC-cc} -E conftest.c | grep ppc_fp_type=`
  373. rm -f conftest.c
  374. # glibc 2.19 and later provide all the soft-fp functions, with proper
  375. # interactions with <fenv.h> exception and rounding mode handling, so
  376. # make libgcc's versions into compat symbols if a recent enough glibc
  377. # version is being used.
  378. ppc_fp_compat=
  379. case ${ppc_fp_type} in
  380. soft|e500v1|e500v2)
  381. if test $glibc_version_major -gt 2 \
  382. || ( test $glibc_version_major -eq 2 \
  383. && test $glibc_version_minor -ge 19 ); then
  384. ppc_fp_compat="t-softfp-compat"
  385. fi
  386. ;;
  387. esac
  388. ;;
  389. esac
  390. case ${host} in
  391. # At present, we cannot turn -mfloat128 on via #pragma GCC target, so just
  392. # check if we have VSX (ISA 2.06) support to build the software libraries, and
  393. # whether the assembler can handle xsaddqp for hardware support. Also check if
  394. # a new glibc is being used so that __builtin_cpu_supports can be used.
  395. powerpc*-*-linux*)
  396. saved_CFLAGS="$CFLAGS"
  397. CFLAGS="$CFLAGS -mabi=altivec -mvsx -mfloat128"
  398. AC_CACHE_CHECK([for PowerPC ISA 2.06 to build __float128 libraries],
  399. [libgcc_cv_powerpc_float128],
  400. [AC_COMPILE_IFELSE(
  401. [AC_LANG_SOURCE([vector double dadd (vector double a, vector double b) { return a + b; }])],
  402. [libgcc_cv_powerpc_float128=yes],
  403. [libgcc_cv_powerpc_float128=no])])
  404. CFLAGS="$CFLAGS -mpower9-vector -mfloat128-hardware"
  405. AC_CACHE_CHECK([for PowerPC ISA 3.0 to build hardware __float128 libraries],
  406. [libgcc_cv_powerpc_float128_hw],
  407. [AC_COMPILE_IFELSE(
  408. [AC_LANG_SOURCE([#include <sys/auxv.h>
  409. #ifndef AT_PLATFORM
  410. #error "AT_PLATFORM is not defined"
  411. #endif
  412. #ifndef __BUILTIN_CPU_SUPPORTS__
  413. #error "__builtin_cpu_supports is not available"
  414. #endif
  415. vector unsigned char add (vector unsigned char a, vector unsigned char b)
  416. {
  417. vector unsigned char ret;
  418. __asm__ ("xsaddqp %0,%1,%2" : "=v" (ret) : "v" (a), "v" (b));
  419. return ret;
  420. }
  421. void *add_resolver (void) { return (void *) add; }
  422. __float128 add_ifunc (__float128, __float128)
  423. __attribute__ ((__ifunc__ ("add_resolver")));])],
  424. [libgcc_cv_powerpc_float128_hw=yes],
  425. [libgcc_cv_powerpc_float128_hw=no])])
  426. CFLAGS="$saved_CFLAGS"
  427. saved_CFLAGS="$CFLAGS"
  428. CFLAGS="$CFLAGS -mcpu=power10 -mfloat128-hardware"
  429. AC_CACHE_CHECK([for PowerPC ISA 3.1 to build hardware __float128 libraries],
  430. [libgcc_cv_powerpc_3_1_float128_hw],
  431. [AC_COMPILE_IFELSE(
  432. [AC_LANG_SOURCE([#include <sys/auxv.h>
  433. #ifndef AT_PLATFORM
  434. #error "AT_PLATFORM is not defined"
  435. #endif
  436. #ifndef __BUILTIN_CPU_SUPPORTS__
  437. #error "__builtin_cpu_supports is not available"
  438. #endif
  439. vector unsigned char conv (vector unsigned char qs)
  440. {
  441. vector unsigned char ret;
  442. __asm__ ("xscvsqqp %0,%1" : "=v" (ret) : "v" (qs));
  443. return ret;
  444. }
  445. void *conv_resolver (void) { return (void *) conv; }
  446. __float128 conv_ifunc (__float128)
  447. __attribute__ ((__ifunc__ ("conv_resolver")));])],
  448. [libgcc_cv_powerpc_3_1_float128_hw=yes],
  449. [libgcc_cv_powerpc_3_1_float128_hw=no])])
  450. CFLAGS="$saved_CFLAGS"
  451. esac
  452. # Collect host-machine-specific information.
  453. . ${srcdir}/config.host
  454. # Used for constructing correct paths for offload compilers.
  455. accel_dir_suffix=
  456. real_host_noncanonical=${host_noncanonical}
  457. if test x"$enable_as_accelerator_for" != x; then
  458. accel_dir_suffix=/accel/${target_noncanonical}
  459. real_host_noncanonical=${enable_as_accelerator_for}
  460. fi
  461. AC_SUBST(accel_dir_suffix)
  462. AC_SUBST(real_host_noncanonical)
  463. if test x"$enable_offload_targets" != x; then
  464. extra_parts="${extra_parts} crtoffloadbegin.o crtoffloadend.o crtoffloadtable.o"
  465. fi
  466. # Check if Solaris/x86 linker supports ZERO terminator unwind entries.
  467. # This is after config.host so we can augment tmake_file.
  468. # Link with -nostartfiles -nodefaultlibs since neither are present while
  469. # building libgcc.
  470. case ${host} in
  471. i?86-*-solaris2* | x86_64-*-solaris2*)
  472. cat > conftest.s <<EOF
  473. .section .eh_frame,"a",@unwind
  474. .zero 4
  475. .section .jcr,"aw",@progbits
  476. .zero 8
  477. EOF
  478. if AC_TRY_COMMAND(${CC-cc} -shared -nostartfiles -nodefaultlibs -o conftest.so conftest.s 1>&AS_MESSAGE_LOG_FD); then
  479. tmake_file="${tmake_file} i386/t-crtstuff"
  480. fi
  481. ;;
  482. esac
  483. # Check if Solaris linker support v2 linker mapfile syntax.
  484. # Link with -nostartfiles -nodefaultlibs since neither are present while
  485. # building libgcc.
  486. case ${host} in
  487. *-*-solaris2*)
  488. solaris_ld_v2_maps=no
  489. echo 'int main(void) {return 0;}' > conftest.c
  490. echo '$mapfile_version 2' > conftest.map
  491. if AC_TRY_COMMAND([${CC-cc} -nostartfiles -nodefaultlibs -Wl,-M,conftest.map -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD]); then
  492. solaris_ld_v2_maps=yes
  493. fi
  494. ;;
  495. esac
  496. AC_SUBST(solaris_ld_v2_maps)
  497. # Check if xtensa target is configured for windowed ABI and thus needs to use
  498. # custom unwind code.
  499. # This is after config.host so we can augment tmake_file.
  500. case ${host} in
  501. xtensa*-*)
  502. AC_COMPILE_IFELSE([AC_LANG_SOURCE(
  503. [#ifdef __XTENSA_CALL0_ABI__
  504. #error
  505. #endif
  506. ])],
  507. [tmake_file="${tmake_file} xtensa/t-windowed"])
  508. ;;
  509. esac
  510. # Check for visibility support. This is after config.host so that
  511. # we can check for asm_hidden_op.
  512. AC_CACHE_CHECK([for __attribute__((visibility("hidden")))],
  513. libgcc_cv_hidden_visibility_attribute, [
  514. echo 'int __attribute__ ((visibility ("hidden"))) foo (void) { return 1; }' > conftest.c
  515. libgcc_cv_hidden_visibility_attribute=no
  516. if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
  517. if grep "\\$asm_hidden_op.*foo" conftest.s >/dev/null; then
  518. libgcc_cv_hidden_visibility_attribute=yes
  519. fi
  520. fi
  521. rm -f conftest.*
  522. ])
  523. if test $libgcc_cv_hidden_visibility_attribute = yes; then
  524. vis_hide='-fvisibility=hidden -DHIDE_EXPORTS'
  525. AC_DEFINE_UNQUOTED(AS_HIDDEN_DIRECTIVE, $asm_hidden_op, [Define to the .hidden-like directive if it exists.])
  526. else
  527. vis_hide=
  528. fi
  529. AC_SUBST(vis_hide)
  530. # Check for .cfi_sections .debug_frame support.
  531. AC_CACHE_CHECK([for .cfi_sections .debug_frame],
  532. libgcc_cv_cfi_sections_directive, [
  533. echo 'int foo (int, char *);' > conftest.c
  534. echo 'int bar (int x) { char *y = __builtin_alloca (x); return foo (x + 1, y) + 1; }' >> conftest.c
  535. libgcc_cv_cfi_sections_directive=no
  536. if AC_TRY_COMMAND(${CC-cc} -Werror -g -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-exceptions -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
  537. if grep "\\.cfi_sections.*\\.debug_frame" conftest.s >/dev/null; then
  538. libgcc_cv_cfi_sections_directive=yes
  539. fi
  540. fi
  541. rm -f conftest.*
  542. ])
  543. if test $libgcc_cv_cfi_sections_directive = yes; then
  544. AC_DEFINE(HAVE_AS_CFI_SECTIONS, 1, [Define to 1 if the assembler supports .cfi_sections .debug_frame directive.])
  545. fi
  546. # See if we have thread-local storage. We can only test assembler
  547. # since link-time and run-time tests require the newly built
  548. # gcc, which can't be used to build executable due to that libgcc
  549. # is yet to be built here.
  550. GCC_CHECK_CC_TLS
  551. set_have_cc_tls=
  552. if test "$enable_tls $gcc_cv_have_cc_tls" = "yes yes"; then
  553. set_have_cc_tls="-DHAVE_CC_TLS"
  554. fi
  555. AC_SUBST(set_have_cc_tls)
  556. # See if we have emulated thread-local storage.
  557. GCC_CHECK_EMUTLS
  558. set_use_emutls=
  559. if test "$enable_tls $gcc_cv_use_emutls" = "yes yes"; then
  560. set_use_emutls="-DUSE_EMUTLS"
  561. fi
  562. AC_SUBST(set_use_emutls)
  563. dnl Check if as supports AVX instructions.
  564. AC_DEFUN([LIBGCC_CHECK_AS_AVX], [
  565. case "${target}" in
  566. i[[34567]]86-*-* | x86_64-*-*)
  567. AC_CACHE_CHECK([if the assembler supports AVX], libgcc_cv_as_avx, [
  568. AC_TRY_COMPILE([], [asm("vzeroupper");],
  569. [libgcc_cv_as_avx=yes], [libgcc_cv_as_avx=no])
  570. ])
  571. if test x$libgcc_cv_as_avx = xyes; then
  572. AC_DEFINE(HAVE_AS_AVX, 1, [Define to 1 if the assembler supports AVX.])
  573. fi
  574. ;;
  575. esac])
  576. LIBGCC_CHECK_AS_AVX
  577. dnl Check if as supports LSE instructions.
  578. AC_DEFUN([LIBGCC_CHECK_AS_LSE], [
  579. case "${target}" in
  580. aarch64*-*-*)
  581. AC_CACHE_CHECK([if the assembler supports LSE], libgcc_cv_as_lse, [
  582. AC_TRY_COMPILE([],
  583. changequote(,)dnl
  584. asm(".arch armv8-a+lse\n\tcas w0, w1, [x2]");
  585. changequote([,])dnl
  586. ,
  587. [libgcc_cv_as_lse=yes], [libgcc_cv_as_lse=no])
  588. ])
  589. if test x$libgcc_cv_as_lse = xyes; then
  590. AC_DEFINE(HAVE_AS_LSE, 1, [Define to 1 if the assembler supports LSE.])
  591. fi
  592. ;;
  593. esac])
  594. LIBGCC_CHECK_AS_LSE
  595. dnl Check if as supports RTM instructions.
  596. AC_CACHE_CHECK(for init priority support, libgcc_cv_init_priority, [
  597. AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,
  598. [[void ip (void) __attribute__ ((constructor (1)));]])],
  599. [libgcc_cv_init_priority=yes],[libgcc_cv_init_priority=no])])
  600. if test $libgcc_cv_init_priority = yes; then
  601. AC_DEFINE(HAVE_INIT_PRIORITY, 1,
  602. [Define if the compiler supports init priority.])
  603. fi
  604. # Conditionalize the sfp-machine.h header for this target machine.
  605. if test -z "${sfp_machine_header}"; then
  606. sfp_machine_header=$cpu_type/sfp-machine.h
  607. if test -f ${srcdir}/config/${sfp_machine_header}; then
  608. :
  609. else
  610. sfp_machine_header=no-sfp-machine.h
  611. fi
  612. fi
  613. AC_SUBST(sfp_machine_header)
  614. # Conditionalize the makefile for this target machine.
  615. tmake_file_=
  616. for f in ${tmake_file}
  617. do
  618. if test -f ${srcdir}/config/$f
  619. then
  620. tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
  621. fi
  622. done
  623. tmake_file="${tmake_file_}"
  624. AC_SUBST(tmake_file)
  625. # Likewise export definitions for libgcc_tm.h
  626. tm_file_=
  627. for f in ${tm_file}
  628. do
  629. tm_file_="${tm_file_} \$(srcdir)/config/$f"
  630. done
  631. tm_file="${tm_file_}"
  632. AC_SUBST(tm_file)
  633. AC_SUBST(tm_defines)
  634. # Map from thread model to thread header.
  635. GCC_AC_THREAD_HEADER([$target_thread_file])
  636. # Determine what GCC version number to use in filesystem paths.
  637. GCC_BASE_VER
  638. # Substitute configuration variables
  639. AC_SUBST(cpu_type)
  640. AC_SUBST(extra_parts)
  641. AC_SUBST(asm_hidden_op)
  642. AC_SUBST(enable_execute_stack)
  643. AC_SUBST(unwind_header)
  644. AC_SUBST(md_unwind_header)
  645. AC_SUBST(sfp_machine_header)
  646. AC_SUBST(thread_header)
  647. # We need multilib support.
  648. AC_CONFIG_FILES([Makefile])
  649. AC_CONFIG_COMMANDS([default],
  650. [[test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
  651. if test -n "$CONFIG_FILES"; then
  652. # FIXME: We shouldn't need to set ac_file
  653. ac_file=Makefile
  654. . ${libgcc_topdir}/config-ml.in
  655. fi]],
  656. [[srcdir=${srcdir}
  657. host=${host}
  658. with_target_subdir=${with_target_subdir}
  659. with_multisubdir=${with_multisubdir}
  660. ac_configure_args="--enable-multilib ${ac_configure_args}"
  661. CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
  662. libgcc_topdir=${libgcc_topdir}
  663. CC="${CC}"
  664. ]])
  665. AC_OUTPUT