dev-qt/qtx11extras: stable 5.14.2 for ppc, bug #719732
[gentoo.git] / eclass / autotools.eclass
index 54e5d038af088365f30b36d3a7bc35607a24599a..625abd0e9d12e1bcd85464f3d35dbe7e92cecb2b 100644 (file)
@@ -1,10 +1,10 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
-# $Id$
 
 # @ECLASS: autotools.eclass
 # @MAINTAINER:
 # base-system@gentoo.org
+# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7
 # @BLURB: Regenerates auto* build scripts
 # @DESCRIPTION:
 # This eclass is for safely handling autotooled software packages that need to
@@ -26,6 +26,11 @@ fi
 if [[ -z ${_AUTOTOOLS_ECLASS} ]]; then
 _AUTOTOOLS_ECLASS=1
 
+case ${EAPI:-0} in
+       0|1|2|3|4|5|6|7) ;;
+       *) die "${ECLASS}: EAPI ${EAPI} not supported" ;;
+esac
+
 inherit libtool
 
 # @ECLASS-VARIABLE: WANT_AUTOCONF
@@ -47,16 +52,20 @@ inherit libtool
 # @INTERNAL
 # @DESCRIPTION:
 # CONSTANT!
-# The latest major version/slot of automake available on each arch.  #312315
-# We should list both the latest stable, and the latest unstable.  #465732
-# This way the stable builds will still work, but the unstable are allowed
-# to build & test things for us ahead of time (if they have it installed).
+# The latest major unstable and stable version/slot of automake available
+# on each arch.
+# List latest unstable version first to boost testing adoption rate because
+# most package manager dependency resolver will pick the first suitable
+# version.
 # If a newer slot is stable on any arch, and is NOT reflected in this list,
 # then circular dependencies may arise during emerge @system bootstraps.
+# 
+# See bug 312315 and 465732 for further information and context.
+# 
 # Do NOT change this variable in your ebuilds!
 # If you want to force a newer minor version, you can specify the correct
 # WANT value by using a colon:  <PV>:<WANT_AUTOMAKE>
-_LATEST_AUTOMAKE=( 1.15:1.15 )
+_LATEST_AUTOMAKE=( 1.16.1:1.16 1.15.1:1.15 )
 
 _automake_atom="sys-devel/automake"
 _autoconf_atom="sys-devel/autoconf"
@@ -100,10 +109,7 @@ if [[ -n ${WANT_LIBTOOL} ]] ; then
        export WANT_LIBTOOL
 fi
 
-# Force people (nicely) to upgrade to a newer version of gettext as
-# older ones are known to be crappy.  #496454
-AUTOTOOLS_DEPEND="!<sys-devel/gettext-0.18.1.1-r3
-       ${_automake_atom}
+AUTOTOOLS_DEPEND="${_automake_atom}
        ${_autoconf_atom}
        ${_libtool_atom}"
 RDEPEND=""
@@ -111,11 +117,14 @@ RDEPEND=""
 # @ECLASS-VARIABLE: AUTOTOOLS_AUTO_DEPEND
 # @DESCRIPTION:
 # Set to 'no' to disable automatically adding to DEPEND.  This lets
-# ebuilds former conditional depends by using ${AUTOTOOLS_DEPEND} in
+# ebuilds form conditional depends by using ${AUTOTOOLS_DEPEND} in
 # their own DEPEND string.
 : ${AUTOTOOLS_AUTO_DEPEND:=yes}
 if [[ ${AUTOTOOLS_AUTO_DEPEND} != "no" ]] ; then
-       DEPEND=${AUTOTOOLS_DEPEND}
+       case ${EAPI:-0} in
+               0|1|2|3|4|5|6) DEPEND=${AUTOTOOLS_DEPEND} ;;
+               7) BDEPEND=${AUTOTOOLS_DEPEND} ;;
+       esac
 fi
 __AUTOTOOLS_AUTO_DEPEND=${AUTOTOOLS_AUTO_DEPEND} # See top of eclass
 
