# $Id: Portfile 64738 2010-03-15 13:14:05Z nox@macports.org $

PortSystem		1.0

name            m4
version         1.4.14
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     e6fb7d08d50d87e796069cff12a52a93 \
                sha1    f2df9a3db6bb3974f06e5cefe04b9ce3f4bf8b82 \
                rmd160  d4145f84b629772d9e5bd8fd893f3633d26071a9

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]
            }
        }
    }
}
