]>
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 | ||
216951b0 | 35 | AC_INIT([GRUB],[0],[bug-grub@gnu.org]) dnl version is filled by debian/rules |
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 | |
53 | ||
90d1e879 RM |
54 | # Optimization flag. Allow user to override. |
55 | if test "x$TARGET_CFLAGS" = x; then | |
56 | TARGET_CFLAGS="$TARGET_CFLAGS -Os" | |
57 | fi | |
58 | ||
76ed06b9 BC |
59 | # Default HOST_CPPFLAGS |
60 | HOST_CPPFLAGS="$HOST_CPPFLAGS -Wall -W" | |
76ed06b9 | 61 | HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include" |
76ed06b9 BC |
62 | HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_UTIL=1" |
63 | HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_LIBDIR=\\\"\$(pkglibdir)\\\"" | |
64 | HOST_CPPFLAGS="$HOST_CPPFLAGS -DLOCALEDIR=\\\"\$(localedir)\\\"" | |
65 | ||
66 | TARGET_CPPFLAGS="$TARGET_CPPFLAGS -Wall -W" | |
67 | TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include" | |
68 | TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include" | |
69 | ||
b977bf01 | 70 | case "$target_cpu" in |
02164e1b | 71 | i[[3456]]86) target_cpu=i386 ;; |
c7ef54aa | 72 | amd64) target_cpu=x86_64 ;; |
02164e1b | 73 | sparc) target_cpu=sparc64 ;; |
ade85305 | 74 | mipsel|mips64el) |
76ed06b9 | 75 | target_cpu=mips; |
c721825b | 76 | machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPSEL=1"; |
4a1eefb6 | 77 | ;; |
ade85305 | 78 | mips|mips64) |
76ed06b9 | 79 | target_cpu=mips; |
c721825b | 80 | machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPS=1"; |
4a1eefb6 | 81 | ;; |
6a161fa9 | 82 | esac |
83 | ||
05568c2e | 84 | # Specify the platform (such as firmware). |
85 | AC_ARG_WITH([platform], | |
86 | AS_HELP_STRING([--with-platform=PLATFORM], | |
83b984de | 87 | [select the host platform [[guessed]]])) |
05568c2e | 88 | |
89 | # Guess the platform if not specified. | |
90 | if test "x$with_platform" = x; then | |
b977bf01 | 91 | case "$target_cpu"-"$target_vendor" in |
05568c2e | 92 | i386-apple) platform=efi ;; |
93 | i386-*) platform=pc ;; | |
58393a2d | 94 | x86_64-apple) platform=efi ;; |
737feb35 | 95 | x86_64-*) platform=pc ;; |
05568c2e | 96 | powerpc-*) platform=ieee1275 ;; |
58393a2d | 97 | powerpc64-*) platform=ieee1275 ;; |
05568c2e | 98 | sparc64-*) platform=ieee1275 ;; |
ad17a401 | 99 | mips-*) platform=yeeloong ;; |
58393a2d | 100 | *) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;; |
05568c2e | 101 | esac |
102 | else | |
103 | platform="$with_platform" | |
104 | fi | |
105 | ||
ec1dfd63 VS |
106 | case "$target_cpu"-"$platform" in |
107 | x86_64-efi) ;; | |
108 | x86_64-emu) ;; | |
109 | x86_64-*) target_cpu=i386 ;; | |
110 | powerpc64-ieee1275) target_cpu=powerpc ;; | |
111 | esac | |
20011694 | 112 | |
58393a2d | 113 | # Check if the platform is supported, make final adjustments. |
b977bf01 | 114 | case "$target_cpu"-"$platform" in |
05568c2e | 115 | i386-efi) ;; |
3f4ce737 | 116 | x86_64-efi) ;; |
05568c2e | 117 | i386-pc) ;; |
7210dca9 | 118 | i386-multiboot) ;; |
546f966a | 119 | i386-coreboot) ;; |
58393a2d | 120 | i386-linuxbios) platform=coreboot ;; |
3d04eab8 | 121 | i386-ieee1275) ;; |
8231fb77 | 122 | i386-qemu) ;; |
05568c2e | 123 | powerpc-ieee1275) ;; |
124 | sparc64-ieee1275) ;; | |
7b5f334b | 125 | mips-qemu-mips) ;; |
ad17a401 | 126 | mips-yeeloong) ;; |
f84b481b | 127 | *-emu) ;; |
58393a2d | 128 | *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;; |
6a161fa9 | 129 | esac |
130 | ||
3f4ce737 | 131 | case "$target_cpu" in |
132 | i386 | powerpc) target_m32=1 ;; | |
133 | x86_64 | sparc64) target_m64=1 ;; | |
134 | esac | |
135 | ||
6e5a42fe | 136 | case "$host_os" in |
4825d790 | 137 | mingw32*) host_os=cygwin ;; |
6e5a42fe | 138 | esac |
139 | ||
9304eef1 | 140 | # This normalizes the names, and creates a new variable ("host_kernel") |
141 | # while at it, since the mapping is not always 1:1 (e.g. different OSes | |
142 | # using the same kernel type). | |
143 | case "$host_os" in | |
144 | gnu*) host_kernel=hurd ;; | |
145 | linux*) host_kernel=linux ;; | |
67937d4d | 146 | freebsd* | kfreebsd*-gnu) host_kernel=kfreebsd ;; |
2c7031b1 | 147 | netbsd*) host_kernel=netbsd ;; |
9304eef1 | 148 | cygwin) host_kernel=windows ;; |
149 | esac | |
150 | ||
f84b481b | 151 | case "$platform" in |
c721825b BC |
152 | coreboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_COREBOOT=1" ;; |
153 | multiboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MULTIBOOT=1" ;; | |
154 | efi) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EFI=1" ;; | |
155 | ieee1275) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_IEEE1275=1" ;; | |
156 | qemu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_QEMU=1" ;; | |
157 | pc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_PCBIOS=1" ;; | |
158 | emu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EMU=1" ;; | |
159 | yeeloong) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_YEELOONG=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;; | |
160 | qemu-mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;; | |
f84b481b | 161 | esac |
6bea3f89 | 162 | case "$target_cpu" in |
c721825b BC |
163 | mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS=1" ;; |
164 | sparc64) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_SPARC64=1" ;; | |
6bea3f89 | 165 | esac |
742f9232 | 166 | machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`" |
6bea3f89 | 167 | |
c721825b BC |
168 | HOST_CPPFLAGS="$HOST_CPPFLAGS $machine_CPPFLAGS" |
169 | TARGET_CPPFLAGS="$TARGET_CPPFLAGS $machine_CPPFLAGS" | |
f84b481b | 170 | |
56978920 | 171 | AC_SUBST(host_cpu) |
172 | AC_SUBST(host_os) | |
9304eef1 | 173 | AC_SUBST(host_kernel) |
6e5a42fe | 174 | |
b977bf01 | 175 | AC_SUBST(target_cpu) |
05568c2e | 176 | AC_SUBST(platform) |
6a161fa9 | 177 | |
d87aedff YB |
178 | # Define default variables |
179 | case "$host_os" in | |
180 | netbsd* | openbsd*) | |
181 | # Because /boot is used for the boot block in NetBSD and OpenBSD, | |
182 | bootdirname='' ;; | |
183 | *) bootdirname='boot' ;; | |
184 | esac | |
185 | bootdirname=`echo "$bootdirname" | sed "$program_transform_name"` | |
186 | AC_SUBST(bootdirname) | |
a4c1d277 YB |
187 | AC_DEFINE_UNQUOTED(GRUB_BOOT_DIR_NAME, "$bootdirname", |
188 | [Default boot directory name]") | |
d87aedff YB |
189 | |
190 | grubdirname=`echo "$PACKAGE" | sed "$program_transform_name"` | |
191 | AC_SUBST(grubdirname) | |
a4c1d277 YB |
192 | AC_DEFINE_UNQUOTED(GRUB_DIR_NAME, "$grubdirname", |
193 | [Default grub directory name]) | |
d87aedff | 194 | |
b977bf01 | 195 | # |
196 | # Checks for build programs. | |
197 | # | |
144f1f98 | 198 | |
6c826348 | 199 | # Although cmp is listed in the GNU Coding Standards as a command which |
200 | # can used directly, OpenBSD lacks cmp in the default installation. | |
201 | AC_CHECK_PROGS([CMP], [cmp]) | |
202 | if test "x$CMP" = x; then | |
203 | AC_MSG_ERROR([cmp is not found]) | |
204 | fi | |
205 | ||
144f1f98 | 206 | AC_CHECK_PROGS([YACC], [bison]) |
1569ec51 | 207 | if test "x$YACC" = x; then |
6c826348 | 208 | AC_MSG_ERROR([bison is not found]) |
1569ec51 | 209 | fi |
210 | ||
4d88b9ae VS |
211 | FONT_SOURCE= |
212 | ||
f4d095d7 GS |
213 | for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do |
214 | for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/unifont; do | |
215 | if test -f "$dir/unifont.$ext"; then | |
8e50ec9f | 216 | FONT_SOURCE="$dir/unifont.$ext" |
f4d095d7 GS |
217 | break 2 |
218 | fi | |
219 | done | |
4931827f | 220 | done |
221 | ||
57ebd41e | 222 | if test "x$FONT_SOURCE" = x && ( test "x$platform" = xqemu || test "x$platform" = xyeeloong ); then |
4d88b9ae VS |
223 | AC_MSG_ERROR([qemu and yeeloong ports need unifont]) |
224 | fi | |
225 | ||
76ed06b9 | 226 | AC_SUBST([FONT_SOURCE]) |
8e50ec9f | 227 | |
76ed06b9 | 228 | AC_PROG_RANLIB |
b977bf01 | 229 | AC_PROG_INSTALL |
230 | AC_PROG_AWK | |
09220190 | 231 | AC_PROG_LEX |
76ed06b9 | 232 | AC_PROG_YACC |
b977bf01 | 233 | AC_PROG_MAKE_SET |
ff420223 | 234 | AC_PROG_MKDIR_P |
e1fd1939 | 235 | AC_PROG_LN_S |
b977bf01 | 236 | |
c7c75cf4 | 237 | if test "x$LEX" = "x:"; then |
09220190 BC |
238 | AC_MSG_ERROR([flex is not found]) |
239 | else | |
2663fb5f | 240 | version=`$LEX --version | $AWK '{ split($NF,x,"."); print x[[1]]*10000+x[[2]]*100+x[[3]]; }'` |
b777c18e | 241 | if test -n "$version" -a "$version" -ge 20535; then |
09220190 BC |
242 | : |
243 | else | |
244 | AC_MSG_ERROR([flex is too old. GRUB requires 2.5.35 or above]) | |
245 | fi | |
246 | fi | |
247 | ||
68807e5f | 248 | # These are not a "must". |
51fa856c | 249 | AC_PATH_PROGS(MAKEINFO, makeinfo true) |
6a161fa9 | 250 | |
b977bf01 | 251 | # |
252 | # Checks for host programs. | |
253 | # | |
254 | ||
255 | AC_PROG_CC | |
15c69261 | 256 | gl_EARLY |
76ed06b9 BC |
257 | AM_PROG_CC_C_O |
258 | AM_PROG_AS | |
259 | ||
6a161fa9 | 260 | # Must be GCC. |
261 | test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required]) | |
262 | ||
4889bdec | 263 | AC_GNU_SOURCE |
2f1a3acf | 264 | AM_GNU_GETTEXT([external]) |
b977bf01 | 265 | AC_SYS_LARGEFILE |
266 | ||
267 | # Identify characteristics of the host architecture. | |
268 | AC_C_BIGENDIAN | |
269 | AC_CHECK_SIZEOF(void *) | |
270 | AC_CHECK_SIZEOF(long) | |
271 | ||
2b167a72 | 272 | grub_apple_cc |
c9da87d0 | 273 | if test x$grub_cv_apple_cc = xyes ; then |
76ed06b9 BC |
274 | HOST_CPPFLAGS="$HOST_CPPFLAGS -DAPPLE_CC=1" |
275 | HOST_CFLAGS="$HOST_CFLAGS -fnested-functions" | |
2b167a72 | 276 | fi |
b977bf01 | 277 | |
86695375 | 278 | if test "x$cross_compiling" = xyes; then |
279 | AC_MSG_WARN([cannot generate manual pages while cross compiling]) | |
280 | else | |
281 | AC_PATH_PROG(HELP2MAN, help2man) | |
282 | fi | |
283 | ||
3169f4c7 | 284 | # Check for functions and headers. |
c38fe9f4 RM |
285 | AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf getextmntent) |
286 | AC_CHECK_HEADERS(libzfs.h libnvpair.h sys/param.h sys/mount.h sys/mnttab.h sys/mkdev.h) | |
7c4e16ff | 287 | |
fb90b546 RM |
288 | AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$ac_includes_default |
289 | #include <sys/param.h> | |
290 | #include <sys/mount.h>]) | |
291 | ||
292 | AC_CHECK_MEMBERS([struct statfs.f_mntfromname],,,[$ac_includes_default | |
293 | #include <sys/param.h> | |
294 | #include <sys/mount.h>]) | |
7c4e16ff | 295 | |
2c7031b1 GS |
296 | # For opendisk() and getrawpartition() on NetBSD. |
297 | # Used in util/deviceiter.c and in util/hostdisk.c. | |
298 | AC_CHECK_HEADER([util.h], [ | |
299 | AC_CHECK_LIB([util], [opendisk], [ | |
300 | LIBUTIL="-lutil" | |
301 | AC_DEFINE(HAVE_OPENDISK, 1, [Define if opendisk() in -lutil can be used]) | |
302 | ]) | |
303 | AC_CHECK_LIB([util], [getrawpartition], [ | |
304 | LIBUTIL="-lutil" | |
305 | AC_DEFINE(HAVE_GETRAWPARTITION, 1, [Define if getrawpartition() in -lutil can be used]) | |
306 | ]) | |
307 | ]) | |
308 | AC_SUBST([LIBUTIL]) | |
309 | ||
76ed06b9 BC |
310 | # |
311 | # Check for host and build compilers. | |
312 | # | |
313 | HOST_CC=$CC | |
314 | AC_CHECK_PROGS(BUILD_CC, [gcc egcs cc], | |
315 | [AC_MSG_ERROR([none of gcc, egcs and cc is found. set BUILD_CC manually.])]) | |
316 | ||
15c69261 YB |
317 | # For gnulib. |
318 | gl_INIT | |
319 | ||
b977bf01 | 320 | # |
321 | # Check for target programs. | |
322 | # | |
323 | ||
5b5d4aa5 | 324 | # Find tools for the target. |
325 | if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then | |
b977bf01 | 326 | tmp_ac_tool_prefix="$ac_tool_prefix" |
327 | ac_tool_prefix=$target_alias- | |
328 | ||
329 | AC_CHECK_TOOLS(TARGET_CC, [gcc egcs cc], | |
330 | [AC_MSG_ERROR([none of gcc, egcs and cc is found. set TARGET_CC manually.])]) | |
331 | AC_CHECK_TOOL(OBJCOPY, objcopy) | |
332 | AC_CHECK_TOOL(STRIP, strip) | |
333 | AC_CHECK_TOOL(NM, nm) | |
334 | ||
335 | ac_tool_prefix="$tmp_ac_tool_prefix" | |
336 | else | |
337 | if test "x$TARGET_CC" = x; then | |
338 | TARGET_CC=$CC | |
339 | fi | |
340 | AC_CHECK_TOOL(OBJCOPY, objcopy) | |
341 | AC_CHECK_TOOL(STRIP, strip) | |
342 | AC_CHECK_TOOL(NM, nm) | |
343 | fi | |
76ed06b9 BC |
344 | AC_SUBST(HOST_CC) |
345 | AC_SUBST(BUILD_CC) | |
b977bf01 | 346 | AC_SUBST(TARGET_CC) |
347 | ||
b977bf01 | 348 | # Test the C compiler for the target environment. |
349 | tmp_CC="$CC" | |
350 | tmp_CFLAGS="$CFLAGS" | |
351 | tmp_LDFLAGS="$LDFLAGS" | |
352 | tmp_CPPFLAGS="$CPPFLAGS" | |
aa6d7826 | 353 | tmp_LIBS="$LIBS" |
b977bf01 | 354 | CC="$TARGET_CC" |
355 | CFLAGS="$TARGET_CFLAGS" | |
356 | CPPFLAGS="$TARGET_CPPFLAGS" | |
357 | LDFLAGS="$TARGET_LDFLAGS" | |
aa6d7826 | 358 | LIBS="" |
b977bf01 | 359 | |
90d1e879 | 360 | # debug flags. |
76ed06b9 BC |
361 | TARGET_CFLAGS="$TARGET_CFLAGS -Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes -Wundef -Wstrict-prototypes -g" |
362 | TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g" | |
6a161fa9 | 363 | |
90d1e879 RM |
364 | # Force no alignment to save space on i386. |
365 | if test "x$target_cpu" = xi386; then | |
366 | AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [ | |
367 | CFLAGS="$CFLAGS -falign-loops=1" | |
eb73121d | 368 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], |
90d1e879 RM |
369 | [grub_cv_cc_falign_loop=yes], |
370 | [grub_cv_cc_falign_loop=no]) | |
6a161fa9 | 371 | ]) |
6a161fa9 | 372 | |
90d1e879 RM |
373 | if test "x$grub_cv_cc_falign_loop" = xyes; then |
374 | TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1" | |
375 | else | |
376 | TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1" | |
6a161fa9 | 377 | fi |
77c55a87 | 378 | |
90d1e879 RM |
379 | # Some toolchains enable these features by default, but they need |
380 | # registers that aren't set up properly in GRUB. | |
381 | TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow" | |
382 | fi | |
77c55a87 | 383 | |
90d1e879 RM |
384 | # By default, GCC 4.4 generates .eh_frame sections containing unwind |
385 | # information in some cases where it previously did not. GRUB doesn't need | |
386 | # these and they just use up vital space. Restore the old compiler | |
387 | # behaviour. | |
388 | AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [ | |
389 | SAVE_CFLAGS="$CFLAGS" | |
390 | CFLAGS="$CFLAGS -fno-dwarf2-cfi-asm" | |
391 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], | |
392 | [grub_cv_cc_fno_dwarf2_cfi_asm=yes], | |
393 | [grub_cv_cc_fno_dwarf2_cfi_asm=no]) | |
394 | CFLAGS="$SAVE_CFLAGS" | |
395 | ]) | |
396 | ||
397 | if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then | |
398 | TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm" | |
b977bf01 | 399 | fi |
6a161fa9 | 400 | |
d2bf06bf RM |
401 | if test "${target_cpu}-${platform}" = mips-yeeloong; then |
402 | AC_CACHE_CHECK([whether -march=loongson2f works], [grub_cv_cc_march_loongson2f], [ | |
403 | SAVE_CFLAGS="$CFLAGS" | |
404 | CFLAGS="$CFLAGS -march=loongson2f" | |
405 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], | |
406 | [grub_cv_cc_march_loongson2f=yes], | |
407 | [grub_cv_cc_march_loongson2f=no]) | |
408 | CFLAGS="$SAVE_CFLAGS" | |
409 | ]) | |
410 | ||
411 | if test "x$grub_cv_cc_march_loongson2f" = xyes; then | |
412 | TARGET_CFLAGS="$TARGET_CFLAGS -march=loongson2f" | |
413 | else | |
414 | TARGET_CFLAGS="$TARGET_CFLAGS -march=mips3" | |
415 | fi | |
416 | fi | |
417 | ||
2b167a72 | 418 | grub_apple_target_cc |
c9da87d0 | 419 | if test x$grub_cv_apple_target_cc = xyes ; then |
76ed06b9 BC |
420 | TARGET_CPPFLAGS="$TARGET_CPPFLAGS -DAPPLE_CC=1" |
421 | TARGET_CFLAGS="$TARGET_CFLAGS -fnested-functions" | |
422 | ||
2b167a72 | 423 | CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions" |
2b167a72 | 424 | TARGET_APPLE_CC=1 |
cf00df31 | 425 | AC_CHECK_PROG([OBJCONV], [objconv], [objconv], []) |
426 | if test "x$OBJCONV" = x ; then | |
427 | AC_CHECK_PROG([OBJCONV], [objconv], [./objconv], [], [.]) | |
428 | fi | |
429 | if test "x$OBJCONV" = x ; then | |
430 | AC_MSG_ERROR([objconv not found which is required when building with apple compiler]) | |
431 | fi | |
2b167a72 | 432 | TARGET_IMG_LDSCRIPT= |
433 | TARGET_IMG_CFLAGS="-static" | |
76ed06b9 BC |
434 | TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20' |
435 | TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20' | |
436 | TARGET_IMG_BASE_LDOPT="-Wl,-image_base" | |
2b167a72 | 437 | else |
438 | TARGET_APPLE_CC=0 | |
439 | # Use linker script if present, otherwise use builtin -N script. | |
76ed06b9 BC |
440 | if test -f "${srcdir}/${grub_coredir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"; then |
441 | TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/${grub_coredir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc" | |
442 | TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT}" | |
443 | TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/${grub_coredir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc" | |
444 | TARGET_IMG_BASE_LDOPT="-Wl,-Ttext" | |
2b167a72 | 445 | else |
446 | TARGET_IMG_LDSCRIPT= | |
76ed06b9 BC |
447 | TARGET_IMG_LDFLAGS='-Wl,-N' |
448 | TARGET_IMG_LDFLAGS_AC='-Wl,-N' | |
449 | TARGET_IMG_BASE_LDOPT="-Wl,-Ttext" | |
2b167a72 | 450 | fi |
451 | TARGET_IMG_CFLAGS= | |
452 | fi | |
453 | ||
2b167a72 | 454 | # For platforms where ELF is not the default link format. |
455 | AC_MSG_CHECKING([for command to convert module to ELF format]) | |
456 | case "${host_os}" in | |
f1632d4d | 457 | cygwin) TARGET_OBJ2ELF='$(top_builddir)/grub-pe2elf'; |
4b0cd8f8 | 458 | # FIXME: put proper test here |
742f9232 | 459 | NEED_REGISTER_FRAME_INFO=1 |
4b0cd8f8 | 460 | ;; |
742f9232 | 461 | *) NEED_REGISTER_FRAME_INFO=0 ;; |
2b167a72 | 462 | esac |
2b167a72 | 463 | AC_MSG_RESULT([$TARGET_OBJ2ELF]) |
464 | ||
b977bf01 | 465 | if test "x$target_m32" = x1; then |
466 | # Force 32-bit mode. | |
467 | TARGET_CFLAGS="$TARGET_CFLAGS -m32" | |
76ed06b9 | 468 | TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m32" |
b977bf01 | 469 | TARGET_LDFLAGS="$TARGET_LDFLAGS -m32" |
2b167a72 | 470 | TARGET_MODULE_FORMAT="elf32" |
6a161fa9 | 471 | fi |
b977bf01 | 472 | |
20011694 | 473 | if test "x$target_m64" = x1; then |
474 | # Force 64-bit mode. | |
7e9ca17a | 475 | TARGET_CFLAGS="$TARGET_CFLAGS -m64" |
76ed06b9 | 476 | TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m64" |
7e9ca17a | 477 | TARGET_LDFLAGS="$TARGET_LDFLAGS -m64" |
2b167a72 | 478 | TARGET_MODULE_FORMAT="elf64" |
7e9ca17a | 479 | fi |
480 | ||
481 | if test "$target_cpu"-"$platform" = x86_64-efi; then | |
482 | # Use large model to support 4G memory | |
6e09b8b7 | 483 | AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [ |
c8600122 | 484 | SAVED_CFLAGS=$CFLAGS |
485 | CFLAGS="$CFLAGS -m64 -mcmodel=large" | |
6e09b8b7 | 486 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], |
487 | [grub_cv_cc_mcmodel=yes], | |
488 | [grub_cv_cc_mcmodel=no]) | |
489 | ]) | |
c8600122 | 490 | if test "x$grub_cv_cc_mcmodel" = xno; then |
4ba8d354 | 491 | AC_MSG_ERROR([-mcmodel=large not supported. Upgrade your gcc.]) |
c8600122 | 492 | else |
493 | TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large" | |
6e09b8b7 | 494 | fi |
7e9ca17a | 495 | |
496 | # EFI writes to stack below %rsp, we must not use the red zone | |
497 | AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [ | |
c8600122 | 498 | CFLAGS="$CFLAGS -m64 -mno-red-zone" |
7e9ca17a | 499 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], |
500 | [grub_cv_cc_no_red_zone=yes], | |
501 | [grub_cv_cc_no_red_zone=no]) | |
502 | ]) | |
503 | if test "x$grub_cv_cc_no_red_zone" = xno; then | |
504 | AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc]) | |
505 | fi | |
506 | ||
c8600122 | 507 | TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone" |
20011694 | 508 | fi |
509 | ||
baa2a121 | 510 | # |
511 | # Compiler features. | |
512 | # | |
513 | ||
9035dce4 | 514 | # Need __enable_execute_stack() for nested function trampolines? |
515 | grub_CHECK_ENABLE_EXECUTE_STACK | |
516 | ||
93a81088 | 517 | # Position independent executable. |
518 | grub_CHECK_PIE | |
519 | [# Need that, because some distributions ship compilers that include | |
520 | # `-fPIE' in the default specs. | |
521 | if [ x"$pie_possible" = xyes ]; then | |
522 | TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE" | |
523 | fi] | |
524 | ||
baa2a121 | 525 | # Smashing stack protector. |
526 | grub_CHECK_STACK_PROTECTOR | |
c3db8364 | 527 | # Need that, because some distributions ship compilers that include |
baa2a121 | 528 | # `-fstack-protector' in the default specs. |
c3db8364 | 529 | if test "x$ssp_possible" = xyes; then |
530 | TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector" | |
531 | fi | |
2a8a80e4 | 532 | grub_CHECK_STACK_ARG_PROBE |
533 | # Cygwin's GCC uses alloca() to probe the stackframe on static | |
534 | # stack allocations above some threshold. | |
535 | if test x"$sap_possible" = xyes; then | |
536 | TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe" | |
537 | fi | |
baa2a121 | 538 | |
63f745e8 | 539 | AC_ARG_ENABLE([werror], |
540 | [AS_HELP_STRING([--disable-werror], | |
541 | [do not use -Werror when building GRUB])]) | |
542 | if test x"$enable_werror" != xno ; then | |
543 | TARGET_CFLAGS="$TARGET_CFLAGS -Werror" | |
544 | fi | |
545 | ||
76ed06b9 BC |
546 | TARGET_CPP="$TARGET_CC -E" |
547 | TARGET_CCAS=$TARGET_CC | |
548 | ||
cf00df31 | 549 | AC_SUBST(OBJCONV) |
76ed06b9 BC |
550 | AC_SUBST(TARGET_CPP) |
551 | AC_SUBST(TARGET_CCAS) | |
552 | AC_SUBST(TARGET_OBJ2ELF) | |
2b167a72 | 553 | AC_SUBST(TARGET_APPLE_CC) |
76ed06b9 BC |
554 | AC_SUBST(TARGET_MODULE_FORMAT) |
555 | ||
556 | AC_SUBST(TARGET_CFLAGS) | |
b977bf01 | 557 | AC_SUBST(TARGET_LDFLAGS) |
76ed06b9 BC |
558 | AC_SUBST(TARGET_CPPFLAGS) |
559 | AC_SUBST(TARGET_CCASFLAGS) | |
560 | ||
561 | AC_SUBST(TARGET_IMG_LDSCRIPT) | |
562 | AC_SUBST(TARGET_IMG_LDFLAGS) | |
563 | AC_SUBST(TARGET_IMG_CFLAGS) | |
564 | AC_SUBST(TARGET_IMG_BASE_LDOPT) | |
565 | ||
566 | AC_SUBST(HOST_CFLAGS) | |
567 | AC_SUBST(HOST_LDFLAGS) | |
568 | AC_SUBST(HOST_CPPFLAGS) | |
569 | AC_SUBST(HOST_CCASFLAGS) | |
6a161fa9 | 570 | |
aa6d7826 | 571 | # Set them to their new values for the tests below. |
572 | CC="$TARGET_CC" | |
26de2bcd | 573 | if test "x$TARGET_APPLE_CC" = x1 ; then |
69be5b74 | 574 | CFLAGS="$TARGET_CFLAGS -nostdlib -Wno-error" |
26de2bcd | 575 | else |
01fcf061 | 576 | CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100 -Wno-error" |
26de2bcd | 577 | fi |
aa6d7826 | 578 | CPPFLAGS="$TARGET_CPPFLAGS" |
03f80960 VS |
579 | if test x$target_cpu = xi386 || test x$target_cpu = xx86_64 ; then |
580 | LIBS= | |
581 | else | |
69be5b74 | 582 | LIBS=-lgcc |
03f80960 | 583 | fi |
69be5b74 | 584 | |
01fcf061 VS |
585 | grub_ASM_USCORE |
586 | if test x$grub_cv_asm_uscore = xyes; then | |
587 | CFLAGS="$CFLAGS -Wl,--defsym,_abort=_main" | |
588 | else | |
589 | CFLAGS="$CFLAGS -Wl,--defsym,abort=main" | |
590 | fi | |
591 | ||
69be5b74 VS |
592 | # Check for libgcc symbols |
593 | AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __trampoline_setup __ucmpdi2 _restgpr_14_x) | |
594 | ||
595 | if test "x$TARGET_APPLE_CC" = x1 ; then | |
596 | CFLAGS="$TARGET_CFLAGS -nostdlib" | |
597 | else | |
598 | CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100" | |
599 | fi | |
42e0cba3 | 600 | LIBS="" |
aa6d7826 | 601 | |
6a161fa9 | 602 | # Defined in aclocal.m4. |
f6130a12 | 603 | grub_PROG_TARGET_CC |
2b167a72 | 604 | if test "x$TARGET_APPLE_CC" != x1 ; then |
b977bf01 | 605 | grub_PROG_OBJCOPY_ABSOLUTE |
2b167a72 | 606 | fi |
cb71ba20 | 607 | grub_PROG_LD_BUILD_ID_NONE |
b977bf01 | 608 | if test "x$target_cpu" = xi386; then |
2aec1692 CF |
609 | if test "$platform" != emu && test "x$TARGET_APPLE_CC" != x1 ; then |
610 | if test ! -z "$TARGET_IMG_LDSCRIPT"; then | |
611 | # Check symbols provided by linker script. | |
76ed06b9 | 612 | CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC} ${TARGET_IMG_BASE_LDOPT},8000 -Wl,--defsym,___main=0x8100" |
2aec1692 | 613 | fi |
2a8a80e4 | 614 | grub_CHECK_BSS_START_SYMBOL |
615 | grub_CHECK_END_SYMBOL | |
616 | fi | |
617 | CFLAGS="$TARGET_CFLAGS" | |
4b13b216 | 618 | grub_I386_ASM_PREFIX_REQUIREMENT |
619 | grub_I386_ASM_ADDR32 | |
6a161fa9 | 620 | fi |
621 | ||
5ce5507f | 622 | AC_ARG_ENABLE([efiemu], |
623 | [AS_HELP_STRING([--enable-efiemu], | |
624 | [build and install the efiemu runtimes (default=guessed)])]) | |
625 | if test x"$enable_efiemu" = xno ; then | |
ce7a733d | 626 | efiemu_excuse="explicitly disabled" |
5ce5507f | 627 | fi |
05f602fc VS |
628 | if test x"$target_cpu" != xi386 ; then |
629 | efiemu_excuse="only available on i386" | |
630 | fi | |
cfdcef12 | 631 | if test x"$platform" = xefi ; then |
05f602fc VS |
632 | efiemu_excuse="not available on efi" |
633 | fi | |
5ce5507f | 634 | if test x"$efiemu_excuse" = x ; then |
43e6200c | 635 | AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [ |
d2838156 | 636 | CFLAGS="$CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib" |
5ce5507f | 637 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], |
638 | [grub_cv_cc_efiemu=yes], | |
639 | [grub_cv_cc_efiemu=no]) | |
640 | ]) | |
55c70904 | 641 | if test x$grub_cv_cc_efiemu = xno; then |
e98cd0c2 | 642 | efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib" |
5ce5507f | 643 | fi |
644 | fi | |
645 | if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then | |
ce7a733d | 646 | AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled]) |
5ce5507f | 647 | fi |
648 | if test x"$efiemu_excuse" = x ; then | |
649 | enable_efiemu=yes | |
650 | else | |
651 | enable_efiemu=no | |
652 | fi | |
653 | AC_SUBST([enable_efiemu]) | |
654 | ||
016a671b | 655 | if test "$platform" != emu; then |
8f9a632b VS |
656 | AC_CACHE_CHECK([whether -nostdinc -isystem works], [grub_cv_cc_isystem], [ |
657 | SAVED_CPPFLAGS="$CPPFLAGS" | |
658 | CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`" | |
659 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h> | |
660 | int va_arg_func (int fixed, va_list args);]], [[]])], | |
661 | [grub_cv_cc_isystem=yes], | |
662 | [grub_cv_cc_isystem=no]) | |
663 | CPPFLAGS="$SAVED_CPPFLAGS" | |
664 | ]) | |
665 | ||
666 | if test x"$grub_cv_cc_isystem" = xyes ; then | |
667 | TARGET_CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`" | |
668 | fi | |
dae79b6b | 669 | fi |
5ce5507f | 670 | |
779dc15b VS |
671 | AC_CACHE_CHECK([whether -Wno-trampolines work], [grub_cv_cc_wnotrampolines], [ |
672 | SAVED_CFLAGS="$CFLAGS" | |
72b7c7aa CW |
673 | # Test for -Wtrampolines rather than -Wno-trampolines to reduce confusion |
674 | # in the event of later failures (since -Wno-* is always accepted, but | |
675 | # produces a diagnostic if something else is wrong). | |
676 | CFLAGS="$TARGET_CFLAGS -Wtrampolines" | |
779dc15b VS |
677 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h> |
678 | int va_arg_func (int fixed, va_list args);]], [[]])], | |
679 | [grub_cv_cc_wnotrampolines=yes], | |
680 | [grub_cv_cc_wnotrampolines=no]) | |
681 | CFLAGS="$SAVED_CFLAGS" | |
682 | ]) | |
683 | ||
684 | if test x"$grub_cv_cc_wnotrampolines" = xyes ; then | |
685 | TARGET_CFLAGS="$TARGET_CFLAGS -Wno-trampolines" | |
686 | fi | |
687 | ||
c9a86192 | 688 | # Restore the flags. |
9962ed99 | 689 | CC="$tmp_CC" |
690 | CFLAGS="$tmp_CFLAGS" | |
691 | CPPFLAGS="$tmp_CPPFLAGS" | |
c9a86192 | 692 | LDFLAGS="$tmp_LDFLAGS" |
aa6d7826 | 693 | LIBS="$tmp_LIBS" |
6a161fa9 | 694 | |
4fe9862e | 695 | # |
2965c7cc | 696 | # Check for options. |
4fe9862e | 697 | # |
698 | ||
699 | # Memory manager debugging. | |
b39f9d20 | 700 | AC_ARG_ENABLE([mm-debug], |
2965c7cc | 701 | AS_HELP_STRING([--enable-mm-debug], |
90ce5d56 | 702 | [include memory manager debugging]), |
2965c7cc | 703 | [AC_DEFINE([MM_DEBUG], [1], |
704 | [Define to 1 if you enable memory manager debugging.])]) | |
705 | ||
d64399b5 | 706 | AC_ARG_ENABLE([grub-emu-usb], |
707 | [AS_HELP_STRING([--enable-grub-emu-usb], | |
5ce5507f | 708 | [build and install the `grub-emu' debugging utility with USB support (default=guessed)])]) |
5ce5507f | 709 | |
927d0134 VS |
710 | AC_ARG_ENABLE([grub-emu-sdl], |
711 | [AS_HELP_STRING([--enable-grub-emu-sdl], | |
712 | [build and install the `grub-emu' debugging utility with SDL support (default=guessed)])]) | |
713 | ||
3affd0ec | 714 | AC_ARG_ENABLE([grub-emu-pci], |
715 | [AS_HELP_STRING([--enable-grub-emu-pci], | |
716 | [build and install the `grub-emu' debugging utility with PCI support (potentially dangerous) (default=no)])]) | |
717 | ||
f84b481b RM |
718 | if test "$platform" = emu; then |
719 | missing_ncurses= | |
720 | [# Check for curses libraries.] | |
4fe9862e | 721 | AC_CHECK_LIB([ncurses], [wgetch], [LIBCURSES="-lncurses"], |
722 | [AC_CHECK_LIB([curses], [wgetch], [LIBCURSES="-lcurses"], | |
f84b481b | 723 | [missing_ncurses=[true]])]) |
4fe9862e | 724 | AC_SUBST([LIBCURSES]) |
f84b481b | 725 | [if [ x"$missing_ncurses" = x ]; then ] |
4fe9862e | 726 | [# Check for headers.] |
727 | AC_CHECK_HEADERS([ncurses/curses.h], [], | |
728 | [AC_CHECK_HEADERS([ncurses.h], [], | |
729 | [AC_CHECK_HEADERS([curses.h], [], | |
f84b481b | 730 | [missing_ncurses=[true]])])]) |
5ce5507f | 731 | [fi] |
f84b481b RM |
732 | if test x"$missing_ncurses" = xtrue ; then |
733 | AC_MSG_ERROR([grub-emu can't be compiled without ncurses]) | |
5ce5507f | 734 | fi |
f84b481b | 735 | |
62a747cb VS |
736 | if test x"$enable_grub_emu_usb" != xyes ; then |
737 | grub_emu_usb_excuse="not enabled" | |
5ce5507f | 738 | fi |
325c8258 | 739 | |
0e848909 VS |
740 | if test x"$enable_grub_emu_pci" = xyes ; then |
741 | grub_emu_usb_excuse="conflicts with PCI support" | |
742 | fi | |
743 | ||
5ce5507f | 744 | [if [ x"$grub_emu_usb_excuse" = x ]; then |
d64399b5 | 745 | # Check for libusb libraries.] |
5ce5507f | 746 | AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"], |
e98cd0c2 | 747 | [grub_emu_usb_excuse=["need libusb library"]]) |
d64399b5 | 748 | AC_SUBST([LIBUSB]) |
5ce5507f | 749 | [fi] |
750 | [if [ x"$grub_emu_usb_excuse" = x ]; then | |
751 | # Check for headers.] | |
d64399b5 | 752 | AC_CHECK_HEADERS([usb.h], [], |
e98cd0c2 | 753 | [grub_emu_usb_excuse=["need libusb headers"]]) |
4fe9862e | 754 | [fi] |
c6f3b249 | 755 | if test x"$enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then |
ce7a733d | 756 | AC_MSG_ERROR([USB support for grub-emu was explicitly requested but can't be compiled]) |
5ce5507f | 757 | fi |
758 | if test x"$grub_emu_usb_excuse" = x ; then | |
759 | enable_grub_emu_usb=yes | |
760 | else | |
761 | enable_grub_emu_usb=no | |
762 | fi | |
763 | ||
927d0134 VS |
764 | if test x"$enable_grub_emu_sdl" = xno ; then |
765 | grub_emu_sdl_excuse="explicitely disabled" | |
766 | fi | |
767 | [if [ x"$grub_emu_sdl_excuse" = x ]; then | |
768 | # Check for libSDL libraries.] | |
769 | AC_CHECK_LIB([SDL], [SDL_Init], [LIBSDL="-lSDL"], | |
770 | [grub_emu_sdl_excuse=["libSDL libraries are required to build \`grub-emu' with SDL support"]]) | |
771 | AC_SUBST([LIBSDL]) | |
772 | [fi] | |
9f293ab0 | 773 | |
927d0134 VS |
774 | [if [ x"$grub_emu_sdl_excuse" = x ]; then |
775 | # Check for headers.] | |
776 | AC_CHECK_HEADERS([SDL/SDL.h], [], | |
777 | [grub_emu_sdl_excuse=["libSDL header file is required to build \`grub-emu' with SDL support"]]) | |
778 | [fi] | |
9f293ab0 | 779 | |
927d0134 VS |
780 | if test x"enable_grub_emu_sdl" = xyes && test x"$grub_emu_sdl_excuse" != x ; then |
781 | AC_MSG_ERROR([SDL support for grub-emu was explicitely requested but can't be compiled]) | |
782 | fi | |
783 | if test x"$grub_emu_sdl_excuse" = x ; then | |
784 | enable_grub_emu_sdl=yes | |
785 | else | |
786 | enable_grub_emu_sdl=no | |
787 | fi | |
788 | ||
3affd0ec | 789 | if test x"$enable_grub_emu_pci" != xyes ; then |
325c8258 | 790 | grub_emu_pci_excuse="not enabled" |
791 | fi | |
792 | ||
793 | if test x"$enable_grub_emu_usb" = xyes ; then | |
794 | grub_emu_pci_excuse="conflicts with USB support" | |
795 | fi | |
796 | ||
797 | [if [ x"$grub_emu_pci_excuse" = x ]; then | |
798 | # Check for libpci libraries.] | |
459fed4b | 799 | AC_CHECK_LIB([pciaccess], [pci_system_init], [LIBPCIACCESS="-lpciaccess"], |
800 | [grub_emu_pci_excuse=["need libpciaccess library"]]) | |
801 | AC_SUBST([LIBPCIACCESS]) | |
325c8258 | 802 | [fi] |
803 | [if [ x"$grub_emu_pci_excuse" = x ]; then | |
804 | # Check for headers.] | |
805 | AC_CHECK_HEADERS([pci/pci.h], [], | |
459fed4b | 806 | [grub_emu_pci_excuse=["need libpciaccess headers"]]) |
325c8258 | 807 | [fi] |
808 | ||
809 | if test x"$grub_emu_pci_excuse" = x ; then | |
810 | enable_grub_emu_pci=yes | |
811 | else | |
9f293ab0 | 812 | |
325c8258 | 813 | enable_grub_emu_pci=no |
3affd0ec | 814 | fi |
815 | ||
927d0134 | 816 | AC_SUBST([enable_grub_emu_sdl]) |
d64399b5 | 817 | AC_SUBST([enable_grub_emu_usb]) |
3affd0ec | 818 | AC_SUBST([enable_grub_emu_pci]) |
f84b481b | 819 | fi |
4fe9862e | 820 | |
e52db1f7 | 821 | AC_ARG_ENABLE([grub-mkfont], |
822 | [AS_HELP_STRING([--enable-grub-mkfont], | |
5ce5507f | 823 | [build and install the `grub-mkfont' utility (default=guessed)])]) |
824 | if test x"$enable_grub_mkfont" = xno ; then | |
ce7a733d | 825 | grub_mkfont_excuse="explicitly disabled" |
5ce5507f | 826 | fi |
827 | ||
828 | if test x"$grub_mkfont_excuse" = x ; then | |
e52db1f7 | 829 | # Check for freetype libraries. |
830 | AC_CHECK_PROGS([FREETYPE], [freetype-config]) | |
831 | if test "x$FREETYPE" = x ; then | |
e98cd0c2 | 832 | grub_mkfont_excuse=["need freetype2 library"] |
e52db1f7 | 833 | fi |
e52db1f7 | 834 | fi |
660960d6 VS |
835 | |
836 | if test x"$grub_mkfont_excuse" = x ; then | |
837 | # Check for freetype libraries. | |
10854d0d YB |
838 | freetype_cflags=`freetype-config --cflags` |
839 | freetype_libs=`freetype-config --libs` | |
d1e8a02f VS |
840 | SAVED_CPPFLAGS="$CPPFLAGS" |
841 | CPPFLAGS="$CPPFLAGS $freetype_cflags" | |
660960d6 VS |
842 | AC_CHECK_HEADERS([ft2build.h], [], |
843 | [grub_mkfont_excuse=["need freetype2 headers"]]) | |
d1e8a02f | 844 | CPPFLAGS="$SAVED_CPPFLAGS" |
660960d6 VS |
845 | fi |
846 | ||
5ce5507f | 847 | if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then |
ce7a733d | 848 | AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled]) |
5ce5507f | 849 | fi |
850 | if test x"$grub_mkfont_excuse" = x ; then | |
851 | enable_grub_mkfont=yes | |
852 | else | |
853 | enable_grub_mkfont=no | |
854 | fi | |
e52db1f7 | 855 | AC_SUBST([enable_grub_mkfont]) |
856 | AC_SUBST([freetype_cflags]) | |
857 | AC_SUBST([freetype_libs]) | |
858 | ||
7181e228 CW |
859 | AC_ARG_ENABLE([device-mapper], |
860 | [AS_HELP_STRING([--enable-device-mapper], | |
861 | [enable Linux device-mapper support (default=guessed)])]) | |
862 | if test x"$enable_device_mapper" = xno ; then | |
863 | device_mapper_excuse="explicitly disabled" | |
864 | fi | |
865 | ||
53798c4b GS |
866 | if test x"$device_mapper_excuse" = x ; then |
867 | # Check for device-mapper header. | |
868 | AC_CHECK_HEADER([libdevmapper.h], [], | |
869 | [device_mapper_excuse="need libdevmapper header"]) | |
870 | fi | |
871 | ||
7181e228 CW |
872 | if test x"$device_mapper_excuse" = x ; then |
873 | # Check for device-mapper library. | |
61d720e5 | 874 | AC_CHECK_LIB([devmapper], [dm_task_create], [], |
7181e228 | 875 | [device_mapper_excuse="need devmapper library"]) |
7181e228 | 876 | fi |
61d720e5 VS |
877 | |
878 | if test x"$device_mapper_excuse" = x ; then | |
879 | # Check for device-mapper library. | |
880 | AC_CHECK_LIB([devmapper], [dm_log_with_errno_init], | |
881 | [], | |
7181e228 | 882 | [device_mapper_excuse="need devmapper library"]) |
7181e228 CW |
883 | fi |
884 | ||
61d720e5 VS |
885 | if test x"$device_mapper_excuse" = x ; then |
886 | LIBDEVMAPPER="-ldevmapper"; | |
887 | AC_DEFINE([HAVE_DEVICE_MAPPER], [1], | |
888 | [Define to 1 if you have the devmapper library.]) | |
889 | fi | |
890 | ||
62f7d208 | 891 | AC_SUBST([LIBDEVMAPPER]) |
76ed06b9 | 892 | |
2c44e493 VS |
893 | AC_CHECK_LIB([lzma], [lzma_code], |
894 | [LIBLZMA="-llzma" | |
895 | AC_DEFINE([HAVE_LIBLZMA], [1], | |
896 | [Define to 1 if you have the LZMA library.])],) | |
897 | AC_SUBST([LIBLZMA]) | |
898 | ||
a184f9c8 | 899 | AC_CHECK_LIB([zfs], [libzfs_init], |
16c7cb32 | 900 | [LIBZFS="-lzfs" |
a184f9c8 RM |
901 | AC_DEFINE([HAVE_LIBZFS], [1], |
902 | [Define to 1 if you have the ZFS library.])],) | |
16c7cb32 BC |
903 | AC_SUBST([LIBZFS]) |
904 | ||
a184f9c8 | 905 | AC_CHECK_LIB([nvpair], [nvlist_print], |
16c7cb32 | 906 | [LIBNVPAIR="-lnvpair" |
a184f9c8 RM |
907 | AC_DEFINE([HAVE_LIBNVPAIR], [1], |
908 | [Define to 1 if you have the NVPAIR library.])],) | |
16c7cb32 | 909 | AC_SUBST([LIBNVPAIR]) |
a184f9c8 | 910 | |
9f915872 VS |
911 | LIBS="" |
912 | ||
76ed06b9 BC |
913 | pkglibrootdir='$(libdir)'/`echo $PACKAGE | sed "$program_transform_name"` |
914 | AC_SUBST(pkglibrootdir) | |
915 | ||
916 | AC_SUBST([FONT_SOURCE]) | |
76ed06b9 BC |
917 | AS_IF([test x$target_cpu = xi386 -a x$platform = xqemu], |
918 | [AC_SUBST([GRUB_BOOT_MACHINE_LINK_ADDR], 0xffe00)]) | |
76ed06b9 BC |
919 | AS_IF([test x$TARGET_APPLE_CC = x1], |
920 | [AC_SUBST([USE_APPLE_CC_FIXES], yes)]) | |
7181e228 | 921 | |
742f9232 VS |
922 | AC_SUBST(HAVE_ASM_USCORE) |
923 | AC_SUBST(ADDR32) | |
924 | AC_SUBST(DATA32) | |
925 | AC_SUBST(BSS_START_SYMBOL) | |
926 | AC_SUBST(END_SYMBOL) | |
927 | AC_SUBST(PACKAGE) | |
928 | AC_SUBST(VERSION) | |
929 | AC_SUBST(NEED_ENABLE_EXECUTE_STACK) | |
930 | AC_SUBST(NEED_REGISTER_FRAME_INFO) | |
931 | ||
76ed06b9 BC |
932 | # |
933 | # Automake conditionals | |
934 | # | |
8c411768 | 935 | |
76ed06b9 BC |
936 | AM_CONDITIONAL([COND_emu], [test x$platform = xemu]) |
937 | AM_CONDITIONAL([COND_i386_pc], [test x$target_cpu = xi386 -a x$platform = xpc]) | |
938 | AM_CONDITIONAL([COND_i386_efi], [test x$target_cpu = xi386 -a x$platform = xefi]) | |
939 | AM_CONDITIONAL([COND_i386_qemu], [test x$target_cpu = xi386 -a x$platform = xqemu]) | |
940 | AM_CONDITIONAL([COND_i386_ieee1275], [test x$target_cpu = xi386 -a x$platform = xieee1275]) | |
941 | AM_CONDITIONAL([COND_i386_coreboot], [test x$target_cpu = xi386 -a x$platform = xcoreboot]) | |
942 | AM_CONDITIONAL([COND_i386_multiboot], [test x$target_cpu = xi386 -a x$platform = xmultiboot]) | |
943 | AM_CONDITIONAL([COND_x86_64_efi], [test x$target_cpu = xx86_64 -a x$platform = xefi]) | |
944 | AM_CONDITIONAL([COND_mips_yeeloong], [test x$target_cpu = xmips -a x$platform = xyeeloong]) | |
945 | AM_CONDITIONAL([COND_mips_qemu_mips], [test x$target_cpu = xmips -a x$platform = xqemu_mips]) | |
946 | AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275]) | |
947 | AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275]) | |
050abaea | 948 | AM_CONDITIONAL([COND_mips], [test x$target_cpu = xmips]) |
f7711f5e BC |
949 | |
950 | AM_CONDITIONAL([COND_HOST_HURD], [test x$host_kernel = xhurd]) | |
951 | AM_CONDITIONAL([COND_HOST_LINUX], [test x$host_kernel = xlinux]) | |
952 | AM_CONDITIONAL([COND_HOST_NETBSD], [test x$host_kernel = xnetbsd]) | |
953 | AM_CONDITIONAL([COND_HOST_WINDOWS], [test x$host_kernel = xwindows]) | |
954 | AM_CONDITIONAL([COND_HOST_KFREEBSD], [test x$host_kernel = xkfreebsd]) | |
2d465fb0 | 955 | |
76ed06b9 BC |
956 | AM_CONDITIONAL([COND_MAN_PAGES], [test x$cross_compiling = xno -a x$HELP2MAN != x]) |
957 | AM_CONDITIONAL([COND_GRUB_EMU_USB], [test x$enable_grub_emu_usb = xyes]) | |
958 | AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes]) | |
959 | AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes]) | |
960 | AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes]) | |
961 | AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x]) | |
76ed06b9 | 962 | AM_CONDITIONAL([COND_GRUB_PE2ELF], [test x$TARGET_OBJ2ELF != x]) |
771111e5 | 963 | AM_CONDITIONAL([COND_APPLE_CC], [test x$TARGET_APPLE_CC = x1]) |
76ed06b9 | 964 | AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes]) |
fc45fb58 | 965 | |
742f9232 | 966 | AM_CONDITIONAL([COND_HAVE_ASM_USCORE], [test x$HAVE_ASM_USCORE = x1]) |
f1632d4d | 967 | AM_CONDITIONAL([COND_CYGWIN], [test x$host_os = xcygwin]) |
fc45fb58 | 968 | |
6a161fa9 | 969 | # Output files. |
1f4147aa | 970 | grub_CHECK_LINK_DIR |
971 | if test x"$link_dir" = xyes ; then | |
f84b481b RM |
972 | AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu]) |
973 | if test "$platform" != emu ; then | |
974 | AC_CONFIG_LINKS([include/grub/machine:include/grub/$target_cpu/$platform]) | |
975 | fi | |
1f4147aa | 976 | else |
977 | mkdir -p include/grub 2>/dev/null | |
978 | rm -rf include/grub/cpu | |
979 | cp -rp $srcdir/include/grub/$target_cpu include/grub/cpu 2>/dev/null | |
f84b481b RM |
980 | if test "$platform" != emu ; then |
981 | rm -rf include/grub/machine | |
982 | cp -rp $srcdir/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null | |
983 | fi | |
1f4147aa | 984 | fi |
6304d292 | 985 | |
8c411768 | 986 | AC_CONFIG_FILES([Makefile]) |
6304d292 | 987 | AC_CONFIG_FILES([grub-core/Makefile]) |
15c69261 | 988 | AC_CONFIG_FILES([grub-core/gnulib/Makefile]) |
269004c1 | 989 | AC_CONFIG_FILES([po/Makefile.in]) |
8c411768 | 990 | AC_CONFIG_FILES([docs/Makefile]) |
b23ffd70 | 991 | AC_CONFIG_FILES([util/bash-completion.d/Makefile]) |
6a161fa9 | 992 | AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h]) |
742f9232 | 993 | AC_CONFIG_FILES([config.h]) |
8c411768 | 994 | |
6a161fa9 | 995 | AC_OUTPUT |
5ce5507f | 996 | [ |
997 | echo "*******************************************************" | |
998 | echo GRUB2 will be compiled with following components: | |
999 | echo Platform: "$target_cpu"-"$platform" | |
f84b481b | 1000 | if [ x"$platform" = xemu ]; then |
5ce5507f | 1001 | if [ x"$grub_emu_usb_excuse" = x ]; then |
1002 | echo USB support for grub-emu: Yes | |
1003 | else | |
1004 | echo USB support for grub-emu: No "($grub_emu_usb_excuse)" | |
1005 | fi | |
927d0134 VS |
1006 | if [ x"$grub_emu_sdl_excuse" = x ]; then |
1007 | echo SDL support for grub-emu: Yes | |
1008 | else | |
1009 | echo SDL support for grub-emu: No "($grub_emu_sdl_excuse)" | |
1010 | fi | |
325c8258 | 1011 | if [ x"$grub_emu_pci_excuse" = x ]; then |
1012 | echo PCI support for grub-emu: Yes | |
1013 | else | |
1014 | echo PCI support for grub-emu: No "($grub_emu_pci_excuse)" | |
1015 | fi | |
f38873b8 | 1016 | fi |
61d720e5 VS |
1017 | if test x"$device_mapper_excuse" = x ; then |
1018 | echo With devmapper support: Yes | |
1019 | else | |
1020 | echo With devmapper support: No "($device_mapper_excuse)" | |
f84b481b | 1021 | fi |
5ce5507f | 1022 | if [ x"$enable_mm_debug" = xyes ]; then |
1023 | echo With memory debugging: Yes | |
1024 | else | |
1025 | echo With memory debugging: No | |
1026 | fi | |
5ce5507f | 1027 | if [ x"$efiemu_excuse" = x ]; then |
1028 | echo efiemu runtime: Yes | |
1029 | else | |
1030 | echo efiemu runtime: No "($efiemu_excuse)" | |
1031 | fi | |
5ce5507f | 1032 | if [ x"$grub_mkfont_excuse" = x ]; then |
1033 | echo grub-mkfont: Yes | |
1034 | else | |
1035 | echo grub-mkfont: No "($grub_mkfont_excuse)" | |
1036 | fi | |
1037 | echo "*******************************************************" | |
1038 | ] |