[asterisk-commits] kpfleming: branch 1.6.0 r153745 - in /branches/1.6.0: ./ apps/ autoconf/ incl...

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


Author: kpfleming
Date: Sun Nov  2 18:52:05 2008
New Revision: 153745

URL: http://svn.digium.com/view/asterisk?view=rev&rev=153745
Log:
Merge 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.0/apps/app_stack.c
    branches/1.6.0/autoconf/ast_gcc_attribute.m4
    branches/1.6.0/configure
    branches/1.6.0/configure.ac
    branches/1.6.0/include/asterisk/agi.h
    branches/1.6.0/include/asterisk/autoconfig.h.in
    branches/1.6.0/include/asterisk/compiler.h

Modified: branches/1.6.0/apps/app_stack.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/apps/app_stack.c?view=diff&rev=153745&r1=153744&r2=153745
==============================================================================
--- branches/1.6.0/apps/app_stack.c (original)
+++ branches/1.6.0/apps/app_stack.c Sun Nov  2 18:52:05 2008
@@ -25,6 +25,10 @@
  * \ingroup applications
  */
 
+/*** MODULEINFO
+	<use>res_agi</use>
+ ***/
+
 #include "asterisk.h"
  
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
@@ -34,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";
@@ -485,7 +491,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"))) {
@@ -507,15 +513,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.0/autoconf/ast_gcc_attribute.m4
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/autoconf/ast_gcc_attribute.m4?view=diff&rev=153745&r1=153744&r2=153745
==============================================================================
--- branches/1.6.0/autoconf/ast_gcc_attribute.m4 (original)
+++ branches/1.6.0/autoconf/ast_gcc_attribute.m4 Sun Nov  2 18:52:05 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.0/configure.ac
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/configure.ac?view=diff&rev=153745&r1=153744&r2=153745
==============================================================================
--- branches/1.6.0/configure.ac (original)
+++ branches/1.6.0/configure.ac Sun Nov  2 18:52:05 2008
@@ -451,6 +451,7 @@
 AST_GCC_ATTRIBUTE(unused)
 AST_GCC_ATTRIBUTE(always_inline)
 AST_GCC_ATTRIBUTE(deprecated)
+AST_GCC_ATTRIBUTE(weak)
 
 AC_MSG_CHECKING(for -ffunction-sections support)
 saved_CFLAGS="${CFLAGS}"

Modified: branches/1.6.0/include/asterisk/agi.h
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/include/asterisk/agi.h?view=diff&rev=153745&r1=153744&r2=153745
==============================================================================
--- branches/1.6.0/include/asterisk/agi.h (original)
+++ branches/1.6.0/include/asterisk/agi.h Sun Nov  2 18:52:05 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.0/include/asterisk/autoconfig.h.in
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/include/asterisk/autoconfig.h.in?view=diff&rev=153745&r1=153744&r2=153745
==============================================================================
--- branches/1.6.0/include/asterisk/autoconfig.h.in (original)
+++ branches/1.6.0/include/asterisk/autoconfig.h.in Sun Nov  2 18:52:05 2008
@@ -109,6 +109,9 @@
 
 /* Define to 1 if your GCC C compiler supports the 'unused' attribute. */
 #undef HAVE_ATTRIBUTE_unused
+
+/* 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.0/include/asterisk/compiler.h
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/include/asterisk/compiler.h?view=diff&rev=153745&r1=153744&r2=153745
==============================================================================
--- branches/1.6.0/include/asterisk/compiler.h (original)
+++ branches/1.6.0/include/asterisk/compiler.h Sun Nov  2 18:52:05 2008
@@ -53,4 +53,10 @@
 #define attribute_malloc
 #endif
 
+#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