Index: Makefile
===================================================================
RCS file: /export/home/cvsroot/asterisk/Makefile,v
retrieving revision 1.59
diff -u -r1.59 Makefile
--- Makefile	26 Oct 2003 18:50:49 -0000	1.59
+++ Makefile	27 Oct 2003 18:20:24 -0000
@@ -151,6 +151,11 @@
 ifeq (${OSARCH},Linux)
 LIBS+=-lresolv  #-lnjamd
 endif
+ifeq (${OSARCH},Darwin)
+ifeq ($(shell uname -r),7.0.0)
+LIBS+=-lresolv
+endif
+endif
 OBJS=io.o sched.o logger.o frame.o loader.o config.o channel.o \
 	translate.o file.o say.o pbx.o cli.o md5.o term.o \
 	ulaw.o alaw.o callerid.o fskmodem.o image.o app.o \
Index: enum.c
===================================================================
RCS file: /export/home/cvsroot/asterisk/enum.c,v
retrieving revision 1.11
diff -u -r1.11 enum.c
--- enum.c	26 Oct 2003 18:50:49 -0000	1.11
+++ enum.c	27 Oct 2003 01:37:25 -0000
@@ -15,6 +15,9 @@
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/nameser.h>
+#if __APPLE_CC__ >= 1495
+#include <arpa/nameser_compat.h>
+#endif
 #include <resolv.h>
 #include <stdlib.h>
 #include <string.h>
Index: srv.c
===================================================================
RCS file: /export/home/cvsroot/asterisk/srv.c,v
retrieving revision 1.5
diff -u -r1.5 srv.c
--- srv.c	26 Oct 2003 18:50:49 -0000	1.5
+++ srv.c	27 Oct 2003 01:37:25 -0000
@@ -14,6 +14,9 @@
 #include <sys/types.h>
 #include <netinet/in.h>
 #include <arpa/nameser.h>
+#if __APPLE_CC__ >= 1495
+#include <arpa/nameser_compat.h>
+#endif
 #include <resolv.h>
 #include <stdio.h>
 #include <string.h>
Index: codecs/gsm/Makefile
===================================================================
RCS file: /export/home/cvsroot/asterisk/codecs/gsm/Makefile,v
retrieving revision 1.9
diff -u -r1.9 Makefile
--- codecs/gsm/Makefile	27 Sep 2003 02:45:37 -0000	1.9
+++ codecs/gsm/Makefile	27 Oct 2003 01:38:12 -0000
@@ -37,6 +37,10 @@
 ######### ppro's, etc, as well as the AMD K6 and K7.  The compile will
 ######### probably require gcc. 
 
+ifneq (${OSARCH},Darwin)
+OPTIMIZE+=-march=$(PROC)
+endif
+
 PG =
 #PG = -g -pg
 ######### Profiling flags.  If you don't know what that means, leave it blank.
@@ -54,7 +58,7 @@
 # CC		= /usr/lang/acc
 # CCFLAGS 	= -c -O
 
-CC		= gcc $(OPTIMIZE) -march=$(PROC) -fomit-frame-pointer 
+CC		= gcc $(OPTIMIZE) -fomit-frame-pointer 
 CCFLAGS 	+= -c -DNeedFunctionPrototypes=1 -funroll-loops -fPIC
 
 LD 		= $(CC)
@@ -189,7 +193,7 @@
 		$(SRC)/gsm_option.c	\
 		$(SRC)/short_term.c	\
 		$(SRC)/table.c
-ifneq (${OSARCH},OpenBSD)
+ifeq (${OSARCH},Linux)
 GSM_SOURCES+=	$(SRC)/k6opt.s
 endif
 
@@ -236,7 +240,7 @@
 		$(SRC)/gsm_option.o	\
 		$(SRC)/short_term.o	\
 		$(SRC)/table.o
-ifneq (${OSARCH},OpenBSD)
+ifeq (${OSARCH},Linux)
 GSM_OBJECTS+=	$(SRC)/k6opt.o
 endif
 
