Commit 8d89b578 authored by Kent Boortz's avatar Kent Boortz

config.h.cmake

 - Added missing HAVE_SYS_TIMES_H, HAVE_SYS_TIME_H, HAVE_TIME_H,
   HAVE_TIME and HAVE_TIMES
 - Removed most #if constructs, keep logic in "configure.cmake"
 - Use space after # if inside #if, for consistency

configure.cmake
 - Added MY_CHECK_TYPE_SIZE function that sets both SIZEOF_* and HAVE_*
 - If "sys/stream.h" exists, include it before "sys/ptem.h" in test
 - Set VOID_SIGHANDLER if RETSIGTYPE is set to "void"
parent 45e5b105
......@@ -81,6 +81,8 @@
#cmakedefine HAVE_SYS_STREAM_H 1
#cmakedefine HAVE_SYS_TERMCAP_H 1
#cmakedefine HAVE_SYS_TIMEB_H 1
#cmakedefine HAVE_SYS_TIMES_H 1
#cmakedefine HAVE_SYS_TIME_H 1
#cmakedefine HAVE_SYS_TYPES_H 1
#cmakedefine HAVE_SYS_UN_H 1
#cmakedefine HAVE_SYS_VADVISE_H 1
......@@ -88,6 +90,7 @@
#cmakedefine HAVE_TERMIOS_H 1
#cmakedefine HAVE_TERMIO_H 1
#cmakedefine HAVE_TERMCAP_H 1
#cmakedefine HAVE_TIME_H 1
#cmakedefine HAVE_UNISTD_H 1
#cmakedefine HAVE_UTIME_H 1
#cmakedefine HAVE_VARARGS_H 1
......@@ -261,6 +264,8 @@
#cmakedefine HAVE_TEMPNAM 1
#cmakedefine HAVE_THR_SETCONCURRENCY 1
#cmakedefine HAVE_THR_YIELD 1
#cmakedefine HAVE_TIME 1
#cmakedefine HAVE_TIMES 1
#cmakedefine HAVE_VALLOC 1
#define HAVE_VIO_READ_BUFF 1
#cmakedefine HAVE_VASPRINTF 1
......@@ -293,11 +298,6 @@
/* Types we may use */
#cmakedefine SIZEOF_CHAR @SIZEOF_CHAR@
#if SIZEOF_CHAR
# define HAVE_CHAR 1
#endif
#ifdef __APPLE__
/*
Special handling required for OSX to support universal binaries that
......@@ -316,119 +316,64 @@
#cmakedefine SIZEOF_SIZE_T @SIZEOF_CHARP@
#endif
#if SIZEOF_LONG
# define HAVE_LONG 1
#endif
#cmakedefine SIZEOF_CHAR @SIZEOF_CHAR@
#cmakedefine HAVE_CHAR 1
#cmakedefine HAVE_LONG 1
#cmakedefine HAVE_CHARP 1
#if SIZEOF_CHARP
#define HAVE_CHARP 1
#define SIZEOF_VOIDP SIZEOF_CHARP
# define SIZEOF_VOIDP SIZEOF_CHARP
#endif
#cmakedefine SIZEOF_SHORT @SIZEOF_SHORT@
#if SIZEOF_SHORT
# define HAVE_SHORT 1
#endif
#cmakedefine HAVE_SHORT 1
#cmakedefine SIZEOF_INT @SIZEOF_INT@
#if SIZEOF_INT
# define HAVE_INT 1
#endif
#cmakedefine HAVE_INT 1
#cmakedefine SIZEOF_LONG_LONG @SIZEOF_LONG_LONG@
#if SIZEOF_LONG_LONG
# define HAVE_LONG_LONG 1
#endif
#cmakedefine HAVE_LONG_LONG 1
#cmakedefine SIZEOF_OFF_T @SIZEOF_OFF_T@
#if SIZEOF_OFF_T
#define HAVE_OFF_T 1
#endif
#cmakedefine HAVE_OFF_T 1
#cmakedefine SIZEOF_SIGSET_T @SIZEOF_SIGSET_T@
#if SIZEOF_SIGSET_T
#define HAVE_SIGSET_T 1
#endif
#if SIZEOF_SIZE_T
#define HAVE_SIZE_T 1
#endif
#cmakedefine HAVE_SIGSET_T 1
#cmakedefine SIZEOF_SIZE_T @SIZEOF_SIZE_T@
#cmakedefine HAVE_SIZE_T 1
#cmakedefine SIZEOF_UCHAR @SIZEOF_UCHAR@
#if SIZEOF_UCHAR
#define HAVE_UCHAR 1
#endif
#cmakedefine HAVE_UCHAR 1
#cmakedefine SIZEOF_UINT @SIZEOF_UINT@
#if SIZEOF_UINT
#define HAVE_UINT 1
#endif
#cmakedefine HAVE_UINT 1
#cmakedefine SIZEOF_ULONG @SIZEOF_ULONG@
#if SIZEOF_ULONG
#define HAVE_ULONG 1
#endif
#cmakedefine HAVE_ULONG 1
#cmakedefine SIZEOF_INT8 @SIZEOF_INT8@
#if SIZEOF_INT8
#define HAVE_INT8 1
#endif
#cmakedefine HAVE_INT8 1
#cmakedefine SIZEOF_UINT8 @SIZEOF_UINT8@
#if SIZEOF_UINT8
#define HAVE_UINT8 1
#endif
#cmakedefine HAVE_UINT8 1
#cmakedefine SIZEOF_INT16 @SIZEOF_INT16@
#if SIZEOF_INT16
# define HAVE_INT16 1
#endif
#cmakedefine HAVE_INT16 1
#cmakedefine SIZEOF_UINT16 @SIZEOF_UINT16@
#if SIZEOF_UINT16
#define HAVE_UINT16 1
#endif
#cmakedefine HAVE_UINT16 1
#cmakedefine SIZEOF_INT32 @SIZEOF_INT32@
#if SIZEOF_INT32
#define HAVE_INT32 1
#endif
#cmakedefine HAVE_INT32 1
#cmakedefine SIZEOF_UINT32 @SIZEOF_UINT32@
#if SIZEOF_UINT32
#define HAVE_UINT32 1
#endif
#cmakedefine HAVE_UINT32 1
#cmakedefine SIZEOF_U_INT32_T @SIZEOF_U_INT32_T@
#if SIZEOF_U_INT32_T
#define HAVE_U_INT32_T 1
#endif
#cmakedefine HAVE_U_INT32_T 1
#cmakedefine SIZEOF_INT64 @SIZEOF_INT64@
#if SIZEOF_INT64
#define HAVE_INT64 1
#endif
#cmakedefine HAVE_INT64 1
#cmakedefine SIZEOF_UINT64 @SIZEOF_UINT64@
#if SIZEOF_UINT64
#define HAVE_UINT64 1
#endif
#cmakedefine HAVE_UINT64 1
#cmakedefine SIZEOF_BOOL @SIZEOF_BOOL@
#cmakedefine HAVE_BOOL 1
#cmakedefine SOCKET_SIZE_TYPE @SOCKET_SIZE_TYPE@
#cmakedefine SIZEOF_BOOL @SIZEOF_BOOL@
#if SIZEOF_BOOL
#define HAVE_BOOL 1
#endif
#cmakedefine HAVE_MBSTATE_T
#define MAX_INDEXES 64
#cmakedefine QSORT_TYPE_IS_VOID 1
#define RETQSORTTYPE void
#cmakedefine RETQSORTTYPE @RETQSORTTYPE@
#cmakedefine SIGNAL_RETURN_TYPE_IS_VOID 1
#define RETSIGTYPE void
#if SIGNAL_RETURN_TYPE_IS_VOID
#define VOID_SIGHANDLER 1
#endif
#cmakedefine RETSIGTYPE @RETSIGTYPE@
#cmakedefine VOID_SIGHANDLER 1
#define STRUCT_RLIMIT struct rlimit
#ifdef __APPLE__
......@@ -545,7 +490,7 @@
#cmakedefine strtoull @strtoull@
#cmakedefine vsnprintf @vsnprintf@
#if (_MSC_VER > 1310)
#define HAVE_SETENV
# define HAVE_SETENV
#define setenv(a,b,c) _putenv_s(a,b)
#endif
......@@ -635,7 +580,7 @@
#cmakedefine WITH_PERFSCHEMA_STORAGE_ENGINE 1
#cmakedefine WITH_NDBCLUSTER_STORAGE_ENGINE 1
#if (WITH_NDBCLUSTER_STORAGE_ENGINE) && !defined(EMBEDDED_LIBRARY)
#define HAVE_NDB_BINLOG 1
# define HAVE_NDB_BINLOG 1
#endif
#cmakedefine DEFAULT_MYSQL_HOME "@DEFAULT_MYSQL_HOME@"
......
......@@ -81,6 +81,13 @@ ENDIF(WITHOUT_DYNAMIC_PLUGINS)
# Large files, common flag
SET(_LARGEFILE_SOURCE 1)
# If finds the size of a type, set SIZEOF_<type> and HAVE_<type>
FUNCTION(MY_CHECK_TYPE_SIZE type defbase)
CHECK_TYPE_SIZE("${type}" SIZEOF_${defbase})
IF(SIZEOF_${defbase})
SET(HAVE_${defbase} 1 PARENT_SCOPE)
ENDIF()
ENDFUNCTION()
# Searches function in libraries
# if function is found, sets output parameter result to the name of the library
......@@ -186,7 +193,6 @@ CHECK_INCLUDE_FILES (select.h HAVE_SELECT_H)
CHECK_INCLUDE_FILES (semaphore.h HAVE_SEMAPHORE_H)
CHECK_INCLUDE_FILES (sys/dir.h HAVE_SYS_DIR_H)
CHECK_INCLUDE_FILES (sys/pte.h HAVE_SYS_PTE_H)
CHECK_INCLUDE_FILES (sys/ptem.h HAVE_SYS_PTEM_H)
CHECK_INCLUDE_FILES (stddef.h HAVE_STDDEF_H)
CHECK_INCLUDE_FILES (stdint.h HAVE_STDINT_H)
CHECK_INCLUDE_FILES (stdlib.h HAVE_STDLIB_H)
......@@ -226,6 +232,13 @@ CHECK_INCLUDE_FILES (fnmatch.h HAVE_FNMATCH_H)
CHECK_INCLUDE_FILES (stdarg.h HAVE_STDARG_H)
CHECK_INCLUDE_FILES("stdlib.h;sys/un.h" HAVE_SYS_UN_H)
IF(HAVE_SYS_STREAM_H)
# Needs sys/stream.h on Solaris
CHECK_INCLUDE_FILES (sys/stream.h sys/ptem.h HAVE_SYS_PTEM_H)
ELSE()
CHECK_INCLUDE_FILES (sys/ptem.h HAVE_SYS_PTEM_H)
ENDIF()
# Figure out threading library
#
FIND_PACKAGE (Threads)
......@@ -449,14 +462,11 @@ set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
-D_LARGEFILE_SOURCE -D_LARGE_FILES -D_FILE_OFFSET_BITS=64
-D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS)
SET(CMAKE_EXTRA_INCLUDE_FILES signal.h)
CHECK_TYPE_SIZE(sigset_t SIZEOF_SIGSET_T)
IF(SIZEOF_SIGSET_T)
SET(HAVE_SIGSET_T 1)
ENDIF()
MY_CHECK_TYPE_SIZE(sigset_t SIGSET_T)
IF(NOT SIZEOF_SIGSET_T)
SET(sigset_t int)
ENDIF()
CHECK_TYPE_SIZE(mode_t SIZEOF_MODE_T)
MY_CHECK_TYPE_SIZE(mode_t MODE_T)
IF(NOT SIZEOF_MODE_T)
SET(mode_t int)
ENDIF()
......@@ -469,43 +479,40 @@ ENDIF(HAVE_STDINT_H)
IF(NOT APPLE)
# Prevent some checks on OSX, they return ambigious results
# on universal 32/64 bit binariess
CHECK_TYPE_SIZE("char *" SIZEOF_CHARP)
CHECK_TYPE_SIZE(long SIZEOF_LONG)
CHECK_TYPE_SIZE(size_t SIZEOF_SIZE_T)
MY_CHECK_TYPE_SIZE("char *" CHARP)
MY_CHECK_TYPE_SIZE(long LONG)
MY_CHECK_TYPE_SIZE(size_t SIZE_T)
ENDIF()
CHECK_TYPE_SIZE(char SIZEOF_CHAR)
CHECK_TYPE_SIZE(short SIZEOF_SHORT)
CHECK_TYPE_SIZE(int SIZEOF_INT)
CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG)
MY_CHECK_TYPE_SIZE(char CHAR)
MY_CHECK_TYPE_SIZE(short SHORT)
MY_CHECK_TYPE_SIZE(int INT)
MY_CHECK_TYPE_SIZE("long long" LONG_LONG)
SET(CMAKE_EXTRA_INCLUDE_FILES stdio.h sys/types.h)
CHECK_TYPE_SIZE(off_t SIZEOF_OFF_T)
CHECK_TYPE_SIZE(uchar SIZEOF_UCHAR)
CHECK_TYPE_SIZE(uint SIZEOF_UINT)
CHECK_TYPE_SIZE(ulong SIZEOF_ULONG)
CHECK_TYPE_SIZE(int8 SIZEOF_INT8)
CHECK_TYPE_SIZE(uint8 SIZEOF_UINT8)
CHECK_TYPE_SIZE(int16 SIZEOF_INT16)
CHECK_TYPE_SIZE(uint16 SIZEOF_UINT16)
CHECK_TYPE_SIZE(int32 SIZEOF_INT32)
CHECK_TYPE_SIZE(uint32 SIZEOF_UINT32)
CHECK_TYPE_SIZE(u_int32_t SIZEOF_U_INT32_T)
CHECK_TYPE_SIZE(int64 SIZEOF_INT64)
CHECK_TYPE_SIZE(uint64 SIZEOF_UINT64)
MY_CHECK_TYPE_SIZE(off_t OFF_T)
MY_CHECK_TYPE_SIZE(uchar UCHAR)
MY_CHECK_TYPE_SIZE(uint UINT)
MY_CHECK_TYPE_SIZE(ulong ULONG)
MY_CHECK_TYPE_SIZE(int8 INT8)
MY_CHECK_TYPE_SIZE(uint8 UINT8)
MY_CHECK_TYPE_SIZE(int16 INT16)
MY_CHECK_TYPE_SIZE(uint16 UINT16)
MY_CHECK_TYPE_SIZE(int32 INT32)
MY_CHECK_TYPE_SIZE(uint32 UINT32)
MY_CHECK_TYPE_SIZE(u_int32_t U_INT32_T)
MY_CHECK_TYPE_SIZE(int64 INT64)
MY_CHECK_TYPE_SIZE(uint64 UINT64)
SET (CMAKE_EXTRA_INCLUDE_FILES sys/types.h)
CHECK_TYPE_SIZE(bool SIZEOF_BOOL)
MY_CHECK_TYPE_SIZE(bool BOOL)
SET(CMAKE_EXTRA_INCLUDE_FILES)
IF(HAVE_SYS_SOCKET_H)
SET(CMAKE_EXTRA_INCLUDE_FILES sys/socket.h)
ENDIF(HAVE_SYS_SOCKET_H)
CHECK_TYPE_SIZE(socklen_t SIZEOF_SOCKLEN_T)
MY_CHECK_TYPE_SIZE(socklen_t SOCKLEN_T)
SET(CMAKE_EXTRA_INCLUDE_FILES)
IF(HAVE_IEEEFP_H)
SET(CMAKE_EXTRA_INCLUDE_FILES ieeefp.h)
CHECK_TYPE_SIZE(fp_except SIZEOF_FP_EXCEPT)
IF(SIZEOF_FP_EXCEPT)
SET(HAVE_FP_EXCEPT TRUE)
ENDIF()
MY_CHECK_TYPE_SIZE(fp_except FP_EXCEPT)
ENDIF()
......@@ -669,6 +676,7 @@ int main(int ac, char **av) {}
" SIGNAL_RETURN_TYPE_IS_VOID)
IF(SIGNAL_RETURN_TYPE_IS_VOID)
SET(RETSIGTYPE void)
SET(VOID_SIGHANDLER 1)
ELSE(SIGNAL_RETURN_TYPE_IS_VOID)
SET(RETSIGTYPE int)
ENDIF(SIGNAL_RETURN_TYPE_IS_VOID)
......@@ -973,14 +981,8 @@ ELSEIF(WIN32)
SET(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} winsock2.h ws2ipdef.h)
ENDIF()
CHECK_TYPE_SIZE("struct sockaddr_in6" SIZEOF_SOCKADDR_IN6)
CHECK_TYPE_SIZE("struct in6_addr" SIZEOF_IN6_ADDR)
IF(SIZEOF_SOCKADDR_IN6)
SET(HAVE_STRUCT_SOCKADDR_IN6 1)
ENDIF()
IF(SIZEOF_IN6_ADDR)
SET(HAVE_STRUCT_IN6_ADDR 1)
ENDIF()
MY_CHECK_TYPE_SIZE("struct sockaddr_in6" SOCKADDR_IN6)
MY_CHECK_TYPE_SIZE("struct in6_addr" IN6_ADDR)
IF(HAVE_STRUCT_SOCKADDR_IN6 OR HAVE_STRUCT_IN6_ADDR)
SET(HAVE_IPV6 TRUE CACHE INTERNAL "")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment