rmagick 2.13.4 → 2.16.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rmagick might be problematic. Click here for more details.

Files changed (281) hide show
  1. checksums.yaml +4 -4
  2. data/.editorconfig +14 -0
  3. data/.hound.yml +2 -0
  4. data/.rspec +1 -0
  5. data/.rubocop.yml +340 -0
  6. data/.simplecov +27 -0
  7. data/.travis.yml +29 -12
  8. data/CHANGELOG.md +915 -0
  9. data/CODE_OF_CONDUCT.md +13 -0
  10. data/CONTRIBUTING.md +31 -3
  11. data/Gemfile +3 -0
  12. data/README.textile +94 -4
  13. data/Rakefile +57 -45
  14. data/before_install_linux.sh +26 -6
  15. data/deprecated/RMagick.rb +6 -0
  16. data/doc/comtasks.html +1 -1
  17. data/doc/draw.html +7 -4
  18. data/doc/ex/InitialCoords.rb +16 -17
  19. data/doc/ex/NewCoordSys.rb +21 -23
  20. data/doc/ex/OrigCoordSys.rb +8 -10
  21. data/doc/ex/PreserveAspectRatio.rb +182 -183
  22. data/doc/ex/RotateScale.rb +27 -28
  23. data/doc/ex/Skew.rb +27 -27
  24. data/doc/ex/Use01.rb +7 -8
  25. data/doc/ex/Use02.rb +11 -12
  26. data/doc/ex/Use03.rb +7 -7
  27. data/doc/ex/ViewBox.rb +16 -18
  28. data/doc/ex/adaptive_threshold.rb +4 -5
  29. data/doc/ex/add_noise.rb +4 -5
  30. data/doc/ex/affine.rb +4 -4
  31. data/doc/ex/affine_transform.rb +4 -4
  32. data/doc/ex/arc.rb +10 -10
  33. data/doc/ex/arcpath.rb +7 -8
  34. data/doc/ex/arcs01.rb +10 -10
  35. data/doc/ex/arcs02.rb +36 -38
  36. data/doc/ex/average.rb +5 -5
  37. data/doc/ex/axes.rb +4 -4
  38. data/doc/ex/baseline_shift01.rb +11 -12
  39. data/doc/ex/bilevel_channel.rb +2 -3
  40. data/doc/ex/blur_image.rb +2 -2
  41. data/doc/ex/border.rb +2 -2
  42. data/doc/ex/bounding_box.rb +9 -11
  43. data/doc/ex/cbezier1.rb +3 -4
  44. data/doc/ex/cbezier2.rb +3 -4
  45. data/doc/ex/cbezier3.rb +3 -4
  46. data/doc/ex/cbezier4.rb +3 -4
  47. data/doc/ex/cbezier5.rb +2 -3
  48. data/doc/ex/cbezier6.rb +3 -3
  49. data/doc/ex/channel.rb +10 -11
  50. data/doc/ex/charcoal.rb +2 -2
  51. data/doc/ex/chop.rb +2 -2
  52. data/doc/ex/circle.rb +3 -3
  53. data/doc/ex/circle01.rb +6 -7
  54. data/doc/ex/clip_path.rb +12 -12
  55. data/doc/ex/coalesce.rb +32 -35
  56. data/doc/ex/color_fill_to_border.rb +6 -6
  57. data/doc/ex/color_floodfill.rb +2 -2
  58. data/doc/ex/color_histogram.rb +17 -18
  59. data/doc/ex/color_reset.rb +2 -2
  60. data/doc/ex/colorize.rb +2 -2
  61. data/doc/ex/colors.rb +30 -30
  62. data/doc/ex/compose_mask.rb +8 -9
  63. data/doc/ex/composite.rb +14 -16
  64. data/doc/ex/composite_layers.rb +15 -15
  65. data/doc/ex/composite_tiled.rb +5 -7
  66. data/doc/ex/contrast.rb +12 -12
  67. data/doc/ex/crop.rb +3 -3
  68. data/doc/ex/crop_with_gravity.rb +13 -17
  69. data/doc/ex/cubic01.rb +18 -20
  70. data/doc/ex/cubic02.rb +64 -67
  71. data/doc/ex/cycle_colormap.rb +2 -2
  72. data/doc/ex/dissolve.rb +2 -3
  73. data/doc/ex/drawcomp.rb +34 -34
  74. data/doc/ex/drop_shadow.rb +8 -8
  75. data/doc/ex/edge.rb +2 -2
  76. data/doc/ex/ellipse.rb +4 -4
  77. data/doc/ex/ellipse01.rb +10 -11
  78. data/doc/ex/emboss.rb +2 -2
  79. data/doc/ex/enhance.rb +2 -2
  80. data/doc/ex/equalize.rb +2 -2
  81. data/doc/ex/evenodd.rb +31 -32
  82. data/doc/ex/fill_pattern.rb +12 -15
  83. data/doc/ex/flatten_images.rb +13 -13
  84. data/doc/ex/flip.rb +2 -2
  85. data/doc/ex/flop.rb +2 -2
  86. data/doc/ex/font_styles.rb +21 -23
  87. data/doc/ex/fonts.rb +14 -14
  88. data/doc/ex/frame.rb +3 -3
  89. data/doc/ex/gaussian_blur.rb +2 -2
  90. data/doc/ex/get_multiline_type_metrics.rb +6 -7
  91. data/doc/ex/get_pixels.rb +13 -14
  92. data/doc/ex/get_type_metrics.rb +26 -31
  93. data/doc/ex/gradientfill.rb +12 -12
  94. data/doc/ex/grav.rb +4 -5
  95. data/doc/ex/gravity.rb +61 -60
  96. data/doc/ex/group.rb +16 -16
  97. data/doc/ex/hatchfill.rb +10 -10
  98. data/doc/ex/image.rb +29 -31
  99. data/doc/ex/implode.rb +17 -17
  100. data/doc/ex/level.rb +2 -2
  101. data/doc/ex/level_colors.rb +4 -4
  102. data/doc/ex/line.rb +4 -5
  103. data/doc/ex/line01.rb +11 -13
  104. data/doc/ex/mask.rb +7 -8
  105. data/doc/ex/matte_fill_to_border.rb +2 -3
  106. data/doc/ex/matte_floodfill.rb +2 -3
  107. data/doc/ex/matte_replace.rb +2 -3
  108. data/doc/ex/median_filter.rb +2 -2
  109. data/doc/ex/modulate.rb +2 -2
  110. data/doc/ex/mono.rb +4 -4
  111. data/doc/ex/morph.rb +7 -8
  112. data/doc/ex/mosaic.rb +15 -15
  113. data/doc/ex/motion_blur.rb +2 -2
  114. data/doc/ex/negate.rb +2 -2
  115. data/doc/ex/negate_channel.rb +2 -2
  116. data/doc/ex/nested_rvg.rb +11 -11
  117. data/doc/ex/nonzero.rb +31 -32
  118. data/doc/ex/normalize.rb +2 -2
  119. data/doc/ex/oil_paint.rb +2 -2
  120. data/doc/ex/opacity.rb +3 -3
  121. data/doc/ex/ordered_dither.rb +2 -2
  122. data/doc/ex/path.rb +4 -5
  123. data/doc/ex/pattern1.rb +10 -10
  124. data/doc/ex/pattern2.rb +7 -7
  125. data/doc/ex/polaroid.rb +13 -14
  126. data/doc/ex/polygon.rb +6 -7
  127. data/doc/ex/polygon01.rb +10 -12
  128. data/doc/ex/polyline.rb +4 -5
  129. data/doc/ex/polyline01.rb +11 -13
  130. data/doc/ex/posterize.rb +2 -2
  131. data/doc/ex/preview.rb +3 -4
  132. data/doc/ex/qbezierpath.rb +5 -5
  133. data/doc/ex/quad01.rb +23 -25
  134. data/doc/ex/quantize-m.rb +5 -5
  135. data/doc/ex/radial_blur.rb +2 -2
  136. data/doc/ex/raise.rb +2 -2
  137. data/doc/ex/random_threshold_channel.rb +2 -2
  138. data/doc/ex/rect01.rb +6 -7
  139. data/doc/ex/rect02.rb +9 -11
  140. data/doc/ex/rectangle.rb +3 -4
  141. data/doc/ex/reduce_noise.rb +2 -2
  142. data/doc/ex/remap.rb +7 -8
  143. data/doc/ex/remap_images.rb +9 -11
  144. data/doc/ex/resize_to_fill.rb +3 -5
  145. data/doc/ex/resize_to_fit.rb +3 -5
  146. data/doc/ex/roll.rb +2 -2
  147. data/doc/ex/rotate.rb +6 -7
  148. data/doc/ex/rotate_f.rb +2 -2
  149. data/doc/ex/roundrect.rb +4 -5
  150. data/doc/ex/rubyname.rb +11 -11
  151. data/doc/ex/rvg_clippath.rb +5 -7
  152. data/doc/ex/rvg_linecap.rb +25 -26
  153. data/doc/ex/rvg_linejoin.rb +25 -26
  154. data/doc/ex/rvg_opacity.rb +10 -11
  155. data/doc/ex/rvg_pattern.rb +15 -15
  156. data/doc/ex/rvg_stroke_dasharray.rb +6 -7
  157. data/doc/ex/segment.rb +2 -2
  158. data/doc/ex/sepiatone.rb +2 -3
  159. data/doc/ex/shade.rb +2 -2
  160. data/doc/ex/shadow.rb +2 -3
  161. data/doc/ex/shave.rb +2 -2
  162. data/doc/ex/shear.rb +3 -3
  163. data/doc/ex/sketch.rb +2 -3
  164. data/doc/ex/skewx.rb +4 -5
  165. data/doc/ex/skewy.rb +3 -3
  166. data/doc/ex/smile.rb +113 -113
  167. data/doc/ex/solarize.rb +2 -2
  168. data/doc/ex/sparse_color.rb +29 -30
  169. data/doc/ex/splice.rb +2 -3
  170. data/doc/ex/spread.rb +2 -2
  171. data/doc/ex/stegano.rb +34 -34
  172. data/doc/ex/stroke_dasharray.rb +4 -5
  173. data/doc/ex/stroke_fill.rb +4 -5
  174. data/doc/ex/stroke_linecap.rb +3 -3
  175. data/doc/ex/stroke_linejoin.rb +3 -3
  176. data/doc/ex/stroke_width.rb +3 -3
  177. data/doc/ex/swirl.rb +2 -2
  178. data/doc/ex/text.rb +4 -4
  179. data/doc/ex/text01.rb +7 -8
  180. data/doc/ex/text_align.rb +2 -2
  181. data/doc/ex/text_antialias.rb +9 -10
  182. data/doc/ex/text_styles.rb +11 -13
  183. data/doc/ex/text_undercolor.rb +2 -2
  184. data/doc/ex/texture_fill_to_border.rb +6 -6
  185. data/doc/ex/texture_floodfill.rb +2 -2
  186. data/doc/ex/texturefill.rb +10 -11
  187. data/doc/ex/threshold.rb +2 -2
  188. data/doc/ex/to_blob.rb +4 -5
  189. data/doc/ex/translate.rb +6 -6
  190. data/doc/ex/transparent.rb +5 -5
  191. data/doc/ex/transpose.rb +2 -2
  192. data/doc/ex/transverse.rb +2 -2
  193. data/doc/ex/tref01.rb +11 -12
  194. data/doc/ex/triangle01.rb +5 -6
  195. data/doc/ex/trim.rb +1 -2
  196. data/doc/ex/tspan01.rb +8 -9
  197. data/doc/ex/tspan02.rb +9 -11
  198. data/doc/ex/tspan03.rb +9 -11
  199. data/doc/ex/unsharp_mask.rb +2 -2
  200. data/doc/ex/viewex.rb +19 -21
  201. data/doc/ex/vignette.rb +2 -2
  202. data/doc/ex/watermark.rb +15 -16
  203. data/doc/ex/wave.rb +2 -2
  204. data/doc/ex/wet_floor.rb +17 -18
  205. data/doc/ex/writing_mode01.rb +8 -9
  206. data/doc/ex/writing_mode02.rb +8 -8
  207. data/doc/ilist.html +1 -1
  208. data/doc/usage.html +8 -8
  209. data/examples/constitute.rb +6 -6
  210. data/examples/crop_with_gravity.rb +13 -17
  211. data/examples/demo.rb +305 -305
  212. data/examples/describe.rb +27 -28
  213. data/examples/find_similar_region.rb +16 -16
  214. data/examples/histogram.rb +228 -232
  215. data/examples/identify.rb +165 -167
  216. data/examples/image_opacity.rb +4 -4
  217. data/examples/import_export.rb +10 -10
  218. data/examples/pattern_fill.rb +9 -9
  219. data/examples/rotating_text.rb +13 -14
  220. data/examples/spinner.rb +18 -19
  221. data/examples/thumbnail.rb +13 -14
  222. data/examples/vignette.rb +8 -9
  223. data/ext/RMagick/extconf.rb +489 -367
  224. data/ext/RMagick/rmagick.c +11 -4
  225. data/ext/RMagick/rmagick.h +4 -0
  226. data/ext/RMagick/rmdraw.c +49 -18
  227. data/ext/RMagick/rmenum.c +18 -7
  228. data/ext/RMagick/rmfill.c +4 -1
  229. data/ext/RMagick/rmilist.c +49 -13
  230. data/ext/RMagick/rmimage.c +196 -59
  231. data/ext/RMagick/rminfo.c +33 -10
  232. data/ext/RMagick/rmmain.c +18 -6
  233. data/ext/RMagick/rmmontage.c +12 -4
  234. data/ext/RMagick/rmpixel.c +18 -5
  235. data/ext/RMagick/rmstruct.c +108 -31
  236. data/ext/RMagick/rmutil.c +50 -26
  237. data/lib/rmagick/version.rb +4 -3
  238. data/lib/rmagick_internal.rb +1159 -1176
  239. data/lib/rvg/clippath.rb +36 -39
  240. data/lib/rvg/container.rb +115 -124
  241. data/lib/rvg/deep_equal.rb +46 -50
  242. data/lib/rvg/describable.rb +41 -47
  243. data/lib/rvg/embellishable.rb +384 -410
  244. data/lib/rvg/misc.rb +697 -714
  245. data/lib/rvg/paint.rb +42 -47
  246. data/lib/rvg/pathdata.rb +120 -125
  247. data/lib/rvg/rvg.rb +213 -213
  248. data/lib/rvg/stretchable.rb +159 -162
  249. data/lib/rvg/stylable.rb +109 -117
  250. data/lib/rvg/text.rb +9 -24
  251. data/lib/rvg/transformable.rb +120 -127
  252. data/lib/rvg/units.rb +58 -61
  253. data/rmagick.gemspec +46 -15
  254. data/spec/rmagick/ImageList1_spec.rb +24 -0
  255. data/spec/rmagick/draw_spec.rb +156 -0
  256. data/spec/rmagick/image/blue_shift_spec.rb +16 -0
  257. data/spec/rmagick/image/composite_spec.rb +140 -0
  258. data/spec/rmagick/image/constitute_spec.rb +15 -0
  259. data/spec/rmagick/image/dispatch_spec.rb +18 -0
  260. data/spec/rmagick/image/from_blob_spec.rb +14 -0
  261. data/spec/rmagick/image/ping_spec.rb +14 -0
  262. data/spec/rmagick/image/properties_spec.rb +29 -0
  263. data/spec/spec_helper.rb +4 -0
  264. data/test/Image1.rb +529 -727
  265. data/test/Image2.rb +1291 -1299
  266. data/test/Image3.rb +978 -981
  267. data/test/ImageList1.rb +7 -9
  268. data/test/ImageList2.rb +346 -350
  269. data/test/Image_attributes.rb +683 -686
  270. data/test/Import_Export.rb +25 -30
  271. data/test/Info.rb +339 -343
  272. data/test/Magick.rb +250 -253
  273. data/test/Pixel.rb +107 -110
  274. data/test/Preview.rb +48 -53
  275. data/test/test_all_basic.rb +15 -11
  276. data/test/tmpnam_test.rb +3 -3
  277. data/wercker.yml +10 -0
  278. metadata +77 -10
  279. data/ChangeLog +0 -816
  280. data/lib/RMagick.rb +0 -1
  281. data/test/Draw.rb +0 -121
