summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2008-08-07 00:29:08 +0000
committerYang Tse <yangsita@gmail.com>2008-08-07 00:29:08 +0000
commit14240e9e109fe6af19438c6531d573f85dbb0b1e (patch)
tree61c5713bff289fbdc27e019b71427723bfb78dbc
parenta3045b4e4944a36f467f363607d6c6a50727fca2 (diff)
downloadcurl-14240e9e109fe6af19438c6531d573f85dbb0b1e.tar.gz
Initial support of curlbuild.h and curlrules.h which allows
to have a curl_off_t data type no longer gated to off_t.
-rw-r--r--CHANGES7
-rw-r--r--RELEASE-NOTES1
-rw-r--r--acinclude.m4258
-rw-r--r--ares/Makefile.am26
-rw-r--r--ares/configure.ac1
-rw-r--r--buildconf.bat3
-rw-r--r--configure.ac9
-rw-r--r--docs/examples/Makefile.am4
-rw-r--r--include/README33
-rw-r--r--include/curl/.cvsignore3
-rw-r--r--include/curl/Makefile.am23
-rw-r--r--include/curl/curl.h82
-rw-r--r--include/curl/curlbuild.h.dist352
-rw-r--r--include/curl/curlbuild.h.in129
-rw-r--r--include/curl/curlrules.h149
-rw-r--r--lib/Makefile.am6
-rw-r--r--lib/Makefile.netware1
-rw-r--r--lib/config-amigaos.h1
-rw-r--r--lib/config-os400.h4
-rw-r--r--lib/config-symbian.h3
-rw-r--r--lib/config-tpf.h3
-rw-r--r--lib/config-win32.h15
-rw-r--r--lib/config-win32ce.h8
-rw-r--r--lib/config.dos1
-rw-r--r--lib/setup.h81
-rw-r--r--packages/vms/config-vms.h10
-rw-r--r--src/Makefile.Watcom2
-rw-r--r--src/Makefile.am10
-rw-r--r--src/Makefile.netware1
-rw-r--r--src/setup.h4
-rw-r--r--tests/libtest/Makefile.am6
-rw-r--r--tests/server/Makefile.am6
32 files changed, 1076 insertions, 166 deletions
diff --git a/CHANGES b/CHANGES
index 52f685888..e56030e38 100644
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,13 @@
Changelog
+Yang Tse (7 Aug 2008)
+- Added curlbuild.h and curlrules.h header files to libcurl's public headers.
+ File curlbuild.h is a generated file on configure-capable systems. This is
+ a first step towards configure-based info in public headers. Currently only
+ used to provide support for a curl_off_t data type which is not gated to
+ off_t. Further details are documented inside these mentioned header files.
+
Yang Tse (5 Aug 2008)
- Changes done to buildconf script. Validate that autom4te and autoconf, as
well as aclocal and automake, versions match. Improve removal of previous
diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index f885fc89c..5b1926453 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -21,6 +21,7 @@ This release includes the following changes:
o the curl tool's -w option support the %{ssl_verify_result} variable
o Added CURLOPT_ADDRESS_SCOPE and scope parsing of the URL according to RFC4007
o Support --append on SFTP uploads (not with OpenSSH, though)
+ o Added curlbuild.h and curlrules.h to the external library interface
This release includes the following bugfixes:
diff --git a/acinclude.m4 b/acinclude.m4
index 4c54d5484..34d0ba1db 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -3533,3 +3533,261 @@ AC_HELP_STRING([--without-ca-path], [Don't use a default CA path]),
])
+dnl CURL_DEFINE_UNQUOTED (VARIABLE, [VALUE])
+dnl -------------------------------------------------
+dnl Like AC_DEFINE_UNQUOTED this macro will define a C preprocessor
+dnl symbol that can be further used in custom template configuration
+dnl files. This macro, unlike AC_DEFINE_UNQUOTED, does not use a third
+dnl argument for the description. Symbol definitions done with this
+dnl macro are intended to be exclusively used in handcrafted *.h.in
+dnl template files. Contrary to what AC_DEFINE_UNQUOTED does, this one
+dnl prevents autoheader generation and insertion of symbol template
+dnl stub and definition into the first configuration header file. Do
+dnl not use this macro as a replacement for AC_DEFINE_UNQUOTED, each
+dnl one serves different functional needs.
+
+AC_DEFUN([CURL_DEFINE_UNQUOTED], [
+cat >>confdefs.h <<_EOF
+[@%:@define] $1 ifelse($#, 2, [$2], 1)
+_EOF
+])
+
+
+dnl CURL_INCLUDES_INTTYPES
+dnl -------------------------------------------------
+dnl Set up variable with list of headers that must be
+dnl included when inttypes.h is to be included.
+
+AC_DEFUN([CURL_INCLUDES_INTTYPES], [
+curl_includes_inttypes="\
+/* includes start */
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+/* includes end */"
+ AC_CHECK_HEADERS(
+ sys/types.h stdint.h inttypes.h,
+ [], [], [$curl_includes_inttypes])
+])
+
+
+dnl DO_CURL_OFF_T_CHECK(TYPE, SIZE)
+dnl -------------------------------------------------
+dnl Internal macro for CURL_CONFIGURE_CURL_OFF_T
+
+AC_DEFUN([DO_CURL_OFF_T_CHECK], [
+ AC_REQUIRE([CURL_INCLUDES_INTTYPES])dnl
+ if test "$x_typeof" = "unknown"; then
+ tmp_includes=""
+ tmp_source=""
+ tmp_fmt=""
+ case AS_TR_SH([$1]) in
+ int64_t)
+ tmp_includes="$curl_includes_inttypes"
+ tmp_source="char f@<:@@:>@ = PRId64;"
+ tmp_fmt="PRId64"
+ ;;
+ int32_t)
+ tmp_includes="$curl_includes_inttypes"
+ tmp_source="char f@<:@@:>@ = PRId32;"
+ tmp_fmt="PRId32"
+ ;;
+ int16_t)
+ tmp_includes="$curl_includes_inttypes"
+ tmp_source="char f@<:@@:>@ = PRId16;"
+ tmp_fmt="PRId16"
+ ;;
+ esac
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+ $tmp_includes
+ typedef $1 curl_off_t;
+ typedef char dummy_arr[sizeof(curl_off_t) == $2 ? 1 : -1];
+ ]],[[
+ $tmp_source
+ curl_off_t dummy;
+ ]])
+ ],[
+ if test -z "$tmp_fmt"; then
+ x_typeof="$1"
+ x_sizeof="$2"
+ else
+ CURL_CHECK_DEF([$tmp_fmt], [$curl_includes_inttypes], [silent])
+ AS_VAR_PUSHDEF([tmp_HaveDef], [curl_cv_have_def_$tmp_fmt])dnl
+ AS_VAR_PUSHDEF([tmp_Def], [curl_cv_def_$tmp_fmt])dnl
+ if test AS_VAR_GET([tmp_HaveDef]) = "yes"; then
+ x_format=AS_VAR_GET([tmp_Def])
+ x_typeof="$1"
+ x_sizeof="$2"
+ fi
+ AS_VAR_POPDEF([tmp_Def])dnl
+ AS_VAR_POPDEF([tmp_HaveDef])dnl
+ fi
+ ])
+ fi
+])
+
+
+dnl CURL_CONFIGURE_CURL_OFF_T
+dnl -------------------------------------------------
+dnl Find out suitable curl_off_t data type definition and associated
+dnl items, and make the appropriate definitions used in template file
+dnl include/curl/curlbuild.h.in to properly configure the library.
+
+AC_DEFUN([CURL_CONFIGURE_CURL_OFF_T], [
+ AC_REQUIRE([CURL_INCLUDES_INTTYPES])dnl
+ #
+ AC_BEFORE([$0],[AC_SYS_LARGEFILE])dnl
+ AC_BEFORE([$0],[CURL_CONFIGURE_REENTRANT])dnl
+ AC_BEFORE([$0],[CURL_CHECK_AIX_ALL_SOURCE])dnl
+ #
+ if test -z "$SED"; then
+ AC_MSG_ERROR([SED not set. Cannot continue without SED being set.])
+ fi
+ #
+ AC_CHECK_SIZEOF(long)
+ AC_CHECK_SIZEOF(void*)
+ #
+ if test -z "$ac_cv_sizeof_long" ||
+ test "$ac_cv_sizeof_long" -eq "0"; then
+ AC_MSG_ERROR([cannot find out size of long.])
+ fi
+ if test -z "$ac_cv_sizeof_voidp" ||
+ test "$ac_cv_sizeof_voidp" -eq "0"; then
+ AC_MSG_ERROR([cannot find out size of void*.])
+ fi
+ #
+ x_LP64_long=""
+ x_LP32_long=""
+ x_LP16_long=""
+ #
+ if test "$ac_cv_sizeof_long" -eq "8" &&
+ test "$ac_cv_sizeof_voidp" -ge "8"; then
+ x_LP64_long="long"
+ elif test "$ac_cv_sizeof_long" -eq "4" &&
+ test "$ac_cv_sizeof_voidp" -ge "4"; then
+ x_LP32_long="long"
+ elif test "$ac_cv_sizeof_long" -eq "2" &&
+ test "$ac_cv_sizeof_voidp" -ge "2"; then
+ x_LP16_long="long"
+ fi
+ #
+ dnl DO_CURL_OFF_T_CHECK results are stored in next 3 vars
+ #
+ x_typeof="unknown"
+ x_sizeof="unknown"
+ x_format="unknown"
+ u_format="unknown"
+ #
+ if test "$x_typeof" = "unknown"; then
+ AC_MSG_CHECKING([for 64-bit curl_off_t data type])
+ for t8 in \
+ "$x_LP64_long" \
+ 'signed __int64' \
+ 'int64_t' \
+ 'long long' \
+ '__longlong' \
+ '__longlong_t' ; do
+ DO_CURL_OFF_T_CHECK([$t8], [8])
+ done
+ AC_MSG_RESULT([$x_typeof])
+ fi
+ if test "$x_typeof" = "unknown"; then
+ AC_MSG_CHECKING([for 32-bit curl_off_t data type])
+ for t4 in \
+ "$x_LP32_long" \
+ 'signed __int32' \
+ 'int32_t' \
+ 'int' ; do
+ DO_CURL_OFF_T_CHECK([$t4], [4])
+ done
+ AC_MSG_RESULT([$x_typeof])
+ fi
+ if test "$x_typeof" = "unknown"; then
+ AC_MSG_CHECKING([for 16-bit curl_off_t data type])
+ for t2 in \
+ "$x_LP16_long" \
+ 'signed __int16' \
+ 'int16_t' \
+ 'int' ; do
+ DO_CURL_OFF_T_CHECK([$t2], [2])
+ done
+ AC_MSG_RESULT([$x_typeof])
+ fi
+ if test "$x_typeof" = "unknown"; then
+ AC_MSG_ERROR([cannot find data type for curl_off_t.])
+ fi
+ #
+ AC_MSG_CHECKING([size of curl_off_t])
+ AC_MSG_RESULT([$x_sizeof])
+ #
+ AC_MSG_CHECKING([formatting string directive for curl_off_t])
+ if test "$x_format" != "unknown"; then
+ x_pull_headers="yes"
+ x_format=`echo "$x_format" | "$SED" 's/[["]]//g'`
+ u_format=`echo "$x_format" | "$SED" 's/i$/u/'`
+ u_format=`echo "$u_format" | "$SED" 's/d$/u/'`
+ u_format=`echo "$u_format" | "$SED" 's/D$/U/'`
+ else
+ x_pull_headers="no"
+ case AS_TR_SH([$x_typeof]) in
+ long_long | __longlong | __longlong_t)
+ x_format="lld"
+ u_format="llu"
+ ;;
+ long)
+ x_format="ld"
+ u_format="lu"
+ ;;
+ int)
+ x_format="d"
+ u_format="u"
+ ;;
+ signed___int64)
+ x_format="I64d"
+ u_format="I64u"
+ ;;
+ signed___int32)
+ x_format="I32d"
+ u_format="I32u"
+ ;;
+ signed___int16)
+ x_format="I16d"
+ u_format="I16u"
+ ;;
+ *)
+ AC_MSG_ERROR([cannot find print format string for curl_off_t.])
+ ;;
+ esac
+ fi
+ AC_MSG_RESULT(["$x_format"])
+ #
+ AC_MSG_CHECKING([formatting string directive for unsigned curl_off_t])
+ AC_MSG_RESULT(["$u_format"])
+ #
+ if test "$x_pull_headers" = "yes"; then
+ if test "x$ac_cv_header_sys_types_h" = "xyes"; then
+ CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_TYPES_H])
+ fi
+ if test "x$ac_cv_header_stdint_h" = "xyes"; then
+ CURL_DEFINE_UNQUOTED([CURL_PULL_STDINT_H])
+ fi
+ if test "x$ac_cv_header_inttypes_h" = "xyes"; then
+ CURL_DEFINE_UNQUOTED([CURL_PULL_INTTYPES_H])
+ fi
+ fi
+ #
+ CURL_DEFINE_UNQUOTED([CURL_OFF_T], [$x_typeof])
+ CURL_DEFINE_UNQUOTED([CURL_FMT_OFF_T], ["$x_format"])
+ CURL_DEFINE_UNQUOTED([CURL_FMT_OFF_TU], ["$u_format"])
+ CURL_DEFINE_UNQUOTED([CURL_FORMAT_OFF_T], ["%$x_format"])
+ CURL_DEFINE_UNQUOTED([CURL_SIZEOF_CURL_OFF_T], [$x_sizeof])
+ #
+])
+
diff --git a/ares/Makefile.am b/ares/Makefile.am
index 04db9ecc9..b12111192 100644
--- a/ares/Makefile.am
+++ b/ares/Makefile.am
@@ -1,7 +1,31 @@
-AUTOMAKE_OPTIONS = foreign
+AUTOMAKE_OPTIONS = foreign nostdinc
ACLOCAL_AMFLAGS = -I m4
+# Specify our include paths here, and do it relative to $(top_srcdir) and
+# $(top_builddir), to ensure that these paths which belong to the library
+# being currently built and tested are searched before the library which
+# might possibly already be installed in the system.
+#
+# When using the low-level hard-hacking memory leak tracking code from
+# libcurl the generated curl/curlbuild.h file must also be reachable.
+# Using the libcurl lowlevel code from within c-ares library is ugly and
+# only works when c-ares is built and linked with a similarly debug-build
+# libcurl, but we do this anyway for convenience.
+#
+# $(top_builddir)/../include is for libcurl's generated curl/curlbuild.h file
+# $(top_builddir) is for c-ares's generated config.h file
+# $(top_srcdir) is for c-ares's lib/setup.h and other "c-ares-private" files
+
+if CURLDEBUG
+INCLUDES = -I$(top_builddir)/../include \
+ -I$(top_builddir) \
+ -I$(top_srcdir)
+else
+INCLUDES = -I$(top_builddir) \
+ -I$(top_srcdir)
+endif
+
lib_LTLIBRARIES = libcares.la
man_MANS = $(MANPAGES)
diff --git a/ares/configure.ac b/ares/configure.ac
index 8ba64e7e0..34888873d 100644
--- a/ares/configure.ac
+++ b/ares/configure.ac
@@ -122,6 +122,7 @@ AC_HELP_STRING([--disable-debug],[Disable debug options]),
AC_MSG_RESULT(no)
)
AM_CONDITIONAL(DEBUGBUILD, test x$debugbuild = xyes)
+AM_CONDITIONAL(CURLDEBUG, test x$debugbuild = xyes)
dnl skip libtool C++ and Fortran compiler checks
m4_ifdef([AC_PROG_CXX], [m4_undefine([AC_PROG_CXX])])
diff --git a/buildconf.bat b/buildconf.bat
index deeaea904..515256c12 100644
--- a/buildconf.bat
+++ b/buildconf.bat
@@ -8,3 +8,6 @@ copy src\hugehelp.c.cvs src\hugehelp.c
REM create Makefile
copy Makefile.dist Makefile
+
+REM create curlbuild.h
+copy include\curl\curlbuild.h.dist include\curl\curlbuild.h
diff --git a/configure.ac b/configure.ac
index f810ccce3..2c150038e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -33,7 +33,7 @@ This configure script may be copied, distributed and modified under the
terms of the curl license; see COPYING for more details])
AC_CONFIG_SRCDIR([lib/urldata.h])
-AM_CONFIG_HEADER(lib/config.h src/config.h)
+AM_CONFIG_HEADER(lib/config.h src/config.h include/curl/curlbuild.h)
AM_MAINTAINER_MODE
dnl SED is mandatory for configure process and libtool.
@@ -132,6 +132,9 @@ AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-machine-OS])
dnl Checks for programs.
AC_PROG_CC
+dnl Our curl_off_t internal and external configure settings
+CURL_CONFIGURE_CURL_OFF_T
+
dnl This defines _ALL_SOURCE for AIX
CURL_CHECK_AIX_ALL_SOURCE
@@ -1993,10 +1996,6 @@ AC_HEADER_TIME
CURL_CHECK_STRUCT_TIMEVAL
CURL_VERIFY_RUNTIMELIBS
-AC_CHECK_SIZEOF(curl_off_t, ,[
-#include <stdio.h>
-#include "$srcdir/include/curl/curl.h"
-])
AC_CHECK_SIZEOF(size_t)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(time_t)
diff --git a/docs/examples/Makefile.am b/docs/examples/Makefile.am
index e897844e8..886e8ada6 100644
--- a/docs/examples/Makefile.am
+++ b/docs/examples/Makefile.am
@@ -12,9 +12,11 @@ EXTRA_DIST = README Makefile.example Makefile.inc Makefile.m32 \
# being currently built and tested are searched before the library which
# might possibly already be installed in the system.
#
+# $(top_builddir)/include is for libcurl's generated curl/curlbuild.h file
# $(top_srcdir)/include is for libcurl's external include files
-INCLUDES = -I$(top_srcdir)/include
+INCLUDES = -I$(top_builddir)/include \
+ -I$(top_srcdir)/include
LIBDIR = $(top_builddir)/lib
diff --git a/include/README b/include/README
index f8482ba69..485722e30 100644
--- a/include/README
+++ b/include/README
@@ -7,7 +7,7 @@
Include files for libcurl, external users.
They're all placed in the curl subdirectory here for better fit in any kind
-of environment. You should include files from here using...
+of environment. You must include files from here using...
#include <curl/curl.h>
@@ -16,14 +16,31 @@ curl subdirectory. It makes it more likely to survive future modifications.
NOTE FOR LIBCURL HACKERS
-All the include files in this tree are written and intended to be installed on
-a system that may serve multiple platforms and multiple applications, all
-using libcurl (possibly even different libcurl installations using different
-versions). Therefore, all header files in here must obey these rules:
+The following notes apply to libcurl version 7.19.0 and later.
-* They cannot depend on or use configure-generated results from libcurl's or
- curl's directories. Other applications may not run configure as (lib)curl
- does, and using platform dependent info here may break other platforms.
+* The distributed curl/curlbuild.h file is only intended to be used on systems
+ which can not run the also distributed configure script.
+
+* The distributed curlbuild.h file is generated as a copy of curlbuild.h.dist
+ when the libcurl source code distribution archive file is originally created.
+
+* If you check out from CVS on a non-configure platform, you must run the
+ appropriate buildconf* script to set up curlbuild.h and other local files
+ before being able of compiling the library.
+
+* On systems capable of running the configure script, the configure process
+ will overwrite the distributed include/curl/curlbuild.h file with one that
+ is suitable and specific to the library being configured and built, which
+ is generated from the include/curl/curlbuild.h.in template file.
+
+* If you intend to distribute an already compiled libcurl library you _MUST_
+ also distribute along with it the generated curl/curlbuild.h which has been
+ used to compile it. Otherwise the library will be of no use for the users of
+ the library that you have built. It is _your_ responsability to provide this
+ file. No one at the cURL project can know how you have built the library.
+
+* File curl/curlbuild.h includes platform and configuration dependant info,
+ and must not be modified by anyone. Configure script generates it for you.
* We cannot assume anything else but very basic compiler features being
present. While libcurl requires an ANSI C compiler to build, some of the
diff --git a/include/curl/.cvsignore b/include/curl/.cvsignore
index 37c8aa7e2..67b973ae3 100644
--- a/include/curl/.cvsignore
+++ b/include/curl/.cvsignore
@@ -1,3 +1,4 @@
Makefile
Makefile.in
-*.dist
+curlbuild.h
+stamp-*
diff --git a/include/curl/Makefile.am b/include/curl/Makefile.am
index 707d1359f..bee5c25af 100644
--- a/include/curl/Makefile.am
+++ b/include/curl/Makefile.am
@@ -1,6 +1,25 @@
pkginclude_HEADERS = \
curl.h curlver.h easy.h mprintf.h stdcheaders.h types.h multi.h \
- typecheck-gcc.h
+ typecheck-gcc.h curlbuild.h curlrules.h
+
pkgincludedir= $(includedir)/curl
-CLEANFILES = *dist
+# curlbuild.h does not exist in the CVS tree. When the original libcurl
+# source code distribution archive file is created, curlbuild.h.dist is
+# renamed to curlbuild.h and included in the tarball so that it can be
+# used directly on non-configure systems.
+#
+# The distributed curlbuild.h will be overwritten on configure systems
+# when the configure script runs, with one that is suitable and specific
+# to the library being configured and built.
+#
+# curlbuild.h.in is the distributed template file from which the configure
+# script creates curlbuild.h at library configuration time, overwiting the
+# one included in the distribution archive.
+#
+# curlbuild.h.dist is not included in the source code distribution archive.
+
+EXTRA_DIST = curlbuild.h.in
+
+DISTCLEANFILES = curlbuild.h
+
diff --git a/include/curl/curl.h b/include/curl/curl.h
index da7cc0793..9dd54ff69 100644
--- a/include/curl/curl.h
+++ b/include/curl/curl.h
@@ -23,11 +23,17 @@
* $Id$
***************************************************************************/
-/* If you have problems, all libcurl docs and details are found here:
- http://curl.haxx.se/libcurl/
-*/
+/*
+ * If you have libcurl problems, all docs and details are found here:
+ * http://curl.haxx.se/libcurl/
+ *
+ * curl-library mailing list subscription and unsubscription web interface:
+ * http://cool.haxx.se/mailman/listinfo/curl-library/
+ */
-#include "curlver.h" /* the libcurl version defines */
+#include "curlver.h" /* libcurl version defines */
+#include "curl/curlbuild.h" /* libcurl build definitions */
+#include "curlrules.h" /* libcurl rules enforcement */
/*
* Define WIN32 when build target is Win32 API
@@ -113,74 +119,6 @@ typedef void CURL;
#endif
#endif
-/*
- * We want the typedef curl_off_t setup for large file support on all
- * platforms. We also provide a CURL_FORMAT_OFF_T define to use in *printf
- * format strings when outputting a variable of type curl_off_t.
- *
- * Note: "pocc -Ze" is MSVC compatibility mode and this sets _MSC_VER!
- */
-
-#if (defined(_MSC_VER) && !defined(__POCC__)) || (defined(__LCC__) && \
- defined(WIN32))
-/* MSVC */
-#ifdef _WIN32_WCE
- typedef long curl_off_t;
-#define CURL_FORMAT_OFF_T "%ld"
-#else
- typedef signed __int64 curl_off_t;
-#define CURL_FORMAT_OFF_T "%I64d"
-#endif
-#else /* (_MSC_VER && !__POCC__) || (__LCC__ && WIN32) */
-#if (defined(__GNUC__) && defined(WIN32)) || defined(__WATCOMC__)
-/* gcc on windows or Watcom */
- typedef long long curl_off_t;
-#define CURL_FORMAT_OFF_T "%I64d"
-#else /* GCC or Watcom on Windows */
-#if defined(__ILEC400__)
-/* OS400 C compiler. */
- typedef long long curl_off_t;
-#define CURL_FORMAT_OFF_T "%lld"
-#else /* OS400 C compiler. */
-
-/* "normal" POSIX approach, do note that this does not necessarily mean that
- the type is >32 bits, see the SIZEOF_CURL_OFF_T define for that! */
- typedef off_t curl_off_t;
-
-/* Check a range of defines to detect large file support. On Linux it seems
- none of these are set by default, so if you don't explicitly switches on
- large file support, this define will be made for "small file" support. */
-#ifndef _FILE_OFFSET_BITS
-#define _FILE_OFFSET_BITS 0 /* to prevent warnings in the check below */
-#define UNDEF_FILE_OFFSET_BITS
-#endif
-#ifndef FILESIZEBITS
-#define FILESIZEBITS 0 /* to prevent warnings in the check below */
-#define UNDEF_FILESIZEBITS
-#endif
-
-#if defined(_LARGE_FILES) || (_FILE_OFFSET_BITS > 32) || (FILESIZEBITS > 32) \
- || defined(_LARGEFILE_SOURCE) || defined(_LARGEFILE64_SOURCE)
- /* For now, we assume at least one of these to be set for large files to
- work! */
-#define CURL_FORMAT_OFF_T "%lld"
-#else /* LARGE_FILE support */
-#define CURL_FORMAT_OFF_T "%ld"
-#endif
-#endif /* OS400 C compiler. */
-#endif /* GCC or Watcom on Windows */
-#endif /* (_MSC_VER && !__POCC__) || (__LCC__ && WIN32) */
-
-#ifdef UNDEF_FILE_OFFSET_BITS
-/* this was defined above for our checks, undefine it again */
-#undef _FILE_OFFSET_BITS
-#endif
-
-#ifdef UNDEF_FILESIZEBITS
-/* this was defined above for our checks, undefine it again */
-#undef FILESIZEBITS
-#endif
-
#ifndef curl_socket_typedef
/* socket typedef */
#ifdef WIN32
diff --git a/include/curl/curlbuild.h.dist b/include/curl/curlbuild.h.dist
new file mode 100644
index 000000000..7dbafbce8
--- /dev/null
+++ b/include/curl/curlbuild.h.dist
@@ -0,0 +1,352 @@
+#ifndef __CURL_CURLBUILD_H
+#define __CURL_CURLBUILD_H
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2008, 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 http://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.
+ *
+ * $Id$
+ ***************************************************************************/
+
+/* ================================================================ */
+/* NOTES FOR CONFIGURE CAPABLE SYSTEMS */
+/* ================================================================ */
+
+/*
+ * NOTE 1:
+ * -------
+ *
+ * See file include/curl/curlbuild.h.in, run configure, and forget
+ * that this file exists it is only used for non-configure systems.
+ * But you can keep reading if you want ;-)
+ *
+ */
+
+/* ================================================================ */
+/* NOTES FOR NON-CONFIGURE SYSTEMS */
+/* ================================================================ */
+
+/*
+ * NOTE 1:
+ * -------
+ *
+ * Nothing in this file is intended to be modified or adjusted by the
+ * curl library user nor by the curl library builder.
+ *
+ * If you think that something actually needs to be changed, adjusted
+ * or fixed in this file, then, report it on the libcurl development
+ * mailing list: http://cool.haxx.se/mailman/listinfo/curl-library/
+ *
+ * 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.
+ *
+ * This header file shall only export symbols which are 'curl' or 'CURL'
+ * prefixed, otherwise public name space would be polluted.
+ *
+ * NOTE 2:
+ * -------
+ *
+ * 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 independant 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 independant 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.
+ *
+ * NOTE 3:
+ * -------
+ *
+ * Right now you might be staring at file include/curl/curlbuild.h.dist or
+ * at file include/curl/curlbuild.h, this is due to the following reason:
+ * file include/curl/curlbuild.h.dist is renamed to include/curl/curlbuild.h
+ * when the libcurl source code distribution archive file is created.
+ *
+ * File include/curl/curlbuild.h.dist is not included in the distribution
+ * archive. File include/curl/curlbuild.h is not present in the CVS tree.
+ *
+ * The distributed include/curl/curlbuild.h file is only intended to be used
+ * on systems which can not run the also distributed configure script.
+ *
+ * On systems capable of running the configure script, the configure process
+ * will overwrite the distributed include/curl/curlbuild.h file with one that
+ * is suitable and specific to the library being configured and built, which
+ * is generated from the include/curl/curlbuild.h.in template file.
+ *
+ * If you check out from CVS on a non-configure platform, you must run the
+ * appropriate buildconf* script to set up curlbuild.h and other local files.
+ *
+ */
+
+/* ================================================================ */
+/* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */
+/* ================================================================ */
+
+#ifdef CURL_OFF_T
+# error "CURL_OFF_T shall not be defined except in curlbuild.h"
+ Error Compilation_aborted_CURL_OFF_T_already_defined
+#endif
+
+#ifdef CURL_FMT_OFF_T
+# error "CURL_FMT_OFF_T shall not be defined except in curlbuild.h"
+ Error Compilation_aborted_CURL_FMT_OFF_T_already_defined
+#endif
+
+#ifdef CURL_FMT_OFF_TU
+# error "CURL_FMT_OFF_TU shall not be defined except in curlbuild.h"
+ Error Compilation_aborted_CURL_FMT_OFF_TU_already_defined
+#endif
+
+#ifdef CURL_FORMAT_OFF_T
+# error "CURL_FORMAT_OFF_T shall not be defined except in curlbuild.h"
+ Error Compilation_aborted_CURL_FORMAT_OFF_T_already_defined
+#endif
+
+#ifdef CURL_SIZEOF_CURL_OFF_T
+# error "CURL_SIZEOF_CURL_OFF_T shall not be defined except in curlbuild.h"
+ Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_already_defined
+#endif
+
+/* ================================================================ */
+/* EXTERNAL INTERFACE SETTINGS FOR NON-CONFIGURE SYSTEMS ONLY */
+/* ================================================================ */
+
+#if defined(__DJGPP__)
+# define CURL_OFF_T long
+# define CURL_FMT_OFF_T "ld"
+# define CURL_FMT_OFF_TU "lu"
+# define CURL_FORMAT_OFF_T "%ld"
+# define CURL_SIZEOF_CURL_OFF_T 4
+
+#elif defined(__SALFORDC__)
+# define CURL_OFF_T long
+# define CURL_FMT_OFF_T "ld"
+# define CURL_FMT_OFF_TU "lu"
+# define CURL_FORMAT_OFF_T "%ld"
+# define CURL_SIZEOF_CURL_OFF_T 4
+
+#elif defined(__BORLANDC__)
+# if (__BORLANDC__ < 0x520)
+# define CURL_OFF_T long
+# define CURL_FMT_OFF_T "ld"
+# define CURL_FMT_OFF_TU "lu"
+# define CURL_FORMAT_OFF_T "%ld"
+# define CURL_SIZEOF_CURL_OFF_T 4
+# else
+# define CURL_OFF_T signed __int64
+# define CURL_FMT_OFF_T "I64d"
+# define CURL_FMT_OFF_TU "I64u"
+# define CURL_FORMAT_OFF_T "%I64d"
+# define CURL_SIZEOF_CURL_OFF_T 8
+# endif
+
+#elif defined(__TURBOC__)
+# define CURL_OFF_T long
+# define CURL_FMT_OFF_T "ld"
+# define CURL_FMT_OFF_TU "lu"
+# define CURL_FORMAT_OFF_T "%ld"
+# define CURL_SIZEOF_CURL_OFF_T 4
+
+#elif defined(__WATCOMC__)
+# if defined(__386__)
+# define CURL_OFF_T signed __int64
+# define CURL_FMT_OFF_T "I64d"
+# define CURL_FMT_OFF_TU "I64u"
+# define CURL_FORMAT_OFF_T "%I64d"
+# define CURL_SIZEOF_CURL_OFF_T 8
+# else
+# define CURL_OFF_T long
+# define CURL_FMT_OFF_T "ld"
+# define CURL_FMT_OFF_TU "lu"
+# define CURL_FORMAT_OFF_T "%ld"
+# define CURL_SIZEOF_CURL_OFF_T 4
+# endif
+
+#elif defined(__POCC__)
+# if (__POCC__ < 280)
+# define CURL_OFF_T long
+# define CURL_FMT_OFF_T "ld"
+# define CURL_FMT_OFF_TU "lu"
+# define CURL_FORMAT_OFF_T "%ld"
+# define CURL_SIZEOF_CURL_OFF_T 4
+# elif defined(_MSC_VER)
+# define CURL_OFF_T signed __int64
+# define CURL_FMT_OFF_T "I64d"
+# define CURL_FMT_OFF_TU "I64u"
+# define CURL_FORMAT_OFF_T "%I64d"
+# define CURL_SIZEOF_CURL_OFF_T 8
+# else
+# define CURL_OFF_T long long
+# define CURL_FMT_OFF_T "lld"
+# define CURL_FMT_OFF_TU "llu"
+# define CURL_FORMAT_OFF_T "%lld"
+# define CURL_SIZEOF_CURL_OFF_T 8
+# endif
+
+#elif defined(__LCC__)
+# define CURL_OFF_T long
+# define CURL_FMT_OFF_T "ld"
+# define CURL_FMT_OFF_TU "lu"
+# define CURL_FORMAT_OFF_T "%ld"
+# define CURL_SIZEOF_CURL_OFF_T 4
+
+#elif defined(__SYMBIAN32__)
+# if defined(__GCC32__)
+# define CURL_OFF_T long long
+# define CURL_FMT_OFF_T "lld"
+# define CURL_FMT_OFF_TU "llu"
+# define CURL_FORMAT_OFF_T "%lld"
+# define CURL_SIZEOF_CURL_OFF_T 8
+# elif defined(__CW32__)
+# pragma longlong on
+# define CURL_OFF_T long long
+# define CURL_FMT_OFF_T "lld"
+# define CURL_FMT_OFF_TU "llu"
+# define CURL_FORMAT_OFF_T "%lld"
+# define CURL_SIZEOF_CURL_OFF_T 8
+# elif defined(__VC32__)
+# define CURL_OFF_T signed __int64
+# define CURL_FMT_OFF_T "lld"
+# define CURL_FMT_OFF_TU "llu"
+# define CURL_FORMAT_OFF_T "%lld"
+# define CURL_SIZEOF_CURL_OFF_T 8
+# endif
+
+#elif defined(_WIN32_WCE)
+# define CURL_OFF_T signed __int64
+# define CURL_FMT_OFF_T "I64d"
+# define CURL_FMT_OFF_TU "I64u"
+# define CURL_FORMAT_OFF_T "%I64d"
+# define CURL_SIZEOF_CURL_OFF_T 8
+
+#elif defined(__MINGW32__)
+# define CURL_OFF_T long long
+# define CURL_FMT_OFF_T "I64d"
+# define CURL_FMT_OFF_TU "I64u"
+# define CURL_FORMAT_OFF_T "%I64d"
+# define CURL_SIZEOF_CURL_OFF_T 8
+
+#elif defined(_MSC_VER)
+# if (_MSC_VER >= 900)
+# define CURL_OFF_T signed __int64
+# define CURL_FMT_OFF_T "I64d"
+# define CURL_FMT_OFF_TU "I64u"
+# define CURL_FORMAT_OFF_T "%I64d"
+# define CURL_SIZEOF_CURL_OFF_T 8
+# else
+# define CURL_OFF_T long
+# define CURL_FMT_OFF_T "ld"
+# define CURL_FMT_OFF_TU "lu"
+# define CURL_FORMAT_OFF_T "%ld"
+# define CURL_SIZEOF_CURL_OFF_T 4
+# endif
+
+#elif defined(__VMS)
+# if defined(__alpha) || defined(__ia64)
+# define CURL_OFF_T long long
+# define CURL_FMT_OFF_T "lld"
+# define CURL_FMT_OFF_TU "llu"
+# define CURL_FORMAT_OFF_T "%lld"
+# define CURL_SIZEOF_CURL_OFF_T 8
+# else
+# define CURL_OFF_T long
+# define CURL_FMT_OFF_T "ld"
+# define CURL_FMT_OFF_TU "lu"
+# define CURL_FORMAT_OFF_T "%ld"
+# define CURL_SIZEOF_CURL_OFF_T 4
+# endif
+
+#elif defined(__OS400__)
+# if defined(__ILEC400__)
+# define CURL_OFF_T long long
+# define CURL_FMT_OFF_T "lld"
+# define CURL_FMT_OFF_TU "llu"
+# define CURL_FORMAT_OFF_T "%lld"
+# define CURL_SIZEOF_CURL_OFF_T 8
+# endif
+
+#elif defined(__MVS__)
+# if defined(__IBMC__) || defined(__IBMCPP__)
+# if defined(_LONG_LONG)
+# define CURL_OFF_T long long
+# define CURL_FMT_OFF_T "lld"
+# define CURL_FMT_OFF_TU "llu"
+# define CURL_FORMAT_OFF_T "%lld"
+# define CURL_SIZEOF_CURL_OFF_T 8
+# elif defined(_LP64)
+# define CURL_OFF_T long
+# define CURL_FMT_OFF_T "ld"
+# define CURL_FMT_OFF_TU "lu"
+# define CURL_FORMAT_OFF_T "%ld"
+# define CURL_SIZEOF_CURL_OFF_T 8
+# else
+# define CURL_OFF_T long
+# define CURL_FMT_OFF_T "ld"
+# define CURL_FMT_OFF_TU "lu"
+# define CURL_FORMAT_OFF_T "%ld"
+# define CURL_SIZEOF_CURL_OFF_T 4
+# endif
+# endif
+
+#elif defined(__370__)
+# if defined(__IBMC__) || defined(__IBMCPP__)
+# if defined(_LONG_LONG)
+# define CURL_OFF_T long long
+# define CURL_FMT_OFF_T "lld"
+# define CURL_FMT_OFF_TU "llu"
+# define CURL_FORMAT_OFF_T "%lld"
+# define CURL_SIZEOF_CURL_OFF_T 8
+# elif defined(_LP64)
+# define CURL_OFF_T long
+# define CURL_FMT_OFF_T "ld"
+# define CURL_FMT_OFF_TU "lu"
+# define CURL_FORMAT_OFF_T "%ld"
+# define CURL_SIZEOF_CURL_OFF_T 8
+# else
+# define CURL_OFF_T long
+# define CURL_FMT_OFF_T "ld"
+# define CURL_FMT_OFF_TU "lu"
+# define CURL_FORMAT_OFF_T "%ld"
+# define CURL_SIZEOF_CURL_OFF_T 4
+# endif
+# endif
+
+#else
+# error "Unknown non-configure build target!"
+ Error Compilation_aborted_Unknown_non_configure_build_target
+#endif
+
+/* Data type definition of curl_off_t. */
+
+#ifdef CURL_OFF_T
+ typedef CURL_OFF_T curl_off_t;
+#endif
+
+#endif /* __CURL_CURLBUILD_H */
diff --git a/include/curl/curlbuild.h.in b/include/curl/curlbuild.h.in
new file mode 100644
index 000000000..cc4d77eb8
--- /dev/null
+++ b/include/curl/curlbuild.h.in
@@ -0,0 +1,129 @@
+#ifndef __CURL_CURLBUILD_H
+#define __CURL_CURLBUILD_H
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2008, 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 http://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.
+ *
+ * $Id$
+ ***************************************************************************/
+
+/* ================================================================ */
+/* NOTES FOR CONFIGURE CAPABLE SYSTEMS */
+/* ================================================================ */
+
+/*
+ * NOTE 1:
+ * -------
+ *
+ * Nothing in this file is intended to be modified or adjusted by the
+ * curl library user nor by the curl library builder.
+ *
+ * If you think that something actually needs to be changed, adjusted
+ * or fixed in this file, then, report it on the libcurl development
+ * mailing list: http://cool.haxx.se/mailman/listinfo/curl-library/
+ *
+ * This header file shall only export symbols which are 'curl' or 'CURL'
+ * prefixed, otherwise public name space would be polluted.
+ *
+ * NOTE 2:
+ * -------
+ *
+ * Right now you might be staring at file include/curl/curlbuild.h.in or
+ * at file include/curl/curlbuild.h, this is due to the following reason:
+ *
+ * On systems capable of running the configure script, the configure process
+ * will overwrite the distributed include/curl/curlbuild.h file with one that
+ * is suitable and specific to the library being configured and built, which
+ * is generated from the include/curl/curlbuild.h.in template file.
+ *
+ */
+
+/* ================================================================ */
+/* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */
+/* ================================================================ */
+
+#ifdef CURL_OFF_T
+# error "CURL_OFF_T shall not be defined except in curlbuild.h"
+ Error Compilation_aborted_CURL_OFF_T_already_defined
+#endif
+
+#ifdef CURL_FMT_OFF_T
+# error "CURL_FMT_OFF_T shall not be defined except in curlbuild.h"
+ Error Compilation_aborted_CURL_FMT_OFF_T_already_defined
+#endif
+
+#ifdef CURL_FMT_OFF_TU
+# error "CURL_FMT_OFF_TU shall not be defined except in curlbuild.h"
+ Error Compilation_aborted_CURL_FMT_OFF_TU_already_defined
+#endif
+
+#ifdef CURL_FORMAT_OFF_T
+# error "CURL_FORMAT_OFF_T shall not be defined except in curlbuild.h"
+ Error Compilation_aborted_CURL_FORMAT_OFF_T_already_defined
+#endif
+
+#ifdef CURL_SIZEOF_CURL_OFF_T
+# error "CURL_SIZEOF_CURL_OFF_T shall not be defined except in curlbuild.h"
+ Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_already_defined
+#endif
+
+/* ================================================================ */
+/* EXTERNAL INTERFACE SETTINGS FOR CONFIGURE CAPABLE SYSTEMS ONLY */
+/* ================================================================ */
+
+/* Configure process defines this to 1 when it finds out that system */
+/* header file sys/types.h must be included by the external interface. */
+#undef CURL_PULL_SYS_TYPES_H
+#ifdef CURL_PULL_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+/* Configure process defines this to 1 when it finds out that system */
+/* header file stdint.h must be included by the external interface. */
+#undef CURL_PULL_STDINT_H
+#ifdef CURL_PULL_STDINT_H
+# include <stdint.h>
+#endif
+
+/* Configure process defines this to 1 when it finds out that system */
+/* header file inttypes.h must be included by the external interface. */
+#undef CURL_PULL_INTTYPES_H
+#ifdef CURL_PULL_INTTYPES_H
+# include <inttypes.h>
+#endif
+
+/* Signed integral data type used for curl_off_t. */
+#undef CURL_OFF_T
+
+/* Data type definition of curl_off_t. */
+typedef CURL_OFF_T curl_off_t;
+
+/* curl_off_t formatting string directive without "%" conversion specifier. */
+#undef CURL_FMT_OFF_T
+
+/* unsigned curl_off_t formatting string without "%" conversion specifier. */
+#undef CURL_FMT_OFF_TU
+
+/* curl_off_t formatting string directive with "%" conversion specifier. */
+#undef CURL_FORMAT_OFF_T
+
+/* The expected size of curl_off_t, as to be computed by sizeof. */
+#undef CURL_SIZEOF_CURL_OFF_T
+
+#endif /* __CURL_CURLBUILD_H */
diff --git a/include/curl/curlrules.h b/include/curl/curlrules.h
new file mode 100644
index 000000000..56499f9a2
--- /dev/null
+++ b/include/curl/curlrules.h
@@ -0,0 +1,149 @@
+#ifndef __CURL_CURLRULES_H
+#define __CURL_CURLRULES_H
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2008, 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 http://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.
+ *
+ * $Id$
+ ***************************************************************************/
+
+/* ================================================================ */
+/* COMPILE TIME SANITY CHECKS */
+/* ================================================================ */
+
+/*
+ * NOTE 1:
+ * -------
+ *
+ * All checks done in this file are intentionally placed in a public
+ * header file which is pulled by curl/curl.h when an application is
+ * being built using an already built libcurl library. Additionally
+ * this file is also included and used when building the library.
+ *
+ * If compilation fails on this file it is certainly sure that the
+ * problem is elsewhere. It could be a problem in the curlbuild.h
+ * header file, or simply that you are using different compilation
+ * settings than those used to build the library.
+ *
+ * Nothing in this file is intended to be modified or adjusted by the
+ * curl library user nor by the curl library builder.
+ *
+ * Do not deactivate any check, these are done to make sure that the
+ * library is properly built and used.
+ *
+ * You can find further help on the libcurl development mailing list:
+ * http://cool.haxx.se/mailman/listinfo/curl-library/
+ *
+ * NOTE 2
+ * ------
+ *
+ * Some of the following compile time checks are based on the fact
+ * that the dimension of a constant array can not be a negative one.
+ * In this way if the compile time verification fails, the compilation
+ * will fail issuing an error. The error description wording is compiler
+ * dependant but it will be quite similar to one of the following:
+ *
+ * "negative subscript or subscript is too large"
+ * "array must have at least one element"
+ * "-1 is an illegal array size"
+ * "size of array is negative"
+ *
+ * If you are building an application which tries to use an already
+ * built libcurl library and you are getting this kind of errors on
+ * this file, it is a clear indication that there is a mismatch between
+ * how the library was built and how you are trying to use it for your
+ * application. Your already compiled or binary library provider is the
+ * only one who can give you the details you need to properly use it.
+ */
+
+/*
+ * Verify that some macros are actually defined.
+ */
+
+#ifndef CURL_OFF_T
+# error "CURL_OFF_T definition is missing!"
+ Error Compilation_aborted_CURL_OFF_T_is_missing
+#endif
+
+#ifndef CURL_FMT_OFF_T
+# error "CURL_FMT_OFF_T definition is missing!"
+ Error Compilation_aborted_CURL_FMT_OFF_T_is_missing
+#endif
+
+#ifndef CURL_FMT_OFF_TU
+# error "CURL_FMT_OFF_TU definition is missing!"
+ Error Compilation_aborted_CURL_FMT_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
+#endif
+
+/*
+ * Macros private to this header file.
+ */
+
+#define CurlchkszEQ(t, s) sizeof(t) == s ? 1 : -1
+
+#define CurlchkszGE(t1, t2) sizeof(t1) >= sizeof(t2) ? 1 : -1
+
+/*
+ * Verify that the size previously defined and expected for
+ * curl_off_t is actually the the same as the one reported
+ * by sizeof() at compile time.
+ */
+
+typedef char
+ __curl_rule_01__
+ [CurlchkszEQ(curl_off_t, CURL_SIZEOF_CURL_OFF_T)];
+
+/*
+ * Verify at compile time that the size of curl_off_t as reported
+ * by sizeof() is greater or equal than the one reported for long
+ * for the current compilation.
+ */
+
+typedef char
+ __curl_rule_02__
+ [CurlchkszGE(curl_off_t, long)];
+
+/*
+ * Get rid of macros private to this header file.
+ */
+
+#undef CurlchkszEQ
+#undef CurlchkszGE
+
+/*
+ * Get rid of macros not intended to exist beyond this point.
+ */
+
+#undef CURL_PULL_SYS_TYPES_H
+#undef CURL_PULL_STDINT_H
+#undef CURL_PULL_INTTYPES_H
+
+#undef CURL_OFF_T
+
+#endif /* __CURL_CURLRULES_H */
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 92a049766..7f236d806 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -48,12 +48,14 @@ LIBCURL_LIBS = @LIBCURL_LIBS@
# being currently built and tested are searched before the library which
# might possibly already be installed in the system.
#
+# $(top_builddir)/include is for libcurl's generated curl/curlbuild.h file
# $(top_srcdir)/include is for libcurl's external include files
# $(top_builddir)/lib is for libcurl's generated lib/config.h file
# $(top_srcdir)/lib is for libcurl's lib/setup.h and other "private" files
-INCLUDES = -I$(top_srcdir)/include \
- -I$(top_builddir)/lib \
+INCLUDES = -I$(top_builddir)/include \
+ -I$(top_srcdir)/include \
+ -I$(top_builddir)/lib \
-I$(top_srcdir)/lib
VERSION=-version-info 5:0:1
diff --git a/lib/Makefile.netware b/lib/Makefile.netware
index 91c9bfdaf..d5440c7b4 100644
--- a/lib/Makefile.netware
+++ b/lib/Makefile.netware
@@ -480,7 +480,6 @@ endif
@echo $(DL)#define HAVE_UTIME 1$(DL) >> $@
@echo $(DL)#define HAVE_UTIME_H 1$(DL) >> $@
@echo $(DL)#define RETSIGTYPE void$(DL) >> $@
- @echo $(DL)#define SIZEOF_CURL_OFF_T 4$(DL) >> $@
@echo $(DL)#define SIZEOF_STRUCT_IN_ADDR 4$(DL) >> $@
@echo $(DL)#define STDC_HEADERS 1$(DL) >> $@
@echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@
diff --git a/lib/config-amigaos.h b/lib/config-amigaos.h
index fe77a2dc4..86d9daa41 100644
--- a/lib/config-amigaos.h
+++ b/lib/config-amigaos.h
@@ -103,7 +103,6 @@
#define SELECT_TYPE_ARG1 int
#define SELECT_TYPE_ARG234 (fd_set *)
#define SELECT_TYPE_ARG5 (struct timeval *)
-#define SIZEOF_CURL_OFF_T 4
#define STDC_HEADERS 1
#define TIME_WITH_SYS_TIME 1
diff --git a/lib/config-os400.h b/lib/config-os400.h
index d3b3d4585..c52098731 100644
--- a/lib/config-os400.h
+++ b/lib/config-os400.h
@@ -374,14 +374,12 @@
#define HAVE_LL
-/* The size of `curl_off_t', as computed by sizeof. */
+/* */
#ifndef _LARGE_FILES
#define _LARGE_FILES
#endif
-#define SIZEOF_CURL_OFF_T 8
-
/* Define this if you have struct sockaddr_storage */
#define HAVE_STRUCT_SOCKADDR_STORAGE
diff --git a/lib/config-symbian.h b/lib/config-symbian.h
index 0b7b90df6..d4b5f0979 100644
--- a/lib/config-symbian.h
+++ b/lib/config-symbian.h
@@ -712,9 +712,6 @@
/* Define to the type of arg 5 for `select'. */
#define SELECT_TYPE_ARG5 (struct timeval *)
-/* The size of `curl_off_t', as computed by sizeof. */
-#define SIZEOF_CURL_OFF_T 8
-
/* The size of `long', as computed by sizeof. */
#define SIZEOF_LONG 4
diff --git a/lib/config-tpf.h b/lib/config-tpf.h
index dbeabf6b1..70b799a3d 100644
--- a/lib/config-tpf.h
+++ b/lib/config-tpf.h
@@ -593,9 +593,6 @@
/* Define to the type of arg 5 for `select'. */
#define SELECT_TYPE_ARG5 (struct timeval *)
-/* The size of a `curl_off_t', as computed by sizeof. */
-#define SIZEOF_CURL_OFF_T 8
-
/* The size of a `long', as computed by sizeof. */
#define SIZEOF_LONG 8
diff --git a/lib/config-win32.h b/lib/config-win32.h
index 6526f5497..25484eb7a 100644
--- a/lib/config-win32.h
+++ b/lib/config-win32.h
@@ -324,21 +324,6 @@
/* The number of bytes in a long long. */
/* #define SIZEOF_LONG_LONG 8 */
-/* Undef SIZEOF_CURL_OFF_T if already defined. */
-#ifdef SIZEOF_CURL_OFF_T
-#undef SIZEOF_CURL_OFF_T
-#endif
-
-/* Define SIZEOF_CURL_OFF_T as computed by sizeof(curl_off_t) */
-/* Borland/PellesC/SalfordC lacks _lseeki64(), so we don't support
- * >2GB files.
- */
-#if defined(__BORLANDC__) || defined(__POCC__) || defined(__SALFORDC__)
-#define SIZEOF_CURL_OFF_T 4
-#else
-#define SIZEOF_CURL_OFF_T 8
-#endif
-
/* ---------------------------------------------------------------- */
/* STRUCT RELATED */
/* ---------------------------------------------------------------- */
diff --git a/lib/config-win32ce.h b/lib/config-win32ce.h
index 347b78cbe..21f7eea64 100644
--- a/lib/config-win32ce.h
+++ b/lib/config-win32ce.h
@@ -307,14 +307,6 @@
/* The number of bytes in a long long. */
/* #define SIZEOF_LONG_LONG 8 */
-/* Undef SIZEOF_CURL_OFF_T if already defined. */
-#ifdef SIZEOF_CURL_OFF_T
-#undef SIZEOF_CURL_OFF_T
-#endif
-
-/* Define SIZEOF_CURL_OFF_T as computed by sizeof(curl_off_t) */
-#define SIZEOF_CURL_OFF_T 4
-
/* ---------------------------------------------------------------- */
/* STRUCT RELATED */
/* ---------------------------------------------------------------- */
diff --git a/lib/config.dos b/lib/config.dos
index 76b30debd..ead655f97 100644
--- a/lib/config.dos
+++ b/lib/config.dos
@@ -60,7 +60,6 @@
#define RETSIGTYPE void
#define SIZEOF_LONG_DOUBLE 16
-#define SIZEOF_CURL_OFF_T 4 /* no huge file support */
#define STDC_HEADERS 1
#define TIME_WITH_SYS_TIME 1
diff --git a/lib/setup.h b/lib/setup.h
index 3f0427bac..d43ae85a0 100644
--- a/lib/setup.h
+++ b/lib/setup.h
@@ -72,6 +72,15 @@
#endif /* HAVE_CONFIG_H */
+/* ================================================================ */
+/* Definition of preprocessor macros/symbols which modify compiler */
+/* behaviour or generated code characteristics must be done here, */
+/* as appropriate, before any system header file is included. It is */
+/* also possible to have them defined in the config file included */
+/* before this point. As a result of all this we frown inclusion of */
+/* system header files in our config files, avoid this at any cost. */
+/* ================================================================ */
+
/*
* Tru64 needs _REENTRANT set for a few function prototypes and
* things to appear in the system header files. Unixware needs it
@@ -84,6 +93,57 @@
# endif
#endif
+/* ================================================================ */
+/* If you need to include a system header file for your platform, */
+/* 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>
+
+/*
+ * Set up internal curl_off_t size macro
+ */
+
+#ifdef SIZEOF_CURL_OFF_T
+# error "SIZEOF_CURL_OFF_T shall not be defined before this point!"
+ Error Compilation_aborted_SIZEOF_CURL_OFF_T_already_defined
+#else
+# define SIZEOF_CURL_OFF_T CURL_SIZEOF_CURL_OFF_T
+#endif
+
+/*
+ * Set up internal curl_off_t formatting string directive
+ */
+
+#ifdef FORMAT_OFF_T
+# error "FORMAT_OFF_T shall not be defined before this point!"
+ Error Compilation_aborted_FORMAT_OFF_T_already_defined
+#else
+# define FORMAT_OFF_T CURL_FMT_OFF_T
+#endif
+
+/*
+ * Set up internal unsigned curl_off_t formatting string directive
+ */
+
+#ifdef FORMAT_OFF_TU
+# error "FORMAT_OFF_TU shall not be defined before this point!"
+ Error Compilation_aborted_FORMAT_OFF_TU_already_defined
+#else
+# define FORMAT_OFF_TU CURL_FMT_OFF_TU
+#endif
+
/*
* Disable other protocols when http is the only one desired.
*/
@@ -97,6 +157,11 @@
# define CURL_DISABLE_FILE
#endif
+/* ================================================================ */
+/* No system header file shall be included in this file before this */
+/* point. The only allowed ones are those included from curlbuild.h */
+/* ================================================================ */
+
/*
* OS/400 setup file includes some system headers.
*/
@@ -160,22 +225,6 @@
#endif /* _MSC_VER */
#endif /* HAVE_LONGLONG */
-#ifndef SIZEOF_CURL_OFF_T
-/* If we don't know the size here, we assume a conservative size: 4. When
- building libcurl, the actual size of this variable should be defined in the
- config*.h file. */
-#define SIZEOF_CURL_OFF_T 4
-#endif
-
-/* We set up our internal prefered (CURL_)FORMAT_OFF_T[U] here */
-#if SIZEOF_CURL_OFF_T > 4
-#define FORMAT_OFF_T "lld"
-#define FORMAT_OFF_TU "llu" /* the unsigned version */
-#else
-#define FORMAT_OFF_T "ld"
-#define FORMAT_OFF_TU "lu" /* thus unsigned version */
-#endif /* SIZEOF_CURL_OFF_T */
-
#ifdef HAVE_EXTRA_STRICMP_H
# include <extra/stricmp.h>
#endif
diff --git a/packages/vms/config-vms.h b/packages/vms/config-vms.h
index 84090106e..e19a0b4d3 100644
--- a/packages/vms/config-vms.h
+++ b/packages/vms/config-vms.h
@@ -1,6 +1,6 @@
/* MSK, 02/05/04, Hand edited for trail build on Alpha V7.3, DEC C 6.5-003 */
/* MSK, 03/09/04, Seems to work for all platforms I've built on so far. */
-/* Added HAVE_SYS_IOCTL_H, IOCTL_3_ARGS and SIZEOF_CURL_OFF_T defines */
+/* Added HAVE_SYS_IOCTL_H and IOCTL_3_ARGS defines */
/* MSK, 06/04/04, Added HAVE_INET_NTOP */
/* TES, 10/06/04, Added MAX_INITIAL_POST_SIZE, HAVE_BASENAME */
/* MSK, 02/02/05, Changed HAVE_TERMIOS_H to an undef since the change in */
@@ -265,14 +265,6 @@
/* IOCTL_3_ARGS defined to match the ioctl function in stropts.h */
#define IOCTL_3_ARGS 1
-/* Seems with versions of cURL after 7.11.0 you need to define */
-/* SIZEOF_CURL_OFF_T to something to get it to compile. */
-#if defined( __VAX) || (__32BITS == 1)
-#define SIZEOF_CURL_OFF_T 4
-#else
-#define SIZEOF_CURL_OFF_T 8
-#endif
-
/* Somewhere around 7.12.0 HAVE_INET_NTOP was introduced. */
#define HAVE_INET_NTOP 1
diff --git a/src/Makefile.Watcom b/src/Makefile.Watcom
index 942443848..ea84c8aac 100644
--- a/src/Makefile.Watcom
+++ b/src/Makefile.Watcom
@@ -8,7 +8,7 @@ CC = wcc386
CFLAGS = -3r -mf -d3 -hc -zff -zgf -zq -zm -s -fr=con -w2 -fpi -oilrtfm &
-bt=nt -d+ -dWIN32 -dHAVE_STRTOLL &
- -dSIZEOF_CURL_OFF_T=8 -dCURLDEBUG -dENABLE_IPV6 -dHAVE_WINSOCK2_H &
+ -dCURLDEBUG -dENABLE_IPV6 -dHAVE_WINSOCK2_H &
-I..\include -I..\lib
OBJ_DIR = WC_Win32.obj
diff --git a/src/Makefile.am b/src/Makefile.am
index 1d0235a77..59a97f808 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -27,16 +27,18 @@ AUTOMAKE_OPTIONS = foreign nostdinc
# being currently built and tested are searched before the library which
# might possibly already be installed in the system.
#
+# $(top_builddir)/include is for libcurl's generated curl/curlbuild.h file
# $(top_srcdir)/include is for libcurl's external include files
# $(top_builddir)/lib is for libcurl's generated lib/config.h file
# $(top_builddir)/src is for curl's generated src/config.h file
# $(top_srcdir)/lib is for libcurl's lib/setup.h and other "borrowed" files
# $(top_srcdir)/src is for curl's src/setup.h and "curl-private" files
-INCLUDES = -I$(top_srcdir)/include \
- -I$(top_builddir)/lib \
- -I$(top_builddir)/src \
- -I$(top_srcdir)/lib \
+INCLUDES = -I$(top_builddir)/include \
+ -I$(top_srcdir)/include \
+ -I$(top_builddir)/lib \
+ -I$(top_builddir)/src \
+ -I$(top_srcdir)/lib \
-I$(top_srcdir)/src
bin_PROGRAMS = curl
diff --git a/src/Makefile.netware b/src/Makefile.netware
index 3f9d67a3e..168e53edf 100644
--- a/src/Makefile.netware
+++ b/src/Makefile.netware
@@ -459,7 +459,6 @@ endif
@echo $(DL)#define HAVE_UTIME 1$(DL) >> $@
@echo $(DL)#define HAVE_UTIME_H 1$(DL) >> $@
@echo $(DL)#define RETSIGTYPE void$(DL) >> $@
- @echo $(DL)#define SIZEOF_CURL_OFF_T 4$(DL) >> $@
@echo $(DL)#define STDC_HEADERS 1$(DL) >> $@
@echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@
ifdef DISABLE_LDAP
diff --git a/src/setup.h b/src/setup.h
index 348c8de79..4f0835e3c 100644
--- a/src/setup.h
+++ b/src/setup.h
@@ -187,10 +187,6 @@ int fileno( FILE *stream);
#include <sys/timeval.h>
#endif
-#ifndef SIZEOF_CURL_OFF_T
-#define SIZEOF_CURL_OFF_T sizeof(curl_off_t)
-#endif
-
#ifndef UNPRINTABLE_CHAR
/* define what to use for unprintable characters */
#define UNPRINTABLE_CHAR '.'
diff --git a/tests/libtest/Makefile.am b/tests/libtest/Makefile.am
index 8efeef13f..b24b90014 100644
--- a/tests/libtest/Makefile.am
+++ b/tests/libtest/Makefile.am
@@ -27,12 +27,14 @@ AUTOMAKE_OPTIONS = foreign nostdinc
# being currently built and tested are searched before the library which
# might possibly already be installed in the system.
#
+# $(top_builddir)/include is for libcurl's generated curl/curlbuild.h file
# $(top_srcdir)/include is for libcurl's external include files
# $(top_builddir)/lib is for libcurl's generated lib/config.h file
# $(top_srcdir)/lib is for libcurl's lib/setup.h and other "borrowed" files
-INCLUDES = -I$(top_srcdir)/include \
- -I$(top_builddir)/lib \
+INCLUDES = -I$(top_builddir)/include \
+ -I$(top_srcdir)/include \
+ -I$(top_builddir)/lib \
-I$(top_srcdir)/lib
LIBDIR = $(top_builddir)/lib
diff --git a/tests/server/Makefile.am b/tests/server/Makefile.am
index d7536cfe3..74f0ec2f3 100644
--- a/tests/server/Makefile.am
+++ b/tests/server/Makefile.am
@@ -27,12 +27,14 @@ AUTOMAKE_OPTIONS = foreign nostdinc
# being currently built and tested are searched before the library which
# might possibly already be installed in the system.
#
+# $(top_builddir)/include is for libcurl's generated curl/curlbuild.h file
# $(top_srcdir)/include is for libcurl's external include files
# $(top_builddir)/lib is for libcurl's generated lib/config.h file
# $(top_srcdir)/lib is for libcurl's lib/setup.h and other "borrowed" files
-INCLUDES = -I$(top_srcdir)/include \
- -I$(top_builddir)/lib \
+INCLUDES = -I$(top_builddir)/include \
+ -I$(top_srcdir)/include \
+ -I$(top_builddir)/lib \
-I$(top_srcdir)/lib
noinst_PROGRAMS = sws getpart sockfilt resolve tftpd