diff --git a/CMakeLists.txt b/CMakeLists.txt index 41dbde5d..93012159 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,8 +16,16 @@ execute_process( set(CMAKE_RUNTIME_OUTPUT_DIRECTORY bin) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY lib) -set(CMAKE_C_FLAGS "-Wall -Wextra -std=c99") +set(CMAKE_C_FLAGS "-Wall -Wextra") set(CMAKE_C_FLAGS_DEBUG "-g -DDEBUG=1") + +option(USE_C11_FEATURE "Enable c11 feature" OFF) +if(USE_C11_FEATURE) + add_definitions(-std=c11) +else() + add_definitions(-std=c99) # at least c99 is required +endif() + include_directories(include extlib) # build picrin diff --git a/README.md b/README.md index 4152ea6b..f7cfe12b 100644 --- a/README.md +++ b/README.md @@ -35,12 +35,12 @@ There is a chat room on chat.freenode.org, channel #picrin. - make `Makefile` - Change directory to `build` then run `cmake` to create Makefile. Once `Makefile` is generated you can run `make` command to build picrin. + Change directory to `build` then run `ccmake` to create Makefile. Once `Makefile` is generated you can run `make` command to build picrin. $ cd build - $ cmake .. + $ ccmake .. - Actually you don't necessarily need to move to `build` directory before running `cmake` (in that case `$ cmake .`), but I strongly recommend to follow above instruction. + Actually you don't necessarily need to move to `build` directory before running `ccmake` (in that case `$ ccmake .`), but I strongly recommend to follow above instruction. - build diff --git a/docs/intro.rst b/docs/intro.rst index 06e75b88..e81632df 100644 --- a/docs/intro.rst +++ b/docs/intro.rst @@ -21,13 +21,13 @@ Installation - make `Makefile` -Change directory to `build` then run `cmake` to create Makefile. Once `Makefile` is generated you can run `make` command to build picrin:: +Change directory to `build` then run `ccmake` to create Makefile. Once `Makefile` is generated you can run `make` command to build picrin:: $ cd build - $ cmake .. + $ ccmake .. -Actually you don't necessarily need to move to `build` directory before running `cmake` (in that case `$ cmake .`), but I strongly recommend to follow above instruction. +Actually you don't necessarily need to move to `build` directory before running `ccmake` (in that case `$ ccmake .`), but I strongly recommend to follow above instruction. - build diff --git a/include/picrin/config.h b/include/picrin/config.h index 2d5fd2a2..2acfe0ea 100644 --- a/include/picrin/config.h +++ b/include/picrin/config.h @@ -45,6 +45,10 @@ /* #define GC_DEBUG 1 */ /* #define GC_DEBUG_DETAIL 1 */ +#if __STDC_VERSION__ < 199901L +# error please activate c99 features +#endif + #ifndef PIC_CONTRIB_INITS # define PIC_CONTRIB_INITS #endif @@ -56,7 +60,7 @@ #endif #ifndef PIC_NAN_BOXING -# if __x86_64__ +# if __x86_64__ && __STDC_VERSION__ >= 201112L # define PIC_NAN_BOXING 1 # endif #endif