From: Sebastian Harl Date: Thu, 15 Oct 2009 21:56:41 +0000 (+0200) Subject: configure.ac: Added the --enable-standards command line option. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=cc5ba66a89d9c14ade7528b63ede7944523042d8;p=template.git configure.ac: Added the --enable-standards command line option. This option may be used to enable C99 and POSIX.1 2001 standards compliance mode. --- 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])