mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-03-19 21:18:23 +01:00
cpp: fixed configure.in for gcc 3.x support
This commit is contained in:
parent
e5e2b9095c
commit
cc0114c482
@ -16,7 +16,7 @@ AC_PROG_CC
|
|||||||
AC_MSG_CHECKING([if C++ API is enabled])
|
AC_MSG_CHECKING([if C++ API is enabled])
|
||||||
AC_ARG_ENABLE(cxx,
|
AC_ARG_ENABLE(cxx,
|
||||||
AS_HELP_STRING([--disable-cxx],
|
AS_HELP_STRING([--disable-cxx],
|
||||||
[don't build C++ API]) )
|
[don't build C++ API]) ) #'
|
||||||
AC_MSG_RESULT([$enable_cxx])
|
AC_MSG_RESULT([$enable_cxx])
|
||||||
if test "$enable_cxx" != "no"; then
|
if test "$enable_cxx" != "no"; then
|
||||||
AC_PROG_CXX
|
AC_PROG_CXX
|
||||||
@ -50,15 +50,41 @@ AC_CACHE_CHECK([for __sync_* atomic operations], msgpack_cv_atomic_ops, [
|
|||||||
], [], msgpack_cv_atomic_ops="yes")
|
], [], msgpack_cv_atomic_ops="yes")
|
||||||
])
|
])
|
||||||
if test "$msgpack_cv_atomic_ops" != "yes"; then
|
if test "$msgpack_cv_atomic_ops" != "yes"; then
|
||||||
AC_MSG_NOTICE([__sync_* atomic operations are not found. Use libstdc++ instead.
|
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); }
|
||||||
|
int atomic_add(int i) { return __gnu_cxx::__exchange_and_add(&i, 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
|
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:
|
add CFLAGS="-march=i686" and CXXFLAGS="-march=i686" options to ./configure as follows:
|
||||||
|
|
||||||
$ ./configure CFLAGS="-march=i686" CXXFLAGS="-march=i686"
|
$ ./configure CFLAGS="-march=i686" CXXFLAGS="-march=i686"
|
||||||
])
|
])
|
||||||
|
|
||||||
|
else
|
||||||
|
enable_gcc_cxx_atomic=yes
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AM_CONDITIONAL(ENABLE_GCC_CXX_ATOMIC, test "$enable_gcc_cxx_atomic" = "yes")
|
||||||
|
|
||||||
|
|
||||||
major=`echo $VERSION | sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
|
major=`echo $VERSION | sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
|
||||||
minor=`echo $VERSION | sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
|
minor=`echo $VERSION | sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
|
||||||
|
@ -10,10 +10,15 @@ libmsgpack_la_SOURCES = \
|
|||||||
|
|
||||||
if ENABLE_CXX
|
if ENABLE_CXX
|
||||||
libmsgpack_la_SOURCES += \
|
libmsgpack_la_SOURCES += \
|
||||||
object.cpp \
|
object.cpp
|
||||||
|
endif
|
||||||
|
|
||||||
|
if ENABLE_GCC_CXX_ATOMIC
|
||||||
|
libmsgpack_la_SOURCES += \
|
||||||
gcc_atomic.cpp
|
gcc_atomic.cpp
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
# -version-info CURRENT:REVISION:AGE
|
# -version-info CURRENT:REVISION:AGE
|
||||||
libmsgpack_la_LDFLAGS = -version-info 3:0:0
|
libmsgpack_la_LDFLAGS = -version-info 3:0:0
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user