Changeset 4097723 for configure.ac


Ignore:
Timestamp:
Jul 5, 2009, 9:02:13 PM (15 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
e477a53
Parents:
16c0416
git-author:
Nelson Elhage <nelhage@mit.edu> (07/05/09 21:00:33)
git-committer:
Nelson Elhage <nelhage@mit.edu> (07/05/09 21:02:13)
Message:
configure: Support --with{out,}-stack-protector

This is a cleaner way to disable -fstack-protector than asking the
user to muck with PROTECT_CFLAGS, and lets the user not link libssp,
even if present.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • configure.ac

    r16c0416 r4097723  
    4646        AC_MSG_RESULT(no)
    4747fi
    48 PROTECT_CFLAGS=${PROTECT_CFLAGS-"-fstack-protector"}
    49 SAVE_CFLAGS=$CFLAGS
    50 CFLAGS="$CFLAGS $PROTECT_CFLAGS"
    51 AC_MSG_CHECKING(whether protection cflags work)
    52 AC_COMPILE_IFELSE(int i;,
    53     [AC_MSG_RESULT(yes)],
    54     [AC_MSG_RESULT(no)
    55     CFLAGS=$SAVE_CFLAGS])
    5648
     49AC_ARG_WITH([stack-protector],
     50  [AS_HELP_STRING([--with-stack-protector],
     51    [Enable gcc -fstack-protector])],
     52  [],
     53  [with_stack_protector=check])
    5754
    58 AC_CHECK_LIB(ssp, __stack_chk_guard)
     55AS_IF([test "x$with_stack_protector" != xno],
     56  [
     57    SAVE_CFLAGS=$CFLAGS
     58    CFLAGS="$CFLAGS -fstack-protector"
     59    AC_MSG_CHECKING(whether protection cflags work)
     60    AC_COMPILE_IFELSE(int i;,
     61        [AC_MSG_RESULT(yes)],
     62        [AC_MSG_RESULT(no)
     63        CFLAGS=$SAVE_CFLAGS
     64        if test "x$with_stack_protector" != xcheck; then
     65          AC_MSG_FAILURE([--with-stack-protector selected, but gcc does support it.])
     66        fi])
     67    AC_CHECK_LIB(ssp, __stack_chk_guard)
     68  ])
     69
    5970AC_CHECK_LIB(ncursesw, initscr,, AC_MSG_ERROR(No libncursesw found.))
    6071AC_CHECK_LIB(com_err, com_err)
Note: See TracChangeset for help on using the changeset viewer.