Module: xenomai-3 Branch: next Commit: 8f45b304774359d24872651ccf5d8ddd368b2f76 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=8f45b304774359d24872651ccf5d8ddd368b2f76
Author: Philippe Gerum <r...@xenomai.org> Date: Thu Feb 19 21:34:40 2015 +0100 build: turn on _FORTIFY_SOURCE on --enable-fortify --- configure | 62 ++++++++++++++++++++++++++++++---------------------------- configure.ac | 40 +++++++++++++++++++------------------ 2 files changed, 53 insertions(+), 49 deletions(-) diff --git a/configure b/configure index ec37dbb..ea63a7a 100755 --- a/configure +++ b/configure @@ -862,11 +862,11 @@ enable_doc_build enable_doc_install enable_verbose_latex enable_valgrind_client +enable_fortify enable_dlopen_libs enable_tls with_testdir with_demodir -enable_fortify ' ac_precious_vars='build_alias host_alias @@ -1538,10 +1538,9 @@ Optional Features: --enable-nonstop-latex Use LaTeX non-stop mode --enable-valgrind-client Enable Valgrind client API + --enable-fortify Enable _FORTIFY_SOURCE --enable-dlopen-libs Allow dynamic loading of Xenomai libraries --enable-tls Enable thread local storage - --enable-fortify Enable support for applications compiled with - _FORTIFY_SOURCE Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -14244,6 +14243,33 @@ if test "$ac_cv_atomic_builtins" != "yes"; then as_fn_error $? "compiler does not support atomic builtins" "$LINENO" 5 fi +unset want_fortify +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fortify support" >&5 +$as_echo_n "checking for fortify support... " >&6; } +# Check whether --enable-fortify was given. +if test "${enable_fortify+set}" = set; then : + enableval=$enable_fortify; case "$enableval" in + y | yes) want_fortify=yes;; + *) want_fortify=no;; + esac +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${want_fortify:-autodetect}" >&5 +$as_echo "${want_fortify:-autodetect}" >&6; } +if test x"$want_fortify" != xno; then + ac_fn_c_check_func "$LINENO" "__vfprintf_chk" "ac_cv_func___vfprintf_chk" +if test "x$ac_cv_func___vfprintf_chk" = xyes; then : + +$as_echo "#define CONFIG_XENO_FORTIFY 1" >>confdefs.h + +else + if test x"$want_fortify" = "xyes"; then + as_fn_error $? "Fortify support enabled but not available in *libc" "$LINENO" 5 + fi +fi + +fi + XENO_USER_APP_CFLAGS="-D_GNU_SOURCE -D_REENTRANT" XENO_USER_APP_LDFLAGS= @@ -14254,6 +14280,9 @@ fi XENO_USER_CFLAGS="$XENO_USER_APP_CFLAGS -pipe -fstrict-aliasing \ -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wno-unused-parameter -Werror" +if test x$want_fortify != xno -a x$debug_mode != xfull; then + XENO_USER_CFLAGS="$XENO_USER_CFLAGS -D_FORTIFY_SOURCE=1" +fi XENO_USER_LDADD="$XENO_USER_APP_LDFLAGS" XENO_USER_APP_CFLAGS="$CFLAGS $XENO_USER_APP_CFLAGS" @@ -14484,33 +14513,6 @@ fi XENO_AUTOINIT_LDFLAGS="-Wl,--wrap=main -Wl,--dynamic-list=$topdir/scripts/dynlist.ld" -unset want_fortify -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fortify support" >&5 -$as_echo_n "checking for fortify support... " >&6; } -# Check whether --enable-fortify was given. -if test "${enable_fortify+set}" = set; then : - enableval=$enable_fortify; case "$enableval" in - y | yes) want_fortify=yes;; - *) want_fortify=no;; - esac -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${want_fortify:-autodetect}" >&5 -$as_echo "${want_fortify:-autodetect}" >&6; } -if test x"$want_fortify" != xno; then - ac_fn_c_check_func "$LINENO" "__vfprintf_chk" "ac_cv_func___vfprintf_chk" -if test "x$ac_cv_func___vfprintf_chk" = xyes; then : - -$as_echo "#define CONFIG_XENO_FORTIFY 1" >>confdefs.h - -else - if test x"$want_fortify" = "xyes"; then - as_fn_error $? "Fortify support enabled but not available in *libc" "$LINENO" 5 - fi -fi - -fi - diff --git a/configure.ac b/configure.ac index 8f6502c..429e7d5 100644 --- a/configure.ac +++ b/configure.ac @@ -668,6 +668,24 @@ if test "$ac_cv_atomic_builtins" != "yes"; then AC_MSG_ERROR([compiler does not support atomic builtins]) fi +unset want_fortify +AC_MSG_CHECKING(for fortify support) +AC_ARG_ENABLE([fortify], + AC_HELP_STRING([--enable-fortify], + [Enable _FORTIFY_SOURCE]), + [case "$enableval" in + y | yes) want_fortify=yes;; + *) want_fortify=no;; + esac]) +AC_MSG_RESULT(${want_fortify:-autodetect}) +if test x"$want_fortify" != xno; then + AC_CHECK_FUNC(__vfprintf_chk, + [AC_DEFINE(CONFIG_XENO_FORTIFY, 1,[config])], + [if test x"$want_fortify" = "xyes"; then + AC_MSG_ERROR([Fortify support enabled but not available in *libc]) + fi]) +fi + dnl Exported CFLAGS and LDFLAGS, shared with internal flags XENO_USER_APP_CFLAGS="-D_GNU_SOURCE -D_REENTRANT" XENO_USER_APP_LDFLAGS= @@ -680,6 +698,9 @@ fi dnl Internal CFLAGS and LDFLAGS, may be enhanced per-arch below XENO_USER_CFLAGS="$XENO_USER_APP_CFLAGS -pipe -fstrict-aliasing \ -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wno-unused-parameter -Werror" +if test x$want_fortify != xno -a x$debug_mode != xfull; then + XENO_USER_CFLAGS="$XENO_USER_CFLAGS -D_FORTIFY_SOURCE=1" +fi XENO_USER_LDADD="$XENO_USER_APP_LDFLAGS" dnl Add any flags forced on the command line, but only @@ -841,25 +862,6 @@ fi XENO_AUTOINIT_LDFLAGS="-Wl,--wrap=main -Wl,--dynamic-list=$topdir/scripts/dynlist.ld" AC_SUBST(XENO_AUTOINIT_LDFLAGS) -unset want_fortify -AC_MSG_CHECKING(for fortify support) -AC_ARG_ENABLE([fortify], - AC_HELP_STRING([--enable-fortify], - [Enable support for applications compiled - with _FORTIFY_SOURCE]), - [case "$enableval" in - y | yes) want_fortify=yes;; - *) want_fortify=no;; - esac]) -AC_MSG_RESULT(${want_fortify:-autodetect}) -if test x"$want_fortify" != xno; then - AC_CHECK_FUNC(__vfprintf_chk, - [AC_DEFINE(CONFIG_XENO_FORTIFY, 1,[config])], - [if test x"$want_fortify" = "xyes"; then - AC_MSG_ERROR([Fortify support enabled but not available in *libc]) - fi]) -fi - dnl dnl Build the Makefiles dnl _______________________________________________ Xenomai-git mailing list Xenomai-git@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai-git