@@ -1,103 +1,316 @@
1
- require "mkmf"
2
- require "date"
1
+ lib_dir = File.expand_path('../../lib', File.dirname(__FILE__))
2
+ $LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
3
+ require 'rubygems'
4
+ require 'mkmf'
5
+ require 'date'
6
+
7
+ module RMagick
8
+ class Extconf
9
+ require 'rmagick/version'
10
+ RMAGICK_VERS = ::Magick::VERSION
11
+ MIN_RUBY_VERS = ::Magick::MIN_RUBY_VERSION
12
+ MIN_RUBY_VERS_NO = MIN_RUBY_VERS.tr('.','').to_i
13
+
14
+ attr_reader :headers
15
+ def initialize
16
+ configure_compile_options
17
+ assert_can_compile!
18
+ configure_headers
19
+ end
20
+
21
+ def configured_compile_options
22
+ {
23
+ :magick_config => $magick_config,
24
+ :with_magick_wand => $with_magick_wand,
25
+ :pkg_config => $pkg_config,
26
+ :magick_version => $magick_version,
27
+ :local_libs => $LOCAL_LIBS,
28
+ :cflags => $CFLAGS,
29
+ :cppflags => $CPPFLAGS,
30
+ :ldflags => $LDFLAGS,
31
+ :defs => $defs,
32
+ :config_h => $config_h,
33
+ }
34
+ end
35
+
36
+ def configure_headers
37
+ #headers = %w{assert.h ctype.h errno.h float.h limits.h math.h stdarg.h stddef.h stdint.h stdio.h stdlib.h string.h time.h}
38
+ @headers = %w{assert.h ctype.h stdio.h stdlib.h math.h time.h}
39
+ headers << 'stdint.h' if have_header('stdint.h') # defines uint64_t
40
+ headers << 'sys/types.h' if have_header('sys/types.h')
41
+
42
+ if have_header('wand/MagickWand.h')
43
+ headers << 'wand/MagickWand.h'
44
+ else
45
+ exit_failure "\nCan't install RMagick #{RMAGICK_VERS}. Can't find MagickWand.h."
46
+ end
47
+ end
3
48
 
