about summary refs log tree commit homepage
path: root/ext/mall/extconf.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mall/extconf.rb')
-rw-r--r--ext/mall/extconf.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/ext/mall/extconf.rb b/ext/mall/extconf.rb
new file mode 100644
index 0000000..c11d28f
--- /dev/null
+++ b/ext/mall/extconf.rb
@@ -0,0 +1,16 @@
+require 'mkmf'
+
+st_r = File.stat('mall.c.erb')
+st_c = File.stat('mall.c') rescue nil
+if st_c.nil? || st_c.ctime < st_r.ctime
+  require 'erb'
+  File.open('mall.c+', 'wb') { |fp|
+    fp.syswrite(ERB.new(File.read('mall.c.erb')).result)
+  }
+  File.rename('mall.c+', 'mall.c')
+end
+
+have_header('malloc.h') or abort "malloc.h header missing"
+have_type('struct mallinfo', 'malloc.h') or warn 'struct mallinfo missing'
+dir_config('mall')
+create_makefile('mall')