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