| 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.106 2011/08/22 19:39:52 vapier Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/autotools.eclass,v 1.111 2011/12/13 21:27:38 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 |
| 9 | # @DESCRIPTION: |
9 | # @DESCRIPTION: |
| 10 | # This eclass is for safely handling autotooled software packages that need to |
10 | # This eclass is for safely handling autotooled software packages that need to |
| 11 | # regenerate their build scripts. All functions will abort in case of errors. |
11 | # regenerate their build scripts. All functions will abort in case of errors. |
| 12 | # |
12 | |
| 13 | # NB: If you add anything, please comment it! |
13 | if [[ ${___ECLASS_ONCE_AUTOTOOLS} != "recur -_+^+_- spank" ]] ; then |
|
|
14 | ___ECLASS_ONCE_AUTOTOOLS="recur -_+^+_- spank" |
| 14 | |
15 | |
| 15 | inherit eutils libtool |
16 | inherit eutils libtool |
| 16 | |
17 | |
| 17 | # @ECLASS-VARIABLE: WANT_AUTOCONF |
18 | # @ECLASS-VARIABLE: WANT_AUTOCONF |
| 18 | # @DESCRIPTION: |
19 | # @DESCRIPTION: |
| … | |
… | |
| 146 | |
147 | |
| 147 | [[ ${AT_NOELIBTOOLIZE} == "yes" ]] && return 0 |
148 | [[ ${AT_NOELIBTOOLIZE} == "yes" ]] && return 0 |
| 148 | |
149 | |
| 149 | # Call it here to prevent failures due to elibtoolize called _before_ |
150 | # Call it here to prevent failures due to elibtoolize called _before_ |
| 150 | # eautoreconf. We set $S because elibtoolize runs on that #265319 |
151 | # eautoreconf. We set $S because elibtoolize runs on that #265319 |
| 151 | S=${PWD} elibtoolize |
152 | S=${PWD} elibtoolize --force |
| 152 | |
153 | |
| 153 | return 0 |
154 | return 0 |
|
|
155 | } |
|
|
156 | |
|
|
157 | # @FUNCTION: eaclocal_amflags |
|
|
158 | # @DESCRIPTION: |
|
|
159 | # Extract the ACLOCAL_AMFLAGS value from the Makefile.am and try to handle |
|
|
160 | # (most) of the crazy crap that people throw at us. |
|
|
161 | eaclocal_amflags() { |
|
|
162 | local aclocal_opts amflags_file |
|
|
163 | |
|
|
164 | for amflags_file in GNUmakefile.am Makefile.am GNUmakefile.in Makefile.in ; do |
|
|
165 | [[ -e ${amflags_file} ]] || continue |
|
|
166 | # setup the env in case the pkg does something crazy |
|
|
167 | # in their ACLOCAL_AMFLAGS. like run a shell script |
|
|
168 | # which turns around and runs autotools. #365401 |
|
|
169 | # or split across multiple lines. #383525 |
|
|
170 | autotools_env_setup |
|
|
171 | aclocal_opts=$(sed -n \ |
|
|
172 | "/^ACLOCAL_AMFLAGS[[:space:]]*=/{ \ |
|
|
173 | # match the first line |
|
|
174 | s:[^=]*=::p; \ |
|
|
175 | # then gobble up all escaped lines |
|
|
176 | : nextline /\\\\$/{ n; p; b nextline; } \ |
|
|
177 | }" ${amflags_file}) |
|
|
178 | eval aclocal_opts=\""${aclocal_opts}"\" |
|
|
179 | break |
|
|
180 | done |
|
|
181 | |
|
|
182 | echo ${aclocal_opts} |
| 154 | } |
183 | } |
| 155 | |
184 | |
| 156 | # @FUNCTION: eaclocal |
185 | # @FUNCTION: eaclocal |
| 157 | # @DESCRIPTION: |
186 | # @DESCRIPTION: |
| 158 | # These functions runs the autotools using autotools_run_tool with the |
187 | # These functions runs the autotools using autotools_run_tool with the |
| 159 | # specified parametes. The name of the tool run is the same of the function |
188 | # specified parametes. The name of the tool run is the same of the function |
| 160 | # without e prefix. |
189 | # without e prefix. |
| 161 | # They also force installing the support files for safety. |
190 | # They also force installing the support files for safety. |
| 162 | # Respects AT_M4DIR for additional directories to search for macro's. |
191 | # Respects AT_M4DIR for additional directories to search for macro's. |
| 163 | eaclocal() { |
192 | eaclocal() { |
| 164 | local aclocal_opts |
|
|
| 165 | |
|
|
| 166 | local amflags_file |
|
|
| 167 | for amflags_file in GNUmakefile.am Makefile.am GNUmakefile.in Makefile.in ; do |
|
|
| 168 | [[ -e ${amflags_file} ]] || continue |
|
|
| 169 | # setup the env in case the pkg does something crazy |
|
|
| 170 | # in their ACLOCAL_AMFLAGS. like run a shell script |
|
|
| 171 | # which turns around and runs autotools #365401 |
|
|
| 172 | autotools_env_setup |
|
|
| 173 | aclocal_opts=$(sed -n '/^ACLOCAL_AMFLAGS[[:space:]]*=/s:[^=]*=::p' ${amflags_file}) |
|
|
| 174 | eval aclocal_opts=\"${aclocal_opts}\" |
|
|
| 175 | break |
|
|
| 176 | done |
|
|
| 177 | |
|
|
| 178 | [[ ! -f aclocal.m4 || -n $(grep -e 'generated.*by aclocal' aclocal.m4) ]] && \ |
193 | [[ ! -f aclocal.m4 || -n $(grep -e 'generated.*by aclocal' aclocal.m4) ]] && \ |
| 179 | autotools_run_tool aclocal $(autotools_m4dir_include) "$@" ${aclocal_opts} |
194 | autotools_run_tool aclocal $(autotools_m4dir_include) "$@" $(eaclocal_amflags) |
| 180 | } |
195 | } |
| 181 | |
196 | |
| 182 | # @FUNCTION: _elibtoolize |
197 | # @FUNCTION: _elibtoolize |
| 183 | # @DESCRIPTION: |
198 | # @DESCRIPTION: |
| 184 | # Runs libtoolize. Note the '_' prefix .. to not collide with elibtoolize() from |
199 | # Runs libtoolize. Note the '_' prefix .. to not collide with elibtoolize() from |
| … | |
… | |
| 258 | eautoreconf |
273 | eautoreconf |
| 259 | return 0 |
274 | return 0 |
| 260 | fi |
275 | fi |
| 261 | fi |
276 | fi |
| 262 | |
277 | |
| 263 | [[ -f INSTALL && -f AUTHORS && -f ChangeLog && -f NEWS ]] \ |
278 | [[ -f INSTALL && -f AUTHORS && -f ChangeLog && -f NEWS && -f README ]] \ |
| 264 | || extra_opts="${extra_opts} --foreign" |
279 | || extra_opts="${extra_opts} --foreign" |
| 265 | |
280 | |
| 266 | # --force-missing seems not to be recognized by some flavours of automake |
281 | # --force-missing seems not to be recognized by some flavours of automake |
| 267 | autotools_run_tool automake --add-missing --copy ${extra_opts} "$@" |
282 | autotools_run_tool automake --add-missing --copy ${extra_opts} "$@" |
| 268 | } |
283 | } |
| … | |
… | |
| 385 | esac |
400 | esac |
| 386 | done |
401 | done |
| 387 | |
402 | |
| 388 | echo $include_opts |
403 | echo $include_opts |
| 389 | } |
404 | } |
|
|
405 | |
|
|
406 | fi |