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

ruby-changes:26593

From: charliesome <ko1@a...>
Date: Fri, 28 Dec 2012 23:23:35 +0900 (JST)
Subject: [ruby-changes:26593] charliesome:r38644 (trunk): * configure.in: check for the whether crt_externs.h is present when compiling

charliesome	2012-12-28 23:23:25 +0900 (Fri, 28 Dec 2012)

  New Revision: 38644

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38644

  Log:
    * configure.in: check for the whether crt_externs.h is present when compiling
      for darwin (this header is missing in the iOS SDK)
    * eval_intern.h: check HAVE_CRT_EXTERNS_H before including crt_externs.h, if
      not defined, include missing/crt_externs.h instead
    * hash.c: ditto
    * missing/setproctitle.c: ditto
    * missing/crt_externs.h: declare _NSGetEnviron() function and define environ
      for iOS

  Added files:
    trunk/missing/crt_externs.h
  Modified files:
    trunk/ChangeLog
    trunk/configure.in
    trunk/eval_intern.h
    trunk/hash.c
    trunk/missing/setproctitle.c

Index: eval_intern.h
===================================================================
--- eval_intern.h	(revision 38643)
+++ eval_intern.h	(revision 38644)
@@ -28,7 +28,11 @@ https://github.com/ruby/ruby/blob/trunk/eval_intern.h#L28
 #include <setjmp.h>
 
 #ifdef __APPLE__
-#include <crt_externs.h>
+# ifdef HAVE_CRT_EXTERNS_H
+#  include <crt_externs.h>
+# else
+#  include "missing/crt_externs.h"
+# endif
 #endif
 
 #ifndef HAVE_STRING_H
Index: configure.in
===================================================================
--- configure.in	(revision 38643)
+++ configure.in	(revision 38644)
@@ -1220,6 +1220,12 @@ main() https://github.com/ruby/ruby/blob/trunk/configure.in#L1220
 		    LINK_SO="$LINK_SO
 $POSTLINK"
 		fi
+		AC_CACHE_CHECK(whether crt_externs.h is present for extern macro, rb_cv_crt_externs,
+		    [AC_TRY_COMPILE([ #include <crt_externs.h> ], [return 0;],
+		    rb_cv_crt_externs=yes, rb_cv_crt_externs=no)])
+		if test "$rb_cv_crt_externs" = yes; then
+		    AC_DEFINE(HAVE_CRT_EXTERNS_H)
+		fi
 		],
 [hpux*], [	LIBS="-lm $LIBS"
 		ac_cv_c_inline=no],
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 38643)
+++ ChangeLog	(revision 38644)
@@ -1,3 +1,14 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Dec 28 23:12:44 2012  Charlie Somerville  <charlie@c...>
+
+	* configure.in: check for the whether crt_externs.h is present when compiling
+	  for darwin (this header is missing in the iOS SDK)
+	* eval_intern.h: check HAVE_CRT_EXTERNS_H before including crt_externs.h, if
+	  not defined, include missing/crt_externs.h instead
+	* hash.c: ditto
+	* missing/setproctitle.c: ditto
+	* missing/crt_externs.h: declare _NSGetEnviron() function and define environ
+	  for iOS
+
 Fri Dec 28 21:40:36 2012  Keiju Ishitsuka  <keiju@i...>
 
 	* lib/irb/context.rb: IRB::Context#new: Check from JobManager
Index: hash.c
===================================================================
--- hash.c	(revision 38643)
+++ hash.c	(revision 38644)
@@ -20,7 +20,11 @@ https://github.com/ruby/ruby/blob/trunk/hash.c#L20
 #include "probes.h"
 
 #ifdef __APPLE__
-#include <crt_externs.h>
+# ifdef HAVE_CRT_EXTERNS_H
+#  include <crt_externs.h>
+# else
+#  include "missing/crt_externs.h"
+# endif
 #endif
 
 static VALUE rb_hash_s_try_convert(VALUE, VALUE);
Index: missing/crt_externs.h
===================================================================
--- missing/crt_externs.h	(revision 0)
+++ missing/crt_externs.h	(revision 38644)
@@ -0,0 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/missing/crt_externs.h#L1
+#ifndef MISSING_CRT_EXTERNS_H
+#define MISSING_CRT_EXTERNS_H
+
+char ***_NSGetEnviron();
+#undef environ
+#define environ (*_NSGetEnviron())
+
+#endif
Index: missing/setproctitle.c
===================================================================
--- missing/setproctitle.c	(revision 38643)
+++ missing/setproctitle.c	(revision 38644)
@@ -49,9 +49,13 @@ https://github.com/ruby/ruby/blob/trunk/missing/setproctitle.c#L49
 #include <string.h>
 
 #if defined(__APPLE__)
-#include <crt_externs.h>
-#undef environ
-#define environ (*_NSGetEnviron())
+# ifdef HAVE_CRT_EXTERNS_H
+#  include <crt_externs.h>
+#  undef environ
+#  define environ (*_NSGetEnviron())
+# else
+#  include "crt_externs.h"
+# endif
 #endif
 
 #define SPT_NONE	0	/* don't use it at all */

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

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