[Asterisk-code-review] RFC: build-system: Build with static pjproject as the default (asterisk[13])

George Joseph asteriskteam at digium.com
Fri Jan 22 21:42:08 CST 2016


George Joseph has uploaded a new change for review.

  https://gerrit.asterisk.org/2072

Change subject: RFC: build-system: Build with static pjproject as the default
......................................................................

RFC: build-system: Build with static pjproject as the default

Background here:
http://lists.digium.com/pipermail/asterisk-dev/2016-January/075266.html

The new default behavior is to link Asterisk statically against a local
instance located in third_party/pjproject.  The original behavior of
linking to the shared libraries of the system-installed pjproject can
be restored with a ./configure option.

Building:

New ./configure options:

--with-pjproject-shared=PATH
	Dynamically link to the shared libraries in PATH (or the system
	default).  This is the equivalent of the old --with-pjproject option
	(but it must now be explicitly specified).
--with-pjproject-static=PATH
	Statically link to the .a archive files located in a pjproject source
	directory.  PATH defaults to ./third_party/pjproject/source.
	pjproject must already have been built WITHOUT the --enable-shared
	option and a build.mak file must be available in that directory.

The default is --with-pjproject-static.  You can disable pjproject
altogether with --without-pjproject-static

To build, cd to third_party/pjproject and type 'make'.  The Makefile will
download an official tarball from pjsip.org, unpack it into the 'source'
subdirectory, apply any patches located in the 'patches' directory, run
configure with the correct options, do a 'make dep' and a 'make'.

When that's done, cd to the Asterisk top directory, run './configure' with
your favorite options and proceed as normal.

Use the --with-pjproject-shared to restore the old behavior.  You should
run 'make distclean' when changing between the shared and static
implementations.

Implementation Notes:

*****
When running the static version, you must add a 'preload = res_pjproject.so'
line to modules.conf.  I have yet to figure out a sure-fire way to force a
module to load early from code.  Suggestions welcomed.
*****

No c source files were changed.

res_pjsip.h was modified so that CHECK_PJSIP_MODULE_LOADED also checks for
res_pjproject if the HAVE_PJPROJECT_STATIC flag is set.

AST_EXT_LIB_SETUP was modified to explicitly set USE_$1 to 'yes' or
'notspecified' to facilitate positive determination of whether an option
was specified or not.  Two new arguments were also added, one to allow a
code block to be executed if the option was not specified, and another to
specify a 'cabability' to add to ac_mandatory_list instead of the package
name.  PJPROJECT_SHARED and PJPROJECT_STATIC both set PJPROJECT for
instance.  Either satisfies the capability but only one can be specified.

configure.ac was modified to process the new options and perform appropriate
checks.

res_pjproject now houses all pjproject APIs so res/Makefile was modified
to perform special processing on res_pjproject if using the static
libraries.

The res_pjproject.exports file is now dynamically built by listing the
global symbols from pjproject's .a files.  Since the original export
generation commands were embedded in the '%.so: %.o' rules, it wasn't
possible to override them just for res_pjproject.  Instead, the exports
files have been given their own rules ('%.exports: %.exports.in') which
allows them to be overridden with a
'res_pjproject.exports: res_pjproject.exports.in' rule that combines the
existing res_pjproject.exports.in file with the symbols from pjproject.

A side effect of the new catch-all exports rule is that they now echo
messages to the terminal.
If there was no specific .in file for a module...
   [COPY]  default.exports.in -> <module>.exports
otherwise...
   [GENERATE]  <module>.exports.in -> <module>.exports
I can squash them if they're too noisy.

Modules should continue to depend on pjproject if they use pjproject APIs
directly.  They should not care about the implementation.  They should only
depend on res_pjproject if they need a specific res_pjproject API.

I would like to alter the dependency chain if HAVE_JPROJECT_STATIC is
specified so menuselect shows that res_pjproject is needed but so far
that has eluded me as well.

REMINDER:  This is an RFC only at this time.

Change-Id: Ia7a60c28c2e9ba9537c5570f933c1ebcb20a3103
---
M Makefile.rules
M autoconf/ast_ext_lib.m4
M build_tools/make_linker_version_script
M configure
M configure.ac
R default.exports.in
M include/asterisk/autoconfig.h.in
M include/asterisk/res_pjsip.h
M makeopts.in
M res/Makefile
A third_party/Makefile
A third_party/pjproject/.gitignore
A third_party/pjproject/Makefile
A third_party/pjproject/apply_patches
A third_party/pjproject/patches/0002-no_third_party.patch
15 files changed, 1,330 insertions(+), 220 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/72/2072/1

diff --git a/Makefile.rules b/Makefile.rules
index 1031f2d..ad8e218 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -165,19 +165,25 @@
 	$(ECHO_PREFIX) echo "   [CPP] $< -> $@"
 	$(CMD_PREFIX) $(CXX) -o $@ -E $< $(MAKE_DEPS) $(CXX_CFLAGS) $(_ASTCFLAGS_COVERAGE)
 
-%.so: %.o
+%.exports: %.exports.in
 ifeq ($(GNU_LD),1)
+	$(ECHO_PREFIX) echo "   [GENERATE] $^ -> $@"
 	$(CMD_PREFIX) $(ASTTOPDIR)/build_tools/make_linker_version_script $* "$(LINKER_SYMBOL_PREFIX)" "$(ASTTOPDIR)"
 endif
-	$(ECHO_PREFIX) echo "   [LD] $^ -> $@"
-	$(CMD_PREFIX) $(CC) $(STATIC_BUILD) -o $@ $(CC_LDFLAGS_SO) $^ $(CC_LIBS)
 
-%.so: %.oo
+%.exports: $(ASTTOPDIR)/default.exports.in
 ifeq ($(GNU_LD),1)
-	$(CMD_PREFIX) $(ASTTOPDIR)/build_tools/make_linker_version_script $* "$(LINKER_SYMBOL_PREFIX)" "$(ASTTOPDIR)"
+	$(ECHO_PREFIX) echo "   [COPY] $< -> $@"
+	$(CMD_PREFIX) cp -f $< $@
 endif
-	$(ECHO_PREFIX) echo "   [LDXX] $^ -> $@"
-	$(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o $@ $(CXX_LDFLAGS_SO) $^ $(CXX_LIBS)
+
+%.so: %.o %.exports
+	$(ECHO_PREFIX) echo "   [LD] $(filter-out %.exports,$^) -> $@"
+	$(CMD_PREFIX) $(CC) $(STATIC_BUILD) -o $@ $(CC_LDFLAGS_SO) $(filter-out %.exports,$^) $(CC_LIBS)
+
+%.so: %.oo %.exports
+	$(ECHO_PREFIX) echo "   [LDXX] $(filter-out %.exports,$^) -> $@"
+	$(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o $@ $(CXX_LDFLAGS_SO) $(filter-out %.exports,$^) $(CXX_LIBS)
 
 %.eo: %.o
 	$(ECHO_PREFIX) echo "   [EMBED] $< -> $@"
diff --git a/autoconf/ast_ext_lib.m4 b/autoconf/ast_ext_lib.m4
index 8f35f4b..f40c1b1 100644
--- a/autoconf/ast_ext_lib.m4
+++ b/autoconf/ast_ext_lib.m4
@@ -3,8 +3,10 @@
 #	for the variables ($1_DIR, $1_INCLUDE, $1_LIB) in makeopts
 # $3 ->	option name, used in --with-$3 or --without-$3 when calling configure.
 # $2 and $4 are just text describing the package (short and long form)
+# $5 is the capability to fulfill (defaults to package)
+# $6 is the action to take if not specified
 
-# AST_EXT_LIB_SETUP([package], [short description], [configure option name], [long description])
+# AST_EXT_LIB_SETUP([package], [short description], [configure option name], [long description], [capability], [action if not specified])
 
 AC_DEFUN([AST_EXT_LIB_SETUP],
 [
@@ -21,14 +23,22 @@
 	PBX_$1=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} $1"
+	if test -n "$5" -a "${ac_mandatory_list#* $5 *}" != "$ac_mandatory_list" ; then
+		AC_MSG_ERROR(An option with capability $5 has already been specified)
+	fi
+	USE_$1=yes
+	ac_mandatory_list="$ac_mandatory_list m4_ifval([$5], [$5], [$1]) "
 	;;
 	*)
+	if test -n "$5" -a "${ac_mandatory_list#* $5 *}" != "$ac_mandatory_list" ; then
+		AC_MSG_ERROR(An option with capability $5 has already been specified)
+	fi
+	USE_$1=yes
 	$1_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} $1"
+	ac_mandatory_list="$ac_mandatory_list m4_ifval([$5], [$5], [$5]) "
 	;;
 	esac
-    ])
+    ], [ USE_$1=notspecified ; $6 ])
     AH_TEMPLATE(m4_bpatsubst([[HAVE_$1]], [(.*)]), [Define to 1 if you have the $2 library.])
     AC_SUBST([$1_LIB])
     AC_SUBST([$1_INCLUDE])
