diff --git a/ChangeLog b/ChangeLog index 73e8f1d32b..efc41ca39e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Feb 27 10:54:20 2012 Nobuyoshi Nakada + + * lib/mkmf.rb (try_cppflags, try_cflags, try_ldflags): replace the + target flags if the given flag is accepted. + Mon Feb 27 10:53:44 2012 Nobuyoshi Nakada * test/rubygems/test_gem_specification.rb (test_self_from_yaml_syck_default_key_bug): diff --git a/lib/mkmf.rb b/lib/mkmf.rb index a29e5bafbd..9f31166b5f 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -550,6 +550,12 @@ MSG $CPPFLAGS = cppflags unless ret end + def try_cppflags(flags) + with_cppflags(flags) do + try_header("int main() {return 0;}") + end + end + def with_cflags(flags) cflags = $CFLAGS $CFLAGS = flags @@ -558,6 +564,12 @@ MSG $CFLAGS = cflags unless ret end + def try_cflags(flags) + with_cflags(flags) do + try_compile("int main() {return 0;}") + end + end + def with_ldflags(flags) ldflags = $LDFLAGS $LDFLAGS = flags @@ -566,6 +578,12 @@ MSG $LDFLAGS = ldflags unless ret end + def try_ldflags(flags) + with_ldflags(flags) do + try_link("int main() {return 0;}") + end + end + def try_static_assert(expr, headers = nil, opt = "", &b) headers = cpp_include(headers) try_compile(<