| 1 | # Copyright 1999-2010 Gentoo Foundation |
1 | # Copyright 1999-2010 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.101 2010/08/21 19:39:52 vapier Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/autotools.eclass,v 1.102 2011/04/06 03:52:08 flameeyes 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 |
| … | |
… | |
| 155 | aclocal_opts=$(sed -n '/^ACLOCAL_AMFLAGS[[:space:]]*=/s:[^=]*=::p' ${amflags_file}) |
155 | aclocal_opts=$(sed -n '/^ACLOCAL_AMFLAGS[[:space:]]*=/s:[^=]*=::p' ${amflags_file}) |
| 156 | eval aclocal_opts=\"${aclocal_opts}\" |
156 | eval aclocal_opts=\"${aclocal_opts}\" |
| 157 | break |
157 | break |
| 158 | done |
158 | done |
| 159 | |
159 | |
| 160 | if [[ -n ${AT_M4DIR} ]] ; then |
|
|
| 161 | for x in ${AT_M4DIR} ; do |
|
|
| 162 | case "${x}" in |
|
|
| 163 | "-I") |
|
|
| 164 | # We handle it below |
|
|
| 165 | ;; |
|
|
| 166 | *) |
|
|
| 167 | [[ ! -d ${x} ]] && ewarn "eaclocal: '${x}' does not exist" |
|
|
| 168 | aclocal_opts="${aclocal_opts} -I ${x}" |
|
|
| 169 | ;; |
|
|
| 170 | esac |
|
|
| 171 | done |
|
|
| 172 | fi |
|
|
| 173 | |
|
|
| 174 | [[ ! -f aclocal.m4 || -n $(grep -e 'generated.*by aclocal' aclocal.m4) ]] && \ |
160 | [[ ! -f aclocal.m4 || -n $(grep -e 'generated.*by aclocal' aclocal.m4) ]] && \ |
| 175 | autotools_run_tool aclocal "$@" ${aclocal_opts} |
161 | autotools_run_tool aclocal $(autotools_m4dir_include) "$@" ${aclocal_opts} |
| 176 | } |
162 | } |
| 177 | |
163 | |
| 178 | # @FUNCTION: _elibtoolize |
164 | # @FUNCTION: _elibtoolize |
| 179 | # @DESCRIPTION: |
165 | # @DESCRIPTION: |
| 180 | # Runs libtoolize. Note the '_' prefix .. to not collide with elibtoolize() from |
166 | # Runs libtoolize. Note the '_' prefix .. to not collide with elibtoolize() from |
| … | |
… | |
| 199 | # @DESCRIPTION: |
185 | # @DESCRIPTION: |
| 200 | # Runs autoheader. |
186 | # Runs autoheader. |
| 201 | eautoheader() { |
187 | eautoheader() { |
| 202 | # Check if we should run autoheader |
188 | # Check if we should run autoheader |
| 203 | [[ -n $(autotools_check_macro "AC_CONFIG_HEADERS") ]] || return 0 |
189 | [[ -n $(autotools_check_macro "AC_CONFIG_HEADERS") ]] || return 0 |
| 204 | NO_FAIL=1 autotools_run_tool autoheader "$@" |
190 | NO_FAIL=1 autotools_run_tool autoheader $(autotools_m4dir_include) "$@" |
| 205 | } |
191 | } |
| 206 | |
192 | |
| 207 | # @FUNCTION: eautoconf |
193 | # @FUNCTION: eautoconf |
| 208 | # @DESCRIPTION: |
194 | # @DESCRIPTION: |
| 209 | # Runs autoconf. |
195 | # Runs autoconf. |
| … | |
… | |
| 213 | eerror "No configure.{ac,in} present in '${PWD}'!" |
199 | eerror "No configure.{ac,in} present in '${PWD}'!" |
| 214 | echo |
200 | echo |
| 215 | die "No configure.{ac,in} present!" |
201 | die "No configure.{ac,in} present!" |
| 216 | fi |
202 | fi |
| 217 | |
203 | |
| 218 | autotools_run_tool autoconf "$@" |
204 | autotools_run_tool autoconf $(autotools_m4dir_include) "$@" |
| 219 | } |
205 | } |
| 220 | |
206 | |
| 221 | # @FUNCTION: eautomake |
207 | # @FUNCTION: eautomake |
| 222 | # @DESCRIPTION: |
208 | # @DESCRIPTION: |
| 223 | # Runs automake. |
209 | # Runs automake. |
| … | |
… | |
| 318 | # Internal function to check for support |
304 | # Internal function to check for support |
| 319 | autotools_check_macro() { |
305 | autotools_check_macro() { |
| 320 | [[ -f configure.ac || -f configure.in ]] || return 0 |
306 | [[ -f configure.ac || -f configure.in ]] || return 0 |
| 321 | local macro |
307 | local macro |
| 322 | for macro ; do |
308 | for macro ; do |
| 323 | WANT_AUTOCONF="2.5" autoconf --trace="${macro}" 2>/dev/null |
309 | WANT_AUTOCONF="2.5" autoconf $(autotools_m4dir_include) --trace="${macro}" 2>/dev/null |
| 324 | done |
310 | done |
| 325 | return 0 |
311 | return 0 |
| 326 | } |
312 | } |
| 327 | |
313 | |
| 328 | # Internal function to get additional subdirs to configure |
314 | # Internal function to get additional subdirs to configure |
| … | |
… | |
| 353 | print res[1] |
339 | print res[1] |
| 354 | }' | uniq |
340 | }' | uniq |
| 355 | |
341 | |
| 356 | return 0 |
342 | return 0 |
| 357 | } |
343 | } |
|
|
344 | |
|
|
345 | autotools_m4dir_include() { |
|
|
346 | [[ -n ${AT_M4DIR} ]] || return |
|
|
347 | |
|
|
348 | local include_opts= |
|
|
349 | |
|
|
350 | for x in ${AT_M4DIR} ; do |
|
|
351 | case "${x}" in |
|
|
352 | "-I") |
|
|
353 | # We handle it below |
|
|
354 | ;; |
|
|
355 | *) |
|
|
356 | [[ ! -d ${x} ]] && ewarn "autotools.eclass: '${x}' does not exist" |
|
|
357 | include_opts="${include_opts} -I ${x}" |
|
|
358 | ;; |
|
|
359 | esac |
|
|
360 | done |
|
|
361 | |
|
|
362 | echo $include_opts |
|
|
363 | } |