From: Daniel Elstner Date: Sun, 13 Sep 2015 16:35:28 +0000 (+0200) Subject: Build: Move _POSIX_C_SOURCE definition to config.h X-Git-Tag: libsigrok-0.4.0~300 X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff_plain;h=56c8705e37314dafe35b680d2254b6f844e0ecc2 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. --- diff --git a/Makefile.am b/Makefile.am index b2c307e7..d94019ce 100644 --- a/Makefile.am +++ b/Makefile.am @@ -29,7 +29,7 @@ if BINDINGS_CXX local_includes += -Ibindings/cxx/include -I$(srcdir)/bindings/cxx/include -Ibindings/cxx endif # 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 # python bindings CFLAGS are a superset of the C++ bindings CFLAGS. diff --git a/configure.ac b/configure.ac index b4ba2b3d..d773d7f2 100644 --- a/configure.ac +++ b/configure.ac @@ -44,6 +44,12 @@ AC_PROG_LN_S # Required for per-target flags or subdir-objects with C sources. 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. SR_PROG_VERSION([$CC], [sr_cc_version]) SR_PROG_VERSION([$CXX], [sr_cxx_version])