diff options
-rw-r--r-- | configure.ac | 10 | ||||
-rw-r--r-- | include/zbxtypes.h | 2 |
2 files changed, 10 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac index 15f856ea1e4..6f5add1b4d4 100644 --- a/configure.ac +++ b/configure.ac @@ -686,6 +686,12 @@ AC_MSG_RESULT(no) ) LDFLAGS="$saved_LDFLAGS" +AC_MSG_CHECKING(for '__thread' compiler support) +AC_TRY_COMPILE([#include <stdio.h>],[static __thread int a = 0;], +AC_DEFINE(HAVE_THREAD_LOCAL,1,[Define to 1 if compiler keyword '__thread' supported.]) +AC_MSG_RESULT(yes), +AC_MSG_RESULT(no) +HAVE_THREAD_LOCAL="no") dnl ***************************************************************** dnl * * dnl * Checks for functions * @@ -1283,7 +1289,9 @@ AC_ARG_ENABLE(agent2,[ --enable-agent2 Turn on build of Zabbix agent 2] yes) agent2=yes ;; no) agent2=no ;; *) AC_MSG_ERROR([bad value ${enableval} for --enable-agent2]) ;; -esac], +esac +test "x$agent2" = "xyes" -a "x$HAVE_THREAD_LOCAL" = "xno" && AC_MSG_ERROR([C compiler is not compatible with agent2 assembly]) +], [agent2=no]) AM_CONDITIONAL(AGENT2, test "x$agent2" = "xyes") diff --git a/include/zbxtypes.h b/include/zbxtypes.h index e51a3e0c6c8..230c898d3a5 100644 --- a/include/zbxtypes.h +++ b/include/zbxtypes.h @@ -23,7 +23,7 @@ #if defined(_WINDOWS) # define ZBX_THREAD_LOCAL __declspec(thread) #else -# if defined(__GNUC__) || defined(__clang__) || defined(__MINGW32__) +# if defined(HAVE_THREAD_LOCAL) && (defined(__GNUC__) || defined(__clang__) || defined(__MINGW32__)) # define ZBX_THREAD_LOCAL __thread # else # define ZBX_THREAD_LOCAL |