1 | Simple install procedure |
---|
2 | ======================== |
---|
3 | |
---|
4 | % gzip -cd glib-2.2.0.tar.gz | tar xvf - # unpack the sources |
---|
5 | % cd glib-2.2.0 # 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 | If you are using the native iconv implementation on Solaris |
---|
44 | instead of libiconv, you'll need to make sure that you have |
---|
45 | the converters between locale encodings and UTF-8 installed. |
---|
46 | At a minimum you'll need the SUNWuiu8 package. You probably |
---|
47 | should also install the SUNWciu8, SUNWhiu8, SUNWjiu8, and |
---|
48 | SUNWkiu8 packages. |
---|
49 | |
---|
50 | The native iconv on Compaq Tru64 doesn't contain support for |
---|
51 | UTF-8, so you'll need to use GNU libiconv instead. (When |
---|
52 | using GNU libiconv for GTK+, you'll need to use GNU libiconv |
---|
53 | for GNU gettext as well.) This probably applies to related |
---|
54 | operating systems as well. |
---|
55 | |
---|
56 | Finally, for message catalog handling, GTK+ requires an implementation |
---|
57 | of gettext(). If your system doesn't provide this functionality, |
---|
58 | you should use the libintl library from the GNU gettext package, |
---|
59 | available from: |
---|
60 | |
---|
61 | http://www.gnu.org/software/gettext/ |
---|
62 | |
---|
63 | The Nitty-Gritty |
---|
64 | ================ |
---|
65 | |
---|
66 | The 'configure' script can be given a number of options to enable |
---|
67 | and disable various features. For a complete list, type: |
---|
68 | |
---|
69 | ./configure --help |
---|
70 | |
---|
71 | A few of the more important ones: |
---|
72 | |
---|
73 | * --prefix=PREFIX install architecture-independent files in PREFIX |
---|
74 | [ Defaults to /usr/local ] |
---|
75 | |
---|
76 | * --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX |
---|
77 | [ Defaults to the value given to --prefix ] |
---|
78 | |
---|
79 | * --enable-debug=[yes/no/minimum] determines the amount of debugging |
---|
80 | code to include. 'yes' will includes some |
---|
81 | extra checks and debugging features that |
---|
82 | may be useful for people developing with |
---|
83 | GLib. 'no' produces a somewhat smaller and |
---|
84 | faster library at the expense of reduced |
---|
85 | robustness. |
---|
86 | [ Defaults to 'minimum' for stable releases ] |
---|
87 | |
---|
88 | * --enable-gc-friendly When enabled all memory freed by the application, |
---|
89 | but retained by GLib for performance reasons |
---|
90 | is set to zero, thus making deployed garbage |
---|
91 | collection or memory profiling tools detect |
---|
92 | unlinked memory correctly. This will make GLib |
---|
93 | slightly slower. |
---|
94 | [ --disable-gc-friendly is default ] |
---|
95 | |
---|
96 | * --disable-mem-pools Do not cache freed objects. When specified, |
---|
97 | GLib will immediately return freed memory |
---|
98 | to the C library instead of keeping around |
---|
99 | pools of free objects such as linked list |
---|
100 | and hash table nodes. Specifying this |
---|
101 | will make GLib slower in most cases, but it |
---|
102 | will use less memory. |
---|
103 | [ --enable-mem-pools is the default ] |
---|
104 | |
---|
105 | * --disable-threads Do not compile GLib to be multi thread safe. GLib |
---|
106 | will be slightly faster then. This is however not |
---|
107 | recommended, as many programs rely on GLib being |
---|
108 | multi thread safe. |
---|
109 | [ --enable-threads is the default ] |
---|
110 | |
---|
111 | * --with-threads=[none/posix/dce/solaris/win32] Specify a thread |
---|
112 | implementation to use. |
---|
113 | * 'posix' and 'dce' can be used interchangeable |
---|
114 | to mean the different versions of posix |
---|
115 | threads. configure tries to find out, which |
---|
116 | one is installed. |
---|
117 | * 'solaris' uses the native Solaris thread |
---|
118 | implementation. |
---|
119 | * 'none' means that GLib will be thread safe, |
---|
120 | but does not have a default thread |
---|
121 | implementation. This has to be supplied to |
---|
122 | g_thread_init() by the programmer. |
---|
123 | [ Determined by configure by default ] |
---|
124 | |
---|
125 | * --enable-included-printf=[yes/no/auto] Specify whether to build using |
---|
126 | the included copy of the Trio library |
---|
127 | for string formatting functions like printf(). |
---|
128 | The default is 'auto', which means that |
---|
129 | Trio will be used if configure detects |
---|
130 | missing features in your system native |
---|
131 | printf implementation. |
---|
132 | |
---|
133 | Options can be given to the compiler and linker by setting |
---|
134 | environment variables before running configure. A few of the more |
---|
135 | important ones: |
---|
136 | |
---|
137 | CC : The C compiler to use |
---|
138 | CPPFLAGS : Flags for the C preprocesser such as -I and -D |
---|
139 | CFLAGS : C compiler flags |
---|
140 | |
---|
141 | The most important use of this is to set the |
---|
142 | optimization/debugging flags. For instance, to compile with no |
---|
143 | debugging information at all, run configure as: |
---|
144 | |
---|
145 | CFLAGS=-O2 ./configure # Bourne compatible shells (sh/bash/zsh) |
---|
146 | |
---|
147 | or, |
---|
148 | |
---|
149 | setenv CFLAGS -O2 ; ./configure # csh and variants |
---|
150 | |
---|
151 | |
---|
152 | Installation directories |
---|
153 | ======================== |
---|
154 | |
---|
155 | The location of the installed files is determined by the --prefix |
---|
156 | and --exec-prefix options given to configure. There are also more |
---|
157 | detailed flags to control individual directories. However, the |
---|
158 | use of these flags is not tested. |
---|
159 | |
---|
160 | One particular detail to note, is that the architecture-dependent |
---|
161 | include file glibconfig.h is installed in: |
---|
162 | |
---|
163 | $exec_prefix/lib/glib/include/ |
---|
164 | |
---|
165 | if you have a version in $prefix/include, this is out of date |
---|
166 | and should be deleted. |
---|
167 | |
---|
168 | .pc files for the various libraries are installed in |
---|
169 | $exec_prefix/lib/pkgconfig to provide information when compiling |
---|
170 | other packages that depend on GTK+. If you set PKG_CONFIG_PATH |
---|
171 | so that it points to this directory, then you can get the |
---|
172 | correct include flags and library flags for compiling a GLib |
---|
173 | application with: |
---|
174 | |
---|
175 | pkg-config --cflags glib-2.0 |
---|
176 | pkg-config --libs glib-2.0 |
---|
177 | |
---|
178 | |
---|
179 | Cross-compiling GLib |
---|
180 | ==================== |
---|
181 | |
---|
182 | Cross-compilation is the proceess of compiling a program or |
---|
183 | library on a different architecture or operating system then |
---|
184 | it will be run upon. GLib is slightly more difficult to |
---|
185 | cross-compile than many packages because much of GLib is |
---|
186 | about hiding differences between different systems. |
---|
187 | |
---|
188 | These notes cover things specific to cross-compiling GLib; |
---|
189 | for general information about cross-compilation, see the |
---|
190 | autoconf info pages. |
---|
191 | |
---|
192 | GLib tries to detect as much information as possible about |
---|
193 | the target system by compiling and linking programs without |
---|
194 | actually running anything; however, some information GLib |
---|
195 | needs is not available this way. This information needs |
---|
196 | to be provided to the configure script via a "cache file" |
---|
197 | or by setting the cache variables in your environment. |
---|
198 | |
---|
199 | As an example of using a cache file, to cross compile for |
---|
200 | the "MingW32" Win32 runtine environment on a Linux system, |
---|
201 | create a file 'win32.cache' with the following contents: |
---|
202 | |
---|
203 | === |
---|
204 | glib_cv_long_long_format=ll |
---|
205 | glib_cv_stack_grows=no |
---|
206 | === |
---|
207 | |
---|
208 | Then execute the following commands: |
---|
209 | |
---|
210 | === |
---|
211 | PATH=/path/to/mingw32-compiler/bin:$PATH |
---|
212 | chmod a-w win32.cache # prevent configure from changing it |
---|
213 | ./configure --cache-file=win32.cache --host=mingw32 |
---|
214 | === |
---|
215 | |
---|
216 | The complete list of cache file variables follows. Most |
---|
217 | of these won't need to be set in most cases. |
---|
218 | |
---|
219 | Cache file variables |
---|
220 | ==================== |
---|
221 | |
---|
222 | glib_cv_long_long_format=[ll/q/I64] |
---|
223 | |
---|
224 | Format used by printf and scanf for 64 bit integers. "ll" is |
---|
225 | the C99 standard, and what is used by the 'trio' library |
---|
226 | that GLib builds if your printf() is insufficiently capable. |
---|
227 | Doesn't need to be set if you are compiling using trio. |
---|
228 | |
---|
229 | glib_cv_stack_grows=[yes/no] |
---|
230 | |
---|
231 | Whether the stack grows up or down. Most places will want "no", |
---|
232 | A few architectures, such as PA-RISC need "yes". |
---|
233 | |
---|
234 | glib_cv_working_bcopy=[yes/no] |
---|
235 | |
---|
236 | Whether your bcopy can handle overlapping copies. Only needs to be set |
---|
237 | if you don't have memmove. (Very unlikely) |
---|
238 | |
---|
239 | glib_cv_sane_realloc=[yes/np] |
---|
240 | |
---|
241 | Whether your realloc() conforms to ANSI C and can handle NULL as |
---|
242 | the first argument. Defaults to "yes" and probably doesn't need to be set. |
---|
243 | |
---|
244 | glib_cv_have_strlcpy=[yes/no] |
---|
245 | |
---|
246 | Whether you have strlcpy that matches OpenBSD. Defaults to "no", |
---|
247 | which is safe, since GLib uses a built-in version in that case. |
---|
248 | |
---|
249 | glib_cv_va_val_copy=[yes/no] |
---|
250 | |
---|
251 | Whether va_list can be copied as a pointer. If set to "no", |
---|
252 | then memcopy will be used. Only matters if you don't have |
---|
253 | va_copy or __va_copy. (So, doesn't matter for GCC.) Defaults |
---|
254 | to "yes" which is slightly more common than "no". |
---|
255 | |
---|
256 | glib_cv_rtldglobal_broken=[yes/no] |
---|
257 | |
---|
258 | Whether you have a bug found in OSF/1 v5.0. Defaults to "no". |
---|
259 | |
---|
260 | glib_cv_uscore=[yes/no] |
---|
261 | |
---|
262 | Whether an underscore needs to be prepended to symbols when |
---|
263 | looking them up via dlsym. Only needs to be set if your system |
---|
264 | uses dlopen/dlsym. |
---|
265 | |
---|
266 | ac_cv_func_posix_getpwuid_r=[yes/no] |
---|
267 | |
---|
268 | Whether you have a getpwuid_r function (in your C library, |
---|
269 | not your thread library) that conforms to the POSIX spec. |
---|
270 | (Takes a 'struct passwd **' as the final argument) |
---|
271 | |
---|
272 | ac_cv_func_nonposix_getpwuid_r=[yes/no] |
---|
273 | |
---|
274 | Whether you have some variant of getpwuid_r that doesn't |
---|
275 | conform to to the POSIX spec, but GLib might be able to |
---|
276 | use (or might segfault.) Only needs to be set if |
---|
277 | ac_cv_func_posix_getpwuid_r is not set. It's safest to set |
---|
278 | this to "no". |
---|
279 | |
---|
280 | glib_cv_use_pid_surrogate=[yes/no] |
---|
281 | |
---|
282 | Whether to use a setpriority() on the PID of the thread as |
---|
283 | a method for setting the priority of threads. This only |
---|
284 | needs to be set when using POSIX threads. |
---|
285 | |
---|
286 | ac_cv_func_printf_unix98=[yes/no] |
---|
287 | |
---|
288 | Whether your printf() family supports Unix98 style %N$ |
---|
289 | positional parameters. Defaults to "no". |
---|
290 | |
---|
291 | ac_cv_func_vsnprintf_c99=[yes/no] |
---|
292 | |
---|
293 | Whether you have a vsnprintf() with C99 semantics. (C99 semantics |
---|
294 | means returns the number of bytes that would have been written |
---|
295 | had the output buffer had enough space.). Defaults to "no". |
---|