diff options
author | Nobuyoshi Nakada <[email protected]> | 2021-07-08 16:56:32 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2021-07-08 18:18:35 +0900 |
commit | 524513be399e81bb170ec88aa0d501f33cbde8c3 (patch) | |
tree | 3fc823c15917e56fd3e568423368635ccbc7fd43 /lib/mkmf.rb | |
parent | d6cf4c0c997752c9e23876a8d5c205737317a6e3 (diff) |
mkmf.rb: try linking at try_var
To check for variables accessible but not declared.
Diffstat (limited to 'lib/mkmf.rb')
-rw-r--r-- | lib/mkmf.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/mkmf.rb b/lib/mkmf.rb index 3a84aba370..04b5f26a5e 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -812,13 +812,21 @@ SRC # You should use +have_var+ rather than +try_var+. def try_var(var, headers = nil, opt = "", &b) headers = cpp_include(headers) - try_compile(<<"SRC", opt, &b) + try_compile(<<"SRC", opt, &b) or #{headers} /*top*/ extern int t(void); #{MAIN_DOES_NOTHING 't'} int t(void) { const volatile void *volatile p; p = &(&#{var})[0]; return !p; } SRC + try_link(<<"SRC", opt, &b) +#{headers} +/*top*/ +extern int t(void); +#{MAIN_DOES_NOTHING 't'} +extern int #{var}; +int t(void) { const volatile void *volatile p; p = &(&#{var})[0]; return !p; } +SRC end # Returns whether or not the +src+ can be preprocessed with the C |