@@ -68,7 +78,7 @@
 m4_ifval([$3], [
 for i in ${ac_mandatory_list}; do
    if test "x$3" = "x$i"; then
-      ac_mandatory_list="${ac_mandatory_list} $1"
+      ac_mandatory_list="${ac_mandatory_list} $1 "
       break
    fi
 done
diff --git a/build_tools/make_linker_version_script b/build_tools/make_linker_version_script
index 5d6bd42..112bf47 100755
--- a/build_tools/make_linker_version_script
+++ b/build_tools/make_linker_version_script
@@ -3,4 +3,3 @@
 AWK=${AWK:-awk}
 
 test -f ${1}.exports.in && ${AWK} "{sub(\"LINKER_SYMBOL_PREFIX\", \"${2}\"); print;}" ${1}.exports.in > ${1}.exports && exit 0
-test -f ${1}.exports.in || rm -f ${1}.exports && cp ${3}/default.exports ${1}.exports && exit 0
diff --git a/configure b/configure
index 44435a6..88ef56d 100755
--- a/configure
+++ b/configure
@@ -901,6 +901,10 @@
 PORTAUDIO_DIR
 PORTAUDIO_INCLUDE
 PORTAUDIO_LIB
+PBX_POPT
+POPT_DIR
+POPT_INCLUDE
+POPT_LIB
 PBX_PJ_SSL_CERT_LOAD_FROM_FILES2
 PJ_SSL_CERT_LOAD_FROM_FILES2_DIR
 PJ_SSL_CERT_LOAD_FROM_FILES2_INCLUDE
@@ -917,10 +921,15 @@
 PJ_TRANSACTION_GRP_LOCK_DIR
 PJ_TRANSACTION_GRP_LOCK_INCLUDE
 PJ_TRANSACTION_GRP_LOCK_LIB
-PBX_POPT
-POPT_DIR
-POPT_INCLUDE
-POPT_LIB
+PBX_PJPROJECT_STATIC
+PJPROJECT_STATIC_DIR
+PJPROJECT_STATIC_INCLUDE
+PJPROJECT_STATIC_LIB
+PBX_PJPROJECT_SHARED
+PJPROJECT_SHARED_DIR
+PJPROJECT_SHARED_INCLUDE
+PJPROJECT_SHARED_LIB
+PJPROJECT_IMPLEMENTATION
 PBX_PJPROJECT
 PJPROJECT_DIR
 PJPROJECT_INCLUDE
@@ -1339,7 +1348,8 @@
 with_osptk
 with_oss
 with_postgres
-with_pjproject
+with_pjproject_shared
+with_pjproject_static
 with_popt
 with_portaudio
 with_pri
@@ -2077,7 +2087,10 @@
   --with-osptk=PATH       use OSP Toolkit files in PATH
   --with-oss=PATH         use Open Sound System files in PATH
   --with-postgres=PATH    use PostgreSQL files in PATH
-  --with-pjproject=PATH   use PJPROJECT files in PATH
+  --with-pjproject-shared=PATH
+                          use Shared pjproject files in PATH
+  --with-pjproject-static=PATH
+                          use Static pjproject files in PATH
   --with-popt=PATH        use popt files in PATH
   --with-portaudio=PATH   use PortAudio files in PATH
   --with-pri=PATH         use ISDN PRI files in PATH
@@ -8430,14 +8443,24 @@
 	PBX_ALSA=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} ALSA"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_ALSA=yes
+	ac_mandatory_list="$ac_mandatory_list ALSA "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_ALSA=yes
 	ALSA_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} ALSA"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_ALSA=notspecified ;
 fi
 
 
@@ -8462,14 +8485,24 @@
 	PBX_BFD=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} BFD"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_BFD=yes
+	ac_mandatory_list="$ac_mandatory_list BFD "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_BFD=yes
 	BFD_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} BFD"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_BFD=notspecified ;
 fi
 
 
@@ -8497,14 +8530,24 @@
 	PBX_BKTR=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} BKTR"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_BKTR=yes
+	ac_mandatory_list="$ac_mandatory_list BKTR "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_BKTR=yes
 	BKTR_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} BKTR"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_BKTR=notspecified ;
 fi
 
 
@@ -8529,14 +8572,24 @@
 	PBX_BLUETOOTH=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} BLUETOOTH"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_BLUETOOTH=yes
+	ac_mandatory_list="$ac_mandatory_list BLUETOOTH "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_BLUETOOTH=yes
 	BLUETOOTH_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} BLUETOOTH"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_BLUETOOTH=notspecified ;
 fi
 
 
@@ -8561,14 +8614,24 @@
 	PBX_CAP=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} CAP"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_CAP=yes
+	ac_mandatory_list="$ac_mandatory_list CAP "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_CAP=yes
 	CAP_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} CAP"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_CAP=notspecified ;
 fi
 
 
@@ -8593,14 +8656,24 @@
 	PBX_COROSYNC=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} COROSYNC"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_COROSYNC=yes
+	ac_mandatory_list="$ac_mandatory_list COROSYNC "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_COROSYNC=yes
 	COROSYNC_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} COROSYNC"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_COROSYNC=notspecified ;
 fi
 
 
@@ -8637,14 +8710,24 @@
 	PBX_CURSES=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} CURSES"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_CURSES=yes
+	ac_mandatory_list="$ac_mandatory_list CURSES "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_CURSES=yes
 	CURSES_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} CURSES"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_CURSES=notspecified ;
 fi
 
 
@@ -8669,14 +8752,24 @@
 	PBX_CRYPT=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} CRYPT"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_CRYPT=yes
+	ac_mandatory_list="$ac_mandatory_list CRYPT "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_CRYPT=yes
 	CRYPT_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} CRYPT"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_CRYPT=notspecified ;
 fi
 
 
@@ -8701,14 +8794,24 @@
 	PBX_CRYPTO=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} CRYPTO"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_CRYPTO=yes
+	ac_mandatory_list="$ac_mandatory_list CRYPTO "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_CRYPTO=yes
 	CRYPTO_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} CRYPTO"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_CRYPTO=notspecified ;
 fi
 
 
@@ -8769,14 +8872,24 @@
 	PBX_DAHDI=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} DAHDI"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_DAHDI=yes
+	ac_mandatory_list="$ac_mandatory_list DAHDI "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_DAHDI=yes
 	DAHDI_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} DAHDI"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_DAHDI=notspecified ;
 fi
 
 
@@ -8801,14 +8914,24 @@
 	PBX_FFMPEG=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} FFMPEG"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_FFMPEG=yes
+	ac_mandatory_list="$ac_mandatory_list FFMPEG "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_FFMPEG=yes
 	FFMPEG_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} FFMPEG"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_FFMPEG=notspecified ;
 fi
 
 
@@ -8833,14 +8956,24 @@
 	PBX_GSM=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} GSM"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_GSM=yes
+	ac_mandatory_list="$ac_mandatory_list GSM "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_GSM=yes
 	GSM_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} GSM"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_GSM=notspecified ;
 fi
 
 
@@ -8865,14 +8998,24 @@
 	PBX_ILBC=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} ILBC"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_ILBC=yes
+	ac_mandatory_list="$ac_mandatory_list ILBC "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_ILBC=yes
 	ILBC_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} ILBC"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_ILBC=notspecified ;
 fi
 
 
@@ -8897,14 +9040,24 @@
 	PBX_GTK2=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} GTK2"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_GTK2=yes
+	ac_mandatory_list="$ac_mandatory_list GTK2 "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_GTK2=yes
 	GTK2_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} GTK2"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_GTK2=notspecified ;
 fi
 
 
@@ -8929,14 +9082,24 @@
 	PBX_GMIME=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} GMIME"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_GMIME=yes
+	ac_mandatory_list="$ac_mandatory_list GMIME "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_GMIME=yes
 	GMIME_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} GMIME"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_GMIME=notspecified ;
 fi
 
 
@@ -8961,14 +9124,24 @@
 	PBX_OPENH323=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} OPENH323"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_OPENH323=yes
+	ac_mandatory_list="$ac_mandatory_list OPENH323 "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_OPENH323=yes
 	OPENH323_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} OPENH323"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_OPENH323=notspecified ;
 fi
 
 
@@ -8993,14 +9166,24 @@
 	PBX_HOARD=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} HOARD"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_HOARD=yes
+	ac_mandatory_list="$ac_mandatory_list HOARD "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_HOARD=yes
 	HOARD_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} HOARD"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_HOARD=notspecified ;
 fi
 
 
@@ -9025,14 +9208,24 @@
 	PBX_ICAL=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} ICAL"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_ICAL=yes
+	ac_mandatory_list="$ac_mandatory_list ICAL "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_ICAL=yes
 	ICAL_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} ICAL"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_ICAL=notspecified ;
 fi
 
 
@@ -9057,14 +9250,24 @@
 	PBX_ICONV=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} ICONV"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_ICONV=yes
+	ac_mandatory_list="$ac_mandatory_list ICONV "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_ICONV=yes
 	ICONV_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} ICONV"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_ICONV=notspecified ;
 fi
 
 
