PORTNAME=	m4
PORTVERSION=	1.4.19
PORTREVISION=	1
PORTEPOCH=	1
CATEGORIES=	devel
MASTER_SITES=	GNU

MAINTAINER=	sunpoet@FreeBSD.org
COMMENT=	GNU M4
WWW=		https://www.gnu.org/software/m4/m4.html

LICENSE=	GPLv3
LICENSE_FILE=	${WRKSRC}/COPYING

USES=		cpe iconv tar:xz

GNU_CONFIGURE=	yes
CONFIGURE_ARGS=	--program-prefix=g --disable-nls

EXAMPLESDIR=	${PREFIX}/share/examples/gm4

CPE_VENDOR=	gnu

OPTIONS_DEFINE=	EXAMPLES LIBSIGSEGV
OPTIONS_SUB=	yes
LIBSIGSEGV_DESC=Use alternative page fault handler (GNU libsigsegv)

LIBSIGSEGV_CONFIGURE_WITH=	libsigsegv-prefix=${LOCALBASE}
LIBSIGSEGV_LIB_DEPENDS=	libsigsegv.so:devel/libsigsegv

post-patch:
	@${REINPLACE_CMD} -e '/^* M4: / s|M4|G&|' ${WRKSRC}/doc/m4.texi
	@${REINPLACE_CMD} -e '/^install-exec-am: / s| .*||' ${WRKSRC}/lib/Makefile.in

post-install-EXAMPLES-on:
	${MKDIR} ${STAGEDIR}${EXAMPLESDIR}/
	${INSTALL_DATA} ${WRKSRC}/examples/*.m4 ${STAGEDIR}${EXAMPLESDIR}/

.include <bsd.port.mk>
