~darkmuggle-deactivatedaccount/ubuntu/quantal/grub2/fix-872244

1.26.4 by Colin Watson
Import upstream version 1.99~20101122
1
# -*- autoconf -*-
2
1.1.2 by Otavio Salvador
Import upstream version 1.92
3
# Process this file with autoconf to produce a configure script.
4
1.15.5 by Robert Millan
Import upstream version 1.98~20100107
5
# Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010  Free Software Foundation, Inc.
1.1.2 by Otavio Salvador
Import upstream version 1.92
6
#
7
# This configure.ac is free software; the author
8
# gives unlimited permission to copy and/or distribute it,
9
# with or without modifications, as long as this notice is preserved.
10
#
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14
# PARTICULAR PURPOSE.
15
1.1.3 by Otavio Salvador
Import upstream version 1.94
16
dnl This configure script is complicated, because GRUB needs to deal
17
dnl with three potentially different types:
18
dnl
19
dnl   build  -- the environment for building GRUB
20
dnl   host   -- the environment for running utilities
21
dnl   target -- the environment for running GRUB
22
dnl
23
dnl In addition, GRUB needs to deal with a platform specification
24
dnl which specifies the system running GRUB, such as firmware.
25
dnl This is necessary because the target type in autoconf does not
26
dnl describe such a system very well.
27
dnl
28
dnl The current strategy is to use variables with no prefix (such as
29
dnl CC, CFLAGS, etc.) for the host type as well as the build type,
30
dnl because GRUB does not need to use those variables for the build
31
dnl type, so there is no conflict. Variables with the prefix "TARGET_"
32
dnl (such as TARGET_CC, TARGET_CFLAGS, etc.) are used for the target
33
dnl type.
34
1.17.15 by Colin Watson
Import upstream version 1.99
35
AC_INIT([GRUB],[1.99],[bug-grub@gnu.org])
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
36
37
AC_CONFIG_AUX_DIR([build-aux])
38
39
# We don't want -g -O2 by default in CFLAGS
40
: ${CFLAGS=""}
41
42
# Checks for host and target systems.
43
AC_CANONICAL_HOST
44
AC_CANONICAL_TARGET
45
1.2.11 by Felix Zielcke
Import upstream version 1.97+20091125
46
AM_INIT_AUTOMAKE()
47
AC_PREREQ(2.60)
1.1.2 by Otavio Salvador
Import upstream version 1.92
48
AC_CONFIG_SRCDIR([include/grub/dl.h])
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
49
AC_CONFIG_HEADER([config-util.h])
1.1.2 by Otavio Salvador
Import upstream version 1.92
50
1.1.5 by Albin Tonnerre
Import upstream version 1.95+20070520
51
# Program name transformations
52
AC_ARG_PROGRAM
53
1.15.4 by Felix Zielcke
Import upstream version 1.98~20091229
54
# Optimization flag.  Allow user to override.
55
if test "x$TARGET_CFLAGS" = x; then
56
  TARGET_CFLAGS="$TARGET_CFLAGS -Os"
57
fi
58
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
59
# Default HOST_CPPFLAGS
60
HOST_CPPFLAGS="$HOST_CPPFLAGS -Wall -W"
61
HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include"
62
HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_UTIL=1"
63
HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_LIBDIR=\\\"\$(pkglibdir)\\\""
64
HOST_CPPFLAGS="$HOST_CPPFLAGS -DLOCALEDIR=\\\"\$(localedir)\\\""
65
66
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -Wall -W"
67
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include"
68
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include"
69
1.1.3 by Otavio Salvador
Import upstream version 1.94
70
case "$target_cpu" in
17.4.9 by Robert Millan
* New SVN snapshot.
71
  i[[3456]]86)	target_cpu=i386 ;;
1.15.10 by Colin Watson
Import upstream version 1.98
72
  amd64)	target_cpu=x86_64 ;;
17.4.9 by Robert Millan
* New SVN snapshot.
73
  sparc)	target_cpu=sparc64 ;;
1.25.1 by Robert Millan
Import upstream version 1.97+experimental.20091205
74
  mipsel|mips64el)
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
75
                target_cpu=mips;
76
		machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPSEL=1";
1.25.1 by Robert Millan
Import upstream version 1.97+experimental.20091205
77
		;;
78
  mips|mips64)
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
79
                target_cpu=mips;
80
		machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPS=1";
1.25.1 by Robert Millan
Import upstream version 1.97+experimental.20091205
81
		;;
1.1.2 by Otavio Salvador
Import upstream version 1.92
82
esac
83
1.1.3 by Otavio Salvador
Import upstream version 1.94
84
# Specify the platform (such as firmware).
85
AC_ARG_WITH([platform],
86
            AS_HELP_STRING([--with-platform=PLATFORM],
87
                           [select the host platform [[guessed]]]))
88
89
# Guess the platform if not specified.
90
if test "x$with_platform" = x; then
91
  case "$target_cpu"-"$target_vendor" in
92
    i386-apple) platform=efi ;;
93
    i386-*) platform=pc ;;
1.1.11 by Christopher James Halse Rogers
Import upstream version 1.96+20080724
94
    x86_64-apple) platform=efi ;;
95
    x86_64-*) platform=pc ;;
1.1.3 by Otavio Salvador
Import upstream version 1.94
96
    powerpc-*) platform=ieee1275 ;;
1.1.11 by Christopher James Halse Rogers
Import upstream version 1.96+20080724
97
    powerpc64-*) platform=ieee1275 ;;
1.1.3 by Otavio Salvador
Import upstream version 1.94
98
    sparc64-*) platform=ieee1275 ;;
1.25.1 by Robert Millan
Import upstream version 1.97+experimental.20091205
99
    mips-*) platform=yeeloong ;;
1.1.11 by Christopher James Halse Rogers
Import upstream version 1.96+20080724
100
    *) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;;
1.1.3 by Otavio Salvador
Import upstream version 1.94
101
  esac
102
else
103
  platform="$with_platform"
104
fi
105
1.17.12 by Colin Watson
Import upstream version 1.99~20110111
106
case "$target_cpu"-"$platform" in
107
  x86_64-efi) ;;
108
  x86_64-emu) ;;
109
  x86_64-*) target_cpu=i386 ;;
110
  powerpc64-ieee1275) target_cpu=powerpc ;;
111
esac
1.1.11 by Christopher James Halse Rogers
Import upstream version 1.96+20080724
112
113
# Check if the platform is supported, make final adjustments.
1.1.3 by Otavio Salvador
Import upstream version 1.94
114
case "$target_cpu"-"$platform" in
115
  i386-efi) ;;
1.1.11 by Christopher James Halse Rogers
Import upstream version 1.96+20080724
116
  x86_64-efi) ;;
1.1.3 by Otavio Salvador
Import upstream version 1.94
117
  i386-pc) ;;
1.15.11 by Colin Watson
Import upstream version 1.98+20100527
118
  i386-multiboot) ;;
1.1.11 by Christopher James Halse Rogers
Import upstream version 1.96+20080724
119
  i386-coreboot) ;;
120
  i386-linuxbios) platform=coreboot ;;
1.1.8 by Robert Millan
Import upstream version 1.95+20080128
121
  i386-ieee1275) ;;
17.4.9 by Robert Millan
* New SVN snapshot.
122
  i386-qemu) ;;
1.1.3 by Otavio Salvador
Import upstream version 1.94
123
  powerpc-ieee1275) ;;
124
  sparc64-ieee1275) ;;
1.25.1 by Robert Millan
Import upstream version 1.97+experimental.20091205
125
  mips-qemu-mips) ;;
126
  mips-yeeloong) ;;
1.2.11 by Felix Zielcke
Import upstream version 1.97+20091125
127
  *-emu) ;;
1.1.11 by Christopher James Halse Rogers
Import upstream version 1.96+20080724
128
  *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
129
esac
130
131
case "$target_cpu" in
132
  i386 | powerpc) target_m32=1 ;;