Index: db1-ast/db/db.c
===================================================================
RCS file: /export/home/cvsroot/asterisk/db1-ast/db/db.c,v
retrieving revision 1.2
diff -u -r1.2 db.c
--- db1-ast/db/db.c	26 Oct 2003 18:50:49 -0000	1.2
+++ db1-ast/db/db.c	27 Oct 2003 01:38:12 -0000
@@ -44,7 +44,9 @@
 
 #include <db.h>
 
+#ifndef __APPLE__
 #define dbopen __dbopen
+#endif
 
 DB *
 dbopen(fname, flags, mode, type, openinfo)
@@ -74,8 +76,8 @@
 	errno = EINVAL;
 	return (NULL);
 }
-#undef dbopen
 #ifndef __APPLE__
+#undef dbopen
 #define weak_alias(original, alias) \
         asm (".weak " #alias "\n" #alias " = " #original);
 weak_alias (__dbopen, dbopen)
Index: db1-ast/mpool/mpool.c
===================================================================
RCS file: /export/home/cvsroot/asterisk/db1-ast/mpool/mpool.c,v
retrieving revision 1.2
diff -u -r1.2 mpool.c
--- db1-ast/mpool/mpool.c	26 Oct 2003 18:50:49 -0000	1.2
+++ db1-ast/mpool/mpool.c	27 Oct 2003 01:38:12 -0000
@@ -50,6 +50,7 @@
 #define	__MPOOLINTERFACE_PRIVATE
 #include <mpool.h>
 
+#ifndef __APPLE__
 #define mpool_open __mpool_open
 #define mpool_filter __mpool_filter
 #define mpool_new __mpool_new
@@ -57,6 +58,7 @@
 #define mpool_put __mpool_put
 #define mpool_sync __mpool_sync
 #define mpool_close __mpool_close
+#endif
 
 static BKT *mpool_bkt __P((MPOOL *));
 static BKT *mpool_look __P((MPOOL *, pgno_t));
@@ -309,6 +311,7 @@
 	return (fsync(mp->fd) ? RET_ERROR : RET_SUCCESS);
 }
 
+#ifndef __APPLE__
 #undef mpool_open
 #undef mpool_filter
 #undef mpool_new
@@ -317,7 +320,6 @@
 #undef mpool_close
 #undef mpool_sync
 
-#ifndef __APPLE__
 #define weak_alias(original, alias) \
 	asm (".weak " #alias "\n" #alias " = " #original);
 weak_alias (__mpool_open, mpool_open)
Index: include/asterisk/frame.h
===================================================================
RCS file: /export/home/cvsroot/asterisk/include/asterisk/frame.h,v
retrieving revision 1.25
diff -u -r1.25 frame.h
--- include/asterisk/frame.h	26 Oct 2003 03:28:01 -0000	1.25
+++ include/asterisk/frame.h	27 Oct 2003 01:38:15 -0000
@@ -26,7 +26,7 @@
 #ifndef __BYTE_ORDER
 #ifdef __linux__
 #include <endian.h>
-#elif (defined(__OpenBSD__) || defined(__APPLE__))
+#elif defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__)
 #include <machine/endian.h>
 #define __BYTE_ORDER BYTE_ORDER
 #define __LITTLE_ENDIAN LITTLE_ENDIAN
@@ -36,11 +36,11 @@
 #define __BYTE_ORDER __LITTLE_ENDIAN
 #endif /* __LITTLE_ENDIAN */
 
-#if (defined(i386))
+#if defined(i386) || defined(__i386__)
 #define __BYTE_ORDER __LITTLE_ENDIAN
 #endif /* defined i386 */
 
-#if (defined(sun) && defined(unix) && defined(sparc))
+#if defined(sun) && defined(unix) && defined(sparc)
 #define __BYTE_ORDER __BIG_ENDIAN
 #endif /* sun unix sparc */
 
