[Top][All Lists]

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

RE: finding the value of a preprocessor symbol

From: David Byron
Subject: RE: finding the value of a preprocessor symbol
Date: Sun, 24 Jan 2010 08:22:21 -0800

On Sunday, January 24, 2010, Ralf Wildenhues wrote: 

> * David Byron wrote on Fri, Jan 22, 2010 at 12:38:03AM CET:
> > Let's say I have a header file named foo.h that contains:
> > 
> > #define FOO an_interesting_value
> > 
> > (I think) I'm looking for a macro like this:
> > 
> > AC_GET_VALUE([foo.h],[FOO])
> > 
> > that populates ac_cv_value_of_FOO with an_interesting_value
> > 
> > Does such a macro exist?  Apologies if this is a FAQ.  I
> > can think of a way to do this by compiling a program
> > that writes the result to a file, but that seems
> > complicated and a struggle when cross-compiling.
> There is AC_COMPUTE_INT which allows you to compute the
> integer (signed long) value of an arbitrary compile-time
> expression.  It is a bit overkill for your case (in a
> cross-compile situation, it may need up to log_2(value)
> compilations to find the value), but should work
> nonetheless.

I'm looking for a non-integer value in this case.

> Autoconf provides AC_EGREP_CPP but that doesn't let you
> get at the matched string.  I think we should add
> something like this, or allow AC_PREPROC_IFELSE to store
> its output for inspection in the IF-TRUE branch.

Making the output available on the IF-TRUE branch of AC_PREPROC_IFELSE is
the thing that came to mind to me first.  As I mentioned before I think I've
convinced myself to go about what I'm doing a different way but I bet this
would be useful to me sometime in the future or to other folks.

Thanks much.


reply via email to

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