configure.ac 70 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236
  1. dnl Process this file with autoconf to produce a configure script.
  2. dnl Note we do not use AC_PREREQ here! See aclocal.m4 for what we use instead.
  3. AC_INIT([GNU C Library], [(see version.h)], [https://sourceware.org/bugzilla/],
  4. [glibc], [https://www.gnu.org/software/glibc/])
  5. AC_CONFIG_SRCDIR([include/features.h])
  6. AC_CONFIG_HEADERS([config.h])
  7. AC_CONFIG_AUX_DIR([scripts])
  8. ACX_PKGVERSION([GNU libc])
  9. ACX_BUGURL([https://www.gnu.org/software/libc/bugs.html])
  10. AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"],
  11. [Package description])
  12. AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"],
  13. [Bug reporting address])
  14. # Glibc should not depend on any header files
  15. AC_DEFUN([_AC_INCLUDES_DEFAULT_REQUIREMENTS],
  16. [m4_divert_text([DEFAULTS],
  17. [ac_includes_default='/* none */'])])
  18. # We require GCC, and by default use its preprocessor. Override AC_PROG_CPP
  19. # here to work around the Autoconf issue discussed in
  20. # <https://sourceware.org/ml/libc-alpha/2013-01/msg00721.html>.
  21. AC_DEFUN([AC_PROG_CPP],
  22. [AC_REQUIRE([AC_PROG_CC])dnl
  23. AC_ARG_VAR([CPP], [C preprocessor])dnl
  24. _AC_ARG_VAR_CPPFLAGS()dnl
  25. # On Suns, sometimes $CPP names a directory.
  26. if test -n "$CPP" && test -d "$CPP"; then
  27. CPP=
  28. fi
  29. if test -z "$CPP"; then
  30. CPP="$CC -E"
  31. fi
  32. AC_SUBST(CPP)dnl
  33. ])# AC_PROG_CPP
  34. # We require GCC. Override _AC_PROG_CC_C89 here to work around the Autoconf
  35. # issue discussed in
  36. # <https://sourceware.org/ml/libc-alpha/2013-01/msg00757.html>.
  37. AC_DEFUN([_AC_PROG_CC_C89], [[$1]])
  38. dnl This is here so we can set $subdirs directly based on configure fragments.
  39. AC_CONFIG_SUBDIRS()
  40. AC_CANONICAL_HOST
  41. AC_PROG_CC
  42. AC_ARG_VAR([TEST_CC],
  43. [C compiler for testing])
  44. if test -z "$TEST_CC"; then
  45. TEST_CC="$CC"
  46. fi
  47. if test $host != $build; then
  48. AC_CHECK_PROGS(BUILD_CC, gcc cc)
  49. fi
  50. AC_SUBST(cross_compiling)
  51. AC_PROG_CPP
  52. # This will get text that should go into config.make.
  53. config_vars=
  54. AC_ARG_ENABLE([static-c++-tests],
  55. AS_HELP_STRING([--disable-static-c++-tests],
  56. [disable static C++ tests@<:@default=no@:>@]),
  57. [static_cxx_tests=$enableval],
  58. [static_cxx_tests=yes])
  59. LIBC_CONFIG_VAR([static-cxx-tests], [$static_cxx_tests])
  60. AC_ARG_ENABLE([static-c++-link-check],
  61. AS_HELP_STRING([--disable-static-c++-link-check],
  62. [disable static C++ link check @<:@default=no@:>@]),
  63. [static_cxx_link_check=$enableval],
  64. [static_cxx_link_check=yes])
  65. # We need the C++ compiler for testing and libsupport.
  66. AC_PROG_CXX
  67. AC_ARG_VAR([TEST_CXX],
  68. [C++ compiler for testing])
  69. saved_CXX="$CXX"
  70. if test -z "$TEST_CXX"; then
  71. TEST_CXX="$CXX"
  72. else
  73. CXX="$TEST_CXX"
  74. fi
  75. # It's useless to us if it can't link programs (e.g. missing -lstdc++).
  76. AC_CACHE_CHECK([whether $CXX can link programs], libc_cv_cxx_link_ok, [dnl
  77. AC_LANG_PUSH([C++])
  78. # Default, dynamic case.
  79. AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
  80. [libc_cv_cxx_link_ok=yes],
  81. [libc_cv_cxx_link_ok=no])
  82. if test $static_cxx_link_check$static_cxx_tests = yesyes; then
  83. # Static case.
  84. old_LDFLAGS="$LDFLAGS"
  85. LDFLAGS="$LDFLAGS -static"
  86. AC_LINK_IFELSE([AC_LANG_SOURCE([
  87. #include <iostream>
  88. int
  89. main()
  90. {
  91. std::cout << "Hello, world!";
  92. return 0;
  93. }
  94. ])],
  95. [],
  96. [libc_cv_cxx_link_ok=no])
  97. LDFLAGS="$old_LDFLAGS"
  98. fi
  99. AC_LANG_POP([C++])])
  100. CXX="$saved_CXX"
  101. AS_IF([test $libc_cv_cxx_link_ok != yes], [CXX=; TEST_CXX=])
  102. if test "`cd $srcdir; pwd -P`" = "`pwd -P`"; then
  103. AC_MSG_ERROR([you must configure in a separate build directory])
  104. fi
  105. # Check for a --with-gd argument and set libgd-LDFLAGS in config.make.
  106. AC_ARG_WITH([gd],
  107. AS_HELP_STRING([--with-gd=DIR],
  108. [find libgd include dir and library with prefix DIR]),
  109. [dnl
  110. case "$with_gd" in
  111. yes|''|no) ;;
  112. *) libgd_include="-I$withval/include"
  113. libgd_ldflags="-L$withval/lib" ;;
  114. esac
  115. ])
  116. AC_ARG_WITH([gd-include],
  117. AS_HELP_STRING([--with-gd-include=DIR],
  118. [find libgd include files in DIR]),
  119. [dnl
  120. case "$with_gd_include" in
  121. ''|no) ;;
  122. *) libgd_include="-I$withval" ;;
  123. esac
  124. ])
  125. AC_ARG_WITH([gd-lib],
  126. AS_HELP_STRING([--with-gd-lib=DIR],
  127. [find libgd library files in DIR]),
  128. [dnl
  129. case "$with_gd_lib" in
  130. ''|no) ;;
  131. *) libgd_ldflags="-L$withval" ;;
  132. esac
  133. ])
  134. if test -n "$libgd_include"; then
  135. config_vars="$config_vars
  136. CFLAGS-memusagestat.c = $libgd_include"
  137. fi
  138. if test -n "$libgd_ldflags"; then
  139. config_vars="$config_vars
  140. libgd-LDFLAGS = $libgd_ldflags"
  141. fi
  142. dnl Arguments to specify presence of other packages/features.
  143. AC_ARG_WITH([binutils],
  144. AS_HELP_STRING([--with-binutils=PATH],
  145. [specify location of binutils (as and ld)]),
  146. [path_binutils=$withval],
  147. [path_binutils=''])
  148. AC_ARG_WITH([selinux],
  149. AS_HELP_STRING([--with-selinux],
  150. [if building with SELinux support]),
  151. [with_selinux=$withval],
  152. [with_selinux=auto])
  153. AC_ARG_WITH([headers],
  154. AS_HELP_STRING([--with-headers=PATH],
  155. [location of system headers to use
  156. (for example /usr/src/linux/include)
  157. @<:@default=compiler default@:>@]),
  158. [sysheaders=$withval],
  159. [sysheaders=''])
  160. AC_SUBST(sysheaders)
  161. dnl Additional build flags injection.
  162. AC_ARG_WITH([nonshared-cflags],
  163. AS_HELP_STRING([--with-nonshared-cflags=CFLAGS],
  164. [build nonshared libraries with additional CFLAGS]),
  165. [extra_nonshared_cflags=$withval],
  166. [extra_nonshared_cflags=])
  167. AC_SUBST(extra_nonshared_cflags)
  168. AC_ARG_WITH([rtld-early-cflags],
  169. AS_HELP_STRING([--with-rtld-early-cflags=CFLAGS],
  170. [build early initialization with additional CFLAGS]),
  171. [rtld_early_cflags=$withval],
  172. [rtld_early_cflags=])
  173. AC_SUBST(rtld_early_cflags)
  174. AC_ARG_WITH([timeoutfactor],
  175. AS_HELP_STRING([--with-timeoutfactor=NUM],
  176. [specify an integer to scale the timeout]),
  177. [timeoutfactor=$withval],
  178. [timeoutfactor=1])
  179. AC_DEFINE_UNQUOTED(TIMEOUTFACTOR, $timeoutfactor)
  180. man_pages_version=6.9.1
  181. AC_ARG_WITH([man-pages],
  182. AS_HELP_STRING([--with-man-pages=VERSION],
  183. [tie manual to a specific man-pages version]),
  184. [man_pages_version=$withval],
  185. [])
  186. AC_SUBST(man_pages_version)
  187. AC_ARG_ENABLE([sanity-checks],
  188. AS_HELP_STRING([--disable-sanity-checks],
  189. [really do not use threads (should not be used except in special situations) @<:@default=yes@:>@]),
  190. [enable_sanity=$enableval],
  191. [enable_sanity=yes])
  192. AC_ARG_ENABLE([shared],
  193. AS_HELP_STRING([--enable-shared],
  194. [build shared library @<:@default=yes if GNU ld@:>@]),
  195. [shared=$enableval],
  196. [shared=yes])
  197. AC_ARG_ENABLE([profile],
  198. AS_HELP_STRING([--enable-profile],
  199. [build profiled library @<:@default=no@:>@]),
  200. [profile=$enableval],
  201. [profile=no])
  202. AC_ARG_ENABLE([default-pie],
  203. AS_HELP_STRING([--disable-default-pie],
  204. [Do not build glibc programs and the testsuite as PIE @<:@default=no@:>@]),
  205. [default_pie=$enableval],
  206. [default_pie=yes])
  207. AC_ARG_ENABLE([timezone-tools],
  208. AS_HELP_STRING([--disable-timezone-tools],
  209. [do not install timezone tools @<:@default=install@:>@]),
  210. [enable_timezone_tools=$enableval],
  211. [enable_timezone_tools=yes])
  212. AC_SUBST(enable_timezone_tools)
  213. AC_ARG_ENABLE([hardcoded-path-in-tests],
  214. AS_HELP_STRING([--enable-hardcoded-path-in-tests],
  215. [hardcode newly built glibc path in tests @<:@default=no@:>@]),
  216. [hardcoded_path_in_tests=$enableval],
  217. [hardcoded_path_in_tests=no])
  218. AC_SUBST(hardcoded_path_in_tests)
  219. AC_ARG_ENABLE([hidden-plt],
  220. AS_HELP_STRING([--disable-hidden-plt],
  221. [do not hide internal function calls to avoid PLT]),
  222. [hidden=$enableval],
  223. [hidden=yes])
  224. if test "x$hidden" = xno; then
  225. AC_DEFINE(NO_HIDDEN)
  226. fi
  227. AC_ARG_ENABLE([bind-now],
  228. AS_HELP_STRING([--enable-bind-now],
  229. [disable lazy relocations in DSOs]),
  230. [bindnow=$enableval],
  231. [bindnow=no])
  232. AC_SUBST(bindnow)
  233. if test "x$bindnow" = xyes; then
  234. AC_DEFINE(BIND_NOW)
  235. fi
  236. dnl Build glibc with -fstack-protector, -fstack-protector-all, or
  237. dnl -fstack-protector-strong.
  238. AC_ARG_ENABLE([stack-protector],
  239. AS_HELP_STRING([--enable-stack-protector=@<:@yes|no|all|strong@:>@],
  240. [Use -fstack-protector[-all|-strong] to detect glibc buffer overflows]),
  241. [enable_stack_protector=$enableval],
  242. [enable_stack_protector=no])
  243. case "$enable_stack_protector" in
  244. all|yes|no|strong) ;;
  245. *) AC_MSG_ERROR([Not a valid argument for --enable-stack-protector: "$enable_stack_protector"]);;
  246. esac
  247. dnl On some platforms we cannot use dynamic loading. We must provide
  248. dnl static NSS modules.
  249. AC_ARG_ENABLE([static-nss],
  250. AS_HELP_STRING([--enable-static-nss],
  251. [build static NSS modules @<:@default=no@:>@]),
  252. [static_nss=$enableval],
  253. [static_nss=no])
  254. dnl Enable static NSS also if we build no shared objects.
  255. if test x"$static_nss" = xyes || test x"$shared" = xno; then
  256. static_nss=yes
  257. AC_DEFINE(DO_STATIC_NSS)
  258. fi
  259. AC_ARG_ENABLE([force-install],
  260. AS_HELP_STRING([--disable-force-install],
  261. [don't force installation of files from this package, even if they are older than the installed files]),
  262. [force_install=$enableval],
  263. [force_install=yes])
  264. AC_SUBST(force_install)
  265. AC_ARG_ENABLE([maintainer-mode],
  266. AS_HELP_STRING([--enable-maintainer-mode],
  267. [enable make rules and dependencies not useful (and sometimes confusing) to the casual installer]),
  268. [maintainer=$enableval],
  269. [maintainer=no])
  270. dnl On some platforms we allow dropping compatibility with all kernel
  271. dnl versions.
  272. AC_ARG_ENABLE([kernel],
  273. AS_HELP_STRING([--enable-kernel=VERSION],
  274. [compile for compatibility with kernel not older than VERSION]),
  275. [minimum_kernel=$enableval],
  276. [])
  277. dnl Prevent unreasonable values.
  278. if test "$minimum_kernel" = yes || test "$minimum_kernel" = no; then
  279. # Better nothing than this.
  280. minimum_kernel=""
  281. else
  282. if test "$minimum_kernel" = current; then
  283. minimum_kernel=`uname -r 2>/dev/null` || minimum_kernel=
  284. fi
  285. fi
  286. AC_ARG_ENABLE([werror],
  287. AS_HELP_STRING([--disable-werror],
  288. [do not build with -Werror]),
  289. [enable_werror=$enableval],
  290. [enable_werror=yes])
  291. AC_SUBST(enable_werror)
  292. AC_ARG_ENABLE([multi-arch],
  293. AS_HELP_STRING([--enable-multi-arch],
  294. [enable single DSO with optimizations for multiple architectures]),
  295. [multi_arch=$enableval],
  296. [multi_arch=default])
  297. AC_ARG_ENABLE([memory-tagging],
  298. AS_HELP_STRING([--enable-memory-tagging],
  299. [enable memory tagging if supported by the architecture @<:@default=no@:>@]),
  300. [memory_tagging=$enableval],
  301. [memory_tagging=no])
  302. if test "$memory_tagging" = yes; then
  303. # Only enable this on architectures that support it.
  304. case $host_cpu in
  305. aarch64)
  306. AC_DEFINE(USE_MTAG)
  307. ;;
  308. esac
  309. fi
  310. AC_SUBST(memory_tagging)
  311. AC_ARG_ENABLE([systemtap],
  312. [AS_HELP_STRING([--enable-systemtap],
  313. [enable systemtap static probe points @<:@default=no@:>@])],
  314. [systemtap=$enableval],
  315. [systemtap=no])
  316. if test "x$systemtap" != xno; then
  317. AC_CACHE_CHECK([for systemtap static probe support], libc_cv_sdt, [dnl
  318. old_CFLAGS="$CFLAGS"
  319. CFLAGS="-std=gnu11 $CFLAGS"
  320. AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <sys/sdt.h>
  321. void foo (int i, void *p)
  322. {
  323. asm ("" STAP_PROBE_ASM (foo, bar, STAP_PROBE_ASM_TEMPLATE (2)) ""
  324. :: STAP_PROBE_ASM_OPERANDS (2, i, p));
  325. }]])], [libc_cv_sdt=yes], [libc_cv_sdt=no])
  326. CFLAGS="$old_CFLAGS"])
  327. if test $libc_cv_sdt = yes; then
  328. AC_DEFINE([USE_STAP_PROBE])
  329. elif test "x$systemtap" != xauto; then
  330. AC_MSG_FAILURE([systemtap support needs sys/sdt.h with asm support])
  331. fi
  332. fi
  333. AC_ARG_ENABLE([build-nscd],
  334. [AS_HELP_STRING([--disable-build-nscd],
  335. [disable building and installing the nscd daemon])],
  336. [build_nscd=$enableval],
  337. [build_nscd=default])
  338. AC_SUBST(build_nscd)
  339. # Note the use of $use_nscd is near the bottom of the file.
  340. AC_ARG_ENABLE([nscd],
  341. [AS_HELP_STRING([--disable-nscd],
  342. [library functions will not contact the nscd daemon])],
  343. [use_nscd=$enableval],
  344. [use_nscd=yes])
  345. AC_ARG_ENABLE([pt_chown],
  346. [AS_HELP_STRING([--enable-pt_chown],
  347. [Enable building and installing pt_chown])],
  348. [build_pt_chown=$enableval],
  349. [build_pt_chown=no])
  350. AC_SUBST(build_pt_chown)
  351. if test "$build_pt_chown" = yes; then
  352. AC_DEFINE(HAVE_PT_CHOWN)
  353. fi
  354. # The abi-tags file uses a fairly simplistic model for name recognition that
  355. # can't distinguish i486-pc-linux-gnu fully from i486-pc-gnu. So we mutate a
  356. # $host_os of `gnu*' here to be `gnu-gnu*' just so that it can tell.
  357. # This doesn't get used much beyond that, so it's fairly safe.
  358. case "$host_os" in
  359. linux*)
  360. ;;
  361. gnu*)
  362. host_os=`echo $host_os | sed -e 's/gnu/gnu-gnu/'`
  363. ;;
  364. esac
  365. AC_ARG_ENABLE([mathvec],
  366. [AS_HELP_STRING([--enable-mathvec],
  367. [Enable building and installing mathvec @<:@default depends on architecture@:>@])],
  368. [build_mathvec=$enableval],
  369. [build_mathvec=notset])
  370. AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[]], [[
  371. #ifndef __CET__
  372. # error no CET compiler support
  373. #endif]])],
  374. [libc_cv_compiler_default_cet=yes],
  375. [libc_cv_compiler_default_cet=no])
  376. AC_ARG_ENABLE([cet],
  377. AS_HELP_STRING([--enable-cet],
  378. [enable Intel Control-flow Enforcement Technology (CET), x86 only]),
  379. [enable_cet=$enableval],
  380. [enable_cet=$libc_cv_compiler_default_cet])
  381. AC_ARG_ENABLE([scv],
  382. AS_HELP_STRING([--disable-scv],
  383. [syscalls will not use scv instruction, even if the kernel supports it, powerpc only]),
  384. [use_scv=$enableval],
  385. [use_scv=yes])
  386. AS_IF([[test "$use_scv" != "no"]],[AC_DEFINE(USE_PPC_SCV)])
  387. dnl Build glibc with _FORTIFY_SOURCE
  388. AC_ARG_ENABLE(fortify-source,
  389. AS_HELP_STRING([--enable-fortify-source@<:@=1|2|3@:>@],
  390. [Use -D_FORTIFY_SOURCE=[1|2|3] to control code hardening, defaults to highest possible value supported by the build compiler.]),
  391. [enable_fortify_source=$enableval],
  392. [enable_fortify_source=no])
  393. case "$enable_fortify_source" in
  394. 1|2|3|no|yes) ;;
  395. *) AC_MSG_ERROR([Not a valid argument for --enable-fortify-source: "$enable_fortify_source"]);;
  396. esac
  397. AC_ARG_ENABLE([sframe],
  398. [AS_HELP_STRING([--enable-sframe],
  399. [Enable building with SFrame support @<:@default=no@:>@])],
  400. [use_sframe=$enableval],
  401. [use_sframe=no])
  402. # We keep the original values in `$config_*' and never modify them, so we
  403. # can write them unchanged into config.make. Everything else uses
  404. # $machine, $vendor, and $os, and changes them whenever convenient.
  405. config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
  406. # Don't allow vendor == "unknown"
  407. test "$config_vendor" = unknown && config_vendor=
  408. config_os="`echo $config_os | sed 's/^unknown-//'`"
  409. # Some configurations imply other options.
  410. elf=yes
  411. # The configure fragment of a port can modify these to supplement
  412. # or override the table in the case statement below. No fragment should
  413. # ever change the config_* variables, however.
  414. machine=$config_machine
  415. vendor=$config_vendor
  416. os=$config_os
  417. base_os=''
  418. submachine=
  419. AC_ARG_WITH([cpu],
  420. AS_HELP_STRING([--with-cpu=CPU], [select code for CPU variant]),
  421. [dnl
  422. case "$withval" in
  423. yes|'') AC_MSG_ERROR([--with-cpu requires an argument]) ;;
  424. no) ;;
  425. *) submachine="$withval" ;;
  426. esac
  427. ])
  428. # An preconfigure script can set this when it wants to disable the sanity
  429. # check below.
  430. libc_config_ok=no
  431. # A preconfigure script for a system that may or may not use fpu
  432. # sysdeps directories sets this to a preprocessor conditional for
  433. # whether to use such directories.
  434. with_fp_cond=1
  435. # A preconfigure script may define another name to TLS descriptor variant
  436. mtls_descriptor=gnu2
  437. # A preconfigure script may define another name to traditional TLS variant
  438. mtls_traditional=gnu
  439. dnl Let sysdeps/*/preconfigure act here.
  440. LIBC_PRECONFIGURE([$srcdir], [for sysdeps])
  441. ###
  442. ### By using the undocumented --enable-hacker-mode option for configure
  443. ### one can skip this test to make the configuration not fail for unsupported
  444. ### platforms.
  445. ###
  446. if test -z "$enable_hacker_mode" && test x"$libc_config_ok" != xyes; then
  447. case "$machine-$host_os" in
  448. *-linux* | *-gnu*)
  449. ;;
  450. *)
  451. AC_MSG_ERROR([
  452. *** The GNU C library is currently unavailable for this platform.
  453. *** If you are interested in seeing glibc on this platform visit
  454. *** the "How to submit a new port" in the wiki:
  455. *** https://sourceware.org/glibc/wiki/#Development
  456. *** and join the community!])
  457. ;;
  458. esac
  459. fi
  460. # Set base_machine if not set by a preconfigure fragment.
  461. test -n "$base_machine" || base_machine=$machine
  462. AC_SUBST(base_machine)
  463. ### Locate tools.
  464. AC_PROG_INSTALL
  465. if test "$INSTALL" = "${srcdir}/scripts/install-sh -c"; then
  466. # The makefiles need to use a different form to find it in $srcdir.
  467. INSTALL='\$(..)./scripts/install-sh -c'
  468. fi
  469. AC_PROG_LN_S
  470. LIBC_PROG_BINUTILS
  471. # Accept binutils 2.39 or newer.
  472. libc_cv_with_lld=no
  473. case $($LD --version) in
  474. "GNU gold"*)
  475. # Accept gold 1.14 or higher
  476. AC_CHECK_PROG_VER(LD, $LD, --version,
  477. [GNU gold.* \([0-9][0-9]*\.[0-9.]*\)],
  478. [1.1[4-9]*|1.[2-9][0-9]*|1.1[0-9][0-9]*|[2-9].*|[1-9][0-9]*],
  479. LD=: critic_missing="$critic_missing GNU gold")
  480. ;;
  481. "LLD"*)
  482. # Accept LLD 13.0.0 or higher
  483. AC_CHECK_PROG_VER(LD, $LD, --version,
  484. [LLD.* \([0-9][0-9]*\.[0-9.]*\)],
  485. [1[3-9].*|[2-9][0-9].*],
  486. LD=: critic_missing="$critic_missing LLD")
  487. libc_cv_with_lld=yes
  488. ;;
  489. *)
  490. AC_CHECK_PROG_VER(LD, $LD, --version,
  491. [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
  492. [2.[1-9][0-9][0-9]*|2.39*|2.[4-9][0-9]*|[3-9].*|[1-9][0-9]*],
  493. LD=: critic_missing="$critic_missing GNU ld")
  494. ;;
  495. esac
  496. LIBC_CONFIG_VAR([with-lld], [$libc_cv_with_lld])
  497. # These programs are version sensitive.
  498. AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
  499. [GNU Make[^0-9]*\([0-9][0-9.]*\)],
  500. [[4-9].* | [1-9][0-9]*], critic_missing="$critic_missing make")
  501. AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
  502. [GNU gettext.* \([0-9]*\.[0-9.]*\)],
  503. [0.10.3[6-9]* | 0.10.[4-9][0-9]* | 0.1[1-9]* | 0.[2-9][0-9]* | [1-9].*],
  504. MSGFMT=: aux_missing="$aux_missing msgfmt")
  505. AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
  506. [GNU texinfo.* \([0-9][0-9.]*\)],
  507. [4.[7-9]*|4.[1-9][0-9]*|[5-9].*],
  508. MAKEINFO=: aux_missing="$aux_missing makeinfo")
  509. AC_CHECK_PROG_VER(SED, sed, --version,
  510. [GNU sed[^0-9]* \([0-9]*\.[0-9.]*\)],
  511. [3.0[2-9]*|3.[1-9]*|[4-9]*],
  512. SED=: aux_missing="$aux_missing sed")
  513. AC_CHECK_PROG_VER(AWK, gawk, --version,
  514. [GNU Awk[^0-9]*\([0-9][0-9.]*\)],
  515. [3.1.[2-9]*|3.[2-9]*|[4-9]*], critic_missing="$critic_missing gawk")
  516. AC_CHECK_PROG_VER(BISON, bison, --version,
  517. [bison (GNU Bison) \([0-9]*\.[0-9.]*\)],
  518. [2.7*|[3-9].*|[1-9][0-9]*], critic_missing="$critic_missing bison")
  519. # Require GCC 12.1 to build.
  520. AC_CACHE_CHECK([if $CC is sufficient to build libc], libc_cv_compiler_ok, [
  521. AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[]], [[
  522. #if (!defined __GNUC__ || __GNUC__ < 12 || (__GNUC__ == 12 && __GNUC_MINOR__ < 1)) && (!defined __clang__ || __clang_major__ < 18)
  523. #error insufficient compiler
  524. #endif]])],
  525. [libc_cv_compiler_ok=yes],
  526. [libc_cv_compiler_ok=no])])
  527. AS_IF([test $libc_cv_compiler_ok != yes],
  528. [critic_missing="$critic_missing compiler"])
  529. if test "x$maintainer" = "xyes"; then
  530. AC_CHECK_PROGS(AUTOCONF, autoconf, no)
  531. case "x$AUTOCONF" in
  532. xno|x|x:) AUTOCONF=no ;;
  533. *)
  534. AC_CACHE_CHECK(dnl
  535. whether $AUTOCONF${ACFLAGS:+ }$ACFLAGS works, libc_cv_autoconf_works, [dnl
  536. if (cd $srcdir; $AUTOCONF $ACFLAGS configure.ac > /dev/null 2>&1); then
  537. libc_cv_autoconf_works=yes
  538. else
  539. libc_cv_autoconf_works=no
  540. fi])
  541. test $libc_cv_autoconf_works = yes || AUTOCONF=no
  542. ;;
  543. esac
  544. if test "x$AUTOCONF" = xno; then
  545. aux_missing="$aux_missing autoconf"
  546. fi
  547. else
  548. AUTOCONF=no
  549. fi
  550. # Check for python3 if available, or else python.
  551. AC_CHECK_PROG_VER(PYTHON_PROG, python3 python, --version,
  552. [Python \([0-9][0-9.]*\)],
  553. [3.[4-9]*|3.[1-9][0-9]*|[4-9].*|[1-9][0-9]*],
  554. critic_missing="$critic_missing python")
  555. PYTHON="$PYTHON_PROG -B"
  556. AC_SUBST(PYTHON)
  557. test -n "$critic_missing" && AC_MSG_ERROR([
  558. *** These critical programs are missing or too old:$critic_missing
  559. *** Check the INSTALL file for required versions.])
  560. test -n "$aux_missing" && AC_MSG_WARN([
  561. *** These auxiliary programs are missing or incompatible versions:$aux_missing
  562. *** some features or tests will be disabled.
  563. *** Check the INSTALL file for required versions.])
  564. # Determine whether to use fpu or nofpu sysdeps directories.
  565. AC_CACHE_CHECK([for use of fpu sysdeps directories],
  566. libc_cv_with_fp, [dnl
  567. cat > conftest.c <<EOF
  568. #if $with_fp_cond
  569. int dummy;
  570. #else
  571. # error "no hardware floating point"
  572. #endif
  573. EOF
  574. libc_cv_with_fp=no
  575. if ${CC-cc} $CFLAGS $CPPFLAGS -S conftest.c -o conftest.s \
  576. 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
  577. libc_cv_with_fp=yes
  578. fi
  579. rm -f conftest*])
  580. AC_SUBST(libc_cv_with_fp)
  581. conftest_code="
  582. #ifndef __clang__
  583. #error Not Clang!
  584. #endif
  585. "
  586. dnl Check if clang is used to test glibc.
  587. LIBC_TRY_TEST_CC_COMMAND([for clang],
  588. [$conftest_code],
  589. [-c],
  590. libc_cv_test_clang,
  591. [libc_cv_test_clang=yes], [libc_cv_test_clang=no],
  592. )
  593. LIBC_CONFIG_VAR([have-test-clang], [$libc_cv_test_clang])
  594. dnl Check if clang++ is used to test glibc.
  595. LIBC_TRY_TEST_CXX_COMMAND([for clang++],
  596. [$conftest_code],
  597. [-c],
  598. libc_cv_test_clangxx,
  599. [libc_cv_test_clangxx=yes], [libc_cv_test_clangxx=no],
  600. )
  601. LIBC_CONFIG_VAR([have-test-clangxx], [$libc_cv_test_clangxx])
  602. if test "$libc_cv_test_clang" = "yes"; then
  603. conftest_code="
  604. #if __clang_major__ > 19
  605. #error clang version > 19
  606. #endif
  607. "
  608. LIBC_TRY_TEST_CC_COMMAND([for clang],
  609. [$conftest_code],
  610. [-c],
  611. libc_cv_test_clang_19_or_less,
  612. [libc_cv_test_clang_19_or_less=yes], [libc_cv_test_clang_19_or_less=no],
  613. )
  614. fi
  615. LIBC_CONFIG_VAR([have-test-clang-19-or-less], [$libc_cv_test_clang_19_or_less])
  616. LIBC_TRY_CC_AND_TEST_CC_OPTION([for -fstack-protector],
  617. [-Werror -fstack-protector],
  618. libc_cv_ssp,
  619. [libc_cv_ssp=yes],
  620. [libc_cv_ssp=no],
  621. libc_cv_test_ssp,
  622. [libc_cv_test_ssp=yes],
  623. [libc_cv_test_ssp=no])
  624. AC_CACHE_CHECK(for -fstack-protector-strong, libc_cv_ssp_strong, [dnl
  625. LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector-strong],
  626. [libc_cv_ssp_strong=yes],
  627. [libc_cv_ssp_strong=no])
  628. ])
  629. AC_CACHE_CHECK(for -fstack-protector-all, libc_cv_ssp_all, [dnl
  630. LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector-all],
  631. [libc_cv_ssp_all=yes],
  632. [libc_cv_ssp_all=no])
  633. ])
  634. stack_protector=
  635. no_stack_protector=
  636. if test "$libc_cv_ssp" = yes; then
  637. no_stack_protector="-fno-stack-protector -DSTACK_PROTECTOR_LEVEL=0"
  638. AC_DEFINE(HAVE_CC_NO_STACK_PROTECTOR)
  639. fi
  640. if test "$libc_cv_test_ssp" = yes; then
  641. AC_DEFINE(HAVE_TEST_CC_NO_STACK_PROTECTOR)
  642. fi
  643. if test "$enable_stack_protector" = yes && test "$libc_cv_ssp" = yes; then
  644. stack_protector="-fstack-protector"
  645. AC_DEFINE(STACK_PROTECTOR_LEVEL, 1)
  646. elif test "$enable_stack_protector" = all && test "$libc_cv_ssp_all" = yes; then
  647. stack_protector="-fstack-protector-all"
  648. AC_DEFINE(STACK_PROTECTOR_LEVEL, 2)
  649. elif test "$enable_stack_protector" = strong && test "$libc_cv_ssp_strong" = yes; then
  650. stack_protector="-fstack-protector-strong"
  651. AC_DEFINE(STACK_PROTECTOR_LEVEL, 3)
  652. else
  653. stack_protector="-fno-stack-protector"
  654. AC_DEFINE(STACK_PROTECTOR_LEVEL, 0)
  655. fi
  656. AC_SUBST(libc_cv_ssp)
  657. AC_SUBST(stack_protector)
  658. AC_SUBST(no_stack_protector)
  659. if test -n "$stack_protector"; then
  660. dnl Don't run configure tests with stack-protection on, to avoid problems with
  661. dnl bootstrapping.
  662. no_ssp=-fno-stack-protector
  663. else
  664. no_ssp=
  665. if test "$enable_stack_protector" != no; then
  666. AC_MSG_ERROR([--enable-stack-protector=$enable_stack_protector specified, but specified level of stack protection is not supported by the compiler.])
  667. fi
  668. fi
  669. # For the multi-arch option we need support in the assembler & linker.
  670. AC_CACHE_CHECK([for assembler and linker STT_GNU_IFUNC support],
  671. libc_cv_ld_gnu_indirect_function, [dnl
  672. cat > conftest.S <<EOF
  673. .type foo,%gnu_indirect_function
  674. foo:
  675. .globl _start
  676. _start:
  677. .globl __start
  678. __start:
  679. .data
  680. #ifdef _LP64
  681. .quad foo
  682. #else
  683. .long foo
  684. #endif
  685. EOF
  686. libc_cv_ld_gnu_indirect_function=no
  687. if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
  688. -nostartfiles -nostdlib $no_ssp \
  689. -o conftest conftest.S 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
  690. # Do a link to see if the backend supports IFUNC relocs.
  691. $READELF -r conftest 1>&AS_MESSAGE_LOG_FD
  692. LC_ALL=C $READELF -Wr conftest | grep -q 'IRELATIVE\|R_SPARC_JMP_IREL' && {
  693. libc_cv_ld_gnu_indirect_function=yes
  694. }
  695. fi
  696. rm -f conftest*])
  697. # Check if gcc supports attribute ifunc as it is used in libc_ifunc macro.
  698. AC_CACHE_CHECK([for gcc attribute ifunc support],
  699. libc_cv_gcc_indirect_function, [dnl
  700. cat > conftest.c <<EOF
  701. extern int func (int);
  702. int used_func (int a)
  703. {
  704. return a;
  705. }
  706. static void *resolver ()
  707. {
  708. return &used_func;
  709. }
  710. extern __typeof (func) func __attribute__ ((ifunc ("resolver")));
  711. EOF
  712. libc_cv_gcc_indirect_function=no
  713. if ${CC-cc} -c conftest.c -o conftest.o 1>&AS_MESSAGE_LOG_FD \
  714. 2>&AS_MESSAGE_LOG_FD ; then
  715. if $READELF -s conftest.o | grep IFUNC >/dev/null 2>&AS_MESSAGE_LOG_FD; then
  716. libc_cv_gcc_indirect_function=yes
  717. fi
  718. fi
  719. rm -f conftest*])
  720. # Check if linker supports textrel relocation with ifunc (used on elf/tests).
  721. # Note that it relies on libc_cv_ld_gnu_indirect_function test above.
  722. AC_CACHE_CHECK([whether the linker supports textrels along with ifunc],
  723. libc_cv_textrel_ifunc, [dnl
  724. cat > conftest.S <<EOF
  725. .type foo,%gnu_indirect_function
  726. foo:
  727. .globl _start
  728. _start:
  729. .globl __start
  730. __start:
  731. .data
  732. #ifdef _LP64
  733. .quad foo
  734. #else
  735. .long foo
  736. #endif
  737. .text
  738. .globl address
  739. address:
  740. #ifdef _LP64
  741. .quad address
  742. #else
  743. .long address
  744. #endif
  745. EOF
  746. libc_cv_textrel_ifunc=no
  747. if test $libc_cv_ld_gnu_indirect_function = yes; then
  748. if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -nostartfiles -nostdlib $no_ssp -pie -o conftest conftest.S); then
  749. libc_cv_textrel_ifunc=yes
  750. fi
  751. fi
  752. rm -f conftest*])
  753. AC_SUBST(libc_cv_textrel_ifunc)
  754. # Check if CC supports attribute retain as it is used in attribute_used_retain macro.
  755. AC_CACHE_CHECK([for GNU attribute retain support],
  756. libc_cv_gnu_retain, [dnl
  757. cat > conftest.c <<EOF
  758. static int var __attribute__ ((used, retain, section ("__libc_atexit")));
  759. EOF
  760. libc_cv_gnu_retain=no
  761. if ${CC-cc} -Werror -c conftest.c -o /dev/null 1>&AS_MESSAGE_LOG_FD \
  762. 2>&AS_MESSAGE_LOG_FD ; then
  763. libc_cv_gnu_retain=yes
  764. fi
  765. rm -f conftest*])
  766. if test $libc_cv_gnu_retain = yes; then
  767. AC_DEFINE(HAVE_GNU_RETAIN)
  768. fi
  769. LIBC_CONFIG_VAR([have-gnu-retain], [$libc_cv_gnu_retain])
  770. # Check if gcc warns about alias for function with incompatible types.
  771. AC_CACHE_CHECK([if compiler warns about alias for function with incompatible types],
  772. libc_cv_gcc_incompatible_alias, [dnl
  773. cat > conftest.c <<EOF
  774. int __redirect_foo (const void *s, int c);
  775. __typeof (__redirect_foo) *foo_impl (void) __asm__ ("foo");
  776. __typeof (__redirect_foo) *foo_impl (void)
  777. {
  778. return 0;
  779. }
  780. extern __typeof (__redirect_foo) foo_alias __attribute__ ((alias ("foo")));
  781. EOF
  782. libc_cv_gcc_incompatible_alias=yes
  783. if ${CC-cc} -Werror -c conftest.c -o conftest.o 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
  784. libc_cv_gcc_incompatible_alias=no
  785. fi
  786. rm -f conftest*])
  787. if test x"$libc_cv_ld_gnu_indirect_function" != xyes; then
  788. if test x"$multi_arch" = xyes; then
  789. AC_MSG_ERROR([--enable-multi-arch support requires assembler and linker support])
  790. else
  791. multi_arch=no
  792. fi
  793. fi
  794. if test x"$libc_cv_gcc_indirect_function" != xyes; then
  795. # GCC 8+ emits a warning for alias with incompatible types and it might
  796. # fail to build ifunc resolvers aliases to either weak or internal
  797. # symbols. Disables multiarch build in this case.
  798. if test x"$libc_cv_gcc_incompatible_alias" = xyes; then
  799. AC_MSG_WARN([gcc emits a warning for alias between functions of incompatible types])
  800. if test x"$multi_arch" = xyes; then
  801. AC_MSG_ERROR([--enable-multi-arch support requires a gcc with gnu-indirect-function support])
  802. fi
  803. AC_MSG_WARN([Multi-arch is disabled.])
  804. multi_arch=no
  805. elif test x"$multi_arch" = xyes; then
  806. AC_MSG_WARN([--enable-multi-arch support recommends a gcc with gnu-indirect-function support.
  807. Please use a gcc which supports it by default or configure gcc with --enable-gnu-indirect-function])
  808. fi
  809. fi
  810. multi_arch_d=
  811. if test x"$multi_arch" != xno; then
  812. multi_arch_d=/multiarch
  813. fi
  814. # Compute the list of sysdep directories for this configuration.
  815. # This can take a while to compute.
  816. sysdep_dir=$srcdir/sysdeps
  817. AC_MSG_CHECKING(sysdep dirs)
  818. dnl We need to use [ and ] for other purposes for a while now.
  819. changequote(,)dnl
  820. # Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
  821. os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
  822. test "x$base_os" != x || case "$os" in
  823. gnu*)
  824. base_os=mach/hurd ;;
  825. linux*)
  826. base_os=unix/sysv ;;
  827. esac
  828. # For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos.
  829. tail=$os
  830. ostry=$os
  831. while o=`echo $tail | sed 's/\.[^.]*$//'`; test $o != $tail; do
  832. ostry="$ostry /$o"
  833. tail=$o
  834. done
  835. o=`echo $tail | sed 's/[0-9]*$//'`
  836. if test $o != $tail; then
  837. ostry="$ostry /$o"
  838. fi
  839. # For linux-gnu, try linux-gnu, then linux.
  840. o=`echo $tail | sed 's/-.*$//'`
  841. if test $o != $tail; then
  842. ostry="$ostry /$o"
  843. fi
  844. # For unix/sysv/sysv4, try unix/sysv/sysv4, then unix/sysv, then unix.
  845. base=
  846. tail=$base_os
  847. while b=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$b"; do
  848. set $b
  849. base="$base /$1"
  850. tail="$2"
  851. done
  852. # For sparc/sparc32, try sparc/sparc32 and then sparc.
  853. mach=
  854. tail=$machine${submachine:+/$submachine}
  855. while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
  856. set $m
  857. # Prepend the machine's FPU directory unless the architecture specific
  858. # preconfigure disables it.
  859. if test "$libc_cv_with_fp" = yes; then
  860. maybe_fpu=/fpu
  861. else
  862. maybe_fpu=/nofpu
  863. fi
  864. # For each machine term, try it with and then without /multiarch.
  865. for try_fpu in $maybe_fpu ''; do
  866. for try_multi in $multi_arch_d ''; do
  867. mach="$mach /$1$try_fpu$try_multi"
  868. done
  869. done
  870. tail="$2"
  871. done
  872. dnl We are done with glob and regexp uses of [ and ]; return to autoconf.
  873. changequote([,])dnl
  874. # Find what sysdep directories exist.
  875. sysnames=
  876. for b in $base ''; do
  877. for m0 in $mach ''; do
  878. for v in /$vendor ''; do
  879. test "$v" = / && continue
  880. for o in /$ostry ''; do
  881. test "$o" = / && continue
  882. for m in $mach ''; do
  883. try_suffix="$m0$b$v$o$m"
  884. if test -n "$try_suffix"; then
  885. try_srcdir="${srcdir}/"
  886. try="sysdeps$try_suffix"
  887. test -n "$enable_debug_configure" &&
  888. echo "$0 [DEBUG]: try $try" >&2
  889. if test -d "$try_srcdir$try"; then
  890. sysnames="$sysnames $try"
  891. { test -n "$o" || test -n "$b"; } && os_used=t
  892. { test -n "$m" || test -n "$m0"; } && machine_used=t
  893. case x${m0:-$m} in
  894. x*/$submachine) submachine_used=t ;;
  895. esac
  896. fi
  897. fi
  898. done
  899. done
  900. done
  901. done
  902. done
  903. # If the assembler supports gnu_indirect_function symbol type and the
  904. # architecture supports multi-arch, we enable multi-arch by default.
  905. case $sysnames in
  906. *"$multi_arch_d"*)
  907. ;;
  908. *)
  909. test x"$multi_arch" = xdefault && multi_arch=no
  910. ;;
  911. esac
  912. if test x"$multi_arch" != xno; then
  913. AC_DEFINE(USE_MULTIARCH)
  914. fi
  915. AC_SUBST(multi_arch)
  916. if test -z "$os_used" && test "$os" != none; then
  917. AC_MSG_ERROR(Operating system $os is not supported.)
  918. fi
  919. if test -z "$machine_used" && test "$machine" != none; then
  920. AC_MSG_ERROR(The $machine is not supported.)
  921. fi
  922. if test -z "$submachine_used" && test -n "$submachine"; then
  923. AC_MSG_ERROR(The $submachine subspecies of $host_cpu is not supported.)
  924. fi
  925. AC_SUBST(submachine)
  926. # We have now validated the configuration.
  927. # Expand the list of system names into a full list of directories
  928. # from each element's parent name and Implies file (if present).
  929. set $sysnames
  930. names=
  931. while test $# -gt 0; do
  932. name=$1
  933. shift
  934. case " $names " in *" $name "*)
  935. # Already in the list.
  936. continue
  937. esac
  938. # Report each name as we discover it, so there is no long pause in output.
  939. echo $ECHO_N "$name $ECHO_C" >&AS_MESSAGE_FD
  940. name_base=`echo $name | sed -e 's@\(.*sysdeps\)/.*@\1@'`
  941. case $name in
  942. /*) xsrcdir= ;;
  943. *) xsrcdir=$srcdir/ ;;
  944. esac
  945. test -n "$enable_debug_configure" &&
  946. echo "[DEBUG]: name/Implies $xsrcdir$name/Implies" >&2
  947. for implies_file in Implies Implies-before Implies-after; do
  948. implies_type=`echo $implies_file | sed s/-/_/`
  949. eval ${implies_type}=
  950. if test -f $xsrcdir$name/$implies_file; then
  951. # Collect more names from the `Implies' file (removing comments).
  952. implied_candidate="`sed 's/#.*$//' < $xsrcdir$name/$implies_file`"
  953. for x in $implied_candidate; do
  954. found=no
  955. if test -d $xsrcdir$name_base/$x; then
  956. eval "${implies_type}=\"\$${implies_type} \$name_base/\$x\""
  957. found=yes
  958. fi
  959. try="sysdeps/$x"
  960. try_srcdir=$srcdir/
  961. test -n "$enable_debug_configure" &&
  962. echo "[DEBUG]: $name $implies_file $x try() {$try_srcdir}$try" >&2
  963. if test $try != $xsrcdir$name_base/$x && test -d $try_srcdir$try;
  964. then
  965. eval "${implies_type}=\"\$${implies_type} \$try\""
  966. found=yes
  967. fi
  968. if test $found = no; then
  969. AC_MSG_WARN($name/$implies_file specifies nonexistent $x)
  970. fi
  971. done
  972. fi
  973. done
  974. # Add NAME to the list of names.
  975. names="$names $name"
  976. # Find the parent of NAME, using the empty string if it has none.
  977. changequote(,)dnl
  978. parent="`echo $name | sed -n -e 's=/[^/]*$==' -e '/sysdeps$/q' -e p`"
  979. changequote([,])dnl
  980. test -n "$enable_debug_configure" &&
  981. echo "[DEBUG]: $name Implies='$Implies' rest='$*' parent='$parent' \
  982. Implies_before='$Implies_before' Implies_after='$Implies_after'" >&2
  983. # Add the names implied by NAME, and NAME's parent (if it has one), to
  984. # the list of names to be processed (the argument list). We prepend the
  985. # implied names to the list and append the parent. We want implied
  986. # directories to come before further directories inferred from the
  987. # configuration components; this ensures that for sysv4, unix/common
  988. # (implied by unix/sysv/sysv4) comes before unix/sysv (in ostry (here $*)
  989. # after sysv4).
  990. sysnames="`echo $Implies $* $Implies_before $parent $Implies_after`"
  991. test -n "$sysnames" && set $sysnames
  992. done
  993. # Add the default directories.
  994. default_sysnames="sysdeps/generic"
  995. sysnames="$names $default_sysnames"
  996. AC_SUBST(sysnames)
  997. # The other names were emitted during the scan.
  998. AC_MSG_RESULT($default_sysnames)
  999. # if using special system headers, find out the compiler's sekrit
  1000. # header directory and add that to the list. NOTE: Only does the right
  1001. # thing on a system that doesn't need fixincludes. (Not presently a problem.)
  1002. if test -n "$sysheaders"; then
  1003. SYSINCLUDES=-nostdinc
  1004. for d in include include-fixed; do
  1005. i=`$CC -print-file-name="$d"` && test "x$i" != x && test "x$i" != "x$d" &&
  1006. SYSINCLUDES="$SYSINCLUDES -isystem $i"
  1007. done
  1008. SYSINCLUDES="$SYSINCLUDES \
  1009. -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`"
  1010. if test -n "$CXX"; then
  1011. CXX_SYSINCLUDES=
  1012. for cxxheaders in `$CXX -v -S -x c++ /dev/null -o /dev/null 2>&1 \
  1013. | sed -n -e '1,/#include/d' -e 's/^ \(\/.*\/[cg]++\)/\1/p'`; do
  1014. test "x$cxxheaders" != x &&
  1015. CXX_SYSINCLUDES="$CXX_SYSINCLUDES -isystem $cxxheaders"
  1016. done
  1017. fi
  1018. fi
  1019. AC_SUBST(SYSINCLUDES)
  1020. AC_SUBST(CXX_SYSINCLUDES)
  1021. # Obtain some C++ header file paths. This is used to make a local
  1022. # copy of those headers in Makerules.
  1023. if test -n "$TEST_CXX"; then
  1024. saved_CXX="$CXX"
  1025. CXX="$TEST_CXX"
  1026. find_cxx_header () {
  1027. echo "#include <$1>" | $CXX -H -fsyntax-only -x c++ - 2>&1 \
  1028. | $AWK '$1 == "."{print $2}'
  1029. }
  1030. CXX_CSTDLIB_HEADER="$(find_cxx_header cstdlib)"
  1031. CXX_CMATH_HEADER="$(find_cxx_header cmath)"
  1032. CXX_BITS_STD_ABS_H="$(find_cxx_header bits/std_abs.h)"
  1033. CXX="$saved_CXX"
  1034. fi
  1035. AC_SUBST(CXX_CSTDLIB_HEADER)
  1036. AC_SUBST(CXX_CMATH_HEADER)
  1037. AC_SUBST(CXX_BITS_STD_ABS_H)
  1038. # Test if LD_LIBRARY_PATH contains the notation for the current directory
  1039. # since this would lead to problems installing/building glibc.
  1040. # LD_LIBRARY_PATH contains the current directory if one of the following
  1041. # is true:
  1042. # - one of the terminals (":" and ";") is the first or last sign
  1043. # - two terminals occur directly after each other
  1044. # - the path contains an element with a dot in it
  1045. AC_MSG_CHECKING(LD_LIBRARY_PATH variable)
  1046. changequote(,)dnl
  1047. case ${LD_LIBRARY_PATH} in
  1048. [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
  1049. ld_library_path_setting="contains current directory"
  1050. ;;
  1051. *)
  1052. ld_library_path_setting="ok"
  1053. ;;
  1054. esac
  1055. changequote([,])dnl
  1056. AC_MSG_RESULT($ld_library_path_setting)
  1057. if test "$ld_library_path_setting" != "ok"; then
  1058. AC_MSG_ERROR([
  1059. *** LD_LIBRARY_PATH shouldn't contain the current directory when
  1060. *** building glibc. Please change the environment variable
  1061. *** and run configure again.])
  1062. fi
  1063. AC_PATH_PROG(BASH_SHELL, bash, no)
  1064. AC_PATH_PROG(PERL, perl, no)
  1065. if test "$PERL" != no &&
  1066. (eval `$PERL -V:apiversion`; test `expr "$apiversion" \< 5` -ne 0); then
  1067. PERL=no
  1068. fi
  1069. AC_PATH_PROG(INSTALL_INFO, install-info, no,
  1070. $PATH:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin)
  1071. AC_CACHE_CHECK(for .set assembler directive, libc_cv_asm_set_directive, [dnl
  1072. cat > conftest.s <<EOF
  1073. .text
  1074. foo:
  1075. .set glibc_conftest_frobozz,foo
  1076. .globl glibc_conftest_frobozz
  1077. EOF
  1078. # The alpha-dec-osf1 assembler gives only a warning for `.set'
  1079. # (but it doesn't work), so we must do a linking check to be sure.
  1080. cat > conftest1.c <<\EOF
  1081. extern int glibc_conftest_frobozz;
  1082. void _start() { glibc_conftest_frobozz = 1; }
  1083. EOF
  1084. if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
  1085. -nostartfiles -nostdlib $no_ssp \
  1086. -o conftest conftest.s conftest1.c 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
  1087. libc_cv_asm_set_directive=yes
  1088. else
  1089. libc_cv_asm_set_directive=no
  1090. fi
  1091. rm -f conftest*])
  1092. if test $libc_cv_asm_set_directive = yes; then
  1093. AC_DEFINE(HAVE_ASM_SET_DIRECTIVE)
  1094. fi
  1095. AC_CACHE_CHECK(linker support for protected data symbol,
  1096. libc_cv_protected_data,
  1097. [cat > conftest.c <<EOF
  1098. int bar __attribute__ ((visibility ("protected"))) = 1;
  1099. EOF
  1100. libc_cv_protected_data=no
  1101. if AC_TRY_COMMAND(${CC-cc} -nostdlib -nostartfiles $no_ssp -fPIC -shared conftest.c -o conftest.so); then
  1102. cat > conftest.c <<EOF
  1103. extern int bar;
  1104. int main (void) { return bar; }
  1105. EOF
  1106. if AC_TRY_COMMAND(${CC-cc} -nostdlib -nostartfiles $no_ssp conftest.c -o conftest conftest.so); then
  1107. libc_cv_protected_data=yes
  1108. fi
  1109. fi
  1110. rm -f conftest.*
  1111. ])
  1112. AC_SUBST(libc_cv_protected_data)
  1113. AC_CACHE_CHECK(linker support for INSERT in linker script,
  1114. libc_cv_insert,
  1115. [cat > conftest.c <<EOF
  1116. int __attribute__ ((section(".bar"))) bar = 0x12345678;
  1117. int test (void) { return bar; }
  1118. EOF
  1119. cat > conftest.t <<EOF
  1120. SECTIONS
  1121. {
  1122. .bar : { *(.bar) }
  1123. }
  1124. INSERT AFTER .rela.dyn;
  1125. EOF
  1126. libc_cv_insert=no
  1127. if AC_TRY_COMMAND([${CC-cc} -nostdlib -nostartfiles $no_ssp -fPIC -shared conftest.c -Wl,-T,conftest.t -o conftest.so]); then
  1128. libc_cv_insert=yes
  1129. fi
  1130. rm -f conftest.*
  1131. ])
  1132. AC_SUBST(libc_cv_insert)
  1133. AC_CACHE_CHECK(for broken __attribute__((alias())),
  1134. libc_cv_broken_alias_attribute,
  1135. [cat > conftest.c <<EOF
  1136. extern int foo (int x) __asm ("xyzzy");
  1137. int bar (int x) { return x; }
  1138. extern __typeof (bar) foo __attribute ((weak, alias ("bar")));
  1139. extern int dfoo;
  1140. extern __typeof (dfoo) dfoo __asm ("abccb");
  1141. int dfoo = 1;
  1142. EOF
  1143. libc_cv_broken_alias_attribute=yes
  1144. if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
  1145. if grep 'xyzzy' conftest.s >/dev/null &&
  1146. grep 'abccb' conftest.s >/dev/null; then
  1147. libc_cv_broken_alias_attribute=no
  1148. fi
  1149. fi
  1150. rm -f conftest.c conftest.s
  1151. ])
  1152. if test $libc_cv_broken_alias_attribute = yes; then
  1153. AC_MSG_ERROR(working alias attribute support required)
  1154. fi
  1155. AC_CACHE_CHECK(whether to put _rtld_local into .sdata section,
  1156. libc_cv_have_sdata_section,
  1157. [echo "int i;" > conftest.c
  1158. libc_cv_have_sdata_section=no
  1159. if ${CC-cc} $LDFLAGS -fPIC -shared -Wl,--verbose conftest.c -o conftest.so 2>&1 \
  1160. | grep '\.sdata' >/dev/null; then
  1161. libc_cv_have_sdata_section=yes
  1162. fi
  1163. rm -f conftest.c conftest.so
  1164. ])
  1165. if test $libc_cv_have_sdata_section = yes; then
  1166. AC_DEFINE(HAVE_SDATA_SECTION)
  1167. fi
  1168. AC_CACHE_CHECK(for libunwind-support in compiler,
  1169. libc_cv_cc_with_libunwind, [
  1170. cat > conftest.c <<EOF
  1171. int main (void) { return 0; }
  1172. EOF
  1173. if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static -o conftest \
  1174. conftest.c -v 2>&1 >/dev/null | grep ' -lunwind ' >/dev/null; then
  1175. libc_cv_cc_with_libunwind=yes
  1176. else
  1177. libc_cv_cc_with_libunwind=no
  1178. fi
  1179. rm -f conftest*])
  1180. AC_SUBST(libc_cv_cc_with_libunwind)
  1181. if test $libc_cv_cc_with_libunwind = yes; then
  1182. AC_DEFINE(HAVE_CC_WITH_LIBUNWIND)
  1183. fi
  1184. ASFLAGS_config=
  1185. AC_CACHE_CHECK(whether --noexecstack is desirable for .S files,
  1186. libc_cv_as_noexecstack, [dnl
  1187. cat > conftest.c <<EOF
  1188. void foo (void) { }
  1189. EOF
  1190. if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS
  1191. -S -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD]) \
  1192. && grep .note.GNU-stack conftest.s >/dev/null \
  1193. && AC_TRY_COMMAND([${CC-cc} $ASFLAGS -Wa,--noexecstack
  1194. -c -o conftest.o conftest.s 1>&AS_MESSAGE_LOG_FD])
  1195. then
  1196. libc_cv_as_noexecstack=yes
  1197. else
  1198. libc_cv_as_noexecstack=no
  1199. fi
  1200. rm -f conftest*])
  1201. if test $libc_cv_as_noexecstack = yes; then
  1202. ASFLAGS_config="$ASFLAGS_config -Wa,--noexecstack"
  1203. fi
  1204. AC_SUBST(ASFLAGS_config)
  1205. LIBC_TEST_LINKER_FEATURE([--no-error-execstack], [-Wl,--no-error-execstack],
  1206. [libc_cv_test_no_error_execstack=yes], [libc_cv_test_no_error_execstack=no])
  1207. AC_SUBST(libc_cv_test_no_error_execstack)
  1208. LIBC_LINKER_FEATURE([-z execstack], [-Wl,-z,execstack],
  1209. [libc_cv_z_execstack=yes], [libc_cv_z_execstack=no])
  1210. AC_SUBST(libc_cv_z_execstack)
  1211. LIBC_LINKER_FEATURE([-z start-stop-gc], [-Wl,-z,start-stop-gc],
  1212. [libc_cv_z_start_stop_gc=yes], [libc_cv_z_start_stop_gc=no])
  1213. LIBC_CONFIG_VAR([have-z-start-stop-gc], [$libc_cv_z_start_stop_gc])
  1214. LIBC_TEST_LINKER_FEATURE([--depaudit], [-Wl,--depaudit,x],
  1215. [libc_cv_test_depaudit=yes], [libc_cv_test_depaudit=no])
  1216. LIBC_CONFIG_VAR([have-depaudit], [$libc_cv_test_depaudit])
  1217. LIBC_LINKER_FEATURE([-z pack-relative-relocs],
  1218. [-Wl,-z,pack-relative-relocs],
  1219. [libc_cv_dt_relr=yes], [libc_cv_dt_relr=no])
  1220. LIBC_CONFIG_VAR([have-dt-relr], [$libc_cv_dt_relr])
  1221. LIBC_LINKER_FEATURE([--no-dynamic-linker],
  1222. [-Wl,--no-dynamic-linker],
  1223. [libc_cv_no_dynamic_linker=yes],
  1224. [libc_cv_no_dynamic_linker=no])
  1225. LIBC_CONFIG_VAR([have-no-dynamic-linker], [$libc_cv_no_dynamic_linker])
  1226. LIBC_TRY_CC_AND_TEST_CC_OPTION(for -static-pie, [-static-pie],
  1227. libc_cv_static_pie,
  1228. [libc_cv_static_pie=yes], [libc_cv_static_pie=no],
  1229. libc_cv_test_static_pie,
  1230. [libc_cv_test_static_pie=yes], [libc_cv_test_static_pie=no]
  1231. )
  1232. LIBC_CONFIG_VAR([have-static-pie], [$libc_cv_static_pie])
  1233. AC_SUBST(libc_cv_test_static_pie)
  1234. AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl
  1235. LIBC_TRY_CC_OPTION([-fpie], [libc_cv_fpie=yes], [libc_cv_fpie=no])
  1236. ])
  1237. AC_SUBST(libc_cv_fpie)
  1238. dnl Check how to suppress C23-qualifier-generic const warnings. GCC has
  1239. dnl -Wno-discarded-qualifiers, while clang -Wno-incompatible-pointer-types-discards-qualifiers
  1240. AC_CACHE_CHECK(for -Wno-discarded-qualifiers, libc_cv_cflags_wno_discarded_qualifiers, [dnl
  1241. LIBC_TRY_CC_OPTION([-Werror -Wno-discarded-qualifiers],
  1242. [libc_cv_cflags_wno_discarded_qualifiers=-Wno-discarded-qualifiers],
  1243. [libc_cv_cflags_wno_discarded_qualifiers=])
  1244. if test -z "$libc_cv_cflags_wno_discarded_qualifiers"; then
  1245. LIBC_TRY_CC_OPTION([-Werror -Wno-incompatible-pointer-types-discards-qualifiers],
  1246. [libc_cv_cflags_wno_incompatible_pointer_type_discards_qualifiers=-Wno-incompatible-pointer-types-discards-qualifiers],
  1247. [libc_cv_cflags_wno_incompatible_pointer_type_discards_qualifiers=])
  1248. libc_cv_cflags_wno_discarded_qualifiers=$libc_cv_cflags_wno_incompatible_pointer_type_discards_qualifiers
  1249. fi
  1250. ])
  1251. LIBC_CONFIG_VAR([config-cflags-wno-discarded-qualifiers],
  1252. [$libc_cv_cflags_wno_discarded_qualifiers])
  1253. AC_CACHE_CHECK(for GLOB_DAT reloc,
  1254. libc_cv_has_glob_dat, [dnl
  1255. cat > conftest.c <<EOF
  1256. extern int mumble;
  1257. int foo (void) { return mumble; }
  1258. EOF
  1259. if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
  1260. -fPIC -shared -o conftest.so conftest.c
  1261. -nostdlib -nostartfiles $no_ssp
  1262. 1>&AS_MESSAGE_LOG_FD])
  1263. then
  1264. dnl look for GLOB_DAT relocation.
  1265. if $READELF -rW conftest.so | grep '_GLOB_DAT' > /dev/null; then
  1266. libc_cv_has_glob_dat=yes
  1267. else
  1268. libc_cv_has_glob_dat=no
  1269. fi
  1270. else
  1271. libc_cv_has_glob_dat=no
  1272. fi
  1273. rm -f conftest*])
  1274. AC_SUBST(libc_cv_has_glob_dat)
  1275. conftest_code="
  1276. __thread int i;
  1277. void foo (void)
  1278. {
  1279. i = 10;
  1280. }
  1281. "
  1282. dnl Check if TEST_CC support tls descriptor.
  1283. LIBC_TRY_TEST_CC_COMMAND([for tls descriptor support],
  1284. [$conftest_code],
  1285. [-fPIC -mtls-dialect=$mtls_descriptor -nostdlib -nostartfiles -shared],
  1286. libc_cv_test_mtls_descriptor,
  1287. [libc_cv_test_mtls_descriptor=$mtls_descriptor],
  1288. [libc_cv_test_mtls_descriptor=no])
  1289. LIBC_CONFIG_VAR([have-test-mtls-descriptor],
  1290. [$libc_cv_test_mtls_descriptor])
  1291. dnl Check if TEST_CC support traditional tls.
  1292. LIBC_TRY_TEST_CC_COMMAND([for traditional tls support],
  1293. [$conftest_code],
  1294. [-fPIC -mtls-dialect=$mtls_traditional -nostdlib -nostartfiles -shared],
  1295. libc_cv_test_mtls_traditional,
  1296. [libc_cv_test_mtls_traditional=$mtls_traditional],
  1297. [libc_cv_test_mtls_traditional=no])
  1298. LIBC_CONFIG_VAR([have-test-mtls-traditional],
  1299. [$libc_cv_test_mtls_traditional])
  1300. AC_CACHE_CHECK([for -Wno-maybe-uninitialized],
  1301. libc_cv_wno_maybe_uninitialized, [dnl
  1302. LIBC_TRY_CC_OPTION([-Werror -Wno-maybe-uninitialized],
  1303. [libc_cv_wno_maybe_uninitialized=-Wno-maybe-uninitialized],
  1304. [libc_cv_wno_maybe_uninitialized=])
  1305. ])
  1306. LIBC_CONFIG_VAR([config-cflags-wno-maybe-uninitialized],
  1307. [$libc_cv_wno_maybe_uninitialized])
  1308. AC_CACHE_CHECK(whether cc puts quotes around section names,
  1309. libc_cv_have_section_quotes,
  1310. [cat > conftest.c <<EOF
  1311. static const int foo
  1312. __attribute__ ((section ("bar"))) = 1;
  1313. EOF
  1314. if ${CC-cc} -S conftest.c -o conftest.s; then
  1315. if grep '\.section.*"bar"' conftest.s >/dev/null; then
  1316. libc_cv_have_section_quotes=yes
  1317. else
  1318. libc_cv_have_section_quotes=no
  1319. fi
  1320. else
  1321. libc_cv_have_section_quotes=unknown
  1322. fi
  1323. rm -f conftest.{c,s}
  1324. ])
  1325. if test $libc_cv_have_section_quotes = yes; then
  1326. AC_DEFINE(HAVE_SECTION_QUOTES)
  1327. fi
  1328. AC_CACHE_CHECK(for __builtin_memset, libc_cv_gcc_builtin_memset, [dnl
  1329. cat > conftest.c <<\EOF
  1330. void zero (void *x)
  1331. {
  1332. __builtin_memset (x, 0, 1000);
  1333. }
  1334. EOF
  1335. dnl
  1336. if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | grep -F "memset" > /dev/null]);
  1337. then
  1338. libc_cv_gcc_builtin_memset=no
  1339. else
  1340. libc_cv_gcc_builtin_memset=yes
  1341. fi
  1342. rm -f conftest* ])
  1343. if test "$libc_cv_gcc_builtin_memset" = yes ; then
  1344. AC_DEFINE(HAVE_BUILTIN_MEMSET)
  1345. fi
  1346. AC_CACHE_CHECK(for 64-bit atomic support, libc_cv_gcc_has_64b_atomics, [dnl
  1347. cat > conftest.c <<\EOF
  1348. typedef struct { long long t; } X;
  1349. extern void has_64b_atomics(void);
  1350. void f(void)
  1351. {
  1352. X x;
  1353. /* Use address of structure with 64-bit type. This avoids incorrect
  1354. implementations which return true even if long long is not 64-bit aligned.
  1355. This works on GCC and LLVM - other cases have bugs and they disagree. */
  1356. _Static_assert (__atomic_always_lock_free (sizeof (x), &x), "no_64b_atomics");
  1357. }
  1358. EOF
  1359. dnl
  1360. if AC_TRY_COMMAND([${CC-cc} -O2 -S conftest.c]);
  1361. then
  1362. libc_cv_gcc_has_64b_atomics=yes
  1363. else
  1364. libc_cv_gcc_has_64b_atomics=no
  1365. fi
  1366. rm -f conftest* ])
  1367. if test "$libc_cv_gcc_has_64b_atomics" = yes; then
  1368. AC_DEFINE(HAVE_64B_ATOMICS, 1)
  1369. else
  1370. AC_DEFINE(HAVE_64B_ATOMICS, 0)
  1371. fi
  1372. dnl Determine how to disable generation of FMA instructions.
  1373. AC_CACHE_CHECK([for compiler option to disable generation of FMA instructions],
  1374. libc_cv_cc_nofma, [dnl
  1375. libc_cv_cc_nofma=
  1376. for opt in -ffp-contract=off -mno-fused-madd; do
  1377. LIBC_TRY_CC_OPTION([$opt], [libc_cv_cc_nofma=$opt; break])
  1378. done])
  1379. AC_SUBST(libc_cv_cc_nofma)
  1380. if test -n "$submachine"; then
  1381. AC_CACHE_CHECK([for compiler option for CPU variant],
  1382. libc_cv_cc_submachine, [dnl
  1383. libc_cv_cc_submachine=no
  1384. for opt in "-march=$submachine" "-mcpu=$submachine"; do
  1385. LIBC_TRY_CC_OPTION([$opt], [
  1386. libc_cv_cc_submachine="$opt"
  1387. break], [])
  1388. done])
  1389. if test "x$libc_cv_cc_submachine" = xno; then
  1390. AC_MSG_ERROR([${CC-cc} does not support $submachine])
  1391. fi
  1392. fi
  1393. AC_SUBST(libc_cv_cc_submachine)
  1394. dnl Determine if compiler supports -fsignaling-nans
  1395. LIBC_TRY_CC_AND_TEST_CC_OPTION([for compiler option that -fsignaling-nans],
  1396. [-Werror -fsignaling-nans],
  1397. libc_cv_cc_signaling_nans,
  1398. [libc_cv_cc_signaling_nans=-fsignaling-nans],
  1399. [libc_cv_cc_signaling_nans=],
  1400. libc_cv_test_cc_signaling_nans,
  1401. [libc_cv_test_cc_signaling_nans=-fsignaling-nans],
  1402. [libc_cv_test_cc_signaling_nans=])
  1403. LIBC_CONFIG_VAR([config-cflags-signaling-nans],
  1404. [$libc_cv_cc_signaling_nans])
  1405. AC_SUBST(libc_cv_test_cc_signaling_nans)
  1406. dnl Check if TEST_CC supports -fsemantic-interposition.
  1407. LIBC_TRY_TEST_CC_OPTION([-fsemantic-interposition],
  1408. [-Werror -fsemantic-interposition],
  1409. libc_cv_test_cc_cflags_fsemantic_interposition,
  1410. [libc_cv_test_cc_cflags_fsemantic_interposition=yes],
  1411. [libc_cv_test_cc_cflags_fsemantic_interposition=no]
  1412. )
  1413. LIBC_CONFIG_VAR(have-test-cc-cflags-fsemantic-interposition,
  1414. $libc_cv_test_cc_cflags_fsemantic_interposition)
  1415. dnl Determine if TEST_CC supports -ffloat-store.
  1416. LIBC_TRY_TEST_CC_OPTION([for -ffloat-store],
  1417. [-Werror -ffloat-store],
  1418. libc_cv_test_cc_float_store,
  1419. [libc_cv_test_cc_float_store="-ffloat-store"],
  1420. [libc_cv_test_cc_float_store=])
  1421. LIBC_CONFIG_VAR([test-config-cflags-float-store],
  1422. [$libc_cv_test_cc_float_store])
  1423. conftest_code="
  1424. void
  1425. __attribute__ ((__optimize__ (\"-fno-tree-loop-distribute-patterns\")))
  1426. foo (void) {}
  1427. "
  1428. LIBC_TRY_CC_AND_TEST_CC_COMMAND([if __attribute__ ((__optimize__("-fno-tree-loop-distribute-patterns"))) works],
  1429. [$conftest_code],
  1430. [-c -Werror],
  1431. libc_cv_cc_loop_to_function,
  1432. [libc_cv_cc_loop_to_function=yes],
  1433. [libc_cv_cc_loop_to_function=no],
  1434. libc_cv_test_cc_loop_to_function,
  1435. [libc_cv_test_cc_loop_to_function=yes],
  1436. [libc_cv_test_cc_loop_to_function=no])
  1437. if test $libc_cv_cc_loop_to_function = yes; then
  1438. AC_DEFINE(HAVE_CC_INHIBIT_LOOP_TO_LIBCALL)
  1439. fi
  1440. if test $libc_cv_test_cc_loop_to_function = yes; then
  1441. AC_DEFINE(HAVE_TEST_CC_INHIBIT_LOOP_TO_LIBCALL)
  1442. fi
  1443. AC_SUBST(libc_cv_cc_loop_to_function)
  1444. LIBC_CONFIG_VAR(config-cflags-cc-loop-to-function,$libc_cv_cc_loop_to_function)
  1445. LIBC_TRY_CC_AND_TEST_CC_OPTION([for -Wimplicit-fallthrough],
  1446. [-Werror -Wimplicit-fallthrough],
  1447. libc_cv_cc_wimplicit_fallthrough,
  1448. [libc_cv_cc_wimplicit_fallthrough=-Wimplicit-fallthrough],
  1449. [libc_cv_cc_wimplicit_fallthrough=],
  1450. libc_cv_test_cc_wimplicit_fallthrough,
  1451. [libc_cv_test_cc_wimplicit_fallthrough=-Wimplicit-fallthrough],
  1452. [libc_cv_test_cc_wimplicit_fallthrough=])
  1453. dnl Clang's -Wimplicit-fallthrough warning, which flags unannotated
  1454. dnl fall-through in switch statements, does not recognize specific
  1455. dnl comments like /* FALLTHROUGH */ for suppressing the warning, unlike
  1456. dnl GCC. Since fall through comments are used extensively in glibc,
  1457. dnl disable -Wimplicit-fallthrough when clang is in use.
  1458. if test $libc_cv_test_clang = yes; then
  1459. libc_cv_test_cc_wimplicit_fallthrough=
  1460. fi
  1461. LIBC_CONFIG_VAR([cc-option-wimplicit-fallthrough],
  1462. [$libc_cv_cc_wimplicit_fallthrough])
  1463. AC_SUBST(libc_cv_test_cc_wimplicit_fallthrough)
  1464. LIBC_TRY_CC_AND_TEST_CC_OPTION([for -Wfree-labels],
  1465. [-Werror -Wfree-labels],
  1466. libc_cv_cc_wfree_labels,
  1467. [libc_cv_cc_wfree_labels=-Wfree-labels],
  1468. [libc_cv_cc_wfree_labels=],
  1469. libc_cv_test_cc_wfree_labels,
  1470. [libc_cv_test_cc_wfree_labels=-Wfree-labels],
  1471. [libc_cv_test_cc_wfree_labels=])
  1472. LIBC_CONFIG_VAR([cc-option-wfree-labels], [$libc_cv_cc_wfree_labels])
  1473. AC_SUBST(libc_cv_test_cc_wfree_labels)
  1474. LIBC_TRY_CC_AND_TEST_CC_OPTION([for -Wmissing-parameter-name],
  1475. [-Werror -Wmissing-parameter-name],
  1476. libc_cv_cc_wmissing_parameter_name,
  1477. [libc_cv_cc_wmissing_parameter_name=-Wmissing-parameter-name],
  1478. [libc_cv_cc_wmissing_parameter_name=],
  1479. libc_cv_test_cc_wmissing_parameter_name,
  1480. [libc_cv_test_cc_wmissing_parameter_name=-Wmissing-parameter-name],
  1481. [libc_cv_test_cc_wmissing_parameter_name=])
  1482. LIBC_CONFIG_VAR([cc-option-wmissing-parameter-name],
  1483. [$libc_cv_cc_wmissing_parameter_name])
  1484. AC_SUBST(libc_cv_test_cc_wmissing_parameter_name)
  1485. conftest_code="
  1486. void bar (void (*callback) (void));
  1487. int foo (void)
  1488. {
  1489. int var = 0;
  1490. void callback (void) { var = 1; }
  1491. bar (callback);
  1492. return var;
  1493. }
  1494. "
  1495. dnl Check if TEST_CC support trampolines.
  1496. LIBC_TRY_TEST_CC_COMMAND([support for trampolines],
  1497. [$conftest_code],
  1498. [-c -Werror],
  1499. libc_cv_test_cc_trampolines,
  1500. [libc_cv_test_cc_trampolines=yes],
  1501. [libc_cv_test_cc_trampolines=no]
  1502. )
  1503. LIBC_CONFIG_VAR([have-test-cc-trampoline],
  1504. [$libc_cv_test_cc_trampolines])
  1505. dnl Check if TEST_CC supports -Wno-restrict.
  1506. LIBC_TRY_TEST_CC_OPTION([-Wno-restrict],
  1507. [-Werror -Wno-restrict],
  1508. libc_cv_test_cflags_wno_restrict,
  1509. [libc_cv_test_cflags_wno_restrict=-Wno-restrict],
  1510. [libc_cv_test_cflags_wno_restrict=]
  1511. )
  1512. LIBC_CONFIG_VAR([test-config-cflags-wno-restrict],
  1513. [$libc_cv_test_cflags_wno_restrict])
  1514. dnl Check if TEST_CC supports -Wno-fortify-source.
  1515. LIBC_TRY_TEST_CC_OPTION([-Wno-fortify-source],
  1516. [-Werror -Wno-fortify-source],
  1517. libc_cv_test_cflags_wno_fortify_source,
  1518. [libc_cv_test_cflags_wno_fortify_source=-Wno-fortify-source],
  1519. [libc_cv_test_cflags_wno_fortify_source=]
  1520. )
  1521. LIBC_CONFIG_VAR([test-config-cflags-wno-fortify-source],
  1522. [$libc_cv_test_cflags_wno_fortify_source])
  1523. dnl Check if TEST_CC supports -finput-charset=ascii.
  1524. LIBC_TRY_TEST_CC_OPTION([-finput-charset=ascii],
  1525. [-Werror -finput-charset=ascii],
  1526. libc_cv_test_cflags_finput_charset_ascii,
  1527. [libc_cv_test_cflags_finput_charset_ascii="-finput-charset=ascii"],
  1528. [libc_cv_test_cflags_finput_charset_ascii=]
  1529. )
  1530. LIBC_CONFIG_VAR(test-config-cflags-finput-charset-ascii,
  1531. $libc_cv_test_cflags_finput_charset_ascii)
  1532. dnl Check if TEST_CXX supports -finput-charset=ascii.
  1533. LIBC_TRY_TEST_CXX_OPTION([$CXX -finput-charset=ascii],
  1534. [-Werror -finput-charset=ascii],
  1535. libc_cv_test_cxxflags_finput_charset_ascii,
  1536. [libc_cv_test_cxxflags_finput_charset_ascii="-finput-charset=ascii"],
  1537. [libc_cv_test_cxxflags_finput_charset_ascii=]
  1538. )
  1539. LIBC_CONFIG_VAR(test-config-cxxflags-finput-charset-ascii,
  1540. $libc_cv_test_cxxflags_finput_charset_ascii)
  1541. conftest_code="
  1542. extern int not_exist (void);
  1543. inline int make_unique (void)
  1544. {
  1545. /* Static variables in inline functions and classes
  1546. generate STB_GNU_UNIQUE symbols. */
  1547. static int unique;
  1548. return ++unique;
  1549. }
  1550. int foo (void)
  1551. {
  1552. return make_unique () + not_exist ();
  1553. }
  1554. "
  1555. dnl Check if TEST_CXX supports STB_GNU_UNIQUE.
  1556. LIBC_TRY_TEST_CXX_COMMAND([for STB_GNU_UNIQUE],
  1557. [$conftest_code],
  1558. [-c],
  1559. libc_cv_test_stb_gnu_unique,
  1560. [
  1561. if LC_ALL=C $READELF -sW conftest \
  1562. | grep -q "UNIQUE.* _ZZ11make_uniquevE6unique"; then
  1563. libc_cv_test_stb_gnu_unique=yes
  1564. else
  1565. libc_cv_test_stb_gnu_unique=no
  1566. fi
  1567. ],
  1568. [libc_cv_test_stb_gnu_unique=no],
  1569. )
  1570. LIBC_CONFIG_VAR([have-test-stb-gnu-unique], [$libc_cv_test_stb_gnu_unique])
  1571. dnl Check whether we have the gd library available.
  1572. AC_MSG_CHECKING(for libgd)
  1573. if test "$with_gd" != "no"; then
  1574. old_CFLAGS="$CFLAGS"
  1575. CFLAGS="$CFLAGS $libgd_include"
  1576. old_LDFLAGS="$LDFLAGS"
  1577. LDFLAGS="$LDFLAGS $libgd_ldflags"
  1578. old_LIBS="$LIBS"
  1579. LIBS="$LIBS -lgd -lpng -lz -lm"
  1580. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gd.h>]], [[gdImagePng (0, 0)]])],
  1581. [LIBGD=yes], [LIBGD=no])
  1582. CFLAGS="$old_CFLAGS"
  1583. LDFLAGS="$old_LDFLAGS"
  1584. LIBS="$old_LIBS"
  1585. else
  1586. LIBGD=no
  1587. fi
  1588. AC_MSG_RESULT($LIBGD)
  1589. AC_SUBST(LIBGD)
  1590. # SELinux detection
  1591. if test x$with_selinux = xno ; then
  1592. have_selinux=no;
  1593. else
  1594. # See if we have the SELinux library
  1595. AC_CHECK_LIB(selinux, is_selinux_enabled,
  1596. have_selinux=yes, have_selinux=no)
  1597. if test x$with_selinux = xyes ; then
  1598. if test x$have_selinux = xno ; then
  1599. AC_MSG_ERROR([SELinux explicitly required, but SELinux library not found])
  1600. fi
  1601. fi
  1602. fi
  1603. # Check if we're building with SELinux support.
  1604. if test "x$have_selinux" = xyes; then
  1605. AC_DEFINE(HAVE_SELINUX, 1, [SELinux support])
  1606. # See if we have the libaudit library
  1607. AC_CHECK_LIB(audit, audit_log_user_avc_message,
  1608. have_libaudit=yes, have_libaudit=no)
  1609. if test "x$have_libaudit" = xyes; then
  1610. AC_DEFINE(HAVE_LIBAUDIT, 1, [SELinux libaudit support])
  1611. fi
  1612. AC_SUBST(have_libaudit)
  1613. # See if we have the libcap library
  1614. AC_CHECK_LIB(cap, cap_init, have_libcap=yes, have_libcap=no)
  1615. if test "x$have_libcap" = xyes; then
  1616. AC_DEFINE(HAVE_LIBCAP, 1, [SELinux libcap support])
  1617. fi
  1618. AC_SUBST(have_libcap)
  1619. fi
  1620. AC_SUBST(have_selinux)
  1621. dnl Check if we support the requested _FORTIFY_SOURCE level
  1622. dnl If not, then don't use it.
  1623. dnl Note that _FORTIFY_SOURCE may have been set through FLAGS too.
  1624. dnl _FORTIFY_SOURCE value will be selectively disabled for function that can't
  1625. dnl support it
  1626. no_fortify_source="-U_FORTIFY_SOURCE"
  1627. fortify_source="${no_fortify_source}"
  1628. LIBC_TRY_CC_AND_TEST_LINK([for maximum supported _FORTIFY_SOURCE level],
  1629. [__builtin_dynamic_object_size("", 0)],
  1630. libc_cv_supported_fortify_source,
  1631. [libc_cv_supported_fortify_source=3],
  1632. [libc_cv_supported_fortify_source=2],
  1633. libc_cv_test_supported_fortify_source,
  1634. [libc_cv_test_supported_fortify_source=3],
  1635. [libc_cv_test_supported_fortify_source=2])
  1636. AC_SUBST(libc_cv_test_supported_fortify_source)
  1637. AS_CASE([$enable_fortify_source],
  1638. [yes], [libc_cv_fortify_source=yes enable_fortify_source=$libc_cv_supported_fortify_source],
  1639. [1|2], [libc_cv_fortify_source=yes],
  1640. [3], [AS_IF([test $libc_cv_supported_fortify_source = 3],
  1641. [libc_cv_fortify_source=yes],
  1642. [AC_MSG_ERROR([Compiler doesn't provide necessary support for _FORTIFY_SOURCE=3])])],
  1643. [libc_cv_fortify_source=no])
  1644. AS_IF([test "$libc_cv_fortify_source" = yes],
  1645. [fortify_source="${fortify_source} -D_FORTIFY_SOURCE=${enable_fortify_source}"]
  1646. )
  1647. AC_SUBST(enable_fortify_source)
  1648. AC_SUBST(libc_cv_fortify_source)
  1649. AC_SUBST(no_fortify_source)
  1650. AC_SUBST(fortify_source)
  1651. LIBC_CONFIG_VAR([supported-fortify], [$libc_cv_supported_fortify_source])
  1652. dnl Check if compiler define _FILE_OFFSET_BITS by default
  1653. AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[]], [[
  1654. #ifndef _FILE_OFFSET_BITS
  1655. # error _FILE_OFFSET_BITS not defined
  1656. #endif]])],
  1657. [libc_cv_compiler_default_file_offset_bits=yes],
  1658. [libc_cv_compiler_default_file_offset_bits=no])
  1659. AS_IF([test "$libc_cv_compiler_default_file_offset_bits" = yes],
  1660. [no_file_offset_bits_source="-U_FILE_OFFSET_BITS"])
  1661. AC_SUBST(no_file_offset_bits_source)
  1662. LIBC_CONFIG_VAR([no-file-offset-bits-source], [$no_file_offset_bits_source])
  1663. dnl Check if compiler define _TIME_BITS by default
  1664. AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[]], [[
  1665. #ifndef _TIME_BITS
  1666. # error _TIME_BITS not defined
  1667. #endif]])],
  1668. [libc_cv_compiler_default_time_bits=yes],
  1669. [libc_cv_compiler_default_time_bits=no])
  1670. AS_IF([test "$libc_cv_compiler_default_time_bits" = yes],
  1671. [no_time_bits_source="-U_TIME_BITS"])
  1672. AC_SUBST(no_time_bits_source)
  1673. LIBC_CONFIG_VAR([no-time-bits-source], [$no_time_bits_source])
  1674. dnl Starting with binutils 2.35, GAS can attach multiple symbol versions
  1675. dnl to one symbol (PR 23840).
  1676. AC_CACHE_CHECK(whether the assembler requires one version per symbol,
  1677. libc_cv_symver_needs_alias, [dnl
  1678. cat > conftest.s <<EOF
  1679. .text
  1680. testfunc:
  1681. .globl testfunc
  1682. .symver testfunc, testfunc1@VERSION1
  1683. .symver testfunc, testfunc1@VERSION2
  1684. EOF
  1685. libc_cv_symver_needs_alias=no
  1686. if ${CC-cc} $ASFLAGS -c conftest.s 2>&AS_MESSAGE_LOG_FD; then
  1687. libc_cv_symver_needs_alias=no
  1688. else
  1689. libc_cv_symver_needs_alias=yes
  1690. fi
  1691. rm conftest.*
  1692. ])
  1693. if test "$libc_cv_symver_needs_alias" = yes; then
  1694. AC_DEFINE(SYMVER_NEEDS_ALIAS)
  1695. fi
  1696. AC_CACHE_CHECK(for __builtin_trap with no external dependencies,
  1697. libc_cv_builtin_trap, [dnl
  1698. libc_cv_builtin_trap=no
  1699. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[__builtin_trap ()]])],[
  1700. libc_undefs=`$NM -u conftest.o |
  1701. LC_ALL=C $AWK '$1 == "U" { print $2 | "sort -u"; next } { exit(1) }' \
  1702. 2>&AS_MESSAGE_LOG_FD` || {
  1703. AC_MSG_ERROR([confusing output from $NM -u])
  1704. }
  1705. echo >&AS_MESSAGE_LOG_FD "libc_undefs='$libc_undefs'"
  1706. if test -z "$libc_undefs"; then
  1707. libc_cv_builtin_trap=yes
  1708. fi],[])])
  1709. if test $libc_cv_builtin_trap = yes; then
  1710. AC_DEFINE([HAVE_BUILTIN_TRAP])
  1711. fi
  1712. dnl Check if
  1713. AC_CACHE_CHECK([whether the compiler supports __attribute__ ((aligned (65536)))],
  1714. libc_cv_aligned_65536, [
  1715. AC_COMPILE_IFELSE([AC_LANG_SOURCE([
  1716. char bss[0xb5dce8] __attribute__ ((aligned (65536)));
  1717. ])],
  1718. [libc_cv_aligned_65536=yes],
  1719. [libc_cv_aligned_65536=no])
  1720. ])
  1721. LIBC_CONFIG_VAR([aligned-65536], [$libc_cv_aligned_65536])
  1722. dnl C++ feature tests.
  1723. AC_LANG_PUSH([C++])
  1724. AC_CACHE_CHECK([whether the C++ compiler supports thread_local],
  1725. libc_cv_cxx_thread_local, [
  1726. old_CXXFLAGS="$CXXFLAGS"
  1727. CXXFLAGS="$CXXFLAGS -std=gnu++11"
  1728. AC_COMPILE_IFELSE([AC_LANG_SOURCE([
  1729. #include <thread>
  1730. // Compiler support.
  1731. struct S
  1732. {
  1733. S ();
  1734. ~S ();
  1735. };
  1736. thread_local S s;
  1737. S * get () { return &s; }
  1738. // libstdc++ support.
  1739. #ifndef _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL
  1740. #error __cxa_thread_atexit_impl not supported
  1741. #endif
  1742. ])],
  1743. [libc_cv_cxx_thread_local=yes],
  1744. [libc_cv_cxx_thread_local=no])
  1745. CXXFLAGS="$old_CXXFLAGS"
  1746. ])
  1747. AC_SUBST(libc_cv_cxx_thread_local)
  1748. AC_LANG_POP([C++])
  1749. dnl End of C++ feature tests.
  1750. ### End of automated tests.
  1751. ### Now run sysdeps configure fragments.
  1752. # They also can set these variables.
  1753. use_ldconfig=no
  1754. ldd_rewrite_script=no
  1755. libc_cv_sysconfdir=$sysconfdir
  1756. libc_cv_localstatedir=$localstatedir
  1757. libc_cv_gcc_unwind_find_fde=no
  1758. libc_cv_idn=no
  1759. pthread_in_libc=yes
  1760. abort_in_ld=no
  1761. # Iterate over all the sysdep directories we will use, running their
  1762. # configure fragments.
  1763. for dir in $sysnames; do
  1764. case $dir in
  1765. /*) dest=$dir ;;
  1766. *) dest=$srcdir/$dir ;;
  1767. esac
  1768. if test -r $dest/configure; then
  1769. AC_MSG_RESULT(running configure fragment for $dir)
  1770. . $dest/configure
  1771. fi
  1772. done
  1773. if test x"$build_mathvec" = xnotset; then
  1774. build_mathvec=no
  1775. fi
  1776. LIBC_CONFIG_VAR([build-mathvec], [$build_mathvec])
  1777. AC_SUBST(libc_extra_cflags)
  1778. AC_SUBST(libc_extra_cppflags)
  1779. if test x$libc_cv_gcc_unwind_find_fde = xyes; then
  1780. AC_DEFINE(EXPORT_UNWIND_FIND_FDE)
  1781. fi
  1782. AC_SUBST(libc_cv_gcc_unwind_find_fde)
  1783. # A sysdeps configure fragment can reset this if IFUNC is not actually
  1784. # usable even though the assembler knows how to generate the symbol type.
  1785. if test x"$libc_cv_ld_gnu_indirect_function" = xyes; then
  1786. AC_DEFINE(HAVE_IFUNC)
  1787. fi
  1788. LIBC_CONFIG_VAR([have-ifunc], [$libc_cv_ld_gnu_indirect_function])
  1789. if test x"$libc_cv_gcc_indirect_function" = xyes; then
  1790. AC_DEFINE(HAVE_GCC_IFUNC)
  1791. fi
  1792. LIBC_CONFIG_VAR([have-gcc-ifunc], [$libc_cv_gcc_indirect_function])
  1793. # This is far from the AC_ARG_ENABLE that sets it so that a sysdeps
  1794. # configure fragment can override the value to prevent this AC_DEFINE.
  1795. AC_SUBST(use_nscd)
  1796. if test "x$use_nscd" != xno; then
  1797. AC_DEFINE([USE_NSCD])
  1798. fi
  1799. if test "x$build_nscd" = xdefault; then
  1800. build_nscd=$use_nscd
  1801. fi
  1802. AC_SUBST(libc_cv_slibdir)
  1803. AC_SUBST(libc_cv_rtlddir)
  1804. AC_SUBST(libc_cv_complocaledir)
  1805. AC_SUBST(libc_cv_sysconfdir)
  1806. AC_SUBST(libc_cv_localstatedir)
  1807. AC_SUBST(libc_cv_rootsbindir)
  1808. if test x$use_ldconfig = xyes; then
  1809. AC_DEFINE(USE_LDCONFIG)
  1810. fi
  1811. AC_SUBST(use_ldconfig)
  1812. AC_SUBST(ldd_rewrite_script)
  1813. AC_SUBST(static)
  1814. AC_SUBST(shared)
  1815. AC_CACHE_CHECK([whether -fPIC is default], libc_cv_pic_default,
  1816. [libc_cv_pic_default=yes
  1817. cat > conftest.c <<EOF
  1818. #if defined __PIC__ || defined __pic__ || defined PIC || defined pic
  1819. # error PIC is default.
  1820. #endif
  1821. EOF
  1822. if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
  1823. libc_cv_pic_default=no
  1824. fi
  1825. rm -f conftest.*])
  1826. LIBC_CONFIG_VAR([build-pic-default], [$libc_cv_pic_default])
  1827. AC_CACHE_CHECK([whether -fPIE is default], libc_cv_cc_pie_default,
  1828. [libc_cv_cc_pie_default=yes
  1829. cat > conftest.c <<EOF
  1830. #if defined __PIE__ || defined __pie__ || defined PIE || defined pie
  1831. # error PIE is default.
  1832. #endif
  1833. EOF
  1834. if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
  1835. libc_cv_cc_pie_default=no
  1836. fi
  1837. rm -f conftest.*])
  1838. LIBC_CONFIG_VAR([cc-pie-default], [$libc_cv_cc_pie_default])
  1839. # Get Position Dependent Executable (PDE) load address to be used to
  1840. # load static Position Independent Executable (PIE) at a known working
  1841. # non-zero load address. This is only used by glibc tests to verify
  1842. # that PIE and static PIE with non-zero load address work correctly.
  1843. AC_CACHE_CHECK([PDE load address],
  1844. libc_cv_pde_load_address, [dnl
  1845. cat > conftest.S <<EOF
  1846. .globl _start
  1847. _start:
  1848. .globl __start
  1849. __start:
  1850. .byte 0
  1851. EOF
  1852. if test $libc_cv_cc_pie_default = yes; then
  1853. pde_ld_flags="-no-pie"
  1854. fi
  1855. if ${CC-cc} $pde_ld_flags $CFLAGS $CPPFLAGS $LDFLAGS \
  1856. -nostartfiles -nostdlib $no_ssp \
  1857. -o conftest conftest.S 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
  1858. # Get the load address of the first PT_LOAD segment.
  1859. libc_cv_pde_load_address=$(LC_ALL=C $READELF -Wl conftest \
  1860. | $AWK '/LOAD/ { print $3; exit 0; }')
  1861. else
  1862. AC_MSG_ERROR([${CC-cc} can not create PDE])
  1863. fi
  1864. rm -f conftest*])
  1865. LIBC_CONFIG_VAR([pde-load-address], [$libc_cv_pde_load_address])
  1866. # Get the linker command-line option to load executable at a non-zero
  1867. # load address. This is only used by glibc tests to verify that PIE and
  1868. # static PIE with non-zero load address work correctly.
  1869. LIBC_LINKER_FEATURE([-Ttext-segment=$libc_cv_pde_load_address],
  1870. [-Wl,-Ttext-segment=$libc_cv_pde_load_address],
  1871. [libc_cv_load_address_ldflag=-Wl,-Ttext-segment],
  1872. [libc_cv_load_address_ldflag=])
  1873. LIBC_CONFIG_VAR([load-address-ldflag], [$libc_cv_load_address_ldflag])
  1874. # Check if compiler supports -fno-fp-int-builtin-inexact
  1875. LIBC_TRY_CC_AND_TEST_CC_OPTION([if compiler supports -fno-fp-int-builtin-inexact],
  1876. [-Werror -fno-fp-int-builtin-inexact],
  1877. libc_cv_cc_no_fp_builtin_inexact,
  1878. [libc_cv_cc_no_fp_builtin_inexact=-fno-fp-int-builtin-inexact],
  1879. [libc_cv_cc_no_fp_builtin_inexact=],
  1880. libc_cv_test_cc_no_fp_builtin_inexact,
  1881. [libc_cv_test_cc_no_fp_builtin_inexact=-fno-fp-int-builtin-inexact],
  1882. [libc_cv_test_cc_no_fp_builtin_inexact=])
  1883. LIBC_CONFIG_VAR([config-cflags-no-fp-builtin-inexact], [$libc_cv_cc_no_fp_builtin_inexact])
  1884. LIBC_LINKER_FEATURE([--undefined-version], [-Wl,--undefined-version],
  1885. [libc_cv_ld_undefined_version=-Wl,--undefined-version],
  1886. [libc_cv_ld_undefined_version=])
  1887. LIBC_CONFIG_VAR([have-undefined-version], [$libc_cv_ld_undefined_version])
  1888. AC_MSG_CHECKING(if we can build programs as PIE)
  1889. AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifdef PIE_UNSUPPORTED
  1890. # error PIE is not supported
  1891. #endif]])], [libc_cv_pie_supported=yes], [libc_cv_pie_supported=no])
  1892. AC_MSG_RESULT($libc_cv_pie_supported)
  1893. # Disable build-pie-default if target does not support it or glibc is
  1894. # configured with --disable-default-pie.
  1895. if test "x$default_pie" = xno; then
  1896. build_pie_default=no
  1897. else
  1898. build_pie_default=$libc_cv_pie_supported
  1899. fi
  1900. LIBC_CONFIG_VAR([build-pie-default], [$build_pie_default])
  1901. AC_MSG_CHECKING(if we can build static PIE programs)
  1902. libc_cv_static_pie_supported=$libc_cv_pie_supported
  1903. if test "x$libc_cv_pie_supported" != xno \
  1904. -a "$libc_cv_no_dynamic_linker" = yes; then
  1905. AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifndef SUPPORT_STATIC_PIE
  1906. # error static PIE is not supported
  1907. #endif]])], [libc_cv_static_pie_supported=yes],
  1908. [libc_cv_static_pie_supported=no])
  1909. fi
  1910. AC_MSG_RESULT($libc_cv_static_pie_supported)
  1911. # Enable static-pie only if it is available and glibc isn't configured
  1912. # with --disable-default-pie.
  1913. if test "x$default_pie" = xno; then
  1914. libc_cv_static_pie=no
  1915. else
  1916. libc_cv_static_pie=$libc_cv_static_pie_supported
  1917. fi
  1918. if test "$libc_cv_static_pie" = "yes"; then
  1919. AC_DEFINE(ENABLE_STATIC_PIE)
  1920. fi
  1921. LIBC_CONFIG_VAR([enable-static-pie], [$libc_cv_static_pie])
  1922. # Check if we can link support functionality against libgcc_s.
  1923. # Must not be used for linking installed binaries, to produce the
  1924. # same binaries for bootstrapped and bootstrapping builds (the latter
  1925. # with a GCC that does not build libgcc_s).
  1926. AC_CACHE_CHECK([whether $CC can link against -lgcc_s], libc_cv_have_libgcc_s, [dnl
  1927. old_LIBS="$LIBS"
  1928. LIBS="$LIBS -lgcc_s"
  1929. AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
  1930. [libc_cv_have_libgcc_s=yes], [libc_cv_have_libgcc_s=no])
  1931. LIBS="$old_LIBS"])
  1932. LIBC_CONFIG_VAR([have-libgcc_s], [$libc_cv_have_libgcc_s])
  1933. # Support configure.ac under sysdeps.
  1934. AC_SUBST(libc_cv_test_cc_mprefer_vector_width)
  1935. AC_SUBST(test_enable_cet)
  1936. enable_gsframe=no
  1937. if test $use_sframe = yes; then
  1938. # SFrame requires to be explicit enabled by the architecture
  1939. if test -z $libc_cv_support_sframe; then
  1940. AC_MSG_FAILURE([the architecture doesn't support SFrame])
  1941. fi
  1942. # SFrame requires binutils 2.45 or higher.
  1943. libc_cv_sframe_readelf_version=yes
  1944. AC_CHECK_PROG_VER(READELF, $READELF, --version,
  1945. [GNU readelf.* \([0-9][0-9]*\.[0-9.]*\)],
  1946. [2.4[5-9]*|2.[5-9][0-9]*|2.[1-9][0-9][0-9]*|[3-9]*|[1-9][0-9]*],
  1947. libc_cv_sframe_readelf_version=no)
  1948. if test $libc_cv_sframe_readelf_version = no; then
  1949. AC_MSG_FAILURE([binutils too old to enable SFrame])
  1950. fi
  1951. # Check if the current toolchain supports SFrame
  1952. AC_CACHE_CHECK([for SFrame support], libc_cv_default_sframe,
  1953. [dnl
  1954. cat > conftest.c <<EOF
  1955. int test_function(void)
  1956. {
  1957. return 42;
  1958. }
  1959. EOF
  1960. libc_cv_default_sframe=no
  1961. if ${CC} -c conftest.c -o conftest.o -Wa,--gsframe >/dev/null 2>&1 && \
  1962. # Check if .sframe section is present and if version > 1
  1963. $READELF --sframe conftest.o | grep "SFRAME_VER" | grep -qv "VERSION_1"; then
  1964. libc_cv_default_sframe=yes
  1965. fi
  1966. rm -f conftest.c conftest.o
  1967. ])
  1968. if test $libc_cv_default_sframe = no; then
  1969. AC_MSG_FAILURE([toolchain doesn't support SFrame v2 or higher])
  1970. fi
  1971. enable_gsframe=yes
  1972. AC_DEFINE(ENABLE_SFRAME)
  1973. fi
  1974. LIBC_CONFIG_VAR([enable-gsframe], [$enable_gsframe])
  1975. # Set the `multidir' variable by grabbing the variable from the compiler.
  1976. # We do it once and save the result in a generated makefile.
  1977. libc_cv_multidir=`${CC-cc} $CFLAGS $CPPFLAGS -print-multi-directory`
  1978. AC_SUBST(libc_cv_multidir)
  1979. AC_SUBST(profile)
  1980. AC_SUBST(static_nss)
  1981. AC_SUBST(DEFINES)
  1982. dnl See sysdeps/mach/configure.ac for this variable.
  1983. AC_SUBST(mach_interface_list)
  1984. VERSION=`sed -n -e 's/^#define VERSION "\([^"]*\)"/\1/p' < $srcdir/version.h`
  1985. RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h`
  1986. AC_SUBST(VERSION)
  1987. AC_SUBST(RELEASE)
  1988. if test "$pthread_in_libc" = yes; then
  1989. AC_DEFINE(PTHREAD_IN_LIBC)
  1990. fi
  1991. AC_SUBST(pthread_in_libc)
  1992. # Some symbols that might be auto-generated by the compiler are redefined
  1993. # to internal alias (for instance mempcpy to __mempcpy). However, if fortify
  1994. # is enabled, the fortify wrapper is define before the alias re-defined and
  1995. # clang warns attribute declaration must precede definition.
  1996. AC_CACHE_CHECK([attribute can declared after function declaration],
  1997. libc_cv_attr_after_func_decl, [dnl
  1998. cat > conftest.c <<EOF
  1999. extern __inline int foo (void) { return 0; };
  2000. extern __typeof (foo) foo __asm__ ("__foo");
  2001. EOF
  2002. libc_cv_attr_after_func_decl=no
  2003. if ${CC-cc} $CFLAGS $CPPFLAGS -fgnu89-inline -Werror conftest.c -c \
  2004. 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
  2005. libc_cv_attr_after_func_decl=yes
  2006. fi
  2007. rm -rf conftest*])
  2008. if test "$libc_cv_attr_after_func_decl" = yes; then
  2009. AC_DEFINE(ATTR_AFTER_FUNC_DECL)
  2010. fi
  2011. LIBC_CONFIG_VAR([abort-in-ld],[$abort_in_ld]);
  2012. AC_CONFIG_FILES([config.make Makefile])
  2013. AC_CONFIG_COMMANDS([default],[[
  2014. case $CONFIG_FILES in *config.make*)
  2015. echo "$config_vars" >> config.make;;
  2016. esac
  2017. test -d bits || mkdir bits]],[[config_vars='$config_vars']])
  2018. AC_OUTPUT