Subject: Avoid linking the asterisk binary with the H.323 libraries
Author: Faidon Liambotis <paravoid@debian.org>
Forwarded: no
Last-Update: 2010-10-20

Don't link the Asterisk binary with the H.323 libraries since they are only
used by separate shared object, chan_h323.so. (Closes: #433884)

WARNING: this will make Asterisk segfault (see #435146) when loading
chan_h323.so because libopenh323 is buggy (#438815).

We are working around this, see patch h323-workaround-openh323-segfault.

--- a/main/Makefile
+++ b/main/Makefile
@@ -153,13 +153,6 @@ AST_EMBED_LDFLAGS:=$(foreach dep,$(EMBED
 AST_EMBED_LIBS:=$(foreach dep,$(EMBED_LIBS),$(value $(dep)))
 OBJS:=$(sort $(OBJS))
 
-ifneq ($(wildcard ../channels/h323/Makefile.ast),)
-  include ../channels/h323/Makefile.ast
-else
-  H323LDFLAGS=
-  H323LDLIBS=
-endif
-
 ifneq ($(findstring $(OSARCH), mingw32 cygwin ),)
 MAIN_TGT:=asterisk.dll
 asterisk: cygload
@@ -177,11 +170,7 @@ endif
 $(MAIN_TGT): $(OBJS) editline/libedit.a db1-ast/libdb1.a $(AST_EMBED_LDSCRIPTS)
 	@$(CC) -c -o buildinfo.o $(_ASTCFLAGS) buildinfo.c $(ASTCFLAGS)
 	$(ECHO_PREFIX) echo "   [LD] $(OBJS) editline/libedit.a db1-ast/libdb1.a $(AST_EMBED_LDSCRIPTS) -> $@"
-ifneq ($(findstring chan_h323,$(MENUSELECT_CHANNELS)),)
 	$(CMD_PREFIX) $(CC) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(_ASTLDFLAGS) $(ASTLDFLAGS) $(OBJS) editline/libedit.a db1-ast/libdb1.a $(AST_EMBED_LDSCRIPTS) buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS) $(GMIMELDFLAGS)
-else
-	$(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(_ASTLDFLAGS) $(ASTLDFLAGS) $(H323LDFLAGS) $(OBJS) editline/libedit.a db1-ast/libdb1.a $(AST_EMBED_LDSCRIPTS) buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS) $(H323LDLIBS) $(GMIMELDFLAGS)
-endif
 
 ifeq ($(GNU_LD),1)
 $(MAIN_TGT): asterisk.exports
