]>
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 | ||
f1d29d87 | 34 | AC_INIT([GRUB],[1.97],[bug-grub@gnu.org]) |
86e5b1db | 35 | AC_PREREQ(2.59d) |
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 ;; | |
67937d4d | 110 | freebsd* | kfreebsd*-gnu) host_kernel=kfreebsd ;; |
9304eef1 | 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 | |
ff420223 | 147 | AC_PROG_MKDIR_P |
b977bf01 | 148 | |
68807e5f | 149 | # These are not a "must". |
b977bf01 | 150 | AC_PATH_PROG(RUBY, ruby) |
c44c90db | 151 | AC_PATH_PROG(MAKEINFO, makeinfo) |
6a161fa9 | 152 | |
b977bf01 | 153 | # |
154 | # Checks for host programs. | |
155 | # | |
156 | ||
157 | AC_PROG_CC | |
6a161fa9 | 158 | # Must be GCC. |
159 | test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required]) | |
160 | ||
4889bdec | 161 | AC_GNU_SOURCE |
b977bf01 | 162 | AC_SYS_LARGEFILE |
163 | ||
164 | # Identify characteristics of the host architecture. | |
165 | AC_C_BIGENDIAN | |
166 | AC_CHECK_SIZEOF(void *) | |
167 | AC_CHECK_SIZEOF(long) | |
168 | ||
2b167a72 | 169 | grub_apple_cc |
c9da87d0 | 170 | if test x$grub_cv_apple_cc = xyes ; then |
2b167a72 | 171 | CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions" |
172 | ASFLAGS="$ASFLAGS -DAPPLE_CC=1" | |
173 | fi | |
b977bf01 | 174 | |
86695375 | 175 | if test "x$cross_compiling" = xyes; then |
176 | AC_MSG_WARN([cannot generate manual pages while cross compiling]) | |
177 | else | |
178 | AC_PATH_PROG(HELP2MAN, help2man) | |
179 | fi | |
180 | ||
4889bdec | 181 | # Check for functions. |
df38d0bb | 182 | AC_CHECK_FUNCS(posix_memalign memalign asprintf) |
4889bdec | 183 | |
b977bf01 | 184 | # |
185 | # Check for target programs. | |
186 | # | |
187 | ||
5b5d4aa5 | 188 | # Find tools for the target. |
189 | if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then | |
b977bf01 | 190 | tmp_ac_tool_prefix="$ac_tool_prefix" |
191 | ac_tool_prefix=$target_alias- | |
192 | ||
193 | AC_CHECK_TOOLS(TARGET_CC, [gcc egcs cc], | |
194 | [AC_MSG_ERROR([none of gcc, egcs and cc is found. set TARGET_CC manually.])]) | |
195 | AC_CHECK_TOOL(OBJCOPY, objcopy) | |
196 | AC_CHECK_TOOL(STRIP, strip) | |
197 | AC_CHECK_TOOL(NM, nm) | |
198 | ||
199 | ac_tool_prefix="$tmp_ac_tool_prefix" | |
200 | else | |
201 | if test "x$TARGET_CC" = x; then | |
202 | TARGET_CC=$CC | |
203 | fi | |
204 | AC_CHECK_TOOL(OBJCOPY, objcopy) | |
205 | AC_CHECK_TOOL(STRIP, strip) | |
206 | AC_CHECK_TOOL(NM, nm) | |
207 | fi | |
208 | AC_SUBST(TARGET_CC) | |
209 | ||
210 | ||
211 | # Test the C compiler for the target environment. | |
212 | tmp_CC="$CC" | |
213 | tmp_CFLAGS="$CFLAGS" | |
214 | tmp_LDFLAGS="$LDFLAGS" | |
215 | tmp_CPPFLAGS="$CPPFLAGS" | |
aa6d7826 | 216 | tmp_LIBS="$LIBS" |
b977bf01 | 217 | CC="$TARGET_CC" |
218 | CFLAGS="$TARGET_CFLAGS" | |
219 | CPPFLAGS="$TARGET_CPPFLAGS" | |
220 | LDFLAGS="$TARGET_LDFLAGS" | |
aa6d7826 | 221 | LIBS="" |
b977bf01 | 222 | |
223 | if test "x$TARGET_CFLAGS" = x; then | |
6a161fa9 | 224 | # debug flags. |
b977bf01 | 225 | TARGET_CFLAGS="-Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes \ |
226 | -Wundef -Wstrict-prototypes -g" | |
6a161fa9 | 227 | |
228 | # optimization flags. | |
322562ea | 229 | AC_CACHE_CHECK([whether optimization for size works], grub_cv_cc_Os, [ |
6a161fa9 | 230 | CFLAGS=-Os |
eb73121d | 231 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], |
232 | [grub_cv_cc_Os=yes], | |
233 | [grub_cv_cc_Os=no]) | |
6a161fa9 | 234 | ]) |
322562ea | 235 | if test "x$grub_cv_cc_Os" = xyes; then |
b977bf01 | 236 | TARGET_CFLAGS="$TARGET_CFLAGS -Os" |
6a161fa9 | 237 | else |
b977bf01 | 238 | TARGET_CFLAGS="$TARGET_CFLAGS -O2 -fno-strength-reduce -fno-unroll-loops" |
6a161fa9 | 239 | fi |
240 | ||
241 | # Force no alignment to save space on i386. | |
b977bf01 | 242 | if test "x$target_cpu" = xi386; then |
322562ea | 243 | AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [ |
2b167a72 | 244 | CFLAGS="$CFLAGS -falign-loops=1" |
eb73121d | 245 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], |
246 | [grub_cv_cc_falign_loop=yes], | |
247 | [grub_cv_cc_falign_loop=no]) | |
6a161fa9 | 248 | ]) |
249 | ||
322562ea | 250 | if test "x$grub_cv_cc_falign_loop" = xyes; then |
b977bf01 | 251 | TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1" |
6a161fa9 | 252 | else |
b977bf01 | 253 | TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1" |
6a161fa9 | 254 | fi |
6f3cd880 | 255 | |
256 | # Some toolchains enable these features by default, but they need | |
257 | # registers that aren't set up properly in GRUB. | |
258 | TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow" | |
6a161fa9 | 259 | fi |
77c55a87 | 260 | |
261 | # By default, GCC 4.4 generates .eh_frame sections containing unwind | |
262 | # information in some cases where it previously did not. GRUB doesn't need | |
263 | # these and they just use up vital space. Restore the old compiler | |
264 | # behaviour. | |
265 | AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [ | |
266 | SAVE_CFLAGS="$CFLAGS" | |
267 | CFLAGS="$CFLAGS -fno-dwarf2-cfi-asm" | |
268 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], | |
269 | [grub_cv_cc_fno_dwarf2_cfi_asm=yes], | |
270 | [grub_cv_cc_fno_dwarf2_cfi_asm=no]) | |
271 | CFLAGS="$SAVE_CFLAGS" | |
272 | ]) | |
273 | ||
274 | if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then | |
275 | TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm" | |
276 | fi | |
b977bf01 | 277 | fi |
6a161fa9 | 278 | |
2b167a72 | 279 | grub_apple_target_cc |
c9da87d0 | 280 | if test x$grub_cv_apple_target_cc = xyes ; then |
2b167a72 | 281 | TARGET_CFLAGS="$TARGET_CFLAGS -DAPPLE_CC=1 -fnested-functions" |
282 | CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions" | |
283 | TARGET_ASFLAGS="$TARGET_ASFLAGS -DAPPLE_CC=1" | |
284 | TARGET_APPLE_CC=1 | |
cf00df31 | 285 | AC_CHECK_PROG([OBJCONV], [objconv], [objconv], []) |
286 | if test "x$OBJCONV" = x ; then | |
287 | AC_CHECK_PROG([OBJCONV], [objconv], [./objconv], [], [.]) | |
288 | fi | |
289 | if test "x$OBJCONV" = x ; then | |
290 | AC_MSG_ERROR([objconv not found which is required when building with apple compiler]) | |
291 | fi | |
2b167a72 | 292 | TARGET_IMG_LDSCRIPT= |
293 | TARGET_IMG_CFLAGS="-static" | |
294 | TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,' | |
295 | TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,' | |
296 | else | |
297 | TARGET_APPLE_CC=0 | |
298 | # Use linker script if present, otherwise use builtin -N script. | |
2b167a72 | 299 | if test -f "${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"; then |
300 | TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc" | |
301 | TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT} -Wl,-Ttext," | |
302 | TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc" | |
303 | else | |
304 | TARGET_IMG_LDSCRIPT= | |
305 | TARGET_IMG_LDFLAGS='-Wl,-N -Wl,-Ttext,' | |
306 | TARGET_IMG_LDFLAGS_AC='-Wl,-N -Wl,-Ttext,' | |
307 | fi | |
308 | TARGET_IMG_CFLAGS= | |
309 | fi | |
310 | ||
311 | AC_SUBST(TARGET_IMG_LDSCRIPT) | |
312 | AC_SUBST(TARGET_IMG_LDFLAGS) | |
313 | AC_SUBST(TARGET_IMG_CFLAGS) | |
2b167a72 | 314 | |
315 | # For platforms where ELF is not the default link format. | |
316 | AC_MSG_CHECKING([for command to convert module to ELF format]) | |
317 | case "${host_os}" in | |
318 | cygwin) TARGET_OBJ2ELF='grub-pe2elf' ;; | |
319 | *) ;; | |
320 | esac | |
321 | AC_SUBST(TARGET_OBJ2ELF) | |
322 | AC_MSG_RESULT([$TARGET_OBJ2ELF]) | |
323 | ||
324 | ||
b977bf01 | 325 | if test "x$target_m32" = x1; then |
326 | # Force 32-bit mode. | |
327 | TARGET_CFLAGS="$TARGET_CFLAGS -m32" | |
328 | TARGET_LDFLAGS="$TARGET_LDFLAGS -m32" | |
2b167a72 | 329 | TARGET_MODULE_FORMAT="elf32" |
6a161fa9 | 330 | fi |
b977bf01 | 331 | |
20011694 | 332 | if test "x$target_m64" = x1; then |
333 | # Force 64-bit mode. | |
7e9ca17a | 334 | TARGET_CFLAGS="$TARGET_CFLAGS -m64" |
335 | TARGET_LDFLAGS="$TARGET_LDFLAGS -m64" | |
2b167a72 | 336 | TARGET_MODULE_FORMAT="elf64" |
7e9ca17a | 337 | fi |
338 | ||
339 | if test "$target_cpu"-"$platform" = x86_64-efi; then | |
340 | # Use large model to support 4G memory | |
6e09b8b7 | 341 | AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [ |
c8600122 | 342 | SAVED_CFLAGS=$CFLAGS |
343 | CFLAGS="$CFLAGS -m64 -mcmodel=large" | |
6e09b8b7 | 344 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], |
345 | [grub_cv_cc_mcmodel=yes], | |
346 | [grub_cv_cc_mcmodel=no]) | |
347 | ]) | |
c8600122 | 348 | if test "x$grub_cv_cc_mcmodel" = xno; then |
349 | CFLAGS="$SAVED_CFLAGS -m64 -DMCMODEL_SMALL=1" | |
b39f9d20 | 350 | TARGET_CFLAGS="$TARGET_CFLAGS -DMCMODEL_SMALL=1" |
ce7a733d | 351 | AC_MSG_WARN([-mcmodel=large not supported. You won't be able to use the memory over 4GiB. Upgrade your gcc]) |
c8600122 | 352 | else |
353 | TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large" | |
6e09b8b7 | 354 | fi |
7e9ca17a | 355 | |
356 | # EFI writes to stack below %rsp, we must not use the red zone | |
357 | AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [ | |
c8600122 | 358 | CFLAGS="$CFLAGS -m64 -mno-red-zone" |
7e9ca17a | 359 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], |
360 | [grub_cv_cc_no_red_zone=yes], | |
361 | [grub_cv_cc_no_red_zone=no]) | |
362 | ]) | |
363 | if test "x$grub_cv_cc_no_red_zone" = xno; then | |
364 | AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc]) | |
365 | fi | |
366 | ||
c8600122 | 367 | TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone" |
20011694 | 368 | fi |
369 | ||
baa2a121 | 370 | # |
371 | # Compiler features. | |
372 | # | |
373 | ||
9035dce4 | 374 | # Need __enable_execute_stack() for nested function trampolines? |
375 | grub_CHECK_ENABLE_EXECUTE_STACK | |
376 | ||
93a81088 | 377 | # Position independent executable. |
378 | grub_CHECK_PIE | |
379 | [# Need that, because some distributions ship compilers that include | |
380 | # `-fPIE' in the default specs. | |
381 | if [ x"$pie_possible" = xyes ]; then | |
382 | TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE" | |
383 | fi] | |
384 | ||
baa2a121 | 385 | # Smashing stack protector. |
386 | grub_CHECK_STACK_PROTECTOR | |
c3db8364 | 387 | # Need that, because some distributions ship compilers that include |
baa2a121 | 388 | # `-fstack-protector' in the default specs. |
c3db8364 | 389 | if test "x$ssp_possible" = xyes; then |
390 | TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector" | |
391 | fi | |
2a8a80e4 | 392 | grub_CHECK_STACK_ARG_PROBE |
393 | # Cygwin's GCC uses alloca() to probe the stackframe on static | |
394 | # stack allocations above some threshold. | |
395 | if test x"$sap_possible" = xyes; then | |
396 | TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe" | |
397 | fi | |
baa2a121 | 398 | |
63f745e8 | 399 | AC_ARG_ENABLE([werror], |
400 | [AS_HELP_STRING([--disable-werror], | |
401 | [do not use -Werror when building GRUB])]) | |
402 | if test x"$enable_werror" != xno ; then | |
403 | TARGET_CFLAGS="$TARGET_CFLAGS -Werror" | |
404 | fi | |
405 | ||
b977bf01 | 406 | AC_SUBST(TARGET_CFLAGS) |
2b167a72 | 407 | AC_SUBST(TARGET_MODULE_FORMAT) |
cf00df31 | 408 | AC_SUBST(OBJCONV) |
2b167a72 | 409 | AC_SUBST(TARGET_APPLE_CC) |
410 | AC_SUBST(TARGET_ASFLAGS) | |
b977bf01 | 411 | AC_SUBST(TARGET_CPPFLAGS) |
412 | AC_SUBST(TARGET_LDFLAGS) | |
6a161fa9 | 413 | |
3b2fe8c2 | 414 | # Check for libgcc symbols (must be performed before we add -nostdlib to LDFLAGS) |
346e7fbe | 415 | AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __trampoline_setup __ucmpdi2) |
3b2fe8c2 | 416 | |
aa6d7826 | 417 | # Set them to their new values for the tests below. |
418 | CC="$TARGET_CC" | |
26de2bcd | 419 | if test "x$TARGET_APPLE_CC" = x1 ; then |
420 | CFLAGS="$TARGET_CFLAGS -nostdlib" | |
421 | else | |
7d83bd47 | 422 | CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100" |
26de2bcd | 423 | fi |
aa6d7826 | 424 | CPPFLAGS="$TARGET_CPPFLAGS" |
425 | LDFLAGS="$TARGET_LDFLAGS" | |
426 | ||
6a161fa9 | 427 | # Defined in aclocal.m4. |
f6130a12 | 428 | grub_PROG_TARGET_CC |
2b167a72 | 429 | if test "x$TARGET_APPLE_CC" != x1 ; then |
b977bf01 | 430 | grub_PROG_OBJCOPY_ABSOLUTE |
2b167a72 | 431 | fi |
cb71ba20 | 432 | grub_PROG_LD_BUILD_ID_NONE |
4b13b216 | 433 | grub_ASM_USCORE |
b977bf01 | 434 | if test "x$target_cpu" = xi386; then |
2a8a80e4 | 435 | if test ! -z "$TARGET_IMG_LDSCRIPT"; then |
436 | # Check symbols provided by linker script. | |
437 | CFLAGS="$TARGET_CFLAGS -nostdlib $TARGET_IMG_LDFLAGS_AC -Wl,-Ttext,8000,--defsym,___main=0x8100" | |
438 | fi | |
58750afc | 439 | if test "x$TARGET_APPLE_CC" != x1 ; then |
2a8a80e4 | 440 | grub_CHECK_BSS_START_SYMBOL |
441 | grub_CHECK_END_SYMBOL | |
442 | fi | |
443 | CFLAGS="$TARGET_CFLAGS" | |
4b13b216 | 444 | grub_I386_ASM_PREFIX_REQUIREMENT |
445 | grub_I386_ASM_ADDR32 | |
446 | grub_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK | |
5aded270 | 447 | else |
f4917dfd | 448 | AC_DEFINE([NESTED_FUNC_ATTR], [], [Catch gcc bug]) |
6a161fa9 | 449 | fi |
450 | ||
bf6a5fb2 | 451 | AH_BOTTOM([#if defined(__i386__) && !defined(GRUB_UTIL) |
452 | #define NESTED_FUNC_ATTR __attribute__ ((__regparm__ (1))) | |
453 | #else | |
454 | #define NESTED_FUNC_ATTR | |
455 | #endif]) | |
456 | ||
5ce5507f | 457 | AC_ARG_ENABLE([efiemu], |
458 | [AS_HELP_STRING([--enable-efiemu], | |
459 | [build and install the efiemu runtimes (default=guessed)])]) | |
460 | if test x"$enable_efiemu" = xno ; then | |
ce7a733d | 461 | efiemu_excuse="explicitly disabled" |
5ce5507f | 462 | fi |
463 | if test x"$efiemu_excuse" = x ; then | |
43e6200c | 464 | AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [ |
d2838156 | 465 | CFLAGS="$CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib" |
5ce5507f | 466 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], |
467 | [grub_cv_cc_efiemu=yes], | |
468 | [grub_cv_cc_efiemu=no]) | |
469 | ]) | |
55c70904 | 470 | if test x$grub_cv_cc_efiemu = xno; then |
e98cd0c2 | 471 | efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib" |
5ce5507f | 472 | fi |
473 | fi | |
474 | if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then | |
ce7a733d | 475 | AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled]) |
5ce5507f | 476 | fi |
477 | if test x"$efiemu_excuse" = x ; then | |
478 | enable_efiemu=yes | |
479 | else | |
480 | enable_efiemu=no | |
481 | fi | |
482 | AC_SUBST([enable_efiemu]) | |
483 | ||
484 | ||
c9a86192 | 485 | # Restore the flags. |
9962ed99 | 486 | CC="$tmp_CC" |
487 | CFLAGS="$tmp_CFLAGS" | |
488 | CPPFLAGS="$tmp_CPPFLAGS" | |
c9a86192 | 489 | LDFLAGS="$tmp_LDFLAGS" |
aa6d7826 | 490 | LIBS="$tmp_LIBS" |
6a161fa9 | 491 | |
4fe9862e | 492 | # |
2965c7cc | 493 | # Check for options. |
4fe9862e | 494 | # |
495 | ||
496 | # Memory manager debugging. | |
b39f9d20 | 497 | AC_ARG_ENABLE([mm-debug], |
2965c7cc | 498 | AS_HELP_STRING([--enable-mm-debug], |
90ce5d56 | 499 | [include memory manager debugging]), |
2965c7cc | 500 | [AC_DEFINE([MM_DEBUG], [1], |
501 | [Define to 1 if you enable memory manager debugging.])]) | |
502 | ||
4fe9862e | 503 | AC_ARG_ENABLE([grub-emu], |
504 | [AS_HELP_STRING([--enable-grub-emu], | |
5ce5507f | 505 | [build and install the `grub-emu' debugging utility (default=guessed)])]) |
d64399b5 | 506 | AC_ARG_ENABLE([grub-emu-usb], |
507 | [AS_HELP_STRING([--enable-grub-emu-usb], | |
5ce5507f | 508 | [build and install the `grub-emu' debugging utility with USB support (default=guessed)])]) |
509 | if test x"$enable_grub_emu" = xno ; then | |
ce7a733d | 510 | grub_emu_excuse="explicitly disabled" |
5ce5507f | 511 | fi |
512 | ||
513 | [# Check for curses libraries.] | |
514 | [if [ x"$grub_emu_excuse" = x ]; then ] | |
4fe9862e | 515 | AC_CHECK_LIB([ncurses], [wgetch], [LIBCURSES="-lncurses"], |
516 | [AC_CHECK_LIB([curses], [wgetch], [LIBCURSES="-lcurses"], | |
e98cd0c2 | 517 | [grub_emu_excuse=["need (n)curses libraries"]])]) |
4fe9862e | 518 | AC_SUBST([LIBCURSES]) |
5ce5507f | 519 | [fi] |
520 | [if [ x"$grub_emu_excuse" = x ]; then ] | |
4fe9862e | 521 | [# Check for headers.] |
522 | AC_CHECK_HEADERS([ncurses/curses.h], [], | |
523 | [AC_CHECK_HEADERS([ncurses.h], [], | |
524 | [AC_CHECK_HEADERS([curses.h], [], | |
e98cd0c2 | 525 | [grub_emu_excuse=["need (n)curses headers"]])])]) |
5ce5507f | 526 | [fi] |
d64399b5 | 527 | |
5ce5507f | 528 | if test x"$enable_grub_emu" = xyes && test x"$grub_emu_excuse" != x ; then |
ce7a733d | 529 | AC_MSG_ERROR([grub-emu was explicitly requested but can't be compiled]) |
5ce5507f | 530 | fi |
531 | if test x"$grub_emu_excuse" = x ; then | |
532 | enable_grub_emu=yes | |
533 | else | |
534 | enable_grub_emu=no | |
535 | grub_emu_usb_excuse="grub-emu isn't built" | |
536 | fi | |
537 | if test x"$enable_grub_emu_usb" = xno ; then | |
ce7a733d | 538 | grub_emu_usb_excuse="explicitly disabled" |
5ce5507f | 539 | fi |
540 | [if [ x"$grub_emu_usb_excuse" = x ]; then | |
d64399b5 | 541 | # Check for libusb libraries.] |
5ce5507f | 542 | AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"], |
e98cd0c2 | 543 | [grub_emu_usb_excuse=["need libusb library"]]) |
d64399b5 | 544 | AC_SUBST([LIBUSB]) |
5ce5507f | 545 | [fi] |
546 | [if [ x"$grub_emu_usb_excuse" = x ]; then | |
547 | # Check for headers.] | |
d64399b5 | 548 | AC_CHECK_HEADERS([usb.h], [], |
e98cd0c2 | 549 | [grub_emu_usb_excuse=["need libusb headers"]]) |
4fe9862e | 550 | [fi] |
c6f3b249 | 551 | if test x"$enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then |
ce7a733d | 552 | AC_MSG_ERROR([USB support for grub-emu was explicitly requested but can't be compiled]) |
5ce5507f | 553 | fi |
554 | if test x"$grub_emu_usb_excuse" = x ; then | |
555 | enable_grub_emu_usb=yes | |
556 | else | |
557 | enable_grub_emu_usb=no | |
558 | fi | |
559 | ||
4fe9862e | 560 | AC_SUBST([enable_grub_emu]) |
d64399b5 | 561 | AC_SUBST([enable_grub_emu_usb]) |
4fe9862e | 562 | |
99fadbaa | 563 | AC_ARG_ENABLE([grub-fstest], |
564 | [AS_HELP_STRING([--enable-grub-fstest], | |
5ce5507f | 565 | [build and install the `grub-fstest' debugging utility (default=guessed)])]) |
566 | if test x"$enable_grub_fstest" = xno ; then | |
ce7a733d | 567 | grub_fstest_excuse="explicitly disabled" |
5ce5507f | 568 | fi |
569 | if test x"$grub_fstest_excuse" = x ; then | |
570 | enable_grub_fstest=yes | |
571 | else | |
572 | enable_grub_fstest=no | |
573 | fi | |
99fadbaa | 574 | AC_SUBST([enable_grub_fstest]) |
575 | ||
e52db1f7 | 576 | AC_ARG_ENABLE([grub-mkfont], |
577 | [AS_HELP_STRING([--enable-grub-mkfont], | |
5ce5507f | 578 | [build and install the `grub-mkfont' utility (default=guessed)])]) |
579 | if test x"$enable_grub_mkfont" = xno ; then | |
ce7a733d | 580 | grub_mkfont_excuse="explicitly disabled" |
5ce5507f | 581 | fi |
582 | ||
583 | if test x"$grub_mkfont_excuse" = x ; then | |
e52db1f7 | 584 | # Check for freetype libraries. |
585 | AC_CHECK_PROGS([FREETYPE], [freetype-config]) | |
586 | if test "x$FREETYPE" = x ; then | |
e98cd0c2 | 587 | grub_mkfont_excuse=["need freetype2 library"] |
e52db1f7 | 588 | fi |
589 | freetype_cflags=`freetype-config --cflags` | |
590 | freetype_libs=`freetype-config --libs` | |
591 | fi | |
5ce5507f | 592 | if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then |
ce7a733d | 593 | AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled]) |
5ce5507f | 594 | fi |
595 | if test x"$grub_mkfont_excuse" = x ; then | |
596 | enable_grub_mkfont=yes | |
597 | else | |
598 | enable_grub_mkfont=no | |
599 | fi | |
e52db1f7 | 600 | AC_SUBST([enable_grub_mkfont]) |
601 | AC_SUBST([freetype_cflags]) | |
602 | AC_SUBST([freetype_libs]) | |
603 | ||
2b167a72 | 604 | AC_SUBST(ASFLAGS) |
fc45fb58 | 605 | |
6a161fa9 | 606 | # Output files. |
1f4147aa | 607 | grub_CHECK_LINK_DIR |
608 | if test x"$link_dir" = xyes ; then | |
609 | AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu | |
b977bf01 | 610 | include/grub/machine:include/grub/$target_cpu/$platform]) |
1f4147aa | 611 | else |
612 | mkdir -p include/grub 2>/dev/null | |
613 | rm -rf include/grub/cpu | |
614 | cp -rp $srcdir/include/grub/$target_cpu include/grub/cpu 2>/dev/null | |
615 | rm -rf include/grub/machine | |
616 | cp -rp $srcdir/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null | |
617 | fi | |
7b455f4d | 618 | AC_CONFIG_FILES([Makefile gensymlist.sh genkernsyms.sh]) |
6a161fa9 | 619 | AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h]) |
620 | AC_OUTPUT | |
5ce5507f | 621 | [ |
622 | echo "*******************************************************" | |
623 | echo GRUB2 will be compiled with following components: | |
624 | echo Platform: "$target_cpu"-"$platform" | |
5ce5507f | 625 | if [ x"$grub_emu_excuse" = x ]; then |
626 | echo grub-emu: Yes | |
627 | else | |
628 | echo grub-emu: No "($grub_emu_excuse)" | |
629 | fi | |
630 | if [ x"$grub_emu_usb_excuse" = x ]; then | |
631 | echo USB support for grub-emu: Yes | |
632 | else | |
633 | echo USB support for grub-emu: No "($grub_emu_usb_excuse)" | |
634 | fi | |
635 | if [ x"$enable_mm_debug" = xyes ]; then | |
636 | echo With memory debugging: Yes | |
637 | else | |
638 | echo With memory debugging: No | |
639 | fi | |
5ce5507f | 640 | if [ x"$efiemu_excuse" = x ]; then |
641 | echo efiemu runtime: Yes | |
642 | else | |
643 | echo efiemu runtime: No "($efiemu_excuse)" | |
644 | fi | |
645 | if [ x"$grub_fstest_excuse" = x ]; then | |
646 | echo grub-fstest: Yes | |
647 | else | |
648 | echo grub-fstest: No "($grub_fstest_excuse)" | |
649 | fi | |
650 | if [ x"$grub_mkfont_excuse" = x ]; then | |
651 | echo grub-mkfont: Yes | |
652 | else | |
653 | echo grub-mkfont: No "($grub_mkfont_excuse)" | |
654 | fi | |
655 | echo "*******************************************************" | |
656 | ] |