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