ruby-changes:51233
From: ngoto <ko1@a...>
Date: Wed, 16 May 2018 05:48:29 +0900 (JST)
Subject: [ruby-changes:51233] ngoto:r63438 (trunk): Change logic to check _XOPEN_SOURCE on Solaris
ngoto 2018-05-16 05:48:23 +0900 (Wed, 16 May 2018) New Revision: 63438 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63438 Log: Change logic to check _XOPEN_SOURCE on Solaris * configure.ac: Change logic to check _XOPEN_SOURCE on Solaris. With _XOPEN_SOURCE, "-std=gnu99" may also be added to CPPFLAGS. Modified files: trunk/configure.ac Index: configure.ac =================================================================== --- configure.ac (revision 63437) +++ configure.ac (revision 63438) @@ -836,16 +836,7 @@ main() https://github.com/ruby/ruby/blob/trunk/configure.ac#L836 AS_IF([test x"$define_xopen_source" != x], [ break ]) - # Both AC_TRY_CPP and AC_TRY_COMPILE should pass - # because some options may not be set to CPPFLAGS. - AC_TRY_CPP([ - #define _XOPEN_SOURCE ${tmp_xpg}00 - #include <unistd.h> - #ifndef _XPG${tmp_xpg} - #error _XPG${tmp_xpg} should be defined by _XOPEN_SOURCE=${tmp_xpg}00 - #endif - ], [ - AC_TRY_COMPILE([ + RUBY_WERROR_FLAG([AC_TRY_COMPILE([ #define _XOPEN_SOURCE ${tmp_xpg}00 #include <unistd.h> #ifndef _XPG${tmp_xpg} @@ -853,7 +844,7 @@ main() https://github.com/ruby/ruby/blob/trunk/configure.ac#L844 #endif ], [], [define_xopen_source=${tmp_xpg}00], []) - ], []) + ]) done AS_IF([test x"$define_xopen_source" = x], [ define_xopen_source=no @@ -861,6 +852,16 @@ main() https://github.com/ruby/ruby/blob/trunk/configure.ac#L852 AC_MSG_RESULT($define_xopen_source) AS_IF([test x"$define_xopen_source" != xno], [ RUBY_APPEND_OPTIONS(CPPFLAGS, -D_XOPEN_SOURCE=$define_xopen_source) + # On Solaris, with gcc, "-std=gnu99" would be needed + # for using "-D_XOPEN_SOURCE=nnn" when nnn >= 600. + # ("-std=gnu99" have been added to both $warnflags and + # $strict_warnflags. During the above AC_TRY_COMPILE, + # $warnflags is effective, but the value will later be + # replaced with $rb_cv_warnflags.) + AS_CASE(["${warnflags}"], + [*-std=gnu99*], [ + RUBY_APPEND_OPTIONS(CPPFLAGS, -std=gnu99) + ]) ]) ]) ], -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/