133
  x86_64 | sparc64) target_m64=1 ;;
1.6.1 by Felix Zielcke
Import upstream version 1.96+20090603
134
esac
135
1.1.12 by Colin Watson
Import upstream version 1.96+20090523
136
case "$host_os" in
1.2.10 by Felix Zielcke
Import upstream version 1.97+20091115
137
  mingw32*) host_os=cygwin ;;
1.1.12 by Colin Watson
Import upstream version 1.96+20090523
138
esac
139
140
# This normalizes the names, and creates a new variable ("host_kernel")
141
# while at it, since the mapping is not always 1:1 (e.g. different OSes
142
# using the same kernel type).
143
case "$host_os" in
144
  gnu*)				host_kernel=hurd ;;
145
  linux*)			host_kernel=linux ;;
1.2.10 by Felix Zielcke
Import upstream version 1.97+20091115
146
  freebsd* | kfreebsd*-gnu)	host_kernel=kfreebsd ;;
1.15.11 by Colin Watson
Import upstream version 1.98+20100527
147
  netbsd*)			host_kernel=netbsd ;;
1.1.12 by Colin Watson
Import upstream version 1.96+20090523
148
  cygwin)			host_kernel=windows ;;
149
esac
150
1.2.11 by Felix Zielcke
Import upstream version 1.97+20091125
151
case "$platform" in
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
152
  coreboot)	machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_COREBOOT=1" ;;
153
  multiboot)	machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MULTIBOOT=1" ;;
154
  efi)		machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EFI=1" ;;
155
  ieee1275)	machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_IEEE1275=1" ;;
156
  qemu)		machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_QEMU=1" ;;
157
  pc)		machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_PCBIOS=1" ;;
158
  emu)		machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EMU=1" ;;
159
  yeeloong)	machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_YEELOONG=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
160
  qemu-mips)	machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
1.15.11 by Colin Watson
Import upstream version 1.98+20100527
161
esac
162
case "$target_cpu" in
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
163
  mips)      	machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS=1" ;;
164
  sparc64)      machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_SPARC64=1" ;;
