Index: acinclude.m4
===================================================================
RCS file: /cvsroot/curl/curl/acinclude.m4,v
retrieving revision 1.176
diff -u -r1.176 acinclude.m4
--- acinclude.m4	30 Jul 2008 03:10:03 -0000	1.176
+++ acinclude.m4	31 Jul 2008 17:31:44 -0000
@@ -3529,3 +3529,255 @@
     AC_MSG_RESULT([no])
   fi
 ])
+
+
+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 <<_ACEOF
+[@%:@define] $1 ifelse($#, 2, [$2], 1)
+_ACEOF
+])
+
+
+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_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])
+  #
+])
+
Index: buildconf.bat
===================================================================
RCS file: /cvsroot/curl/curl/buildconf.bat,v
retrieving revision 1.5
diff -u -r1.5 buildconf.bat
--- buildconf.bat	31 Mar 2008 12:09:43 -0000	1.5
+++ buildconf.bat	31 Jul 2008 17:31:44 -0000
@@ -8,3 +8,6 @@
 
 REM create Makefile
 copy Makefile.dist Makefile
+
+REM create curlbuild.h
+copy include\curl\curlbuild.h.dist include\curl\curlbuild.h
Index: configure.ac
===================================================================
RCS file: /cvsroot/curl/curl/configure.ac,v
retrieving revision 1.317
diff -u -r1.317 configure.ac
--- configure.ac	27 Jul 2008 23:43:53 -0000	1.317
+++ configure.ac	31 Jul 2008 17:31:46 -0000
@@ -33,7 +33,7 @@
 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.
@@ -2012,10 +2012,8 @@
 CURL_CHECK_STRUCT_TIMEVAL
 CURL_VERIFY_RUNTIMELIBS
 
-AC_CHECK_SIZEOF(curl_off_t, ,[
-#include <stdio.h>
-#include "$srcdir/include/curl/curl.h"
-])
+CURL_CONFIGURE_CURL_OFF_T
+
 AC_CHECK_SIZEOF(size_t)
 AC_CHECK_SIZEOF(long)
 AC_CHECK_SIZEOF(time_t)
Index: ares/Makefile.am
===================================================================
RCS file: /cvsroot/curl/curl/ares/Makefile.am,v
retrieving revision 1.27
diff -u -r1.27 Makefile.am
--- ares/Makefile.am	30 Jul 2008 03:10:03 -0000	1.27
+++ ares/Makefile.am	31 Jul 2008 17:31:46 -0000
@@ -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)
Index: ares/configure.ac
===================================================================
RCS file: /cvsroot/curl/curl/ares/configure.ac,v
retrieving revision 1.109
diff -u -r1.109 configure.ac
--- ares/configure.ac	27 Jul 2008 23:43:53 -0000	1.109
+++ ares/configure.ac	31 Jul 2008 17:31:47 -0000
@@ -120,6 +120,7 @@
        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])])
Index: docs/examples/Makefile.am
===================================================================
RCS file: /cvsroot/curl/curl/docs/examples/Makefile.am,v
retrieving revision 1.51
diff -u -r1.51 Makefile.am
--- docs/examples/Makefile.am	15 Jul 2008 13:54:30 -0000	1.51
+++ docs/examples/Makefile.am	31 Jul 2008 17:31:47 -0000
@@ -12,9 +12,11 @@
 # 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
 
Index: include/curl/.cvsignore
===================================================================
RCS file: /cvsroot/curl/curl/include/curl/.cvsignore,v
retrieving revision 1.2
diff -u -r1.2 .cvsignore
--- include/curl/.cvsignore	30 Oct 2003 13:08:20 -0000	1.2
+++ include/curl/.cvsignore	31 Jul 2008 17:31:47 -0000
@@ -1,3 +1,4 @@
 Makefile
 Makefile.in
