aclocal.m4 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  1. dnl We require that everyone use exactly the same Autoconf version so that
  2. dnl the internal functions defined and used by the main configure script
  3. dnl match those expected by the fragments. When changing this version,
  4. dnl install.texi also needs to be updated.
  5. m4_define([GLIBC_AUTOCONF_VERSION], [2.72])
  6. m4_if(m4_defn([AC_AUTOCONF_VERSION]), GLIBC_AUTOCONF_VERSION, [],
  7. [m4_fatal(m4_flatten(
  8. Exactly version GLIBC_AUTOCONF_VERSION of Autoconf is required but you have
  9. m4_defn([AC_AUTOCONF_VERSION])
  10. ), [63])])dnl
  11. dnl
  12. dnl We define the macro GLIBC_PROVIDES to do an AC_PROVIDE for each macro
  13. dnl which appears in configure.ac before the sysdep configure scripts are run.
  14. dnl Each sysdep configure.ac does GLIBC_PROVIDES first, to avoid any
  15. dnl AC_REQUIREs or AC_BEFOREs duplicating their code.
  16. dnl
  17. define([GLIBC_PROVIDES], [dnl
  18. AC_PROVIDE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
  19. AC_PROVIDE([AC_CONFIG_SUBDIRS])dnl
  20. AC_PROVIDE([_AS_ECHO_N_PREPARE])dnl
  21. AC_PROVIDE([_AS_ECHO_PREPARE])dnl
  22. AC_PROVIDE([_AS_CR_PREPARE])dnl
  23. AC_PROVIDE([_AS_TR_SH_PREPARE])dnl
  24. AC_PROVIDE([_AS_VAR_ARITH_PREPARE])dnl
  25. AC_PROVIDE([AC_PROG_INSTALL])dnl
  26. AC_PROVIDE([AC_PROG_CC])dnl
  27. AC_PROVIDE([AC_PROG_CPP])dnl
  28. AC_PROVIDE([_AS_PATH_SEPARATOR_PREPARE])dnl
  29. AC_PROVIDE([_AS_TEST_PREPARE])dnl
  30. AC_PROVIDE([_AS_BASENAME_PREPARE])dnl
  31. AC_PROVIDE([_AS_ME_PREPARE])dnl
  32. AC_PROVIDE([_AS_LINENO_PREPARE])dnl
  33. AC_PROVIDE([AS_SHELL_FN_as_fn_set_status])dnl
  34. AC_PROVIDE([AS_SHELL_FN_as_fn_exit])dnl
  35. AC_PROVIDE([AS_SHELL_FN_as_fn_arith])dnl
  36. AC_PROVIDE([AS_SHELL_FN_ac_fn_c_try_compile])dnl
  37. AC_PROVIDE([AS_SHELL_FN_ac_fn_c_try_cpp])dnl
  38. define([AS_MESSAGE_LOG_FD],5)dnl
  39. define([AS_MESSAGE_FD],6)dnl
  40. dnl Ripped out of AS_INIT, which does more cruft we do not want.
  41. m4_wrap([m4_divert_pop([BODY])[]])
  42. m4_divert_push([BODY])[]dnl
  43. dnl End of ripped out of AS_INIT.
  44. # This file is generated from configure.ac by Autoconf. DO NOT EDIT!
  45. define([_AC_LANG], [C])dnl
  46. ])dnl
  47. dnl
  48. dnl Check for a symbol
  49. dnl
  50. AC_DEFUN([AC_CHECK_SYMBOL], [dnl
  51. AC_MSG_CHECKING(for $1)
  52. AC_CACHE_VAL(ac_cv_check_symbol_$1, [dnl
  53. AC_TRY_LINK(,
  54. changequote(,)dnl
  55. extern char *$1[]; puts(*$1);,
  56. changequote([,])dnl
  57. ac_cv_check_symbol_$1=yes, ac_cv_check_symbol_$1=no)])
  58. if test "$ac_cv_check_symbol_$1" = yes; then
  59. changequote(,)dnl
  60. ac_tr_symbol=`echo $1 | tr '[a-z]' '[A-Z]'`
  61. changequote([,])dnl
  62. AC_DEFINE_UNQUOTED(HAVE_${ac_tr_symbol})
  63. fi
  64. AC_MSG_RESULT($ac_cv_check_symbol_$1)])dnl
  65. dnl
  66. dnl Locate a program and check that its version is acceptable.
  67. dnl AC_PROG_CHECK_VER(var, namelist, version-switch,
  68. dnl [version-extract-regexp], version-glob [, do-if-fail])
  69. AC_DEFUN([AC_CHECK_PROG_VER],
  70. [AC_CHECK_PROGS([$1], [$2])
  71. if test -z "[$]$1"; then
  72. ac_verc_fail=yes
  73. else
  74. # Found it, now check the version.
  75. AC_MSG_CHECKING([version of [$]$1])
  76. changequote(<<,>>)dnl
  77. ac_prog_version=`<<$>>$1 $3 2>&1 ifelse(<<$4>>,,,
  78. <<| sed -n 's/^.*patsubst(<<$4>>,/,\/).*$/\1/p'>>)`
  79. case $ac_prog_version in
  80. '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
  81. <<$5>>)
  82. changequote([,])dnl
  83. ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
  84. *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
  85. esac
  86. AC_MSG_RESULT([$ac_prog_version])
  87. fi
  88. ifelse([$6],,,
  89. [if test $ac_verc_fail = yes; then
  90. $6
  91. fi])
  92. ])
  93. dnl These modifications are to allow for an empty cross compiler tree.
  94. define([_AC_COMPILER_EXEEXT], [EXEEXT=
  95. ])
  96. AC_DEFUN([LIBC_PROG_FOO_GNU],
  97. [# Most GNU programs take a -v and spit out some text including
  98. # the word 'GNU'. Some try to read stdin, so give them /dev/null.
  99. if $1 -o conftest -v </dev/null 2>&1 | grep GNU > /dev/null 2>&1; then
  100. $2
  101. else
  102. $3
  103. fi
  104. rm -fr contest*])
  105. AC_DEFUN([LIBC_PROG_BINUTILS],
  106. [# Was a --with-binutils option given?
  107. if test -n "$path_binutils"; then
  108. # Make absolute; ensure a single trailing slash.
  109. path_binutils=`(cd $path_binutils; pwd) | sed 's%/*$%/%'`
  110. CC="$CC -B$path_binutils"
  111. fi
  112. case "$CC" in
  113. *fuse-ld=lld*) LDNAME=ld.lld;;
  114. *) LDNAME=ld;;
  115. esac
  116. if test -z "$LD"; then
  117. LD=`$CC -print-prog-name=$LDNAME`
  118. fi
  119. if test -z "$AR"; then
  120. AR=`$CC -print-prog-name=ar`
  121. fi
  122. AC_SUBST(AR)
  123. if test -z "$OBJCOPY"; then
  124. OBJCOPY=`$CC -print-prog-name=objcopy`
  125. fi
  126. AC_SUBST(OBJCOPY)
  127. if test -z "$GPROF"; then
  128. GPROF=`$CC -print-prog-name=gprof`
  129. fi
  130. AC_SUBST(GPROF)
  131. if test -z "$READELF"; then
  132. READELF=`$CC -print-prog-name=readelf`
  133. fi
  134. AC_SUBST(READELF)
  135. if test -z "$OBJDUMP"; then
  136. OBJDUMP=`$CC -print-prog-name=objdump`
  137. fi
  138. AC_SUBST(OBJDUMP)
  139. if test -z "$NM"; then
  140. NM=`$CC -print-prog-name=nm`
  141. fi
  142. AC_SUBST(NM)
  143. if test -z "$STRIP"; then
  144. STRIP=`$CC -print-prog-name=strip`
  145. fi
  146. AC_SUBST(STRIP)
  147. ])
  148. dnl Run a static link test with -nostdlib -nostartfiles.
  149. dnl LIBC_TRY_LINK_STATIC([code], [action-if-true], [action-if-false])
  150. AC_DEFUN([LIBC_TRY_LINK_STATIC],
  151. [cat > conftest.c <<EOF
  152. int _start (void) { return 0; }
  153. int __start (void) { return 0; }
  154. $1
  155. EOF
  156. AS_IF([AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -o conftest
  157. conftest.c -static -nostartfiles -nostdlib
  158. 1>&AS_MESSAGE_LOG_FD])],
  159. [$2], [$3])
  160. rm -f conftest*])
  161. dnl Test a compiler option or options with an empty input file.
  162. dnl LIBC_TRY_CC_OPTION([options], [action-if-true], [action-if-false])
  163. AC_DEFUN([LIBC_TRY_CC_OPTION],
  164. [AS_IF([AC_TRY_COMMAND([${CC-cc} $1 -xc /dev/null -S -o /dev/null])],
  165. [$2], [$3])])
  166. dnl Test a C++ compiler option or options with an empty input file.
  167. dnl LIBC_TRY_CXX_OPTION([options], [action-if-true], [action-if-false])
  168. AC_DEFUN([LIBC_TRY_CXX_OPTION],
  169. [AS_IF([AC_TRY_COMMAND([${CXX-c++} $1 -xc++ /dev/null -S -o /dev/null])],
  170. [$2], [$3])])
  171. dnl Find and source sysdeps/*/preconfigure.
  172. dnl LIBC_PRECONFIGURE([$srcdir], [for])
  173. AC_DEFUN([LIBC_PRECONFIGURE], [dnl
  174. if frags=`ls -d $1/sysdeps/*/preconfigure 2> /dev/null`
  175. then
  176. AC_MSG_CHECKING($2 preconfigure fragments)
  177. for frag in $frags; do
  178. name=`echo "$frag" | sed 's@/[[^/]]*[$]@@;s@^.*/@@'`
  179. echo $ECHO_N "$name $ECHO_C" >&AS_MESSAGE_FD
  180. . "$frag"
  181. done
  182. AC_MSG_RESULT()
  183. fi])
  184. # These two macros are taken from GCC's config/acx.m4.
  185. dnl Support the --with-pkgversion configure option.
  186. dnl ACX_PKGVERSION(default-pkgversion)
  187. AC_DEFUN([ACX_PKGVERSION],[
  188. AC_ARG_WITH(pkgversion,
  189. AS_HELP_STRING([--with-pkgversion=PKG],
  190. [Use PKG in the version string in place of "$1"]),
  191. [case "$withval" in
  192. yes) AC_MSG_ERROR([package version not specified]) ;;
  193. no) PKGVERSION= ;;
  194. *) PKGVERSION="($withval) " ;;
  195. esac],
  196. PKGVERSION="($1) "
  197. )
  198. PKGVERSION_TEXI=`echo "$PKGVERSION" | sed 's/@/@@/g'`
  199. AC_SUBST(PKGVERSION)
  200. AC_SUBST(PKGVERSION_TEXI)
  201. ])
  202. dnl Support the --with-bugurl configure option.
  203. dnl ACX_BUGURL(default-bugurl)
  204. AC_DEFUN([ACX_BUGURL],[
  205. AC_ARG_WITH(bugurl,
  206. AS_HELP_STRING([--with-bugurl=URL],
  207. [Direct users to URL to report a bug]),
  208. [case "$withval" in
  209. yes) AC_MSG_ERROR([bug URL not specified]) ;;
  210. no) BUGURL=
  211. ;;
  212. *) BUGURL="$withval"
  213. ;;
  214. esac],
  215. BUGURL="$1"
  216. )
  217. case ${BUGURL} in
  218. "")
  219. REPORT_BUGS_TO=
  220. REPORT_BUGS_TEXI=
  221. ;;
  222. *)
  223. REPORT_BUGS_TO="<$BUGURL>"
  224. REPORT_BUGS_TEXI=@uref{`echo "$BUGURL" | sed 's/@/@@/g'`}
  225. ;;
  226. esac;
  227. AC_SUBST(REPORT_BUGS_TO)
  228. AC_SUBST(REPORT_BUGS_TEXI)
  229. ])
  230. dnl Check linker option support.
  231. dnl LIBC_LINKER_FEATURE([ld_option], [cc_option], [action-if-true], [action-if-false])
  232. AC_DEFUN([LIBC_LINKER_FEATURE],
  233. [AC_MSG_CHECKING([for linker that supports $1])
  234. libc_linker_feature=no
  235. cat > conftest.c <<EOF
  236. int _start (void) { return 42; }
  237. EOF
  238. if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
  239. $2 -nostdlib -nostartfiles
  240. -fPIC -shared -o conftest.so conftest.c
  241. 1>&AS_MESSAGE_LOG_FD])
  242. then
  243. if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp $2 -nostdlib \
  244. -nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \
  245. | grep "warning: $1 ignored" > /dev/null 2>&1; then
  246. true
  247. else
  248. libc_linker_feature=yes
  249. fi
  250. fi
  251. rm -f conftest*
  252. if test $libc_linker_feature = yes; then
  253. $3
  254. else
  255. $4
  256. fi
  257. AC_MSG_RESULT($libc_linker_feature)])
  258. dnl Check linker option support.
  259. dnl LIBC_TEST_LINKER_FEATURE([ld_option], [cc_option], [action-if-true], [action-if-false])
  260. AC_DEFUN([LIBC_TEST_LINKER_FEATURE],
  261. [AC_MSG_CHECKING([for linker that supports $1])
  262. libc_linker_feature=no
  263. cat > conftest.c <<EOF
  264. int _start (void) { return 42; }
  265. EOF
  266. saved_CC="$CC"
  267. CC="$TEST_CC"
  268. if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
  269. $2 -nostdlib -nostartfiles
  270. -fPIC -shared -o conftest.so conftest.c
  271. 1>&AS_MESSAGE_LOG_FD])
  272. then
  273. if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp $2 -nostdlib \
  274. -nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \
  275. | grep "warning: $1 ignored" > /dev/null 2>&1; then
  276. true
  277. else
  278. libc_linker_feature=yes
  279. fi
  280. fi
  281. rm -f conftest*
  282. if test $libc_linker_feature = yes; then
  283. $3
  284. else
  285. $4
  286. fi
  287. CC="$saved_CC"
  288. AC_MSG_RESULT($libc_linker_feature)])
  289. dnl Add a makefile variable, with value set from a shell string
  290. dnl (expanded by the shell inside double quotes), to config.make.
  291. dnl LIBC_CONFIG_VAR(make-variable, shell-value)
  292. AC_DEFUN([LIBC_CONFIG_VAR],
  293. [config_vars="$config_vars
  294. $1 = $2"])
  295. dnl Check that function FUNC was inlined as a builtin. The code fragment
  296. dnl CODE is compiled with additional options CC_OPTION. If FUNC is
  297. dnl not found in the assembly then it is assumed the compiler has support
  298. dnl for this builtin and has inlined the call. If the compiler has the
  299. dnl feature then ACTION-IF-TRUE is called, otherwise ACTION-IF-FALSE.
  300. dnl It is up to the caller to provide a CC_OPTION that ensures the
  301. dnl builtin is inlined if present.
  302. dnl Warning: This may not work for some machines. For example on ARM the
  303. dnl ABI dictates that some functions should not be inlined and instead
  304. dnl should be provided by a compiler helper library e.g. __aeabi_memcpy.
  305. dnl This is done to reduce code size.
  306. dnl LIBC_COMPILER_BUILTIN([func], [code], [cc_option], [action-if-true], [action-if-false])
  307. AC_DEFUN([LIBC_COMPILER_BUILTIN_INLINED],
  308. [AC_MSG_CHECKING([for compiler support of inlined builtin function $1])
  309. libc_compiler_builtin_inlined=no
  310. cat > conftest.c <<EOF
  311. int _start (void) { $2 return 0; }
  312. EOF
  313. if ! AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
  314. $3 -nostdlib -nostartfiles
  315. -S conftest.c -o - | grep -F "$1"
  316. 1>&AS_MESSAGE_LOG_FD])
  317. then
  318. libc_compiler_builtin_inlined=yes
  319. fi
  320. rm -f conftest*
  321. if test $libc_compiler_builtin_inlined = yes; then
  322. $4
  323. else
  324. $5
  325. fi
  326. AC_MSG_RESULT($libc_compiler_builtin_inlined)])
  327. dnl Default to slibdir named SLIBDIR instead of "lib", and rtlddir
  328. dnl named RTLDDIR instead of "lib". This is used to put 64-bit
  329. dnl libraries in /lib64.
  330. dnl LIBC_SLIBDIR_RTLDDIR([slibdir], [rtlddir])
  331. AC_DEFUN([LIBC_SLIBDIR_RTLDDIR],
  332. [test -n "$libc_cv_slibdir" ||
  333. case "$prefix" in
  334. /usr | /usr/)
  335. libc_cv_slibdir='/$1'
  336. libc_cv_rtlddir='/$2'
  337. if test "$libdir" = '${exec_prefix}/lib'; then
  338. libdir='${exec_prefix}/$1';
  339. # Locale data can be shared between 32-bit and 64-bit libraries.
  340. libc_cv_complocaledir='${exec_prefix}/lib/locale'
  341. fi
  342. ;;
  343. esac])
  344. dnl Test a CC compiler option or options with an input file.
  345. dnl LIBC_TRY_CC_COMMAND([message], [code], [options],
  346. dnl [CC-cache-id], [CC-action-if-true], [CC-action-if-false])
  347. AC_DEFUN([LIBC_TRY_CC_COMMAND],
  348. [
  349. cat > conftest.c <<EOF
  350. $2
  351. EOF
  352. AC_CACHE_CHECK([$1], $4, [dnl
  353. if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $3 conftest.c -o conftest 1>&AS_MESSAGE_LOG_FD])
  354. then
  355. [$5]
  356. else
  357. [$6]
  358. fi])
  359. rm -f conftest*])
  360. dnl Run a test with TEST_CC.
  361. dnl LIBC_CHECK_TEST_CC([commands])
  362. AC_DEFUN([LIBC_CHECK_TEST_CC],
  363. [
  364. saved_CC="$CC"
  365. CC="$TEST_CC"
  366. [$1]
  367. CC="$saved_CC"
  368. ])
  369. dnl Run a test with TEST_CXX.
  370. dnl LIBC_CHECK_TEST_CXX([commands])
  371. AC_DEFUN([LIBC_CHECK_TEST_CXX],
  372. [
  373. saved_CXX="$CXX"
  374. CXX="$TEST_CXX"
  375. [$1]
  376. CXX="$saved_CXX"
  377. ])
  378. dnl Test a CC and TEST_CC compiler option or options with an empty input
  379. dnl file.
  380. dnl LIBC_TRY_CC_AND_TEST_CC_OPTION([message], [options],
  381. dnl [CC-cache-id], [CC-action-if-true], [CC-action-if-false]
  382. dnl [TEST_CC-cache-id], [TEST_CC-action-if-true], [TEST_CC-action-if-false])
  383. AC_DEFUN([LIBC_TRY_CC_AND_TEST_CC_OPTION],
  384. [
  385. AC_CACHE_CHECK([$1], $3,
  386. [LIBC_TRY_CC_OPTION([$2], [$4], [$5])])
  387. if test "$TEST_CC" = "$CC"; then
  388. $6=$[$3]
  389. else
  390. LIBC_CHECK_TEST_CC(
  391. AC_CACHE_CHECK([$1 in testing], $6,
  392. [LIBC_TRY_CC_OPTION([$2], [$7], [$8])])
  393. )
  394. fi
  395. ])
  396. dnl Test a CC and TEST_CC compiler option or options with an input file.
  397. dnl LIBC_TRY_CC_AND_TEST_CC_COMMAND([message], [code], [options],
  398. dnl [CC-cache-id], [CC-action-if-true], [CC-action-if-false]
  399. dnl [TEST_CC-cache-id], [TEST_CC-action-if-true], [TEST_CC-action-if-false])
  400. AC_DEFUN([LIBC_TRY_CC_AND_TEST_CC_COMMAND],
  401. [
  402. cat > conftest.c <<EOF
  403. $2
  404. EOF
  405. AC_CACHE_CHECK([$1], $4, [dnl
  406. if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $3 conftest.c -o conftest 1>&AS_MESSAGE_LOG_FD])
  407. then
  408. [$5]
  409. else
  410. [$6]
  411. fi
  412. ])
  413. if test "$TEST_CC" = "$CC"; then
  414. $7=$[$4]
  415. else
  416. LIBC_CHECK_TEST_CC(
  417. AC_CACHE_CHECK([$1 in testing], $7, [dnl
  418. if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $3 conftest.c -o conftest 1>&AS_MESSAGE_LOG_FD])
  419. then
  420. [$8]
  421. else
  422. [$9]
  423. fi])
  424. )
  425. fi
  426. rm -f conftest*])
  427. dnl Test if CC and TEST_CC can link with an input file.
  428. dnl LIBC_TRY_CC_AND_TEST_LINK([message], [code],
  429. dnl [CC-cache-id], [CC-action-if-true], [CC-action-if-false]
  430. dnl [TEST_CC-cache-id], [TEST_CC-action-if-true], [TEST_CC-action-if-false])
  431. AC_DEFUN([LIBC_TRY_CC_AND_TEST_LINK],
  432. [
  433. AC_CACHE_CHECK([$1], $3, [
  434. AC_LINK_IFELSE([AC_LANG_PROGRAM([], [$2])],
  435. [$4], [$5])
  436. ])
  437. if test "$TEST_CC" = "$CC"; then
  438. $6=$[$3]
  439. else
  440. LIBC_CHECK_TEST_CC(
  441. AC_CACHE_CHECK([$1 in testing], $6, [
  442. AC_LINK_IFELSE([AC_LANG_PROGRAM([], [$2])],
  443. [$7], [$8])
  444. ])
  445. )
  446. fi
  447. ])
  448. dnl Test a TEST_CC compiler option or options with an input file.
  449. dnl LIBC_TRY_TEST_CC_COMMAND([message], [code], [options],
  450. dnl [TEST_CC-cache-id], [TEST_CC-action-if-true], [TEST_CC-action-if-false])
  451. AC_DEFUN([LIBC_TRY_TEST_CC_COMMAND],
  452. [
  453. cat > conftest.c <<EOF
  454. $2
  455. EOF
  456. LIBC_CHECK_TEST_CC(
  457. AC_CACHE_CHECK([$1 in testing], $4, [dnl
  458. if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $3 conftest.c -o conftest 1>&AS_MESSAGE_LOG_FD])
  459. then
  460. [$5]
  461. else
  462. [$6]
  463. fi])
  464. )
  465. rm -f conftest*])
  466. dnl Test a TEST_CXX compiler option or options with an input file.
  467. dnl LIBC_TRY_TEST_CXX_COMMAND([message], [code], [options],
  468. dnl [TEST_CXX-cache-id], [TEST_CXX-action-if-true],
  469. dnl [TEST_CXX-action-if-false])
  470. AC_DEFUN([LIBC_TRY_TEST_CXX_COMMAND],
  471. [
  472. cat > conftest.cc <<EOF
  473. $2
  474. EOF
  475. LIBC_CHECK_TEST_CXX(
  476. AC_CACHE_CHECK([$1 in testing], $4, [dnl
  477. if AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS $3 conftest.cc -o conftest 1>&AS_MESSAGE_LOG_FD])
  478. then
  479. [$5]
  480. else
  481. [$6]
  482. fi])
  483. )
  484. rm -f conftest*])
  485. dnl Test a TEST_CC compiler option or options with an empty input file.
  486. dnl LIBC_TRY_TEST_CC_OPTION([message], [options],
  487. dnl [TEST_CC-cache-id], [TEST_CC-action-if-true], [TEST_CC-action-if-false])
  488. AC_DEFUN([LIBC_TRY_TEST_CC_OPTION],
  489. [
  490. LIBC_CHECK_TEST_CC(
  491. AC_CACHE_CHECK([$1 in testing], $3,
  492. [LIBC_TRY_CC_OPTION([$2], [$4], [$5])])
  493. )
  494. ])
  495. dnl Test a TEST_CXX compiler option or options with an empty input file.
  496. dnl LIBC_TRY_TEST_CXX_OPTION([message], [options],
  497. dnl [TEST_CXX-cache-id], [TEST_CXX-action-if-true],
  498. dnl [TEST_CXX-action-if-false])
  499. AC_DEFUN([LIBC_TRY_TEST_CXX_OPTION],
  500. [
  501. LIBC_CHECK_TEST_CXX(
  502. AC_CACHE_CHECK([$1 in testing], $3,
  503. [LIBC_TRY_CXX_OPTION([$2], [$4], [$5])])
  504. )
  505. ])
  506. dnl Check if toolchain supports generating binaries with the required
  507. dnl ELF marking as checked by readelf.
  508. dnl LIBC_CHECK_ELF_PROPERTY([message], [pattern], [action-if-true], [action-if-false])
  509. AC_DEFUN([LIBC_CHECK_ELF_PROPERTY],
  510. [AC_MSG_CHECKING([$1])
  511. libc_elf_property=no
  512. cat > conftest.c <<EOF
  513. int foo (void) { return 42; }
  514. EOF
  515. if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
  516. -fPIC -shared -o conftest.so conftest.c
  517. 1>&AS_MESSAGE_LOG_FD])
  518. then
  519. if AC_TRY_COMMAND([LC_ALL=C $READELF -n --wide conftest.so | grep "$2" 1>&AS_MESSAGE_LOG_FD])
  520. then
  521. libc_elf_property=yes
  522. else
  523. libc_elf_property=no
  524. fi
  525. fi
  526. rm -f conftest*
  527. if test $libc_elf_property = yes; then
  528. $3
  529. else
  530. $4
  531. fi
  532. AC_MSG_RESULT($libc_elf_property)])