glib2 0.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. data/ChangeLog +3023 -0
  2. data/README +28 -0
  3. data/Rakefile +87 -0
  4. data/extconf.rb +61 -0
  5. data/sample/bookmarkfile.rb +66 -0
  6. data/sample/completion.rb +45 -0
  7. data/sample/idle.rb +41 -0
  8. data/sample/iochannel.rb +44 -0
  9. data/sample/keyfile.rb +62 -0
  10. data/sample/shell.rb +36 -0
  11. data/sample/spawn.rb +25 -0
  12. data/sample/timeout.rb +28 -0
  13. data/sample/timeout2.rb +35 -0
  14. data/sample/timer.rb +40 -0
  15. data/sample/type-register.rb +103 -0
  16. data/sample/type-register2.rb +104 -0
  17. data/sample/utils.rb +54 -0
  18. data/src/glib-enum-types.c +1032 -0
  19. data/src/glib-enum-types.h +140 -0
  20. data/src/lib/glib-mkenums.rb +199 -0
  21. data/src/lib/glib2.rb +220 -0
  22. data/src/lib/mkmf-gnome2.rb +390 -0
  23. data/src/lib/pkg-config.rb +137 -0
  24. data/src/rbgcompat.h +30 -0
  25. data/src/rbglib.c +320 -0
  26. data/src/rbglib.h +96 -0
  27. data/src/rbglib_bookmarkfile.c +595 -0
  28. data/src/rbglib_completion.c +192 -0
  29. data/src/rbglib_convert.c +195 -0
  30. data/src/rbglib_error.c +95 -0
  31. data/src/rbglib_fileutils.c +83 -0
  32. data/src/rbglib_i18n.c +44 -0
  33. data/src/rbglib_int64.c +157 -0
  34. data/src/rbglib_iochannel.c +883 -0
  35. data/src/rbglib_keyfile.c +846 -0
  36. data/src/rbglib_maincontext.c +917 -0
  37. data/src/rbglib_mainloop.c +87 -0
  38. data/src/rbglib_messages.c +150 -0
  39. data/src/rbglib_pollfd.c +111 -0
  40. data/src/rbglib_shell.c +68 -0
  41. data/src/rbglib_source.c +190 -0
  42. data/src/rbglib_spawn.c +345 -0
  43. data/src/rbglib_threads.c +51 -0
  44. data/src/rbglib_timer.c +127 -0
  45. data/src/rbglib_unicode.c +611 -0
  46. data/src/rbglib_utils.c +386 -0
  47. data/src/rbglib_win32.c +136 -0
  48. data/src/rbgobj_boxed.c +251 -0
  49. data/src/rbgobj_closure.c +337 -0
  50. data/src/rbgobj_convert.c +167 -0
  51. data/src/rbgobj_enums.c +961 -0
  52. data/src/rbgobj_fundamental.c +30 -0
  53. data/src/rbgobj_object.c +892 -0
  54. data/src/rbgobj_param.c +390 -0
  55. data/src/rbgobj_paramspecs.c +305 -0
  56. data/src/rbgobj_signal.c +963 -0
  57. data/src/rbgobj_strv.c +61 -0
  58. data/src/rbgobj_type.c +851 -0
  59. data/src/rbgobj_typeinstance.c +121 -0
  60. data/src/rbgobj_typeinterface.c +148 -0
  61. data/src/rbgobj_typemodule.c +66 -0
  62. data/src/rbgobj_typeplugin.c +49 -0
  63. data/src/rbgobj_value.c +313 -0
  64. data/src/rbgobj_valuearray.c +59 -0
  65. data/src/rbgobj_valuetypes.c +298 -0
  66. data/src/rbgobject.c +406 -0
  67. data/src/rbgobject.h +265 -0
  68. data/src/rbgprivate.h +88 -0
  69. data/src/rbgutil.c +222 -0
  70. data/src/rbgutil.h +82 -0
  71. data/src/rbgutil_callback.c +231 -0
  72. data/test/glib-test-init.rb +6 -0
  73. data/test/glib-test-utils.rb +12 -0
  74. data/test/run-test.rb +25 -0
  75. data/test/test_enum.rb +99 -0
  76. data/test/test_file_utils.rb +15 -0
  77. data/test/test_glib2.rb +120 -0
  78. data/test/test_iochannel.rb +275 -0
  79. data/test/test_key_file.rb +38 -0
  80. data/test/test_mkenums.rb +25 -0
  81. data/test/test_signal.rb +20 -0
  82. data/test/test_timeout.rb +28 -0
  83. data/test/test_unicode.rb +369 -0
  84. data/test/test_utils.rb +37 -0
  85. data/test/test_win32.rb +13 -0
  86. metadata +165 -0
