From 8695612caf8afe1138a7baaa142658dd93c70293 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 16 Aug 2003 14:58:34 +0000 Subject: * marshal.c (w_symbol, w_object): get rid of warnings. * re.c (rb_memsearch): ditto. * time.c (time_dump): ditto. * ext/extmk.rb (extmake): not continue making when extconf.rb failed. * ext/openssl/extconf.rb: check __VA_ARGS__ macro more precisely. * ext/openssl/ossl.h: remove version.h dependency. * ext/openssl/ruby_missing.h: ditto. * lib/mkmf.rb (pkg_config): use --libs output except with only-L for other options. [ruby-list:38099] * lib/mkmf.rb (create_makefile): separate rule for static library from shared object. * win32/Makefile.sub, bcc32/Makefile.sub, wince/Makefile.sub: define exec_prefix and libdir. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 26 ++++++++++++++++++++++ Makefile.in | 6 +++--- bcc32/Makefile.sub | 8 +++++++ ext/extmk.rb | 28 +++++++++++++----------- ext/openssl/extconf.rb | 5 +---- ext/openssl/ossl.h | 8 +++---- ext/openssl/ruby_missing.h | 54 ++-------------------------------------------- lib/mkmf.rb | 20 +++++++++-------- marshal.c | 8 +++---- re.c | 4 +--- time.c | 2 +- win32/Makefile.sub | 8 +++++++ wince/Makefile.sub | 8 +++++++ 13 files changed, 92 insertions(+), 93 deletions(-) diff --git a/ChangeLog b/ChangeLog index d5f33119c9..22be2e221d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,29 @@ +Sat Aug 16 23:58:18 2003 Nobuyoshi Nakada + + * marshal.c (w_symbol, w_object): get rid of warnings. + + * re.c (rb_memsearch): ditto. + + * time.c (time_dump): ditto. + + * ext/extmk.rb (extmake): not continue making when extconf.rb + failed. + + * ext/openssl/extconf.rb: check __VA_ARGS__ macro more precisely. + + * ext/openssl/ossl.h: remove version.h dependency. + + * ext/openssl/ruby_missing.h: ditto. + + * lib/mkmf.rb (pkg_config): use --libs output except with + only-L for other options. [ruby-list:38099] + + * lib/mkmf.rb (create_makefile): separate rule for static + library from shared object. + + * win32/Makefile.sub, bcc32/Makefile.sub, wince/Makefile.sub: + define exec_prefix and libdir. + Fri Aug 15 23:15:00 2003 Shigeo Kobayashi * ext/bigdecimal/bigdecimal.c .h: Bug in combination of limit & div diff --git a/Makefile.in b/Makefile.in index 9772438db5..26c2bb820b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -196,12 +196,12 @@ Makefile: $(srcdir)/Makefile.in @MAKEFILES@: config.status MAKE=$(MAKE) $(SHELL) ./config.status - @{ : $(MAKE); \ + @{ \ echo "all:; -@rm -f conftest.mk"; \ echo "conftest.mk: .force; @echo AUTO_REMAKE"; \ echo ".force:"; \ - } > conftest.mk - @$(MAKE) -f conftest.mk | grep '^AUTO_REMAKE$$' >/dev/null 2>&1 || \ + } > conftest.mk || exit 1; \ + $(MAKE) -f conftest.mk | grep '^AUTO_REMAKE$$' >/dev/null 2>&1 || \ { echo "Makefile updated, restart."; exit 1; } config.status: $(srcdir)/configure diff --git a/bcc32/Makefile.sub b/bcc32/Makefile.sub index feefe24e48..ba7a279c78 100644 --- a/bcc32/Makefile.sub +++ b/bcc32/Makefile.sub @@ -1,3 +1,5 @@ +# -*- makefile -*- + SHELL = $(COMSPEC) #### Start of system configuration section. #### @@ -83,6 +85,12 @@ OPTFLAGS = -O !ifndef prefix prefix = /usr !endif +!ifndef exec_prefix +exec_prefix = $(prefix) +!endif +!ifndef libdir +libdir = $(exec_prefix)/lib +!endif !ifndef DESTDIR DESTDIR = $(prefix) !endif diff --git a/ext/extmk.rb b/ext/extmk.rb index e2f398356d..bb50579c92 100644 --- a/ext/extmk.rb +++ b/ext/extmk.rb @@ -61,15 +61,17 @@ def extmake(target) $mdir = target $srcdir = File.join($top_srcdir, "ext", $mdir) $preload = nil + makefile = "./Makefile" unless $ignore if $static || - !(t = modified?("./Makefile", MTIMES)) || + !(t = modified?(makefile, MTIMES)) || %W<#{$srcdir}/makefile.rb #{$srcdir}/extconf.rb #{$srcdir}/depend #{$srcdir}/MANIFEST>.any? {|f| modified?(f, [t])} then $defs = [] Logging::logfile 'mkmf.log' Config::CONFIG["srcdir"] = $srcdir + rm_f makefile begin if File.exist?($0 = "#{$srcdir}/makefile.rb") load $0 @@ -78,6 +80,7 @@ def extmake(target) else create_makefile(target) end + File.exist?(makefile) rescue SystemExit # ignore ensure @@ -85,19 +88,20 @@ def extmake(target) $0 = $PROGRAM_NAME Config::CONFIG["srcdir"] = $top_srcdir end + else + true end + end or open(makefile, "w") do |f| + f.print dummy_makefile($srcdir) + return true end - if File.exist?("./Makefile") - if $static - $extlist.push [$static, $target, File.basename($target), $preload] - end - unless system($make, *sysquote($mflags)) - $ignore or $continue or return false - end - else - open("./Makefile", "w") {|f| - f.print dummy_makefile($srcdir) - } + args = sysquote($mflags) + if $static + args += ["static"] + $extlist.push [$static, $target, File.basename($target), $preload] + end + unless system($make, *args) + $ignore or $continue or return false end if $static $extflags ||= "" diff --git a/ext/openssl/extconf.rb b/ext/openssl/extconf.rb index 92dabdc587..978f9dbb69 100644 --- a/ext/openssl/extconf.rb +++ b/ext/openssl/extconf.rb @@ -79,15 +79,12 @@ have_func("BN_mod_sub") have_func("BN_rand_range") have_func("BN_pseudo_rand_range") have_func("CONF_get1_default_config_file") -if try_cpp("#define FOO(a, ...) foo(a, ##__VA_ARGS__)\n int x(){FOO(1,2);}\n") +if try_cpp("#define FOO(a, ...) foo(a, ##__VA_ARGS__)\n int x(){FOO(1);FOO(1,2);FOO(1,2,3);}\n") $defs.push("-DHAVE_VA_ARGS_MACRO") end have_header("openssl/ocsp.h") have_struct_member("EVP_CIPHER_CTX", "flags", "openssl/evp.h") -message "=== Checking for Ruby features... ===\n" -have_func("rb_obj_init_copy", "ruby.h") - message "=== Checking done. ===\n" $distcleanfiles << "GNUmakefile" << "dep" create_makefile("openssl") diff --git a/ext/openssl/ossl.h b/ext/openssl/ossl.h index 72b183986e..7a8b3e1853 100644 --- a/ext/openssl/ossl.h +++ b/ext/openssl/ossl.h @@ -16,15 +16,13 @@ extern "C" { #endif /* - * Check the Ruby version and OpenSSL + * Check the OpenSSL version * The only supported are: - * Ruby >= 1.7.2 * OpenSSL >= 0.9.7 */ -#include #include -#if defined(NT) || defined(_WIN32) +#if defined(_WIN32) # define OpenFile WINAPI_OpenFile #endif #include @@ -40,7 +38,7 @@ extern "C" { # define OSSL_OCSP_ENABLED # include #endif -#if defined(NT) || defined(_WIN32) +#if defined(_WIN32) # undef OpenFile #endif diff --git a/ext/openssl/ruby_missing.h b/ext/openssl/ruby_missing.h index bdb152b08e..f9e74f743e 100644 --- a/ext/openssl/ruby_missing.h +++ b/ext/openssl/ruby_missing.h @@ -11,60 +11,10 @@ #if !defined(_OSSL_RUBY_MISSING_H_) #define _OSS_RUBY_MISSING_H_ -#if !defined(StringValue) -# define StringValue(v) \ - if (TYPE(v) != T_STRING) v = rb_str_to_str(v) -#endif +#define DEFINE_ALLOC_WRAPPER(func) -#if !defined(StringValuePtr) -# define StringValuePtr(v) \ - RSTRING((TYPE(v) == T_STRING) ? (v) : rb_str_to_str(v))->ptr -#endif - -#if !defined(SafeStringValue) -# define SafeStringValue(v) do {\ - StringValue(v);\ - rb_check_safe_str(v);\ -} while (0) -#endif - -#if RUBY_VERSION_CODE < 180 -# define rb_cstr_to_inum(a,b,c) \ - rb_cstr2inum(a,b) -# define rb_check_frozen(obj) \ - if (OBJ_FROZEN(obj)) rb_error_frozen(rb_obj_classname(obj)) -# define rb_obj_classname(obj) \ - rb_class2name(CLASS_OF(obj)) -#endif - -#if HAVE_RB_DEFINE_ALLOC_FUNC -# define DEFINE_ALLOC_WRAPPER(func) -#else -# define DEFINE_ALLOC_WRAPPER(func) \ - static VALUE \ - func##_wrapper(int argc, VALUE *argv, VALUE klass) \ - { \ - VALUE obj; \ - \ - obj = func(klass); \ - \ - rb_obj_call_init(obj, argc, argv); \ - \ - return obj; \ - } -# define rb_define_alloc_func(klass, func) \ - rb_define_singleton_method(klass, "new", func##_wrapper, -1) -#endif - -#if RUBY_VERSION_CODE >= 180 -# if !defined(HAVE_RB_OBJ_INIT_COPY) -# define rb_define_copy_func(klass, func) \ - rb_define_method(klass, "copy_object", func, 1) -# else -# define rb_define_copy_func(klass, func) \ +#define rb_define_copy_func(klass, func) \ rb_define_method(klass, "initialize_copy", func, 1) -# endif -#endif #endif /* _OSS_RUBY_MISSING_H_ */ diff --git a/lib/mkmf.rb b/lib/mkmf.rb index d21fa4f8b6..85cff94da1 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -650,8 +650,9 @@ def pkg_config(pkg) end if $PKGCONFIG and system("#{$PKGCONFIG} --exists #{pkg}") cflags = `#{$PKGCONFIG} --cflags #{pkg}`.chomp - ldflags = `#{$PKGCONFIG} --libs-only-L #{pkg}`.chomp + ldflags = `#{$PKGCONFIG} --libs #{pkg}`.chomp libs = `#{$PKGCONFIG} --libs-only-l #{pkg}`.chomp + ldflags = (Shellwords.shellwords(ldflags) - Shellwords.shellwords(libs)).quote.join(" ") $CFLAGS += " " << cflags $LDFLAGS += " " << ldflags $libs += " " << libs @@ -805,7 +806,8 @@ def create_makefile(target, srcprefix = nil) libpath = libpathflag(libpath) - dllib = target ? "$(TARGET).#{$static ? $LIBEXT : CONFIG['DLEXT']}" : "" + dllib = target ? "$(TARGET).#{CONFIG['DLEXT']}" : "" + staticlib = target ? "$(TARGET).#$LIBEXT" : "" mfile = open("Makefile", "wb") mfile.print configuration(srcdir) mfile.print %{ @@ -821,6 +823,7 @@ LIBS = #{$LIBRUBYARG} #{$libs} #{$LIBS} OBJS = #{$objs} TARGET = #{target} DLLIB = #{dllib} +STATIC_LIB = #{staticlib} } if $extmk mfile.print %{ @@ -840,6 +843,7 @@ CLEANLIBS = "$(TARGET).{lib,exp,il?,tds,map}" $(DLLIB) CLEANOBJS = "*.{#{$OBJEXT},#{$LIBEXT},s[ol],pdb,bak}" all: #{target ? "$(DLLIB)" : "Makefile"} +static: $(STATIC_LIB) } mfile.print CLEANINGS dirs = [] @@ -894,13 +898,11 @@ all: #{target ? "$(DLLIB)" : "Makefile"} mfile.print "$(DLLIB): $(OBJS)\n\t" mfile.print "@-$(RM) $@\n\t" mfile.print "@-$(RM) $(TARGET).lib\n\t" if $mswin - if $static - mfile.print "$(AR) #{config_string('ARFLAGS') || 'cru '}$(DLLIB) $(OBJS)" - if ranlib = config_string('RANLIB') - mfile.print "\n\t@-#{ranlib} $(DLLIB) 2> /dev/null || true" - end - else - mfile.print LINK_SO + mfile.print LINK_SO, "\n\n" + mfile.print "$(STATIC_LIB): $(OBJS)\n\t" + mfile.print "$(AR) #{config_string('ARFLAGS') || 'cru '}$@ $(OBJS)" + if ranlib = config_string('RANLIB') + mfile.print "\n\t@-#{ranlib} $(DLLIB) 2> /dev/null || true" end mfile.print "\n\n" diff --git a/marshal.c b/marshal.c index e4f84454eb..cf947e44d9 100644 --- a/marshal.c +++ b/marshal.c @@ -308,11 +308,11 @@ w_symbol(id, arg) struct dump_arg *arg; { char *sym = rb_id2name(id); - long num; + st_data_t num; if (st_lookup(arg->symbols, id, &num)) { w_byte(TYPE_SYMLINK, arg); - w_long(num, arg); + w_long((long)num, arg); } else { w_byte(TYPE_SYMBOL, arg); @@ -468,11 +468,11 @@ w_object(obj, arg, limit) w_symbol(SYM2ID(obj), arg); } else { - long num; + st_data_t num; if (st_lookup(arg->data, obj, &num)) { w_byte(TYPE_LINK, arg); - w_long(num, arg); + w_long((long)num, arg); return; } diff --git a/re.c b/re.c index e81b093a3e..53c6832c2a 100644 --- a/re.c +++ b/re.c @@ -69,8 +69,6 @@ static const char casetable[] = { # error >>> "You lose. You will need a translation table for your character set." <<< #endif -#define MIN(a,b) (((a)>(b))?(b):(a)) - int rb_memcicmp(p1, p2, len) char *p1, *p2; @@ -101,7 +99,7 @@ rb_memsearch(x0, m, y0, n) char *x0, *y0; long m, n; { - unsigned char *x = x0, *y = y0; + unsigned char *x = (unsigned char *)x0, *y = (unsigned char *)y0; unsigned char *s, *e; long i; int d; diff --git a/time.c b/time.c index af4a37e0e4..d8e6bbca0e 100644 --- a/time.c +++ b/time.c @@ -1302,7 +1302,7 @@ time_dump(argc, argv, time) struct time_object *tobj; struct tm *tm; unsigned long p, s; - unsigned char buf[8]; + char buf[8]; time_t t; int i; diff --git a/win32/Makefile.sub b/win32/Makefile.sub index 8e81404190..af0e157930 100644 --- a/win32/Makefile.sub +++ b/win32/Makefile.sub @@ -1,3 +1,5 @@ +# -*- makefile -*- + SHELL = $(COMSPEC) #### Start of system configuration section. #### @@ -74,6 +76,12 @@ RUBY_SO_NAME = $(RT)-$(RUBY_INSTALL_NAME)$(MAJOR)$(MINOR) !if !defined(prefix) prefix = /usr !endif +!if !defined(exec_prefix) +exec_prefix = $(prefix) +!endif +!if !defined(libdir) +libdir = $(exec_prefix)/lib +!endif !if !defined(DESTDIR) DESTDIR = $(prefix) !endif diff --git a/wince/Makefile.sub b/wince/Makefile.sub index 77c8008cfb..ffec23ad48 100644 --- a/wince/Makefile.sub +++ b/wince/Makefile.sub @@ -1,3 +1,5 @@ +# -*- makefile -*- + SHELL = $(COMSPEC) #### Start of system configuration section. #### @@ -78,6 +80,12 @@ RUBY_SO_NAME = $(RT)-$(RUBY_INSTALL_NAME)$(MAJOR)$(MINOR) !if !defined(prefix) prefix = /usr !endif +!if !defined(exec_prefix) +exec_prefix = $(prefix) +!endif +!if !defined(libdir) +libdir = $(exec_prefix)/lib +!endif !if !defined(DESTDIR) DESTDIR = $(prefix) !endif -- cgit v1.2.3