diff options
author | Yang Tse <yangsita@gmail.com> | 2008-08-07 00:29:08 +0000 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2008-08-07 00:29:08 +0000 |
commit | 14240e9e109fe6af19438c6531d573f85dbb0b1e (patch) | |
tree | 61c5713bff289fbdc27e019b71427723bfb78dbc /include | |
parent | a3045b4e4944a36f467f363607d6c6a50727fca2 (diff) |
Initial support of curlbuild.h and curlrules.h which allows
to have a curl_off_t data type no longer gated to off_t.
Diffstat (limited to 'include')
-rw-r--r-- | include/README | 33 | ||||
-rw-r--r-- | include/curl/.cvsignore | 3 | ||||
-rw-r--r-- | include/curl/Makefile.am | 23 | ||||
-rw-r--r-- | include/curl/curl.h | 82 | ||||
-rw-r--r-- | include/curl/curlbuild.h.dist | 352 | ||||
-rw-r--r-- | include/curl/curlbuild.h.in | 129 | ||||
-rw-r--r-- | include/curl/curlrules.h | 149 |
7 files changed, 688 insertions, 83 deletions
diff --git a/include/README b/include/README index f8482ba69..485722e30 100644 --- a/include/README +++ b/include/README @@ -7,7 +7,7 @@ Include files for libcurl, external users. They're all placed in the curl subdirectory here for better fit in any kind -of environment. You should include files from here using... +of environment. You must include files from here using... #include <curl/curl.h> @@ -16,14 +16,31 @@ curl subdirectory. It makes it more likely to survive future modifications. NOTE FOR LIBCURL HACKERS -All the include files in this tree are written and intended to be installed on -a system that may serve multiple platforms and multiple applications, all -using libcurl (possibly even different libcurl installations using different -versions). Therefore, all header files in here must obey these rules: +The following notes apply to libcurl version 7.19.0 and later. -* They cannot depend on or use configure-generated results from libcurl's or - curl's directories. Other applications may not run configure as (lib)curl - does, and using platform dependent info here may break other platforms. +* The distributed curl/curlbuild.h file is only intended to be used on systems + which can not run the also distributed configure script. + +* The distributed curlbuild.h file is generated as a copy of curlbuild.h.dist + when the libcurl source code distribution archive file is originally created. + +* If you check out from CVS on a non-configure platform, you must run the + appropriate buildconf* script to set up curlbuild.h and other local files + before being able of compiling the library. + +* On systems capable of running the configure script, the configure process + will overwrite the distributed include/curl/curlbuild.h file with one that + is suitable and specific to the library being configured and built, which + is generated from the include/curl/curlbuild.h.in template file. + +* If you intend to distribute an already compiled libcurl library you _MUST_ + also distribute along with it the generated curl/curlbuild.h which has been + used to compile it. Otherwise the library will be of no use for the users of + the library that you have built. It is _your_ responsability to provide this + file. No one at the cURL project can know how you have built the library. + +* File curl/curlbuild.h includes platform and configuration dependant info, + and must not be modified by anyone. Configure script generates it for you. * We cannot assume anything else but very basic compiler features being present. While libcurl requires an ANSI C compiler to build, some of the diff --git a/include/curl/.cvsignore b/include/curl/.cvsignore index 37c8aa7e2..67b973ae3 100644 --- a/include/curl/.cvsignore +++ b/include/curl/.cvsignore @@ -1,3 +1,4 @@ Makefile Makefile.in -*.dist +curlbuild.h +stamp-* diff --git a/include/curl/Makefile.am b/include/curl/Makefile.am index 707d1359f..bee5c25af 100644 --- a/include/curl/Makefile.am +++ b/include/curl/Makefile.am @@ -1,6 +1,25 @@ pkginclude_HEADERS = \ curl.h curlver.h easy.h mprintf.h stdcheaders.h types.h multi.h \ - typecheck-gcc.h + typecheck-gcc.h curlbuild.h curlrules.h + pkgincludedir= $(includedir)/curl -CLEANFILES = *dist +# curlbuild.h does not exist in the CVS tree. When the original libcurl +# source code distribution archive file is created, curlbuild.h.dist is +# renamed to curlbuild.h and included in the tarball so that it can be +# used directly on non-configure systems. +# +# The distributed curlbuild.h will be overwritten on configure systems +# when the configure script runs, with one that is suitable and specific +# to the library being configured and built. +# +# curlbuild.h.in is the distributed template file from which the configure +# script creates curlbuild.h at library configuration time, overwiting the +# one included in the distribution archive. +# +# curlbuild.h.dist is not included in the source code distribution archive. + +EXTRA_DIST = curlbuild.h.in + +DISTCLEANFILES = curlbuild.h + diff --git a/include/curl/curl.h b/include/curl/curl.h index da7cc0793..9dd54ff69 100644 --- a/include/curl/curl.h +++ b/include/curl/curl.h @@ -23,11 +23,17 @@ * $Id$ ***************************************************************************/ -/* If you have problems, all libcurl docs and details are found here: - http://curl.haxx.se/libcurl/ -*/ +/* + * If you have libcurl problems, all docs and details are found here: + * http://curl.haxx.se/libcurl/ + * + * curl-library mailing list subscription and unsubscription web interface: + * http://cool.haxx.se/mailman/listinfo/curl-library/ + */ -#include "curlver.h" /* the libcurl version defines */ +#include "curlver.h" /* libcurl version defines */ +#include "curl/curlbuild.h" /* libcurl build definitions */ +#include "curlrules.h" /* libcurl rules enforcement */ /* * Define WIN32 when build target is Win32 API @@ -113,74 +119,6 @@ typedef void CURL; #endif #endif -/* - * We want the typedef curl_off_t setup for large file support on all - * platforms. We also provide a CURL_FORMAT_OFF_T define to use in *printf - * format strings when outputting a variable of type curl_off_t. - * - * Note: "pocc -Ze" is MSVC compatibility mode and this sets _MSC_VER! - */ - -#if (defined(_MSC_VER) && !defined(__POCC__)) || (defined(__LCC__) && \ - defined(WIN32)) -/* MSVC */ -#ifdef _WIN32_WCE - typedef long curl_off_t; -#define CURL_FORMAT_OFF_T "%ld" -#else - typedef signed __int64 curl_off_t; -#define CURL_FORMAT_OFF_T "%I64d" -#endif -#else /* (_MSC_VER && !__POCC__) || (__LCC__ && WIN32) */ -#if (defined(__GNUC__) && defined(WIN32)) || defined(__WATCOMC__) -/* gcc on windows or Watcom */ - typedef long long curl_off_t; -#define CURL_FORMAT_OFF_T "%I64d" -#else /* GCC or Watcom on Windows */ -#if defined(__ILEC400__) -/* OS400 C compiler. */ - typedef long long curl_off_t; -#define CURL_FORMAT_OFF_T "%lld" -#else /* OS400 C compiler. */ - -/* "normal" POSIX approach, do note that this does not necessarily mean that - the type is >32 bits, see the SIZEOF_CURL_OFF_T define for that! */ - typedef off_t curl_off_t; - -/* Check a range of defines to detect large file support. On Linux it seems - none of these are set by default, so if you don't explicitly switches on - large file support, this define will be made for "small file" support. */ -#ifndef _FILE_OFFSET_BITS -#define _FILE_OFFSET_BITS 0 /* to prevent warnings in the check below */ -#define UNDEF_FILE_OFFSET_BITS -#endif -#ifndef FILESIZEBITS -#define FILESIZEBITS 0 /* to prevent warnings in the check below */ -#define UNDEF_FILESIZEBITS -#endif - -#if defined(_LARGE_FILES) || (_FILE_OFFSET_BITS > 32) || (FILESIZEBITS > 32) \ - || defined(_LARGEFILE_SOURCE) || defined(_LARGEFILE64_SOURCE) - /* For now, we assume at least one of these to be set for large files to - work! */ -#define CURL_FORMAT_OFF_T "%lld" -#else /* LARGE_FILE support */ -#define CURL_FORMAT_OFF_T "%ld" -#endif -#endif /* OS400 C compiler. */ -#endif /* GCC or Watcom on Windows */ -#endif /* (_MSC_VER && !__POCC__) || (__LCC__ && WIN32) */ - -#ifdef UNDEF_FILE_OFFSET_BITS -/* this was defined above for our checks, undefine it again */ -#undef _FILE_OFFSET_BITS -#endif - -#ifdef UNDEF_FILESIZEBITS -/* this was defined above for our checks, undefine it again */ -#undef FILESIZEBITS -#endif - #ifndef curl_socket_typedef /* socket typedef */ #ifdef WIN32 diff --git a/include/curl/curlbuild.h.dist b/include/curl/curlbuild.h.dist new file mode 100644 index 000000000..7dbafbce8 --- /dev/null +++ b/include/curl/curlbuild.h.dist @@ -0,0 +1,352 @@ +#ifndef __CURL_CURLBUILD_H +#define __CURL_CURLBUILD_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * $Id$ + ***************************************************************************/ + +/* ================================================================ */ +/* NOTES FOR CONFIGURE CAPABLE SYSTEMS */ +/* ================================================================ */ + +/* + * NOTE 1: + * ------- + * + * See file include/curl/curlbuild.h.in, run configure, and forget + * that this file exists it is only used for non-configure systems. + * But you can keep reading if you want ;-) + * + */ + +/* ================================================================ */ +/* NOTES FOR NON-CONFIGURE SYSTEMS */ +/* ================================================================ */ + +/* + * NOTE 1: + * ------- + * + * Nothing in this file is intended to be modified or adjusted by the + * curl library user nor by the curl library builder. + * + * If you think that something actually needs to be changed, adjusted + * or fixed in this file, then, report it on the libcurl development + * mailing list: http://cool.haxx.se/mailman/listinfo/curl-library/ + * + * Try to keep one section per platform, compiler and architecture, + * otherwise, if an existing section is reused for a different one and + * later on the original is adjusted, probably the piggybacking one can + * be adversely changed. + * + * In order to differentiate between platforms/compilers/architectures + * use only compiler built in predefined preprocessor symbols. + * + * This header file shall only export symbols which are 'curl' or 'CURL' + * prefixed, otherwise public name space would be polluted. + * + * NOTE 2: + * ------- + * + * For any given platform/compiler curl_off_t must be typedef'ed to a + * 64-bit wide signed integral data type. The width of this data type + * must remain constant and independant of any possible large file + * support settings. + * + * As an exception to the above, curl_off_t shall be typedef'ed to a + * 32-bit wide signed integral data type if there is no 64-bit type. + * + * As a general rule, curl_off_t shall not be mapped to off_t. This + * rule shall only be violated if off_t is the only 64-bit data type + * available and the size of off_t is independant of large file support + * settings. Keep your build on the safe side avoiding an off_t gating. + * If you have a 64-bit off_t then take for sure that another 64-bit + * data type exists, dig deeper and you will find it. + * + * NOTE 3: + * ------- + * + * Right now you might be staring at file include/curl/curlbuild.h.dist or + * at file include/curl/curlbuild.h, this is due to the following reason: + * file include/curl/curlbuild.h.dist is renamed to include/curl/curlbuild.h + * when the libcurl source code distribution archive file is created. + * + * File include/curl/curlbuild.h.dist is not included in the distribution + * archive. File include/curl/curlbuild.h is not present in the CVS tree. + * + * The distributed include/curl/curlbuild.h file is only intended to be used + * on systems which can not run the also distributed configure script. + * + * On systems capable of running the configure script, the configure process + * will overwrite the distributed include/curl/curlbuild.h file with one that + * is suitable and specific to the library being configured and built, which + * is generated from the include/curl/curlbuild.h.in template file. + * + * If you check out from CVS on a non-configure platform, you must run the + * appropriate buildconf* script to set up curlbuild.h and other local files. + * + */ + +/* ================================================================ */ +/* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */ +/* ================================================================ */ + +#ifdef CURL_OFF_T +# error "CURL_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_OFF_T_already_defined +#endif + +#ifdef CURL_FMT_OFF_T +# error "CURL_FMT_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_FMT_OFF_T_already_defined +#endif + +#ifdef CURL_FMT_OFF_TU +# error "CURL_FMT_OFF_TU shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_FMT_OFF_TU_already_defined +#endif + +#ifdef CURL_FORMAT_OFF_T +# error "CURL_FORMAT_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_FORMAT_OFF_T_already_defined +#endif + +#ifdef CURL_SIZEOF_CURL_OFF_T +# error "CURL_SIZEOF_CURL_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_already_defined +#endif + +/* ================================================================ */ +/* EXTERNAL INTERFACE SETTINGS FOR NON-CONFIGURE SYSTEMS ONLY */ +/* ================================================================ */ + +#if defined(__DJGPP__) +# define CURL_OFF_T long +# define CURL_FMT_OFF_T "ld" +# define CURL_FMT_OFF_TU "lu" +# define CURL_FORMAT_OFF_T "%ld" +# define CURL_SIZEOF_CURL_OFF_T 4 + +#elif defined(__SALFORDC__) +# define CURL_OFF_T long +# define CURL_FMT_OFF_T "ld" +# define CURL_FMT_OFF_TU "lu" +# define CURL_FORMAT_OFF_T "%ld" +# define CURL_SIZEOF_CURL_OFF_T 4 + +#elif defined(__BORLANDC__) +# if (__BORLANDC__ < 0x520) +# define CURL_OFF_T long +# define CURL_FMT_OFF_T "ld" +# define CURL_FMT_OFF_TU "lu" +# define CURL_FORMAT_OFF_T "%ld" +# define CURL_SIZEOF_CURL_OFF_T 4 +# else +# define CURL_OFF_T signed __int64 +# define CURL_FMT_OFF_T "I64d" +# define CURL_FMT_OFF_TU "I64u" +# define CURL_FORMAT_OFF_T "%I64d" +# define CURL_SIZEOF_CURL_OFF_T 8 +# endif + +#elif defined(__TURBOC__) +# define CURL_OFF_T long +# define CURL_FMT_OFF_T "ld" +# define CURL_FMT_OFF_TU "lu" +# define CURL_FORMAT_OFF_T "%ld" +# define CURL_SIZEOF_CURL_OFF_T 4 + +#elif defined(__WATCOMC__) +# if defined(__386__) +# define CURL_OFF_T signed __int64 +# define CURL_FMT_OFF_T "I64d" +# define CURL_FMT_OFF_TU "I64u" +# define CURL_FORMAT_OFF_T "%I64d" +# define CURL_SIZEOF_CURL_OFF_T 8 +# else +# define CURL_OFF_T long +# define CURL_FMT_OFF_T "ld" +# define CURL_FMT_OFF_TU "lu" +# define CURL_FORMAT_OFF_T "%ld" +# define CURL_SIZEOF_CURL_OFF_T 4 +# endif + +#elif defined(__POCC__) +# if (__POCC__ < 280) +# define CURL_OFF_T long +# define CURL_FMT_OFF_T "ld" +# define CURL_FMT_OFF_TU "lu" +# define CURL_FORMAT_OFF_T "%ld" +# define CURL_SIZEOF_CURL_OFF_T 4 +# elif defined(_MSC_VER) +# define CURL_OFF_T signed __int64 +# define CURL_FMT_OFF_T "I64d" +# define CURL_FMT_OFF_TU "I64u" +# define CURL_FORMAT_OFF_T "%I64d" +# define CURL_SIZEOF_CURL_OFF_T 8 +# else +# define CURL_OFF_T long long +# define CURL_FMT_OFF_T "lld" +# define CURL_FMT_OFF_TU "llu" +# define CURL_FORMAT_OFF_T "%lld" +# define CURL_SIZEOF_CURL_OFF_T 8 +# endif + +#elif defined(__LCC__) +# define CURL_OFF_T long +# define CURL_FMT_OFF_T "ld" +# define CURL_FMT_OFF_TU "lu" +# define CURL_FORMAT_OFF_T "%ld" +# define CURL_SIZEOF_CURL_OFF_T 4 + +#elif defined(__SYMBIAN32__) +# if defined(__GCC32__) +# define CURL_OFF_T long long +# define CURL_FMT_OFF_T "lld" +# define CURL_FMT_OFF_TU "llu" +# define CURL_FORMAT_OFF_T "%lld" +# define CURL_SIZEOF_CURL_OFF_T 8 +# elif defined(__CW32__) +# pragma longlong on +# define CURL_OFF_T long long +# define CURL_FMT_OFF_T "lld" +# define CURL_FMT_OFF_TU "llu" +# define CURL_FORMAT_OFF_T "%lld" +# define CURL_SIZEOF_CURL_OFF_T 8 +# elif defined(__VC32__) +# define CURL_OFF_T signed __int64 +# define CURL_FMT_OFF_T "lld" +# define CURL_FMT_OFF_TU "llu" +# define CURL_FORMAT_OFF_T "%lld" +# define CURL_SIZEOF_CURL_OFF_T 8 +# endif + +#elif defined(_WIN32_WCE) +# define CURL_OFF_T signed __int64 +# define CURL_FMT_OFF_T "I64d" +# define CURL_FMT_OFF_TU "I64u" +# define CURL_FORMAT_OFF_T "%I64d" +# define CURL_SIZEOF_CURL_OFF_T 8 + +#elif defined(__MINGW32__) +# define CURL_OFF_T long long +# define CURL_FMT_OFF_T "I64d" +# define CURL_FMT_OFF_TU "I64u" +# define CURL_FORMAT_OFF_T "%I64d" +# define CURL_SIZEOF_CURL_OFF_T 8 + +#elif defined(_MSC_VER) +# if (_MSC_VER >= 900) +# define CURL_OFF_T signed __int64 +# define CURL_FMT_OFF_T "I64d" +# define CURL_FMT_OFF_TU "I64u" +# define CURL_FORMAT_OFF_T "%I64d" +# define CURL_SIZEOF_CURL_OFF_T 8 +# else +# define CURL_OFF_T long +# define CURL_FMT_OFF_T "ld" +# define CURL_FMT_OFF_TU "lu" +# define CURL_FORMAT_OFF_T "%ld" +# define CURL_SIZEOF_CURL_OFF_T 4 +# endif + +#elif defined(__VMS) +# if defined(__alpha) || defined(__ia64) +# define CURL_OFF_T long long +# define CURL_FMT_OFF_T "lld" +# define CURL_FMT_OFF_TU "llu" +# define CURL_FORMAT_OFF_T "%lld" +# define CURL_SIZEOF_CURL_OFF_T 8 +# else +# define CURL_OFF_T long +# define CURL_FMT_OFF_T "ld" +# define CURL_FMT_OFF_TU "lu" +# define CURL_FORMAT_OFF_T "%ld" +# define CURL_SIZEOF_CURL_OFF_T 4 +# endif + +#elif defined(__OS400__) +# if defined(__ILEC400__) +# define CURL_OFF_T long long +# define CURL_FMT_OFF_T "lld" +# define CURL_FMT_OFF_TU "llu" +# define CURL_FORMAT_OFF_T "%lld" +# define CURL_SIZEOF_CURL_OFF_T 8 +# endif + +#elif defined(__MVS__) +# if defined(__IBMC__) || defined(__IBMCPP__) +# if defined(_LONG_LONG) +# define CURL_OFF_T long long +# define CURL_FMT_OFF_T "lld" +# define CURL_FMT_OFF_TU "llu" +# define CURL_FORMAT_OFF_T "%lld" +# define CURL_SIZEOF_CURL_OFF_T 8 +# elif defined(_LP64) +# define CURL_OFF_T long +# define CURL_FMT_OFF_T "ld" +# define CURL_FMT_OFF_TU "lu" +# define CURL_FORMAT_OFF_T "%ld" +# define CURL_SIZEOF_CURL_OFF_T 8 +# else +# define CURL_OFF_T long +# define CURL_FMT_OFF_T "ld" +# define CURL_FMT_OFF_TU "lu" +# define CURL_FORMAT_OFF_T "%ld" +# define CURL_SIZEOF_CURL_OFF_T 4 +# endif +# endif + +#elif defined(__370__) +# if defined(__IBMC__) || defined(__IBMCPP__) +# if defined(_LONG_LONG) +# define CURL_OFF_T long long +# define CURL_FMT_OFF_T "lld" +# define CURL_FMT_OFF_TU "llu" +# define CURL_FORMAT_OFF_T "%lld" +# define CURL_SIZEOF_CURL_OFF_T 8 +# elif defined(_LP64) +# define CURL_OFF_T long +# define CURL_FMT_OFF_T "ld" +# define CURL_FMT_OFF_TU "lu" +# define CURL_FORMAT_OFF_T "%ld" +# define CURL_SIZEOF_CURL_OFF_T 8 +# else +# define CURL_OFF_T long +# define CURL_FMT_OFF_T "ld" +# define CURL_FMT_OFF_TU "lu" +# define CURL_FORMAT_OFF_T "%ld" +# define CURL_SIZEOF_CURL_OFF_T 4 +# endif +# endif + +#else +# error "Unknown non-configure build target!" + Error Compilation_aborted_Unknown_non_configure_build_target +#endif + +/* Data type definition of curl_off_t. */ + +#ifdef CURL_OFF_T + typedef CURL_OFF_T curl_off_t; +#endif + +#endif /* __CURL_CURLBUILD_H */ diff --git a/include/curl/curlbuild.h.in b/include/curl/curlbuild.h.in new file mode 100644 index 000000000..cc4d77eb8 --- /dev/null +++ b/include/curl/curlbuild.h.in @@ -0,0 +1,129 @@ +#ifndef __CURL_CURLBUILD_H +#define __CURL_CURLBUILD_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * $Id$ + ***************************************************************************/ + +/* ================================================================ */ +/* NOTES FOR CONFIGURE CAPABLE SYSTEMS */ +/* ================================================================ */ + +/* + * NOTE 1: + * ------- + * + * Nothing in this file is intended to be modified or adjusted by the + * curl library user nor by the curl library builder. + * + * If you think that something actually needs to be changed, adjusted + * or fixed in this file, then, report it on the libcurl development + * mailing list: http://cool.haxx.se/mailman/listinfo/curl-library/ + * + * This header file shall only export symbols which are 'curl' or 'CURL' + * prefixed, otherwise public name space would be polluted. + * + * NOTE 2: + * ------- + * + * Right now you might be staring at file include/curl/curlbuild.h.in or + * at file include/curl/curlbuild.h, this is due to the following reason: + * + * On systems capable of running the configure script, the configure process + * will overwrite the distributed include/curl/curlbuild.h file with one that + * is suitable and specific to the library being configured and built, which + * is generated from the include/curl/curlbuild.h.in template file. + * + */ + +/* ================================================================ */ +/* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */ +/* ================================================================ */ + +#ifdef CURL_OFF_T +# error "CURL_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_OFF_T_already_defined +#endif + +#ifdef CURL_FMT_OFF_T +# error "CURL_FMT_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_FMT_OFF_T_already_defined +#endif + +#ifdef CURL_FMT_OFF_TU +# error "CURL_FMT_OFF_TU shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_FMT_OFF_TU_already_defined +#endif + +#ifdef CURL_FORMAT_OFF_T +# error "CURL_FORMAT_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_FORMAT_OFF_T_already_defined +#endif + +#ifdef CURL_SIZEOF_CURL_OFF_T +# error "CURL_SIZEOF_CURL_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_already_defined +#endif + +/* ================================================================ */ +/* EXTERNAL INTERFACE SETTINGS FOR CONFIGURE CAPABLE SYSTEMS ONLY */ +/* ================================================================ */ + +/* Configure process defines this to 1 when it finds out that system */ +/* header file sys/types.h must be included by the external interface. */ +#undef CURL_PULL_SYS_TYPES_H +#ifdef CURL_PULL_SYS_TYPES_H +# include <sys/types.h> +#endif + +/* Configure process defines this to 1 when it finds out that system */ +/* header file stdint.h must be included by the external interface. */ +#undef CURL_PULL_STDINT_H +#ifdef CURL_PULL_STDINT_H +# include <stdint.h> +#endif + +/* Configure process defines this to 1 when it finds out that system */ +/* header file inttypes.h must be included by the external interface. */ +#undef CURL_PULL_INTTYPES_H +#ifdef CURL_PULL_INTTYPES_H +# include <inttypes.h> +#endif + +/* Signed integral data type used for curl_off_t. */ +#undef CURL_OFF_T + +/* Data type definition of curl_off_t. */ +typedef CURL_OFF_T curl_off_t; + +/* curl_off_t formatting string directive without "%" conversion specifier. */ +#undef CURL_FMT_OFF_T + +/* unsigned curl_off_t formatting string without "%" conversion specifier. */ +#undef CURL_FMT_OFF_TU + +/* curl_off_t formatting string directive with "%" conversion specifier. */ +#undef CURL_FORMAT_OFF_T + +/* The expected size of curl_off_t, as to be computed by sizeof. */ +#undef CURL_SIZEOF_CURL_OFF_T + +#endif /* __CURL_CURLBUILD_H */ diff --git a/include/curl/curlrules.h b/include/curl/curlrules.h new file mode 100644 index 000000000..56499f9a2 --- /dev/null +++ b/include/curl/curlrules.h @@ -0,0 +1,149 @@ +#ifndef __CURL_CURLRULES_H +#define __CURL_CURLRULES_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * $Id$ + ***************************************************************************/ + +/* ================================================================ */ +/* COMPILE TIME SANITY CHECKS */ +/* ================================================================ */ + +/* + * NOTE 1: + * ------- + * + * All checks done in this file are intentionally placed in a public + * header file which is pulled by curl/curl.h when an application is + * being built using an already built libcurl library. Additionally + * this file is also included and used when building the library. + * + * If compilation fails on this file it is certainly sure that the + * problem is elsewhere. It could be a problem in the curlbuild.h + * header file, or simply that you are using different compilation + * settings than those used to build the library. + * + * Nothing in this file is intended to be modified or adjusted by the + * curl library user nor by the curl library builder. + * + * Do not deactivate any check, these are done to make sure that the + * library is properly built and used. + * + * You can find further help on the libcurl development mailing list: + * http://cool.haxx.se/mailman/listinfo/curl-library/ + * + * NOTE 2 + * ------ + * + * Some of the following compile time checks are based on the fact + * that the dimension of a constant array can not be a negative one. + * In this way if the compile time verification fails, the compilation + * will fail issuing an error. The error description wording is compiler + * dependant but it will be quite similar to one of the following: + * + * "negative subscript or subscript is too large" + * "array must have at least one element" + * "-1 is an illegal array size" + * "size of array is negative" + * + * If you are building an application which tries to use an already + * built libcurl library and you are getting this kind of errors on + * this file, it is a clear indication that there is a mismatch between + * how the library was built and how you are trying to use it for your + * application. Your already compiled or binary library provider is the + * only one who can give you the details you need to properly use it. + */ + +/* + * Verify that some macros are actually defined. + */ + +#ifndef CURL_OFF_T +# error "CURL_OFF_T definition is missing!" + Error Compilation_aborted_CURL_OFF_T_is_missing +#endif + +#ifndef CURL_FMT_OFF_T +# error "CURL_FMT_OFF_T definition is missing!" + Error Compilation_aborted_CURL_FMT_OFF_T_is_missing +#endif + +#ifndef CURL_FMT_OFF_TU +# error "CURL_FMT_OFF_TU definition is missing!" + Error Compilation_aborted_CURL_FMT_OFF_TU_is_missing +#endif + +#ifndef CURL_FORMAT_OFF_T +# error "CURL_FORMAT_OFF_T definition is missing!" + Error Compilation_aborted_CURL_FORMAT_OFF_T_is_missing +#endif + +#ifndef CURL_SIZEOF_CURL_OFF_T +# error "CURL_SIZEOF_CURL_OFF_T definition is missing!" + Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_is_missing +#endif + +/* + * Macros private to this header file. + */ + +#define CurlchkszEQ(t, s) sizeof(t) == s ? 1 : -1 + +#define CurlchkszGE(t1, t2) sizeof(t1) >= sizeof(t2) ? 1 : -1 + +/* + * Verify that the size previously defined and expected for + * curl_off_t is actually the the same as the one reported + * by sizeof() at compile time. + */ + +typedef char + __curl_rule_01__ + [CurlchkszEQ(curl_off_t, CURL_SIZEOF_CURL_OFF_T)]; + +/* + * Verify at compile time that the size of curl_off_t as reported + * by sizeof() is greater or equal than the one reported for long + * for the current compilation. + */ + +typedef char + __curl_rule_02__ + [CurlchkszGE(curl_off_t, long)]; + +/* + * Get rid of macros private to this header file. + */ + +#undef CurlchkszEQ +#undef CurlchkszGE + +/* + * Get rid of macros not intended to exist beyond this point. + */ + +#undef CURL_PULL_SYS_TYPES_H +#undef CURL_PULL_STDINT_H +#undef CURL_PULL_INTTYPES_H + +#undef CURL_OFF_T + +#endif /* __CURL_CURLRULES_H */ |