summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorDennis Camera <skonfig@dtnr.ch>2022-08-18 00:10:21 +0200
committerDennis Camera <skonfig@dtnr.ch>2022-08-18 00:10:21 +0200
commit823c7b090cef2f8384e8b143e8df8e0d64302d51 (patch)
tree291e8c7b1fb658fff60fb5aa91d3a33ea23834ff /configure.ac
parent3a3ad5b6bed9039e51d6766ad8849b8f65842638 (diff)
downloadskonfig-c-823c7b090cef2f8384e8b143e8df8e0d64302d51.tar.gz
skonfig-c-823c7b090cef2f8384e8b143e8df8e0d64302d51.zip
[configure.ac] Check for correct POSIX conformance level
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac18
1 files changed, 18 insertions, 0 deletions
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 <unistd.h>
+#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:?}