Initial support of curlbuild.h and curlrules.h which allows
authorYang Tse <yangsita@gmail.com>
Thu, 7 Aug 2008 00:29:08 +0000 (00:29 +0000)
committerYang Tse <yangsita@gmail.com>
Thu, 7 Aug 2008 00:29:08 +0000 (00:29 +0000)
to have a curl_off_t data type no longer gated to off_t.

32 files changed:
CHANGES
RELEASE-NOTES
acinclude.m4
ares/Makefile.am
ares/configure.ac
buildconf.bat
configure.ac
docs/examples/Makefile.am
include/README
include/curl/.cvsignore
include/curl/Makefile.am
include/curl/curl.h
include/curl/curlbuild.h.dist [new file with mode: 0644]
include/curl/curlbuild.h.in [new file with mode: 0644]
include/curl/curlrules.h [new file with mode: 0644]
lib/Makefile.am
lib/Makefile.netware
lib/config-amigaos.h
lib/config-os400.h
lib/config-symbian.h
lib/config-tpf.h
lib/config-win32.h
lib/config-win32ce.h
lib/config.dos
lib/setup.h
packages/vms/config-vms.h
src/Makefile.Watcom
src/Makefile.am
src/Makefile.netware
src/setup.h
tests/libtest/Makefile.am
tests/server/Makefile.am

diff --git a/CHANGES b/CHANGES
index 52f6858..e56030e 100644 (file)
--- 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
index f885fc8..5b19264 100644 (file)
@@ -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:
 
index 4c54d54..34d0ba1 100644 (file)
@@ -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])
+  #
+])
+
index 04db9ec..b121111 100644 (file)
@@ -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 8ba64e7..3488887 100644 (file)
@@ -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])])
index deeaea9..515256c 100644 (file)
@@ -8,3 +8,6 @@ copy src\hugehelp.c.cvs src\hugehelp.c
 \r
 REM create Makefile\r
 copy Makefile.dist Makefile\r
+\r
+REM create curlbuild.h\r
+copy include\curl\curlbuild.h.dist include\curl\curlbuild.h\r
index f810ccc..2c15003 100644 (file)
@@ -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)
index e897844..886e8ad 100644 (file)
@@ -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
 
index f8482ba..485722e 100644 (file)
@@ -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
index 37c8aa7..67b973a 100644 (file)
@@ -1,3 +1,4 @@
 Makefile
 Makefile.in
-*.dist
+curlbuild.h
+stamp-*
index 707d135..bee5c25 100644 (file)
@@ -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 da7cc07..9dd54ff 100644 (file)
  * $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 (file)
index 0000000..7dbafbc
--- /dev/null
@@ -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 (file)
index 0000000..cc4d77e
--- /dev/null
@@ -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 (file)
index 0000000..56499f9
--- /dev/null
@@ -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 92a0497..7f236d8 100644 (file)
@@ -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
index 91c9bfd..d5440c7 100644 (file)
@@ -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) >> $@
index fe77a2d..86d9daa 100644 (file)
 #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 d3b3d45..c520987 100644 (file)
 
 #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 0b7b90d..d4b5f09 100644 (file)
 /* 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 dbeabf6..70b799a 100644 (file)
 /* 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 6526f54..25484eb 100644 (file)
 /* 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 347b78c..21f7eea 100644 (file)
 /* 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 76b30de..ead655f 100644 (file)
@@ -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 3f0427b..d43ae85 100644 (file)
 
 #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
 #  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.
  */
 #  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.
  */
 #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 8409010..e19a0b4 100644 (file)
@@ -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   */
 /* 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 9424438..ea84c8a 100644 (file)
@@ -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
index 1d0235a..59a97f8 100644 (file)
@@ -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
index 3f9d67a..168e53e 100644 (file)
@@ -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
index 348c8de..4f0835e 100644 (file)
@@ -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 '.'
index 8efeef1..b24b900 100644 (file)
@@ -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
index d7536cf..74f0ec2 100644 (file)
@@ -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