@@ -9089,14 +9292,24 @@
 	PBX_IKSEMEL=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} IKSEMEL"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_IKSEMEL=yes
+	ac_mandatory_list="$ac_mandatory_list IKSEMEL "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_IKSEMEL=yes
 	IKSEMEL_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} IKSEMEL"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_IKSEMEL=notspecified ;
 fi
 
 
@@ -9121,14 +9334,24 @@
 	PBX_IMAP_TK=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} IMAP_TK"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_IMAP_TK=yes
+	ac_mandatory_list="$ac_mandatory_list IMAP_TK "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_IMAP_TK=yes
 	IMAP_TK_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} IMAP_TK"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_IMAP_TK=notspecified ;
 fi
 
 
@@ -9153,14 +9376,24 @@
 	PBX_INOTIFY=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} INOTIFY"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_INOTIFY=yes
+	ac_mandatory_list="$ac_mandatory_list INOTIFY "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_INOTIFY=yes
 	INOTIFY_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} INOTIFY"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_INOTIFY=notspecified ;
 fi
 
 
@@ -9185,14 +9418,24 @@
 	PBX_IODBC=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} IODBC"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_IODBC=yes
+	ac_mandatory_list="$ac_mandatory_list IODBC "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_IODBC=yes
 	IODBC_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} IODBC"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_IODBC=notspecified ;
 fi
 
 
@@ -9217,14 +9460,24 @@
 	PBX_ISDNNET=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} ISDNNET"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_ISDNNET=yes
+	ac_mandatory_list="$ac_mandatory_list ISDNNET "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_ISDNNET=yes
 	ISDNNET_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} ISDNNET"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_ISDNNET=notspecified ;
 fi
 
 
@@ -9249,14 +9502,24 @@
 	PBX_JACK=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} JACK"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_JACK=yes
+	ac_mandatory_list="$ac_mandatory_list JACK "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_JACK=yes
 	JACK_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} JACK"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_JACK=notspecified ;
 fi
 
 
@@ -9281,14 +9544,24 @@
 	PBX_JANSSON=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} JANSSON"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_JANSSON=yes
+	ac_mandatory_list="$ac_mandatory_list JANSSON "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_JANSSON=yes
 	JANSSON_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} JANSSON"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_JANSSON=notspecified ;
 fi
 
 
@@ -9313,14 +9586,24 @@
 	PBX_URIPARSER=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} URIPARSER"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_URIPARSER=yes
+	ac_mandatory_list="$ac_mandatory_list URIPARSER "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_URIPARSER=yes
 	URIPARSER_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} URIPARSER"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_URIPARSER=notspecified ;
 fi
 
 
@@ -9345,14 +9628,24 @@
 	PBX_KQUEUE=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} KQUEUE"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_KQUEUE=yes
+	ac_mandatory_list="$ac_mandatory_list KQUEUE "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_KQUEUE=yes
 	KQUEUE_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} KQUEUE"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_KQUEUE=notspecified ;
 fi
 
 
@@ -9377,14 +9670,24 @@
 	PBX_LDAP=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} LDAP"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_LDAP=yes
+	ac_mandatory_list="$ac_mandatory_list LDAP "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_LDAP=yes
 	LDAP_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} LDAP"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_LDAP=notspecified ;
 fi
 
 
@@ -9786,14 +10089,24 @@
 	PBX_LIBEDIT=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} LIBEDIT"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_LIBEDIT=yes
+	ac_mandatory_list="$ac_mandatory_list LIBEDIT "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_LIBEDIT=yes
 	LIBEDIT_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} LIBEDIT"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_LIBEDIT=notspecified ;
 fi
 
 
@@ -9818,14 +10131,24 @@
 	PBX_LIBXML2=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} LIBXML2"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_LIBXML2=yes
+	ac_mandatory_list="$ac_mandatory_list LIBXML2 "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_LIBXML2=yes
 	LIBXML2_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} LIBXML2"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_LIBXML2=notspecified ;
 fi
 
 
@@ -9850,14 +10173,24 @@
 	PBX_LIBXSLT=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} LIBXSLT"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_LIBXSLT=yes
+	ac_mandatory_list="$ac_mandatory_list LIBXSLT "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_LIBXSLT=yes
 	LIBXSLT_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} LIBXSLT"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_LIBXSLT=notspecified ;
 fi
 
 
@@ -9894,14 +10227,24 @@
 	PBX_LTDL=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} LTDL"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_LTDL=yes
+	ac_mandatory_list="$ac_mandatory_list LTDL "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_LTDL=yes
 	LTDL_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} LTDL"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_LTDL=notspecified ;
 fi
 
 
@@ -9926,14 +10269,24 @@
 	PBX_LUA=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} LUA"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_LUA=yes
+	ac_mandatory_list="$ac_mandatory_list LUA "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_LUA=yes
 	LUA_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} LUA"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_LUA=notspecified ;
 fi
 
 
@@ -9958,14 +10311,24 @@
 	PBX_MISDN=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} MISDN"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_MISDN=yes
+	ac_mandatory_list="$ac_mandatory_list MISDN "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_MISDN=yes
 	MISDN_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} MISDN"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_MISDN=notspecified ;
 fi
 
 
@@ -9990,14 +10353,24 @@
 	PBX_MYSQLCLIENT=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} MYSQLCLIENT"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_MYSQLCLIENT=yes
+	ac_mandatory_list="$ac_mandatory_list MYSQLCLIENT "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_MYSQLCLIENT=yes
 	MYSQLCLIENT_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} MYSQLCLIENT"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_MYSQLCLIENT=notspecified ;
 fi
 
 
@@ -10022,14 +10395,24 @@
 	PBX_NBS=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} NBS"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_NBS=yes
+	ac_mandatory_list="$ac_mandatory_list NBS "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_NBS=yes
 	NBS_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} NBS"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_NBS=notspecified ;
 fi
 
 
@@ -10054,14 +10437,24 @@
 	PBX_NCURSES=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} NCURSES"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_NCURSES=yes
+	ac_mandatory_list="$ac_mandatory_list NCURSES "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_NCURSES=yes
 	NCURSES_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} NCURSES"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_NCURSES=notspecified ;
 fi
 
 
@@ -10086,14 +10479,24 @@
 	PBX_NEON=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} NEON"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_NEON=yes
+	ac_mandatory_list="$ac_mandatory_list NEON "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_NEON=yes
 	NEON_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} NEON"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_NEON=notspecified ;
 fi
 
 
@@ -10118,14 +10521,24 @@
 	PBX_NEON29=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} NEON29"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_NEON29=yes
+	ac_mandatory_list="$ac_mandatory_list NEON29 "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_NEON29=yes
 	NEON29_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} NEON29"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_NEON29=notspecified ;
 fi
 
 
@@ -10150,14 +10563,24 @@
 	PBX_NETSNMP=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} NETSNMP"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_NETSNMP=yes
+	ac_mandatory_list="$ac_mandatory_list NETSNMP "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_NETSNMP=yes
 	NETSNMP_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} NETSNMP"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_NETSNMP=notspecified ;
 fi
 
 
@@ -10182,14 +10605,24 @@
 	PBX_NEWT=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} NEWT"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_NEWT=yes
+	ac_mandatory_list="$ac_mandatory_list NEWT "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_NEWT=yes
 	NEWT_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} NEWT"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_NEWT=notspecified ;
 fi
 
 
@@ -10214,14 +10647,24 @@
 	PBX_OGG=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} OGG"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_OGG=yes
+	ac_mandatory_list="$ac_mandatory_list OGG "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_OGG=yes
 	OGG_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} OGG"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_OGG=notspecified ;
 fi
 
 
@@ -10246,14 +10689,24 @@
 	PBX_OPENR2=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} OPENR2"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_OPENR2=yes
+	ac_mandatory_list="$ac_mandatory_list OPENR2 "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_OPENR2=yes
 	OPENR2_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} OPENR2"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_OPENR2=notspecified ;
 fi
 
 
@@ -10278,14 +10731,24 @@
 	PBX_OPUS=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} OPUS"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_OPUS=yes
+	ac_mandatory_list="$ac_mandatory_list OPUS "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_OPUS=yes
 	OPUS_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} OPUS"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_OPUS=notspecified ;
 fi
 
 
@@ -10310,14 +10773,24 @@
 	PBX_OSPTK=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} OSPTK"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_OSPTK=yes
+	ac_mandatory_list="$ac_mandatory_list OSPTK "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_OSPTK=yes
 	OSPTK_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} OSPTK"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_OSPTK=notspecified ;
 fi
 
 
@@ -10342,14 +10815,24 @@
 	PBX_OSS=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} OSS"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_OSS=yes
+	ac_mandatory_list="$ac_mandatory_list OSS "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_OSS=yes
 	OSS_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} OSS"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_OSS=notspecified ;
 fi
 
 
@@ -10374,14 +10857,24 @@
 	PBX_PGSQL=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} PGSQL"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_PGSQL=yes
