1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/tool/mjit_archflag.sh
nobu 3f84ef9740 fix for Solaris sh
* Makefile.in (mjit_config.h): removed unnecessary assignment.

* tool/mjit_archflag.sh (define_arch_flags): need to quote on
  Solaris.  [ruby-dev:50669] [Bug #15319]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-19 13:43:44 +00:00

41 lines
768 B
Bash

# -*- sh -*-
quote() {
printf "#${indent}define $1"
shift
${1+printf} ${1+' "%s"'$sep} ${1+"$@"}
echo
}
archs=""
arch_flag=""
parse_arch_flags() {
for arch in $1; do
archs="${archs:+$archs }${arch%=*}"
done
while shift && [ "$#" -gt 0 ]; do
case "$1" in
-arch)
shift
archs="${archs:+$archs }$1"
;;
*)
arch_flag="${arch_flag:+${arch_flag} }$1"
;;
esac
done
}
define_arch_flags() {
local indent=${archs:+' '}
${archs:+echo} ${archs:+'#if 0'}
for arch in $archs; do
echo "#elif defined __${arch}__"
quote "MJIT_ARCHFLAG " -arch "${arch}"
done
${archs:+echo} ${archs:+'#else'}
quote "MJIT_ARCHFLAG ${arch_flag:- /* no flag */}" ${arch_flag}
${archs:+echo} ${archs:+'#endif'}
}