# $Id: Portfile 49187 2009-04-05 05:58:02Z blb@macports.org $

PortSystem		1.0

name            m4
version         1.4.13
categories      devel
maintainers     blair openmaintainer
platforms       darwin
description     GNU macro processor

long_description \
    GNU `m4' is an implementation of the traditional Unix macro         \
    processor.  It is mostly SVR4 compatible, although it has some      \
    extensions (for example, handling more than 9 positional parameters \
    to macros). `m4' also has built-in functions for including files,   \
    running shell commands, doing arithmetic, etc. Autoconf needs GNU   \
    `m4' for generating `configure' scripts, but not for running them.

homepage        http://www.gnu.org/software/m4/
master_sites    gnu
use_bzip2       yes

checksums       md5     28f9ccd3ac4da45409251008b911d677 \
                sha1    7ba1834ebf96d0520d526c1c9f5764cc869a9f42 \
                rmd160  36d624b8a0f27bbf239bb92548d812d879c1039a

patchfiles      patch-test-c-stack2.sh.diff

configure.args  --program-prefix=g \
                gl_cv_lib_sigsegv=no

use_parallel_build  yes

post-destroot {
    move ${destroot}${prefix}/share/info/m4.info ${destroot}${prefix}/share/info/gm4.info

	set docdir ${prefix}/share/doc/${name}-${version}
	xinstall -d ${destroot}${docdir}
	xinstall -m 0644 -W ${worksrcpath} AUTHORS COPYING ChangeLog NEWS README THANKS \
		TODO ${destroot}${docdir}
}

test.run        yes
test.target     check
test.env        TMPDIR=/tmp

variant with_default_names description {Install files without 'g' prefix} {
    post-destroot {
        foreach {d} {bin share/man/man1} {
            foreach {f} [glob -tails -directory ${destroot}${prefix}/${d} g*] {
                ln -sf ${prefix}/${d}/${f} ${destroot}${prefix}/${d}/[string range ${f} 1 end]
            }
        }
    }
}

livecheck.check regex
livecheck.url   http://ftp.gnu.org/gnu/${name}/?C=M&O=D
livecheck.regex ${name}-(\\d+(?:\\.\\d+)*)\\.tar\\.bz2
