]>
Commit | Line | Data |
---|---|---|
76ed06b9 BC |
1 | # -*- autoconf -*- |
2 | ||
6a161fa9 | 3 | # Process this file with autoconf to produce a configure script. |
4 | ||
2f1a3acf | 5 | # Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc. |
6a161fa9 | 6 | # |
7 | # This configure.ac is free software; the author | |
8 | # gives unlimited permission to copy and/or distribute it, | |
9 | # with or without modifications, as long as this notice is preserved. | |
10 | # | |
11 | # This program is distributed in the hope that it will be useful, | |
12 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without | |
13 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A | |
14 | # PARTICULAR PURPOSE. | |
15 | ||
b977bf01 | 16 | dnl This configure script is complicated, because GRUB needs to deal |
17 | dnl with three potentially different types: | |
18 | dnl | |
19 | dnl build -- the environment for building GRUB | |
20 | dnl host -- the environment for running utilities | |
21 | dnl target -- the environment for running GRUB | |
22 | dnl | |
23 | dnl In addition, GRUB needs to deal with a platform specification | |
24 | dnl which specifies the system running GRUB, such as firmware. | |
25 | dnl This is necessary because the target type in autoconf does not | |
26 | dnl describe such a system very well. | |
27 | dnl | |
28 | dnl The current strategy is to use variables with no prefix (such as | |
29 | dnl CC, CFLAGS, etc.) for the host type as well as the build type, | |
30 | dnl because GRUB does not need to use those variables for the build | |
31 | dnl type, so there is no conflict. Variables with the prefix "TARGET_" | |
32 | dnl (such as TARGET_CC, TARGET_CFLAGS, etc.) are used for the target | |
33 | dnl type. | |
34 | ||
5f91f701 | 35 | AC_INIT([GRUB],[2.00],[bug-grub@gnu.org]) |
6a161fa9 | 36 | |
15c69261 YB |
37 | AC_CONFIG_AUX_DIR([build-aux]) |
38 | ||
76ed06b9 BC |
39 | # We don't want -g -O2 by default in CFLAGS |
40 | : ${CFLAGS=""} | |
6a161fa9 | 41 | |
b977bf01 | 42 | # Checks for host and target systems. |
6a161fa9 | 43 | AC_CANONICAL_HOST |
ee7fb780 | 44 | save_program_prefix="${program_prefix}" |
b977bf01 | 45 | AC_CANONICAL_TARGET |
ee7fb780 | 46 | program_prefix="${save_program_prefix}" |
6a161fa9 | 47 | |
6fe506b0 | 48 | AM_INIT_AUTOMAKE([1.10.1]) |
8c411768 | 49 | AC_PREREQ(2.60) |
6304d292 | 50 | AC_CONFIG_SRCDIR([include/grub/dl.h]) |
742f9232 | 51 | AC_CONFIG_HEADER([config-util.h]) |
e52db1f7 | 52 | |
1d543c3e | 53 | # Program name transformations |
54 | AC_ARG_PROGRAM | |
fd49ceb3 CW |
55 | grub_TRANSFORM([grub-bios-setup]) |
56 | grub_TRANSFORM([grub-editenv]) | |
57 | grub_TRANSFORM([grub-install]) | |
58 | grub_TRANSFORM([grub-mkconfig]) | |
59 | grub_TRANSFORM([grub-mkfont]) | |
60 | grub_TRANSFORM([grub-mkimage]) | |
67ab8353 | 61 | grub_TRANSFORM([grub-glue-efi]) |
fd49ceb3 CW |
62 | grub_TRANSFORM([grub-mklayout]) |
63 | grub_TRANSFORM([grub-mkpasswd-pbkdf2]) | |
64 | grub_TRANSFORM([grub-mkrelpath]) | |
65 | grub_TRANSFORM([grub-mkrescue]) | |
66 | grub_TRANSFORM([grub-probe]) | |
67 | grub_TRANSFORM([grub-reboot]) | |
68 | grub_TRANSFORM([grub-script-check]) | |
69 | grub_TRANSFORM([grub-set-default]) | |
fd49ceb3 | 70 | grub_TRANSFORM([grub-sparc64-setup]) |
a79b8a15 | 71 | grub_TRANSFORM([grub-render-label]) |
1d543c3e | 72 | |
90d1e879 RM |
73 | # Optimization flag. Allow user to override. |
74 | if test "x$TARGET_CFLAGS" = x; then | |
75 | TARGET_CFLAGS="$TARGET_CFLAGS -Os" | |
76 | fi | |
77 | ||
76ed06b9 BC |
78 | # Default HOST_CPPFLAGS |
79 | HOST_CPPFLAGS="$HOST_CPPFLAGS -Wall -W" | |
76ed06b9 | 80 | HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include" |
76ed06b9 | 81 | HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_UTIL=1" |
76ed06b9 BC |
82 | |
83 | TARGET_CPPFLAGS="$TARGET_CPPFLAGS -Wall -W" | |
84 | TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include" | |
85 | TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include" | |
86 | ||
b977bf01 | 87 | case "$target_cpu" in |
02164e1b | 88 | i[[3456]]86) target_cpu=i386 ;; |
c7ef54aa | 89 | amd64) target_cpu=x86_64 ;; |
02164e1b | 90 | sparc) target_cpu=sparc64 ;; |
ade85305 | 91 | mipsel|mips64el) |
4959e111 | 92 | target_cpu=mipsel; |
c721825b | 93 | machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPSEL=1"; |
4a1eefb6 | 94 | ;; |
ade85305 | 95 | mips|mips64) |
76ed06b9 | 96 | target_cpu=mips; |
c721825b | 97 | machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPS=1"; |
4a1eefb6 | 98 | ;; |
389b31cd LL |
99 | arm*) |
100 | target_cpu=arm; | |
101 | ;; | |
15a463d7 LL |
102 | aarch64*) |
103 | target_cpu=arm64; | |
104 | ;; | |
6a161fa9 | 105 | esac |
106 | ||
05568c2e | 107 | # Specify the platform (such as firmware). |
108 | AC_ARG_WITH([platform], | |
109 | AS_HELP_STRING([--with-platform=PLATFORM], | |
83b984de | 110 | [select the host platform [[guessed]]])) |
05568c2e | 111 | |
112 | # Guess the platform if not specified. | |
113 | if test "x$with_platform" = x; then | |
b977bf01 | 114 | case "$target_cpu"-"$target_vendor" in |
05568c2e | 115 | i386-apple) platform=efi ;; |
116 | i386-*) platform=pc ;; | |
58393a2d | 117 | x86_64-apple) platform=efi ;; |
737feb35 | 118 | x86_64-*) platform=pc ;; |
05568c2e | 119 | powerpc-*) platform=ieee1275 ;; |
58393a2d | 120 | powerpc64-*) platform=ieee1275 ;; |
05568c2e | 121 | sparc64-*) platform=ieee1275 ;; |
4959e111 VS |
122 | mipsel-*) platform=loongson ;; |
123 | mips-*) platform=arc ;; | |
e68d3b24 | 124 | ia64-*) platform=efi ;; |
389b31cd | 125 | arm-*) platform=uboot ;; |
15a463d7 | 126 | arm64-*) platform=efi ;; |
58393a2d | 127 | *) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;; |
05568c2e | 128 | esac |
129 | else | |
130 | platform="$with_platform" | |
131 | fi | |
132 | ||
ec1dfd63 VS |
133 | case "$target_cpu"-"$platform" in |
134 | x86_64-efi) ;; | |
135 | x86_64-emu) ;; | |
9612ebc0 | 136 | x86_64-xen) ;; |
ec1dfd63 VS |
137 | x86_64-*) target_cpu=i386 ;; |
138 | powerpc64-ieee1275) target_cpu=powerpc ;; | |
139 | esac | |
20011694 | 140 | |
58393a2d | 141 | # Check if the platform is supported, make final adjustments. |
b977bf01 | 142 | case "$target_cpu"-"$platform" in |
05568c2e | 143 | i386-efi) ;; |
3f4ce737 | 144 | x86_64-efi) ;; |
9612ebc0 VS |
145 | i386-xen) ;; |
146 | x86_64-xen) ;; | |
05568c2e | 147 | i386-pc) ;; |
7210dca9 | 148 | i386-multiboot) ;; |
546f966a | 149 | i386-coreboot) ;; |
58393a2d | 150 | i386-linuxbios) platform=coreboot ;; |
3d04eab8 | 151 | i386-ieee1275) ;; |
8231fb77 | 152 | i386-qemu) ;; |
05568c2e | 153 | powerpc-ieee1275) ;; |
154 | sparc64-ieee1275) ;; | |
2c40cc78 | 155 | ia64-efi) ;; |
f440c33f | 156 | mips-qemu_mips) ;; |
3666d5f6 | 157 | mips-qemu-mips) platform=qemu_mips;; |
8906c3dd | 158 | mips-arc) ;; |
7f63a64f | 159 | mipsel-arc) ;; |
4959e111 VS |
160 | mipsel-qemu_mips) ;; |
161 | mipsel-qemu-mips) platform=qemu_mips;; | |
162 | mipsel-yeeloong) platform=loongson ;; | |
163 | mipsel-fuloong) platform=loongson ;; | |
164 | mipsel-loongson) ;; | |
389b31cd LL |
165 | arm-uboot) ;; |
166 | arm-efi) ;; | |
15a463d7 | 167 | arm64-efi) ;; |
f84b481b | 168 | *-emu) ;; |
58393a2d | 169 | *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;; |
6a161fa9 | 170 | esac |
171 | ||
48145ea3 | 172 | if test x$platform != xemu ; then |
dd614590 VS |
173 | case "$target_cpu" in |
174 | i386 | powerpc) target_m32=1 ;; | |
175 | x86_64 | sparc64) target_m64=1 ;; | |
176 | esac | |
177 | fi | |
3f4ce737 | 178 | |
eaf01c25 VS |
179 | if test x"$target_cpu-$platform" = xsparc64-emu ; then |
180 | target_m64=1 ; | |
181 | fi | |
182 | ||
fc97214f | 183 | case "$target_os" in |
c3302aa5 | 184 | windows* | mingw32*) target_os=cygwin ;; |
fc97214f VS |
185 | esac |
186 | ||
9304eef1 | 187 | # This normalizes the names, and creates a new variable ("host_kernel") |
188 | # while at it, since the mapping is not always 1:1 (e.g. different OSes | |
189 | # using the same kernel type). | |
190 | case "$host_os" in | |
191 | gnu*) host_kernel=hurd ;; | |
192 | linux*) host_kernel=linux ;; | |
67937d4d | 193 | freebsd* | kfreebsd*-gnu) host_kernel=kfreebsd ;; |
2c7031b1 | 194 | netbsd*) host_kernel=netbsd ;; |
958ee221 | 195 | solaris*) host_kernel=illumos ;; |
b105df76 | 196 | darwin*) host_kernel=xnu ;; |
7e518ca8 | 197 | cygwin | windows* | mingw32*) host_kernel=windows ;; |
9304eef1 | 198 | esac |
199 | ||
cd46aa6c VS |
200 | case "$host_os" in |
201 | cygwin | windows* | mingw32*) have_exec=n ;; | |
202 | aros*) have_exec=n ;; | |
203 | *) have_exec=y;; | |
204 | esac | |
205 | ||
f84b481b | 206 | case "$platform" in |
c721825b BC |
207 | coreboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_COREBOOT=1" ;; |
208 | multiboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MULTIBOOT=1" ;; | |
209 | efi) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EFI=1" ;; | |
9612ebc0 | 210 | xen) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_XEN=1" ;; |
c721825b | 211 | ieee1275) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_IEEE1275=1" ;; |
389b31cd | 212 | uboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_UBOOT=1" ;; |
c721825b BC |
213 | qemu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_QEMU=1" ;; |
214 | pc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_PCBIOS=1" ;; | |
215 | emu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EMU=1" ;; | |
54da1feb | 216 | loongson) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_LOONGSON=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;; |
3666d5f6 VS |
217 | qemu_mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;; |
218 | arc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_ARC=1" ;; | |
f84b481b | 219 | esac |
6bea3f89 | 220 | case "$target_cpu" in |
389b31cd | 221 | arm) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_ARM=1" ;; |
15a463d7 | 222 | arm64) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_ARM64=1" ;; |
4959e111 | 223 | mips |mipsel) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS=1" ;; |
c721825b | 224 | sparc64) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_SPARC64=1" ;; |
6bea3f89 | 225 | esac |
4959e111 VS |
226 | if test x${target_cpu} = xmipsel ; then |
227 | machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo mips_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`" | |
228 | else | |
3ec0fc1c | 229 | machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,` -DGRUB_TARGET_CPU_`echo ${target_cpu} | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`=1" |
4959e111 | 230 | fi |
6bea3f89 | 231 | |
7f63a64f VS |
232 | case "${target_cpu}-$platform" in |
233 | mips-arc) | |
234 | TARGET_LINK_ADDR=0x88200000 | |
235 | TARGET_DECOMPRESSOR_LINK_ADDR=0x88100000 | |
236 | ;; | |
237 | mipsel-arc) | |
238 | TARGET_LINK_ADDR=0x80700000 | |
239 | TARGET_DECOMPRESSOR_LINK_ADDR=0x80600000 | |
240 | ;; | |
5fe67f39 | 241 | mips*-qemu_mips | mips*-loongson) |
7f63a64f VS |
242 | TARGET_DECOMPRESSOR_LINK_ADDR=0x80100000 |
243 | ;; | |
244 | esac | |
245 | ||
246 | AC_SUBST(TARGET_LINK_ADDR) | |
247 | AC_SUBST(TARGET_DECOMPRESSOR_LINK_ADDR) | |
248 | ||
c721825b | 249 | TARGET_CPPFLAGS="$TARGET_CPPFLAGS $machine_CPPFLAGS" |
f84b481b | 250 | |
56978920 | 251 | AC_SUBST(host_cpu) |
252 | AC_SUBST(host_os) | |
9304eef1 | 253 | AC_SUBST(host_kernel) |
6e5a42fe | 254 | |
071114bb VS |
255 | AC_SUBST(target_cpu) |
256 | AC_SUBST(platform) | |
257 | ||
d87aedff | 258 | # Define default variables |
7134247c VS |
259 | |
260 | have_with_bootdir=n | |
261 | AC_ARG_WITH([bootdir], | |
262 | AS_HELP_STRING([--with-bootdir=DIR], | |
263 | [set the name of /boot directory [[guessed]]]), | |
264 | [have_with_bootdir=y], | |
265 | [have_with_bootdir=n]) | |
266 | if test x$have_with_bootdir = xy; then | |
267 | bootdirname="$with_bootdir" | |
268 | else | |
269 | case "$host_os" in | |
270 | netbsd* | openbsd*) | |
d87aedff | 271 | # Because /boot is used for the boot block in NetBSD and OpenBSD, |
7134247c VS |
272 | bootdirname='' ;; |
273 | *) bootdirname='boot' ;; | |
274 | esac | |
275 | fi | |
276 | ||
d87aedff | 277 | AC_SUBST(bootdirname) |
a4c1d277 YB |
278 | AC_DEFINE_UNQUOTED(GRUB_BOOT_DIR_NAME, "$bootdirname", |
279 | [Default boot directory name]") | |
d87aedff | 280 | |
7134247c VS |
281 | AC_ARG_WITH([grubdir], |
282 | AS_HELP_STRING([--with-grubdir=DIR], | |
283 | [set the name of grub directory [[guessed]]]), | |
284 | [grubdirname="$with_grubdir"], | |
285 | [grubdirname="$PACKAGE"]) | |
286 | ||
d87aedff | 287 | AC_SUBST(grubdirname) |
a4c1d277 YB |
288 | AC_DEFINE_UNQUOTED(GRUB_DIR_NAME, "$grubdirname", |
289 | [Default grub directory name]) | |
d87aedff | 290 | |
b977bf01 | 291 | # |
292 | # Checks for build programs. | |
293 | # | |
144f1f98 | 294 | |
6c826348 | 295 | # Although cmp is listed in the GNU Coding Standards as a command which |
296 | # can used directly, OpenBSD lacks cmp in the default installation. | |
297 | AC_CHECK_PROGS([CMP], [cmp]) | |
298 | if test "x$CMP" = x; then | |
299 | AC_MSG_ERROR([cmp is not found]) | |
300 | fi | |
301 | ||
144f1f98 | 302 | AC_CHECK_PROGS([YACC], [bison]) |
1569ec51 | 303 | if test "x$YACC" = x; then |
6c826348 | 304 | AC_MSG_ERROR([bison is not found]) |
1569ec51 | 305 | fi |
306 | ||
76ed06b9 | 307 | AC_PROG_RANLIB |
b977bf01 | 308 | AC_PROG_INSTALL |
309 | AC_PROG_AWK | |
09220190 | 310 | AC_PROG_LEX |
76ed06b9 | 311 | AC_PROG_YACC |
b977bf01 | 312 | AC_PROG_MAKE_SET |
ff420223 | 313 | AC_PROG_MKDIR_P |
e1fd1939 | 314 | AC_PROG_LN_S |
b977bf01 | 315 | |
c7c75cf4 | 316 | if test "x$LEX" = "x:"; then |
09220190 BC |
317 | AC_MSG_ERROR([flex is not found]) |
318 | else | |
2663fb5f | 319 | version=`$LEX --version | $AWK '{ split($NF,x,"."); print x[[1]]*10000+x[[2]]*100+x[[3]]; }'` |
b777c18e | 320 | if test -n "$version" -a "$version" -ge 20535; then |
09220190 BC |
321 | : |
322 | else | |
323 | AC_MSG_ERROR([flex is too old. GRUB requires 2.5.35 or above]) | |
324 | fi | |
325 | fi | |
326 | ||
68807e5f | 327 | # These are not a "must". |
51fa856c | 328 | AC_PATH_PROGS(MAKEINFO, makeinfo true) |
6a161fa9 | 329 | |
b977bf01 | 330 | # |
331 | # Checks for host programs. | |
332 | # | |
333 | ||
334 | AC_PROG_CC | |
15c69261 | 335 | gl_EARLY |
1eed0e6e | 336 | AC_PROG_CXX |
76ed06b9 BC |
337 | AM_PROG_CC_C_O |
338 | AM_PROG_AS | |
339 | ||
6a161fa9 | 340 | # Must be GCC. |
341 | test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required]) | |
342 | ||
1eed0e6e VS |
343 | AC_CHECK_PROG(HAVE_CXX, $CXX, yes, no) |
344 | ||
4889bdec | 345 | AC_GNU_SOURCE |
2f1a3acf | 346 | AM_GNU_GETTEXT([external]) |
b977bf01 | 347 | AC_SYS_LARGEFILE |
348 | ||
349 | # Identify characteristics of the host architecture. | |
7b780018 VS |
350 | unset ac_cv_c_bigendian |
351 | ||
eaf01c25 VS |
352 | if test x"$target_cpu-$platform" = xsparc64-emu ; then |
353 | CFLAGS="$CFLAGS -m64" | |
354 | HOST_CFLAGS="$HOST_CFLAGS -m64" | |
355 | fi | |
356 | ||
b977bf01 | 357 | AC_C_BIGENDIAN |
358 | AC_CHECK_SIZEOF(void *) | |
359 | AC_CHECK_SIZEOF(long) | |
360 | ||
7e518ca8 VS |
361 | case "$host_os" in |
362 | cygwin | windows* | mingw32*) | |
363 | HOST_CPPFLAGS="$HOST_CPPFLAGS -DUNICODE=1 -D_WIN32_WINNT=0x0500" | |
364 | CPPFLAGS="$CPPFLAGS -DUNICODE=1 -D_WIN32_WINNT=0x0500" | |
365 | AC_CHECK_SIZEOF(TCHAR,,[#include <windows.h>]) | |
366 | ;; | |
367 | esac | |
368 | ||
aad32b14 VS |
369 | if test x$USE_NLS = xno; then |
370 | HOST_CFLAGS="$HOST_CFLAGS -fno-builtin-gettext" | |
371 | fi | |
372 | ||
86695375 | 373 | if test "x$cross_compiling" = xyes; then |
374 | AC_MSG_WARN([cannot generate manual pages while cross compiling]) | |
375 | else | |
376 | AC_PATH_PROG(HELP2MAN, help2man) | |
377 | fi | |
378 | ||
3169f4c7 | 379 | # Check for functions and headers. |
0f7e980b | 380 | AC_CHECK_FUNCS(posix_memalign memalign getextmntent) |
e4c498a1 | 381 | AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/mnttab.h sys/mkdev.h limits.h) |
7c4e16ff | 382 | |
fb90b546 RM |
383 | AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$ac_includes_default |
384 | #include <sys/param.h> | |
385 | #include <sys/mount.h>]) | |
386 | ||
387 | AC_CHECK_MEMBERS([struct statfs.f_mntfromname],,,[$ac_includes_default | |
388 | #include <sys/param.h> | |
389 | #include <sys/mount.h>]) | |
390 | ||
2c7031b1 GS |
391 | # For opendisk() and getrawpartition() on NetBSD. |
392 | # Used in util/deviceiter.c and in util/hostdisk.c. | |
393 | AC_CHECK_HEADER([util.h], [ | |
394 | AC_CHECK_LIB([util], [opendisk], [ | |
395 | LIBUTIL="-lutil" | |
396 | AC_DEFINE(HAVE_OPENDISK, 1, [Define if opendisk() in -lutil can be used]) | |
397 | ]) | |
398 | AC_CHECK_LIB([util], [getrawpartition], [ | |
399 | LIBUTIL="-lutil" | |
400 | AC_DEFINE(HAVE_GETRAWPARTITION, 1, [Define if getrawpartition() in -lutil can be used]) | |
401 | ]) | |
402 | ]) | |
403 | AC_SUBST([LIBUTIL]) | |
404 | ||
19ce697d | 405 | AC_CACHE_CHECK([whether -Wtrampolines work], [grub_cv_host_cc_wtrampolines], [ |
00c05e22 | 406 | SAVED_CFLAGS="$CFLAGS" |
b35ec299 | 407 | CFLAGS="$HOST_CFLAGS -Wtrampolines -Werror" |
00c05e22 VS |
408 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h> |
409 | int va_arg_func (int fixed, va_list args);]], [[]])], | |
19ce697d VS |
410 | [grub_cv_host_cc_wtrampolines=yes], |
411 | [grub_cv_host_cc_wtrampolines=no]) | |
00c05e22 VS |
412 | CFLAGS="$SAVED_CFLAGS" |
413 | ]) | |
414 | ||
19ce697d VS |
415 | if test x"$grub_host_cv_cc_wtrampolines" = xyes ; then |
416 | HOST_CFLAGS="$HOST_CFLAGS -Wtrampolines" | |
00c05e22 VS |
417 | fi |
418 | ||
76ed06b9 BC |
419 | # |
420 | # Check for host and build compilers. | |
421 | # | |
422 | HOST_CC=$CC | |
816719c8 VS |
423 | AC_CHECK_PROGS(BUILD_CC, [gcc egcs cc]) |
424 | test -z "$BUILD_CC" && AC_MSG_ERROR([none of gcc, egcs and cc is found. set BUILD_CC manually.]) | |
b224c266 | 425 | BUILD_CPP="$BUILD_CC -E" |
76ed06b9 | 426 | |
29013cba VS |
427 | case "$build_os" in |
428 | haiku*) BUILD_LIBM= ;; | |
429 | *) BUILD_LIBM=-lm ;; | |
430 | esac | |
15c69261 YB |
431 | # For gnulib. |
432 | gl_INIT | |
433 | ||
382b500e VS |
434 | WARN_FLAGS="-Wall -W -Wshadow -Wpointer-arith -Wundef -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wmain -Wmissing-braces -Wmissing-format-attribute -Wmultichar -Wparentheses -Wpointer-arith -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtrigraphs -Wundef -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wwrite-strings -Wnested-externs -Wstrict-prototypes" |
435 | EXTRA_WARN_FLAGS="-Wold-style-definition -Wextra -Wattributes -Wendif-labels -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmissing-field-initializers -Wnonnull -Woverflow -Wvla -Wpointer-to-int-cast -Wstrict-aliasing -Wvariadic-macros -Wvolatile-register-var -Wpointer-sign" | |
60d5e9cb VS |
436 | |
437 | HOST_CFLAGS="$HOST_CFLAGS $WARN_FLAGS -Wcast-align" | |
438 | ||
439 | AC_CACHE_CHECK([which extra warnings work], [grub_cv_cc_w_extra_flags], [ | |
440 | SAVED_CFLAGS="$CFLAGS" | |
441 | grub_cv_cc_w_extra_flags= | |
442 | for x in $EXTRA_WARN_FLAGS; do | |
443 | CFLAGS="$HOST_CFLAGS $x -Werror" | |
444 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [flag=1], [flag=0]) | |
445 | if test x$flag = x1 ; then | |
446 | grub_cv_cc_w_extra_flags="$grub_cv_cc_w_extra_flags $x" | |
447 | fi | |
448 | done | |
449 | CFLAGS="$SAVED_CFLAGS" | |
450 | ]) | |
451 | ||
452 | HOST_CFLAGS="$HOST_CFLAGS $grub_cv_cc_w_extra_flags" | |
453 | ||
b977bf01 | 454 | # |
455 | # Check for target programs. | |
456 | # | |
457 | ||
5b5d4aa5 | 458 | # Find tools for the target. |
459 | if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then | |
b977bf01 | 460 | tmp_ac_tool_prefix="$ac_tool_prefix" |
461 | ac_tool_prefix=$target_alias- | |
462 | ||
463 | AC_CHECK_TOOLS(TARGET_CC, [gcc egcs cc], | |
464 | [AC_MSG_ERROR([none of gcc, egcs and cc is found. set TARGET_CC manually.])]) | |
fc97214f VS |
465 | AC_CHECK_TOOL(TARGET_OBJCOPY, objcopy) |
466 | AC_CHECK_TOOL(TARGET_STRIP, strip) | |
467 | AC_CHECK_TOOL(TARGET_NM, nm) | |
0e8daad0 | 468 | AC_CHECK_TOOL(TARGET_RANLIB, ranlib) |
b977bf01 | 469 | |
470 | ac_tool_prefix="$tmp_ac_tool_prefix" | |
471 | else | |
472 | if test "x$TARGET_CC" = x; then | |
473 | TARGET_CC=$CC | |
474 | fi | |
fc97214f VS |
475 | AC_CHECK_TOOL(TARGET_OBJCOPY, objcopy) |
476 | AC_CHECK_TOOL(TARGET_STRIP, strip) | |
477 | AC_CHECK_TOOL(TARGET_NM, nm) | |
0e8daad0 | 478 | AC_CHECK_TOOL(TARGET_RANLIB, ranlib) |
b977bf01 | 479 | fi |
fc97214f | 480 | |
76ed06b9 BC |
481 | AC_SUBST(HOST_CC) |
482 | AC_SUBST(BUILD_CC) | |
7c9d0c39 VS |
483 | AC_SUBST(BUILD_CFLAGS) |
484 | AC_SUBST(BUILD_CPPFLAGS) | |
b977bf01 | 485 | AC_SUBST(TARGET_CC) |
fc97214f | 486 | AC_SUBST(TARGET_NM) |
1bd73025 | 487 | AC_SUBST(TARGET_RANLIB) |
fc97214f VS |
488 | AC_SUBST(TARGET_STRIP) |
489 | AC_SUBST(TARGET_OBJCOPY) | |
b977bf01 | 490 | |
b977bf01 | 491 | # Test the C compiler for the target environment. |
492 | tmp_CC="$CC" | |
493 | tmp_CFLAGS="$CFLAGS" | |
494 | tmp_LDFLAGS="$LDFLAGS" | |
495 | tmp_CPPFLAGS="$CPPFLAGS" | |
aa6d7826 | 496 | tmp_LIBS="$LIBS" |
b977bf01 | 497 | CC="$TARGET_CC" |
498 | CFLAGS="$TARGET_CFLAGS" | |
499 | CPPFLAGS="$TARGET_CPPFLAGS" | |
500 | LDFLAGS="$TARGET_LDFLAGS" | |
aa6d7826 | 501 | LIBS="" |
b977bf01 | 502 | |
90d1e879 | 503 | # debug flags. |
4e27343f | 504 | TARGET_CFLAGS="$TARGET_CFLAGS $WARN_FLAGS -g -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations" |
76ed06b9 | 505 | TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g" |
6a161fa9 | 506 | |
c12936c5 VS |
507 | if test "x$target_cpu" != xi386 && test "x$target_cpu" != xx86_64; then |
508 | TARGET_CFLAGS="$TARGET_CFLAGS -Wcast-align" | |
509 | fi | |
510 | ||
60d5e9cb VS |
511 | AC_CACHE_CHECK([which extra warnings work], [grub_cv_target_cc_w_extra_flags], [ |
512 | LDFLAGS="$TARGET_LDFLAGS -nostdlib -static" | |
513 | ||
514 | grub_cv_target_cc_w_extra_flags= | |
515 | for x in $EXTRA_WARN_FLAGS; do | |
516 | CFLAGS="$TARGET_CFLAGS $x -Werror" | |
37378f74 VS |
517 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
518 | asm (".globl start; start:"); | |
519 | void __main (void); | |
520 | void __main (void) {} | |
521 | int main (void); | |
522 | ]], [[]])], [flag=1], [flag=0]) | |
60d5e9cb VS |
523 | if test x$flag = x1 ; then |
524 | grub_cv_target_cc_w_extra_flags="$grub_cv_target_cc_w_extra_flags $x" | |
525 | fi | |
526 | done | |
527 | ]) | |
528 | ||
529 | TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_w_extra_flags" | |
530 | ||
60375a88 | 531 | AC_CACHE_CHECK([if compiling with clang], [grub_cv_cc_target_clang] |
b73b70eb VS |
532 | [ |
533 | CFLAGS="$TARGET_CFLAGS" | |
534 | AC_COMPILE_IFELSE( | |
60375a88 VS |
535 | [AC_LANG_PROGRAM([], [[ |
536 | #ifdef __clang__ | |
537 | #error "is clang" | |
538 | #endif | |
539 | ]])], | |
540 | [grub_cv_cc_target_clang=no], [grub_cv_cc_target_clang=yes])]) | |
541 | ||
2312f06c VS |
542 | # on x86 clang doesn't support .code16 |
543 | # on arm clang doesn't support .arch directive | |
63a45330 VS |
544 | # on mips clang doesn't support privilegied instructions, doubleword store/load |
545 | # and crashes with hand-written assembly | |
546 | if test "x$grub_cv_cc_target_clang" = xyes && ( test "x$target_cpu" = xi386 \ | |
547 | || test "x$target_cpu" = xx86_64 || test "x$target_cpu" = xarm \ | |
548 | || test "x$target_cpu" = xmips || test "x$target_cpu" = xmipsel ); then | |
60375a88 VS |
549 | TARGET_CCASFLAGS="$TARGET_CCASFLAGS -no-integrated-as" |
550 | fi | |
551 | ||
b73b70eb VS |
552 | if test "x$grub_cv_cc_target_clang" = xyes && test "x$target_cpu" = xpowerpc; then |
553 | AC_CACHE_CHECK([if clang can handle ame instruction], [grub_cv_cc_target_clang_ame] | |
554 | [ | |
555 | CFLAGS="$TARGET_CFLAGS" | |
556 | AC_COMPILE_IFELSE( | |
557 | [AC_LANG_PROGRAM([], [[ | |
558 | unsigned int a = 0, b = 0; | |
559 | asm volatile ("{ame|addme} %0,%1" : "=r" (a) : "r" (b)); | |
560 | if (a) | |
561 | return 1; | |
562 | ]])], | |
563 | [grub_cv_cc_target_clang_ame=yes], [grub_cv_cc_target_clang_ame=no])]) | |
564 | # clang <= 3.3 doesn't handle most of ppc assembly, not even inline assembly | |
565 | # used by gcrypt | |
566 | if test x$grub_cv_cc_target_clang_ame = xno ; then | |
567 | TARGET_CCASFLAGS="$TARGET_CCASFLAGS -no-integrated-as" | |
896f483d | 568 | TARGET_CFLAGS="$TARGET_CFLAGS -no-integrated-as" |
b73b70eb VS |
569 | fi |
570 | fi | |
571 | ||
60375a88 VS |
572 | if test "x$target_cpu" = xi386 && test "x$platform" != xemu; then |
573 | TARGET_CFLAGS="$TARGET_CFLAGS -march=i386" | |
574 | fi | |
575 | ||
576 | if test "x$target_m32" = x1; then | |
577 | # Force 32-bit mode. | |
578 | TARGET_CFLAGS="$TARGET_CFLAGS -m32" | |
579 | TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m32" | |
580 | TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m32" | |
581 | TARGET_LDFLAGS="$TARGET_LDFLAGS -m32" | |
582 | TARGET_MODULE_FORMAT="elf32" | |
583 | fi | |
584 | ||
585 | if test "x$target_m64" = x1; then | |
586 | # Force 64-bit mode. | |
587 | TARGET_CFLAGS="$TARGET_CFLAGS -m64" | |
588 | TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m64" | |
589 | TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m64" | |
590 | TARGET_LDFLAGS="$TARGET_LDFLAGS -m64" | |
591 | TARGET_MODULE_FORMAT="elf64" | |
592 | fi | |
593 | ||
594 | if test "x$grub_cv_cc_target_clang" = xno && test "x$target_cpu" = xi386 && test "x$platform" != xemu && test "x$platform" != xefi; then | |
595 | TARGET_CFLAGS="$TARGET_CFLAGS -mrtd -mregparm=3" | |
596 | fi | |
597 | ||
f93ddcfd VS |
598 | # on mips redirect cache flushing function to non-existant one. |
599 | if test "x$target_cpu" = xmips || test "x$target_cpu" = xmipsel ; then | |
600 | AC_CACHE_CHECK([whether -mflush-func=grub_red_herring works], [grub_cv_cc_mflush_func], [ | |
601 | CFLAGS="$TARGET_CFLAGS -mflush-func=grub_red_herring -Werror" | |
602 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], | |
603 | [grub_cv_cc_mflush_func=yes], | |
604 | [grub_cv_cc_mflush_func=no]) | |
605 | ]) | |
606 | ||
607 | if test "x$grub_cv_cc_mflush_func" = xyes; then | |
608 | TARGET_CFLAGS="$TARGET_CFLAGS -mflush-func=grub_red_herring" | |
609 | fi | |
610 | fi | |
611 | ||
612 | ||
90d1e879 RM |
613 | # Force no alignment to save space on i386. |
614 | if test "x$target_cpu" = xi386; then | |
615 | AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [ | |
b35ec299 | 616 | CFLAGS="$TARGET_CFLAGS -falign-loops=1 -Werror" |
eb73121d | 617 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], |
90d1e879 RM |
618 | [grub_cv_cc_falign_loop=yes], |
619 | [grub_cv_cc_falign_loop=no]) | |
6a161fa9 | 620 | ]) |
6a161fa9 | 621 | |
c966a489 | 622 | AC_CACHE_CHECK([whether -malign-loops works], [grub_cv_cc_malign_loop], [ |
b35ec299 | 623 | CFLAGS="$TARGET_CFLAGS -malign-loops=1 -Werror" |
c966a489 VS |
624 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], |
625 | [grub_cv_cc_malign_loop=yes], | |
626 | [grub_cv_cc_malign_loop=no]) | |
627 | ]) | |
628 | ||
90d1e879 RM |
629 | if test "x$grub_cv_cc_falign_loop" = xyes; then |
630 | TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1" | |
c966a489 | 631 | elif test "x$grub_cv_cc_malign_loop" = xyes; then |
90d1e879 | 632 | TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1" |
6a161fa9 | 633 | fi |
89e0240c | 634 | fi |
6a161fa9 | 635 | |
cdc17f60 VS |
636 | AC_CACHE_CHECK([whether -freg-struct-return works], [grub_cv_cc_freg_struct_return], [ |
637 | CFLAGS="$TARGET_CFLAGS -freg-struct-return -Werror" | |
638 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], | |
639 | [grub_cv_cc_freg_struct_return=yes], | |
640 | [grub_cv_cc_freg_struct_return=no]) | |
641 | ]) | |
642 | ||
643 | if test "x$grub_cv_cc_freg_struct_return" = xyes; then | |
644 | TARGET_CFLAGS="$TARGET_CFLAGS -freg-struct-return" | |
645 | fi | |
646 | ||
ee0220bc | 647 | if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$platform" != xemu; then |
90d1e879 RM |
648 | # Some toolchains enable these features by default, but they need |
649 | # registers that aren't set up properly in GRUB. | |
650 | TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow" | |
651 | fi | |
77c55a87 | 652 | |
90d1e879 RM |
653 | # By default, GCC 4.4 generates .eh_frame sections containing unwind |
654 | # information in some cases where it previously did not. GRUB doesn't need | |
655 | # these and they just use up vital space. Restore the old compiler | |
656 | # behaviour. | |
657 | AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [ | |
24f4e57c | 658 | CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm" |
90d1e879 RM |
659 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], |
660 | [grub_cv_cc_fno_dwarf2_cfi_asm=yes], | |
661 | [grub_cv_cc_fno_dwarf2_cfi_asm=no]) | |
90d1e879 | 662 | ]) |
77c55a87 | 663 | |
90d1e879 RM |
664 | if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then |
665 | TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm" | |
b977bf01 | 666 | fi |
6a161fa9 | 667 | |
1c1f31e5 VS |
668 | if test x"$target_os" = xcygwin; then |
669 | AC_CACHE_CHECK([whether option -fno-reorder-functions works], grub_cv_cc_no_reorder_functions, [ | |
24f4e57c | 670 | CFLAGS="$TARGET_CFLAGS -fno-reorder-functions" |
1c1f31e5 VS |
671 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], |
672 | [grub_cv_cc_no_reorder_functions=yes], | |
673 | [grub_cv_cc_no_reorder_functions=no]) | |
674 | ]) | |
675 | fi | |
676 | ||
677 | if test x"$target_os" = xcygwin && test "x$grub_cv_cc_no_reorder_functions" = xyes; then | |
678 | TARGET_CFLAGS="$TARGET_CFLAGS -fno-reorder-functions" | |
679 | fi | |
680 | ||
e9d3421c VS |
681 | # By default, GCC 4.6 generates .eh_frame sections containing unwind |
682 | # information in some cases where it previously did not. GRUB doesn't need | |
683 | # these and they just use up vital space. Restore the old compiler | |
684 | # behaviour. | |
685 | AC_CACHE_CHECK([whether -fno-asynchronous-unwind-tables works], [grub_cv_cc_fno_asynchronous_unwind_tables], [ | |
24f4e57c | 686 | CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm" |
e9d3421c VS |
687 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], |
688 | [grub_cv_cc_fno_asynchronous_unwind_tables=yes], | |
689 | [grub_cv_cc_fno_asynchronous_unwind_tables=no]) | |
e9d3421c VS |
690 | ]) |
691 | ||
692 | if test "x$grub_cv_cc_fno_asynchronous_unwind_tables" = xyes; then | |
693 | TARGET_CFLAGS="$TARGET_CFLAGS -fno-asynchronous-unwind-tables" | |
694 | fi | |
695 | ||
30c7d3ce VS |
696 | AC_ARG_ENABLE([efiemu], |
697 | [AS_HELP_STRING([--enable-efiemu], | |
698 | [build and install the efiemu runtimes (default=guessed)])]) | |
699 | if test x"$enable_efiemu" = xno ; then | |
700 | efiemu_excuse="explicitly disabled" | |
701 | fi | |
6f1f6a0c | 702 | if test x"$grub_cv_target_cc_link_format" = x-mi386pe || test x"$grub_cv_target_cc_link_format" = x-mi386pep ; then |
1c1f31e5 VS |
703 | efiemu_excuse="not available on cygwin" |
704 | fi | |
30c7d3ce VS |
705 | if test x"$target_cpu" != xi386 ; then |
706 | efiemu_excuse="only available on i386" | |
707 | fi | |
708 | if test x"$platform" = xefi ; then | |
709 | efiemu_excuse="not available on efi" | |
710 | fi | |
711 | if test x"$efiemu_excuse" = x ; then | |
712 | AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [ | |
3c2304d5 | 713 | CFLAGS="-m64 -nostdlib -O2 -mcmodel=large -mno-red-zone" |
30c7d3ce VS |
714 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], |
715 | [grub_cv_cc_efiemu=yes], | |
716 | [grub_cv_cc_efiemu=no]) | |
717 | ]) | |
718 | if test x$grub_cv_cc_efiemu = xno; then | |
719 | efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib" | |
720 | fi | |
721 | fi | |
c2b70d09 AB |
722 | if test x"$efiemu_excuse" = x ; then |
723 | AC_CACHE_CHECK([for efiemu64 linking format], [grub_cv_target_cc_efiemu64_link_format], [ | |
724 | grub_cv_target_cc_efiemu64_link_format=unknown | |
725 | for format in -melf_x86_64 -melf_x86_64_fbsd -melf_x86_64_obsd -melf_x86_64_haiku -arch,x86_64; do | |
726 | CFLAGS="-m64 -nostdlib -O2 -mcmodel=large -mno-red-zone" | |
727 | LDFLAGS="-m64 -Wl,$format -nostdlib -static" | |
728 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ | |
729 | asm (".globl start; start:"); | |
730 | asm (".globl _start; _start:"); | |
731 | asm (".globl __start; __start:"); | |
732 | void __main (void); | |
733 | void __main (void) {} | |
734 | ]], [[]])], [flag=1], [flag=0]) | |
735 | if test x"$flag" = x1; then | |
736 | grub_cv_target_cc_efiemu64_link_format="$format" | |
737 | break; | |
738 | fi | |
739 | done]) | |
740 | if test x"$grub_cv_target_cc_efiemu64_link_format" = xunknown; then | |
741 | efiemu_excuse="no suitable link format for efiemu64 found" | |
742 | else | |
743 | EFIEMU64_LINK_FORMAT="-Wl,$grub_cv_target_cc_efiemu64_link_format" | |
744 | fi | |
745 | fi | |
30c7d3ce VS |
746 | if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then |
747 | AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled]) | |
748 | fi | |
749 | if test x"$efiemu_excuse" = x ; then | |
750 | enable_efiemu=yes | |
751 | else | |
752 | enable_efiemu=no | |
753 | fi | |
754 | AC_SUBST([enable_efiemu]) | |
c2b70d09 | 755 | AC_SUBST([EFIEMU64_LINK_FORMAT]) |
30c7d3ce | 756 | |
a9f25a08 VS |
757 | CFLAGS="$TARGET_CFLAGS" |
758 | ||
759 | if test x"$target_cpu" = xi386 || test x"$target_cpu" = xx86_64; then | |
c2b70d09 | 760 | AC_CACHE_CHECK([for target linking format], [grub_cv_target_cc_link_format], [ |
a9f25a08 | 761 | grub_cv_target_cc_link_format=unknown |
6f1f6a0c VS |
762 | for format in -melf_${target_cpu} -melf_${target_cpu}_fbsd -melf_${target_cpu}_obsd -melf_${target_cpu}_haiku -mi386pe -mi386pep -arch,${target_cpu}; do |
763 | if test x${target_cpu} != xi386 && test x$format = xi386pe; then | |
764 | continue | |
765 | fi | |
766 | if test x${target_cpu} != xx86_64 && test x$format = xi386pep; then | |
a9f25a08 VS |
767 | continue |
768 | fi | |
246a434f VS |
769 | CFLAGS="$TARGET_CFLAGS" |
770 | LDFLAGS="$TARGET_LDFLAGS -Wl,$format -nostdlib -static" | |
a9f25a08 VS |
771 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
772 | asm (".globl start; start:"); | |
773 | asm (".globl _start; _start:"); | |
774 | asm (".globl __start; __start:"); | |
775 | void __main (void); | |
776 | void __main (void) {} | |
c2b70d09 | 777 | ]], [[]])], [flag=1], [flag=0]) |
a9f25a08 VS |
778 | if test x"$flag" = x1; then |
779 | grub_cv_target_cc_link_format="$format" | |
780 | break; | |
781 | fi | |
782 | done]) | |
783 | if test x"$grub_cv_target_cc_link_format" = xunknown; then | |
784 | AC_MSG_ERROR([no suitable link format found]) | |
785 | fi | |
786 | TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format" | |
6f1f6a0c | 787 | if test x"$grub_cv_target_cc_link_format" = x-mi386pe ; then |
a9f25a08 VS |
788 | TARGET_OBJ2ELF='./build-grub-pe2elf'; |
789 | fi | |
6f1f6a0c VS |
790 | if test x"$grub_cv_target_cc_link_format" = x-mi386pep ; then |
791 | TARGET_OBJ2ELF='./build-grub-pep2elf'; | |
792 | fi | |
a9f25a08 VS |
793 | fi |
794 | ||
795 | if test x$grub_cv_target_cc_link_format = x-arch,i386 || test x$grub_cv_target_cc_link_format = x-arch,x86_64; then | |
796 | TARGET_APPLE_LINKER=1 | |
797 | AC_CHECK_PROG([TARGET_OBJCONV], [objconv], [objconv], []) | |
798 | if test "x$TARGET_OBJCONV" = x ; then | |
799 | AC_CHECK_PROG([TARGET_OBJCONV], [objconv], [./objconv], [], [.]) | |
800 | fi | |
801 | if test "x$TARGET_OBJCONV" = x ; then | |
802 | AC_MSG_ERROR([objconv not found which is required when building with apple compiler]) | |
803 | fi | |
804 | TARGET_IMG_LDSCRIPT= | |
805 | TARGET_IMG_CFLAGS="-static" | |
806 | TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20' | |
807 | TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20' | |
808 | TARGET_IMG_BASE_LDOPT="-Wl,-image_base" | |
809 | TARGET_LDFLAGS_OLDMAGIC="" | |
6f1f6a0c | 810 | elif test x$grub_cv_target_cc_link_format = x-mi386pe || test x$grub_cv_target_cc_link_format = x-mi386pep ; then |
a9f25a08 VS |
811 | TARGET_APPLE_LINKER=0 |
812 | TARGET_LDFLAGS_OLDMAGIC="-Wl,-N" | |
60b967be | 813 | TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/${grub_coredir}/conf/i386-cygwin-img-ld.sc" |
a9f25a08 | 814 | TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT}" |
60b967be | 815 | TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/${grub_coredir}/conf/i386-cygwin-img-ld.sc" |
a9f25a08 VS |
816 | TARGET_IMG_BASE_LDOPT="-Wl,-Ttext" |
817 | TARGET_IMG_CFLAGS= | |
818 | else | |
819 | TARGET_APPLE_LINKER=0 | |
820 | TARGET_LDFLAGS_OLDMAGIC="-Wl,-N" | |
821 | TARGET_IMG_LDSCRIPT= | |
822 | TARGET_IMG_LDFLAGS='-Wl,-N' | |
823 | TARGET_IMG_LDFLAGS_AC='-Wl,-N' | |
824 | TARGET_IMG_BASE_LDOPT="-Wl,-Ttext" | |
825 | TARGET_IMG_CFLAGS= | |
826 | fi | |
827 | ||
828 | AC_SUBST(TARGET_LDFLAGS_OLDMAGIC) | |
829 | ||
830 | ||
831 | LDFLAGS="$TARGET_LDFLAGS" | |
8f0baaac | 832 | |
eaf01c25 | 833 | if test "$target_cpu" = x86_64 || test "$target_cpu-$platform" = sparc64-emu ; then |
7e9ca17a | 834 | # Use large model to support 4G memory |
6e09b8b7 | 835 | AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [ |
24f4e57c | 836 | CFLAGS="$TARGET_CFLAGS -m64 -mcmodel=large" |
6e09b8b7 | 837 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], |
838 | [grub_cv_cc_mcmodel=yes], | |
839 | [grub_cv_cc_mcmodel=no]) | |
840 | ]) | |
a3ba7410 | 841 | if test "x$grub_cv_cc_mcmodel" = xyes; then |
c8600122 | 842 | TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large" |
eaf01c25 VS |
843 | elif test "$target_cpu-$platform" = sparc64-emu; then |
844 | TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=medany" | |
6e09b8b7 | 845 | fi |
46546fc5 | 846 | fi |
7e9ca17a | 847 | |
46546fc5 | 848 | if test "$target_cpu"-"$platform" = x86_64-efi; then |
7e9ca17a | 849 | # EFI writes to stack below %rsp, we must not use the red zone |
850 | AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [ | |
24f4e57c | 851 | CFLAGS="$TARGET_CFLAGS -m64 -mno-red-zone" |
7e9ca17a | 852 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], |
853 | [grub_cv_cc_no_red_zone=yes], | |
854 | [grub_cv_cc_no_red_zone=no]) | |
855 | ]) | |
856 | if test "x$grub_cv_cc_no_red_zone" = xno; then | |
857 | AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc]) | |
858 | fi | |
859 | ||
c8600122 | 860 | TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone" |
20011694 | 861 | fi |
862 | ||
41822625 VS |
863 | if test "x$target_cpu" = xarm; then |
864 | AC_CACHE_CHECK([whether option -mlong-calls works], grub_cv_cc_mlong_calls, [ | |
865 | CFLAGS="$TARGET_CFLAGS -mlong-calls -Werror" | |
866 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], | |
867 | [grub_cv_cc_mlong_calls=yes], | |
868 | [grub_cv_cc_mlong_calls=no]) | |
869 | ]) | |
870 | if test "x$grub_cv_cc_mlong_calls" = xyes; then | |
871 | TARGET_CFLAGS="$TARGET_CFLAGS -mlong-calls" | |
872 | fi | |
873 | fi | |
874 | ||
baa2a121 | 875 | # |
876 | # Compiler features. | |
877 | # | |
878 | ||
28668d80 VS |
879 | CFLAGS="$TARGET_CFLAGS" |
880 | ||
93a81088 | 881 | # Position independent executable. |
882 | grub_CHECK_PIE | |
883 | [# Need that, because some distributions ship compilers that include | |
884 | # `-fPIE' in the default specs. | |
885 | if [ x"$pie_possible" = xyes ]; then | |
886 | TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE" | |
887 | fi] | |
888 | ||
28668d80 VS |
889 | CFLAGS="$TARGET_CFLAGS" |
890 | ||
7bd8b0c7 VS |
891 | # Position independent executable. |
892 | grub_CHECK_PIC | |
9cf12b20 VS |
893 | [# On most platforms we don't want PIC as it only makes relocations harder |
894 | # and code less efficient. On mips we want to have one got table per module | |
895 | # and reload $gp in every function. | |
896 | # GCC implements it using symbol __gnu_local_gp in non-PIC as well. | |
897 | # However with clang we need PIC for this reloading to happen. | |
898 | # Since default varies across dictributions use either -fPIC or -fno-PIC | |
899 | # explicitly. | |
900 | if ( test x$target_cpu = xmips || test x$target_cpu = xmipsel ) && test "x$grub_cv_cc_target_clang" = xyes ; then | |
901 | TARGET_CFLAGS="$TARGET_CFLAGS -fPIC" | |
902 | elif [ x"$pic_possible" = xyes ]; then | |
903 | TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIC" | |
7bd8b0c7 VS |
904 | fi] |
905 | ||
28668d80 VS |
906 | CFLAGS="$TARGET_CFLAGS" |
907 | ||
baa2a121 | 908 | # Smashing stack protector. |
909 | grub_CHECK_STACK_PROTECTOR | |
c3db8364 | 910 | # Need that, because some distributions ship compilers that include |
baa2a121 | 911 | # `-fstack-protector' in the default specs. |
c3db8364 | 912 | if test "x$ssp_possible" = xyes; then |
913 | TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector" | |
914 | fi | |
28668d80 VS |
915 | |
916 | CFLAGS="$TARGET_CFLAGS" | |
917 | ||
2a8a80e4 | 918 | grub_CHECK_STACK_ARG_PROBE |
919 | # Cygwin's GCC uses alloca() to probe the stackframe on static | |
920 | # stack allocations above some threshold. | |
921 | if test x"$sap_possible" = xyes; then | |
922 | TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe" | |
923 | fi | |
baa2a121 | 924 | |
28668d80 VS |
925 | CFLAGS="$TARGET_CFLAGS" |
926 | ||
d74b9a1d | 927 | # -mno-unaligned-access -mstrict-align |
bb9f92b9 | 928 | if test "$target_cpu" = arm; then |
d74b9a1d | 929 | AC_CACHE_CHECK([for compile options to get strict alignment], [grub_cv_target_cc_strict_align], [ |
bdb6090d | 930 | grub_cv_target_cc_strict_align= |
d74b9a1d VS |
931 | for arg in -mno-unaligned-access "-Xclang -mstrict-align" -mstrict-align; do |
932 | CFLAGS="$TARGET_CFLAGS $arg -Werror" | |
933 | LDFLAGS="$TARGET_LDFLAGS" | |
934 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [flag=1], [flag=0]) | |
935 | if test x"$flag" = x1; then | |
936 | grub_cv_target_cc_strict_align="$arg" | |
937 | break; | |
938 | fi | |
939 | done]) | |
940 | ||
d74b9a1d VS |
941 | TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_strict_align" |
942 | if test x"$grub_cv_target_cc_strict_align" = x"-Xclang -mstrict-align"; then | |
943 | TARGET_LDFLAGS="$TARGET_LDFLAGS -Qunused-arguments" | |
bb9f92b9 | 944 | fi |
bdb6090d VS |
945 | AC_CACHE_CHECK([if compiler generates unaligned accesses], [grub_cv_cc_target_emits_unaligned], |
946 | [CFLAGS="$TARGET_CFLAGS" | |
947 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[ | |
948 | #ifdef __ARM_FEATURE_UNALIGNED | |
949 | #error "unaligned" | |
950 | #endif | |
951 | ]])], | |
952 | [grub_cv_cc_target_emits_unaligned=no], [grub_cv_cc_target_emits_unaligned=yes])]) | |
953 | if test x$grub_cv_cc_target_emits_unaligned = xyes; then | |
954 | AC_MSG_ERROR([compiler generates unaligned accesses]) | |
955 | fi | |
bb9f92b9 LL |
956 | fi |
957 | ||
aa6d7826 | 958 | # Set them to their new values for the tests below. |
959 | CC="$TARGET_CC" | |
a9f25a08 | 960 | if test "x$TARGET_APPLE_LINKER" = x1 ; then |
246a434f | 961 | CFLAGS="$TARGET_CFLAGS -nostdlib -static -Wno-error" |
26de2bcd | 962 | else |
37378f74 | 963 | CFLAGS="$TARGET_CFLAGS -nostdlib -Wno-error" |
26de2bcd | 964 | fi |
aa6d7826 | 965 | CPPFLAGS="$TARGET_CPPFLAGS" |
d5524ca8 VS |
966 | if test x$target_cpu = xi386 || test x$target_cpu = xx86_64 || test "x$grub_cv_cc_target_clang" = xyes ; then |
967 | TARGET_LIBGCC= | |
03f80960 | 968 | else |
d5524ca8 | 969 | TARGET_LIBGCC=-lgcc |
03f80960 | 970 | fi |
69be5b74 | 971 | |
d5524ca8 VS |
972 | LIBS="$TARGET_LIBGCC" |
973 | ||
01fcf061 | 974 | grub_ASM_USCORE |
a9f25a08 | 975 | if test "x$TARGET_APPLE_LINKER" = x0 ; then |
01fcf061 | 976 | if test x$grub_cv_asm_uscore = xyes; then |
37378f74 | 977 | DEFSYM="-Wl,--defsym,_abort=_main -Wl,--defsym,__main=_main" |
01fcf061 | 978 | else |
37378f74 | 979 | DEFSYM="-Wl,--defsym,abort=main -Wl,--defsym,_main=main -Wl,--defsym,__main=main" |
01fcf061 | 980 | fi |
37378f74 | 981 | CFLAGS="$TARGET_CFLAGS -nostdlib $DEFSYM" |
a9f25a08 | 982 | fi |
01fcf061 | 983 | |
69be5b74 | 984 | # Check for libgcc symbols |
6fcec439 | 985 | AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __ucmpdi2 _restgpr_14_x) |
69be5b74 | 986 | |
a9f25a08 | 987 | if test "x$TARGET_APPLE_LINKER" = x1 ; then |
246a434f | 988 | CFLAGS="$TARGET_CFLAGS -nostdlib -static" |
69be5b74 | 989 | else |
37378f74 | 990 | CFLAGS="$TARGET_CFLAGS -nostdlib" |
69be5b74 | 991 | fi |
42e0cba3 | 992 | LIBS="" |
aa6d7826 | 993 | |
6a161fa9 | 994 | # Defined in aclocal.m4. |
f6130a12 | 995 | grub_PROG_TARGET_CC |
a9f25a08 | 996 | if test "x$TARGET_APPLE_LINKER" != x1 ; then |
b977bf01 | 997 | grub_PROG_OBJCOPY_ABSOLUTE |
2b167a72 | 998 | fi |
cb71ba20 | 999 | grub_PROG_LD_BUILD_ID_NONE |
b977bf01 | 1000 | if test "x$target_cpu" = xi386; then |
a9f25a08 | 1001 | if test "$platform" != emu && test "x$TARGET_APPLE_LINKER" != x1 ; then |
2aec1692 CF |
1002 | if test ! -z "$TARGET_IMG_LDSCRIPT"; then |
1003 | # Check symbols provided by linker script. | |
37378f74 | 1004 | CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC} ${TARGET_IMG_BASE_LDOPT},0x8000" |
2aec1692 | 1005 | fi |
2a8a80e4 | 1006 | grub_CHECK_BSS_START_SYMBOL |
1007 | grub_CHECK_END_SYMBOL | |
1008 | fi | |
1009 | CFLAGS="$TARGET_CFLAGS" | |
4b13b216 | 1010 | grub_I386_ASM_PREFIX_REQUIREMENT |
1011 | grub_I386_ASM_ADDR32 | |
6a161fa9 | 1012 | fi |
1013 | ||
20aea949 VS |
1014 | grub_PROG_NM_WORKS |
1015 | grub_PROG_NM_MINUS_P | |
1016 | grub_PROG_NM_DEFINED_ONLY | |
1017 | AC_SUBST(TARGET_NMFLAGS_MINUS_P) | |
1018 | AC_SUBST(TARGET_NMFLAGS_DEFINED_ONLY) | |
1019 | ||
016a671b | 1020 | if test "$platform" != emu; then |
8f9a632b VS |
1021 | AC_CACHE_CHECK([whether -nostdinc -isystem works], [grub_cv_cc_isystem], [ |
1022 | SAVED_CPPFLAGS="$CPPFLAGS" | |
1023 | CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`" | |
1024 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h> | |
ce938140 | 1025 | #include <stddef.h> |
8f9a632b VS |
1026 | int va_arg_func (int fixed, va_list args);]], [[]])], |
1027 | [grub_cv_cc_isystem=yes], | |
1028 | [grub_cv_cc_isystem=no]) | |
1029 | CPPFLAGS="$SAVED_CPPFLAGS" | |
1030 | ]) | |
1031 | ||
1032 | if test x"$grub_cv_cc_isystem" = xyes ; then | |
1033 | TARGET_CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`" | |
1034 | fi | |
dae79b6b | 1035 | fi |
5ce5507f | 1036 | |
19ce697d | 1037 | AC_CACHE_CHECK([whether -Wtrampolines work], [grub_cv_cc_wtrampolines], [ |
24f4e57c | 1038 | CFLAGS="$TARGET_CFLAGS -Wtrampolines -Werror" |
779dc15b VS |
1039 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h> |
1040 | int va_arg_func (int fixed, va_list args);]], [[]])], | |
19ce697d VS |
1041 | [grub_cv_cc_wtrampolines=yes], |
1042 | [grub_cv_cc_wtrampolines=no]) | |
779dc15b VS |
1043 | ]) |
1044 | ||
19ce697d VS |
1045 | if test x"$grub_cv_cc_wtrampolines" = xyes ; then |
1046 | TARGET_CFLAGS="$TARGET_CFLAGS -Wtrampolines" | |
779dc15b VS |
1047 | fi |
1048 | ||
c9a86192 | 1049 | # Restore the flags. |
9962ed99 | 1050 | CC="$tmp_CC" |
1051 | CFLAGS="$tmp_CFLAGS" | |
1052 | CPPFLAGS="$tmp_CPPFLAGS" | |
c9a86192 | 1053 | LDFLAGS="$tmp_LDFLAGS" |
aa6d7826 | 1054 | LIBS="$tmp_LIBS" |
6a161fa9 | 1055 | |
4fe9862e | 1056 | # |
2965c7cc | 1057 | # Check for options. |
4fe9862e | 1058 | # |
1059 | ||
1060 | # Memory manager debugging. | |
b39f9d20 | 1061 | AC_ARG_ENABLE([mm-debug], |
2965c7cc | 1062 | AS_HELP_STRING([--enable-mm-debug], |
90ce5d56 | 1063 | [include memory manager debugging]), |
2965c7cc | 1064 | [AC_DEFINE([MM_DEBUG], [1], |
1065 | [Define to 1 if you enable memory manager debugging.])]) | |
1066 | ||
c5dc1690 SJ |
1067 | AC_ARG_ENABLE([cache-stats], |
1068 | AS_HELP_STRING([--enable-cache-stats], | |
055e2b8b | 1069 | [enable disk cache statistics collection])) |
c5dc1690 SJ |
1070 | |
1071 | if test x$enable_cache_stats = xyes; then | |
1072 | DISK_CACHE_STATS=1 | |
1073 | else | |
1074 | DISK_CACHE_STATS=0 | |
1075 | fi | |
1076 | AC_SUBST([DISK_CACHE_STATS]) | |
1077 | ||
e744219b VS |
1078 | AC_ARG_ENABLE([boot-time], |
1079 | AS_HELP_STRING([--enable-boot-time], | |
1080 | [enable boot time statistics collection])) | |
1081 | ||
1082 | if test x$enable_boot_time = xyes; then | |
1083 | BOOT_TIME_STATS=1 | |
1084 | else | |
1085 | BOOT_TIME_STATS=0 | |
1086 | fi | |
1087 | AC_SUBST([BOOT_TIME_STATS]) | |
1088 | ||
d64399b5 | 1089 | AC_ARG_ENABLE([grub-emu-usb], |
1090 | [AS_HELP_STRING([--enable-grub-emu-usb], | |
5ce5507f | 1091 | [build and install the `grub-emu' debugging utility with USB support (default=guessed)])]) |
5ce5507f | 1092 | |
927d0134 VS |
1093 | AC_ARG_ENABLE([grub-emu-sdl], |
1094 | [AS_HELP_STRING([--enable-grub-emu-sdl], | |
1095 | [build and install the `grub-emu' debugging utility with SDL support (default=guessed)])]) | |
1096 | ||
3affd0ec | 1097 | AC_ARG_ENABLE([grub-emu-pci], |
1098 | [AS_HELP_STRING([--enable-grub-emu-pci], | |
1099 | [build and install the `grub-emu' debugging utility with PCI support (potentially dangerous) (default=no)])]) | |
1100 | ||
f84b481b | 1101 | if test "$platform" = emu; then |
f84b481b | 1102 | |
62a747cb VS |
1103 | if test x"$enable_grub_emu_usb" != xyes ; then |
1104 | grub_emu_usb_excuse="not enabled" | |
5ce5507f | 1105 | fi |
325c8258 | 1106 | |
0e848909 VS |
1107 | if test x"$enable_grub_emu_pci" = xyes ; then |
1108 | grub_emu_usb_excuse="conflicts with PCI support" | |
1109 | fi | |
1110 | ||
5ce5507f | 1111 | [if [ x"$grub_emu_usb_excuse" = x ]; then |
d64399b5 | 1112 | # Check for libusb libraries.] |
5ce5507f | 1113 | AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"], |
e98cd0c2 | 1114 | [grub_emu_usb_excuse=["need libusb library"]]) |
d64399b5 | 1115 | AC_SUBST([LIBUSB]) |
5ce5507f | 1116 | [fi] |
1117 | [if [ x"$grub_emu_usb_excuse" = x ]; then | |
1118 | # Check for headers.] | |
d64399b5 | 1119 | AC_CHECK_HEADERS([usb.h], [], |
e98cd0c2 | 1120 | [grub_emu_usb_excuse=["need libusb headers"]]) |
4fe9862e | 1121 | [fi] |
c6f3b249 | 1122 | if test x"$enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then |
ce7a733d | 1123 | AC_MSG_ERROR([USB support for grub-emu was explicitly requested but can't be compiled]) |
5ce5507f | 1124 | fi |
1125 | if test x"$grub_emu_usb_excuse" = x ; then | |
1126 | enable_grub_emu_usb=yes | |
1127 | else | |
1128 | enable_grub_emu_usb=no | |
1129 | fi | |
1130 | ||
927d0134 VS |
1131 | if test x"$enable_grub_emu_sdl" = xno ; then |
1132 | grub_emu_sdl_excuse="explicitely disabled" | |
1133 | fi | |
1134 | [if [ x"$grub_emu_sdl_excuse" = x ]; then | |
1135 | # Check for libSDL libraries.] | |
1136 | AC_CHECK_LIB([SDL], [SDL_Init], [LIBSDL="-lSDL"], | |
1137 | [grub_emu_sdl_excuse=["libSDL libraries are required to build \`grub-emu' with SDL support"]]) | |
1138 | AC_SUBST([LIBSDL]) | |
1139 | [fi] | |
9f293ab0 | 1140 | |
927d0134 VS |
1141 | [if [ x"$grub_emu_sdl_excuse" = x ]; then |
1142 | # Check for headers.] | |
1143 | AC_CHECK_HEADERS([SDL/SDL.h], [], | |
1144 | [grub_emu_sdl_excuse=["libSDL header file is required to build \`grub-emu' with SDL support"]]) | |
1145 | [fi] | |
9f293ab0 | 1146 | |
927d0134 VS |
1147 | if test x"enable_grub_emu_sdl" = xyes && test x"$grub_emu_sdl_excuse" != x ; then |
1148 | AC_MSG_ERROR([SDL support for grub-emu was explicitely requested but can't be compiled]) | |
1149 | fi | |
1150 | if test x"$grub_emu_sdl_excuse" = x ; then | |
1151 | enable_grub_emu_sdl=yes | |
1152 | else | |
1153 | enable_grub_emu_sdl=no | |
1154 | fi | |
1155 | ||
3affd0ec | 1156 | if test x"$enable_grub_emu_pci" != xyes ; then |
325c8258 | 1157 | grub_emu_pci_excuse="not enabled" |
1158 | fi | |
1159 | ||
1160 | if test x"$enable_grub_emu_usb" = xyes ; then | |
1161 | grub_emu_pci_excuse="conflicts with USB support" | |
1162 | fi | |
1163 | ||
1164 | [if [ x"$grub_emu_pci_excuse" = x ]; then | |
1165 | # Check for libpci libraries.] | |
459fed4b | 1166 | AC_CHECK_LIB([pciaccess], [pci_system_init], [LIBPCIACCESS="-lpciaccess"], |
1167 | [grub_emu_pci_excuse=["need libpciaccess library"]]) | |
1168 | AC_SUBST([LIBPCIACCESS]) | |
325c8258 | 1169 | [fi] |
1170 | [if [ x"$grub_emu_pci_excuse" = x ]; then | |
1171 | # Check for headers.] | |
1172 | AC_CHECK_HEADERS([pci/pci.h], [], | |
459fed4b | 1173 | [grub_emu_pci_excuse=["need libpciaccess headers"]]) |
325c8258 | 1174 | [fi] |
1175 | ||
1176 | if test x"$grub_emu_pci_excuse" = x ; then | |
1177 | enable_grub_emu_pci=yes | |
1178 | else | |
9f293ab0 | 1179 | |
325c8258 | 1180 | enable_grub_emu_pci=no |
3affd0ec | 1181 | fi |
1182 | ||
927d0134 | 1183 | AC_SUBST([enable_grub_emu_sdl]) |
d64399b5 | 1184 | AC_SUBST([enable_grub_emu_usb]) |
3affd0ec | 1185 | AC_SUBST([enable_grub_emu_pci]) |
e7d09ac4 AB |
1186 | |
1187 | else | |
1188 | ||
1189 | # Ignore --enable-emu-* if platform is not emu | |
1190 | enable_grub_emu_sdl=no | |
1191 | enable_grub_emu_usb=no | |
1192 | enable_grub_emu_pci=no | |
f84b481b | 1193 | fi |
4fe9862e | 1194 | |
e52db1f7 | 1195 | AC_ARG_ENABLE([grub-mkfont], |
1196 | [AS_HELP_STRING([--enable-grub-mkfont], | |
5ce5507f | 1197 | [build and install the `grub-mkfont' utility (default=guessed)])]) |
1198 | if test x"$enable_grub_mkfont" = xno ; then | |
ce7a733d | 1199 | grub_mkfont_excuse="explicitly disabled" |
5ce5507f | 1200 | fi |
1201 | ||
1202 | if test x"$grub_mkfont_excuse" = x ; then | |
e52db1f7 | 1203 | # Check for freetype libraries. |
a5b55c4b | 1204 | AC_CHECK_TOOLS([FREETYPE], [freetype-config]) |
e52db1f7 | 1205 | if test "x$FREETYPE" = x ; then |
e98cd0c2 | 1206 | grub_mkfont_excuse=["need freetype2 library"] |
e52db1f7 | 1207 | fi |
e52db1f7 | 1208 | fi |
660960d6 | 1209 | |
7b780018 VS |
1210 | unset ac_cv_header_ft2build_h |
1211 | ||
660960d6 VS |
1212 | if test x"$grub_mkfont_excuse" = x ; then |
1213 | # Check for freetype libraries. | |
a5b55c4b DM |
1214 | freetype_cflags=`$FREETYPE --cflags` |
1215 | freetype_libs=`$FREETYPE --libs` | |
d1e8a02f | 1216 | SAVED_CPPFLAGS="$CPPFLAGS" |
b75db69a | 1217 | SAVED_LIBS="$LIBS" |
d1e8a02f | 1218 | CPPFLAGS="$CPPFLAGS $freetype_cflags" |
b75db69a | 1219 | LIBS="$LIBS $freetype_libs" |
660960d6 VS |
1220 | AC_CHECK_HEADERS([ft2build.h], [], |
1221 | [grub_mkfont_excuse=["need freetype2 headers"]]) | |
b75db69a | 1222 | AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [], [grub_mkfont_excuse=["freetype2 library unusable"]]) |
d1e8a02f | 1223 | CPPFLAGS="$SAVED_CPPFLAGS" |
b75db69a | 1224 | LIBS="$SAVED_LIBS" |
660960d6 VS |
1225 | fi |
1226 | ||
5ce5507f | 1227 | if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then |
ce7a733d | 1228 | AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled]) |
5ce5507f | 1229 | fi |
1230 | if test x"$grub_mkfont_excuse" = x ; then | |
1231 | enable_grub_mkfont=yes | |
1232 | else | |
1233 | enable_grub_mkfont=no | |
1234 | fi | |
e52db1f7 | 1235 | AC_SUBST([enable_grub_mkfont]) |
1236 | AC_SUBST([freetype_cflags]) | |
1237 | AC_SUBST([freetype_libs]) | |
1238 | ||
7c9d0c39 | 1239 | SAVED_CC="$CC" |
b224c266 | 1240 | SAVED_CPP="$CPP" |
7c9d0c39 VS |
1241 | SAVED_CFLAGS="$CFLAGS" |
1242 | SAVED_CPPFLAGS="$CPPFLAGS" | |
1243 | CC="$BUILD_CC" | |
b224c266 | 1244 | CPP="$BUILD_CPP" |
7c9d0c39 | 1245 | CFLAGS="$BUILD_CFLAGS" |
7b780018 VS |
1246 | CPPFLAGS="$BUILD_CPPFLAGS" |
1247 | ||
1248 | unset ac_cv_c_bigendian | |
1249 | unset ac_cv_header_ft2build_h | |
1250 | ||
1251 | AC_COMPUTE_INT([BUILD_SIZEOF_VOID_P], [sizeof (void *)]) | |
1252 | AC_COMPUTE_INT([BUILD_SIZEOF_LONG], [sizeof (long)]) | |
1253 | AC_C_BIGENDIAN([BUILD_WORDS_BIGENDIAN=1], [BUILD_WORDS_BIGENDIAN=0], [BUILD_WORDS_BIGENDIAN=err], [BUILD_WORDS_BIGENDIAN=err]) | |
1254 | ||
1255 | if test x$BUILD_WORDS_BIGENDIAN = xerr ; then | |
1256 | AC_MSG_ERROR([couldnt determine build endianness]) | |
1257 | fi | |
1258 | ||
1259 | AC_SUBST([BUILD_SIZEOF_LONG]) | |
1260 | AC_SUBST([BUILD_SIZEOF_VOID_P]) | |
1261 | AC_SUBST([BUILD_WORDS_BIGENDIAN]) | |
c5884973 | 1262 | |
7c9d0c39 VS |
1263 | if test x"$grub_build_mkfont_excuse" = x ; then |
1264 | # Check for freetype libraries. | |
7b780018 | 1265 | AC_CHECK_PROGS([BUILD_FREETYPE], [freetype-config]) |
7c9d0c39 VS |
1266 | if test "x$BUILD_FREETYPE" = x ; then |
1267 | grub_build_mkfont_excuse=["need freetype2 library"] | |
1268 | fi | |
1269 | fi | |
c5884973 | 1270 | |
7c9d0c39 VS |
1271 | if test x"$grub_build_mkfont_excuse" = x ; then |
1272 | # Check for freetype libraries. | |
1273 | build_freetype_cflags=`$BUILD_FREETYPE --cflags` | |
1274 | build_freetype_libs=`$BUILD_FREETYPE --libs` | |
1275 | SAVED_CPPFLAGS_2="$CPPFLAGS" | |
b75db69a | 1276 | SAVED_LIBS="$LIBS" |
7c9d0c39 | 1277 | CPPFLAGS="$CPPFLAGS $build_freetype_cflags" |
b75db69a | 1278 | LIBS="$LIBS $build_freetype_libs" |
7c9d0c39 VS |
1279 | AC_CHECK_HEADERS([ft2build.h], [], |
1280 | [grub_build_mkfont_excuse=["need freetype2 headers"]]) | |
b75db69a VS |
1281 | AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [], [grub_build_mkfont_excuse=["freetype2 library unusable"]]) |
1282 | LIBS="$SAVED_LIBS" | |
7c9d0c39 VS |
1283 | CPPFLAGS="$SAVED_CPPFLAGS_2" |
1284 | fi | |
1285 | ||
1286 | if test x"$enable_build_grub_mkfont" = xyes && test x"$grub_build_mkfont_excuse" != x ; then | |
1287 | AC_MSG_ERROR([build-grub-mkfont was explicitly requested but can't be compiled]) | |
1288 | fi | |
1289 | if test x"$grub_build_mkfont_excuse" = x ; then | |
1290 | enable_build_grub_mkfont=yes | |
1291 | else | |
1292 | enable_build_grub_mkfont=no | |
c5884973 | 1293 | fi |
71669c3b VS |
1294 | if test x"$enable_build_grub_mkfont" = xno && ( test "x$platform" = xqemu || test "x$platform" = xloongson || test "x$platform" = xqemu_mips || test "x$target_cpu"-"$platform" = xpowerpc-ieee1275 || test "x$platform" = xxen || test "x$platform" = xcoreboot ); then |
1295 | AC_MSG_ERROR([qemu, powerpc-ieee1275, coreboot, xen and loongson ports needs build-time grub-mkfont]) | |
7c9d0c39 VS |
1296 | fi |
1297 | ||
1298 | AC_SUBST([build_freetype_cflags]) | |
1299 | AC_SUBST([build_freetype_libs]) | |
1300 | ||
1301 | CC="$SAVED_CC" | |
b224c266 | 1302 | CPP="$SAVED_CPP" |
7c9d0c39 VS |
1303 | CFLAGS="$SAVED_CFLAGS" |
1304 | CPPFLAGS="$SAVED_CPPFLAGS" | |
1305 | ||
1306 | ||
1307 | DJVU_FONT_SOURCE= | |
1308 | ||
1309 | starfield_excuse= | |
c5884973 | 1310 | |
300f48c5 VS |
1311 | AC_ARG_ENABLE([grub-themes], |
1312 | [AS_HELP_STRING([--enable-grub-themes], | |
1313 | [build and install GRUB themes (default=guessed)])]) | |
1314 | if test x"$enable_grub_themes" = xno ; then | |
1315 | starfield_excuse="explicitly disabled" | |
1316 | fi | |
1317 | ||
1318 | if test x"$starfield_excuse" = x && test x"$enable_build_grub_mkfont" = xno ; then | |
7b966834 VS |
1319 | starfield_excuse="No build-time grub-mkfont" |
1320 | fi | |
1321 | ||
501b9e4b | 1322 | if test x"$starfield_excuse" = x; then |
c5884973 | 1323 | for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do |
32745f51 | 1324 | for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu; do |
c5884973 DO |
1325 | if test -f "$dir/DejaVuSans.$ext"; then |
1326 | DJVU_FONT_SOURCE="$dir/DejaVuSans.$ext" | |
1327 | break 2 | |
1328 | fi | |
1329 | done | |
1330 | done | |
1331 | ||
1332 | if test "x$DJVU_FONT_SOURCE" = x; then | |
1333 | starfield_excuse="No DejaVu found" | |
1334 | fi | |
1335 | fi | |
1336 | ||
300f48c5 VS |
1337 | if test x"$enable_grub_themes" = xyes && test x"$starfield_excuse" != x; then |
1338 | AC_MSG_ERROR([themes were explicitly requested but requirements are not satisfied]) | |
1339 | fi | |
1340 | ||
c5884973 DO |
1341 | AC_SUBST([DJVU_FONT_SOURCE]) |
1342 | ||
7c9d0c39 VS |
1343 | FONT_SOURCE= |
1344 | ||
1345 | for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do | |
1346 | for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/unifont /usr/share/fonts/uni /usr/share/fonts/truetype/unifont /usr/share/fonts/misc; do | |
1347 | if test -f "$dir/unifont.$ext"; then | |
0277eab7 VS |
1348 | md5="$(md5sum "$dir/unifont.$ext"|awk '{ print $1; }')" |
1349 | # PCF and BDF from version 6.3 isn't hanled properly by libfreetype. | |
1350 | if test "$md5" = 0a54834d2788c83886a3e1785a6a1e61 || test "$md5" = 28f2565c7a41d8d407e2551159385edb || test "$md5" = dae5e588461b3b92b87b6ffee734f936 || test "$md5" = 4a3d687aa5bb329ed05f4263a1016791 ; then | |
1351 | continue; | |
1352 | fi | |
7c9d0c39 VS |
1353 | FONT_SOURCE="$dir/unifont.$ext" |
1354 | break 2 | |
1355 | fi | |
1356 | done | |
1357 | done | |
1358 | ||
7b966834 VS |
1359 | if test x"$enable_build_grub_mkfont" = xno ; then |
1360 | FONT_SOURCE= | |
1361 | fi | |
1362 | ||
71669c3b VS |
1363 | if test "x$FONT_SOURCE" = x && ( test "x$platform" = xqemu || test "x$platform" = xloongson || test "x$platform" = xqemu_mips || test "x$target_cpu"-"$platform" = xpowerpc-ieee1275 || test "x$platform" = xxen || test "x$platform" = xcoreboot ); then |
1364 | AC_MSG_ERROR([qemu, powerpc-ieee1275, xen, coreboot and loongson ports need unifont]) | |
7c9d0c39 VS |
1365 | fi |
1366 | ||
1367 | AC_SUBST([FONT_SOURCE]) | |
1368 | ||
7b780018 | 1369 | if test x"$FONT_SOURCE" = x && test x"$DJVU_FONT_SOURCE" = x && test x"$grub_build_mkfont_excuse" = x; then |
7c9d0c39 VS |
1370 | grub_build_mkfont_excuse="no fonts" |
1371 | fi | |
1372 | ||
1373 | ||
897e6207 CW |
1374 | AC_ARG_ENABLE([grub-mount], |
1375 | [AS_HELP_STRING([--enable-grub-mount], | |
1376 | [build and install the `grub-mount' utility (default=guessed)])]) | |
1377 | if test x"$enable_grub_mount" = xno ; then | |
1378 | grub_mount_excuse="explicitly disabled" | |
92bb0786 VS |
1379 | fi |
1380 | ||
897e6207 | 1381 | if test x"$grub_mount_excuse" = x ; then |
92bb0786 | 1382 | AC_CHECK_LIB([fuse], [fuse_main_real], [], |
897e6207 | 1383 | [grub_mount_excuse="need FUSE library"]) |
92bb0786 VS |
1384 | fi |
1385 | ||
897e6207 | 1386 | if test x"$grub_mount_excuse" = x ; then |
92bb0786 VS |
1387 | # Check for fuse headers. |
1388 | SAVED_CPPFLAGS="$CPPFLAGS" | |
338c7fab | 1389 | CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26" |
92bb0786 | 1390 | AC_CHECK_HEADERS([fuse/fuse.h], [], |
897e6207 | 1391 | [grub_mount_excuse=["need FUSE headers"]]) |
92bb0786 VS |
1392 | CPPFLAGS="$SAVED_CPPFLAGS" |
1393 | fi | |
1394 | ||
897e6207 | 1395 | if test x"$enable_grub_mount" = xyes && test x"$grub_mount_excuse" != x ; then |
89644ef1 | 1396 | AC_MSG_ERROR([grub-mount was explicitly requested but can't be compiled]) |
92bb0786 | 1397 | fi |
897e6207 CW |
1398 | if test x"$grub_mount_excuse" = x ; then |
1399 | enable_grub_mount=yes | |
92bb0786 | 1400 | else |
897e6207 | 1401 | enable_grub_mount=no |
92bb0786 | 1402 | fi |
897e6207 | 1403 | AC_SUBST([enable_grub_mount]) |
92bb0786 | 1404 | |
7181e228 CW |
1405 | AC_ARG_ENABLE([device-mapper], |
1406 | [AS_HELP_STRING([--enable-device-mapper], | |
1407 | [enable Linux device-mapper support (default=guessed)])]) | |
1408 | if test x"$enable_device_mapper" = xno ; then | |
1409 | device_mapper_excuse="explicitly disabled" | |
1410 | fi | |
1411 | ||
53798c4b GS |
1412 | if test x"$device_mapper_excuse" = x ; then |
1413 | # Check for device-mapper header. | |
1414 | AC_CHECK_HEADER([libdevmapper.h], [], | |
1415 | [device_mapper_excuse="need libdevmapper header"]) | |
1416 | fi | |
1417 | ||
7181e228 CW |
1418 | if test x"$device_mapper_excuse" = x ; then |
1419 | # Check for device-mapper library. | |
61d720e5 | 1420 | AC_CHECK_LIB([devmapper], [dm_task_create], [], |
7181e228 | 1421 | [device_mapper_excuse="need devmapper library"]) |
7181e228 | 1422 | fi |
61d720e5 VS |
1423 | |
1424 | if test x"$device_mapper_excuse" = x ; then | |
1425 | # Check for device-mapper library. | |
1426 | AC_CHECK_LIB([devmapper], [dm_log_with_errno_init], | |
1427 | [], | |
1428 | [device_mapper_excuse="need devmapper library"]) | |
1429 | fi | |
1430 | ||
1431 | if test x"$device_mapper_excuse" = x ; then | |
1432 | LIBDEVMAPPER="-ldevmapper"; | |
1433 | AC_DEFINE([HAVE_DEVICE_MAPPER], [1], | |
1434 | [Define to 1 if you have the devmapper library.]) | |
1435 | fi | |
1436 | ||
62f7d208 | 1437 | AC_SUBST([LIBDEVMAPPER]) |
76ed06b9 | 1438 | |
f4727da9 VS |
1439 | LIBGEOM= |
1440 | if test x$host_kernel = xkfreebsd; then | |
1441 | AC_CHECK_LIB([geom], [geom_gettree], [], | |
1442 | [AC_MSG_ERROR([Your platform requires libgeom])]) | |
1443 | LIBGEOM="-lgeom" | |
1444 | fi | |
1445 | ||
1446 | AC_SUBST([LIBGEOM]) | |
1447 | ||
0d2d30bb VS |
1448 | AC_ARG_ENABLE([liblzma], |
1449 | [AS_HELP_STRING([--enable-liblzma], | |
1450 | [enable liblzma integration (default=guessed)])]) | |
1451 | if test x"$enable_liblzma" = xno ; then | |
1452 | liblzma_excuse="explicitly disabled" | |
1453 | fi | |
1454 | ||
1455 | if test x"$liblzma_excuse" = x ; then | |
2c44e493 | 1456 | AC_CHECK_LIB([lzma], [lzma_code], |
0d2d30bb VS |
1457 | [],[liblzma_excuse="need lzma library"]) |
1458 | fi | |
1459 | if test x"$liblzma_excuse" = x ; then | |
1460 | AC_CHECK_HEADER([lzma.h], [], [liblzma_excuse="need lzma header"]) | |
1461 | fi | |
1462 | ||
1463 | if test x"$enable_liblzma" = xyes && test x"$liblzma_excuse" != x ; then | |
1464 | AC_MSG_ERROR([liblzma support was explicitly requested but requirements are not satisfied]) | |
1465 | fi | |
1466 | ||
1467 | ||
1468 | if test x"$liblzma_excuse" = x ; then | |
1469 | LIBLZMA="-llzma" | |
1470 | AC_DEFINE([USE_LIBLZMA], [1], | |
1471 | [Define to 1 if you have the LZMA library.]) | |
1472 | fi | |
1473 | ||
2c44e493 VS |
1474 | AC_SUBST([LIBLZMA]) |
1475 | ||
e4c498a1 MG |
1476 | AC_ARG_ENABLE([libzfs], |
1477 | [AS_HELP_STRING([--enable-libzfs], | |
1478 | [enable libzfs integration (default=guessed)])]) | |
1479 | if test x"$enable_libzfs" = xno ; then | |
1480 | libzfs_excuse="explicitly disabled" | |
1481 | fi | |
16c7cb32 | 1482 | |
e4c498a1 MG |
1483 | if test x"$libzfs_excuse" = x ; then |
1484 | # Only check for system headers if libzfs support has not been disabled. | |
1485 | AC_CHECK_HEADERS(libzfs.h libnvpair.h) | |
1486 | fi | |
1487 | ||
1488 | if test x"$libzfs_excuse" = x ; then | |
1489 | AC_CHECK_LIB([zfs], [libzfs_init], | |
1490 | [], | |
1491 | [libzfs_excuse="need zfs library"]) | |
1492 | fi | |
1493 | ||
1494 | if test x"$libzfs_excuse" = x ; then | |
27f9d02e | 1495 | AC_CHECK_LIB([nvpair], [nvlist_lookup_string], |
e4c498a1 MG |
1496 | [], |
1497 | [libzfs_excuse="need nvpair library"]) | |
1498 | fi | |
1499 | ||
1500 | if test x"$enable_libzfs" = xyes && test x"$libzfs_excuse" != x ; then | |
1501 | AC_MSG_ERROR([libzfs support was explicitly requested but requirements are not satisfied]) | |
1502 | fi | |
1503 | ||
1504 | if test x"$libzfs_excuse" = x ; then | |
1505 | # We need both libzfs and libnvpair for a successful build. | |
1506 | LIBZFS="-lzfs" | |
1507 | AC_DEFINE([HAVE_LIBZFS], [1], | |
1508 | [Define to 1 if you have the ZFS library.]) | |
1509 | LIBNVPAIR="-lnvpair" | |
1510 | AC_DEFINE([HAVE_LIBNVPAIR], [1], | |
1511 | [Define to 1 if you have the NVPAIR library.]) | |
1512 | fi | |
1513 | ||
1514 | AC_SUBST([LIBZFS]) | |
16c7cb32 BC |
1515 | AC_SUBST([LIBNVPAIR]) |
1516 | ||
9f915872 VS |
1517 | LIBS="" |
1518 | ||
76ed06b9 | 1519 | AC_SUBST([FONT_SOURCE]) |
76ed06b9 BC |
1520 | AS_IF([test x$target_cpu = xi386 -a x$platform = xqemu], |
1521 | [AC_SUBST([GRUB_BOOT_MACHINE_LINK_ADDR], 0xffe00)]) | |
7181e228 | 1522 | |
742f9232 VS |
1523 | AC_SUBST(HAVE_ASM_USCORE) |
1524 | AC_SUBST(ADDR32) | |
1525 | AC_SUBST(DATA32) | |
1526 | AC_SUBST(BSS_START_SYMBOL) | |
1527 | AC_SUBST(END_SYMBOL) | |
1528 | AC_SUBST(PACKAGE) | |
1529 | AC_SUBST(VERSION) | |
742f9232 VS |
1530 | AC_SUBST(NEED_REGISTER_FRAME_INFO) |
1531 | ||
d5524ca8 VS |
1532 | AC_ARG_ENABLE([werror], |
1533 | [AS_HELP_STRING([--disable-werror], | |
1534 | [do not use -Werror when building GRUB])]) | |
1535 | if test x"$enable_werror" != xno ; then | |
1536 | TARGET_CFLAGS="$TARGET_CFLAGS -Werror" | |
1537 | HOST_CFLAGS="$HOST_CFLAGS -Werror" | |
1538 | fi | |
1539 | ||
1540 | if test "x$grub_cv_cc_target_clang" = xno; then | |
1541 | TARGET_LDFLAGS_STATIC_LIBGCC="-static-libgcc" | |
1542 | else | |
1543 | TARGET_LDFLAGS_STATIC_LIBGCC= | |
1544 | fi | |
1545 | ||
1546 | TARGET_CPP="$TARGET_CC -E" | |
1547 | TARGET_CCAS=$TARGET_CC | |
1548 | ||
1549 | GRUB_TARGET_CPU="${target_cpu}" | |
1550 | GRUB_PLATFORM="${platform}" | |
1551 | ||
1552 | AC_SUBST(GRUB_TARGET_CPU) | |
1553 | AC_SUBST(GRUB_PLATFORM) | |
1554 | ||
1555 | AC_SUBST(TARGET_OBJCONV) | |
1556 | AC_SUBST(TARGET_LIBGCC) | |
1557 | AC_SUBST(TARGET_LDFLAGS_STATIC_LIBGCC) | |
1558 | AC_SUBST(TARGET_CPP) | |
1559 | AC_SUBST(TARGET_CCAS) | |
1560 | AC_SUBST(TARGET_OBJ2ELF) | |
d5524ca8 VS |
1561 | AC_SUBST(TARGET_MODULE_FORMAT) |
1562 | ||
1563 | AC_SUBST(TARGET_CFLAGS) | |
1564 | AC_SUBST(TARGET_LDFLAGS) | |
1565 | AC_SUBST(TARGET_CPPFLAGS) | |
1566 | AC_SUBST(TARGET_CCASFLAGS) | |
1567 | ||
d5524ca8 VS |
1568 | AC_SUBST(TARGET_IMG_LDFLAGS) |
1569 | AC_SUBST(TARGET_IMG_CFLAGS) | |
1570 | AC_SUBST(TARGET_IMG_BASE_LDOPT) | |
a9f25a08 | 1571 | AC_SUBST(TARGET_APPLE_LINKER) |
d5524ca8 VS |
1572 | |
1573 | AC_SUBST(HOST_CFLAGS) | |
1574 | AC_SUBST(HOST_LDFLAGS) | |
1575 | AC_SUBST(HOST_CPPFLAGS) | |
1576 | AC_SUBST(HOST_CCASFLAGS) | |
1577 | ||
1578 | AC_SUBST(BUILD_LIBM) | |
1579 | ||
76ed06b9 BC |
1580 | # |
1581 | # Automake conditionals | |
1582 | # | |
8c411768 | 1583 | |
76ed06b9 | 1584 | AM_CONDITIONAL([COND_emu], [test x$platform = xemu]) |
d59849b2 | 1585 | AM_CONDITIONAL([COND_clang], [test x$grub_cv_cc_target_clang = xyes]) |
76ed06b9 BC |
1586 | AM_CONDITIONAL([COND_i386_pc], [test x$target_cpu = xi386 -a x$platform = xpc]) |
1587 | AM_CONDITIONAL([COND_i386_efi], [test x$target_cpu = xi386 -a x$platform = xefi]) | |
6585de4c | 1588 | AM_CONDITIONAL([COND_ia64_efi], [test x$target_cpu = xia64 -a x$platform = xefi]) |
76ed06b9 BC |
1589 | AM_CONDITIONAL([COND_i386_qemu], [test x$target_cpu = xi386 -a x$platform = xqemu]) |
1590 | AM_CONDITIONAL([COND_i386_ieee1275], [test x$target_cpu = xi386 -a x$platform = xieee1275]) | |
1591 | AM_CONDITIONAL([COND_i386_coreboot], [test x$target_cpu = xi386 -a x$platform = xcoreboot]) | |
1592 | AM_CONDITIONAL([COND_i386_multiboot], [test x$target_cpu = xi386 -a x$platform = xmultiboot]) | |
1593 | AM_CONDITIONAL([COND_x86_64_efi], [test x$target_cpu = xx86_64 -a x$platform = xefi]) | |
9612ebc0 VS |
1594 | AM_CONDITIONAL([COND_i386_xen], [test x$target_cpu = xi386 -a x$platform = xxen]) |
1595 | AM_CONDITIONAL([COND_x86_64_xen], [test x$target_cpu = xx86_64 -a x$platform = xxen]) | |
4959e111 VS |
1596 | AM_CONDITIONAL([COND_mips_loongson], [test x$target_cpu = xmipsel -a x$platform = xloongson]) |
1597 | AM_CONDITIONAL([COND_mips_qemu_mips], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")" -a x$platform = xqemu_mips]) | |
7f63a64f | 1598 | AM_CONDITIONAL([COND_mips_arc], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")" -a x$platform = xarc]) |
76ed06b9 | 1599 | AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275]) |
eaf01c25 | 1600 | AM_CONDITIONAL([COND_sparc64_emu], [test x$target_cpu = xsparc64 -a x$platform = xemu]) |
76ed06b9 | 1601 | AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275]) |
4959e111 | 1602 | AM_CONDITIONAL([COND_mips], [test x$target_cpu = xmips -o x$target_cpu = xmipsel]) |
37ba07eb VS |
1603 | AM_CONDITIONAL([COND_mipsel], [test x$target_cpu = xmipsel]) |
1604 | AM_CONDITIONAL([COND_mipseb], [test x$target_cpu = xmips]) | |
389b31cd LL |
1605 | AM_CONDITIONAL([COND_arm], [test x$target_cpu = xarm ]) |
1606 | AM_CONDITIONAL([COND_arm_uboot], [test x$target_cpu = xarm -a x$platform = xuboot]) | |
1607 | AM_CONDITIONAL([COND_arm_efi], [test x$target_cpu = xarm -a x$platform = xefi]) | |
15a463d7 LL |
1608 | AM_CONDITIONAL([COND_arm64], [test x$target_cpu = xarm64 ]) |
1609 | AM_CONDITIONAL([COND_arm64_efi], [test x$target_cpu = xarm64 -a x$platform = xefi]) | |
f7711f5e BC |
1610 | |
1611 | AM_CONDITIONAL([COND_HOST_HURD], [test x$host_kernel = xhurd]) | |
1612 | AM_CONDITIONAL([COND_HOST_LINUX], [test x$host_kernel = xlinux]) | |
1613 | AM_CONDITIONAL([COND_HOST_NETBSD], [test x$host_kernel = xnetbsd]) | |
1614 | AM_CONDITIONAL([COND_HOST_WINDOWS], [test x$host_kernel = xwindows]) | |
1615 | AM_CONDITIONAL([COND_HOST_KFREEBSD], [test x$host_kernel = xkfreebsd]) | |
b105df76 | 1616 | AM_CONDITIONAL([COND_HOST_XNU], [test x$host_kernel = xxnu]) |
958ee221 | 1617 | AM_CONDITIONAL([COND_HOST_ILLUMOS], [test x$host_kernel = xillumos]) |
2d465fb0 | 1618 | |
76ed06b9 BC |
1619 | AM_CONDITIONAL([COND_MAN_PAGES], [test x$cross_compiling = xno -a x$HELP2MAN != x]) |
1620 | AM_CONDITIONAL([COND_GRUB_EMU_USB], [test x$enable_grub_emu_usb = xyes]) | |
1621 | AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes]) | |
1622 | AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes]) | |
1623 | AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes]) | |
897e6207 | 1624 | AM_CONDITIONAL([COND_GRUB_MOUNT], [test x$enable_grub_mount = xyes]) |
76ed06b9 | 1625 | AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x]) |
6f07c4e4 VS |
1626 | if test x$FONT_SOURCE != x ; then |
1627 | HAVE_FONT_SOURCE=1 | |
1628 | else | |
1629 | HAVE_FONT_SOURCE=0 | |
1630 | fi | |
1631 | AC_SUBST(HAVE_FONT_SOURCE) | |
a9f25a08 | 1632 | AM_CONDITIONAL([COND_APPLE_LINKER], [test x$TARGET_APPLE_LINKER = x1]) |
76ed06b9 | 1633 | AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes]) |
c5dc1690 | 1634 | AM_CONDITIONAL([COND_ENABLE_CACHE_STATS], [test x$DISK_CACHE_STATS = x1]) |
e744219b | 1635 | AM_CONDITIONAL([COND_ENABLE_BOOT_TIME_STATS], [test x$BOOT_TIME_STATS = x1]) |
fc45fb58 | 1636 | |
1eed0e6e VS |
1637 | AM_CONDITIONAL([COND_HAVE_CXX], [test x$HAVE_CXX = xyes]) |
1638 | ||
742f9232 | 1639 | AM_CONDITIONAL([COND_HAVE_ASM_USCORE], [test x$HAVE_ASM_USCORE = x1]) |
c5884973 | 1640 | AM_CONDITIONAL([COND_STARFIELD], [test "x$starfield_excuse" = x]) |
cd46aa6c VS |
1641 | AM_CONDITIONAL([COND_HAVE_EXEC], [test "x$have_exec" = xy]) |
1642 | ||
1643 | test "x$prefix" = xNONE && prefix="$ac_default_prefix" | |
1644 | test "x$exec_prefix" = xNONE && exec_prefix="${prefix}" | |
1645 | datarootdir="$(eval echo "$datarootdir")" | |
1646 | grub_libdir="$(eval echo "$libdir")" | |
1647 | grub_localedir="$(eval echo "$localedir")" | |
1648 | grub_datadir="$(eval echo "$datadir")" | |
1649 | grub_sysconfdir="$(eval echo "$sysconfdir")" | |
1650 | AC_DEFINE_UNQUOTED(LOCALEDIR, "$grub_localedir", [Locale dir]) | |
1651 | AC_DEFINE_UNQUOTED(GRUB_LIBDIR, "$grub_libdir", [Library dir]) | |
1652 | AC_DEFINE_UNQUOTED(GRUB_DATADIR, "$grub_datadir", [Data dir]) | |
1653 | AC_DEFINE_UNQUOTED(GRUB_SYSCONFDIR, "$grub_sysconfdir", [Configuration dir]) | |
1654 | ||
742f9232 | 1655 | |
6a161fa9 | 1656 | # Output files. |
4959e111 VS |
1657 | cpudir="${target_cpu}" |
1658 | if test x${cpudir} = xmipsel; then | |
1659 | cpudir=mips; | |
1660 | fi | |
1f4147aa | 1661 | grub_CHECK_LINK_DIR |
1662 | if test x"$link_dir" = xyes ; then | |
4959e111 | 1663 | AC_CONFIG_LINKS([include/grub/cpu:include/grub/$cpudir]) |
f84b481b | 1664 | if test "$platform" != emu ; then |
4959e111 | 1665 | AC_CONFIG_LINKS([include/grub/machine:include/grub/$cpudir/$platform]) |
f84b481b | 1666 | fi |
1f4147aa | 1667 | else |
1668 | mkdir -p include/grub 2>/dev/null | |
1669 | rm -rf include/grub/cpu | |
4959e111 | 1670 | cp -rp $srcdir/include/grub/$cpudir include/grub/cpu 2>/dev/null |
f84b481b RM |
1671 | if test "$platform" != emu ; then |
1672 | rm -rf include/grub/machine | |
4959e111 | 1673 | cp -rp $srcdir/include/grub/$cpudir/$platform include/grub/machine 2>/dev/null |
f84b481b | 1674 | fi |
1f4147aa | 1675 | fi |
6304d292 | 1676 | |
8c411768 | 1677 | AC_CONFIG_FILES([Makefile]) |
6304d292 | 1678 | AC_CONFIG_FILES([grub-core/Makefile]) |
15c69261 | 1679 | AC_CONFIG_FILES([grub-core/gnulib/Makefile]) |
269004c1 | 1680 | AC_CONFIG_FILES([po/Makefile.in]) |
8c411768 | 1681 | AC_CONFIG_FILES([docs/Makefile]) |
b23ffd70 | 1682 | AC_CONFIG_FILES([util/bash-completion.d/Makefile]) |
6a161fa9 | 1683 | AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h]) |
742f9232 | 1684 | AC_CONFIG_FILES([config.h]) |
8c411768 | 1685 | |
6a161fa9 | 1686 | AC_OUTPUT |
5ce5507f | 1687 | [ |
1688 | echo "*******************************************************" | |
1689 | echo GRUB2 will be compiled with following components: | |
1690 | echo Platform: "$target_cpu"-"$platform" | |
f84b481b | 1691 | if [ x"$platform" = xemu ]; then |
5ce5507f | 1692 | if [ x"$grub_emu_usb_excuse" = x ]; then |
1693 | echo USB support for grub-emu: Yes | |
1694 | else | |
1695 | echo USB support for grub-emu: No "($grub_emu_usb_excuse)" | |
1696 | fi | |
927d0134 VS |
1697 | if [ x"$grub_emu_sdl_excuse" = x ]; then |
1698 | echo SDL support for grub-emu: Yes | |
1699 | else | |
1700 | echo SDL support for grub-emu: No "($grub_emu_sdl_excuse)" | |
1701 | fi | |
325c8258 | 1702 | if [ x"$grub_emu_pci_excuse" = x ]; then |
1703 | echo PCI support for grub-emu: Yes | |
1704 | else | |
1705 | echo PCI support for grub-emu: No "($grub_emu_pci_excuse)" | |
1706 | fi | |
f84b481b | 1707 | fi |
61d720e5 VS |
1708 | if test x"$device_mapper_excuse" = x ; then |
1709 | echo With devmapper support: Yes | |
1710 | else | |
1711 | echo With devmapper support: No "($device_mapper_excuse)" | |
1712 | fi | |
5ce5507f | 1713 | if [ x"$enable_mm_debug" = xyes ]; then |
1714 | echo With memory debugging: Yes | |
1715 | else | |
1716 | echo With memory debugging: No | |
1717 | fi | |
c5dc1690 SJ |
1718 | if [ x"$enable_cache_stats" = xyes ]; then |
1719 | echo With disk cache statistics: Yes | |
1720 | else | |
1721 | echo With disk cache statistics: No | |
1722 | fi | |
e744219b VS |
1723 | |
1724 | if [ x"$enable_boot_time" = xyes ]; then | |
1725 | echo With boot time statistics: Yes | |
1726 | else | |
1727 | echo With boot time statistics: No | |
1728 | fi | |
1729 | ||
5ce5507f | 1730 | if [ x"$efiemu_excuse" = x ]; then |
1731 | echo efiemu runtime: Yes | |
1732 | else | |
1733 | echo efiemu runtime: No "($efiemu_excuse)" | |
1734 | fi | |
5ce5507f | 1735 | if [ x"$grub_mkfont_excuse" = x ]; then |
1736 | echo grub-mkfont: Yes | |
1737 | else | |
1738 | echo grub-mkfont: No "($grub_mkfont_excuse)" | |
1739 | fi | |
897e6207 | 1740 | if [ x"$grub_mount_excuse" = x ]; then |
89644ef1 | 1741 | echo grub-mount: Yes |
92bb0786 | 1742 | else |
897e6207 | 1743 | echo grub-mount: No "($grub_mount_excuse)" |
92bb0786 | 1744 | fi |
c5884973 DO |
1745 | if [ x"$starfield_excuse" = x ]; then |
1746 | echo starfield theme: Yes | |
1747 | else | |
1748 | echo starfield theme: No "($starfield_excuse)" | |
1749 | fi | |
e4c498a1 MG |
1750 | if [ x"$libzfs_excuse" = x ]; then |
1751 | echo With libzfs support: Yes | |
1752 | else | |
1753 | echo With libzfs support: No "($libzfs_excuse)" | |
1754 | fi | |
7b780018 | 1755 | if [ x"$grub_build_mkfont_excuse" = x ]; then |
7c9d0c39 VS |
1756 | echo Build-time grub-mkfont: Yes |
1757 | if test "x$FONT_SOURCE" = x ; then | |
1758 | echo "Without unifont" | |
1759 | else | |
1760 | echo "With unifont from $FONT_SOURCE" | |
1761 | fi | |
4b80e43c | 1762 | else |
7b780018 | 1763 | echo Build-time grub-mkfont: No "($grub_build_mkfont_excuse)" |
7c9d0c39 | 1764 | echo "Without unifont (no build-time grub-mkfont)" |
4b80e43c | 1765 | fi |
0d2d30bb VS |
1766 | if test x"$liblzma_excuse" != x ; then |
1767 | echo "Without liblzma (no support for XZ-compressed mips images) ($liblzma_excuse)" | |
64fce2d8 VS |
1768 | else |
1769 | echo "With liblzma from $LIBLZMA (support for XZ-compressed mips images)" | |
1770 | fi | |
5ce5507f | 1771 | echo "*******************************************************" |
1772 | ] |