autoconf
[Top][All Lists]
Advanced

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

RE: Writing New Macros


From: Eric Lemings
Subject: RE: Writing New Macros
Date: Tue, 10 Apr 2007 09:07:11 -0600

 

> -----Original Message-----
> From: Eric Blake [mailto:address@hidden 
> Sent: Tuesday, April 10, 2007 6:14 AM
> To: Eric Lemings
> Cc: address@hidden
> Subject: Re: Writing New Macros
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> According to Eric Lemings on 4/9/2007 1:32 PM:
> > 2. An Autoconf macro that checks whether a given type is a built-in
> > type or not.  This macro is similar to AC_CHECK_TYPE except that it
> > performs action-if-built-in only if the type is a built-in type and
> > action-if-not-built-in if the type is not defined or not a built-in
> > type.
> > (Possibly the same as _AC_TYPE_CHECK_NEW without any 
> includes at all.)
> 
> Don't use undocumented autoconf internals (unless you are 
> writing a patch
> for autoconf itself).  The _AC namespace is reserved, and should not
> appear in your configure.ac.

It wouldn't.  I'm writing custom M4 macros that would appear in the
configure.ac and calls to the reserved _AC namespace would appear in
these custom macros.  Nothing wrong with that right?  :P

> But what's wrong with AC_CHECK_TYPE([int], [action-if-builtin],
> [action-if-not], [])?  In other words, explicitly tell 
> AC_CHECK_TYPE to
> use no includes.

Just as good.  :)

> > 3. An Autoconf macro that defines a preprocessor name with the
> > fundamental type as an existing type definition.
> > 
> >     FOO_REDEFINE_TYPE(FOO_INT8_T, int8_t, AC_INCLUDES_DEFAULT)
> > 
> > and the type __sys_int8_t is defined in <sys/types.h> as
> > 
> >     typedef char __sys_int8_t int8_t;
> 
> Typo, I hope.
> 
> Why are you doing this?  Avoiding header files seems like overkill; if
> they are there and they work, use them.  Meanwhile, based on 
> your mention
> of int8_t, you may be interested in the gnulib stdint module, which
> provides a good example of how to build a header that 
> provides all of the
> [u]int{8,16,32}_t types and friends using autoconf.
> http://www.gnu.org/software/gnulib/MODULES.html#module=stdint

Thanks for the link.

The reason for writing such macros is that in some environments these
headers are not available (e.g. embedded software) or should not be
available (e.g. when writing the standard library itself).  Very
uncommon situations.

Eric.




reply via email to

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