DESCRIPTION="free, small, and standard compliant a Prolog compiler"
HOMEPAGE="http://www.swi-prolog.org/"
SRC_URI="http://www.swi.psy.uva.nl/cgi-bin/nph-download/SWI-Prolog/pl-${PV}.tar.gz"
LICENSE="LGPL-2.1"
SLOT="0"
KEYWORDS="x86"
IUSE="readline static"

DEPEND="
	sys-libs/ncurses
	virtual/glibc
	sys-apps/gawk
	sys-apps/sed
	sys-devel/binutils"
S="${WORKDIR}/pl-${PV}"

src_unpack() {
	unpack ${A}
}

src_compile() {

	cd ${S}/src
	S="${S}/src"
	local myconf	
	use readline || myconf="${myconf} --disable-readline"
		
	use static && myconf="${myconf} --disable-shared"
	
	econf ${myconf} \
		--prefix=/usr \
		--enable-mt
		
	make || die "make failed"
}

src_install() {

	cd ${S}/src
	S="${S}/src"
#	make install DESTDIR=${D} || die "make install failed"
	einstall	
	dodoc ANNOUNCE ChangeLog INSTALL INSTALL.notes PORTING README VERSION
}