aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schlemmer <azarah@gentoo.org>2005-07-16 20:28:42 +0000
committerMartin Schlemmer <azarah@gentoo.org>2005-07-16 20:28:42 +0000
commit0f29395680956410ff47d8f66781680a19829e80 (patch)
tree6dea2334a06e78810d40b2e961a351ac8350d07a
parentAlso check configure.{in,ac} for AC_PREREQ, bug #97470. (diff)
downloadautotools-wrappers-0f29395680956410ff47d8f66781680a19829e80.tar.gz
autotools-wrappers-0f29395680956410ff47d8f66781680a19829e80.tar.bz2
autotools-wrappers-0f29395680956410ff47d8f66781680a19829e80.zip
Update to work with MacOS X. Do not parse comments in acfiles.ac-3.1
Package-Manager: portage-2.0.51.22-r1
-rwxr-xr-xac-wrapper.sh93
1 files changed, 72 insertions, 21 deletions
diff --git a/ac-wrapper.sh b/ac-wrapper.sh
index 0c2a056..fe6f398 100755
--- a/ac-wrapper.sh
+++ b/ac-wrapper.sh
@@ -1,7 +1,7 @@
#!/bin/bash
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $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 $
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/autoconf-wrapper/files/ac-wrapper-3.1.sh,v 1.1 2005/07/16 20:28:42 azarah Exp $
# Based on the ac-wrapper.pl script provided by MandrakeSoft
# Rewritten in bash by Gregorio Guidi
@@ -30,6 +30,72 @@ binary_new="${0}-2.59"
binary_old="${0}-2.13"
binary=${binary_new}
+acprereq_version() {
+ # Add --posix to below awk to make sure it will run on macosx, etc
+ awk \
+ '($0 !~ /^[[:space:]]*(#|dnl)/) {
+ # The following is replaced by below, as we cannot use match()
+ # with a third argument with non-gawk (posix) versions of awk:
+ #
+ #if (match($0, "AC_PREREQ\\(\\[?([0-9]\\.[0-9])", res))
+ # VERSIONS[COUNT++] = res[1]
+ #
+ sindex = match($0, /AC_PREREQ\(\[?([0-9]\.[0-9])/)
+ if (sindex > 0) {
+ sindex += length("AC_PREREQ(")
+ if (substr($0, sindex, 1) == "[")
+ sindex++
+ VERSIONS[COUNT++] = substr($0, sindex, 3)
+ }
+ }
+
+ END {
+ # The following is replaced by below, as we cannot use asort()
+ # with non-gawk (posix) versions of awk:
+ #
+ #asort(VERSIONS)
+ #
+ VERSION = VERSIONS[0]
+ for (x = 0; x <= COUNT;x++)
+ if (VERSIONS[x] > VERSION)
+ VERSION=VERSIONS[x]
+
+ print VERSION
+ }' "$@"
+}
+
+generated_version() {
+ # Add --posix to below awk to make sure it will run on macosx, etc
+ awk \
+ '{
+ # The following is replaced by below, as we cannot use match()
+ # with a third argument with non-gawk (posix) versions of awk:
+ #
+ #if (match($0,
+ # "^# Generated (by (GNU )?Autoconf|automatically using autoconf version) ([0-9].[0-9])",
+ # res))
+ # { print res[3]; exit }
+ #
+ # First try for newer versions of autoconf
+ sindex = match($0, /Generated by GNU Autoconf ([0-9]\.[0-9])/)
+ if (sindex > 0)
+ # Now chop the first part before the version
+ sindex += length("Generated by GNU Autoconf ")
+ # No version, so try older versions of autoconf
+ if (sindex <= 0) {
+ sindex = match($0, /Generated automatically using autoconf version ([0-9]\.[0-9])/)
+ if (sindex > 0)
+ sindex += length("Generated automatically using autoconf version ")
+ }
+
+ # Ok, we got a version
+ if (sindex > 0) {
+ print substr($0, sindex, 3)
+ exit
+ }
+ }' "$@"
+}
+
#
# autodetect routine
#
@@ -51,26 +117,11 @@ if [[ ${WANT_AUTOCONF} != "2.5" ]] ; then
1.[7-9]) ;;
*)
acfiles=$(ls ac{local,include}.m4 configure.{in,ac} 2>/dev/null)
- if [[ -n ${acfiles} ]] ; then
- confversion=$(gawk \
- '{
- if (match($0, "AC_PREREQ\\(\\[?([0-9]\\.[0-9])", res))
- VERSIONS[COUNT++] = res[1]
- }
- END {
- asort(VERSIONS)
- print VERSIONS[COUNT]
- }' ${acfiles})
- fi
- if [[ -z ${confversion} && -r "configure" ]] ; then
- confversion=$(gawk \
- '{
- if (match($0,
- "^# Generated (by (GNU )?Autoconf|automatically using autoconf version) ([0-9].[0-9])",
- res))
- { print res[3]; exit }
- }' configure)
- fi
+ [[ -n ${acfiles} ]] && confversion=$(acprereq_version ${acfiles})
+
+ [[ -z ${confversion} && -r "configure" ]] && \
+ confversion=$(generated_version configure)
+
if [[ ${confversion} == "2.1" && ! -f "configure.ac" ]] ; then
binary="${binary_old}"
fi