diff -X excl -rduNp qemu_trunk.20070927.orig/configure qemu_trunk.20070927.ggi/configure
--- qemu_trunk.20070927.orig/configure	2007-09-27 22:47:05.000000000 +0200
+++ qemu_trunk.20070927.ggi/configure	2007-09-27 22:54:20.000000000 +0200
@@ -102,6 +102,7 @@ linux_user="no"
 darwin_user="no"
 build_docs="no"
 uname_release=""
+ggi_dir="/usr"
 
 # OS specific
 targetos=`uname -s`
@@ -245,6 +246,10 @@ for opt do
   ;;
   --static) static="yes"
   ;;
+  --disable-ggi) ggi="no"
+  ;;
+  --ggi-path=*) ggi_dir="$optarg"
+  ;;
   --disable-sdl) sdl="no"
   ;;
   --enable-coreaudio) coreaudio="yes"
@@ -390,6 +395,7 @@ echo "  --enable-darwin-user     enable 
 echo "  --disable-darwin-user    disable all darwin usermode emulation targets"
 echo "  --fmod-lib               path to FMOD library"
 echo "  --fmod-inc               path to FMOD includes"
+echo "  --ggi-path=DIR           use GGI installed in dir [$ggi_dir]"
 echo "  --enable-uname-release=R Return R for uname -r in usermode emulation"
 echo "  --sparc_cpu=V            Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
 echo ""
@@ -554,6 +560,32 @@ int main(void) {
 }
 EOF
 
+have_gcc3_options="no"
+if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
+   have_gcc3_options="yes"
+fi
+
+if test "$ggi" != "no" ; then
+##########################################
+# GGI probe
+ggi=no
+#ggi_static=no
+cat > $TMPC << EOF
+#include <ggi/ggi.h>
+int main( void ) { return (ggiInit()<0)?1:0; }
+EOF
+#not pretty, but good enough for initial testing
+GGI_INCLUDES="-I$ggi_dir/include"
+GGI_LIBS="-L$ggi_dir/lib -lggi -lgii -lgg"
+case "`uname -s`" in 
+*FreeBSD*|*OpenBSD*) GGI_LIBS="$GGI_LIBS -pthread";;
+esac
+
+if $cc -o $TMPE $GGI_INCLUDES $TMPC $GGI_LIBS 2> /dev/null ; then
+  ggi=yes
+fi
+fi # --disable-ggi
+
 ##########################################
 # SDL probe
 
@@ -682,6 +714,7 @@ echo "static build      $static"
 if test "$darwin" = "yes" ; then
     echo "Cocoa support     $cocoa"
 fi
+echo "GGI support       $ggi"
 echo "SDL support       $sdl"
 if test "$sdl" != "no" ; then
     echo "SDL static link   $sdl_static"
@@ -957,8 +990,8 @@ case "$target" in
 esac
 
 if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
-        -a "$sdl" = "no" -a "$cocoa" = "no" ; then
-    echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
+	-a "$sdl" = "no" -a "$cocoa" = "no" -a "$ggi" = "no"  ; then
+    echo "ERROR: QEMU requires SDL, Cocoa or GGI for graphical output"
     echo "To build QEMU without graphical output configure with --disable-gfx-check"
     echo "Note that this will disable all output from the virtual graphics card."
     exit 1;
@@ -1098,6 +1131,15 @@ if test "$target_user_only" = "yes" -a "
   echo "TARGET_HAS_BFLT=yes" >> $config_mak
   echo "#define TARGET_HAS_BFLT 1" >> $config_h
 fi
+
+# GGI
+if test "$ggi" = "yes" ; then
+  echo "#define CONFIG_GGI 1" >> $config_h
+  echo "CONFIG_GGI=yes" >> $config_mak
+  echo "GGI_INCLUDES= $GGI_INCLUDES" >> $config_mak
+  echo "GGI_LIBS= $GGI_LIBS" >> $config_mak
+fi
+
 # sdl defines
 
 if test "$target_user_only" = "no"; then
