summaryrefslogtreecommitdiff
path: root/lib
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
parenta3045b4e4944a36f467f363607d6c6a50727fca2 (diff)
downloadcurl-14240e9e109fe6af19438c6531d573f85dbb0b1e.tar.gz
Initial support of curlbuild.h and curlrules.h which allows
to have a curl_off_t data type no longer gated to off_t.
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile.am6
-rw-r--r--lib/Makefile.netware1
-rw-r--r--lib/config-amigaos.h1
-rw-r--r--lib/config-os400.h4
-rw-r--r--lib/config-symbian.h3
-rw-r--r--lib/config-tpf.h3
-rw-r--r--lib/config-win32.h15
-rw-r--r--lib/config-win32ce.h8
-rw-r--r--lib/config.dos1
-rw-r--r--lib/setup.h81
10 files changed, 70 insertions, 53 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 92a049766..7f236d806 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -48,12 +48,14 @@ LIBCURL_LIBS = @LIBCURL_LIBS@
# being currently built and tested are searched before the library which
# might possibly already be installed in the system.
#
+# $(top_builddir)/include is for libcurl's generated curl/curlbuild.h file
# $(top_srcdir)/include is for libcurl's external include files
# $(top_builddir)/lib is for libcurl's generated lib/config.h file
# $(top_srcdir)/lib is for libcurl's lib/setup.h and other "private" files
-INCLUDES = -I$(top_srcdir)/include \
- -I$(top_builddir)/lib \
+INCLUDES = -I$(top_builddir)/include \
+ -I$(top_srcdir)/include \
+ -I$(top_builddir)/lib \
-I$(top_srcdir)/lib
VERSION=-version-info 5:0:1
diff --git a/lib/Makefile.netware b/lib/Makefile.netware
index 91c9bfdaf..d5440c7b4 100644
--- a/lib/Makefile.netware
+++ b/lib/Makefile.netware
@@ -480,7 +480,6 @@ endif
@echo $(DL)#define HAVE_UTIME 1$(DL) >> $@
@echo $(DL)#define HAVE_UTIME_H 1$(DL) >> $@
@echo $(DL)#define RETSIGTYPE void$(DL) >> $@
- @echo $(DL)#define SIZEOF_CURL_OFF_T 4$(DL) >> $@
@echo $(DL)#define SIZEOF_STRUCT_IN_ADDR 4$(DL) >> $@
@echo $(DL)#define STDC_HEADERS 1$(DL) >> $@
@echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@
diff --git a/lib/config-amigaos.h b/lib/config-amigaos.h
index fe77a2dc4..86d9daa41 100644
--- a/lib/config-amigaos.h
+++ b/lib/config-amigaos.h
@@ -103,7 +103,6 @@
#define SELECT_TYPE_ARG1 int
#define SELECT_TYPE_ARG234 (fd_set *)
#define SELECT_TYPE_ARG5 (struct timeval *)
-#define SIZEOF_CURL_OFF_T 4
#define STDC_HEADERS 1
#define TIME_WITH_SYS_TIME 1
diff --git a/lib/config-os400.h b/lib/config-os400.h
index d3b3d4585..c52098731 100644
--- a/lib/config-os400.h
+++ b/lib/config-os400.h
@@ -374,14 +374,12 @@
#define HAVE_LL
-/* The size of `curl_off_t', as computed by sizeof. */
+/* */
#ifndef _LARGE_FILES
#define _LARGE_FILES
#endif
-#define SIZEOF_CURL_OFF_T 8
-
/* Define this if you have struct sockaddr_storage */
#define HAVE_STRUCT_SOCKADDR_STORAGE
diff --git a/lib/config-symbian.h b/lib/config-symbian.h
index 0b7b90df6..d4b5f0979 100644
--- a/lib/config-symbian.h
+++ b/lib/config-symbian.h
@@ -712,9 +712,6 @@
/* Define to the type of arg 5 for `select'. */
#define SELECT_TYPE_ARG5 (struct timeval *)
-/* The size of `curl_off_t', as computed by sizeof. */
-#define SIZEOF_CURL_OFF_T 8
-
/* The size of `long', as computed by sizeof. */
#define SIZEOF_LONG 4
diff --git a/lib/config-tpf.h b/lib/config-tpf.h
index dbeabf6b1..70b799a3d 100644
--- a/lib/config-tpf.h
+++ b/lib/config-tpf.h
@@ -593,9 +593,6 @@
/* Define to the type of arg 5 for `select'. */
#define SELECT_TYPE_ARG5 (struct timeval *)
-/* The size of a `curl_off_t', as computed by sizeof. */
-#define SIZEOF_CURL_OFF_T 8
-
/* The size of a `long', as computed by sizeof. */
#define SIZEOF_LONG 8
diff --git a/lib/config-win32.h b/lib/config-win32.h
index 6526f5497..25484eb7a 100644
--- a/lib/config-win32.h
+++ b/lib/config-win32.h
@@ -324,21 +324,6 @@
/* The number of bytes in a long long. */
/* #define SIZEOF_LONG_LONG 8 */
-/* Undef SIZEOF_CURL_OFF_T if already defined. */
-#ifdef SIZEOF_CURL_OFF_T
-#undef SIZEOF_CURL_OFF_T
-#endif
-
-/* Define SIZEOF_CURL_OFF_T as computed by sizeof(curl_off_t) */
-/* Borland/PellesC/SalfordC lacks _lseeki64(), so we don't support
- * >2GB files.
- */
-#if defined(__BORLANDC__) || defined(__POCC__) || defined(__SALFORDC__)
-#define SIZEOF_CURL_OFF_T 4
-#else
-#define SIZEOF_CURL_OFF_T 8
-#endif
-
/* ---------------------------------------------------------------- */
/* STRUCT RELATED */
/* ---------------------------------------------------------------- */
diff --git a/lib/config-win32ce.h b/lib/config-win32ce.h
index 347b78cbe..21f7eea64 100644
--- a/lib/config-win32ce.h
+++ b/lib/config-win32ce.h
@@ -307,14 +307,6 @@
/* The number of bytes in a long long. */
/* #define SIZEOF_LONG_LONG 8 */
-/* Undef SIZEOF_CURL_OFF_T if already defined. */
-#ifdef SIZEOF_CURL_OFF_T
-#undef SIZEOF_CURL_OFF_T
-#endif
-
-/* Define SIZEOF_CURL_OFF_T as computed by sizeof(curl_off_t) */
-#define SIZEOF_CURL_OFF_T 4
-
/* ---------------------------------------------------------------- */
/* STRUCT RELATED */
/* ---------------------------------------------------------------- */
diff --git a/lib/config.dos b/lib/config.dos
index 76b30debd..ead655f97 100644
--- a/lib/config.dos
+++ b/lib/config.dos
@@ -60,7 +60,6 @@
#define RETSIGTYPE void
#define SIZEOF_LONG_DOUBLE 16
-#define SIZEOF_CURL_OFF_T 4 /* no huge file support */
#define STDC_HEADERS 1
#define TIME_WITH_SYS_TIME 1
diff --git a/lib/setup.h b/lib/setup.h
index 3f0427bac..d43ae85a0 100644
--- a/lib/setup.h
+++ b/lib/setup.h
@@ -72,6 +72,15 @@
#endif /* HAVE_CONFIG_H */
+/* ================================================================ */
+/* Definition of preprocessor macros/symbols which modify compiler */
+/* behaviour or generated code characteristics must be done here, */
+/* as appropriate, before any system header file is included. It is */
+/* also possible to have them defined in the config file included */
+/* before this point. As a result of all this we frown inclusion of */
+/* system header files in our config files, avoid this at any cost. */
+/* ================================================================ */
+
/*
* Tru64 needs _REENTRANT set for a few function prototypes and
* things to appear in the system header files. Unixware needs it
@@ -84,6 +93,57 @@
# endif
#endif
+/* ================================================================ */
+/* If you need to include a system header file for your platform, */
+/* please, do it beyond the point further indicated in this file. */
+/* ================================================================ */
+
+/*
+ * libcurl's external interface definitions are also used internally,
+ * and might also include required system header files to define them.
+ */
+
+#include <curl/curlbuild.h>
+
+/*
+ * Compile time sanity checks must also be done when building the library.
+ */
+
+#include <curl/curlrules.h>
+
+/*
+ * Set up internal curl_off_t size macro
+ */
+
+#ifdef SIZEOF_CURL_OFF_T
+# error "SIZEOF_CURL_OFF_T shall not be defined before this point!"
+ Error Compilation_aborted_SIZEOF_CURL_OFF_T_already_defined
+#else
+# define SIZEOF_CURL_OFF_T CURL_SIZEOF_CURL_OFF_T
+#endif
+
+/*
+ * Set up internal curl_off_t formatting string directive
+ */
+
+#ifdef FORMAT_OFF_T
+# error "FORMAT_OFF_T shall not be defined before this point!"
+ Error Compilation_aborted_FORMAT_OFF_T_already_defined
+#else
+# define FORMAT_OFF_T CURL_FMT_OFF_T
+#endif
+
+/*
+ * Set up internal unsigned curl_off_t formatting string directive
+ */
+
+#ifdef FORMAT_OFF_TU
+# error "FORMAT_OFF_TU shall not be defined before this point!"
+ Error Compilation_aborted_FORMAT_OFF_TU_already_defined
+#else
+# define FORMAT_OFF_TU CURL_FMT_OFF_TU
+#endif
+
/*
* Disable other protocols when http is the only one desired.
*/
@@ -97,6 +157,11 @@
# define CURL_DISABLE_FILE
#endif
+/* ================================================================ */
+/* No system header file shall be included in this file before this */
+/* point. The only allowed ones are those included from curlbuild.h */
+/* ================================================================ */
+
/*
* OS/400 setup file includes some system headers.
*/
@@ -160,22 +225,6 @@
#endif /* _MSC_VER */
#endif /* HAVE_LONGLONG */
-#ifndef SIZEOF_CURL_OFF_T
-/* If we don't know the size here, we assume a conservative size: 4. When
- building libcurl, the actual size of this variable should be defined in the
- config*.h file. */
-#define SIZEOF_CURL_OFF_T 4
-#endif
-
-/* We set up our internal prefered (CURL_)FORMAT_OFF_T[U] here */
-#if SIZEOF_CURL_OFF_T > 4
-#define FORMAT_OFF_T "lld"
-#define FORMAT_OFF_TU "llu" /* the unsigned version */
-#else
-#define FORMAT_OFF_T "ld"
-#define FORMAT_OFF_TU "lu" /* thus unsigned version */
-#endif /* SIZEOF_CURL_OFF_T */
-
#ifdef HAVE_EXTRA_STRICMP_H
# include <extra/stricmp.h>
#endif