From 0f814e52dd22ee959a29ffcce36923aff62147b3 Mon Sep 17 00:00:00 2001 From: Eric Haszlakiewicz Date: Sun, 4 Mar 2018 22:32:45 -0500 Subject: [PATCH] Issue #396: check for toolchain compatibilty with _REENTRANT before adding it to CFLAGS. --- configure.ac | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 024c5aa..ab0c3d6 100644 --- a/configure.ac +++ b/configure.ac @@ -167,7 +167,28 @@ AC_SUBST(JSON_BSYMBOLIC_LDFLAGS) AX_APPEND_COMPILE_FLAGS([-Wall -Werror -Wcast-qual -Wno-error=deprecated-declarations]) AX_APPEND_COMPILE_FLAGS([-Wextra -Wwrite-string -Wno-unused-parameter]) -AX_APPEND_COMPILE_FLAGS([-D_GNU_SOURCE -D_REENTRANT]) +AX_APPEND_COMPILE_FLAGS([-D_GNU_SOURCE]) + +AC_LANG_PUSH([C]) +AC_MSG_CHECKING([for compatibility with _REENTRANT and toolchain headers]) +AC_LINK_IFELSE( +[ + AC_LANG_SOURCE([[ +/* uClibc toolchains without threading barf when _REENTRANT is defined */ +#define _REENTRANT 1 +#include +int main () +{ + return 0; +} +]])], [ + AC_MSG_RESULT(yes) + AX_APPEND_COMPILE_FLAGS([-D_REENTRANT]) +], [ + AC_MSG_RESULT(no) +]) +AC_LANG_POP([C]) + AX_COMPILE_CHECK_SIZEOF(int) AX_COMPILE_CHECK_SIZEOF(long)