summaryrefslogtreecommitdiffstats
path: root/ext/mmap/extconf.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mmap/extconf.rb')
-rw-r--r--ext/mmap/extconf.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/ext/mmap/extconf.rb b/ext/mmap/extconf.rb
new file mode 100644
index 0000000..87e8088
--- /dev/null
+++ b/ext/mmap/extconf.rb
@@ -0,0 +1,33 @@
+#!/usr/bin/ruby
+ARGV.collect! {|x| x.sub(/^--with-mmap-prefix=/, "--with-mmap-dir=") }
+
+require 'mkmf'
+
+if unknown = enable_config("unknown")
+ libs = if CONFIG.key?("LIBRUBYARG_STATIC")
+ Config::expand(CONFIG["LIBRUBYARG_STATIC"].dup).sub(/^-l/, '')
+ else
+ Config::expand(CONFIG["LIBRUBYARG"].dup).sub(/^lib([^.]*).*/, '\\1')
+ end
+ unknown = find_library(libs, "ruby_init",
+ Config::expand(CONFIG["archdir"].dup))
+end
+
+dir_config("mmap")
+
+["lstrip", "match", "insert", "casecmp"].each do |func|
+ if "aa".respond_to?(func)
+ $CFLAGS += " -DHAVE_RB_STR_#{func.upcase}"
+ end
+end
+
+if enable_config("ipc")
+ unless have_func("semctl") && have_func("shmctl")
+ $stderr.puts "\tIPC will not be available"
+ end
+end
+
+$CFLAGS += " -DRUBYLIBDIR='\"#{CONFIG['rubylibdir']}\"'"
+
+create_makefile "mmap"
+