]>
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 | |
dcecae1a AB |
29 | dnl CC, CFLAGS, etc.) for the host type, variables with prefix "BUILD_" |
30 | dnl (such as BUILD_CC, BUILD_CFLAGS, etc.) for the build type and variables | |
31 | dnl with the prefix "TARGET_" (such as TARGET_CC, TARGET_CFLAGS, etc.) are | |
32 | dnl used for the target type. See INSTALL for full list of variables. | |
b977bf01 | 33 | |
b0bad6fd | 34 | AC_INIT([GRUB],[2.03],[bug-grub@gnu.org]) |
6a161fa9 | 35 | |
15c69261 YB |
36 | AC_CONFIG_AUX_DIR([build-aux]) |
37 | ||
76ed06b9 BC |
38 | # We don't want -g -O2 by default in CFLAGS |
39 | : ${CFLAGS=""} | |
6a161fa9 | 40 | |
1ecf96fc AB |
41 | # Checks for build, host and target systems. |
42 | AC_CANONICAL_BUILD | |
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 | |
7e23437d CW |
53 | # Explicitly check for pkg-config early on, since otherwise conditional |
54 | # calls are problematic. | |
55 | PKG_PROG_PKG_CONFIG | |
56 | ||
1d543c3e | 57 | # Program name transformations |
58 | AC_ARG_PROGRAM | |
fd49ceb3 CW |
59 | grub_TRANSFORM([grub-bios-setup]) |
60 | grub_TRANSFORM([grub-editenv]) | |
61 | grub_TRANSFORM([grub-install]) | |
62 | grub_TRANSFORM([grub-mkconfig]) | |
63 | grub_TRANSFORM([grub-mkfont]) | |
64 | grub_TRANSFORM([grub-mkimage]) | |
67ab8353 | 65 | grub_TRANSFORM([grub-glue-efi]) |
fd49ceb3 CW |
66 | grub_TRANSFORM([grub-mklayout]) |
67 | grub_TRANSFORM([grub-mkpasswd-pbkdf2]) | |
68 | grub_TRANSFORM([grub-mkrelpath]) | |
69 | grub_TRANSFORM([grub-mkrescue]) | |
70 | grub_TRANSFORM([grub-probe]) | |
71 | grub_TRANSFORM([grub-reboot]) | |
72 | grub_TRANSFORM([grub-script-check]) | |
73 | grub_TRANSFORM([grub-set-default]) | |
fd49ceb3 | 74 | grub_TRANSFORM([grub-sparc64-setup]) |
a79b8a15 | 75 | grub_TRANSFORM([grub-render-label]) |
ec824e0f | 76 | grub_TRANSFORM([grub-file]) |
1d543c3e | 77 | |
90d1e879 RM |
78 | # Optimization flag. Allow user to override. |
79 | if test "x$TARGET_CFLAGS" = x; then | |
80 | TARGET_CFLAGS="$TARGET_CFLAGS -Os" | |
81 | fi | |
82 | ||
76ed06b9 BC |
83 | # Default HOST_CPPFLAGS |
84 | HOST_CPPFLAGS="$HOST_CPPFLAGS -Wall -W" | |
76ed06b9 | 85 | HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_UTIL=1" |
76ed06b9 BC |
86 | |
87 | TARGET_CPPFLAGS="$TARGET_CPPFLAGS -Wall -W" | |
76ed06b9 | 88 | |
b977bf01 | 89 | case "$target_cpu" in |
02164e1b | 90 | i[[3456]]86) target_cpu=i386 ;; |
c7ef54aa | 91 | amd64) target_cpu=x86_64 ;; |
02164e1b | 92 | sparc) target_cpu=sparc64 ;; |
ade85305 | 93 | mipsel|mips64el) |
4d94b2db CW |
94 | target_cpu=mipsel |
95 | machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPSEL=1" | |
4a1eefb6 | 96 | ;; |
ade85305 | 97 | mips|mips64) |
4d94b2db CW |
98 | target_cpu=mips |
99 | machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPS=1" | |
4a1eefb6 | 100 | ;; |
389b31cd | 101 | arm*) |
4d94b2db | 102 | target_cpu=arm |
389b31cd | 103 | ;; |
15a463d7 | 104 | aarch64*) |
4d94b2db | 105 | target_cpu=arm64 |
15a463d7 | 106 | ;; |
6a161fa9 | 107 | esac |
108 | ||
05568c2e | 109 | # Specify the platform (such as firmware). |
110 | AC_ARG_WITH([platform], | |
111 | AS_HELP_STRING([--with-platform=PLATFORM], | |
83b984de | 112 | [select the host platform [[guessed]]])) |
05568c2e | 113 | |
114 | # Guess the platform if not specified. | |
115 | if test "x$with_platform" = x; then | |
b977bf01 | 116 | case "$target_cpu"-"$target_vendor" in |
05568c2e | 117 | i386-apple) platform=efi ;; |
118 | i386-*) platform=pc ;; | |
58393a2d | 119 | x86_64-apple) platform=efi ;; |
737feb35 | 120 | x86_64-*) platform=pc ;; |
05568c2e | 121 | powerpc-*) platform=ieee1275 ;; |
58393a2d | 122 | powerpc64-*) platform=ieee1275 ;; |
5c46165a | 123 | powerpc64le-*) platform=ieee1275 ;; |
05568c2e | 124 | sparc64-*) platform=ieee1275 ;; |
4959e111 VS |
125 | mipsel-*) platform=loongson ;; |
126 | mips-*) platform=arc ;; | |
e68d3b24 | 127 | ia64-*) platform=efi ;; |
389b31cd | 128 | arm-*) platform=uboot ;; |
15a463d7 | 129 | arm64-*) platform=efi ;; |
5d90f6e5 CW |
130 | *) |
131 | AC_MSG_WARN([unsupported CPU: "$target_cpu" - only building utilities]) | |
132 | platform=none | |
133 | ;; | |
05568c2e | 134 | esac |
135 | else | |
136 | platform="$with_platform" | |
137 | fi | |
138 | ||
ec1dfd63 VS |
139 | case "$target_cpu"-"$platform" in |
140 | x86_64-efi) ;; | |
141 | x86_64-emu) ;; | |
9612ebc0 | 142 | x86_64-xen) ;; |
5d90f6e5 | 143 | x86_64-none) ;; |
ec1dfd63 VS |
144 | x86_64-*) target_cpu=i386 ;; |
145 | powerpc64-ieee1275) target_cpu=powerpc ;; | |
5c46165a | 146 | powerpc64le-ieee1275) target_cpu=powerpc ;; |
ec1dfd63 | 147 | esac |
20011694 | 148 | |
58393a2d | 149 | # Check if the platform is supported, make final adjustments. |
b977bf01 | 150 | case "$target_cpu"-"$platform" in |
05568c2e | 151 | i386-efi) ;; |
3f4ce737 | 152 | x86_64-efi) ;; |
9612ebc0 | 153 | i386-xen) ;; |
d789e70e | 154 | i386-xen_pvh) ;; |
9612ebc0 | 155 | x86_64-xen) ;; |
05568c2e | 156 | i386-pc) ;; |
7210dca9 | 157 | i386-multiboot) ;; |
546f966a | 158 | i386-coreboot) ;; |
58393a2d | 159 | i386-linuxbios) platform=coreboot ;; |
3d04eab8 | 160 | i386-ieee1275) ;; |
8231fb77 | 161 | i386-qemu) ;; |
05568c2e | 162 | powerpc-ieee1275) ;; |
163 | sparc64-ieee1275) ;; | |
2c40cc78 | 164 | ia64-efi) ;; |
f440c33f | 165 | mips-qemu_mips) ;; |
3666d5f6 | 166 | mips-qemu-mips) platform=qemu_mips;; |
8906c3dd | 167 | mips-arc) ;; |
7f63a64f | 168 | mipsel-arc) ;; |
4959e111 VS |
169 | mipsel-qemu_mips) ;; |
170 | mipsel-qemu-mips) platform=qemu_mips;; | |
171 | mipsel-yeeloong) platform=loongson ;; | |
172 | mipsel-fuloong) platform=loongson ;; | |
173 | mipsel-loongson) ;; | |
389b31cd | 174 | arm-uboot) ;; |
24e37a88 | 175 | arm-coreboot) ;; |
389b31cd | 176 | arm-efi) ;; |
15a463d7 | 177 | arm64-efi) ;; |
f84b481b | 178 | *-emu) ;; |
5d90f6e5 | 179 | *-none) ;; |
58393a2d | 180 | *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;; |
6a161fa9 | 181 | esac |
182 | ||
48145ea3 | 183 | if test x$platform != xemu ; then |
dd614590 VS |
184 | case "$target_cpu" in |
185 | i386 | powerpc) target_m32=1 ;; | |
186 | x86_64 | sparc64) target_m64=1 ;; | |
187 | esac | |
188 | fi | |
3f4ce737 | 189 | |
eaf01c25 | 190 | if test x"$target_cpu-$platform" = xsparc64-emu ; then |
4d94b2db | 191 | target_m64=1 |
eaf01c25 VS |
192 | fi |
193 | ||
fc97214f | 194 | case "$target_os" in |
c3302aa5 | 195 | windows* | mingw32*) target_os=cygwin ;; |
fc97214f VS |
196 | esac |
197 | ||
9304eef1 | 198 | # This normalizes the names, and creates a new variable ("host_kernel") |
199 | # while at it, since the mapping is not always 1:1 (e.g. different OSes | |
200 | # using the same kernel type). | |
201 | case "$host_os" in | |
202 | gnu*) host_kernel=hurd ;; | |
203 | linux*) host_kernel=linux ;; | |
67937d4d | 204 | freebsd* | kfreebsd*-gnu) host_kernel=kfreebsd ;; |
2c7031b1 | 205 | netbsd*) host_kernel=netbsd ;; |
958ee221 | 206 | solaris*) host_kernel=illumos ;; |
b105df76 | 207 | darwin*) host_kernel=xnu ;; |
7e518ca8 | 208 | cygwin | windows* | mingw32*) host_kernel=windows ;; |
9304eef1 | 209 | esac |
210 | ||
cd46aa6c | 211 | case "$host_os" in |
5435aaac XG |
212 | cygwin) have_exec=y ;; |
213 | windows* | mingw32*) have_exec=n ;; | |
cd46aa6c VS |
214 | aros*) have_exec=n ;; |
215 | *) have_exec=y;; | |
216 | esac | |
217 | ||
f84b481b | 218 | case "$platform" in |
c721825b BC |
219 | coreboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_COREBOOT=1" ;; |
220 | multiboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MULTIBOOT=1" ;; | |
221 | efi) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EFI=1" ;; | |
9612ebc0 | 222 | xen) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_XEN=1" ;; |
d789e70e | 223 | xen_pvh) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_XEN_PVH=1" ;; |
c721825b | 224 | ieee1275) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_IEEE1275=1" ;; |
389b31cd | 225 | uboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_UBOOT=1" ;; |
c721825b BC |
226 | qemu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_QEMU=1" ;; |
227 | pc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_PCBIOS=1" ;; | |
228 | emu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EMU=1" ;; | |
0c930a84 VS |
229 | loongson) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_LOONGSON=1" ;; |
230 | qemu_mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_QEMU_MIPS=1" ;; | |
3666d5f6 | 231 | arc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_ARC=1" ;; |
f84b481b | 232 | esac |
4959e111 VS |
233 | if test x${target_cpu} = xmipsel ; then |
234 | machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo mips_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`" | |
235 | else | |
0c930a84 | 236 | machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`" |
4959e111 | 237 | fi |
6bea3f89 | 238 | |
7f63a64f VS |
239 | case "${target_cpu}-$platform" in |
240 | mips-arc) | |
241 | TARGET_LINK_ADDR=0x88200000 | |
242 | TARGET_DECOMPRESSOR_LINK_ADDR=0x88100000 | |
243 | ;; | |
244 | mipsel-arc) | |
245 | TARGET_LINK_ADDR=0x80700000 | |
246 | TARGET_DECOMPRESSOR_LINK_ADDR=0x80600000 | |
247 | ;; | |
5fe67f39 | 248 | mips*-qemu_mips | mips*-loongson) |
7f63a64f VS |
249 | TARGET_DECOMPRESSOR_LINK_ADDR=0x80100000 |
250 | ;; | |
251 | esac | |
252 | ||
253 | AC_SUBST(TARGET_LINK_ADDR) | |
254 | AC_SUBST(TARGET_DECOMPRESSOR_LINK_ADDR) | |
255 | ||
c721825b | 256 | TARGET_CPPFLAGS="$TARGET_CPPFLAGS $machine_CPPFLAGS" |
f84b481b | 257 | |
56978920 | 258 | AC_SUBST(host_cpu) |
259 | AC_SUBST(host_os) | |
9304eef1 | 260 | AC_SUBST(host_kernel) |
6e5a42fe | 261 | |
071114bb VS |
262 | AC_SUBST(target_cpu) |
263 | AC_SUBST(platform) | |
264 | ||
d87aedff | 265 | # Define default variables |
7134247c VS |
266 | |
267 | have_with_bootdir=n | |
268 | AC_ARG_WITH([bootdir], | |
269 | AS_HELP_STRING([--with-bootdir=DIR], | |
270 | [set the name of /boot directory [[guessed]]]), | |
271 | [have_with_bootdir=y], | |
272 | [have_with_bootdir=n]) | |
273 | if test x$have_with_bootdir = xy; then | |
274 | bootdirname="$with_bootdir" | |
275 | else | |
276 | case "$host_os" in | |
277 | netbsd* | openbsd*) | |
d87aedff | 278 | # Because /boot is used for the boot block in NetBSD and OpenBSD, |
7134247c VS |
279 | bootdirname='' ;; |
280 | *) bootdirname='boot' ;; | |
281 | esac | |
282 | fi | |
283 | ||
d87aedff | 284 | AC_SUBST(bootdirname) |
a4c1d277 | 285 | AC_DEFINE_UNQUOTED(GRUB_BOOT_DIR_NAME, "$bootdirname", |
a6c83d4a | 286 | [Default boot directory name]) |
d87aedff | 287 | |
7134247c VS |
288 | AC_ARG_WITH([grubdir], |
289 | AS_HELP_STRING([--with-grubdir=DIR], | |
290 | [set the name of grub directory [[guessed]]]), | |
291 | [grubdirname="$with_grubdir"], | |
292 | [grubdirname="$PACKAGE"]) | |
293 | ||
d87aedff | 294 | AC_SUBST(grubdirname) |
a4c1d277 YB |
295 | AC_DEFINE_UNQUOTED(GRUB_DIR_NAME, "$grubdirname", |
296 | [Default grub directory name]) | |
d87aedff | 297 | |
b977bf01 | 298 | # |
299 | # Checks for build programs. | |
300 | # | |
144f1f98 | 301 | |
6c826348 | 302 | # Although cmp is listed in the GNU Coding Standards as a command which |
303 | # can used directly, OpenBSD lacks cmp in the default installation. | |
304 | AC_CHECK_PROGS([CMP], [cmp]) | |
305 | if test "x$CMP" = x; then | |
306 | AC_MSG_ERROR([cmp is not found]) | |
307 | fi | |
308 | ||
144f1f98 | 309 | AC_CHECK_PROGS([YACC], [bison]) |
1569ec51 | 310 | if test "x$YACC" = x; then |
6c826348 | 311 | AC_MSG_ERROR([bison is not found]) |
1569ec51 | 312 | fi |
313 | ||
76ed06b9 | 314 | AC_PROG_RANLIB |
b977bf01 | 315 | AC_PROG_INSTALL |
316 | AC_PROG_AWK | |
09220190 | 317 | AC_PROG_LEX |
76ed06b9 | 318 | AC_PROG_YACC |
b977bf01 | 319 | AC_PROG_MAKE_SET |
ff420223 | 320 | AC_PROG_MKDIR_P |
e1fd1939 | 321 | AC_PROG_LN_S |
b977bf01 | 322 | |
c7c75cf4 | 323 | if test "x$LEX" = "x:"; then |
09220190 BC |
324 | AC_MSG_ERROR([flex is not found]) |
325 | else | |
a2618427 | 326 | version=`$LEX --version | $AWK '{ split($2,x,"."); print x[[1]]*10000+x[[2]]*100+x[[3]]; }'` |
b777c18e | 327 | if test -n "$version" -a "$version" -ge 20535; then |
09220190 BC |
328 | : |
329 | else | |
330 | AC_MSG_ERROR([flex is too old. GRUB requires 2.5.35 or above]) | |
331 | fi | |
332 | fi | |
333 | ||
68807e5f | 334 | # These are not a "must". |
51fa856c | 335 | AC_PATH_PROGS(MAKEINFO, makeinfo true) |
6a161fa9 | 336 | |
b977bf01 | 337 | # |
338 | # Checks for host programs. | |
339 | # | |
340 | ||
341 | AC_PROG_CC | |
15c69261 | 342 | gl_EARLY |
1eed0e6e | 343 | AC_PROG_CXX |
76ed06b9 BC |
344 | AM_PROG_CC_C_O |
345 | AM_PROG_AS | |
8b467844 | 346 | AM_PATH_PYTHON([2.6]) |
76ed06b9 | 347 | |
6a161fa9 | 348 | # Must be GCC. |
349 | test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required]) | |
350 | ||
1eed0e6e VS |
351 | AC_CHECK_PROG(HAVE_CXX, $CXX, yes, no) |
352 | ||
4889bdec | 353 | AC_GNU_SOURCE |
2f1a3acf | 354 | AM_GNU_GETTEXT([external]) |
b977bf01 | 355 | AC_SYS_LARGEFILE |
356 | ||
357 | # Identify characteristics of the host architecture. | |
7b780018 VS |
358 | unset ac_cv_c_bigendian |
359 | ||
eaf01c25 VS |
360 | if test x"$target_cpu-$platform" = xsparc64-emu ; then |
361 | CFLAGS="$CFLAGS -m64" | |
362 | HOST_CFLAGS="$HOST_CFLAGS -m64" | |
363 | fi | |
364 | ||
fc7a64bc VS |
365 | CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64" |
366 | HOST_CPPFLAGS="$HOST_CPPFLAGS -D_FILE_OFFSET_BITS=64" | |
367 | ||
b977bf01 | 368 | AC_C_BIGENDIAN |
369 | AC_CHECK_SIZEOF(void *) | |
370 | AC_CHECK_SIZEOF(long) | |
371 | ||
7e518ca8 VS |
372 | case "$host_os" in |
373 | cygwin | windows* | mingw32*) | |
374 | HOST_CPPFLAGS="$HOST_CPPFLAGS -DUNICODE=1 -D_WIN32_WINNT=0x0500" | |
375 | CPPFLAGS="$CPPFLAGS -DUNICODE=1 -D_WIN32_WINNT=0x0500" | |
376 | AC_CHECK_SIZEOF(TCHAR,,[#include <windows.h>]) | |
377 | ;; | |
378 | esac | |
379 | ||
3bac4caa FJ |
380 | case "$host_os" in |
381 | cygwin | windows* | mingw32* | aros*) | |
382 | ;; | |
383 | *) | |
384 | AC_CHECK_SIZEOF(off_t) | |
608bec51 VS |
385 | if test x"$ac_cv_sizeof_off_t" != x8 ; then |
386 | AC_CHECK_SIZEOF(off64_t) | |
387 | test x"$ac_cv_sizeof_off64_t" = x8 || AC_MSG_ERROR([Large file support is required]) | |
388 | fi;; | |
3bac4caa FJ |
389 | esac |
390 | ||
aad32b14 VS |
391 | if test x$USE_NLS = xno; then |
392 | HOST_CFLAGS="$HOST_CFLAGS -fno-builtin-gettext" | |
393 | fi | |
394 | ||
86695375 | 395 | if test "x$cross_compiling" = xyes; then |
396 | AC_MSG_WARN([cannot generate manual pages while cross compiling]) | |
397 | else | |
398 | AC_PATH_PROG(HELP2MAN, help2man) | |
399 | fi | |
400 | ||
3169f4c7 | 401 | # Check for functions and headers. |
0f7e980b | 402 | AC_CHECK_FUNCS(posix_memalign memalign getextmntent) |
7a5b301e | 403 | AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/mnttab.h limits.h) |
07662af7 AB |
404 | |
405 | # glibc 2.25 still includes sys/sysmacros.h in sys/types.h but emits deprecation | |
406 | # warning which causes compilation failure later with -Werror. So use -Werror here | |
407 | # as well to force proper sys/sysmacros.h detection. | |
408 | SAVED_CFLAGS="$CFLAGS" | |
409 | CFLAGS="$HOST_CFLAGS -Werror" | |
7a5b301e | 410 | AC_HEADER_MAJOR |
07662af7 | 411 | CFLAGS="$SAVED_CFLAGS" |
7c4e16ff | 412 | |
fb90b546 RM |
413 | AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$ac_includes_default |
414 | #include <sys/param.h> | |
415 | #include <sys/mount.h>]) | |
416 | ||
417 | AC_CHECK_MEMBERS([struct statfs.f_mntfromname],,,[$ac_includes_default | |
418 | #include <sys/param.h> | |
419 | #include <sys/mount.h>]) | |
420 | ||
2c7031b1 GS |
421 | # For opendisk() and getrawpartition() on NetBSD. |
422 | # Used in util/deviceiter.c and in util/hostdisk.c. | |
423 | AC_CHECK_HEADER([util.h], [ | |
424 | AC_CHECK_LIB([util], [opendisk], [ | |
425 | LIBUTIL="-lutil" | |
426 | AC_DEFINE(HAVE_OPENDISK, 1, [Define if opendisk() in -lutil can be used]) | |
427 | ]) | |
428 | AC_CHECK_LIB([util], [getrawpartition], [ | |
429 | LIBUTIL="-lutil" | |
430 | AC_DEFINE(HAVE_GETRAWPARTITION, 1, [Define if getrawpartition() in -lutil can be used]) | |
431 | ]) | |
432 | ]) | |
433 | AC_SUBST([LIBUTIL]) | |
434 | ||
19ce697d | 435 | AC_CACHE_CHECK([whether -Wtrampolines work], [grub_cv_host_cc_wtrampolines], [ |
00c05e22 | 436 | SAVED_CFLAGS="$CFLAGS" |
b35ec299 | 437 | CFLAGS="$HOST_CFLAGS -Wtrampolines -Werror" |
00c05e22 VS |
438 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h> |
439 | int va_arg_func (int fixed, va_list args);]], [[]])], | |
19ce697d VS |
440 | [grub_cv_host_cc_wtrampolines=yes], |
441 | [grub_cv_host_cc_wtrampolines=no]) | |
00c05e22 VS |
442 | CFLAGS="$SAVED_CFLAGS" |
443 | ]) | |
444 | ||
19ce697d VS |
445 | if test x"$grub_host_cv_cc_wtrampolines" = xyes ; then |
446 | HOST_CFLAGS="$HOST_CFLAGS -Wtrampolines" | |
00c05e22 VS |
447 | fi |
448 | ||
76ed06b9 BC |
449 | # |
450 | # Check for host and build compilers. | |
451 | # | |
452 | HOST_CC=$CC | |
816719c8 VS |
453 | AC_CHECK_PROGS(BUILD_CC, [gcc egcs cc]) |
454 | test -z "$BUILD_CC" && AC_MSG_ERROR([none of gcc, egcs and cc is found. set BUILD_CC manually.]) | |
b224c266 | 455 | BUILD_CPP="$BUILD_CC -E" |
76ed06b9 | 456 | |
29013cba VS |
457 | case "$build_os" in |
458 | haiku*) BUILD_LIBM= ;; | |
459 | *) BUILD_LIBM=-lm ;; | |
460 | esac | |
1ecf96fc AB |
461 | |
462 | dnl FIXME proper test seems to require too deep dive into Autoconf internals. | |
463 | dnl For now just list known platforms that we support. | |
464 | ||
465 | case "$build_os" in | |
466 | cygwin*|mingw32*|mingw64*) BUILD_EXEEXT=.exe ;; | |
467 | *) BUILD_EXEEXT= ;; | |
468 | esac | |
469 | AC_SUBST(BUILD_EXEEXT) | |
470 | ||
a827807a VS |
471 | # In some build environments like termux /bin/sh is not a valid |
472 | # shebang. Use $SHELL instead if it's executable and /bin/sh isn't | |
473 | BUILD_SHEBANG=/bin/sh | |
474 | for she in /bin/sh "$SHELL"; do | |
475 | if test -x "$she" ; then | |
476 | BUILD_SHEBANG="$she" | |
477 | fi | |
478 | done | |
479 | AC_SUBST(BUILD_SHEBANG) | |
480 | ||
15c69261 YB |
481 | # For gnulib. |
482 | gl_INIT | |
483 | ||
93bf55e6 | 484 | 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 -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtrigraphs -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wwrite-strings -Wnested-externs -Wstrict-prototypes" |
ae558c2c | 485 | EXTRA_WARN_FLAGS="-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 -Wmissing-include-dirs -Wmissing-prototypes -Wmissing-declarations -Wformat=2" |
60d5e9cb VS |
486 | |
487 | HOST_CFLAGS="$HOST_CFLAGS $WARN_FLAGS -Wcast-align" | |
488 | ||
489 | AC_CACHE_CHECK([which extra warnings work], [grub_cv_cc_w_extra_flags], [ | |
490 | SAVED_CFLAGS="$CFLAGS" | |
491 | grub_cv_cc_w_extra_flags= | |
492 | for x in $EXTRA_WARN_FLAGS; do | |
493 | CFLAGS="$HOST_CFLAGS $x -Werror" | |
494 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [flag=1], [flag=0]) | |
495 | if test x$flag = x1 ; then | |
496 | grub_cv_cc_w_extra_flags="$grub_cv_cc_w_extra_flags $x" | |
497 | fi | |
498 | done | |
499 | CFLAGS="$SAVED_CFLAGS" | |
500 | ]) | |
501 | ||
502 | HOST_CFLAGS="$HOST_CFLAGS $grub_cv_cc_w_extra_flags" | |
503 | ||
b977bf01 | 504 | # |
505 | # Check for target programs. | |
506 | # | |
507 | ||
5b5d4aa5 | 508 | # Find tools for the target. |
509 | if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then | |
b977bf01 | 510 | tmp_ac_tool_prefix="$ac_tool_prefix" |
511 | ac_tool_prefix=$target_alias- | |
512 | ||
513 | AC_CHECK_TOOLS(TARGET_CC, [gcc egcs cc], | |
514 | [AC_MSG_ERROR([none of gcc, egcs and cc is found. set TARGET_CC manually.])]) | |
fc97214f VS |
515 | AC_CHECK_TOOL(TARGET_OBJCOPY, objcopy) |
516 | AC_CHECK_TOOL(TARGET_STRIP, strip) | |
517 | AC_CHECK_TOOL(TARGET_NM, nm) | |
0e8daad0 | 518 | AC_CHECK_TOOL(TARGET_RANLIB, ranlib) |
b977bf01 | 519 | |
520 | ac_tool_prefix="$tmp_ac_tool_prefix" | |
521 | else | |
522 | if test "x$TARGET_CC" = x; then | |
523 | TARGET_CC=$CC | |
524 | fi | |
fc97214f VS |
525 | AC_CHECK_TOOL(TARGET_OBJCOPY, objcopy) |
526 | AC_CHECK_TOOL(TARGET_STRIP, strip) | |
527 | AC_CHECK_TOOL(TARGET_NM, nm) | |
0e8daad0 | 528 | AC_CHECK_TOOL(TARGET_RANLIB, ranlib) |
b977bf01 | 529 | fi |
fc97214f | 530 | |
76ed06b9 BC |
531 | AC_SUBST(HOST_CC) |
532 | AC_SUBST(BUILD_CC) | |
7c9d0c39 VS |
533 | AC_SUBST(BUILD_CFLAGS) |
534 | AC_SUBST(BUILD_CPPFLAGS) | |
dcecae1a | 535 | AC_SUBST(BUILD_LDFLAGS) |
b977bf01 | 536 | AC_SUBST(TARGET_CC) |
fc97214f | 537 | AC_SUBST(TARGET_NM) |
1bd73025 | 538 | AC_SUBST(TARGET_RANLIB) |
fc97214f VS |
539 | AC_SUBST(TARGET_STRIP) |
540 | AC_SUBST(TARGET_OBJCOPY) | |
b977bf01 | 541 | |
b977bf01 | 542 | # Test the C compiler for the target environment. |
543 | tmp_CC="$CC" | |
544 | tmp_CFLAGS="$CFLAGS" | |
545 | tmp_LDFLAGS="$LDFLAGS" | |
546 | tmp_CPPFLAGS="$CPPFLAGS" | |
aa6d7826 | 547 | tmp_LIBS="$LIBS" |
b977bf01 | 548 | CC="$TARGET_CC" |
549 | CFLAGS="$TARGET_CFLAGS" | |
550 | CPPFLAGS="$TARGET_CPPFLAGS" | |
551 | LDFLAGS="$TARGET_LDFLAGS" | |
aa6d7826 | 552 | LIBS="" |
b977bf01 | 553 | |
90d1e879 | 554 | # debug flags. |
4e27343f | 555 | TARGET_CFLAGS="$TARGET_CFLAGS $WARN_FLAGS -g -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations" |
76ed06b9 | 556 | TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g" |
6a161fa9 | 557 | |
c12936c5 VS |
558 | if test "x$target_cpu" != xi386 && test "x$target_cpu" != xx86_64; then |
559 | TARGET_CFLAGS="$TARGET_CFLAGS -Wcast-align" | |
560 | fi | |
561 | ||
6a7957f9 VS |
562 | TARGET_CC_VERSION="$(LC_ALL=C $TARGET_CC --version | head -n1)" |
563 | ||
60d5e9cb VS |
564 | AC_CACHE_CHECK([which extra warnings work], [grub_cv_target_cc_w_extra_flags], [ |
565 | LDFLAGS="$TARGET_LDFLAGS -nostdlib -static" | |
566 | ||
567 | grub_cv_target_cc_w_extra_flags= | |
568 | for x in $EXTRA_WARN_FLAGS; do | |
569 | CFLAGS="$TARGET_CFLAGS $x -Werror" | |
37378f74 VS |
570 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
571 | asm (".globl start; start:"); | |
572 | void __main (void); | |
573 | void __main (void) {} | |
574 | int main (void); | |
575 | ]], [[]])], [flag=1], [flag=0]) | |
60d5e9cb VS |
576 | if test x$flag = x1 ; then |
577 | grub_cv_target_cc_w_extra_flags="$grub_cv_target_cc_w_extra_flags $x" | |
578 | fi | |
579 | done | |
580 | ]) | |
581 | ||
582 | TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_w_extra_flags" | |
583 | ||
86f05f14 | 584 | AC_CACHE_CHECK([if compiling with clang], [grub_cv_cc_target_clang], |
b73b70eb VS |
585 | [ |
586 | CFLAGS="$TARGET_CFLAGS" | |
587 | AC_COMPILE_IFELSE( | |
60375a88 VS |
588 | [AC_LANG_PROGRAM([], [[ |
589 | #ifdef __clang__ | |
590 | #error "is clang" | |
591 | #endif | |
592 | ]])], | |
593 | [grub_cv_cc_target_clang=no], [grub_cv_cc_target_clang=yes])]) | |
594 | ||
a3645c12 | 595 | if test x$target_cpu = xpowerpc -o x$target_cpu = xmips; then |
5c46165a VS |
596 | AC_CACHE_CHECK([for options to get big-endian compilation], grub_cv_target_cc_big_endian, [ |
597 | grub_cv_target_cc_big_endian=no | |
a3645c12 AB |
598 | for cand in "-target $target_cpu -Wl,-EB" "-target $target_cpu" \ |
599 | "-target $target_cpu-linux-gnu -Wl,-EB" "-target $target_cpu-linux-gnu" \ | |
600 | "-EB" "-mbig-endian"; do | |
5c46165a VS |
601 | if test x"$grub_cv_target_cc_big_endian" != xno ; then |
602 | break | |
603 | fi | |
604 | CFLAGS="$TARGET_CFLAGS $cand -Werror" | |
605 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ | |
606 | #if defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && (__ORDER_BIG_ENDIAN__ != __BYTE_ORDER__) | |
607 | #error still little endian | |
608 | #endif | |
609 | asm (".globl start; start:"); | |
a3645c12 AB |
610 | asm (".globl _start; _start:"); |
611 | asm (".globl __start; __start:"); | |
5c46165a VS |
612 | void __main (void); |
613 | void __main (void) {} | |
614 | int main (void); | |
615 | ]], [[]])], | |
616 | [grub_cv_target_cc_big_endian="$cand"], []) | |
617 | done | |
618 | ]) | |
619 | ||
620 | if test x"$grub_cv_target_cc_big_endian" = xno ; then | |
621 | AC_MSG_ERROR([could not force big-endian]) | |
622 | fi | |
623 | ||
624 | skip_linkflags="$(echo "$grub_cv_target_cc_big_endian"|sed 's@-Wl,-EB@@')" | |
625 | ||
626 | TARGET_CFLAGS="$TARGET_CFLAGS $skip_linkflags" | |
627 | TARGET_CPPFLAGS="$TARGET_CPPFLAGS $skip_linkflags" | |
628 | TARGET_CCASFLAGS="$TARGET_CCASFLAGS $skip_linkflags" | |
629 | TARGET_LDFLAGS="$TARGET_LDFLAGS $grub_cv_target_cc_big_endian" | |
a3645c12 AB |
630 | elif test x$target_cpu = xmipsel; then |
631 | AC_CACHE_CHECK([for options to get little-endian compilation], grub_cv_target_cc_little_endian, [ | |
632 | grub_cv_target_cc_little_endian=no | |
633 | for cand in "-target $target_cpu -Wl,-EL" "-target $target_cpu" \ | |
634 | "-target $target_cpu-linux-gnu -Wl,-EL" "-target $target_cpu-linux-gnu" \ | |
635 | "-EL"; do | |
636 | if test x"$grub_cv_target_cc_little_endian" != xno ; then | |
637 | break | |
638 | fi | |
639 | CFLAGS="$TARGET_CFLAGS $cand -Werror" | |
640 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ | |
641 | #if defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && (__ORDER_BIG_ENDIAN__ == __BYTE_ORDER__) | |
642 | #error still big endian | |
643 | #endif | |
644 | asm (".globl start; start:"); | |
645 | asm (".globl _start; _start:"); | |
646 | asm (".globl __start; __start:"); | |
647 | void __main (void); | |
648 | void __main (void) {} | |
649 | int main (void); | |
650 | ]], [[]])], | |
651 | [grub_cv_target_cc_little_endian="$cand"], []) | |
652 | done | |
653 | ]) | |
654 | ||
655 | if test x"$grub_cv_target_cc_little_endian" = xno ; then | |
656 | AC_MSG_ERROR([could not force little-endian]) | |
657 | fi | |
658 | ||
659 | skip_linkflags="$(echo "$grub_cv_target_cc_little_endian"|sed 's@-Wl,-EL@@')" | |
660 | ||
661 | TARGET_CFLAGS="$TARGET_CFLAGS $skip_linkflags" | |
662 | TARGET_CPPFLAGS="$TARGET_CPPFLAGS $skip_linkflags" | |
663 | TARGET_CCASFLAGS="$TARGET_CCASFLAGS $skip_linkflags" | |
664 | TARGET_LDFLAGS="$TARGET_LDFLAGS $grub_cv_target_cc_little_endian" | |
5c46165a VS |
665 | fi |
666 | ||
be25d921 AB |
667 | # GRUB code is N32-compliant but it's experimental and we would prefer to |
668 | # avoid having too much variety when it doesn't result in any real improvement. | |
669 | # Moreover N64 isn't supported. | |
670 | if test "x$target_cpu" = xmips || test "x$target_cpu" = xmipsel ; then | |
671 | AC_CACHE_CHECK([for options to force MIPS o32 ABI], grub_cv_target_cc_mips_o32_abi, [ | |
672 | grub_cv_target_cc_mips_o32_abi=no | |
673 | for arg in "" "-mabi=32" "-target $target_cpu -mabi=32" ; do | |
674 | if test x"$grub_cv_target_cc_mips_o32_abi" != xno ; then | |
675 | break | |
676 | fi | |
677 | CFLAGS="$TARGET_CFLAGS $arg -Werror" | |
678 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ | |
679 | #if !defined(_ABIO32) || !defined(_MIPS_SIM) || (_MIPS_SIM != _ABIO32) | |
680 | #error not o32 ABI | |
681 | #endif | |
682 | asm (".globl start; start:"); | |
683 | asm (".globl _start; _start:"); | |
684 | asm (".globl __start; __start:"); | |
685 | void __main (void); | |
686 | void __main (void) {} | |
687 | int main (void); | |
688 | ]], [[]])], | |
689 | [grub_cv_target_cc_mips_o32_abi="$arg"], []) | |
690 | done | |
691 | ]) | |
692 | ||
693 | if test x"$grub_cv_target_cc_mips_o32_abi" = xno ; then | |
694 | AC_MSG_ERROR([could not force MIPS o32 ABI]) | |
695 | fi | |
696 | ||
697 | TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_mips_o32_abi" | |
698 | TARGET_CCASFLAGS="$TARGET_CCASFLAGS $grub_cv_target_cc_mips_o32_abi" | |
699 | fi | |
700 | ||
065ad910 VS |
701 | AC_CACHE_CHECK([for options to compile assembly], [grub_cv_cc_target_asm_compile], [ |
702 | test_program= | |
f16b8c04 VS |
703 | case "x$target_cpu-$platform" in |
704 | xmips-* | xmipsel-*) | |
065ad910 VS |
705 | test_program=mips |
706 | ;; | |
f16b8c04 VS |
707 | xi386-pc) |
708 | test_program=i386-pc | |
709 | ;; | |
710 | xi386-* | xx86_64-*) | |
065ad910 VS |
711 | test_program=i386 |
712 | ;; | |
f16b8c04 | 713 | xpowerpc-* | xsparc64-* | xarm-*) |
065ad910 VS |
714 | test_program=$target_cpu |
715 | ;; | |
716 | esac | |
717 | if test x"$test_program" = x ; then | |
718 | grub_cv_cc_target_asm_compile= | |
719 | else | |
720 | found=no | |
721 | for arg in "" "-no-integrated-as"; do | |
722 | cmdline="$TARGET_CC -c -o /dev/null $TARGET_CCASFLAGS $arg $TARGET_CPPFLAGS $srcdir/asm-tests/$test_program.S" | |
723 | echo "Running $cmdline" >&AS_MESSAGE_LOG_FD | |
724 | if $cmdline >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then | |
725 | grub_cv_cc_target_asm_compile="$arg" | |
726 | found=yes | |
727 | break | |
728 | fi | |
729 | done | |
730 | if test x"$found" = xno ; then | |
731 | AC_MSG_ERROR([could not compile assembly]) | |
732 | fi | |
60375a88 | 733 | fi |
065ad910 | 734 | ]) |
60375a88 | 735 | |
065ad910 | 736 | TARGET_CCASFLAGS="$TARGET_CCASFLAGS $grub_cv_cc_target_asm_compile" |
b73b70eb | 737 | |
60375a88 VS |
738 | if test "x$target_cpu" = xi386 && test "x$platform" != xemu; then |
739 | TARGET_CFLAGS="$TARGET_CFLAGS -march=i386" | |
740 | fi | |
741 | ||
742 | if test "x$target_m32" = x1; then | |
743 | # Force 32-bit mode. | |
744 | TARGET_CFLAGS="$TARGET_CFLAGS -m32" | |
745 | TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m32" | |
746 | TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m32" | |
747 | TARGET_LDFLAGS="$TARGET_LDFLAGS -m32" | |
748 | TARGET_MODULE_FORMAT="elf32" | |
749 | fi | |
750 | ||
751 | if test "x$target_m64" = x1; then | |
752 | # Force 64-bit mode. | |
753 | TARGET_CFLAGS="$TARGET_CFLAGS -m64" | |
754 | TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m64" | |
755 | TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m64" | |
756 | TARGET_LDFLAGS="$TARGET_LDFLAGS -m64" | |
757 | TARGET_MODULE_FORMAT="elf64" | |
758 | fi | |
759 | ||
760 | if test "x$grub_cv_cc_target_clang" = xno && test "x$target_cpu" = xi386 && test "x$platform" != xemu && test "x$platform" != xefi; then | |
761 | TARGET_CFLAGS="$TARGET_CFLAGS -mrtd -mregparm=3" | |
762 | fi | |
763 | ||
f93ddcfd VS |
764 | # on mips redirect cache flushing function to non-existant one. |
765 | if test "x$target_cpu" = xmips || test "x$target_cpu" = xmipsel ; then | |
766 | AC_CACHE_CHECK([whether -mflush-func=grub_red_herring works], [grub_cv_cc_mflush_func], [ | |
767 | CFLAGS="$TARGET_CFLAGS -mflush-func=grub_red_herring -Werror" | |
768 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], | |
769 | [grub_cv_cc_mflush_func=yes], | |
770 | [grub_cv_cc_mflush_func=no]) | |
771 | ]) | |
772 | ||
773 | if test "x$grub_cv_cc_mflush_func" = xyes; then | |
774 | TARGET_CFLAGS="$TARGET_CFLAGS -mflush-func=grub_red_herring" | |
775 | fi | |
776 | fi | |
777 | ||
778 | ||
90d1e879 RM |
779 | # Force no alignment to save space on i386. |
780 | if test "x$target_cpu" = xi386; then | |
781 | AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [ | |
b35ec299 | 782 | CFLAGS="$TARGET_CFLAGS -falign-loops=1 -Werror" |
eb73121d | 783 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], |
90d1e879 RM |
784 | [grub_cv_cc_falign_loop=yes], |
785 | [grub_cv_cc_falign_loop=no]) | |
6a161fa9 | 786 | ]) |
6a161fa9 | 787 | |
c966a489 | 788 | AC_CACHE_CHECK([whether -malign-loops works], [grub_cv_cc_malign_loop], [ |
b35ec299 | 789 | CFLAGS="$TARGET_CFLAGS -malign-loops=1 -Werror" |
c966a489 VS |
790 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], |
791 | [grub_cv_cc_malign_loop=yes], | |
792 | [grub_cv_cc_malign_loop=no]) | |
793 | ]) | |
794 | ||
90d1e879 RM |
795 | if test "x$grub_cv_cc_falign_loop" = xyes; then |
796 | TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1" | |
c966a489 | 797 | elif test "x$grub_cv_cc_malign_loop" = xyes; then |
90d1e879 | 798 | TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1" |
6a161fa9 | 799 | fi |
89e0240c | 800 | fi |
6a161fa9 | 801 | |
cdc17f60 VS |
802 | AC_CACHE_CHECK([whether -freg-struct-return works], [grub_cv_cc_freg_struct_return], [ |
803 | CFLAGS="$TARGET_CFLAGS -freg-struct-return -Werror" | |
804 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], | |
805 | [grub_cv_cc_freg_struct_return=yes], | |
806 | [grub_cv_cc_freg_struct_return=no]) | |
807 | ]) | |
808 | ||
809 | if test "x$grub_cv_cc_freg_struct_return" = xyes; then | |
810 | TARGET_CFLAGS="$TARGET_CFLAGS -freg-struct-return" | |
811 | fi | |
812 | ||
ee0220bc | 813 | if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$platform" != xemu; then |
90d1e879 RM |
814 | # Some toolchains enable these features by default, but they need |
815 | # registers that aren't set up properly in GRUB. | |
cd6d79cd | 816 | TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow" |
90d1e879 | 817 | fi |
77c55a87 | 818 | |
3661261f VS |
819 | # GRUB doesn't use float or doubles at all. Yet some toolchains may decide |
820 | # that floats are a good fit to run instead of what's written in the code. | |
821 | # Given that floating point unit is disabled (if present to begin with) | |
822 | # when GRUB is running which may result in various hard crashes. | |
ebe316e4 VS |
823 | if test x"$platform" != xemu ; then |
824 | AC_CACHE_CHECK([for options to get soft-float], grub_cv_target_cc_soft_float, [ | |
825 | grub_cv_target_cc_soft_float=no | |
826 | if test "x$target_cpu" = xarm64; then | |
43d42314 | 827 | CFLAGS="$TARGET_CFLAGS -mgeneral-regs-only -Werror" |
ebe316e4 | 828 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], |
43d42314 | 829 | [grub_cv_target_cc_soft_float="-mgeneral-regs-only"], []) |
ebe316e4 | 830 | fi |
ea39b87a VS |
831 | if test "x$target_cpu" = xia64; then |
832 | CFLAGS="$TARGET_CFLAGS -mno-inline-float-divide -mno-inline-sqrt -Werror" | |
833 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], | |
834 | [grub_cv_target_cc_soft_float="-mno-inline-float-divide -mno-inline-sqrt"], []) | |
835 | fi | |
6a4ecd27 VS |
836 | for cand in "-msoft-float -Xclang -msoft-float -Xclang -no-implicit-float" \ |
837 | "-Xclang -msoft-float -Xclang -no-implicit-float" \ | |
ebe316e4 VS |
838 | "-Xclang -msoft-float" "-msoft-float"; do |
839 | if test x"$grub_cv_target_cc_soft_float" != xno ; then | |
840 | break | |
841 | fi | |
842 | CFLAGS="$TARGET_CFLAGS $cand -Werror" | |
843 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], | |
844 | [grub_cv_target_cc_soft_float="$cand"], []) | |
845 | done | |
846 | ]) | |
847 | ||
848 | if test x"$grub_cv_target_cc_soft_float" = xno ; then | |
849 | AC_MSG_ERROR([could not force soft-float]) | |
850 | fi | |
851 | ||
852 | case x"$grub_cv_target_cc_soft_float" in | |
6a4ecd27 | 853 | x*"-Xclang"*) |
ebe316e4 VS |
854 | # A trick so that clang doesn't see it on link stаge |
855 | TARGET_CPPFLAGS="$TARGET_CPPFLAGS $grub_cv_target_cc_soft_float" | |
856 | ;; | |
857 | *) | |
858 | TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_soft_float" | |
859 | ;; | |
860 | esac | |
43d42314 | 861 | TARGET_CCASFLAGS="$TARGET_CCASFLAGS $grub_cv_target_cc_soft_float" |
345076a7 | 862 | |
2da4171e | 863 | fi |
3661261f | 864 | |
155f334f VS |
865 | if test x"$target_cpu" = xsparc64 ; then |
866 | AC_CACHE_CHECK([for options to reserve application registers], grub_cv_target_cc_mno_app_regs, [ | |
867 | grub_cv_target_cc_mno_app_regs=no | |
868 | for cand in "-mllvm -sparc-reserve-app-registers" \ | |
869 | "-mno-app-regs"; do | |
870 | if test x"$grub_cv_target_cc_mno_app_regs" != xno ; then | |
871 | break | |
872 | fi | |
873 | CFLAGS="$TARGET_CFLAGS $cand -Werror" | |
aa6ccc05 | 874 | CPPFLAGS="$TARGET_CPPFLAGS" |
155f334f VS |
875 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], |
876 | [grub_cv_target_cc_mno_app_regs="$cand"], []) | |
877 | done | |
878 | ]) | |
879 | ||
880 | if test x"$grub_cv_target_cc_mno_app_regs" = xno ; then | |
881 | AC_MSG_ERROR([could not reserve application registers]) | |
882 | fi | |
883 | if test x"$grub_cv_target_cc_mno_app_regs" = x"-mllvm -sparc-reserve-app-registers" ; then | |
884 | # A trick so that clang doesn't see it on link stаge | |
885 | TARGET_CPPFLAGS="$TARGET_CPPFLAGS $grub_cv_target_cc_mno_app_regs" | |
886 | else | |
887 | TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_mno_app_regs" | |
888 | fi | |
889 | ||
890 | AC_CACHE_CHECK([for no-relax options], grub_cv_target_cc_mno_relax, [ | |
891 | grub_cv_target_cc_mno_relax=no | |
892 | for cand in "-mno-relax" "-Wl,--no-relax"; do | |
893 | if test x"$grub_cv_target_cc_mno_relax" != xno ; then | |
894 | break | |
895 | fi | |
896 | LDFLAGS="$TARGET_LDFLAGS $cand -nostdlib -static" | |
897 | CFLAGS="$TARGET_CFLAGS -Werror" | |
898 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ | |
899 | asm (".globl start; start:"); | |
900 | void __main (void); | |
901 | void __main (void) {} | |
902 | int main (void); | |
903 | ]], [[]])], [grub_cv_target_cc_mno_relax="$cand"], []) | |
904 | done | |
905 | ]) | |
906 | LDFLAGS="$TARGET_LDFLAGS" | |
907 | CFLAGS="$TARGET_CFLAGS" | |
908 | ||
909 | if test x"$grub_cv_target_cc_mno_relax" = xno ; then | |
910 | AC_MSG_ERROR([could not find no-relax options]) | |
911 | fi | |
912 | TARGET_LDFLAGS="$TARGET_LDFLAGS $grub_cv_target_cc_mno_relax" | |
913 | fi | |
914 | ||
90d1e879 RM |
915 | # By default, GCC 4.4 generates .eh_frame sections containing unwind |
916 | # information in some cases where it previously did not. GRUB doesn't need | |
917 | # these and they just use up vital space. Restore the old compiler | |
918 | # behaviour. | |
919 | AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [ | |
24f4e57c | 920 | CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm" |
90d1e879 RM |
921 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], |
922 | [grub_cv_cc_fno_dwarf2_cfi_asm=yes], | |
923 | [grub_cv_cc_fno_dwarf2_cfi_asm=no]) | |
90d1e879 | 924 | ]) |
77c55a87 | 925 | |
90d1e879 RM |
926 | if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then |
927 | TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm" | |
b977bf01 | 928 | fi |
6a161fa9 | 929 | |
1c1f31e5 VS |
930 | if test x"$target_os" = xcygwin; then |
931 | AC_CACHE_CHECK([whether option -fno-reorder-functions works], grub_cv_cc_no_reorder_functions, [ | |
24f4e57c | 932 | CFLAGS="$TARGET_CFLAGS -fno-reorder-functions" |
1c1f31e5 VS |
933 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], |
934 | [grub_cv_cc_no_reorder_functions=yes], | |
935 | [grub_cv_cc_no_reorder_functions=no]) | |
936 | ]) | |
937 | fi | |
938 | ||
939 | if test x"$target_os" = xcygwin && test "x$grub_cv_cc_no_reorder_functions" = xyes; then | |
940 | TARGET_CFLAGS="$TARGET_CFLAGS -fno-reorder-functions" | |
941 | fi | |
942 | ||
f1b35253 VS |
943 | AC_CACHE_CHECK([whether -mno-stack-arg-probe works], [grub_cv_cc_mno_stack_arg_probe], [ |
944 | CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe" | |
945 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], | |
946 | [grub_cv_cc_mno_stack_arg_probe=yes], | |
947 | [grub_cv_cc_mno_stack_arg_probe=no]) | |
948 | ]) | |
949 | ||
950 | if test "x$grub_cv_cc_mno_stack_arg_probe" = xyes; then | |
951 | TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe" | |
952 | fi | |
953 | ||
954 | ||
e9d3421c VS |
955 | # By default, GCC 4.6 generates .eh_frame sections containing unwind |
956 | # information in some cases where it previously did not. GRUB doesn't need | |
957 | # these and they just use up vital space. Restore the old compiler | |
958 | # behaviour. | |
959 | AC_CACHE_CHECK([whether -fno-asynchronous-unwind-tables works], [grub_cv_cc_fno_asynchronous_unwind_tables], [ | |
5ae590b3 | 960 | CFLAGS="$TARGET_CFLAGS -fno-asynchronous-unwind-tables" |
e9d3421c VS |
961 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], |
962 | [grub_cv_cc_fno_asynchronous_unwind_tables=yes], | |
963 | [grub_cv_cc_fno_asynchronous_unwind_tables=no]) | |
e9d3421c VS |
964 | ]) |
965 | ||
966 | if test "x$grub_cv_cc_fno_asynchronous_unwind_tables" = xyes; then | |
967 | TARGET_CFLAGS="$TARGET_CFLAGS -fno-asynchronous-unwind-tables" | |
968 | fi | |
969 | ||
40051fed VS |
970 | AC_CACHE_CHECK([whether -fno-unwind-tables works], [grub_cv_cc_fno_unwind_tables], [ |
971 | CFLAGS="$TARGET_CFLAGS -fno-unwind-tables" | |
972 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], | |
973 | [grub_cv_cc_fno_unwind_tables=yes], | |
974 | [grub_cv_cc_fno_unwind_tables=no]) | |
975 | ]) | |
976 | ||
977 | if test "x$grub_cv_cc_fno_unwind_tables" = xyes; then | |
978 | TARGET_CFLAGS="$TARGET_CFLAGS -fno-unwind-tables" | |
979 | fi | |
980 | ||
30c7d3ce | 981 | |
a9f25a08 VS |
982 | CFLAGS="$TARGET_CFLAGS" |
983 | ||
bf082198 VS |
984 | |
985 | if test x"$platform" = xemu ; then | |
986 | TARGET_OBJ2ELF= | |
987 | grub_cv_target_cc_link_format= | |
988 | case "$host_os" in | |
989 | *darwin* | *mac*) | |
990 | grub_cv_target_cc_link_format="-arch,${target_cpu}" | |
991 | TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format" | |
992 | ;; | |
993 | *windows* | *cygwin* | *mingw*) | |
994 | if test x${target_cpu} = xi386 ; then | |
4d94b2db CW |
995 | grub_cv_target_cc_link_format=-mi386pe |
996 | TARGET_OBJ2ELF='./build-grub-pe2elf$(BUILD_EXEEXT)' | |
bf082198 VS |
997 | fi |
998 | if test x${target_cpu} = xx86_64 ; then | |
4d94b2db CW |
999 | grub_cv_target_cc_link_format=-mi386pep |
1000 | TARGET_OBJ2ELF='./build-grub-pep2elf$(BUILD_EXEEXT)' | |
bf082198 VS |
1001 | fi |
1002 | TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format" | |
1003 | ;; | |
1004 | esac | |
1005 | elif test x"$target_cpu" = xi386 || test x"$target_cpu" = xx86_64; then | |
c2b70d09 | 1006 | AC_CACHE_CHECK([for target linking format], [grub_cv_target_cc_link_format], [ |
a9f25a08 | 1007 | grub_cv_target_cc_link_format=unknown |
6f1f6a0c | 1008 | for format in -melf_${target_cpu} -melf_${target_cpu}_fbsd -melf_${target_cpu}_obsd -melf_${target_cpu}_haiku -mi386pe -mi386pep -arch,${target_cpu}; do |
bf082198 | 1009 | if test x${target_cpu} != xi386 && test x$format = x-mi386pe; then |
6f1f6a0c VS |
1010 | continue |
1011 | fi | |
bf082198 | 1012 | if test x${target_cpu} != xx86_64 && test x$format = x-mi386pep; then |
a9f25a08 VS |
1013 | continue |
1014 | fi | |
246a434f VS |
1015 | CFLAGS="$TARGET_CFLAGS" |
1016 | LDFLAGS="$TARGET_LDFLAGS -Wl,$format -nostdlib -static" | |
a9f25a08 VS |
1017 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
1018 | asm (".globl start; start:"); | |
1019 | asm (".globl _start; _start:"); | |
1020 | asm (".globl __start; __start:"); | |
1021 | void __main (void); | |
1022 | void __main (void) {} | |
c2b70d09 | 1023 | ]], [[]])], [flag=1], [flag=0]) |
a9f25a08 VS |
1024 | if test x"$flag" = x1; then |
1025 | grub_cv_target_cc_link_format="$format" | |
4d94b2db | 1026 | break |
a9f25a08 VS |
1027 | fi |
1028 | done]) | |
1029 | if test x"$grub_cv_target_cc_link_format" = xunknown; then | |
1030 | AC_MSG_ERROR([no suitable link format found]) | |
1031 | fi | |
1032 | TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format" | |
6f1f6a0c | 1033 | if test x"$grub_cv_target_cc_link_format" = x-mi386pe ; then |
4d94b2db | 1034 | TARGET_OBJ2ELF='./build-grub-pe2elf$(BUILD_EXEEXT)' |
a9f25a08 | 1035 | fi |
6f1f6a0c | 1036 | if test x"$grub_cv_target_cc_link_format" = x-mi386pep ; then |
4d94b2db | 1037 | TARGET_OBJ2ELF='./build-grub-pep2elf$(BUILD_EXEEXT)' |
6f1f6a0c | 1038 | fi |
a9f25a08 VS |
1039 | fi |
1040 | ||
1041 | 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 | |
1042 | TARGET_APPLE_LINKER=1 | |
1043 | AC_CHECK_PROG([TARGET_OBJCONV], [objconv], [objconv], []) | |
1044 | if test "x$TARGET_OBJCONV" = x ; then | |
1045 | AC_CHECK_PROG([TARGET_OBJCONV], [objconv], [./objconv], [], [.]) | |
1046 | fi | |
1047 | if test "x$TARGET_OBJCONV" = x ; then | |
1048 | AC_MSG_ERROR([objconv not found which is required when building with apple compiler]) | |
1049 | fi | |
1050 | TARGET_IMG_LDSCRIPT= | |
1051 | TARGET_IMG_CFLAGS="-static" | |
1052 | TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20' | |
1053 | TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20' | |
1054 | TARGET_IMG_BASE_LDOPT="-Wl,-image_base" | |
1055 | TARGET_LDFLAGS_OLDMAGIC="" | |
6f1f6a0c | 1056 | elif test x$grub_cv_target_cc_link_format = x-mi386pe || test x$grub_cv_target_cc_link_format = x-mi386pep ; then |
a9f25a08 VS |
1057 | TARGET_APPLE_LINKER=0 |
1058 | TARGET_LDFLAGS_OLDMAGIC="-Wl,-N" | |
60b967be | 1059 | TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/${grub_coredir}/conf/i386-cygwin-img-ld.sc" |
a9f25a08 | 1060 | TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT}" |
60b967be | 1061 | TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/${grub_coredir}/conf/i386-cygwin-img-ld.sc" |
a9f25a08 VS |
1062 | TARGET_IMG_BASE_LDOPT="-Wl,-Ttext" |
1063 | TARGET_IMG_CFLAGS= | |
1064 | else | |
1065 | TARGET_APPLE_LINKER=0 | |
1066 | TARGET_LDFLAGS_OLDMAGIC="-Wl,-N" | |
1067 | TARGET_IMG_LDSCRIPT= | |
1068 | TARGET_IMG_LDFLAGS='-Wl,-N' | |
1069 | TARGET_IMG_LDFLAGS_AC='-Wl,-N' | |
1070 | TARGET_IMG_BASE_LDOPT="-Wl,-Ttext" | |
1071 | TARGET_IMG_CFLAGS= | |
1072 | fi | |
1073 | ||
80fdaf1d VS |
1074 | CFLAGS="$TARGET_CFLAGS" |
1075 | ||
1076 | AC_ARG_ENABLE([efiemu], | |
1077 | [AS_HELP_STRING([--enable-efiemu], | |
1078 | [build and install the efiemu runtimes (default=guessed)])]) | |
1079 | if test x"$enable_efiemu" = xno ; then | |
1080 | efiemu_excuse="explicitly disabled" | |
1081 | fi | |
1082 | ||
1083 | if test x"$grub_cv_target_cc_link_format" = x-mi386pe || test x"$grub_cv_target_cc_link_format" = x-mi386pep ; then | |
1084 | efiemu_excuse="not available on cygwin" | |
1085 | fi | |
1086 | if test x"$target_cpu" != xi386 ; then | |
1087 | efiemu_excuse="only available on i386" | |
1088 | fi | |
1089 | if test x"$platform" = xefi ; then | |
1090 | efiemu_excuse="not available on efi" | |
1091 | fi | |
1092 | ||
1093 | if test x"$efiemu_excuse" = x ; then | |
1094 | AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [ | |
1095 | CFLAGS="-m64 -nostdlib -O2 -mcmodel=large -mno-red-zone" | |
1096 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], | |
1097 | [grub_cv_cc_efiemu=yes], | |
1098 | [grub_cv_cc_efiemu=no]) | |
1099 | ]) | |
1100 | if test x$grub_cv_cc_efiemu = xno; then | |
1101 | efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib" | |
1102 | fi | |
1103 | fi | |
1104 | if test x"$efiemu_excuse" = x ; then | |
1105 | AC_CACHE_CHECK([for efiemu64 linking format], [grub_cv_target_cc_efiemu64_link_format], [ | |
1106 | grub_cv_target_cc_efiemu64_link_format=unknown | |
1107 | for format in -melf_x86_64 -melf_x86_64_fbsd -melf_x86_64_obsd -melf_x86_64_haiku -arch,x86_64; do | |
1108 | CFLAGS="-m64 -nostdlib -O2 -mcmodel=large -mno-red-zone" | |
1109 | LDFLAGS="-m64 -Wl,$format -nostdlib -static" | |
1110 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ | |
1111 | asm (".globl start; start:"); | |
1112 | asm (".globl _start; _start:"); | |
1113 | asm (".globl __start; __start:"); | |
1114 | void __main (void); | |
1115 | void __main (void) {} | |
1116 | ]], [[]])], [flag=1], [flag=0]) | |
1117 | if test x"$flag" = x1; then | |
1118 | grub_cv_target_cc_efiemu64_link_format="$format" | |
1119 | break | |
1120 | fi | |
1121 | done]) | |
1122 | if test x"$grub_cv_target_cc_efiemu64_link_format" = xunknown; then | |
1123 | efiemu_excuse="no suitable link format for efiemu64 found" | |
1124 | else | |
1125 | EFIEMU64_LINK_FORMAT="-Wl,$grub_cv_target_cc_efiemu64_link_format" | |
1126 | fi | |
1127 | fi | |
1128 | if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then | |
1129 | AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled ($efiemu_excuse)]) | |
1130 | fi | |
1131 | if test x"$efiemu_excuse" = x ; then | |
1132 | enable_efiemu=yes | |
1133 | else | |
1134 | enable_efiemu=no | |
1135 | fi | |
1136 | AC_SUBST([enable_efiemu]) | |
1137 | AC_SUBST([EFIEMU64_LINK_FORMAT]) | |
1138 | ||
1139 | CFLAGS="$TARGET_CFLAGS" | |
1140 | ||
a9f25a08 VS |
1141 | AC_SUBST(TARGET_LDFLAGS_OLDMAGIC) |
1142 | ||
1143 | ||
1144 | LDFLAGS="$TARGET_LDFLAGS" | |
8f0baaac | 1145 | |
155f334f | 1146 | if test "$target_cpu" = x86_64 || test "$target_cpu" = sparc64 ; then |
7e9ca17a | 1147 | # Use large model to support 4G memory |
6e09b8b7 | 1148 | AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [ |
2a5a532c | 1149 | CFLAGS="$TARGET_CFLAGS -mcmodel=large" |
6e09b8b7 | 1150 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], |
1151 | [grub_cv_cc_mcmodel=yes], | |
1152 | [grub_cv_cc_mcmodel=no]) | |
1153 | ]) | |
a3ba7410 | 1154 | if test "x$grub_cv_cc_mcmodel" = xyes; then |
c8600122 | 1155 | TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large" |
155f334f | 1156 | elif test "$target_cpu" = sparc64; then |
eaf01c25 | 1157 | TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=medany" |
6e09b8b7 | 1158 | fi |
46546fc5 | 1159 | fi |
7e9ca17a | 1160 | |
46546fc5 | 1161 | if test "$target_cpu"-"$platform" = x86_64-efi; then |
7e9ca17a | 1162 | # EFI writes to stack below %rsp, we must not use the red zone |
1163 | AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [ | |
2a5a532c | 1164 | CFLAGS="$TARGET_CFLAGS -mno-red-zone" |
7e9ca17a | 1165 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], |
1166 | [grub_cv_cc_no_red_zone=yes], | |
1167 | [grub_cv_cc_no_red_zone=no]) | |
1168 | ]) | |
1169 | if test "x$grub_cv_cc_no_red_zone" = xno; then | |
1170 | AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc]) | |
1171 | fi | |
1172 | ||
c8600122 | 1173 | TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone" |
20011694 | 1174 | fi |
1175 | ||
41822625 | 1176 | if test "x$target_cpu" = xarm; then |
d15f17b2 VS |
1177 | AC_CACHE_CHECK([for options to disable movt and movw], grub_cv_target_cc_mno_movt, [ |
1178 | grub_cv_target_cc_mno_movt=no | |
1179 | for cand in "-mno-movt" \ | |
1180 | "-mllvm -arm-use-movt=0"; do | |
1181 | if test x"$grub_cv_target_cc_mno_movt" != xno ; then | |
1182 | break | |
1183 | fi | |
1184 | CFLAGS="$TARGET_CFLAGS $cand -Werror" | |
1185 | CPPFLAGS="$TARGET_CPPFLAGS" | |
1186 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], | |
1187 | [grub_cv_target_cc_mno_movt="$cand"], []) | |
1188 | done | |
bf9c5616 | 1189 | ]) |
d15f17b2 VS |
1190 | |
1191 | if test x"$grub_cv_target_cc_mno_movt" != xno ; then | |
bf9c5616 | 1192 | # A trick so that clang doesn't see it on link stage |
d15f17b2 | 1193 | TARGET_CPPFLAGS="$TARGET_CPPFLAGS $grub_cv_target_cc_mno_movt" |
bf9c5616 | 1194 | fi |
a29f317a VS |
1195 | AC_CACHE_CHECK([whether option -mthumb-interwork works], grub_cv_cc_mthumb_interwork, [ |
1196 | CFLAGS="$TARGET_CFLAGS -mthumb-interwork -Werror" | |
1197 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], | |
1198 | [grub_cv_cc_mthumb_interwork=yes], | |
1199 | [grub_cv_cc_mthumb_interwork=no]) | |
1200 | ]) | |
1201 | if test "x$grub_cv_cc_mthumb_interwork" = xyes; then | |
1202 | TARGET_CFLAGS="$TARGET_CFLAGS -mthumb-interwork" | |
2066c35b | 1203 | # Clang defaults to thumb interworking |
a29f317a VS |
1204 | elif test "x$grub_cv_cc_target_clang" = xno ; then |
1205 | AC_MSG_ERROR([your compiler doesn't support -mthumb-interwork]) | |
a29f317a | 1206 | fi |
41822625 VS |
1207 | fi |
1208 | ||
57bc5d43 VS |
1209 | AC_CACHE_CHECK([whether option -Qn works], grub_cv_target_cc_qn, [ |
1210 | CFLAGS="$TARGET_CFLAGS -Qn -Werror" | |
1211 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], | |
1212 | [grub_cv_target_cc_qn=yes], | |
1213 | [grub_cv_target_cc_qn=no])]) | |
1214 | if test "x$grub_cv_target_cc_qn" = xyes; then | |
1215 | TARGET_CFLAGS="$TARGET_CFLAGS -Qn" | |
1216 | fi | |
1217 | ||
baa2a121 | 1218 | # |
1219 | # Compiler features. | |
1220 | # | |
1221 | ||
28668d80 VS |
1222 | CFLAGS="$TARGET_CFLAGS" |
1223 | ||
93a81088 | 1224 | # Position independent executable. |
1225 | grub_CHECK_PIE | |
a3e9da05 | 1226 | grub_CHECK_NO_PIE |
b53f595b VS |
1227 | grub_CHECK_NO_PIE_ONEWORD |
1228 | grub_CHECK_LINK_PIE | |
93a81088 | 1229 | [# Need that, because some distributions ship compilers that include |
a3e9da05 | 1230 | # `-fPIE' or '-fpie' and '-pie' in the default specs. |
93a81088 | 1231 | if [ x"$pie_possible" = xyes ]; then |
f4d35d49 | 1232 | TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE -fno-pie" |
a3e9da05 | 1233 | fi |
b53f595b VS |
1234 | |
1235 | if [ x"$link_nopie_needed" = xyes ] || [ x"$pie_possible" = xyes ]; then | |
1236 | if [ x"$nopie_possible" = xyes ]; then | |
1237 | TARGET_LDFLAGS="$TARGET_LDFLAGS -no-pie" | |
1238 | fi | |
1239 | if [ x"$nopie_oneword_possible" = xyes ]; then | |
1240 | TARGET_LDFLAGS="$TARGET_LDFLAGS -nopie" | |
1241 | fi | |
93a81088 | 1242 | fi] |
1243 | ||
28668d80 | 1244 | CFLAGS="$TARGET_CFLAGS" |
a3e9da05 | 1245 | LDFLAGS="$TARGET_LDFLAGS" |
28668d80 | 1246 | |
7bd8b0c7 VS |
1247 | # Position independent executable. |
1248 | grub_CHECK_PIC | |
9cf12b20 VS |
1249 | [# On most platforms we don't want PIC as it only makes relocations harder |
1250 | # and code less efficient. On mips we want to have one got table per module | |
1251 | # and reload $gp in every function. | |
1252 | # GCC implements it using symbol __gnu_local_gp in non-PIC as well. | |
1253 | # However with clang we need PIC for this reloading to happen. | |
393cc591 VS |
1254 | # With arm64 we need relocations that are in some way representable in |
1255 | # PE as we need to support arm64-efi. Without -fPIC clang generates | |
1256 | # movk's which aren't representable. | |
9cf12b20 VS |
1257 | # Since default varies across dictributions use either -fPIC or -fno-PIC |
1258 | # explicitly. | |
393cc591 | 1259 | if ( test x$target_cpu = xmips || test x$target_cpu = xmipsel || test x$target_cpu = xarm64 ) && test "x$grub_cv_cc_target_clang" = xyes ; then |
9cf12b20 VS |
1260 | TARGET_CFLAGS="$TARGET_CFLAGS -fPIC" |
1261 | elif [ x"$pic_possible" = xyes ]; then | |
1262 | TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIC" | |
7bd8b0c7 VS |
1263 | fi] |
1264 | ||
28668d80 VS |
1265 | CFLAGS="$TARGET_CFLAGS" |
1266 | ||
baa2a121 | 1267 | # Smashing stack protector. |
1268 | grub_CHECK_STACK_PROTECTOR | |
c3db8364 | 1269 | # Need that, because some distributions ship compilers that include |
baa2a121 | 1270 | # `-fstack-protector' in the default specs. |
c3db8364 | 1271 | if test "x$ssp_possible" = xyes; then |
1272 | TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector" | |
1273 | fi | |
28668d80 VS |
1274 | |
1275 | CFLAGS="$TARGET_CFLAGS" | |
1276 | ||
2a8a80e4 | 1277 | grub_CHECK_STACK_ARG_PROBE |
1278 | # Cygwin's GCC uses alloca() to probe the stackframe on static | |
1279 | # stack allocations above some threshold. | |
1280 | if test x"$sap_possible" = xyes; then | |
1281 | TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe" | |
1282 | fi | |
baa2a121 | 1283 | |
28668d80 VS |
1284 | CFLAGS="$TARGET_CFLAGS" |
1285 | ||
d74b9a1d | 1286 | # -mno-unaligned-access -mstrict-align |
bb9f92b9 | 1287 | if test "$target_cpu" = arm; then |
d74b9a1d | 1288 | AC_CACHE_CHECK([for compile options to get strict alignment], [grub_cv_target_cc_strict_align], [ |
bdb6090d | 1289 | grub_cv_target_cc_strict_align= |
d74b9a1d VS |
1290 | for arg in -mno-unaligned-access "-Xclang -mstrict-align" -mstrict-align; do |
1291 | CFLAGS="$TARGET_CFLAGS $arg -Werror" | |
1292 | LDFLAGS="$TARGET_LDFLAGS" | |
1293 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [flag=1], [flag=0]) | |
1294 | if test x"$flag" = x1; then | |
1295 | grub_cv_target_cc_strict_align="$arg" | |
4d94b2db | 1296 | break |
d74b9a1d VS |
1297 | fi |
1298 | done]) | |
1299 | ||
d74b9a1d VS |
1300 | TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_strict_align" |
1301 | if test x"$grub_cv_target_cc_strict_align" = x"-Xclang -mstrict-align"; then | |
1302 | TARGET_LDFLAGS="$TARGET_LDFLAGS -Qunused-arguments" | |
bb9f92b9 | 1303 | fi |
bdb6090d VS |
1304 | AC_CACHE_CHECK([if compiler generates unaligned accesses], [grub_cv_cc_target_emits_unaligned], |
1305 | [CFLAGS="$TARGET_CFLAGS" | |
1306 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[ | |
1307 | #ifdef __ARM_FEATURE_UNALIGNED | |
1308 | #error "unaligned" | |
1309 | #endif | |
1310 | ]])], | |
1311 | [grub_cv_cc_target_emits_unaligned=no], [grub_cv_cc_target_emits_unaligned=yes])]) | |
1312 | if test x$grub_cv_cc_target_emits_unaligned = xyes; then | |
1313 | AC_MSG_ERROR([compiler generates unaligned accesses]) | |
1314 | fi | |
bb9f92b9 LL |
1315 | fi |
1316 | ||
aa6d7826 | 1317 | # Set them to their new values for the tests below. |
1318 | CC="$TARGET_CC" | |
064360e6 VS |
1319 | if test x"$platform" = xemu ; then |
1320 | CFLAGS="$TARGET_CFLAGS -Wno-error" | |
1321 | elif test "x$TARGET_APPLE_LINKER" = x1 ; then | |
246a434f | 1322 | CFLAGS="$TARGET_CFLAGS -nostdlib -static -Wno-error" |
26de2bcd | 1323 | else |
37378f74 | 1324 | CFLAGS="$TARGET_CFLAGS -nostdlib -Wno-error" |
26de2bcd | 1325 | fi |
aa6d7826 | 1326 | CPPFLAGS="$TARGET_CPPFLAGS" |
d5524ca8 | 1327 | |
01fcf061 | 1328 | grub_ASM_USCORE |
064360e6 | 1329 | if test "x$TARGET_APPLE_LINKER" = x0 && test x"$platform" != xemu; then |
01fcf061 | 1330 | if test x$grub_cv_asm_uscore = xyes; then |
37378f74 | 1331 | DEFSYM="-Wl,--defsym,_abort=_main -Wl,--defsym,__main=_main" |
01fcf061 | 1332 | else |
37378f74 | 1333 | DEFSYM="-Wl,--defsym,abort=main -Wl,--defsym,_main=main -Wl,--defsym,__main=main" |
01fcf061 | 1334 | fi |
37378f74 | 1335 | CFLAGS="$TARGET_CFLAGS -nostdlib $DEFSYM" |
a9f25a08 | 1336 | fi |
01fcf061 | 1337 | |
69be5b74 | 1338 | # Check for libgcc symbols |
064360e6 | 1339 | if test x"$platform" = xemu; then |
ca73ae44 | 1340 | AC_CHECK_FUNCS(__udivsi3 __umodsi3 __divsi3 __modsi3 __divdi3 __moddi3 __udivdi3 __umoddi3 __ctzdi2 __ctzsi2 __aeabi_uidiv __aeabi_uidivmod __aeabi_idiv __aeabi_idivmod __aeabi_ulcmp __muldi3 __aeabi_lmul __aeabi_memcpy __aeabi_memcpy4 __aeabi_memcpy8 __aeabi_memclr __aeabi_memclr4 __aeabi_memclr8 __aeabi_memset __aeabi_lasr __aeabi_llsl __aeabi_llsr _restgpr_14_x __ucmpdi2 __ashldi3 __ashrdi3 __lshrdi3 __bswapsi2 __bswapdi2 __bzero __register_frame_info __deregister_frame_info ___chkstk_ms __chkstk_ms) |
064360e6 | 1341 | fi |
69be5b74 | 1342 | |
a9f25a08 | 1343 | if test "x$TARGET_APPLE_LINKER" = x1 ; then |
246a434f | 1344 | CFLAGS="$TARGET_CFLAGS -nostdlib -static" |
69be5b74 | 1345 | else |
37378f74 | 1346 | CFLAGS="$TARGET_CFLAGS -nostdlib" |
69be5b74 | 1347 | fi |
42e0cba3 | 1348 | LIBS="" |
aa6d7826 | 1349 | |
6a161fa9 | 1350 | # Defined in aclocal.m4. |
f6130a12 | 1351 | grub_PROG_TARGET_CC |
a9f25a08 | 1352 | if test "x$TARGET_APPLE_LINKER" != x1 ; then |
b977bf01 | 1353 | grub_PROG_OBJCOPY_ABSOLUTE |
2b167a72 | 1354 | fi |
cb71ba20 | 1355 | grub_PROG_LD_BUILD_ID_NONE |
b977bf01 | 1356 | if test "x$target_cpu" = xi386; then |
a9f25a08 | 1357 | if test "$platform" != emu && test "x$TARGET_APPLE_LINKER" != x1 ; then |
2aec1692 CF |
1358 | if test ! -z "$TARGET_IMG_LDSCRIPT"; then |
1359 | # Check symbols provided by linker script. | |
37378f74 | 1360 | CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC} ${TARGET_IMG_BASE_LDOPT},0x8000" |
2aec1692 | 1361 | fi |
2a8a80e4 | 1362 | grub_CHECK_BSS_START_SYMBOL |
1363 | grub_CHECK_END_SYMBOL | |
1364 | fi | |
1365 | CFLAGS="$TARGET_CFLAGS" | |
6a161fa9 | 1366 | fi |
1367 | ||
20aea949 VS |
1368 | grub_PROG_NM_WORKS |
1369 | grub_PROG_NM_MINUS_P | |
1370 | grub_PROG_NM_DEFINED_ONLY | |
1371 | AC_SUBST(TARGET_NMFLAGS_MINUS_P) | |
1372 | AC_SUBST(TARGET_NMFLAGS_DEFINED_ONLY) | |
1373 | ||
016a671b | 1374 | if test "$platform" != emu; then |
8f9a632b VS |
1375 | AC_CACHE_CHECK([whether -nostdinc -isystem works], [grub_cv_cc_isystem], [ |
1376 | SAVED_CPPFLAGS="$CPPFLAGS" | |
1377 | CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`" | |
1378 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h> | |
ce938140 | 1379 | #include <stddef.h> |
8f9a632b VS |
1380 | int va_arg_func (int fixed, va_list args);]], [[]])], |
1381 | [grub_cv_cc_isystem=yes], | |
1382 | [grub_cv_cc_isystem=no]) | |
1383 | CPPFLAGS="$SAVED_CPPFLAGS" | |
1384 | ]) | |
1385 | ||
1386 | if test x"$grub_cv_cc_isystem" = xyes ; then | |
1387 | TARGET_CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`" | |
1388 | fi | |
dae79b6b | 1389 | fi |
5ce5507f | 1390 | |
19ce697d | 1391 | AC_CACHE_CHECK([whether -Wtrampolines work], [grub_cv_cc_wtrampolines], [ |
24f4e57c | 1392 | CFLAGS="$TARGET_CFLAGS -Wtrampolines -Werror" |
779dc15b VS |
1393 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h> |
1394 | int va_arg_func (int fixed, va_list args);]], [[]])], | |
19ce697d VS |
1395 | [grub_cv_cc_wtrampolines=yes], |
1396 | [grub_cv_cc_wtrampolines=no]) | |
779dc15b VS |
1397 | ]) |
1398 | ||
19ce697d VS |
1399 | if test x"$grub_cv_cc_wtrampolines" = xyes ; then |
1400 | TARGET_CFLAGS="$TARGET_CFLAGS -Wtrampolines" | |
779dc15b VS |
1401 | fi |
1402 | ||
c9a86192 | 1403 | # Restore the flags. |
9962ed99 | 1404 | CC="$tmp_CC" |
1405 | CFLAGS="$tmp_CFLAGS" | |
1406 | CPPFLAGS="$tmp_CPPFLAGS" | |
c9a86192 | 1407 | LDFLAGS="$tmp_LDFLAGS" |
aa6d7826 | 1408 | LIBS="$tmp_LIBS" |
6a161fa9 | 1409 | |
4fe9862e | 1410 | # |
2965c7cc | 1411 | # Check for options. |
4fe9862e | 1412 | # |
1413 | ||
1414 | # Memory manager debugging. | |
b39f9d20 | 1415 | AC_ARG_ENABLE([mm-debug], |
2965c7cc | 1416 | AS_HELP_STRING([--enable-mm-debug], |
90ce5d56 | 1417 | [include memory manager debugging]), |
2965c7cc | 1418 | [AC_DEFINE([MM_DEBUG], [1], |
1419 | [Define to 1 if you enable memory manager debugging.])]) | |
1420 | ||
c5dc1690 SJ |
1421 | AC_ARG_ENABLE([cache-stats], |
1422 | AS_HELP_STRING([--enable-cache-stats], | |
055e2b8b | 1423 | [enable disk cache statistics collection])) |
c5dc1690 SJ |
1424 | |
1425 | if test x$enable_cache_stats = xyes; then | |
1426 | DISK_CACHE_STATS=1 | |
1427 | else | |
1428 | DISK_CACHE_STATS=0 | |
1429 | fi | |
1430 | AC_SUBST([DISK_CACHE_STATS]) | |
1431 | ||
e744219b VS |
1432 | AC_ARG_ENABLE([boot-time], |
1433 | AS_HELP_STRING([--enable-boot-time], | |
1434 | [enable boot time statistics collection])) | |
1435 | ||
1436 | if test x$enable_boot_time = xyes; then | |
1437 | BOOT_TIME_STATS=1 | |
1438 | else | |
1439 | BOOT_TIME_STATS=0 | |
1440 | fi | |
1441 | AC_SUBST([BOOT_TIME_STATS]) | |
1442 | ||
927d0134 VS |
1443 | AC_ARG_ENABLE([grub-emu-sdl], |
1444 | [AS_HELP_STRING([--enable-grub-emu-sdl], | |
1445 | [build and install the `grub-emu' debugging utility with SDL support (default=guessed)])]) | |
1446 | ||
3affd0ec | 1447 | AC_ARG_ENABLE([grub-emu-pci], |
1448 | [AS_HELP_STRING([--enable-grub-emu-pci], | |
1449 | [build and install the `grub-emu' debugging utility with PCI support (potentially dangerous) (default=no)])]) | |
1450 | ||
f84b481b | 1451 | if test "$platform" = emu; then |
f84b481b | 1452 | |
927d0134 | 1453 | if test x"$enable_grub_emu_sdl" = xno ; then |
16f7455b | 1454 | grub_emu_sdl_excuse="explicitly disabled" |
927d0134 VS |
1455 | fi |
1456 | [if [ x"$grub_emu_sdl_excuse" = x ]; then | |
1457 | # Check for libSDL libraries.] | |
1458 | AC_CHECK_LIB([SDL], [SDL_Init], [LIBSDL="-lSDL"], | |
1459 | [grub_emu_sdl_excuse=["libSDL libraries are required to build \`grub-emu' with SDL support"]]) | |
1460 | AC_SUBST([LIBSDL]) | |
1461 | [fi] | |
9f293ab0 | 1462 | |
927d0134 VS |
1463 | [if [ x"$grub_emu_sdl_excuse" = x ]; then |
1464 | # Check for headers.] | |
1465 | AC_CHECK_HEADERS([SDL/SDL.h], [], | |
1466 | [grub_emu_sdl_excuse=["libSDL header file is required to build \`grub-emu' with SDL support"]]) | |
1467 | [fi] | |
9f293ab0 | 1468 | |
927d0134 | 1469 | if test x"enable_grub_emu_sdl" = xyes && test x"$grub_emu_sdl_excuse" != x ; then |
16f7455b | 1470 | AC_MSG_ERROR([SDL support for grub-emu was explicitly requested but can't be compiled ($grub_emu_sdl_excuse)]) |
927d0134 VS |
1471 | fi |
1472 | if test x"$grub_emu_sdl_excuse" = x ; then | |
1473 | enable_grub_emu_sdl=yes | |
1474 | else | |
1475 | enable_grub_emu_sdl=no | |
1476 | fi | |
1477 | ||
3affd0ec | 1478 | if test x"$enable_grub_emu_pci" != xyes ; then |
325c8258 | 1479 | grub_emu_pci_excuse="not enabled" |
1480 | fi | |
1481 | ||
325c8258 | 1482 | [if [ x"$grub_emu_pci_excuse" = x ]; then |
1483 | # Check for libpci libraries.] | |
459fed4b | 1484 | AC_CHECK_LIB([pciaccess], [pci_system_init], [LIBPCIACCESS="-lpciaccess"], |
1485 | [grub_emu_pci_excuse=["need libpciaccess library"]]) | |
1486 | AC_SUBST([LIBPCIACCESS]) | |
325c8258 | 1487 | [fi] |
1488 | [if [ x"$grub_emu_pci_excuse" = x ]; then | |
1489 | # Check for headers.] | |
5959b15c | 1490 | AC_CHECK_HEADERS([pciaccess.h], [], |
459fed4b | 1491 | [grub_emu_pci_excuse=["need libpciaccess headers"]]) |
325c8258 | 1492 | [fi] |
1493 | ||
1494 | if test x"$grub_emu_pci_excuse" = x ; then | |
1495 | enable_grub_emu_pci=yes | |
1496 | else | |
9f293ab0 | 1497 | |
325c8258 | 1498 | enable_grub_emu_pci=no |
3affd0ec | 1499 | fi |
1500 | ||
927d0134 | 1501 | AC_SUBST([enable_grub_emu_sdl]) |
3affd0ec | 1502 | AC_SUBST([enable_grub_emu_pci]) |
e7d09ac4 AB |
1503 | |
1504 | else | |
1505 | ||
1506 | # Ignore --enable-emu-* if platform is not emu | |
1507 | enable_grub_emu_sdl=no | |
e7d09ac4 | 1508 | enable_grub_emu_pci=no |
f84b481b | 1509 | fi |
4fe9862e | 1510 | |
e52db1f7 | 1511 | AC_ARG_ENABLE([grub-mkfont], |
1512 | [AS_HELP_STRING([--enable-grub-mkfont], | |
5ce5507f | 1513 | [build and install the `grub-mkfont' utility (default=guessed)])]) |
1514 | if test x"$enable_grub_mkfont" = xno ; then | |
ce7a733d | 1515 | grub_mkfont_excuse="explicitly disabled" |
5ce5507f | 1516 | fi |
1517 | ||
7b780018 VS |
1518 | unset ac_cv_header_ft2build_h |
1519 | ||
660960d6 VS |
1520 | if test x"$grub_mkfont_excuse" = x ; then |
1521 | # Check for freetype libraries. | |
7e23437d CW |
1522 | PKG_CHECK_MODULES([FREETYPE], [freetype2], [ |
1523 | SAVED_CPPFLAGS="$CPPFLAGS" | |
1524 | SAVED_LIBS="$LIBS" | |
1525 | CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS" | |
1526 | LIBS="$LIBS $FREETYPE_LIBS" | |
1527 | AC_CHECK_HEADERS([ft2build.h], [], | |
1528 | [grub_mkfont_excuse=["need freetype2 headers"]]) | |
1529 | AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [], | |
1530 | [grub_mkfont_excuse=["freetype2 library unusable"]]) | |
1531 | CPPFLAGS="$SAVED_CPPFLAGS" | |
1532 | LIBS="$SAVED_LIBS" | |
1533 | ], [grub_mkfont_excuse=["need freetype2 library"]]) | |
660960d6 VS |
1534 | fi |
1535 | ||
5ce5507f | 1536 | if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then |
d642d761 | 1537 | AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled ($grub_mkfont_excuse)]) |
5ce5507f | 1538 | fi |
1539 | if test x"$grub_mkfont_excuse" = x ; then | |
1540 | enable_grub_mkfont=yes | |
1541 | else | |
1542 | enable_grub_mkfont=no | |
1543 | fi | |
e52db1f7 | 1544 | AC_SUBST([enable_grub_mkfont]) |
e52db1f7 | 1545 | |
7c9d0c39 | 1546 | SAVED_CC="$CC" |
b224c266 | 1547 | SAVED_CPP="$CPP" |
7c9d0c39 VS |
1548 | SAVED_CFLAGS="$CFLAGS" |
1549 | SAVED_CPPFLAGS="$CPPFLAGS" | |
dcecae1a | 1550 | SAVED_LDFLAGS="$LDFLAGS" |
7c9d0c39 | 1551 | CC="$BUILD_CC" |
b224c266 | 1552 | CPP="$BUILD_CPP" |
7c9d0c39 | 1553 | CFLAGS="$BUILD_CFLAGS" |
7b780018 | 1554 | CPPFLAGS="$BUILD_CPPFLAGS" |
dcecae1a | 1555 | LDFLAGS="$BUILD_LDFAGS" |
7b780018 VS |
1556 | |
1557 | unset ac_cv_c_bigendian | |
1558 | unset ac_cv_header_ft2build_h | |
1559 | ||
1560 | AC_COMPUTE_INT([BUILD_SIZEOF_VOID_P], [sizeof (void *)]) | |
1561 | AC_COMPUTE_INT([BUILD_SIZEOF_LONG], [sizeof (long)]) | |
1562 | AC_C_BIGENDIAN([BUILD_WORDS_BIGENDIAN=1], [BUILD_WORDS_BIGENDIAN=0], [BUILD_WORDS_BIGENDIAN=err], [BUILD_WORDS_BIGENDIAN=err]) | |
1563 | ||
1564 | if test x$BUILD_WORDS_BIGENDIAN = xerr ; then | |
1565 | AC_MSG_ERROR([couldnt determine build endianness]) | |
1566 | fi | |
1567 | ||
1568 | AC_SUBST([BUILD_SIZEOF_LONG]) | |
1569 | AC_SUBST([BUILD_SIZEOF_VOID_P]) | |
1570 | AC_SUBST([BUILD_WORDS_BIGENDIAN]) | |
c5884973 | 1571 | |
7c9d0c39 VS |
1572 | if test x"$grub_build_mkfont_excuse" = x ; then |
1573 | # Check for freetype libraries. | |
7e23437d CW |
1574 | SAVED_PKG_CONFIG="$PKG_CONFIG" |
1575 | test -z "$BUILD_PKG_CONFIG" || PKG_CONFIG="$BUILD_PKG_CONFIG" | |
1576 | PKG_CHECK_MODULES([BUILD_FREETYPE], [freetype2], [ | |
1577 | SAVED_CPPFLAGS_2="$CPPFLAGS" | |
1578 | SAVED_LIBS="$LIBS" | |
1579 | CPPFLAGS="$CPPFLAGS $BUILD_FREETYPE_CFLAGS" | |
1580 | LIBS="$LIBS $BUILD_FREETYPE_LIBS" | |
1581 | AC_CHECK_HEADERS([ft2build.h], [], | |
1582 | [grub_build_mkfont_excuse=["need freetype2 headers"]]) | |
1583 | AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [], | |
1584 | [grub_build_mkfont_excuse=["freetype2 library unusable"]]) | |
1585 | LIBS="$SAVED_LIBS" | |
1586 | CPPFLAGS="$SAVED_CPPFLAGS_2" | |
1587 | ], [grub_build_mkfont_excuse=["need freetype2 library"]]) | |
1588 | PKG_CONFIG="$SAVED_PKG_CONFIG" | |
7c9d0c39 VS |
1589 | fi |
1590 | ||
1591 | if test x"$enable_build_grub_mkfont" = xyes && test x"$grub_build_mkfont_excuse" != x ; then | |
d642d761 | 1592 | AC_MSG_ERROR([build-grub-mkfont was explicitly requested but can't be compiled ($grub_build_mkfont_excuse)]) |
7c9d0c39 VS |
1593 | fi |
1594 | if test x"$grub_build_mkfont_excuse" = x ; then | |
1595 | enable_build_grub_mkfont=yes | |
1596 | else | |
1597 | enable_build_grub_mkfont=no | |
c5884973 | 1598 | fi |
0af7539b | 1599 | if test x"$enable_build_grub_mkfont" = xno && ( test "x$platform" = xqemu || test "x$platform" = xloongson || test "x$platform" = xqemu_mips || test "x$platform" = xcoreboot ); then |
d642d761 | 1600 | if test x"$grub_build_mkfont_excuse" = x ; then |
0af7539b | 1601 | AC_MSG_ERROR([qemu, coreboot and loongson ports need build-time grub-mkfont]) |
d642d761 | 1602 | else |
0af7539b | 1603 | AC_MSG_ERROR([qemu, coreboot and loongson ports need build-time grub-mkfont ($grub_build_mkfont_excuse)]) |
d642d761 | 1604 | fi |
7c9d0c39 VS |
1605 | fi |
1606 | ||
7c9d0c39 | 1607 | CC="$SAVED_CC" |
b224c266 | 1608 | CPP="$SAVED_CPP" |
7c9d0c39 VS |
1609 | CFLAGS="$SAVED_CFLAGS" |
1610 | CPPFLAGS="$SAVED_CPPFLAGS" | |
dcecae1a | 1611 | LDFLAGS="$SAVED_LDFLAGS" |
7c9d0c39 VS |
1612 | |
1613 | ||
1614 | DJVU_FONT_SOURCE= | |
1615 | ||
1616 | starfield_excuse= | |
c5884973 | 1617 | |
300f48c5 VS |
1618 | AC_ARG_ENABLE([grub-themes], |
1619 | [AS_HELP_STRING([--enable-grub-themes], | |
1620 | [build and install GRUB themes (default=guessed)])]) | |
1621 | if test x"$enable_grub_themes" = xno ; then | |
1622 | starfield_excuse="explicitly disabled" | |
1623 | fi | |
1624 | ||
1625 | if test x"$starfield_excuse" = x && test x"$enable_build_grub_mkfont" = xno ; then | |
7b966834 VS |
1626 | starfield_excuse="No build-time grub-mkfont" |
1627 | fi | |
1628 | ||
501b9e4b | 1629 | if test x"$starfield_excuse" = x; then |
c5884973 | 1630 | for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do |
36387ece | 1631 | for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu /usr/share/fonts/truetype; do |
c5884973 DO |
1632 | if test -f "$dir/DejaVuSans.$ext"; then |
1633 | DJVU_FONT_SOURCE="$dir/DejaVuSans.$ext" | |
1634 | break 2 | |
1635 | fi | |
1636 | done | |
1637 | done | |
1638 | ||
1639 | if test "x$DJVU_FONT_SOURCE" = x; then | |
1640 | starfield_excuse="No DejaVu found" | |
1641 | fi | |
1642 | fi | |
1643 | ||
300f48c5 | 1644 | if test x"$enable_grub_themes" = xyes && test x"$starfield_excuse" != x; then |
d642d761 | 1645 | AC_MSG_ERROR([themes were explicitly requested but requirements are not satisfied ($starfield_excuse)]) |
300f48c5 VS |
1646 | fi |
1647 | ||
c5884973 DO |
1648 | AC_SUBST([DJVU_FONT_SOURCE]) |
1649 | ||
7c9d0c39 VS |
1650 | FONT_SOURCE= |
1651 | ||
1652 | for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do | |
1653 | 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 | |
1654 | if test -f "$dir/unifont.$ext"; then | |
0277eab7 VS |
1655 | md5="$(md5sum "$dir/unifont.$ext"|awk '{ print $1; }')" |
1656 | # PCF and BDF from version 6.3 isn't hanled properly by libfreetype. | |
1657 | if test "$md5" = 0a54834d2788c83886a3e1785a6a1e61 || test "$md5" = 28f2565c7a41d8d407e2551159385edb || test "$md5" = dae5e588461b3b92b87b6ffee734f936 || test "$md5" = 4a3d687aa5bb329ed05f4263a1016791 ; then | |
4d94b2db | 1658 | continue |
0277eab7 | 1659 | fi |
7c9d0c39 VS |
1660 | FONT_SOURCE="$dir/unifont.$ext" |
1661 | break 2 | |
1662 | fi | |
1663 | done | |
1664 | done | |
1665 | ||
7b966834 VS |
1666 | if test x"$enable_build_grub_mkfont" = xno ; then |
1667 | FONT_SOURCE= | |
1668 | fi | |
1669 | ||
0af7539b | 1670 | if test "x$FONT_SOURCE" = x && ( test "x$platform" = xqemu || test "x$platform" = xloongson || test "x$platform" = xqemu_mips || test "x$platform" = xcoreboot ); then |
d642d761 | 1671 | if test x"$grub_build_mkfont_excuse" = x ; then |
0af7539b | 1672 | AC_MSG_ERROR([qemu, coreboot and loongson ports need unifont]) |
d642d761 | 1673 | else |
0af7539b | 1674 | AC_MSG_ERROR([qemu, coreboot and loongson ports need unifont ($grub_build_mkfont_excuse)]) |
d642d761 | 1675 | fi |
7c9d0c39 VS |
1676 | fi |
1677 | ||
1678 | AC_SUBST([FONT_SOURCE]) | |
1679 | ||
7b780018 | 1680 | if test x"$FONT_SOURCE" = x && test x"$DJVU_FONT_SOURCE" = x && test x"$grub_build_mkfont_excuse" = x; then |
7c9d0c39 VS |
1681 | grub_build_mkfont_excuse="no fonts" |
1682 | fi | |
1683 | ||
1684 | ||
897e6207 CW |
1685 | AC_ARG_ENABLE([grub-mount], |
1686 | [AS_HELP_STRING([--enable-grub-mount], | |
1687 | [build and install the `grub-mount' utility (default=guessed)])]) | |
1688 | if test x"$enable_grub_mount" = xno ; then | |
1689 | grub_mount_excuse="explicitly disabled" | |
92bb0786 VS |
1690 | fi |
1691 | ||
897e6207 | 1692 | if test x"$grub_mount_excuse" = x ; then |
92bb0786 | 1693 | AC_CHECK_LIB([fuse], [fuse_main_real], [], |
897e6207 | 1694 | [grub_mount_excuse="need FUSE library"]) |
92bb0786 VS |
1695 | fi |
1696 | ||
897e6207 | 1697 | if test x"$grub_mount_excuse" = x ; then |
92bb0786 VS |
1698 | # Check for fuse headers. |
1699 | SAVED_CPPFLAGS="$CPPFLAGS" | |
fc7a64bc | 1700 | CPPFLAGS="$CPPFLAGS -DFUSE_USE_VERSION=26" |
92bb0786 | 1701 | AC_CHECK_HEADERS([fuse/fuse.h], [], |
897e6207 | 1702 | [grub_mount_excuse=["need FUSE headers"]]) |
92bb0786 VS |
1703 | CPPFLAGS="$SAVED_CPPFLAGS" |
1704 | fi | |
1705 | ||
897e6207 | 1706 | if test x"$enable_grub_mount" = xyes && test x"$grub_mount_excuse" != x ; then |
d642d761 | 1707 | AC_MSG_ERROR([grub-mount was explicitly requested but can't be compiled ($grub_mount_excuse)]) |
92bb0786 | 1708 | fi |
897e6207 CW |
1709 | if test x"$grub_mount_excuse" = x ; then |
1710 | enable_grub_mount=yes | |
92bb0786 | 1711 | else |
897e6207 | 1712 | enable_grub_mount=no |
92bb0786 | 1713 | fi |
897e6207 | 1714 | AC_SUBST([enable_grub_mount]) |
92bb0786 | 1715 | |
7181e228 CW |
1716 | AC_ARG_ENABLE([device-mapper], |
1717 | [AS_HELP_STRING([--enable-device-mapper], | |
1718 | [enable Linux device-mapper support (default=guessed)])]) | |
1719 | if test x"$enable_device_mapper" = xno ; then | |
1720 | device_mapper_excuse="explicitly disabled" | |
1721 | fi | |
1722 | ||
53798c4b GS |
1723 | if test x"$device_mapper_excuse" = x ; then |
1724 | # Check for device-mapper header. | |
1725 | AC_CHECK_HEADER([libdevmapper.h], [], | |
1726 | [device_mapper_excuse="need libdevmapper header"]) | |
1727 | fi | |
1728 | ||
7181e228 CW |
1729 | if test x"$device_mapper_excuse" = x ; then |
1730 | # Check for device-mapper library. | |
61d720e5 | 1731 | AC_CHECK_LIB([devmapper], [dm_task_create], [], |
7181e228 | 1732 | [device_mapper_excuse="need devmapper library"]) |
7181e228 | 1733 | fi |
61d720e5 VS |
1734 | |
1735 | if test x"$device_mapper_excuse" = x ; then | |
1736 | # Check for device-mapper library. | |
1737 | AC_CHECK_LIB([devmapper], [dm_log_with_errno_init], | |
1738 | [], | |
1739 | [device_mapper_excuse="need devmapper library"]) | |
1740 | fi | |
1741 | ||
1742 | if test x"$device_mapper_excuse" = x ; then | |
4d94b2db | 1743 | LIBDEVMAPPER="-ldevmapper" |
61d720e5 VS |
1744 | AC_DEFINE([HAVE_DEVICE_MAPPER], [1], |
1745 | [Define to 1 if you have the devmapper library.]) | |
1746 | fi | |
1747 | ||
62f7d208 | 1748 | AC_SUBST([LIBDEVMAPPER]) |
76ed06b9 | 1749 | |
f4727da9 VS |
1750 | LIBGEOM= |
1751 | if test x$host_kernel = xkfreebsd; then | |
1752 | AC_CHECK_LIB([geom], [geom_gettree], [], | |
1753 | [AC_MSG_ERROR([Your platform requires libgeom])]) | |
1754 | LIBGEOM="-lgeom" | |
1755 | fi | |
1756 | ||
1757 | AC_SUBST([LIBGEOM]) | |
1758 | ||
0d2d30bb VS |
1759 | AC_ARG_ENABLE([liblzma], |
1760 | [AS_HELP_STRING([--enable-liblzma], | |
1761 | [enable liblzma integration (default=guessed)])]) | |
1762 | if test x"$enable_liblzma" = xno ; then | |
1763 | liblzma_excuse="explicitly disabled" | |
1764 | fi | |
1765 | ||
1766 | if test x"$liblzma_excuse" = x ; then | |
2c44e493 | 1767 | AC_CHECK_LIB([lzma], [lzma_code], |
0d2d30bb VS |
1768 | [],[liblzma_excuse="need lzma library"]) |
1769 | fi | |
1770 | if test x"$liblzma_excuse" = x ; then | |
1771 | AC_CHECK_HEADER([lzma.h], [], [liblzma_excuse="need lzma header"]) | |
1772 | fi | |
1773 | ||
1774 | if test x"$enable_liblzma" = xyes && test x"$liblzma_excuse" != x ; then | |
d642d761 | 1775 | AC_MSG_ERROR([liblzma support was explicitly requested but requirements are not satisfied ($liblzma_excuse)]) |
0d2d30bb VS |
1776 | fi |
1777 | ||
1778 | ||
1779 | if test x"$liblzma_excuse" = x ; then | |
1780 | LIBLZMA="-llzma" | |
1781 | AC_DEFINE([USE_LIBLZMA], [1], | |
1782 | [Define to 1 if you have the LZMA library.]) | |
1783 | fi | |
1784 | ||
2c44e493 VS |
1785 | AC_SUBST([LIBLZMA]) |
1786 | ||
e4c498a1 MG |
1787 | AC_ARG_ENABLE([libzfs], |
1788 | [AS_HELP_STRING([--enable-libzfs], | |
1789 | [enable libzfs integration (default=guessed)])]) | |
1790 | if test x"$enable_libzfs" = xno ; then | |
1791 | libzfs_excuse="explicitly disabled" | |
1792 | fi | |
16c7cb32 | 1793 | |
e4c498a1 MG |
1794 | if test x"$libzfs_excuse" = x ; then |
1795 | # Only check for system headers if libzfs support has not been disabled. | |
1796 | AC_CHECK_HEADERS(libzfs.h libnvpair.h) | |
1797 | fi | |
1798 | ||
1799 | if test x"$libzfs_excuse" = x ; then | |
1800 | AC_CHECK_LIB([zfs], [libzfs_init], | |
1801 | [], | |
1802 | [libzfs_excuse="need zfs library"]) | |
1803 | fi | |
1804 | ||
1805 | if test x"$libzfs_excuse" = x ; then | |
27f9d02e | 1806 | AC_CHECK_LIB([nvpair], [nvlist_lookup_string], |
e4c498a1 MG |
1807 | [], |
1808 | [libzfs_excuse="need nvpair library"]) | |
1809 | fi | |
1810 | ||
1811 | if test x"$enable_libzfs" = xyes && test x"$libzfs_excuse" != x ; then | |
d642d761 | 1812 | AC_MSG_ERROR([libzfs support was explicitly requested but requirements are not satisfied ($libzfs_excuse)]) |
e4c498a1 MG |
1813 | fi |
1814 | ||
1815 | if test x"$libzfs_excuse" = x ; then | |
1816 | # We need both libzfs and libnvpair for a successful build. | |
1817 | LIBZFS="-lzfs" | |
1818 | AC_DEFINE([HAVE_LIBZFS], [1], | |
1819 | [Define to 1 if you have the ZFS library.]) | |
1820 | LIBNVPAIR="-lnvpair" | |
1821 | AC_DEFINE([HAVE_LIBNVPAIR], [1], | |
1822 | [Define to 1 if you have the NVPAIR library.]) | |
1823 | fi | |
1824 | ||
1825 | AC_SUBST([LIBZFS]) | |
16c7cb32 BC |
1826 | AC_SUBST([LIBNVPAIR]) |
1827 | ||
9f915872 VS |
1828 | LIBS="" |
1829 | ||
76ed06b9 | 1830 | AC_SUBST([FONT_SOURCE]) |
76ed06b9 BC |
1831 | AS_IF([test x$target_cpu = xi386 -a x$platform = xqemu], |
1832 | [AC_SUBST([GRUB_BOOT_MACHINE_LINK_ADDR], 0xffe00)]) | |
7181e228 | 1833 | |
742f9232 | 1834 | AC_SUBST(HAVE_ASM_USCORE) |
742f9232 VS |
1835 | AC_SUBST(BSS_START_SYMBOL) |
1836 | AC_SUBST(END_SYMBOL) | |
1837 | AC_SUBST(PACKAGE) | |
1838 | AC_SUBST(VERSION) | |
742f9232 | 1839 | |
d5524ca8 VS |
1840 | AC_ARG_ENABLE([werror], |
1841 | [AS_HELP_STRING([--disable-werror], | |
1842 | [do not use -Werror when building GRUB])]) | |
1843 | if test x"$enable_werror" != xno ; then | |
1844 | TARGET_CFLAGS="$TARGET_CFLAGS -Werror" | |
1845 | HOST_CFLAGS="$HOST_CFLAGS -Werror" | |
1846 | fi | |
1847 | ||
d5524ca8 VS |
1848 | TARGET_CPP="$TARGET_CC -E" |
1849 | TARGET_CCAS=$TARGET_CC | |
1850 | ||
b46bf3cd VS |
1851 | # Includes which include make-time substitutions. They must come last |
1852 | # as to avoid executing top_builddir in shell. | |
1853 | HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include" | |
1854 | TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include" | |
1855 | TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include" | |
1856 | ||
d5524ca8 VS |
1857 | GRUB_TARGET_CPU="${target_cpu}" |
1858 | GRUB_PLATFORM="${platform}" | |
1859 | ||
1860 | AC_SUBST(GRUB_TARGET_CPU) | |
1861 | AC_SUBST(GRUB_PLATFORM) | |
1862 | ||
1863 | AC_SUBST(TARGET_OBJCONV) | |
d5524ca8 VS |
1864 | AC_SUBST(TARGET_CPP) |
1865 | AC_SUBST(TARGET_CCAS) | |
1866 | AC_SUBST(TARGET_OBJ2ELF) | |
d5524ca8 | 1867 | AC_SUBST(TARGET_MODULE_FORMAT) |
6a7957f9 | 1868 | AC_SUBST(TARGET_CC_VERSION) |
d5524ca8 VS |
1869 | |
1870 | AC_SUBST(TARGET_CFLAGS) | |
1871 | AC_SUBST(TARGET_LDFLAGS) | |
1872 | AC_SUBST(TARGET_CPPFLAGS) | |
1873 | AC_SUBST(TARGET_CCASFLAGS) | |
1874 | ||
d5524ca8 VS |
1875 | AC_SUBST(TARGET_IMG_LDFLAGS) |
1876 | AC_SUBST(TARGET_IMG_CFLAGS) | |
1877 | AC_SUBST(TARGET_IMG_BASE_LDOPT) | |
a9f25a08 | 1878 | AC_SUBST(TARGET_APPLE_LINKER) |
d5524ca8 VS |
1879 | |
1880 | AC_SUBST(HOST_CFLAGS) | |
1881 | AC_SUBST(HOST_LDFLAGS) | |
1882 | AC_SUBST(HOST_CPPFLAGS) | |
1883 | AC_SUBST(HOST_CCASFLAGS) | |
1884 | ||
1885 | AC_SUBST(BUILD_LIBM) | |
1886 | ||
76ed06b9 BC |
1887 | # |
1888 | # Automake conditionals | |
1889 | # | |
8c411768 | 1890 | |
5d90f6e5 | 1891 | AM_CONDITIONAL([COND_real_platform], [test x$platform != xnone]) |
76ed06b9 BC |
1892 | AM_CONDITIONAL([COND_emu], [test x$platform = xemu]) |
1893 | AM_CONDITIONAL([COND_i386_pc], [test x$target_cpu = xi386 -a x$platform = xpc]) | |
1894 | AM_CONDITIONAL([COND_i386_efi], [test x$target_cpu = xi386 -a x$platform = xefi]) | |
6585de4c | 1895 | AM_CONDITIONAL([COND_ia64_efi], [test x$target_cpu = xia64 -a x$platform = xefi]) |
76ed06b9 BC |
1896 | AM_CONDITIONAL([COND_i386_qemu], [test x$target_cpu = xi386 -a x$platform = xqemu]) |
1897 | AM_CONDITIONAL([COND_i386_ieee1275], [test x$target_cpu = xi386 -a x$platform = xieee1275]) | |
1898 | AM_CONDITIONAL([COND_i386_coreboot], [test x$target_cpu = xi386 -a x$platform = xcoreboot]) | |
1899 | AM_CONDITIONAL([COND_i386_multiboot], [test x$target_cpu = xi386 -a x$platform = xmultiboot]) | |
1900 | AM_CONDITIONAL([COND_x86_64_efi], [test x$target_cpu = xx86_64 -a x$platform = xefi]) | |
9612ebc0 | 1901 | AM_CONDITIONAL([COND_i386_xen], [test x$target_cpu = xi386 -a x$platform = xxen]) |
d789e70e | 1902 | AM_CONDITIONAL([COND_i386_xen_pvh], [test x$target_cpu = xi386 -a x$platform = xxen_pvh]) |
9612ebc0 | 1903 | AM_CONDITIONAL([COND_x86_64_xen], [test x$target_cpu = xx86_64 -a x$platform = xxen]) |
4959e111 VS |
1904 | AM_CONDITIONAL([COND_mips_loongson], [test x$target_cpu = xmipsel -a x$platform = xloongson]) |
1905 | AM_CONDITIONAL([COND_mips_qemu_mips], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")" -a x$platform = xqemu_mips]) | |
7f63a64f | 1906 | AM_CONDITIONAL([COND_mips_arc], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")" -a x$platform = xarc]) |
76ed06b9 | 1907 | AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275]) |
eaf01c25 | 1908 | AM_CONDITIONAL([COND_sparc64_emu], [test x$target_cpu = xsparc64 -a x$platform = xemu]) |
76ed06b9 | 1909 | AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275]) |
4959e111 | 1910 | AM_CONDITIONAL([COND_mips], [test x$target_cpu = xmips -o x$target_cpu = xmipsel]) |
37ba07eb VS |
1911 | AM_CONDITIONAL([COND_mipsel], [test x$target_cpu = xmipsel]) |
1912 | AM_CONDITIONAL([COND_mipseb], [test x$target_cpu = xmips]) | |
389b31cd LL |
1913 | AM_CONDITIONAL([COND_arm], [test x$target_cpu = xarm ]) |
1914 | AM_CONDITIONAL([COND_arm_uboot], [test x$target_cpu = xarm -a x$platform = xuboot]) | |
24e37a88 | 1915 | AM_CONDITIONAL([COND_arm_coreboot], [test x$target_cpu = xarm -a x$platform = xcoreboot]) |
389b31cd | 1916 | AM_CONDITIONAL([COND_arm_efi], [test x$target_cpu = xarm -a x$platform = xefi]) |
15a463d7 LL |
1917 | AM_CONDITIONAL([COND_arm64], [test x$target_cpu = xarm64 ]) |
1918 | AM_CONDITIONAL([COND_arm64_efi], [test x$target_cpu = xarm64 -a x$platform = xefi]) | |
f7711f5e | 1919 | |
faf4a65e VS |
1920 | AM_CONDITIONAL([COND_HOST_HURD], [test x$host_kernel = xhurd]) |
1921 | AM_CONDITIONAL([COND_HOST_LINUX], [test x$host_kernel = xlinux]) | |
1922 | AM_CONDITIONAL([COND_HOST_NETBSD], [test x$host_kernel = xnetbsd]) | |
f7711f5e | 1923 | AM_CONDITIONAL([COND_HOST_WINDOWS], [test x$host_kernel = xwindows]) |
faf4a65e VS |
1924 | AM_CONDITIONAL([COND_HOST_KFREEBSD], [test x$host_kernel = xkfreebsd]) |
1925 | AM_CONDITIONAL([COND_HOST_XNU], [test x$host_kernel = xxnu]) | |
1926 | AM_CONDITIONAL([COND_HOST_ILLUMOS], [test x$host_kernel = xillumos]) | |
2d465fb0 | 1927 | |
76ed06b9 | 1928 | AM_CONDITIONAL([COND_MAN_PAGES], [test x$cross_compiling = xno -a x$HELP2MAN != x]) |
76ed06b9 BC |
1929 | AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes]) |
1930 | AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes]) | |
1931 | AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes]) | |
897e6207 | 1932 | AM_CONDITIONAL([COND_GRUB_MOUNT], [test x$enable_grub_mount = xyes]) |
76ed06b9 | 1933 | AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x]) |
6f07c4e4 VS |
1934 | if test x$FONT_SOURCE != x ; then |
1935 | HAVE_FONT_SOURCE=1 | |
1936 | else | |
1937 | HAVE_FONT_SOURCE=0 | |
1938 | fi | |
1939 | AC_SUBST(HAVE_FONT_SOURCE) | |
a9f25a08 | 1940 | AM_CONDITIONAL([COND_APPLE_LINKER], [test x$TARGET_APPLE_LINKER = x1]) |
76ed06b9 | 1941 | AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes]) |
c5dc1690 | 1942 | AM_CONDITIONAL([COND_ENABLE_CACHE_STATS], [test x$DISK_CACHE_STATS = x1]) |
e744219b | 1943 | AM_CONDITIONAL([COND_ENABLE_BOOT_TIME_STATS], [test x$BOOT_TIME_STATS = x1]) |
fc45fb58 | 1944 | |
1eed0e6e VS |
1945 | AM_CONDITIONAL([COND_HAVE_CXX], [test x$HAVE_CXX = xyes]) |
1946 | ||
742f9232 | 1947 | AM_CONDITIONAL([COND_HAVE_ASM_USCORE], [test x$HAVE_ASM_USCORE = x1]) |
c5884973 | 1948 | AM_CONDITIONAL([COND_STARFIELD], [test "x$starfield_excuse" = x]) |
cd46aa6c VS |
1949 | AM_CONDITIONAL([COND_HAVE_EXEC], [test "x$have_exec" = xy]) |
1950 | ||
1951 | test "x$prefix" = xNONE && prefix="$ac_default_prefix" | |
1952 | test "x$exec_prefix" = xNONE && exec_prefix="${prefix}" | |
1953 | datarootdir="$(eval echo "$datarootdir")" | |
1954 | grub_libdir="$(eval echo "$libdir")" | |
1955 | grub_localedir="$(eval echo "$localedir")" | |
1956 | grub_datadir="$(eval echo "$datadir")" | |
1957 | grub_sysconfdir="$(eval echo "$sysconfdir")" | |
1958 | AC_DEFINE_UNQUOTED(LOCALEDIR, "$grub_localedir", [Locale dir]) | |
1959 | AC_DEFINE_UNQUOTED(GRUB_LIBDIR, "$grub_libdir", [Library dir]) | |
1960 | AC_DEFINE_UNQUOTED(GRUB_DATADIR, "$grub_datadir", [Data dir]) | |
1961 | AC_DEFINE_UNQUOTED(GRUB_SYSCONFDIR, "$grub_sysconfdir", [Configuration dir]) | |
1962 | ||
742f9232 | 1963 | |
6a161fa9 | 1964 | # Output files. |
5d90f6e5 CW |
1965 | if test "$platform" != none; then |
1966 | cpudir="${target_cpu}" | |
1967 | if test x${cpudir} = xmipsel; then | |
1968 | cpudir=mips; | |
f84b481b | 1969 | fi |
5d90f6e5 CW |
1970 | grub_CHECK_LINK_DIR |
1971 | if test x"$link_dir" = xyes ; then | |
1972 | AC_CONFIG_LINKS([include/grub/cpu:include/grub/$cpudir]) | |
1973 | if test "$platform" != emu ; then | |
1974 | AC_CONFIG_LINKS([include/grub/machine:include/grub/$cpudir/$platform]) | |
1975 | fi | |
1976 | else | |
1977 | mkdir -p include/grub 2>/dev/null | |
1978 | rm -rf include/grub/cpu | |
1979 | cp -rp $srcdir/include/grub/$cpudir include/grub/cpu 2>/dev/null | |
1980 | if test "$platform" != emu ; then | |
1981 | rm -rf include/grub/machine | |
1982 | cp -rp $srcdir/include/grub/$cpudir/$platform include/grub/machine 2>/dev/null | |
1983 | fi | |
f84b481b | 1984 | fi |
5d90f6e5 CW |
1985 | else |
1986 | # Just enough to stop the compiler failing with -I$(srcdir)/include. | |
1987 | mkdir -p include 2>/dev/null | |
77063f4c | 1988 | rm -rf include/grub/cpu include/grub/machine |
1f4147aa | 1989 | fi |
6304d292 | 1990 | |
8c411768 | 1991 | AC_CONFIG_FILES([Makefile]) |
6304d292 | 1992 | AC_CONFIG_FILES([grub-core/Makefile]) |
15c69261 | 1993 | AC_CONFIG_FILES([grub-core/gnulib/Makefile]) |
269004c1 | 1994 | AC_CONFIG_FILES([po/Makefile.in]) |
8c411768 | 1995 | AC_CONFIG_FILES([docs/Makefile]) |
b23ffd70 | 1996 | AC_CONFIG_FILES([util/bash-completion.d/Makefile]) |
6a161fa9 | 1997 | AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h]) |
742f9232 | 1998 | AC_CONFIG_FILES([config.h]) |
8c411768 | 1999 | |
6a161fa9 | 2000 | AC_OUTPUT |
5ce5507f | 2001 | [ |
2002 | echo "*******************************************************" | |
2003 | echo GRUB2 will be compiled with following components: | |
2004 | echo Platform: "$target_cpu"-"$platform" | |
f84b481b | 2005 | if [ x"$platform" = xemu ]; then |
927d0134 VS |
2006 | if [ x"$grub_emu_sdl_excuse" = x ]; then |
2007 | echo SDL support for grub-emu: Yes | |
2008 | else | |
2009 | echo SDL support for grub-emu: No "($grub_emu_sdl_excuse)" | |
2010 | fi | |
325c8258 | 2011 | if [ x"$grub_emu_pci_excuse" = x ]; then |
2012 | echo PCI support for grub-emu: Yes | |
2013 | else | |
2014 | echo PCI support for grub-emu: No "($grub_emu_pci_excuse)" | |
2015 | fi | |
f84b481b | 2016 | fi |
61d720e5 VS |
2017 | if test x"$device_mapper_excuse" = x ; then |
2018 | echo With devmapper support: Yes | |
2019 | else | |
2020 | echo With devmapper support: No "($device_mapper_excuse)" | |
2021 | fi | |
5ce5507f | 2022 | if [ x"$enable_mm_debug" = xyes ]; then |
2023 | echo With memory debugging: Yes | |
2024 | else | |
2025 | echo With memory debugging: No | |
2026 | fi | |
c5dc1690 SJ |
2027 | if [ x"$enable_cache_stats" = xyes ]; then |
2028 | echo With disk cache statistics: Yes | |
2029 | else | |
2030 | echo With disk cache statistics: No | |
2031 | fi | |
e744219b VS |
2032 | |
2033 | if [ x"$enable_boot_time" = xyes ]; then | |
2034 | echo With boot time statistics: Yes | |
2035 | else | |
2036 | echo With boot time statistics: No | |
2037 | fi | |
2038 | ||
5ce5507f | 2039 | if [ x"$efiemu_excuse" = x ]; then |
2040 | echo efiemu runtime: Yes | |
2041 | else | |
2042 | echo efiemu runtime: No "($efiemu_excuse)" | |
2043 | fi | |
5ce5507f | 2044 | if [ x"$grub_mkfont_excuse" = x ]; then |
2045 | echo grub-mkfont: Yes | |
2046 | else | |
2047 | echo grub-mkfont: No "($grub_mkfont_excuse)" | |
2048 | fi | |
897e6207 | 2049 | if [ x"$grub_mount_excuse" = x ]; then |
89644ef1 | 2050 | echo grub-mount: Yes |
92bb0786 | 2051 | else |
897e6207 | 2052 | echo grub-mount: No "($grub_mount_excuse)" |
92bb0786 | 2053 | fi |
c5884973 DO |
2054 | if [ x"$starfield_excuse" = x ]; then |
2055 | echo starfield theme: Yes | |
443b3222 | 2056 | echo With DejaVuSans font from $DJVU_FONT_SOURCE |
c5884973 DO |
2057 | else |
2058 | echo starfield theme: No "($starfield_excuse)" | |
2059 | fi | |
e4c498a1 MG |
2060 | if [ x"$libzfs_excuse" = x ]; then |
2061 | echo With libzfs support: Yes | |
2062 | else | |
2063 | echo With libzfs support: No "($libzfs_excuse)" | |
2064 | fi | |
7b780018 | 2065 | if [ x"$grub_build_mkfont_excuse" = x ]; then |
7c9d0c39 VS |
2066 | echo Build-time grub-mkfont: Yes |
2067 | if test "x$FONT_SOURCE" = x ; then | |
2068 | echo "Without unifont" | |
2069 | else | |
2070 | echo "With unifont from $FONT_SOURCE" | |
2071 | fi | |
4b80e43c | 2072 | else |
7b780018 | 2073 | echo Build-time grub-mkfont: No "($grub_build_mkfont_excuse)" |
7c9d0c39 | 2074 | echo "Without unifont (no build-time grub-mkfont)" |
4b80e43c | 2075 | fi |
0d2d30bb VS |
2076 | if test x"$liblzma_excuse" != x ; then |
2077 | echo "Without liblzma (no support for XZ-compressed mips images) ($liblzma_excuse)" | |
64fce2d8 VS |
2078 | else |
2079 | echo "With liblzma from $LIBLZMA (support for XZ-compressed mips images)" | |
2080 | fi | |
5ce5507f | 2081 | echo "*******************************************************" |
2082 | ] |