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