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.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@336733 65c4cc65-6c06-0410-ace0-fbb531ad65f3
certified/1.8.11
Tilghman Lesher 14 years ago
parent 32c717b97c
commit 02795f190e

@ -278,7 +278,7 @@ MOD_SUBDIRS_MENUSELECT_TREE:=$(MOD_SUBDIRS:%=%-menuselect-tree)
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

@ -37,8 +37,8 @@ endif
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

@ -53,8 +53,8 @@ ifeq (,$(findstring $(shell uname -s),Darwin SunOS))
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

41131
configure vendored

File diff suppressed because it is too large Load Diff

@ -867,6 +867,7 @@ AST_GCC_ATTRIBUTE(deprecated)
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)

@ -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. */
@ -1053,6 +1056,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

@ -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,13 +117,19 @@
* - 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
#if defined(AST_API_MODULE)
@ -140,17 +146,16 @@
#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
/* End of Darwin (Mac OS/X) implementation */

@ -53,7 +53,7 @@ endif
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

Loading…
Cancel
Save