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

Diff of /eclass/autotools.eclass

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

Revision 1.138 Revision 1.139
1# Copyright 1999-2012 Gentoo Foundation 1# Copyright 1999-2012 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.138 2012/05/20 13:01:22 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/autotools.eclass,v 1.139 2012/05/21 17:40:44 vapier Exp $
4 4
5# @ECLASS: autotools.eclass 5# @ECLASS: autotools.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# base-system@gentoo.org 7# base-system@gentoo.org
8# @BLURB: Regenerates auto* build scripts 8# @BLURB: Regenerates auto* build scripts
160 einfo "Running eautoreconf in '${PWD}' ..." 160 einfo "Running eautoreconf in '${PWD}' ..."
161 161
162 local m4dirs=$(autotools_check_macro_val AC_CONFIG_{AUX,MACRO}_DIR) 162 local m4dirs=$(autotools_check_macro_val AC_CONFIG_{AUX,MACRO}_DIR)
163 [[ -n ${m4dirs} ]] && mkdir -p ${m4dirs} 163 [[ -n ${m4dirs} ]] && mkdir -p ${m4dirs}
164 164
165 # Run all the tools before aclocal so we can gather the .m4 files.
166 local i tools=(
167 # <tool> <was run> <command>
168 gettext false "eautopoint --force"
169 libtool false "_elibtoolize --install --copy --force"
170 )
171 for (( i = 0; i < ${#tools[@]}; i += 3 )) ; do
172 if _at_uses_${tools[i]} ; then
173 tools[i+1]=true
174 ${tools[i+2]}
175 fi
176 done
177
178 # Generate aclocal.m4 with our up-to-date m4 files.
179 local rerun_aclocal=false
165 eaclocal 180 eaclocal
166 if grep -q '^AM_GNU_GETTEXT_VERSION' configure.?? ; then 181
167 eautopoint --force 182 # Check to see if we had macros expanded by other macros or in other
183 # m4 files that we couldn't detect early. This is uncommon, but some
184 # packages do this, so we have to handle it correctly.
185 for (( i = 0; i < ${#tools[@]}; i += 3 )) ; do
186 if ! ${tools[i+1]} && _at_uses_${tools[i]} ; then
187 ${tools[i+2]}
188 rerun_aclocal=true
168 fi 189 fi
169 _elibtoolize --install --copy --force 190 done
191 ${rerun_aclocal} && eaclocal
192
170 eautoconf 193 eautoconf
171 eautoheader 194 eautoheader
172 [[ ${AT_NOEAUTOMAKE} != "yes" ]] && FROM_EAUTORECONF="yes" eautomake ${AM_OPTS} 195 [[ ${AT_NOEAUTOMAKE} != "yes" ]] && FROM_EAUTORECONF="yes" eautomake ${AM_OPTS}
173 196
174 [[ ${AT_NOELIBTOOLIZE} == "yes" ]] && return 0 197 [[ ${AT_NOELIBTOOLIZE} == "yes" ]] && return 0
177 # eautoreconf. We set $S because elibtoolize runs on that #265319 200 # eautoreconf. We set $S because elibtoolize runs on that #265319
178 S=${PWD} elibtoolize --force 201 S=${PWD} elibtoolize --force
179 202
180 return 0 203 return 0
181} 204}
205
206# @FUNCTION: _at_uses_pkg
207# @USAGE: <macros>
208# @INTERNAL
209# See if the specified macros are enabled.
210_at_uses_pkg() {
211 if [[ -e aclocal.m4 ]] ; then
212 # If aclocal.m4 exists, trust the trace data.
213 [[ -n $(autotools_check_macro "${@}") ]]
214 else
215 # If aclocal.m4 hasn't been generated yet, cheat, but be conservative.
216 local macro args=()
217 for macro ; do
218 args+=( -e "^[[:space:]]*${macro}\>" )
219 done
220 egrep -q "${args[@]}" configure.??
221 fi
222}
223_at_uses_gettext() { _at_uses_pkg AM_GNU_GETTEXT_VERSION; }
224_at_uses_autoheader() { _at_uses_pkg AC_CONFIG_HEADERS; }
225_at_uses_automake() { _at_uses_pkg AM_INIT_AUTOMAKE; }
226_at_uses_libtool() { _at_uses_pkg A{C,M}_PROG_LIBTOOL LT_INIT; }
182 227
183# @FUNCTION: eaclocal_amflags 228# @FUNCTION: eaclocal_amflags
184# @DESCRIPTION: 229# @DESCRIPTION:
185# Extract the ACLOCAL_AMFLAGS value from the Makefile.am and try to handle 230# Extract the ACLOCAL_AMFLAGS value from the Makefile.am and try to handle
186# (most) of the crazy crap that people throw at us. 231# (most) of the crazy crap that people throw at us.
225# Runs libtoolize. If --install is the first arg, automatically drop it if 270# Runs libtoolize. If --install is the first arg, automatically drop it if
226# the active libtool version doesn't support it. 271# the active libtool version doesn't support it.
227# 272#
228# Note the '_' prefix .. to not collide with elibtoolize() from libtool.eclass. 273# Note the '_' prefix .. to not collide with elibtoolize() from libtool.eclass.
229_elibtoolize() { 274_elibtoolize() {
230 # Check if we should run libtoolize (AM_PROG_LIBTOOL is an older macro,
231 # check for both it and the current AC_PROG_LIBTOOL)
232 [[ -n $(autotools_check_macro AC_PROG_LIBTOOL AM_PROG_LIBTOOL LT_INIT) ]] || return 0
233
234 local LIBTOOLIZE=${LIBTOOLIZE:-libtoolize} 275 local LIBTOOLIZE=${LIBTOOLIZE:-libtoolize}
235 type -P glibtoolize && LIBTOOLIZE=glibtoolize 276 type -P glibtoolize && LIBTOOLIZE=glibtoolize
236 277
237 [[ -f GNUmakefile.am || -f Makefile.am ]] && set -- "$@" --automake 278 [[ -f GNUmakefile.am || -f Makefile.am ]] && set -- "$@" --automake
238 if [[ $1 == "--install" ]] ; then 279 if [[ $1 == "--install" ]] ; then
239 ${LIBTOOLIZE} -n --install >& /dev/null || shift 280 ${LIBTOOLIZE} -n --install >& /dev/null || shift
240 fi 281 fi
241 282
242 autotools_run_tool ${LIBTOOLIZE} "$@" ${opts} 283 autotools_run_tool ${LIBTOOLIZE} "$@" ${opts}
243
244 # Need to rerun aclocal
245 eaclocal
246} 284}
247 285
248# @FUNCTION: eautoheader 286# @FUNCTION: eautoheader
249# @DESCRIPTION: 287# @DESCRIPTION:
250# Runs autoheader. 288# Runs autoheader.
251eautoheader() { 289eautoheader() {
252 # Check if we should run autoheader 290 _at_uses_autoheader || return 0
253 [[ -n $(autotools_check_macro "AC_CONFIG_HEADERS") ]] || return 0
254 autotools_run_tool --at-no-fail --at-m4flags autoheader "$@" 291 autotools_run_tool --at-no-fail --at-m4flags autoheader "$@"
255} 292}
256 293
257# @FUNCTION: eautoconf 294# @FUNCTION: eautoconf
258# @DESCRIPTION: 295# @DESCRIPTION:
281 for makefile_name in {GNUmakefile,{M,m}akefile}.am "" ; do 318 for makefile_name in {GNUmakefile,{M,m}akefile}.am "" ; do
282 [[ -f ${makefile_name} ]] && break 319 [[ -f ${makefile_name} ]] && break
283 done 320 done
284 321
285 if [[ -z ${makefile_name} ]] ; then 322 if [[ -z ${makefile_name} ]] ; then
286 [[ -n $(autotools_check_macro AM_INIT_AUTOMAKE) ]] || return 0 323 _at_uses_automake || return 0
287 324
288 elif [[ -z ${FROM_EAUTORECONF} && -f ${makefile_name%.am}.in ]]; then 325 elif [[ -z ${FROM_EAUTORECONF} && -f ${makefile_name%.am}.in ]]; then
289 local used_automake 326 local used_automake
290 local installed_automake 327 local installed_automake
291 328
420 AC_PROG_LIBTOOL AM_PROG_LIBTOOL LT_INIT 457 AC_PROG_LIBTOOL AM_PROG_LIBTOOL LT_INIT
421 AC_CONFIG_HEADERS 458 AC_CONFIG_HEADERS
422 AC_CONFIG_SUBDIRS 459 AC_CONFIG_SUBDIRS
423 AC_CONFIG_AUX_DIR AC_CONFIG_MACRO_DIR 460 AC_CONFIG_AUX_DIR AC_CONFIG_MACRO_DIR
424 AM_INIT_AUTOMAKE 461 AM_INIT_AUTOMAKE
462 AM_GNU_GETTEXT_VERSION
425) 463)
426autotools_check_macro() { 464autotools_check_macro() {
427 [[ -f configure.ac || -f configure.in ]] || return 0 465 [[ -f configure.ac || -f configure.in ]] || return 0
428 466
429 # We can run in multiple dirs, so we have to cache the trace 467 # We can run in multiple dirs, so we have to cache the trace

Legend:
Removed from v.1.138  
changed lines
  Added in v.1.139

  ViewVC Help
Powered by ViewVC 1.1.20