| 1 | # Copyright 1999-2005 Gentoo Foundation |
1 | # Copyright 1999-2007 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.63 2007/01/08 23:25:30 flameeyes Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/autotools.eclass,v 1.64 2007/01/19 23:39:29 vapier 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 |
| … | |
… | |
| 19 | _autoconf_atom="sys-devel/autoconf" |
19 | _autoconf_atom="sys-devel/autoconf" |
| 20 | if [[ -n ${WANT_AUTOMAKE} ]]; then |
20 | if [[ -n ${WANT_AUTOMAKE} ]]; then |
| 21 | case ${WANT_AUTOMAKE} in |
21 | case ${WANT_AUTOMAKE} in |
| 22 | # workaround while we have different versions of automake in arch and ~arch |
22 | # workaround while we have different versions of automake in arch and ~arch |
| 23 | none) _automake_atom="" ;; # some packages don't require automake at all |
23 | none) _automake_atom="" ;; # some packages don't require automake at all |
| 24 | latest) _automake_atom="|| ( =sys-devel/automake-1.10* =sys-devel/automake-1.9* )" ;; |
24 | latest) _automake_atom="=sys-devel/automake-1.10*" ;; |
| 25 | *) _automake_atom="=sys-devel/automake-${WANT_AUTOMAKE}*" ;; |
25 | *) _automake_atom="=sys-devel/automake-${WANT_AUTOMAKE}*" ;; |
| 26 | esac |
26 | esac |
|
|
27 | [[ ${WANT_AUTOMAKE} == "latest" ]] && WANT_AUTOMAKE="1.10" |
|
|
28 | export WANT_AUTOMAKE |
| 27 | fi |
29 | fi |
| 28 | |
30 | |
| 29 | if [[ -n ${WANT_AUTOCONF} ]] ; then |
31 | if [[ -n ${WANT_AUTOCONF} ]] ; then |
| 30 | case ${WANT_AUTOCONF} in |
32 | case ${WANT_AUTOCONF} in |
| 31 | 2.1) _autoconf_atom="=sys-devel/autoconf-${WANT_AUTOCONF}*" ;; |
33 | 2.1) _autoconf_atom="=sys-devel/autoconf-${WANT_AUTOCONF}*" ;; |
| 32 | latest | 2.5) _autoconf_atom=">=sys-devel/autoconf-2.59" ;; |
34 | latest | 2.5) _autoconf_atom=">=sys-devel/autoconf-2.59" ;; |
| 33 | esac |
35 | esac |
|
|
36 | [[ ${WANT_AUTOCONF} == "latest" ]] && WANT_AUTOCONF="2.5" |
|
|
37 | export WANT_AUTOCONF |
| 34 | fi |
38 | fi |
| 35 | DEPEND="${_automake_atom} |
39 | DEPEND="${_automake_atom} |
| 36 | ${_autoconf_atom} |
40 | ${_autoconf_atom} |
| 37 | sys-devel/libtool" |
41 | sys-devel/libtool" |
| 38 | RDEPEND="" |
42 | RDEPEND="" |
| … | |
… | |
| 121 | ;; |
125 | ;; |
| 122 | esac |
126 | esac |
| 123 | done |
127 | done |
| 124 | fi |
128 | fi |
| 125 | |
129 | |
| 126 | autotools_set_versions |
|
|
| 127 | [[ ! -f aclocal.m4 || -n $(grep -e 'generated.*by aclocal' aclocal.m4) ]] && \ |
130 | [[ ! -f aclocal.m4 || -n $(grep -e 'generated.*by aclocal' aclocal.m4) ]] && \ |
| 128 | autotools_run_tool aclocal "$@" ${aclocal_opts} |
131 | autotools_run_tool aclocal "$@" ${aclocal_opts} |
| 129 | } |
132 | } |
| 130 | |
133 | |
| 131 | _elibtoolize() { |
134 | _elibtoolize() { |
| … | |
… | |
| 147 | } |
150 | } |
| 148 | |
151 | |
| 149 | eautoheader() { |
152 | eautoheader() { |
| 150 | # Check if we should run autoheader |
153 | # Check if we should run autoheader |
| 151 | [[ -n $(autotools_check_macro "AC_CONFIG_HEADERS") ]] || return 0 |
154 | [[ -n $(autotools_check_macro "AC_CONFIG_HEADERS") ]] || return 0 |
| 152 | autotools_set_versions |
|
|
| 153 | NO_FAIL=1 autotools_run_tool autoheader "$@" |
155 | NO_FAIL=1 autotools_run_tool autoheader "$@" |
| 154 | } |
156 | } |
| 155 | |
157 | |
| 156 | eautoconf() { |
158 | eautoconf() { |
| 157 | if [[ ! -f configure.ac && ! -f configure.in ]] ; then |
159 | if [[ ! -f configure.ac && ! -f configure.in ]] ; then |
| … | |
… | |
| 159 | eerror "No configure.{ac,in} present in '$(pwd | sed -e 's:.*/::')'!" |
161 | eerror "No configure.{ac,in} present in '$(pwd | sed -e 's:.*/::')'!" |
| 160 | echo |
162 | echo |
| 161 | die "No configure.{ac,in} present!" |
163 | die "No configure.{ac,in} present!" |
| 162 | fi |
164 | fi |
| 163 | |
165 | |
| 164 | autotools_set_versions |
|
|
| 165 | autotools_run_tool autoconf "$@" |
166 | autotools_run_tool autoconf "$@" |
| 166 | } |
167 | } |
| 167 | |
168 | |
| 168 | eautomake() { |
169 | eautomake() { |
| 169 | local extra_opts |
170 | local extra_opts |
| 170 | |
171 | |
| 171 | [[ -f Makefile.am ]] || return 0 |
172 | [[ -f Makefile.am ]] || return 0 |
| 172 | |
173 | |
| 173 | autotools_set_versions |
|
|
| 174 | if [[ -z ${FROM_EAUTORECONF} && -f Makefile.in ]]; then |
174 | if [[ -z ${FROM_EAUTORECONF} && -f Makefile.in ]]; then |
| 175 | local used_automake |
175 | local used_automake |
| 176 | local installed_automake |
176 | local installed_automake |
| 177 | |
177 | |
| 178 | installed_automake=$(automake --version | head -n 1 | \ |
178 | installed_automake=$(automake --version | head -n 1 | \ |
| … | |
… | |
| 193 | |
193 | |
| 194 | # --force-missing seems not to be recognized by some flavours of automake |
194 | # --force-missing seems not to be recognized by some flavours of automake |
| 195 | autotools_run_tool automake --add-missing --copy ${extra_opts} "$@" |
195 | autotools_run_tool automake --add-missing --copy ${extra_opts} "$@" |
| 196 | } |
196 | } |
| 197 | |
197 | |
| 198 | autotools_set_versions() { |
|
|
| 199 | [[ -n ${autotools_version_sets} ]] && return 0 |
|
|
| 200 | |
|
|
| 201 | if [[ -n ${WANT_AUTOCONF} ]]; then |
|
|
| 202 | [[ ${WANT_AUTOCONF} == "latest" ]] && WANT_AUTOCONF="2.5" |
|
|
| 203 | export WANT_AUTOCONF |
|
|
| 204 | einfo "Requested autoconf ${WANT_AUTOCONF}" |
|
|
| 205 | einfo "Using $(autoconf --version 2>/dev/null | head -n 1)" |
|
|
| 206 | einfo "Using $(autoheader --version 2>/dev/null | head -n 1)" |
|
|
| 207 | else |
|
|
| 208 | ewarn "QA Notice: \${WANT_AUTOCONF} variable unset. Please report on http://bugs.gentoo.org/" |
|
|
| 209 | fi |
|
|
| 210 | |
|
|
| 211 | if [[ -n ${WANT_AUTOMAKE} ]]; then |
|
|
| 212 | local latest_automake |
|
|
| 213 | if [[ ${WANT_AUTOMAKE} == "latest" ]]; then |
|
|
| 214 | latest_automake="latest: " |
|
|
| 215 | for amver in 1.10 1.9 1.8 1.7 1.6; do |
|
|
| 216 | WANT_AUTOMAKE="${amver}" |
|
|
| 217 | ROOT=/ has_version =sys-devel/automake-${amver}* && break |
|
|
| 218 | done |
|
|
| 219 | fi |
|
|
| 220 | |
|
|
| 221 | # Don't do stuff if no autoamke is requested/required |
|
|
| 222 | if [[ ${WANT_AUTOMAKE} != "none" ]]; then |
|
|
| 223 | export WANT_AUTOMAKE |
|
|
| 224 | einfo "Requested automake ${latest_automake}${WANT_AUTOMAKE}" |
|
|
| 225 | einfo "Using $(automake --version 2>/dev/null | head -n 1)" |
|
|
| 226 | einfo "Using $(aclocal --version 2>/dev/null | head -n 1)" |
|
|
| 227 | fi |
|
|
| 228 | else |
|
|
| 229 | ewarn "QA Notice: \${WANT_AUTOMAKE} variable unset. Please report on http://bugs.gentoo.org/" |
|
|
| 230 | fi |
|
|
| 231 | |
|
|
| 232 | autotools_version_sets="yes" |
|
|
| 233 | } |
|
|
| 234 | |
|
|
| 235 | # Internal function to run an autotools' tool |
198 | # Internal function to run an autotools' tool |
| 236 | autotools_run_tool() { |
199 | autotools_run_tool() { |
| 237 | local STDERR_TARGET="${T}/$$.out" |
200 | local STDERR_TARGET="${T}/$$.out" |
| 238 | local ris |
201 | local ris |
| 239 | |
202 | |