mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-05-20 13:05:33 +02:00
Added -Wextra and -Werror option for gcc and clang.
Reformatted and untabified configure.in.
This commit is contained in:
parent
432c9cc542
commit
aee537099d
@ -196,8 +196,8 @@ IF (MSGPACK_BUILD_TESTS)
|
||||
ENDIF ()
|
||||
|
||||
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
SET_PROPERTY (TARGET msgpack APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -g -O3 -DPIC")
|
||||
SET_PROPERTY (TARGET msgpack-static APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -g -O3" )
|
||||
SET_PROPERTY (TARGET msgpack APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Werror -g -O3 -DPIC")
|
||||
SET_PROPERTY (TARGET msgpack-static APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Werror -g -O3" )
|
||||
ENDIF ()
|
||||
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
||||
IF (CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
||||
|
100
configure.in
100
configure.in
@ -3,10 +3,10 @@ AC_CONFIG_AUX_DIR(ac)
|
||||
AM_INIT_AUTOMAKE
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
AC_SUBST(CFLAGS)
|
||||
CFLAGS="-O3 -Wall $CFLAGS"
|
||||
CFLAGS="-O3 -Wall -Wextra -Werror $CFLAGS"
|
||||
|
||||
AC_SUBST(CXXFLAGS)
|
||||
CXXFLAGS="-O3 -Wall $CXXFLAGS"
|
||||
CXXFLAGS="-O3 -Wall -Wextra -Werror $CXXFLAGS"
|
||||
|
||||
|
||||
AC_PROG_CC
|
||||
@ -14,12 +14,12 @@ AC_PROG_CC
|
||||
|
||||
AC_MSG_CHECKING([if C++ API is enabled])
|
||||
AC_ARG_ENABLE(cxx,
|
||||
AS_HELP_STRING([--disable-cxx],
|
||||
[don't build C++ API]) ) #'
|
||||
AS_HELP_STRING([--disable-cxx],
|
||||
[don't build C++ API]) ) #'
|
||||
AC_MSG_RESULT([$enable_cxx])
|
||||
if test "$enable_cxx" != "no"; then
|
||||
AC_PROG_CXX
|
||||
AM_PROG_CC_C_O
|
||||
AC_PROG_CXX
|
||||
AM_PROG_CC_C_O
|
||||
fi
|
||||
AM_CONDITIONAL(ENABLE_CXX, test "$enable_cxx" != "no")
|
||||
|
||||
@ -30,56 +30,56 @@ AM_PROG_AS
|
||||
|
||||
AC_MSG_CHECKING([if debug option is enabled])
|
||||
AC_ARG_ENABLE(debug,
|
||||
AS_HELP_STRING([--disable-debug],
|
||||
[disable assert macros and omit -g option]) )
|
||||
AS_HELP_STRING([--disable-debug],
|
||||
[disable assert macros and omit -g option]) )
|
||||
AC_MSG_RESULT([$enable_debug])
|
||||
if test "$enable_debug" != "no"; then
|
||||
CXXFLAGS="$CXXFLAGS -g"
|
||||
CFLAGS="$CFLAGS -g"
|
||||
CXXFLAGS="$CXXFLAGS -g"
|
||||
CFLAGS="$CFLAGS -g"
|
||||
else
|
||||
CXXFLAGS="$CXXFLAGS -DNDEBUG"
|
||||
CFLAGS="$CFLAGS -DNDEBUG"
|
||||
CXXFLAGS="$CXXFLAGS -DNDEBUG"
|
||||
CFLAGS="$CFLAGS -DNDEBUG"
|
||||
fi
|
||||
|
||||
|
||||
AC_CACHE_CHECK([for __sync_* atomic operations], msgpack_cv_atomic_ops, [
|
||||
AC_TRY_LINK([
|
||||
int atomic_sub(int i) { return __sync_sub_and_fetch(&i, 1); }
|
||||
int atomic_add(int i) { return __sync_add_and_fetch(&i, 1); }
|
||||
], [atomic_sub(1); atomic_add(1);], msgpack_cv_atomic_ops="yes")
|
||||
])
|
||||
if test "$msgpack_cv_atomic_ops" != "yes"; then
|
||||
if test "$enable_cxx" = "no"; then
|
||||
AC_MSG_ERROR([__sync_* atomic operations are not found. Try to enable C++ support.
|
||||
If you are using gcc >= 4.1 and the default target CPU architecture is "i386", try to
|
||||
add CFLAGS="-march=i686" and CXXFLAGS="-march=i686" options to ./configure as follows:
|
||||
|
||||
$ ./configure CFLAGS="-march=i686" CXXFLAGS="-march=i686"
|
||||
])
|
||||
fi
|
||||
|
||||
AC_LANG_PUSH([C++])
|
||||
AC_CACHE_CHECK([for __gnu_cxx::__exchange_and_add], msgpack_cv_gcc_cxx_atomic_ops, [
|
||||
AC_TRY_LINK([
|
||||
#include <bits/atomicity.h>
|
||||
int atomic_sub(int i) { return __gnu_cxx::__exchange_and_add(&i, -1) - 1; }
|
||||
int atomic_add(int i) { return __gnu_cxx::__exchange_and_add(&i, 1) + 1; }
|
||||
], [atomic_sub(1); atomic_add(1);], msgpack_cv_gcc_cxx_atomic_ops="yes")
|
||||
])
|
||||
AC_LANG_POP([C++])
|
||||
|
||||
if test "$msgpack_cv_gcc_cxx_atomic_ops" != "yes"; then
|
||||
AC_MSG_ERROR([__sync_* atomic operations nor __gnu_cxx::__exchange_and_add are not found.
|
||||
|
||||
If you are using gcc >= 4.1 and the default target CPU architecture is "i386", try to
|
||||
add CFLAGS="-march=i686" and CXXFLAGS="-march=i686" options to ./configure as follows:
|
||||
|
||||
$ ./configure CFLAGS="-march=i686" CXXFLAGS="-march=i686"
|
||||
AC_TRY_LINK([
|
||||
int atomic_sub(int i) { return __sync_sub_and_fetch(&i, 1); }
|
||||
int atomic_add(int i) { return __sync_add_and_fetch(&i, 1); }
|
||||
], [atomic_sub(1); atomic_add(1);], msgpack_cv_atomic_ops="yes")
|
||||
])
|
||||
if test "$msgpack_cv_atomic_ops" != "yes"; then
|
||||
if test "$enable_cxx" = "no"; then
|
||||
AC_MSG_ERROR([__sync_* atomic operations are not found. Try to enable C++ support.
|
||||
If you are using gcc >= 4.1 and the default target CPU architecture is "i386", try to
|
||||
add CFLAGS="-march=i686" and CXXFLAGS="-march=i686" options to ./configure as follows:
|
||||
|
||||
else
|
||||
enable_gcc_cxx_atomic=yes
|
||||
fi
|
||||
$ ./configure CFLAGS="-march=i686" CXXFLAGS="-march=i686"
|
||||
])
|
||||
fi
|
||||
|
||||
AC_LANG_PUSH([C++])
|
||||
AC_CACHE_CHECK([for __gnu_cxx::__exchange_and_add], msgpack_cv_gcc_cxx_atomic_ops, [
|
||||
AC_TRY_LINK([
|
||||
#include <bits/atomicity.h>
|
||||
int atomic_sub(int i) { return __gnu_cxx::__exchange_and_add(&i, -1) - 1; }
|
||||
int atomic_add(int i) { return __gnu_cxx::__exchange_and_add(&i, 1) + 1; }
|
||||
], [atomic_sub(1); atomic_add(1);], msgpack_cv_gcc_cxx_atomic_ops="yes")
|
||||
])
|
||||
AC_LANG_POP([C++])
|
||||
|
||||
if test "$msgpack_cv_gcc_cxx_atomic_ops" != "yes"; then
|
||||
AC_MSG_ERROR([__sync_* atomic operations nor __gnu_cxx::__exchange_and_add are not found.
|
||||
|
||||
If you are using gcc >= 4.1 and the default target CPU architecture is "i386", try to
|
||||
add CFLAGS="-march=i686" and CXXFLAGS="-march=i686" options to ./configure as follows:
|
||||
|
||||
$ ./configure CFLAGS="-march=i686" CXXFLAGS="-march=i686"
|
||||
])
|
||||
|
||||
else
|
||||
enable_gcc_cxx_atomic=yes
|
||||
fi
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(ENABLE_GCC_CXX_ATOMIC, test "$enable_gcc_cxx_atomic" = "yes")
|
||||
@ -93,6 +93,6 @@ AC_SUBST(VERSION_REVISION, $revision)
|
||||
|
||||
|
||||
AC_OUTPUT([Makefile
|
||||
msgpack.pc
|
||||
src/Makefile
|
||||
test/Makefile])
|
||||
msgpack.pc
|
||||
src/Makefile
|
||||
test/Makefile])
|
||||
|
@ -61,7 +61,7 @@ FOREACH (source_file ${check_PROGRAMS})
|
||||
)
|
||||
ADD_TEST (${source_file_we} ${source_file_we})
|
||||
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -g -O3")
|
||||
SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Werror -g -O3")
|
||||
ENDIF ()
|
||||
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
||||
IF (CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
||||
|
Loading…
x
Reference in New Issue
Block a user