summaryrefslogtreecommitdiff
path: root/ext/psych/extconf.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ext/psych/extconf.rb')
-rw-r--r--ext/psych/extconf.rb17
1 files changed, 7 insertions, 10 deletions
diff --git a/ext/psych/extconf.rb b/ext/psych/extconf.rb
index b294aab..65e83a3 100644
--- a/ext/psych/extconf.rb
+++ b/ext/psych/extconf.rb
@@ -1,3 +1,4 @@
+# -*- coding: us-ascii -*-
require 'mkmf'
require 'fileutils'
@@ -5,20 +6,16 @@ require 'fileutils'
dir_config 'libyaml'
-unless find_header('yaml.h') && find_library('yaml', 'yaml_get_version')
+if enable_config("bundled-libyaml", false) || !(find_header('yaml.h') && find_library('yaml', 'yaml_get_version'))
# Embed libyaml since we could not find it.
- srcdir = File.expand_path File.dirname __FILE__
- files = Dir.chdir File.join(srcdir, 'yaml') do
- Dir.entries(Dir.pwd).find_all { |f|
- File.file?(f) && File.extname(f) =~ /^\.[hc]/
- }.map { |f| File.expand_path f }
- end
+ $VPATH << "$(srcdir)/yaml"
+ $INCFLAGS << " -I$(srcdir)/yaml"
- FileUtils.cp_r files, srcdir
+ $srcs = Dir.glob("#{$srcdir}/{,yaml/}*.c").map {|n| File.basename(n)}
- if $mswin
- $CFLAGS += " -DYAML_DECLARE_STATIC -DHAVE_CONFIG_H"
+ if have_macro("_WIN32")
+ $CPPFLAGS << " -DYAML_DECLARE_STATIC -DHAVE_CONFIG_H"
end
have_header 'dlfcn.h'