summaryrefslogtreecommitdiffstats
path: root/ext/mmap/extconf.rb
blob: 87e8088adeeba11d88c8ead5193c0de215e07481 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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"