+	ac_mandatory_list="$ac_mandatory_list PGSQL "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_PGSQL=yes
 	PGSQL_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} PGSQL"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_PGSQL=notspecified ;
 fi
 
 
@@ -10391,29 +10884,48 @@
 
 
 
-    PJPROJECT_DESCRIP="PJPROJECT"
-    PJPROJECT_OPTION="pjproject"
-    PBX_PJPROJECT=0
+PBX_PJPROJECT=0
 
-# Check whether --with-pjproject was given.
-if test "${with_pjproject+set}" = set; then :
-  withval=$with_pjproject;
+
+
+
+
+
+
+
+    PJPROJECT_SHARED_DESCRIP="Shared pjproject"
+    PJPROJECT_SHARED_OPTION="pjproject-shared"
+    PBX_PJPROJECT_SHARED=0
+
+# Check whether --with-pjproject-shared was given.
+if test "${with_pjproject_shared+set}" = set; then :
+  withval=$with_pjproject_shared;
 	case ${withval} in
 	n|no)
-	USE_PJPROJECT=no
+	USE_PJPROJECT_SHARED=no
 	# -1 is a magic value used by menuselect to know that the package
 	# was disabled, other than 'not found'
-	PBX_PJPROJECT=-1
+	PBX_PJPROJECT_SHARED=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} PJPROJECT"
+	if test -n "PJPROJECT" -a "${ac_mandatory_list#* PJPROJECT *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability PJPROJECT has already been specified" "$LINENO" 5
+	fi
+	USE_PJPROJECT_SHARED=yes
+	ac_mandatory_list="$ac_mandatory_list PJPROJECT "
 	;;
 	*)
-	PJPROJECT_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} PJPROJECT"
+	if test -n "PJPROJECT" -a "${ac_mandatory_list#* PJPROJECT *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability PJPROJECT has already been specified" "$LINENO" 5
+	fi
+	USE_PJPROJECT_SHARED=yes
+	PJPROJECT_SHARED_DIR="${withval}"
+	ac_mandatory_list="$ac_mandatory_list PJPROJECT "
 	;;
 	esac
 
+else
+   USE_PJPROJECT_SHARED=notspecified ;
 fi
 
 
@@ -10423,29 +10935,39 @@
 
 
 
-    POPT_DESCRIP="popt"
-    POPT_OPTION="popt"
-    PBX_POPT=0
+    PJPROJECT_STATIC_DESCRIP="Static pjproject"
+    PJPROJECT_STATIC_OPTION="pjproject-static"
+    PBX_PJPROJECT_STATIC=0
 
-# Check whether --with-popt was given.
-if test "${with_popt+set}" = set; then :
-  withval=$with_popt;
+# Check whether --with-pjproject-static was given.
+if test "${with_pjproject_static+set}" = set; then :
+  withval=$with_pjproject_static;
 	case ${withval} in
 	n|no)
-	USE_POPT=no
+	USE_PJPROJECT_STATIC=no
 	# -1 is a magic value used by menuselect to know that the package
 	# was disabled, other than 'not found'
-	PBX_POPT=-1
+	PBX_PJPROJECT_STATIC=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} POPT"
+	if test -n "PJPROJECT" -a "${ac_mandatory_list#* PJPROJECT *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability PJPROJECT has already been specified" "$LINENO" 5
+	fi
+	USE_PJPROJECT_STATIC=yes
+	ac_mandatory_list="$ac_mandatory_list PJPROJECT "
 	;;
 	*)
-	POPT_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} POPT"
+	if test -n "PJPROJECT" -a "${ac_mandatory_list#* PJPROJECT *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability PJPROJECT has already been specified" "$LINENO" 5
+	fi
+	USE_PJPROJECT_STATIC=yes
+	PJPROJECT_STATIC_DIR="${withval}"
+	ac_mandatory_list="$ac_mandatory_list PJPROJECT "
 	;;
 	esac
 
+else
+   USE_PJPROJECT_STATIC=notspecified ;
 fi
 
 
@@ -10453,6 +10975,23 @@
 
 
 
+
+
+if test "$USE_PJPROJECT_SHARED" != "yes" -a "$USE_PJPROJECT_STATIC" = "notspecified" ; then
+	ac_mandatory_list="$ac_mandatory_list PJPROJECT "
+	USE_PJPROJECT_STATIC=yes
+fi
+
+if test "$USE_PJPROJECT_SHARED" = "yes" ; then
+   PJPROJECT_IMPLEMENTATION="PJPROJECT_SHARED"
+fi
+
+if test "$USE_PJPROJECT_STATIC" = "yes" ; then
+   PJPROJECT_IMPLEMENTATION="PJPROJECT_STATIC"
+   if test "x$PJPROJECT_STATIC_DIR" = "x" ; then
+      PJPROJECT_STATIC_DIR="${PWD}/third_party/pjproject/source"
+   fi
+fi
 
 
 PJ_TRANSACTION_GRP_LOCK_DESCRIP="PJSIP Transaction Group Lock Support"
@@ -10503,6 +11042,49 @@
 
 
 
+
+    POPT_DESCRIP="popt"
+    POPT_OPTION="popt"
+    PBX_POPT=0
+
+# Check whether --with-popt was given.
+if test "${with_popt+set}" = set; then :
+  withval=$with_popt;
+	case ${withval} in
+	n|no)
+	USE_POPT=no
+	# -1 is a magic value used by menuselect to know that the package
+	# was disabled, other than 'not found'
+	PBX_POPT=-1
+	;;
+	y|ye|yes)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_POPT=yes
+	ac_mandatory_list="$ac_mandatory_list POPT "
+	;;
+	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_POPT=yes
+	POPT_DIR="${withval}"
+	ac_mandatory_list="$ac_mandatory_list  "
+	;;
+	esac
+
+else
+   USE_POPT=notspecified ;
+fi
+
+
+
+
+
+
+
+
     PORTAUDIO_DESCRIP="PortAudio"
     PORTAUDIO_OPTION="portaudio"
     PBX_PORTAUDIO=0
@@ -10518,14 +11100,24 @@
 	PBX_PORTAUDIO=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} PORTAUDIO"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_PORTAUDIO=yes
+	ac_mandatory_list="$ac_mandatory_list PORTAUDIO "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_PORTAUDIO=yes
 	PORTAUDIO_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} PORTAUDIO"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_PORTAUDIO=notspecified ;
 fi
 
 
@@ -10550,14 +11142,24 @@
 	PBX_PRI=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} PRI"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_PRI=yes
+	ac_mandatory_list="$ac_mandatory_list PRI "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_PRI=yes
 	PRI_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} PRI"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_PRI=notspecified ;
 fi
 
 
@@ -10826,14 +11428,24 @@
 	PBX_PWLIB=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} PWLIB"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_PWLIB=yes
+	ac_mandatory_list="$ac_mandatory_list PWLIB "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_PWLIB=yes
 	PWLIB_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} PWLIB"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_PWLIB=notspecified ;
 fi
 
 
@@ -10858,14 +11470,24 @@
 	PBX_RADIUS=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} RADIUS"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_RADIUS=yes
+	ac_mandatory_list="$ac_mandatory_list RADIUS "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_RADIUS=yes
 	RADIUS_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} RADIUS"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_RADIUS=notspecified ;
 fi
 
 
@@ -10890,14 +11512,24 @@
 	PBX_RESAMPLE=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} RESAMPLE"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_RESAMPLE=yes
+	ac_mandatory_list="$ac_mandatory_list RESAMPLE "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_RESAMPLE=yes
 	RESAMPLE_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} RESAMPLE"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_RESAMPLE=notspecified ;
 fi
 
 
@@ -10922,14 +11554,24 @@
 	PBX_SDL=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} SDL"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_SDL=yes
+	ac_mandatory_list="$ac_mandatory_list SDL "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_SDL=yes
 	SDL_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} SDL"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_SDL=notspecified ;
 fi
 
 
@@ -10954,14 +11596,24 @@
 	PBX_SDL_IMAGE=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} SDL_IMAGE"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_SDL_IMAGE=yes
+	ac_mandatory_list="$ac_mandatory_list SDL_IMAGE "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_SDL_IMAGE=yes
 	SDL_IMAGE_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} SDL_IMAGE"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_SDL_IMAGE=notspecified ;
 fi
 
 
@@ -11010,14 +11662,24 @@
 	PBX_SPANDSP=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} SPANDSP"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_SPANDSP=yes
+	ac_mandatory_list="$ac_mandatory_list SPANDSP "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_SPANDSP=yes
 	SPANDSP_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} SPANDSP"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_SPANDSP=notspecified ;
 fi
 
 
@@ -11042,14 +11704,24 @@
 	PBX_SS7=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} SS7"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_SS7=yes
+	ac_mandatory_list="$ac_mandatory_list SS7 "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_SS7=yes
 	SS7_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} SS7"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_SS7=notspecified ;
 fi
 
 
@@ -11074,14 +11746,24 @@
 	PBX_SPEEX=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} SPEEX"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_SPEEX=yes
