autoconf
[Top][All Lists]
Advanced

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

Re: Nesting m4 macros


From: Stefano Lattarini
Subject: Re: Nesting m4 macros
Date: Mon, 6 Sep 2010 12:33:28 +0200
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

On Monday 06 September 2010, Matthias Wichtlhuber wrote:
> Hi list,
Hello Matthias.

> this is my first post here, so I hope this is the right list
Yes, it is.

> and I am not violating the netiquette.
> 
> I'm a complete autoconf newbie. For a small project I want to test,
> whether the cuda NVCC compiler's version is appropriate. The
> version is appropriate, when the output of the command "nvcc
> --version" contains the string "release 3.0". If not, I want to
> print a warning.
> 
> AS_IF([test m4_index([m4_esyscmd([nvcc --version])], [release 3.0])
> -eq -1],[
>                  AC_MSG_WARN([NVCC compiler version is NOT 3.0!])
>          ])
> 
> Unfortunately the condition in the AS_IF always evaluates to true,
> so the warning is always printed.
> M4 seems to treat the esyscmd as a string.
Could you show relevant excerpts from the generated configure, and
the messages generated by ./configure run?
> I have tried every thinkable way of quoting this. Any ideas?
Well, you are doing something fundamentally wrong.  You should do the
check on nvcc when configure is run, not when configure is generated
(which happens only on the developer system); so, use something like
this (untested):

  AS_IF([nvcc --version | grep 'release 3\.0'],
        [# the nvcc version is correct: nothing to do],
        [AC_MSG_WARN([NVCC compiler version is NOT 3.0!])])

Let me elaborate more on this.

The `m4_esyscmd' is expected to be expanded by m4 when autoconf is run,
so it would check the version of nvcc on the system of the developer
running autoconf, not on the system of the user which will run configure
-- consequently rendering the check useless.

It seems to me that you are *greatly* misunderstanding how autoconf
works.  Have you read any tutorial about the autotools?  If not, I
suggest this: <http://www.lrde.epita.fr/~adl/autotools.html>, which
I find it very clear, and which helped me a lot in the past.

HTH,
  Stefano



reply via email to

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