From 40974c0b9210ac51393be04db42e8eda74d5fe14 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sun, 23 May 2010 22:52:41 +0000 Subject: run automake if the configure script requests it via AM_INIT_AUTOMAKE even if there are no .am files #311439 --- eclass/autotools.eclass | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'eclass') diff --git a/eclass/autotools.eclass b/eclass/autotools.eclass index 8e99488c42af..384bacca98cb 100644 --- a/eclass/autotools.eclass +++ b/eclass/autotools.eclass @@ -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 -- cgit v1.2.3-65-gdbad