autoconf
[Top][All Lists]
Advanced

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

Re: Testing autoconf-cvs


From: Akim Demaille
Subject: Re: Testing autoconf-cvs
Date: 17 Apr 2001 18:03:00 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.1 (Cuyahoga Valley)

|  I finally got around to do some testing with real-world software.
|  So far, I haven't seen any major problems, but there are a few
|  little things I'd like to have explained, as I didn't follow the
|  discussions here too closely.
| 
|  Consider the following configure.in fragment. It checks whether the
|  sig_atomic_t type is defined in signal.h, and whether it's declared
|  volatile:
| 
| AC_MSG_CHECKING(for sig_atomic_t in signal.h)
| AC_EGREP_HEADER(sig_atomic_t,signal.h,
|   [
|     ac_cv_type_sig_atomic_t=yes;
|     AC_EGREP_HEADER(volatile.*sig_atomic_t,
|                     signal.h,
|                     [
|                         is_sig_atomic_t_volatile=yes;
|                         AC_MSG_RESULT([yes, volatile])
|                     ],
|                     [
|                         is_sig_atomic_t_volatile=no;
|                         AC_MSG_RESULT([yes, non volatile])
|                     ])
|   ],
|   [
|     AC_MSG_RESULT(no)
|     AC_CHECK_TYPE(sig_atomic_t, int)
|     is_sig_atomic_t_volatile=no
|   ])
| 
|  An autoconf 2.13 generated configure script generates the following output:
| 
| checking for sig_atomic_t in signal.h... yes, non volatile
| 
|  An autoconf 2.49e (today's cvs) creates this output:
| 
| checking for sig_atomic_t in signal.h... checking for stdlib.h... yes
| checking for string.h... (cached) yes
| checking for memory.h... yes
| checking for strings.h... yes
| checking for inttypes.h... yes
| checking for unistd.h... yes
| yes, non volatile
| 
|  I'd like to know why autoconf inserts this "virtual" AC_CHECK_HEADERS
|  code.

Generic Type Checks
-------------------

   These macros are used to check for types not covered by the
"particular" test macros.

 - Macro: AC_CHECK_TYPE (TYPE, [ACTION-IF-FOUND],
          [ACTION-IF-NOT-FOUND], [INCLUDES])
     Check whether TYPE is defined.  It may be a compiler builtin type
     or defined by the [INCLUDES] (*note Default Includes::).

and

Default Includes
----------------

   Several tests depend upon a set of header files.  Since these headers
are not universally available, tests actually have to provide a set of
protected includes, such as:

     #if TIME_WITH_SYS_TIME
     # include <sys/time.h>
     # include <time.h>
     #else
     # if HAVE_SYS_TIME_H
     #  include <sys/time.h>
     # else
     #  include <time.h>
     # endif
     #endif

Unless you know exactly what you are doing, you should avoid using
unconditional includes, and check the existence of the headers you
include beforehand (*note Header Files::).

   Most generic macros provide the following default set of includes:

     #include <stdio.h>
     #include <sys/types.h>
     #include <sys/stat.h>
     #if STDC_HEADERS
     # include <stdlib.h>
     # include <stddef.h>
     #else
     # if HAVE_STDLIB_H
     #  include <stdlib.h>
     # endif
     #endif
     #if HAVE_STRING_H
     # if !STDC_HEADERS && HAVE_MEMORY_H
     #  include <memory.h>
     # endif
     # include <string.h>
     #else
     # if HAVE_STRINGS_H
     #  include <strings.h>
     # endif
     #endif
     #if HAVE_INTTYPES_H
     # include <inttypes.h>
     #endif
     #if HAVE_UNISTD_H
     # include <unistd.h>
     #endif

   If the default includes are used, then Autoconf will automatically
check for the presence of these headers, i.e., you don't need to run
`AC_HEADERS_STDC', nor check for `stdlib.h' etc.



reply via email to

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