+	ac_mandatory_list="$ac_mandatory_list SPEEX "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_SPEEX=yes
 	SPEEX_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} SPEEX"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_SPEEX=notspecified ;
 fi
 
 
@@ -11106,14 +11788,24 @@
 	PBX_SPEEX_PREPROCESS=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} SPEEX_PREPROCESS"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_SPEEX_PREPROCESS=yes
+	ac_mandatory_list="$ac_mandatory_list SPEEX_PREPROCESS "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_SPEEX_PREPROCESS=yes
 	SPEEX_PREPROCESS_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} SPEEX_PREPROCESS"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_SPEEX_PREPROCESS=notspecified ;
 fi
 
 
@@ -11138,14 +11830,24 @@
 	PBX_SPEEXDSP=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} SPEEXDSP"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_SPEEXDSP=yes
+	ac_mandatory_list="$ac_mandatory_list SPEEXDSP "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_SPEEXDSP=yes
 	SPEEXDSP_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} SPEEXDSP"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_SPEEXDSP=notspecified ;
 fi
 
 
@@ -11181,14 +11883,24 @@
 	PBX_SQLITE=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} SQLITE"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_SQLITE=yes
+	ac_mandatory_list="$ac_mandatory_list SQLITE "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_SQLITE=yes
 	SQLITE_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} SQLITE"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_SQLITE=notspecified ;
 fi
 
 
@@ -11213,14 +11925,24 @@
 	PBX_SQLITE3=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} SQLITE3"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_SQLITE3=yes
+	ac_mandatory_list="$ac_mandatory_list SQLITE3 "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_SQLITE3=yes
 	SQLITE3_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} SQLITE3"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_SQLITE3=notspecified ;
 fi
 
 
@@ -11245,14 +11967,24 @@
 	PBX_SRTP=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} SRTP"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_SRTP=yes
+	ac_mandatory_list="$ac_mandatory_list SRTP "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_SRTP=yes
 	SRTP_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} SRTP"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_SRTP=notspecified ;
 fi
 
 
@@ -11289,14 +12021,24 @@
 	PBX_OPENSSL=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} OPENSSL"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_OPENSSL=yes
+	ac_mandatory_list="$ac_mandatory_list OPENSSL "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_OPENSSL=yes
 	OPENSSL_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} OPENSSL"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_OPENSSL=notspecified ;
 fi
 
 
@@ -11321,14 +12063,24 @@
 	PBX_SUPPSERV=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} SUPPSERV"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_SUPPSERV=yes
+	ac_mandatory_list="$ac_mandatory_list SUPPSERV "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_SUPPSERV=yes
 	SUPPSERV_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} SUPPSERV"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_SUPPSERV=notspecified ;
 fi
 
 
@@ -11353,14 +12105,24 @@
 	PBX_FREETDS=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} FREETDS"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_FREETDS=yes
+	ac_mandatory_list="$ac_mandatory_list FREETDS "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_FREETDS=yes
 	FREETDS_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} FREETDS"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_FREETDS=notspecified ;
 fi
 
 
@@ -11385,14 +12147,24 @@
 	PBX_TERMCAP=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} TERMCAP"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_TERMCAP=yes
+	ac_mandatory_list="$ac_mandatory_list TERMCAP "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_TERMCAP=yes
 	TERMCAP_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} TERMCAP"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_TERMCAP=notspecified ;
 fi
 
 
@@ -11417,14 +12189,24 @@
 	PBX_TIMERFD=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} TIMERFD"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_TIMERFD=yes
+	ac_mandatory_list="$ac_mandatory_list TIMERFD "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_TIMERFD=yes
 	TIMERFD_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} TIMERFD"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_TIMERFD=notspecified ;
 fi
 
 
@@ -11449,14 +12231,24 @@
 	PBX_TINFO=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} TINFO"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_TINFO=yes
+	ac_mandatory_list="$ac_mandatory_list TINFO "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_TINFO=yes
 	TINFO_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} TINFO"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_TINFO=notspecified ;
 fi
 
 
@@ -11481,14 +12273,24 @@
 	PBX_TONEZONE=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} TONEZONE"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_TONEZONE=yes
+	ac_mandatory_list="$ac_mandatory_list TONEZONE "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_TONEZONE=yes
 	TONEZONE_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} TONEZONE"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_TONEZONE=notspecified ;
 fi
 
 
@@ -11513,14 +12315,24 @@
 	PBX_UNIXODBC=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} UNIXODBC"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_UNIXODBC=yes
+	ac_mandatory_list="$ac_mandatory_list UNIXODBC "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_UNIXODBC=yes
 	UNIXODBC_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} UNIXODBC"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_UNIXODBC=notspecified ;
 fi
 
 
@@ -11545,14 +12357,24 @@
 	PBX_VORBIS=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} VORBIS"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_VORBIS=yes
+	ac_mandatory_list="$ac_mandatory_list VORBIS "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_VORBIS=yes
 	VORBIS_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} VORBIS"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_VORBIS=notspecified ;
 fi
 
 
@@ -11577,14 +12399,24 @@
 	PBX_VPB=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} VPB"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_VPB=yes
+	ac_mandatory_list="$ac_mandatory_list VPB "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_VPB=yes
 	VPB_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} VPB"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_VPB=notspecified ;
 fi
 
 
@@ -11609,14 +12441,24 @@
 	PBX_X11=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} X11"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_X11=yes
+	ac_mandatory_list="$ac_mandatory_list X11 "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_X11=yes
 	X11_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} X11"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_X11=notspecified ;
 fi
 
 
@@ -11641,14 +12483,24 @@
 	PBX_ZLIB=-1
 	;;
 	y|ye|yes)
-	ac_mandatory_list="${ac_mandatory_list} ZLIB"
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_ZLIB=yes
+	ac_mandatory_list="$ac_mandatory_list ZLIB "
 	;;
 	*)
+	if test -n "" -a "${ac_mandatory_list#*  *}" != "$ac_mandatory_list" ; then
+		as_fn_error $? "An option with capability  has already been specified" "$LINENO" 5
+	fi
+	USE_ZLIB=yes
 	ZLIB_DIR="${withval}"
-	ac_mandatory_list="${ac_mandatory_list} ZLIB"
+	ac_mandatory_list="$ac_mandatory_list  "
 	;;
 	esac
 
+else
+   USE_ZLIB=notspecified ;
 fi
 
 
@@ -24003,6 +24855,7 @@
    fi
 fi
 
+if test "$PJPROJECT_IMPLEMENTATION" = "PJPROJECT_SHARED" ; then
 
    if test "x${PBX_PJPROJECT}" != "x1" -a "${USE_PJPROJECT}" != "no"; then
 
@@ -24092,6 +24945,28 @@
    fi
 
 
+$as_echo "#define HAVE_PJPROJECT_SHARED 1" >>confdefs.h
+
+elif test "$PJPROJECT_IMPLEMENTATION" = "PJPROJECT_STATIC" ; then
+   if test -e "$PJPROJECT_STATIC_DIR/build.mak" ; then
+      PJPROJECT_INCLUDE=`make -f /dev/null --eval="include $PJPROJECT_STATIC_DIR/build.mak" --eval='$(info $(PJ_CFLAGS))' --eval='all:' -q -s`
+      PJPROJECT_LIB=`make -f /dev/null --eval="include $PJPROJECT_STATIC_DIR/build.mak" --eval='$(info $(APP_LDFLAGS) $(APP_LDLIBS))' --eval='all:' -q -s`
+      PJPROJECT_DIR="$PJPROJECT_STATIC_DIR"
+      PBX_PJPROJECT_STATIC=1
+      PBX_PJPROJECT=1
+
+
+$as_echo "#define HAVE_PJPROJECT 1" >>confdefs.h
+
+
+$as_echo "#define HAVE_PJPROJECT_STATIC 1" >>confdefs.h
+
+   else
+      PBX_PJPROJECT_STATIC=0
+      PBX_PJPROJECT=0
+   fi
+fi
+
 
 if test "x${PBX_PJ_TRANSACTION_GRP_LOCK}" != "x1" -a "${USE_PJ_TRANSACTION_GRP_LOCK}" != "no"; then
    pbxlibdir=""
@@ -24108,7 +24983,7 @@
       AST_PJ_TRANSACTION_GRP_LOCK_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
