1 <refentry id="glib-cross-compiling" revision="8 Apr 2003">
3 <refentrytitle>Cross-compiling the GLib package</refentrytitle>
4 <manvolnum>3</manvolnum>
5 <refmiscinfo>GLib Library</refmiscinfo>
9 <refname>Cross-compiling the GLib Package</refname>
11 How to cross-compile GLib
16 <title>Building the Library for a different architecture</title>
18 Cross-compilation is the process of compiling a program or
19 library on a different architecture or operating system then
20 it will be run upon. GLib is slightly more difficult to
21 cross-compile than many packages because much of GLib is
22 about hiding differences between different systems.
25 These notes cover things specific to cross-compiling GLib;
26 for general information about cross-compilation, see the
27 <application>autoconf</application> info pages.
30 GLib tries to detect as much information as possible about
31 the target system by compiling and linking programs without
32 actually running anything; however, some information GLib
33 needs is not available this way. This information needs
34 to be provided to the configure script via a "cache file"
35 or by setting the cache variables in your environment.
38 As an example of using a cache file, to cross compile for
39 the "MingW32" Win32 runtine environment on a Linux system,
40 create a file 'win32.cache' with the following contents:
43 glib_cv_long_long_format=I64
44 glib_cv_stack_grows=no
47 Then execute the following commands:
50 PATH=/path/to/mingw32-compiler/bin:$PATH
51 chmod a-w win32.cache # prevent configure from changing it
52 ./configure --cache-file=win32.cache --host=mingw32
55 The complete list of cache file variables follows. Most
56 of these won't need to be set in most cases.
59 <refsect1 id="cache-file-variables">
60 <title>Cache file variables</title>
62 <title>glib_cv_long_long_format=[ll/q/I64]</title>
65 Format used by <function>printf()</function> and
66 <function>scanf()</function> for 64 bit integers. "ll" is
67 the C99 standard, and what is used by the 'trio' library
68 that GLib builds if your <function>printf()</function> is
69 insufficiently capable.
70 Doesn't need to be set if you are compiling using trio.
74 <title>glib_cv_stack_grows=[yes/no]</title>
77 Whether the stack grows up or down. Most places will want "no",
78 A few architectures, such as PA-RISC need "yes".
82 <title>glib_cv_working_bcopy=[yes/no]</title>
85 Whether your <function>bcopy()</function> can handle overlapping
86 copies. Only needs to be set if you don't have
87 <function>memmove()</function>. (Very unlikely)
91 <title>glib_cv_sane_realloc=[yes/np]</title>
94 Whether your <function>realloc()</function> conforms to ANSI C
95 and can handle <literal>NULL</literal> as the first argument.
96 Defaults to "yes" and probably doesn't need to be set.
100 <title>glib_cv_have_strlcpy=[yes/no]</title>
103 Whether you have <function>strlcpy()</function> that matches
104 OpenBSD. Defaults to "no", which is safe, since GLib uses a
105 built-in version in that case.
109 <title>glib_cv_va_val_copy=[yes/no]</title>
112 Whether <type>va_list</type> can be copied as a pointer. If set
113 to "no", then <function>memcopy()</function> will be used. Only
114 matters if you don't have <function>va_copy()</function> or
115 <function>__va_copy()</function>. (So, doesn't matter for GCC.)
116 Defaults to "yes" which is slightly more common than "no".
120 <title>glib_cv_rtldglobal_broken=[yes/no]</title>
123 Whether you have a bug found in OSF/1 v5.0. Defaults to "no".
127 <title>glib_cv_uscore=[yes/no]</title>
130 Whether an underscore needs to be prepended to symbols when
131 looking them up via <function>dlsym()</function>. Only needs to
132 be set if your system uses
133 <function>dlopen()</function>/<function>dlsym()</function>.
137 <title>ac_cv_func_posix_getpwuid_r=[yes/no]</title>
140 Whether you have a getpwuid_r function (in your C library,
141 not your thread library) that conforms to the POSIX spec.
142 (Takes a 'struct passwd **' as the final argument)
146 <title>ac_cv_func_nonposix_getpwuid_r=[yes/no]</title>
149 Whether you have some variant of <function>getpwuid_r()</function>
150 that doesn't conform to to the POSIX spec, but GLib might be able
151 to use (or might segfault.) Only needs to be set if
152 <literal>ac_cv_func_posix_getpwuid_r</literal> is not set. It's
153 safest to set this to "no".
157 <title>glib_cv_use_pid_surrogate=[yes/no]</title>
160 Whether to use a <function>setpriority()</function> on the PID of
161 the thread as a method for setting the priority of threads. This
162 only needs to be set when using POSIX threads.
166 <title>ac_cv_func_printf_unix98=[yes/no]</title>
169 Whether your <function>printf()</function> family supports Unix98
170 style <literal>%N$</literal> positional parameters. Defaults to
175 <title>ac_cv_func_vsnprintf_c99=[yes/no]</title>
178 Whether you have a <function>vsnprintf()</function> with C99
179 semantics. (C99 semantics means returning the number of bytes
180 that would have been written had the output buffer had enough
181 space.) Defaults to "no".