--- a/config.mk	2012-11-11 20:09:21.174319764 +0100
+++ b/config.mk	2012-11-11 19:36:25.990617582 +0100
@@ -10,13 +10,17 @@
 X11INC = /usr/X11R6/include
 X11LIB = /usr/X11R6/lib
 
+#Xft
+#XFTINC  = /usr/include/freetype2
+#XFTLIBS = -lutil -lXext -lXft -lfontconfig
+
 # Xinerama, comment if you don't want it
 XINERAMALIBS  = -lXinerama
 XINERAMAFLAGS = -DXINERAMA
 
 # includes and libs
-INCS = -I${X11INC} -I/usr/include/freetype2
-LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} -lutil -lXext -lXft -lfontconfig
+INCS = -I${X11INC} -I${XFTINC}
+LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${XFTLIBS}
 
 # flags
 CPPFLAGS = -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}

--- a/dwm.c	2012-11-11 20:46:08.738079237 +0100
+++ b/dwm.c	2012-11-11 20:45:51.781409248 +0100
@@ -37,8 +37,10 @@
 #include <X11/Xproto.h>
 #include <X11/Xutil.h>
 #include <X11/XKBlib.h>
+#ifdef XFT
 #include <fontconfig/fontconfig.h>
 #include <X11/Xft/Xft.h>
+#endif /* XFT */
 #ifdef XINERAMA
 #include <X11/extensions/Xinerama.h>
 #endif /* XINERAMA */
@@ -102,15 +104,25 @@
 
 typedef struct {
 	int x, y, w, h;
+#ifdef XFT
 	XftColor norm[ColLast];
 	XftColor sel[ColLast];
+#else
+	unsigned long norm[ColLast];
+	unsigned long sel[ColLast];
+#endif
 	Drawable drawable;
 	GC gc;
 	struct {
 		int ascent;
 		int descent;
 		int height;
+#ifdef XFT
 		XftFont *xfont;
+#else
+		XFontSet set;
+		XFontStruct *xfont;
+#endif
 	} font;
 } DC; /* draw context */
 
@@ -180,15 +192,24 @@
 static Monitor *dirtomon(int dir);
 static void drawbar(Monitor *m);
 static void drawbars(void);
+#ifdef XFT
 static void drawsquare(Bool filled, Bool empty, Bool invert, XftColor col[ColLast]);
 static void drawtext(const char *text, XftColor col[ColLast], Bool invert);
+#else
+static void drawsquare(Bool filled, Bool empty, Bool invert, unsigned long col[ColLast]);
+static void drawtext(const char *text, unsigned long col[ColLast], Bool invert);
+#endif
 static void enternotify(XEvent *e);
 static void expose(XEvent *e);
 static void focus(Client *c);
 static void focusin(XEvent *e);
 static void focusmon(const Arg *arg);
 static void focusstack(const Arg *arg);
+#ifdef XFT
 static XftColor getcolor(const char *colstr);
+#else
+static unsigned long getcolor(const char *colstr);
+#endif
 static Bool getrootptr(int *x, int *y);
 static long getstate(Window w);
 static Bool gettextprop(Window w, Atom atom, char *text, unsigned int size);
@@ -488,6 +509,13 @@
 	for(m = mons; m; m = m->next)
 		while(m->stack)
 			unmanage(m->stack, False);
+#ifdef XFT
+#else
+	if(dc.font.set)
+		XFreeFontSet(dpy, dc.font.set);
+	else
+		XFreeFont(dpy, dc.font.xfont);
+#endif
 	XUngrabKey(dpy, AnyKey, AnyModifier, root);
 	XFreePixmap(dpy, dc.drawable);
 	XFreeGC(dpy, dc.gc);
@@ -720,7 +748,11 @@
 drawbar(Monitor *m) {
 	int x;
 	unsigned int i, occ = 0, urg = 0;
+#ifdef XFT
 	XftColor *col;
+#else
+	unsigned long *col;
+#endif
 	Client *c;
 
 	for(c = m->clients; c; c = c->next) {
@@ -775,10 +807,18 @@
 }
 
 void
+#ifdef XFT
 drawsquare(Bool filled, Bool empty, Bool invert, XftColor col[ColLast]) {
+#else
+drawsquare(Bool filled, Bool empty, Bool invert, unsigned long col[ColLast]) {
+#endif
 	int x;
 
+#ifdef XFT
 	XSetForeground(dpy, dc.gc, col[invert ? ColBG : ColFG].pixel);
+#else
+	XSetForeground(dpy, dc.gc, col[invert ? ColBG : ColFG]);
+#endif
 	x = (dc.font.ascent + dc.font.descent + 2) / 4;
 	if(filled)
 		XFillRectangle(dpy, dc.drawable, dc.gc, dc.x+1, dc.y+1, x+1, x+1);
@@ -787,12 +827,22 @@
 }
 
 void
+#ifdef XFT
 drawtext(const char *text, XftColor col[ColLast], Bool invert) {
+#else
+drawtext(const char *text, unsigned long col[ColLast], Bool invert) {
+#endif
 	char buf[256];
 	int i, x, y, h, len, olen;
+#ifdef XFT
 	XftDraw *d;
+#endif
 
+#ifdef XFT
 	XSetForeground(dpy, dc.gc, col[invert ? ColFG : ColBG].pixel);
+#else
+	XSetForeground(dpy, dc.gc, col[invert ? ColFG : ColBG]);
+#endif
 	XFillRectangle(dpy, dc.drawable, dc.gc, dc.x, dc.y, dc.w, dc.h);
 	if(!text)
 		return;
@@ -807,11 +857,19 @@
 	memcpy(buf, text, len);
 	if(len < olen)
 		for(i = len; i && i > len - 3; buf[--i] = '.');
+#ifdef XFT
 
 	d = XftDrawCreate(dpy, dc.drawable, DefaultVisual(dpy, screen), DefaultColormap(dpy,screen));
 
 	XftDrawStringUtf8(d, &col[invert ? ColBG : ColFG], dc.font.xfont, x, y, (XftChar8 *) buf, len);
 	XftDrawDestroy(d);
+#else
+	XSetForeground(dpy, dc.gc, col[invert ? ColBG : ColFG]);
+	if(dc.font.set)
+		XmbDrawString(dpy, dc.drawable, dc.font.set, dc.gc, x, y, buf, len);
+	else
+		XDrawString(dpy, dc.drawable, dc.gc, x, y, buf, len);
+#endif
 }
 
 void
@@ -857,7 +915,11 @@
 		detachstack(c);
 		attachstack(c);
 		grabbuttons(c, True);
+#ifdef XFT
 		XSetWindowBorder(dpy, c->win, dc.sel[ColBorder].pixel);
+#else
+		XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]);
+#endif
 		setfocus(c);
 	}
 	else {
@@ -931,14 +993,32 @@
 	return atom;
 }
 
