diff options
author | Hans de Goede <hdegoede@redhat.com> | 2013-01-08 11:44:13 +0100 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2013-01-08 11:44:13 +0100 |
commit | 515b65199d62bad7e3a1c840af61e599f6d67bfb (patch) | |
tree | 40e86b8dd2a4f1a19440b011eb1d0a2dad044203 /configure.ac | |
parent | dfb6589920be00c8b41a22f748499d6fecf0c6f7 (diff) | |
download | vd_agent-515b65199d62bad7e3a1c840af61e599f6d67bfb.tar.gz vd_agent-515b65199d62bad7e3a1c840af61e599f6d67bfb.tar.xz vd_agent-515b65199d62bad7e3a1c840af61e599f6d67bfb.zip |
Buildsys: Add default CFLAGS to be used when no CFLAGS are specified
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 149c652..0f81062 100644 --- a/configure.ac +++ b/configure.ac @@ -125,6 +125,21 @@ if test x"$enable_static_uinput" = "xyes" ; then AC_DEFINE([WITH_STATIC_UINPUT], [1], [If defined, vdagentd will use a static uinput device] ) fi +# If no CFLAGS are set, set some sane default CFLAGS +if test "$ac_test_CFLAGS" != set; then + DEFAULT_CFLAGS="-Wall -Werror -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4" + for F in $DEFAULT_CFLAGS; do + AC_MSG_CHECKING([whether $CC supports $F]) + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $F" + AC_COMPILE_IFELSE([AC_LANG_SOURCE([ ])], [cc_flag=yes], [cc_flag=no]) + if test "x$cc_flag" != "xyes"; then + CFLAGS="$save_CFLAGS" + fi + AC_MSG_RESULT([$cc_flag]) + done +fi + AC_CONFIG_FILES([ Makefile ]) |