-      CFLAGS="${CFLAGS} $PJPROJECT_CFLAGS"
+      CFLAGS="${CFLAGS} $PJPROJECT_INCLUDE"
       as_ac_Lib=`$as_echo "ac_cv_lib_pjsip_${pbxfuncname}" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpjsip" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lpjsip... " >&6; }
@@ -24116,7 +24991,7 @@
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpjsip ${pbxlibdir} $PJPROJECT_LIBS $LIBS"
+LIBS="-lpjsip ${pbxlibdir} $PJPROJECT_LIB $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -24158,12 +25033,12 @@
 
    # now check for the header.
    if test "${AST_PJ_TRANSACTION_GRP_LOCK_FOUND}" = "yes"; then
-      PJ_TRANSACTION_GRP_LOCK_LIB="${pbxlibdir} -lpjsip $PJPROJECT_LIBS"
+      PJ_TRANSACTION_GRP_LOCK_LIB="${pbxlibdir} -lpjsip $PJPROJECT_LIB"
       # if --with-PJ_TRANSACTION_GRP_LOCK=DIR has been specified, use it.
       if test "x${PJ_TRANSACTION_GRP_LOCK_DIR}" != "x"; then
          PJ_TRANSACTION_GRP_LOCK_INCLUDE="-I${PJ_TRANSACTION_GRP_LOCK_DIR}/include"
       fi
-      PJ_TRANSACTION_GRP_LOCK_INCLUDE="${PJ_TRANSACTION_GRP_LOCK_INCLUDE} $PJPROJECT_CFLAGS"
+      PJ_TRANSACTION_GRP_LOCK_INCLUDE="${PJ_TRANSACTION_GRP_LOCK_INCLUDE} $PJPROJECT_INCLUDE"
       if test "xpjsip.h" = "x" ; then	# no header, assume found
          PJ_TRANSACTION_GRP_LOCK_HEADER_FOUND="1"
       else				# check for the header
@@ -24199,8 +25074,8 @@
 
 saved_cppflags="${CPPFLAGS}"
 saved_libs="${LIBS}"
-CPPFLAGS="${CPPFLAGS} ${PJPROJECT_CFLAGS}"
-LIBS="${LIBS} ${PJPROJECT_LIBS}"
+CPPFLAGS="${CPPFLAGS} ${PJPROJECT_INCLUDE}"
+LIBS="${LIBS} ${PJPROJECT_LIB}"
 
     if test "x${PBX_PJSIP_REPLACE_MEDIA_STREAM}" != "x1" -a "${USE_PJSIP_REPLACE_MEDIA_STREAM}" != "no"; then
         if test "x" != "x"; then
@@ -24265,7 +25140,7 @@
       AST_PJSIP_GET_DEST_INFO_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
-      CFLAGS="${CFLAGS} $PJPROJECT_CFLAGS"
+      CFLAGS="${CFLAGS} $PJPROJECT_INCLUDE"
       as_ac_Lib=`$as_echo "ac_cv_lib_pjsip_${pbxfuncname}" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpjsip" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lpjsip... " >&6; }
@@ -24273,7 +25148,7 @@
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpjsip ${pbxlibdir} $PJPROJECT_LIBS $LIBS"
+LIBS="-lpjsip ${pbxlibdir} $PJPROJECT_LIB $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -24315,12 +25190,12 @@
 
    # now check for the header.
    if test "${AST_PJSIP_GET_DEST_INFO_FOUND}" = "yes"; then
-      PJSIP_GET_DEST_INFO_LIB="${pbxlibdir} -lpjsip $PJPROJECT_LIBS"
+      PJSIP_GET_DEST_INFO_LIB="${pbxlibdir} -lpjsip $PJPROJECT_LIB"
       # if --with-PJSIP_GET_DEST_INFO=DIR has been specified, use it.
       if test "x${PJSIP_GET_DEST_INFO_DIR}" != "x"; then
          PJSIP_GET_DEST_INFO_INCLUDE="-I${PJSIP_GET_DEST_INFO_DIR}/include"
       fi
-      PJSIP_GET_DEST_INFO_INCLUDE="${PJSIP_GET_DEST_INFO_INCLUDE} $PJPROJECT_CFLAGS"
+      PJSIP_GET_DEST_INFO_INCLUDE="${PJSIP_GET_DEST_INFO_INCLUDE} $PJPROJECT_INCLUDE"
       if test "xpjsip.h" = "x" ; then	# no header, assume found
          PJSIP_GET_DEST_INFO_HEADER_FOUND="1"
       else				# check for the header
@@ -24369,7 +25244,7 @@
       AST_PJ_SSL_CERT_LOAD_FROM_FILES2_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
