/[gentoo-x86]/eclass/autotools.eclass
Gentoo

Diff of /eclass/autotools.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.38 Revision 1.63
1# Copyright 1999-2005 Gentoo Foundation 1# Copyright 1999-2005 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/autotools.eclass,v 1.38 2006/06/28 00:15:32 flameeyes Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/autotools.eclass,v 1.63 2007/01/08 23:25:30 flameeyes Exp $
4# 4#
5# Author: Diego Pettenò <flameeyes@gentoo.org> 5# Author: Diego Pettenò <flameeyes@gentoo.org>
6# Enhancements: Martin Schlemmer <azarah@gentoo.org> 6# Enhancements: Martin Schlemmer <azarah@gentoo.org>
7# 7#
8# This eclass is for handling autotooled software packages that 8# This eclass is for handling autotooled software packages that
10# 10#
11# NB: If you add anything, please comment it! 11# NB: If you add anything, please comment it!
12 12
13inherit eutils libtool 13inherit eutils libtool
14 14
15DEPEND="sys-devel/automake 15[[ -z ${WANT_AUTOCONF} ]] && WANT_AUTOCONF="latest"
16 sys-devel/autoconf 16[[ -z ${WANT_AUTOMAKE} ]] && WANT_AUTOMAKE="latest"
17
18_automake_atom="sys-devel/automake"
19_autoconf_atom="sys-devel/autoconf"
20if [[ -n ${WANT_AUTOMAKE} ]]; then
21 case ${WANT_AUTOMAKE} in
22 # workaround while we have different versions of automake in arch and ~arch
23 none) _automake_atom="" ;; # some packages don't require automake at all
24 latest) _automake_atom="|| ( =sys-devel/automake-1.10* =sys-devel/automake-1.9* )" ;;
25 *) _automake_atom="=sys-devel/automake-${WANT_AUTOMAKE}*" ;;
26 esac
27fi
28
29if [[ -n ${WANT_AUTOCONF} ]] ; then
30 case ${WANT_AUTOCONF} in
31 2.1) _autoconf_atom="=sys-devel/autoconf-${WANT_AUTOCONF}*" ;;
32 latest | 2.5) _autoconf_atom=">=sys-devel/autoconf-2.59" ;;
33 esac
34fi
35DEPEND="${_automake_atom}
36 ${_autoconf_atom}
17 sys-devel/libtool" 37 sys-devel/libtool"
38RDEPEND=""
39unset _automake_atom _autoconf_atom
18 40
19# Variables: 41# Variables:
20# 42#
21# AT_M4DIR - Additional director(y|ies) aclocal should search 43# AT_M4DIR - Additional director(y|ies) aclocal should search
22# AM_OPTS - Additional options to pass to automake during 44# AM_OPTS - Additional options to pass to automake during
23# eautoreconf call. 45# eautoreconf call.
46# AT_NOELIBTOOLIZE - Don't run elibtoolize command if set to 'yes',
47# useful when elibtoolize needs to be ran with
48# particular options
24 49
25# Functions: 50# Functions:
26# 51#
27# eautoreconf() - Should do a full autoreconf - normally what most people 52# eautoreconf() - Should do a full autoreconf - normally what most people
28# will be interested in. Also should handle additional 53# will be interested in. Also should handle additional
45# eauto* functions to run the tools. It doesn't accept parameters, but 70# eauto* functions to run the tools. It doesn't accept parameters, but
46# the directory with include files can be specified with AT_M4DIR variable. 71# the directory with include files can be specified with AT_M4DIR variable.
47eautoreconf() { 72eautoreconf() {
48 local pwd=$(pwd) x auxdir 73 local pwd=$(pwd) x auxdir
49 74
75 if [[ -z ${AT_NO_RECURSIVE} ]]; then
50 # Take care of subdirs 76 # Take care of subdirs
51 for x in $(autotools_get_subdirs); do 77 for x in $(autotools_get_subdirs); do
52 if [[ -d ${x} ]] ; then 78 if [[ -d ${x} ]] ; then
53 cd "${x}" 79 cd "${x}"
54 AT_NOELIBTOOLIZE="yes" eautoreconf 80 AT_NOELIBTOOLIZE="yes" eautoreconf
55 cd "${pwd}" 81 cd "${pwd}"
56 fi 82 fi
57 done 83 done
84 fi
58 85
59 auxdir=$(autotools_get_auxdir) 86 auxdir=$(autotools_get_auxdir)
60 87
61 einfo "Running eautoreconf in '$(pwd)' ..." 88 einfo "Running eautoreconf in '$(pwd)' ..."
62 [[ -n ${auxdir} ]] && mkdir -p ${auxdir} 89 [[ -n ${auxdir} ]] && mkdir -p ${auxdir}
94 ;; 121 ;;
95 esac 122 esac
96 done 123 done
97 fi 124 fi
98 125
126 autotools_set_versions
99 [[ ! -f aclocal.m4 || -n $(grep -e 'generated.*by aclocal' aclocal.m4) ]] && \ 127 [[ ! -f aclocal.m4 || -n $(grep -e 'generated.*by aclocal' aclocal.m4) ]] && \
100 autotools_run_tool aclocal "$@" ${aclocal_opts} 128 autotools_run_tool aclocal "$@" ${aclocal_opts}
101} 129}
102 130
103_elibtoolize() { 131_elibtoolize() {
119} 147}
120 148
121eautoheader() { 149eautoheader() {
122 # Check if we should run autoheader 150 # Check if we should run autoheader
123 [[ -n $(autotools_check_macro "AC_CONFIG_HEADERS") ]] || return 0 151 [[ -n $(autotools_check_macro "AC_CONFIG_HEADERS") ]] || return 0
152 autotools_set_versions
124 autotools_run_tool autoheader "$@" 153 NO_FAIL=1 autotools_run_tool autoheader "$@"
125} 154}
126 155
127eautoconf() { 156eautoconf() {
128 if [[ ! -f configure.ac && ! -f configure.in ]] ; then 157 if [[ ! -f configure.ac && ! -f configure.in ]] ; then
129 echo 158 echo
130 eerror "No configure.{ac,in} present in '$(pwd | sed -e 's:.*/::')'!" 159 eerror "No configure.{ac,in} present in '$(pwd | sed -e 's:.*/::')'!"
131 echo 160 echo
132 die "No configure.{ac,in} present!" 161 die "No configure.{ac,in} present!"
133 fi 162 fi
134 163
164 autotools_set_versions
135 autotools_run_tool autoconf "$@" 165 autotools_run_tool autoconf "$@"
136} 166}
137 167
138eautomake() { 168eautomake() {
139 local extra_opts 169 local extra_opts
140 170
141 [[ -f Makefile.am ]] || return 0 171 [[ -f Makefile.am ]] || return 0
142 172
173 autotools_set_versions
143 if [[ -z ${FROM_EAUTORECONF} && -f Makefile.in ]]; then 174 if [[ -z ${FROM_EAUTORECONF} && -f Makefile.in ]]; then
144 local used_automake 175 local used_automake
145 local installed_automake 176 local installed_automake
146 177
147 installed_automake=$(automake --version | head -n 1 | \ 178 installed_automake=$(automake --version | head -n 1 | \
162 193
163 # --force-missing seems not to be recognized by some flavours of automake 194 # --force-missing seems not to be recognized by some flavours of automake
164 autotools_run_tool automake --add-missing --copy ${extra_opts} "$@" 195 autotools_run_tool automake --add-missing --copy ${extra_opts} "$@"
165} 196}
166 197
198autotools_set_versions() {
199 [[ -n ${autotools_version_sets} ]] && return 0
167 200
201 if [[ -n ${WANT_AUTOCONF} ]]; then
202 [[ ${WANT_AUTOCONF} == "latest" ]] && WANT_AUTOCONF="2.5"
203 export WANT_AUTOCONF
204 einfo "Requested autoconf ${WANT_AUTOCONF}"
205 einfo "Using $(autoconf --version 2>/dev/null | head -n 1)"
206 einfo "Using $(autoheader --version 2>/dev/null | head -n 1)"
207 else
208 ewarn "QA Notice: \${WANT_AUTOCONF} variable unset. Please report on http://bugs.gentoo.org/"
209 fi
210
211 if [[ -n ${WANT_AUTOMAKE} ]]; then
212 local latest_automake
213 if [[ ${WANT_AUTOMAKE} == "latest" ]]; then
214 latest_automake="latest: "
215 for amver in 1.10 1.9 1.8 1.7 1.6; do
216 WANT_AUTOMAKE="${amver}"
217 ROOT=/ has_version =sys-devel/automake-${amver}* && break
218 done
219 fi
220
221 # Don't do stuff if no autoamke is requested/required
222 if [[ ${WANT_AUTOMAKE} != "none" ]]; then
223 export WANT_AUTOMAKE
224 einfo "Requested automake ${latest_automake}${WANT_AUTOMAKE}"
225 einfo "Using $(automake --version 2>/dev/null | head -n 1)"
226 einfo "Using $(aclocal --version 2>/dev/null | head -n 1)"
227 fi
228 else
229 ewarn "QA Notice: \${WANT_AUTOMAKE} variable unset. Please report on http://bugs.gentoo.org/"
230 fi
231
232 autotools_version_sets="yes"
233}
168 234
169# Internal function to run an autotools' tool 235# Internal function to run an autotools' tool
170autotools_run_tool() { 236autotools_run_tool() {
171 local STDERR_TARGET="${T}/$$.out" 237 local STDERR_TARGET="${T}/$$.out"
172 local PATCH_TARGET="${T}/$$.patch"
173 local ris 238 local ris
174 239
175 echo "***** $1 *****" > ${STDERR_TARGET%/*}/$1-${STDERR_TARGET##*/} 240 echo "***** $1 *****" > ${STDERR_TARGET%/*}/$1-${STDERR_TARGET##*/}
176 echo >> ${STDERR_TARGET%/*}/$1-${STDERR_TARGET##*/} 241 echo >> ${STDERR_TARGET%/*}/$1-${STDERR_TARGET##*/}
177 242
178 ebegin "Running $@" 243 ebegin "Running $@"
179 $@ >> ${STDERR_TARGET%/*}/$1-${STDERR_TARGET##*/} 2>&1 244 $@ >> ${STDERR_TARGET%/*}/$1-${STDERR_TARGET##*/} 2>&1
180 ris=$? 245 ris=$?
181 eend ${ris} 246 eend ${ris}
182 247
183 if [[ ${ris} != 0 ]]; then 248 if [[ ${ris} != 0 && ${NO_FAIL} != 1 ]]; then
184 echo 249 echo
185 eerror "Failed Running $1 !" 250 eerror "Failed Running $1 !"
186 eerror 251 eerror
187 eerror "Include in your bugreport the contents of:" 252 eerror "Include in your bugreport the contents of:"
188 eerror 253 eerror

Legend:
Removed from v.1.38  
changed lines
  Added in v.1.63

  ViewVC Help
Powered by ViewVC 1.1.20