4
- require_relative '../../lib/rmagick/version'
49
+ def configure_compile_options
50
+ # Magick-config is not available on Windows
51
+ if RUBY_PLATFORM !~ /mswin|mingw/
52
+
53
+ # Check for compiler. Extract first word so ENV['CC'] can be a program name with arguments.
54
+ config = defined?(RbConfig) ? ::RbConfig : ::Config
55
+ cc = (ENV['CC'] || config::CONFIG['CC'] || 'gcc').split(' ').first
56
+ unless find_executable(cc)
57
+ exit_failure "No C compiler found in ${ENV['PATH']}. See mkmf.log for details."
58
+ end
59
+
60
+ # ugly way to handle which config tool we're going to use...
61
+ $with_magick_wand = false
62
+ $magick_config = false
63
+ $pkg_config = false
64
+
65
+ # Check for Magick-config
66
+ if find_executable('Magick-config') && !has_graphicsmagick_libmagick_dev_compat?
67
+ $magick_config = true
68
+ $magick_version = `Magick-config --version`[/^(\d+\.\d+\.\d+)/]
69
+ elsif find_executable('pkg-config')
70
+ $pkg_config = true
71
+ $magick_version = `pkg-config MagickCore --modversion`[/^(\d+\.\d+\.\d+)/]
72
+ else
73
+ exit_failure "Can't install RMagick #{RMAGICK_VERS}. Can't find Magick-config or pkg-config in #{ENV['PATH']}\n"
74
+ end
75
+
76
+ check_multiple_imagemagick_versions
77
+ check_partial_imagemagick_versions
78
+
79
+ # Ensure minimum ImageMagick version
80
+ # Check minimum ImageMagick version if possible
81
+ checking_for("outdated ImageMagick version (<= #{Magick::MIN_IM_VERSION})") do
82
+ Logging.message("Detected ImageMagick version: #{$magick_version}\n")
83
+
84
+ if Gem::Version.new($magick_version) < Gem::Version.new(Magick::MIN_IM_VERSION)
85
+ exit_failure "Can't install RMagick #{RMAGICK_VERS}. You must have ImageMagick #{Magick::MIN_IM_VERSION} or later.\n"
86
+ end
87
+ end
88
+
89
+ # From ImageMagick 6.9 binaries are split to two and we have to use
90
+ # MagickWand instead of MagickCore
91
+ checking_for("presence of MagickWand API (ImageMagick version >= #{Magick::MIN_WAND_VERSION})") do
92
+ $with_magick_wand = Gem::Version.new($magick_version) >= Gem::Version.new(Magick::MIN_WAND_VERSION)
93
+ if $with_magick_wand
94
+ Logging.message('Detected 6.9+ version, using MagickWand API')
95
+ else
96
+ Logging.message('Older version detected, using MagickCore API')
97
+ end
98
+ end
99
+
100
+ # either set flags using Magick-config, MagickWand-config or pkg-config (new Debian default)
101
+ if $with_magick_wand
102
+ if $magick_config
103
+ # Save flags
104
+ $CFLAGS = ENV['CFLAGS'].to_s + ' ' + `MagickWand-config --cflags`.chomp
105
+ $CPPFLAGS = ENV['CPPFLAGS'].to_s + ' ' + `MagickWand-config --cppflags`.chomp
106
+ $LDFLAGS = ENV['LDFLAGS'].to_s + ' ' + `MagickWand-config --ldflags`.chomp
107
+ $LOCAL_LIBS = ENV['LIBS'].to_s + ' ' + `MagickWand-config --libs`.chomp
108
+ end
109
+
110
+ if $pkg_config
111
+ # Save flags
112
+ $CFLAGS = ENV['CFLAGS'].to_s + ' ' + `pkg-config --cflags MagickWand`.chomp
113
+ $CPPFLAGS = ENV['CPPFLAGS'].to_s + ' ' + `pkg-config --cflags MagickWand`.chomp
114
+ $LDFLAGS = ENV['LDFLAGS'].to_s + ' ' + `pkg-config --libs MagickWand`.chomp
115
+ $LOCAL_LIBS = ENV['LIBS'].to_s + ' ' + `pkg-config --libs MagickWand`.chomp
116
+ end
117
+ else
118
+ if $magick_config
119
+ # Save flags
120
+ $CFLAGS = ENV['CFLAGS'].to_s + ' ' + `Magick-config --cflags`.chomp
121
+ $CPPFLAGS = ENV['CPPFLAGS'].to_s + ' ' + `Magick-config --cppflags`.chomp
122
+ $LDFLAGS = ENV['LDFLAGS'].to_s + ' ' + `Magick-config --ldflags`.chomp
123
+ $LOCAL_LIBS = ENV['LIBS'].to_s + ' ' + `Magick-config --libs`.chomp
124
+ end
125
+
126
+ if $pkg_config
127
+ # Save flags
128
+ $CFLAGS = ENV['CFLAGS'].to_s + ' ' + `pkg-config --cflags MagickCore`.chomp
129
+ $CPPFLAGS = ENV['CPPFLAGS'].to_s + ' ' + `pkg-config --cflags MagickCore`.chomp
130
+ $LDFLAGS = ENV['LDFLAGS'].to_s + ' ' + `pkg-config --libs MagickCore`.chomp
131
+ $LOCAL_LIBS = ENV['LIBS'].to_s + ' ' + `pkg-config --libs MagickCore`.chomp
132
+ end
133
+ end
134
+
135
+ if RUBY_PLATFORM =~ /darwin/ # osx
136
+ set_archflags_for_osx
137
+ end
138
+
139
+ elsif RUBY_PLATFORM =~ /mingw/ # mingw
140
+
141
+ `identify -version` =~ /Version: ImageMagick (\d+\.\d+\.\d+)-+\d+ /
142
+ abort 'Unable to get ImageMagick version' unless $1
143
+ $magick_version = $1
144
+ unless have_library('CORE_RL_magick_')
145
+ search_paths_for_library_for_mingw
146
+ end
147
+ have_library('X11')
148
+
149
+ else # mswin
150
+
151
+ `identify -version` =~ /Version: ImageMagick (\d+\.\d+\.\d+)-+\d+ /
152
+ abort 'Unable to get ImageMagick version' unless $1
153
+ $magick_version = $1
154
+ $CFLAGS = '-W3'
155
+ $CPPFLAGS = %Q{-I"C:\\Program Files\\Microsoft Platform SDK for Windows Server 2003 R2\\Include" -I"C:\\Program Files\\ImageMagick-#{$magick_version}-Q8\\include"}
156
+ # The /link option is required by the Makefile but causes warnings in the mkmf.log file.
157
+ $LDFLAGS = %Q{/link /LIBPATH:"C:\\Program Files\\Microsoft Platform SDK for Windows Server 2003 R2\\Lib" /LIBPATH:"C:\\Program Files\\ImageMagick-#{$magick_version}-Q8\\lib" /LIBPATH:"C:\\ruby\\lib"}
158
+ $LOCAL_LIBS = 'CORE_RL_magick_.lib'
159
+ have_library('X11')
5
160
 
