Hot to test for _FORTIFY_SOURCE with Autoconf

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Everyone,

I'm not sure if this is a GCC or Autoconf question. Please point me in
the right direction.

I'm trying to test for availability of _FORTIFY_SOURCE=2. Setting a
CPPFLAG is not enough since the compiler will happily pass it down.

Does the compiler make the information available anywhere?

Here's a small Autoconf test, but I'm not sure how to craft the program.

  OLD_CPPFLAGS="$CPPFLAGS"
  CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2"

  AC_MSG_CHECKING([for -D_FORTIFY_SOURCE=2])
  AC_LINK_IFELSE(
    [AC_LANG_SOURCE([int main(void) {return 0;}])],
    [AC_MSG_RESULT([yes]); MY_CPPFLAGS="$MY_CPPFLAGS -D_FORTIFY_SOURCE=2"],
    [AC_MSG_RESULT([no])]
  )

How do I check for _FORTIFY_SOURCE=2?



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux