summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Haszlakiewicz <erh+git@nimenees.com>2018-03-04 22:32:45 -0500
committerEric Haszlakiewicz <erh+git@nimenees.com>2018-03-04 22:46:05 -0500
commit0f814e52dd22ee959a29ffcce36923aff62147b3 (patch)
treecc927a23b8d1fbff985f313264377d2b1859c19a
parent33e166a6850078afdaca027340379efb721d61df (diff)
downloadjson-c-0f814e52dd22ee959a29ffcce36923aff62147b3.tar.gz
Issue #396: check for toolchain compatibilty with _REENTRANT before adding it to CFLAGS.
-rw-r--r--configure.ac23
1 files changed, 22 insertions, 1 deletions
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 <sys/types.h>
+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)