/[gentoo-alt]/trunk/prefix/sys-devel/autoconf-wrapper/files/ac-wrapper-3.sh
Gentoo

Contents of /trunk/prefix/sys-devel/autoconf-wrapper/files/ac-wrapper-3.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 920 - (show annotations) (download) (as text)
Tue Dec 13 20:55:14 2005 UTC (9 years, 8 months ago) by kito
File MIME type: text/x-sh
File size: 3077 byte(s)
drop -overlay
1 #!/bin/bash
2 # Copyright 1999-2005 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
4 # $Header: /var/cvsroot/gentoo-x86/sys-devel/autoconf-wrapper/files/ac-wrapper-3.sh,v 1.2 2005/06/30 12:58:52 azarah Exp $
5
6 # Based on the ac-wrapper.pl script provided by MandrakeSoft
7 # Rewritten in bash by Gregorio Guidi
8 #
9 # Executes the correct autoconf version.
10 #
11 # - defaults to latest version (2.5x)
12 # - runs autoconf 2.13 only if:
13 # - envvar WANT_AUTOCONF is set to `2.1'
14 # -or-
15 # - `configure' is already present and was generated by autoconf 2.13
16
17 if [[ ${0##*/} == "ac-wrapper.sh" ]] ; then
18 echo "Don't call this script directly" >&2
19 exit 1
20 fi
21
22 if [[ ${WANT_AUTOCONF} == "2.1" && ${0##*/} == "autom4te" ]] ; then
23 echo "ac-wrapper: Autoconf 2.13 doesn't contain autom4te." >&2
24 echo " Either unset WANT_AUTOCONF or don't execute anything" >&2
25 echo " that would use autom4te." >&2
26 exit 1
27 fi
28
29 binary_new="${0}-2.59"
30 binary_old="${0}-2.13"
31 binary=${binary_new}
32
33 #
34 # autodetect routine
35 #
36 if [[ ${WANT_AUTOCONF} != "2.5" ]] ; then
37 if [[ ${WANT_AUTOCONF} == "2.1" ]] ; then
38 if [[ ! -f "configure.ac" ]] ; then
39 binary=${binary_old}
40 else
41 echo "ac-wrapper: Since configure.ac is present, aclocal always use" >&2
42 echo " autoconf 2.59, which conflicts with your choice and" >&2
43 echo " causes error. You have two options:" >&2
44 echo " 1. Try execute command again after removing configure.ac" >&2
45 echo " 2. Don't set WANT_AUTOCONF" >&2
46 exit 1
47 fi
48 else
49 # Automake-1.7 and better requie autoconf-2.5x
50 case "${WANT_AUTOMAKE}" in
51 1.[7-9]) ;;
52 *)
53 acfiles=$(ls ac{local,include}.m4 configure.{in,ac} 2>/dev/null)
54 if [[ -n ${acfiles} ]] ; then
55 confversion=$(gawk \
56 '{
57 if (match($0, "AC_PREREQ\\(\\[?([0-9]\\.[0-9])", res))
58 VERSIONS[COUNT++] = res[1]
59 }
60 END {
61 asort(VERSIONS)
62 print VERSIONS[COUNT]
63 }' ${acfiles})
64 fi
65 if [[ -z ${confversion} && -r "configure" ]] ; then
66 confversion=$(gawk \
67 '{
68 if (match($0,
69 "^# Generated (by (GNU )?Autoconf|automatically using autoconf version) ([0-9].[0-9])",
70 res))
71 { print res[3]; exit }
72 }' configure)
73 fi
74 if [[ ${confversion} == "2.1" && ! -f "configure.ac" ]] ; then
75 binary="${binary_old}"
76 fi
77 esac
78 fi
79 fi
80
81 if [[ -n ${WANT_ACWRAPPER_DEBUG} ]] ; then
82 if [[ -n ${WANT_AUTOCONF} ]] ; then
83 echo "ac-wrapper: DEBUG: WANT_AUTOCONF is set to ${WANT_AUTOCONF}" >&2
84 fi
85 echo "ac-wrapper: DEBUG: will execute <${binary}>" >&2
86 fi
87
88 #
89 # for further consistency
90 #
91 if [[ ${binary} == "${binary_new}" ]] ; then
92 export WANT_AUTOCONF="2.5"
93 elif [[ ${binary} == "${binary_old}" ]] ; then
94 export WANT_AUTOCONF="2.1"
95 fi
96
97 if [[ ! -x ${binary} ]] ; then
98 # this shouldn't happen
99 echo "ac-wrapper: ${binary} is missing or not executable." >&2
100 echo " Please try emerging the correct version of autoconf." >&2
101 exit 1
102 fi
103
104 exec "${binary}" "$@"
105
106 echo "ac-wrapper: was unable to exec ${binary} !?" >&2
107 exit 1

  ViewVC Help
Powered by ViewVC 1.1.20