]>
Commit | Line | Data |
---|---|---|
6a161fa9 | 1 | # Process this file with autoconf to produce a configure script. |
2 | ||
1e901a75 | 3 | # Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc. |
6a161fa9 | 4 | # |
5 | # This configure.ac is free software; the author | |
6 | # gives unlimited permission to copy and/or distribute it, | |
7 | # with or without modifications, as long as this notice is preserved. | |
8 | # | |
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without | |
11 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A | |
12 | # PARTICULAR PURPOSE. | |
13 | ||
b977bf01 | 14 | dnl This configure script is complicated, because GRUB needs to deal |
15 | dnl with three potentially different types: | |
16 | dnl | |
17 | dnl build -- the environment for building GRUB | |
18 | dnl host -- the environment for running utilities | |
19 | dnl target -- the environment for running GRUB | |
20 | dnl | |
21 | dnl In addition, GRUB needs to deal with a platform specification | |
22 | dnl which specifies the system running GRUB, such as firmware. | |
23 | dnl This is necessary because the target type in autoconf does not | |
24 | dnl describe such a system very well. | |
25 | dnl | |
26 | dnl The current strategy is to use variables with no prefix (such as | |
27 | dnl CC, CFLAGS, etc.) for the host type as well as the build type, | |
28 | dnl because GRUB does not need to use those variables for the build | |
29 | dnl type, so there is no conflict. Variables with the prefix "TARGET_" | |
30 | dnl (such as TARGET_CC, TARGET_CFLAGS, etc.) are used for the target | |
31 | dnl type. | |
32 | ||
33 | ||
cc55302e | 34 | AC_INIT([GRUB],[1.97~beta1],[bug-grub@gnu.org]) |
46e04eb9 | 35 | AC_PREREQ(2.59) |
4b13b216 | 36 | AC_CONFIG_SRCDIR([include/grub/dl.h]) |
6a161fa9 | 37 | AC_CONFIG_HEADER([config.h]) |
38 | ||
b977bf01 | 39 | # Checks for host and target systems. |
6a161fa9 | 40 | AC_CANONICAL_HOST |
b977bf01 | 41 | AC_CANONICAL_TARGET |
6a161fa9 | 42 | |
1d543c3e | 43 | # Program name transformations |
44 | AC_ARG_PROGRAM | |
45 | ||
b977bf01 | 46 | case "$target_cpu" in |
02164e1b | 47 | i[[3456]]86) target_cpu=i386 ;; |
48 | sparc) target_cpu=sparc64 ;; | |
6a161fa9 | 49 | esac |
50 | ||
05568c2e | 51 | # Specify the platform (such as firmware). |
52 | AC_ARG_WITH([platform], | |
53 | AS_HELP_STRING([--with-platform=PLATFORM], | |
83b984de | 54 | [select the host platform [[guessed]]])) |
05568c2e | 55 | |
56 | # Guess the platform if not specified. | |
57 | if test "x$with_platform" = x; then | |
b977bf01 | 58 | case "$target_cpu"-"$target_vendor" in |
05568c2e | 59 | i386-apple) platform=efi ;; |
60 | i386-*) platform=pc ;; | |
58393a2d | 61 | x86_64-apple) platform=efi ;; |
737feb35 | 62 | x86_64-*) platform=pc ;; |
05568c2e | 63 | powerpc-*) platform=ieee1275 ;; |
58393a2d | 64 | powerpc64-*) platform=ieee1275 ;; |
05568c2e | 65 | sparc64-*) platform=ieee1275 ;; |
58393a2d | 66 | *) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;; |
05568c2e | 67 | esac |
68 | else | |
69 | platform="$with_platform" | |
70 | fi | |
71 | ||
58393a2d | 72 | # Adjust CPU unless target was explicitly specified. |
73 | if test -z "$target_alias"; then | |
74 | case "$target_cpu"-"$platform" in | |
75 | x86_64-efi) ;; | |
3f4ce737 | 76 | x86_64-*) target_cpu=i386 ;; |
77 | powerpc64-ieee1275) target_cpu=powerpc ;; | |
20011694 | 78 | esac |
79 | fi | |
80 | ||
58393a2d | 81 | # Check if the platform is supported, make final adjustments. |
b977bf01 | 82 | case "$target_cpu"-"$platform" in |
05568c2e | 83 | i386-efi) ;; |
3f4ce737 | 84 | x86_64-efi) ;; |
05568c2e | 85 | i386-pc) ;; |
546f966a | 86 | i386-coreboot) ;; |
58393a2d | 87 | i386-linuxbios) platform=coreboot ;; |
3d04eab8 | 88 | i386-ieee1275) ;; |
8231fb77 | 89 | i386-qemu) ;; |
05568c2e | 90 | powerpc-ieee1275) ;; |
91 | sparc64-ieee1275) ;; | |
58393a2d | 92 | *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;; |
6a161fa9 | 93 | esac |
94 | ||
3f4ce737 | 95 | case "$target_cpu" in |
96 | i386 | powerpc) target_m32=1 ;; | |
97 | x86_64 | sparc64) target_m64=1 ;; | |
98 | esac | |
99 | ||
6e5a42fe | 100 | case "$host_os" in |
101 | mingw32) host_os=cygwin ;; | |
102 | esac | |
103 | ||
9304eef1 | 104 | # This normalizes the names, and creates a new variable ("host_kernel") |
105 | # while at it, since the mapping is not always 1:1 (e.g. different OSes | |
106 | # using the same kernel type). | |
107 | case "$host_os" in | |
108 | gnu*) host_kernel=hurd ;; | |
109 | linux*) host_kernel=linux ;; | |
110 | freebsd* | kfreebsd*-gnu) host_kernel=freebsd ;; | |
111 | cygwin) host_kernel=windows ;; | |
112 | esac | |
113 | ||
56978920 | 114 | AC_SUBST(host_cpu) |
115 | AC_SUBST(host_os) | |
9304eef1 | 116 | AC_SUBST(host_kernel) |
6e5a42fe | 117 | |
b977bf01 | 118 | AC_SUBST(target_cpu) |
05568c2e | 119 | AC_SUBST(platform) |
6a161fa9 | 120 | |
b977bf01 | 121 | # |
122 | # Checks for build programs. | |
123 | # | |
144f1f98 | 124 | |
6c826348 | 125 | # Although cmp is listed in the GNU Coding Standards as a command which |
126 | # can used directly, OpenBSD lacks cmp in the default installation. | |
127 | AC_CHECK_PROGS([CMP], [cmp]) | |
128 | if test "x$CMP" = x; then | |
129 | AC_MSG_ERROR([cmp is not found]) | |
130 | fi | |
131 | ||
144f1f98 | 132 | AC_CHECK_PROGS([YACC], [bison]) |
1569ec51 | 133 | if test "x$YACC" = x; then |
6c826348 | 134 | AC_MSG_ERROR([bison is not found]) |
1569ec51 | 135 | fi |
136 | ||
1e901a75 | 137 | for file in /usr/src/unifont.bdf ; do |
4931827f | 138 | if test -e $file ; then |
1e901a75 | 139 | AC_SUBST([UNIFONT_BDF], [$file]) |
4931827f | 140 | break |
141 | fi | |
142 | done | |
143 | ||
b977bf01 | 144 | AC_PROG_INSTALL |
145 | AC_PROG_AWK | |
146 | AC_PROG_MAKE_SET | |
147 | ||
68807e5f | 148 | # These are not a "must". |
b977bf01 | 149 | AC_PATH_PROG(RUBY, ruby) |
68807e5f | 150 | AC_PATH_PROG(HELP2MAN, help2man) |
6a161fa9 | 151 | |
b977bf01 | 152 | # |
153 | # Checks for host programs. | |
154 | # | |
155 | ||
156 | AC_PROG_CC | |
6a161fa9 | 157 | # Must be GCC. |
158 | test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required]) | |
159 | ||
4889bdec | 160 | AC_GNU_SOURCE |
b977bf01 | 161 | AC_SYS_LARGEFILE |
162 | ||
163 | # Identify characteristics of the host architecture. | |
164 | AC_C_BIGENDIAN | |
165 | AC_CHECK_SIZEOF(void *) | |
166 | AC_CHECK_SIZEOF(long) | |
167 | ||
2b167a72 | 168 | grub_apple_cc |
c9da87d0 | 169 | if test x$grub_cv_apple_cc = xyes ; then |
2b167a72 | 170 | CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions" |
171 | ASFLAGS="$ASFLAGS -DAPPLE_CC=1" | |
172 | fi | |
b977bf01 | 173 | |
4889bdec | 174 | # Check for functions. |
df38d0bb | 175 | AC_CHECK_FUNCS(posix_memalign memalign asprintf) |
4889bdec | 176 | |
b977bf01 | 177 | # |
178 | # Check for target programs. | |
179 | # | |
180 | ||
5b5d4aa5 | 181 | # Find tools for the target. |
182 | if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then | |
b977bf01 | 183 | tmp_ac_tool_prefix="$ac_tool_prefix" |
184 | ac_tool_prefix=$target_alias- | |
185 | ||
186 | AC_CHECK_TOOLS(TARGET_CC, [gcc egcs cc], | |
187 | [AC_MSG_ERROR([none of gcc, egcs and cc is found. set TARGET_CC manually.])]) | |
188 | AC_CHECK_TOOL(OBJCOPY, objcopy) | |
189 | AC_CHECK_TOOL(STRIP, strip) | |
190 | AC_CHECK_TOOL(NM, nm) | |
191 | ||
192 | ac_tool_prefix="$tmp_ac_tool_prefix" | |
193 | else | |
194 | if test "x$TARGET_CC" = x; then | |
195 | TARGET_CC=$CC | |
196 | fi | |
197 | AC_CHECK_TOOL(OBJCOPY, objcopy) | |
198 | AC_CHECK_TOOL(STRIP, strip) | |
199 | AC_CHECK_TOOL(NM, nm) | |
200 | fi | |
201 | AC_SUBST(TARGET_CC) | |
202 | ||
203 | ||
204 | # Test the C compiler for the target environment. | |
205 | tmp_CC="$CC" | |
206 | tmp_CFLAGS="$CFLAGS" | |
207 | tmp_LDFLAGS="$LDFLAGS" | |
208 | tmp_CPPFLAGS="$CPPFLAGS" | |
aa6d7826 | 209 | tmp_LIBS="$LIBS" |
b977bf01 | 210 | CC="$TARGET_CC" |
211 | CFLAGS="$TARGET_CFLAGS" | |
212 | CPPFLAGS="$TARGET_CPPFLAGS" | |
213 | LDFLAGS="$TARGET_LDFLAGS" | |
aa6d7826 | 214 | LIBS="" |
b977bf01 | 215 | |
216 | if test "x$TARGET_CFLAGS" = x; then | |
6a161fa9 | 217 | # debug flags. |
b977bf01 | 218 | TARGET_CFLAGS="-Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes \ |
219 | -Wundef -Wstrict-prototypes -g" | |
6a161fa9 | 220 | |
221 | # optimization flags. | |
322562ea | 222 | AC_CACHE_CHECK([whether optimization for size works], grub_cv_cc_Os, [ |
6a161fa9 | 223 | CFLAGS=-Os |
eb73121d | 224 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], |
225 | [grub_cv_cc_Os=yes], | |
226 | [grub_cv_cc_Os=no]) | |
6a161fa9 | 227 | ]) |
322562ea | 228 | if test "x$grub_cv_cc_Os" = xyes; then |
b977bf01 | 229 | TARGET_CFLAGS="$TARGET_CFLAGS -Os" |
6a161fa9 | 230 | else |
b977bf01 | 231 | TARGET_CFLAGS="$TARGET_CFLAGS -O2 -fno-strength-reduce -fno-unroll-loops" |
6a161fa9 | 232 | fi |
233 | ||
234 | # Force no alignment to save space on i386. | |
b977bf01 | 235 | if test "x$target_cpu" = xi386; then |
322562ea | 236 | AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [ |
2b167a72 | 237 | CFLAGS="$CFLAGS -falign-loops=1" |
eb73121d | 238 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], |
239 | [grub_cv_cc_falign_loop=yes], | |
240 | [grub_cv_cc_falign_loop=no]) | |
6a161fa9 | 241 | ]) |
242 | ||
322562ea | 243 | if test "x$grub_cv_cc_falign_loop" = xyes; then |
b977bf01 | 244 | TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1" |
6a161fa9 | 245 | else |
b977bf01 | 246 | TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1" |
6a161fa9 | 247 | fi |
248 | fi | |
b977bf01 | 249 | fi |
6a161fa9 | 250 | |
2b167a72 | 251 | grub_apple_target_cc |
c9da87d0 | 252 | if test x$grub_cv_apple_target_cc = xyes ; then |
2b167a72 | 253 | TARGET_CFLAGS="$TARGET_CFLAGS -DAPPLE_CC=1 -fnested-functions" |
254 | CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions" | |
255 | TARGET_ASFLAGS="$TARGET_ASFLAGS -DAPPLE_CC=1" | |
256 | TARGET_APPLE_CC=1 | |
cf00df31 | 257 | AC_CHECK_PROG([OBJCONV], [objconv], [objconv], []) |
258 | if test "x$OBJCONV" = x ; then | |
259 | AC_CHECK_PROG([OBJCONV], [objconv], [./objconv], [], [.]) | |
260 | fi | |
261 | if test "x$OBJCONV" = x ; then | |
262 | AC_MSG_ERROR([objconv not found which is required when building with apple compiler]) | |
263 | fi | |
2b167a72 | 264 | TARGET_IMG_LDSCRIPT= |
265 | TARGET_IMG_CFLAGS="-static" | |
266 | TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,' | |
267 | TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,' | |
268 | else | |
269 | TARGET_APPLE_CC=0 | |
270 | # Use linker script if present, otherwise use builtin -N script. | |
2b167a72 | 271 | if test -f "${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"; then |
272 | TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc" | |
273 | TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT} -Wl,-Ttext," | |
274 | TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc" | |
275 | else | |
276 | TARGET_IMG_LDSCRIPT= | |
277 | TARGET_IMG_LDFLAGS='-Wl,-N -Wl,-Ttext,' | |
278 | TARGET_IMG_LDFLAGS_AC='-Wl,-N -Wl,-Ttext,' | |
279 | fi | |
280 | TARGET_IMG_CFLAGS= | |
281 | fi | |
282 | ||
283 | AC_SUBST(TARGET_IMG_LDSCRIPT) | |
284 | AC_SUBST(TARGET_IMG_LDFLAGS) | |
285 | AC_SUBST(TARGET_IMG_CFLAGS) | |
2b167a72 | 286 | |
287 | # For platforms where ELF is not the default link format. | |
288 | AC_MSG_CHECKING([for command to convert module to ELF format]) | |
289 | case "${host_os}" in | |
290 | cygwin) TARGET_OBJ2ELF='grub-pe2elf' ;; | |
291 | *) ;; | |
292 | esac | |
293 | AC_SUBST(TARGET_OBJ2ELF) | |
294 | AC_MSG_RESULT([$TARGET_OBJ2ELF]) | |
295 | ||
296 | ||
b977bf01 | 297 | if test "x$target_m32" = x1; then |
298 | # Force 32-bit mode. | |
299 | TARGET_CFLAGS="$TARGET_CFLAGS -m32" | |
300 | TARGET_LDFLAGS="$TARGET_LDFLAGS -m32" | |
2b167a72 | 301 | TARGET_MODULE_FORMAT="elf32" |
6a161fa9 | 302 | fi |
b977bf01 | 303 | |
20011694 | 304 | if test "x$target_m64" = x1; then |
305 | # Force 64-bit mode. | |
7e9ca17a | 306 | TARGET_CFLAGS="$TARGET_CFLAGS -m64" |
307 | TARGET_LDFLAGS="$TARGET_LDFLAGS -m64" | |
2b167a72 | 308 | TARGET_MODULE_FORMAT="elf64" |
7e9ca17a | 309 | fi |
310 | ||
311 | if test "$target_cpu"-"$platform" = x86_64-efi; then | |
312 | # Use large model to support 4G memory | |
6e09b8b7 | 313 | AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [ |
c8600122 | 314 | SAVED_CFLAGS=$CFLAGS |
315 | CFLAGS="$CFLAGS -m64 -mcmodel=large" | |
6e09b8b7 | 316 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], |
317 | [grub_cv_cc_mcmodel=yes], | |
318 | [grub_cv_cc_mcmodel=no]) | |
319 | ]) | |
c8600122 | 320 | if test "x$grub_cv_cc_mcmodel" = xno; then |
321 | CFLAGS="$SAVED_CFLAGS -m64 -DMCMODEL_SMALL=1" | |
b39f9d20 | 322 | TARGET_CFLAGS="$TARGET_CFLAGS -DMCMODEL_SMALL=1" |
ce7a733d | 323 | AC_MSG_WARN([-mcmodel=large not supported. You won't be able to use the memory over 4GiB. Upgrade your gcc]) |
c8600122 | 324 | else |
325 | TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large" | |
6e09b8b7 | 326 | fi |
7e9ca17a | 327 | |
328 | # EFI writes to stack below %rsp, we must not use the red zone | |
329 | AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [ | |
c8600122 | 330 | CFLAGS="$CFLAGS -m64 -mno-red-zone" |
7e9ca17a | 331 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], |
332 | [grub_cv_cc_no_red_zone=yes], | |
333 | [grub_cv_cc_no_red_zone=no]) | |
334 | ]) | |
335 | if test "x$grub_cv_cc_no_red_zone" = xno; then | |
336 | AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc]) | |
337 | fi | |
338 | ||
c8600122 | 339 | TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone" |
20011694 | 340 | fi |
341 | ||
baa2a121 | 342 | # |
343 | # Compiler features. | |
344 | # | |
345 | ||
9035dce4 | 346 | # Need __enable_execute_stack() for nested function trampolines? |
347 | grub_CHECK_ENABLE_EXECUTE_STACK | |
348 | ||
baa2a121 | 349 | # Smashing stack protector. |
350 | grub_CHECK_STACK_PROTECTOR | |
c3db8364 | 351 | # Need that, because some distributions ship compilers that include |
baa2a121 | 352 | # `-fstack-protector' in the default specs. |
c3db8364 | 353 | if test "x$ssp_possible" = xyes; then |
354 | TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector" | |
355 | fi | |
2a8a80e4 | 356 | grub_CHECK_STACK_ARG_PROBE |
357 | # Cygwin's GCC uses alloca() to probe the stackframe on static | |
358 | # stack allocations above some threshold. | |
359 | if test x"$sap_possible" = xyes; then | |
360 | TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe" | |
361 | fi | |
baa2a121 | 362 | |
b977bf01 | 363 | AC_SUBST(TARGET_CFLAGS) |
2b167a72 | 364 | AC_SUBST(TARGET_MODULE_FORMAT) |
cf00df31 | 365 | AC_SUBST(OBJCONV) |
2b167a72 | 366 | AC_SUBST(TARGET_APPLE_CC) |
367 | AC_SUBST(TARGET_ASFLAGS) | |
b977bf01 | 368 | AC_SUBST(TARGET_CPPFLAGS) |
369 | AC_SUBST(TARGET_LDFLAGS) | |
6a161fa9 | 370 | |
aa6d7826 | 371 | # Set them to their new values for the tests below. |
372 | CC="$TARGET_CC" | |
26de2bcd | 373 | if test "x$TARGET_APPLE_CC" = x1 ; then |
374 | CFLAGS="$TARGET_CFLAGS -nostdlib" | |
375 | else | |
7d83bd47 | 376 | CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100" |
26de2bcd | 377 | fi |
aa6d7826 | 378 | CPPFLAGS="$TARGET_CPPFLAGS" |
379 | LDFLAGS="$TARGET_LDFLAGS" | |
380 | ||
6a161fa9 | 381 | # Defined in aclocal.m4. |
f6130a12 | 382 | grub_PROG_TARGET_CC |
2b167a72 | 383 | if test "x$TARGET_APPLE_CC" != x1 ; then |
b977bf01 | 384 | grub_PROG_OBJCOPY_ABSOLUTE |
2b167a72 | 385 | fi |
cb71ba20 | 386 | grub_PROG_LD_BUILD_ID_NONE |
4b13b216 | 387 | grub_ASM_USCORE |
b977bf01 | 388 | if test "x$target_cpu" = xi386; then |
2a8a80e4 | 389 | if test ! -z "$TARGET_IMG_LDSCRIPT"; then |
390 | # Check symbols provided by linker script. | |
391 | CFLAGS="$TARGET_CFLAGS -nostdlib $TARGET_IMG_LDFLAGS_AC -Wl,-Ttext,8000,--defsym,___main=0x8100" | |
392 | fi | |
58750afc | 393 | if test "x$TARGET_APPLE_CC" != x1 ; then |
2a8a80e4 | 394 | grub_CHECK_BSS_START_SYMBOL |
395 | grub_CHECK_END_SYMBOL | |
396 | fi | |
397 | CFLAGS="$TARGET_CFLAGS" | |
4b13b216 | 398 | grub_I386_ASM_PREFIX_REQUIREMENT |
399 | grub_I386_ASM_ADDR32 | |
400 | grub_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK | |
5aded270 | 401 | else |
f4917dfd | 402 | AC_DEFINE([NESTED_FUNC_ATTR], [], [Catch gcc bug]) |
6a161fa9 | 403 | fi |
404 | ||
bf6a5fb2 | 405 | AH_BOTTOM([#if defined(__i386__) && !defined(GRUB_UTIL) |
406 | #define NESTED_FUNC_ATTR __attribute__ ((__regparm__ (1))) | |
407 | #else | |
408 | #define NESTED_FUNC_ATTR | |
409 | #endif]) | |
410 | ||
5ce5507f | 411 | AC_ARG_ENABLE([efiemu], |
412 | [AS_HELP_STRING([--enable-efiemu], | |
413 | [build and install the efiemu runtimes (default=guessed)])]) | |
414 | if test x"$enable_efiemu" = xno ; then | |
ce7a733d | 415 | efiemu_excuse="explicitly disabled" |
5ce5507f | 416 | fi |
417 | if test x"$efiemu_excuse" = x ; then | |
43e6200c | 418 | AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [ |
d2838156 | 419 | CFLAGS="$CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib" |
5ce5507f | 420 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], |
421 | [grub_cv_cc_efiemu=yes], | |
422 | [grub_cv_cc_efiemu=no]) | |
423 | ]) | |
55c70904 | 424 | if test x$grub_cv_cc_efiemu = xno; then |
e98cd0c2 | 425 | efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib" |
5ce5507f | 426 | fi |
427 | fi | |
428 | if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then | |
ce7a733d | 429 | AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled]) |
5ce5507f | 430 | fi |
431 | if test x"$efiemu_excuse" = x ; then | |
432 | enable_efiemu=yes | |
433 | else | |
434 | enable_efiemu=no | |
435 | fi | |
436 | AC_SUBST([enable_efiemu]) | |
437 | ||
438 | ||
c9a86192 | 439 | # Restore the flags. |
9962ed99 | 440 | CC="$tmp_CC" |
441 | CFLAGS="$tmp_CFLAGS" | |
442 | CPPFLAGS="$tmp_CPPFLAGS" | |
c9a86192 | 443 | LDFLAGS="$tmp_LDFLAGS" |
aa6d7826 | 444 | LIBS="$tmp_LIBS" |
6a161fa9 | 445 | |
4fe9862e | 446 | # |
2965c7cc | 447 | # Check for options. |
4fe9862e | 448 | # |
449 | ||
450 | # Memory manager debugging. | |
b39f9d20 | 451 | AC_ARG_ENABLE([mm-debug], |
2965c7cc | 452 | AS_HELP_STRING([--enable-mm-debug], |
90ce5d56 | 453 | [include memory manager debugging]), |
2965c7cc | 454 | [AC_DEFINE([MM_DEBUG], [1], |
455 | [Define to 1 if you enable memory manager debugging.])]) | |
456 | ||
4fe9862e | 457 | AC_ARG_ENABLE([grub-emu], |
458 | [AS_HELP_STRING([--enable-grub-emu], | |
5ce5507f | 459 | [build and install the `grub-emu' debugging utility (default=guessed)])]) |
d64399b5 | 460 | AC_ARG_ENABLE([grub-emu-usb], |
461 | [AS_HELP_STRING([--enable-grub-emu-usb], | |
5ce5507f | 462 | [build and install the `grub-emu' debugging utility with USB support (default=guessed)])]) |
463 | if test x"$enable_grub_emu" = xno ; then | |
ce7a733d | 464 | grub_emu_excuse="explicitly disabled" |
5ce5507f | 465 | fi |
466 | ||
467 | [# Check for curses libraries.] | |
468 | [if [ x"$grub_emu_excuse" = x ]; then ] | |
4fe9862e | 469 | AC_CHECK_LIB([ncurses], [wgetch], [LIBCURSES="-lncurses"], |
470 | [AC_CHECK_LIB([curses], [wgetch], [LIBCURSES="-lcurses"], | |
e98cd0c2 | 471 | [grub_emu_excuse=["need (n)curses libraries"]])]) |
4fe9862e | 472 | AC_SUBST([LIBCURSES]) |
5ce5507f | 473 | [fi] |
474 | [if [ x"$grub_emu_excuse" = x ]; then ] | |
4fe9862e | 475 | [# Check for headers.] |
476 | AC_CHECK_HEADERS([ncurses/curses.h], [], | |
477 | [AC_CHECK_HEADERS([ncurses.h], [], | |
478 | [AC_CHECK_HEADERS([curses.h], [], | |
e98cd0c2 | 479 | [grub_emu_excuse=["need (n)curses headers"]])])]) |
5ce5507f | 480 | [fi] |
d64399b5 | 481 | |
5ce5507f | 482 | if test x"$enable_grub_emu" = xyes && test x"$grub_emu_excuse" != x ; then |
ce7a733d | 483 | AC_MSG_ERROR([grub-emu was explicitly requested but can't be compiled]) |
5ce5507f | 484 | fi |
485 | if test x"$grub_emu_excuse" = x ; then | |
486 | enable_grub_emu=yes | |
487 | else | |
488 | enable_grub_emu=no | |
489 | grub_emu_usb_excuse="grub-emu isn't built" | |
490 | fi | |
491 | if test x"$enable_grub_emu_usb" = xno ; then | |
ce7a733d | 492 | grub_emu_usb_excuse="explicitly disabled" |
5ce5507f | 493 | fi |
494 | [if [ x"$grub_emu_usb_excuse" = x ]; then | |
d64399b5 | 495 | # Check for libusb libraries.] |
5ce5507f | 496 | AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"], |
e98cd0c2 | 497 | [grub_emu_usb_excuse=["need libusb library"]]) |
d64399b5 | 498 | AC_SUBST([LIBUSB]) |
5ce5507f | 499 | [fi] |
500 | [if [ x"$grub_emu_usb_excuse" = x ]; then | |
501 | # Check for headers.] | |
d64399b5 | 502 | AC_CHECK_HEADERS([usb.h], [], |
e98cd0c2 | 503 | [grub_emu_usb_excuse=["need libusb headers"]]) |
4fe9862e | 504 | [fi] |
5ce5507f | 505 | if test x"enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then |
ce7a733d | 506 | AC_MSG_ERROR([USB support for grub-emu was explicitly requested but can't be compiled]) |
5ce5507f | 507 | fi |
508 | if test x"$grub_emu_usb_excuse" = x ; then | |
509 | enable_grub_emu_usb=yes | |
510 | else | |
511 | enable_grub_emu_usb=no | |
512 | fi | |
513 | ||
4fe9862e | 514 | AC_SUBST([enable_grub_emu]) |
d64399b5 | 515 | AC_SUBST([enable_grub_emu_usb]) |
4fe9862e | 516 | |
99fadbaa | 517 | AC_ARG_ENABLE([grub-fstest], |
518 | [AS_HELP_STRING([--enable-grub-fstest], | |
5ce5507f | 519 | [build and install the `grub-fstest' debugging utility (default=guessed)])]) |
520 | if test x"$enable_grub_fstest" = xno ; then | |
ce7a733d | 521 | grub_fstest_excuse="explicitly disabled" |
5ce5507f | 522 | fi |
523 | if test x"$grub_fstest_excuse" = x ; then | |
524 | enable_grub_fstest=yes | |
525 | else | |
526 | enable_grub_fstest=no | |
527 | fi | |
99fadbaa | 528 | AC_SUBST([enable_grub_fstest]) |
529 | ||
2d05bc6a | 530 | AC_ARG_ENABLE([grub-pe2elf], |
531 | [AS_HELP_STRING([--enable-grub-pe2elf], | |
532 | [build and install the `grub-pe2elf' conversion utility])]) | |
533 | AC_SUBST([enable_grub_pe2elf]) | |
534 | ||
e52db1f7 | 535 | AC_ARG_ENABLE([grub-mkfont], |
536 | [AS_HELP_STRING([--enable-grub-mkfont], | |
5ce5507f | 537 | [build and install the `grub-mkfont' utility (default=guessed)])]) |
538 | if test x"$enable_grub_mkfont" = xno ; then | |
ce7a733d | 539 | grub_mkfont_excuse="explicitly disabled" |
5ce5507f | 540 | fi |
541 | ||
542 | if test x"$grub_mkfont_excuse" = x ; then | |
e52db1f7 | 543 | # Check for freetype libraries. |
544 | AC_CHECK_PROGS([FREETYPE], [freetype-config]) | |
545 | if test "x$FREETYPE" = x ; then | |
e98cd0c2 | 546 | grub_mkfont_excuse=["need freetype2 library"] |
e52db1f7 | 547 | fi |
548 | freetype_cflags=`freetype-config --cflags` | |
549 | freetype_libs=`freetype-config --libs` | |
550 | fi | |
5ce5507f | 551 | if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then |
ce7a733d | 552 | AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled]) |
5ce5507f | 553 | fi |
554 | if test x"$grub_mkfont_excuse" = x ; then | |
555 | enable_grub_mkfont=yes | |
556 | else | |
557 | enable_grub_mkfont=no | |
558 | fi | |
e52db1f7 | 559 | AC_SUBST([enable_grub_mkfont]) |
560 | AC_SUBST([freetype_cflags]) | |
561 | AC_SUBST([freetype_libs]) | |
562 | ||
2b167a72 | 563 | AC_SUBST(ASFLAGS) |
fc45fb58 | 564 | |
6a161fa9 | 565 | # Output files. |
1f4147aa | 566 | grub_CHECK_LINK_DIR |
567 | if test x"$link_dir" = xyes ; then | |
568 | AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu | |
b977bf01 | 569 | include/grub/machine:include/grub/$target_cpu/$platform]) |
1f4147aa | 570 | else |
571 | mkdir -p include/grub 2>/dev/null | |
572 | rm -rf include/grub/cpu | |
573 | cp -rp $srcdir/include/grub/$target_cpu include/grub/cpu 2>/dev/null | |
574 | rm -rf include/grub/machine | |
575 | cp -rp $srcdir/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null | |
576 | fi | |
7b455f4d | 577 | AC_CONFIG_FILES([Makefile gensymlist.sh genkernsyms.sh]) |
6a161fa9 | 578 | AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h]) |
579 | AC_OUTPUT | |
5ce5507f | 580 | [ |
581 | echo "*******************************************************" | |
582 | echo GRUB2 will be compiled with following components: | |
583 | echo Platform: "$target_cpu"-"$platform" | |
5ce5507f | 584 | if [ x"$grub_emu_excuse" = x ]; then |
585 | echo grub-emu: Yes | |
586 | else | |
587 | echo grub-emu: No "($grub_emu_excuse)" | |
588 | fi | |
589 | if [ x"$grub_emu_usb_excuse" = x ]; then | |
590 | echo USB support for grub-emu: Yes | |
591 | else | |
592 | echo USB support for grub-emu: No "($grub_emu_usb_excuse)" | |
593 | fi | |
594 | if [ x"$enable_mm_debug" = xyes ]; then | |
595 | echo With memory debugging: Yes | |
596 | else | |
597 | echo With memory debugging: No | |
598 | fi | |
599 | if [ x"$enable_grub_pe2elf" = xyes ]; then | |
600 | echo grub-pe2elf will be built and installed | |
601 | elif [ x$TARGET_OBJ2ELF = xgrub-pe2elf ]; then | |
602 | echo grub-pe2elf will be built but not installed | |
603 | else | |
604 | echo grub-pe2elf will not be built | |
605 | fi | |
606 | if [ x"$efiemu_excuse" = x ]; then | |
607 | echo efiemu runtime: Yes | |
608 | else | |
609 | echo efiemu runtime: No "($efiemu_excuse)" | |
610 | fi | |
611 | if [ x"$grub_fstest_excuse" = x ]; then | |
612 | echo grub-fstest: Yes | |
613 | else | |
614 | echo grub-fstest: No "($grub_fstest_excuse)" | |
615 | fi | |
616 | if [ x"$grub_mkfont_excuse" = x ]; then | |
617 | echo grub-mkfont: Yes | |
618 | else | |
619 | echo grub-mkfont: No "($grub_mkfont_excuse)" | |
620 | fi | |
621 | echo "*******************************************************" | |
622 | ] |