Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

5.1.2 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 (see Header Files).

Most generic macros use the following macro to provide the default set of includes:

— Macro: AC_INCLUDES_DEFAULT ([include-directives])

Expand to include-directives if defined, otherwise to:

          #include <stdio.h>
          #if HAVE_SYS_TYPES_H
          # include <sys/types.h>
          #endif
          #if HAVE_SYS_STAT_H
          # include <sys/stat.h>
          #endif
          #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>
          #endif
          #if HAVE_STRINGS_H
          # include <strings.h>
          #endif
          #if HAVE_INTTYPES_H
          # include <inttypes.h>
          #endif
          #if HAVE_STDINT_H
          # include <stdint.h>
          #endif
          #if HAVE_UNISTD_H
          # include <unistd.h>
          #endif
     

If the default includes are used, then check for the presence of these headers and their compatibility, i.e., you don't need to run AC_HEADER_STDC, nor check for stdlib.h etc.

These headers are checked for in the same order as they are included. For instance, on some systems string.h and strings.h both exist, but conflict. Then HAVE_STRING_H is defined, not HAVE_STRINGS_H.


 
 
  Published under the terms of the GNU General Public License Design by Interspire