Tizen 2.1 base
[platform/upstream/glib2.0.git] / docs / reference / glib / cross.sgml
1 <?xml version="1.0"?>
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
3                "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
4 ]>
5 <refentry id="glib-cross-compiling" revision="8 Apr 2003">
6 <refmeta>
7 <refentrytitle>Cross-compiling the GLib package</refentrytitle>
8 <manvolnum>3</manvolnum>
9 <refmiscinfo>GLib Library</refmiscinfo>
10 </refmeta>
11
12 <refnamediv>
13 <refname>Cross-compiling the GLib Package</refname>
14 <refpurpose>
15 How to cross-compile GLib
16 </refpurpose>
17 </refnamediv>
18
19     <refsect1 id="cross">
20       <title>Building the Library for a different architecture</title>
21       <para>
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. 
27       </para>
28       <para>
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.
32       </para>
33       <para>
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.
40       </para>
41       <para>
42         As an example of using a cache file, to cross compile for
43         the "MingW32" Win32 runtine environment on a Linux system,
44         create a file 'win32.cache' with the following contents:
45       </para>
46       <programlisting> 
47 glib_cv_long_long_format=I64
48 glib_cv_stack_grows=no
49       </programlisting>
50       <para>
51         Then execute the following commands:
52       </para>
53       <programlisting>
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
57       </programlisting>
58       <para>
59         The complete list of cache file variables follows. Most
60          of these won't need to be set in most cases.
61       </para>
62     </refsect1>
63     <refsect1 id="cache-file-variables">
64       <title>Cache file variables</title>
65       <formalpara>
66         <title>glib_cv_long_long_format=[ll/q/I64]</title>
67         
68         <para>
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.
75         </para>
76       </formalpara>
77       <formalpara>
78         <title>glib_cv_stack_grows=[yes/no]</title>
79
80         <para>
81            Whether the stack grows up or down. Most places will want "no",
82            A few architectures, such as PA-RISC need "yes".
83         </para>
84       </formalpara>
85       <formalpara>
86         <title>glib_cv_working_bcopy=[yes/no]</title>
87
88         <para>
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)
92         </para>
93       </formalpara>
94       <formalpara>
95          <title>glib_cv_sane_realloc=[yes/np]</title>
96
97          <para>  
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.
101         </para>
102       </formalpara>
103       <formalpara>
104          <title>glib_cv_have_strlcpy=[yes/no]</title>
105
106          <para>
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.
110         </para>
111       </formalpara>
112       <formalpara>
113          <title>glib_cv_have_qsort_r=[yes/no]</title>
114
115          <para>
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.
119          </para>
120       </formalpara>
121       <formalpara>
122          <title>glib_cv_va_val_copy=[yes/no]</title>
123    
124          <para>
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".
130         </para>
131       </formalpara>
132       <formalpara>
133          <title>glib_cv_rtldglobal_broken=[yes/no]</title>
134  
135          <para>
136             Whether you have a bug found in OSF/1 v5.0. Defaults to "no".
137          </para>
138       </formalpara>
139       <formalpara>
140          <title>glib_cv_uscore=[yes/no]</title>
141
142          <para>
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>.
147          </para>
148       </formalpara>
149       <formalpara>
150          <title>ac_cv_func_posix_getpwuid_r=[yes/no]</title>
151
152          <para>
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)
156          </para>
157       </formalpara>
158       <formalpara>
159          <title>ac_cv_func_nonposix_getpwuid_r=[yes/no]</title>
160  
161          <para>
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".
167          </para>
168       </formalpara>
169       <formalpara>
170          <title>ac_cv_func_posix_getgrgid_r=[yes/no]</title>
171  
172          <para>
173             Whether you have a getgrgid_r function that conforms to
174             the POSIX spec.
175          </para>
176       </formalpara>
177       <formalpara>
178          <title>glib_cv_use_pid_surrogate=[yes/no]</title>
179
180          <para>
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.
184          </para>
185       </formalpara>
186       <formalpara>
187          <title>ac_cv_func_printf_unix98=[yes/no]</title>
188
189          <para>
190            Whether your <function>printf()</function> family supports Unix98 
191            style <literal>%N$</literal> positional parameters. Defaults to
192         "no".
193          </para>
194       </formalpara>
195       <formalpara>
196          <title>ac_cv_func_vsnprintf_c99=[yes/no]</title>
197
198          <para>
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".
203          </para>
204       </formalpara>
205
206     </refsect1>    
207
208 </refentry>