+#ifdef XFT
 XftColor 
+#else
+unsigned long
+#endif
 getcolor(const char *colstr) {
+#ifdef XFT
 	XftColor color;
+#else
+	Colormap cmap = DefaultColormap(dpy, screen);
+	XColor color;
+#endif
 
+#ifdef XFT
 	if(!XftColorAllocName(dpy, DefaultVisual(dpy, screen), DefaultColormap(dpy, screen), colstr, &color))
+#else
+	if(!XAllocNamedColor(dpy, cmap, colstr, &color, &color))
+#endif
 		die("error, cannot allocate color '%s'\n", colstr);
 
+#ifdef XFT
+
 	return color;
+#else
+return color.pixel;
+#endif
 }
 
 Bool
@@ -1040,12 +1120,44 @@
 void
 initfont(const char *fontstr) {
 
+#ifdef XFT
 	if(!(dc.font.xfont = XftFontOpenName(dpy,screen,fontstr))
 	&& !(dc.font.xfont = XftFontOpenName(dpy,screen,"fixed")))
 		die("error, cannot load font: '%s'\n", fontstr);
 
 	dc.font.ascent = dc.font.xfont->ascent;
 	dc.font.descent = dc.font.xfont->descent;
+#else
+	char *def, **missing;
+	int n;
+ 
+	dc.font.set = XCreateFontSet(dpy, fontstr, &missing, &n, &def);
+	if(missing) {
+		while(n--)
+			fprintf(stderr, "dwm: missing fontset: %s\n", missing[n]);
+		XFreeStringList(missing);
+	}
+	if(dc.font.set) {
+		XFontStruct **xfonts;
+		char **font_names;
+
+		dc.font.ascent = dc.font.descent = 0;
+		XExtentsOfFontSet(dc.font.set);
+		n = XFontsOfFontSet(dc.font.set, &xfonts, &font_names);
+		while(n--) {
+			dc.font.ascent = MAX(dc.font.ascent, (*xfonts)->ascent);
+			dc.font.descent = MAX(dc.font.descent,(*xfonts)->descent);
+			xfonts++;
+		}
+	}
+	else {
+		if(!(dc.font.xfont = XLoadQueryFont(dpy, fontstr))
+		&& !(dc.font.xfont = XLoadQueryFont(dpy, "fixed")))
+			die("error, cannot load font: '%s'\n", fontstr);
+		dc.font.ascent = dc.font.xfont->ascent;
+		dc.font.descent = dc.font.xfont->descent;
+	}
+#endif
 	dc.font.height = dc.font.ascent + dc.font.descent;
 }
 
@@ -1127,7 +1239,11 @@
 
 	wc.border_width = c->bw;
 	XConfigureWindow(dpy, w, CWBorderWidth, &wc);
+#ifdef XFT
 	XSetWindowBorder(dpy, w, dc.norm[ColBorder].pixel);
+#else
+	XSetWindowBorder(dpy, w, dc.norm[ColBorder]);
+#endif
 	configure(c); /* propagates border_width, if size doesn't change */
 	updatewindowtype(c);
 	updatesizehints(c);
@@ -1616,6 +1732,11 @@
 	dc.drawable = XCreatePixmap(dpy, root, DisplayWidth(dpy, screen), bh, DefaultDepth(dpy, screen));
 	dc.gc = XCreateGC(dpy, root, 0, NULL);
 	XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter);
+#ifdef XFT
+#else
+	if(!dc.font.set)
+	XSetFont(dpy, dc.gc, dc.font.xfont->fid);
+#endif
 	/* init bars */
 	updatebars();
 	updatestatus();
@@ -1686,9 +1807,18 @@
 
 int
 textnw(const char *text, unsigned int len) {
+#ifdef XFT
 	XGlyphInfo ext;
 	XftTextExtentsUtf8(dpy, dc.font.xfont, (XftChar8 *) text, len, &ext);
 	return ext.xOff;
+#else
+	XRectangle r;
+	if(dc.font.set) {
+		XmbTextExtents(dc.font.set, text, len, NULL, &r);
+		return r.width;
+	}
+	return XTextWidth(dc.font.xfont, text, len);
+#endif
 }
 
 void
@@ -1768,7 +1898,11 @@
 	if(!c)
 		return;
 	grabbuttons(c, False);
+#ifdef XFT
 	XSetWindowBorder(dpy, c->win, dc.norm[ColBorder].pixel);
+#else
+	XSetWindowBorder(dpy, c->win, dc.norm[ColBorder]);
+#endif
 	if(setfocus) {
 		XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
 		XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
