INSTALL 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018
  1. _ _ ____ _
  2. ___| | | | _ \| |
  3. / __| | | | |_) | |
  4. | (__| |_| | _ <| |___
  5. \___|\___/|_| \_\_____|
  6. How To Compile
  7. Installing Binary Packages
  8. ==========================
  9. Lots of people download binary distributions of curl and libcurl. This
  10. document does not describe how to install curl or libcurl using such a
  11. binary package. This document describes how to compile, build and install
  12. curl and libcurl from source code.
  13. UNIX
  14. ====
  15. A normal unix installation is made in three or four steps (after you've
  16. unpacked the source archive):
  17. ./configure
  18. make
  19. make test (optional)
  20. make install
  21. You probably need to be root when doing the last command.
  22. If you have checked out the sources from the git repository, read the
  23. GIT-INFO on how to proceed.
  24. Get a full listing of all available configure options by invoking it like:
  25. ./configure --help
  26. If you want to install curl in a different file hierarchy than /usr/local,
  27. you need to specify that already when running configure:
  28. ./configure --prefix=/path/to/curl/tree
  29. If you happen to have write permission in that directory, you can do 'make
  30. install' without being root. An example of this would be to make a local
  31. install in your own home directory:
  32. ./configure --prefix=$HOME
  33. make
  34. make install
  35. The configure script always tries to find a working SSL library unless
  36. explicitly told not to. If you have OpenSSL installed in the default search
  37. path for your compiler/linker, you don't need to do anything special. If
  38. you have OpenSSL installed in /usr/local/ssl, you can run configure like:
  39. ./configure --with-ssl
  40. If you have OpenSSL installed somewhere else (for example, /opt/OpenSSL)
  41. and you have pkg-config installed, set the pkg-config path first, like this:
  42. env PKG_CONFIG_PATH=/opt/OpenSSL/lib/pkgconfig ./configure --with-ssl
  43. Without pkg-config installed, use this:
  44. ./configure --with-ssl=/opt/OpenSSL
  45. If you insist on forcing a build without SSL support, even though you may
  46. have OpenSSL installed in your system, you can run configure like this:
  47. ./configure --without-ssl
  48. If you have OpenSSL installed, but with the libraries in one place and the
  49. header files somewhere else, you have to set the LDFLAGS and CPPFLAGS
  50. environment variables prior to running configure. Something like this
  51. should work:
  52. (with the Bourne shell and its clones):
  53. CPPFLAGS="-I/path/to/ssl/include" LDFLAGS="-L/path/to/ssl/lib" \
  54. ./configure
  55. (with csh, tcsh and their clones):
  56. env CPPFLAGS="-I/path/to/ssl/include" LDFLAGS="-L/path/to/ssl/lib" \
  57. ./configure
  58. If you have shared SSL libs installed in a directory where your run-time
  59. linker doesn't find them (which usually causes configure failures), you can
  60. provide the -R option to ld on some operating systems to set a hard-coded
  61. path to the run-time linker:
  62. env LDFLAGS=-R/usr/local/ssl/lib ./configure --with-ssl
  63. MORE OPTIONS
  64. ------------
  65. To force configure to use the standard cc compiler if both cc and gcc are
  66. present, run configure like
  67. CC=cc ./configure
  68. or
  69. env CC=cc ./configure
  70. To force a static library compile, disable the shared library creation
  71. by running configure like:
  72. ./configure --disable-shared
  73. To tell the configure script to skip searching for thread-safe functions,
  74. add an option like:
  75. ./configure --disable-thread
  76. To build curl with kerberos4 support enabled, curl requires the krb4 libs
  77. and headers installed. You can then use a set of options to tell
  78. configure where those are:
  79. --with-krb4-includes[=DIR] Specify location of kerberos4 headers
  80. --with-krb4-libs[=DIR] Specify location of kerberos4 libs
  81. --with-krb4[=DIR] where to look for Kerberos4
  82. In most cases, /usr/athena is the install prefix and then it works with
  83. ./configure --with-krb4=/usr/athena
  84. If you're a curl developer and use gcc, you might want to enable more
  85. debug options with the --enable-debug option.
  86. curl can be built to use a whole range of libraries to provide various
  87. useful services, and configure will try to auto-detect a decent
  88. default. But if you want to alter it, you can select how to deal with
  89. each individual library.
  90. To build with GnuTLS support instead of OpenSSL for SSL/TLS, note that
  91. you need to use both --without-ssl and --with-gnutls.
  92. To build with yassl support instead of OpenSSL or GnuTLS, you must build
  93. yassl with its OpenSSL emulation enabled and point to that directory root
  94. with configure --with-ssl.
  95. To build with NSS support instead of OpenSSL for SSL/TLS, note that
  96. you need to use both --without-ssl and --with-nss.
  97. To build with PolarSSL support instead of OpenSSL for SSL/TLS, note that
  98. you need to use both --without-ssl and --with-polarssl.
  99. To build with axTLS support instead of OpenSSL for TLS, note that you
  100. need to use both --without-ssl and --with-axtls.
  101. To get GSSAPI support, build with --with-gssapi and have the MIT or
  102. Heimdal Kerberos 5 packages installed.
  103. To get support for SCP and SFTP, build with --with-libssh2 and have
  104. libssh2 0.16 or later installed.
  105. SPECIAL CASES
  106. -------------
  107. Some versions of uClibc require configuring with CPPFLAGS=-D_GNU_SOURCE=1
  108. to get correct large file support.
  109. The Open Watcom C compiler on Linux requires configuring with the variables:
  110. ./configure CC=owcc AR="$WATCOM/binl/wlib" AR_FLAGS=-q \
  111. RANLIB=/bin/true STRIP="$WATCOM/binl/wstrip" CFLAGS=-Wextra
  112. Win32
  113. =====
  114. Building Windows DLLs and C run-time (CRT) linkage issues
  115. ---------------------------------------------------------
  116. As a general rule, building a DLL with static CRT linkage is highly
  117. discouraged, and intermixing CRTs in the same app is something to
  118. avoid at any cost.
  119. Reading and comprehension of Microsoft Knowledge Base articles
  120. KB94248 and KB140584 is a must for any Windows developer. Especially
  121. important is full understanding if you are not going to follow the
  122. advice given above.
  123. KB94248 - How To Use the C Run-Time
  124. http://support.microsoft.com/kb/94248/en-us
  125. KB140584 - How to link with the correct C Run-Time (CRT) library
  126. http://support.microsoft.com/kb/140584/en-us
  127. KB190799 - Potential Errors Passing CRT Objects Across DLL Boundaries
  128. http://msdn.microsoft.com/en-us/library/ms235460
  129. If your app is misbehaving in some strange way, or it is suffering
  130. from memory corruption, before asking for further help, please try
  131. first to rebuild every single library your app uses as well as your
  132. app using the debug multithreaded dynamic C runtime.
  133. MingW32
  134. -------
  135. Make sure that MinGW32's bin dir is in the search path, for example:
  136. set PATH=c:\mingw32\bin;%PATH%
  137. then run 'mingw32-make mingw32' in the root dir. There are other
  138. make targets available to build libcurl with more features, use:
  139. 'mingw32-make mingw32-zlib' to build with Zlib support;
  140. 'mingw32-make mingw32-ssl-zlib' to build with SSL and Zlib enabled;
  141. 'mingw32-make mingw32-ssh2-ssl-zlib' to build with SSH2, SSL, Zlib;
  142. 'mingw32-make mingw32-ssh2-ssl-sspi-zlib' to build with SSH2, SSL, Zlib
  143. and SSPI support.
  144. If you have any problems linking libraries or finding header files, be sure
  145. to verify that the provided "Makefile.m32" files use the proper paths, and
  146. adjust as necessary. It is also possible to override these paths with
  147. environment variables, for example:
  148. set ZLIB_PATH=c:\zlib-1.2.3
  149. set OPENSSL_PATH=c:\openssl-0.9.8k
  150. set LIBSSH2_PATH=c:\libssh2-1.1
  151. ATTENTION: if you want to build with libssh2 support you have to use latest
  152. version 0.17 - previous versions will NOT work with 7.17.0 and later!
  153. Use 'mingw32-make mingw32-ssh2-ssl-zlib' to build with SSH2 and SSL enabled.
  154. It is now also possible to build with other LDAP SDKs than MS LDAP;
  155. currently it is possible to build with native Win32 OpenLDAP, or with the
  156. Novell CLDAP SDK. If you want to use these you need to set these vars:
  157. set LDAP_SDK=c:\openldap
  158. set USE_LDAP_OPENLDAP=1
  159. or for using the Novell SDK:
  160. set USE_LDAP_NOVELL=1
  161. If you want to enable LDAPS support then set LDAPS=1.
  162. - optional MingW32-built OpenlDAP SDK available from:
  163. http://www.gknw.net/mirror/openldap/
  164. - optional recent Novell CLDAP SDK available from:
  165. http://developer.novell.com/ndk/cldap.htm
  166. Cygwin
  167. ------
  168. Almost identical to the unix installation. Run the configure script in the
  169. curl root with 'sh configure'. Make sure you have the sh executable in
  170. /bin/ or you'll see the configure fail toward the end.
  171. Run 'make'
  172. Dev-Cpp
  173. -------
  174. See the separate INSTALL.devcpp file for details.
  175. MSVC 6 caveats
  176. --------------
  177. If you use MSVC 6 it is required that you use the February 2003 edition PSDK:
  178. http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm
  179. Building any software with MSVC 6 without having PSDK installed is just
  180. asking for trouble down the road once you have released it, you might notice
  181. the problems in the first corner or ten miles ahead, depending mostly on your
  182. choice of static vs dynamic runtime and third party libraries. Anyone using
  183. software built in such way will at some point regret having done so.
  184. When someone uses MSVC 6 without PSDK he is using a compiler back from 1998.
  185. If the compiler has been updated with the installation of a service pack as
  186. those mentioned in http://support.microsoft.com/kb/194022 the compiler can be
  187. safely used to read source code, translate and make it object code.
  188. But, even with the service packs mentioned above installed, the resulting
  189. software generated in such an environment will be using outdated system
  190. header files and libraries with bugs and security issues which have already
  191. been addressed and fixed long time ago.
  192. In order to make use of the updated system headers and fixed libraries
  193. for MSVC 6, it is required that 'Platform SDK', PSDK from now onwards,
  194. is installed. The specific PSDK that must be installed for MSVC 6 is the
  195. February 2003 edition, which is the latest one supporting the MSVC 6 compiler,
  196. this PSDK is also known as 'Windows Server 2003 PSDK' and can be downloaded
  197. from http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm
  198. So, building curl and libcurl with MSVC 6 without PSDK is absolutely
  199. discouraged for the benefit of anyone using software built in such
  200. environment. And it will not be supported in any way, as we could just
  201. be hunting bugs which have already been fixed way back in 2003.
  202. When building with MSVC 6 we attempt to detect if PSDK is not being used,
  203. and if this is the case the build process will fail hard with an error
  204. message stating that the February 2003 PSDK is required. This is done to
  205. protect the unsuspecting and avoid PEBKAC issues.
  206. Additionally it might happen that a die hard MSVC hacker still wants to
  207. build curl and libcurl with MSVC 6 without PSDK installed, even knowing
  208. that this is a highly discouraged and unsupported build environment. In
  209. this case the brave of heart will be able to build in such an environment
  210. with the requisite of defining preprocessor symbol ALLOW_MSVC6_WITHOUT_PSDK
  211. in lib/config-win32.h and knowing that LDAP and IPv6 support will be missing.
  212. MSVC from command line
  213. ----------------------
  214. Run the 'vcvars32.bat' file to get a proper environment. The
  215. vcvars32.bat file is part of the Microsoft development environment and
  216. you may find it in 'C:\Program Files\Microsoft Visual Studio\vc98\bin'
  217. provided that you installed Visual C/C++ 6 in the default directory.
  218. Then run 'nmake vc' in curl's root directory.
  219. If you want to compile with zlib support, you will need to build
  220. zlib (http://www.gzip.org/zlib/) as well. Please read the zlib
  221. documentation on how to compile zlib. Define the ZLIB_PATH environment
  222. variable to the location of zlib.h and zlib.lib, for example:
  223. set ZLIB_PATH=c:\zlib-1.2.3
  224. Then run 'nmake vc-zlib' in curl's root directory.
  225. If you want to compile with SSL support you need the OpenSSL package.
  226. Please read the OpenSSL documentation on how to compile and install
  227. the OpenSSL libraries. The build process of OpenSSL generates the
  228. libeay32.dll and ssleay32.dll files in the out32dll subdirectory in
  229. the OpenSSL home directory. OpenSSL static libraries (libeay32.lib,
  230. ssleay32.lib, RSAglue.lib) are created in the out32 subdirectory.
  231. Before running nmake define the OPENSSL_PATH environment variable with
  232. the root/base directory of OpenSSL, for example:
  233. set OPENSSL_PATH=c:\openssl-0.9.8k
  234. Then run 'nmake vc-ssl' or 'nmake vc-ssl-dll' in curl's root
  235. directory. 'nmake vc-ssl' will create a libcurl static and dynamic
  236. libraries in the lib subdirectory, as well as a statically linked
  237. version of curl.exe in the src subdirectory. This statically linked
  238. version is a standalone executable not requiring any DLL at
  239. runtime. This make method requires that you have the static OpenSSL
  240. libraries available in OpenSSL's out32 subdirectory.
  241. 'nmake vc-ssl-dll' creates the libcurl dynamic library and
  242. links curl.exe against libcurl and OpenSSL dynamically.
  243. This executable requires libcurl.dll and the OpenSSL DLLs
  244. at runtime.
  245. Run 'nmake vc-ssl-zlib' to build with both ssl and zlib support.
  246. MSVC 6 IDE
  247. ----------
  248. A minimal VC++ 6.0 reference workspace (vc6curl.dsw) is available with the
  249. source distribution archive to allow proper building of the two included
  250. projects, the libcurl library and the curl tool.
  251. 1) Open the vc6curl.dsw workspace with MSVC6's IDE.
  252. 2) Select 'Build' from top menu.
  253. 3) Select 'Batch Build' from dropdown menu.
  254. 4) Make sure that the eight project configurations are 'checked'.
  255. 5) Click on the 'Build' button.
  256. 6) Once the eight project configurations are built you are done.
  257. Dynamic and static libcurl libraries are built in debug and release flavours,
  258. and can be located each one in its own subdirectory, DLL-Debug, DLL-Release,
  259. LIB-Debug and LIB-Release, all of them below the 'lib' subdirectory.
  260. In the same way four curl executables are created, each using its respective
  261. library. The resulting curl executables are located in its own subdirectory,
  262. DLL-Debug, DLL-Release, LIB-Debug and LIB-Release, below the 'src' subdir.
  263. These reference VC++ 6.0 configurations are generated using the dynamic CRT.
  264. Intentionally, these reference VC++ 6.0 projects and configurations don't use
  265. third party libraries, such as OpenSSL or Zlib, to allow proper compilation
  266. and configuration for all new users without further requirements.
  267. If you need something more 'involved' you might adjust them for your own use,
  268. or explore the world of makefiles described above 'MSVC from command line'.
  269. Borland C++ compiler
  270. ---------------------
  271. Ensure that your build environment is properly set up to use the compiler
  272. and associated tools. PATH environment variable must include the path to
  273. bin subdirectory of your compiler installation, eg: c:\Borland\BCC55\bin
  274. It is advisable to set environment variable BCCDIR to the base path of
  275. the compiler installation.
  276. set BCCDIR=c:\Borland\BCC55
  277. In order to build a plain vanilla version of curl and libcurl run the
  278. following command from curl's root directory:
  279. make borland
  280. To build curl and libcurl with zlib and OpenSSL support set environment
  281. variables ZLIB_PATH and OPENSSL_PATH to the base subdirectories of the
  282. already built zlib and OpenSSL libraries and from curl's root directory
  283. run command:
  284. make borland-ssl-zlib
  285. libcurl library will be built in 'lib' subdirectory while curl tool
  286. is built in 'src' subdirectory. In order to use libcurl library it is
  287. advisable to modify compiler's configuration file bcc32.cfg located
  288. in c:\Borland\BCC55\bin to reflect the location of libraries include
  289. paths for example the '-I' line could result in something like:
  290. -I"c:\Borland\BCC55\include;c:\curl\include;c:\openssl\inc32"
  291. bcc3.cfg '-L' line could also be modified to reflect the location of
  292. of libcurl library resulting for example:
  293. -L"c:\Borland\BCC55\lib;c:\curl\lib;c:\openssl\out32"
  294. In order to build sample program 'simple.c' from the docs\examples
  295. subdirectory run following command from mentioned subdirectory:
  296. bcc32 simple.c libcurl.lib cw32mt.lib
  297. In order to build sample program simplessl.c an SSL enabled libcurl
  298. is required, as well as the OpenSSL libeay32.lib and ssleay32.lib
  299. libraries.
  300. OTHER MSVC IDEs
  301. ---------------
  302. If you use VC++, Borland or similar compilers. Include all lib source
  303. files in a static lib "project" (all .c and .h files that is).
  304. (you should name it libcurl or similar)
  305. Make the sources in the src/ drawer be a "win32 console application"
  306. project. Name it curl.
  307. Disabling Specific Protocols in Win32 builds
  308. --------------------------------------------
  309. The configure utility, unfortunately, is not available for the Windows
  310. environment, therefore, you cannot use the various disable-protocol
  311. options of the configure utility on this platform.
  312. However, you can use the following defines to disable specific
  313. protocols:
  314. HTTP_ONLY disables all protocols except HTTP
  315. CURL_DISABLE_FTP disables FTP
  316. CURL_DISABLE_LDAP disables LDAP
  317. CURL_DISABLE_TELNET disables TELNET
  318. CURL_DISABLE_DICT disables DICT
  319. CURL_DISABLE_FILE disables FILE
  320. CURL_DISABLE_TFTP disables TFTP
  321. CURL_DISABLE_HTTP disables HTTP
  322. If you want to set any of these defines you have the following
  323. possibilities:
  324. - Modify lib/config-win32.h
  325. - Modify lib/setup.h
  326. - Modify lib/Makefile.vc6
  327. - Add defines to Project/Settings/C/C++/General/Preprocessor Definitions
  328. in the vc6libcurl.dsw/vc6libcurl.dsp Visual C++ 6 IDE project.
  329. Important static libcurl usage note
  330. -----------------------------------
  331. When building an application that uses the static libcurl library, you must
  332. add '-DCURL_STATICLIB' to your CFLAGS. Otherwise the linker will look for
  333. dynamic import symbols.
  334. IBM OS/2
  335. ========
  336. Building under OS/2 is not much different from building under unix.
  337. You need:
  338. - emx 0.9d
  339. - GNU make
  340. - GNU patch
  341. - ksh
  342. - GNU bison
  343. - GNU file utilities
  344. - GNU sed
  345. - autoconf 2.13
  346. If you want to build with OpenSSL or OpenLDAP support, you'll need to
  347. download those libraries, too. Dirk Ohme has done some work to port SSL
  348. libraries under OS/2, but it looks like he doesn't care about emx. You'll
  349. find his patches on: http://come.to/Dirk_Ohme
  350. If during the linking you get an error about _errno being an undefined
  351. symbol referenced from the text segment, you need to add -D__ST_MT_ERRNO__
  352. in your definitions.
  353. If everything seems to work fine but there's no curl.exe, you need to add
  354. -Zexe to your linker flags.
  355. If you're getting huge binaries, probably your makefiles have the -g in
  356. CFLAGS.
  357. VMS
  358. ===
  359. (The VMS section is in whole contributed by the friendly Nico Baggus)
  360. Curl seems to work with FTP & HTTP other protocols are not tested. (the
  361. perl http/ftp testing server supplied as testing too cannot work on VMS
  362. because vms has no concept of fork(). [ I tried to give it a whack, but
  363. thats of no use.
  364. SSL stuff has not been ported.
  365. Telnet has about the same issues as for Win32. When the changes for Win32
  366. are clear maybe they'll work for VMS too. The basic problem is that select
  367. ONLY works for sockets.
  368. Marked instances of fopen/[f]stat that might become a problem, especially
  369. for non stream files. In this regard, the files opened for writing will be
  370. created stream/lf and will thus be safe. Just keep in mind that non-binary
  371. read/wring from/to files will have a records size limit of 32767 bytes
  372. imposed.
  373. Stat to get the size of the files is again only safe for stream files &
  374. fixed record files without implied CC.
  375. -- My guess is that only allowing access to stream files is the quickest
  376. way to get around the most issues. Therefore all files need to to be
  377. checked to be sure they will be stream/lf before processing them. This is
  378. the easiest way out, I know. The reason for this is that code that needs to
  379. report the filesize will become a pain in the ass otherwise.
  380. Exit status.... Well we needed something done here,
  381. VMS has a structured exist status:
  382. | 3 | 2 | 1 | 0|
  383. |1098|765432109876|5432109876543|210|
  384. +----+------------+-------------+---+
  385. |Ctrl| Facility | Error code |sev|
  386. +----+------------+-------------+---+
  387. With the Ctrl-bits an application can tell if part or the whole message has
  388. already been printed from the program, DCL doesn't need to print it again.
  389. Facility - basically the program ID. A code assigned to the program
  390. the name can be fetched from external or internal message libraries
  391. Error code - the err codes assigned by the application
  392. Sev. - severity: Even = error, off = non error
  393. 0 = Warning
  394. 1 = Success
  395. 2 = Error
  396. 3 = Information
  397. 4 = Fatal
  398. <5-7> reserved.
  399. This all presents itself with:
  400. %<FACILITY>-<Sev>-<Errorname>, <Error message>
  401. See also the src/curlmsg.msg file, it has the source for the messages In
  402. src/main.c a section is devoted to message status values, the globalvalues
  403. create symbols with certain values, referenced from a compiled message
  404. file. Have all exit function use a exit status derived from a translation
  405. table with the compiled message codes.
  406. This was all compiled with:
  407. Compaq C V6.2-003 on OpenVMS Alpha V7.1-1H2
  408. So far for porting notes as of:
  409. 13-jul-2001
  410. N. Baggus
  411. QNX
  412. ===
  413. (This section was graciously brought to us by David Bentham)
  414. As QNX is targeted for resource constrained environments, the QNX headers
  415. set conservative limits. This includes the FD_SETSIZE macro, set by default
  416. to 32. Socket descriptors returned within the CURL library may exceed this,
  417. resulting in memory faults/SIGSEGV crashes when passed into select(..)
  418. calls using fd_set macros.
  419. A good all-round solution to this is to override the default when building
  420. libcurl, by overriding CFLAGS during configure, example
  421. # configure CFLAGS='-DFD_SETSIZE=64 -g -O2'
  422. RISC OS
  423. =======
  424. The library can be cross-compiled using gccsdk as follows:
  425. CC=riscos-gcc AR=riscos-ar RANLIB='riscos-ar -s' ./configure \
  426. --host=arm-riscos-aof --without-random --disable-shared
  427. make
  428. where riscos-gcc and riscos-ar are links to the gccsdk tools.
  429. You can then link your program with curl/lib/.libs/libcurl.a
  430. AmigaOS
  431. =======
  432. (This section was graciously brought to us by Diego Casorran)
  433. To build cURL/libcurl on AmigaOS just type 'make amiga' ...
  434. What you need is: (not tested with others versions)
  435. GeekGadgets / gcc 2.95.3 (http://www.geekgadgets.org/)
  436. AmiTCP SDK v4.3 (http://www.aminet.net/comm/tcp/AmiTCP-SDK-4.3.lha)
  437. Native Developer Kit (http://www.amiga.com/3.9/download/NDK3.9.lha)
  438. As no ixemul.library is required you will be able to build it for
  439. WarpOS/PowerPC (not tested by me), as well a MorphOS version should be
  440. possible with no problems.
  441. To enable SSL support, you need a OpenSSL native version (without ixemul),
  442. you can find a precompiled package at http://amiga.sourceforge.net/OpenSSL/
  443. NetWare
  444. =======
  445. To compile curl.nlm / libcurl.nlm you need:
  446. - either any gcc / nlmconv, or CodeWarrior 7 PDK 4 or later.
  447. - gnu make and awk running on the platform you compile on;
  448. native Win32 versions can be downloaded from:
  449. http://www.gknw.net/development/prgtools/
  450. - recent Novell LibC SDK available from:
  451. http://developer.novell.com/ndk/libc.htm
  452. - or recent Novell CLib SDK available from:
  453. http://developer.novell.com/ndk/clib.htm
  454. - optional recent Novell CLDAP SDK available from:
  455. http://developer.novell.com/ndk/cldap.htm
  456. - optional zlib sources (static or dynamic linking with zlib.imp);
  457. sources with NetWare Makefile can be obtained from:
  458. http://www.gknw.net/mirror/zlib/
  459. - optional OpenSSL sources (version 0.9.8 or later build with BSD sockets);
  460. you can find precompiled packages at:
  461. http://www.gknw.net/development/ossl/netware/
  462. for CLIB-based builds OpenSSL 0.9.8h or later is required - earlier versions
  463. dont support buildunf with CLIB BSD sockets.
  464. - optional SSH2 sources (version 0.17 or later);
  465. Set a search path to your compiler, linker and tools; on Linux make
  466. sure that the var OSTYPE contains the string 'linux'; set the var
  467. NDKBASE to point to the base of your Novell NDK; and then type
  468. 'make netware' from the top source directory; other targets available
  469. are 'netware-ssl', 'netware-ssl-zlib', 'netware-zlib' and 'netware-ares';
  470. if you need other combinations you can control the build with the
  471. environment variables WITH_SSL, WITH_ZLIB, WITH_ARES, WITH_SSH2, and
  472. ENABLE_IPV6; you can set LINK_STATIC=1 to link curl.nlm statically.
  473. By default LDAP support is enabled, however currently you will need a patch
  474. in order to use the CLDAP NDK with BSD sockets (Novell Bug 300237):
  475. http://www.gknw.net/test/curl/cldap_ndk/ldap_ndk.diff
  476. I found on some Linux systems (RH9) that OS detection didn't work although
  477. a 'set | grep OSTYPE' shows the var present and set; I simply overwrote it
  478. with 'OSTYPE=linux-rh9-gnu' and the detection in the Makefile worked...
  479. Any help in testing appreciated!
  480. Builds automatically created 8 times a day from current git are here:
  481. http://www.gknw.net/mirror/curl/autobuilds/
  482. the status of these builds can be viewed at the autobuild table:
  483. http://curl.haxx.se/auto/
  484. eCos
  485. ====
  486. curl does not use the eCos build system, so you must first build eCos
  487. separately, then link curl to the resulting eCos library. Here's a sample
  488. configure line to do so on an x86 Linux box targeting x86:
  489. GCCLIB=`gcc -print-libgcc-file-name` && \
  490. CFLAGS="-D__ECOS=1 -nostdinc -I$ECOS_INSTALL/include \
  491. -I`dirname $GCCLIB`/include" \
  492. LDFLAGS="-nostdlib -Wl,--gc-sections -Wl,-static \
  493. -L$ECOS_INSTALL/lib -Ttarget.ld -ltarget" \
  494. ./configure --host=i386 --disable-shared \
  495. --without-ssl --without-zlib --disable-manual --disable-ldap
  496. In most cases, eCos users will be using libcurl from within a custom
  497. embedded application. Using the standard 'curl' executable from
  498. within eCos means facing the limitation of the standard eCos C
  499. startup code which does not allow passing arguments in main(). To
  500. run 'curl' from eCos and have it do something useful, you will need
  501. to either modify the eCos startup code to pass in some arguments, or
  502. modify the curl application itself to retrieve its arguments from
  503. some location set by the bootloader or hard-code them.
  504. Something like the following patch could be used to hard-code some
  505. arguments. The MTAB_ENTRY line mounts a RAM disk as the root filesystem
  506. (without mounting some kind of filesystem, eCos errors out all file
  507. operations which curl does not take to well). The next section synthesizes
  508. some command-line arguments for curl to use, in this case to direct curl
  509. to read further arguments from a file. It then creates that file on the
  510. RAM disk and places within it a URL to download: a file: URL that
  511. just happens to point to the configuration file itself. The results
  512. of running curl in this way is the contents of the configuration file
  513. printed to the console.
  514. --- src/main.c 19 Jul 2006 19:09:56 -0000 1.363
  515. +++ src/main.c 24 Jul 2006 21:37:23 -0000
  516. @@ -4286,11 +4286,31 @@
  517. }
  518. +#ifdef __ECOS
  519. +#include <cyg/fileio/fileio.h>
  520. +MTAB_ENTRY( testfs_mte1,
  521. + "/",
  522. + "ramfs",
  523. + "",
  524. + 0);
  525. +#endif
  526. int main(int argc, char *argv[])
  527. {
  528. int res;
  529. struct Configurable config;
  530. +#ifdef __ECOS
  531. + char *args[] = {"ecos-curl", "-K", "curlconf.txt"};
  532. + FILE *f;
  533. + argc = sizeof(args)/sizeof(args[0]);
  534. + argv = args;
  535. +
  536. + f = fopen("curlconf.txt", "w");
  537. + if (f) {
  538. + fprintf(f, "--url file:curlconf.txt");
  539. + fclose(f);
  540. + }
  541. +#endif
  542. memset(&config, 0, sizeof(struct Configurable));
  543. config.errors = stderr; /* default errors to stderr */
  544. Minix
  545. =====
  546. curl can be compiled on Minix 3 using gcc or ACK (starting with
  547. ver. 3.1.3). Ensure that GNU gawk and bash are both installed and
  548. available in the PATH.
  549. ACK
  550. ---
  551. Increase the heap sizes of the compiler with the command:
  552. binsizes xxl
  553. then configure and compile curl with:
  554. ./configure CC=cc LD=cc AR=/usr/bin/aal GREP=grep \
  555. CPPFLAGS='-D_POSIX_SOURCE=1 -I/usr/local/include'
  556. make
  557. chmem =256000 src/curl
  558. GCC
  559. ---
  560. Make sure gcc is in your PATH with the command:
  561. export PATH=/usr/gnu/bin:$PATH
  562. then configure and compile curl with:
  563. ./configure CC=gcc AR=/usr/gnu/bin/gar GREP=grep
  564. make
  565. chmem =256000 src/curl
  566. Symbian OS
  567. ==========
  568. The Symbian OS port uses the Symbian build system to compile. From the
  569. packages/Symbian/group/ directory, run:
  570. bldmake bldfiles
  571. abld build
  572. to compile and install curl and libcurl using SBSv1. If your Symbian
  573. SDK doesn't include support for P.I.P.S., you will need to contact
  574. your SDK vendor to obtain that first.
  575. VxWorks
  576. ========
  577. Build for VxWorks is performed using cross compilation.
  578. That means you build on Windows machine using VxWorks tools and
  579. run the built image on the VxWorks device.
  580. To build libcurl for VxWorks you need:
  581. - CYGWIN (free, http://cygwin.com/)
  582. - Wind River Workbench (commercial)
  583. If you have CYGWIN and Workbench installed on you machine
  584. follow after next steps:
  585. 1. Open the Command Prompt window and change directory ('cd')
  586. to the libcurl 'lib' folder.
  587. 2. Add CYGWIN 'bin' folder to the PATH environment variable.
  588. For example, type 'set PATH=C:/embedded/cygwin/bin;%PATH%'.
  589. 3. Adjust environment variables defined in 'Environment' section
  590. of the Makefile.vxworks file to point to your software folders.
  591. 4. Build the libcurl by typing 'make -f ./Makefile.vxworks'
  592. As a result the libcurl.a library should be created in the 'lib' folder.
  593. To clean the build results type 'make -f ./Makefile.vxworks clean'.
  594. Android
  595. =======
  596. See the build notes in the Android.mk file.
  597. CROSS COMPILE
  598. =============
  599. (This section was graciously brought to us by Jim Duey, with additions by
  600. Dan Fandrich)
  601. Download and unpack the cURL package.
  602. 'cd' to the new directory. (e.g. cd curl-7.12.3)
  603. Set environment variables to point to the cross-compile toolchain and call
  604. configure with any options you need. Be sure and specify the '--host' and
  605. '--build' parameters at configuration time. The following script is an
  606. example of cross-compiling for the IBM 405GP PowerPC processor using the
  607. toolchain from MonteVista for Hardhat Linux.
  608. (begin script)
  609. #! /bin/sh
  610. export PATH=$PATH:/opt/hardhat/devkit/ppc/405/bin
  611. export CPPFLAGS="-I/opt/hardhat/devkit/ppc/405/target/usr/include"
  612. export AR=ppc_405-ar
  613. export AS=ppc_405-as
  614. export LD=ppc_405-ld
  615. export RANLIB=ppc_405-ranlib
  616. export CC=ppc_405-gcc
  617. export NM=ppc_405-nm
  618. ./configure --target=powerpc-hardhat-linux \
  619. --host=powerpc-hardhat-linux \
  620. --build=i586-pc-linux-gnu \
  621. --prefix=/opt/hardhat/devkit/ppc/405/target/usr/local \
  622. --exec-prefix=/usr/local
  623. (end script)
  624. You may also need to provide a parameter like '--with-random=/dev/urandom'
  625. to configure as it cannot detect the presence of a random number
  626. generating device for a target system. The '--prefix' parameter
  627. specifies where cURL will be installed. If 'configure' completes
  628. successfully, do 'make' and 'make install' as usual.
  629. In some cases, you may be able to simplify the above commands to as
  630. little as:
  631. ./configure --host=ARCH-OS
  632. REDUCING SIZE
  633. =============
  634. There are a number of configure options that can be used to reduce the
  635. size of libcurl for embedded applications where binary size is an
  636. important factor. First, be sure to set the CFLAGS variable when
  637. configuring with any relevant compiler optimization flags to reduce the
  638. size of the binary. For gcc, this would mean at minimum the -Os option,
  639. and potentially the -march=X and -mdynamic-no-pic options as well, e.g.
  640. ./configure CFLAGS='-Os' ...
  641. Note that newer compilers often produce smaller code than older versions
  642. due to improved optimization.
  643. Be sure to specify as many --disable- and --without- flags on the configure
  644. command-line as you can to disable all the libcurl features that you
  645. know your application is not going to need. Besides specifying the
  646. --disable-PROTOCOL flags for all the types of URLs your application
  647. will not use, here are some other flags that can reduce the size of the
  648. library:
  649. --disable-ares (disables support for the C-ARES DNS library)
  650. --disable-cookies (disables support for HTTP cookies)
  651. --disable-crypto-auth (disables HTTP cryptographic authentication)
  652. --disable-ipv6 (disables support for IPv6)
  653. --disable-manual (disables support for the built-in documentation)
  654. --disable-proxy (disables support for HTTP and SOCKS proxies)
  655. --disable-verbose (eliminates debugging strings and error code strings)
  656. --enable-hidden-symbols (eliminates unneeded symbols in the shared library)
  657. --without-libidn (disables support for the libidn DNS library)
  658. --without-ssl (disables support for SSL/TLS)
  659. --without-zlib (disables support for on-the-fly decompression)
  660. The GNU compiler and linker have a number of options that can reduce the
  661. size of the libcurl dynamic libraries on some platforms even further.
  662. Specify them by providing appropriate CFLAGS and LDFLAGS variables on the
  663. configure command-line:
  664. CFLAGS="-ffunction-sections -fdata-sections" \
  665. LDFLAGS="-Wl,-s -Wl,-Bsymbolic -Wl,--gc-sections"
  666. Be sure also to strip debugging symbols from your binaries after
  667. compiling using 'strip' (or the appropriate variant if cross-compiling).
  668. If space is really tight, you may be able to remove some unneeded
  669. sections of the shared library using the -R option to objcopy (e.g. the
  670. .comment section).
  671. Using these techniques it is possible to create a basic HTTP-only shared
  672. libcurl library for i386 Linux platforms that is only 98 KiB in size, and
  673. an FTP-only library that is 94 KiB in size (as of libcurl version 7.20.0,
  674. using gcc 4.3.3).
  675. You may find that statically linking libcurl to your application will
  676. result in a lower total size than dynamically linking.
  677. Note that the curl test harness can detect the use of some, but not all, of
  678. the --disable statements suggested above. Use will cause tests relying on
  679. those features to fail. The test harness can be manually forced to skip
  680. the relevant tests by specifying certain key words on the runtests.pl
  681. command line. Following is a list of appropriate key words:
  682. --disable-cookies !cookies
  683. --disable-crypto-auth !HTTP\ Digest\ auth !HTTP\ proxy\ Digest\ auth
  684. --disable-manual !--manual
  685. --disable-proxy !HTTP\ proxy !proxytunnel !SOCKS4 !SOCKS5
  686. PORTS
  687. =====
  688. This is a probably incomplete list of known hardware and operating systems
  689. that curl has been compiled for. If you know a system curl compiles and
  690. runs on, that isn't listed, please let us know!
  691. - Alpha DEC OSF 4
  692. - Alpha Digital UNIX v3.2
  693. - Alpha FreeBSD 4.1, 4.5
  694. - Alpha Linux 2.2, 2.4
  695. - Alpha NetBSD 1.5.2
  696. - Alpha OpenBSD 3.0
  697. - Alpha OpenVMS V7.1-1H2
  698. - Alpha Tru64 v5.0 5.1
  699. - AVR32 Linux
  700. - ARM Android 1.5, 2.1
  701. - ARM INTEGRITY
  702. - ARM iPhone OS
  703. - Cell Linux
  704. - Cell Cell OS
  705. - HP-PA HP-UX 9.X 10.X 11.X
  706. - HP-PA Linux
  707. - HP3000 MPE/iX
  708. - MicroBlaze uClinux
  709. - MIPS IRIX 6.2, 6.5
  710. - MIPS Linux
  711. - OS/400
  712. - Pocket PC/Win CE 3.0
  713. - Power AIX 3.2.5, 4.2, 4.3.1, 4.3.2, 5.1, 5.2
  714. - PowerPC Darwin 1.0
  715. - PowerPC INTEGRITY
  716. - PowerPC Linux
  717. - PowerPC Mac OS 9
  718. - PowerPC Mac OS X
  719. - SH4 Linux 2.6.X
  720. - SH4 OS21
  721. - SINIX-Z v5
  722. - Sparc Linux
  723. - Sparc Solaris 2.4, 2.5, 2.5.1, 2.6, 7, 8, 9, 10
  724. - Sparc SunOS 4.1.X
  725. - StrongARM (and other ARM) RISC OS 3.1, 4.02
  726. - StrongARM/ARM7/ARM9 Linux 2.4, 2.6
  727. - StrongARM NetBSD 1.4.1
  728. - Symbian OS (P.I.P.S.) 9.x
  729. - TPF
  730. - Ultrix 4.3a
  731. - UNICOS 9.0
  732. - i386 BeOS
  733. - i386 DOS
  734. - i386 eCos 1.3.1
  735. - i386 Esix 4.1
  736. - i386 FreeBSD
  737. - i386 HURD
  738. - i386 Haiku OS
  739. - i386 Linux 1.3, 2.0, 2.2, 2.3, 2.4, 2.6
  740. - i386 MINIX 3.1
  741. - i386 NetBSD
  742. - i386 Novell NetWare
  743. - i386 OS/2
  744. - i386 OpenBSD
  745. - i386 QNX 6
  746. - i386 SCO unix
  747. - i386 Solaris 2.7
  748. - i386 Windows 95, 98, ME, NT, 2000, XP, 2003
  749. - i486 ncr-sysv4.3.03 (NCR MP-RAS)
  750. - ia64 Linux 2.3.99
  751. - m68k AmigaOS 3
  752. - m68k Linux
  753. - m68k uClinux
  754. - m68k OpenBSD
  755. - m88k dg-dgux5.4R3.00
  756. - s390 Linux
  757. - x86_64 Linux
  758. - XScale/PXA250 Linux 2.4
  759. - Nios II uClinux
  760. Useful URLs
  761. ===========
  762. c-ares http://daniel.haxx.se/projects/c-ares/license.html
  763. GNU GSS http://www.gnu.org/software/gss/
  764. GnuTLS http://www.gnu.org/software/gnutls/
  765. Heimdal http://www.pdc.kth.se/heimdal/
  766. libidn http://www.gnu.org/software/libidn/
  767. libssh2 http://www.libssh2.org
  768. MingW http://www.mingw.org
  769. MIT Kerberos http://web.mit.edu/kerberos/www/dist/
  770. NSS http://www.mozilla.org/projects/security/pki/nss/
  771. OpenLDAP http://www.openldap.org
  772. OpenSSL http://www.openssl.org
  773. PolarSSL http://polarssl.org
  774. yassl http://www.yassl.com/
  775. Zlib http://www.gzip.org/zlib/