From cc5ba66a89d9c14ade7528b63ede7944523042d8 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Thu, 15 Oct 2009 23:56:41 +0200 Subject: [PATCH] configure.ac: Added the --enable-standards command line option. This option may be used to enable C99 and POSIX.1 2001 standards compliance mode. --- configure.ac | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/configure.ac b/configure.ac index abd0c5e..e0fd5db 100644 --- a/configure.ac +++ b/configure.ac @@ -30,6 +30,37 @@ test_cc_flags() { return $ret } +dnl Optionally stick to standard C99 and POSIX.1 2001 as close as possible. +AC_ARG_ENABLE([standards], + AS_HELP_STRING([--enable-standards], + [Enable standards compliance mode]), + [enable_standards="$enableval"], + [enable_standards="no"]) + +if test "x$enable_standards" = "xyes"; then + AC_DEFINE([_ISOC99_SOURCE], 1, + [Define to enforce ISO/IEC 9899:1999 (C99) compliance.]) + AC_DEFINE([_POSIX_C_SOURCE], 200112L, + [Define to enforce IEEE 1003.1-2001 (POSIX:2001) compliance.]) + AC_DEFINE([_XOPEN_SOURCE], 600, + [Define to enforce X/Open 6 (XSI) compliance.]) + AC_DEFINE([_REENTRANT], 1, + [Define to enable reentrant interfaces.]) + AC_DEFINE([_THREAD_SAFE], 1, + [Define to enable reentrant interfaces.]) + + for flag in -std=c99 -pedantic; do + AC_MSG_CHECKING([whether $CC accepts $flag]) + + if test_cc_flags $flag; then + CFLAGS="$CFLAGS $flag" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + done +fi + for flag in -Wall -Wextra -Werror; do AC_MSG_CHECKING([whether $CC accepts $flag]) -- 2.30.2