From 29f496ef12247a2401d02428fa533020b588f5b6 Mon Sep 17 00:00:00 2001 From: kpfleming Date: Mon, 24 Apr 2006 17:11:45 +0000 Subject: Thanks to the fine work of Russell Bryant and Dancho Lazarov, we now have autoconf and menuselect tools for Asterisk! git-svn-id: http://svn.digium.com/svn/asterisk/trunk@22267 f38db490-d61c-443f-a65b-d21fe96a405b --- res/Makefile | 119 ++++++++++--------------------------------------- res/res_config_odbc.c | 4 ++ res/res_config_pgsql.c | 4 ++ res/res_crypto.c | 6 +++ res/res_musiconhold.c | 26 ++++++----- res/res_odbc.c | 5 ++- res/res_osp.c | 13 ++++-- res/res_snmp.c | 4 ++ 8 files changed, 72 insertions(+), 109 deletions(-) (limited to 'res') diff --git a/res/Makefile b/res/Makefile index 83a68d165..bd9c44618 100644 --- a/res/Makefile +++ b/res/Makefile @@ -11,25 +11,10 @@ # the GNU General Public License # -MODS:=$(patsubst %.c,%.so,$(wildcard res_*.c)) +MODS:=$(filter-out $(MENUSELECT_RES),$(patsubst %.c,%.so,$(wildcard res_*.c))) -ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/odbcinst.h $(CROSS_COMPILE_TARGET)/usr/local/include/odbcinst.h),) - MODS:=$(filter-out res_odbc.so,$(MODS)) - MODS:=$(filter-out res_config_odbc.so,$(MODS)) -else - ifeq (${OSARCH},FreeBSD) - MODS:=$(filter-out $(shell if test ${BSDVERSION} -lt 500000 ; then echo "res_config_odbc.so"; fi),$(MODS)) - endif -endif - -ifeq ($(NOCRYPTO),yes) - MODS:=$(filter-out res_crypto.so,$(MODS)) - MODS:=$(filter-out res_osp.so,$(MODS)) -endif - -OSPLIB:=$(wildcard $(CROSS_COMPILE_TARGET)/usr/lib/libosptk.a $(CROSS_COMPILE_TARGET)/usr/local/lib/libosptk.a) -ifeq (${OSPLIB},) - MODS:=$(filter-out res_osp.so,$(MODS)) +ifeq ($(OSARCH),FreeBSD) + MODS:=$(filter-out $(shell if test ${BSDVERSION} -lt 500000 ; then echo "res_config_odbc.so"; fi),$(MODS)) endif # NETsnmp has some difficulties on some platforms (conflict with unload_module) @@ -43,82 +28,17 @@ else endif endif -ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/postgresql $(CROSS_COMPILE_TARGET)/usr/local/pgsql/include $(CROSS_COMPILE_TARGET)/usr/include/pgsql $(CROSS_COMPILE_TARGET)/usr/local/include/pgsql $(CROSS_COMPILE_TARGET)/opt/pgsql/include $(CROSS_COMPILE_TARGET)/usr/include/libpq-fe.h),) - MODS:=$(filter-out res_config_pgsql.so,$(MODS)) -endif - ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/net-snmp/net-snmp-config.h),) MODS:=$(filter-out res_snmp.so,$(MODS)) else SNMP_LDLIBS+=$(shell net-snmp-config --agent-libs) endif -ifeq (${WITH_SMDI},) - MODS:=$(filter-out res_smdi.so,$(MODS)) -endif - -MLFLAGS= - -# Now, go find postgresql libraries -ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/postgresql),) - CFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/include/postgresql - MLFLAGS+=-L$(CROSS_COMPILE_TARGET)/usr/lib/postgresql -endif - -ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/local/pgsql/include),) - CFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/pgsql/include - MLFLAGS+=-L$(CROSS_COMPILE_TARGET)/usr/local/pgsql/lib -endif - -ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/pgsql),) - CFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/include/pgsql - MLFLAGS+=-L$(CROSS_COMPILE_TARGET)/usr/lib/pgsql -endif - -ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/pgsql),) - CFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include/pgsql - MLFLAGS+=-L$(CROSS_COMPILE_TARGET)/usr/local/lib/pgsql -endif - -ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/opt/pgsql/include),) - CFLAGS+=-I$(CROSS_COMPILE_TARGET)/opt/pgsql/include - MLFLAGS+=-L$(CROSS_COMPILE_TARGET)/opt/pgsql/lib -endif - -ifneq ($(wilcard $(CROSS_COMPILE_TARGET)/usr/include/postgresql),) - CFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/include/postgresql -endif - -ifneq ($(wilcard $(CROSS_COMPILE_TARGET)/usr/lib/libpq.so),) - MLFLAGS+=-L$(CROSS_COMPILE_TARGET)/usr/lib -endif - -ifeq (${OSARCH},CYGWIN) - CYGSOLINK=-Wl,--out-implib=lib$@.a -Wl,--export-all-symbols - CYGSOLIB=-L.. -L. -lasterisk.dll - CYG_RES_CONFIG_ODBC_LIB=-lres_odbc.so - CYG_RES_FEATURES_LIB=-lres_adsi.so -lres_monitor.so - MODS:=$(filter-out res_musiconhold.so,$(MODS)) -endif - -CRYPTO_LIBS=-lssl -lcrypto - -CFLAGS+= - -ifndef WITHOUT_ZAPTEL -ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/linux/zaptel.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/zaptel.h),) - CFLAGS+=-DZAPATA_MOH -endif -endif # WITHOUT_ZAPTEL # # Work around buggy RedHat 9.0 # -ifeq (${OSARCH},CYGWIN) CFLAGS+=-DOPENSSL_NO_KRB5 -else -CFLAGS+=-DOPENSSL_NO_KRB5 -fPIC -endif all: depend $(MODS) @@ -142,7 +62,10 @@ install: all uninstall: res_crypto.so: res_crypto.o - $(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} $(CRYPTO_LIBS) + $(CC) $(SOLINK) -o $@ $< $(SSL_LIB) + +res_crypto.o: res_crypto.c + $(CC) -c -o $@ $(CFLAGS) $(SSL_INCLUDE) $< clean-depend: rm -f .depend @@ -151,25 +74,31 @@ clean: clean-depend rm -f *.so *.o res_odbc.so: res_odbc.o - $(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} -lodbc + $(CC) $(SOLINK) -o $@ $< $(ODBC_LIB) -res_osp.so: res_osp.o $(OSPLIB) - $(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} $(OSPLIB) $(CRYPTO_LIBS) +res_odbc.o: res_odbc.c + $(CC) -c -o $@ $(CFLAGS) $(ODBC_INCLUDE) $< -%.so : %.o - $(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} +res_osp.so: res_osp.o + $(CC) $(SOLINK) -o $@ $< $(OSPTK_LIB) + +res_osp.o: res_osp.c + $(CC) -c -o $@ $(CFLAGS) $(OSPTK_INCLUDE) $< -res_features.so: res_features.o - $(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} ${CYG_RES_FEATURES_LIB} +%.so : %.o + $(CC) -o $@ $(SOLINK) $< -res_config_odbc.so: res_config_odbc.o - $(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} ${CYG_RES_CONFIG_ODBC_LIB} +res_config_odbc.o: res_config_odbc.c + $(CC) -c -o $@ $(CFLAGS) $(ODBC_INCLUDE) $< res_snmp.so: res_snmp.o snmp/agent.o - $(CC) $(SOLINK) ${SNMP_LDFLAGS} -o $@ ${CYGSOLINK} res_snmp.o snmp/agent.o ${CYGSOLIB} ${SNMP_LDLIBS} + $(CC) $(SOLINK) $(SNMP_LDFLAGS) -o $@ $< snmp/agent.o $(SNMP_LDLIBS) res_config_pgsql.so: res_config_pgsql.o - $(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} -lpq -lz $(MLFLAGS) + $(CC) $(SOLINK) -o $@ $< $(PGSQL_LIB) + +res_config_pgsql.o: res_config_pgsql.c + $(CC) -c -o $@ $(CFLAGS) $(PGSQL_INCLUDE) $< ifneq ($(wildcard .depend),) include .depend diff --git a/res/res_config_odbc.c b/res/res_config_odbc.c index e48b01c02..31a2d1513 100644 --- a/res/res_config_odbc.c +++ b/res/res_config_odbc.c @@ -28,6 +28,10 @@ * \arg http://www.unixodbc.org */ +/*** MODULEINFO + unixodbc + ***/ + #include #include #include diff --git a/res/res_config_pgsql.c b/res/res_config_pgsql.c index 61046c84b..ca23508c2 100644 --- a/res/res_config_pgsql.c +++ b/res/res_config_pgsql.c @@ -22,6 +22,10 @@ * \arg http://www.postgresql.org */ +/*** MODULEINFO + pgsql + ***/ + #include #include #include /* PostgreSQL */ diff --git a/res/res_crypto.c b/res/res_crypto.c index d7c74d79f..e4d7ade8b 100644 --- a/res/res_crypto.c +++ b/res/res_crypto.c @@ -23,6 +23,10 @@ * \author Mark Spencer */ +/*** MODULEINFO + ssl + ***/ + #include #include #include @@ -612,4 +616,6 @@ static const char *key(void) { return ASTERISK_GPL_KEY; } + STD_MOD(MOD_0 | NO_USECOUNT | NO_UNLOAD, reload, NULL, NULL); + diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c index 30a363574..061934335 100644 --- a/res/res_musiconhold.c +++ b/res/res_musiconhold.c @@ -1,7 +1,7 @@ /* * Asterisk -- An open source telephony toolkit. * - * Copyright (C) 1999 - 2005, Digium, Inc. + * Copyright (C) 1999 - 2006, Digium, Inc. * * Mark Spencer * @@ -25,6 +25,10 @@ * \author Mark Spencer */ +/*** MODULEINFO + win32 + ***/ + #include #include #include @@ -37,13 +41,6 @@ #include #include #include -#ifdef ZAPATA_MOH -#ifdef __linux__ -#include -#else -#include -#endif /* __linux__ */ -#endif #include #include @@ -51,6 +48,14 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") +#ifdef HAVE_ZAPTEL +#ifdef __linux__ +#include +#else +#include +#endif /* __linux__ */ +#endif + #include "asterisk/lock.h" #include "asterisk/file.h" #include "asterisk/logger.h" @@ -796,7 +801,7 @@ static int moh_scan_files(struct mohclass *class) { static int moh_register(struct mohclass *moh, int reload) { -#ifdef ZAPATA_MOH +#ifdef HAVE_ZAPTEL int x; #endif ast_mutex_lock(&moh_lock); @@ -834,7 +839,7 @@ static int moh_register(struct mohclass *moh, int reload) ast_set_flag(moh, MOH_QUIET); moh->srcfd = -1; -#ifdef ZAPATA_MOH +#ifdef HAVE_ZAPTEL /* Open /dev/zap/pseudo for timing... Is there a better, yet reliable way to do this? */ moh->pseudofd = open("/dev/zap/pseudo", O_RDONLY); @@ -1228,3 +1233,4 @@ static const char *key(void) } STD_MOD(MOD_0 | NO_USECOUNT | NO_UNLOAD, reload, NULL, NULL); + diff --git a/res/res_odbc.c b/res/res_odbc.c index 76fd217ac..56d110152 100644 --- a/res/res_odbc.c +++ b/res/res_odbc.c @@ -19,7 +19,6 @@ * at the top of the source tree. */ - /*! \file * * \brief ODBC resource manager @@ -30,6 +29,10 @@ * \arg See also: \ref cdr_odbc */ +/*** MODULEINFO + unixodbc + ***/ + #include #include #include diff --git a/res/res_osp.c b/res/res_osp.c index b8a6fd8ac..17b605fce 100644 --- a/res/res_osp.c +++ b/res/res_osp.c @@ -1,7 +1,7 @@ /* * Asterisk -- An open source telephony toolkit. * - * Copyright (C) 1999 - 2005, Digium, Inc. + * Copyright (C) 1999 - 2006, Digium, Inc. * * Mark Spencer * @@ -25,9 +25,14 @@ * \arg See also: \ref app_osplookup.c */ +/*** MODULEINFO + libosptk + ssl + ***/ + #include -#include -#include +#include +#include #include #include #include @@ -1106,3 +1111,5 @@ static const char *key(void) } STD_MOD(MOD_0, reload, NULL, NULL) + + diff --git a/res/res_snmp.c b/res/res_snmp.c index a399b8b8c..39e2cdb36 100644 --- a/res/res_snmp.c +++ b/res/res_snmp.c @@ -14,6 +14,10 @@ * \author Thorsten Lockert */ +/*** MODULEINFO + no + ***/ + #include "asterisk.h" ASTERISK_FILE_VERSION(__FILE__, "$Revision$") -- cgit v1.2.3