1.15.11 by Colin Watson
Import upstream version 1.98+20100527
165
esac
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
166
machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`"
1.15.11 by Colin Watson
Import upstream version 1.98+20100527
167
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
168
HOST_CPPFLAGS="$HOST_CPPFLAGS $machine_CPPFLAGS"
169
TARGET_CPPFLAGS="$TARGET_CPPFLAGS $machine_CPPFLAGS"
1.2.11 by Felix Zielcke
Import upstream version 1.97+20091125
170
1.1.12 by Colin Watson
Import upstream version 1.96+20090523
171
AC_SUBST(host_cpu)
172
AC_SUBST(host_os)
173
AC_SUBST(host_kernel)
174
1.1.3 by Otavio Salvador
Import upstream version 1.94
175
AC_SUBST(target_cpu)
176
AC_SUBST(platform)
177
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
178
# Define default variables
179
case "$host_os" in
180
  netbsd* | openbsd*)
181
        # Because /boot is used for the boot block in NetBSD and OpenBSD,
182
        bootdirname=''      ;;
183
  *)    bootdirname='boot'  ;;
184
esac
185
bootdirname=`echo "$bootdirname" | sed "$program_transform_name"`
186
AC_SUBST(bootdirname)
187
AC_DEFINE_UNQUOTED(GRUB_BOOT_DIR_NAME, "$bootdirname",
188
    [Default boot directory name]")
189
190
grubdirname=`echo "$PACKAGE" | sed "$program_transform_name"`
191
AC_SUBST(grubdirname)
192
AC_DEFINE_UNQUOTED(GRUB_DIR_NAME, "$grubdirname",
193
    [Default grub directory name])
194
1.1.3 by Otavio Salvador
Import upstream version 1.94
195
#
196
# Checks for build programs.
197
#
198
199
# Although cmp is listed in the GNU Coding Standards as a command which
200
# can used directly, OpenBSD lacks cmp in the default installation.
201
AC_CHECK_PROGS([CMP], [cmp])
202
if test "x$CMP" = x; then
203
  AC_MSG_ERROR([cmp is not found])
204
fi
205
206
AC_CHECK_PROGS([YACC], [bison])
207
if test "x$YACC" = x; then
208
  AC_MSG_ERROR([bison is not found])
209
fi
210
1.15.15 by Colin Watson
Import upstream version 1.98+20100702
211
FONT_SOURCE=
212
1.15.13 by Colin Watson
Import upstream version 1.98+20100614
213
for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
214
  for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/unifont; do
215
    if test -f "$dir/unifont.$ext"; then
1.15.15 by Colin Watson
Import upstream version 1.98+20100702
216
      FONT_SOURCE="$dir/unifont.$ext"
1.15.13 by Colin Watson
Import upstream version 1.98+20100614
217
      break 2
218
    fi
219
  done
1.1.8 by Robert Millan
Import upstream version 1.95+20080128
220
done
221
1.16.1 by Colin Watson
Import upstream version 1.98+20100705
222
if test "x$FONT_SOURCE" = x && ( test "x$platform" = xqemu || test "x$platform" = xyeeloong ); then
1.15.15 by Colin Watson
Import upstream version 1.98+20100702
223
   AC_MSG_ERROR([qemu and yeeloong ports need unifont])
224
fi
225
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
226
AC_SUBST([FONT_SOURCE])
1.15.15 by Colin Watson
Import upstream version 1.98+20100702
227
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
228
AC_PROG_RANLIB
1.1.3 by Otavio Salvador
Import upstream version 1.94
229
AC_PROG_INSTALL
230
AC_PROG_AWK
1.15.11 by Colin Watson
Import upstream version 1.98+20100527
231
AC_PROG_LEX
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
232
AC_PROG_YACC
1.1.3 by Otavio Salvador
Import upstream version 1.94
233
AC_PROG_MAKE_SET
1.20.1 by Robert Millan
Import upstream version 1.97~beta3+20091003
234
AC_PROG_MKDIR_P
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
235
AC_PROG_LN_S
1.1.3 by Otavio Salvador
Import upstream version 1.94
236
1.15.12 by Colin Watson
Import upstream version 1.98+20100602
237
if test "x$LEX" = "x:"; then
1.15.11 by Colin Watson
Import upstream version 1.98+20100527
238
  AC_MSG_ERROR([flex is not found])
239
else
240
  version=`$LEX --version | $AWK '{ split($NF,x,"."); print x[[1]]*10000+x[[2]]*100+x[[3]]; }'`
241
  if test -n "$version" -a "$version" -ge 20535; then
242
    :
243
  else
244
    AC_MSG_ERROR([flex is too old. GRUB requires 2.5.35 or above])
245
  fi
246
fi
247
1.1.10 by Mario Limonciello
Import upstream version 1.96+20080512
248
# These are not a "must".
1.17.13 by Colin Watson
Import upstream version 1.99~20110112
249
AC_PATH_PROGS(MAKEINFO, makeinfo true)
1.1.3 by Otavio Salvador
Import upstream version 1.94
250
251
#
252
# Checks for host programs.
253
#
1.1.2 by Otavio Salvador
Import upstream version 1.92
254
255
AC_PROG_CC
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
256
gl_EARLY
257
AM_PROG_CC_C_O
258
AM_PROG_AS
259
1.1.2 by Otavio Salvador
Import upstream version 1.92
260
# Must be GCC.
261
test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required])
262
1.1.4 by Robert Millan
Import upstream version 1.95
263
AC_GNU_SOURCE
1.15.5 by Robert Millan
Import upstream version 1.98~20100107
264
AM_GNU_GETTEXT([external])
1.1.3 by Otavio Salvador
Import upstream version 1.94
265
AC_SYS_LARGEFILE
266
267
# Identify characteristics of the host architecture.
268
AC_C_BIGENDIAN
269
AC_CHECK_SIZEOF(void *)
270
AC_CHECK_SIZEOF(long)
271
17.4.9 by Robert Millan
* New SVN snapshot.
272
grub_apple_cc
273
if test x$grub_cv_apple_cc = xyes ; then
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
274
  HOST_CPPFLAGS="$HOST_CPPFLAGS -DAPPLE_CC=1"
275
  HOST_CFLAGS="$HOST_CFLAGS -fnested-functions"
1.1.3 by Otavio Salvador
Import upstream version 1.94
276
fi
277
1.2.7 by Felix Zielcke
Import upstream version 1.97~beta3
278
if test "x$cross_compiling" = xyes; then
279
  AC_MSG_WARN([cannot generate manual pages while cross compiling])
280
else
281
  AC_PATH_PROG(HELP2MAN, help2man)
282
fi
283
1.17.4 by Colin Watson
Import upstream version 1.98+20100802
284
# Check for functions and headers.
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
285
AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf getextmntent)
286
AC_CHECK_HEADERS(libzfs.h libnvpair.h sys/param.h sys/mount.h sys/mnttab.h sys/mkdev.h)
287
288
AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$ac_includes_default
289
#include <sys/param.h>
290
#include <sys/mount.h>])
291
292
AC_CHECK_MEMBERS([struct statfs.f_mntfromname],,,[$ac_includes_default
293
#include <sys/param.h>
294
#include <sys/mount.h>])
1.2.10 by Felix Zielcke
Import upstream version 1.97+20091115
295
1.15.11 by Colin Watson
Import upstream version 1.98+20100527
296
# For opendisk() and getrawpartition() on NetBSD.
297
# Used in util/deviceiter.c and in util/hostdisk.c.
298
AC_CHECK_HEADER([util.h], [
299
  AC_CHECK_LIB([util], [opendisk], [
300
    LIBUTIL="-lutil"
301
    AC_DEFINE(HAVE_OPENDISK, 1, [Define if opendisk() in -lutil can be used])
302
  ])
303
  AC_CHECK_LIB([util], [getrawpartition], [
304
    LIBUTIL="-lutil"
305
    AC_DEFINE(HAVE_GETRAWPARTITION, 1, [Define if getrawpartition() in -lutil can be used])
306
  ])
307
])
308
AC_SUBST([LIBUTIL])
309
1.1.3 by Otavio Salvador
Import upstream version 1.94
310
#
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
311
# Check for host and build compilers.
312
#
313
HOST_CC=$CC
314
AC_CHECK_PROGS(BUILD_CC, [gcc egcs cc],
315
                 [AC_MSG_ERROR([none of gcc, egcs and cc is found. set BUILD_CC manually.])])
316
317
# For gnulib.
318
gl_INIT
1.1.20 by Colin Watson
Import upstream version 1.97+20091130
319
1.1.3 by Otavio Salvador
Import upstream version 1.94
320
#
321
# Check for target programs.
322
#
323
17.4.9 by Robert Millan
* New SVN snapshot.
324
# Find tools for the target.
325
if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then
1.1.3 by Otavio Salvador
Import upstream version 1.94
326
  tmp_ac_tool_prefix="$ac_tool_prefix"
327
  ac_tool_prefix=$target_alias-
328
329
  AC_CHECK_TOOLS(TARGET_CC, [gcc egcs cc],
330
                 [AC_MSG_ERROR([none of gcc, egcs and cc is found. set TARGET_CC manually.])])
331
  AC_CHECK_TOOL(OBJCOPY, objcopy)
332
  AC_CHECK_TOOL(STRIP, strip)
333
  AC_CHECK_TOOL(NM, nm)
334
335
  ac_tool_prefix="$tmp_ac_tool_prefix"
336
else
337
  if test "x$TARGET_CC" = x; then
338
    TARGET_CC=$CC
339
  fi
340
  AC_CHECK_TOOL(OBJCOPY, objcopy)
341
  AC_CHECK_TOOL(STRIP, strip)
342
  AC_CHECK_TOOL(NM, nm)
343
fi
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
344
AC_SUBST(HOST_CC)
345
AC_SUBST(BUILD_CC)
1.1.3 by Otavio Salvador
Import upstream version 1.94
346
AC_SUBST(TARGET_CC)
347
348
# Test the C compiler for the target environment.
349
tmp_CC="$CC"
350
tmp_CFLAGS="$CFLAGS"
351
tmp_LDFLAGS="$LDFLAGS"
352
tmp_CPPFLAGS="$CPPFLAGS"
353
tmp_LIBS="$LIBS"
354
CC="$TARGET_CC"
355
CFLAGS="$TARGET_CFLAGS"
356
CPPFLAGS="$TARGET_CPPFLAGS"
357
LDFLAGS="$TARGET_LDFLAGS"
358
LIBS=""
359
1.15.4 by Felix Zielcke
Import upstream version 1.98~20091229
360
# debug flags.
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
361
TARGET_CFLAGS="$TARGET_CFLAGS -Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes -Wundef -Wstrict-prototypes -g"
362
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g"
1.1.2 by Otavio Salvador
Import upstream version 1.92
363
1.15.4 by Felix Zielcke
Import upstream version 1.98~20091229
364
# Force no alignment to save space on i386.
365
if test "x$target_cpu" = xi386; then
366
  AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
367
    CFLAGS="$CFLAGS -falign-loops=1"
1.1.12 by Colin Watson
Import upstream version 1.96+20090523
368
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1.15.4 by Felix Zielcke
Import upstream version 1.98~20091229
369
        [grub_cv_cc_falign_loop=yes],
370
	[grub_cv_cc_falign_loop=no])
1.1.2 by Otavio Salvador
Import upstream version 1.92
371
  ])
1.15.4 by Felix Zielcke
Import upstream version 1.98~20091229
372
373
  if test "x$grub_cv_cc_falign_loop" = xyes; then
374
    TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
1.1.2 by Otavio Salvador
Import upstream version 1.92
375
  else
1.15.4 by Felix Zielcke
Import upstream version 1.98~20091229
376
    TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
377
  fi
378
379
  # Some toolchains enable these features by default, but they need
380
  # registers that aren't set up properly in GRUB.
381
  TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow"
382
fi
383
384
# By default, GCC 4.4 generates .eh_frame sections containing unwind
385
# information in some cases where it previously did not. GRUB doesn't need
386
# these and they just use up vital space. Restore the old compiler
387
# behaviour.
388
AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [
389
  SAVE_CFLAGS="$CFLAGS"
390
  CFLAGS="$CFLAGS -fno-dwarf2-cfi-asm"
391
  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
392
      [grub_cv_cc_fno_dwarf2_cfi_asm=yes],
393
      [grub_cv_cc_fno_dwarf2_cfi_asm=no])
394
  CFLAGS="$SAVE_CFLAGS"
395
])
396
397
if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
398
  TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
1.6.6 by Felix Zielcke
Import upstream version 1.96+20090307
399
fi
1.1.13 by Colin Watson
Import upstream version 1.96+20090611
400
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
401
if test "${target_cpu}-${platform}" = mips-yeeloong; then
402
  AC_CACHE_CHECK([whether -march=loongson2f works], [grub_cv_cc_march_loongson2f], [
403
    SAVE_CFLAGS="$CFLAGS"
404
    CFLAGS="$CFLAGS -march=loongson2f"
405
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
406
        [grub_cv_cc_march_loongson2f=yes],
407
        [grub_cv_cc_march_loongson2f=no])
408
    CFLAGS="$SAVE_CFLAGS"
409
  ])
410
411
  if test "x$grub_cv_cc_march_loongson2f" = xyes; then
412
    TARGET_CFLAGS="$TARGET_CFLAGS -march=loongson2f"
413
  else
414
    TARGET_CFLAGS="$TARGET_CFLAGS -march=mips3"
415
  fi
416
fi
417
17.4.9 by Robert Millan
* New SVN snapshot.
418
grub_apple_target_cc
419
if test x$grub_cv_apple_target_cc = xyes ; then
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
420
  TARGET_CPPFLAGS="$TARGET_CPPFLAGS -DAPPLE_CC=1"
421
  TARGET_CFLAGS="$TARGET_CFLAGS -fnested-functions"
422
17.4.9 by Robert Millan
* New SVN snapshot.
423
  CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions"
424
  TARGET_APPLE_CC=1
425
  AC_CHECK_PROG([OBJCONV], [objconv], [objconv], [])
426
  if test "x$OBJCONV" = x ; then
427
     AC_CHECK_PROG([OBJCONV], [objconv], [./objconv], [], [.])
428
  fi
429
  if test "x$OBJCONV" = x ; then
430
    AC_MSG_ERROR([objconv not found which is required when building with apple compiler])
431
  fi
432
  TARGET_IMG_LDSCRIPT=
433
  TARGET_IMG_CFLAGS="-static"
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
434
  TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20'
435
  TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20'
436
  TARGET_IMG_BASE_LDOPT="-Wl,-image_base"
17.4.9 by Robert Millan
* New SVN snapshot.
437
else
438
  TARGET_APPLE_CC=0
439
# Use linker script if present, otherwise use builtin -N script.
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
440
if test -f "${srcdir}/${grub_coredir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"; then
441
  TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/${grub_coredir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"
442
  TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT}"
443
  TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/${grub_coredir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"
444
  TARGET_IMG_BASE_LDOPT="-Wl,-Ttext"
17.4.9 by Robert Millan
* New SVN snapshot.
445
else
446
  TARGET_IMG_LDSCRIPT=
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
447
  TARGET_IMG_LDFLAGS='-Wl,-N'
448
  TARGET_IMG_LDFLAGS_AC='-Wl,-N'
449
  TARGET_IMG_BASE_LDOPT="-Wl,-Ttext"
17.4.9 by Robert Millan
* New SVN snapshot.
450
fi
451
TARGET_IMG_CFLAGS=
452
fi
453
454
# For platforms where ELF is not the default link format.
455
AC_MSG_CHECKING([for command to convert module to ELF format])
456
case "${host_os}" in
1.17.14 by Colin Watson
Import upstream version 1.99~rc1
457
  cygwin) TARGET_OBJ2ELF='$(top_builddir)/grub-pe2elf';
1.15.11 by Colin Watson
Import upstream version 1.98+20100527
458
# FIXME: put proper test here
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
459
  NEED_REGISTER_FRAME_INFO=1
1.15.11 by Colin Watson
Import upstream version 1.98+20100527
460
  ;;
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
461
  *) NEED_REGISTER_FRAME_INFO=0 ;;
17.4.9 by Robert Millan
* New SVN snapshot.
462
esac
463
AC_MSG_RESULT([$TARGET_OBJ2ELF])
464
1.1.3 by Otavio Salvador
Import upstream version 1.94
465
if test "x$target_m32" = x1; then
466
  # Force 32-bit mode.
467
  TARGET_CFLAGS="$TARGET_CFLAGS -m32"
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
468
  TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m32"
1.1.3 by Otavio Salvador
Import upstream version 1.94
469
  TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
17.4.9 by Robert Millan
* New SVN snapshot.
470
  TARGET_MODULE_FORMAT="elf32"
1.2.1 by Robert Millan
Import upstream version 1.96+20090702
471
fi
472
1.1.11 by Christopher James Halse Rogers
Import upstream version 1.96+20080724
473
if test "x$target_m64" = x1; then
474
  # Force 64-bit mode.
475
  TARGET_CFLAGS="$TARGET_CFLAGS -m64"
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
476
  TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m64"
1.1.11 by Christopher James Halse Rogers
Import upstream version 1.96+20080724
477
  TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
17.4.9 by Robert Millan
* New SVN snapshot.
478
  TARGET_MODULE_FORMAT="elf64"
1.1.11 by Christopher James Halse Rogers
Import upstream version 1.96+20080724
479
fi
480
1.1.12 by Colin Watson
Import upstream version 1.96+20090523
481
if test "$target_cpu"-"$platform" = x86_64-efi; then
482
  # Use large model to support 4G memory
483
  AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [
17.4.9 by Robert Millan
* New SVN snapshot.
484
    SAVED_CFLAGS=$CFLAGS
485
    CFLAGS="$CFLAGS -m64 -mcmodel=large"
1.1.12 by Colin Watson
Import upstream version 1.96+20090523
486
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
487
		      [grub_cv_cc_mcmodel=yes],
488
		      [grub_cv_cc_mcmodel=no])
489
  ])
17.4.9 by Robert Millan
* New SVN snapshot.
490
  if test "x$grub_cv_cc_mcmodel" = xno; then
1.15.11 by Colin Watson
Import upstream version 1.98+20100527
491
    AC_MSG_ERROR([-mcmodel=large not supported. Upgrade your gcc.])
17.4.9 by Robert Millan
* New SVN snapshot.
492
  else
493
    TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
1.1.12 by Colin Watson
Import upstream version 1.96+20090523
494
  fi
495
496
  # EFI writes to stack below %rsp, we must not use the red zone
497
  AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [
17.4.9 by Robert Millan
* New SVN snapshot.
498
    CFLAGS="$CFLAGS -m64 -mno-red-zone"
1.1.12 by Colin Watson
Import upstream version 1.96+20090523
499
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
500
		      [grub_cv_cc_no_red_zone=yes],
501
		      [grub_cv_cc_no_red_zone=no])
502
  ])
503
  if test "x$grub_cv_cc_no_red_zone" = xno; then
504
    AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc])
505
  fi
506
17.4.9 by Robert Millan
* New SVN snapshot.
507
  TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone"
1.1.12 by Colin Watson
Import upstream version 1.96+20090523
508
fi
509
1.1.5 by Albin Tonnerre
Import upstream version 1.95+20070520
510
#
511
# Compiler features.
512
#
513
1.1.12 by Colin Watson
Import upstream version 1.96+20090523
514
# Need __enable_execute_stack() for nested function trampolines?
515
grub_CHECK_ENABLE_EXECUTE_STACK
516
1.2.6 by Felix Zielcke
Import upstream version 1.97~beta2
517
# Position independent executable.
518
grub_CHECK_PIE
519
[# Need that, because some distributions ship compilers that include
520
# `-fPIE' in the default specs.
521
if [ x"$pie_possible" = xyes ]; then
522
  TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE"
