--- makefile.orig	2006-03-06 00:39:37.000000000 +1100
+++ makefile	2011-06-30 13:31:16.000000000 +1000
@@ -8,22 +8,22 @@
 # no need to touch anything below this line
 # -----------------------------------------
 
-CC = g++
+CC = @CXX@
 MAKE = $(MAKE_COMMAND)
 TARGET = daapd
 DEPS = daaplib_ libhttpd_
 OBJS = daapd.o db.o dboutput.o songcache.o parsemp3.o util.o
 LIBS = -ldaaplib -lhttpd-persistent -lid3tag -lz
-LIBPATH = -L. -L./daaplib/src -L./libhttpd/src  -L/usr/local/lib
-INCPATH = -I. -I./daaplib/include -I./libhttpd/src  -I/usr/local/include
-DEPLOY = /usr/local
-CFLAGS = -Wall -Wno-multichar
+LIBPATH = -L. -L./daaplib/src -L./libhttpd/src  -L@PREFIX@/lib
+INCPATH = -I. -I./daaplib/include -I./libhttpd/src  -I@PREFIX@/include
+DEPLOY = @PREFIX@
+CFLAGS = @CFLAGS@ -Wall -Wno-multichar $(PTHREAD_CFLAGS)
 
 # HOWL
 ifeq ($(HOWL_ENABLE),1)
-	HOWLDIRS := $(sort $(wildcard /usr/local/include/howl*) )
+	HOWLDIRS := $(sort $(wildcard @PREFIX@/include/howl*) )
 ifeq ($(words $(HOWLDIRS) ), 0)
-$(error howl not found in /usr/local/include. Install howl or disable it in the makefile)
+$(error howl not found in @PREFIX@/include. Install howl or disable it in the makefile)
 endif
 	HOWLRECENT := $(word $(words $(HOWLDIRS)),$(HOWLDIRS) )
 	INCPATH := $(INCPATH) -I$(HOWLRECENT)
@@ -71,7 +71,7 @@
 	cd daaplib/src && $(MAKE)
 
 libhttpd_:
-	if test ! -e libhttpd/Site.mm; then cd libhttpd && ./configure; fi
+	if test ! -e libhttpd/Site.mm; then cd libhttpd && env CC="$(CC)" CXX="$(CC)" CFLAGS="$(CFLAGS)" ./configure; fi
 	cd libhttpd && $(MAKE)
 
 clean:
