diff options
author | Alan Wu <XrXr@users.noreply.github.com> | 2022-04-04 15:23:42 -0400 |
---|---|---|
committer | Alan Wu <XrXr@users.noreply.github.com> | 2022-04-05 12:57:55 -0400 |
commit | 2304cfa4c08a347f4df4915f88fb062cb12e4eeb (patch) | |
tree | 8d619d7681263ebe30368f64e3379403aed8e920 /lib | |
parent | 3bb70a6924ddd83f90b508b5bbc4d5629b8a41c6 (diff) |
Document MakeMakefile#append_cflags
This method is at least 7 years old and is widely used in the wild.
Since we need to support it, let's document it to make it discoverable.
Add docs and move it out of the `# :stopdoc:` zone.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5760
Diffstat (limited to 'lib')
-rw-r--r-- | lib/mkmf.rb | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/lib/mkmf.rb b/lib/mkmf.rb index 4ced064a8b..547a28577e 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -680,16 +680,6 @@ 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.dup @@ -1024,6 +1014,21 @@ SRC # :startdoc: + # Check whether each given C compiler flag is acceptable and append it + # to <tt>$CFLAGS</tt> if so. + # + # [+flags+] a C compiler flag as a +String+ or an +Array+ of them + # + 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 + # Returns whether or not +macro+ is defined either in the common header # files or within any +headers+ you provide. # |