523
fi]
524
1.1.5 by Albin Tonnerre
Import upstream version 1.95+20070520
525
# Smashing stack protector.
526
grub_CHECK_STACK_PROTECTOR
1.1.10 by Mario Limonciello
Import upstream version 1.96+20080512
527
# Need that, because some distributions ship compilers that include
1.1.5 by Albin Tonnerre
Import upstream version 1.95+20070520
528
# `-fstack-protector' in the default specs.
1.1.10 by Mario Limonciello
Import upstream version 1.96+20080512
529
if test "x$ssp_possible" = xyes; then
530
  TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector"
531
fi
1.1.12 by Colin Watson
Import upstream version 1.96+20090523
532
grub_CHECK_STACK_ARG_PROBE
533
# Cygwin's GCC uses alloca() to probe the stackframe on static
534
# stack allocations above some threshold.
535
if test x"$sap_possible" = xyes; then
536
  TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe"
537
fi
1.1.5 by Albin Tonnerre
Import upstream version 1.95+20070520
538
1.20.1 by Robert Millan
Import upstream version 1.97~beta3+20091003
539
AC_ARG_ENABLE([werror],
540
	      [AS_HELP_STRING([--disable-werror],
541
                             [do not use -Werror when building GRUB])])
542
if test x"$enable_werror" != xno ; then
543
  TARGET_CFLAGS="$TARGET_CFLAGS -Werror"
