All of lore.kernel.org
 help / color / mirror / Atom feed
* Patch for successful compilation on FreeBSD Release-6.1
@ 2006-06-11 15:28 Harley D. Eades III
  2006-06-11 19:10 ` Jeroen Dekkers
  0 siblings, 1 reply; 10+ messages in thread
From: Harley D. Eades III @ 2006-06-11 15:28 UTC (permalink / raw)
  To: grub-devel

Hello,
        I managed to work up a small patch for grub2.  She makes it
        possible to build grub2 on FreeBSD Release-6.1.  There is one
        thing I am not sure on. In configure.ac I had to move the
        lines which restore the compiler flags above the checks for
        _start etc..see the patch.  I would like as much
        feedback as possible.  Thanks. :)



2006-06-10  Harley D. Eades III  <hde@gnu.org>

        * configure.ac: Check for <malloc.h>.  Check for memalign().
        * include/grub/util/misc.h: Include <unistd.h>.
        * util/grub-emu.c [HAVE_MALLOC_H]: Include <malloc.h>.
        * util/misc.c: Likewise.
        (grub_memalign) [!HAVE_MEMALIGN]: Don't call memalign, but
        generate an error instead.

diff --exclude=CVS --exclude=configure --exclude=config.log
--exclude=config.h.in -ru grub2/configure.ac grub2Hacked/configure.ac
--- grub2/configure.ac  Mon May 29 19:32:29 2006
+++ grub2Hacked/configure.ac    Mon Jun  5 15:50:36 2006
@@ -122,6 +122,15 @@
 AC_CHECK_SIZEOF(void *)
 AC_CHECK_SIZEOF(long)
 
+# BSD checks. 
+AC_CHECK_HEADER([malloc.h],
+               [AC_DEFINE(HAVE_MALLOC_H, [], 
+               [Define to 1 if you have the malloc.h header file.])],
,)
+
+AC_CHECK_FUNC([memalign], 
+             [AC_DEFINE(HAVE_MEMALIGN, [], 
+             [Define to 1 if you have the memalign function.])], ,)
+
 if test "x$host_m32" = x1; then
   # Force 32-bit mode.
   CFLAGS="$CFLAGS -m32"
@@ -232,6 +241,12 @@
 AC_SUBST(TARGET_CPPFLAGS)
 AC_SUBST(TARGET_LDFLAGS)
 
+# Restore the flags.
+CC="$tmp_CC"
+CFLAGS="$tmp_CFLAGS"
+CPPFLAGS="$tmp_CPPFLAGS"
+LDFLAGS="$tmp_LDFLAGS"
+
 # Defined in aclocal.m4.
 grub_PROG_OBJCOPY_ABSOLUTE
 grub_ASM_USCORE
@@ -246,12 +261,6 @@
 else
   AC_DEFINE([NESTED_FUNC_ATTR], [], [Catch gcc bug])
 fi
-
-# Restore the flags.
-CC="$tmp_CC"
-CFLAGS="$tmp_CFLAGS"
-CPPFLAGS="$tmp_CPPFLAGS"
-LDFLAGS="$tmp_LDFLAGS"
 
 # Check for options.
 AC_ARG_ENABLE([mm-debug], 
diff --exclude=CVS --exclude=configure --exclude=config.log
 --exclude=config.h.in -ru grub2/include/grub/util/misc.h
 grub2Hacked/include/grub/util/misc.h
--- grub2/include/grub/util/misc.h      Mon Feb 14 18:07:01 2005
+++ grub2Hacked/include/grub/util/misc.h        Mon Jun  5 15:25:38
 2006
@@ -23,6 +23,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <setjmp.h>
+#include <unistd.h>
 
 extern char *progname;
 extern int verbosity;
diff --exclude=CVS --exclude=configure --exclude=config.log
 --exclude=config.h.in -ru grub2/util/grub-emu.c
 grub2Hacked/util/grub-emu.c
--- grub2/util/grub-emu.c       Wed Apr 26 16:58:36 2006
+++ grub2Hacked/util/grub-emu.c Mon Jun  5 15:26:30 2006
@@ -18,7 +18,11 @@
  */
 
 #include <stdlib.h>
+
+#ifdef HAVE_MALLOC_H
 #include <malloc.h>
+#endif
+
 #include <sys/stat.h>
 #include <argp.h>
 #include <string.h>
diff --exclude=CVS --exclude=configure --exclude=config.log
--exclude=config.h.in -ru grub2/util/misc.c grub2Hacked/util/misc.c
--- grub2/util/misc.c   Sun Apr 23 08:37:36 2006
+++ grub2Hacked/util/misc.c     Mon Jun  5 15:28:12 2006
@@ -24,7 +24,11 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/time.h>
+
+#ifdef HAVE_MALLOC_H
 #include <malloc.h>
+#endif 
+
 #include <unistd.h>
 
 #include <grub/util/misc.h>
@@ -228,8 +232,13 @@
 grub_memalign (grub_size_t align, grub_size_t size)
 {
   void *p;
-  
+
+#ifdef HAVE_MEMALIGN
   p = memalign (align, size);
+#else
+  grub_util_error ("memalign not available");
+#endif
+  
   if (! p)
     grub_util_error ("out of memory");



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2006-06-14  1:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-11 15:28 Patch for successful compilation on FreeBSD Release-6.1 Harley D. Eades III
2006-06-11 19:10 ` Jeroen Dekkers
2006-06-11 19:27   ` Harley D. Eades III
2006-06-12 15:31     ` Harley D. Eades III
2006-06-12 16:39       ` Marco Gerards
2006-06-13 18:01       ` Yoshinori K. Okuji
2006-06-13 21:52         ` Harley D. Eades III
2006-06-13 22:53           ` Yoshinori K. Okuji
2006-06-14  1:23             ` Harley D. Eades III
2006-06-14  1:46               ` Harley D. Eades III

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.