diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/mkmf.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/mkmf.rb b/lib/mkmf.rb index be9b06ca51..0d19562db6 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -1818,11 +1818,18 @@ SRC cflags = get['cflags'] end libs = get['libs-only-l'] - ldflags = (Shellwords.shellwords(ldflags) - Shellwords.shellwords(libs)).quote.join(" ") - $CFLAGS += " " << cflags - $CXXFLAGS += " " << cflags - $LDFLAGS = [orig_ldflags, ldflags].join(' ') + if cflags + $CFLAGS += " " << cflags + $CXXFLAGS += " " << cflags + end + if libs + ldflags = (Shellwords.shellwords(ldflags) - Shellwords.shellwords(libs)).quote.join(" ") + else + libs, ldflags = Shellwords.shellwords(ldflags).partition {|s| s =~ /-l([^ ]+)/ }.map {|l|l.quote.join(" ")} + end $libs += " " << libs + + $LDFLAGS = [orig_ldflags, ldflags].join(' ') Logging::message "package configuration for %s\n", pkg Logging::message "cflags: %s\nldflags: %s\nlibs: %s\n\n", cflags, ldflags, libs |