
config.h:	stamp-h
stamp-h:	${.CURDIR}/config.h.in config.status
	CONFIG_FILES= ./config.status
	echo timestamp > stamp-h

config.status:	${.CURDIR}/config.h.in ${.CURDIR}/configure 
.if exists(config.status)
	./config.status --recheck
.else
	${.CURDIR}/configure 
.endif

# avoid things blowing up if these are not here...
# this is not quite per the autoconf manual,
# and is extremely convoluted - but all utterly necessary!

.if exists(/usr/local/bin/autoconf)

.PRECIOUS: configure config.h.in config.status

ACLOCAL=
ACCONFIG=

.if exists(${.CURDIR}/aclocal.m4)
ACLOCAL+= aclocal.m4
.endif
.if exists(${.CURDIR}/acconfig.h)
ACCONFIG+= acconfig.h
.endif

${.CURDIR}/config.h.in:	${.CURDIR}/stamp-h.in
${.CURDIR}/stamp-h.in:	configure.in ${ACCONFIG}
	cd ${.CURDIR} && autoheader
	echo timestamp > ${.CURDIR}/stamp-h.in

${.CURDIR}/configure:	configure.in ${ACLOCAL}
	cd ${.CURDIR} && autoconf

.endif
