All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Schwinge <tschwinge@gnu.org>
To: grub-devel@gnu.org
Subject: Conditionally building `grub-emu'
Date: Sun, 22 Oct 2006 16:46:51 +0200	[thread overview]
Message-ID: <20061022144651.GD6928@fencepost> (raw)

[-- Attachment #1: Type: text/plain, Size: 7613 bytes --]

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  <tschwinge@gnu.org>

	* 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 #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

             reply	other threads:[~2006-10-22 14:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-22 14:46 Thomas Schwinge [this message]
2006-10-26 18:59 ` Conditionally building `grub-emu' Hollis Blanchard
2006-10-28 13:47 ` Yoshinori K. Okuji
2006-10-28 15:32   ` Thomas Schwinge
2006-12-13 13:31   ` Thomas Schwinge
2006-12-13 21:46     ` Yoshinori K. Okuji
2006-12-13 22:35       ` Thomas Schwinge
2006-12-14 12:19 ` Marco Gerards
2006-12-15  9:40   ` Thomas Schwinge

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061022144651.GD6928@fencepost \
    --to=tschwinge@gnu.org \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.