• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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(ufs2,
246  [  --disable-ufs2          disable UFS2 support in Stage 2])
247
248if test x"$enable_ufs2" != xno; then
249  FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_UFS2=1"
250fi
251
252AC_ARG_ENABLE(minix,
253  [  --disable-minix         disable Minix fs support in Stage 2])
254
255if test x"$enable_minix" != xno; then
256  FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_MINIX=1"
257fi
258
259AC_ARG_ENABLE(reiserfs,
260  [  --disable-reiserfs      disable ReiserFS support in Stage 2])
261
262if test x"$enable_reiserfs" != xno; then
263  FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_REISERFS=1"
264fi
265
266AC_ARG_ENABLE(vstafs,
267  [  --disable-vstafs        disable VSTa FS support in Stage 2])
268
269if test x"$enable_vstafs" != xno; then
270  FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_VSTAFS=1"
271fi
272
273AC_ARG_ENABLE(jfs,
274  [  --disable-jfs           disable IBM JFS support in Stage 2])
275
276if test x"$enable_jfs" != xno; then
277  FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_JFS=1"
278fi
279
280AC_ARG_ENABLE(xfs,
281  [  --disable-xfs           disable SGI XFS support in Stage 2])
282
283if test x"$enable_xfs" != xno; then
284  FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_XFS=1"
285fi
286
287AC_ARG_ENABLE(iso9660,
288  [  --disable-iso9660       disable ISO9660 support in Stage 2])
289
290if test x"$enable_iso9660" != xno; then
291  FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_ISO9660=1"
292fi
293
294dnl AC_ARG_ENABLE(tftp,
295dnl [  --enable-tftp           enable TFTP support in Stage 2])
296dnl
297dnl #if test x"$enable_tftp" = xyes; then
298dnl FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_TFTP=1"
299dnl fi
300
301AC_ARG_ENABLE(gunzip,
302  [  --disable-gunzip        disable decompression in Stage 2])
303
304if test x"$enable_gunzip" = xno; then
305  FSYS_CFLAGS="$FSYS_CFLAGS -DNO_DECOMPRESSION=1"
306fi
307
308AC_ARG_ENABLE(md5-password,
309  [  --disable-md5-password  disable MD5 password support in Stage 2])
310if test "x$enable_md5_password" != xno; then
311  FSYS_CFLAGS="$FSYS_CFLAGS -DUSE_MD5_PASSWORDS=1"
312fi
313
314dnl The netboot support.
315dnl General options.
316AC_ARG_ENABLE(packet-retransmission,
317  [  --disable-packet-retransmission
318                          turn off packet retransmission])
319if test "x$enable_packet_retransmission" != xno; then
320  NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DCONGESTED=1"
321fi
322
323AC_ARG_ENABLE(pci-direct,
324  [  --enable-pci-direct     access PCI directly instead of using BIOS])
325if test "x$enable_pci_direct" = xyes; then
326  NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DCONFIG_PCI_DIRECT=1"
327fi
328
329dnl Device drivers.
330AC_ARG_ENABLE(3c509,
331  [  --enable-3c509          enable 3Com509 driver])
332if test "x$enable_3c509" = xyes; then
333  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_3C509"
334  NETBOOT_DRIVERS="$NETBOOT_DRIVERS 3c509.o"
335fi
336
337AC_ARG_ENABLE(3c529,
338  [  --enable-3c529          enable 3Com529 driver])
339if test "x$enable_3c529" = xyes; then
340  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_3C529=1"
341  NETBOOT_DRIVERS="$NETBOOT_DRIVERS 3c529.o"
342fi
343
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(cs89x0,
359  [  --enable-cs89x0         enable CS89x0 driver])
360if test "x$enable_cs89x0" = xyes; then
361  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_CS89X0=1"
362  NETBOOT_DRIVERS="$NETBOOT_DRIVERS cs89x0.o"
363fi
364
365AC_ARG_ENABLE(davicom,
366  [  --enable-davicom        enable Davicom driver])
367if test "x$enable_davicom" = xyes; then
368  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_DAVICOM=1"
369  NETBOOT_DRIVERS="$NETBOOT_DRIVERS davicom.o"
370fi
371
372AC_ARG_ENABLE(depca,
373  [  --enable-depca          enable DEPCA and EtherWORKS driver])
374if test "x$enable_depca" = xyes; then
375  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_DEPCA=1"
376  NETBOOT_DRIVERS="$NETBOOT_DRIVERS depca.o"
377fi
378
379AC_ARG_ENABLE(eepro,
380  [  --enable-eepro          enable Etherexpress Pro/10 driver])
381if test "x$enable_eepro" = xyes; then
382  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_EEPRO=1"
383  NETBOOT_DRIVERS="$NETBOOT_DRIVERS eepro.o"
384fi
385
386AC_ARG_ENABLE(eepro100,
387  [  --enable-eepro100       enable Etherexpress Pro/100 driver])
388if test "x$enable_eepro100" = xyes; then
389  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_EEPRO100=1"
390  NETBOOT_DRIVERS="$NETBOOT_DRIVERS eepro100.o"
391fi
392
393AC_ARG_ENABLE(epic100,
394  [  --enable-epic100        enable SMC 83c170 EPIC/100 driver])
395if test "x$enable_epic100" = xyes; then
396  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_EPIC100=1"
397  NETBOOT_DRIVERS="$NETBOOT_DRIVERS epic100.o"
398fi
399
400AC_ARG_ENABLE(3c507,
401  [  --enable-3c507          enable 3Com507 driver])
402if test "x$enable_3c507" = xyes; then
403  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_3C507=1"
404  NETBOOT_DRIVERS="$NETBOOT_DRIVERS 3c507.o"
405fi
406
407AC_ARG_ENABLE(exos205,
408  [  --enable-exos205        enable EXOS205 driver])
409if test "x$enable_exos205" = xyes; then
410  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_EXOS205=1"
411  NETBOOT_DRIVERS="$NETBOOT_DRIVERS exos205.o"
412fi
413
414AC_ARG_ENABLE(ni5210,
415  [  --enable-ni5210         enable Racal-Interlan NI5210 driver])
416if test "x$enable_ni5210" = xyes; then
417  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_NI5210=1"
418  NETBOOT_DRIVERS="$NETBOOT_DRIVERS ni5210.o"
419fi
420
421AC_ARG_ENABLE(lance,
422  [  --enable-lance          enable Lance PCI PCNet/32 driver])
423if test "x$enable_lance" = xyes; then
424  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_LANCE=1"
425  NETBOOT_DRIVERS="$NETBOOT_DRIVERS lance.o"
426fi
427
428AC_ARG_ENABLE(ne2100,
429  [  --enable-ne2100         enable Novell NE2100 driver])
430if test "x$enable_ne2100" = xyes; then
431  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_NE2100=1"
432  NETBOOT_DRIVERS="$NETBOOT_DRIVERS ne2100.o"
433fi
434
435AC_ARG_ENABLE(ni6510,
436  [  --enable-ni6510         enable Racal-Interlan NI6510 driver])
437if test "x$enable_ni6510" = xyes; then
438  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_NI6510=1"
439  NETBOOT_DRIVERS="$NETBOOT_DRIVERS ni6510.o"
440fi
441
442AC_ARG_ENABLE(natsemi,
443  [  --enable-natsemi        enable NatSemi DP8381x driver])
444if test "x$enable_natsemi" = xyes; then
445  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_NATSEMI=1"
446  NETBOOT_DRIVERS="$NETBOOT_DRIVERS natsemi.o"
447fi
448
449AC_ARG_ENABLE(ni5010,
450  [  --enable-ni5010         enable Racal-Interlan NI5010 driver])
451if test "x$enable_ni5010" = xyes; then
452  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_NI5010=1"
453  NETBOOT_DRIVERS="$NETBOOT_DRIVERS ni5010.o"
454fi
455
456AC_ARG_ENABLE(3c503,
457  [  --enable-3c503          enable 3Com503 driver])
458if test "x$enable_3c503" = xyes; then
459  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_3C503=1"
460  NETBOOT_DRIVERS="$NETBOOT_DRIVERS 3c503.o"
461fi
462
463AC_ARG_ENABLE(ne,
464  [  --enable-ne             enable NE1000/2000 ISA driver])
465if test "x$enable_ne" = xyes; then
466  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_NE=1"
467  NETBOOT_DRIVERS="$NETBOOT_DRIVERS ne.o"
468fi
469
470AC_ARG_ENABLE(ns8390,
471  [  --enable-ns8390         enable NE2000 PCI driver])
472if test "x$enable_ns8390" = xyes; then
473  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_NS8390=1"
474  NETBOOT_DRIVERS="$NETBOOT_DRIVERS ns8390.o"
475fi
476
477AC_ARG_ENABLE(wd,
478  [  --enable-wd             enable WD8003/8013, SMC8216/8416 driver])
479if test "x$enable_wd" = xyes; then
480  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_WD=1"
481  NETBOOT_DRIVERS="$NETBOOT_DRIVERS wd.o"
482fi
483
484AC_ARG_ENABLE(otulip,
485  [  --enable-otulip         enable old Tulip driver])
486if test "x$enable_otulip" = xyes; then
487  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_OTULIP=1"
488  NETBOOT_DRIVERS="$NETBOOT_DRIVERS otulip.o"
489fi
490
491AC_ARG_ENABLE(rtl8139,
492  [  --enable-rtl8139        enable Realtek 8139 driver])
493if test "x$enable_rtl8139" = xyes; then
494  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_RTL8139=1"
495  NETBOOT_DRIVERS="$NETBOOT_DRIVERS rtl8139.o"
496fi
497
498AC_ARG_ENABLE(sis900,
499  [  --enable-sis900         enable SIS 900 and SIS 7016 driver])
500if test "x$enable_sis900" = xyes; then
501  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_SIS900=1"
502  NETBOOT_DRIVERS="$NETBOOT_DRIVERS sis900.o"
503fi
504
505AC_ARG_ENABLE(sk-g16,
506  [  --enable-sk-g16         enable Schneider and Koch G16 driver])
507if test "x$enable_sk_g16" = xyes; then
508  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_SK_G16=1"
509  NETBOOT_DRIVERS="$NETBOOT_DRIVERS sk_g16.o"
510fi
511
512AC_ARG_ENABLE(smc9000,
513  [  --enable-smc9000        enable SMC9000 driver])
514if test "x$enable_smc9000" = xyes; then
515  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_SMC9000=1"
516  NETBOOT_DRIVERS="$NETBOOT_DRIVERS smc9000.o"
517fi
518
519AC_ARG_ENABLE(tiara,
520  [  --enable-tiara          enable Tiara driver])
521if test "x$enable_tiara" = xyes; then
522  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_TIARA=1"
523  NETBOOT_DRIVERS="$NETBOOT_DRIVERS tiara.o"
524fi
525
526AC_ARG_ENABLE(tulip,
527  [  --enable-tulip          enable Tulip driver])
528if test "x$enable_tulip" = xyes; then
529  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_TULIP=1"
530  NETBOOT_DRIVERS="$NETBOOT_DRIVERS tulip.o"
531fi
532
533AC_ARG_ENABLE(via-rhine,
534  [  --enable-via-rhine      enable Rhine-I/II driver])
535if test "x$enable_via_rhine" = xyes; then
536  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_VIA_RHINE=1"
537  NETBOOT_DRIVERS="$NETBOOT_DRIVERS via_rhine.o"
538fi
539
540AC_ARG_ENABLE(w89c840,
541  [  --enable-w89c840        enable Winbond W89c840, Compex RL100-ATX driver])
542if test "x$enable_w89c840" = xyes; then
543  NET_CFLAGS="$NET_CFLAGS -DINCLUDE_W89C840=1"
544  NETBOOT_DRIVERS="$NETBOOT_DRIVERS w89c840.o"
545fi
546
547dnl Check if the netboot support is turned on.
548AM_CONDITIONAL(NETBOOT_SUPPORT, test "x$NET_CFLAGS" != x)
549if test "x$NET_CFLAGS" != x; then
550  FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_TFTP=1"
551fi
552
553dnl Extra options.
554AC_ARG_ENABLE(3c503-shmem,
555  [  --enable-3c503-shmem    use 3c503 shared memory mode])
556if test "x$enable_3c503_shmem" = xyes; then
557  NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DT503_SHMEM=1"
558fi
559
560AC_ARG_ENABLE(3c503-aui,
561  [  --enable-3c503-aui      use AUI by default on 3c503 cards])
562if test "x$enable_3c503_aui" = xyes; then
563  NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DT503_AUI=1"
564fi
565
566AC_ARG_ENABLE(compex-rl2000-fix,
567  [  --enable-compex-rl2000-fix
568                          specify this if you have a Compex RL2000 PCI])
569if test "x$enable_compex_rl2000_fix" = xyes; then
570  NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DCOMPEX_RL2000_FIX=1"
571fi
572
573AC_ARG_ENABLE(smc9000-scan,
574  [  --enable-smc9000-scan=LIST
575                          probe for SMC9000 I/O addresses using LIST],
576  [NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DSMC9000_SCAN=$enable_smc9000_scan"])
577
578AC_ARG_ENABLE(ne-scan,
579  [  --enable-ne-scan=LIST   probe for NE base address using LIST],
580  [NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DNE_SCAN=$enable_ne_scan"],
581  [NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DNE_SCAN=0x280,0x300,0x320,0x340"])
582
583AC_ARG_ENABLE(wd-default-mem,
584  [  --enable-wd-default-mem=MEM
585                          set the default memory location for WD/SMC],
586  [NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DWD_DEFAULT_MEM=$enable_wd_default_mem"],
587  [NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DWD_DEFAULT_MEM=0xCC000"])
588
589AC_ARG_ENABLE(cs-scan,
590  [  --enable-cs-scan=LIST   probe for CS89x0 base address using LIST],
591  [NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DCS_SCAN=$enable_cs_scan"])
592
593dnl Diskless
594AC_ARG_ENABLE(diskless,
595  [  --enable-diskless       enable diskless support])
596AM_CONDITIONAL(DISKLESS_SUPPORT, test "x$enable_diskless" = xyes)
597
598dnl Hercules terminal
599AC_ARG_ENABLE(hercules,
600  [  --disable-hercules      disable hercules terminal support])
601AM_CONDITIONAL(HERCULES_SUPPORT, test "x$enable_hercules" != xno)
602
603dnl Serial terminal
604AC_ARG_ENABLE(serial,
605  [  --disable-serial        disable serial terminal support])
606AM_CONDITIONAL(SERIAL_SUPPORT, test "x$enable_serial" != xno)
607
608dnl Simulation of the slowness of a serial device.
609AC_ARG_ENABLE(serial-speed-simulation,
610  [  --enable-serial-speed-simulation
611                          simulate the slowness of a serial device])
612AM_CONDITIONAL(SERIAL_SPEED_SIMULATION,
613  test "x$enable_serial_speed_simulation" = xyes)
614
615# Sanity check.
616if test "x$enable_diskless" = xyes; then
617  if test "x$NET_CFLAGS" = x; then
618    AC_MSG_ERROR([You must enable at least one network driver])
619  fi
620fi
621
622dnl Embed a menu string in GRUB itself.
623AC_ARG_ENABLE(preset-menu,
624  [  --enable-preset-menu=FILE
625                          preset a menu file FILE in Stage 2])
626if test "x$enable_preset_menu" = x; then
627  :
628else
629  if test -r $enable_preset_menu; then
630    grub_DEFINE_FILE(PRESET_MENU_STRING, [$enable_preset_menu],
631    		     [Define if there is user specified preset menu string])
632  else
633    AC_MSG_ERROR([Cannot read the preset menu file $enable_preset_menu])
634  fi
635fi
636
637dnl Build the example Multiboot kernel.
638AC_ARG_ENABLE(example-kernel,
639  [  --enable-example-kernel
640                          build the example Multiboot kernel])
641AM_CONDITIONAL(BUILD_EXAMPLE_KERNEL, test "x$enable_example_kernel" = xyes)
642
643dnl Automatic Linux mem= option.
644AC_ARG_ENABLE(auto-linux-mem-opt,
645  [  --disable-auto-linux-mem-opt
646                          don't pass Linux mem= option automatically])
647if test "x$enable_auto_linux_mem_opt" = xno; then
648  :
649else
650  AC_DEFINE(AUTO_LINUX_MEM_OPT, 1, [Define if you don't want to pass the mem= option to Linux])
651fi
652
653dnl Now substitute the variables.
654AC_SUBST(FSYS_CFLAGS)
655AC_SUBST(NET_CFLAGS)
656AC_SUBST(NET_EXTRAFLAGS)
657AC_SUBST(NETBOOT_DRIVERS)
658
659dnl Because recent automake complains about CCASFLAGS, set it here.
660CCASFLAGS='$(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)'
661AC_SUBST(CCASFLAGS)
662
663
664dnl Output.
665AC_CONFIG_FILES([Makefile stage1/Makefile stage2/Makefile \
666		 docs/Makefile lib/Makefile util/Makefile \
667		 grub/Makefile netboot/Makefile util/grub-image \
668		 util/grub-install util/grub-md5-crypt \
669		 util/grub-terminfo util/grub-set-default])
670AC_OUTPUT
671