mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
mkmf.rb: methods to append flags
* lib/mkmf.rb (append_cppflags, append_cflags, append_ldflags): utility methods to append compiler options. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50223 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1b1a0bda67
commit
bb96ab6fb6
3 changed files with 36 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
|||
Sat Apr 11 10:59:58 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* lib/mkmf.rb (append_cppflags, append_cflags, append_ldflags):
|
||||
utility methods to append compiler options.
|
||||
|
||||
Sat Apr 11 08:22:24 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
|
||||
|
||||
* lib/rdoc/text.rb: removed duplicated code.
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
require 'mkmf'
|
||||
if try_cflags("-std=iso9899:1999")
|
||||
$CFLAGS += " " << "-std=iso9899:1999"
|
||||
end
|
||||
append_cflags("-std=iso9899:1999")
|
||||
create_makefile('date_core')
|
||||
|
|
30
lib/mkmf.rb
30
lib/mkmf.rb
|
@ -613,6 +613,16 @@ MSG
|
|||
try_header(MAIN_DOES_NOTHING, flags, {:werror => true}.update(opts))
|
||||
end
|
||||
|
||||
def append_cppflags(flags, *opts)
|
||||
Array(flags).each do |flag|
|
||||
if checking_for "whether #{flag} is accepted as CPPFLAGS" {
|
||||
try_cppflags(flag, *opts)
|
||||
}
|
||||
$CPPFLAGS << " " << flag
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def with_cflags(flags)
|
||||
cflags = $CFLAGS
|
||||
$CFLAGS = flags
|
||||
|
@ -625,6 +635,16 @@ MSG
|
|||
try_compile(MAIN_DOES_NOTHING, flags, {:werror => true}.update(opts))
|
||||
end
|
||||
|
||||
def append_cflags(flags, *opts)
|
||||
Array(flags).each do |flag|
|
||||
if checking_for "whether #{flag} is accepted as CFLAGS" {
|
||||
try_cflags(flag, *opts)
|
||||
}
|
||||
$CFLAGS << " " << flag
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def with_ldflags(flags)
|
||||
ldflags = $LDFLAGS
|
||||
$LDFLAGS = flags
|
||||
|
@ -637,6 +657,16 @@ MSG
|
|||
try_link(MAIN_DOES_NOTHING, flags, {:werror => true}.update(opts))
|
||||
end
|
||||
|
||||
def append_ldflags(flags, *opts)
|
||||
Array(flags).each do |flag|
|
||||
if checking_for "whether #{flag} is accepted as LDFLAGS" {
|
||||
try_ldflags(flag, *opts)
|
||||
}
|
||||
$LDFLAGS << " " << flag
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def try_static_assert(expr, headers = nil, opt = "", &b)
|
||||
headers = cpp_include(headers)
|
||||
try_compile(<<SRC, opt, &b)
|
||||
|
|
Loading…
Reference in a new issue