[06/20] autotools-autoreconf: Support project with multiple configure.ac (submodules)

Submitted by Yann Diorcet on Aug. 6, 2014, 7:16 p.m.

Details

Message ID 1407352611-7652-6-git-send-email-diorcet.yann@gmail.com
State New
Delegated to: Esben Haabendal
Headers show

Commit Message

Yann Diorcet Aug. 6, 2014, 7:16 p.m.
---
 classes/autotools-autoreconf.oeclass | 108 ++++++++++++++++++-----------------
 1 file changed, 55 insertions(+), 53 deletions(-)

Patch hide | download patch | download mbox

diff --git a/classes/autotools-autoreconf.oeclass b/classes/autotools-autoreconf.oeclass
index d480e96..4f66886 100644
--- a/classes/autotools-autoreconf.oeclass
+++ b/classes/autotools-autoreconf.oeclass
@@ -27,69 +27,71 @@  export LIBTOOLIZE = "${HOST_PREFIX}libtoolize"
 
 do_autoreconf () {
 
-    for ac in `find ${S} -name configure.in -o -name configure.ac`; do
-        rm -f `dirname $ac`/configure
-    done
-
-    if [ -e ${S}/configure.in -o -e ${S}/configure.ac ]; then
-        if [ "${acpaths}" = "__default__" ]; then
-            acpaths=
-            for i in `find ${S} -maxdepth 2 -name \*.m4|grep -v 'aclocal.m4'| \
-                grep -v 'acinclude.m4' | sed -e 's,\(.*/\).*$,\1,'|sort -u`
-            do
-                acpaths="$acpaths -I $i"
-            done
-        else
-            acpaths="${acpaths}"
-        fi
+    for ac in `find ${S} -name '.*' -prune -o -name configure.in -print -o -name configure.ac -print`; do
+        pushd `dirname $ac`
+        rm -f configure
+
+        if [ -e configure.in -o -e configure.ac ]; then
+            if [ "${acpaths}" = "__default__" ]; then
+                acpaths=
+                for i in `find ${S} -maxdepth 2 -name \*.m4|grep -v 'aclocal.m4'| \
+                    grep -v 'acinclude.m4' | sed -e 's,\(.*/\).*$,\1,'|sort -u`
+                do
+                    acpaths="$acpaths -I $i"
+                done
+            else
+                acpaths="${acpaths}"
+            fi
 
-        install -d ${TARGET_SYSROOT}${datadir}/aclocal
-        acpaths="$acpaths -I${TARGET_SYSROOT}${datadir}/aclocal"
-        install -d ${STAGE_DIR}/${HOST_CROSS}${stage_datadir}/aclocal
-        acpaths="$acpaths -I${STAGE_DIR}/${HOST_CROSS}${stage_datadir}/aclocal"
-        oenote acpaths=$acpaths
+            install -d ${TARGET_SYSROOT}${datadir}/aclocal
+            acpaths="$acpaths -I${TARGET_SYSROOT}${datadir}/aclocal"
+            install -d ${STAGE_DIR}/${HOST_CROSS}${stage_datadir}/aclocal
+            acpaths="$acpaths -I${STAGE_DIR}/${HOST_CROSS}${stage_datadir}/aclocal"
+            oenote acpaths=$acpaths
         export ACLOCAL="aclocal $acpaths"
 
-        # autoreconf is too shy to overwrite aclocal.m4 if it doesn't look
-        # like it was auto-generated.  Work around this by blowing it away
-        # by hand, unless the package specifically asked not to run aclocal.
-        if ! echo ${EXTRA_AUTORECONF} | grep -q "aclocal"; then
-            rm -f aclocal.m4
-        fi
-
-        if [ -e configure.in ]; then
-            CONFIGURE_AC=configure.in
-        else
-            CONFIGURE_AC=configure.ac
-        fi
+            # autoreconf is too shy to overwrite aclocal.m4 if it doesn't look
+            # like it was auto-generated.  Work around this by blowing it away
+            # by hand, unless the package specifically asked not to run aclocal.
+            if ! echo ${EXTRA_AUTORECONF} | grep -q "aclocal"; then
+                rm -f aclocal.m4
+            fi
 
-        if grep "^[[:space:]]*AM_GLIB_GNU_GETTEXT" $CONFIGURE_AC >/dev/null; then
-            if grep "sed.*POTFILES" $CONFIGURE_AC >/dev/null; then
-                : do nothing -- we still have an old unmodified configure.ac
+            if [ -e configure.in ]; then
+                CONFIGURE_AC=configure.in
             else
-                oenote Executing glib-gettextize --force --copy
-                echo "no" | sysroot=${BUILD_SYSROOT} glib-gettextize --force --copy
+                CONFIGURE_AC=configure.ac
             fi
-        elif grep "^[[:space:]]*AM_GNU_GETTEXT" $CONFIGURE_AC >/dev/null; then
-            if [ -e ${TARGET_SYSROOT}${datadir}/gettext/config.rpath ]; then
-                cp ${TARGET_SYSROOT}${datadir}/gettext/config.rpath ${S}/
-            else
-                oenote config.rpath not found. gettext is not installed.
+
+            if grep "^[[:space:]]*AM_GLIB_GNU_GETTEXT" $CONFIGURE_AC >/dev/null; then
+                if grep "sed.*POTFILES" $CONFIGURE_AC >/dev/null; then
+                    : do nothing -- we still have an old unmodified configure.ac
+                else
+                    oenote Executing glib-gettextize --force --copy
+                    echo "no" | sysroot=${BUILD_SYSROOT} glib-gettextize --force --copy
+                fi
+            elif grep "^[[:space:]]*AM_GNU_GETTEXT" $CONFIGURE_AC >/dev/null; then
+                if [ -e ${TARGET_SYSROOT}${datadir}/gettext/config.rpath ]; then
+                    cp ${TARGET_SYSROOT}${datadir}/gettext/config.rpath ${S}/
+                else
+                    oenote config.rpath not found. gettext is not installed.
+                fi
             fi
-        fi
 
-        mkdir -p m4
+            mkdir -p m4
 
-        if [ -d "${pkgltdldir}" ] ; then
-            export _lt_pkgdatadir="${pkgltdldir}"
-        fi
-        oenote Executing autoreconf
-        eval "${AUTORECONF_CMD}" || oefatal 'autoreconf execution failed.'
-        if grep "^[[:space:]]*[AI][CT]_PROG_INTLTOOL" $CONFIGURE_AC >/dev/null; then
-            oenote Executing intltoolize
-            intltoolize --copy --force --automake
+            if [ -d "${pkgltdldir}" ] ; then
+                export _lt_pkgdatadir="${pkgltdldir}"
+            fi
+            oenote Executing autoreconf
+            eval "${AUTORECONF_CMD}" || oefatal 'autoreconf execution failed.'
+            if grep "^[[:space:]]*[AI][CT]_PROG_INTLTOOL" $CONFIGURE_AC >/dev/null; then
+                oenote Executing intltoolize
+                intltoolize --copy --force --automake
+            fi
         fi
-    fi
+        popd
+    done
 }
 
 # Local Variables: