[asterisk-commits] tilghman: branch 1.8 r336733 - in /branches/1.8: ./ codecs/gsm/ include/aster...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Sep 19 15:27:05 CDT 2011


Author: tilghman
Date: Mon Sep 19 15:27:03 2011
New Revision: 336733

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=336733
Log:
Various changes to allow 1.8 to compile on Mac OS X Lion (10.7)

* Makefile workaround for 10.6 extended to work on 10.7 and later.
* Now uses the 'weak' symbol for Lion systems, which no longer support
  'weak_import'

Closes ASTERISK-17612.
Closes ASTERISK-18213.

Tested by: tilghman, oej.

Modified:
    branches/1.8/Makefile
    branches/1.8/Makefile.rules
    branches/1.8/codecs/gsm/Makefile
    branches/1.8/configure
    branches/1.8/configure.ac
    branches/1.8/include/asterisk/autoconfig.h.in
    branches/1.8/include/asterisk/optional_api.h
    branches/1.8/main/Makefile

Modified: branches/1.8/Makefile
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/Makefile?view=diff&rev=336733&r1=336732&r2=336733
==============================================================================
--- branches/1.8/Makefile (original)
+++ branches/1.8/Makefile Mon Sep 19 15:27:03 2011
@@ -278,7 +278,7 @@
 ifneq ($(findstring darwin,$(OSARCH)),)
   _ASTCFLAGS+=-D__Darwin__
   SOLINK=-bundle -Xlinker -macosx_version_min -Xlinker 10.4 -Xlinker -undefined -Xlinker dynamic_lookup -force_flat_namespace
-  ifeq ($(shell /usr/bin/sw_vers -productVersion | cut -c1-4),10.6)
+  ifeq ($(shell if test `/usr/bin/sw_vers -productVersion | cut -c4` -gt 5; then echo 6; else echo 0; fi),6)
     SOLINK+=/usr/lib/bundle1.o
   endif
   _ASTLDFLAGS+=-L/usr/local/lib

Modified: branches/1.8/Makefile.rules
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/Makefile.rules?view=diff&rev=336733&r1=336732&r2=336733
==============================================================================
--- branches/1.8/Makefile.rules (original)
+++ branches/1.8/Makefile.rules Mon Sep 19 15:27:03 2011
@@ -37,8 +37,8 @@
 
 OPTIMIZE?=-O6
 ifneq ($(findstring darwin,$(OSARCH)),)
-  ifeq ($(shell /usr/bin/sw_vers -productVersion | cut -c1-4),10.6)
-    # Snow Leopard has an issue with this optimization flag on large files (like chan_sip)
+  ifeq ($(shell if test `/usr/bin/sw_vers -productVersion | cut -c4` -gt 5; then echo 6; else echo 0; fi),6)
+    # Snow Leopard/Lion has an issue with this optimization flag on large files (like chan_sip)
     OPTIMIZE+=-fno-inline-functions
   endif
 endif

Modified: branches/1.8/codecs/gsm/Makefile
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/codecs/gsm/Makefile?view=diff&rev=336733&r1=336732&r2=336733
==============================================================================
--- branches/1.8/codecs/gsm/Makefile (original)
+++ branches/1.8/codecs/gsm/Makefile Mon Sep 19 15:27:03 2011
@@ -53,8 +53,8 @@
   endif
 else
   ifneq (,$(findstring $(OSARCH),Darwin))
-    ifeq ($(shell /usr/bin/sw_vers -productVersion | cut -c1-4),10.6)
-      # Snow Leopard reports i386, even though it's really x86_64
+    ifeq ($(shell if test `/usr/bin/sw_vers -productVersion | cut -c4` -gt 5; then echo 6; else echo 0; fi),6)
+      # Snow Leopard/Lion reports i386, even though it's really x86_64
       OPTIMIZE+=-mtune=native
     endif
   endif

Modified: branches/1.8/configure.ac
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/configure.ac?view=diff&rev=336733&r1=336732&r2=336733
==============================================================================
--- branches/1.8/configure.ac (original)
+++ branches/1.8/configure.ac Mon Sep 19 15:27:03 2011
@@ -867,6 +867,7 @@
 AST_GCC_ATTRIBUTE(sentinel)
 AST_GCC_ATTRIBUTE(warn_unused_result)
 AST_GCC_ATTRIBUTE(weak_import, [], [], PBX_WEAKREF)
+AST_GCC_ATTRIBUTE(weak, [], [], PBX_WEAKREF)
 AST_GCC_ATTRIBUTE(weakref, [weakref("foo")], static, PBX_WEAKREF)
 
 AC_MSG_CHECKING(for -ffunction-sections support)

Modified: branches/1.8/include/asterisk/autoconfig.h.in
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/include/asterisk/autoconfig.h.in?view=diff&rev=336733&r1=336732&r2=336733
==============================================================================
--- branches/1.8/include/asterisk/autoconfig.h.in (original)
+++ branches/1.8/include/asterisk/autoconfig.h.in Mon Sep 19 15:27:03 2011
@@ -101,6 +101,9 @@
    attribute. */
 #undef HAVE_ATTRIBUTE_warn_unused_result
 
+/* Define to 1 if your GCC C compiler supports the 'weak' attribute. */
+#undef HAVE_ATTRIBUTE_weak
+
 /* Define to 1 if your GCC C compiler supports the 'weak_import' attribute. */
 #undef HAVE_ATTRIBUTE_weak_import
 
@@ -769,16 +772,16 @@
 /* Define to 1 if you have the `strtoq' function. */
 #undef HAVE_STRTOQ
 