@@ -0,0 +1,390 @@
1
+ #
2
+ # mkmf-gnome2.rb
3
+ #
4
+ # Extended mkmf for Ruby-GNOME2 and Ruby/GLib based libraries.
5
+ #
6
+ # Copyright(C) 2003-2005 Ruby-GNOME2 Project.
7
+ #
8
+ # This program is licenced under the same
9
+ # license of Ruby-GNOME2.
10
+ #
11
+
12
+ require 'mkmf'
13
+ require 'pkg-config'
14
+ require 'glib-mkenums'
15
+
16
+ unless defined?(macro_defined?)
17
+ def macro_defined?(macro, src, opt="")
18
+ try_cpp(src + <<EOP, opt)
19
+ #ifndef #{macro}
20
+ # error
21
+ #endif
22
+ EOP
23
+ end
24
+ end
25
+
26
+
27
+ STDOUT.print("checking for GCC... ")
28
+ STDOUT.flush
29
+ if macro_defined?("__GNUC__", "")
30
+ STDOUT.print "yes\n"
31
+ $CFLAGS += ' -Wall'
32
+ $cc_is_gcc = true
33
+ else
34
+ STDOUT.print "no\n"
35
+ $cc_is_gcc = false
36
+ end
37
+
38
+ include_path = nil
39
+ if ENV['GTK_BASEPATH'] and /cygwin/ !~ RUBY_PLATFORM
40
+ include_path = (ENV['GTK_BASEPATH'] + "\\INCLUDE").gsub("\\", "/")
41
+ # $hdrdir += " -I#{include_path} "
42
+ $CFLAGS += " -I#{include_path} "
43
+ end
44
+
45
+ def check_win32()
46
+ $G_PLATFORM_WIN32 = false
47
+ $G_OS_WIN32 = false
48
+ $G_WITH_CYGWIN = false
49
+
50
+ STDOUT.print("checking for G_PLATFORM_WIN32... ")
51
+ STDOUT.flush
52
+ if macro_defined?('G_PLATFORM_WIN32', "#include <glibconfig.h>\n")
53
+ STDOUT.print "yes\n"
54
+ $G_PLATFORM_WIN32 = true
55
+ else
56
+ STDOUT.print "no\n"
57
+ end
58
+
59
+ if $G_PLATFORM_WIN32
60
+ STDOUT.print("checking for G_OS_WIN32... ")
61
+ STDOUT.flush
62
+ if macro_defined?('G_OS_WIN32', "#include <glibconfig.h>\n")
63
+ STDOUT.print "yes\n"
64
+ $G_OS_WIN32 = true
65
+ if $cc_is_gcc
66
+ if /^2\./ =~ `#{Config::CONFIG['CC']} -dumpversion`.chomp
67
+ $CFLAGS += ' -fnative-struct'
68
+ else
69
+ $CFLAGS += ' -mms-bitfields'
70
+ end
71
+ end
72
+ else
73
+ STDOUT.print "no\n"
74
+ end
75
+
76
+ # STDOUT.print("checking for G_WITH_CYGWIN... ")
77
+ # STDOUT.flush
78
+ # if macro_defined?('G_WITH_CYGWIN', "#include <glibconfig.h>\n")
79
+ # STDOUT.print "yes\n"
80
+ # $G_WITH_CYGWIN = true
81
+ # else
82
+ # STDOUT.print "no\n"
83
+ # end
84
+ end
85
+
86
+ nil
87
+ end
88
+
89
+ def set_output_lib(target_name)
90
+ if /cygwin|mingw/ =~ RUBY_PLATFORM
91
+ filename = "libruby-#{target_name}.a"
92
+ if RUBY_VERSION > "1.8.0"
93
+ $DLDFLAGS << ",--out-implib=#{filename}" if filename
94
+ elsif RUBY_VERSION > "1.8"
95
+ $DLDFLAGS.gsub!(/ -Wl,--out-implib=[^ ]+/, '')
96
+ $DLDFLAGS << " -Wl,--out-implib=#{filename}" if filename
97
+ else
98
+ $DLDFLAGS.gsub!(/ --output-lib\s+[^ ]+/, '')
99
+ $DLDFLAGS << " --output-lib #{filename}" if filename
100
+ end
101
+ elsif /mswin32/ =~ RUBY_PLATFORM
102
+ filename = "libruby-#{target_name}.lib"
103
+ $DLDFLAGS.gsub!(/ --output-lib\s+[^ ]+/, '')
104
+ $DLDFLAGS.gsub!(/ \/IMPLIB:[^ ]+/, '')
105
+ $DLDFLAGS << " /IMPLIB:#{filename}" if filename
106
+ end
107
+ end
108
+
109
+ def setup_win32(target_name)
110
+ check_win32
111
+ set_output_lib(target_name)
112
+ end
113
+
114
+ #add_depend_package("glib2", "glib/src", "/...../ruby-gnome2")
115
+ def add_depend_package(target_name, target_srcdir, top_srcdir)
116
+ [top_srcdir, $configure_args['--topdir']].each do |topdir|
117
+ topdir = File.expand_path(topdir)
118
+ if RUBY_VERSION < "1.8.5"
119
+ $CFLAGS = "-I#{File.join(topdir, target_srcdir)} #{$CFLAGS}"
120
+ else
121
+ $INCFLAGS = "-I#{File.join(topdir, target_srcdir)} #{$INCFLAGS}"
122
+ end
123
+
124
+ if /cygwin|mingw/ =~ RUBY_PLATFORM
125
+ $libs << " -lruby-#{target_name}"
126
+ $LDFLAGS << " -L#{topdir}/#{target_srcdir}"
127
+ elsif /mswin32/ =~ RUBY_PLATFORM
128
+ $DLDFLAGS << " /libpath:#{topdir}/#{target_srcdir}"
129
+ $libs << " libruby-#{target_name}.lib"
130
+ end
131
+ end
132
+ end
133
+
134
+ def add_distcleanfile(file)
135
+ $distcleanfiles ||= []
136
+ $distcleanfiles << file
137
+ end
138
+
139
+ def create_pkg_config_file(package_name, c_package,
140
+ version=nil, pc_file_name=nil)
141
+ pc_file_name ||= "#{package_name.downcase.sub(/\//, '-')}.pc"
142
+ version ||= ruby_gnome2_version || PKGConfig.modversion(c_package)
143
+
144
+ puts "creating #{pc_file_name}"
145
+
146
+ File.open(pc_file_name, 'w') do |pc_file|
147
+ if package_name.nil?
148
+ c_module_name = PKGConfig.name(c_package)
149
+ package_name = "Ruby/#{c_module_name}" if c_module_name
150
+ end
151
+ pc_file.puts("Name: #{package_name}") if package_name
152
+
153
+ description = PKGConfig.description(c_package)
154
+ pc_file.puts("Description: Ruby bindings for #{description}") if description
155
+ pc_file.printf("Version: #{version}")
156
+ end
157
+ end
158
+
159
+ def ruby_gnome2_version(glib_source_directory=nil)
160
+ glib_source_directory ||= File.join(File.dirname(__FILE__), "..")
161
+ rbglib_h = File.join(glib_source_directory, "rbglib.h")
162
+ return nil unless File.exist?(rbglib_h)
163
+
164
+ version = nil
165
+ File.open(rbglib_h) do |h_file|
166
+ version_info = {}
167
+ h_file.each_line do |line|
168
+ case line
169
+ when /\A#define RBGLIB_(MAJOR|MINOR|MICRO)_VERSION\s+(\d+)/
170
+ version_info[$1] = $2
171
+ end
172
+ end
173
+ version_info = [version_info["MAJOR"],
174
+ version_info["MINOR"],
175
+ version_info["MICRO"]].compact
176
+ version = version_info.join(".") if version_info.size == 3
177
+ end
178
+
179
+ version
180
+ end
181
+
182
+ def create_makefile_at_srcdir(pkg_name, srcdir, defs = nil)
183
+ base_dir = File.basename(Dir.pwd)
184
+ last_common_index = srcdir.rindex(base_dir)
185
+ if last_common_index
186
+ builddir = srcdir[(last_common_index + base_dir.size + 1)..-1]
187
+ end
188
+ builddir ||= "."
189
+ FileUtils.mkdir_p(builddir)
190
+
191
+ Dir.chdir(builddir) do
192
+ yield if block_given?
193
+
194
+ $defs << defs if defs
195
+
196
+ pattern = "*.{#{SRC_EXT.join(',')}}"
197
+ srcs = Dir[File.join(srcdir, pattern)]
198
+ srcs |= Dir[File.join(".", pattern)]
199
+ $objs = srcs.collect do |src|
200
+ File.basename(src, ".*") + ".o"
201
+ end.flatten.uniq
202
+
203
+ create_makefile(pkg_name, srcdir)
204
+ end
205
+ end
206
+
207
+ def run_make_in_sub_dirs_command(command, sub_dirs)
208
+ if /mswin32/ =~ RUBY_PLATFORM
209
+ sub_dirs.collect do |dir|
210
+ <<-EOM.chmop
211
+ @cd #{dir}
212
+ @nmake -nologo DESTDIR=$(DESTDIR) #{command}
213
+ @cd ..
214
+ EOM
215
+ end.join("\n")
216
+ else
217
+ sub_dirs.collect do |dir|
218
+ "\t@cd #{dir}; $(MAKE) #{command}"
219
+ end.join("\n")
220
+ end
221
+ end
222
+
223
+ def create_top_makefile(sub_dirs=["src"])
224
+ File.open("Makefile", "w") do |makefile|
225
+ makefile.print(<<-EOM)
226
+ all:
227
+ #{run_make_in_sub_dirs_command("all", sub_dirs)}
228
+
229
+ install:
230
+ #{run_make_in_sub_dirs_command("install", sub_dirs)}
231
+
232
+ site-install:
233
+ #{run_make_in_sub_dirs_command("site-install", sub_dirs)}
234
+
235
+ clean:
236
+ #{run_make_in_sub_dirs_command("clean", sub_dirs)}
237
+ EOM
238
+
239
+ if /mswin32/ =~ RUBY_PLATFORM
240
+ makefile.print(<<-EOM)
241
+ @if exist extconf.h del extconf.h
242
+ @if exist conftest.* del conftest.*
243
+ @if exist *.lib del *.lib
244
+ @if exist *~ del *~
245
+ @if exist mkmf.log del mkmf.log
246
+ EOM
247
+ else
248
+ makefile.print(<<-EOM)
249
+
250
+ distclean: clean
251
+ #{run_make_in_sub_dirs_command("distclean", sub_dirs)}
252
+ @rm -f Makefile extconf.h conftest.*
253
+ @rm -f core *~ mkmf.log
254
+ EOM
255
+ end
256
+ end
257
+ end
258
+
259
+ # This is used for the library which doesn't support version info.
260
+ def make_version_header(app_name, pkgname, dir = "src")
261
+ version = PKGConfig.modversion(pkgname).split(/\./)
262
+ (0..2).each do |v|
263
+ version[v] = "0" unless version[v]
264
+ end
265
+ filename = "rb#{app_name.downcase}version.h"
266
+
267
+ puts "creating #{filename}"
268
+
269
+ add_distcleanfile(filename)
270
+
271
+ FileUtils.mkdir_p(dir)
272
+ out = File.open(File.join(dir, filename), "w")
273
+
274
+ out.print %Q[/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
275
+ /************************************************
276
+
277
+ #{filename} -
278
+
279
+ This file was generated by mkmf-gnome2.rb.
280
+
281
+ ************************************************/
282
+
283
+ #ifndef __RB#{app_name}_VERSION_H__
284
+ #define __RB#{app_name}_VERSION_H__
285
+
286
+ #define #{app_name}_MAJOR_VERSION (#{version[0]})
287
+ #define #{app_name}_MINOR_VERSION (#{version[1]})
288
+ #define #{app_name}_MICRO_VERSION (#{version[2]})
289
+
290
+ #define #{app_name}_CHECK_VERSION(major,minor,micro) \\
291
+ (#{app_name}_MAJOR_VERSION > (major) || \\
292
+ (#{app_name}_MAJOR_VERSION == (major) && #{app_name}_MINOR_VERSION > (minor)) || \\
293
+ (#{app_name}_MAJOR_VERSION == (major) && #{app_name}_MINOR_VERSION == (minor) && \\
294
+ #{app_name}_MICRO_VERSION >= (micro)))
295
+
296
+
297
+ #endif /* __RB#{app_name}_VERSION_H__ */
298
+ ]
299
+ out.close
300
+ end
301
+
302
+ def check_ruby_func
303
+ #Other options
304
+ ruby_header = "ruby.h"
305
+ have_func("rb_define_alloc_func", ruby_header) # for ruby-1.8
306
+ have_func("rb_block_proc", ruby_header) # for ruby-1.8
307
+
308
+ STDOUT.print("checking for new allocation framework... ") # for ruby-1.7
309
+ if Object.respond_to? :allocate
310
+ STDOUT.print "yes\n"
311
+ $defs << "-DHAVE_OBJECT_ALLOCATE"
312
+ else
313
+ STDOUT.print "no\n"
314
+ end
315
+
316
+ STDOUT.print("checking for attribute assignment... ") # for ruby-1.7
317
+ STDOUT.flush
318
+ if defined? try_compile and try_compile <<SRC
319
+ #include "ruby.h"
320
+ #include "node.h"
321
+ int node_attrasgn = (int)NODE_ATTRASGN;
322
+ SRC
323
+ STDOUT.print "yes\n"
324
+ $defs << "-DHAVE_NODE_ATTRASGN"
325
+ else
326
+ STDOUT.print "no\n"
327
+ end
328
+ end
329
+
330
+ def add_obj(name)
331
+ $objs << name unless $objs.index(name)
332
+ end
333
+
334
+ def glib_mkenums(prefix, files, g_type_prefix, include_files, options={})
335
+ add_distcleanfile(prefix + ".h")
336
+ add_distcleanfile(prefix + ".c")
337
+ GLib::MkEnums.create(prefix, files, g_type_prefix, include_files, options)
338
+ end
339
+
340
+ def check_cairo
341
+ return false unless PKGConfig.have_package('cairo')
342
+
343
+ have_rb_cairo_h = have_header('rb_cairo.h')
344
+ unless have_rb_cairo_h
345
+ begin
346
+ require 'rubygems'
347
+ gem 'cairo'
348
+ require 'cairo'
349
+ rcairo_src_gem_path_re =
350
+ /\A#{Regexp.escape(Gem.dir)}\/gems\/cairo-[\d.]+\/src\z/
351
+ $:.each do |path|
352
+ if rcairo_src_gem_path_re =~ path
353
+ $CFLAGS += " -I#{path} "
354
+ have_rb_cairo_h = have_header('rb_cairo.h')
355
+ break
356
+ end
357
+ end
358
+ rescue LoadError
359
+ end
360
+ end
361
+
362
+ if have_rb_cairo_h
363
+ if /mingw|cygwin|mswin32/ =~ RUBY_PLATFORM
364
+ unless ENV["CAIRO_PATH"]
365
+ puts "Error! Set CAIRO_PATH."
366
+ exit 1
367
+ end
368
+ add_depend_package("cairo", "src", ENV["CAIRO_PATH"])
369
+ $defs << "-DRUBY_CAIRO_PLATFORM_WIN32"
370
+ end
371
+ end
372
+ have_rb_cairo_h
373
+ end
374
+
375
+ add_include_path = Proc.new do |dir_variable|
376
+ value = Config::CONFIG[dir_variable]
377
+ if value and File.exist?(value)
378
+ $INCFLAGS << " -I$(#{dir_variable}) "
379
+ end
380
+ end
381
+
382
+ add_include_path.call("sitearchdir")
383
+ add_include_path.call("vendorarchdir")
384
+
385
+ check_ruby_func
386
+
387
+ if /mingw/ =~ RUBY_PLATFORM
388
+ $ruby.gsub!('\\', '/')
389
+ end
390
+
@@ -0,0 +1,137 @@
1
+ #
2
+ # pkg-config.rb
3
+ #
4
+ # Wrapper of pkg-config tool.
5
+ #
6
+ # Copyright(C) 2003-2005 Ruby-GNOME2 Project.
7
+ #
8
+ # This file is part of Ruby/GLib2.
9
+ #
10
+ # Ruby/GLib2 is free software: you can redistribute it and/or modify
11
+ # it under the terms of the GNU Lesser General Public License as published by
12
+ # the Free Software Foundation, either version 2.1 of the License.
13
+ #
14
+ # Foobar is distributed in the hope that it will be useful,
15
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ # GNU Lesser General Public License for more details.
18
+ #
19
+ # You should have received a copy of the GNU Lesser General Public License
20
+ # along with Foobar. If not, see <http://www.gnu.org/licenses/>.
21
+
22
+
23
+ require 'mkmf'
24
+ require 'shellwords'
25
+
26
+ module PKGConfig
27
+ @@cmd = with_config('pkg-config', ENV["PKG_CONFIG"] || 'pkg-config')
28
+ if /mswin32/ =~ RUBY_PLATFORM and /^cl\b/ =~ Config::CONFIG['CC']
29
+ @@cmd += ' --msvc-syntax'
30
+ end
31
+
32
+ @@list = {}
33
+ `#{@@cmd} --list-all`.chomp.split(/\n/).each{|v|
34
+ pkg, name, desc = /(\S+?)\s+(.*?)\s-\s(.*)/.match(v).to_a[1..3]
35
+ @@list[pkg] = [name, desc]
36
+ }
37
+
38
+ module_function
39
+ def exist?(pkg)
40
+ system("#{@@cmd} --exists #{pkg}")
41
+ end
42
+
43
+ def libs(pkg)
44
+ `#{@@cmd} --libs #{pkg}`.chomp
45
+ end
46
+
47
+ def libs_only_L(pkg)
48
+ `#{@@cmd} --libs-only-L #{pkg}`.chomp
49
+ end
50
+
51
+ def libs_only_l(pkg)
52
+ `#{@@cmd} --libs-only-l #{pkg}`.chomp
53
+ end
54
+
55
+ def cflags(pkg)
56
+ `#{@@cmd} --cflags #{pkg}`.chomp
57
+ end
58
+
59
+ def cflags_only_I(pkg)
60
+ `#{@@cmd} --cflags-only-I #{pkg}`.chomp
61
+ end
62
+
63
+ def cflags_only_other(pkg)
64
+ `#{@@cmd} --cflags-only-other #{pkg}`.chomp
65
+ end
66
+
67
+ def variable(pkg, var)
68
+ `#{@@cmd} --variable=#{var} #{pkg}`.chomp
69
+ end
70
+
71
+ def modversion(pkg)
72
+ `#{@@cmd} --modversion #{pkg}`.chomp
73
+ end
74
+
75
+ def version
76
+ `#{@@cmd} --version`.chomp
77
+ end
78
+
79
+ def list_all
80
+ # Returns [pkg, name, description]
81
+ @@list.keys.collect{|key| [key] + @@list[key]}.sort
82
+ end
83
+
84
+ def name(pkg)
85
+ @@list[pkg][0]
86
+ end
87
+
88
+ def description(pkg)
89
+ @@list[pkg][1]
90
+ end
91
+
92
+ def provides(pkg)
93
+ `#{@@cmd} --print-provides #{pkg}`.chomp
94
+ end
95
+
96
+ def requires(pkg)
97
+ `#{@@cmd} --print-requires #{pkg}`.chomp.gsub("\n", ", ")
98
+ end
99
+
100
+ def check_version?(pkg, major = 0, minor = 0, micro = 0)
101
+ return false unless exist?(pkg)
102
+ ver = modversion(pkg).split(".").collect{|item| item.to_i}
103
+ (0..2).each {|i| ver[i] = 0 unless ver[i]}
104
+
105
+ (ver[0] > major ||
106
+ (ver[0] == major && ver[1] > minor) ||
107
+ (ver[0] == major && ver[1] == minor &&
108
+ ver[2] >= micro))
109
+ end
110
+
111
+ def have_package(pkg, major = nil, minor = 0, micro = 0)
112
+ if major.nil?
113
+ STDOUT.print("checking for #{pkg}... ")
114
+ else
115
+ STDOUT.print("checking for #{pkg} version (>= #{major}.#{minor}.#{micro})... ")
116
+ end
117
+ major ||= 0
118
+ STDOUT.flush
119
+ if check_version?(pkg, major, minor, micro)
120
+ STDOUT.print "yes\n"
121
+ libraries = libs_only_l(pkg)
122
+ dldflags = libs(pkg)
123
+ dldflags = (Shellwords.shellwords(dldflags) - Shellwords.shellwords(libraries)).map{|s| /\s/ =~ s ? "\"#{s}\"" : s }.join(' ')
124
+ $libs += ' ' + libraries
125
+ if /mswin32/ =~ RUBY_PLATFORM
126
+ $DLDFLAGS += ' ' + dldflags
127
+ else
128
+ $LDFLAGS += ' ' + dldflags
129
+ end
130
+ $CFLAGS += ' ' + cflags(pkg)
131
+ true
132
+ else
133
+ STDOUT.print "no\n"
134
+ false
135
+ end
136
+ end
137
+ end