]>
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 | ||
eb73121d | 34 | AC_INIT([GRUB],[1.96],[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 |
47 | i[[3456]]86) target_cpu=i386 ;; | |
6a161fa9 | 48 | esac |
49 | ||
05568c2e | 50 | # Specify the platform (such as firmware). |
51 | AC_ARG_WITH([platform], | |
52 | AS_HELP_STRING([--with-platform=PLATFORM], | |
83b984de | 53 | [select the host platform [[guessed]]])) |
05568c2e | 54 | |
55 | # Guess the platform if not specified. | |
56 | if test "x$with_platform" = x; then | |
b977bf01 | 57 | case "$target_cpu"-"$target_vendor" in |
05568c2e | 58 | i386-apple) platform=efi ;; |
59 | i386-*) platform=pc ;; | |
58393a2d | 60 | x86_64-apple) platform=efi ;; |
737feb35 | 61 | x86_64-*) platform=pc ;; |
05568c2e | 62 | powerpc-*) platform=ieee1275 ;; |
58393a2d | 63 | powerpc64-*) platform=ieee1275 ;; |
05568c2e | 64 | sparc64-*) platform=ieee1275 ;; |
58393a2d | 65 | *) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;; |
05568c2e | 66 | esac |
67 | else | |
68 | platform="$with_platform" | |
69 | fi | |
70 | ||
58393a2d | 71 | # Adjust CPU unless target was explicitly specified. |
72 | if test -z "$target_alias"; then | |
73 | case "$target_cpu"-"$platform" in | |
74 | x86_64-efi) ;; | |
3f4ce737 | 75 | x86_64-*) target_cpu=i386 ;; |
76 | powerpc64-ieee1275) target_cpu=powerpc ;; | |
20011694 | 77 | esac |
78 | fi | |
79 | ||
58393a2d | 80 | # Check if the platform is supported, make final adjustments. |
b977bf01 | 81 | case "$target_cpu"-"$platform" in |
05568c2e | 82 | i386-efi) ;; |
3f4ce737 | 83 | x86_64-efi) ;; |
05568c2e | 84 | i386-pc) ;; |
546f966a | 85 | i386-coreboot) ;; |
58393a2d | 86 | i386-linuxbios) platform=coreboot ;; |
3d04eab8 | 87 | i386-ieee1275) ;; |
05568c2e | 88 | powerpc-ieee1275) ;; |
89 | sparc64-ieee1275) ;; | |
58393a2d | 90 | *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;; |
6a161fa9 | 91 | esac |
92 | ||
3f4ce737 | 93 | case "$target_cpu" in |
94 | i386 | powerpc) target_m32=1 ;; | |
95 | x86_64 | sparc64) target_m64=1 ;; | |
96 | esac | |
97 | ||
6e5a42fe | 98 | case "$host_os" in |
99 | mingw32) host_os=cygwin ;; | |
100 | esac | |
101 | ||
9304eef1 | 102 | # This normalizes the names, and creates a new variable ("host_kernel") |
103 | # while at it, since the mapping is not always 1:1 (e.g. different OSes | |
104 | # using the same kernel type). | |
105 | case "$host_os" in | |
106 | gnu*) host_kernel=hurd ;; | |
107 | linux*) host_kernel=linux ;; | |
108 | freebsd* | kfreebsd*-gnu) host_kernel=freebsd ;; | |
109 | cygwin) host_kernel=windows ;; | |
110 | esac | |
111 | ||
56978920 | 112 | AC_SUBST(host_cpu) |
113 | AC_SUBST(host_os) | |
9304eef1 | 114 | AC_SUBST(host_kernel) |
6e5a42fe | 115 | |
b977bf01 | 116 | AC_SUBST(target_cpu) |
05568c2e | 117 | AC_SUBST(platform) |
6a161fa9 | 118 | |
b977bf01 | 119 | # |
120 | # Checks for build programs. | |
121 | # | |
144f1f98 | 122 | |
6c826348 | 123 | # Although cmp is listed in the GNU Coding Standards as a command which |
124 | # can used directly, OpenBSD lacks cmp in the default installation. | |
125 | AC_CHECK_PROGS([CMP], [cmp]) | |
126 | if test "x$CMP" = x; then | |
127 | AC_MSG_ERROR([cmp is not found]) | |
128 | fi | |
129 | ||
144f1f98 | 130 | AC_CHECK_PROGS([YACC], [bison]) |
1569ec51 | 131 | if test "x$YACC" = x; then |
6c826348 | 132 | AC_MSG_ERROR([bison is not found]) |
1569ec51 | 133 | fi |
134 | ||
1e901a75 | 135 | for file in /usr/src/unifont.bdf ; do |
4931827f | 136 | if test -e $file ; then |
1e901a75 | 137 | AC_SUBST([UNIFONT_BDF], [$file]) |
4931827f | 138 | break |
139 | fi | |
140 | done | |
141 | ||
b977bf01 | 142 | AC_PROG_INSTALL |
143 | AC_PROG_AWK | |
144 | AC_PROG_MAKE_SET | |
145 | ||
68807e5f | 146 | # These are not a "must". |
b977bf01 | 147 | AC_PATH_PROG(RUBY, ruby) |
68807e5f | 148 | AC_PATH_PROG(HELP2MAN, help2man) |
6a161fa9 | 149 | |
b977bf01 | 150 | # |
151 | # Checks for host programs. | |
152 | # | |
153 | ||
154 | AC_PROG_CC | |
6a161fa9 | 155 | # Must be GCC. |
156 | test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required]) | |
157 | ||
4889bdec | 158 | AC_GNU_SOURCE |
b977bf01 | 159 | AC_SYS_LARGEFILE |
160 | ||
161 | # Identify characteristics of the host architecture. | |
162 | AC_C_BIGENDIAN | |
163 | AC_CHECK_SIZEOF(void *) | |
164 | AC_CHECK_SIZEOF(long) | |
165 | ||
2b167a72 | 166 | grub_apple_cc |
167 | if test x$grub_cv_apple_cc == xyes ; then | |
168 | CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions" | |
169 | ASFLAGS="$ASFLAGS -DAPPLE_CC=1" | |
170 | fi | |
b977bf01 | 171 | |
172 | # Check LZO when compiling for the i386-pc. | |
173 | if test "$target_cpu"-"$platform" = i386-pc; then | |
aa24b516 | 174 | AC_ARG_ENABLE([lzo], |
175 | [AS_HELP_STRING([--enable-lzo], | |
176 | [use lzo to compress kernel (default is lzma)])]) | |
177 | [if [ x"$enable_lzo" = xyes ]; then | |
178 | # There are three possibilities. LZO version 2 installed with the name | |
179 | # liblzo2, with the name liblzo, and LZO version 1.] | |
180 | AC_DEFINE([ENABLE_LZO], [1], [Use lzo compression]) | |
181 | AC_CHECK_LIB([lzo2], [__lzo_init_v2], [LIBLZO="-llzo2"], | |
182 | [AC_CHECK_LIB([lzo], [__lzo_init_v2], [LIBLZO="-llzo"], | |
183 | [AC_CHECK_LIB([lzo], [__lzo_init2], [LIBLZO="-llzo"], | |
184 | [AC_MSG_ERROR([LZO library version 1.02 or later is required])])])]) | |
185 | AC_SUBST([LIBLZO]) | |
186 | [LIBS="$LIBS $LIBLZO"] | |
187 | AC_CHECK_FUNC([lzo1x_999_compress], , | |
b977bf01 | 188 | [AC_MSG_ERROR([LZO1X-999 must be enabled])]) |
189 | ||
aa24b516 | 190 | [# LZO version 2 uses lzo/lzo1x.h, while LZO version 1 uses lzo1x.h.] |
191 | AC_CHECK_HEADERS([lzo/lzo1x.h lzo1x.h]) | |
192 | [else] | |
193 | AC_DEFINE([ENABLE_LZMA], [1], [Use lzma compression]) | |
194 | [fi] | |
195 | AC_SUBST([enable_lzo]) | |
b977bf01 | 196 | fi |
197 | ||
4889bdec | 198 | # Check for functions. |
df38d0bb | 199 | AC_CHECK_FUNCS(posix_memalign memalign asprintf) |
4889bdec | 200 | |
b977bf01 | 201 | # |
202 | # Check for target programs. | |
203 | # | |
204 | ||
5b5d4aa5 | 205 | # Find tools for the target. |
206 | if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then | |
b977bf01 | 207 | tmp_ac_tool_prefix="$ac_tool_prefix" |
208 | ac_tool_prefix=$target_alias- | |
209 | ||
210 | AC_CHECK_TOOLS(TARGET_CC, [gcc egcs cc], | |
211 | [AC_MSG_ERROR([none of gcc, egcs and cc is found. set TARGET_CC manually.])]) | |
212 | AC_CHECK_TOOL(OBJCOPY, objcopy) | |
213 | AC_CHECK_TOOL(STRIP, strip) | |
214 | AC_CHECK_TOOL(NM, nm) | |
215 | ||
216 | ac_tool_prefix="$tmp_ac_tool_prefix" | |
217 | else | |
218 | if test "x$TARGET_CC" = x; then | |
219 | TARGET_CC=$CC | |
220 | fi | |
221 | AC_CHECK_TOOL(OBJCOPY, objcopy) | |
222 | AC_CHECK_TOOL(STRIP, strip) | |
223 | AC_CHECK_TOOL(NM, nm) | |
224 | fi | |
225 | AC_SUBST(TARGET_CC) | |
226 | ||
227 | ||
228 | # Test the C compiler for the target environment. | |
229 | tmp_CC="$CC" | |
230 | tmp_CFLAGS="$CFLAGS" | |
231 | tmp_LDFLAGS="$LDFLAGS" | |
232 | tmp_CPPFLAGS="$CPPFLAGS" | |
aa6d7826 | 233 | tmp_LIBS="$LIBS" |
b977bf01 | 234 | CC="$TARGET_CC" |
235 | CFLAGS="$TARGET_CFLAGS" | |
236 | CPPFLAGS="$TARGET_CPPFLAGS" | |
237 | LDFLAGS="$TARGET_LDFLAGS" | |
aa6d7826 | 238 | LIBS="" |
b977bf01 | 239 | |
240 | if test "x$TARGET_CFLAGS" = x; then | |
6a161fa9 | 241 | # debug flags. |
b977bf01 | 242 | TARGET_CFLAGS="-Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes \ |
243 | -Wundef -Wstrict-prototypes -g" | |
6a161fa9 | 244 | |
245 | # optimization flags. | |
322562ea | 246 | AC_CACHE_CHECK([whether optimization for size works], grub_cv_cc_Os, [ |
6a161fa9 | 247 | CFLAGS=-Os |
eb73121d | 248 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], |
249 | [grub_cv_cc_Os=yes], | |
250 | [grub_cv_cc_Os=no]) | |
6a161fa9 | 251 | ]) |
322562ea | 252 | if test "x$grub_cv_cc_Os" = xyes; then |
b977bf01 | 253 | TARGET_CFLAGS="$TARGET_CFLAGS -Os" |
6a161fa9 | 254 | else |
b977bf01 | 255 | TARGET_CFLAGS="$TARGET_CFLAGS -O2 -fno-strength-reduce -fno-unroll-loops" |
6a161fa9 | 256 | fi |
257 | ||
258 | # Force no alignment to save space on i386. | |
b977bf01 | 259 | if test "x$target_cpu" = xi386; then |
322562ea | 260 | AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [ |
2b167a72 | 261 | CFLAGS="$CFLAGS -falign-loops=1" |
eb73121d | 262 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], |
263 | [grub_cv_cc_falign_loop=yes], | |
264 | [grub_cv_cc_falign_loop=no]) | |
6a161fa9 | 265 | ]) |
266 | ||
322562ea | 267 | if test "x$grub_cv_cc_falign_loop" = xyes; then |
b977bf01 | 268 | TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1" |
6a161fa9 | 269 | else |
b977bf01 | 270 | TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1" |
6a161fa9 | 271 | fi |
272 | fi | |
b977bf01 | 273 | fi |
6a161fa9 | 274 | |
2b167a72 | 275 | grub_apple_target_cc |
276 | if test x$grub_cv_apple_target_cc == xyes ; then | |
277 | TARGET_CFLAGS="$TARGET_CFLAGS -DAPPLE_CC=1 -fnested-functions" | |
278 | CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions" | |
279 | TARGET_ASFLAGS="$TARGET_ASFLAGS -DAPPLE_CC=1" | |
280 | TARGET_APPLE_CC=1 | |
cf00df31 | 281 | AC_CHECK_PROG([OBJCONV], [objconv], [objconv], []) |
282 | if test "x$OBJCONV" = x ; then | |
283 | AC_CHECK_PROG([OBJCONV], [objconv], [./objconv], [], [.]) | |
284 | fi | |
285 | if test "x$OBJCONV" = x ; then | |
286 | AC_MSG_ERROR([objconv not found which is required when building with apple compiler]) | |
287 | fi | |
2b167a72 | 288 | TARGET_IMG_LDSCRIPT= |
289 | TARGET_IMG_CFLAGS="-static" | |
290 | TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,' | |
291 | TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,' | |
292 | else | |
293 | TARGET_APPLE_CC=0 | |
294 | # Use linker script if present, otherwise use builtin -N script. | |
295 | AC_MSG_CHECKING([for option to link raw image]) | |
296 | if test -f "${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"; then | |
297 | TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc" | |
298 | TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT} -Wl,-Ttext," | |
299 | TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc" | |
300 | else | |
301 | TARGET_IMG_LDSCRIPT= | |
302 | TARGET_IMG_LDFLAGS='-Wl,-N -Wl,-Ttext,' | |
303 | TARGET_IMG_LDFLAGS_AC='-Wl,-N -Wl,-Ttext,' | |
304 | fi | |
305 | TARGET_IMG_CFLAGS= | |
306 | fi | |
307 | ||
308 | AC_SUBST(TARGET_IMG_LDSCRIPT) | |
309 | AC_SUBST(TARGET_IMG_LDFLAGS) | |
310 | AC_SUBST(TARGET_IMG_CFLAGS) | |
311 | AC_MSG_RESULT([$TARGET_IMG_LDFLAGS_AC]) | |
312 | ||
313 | # For platforms where ELF is not the default link format. | |
314 | AC_MSG_CHECKING([for command to convert module to ELF format]) | |
315 | case "${host_os}" in | |
316 | cygwin) TARGET_OBJ2ELF='grub-pe2elf' ;; | |
317 | *) ;; | |
318 | esac | |
319 | AC_SUBST(TARGET_OBJ2ELF) | |
320 | AC_MSG_RESULT([$TARGET_OBJ2ELF]) | |
321 | ||
322 | ||
b977bf01 | 323 | if test "x$target_m32" = x1; then |
324 | # Force 32-bit mode. | |
325 | TARGET_CFLAGS="$TARGET_CFLAGS -m32" | |
326 | TARGET_LDFLAGS="$TARGET_LDFLAGS -m32" | |
2b167a72 | 327 | TARGET_MODULE_FORMAT="elf32" |
6a161fa9 | 328 | fi |
b977bf01 | 329 | |
20011694 | 330 | if test "x$target_m64" = x1; then |
331 | # Force 64-bit mode. | |
7e9ca17a | 332 | TARGET_CFLAGS="$TARGET_CFLAGS -m64" |
333 | TARGET_LDFLAGS="$TARGET_LDFLAGS -m64" | |
2b167a72 | 334 | TARGET_MODULE_FORMAT="elf64" |
7e9ca17a | 335 | fi |
336 | ||
337 | if test "$target_cpu"-"$platform" = x86_64-efi; then | |
338 | # Use large model to support 4G memory | |
6e09b8b7 | 339 | AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [ |
c8600122 | 340 | SAVED_CFLAGS=$CFLAGS |
341 | CFLAGS="$CFLAGS -m64 -mcmodel=large" | |
6e09b8b7 | 342 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], |
343 | [grub_cv_cc_mcmodel=yes], | |
344 | [grub_cv_cc_mcmodel=no]) | |
345 | ]) | |
c8600122 | 346 | if test "x$grub_cv_cc_mcmodel" = xno; then |
347 | CFLAGS="$SAVED_CFLAGS -m64 -DMCMODEL_SMALL=1" | |
b39f9d20 | 348 | TARGET_CFLAGS="$TARGET_CFLAGS -DMCMODEL_SMALL=1" |
c8600122 | 349 | AC_MSG_WARN([-mcmodel=large not supported. You wan't be able to use the memory over 4GiB. Upgrade your gcc]) |
350 | else | |
351 | TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large" | |
6e09b8b7 | 352 | fi |
7e9ca17a | 353 | |
354 | # EFI writes to stack below %rsp, we must not use the red zone | |
355 | AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [ | |
c8600122 | 356 | CFLAGS="$CFLAGS -m64 -mno-red-zone" |
7e9ca17a | 357 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], |
358 | [grub_cv_cc_no_red_zone=yes], | |
359 | [grub_cv_cc_no_red_zone=no]) | |
360 | ]) | |
361 | if test "x$grub_cv_cc_no_red_zone" = xno; then | |
362 | AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc]) | |
363 | fi | |
364 | ||
c8600122 | 365 | TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone" |
20011694 | 366 | fi |
367 | ||
baa2a121 | 368 | # |
369 | # Compiler features. | |
370 | # | |
371 | ||
9035dce4 | 372 | # Need __enable_execute_stack() for nested function trampolines? |
373 | grub_CHECK_ENABLE_EXECUTE_STACK | |
374 | ||
baa2a121 | 375 | # Smashing stack protector. |
376 | grub_CHECK_STACK_PROTECTOR | |
c3db8364 | 377 | # Need that, because some distributions ship compilers that include |
baa2a121 | 378 | # `-fstack-protector' in the default specs. |
c3db8364 | 379 | if test "x$ssp_possible" = xyes; then |
380 | TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector" | |
381 | fi | |
2a8a80e4 | 382 | grub_CHECK_STACK_ARG_PROBE |
383 | # Cygwin's GCC uses alloca() to probe the stackframe on static | |
384 | # stack allocations above some threshold. | |
385 | if test x"$sap_possible" = xyes; then | |
386 | TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe" | |
387 | fi | |
baa2a121 | 388 | |
b977bf01 | 389 | AC_SUBST(TARGET_CFLAGS) |
2b167a72 | 390 | AC_SUBST(TARGET_MODULE_FORMAT) |
cf00df31 | 391 | AC_SUBST(OBJCONV) |
2b167a72 | 392 | AC_SUBST(TARGET_APPLE_CC) |
393 | AC_SUBST(TARGET_ASFLAGS) | |
b977bf01 | 394 | AC_SUBST(TARGET_CPPFLAGS) |
395 | AC_SUBST(TARGET_LDFLAGS) | |
6a161fa9 | 396 | |
aa6d7826 | 397 | # Set them to their new values for the tests below. |
398 | CC="$TARGET_CC" | |
437e6adc | 399 | CFLAGS="$TARGET_CFLAGS -nostdlib" |
aa6d7826 | 400 | CPPFLAGS="$TARGET_CPPFLAGS" |
401 | LDFLAGS="$TARGET_LDFLAGS" | |
402 | ||
6a161fa9 | 403 | # Defined in aclocal.m4. |
f6130a12 | 404 | grub_PROG_TARGET_CC |
2b167a72 | 405 | if test "x$TARGET_APPLE_CC" != x1 ; then |
b977bf01 | 406 | grub_PROG_OBJCOPY_ABSOLUTE |
2b167a72 | 407 | fi |
cb71ba20 | 408 | grub_PROG_LD_BUILD_ID_NONE |
4b13b216 | 409 | grub_ASM_USCORE |
b977bf01 | 410 | if test "x$target_cpu" = xi386; then |
2a8a80e4 | 411 | if test ! -z "$TARGET_IMG_LDSCRIPT"; then |
412 | # Check symbols provided by linker script. | |
413 | CFLAGS="$TARGET_CFLAGS -nostdlib $TARGET_IMG_LDFLAGS_AC -Wl,-Ttext,8000,--defsym,___main=0x8100" | |
414 | fi | |
2b167a72 | 415 | if test "x$platform" = xpc && test "x$TARGET_APPLE_CC" != x1 ; then |
2a8a80e4 | 416 | grub_CHECK_BSS_START_SYMBOL |
417 | grub_CHECK_END_SYMBOL | |
418 | fi | |
419 | CFLAGS="$TARGET_CFLAGS" | |
4b13b216 | 420 | grub_I386_ASM_PREFIX_REQUIREMENT |
421 | grub_I386_ASM_ADDR32 | |
422 | grub_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK | |
5aded270 | 423 | else |
f4917dfd | 424 | AC_DEFINE([NESTED_FUNC_ATTR], [], [Catch gcc bug]) |
6a161fa9 | 425 | fi |
426 | ||
bf6a5fb2 | 427 | AH_BOTTOM([#if defined(__i386__) && !defined(GRUB_UTIL) |
428 | #define NESTED_FUNC_ATTR __attribute__ ((__regparm__ (1))) | |
429 | #else | |
430 | #define NESTED_FUNC_ATTR | |
431 | #endif]) | |
432 | ||
c9a86192 | 433 | # Restore the flags. |
9962ed99 | 434 | CC="$tmp_CC" |
435 | CFLAGS="$tmp_CFLAGS" | |
436 | CPPFLAGS="$tmp_CPPFLAGS" | |
c9a86192 | 437 | LDFLAGS="$tmp_LDFLAGS" |
aa6d7826 | 438 | LIBS="$tmp_LIBS" |
6a161fa9 | 439 | |
4fe9862e | 440 | # |
2965c7cc | 441 | # Check for options. |
4fe9862e | 442 | # |
443 | ||
444 | # Memory manager debugging. | |
b39f9d20 | 445 | AC_ARG_ENABLE([mm-debug], |
2965c7cc | 446 | AS_HELP_STRING([--enable-mm-debug], |
90ce5d56 | 447 | [include memory manager debugging]), |
2965c7cc | 448 | [AC_DEFINE([MM_DEBUG], [1], |
449 | [Define to 1 if you enable memory manager debugging.])]) | |
450 | ||
4fe9862e | 451 | AC_ARG_ENABLE([grub-emu], |
452 | [AS_HELP_STRING([--enable-grub-emu], | |
453 | [build and install the `grub-emu' debugging utility])]) | |
d64399b5 | 454 | AC_ARG_ENABLE([grub-emu-usb], |
455 | [AS_HELP_STRING([--enable-grub-emu-usb], | |
456 | [build and install the `grub-emu' debugging utility with USB support])]) | |
4fe9862e | 457 | [if [ x"$enable_grub_emu" = xyes ]; then |
458 | # Check for curses libraries.] | |
459 | AC_CHECK_LIB([ncurses], [wgetch], [LIBCURSES="-lncurses"], | |
460 | [AC_CHECK_LIB([curses], [wgetch], [LIBCURSES="-lcurses"], | |
461 | [AC_MSG_ERROR([(n)curses libraries are required to build `grub-emu'])])]) | |
462 | AC_SUBST([LIBCURSES]) | |
463 | ||
464 | [# Check for headers.] | |
465 | AC_CHECK_HEADERS([ncurses/curses.h], [], | |
466 | [AC_CHECK_HEADERS([ncurses.h], [], | |
467 | [AC_CHECK_HEADERS([curses.h], [], | |
468 | [AC_MSG_ERROR([(n)curses header files are required to build `grub-emu'])])])]) | |
d64399b5 | 469 | |
470 | [if [ x"$enable_grub_emu_usb" = xyes ]; then | |
471 | # Check for libusb libraries.] | |
472 | AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"], | |
473 | [AC_MSG_ERROR([libusb libraries are required to build `grub-emu' with USB support])]) | |
474 | AC_SUBST([LIBUSB]) | |
475 | ||
476 | [# Check for headers.] | |
477 | AC_CHECK_HEADERS([usb.h], [], | |
478 | [AC_MSG_ERROR([libusb header file is required to build `grub-emu' with USB support])]) | |
479 | [fi] | |
4fe9862e | 480 | [fi] |
481 | AC_SUBST([enable_grub_emu]) | |
d64399b5 | 482 | AC_SUBST([enable_grub_emu_usb]) |
4fe9862e | 483 | |
99fadbaa | 484 | AC_ARG_ENABLE([grub-fstest], |
485 | [AS_HELP_STRING([--enable-grub-fstest], | |
486 | [build and install the `grub-fstest' debugging utility])]) | |
487 | AC_SUBST([enable_grub_fstest]) | |
488 | ||
2d05bc6a | 489 | AC_ARG_ENABLE([grub-pe2elf], |
490 | [AS_HELP_STRING([--enable-grub-pe2elf], | |
491 | [build and install the `grub-pe2elf' conversion utility])]) | |
492 | AC_SUBST([enable_grub_pe2elf]) | |
493 | ||
e52db1f7 | 494 | AC_ARG_ENABLE([grub-mkfont], |
495 | [AS_HELP_STRING([--enable-grub-mkfont], | |
496 | [build and install the `grub-mkfont' utility])]) | |
497 | if test x"$enable_grub_mkfont" = xyes ; then | |
498 | # Check for freetype libraries. | |
499 | AC_CHECK_PROGS([FREETYPE], [freetype-config]) | |
500 | if test "x$FREETYPE" = x ; then | |
501 | AC_MSG_ERROR([freetype2 libraries are required to build `grub-mkfont']) | |
502 | fi | |
503 | freetype_cflags=`freetype-config --cflags` | |
504 | freetype_libs=`freetype-config --libs` | |
505 | fi | |
506 | AC_SUBST([enable_grub_mkfont]) | |
507 | AC_SUBST([freetype_cflags]) | |
508 | AC_SUBST([freetype_libs]) | |
509 | ||
fc45fb58 | 510 | AC_ARG_ENABLE([efiemu], |
511 | [AS_HELP_STRING([--enable-efiemu], | |
512 | [build and install the efiemu runtimes])]) | |
513 | AC_SUBST([enable_efiemu]) | |
2b167a72 | 514 | AC_SUBST(ASFLAGS) |
fc45fb58 | 515 | |
6a161fa9 | 516 | # Output files. |
1f4147aa | 517 | grub_CHECK_LINK_DIR |
518 | if test x"$link_dir" = xyes ; then | |
519 | AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu | |
b977bf01 | 520 | include/grub/machine:include/grub/$target_cpu/$platform]) |
1f4147aa | 521 | else |
522 | mkdir -p include/grub 2>/dev/null | |
523 | rm -rf include/grub/cpu | |
524 | cp -rp $srcdir/include/grub/$target_cpu include/grub/cpu 2>/dev/null | |
525 | rm -rf include/grub/machine | |
526 | cp -rp $srcdir/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null | |
527 | fi | |
7b455f4d | 528 | AC_CONFIG_FILES([Makefile gensymlist.sh genkernsyms.sh]) |
6a161fa9 | 529 | AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h]) |
530 | AC_OUTPUT |