]>
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 | ||
85c6210f | 35 | AC_INIT([GRUB],[1.99],[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 | |
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) |
4959e111 | 75 | target_cpu=mipsel; |
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 ;; |
4959e111 VS |
99 | mipsel-*) platform=loongson ;; |
100 | mips-*) platform=arc ;; | |
e68d3b24 | 101 | ia64-*) platform=efi ;; |
58393a2d | 102 | *) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;; |
05568c2e | 103 | esac |
104 | else | |
105 | platform="$with_platform" | |
106 | fi | |
107 | ||
ec1dfd63 VS |
108 | case "$target_cpu"-"$platform" in |
109 | x86_64-efi) ;; | |
110 | x86_64-emu) ;; | |
111 | x86_64-*) target_cpu=i386 ;; | |
112 | powerpc64-ieee1275) target_cpu=powerpc ;; | |
113 | esac | |
20011694 | 114 | |
58393a2d | 115 | # Check if the platform is supported, make final adjustments. |
b977bf01 | 116 | case "$target_cpu"-"$platform" in |
05568c2e | 117 | i386-efi) ;; |
3f4ce737 | 118 | x86_64-efi) ;; |
05568c2e | 119 | i386-pc) ;; |
7210dca9 | 120 | i386-multiboot) ;; |
546f966a | 121 | i386-coreboot) ;; |
58393a2d | 122 | i386-linuxbios) platform=coreboot ;; |
3d04eab8 | 123 | i386-ieee1275) ;; |
8231fb77 | 124 | i386-qemu) ;; |
05568c2e | 125 | powerpc-ieee1275) ;; |
126 | sparc64-ieee1275) ;; | |
2c40cc78 | 127 | ia64-efi) ;; |
f440c33f | 128 | mips-qemu_mips) ;; |
3666d5f6 | 129 | mips-qemu-mips) platform=qemu_mips;; |
8906c3dd | 130 | mips-arc) ;; |
4959e111 VS |
131 | mipsel-qemu_mips) ;; |
132 | mipsel-qemu-mips) platform=qemu_mips;; | |
133 | mipsel-yeeloong) platform=loongson ;; | |
134 | mipsel-fuloong) platform=loongson ;; | |
135 | mipsel-loongson) ;; | |
f84b481b | 136 | *-emu) ;; |
58393a2d | 137 | *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;; |
6a161fa9 | 138 | esac |
139 | ||
3f4ce737 | 140 | case "$target_cpu" in |
141 | i386 | powerpc) target_m32=1 ;; | |
142 | x86_64 | sparc64) target_m64=1 ;; | |
143 | esac | |
144 | ||
6e5a42fe | 145 | case "$host_os" in |
4825d790 | 146 | mingw32*) host_os=cygwin ;; |
6e5a42fe | 147 | esac |
148 | ||
9304eef1 | 149 | # This normalizes the names, and creates a new variable ("host_kernel") |
150 | # while at it, since the mapping is not always 1:1 (e.g. different OSes | |
151 | # using the same kernel type). | |
152 | case "$host_os" in | |
153 | gnu*) host_kernel=hurd ;; | |
154 | linux*) host_kernel=linux ;; | |
67937d4d | 155 | freebsd* | kfreebsd*-gnu) host_kernel=kfreebsd ;; |
2c7031b1 | 156 | netbsd*) host_kernel=netbsd ;; |
958ee221 | 157 | solaris*) host_kernel=illumos ;; |
9304eef1 | 158 | cygwin) host_kernel=windows ;; |
159 | esac | |
160 | ||
f84b481b | 161 | case "$platform" in |
c721825b BC |
162 | coreboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_COREBOOT=1" ;; |
163 | multiboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MULTIBOOT=1" ;; | |
164 | efi) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EFI=1" ;; | |
165 | ieee1275) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_IEEE1275=1" ;; | |
166 | qemu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_QEMU=1" ;; | |
167 | pc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_PCBIOS=1" ;; | |
168 | emu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EMU=1" ;; | |
54da1feb | 169 | loongson) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_LOONGSON=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;; |
3666d5f6 VS |
170 | qemu_mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;; |
171 | arc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_ARC=1" ;; | |
f84b481b | 172 | esac |
6bea3f89 | 173 | case "$target_cpu" in |
4959e111 | 174 | mips |mipsel) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS=1" ;; |
c721825b | 175 | sparc64) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_SPARC64=1" ;; |
6bea3f89 | 176 | esac |
4959e111 VS |
177 | if test x${target_cpu} = xmipsel ; then |
178 | machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo mips_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`" | |
179 | else | |
180 | machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`" | |
181 | fi | |
6bea3f89 | 182 | |
c721825b BC |
183 | HOST_CPPFLAGS="$HOST_CPPFLAGS $machine_CPPFLAGS" |
184 | TARGET_CPPFLAGS="$TARGET_CPPFLAGS $machine_CPPFLAGS" | |
f84b481b | 185 | |
56978920 | 186 | AC_SUBST(host_cpu) |
187 | AC_SUBST(host_os) | |
9304eef1 | 188 | AC_SUBST(host_kernel) |
6e5a42fe | 189 | |
b977bf01 | 190 | AC_SUBST(target_cpu) |
05568c2e | 191 | AC_SUBST(platform) |
6a161fa9 | 192 | |
d87aedff YB |
193 | # Define default variables |
194 | case "$host_os" in | |
195 | netbsd* | openbsd*) | |
196 | # Because /boot is used for the boot block in NetBSD and OpenBSD, | |
197 | bootdirname='' ;; | |
198 | *) bootdirname='boot' ;; | |
199 | esac | |
200 | bootdirname=`echo "$bootdirname" | sed "$program_transform_name"` | |
201 | AC_SUBST(bootdirname) | |
a4c1d277 YB |
202 | AC_DEFINE_UNQUOTED(GRUB_BOOT_DIR_NAME, "$bootdirname", |
203 | [Default boot directory name]") | |
d87aedff YB |
204 | |
205 | grubdirname=`echo "$PACKAGE" | sed "$program_transform_name"` | |
206 | AC_SUBST(grubdirname) | |
a4c1d277 YB |
207 | AC_DEFINE_UNQUOTED(GRUB_DIR_NAME, "$grubdirname", |
208 | [Default grub directory name]) | |
d87aedff | 209 | |
b977bf01 | 210 | # |
211 | # Checks for build programs. | |
212 | # | |
144f1f98 | 213 | |
6c826348 | 214 | # Although cmp is listed in the GNU Coding Standards as a command which |
215 | # can used directly, OpenBSD lacks cmp in the default installation. | |
216 | AC_CHECK_PROGS([CMP], [cmp]) | |
217 | if test "x$CMP" = x; then | |
218 | AC_MSG_ERROR([cmp is not found]) | |
219 | fi | |
220 | ||
144f1f98 | 221 | AC_CHECK_PROGS([YACC], [bison]) |
1569ec51 | 222 | if test "x$YACC" = x; then |
6c826348 | 223 | AC_MSG_ERROR([bison is not found]) |
1569ec51 | 224 | fi |
225 | ||
4d88b9ae VS |
226 | FONT_SOURCE= |
227 | ||
f4d095d7 GS |
228 | for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do |
229 | for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/unifont; do | |
230 | if test -f "$dir/unifont.$ext"; then | |
8e50ec9f | 231 | FONT_SOURCE="$dir/unifont.$ext" |
f4d095d7 GS |
232 | break 2 |
233 | fi | |
234 | done | |
4931827f | 235 | done |
236 | ||
54da1feb VS |
237 | if test "x$FONT_SOURCE" = x && ( test "x$platform" = xqemu || test "x$platform" = xloongson ); then |
238 | AC_MSG_ERROR([qemu and loongson ports need unifont]) | |
4d88b9ae VS |
239 | fi |
240 | ||
76ed06b9 | 241 | AC_SUBST([FONT_SOURCE]) |
8e50ec9f | 242 | |
76ed06b9 | 243 | AC_PROG_RANLIB |
b977bf01 | 244 | AC_PROG_INSTALL |
245 | AC_PROG_AWK | |
09220190 | 246 | AC_PROG_LEX |
76ed06b9 | 247 | AC_PROG_YACC |
b977bf01 | 248 | AC_PROG_MAKE_SET |
ff420223 | 249 | AC_PROG_MKDIR_P |
e1fd1939 | 250 | AC_PROG_LN_S |
b977bf01 | 251 | |
c7c75cf4 | 252 | if test "x$LEX" = "x:"; then |
09220190 BC |
253 | AC_MSG_ERROR([flex is not found]) |
254 | else | |
2663fb5f | 255 | version=`$LEX --version | $AWK '{ split($NF,x,"."); print x[[1]]*10000+x[[2]]*100+x[[3]]; }'` |
b777c18e | 256 | if test -n "$version" -a "$version" -ge 20535; then |
09220190 BC |
257 | : |
258 | else | |
259 | AC_MSG_ERROR([flex is too old. GRUB requires 2.5.35 or above]) | |
260 | fi | |
261 | fi | |
262 | ||
68807e5f | 263 | # These are not a "must". |
51fa856c | 264 | AC_PATH_PROGS(MAKEINFO, makeinfo true) |
6a161fa9 | 265 | |
b977bf01 | 266 | # |
267 | # Checks for host programs. | |
268 | # | |
269 | ||
270 | AC_PROG_CC | |
15c69261 | 271 | gl_EARLY |
76ed06b9 BC |
272 | AM_PROG_CC_C_O |
273 | AM_PROG_AS | |
274 | ||
6a161fa9 | 275 | # Must be GCC. |
276 | test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required]) | |
277 | ||
4889bdec | 278 | AC_GNU_SOURCE |
2f1a3acf | 279 | AM_GNU_GETTEXT([external]) |
b977bf01 | 280 | AC_SYS_LARGEFILE |
281 | ||
282 | # Identify characteristics of the host architecture. | |
283 | AC_C_BIGENDIAN | |
284 | AC_CHECK_SIZEOF(void *) | |
285 | AC_CHECK_SIZEOF(long) | |
286 | ||
2b167a72 | 287 | grub_apple_cc |
c9da87d0 | 288 | if test x$grub_cv_apple_cc = xyes ; then |
76ed06b9 BC |
289 | HOST_CPPFLAGS="$HOST_CPPFLAGS -DAPPLE_CC=1" |
290 | HOST_CFLAGS="$HOST_CFLAGS -fnested-functions" | |
2b167a72 | 291 | fi |
b977bf01 | 292 | |
86695375 | 293 | if test "x$cross_compiling" = xyes; then |
294 | AC_MSG_WARN([cannot generate manual pages while cross compiling]) | |
295 | else | |
296 | AC_PATH_PROG(HELP2MAN, help2man) | |
297 | fi | |
298 | ||
3169f4c7 | 299 | # Check for functions and headers. |
c38fe9f4 RM |
300 | AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf getextmntent) |
301 | AC_CHECK_HEADERS(libzfs.h libnvpair.h sys/param.h sys/mount.h sys/mnttab.h sys/mkdev.h) | |
7c4e16ff | 302 | |
fb90b546 RM |
303 | AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$ac_includes_default |
304 | #include <sys/param.h> | |
305 | #include <sys/mount.h>]) | |
306 | ||
307 | AC_CHECK_MEMBERS([struct statfs.f_mntfromname],,,[$ac_includes_default | |
308 | #include <sys/param.h> | |
309 | #include <sys/mount.h>]) | |
310 | ||
2c7031b1 GS |
311 | # For opendisk() and getrawpartition() on NetBSD. |
312 | # Used in util/deviceiter.c and in util/hostdisk.c. | |
313 | AC_CHECK_HEADER([util.h], [ | |
314 | AC_CHECK_LIB([util], [opendisk], [ | |
315 | LIBUTIL="-lutil" | |
316 | AC_DEFINE(HAVE_OPENDISK, 1, [Define if opendisk() in -lutil can be used]) | |
317 | ]) | |
318 | AC_CHECK_LIB([util], [getrawpartition], [ | |
319 | LIBUTIL="-lutil" | |
320 | AC_DEFINE(HAVE_GETRAWPARTITION, 1, [Define if getrawpartition() in -lutil can be used]) | |
321 | ]) | |
322 | ]) | |
323 | AC_SUBST([LIBUTIL]) | |
324 | ||
76ed06b9 BC |
325 | # |
326 | # Check for host and build compilers. | |
327 | # | |
328 | HOST_CC=$CC | |
329 | AC_CHECK_PROGS(BUILD_CC, [gcc egcs cc], | |
330 | [AC_MSG_ERROR([none of gcc, egcs and cc is found. set BUILD_CC manually.])]) | |
331 | ||
15c69261 YB |
332 | # For gnulib. |
333 | gl_INIT | |
334 | ||
b977bf01 | 335 | # |
336 | # Check for target programs. | |
337 | # | |
338 | ||
5b5d4aa5 | 339 | # Find tools for the target. |
340 | if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then | |
b977bf01 | 341 | tmp_ac_tool_prefix="$ac_tool_prefix" |
342 | ac_tool_prefix=$target_alias- | |
343 | ||
344 | AC_CHECK_TOOLS(TARGET_CC, [gcc egcs cc], | |
345 | [AC_MSG_ERROR([none of gcc, egcs and cc is found. set TARGET_CC manually.])]) | |
346 | AC_CHECK_TOOL(OBJCOPY, objcopy) | |
347 | AC_CHECK_TOOL(STRIP, strip) | |
348 | AC_CHECK_TOOL(NM, nm) | |
349 | ||
350 | ac_tool_prefix="$tmp_ac_tool_prefix" | |
351 | else | |
352 | if test "x$TARGET_CC" = x; then | |
353 | TARGET_CC=$CC | |
354 | fi | |
355 | AC_CHECK_TOOL(OBJCOPY, objcopy) | |
356 | AC_CHECK_TOOL(STRIP, strip) | |
357 | AC_CHECK_TOOL(NM, nm) | |
358 | fi | |
76ed06b9 BC |
359 | AC_SUBST(HOST_CC) |
360 | AC_SUBST(BUILD_CC) | |
b977bf01 | 361 | AC_SUBST(TARGET_CC) |
362 | ||
b977bf01 | 363 | # Test the C compiler for the target environment. |
364 | tmp_CC="$CC" | |
365 | tmp_CFLAGS="$CFLAGS" | |
366 | tmp_LDFLAGS="$LDFLAGS" | |
367 | tmp_CPPFLAGS="$CPPFLAGS" | |
aa6d7826 | 368 | tmp_LIBS="$LIBS" |
b977bf01 | 369 | CC="$TARGET_CC" |
370 | CFLAGS="$TARGET_CFLAGS" | |
371 | CPPFLAGS="$TARGET_CPPFLAGS" | |
372 | LDFLAGS="$TARGET_LDFLAGS" | |
aa6d7826 | 373 | LIBS="" |
b977bf01 | 374 | |
90d1e879 | 375 | # debug flags. |
76ed06b9 BC |
376 | TARGET_CFLAGS="$TARGET_CFLAGS -Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes -Wundef -Wstrict-prototypes -g" |
377 | TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g" | |
6a161fa9 | 378 | |
90d1e879 RM |
379 | # Force no alignment to save space on i386. |
380 | if test "x$target_cpu" = xi386; then | |
381 | AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [ | |
382 | CFLAGS="$CFLAGS -falign-loops=1" | |
eb73121d | 383 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], |
90d1e879 RM |
384 | [grub_cv_cc_falign_loop=yes], |
385 | [grub_cv_cc_falign_loop=no]) | |
6a161fa9 | 386 | ]) |
6a161fa9 | 387 | |
90d1e879 RM |
388 | if test "x$grub_cv_cc_falign_loop" = xyes; then |
389 | TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1" | |
6a161fa9 | 390 | else |
90d1e879 | 391 | TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1" |
6a161fa9 | 392 | fi |
393 | ||
90d1e879 RM |
394 | # Some toolchains enable these features by default, but they need |
395 | # registers that aren't set up properly in GRUB. | |
396 | TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow" | |
397 | fi | |
77c55a87 | 398 | |
90d1e879 RM |
399 | # By default, GCC 4.4 generates .eh_frame sections containing unwind |
400 | # information in some cases where it previously did not. GRUB doesn't need | |
401 | # these and they just use up vital space. Restore the old compiler | |
402 | # behaviour. | |
403 | AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [ | |
404 | SAVE_CFLAGS="$CFLAGS" | |
405 | CFLAGS="$CFLAGS -fno-dwarf2-cfi-asm" | |
406 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], | |
407 | [grub_cv_cc_fno_dwarf2_cfi_asm=yes], | |
408 | [grub_cv_cc_fno_dwarf2_cfi_asm=no]) | |
409 | CFLAGS="$SAVE_CFLAGS" | |
410 | ]) | |
77c55a87 | 411 | |
90d1e879 RM |
412 | if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then |
413 | TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm" | |
b977bf01 | 414 | fi |
6a161fa9 | 415 | |
2b167a72 | 416 | grub_apple_target_cc |
c9da87d0 | 417 | if test x$grub_cv_apple_target_cc = xyes ; then |
76ed06b9 BC |
418 | TARGET_CPPFLAGS="$TARGET_CPPFLAGS -DAPPLE_CC=1" |
419 | TARGET_CFLAGS="$TARGET_CFLAGS -fnested-functions" | |
420 | ||
2b167a72 | 421 | CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions" |
2b167a72 | 422 | TARGET_APPLE_CC=1 |
cf00df31 | 423 | AC_CHECK_PROG([OBJCONV], [objconv], [objconv], []) |
424 | if test "x$OBJCONV" = x ; then | |
425 | AC_CHECK_PROG([OBJCONV], [objconv], [./objconv], [], [.]) | |
426 | fi | |
427 | if test "x$OBJCONV" = x ; then | |
428 | AC_MSG_ERROR([objconv not found which is required when building with apple compiler]) | |
429 | fi | |
2b167a72 | 430 | TARGET_IMG_LDSCRIPT= |
431 | TARGET_IMG_CFLAGS="-static" | |
76ed06b9 BC |
432 | TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20' |
433 | TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20' | |
434 | TARGET_IMG_BASE_LDOPT="-Wl,-image_base" | |
2b167a72 | 435 | else |
436 | TARGET_APPLE_CC=0 | |
437 | # Use linker script if present, otherwise use builtin -N script. | |
76ed06b9 BC |
438 | if test -f "${srcdir}/${grub_coredir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"; then |
439 | TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/${grub_coredir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc" | |
440 | TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT}" | |
441 | TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/${grub_coredir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc" | |
442 | TARGET_IMG_BASE_LDOPT="-Wl,-Ttext" | |
2b167a72 | 443 | else |
444 | TARGET_IMG_LDSCRIPT= | |
76ed06b9 BC |
445 | TARGET_IMG_LDFLAGS='-Wl,-N' |
446 | TARGET_IMG_LDFLAGS_AC='-Wl,-N' | |
447 | TARGET_IMG_BASE_LDOPT="-Wl,-Ttext" | |
2b167a72 | 448 | fi |
449 | TARGET_IMG_CFLAGS= | |
450 | fi | |
451 | ||
2b167a72 | 452 | # For platforms where ELF is not the default link format. |
453 | AC_MSG_CHECKING([for command to convert module to ELF format]) | |
454 | case "${host_os}" in | |
f1632d4d | 455 | cygwin) TARGET_OBJ2ELF='$(top_builddir)/grub-pe2elf'; |
4b0cd8f8 | 456 | # FIXME: put proper test here |
742f9232 | 457 | NEED_REGISTER_FRAME_INFO=1 |
4b0cd8f8 | 458 | ;; |
742f9232 | 459 | *) NEED_REGISTER_FRAME_INFO=0 ;; |
2b167a72 | 460 | esac |
2b167a72 | 461 | AC_MSG_RESULT([$TARGET_OBJ2ELF]) |
462 | ||
b977bf01 | 463 | if test "x$target_m32" = x1; then |
464 | # Force 32-bit mode. | |
465 | TARGET_CFLAGS="$TARGET_CFLAGS -m32" | |
76ed06b9 | 466 | TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m32" |
19e81ba7 | 467 | TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m32" |
b977bf01 | 468 | TARGET_LDFLAGS="$TARGET_LDFLAGS -m32" |
2b167a72 | 469 | TARGET_MODULE_FORMAT="elf32" |
6a161fa9 | 470 | fi |
b977bf01 | 471 | |
20011694 | 472 | if test "x$target_m64" = x1; then |
473 | # Force 64-bit mode. | |
7e9ca17a | 474 | TARGET_CFLAGS="$TARGET_CFLAGS -m64" |
76ed06b9 | 475 | TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m64" |
19e81ba7 | 476 | TARGET_CPPFLAGS="$TARGET_CPPFLAGS -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 | 592 | # Check for libgcc symbols |
2afb7f6c | 593 | AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __trampoline_setup __ucmpdi2 _restgpr_14_x __ia64_trampoline __udivsi3 __umoddi3 __udivdi3 __divsi3 __modsi3 __umodsi3 __moddi3 __divdi3 __ctzdi2 __ctzsi2) |
69be5b74 VS |
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 | ||
c5dc1690 SJ |
706 | AC_ARG_ENABLE([cache-stats], |
707 | AS_HELP_STRING([--enable-cache-stats], | |
055e2b8b | 708 | [enable disk cache statistics collection])) |
c5dc1690 SJ |
709 | |
710 | if test x$enable_cache_stats = xyes; then | |
711 | DISK_CACHE_STATS=1 | |
712 | else | |
713 | DISK_CACHE_STATS=0 | |
714 | fi | |
715 | AC_SUBST([DISK_CACHE_STATS]) | |
716 | ||
d64399b5 | 717 | AC_ARG_ENABLE([grub-emu-usb], |
718 | [AS_HELP_STRING([--enable-grub-emu-usb], | |
5ce5507f | 719 | [build and install the `grub-emu' debugging utility with USB support (default=guessed)])]) |
5ce5507f | 720 | |
927d0134 VS |
721 | AC_ARG_ENABLE([grub-emu-sdl], |
722 | [AS_HELP_STRING([--enable-grub-emu-sdl], | |
723 | [build and install the `grub-emu' debugging utility with SDL support (default=guessed)])]) | |
724 | ||
3affd0ec | 725 | AC_ARG_ENABLE([grub-emu-pci], |
726 | [AS_HELP_STRING([--enable-grub-emu-pci], | |
727 | [build and install the `grub-emu' debugging utility with PCI support (potentially dangerous) (default=no)])]) | |
728 | ||
f84b481b RM |
729 | if test "$platform" = emu; then |
730 | missing_ncurses= | |
731 | [# Check for curses libraries.] | |
4fe9862e | 732 | AC_CHECK_LIB([ncurses], [wgetch], [LIBCURSES="-lncurses"], |
733 | [AC_CHECK_LIB([curses], [wgetch], [LIBCURSES="-lcurses"], | |
f84b481b | 734 | [missing_ncurses=[true]])]) |
4fe9862e | 735 | AC_SUBST([LIBCURSES]) |
f84b481b | 736 | [if [ x"$missing_ncurses" = x ]; then ] |
4fe9862e | 737 | [# Check for headers.] |
738 | AC_CHECK_HEADERS([ncurses/curses.h], [], | |
739 | [AC_CHECK_HEADERS([ncurses.h], [], | |
740 | [AC_CHECK_HEADERS([curses.h], [], | |
f84b481b | 741 | [missing_ncurses=[true]])])]) |
5ce5507f | 742 | [fi] |
f84b481b RM |
743 | if test x"$missing_ncurses" = xtrue ; then |
744 | AC_MSG_ERROR([grub-emu can't be compiled without ncurses]) | |
5ce5507f | 745 | fi |
f84b481b | 746 | |
62a747cb VS |
747 | if test x"$enable_grub_emu_usb" != xyes ; then |
748 | grub_emu_usb_excuse="not enabled" | |
5ce5507f | 749 | fi |
325c8258 | 750 | |
0e848909 VS |
751 | if test x"$enable_grub_emu_pci" = xyes ; then |
752 | grub_emu_usb_excuse="conflicts with PCI support" | |
753 | fi | |
754 | ||
5ce5507f | 755 | [if [ x"$grub_emu_usb_excuse" = x ]; then |
d64399b5 | 756 | # Check for libusb libraries.] |
5ce5507f | 757 | AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"], |
e98cd0c2 | 758 | [grub_emu_usb_excuse=["need libusb library"]]) |
d64399b5 | 759 | AC_SUBST([LIBUSB]) |
5ce5507f | 760 | [fi] |
761 | [if [ x"$grub_emu_usb_excuse" = x ]; then | |
762 | # Check for headers.] | |
d64399b5 | 763 | AC_CHECK_HEADERS([usb.h], [], |
e98cd0c2 | 764 | [grub_emu_usb_excuse=["need libusb headers"]]) |
4fe9862e | 765 | [fi] |
c6f3b249 | 766 | if test x"$enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then |
ce7a733d | 767 | AC_MSG_ERROR([USB support for grub-emu was explicitly requested but can't be compiled]) |
5ce5507f | 768 | fi |
769 | if test x"$grub_emu_usb_excuse" = x ; then | |
770 | enable_grub_emu_usb=yes | |
771 | else | |
772 | enable_grub_emu_usb=no | |
773 | fi | |
774 | ||
927d0134 VS |
775 | if test x"$enable_grub_emu_sdl" = xno ; then |
776 | grub_emu_sdl_excuse="explicitely disabled" | |
777 | fi | |
778 | [if [ x"$grub_emu_sdl_excuse" = x ]; then | |
779 | # Check for libSDL libraries.] | |
780 | AC_CHECK_LIB([SDL], [SDL_Init], [LIBSDL="-lSDL"], | |
781 | [grub_emu_sdl_excuse=["libSDL libraries are required to build \`grub-emu' with SDL support"]]) | |
782 | AC_SUBST([LIBSDL]) | |
783 | [fi] | |
9f293ab0 | 784 | |
927d0134 VS |
785 | [if [ x"$grub_emu_sdl_excuse" = x ]; then |
786 | # Check for headers.] | |
787 | AC_CHECK_HEADERS([SDL/SDL.h], [], | |
788 | [grub_emu_sdl_excuse=["libSDL header file is required to build \`grub-emu' with SDL support"]]) | |
789 | [fi] | |
9f293ab0 | 790 | |
927d0134 VS |
791 | if test x"enable_grub_emu_sdl" = xyes && test x"$grub_emu_sdl_excuse" != x ; then |
792 | AC_MSG_ERROR([SDL support for grub-emu was explicitely requested but can't be compiled]) | |
793 | fi | |
794 | if test x"$grub_emu_sdl_excuse" = x ; then | |
795 | enable_grub_emu_sdl=yes | |
796 | else | |
797 | enable_grub_emu_sdl=no | |
798 | fi | |
799 | ||
3affd0ec | 800 | if test x"$enable_grub_emu_pci" != xyes ; then |
325c8258 | 801 | grub_emu_pci_excuse="not enabled" |
802 | fi | |
803 | ||
804 | if test x"$enable_grub_emu_usb" = xyes ; then | |
805 | grub_emu_pci_excuse="conflicts with USB support" | |
806 | fi | |
807 | ||
808 | [if [ x"$grub_emu_pci_excuse" = x ]; then | |
809 | # Check for libpci libraries.] | |
459fed4b | 810 | AC_CHECK_LIB([pciaccess], [pci_system_init], [LIBPCIACCESS="-lpciaccess"], |
811 | [grub_emu_pci_excuse=["need libpciaccess library"]]) | |
812 | AC_SUBST([LIBPCIACCESS]) | |
325c8258 | 813 | [fi] |
814 | [if [ x"$grub_emu_pci_excuse" = x ]; then | |
815 | # Check for headers.] | |
816 | AC_CHECK_HEADERS([pci/pci.h], [], | |
459fed4b | 817 | [grub_emu_pci_excuse=["need libpciaccess headers"]]) |
325c8258 | 818 | [fi] |
819 | ||
820 | if test x"$grub_emu_pci_excuse" = x ; then | |
821 | enable_grub_emu_pci=yes | |
822 | else | |
9f293ab0 | 823 | |
325c8258 | 824 | enable_grub_emu_pci=no |
3affd0ec | 825 | fi |
826 | ||
927d0134 | 827 | AC_SUBST([enable_grub_emu_sdl]) |
d64399b5 | 828 | AC_SUBST([enable_grub_emu_usb]) |
3affd0ec | 829 | AC_SUBST([enable_grub_emu_pci]) |
f84b481b | 830 | fi |
4fe9862e | 831 | |
e52db1f7 | 832 | AC_ARG_ENABLE([grub-mkfont], |
833 | [AS_HELP_STRING([--enable-grub-mkfont], | |
5ce5507f | 834 | [build and install the `grub-mkfont' utility (default=guessed)])]) |
835 | if test x"$enable_grub_mkfont" = xno ; then | |
ce7a733d | 836 | grub_mkfont_excuse="explicitly disabled" |
5ce5507f | 837 | fi |
838 | ||
839 | if test x"$grub_mkfont_excuse" = x ; then | |
e52db1f7 | 840 | # Check for freetype libraries. |
841 | AC_CHECK_PROGS([FREETYPE], [freetype-config]) | |
842 | if test "x$FREETYPE" = x ; then | |
e98cd0c2 | 843 | grub_mkfont_excuse=["need freetype2 library"] |
e52db1f7 | 844 | fi |
e52db1f7 | 845 | fi |
660960d6 VS |
846 | |
847 | if test x"$grub_mkfont_excuse" = x ; then | |
848 | # Check for freetype libraries. | |
10854d0d YB |
849 | freetype_cflags=`freetype-config --cflags` |
850 | freetype_libs=`freetype-config --libs` | |
d1e8a02f VS |
851 | SAVED_CPPFLAGS="$CPPFLAGS" |
852 | CPPFLAGS="$CPPFLAGS $freetype_cflags" | |
660960d6 VS |
853 | AC_CHECK_HEADERS([ft2build.h], [], |
854 | [grub_mkfont_excuse=["need freetype2 headers"]]) | |
d1e8a02f | 855 | CPPFLAGS="$SAVED_CPPFLAGS" |
660960d6 VS |
856 | fi |
857 | ||
5ce5507f | 858 | if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then |
ce7a733d | 859 | AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled]) |
5ce5507f | 860 | fi |
861 | if test x"$grub_mkfont_excuse" = x ; then | |
862 | enable_grub_mkfont=yes | |
863 | else | |
864 | enable_grub_mkfont=no | |
865 | fi | |
20168fca CW |
866 | if test x"$enable_grub_mkfont" = xno && test "x$platform" = xloongson; then |
867 | AC_MSG_ERROR([loongson port needs grub-mkfont]) | |
868 | fi | |
e52db1f7 | 869 | AC_SUBST([enable_grub_mkfont]) |
870 | AC_SUBST([freetype_cflags]) | |
871 | AC_SUBST([freetype_libs]) | |
872 | ||
897e6207 CW |
873 | AC_ARG_ENABLE([grub-mount], |
874 | [AS_HELP_STRING([--enable-grub-mount], | |
875 | [build and install the `grub-mount' utility (default=guessed)])]) | |
876 | if test x"$enable_grub_mount" = xno ; then | |
877 | grub_mount_excuse="explicitly disabled" | |
92bb0786 VS |
878 | fi |
879 | ||
897e6207 | 880 | if test x"$grub_mount_excuse" = x ; then |
92bb0786 | 881 | AC_CHECK_LIB([fuse], [fuse_main_real], [], |
897e6207 | 882 | [grub_mount_excuse="need FUSE library"]) |
92bb0786 VS |
883 | fi |
884 | ||
897e6207 | 885 | if test x"$grub_mount_excuse" = x ; then |
92bb0786 VS |
886 | # Check for fuse headers. |
887 | SAVED_CPPFLAGS="$CPPFLAGS" | |
338c7fab | 888 | CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26" |
92bb0786 | 889 | AC_CHECK_HEADERS([fuse/fuse.h], [], |
897e6207 | 890 | [grub_mount_excuse=["need FUSE headers"]]) |
92bb0786 VS |
891 | CPPFLAGS="$SAVED_CPPFLAGS" |
892 | fi | |
893 | ||
897e6207 | 894 | if test x"$enable_grub_mount" = xyes && test x"$grub_mount_excuse" != x ; then |
89644ef1 | 895 | AC_MSG_ERROR([grub-mount was explicitly requested but can't be compiled]) |
92bb0786 | 896 | fi |
897e6207 CW |
897 | if test x"$grub_mount_excuse" = x ; then |
898 | enable_grub_mount=yes | |
92bb0786 | 899 | else |
897e6207 | 900 | enable_grub_mount=no |
92bb0786 | 901 | fi |
897e6207 | 902 | AC_SUBST([enable_grub_mount]) |
92bb0786 | 903 | |
7181e228 CW |
904 | AC_ARG_ENABLE([device-mapper], |
905 | [AS_HELP_STRING([--enable-device-mapper], | |
906 | [enable Linux device-mapper support (default=guessed)])]) | |
907 | if test x"$enable_device_mapper" = xno ; then | |
908 | device_mapper_excuse="explicitly disabled" | |
909 | fi | |
910 | ||
53798c4b GS |
911 | if test x"$device_mapper_excuse" = x ; then |
912 | # Check for device-mapper header. | |
913 | AC_CHECK_HEADER([libdevmapper.h], [], | |
914 | [device_mapper_excuse="need libdevmapper header"]) | |
915 | fi | |
916 | ||
7181e228 CW |
917 | if test x"$device_mapper_excuse" = x ; then |
918 | # Check for device-mapper library. | |
61d720e5 | 919 | AC_CHECK_LIB([devmapper], [dm_task_create], [], |
7181e228 | 920 | [device_mapper_excuse="need devmapper library"]) |
7181e228 | 921 | fi |
61d720e5 VS |
922 | |
923 | if test x"$device_mapper_excuse" = x ; then | |
924 | # Check for device-mapper library. | |
925 | AC_CHECK_LIB([devmapper], [dm_log_with_errno_init], | |
926 | [], | |
927 | [device_mapper_excuse="need devmapper library"]) | |
928 | fi | |
929 | ||
930 | if test x"$device_mapper_excuse" = x ; then | |
931 | LIBDEVMAPPER="-ldevmapper"; | |
932 | AC_DEFINE([HAVE_DEVICE_MAPPER], [1], | |
933 | [Define to 1 if you have the devmapper library.]) | |
934 | fi | |
935 | ||
62f7d208 | 936 | AC_SUBST([LIBDEVMAPPER]) |
76ed06b9 | 937 | |
f4727da9 VS |
938 | LIBGEOM= |
939 | if test x$host_kernel = xkfreebsd; then | |
940 | AC_CHECK_LIB([geom], [geom_gettree], [], | |
941 | [AC_MSG_ERROR([Your platform requires libgeom])]) | |
942 | LIBGEOM="-lgeom" | |
943 | fi | |
944 | ||
945 | AC_SUBST([LIBGEOM]) | |
946 | ||
2c44e493 VS |
947 | AC_CHECK_LIB([lzma], [lzma_code], |
948 | [LIBLZMA="-llzma" | |
949 | AC_DEFINE([HAVE_LIBLZMA], [1], | |
950 | [Define to 1 if you have the LZMA library.])],) | |
951 | AC_SUBST([LIBLZMA]) | |
952 | ||
a184f9c8 | 953 | AC_CHECK_LIB([zfs], [libzfs_init], |
16c7cb32 | 954 | [LIBZFS="-lzfs" |
a184f9c8 RM |
955 | AC_DEFINE([HAVE_LIBZFS], [1], |
956 | [Define to 1 if you have the ZFS library.])],) | |
16c7cb32 BC |
957 | AC_SUBST([LIBZFS]) |
958 | ||
a184f9c8 | 959 | AC_CHECK_LIB([nvpair], [nvlist_print], |
16c7cb32 | 960 | [LIBNVPAIR="-lnvpair" |
a184f9c8 RM |
961 | AC_DEFINE([HAVE_LIBNVPAIR], [1], |
962 | [Define to 1 if you have the NVPAIR library.])],) | |
16c7cb32 BC |
963 | AC_SUBST([LIBNVPAIR]) |
964 | ||
9f915872 VS |
965 | LIBS="" |
966 | ||
76ed06b9 BC |
967 | pkglibrootdir='$(libdir)'/`echo $PACKAGE | sed "$program_transform_name"` |
968 | AC_SUBST(pkglibrootdir) | |
969 | ||
970 | AC_SUBST([FONT_SOURCE]) | |
76ed06b9 BC |
971 | AS_IF([test x$target_cpu = xi386 -a x$platform = xqemu], |
972 | [AC_SUBST([GRUB_BOOT_MACHINE_LINK_ADDR], 0xffe00)]) | |
76ed06b9 BC |
973 | AS_IF([test x$TARGET_APPLE_CC = x1], |
974 | [AC_SUBST([USE_APPLE_CC_FIXES], yes)]) | |
7181e228 | 975 | |
742f9232 VS |
976 | AC_SUBST(HAVE_ASM_USCORE) |
977 | AC_SUBST(ADDR32) | |
978 | AC_SUBST(DATA32) | |
979 | AC_SUBST(BSS_START_SYMBOL) | |
980 | AC_SUBST(END_SYMBOL) | |
981 | AC_SUBST(PACKAGE) | |
982 | AC_SUBST(VERSION) | |
983 | AC_SUBST(NEED_ENABLE_EXECUTE_STACK) | |
984 | AC_SUBST(NEED_REGISTER_FRAME_INFO) | |
985 | ||
76ed06b9 BC |
986 | # |
987 | # Automake conditionals | |
988 | # | |
8c411768 | 989 | |
76ed06b9 BC |
990 | AM_CONDITIONAL([COND_emu], [test x$platform = xemu]) |
991 | AM_CONDITIONAL([COND_i386_pc], [test x$target_cpu = xi386 -a x$platform = xpc]) | |
992 | AM_CONDITIONAL([COND_i386_efi], [test x$target_cpu = xi386 -a x$platform = xefi]) | |
6585de4c | 993 | AM_CONDITIONAL([COND_ia64_efi], [test x$target_cpu = xia64 -a x$platform = xefi]) |
76ed06b9 BC |
994 | AM_CONDITIONAL([COND_i386_qemu], [test x$target_cpu = xi386 -a x$platform = xqemu]) |
995 | AM_CONDITIONAL([COND_i386_ieee1275], [test x$target_cpu = xi386 -a x$platform = xieee1275]) | |
996 | AM_CONDITIONAL([COND_i386_coreboot], [test x$target_cpu = xi386 -a x$platform = xcoreboot]) | |
997 | AM_CONDITIONAL([COND_i386_multiboot], [test x$target_cpu = xi386 -a x$platform = xmultiboot]) | |
998 | AM_CONDITIONAL([COND_x86_64_efi], [test x$target_cpu = xx86_64 -a x$platform = xefi]) | |
4959e111 VS |
999 | AM_CONDITIONAL([COND_mips_loongson], [test x$target_cpu = xmipsel -a x$platform = xloongson]) |
1000 | AM_CONDITIONAL([COND_mips_qemu_mips], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")" -a x$platform = xqemu_mips]) | |
8906c3dd | 1001 | AM_CONDITIONAL([COND_mips_arc], [test x$target_cpu = xmips -a x$platform = xarc]) |
76ed06b9 BC |
1002 | AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275]) |
1003 | AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275]) | |
4959e111 | 1004 | AM_CONDITIONAL([COND_mips], [test x$target_cpu = xmips -o x$target_cpu = xmipsel]) |
f7711f5e BC |
1005 | |
1006 | AM_CONDITIONAL([COND_HOST_HURD], [test x$host_kernel = xhurd]) | |
1007 | AM_CONDITIONAL([COND_HOST_LINUX], [test x$host_kernel = xlinux]) | |
1008 | AM_CONDITIONAL([COND_HOST_NETBSD], [test x$host_kernel = xnetbsd]) | |
1009 | AM_CONDITIONAL([COND_HOST_WINDOWS], [test x$host_kernel = xwindows]) | |
1010 | AM_CONDITIONAL([COND_HOST_KFREEBSD], [test x$host_kernel = xkfreebsd]) | |
958ee221 | 1011 | AM_CONDITIONAL([COND_HOST_ILLUMOS], [test x$host_kernel = xillumos]) |
2d465fb0 | 1012 | |
76ed06b9 BC |
1013 | AM_CONDITIONAL([COND_MAN_PAGES], [test x$cross_compiling = xno -a x$HELP2MAN != x]) |
1014 | AM_CONDITIONAL([COND_GRUB_EMU_USB], [test x$enable_grub_emu_usb = xyes]) | |
1015 | AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes]) | |
1016 | AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes]) | |
1017 | AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes]) | |
897e6207 | 1018 | AM_CONDITIONAL([COND_GRUB_MOUNT], [test x$enable_grub_mount = xyes]) |
76ed06b9 | 1019 | AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x]) |
76ed06b9 | 1020 | AM_CONDITIONAL([COND_GRUB_PE2ELF], [test x$TARGET_OBJ2ELF != x]) |
771111e5 | 1021 | AM_CONDITIONAL([COND_APPLE_CC], [test x$TARGET_APPLE_CC = x1]) |
76ed06b9 | 1022 | AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes]) |
c5dc1690 | 1023 | AM_CONDITIONAL([COND_ENABLE_CACHE_STATS], [test x$DISK_CACHE_STATS = x1]) |
fc45fb58 | 1024 | |
742f9232 | 1025 | AM_CONDITIONAL([COND_HAVE_ASM_USCORE], [test x$HAVE_ASM_USCORE = x1]) |
f1632d4d | 1026 | AM_CONDITIONAL([COND_CYGWIN], [test x$host_os = xcygwin]) |
742f9232 | 1027 | |
6a161fa9 | 1028 | # Output files. |
4959e111 VS |
1029 | cpudir="${target_cpu}" |
1030 | if test x${cpudir} = xmipsel; then | |
1031 | cpudir=mips; | |
1032 | fi | |
1f4147aa | 1033 | grub_CHECK_LINK_DIR |
1034 | if test x"$link_dir" = xyes ; then | |
4959e111 | 1035 | AC_CONFIG_LINKS([include/grub/cpu:include/grub/$cpudir]) |
f84b481b | 1036 | if test "$platform" != emu ; then |
4959e111 | 1037 | AC_CONFIG_LINKS([include/grub/machine:include/grub/$cpudir/$platform]) |
f84b481b | 1038 | fi |
1f4147aa | 1039 | else |
1040 | mkdir -p include/grub 2>/dev/null | |
1041 | rm -rf include/grub/cpu | |
4959e111 | 1042 | cp -rp $srcdir/include/grub/$cpudir include/grub/cpu 2>/dev/null |
f84b481b RM |
1043 | if test "$platform" != emu ; then |
1044 | rm -rf include/grub/machine | |
4959e111 | 1045 | cp -rp $srcdir/include/grub/$cpudir/$platform include/grub/machine 2>/dev/null |
f84b481b | 1046 | fi |
1f4147aa | 1047 | fi |
6304d292 | 1048 | |
8c411768 | 1049 | AC_CONFIG_FILES([Makefile]) |
6304d292 | 1050 | AC_CONFIG_FILES([grub-core/Makefile]) |
15c69261 | 1051 | AC_CONFIG_FILES([grub-core/gnulib/Makefile]) |
269004c1 | 1052 | AC_CONFIG_FILES([po/Makefile.in]) |
8c411768 | 1053 | AC_CONFIG_FILES([docs/Makefile]) |
b23ffd70 | 1054 | AC_CONFIG_FILES([util/bash-completion.d/Makefile]) |
6a161fa9 | 1055 | AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h]) |
742f9232 | 1056 | AC_CONFIG_FILES([config.h]) |
8c411768 | 1057 | |
6a161fa9 | 1058 | AC_OUTPUT |
5ce5507f | 1059 | [ |
1060 | echo "*******************************************************" | |
1061 | echo GRUB2 will be compiled with following components: | |
1062 | echo Platform: "$target_cpu"-"$platform" | |
f84b481b | 1063 | if [ x"$platform" = xemu ]; then |
5ce5507f | 1064 | if [ x"$grub_emu_usb_excuse" = x ]; then |
1065 | echo USB support for grub-emu: Yes | |
1066 | else | |
1067 | echo USB support for grub-emu: No "($grub_emu_usb_excuse)" | |
1068 | fi | |
927d0134 VS |
1069 | if [ x"$grub_emu_sdl_excuse" = x ]; then |
1070 | echo SDL support for grub-emu: Yes | |
1071 | else | |
1072 | echo SDL support for grub-emu: No "($grub_emu_sdl_excuse)" | |
1073 | fi | |
325c8258 | 1074 | if [ x"$grub_emu_pci_excuse" = x ]; then |
1075 | echo PCI support for grub-emu: Yes | |
1076 | else | |
1077 | echo PCI support for grub-emu: No "($grub_emu_pci_excuse)" | |
1078 | fi | |
f84b481b | 1079 | fi |
61d720e5 VS |
1080 | if test x"$device_mapper_excuse" = x ; then |
1081 | echo With devmapper support: Yes | |
1082 | else | |
1083 | echo With devmapper support: No "($device_mapper_excuse)" | |
1084 | fi | |
5ce5507f | 1085 | if [ x"$enable_mm_debug" = xyes ]; then |
1086 | echo With memory debugging: Yes | |
1087 | else | |
1088 | echo With memory debugging: No | |
1089 | fi | |
c5dc1690 SJ |
1090 | if [ x"$enable_cache_stats" = xyes ]; then |
1091 | echo With disk cache statistics: Yes | |
1092 | else | |
1093 | echo With disk cache statistics: No | |
1094 | fi | |
5ce5507f | 1095 | if [ x"$efiemu_excuse" = x ]; then |
1096 | echo efiemu runtime: Yes | |
1097 | else | |
1098 | echo efiemu runtime: No "($efiemu_excuse)" | |
1099 | fi | |
5ce5507f | 1100 | if [ x"$grub_mkfont_excuse" = x ]; then |
1101 | echo grub-mkfont: Yes | |
1102 | else | |
1103 | echo grub-mkfont: No "($grub_mkfont_excuse)" | |
1104 | fi | |
897e6207 | 1105 | if [ x"$grub_mount_excuse" = x ]; then |
89644ef1 | 1106 | echo grub-mount: Yes |
92bb0786 | 1107 | else |
897e6207 | 1108 | echo grub-mount: No "($grub_mount_excuse)" |
92bb0786 | 1109 | fi |
5ce5507f | 1110 | echo "*******************************************************" |
1111 | ] |