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