diff -X excl -rduNp qemu_trunk.20070927.orig/ggi.c qemu_trunk.20070927.ggi/ggi.c
--- qemu_trunk.20070927.orig/ggi.c	1970-01-01 01:00:00.000000000 +0100
+++ qemu_trunk.20070927.ggi/ggi.c	2007-09-27 22:54:20.000000000 +0200
@@ -0,0 +1,231 @@
+/* vi: set sw=4 ts=4: */
+/* Copyright (c) 2005-2006 Bernhard Fischer */
+/* #include license.bsd */
+
+#include "vl.h"
+/* both softfloat.h and ggi/system.h define the uint types.
+ * ugly workaround: */
+#define uint8 softfloat_uint8
+#define uint16 softfloat_uint16
+#define uint32 softfloat_uint32
+#define uint64 softfloat_uint64
+
+#include <ggi/gii.h> /* input handling */
+#include <ggi/ggi.h> /* output handling */
+
+#ifdef DEBUG_TRACE_GGI
+#	define trace(args...) printf(args)
+#else
+#	define trace(args...)
+#endif
+#ifdef DEBUG_GGI
+#define dbg(args...) printf(args)
+#else
+#define dbg(args...)
+#endif
+
+static ggi_visual_t v = NULL;
+static ggi_mode m;
+static const ggi_directbuffer *db;
+
+static void ggi_display_exit(void)
+{
+	trace("ggi_display_exit\n");
+	if (db) {
+		if (db->resource)
+			ggiResourceRelease(db->resource);
+	}
+	if (v)
+		ggiClose(v);
+	ggiExit();
+}
+
+static void ggi_update_vis(DisplayState *ds, int x, int y, int w, int h)
+{
+	trace("ggi_update_vis x=%d y=%d w=%d h=%d\n", x, y, w, h);
+	ggiFlushRegion(v, x, y, w, h);
+}
+
+static void _ggi_get_directbuf(DisplayState *ds)
+{
+	int err;
+
+	if (!(db = ggiDBGetBuffer(v, 0))) {
+		fprintf(stderr, "Failed to acquire directbuffer.\n");
+		ggi_display_exit();
+	}
+	if (!(db->type & GGI_DB_SIMPLE_PLB)) {
+		fprintf(stderr, "Error: non-standard display buffer.\n");
+		ggi_display_exit();
+	}
+
+	if ((err=ggiResourceAcquire(db->resource, GGI_ACTYPE_WRITE))) {
+		fprintf(stderr, "Error acquiring directbuffer. (%d)\n", err);
+		ggi_display_exit();
+	}
+	ds->data = db->write;
+	ds->linesize = db->buffer.plb.stride;
+	ds->depth = GT_SIZE(m.graphtype);
+	ds->width = m.visible.x;
+	ds->height = m.visible.y;
+}
+
+static void ggi_resize_vis(DisplayState *ds, int w, int h)
+{
+	ggi_mode newmode;
+	int err;
+
+	trace("ggi_resize_vis w=%d h=%d\n", w, h);
+	ggiGetMode(v, &newmode);
+	newmode.visible.x = w;
+	newmode.visible.y = h;
+
+	ggiCheckMode(v, &newmode);
+#ifdef DEBUG_GGI
+	fprintf(stderr, "Using mode: ");
+	ggiFPrintMode(stderr, &newmode);
+	fprintf(stderr, "\n");
+#endif
+	if (db) {
+		if (db->resource)
+			ggiResourceRelease(db->resource);
+	}
+
+	err = ggiSetMode(v, &newmode);
+	if (err) {
+		fprintf(stderr, "Failed to set a video mode. (%d)\n", err);
+		ggi_display_exit();
+	}
+	ggiGetMode(v, &m);
+	_ggi_get_directbuf(ds);
+}
+
+static void _process_input(int count);
+
+static void ggi_refresh_vis(DisplayState *ds)
+{
+	int count;
+	struct timeval tv = {0,100};
+	trace("ggi_refresh_vis\n");
+	vga_hw_update();
+
+    ggiEventPoll(v, emKey|emPointer, &tv);
+	if ((count=ggiEventsQueued(v, emKey | emPointer | emExpose)))
+		_process_input(count);
+}
+
+static void _kbd_layout_init(void);
+
+void ggi_display_init(DisplayState *ds, int full_screen)
+{
+	int err;
+
+	trace("ggi_display_init\n");
+	_kbd_layout_init();
+	if ((err=ggiInit()) < 0) {
+		fprintf(stderr, "Failed to initialize ggi (%i)\n", err);
+		exit(1);
+	}
+	if (!(v = ggiOpen(NULL)))
+		ggiPanic("Unable to open default visual, exiting.\n");
+
+	ggiSetFlags(v, GGIFLAG_ASYNC);
+	if (!(err=ggiSetEventMask(v, emKey | emPointer)))
+		fprintf(stderr, "Failed to set eventmask for input, continuing. (%i)\n",
+				err);
+	ggiCheckSimpleMode(v, 640, 400, GGI_AUTO, GT_AUTO, &m);
+#ifdef DEBUG_GGI
+	fprintf(stderr, "Suggested mode: ");
+	ggiFPrintMode(stderr, &m);
+	fprintf(stderr, "\n");
+#endif
+	if ((err = ggiSetMode(v, &m))) {
+		fprintf(stderr, "Failed to set a video mode. (%d)\n", err);
+		ggi_display_exit();
+	}
+	ggiGetMode(v, &m);
+
+	ds->dpy_update = ggi_update_vis;
+	ds->dpy_resize = ggi_resize_vis;
+	ds->dpy_refresh = ggi_refresh_vis;
+
+	_ggi_get_directbuf(ds);
+
+	atexit(ggi_display_exit);
+}
+
+/* input handling */
+#include "ggi_keysym.h"
+
+#include "keymaps.c"
+static kbd_layout_t *kbd_layout = NULL;
+
+static void _kbd_layout_init(void)
+{
+	if (keyboard_layout) {
+		kbd_layout = init_keyboard_layout(keyboard_layout);
+		if (!kbd_layout) {
+			fprintf(stderr, "Failed to initialize keyboard layout, exiting.\n");
+			exit(1);
+		}
+	}
+}
+
+static void _process_input(int count) {
+	ggi_event ev;
+	int key, scan, pbutton, px, py, pz;
+	trace("_process_input\n");
+	while (count--) {
+		ggiEventRead(v, &ev, emKey | emPointer);
+
+		switch (ev.any.type) {
+		case evKeyPress:
+		case evKeyRepeat:
+		case evKeyRelease:
+			key = ev.key.button;
+			scan = kbd_layout ? keysym2scancode(kbd_layout, ev.key.sym) :
+					(key<89)?(key):_translate_keycode(key-89);
+			if (ev.key.sym == GIIK_Pause) {
+				key = (ev.any.type == evKeyRelease) ? GII_KM_LOCK : 0;
+				kbd_put_keycode(GII_KT_FN);
+				kbd_put_keycode(0x1d | key);
+				kbd_put_keycode(GIIUC_E);
+				return;
+			} else {
+				if (scan & 0x80)
+					kbd_put_keycode(GII_KT_SPEC);
+
+				if (ev.any.type == evKeyRelease)
+					kbd_put_keycode(scan | 0x80);
+				else
+					kbd_put_keycode(scan & 0x7f);
+			}
+			break;
+#if 1
+		case evPtrAbsolute:
+		case evPtrButtonPress:
+		case evPtrButtonRelease:
+			px = ev.pmove.x;
+			py = ev.pmove.y;
+			pz = ev.pmove.z;
+
+			pbutton = ev.pbutton.button;
+fprintf(stderr, "### mouse: %d, %d, %d, %d(0x%x)\n",
+		px, py, pz, pbutton, pbutton);
+			kbd_mouse_event(px, py, pz, pbutton);
+			break;
+		case evPtrRelative:
+			px = ev.pmove.x;
+			py = ev.pmove.y;
+			pz = ev.pmove.z;
+			pbutton = ev.pbutton.button;
+fprintf(stderr, "### rel mouse: %d, %d, %d, %d(0x%x)\n",
+		px, py, pz, pbutton, pbutton);
+			break;
+#endif
+		default:
+fprintf(stderr, "\ttype non key\n");
+			break;
+		}
+	};
+}
diff -X excl -rduNp qemu_trunk.20070927.orig/ggi_keysym.h qemu_trunk.20070927.ggi/ggi_keysym.h
--- qemu_trunk.20070927.orig/ggi_keysym.h	1970-01-01 01:00:00.000000000 +0100
+++ qemu_trunk.20070927.ggi/ggi_keysym.h	2007-09-27 22:54:20.000000000 +0200
@@ -0,0 +1,277 @@
+/* vi: set sw=4 ts=4: */
+typedef struct {
+	const char *name;
+	int keysym;
+} name2keysym_t;
+static name2keysym_t name2keysym [] = {
+	/* ascii */
+    { "space",                0x020},
+    { "exclam",               0x021},
+    { "quotedbl",             0x022},
+    { "numbersign",           0x023},
+    { "dollar",               0x024},
+    { "percent",              0x025},
+    { "ampersand",            0x026},
+    { "apostrophe",           0x027},
+    { "parenleft",            0x028},
+    { "parenright",           0x029},
+    { "asterisk",             0x02a},
+    { "plus",                 0x02b},
+    { "comma",                0x02c},
+    { "minus",                0x02d},
+    { "period",               0x02e},
+    { "slash",                0x02f},
+    { "0",                    0x030},
+    { "1",                    0x031},
+    { "2",                    0x032},
+    { "3",                    0x033},
+    { "4",                    0x034},
+    { "5",                    0x035},
+    { "6",                    0x036},
+    { "7",                    0x037},
+    { "8",                    0x038},
+    { "9",                    0x039},
+    { "colon",                0x03a},
+    { "semicolon",            0x03b},
+    { "less",                 0x03c},
+    { "equal",                0x03d},
+    { "greater",              0x03e},
+    { "question",             0x03f},
+    { "at",                   0x040},
+    { "A",                    0x041},
+    { "B",                    0x042},
+    { "C",                    0x043},
+    { "D",                    0x044},
+    { "E",                    0x045},
+    { "F",                    0x046},
+    { "G",                    0x047},
+    { "H",                    0x048},
+    { "I",                    0x049},
+    { "J",                    0x04a},
+    { "K",                    0x04b},
+    { "L",                    0x04c},
+    { "M",                    0x04d},
+    { "N",                    0x04e},
+    { "O",                    0x04f},
+    { "P",                    0x050},
+    { "Q",                    0x051},
+    { "R",                    0x052},
+    { "S",                    0x053},
+    { "T",                    0x054},
+    { "U",                    0x055},
+    { "V",                    0x056},
+    { "W",                    0x057},
+    { "X",                    0x058},
+    { "Y",                    0x059},
+    { "Z",                    0x05a},
+    { "bracketleft",          0x05b},
+    { "backslash",            0x05c},
+    { "bracketright",         0x05d},
+    { "asciicircum",          0x05e},
+    { "underscore",           0x05f},
+    { "grave",                0x060},
+    { "a",                    0x061},
+    { "b",                    0x062},
+    { "c",                    0x063},
+    { "d",                    0x064},
+    { "e",                    0x065},
+    { "f",                    0x066},
+    { "g",                    0x067},
+    { "h",                    0x068},
+    { "i",                    0x069},
+    { "j",                    0x06a},
+    { "k",                    0x06b},
+    { "l",                    0x06c},
+    { "m",                    0x06d},
+    { "n",                    0x06e},
+    { "o",                    0x06f},
+    { "p",                    0x070},
+    { "q",                    0x071},
+    { "r",                    0x072},
+    { "s",                    0x073},
+    { "t",                    0x074},
+    { "u",                    0x075},
+    { "v",                    0x076},
+    { "w",                    0x077},
+    { "x",                    0x078},
+    { "y",                    0x079},
+    { "z",                    0x07a},
+    { "braceleft",            0x07b},
+    { "bar",                  0x07c},
+    { "braceright",           0x07d},
+    { "asciitilde",           0x07e},
+	/* latin1 */
+	{ "nobreakspace",         0x0a0},
+	{ "exclamdown",           0x0a1},
+	{ "cent",                 0x0a2},
+	{ "sterling",             0x0a3},
+	{ "currency",             0x0a4},
+	{ "yen",                  0x0a5},
+	{ "brokenbar",            0x0a6},
+	{ "section",              0x0a7},
+	{ "diaeresis",            0x0a8},
+	{ "copyright",            0x0a9},
+	{ "ordfeminine",          0x0aa},
+	{ "guillemotleft",        0x0ab},
+	{ "notsign",              0x0ac},
+	{ "hyphen",               0x0ad},
+	{ "registered",           0x0ae},
+	{ "macron",               0x0af},
+	{ "degree",               0x0b0},
+	{ "plusminus",            0x0b1},
+	{ "twosuperior",          0x0b2},
+	{ "threesuperior",        0x0b3},
+	{ "acute",                0x0b4},
+	{ "mu",                   0x0b5},
+	{ "paragraph",            0x0b6},
+	{ "periodcentered",       0x0b7},
+	{ "cedilla",              0x0b8},
+	{ "onesuperior",          0x0b9},
+	{ "masculine",            0x0ba},
+	{ "guillemotright",       0x0bb},
+	{ "onequarter",           0x0bc},
+	{ "onehalf",              0x0bd},
+	{ "threequarters",        0x0be},
+	{ "questiondown",         0x0bf},
+	{ "Agrave",               0x0c0},
+	{ "Aacute",               0x0c1},
+	{ "Acircumflex",          0x0c2},
+	{ "Atilde",               0x0c3},
+	{ "Adiaeresis",           0x0c4},
+	{ "Aring",                0x0c5},
+	{ "AE",                   0x0c6},
+	{ "Ccedilla",             0x0c7},
+	{ "Egrave",               0x0c8},
+	{ "Eacute",               0x0c9},
+	{ "Ecircumflex",          0x0ca},
+	{ "Ediaeresis",           0x0cb},
+	{ "Igrave",               0x0cc},
+	{ "Iacute",               0x0cd},
+	{ "Icircumflex",          0x0ce},
+	{ "Idiaeresis",           0x0cf},
+	{ "ETH",                  0x0d0},
+	{ "Eth",                  0x0d0},
+	{ "Ntilde",               0x0d1},
+	{ "Ograve",               0x0d2},
+	{ "Oacute",               0x0d3},
+	{ "Ocircumflex",          0x0d4},
+	{ "Otilde",               0x0d5},
+	{ "Odiaeresis",           0x0d6},
+	{ "multiply",             0x0d7},
+	{ "Ooblique",             0x0d8},
+	{ "Oslash",               0x0d8},
+	{ "Ugrave",               0x0d9},
+	{ "Uacute",               0x0da},
+	{ "Ucircumflex",          0x0db},
+	{ "Udiaeresis",           0x0dc},
+	{ "Yacute",               0x0dd},
+	{ "THORN",                0x0de},
+	{ "Thorn",                0x0de},
+	{ "ssharp",               0x0df},
+	{ "agrave",               0x0e0},
+	{ "aacute",               0x0e1},
+	{ "acircumflex",          0x0e2},
+	{ "atilde",               0x0e3},
+	{ "adiaeresis",           0x0e4},
+	{ "aring",                0x0e5},
+	{ "ae",                   0x0e6},
+	{ "ccedilla",             0x0e7},
+	{ "egrave",               0x0e8},
+	{ "eacute",               0x0e9},
+	{ "ecircumflex",          0x0ea},
+	{ "ediaeresis",           0x0eb},
+	{ "igrave",               0x0ec},
+	{ "iacute",               0x0ed},
+	{ "icircumflex",          0x0ee},
+	{ "idiaeresis",           0x0ef},
+	{ "eth",                  0x0f0},
+	{ "ntilde",               0x0f1},
+	{ "ograve",               0x0f2},
+	{ "oacute",               0x0f3},
+	{ "ocircumflex",          0x0f4},
+	{ "otilde",               0x0f5},
+	{ "odiaeresis",           0x0f6},
+	{ "division",             0x0f7},
+	{ "oslash",               0x0f8},
+	{ "ooblique",             0x0f8},
+	{ "ugrave",               0x0f9},
+	{ "uacute",               0x0fa},
+	{ "ucircumflex",          0x0fb},
+	{ "udiaeresis",           0x0fc},
+	{ "yacute",               0x0fd},
+	{ "thorn",                0x0fe},
+	{ "ydiaeresis",           0x0ff},
+	{"EuroSign", 00},
+	/* modifiers */
+	{"Control_L", GIIK_CtrlL},
+	{"Control_R", GIIK_CtrlR},
+	{"Alt_L", GIIK_AltL},
+	{"Alt_R", GIIK_AltR},
+	{"Caps_Lock", GIIK_Caps},
+	{"Meta_L", GIIK_MetaL},
+	{"Meta_R", GIIK_MetaR},
+	{"Shift_L", GIIK_ShiftL},
+	{"Shift_R", GIIK_ShiftR},
+	{"Super_L", GIIK_SuperL},
+	{"Super_R", GIIK_SuperR},
+
+    /* special */
+	{"BackSpace", GIIUC_BackSpace},
+	{"Tab", GIIUC_Tab},
+	{"Return", GIIUC_Return},
+	{"Right", GIIK_Right},
+	{"Left", GIIK_Left},
+	{"Up", GIIK_Up},
+	{"Down", GIIK_Down},
+	{"Page_Down", GIIK_PageDown},
+	{"Page_Up", GIIK_PageUp},
+	{"Insert", GIIK_Insert},
+	{"Delete", GIIK_Delete},
+	{"Home", GIIK_Home},
+	{"End", GIIK_End},
+	{"Scroll_Lock", GIIK_ScrollLock},
+	{"F1", GIIK_F1},
+	{"F2", GIIK_F2},
+	{"F3", GIIK_F3},
+	{"F4", GIIK_F4},
+	{"F5", GIIK_F5},
+	{"F6", GIIK_F6},
+	{"F7", GIIK_F7},
+	{"F8", GIIK_F8},
+	{"F9", GIIK_F9},
+	{"F10", GIIK_F10},
+	{"F11", GIIK_F11},
+	{"F12", GIIK_F12},
+	{"F13", GIIK_F13},
+	{"F14", GIIK_F14},
+	{"F15", GIIK_F15},
+	{"Sys_Req", GIIK_SysRq},
+	{"KP_0", GIIK_P0},
+	{"KP_1", GIIK_P1},
+	{"KP_2", GIIK_P2},
+	{"KP_3", GIIK_P3},
+	{"KP_4", GIIK_P4},
+	{"KP_5", GIIK_P5},
+	{"KP_6", GIIK_P6},
+	{"KP_7", GIIK_P7},
+	{"KP_8", GIIK_P8},
+	{"KP_9", GIIK_P9},
+	{"KP_Add", GIIK_PPlus},
+	{"KP_Decimal", GIIK_PSeparator},
+	{"KP_Divide", GIIK_PSlash},
+	{"KP_Enter", GIIK_PEnter},
+	{"KP_Equal", GIIK_PEqual},
+	{"KP_Multiply", GIIK_PAsterisk},
+	{"KP_Subtract", GIIK_PMinus},
+	{"help", GIIK_Help},
+	{"Menu", GIIK_Menu},
+{"Power", GIIK_Boot},
+	{"Print", GIIK_PrintScreen},
+	{"Mode_switch", GIIK_ModeSwitch},
+	{"Multi_Key", GIIK_Compose},
+	{"Num_Lock", GIIK_Num},
+	{"Pause", GIIK_Pause},
+	{"Escape", GIIUC_Escape},
+
+	{NULL,0}
+};
diff -X excl -rduNp qemu_trunk.20070927.orig/Makefile.target qemu_trunk.20070927.ggi/Makefile.target
--- qemu_trunk.20070927.orig/Makefile.target	2007-09-27 22:47:05.000000000 +0200
+++ qemu_trunk.20070927.ggi/Makefile.target	2007-09-27 22:54:20.000000000 +0200
@@ -485,6 +485,9 @@ endif
 ifdef CONFIG_GDBSTUB
 VL_OBJS+=gdbstub.o
 endif
