| 1 | # Copyright 1999-2011 Gentoo Foundation |
1 | # Copyright 1999-2011 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.114 2011/12/14 18:33:59 vapier Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/autotools.eclass,v 1.115 2011/12/14 19:15:13 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 |
| … | |
… | |
| 199 | # without e prefix. |
199 | # without e prefix. |
| 200 | # They also force installing the support files for safety. |
200 | # They also force installing the support files for safety. |
| 201 | # Respects AT_M4DIR for additional directories to search for macro's. |
201 | # Respects AT_M4DIR for additional directories to search for macro's. |
| 202 | eaclocal() { |
202 | eaclocal() { |
| 203 | [[ ! -f aclocal.m4 || -n $(grep -e 'generated.*by aclocal' aclocal.m4) ]] && \ |
203 | [[ ! -f aclocal.m4 || -n $(grep -e 'generated.*by aclocal' aclocal.m4) ]] && \ |
| 204 | autotools_run_tool aclocal $(autotools_m4dir_include) "$@" $(eaclocal_amflags) |
204 | autotools_run_tool --at-m4flags aclocal "$@" $(eaclocal_amflags) |
| 205 | } |
205 | } |
| 206 | |
206 | |
| 207 | # @FUNCTION: _elibtoolize |
207 | # @FUNCTION: _elibtoolize |
| 208 | # @DESCRIPTION: |
208 | # @DESCRIPTION: |
| 209 | # Runs libtoolize. Note the '_' prefix .. to not collide with elibtoolize() from |
209 | # Runs libtoolize. Note the '_' prefix .. to not collide with elibtoolize() from |
| … | |
… | |
| 228 | # @DESCRIPTION: |
228 | # @DESCRIPTION: |
| 229 | # Runs autoheader. |
229 | # Runs autoheader. |
| 230 | eautoheader() { |
230 | eautoheader() { |
| 231 | # Check if we should run autoheader |
231 | # Check if we should run autoheader |
| 232 | [[ -n $(autotools_check_macro "AC_CONFIG_HEADERS") ]] || return 0 |
232 | [[ -n $(autotools_check_macro "AC_CONFIG_HEADERS") ]] || return 0 |
| 233 | NO_FAIL=1 autotools_run_tool autoheader $(autotools_m4dir_include) "$@" |
233 | autotools_run_tool --at-no-fail --at-m4flags autoheader "$@" |
| 234 | } |
234 | } |
| 235 | |
235 | |
| 236 | # @FUNCTION: eautoconf |
236 | # @FUNCTION: eautoconf |
| 237 | # @DESCRIPTION: |
237 | # @DESCRIPTION: |
| 238 | # Runs autoconf. |
238 | # Runs autoconf. |
| … | |
… | |
| 242 | eerror "No configure.{ac,in} present in '${PWD}'!" |
242 | eerror "No configure.{ac,in} present in '${PWD}'!" |
| 243 | echo |
243 | echo |
| 244 | die "No configure.{ac,in} present!" |
244 | die "No configure.{ac,in} present!" |
| 245 | fi |
245 | fi |
| 246 | |
246 | |
| 247 | autotools_run_tool autoconf $(autotools_m4dir_include) "$@" |
247 | autotools_run_tool --at-m4flags autoconf "$@" |
| 248 | } |
248 | } |
| 249 | |
249 | |
| 250 | # @FUNCTION: eautomake |
250 | # @FUNCTION: eautomake |
| 251 | # @DESCRIPTION: |
251 | # @DESCRIPTION: |
| 252 | # Runs automake. |
252 | # Runs automake. |
| … | |
… | |
| 318 | autotools_run_tool() { |
318 | autotools_run_tool() { |
| 319 | if [[ ${EBUILD_PHASE} != "unpack" && ${EBUILD_PHASE} != "prepare" ]]; then |
319 | if [[ ${EBUILD_PHASE} != "unpack" && ${EBUILD_PHASE} != "prepare" ]]; then |
| 320 | ewarn "QA Warning: running $1 in ${EBUILD_PHASE} phase" |
320 | ewarn "QA Warning: running $1 in ${EBUILD_PHASE} phase" |
| 321 | fi |
321 | fi |
| 322 | |
322 | |
|
|
323 | # Process our own internal flags first |
|
|
324 | local autofail=true m4flags=false |
|
|
325 | while [[ -n $1 ]] ; do |
|
|
326 | case $1 in |
|
|
327 | --at-no-fail) autofail=false;; |
|
|
328 | --at-m4flags) m4flags=true;; |
|
|
329 | # whatever is left goes to the actual tool |
|
|
330 | *) break;; |
|
|
331 | esac |
|
|
332 | shift |
|
|
333 | done |
|
|
334 | |
| 323 | autotools_env_setup |
335 | autotools_env_setup |
| 324 | |
336 | |
| 325 | local STDERR_TARGET="${T}/$1.out" |
337 | local STDERR_TARGET="${T}/$1.out" |
| 326 | # most of the time, there will only be one run, but if there are |
338 | # most of the time, there will only be one run, but if there are |
| 327 | # more, make sure we get unique log filenames |
339 | # more, make sure we get unique log filenames |
| … | |
… | |
| 332 | [[ -e ${STDERR_TARGET} ]] || break |
344 | [[ -e ${STDERR_TARGET} ]] || break |
| 333 | : $(( i++ )) |
345 | : $(( i++ )) |
| 334 | done |
346 | done |
| 335 | fi |
347 | fi |
| 336 | |
348 | |
|
|
349 | if ${m4flags} ; then |
|
|
350 | set -- $(autotools_m4dir_include) "$@" $(autotools_m4sysdir_include) |
|
|
351 | fi |
|
|
352 | |
| 337 | printf "***** $1 *****\n***** PWD: ${PWD}\n***** $*\n\n" > "${STDERR_TARGET}" |
353 | printf "***** $1 *****\n***** PWD: ${PWD}\n***** $*\n\n" > "${STDERR_TARGET}" |
| 338 | |
354 | |
| 339 | ebegin "Running $@" |
355 | ebegin "Running $@" |
| 340 | "$@" >> "${STDERR_TARGET}" 2>&1 |
356 | "$@" >> "${STDERR_TARGET}" 2>&1 |
| 341 | eend $? |
357 | if ! eend $? && ${autofail} ; then |
| 342 | |
|
|
| 343 | if [[ $? != 0 && ${NO_FAIL} != 1 ]] ; then |
|
|
| 344 | echo |
358 | echo |
| 345 | eerror "Failed Running $1 !" |
359 | eerror "Failed Running $1 !" |
| 346 | eerror |
360 | eerror |
| 347 | eerror "Include in your bugreport the contents of:" |
361 | eerror "Include in your bugreport the contents of:" |
| 348 | eerror |
362 | eerror |
| … | |
… | |
| 378 | |
392 | |
| 379 | # Internal function to get additional subdirs to configure |
393 | # Internal function to get additional subdirs to configure |
| 380 | autotools_get_subdirs() { autotools_check_macro_val AC_CONFIG_SUBDIRS ; } |
394 | autotools_get_subdirs() { autotools_check_macro_val AC_CONFIG_SUBDIRS ; } |
| 381 | autotools_get_auxdir() { autotools_check_macro_val AC_CONFIG_AUX_DIR ; } |
395 | autotools_get_auxdir() { autotools_check_macro_val AC_CONFIG_AUX_DIR ; } |
| 382 | |
396 | |
| 383 | autotools_m4dir_include() { |
397 | _autotools_m4dir_include() { |
| 384 | local x include_opts |
398 | local x include_opts |
| 385 | |
399 | |
| 386 | for x in ${AT_M4DIR} $(eval echo ${AT_SYS_M4DIR}) ; do |
400 | for x in "$@" ; do |
| 387 | case "${x}" in |
401 | case ${x} in |
| 388 | "-I") |
|
|
| 389 | # We handle it below |
402 | # We handle it below |
| 390 | ;; |
403 | -I) ;; |
| 391 | *) |
404 | *) |
| 392 | [[ ! -d ${x} ]] && ewarn "autotools.eclass: '${x}' does not exist" |
405 | [[ ! -d ${x} ]] && ewarn "autotools.eclass: '${x}' does not exist" |
| 393 | include_opts+=" -I ${x}" |
406 | include_opts+=" -I ${x}" |
| 394 | ;; |
407 | ;; |
| 395 | esac |
408 | esac |
| 396 | done |
409 | done |
| 397 | |
410 | |
| 398 | echo ${include_opts} |
411 | echo ${include_opts} |
| 399 | } |
412 | } |
|
|
413 | autotools_m4dir_include() { _autotools_m4dir_include ${AT_M4DIR} ; } |
|
|
414 | autotools_m4sysdir_include() { _autotools_m4dir_include $(eval echo ${AT_SYS_M4DIR}) ; } |
| 400 | |
415 | |
| 401 | fi |
416 | fi |