Build: Move _POSIX_C_SOURCE definition to config.h

Do not redefine it though when already set, so that it can be
overridden by the user, or indirectly by the compiler settings.
This commit is contained in:
Daniel Elstner 2015-09-13 18:35:28 +02:00
parent 6ec6c43b47
commit 56c8705e37
2 changed files with 7 additions and 1 deletions

View File

@ -29,7 +29,7 @@ if BINDINGS_CXX
local_includes += -Ibindings/cxx/include -I$(srcdir)/bindings/cxx/include -Ibindings/cxx local_includes += -Ibindings/cxx/include -I$(srcdir)/bindings/cxx/include -Ibindings/cxx
endif endif
# Ensure that local include directories are always searched first. # Ensure that local include directories are always searched first.
AM_CPPFLAGS = $(local_includes) -D_POSIX_C_SOURCE=200112L -DFIRMWARE_DIR='"$(FIRMWARE_DIR)"' AM_CPPFLAGS = $(local_includes) -DFIRMWARE_DIR='"$(FIRMWARE_DIR)"'
# The tests CFLAGS are a superset of the libsigrok CFLAGS, and the # The tests CFLAGS are a superset of the libsigrok CFLAGS, and the
# python bindings CFLAGS are a superset of the C++ bindings CFLAGS. # python bindings CFLAGS are a superset of the C++ bindings CFLAGS.

View File

@ -44,6 +44,12 @@ AC_PROG_LN_S
# Required for per-target flags or subdir-objects with C sources. # Required for per-target flags or subdir-objects with C sources.
AM_PROG_CC_C_O AM_PROG_CC_C_O
# Set the standard the C library headers should conform to.
AH_VERBATIM([_POSIX_C_SOURCE], [/* The targeted POSIX standard. */
#ifndef _POSIX_C_SOURCE
# define _POSIX_C_SOURCE 200112L
#endif])
# Get compiler versions. # Get compiler versions.
SR_PROG_VERSION([$CC], [sr_cc_version]) SR_PROG_VERSION([$CC], [sr_cc_version])
SR_PROG_VERSION([$CXX], [sr_cxx_version]) SR_PROG_VERSION([$CXX], [sr_cxx_version])