2003-03-28 20:21:24 +03:00
|
|
|
#
|
|
|
|
# extconf.rb
|
|
|
|
#
|
|
|
|
# $Id$
|
|
|
|
#
|
|
|
|
|
|
|
|
require 'mkmf'
|
|
|
|
require 'rbconfig'
|
|
|
|
|
2012-07-10 04:04:47 +04:00
|
|
|
$INCFLAGS << " -I$(topdir) -I$(top_srcdir)"
|
2003-03-28 20:21:24 +03:00
|
|
|
|
2012-07-10 04:04:47 +04:00
|
|
|
dir_config 'zlib'
|
2003-03-28 20:21:24 +03:00
|
|
|
|
2008-05-29 12:52:31 +04:00
|
|
|
if %w'z libz zlib1 zlib zdll'.find {|z| have_library(z, 'deflateReset')} and
|
2003-03-28 20:21:24 +03:00
|
|
|
have_header('zlib.h') then
|
|
|
|
|
|
|
|
defines = []
|
|
|
|
|
2012-05-18 23:51:58 +04:00
|
|
|
Logging::message 'checking for kind of operating system... '
|
2003-03-28 20:21:24 +03:00
|
|
|
os_code = with_config('os-code') ||
|
|
|
|
case RUBY_PLATFORM.split('-',2)[1]
|
|
|
|
when 'amigaos' then
|
|
|
|
os_code = 'AMIGA'
|
|
|
|
when /\Aos2[\-_]emx\z/ then
|
|
|
|
os_code = 'OS2'
|
2008-05-29 12:52:31 +04:00
|
|
|
when /mswin|mingw|bccwin/ then
|
2003-03-28 20:21:24 +03:00
|
|
|
# NOTE: cygwin should be regarded as Unix.
|
|
|
|
os_code = 'WIN32'
|
|
|
|
else
|
|
|
|
os_code = 'UNIX'
|
|
|
|
end
|
|
|
|
os_code = 'OS_' + os_code.upcase
|
|
|
|
|
|
|
|
OS_NAMES = {
|
|
|
|
'OS_MSDOS' => 'MS-DOS',
|
|
|
|
'OS_AMIGA' => 'Amiga',
|
|
|
|
'OS_VMS' => 'VMS',
|
|
|
|
'OS_UNIX' => 'Unix',
|
|
|
|
'OS_ATARI' => 'Atari',
|
|
|
|
'OS_OS2' => 'OS/2',
|
|
|
|
'OS_MACOS' => 'MacOS',
|
|
|
|
'OS_TOPS20' => 'TOPS20',
|
|
|
|
'OS_WIN32' => 'Win32',
|
|
|
|
'OS_VMCMS' => 'VM/CMS',
|
|
|
|
'OS_ZSYSTEM' => 'Z-System',
|
|
|
|
'OS_CPM' => 'CP/M',
|
|
|
|
'OS_QDOS' => 'QDOS',
|
|
|
|
'OS_RISCOS' => 'RISCOS',
|
|
|
|
'OS_UNKNOWN' => 'Unknown',
|
|
|
|
}
|
|
|
|
unless OS_NAMES.key? os_code then
|
2012-05-18 11:02:56 +04:00
|
|
|
raise "invalid OS_CODE `#{os_code}'"
|
2003-03-28 20:21:24 +03:00
|
|
|
end
|
2012-05-18 23:51:58 +04:00
|
|
|
Logging::message "#{OS_NAMES[os_code]}\n"
|
2003-03-28 20:21:24 +03:00
|
|
|
defines << "OS_CODE=#{os_code}"
|
|
|
|
|
2006-05-26 03:44:08 +04:00
|
|
|
$defs.concat(defines.collect{|d|' -D'+d})
|
2003-03-28 20:21:24 +03:00
|
|
|
|
2010-01-19 08:14:29 +03:00
|
|
|
have_func('crc32_combine', 'zlib.h')
|
|
|
|
have_func('adler32_combine', 'zlib.h')
|
2012-04-30 15:11:21 +04:00
|
|
|
have_type('z_crc_t', 'zlib.h')
|
2010-01-19 08:14:29 +03:00
|
|
|
|
2003-03-28 20:21:24 +03:00
|
|
|
create_makefile('zlib')
|
|
|
|
|
|
|
|
end
|