6
- RMAGICK_VERS = Magick::VERSION
7
- MIN_RUBY_VERS = Magick::MIN_RUBY_VERSION
8
- MIN_RUBY_VERS_NO = MIN_RUBY_VERS.tr(".","").to_i
9
- MIN_IM_VERS = Magick::MIN_IM_VERSION
10
- MIN_IM_VERS_NO = MIN_IM_VERS.tr(".","").to_i
161
+ end
162
+ end
11
163
 
12
- # Test for a specific value in an enum type
13
- def have_enum_value(enum, value, headers=nil, &b)
14
- checking_for "#{enum}.#{value}" do
15
- if try_compile(<<"SRC", &b)
164
+ # Test for a specific value in an enum type
165
+ def have_enum_value(enum, value, headers=nil, &b)
166
+ checking_for "#{enum}.#{value}" do
167
+ if try_compile(<<"SRC", &b)
16
168
  #{COMMON_HEADERS}
17
169
  #{cpp_include(headers)}
18
170
  /*top*/
19
171
  int main() { #{enum} t = #{value}; t = t; return 0; }
20
172
  SRC
21
- $defs.push(format("-DHAVE_ENUM_%s", value.upcase))
22
- true
23
- else
24
- false
173
+ $defs.push(format('-DHAVE_ENUM_%s', value.upcase))
174
+ true
175
+ else
176
+ false
177
+ end
178
+ end
25
179
  end
26
- end
27
- end
28
-
29
-
30
-
31
-
32
- # Test for multiple values of the same enum type
33
- def have_enum_values(enum, values, headers=nil, &b)
34
- values.each do |value|
35
- have_enum_value(enum, value, headers, &b)
36
- end
37
- end
38
180
 
181
+ # Test for multiple values of the same enum type
182
+ def have_enum_values(enum, values, headers=nil, &b)
183
+ values.each do |value|
184
+ have_enum_value(enum, value, headers, &b)
185
+ end
186
+ end
39
187
 
188
+ def has_graphicsmagick_libmagick_dev_compat?
189
+ config_path = `which Magick-config`.chomp
190
+ if File.exist?(config_path) &&
191
+ File.symlink?(config_path) &&
192
+ File.readlink(config_path) =~ /GraphicsMagick/
193
+ msg = 'Found a graphicsmagick-libmagick-dev-compat installation.'
194
+ Logging.message msg
195
+ message msg+"\n"
196
+ true
197
+ else
198
+ false
199
+ end
200
+ end
40
201
 
202
+ def exit_failure(msg)
203
+ Logging.message msg
204
+ message msg+"\n"
205
+ exit(1)
206
+ end
41
207
 
42
- def exit_failure(msg)
43
- Logging::message msg
44
- message msg+"\n"
45
- exit(1)
46
- end
208
+ # Seems like lots of people have multiple versions of ImageMagick installed.
209
+ def check_multiple_imagemagick_versions
210
+ versions = []
211
+ path = ENV['PATH'].split(File::PATH_SEPARATOR)
212
+ path.each do |dir|
213
+ file = File.join(dir, 'Magick-config')
214
+ if File.executable? file
215
+ vers = `#{file} --version`.chomp.strip
216
+ prefix = `#{file} --prefix`.chomp.strip
217
+ versions << [vers, prefix, dir]
218
+ end
219
+ end
220
+ versions.uniq!
221
+ if versions.size > 1
222
+ msg = "\nWarning: Found more than one ImageMagick installation. This could cause problems at runtime.\n"
223
+ versions.each do |vers, prefix, dir|
224
+ msg << " #{dir}/Magick-config reports version #{vers} is installed in #{prefix}\n"
225
+ end
226
+ msg << "Using #{versions[0][0]} from #{versions[0][1]}.\n\n"
227
+ Logging.message msg
228
+ message msg
229
+ end
230
+ end
47
231
 
232
+ # Ubuntu (maybe other systems) comes with a partial installation of
233
+ # ImageMagick in the prefix /usr (some libraries, no includes, and no
234
+ # binaries). This causes problems when /usr/lib is in the path (e.g., using
235
+ # the default Ruby installation).
236
+ def check_partial_imagemagick_versions
237
+ prefix = config_string('prefix') || ''
238
+ matches = [
239
+ prefix+'/lib/lib?agick*',
240
+ prefix+'/include/ImageMagick',
241
+ prefix+'/bin/Magick-config',
242
+ ].map do |file_glob|
243
+ Dir.glob(file_glob)
244
+ end
245
+ matches.delete_if { |arr| arr.empty? }
246
+ if 0 < matches.length && matches.length < 3
247
+ msg = "\nWarning: Found a partial ImageMagick installation. Your operating system likely has some built-in ImageMagick libraries but not all of ImageMagick. This will most likely cause problems at both compile and runtime.\nFound partial installation at: "+prefix+"\n"
248
+ Logging.message msg
249
+ message msg
250
+ end
251
+ end
48
252
 
253
+ # issue #169
254
+ # set ARCHFLAGS appropriately for OSX
255
+ def set_archflags_for_osx
256
+ archflags = []
257
+ fullpath = `which convert`
258
+ fileinfo = `file #{fullpath}`
49
259
 
260
+ # default ARCHFLAGS
261
+ archs = $ARCH_FLAG.scan(/-arch\s+(\S+)/).flatten
50
262
 
51
- # Seems like lots of people have multiple versions of ImageMagick installed.
52
- def check_multiple_imagemagick_versions()
53
- versions = []
54
- path = ENV['PATH'].split(File::PATH_SEPARATOR)
55
- path.each do |dir|
56
- file = File.join(dir, "Magick-config")
57
- if File.executable? file
58
- vers = `#{file} --version`.chomp.strip
59
- prefix = `#{file} --prefix`.chomp.strip
60
- versions << [vers, prefix, dir]
263
+ archs.each do |arch|
264
+ if fileinfo.include?(arch)
265
+ archflags << "-arch #{arch}"
266
+ end
61
267
  end
62
- end
63
- versions.uniq!
64
- if versions.size > 1
65
- msg = "\nWarning: Found more than one ImageMagick installation. This could cause problems at runtime.\n"
66
- versions.each do |vers, prefix, dir|
67
- msg << " #{dir}/Magick-config reports version #{vers} is installed in #{prefix}\n"
68
- end
69
- msg << "Using #{versions[0][0]} from #{versions[0][1]}.\n\n"
70
- Logging::message msg
71
- message msg
72
- end
73
- end
74
268
 
269
+ if archflags.length != 0
270
+ $ARCH_FLAG = archflags.join(' ')
271
+ end
272
+ end
75
273
 
76
- # Ubuntu (maybe other systems) comes with a partial installation of
77
- # ImageMagick in the prefix /usr (some libraries, no includes, and no
78
- # binaries). This causes problems when /usr/lib is in the path (e.g., using
79
- # the default Ruby installation).
80
- def check_partial_imagemagick_versions()
81
- prefix = config_string("prefix")
82
- matches = [
83
- prefix+"/lib/lib?agick*",
84
- prefix+"/include/ImageMagick",
85
- prefix+"/bin/Magick-config",
86
- ].map do |file_glob|
87
- Dir.glob(file_glob)
88
- end
89
- matches.delete_if { |arr| arr.empty? }
90
- if 0 < matches.length and matches.length < 3
91
- msg = "\nWarning: Found a partial ImageMagick installation. Your operating system likely has some built-in ImageMagick libraries but not all of ImageMagick. This will most likely cause problems at both compile and runtime.\nFound partial installation at: "+prefix+"\n"
92
- Logging::message msg
93
- message msg
94
- end
95
- end
274
+ def search_paths_for_library_for_mingw
275
+ msg = 'searching PATH for the ImageMagick library...'
276
+ Logging.message msg
277
+ message msg+"\n"
278
+
279
+ found_lib = false
280
+
281
+ paths = ENV['PATH'].split(File::PATH_SEPARATOR)
282
+ paths.each do |dir|
283
+ lib = File.join(dir, 'lib')
284
+ lib_file = File.join(lib, 'CORE_RL_magick_.lib')
285
+ if File.exist?(lib_file)
286
+ $CPPFLAGS = %Q{-I"#{File.join(dir, 'include')}"}
287
+ $LDFLAGS = %Q{-L"#{lib}"}
288
+ found_lib = have_library('CORE_RL_magick_')
289
+ break if found_lib
290
+ end
291
+ end
96
292
 
293
+ unless found_lib
294
+ exit_failure <<END_MINGW
295
+ Can't install RMagick #{RMAGICK_VERS}.
296
+ Can't find the ImageMagick library.
297
+ Retry with '--with-opt-dir' option.
298
+ Usage: gem install rmagick -- '--with-opt-dir=\"[path to ImageMagick]\"'
299
+ e.g.
300
+ gem install rmagick -- '--with-opt-dir=\"C:\Program Files\ImageMagick-6.9.1-Q16\"'
301
+ END_MINGW
302
+ end
303
+ end
97
304
 
305
+ def assert_can_compile!
306
+ assert_not_windows!
307
+ assert_minimum_ruby_version!
308
+ assert_has_dev_libs!
309
+ end
98
310
 
99
- if RUBY_PLATFORM =~ /mswin/
100
- abort <<END_MSWIN
311
+ def assert_not_windows!
312
+ if RUBY_PLATFORM =~ /mswin/
313
+ abort <<END_MSWIN
101
314
  +----------------------------------------------------------------------------+
102
315
  | This rmagick gem is for use only on Linux, BSD, OS X, and similar systems |
103
316
  | that have a gnu or similar toolchain installed. The rmagick-win32 gem is a |
@@ -106,186 +319,82 @@ if RUBY_PLATFORM =~ /mswin/
106
319
  | See http://rmagick.rubyforge.org/install-faq.html for more information. |
107
320
  +----------------------------------------------------------------------------+
108
321
  END_MSWIN
109
- end
110
-
111
-
112
-
113
-
114
- unless checking_for("Ruby version >= #{MIN_RUBY_VERS}") do
115
- version = RUBY_VERSION.tr(".","").to_i
116
- version >= MIN_RUBY_VERS_NO
117
- end
118
- exit_failure "Can't install RMagick #{RMAGICK_VERS}. Ruby #{MIN_RUBY_VERS} or later required.\n"
119
- end
120
-
121
-
122
-
123
-
124
- # Magick-config is not available on Windows
125
- if RUBY_PLATFORM !~ /mswin|mingw/
126
-
127
- # Check for compiler. Extract first word so ENV['CC'] can be a program name with arguments.
128
- config = defined?(RbConfig) ? ::RbConfig : ::Config
129
- cc = (ENV["CC"] or config::CONFIG["CC"] or "gcc").split(' ').first
130
- unless find_executable(cc)
131
- exit_failure "No C compiler found in ${ENV['PATH']}. See mkmf.log for details."
132
- end
133
-
134
- # ugly way to handle which config tool we're going to use...
135
- $magick_config = false
136
- $pkg_config = false
137
-
138
- # Check for Magick-config
139
- if find_executable("Magick-config")
140
- $magick_config = true
141
- elsif find_executable("pkg-config")
142
- $pkg_config = true
143
- else
144
- exit_failure "Can't install RMagick #{RMAGICK_VERS}. Can't find Magick-config or pkg-config in #{ENV['PATH']}\n"
145
- end
146
-
147
- check_multiple_imagemagick_versions()
148
- check_partial_imagemagick_versions()
149
-
150
- # Ensure minimum ImageMagick version
151
- unless checking_for("ImageMagick version >= #{MIN_IM_VERS}") do
152
- # extract version info from convert binary (could use identify as well)
153
- convert_version_string = /^Version: ImageMagick\s+(?<Version>\d+\.\d+\.\d+\-\d+)\s+(?<Unknown>\S+)\s+(?<Arch>\S+)\s+(?<Date>\S+)/
154
- match_data = `convert -version`.match(convert_version_string)
155
- unless match_data.nil?
156
- # taken from previous version, this doesn't look right though
157
- # for example 6.8.12 whould show as greater than 6.12.9
158
- # is there some property of imagemagick versioning that prevents this situation?
159
- version = match_data['Version'].chomp.tr(".","").to_i
160
- version >= MIN_IM_VERS_NO
322
+ end
161
323
  end
162
- end
163
- exit_failure "Can't install RMagick #{RMAGICK_VERS}. You must have ImageMagick #{MIN_IM_VERS} or later.\n"
164
- end
165
-
166
-
167
- # either set flags using Magick-config or pkg-config (new Debian default)
168
- if $magick_config
169
- # Save flags
170
- $CFLAGS = ENV["CFLAGS"].to_s + " " + `Magick-config --cflags`.chomp
171
- $CPPFLAGS = ENV["CPPFLAGS"].to_s + " " + `Magick-config --cppflags`.chomp
172
- $LDFLAGS = ENV["LDFLAGS"].to_s + " " + `Magick-config --ldflags`.chomp
173
- $LOCAL_LIBS = ENV["LIBS"].to_s + " " + `Magick-config --libs`.chomp
174
- end
175
-
176
- if $pkg_config
177
- # Save flags
178
- $CFLAGS = ENV["CFLAGS"].to_s + " " + `pkg-config --cflags MagickCore`.chomp
179
- $CPPFLAGS = ENV["CPPFLAGS"].to_s + " " + `pkg-config --cflags MagickCore`.chomp
180
- $LDFLAGS = ENV["LDFLAGS"].to_s + " " + `pkg-config --libs MagickCore`.chomp
181
- $LOCAL_LIBS = ENV["LIBS"].to_s + " " + `pkg-config --libs MagickCore`.chomp
182
- end
183
-
184
- elsif RUBY_PLATFORM =~ /mingw/ # mingw
185
-
186
- `convert -version` =~ /Version: ImageMagick (\d+\.\d+\.\d+)-\d+ /
187
- abort "Unable to get ImageMagick version" unless $1
188
- $magick_version = $1
189
- if RUBY_PLATFORM =~ /x64/
190
- $LOCAL_LIBS = '-lCORE_RL_magick_'
191
- else
192
- $LOCAL_LIBS = '-lCORE_RL_magick_ -lX11'
193
- end
194
-
195
- else # mswin
196
-
197
- `convert -version` =~ /Version: ImageMagick (\d+\.\d+\.\d+)-\d+ /
198
- abort "Unable to get ImageMagick version" unless $1
199
- $magick_version = $1
200
- $CFLAGS = "-W3"
201
- $CPPFLAGS = %Q{-I"C:\\Program Files\\Microsoft Platform SDK for Windows Server 2003 R2\\Include" -I"C:\\Program Files\\ImageMagick-#{$magick_version}-Q8\\include"}
202
- # The /link option is required by the Makefile but causes warnings in the mkmf.log file.
203
- $LDFLAGS = %Q{/link /LIBPATH:"C:\\Program Files\\Microsoft Platform SDK for Windows Server 2003 R2\\Lib" /LIBPATH:"C:\\Program Files\\ImageMagick-#{$magick_version}-Q8\\lib" /LIBPATH:"C:\\ruby\\lib"}
204
- $LOCAL_LIBS = 'CORE_RL_magick_.lib X11.lib'
205
-
206
- end
207
-
208
-
209
-
210
- #headers = %w{assert.h ctype.h errno.h float.h limits.h math.h stdarg.h stddef.h stdint.h stdio.h stdlib.h string.h time.h}
211
- headers = %w{assert.h ctype.h stdio.h stdlib.h math.h time.h}
212
- headers << "stdint.h" if have_header("stdint.h") # defines uint64_t
213
- headers << "sys/types.h" if have_header("sys/types.h")
214
-
215
-
216
- if have_header("wand/MagickWand.h")
217
- headers << "wand/MagickWand.h"
218
- else
219
- exit_failure "\nCan't install RMagick #{RMAGICK_VERS}. Can't find MagickWand.h."
220
- end
221
-
222
-
223
-
224
- if RUBY_PLATFORM !~ /mswin|mingw/
225
-
226
- # check for pkg-config if Magick-config doesn't exist
227
- if $magick_config && `Magick-config --libs`[/\bl\s*(MagickCore|Magick)6?\b/]
228
- elsif $pkg_config && `pkg-config --libs MagickCore`[/\bl\s*(MagickCore|Magick)6?\b/]
229
- else
230
- exit_failure "Can't install RMagick #{RMAGICK_VERS}. " +
231
- "Can't find the ImageMagick library or one of the dependent libraries. " +
232
- "Check the mkmf.log file for more detailed information.\n"
233
- end
234
- end
235
-
236
-
237
- have_func("snprintf", headers)
238
- ["AcquireImage", # 6.4.1
239
- "AffinityImage", # 6.4.3-6
240
- "AffinityImages", # 6.4.3-6
241
- "AutoGammaImageChannel", # 6.5.5-1
242
- "AutoLevelImageChannel", # 6.5.5-1
243
- "BlueShiftImage", # 6.5.4-3
244
- "ColorMatrixImage", # 6.6.1-0
245
- "ConstituteComponentTerminus", # 6.5.7-9
246
- "DeskewImage", # 6.4.2-5
247
- "DestroyConstitute", # 6.5.7-9(deprecated)
248
- "EncipherImage", # 6.3.8-6
249
- "EqualizeImageChannel", # 6.3.6-9
250
- "EvaluateImages", # 6.8.6-4
251
- "FloodfillPaintImage", # 6.3.7
252
- "FunctionImageChannel", # 6.4.8-8
253
- "GetAuthenticIndexQueue", # 6.4.5-6
254
- "GetAuthenticPixels", # 6.4.5-6
255
- "GetImageAlphaChannel", # 6.3.9-2
256
- "GetMagickFeatures", # 6.5.7-1
257
- "GetVirtualPixels", # 6.4.5-6
258
- "LevelImageColors", # 6.4.2
259
- "LevelColorsImageChannel", # 6.5.6-4
260
- "LevelizeImageChannel", # 6.4.2
261
- "LiquidRescaleImage", # 6.3.8-2
262
- "MagickLibAddendum", # 6.5.9-1
263
- "OpaquePaintImageChannel", # 6.3.7-10
264
- "QueueAuthenticPixels", # 6.4.5-6
265
- "RemapImage", # 6.4.4-0
266
- "RemapImages", # 6.4.4-0
267
- "RemoveImageArtifact", # 6.3.6
268
- "RotationalBlurImage", # 6.8.8-9
269
- "RotationalBlurImageChannel", # 6.8.8-9
270
- "SelectiveBlurImageChannel", # 6.5.0-3
271
- "SetImageAlphaChannel", # 6.3.6-9
272
- "SetImageArtifact", # 6.3.6
273
- "SetMagickMemoryMethods", # 6.4.1
274
- "SparseColorImage", # 6.3.6-?
275
- "StatisticImage", # 6.6.8-6
276
- "SyncAuthenticPixels", # 6.4.5-6
277
- "TransformImageColorspace", # 6.5.1
278
- "TransparentPaintImage", # 6.3.7-10
279
- "TransparentPaintImageChroma" # 6.4.5-6
280
- ].each do |func|
281
- have_func(func, headers)
282
- end
283
324
 
325
+ def assert_minimum_ruby_version!
326
+ unless checking_for("Ruby version >= #{MIN_RUBY_VERS}") do
327
+ version = RUBY_VERSION.tr('.','').to_i
328
+ version >= MIN_RUBY_VERS_NO
329
+ end
330
+ exit_failure "Can't install RMagick #{RMAGICK_VERS}. Ruby #{MIN_RUBY_VERS} or later required.\n"
331
+ end
332
+ end
284
333
 
334
+ def assert_has_dev_libs!
335
+ if RUBY_PLATFORM !~ /mswin|mingw/
336
+
337
+ # check for pkg-config if Magick-config doesn't exist
338
+ if $magick_config && `Magick-config --libs`[/\bl\s*(MagickCore|Magick)6?\b/]
339
+ elsif $pkg_config && `pkg-config --libs MagickCore`[/\bl\s*(MagickCore|Magick)6?\b/]
340
+ else
341
+ exit_failure "Can't install RMagick #{RMAGICK_VERS}. " \
342
+ "Can't find the ImageMagick library or one of the dependent libraries. " \
343
+ "Check the mkmf.log file for more detailed information.\n"
344
+ end
345
+ end
346
+ end
285
347
 
348
+ def create_header_file
349
+ have_func('snprintf', headers)
350
+ ['AcquireImage', # 6.4.1
351
+ 'AffinityImage', # 6.4.3-6
352
+ 'AffinityImages', # 6.4.3-6
353
+ 'AutoGammaImageChannel', # 6.5.5-1
354
+ 'AutoLevelImageChannel', # 6.5.5-1
355
+ 'BlueShiftImage', # 6.5.4-3
356
+ 'ColorMatrixImage', # 6.6.1-0
357
+ 'ConstituteComponentTerminus', # 6.5.7-9
358
+ 'DeskewImage', # 6.4.2-5
359
+ 'DestroyConstitute', # 6.5.7-9(deprecated)
360
+ 'EncipherImage', # 6.3.8-6
361
+ 'EqualizeImageChannel', # 6.3.6-9
362
+ 'EvaluateImages', # 6.8.6-4
363
+ 'FloodfillPaintImage', # 6.3.7
364
+ 'FunctionImageChannel', # 6.4.8-8
365
+ 'GetAuthenticIndexQueue', # 6.4.5-6
366
+ 'GetAuthenticPixels', # 6.4.5-6
367
+ 'GetImageAlphaChannel', # 6.3.9-2
368
+ 'GetMagickFeatures', # 6.5.7-1
369
+ 'GetVirtualPixels', # 6.4.5-6
370
+ 'LevelImageColors', # 6.4.2
371
+ 'LevelColorsImageChannel', # 6.5.6-4
372
+ 'LevelizeImageChannel', # 6.4.2
373
+ 'LiquidRescaleImage', # 6.3.8-2
374
+ 'MagickLibAddendum', # 6.5.9-1
375
+ 'OpaquePaintImageChannel', # 6.3.7-10
376
+ 'QueueAuthenticPixels', # 6.4.5-6
377
+ 'RemapImage', # 6.4.4-0
378
+ 'RemapImages', # 6.4.4-0
379
+ 'RemoveImageArtifact', # 6.3.6
380
+ 'RotationalBlurImage', # 6.8.8-9
381
+ 'RotationalBlurImageChannel', # 6.8.8-9
382
+ 'SelectiveBlurImageChannel', # 6.5.0-3
383
+ 'SetImageAlphaChannel', # 6.3.6-9
384
+ 'SetImageArtifact', # 6.3.6
385
+ 'SetMagickMemoryMethods', # 6.4.1
386
+ 'SparseColorImage', # 6.3.6-?
387
+ 'StatisticImage', # 6.6.8-6
388
+ 'SyncAuthenticPixels', # 6.4.5-6
389
+ 'TransformImageColorspace', # 6.5.1
390
+ 'TransparentPaintImage', # 6.3.7-10
391
+ 'TransparentPaintImageChroma' # 6.4.5-6
392
+ ].each do |func|
393
+ have_func(func, headers)
394
+ end
286
395
 
287
- checking_for("QueryMagickColorname() new signature") do
288
- if try_compile(<<"SRC")
396
+ checking_for('QueryMagickColorname() new signature') do
397
+ if try_compile(<<"SRC")
289
398
  #{COMMON_HEADERS}
290
399
  #{cpp_include(headers)}
291
400
  /*top*/
@@ -299,134 +408,147 @@ int main() {
299
408
  return 0;
300
409
  }
301
410
  SRC
302
- $defs.push("-DHAVE_NEW_QUERYMAGICKCOLORNAME")
303
- true
304
- else
305
- false
306
- end
307
- end
308
-
309
-
310
-
411
+ $defs.push('-DHAVE_NEW_QUERYMAGICKCOLORNAME')
412
+ true
413
+ else
414
+ false
415
+ end
416
+ end
311
417
 
312
- have_struct_member("Image", "type", headers) # ???
313
- have_struct_member("DrawInfo", "kerning", headers) # 6.4.7-8
314
- have_struct_member("DrawInfo", "interline_spacing", headers) # 6.5.5-8
315
- have_struct_member("DrawInfo", "interword_spacing", headers) # 6.4.8-0
316
- have_type("DitherMethod", headers) # 6.4.2
317
- have_type("MagickFunction", headers) # 6.4.8-8
318
- have_type("ImageLayerMethod", headers) # 6.3.6 replaces MagickLayerMethod
319
- have_type("long double", headers)
320
- #have_type("unsigned long long", headers)
321
- #have_type("uint64_t", headers)
322
- #have_type("__int64", headers)
323
- #have_type("uintmax_t", headers)
324
- #check_sizeof("unsigned long", headers)
325
- #check_sizeof("Image *", headers)
326
-
327
-
328
- have_enum_values("AlphaChannelType", ["CopyAlphaChannel", # 6.4.3-7
329
- "BackgroundAlphaChannel"], headers) # 6.5.2-5
330
- have_enum_values("CompositeOperator", ["BlurCompositeOp", # 6.5.3-7
331
- "DistortCompositeOp", # 6.5.3-10
332
- "LinearBurnCompositeOp", # 6.5.4-3
333
- "LinearDodgeCompositeOp", # 6.5.4-3
334
- "MathematicsCompositeOp", # 6.5.4-3
335
- "PegtopLightCompositeOp", # 6.5.4-3
336
- "PinLightCompositeOp", # 6.5.4-3
337
- "VividLightCompositeOp"], headers) # 6.5.4-3
338
- have_enum_values("CompressionType", ["DXT1Compression", # 6.3.9-3
339
- "DXT3Compression", # 6.3.9-3
340
- "DXT5Compression", # 6.3.9-3
341
- "ZipSCompression", # 6.5.5-4
342
- "PizCompression", # 6.5.5-4
343
- "Pxr24Compression", # 6.5.5-4
344
- "B44Compression", # 6.5.5-4
345
- "B44ACompression"], headers) # 6.5.5-4
346
-
347
- have_enum_values("DistortImageMethod", ["BarrelDistortion", # 6.4.2-5
348
- "BarrelInverseDistortion", # 6.4.3-8
349
- "BilinearForwardDistortion", # 6.5.1-2
350
- "BilinearReverseDistortion", # 6.5.1-2
351
- "DePolarDistortion", # 6.4.2-6
352
- "PolarDistortion", # 6.4.2-6
353
- "PolynomialDistortion", # 6.4.2-4
354
- "ShepardsDistortion"], headers) # 6.4.2-4
355
- have_enum_value("DitherMethod", "NoDitherMethod", headers) # 6.4.3
356
- have_enum_values("FilterTypes", ["KaiserFilter", # 6.3.6
357
- "WelshFilter", # 6.3.6-4
358
- "ParzenFilter", # 6.3.6-4
359
- "LagrangeFilter", # 6.3.7-2
360
- "BohmanFilter", # 6.3.7-2
361
- "BartlettFilter", # 6.3.7-2
362
- "SentinelFilter"], headers) # 6.3.7-2
363
- have_enum_values("MagickEvaluateOperator", ["PowEvaluateOperator", # 6.4.1-9
364
- "LogEvaluateOperator", # 6.4.2
365
- "ThresholdEvaluateOperator", # 6.4.3
366
- "ThresholdBlackEvaluateOperator", # 6.4.3
367
- "ThresholdWhiteEvaluateOperator", # 6.4.3
368
- "GaussianNoiseEvaluateOperator", # 6.4.3
369
- "ImpulseNoiseEvaluateOperator", # 6.4.3
370
- "LaplacianNoiseEvaluateOperator", # 6.4.3
371
- "MultiplicativeNoiseEvaluateOperator", # 6.4.3
372
- "PoissonNoiseEvaluateOperator", # 6.4.3
373
- "UniformNoiseEvaluateOperator", # 6.4.3
374
- "CosineEvaluateOperator", # 6.4.8-5
375
- "SineEvaluateOperator", # 6.4.8-5
376
- "AddModulusEvaluateOperator"], # 6.4.8-5
377
- headers)
378
- have_enum_values("MagickFunction", ["ArcsinFunction", # 6.5.2-8
379
- "ArctanFunction", # 6.5.2-8
380
- "PolynomialFunction", # 6.4.8-8
381
- "SinusoidFunction"], headers) # 6.4.8-8
382
- have_enum_values("ImageLayerMethod", ["FlattenLayer", # 6.3.6-2
383
- "MergeLayer", # 6.3.6
384
- "MosaicLayer", # 6.3.6-2
385
- "TrimBoundsLayer" ], headers) # 6.4.3-8
386
- have_enum_values("VirtualPixelMethod", ["HorizontalTileVirtualPixelMethod", # 6.4.2-6
387
- "VerticalTileVirtualPixelMethod", # 6.4.2-6
388
- "HorizontalTileEdgeVirtualPixelMethod", # 6.5.0-1
389
- "VerticalTileEdgeVirtualPixelMethod", # 6.5.0-1
390
- "CheckerTileVirtualPixelMethod"], # 6.5.0-1
391
- headers)
392
-
393
-
394
- # Now test Ruby 1.9.0 features.
395
- headers = ["ruby.h"]
396
- if have_header("ruby/io.h")
397
- headers << "ruby/io.h"
398
- else
399
- headers << "rubyio.h"
400
- end
418
+ have_struct_member('Image', 'type', headers) # ???
419
+ have_struct_member('DrawInfo', 'kerning', headers) # 6.4.7-8
420
+ have_struct_member('DrawInfo', 'interline_spacing', headers) # 6.5.5-8
421
+ have_struct_member('DrawInfo', 'interword_spacing', headers) # 6.4.8-0
422
+ have_type('DitherMethod', headers) # 6.4.2
423
+ have_type('MagickFunction', headers) # 6.4.8-8
424
+ have_type('ImageLayerMethod', headers) # 6.3.6 replaces MagickLayerMethod
425
+ have_type('long double', headers)
426
+ #have_type("unsigned long long", headers)
427
+ #have_type("uint64_t", headers)
428
+ #have_type("__int64", headers)
429
+ #have_type("uintmax_t", headers)
430
+ #check_sizeof("unsigned long", headers)
431
+ #check_sizeof("Image *", headers)
432
+
433
+ have_enum_values('AlphaChannelType', ['CopyAlphaChannel', # 6.4.3-7
434
+ 'BackgroundAlphaChannel', # 6.5.2-5
435
+ 'RemoveAlphaChannel'], headers) # 6.7.5-1
436
+ have_enum_values('CompositeOperator', ['BlurCompositeOp', # 6.5.3-7
437
+ 'DistortCompositeOp', # 6.5.3-10
438
+ 'LinearBurnCompositeOp', # 6.5.4-3
439
+ 'LinearDodgeCompositeOp', # 6.5.4-3
440
+ 'MathematicsCompositeOp', # 6.5.4-3
441
+ 'PegtopLightCompositeOp', # 6.5.4-3
442
+ 'PinLightCompositeOp', # 6.5.4-3
443
+ 'VividLightCompositeOp'], headers) # 6.5.4-3
444
+ have_enum_values('CompressionType', ['DXT1Compression', # 6.3.9-3
445
+ 'DXT3Compression', # 6.3.9-3
446
+ 'DXT5Compression', # 6.3.9-3
447
+ 'ZipSCompression', # 6.5.5-4
448
+ 'PizCompression', # 6.5.5-4
449
+ 'Pxr24Compression', # 6.5.5-4
450
+ 'B44Compression', # 6.5.5-4
451
+ 'B44ACompression'], headers) # 6.5.5-4
452
+
453
+ have_enum_values('DistortImageMethod', ['BarrelDistortion', # 6.4.2-5
454
+ 'BarrelInverseDistortion', # 6.4.3-8
455
+ 'BilinearForwardDistortion', # 6.5.1-2
456
+ 'BilinearReverseDistortion', # 6.5.1-2
457
+ 'DePolarDistortion', # 6.4.2-6
458
+ 'PolarDistortion', # 6.4.2-6
459
+ 'PolynomialDistortion', # 6.4.2-4
460
+ 'ShepardsDistortion'], headers) # 6.4.2-4
461
+ have_enum_value('DitherMethod', 'NoDitherMethod', headers) # 6.4.3
462
+ have_enum_values('FilterTypes', ['KaiserFilter', # 6.3.6
463
+ 'WelshFilter', # 6.3.6-4
464
+ 'ParzenFilter', # 6.3.6-4
465
+ 'LagrangeFilter', # 6.3.7-2
466
+ 'BohmanFilter', # 6.3.7-2
467
+ 'BartlettFilter', # 6.3.7-2
468
+ 'SentinelFilter'], headers) # 6.3.7-2
469
+ have_enum_values('MagickEvaluateOperator', ['PowEvaluateOperator', # 6.4.1-9
470
+ 'LogEvaluateOperator', # 6.4.2
471
+ 'ThresholdEvaluateOperator', # 6.4.3
472
+ 'ThresholdBlackEvaluateOperator', # 6.4.3
473
+ 'ThresholdWhiteEvaluateOperator', # 6.4.3
474
+ 'GaussianNoiseEvaluateOperator', # 6.4.3
475
+ 'ImpulseNoiseEvaluateOperator', # 6.4.3
476
+ 'LaplacianNoiseEvaluateOperator', # 6.4.3
477
+ 'MultiplicativeNoiseEvaluateOperator', # 6.4.3
478
+ 'PoissonNoiseEvaluateOperator', # 6.4.3
479
+ 'UniformNoiseEvaluateOperator', # 6.4.3
480
+ 'CosineEvaluateOperator', # 6.4.8-5
481
+ 'SineEvaluateOperator', # 6.4.8-5
482
+ 'AddModulusEvaluateOperator'], # 6.4.8-5
483
+ headers)
484
+ have_enum_values('MagickFunction', ['ArcsinFunction', # 6.5.2-8
485
+ 'ArctanFunction', # 6.5.2-8
486
+ 'PolynomialFunction', # 6.4.8-8
487
+ 'SinusoidFunction'], headers) # 6.4.8-8
488
+ have_enum_values('ImageLayerMethod', ['FlattenLayer', # 6.3.6-2
489
+ 'MergeLayer', # 6.3.6
490
+ 'MosaicLayer', # 6.3.6-2
491
+ 'TrimBoundsLayer' ], headers) # 6.4.3-8
492
+ have_enum_values('VirtualPixelMethod', ['HorizontalTileVirtualPixelMethod', # 6.4.2-6
493
+ 'VerticalTileVirtualPixelMethod', # 6.4.2-6
494
+ 'HorizontalTileEdgeVirtualPixelMethod', # 6.5.0-1
495
+ 'VerticalTileEdgeVirtualPixelMethod', # 6.5.0-1
496
+ 'CheckerTileVirtualPixelMethod'], # 6.5.0-1
497
+ headers)
498
+
499
+ # Now test Ruby 1.9.0 features.
500
+ headers = ['ruby.h']
501
+ if have_header('ruby/io.h')
502
+ headers << 'ruby/io.h'
503
+ else
504
+ headers << 'rubyio.h'
505
+ end
401
506
 
402
- have_func("rb_frame_this_func", headers)
507
+ have_func('rb_frame_this_func', headers)
403
508
 
404
- # Miscellaneous constants
405
- $defs.push("-DRUBY_VERSION_STRING=\"ruby #{RUBY_VERSION}\"")
406
- $defs.push("-DRMAGICK_VERSION_STRING=\"RMagick #{RMAGICK_VERS}\"")
509
+ # Miscellaneous constants
510
+ $defs.push("-DRUBY_VERSION_STRING=\"ruby #{RUBY_VERSION}\"")
511
+ $defs.push("-DRMAGICK_VERSION_STRING=\"RMagick #{RMAGICK_VERS}\"")
407
512
 
408
- create_header()
409
- # Prior to 1.8.5 mkmf duplicated the symbols on the command line and in the
410
- # extconf.h header. Suppress that behavior by removing the symbol array.
411
- $defs = []
513
+ create_header
514
+ end
412
515
 
413
- # Force re-compilation if the generated Makefile changed.
414
- $config_h = "Makefile rmagick.h"
516
+ def create_makefile_file
517
+ create_header_file
518
+ # Prior to 1.8.5 mkmf duplicated the symbols on the command line and in the
519
+ # extconf.h header. Suppress that behavior by removing the symbol array.
520
+ $defs = []
415
521
 
416
- create_makefile("RMagick2")
522
+ # Force re-compilation if the generated Makefile changed.
523
+ $config_h = 'Makefile rmagick.h'
417
524
 
525
+ create_makefile('RMagick2')
526
+ print_summary
527
+ end
418
528
 
419
- SUMMARY = <<"END_SUMMARY"
529
+ def print_summary
530
+ summary = <<"END_SUMMARY"
420
531
 
421
532
 
422
- #{"=" * 70}
423
- #{DateTime.now.strftime("%a %d%b%y %T")}
533
+ #{'=' * 70}
534
+ #{DateTime.now.strftime('%a %d%b%y %T')}
424
535
  This installation of RMagick #{RMAGICK_VERS} is configured for
425
536
  Ruby #{RUBY_VERSION} (#{RUBY_PLATFORM}) and ImageMagick #{$magick_version}
426
- #{"=" * 70}
537
+ #{'=' * 70}
427
538
 
428
539
 
429
540
  END_SUMMARY
430
541
 
431
- Logging::message SUMMARY
432
- message SUMMARY
542
+ Logging.message summary
543
+ message summary
544
+ end
545
+ end
546
+ end
547
+
548
+ extconf = RMagick::Extconf.new
549
+ at_exit do
550
+ msg = "Configured compile options: #{extconf.configured_compile_options}"
551
+ Logging.message msg
552
+ message msg+"\n"
553
+ end
554
+ extconf.create_makefile_file