Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Eclipse Autotools: ac-wrapper: Unable to locate any usuab...
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
Yminus
Apprentice
Apprentice


Joined: 06 Jan 2008
Posts: 184

PostPosted: Mon Sep 12, 2011 9:24 pm    Post subject: Eclipse Autotools: ac-wrapper: Unable to locate any usuab... Reply with quote

I am new to Autotools and I am trying to use them in Eclipse (Indigo) with Eclipse Linux Tools and started with a "Hello World C++ Autotools Project".

When I "Invoke Autoconf" via the context menu it fails:

Code:

Invoking autoconf in /home/lars/workspace/testAutotools

sh autoconf
ac-wrapper: Unable to locate any usuable version of autoconf.
    I tried these versions: 2.99:2.5 2.98:2.5 2.97:2.5 2.96:2.5 2.95:2.5 2.94:2.5 2.93:2.5 2.92:2.5 2.91:2.5 2.90:2.5 2.89:2.5 2.88:2.5 2.87:2.5 2.86:2.5 2.85:2.5 2.84:2.5 2.83:2.5 2.82:2.5 2.81:2.5 2.80:2.5 2.79:2.5 2.78:2.5 2.77:2.5 2.76:2.5 2.75:2.5 2.74:2.5 2.73:2.5 2.72:2.5 2.71:2.5 2.70:2.5 2.69:2.5 2.68:2.5 2.67:2.5 2.66:2.5 2.65:2.5 2.64:2.5 2.63:2.5 2.62:2.5 2.61:2.5 2.60:2.5 2.59:2.5  2.13:2.1
    With a base name of 'autoconf'.


It seems to be the way eclipse calls autoconf. If I invoke autoconf in bash directly it works (well, it would):
Code:

autoconf
autoconf-2.68: error: no input file


Iif I invoke it like eclipse it fails the same way:
Code:

sh autoconf
ac-wrapper: Unable to locate any usuable version of autoconf.
        I tried these versions: 2.99:2.5 2.98:2.5 2.97:2.5 2.96:2.5 2.95:2.5 2.94:2.5 2.93:2.5 2.92:2.5 2.91:2.5 2.90:2.5 2.89:2.5 2.88:2.5 2.87:2.5 2.86:2.5 2.85:2.5 2.84:2.5 2.83:2.5 2.82:2.5 2.81:2.5 2.80:2.5 2.79:2.5 2.78:2.5 2.77:2.5 2.76:2.5 2.75:2.5 2.74:2.5 2.73:2.5 2.72:2.5 2.71:2.5 2.70:2.5 2.69:2.5 2.68:2.5 2.67:2.5 2.66:2.5 2.65:2.5 2.64:2.5 2.63:2.5 2.62:2.5 2.61:2.5 2.60:2.5 2.59:2.5  2.13:2.1
        With a base name of 'autoconf'.


Is there a way to work around or fix this? Or maybe I forgot some crucial eclipse settings?


[I] sys-devel/autoconf
Installed versions: 2.13(2.1)(21:55:47 10.07.2011) 2.68(2.5)(03:20:20 10.07.2011)(emacs)
[I] sys-devel/autoconf-wrapper
Installed versions: 10-r1(01:33:35 10.07.2011)
Back to top
View user's profile Send private message
Homer512
n00b
n00b


Joined: 04 Feb 2007
Posts: 13

PostPosted: Sat Oct 01, 2011 2:35 pm    Post subject: Reply with quote

I stumbled upon the same issue. The problem is that due to the way it is called, within the script $0 is set to "autoconf" and not "/usr/bin/autoconf". To fix it, I've patched the script to check for this case.

Try to replace it with the following code:
Code:

#!/bin/sh
# Copyright 1999-2011 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-11.sh,v 1.1 2011/06/11 23:37:38 vapier Exp $

# Based on the ac-wrapper.pl script provided by MandrakeSoft
# Rewritten in bash by Gregorio Guidi
#
# Executes the correct autoconf version.
#
# - defaults to newest version available (hopefully autoconf-2.60)
# - runs autoconf 2.13 if:
#   - envvar WANT_AUTOCONF is set to `2.1'
#     -or-
#   - `ac{local,include}.m4' or `configure.{in,ac}' have AC_PREREQ(2.1) (not higher)
#     -or-
#   - `configure' is already present and was generated by autoconf 2.13

warn() { printf "ac-wrapper: $*\n" 1>&2; }
err() { warn "$@"; exit 1; }

if [ "${0##*/}" = "ac-wrapper.sh" ] ; then
        err "Don't call this script directly"
fi

if [ "${WANT_AUTOCONF}" = "2.1" ] && [ "${0##*/}" = "autom4te" ] ; then
        err "Autoconf 2.13 doesn't contain autom4te.\n" \
            "   Either unset WANT_AUTOCONF or don't execute anything\n" \
            "   that would use autom4te."
fi


# Sanitize $0 in order to protect against stupid ways of calling this script
# such as `sh autoconf` which prevent $0 from being set to a valid path.
# Since we cannot manipulate $0, use $script instead.
if [ -x "$0" ]; then
    script="$0"
else
    script=$(which "$0")
fi

