diff options
author | Eric Haszlakiewicz <erh+git@nimenees.com> | 2018-03-04 22:32:45 -0500 |
---|---|---|
committer | Eric Haszlakiewicz <erh+git@nimenees.com> | 2018-03-04 22:46:05 -0500 |
commit | 0f814e52dd22ee959a29ffcce36923aff62147b3 (patch) | |
tree | cc927a23b8d1fbff985f313264377d2b1859c19a | |
parent | 33e166a6850078afdaca027340379efb721d61df (diff) | |
download | json-c-0f814e52dd22ee959a29ffcce36923aff62147b3.tar.gz |
Issue #396: check for toolchain compatibilty with _REENTRANT before adding it to CFLAGS.
-rw-r--r-- | configure.ac | 23 |
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) |