From af35f2a61d8027df2e70012ae736f91ee0e41b85 Mon Sep 17 00:00:00 2001 From: charliesome Date: Fri, 28 Dec 2012 14:23:25 +0000 Subject: [PATCH] * 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 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38644 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 11 +++++++++++ configure.in | 6 ++++++ eval_intern.h | 6 +++++- hash.c | 6 +++++- missing/crt_externs.h | 8 ++++++++ missing/setproctitle.c | 10 +++++++--- 6 files changed, 42 insertions(+), 5 deletions(-) create mode 100644 missing/crt_externs.h diff --git a/ChangeLog b/ChangeLog index 20831bf20b..9578518057 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Fri Dec 28 23:12:44 2012 Charlie Somerville + + * 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 * lib/irb/context.rb: IRB::Context#new: Check from JobManager diff --git a/configure.in b/configure.in index 3648814a9f..9e97d6113d 100644 --- a/configure.in +++ b/configure.in @@ -1220,6 +1220,12 @@ main() 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 ], [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], diff --git a/eval_intern.h b/eval_intern.h index ed27b8ba85..334b8d439a 100644 --- a/eval_intern.h +++ b/eval_intern.h @@ -28,7 +28,11 @@ #include #ifdef __APPLE__ -#include +# ifdef HAVE_CRT_EXTERNS_H +# include +# else +# include "missing/crt_externs.h" +# endif #endif #ifndef HAVE_STRING_H diff --git a/hash.c b/hash.c index 68955b241c..cba71f948f 100644 --- a/hash.c +++ b/hash.c @@ -20,7 +20,11 @@ #include "probes.h" #ifdef __APPLE__ -#include +# ifdef HAVE_CRT_EXTERNS_H +# include +# else +# include "missing/crt_externs.h" +# endif #endif static VALUE rb_hash_s_try_convert(VALUE, VALUE); diff --git a/missing/crt_externs.h b/missing/crt_externs.h new file mode 100644 index 0000000000..cc96d46738 --- /dev/null +++ b/missing/crt_externs.h @@ -0,0 +1,8 @@ +#ifndef MISSING_CRT_EXTERNS_H +#define MISSING_CRT_EXTERNS_H + +char ***_NSGetEnviron(); +#undef environ +#define environ (*_NSGetEnviron()) + +#endif diff --git a/missing/setproctitle.c b/missing/setproctitle.c index d35e70d534..9dcf37560b 100644 --- a/missing/setproctitle.c +++ b/missing/setproctitle.c @@ -49,9 +49,13 @@ #include #if defined(__APPLE__) -#include -#undef environ -#define environ (*_NSGetEnviron()) +# ifdef HAVE_CRT_EXTERNS_H +# include +# undef environ +# define environ (*_NSGetEnviron()) +# else +# include "crt_externs.h" +# endif #endif #define SPT_NONE 0 /* don't use it at all */