ue May 21 15:51:17 2002 Owen Taylor <otaylor@redhat.com>
[platform/upstream/glib.git] / INSTALL
1 Simple install procedure
2 ========================
3
4   % gzip -cd glib-2.0.1.tar.gz | tar xvf -  # unpack the sources
5   % cd glib-2.0.1                           # change to the toplevel directory
6   % ./configure                             # run the `configure' script
7   % make                                    # build GLIB
8
9   [ Become root if necessary ]
10   % rm -rf /install-prefix/include/glib.h /install-prefix/include/gmodule.h
11   % make install                            # install GLIB
12
13 Requirements
14 ============
15
16 GLib-2.0 requires pkg-config, which is tool for tracking the
17 compilation flags needed for libraries. (For each library, a small .pc
18 text file is installed in a standard location that contains the
19 compilation flags needed for that library along with version number
20 information.) Information about pkg-config can be found at:
21
22   http://www.freedesktop.org/software/pkgconfig/
23
24 GNU make (http://www.gnu.org/software/make) is also recommended.
25
26 In order to implement conversions between character sets,
27 GLib requires an implementation of the standard iconv() routine.
28 Most modern systems will have a suitable implementation, however
29 many older systems lack an iconv() implementation. On such systems, 
30 you must install the libiconv library. This can be found at:
31
32  http://www.gnu.org/software/libiconv/
33
34 If your system has an iconv implementation but you want to use
35 libiconv instead, you can pass the --with-libiconv option to
36 configure. This forces libiconv to be used. 
37
38 Note that if you have libiconv installed in your default include
39 search path (for instance, in /usr/local/), but don't enable
40 it, you will get an error while compiling GTK+ because the
41 iconv.h that libiconv installs hides the system iconv.
42
43 Finally, for message catalog handling, GTK+ requires an implementation
44 of gettext(). If your system doesn't provide this functionality,
45 you should use the libintl library from the GNU gettext package,
46 available from:
47
48  http://www.gnu.org/software/gettext/
49
50 The Nitty-Gritty
51 ================
52
53 The 'configure' script can be given a number of options to enable
54 and disable various features. For a complete list, type:
55
56   ./configure --help
57
58 A few of the more important ones:
59
60 *  --prefix=PREFIX         install architecture-independent files in PREFIX
61                            [ Defaults to /usr/local ]
62
63 *  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
64                            [ Defaults to the value given to --prefix ]
65
66 *  --enable-gc-friendly    When enabled all memory freed by the application,
67                            but retained by GLib for performance reasons  
68                            is set to zero, thus making deployed garbage
69                            collection or memory profiling tools detect 
70                            unlinked memory correctly. This will make GLib 
71                            slightly slower.
72                            [ Disabled by default ]
73
74 * --disable-threads        Do not compile GLib to be multi thread safe. GLib
75                            will be slightly faster then. This is however not
76                            recommended, as many programs rely on GLib being 
77                            multi thread safe.
78                            [ Enabled by default ]
79
80 * --with-threads=[none/posix/dce/solaris/win32] Specify a thread 
81                            implementation to use. 
82                            * 'posix' and 'dce' can be used interchangeable 
83                              to mean the different versions of posix 
84                              threads. configure tries to find out, which 
85                              one is installed. 
86                            * 'solaris' uses the native Solaris thread
87                              implementation. 
88                            * 'none' means that GLib will be thread safe, 
89                              but does not have a default thread 
90                              implementation. This has to be supplied to 
91                              g_thread_init() by the programmer. 
92                            [ Determined by configure by default ]
93
94 Options can be given to the compiler and linker by setting
95 environment variables before running configure. A few of the more
96 important ones:
97
98  CC       : The C compiler to use
99  CPPFLAGS : Flags for the C preprocesser such as -I and -D
100  CFLAGS   : C compiler flags
101
102 The most important use of this is to set the
103 optimization/debugging flags. For instance, to compile with no
104 debugging information at all, run configure as:
105
106  CFLAGS=-O2 ./configure           # Bourne compatible shells (sh/bash/zsh)
107
108 or,
109
110  setenv CFLAGS -O2 ; ./configure  # csh and variants
111
112
113 Installation directories
114 ========================
115
116 The location of the installed files is determined by the --prefix
117 and --exec-prefix options given to configure. There are also more
118 detailed flags to control individual directories. However, the
119 use of these flags is not tested.
120
121 One particular detail to note, is that the architecture-dependent
122 include file glibconfig.h is installed in:
123
124   $exec_prefix/lib/glib/include/
125
126 if you have a version in $prefix/include, this is out of date
127 and should be deleted.
128
129 .pc files for the various libraries are installed in 
130 $exec_prefix/lib/pkgconfig to provide information when compiling
131 other packages that depend on GTK+. If you set PKG_CONFIG_PATH
132 so that it points to this directory, then you can get the 
133 correct include flags and library flags for compiling a GLib
134 application with:
135
136  pkg-config --cflags glib-2.0
137  pkg-config --libs glib-2.0
138