X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=configure.ac;h=032adea94597b029acfa092b5a414193be5d7951;hb=6ba0c2b259f1f99ed3ce8ee2e58e90bc393b704e;hp=99b998524b7236d6361bef844716131b6ee569a4;hpb=9d4c8b2d907edb9ebc9bfde55602598e7ba0832e;p=lttng-ust.git diff --git a/configure.ac b/configure.ac index 99b99852..032adea9 100644 --- a/configure.ac +++ b/configure.ac @@ -38,7 +38,7 @@ m4_define([ust_ctl_lib_version], ust_ctl_lib_version_current[:]ust_ctl_lib_versi AC_PREREQ([2.69]) AC_INIT([lttng-ust],[ust_version],[mathieu dot desnoyers at efficios dot com],[],[https://lttng.org]) -AC_CONFIG_HEADERS([include/config.h include/lttng/ust-config.h include/lttng/ust-version.h]) +AC_CONFIG_HEADERS([src/common/config.h include/lttng/ust-config.h include/lttng/ust-version.h]) AC_CONFIG_AUX_DIR([config]) AC_CONFIG_MACRO_DIR([m4]) @@ -135,6 +135,55 @@ AC_TYPE_UINT64_T AC_TYPE_UINT8_T AC_CHECK_TYPES([ptrdiff_t]) +# Detect warning flags supported by the C compiler and append them to +# WARN_CFLAGS. +m4_define([WARN_FLAGS_LIST], [ dnl + -Wall dnl + -Wextra dnl + -Wmissing-prototypes dnl + -Wmissing-declarations dnl + -Wnull-dereference dnl + -Wundef dnl + -Wshadow dnl + -Wjump-misses-init dnl + -Wsuggest-attribute=format dnl + -Wtautological-constant-out-of-range-compare dnl + -Wnested-externs dnl + -Wwrite-strings dnl + -Wformat=2 dnl + -Wstrict-aliasing dnl + -Wmissing-noreturn dnl + -Winit-self dnl + -Wduplicated-cond dnl + -Wduplicated-branches dnl + -Wlogical-op dnl + dnl These would require reworking the tracepoint macros + dnl-Wredundant-decls dnl + -Wno-sign-compare dnl + -Wno-missing-field-initializers dnl + -Wno-null-dereference dnl +]) + +# Pass -Werror as an extra flag during the test: this is needed to make the +# -Wunknown-warning-option diagnostic fatal with clang. +AC_LANG_PUSH([C]) +AX_APPEND_COMPILE_FLAGS([WARN_FLAGS_LIST], [WARN_CFLAGS], [-Werror]) +AC_LANG_POP([C]) + +# The test used in AX_APPEND_COMPILE_FLAGS, generated using AC_LANG_PROGRAM, is +# written in such a way that it triggers warnings with the following warning +# flags. So they would always end up disabled if we put them there, because +# the test program would not build. +# +# Enable them here unconditionally. They are supported by GCC >= 4.8 and by +# Clang >= 3.3 (required by the project) and are only valid for C code. +WARN_CFLAGS="${WARN_CFLAGS} -Wold-style-definition -Wstrict-prototypes" + +# Disable 'strict aliasing' if the compiler supports it. +AC_LANG_PUSH([C]) +AX_APPEND_COMPILE_FLAGS([-fno-strict-aliasing], [OPT_CFLAGS], [-Werror]) +AC_LANG_POP([C]) + ## ## ## C++ compiler checks ## @@ -143,6 +192,14 @@ AC_CHECK_TYPES([ptrdiff_t]) # Find an optional C++11 compiler without GNU extensions (-std=c++11) AX_CXX_COMPILE_STDCXX([11], [noext], [optional]) +AS_IF([test "$HAVE_CXX11" = "1"], [ + # Pass -Werror as an extra flag during the test: this is needed to make the + # -Wunknown-warning-option diagnostic fatal with clang. + AC_LANG_PUSH([C++]) + AX_APPEND_COMPILE_FLAGS([WARN_FLAGS_LIST -Wno-undef -Wno-duplicated-branches], [WARN_CXXFLAGS], [-Werror]) + AC_LANG_POP([C++]) +]) + ## ## ## Header checks ## @@ -204,6 +261,7 @@ AC_CHECK_FUNCS([ \ clock_gettime \ ftruncate \ getpagesize \ + gettid \ gettimeofday \ localeconv \ memchr \ @@ -492,16 +550,16 @@ AC_SUBST([LTTNG_UST_CTL_LIBRARY_VERSION], ust_ctl_lib_version) # Major soname for python-lttngust AC_SUBST([LTTNG_UST_LIB_SONAME_MAJOR], [ust_lib_version_current]) -AM_CFLAGS="-Wall $URCU_CFLAGS $PTHREAD_CFLAGS" +AM_CFLAGS="$OPT_CFLAGS $WARN_CFLAGS $URCU_CFLAGS $PTHREAD_CFLAGS" AC_SUBST(AM_CFLAGS) -AM_CXXFLAGS="$AM_CFLAGS" +AM_CXXFLAGS="$WARN_CXXFLAGS $URCU_CFLAGS $PTHREAD_CFLAGS" AC_SUBST(AM_CXXFLAGS) # The order in which the include folders are searched is important. # The top_builddir should always be searched first in the event that a build # time generated file is included. -AM_CPPFLAGS="-I\$(top_builddir)/include -I\$(top_srcdir)/include -include config.h" +AM_CPPFLAGS="-I\$(top_builddir)/include -I\$(top_srcdir)/include -I\$(top_builddir)/src -I\$(top_srcdir)/src -include common/config.h" AC_SUBST(AM_CPPFLAGS) AC_SUBST(JNI_CPPFLAGS) @@ -518,36 +576,36 @@ AC_CONFIG_FILES([ doc/Makefile doc/man/Makefile include/Makefile - src/libcounter/Makefile - src/liblttng-ust-comm/Makefile - src/liblttng-ust-ctl/Makefile - src/liblttng-ust-cyg-profile/Makefile - src/liblttng-ust-dl/Makefile - src/liblttng-ust-fd/Makefile - src/liblttng-ust-fork/Makefile - src/liblttng-ust-java-agent/java/lttng-ust-agent-all/Makefile - src/liblttng-ust-java-agent/java/lttng-ust-agent-common/Makefile - src/liblttng-ust-java-agent/java/lttng-ust-agent-jul/Makefile - src/liblttng-ust-java-agent/java/lttng-ust-agent-log4j/Makefile - src/liblttng-ust-java-agent/java/Makefile - src/liblttng-ust-java-agent/jni/common/Makefile - src/liblttng-ust-java-agent/jni/jul/Makefile - src/liblttng-ust-java-agent/jni/log4j/Makefile - src/liblttng-ust-java-agent/jni/Makefile - src/liblttng-ust-java-agent/Makefile - src/liblttng-ust-java/Makefile - src/liblttng-ust-libc-wrapper/Makefile - src/liblttng-ust/Makefile - src/liblttng-ust-python-agent/Makefile - src/libmsgpack/Makefile - src/libringbuffer/Makefile + src/common/Makefile + src/lib/lttng-ust-common/Makefile + src/lib/lttng-ust-ctl/Makefile + src/lib/lttng-ust-cyg-profile/Makefile + src/lib/lttng-ust-dl/Makefile + src/lib/lttng-ust-fd/Makefile + src/lib/lttng-ust-fork/Makefile + src/lib/lttng-ust-java-agent/java/lttng-ust-agent-all/Makefile + src/lib/lttng-ust-java-agent/java/lttng-ust-agent-common/Makefile + src/lib/lttng-ust-java-agent/java/lttng-ust-agent-jul/Makefile + src/lib/lttng-ust-java-agent/java/lttng-ust-agent-log4j/Makefile + src/lib/lttng-ust-java-agent/java/Makefile + src/lib/lttng-ust-java-agent/jni/common/Makefile + src/lib/lttng-ust-java-agent/jni/jul/Makefile + src/lib/lttng-ust-java-agent/jni/log4j/Makefile + src/lib/lttng-ust-java-agent/jni/Makefile + src/lib/lttng-ust-java-agent/Makefile + src/lib/lttng-ust-java/Makefile + src/lib/lttng-ust-libc-wrapper/Makefile + src/lib/lttng-ust-pthread-wrapper/Makefile + src/lib/lttng-ust-tracepoint/Makefile + src/lib/lttng-ust/Makefile + src/lib/lttng-ust-python-agent/Makefile + src/lib/Makefile src/lttng-ust-ctl.pc src/lttng-ust.pc src/Makefile src/python-lttngust/lttngust/version.py src/python-lttngust/Makefile src/python-lttngust/setup.py - src/snprintf/Makefile tests/benchmark/Makefile tests/compile/ctf-types/Makefile tests/compile/hello.cxx/Makefile