From: "Kurt M. Dresner" Date: 2003-09-01T01:13:32+09:00 Subject: Re: errors compiling Ruby under Solaris > Try -E option to check the pre-processed source. Is this -E on make? > > > So how do I go about figuring out what headers I need for sys/socket.h? > > > > Here are the #include's from the file... > > What file? /usr/include/sys/socket.h > > #include > > #include > > #include > Since -DHAVE_SYS_UIO_H is already defined, sys/feature_tests.h > is also necessary? I dunno... -Kurt > Although I guess it's a bug of Solaris. > > > Index: ext/socket/extconf.rb > =================================================================== > RCS file: /cvs/ruby/src/ruby/ext/socket/extconf.rb,v > retrieving revision 1.30 > diff -u -2 -p -r1.30 extconf.rb > --- ext/socket/extconf.rb 30 Jul 2003 00:32:03 -0000 1.30 > +++ ext/socket/extconf.rb 31 Aug 2003 14:50:37 -0000 > @@ -28,5 +28,5 @@ $ipv6 = false > default_ipv6 = /cygwin/ !~ RUBY_PLATFORM > if enable_config("ipv6", default_ipv6) > - if try_link(< + if checking_for("ipv6") {try_link(< #include > #include > @@ -46,12 +46,9 @@ $ipv6libdir = nil > $ipv6trylibc = nil > if $ipv6 > - if macro_defined?("IPV6_INRIA_VERSION", < -#include > -EOF > + checking_for("ipv6 type") { > + if macro_defined?("IPV6_INRIA_VERSION", "#include ") > $ipv6type = "inria" > $CFLAGS="-DINET6 "+$CFLAGS > - elsif macro_defined?("__KAME__", < -#include > -EOF > + elsif macro_defined?("__KAME__", "#include ") > $ipv6type = "kame" > $ipv6lib="inet6" > @@ -64,21 +61,15 @@ EOF > $ipv6libdir="/usr/inet6/lib" > $CFLAGS="-DINET6 -I/usr/inet6/include "+$CFLAGS > - elsif macro_defined?("_TOSHIBA_INET6", < -#include > -EOF > + elsif macro_defined?("_TOSHIBA_INET6", "#include ") > $ipv6type = "toshiba" > $ipv6lib="inet6" > $ipv6libdir="/usr/local/v6/lib" > $CFLAGS="-DINET6 "+$CFLAGS > - elsif macro_defined?("__V6D__", < -#include > -EOF > + elsif macro_defined?("__V6D__", "#include ") > $ipv6type = "v6d" > $ipv6lib="v6" > $ipv6libdir="/usr/local/v6/lib" > $CFLAGS="-DINET6 -I/usr/local/v6/include "+$CFLAGS > - elsif macro_defined?("_ZETA_MINAMI_INET6", < -#include > -EOF > + elsif macro_defined?("_ZETA_MINAMI_INET6", "#include ") > $ipv6type = "zeta" > $ipv6lib="inet6" > @@ -90,5 +81,6 @@ EOF > $CFLAGS="-DINET6 "+$CFLAGS > end > - > + $ipv6type} > + > if $ipv6lib > if File.directory? $ipv6libdir and File.exist? "#{$ipv6libdir}/lib#{$ipv6lib}.a" > @@ -106,88 +98,32 @@ EOS > end > > - if try_link(< -#ifdef _WIN32 > -# include > -# include > -#else > -# include > -# include > -# include > -# include > -# include > -#endif > -int > -main() > -{ > - struct sockaddr_in sin; > - > - sin.sin_len; > - return 0; > -} > -EOF > - $CFLAGS="-DHAVE_SIN_LEN "+$CFLAGS > +unless $mswin or $bccwin or $mingw > + headers = %w > +end > +if /solaris/ =~ RUBY_PLATFORM and !try_compile("") > + # bug of gcc 3.0 on Solaris 8 > + headers << "sys/feature_tests.h" > end > > - if try_link(< -#ifdef _WIN32 > -# include > -# include > -#else > -# include > -# include > -# include > -# include > -#endif > -int > -main() > -{ > - struct sockaddr_storage ss; > - > - ss.ss_family; > - return 0; > -} > -EOF > - $CFLAGS="-DHAVE_SOCKADDR_STORAGE "+$CFLAGS > -else # doug's fix, NOW add -Dss_family... only if required! > -$CPPFLAGS += " -Dss_family=__ss_family -Dss_len=__ss_len" > - if try_link(< -#ifdef _WIN32 > -# include > -# include > -#else > -# include > -# include > -# include > -# include > -#endif > -int > -main() > -{ > - struct sockaddr_storage ss; > - > - ss.ss_family; > - return 0; > -} > -EOF > - $CFLAGS="-DHAVE_SOCKADDR_STORAGE "+$CFLAGS > +if have_struct_member("struct sockaddr_in", "sin_len", headers) > + $defs[-1] = "-DHAVE_SIN_LEN" > end > + > +flags = " -Dss_family=__ss_family -Dss_len=__ss_len" > +begin > + if have_struct_member("struct sockaddr_storage", "ss_family", headers) > + $defs[-1] = "-DHAVE_SOCKADDR_STORAGE" > + elsif flags # doug's fix, NOW add -Dss_family... only if required! > + $CPPFLAGS += flags > + retry > + end > end > > - if try_link(< -#include > -#include > -#include > -#include > -#include > -int > -main() > -{ > - struct sockaddr sa; > +if have_struct_member("struct sockaddr", "sa_len", headers) > + $defs[-1] = "-DHAVE_SA_LEN "+$CFLAGS > +end > > - sa.sa_len; > - return 0; > -} > -EOF > - $CFLAGS="-DHAVE_SA_LEN "+$CFLAGS > +unless have_type("socklen_t", headers) > + $defs[-1] = "-Dsocklen_t=int" > end > > @@ -201,10 +137,6 @@ end > > $getaddr_info_ok = false > -if !enable_config("wide-getaddrinfo", false) and try_run(< -#include > -#include > -#include > -#include > -#include > +if !enable_config("wide-getaddrinfo", false) and checking_for("getaddrinfo") {try_run(< +#{cpp_include(headers)} > > #ifndef AF_LOCAL > @@ -336,20 +268,4 @@ else > have_header("arpa/nameser.h") > have_header("resolv.h") > -end > - > -if !try_link(< -#include > -#include > -#include > -#include > -#include > -int > -main() > -{ > - socklen_t len; > - return 0; > -} > -EOF > - $CFLAGS="-Dsocklen_t=int "+$CFLAGS > end > > > > -- > Nobu Nakada > >======= End of Original Message =======<