1<refentry id="glib-cross-compiling" revision="8 Apr 2003"> 2<refmeta> 3<refentrytitle>Cross-compiling the GLib package</refentrytitle> 4<manvolnum>3</manvolnum> 5<refmiscinfo>GLib Library</refmiscinfo> 6</refmeta> 7 8<refnamediv> 9<refname>Cross-compiling the GLib Package</refname> 10<refpurpose> 11How to cross-compile GLib 12</refpurpose> 13</refnamediv> 14 15 <refsect1 id="cross"> 16 <title>Building the Library for a different architecture</title> 17 <para> 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. 23 </para> 24 <para> 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. 28 </para> 29 <para> 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. 36 </para> 37 <para> 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: 41 </para> 42 <programlisting> 43glib_cv_long_long_format=I64 44glib_cv_stack_grows=no 45 </programlisting> 46 <para> 47 Then execute the following commands: 48 </para> 49 <programlisting> 50PATH=/path/to/mingw32-compiler/bin:$PATH 51chmod a-w win32.cache # prevent configure from changing it 52./configure --cache-file=win32.cache --host=mingw32 53 </programlisting> 54 <para> 55 The complete list of cache file variables follows. Most 56 of these won't need to be set in most cases. 57 </para> 58 </refsect1> 59 <refsect1 id="cache-file-variables"> 60 <title>Cache file variables</title> 61 <formalpara> 62 <title>glib_cv_long_long_format=[ll/q/I64]</title> 63 64 <para> 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. 71 </para> 72 </formalpara> 73 <formalpara> 74 <title>glib_cv_stack_grows=[yes/no]</title> 75 76 <para> 77 Whether the stack grows up or down. Most places will want "no", 78 A few architectures, such as PA-RISC need "yes". 79 </para> 80 </formalpara> 81 <formalpara> 82 <title>glib_cv_working_bcopy=[yes/no]</title> 83 84 <para> 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) 88 </para> 89 </formalpara> 90 <formalpara> 91 <title>glib_cv_sane_realloc=[yes/np]</title> 92 93 <para> 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. 97 </para> 98 </formalpara> 99 <formalpara> 100 <title>glib_cv_have_strlcpy=[yes/no]</title> 101 102 <para> 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. 106 </para> 107 </formalpara> 108 <formalpara> 109 <title>glib_cv_va_val_copy=[yes/no]</title> 110 111 <para> 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". 117 </para> 118 </formalpara> 119 <formalpara> 120 <title>glib_cv_rtldglobal_broken=[yes/no]</title> 121 122 <para> 123 Whether you have a bug found in OSF/1 v5.0. Defaults to "no". 124 </para> 125 </formalpara> 126 <formalpara> 127 <title>glib_cv_uscore=[yes/no]</title> 128 129 <para> 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>. 134 </para> 135 </formalpara> 136 <formalpara> 137 <title>ac_cv_func_posix_getpwuid_r=[yes/no]</title> 138 139 <para> 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) 143 </para> 144 </formalpara> 145 <formalpara> 146 <title>ac_cv_func_nonposix_getpwuid_r=[yes/no]</title> 147 148 <para> 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". 154 </para> 155 </formalpara> 156 <formalpara> 157 <title>ac_cv_func_posix_getgrgid_r=[yes/no]</title> 158 159 <para> 160 Whether you have a getgrgid_r function that conforms to 161 the POSIX spec. 162 </para> 163 </formalpara> 164 <formalpara> 165 <title>glib_cv_use_pid_surrogate=[yes/no]</title> 166 167 <para> 168 Whether to use a <function>setpriority()</function> on the PID of 169 the thread as a method for setting the priority of threads. This 170 only needs to be set when using POSIX threads. 171 </para> 172 </formalpara> 173 <formalpara> 174 <title>ac_cv_func_printf_unix98=[yes/no]</title> 175 176 <para> 177 Whether your <function>printf()</function> family supports Unix98 178 style <literal>%N$</literal> positional parameters. Defaults to 179 "no". 180 </para> 181 </formalpara> 182 <formalpara> 183 <title>ac_cv_func_vsnprintf_c99=[yes/no]</title> 184 185 <para> 186 Whether you have a <function>vsnprintf()</function> with C99 187 semantics. (C99 semantics means returning the number of bytes 188 that would have been written had the output buffer had enough 189 space.) Defaults to "no". 190 </para> 191 </formalpara> 192 193 </refsect1> 194 195</refentry> 196