1#----------------------------------
2# extconf.rb
3# $Revision: 38867 $
4#----------------------------------
5require 'mkmf'
6
7case RUBY_PLATFORM
8when /cygwin/
9  inc = nil
10  lib = '/usr/lib/w32api'
11end
12
13dir_config("win32", inc, lib)
14
15def create_win32ole_makefile
16  if have_library("ole32") and
17     have_library("oleaut32") and
18     have_library("uuid", "&CLSID_CMultiLanguage", "mlang.h") and
19     have_library("user32") and
20     have_library("kernel32") and
21     have_library("advapi32") and
22     have_header("windows.h")
23    unless have_type("IMultiLanguage2", "mlang.h")
24      have_type("IMultiLanguage", "mlang.h")
25    end
26    spec = nil
27    checking_for('thread_specific', '%s') do
28      spec = %w[__declspec(thread) __thread].find {|th|
29        try_compile("#{th} int foo;", "", :werror => true)
30      }
31      spec or 'no'
32    end
33    $defs << "-DRB_THREAD_SPECIFIC=#{spec}" if spec
34    create_makefile("win32ole")
35  end
36end
37
38
39case RUBY_PLATFORM
40when /mswin/
41  $CFLAGS.sub!(/((?:\A|\s)[-\/])W\d(?=\z|\s)/, '\1W3') or
42    $CFLAGS += ' -W3'
43end
44create_win32ole_makefile
45