-*.dist
+curlbuild.h
+stamp-*
Index: include/curl/Makefile.am
===================================================================
RCS file: /cvsroot/curl/curl/include/curl/Makefile.am,v
retrieving revision 1.5
diff -u -r1.5 Makefile.am
--- include/curl/Makefile.am	11 Mar 2008 07:37:40 -0000	1.5
+++ include/curl/Makefile.am	31 Jul 2008 17:31:47 -0000
@@ -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
+
Index: include/curl/curl.h
===================================================================
RCS file: /cvsroot/curl/curl/include/curl/curl.h,v
retrieving revision 1.360
diff -u -r1.360 curl.h
--- include/curl/curl.h	30 Jul 2008 21:55:26 -0000	1.360
+++ include/curl/curl.h	31 Jul 2008 17:31:48 -0000
@@ -23,11 +23,17 @@
  * $Id: curl.h,v 1.360 2008-07-30 21:55:26 bagder Exp $
  ***************************************************************************/
 
-/* 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 @@
 #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
Index: include/curl/curlbuild.h.dist
===================================================================
RCS file: include/curl/curlbuild.h.dist
diff -N include/curl/curlbuild.h.dist
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ include/curl/curlbuild.h.dist	31 Jul 2008 17:31:48 -0000
@@ -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 */
Index: include/curl/curlbuild.h.in
===================================================================
RCS file: include/curl/curlbuild.h.in
diff -N include/curl/curlbuild.h.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ include/curl/curlbuild.h.in	31 Jul 2008 17:31:48 -0000
@@ -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 */
Index: include/curl/curlrules.h
===================================================================
RCS file: include/curl/curlrules.h
diff -N include/curl/curlrules.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ include/curl/curlrules.h	31 Jul 2008 17:31:49 -0000
@@ -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 */
Index: lib/Makefile.am
===================================================================
RCS file: /cvsroot/curl/curl/lib/Makefile.am,v
retrieving revision 1.132
diff -u -r1.132 Makefile.am
--- lib/Makefile.am	15 Jul 2008 05:46:49 -0000	1.132
+++ lib/Makefile.am	31 Jul 2008 17:31:49 -0000
@@ -48,12 +48,14 @@
 # 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
Index: lib/Makefile.netware
===================================================================
RCS file: /cvsroot/curl/curl/lib/Makefile.netware,v
retrieving revision 1.88
diff -u -r1.88 Makefile.netware
--- lib/Makefile.netware	21 Jul 2008 03:50:02 -0000	1.88
+++ lib/Makefile.netware	31 Jul 2008 17:31:49 -0000
@@ -480,7 +480,6 @@
 	@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) >> $@
Index: lib/config-amigaos.h
===================================================================
RCS file: /cvsroot/curl/curl/lib/config-amigaos.h,v
retrieving revision 1.14
diff -u -r1.14 config-amigaos.h
--- lib/config-amigaos.h	17 Jul 2008 03:07:54 -0000	1.14
+++ lib/config-amigaos.h	31 Jul 2008 17:31:49 -0000
@@ -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
Index: lib/config-os400.h
===================================================================
RCS file: /cvsroot/curl/curl/lib/config-os400.h,v
retrieving revision 1.7
diff -u -r1.7 config-os400.h
--- lib/config-os400.h	22 Jul 2008 00:12:06 -0000	1.7
+++ lib/config-os400.h	31 Jul 2008 17:31:49 -0000
@@ -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
 
Index: lib/config-symbian.h
===================================================================
RCS file: /cvsroot/curl/curl/lib/config-symbian.h,v
retrieving revision 1.8
diff -u -r1.8 config-symbian.h
--- lib/config-symbian.h	30 Jul 2008 00:10:32 -0000	1.8
+++ lib/config-symbian.h	31 Jul 2008 17:31:50 -0000
@@ -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
 
Index: lib/config-tpf.h
===================================================================
RCS file: /cvsroot/curl/curl/lib/config-tpf.h,v
retrieving revision 1.14
diff -u -r1.14 config-tpf.h
--- lib/config-tpf.h	17 Jul 2008 03:07:54 -0000	1.14
+++ lib/config-tpf.h	31 Jul 2008 17:31:50 -0000
@@ -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
 
Index: lib/config-win32.h
===================================================================
RCS file: /cvsroot/curl/curl/lib/config-win32.h,v
retrieving revision 1.63
diff -u -r1.63 config-win32.h
--- lib/config-win32.h	17 Jul 2008 03:07:54 -0000	1.63
+++ lib/config-win32.h	31 Jul 2008 17:31:51 -0000
@@ -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                          */
 /* ---------------------------------------------------------------- */
