@@ -3,23 +3,23 @@ AC_CONFIG_AUX_DIR(ac)
33AM_INIT_AUTOMAKE
44AC_CONFIG_HEADER(config.h)
55AC_SUBST(CFLAGS)
6- CFLAGS="-O3 -Wall $CFLAGS"
6+ CFLAGS="-O3 -Wall -Wextra -Werror $CFLAGS"
77
88AC_SUBST(CXXFLAGS)
9- CXXFLAGS="-O3 -Wall $CXXFLAGS"
9+ CXXFLAGS="-O3 -Wall -Wextra -Werror $CXXFLAGS"
1010
1111
1212AC_PROG_CC
1313
1414
1515AC_MSG_CHECKING([if C++ API is enabled])
1616AC_ARG_ENABLE(cxx,
17- AS_HELP_STRING([--disable-cxx],
18- [don't build C++ API]) ) #'
17+ AS_HELP_STRING([--disable-cxx],
18+ [don't build C++ API]) ) #'
1919AC_MSG_RESULT([$enable_cxx])
2020if test "$enable_cxx" != "no"; then
21- AC_PROG_CXX
22- AM_PROG_CC_C_O
21+ AC_PROG_CXX
22+ AM_PROG_CC_C_O
2323fi
2424AM_CONDITIONAL(ENABLE_CXX, test "$enable_cxx" != "no")
2525
@@ -30,56 +30,56 @@ AM_PROG_AS
3030
3131AC_MSG_CHECKING([if debug option is enabled])
3232AC_ARG_ENABLE(debug,
33- AS_HELP_STRING([--disable-debug],
34- [disable assert macros and omit -g option]) )
33+ AS_HELP_STRING([--disable-debug],
34+ [disable assert macros and omit -g option]) )
3535AC_MSG_RESULT([$enable_debug])
3636if test "$enable_debug" != "no"; then
37- CXXFLAGS="$CXXFLAGS -g"
38- CFLAGS="$CFLAGS -g"
37+ CXXFLAGS="$CXXFLAGS -g"
38+ CFLAGS="$CFLAGS -g"
3939else
40- CXXFLAGS="$CXXFLAGS -DNDEBUG"
41- CFLAGS="$CFLAGS -DNDEBUG"
40+ CXXFLAGS="$CXXFLAGS -DNDEBUG"
41+ CFLAGS="$CFLAGS -DNDEBUG"
4242fi
4343
4444
4545AC_CACHE_CHECK([for __sync_* atomic operations], msgpack_cv_atomic_ops, [
46- AC_TRY_LINK([
47- int atomic_sub(int i) { return __sync_sub_and_fetch(&i, 1); }
48- int atomic_add(int i) { return __sync_add_and_fetch(&i, 1); }
49- ], [atomic_sub(1); atomic_add(1);], msgpack_cv_atomic_ops="yes")
50- ])
46+ AC_TRY_LINK([
47+ int atomic_sub(int i) { return __sync_sub_and_fetch(&i, 1); }
48+ int atomic_add(int i) { return __sync_add_and_fetch(&i, 1); }
49+ ], [atomic_sub(1); atomic_add(1);], msgpack_cv_atomic_ops="yes")
50+ ])
5151if test "$msgpack_cv_atomic_ops" != "yes"; then
52- if test "$enable_cxx" = "no"; then
53- AC_MSG_ERROR([__sync_* atomic operations are not found. Try to enable C++ support.
52+ if test "$enable_cxx" = "no"; then
53+ AC_MSG_ERROR([__sync_* atomic operations are not found. Try to enable C++ support.
5454If you are using gcc >= 4.1 and the default target CPU architecture is "i386", try to
5555add CFLAGS="-march=i686" and CXXFLAGS="-march=i686" options to ./configure as follows:
5656
5757 $ ./configure CFLAGS="-march=i686" CXXFLAGS="-march=i686"
58- ])
59- fi
60-
61- AC_LANG_PUSH([C++])
62- AC_CACHE_CHECK([for __gnu_cxx::__exchange_and_add], msgpack_cv_gcc_cxx_atomic_ops, [
63- AC_TRY_LINK([
64- #include <bits/atomicity.h>
65- int atomic_sub(int i) { return __gnu_cxx::__exchange_and_add(&i, -1) - 1; }
66- int atomic_add(int i) { return __gnu_cxx::__exchange_and_add(&i, 1) + 1; }
67- ], [atomic_sub(1); atomic_add(1);], msgpack_cv_gcc_cxx_atomic_ops="yes")
68- ])
69- AC_LANG_POP([C++])
70-
71- if test "$msgpack_cv_gcc_cxx_atomic_ops" != "yes"; then
72- AC_MSG_ERROR([__sync_* atomic operations nor __gnu_cxx::__exchange_and_add are not found.
58+ ])
59+ fi
60+
61+ AC_LANG_PUSH([C++])
62+ AC_CACHE_CHECK([for __gnu_cxx::__exchange_and_add], msgpack_cv_gcc_cxx_atomic_ops, [
63+ AC_TRY_LINK([
64+ #include <bits/atomicity.h>
65+ int atomic_sub(int i) { return __gnu_cxx::__exchange_and_add(&i, -1) - 1; }
66+ int atomic_add(int i) { return __gnu_cxx::__exchange_and_add(&i, 1) + 1; }
67+ ], [atomic_sub(1); atomic_add(1);], msgpack_cv_gcc_cxx_atomic_ops="yes")
68+ ])
69+ AC_LANG_POP([C++])
70+
71+ if test "$msgpack_cv_gcc_cxx_atomic_ops" != "yes"; then
72+ AC_MSG_ERROR([__sync_* atomic operations nor __gnu_cxx::__exchange_and_add are not found.
7373
7474If you are using gcc >= 4.1 and the default target CPU architecture is "i386", try to
7575add CFLAGS="-march=i686" and CXXFLAGS="-march=i686" options to ./configure as follows:
7676
7777 $ ./configure CFLAGS="-march=i686" CXXFLAGS="-march=i686"
78- ])
78+ ])
7979
80- else
81- enable_gcc_cxx_atomic=yes
82- fi
80+ else
81+ enable_gcc_cxx_atomic=yes
82+ fi
8383fi
8484
8585AM_CONDITIONAL(ENABLE_GCC_CXX_ATOMIC, test "$enable_gcc_cxx_atomic" = "yes")
@@ -93,6 +93,6 @@ AC_SUBST(VERSION_REVISION, $revision)
9393
9494
9595AC_OUTPUT([Makefile
96- msgpack.pc
97- src/Makefile
98- test/Makefile])
96+ msgpack.pc
97+ src/Makefile
98+ test/Makefile])
0 commit comments