require "mkmf"

$LIBPATH.push(Config::CONFIG['libdir'])

def crash(str)
  printf(" extconf failure: %s\n", str)
  exit 1
end

unless have_library('c_r', 'pthread_create')
  crash('need libpthread')
end

unless have_library('tspread', 'SP_connect')
  crash('need libtspread (threaded spread library)')
end

$CFLAGS << ' -g -Wall'
$CFLAGS << " -I#{Config::CONFIG['includedir']}"

create_makefile("spread")
