From e001b30f18c6a46318d28d6a2446ab9e46a1455b Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Wed, 23 Oct 2002 15:18:57 +0000 Subject: Define bool=char, true=1, and false=0 for C++ compilers that don't support bool. This isn't as nice as the config.h solution, but it will make sure that apps that use fltk-config to get the CXXFLAGS will work on all compilers. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2688 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- configh.in | 20 ++------------------ configure.in | 33 ++++++++++++++++++--------------- 2 files changed, 20 insertions(+), 33 deletions(-) diff --git a/configh.in b/configh.in index 0abefa4a0..c08e91871 100644 --- a/configh.in +++ b/configh.in @@ -1,5 +1,5 @@ /* - * "$Id: configh.in,v 1.11.2.11.2.14 2002/10/22 13:45:23 easysw Exp $" + * "$Id: configh.in,v 1.11.2.11.2.15 2002/10/23 15:18:56 easysw Exp $" * * Configuration file for the Fast Light Tool Kit (FLTK). * @configure_input@ @@ -31,22 +31,6 @@ #define FLTK_DATADIR "" #define FLTK_DOCDIR "" -/* - * Old C++ compilers don't support the bool type; unfortunately, it crept - * into FLTK 1.1.0 (Fl_Text_*) when we updated to the latest NEdit code, - * but we didn't notice it before 1.1.0 went out the door. Rather than - * break binary compatibility or do a 1.2.0 release for the sake of the - * few old C++ compilers that can't handle it, the following definitions - * allow older compilers to compile code using the bool type... - */ - -#undef HAVE_BOOL - -#if !defined(HAVE_BOOL) && defined(__cplusplus) -typedef char bool; -enum { false, true }; -#endif /* !HAVE_BOOL */ - /* * BORDER_WIDTH: * @@ -236,5 +220,5 @@ enum { false, true }; /* - * End of "$Id: configh.in,v 1.11.2.11.2.14 2002/10/22 13:45:23 easysw Exp $". + * End of "$Id: configh.in,v 1.11.2.11.2.15 2002/10/23 15:18:56 easysw Exp $". */ diff --git a/configure.in b/configure.in index af66c7552..931b520b9 100644 --- a/configure.in +++ b/configure.in @@ -1,7 +1,7 @@ dnl -*- sh -*- dnl the "configure" script is made from this by running GNU "autoconf" dnl -dnl "$Id: configure.in,v 1.33.2.31.2.89 2002/10/22 13:45:23 easysw Exp $" +dnl "$Id: configure.in,v 1.33.2.31.2.90 2002/10/23 15:18:57 easysw Exp $" dnl dnl Configuration script for the Fast Light Tool Kit (FLTK). dnl @@ -280,19 +280,22 @@ fi dnl Does the C++ compiler support the bool type? AC_CACHE_CHECK(whether the compiler recognizes bool as a built-in type, -ac_cv_cxx_bool, -[AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([ -int f(int x){return 1;} -int f(char x){return 1;} -int f(bool x){return 1;} -],[bool b = true; return f(b);], - ac_cv_cxx_bool=yes, ac_cv_cxx_bool=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_cxx_bool" = yes; then - AC_DEFINE(HAVE_BOOL) + ac_cv_cxx_bool,[ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE([ + int f(int x){return 1;} + int f(char x){return 1;} + int f(bool x){return 1;} + ],[ + bool b = true; + return f(b); + ], ac_cv_cxx_bool=yes, ac_cv_cxx_bool=no) + AC_LANG_RESTORE + ]) + +if test "$ac_cv_cxx_bool" != yes; then + CXXFLAGS="-Dbool=char -Dfalse=0 -Dtrue=1 $CXXFLAGS" fi dnl Standard headers and functions... @@ -802,5 +805,5 @@ dnl Make sure the fltk-config script is executable... chmod +x fltk-config dnl -dnl End of "$Id: configure.in,v 1.33.2.31.2.89 2002/10/22 13:45:23 easysw Exp $". +dnl End of "$Id: configure.in,v 1.33.2.31.2.90 2002/10/23 15:18:57 easysw Exp $". dnl -- cgit v1.2.3