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