aboutsummaryrefslogtreecommitdiff
path: root/lib/setup.h
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2008-08-07 00:29:08 +0000
committerYang Tse <yangsita@gmail.com>2008-08-07 00:29:08 +0000
commit14240e9e109fe6af19438c6531d573f85dbb0b1e (patch)
tree61c5713bff289fbdc27e019b71427723bfb78dbc /lib/setup.h
parenta3045b4e4944a36f467f363607d6c6a50727fca2 (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 'lib/setup.h')
-rw-r--r--lib/setup.h81
1 files changed, 65 insertions, 16 deletions
diff --git a/lib/setup.h b/lib/setup.h
index 3f0427bac..d43ae85a0 100644
--- a/lib/setup.h
+++ b/lib/setup.h
@@ -72,6 +72,15 @@
#endif /* HAVE_CONFIG_H */
+/* ================================================================ */
+/* Definition of preprocessor macros/symbols which modify compiler */
+/* behaviour or generated code characteristics must be done here, */
+/* as appropriate, before any system header file is included. It is */
+/* also possible to have them defined in the config file included */
+/* before this point. As a result of all this we frown inclusion of */
+/* system header files in our config files, avoid this at any cost. */
+/* ================================================================ */
+
/*
* Tru64 needs _REENTRANT set for a few function prototypes and
* things to appear in the system header files. Unixware needs it
@@ -84,6 +93,57 @@
# endif
#endif
+/* ================================================================ */
+/* If you need to include a system header file for your platform, */
+/* please, do it beyond the point further indicated in this file. */
+/* ================================================================ */
+
+/*
+ * libcurl's external interface definitions are also used internally,
+ * and might also include required system header files to define them.
+ */
+
+#include <curl/curlbuild.h>
+
+/*
+ * Compile time sanity checks must also be done when building the library.
+ */
+
+#include <curl/curlrules.h>
+
+/*
+ * Set up internal curl_off_t size macro
+ */
+
+#ifdef SIZEOF_CURL_OFF_T
+# error "SIZEOF_CURL_OFF_T shall not be defined before this point!"
+ Error Compilation_aborted_SIZEOF_CURL_OFF_T_already_defined
+#else
+# define SIZEOF_CURL_OFF_T CURL_SIZEOF_CURL_OFF_T
+#endif
+
+/*
+ * Set up internal curl_off_t formatting string directive
+ */
+
+#ifdef FORMAT_OFF_T
+# error "FORMAT_OFF_T shall not be defined before this point!"
+ Error Compilation_aborted_FORMAT_OFF_T_already_defined
+#else
+# define FORMAT_OFF_T CURL_FMT_OFF_T
+#endif
+
+/*
+ * Set up internal unsigned curl_off_t formatting string directive
+ */
+
+#ifdef FORMAT_OFF_TU
+# error "FORMAT_OFF_TU shall not be defined before this point!"
+ Error Compilation_aborted_FORMAT_OFF_TU_already_defined
+#else
+# define FORMAT_OFF_TU CURL_FMT_OFF_TU
+#endif
+
/*
* Disable other protocols when http is the only one desired.
*/
@@ -97,6 +157,11 @@
# define CURL_DISABLE_FILE
#endif
+/* ================================================================ */
+/* No system header file shall be included in this file before this */
+/* point. The only allowed ones are those included from curlbuild.h */
+/* ================================================================ */
+
/*
* OS/400 setup file includes some system headers.
*/
@@ -160,22 +225,6 @@
#endif /* _MSC_VER */
#endif /* HAVE_LONGLONG */
-#ifndef SIZEOF_CURL_OFF_T
-/* If we don't know the size here, we assume a conservative size: 4. When
- building libcurl, the actual size of this variable should be defined in the
- config*.h file. */
-#define SIZEOF_CURL_OFF_T 4
-#endif
-
-/* We set up our internal prefered (CURL_)FORMAT_OFF_T[U] here */
-#if SIZEOF_CURL_OFF_T > 4
-#define FORMAT_OFF_T "lld"
-#define FORMAT_OFF_TU "llu" /* the unsigned version */
-#else
-#define FORMAT_OFF_T "ld"
-#define FORMAT_OFF_TU "lu" /* thus unsigned version */
-#endif /* SIZEOF_CURL_OFF_T */
-
#ifdef HAVE_EXTRA_STRICMP_H
# include <extra/stricmp.h>
#endif