* 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
This commit is contained in:
charliesome 2012-12-28 14:23:25 +00:00
Родитель 80b0c6ca3b
Коммит af35f2a61d
6 изменённых файлов: 42 добавлений и 5 удалений

Просмотреть файл

@ -1,3 +1,14 @@
Fri Dec 28 23:12:44 2012 Charlie Somerville <charlie@charliesomerville.com>
* 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@ishitsuka.com>
* lib/irb/context.rb: IRB::Context#new: Check from JobManager

Просмотреть файл

@ -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 <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],

Просмотреть файл

@ -28,7 +28,11 @@
#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

6
hash.c
Просмотреть файл

@ -20,7 +20,11 @@
#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);

8
missing/crt_externs.h Normal file
Просмотреть файл

@ -0,0 +1,8 @@
#ifndef MISSING_CRT_EXTERNS_H
#define MISSING_CRT_EXTERNS_H
char ***_NSGetEnviron();
#undef environ
#define environ (*_NSGetEnviron())
#endif

Просмотреть файл

@ -49,9 +49,13 @@
#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 */