1 Index: configure.rb
2 ===================================================================
3 --- configure.rb (revision 140)
4 +++ configure.rb (working copy)
5 @@ -59,21 +59,24 @@
6 end
7 end
8
9 -require 'ftools'
10 +require 'fileutils'
11
12 def AC_OUTPUT(*files)
13 + $DEFS ||= ""
14 if $AC_LIST_HEADER
15 - $DEFS = "-DHAVE_CONFIG_H"
16 + $DEFS << " -DHAVE_CONFIG_H"
17 AC_OUTPUT_HEADER($AC_LIST_HEADER)
18 else
19 - $DEFS = $ac_confdefs.collect {|k, v| "-D#{k}=#{v}" }.join(" ")
20 + $DEFS << " " + $ac_confdefs.collect {|k, v| "-D#{k}=#{v}" }.join(" ")
21 end
22 for file in files
23 print "creating ", file, "\n"
24 open(File.join($srcdir, file + ".in")) do |fin|
25 - File.makedirs(File.dirname(file))
26 + FileUtils.mkdir_p(File.dirname(file))
27 open(file, "w") do |fout|
28 + depend = false
29 while line = fin.gets
30 + depend = true if /^\#\#\# depend/ =~ line
31 line.gsub!(/@([A-Za-z_]+)@/) do |s|
32 name = $1
33 if $ac_sed.key?(name)
34 @@ -82,6 +85,7 @@
35 s
36 end
37 end
38 + line.gsub!(/(\s)([^\s\/]+\.[ch])/, '\1{$(srcdir)}\2') if depend && $nmake
39 fout.print(line)
40 end
41 end
42 @@ -153,13 +157,18 @@
43 file = File.join(dir, prog)
44 if File.file?(file); then
45 $ac_aux_dir = dir
46 - $ac_install_rb = "#{file} -c"
47 + $ac_install_rb = "$(RUBY) #{file} -c"
48 return
49 end
50 end
51 end
52 end
53
54 +begin
55 + require "continuation"
56 +rescue LoadError
57 +end
58 +
59 def AC_PROG_INSTALL
60 AC_MSG_CHECKING("for a BSD compatible install")
61 $ac_cv_path_install = callcc { |c|
62 @@ -291,6 +300,13 @@
63 $AR = CONFIG["AR"]
64 $LD = "$(CC)"
65 $RANLIB = CONFIG["RANLIB"]
66 +$ruby = arg_config("--ruby", File.join(Config::CONFIG["bindir"], CONFIG["ruby_install_name"]))
67 +$RUBY = ($nmake && !$configure_args.has_key?('--ruby')) ? $ruby.gsub(%r'/', '\\') : $ruby
68 +if RUBY_VERSION < "1.8.0"
69 + $RM = 'rm -f'
70 +else
71 + $RM = CONFIG["RM"] || '$(RUBY) -run -e rm -- -f'
72 +end
73
74 if not defined? CFLAGS
75 CFLAGS = CONFIG["CFLAGS"]
76 @@ -306,7 +322,7 @@
77 $LDFLAGS = "-link -incremental:no -pdb:none"
78 end
79 $LIBS = CONFIG["LIBS"]
80 -$XLDFLAGS = CONFIG["XLDFLAGS"]
81 +$XLDFLAGS = CONFIG["XLDFLAGS"].to_s
82 $XLDFLAGS.gsub!(/-L\./, "")
83 if /mswin32/ !~ RUBY_PLATFORM
84 $XLDFLAGS += " -L$(libdir)"
85 @@ -349,6 +365,14 @@
86 end
87 end
88
89 +$COMPILE_RULES = ''
90 +if defined?(COMPILE_RULES)
91 + COMPILE_RULES.each do |rule|
92 + $COMPILE_RULES << sprintf(rule, 'c', $OBJEXT)
93 + $COMPILE_RULES << sprintf("\n\t%s\n\n", COMPILE_C)
94 + end
95 +end
96 +
97 AC_SUBST("srcdir")
98 AC_SUBST("topdir")
99 AC_SUBST("hdrdir")
100 @@ -375,6 +399,8 @@
101 AC_SUBST("AR")
102 AC_SUBST("LD")
103 AC_SUBST("RANLIB")
104 +AC_SUBST("RUBY")
105 +AC_SUBST("RM")
106
107 AC_SUBST("CFLAGS")
108 AC_SUBST("DEFS")
109 @@ -388,6 +414,8 @@
110 AC_SUBST("EXEEXT")
111 AC_SUBST("DLEXT")
112
113 +AC_SUBST("COMPILE_RULES")
114 +
115 AC_SUBST("RUBY_INSTALL_NAME")
116 AC_SUBST("LIBRUBYARG")
117 AC_SUBST("LIBRUBYARG_SHARED")
|