Skip to content

Commit

Permalink
m4/ax_run_or_link_ifelse.m4: revise to only impose gcc/clang warning …
Browse files Browse the repository at this point in the history
…option requirements into compilers that identify as GCC or CLANG [networkupstools#2096 fallout]

Signed-off-by: Jim Klimov <[email protected]>
  • Loading branch information
jimklimov committed Oct 16, 2023
1 parent 1a7c3a7 commit 741832b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions m4/ax_run_or_link_ifelse.m4
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,16 @@ AC_DEFUN([AX_RUN_OR_LINK_IFELSE],
[
myCFLAGS="$CFLAGS"
myCXXFLAGS="$CXXFLAGS"
CFLAGS="$myCFLAGS -Werror -Werror=implicit-function-declaration $4"
dnl # cc1plus: error: '-Werror=' argument '-Werror=implicit-function-declaration' is not valid for C++ [-Werror]
CXXFLAGS="$myCXXFLAGS -Werror $5"
AS_IF([test "${GCC}" = "yes" || test "${CLANGCC}" = "yes"], [
CFLAGS="$myCFLAGS -Werror -Werror=implicit-function-declaration $4"
dnl # cc1plus: error: '-Werror=' argument '-Werror=implicit-function-declaration' is not valid for C++ [-Werror]
CXXFLAGS="$myCXXFLAGS -Werror $5"
], [
dnl # Don't know what to complain about for unknown compilers
dnl # FIXME: Presume here they have at least a "-Werror" option
CFLAGS="$myCFLAGS -Werror $4"
CXXFLAGS="$myCXXFLAGS -Werror $5"
])
AC_RUN_IFELSE([$1], [$2], [$3],
[
AC_MSG_WARN([Current build is a cross-build, so not running test binaries, just linking them])
Expand Down

0 comments on commit 741832b

Please sign in to comment.