Provide better feature checking for stdbool

This commit is contained in:
c9s 2015-11-17 21:31:33 +08:00
parent 3808cb37aa
commit c128cdef13
5 changed files with 23 additions and 23 deletions

View file

@ -22,7 +22,6 @@ endif
r3_includedir = $(includedir)/r3 r3_includedir = $(includedir)/r3
r3_include_HEADERS = \ r3_include_HEADERS = \
include/r3.h \ include/r3.h \
include/r3_define.h \
include/r3_list.h \ include/r3_list.h \
include/r3_slug.h \ include/r3_slug.h \
include/r3_gvc.h \ include/r3_gvc.h \

View file

@ -10,6 +10,7 @@ AC_PROG_CC
AC_PROG_CC_STDC AC_PROG_CC_STDC
AC_PROG_CXX AC_PROG_CXX
AC_PROG_INSTALL AC_PROG_INSTALL
AC_HEADER_STDBOOL
# older debian # older debian
AC_PROG_LIBTOOL AC_PROG_LIBTOOL

View file

@ -11,11 +11,31 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <pcre.h> #include <pcre.h>
#ifdef HAVE_STDBOOL_H
#include <stdbool.h> #include <stdbool.h>
#include "r3_define.h"
#else
#if !defined(bool) && !defined(__cplusplus)
typedef unsigned char bool;
#endif
#ifndef FALSE
# define FALSE 0
#endif
#ifndef TRUE
# define TRUE 1
#endif
#endif
#include "str_array.h" #include "str_array.h"
#include "r3_slug.h" #include "r3_slug.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif

View file

@ -1,20 +0,0 @@
/*
* r3_define.h
* Copyright (C) 2014 c9s <yoanlin93@gmail.com>
*
* Distributed under terms of the MIT license.
*/
#ifndef DEFINE_H
#define DEFINE_H
#include <stdbool.h>
#if !defined(bool) && !defined(__cplusplus)
typedef unsigned char bool;
#endif
#ifndef FALSE
# define FALSE 0
#endif
#ifndef TRUE
# define TRUE 1
#endif
#endif /* !DEFINE_H */

View file

@ -5,5 +5,5 @@
"description": "high-performance path dispatching library", "description": "high-performance path dispatching library",
"keywords": ["path", "dispatch", "performance", "r3", "c9s"], "keywords": ["path", "dispatch", "performance", "r3", "c9s"],
"license": "MIT", "license": "MIT",
"src": ["3rdparty/zmalloc.c", "3rdparty/zmalloc.h", "include/r3.h", "include/r3.hpp", "include/r3_define.h", "include/r3_gvc.h", "include/r3_json.h", "include/r3_list.h", "include/r3_slug.h", "include/str_array.h", "src/edge.c", "src/gvc.c", "src/json.c", "src/list.c", "src/match_entry.c", "src/node.c", "src/slug.c", "src/slug.h", "src/str.c", "src/token.c"] "src": ["3rdparty/zmalloc.c", "3rdparty/zmalloc.h", "include/r3.h", "include/r3.hpp", "include/r3_gvc.h", "include/r3_json.h", "include/r3_list.h", "include/r3_slug.h", "include/str_array.h", "src/edge.c", "src/gvc.c", "src/json.c", "src/list.c", "src/match_entry.c", "src/node.c", "src/slug.c", "src/slug.h", "src/str.c", "src/token.c"]
} }