From 2b72f35c324e3a0623894f9c678bd08341973a32 Mon Sep 17 00:00:00 2001 From: frsyuki Date: Wed, 20 Jan 2010 14:49:51 +0900 Subject: [PATCH] configure.in: show error message if __sync_* atomic operations are not supported --- configure.in | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 99c43521..6bf1b486 100644 --- a/configure.in +++ b/configure.in @@ -24,7 +24,7 @@ if test "$enable_cxx" != "no"; then fi fi -# FIXME +# FIXME enable_cxx AC_PROG_CXX CXXFLAGS="-O4 -Wall $CXXFLAGS -I.. -I../c" @@ -34,6 +34,22 @@ AC_CHECK_HEADERS(tr1/unordered_map) AC_CHECK_HEADERS(tr1/unordered_set) AC_LANG_POP([C++]) +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); } + ], [], msgpack_cv_atomic_ops="yes") + ]) +if test "$msgpack_cv_atomic_ops" != "yes"; then + AC_MSG_ERROR([__sync_* atomic operations are not supported. +Note that gcc < 4.1 is not supported. +If you are using gcc-4.1 and the CPU architecture is x86, try to add +CFLAGS"--march=i686" and CXXFLAGS="-march=i668" options to ./configure as follows: + + $ ./configure CFLAGS="-march=i686" CXXFLAGS="-march=i686" +]) +fi + AM_CONDITIONAL(ENABLE_CXX, test "$enable_cxx" != "no") AC_PROG_LIBTOOL