| 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.37 2006/06/15 22:29:25 flameeyes Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/autotools.eclass,v 1.38 2006/06/28 00:15:32 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 |
| … | |
… | |
| 16 | sys-devel/autoconf |
16 | sys-devel/autoconf |
| 17 | sys-devel/libtool" |
17 | sys-devel/libtool" |
| 18 | |
18 | |
| 19 | # Variables: |
19 | # Variables: |
| 20 | # |
20 | # |
| 21 | # AT_M4DIR - Additional director(y|ies) aclocal should search |
21 | # AT_M4DIR - Additional director(y|ies) aclocal should search |
| 22 | # AM_OPTS - Additional options to pass to automake during |
22 | # AM_OPTS - Additional options to pass to automake during |
| 23 | # eautoreconf call. |
23 | # eautoreconf call. |
| 24 | |
24 | |
| 25 | # Functions: |
25 | # Functions: |
| 26 | # |
26 | # |
| 27 | # eautoreconf() - Should do a full autoreconf - normally what most people |
27 | # eautoreconf() - Should do a full autoreconf - normally what most people |
| 28 | # will be interested in. Also should handle additional |
28 | # will be interested in. Also should handle additional |
| 29 | # directories specified by AC_CONFIG_SUBDIRS. |
29 | # directories specified by AC_CONFIG_SUBDIRS. |
| 30 | # eaclocal() - Runs aclocal. Respects AT_M4DIR for additional directories |
30 | # eaclocal() - Runs aclocal. Respects AT_M4DIR for additional directories |
| 31 | # to search for macro's. |
31 | # to search for macro's. |
| 32 | # _elibtoolize() - Runs libtoolize. Note the '_' prefix .. to not collide |
32 | # _elibtoolize() - Runs libtoolize. Note the '_' prefix .. to not collide |
| 33 | # with elibtoolize() from libtool.eclass |
33 | # with elibtoolize() from libtool.eclass |
| 34 | # eautoconf - Runs autoconf. |
34 | # eautoconf - Runs autoconf. |
| 35 | # eautoheader - Runs autoheader. |
35 | # eautoheader - Runs autoheader. |
| 36 | # eautomake - Runs automake |
36 | # eautomake - Runs automake |
| 37 | # |
37 | # |
| 38 | |
38 | |
| 39 | # XXX: M4DIR should be depreciated |
39 | # XXX: M4DIR should be depreciated |
| 40 | AT_M4DIR=${AT_M4DIR:-${M4DIR}} |
40 | AT_M4DIR=${AT_M4DIR:-${M4DIR}} |
| 41 | AT_GNUCONF_UPDATE="no" |
41 | AT_GNUCONF_UPDATE="no" |
| … | |
… | |
| 43 | |
43 | |
| 44 | # This function mimes the behavior of autoreconf, but uses the different |
44 | # This function mimes the behavior of autoreconf, but uses the different |
| 45 | # eauto* functions to run the tools. It doesn't accept parameters, but |
45 | # 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. |
46 | # the directory with include files can be specified with AT_M4DIR variable. |
| 47 | eautoreconf() { |
47 | eautoreconf() { |
| 48 | local pwd=$(pwd) x |
48 | local pwd=$(pwd) x auxdir |
| 49 | |
49 | |
| 50 | # Take care of subdirs |
50 | # Take care of subdirs |
| 51 | for x in $(autotools_get_subdirs); do |
51 | for x in $(autotools_get_subdirs); do |
| 52 | if [[ -d ${x} ]] ; then |
52 | if [[ -d ${x} ]] ; then |
| 53 | cd "${x}" |
53 | cd "${x}" |
| 54 | AT_NOELIBTOOLIZE="yes" eautoreconf |
54 | AT_NOELIBTOOLIZE="yes" eautoreconf |
| 55 | cd "${pwd}" |
55 | cd "${pwd}" |
| 56 | fi |
56 | fi |
| 57 | done |
57 | done |
| 58 | |
58 | |
|
|
59 | auxdir=$(autotools_get_auxdir) |
|
|
60 | |
| 59 | einfo "Running eautoreconf in '$(pwd)' ..." |
61 | einfo "Running eautoreconf in '$(pwd)' ..." |
|
|
62 | [[ -n ${auxdir} ]] && mkdir -p ${auxdir} |
| 60 | eaclocal |
63 | eaclocal |
| 61 | _elibtoolize --copy --force |
64 | _elibtoolize --copy --force |
| 62 | eautoconf |
65 | eautoconf |
| 63 | eautoheader |
66 | eautoheader |
| 64 | FROM_EAUTORECONF="yes" eautomake ${AM_OPTS} |
67 | FROM_EAUTORECONF="yes" eautomake ${AM_OPTS} |
| … | |
… | |
| 210 | }' | uniq |
213 | }' | uniq |
| 211 | |
214 | |
| 212 | return 0 |
215 | return 0 |
| 213 | } |
216 | } |
| 214 | |
217 | |
|
|
218 | autotools_get_auxdir() { |
|
|
219 | local auxdir_scan_out |
|
|
220 | |
|
|
221 | auxdir_scan_out=$(autotools_check_macro "AC_CONFIG_AUX_DIR") |
|
|
222 | [[ -n ${auxdir_scan_out} ]] || return 0 |
|
|
223 | |
|
|
224 | echo ${auxdir_scan_out} | gawk \ |
|
|
225 | '($0 !~ /^[[:space:]]*(#|dnl)/) { |
|
|
226 | if (match($0, /AC_CONFIG_AUX_DIR:(.*)$/, res)) |
|
|
227 | print res[1] |
|
|
228 | }' | uniq |
|
|
229 | |
|
|
230 | return 0 |
|
|
231 | } |