f719dc34e89e4973389e666d776a675e2ff88bfe
[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 UNIX
18 ====
19
20    A normal unix installation is made in three or four steps (after you've
21    unpacked the source archive):
22
23         ./configure
24         make
25         make test (optional)
26         make install
27
28    You probably need to be root when doing the last command.
29
30    If you have checked out the sources from the CVS repository, read the
31    CVS-INFO on how to proceed.
32
33    Get a full listing of all available configure options by invoking it like:
34
35         ./configure --help
36
37    If you want to install curl in a different file hierarchy than /usr/local,
38    you need to specify that already when running configure:
39
40         ./configure --prefix=/path/to/curl/tree
41
42    If you happen to have write permission in that directory, you can do 'make
43    install' without being root. An example of this would be to make a local
44    install in your own home directory:
45
46         ./configure --prefix=$HOME
47         make
48         make install
49
50    The configure script always tries to find a working SSL library unless
51    explicitly told not to. If you have OpenSSL installed in the default search
52    path for your compiler/linker, you don't need to do anything special. If
53    you have OpenSSL installed in /usr/local/ssl, you can run configure like:
54
55         ./configure --with-ssl
56
57    If you have OpenSSL installed somewhere else (for example, /opt/OpenSSL,)
58    you can run configure like this:
59
60         ./configure --with-ssl=/opt/OpenSSL
61
62    If you insist on forcing a build without SSL support, even though you may
63    have OpenSSL installed in your system, you can run configure like this:
64
65         ./configure --without-ssl
66
67    If you have OpenSSL installed, but with the libraries in one place and the
68    header files somewhere else, you have to set the LDFLAGS and CPPFLAGS
69    environment variables prior to running configure.  Something like this
70    should work:
71
72      (with the Bourne shell and its clones):
73
74        CPPFLAGS="-I/path/to/ssl/include" LDFLAGS="-L/path/to/ssl/lib" \
75            ./configure
76
77      (with csh, tcsh and their clones):
78
79        env CPPFLAGS="-I/path/to/ssl/include" LDFLAGS="-L/path/to/ssl/lib" \
80        ./configure
81
82    If you have shared SSL libs installed in a directory where your run-time
83    linker doesn't find them (which usually causes configure failures), you can
84    provide the -R option to ld on some operating systems to set a hard-coded
85    path to the run-time linker:
86
87         LDFLAGS=-R/usr/local/ssl/lib ./configure --with-ssl
88
89    Another option to the previous trick, is to set LD_LIBRARY_PATH or edit the
90    /etc/ld.so.conf file.
91
92    If your SSL library was compiled with rsaref (this was common in the past
93    when used in the United States), you may also need to set:
94
95      LIBS=-lRSAglue -lrsaref
96      (as suggested by Doug Kaufman)
97
98    MORE OPTIONS
99
100      To force configure to use the standard cc compiler if both cc and gcc are
101      present, run configure like
102
103        CC=cc ./configure
104          or
105        env CC=cc ./configure
106
107      To force a static library compile, disable the shared library creation
108      by running configure like:
109
110        ./configure --disable-shared
111
112      To tell the configure script to skip searching for thread-safe functions,
113      add an option like:
114
115        ./configure --disable-thread
116
117      To build curl with kerberos4 support enabled, curl requires the krb4 libs
118      and headers installed. You can then use a set of options to tell
119      configure where those are:
120
121           --with-krb4-includes[=DIR]   Specify location of kerberos4 headers
122           --with-krb4-libs[=DIR]       Specify location of kerberos4 libs
123           --with-krb4[=DIR]            where to look for Kerberos4
124
125      In most cases, /usr/athena is the install prefix and then it works with
126
127        ./configure --with-krb4=/usr/athena
128
129      If you're a curl developer and use gcc, you might want to enable more
130      debug options with the --enable-debug option.
131
132 Win32
133 =====
134
135    MingW32
136    -------
137
138    Run the 'mingw32.bat' file to get the proper environment variables set,
139    then run 'make mingw32' in the root dir. Use  'make mingw32-ssl' to build
140    curl SSL enabled.
141
142    If you have any problems linking libraries or finding header files, be sure
143    to verify that the provided "Makefile.m32" files use the proper paths, and
144    adjust as necessary.
145
146    Cygwin
147    ------
148
149    Almost identical to the unix installation. Run the configure script in the
150    curl root with 'sh configure'. Make sure you have the sh executable in
151    /bin/ or you'll see the configure fail towards the end.
152
153    Run 'make'
154
155    Dev-Cpp
156    -------
157
158    See the separate INSTALL.devcpp file for details.
159
160    MSVC from command line
161    ----------------------
162
163    Run the 'vcvars32.bat' file to get a proper environment. The
164    vcvars32.bat file is part of the Microsoft development environment and
165    you may find it in 'C:\Program Files\Microsoft Visual Studio\vc98\bin'
166    provided that you installed Visual C/C++ 6 in the default directory.
167
168    Then run 'nmake vc' in curl's root directory.
169
170    If you want to compile with zlib support, you will need to build
171    zlib (http://www.gzip.org/zlib/) as well. Please read the zlib
172    documentation on how to compile zlib. Define the ZLIB_PATH environment
173    variable to the location of zlib.h and zlib.lib, for example:
174
175      set ZLIB_PATH=c:\zlib-1.2.1
176
177    Then run 'nmake vc-zlib' in curl's root directory.
178
179    If you want to compile with SSL support you need the OpenSSL package.
180    Please read the OpenSSL documentation on how to compile and install
181    the OpenSSL libraries.  The build process of OpenSSL generates the
182    libeay32.dll and ssleay32.dll files in the out32dll subdirectory in
183    the OpenSSL home directory.  OpenSSL static libraries (libeay32.lib,
184    ssleay32.lib, RSAglue.lib) are created in the out32 subdirectory.
185
186    Before running nmake define the OPENSSL_PATH environment variable with
187    the root/base directory of OpenSSL, for example:
188
189      set OPENSSL_PATH=c:\openssl-0.9.7d
190
191    Then run 'nmake vc-ssl' or 'nmake vc-ssl-dll' in curl's root
192    directory.  'nmake vc-ssl' will create a libcurl static and dynamic
193    libraries in the lib subdirectory, as well as a statically linked
194    version of curl.exe in the src subdirectory.  This statically linked
195    version is a standalone executable not requiring any DLL at
196    runtime. This make method requires that you have the static OpenSSL
197    libraries available in OpenSSL's out32 subdirectory.
198    'nmake vc-ssl-dll' creates the libcurl dynamic library and
199    links curl.exe against libcurl and OpenSSL dynamically.
200    This executable requires libcurl.dll and the OpenSSL DLLs
201    at runtime.
202    Run 'nmake vc-ssl-zlib' to build with both ssl and zlib support.
203
204    Borland C++ compiler
205    ---------------------
206
207    compile openssl
208
209    Make sure you include the paths to curl/include and openssl/inc32 in
210    your bcc32.cnf file
211
212    eg : -I"c:\Bcc55\include;c:\path_curl\include;c:\path_openssl\inc32"
213
214    Check to make sure that all of the sources listed in lib/Makefile.b32
215    are present in the /path_to_curl/lib directory. (Check the src
216    directory for missing ones.)
217
218    Make sure the environment variable "BCCDIR" is set to the install
219    location for the compiler eg : c:\Borland\BCC55
220
221    command line:
222    make -f /path_to_curl/lib/Makefile-ssl.b32
223
224    compile simplessl.c with appropriate links
225
226    c:\curl\docs\examples\> bcc32 -L c:\path_to_curl\lib\libcurl.lib
227                                  -L c:\borland\bcc55\lib\psdk\ws2_32.lib
228                                  -L c:\openssl\out32\libeay32.lib
229                                  -L c:\openssl\out32\ssleay32.lib
230                                  simplessl.c
231
232
233    MSVC IDE
234    --------
235
236    If you use VC++, Borland or similar compilers. Include all lib source
237    files in a static lib "project" (all .c and .h files that is).
238    (you should name it libcurl or similar)
239
240    Make the sources in the src/ drawer be a "win32 console application"
241    project. Name it curl.
242
243    For VC++ 6, there's an included Makefile.vc6 that should be possible
244    to use out-of-the-box.
245
246
247    Disabling Specific Protocols in Win32 builds
248    --------------------------------------------
249
250    The configure utility, unfortunately, is not available for the Windows
251    environment, therefore, you cannot use the various disable-protocol
252    options of the configure utility on this platform.
253
254    However, you can use the following defines to disable specific
255    protocols:
256
257    HTTP_ONLY             disables all protocols except HTTP
258    CURL_DISABLE_FTP      disables FTP
259    CURL_DISABLE_LDAP     disables LDAP
260    CURL_DISABLE_TELNET   disables TELNET
261    CURL_DISABLE_DICT     disables DICT
262    CURL_DISABLE_FILE     disables FILE
263    CURL_DISABLE_GOPHER   disables GOPHER
264
265    If you want to set any of these defines you have the following
266    possibilities:
267
268    - Modify lib/setup.h
269    - Modify lib/Makefile.vc6
270    - Add defines to Project/Settings/C/C++/General/Preprocessor Definitions
271      in the curllib.dsw/curllib.dsp Visual C++ 6 IDE project.
272
273
274    Important static libcurl usage note
275    -----------------------------------
276
277    When building an application that uses the static libcurl library, you must
278    add '-DCURL_STATICLIB' to your CFLAGS.  Otherwise the linker will look for
279    dynamic import symbols.
280
281
282 IBM OS/2
283 ========
284
285    Building under OS/2 is not much different from building under unix.
286    You need:
287
288       - emx 0.9d
289       - GNU make
290       - GNU patch
291       - ksh
292       - GNU bison
293       - GNU file utilities
294       - GNU sed
295       - autoconf 2.13
296
297    If you want to build with OpenSSL or OpenLDAP support, you'll need to
298    download those libraries, too. Dirk Ohme has done some work to port SSL
299    libraries under OS/2, but it looks like he doesn't care about emx.  You'll
300    find his patches on: http://come.to/Dirk_Ohme
301
302    If during the linking you get an error about _errno being an undefined
303    symbol referenced from the text segment, you need to add -D__ST_MT_ERRNO__
304    in your definitions.
305
306    If everything seems to work fine but there's no curl.exe, you need to add
307    -Zexe to your linker flags.
308
309    If you're getting huge binaries, probably your makefiles have the -g in
310    CFLAGS.
311
312 VMS
313 ===
314    (The VMS section is in whole contributed by the friendly Nico Baggus)
315
316    Curl seems to work with FTP & HTTP other protocols are not tested.  (the
317    perl http/ftp testing server supplied as testing too cannot work on VMS
318    because vms has no concept of fork(). [ I tried to give it a whack, but
319    thats of no use.
320
321    SSL stuff has not been ported.
322
323    Telnet has about the same issues as for Win32. When the changes for Win32
324    are clear maybe they'll work for VMS too. The basic problem is that select
325    ONLY works for sockets.
326
327    Marked instances of fopen/[f]stat that might become a problem, especially
328    for non stream files. In this regard, the files opened for writing will be
329    created stream/lf and will thus be safe. Just keep in mind that non-binary
330    read/wring from/to files will have a records size limit of 32767 bytes
331    imposed.
332
333    Stat to get the size of the files is again only safe for stream files &
334    fixed record files without implied CC.
335
336    -- My guess is that only allowing access to stream files is the quickest
337    way to get around the most issues. Therefore all files need to to be
338    checked to be sure they will be stream/lf before processing them.  This is
339    the easiest way out, I know. The reason for this is that code that needs to
340    report the filesize will become a pain in the ass otherwise.
341
342    Exit status.... Well we needed something done here,
343
344    VMS has a structured exist status:
345    | 3  |       2    |     1       |  0|
346    |1098|765432109876|5432109876543|210|
347    +----+------------+-------------+---+
348    |Ctrl|  Facility  | Error code  |sev|
349    +----+------------+-------------+---+
350
351    With the Ctrl-bits an application can tell if part or the whole message has
352    already been printed from the program, DCL doesn't need to print it again.
353
354    Facility - basically the program ID. A code assigned to the program
355    the name can be fetched from external or internal message libraries
356    Errorcode - the errodes assigned by the application
357    Sev. - severity: Even = error, off = non error
358       0 = Warning
359       1 = Success
360       2 = Error
361       3 = Information
362       4 = Fatal
363       <5-7> reserved.
364
365    This all presents itself with:
366    %<FACILITY>-<SeV>-<Errorname>, <Error message>
367
368    See also the src/curlmsg.msg file, it has the source for the messages In
369    src/main.c a section is devoted to message status values, the globalvalues
370    create symbols with certain values, referenced from a compiled message
371    file. Have all exit function use a exit status derived from a translation
372    table with the compiled message codes.
373
374    This was all compiled with:
375
376       Compaq C V6.2-003 on OpenVMS Alpha V7.1-1H2
377
378    So far for porting notes as of:
379    13-jul-2001
380    N. Baggus
381
382 QNX
383 ===
384    (This section was graciously brought to us by David Bentham)
385
386    As QNX is targeted for resource constrained environments, the QNX headers
387    set conservative limits. This includes the FD_SETSIZE macro, set by default
388    to 32. Socket descriptors returned within the CURL library may exceed this,
389    resulting in memory faults/SIGSEGV crashes when passed into select(..)
390    calls using fd_set macros.
391
392    A good all-round solution to this is to override the default when building
393    libcurl, by overriding CFLAGS during configure, example
394    #  configure CFLAGS='-DFD_SETSIZE=64 -g -O2'
395
396
397 RISC OS
398 =======
399    The library can be cross-compiled using gccsdk as follows:
400
401         CC=riscos-gcc AR=riscos-ar RANLIB='riscos-ar -s' ./configure \
402              --host=arm-riscos-aof --without-random --disable-shared
403         make
404
405    where riscos-gcc and riscos-ar are links to the gccsdk tools.
406    You can then link your program with curl/lib/.libs/libcurl.a
407
408
409 AmigaOS
410 =======
411    (This section was graciously brought to us by Diego Casorran)
412
413    To build cURL/libcurl on AmigaOS just type 'make amiga' ...
414
415    What you need is:    (not tested with others versions)
416
417         GeekGadgets / gcc 2.95.3 (http://www.geekgadgets.org/)
418
419         AmiTCP SDK v4.3 (http://www.aminet.net/comm/tcp/AmiTCP-SDK-4.3.lha)
420
421         Native Developer Kit (http://www.amiga.com/3.9/download/NDK3.9.lha)
422
423    As no ixemul.library is required you will be able to build it for
424    WarpOS/PowerPC (not tested by me), as well a MorphOS version should be
425    possible with no problems.
426
427    To enable SSL support, you need a OpenSSL native version (without ixemul),
428    you can find a precompiled package at http://amiga.sourceforge.net/OpenSSL/
429
430
431 NetWare
432 =======
433
434    To compile curl.nlm / libcurl.nlm you need:
435    - either any gcc / nlmconv, or CodeWarrior 7 PDK 4 or later.
436    - gnu make and awk running on the platform you compile on;
437      native Win32 versions can be downloaded from:
438      http://www.gknw.com/development/prgtools/
439    - recent Novell LibC SDK available from:
440      http://developer.novell.com/ndk/libc.htm
441    - optional zlib sources (at the moment only dynamic linking with zlib.imp);
442      sources with NetWare Makefile can be obtained from:
443      http://www.gknw.com/mirror/zlib/
444    - optional OpenSSL sources (version 0.9.8 or later which builds with BSD);
445
446    Set a search path to your compiler, linker and tools; on Linux make
447    sure that the var OSTYPE contains the string 'linux'; and then type
448    'make netware' from the top source directory; other tagets available
449    are 'netware-ssl', 'netware-ssl-zlib', 'netware-zlib' and 'netware-ares';
450    if you need other combinations you can control the build with the
451    environment variables WITH_SSL, WITH_ZLIB, WITH_ARES and ENABLE_IPV6.
452    I found on some Linux systems (RH9) that OS detection didnt work although
453    a 'set | grep OSTYPE' shows the var present and set; I simply overwrote it
454    with 'OSTYPE=linux-rh9-gnu' and the detection in the Makefile worked...
455    Any help in testing appreciated!
456    Builds automatically created 8 times a day from current CVS are here:
457    http://www.gknw.com/mirror/curl/autobuilds/
458    the status of these builds can be viewed at the autobuild table:
459    http://curl.haxx.se/auto/
460
461
462 CROSS COMPILE
463 =============
464
465    (This section was graciously brought to us by Jim Duey, with additions by
466    Dan Fandrich)
467
468    Download and unpack the cURL package.  Version should be 7.9.1 or later.
469
470    'cd' to the new directory. (e.g. cd curl-7.12.3)
471
472    Set environment variables to point to the cross-compile toolchain and call
473    configure with any options you need.  Be sure and specify the '--host' and
474    '--build' parameters at configuration time.  The following script is an
475    example of cross-compiling for the IBM 405GP PowerPC processor using the
476    toolchain from MonteVista for Hardhat Linux.
477
478    (begin script)
479
480    #! /bin/sh
481
482    export PATH=$PATH:/opt/hardhat/devkit/ppc/405/bin
483    export CPPFLAGS="-I/opt/hardhat/devkit/ppc/405/target/usr/include"
484    export AR=ppc_405-ar
485    export AS=ppc_405-as
486    export LD=ppc_405-ld
487    export RANLIB=ppc_405-ranlib
488    export CC=ppc_405-gcc
489    export NM=ppc_405-nm
490
491    ./configure --target=powerpc-hardhat-linux \
492         --host=powerpc-hardhat-linux \
493         --build=i586-pc-linux-gnu \
494         --prefix=/opt/hardhat/devkit/ppc/405/target/usr/local \
495         --exec-prefix=/usr/local
496
497    (end script)
498
499    You may also need to provide a parameter like '--with-random=/dev/urandom'
500    to configure as it cannot detect the presence of a random number
501    generating device for a target system.  The '--prefix' parameter
502    specifies where cURL will be installed.  If 'configure' completes
503    successfully, do 'make' and 'make install' as usual.
504
505    In some cases, you may be able to simplify the above commands to as
506    little as:
507
508        ./configure --host=ARCH-OS
509
510    There are a number of configure options that can be used to reduce the
511    size of libcurl for embedded applications where binary size is an
512    important factor.  First, be sure to set the CFLAGS environment variable
513    when configuring with any compiler optimization flags to reduce the
514    size of the binary.  For gcc, this would mean at minimum:
515
516       env CFLAGS='-Os' ./configure ...
517
518    Be sure to specify as many --disable- and --without- flags on the configure
519    command-line as you can to disable all the libcurl features that you
520    know your application is not going to need.  Besides specifying the
521    --disable-PROTOCOL flags for all the types of URLs your application
522    will not use, here are some other flags that can reduce the size of the
523    library:
524
525      --disable-ares (disables support for the ARES DNS library)
526      --disable-cookies (disables support for HTTP cookies)
527      --disable-crypto-auth (disables HTTP cryptographic authentication)
528      --disable-ipv6 (disables support for IPv6)
529      --disable-verbose (eliminates debugging strings and error code strings)
530      --without-libidn (disables support for the libidn DNS library)
531      --without-ssl (disables support for SSL/TLS)
532      --without-zlib (disables support for on-the-fly decompression)
533
534    You may find that statically linking libcurl to your application will
535    result in a lower total size.
536
537
538 PORTS
539 =====
540    This is a probably incomplete list of known hardware and operating systems
541    that curl has been compiled for. If you know a system curl compiles and
542    runs on, that isn't listed, please let us know!
543
544         - Alpha DEC OSF 4
545         - Alpha Digital UNIX v3.2
546         - Alpha FreeBSD 4.1, 4.5
547         - Alpha Linux 2.2, 2.4
548         - Alpha NetBSD 1.5.2
549         - Alpha OpenBSD 3.0
550         - Alpha OpenVMS V7.1-1H2
551         - Alpha Tru64 v5.0 5.1
552         - HP-PA HP-UX 9.X 10.X 11.X
553         - HP-PA Linux
554         - HP3000 MPE/iX
555         - MIPS IRIX 6.2, 6.5
556         - MIPS Linux
557         - Pocket PC/Win CE 3.0
558         - Power AIX 3.2.5, 4.2, 4.3.1, 4.3.2, 5.1, 5.2
559         - PowerPC Darwin 1.0
560         - PowerPC Linux
561         - PowerPC Mac OS 9
562         - PowerPC Mac OS X
563         - SINIX-Z v5
564         - Sparc Linux
565         - Sparc Solaris 2.4, 2.5, 2.5.1, 2.6, 7, 8, 9, 10
566         - Sparc SunOS 4.1.X
567         - StrongARM (and other ARM) RISC OS 3.1, 4.02
568         - StrongARM/ARM7/ARM9 Linux 2.4, 2.6
569         - StrongARM NetBSD 1.4.1
570         - Ultrix 4.3a
571         - i386 BeOS
572         - i386 DOS
573         - i386 Esix 4.1
574         - i386 FreeBSD
575         - i386 HURD
576         - i386 Linux 1.3, 2.0, 2.2, 2.3, 2.4, 2.6
577         - i386 NetBSD
578         - i386 Novell NetWare
579         - i386 OS/2
580         - i386 OpenBSD
581         - i386 SCO unix
582         - i386 Solaris 2.7
583         - i386 Windows 95, 98, ME, NT, 2000, XP, 2003
584         - i386 QNX 6
585         - i486 ncr-sysv4.3.03 (NCR MP-RAS)
586         - ia64 Linux 2.3.99
587         - m68k AmigaOS 3
588         - m68k Linux
589         - m68k OpenBSD
590         - m88k dg-dgux5.4R3.00
591         - s390 Linux
592         - XScale/PXA250 Linux 2.4
593
594 Useful URLs
595 ===========
596
597 OpenSSL   http://www.openssl.org
598 MingW     http://www.mingw.org
599 OpenLDAP  http://www.openldap.org
600 Zlib      http://www.gzip.org/zlib/