544
fi
545
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
546
TARGET_CPP="$TARGET_CC -E"
547
TARGET_CCAS=$TARGET_CC
548
17.4.9 by Robert Millan
* New SVN snapshot.
549
AC_SUBST(OBJCONV)
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
550
AC_SUBST(TARGET_CPP)
551
AC_SUBST(TARGET_CCAS)
552
AC_SUBST(TARGET_OBJ2ELF)
17.4.9 by Robert Millan
* New SVN snapshot.
553
AC_SUBST(TARGET_APPLE_CC)
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
554
AC_SUBST(TARGET_MODULE_FORMAT)
555
556
AC_SUBST(TARGET_CFLAGS)
557
AC_SUBST(TARGET_LDFLAGS)
1.1.3 by Otavio Salvador
Import upstream version 1.94
558
AC_SUBST(TARGET_CPPFLAGS)
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
559
AC_SUBST(TARGET_CCASFLAGS)
560
561
AC_SUBST(TARGET_IMG_LDSCRIPT)
562
AC_SUBST(TARGET_IMG_LDFLAGS)
563
AC_SUBST(TARGET_IMG_CFLAGS)
564
AC_SUBST(TARGET_IMG_BASE_LDOPT)
565
566
AC_SUBST(HOST_CFLAGS)
567
AC_SUBST(HOST_LDFLAGS)
568
AC_SUBST(HOST_CPPFLAGS)
569
AC_SUBST(HOST_CCASFLAGS)
17.4.18 by Felix Zielcke, Robert Millan, Felix Zielcke, Updated translations
[ Robert Millan ]
570
1.1.3 by Otavio Salvador
Import upstream version 1.94
571
# Set them to their new values for the tests below.
572
CC="$TARGET_CC"
17.4.9 by Robert Millan
* New SVN snapshot.
573
if test "x$TARGET_APPLE_CC" = x1 ; then
1.15.8 by Felix Zielcke
Import upstream version 1.98~20100126
574
CFLAGS="$TARGET_CFLAGS -nostdlib -Wno-error"
575
else
1.15.11 by Colin Watson
Import upstream version 1.98+20100527
576
CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100 -Wno-error"
1.15.8 by Felix Zielcke
Import upstream version 1.98~20100126
577
fi
578
CPPFLAGS="$TARGET_CPPFLAGS"
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
579
if test x$target_cpu = xi386 || test x$target_cpu = xx86_64 ; then
580
LIBS=
581
else
1.15.8 by Felix Zielcke
Import upstream version 1.98~20100126
582
LIBS=-lgcc
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
583
fi
1.15.8 by Felix Zielcke
Import upstream version 1.98~20100126
584
1.15.11 by Colin Watson
Import upstream version 1.98+20100527
585
grub_ASM_USCORE
586
if test x$grub_cv_asm_uscore = xyes; then
587
CFLAGS="$CFLAGS -Wl,--defsym,_abort=_main"
588
else
589
CFLAGS="$CFLAGS -Wl,--defsym,abort=main"
590
fi
591
1.15.8 by Felix Zielcke
Import upstream version 1.98~20100126
592
# Check for libgcc symbols
593
AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __trampoline_setup __ucmpdi2 _restgpr_14_x)
594
595
if test "x$TARGET_APPLE_CC" = x1 ; then
17.4.9 by Robert Millan
* New SVN snapshot.
596
CFLAGS="$TARGET_CFLAGS -nostdlib"
597
else
598
CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100"
599
fi
1.15.8 by Felix Zielcke
Import upstream version 1.98~20100126
600
LIBS=""
1.1.2 by Otavio Salvador
Import upstream version 1.92
601
602
# Defined in aclocal.m4.
1.1.11 by Christopher James Halse Rogers
Import upstream version 1.96+20080724
603
grub_PROG_TARGET_CC
17.4.9 by Robert Millan
* New SVN snapshot.
604
if test "x$TARGET_APPLE_CC" != x1 ; then
1.1.3 by Otavio Salvador
Import upstream version 1.94
605
grub_PROG_OBJCOPY_ABSOLUTE
17.4.9 by Robert Millan
* New SVN snapshot.
606
fi
1.1.11 by Christopher James Halse Rogers
Import upstream version 1.96+20080724
607
grub_PROG_LD_BUILD_ID_NONE
1.1.3 by Otavio Salvador
Import upstream version 1.94
608
if test "x$target_cpu" = xi386; then
1.15.11 by Colin Watson
Import upstream version 1.98+20100527
609
  if test "$platform" != emu && test "x$TARGET_APPLE_CC" != x1 ; then
610
    if test ! -z "$TARGET_IMG_LDSCRIPT"; then
611
      # Check symbols provided by linker script.
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
612
      CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC} ${TARGET_IMG_BASE_LDOPT},8000 -Wl,--defsym,___main=0x8100"
1.15.11 by Colin Watson
Import upstream version 1.98+20100527
613
    fi
1.1.12 by Colin Watson
Import upstream version 1.96+20090523
614
    grub_CHECK_BSS_START_SYMBOL
615
    grub_CHECK_END_SYMBOL
616
  fi
617
  CFLAGS="$TARGET_CFLAGS"
1.1.2 by Otavio Salvador
Import upstream version 1.92
618
  grub_I386_ASM_PREFIX_REQUIREMENT
619
  grub_I386_ASM_ADDR32
620
fi
621
17.4.10 by Felix Zielcke
Add back Conflicts/Replaces grub.
622
AC_ARG_ENABLE([efiemu],
623
	      [AS_HELP_STRING([--enable-efiemu],
624
                             [build and install the efiemu runtimes (default=guessed)])])
625
if test x"$enable_efiemu" = xno ; then
626
  efiemu_excuse="explicitly disabled"
627
fi
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
628
if test x"$target_cpu" != xi386 ; then
629
  efiemu_excuse="only available on i386"
630
fi
631
if test x"$platform" = xefi ; then
632
  efiemu_excuse="not available on efi"
633
fi
17.4.10 by Felix Zielcke
Add back Conflicts/Replaces grub.
634
if test x"$efiemu_excuse" = x ; then
635
  AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [
636
    CFLAGS="$CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib"
637
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
638
		      [grub_cv_cc_efiemu=yes],
639
		      [grub_cv_cc_efiemu=no])
640
  ])
641
  if test x$grub_cv_cc_efiemu = xno; then
642
     efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
643
  fi
644
fi
645
if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
646
  AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled])
647
fi
648
if test x"$efiemu_excuse" = x ; then
649
enable_efiemu=yes
650
else
651
enable_efiemu=no
652
fi
653
AC_SUBST([enable_efiemu])
654
1.15.11 by Colin Watson
Import upstream version 1.98+20100527
655
if test "$platform" != emu; then
1.15.10 by Colin Watson
Import upstream version 1.98
656
AC_CACHE_CHECK([whether -nostdinc -isystem works], [grub_cv_cc_isystem], [
657
  SAVED_CPPFLAGS="$CPPFLAGS"
658
  CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
659
  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
660
int va_arg_func (int fixed, va_list args);]], [[]])],
661
      [grub_cv_cc_isystem=yes],
662
      [grub_cv_cc_isystem=no])
663
  CPPFLAGS="$SAVED_CPPFLAGS"
664
])
665
666
if test x"$grub_cv_cc_isystem" = xyes ; then
667
  TARGET_CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
668
fi
1.15.11 by Colin Watson
Import upstream version 1.98+20100527
669
fi
17.4.10 by Felix Zielcke
Add back Conflicts/Replaces grub.
670
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
671
AC_CACHE_CHECK([whether -Wno-trampolines work], [grub_cv_cc_wnotrampolines], [
672
  SAVED_CFLAGS="$CFLAGS"
673
  # Test for -Wtrampolines rather than -Wno-trampolines to reduce confusion
674
  # in the event of later failures (since -Wno-* is always accepted, but
675
  # produces a diagnostic if something else is wrong).
676
  CFLAGS="$TARGET_CFLAGS -Wtrampolines"
677
  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
678
int va_arg_func (int fixed, va_list args);]], [[]])],
679
      [grub_cv_cc_wnotrampolines=yes],
680
      [grub_cv_cc_wnotrampolines=no])
681
  CFLAGS="$SAVED_CFLAGS"
