2
dnl Copyright (C) 1995-2006 Free Software Foundation, Inc.
4
dnl This library is free software; you can redistribute it and/or
5
dnl modify it under the terms of the GNU Lesser General Public
6
dnl License as published by the Free Software Foundation; either
7
dnl version 2.1 of the License, or (at your option) any later version.
9
dnl This library is distributed in the hope that it will be useful,
10
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
dnl Lesser General Public License for more details.
14
dnl You should have received a copy of the GNU Lesser General Public
15
dnl License along with this library; if not, write to the Free Software
16
dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
dnl Checks whether the stack can be marked nonexecutable by passing an
19
dnl option to the C-compiler when acting on .s files. Returns that
20
dnl option in NOEXECSTACK_FLAGS.
21
dnl This macro is adapted from one found in GLIBC-2.3.5.
22
AC_DEFUN([CL_AS_NOEXECSTACK],[
23
AC_REQUIRE([AC_PROG_CC])
24
AC_REQUIRE([AM_PROG_AS])
26
AC_MSG_CHECKING([whether non excutable stack support is requested])
27
AC_ARG_ENABLE(noexecstack,
28
AC_HELP_STRING([--disable-noexecstack],
29
[disable non executable stack support]),
30
noexecstack_support=$enableval, noexecstack_support=yes)
31
AC_MSG_RESULT($noexecstack_support)
33
AC_CACHE_CHECK([whether assembler supports --noexecstack option],
34
cl_cv_as_noexecstack, [dnl
35
cat > conftest.c <<EOF
38
if AC_TRY_COMMAND([${CC} $CFLAGS $CPPFLAGS
39
-S -o conftest.s conftest.c >/dev/null]) \
40
&& grep -q .note.GNU-stack conftest.s \
41
&& AC_TRY_COMMAND([${CCAS} $CCASFLAGS $CPPFLAGS -Wa,--noexecstack
42
-c -o conftest.o conftest.s >/dev/null])
44
cl_cv_as_noexecstack=yes
46
cl_cv_as_noexecstack=no
49
if test "$noexecstack_support" = yes -a "$cl_cv_as_noexecstack" = yes; then
50
NOEXECSTACK_FLAGS="-Wa,--noexecstack"
54
AC_SUBST(NOEXECSTACK_FLAGS)