2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
5 <refentry id="glib-cross-compiling" revision="8 Apr 2003">
7 <refentrytitle>Cross-compiling the GLib package</refentrytitle>
8 <manvolnum>3</manvolnum>
9 <refmiscinfo>GLib Library</refmiscinfo>
13 <refname>Cross-compiling the GLib Package</refname>
15 How to cross-compile GLib
20 <title>Building the Library for a different architecture</title>
22 Cross-compilation is the process of compiling a program or
23 library on a different architecture or operating system then
24 it will be run upon. GLib is slightly more difficult to
25 cross-compile than many packages because much of GLib is
26 about hiding differences between different systems.
29 These notes cover things specific to cross-compiling GLib;
30 for general information about cross-compilation, see the
31 <application>autoconf</application> info pages.
34 GLib tries to detect as much information as possible about
35 the target system by compiling and linking programs without
36 actually running anything; however, some information GLib
37 needs is not available this way. This information needs
38 to be provided to the configure script via a "cache file"
39 or by setting the cache variables in your environment.
42 As an example of using a cache file, to cross compile for
43 the "MingW32" Win32 runtime environment on a Linux system,
44 create a file 'win32.cache' with the following contents:
47 glib_cv_long_long_format=I64
48 glib_cv_stack_grows=no
51 Then execute the following commands:
54 PATH=/path/to/mingw32-compiler/bin:$PATH
55 chmod a-w win32.cache # prevent configure from changing it
56 ./configure --cache-file=win32.cache --host=mingw32
59 The complete list of cache file variables follows. Most
60 of these won't need to be set in most cases.
63 <refsect1 id="cache-file-variables">
64 <title>Cache file variables</title>
66 <title>glib_cv_long_long_format=[ll/q/I64]</title>
69 Format used by <function>printf()</function> and
70 <function>scanf()</function> for 64 bit integers. "ll" is
71 the C99 standard, and what is used by the 'trio' library
72 that GLib builds if your <function>printf()</function> is
73 insufficiently capable.
74 Doesn't need to be set if you are compiling using trio.
78 <title>glib_cv_stack_grows=[yes/no]</title>
81 Whether the stack grows up or down. Most places will want "no",
82 A few architectures, such as PA-RISC need "yes".
86 <title>glib_cv_working_bcopy=[yes/no]</title>
89 Whether your <function>bcopy()</function> can handle overlapping
90 copies. Only needs to be set if you don't have
91 <function>memmove()</function>. (Very unlikely)
95 <title>glib_cv_sane_realloc=[yes/no]</title>
98 Whether your <function>realloc()</function> conforms to ANSI C
99 and can handle <literal>NULL</literal> as the first argument.
100 Defaults to "yes" and probably doesn't need to be set.
104 <title>glib_cv_have_strlcpy=[yes/no]</title>
107 Whether you have <function>strlcpy()</function> that matches
108 OpenBSD. Defaults to "no", which is safe, since GLib uses a
109 built-in version in that case.
113 <title>glib_cv_have_qsort_r=[yes/no]</title>
116 Whether you have <function>qsort_r()</function> that matches
117 BSD. Defaults to "no", which is safe, since GLib uses a
118 built-in version in that case.
122 <title>glib_cv_va_val_copy=[yes/no]</title>
125 Whether <type>va_list</type> can be copied as a pointer. If set
126 to "no", then <function>memcopy()</function> will be used. Only
127 matters if you don't have <function>va_copy()</function> or
128 <function>__va_copy()</function>. (So, doesn't matter for GCC.)
129 Defaults to "yes" which is slightly more common than "no".
133 <title>glib_cv_rtldglobal_broken=[yes/no]</title>
136 Whether you have a bug found in OSF/1 v5.0. Defaults to "no".
140 <title>glib_cv_uscore=[yes/no]</title>
143 Whether an underscore needs to be prepended to symbols when
144 looking them up via <function>dlsym()</function>. Only needs to
145 be set if your system uses
146 <function>dlopen()</function>/<function>dlsym()</function>.
150 <title>ac_cv_func_posix_getpwuid_r=[yes/no]</title>
153 Whether you have a getpwuid_r function (in your C library,
154 not your thread library) that conforms to the POSIX spec.
155 (Takes a 'struct passwd **' as the final argument)
159 <title>ac_cv_func_nonposix_getpwuid_r=[yes/no]</title>
162 Whether you have some variant of <function>getpwuid_r()</function>
163 that doesn't conform to to the POSIX spec, but GLib might be able
164 to use (or might segfault.) Only needs to be set if
165 <literal>ac_cv_func_posix_getpwuid_r</literal> is not set. It's
166 safest to set this to "no".
170 <title>ac_cv_func_posix_getgrgid_r=[yes/no]</title>
173 Whether you have a getgrgid_r function that conforms to
178 <title>glib_cv_use_pid_surrogate=[yes/no]</title>
181 Whether to use a <function>setpriority()</function> on the PID of
182 the thread as a method for setting the priority of threads. This
183 only needs to be set when using POSIX threads.
187 <title>ac_cv_func_printf_unix98=[yes/no]</title>
190 Whether your <function>printf()</function> family supports Unix98
191 style <literal>%N$</literal> positional parameters. Defaults to
196 <title>ac_cv_func_vsnprintf_c99=[yes/no]</title>
199 Whether you have a <function>vsnprintf()</function> with C99
200 semantics. (C99 semantics means returning the number of bytes
201 that would have been written had the output buffer had enough
202 space.) Defaults to "no".