$NetBSD: patch-aa,v 1.4 2011/03/20 11:46:34 obache Exp $

--- Makefile.defs.orig	2004-07-27 11:38:33.000000000 +0000
+++ Makefile.defs
@@ -85,9 +85,14 @@ man-prefix = $(basedir)$(prefix)
 ut-prefix = $(basedir)$(prefix)
 
 # dirs
-cfg-dir = etc/ser/
+cfg-dir = ser/
+eg-dir  = $(EGDIR)/
 bin-dir = sbin/
 modules-dir = lib/ser/modules/
+ifeq (1, 1)
+	doc-dir = share/doc/ser
+	man-dir = $(PKGMANDIR)
+else
 ifeq ($(OS), linux)
 	doc-dir = share/doc/ser/
 	man-dir = share/man/
@@ -104,6 +109,10 @@ ifeq ($(OS), netbsd)
 	doc-dir = share/doc/ser
 	man-dir = man/
 else
+ifeq ($(OS), dragonfly)
+	doc-dir = share/doc/ser
+	man-dir = man/
+else
 ifeq ($(OS), darwin)
 	doc-dir = share/doc/ser/
 	man-dir = man/
@@ -115,9 +124,11 @@ endif
 endif
 endif
 endif
+endif
+endif
 ut-prefix = bin/
 # target dirs for various stuff
-cfg-target = $(prefix)/$(cfg-dir)
+cfg-target = $(PKG_SYSCONFDIR)/
 modules-target = $(prefix)/$(modules-dir)
 
 
@@ -133,10 +144,10 @@ endif
 INSTALL-TOUCH = touch          # used to create the file first (good to 
                                #  make solaris install work)
 # INSTALL-CFG = $(INSTALL) -m 644
-INSTALL-BIN = $(INSTALL) -m 755
-INSTALL-MODULES = $(INSTALL) -m 755
-INSTALL-DOC = $(INSTALL) -m 644
-INSTALL-MAN = $(INSTALL) -m 644
+INSTALL-BIN = $(INSTALL) -c -m 755
+INSTALL-MODULES = $(INSTALL) -c -m 755
+INSTALL-DOC = $(INSTALL) -c -m 644
+INSTALL-MAN = $(INSTALL) -c -m 644
 
 #set some vars from the environment (and not make builtins)
 CC   := $(shell echo "$${CC}")
@@ -384,6 +395,10 @@ ifeq ($(ARCH), i386)
 	use_fast_lock=yes
 endif
 
+ifeq ($(ARCH), amd64)
+	use_fast_lock=yes
+endif
+
 ifeq ($(ARCH), sparc64)
 ifeq 	($(CC_NAME), gcc)
 	use_fast_lock=yes
@@ -639,6 +654,7 @@ ifeq	($(CC_NAME), suncc)
 endif
 
 endif #mode=release
+LDFLAGS+= -L${BUILDLINK_PREFIX.pthread}/lib ${COMPILER_RPATH_FLAG}${BUILDLINK_PREFIX.pthread}/lib
 
 
 #*FLAGS used for compiling the modules
@@ -743,6 +759,19 @@ ifeq ($(OS), netbsd)
 	LIBS= -lfl 
 endif
 
+ifeq ($(OS), dragonfly)
+	DEFS+=-DHAVE_SOCKADDR_SA_LEN -DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN \
+		-DHAVE_SCHED_YIELD -DHAVE_MSGHDR_MSG_CONTROL
+	ifneq ($(found_lock_method), yes)
+		DEFS+= -DUSE_PTHREAD_MUTEX  # try pthread sems
+		found_lock_method=yes
+		LIBS= -pthread -lfl  #dlopen is in libc
+	else
+		LIBS= -lfl  #dlopen is in libc
+	endif
+	YACC=yacc
+endif
+
 # OS X support, same as freebsd
 ifeq ($(OS), darwin)
 	DEFS+=-DHAVE_SOCKADDR_SA_LEN -DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN \
