grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Conditionally building `grub-emu'


From: Thomas Schwinge
Subject: Conditionally building `grub-emu'
Date: Sun, 22 Oct 2006 16:46:51 +0200
User-agent: Mutt/1.5.6+20040907i

Hello!

On request / suggestion / whatever ;-) of Marco I created the following
patch.  Its origin: I was trying to build GRUB2 on a system where no
(n)curses header files were installed (which configure even detected
correctly, but didn't complain about it) and then the build stopped with
an error when building `grub-emu''s object files.  As `grub-emu' is
considered to ``only'' be a debugging tool, the patch disables it for a
default build (and thusly also avoids the (n)curses dependency for a
default build).


The only remaining problem --- which only happens if building without
having `grub-emu' enabled --- is the following one:

#v+
[...]
cc -Iloader/i386/pc -I../loader/i386/pc -I. -Iinclude -I../include -Wall -W 
-Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes       -Wundef 
-Wstrict-prototypes -g -Os -falign-jumps=1 -falign-loops=1 -falign-functions=1 
-fno-builtin -mrtd -mregparm=3 -m32 -MD -c -o 
chain_mod-loader_i386_pc_chainloader_normal.o 
../loader/i386/pc/chainloader_normal.c
In file included from ../include/grub/normal.h:28,
                 from ../loader/i386/pc/chainloader_normal.c:23:
../include/grub/script.h:27:29: error: grub_script.tab.h: No such file or 
directory
In file included from ../include/grub/normal.h:28,
                 from ../loader/i386/pc/chainloader_normal.c:23:
../include/grub/script.h:242: error: expected ')' before '*' token
make: *** [chain_mod-loader_i386_pc_chainloader_normal.o] Error 1
#v-

Running `make grub_script.tab.h' and then again `make' makes the build
succeed.  So my guess is that there is a missing dependency somewhere and
it wasn't a problem so far because the file was built earlier (for
`grub-emu'?).  Someone who knows the dependencies between the source
files should be able to quickly spot the missing one.


2006-10-22  Thomas Schwinge  <address@hidden>

        * Makefile.in (enable_grub_emu): New variable.
        * configure.ac (--enable-grub-emu): New option.
        Do the checks for (n)curses only if `--enable-grub-emu' is requested.
        * conf/i386-efi.rmk (sbin_UTILITIES): Add `grub-emu' only if requested.
        * conf/i386-pc.rmk: Likewise.
        * conf/powerpc-ieee1275.rmk: Likewise.
        * conf/sparc64-ieee1275.rmk (bin_UTILITIES): Likewise.

Index: Makefile.in
===================================================================
RCS file: /cvsroot/grub/grub2/Makefile.in,v
retrieving revision 1.22
diff -u -p -r1.22 Makefile.in
--- Makefile.in 28 May 2006 23:01:43 -0000      1.22
+++ Makefile.in 22 Oct 2006 14:35:10 -0000
@@ -73,6 +73,9 @@ LIBCURSES = @LIBCURSES@
 LIBLZO = @LIBLZO@
 YACC = @YACC@
 
+# Options.
+enable_grub_emu = @enable_grub_emu@
+
 ### General variables.
 
 RMKFILES = $(addprefix conf/,common.rmk i386-pc.rmk powerpc-ieee1275.rmk \
Index: configure.ac
===================================================================
RCS file: /cvsroot/grub/grub2/configure.ac,v
retrieving revision 1.34
diff -u -p -r1.34 configure.ac
--- configure.ac        15 Oct 2006 13:53:59 -0000      1.34
+++ configure.ac        22 Oct 2006 14:35:12 -0000
@@ -145,14 +145,6 @@ if test "$target_cpu"-"$platform" = i386
   AC_CHECK_HEADERS(lzo/lzo1x.h lzo1x.h)
 fi
 
-# Check for curses.
-AC_CHECK_LIB(ncurses, wgetch, [LIBCURSES="-lncurses"],
-  [AC_CHECK_LIB(curses, wgetch, [LIBCURSES="-lcurses"])])
-AC_SUBST(LIBCURSES)
-
-# Check for headers.
-AC_CHECK_HEADERS(ncurses/curses.h ncurses.h curses.h)
-
 # Check for functions.
 AC_CHECK_FUNCS(posix_memalign memalign)
 
@@ -265,13 +257,35 @@ CPPFLAGS="$tmp_CPPFLAGS"
 LDFLAGS="$tmp_LDFLAGS"
 LIBS="$tmp_LIBS"
 
+#
 # Check for options.
+#
+
+# Memory manager debugging.
 AC_ARG_ENABLE([mm-debug], 
              AS_HELP_STRING([--enable-mm-debug],
                              [include memory manager debugging]),
               [AC_DEFINE([MM_DEBUG], [1],
                          [Define to 1 if you enable memory manager 
debugging.])])
 
+AC_ARG_ENABLE([grub-emu],
+             [AS_HELP_STRING([--enable-grub-emu],
+                             [build and install the `grub-emu' debugging 
utility])])
+[if [ x"$enable_grub_emu" = xyes ]; then
+  # Check for curses libraries.]
+  AC_CHECK_LIB([ncurses], [wgetch], [LIBCURSES="-lncurses"],
+    [AC_CHECK_LIB([curses], [wgetch], [LIBCURSES="-lcurses"],
+      [AC_MSG_ERROR([(n)curses libraries are required to build `grub-emu'])])])
+  AC_SUBST([LIBCURSES])
+
+  [# Check for headers.]
+  AC_CHECK_HEADERS([ncurses/curses.h], [],
+    [AC_CHECK_HEADERS([ncurses.h], [],
+      [AC_CHECK_HEADERS([curses.h], [],
+       [AC_MSG_ERROR([(n)curses header files are required to build 
`grub-emu'])])])])
+[fi]
+AC_SUBST([enable_grub_emu])
+
 # Output files.
 AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu
        include/grub/machine:include/grub/$target_cpu/$platform])
Index: conf/i386-efi.rmk
===================================================================
RCS file: /cvsroot/grub/grub2/conf/i386-efi.rmk,v
retrieving revision 1.11
diff -u -p -r1.11 i386-efi.rmk
--- conf/i386-efi.rmk   14 Oct 2006 18:59:34 -0000      1.11
+++ conf/i386-efi.rmk   22 Oct 2006 14:35:13 -0000
@@ -6,7 +6,10 @@ COMMON_LDFLAGS = -melf_i386 -nostdlib
 
 # Utilities.
 bin_UTILITIES = grub-mkimage
-#sbin_UTILITIES = grub-setup grub-emu grub-mkdevicemap grub-probe
+#sbin_UTILITIES = grub-setup grub-mkdevicemap grub-probe
+#ifeq ($(enable_grub_emu), yes)
+#sbin_UTILITIES += grub-emu
+#endif
 
 # For grub-mkimage.
 grub_mkimage_SOURCES = util/i386/efi/grub-mkimage.c util/misc.c \
Index: conf/i386-pc.rmk
===================================================================
RCS file: /cvsroot/grub/grub2/conf/i386-pc.rmk,v
retrieving revision 1.72
diff -u -p -r1.72 i386-pc.rmk
--- conf/i386-pc.rmk    14 Oct 2006 18:59:34 -0000      1.72
+++ conf/i386-pc.rmk    22 Oct 2006 14:35:13 -0000
@@ -51,7 +51,10 @@ kernel_syms.lst: $(addprefix include/gru
 
 # Utilities.
 bin_UTILITIES = grub-mkimage
-sbin_UTILITIES = grub-setup grub-emu grub-mkdevicemap grub-probe
+sbin_UTILITIES = grub-setup grub-mkdevicemap grub-probe
+ifeq ($(enable_grub_emu), yes)
+sbin_UTILITIES += grub-emu
+endif
 
 # For grub-mkimage.
 grub_mkimage_SOURCES = util/i386/pc/grub-mkimage.c util/misc.c \
Index: conf/powerpc-ieee1275.rmk
===================================================================
RCS file: /cvsroot/grub/grub2/conf/powerpc-ieee1275.rmk,v
retrieving revision 1.60
diff -u -p -r1.60 powerpc-ieee1275.rmk
--- conf/powerpc-ieee1275.rmk   22 Sep 2006 19:36:32 -0000      1.60
+++ conf/powerpc-ieee1275.rmk   22 Oct 2006 14:35:13 -0000
@@ -27,7 +27,9 @@ pkgdata_PROGRAMS = kernel.elf
 
 # Utilities.
 bin_UTILITIES = grub-mkimage
-sbin_UTILITIES = grub-emu 
+ifeq ($(enable_grub_emu), yes)
+sbin_UTILITIES = grub-emu
+endif
  
 # For grub-mkimage.
 grub_mkimage_SOURCES = util/powerpc/ieee1275/grub-mkimage.c util/misc.c \
Index: conf/sparc64-ieee1275.rmk
===================================================================
RCS file: /cvsroot/grub/grub2/conf/sparc64-ieee1275.rmk,v
retrieving revision 1.14
diff -u -p -r1.14 sparc64-ieee1275.rmk
--- conf/sparc64-ieee1275.rmk   22 Sep 2006 19:36:31 -0000      1.14
+++ conf/sparc64-ieee1275.rmk   22 Oct 2006 14:35:14 -0000
@@ -30,7 +30,10 @@ kernel_syms.lst: $(addprefix include/gru
 pkgdata_PROGRAMS = kernel.elf
 
 # Utilities.
-#bin_UTILITIES = grub-emu grub-mkimage
+#bin_UTILITIES = grub-mkimage
+#ifeq ($(enable_grub_emu), yes)
+#bin_UTILITIES += grub-emu
+#endif
 
 # For grub-mkimage.
 grub_mkimage_SOURCES = util/sparc64/ieee1275/grub-mkimage.c util/misc.c \


Regards,
 Thomas

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]