[svn-commits] tilghman: trunk r814 - /trunk/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Aug 24 20:42:44 CDT 2010


Author: tilghman
Date: Tue Aug 24 20:42:41 2010
New Revision: 814

URL: http://svnview.digium.com/svn/menuselect?view=rev&rev=814
Log:
Translate keyword 'use' to 'depend', if the functionality in the compiler is not present to make 'use' work.

(issue #17707)
 Reported by: ira
 Patches: 
       20100819__issue17707__menuselect.diff.txt uploaded by tilghman (license 14)
 Tested by: tilghman

Modified:
    trunk/acinclude.m4
    trunk/aclocal.m4
    trunk/autoconfig.h.in
    trunk/configure   (contents, props changed)
    trunk/configure.ac
    trunk/menuselect.c

Modified: trunk/acinclude.m4
URL: http://svnview.digium.com/svn/menuselect/trunk/acinclude.m4?view=diff&rev=814&r1=813&r2=814
==============================================================================
--- trunk/acinclude.m4 (original)
+++ trunk/acinclude.m4 Tue Aug 24 20:42:41 2010
@@ -1,14 +1,36 @@
-# AST_GCC_ATTRIBUTE([attribute name])
+# Helper function to check for gcc attributes.
+# AST_GCC_ATTRIBUTE([attribute name], [attribute syntax], [attribute scope], [makeopts flag])
 
 AC_DEFUN([AST_GCC_ATTRIBUTE],
 [
 AC_MSG_CHECKING(checking for compiler 'attribute $1' support)
+saved_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
+m4_ifval([$4],$4=0)
+
+if test "x$2" = "x"
+then
 AC_COMPILE_IFELSE(
-	AC_LANG_PROGRAM([static int __attribute__(($1)) test(void) {}],
+	AC_LANG_PROGRAM([$3 void __attribute__(($1)) *test(void *muffin, ...) {return (void *) 0;}],
 			[]),
 	AC_MSG_RESULT(yes)
+	m4_ifval([$4],$4=1)
 	AC_DEFINE_UNQUOTED([HAVE_ATTRIBUTE_$1], 1, [Define to 1 if your GCC C compiler supports the '$1' attribute.]),
-	AC_MSG_RESULT(no))
+	AC_MSG_RESULT(no)
+)
+else
+AC_COMPILE_IFELSE(
+	AC_LANG_PROGRAM([$3 void __attribute__(($2)) *test(void *muffin, ...) {return (void *) 0;}],
+			[]),
+	AC_MSG_RESULT(yes)
+	m4_ifval([$4],$4=1)
+	AC_DEFINE_UNQUOTED([HAVE_ATTRIBUTE_$1], 1, [Define to 1 if your GCC C compiler supports the '$1' attribute.]),
+	AC_MSG_RESULT(no)
+)
+fi
+
+m4_ifval([$4],[AC_SUBST($4)])
+CFLAGS="$saved_CFLAGS"
 ])
 
 # AST_EXT_LIB_SETUP([package symbol name], [package friendly name], [package option name], [additional help text])

Modified: trunk/aclocal.m4
URL: http://svnview.digium.com/svn/menuselect/trunk/aclocal.m4?view=diff&rev=814&r1=813&r2=814
==============================================================================
--- trunk/aclocal.m4 (original)
+++ trunk/aclocal.m4 Tue Aug 24 20:42:41 2010
@@ -1,7 +1,7 @@
-# generated automatically by aclocal 1.11 -*- Autoconf -*-
+# generated automatically by aclocal 1.10.1 -*- Autoconf -*-
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
+# 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.

Modified: trunk/autoconfig.h.in
URL: http://svnview.digium.com/svn/menuselect/trunk/autoconfig.h.in?view=diff&rev=814&r1=813&r2=814
==============================================================================
--- trunk/autoconfig.h.in (original)
+++ trunk/autoconfig.h.in Tue Aug 24 20:42:41 2010
@@ -25,6 +25,12 @@
 
 /* Define to 1 if you have the `asprintf' function. */
 #undef HAVE_ASPRINTF
+
+/* Define to 1 if your GCC C compiler supports the 'weak_import' attribute. */
+#undef HAVE_ATTRIBUTE_weak_import
+
+/* Define to 1 if your GCC C compiler supports the 'weakref' attribute. */
+#undef HAVE_ATTRIBUTE_weakref
 
 /* Define to indicate the ${CURSES_DESCRIP} library */
 #undef HAVE_CURSES
@@ -101,9 +107,6 @@
 /* Define to the one symbol short name of this package. */
 #undef PACKAGE_TARNAME
 
-/* Define to the home page for this package. */
-#undef PACKAGE_URL
-
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 

Propchange: trunk/configure
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: trunk/configure.ac
URL: http://svnview.digium.com/svn/menuselect/trunk/configure.ac?view=diff&rev=814&r1=813&r2=814
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Tue Aug 24 20:42:41 2010
@@ -51,6 +51,9 @@
     esac])
 AC_SUBST(MENUSELECT_DEBUG)
 
+AST_GCC_ATTRIBUTE(weak_import)
+AST_GCC_ATTRIBUTE(weakref)
+
 AC_FUNC_ALLOCA
 AC_CHECK_FUNCS([asprintf getloadavg setenv strcasestr strndup strnlen strsep unsetenv vasprintf])
 

Modified: trunk/menuselect.c
URL: http://svnview.digium.com/svn/menuselect/trunk/menuselect.c?view=diff&rev=814&r1=813&r2=814
==============================================================================
--- trunk/menuselect.c (original)
+++ trunk/menuselect.c Tue Aug 24 20:42:41 2010
@@ -31,6 +31,7 @@
 #include <stdarg.h>
 #include <getopt.h>
 
+#include "autoconfig.h"
 #include "mxml/mxml.h"
 #include "linkedlists.h"
 #include "menuselect.h"
@@ -344,6 +345,27 @@
 			     cur3 && cur3->child;
 			     cur3 = mxmlFindElement(cur3, cur2, "use", NULL, NULL, MXML_NO_DESCEND))
 			{
+#if !defined(HAVE_ATTRIBUTE_weak_import) && !defined(HAVE_ATTRIBUTE_weakref)
+				/* If the compiler won't support the functionality required for "use", then "use" -> "depend" */
+				if (!(dep = calloc(1, sizeof(*dep)))) {
+					free_member(mem);
+					return -1;
+				}
+				if ((tmp = mxmlElementGetAttr(cur3, "name"))) {
+					if (!strlen_zero(tmp)) {
+						dep->name = tmp;
+					}
+				}
+				if (!strlen_zero(cur3->child->value.opaque)) {
+					dep->displayname = cur3->child->value.opaque;
+					if (!dep->name) {
+						dep->name = dep->displayname;
+					}
+					AST_LIST_INSERT_TAIL(&mem->deps, dep, list);
+				} else {
+					free(dep);
+				}
+#else
 				if (!(use = calloc(1, sizeof(*use)))) {
 					free_member(mem);
 					return -1;
@@ -361,6 +383,7 @@
 					AST_LIST_INSERT_TAIL(&mem->uses, use, list);
 				} else
 					free(use);
+#endif
 			}
 
 			if (add_member(mem, cat))




More information about the svn-commits mailing list