# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem              1.0

# IMPORTANT
# On future version bumps, make sure you also revbump the libtool port
# Otherwise glibtoolize will provide an incompatible version of aclocal.m4
# from the older version of automake.
# cf: ${prefix}/share/libtool/aclocal.m4
name                    automake
version                 1.20

categories              devel
license                 GPL-3+
platforms               {darwin any}
supported_archs         noarch
homepage                https://www.gnu.org/software/automake
maintainers             {sethm.id.au:dev @McDaMastR} \
                        openmaintainer

description             The GNU utility for generating Makefile.in files
long_description        Automake is a tool for automatically generating \
                        Makefile.in files from files called Makefile.am.  Each \
                        Makefile.am is basically a series of make variable \
                        definitions, with rules being thrown in occasionally. \
                        The generated Makefile.in files are compliant with the \
                        GNU Makefile standards.

installs_libs           no

depends_build-append    port:autoconf

master_sites            gnu

checksums               rmd160  7747d1550bfea1cf1978cbf0f5a2bbd89cabf586 \
                        sha256  f6f34dad4cbe395715762b0710f7c511e39bd5cf777e6b95818ccbecf7714248 \
                        size    1694124

use_xz                  yes

patchfiles              test-glibtool.patch

configure.args          --disable-silent-rules

configure.checks.implicit_int \
                        no
# <https://trac.macports.org/wiki/WimplicitFunctionDeclaration>
configure.checks.implicit_function_declaration.whitelist-append \
                        alignof

# The test suite appears to include checks that automake is compatible
# with a wide variety of programs.  Hence to ensure the test suite gives
# consistent results, all these programs must be present in the system.
# But this would require so many test dependencies that it risks
# introducing circular dependencies (since automake is a common build
# dependency).  So just let the test suite skip checks with nonexistent
# programs and accept that `port test` will give different results on
# different systems.
test.run                yes
test.target             check

post-destroot {
    set destdocdir  ${destroot}${prefix}/share/doc/${name}

    xinstall -d ${destdocdir}
    xinstall -W ${worksrcpath} -m 644 \
        AUTHORS \
        COPYING \
        ChangeLog \
        HACKING \
        INSTALL \
        NEWS \
        README \
        THANKS \
        ${destdocdir}
}

if {${os.platform} eq "darwin"} {
    # It should be safe to use the system Perl, since Automake only uses
    # core modules.  The configure script requires 5.6 or later, and
    # Tiger has 5.8.6.  Though the script recommends 5.10 or later due
    # to higher resolution timestamps, which was first included in Snow
    # Leopard.  So if Mac OS X < 10.6 users report issues, remember to
    # check whether the perl version is the problem.
    configure.perl          /usr/bin/perl
} else {
    depends_lib-append      path:bin/perl5:perl5
    configure.perl          ${prefix}/bin/perl5
}

livecheck.type          regex
livecheck.url           https://ftp.gnu.org/gnu/${name}/
livecheck.regex         "${name}-(\[0-9]+(\\.\[0-9]+)*)\\.tar\\.gz"
