mirror of
git://sourceware.org/git/glibc.git
synced 2025-03-06 20:58:33 +01:00
Check if clang and clang++ are used to test glibc
Set have-test-clang to yes if clang is used to test glibc. Set have-test-clangxx to yes if clang++ is used to test glibc. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Sam James <sam@gentoo.org>
This commit is contained in:
parent
cd90d3ca7d
commit
eb02fb7739
3 changed files with 149 additions and 0 deletions
49
aclocal.m4
vendored
49
aclocal.m4
vendored
|
@ -326,6 +326,16 @@ CC="$TEST_CC"
|
||||||
CC="$saved_CC"
|
CC="$saved_CC"
|
||||||
])
|
])
|
||||||
|
|
||||||
|
dnl Run a test with TEST_CXX.
|
||||||
|
dnl LIBC_CHECK_TEST_CXX([commands])
|
||||||
|
AC_DEFUN([LIBC_CHECK_TEST_CXX],
|
||||||
|
[
|
||||||
|
saved_CXX="$CXX"
|
||||||
|
CXX="$TEST_CXX"
|
||||||
|
[$1]
|
||||||
|
CXX="$saved_CXX"
|
||||||
|
])
|
||||||
|
|
||||||
dnl Test a CC and TEST_CC compiler option or options with an empty input
|
dnl Test a CC and TEST_CC compiler option or options with an empty input
|
||||||
dnl file.
|
dnl file.
|
||||||
dnl LIBC_TRY_CC_AND_TEST_CC_OPTION([message], [options],
|
dnl LIBC_TRY_CC_AND_TEST_CC_OPTION([message], [options],
|
||||||
|
@ -398,3 +408,42 @@ else
|
||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
])
|
])
|
||||||
|
|
||||||
|
dnl Test a TEST_CC compiler option or options with an input file.
|
||||||
|
dnl LIBC_TRY_TEST_CC_COMMAND([message], [code], [options],
|
||||||
|
dnl [TEST_CC-cache-id], [TEST_CC-action-if-true], [TEST_CC-action-if-false])
|
||||||
|
AC_DEFUN([LIBC_TRY_TEST_CC_COMMAND],
|
||||||
|
[
|
||||||
|
cat > conftest.c <<EOF
|
||||||
|
$2
|
||||||
|
EOF
|
||||||
|
LIBC_CHECK_TEST_CC(
|
||||||
|
AC_CACHE_CHECK([$1 in testing], $4, [dnl
|
||||||
|
if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $3 conftest.c -o conftest 1>&AS_MESSAGE_LOG_FD])
|
||||||
|
then
|
||||||
|
[$5]
|
||||||
|
else
|
||||||
|
[$6]
|
||||||
|
fi])
|
||||||
|
)
|
||||||
|
rm -f conftest*])
|
||||||
|
|
||||||
|
dnl Test a TEST_CXX compiler option or options with an input file.
|
||||||
|
dnl LIBC_TRY_TEST_CXX_COMMAND([message], [code], [options],
|
||||||
|
dnl [TEST_CXX-cache-id], [TEST_CXX-action-if-true],
|
||||||
|
dnl [TEST_CXX-action-if-false])
|
||||||
|
AC_DEFUN([LIBC_TRY_TEST_CXX_COMMAND],
|
||||||
|
[
|
||||||
|
cat > conftest.cc <<EOF
|
||||||
|
$2
|
||||||
|
EOF
|
||||||
|
LIBC_CHECK_TEST_CXX(
|
||||||
|
AC_CACHE_CHECK([$1 in testing], $4, [dnl
|
||||||
|
if AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS $3 conftest.cc -o conftest 1>&AS_MESSAGE_LOG_FD])
|
||||||
|
then
|
||||||
|
[$5]
|
||||||
|
else
|
||||||
|
[$6]
|
||||||
|
fi])
|
||||||
|
)
|
||||||
|
rm -f conftest*])
|
||||||
|
|
76
configure
vendored
76
configure
vendored
|
@ -5993,6 +5993,82 @@ fi
|
||||||
printf "%s\n" "$libc_cv_with_fp" >&6; }
|
printf "%s\n" "$libc_cv_with_fp" >&6; }
|
||||||
|
|
||||||
|
|
||||||
|
conftest_code="
|
||||||
|
#ifndef __clang__
|
||||||
|
#error Not Clang!
|
||||||
|
#endif
|
||||||
|
"
|
||||||
|
|
||||||
|
|
||||||
|
cat > conftest.c <<EOF
|
||||||
|
$conftest_code
|
||||||
|
EOF
|
||||||
|
|
||||||
|
saved_CC="$CC"
|
||||||
|
CC="$TEST_CC"
|
||||||
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for clang in testing" >&5
|
||||||
|
printf %s "checking for clang in testing... " >&6; }
|
||||||
|
if test ${libc_cv_test_clang+y}
|
||||||
|
then :
|
||||||
|
printf %s "(cached) " >&6
|
||||||
|
else case e in #(
|
||||||
|
e) if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c -o conftest 1>&5'
|
||||||
|
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
|
||||||
|
(eval $ac_try) 2>&5
|
||||||
|
ac_status=$?
|
||||||
|
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||||
|
test $ac_status = 0; }; }
|
||||||
|
then
|
||||||
|
libc_cv_test_clang=yes
|
||||||
|
else
|
||||||
|
libc_cv_test_clang=no
|
||||||
|
fi ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_test_clang" >&5
|
||||||
|
printf "%s\n" "$libc_cv_test_clang" >&6; }
|
||||||
|
|
||||||
|
CC="$saved_CC"
|
||||||
|
|
||||||
|
rm -f conftest*
|
||||||
|
config_vars="$config_vars
|
||||||
|
have-test-clang = $libc_cv_test_clang"
|
||||||
|
|
||||||
|
|
||||||
|
cat > conftest.cc <<EOF
|
||||||
|
$conftest_code
|
||||||
|
EOF
|
||||||
|
|
||||||
|
saved_CXX="$CXX"
|
||||||
|
CXX="$TEST_CXX"
|
||||||
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for clang++ in testing" >&5
|
||||||
|
printf %s "checking for clang++ in testing... " >&6; }
|
||||||
|
if test ${libc_cv_test_clangxx+y}
|
||||||
|
then :
|
||||||
|
printf %s "(cached) " >&6
|
||||||
|
else case e in #(
|
||||||
|
e) if { ac_try='${CXX-c++} $CXXFLAGS $CPPFLAGS -c conftest.cc -o conftest 1>&5'
|
||||||
|
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
|
||||||
|
(eval $ac_try) 2>&5
|
||||||
|
ac_status=$?
|
||||||
|
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||||
|
test $ac_status = 0; }; }
|
||||||
|
then
|
||||||
|
libc_cv_test_clangxx=yes
|
||||||
|
else
|
||||||
|
libc_cv_test_clangxx=no
|
||||||
|
fi ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_test_clangxx" >&5
|
||||||
|
printf "%s\n" "$libc_cv_test_clangxx" >&6; }
|
||||||
|
|
||||||
|
CXX="$saved_CXX"
|
||||||
|
|
||||||
|
rm -f conftest*
|
||||||
|
config_vars="$config_vars
|
||||||
|
have-test-clangxx = $libc_cv_test_clangxx"
|
||||||
|
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -fstack-protector" >&5
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -fstack-protector" >&5
|
||||||
printf %s "checking for -fstack-protector... " >&6; }
|
printf %s "checking for -fstack-protector... " >&6; }
|
||||||
if test ${libc_cv_ssp+y}
|
if test ${libc_cv_ssp+y}
|
||||||
|
|
24
configure.ac
24
configure.ac
|
@ -641,6 +641,30 @@ fi
|
||||||
rm -f conftest*])
|
rm -f conftest*])
|
||||||
AC_SUBST(libc_cv_with_fp)
|
AC_SUBST(libc_cv_with_fp)
|
||||||
|
|
||||||
|
conftest_code="
|
||||||
|
#ifndef __clang__
|
||||||
|
#error Not Clang!
|
||||||
|
#endif
|
||||||
|
"
|
||||||
|
|
||||||
|
dnl Check if clang is used to test glibc.
|
||||||
|
LIBC_TRY_TEST_CC_COMMAND([for clang],
|
||||||
|
[$conftest_code],
|
||||||
|
[-c],
|
||||||
|
libc_cv_test_clang,
|
||||||
|
[libc_cv_test_clang=yes], [libc_cv_test_clang=no],
|
||||||
|
)
|
||||||
|
LIBC_CONFIG_VAR([have-test-clang], [$libc_cv_test_clang])
|
||||||
|
|
||||||
|
dnl Check if clang++ is used to test glibc.
|
||||||
|
LIBC_TRY_TEST_CXX_COMMAND([for clang++],
|
||||||
|
[$conftest_code],
|
||||||
|
[-c],
|
||||||
|
libc_cv_test_clangxx,
|
||||||
|
[libc_cv_test_clangxx=yes], [libc_cv_test_clangxx=no],
|
||||||
|
)
|
||||||
|
LIBC_CONFIG_VAR([have-test-clangxx], [$libc_cv_test_clangxx])
|
||||||
|
|
||||||
AC_CACHE_CHECK(for -fstack-protector, libc_cv_ssp, [dnl
|
AC_CACHE_CHECK(for -fstack-protector, libc_cv_ssp, [dnl
|
||||||
LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector],
|
LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector],
|
||||||
[libc_cv_ssp=yes],
|
[libc_cv_ssp=yes],
|
||||||
|
|
Loading…
Add table
Reference in a new issue