--- wrapper/Makefile.orig	Thu Mar 20 16:49:39 2008
+++ wrapper/Makefile	Fri Mar 21 11:56:29 2008
@@ -33,7 +33,7 @@
 .PHONY: .pwlib_version .openh323_version
 
 OPENH323USERFLAGS =
-STDCCFLAGS :=
+STDCCFLAGS := -fPIC
 
 ifdef	NOVIDEO
 OPENH323USERFLAGS += NOVIDEO=1
@@ -62,7 +62,7 @@
 ifdef	OH323_SUPPRESS_H235
 STDCCFLAGS  += -DOH323_SUPPRESS_H235
 endif
-OPENH323FLAGS = $(shell make $(OPENH323USERFLAGS) -f openh323flags.mak \
+OPENH323FLAGS := $(shell $(MAKE) $(OPENH323USERFLAGS) -f openh323flags.mak \
 		--no-print-directory -s \
 		PWLIBDIR=$(PWLIBDIR) OPENH323DIR=$(OPENH323DIR) oh323ccflags)
 CPPFLAGS += $(OPENH323FLAGS)
@@ -100,25 +100,29 @@
 	@if [ "$(OPENH323_VERSION)" = "UNKNOWN" ]; then \
 		echo "*** Cannot determine the version of OPENH323!"; exit 1; \
 	fi
+ifneq ($(OH323NOWRAP),1)
 ifeq ($(OH323STAT),1)
 	$(AR) rc liboh323wrap_s.a $(WRAPOBJECTS)
 else
-	$(CC) -shared -Wl,-soname,liboh323wrap.so -o liboh323wrap.so $(WRAPOBJECTS)
+	$(CC) -shared -Wl,-soname,liboh323wrap.so.1 -o liboh323wrap.so.1 $(WRAPOBJECTS)
+	ln -sfh liboh323wrap.so.1 liboh323wrap.so
+endif
 endif
 
 strip:
 
 install:
+ifneq ($(OH323NOWRAP),1)
 	if [ ! -d $(DESTDIR)$(OH323WRAPLIBDIR) ]; then \
-		$(INSTALL) -d $(DESTDIR)$(OH323WRAPLIBDIR); \
+		$(MKDIR) $(DESTDIR)$(OH323WRAPLIBDIR); \
 	fi
 ifeq ($(OH323STAT),1)
-	$(INSTALL) -m 0644 liboh323wrap_s.a $(DESTDIR)$(OH323WRAPLIBDIR)
+	$(BSD_INSTALL_PROGRAM) liboh323wrap_s.a $(DESTDIR)$(OH323WRAPLIBDIR)
 else
-	$(INSTALL) liboh323wrap.so $(DESTDIR)$(OH323WRAPLIBDIR)
-	cd $(DESTDIR)$(OH323WRAPLIBDIR); rm -f ./liboh323wrap.so.1; rm -f ./liboh323wrap.so.1.1
-	cd $(DESTDIR)$(OH323WRAPLIBDIR); ln -s liboh323wrap.so liboh323wrap.so.1
-	cd $(DESTDIR)$(OH323WRAPLIBDIR); ln -s liboh323wrap.so liboh323wrap.so.1.1
+	$(BSD_INSTALL_PROGRAM) liboh323wrap.so.1 $(DESTDIR)$(OH323WRAPLIBDIR)
+	cd $(DESTDIR)$(OH323WRAPLIBDIR); rm -f ./liboh323wrap.so
+	cd $(DESTDIR)$(OH323WRAPLIBDIR); ln -s liboh323wrap.so.1 liboh323wrap.so
+endif
 endif
 
 clean:
