#! /usr/local/bin/ruby

require 'mkmf'

NEED_VERSION = '0.2.22'

# esdのバージョンのチェック
/(\d+)\.(\d+)\.(\d+)/ =~ NEED_VERSION
need_version = $1.to_i * 10000 + $2.to_i * 100 + $3.to_i

/(\d+)\.(\d+)\.(\d+)/ =~ `esd-config --version`.chomp
current_version = $1.to_i * 10000 + $2.to_i * 100 + $3.to_i

if need_version > current_version 
	print "Need EsounD version. require later " + NEED_VERSION + "\n"
	exit
end

#$sitearchdir += File::Separator + 'xasahi'

# フラグの作成
$CFLAGS += ' ' + `esd-config --cflags`.chomp
$LDFLAGS += ' ' + `esd-config --libs`.chomp + ' ' +
		 `audiofile-config --libs`.chomp

have_func( "esd_sample_kill");

create_makefile( "esd")
