From 69ac654c90178dce12c3365afbc03447a0fccf78 Mon Sep 17 00:00:00 2001 From: yugui Date: Sat, 11 Oct 2014 02:11:53 +0000 Subject: Merges a patch form naclports. * configure.in (RUBY_NACL and others): Supports PNaCl. * dln.c: replace the old hacky dynamic loading over HTTP with nacl_io. * file.c: tenatively use access(2) instead of eaccess. (rb_file_load_ok): weaken with attribute but not by postprocess. * io.c (socket.h): now NaCl has socket.h (flock): disable here instead of nacl/ioctl.h * nacl/GNUmakefile.in (CC, LD, NM, AR, AS, RANLIB, OBJDUMP, OBJCOPY): respect path to them if they are absolute. This helps naclports to build ruby in their source tree. (PROGRAM_NMF, .SUFFIXES): support .pnexe for PNaCl. (ruby.o, file.o): move the hack to attributes in ruby.c and file.c * nacl/ioctl.h: removed. move the hack to io.c. * nacl/nacl-config.rb: support arm, pnacl and others. * nacl/pepper_main.c: support build in a naclports tree. * ruby.c (rb_load_file): weaken with attribute but not by postprocess. The patch is by sbc@google.com and the Native Client Authors. It is available at: * https://chromium.googlesource.com/external/naclports.git/+/873ca4910a5f9d4206306aacb4ed79c587c6a5f3/ports/ruby/nacl.patch git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- configure.in | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'configure.in') diff --git a/configure.in b/configure.in index efb14e7611..d2c44d6199 100644 --- a/configure.in +++ b/configure.in @@ -96,8 +96,11 @@ AC_DEFUN([RUBY_NACL], [no], [nacl_cv_build_variant=glibc], [yes], [nacl_cv_build_variant=newlib])]) - AS_CASE(["$build_cpu"], - [x86_64|i?86], [nacl_cv_cpu_nick=x86], [nacl_cv_cpu_nick=$build_cpu]) + AS_CASE(["$target_cpu"], + [x86_64|i?86], [nacl_cv_cpu_nick=x86], + [le32], [nacl_cv_cpu_nick=pnacl + ac_cv_exeext=.pexe], + [nacl_cv_cpu_nick=$target_cpu]) AS_CASE(["$build_os"], [linux*], [nacl_cv_os_nick=linux], [darwin*], [nacl_cv_os_nick=mac], @@ -111,6 +114,9 @@ AC_DEFUN([RUBY_NACL], if test -d \ "${NACL_SDK_ROOT}/toolchain/${nacl_cv_os_nick}_${nacl_cv_cpu_nick}_${nacl_cv_build_variant}"; then NACL_TOOLCHAIN="${nacl_cv_os_nick}_${nacl_cv_cpu_nick}_${nacl_cv_build_variant}" + elif test -d \ + "${NACL_SDK_ROOT}/toolchain/${nacl_cv_os_nick}_x86_${nacl_cv_cpu_nick}/${nacl_cv_build_variant}"; then + NACL_TOOLCHAIN="${nacl_cv_os_nick}_x86_${nacl_cv_cpu_nick}/${nacl_cv_build_variant}" else AS_CASE( ["${nacl_cv_build_variant}"], @@ -791,12 +797,16 @@ fi RUBY_TRY_CFLAGS(-Qunused-arguments, [RUBY_APPEND_OPTIONS(rb_cv_wsuppress_flags, -Qunused-arguments)]) if test "$GCC" = yes; then - # -D_FORTIFY_SOURCE - # When defined _FORTIFY_SOURCE, glibc enables some additional sanity - # argument check. The performance drop is very little and Ubuntu enables - # _FORTIFY_SOURCE=2 by default. So, let's support it for protecting us from - # a mistake of silly C extensions. - RUBY_TRY_CFLAGS(-D_FORTIFY_SOURCE=2, [RUBY_APPEND_OPTION(XCFLAGS, -D_FORTIFY_SOURCE=2)]) + # NaCl's glibc build generates undefined references to __memset_chk. + # TODO(sbc): Remove this once NaCl's glibc is fixed. + AS_CASE(["$target_os"], [nacl], [], [ + # -D_FORTIFY_SOURCE + # When defined _FORTIFY_SOURCE, glibc enables some additional sanity + # argument check. The performance drop is very little and Ubuntu enables + # _FORTIFY_SOURCE=2 by default. So, let's support it for protecting us from + # a mistake of silly C extensions. + RUBY_TRY_CFLAGS(-D_FORTIFY_SOURCE=2, [RUBY_APPEND_OPTION(XCFLAGS, -D_FORTIFY_SOURCE=2)]) + ]) # -fstack-protector AS_CASE(["$target_os"], @@ -1087,12 +1097,9 @@ main() LIBS="-lm $LIBS" if test "${nacl_cv_build_variant}" = "newlib"; then RUBY_APPEND_OPTION(CPPFLAGS, -DNACL_NEWLIB) - RUBY_APPEND_OPTION(LIBS, '-lnosys') else RUBY_APPEND_OPTION(XCFLAGS, -fPIC) fi - ac_cv_func_shutdown=no - ac_cv_func_fcntl=no ], [ LIBS="-lm $LIBS"]) -- cgit v1.2.3