-      CFLAGS="${CFLAGS} $PJPROJECT_CFLAGS"
+      CFLAGS="${CFLAGS} $PJPROJECT_INCLUDE"
       as_ac_Lib=`$as_echo "ac_cv_lib_pj_${pbxfuncname}" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpj" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lpj... " >&6; }
@@ -24377,7 +25252,7 @@
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpj ${pbxlibdir} $PJPROJECT_LIBS $LIBS"
+LIBS="-lpj ${pbxlibdir} $PJPROJECT_LIB $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -24419,12 +25294,12 @@
 
    # now check for the header.
    if test "${AST_PJ_SSL_CERT_LOAD_FROM_FILES2_FOUND}" = "yes"; then
-      PJ_SSL_CERT_LOAD_FROM_FILES2_LIB="${pbxlibdir} -lpj $PJPROJECT_LIBS"
+      PJ_SSL_CERT_LOAD_FROM_FILES2_LIB="${pbxlibdir} -lpj $PJPROJECT_LIB"
       # if --with-PJ_SSL_CERT_LOAD_FROM_FILES2=DIR has been specified, use it.
       if test "x${PJ_SSL_CERT_LOAD_FROM_FILES2_DIR}" != "x"; then
          PJ_SSL_CERT_LOAD_FROM_FILES2_INCLUDE="-I${PJ_SSL_CERT_LOAD_FROM_FILES2_DIR}/include"
       fi
-      PJ_SSL_CERT_LOAD_FROM_FILES2_INCLUDE="${PJ_SSL_CERT_LOAD_FROM_FILES2_INCLUDE} $PJPROJECT_CFLAGS"
+      PJ_SSL_CERT_LOAD_FROM_FILES2_INCLUDE="${PJ_SSL_CERT_LOAD_FROM_FILES2_INCLUDE} $PJPROJECT_INCLUDE"
       if test "xpjlib.h" = "x" ; then	# no header, assume found
          PJ_SSL_CERT_LOAD_FROM_FILES2_HEADER_FOUND="1"
       else				# check for the header
@@ -24458,6 +25333,10 @@
 
 
 
+if test "$PJPROJECT_IMPLEMENTATION" = "PJPROJECT_STATIC" ; then
+   PJPROJECT_LIB=""
+fi
+
 
 if test "x${PBX_POPT}" != "x1" -a "${USE_POPT}" != "no"; then
    pbxlibdir=""
diff --git a/configure.ac b/configure.ac
index 54cbab2..ef00bf6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -457,12 +457,40 @@
 AST_EXT_LIB_SETUP([OSPTK], [OSP Toolkit], [osptk])
 AST_EXT_LIB_SETUP([OSS], [Open Sound System], [oss])
 AST_EXT_LIB_SETUP([PGSQL], [PostgreSQL], [postgres])
-AST_EXT_LIB_SETUP([PJPROJECT], [PJPROJECT], [pjproject])
-AST_EXT_LIB_SETUP([POPT], [popt], [popt])
+
+PBX_PJPROJECT=0
+AH_TEMPLATE(m4_bpatsubst([[HAVE_PJPROJECT]], [(.*)]), [Define to 1 if you have the $2 library.])
+AC_SUBST([PJPROJECT_LIB])
+AC_SUBST([PJPROJECT_INCLUDE])
+AC_SUBST([PJPROJECT_DIR])
+AC_SUBST([PBX_PJPROJECT])
+AC_SUBST([PJPROJECT_IMPLEMENTATION])
+
+AST_EXT_LIB_SETUP([PJPROJECT_SHARED], [Shared pjproject], [pjproject-shared], [], [PJPROJECT])
+AST_EXT_LIB_SETUP([PJPROJECT_STATIC], [Static pjproject], [pjproject-static], [], [PJPROJECT])
+
+if test "$USE_PJPROJECT_SHARED" != "yes" -a "$USE_PJPROJECT_STATIC" = "notspecified" ; then
+	ac_mandatory_list="$ac_mandatory_list PJPROJECT "
+	USE_PJPROJECT_STATIC=yes
+fi
+
+if test "$USE_PJPROJECT_SHARED" = "yes" ; then
+   PJPROJECT_IMPLEMENTATION="PJPROJECT_SHARED"
+fi
+
+if test "$USE_PJPROJECT_STATIC" = "yes" ; then
+   PJPROJECT_IMPLEMENTATION="PJPROJECT_STATIC"
+   if test "x$PJPROJECT_STATIC_DIR" = "x" ; then
+      PJPROJECT_STATIC_DIR="${PWD}/third_party/pjproject/source"
+   fi
+fi
+
 AST_EXT_LIB_SETUP_OPTIONAL([PJ_TRANSACTION_GRP_LOCK], [PJSIP Transaction Group Lock Support], [PJPROJECT], [pjsip])
 AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_REPLACE_MEDIA_STREAM], [PJSIP Media Stream Replacement Support], [PJPROJECT], [pjsip])
 AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_GET_DEST_INFO], [pjsip_get_dest_info support], [PJPROJECT], [pjsip])
 AST_EXT_LIB_SETUP_OPTIONAL([PJ_SSL_CERT_LOAD_FROM_FILES2], [pj_ssl_cert_load_from_files2 support], [PJPROJECT], [pjsip])
+
+AST_EXT_LIB_SETUP([POPT], [popt], [popt])
 AST_EXT_LIB_SETUP([PORTAUDIO], [PortAudio], [portaudio])
 AST_EXT_LIB_SETUP([PRI], [ISDN PRI], [pri])
 AST_EXT_LIB_SETUP_OPTIONAL([PRI_SETUP_ACK_INBAND], [ISDN PRI progress inband ie in SETUP ACK], [PRI], [pri])
@@ -2076,20 +2104,41 @@
    fi
 fi
 
-AST_PKG_CONFIG_CHECK([PJPROJECT], [libpjproject])
+if test "$PJPROJECT_IMPLEMENTATION" = "PJPROJECT_SHARED" ; then
+   AST_PKG_CONFIG_CHECK([PJPROJECT], [libpjproject])
+   AC_DEFINE([HAVE_PJPROJECT_SHARED], 1, [Define if your system has the pjproject shared libraries.])
+elif test "$PJPROJECT_IMPLEMENTATION" = "PJPROJECT_STATIC" ; then
+   if test -e "$PJPROJECT_STATIC_DIR/build.mak" ; then
+      PJPROJECT_INCLUDE=`make -f /dev/null --eval="include $PJPROJECT_STATIC_DIR/build.mak" --eval='$(info $(PJ_CFLAGS))' --eval='all:' -q -s`
+      PJPROJECT_LIB=`make -f /dev/null --eval="include $PJPROJECT_STATIC_DIR/build.mak" --eval='$(info $(APP_LDFLAGS) $(APP_LDLIBS))' --eval='all:' -q -s`
+      PJPROJECT_DIR="$PJPROJECT_STATIC_DIR"
+      PBX_PJPROJECT_STATIC=1
+      PBX_PJPROJECT=1
 
-AST_EXT_LIB_CHECK([PJ_TRANSACTION_GRP_LOCK], [pjsip], [pjsip_tsx_create_uac2], [pjsip.h], [$PJPROJECT_LIBS], [$PJPROJECT_CFLAGS])
+      AC_DEFINE([HAVE_PJPROJECT], 1, [Define if your system has the pjproject libraries.])
+      AC_DEFINE([HAVE_PJPROJECT_STATIC], 1, [Define if your system has the pjproject static libraries.])
+   else
+      PBX_PJPROJECT_STATIC=0
+      PBX_PJPROJECT=0
+   fi
+fi
+
+AST_EXT_LIB_CHECK([PJ_TRANSACTION_GRP_LOCK], [pjsip], [pjsip_tsx_create_uac2], [pjsip.h], [$PJPROJECT_LIB], [$PJPROJECT_INCLUDE])
 
 saved_cppflags="${CPPFLAGS}"
 saved_libs="${LIBS}"
-CPPFLAGS="${CPPFLAGS} ${PJPROJECT_CFLAGS}"
-LIBS="${LIBS} ${PJPROJECT_LIBS}"
+CPPFLAGS="${CPPFLAGS} ${PJPROJECT_INCLUDE}"
+LIBS="${LIBS} ${PJPROJECT_LIB}"
 AST_C_COMPILE_CHECK([PJSIP_REPLACE_MEDIA_STREAM], [pjmedia_mod_offer_flag flag = PJMEDIA_SDP_NEG_ALLOW_MEDIA_CHANGE], [pjmedia.h])
 LIBS="${saved_libs}"
 CPPFLAGS="${saved_cppflags}"
 
-AST_EXT_LIB_CHECK([PJSIP_GET_DEST_INFO], [pjsip], [pjsip_get_dest_info], [pjsip.h], [$PJPROJECT_LIBS], [$PJPROJECT_CFLAGS])
-AST_EXT_LIB_CHECK([PJ_SSL_CERT_LOAD_FROM_FILES2], [pj], [pj_ssl_cert_load_from_files2], [pjlib.h], [$PJPROJECT_LIBS], [$PJPROJECT_CFLAGS])
+AST_EXT_LIB_CHECK([PJSIP_GET_DEST_INFO], [pjsip], [pjsip_get_dest_info], [pjsip.h], [$PJPROJECT_LIB], [$PJPROJECT_INCLUDE])
+AST_EXT_LIB_CHECK([PJ_SSL_CERT_LOAD_FROM_FILES2], [pj], [pj_ssl_cert_load_from_files2], [pjlib.h], [$PJPROJECT_LIB], [$PJPROJECT_INCLUDE])
+
+if test "$PJPROJECT_IMPLEMENTATION" = "PJPROJECT_STATIC" ; then
+   PJPROJECT_LIB=""
+fi
 
 AST_EXT_LIB_CHECK([POPT], [popt], [poptStrerror], [popt.h])
 
@@ -2253,11 +2302,11 @@
 if test "x$LIBCRYPT_LIB" != "x" ; then
     CRYPT_LIB="$LIBCRYPT_LIB"
     CRYPT_INCLUDE="$LIBCRYPT_INCLUDE"
-    AC_DEFINE([HAVE_CRYPT], [1], [Define to 1 if you have the `crypt' function.])
+    AC_DEFINE([HAVE_CRYPT], [1], [Define to 1 if you have the 'crypt' function.])
 elif test "x$SYSCRYPT" != "x" ; then
     CRYPT_LIB=""
     CRYPT_INCLUDE=""
