| 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.20 2005/09/04 15:15:37 swegener Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/autotools.eclass,v 1.26 2005/12/08 22:51:52 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 |
| … | |
… | |
| 21 | # Variables: |
21 | # Variables: |
| 22 | # |
22 | # |
| 23 | # AT_M4DIR - Additional director(y|ies) aclocal should search |
23 | # AT_M4DIR - Additional director(y|ies) aclocal should search |
| 24 | # AT_GNUCONF_UPDATE - Should gnuconfig_update() be run (normally handled by |
24 | # AT_GNUCONF_UPDATE - Should gnuconfig_update() be run (normally handled by |
| 25 | # econf()) [yes|no] |
25 | # econf()) [yes|no] |
|
|
26 | # AM_OPTS - Additional options to pass to automake during |
|
|
27 | # eautoreconf call. |
| 26 | |
28 | |
| 27 | # Functions: |
29 | # Functions: |
| 28 | # |
30 | # |
| 29 | # eautoreconf() - Should do a full autoreconf - normally what most people |
31 | # eautoreconf() - Should do a full autoreconf - normally what most people |
| 30 | # will be interested in. Also should handle additional |
32 | # will be interested in. Also should handle additional |
| … | |
… | |
| 58 | eautoreconf |
60 | eautoreconf |
| 59 | cd "${pwd}" |
61 | cd "${pwd}" |
| 60 | fi |
62 | fi |
| 61 | done |
63 | done |
| 62 | |
64 | |
|
|
65 | einfo "Running eautoreconf in '$(pwd)' ..." |
| 63 | eaclocal |
66 | eaclocal |
| 64 | _elibtoolize --copy --force |
67 | _elibtoolize --copy --force |
| 65 | eautoconf |
68 | eautoconf |
| 66 | eautoheader |
69 | eautoheader |
| 67 | eautomake |
70 | eautomake ${AM_OPTS} |
| 68 | |
71 | |
| 69 | # Normally run by econf() |
72 | # Normally run by econf() |
| 70 | [[ ${AT_GNUCONF_UPDATE} == "yes" ]] && gnuconfig_update |
73 | [[ ${AT_GNUCONF_UPDATE} == "yes" ]] && gnuconfig_update |
|
|
74 | |
|
|
75 | return 0 |
| 71 | } |
76 | } |
| 72 | |
77 | |
| 73 | # These functions runs the autotools using autotools_run_tool with the |
78 | # These functions runs the autotools using autotools_run_tool with the |
| 74 | # specified parametes. The name of the tool run is the same of the function |
79 | # specified parametes. The name of the tool run is the same of the function |
| 75 | # without e prefix. |
80 | # without e prefix. |
| … | |
… | |
| 97 | ;; |
102 | ;; |
| 98 | esac |
103 | esac |
| 99 | done |
104 | done |
| 100 | fi |
105 | fi |
| 101 | |
106 | |
| 102 | [[ -f aclocal.m4 && -n $(grep -e 'generated.*by aclocal' aclocal.m4) ]] && \ |
107 | [[ ! -f aclocal.m4 || -n $(grep -e 'generated.*by aclocal' aclocal.m4) ]] && \ |
| 103 | autotools_run_tool aclocal "$@" ${aclocal_opts} |
108 | autotools_run_tool aclocal "$@" ${aclocal_opts} |
| 104 | } |
109 | } |
| 105 | |
110 | |
| 106 | _elibtoolize() { |
111 | _elibtoolize() { |
| 107 | local opts |
112 | local opts |
| … | |
… | |
| 134 | |
139 | |
| 135 | autotools_run_tool autoconf "$@" |
140 | autotools_run_tool autoconf "$@" |
| 136 | } |
141 | } |
| 137 | |
142 | |
| 138 | eautomake() { |
143 | eautomake() { |
|
|
144 | local extra_opts |
|
|
145 | |
| 139 | [[ -f Makefile.am ]] || return 0 |
146 | [[ -f Makefile.am ]] || return 0 |
|
|
147 | |
|
|
148 | [[ -f INSTALL && -f AUTHORS && -f ChangeLog ]] \ |
|
|
149 | || extra_opts="${extra_opts} --foreign" |
|
|
150 | |
| 140 | # --force-missing seems not to be recognized by some flavours of automake |
151 | # --force-missing seems not to be recognized by some flavours of automake |
| 141 | autotools_run_tool automake --add-missing --copy "$@" |
152 | autotools_run_tool automake --add-missing --copy ${extra_opts} "$@" |
| 142 | } |
153 | } |
| 143 | |
154 | |
| 144 | |
155 | |
| 145 | |
156 | |
| 146 | # Internal function to run an autotools' tool |
157 | # Internal function to run an autotools' tool |
| … | |
… | |
| 183 | subdirs_scan_out=$(autotools_check_macro "AC_CONFIG_SUBDIRS") |
194 | subdirs_scan_out=$(autotools_check_macro "AC_CONFIG_SUBDIRS") |
| 184 | [[ -n ${subdirs_scan_out} ]] || return 0 |
195 | [[ -n ${subdirs_scan_out} ]] || return 0 |
| 185 | |
196 | |
| 186 | echo "${subdirs_scan_out}" | gawk \ |
197 | echo "${subdirs_scan_out}" | gawk \ |
| 187 | '($0 !~ /^[[:space:]]*(#|dnl)/) { |
198 | '($0 !~ /^[[:space:]]*(#|dnl)/) { |
| 188 | if (match($0, "AC_CONFIG_SUBDIRS\\(\\[?([^\\])]*)", res)) { |
199 | if (match($0, /AC_CONFIG_SUBDIRS:(.*)$/, res)) |
| 189 | split(res[1], DIRS, /[\])]/) |
|
|
| 190 | print DIRS[1] |
200 | print res[1] |
| 191 | } |
|
|
| 192 | }' | uniq |
201 | }' | uniq |
| 193 | |
202 | |
| 194 | return 0 |
203 | return 0 |
| 195 | } |
204 | } |
| 196 | |
205 | |