Instead of linking libresample into the main Asterisk binary, build it as
authorRussell Bryant <russell@russellbryant.com>
Wed, 2 Jan 2008 01:00:44 +0000 (01:00 +0000)
committerRussell Bryant <russell@russellbryant.com>
Wed, 2 Jan 2008 01:00:44 +0000 (01:00 +0000)
res_resample, and mark codec_resample as dependent upon res_resample.  This
prevents the linker from optimizing away libresample, and also makes it so the
libresample code isn't linked in to multiple places.  (I have another module
in a branch that needs it, too.)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@95697 65c4cc65-6c06-0410-ace0-fbb531ad65f3

26 files changed:
codecs/Makefile
codecs/codec_resample.c
main/Makefile
res/Makefile
res/libresample/LICENSE.txt [moved from main/libresample/LICENSE.txt with 100% similarity]
res/libresample/Makefile.asterisk [moved from main/libresample/Makefile.asterisk with 100% similarity]
res/libresample/Makefile.in [moved from main/libresample/Makefile.in with 100% similarity]
res/libresample/README.txt [moved from main/libresample/README.txt with 100% similarity]
res/libresample/config.guess [moved from main/libresample/config.guess with 100% similarity]
res/libresample/config.sub [moved from main/libresample/config.sub with 100% similarity]
res/libresample/configure [moved from main/libresample/configure with 100% similarity]
res/libresample/configure.in [moved from main/libresample/configure.in with 100% similarity]
res/libresample/include/libresample.h [moved from main/libresample/include/libresample.h with 100% similarity]
res/libresample/install-sh [moved from main/libresample/install-sh with 100% similarity]
res/libresample/src/configtemplate.h [moved from main/libresample/src/configtemplate.h with 100% similarity]
res/libresample/src/filterkit.c [moved from main/libresample/src/filterkit.c with 100% similarity]
res/libresample/src/filterkit.h [moved from main/libresample/src/filterkit.h with 100% similarity]
res/libresample/src/resample.c [moved from main/libresample/src/resample.c with 100% similarity]
res/libresample/src/resample_defs.h [moved from main/libresample/src/resample_defs.h with 100% similarity]
res/libresample/src/resamplesubs.c [moved from main/libresample/src/resamplesubs.c with 100% similarity]
res/libresample/tests/compareresample.c [moved from main/libresample/tests/compareresample.c with 100% similarity]
res/libresample/tests/resample-sndfile.c [moved from main/libresample/tests/resample-sndfile.c with 100% similarity]
res/libresample/tests/testresample.c [moved from main/libresample/tests/testresample.c with 100% similarity]
res/libresample/win/libresample.dsp [moved from main/libresample/win/libresample.dsp with 100% similarity]
res/libresample/win/libresample.vcproj [moved from main/libresample/win/libresample.vcproj with 100% similarity]
res/res_resample.c [new file with mode: 0644]

index f7bde5c..ef76962 100644 (file)
@@ -55,7 +55,4 @@ $(LIBG722):
 
 $(if $(filter codec_g722,$(EMBEDDED_MODS)),modules.link,codec_g722.so): $(LIBG722)
 
-codec_resample.o: ASTCFLAGS+=-I$(ASTTOPDIR)/main/libresample/include
-ifneq ($(findstring $(OSARCH), mingw32 cygwin ),)
-  codec_resample.so: LIBS += $(ASTTOPDIR)/main/libresample/libresample.a
-endif
+codec_resample.o: ASTCFLAGS+=-I$(ASTTOPDIR)/res/libresample/include
index 66d6016..718ab88 100644 (file)
  * \ingroup codecs
  */
 
+/*** MODULEINFO
+       <depend>res_resample</depend>
+ ***/
+
 #include "asterisk.h"
 
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
index fc5fbd7..ffbd4bf 100644 (file)
@@ -111,9 +111,6 @@ editline/libedit.a: CHECK_SUBDIR
 db1-ast/libdb1.a: CHECK_SUBDIR
        CFLAGS="$(ASTCFLAGS)" LDFLAGS="$(ASTLDFLAGS)" $(MAKE) -C db1-ast libdb1.a
 
-libresample/libresample.a: CHECK_SUBDIR
-       $(MAKE) -f Makefile.asterisk -C libresample libresample.a
-
 ast_expr2.c ast_expr2.h:
        bison -o $@ -d --name-prefix=ast_yy ast_expr2.y
 
@@ -155,7 +152,7 @@ else
 MAIN_TGT:=asterisk
 endif
 
-$(MAIN_TGT): $(OBJS) editline/libedit.a db1-ast/libdb1.a minimime/libmmime.a $(AST_EMBED_LDSCRIPTS) libresample/libresample.a
+$(MAIN_TGT): $(OBJS) editline/libedit.a db1-ast/libdb1.a minimime/libmmime.a $(AST_EMBED_LDSCRIPTS)
        @$(CC) -c -o buildinfo.o $(ASTCFLAGS) buildinfo.c
        $(ECHO_PREFIX) echo "   [LD] $^ -> $@"
 ifneq ($(findstring chan_h323,$(MENUSELECT_CHANNELS)),)
@@ -172,4 +169,3 @@ clean::
        @$(MAKE) -C db1-ast clean
        @$(MAKE) -C stdtime clean
        @$(MAKE) -C minimime clean
-       @$(MAKE) -f Makefile.asterisk -C libresample clean
index cfac318..496264f 100644 (file)
@@ -47,6 +47,9 @@ ael/ael.tab.c ael/ael.tab.h:
 
 ael/pval.o: ael/pval.c
 
+res_resample.so: libresample/src/resample.o libresample/src/resamplesubs.o libresample/src/filterkit.o
+
 clean::
        rm -f snmp/*.o
        rm -f ael/*.o
+       rm -f libresample/src/*.o
diff --git a/res/res_resample.c b/res/res_resample.c
new file mode 100644 (file)
index 0000000..ac85c3f
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Asterisk -- A telephony toolkit for Linux.
+ *
+ * Copyright (C) 2007, Digium, Inc.
+ *
+ * Russell Bryant <russell@digium.com>
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*!
+ * \file
+ *
+ * \author Russell Bryant <russell@digium.com>
+ */
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include "asterisk/module.h"
+
+static int load_module(void)
+{
+       return 0;
+}
+
+static int unload_module(void)
+{
+       return -1;
+}
+
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS, "Resampling Support via libresample",
+               .load = load_module,
+               .unload = unload_module,
+              );