Index: lib/config-win32ce.h
===================================================================
RCS file: /cvsroot/curl/curl/lib/config-win32ce.h,v
retrieving revision 1.28
diff -u -r1.28 config-win32ce.h
--- lib/config-win32ce.h	17 Jul 2008 03:07:54 -0000	1.28
+++ lib/config-win32ce.h	31 Jul 2008 17:31:51 -0000
@@ -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                          */
 /* ---------------------------------------------------------------- */
Index: lib/config.dos
===================================================================
RCS file: /cvsroot/curl/curl/lib/config.dos,v
retrieving revision 1.17
diff -u -r1.17 config.dos
--- lib/config.dos	21 Jul 2008 00:36:55 -0000	1.17
+++ lib/config.dos	31 Jul 2008 17:31:51 -0000
@@ -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
 
Index: lib/setup.h
===================================================================
RCS file: /cvsroot/curl/curl/lib/setup.h,v
retrieving revision 1.146
diff -u -r1.146 setup.h
--- lib/setup.h	30 Jul 2008 08:21:25 -0000	1.146
+++ lib/setup.h	31 Jul 2008 17:31:51 -0000
@@ -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
Index: packages/vms/config-vms.h
===================================================================
RCS file: /cvsroot/curl/curl/packages/vms/config-vms.h,v
retrieving revision 1.16
diff -u -r1.16 config-vms.h
--- packages/vms/config-vms.h	21 Jul 2008 00:36:55 -0000	1.16
+++ packages/vms/config-vms.h	31 Jul 2008 17:31:52 -0000
@@ -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
 
Index: src/Makefile.Watcom
===================================================================
RCS file: /cvsroot/curl/curl/src/Makefile.Watcom,v
retrieving revision 1.10
diff -u -r1.10 Makefile.Watcom
--- src/Makefile.Watcom	9 May 2008 16:31:51 -0000	1.10
+++ src/Makefile.Watcom	31 Jul 2008 17:31:52 -0000
@@ -8,7 +8,7 @@
 
 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
Index: src/Makefile.am
===================================================================
RCS file: /cvsroot/curl/curl/src/Makefile.am,v
retrieving revision 1.57
diff -u -r1.57 Makefile.am
--- src/Makefile.am	15 Jul 2008 05:46:50 -0000	1.57
+++ src/Makefile.am	31 Jul 2008 17:31:52 -0000
@@ -27,16 +27,18 @@
 # 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
Index: src/Makefile.netware
===================================================================
RCS file: /cvsroot/curl/curl/src/Makefile.netware,v
retrieving revision 1.78
diff -u -r1.78 Makefile.netware
--- src/Makefile.netware	21 Jul 2008 03:50:02 -0000	1.78
+++ src/Makefile.netware	31 Jul 2008 17:31:52 -0000
@@ -459,7 +459,6 @@
 	@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
Index: src/setup.h
===================================================================
RCS file: /cvsroot/curl/curl/src/setup.h,v
retrieving revision 1.56
diff -u -r1.56 setup.h
--- src/setup.h	30 Jul 2008 08:27:02 -0000	1.56
+++ src/setup.h	31 Jul 2008 17:31:52 -0000
@@ -187,10 +187,6 @@
 #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 '.'
Index: tests/libtest/Makefile.am
===================================================================
RCS file: /cvsroot/curl/curl/tests/libtest/Makefile.am,v
retrieving revision 1.72
diff -u -r1.72 Makefile.am
--- tests/libtest/Makefile.am	15 Jul 2008 05:46:50 -0000	1.72
+++ tests/libtest/Makefile.am	31 Jul 2008 17:31:53 -0000
@@ -27,12 +27,14 @@
 # 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
Index: tests/server/Makefile.am
===================================================================
RCS file: /cvsroot/curl/curl/tests/server/Makefile.am,v
retrieving revision 1.22
diff -u -r1.22 Makefile.am
--- tests/server/Makefile.am	15 Jul 2008 05:46:50 -0000	1.22
+++ tests/server/Makefile.am	31 Jul 2008 17:31:53 -0000
@@ -27,12 +27,14 @@
 # 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
