X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=configure.ac;h=0614b270efcfa42e3c64856603a9143dd9998cc6;hp=852c61f0e246e025849d3a63256b34977cc01b10;hb=3ea695b469739ac0f1d6e2a6755c79fa11bc0b28;hpb=bfb025cd1038e01972c11fdf5fcad8b044b03f76 diff --git a/configure.ac b/configure.ac index 852c61f0e..0614b270e 100644 --- a/configure.ac +++ b/configure.ac @@ -26,6 +26,24 @@ AC_PROG_CXX RW_PROG_CXX_WORKS AM_CONDITIONAL([CXX_WORKS], [test "x$rw_cv_prog_cxx_works" = "xyes"]) +# Detect warning flags supported by the compiler, append them to WARN_CFLAGS. +# +# Pass -Werror as an extra flag during the test: this is needed to make the +# -Wunknown-warning-option diagnostic fatal with clang. +AX_APPEND_COMPILE_FLAGS([ dnl + -Wall dnl + ], + [WARN_CFLAGS], + [-Werror]) + +# When given, add -Werror to WARN_CFLAGS. +AC_ARG_ENABLE([Werror], + [AS_HELP_STRING([--enable-Werror], [Treat compiler warnings as errors.])] +) +AS_IF([test "x$enable_Werror" = "xyes"], + [WARN_CFLAGS="${WARN_CFLAGS} -Werror"] +) + # Checks for programs. AC_PROG_GREP AC_PROG_MAKE_SET @@ -1038,7 +1056,7 @@ AM_CONDITIONAL([BUILD_LIB_SESSIOND_COMM], [test x$build_lib_sessiond_comm = xyes AM_CONDITIONAL([BUILD_LIB_TESTPOINT], [test x$build_lib_testpoint = xyes]) AM_CONDITIONAL([BUILD_LIB_UST_CONSUMER], [test x$build_lib_ust_consumer = xyes]) -AM_CFLAGS="-Wall -fno-strict-aliasing $PTHREAD_CFLAGS" +AM_CFLAGS="${WARN_CFLAGS} -fno-strict-aliasing $PTHREAD_CFLAGS" AC_SUBST(AM_CFLAGS) # The order in which the include folders are searched is important.