1 dnl Checks whether the stack can be marked nonexecutable by passing an option
2 dnl to the C-compiler when acting on .s files. Appends that option to ASFLAGS.
3 dnl This macro is adapted from one found in GLIBC-2.3.5.
4 AC_DEFUN([CL_AS_NOEXECSTACK],[
5 AC_REQUIRE([AC_PROG_CC])
6 AC_REQUIRE([AM_PROG_AS])
7 AC_CACHE_CHECK([whether --noexecstack is desirable for .s files], cl_cv_as_noexecstack, [dnl
11 if AC_TRY_COMMAND([${CCAS} $CFLAGS $CPPFLAGS
12 -S -o conftest.s conftest.c >/dev/null]) \
13 && grep -q .note.GNU-stack conftest.s \
14 && AC_TRY_COMMAND([${CCAS} $CFLAGS $CPPFLAGS -Wa,--noexecstack
15 -c -o conftest.o conftest.s >/dev/null])
17 cl_cv_as_noexecstack=yes
19 cl_cv_as_noexecstack=no
22 if test "$cl_cv_as_noexecstack" = yes; then
23 CCASFLAGS="$CCASFLAGS -Wa,--noexecstack"
28 dnl Checks whether the compiler supports __attribute__((flatten)).
29 AC_DEFUN([CL_ATTRIBUTE_FLATTEN],[
30 AC_REQUIRE([AC_PROG_CXX])
31 AC_CACHE_CHECK([whether the compiler supports __attribute__((flatten))], cl_cv_have_attr_flatten, [dnl
32 cat > conftest.cc <<EOF
33 void f() __attribute__((flatten));
35 if AC_TRY_COMMAND(${CXX-g++} $CXXFLAGS -c conftest.cc >/dev/null 2>conftest.stderr)
37 if grep -i "warning" conftest.stderr > /dev/null; then
38 cl_cv_have_attr_flatten=no
40 cl_cv_have_attr_flatten=yes
43 cl_cv_have_attr_flatten=no
47 if test $cl_cv_have_attr_flatten = yes; then
48 AC_DEFINE(CL_HAVE_ATTRIBUTE_FLATTEN, ,[Define if compiler supports __attribute__((flatten))])