| 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.134 2012/05/20 12:31:32 vapier Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/autotools.eclass,v 1.136 2012/05/20 12:55:06 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 |
| … | |
… | |
| 164 | [[ -n ${auxdir}${macdir} ]] && mkdir -p ${auxdir} ${macdir} |
164 | [[ -n ${auxdir}${macdir} ]] && mkdir -p ${auxdir} ${macdir} |
| 165 | eaclocal |
165 | eaclocal |
| 166 | if grep -q '^AM_GNU_GETTEXT_VERSION' configure.?? ; then |
166 | if grep -q '^AM_GNU_GETTEXT_VERSION' configure.?? ; then |
| 167 | eautopoint --force |
167 | eautopoint --force |
| 168 | fi |
168 | fi |
| 169 | [[ ${CHOST} == *-darwin* ]] && g=g |
|
|
| 170 | if ${LIBTOOLIZE:-${g}libtoolize} -n --install >& /dev/null ; then |
|
|
| 171 | _elibtoolize --copy --force --install |
|
|
| 172 | else |
|
|
| 173 | _elibtoolize --copy --force |
169 | _elibtoolize --install --copy --force |
| 174 | fi |
|
|
| 175 | eautoconf |
170 | eautoconf |
| 176 | eautoheader |
171 | eautoheader |
| 177 | [[ ${AT_NOEAUTOMAKE} != "yes" ]] && FROM_EAUTORECONF="yes" eautomake ${AM_OPTS} |
172 | [[ ${AT_NOEAUTOMAKE} != "yes" ]] && FROM_EAUTORECONF="yes" eautomake ${AM_OPTS} |
| 178 | |
173 | |
| 179 | [[ ${AT_NOELIBTOOLIZE} == "yes" ]] && return 0 |
174 | [[ ${AT_NOELIBTOOLIZE} == "yes" ]] && return 0 |
| … | |
… | |
| 225 | autotools_run_tool --at-m4flags aclocal "$@" $(eaclocal_amflags) |
220 | autotools_run_tool --at-m4flags aclocal "$@" $(eaclocal_amflags) |
| 226 | } |
221 | } |
| 227 | |
222 | |
| 228 | # @FUNCTION: _elibtoolize |
223 | # @FUNCTION: _elibtoolize |
| 229 | # @DESCRIPTION: |
224 | # @DESCRIPTION: |
|
|
225 | # Runs libtoolize. If --install is the first arg, automatically drop it if |
|
|
226 | # the active libtool version doesn't support it. |
|
|
227 | # |
| 230 | # Runs libtoolize. Note the '_' prefix .. to not collide with elibtoolize() from |
228 | # Note the '_' prefix .. to not collide with elibtoolize() from libtool.eclass. |
| 231 | # libtool.eclass. |
|
|
| 232 | _elibtoolize() { |
229 | _elibtoolize() { |
| 233 | local opts g= |
|
|
| 234 | |
|
|
| 235 | # Check if we should run libtoolize (AM_PROG_LIBTOOL is an older macro, |
230 | # Check if we should run libtoolize (AM_PROG_LIBTOOL is an older macro, |
| 236 | # check for both it and the current AC_PROG_LIBTOOL) |
231 | # check for both it and the current AC_PROG_LIBTOOL) |
| 237 | [[ -n $(autotools_check_macro AC_PROG_LIBTOOL AM_PROG_LIBTOOL LT_INIT) ]] || return 0 |
232 | [[ -n $(autotools_check_macro AC_PROG_LIBTOOL AM_PROG_LIBTOOL LT_INIT) ]] || return 0 |
| 238 | |
233 | |
|
|
234 | local LIBTOOLIZE=${LIBTOOLIZE:-libtoolize} |
|
|
235 | type -P glibtoolize && LIBTOOLIZE=glibtoolize |
|
|
236 | |
| 239 | [[ -f GNUmakefile.am || -f Makefile.am ]] && opts="--automake" |
237 | [[ -f GNUmakefile.am || -f Makefile.am ]] && set -- "$@" --automake |
|
|
238 | if [[ $1 == "--install" ]] ; then |
|
|
239 | ${LIBTOOLIZE} -n --install >& /dev/null || shift |
|
|
240 | fi |
| 240 | |
241 | |
| 241 | [[ ${CHOST} == *-darwin* ]] && g=g |
|
|
| 242 | autotools_run_tool ${LIBTOOLIZE:-${g}libtoolize} "$@" ${opts} |
242 | autotools_run_tool ${LIBTOOLIZE} "$@" ${opts} |
| 243 | |
243 | |
| 244 | # Need to rerun aclocal |
244 | # Need to rerun aclocal |
| 245 | eaclocal |
245 | eaclocal |
| 246 | } |
246 | } |
| 247 | |
247 | |
| … | |
… | |
| 414 | WANT_AUTOCONF="2.5" autoconf $(autotools_m4dir_include) --trace="${macro}" 2>/dev/null |
414 | WANT_AUTOCONF="2.5" autoconf $(autotools_m4dir_include) --trace="${macro}" 2>/dev/null |
| 415 | done |
415 | done |
| 416 | return 0 |
416 | return 0 |
| 417 | } |
417 | } |
| 418 | |
418 | |
|
|
419 | # @FUNCTION: autotools_check_macro_val |
|
|
420 | # @USAGE: <macro> [macros] |
|
|
421 | # @INTERNAL |
|
|
422 | # @DESCRIPTION: |
| 419 | # Internal function to look for a macro and extract its value |
423 | # Look for a macro and extract its value. |
| 420 | autotools_check_macro_val() { |
424 | autotools_check_macro_val() { |
| 421 | local macro=$1 scan_out |
425 | local macro scan_out |
| 422 | |
426 | |
|
|
427 | for macro ; do |
| 423 | autotools_check_macro "${macro}" | \ |
428 | autotools_check_macro "${macro}" | \ |
| 424 | gawk -v macro="${macro}" \ |
429 | gawk -v macro="${macro}" \ |
| 425 | '($0 !~ /^[[:space:]]*(#|dnl)/) { |
430 | '($0 !~ /^[[:space:]]*(#|dnl)/) { |
| 426 | if (match($0, macro ":(.*)$", res)) |
431 | if (match($0, macro ":(.*)$", res)) |
| 427 | print res[1] |
432 | print res[1] |
| 428 | }' | uniq |
433 | }' | uniq |
|
|
434 | done |
| 429 | |
435 | |
| 430 | return 0 |
436 | return 0 |
| 431 | } |
437 | } |
| 432 | |
438 | |
| 433 | # Internal function to get additional subdirs to configure |
439 | # Internal function to get additional subdirs to configure |