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