1999-01-19 23:59:39 -05:00
|
|
|
require 'mkmf'
|
|
|
|
|
1998-01-16 07:13:05 -05:00
|
|
|
have_library("sun", "getpwnam") # NIS (== YP) interface for IRIX 4
|
|
|
|
a = have_func("getlogin")
|
|
|
|
b = have_func("getpwent")
|
|
|
|
c = have_func("getgrent")
|
|
|
|
if a or b or c
|
2002-09-08 06:00:43 -04:00
|
|
|
have_struct_member('struct passwd', 'pw_gecos', 'pwd.h')
|
|
|
|
have_struct_member('struct passwd', 'pw_change', 'pwd.h')
|
|
|
|
have_struct_member('struct passwd', 'pw_quota', 'pwd.h')
|
2005-09-06 19:35:31 -04:00
|
|
|
if have_struct_member('struct passwd', 'pw_age', 'pwd.h')
|
|
|
|
case what_type?('struct passwd', 'pw_age', 'pwd.h')
|
|
|
|
when "string"
|
|
|
|
f = "safe_setup_str"
|
|
|
|
when "long long"
|
|
|
|
f = "LL2NUM"
|
|
|
|
else
|
|
|
|
f = "INT2NUM"
|
|
|
|
end
|
|
|
|
$defs.push("-DPW_AGE2VAL="+f)
|
|
|
|
end
|
2002-09-08 06:00:43 -04:00
|
|
|
have_struct_member('struct passwd', 'pw_class', 'pwd.h')
|
|
|
|
have_struct_member('struct passwd', 'pw_comment', 'pwd.h') unless /cygwin/ === RUBY_PLATFORM
|
|
|
|
have_struct_member('struct passwd', 'pw_expire', 'pwd.h')
|
2003-11-24 05:42:17 -05:00
|
|
|
have_struct_member('struct passwd', 'pw_passwd', 'pwd.h')
|
|
|
|
have_struct_member('struct group', 'gr_passwd', 'grp.h')
|
2006-06-26 22:37:01 -04:00
|
|
|
[%w"uid_t pwd.h", %w"gid_t grp.h"].each do |t, *h|
|
2006-07-03 01:42:35 -04:00
|
|
|
h.unshift("sys/types.h")
|
|
|
|
f = "INT2NUM"
|
2006-06-26 22:37:01 -04:00
|
|
|
if have_type(t, h)
|
|
|
|
if try_static_assert("sizeof(#{t}) > sizeof(long)", h)
|
|
|
|
f = "LL2NUM"
|
|
|
|
end
|
|
|
|
if try_static_assert("(#{t})-1 > 0", h)
|
|
|
|
f = "U#{f}"
|
|
|
|
end
|
|
|
|
end
|
2006-07-03 01:42:35 -04:00
|
|
|
$defs.push("-DPW_#{t.chomp('_t').upcase}2VAL=#{f}")
|
2006-06-26 22:37:01 -04:00
|
|
|
end
|
1998-01-16 07:13:05 -05:00
|
|
|
create_makefile("etc")
|
|
|
|
end
|