diff options
author | ngoto <ngoto@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-07-02 13:50:53 +0000 |
---|---|---|
committer | ngoto <ngoto@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-07-02 13:50:53 +0000 |
commit | 2c68033a6d2d56d92a1ff787eb3d5913d98729b8 (patch) | |
tree | 5b771b2803cece252c99b2adcd0e72ba1644ebd7 | |
parent | ad0169421f0477821578bbccd74460d585729770 (diff) | |
download | ruby-2c68033a6d2d56d92a1ff787eb3d5913d98729b8.tar.gz |
Makefile.in: ARCH_FLAG may contain "-m64" etc.
* Makefile.in (mjit_config.h): ARCH_FLAG may contain "-m64", "-m32",
"-march=i486" and so on, but the change made with r63232 only
supports "-arch AAA -arch BBB" mainly used on Mac OS X.
To solve the issue, ARCH_FLAG is parsed and the architectures
specified in "-arch XXX" are added to $archs and the rest is
stored to $arch_flag. The $arch_flag is defined as MJIT_ARCHFLAG
if $archs is empty or the target architecture is not listed in $arch.
Fix build failure on Solaris 10 with ./configure CFLAGS="-m64".
[Bug #14876] [ruby-dev:50583]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63828 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | Makefile.in | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/Makefile.in b/Makefile.in index 7d3f54a738..8a1271c7ab 100644 --- a/Makefile.in +++ b/Makefile.in @@ -560,9 +560,26 @@ mjit_config.h: $${1+printf} $${1+' "%s"'$$sep} $${1+"$$@"}; \ echo; \ }; \ - archs="$(UNIVERSAL_ARCHNAMES)"; \ - archs="$${archs:-$(ARCH_FLAG:-arch=)}"; \ + parse_arch_flag() { \ + while [ "$$#" -gt 0 ]; do \ + case "$$1" in \ + -arch) \ + shift; \ + archs="$${archs:+$$archs }$$1"; \ + shift; \ + ;; \ + *) \ + arch_flag="$${arch_flag:+$${arch_flag} }$$1"; \ + shift; \ + ;; \ + esac; \ + done; \ + }; \ test "$(Q)" = @ || set -x; \ + archs="$(UNIVERSAL_ARCHNAMES)"; \ + arch_flag=""; \ + parse_arch_flag $(ARCH_FLAG); \ + need_mjit_archflag="$${archs}$${arch_flag}"; \ echo '#ifndef RUBY_MJIT_CONFIG_H'; \ echo '#define RUBY_MJIT_CONFIG_H 1'; \ echo; \ @@ -570,17 +587,21 @@ mjit_config.h: quote MJIT_MIN_HEADER_NAME "/$(MJIT_HEADER_INSTALL_DIR)/$(MJIT_MIN_HEADER_NAME)"; \ sep=,; \ quote "MJIT_CC_COMMON " $(MJIT_CC); \ - quote "MJIT_CFLAGS $${archs:+ MJIT_ARCHFLAG}" -w; \ + quote "MJIT_CFLAGS $${need_mjit_archflag:+ MJIT_ARCHFLAG}" -w; \ quote "MJIT_OPTFLAGS " $(MJIT_OPTFLAGS); \ quote "MJIT_DEBUGFLAGS " $(MJIT_DEBUGFLAGS); \ quote "MJIT_LDSHARED " $(MJIT_LDSHARED); \ - quote "MJIT_DLDFLAGS $${archs:+ MJIT_ARCHFLAG}" $(MJIT_DLDFLAGS); \ + quote "MJIT_DLDFLAGS $${need_mjit_archflag:+ MJIT_ARCHFLAG}" $(MJIT_DLDFLAGS); \ quote "MJIT_LIBS " $(LIBRUBYARG_SHARED); \ $${archs:+echo} $${archs:+'#if 0'}; \ for arch in $$archs; do \ echo "#elif defined __$${arch%=*}__"; \ quote " MJIT_ARCHFLAG " -arch $${arch%=*}; \ done; \ + $${archs:+echo} $${archs:+'#else'}; \ + if [ "$${arch_flag}" != "" ]; then \ + quote " MJIT_ARCHFLAG " $${arch_flag}; \ + fi; \ $${archs:+echo} $${archs:+'#endif'}; \ echo; \ echo '#endif /* RUBY_MJIT_CONFIG_H */'; \ |