]>
Commit | Line | Data |
---|---|---|
6a161fa9 | 1 | # Process this file with autoconf to produce a configure script. |
2 | ||
4801580b | 3 | # Copyright (C) 2002,2003,2004,2005 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 | ||
befaed6c | 14 | AC_INIT(GRUB, 1.92, [bug-grub@gnu.org]) |
6a161fa9 | 15 | AC_PREREQ(2.53) |
4b13b216 | 16 | AC_CONFIG_SRCDIR([include/grub/dl.h]) |
6a161fa9 | 17 | AC_CONFIG_HEADER([config.h]) |
18 | ||
19 | # Checks for build and host systems. | |
20 | AC_CANONICAL_BUILD | |
21 | AC_CANONICAL_HOST | |
22 | ||
23 | case "$host_cpu" in | |
24 | i[[3456]]86) host_cpu=i386 ;; | |
be973c1b | 25 | x86_64) host_cpu=i386 biarch32=1 ;; |
e56cdf21 | 26 | powerpc) ;; |
be973c1b | 27 | powerpc64) host_cpu=powerpc biarch32=1;; |
e9211b5d | 28 | sparc64) ;; |
6a161fa9 | 29 | *) AC_MSG_ERROR([unsupported CPU type]) ;; |
30 | esac | |
31 | ||
32 | case "$host_cpu"-"$host_vendor" in | |
33 | i386-*) host_vendor=pc ;; | |
e56cdf21 | 34 | powerpc-*) host_vendor=ieee1275 ;; |
e9211b5d | 35 | sparc64-*) host_vendor=ieee1275 ;; |
6a161fa9 | 36 | *) AC_MSG_ERROR([unsupported machine type]) ;; |
37 | esac | |
38 | ||
39 | AC_SUBST(host_cpu) | |
40 | AC_SUBST(host_vendor) | |
41 | ||
42 | # Checks for programs. | |
43 | if test "x$CFLAGS" = x; then | |
44 | default_CFLAGS=yes | |
45 | fi | |
46 | ||
47 | AC_PROG_CC | |
daac212a | 48 | AC_PROG_YACC |
1569ec51 | 49 | # AC_PROG_YACC doesn't actually check if yacc exists! |
50 | tmp_yacc=$YACC | |
51 | unset YACC | |
52 | AC_CHECK_PROG(YACC, "$tmp_yacc", "$tmp_yacc") | |
53 | if test "x$YACC" = x; then | |
54 | AC_MSG_ERROR([Could not find $tmp_yacc.]) | |
55 | fi | |
56 | ||
a35eed7c | 57 | AC_SYS_LARGEFILE |
6a161fa9 | 58 | |
59 | # Must be GCC. | |
60 | test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required]) | |
61 | ||
62 | if test "x$default_CFLAGS" = xyes; then | |
63 | # debug flags. | |
a5ffe966 | 64 | tmp_CFLAGS="-Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes \ |
65 | -Wundef -Wstrict-prototypes -g" | |
6a161fa9 | 66 | |
67 | # optimization flags. | |
68 | AC_CACHE_CHECK([whether optimization for size works], size_flag, [ | |
69 | CFLAGS=-Os | |
70 | AC_TRY_COMPILE(, , size_flag=yes, size_flag=no) | |
71 | ]) | |
72 | if test "x$size_flag" = xyes; then | |
73 | tmp_CFLAGS="$tmp_CFLAGS -Os" | |
74 | else | |
75 | tmp_CFLAGS="$tmp_CFLAGS -O2 -fno-strength-reduce -fno-unroll-loops" | |
76 | fi | |
77 | ||
78 | # Force no alignment to save space on i386. | |
79 | if test "x$host_cpu" = xi386; then | |
80 | AC_CACHE_CHECK([whether -falign-loops works], [falign_loop_flag], [ | |
81 | CFLAGS="-falign-loops=1" | |
82 | AC_TRY_COMPILE(, , [falign_loop_flag=yes], [falign_loop_flag=no]) | |
83 | ]) | |
84 | ||
85 | if test "x$falign_loop_flag" = xyes; then | |
86 | tmp_CFLAGS="$tmp_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1" | |
87 | else | |
88 | tmp_CFLAGS="$tmp_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1" | |
89 | fi | |
90 | fi | |
91 | ||
be973c1b | 92 | if test "x$biarch32" = x1; then |
59b8208a | 93 | tmp_CFLAGS="$tmp_CFLAGS -m32" |
94 | fi | |
95 | ||
6a161fa9 | 96 | CFLAGS="$tmp_CFLAGS" |
97 | fi | |
98 | AC_SUBST(CFLAGS) | |
99 | ||
100 | # Defined in aclocal.m4. | |
4b13b216 | 101 | grub_ASM_USCORE |
e56cdf21 | 102 | if test "x$host_cpu" = xi386; then |
4b13b216 | 103 | grub_CHECK_START_SYMBOL |
104 | grub_CHECK_BSS_START_SYMBOL | |
105 | grub_CHECK_END_SYMBOL | |
e56cdf21 | 106 | fi |
6a161fa9 | 107 | |
108 | if test "x$host_cpu" = xi386; then | |
4b13b216 | 109 | grub_I386_ASM_PREFIX_REQUIREMENT |
110 | grub_I386_ASM_ADDR32 | |
111 | grub_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK | |
112 | grub_I386_CHECK_REGPARM_BUG | |
5aded270 | 113 | else |
f4917dfd | 114 | AC_DEFINE([NESTED_FUNC_ATTR], [], [Catch gcc bug]) |
6a161fa9 | 115 | fi |
116 | ||
6a161fa9 | 117 | AC_PROG_INSTALL |
118 | AC_PROG_MAKE_SET | |
119 | AC_CHECK_TOOL(OBJCOPY, objcopy) | |
4b13b216 | 120 | grub_PROG_OBJCOPY_ABSOLUTE |
6a161fa9 | 121 | AC_CHECK_TOOL(STRIP, strip) |
122 | AC_CHECK_TOOL(NM, nm) | |
9962ed99 | 123 | AC_CHECK_TOOL(LD, ld) |
6a161fa9 | 124 | |
125 | # This is not a "must". | |
126 | AC_PATH_PROG(RUBY, ruby) | |
127 | ||
128 | # For cross-compiling. | |
121c1d83 | 129 | if test "x$build" != "x$host"; then |
6a161fa9 | 130 | AC_CHECK_PROGS(BUILD_CC, [gcc egcs cc], |
131 | [AC_MSG_ERROR([none of gcc, egcs and cc is found. set BUILD_CC manually.])]) | |
e56cdf21 | 132 | else |
133 | BUILD_CC="$CC" | |
134 | AC_SUBST(BUILD_CC) | |
6a161fa9 | 135 | fi |
136 | ||
137 | # Test the C compiler for the build environment. | |
9962ed99 | 138 | tmp_CC="$CC" |
139 | tmp_CFLAGS="$CFLAGS" | |
59b8208a | 140 | tmp_LDFLAGS="$LDFLAGS" |
9962ed99 | 141 | tmp_CPPFLAGS="$CPPFLAGS" |
6a161fa9 | 142 | CC="$BUILD_CC" |
9962ed99 | 143 | CFLAGS="$BUILD_CFLAGS" |
144 | CPPFLAGS="$BUILD_CPPFLAGS" | |
59b8208a | 145 | LDFLAGS="$BUILD_LDDFLAGS" |
1f5ab428 | 146 | |
147 | # Identify characteristics of the build architecture. | |
6a161fa9 | 148 | AC_C_BIGENDIAN |
149 | AC_CHECK_SIZEOF(void *) | |
150 | AC_CHECK_SIZEOF(long) | |
1f5ab428 | 151 | |
e56cdf21 | 152 | # Check LZO when compiling for the i386. |
153 | if test "x$host_cpu" = xi386; then | |
4ac9bd04 | 154 | # There are three possibilities. LZO version 2 installed with the name |
155 | # liblzo2, with the name liblzo, and LZO version 1. | |
156 | AC_CHECK_LIB(lzo2, __lzo_init_v2, [LIBLZO="-llzo2"], | |
157 | AC_CHECK_LIB(lzo, __lzo_init_v2, [LIBLZO="-llzo"], | |
158 | AC_CHECK_LIB(lzo, __lzo_init2, [LIBLZO="-llzo"], | |
159 | AC_MSG_ERROR([LZO library version 1.02 or later is required])))) | |
160 | AC_SUBST(LIBLZO) | |
161 | LIBS="$LIBS $LIBLZO" | |
e56cdf21 | 162 | AC_CHECK_FUNC(lzo1x_999_compress, , |
163 | [AC_MSG_ERROR([LZO1X-999 must be enabled])]) | |
4ac9bd04 | 164 | |
165 | # LZO version 2 uses lzo/lzo1x.h, while LZO version 1 uses lzo1x.h. | |
166 | AC_CHECK_HEADERS(lzo/lzo1x.h lzo1x.h) | |
e56cdf21 | 167 | fi |
1f5ab428 | 168 | |
f4917dfd | 169 | # Check for curses. |
170 | AC_CHECK_LIB(ncurses, wgetch, [LIBCURSES="-lncurses"], | |
171 | [AC_CHECK_LIB(curses, wgetch, [LIBCURSES="-lcurses"])]) | |
172 | AC_SUBST(LIBCURSES) | |
173 | ||
174 | # Check for headers. | |
175 | AC_CHECK_HEADERS(ncurses/curses.h ncurses.h curses.h) | |
176 | ||
9962ed99 | 177 | CC="$tmp_CC" |
178 | CFLAGS="$tmp_CFLAGS" | |
179 | CPPFLAGS="$tmp_CPPFLAGS" | |
6a161fa9 | 180 | |
181 | # Output files. | |
4b13b216 | 182 | AC_CONFIG_LINKS([include/grub/cpu:include/grub/$host_cpu |
183 | include/grub/machine:include/grub/$host_cpu/$host_vendor]) | |
6a161fa9 | 184 | AC_CONFIG_FILES([Makefile]) |
185 | AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h]) | |
186 | AC_OUTPUT |