Subject: qemu under NetBSD/MacPPC [PATCH]
To: None <tech-pkg@netbsd.org>
From: Luciano Rodrigues Furtado <lrfurtado@yahoo.com.br>
List: tech-pkg
Date: 04/14/2006 20:54:35
I had to use the following patches to get qemu working on NetBSD/MacPPC, 
dont know if this was the best approach but with them qemu builds and runs.

$NetBSD$

--- configure.orig      2005-12-19 22:51:53.000000000 +0000
+++ configure
@@ -41,7 +41,7 @@ case "$cpu" in
    alpha)
      cpu="alpha"
    ;;
-  "Power Macintosh"|ppc|ppc64)
+  "Power Macintosh"|ppc|ppc64|macppc)
      cpu="powerpc"
    ;;
    mips)
@@ -400,7 +400,7 @@ else
  if test -z "$prefix" ; then
      prefix="/usr/local"
  fi
-mandir="$prefix/share/man"
+mandir="$prefix/man"
  datadir="$prefix/share/qemu"
  docdir="$prefix/share/doc/qemu"
  bindir="$prefix/bin"
@@ -583,6 +583,8 @@ if test "$mingw32" = "yes" ; then
    echo "#define CONFIG_WIN32 1" >> $config_h
  elif test -f "/usr/include/byteswap.h" ; then
    echo "#define HAVE_BYTESWAP_H 1" >> $config_h
+elif test -f "/usr/include/machine/bswap.h" ; then
+  echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
  fi
  if test "$darwin" = "yes" ; then
    echo "CONFIG_DARWIN=yes" >> $config_mak



NetBSD$

--- dyngen.c.orig       2005-12-19 22:51:53.000000000 +0000
+++ dyngen.c
@@ -1587,6 +1587,7 @@ void gen_code(const char *name, host_ulo
                  if(!sym_name)
                      continue;
                  if (*sym_name &&
+                    !strstart(sym_name, "bswap64", NULL) && /* HF hack */
                      !strstart(sym_name, "__op_param", NULL) &&
                      !strstart(sym_name, "__op_jmp", NULL) &&
                      !strstart(sym_name, "__op_gen_label", NULL)) {
@@ -1610,6 +1611,10 @@ void gen_code(const char *name, host_ulo
                                  */
                                 fprintf(outfile, "    extern char %s;\n",
                                         sym_name);
+
+#elif defined(HOST_PPC)
+                   if(strcmp("bswap32", sym_name))
+                       fprintf(outfile, "extern char %s;\n", sym_name);
  #else
                      fprintf(outfile, "extern char %s;\n", sym_name);
  #endif