summaryrefslogtreecommitdiffstats
path: root/recipes-support/ruby-shadow/files/extconf.rb
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-support/ruby-shadow/files/extconf.rb')
-rw-r--r--recipes-support/ruby-shadow/files/extconf.rb75
1 files changed, 75 insertions, 0 deletions
diff --git a/recipes-support/ruby-shadow/files/extconf.rb b/recipes-support/ruby-shadow/files/extconf.rb
new file mode 100644
index 0000000..570a6ee
--- /dev/null
+++ b/recipes-support/ruby-shadow/files/extconf.rb
@@ -0,0 +1,75 @@
1# -*- ruby -*-
2# extconf.rb
3#
4# Modified at: <1999/8/19 06:38:55 by ttate>
5#
6
7require 'mkmf'
8require 'rbconfig'
9
10$CFLAGS = case RUBY_VERSION
11 when /^1\.9/; '-DRUBY19'
12 when /^2\./; '-DRUBY19'
13 when /^3\./; '-DRUBY19'
14 else; ''
15 end
16
17implementation = case CONFIG['host_os']
18 when /linux/i; 'shadow'
19 when /sunos|solaris/i; 'shadow'
20 when /freebsd|mirbsd|netbsd|openbsd/i; 'pwd'
21 when /darwin/i; 'pwd'
22 else; nil
23 "This library works on OS X, FreeBSD, MirBSD, NetBSD, OpenBSD, Solaris and Linux."
24 end
25
26# force this, we know we are building for linux
27implementation = 'shadow'
28
29# puts "Selected implementation: #{implementation}"
30# puts "Host OS: #{CONFIG['host_os']}"
31
32ok = true
33
34case implementation
35when 'shadow'
36 #$LDFLAGS = "-lshadow"
37
38 if( ! (ok &= have_library("shadow","getspent")) )
39 $LDFLAGS = ""
40 ok = have_func("getspent")
41 end
42
43 ok &= have_func("fgetspent")
44 ok &= have_func("setspent")
45 ok &= have_func("endspent")
46 ok &= have_func("lckpwdf")
47 ok &= have_func("ulckpwdf")
48
49 if ok
50 if !have_func("sgetspent")
51 $CFLAGS += ' -DSOLARIS'
52 end
53 end
54when 'pwd'
55 ok &= have_func("endpwent")
56 ok &= have_func("getpwent")
57 ok &= have_func("getpwnam")
58 ok &= have_func("getpwuid")
59 ok &= have_func("setpassent")
60 ok &= have_func("setpwent")
61
62 have_header("uuid/uuid.h")
63 have_header("uuid.h")
64else
65 ok = false
66end
67
68have_header( "ruby/io.h")
69
70if ok
71
72 create_makefile("shadow", implementation)
73else
74 raise "You are missing some of the required functions from either shadow.h on Linux/Solaris, or pwd.h on FreeBSD/MirBSD/NetBSD/OpenBSD/OS X."
75end