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