ruby-changes:51617
From: ngoto <ko1@a...>
Date: Mon, 2 Jul 2018 22:50:58 +0900 (JST)
Subject: [ruby-changes:51617] ngoto:r63828 (trunk): Makefile.in: ARCH_FLAG may contain "-m64" etc.
ngoto 2018-07-02 22:50:53 +0900 (Mon, 02 Jul 2018) New Revision: 63828 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63828 Log: 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] Modified files: trunk/Makefile.in Index: Makefile.in =================================================================== --- Makefile.in (revision 63827) +++ Makefile.in (revision 63828) @@ -560,9 +560,26 @@ mjit_config.h: https://github.com/ruby/ruby/blob/trunk/Makefile.in#L560 $${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: https://github.com/ruby/ruby/blob/trunk/Makefile.in#L587 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 */'; \ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/