[前][次][番号順一覧][スレッド一覧]

ruby-changes:51237

From: ngoto <ko1@a...>
Date: Wed, 16 May 2018 13:11:25 +0900 (JST)
Subject: [ruby-changes:51237] ngoto:r63443 (trunk): configure.ac: move checks of -std=gnu99 and _XOPEN_SOURCE on Solaris

ngoto	2018-05-16 13:11:20 +0900 (Wed, 16 May 2018)

  New Revision: 63443

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63443

  Log:
    configure.ac: move checks of -std=gnu99 and _XOPEN_SOURCE on Solaris
    
    * configure.ac (ansi_options): On Solaris, "-std=gnu99" should be
      appended to CPPFLAGS instead of warnflags and strict_warnflags,
      because the flag affects existance of functions and macros.
    
    * configure.ac (solaris*): Check _XOPEN_SOURCE just after checking
      "-std=gnu99" on Solaris. Because _XOPEN_SOURCE also affects existance
      of many functions and macros, it is good to define it earlier.
      The check is simplified to use AC_TRY_COMPILE with RUBY_WERROR_FLAG.

  Modified files:
    trunk/configure.ac
Index: configure.ac
===================================================================
--- configure.ac	(revision 63442)
+++ configure.ac	(revision 63443)
@@ -582,6 +582,50 @@ AS_IF([test "$GCC" = yes], [ https://github.com/ruby/ruby/blob/trunk/configure.ac#L582
     [cygwin*|darwin*|netbsd*], [
       # need lgamma_r(), finite()
     ],
+    [solaris*], [
+      # ANSI (no XCFLAGS because this is C only)
+      # Because "-std=gnu99" affects existance of functions on Solaris,
+      # "-std=gnu99" will be appended to CPPFLAGS.
+	for ansi_options in -std=gnu99; do
+	    RUBY_TRY_CFLAGS(${ansi_options}, [
+		RUBY_APPEND_OPTIONS(CPPFLAGS, ${ansi_options})
+	    ], [ansi_options=])
+	    test "x${ansi_options}" = x || break
+	done
+	AC_MSG_CHECKING(whether _XOPEN_SOURCE is already given)
+	AC_TRY_COMPILE([#include <unistd.h>
+		#ifndef _XOPEN_SOURCE
+		#error _XOPEN_SOURCE is not defined
+		#endif
+		], [],
+	        [given_xopen_source=yes], [given_xopen_source=no])
+	AC_MSG_RESULT($given_xopen_source)
+	AS_IF([test $given_xopen_source = no], [
+	  AC_MSG_CHECKING(appropriate _XOPEN_SOURCE value to define)
+	  define_xopen_source=""
+	  for tmp_xpg in 7 6 5; do
+	    AS_IF([test x"$define_xopen_source" != x], [
+	      break
+	    ])
+	    RUBY_WERROR_FLAG([AC_TRY_COMPILE([
+		#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
+		], [],
+		[define_xopen_source=${tmp_xpg}00], [])
+		])
+	  done
+	  AS_IF([test x"$define_xopen_source" = x], [
+	    define_xopen_source=no
+	  ])
+	  AC_MSG_RESULT($define_xopen_source)
+	  AS_IF([test x"$define_xopen_source" != xno], [
+	    RUBY_APPEND_OPTIONS(CPPFLAGS, -D_XOPEN_SOURCE=$define_xopen_source)
+	  ])
+	])
+    ],
     [
       # ANSI (no XCFLAGS because this is C only)
 	for ansi_options in -std=gnu99; do
@@ -821,48 +865,6 @@ main() https://github.com/ruby/ruby/blob/trunk/configure.ac#L865
 		ac_cv_c_inline=no],
 [solaris*], [	LIBS="-lm $LIBS"
 		ac_cv_func_vfork=no
-		AC_MSG_CHECKING(whether _XOPEN_SOURCE is already given)
-		AC_TRY_COMPILE([#include <unistd.h>
-		    #ifndef _XOPEN_SOURCE
-		    #error _XOPEN_SOURCE is not defined
-		    #endif
-		    ], [],
-		    [given_xopen_source=yes], [given_xopen_source=no])
-		AC_MSG_RESULT($given_xopen_source)
-		AS_IF([test $given_xopen_source = no], [
-		  AC_MSG_CHECKING(appropriate _XOPEN_SOURCE value to define)
-		  define_xopen_source=""
-		  for tmp_xpg in 7 6 5; do
-		    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([
-			#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
-			], [],
-			[define_xopen_source=${tmp_xpg}00], [])
-			], [])
-		  done
-		  AS_IF([test x"$define_xopen_source" = x], [
-		    define_xopen_source=no
-		  ])
-		  AC_MSG_RESULT($define_xopen_source)
-		  AS_IF([test x"$define_xopen_source" != xno], [
-		    RUBY_APPEND_OPTIONS(CPPFLAGS, -D_XOPEN_SOURCE=$define_xopen_source)
-		  ])
-		])
 		],
 [haiku*], [
 		LIBS="$LIBS" # m lib is include in root

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]