# -*- 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.72
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 638048a3974ef7940407b785bdba9a08816b850f \
                    sha256 ba885c1319578d6c94d46e9b0dceb4014caafe2490e437a0dbca3f270a223f5a

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+)
