[asterisk-commits] kpfleming: branch 1.6.1 r153711 - in /branches/1.6.1: ./ apps/ autoconf/ incl...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Nov 2 18:21:05 CST 2008


Author: kpfleming
Date: Sun Nov  2 18:21:04 2008
New Revision: 153711

URL: http://svn.digium.com/view/asterisk?view=rev&rev=153711
Log:
Merged revision 153709 from trunk

------------------------------------------------------------------------
r153709 | kpfleming | 2008-11-02 17:34:39 -0600 (Sun, 02 Nov 2008) | 3 lines

instead of trying to forcibly load res_agi when app_stack is loaded (even if the administrator didn't want it loaded), use GCC weak symbols to determine whether it was loaded already or not; if it was loaded, then use it.


------------------------------------------------------------------------


Modified:
    branches/1.6.1/apps/app_stack.c
    branches/1.6.1/autoconf/ast_gcc_attribute.m4
    branches/1.6.1/configure
    branches/1.6.1/configure.ac
    branches/1.6.1/include/asterisk/agi.h
    branches/1.6.1/include/asterisk/autoconfig.h.in
    branches/1.6.1/include/asterisk/compiler.h

Modified: branches/1.6.1/apps/app_stack.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/apps/app_stack.c?view=diff&rev=153711&r1=153710&r2=153711
==============================================================================
--- branches/1.6.1/apps/app_stack.c (original)
+++ branches/1.6.1/apps/app_stack.c Sun Nov  2 18:21:04 2008
@@ -26,7 +26,7 @@
  */
 
 /*** MODULEINFO
-	<depend>res_agi</depend>
+	<use>res_agi</use>
  ***/
 
 #include "asterisk.h"
@@ -38,9 +38,11 @@
 #include "asterisk/app.h"
 #include "asterisk/manager.h"
 #include "asterisk/channel.h"
+
+/* usage of AGI is optional, so indicate that to the header file */
+#define ASTERISK_AGI_OPTIONAL
 #include "asterisk/agi.h"
 
-static int agi_loaded = 0;
 
 static const char *app_gosub = "Gosub";
 static const char *app_gosubif = "GosubIf";
@@ -492,7 +494,7 @@
 {
 	struct ast_context *con;
 
-	if (agi_loaded) {
+	if (ast_agi_unregister) {
 		ast_agi_unregister(ast_module_info->self, &gosub_agi_command);
 
 		if ((con = ast_context_find("app_stack_gosub_virtual_context"))) {
@@ -514,15 +516,10 @@
 {
 	struct ast_context *con;
 
-	if (!ast_module_check("res_agi.so")) {
-		if (ast_load_resource("res_agi.so") == AST_MODULE_LOAD_SUCCESS) {
-			agi_loaded = 1;
-		}
-	} else {
-		agi_loaded = 1;
-	}
-
-	if (agi_loaded) {
+	/* usage of AGI is optional, so check to see if the ast_agi_register()
+	   function is available; if so, use it.
+	*/
+	if (ast_agi_register) {
 		con = ast_context_find_or_create(NULL, NULL, "app_stack_gosub_virtual_context", "app_stack");
 		if (!con) {
 			ast_log(LOG_ERROR, "Virtual context 'app_stack_gosub_virtual_context' does not exist and unable to create\n");

Modified: branches/1.6.1/autoconf/ast_gcc_attribute.m4
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/autoconf/ast_gcc_attribute.m4?view=diff&rev=153711&r1=153710&r2=153711
==============================================================================
--- branches/1.6.1/autoconf/ast_gcc_attribute.m4 (original)
+++ branches/1.6.1/autoconf/ast_gcc_attribute.m4 Sun Nov  2 18:21:04 2008
@@ -7,7 +7,7 @@
 saved_CFLAGS="$CFLAGS"
 CFLAGS="$CFLAGS -Werror"
 AC_COMPILE_IFELSE(
-	AC_LANG_PROGRAM([static void __attribute__(($1)) *test(void *muffin, ...) {}],
+	AC_LANG_PROGRAM([void __attribute__(($1)) *test(void *muffin, ...) {}],
 			[]),
 	AC_MSG_RESULT(yes)
 	AC_DEFINE_UNQUOTED([HAVE_ATTRIBUTE_$1], 1, [Define to 1 if your GCC C compiler supports the '$1' attribute.]),

Modified: branches/1.6.1/configure.ac
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/configure.ac?view=diff&rev=153711&r1=153710&r2=153711
==============================================================================
--- branches/1.6.1/configure.ac (original)
+++ branches/1.6.1/configure.ac Sun Nov  2 18:21:04 2008
@@ -455,6 +455,7 @@
 AST_GCC_ATTRIBUTE(deprecated)
 AST_GCC_ATTRIBUTE(sentinel)
 AST_GCC_ATTRIBUTE(warn_unused_result)
+AST_GCC_ATTRIBUTE(weak)
 
 AC_MSG_CHECKING(for -ffunction-sections support)
 saved_CFLAGS="${CFLAGS}"

Modified: branches/1.6.1/include/asterisk/agi.h
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/include/asterisk/agi.h?view=diff&rev=153711&r1=153710&r2=153711
==============================================================================
--- branches/1.6.1/include/asterisk/agi.h (original)
+++ branches/1.6.1/include/asterisk/agi.h Sun Nov  2 18:21:04 2008
@@ -55,11 +55,17 @@
 	AST_LIST_ENTRY(agi_command) list;
 } agi_command;
 
-int ast_agi_fdprintf(struct ast_channel *chan, int fd, char *fmt, ...);
-int ast_agi_register(struct ast_module *mod, agi_command *cmd);
-int ast_agi_unregister(struct ast_module *mod, agi_command *cmd);
-void ast_agi_register_multiple(struct ast_module *mod, agi_command *cmd, int len);
-void ast_agi_unregister_multiple(struct ast_module *mod, agi_command *cmd, int len);
+#if defined(ASTERISK_AGI_OPTIONAL)
+#define AGI_WEAK attribute_weak
+#else
+#define AGI_WEAK
+#endif
+
+int AGI_WEAK ast_agi_fdprintf(struct ast_channel *chan, int fd, char *fmt, ...);
+int AGI_WEAK ast_agi_register(struct ast_module *mod, agi_command *cmd);
+int AGI_WEAK ast_agi_unregister(struct ast_module *mod, agi_command *cmd);
+void AGI_WEAK ast_agi_register_multiple(struct ast_module *mod, agi_command *cmd, int len);
+void AGI_WEAK ast_agi_unregister_multiple(struct ast_module *mod, agi_command *cmd, int len);
 
 #if defined(__cplusplus) || defined(c_plusplus)
 }

Modified: branches/1.6.1/include/asterisk/autoconfig.h.in
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/include/asterisk/autoconfig.h.in?view=diff&rev=153711&r1=153710&r2=153711
==============================================================================
--- branches/1.6.1/include/asterisk/autoconfig.h.in (original)
+++ branches/1.6.1/include/asterisk/autoconfig.h.in Sun Nov  2 18:21:04 2008
@@ -116,6 +116,9 @@
 /* Define to 1 if your GCC C compiler supports the 'warn_unused_result'
    attribute. */
 #undef HAVE_ATTRIBUTE_warn_unused_result
+
+/* Define to 1 if your GCC C compiler supports the 'weak' attribute. */
+#undef HAVE_ATTRIBUTE_weak
 
 /* Define this to indicate the ${BKTR_DESCRIP} library */
 #undef HAVE_BKTR

Modified: branches/1.6.1/include/asterisk/compiler.h
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/include/asterisk/compiler.h?view=diff&rev=153711&r1=153710&r2=153711
==============================================================================
--- branches/1.6.1/include/asterisk/compiler.h (original)
+++ branches/1.6.1/include/asterisk/compiler.h Sun Nov  2 18:21:04 2008
@@ -68,4 +68,10 @@
 /* Some older version of GNU gcc (3.3.5 on OpenBSD 4.3 for example) dont like 'NULL' as sentinel */
 #define SENTINEL ((char *)NULL)
 
+#ifdef HAVE_ATTRIBUTE_weak
+#define attribute_weak __attribute__((weak))
+#else
+#define attribute_weak
+#endif
+
 #endif /* _ASTERISK_COMPILER_H */




More information about the asterisk-commits mailing list