From 287fce05d0eaa6ab8131a04eb6e84bf2d02b30d3 Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Fri, 16 Jun 2006 16:17:43 +0000 Subject: [PATCH] add support for setting the CFLAGS for voicemail storage options in menuselect Thanks to kpfleming for the Makefile magic :) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@34492 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- apps/Makefile | 11 ++----- apps/app_voicemail.c | 31 ++++++++++++++----- build_tools/get_makeopts | 3 ++ .../{get_moduledeps => get_moduleinfo} | 0 build_tools/prep_moduledeps | 10 +++++- 5 files changed, 38 insertions(+), 17 deletions(-) create mode 100644 build_tools/get_makeopts rename build_tools/{get_moduledeps => get_moduleinfo} (100%) diff --git a/apps/Makefile b/apps/Makefile index 4d6f0bb55f..740f69993a 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -15,17 +15,10 @@ include ../menuselect.makeopts SELECTED_MODS:=$(filter-out $(MENUSELECT_APPS),$(patsubst %.c,%,$(wildcard app_*.c))) -# If you have UnixODBC you can use ODBC voicemail -# storage -# -# Uncomment to use ODBC storage -#CFLAGS+=-DUSE_ODBC_STORAGE -# Uncomment for extended ODBC voicemail storage -#CFLAGS+=-DEXTENDED_ODBC_STORAGE -# See doc/README.odbcstorage for more information - MODS:=$(patsubst %,%.so,$(SELECTED_MODS)) +app_voicemail.o: CFLAGS+=$(patsubst %,-D%,$(MENUSELECT_app_voicemail)) + all: $(MODS) clean-depend: diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 4ef68cc55b..8ab00658f3 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -41,6 +41,23 @@ * Bartosz Supczinski */ +/*** MAKEOPTS + + + cc-client + no + + + unixodbc + no + + + unixodbc + no + + + ***/ + #include "asterisk.h" ASTERISK_FILE_VERSION(__FILE__, "$Revision$") @@ -77,7 +94,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/stringfields.h" #include "asterisk/smdi.h" #define SMDI_MWI_WAIT_TIMEOUT 1000 /* 1 second */ -#ifdef USE_ODBC_STORAGE +#ifdef ODBC_STORAGE #include "asterisk/res_odbc.h" #endif @@ -289,7 +306,7 @@ static int vm_play_folder_name(struct ast_channel *chan, char *mbox); static void apply_options(struct ast_vm_user *vmu, const char *options); -#ifdef USE_ODBC_STORAGE +#ifdef ODBC_STORAGE static char odbc_database[80]; static char odbc_table[80]; #define RETRIEVE(a,b) retrieve_file(a,b) @@ -838,7 +855,7 @@ static int vm_lock_path(const char *path) } -#ifdef USE_ODBC_STORAGE +#ifdef ODBC_STORAGE static int retrieve_file(char *dir, int msgnum) { int x = 0; @@ -1290,7 +1307,7 @@ static int store_file(char *dir, char *mailboxuser, char *mailboxcontext, int ms } fdlen = lseek(fd, 0, SEEK_END); lseek(fd, 0, SEEK_SET); - printf("Length is %d\n", fdlen); + printf("Length is %zd\n", fdlen); fdm = mmap(NULL, fdlen, PROT_READ | PROT_WRITE, MAP_SHARED,fd, 0); if (!fdm) { ast_log(LOG_WARNING, "Memory map failed!\n"); @@ -2015,7 +2032,7 @@ static const char *mbox(int id) return (id >= 0 && id < (sizeof(msgs)/sizeof(msgs[0]))) ? msgs[id] : "Unknown"; } -#ifdef USE_ODBC_STORAGE +#ifdef ODBC_STORAGE static int inboxcount(const char *mailbox, int *newmsgs, int *oldmsgs) { int x = -1; @@ -6183,7 +6200,7 @@ static int load_config(void) astsearch = "no"; ast_set2_flag((&globalflags), ast_true(astsearch), VM_SEARCH); -#ifdef USE_ODBC_STORAGE +#ifdef ODBC_STORAGE strcpy(odbc_database, "asterisk"); if ((thresholdstr = ast_variable_retrieve(cfg, "general", "odbcstorage"))) { ast_copy_string(odbc_database, thresholdstr, sizeof(odbc_database)); @@ -6614,7 +6631,7 @@ static int load_module(void *mod) ast_install_vm_functions(has_voicemail, inboxcount, messagecount); -#if defined(USE_ODBC_STORAGE) && !defined(EXTENDED_ODBC_STORAGE) +#if defined(ODBC_STORAGE) && !defined(EXTENDED_ODBC_STORAGE) ast_log(LOG_WARNING, "The current ODBC storage table format will be changed soon." "Please update your tables as per the README and edit the apps/Makefile " "and uncomment the line containing EXTENDED_ODBC_STORAGE to enable the " diff --git a/build_tools/get_makeopts b/build_tools/get_makeopts new file mode 100644 index 0000000000..15ad97b750 --- /dev/null +++ b/build_tools/get_makeopts @@ -0,0 +1,3 @@ +/\/\*\*\* MAKEOPTS/ {printit=1; next} +/\*\*\*\// {exit} +// {if (printit) print} diff --git a/build_tools/get_moduledeps b/build_tools/get_moduleinfo similarity index 100% rename from build_tools/get_moduledeps rename to build_tools/get_moduleinfo diff --git a/build_tools/prep_moduledeps b/build_tools/prep_moduledeps index 457bcb99a5..1a131cb432 100755 --- a/build_tools/prep_moduledeps +++ b/build_tools/prep_moduledeps @@ -39,15 +39,21 @@ process_dir() { get_description ${file} desc=${TDESC} echo -e "\t\t" - awk -f build_tools/get_moduledeps ${file} + awk -f build_tools/get_moduleinfo ${file} echo -e "\t\t" done echo -e "\t" + + for file in ${dir}/${prefix}*.c + do + awk -f build_tools/get_makeopts ${file} >> .makeoptstmp + done } echo "" echo echo "" +rm -f .makeoptstmp process_dir apps app APPS Applications process_dir cdr cdr CDR "Call Detail Recording" process_dir channels chan CHANNELS "Channel Drivers" @@ -58,4 +64,6 @@ process_dir pbx pbx PBX "PBX Modules" process_dir res res RES "Resource Modules" cat build_tools/cflags.xml cat sounds/sounds.xml +cat .makeoptstmp +rm -f .makeoptstmp echo ""