#!/usr/bin/env ruby AC_ACVERSION = "0.1" $ac_helps = [] open("configure.rb.in") do |cin| $input = cin.read $input.gsub!(/AC_ARG_ENABLE\(\s*(.*?)\s*,\s*(.*?)\s*\)/m) do $ac_helps.push($2) "AC_ENABLE(#{$1})" end $input.gsub!(/AC_ARG_WITH\(\s*(.*?)\s*,\s*(.*?)\s*\)/m) do $ac_helps.push($2) "AC_WITH(#{$1})" end end open("configure.rb", "w") do |cout| cout.print(<&1` =~ /dspmsg/ # AIX install. It has an incompatible calling convention. else c.call("#{file} -c") end end end end unless $ac_install_rb AC_CONFIG_AUX_DIR_DEFAULT() end $ac_install_rb } $INSTALL = $ac_cv_path_install AC_MSG_RESULT($INSTALL) $INSTALL_PROGRAM ||= "$(INSTALL)" $INSTALL_SCRIPT ||= "$(INSTALL)" $INSTALL_DATA ||= "$(INSTALL) -m 644" $INSTALL_DLLIB ||= "$(INSTALL) -m 555" $INSTALL_DIR ||= "$(INSTALL) -d" AC_SUBST("INSTALL") AC_SUBST("INSTALL_PROGRAM") AC_SUBST("INSTALL_SCRIPT") AC_SUBST("INSTALL_DATA") AC_SUBST("INSTALL_DLLIB") AC_SUBST("INSTALL_DIR") end $stdout.sync = true drive = File::PATH_SEPARATOR == ';' ? /\A\w:/ : /\A/ prefix = Regexp.new("\\A" + Regexp.quote(CONFIG["prefix"])) $prefix = CONFIG["prefix"].sub(drive, '') $exec_prefix = "$(prefix)" $bindir = CONFIG["bindir"].sub(prefix, "$(exec_prefix)").sub(drive, '') $libdir = CONFIG["libdir"].sub(prefix, "$(exec_prefix)").sub(drive, '') $archdir = $archdir.sub(prefix, "$(prefix)").sub(drive, '') $sitelibdir = $sitelibdir.sub(prefix, "$(prefix)").sub(drive, '') $sitearchdir = $sitearchdir.sub(prefix, "$(prefix)").sub(drive, '') $includedir = CONFIG["includedir"].sub(prefix, "$(prefix)").sub(drive, '') $mandir = CONFIG["mandir"].sub(prefix, "$(prefix)").sub(drive, '') $rubylibdir ||= $libdir + "/ruby/" + CONFIG["MAJOR"] + "." + CONFIG["MINOR"] for option in ARGV if option =~ /^-.*?=(.*)/ optarg = $1 else optarg = nil end case option when /^--prefix/ $prefix = optarg when /^--exec-prefix/ $exec_prefix = optarg when /^--bindir/ $bindir = optarg when /^--libdir/ $libdir = optarg when /^--includedir/ $includedir = optarg when /^--mandir/ $mandir = optarg when /^--enable-([^=]+)/ feature = $1 if optarg.nil? optarg = "yes" end $ac_features[feature] = optarg when /^--with-([^=]+)/ package = $1 if optarg.nil? optarg = "yes" end $ac_packages[package] = optarg when "--help" print < 0 print "--enable and --with options recognized:\n" print $ac_help end exit(0) when /^-.*/ AC_MSG_ERROR("#{option}: invalid option; use --help to show usage") end end $srcdir = File.dirname($0) $VPATH = "" $RUBY_INSTALL_NAME = CONFIG["RUBY_INSTALL_NAME"] $arch = CONFIG["arch"] $ruby_version = Config::CONFIG["ruby_version"] || CONFIG["MAJOR"] + "." + CONFIG["MINOR"] $CC = CONFIG["CC"] $AR = CONFIG["AR"] $LD = "$(CC)" $RANLIB = CONFIG["RANLIB"] $CFLAGS = CFLAGS + " " + CONFIG["CCDLFLAGS"] $LDFLAGS = CONFIG["LDFLAGS"] $LIBS = CONFIG["LIBS"] $XLDFLAGS = CONFIG["XLDFLAGS"] $DLDFLAGS = CONFIG["DLDFLAGS"] $LDSHARED = CONFIG["LDSHARED"] $EXEEXT = CONFIG["EXEEXT"] $DLEXT = CONFIG["DLEXT"] $LIBRUBYARG = CONFIG["LIBRUBYARG"] if $LIBRUBYARG =~ /\.a$/ $RUBY_SHARED = false $LIBRUBYARG = "$(hdrdir)/" + $LIBRUBYARG else $RUBY_SHARED = true $LIBRUBYARG.gsub!(/-L\./, "-L$(libdir)") end case PLATFORM when /-aix/ if $RUBY_SHARED $LIBRUBYARG = "-Wl,$(libdir)/" + CONFIG["LIBRUBY_SO"] $LIBRUBYARG.sub!(/\.so\.[.0-9]*$/, '.so') $XLDFLAGS = "" else $XLDFLAGS = "-Wl,-bE:$(topdir)/ruby.imp" end if $DLDFLAGS !~ /-Wl,/ $LIBRUBYARG.gsub!(/-Wl,/, '') $XLDFLAGS.gsub!(/-Wl,/, '') $DLDFLAGS.gsub!(/-Wl,/, '') end end AC_SUBST("srcdir") AC_SUBST("topdir") AC_SUBST("hdrdir") AC_SUBST("VPATH") AC_SUBST("RUBY_INSTALL_NAME") AC_SUBST("arch") AC_SUBST("ruby_version") AC_SUBST("prefix") AC_SUBST("exec_prefix") AC_SUBST("bindir") AC_SUBST("libdir") AC_SUBST("rubylibdir") AC_SUBST("archdir") AC_SUBST("sitedir") AC_SUBST("sitelibdir") AC_SUBST("sitearchdir") AC_SUBST("includedir") AC_SUBST("mandir") AC_SUBST("CC") AC_SUBST("AR") AC_SUBST("LD") AC_SUBST("RANLIB") AC_SUBST("CFLAGS") AC_SUBST("DEFS") AC_SUBST("LDFLAGS") AC_SUBST("LIBS") AC_SUBST("XLDFLAGS") AC_SUBST("DLDFLAGS") AC_SUBST("LDSHARED") AC_SUBST("OBJEXT") AC_SUBST("EXEEXT") AC_SUBST("DLEXT") AC_SUBST("LIBRUBYARG") EOS cout.print($input) cout.chmod(0755) end