-/* Define to 1 if `ifr_ifru.ifru_hwaddr' is member of `struct ifreq'. */
+/* Define to 1 if `ifr_ifru.ifru_hwaddr' is a member of `struct ifreq'. */
 #undef HAVE_STRUCT_IFREQ_IFR_IFRU_IFRU_HWADDR
 
-/* Define to 1 if `st_blksize' is member of `struct stat'. */
+/* Define to 1 if `st_blksize' is a member of `struct stat'. */
 #undef HAVE_STRUCT_STAT_ST_BLKSIZE
 
-/* Define to 1 if `cr_uid' is member of `struct ucred'. */
+/* Define to 1 if `cr_uid' is a member of `struct ucred'. */
 #undef HAVE_STRUCT_UCRED_CR_UID
 
-/* Define to 1 if `uid' is member of `struct ucred'. */
+/* Define to 1 if `uid' is a member of `struct ucred'. */
 #undef HAVE_STRUCT_UCRED_UID
 
 /* Define to 1 if you have the mISDN Supplemental Services library. */
@@ -1052,6 +1055,9 @@
 
 /* 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

Modified: branches/1.8/include/asterisk/optional_api.h
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/include/asterisk/optional_api.h?view=diff&rev=336733&r1=336732&r2=336733
==============================================================================
--- branches/1.8/include/asterisk/optional_api.h (original)
+++ branches/1.8/include/asterisk/optional_api.h Mon Sep 19 15:27:03 2011
@@ -103,11 +103,11 @@
 #define AST_OPTIONAL_API_UNAVAILABLE	INT_MIN
 
 
-#if defined(HAVE_ATTRIBUTE_weak_import)
+#if defined(HAVE_ATTRIBUTE_weak_import) || defined(HAVE_ATTRIBUTE_weak)
 
 /*
- * This is the Darwin (Mac OS/X) implementation, that only provides the
- * 'weak_import' compiler attribute for weak symbols. On this platform,
+ * This is the Darwin (Mac OS/X) implementation, that only provides the 'weak'
+ * or 'weak_import' compiler attribute for weak symbols. On this platform,
  *
  * - The module providing the API will only provide a '__' prefixed version
  *   of the API function to other modules (this will be hidden from the other
@@ -117,12 +117,18 @@
  * - In the API module itself, access to the API function without using a
  *   prefixed name is provided by a static pointer variable that holds the
  *   function address.
- * - 'Consumer' modules of the API will use a combination of a weak_import
- *   symbol, a local stub function, a pointer variable and a constructor function
- *   (which initializes that pointer variable as the module is being loaded)
- *   to provide safe, optional access to the API function without any special
- *   code being required.
- */
+ * - 'Consumer' modules of the API will use a combination of a weak_import or
+ *   weak symbol, a local stub function, a pointer variable and a constructor
+ *   function (which initializes that pointer variable as the module is being
+ *   loaded) to provide safe, optional access to the API function without any
+ *   special code being required.
+ */
+
+#if defined(HAVE_ATTRIBUTE_weak_import)
+#define	__default_attribute	weak_import /* pre-Lion */
+#else
+#define	__default_attribute	weak        /* Lion-onwards */
+#endif
 
 #define AST_OPTIONAL_API_NAME(name) __##name
 
@@ -140,16 +146,15 @@
 
 #define AST_OPTIONAL_API(result, name, proto, stub) \
 	static result __stub__##name proto stub; \
-	__attribute__((weak_import)) typeof(__stub__##name) AST_OPTIONAL_API_NAME(name); \
+	__attribute__((__default_attribute)) typeof(__stub__##name) AST_OPTIONAL_API_NAME(name); \
 	static attribute_unused typeof(__stub__##name) * name; \
 	static void __attribute__((constructor)) __init__##name(void) { name = AST_OPTIONAL_API_NAME(name) ? : __stub__##name; }
 
 #define AST_OPTIONAL_API_ATTR(result, attr, name, proto, stub) \
 	static __attribute__((attr)) result __stub__##name proto stub; \
-	__attribute__((attr, weak_import)) typeof(__stub__##name) AST_OPTIONAL_API_NAME(name); \
+	__attribute__((attr, __default_attribute)) typeof(__stub__##name) AST_OPTIONAL_API_NAME(name); \
 	static attribute_unused __attribute__((attr)) typeof(__stub__##name) * name; \
 	static void __attribute__((constructor)) __init__##name(void) { name = AST_OPTIONAL_API_NAME(name) ? : __stub__##name; }
-
 
 #endif
 

Modified: branches/1.8/main/Makefile
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/Makefile?view=diff&rev=336733&r1=336732&r2=336733
==============================================================================
--- branches/1.8/main/Makefile (original)
+++ branches/1.8/main/Makefile Mon Sep 19 15:27:03 2011
@@ -53,7 +53,7 @@
 ifneq ($(findstring darwin,$(OSARCH)),)
   AST_LIBS+=-lresolv
   ASTLINK=-Xlinker -macosx_version_min -Xlinker 10.4 -Xlinker -undefined -Xlinker dynamic_lookup -force_flat_namespace
-  ifeq ($(shell /usr/bin/sw_vers -productVersion | cut -c1-4),10.6)
+  ifeq ($(shell if test `/usr/bin/sw_vers -productVersion | cut -c4` -gt 5; then echo 6; else echo 0; fi),6)
     ASTLINK+=/usr/lib/bundle1.o
   endif
 else




More information about the asterisk-commits mailing list