From 823c7b090cef2f8384e8b143e8df8e0d64302d51 Mon Sep 17 00:00:00 2001 From: Dennis Camera Date: Thu, 18 Aug 2022 00:10:21 +0200 Subject: [configure.ac] Check for correct POSIX conformance level --- configure.ac | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index e32cbfd..38d2194 100644 --- a/configure.ac +++ b/configure.ac @@ -20,6 +20,24 @@ m4_version_prereq([2.70],[],[AC_PROG_CC_C99]) AC_PROG_CPP AC_PROG_MAKE_SET +# check POSIX conformance level +_want_posix_level=200112L +_posix_level_human=POSIX.1-2001 +AC_MSG_CHECKING([if system POSIX conformance level can be set to ${_posix_level_human}]) +AC_COMPILE_IFELSE([ +#define _POSIX_C_SOURCE ${_want_posix_level} +#include +#if _POSIX_VERSION != ${_want_posix_level} +#error incorrect _POSIX_VERSION +#endif +], +[AC_MSG_RESULT([yes])], +[AC_MSG_RESULT([no]); + AC_MSG_FAILURE([this system does not conform to the ${_posix_level_human} standard]) +]) +AC_DEFINE_UNQUOTED([_POSIX_C_SOURCE], [${_want_posix_level}], [define the POSIX conformance level]) +CFLAGS=${CFLAGS-}${CFLAGS:+ }-D_POSIX_C_SOURCE=${_want_posix_level} + # Check compiler options check_ccopt() { ( _ccopt=${1:?} -- cgit v1.2.3