Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2004:
[Freeciv-Dev] (PR#11298) [C++] Use AC_HEADER_STDBOOL to check for stdboo
Home

[Freeciv-Dev] (PR#11298) [C++] Use AC_HEADER_STDBOOL to check for stdboo

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#11298) [C++] Use AC_HEADER_STDBOOL to check for stdbool.h
From: "Frédéric Brière" <fbriere@xxxxxxxxxxx>
Date: Thu, 2 Dec 2004 00:55:22 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=11298 >

This patch replaces the generic AC_CHECK_HEADERS check for stdbool.h
with autoconf's own AC_HEADER_STDBOOL, which makes sure that stdbool.h
is actually C99-compliant.  GCC 2.95 shipped with a broken pre-C99
stdbool.h that cannot be included in C++, and didn't ensure
compatibility of the bool type between gcc and g++.

The goal of this patch is to enable C++ clients to require
HAVE_STDBOOL_H [*], and be confident that the C portion of the code will
use a bool type (namely C99's _Bool) that's API-compatible with the C++
bool.

The other effect of this patch is that stdbool.h will no longer be
included when using a non-C99 compiler (like gcc 2.95).  Such compilers
typically lack _Bool, and merely emulate the bool type via an enum or an
int, which is what common/shared.h will end up doing anyway.  No harm
done.


[*] The way it currently works, clients run their checks *before* the
    generic stuff in configure.ac, so that test will probably be run
    twice.  The point is to prevent autoconf.ac from overwriting the
    previous result by using a more generic test.

-- 
             Frédéric Brière    <*>    fbriere@xxxxxxxxxxx

 =>  <fbriere@xxxxxxxxxx> IS NO MORE:  <http://www.abacomsucks.com>  <=

Index: configure.ac
===================================================================
RCS file: /home/freeciv/CVS/freeciv/configure.ac,v
retrieving revision 1.86
diff -u -r1.86 configure.ac
--- configure.ac        13 Nov 2004 09:11:21 -0000      1.86
+++ configure.ac        2 Dec 2004 08:34:42 -0000
@@ -463,7 +463,8 @@
 AC_HEADER_STDC
 AC_HEADER_SYS_WAIT
 AC_CHECK_HEADERS(fcntl.h sys/time.h sys/types.h unistd.h sys/utsname.h \
-                 stdbool.h sys/file.h)
+                 sys/file.h)
+AC_HEADER_STDBOOL
 dnl Avoid including the unix emulation layer if we build mingw executables
 dnl There would be type conflicts between winsock and bsd/unix includes
 if test "x$MINGW32" != "xyes"; then

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#11298) [C++] Use AC_HEADER_STDBOOL to check for stdbool.h, Frédéric Brière <=