mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Fix unnecessary config.h preprocessor (re)definitions.
The CMake-generated config.h would redundantly define some types to themselves, causing lots of warning in some cases (e.g. Xcode build). This addresses #414
This commit is contained in:
parent
050680aa63
commit
c732cef69b
3 changed files with 26 additions and 45 deletions
|
@ -7,9 +7,6 @@ check_function_exists(strerror HAVE_STRERROR)
|
||||||
check_function_exists(strsep HAVE_STRSEP)
|
check_function_exists(strsep HAVE_STRSEP)
|
||||||
check_function_exists(sigset HAVE_SIGSET)
|
check_function_exists(sigset HAVE_SIGSET)
|
||||||
|
|
||||||
if (HAVE_SIGSET)
|
if (NOT HAVE_SIGSET)
|
||||||
set(SIG_FUNC sigset)
|
|
||||||
else ()
|
|
||||||
set(SIG_FUNC signal)
|
|
||||||
check_function_exists(sigaction HAVE_SIGACTION)
|
check_function_exists(sigaction HAVE_SIGACTION)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
|
@ -4,43 +4,25 @@ check_type_size("long int" SIZEOF_LONG_INT)
|
||||||
check_type_size("long long" SIZEOF_LONG_LONG)
|
check_type_size("long long" SIZEOF_LONG_LONG)
|
||||||
check_type_size("void *" SIZEOF_VOID_P)
|
check_type_size("void *" SIZEOF_VOID_P)
|
||||||
|
|
||||||
|
# checks existence of ${_type}, and if it does not, sets CMake variable ${_var}
|
||||||
|
# to alternative type, ${_alt_type}
|
||||||
|
macro(CheckType _type _alt_type _var)
|
||||||
|
check_type_size(${_type} ${_var})
|
||||||
|
if (NOT ${_var})
|
||||||
|
set(${_var} ${_alt_type})
|
||||||
|
else ()
|
||||||
|
unset(${_var})
|
||||||
|
unset(${_var} CACHE)
|
||||||
|
endif ()
|
||||||
|
endmacro(CheckType _type _alt_type _var)
|
||||||
|
|
||||||
set(CMAKE_EXTRA_INCLUDE_FILES sys/types.h)
|
set(CMAKE_EXTRA_INCLUDE_FILES sys/types.h)
|
||||||
|
CheckType(int32_t int int32_t)
|
||||||
check_type_size(int32_t INT32_T)
|
CheckType(u_int32_t u_int u_int32_t)
|
||||||
if (INT32_T)
|
CheckType(u_int16_t u_short u_int16_t)
|
||||||
set(INT32_T int32_t)
|
CheckType(u_int8_t u_char u_int8_t)
|
||||||
else()
|
|
||||||
set(INT32_T int)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
check_type_size(u_int32_t U_INT32_T)
|
|
||||||
if (U_INT32_T)
|
|
||||||
set(U_INT32_T u_int32_t)
|
|
||||||
else ()
|
|
||||||
set(INT32_T u_int)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
check_type_size(u_int16_t U_INT16_T)
|
|
||||||
if (U_INT16_T)
|
|
||||||
set(U_INT16_T u_int16_t)
|
|
||||||
else ()
|
|
||||||
set(INT16_T u_short)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
check_type_size(u_int8_t U_INT8_T)
|
|
||||||
if (U_INT8_T)
|
|
||||||
set(U_INT8_T u_int8_t)
|
|
||||||
else ()
|
|
||||||
set(INT8_T u_char)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
set(CMAKE_EXTRA_INCLUDE_FILES)
|
set(CMAKE_EXTRA_INCLUDE_FILES)
|
||||||
|
|
||||||
set(CMAKE_EXTRA_INCLUDE_FILES sys/socket.h)
|
set(CMAKE_EXTRA_INCLUDE_FILES sys/socket.h)
|
||||||
check_type_size(socklen_t SOCKLEN_T)
|
CheckType(socklen_t int socklen_t)
|
||||||
if (SOCKLEN_T)
|
|
||||||
set(SOCKLEN_T socklen_t)
|
|
||||||
else ()
|
|
||||||
set(SOCKLEN_T int)
|
|
||||||
endif ()
|
|
||||||
set(CMAKE_EXTRA_INCLUDE_FILES)
|
set(CMAKE_EXTRA_INCLUDE_FILES)
|
||||||
|
|
14
config.h.in
14
config.h.in
|
@ -130,19 +130,21 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Define int32_t */
|
/* Define int32_t */
|
||||||
#define int32_t @INT32_T@
|
#cmakedefine int32_t @int32_t@
|
||||||
|
|
||||||
/* use sigset() instead of signal() */
|
/* use sigset() instead of signal() */
|
||||||
#define signal @SIG_FUNC@
|
#ifdef HAVE_SIGSET
|
||||||
|
#define signal sigset
|
||||||
|
#endif
|
||||||
|
|
||||||
/* define to int if socklen_t not available */
|
/* define to int if socklen_t not available */
|
||||||
#define socklen_t @SOCKLEN_T@
|
#cmakedefine socklen_t @socklen_t@
|
||||||
|
|
||||||
/* Define u_int16_t */
|
/* Define u_int16_t */
|
||||||
#define u_int16_t @U_INT16_T@
|
#cmakedefine u_int16_t @u_int16_t@
|
||||||
|
|
||||||
/* Define u_int32_t */
|
/* Define u_int32_t */
|
||||||
#define u_int32_t @U_INT32_T@
|
#cmakedefine u_int32_t @u_int32_t@
|
||||||
|
|
||||||
/* Define u_int8_t */
|
/* Define u_int8_t */
|
||||||
#define u_int8_t @U_INT8_T@
|
#cmakedefine u_int8_t @u_int8_t@
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue