--- Makefile.orig	Wed Jul 15 20:51:24 2009
+++ Makefile	Sat Jul 18 01:52:56 2009
@@ -49,13 +49,11 @@
 skip_modules?=
 
 # if not set on the cmd. line or the env, exclude this modules:
-exclude_modules?= jabber cpl-c xmpp rls mi_xmlrpc xcap_client \
-	db_mysql db_postgres db_unixodbc db_oracle db_berkeley \
-	avp_radius auth_radius group_radius uri_radius \
-	osp perl snmpstats perlvdb peering carrierroute mmgeoip \
-	presence presence_xml presence_mwi presence_dialoginfo \
-	pua pua_bla pua_mi pua_usrloc pua_xmpp pua_dialoginfo \
-	ldap h350 identity regex seas
+exclude_modules?= $(MYSQL) $(POSTGRESQL) $(CPL) $(SNMPSTATS) $(TLSOPS) $(UNIXODBC) $(ORACLE) \
+	jabber osp avp_radius auth_radius group_radius uri_radius xmpp \
+	presence presence_xml presence_mwi pua pua_bla pua_mi \
+	pua_usrloc pua_xmpp rls mi_xmlrpc perl snmpstats perlvdb \
+	ldap carrierroute h350 xcap_client db_berkeley mmgeoip 
 ifeq ($(TLS),)
 	exclude_modules+= tlsops
 endif
@@ -465,29 +463,12 @@
 		
 # note: on solaris 8 sed: ? or \(...\)* (a.s.o) do not work
 install-cfg: $(cfg-prefix)/$(cfg-dir)
-		sed -e "s#/usr/.*lib/$(NAME)/modules/#$(modules-target)#g" \
-			< etc/$(NAME).cfg > $(cfg-prefix)/$(cfg-dir)$(NAME).cfg.sample0
-		sed -e "s#/usr/.*etc/$(NAME)/tls/#$(cfg-target)tls/#g" \
-			< $(cfg-prefix)/$(cfg-dir)$(NAME).cfg.sample0 \
-			> $(cfg-prefix)/$(cfg-dir)$(NAME).cfg.sample
-		rm -fr $(cfg-prefix)/$(cfg-dir)$(NAME).cfg.sample0
-		chmod 600 $(cfg-prefix)/$(cfg-dir)$(NAME).cfg.sample
-		chmod 700 $(cfg-prefix)/$(cfg-dir)
-		if [ -z "${skip_cfg_install}" -a \
-				! -f $(cfg-prefix)/$(cfg-dir)$(NAME).cfg ]; then \
-			mv -f $(cfg-prefix)/$(cfg-dir)$(NAME).cfg.sample \
-				$(cfg-prefix)/$(cfg-dir)$(NAME).cfg; \
-		fi
 		# radius dictionary
-		if [ "$(RADIUSDEPON)" = "yes" ]; then \
-			$(INSTALL_TOUCH) \
-				$(cfg-prefix)/$(cfg-dir)/dictionary.opensips.sample ; \
-			$(INSTALL_CFG) etc/dictionary.opensips \
-				$(cfg-prefix)/$(cfg-dir)/dictionary.opensips.sample ; \
-			if [ ! -f $(cfg-prefix)/$(cfg-dir)/dictionary.opensips ]; then \
-				mv -f $(cfg-prefix)/$(cfg-dir)/dictionary.opensips.sample \
-					$(cfg-prefix)/$(cfg-dir)/dictionary.opensips; \
-			fi; \
+		$(INSTALL_TOUCH) $(cfg-prefix)/$(cfg-dir)/dictionary.opensips.default
+		$(INSTALL_CFG) etc/dictionary.opensips $(cfg-prefix)/$(cfg-dir)/dictionary.opensips.default
+		if [ ! -f $(cfg-prefix)/$(cfg-dir)/dictionary.opensips ]; then \
+			cp -f $(cfg-prefix)/$(cfg-dir)/dictionary.opensips.default \
+				$(cfg-prefix)/$(cfg-dir)/dictionary.opensips; \
 		fi
 		# opensipsctl config
 		$(INSTALL_TOUCH)   $(cfg-prefix)/$(cfg-dir)/opensipsctlrc.sample
@@ -521,6 +502,10 @@
 				fi ;\
 			done ; \
 		fi
+		# cpl dtd
+		$(INSTALL_TOUCH)   $(cfg-prefix)/$(cfg-dir)/cpl-06.dtd
+		$(INSTALL_CFG) modules/cpl-c/cpl-06.dtd \
+			$(cfg-prefix)/$(cfg-dir)/cpl-06.dtd
 
 install-console: $(bin-prefix)/$(bin-dir)
 		# install osipsconsole
@@ -530,20 +515,20 @@
 		sed -e "s#PATH_ETC[ \t]*=[ \t]*\"\./etc/\"#PATH_ETC = \"$(cfg-target)\"#g" \
 		> /tmp/osipsconsole
 		$(INSTALL_TOUCH) $(bin-prefix)/$(bin-dir)/osipsconsole
-		$(INSTALL_BIN) /tmp/osipsconsole $(bin-prefix)/$(bin-dir)
+		$(BSD_INSTALL_SCRIPT) /tmp/osipsconsole $(bin-prefix)/$(bin-dir)
 		rm -fr /tmp/osipsconsole
 
 install-bin: $(bin-prefix)/$(bin-dir) utils
 		# install opensips binary
 		$(INSTALL_TOUCH) $(bin-prefix)/$(bin-dir)/$(NAME) 
-		$(INSTALL_BIN) $(NAME) $(bin-prefix)/$(bin-dir)
+		$(BSD_INSTALL_SCRIPT) $(NAME) $(bin-prefix)/$(bin-dir)
 		# install opensipsctl (and family) tool
 		cat scripts/opensipsctl | \
 		sed -e "s#/usr/local/sbin#$(bin-target)#g" | \
 		sed -e "s#/usr/local/lib/opensips#$(lib-target)#g" | \
 		sed -e "s#/usr/local/etc/opensips#$(cfg-target)#g"  >/tmp/opensipsctl
 		$(INSTALL_TOUCH) $(bin-prefix)/$(bin-dir)/opensipsctl
-		$(INSTALL_BIN) /tmp/opensipsctl $(bin-prefix)/$(bin-dir)
+		$(BSD_INSTALL_SCRIPT) /tmp/opensipsctl $(bin-prefix)/$(bin-dir)
 		rm -fr /tmp/opensipsctl
 		sed -e "s#/usr/local/sbin#$(bin-target)#g" \
 			< scripts/opensipsctl.base > /tmp/opensipsctl.base
@@ -585,10 +570,10 @@
 		sed -e "s#/usr/local/lib/opensips#$(lib-target)#g" | \
 		sed -e "s#/usr/local/etc/opensips#$(cfg-target)#g"  >/tmp/opensipsdbctl
 		$(INSTALL_TOUCH) $(bin-prefix)/$(bin-dir)/opensipsdbctl
-		$(INSTALL_BIN) /tmp/opensipsdbctl $(bin-prefix)/$(bin-dir)
+		$(BSD_INSTALL_SCRIPT) /tmp/opensipsdbctl $(bin-prefix)/$(bin-dir)
 		rm -fr /tmp/opensipsdbctl
 		$(INSTALL_TOUCH)   $(bin-prefix)/$(bin-dir)/$(NAME)unix
-		$(INSTALL_BIN) utils/$(NAME)unix/$(NAME)unix $(bin-prefix)/$(bin-dir)
+		$(BSD_INSTALL_SCRIPT) utils/$(NAME)unix/$(NAME)unix $(bin-prefix)/$(bin-dir)
 
 .PHONY: utils
 utils:
@@ -709,7 +694,7 @@
 					$(data-prefix)/$(data-dir)/oracle/admin/`basename "$$FILE"` ; \
 				fi ;\
 			done ; \
-			$(INSTALL_BIN) utils/db_oracle/opensips_orasel $(bin-prefix)/$(bin-dir) ; \
+			$(BSD_INSTALL_SCRIPT) utils/db_oracle/opensips_orasel $(bin-prefix)/$(bin-dir) ; \
 		fi
 		# install Berkeley database stuff
 		if [ "$(BERKELEYDBON)" = "yes" ]; then \
@@ -733,7 +718,7 @@
 					$(data-prefix)/$(data-dir)/db_berkeley/opensips/`basename "$$FILE"` ; \
 				fi ;\
 			done ; \
-			$(INSTALL_BIN) utils/db_berkeley/bdb_recover $(bin-prefix)/$(bin-dir) ; \
+			$(BSD_INSTALL_SCRIPT) utils/db_berkeley/bdb_recover $(bin-prefix)/$(bin-dir) ; \
 		fi
 		# install dbtext stuff
 		if [ "$(DBTEXTON)" = "yes" ]; then \
@@ -750,7 +735,7 @@
 			rm -fr /tmp/opensipsdbctl.dbtext ; \
 			mkdir -p $(modules-prefix)/$(lib-dir)/opensipsctl/dbtextdb ; \
 			$(INSTALL_TOUCH) $(modules-prefix)/$(lib-dir)/opensipsctl/dbtextdb/dbtextdb.py ; \
-			$(INSTALL_BIN) scripts/dbtextdb/dbtextdb.py $(modules-prefix)/$(lib-dir)/opensipsctl/dbtextdb/ ; \
+			$(BSD_INSTALL_SCRIPT) scripts/dbtextdb/dbtextdb.py $(modules-prefix)/$(lib-dir)/opensipsctl/dbtextdb/ ; \
 			mkdir -p $(data-prefix)/$(data-dir)/dbtext/opensips ; \
 			for FILE in $(wildcard scripts/dbtext/opensips/*) ; do \
 				if [ -f $$FILE ] ; then \
@@ -782,9 +767,7 @@
 			if [ -f modules/"$$r"/README ]; then \
 				$(INSTALL_TOUCH)  $(doc-prefix)/$(doc-dir)/README ; \
 				$(INSTALL_DOC)  modules/"$$r"/README  \
-									$(doc-prefix)/$(doc-dir)/README ; \
-				mv -f $(doc-prefix)/$(doc-dir)/README \
-						$(doc-prefix)/$(doc-dir)/README."$$r" ; \
+					$(doc-prefix)/$(doc-dir)/README."$$r" ; \
 			fi ; \
 		fi ; \
 	done 
