aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/curl/Makefile.am4
-rw-r--r--include/curl/curl.h1
-rw-r--r--include/curl/curlrules.h25
-rw-r--r--include/curl/system.h457
-rw-r--r--lib/curl_setup.h13
-rw-r--r--tests/data/Makefile.inc2
-rw-r--r--tests/data/test154122
-rw-r--r--tests/libtest/Makefile.inc6
-rw-r--r--tests/libtest/lib1541.c109
9 files changed, 599 insertions, 40 deletions
diff --git a/include/curl/Makefile.am b/include/curl/Makefile.am
index 7c924fcb5..9011c793c 100644
--- a/include/curl/Makefile.am
+++ b/include/curl/Makefile.am
@@ -5,7 +5,7 @@
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
-# Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+# Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
@@ -21,7 +21,7 @@
###########################################################################
pkginclude_HEADERS = \
curl.h curlver.h easy.h mprintf.h stdcheaders.h multi.h \
- typecheck-gcc.h curlbuild.h curlrules.h
+ typecheck-gcc.h curlbuild.h curlrules.h system.h
pkgincludedir= $(includedir)/curl
diff --git a/include/curl/curl.h b/include/curl/curl.h
index 421152259..103071264 100644
--- a/include/curl/curl.h
+++ b/include/curl/curl.h
@@ -35,6 +35,7 @@
#endif
#include "curlver.h" /* libcurl version defines */
+#include "system.h" /* determine things run-time */
#include "curlbuild.h" /* libcurl build definitions */
#include "curlrules.h" /* libcurl rules enforcement */
diff --git a/include/curl/curlrules.h b/include/curl/curlrules.h
index 55d21f68f..0abd9f71d 100644
--- a/include/curl/curlrules.h
+++ b/include/curl/curlrules.h
@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -105,11 +105,6 @@
Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_is_missing
#endif
-#ifndef CURL_FORMAT_OFF_T
-# error "CURL_FORMAT_OFF_T definition is missing!"
- Error Compilation_aborted_CURL_FORMAT_OFF_T_is_missing
-#endif
-
#ifndef CURL_SIZEOF_CURL_OFF_T
# error "CURL_SIZEOF_CURL_OFF_T definition is missing!"
Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_is_missing
@@ -241,22 +236,4 @@ typedef char
#undef CurlchkszEQ
#undef CurlchkszGE
-/*
- * Get rid of macros not intended to exist beyond this point.
- */
-
-#undef CURL_PULL_WS2TCPIP_H
-#undef CURL_PULL_SYS_TYPES_H
-#undef CURL_PULL_SYS_SOCKET_H
-#undef CURL_PULL_SYS_POLL_H
-#undef CURL_PULL_STDINT_H
-#undef CURL_PULL_INTTYPES_H
-
-#undef CURL_TYPEOF_CURL_SOCKLEN_T
-#undef CURL_TYPEOF_CURL_OFF_T
-
-#ifdef CURL_NO_OLDIES
-#undef CURL_FORMAT_OFF_T /* not required since 7.19.0 - obsoleted in 7.20.0 */
-#endif
-
#endif /* __CURL_CURLRULES_H */
diff --git a/include/curl/system.h b/include/curl/system.h
new file mode 100644
index 000000000..fb4597b52
--- /dev/null
+++ b/include/curl/system.h
@@ -0,0 +1,457 @@
+#ifndef __CURL_SYSTEM_H
+#define __CURL_SYSTEM_H
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at https://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+
+/*
+ * This header is supposed to eventually replace curlbuild.h. This little one
+ * is still learning. During the experimental phase, this header files
+ * defines symbols using the prefixes CURLSYS_ or curlsys_. When we feel
+ * confident enough, we replace curlbuild.h with this file and rename all
+ * prefixes to CURL_ and curl_.
+ */
+
+/*
+ * Try to keep one section per platform, compiler and architecture, otherwise,
+ * if an existing section is reused for a different one and later on the
+ * original is adjusted, probably the piggybacking one can be adversely
+ * changed.
+ *
+ * In order to differentiate between platforms/compilers/architectures use
+ * only compiler built in predefined preprocessor symbols.
+ *
+ * curl_off_t
+ * ----------
+ *
+ * For any given platform/compiler curl_off_t must be typedef'ed to a 64-bit
+ * wide signed integral data type. The width of this data type must remain
+ * constant and independent of any possible large file support settings.
+ *
+ * As an exception to the above, curl_off_t shall be typedef'ed to a 32-bit
+ * wide signed integral data type if there is no 64-bit type.
+ *
+ * As a general rule, curl_off_t shall not be mapped to off_t. This rule shall
+ * only be violated if off_t is the only 64-bit data type available and the
+ * size of off_t is independent of large file support settings. Keep your
+ * build on the safe side avoiding an off_t gating. If you have a 64-bit
+ * off_t then take for sure that another 64-bit data type exists, dig deeper
+ * and you will find it.
+ *
+ */
+
+#if defined(__DJGPP__) || defined(__GO32__)
+# if defined(__DJGPP__) && (__DJGPP__ > 1)
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long long
+# define CURLSYS_FORMAT_CURL_OFF_T "lld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "llu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T LL
+# define CURLSYS_SUFFIX_CURL_OFF_TU ULL
+# else
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long
+# define CURLSYS_FORMAT_CURL_OFF_T "ld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 4
+# define CURLSYS_SUFFIX_CURL_OFF_T L
+# define CURLSYS_SUFFIX_CURL_OFF_TU UL
+# endif
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T int
+# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+
+#elif defined(__SALFORDC__)
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long
+# define CURLSYS_FORMAT_CURL_OFF_T "ld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 4
+# define CURLSYS_SUFFIX_CURL_OFF_T L
+# define CURLSYS_SUFFIX_CURL_OFF_TU UL
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T int
+# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+
+#elif defined(__BORLANDC__)
+# if (__BORLANDC__ < 0x520)
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long
+# define CURLSYS_FORMAT_CURL_OFF_T "ld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 4
+# define CURLSYS_SUFFIX_CURL_OFF_T L
+# define CURLSYS_SUFFIX_CURL_OFF_TU UL
+# else
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T __int64
+# define CURLSYS_FORMAT_CURL_OFF_T "I64d"
+# define CURLSYS_FORMAT_CURL_OFF_TU "I64u"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T i64
+# define CURLSYS_SUFFIX_CURL_OFF_TU ui64
+# endif
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T int
+# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+
+#elif defined(__TURBOC__)
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long
+# define CURLSYS_FORMAT_CURL_OFF_T "ld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 4
+# define CURLSYS_SUFFIX_CURL_OFF_T L
+# define CURLSYS_SUFFIX_CURL_OFF_TU UL
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T int
+# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+
+#elif defined(__WATCOMC__)
+# if defined(__386__)
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T __int64
+# define CURLSYS_FORMAT_CURL_OFF_T "I64d"
+# define CURLSYS_FORMAT_CURL_OFF_TU "I64u"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T i64
+# define CURLSYS_SUFFIX_CURL_OFF_TU ui64
+# else
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long
+# define CURLSYS_FORMAT_CURL_OFF_T "ld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 4
+# define CURLSYS_SUFFIX_CURL_OFF_T L
+# define CURLSYS_SUFFIX_CURL_OFF_TU UL
+# endif
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T int
+# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+
+#elif defined(__POCC__)
+# if (__POCC__ < 280)
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long
+# define CURLSYS_FORMAT_CURL_OFF_T "ld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 4
+# define CURLSYS_SUFFIX_CURL_OFF_T L
+# define CURLSYS_SUFFIX_CURL_OFF_TU UL
+# elif defined(_MSC_VER)
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T __int64
+# define CURLSYS_FORMAT_CURL_OFF_T "I64d"
+# define CURLSYS_FORMAT_CURL_OFF_TU "I64u"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T i64
+# define CURLSYS_SUFFIX_CURL_OFF_TU ui64
+# else
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long long
+# define CURLSYS_FORMAT_CURL_OFF_T "lld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "llu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T LL
+# define CURLSYS_SUFFIX_CURL_OFF_TU ULL
+# endif
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T int
+# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+
+#elif defined(__LCC__)
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long
+# define CURLSYS_FORMAT_CURL_OFF_T "ld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 4
+# define CURLSYS_SUFFIX_CURL_OFF_T L
+# define CURLSYS_SUFFIX_CURL_OFF_TU UL
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T int
+# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+
+#elif defined(__SYMBIAN32__)
+# if defined(__EABI__) /* Treat all ARM compilers equally */
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long long
+# define CURLSYS_FORMAT_CURL_OFF_T "lld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "llu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T LL
+# define CURLSYS_SUFFIX_CURL_OFF_TU ULL
+# elif defined(__CW32__)
+# pragma longlong on
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long long
+# define CURLSYS_FORMAT_CURL_OFF_T "lld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "llu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T LL
+# define CURLSYS_SUFFIX_CURL_OFF_TU ULL
+# elif defined(__VC32__)
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T __int64
+# define CURLSYS_FORMAT_CURL_OFF_T "lld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "llu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T LL
+# define CURLSYS_SUFFIX_CURL_OFF_TU ULL
+# endif
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T unsigned int
+# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+
+#elif defined(__MWERKS__)
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long long
+# define CURLSYS_FORMAT_CURL_OFF_T "lld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "llu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T LL
+# define CURLSYS_SUFFIX_CURL_OFF_TU ULL
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T int
+# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+
+#elif defined(_WIN32_WCE)
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T __int64
+# define CURLSYS_FORMAT_CURL_OFF_T "I64d"
+# define CURLSYS_FORMAT_CURL_OFF_TU "I64u"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T i64
+# define CURLSYS_SUFFIX_CURL_OFF_TU ui64
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T int
+# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+
+#elif defined(__MINGW32__)
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long long
+# define CURLSYS_FORMAT_CURL_OFF_T "I64d"
+# define CURLSYS_FORMAT_CURL_OFF_TU "I64u"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T LL
+# define CURLSYS_SUFFIX_CURL_OFF_TU ULL
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T int
+# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+
+#elif defined(__VMS)
+# if defined(__VAX)
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long
+# define CURLSYS_FORMAT_CURL_OFF_T "ld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 4
+# define CURLSYS_SUFFIX_CURL_OFF_T L
+# define CURLSYS_SUFFIX_CURL_OFF_TU UL
+# else
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long long
+# define CURLSYS_FORMAT_CURL_OFF_T "lld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "llu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T LL
+# define CURLSYS_SUFFIX_CURL_OFF_TU ULL
+# endif
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T unsigned int
+# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+
+#elif defined(__OS400__)
+# if defined(__ILEC400__)
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long long
+# define CURLSYS_FORMAT_CURL_OFF_T "lld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "llu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T LL
+# define CURLSYS_SUFFIX_CURL_OFF_TU ULL
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T socklen_t
+# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+# define CURLSYS_PULL_SYS_TYPES_H 1
+# define CURLSYS_PULL_SYS_SOCKET_H 1
+# endif
+
+#elif defined(__MVS__)
+# if defined(__IBMC__) || defined(__IBMCPP__)
+# if defined(_ILP32)
+# define CURLSYS_SIZEOF_LONG 4
+# elif defined(_LP64)
+# define CURLSYS_SIZEOF_LONG 8
+# endif
+# if defined(_LONG_LONG)
+# define CURLSYS_TYPEOF_CURL_OFF_T long long
+# define CURLSYS_FORMAT_CURL_OFF_T "lld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "llu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T LL
+# define CURLSYS_SUFFIX_CURL_OFF_TU ULL
+# elif defined(_LP64)
+# define CURLSYS_TYPEOF_CURL_OFF_T long
+# define CURLSYS_FORMAT_CURL_OFF_T "ld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T L
+# define CURLSYS_SUFFIX_CURL_OFF_TU UL
+# else
+# define CURLSYS_TYPEOF_CURL_OFF_T long
+# define CURLSYS_FORMAT_CURL_OFF_T "ld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 4
+# define CURLSYS_SUFFIX_CURL_OFF_T L
+# define CURLSYS_SUFFIX_CURL_OFF_TU UL
+# endif
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T socklen_t
+# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+# define CURLSYS_PULL_SYS_TYPES_H 1
+# define CURLSYS_PULL_SYS_SOCKET_H 1
+# endif
+
+#elif defined(__370__)
+# if defined(__IBMC__) || defined(__IBMCPP__)
+# if defined(_ILP32)
+# define CURLSYS_SIZEOF_LONG 4
+# elif defined(_LP64)
+# define CURLSYS_SIZEOF_LONG 8
+# endif
+# if defined(_LONG_LONG)
+# define CURLSYS_TYPEOF_CURL_OFF_T long long
+# define CURLSYS_FORMAT_CURL_OFF_T "lld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "llu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T LL
+# define CURLSYS_SUFFIX_CURL_OFF_TU ULL
+# elif defined(_LP64)
+# define CURLSYS_TYPEOF_CURL_OFF_T long
+# define CURLSYS_FORMAT_CURL_OFF_T "ld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T L
+# define CURLSYS_SUFFIX_CURL_OFF_TU UL
+# else
+# define CURLSYS_TYPEOF_CURL_OFF_T long
+# define CURLSYS_FORMAT_CURL_OFF_T "ld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 4
+# define CURLSYS_SUFFIX_CURL_OFF_T L
+# define CURLSYS_SUFFIX_CURL_OFF_TU UL
+# endif
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T socklen_t
+# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+# define CURLSYS_PULL_SYS_TYPES_H 1
+# define CURLSYS_PULL_SYS_SOCKET_H 1
+# endif
+
+#elif defined(TPF)
+# define CURLSYS_SIZEOF_LONG 8
+# define CURLSYS_TYPEOF_CURL_OFF_T long
+# define CURLSYS_FORMAT_CURL_OFF_T "ld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T L
+# define CURLSYS_SUFFIX_CURL_OFF_TU UL
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T int
+# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+
+/* ===================================== */
+/* KEEP MSVC THE PENULTIMATE ENTRY */
+/* ===================================== */
+
+#elif defined(_MSC_VER)
+# if (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64)
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T __int64
+# define CURLSYS_FORMAT_CURL_OFF_T "I64d"
+# define CURLSYS_FORMAT_CURL_OFF_TU "I64u"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T i64
+# define CURLSYS_SUFFIX_CURL_OFF_TU ui64
+# else
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long
+# define CURLSYS_FORMAT_CURL_OFF_T "ld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 4
+# define CURLSYS_SUFFIX_CURL_OFF_T L
+# define CURLSYS_SUFFIX_CURL_OFF_TU UL
+# endif
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T int
+# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+
+/* ===================================== */
+/* KEEP GENERIC GCC THE LAST ENTRY */
+/* ===================================== */
+
+#elif defined(__GNUC__)
+# if !defined(__LP64__) && (defined(__ILP32__) || \
+ defined(__i386__) || defined(__ppc__) || defined(__arm__) || \
+ defined(__sparc__) || defined(__mips__) || defined(__sh__))
+# define CURLSYS_SIZEOF_LONG 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long long
+# define CURLSYS_FORMAT_CURL_OFF_T "lld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "llu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T LL
+# define CURLSYS_SUFFIX_CURL_OFF_TU ULL
+# elif defined(__LP64__) || \
+ defined(__x86_64__) || defined(__ppc64__) || defined(__sparc64__)
+# define CURLSYS_SIZEOF_LONG 8
+# define CURLSYS_TYPEOF_CURL_OFF_T long
+# define CURLSYS_FORMAT_CURL_OFF_T "ld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
+# define CURLSYS_SIZEOF_CURL_OFF_T 8
+# define CURLSYS_SUFFIX_CURL_OFF_T L
+# define CURLSYS_SUFFIX_CURL_OFF_TU UL
+# endif
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T socklen_t
+# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+# define CURLSYS_PULL_SYS_TYPES_H 1
+# define CURLSYS_PULL_SYS_SOCKET_H 1
+
+#else
+/* generic "safe guess" on old 32 bit style */
+# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+# define CURLSYS_SIZEOF_CURL_OFF_T 4
+# define CURLSYS_TYPEOF_CURL_OFF_T long
+# define CURLSYS_FORMAT_CURL_OFF_T "ld"
+# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
+# define CURLSYS_SUFFIX_CURL_OFF_T L
+# define CURLSYS_SUFFIX_CURL_OFF_TU UL
+# define CURLSYS_TYPEOF_CURL_SOCKLEN_T int
+#endif
+
+/* CURLSYS_PULL_SYS_TYPES_H is defined above when inclusion of header file */
+/* sys/types.h is required here to properly make type definitions below. */
+#ifdef CURLSYS_PULL_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+/* CURLSYS_PULL_SYS_SOCKET_H is defined above when inclusion of header file */
+/* sys/socket.h is required here to properly make type definitions below. */
+#ifdef CURLSYS_PULL_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif
+
+/* Data type definition of curl_socklen_t. */
+#ifdef CURLSYS_TYPEOF_CURL_SOCKLEN_T
+ typedef CURLSYS_TYPEOF_CURL_SOCKLEN_T curlsys_socklen_t;
+#endif
+
+/* Data type definition of curl_off_t. */
+
+#ifdef CURLSYS_TYPEOF_CURL_OFF_T
+ typedef CURLSYS_TYPEOF_CURL_OFF_T curlsys_off_t;
+#endif
+
+#endif /* __CURL_SYSTEM_H */
+
diff --git a/lib/curl_setup.h b/lib/curl_setup.h
index 0fe3633ec..9d99f1394 100644
--- a/lib/curl_setup.h
+++ b/lib/curl_setup.h
@@ -124,18 +124,7 @@
/* please, do it beyond the point further indicated in this file. */
/* ================================================================ */
-/*
- * libcurl's external interface definitions are also used internally,
- * and might also include required system header files to define them.
- */
-
-#include <curl/curlbuild.h>
-
-/*
- * Compile time sanity checks must also be done when building the library.
- */
-
-#include <curl/curlrules.h>
+#include <curl/curl.h>
/*
* Ensure that no one is using the old SIZEOF_CURL_OFF_T macro
diff --git a/tests/data/Makefile.inc b/tests/data/Makefile.inc
index e908c12b9..d89d53249 100644
--- a/tests/data/Makefile.inc
+++ b/tests/data/Makefile.inc
@@ -163,7 +163,7 @@ test1520 \
\
test1525 test1526 test1527 test1528 test1529 test1530 test1531 test1532 \
test1533 test1534 test1535 test1536 \
-test1540 \
+test1540 test1541 \
\
test1600 test1601 test1602 test1603 test1604 test1605 \
\
diff --git a/tests/data/test1541 b/tests/data/test1541
new file mode 100644
index 000000000..3d04cb4f9
--- /dev/null
+++ b/tests/data/test1541
@@ -0,0 +1,22 @@
+<testcase>
+<info>
+<keywords>
+typecheck
+</keywords>
+</info>
+
+#
+# Client-side
+<client>
+<server>
+none
+</server>
+ <name>
+verify curl/system.h detection
+ </name>
+<tool>
+lib1541
+</tool>
+</client>
+
+</testcase>
diff --git a/tests/libtest/Makefile.inc b/tests/libtest/Makefile.inc
index d85956d8b..66e2f1c6b 100644
--- a/tests/libtest/Makefile.inc
+++ b/tests/libtest/Makefile.inc
@@ -25,7 +25,7 @@ noinst_PROGRAMS = chkhostname libauthretry libntlmconnect \
lib1520 \
lib1525 lib1526 lib1527 lib1528 lib1529 lib1530 lib1531 lib1532 lib1533 \
lib1534 lib1535 lib1536 \
- lib1540 \
+ lib1540 lib1541 \
lib1900 \
lib2033
@@ -417,6 +417,10 @@ lib1540_SOURCES = lib1540.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
lib1540_LDADD = $(TESTUTIL_LIBS)
lib1540_CPPFLAGS = $(AM_CPPFLAGS)
+lib1541_SOURCES = lib1541.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
+lib1541_LDADD = $(TESTUTIL_LIBS)
+lib1541_CPPFLAGS = $(AM_CPPFLAGS)
+
lib1900_SOURCES = lib1900.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
lib1900_LDADD = $(TESTUTIL_LIBS)
lib1900_CPPFLAGS = $(AM_CPPFLAGS)
diff --git a/tests/libtest/lib1541.c b/tests/libtest/lib1541.c
new file mode 100644
index 000000000..ef993dd66
--- /dev/null
+++ b/tests/libtest/lib1541.c
@@ -0,0 +1,109 @@
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at https://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+#include "test.h"
+
+#include "testutil.h"
+#include "warnless.h"
+#include "memdebug.h"
+
+#define XSTR(x) #x
+#define STRING(y) XSTR(y)
+
+int test(char *URL)
+{
+ char detect[512];
+ char syst[512];
+
+ const char *types_h = "No";
+ const char *socket_h = "No";
+ const char *stypes_h = "No";
+ const char *ssocket_h = "No";
+
+ (void)(URL);
+
+#ifdef CURL_PULL_SYS_TYPES_H
+ types_h = "Yes";
+#endif
+#ifdef CURL_PULL_SYS_SOCKET_H
+ socket_h = "Yes";
+#endif
+ snprintf(detect, sizeof(detect),
+ "CURL_TYPEOF_CURL_OFF_T: %s\n"
+ "CURL_FORMAT_CURL_OFF_T: %s\n"
+ "CURL_FORMAT_CURL_OFF_TU: %s\n"
+ "CURL_SUFFIX_CURL_OFF_T: %s\n"
+ "CURL_SUFFIX_CURL_OFF_TU: %s\n"
+ "CURL_SIZEOF_CURL_OFF_T: %d\n"
+ "CURL_SIZEOF_LONG: %d\n"
+ "CURL_TYPEOF_CURL_SOCKLEN_T: %s\n"
+ "CURL_PULL_SYS_TYPES_H: %s\n"
+ "CURL_PULL_SYS_SOCKET_H: %s\n"
+
+ , STRING(CURL_TYPEOF_CURL_OFF_T)
+ , CURL_FORMAT_CURL_OFF_T
+ , CURL_FORMAT_CURL_OFF_TU
+ , STRING(CURL_SUFFIX_CURL_OFF_T)
+ , STRING(CURL_SUFFIX_CURL_OFF_TU)
+ , CURL_SIZEOF_CURL_OFF_T
+ , CURL_SIZEOF_LONG
+ , STRING(CURL_TYPEOF_CURL_SOCKLEN_T)
+ , types_h
+ , socket_h);
+
+#ifdef CURLSYS_PULL_SYS_TYPES_H
+ stypes_h = "Yes";
+#endif
+#ifdef CURLSYS_PULL_SYS_SOCKET_H
+ ssocket_h = "Yes";
+#endif
+ snprintf(syst, sizeof(syst),
+ "CURL_TYPEOF_CURL_OFF_T: %s\n"
+ "CURL_FORMAT_CURL_OFF_T: %s\n"
+ "CURL_FORMAT_CURL_OFF_TU: %s\n"
+ "CURL_SUFFIX_CURL_OFF_T: %s\n"
+ "CURL_SUFFIX_CURL_OFF_TU: %s\n"
+ "CURL_SIZEOF_CURL_OFF_T: %d\n"
+ "CURL_SIZEOF_LONG: %d\n"
+ "CURL_TYPEOF_CURL_SOCKLEN_T: %s\n"
+ "CURL_PULL_SYS_TYPES_H: %s\n"
+ "CURL_PULL_SYS_SOCKET_H: %s\n"
+
+ , STRING(CURLSYS_TYPEOF_CURL_OFF_T)
+ , CURLSYS_FORMAT_CURL_OFF_T
+ , CURLSYS_FORMAT_CURL_OFF_TU
+ , STRING(CURLSYS_SUFFIX_CURL_OFF_T)
+ , STRING(CURLSYS_SUFFIX_CURL_OFF_TU)
+ , CURLSYS_SIZEOF_CURL_OFF_T
+ , CURLSYS_SIZEOF_LONG
+ , STRING(CURLSYS_TYPEOF_CURL_SOCKLEN_T)
+ , stypes_h
+ , ssocket_h);
+
+ if(strcmp(detect, syst)) {
+ printf("===> Type detection failed <====\n");
+ printf("[Detected]\n%s", detect);
+ printf("[System]\n%s", syst);
+ return 1; /* FAIL! */
+ }
+
+ return 0;
+}