diff options
-rw-r--r-- | Utilities/cmcurl/CMakeLists.txt | 62 | ||||
-rw-r--r-- | Utilities/cmcurl/include/curl/curlbuild.h.cmake | 67 | ||||
-rw-r--r-- | Utilities/cmcurl/lib/curl_config.h.cmake | 30 |
3 files changed, 72 insertions, 87 deletions
diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt index 61e6fa5..dffa4a3 100644 --- a/Utilities/cmcurl/CMakeLists.txt +++ b/Utilities/cmcurl/CMakeLists.txt @@ -521,58 +521,12 @@ check_type_size("short" SIZEOF_SHORT) check_type_size("int" SIZEOF_INT) check_type_size("__int64" SIZEOF___INT64) check_type_size("time_t" SIZEOF_TIME_T) -if(NOT HAVE_SIZEOF_SSIZE_T) - if(SIZEOF_LONG EQUAL SIZEOF_SIZE_T) - set(ssize_t long) - endif(SIZEOF_LONG EQUAL SIZEOF_SIZE_T) - if(NOT ssize_t AND SIZEOF___INT64 EQUAL SIZEOF_SIZE_T) - set(ssize_t __int64) - endif(NOT ssize_t AND SIZEOF___INT64 EQUAL SIZEOF_SIZE_T) -endif(NOT HAVE_SIZEOF_SSIZE_T) - -# Different sizeofs, etc. - -# define CURL_SIZEOF_LONG 4 -# define CURL_TYPEOF_CURL_OFF_T long long -# define CURL_FORMAT_CURL_OFF_T "lld" -# define CURL_FORMAT_CURL_OFF_TU "llu" -# define CURL_FORMAT_OFF_T "%lld" -# define CURL_SIZEOF_CURL_OFF_T 8 -# define CURL_SUFFIX_CURL_OFF_T LL -# define CURL_SUFFIX_CURL_OFF_TU ULL - -set(CURL_SIZEOF_LONG ${SIZEOF_LONG}) - -if(SIZEOF_LONG EQUAL 8) - set(CURL_TYPEOF_CURL_OFF_T long) - set(CURL_SIZEOF_CURL_OFF_T 8) - set(CURL_FORMAT_CURL_OFF_T "ld") - set(CURL_FORMAT_CURL_OFF_TU "lu") - set(CURL_FORMAT_OFF_T "%ld") - set(CURL_SUFFIX_CURL_OFF_T L) - set(CURL_SUFFIX_CURL_OFF_TU UL) -endif(SIZEOF_LONG EQUAL 8) - -if(SIZEOF_LONG_LONG EQUAL 8) - set(CURL_TYPEOF_CURL_OFF_T "long long") - set(CURL_SIZEOF_CURL_OFF_T 8) - set(CURL_FORMAT_CURL_OFF_T "lld") - set(CURL_FORMAT_CURL_OFF_TU "llu") - set(CURL_FORMAT_OFF_T "%lld") - set(CURL_SUFFIX_CURL_OFF_T LL) - set(CURL_SUFFIX_CURL_OFF_TU ULL) -endif(SIZEOF_LONG_LONG EQUAL 8) - -if(NOT CURL_TYPEOF_CURL_OFF_T) - set(CURL_TYPEOF_CURL_OFF_T ${ssize_t}) - set(CURL_SIZEOF_CURL_OFF_T ${SIZEOF_SSIZE_T}) - # TODO: need adjustment here. - set(CURL_FORMAT_CURL_OFF_T "ld") - set(CURL_FORMAT_CURL_OFF_TU "lu") - set(CURL_FORMAT_OFF_T "%ld") - set(CURL_SUFFIX_CURL_OFF_T L) - set(CURL_SUFFIX_CURL_OFF_TU LU) -endif(NOT CURL_TYPEOF_CURL_OFF_T) +check_type_size("off_t" SIZEOF_OFF_T) + +# Make public versions of some type sizes for curlbuild.h. +foreach(t INT LONG LONG_LONG SSIZE_T) + string(REPLACE "SIZEOF_" "CURL_SIZEOF_" CURL_SIZEOF_${t}_CODE "${SIZEOF_${t}_CODE}") +endforeach() if(HAVE_SIZEOF_LONG_LONG) set(HAVE_LONGLONG 1) @@ -835,6 +789,7 @@ if(CMAKE_COMPILER_IS_GNUCC AND APPLE) endif(CMAKE_COMPILER_IS_GNUCC AND APPLE) if(HAVE_SOCKLEN_T) + set(CURL_HAVE_SOCKLEN_T 1) set(CURL_TYPEOF_CURL_SOCKLEN_T "socklen_t") if(WIN32) set(CMAKE_EXTRA_INCLUDE_FILES "winsock2.h;ws2tcpip.h") @@ -848,8 +803,7 @@ if(HAVE_SOCKLEN_T) "Check for sizeof socklen_t failed, see CMakeFiles/CMakerror.log") endif() else() - set(CURL_TYPEOF_CURL_SOCKLEN_T int) - set(CURL_SIZEOF_CURL_SOCKLEN_T ${SIZEOF_INT}) + set(CURL_HAVE_SOCKLEN_T 0) endif() # TODO test which of these headers are required for the typedefs used in curlbuild.h diff --git a/Utilities/cmcurl/include/curl/curlbuild.h.cmake b/Utilities/cmcurl/include/curl/curlbuild.h.cmake index 60bc7a7..6608694 100644 --- a/Utilities/cmcurl/include/curl/curlbuild.h.cmake +++ b/Utilities/cmcurl/include/curl/curlbuild.h.cmake @@ -158,40 +158,61 @@ # include <sys/poll.h> #endif +/* The size of `int', as computed by sizeof. */ +@CURL_SIZEOF_INT_CODE@ + /* The size of `long', as computed by sizeof. */ -#define CURL_SIZEOF_LONG ${CURL_SIZEOF_LONG} +@CURL_SIZEOF_LONG_CODE@ + +/* The size of `long long', as computed by sizeof. */ +@CURL_SIZEOF_LONG_LONG_CODE@ + +/* The size of `ssize_t', as computed by sizeof. */ +@CURL_SIZEOF_SSIZE_T_CODE@ +#define CURL_HAVE_SOCKLEN_T @CURL_HAVE_SOCKLEN_T@ +#if CURL_HAVE_SOCKLEN_T /* Integral data type used for curl_socklen_t. */ -#define CURL_TYPEOF_CURL_SOCKLEN_T ${CURL_TYPEOF_CURL_SOCKLEN_T} +#define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t /* The size of `curl_socklen_t', as computed by sizeof. */ -#define CURL_SIZEOF_CURL_SOCKLEN_T ${CURL_SIZEOF_CURL_SOCKLEN_T} +@CURL_SIZEOF_CURL_SOCKLEN_T_CODE@ +#else +# define CURL_TYPEOF_CURL_SOCKLEN_T int +# define CURL_SIZEOF_CURL_SOCKLEN_T CURL_SIZEOF_INT +#endif /* Data type definition of curl_socklen_t. */ typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t; -/* Signed integral data type used for curl_off_t. */ -#define CURL_TYPEOF_CURL_OFF_T ${CURL_TYPEOF_CURL_OFF_T} +#if CURL_SIZEOF_LONG == 8 +# define CURL_TYPEOF_CURL_OFF_T long +# define CURL_SIZEOF_CURL_OFF_T 8 +# define CURL_FORMAT_CURL_OFF_T "ld" +# define CURL_FORMAT_CURL_OFF_TU "lu" +# define CURL_FORMAT_OFF_T "%ld" +# define CURL_SUFFIX_CURL_OFF_T L +# define CURL_SUFFIX_CURL_OFF_TU UL +#elif CURL_SIZEOF_LONG_LONG == 8 +# define CURL_TYPEOF_CURL_OFF_T long long +# define CURL_SIZEOF_CURL_OFF_T 8 +# define CURL_FORMAT_CURL_OFF_T "lld" +# define CURL_FORMAT_CURL_OFF_TU "llu" +# define CURL_FORMAT_OFF_T "%lld" +# define CURL_SUFFIX_CURL_OFF_T LL +# define CURL_SUFFIX_CURL_OFF_TU ULL +#else +# define CURL_TYPEOF_CURL_OFF_T ssize_t +# define CURL_SIZEOF_CURL_OFF_T CURL_SIZEOF_SSIZE_T +/* TODO: need adjustment here. */ +# define CURL_FORMAT_CURL_OFF_T "ld" +# define CURL_FORMAT_CURL_OFF_TU "lu" +# define CURL_FORMAT_OFF_T "%ld" +# define CURL_SUFFIX_CURL_OFF_T L +# define CURL_SUFFIX_CURL_OFF_TU UL +#endif /* Data type definition of curl_off_t. */ typedef CURL_TYPEOF_CURL_OFF_T curl_off_t; -/* curl_off_t formatting string directive without "%" conversion specifier. */ -#define CURL_FORMAT_CURL_OFF_T "${CURL_FORMAT_CURL_OFF_T}" - -/* unsigned curl_off_t formatting string without "%" conversion specifier. */ -#define CURL_FORMAT_CURL_OFF_TU "${CURL_FORMAT_CURL_OFF_TU}" - -/* curl_off_t formatting string directive with "%" conversion specifier. */ -#define CURL_FORMAT_OFF_T "${CURL_FORMAT_OFF_T}" - -/* The size of `curl_off_t', as computed by sizeof. */ -#define CURL_SIZEOF_CURL_OFF_T ${CURL_SIZEOF_CURL_OFF_T} - -/* curl_off_t constant suffix. */ -#define CURL_SUFFIX_CURL_OFF_T ${CURL_SUFFIX_CURL_OFF_T} - -/* unsigned curl_off_t constant suffix. */ -#define CURL_SUFFIX_CURL_OFF_TU ${CURL_SUFFIX_CURL_OFF_TU} - #endif /* __CURL_CURLBUILD_H */ diff --git a/Utilities/cmcurl/lib/curl_config.h.cmake b/Utilities/cmcurl/lib/curl_config.h.cmake index ed55a65..b5db3b6 100644 --- a/Utilities/cmcurl/lib/curl_config.h.cmake +++ b/Utilities/cmcurl/lib/curl_config.h.cmake @@ -847,25 +847,25 @@ #cmakedefine SEND_TYPE_RETV ${SEND_TYPE_RETV} /* The size of `int', as computed by sizeof. */ -#cmakedefine SIZEOF_INT ${SIZEOF_INT} +@SIZEOF_INT_CODE@ /* The size of `short', as computed by sizeof. */ -#cmakedefine SIZEOF_SHORT ${SIZEOF_SHORT} +@SIZEOF_SHORT_CODE@ /* The size of `long', as computed by sizeof. */ -#cmakedefine SIZEOF_LONG ${SIZEOF_LONG} +@SIZEOF_LONG_CODE@ /* The size of `off_t', as computed by sizeof. */ -#cmakedefine SIZEOF_OFF_T ${SIZEOF_OFF_T} +@SIZEOF_OFF_T_CODE@ /* The size of `size_t', as computed by sizeof. */ -#cmakedefine SIZEOF_SIZE_T ${SIZEOF_SIZE_T} +@SIZEOF_SIZE_T_CODE@ -/* The size of `time_t', as computed by sizeof. */ -#cmakedefine SIZEOF_TIME_T ${SIZEOF_TIME_T} +/* The size of `ssize_t', as computed by sizeof. */ +@SIZEOF_SSIZE_T_CODE@ -/* The size of `void*', as computed by sizeof. */ -#cmakedefine SIZEOF_VOIDP ${SIZEOF_VOIDP} +/* The size of `time_t', as computed by sizeof. */ +@SIZEOF_TIME_T_CODE@ /* Define to 1 if you have the ANSI C header files. */ #cmakedefine STDC_HEADERS 1 @@ -948,4 +948,14 @@ #cmakedefine size_t ${size_t} /* the signed version of size_t */ -#cmakedefine ssize_t ${ssize_t} +#ifndef SIZEOF_SSIZE_T +# if SIZEOF_LONG == SIZEOF_SIZE_T + typedef long ssize_t; +# elif SIZEOF_LONG_LONG == SIZEOF_SIZE_T + typedef long long ssize_t; +# elif SIZEOF___INT64 == SIZEOF_SIZE_T + typedef __int64 ssize_t; +# else + typedef int ssize_t; +# endif +#endif |