1
# Process this file with autoconf to produce a configure script.
3
# Copyright (C) 2002,2003,2004,2005 Free Software Foundation, Inc.
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.
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
14
AC_INIT(GRUB, 1.92, [bug-grub@gnu.org])
16
AC_CONFIG_SRCDIR([include/grub/dl.h])
17
AC_CONFIG_HEADER([config.h])
19
# Checks for build and host systems.
24
i[[3456]]86) host_cpu=i386 ;;
25
x86_64) host_cpu=i386 biarch32=1 ;;
27
powerpc64) host_cpu=powerpc biarch32=1;;
29
*) AC_MSG_ERROR([unsupported CPU type]) ;;
32
case "$host_cpu"-"$host_vendor" in
33
i386-*) host_vendor=pc ;;
34
powerpc-*) host_vendor=ieee1275 ;;
35
sparc64-*) host_vendor=ieee1275 ;;
36
*) AC_MSG_ERROR([unsupported machine type]) ;;
42
# Checks for programs.
43
if test "x$CFLAGS" = x; then
49
# AC_PROG_YACC doesn't actually check if yacc exists!
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.])
60
test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required])
62
if test "x$default_CFLAGS" = xyes; then
64
tmp_CFLAGS="-Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes \
65
-Wundef -Wstrict-prototypes -g"
68
AC_CACHE_CHECK([whether optimization for size works], size_flag, [
70
AC_TRY_COMPILE(, , size_flag=yes, size_flag=no)
72
if test "x$size_flag" = xyes; then
73
tmp_CFLAGS="$tmp_CFLAGS -Os"
75
tmp_CFLAGS="$tmp_CFLAGS -O2 -fno-strength-reduce -fno-unroll-loops"
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])
85
if test "x$falign_loop_flag" = xyes; then
86
tmp_CFLAGS="$tmp_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
88
tmp_CFLAGS="$tmp_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
92
if test "x$biarch32" = x1; then
93
tmp_CFLAGS="$tmp_CFLAGS -m32"
100
# Defined in aclocal.m4.
102
if test "x$host_cpu" = xi386; then
103
grub_CHECK_START_SYMBOL
104
grub_CHECK_BSS_START_SYMBOL
105
grub_CHECK_END_SYMBOL
108
if test "x$host_cpu" = xi386; then
109
grub_I386_ASM_PREFIX_REQUIREMENT
111
grub_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK
112
grub_I386_CHECK_REGPARM_BUG
114
AC_DEFINE([NESTED_FUNC_ATTR], [], [Catch gcc bug])
119
AC_CHECK_TOOL(OBJCOPY, objcopy)
120
grub_PROG_OBJCOPY_ABSOLUTE
121
AC_CHECK_TOOL(STRIP, strip)
122
AC_CHECK_TOOL(NM, nm)
123
AC_CHECK_TOOL(LD, ld)
125
# This is not a "must".
126
AC_PATH_PROG(RUBY, ruby)
128
# For cross-compiling.
129
if test "x$build" != "x$host"; then
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.])])
137
# Test the C compiler for the build environment.
140
tmp_LDFLAGS="$LDFLAGS"
141
tmp_CPPFLAGS="$CPPFLAGS"
143
CFLAGS="$BUILD_CFLAGS"
144
CPPFLAGS="$BUILD_CPPFLAGS"
145
LDFLAGS="$BUILD_LDDFLAGS"
147
# Identify characteristics of the build architecture.
149
AC_CHECK_SIZEOF(void *)
150
AC_CHECK_SIZEOF(long)
152
# Check LZO when compiling for the i386.
153
if test "x$host_cpu" = xi386; then
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]))))
162
AC_CHECK_FUNC(lzo1x_999_compress, ,
163
[AC_MSG_ERROR([LZO1X-999 must be enabled])])
165
# LZO version 2 uses lzo/lzo1x.h, while LZO version 1 uses lzo1x.h.
166
AC_CHECK_HEADERS(lzo/lzo1x.h lzo1x.h)
170
AC_CHECK_LIB(ncurses, wgetch, [LIBCURSES="-lncurses"],
171
[AC_CHECK_LIB(curses, wgetch, [LIBCURSES="-lcurses"])])
175
AC_CHECK_HEADERS(ncurses/curses.h ncurses.h curses.h)
179
CPPFLAGS="$tmp_CPPFLAGS"
182
AC_CONFIG_LINKS([include/grub/cpu:include/grub/$host_cpu
183
include/grub/machine:include/grub/$host_cpu/$host_vendor])
184
AC_CONFIG_FILES([Makefile])
185
AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])