diff options
author | katsu <katsu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-03-28 17:21:24 +0000 |
---|---|---|
committer | katsu <katsu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-03-28 17:21:24 +0000 |
commit | 6f19027e4016dde04f41cc7cc58dba968fb4c2f7 (patch) | |
tree | 26027a9e49d3b24f8ff062cdc23253ac1155d076 /ext/zlib/extconf.rb | |
parent | 8a18a837f360557a7172e7a7e3c89a447e0cb1bd (diff) | |
download | ruby-6f19027e4016dde04f41cc7cc58dba968fb4c2f7.tar.gz |
Import Ruby/zlib from rough.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/zlib/extconf.rb')
-rw-r--r-- | ext/zlib/extconf.rb | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/ext/zlib/extconf.rb b/ext/zlib/extconf.rb new file mode 100644 index 0000000000..a1a28bb078 --- /dev/null +++ b/ext/zlib/extconf.rb @@ -0,0 +1,66 @@ +# +# extconf.rb +# +# $Id$ +# + +require 'mkmf' +require 'rbconfig' + +dir_config 'zlib' + + +if %w'z libz zlib'.find {|z| have_library(z, 'deflateReset')} and + have_header('zlib.h') then + + defines = [] + + message 'checking for kind of operating system... ' + 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' + when 'mswin32', 'mingw32' then + # 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 + puts "invalid OS_CODE `#{os_code}'" + exit + end + message "#{OS_NAMES[os_code]}\n" + defines << "OS_CODE=#{os_code}" + + defines = defines.collect{|d|' -D'+d}.join + if $CPPFLAGS then + $CPPFLAGS += defines + else + $CFLAGS += defines + end + + create_makefile('zlib') + +end |