From: nobu.nokada@... Date: 2004-02-05T22:23:55+09:00 Subject: Re: ruby-serialport on Win32 Hi, At Thu, 5 Feb 2004 21:55:04 +0900, Stephan K�mper wrote in [ruby-talk:91615]: > I assume you're running these inside the ruby-serialport directory. > Doing this I get: > > $ /ruby.exe -I /lib -I > extconf.rb > checking for OS... mingw > checking for termios.h... no > > After that running 'make' doesn't make much sense I think. > Where could/should I get 'termios.h' from? Why is it not found? > BTW, 'termios.h' in fact is not on the PC (and the only file referencing > it is serialport's 'extconf.rb'). mingw doesn't have termios because it borrows the runtime library from VC. ruby-serialport seems not to support mingw yet. --- extconf.rb.orig 2003-02-14 04:54:47.000000000 +0900 +++ extconf.rb 2004-02-05 22:22:14.000000000 +0900 @@ -1,13 +1,10 @@ require 'mkmf' -printf("checking for OS... ") -STDOUT.flush -os = /-([a-z]+)/.match(RUBY_PLATFORM)[1] -puts(os) -$CFLAGS += " -D#{os}" - -if !(os == 'mswin' or os == 'bccwin') - exit(1) if not have_header("termios.h") or not have_header("unistd.h") +if respond_to?(:macro_defined?) + win32 = macro_defined?("_WIN32", "") +else + win32 = /mingw|mswin|bccwin/ =~ RUBY_PLATFORM +end +if win32 or (have_header("termios.h") and have_header("unistd.h")) + create_makefile("serialport") end - -create_makefile("serialport") --- serialport.c.orig 2003-02-14 04:55:48.000000000 +0900 +++ serialport.c 2004-02-05 22:22:05.000000000 +0900 @@ -43,5 +43,5 @@ static VALUE sRts, sDtr, sCts, sDsr, sDc -#if defined(mswin) || defined(bccwin) +#ifdef _WIN32 @@ -92,5 +92,5 @@ static VALUE sp_create(class, _port) rb_secure(4); OBJSETUP(sp, class, T_FILE); - MakeOpenFile(sp, fp); + MakeOpenFile((VALUE)sp, fp); switch(TYPE(_port)) { @@ -520,5 +520,5 @@ static VALUE sp_get_dtr(self) -#else /* defined(mswin) || defined(bccwin) */ +#else /* _WIN32 */ @@ -589,5 +589,5 @@ static VALUE sp_create(class, _port) rb_secure(4); OBJSETUP(sp, class, T_FILE); - MakeOpenFile(sp, fp); + MakeOpenFile((VALUE)sp, fp); switch(TYPE(_port)) { @@ -1054,5 +1054,5 @@ static VALUE sp_get_dtr(self) -#endif /* defined(mswin) || defined(bccwin) */ +#endif /* _WIN32 */ @@ -1193,5 +1193,5 @@ sp_signals(self) get_line_signals(self, &ls); hash = rb_hash_new(); -#if !(defined(mswin) || defined(bccwin)) +#ifndef _WIN32 rb_hash_aset(hash, sRts, INT2FIX(ls.rts)); rb_hash_aset(hash, sDtr, INT2FIX(ls.dtr)); -- Nobu Nakada