autoconf
[Top][All Lists]
Advanced

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

Re: AC_TYPE_UINT8_T and co


From: Stepan Kasal
Subject: Re: AC_TYPE_UINT8_T and co
Date: Wed, 30 May 2007 11:31:56 +0200
User-agent: Mutt/1.4.2.2i

Hello,

I'm afraid there are some misunderstandings here.  I'll try to
make things mor clear.

Let's start with your very first mail:
Until yesterday, the manual said:

| -- Macro: AC_TYPE_INT8_T
|     If `stdint.h' or `inttypes.h' defines the type `int8_t', define
|     `HAVE_INT8_T'.  Otherwise, define `int8_t' to ...

As you can see, if configure had to define `int8_t', then the symbol
`HAVE_INT8_T' is not defined.

So your implementation was wrong, instead of
+  if test "$ac_cv_c_int$1_t" != no; then
+    AC_DEFINE_UNQUOTED([HAVE_INT$1_T], [1], [Define if int$i_t exists.])
+  fi

you should rather call AC_DEFINE only if "$ac_cv_c_int$1_t" is "yes".

A side note: AC_DEFINE_UNQUOTED is not necessary, as the symbol
HAVE_INT8_T is expanded by autoconf when writing configure, the shell
expansion is not needed.

Consistently, when you followed my sugestion and used:

AC_TYPE_UINT8_T
AC_TYPE_SIZE_T
AC_CHECK_TYPES([uint8_t, size_t])

then HAVE_UINT8_T would get defined only if `uint8_t' exists on the
system, not if a substitute was defined by AC_TYPE_UINT8_T.

AC_CHECK_TYPES([uint8_t]) does not actually perform a second check,
it uses the findings of AC_TYPE_UINT8_T.
Observe the output of the configure script:
        checking for uint8_t... no
        checking for size_t... no
        checking for uint8_t... (cached) no
        checking for size_t... (cached) no

(You are right, if AC_CHECK_TYPES([uint8_t]) performed the check for
the second time, it might say "yes", because the just defined
`uint8_t' macro would have been found.)

On Tue, May 29, 2007 at 01:55:49PM +0100, Patrick Welche wrote:
> [...], a typdef for uint8_t appears in config.h,
> but it is only created at the end of configure, so how would a subsequent
> test in configure see the typedef?

BTW, it is not typedef, it is #define.

Yes, you are right, config.h is created at the end of the script in
AC_OUTPUT.  (No matter where AC_CONFIG_HEADERS is placed.)

But during the configure run, all preprocessor macros defined by
AC_DEFINE are stored in a file called confdefs.h.  And this file is
used for all test compiles.  This is why subsequent checks see the
#defines from previous ones.

Hope you find this mosaic of comments useful,
have a nice day,
        Stepan Kasal




reply via email to

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