From: Enblend <enb...@li...> - 2014-08-26 16:25:44
|
branch: details: http://enblend.hg.sourceforge.net/hgweb/enblend/enblend/hg/p/enblend/code/rev/e5ac8802c888 changeset: 1073:e5ac8802c888 user: tmodes date: Tue Aug 26 18:13:38 2014 +0200 description: CMake: Use CMake own code for creation of entries in config.h instead of an additional hand crafted line in config.h.cmake diffstat: ConfigureChecks.cmake | 17 +++++++ VERSION | 2 +- config.h.cmake | 121 +------------------------------------------------ 3 files changed, 21 insertions(+), 119 deletions(-) diffs (201 lines): diff -r 73087a2638cb -r e5ac8802c888 ConfigureChecks.cmake --- a/ConfigureChecks.cmake Tue Aug 26 18:06:37 2014 +0200 +++ b/ConfigureChecks.cmake Tue Aug 26 18:13:38 2014 +0200 @@ -17,6 +17,19 @@ include(CheckFunctionExists) include(TestBigEndian) +MACRO(AddHeaderTestToConfig header var) +STRING(CONFIGURE "/* Define if you have the <${header}> header file. */\n#cmakedefine ${var} 1\n" _str) +SET(CMAKE_HEADER_EXISTS "${CMAKE_HEADER_EXISTS}${_str}\n") +UNSET(_str) +ENDMACRO() + +MACRO(AddFunctionTestToConfig function var) +STRING(CONFIGURE "/* Define if you have the '${function}' function. */\n#cmakedefine ${var} 1\n" _str) +SET(CMAKE_FUNCTION_EXISTS "${CMAKE_FUNCTION_EXISTS}${_str}\n") +UNSET(_str) +ENDMACRO() + + #Check for some include files and set appropriate variables # e.g. "sys/dir.h" found => "HAVE_SYS_DIR_H" set to 1 foreach(_fl "dirent.h" "ext/slist" "fenv.h" @@ -26,6 +39,7 @@ string(REGEX REPLACE "[/\\.]" "_" _var ${_fl}) string(TOUPPER "${_var}" _FLN) check_include_file_cxx("${_fl}" "HAVE_${_FLN}" ) + AddHeaderTestToConfig("${_fl}" "HAVE_${_FLN}") endforeach() #Check for functions @@ -35,6 +49,7 @@ strchr strcspn strdup strerror strerror_r strrchr strtol strtok_r) string(TOUPPER "${_fc}" _FC) check_function_exists(${_fc} "HAVE_${_FC}") + AddFunctionTestToConfig("${_fc}" "HAVE_${_FC}") endforeach() if(HAVE_DIRENT_H) @@ -49,6 +64,7 @@ endif(HAVE_DIRENT_H) CHECK_LIBRARY_EXISTS(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME) +AddFunctionTestToConfig("clock_gettime" "HAVE_CLOCK_GETTIME") # Check for restrict keyword # Builds the macro A_C_RESTRICT form automake @@ -122,6 +138,7 @@ int main(){return(0);} " HAVE_SYS_NDIR_H) +AddHeaderTestToConfig("sys/ndir.h" "HAVE_SYS_NDIR_H") check_include_files("stdlib.h;stdarg.h;string.h;float.h" STDC_HEADERS) check_cxx_source_compiles( diff -r 73087a2638cb -r e5ac8802c888 VERSION --- a/VERSION Tue Aug 26 18:06:37 2014 +0200 +++ b/VERSION Tue Aug 26 18:13:38 2014 +0200 @@ -1,1 +1,1 @@ -4.2-e38942633f9f +4.2-73087a2638cb diff -r 73087a2638cb -r e5ac8802c888 config.h.cmake --- a/config.h.cmake Tue Aug 26 18:06:37 2014 +0200 +++ b/config.h.cmake Tue Aug 26 18:13:38 2014 +0200 @@ -16,133 +16,18 @@ Enblend and Enfuse report progress in detail. */ #define DEFAULT_VERBOSITY 1 +${CMAKE_HEADER_EXISTS} +${CMAKE_FUNCTION_EXISTS} + /* Define to 1 if the `closedir' function returns void instead of `int'. */ #cmakedefine CLOSEDIR_VOID 1 -/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'. - */ -#cmakedefine HAVE_DIRENT_H 1 - -/* Define if you have the <ext/slist> header file */ -#cmakedefine HAVE_EXT_SLIST 1 - -/* Define to 1 if you have the <fenv.h> header file. */ -#cmakedefine HAVE_FENV_H 1 - -/* Define to 1 if you have the `fesetround' function. */ -#cmakedefine HAVE_FESETROUND 1 - -/* Define to 1 if you have the `floor' function. */ -#cmakedefine HAVE_FLOOR 1 - -/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ -#cmakedefine HAVE_FSEEKO 1 - -/* Define to 1 if you have the <inttypes.h> header file. */ -#cmakedefine HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the <limits.h> header file. */ -#cmakedefine HAVE_LIMITS_H 1 - -/* Define if you have C99's lrint function. */ -#cmakedefine HAVE_LRINT 1 - -/* Define if you have C99's lrintf function. */ -#cmakedefine HAVE_LRINTF 1 - -/* Define to 1 if your system has a GNU libc compatible `malloc' function, and - to 0 otherwise. */ -#cmakedefine HAVE_MALLOC 1 - -/* Define to 1 if you have the 'clock_gettime' function. */ -#cmakedefine HAVE_CLOCK_GETTIME 1 - -/* Define to 1 if you have the <memory.h> header file. */ -#cmakedefine HAVE_MEMORY_H 1 - -/* Define to 1 if you have the `memset' function. */ -#cmakedefine HAVE_MEMSET 1 - -/* Define to 1 if you have the `mkstemp' function. */ -#cmakedefine HAVE_MKSTEMP 1 - -/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */ -#cmakedefine HAVE_NDIR_H 1 - -/* Define to 1 if you have the `pow' function. */ -#cmakedefine HAVE_POW 1 - /* Define if you have POSIX threads libraries and header files. */ #cmakedefine HAVE_PTHREAD 1 /* Define to 1 if the system has the type `ptrdiff_t'. */ #cmakedefine HAVE_PTRDIFF_T 1 -/* Define to 1 if you have the `sqrt' function. */ -#cmakedefine HAVE_SQRT 1 - -/* Define to 1 if stdbool.h conforms to C99. */ -#cmakedefine HAVE_STDBOOL_H 1 - -/* Define to 1 if you have the <stdint.h> header file. */ -#cmakedefine HAVE_STDINT_H 1 - -/* Define to 1 if you have the <stdlib.h> header file. */ -#cmakedefine HAVE_STDLIB_H 1 - -/* Define to 1 if you have the `strchr' function. */ -#cmakedefine HAVE_STRCHR 1 - -/* Define to 1 if you have the `strcspn' function. */ -#cmakedefine HAVE_STRCSPN 1 - -/* Define to 1 if you have the `strdup' function. */ -#cmakedefine HAVE_STRDUP 1 - -/* Define to 1 if you have the `strerror_r' function. */ -#cmakedefine HAVE_STRERROR_R 1 - -/* Define to 1 if you have the `strerror' function. */ -#cmakedefine HAVE_STRERROR 1 - -/* Define to 1 if you have the <strings.h> header file. */ -#cmakedefine HAVE_STRINGS_H 1 - -/* Define to 1 if you have the <string.h> header file. */ -#cmakedefine HAVE_STRING_H 1 - -/* Define to 1 if you have the `strrchr' function. */ -#cmakedefine HAVE_STRRCHR 1 - -/* Define to 1 if you have the `strtol' function. */ -#cmakedefine HAVE_STRTOL 1 - -/* Define to 1 if you have the `strtok_r' function. */ -#cmakedefine HAVE_STRTOK_R 1 - -/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'. - */ -#cmakedefine HAVE_SYS_DIR_H 1 - -/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'. - */ -#cmakedefine HAVE_SYS_NDIR_H 1 - -/* Define to 1 if you have the <sys/stat.h> header file. */ -#cmakedefine HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the <sys/times.h> header file. */ -#cmakedefine HAVE_SYS_TIMES_H 1 - -/* Define to 1 if you have the <sys/types.h> header file. */ -#cmakedefine HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the <unistd.h> header file. */ -#cmakedefine HAVE_UNISTD_H 1 - -/* Define to 1 if you have the <windows.h> header file. */ -#cmakedefine HAVE_WINDOWS_H 1 - /* define to 1 if you have dlfcn.h header file and dl lib. */ #cmakedefine HAVE_DL 1 |