run automake if the configure script requests it via AM_INIT_AUTOMAKE even if there...
authorMike Frysinger <vapier@gentoo.org>
Sun, 23 May 2010 22:52:41 +0000 (22:52 +0000)
committerMike Frysinger <vapier@gentoo.org>
Sun, 23 May 2010 22:52:41 +0000 (22:52 +0000)
eclass/autotools.eclass

index 8e99488c42afa3b7af461a8aac33da185f369b0c..384bacca98cb0edcf8c60dd8bab350e0264bd597 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright 1999-2010 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/autotools.eclass,v 1.97 2010/04/01 21:42:37 robbat2 Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/autotools.eclass,v 1.98 2010/05/23 22:52:41 vapier Exp $
 
 # @ECLASS: autotools.eclass
 # @MAINTAINER:
@@ -231,21 +231,27 @@ eautomake() {
        local extra_opts
        local makefile_name
 
-       if [[ -f GNUmakefile.am ]]; then
-               makefile_name="GNUmakefile"
-       elif [[ -f Makefile.am ]]; then
-               makefile_name="Makefile"
-       else
-               return 0
-       fi
+       # Run automake if:
+       #  - a Makefile.am type file exists
+       #  - a Makefile.in type file exists and the configure
+       #    script is using the AM_INIT_AUTOMAKE directive
+       for makefile_name in {GNUmakefile,{M,m}akefile}.{am,in} "" ; do
+               [[ -f ${makefile_name} ]] && break
+       done
+       [[ -z ${makefile_name} ]] && return 0
+
+       if [[ ${makefile_name} == *.in ]] ; then
+               if ! grep -qs AM_INIT_AUTOMAKE configure.?? ; then
+                       return 0
+               fi
 
-       if [[ -z ${FROM_EAUTORECONF} && -f ${makefile_name}.in ]]; then
+       elif [[ -z ${FROM_EAUTORECONF} && -f ${makefile_name%.am}.in ]]; then
                local used_automake
                local installed_automake
 
                installed_automake=$(WANT_AUTOMAKE= automake --version | head -n 1 | \
                        sed -e 's:.*(GNU automake) ::')
-               used_automake=$(head -n 1 < ${makefile_name}.in | \
+               used_automake=$(head -n 1 < ${makefile_name%.am}.in | \
                        sed -e 's:.*by automake \(.*\) from .*:\1:')
 
                if [[ ${installed_automake} != ${used_automake} ]]; then