# -*- 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

name                autoconf
epoch               1
version             2.73
categories          devel
# the license is GPL-3+ with an exception:
# https://www.gnu.org/licenses/autoconf-exception.html
platforms           any
supported_archs     noarch
license             {Autoconf GPL-3+}
maintainers         {larryv @larryv}

description         Automatically configures software for compilation
long_description    Autoconf is an extensible package of m4 macros \
                    that produce shell scripts to automatically \
                    configure software source code packages. These \
                    scripts can adapt the packages to many kinds of \
                    UNIX-like systems without manual user \
                    intervention. Autoconf creates a configuration \
                    script for a package from a template file that \
                    lists the operating system features that the \
                    package can use, in the form of m4 macro calls.
homepage            https://www.gnu.org/software/autoconf/

# The system m4 is quite outdated due to Apple's no GPLv3 policy, and
# seems to have an issue that causes an error when autoconf tries to
# print warnings. So we now always use the m4 port.
# https://savannah.gnu.org/support/index.php?110397
# https://trac.macports.org/ticket/62411
depends_lib         port:m4
installs_libs       no

master_sites        gnu
use_xz              yes
checksums           rmd160 561f8884585bb39e38797ed6a6fad802bcf29325 \
                    sha256 9fd672b1c8425fac2fa67fa0477b990987268b90ff36d5f016dae57be0d6b52e

patchfiles          use-macports-tools.patch
post-patch {
    # Stop build from trying to regenerate this after patching.
    touch ${worksrcpath}/man/autoreconf.1
}

if {${os.platform} eq "darwin"} {
    # It should be safe to use the system Perl, since the scripts only use
    # core modules. The README prescribes 5.6 or later, and Tiger has 5.8.6.
    configure.perl  /usr/bin/perl
} else {
    depends_build-append \
                    port:help2man \
                    port:perl5
    # https://trac.macports.org/ticket/70673
    configure.perl  ${prefix}/bin/perl5
}

test.run            yes
test.env            CC=${configure.cc}
test.target         check

livecheck.type      regex
livecheck.url       https://ftp.gnu.org/gnu/${name}/?C=M&O=D
livecheck.regex     ${name}-(\\d+\\.\\d+)
