From fdfc532ecd49fc3353627ef4a093366e73d6b91a Mon Sep 17 00:00:00 2001 From: Daniel Elstner Date: Sun, 13 Sep 2015 22:10:54 +0200 Subject: 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. --- Makefile.am | 4 ++-- configure.ac | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Makefile.am b/Makefile.am index 2bbdb2c..e90e2e4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -23,7 +23,7 @@ AM_LIBTOOLFLAGS = --silent GNUMAKEFLAGS = --no-print-directory DECODERS_DIR = $(pkgdatadir)/decoders -AM_CPPFLAGS = -D_POSIX_C_SOURCE=200112L -DDECODERS_DIR='"$(DECODERS_DIR)"' +AM_CPPFLAGS = -DDECODERS_DIR='"$(DECODERS_DIR)"' # The tests CFLAGS are a superset of the libsigrokdecode CFLAGS. AM_CFLAGS = $(SRD_EXTRA_CFLAGS) $(SRD_WFLAGS) $(TESTS_CFLAGS) @@ -70,7 +70,7 @@ tests_main_SOURCES = \ tests/inst.c \ tests/session.c -tests_main_CPPFLAGS = -D_POSIX_C_SOURCE=200112L -DDECODERS_DIR='"$(abs_top_srcdir)/decoders"' +tests_main_CPPFLAGS = -DDECODERS_DIR='"$(abs_top_srcdir)/decoders"' tests_main_LDADD = libsigrokdecode.la $(SRD_EXTRA_LIBS) $(TESTS_LIBS) MAINTAINERCLEANFILES = ChangeLog diff --git a/configure.ac b/configure.ac index a57cea5..53e8bc1 100644 --- a/configure.ac +++ b/configure.ac @@ -33,10 +33,6 @@ AM_INIT_AUTOMAKE([1.11 -Wall -Werror no-define subdir-objects check-news color-t AM_SILENT_RULES([yes]) m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) -AH_TOP([#ifndef SRD_CONFIG_H -#define SRD_CONFIG_H /* To stop multiple inclusions. */]) -AH_BOTTOM([#endif /* SRD_CONFIG_H */]) - AC_CANONICAL_HOST # Checks for programs. @@ -47,6 +43,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], [srd_cc_version]) -- cgit v1.2.3-70-g09d2