+ifdef CONFIG_GGI
+VL_OBJS+=ggi.o x_keymap.o
+endif
 ifdef CONFIG_SDL
 VL_OBJS+=sdl.o x_keymap.o
 endif
@@ -541,7 +544,12 @@ SDL_LIBS := $(filter-out -mwindows, $(SD
 endif
 
 $(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
-	$(CC) $(VL_LDFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
+	$(CC) $(VL_LDFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS) $(GGI_LIBS)
+
+CPPFLAGS+= -DDEBUG_GGI -DDEBUG_TRACE_GGI -DDEBUG_MOUSE #-DDEBUG_KBD -DDEBUG -DDEBUG_GDB
+
+ggi.o: ggi.c keymaps.c ggi_keysym.h x_keymap.c
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $(GGI_INCLUDES) -c -o $@ $<
 
 cocoa.o: cocoa.m
 	$(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
diff -X excl -rduNp qemu_trunk.20070927.orig/vl.c qemu_trunk.20070927.ggi/vl.c
--- qemu_trunk.20070927.orig/vl.c	2007-09-27 22:47:07.000000000 +0200
+++ qemu_trunk.20070927.ggi/vl.c	2007-09-27 22:54:20.000000000 +0200
@@ -8331,7 +8331,9 @@ int main(int argc, char **argv)
         if (vnc_display_open(ds, vnc_display) < 0)
             exit(1);
     } else {
-#if defined(CONFIG_SDL)
+#if defined(CONFIG_GGI)
+        ggi_display_init(ds, full_screen);
+#elif defined(CONFIG_SDL)
         sdl_display_init(ds, full_screen, no_frame);
 #elif defined(CONFIG_COCOA)
         cocoa_display_init(ds, full_screen);
diff -X excl -rduNp qemu_trunk.20070927.orig/vl.h qemu_trunk.20070927.ggi/vl.h
--- qemu_trunk.20070927.orig/vl.h	2007-09-27 22:47:07.000000000 +0200
+++ qemu_trunk.20070927.ggi/vl.h	2007-09-27 22:54:20.000000000 +0200
@@ -969,6 +969,10 @@ void isa_cirrus_vga_init(DisplayState *d
 void pci_vmsvga_init(PCIBus *bus, DisplayState *ds, uint8_t *vga_ram_base,
                      unsigned long vga_ram_offset, int vga_ram_size);
 
+#ifdef CONFIG_GGI
+void ggi_display_init(DisplayState *ds, int full_screen);
+#endif
+
 /* sdl.c */
 void sdl_display_init(DisplayState *ds, int full_screen, int no_frame);
 