if ! seq 0 0 2>/dev/null 1>&2 ; then #338518
        seq() {
                local f l i
                case $# in
                        1) f=1 i=1 l=$1;;
                        2) f=$1 i=1 l=$2;;
                        3) f=$1 i=$2 l=$3;;
                esac
                while :; do
                        [ $l -lt $f -a $i -gt 0 ] && break
                        [ $f -lt $l -a $i -lt 0 ] && break
                        echo $f
                        : $(( f += i ))
                done
                return 0
        }
fi

#
# Set up bindings between actual version and WANT_AUTOCONF
#
vers="9999:2.5 $(printf '2.%s:2.5 ' `seq 99 -1 59`) 2.13:2.1"

binary=""
for v in ${vers} ; do
        auto_ver=${v%:*}
        if [ -z "${binary}" ] && [ -x "${script}-${auto_ver}" ] ; then
                binary="${script}-${auto_ver}"
        fi
done
if [ -z "${binary}" ] ; then
        err "Unable to locate any usuable version of autoconf.\n" \
            "\tI tried these versions: ${vers}\n" \
            "\tWith a base name of '${script}'."
fi

#
# Check the WANT_AUTOCONF setting.  We accept a whitespace delimited
# list of autoconf versions.
#
if [ -n "${WANT_AUTOCONF}" ] ; then
        for v in ${vers} x ; do
                if [ "${v}" = "x" ] ; then
                        warn "warning: invalid WANT_AUTOCONF '${WANT_AUTOCONF}'; ignoring."
                        unset WANT_AUTOCONF
                        break
                fi

                auto_ver=${v%:*}
                want_ver=${v#*:}
                for wx in ${WANT_AUTOCONF} ; do
                        if [ "${wx}" = "${want_ver}" ] && [ -x "${script}-${auto_ver}" ] ; then
                                binary="${script}-${auto_ver}"
                                v="x"
                        fi
                done
                [ "${v}" = "x" ] && break
        done
fi

#
# autodetect helpers
#
acprereq_version() {
        gawk \
        '($script !~ /^[[:space:]]*(#|dnl)/) {
                if (match($script, "AC_PREREQ\\(\\[?([0-9]\\.[0-9])", res))
                        VERSIONS[COUNT++] = res[1]
        }

        END {
                asort(VERSIONS)
                print VERSIONS[COUNT]
        }' "$@"
}

generated_version() {
        gawk \
        '{
                if (match($script,
                          "^# Generated (by (GNU )?Autoconf|automatically using autoconf version) ([0-9].[0-9])",
                          res)) {
                        print res[3]
                        exit
                }
        }' "$@"
}

#
# autodetect routine
#
if [ "${WANT_AUTOCONF}" = "2.1" ] && [ -f "configure.ac" ] ; then
        err "Since configure.ac is present, aclocal always use\n" \
            "\tautoconf 2.59+, which conflicts with your choice and\n" \
            "\tcauses error. You have two options:\n" \
            "\t1. Try execute command again after removing configure.ac\n" \
            "\t2. Don't set WANT_AUTOCONF"
fi

if [ "${WANT_AUTOCONF}" != "2.5" ] && [ -n "${WANT_AUTOMAKE}" ] ; then
        # Automake-1.7 and better require autoconf-2.5x so if WANT_AUTOMAKE
        # is set to an older version, let's do some sanity checks.
        case "${WANT_AUTOMAKE}" in
        1.[456])
                acfiles=$(ls ac{local,include}.m4 configure.{in,ac} 2>/dev/null)
                [ -n "${acfiles}" ] && confversion=$(acprereq_version ${acfiles})
               
                [ -z "${confversion}" ] && [ -r "configure" ] \
                        && confversion=$(generated_version configure)

                if [ "${confversion}" = "2.1" ] && [ ! -f "configure.ac" ] ; then
                        binary="${script}-2.13"
                fi
        esac
fi

if [ -n "${WANT_ACWRAPPER_DEBUG}" ] ; then
        if [ -n "${WANT_AUTOCONF}" ] ; then
                warn "DEBUG: WANT_AUTOCONF is set to ${WANT_AUTOCONF}"
        fi
        warn "DEBUG: will execute <${binary}>"
fi

#
# for further consistency
#
for v in ${vers} ; do
        auto_ver=${v%:*}
        want_ver=${v#*:}
        if [ "${binary}" = "${script}-${auto_ver}" ] ; then
                export WANT_AUTOCONF="${want_ver}"
        fi
done

#
# Now try to run the binary
#
if [ ! -x "${binary}" ] ; then
        # this shouldn't happen
        err "${binary} is missing or not executable.\n" \
            "\tPlease try emerging the correct version of autoconf."
fi

exec "${binary}" "$@"

err "was unable to exec ${binary} !?"


The only change is that it now sets a variable $script and uses it instead of $0.
Back to top
View user's profile Send private message
Homer512
n00b
n00b


Joined: 04 Feb 2007
Posts: 13

PostPosted: Sat Oct 01, 2011 3:22 pm    Post subject: Reply with quote

I've filed a bug: sys-devel/autoconf ac-wrapper.sh fails when called from Eclipse with autotools support.
Back to top
View user's profile Send private message
Yminus
Apprentice
Apprentice


Joined: 06 Jan 2008
Posts: 184

PostPosted: Sat Oct 01, 2011 11:38 pm    Post subject: Reply with quote

Thank you for fixing this and posting the fix here!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum