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:
nobu 2015-04-11 02:00:02 +00:00
Родитель 1b1a0bda67
Коммит bb96ab6fb6
3 изменённых файлов: 36 добавлений и 3 удалений

Просмотреть файл

@ -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')

Просмотреть файл

@ -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)