diff --git a/acsm_compiler_flags.m4 b/acsm_compiler_flags.m4 index dc075fb..b6b5202 100644 --- a/acsm_compiler_flags.m4 +++ b/acsm_compiler_flags.m4 @@ -585,6 +585,27 @@ AC_DEFUN([ACSM_SET_CXX_FLAGS], ], [clang], [ + dnl On Darwin with clang + gfortran, we get very many warnings for compact unwinding issues + dnl We deliberately keep relying on the less performant dwarf unwinding until the over-production of warnings is solved. + old_LDFLAGS="$LDFLAGS" + LDFLAGS+=" -Wl,-femit-dwarf-unwind=no_compact_unwind" + AC_LINK_IFELSE([AC_LANG_SOURCE([[ + #include + void main(int argc, char **argv) + { + std::cout << "Hello World!" << std::endl; + } + ]])], + [ + AC_MSG_RESULT(<<>>) + ACSM_LDFLAGS+=" -Wl,-femit-dwarf-unwind=no_compact_unwind" + ],[ + dnl Failed to link with new flags, do not add them + ]) + dnl Reset to old flags in case for any potential other test + LDFLAGS="$old_LDFLAGS" + + ACSM_CXXFLAGS_OPT="$ACSM_CXXFLAGS_OPT -O2 -felide-constructors -Qunused-arguments -Wunused-parameter -Wunused" dnl devel flags are added on two lines since there are so many ACSM_CXXFLAGS_DEVEL="$ACSM_CXXFLAGS_DEVEL -O2 -felide-constructors -g -pedantic -W -Wall -Wextra -Wno-long-long"