~ubuntu-branches/ubuntu/hardy/ruby1.8/hardy-updates

« back to all changes in this revision

Viewing changes to ext/etc/extconf.rb

  • Committer: Bazaar Package Importer
  • Author(s): akira yamada
  • Date: 2007-03-13 22:11:58 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20070313221158-h3oql37brlaf2go2
Tags: 1.8.6-1
* new upstream version, 1.8.6.
* libruby1.8 conflicts with libopenssl-ruby1.8 (< 1.8.6) (closes: #410018)
* changed packaging style to cdbs from dbs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
require 'mkmf'
 
2
 
 
3
have_library("sun", "getpwnam") # NIS (== YP) interface for IRIX 4
 
4
a = have_func("getlogin")
 
5
b = have_func("getpwent")
 
6
c = have_func("getgrent")
 
7
if  a or b or c
 
8
  have_struct_member('struct passwd', 'pw_gecos', 'pwd.h')
 
9
  have_struct_member('struct passwd', 'pw_change', 'pwd.h')
 
10
  have_struct_member('struct passwd', 'pw_quota', 'pwd.h')
 
11
  if have_struct_member('struct passwd', 'pw_age', 'pwd.h')
 
12
    case what_type?('struct passwd', 'pw_age', 'pwd.h')
 
13
    when "string"
 
14
      f = "safe_setup_str"
 
15
    when "long long"
 
16
      f = "LL2NUM"
 
17
    else
 
18
      f = "INT2NUM"
 
19
    end
 
20
    $defs.push("-DPW_AGE2VAL="+f)
 
21
  end
 
22
  have_struct_member('struct passwd', 'pw_class', 'pwd.h')
 
23
  have_struct_member('struct passwd', 'pw_comment', 'pwd.h') unless /cygwin/ === RUBY_PLATFORM
 
24
  have_struct_member('struct passwd', 'pw_expire', 'pwd.h')
 
25
  have_struct_member('struct passwd', 'pw_passwd', 'pwd.h')
 
26
  have_struct_member('struct group', 'gr_passwd', 'grp.h')
 
27
  [%w"uid_t pwd.h", %w"gid_t grp.h"].each do |t, *h|
 
28
    h.unshift("sys/types.h")
 
29
    f = "INT2NUM"
 
30
    if have_type(t, h)
 
31
      if try_static_assert("sizeof(#{t}) > sizeof(long)", h)
 
32
        f = "LL2NUM"
 
33
      end
 
34
      if try_static_assert("(#{t})-1 > 0", h)
 
35
        f = "U#{f}"
 
36
      end
 
37
    end
 
38
    t = t.chomp('_t').upcase
 
39
    $defs.push("-DPW_#{t}2VAL=#{f}")
 
40
    $defs.push("-DPW_VAL2#{t}=#{f.sub(/([A-Z]+)2(NUM)/, '\22\1')}")
 
41
  end
 
42
  create_makefile("etc")
 
43
end