@@ -198,7 +207,7 @@ eautoreconf() {
                intltool    false "autotools_run_tool intltoolize --automake --copy --force"
                gtkdoc      false "autotools_run_tool --at-missing gtkdocize --copy"
                gnomedoc    false "autotools_run_tool --at-missing gnome-doc-prepare --copy --force"
-               libtool     false "_elibtoolize --install --copy --force"
+               libtool     false "_elibtoolize --auto-ltdl --install --copy --force"
        )
        for (( i = 0; i < ${#tools[@]}; i += 3 )) ; do
                if _at_uses_${tools[i]} ; then
@@ -258,12 +267,13 @@ _at_uses_pkg() {
 }
 _at_uses_autoheader()  { _at_uses_pkg A{C,M}_CONFIG_HEADER{S,}; }
 _at_uses_automake()    { _at_uses_pkg AM_INIT_AUTOMAKE; }
-_at_uses_gettext()     { _at_uses_pkg AM_GNU_GETTEXT_VERSION; }
+_at_uses_gettext()     { _at_uses_pkg AM_GNU_GETTEXT_{,REQUIRE_}VERSION; }
 _at_uses_glibgettext() { _at_uses_pkg AM_GLIB_GNU_GETTEXT; }
 _at_uses_intltool()    { _at_uses_pkg {AC,IT}_PROG_INTLTOOL; }
 _at_uses_gtkdoc()      { _at_uses_pkg GTK_DOC_CHECK; }
 _at_uses_gnomedoc()    { _at_uses_pkg GNOME_DOC_INIT; }
 _at_uses_libtool()     { _at_uses_pkg A{C,M}_PROG_LIBTOOL LT_INIT; }
+_at_uses_libltdl()     { _at_uses_pkg LT_CONFIG_LTDL_DIR; }
 
 # @FUNCTION: eaclocal_amflags
 # @DESCRIPTION:
@@ -313,6 +323,11 @@ eaclocal() {
 _elibtoolize() {
        local LIBTOOLIZE=${LIBTOOLIZE:-$(type -P glibtoolize > /dev/null && echo glibtoolize || echo libtoolize)}
 
+       if [[ $1 == "--auto-ltdl" ]] ; then
+               shift
+               _at_uses_libltdl && set -- "$@" --ltdl
+       fi
+
        [[ -f GNUmakefile.am || -f Makefile.am ]] && set -- "$@" --automake
 
        autotools_run_tool ${LIBTOOLIZE} "$@"
@@ -433,9 +448,17 @@ autotools_env_setup() {
        if [[ ${WANT_AUTOMAKE} == "latest" ]]; then
                local pv
                for pv in ${_LATEST_AUTOMAKE[@]/#*:} ; do
-                       # has_version respects ROOT, but in this case, we don't want it to,
-                       # thus "ROOT=/" prefix:
-                       ROOT=/ has_version "=sys-devel/automake-${pv}*" && export WANT_AUTOMAKE="${pv}"
+                       # Break on first hit to respect _LATEST_AUTOMAKE order.
+                       local hv_args=""
+                       case ${EAPI:-0} in
+                               5|6)
+                                       hv_args="--host-root"
+                                       ;;
+                               7)
+                                       hv_args="-b"
+                                       ;;
+                       esac
+                       ROOT=/ has_version ${hv_args} "=sys-devel/automake-${pv}*" && export WANT_AUTOMAKE="${pv}" && break
                done
                [[ ${WANT_AUTOMAKE} == "latest" ]] && \
                        die "Cannot find the latest automake! Tried ${_LATEST_AUTOMAKE[*]}"
@@ -489,7 +512,7 @@ autotools_run_tool() {
        fi
 
        if ${m4flags} ; then
-               set -- "${1}" $(autotools_m4dir_include) "${@:2}" $(autotools_m4sysdir_include)
+               set -- "${1}" $(autotools_m4dir_include) $(autotools_m4sysdir_include) "${@:2}"
        fi
 
        # If the caller wants to probe something, then let them do it directly.
@@ -519,13 +542,13 @@ autotools_run_tool() {
 # Keep a list of all the macros we might use so that we only
 # have to run the trace code once.  Order doesn't matter.
 ALL_AUTOTOOLS_MACROS=(
-       A{C,M}_PROG_LIBTOOL LT_INIT
+       A{C,M}_PROG_LIBTOOL LT_INIT LT_CONFIG_LTDL_DIR
        A{C,M}_CONFIG_HEADER{S,}
        AC_CONFIG_SUBDIRS
        AC_CONFIG_AUX_DIR AC_CONFIG_MACRO_DIR
        AM_INIT_AUTOMAKE
        AM_GLIB_GNU_GETTEXT
-       AM_GNU_GETTEXT_VERSION
+       AM_GNU_GETTEXT_{,REQUIRE_}VERSION
        {AC,IT}_PROG_INTLTOOL
        GTK_DOC_CHECK
        GNOME_DOC_INIT