autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: simple autoconf question


From: Nick Bowler
Subject: Re: simple autoconf question
Date: Tue, 20 Dec 2011 14:57:48 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

Hi Eric,

First, some general comments (not specific to your problem):

On 2011-12-20 14:28 -0500, Eric Gorr wrote:
> I am just starting to experiment with build tools like autoconf, etc.
> and had what I am sure is a silly/stupid/easy question, but one that I
> still don't know the answer to.
> 
> I am just trying to write a very simple, "hello, world" configure.ac
> script using a AC_DEFUN macro that I wrote to print "hello world".
> What I have is the following:
> 
>    AC_PREREQ(2.61)
>    AC_INIT(autoconf_test, 1.0,address@hidden)

It's generally good form to quote (with [brackets]) all the arguments to
macros unless you have a good reason not to.  It shouldn't matter for
the above, but further down...

>    # EG_MY_MACRO
>    # -----------------------------
>    AC_DEFUN( [EG_MY_MACRO],
>    m4_warn( [all], [hello world] )
>    ) # EG_MY_MACRO

Assuming that it actually worked, this m4_warn is not quoted so it will
be executed (and the warning printed) _before_ the AC_DEFUN is.  This is
probably not what you want, since this means the warning will be printed
unconditionally (whether or not the script actually uses EG_MY_MACRO
anywhere else).

Nevertheless, this is still technically valid, so it shouldn't be the
cause of your issue.

>    #EG_MY_MACRO
> 
> However, when I execute autoconf, I get the following error message:
> 
>    ~/depot/autoconf_test $autoconf
>    unknown channel all at /usr/bin/../share/autoconf/Autom4te/Channels.pm 
> line 546
>        Autom4te::Channels::msg('all', 'configure.ac:8', 'warning: hello world 
> ') called at /usr/bin/autom4te line 1012

Interesting!  The autoconf manual suggests that this should work.
Indeed, if you use any of the other documented categories instead of
"all" (i.e., cross, obsolete or syntax), the above works fine.

> and there is no configure script generated.

Right, this looks like a bug (possibly in the manual) to me.

> Furthermore, what prompted this question is one I posted to
> stackoverflow...if you know the answer to this, I would be interested.
> 
> http://stackoverflow.com/questions/8578181/using-the-pkg-config-macro-pkg-check-modules-failing
> 
> I'm sure this is a fairly simple problem. I have a very simple
> configure.ac file which I am using to just learn how autoconf &
> pkg-config work together. The confgure.ac file looks like:
> 
>    AC_PREREQ(2.61)
>    AC_INIT(autoconf_test, 1.0,address@hidden)
> 
>    PKG_CHECK_MODULES(libusbmuxd, libusbmuxd >= 0.1.4)

This script also suffers from a lack of quoting, although again it's not
the root cause of your issue.

> I can then execute autoconf from the command line and it does produce
> a configure script. However, when I run the configure script, I get
> the following error:
> 
>    ./configure: line 1618: syntax error near unexpected token `libusbmuxd,'
>    ./configure: line 1618: `PKG_CHECK_MODULES(libusbmuxd, libusbmuxd >= 
> 0.1.4)'

The problem here is that the PKG_CHECK_MODULES macro is not defined at
autoconf time.  Perhaps aclocal needs to be run with an appropriate -I
option to find the macro (maybe it's installed in a nonstandard path, or
not installed at all?).

Hope that helps,
-- 
Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]