-    AC_DEFINE([HAVE_CRYPT], [1], [Define to 1 if you have the `crypt' function.])
+    AC_DEFINE([HAVE_CRYPT], [1], [Define to 1 if you have the 'crypt' function.])
 fi
 
 AC_SUBST(CRYPT_LIB)
@@ -2265,7 +2314,7 @@
 
 # Find crypt_r support
 AC_CHECK_LIB([crypt], [crypt_r],
-    [AC_DEFINE([HAVE_CRYPT_R], [1], [Define to 1 if you have the `crypt_r' function.])])
+    [AC_DEFINE([HAVE_CRYPT_R], [1], [Define to 1 if you have the 'crypt_r' function.])])
 
 AST_EXT_LIB_CHECK([CRYPTO], [crypto], [AES_encrypt], [openssl/aes.h])
 
diff --git a/default.exports b/default.exports.in
similarity index 100%
rename from default.exports
rename to default.exports.in
diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in
index 542f5d2..25e68f7 100644
--- a/include/asterisk/autoconfig.h.in
+++ b/include/asterisk/autoconfig.h.in
@@ -155,13 +155,13 @@
 /* Define to 1 if you have the `cosl' function. */
 #undef HAVE_COSL
 
-/* Define to 1 if you have the `crypt' function. */
+/* Define to 1 if you have the 'crypt' function. */
 #undef HAVE_CRYPT
 
 /* Define to 1 if you have the OpenSSL Cryptography library. */
 #undef HAVE_CRYPTO
 
-/* Define to 1 if you have the `crypt_r' function. */
+/* Define to 1 if you have the 'crypt_r' function. */
 #undef HAVE_CRYPT_R
 
 /* Define to 1 if you have a functional curl library. */
@@ -578,9 +578,15 @@
 /* Define to indicate presence of the pg_encoding_to_char API. */
 #undef HAVE_PGSQL_pg_encoding_to_char
 
-/* Define if your system has the PJPROJECT libraries. */
+/* Define if your system has the pjproject libraries. */
 #undef HAVE_PJPROJECT
 
+/* Define if your system has the pjproject shared libraries. */
+#undef HAVE_PJPROJECT_SHARED
+
+/* Define if your system has the pjproject static libraries. */
+#undef HAVE_PJPROJECT_STATIC
+
 /* Define to 1 if PJPROJECT has the pjsip_get_dest_info support feature. */
 #undef HAVE_PJSIP_GET_DEST_INFO
 
diff --git a/include/asterisk/res_pjsip.h b/include/asterisk/res_pjsip.h
index 5dc16bc..0f5f427 100644
--- a/include/asterisk/res_pjsip.h
+++ b/include/asterisk/res_pjsip.h
@@ -2108,6 +2108,16 @@
 void ast_sip_get_default_from_user(char *from_user, size_t size);
 
 /*! \brief Determines whether the res_pjsip module is loaded */
+#ifdef HAVE_PJPROJECT_STATIC
+#define CHECK_PJSIP_MODULE_LOADED()				\
+	do {							\
+		if (!ast_module_check("res_pjsip.so")		\
+			|| !ast_module_check("res_pjproject.so") \
+			|| !ast_sip_get_pjsip_endpoint()) {	\
+			return AST_MODULE_LOAD_DECLINE;		\
+		}						\
+	} while(0)
+#else
 #define CHECK_PJSIP_MODULE_LOADED()				\
 	do {							\
 		if (!ast_module_check("res_pjsip.so")		\
@@ -2115,7 +2125,7 @@
 			return AST_MODULE_LOAD_DECLINE;		\
 		}						\
 	} while(0)
-
+#endif
 /*!
  * \brief Retrieve the system keep alive interval setting.
  *
diff --git a/makeopts.in b/makeopts.in
index 943bc3a..470cb4d 100644
--- a/makeopts.in
+++ b/makeopts.in
@@ -229,8 +229,10 @@
 PGSQL_INCLUDE=@PGSQL_INCLUDE@
 PGSQL_LIB=@PGSQL_LIB@
 
+PJPROJECT_IMPLEMENTATION=@PJPROJECT_IMPLEMENTATION@
 PJPROJECT_INCLUDE=@PJPROJECT_INCLUDE@
 PJPROJECT_LIB=@PJPROJECT_LIB@
+PJPROJECT_DIR=@PJPROJECT_DIR@
 
 POPT_INCLUDE=@POPT_INCLUDE@
 POPT_LIB=@POPT_LIB@
diff --git a/res/Makefile b/res/Makefile
index d2a2ad9..18b5749 100644
--- a/res/Makefile
+++ b/res/Makefile
@@ -97,3 +97,36 @@
 
 # Dependencies for res_ari_*.so are generated, so they're in this file
 include ari.make
+
+ifeq ($(PJPROJECT_IMPLEMENTATION),PJPROJECT_STATIC)
+ifeq ($(MAKECMDGOALS),all)
+
+include $(PJPROJECT_DIR)/build.mak
+
+res_pjproject.exports: res_pjproject.exports.in $(PJPROJECT_DIR)/build.mak $(ASTTOPDIR)/config.log
+	$(ECHO_PREFIX) echo "   [GENERATE] res_pjproject.exports.in -> res_pjproject.exports"
+	$(CMD_PREFIX) echo -e "{\n\tglobal:" > res_pjproject.exports
+	$(CMD_PREFIX) sed -n -r -e "s/LINKER_SYMBOL_PREFIX(.*)/$(LINKER_SYMBOL_PREFIX)\1/gp" res_pjproject.exports.in >> res_pjproject.exports
+	$(CMD_PREFIX) for f in $(APP_LIBXX_FILES) ; do objdump -t $${f} | sed -n -r -e "s/^[0-9A-Fa-f]+ g     [FfO ]\s+\.[^ ]+\s+[0-9A-Fa-f]+\s+([^_].*)/\t\t$(LINKER_SYMBOL_PREFIX)\1;/gp" | sort -u >> res_pjproject.exports ; done
+	$(CMD_PREFIX) echo -e "\tlocal:\n\t\t*;\n};" >> res_pjproject.exports
+
+PJPROJECT_LDLIBS := -Wl,--whole-archive \
+	$(PJSUA_LIB_LDLIB) \
+	$(PJSIP_UA_LDLIB) \
+	$(PJSIP_SIMPLE_LDLIB) \
+	$(PJSIP_LDLIB) \
+	$(PJNATH_LDLIB) \
+	$(PJMEDIA_CODEC_LDLIB) \
+	$(PJMEDIA_LDLIB) \
+	$(PJLIB_UTIL_LDLIB) \
+	$(PJLIB_LDLIB) \
+	-Wl,--no-whole-archive \
+	$(APP_THIRD_PARTY_LIBS)\
+	$(APP_THIRD_PARTY_EXT)
+
+res_pjproject.o: _ASTCFLAGS+=$(PJ_CFLAGS)
+res_pjproject.so: _ASTLDFLAGS+=$(PJ_LDFLAGS) -Wl,-E
+res_pjproject.so: LIBS= $(PJPROJECT_LDLIBS) -lssl -lcrypto -luuid -lm -lrt -lpthread
+
+endif
+endif
diff --git a/third_party/Makefile b/third_party/Makefile
new file mode 100644
index 0000000..7d4d650
--- /dev/null
+++ b/third_party/Makefile
@@ -0,0 +1,8 @@
+
+SUBDIRS := $(wildcard */.)
+
+.PHONY : all $(SUBDIRS)
+all : $(SUBDIRS)
+
+$(SUBDIRS) :
+	$(MAKE) -C $@
diff --git a/third_party/pjproject/.gitignore b/third_party/pjproject/.gitignore
new file mode 100644
index 0000000..b5d5f4c
--- /dev/null
+++ b/third_party/pjproject/.gitignore
@@ -0,0 +1,4 @@
+include/
+lib/
+source/
+**.bz2
diff --git a/third_party/pjproject/Makefile b/third_party/pjproject/Makefile
new file mode 100644
index 0000000..338d982
--- /dev/null
+++ b/third_party/pjproject/Makefile
@@ -0,0 +1,41 @@
+#
+# This Makefile can use some work!!
+#
+PJ_VERSION=2.4.5
+
+CONFIG_OPTS = --prefix= --with-external-speex --with-external-gsm --with-external-srtp \
+	--with-external-pa --disable-video --disable-v4l2 --disable-sound --disable-resample \
+	--disable-opencore-amr --disable-ilbc-codec --without-libyuv --disable-g7221-codec
+
+.PHONY: all clean distclean compile source configure
+
+all: compile
+
+pjproject-$(PJ_VERSION).tar.bz2 :
+	@curl -L -R http://www.pjsip.org/release/$(PJ_VERSION)/pjproject-$(PJ_VERSION).tar.bz2 -o pjproject-$(PJ_VERSION).tar.bz2 -z pjproject-$(PJ_VERSION).tar.bz2 
+
+source/version.mak: pjproject-$(PJ_VERSION).tar.bz2
+	@echo Unpacking $<
+	- at mkdir source
+	@tar --strip-components=1 -C source -xjf pjproject-$(PJ_VERSION).tar.bz2
+	@touch source/version.mak
+	
+source/patched: source/version.mak
+	@./apply_patches ./patches ./source
+
+source/Makefile: source/patched 
+	@echo Configuring
+	@(cd source ; ./configure -q $(CONFIG_OPTS) CFLAGS="-DNDEBUG -fPIC" && echo "Making dependencies" ; make dep > /dev/null)
+	@touch source/Makefile
+
+configure: source/Makefile
+
+compile: configure
+	@echo Compiling
+	@$(MAKE) -C source >/dev/null
+
+clean:
+	@$(MAKE) -C source clean
+
+distclean:
+	- at rm -rf source
diff --git a/third_party/pjproject/apply_patches b/third_party/pjproject/apply_patches
new file mode 100755
index 0000000..723a9a5
--- /dev/null
+++ b/third_party/pjproject/apply_patches
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+patchdir=${1:?You must supply a patches directory}
+sourcedir=${2?:You must supply a source directory}
+
+patchdir=`readlink -f $patchdir`
+sourcedir=`readlink -f $sourcedir`
+
+if [ ! -d "$patchdir" ] ; then
+	echo "$patchdir is not a directory"
+	exit 1
+fi
+
+if [ ! -d "$sourcedir" ] ; then
+	echo "$sourcedir is not a directory"
+	exit 1
+fi
+
+if [ ! -f "$patchdir"/*.patch ] ; then
+	echo "No patches in $patchdir"
+	exit 0
+fi
+
+if [ -f "$sourcedir/patched" ] ; then
+	echo "$sourcedir already patched"
+	exit 0
+fi
+
+declare -i ok=1
+for patchfile in "$patchdir"/*.patch ; do
+	patch -d "$sourcedir" -p1 -s -r- -f -N --dry-run -i "$patchfile" 2&>/dev/null || (ok=0 ; echo "Patchfile $(basename $patchfile) failed to apply" ; break )
+done
+
+if [ $ok -eq 0 ] ; then
+	exit 1
+fi
+
+for patchfile in "$patchdir"/*.patch ; do
+	echo "Applying patch $(basename $patchfile)"
+	patch -d "$sourcedir" -p1 -s -i "$patchfile" || exit 1
+done
+
+touch "$sourcedir/patched"
+
+exit 0
+
diff --git a/third_party/pjproject/patches/0002-no_third_party.patch b/third_party/pjproject/patches/0002-no_third_party.patch
new file mode 100644
index 0000000..b671909
--- /dev/null
+++ b/third_party/pjproject/patches/0002-no_third_party.patch
@@ -0,0 +1,17 @@
+--- pjproject-2.2/third_party/build/os-linux.mak	2014-01-02 22:44:05.000000000 -0500
++++ pjproject-2.2-no_third_party/third_party/build/os-linux.mak	2014-02-28 10:56:33.998682746 -0500
+@@ -1,9 +1,9 @@
+-DIRS += gsm
++#DIRS += gsm
+-DIRS += ilbc
+-DIRS += speex
+-DIRS += portaudio
+-DIRS += g7221
+-DIRS += srtp
+-DIRS += resample
++#DIRS += ilbc
++#DIRS += speex
++#DIRS += portaudio
++#DIRS += g7221
++#DIRS += srtp
++#DIRS += resample

-- 
To view, visit https://gerrit.asterisk.org/2072
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia7a60c28c2e9ba9537c5570f933c1ebcb20a3103
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: George Joseph <george.joseph at fairview5.com>



More information about the asterisk-code-review mailing list