It looks like grub2's codebase triggers bugs in old compiler. I don't
feel like we should support these compilers at all. Hence this patch.
If someone wants to use older compiler he's free to patch this check
out but this way he's aware that we don't support gcc prior to 4.2

-- 
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
diff --git a/ChangeLog b/ChangeLog
index 84dd6e4..916f581 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-09-01  Vladimir Serbinenko  <phco...@gmail.com>
+
+       Remove gcc < 4.2 support.
+
+       * configure.ac (grub_cv_cc_recent): New check.
+
 2009-08-30  Vladimir Serbinenko  <phco...@gmail.com>
 
        * kern/file.c (grub_file_read): Spelling fix
diff --git a/configure.ac b/configure.ac
index cddd9fe..cb389a5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -213,6 +213,15 @@ CPPFLAGS="$TARGET_CPPFLAGS"
 LDFLAGS="$TARGET_LDFLAGS"
 LIBS=""
 
+AC_CACHE_CHECK([whether gcc is recent enough], grub_cv_cc_recent, [
+  CFLAGS=
+  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#if defined (__GNUC__) && (__GNUC__ < 4 || __GNUC_MINOR__ < 2)
+#error Use at least GCC 4.2
+#endif
+]], [[]])],[grub_cv_cc_recent=yes],[grub_cv_cc_recent=no]) ])
+test "x$grub_cv_cc_recent" = xyes || AC_MSG_ERROR([GCC >= 4.2 is required])
+
 if test "x$TARGET_CFLAGS" = x; then
   # debug flags.
   TARGET_CFLAGS="-Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes \
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to