-
Notifications
You must be signed in to change notification settings - Fork 25
/
extconf.rb
69 lines (57 loc) · 1.58 KB
/
extconf.rb
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# -*- ruby -*-
# extconf.rb
#
# Modified at: <1999/8/19 06:38:55 by ttate>
#
require 'mkmf'
require 'rbconfig'
$CFLAGS = case RUBY_VERSION
when /^1\.9/; '-DRUBY19'
when /^2\./; '-DRUBY19'
when /^3\./; '-DRUBY19'
else; ''
end
implementation = case CONFIG['host_os']
when /linux/i; 'shadow'
when /sunos|solaris/i; 'shadow'
when /freebsd|mirbsd|netbsd|openbsd/i; 'pwd'
when /darwin/i; 'pwd'
else; nil
"This library works on OS X, FreeBSD, MirBSD, NetBSD, OpenBSD, Solaris and Linux."
end
ok = true
case implementation
when 'shadow'
#$LDFLAGS = "-lshadow"
if( ! (ok &= have_library("shadow","getspent")) )
$LDFLAGS = ""
ok = have_func("getspent")
end
ok &= have_func("fgetspent")
ok &= have_func("setspent")
ok &= have_func("endspent")
ok &= have_func("lckpwdf")
ok &= have_func("ulckpwdf")
if ok
if !have_func("sgetspent")
$CFLAGS += ' -DSOLARIS'
end
end
when 'pwd'
ok &= have_func("endpwent")
ok &= have_func("getpwent")
ok &= have_func("getpwnam")
ok &= have_func("getpwuid")
ok &= have_func("setpassent")
ok &= have_func("setpwent")
have_header("uuid/uuid.h")
have_header("uuid.h")
else
ok = false
end
have_header( "ruby/io.h")
if ok
create_makefile("shadow", implementation)
else
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."
end