summaryrefslogtreecommitdiff
path: root/ext/socket/extconf.rb
blob: dbba2cacf33847d19e825923ccc6073801065b90 (plain)
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
require 'mkmf'
$LDFLAGS = "-L/usr/local/lib" if File.directory?("/usr/local/lib")
case PLATFORM
when /mswin32/
  test_func = "WSACleanup"
  have_library("wsock32", "WSACleanup")
when /cygwin32/
  test_func = "socket"
when /beos/
  test_func = "socket"
  have_library("net", "socket")
else
  test_func = "socket"
  have_library("socket", "socket")
  have_library("inet", "gethostbyname")
  have_library("nsl", "gethostbyname")
end
have_header("sys/un.h")
if have_func(test_func)
  have_func("hsterror")
  unless have_func("gethostname")
    have_func("uname")
  end
  if ENV["SOCKS_SERVER"]  # test if SOCKSsocket needed
    if have_library("socks", "Rconnect")
      $CFLAGS="-DSOCKS"
    end
  end
  create_makefile("socket")
end