682
])
683
684
if test x"$grub_cv_cc_wnotrampolines" = xyes ; then
685
  TARGET_CFLAGS="$TARGET_CFLAGS -Wno-trampolines"
686
fi
17.4.10 by Felix Zielcke
Add back Conflicts/Replaces grub.
687
1.1.3 by Otavio Salvador
Import upstream version 1.94
688
# Restore the flags.
1.1.2 by Otavio Salvador
Import upstream version 1.92
689
CC="$tmp_CC"
690
CFLAGS="$tmp_CFLAGS"
691
CPPFLAGS="$tmp_CPPFLAGS"
1.1.3 by Otavio Salvador
Import upstream version 1.94
692
LDFLAGS="$tmp_LDFLAGS"
693
LIBS="$tmp_LIBS"
694
1.1.5 by Albin Tonnerre
Import upstream version 1.95+20070520
695
#
1.1.3 by Otavio Salvador
Import upstream version 1.94
696
# Check for options.
1.1.5 by Albin Tonnerre
Import upstream version 1.95+20070520
697
#
698
699
# Memory manager debugging.
17.4.9 by Robert Millan
* New SVN snapshot.
700
AC_ARG_ENABLE([mm-debug],
1.1.3 by Otavio Salvador
Import upstream version 1.94
701
	      AS_HELP_STRING([--enable-mm-debug],
1.1.4 by Robert Millan
Import upstream version 1.95
702
                             [include memory manager debugging]),
1.1.3 by Otavio Salvador
Import upstream version 1.94
703
              [AC_DEFINE([MM_DEBUG], [1],
704
                         [Define to 1 if you enable memory manager debugging.])])
1.1.2 by Otavio Salvador
Import upstream version 1.92
705
1.1.12 by Colin Watson
Import upstream version 1.96+20090523
706
AC_ARG_ENABLE([grub-emu-usb],
707
	      [AS_HELP_STRING([--enable-grub-emu-usb],
17.4.10 by Felix Zielcke
Add back Conflicts/Replaces grub.
708
                             [build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
709
1.24.1 by Robert Millan
Import upstream version 1.97+experimental.20091127
710
AC_ARG_ENABLE([grub-emu-sdl],
711
	      [AS_HELP_STRING([--enable-grub-emu-sdl],
712
                             [build and install the `grub-emu' debugging utility with SDL support (default=guessed)])])
713
1.25.1 by Robert Millan
Import upstream version 1.97+experimental.20091205
714
AC_ARG_ENABLE([grub-emu-pci],
715
	      [AS_HELP_STRING([--enable-grub-emu-pci],
716
                             [build and install the `grub-emu' debugging utility with PCI support (potentially dangerous) (default=no)])])
717
1.2.11 by Felix Zielcke
Import upstream version 1.97+20091125
718
if test "$platform" = emu; then
719
  missing_ncurses=
720
[# Check for curses libraries.]
1.1.5 by Albin Tonnerre
Import upstream version 1.95+20070520
721
  AC_CHECK_LIB([ncurses], [wgetch], [LIBCURSES="-lncurses"],
722
    [AC_CHECK_LIB([curses], [wgetch], [LIBCURSES="-lcurses"],
1.2.11 by Felix Zielcke
Import upstream version 1.97+20091125
723
      [missing_ncurses=[true]])])
1.1.5 by Albin Tonnerre
Import upstream version 1.95+20070520
724
  AC_SUBST([LIBCURSES])
1.2.11 by Felix Zielcke
Import upstream version 1.97+20091125
725
[if [ x"$missing_ncurses" = x ]; then ]
1.1.5 by Albin Tonnerre
Import upstream version 1.95+20070520
726
  [# Check for headers.]
727
  AC_CHECK_HEADERS([ncurses/curses.h], [],
728
    [AC_CHECK_HEADERS([ncurses.h], [],
729
      [AC_CHECK_HEADERS([curses.h], [],
1.2.11 by Felix Zielcke
Import upstream version 1.97+20091125
730
	[missing_ncurses=[true]])])])
17.4.10 by Felix Zielcke
Add back Conflicts/Replaces grub.
731
[fi]
1.2.11 by Felix Zielcke
Import upstream version 1.97+20091125
732
if test x"$missing_ncurses" = xtrue ; then
733
  AC_MSG_ERROR([grub-emu can't be compiled without ncurses])
734
fi
1.1.12 by Colin Watson
Import upstream version 1.96+20090523
735
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
736
if test x"$enable_grub_emu_usb" != xyes ; then
737
   grub_emu_usb_excuse="not enabled"
17.4.10 by Felix Zielcke
Add back Conflicts/Replaces grub.
738
fi
1.25.1 by Robert Millan
Import upstream version 1.97+experimental.20091205
739
740
if test x"$enable_grub_emu_pci" = xyes ; then
741
   grub_emu_usb_excuse="conflicts with PCI support"
742
fi
743
17.4.10 by Felix Zielcke
Add back Conflicts/Replaces grub.
744
[if [ x"$grub_emu_usb_excuse" = x ]; then
1.1.12 by Colin Watson
Import upstream version 1.96+20090523
745
    # Check for libusb libraries.]
17.4.10 by Felix Zielcke
Add back Conflicts/Replaces grub.
746
AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"],
747
    [grub_emu_usb_excuse=["need libusb library"]])
1.1.12 by Colin Watson
Import upstream version 1.96+20090523
748
    AC_SUBST([LIBUSB])
17.4.10 by Felix Zielcke
Add back Conflicts/Replaces grub.
749
[fi]
750
[if [ x"$grub_emu_usb_excuse" = x ]; then
751
    # Check for headers.]
1.1.12 by Colin Watson
Import upstream version 1.96+20090523
752
    AC_CHECK_HEADERS([usb.h], [],
17.4.10 by Felix Zielcke
Add back Conflicts/Replaces grub.
753
      [grub_emu_usb_excuse=["need libusb headers"]])
1.1.5 by Albin Tonnerre
Import upstream version 1.95+20070520
754
[fi]
17.4.18 by Felix Zielcke, Robert Millan, Felix Zielcke, Updated translations
[ Robert Millan ]
755
if test x"$enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then
17.4.10 by Felix Zielcke
Add back Conflicts/Replaces grub.
756
  AC_MSG_ERROR([USB support for grub-emu was explicitly requested but can't be compiled])
757
fi
758
if test x"$grub_emu_usb_excuse" = x ; then
759
enable_grub_emu_usb=yes
760
else
761
enable_grub_emu_usb=no
762
fi
1.24.1 by Robert Millan
Import upstream version 1.97+experimental.20091127
763
764
if test x"$enable_grub_emu_sdl" = xno ; then
765
  grub_emu_sdl_excuse="explicitely disabled"
766
fi
767
[if [ x"$grub_emu_sdl_excuse" = x ]; then
768
    # Check for libSDL libraries.]
769
AC_CHECK_LIB([SDL], [SDL_Init], [LIBSDL="-lSDL"],
770
    [grub_emu_sdl_excuse=["libSDL libraries are required to build \`grub-emu' with SDL support"]])
771
    AC_SUBST([LIBSDL])
772
[fi]
1.25.1 by Robert Millan
Import upstream version 1.97+experimental.20091205
773
1.26.2 by Felix Zielcke
Import upstream version 1.98~experimental.20091229
774
[if [ x"$grub_emu_sdl_excuse" = x ]; then
775
    # Check for headers.]
776
    AC_CHECK_HEADERS([SDL/SDL.h], [],
777
      [grub_emu_sdl_excuse=["libSDL header file is required to build \`grub-emu' with SDL support"]])
778
[fi]
779
780
if test x"enable_grub_emu_sdl" = xyes && test x"$grub_emu_sdl_excuse" != x ; then
781
  AC_MSG_ERROR([SDL support for grub-emu was explicitely requested but can't be compiled])
782
fi
783
if test x"$grub_emu_sdl_excuse" = x ; then
784
enable_grub_emu_sdl=yes
785
else
786
enable_grub_emu_sdl=no
787
fi
788
1.25.1 by Robert Millan
Import upstream version 1.97+experimental.20091205
789
if test x"$enable_grub_emu_pci" != xyes ; then
790
   grub_emu_pci_excuse="not enabled"
791
fi
792
793
if test x"$enable_grub_emu_usb" = xyes ; then
794
   grub_emu_pci_excuse="conflicts with USB support"
795
fi
796
797
[if [ x"$grub_emu_pci_excuse" = x ]; then
798
      # Check for libpci libraries.]
799
   AC_CHECK_LIB([pciaccess], [pci_system_init], [LIBPCIACCESS="-lpciaccess"],
800
      [grub_emu_pci_excuse=["need libpciaccess library"]])
801
    AC_SUBST([LIBPCIACCESS])
802
[fi]
803
[if [ x"$grub_emu_pci_excuse" = x ]; then
804
    # Check for headers.]
805
    AC_CHECK_HEADERS([pci/pci.h], [],
806
      [grub_emu_pci_excuse=["need libpciaccess headers"]])
807
[fi]
808
809
if test x"$grub_emu_pci_excuse" = x ; then
810
enable_grub_emu_pci=yes
811
else
1.26.2 by Felix Zielcke
Import upstream version 1.98~experimental.20091229
812
1.25.1 by Robert Millan
Import upstream version 1.97+experimental.20091205
813
enable_grub_emu_pci=no
814
fi
815
1.24.1 by Robert Millan
Import upstream version 1.97+experimental.20091127
816
AC_SUBST([enable_grub_emu_sdl])
1.1.12 by Colin Watson
Import upstream version 1.96+20090523
817
AC_SUBST([enable_grub_emu_usb])
1.25.1 by Robert Millan
Import upstream version 1.97+experimental.20091205
818
AC_SUBST([enable_grub_emu_pci])
1.2.11 by Felix Zielcke
Import upstream version 1.97+20091125
819
fi
1.6.1 by Felix Zielcke
Import upstream version 1.96+20090603
820
1.1.12 by Colin Watson
Import upstream version 1.96+20090523
821
AC_ARG_ENABLE([grub-mkfont],
822
	      [AS_HELP_STRING([--enable-grub-mkfont],
17.4.10 by Felix Zielcke
Add back Conflicts/Replaces grub.
823
                             [build and install the `grub-mkfont' utility (default=guessed)])])
824
if test x"$enable_grub_mkfont" = xno ; then
825
  grub_mkfont_excuse="explicitly disabled"
826
fi
827
828
if test x"$grub_mkfont_excuse" = x ; then
1.1.12 by Colin Watson
Import upstream version 1.96+20090523
829
  # Check for freetype libraries.
830
  AC_CHECK_PROGS([FREETYPE], [freetype-config])
831
  if test "x$FREETYPE" = x ; then
17.4.10 by Felix Zielcke
Add back Conflicts/Replaces grub.
832
    grub_mkfont_excuse=["need freetype2 library"]
1.1.12 by Colin Watson
Import upstream version 1.96+20090523
833
  fi
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
834
fi
835
836
if test x"$grub_mkfont_excuse" = x ; then
837
  # Check for freetype libraries.
1.1.12 by Colin Watson
Import upstream version 1.96+20090523
838
  freetype_cflags=`freetype-config --cflags`
839
  freetype_libs=`freetype-config --libs`
1.15.10 by Colin Watson
Import upstream version 1.98
840
  SAVED_CPPFLAGS="$CPPFLAGS"
841
  CPPFLAGS="$CPPFLAGS $freetype_cflags"
842
  AC_CHECK_HEADERS([ft2build.h], [],
843
  	[grub_mkfont_excuse=["need freetype2 headers"]])
844
  CPPFLAGS="$SAVED_CPPFLAGS"
845
fi
846
17.4.10 by Felix Zielcke
Add back Conflicts/Replaces grub.
847
if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
848
  AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled])
849
fi
850
if test x"$grub_mkfont_excuse" = x ; then
851
enable_grub_mkfont=yes
852
else
853
enable_grub_mkfont=no
854
fi
1.1.12 by Colin Watson
Import upstream version 1.96+20090523
855
AC_SUBST([enable_grub_mkfont])
856
AC_SUBST([freetype_cflags])
857
AC_SUBST([freetype_libs])
858
1.15.11 by Colin Watson
Import upstream version 1.98+20100527
859
AC_ARG_ENABLE([device-mapper],
860
              [AS_HELP_STRING([--enable-device-mapper],
861
                              [enable Linux device-mapper support (default=guessed)])])
862
if test x"$enable_device_mapper" = xno ; then
863
  device_mapper_excuse="explicitly disabled"
864
fi
865
866
if test x"$device_mapper_excuse" = x ; then
1.17.12 by Colin Watson
Import upstream version 1.99~20110111
867
  # Check for device-mapper header.
868
  AC_CHECK_HEADER([libdevmapper.h], [],
869
               [device_mapper_excuse="need libdevmapper header"])
870
fi
871
872
if test x"$device_mapper_excuse" = x ; then
1.15.11 by Colin Watson
Import upstream version 1.98+20100527
873
  # Check for device-mapper library.
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
874
  AC_CHECK_LIB([devmapper], [dm_task_create], [],
875
               [device_mapper_excuse="need devmapper library"])
876
fi
877
878
if test x"$device_mapper_excuse" = x ; then
879
  # Check for device-mapper library.
880
  AC_CHECK_LIB([devmapper], [dm_log_with_errno_init],
881
               [],
882
               [device_mapper_excuse="need devmapper library"])
883
fi
884
885
if test x"$device_mapper_excuse" = x ; then
886
   LIBDEVMAPPER="-ldevmapper";
887
   AC_DEFINE([HAVE_DEVICE_MAPPER], [1],
888
             [Define to 1 if you have the devmapper library.])
889
fi
890
891
AC_SUBST([LIBDEVMAPPER])
892
1.17.15 by Colin Watson
Import upstream version 1.99
893
LIBGEOM=
894
if test x$host_kernel = xkfreebsd; then
895
  AC_CHECK_LIB([geom], [geom_gettree], [],
896
               [AC_MSG_ERROR([Your platform requires libgeom])])
897
  LIBGEOM="-lgeom"
898
fi
899
900
AC_SUBST([LIBGEOM])
901
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
902
AC_CHECK_LIB([lzma], [lzma_code],
903
             [LIBLZMA="-llzma"
904
              AC_DEFINE([HAVE_LIBLZMA], [1],
905
                        [Define to 1 if you have the LZMA library.])],)
906
AC_SUBST([LIBLZMA])
1.15.11 by Colin Watson
Import upstream version 1.98+20100527
907
1.17.4 by Colin Watson
Import upstream version 1.98+20100802
908
AC_CHECK_LIB([zfs], [libzfs_init],
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
909
             [LIBZFS="-lzfs"
1.17.4 by Colin Watson
Import upstream version 1.98+20100802
910
              AC_DEFINE([HAVE_LIBZFS], [1],
911
                        [Define to 1 if you have the ZFS library.])],)
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
912
AC_SUBST([LIBZFS])
913
1.17.4 by Colin Watson
Import upstream version 1.98+20100802
914
AC_CHECK_LIB([nvpair], [nvlist_print],
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
915
             [LIBNVPAIR="-lnvpair"
1.17.4 by Colin Watson
Import upstream version 1.98+20100802
916
              AC_DEFINE([HAVE_LIBNVPAIR], [1],
917
                        [Define to 1 if you have the NVPAIR library.])],)
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
918
AC_SUBST([LIBNVPAIR])
919
920
LIBS=""
921
922
pkglibrootdir='$(libdir)'/`echo $PACKAGE | sed "$program_transform_name"`
923
AC_SUBST(pkglibrootdir)
924
925
AC_SUBST([FONT_SOURCE])
926
AS_IF([test x$target_cpu = xi386 -a x$platform = xqemu],
927
	    [AC_SUBST([GRUB_BOOT_MACHINE_LINK_ADDR], 0xffe00)])
928
AS_IF([test x$TARGET_APPLE_CC = x1],
929
	    [AC_SUBST([USE_APPLE_CC_FIXES], yes)])
930
931
AC_SUBST(HAVE_ASM_USCORE)
932
AC_SUBST(ADDR32)
933
AC_SUBST(DATA32)
934
AC_SUBST(BSS_START_SYMBOL)
935
AC_SUBST(END_SYMBOL)
936
AC_SUBST(PACKAGE)
937
AC_SUBST(VERSION)
938
AC_SUBST(NEED_ENABLE_EXECUTE_STACK)
939
AC_SUBST(NEED_REGISTER_FRAME_INFO)
940
941
#
942
# Automake conditionals
943
#
944
945
AM_CONDITIONAL([COND_emu], [test x$platform = xemu])
946
AM_CONDITIONAL([COND_i386_pc], [test x$target_cpu = xi386 -a x$platform = xpc])
947
AM_CONDITIONAL([COND_i386_efi], [test x$target_cpu = xi386 -a x$platform = xefi])
948
AM_CONDITIONAL([COND_i386_qemu], [test x$target_cpu = xi386 -a x$platform = xqemu])
949
AM_CONDITIONAL([COND_i386_ieee1275], [test x$target_cpu = xi386 -a x$platform = xieee1275])
950
AM_CONDITIONAL([COND_i386_coreboot], [test x$target_cpu = xi386 -a x$platform = xcoreboot])
951
AM_CONDITIONAL([COND_i386_multiboot], [test x$target_cpu = xi386 -a x$platform = xmultiboot])
952
AM_CONDITIONAL([COND_x86_64_efi], [test x$target_cpu = xx86_64 -a x$platform = xefi])
953
AM_CONDITIONAL([COND_mips_yeeloong], [test x$target_cpu = xmips -a x$platform = xyeeloong])
954
AM_CONDITIONAL([COND_mips_qemu_mips], [test x$target_cpu = xmips -a x$platform = xqemu_mips])
955
AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275])
956
AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275])
957
AM_CONDITIONAL([COND_mips], [test x$target_cpu = xmips])
958
959
AM_CONDITIONAL([COND_HOST_HURD], [test x$host_kernel = xhurd])
960
AM_CONDITIONAL([COND_HOST_LINUX], [test x$host_kernel = xlinux])
961
AM_CONDITIONAL([COND_HOST_NETBSD], [test x$host_kernel = xnetbsd])
962
AM_CONDITIONAL([COND_HOST_WINDOWS], [test x$host_kernel = xwindows])
963
AM_CONDITIONAL([COND_HOST_KFREEBSD], [test x$host_kernel = xkfreebsd])
964
965
AM_CONDITIONAL([COND_MAN_PAGES], [test x$cross_compiling = xno -a x$HELP2MAN != x])
966
AM_CONDITIONAL([COND_GRUB_EMU_USB], [test x$enable_grub_emu_usb = xyes])
967
AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes])
968
AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes])
969
AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes])
970
AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x])
971
AM_CONDITIONAL([COND_GRUB_PE2ELF], [test x$TARGET_OBJ2ELF != x])
972
AM_CONDITIONAL([COND_APPLE_CC], [test x$TARGET_APPLE_CC = x1])
973
AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes])
974
975
AM_CONDITIONAL([COND_HAVE_ASM_USCORE], [test x$HAVE_ASM_USCORE = x1])
1.17.14 by Colin Watson
Import upstream version 1.99~rc1
976
AM_CONDITIONAL([COND_CYGWIN], [test x$host_os = xcygwin])
17.4.9 by Robert Millan
* New SVN snapshot.
977
1.1.2 by Otavio Salvador
Import upstream version 1.92
978
# Output files.
1.3.2 by Robert Millan
Import upstream version 1.96+20090401
979
grub_CHECK_LINK_DIR
980
if test x"$link_dir" = xyes ; then
1.2.11 by Felix Zielcke
Import upstream version 1.97+20091125
981
  AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu])
982
  if test "$platform" != emu ; then
983
    AC_CONFIG_LINKS([include/grub/machine:include/grub/$target_cpu/$platform])
984
  fi
1.3.2 by Robert Millan
Import upstream version 1.96+20090401
985
else
986
  mkdir -p include/grub 2>/dev/null
987
  rm -rf include/grub/cpu
988
  cp -rp $srcdir/include/grub/$target_cpu include/grub/cpu 2>/dev/null
1.2.11 by Felix Zielcke
Import upstream version 1.97+20091125
989
  if test "$platform" != emu ; then
990
    rm -rf include/grub/machine
991
    cp -rp $srcdir/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null
992
  fi
1.3.2 by Robert Millan
Import upstream version 1.96+20090401
993
fi
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
994
995
AC_CONFIG_FILES([Makefile])
996
AC_CONFIG_FILES([grub-core/Makefile])
997
AC_CONFIG_FILES([grub-core/gnulib/Makefile])
998
AC_CONFIG_FILES([po/Makefile.in])
999
AC_CONFIG_FILES([docs/Makefile])
1000
AC_CONFIG_FILES([util/bash-completion.d/Makefile])
1.1.2 by Otavio Salvador
Import upstream version 1.92
1001
AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
1002
AC_CONFIG_FILES([config.h])
1003
1.1.2 by Otavio Salvador
Import upstream version 1.92
1004
AC_OUTPUT
17.4.10 by Felix Zielcke
Add back Conflicts/Replaces grub.
1005
[
1006
echo "*******************************************************"
1007
echo GRUB2 will be compiled with following components:
1008
echo Platform: "$target_cpu"-"$platform"
1.2.11 by Felix Zielcke
Import upstream version 1.97+20091125
1009
if [ x"$platform" = xemu ]; then
17.4.10 by Felix Zielcke
Add back Conflicts/Replaces grub.
1010
if [ x"$grub_emu_usb_excuse" = x ]; then
1011
echo USB support for grub-emu: Yes
1012
else
1013
echo USB support for grub-emu: No "($grub_emu_usb_excuse)"
1014
fi
1.24.1 by Robert Millan
Import upstream version 1.97+experimental.20091127
1015
if [ x"$grub_emu_sdl_excuse" = x ]; then
1016
echo SDL support for grub-emu: Yes
1017
else
1018
echo SDL support for grub-emu: No "($grub_emu_sdl_excuse)"
1019
fi
1.25.1 by Robert Millan
Import upstream version 1.97+experimental.20091205
1020
if [ x"$grub_emu_pci_excuse" = x ]; then
1021
echo PCI support for grub-emu: Yes
1022
else
1023
echo PCI support for grub-emu: No "($grub_emu_pci_excuse)"
1024
fi
1.1.20 by Colin Watson
Import upstream version 1.97+20091130
1025
fi
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
1026
if test x"$device_mapper_excuse" = x ; then
1027
echo With devmapper support: Yes
1.15.11 by Colin Watson
Import upstream version 1.98+20100527
1028
else
1.26.4 by Colin Watson
Import upstream version 1.99~20101122
1029
echo With devmapper support: No "($device_mapper_excuse)"
1.2.11 by Felix Zielcke
Import upstream version 1.97+20091125
1030
fi
17.4.10 by Felix Zielcke
Add back Conflicts/Replaces grub.
1031
if [ x"$enable_mm_debug" = xyes ]; then
1032
echo With memory debugging: Yes
1033
else
1034
echo With memory debugging: No
1035
fi
1036
if [ x"$efiemu_excuse" = x ]; then
1037
echo efiemu runtime: Yes
1038
else
1039
echo efiemu runtime: No "($efiemu_excuse)"
1040
fi
1041
if [ x"$grub_mkfont_excuse" = x ]; then
1042
echo grub-mkfont: Yes
1043
else
1044
echo grub-mkfont: No "($grub_mkfont_excuse)"
1045
fi
1046
echo "*******************************************************"
1047
]