1dnl Configure script for GRUB.
2dnl Copyright 1999,2000,2001,2002,2003,2004,2005 Free Software Foundation, Inc.
3
4dnl Permission to use, copy, modify and distribute this software and its
5dnl documentation is hereby granted, provided that both the copyright
6dnl notice and this permission notice appear in all copies of the
7dnl software, derivative works or modified versions, and any portions
8dnl thereof, and that both notices appear in supporting documentation.
9dnl
10dnl THE FREE SOFTWARE FOUNDATION ALLOWS FREE USE OF THIS SOFTWARE IN ITS
11dnl "AS IS" CONDITION.  THE FREE SOFTWARE FOUNDATION DISCLAIMS ANY
12dnl LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
13dnl USE OF THIS SOFTWARE.
14
15AC_PREREQ(2.57)
16AC_INIT([GRUB], [0.97], [bug-grub@gnu.org])
17AC_CONFIG_SRCDIR([stage2/stage2.c])
18AC_CONFIG_HEADER([config.h])
19AM_INIT_AUTOMAKE
20
21AC_CANONICAL_HOST
22
23case "$host_cpu" in
24i[[3456]]86) host_cpu=i386 ;;
25x86_64) host_cpu=x86_64 ;;
26*) AC_MSG_ERROR([unsupported CPU type]) ;;
27esac
28
29AC_SUBST(host_cpu)
30AC_SUBST(host_vendor)
31
32#
33# Options
34#
35
36AM_MAINTAINER_MODE
37if test "x$enable_maintainer_mode" = xyes; then
38  AC_PATH_PROG(PERL,perl)
39  if test -z "$PERL"; then
40    AC_MSG_ERROR([perl not found])
41  fi
42fi
43
44# This should be checked before AC_PROG_CC
45if test "x$CFLAGS" = x; then
46  default_CFLAGS=yes
47fi
48
49if test "x$host_cpu" = xx86_64; then
50  CFLAGS="-m32 $CFLAGS"
51fi
52
53#
54# Programs
55#
56
57AC_CHECK_TOOL(CC, gcc)
58AC_PROG_CC
59# We need this for older versions of Autoconf.
60_AM_DEPENDENCIES(CC)
61
62dnl Because recent automake complains about AS, set it here.
63CCAS="$CC"
64AC_SUBST(CCAS)
65
66AC_ARG_WITH(binutils,
67  [  --with-binutils=DIR     search the directory DIR to find binutils])
68
69if test "x$with_binutils" != x; then
70dnl AC_PATH_TOOL is not seen in autoconf 2.13, so use AC_PATH_PROG
71dnl instead for now. It is preferable when you cross-compile GRUB.
72dnl  AC_PATH_TOOL(RANLIB, ranlib, :, "$with_binutils:$PATH")
73  AC_PATH_PROG(RANLIB, ranlib, :, "$with_binutils:$PATH")
74else
75  AC_PROG_RANLIB
76fi
77
78# optimization flags
79if test "x$ac_cv_prog_gcc" = xyes; then
80  if test "x$default_CFLAGS" = xyes; then
81    # Autoconf may set CFLAGS to -O2 and/or -g. So eliminate them.
82    CFLAGS="`echo $CFLAGS | sed -e 's/-g//g' -e 's/-O[[0-9]]//g'` -g"
83    # If the user specify the directory for binutils, add the option `-B'.
84    if test "x$with_binutils" != x; then
85      CFLAGS="-B$with_binutils/ $CFLAGS"
86    fi
87    STAGE1_CFLAGS="-O2"
88    GRUB_CFLAGS="-O2"
89    AC_CACHE_CHECK([whether optimization for size works], size_flag, [
90      saved_CFLAGS=$CFLAGS
91      CFLAGS="-Os -g"
92      AC_TRY_COMPILE(, , size_flag=yes, size_flag=no)
93      CFLAGS=$saved_CFLAGS
94    ])
95    if test "x$size_flag" = xyes; then
96      STAGE2_CFLAGS="-Os"
97    else
98      STAGE2_CFLAGS="-O2 -fno-strength-reduce -fno-unroll-loops"
99    fi
100    # OpenBSD has a GCC extension for protecting applications from
101    # stack smashing attacks, but GRUB doesn't want this feature.
102    AC_CACHE_CHECK([whether gcc has -fno-stack-protector],
103		   no_stack_protector_flag, [
104      saved_CFLAGS=$CFLAGS
105      CFLAGS="-fno-stack-protector"
106      AC_TRY_COMPILE(,
107		     ,
108		     no_stack_protector_flag=yes,
109		     no_stack_protector_flag=no)
110      CFLAGS=$saved_CFLAGS
111    ])
112    if test "x$no_stack_protector_flag" = xyes; then
113      STAGE2_CFLAGS="$STAGE2_CFLAGS -fno-stack-protector"
114    fi
115  fi
116fi
117
118AC_SUBST(STAGE1_CFLAGS)
119AC_SUBST(STAGE2_CFLAGS)
120AC_SUBST(GRUB_CFLAGS)
121
122# Enforce coding standards.
123CPPFLAGS="$CPPFLAGS -Wall -Wmissing-prototypes -Wunused -Wshadow"
124CPPFLAGS="$CPPFLAGS -Wpointer-arith"
125
126AC_CACHE_CHECK([whether -Wundef works], undef_flag, [
127  saved_CPPFLAGS="$CPPFLAGS"
128  CPPFLAGS="-Wundef"
129  AC_TRY_COMPILE(, , undef_flag=yes, undef_flag=no)
130  CPPFLAGS="$saved_CPPFLAGS"
131])
132
133# The options `-falign-*' are supported by gcc 3.0 or later.
134# Probably it is sufficient to only check for -falign-loops.
135AC_CACHE_CHECK([whether -falign-loops works], [falign_loop_flag], [
136  saved_CPPFLAGS="$CPPFLAGS"
137  CPPFLAGS="-falign-loops=1"
138  AC_TRY_COMPILE(, , [falign_loop_flag=yes], [falign_loop_flag=no])
139  CPPFLAGS="$saved_CPPFLAGS"
140])
141
142# Force no alignment to save space.
143if test "x$falign_loop_flag" = xyes; then
144  CPPFLAGS="$CPPFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
145else
146  CPPFLAGS="$CPPFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
147fi
148
149if test "x$undef_flag" = xyes; then
150  CPPFLAGS="$CPPFLAGS -Wundef"
151fi
152
153if test "x$with_binutils" != x; then
154dnl  AC_PATH_TOOL(OBJCOPY, objcopy, , "$with_binutils:$PATH")
155  AC_PATH_PROG(OBJCOPY, objcopy, , "$with_binutils:$PATH")
156else
157  AC_CHECK_TOOL(OBJCOPY, objcopy)
158fi
159
160# Defined in acinclude.m4.
161grub_ASM_USCORE
162grub_PROG_OBJCOPY_ABSOLUTE
163if test "x$grub_cv_prog_objcopy_absolute" != xyes; then
164  AC_MSG_ERROR([GRUB requires a working absolute objcopy; upgrade your binutils])
165fi
166
167grub_ASM_PREFIX_REQUIREMENT
168
169grub_ASM_ADDR32
170if test "x$grub_cv_asm_addr32" != xyes; then
171  AC_MSG_ERROR([GRUB requires GAS .code16 addr32 support; upgrade your binutils])
172fi
173
174grub_ASM_ABSOLUTE_WITHOUT_ASTERISK
175
176grub_CHECK_START_SYMBOL
177grub_CHECK_USCORE_START_SYMBOL
178if test "x$grub_cv_check_start_symbol" != "xyes" \
179	-a "x$grub_cv_check_uscore_start_symbol" != "xyes"; then
180  AC_MSG_ERROR([Neither start nor _start is defined])
181fi
182
183grub_CHECK_USCORE_USCORE_BSS_START_SYMBOL
184grub_CHECK_USCORE_EDATA_SYMBOL
185grub_CHECK_EDATA_SYMBOL
186if test "x$grub_cv_check_uscore_uscore_bss_start_symbol" != "xyes" \
187	-a "x$grub_cv_check_uscore_edata_symbol" != "xyes" \
188	-a "x$grub_cv_check_edata_symbol" != "xyes"; then
189  AC_MSG_ERROR([None of __bss_start, _edata, edata defined])
190fi
191
192grub_CHECK_END_SYMBOL
193grub_CHECK_USCORE_END_SYMBOL
194if test "x$grub_cv_check_end_symbol" != "xyes" \
195	-a "x$grub_cv_check_uscore_end_symbol" != "xyes"; then
196  AC_MSG_ERROR([Neither end nor _end is defined])
197fi
198
199# Check for curses libraries.
200AC_ARG_WITH(curses,
201  [  --without-curses        do not use curses])
202
203# Get the filename or the whole disk and open it.
204# Known to work on NetBSD.
205AC_CHECK_LIB(util, opendisk, [GRUB_LIBS="$GRUB_LIBS -lutil"
206  AC_DEFINE(HAVE_OPENDISK, 1, [Define if opendisk() in -lutil can be used])])
207
208# Unless the user specify --without-curses, check for curses.
209if test "x$with_curses" != "xno"; then
210  AC_CHECK_LIB(ncurses, wgetch, [GRUB_LIBS="$GRUB_LIBS -lncurses"
211  AC_DEFINE(HAVE_LIBCURSES, 1, [Define if you have a curses library])],
212    [AC_CHECK_LIB(curses, wgetch, [GRUB_LIBS="$GRUB_LIBS -lcurses"
213       AC_DEFINE(HAVE_LIBCURSES, 1, [Define if you have a curses library])])])
214fi
215
216AC_SUBST(GRUB_LIBS)
217
218# Check for headers.
219AC_CHECK_HEADERS(string.h strings.h ncurses/curses.h ncurses.h curses.h)
220
221# Check for user options.
222
223# filesystems support.
224AC_ARG_ENABLE(ext2fs,
225  [  --disable-ext2fs        disable ext2fs support in Stage 2])
226
227if test x"$enable_ext2fs" != xno; then
228  FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_EXT2FS=1"
229fi
230
231AC_ARG_ENABLE(fat,
232  [  --disable-fat           disable FAT support in Stage 2])
233
234if test x"$enable_fat" != xno; then
235  FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_FAT=1"
236fi
237
238AC_ARG_ENABLE(ffs,
239  [  --disable-ffs           disable FFS support in Stage 2])
240
241if test x"$enable_ffs" != xno; then
242  FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_FFS=1"
243fi
244
245AC_ARG_ENABLE(ufs,
246  [  --disable-ufs           disable UFS support in Stage 2])
247
248if test x"$enable_ufs" != xno; then
249  FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_UFS=1"
250fi
251
252AC_ARG_ENABLE(ufs2,
253  [  --disable-ufs2          disable UFS2 support in Stage 2])
254
255if test x"$enable_ufs2" != xno; then
256  FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_UFS2=1"
257fi
258
259AC_ARG_ENABLE(minix,
260  [  --disable-minix         disable Minix fs support in Stage 2])
261
262if test x"$enable_minix" != xno; then
263  FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_MINIX=1"
264fi
265
266AC_ARG_ENABLE(reiserfs,
267  [  --disable-reiserfs      disable ReiserFS support in Stage 2])
268
269if test x"$enable_reiserfs" != xno; then
270  FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_REISERFS=1"
271fi
272
273AC_ARG_ENABLE(vstafs,
274  [  --disable-vstafs        disable VSTa FS support in Stage 2])
275
276if test x"$enable_vstafs" != xno; then
277  FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_VSTAFS=1"
278fi
279
280AC_ARG_ENABLE(jfs,
281  [  --disable-jfs           disable IBM JFS support in Stage 2])
282
283if test x"$enable_jfs" != xno; then
284  FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_JFS=1"
285fi
286
287AC_ARG_ENABLE(xfs,
288  [  --disable-xfs           disable SGI XFS support in Stage 2])
289
290if test x"$enable_xfs" != xno; then
291  FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_XFS=1"
292fi
293
294AC_ARG_ENABLE(zfs,
295  [  --disable-zfs           disable ZFS support in Stage 2])
296
297if test x"$enable_zfs" != xno; then
298  FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_ZFS=1"
299fi
300
301AC_ARG_ENABLE(iso9660,
302  [  --disable-iso9660       disable ISO9660 support in Stage 2])
303
304if test x"$enable_iso9660" != xno; then
305  FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_ISO9660=1"
306fi
307
308dnl AC_ARG_ENABLE(tftp,
309dnl [  --enable-tftp           enable TFTP support in Stage 2])
310dnl
311dnl #if test x"$enable_tftp" = xyes; then
312dnl FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_TFTP=1"
313dnl fi
314
315AC_ARG_ENABLE(gunzip,
316  [  --disable-gunzip        disable decompression in Stage 2])
317
318if test x"$enable_gunzip" = xno; then
319  FSYS_CFLAGS="$FSYS_CFLAGS -DNO_DECOMPRESSION=1"
320fi
321
322AC_ARG_ENABLE(md5-password,
323  [  --disable-md5-password  disable MD5 password support in Stage 2])
324if test "x$enable_md5_password" != xno; then
325  FSYS_CFLAGS="$FSYS_CFLAGS -DUSE_MD5_PASSWORDS=1"
326fi
327
328dnl The netboot support.
329dnl General options.
330AC_ARG_ENABLE(packet-retransmission,
331  [  --disable-packet-retransmission
332                          turn off packet retransmission])
333if test "x$enable_packet_retransmission" != xno; then
334  NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DCONGESTED=1 -DCONFIG_PCI"
335fi
336
337AC_ARG_ENABLE(pci-direct,
338  [  --enable-pci-direct     access PCI directly instead of using BIOS])
339if test "x$enable_pci_direct" = xyes; then
340  NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DCONFIG_PCI_DIRECT=1"
341fi
342
343dnl Device drivers.
344AC_ARG_ENABLE(3c595,
345  [  --enable-3c595          enable 3Com595 driver])
346if test "x$enable_3c595" = xyes; then
347  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_3C595=1"
348  NETBOOT_DRIVERS="$NETBOOT_DRIVERS 3c595.o"
349fi
350
351AC_ARG_ENABLE(3c90x,
352  [  --enable-3c90x          enable 3Com90x driver])
353if test "x$enable_3c90x" = xyes; then
354  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_3C90X=1"
355  NETBOOT_DRIVERS="$NETBOOT_DRIVERS 3c90x.o"
356fi
357
358AC_ARG_ENABLE(davicom,
359  [  --enable-davicom        enable Davicom driver])
360if test "x$enable_davicom" = xyes; then
361  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_DAVICOM=1"
362  NETBOOT_DRIVERS="$NETBOOT_DRIVERS davicom.o"
363fi
364
365AC_ARG_ENABLE(e1000,
366  [  --enable-e1000          enable Etherexpress Pro/1000 driver])
367if test "x$enable_e1000" = xyes; then
368  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_E1000=1"
369  NETBOOT_DRIVERS="$NETBOOT_DRIVERS e1000.o"
370fi
371
372AC_ARG_ENABLE(eepro100,
373  [  --enable-eepro100       enable Etherexpress Pro/100 driver])
374if test "x$enable_eepro100" = xyes; then
375  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_EEPRO100=1"
376  NETBOOT_DRIVERS="$NETBOOT_DRIVERS eepro100.o"
377fi
378
379AC_ARG_ENABLE(epic100,
380  [  --enable-epic100        enable SMC 83c170 EPIC/100 driver])
381if test "x$enable_epic100" = xyes; then
382  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_EPIC100=1"
383  NETBOOT_DRIVERS="$NETBOOT_DRIVERS epic100.o"
384fi
385
386AC_ARG_ENABLE(forcedeth,
387  [  --enable-forcedeth      enable Nvidia Geforce driver])
388if test "x$enable_forcedeth" = xyes; then
389  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_FORCEDETH=1"
390  NETBOOT_DRIVERS="$NETBOOT_DRIVERS forcedeth.o"
391fi
392
393AC_ARG_ENABLE(natsemi,
394  [  --enable-natsemi        enable NatSemi DP8381x driver])
395if test "x$enable_natsemi" = xyes; then
396  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_NATSEMI=1"
397  NETBOOT_DRIVERS="$NETBOOT_DRIVERS natsemi.o"
398fi
399
400AC_ARG_ENABLE(ns83820,
401  [  --enable-ns83820        enable NS83820 driver])
402if test "x$enable_ns83820" = xyes; then
403  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_NS83820=1"
404  NETBOOT_DRIVERS="$NETBOOT_DRIVERS ns83820.o"
405fi
406
407AC_ARG_ENABLE(ns8390,
408  [  --enable-ns8390         enable NE2000 PCI driver])
409if test "x$enable_ns8390" = xyes; then
410  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_NS8390=1"
411  NETBOOT_DRIVERS="$NETBOOT_DRIVERS ns8390.o"
412fi
413
414AC_ARG_ENABLE(pcnet32,
415  [  --enable-pcnet32        enable AMD Lance/PCI PCNet/32 driver])
416if test "x$enable_pcnet32" = xyes; then
417  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_PCNET32=1"
418  NETBOOT_DRIVERS="$NETBOOT_DRIVERS pcnet32.o"
419fi
420
421AC_ARG_ENABLE(pnic,
422  [  --enable-pnic           enable Bochs Pseudo Nic driver])
423if test "x$enable_pnic" = xyes; then
424  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_PNIC=1"
425  NETBOOT_DRIVERS="$NETBOOT_DRIVERS pnic.o"
426fi
427
428AC_ARG_ENABLE(rtl8139,
429  [  --enable-rtl8139        enable Realtek 8139 driver])
430if test "x$enable_rtl8139" = xyes; then
431  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_RTL8139=1"
432  NETBOOT_DRIVERS="$NETBOOT_DRIVERS rtl8139.o"
433fi
434
435AC_ARG_ENABLE(r8169,
436  [  --enable-r8169          enable Realtek 8169 driver])
437if test "x$enable_r8169" = xyes; then
438  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_R8169=1"
439  NETBOOT_DRIVERS="$NETBOOT_DRIVERS r8169.o"
440fi
441
442AC_ARG_ENABLE(sis900,
443  [  --enable-sis900         enable SIS 900 and SIS 7016 driver])
444if test "x$enable_sis900" = xyes; then
445  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_SIS900=1"
446  NETBOOT_DRIVERS="$NETBOOT_DRIVERS sis900.o"
447fi
448
449AC_ARG_ENABLE(sundance,
450  [  --enable-sundance       enable Sundance ST201 driver])
451if test "x$enable_sundance" = xyes; then
452  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_SUNDANCE=1"
453  NETBOOT_DRIVERS="$NETBOOT_DRIVERS sundance.o"
454fi
455
456AC_ARG_ENABLE(tg3,
457  [  --enable-tg3            enable Broadcom Tigon3 driver])
458if test "x$enable_tg3" = xyes; then
459  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_TG3=1"
460  NETBOOT_DRIVERS="$NETBOOT_DRIVERS tg3.o"
461fi
462
463AC_ARG_ENABLE(tulip,
464  [  --enable-tulip          enable Tulip driver])
465if test "x$enable_tulip" = xyes; then
466  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_TULIP=1"
467  NETBOOT_DRIVERS="$NETBOOT_DRIVERS tulip.o"
468fi
469
470AC_ARG_ENABLE(tlan,
471  [  --enable-tlan           enable TI ThunderLAN driver])
472if test "x$enable_tlan" = xyes; then
473  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_TLAN=1"
474  NETBOOT_DRIVERS="$NETBOOT_DRIVERS tlan.o"
475fi
476
477AC_ARG_ENABLE(undi,
478  [  --enable-undi           enable PXE UNDI driver])
479if test "x$enable_undi" = xyes; then
480  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_UNDI=1"
481  NETBOOT_DRIVERS="$NETBOOT_DRIVERS undi.o"
482fi
483
484AC_ARG_ENABLE(via-rhine,
485  [  --enable-via-rhine      enable Rhine-I/II driver])
486if test "x$enable_via_rhine" = xyes; then
487  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_VIA_RHINE=1"
488  NETBOOT_DRIVERS="$NETBOOT_DRIVERS via_rhine.o"
489fi
490
491AC_ARG_ENABLE(w89c840,
492  [  --enable-w89c840        enable Winbond W89c840 driver])
493if test "x$enable_w89c840" = xyes; then
494  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_W89C840=1"
495  NETBOOT_DRIVERS="$NETBOOT_DRIVERS w89c840.o"
496fi
497
498dnl Check if the netboot support is turned on.
499AM_CONDITIONAL(NETBOOT_SUPPORT, test "x$NET_CFLAGS" != x)
500if test "x$NET_CFLAGS" != x; then
501  FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_TFTP=1"
502fi
503
504dnl extra flag for ns8390.c
505AC_ARG_ENABLE(compex-rl2000-fix,
506  [  --enable-compex-rl2000-fix
507                          specify this if you have a Compex RL2000 PCI])
508if test "x$enable_compex_rl2000_fix" = xyes; then
509  NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DCOMPEX_RL2000_FIX=1"
510fi
511
512AC_ARG_ENABLE(ne-scan,
513  [  --enable-ne-scan=LIST   probe for NE base address using LIST],
514  [NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DNE_SCAN=$enable_ne_scan"],
515  [NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DNE_SCAN=0x280,0x300,0x320,0x340"])
516
517AC_ARG_ENABLE(wd-default-mem,
518  [  --enable-wd-default-mem=MEM
519                          set the default memory location for WD/SMC],
520  [NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DWD_DEFAULT_MEM=$enable_wd_default_mem"],
521  [NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DWD_DEFAULT_MEM=0xCC000"])
522
523dnl Diskless
524AC_ARG_ENABLE(diskless,
525  [  --enable-diskless       enable diskless support])
526AM_CONDITIONAL(DISKLESS_SUPPORT, test "x$enable_diskless" = xyes)
527
528dnl Graphical splashscreen support
529AC_ARG_ENABLE(graphics,
530  [  --disable-graphics      disable graphics terminal support])
531AM_CONDITIONAL(GRAPHICS_SUPPORT, test "x$enable_graphics" != xno)
532
533dnl Hercules terminal
534AC_ARG_ENABLE(hercules,
535  [  --disable-hercules      disable hercules terminal support])
536AM_CONDITIONAL(HERCULES_SUPPORT, test "x$enable_hercules" != xno)
537
538dnl Serial terminal
539AC_ARG_ENABLE(serial,
540  [  --disable-serial        disable serial terminal support])
541AM_CONDITIONAL(SERIAL_SUPPORT, test "x$enable_serial" != xno)
542
543dnl Simulation of the slowness of a serial device.
544AC_ARG_ENABLE(serial-speed-simulation,
545  [  --enable-serial-speed-simulation
546                          simulate the slowness of a serial device])
547AM_CONDITIONAL(SERIAL_SPEED_SIMULATION,
548  test "x$enable_serial_speed_simulation" = xyes)
549
550# Sanity check.
551if test "x$enable_diskless" = xyes; then
552  if test "x$NET_CFLAGS" = x; then
553    AC_MSG_ERROR([You must enable at least one network driver])
554  fi
555fi
556
557dnl Embed a menu string in GRUB itself.
558AC_ARG_ENABLE(preset-menu,
559  [  --enable-preset-menu=FILE
560                          preset a menu file FILE in Stage 2])
561if test "x$enable_preset_menu" = x; then
562  :
563else
564  if test -r $enable_preset_menu; then
565    grub_DEFINE_FILE(PRESET_MENU_STRING, [$enable_preset_menu],
566    		     [Define if there is user specified preset menu string])
567  else
568    AC_MSG_ERROR([Cannot read the preset menu file $enable_preset_menu])
569  fi
570fi
571
572dnl Build the example Multiboot kernel.
573AC_ARG_ENABLE(example-kernel,
574  [  --enable-example-kernel
575                          build the example Multiboot kernel])
576AM_CONDITIONAL(BUILD_EXAMPLE_KERNEL, test "x$enable_example_kernel" = xyes)
577
578dnl Automatic Linux mem= option.
579AC_ARG_ENABLE(auto-linux-mem-opt,
580  [  --disable-auto-linux-mem-opt
581                          don't pass Linux mem= option automatically])
582if test "x$enable_auto_linux_mem_opt" = xno; then
583  :
584else
585  AC_DEFINE(AUTO_LINUX_MEM_OPT, 1, [Define if you don't want to pass the mem= option to Linux])
586fi
587
588dnl Now substitute the variables.
589AC_SUBST(FSYS_CFLAGS)
590AC_SUBST(NET_CFLAGS)
591AC_SUBST(NET_EXTRAFLAGS)
592AC_SUBST(NETBOOT_DRIVERS)
593
594dnl Because recent automake complains about CCASFLAGS, set it here.
595CCASFLAGS='$(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)'
596AC_SUBST(CCASFLAGS)
597
598
599dnl Output.
600AC_CONFIG_FILES([Makefile stage1/Makefile stage2/Makefile \
601		 docs/Makefile lib/Makefile util/Makefile \
602		 grub/Makefile netboot/Makefile util/grub-image \
603		 util/grub-install util/grub-md5-crypt \
604		 util/grub-terminfo util/grub-set-default])
605AC_OUTPUT
606