Commit ae1691b2 authored by Jonas Termansen's avatar Jonas Termansen

Add the _DARWIN_C_SOURCE feature macro.

parent 28306828
......@@ -664,15 +664,27 @@ int main(void)
EOF
}
conftest_c_apple() {
cat > conftest.c << EOF
#if !defined(__APPLE__)
#error "not apple"
#endif
EOF
}
check_begin "for host feature macros"
FEATURE_MACROS=""
conftest_c_asprintf
if c_compile "$CC" "$CFLAGS" "$CPPFLAGS" "$LDFLAGS" "$LIBS"; then
: # No feature macros are needed.
elif c_compile "$CC" "$CFLAGS" "$CPPFLAGS -D_ALL_SOURCE" "$LDFLAGS" "$LIBS"; then
FEATURE_MACROS="-D_ALL_SOURCE"
FEATURE_MACROS="$FEATURE_MACROS -D_ALL_SOURCE"
elif c_compile "$CC" "$CFLAGS" "$CPPFLAGS -D_GNU_SOURCE" "$LDFLAGS" "$LIBS"; then
FEATURE_MACROS="-D_GNU_SOURCE"
FEATURE_MACROS="$FEATURE_MACROS -D_GNU_SOURCE"
fi
conftest_c_apple
if c_compile "$CC" "$CFLAGS" "$CPPFLAGS" "$LDFLAGS" "$LIBS"; then
FEATURE_MACROS="$FEATURE_MACROS -D_DARWIN_C_SOURCE"
fi
CPPFLAGS="$CPPFLAGS $FEATURE_MACROS"
[ -n "$FEATURE_MACROS" ] || FEATURE_MACROS="none needed"
......@@ -684,10 +696,14 @@ FEATURE_MACROS_FOR_BUILD=""
if c_compile "$CC_FOR_BUILD" "$CFLAGS_FOR_BUILD" "$CPPFLAGS_FOR_BUILD" "$LDFLAGS_FOR_BUILD" "$LIBS_FOR_BUILD"; then
: # No feature macros are needed.
elif c_compile "$CC_FOR_BUILD" "$CFLAGS_FOR_BUILD" "$CPPFLAGS_FOR_BUILD -D_ALL_SOURCE" "$LDFLAGS_FOR_BUILD" "$LIBS_FOR_BUILD"; then
FEATURE_MACROS_FOR_BUILD="-D_ALL_SOURCE"
FEATURE_MACROS_FOR_BUILD="$FEATURE_MACROS_FOR_BUILD -D_ALL_SOURCE"
elif c_compile "$CC_FOR_BUILD" "$CFLAGS_FOR_BUILD" "$CPPFLAGS_FOR_BUILD -D_GNU_SOURCE" "$LDFLAGS_FOR_BUILD" "$LIBS_FOR_BUILD"; then
FEATURE_MACROS_FOR_BUILD="$FEATURE_MACROS_FOR_BUILD -D_GNU_SOURCE"
fi
conftest_c_apple
if c_compile "$CC" "$CFLAGS" "$CPPFLAGS" "$LDFLAGS" "$LIBS"; then
FEATURE_MACROS_FOR_BUILD="$FEATURE_MACROS_FOR_BUILD -D_DARWIN_C_SOURCE"
fi
CPPFLAGS_FOR_BUILD="$CPPFLAGS_FOR_BUILD $FEATURE_MACROS_FOR_BUILD"
[ -n "$FEATURE_MACROS_FOR_BUILD" ] || FEATURE_MACROS_FOR_BUILD="none needed"
check_end "$FEATURE_MACROS_FOR_BUILD"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment