Skip to content

Instantly share code, notes, and snippets.

@goodell
Created January 19, 2012 19:54
Show Gist options
  • Save goodell/1642179 to your computer and use it in GitHub Desktop.
Save goodell/1642179 to your computer and use it in GitHub Desktop.
commit f35d474f0cc42d31f5f4ffb50261362a6747ca98
Author: Dave Goodell <[email protected]>
Date: Wed Jan 18 18:26:22 2012 -0600
--enables-strict=posix improvements: choose standard & make 2001 default
You can now choose from three new "--enable-strict=" values:
"posix1995", "posix2001", and "posix2008".
Also the default has been changed from 1995 to 2001. This resolves a number
of problems related to OS X Lion and "--enable-strict" (see ticket #1568).
Based on some of Darius' code.
No reviewer.
---
confdb/aclocal_cc.m4 | 25 ++++++++++++++++++-------
1 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/confdb/aclocal_cc.m4 b/confdb/aclocal_cc.m4
index b44ea48..e2e2b10 100644
--- a/confdb/aclocal_cc.m4
+++ b/confdb/aclocal_cc.m4
@@ -506,7 +506,7 @@ if test "$enable_strict_done" != "yes" ; then
enable_c89=yes
enable_c99=no
- enable_posix=yes
+ enable_posix=2001
enable_opt=yes
flags="`echo $1 | sed -e 's/:/ /g' -e 's/,/ /g'`"
for flag in ${flags}; do
@@ -519,9 +519,17 @@ if test "$enable_strict_done" != "yes" ; then
enable_strict_done="yes"
enable_c99=yes
;;
- posix)
+ posix1995)
enable_strict_done="yes"
- enable_posix=yes
+ enable_posix=1995
+ ;;
+ posix|posix2001)
+ enable_strict_done="yes"
+ enable_posix=2001
+ ;;
+ posix2008)
+ enable_strict_done="yes"
+ enable_posix=2008
;;
noposix)
enable_strict_done="yes"
@@ -538,7 +546,7 @@ if test "$enable_strict_done" != "yes" ; then
all|yes)
enable_strict_done="yes"
enable_c89=yes
- enable_posix=yes
+ enable_posix=2001
enable_opt=yes
;;
no)
@@ -559,9 +567,12 @@ if test "$enable_strict_done" != "yes" ; then
pac_cc_strict_flags="-O2"
fi
pac_cc_strict_flags="$pac_cc_strict_flags $pac_common_strict_flags"
- if test "${enable_posix}" = "yes" ; then
- PAC_APPEND_FLAG([-D_POSIX_C_SOURCE=199506L],[pac_cc_strict_flags])
- fi
+ case "$enable_posix" in
+ 1995) PAC_APPEND_FLAG([-D_POSIX_C_SOURCE=199506L],[pac_cc_strict_flags]) ;;
+ 2001) PAC_APPEND_FLAG([-D_POSIX_C_SOURCE=200112L],[pac_cc_strict_flags]) ;;
+ 2008) PAC_APPEND_FLAG([-D_POSIX_C_SOURCE=200809L],[pac_cc_strict_flags]) ;;
+ *) AC_MSG_ERROR([internal error, unexpected POSIX version]) ;;
+ esac
# We only allow one of strict-C99 or strict-C89 to be
# enabled. If C99 is enabled, we automatically disable C89.
if test "${enable_c99}" = "yes" ; then
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment