diff options
author | Michał Łyszczek <michal.lyszczek@bofc.pl> | 2021-01-23 21:02:26 +0100 |
---|---|---|
committer | Michał Łyszczek <michal.lyszczek@bofc.pl> | 2021-01-24 01:28:14 +0100 |
commit | 737d8963e7955a0afcc388af3e836c323ed251fb (patch) | |
tree | a5985e48b2a77decef9213d04646981530d050ab | |
parent | 8135f33615d31f23f0d9ec7ef1d2778443c81cf6 (diff) | |
download | embedlog-737d8963e7955a0afcc388af3e836c323ed251fb.tar.gz embedlog-737d8963e7955a0afcc388af3e836c323ed251fb.tar.bz2 embedlog-737d8963e7955a0afcc388af3e836c323ed251fb.zip |
configure.ac: fix compilation error on old gcc
Old gcc (like 4.2 old) aborts compilation with error when
-Wno-unused-result is used, since it does not know that flag.
Signed-off-by: Michał Łyszczek <michal.lyszczek@bofc.pl>
-rw-r--r-- | configure.ac | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index e1939b2..1c67ab3 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,25 @@ m4_include([m4/ax_compiler_vendor.m4]) AX_COMPILER_VENDOR AS_IF([test "x$ax_cv_c_compiler_vendor" = "xgnu"], [ - CFLAGS="$CFLAGS -Wno-unused-result" + dnl old gcc do not support -Wno-unused-result, what's more, + dnl it causes compilation for abort with error, so explicitly + dnl check if we can use that flag. Unecessary warning about + dnl uneeded result value is better then error. + AC_CACHE_CHECK([whether -Wno-unused-result is supported], + [el_cv_cc_no_unused_result_supported], + [save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Wno-unused-result" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[]], [[]])], + [el_cv_cc_no_unused_result_supported=yes], + [el_cv_cc_no_unused_result_supported=no]) + CFLAGS="$save_CFLAGS" + ]) + + AS_IF([test "$el_cv_cc_no_unused_result_supported" = yes], + [ + CFLAGS="$CFLAGS -Wno-unused-result" + ]) ]) |