libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit c99bb7febbe4ad5f36b1882c94c51e6429a0e7d4
parent 194d72e1f9628d9dd3e732ef2e199f7d4c43afd6
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Wed, 16 Nov 2016 21:17:00 +0300

configure.ac: check for "true" and "false" and substitute a replacement if required.
This will allow to use "true" and "false" in code, even if compiler don't support them internally.

Diffstat:
Mconfigure.ac | 57+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 57 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac @@ -126,6 +126,63 @@ AC_CHECK_HEADER([stdbool.h], [AC_INCLUDES_DEFAULT] ) +AC_CACHE_CHECK([[whether "true" is defined or builtin]], [[mhd_cv_macro_true_defined]], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ +#ifdef HAVE_STDBOOL_H +#include <stdbool.h> +#endif + ]], [[ +#if defined(true) + /* dummy */ +#else + (void)true; +#endif + ]]) + ], [[mhd_cv_macro_true_defined='yes']], [[mhd_cv_macro_true_defined='no']]) + ]) +AS_VAR_IF([[mhd_cv_macro_true_defined]], [["yes"]], [[:]], + [AC_DEFINE([[true]],[[(!0)]], [Define to value interpreted by compiler as boolean "true", if "true" is not defined by system headers.])]) + +AC_CACHE_CHECK([[whether "false" is defined or builtin]], [[mhd_cv_macro_false_defined]], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ +#ifdef HAVE_STDBOOL_H +#include <stdbool.h> +#endif + ]], [[ +#if !defined(false) + (void)false; +#else + /* dummy */ +#endif + ]]) + ], [[mhd_cv_macro_false_defined='yes']], [[mhd_cv_macro_false_defined='no']]) + ]) +AS_VAR_IF([[mhd_cv_macro_false_defined]], [["yes"]], [[:]], + [AC_DEFINE([[false]],[[0]], [Define to value interpreted by compiler as boolean "false", if "false" is not defined by system headers.])]) + +AC_CACHE_CHECK([[whether "true" and "false" could be used]], [[mhd_cv_macro_true_false_valid]], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ +#ifdef HAVE_STDBOOL_H +#include <stdbool.h> +#endif + ]], [[ + int var1[true ? 1 : -1] = { 1 }; + int var2[false ? -1 : 1] = { 2 }; + if (var1[0] == var2[0]) + return 1; + ]]) + ], [[mhd_cv_macro_true_false_valid='yes']], [[mhd_cv_macro_true_false_valid='no']]) + ]) +AS_VAR_IF([[mhd_cv_macro_true_false_valid]], [["yes"]], [[:]], + [AC_MSG_ERROR([[Value of "true" or value of "false" is not valid. Check config.log for details.]])]) + + AX_CHECK_COMPILE_FLAG([[-Werror=attributes]], [[errattr_CFLAGS="-Werror=attributes"]], [[errattr_CFLAGS=""]], [], [])