diff --git a/Makefile b/Makefile index 881d1fa1d3328b25906621bfa38f4f665dcdc55c..65df33e805a47e1e909f244e7b0ca2ff05071417 100755 --- a/Makefile +++ b/Makefile @@ -151,6 +151,11 @@ LIBS+=-lncurses -lm 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 \ diff --git a/codecs/Makefile b/codecs/Makefile index a86709da816cbda2e9f7238a9e9305c98b545f0d..f7a69fd1aa1d05fe3b771cbfccb0fbc5fdf56b0f 100755 --- a/codecs/Makefile +++ b/codecs/Makefile @@ -27,8 +27,7 @@ CFLAGS+=$(shell [ -f /usr/local/include/speex.h ] && echo "-I/usr/local/include" LIBG723=g723.1/libg723.a LIBG723B=g723.1b/libg723b.a LIBGSM=gsm/lib/libgsm.a -LIBGSM=$(shell if uname -m | grep -q 86; then echo gsm/lib/libgsm.a; else echo "-lgsm" ; fi) -LIBGSMT=$(shell if uname -m | grep -q 86; then echo gsm/lib/libgsm.a; fi) +LIBGSMT=gsm/lib/libgsm.a LIBMP3=mp3/libmp3.a LIBLPC10=lpc10/liblpc10.a LIBSPEEX=$(shell [ -f /usr/local/lib/libspeex.a ] && echo "-L/usr/local/lib") diff --git a/codecs/gsm/Makefile b/codecs/gsm/Makefile index 5e2ccd180288ca45c7b9407b811836a3c6f0f2e0..490f3938c394f5a65718c0132fc402795e3ce516 100755 --- a/codecs/gsm/Makefile +++ b/codecs/gsm/Makefile @@ -37,6 +37,10 @@ WAV49 = -DWAV49 ######### 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 @@ PG = # 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 @@ GSM_SOURCES = $(SRC)/add.c \ $(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 @@ GSM_OBJECTS = $(SRC)/add.o \ $(SRC)/gsm_option.o \ $(SRC)/short_term.o \ $(SRC)/table.o -ifneq (${OSARCH},OpenBSD) +ifeq (${OSARCH},Linux) GSM_OBJECTS+= $(SRC)/k6opt.o endif diff --git a/codecs/gsm/src/code.c b/codecs/gsm/src/code.c index 4d195dfbd09174ce59c53e0540ae2c7fef0e09c9..6358330e5621412b5aa28f22bf7a3e1bbc6aeeb2 100755 --- a/codecs/gsm/src/code.c +++ b/codecs/gsm/src/code.c @@ -62,6 +62,10 @@ void Gsm_Coder P8((S,s,LARc,Nc,bc,Mc,xmaxc,xMc), word so[160]; +#if !(defined(__GNUC__) && defined(__i386__)) + longword ltmp; +#endif + Gsm_Preprocess (S, s, so); Gsm_LPC_Analysis (S, so, LARc); Gsm_Short_Term_Analysis_Filter (S, LARc, so); diff --git a/codecs/lpc10/Makefile b/codecs/lpc10/Makefile index 5e04d5f7365a90a32435f28d10b12b93e7870c7a..42ff106381fcbef443f434cd9bd4d467f7cafaab 100755 --- a/codecs/lpc10/Makefile +++ b/codecs/lpc10/Makefile @@ -37,42 +37,17 @@ LIB = $(LIB_TARGET_DIR)/liblpc10.a .PHONY: all clean all: $(LIB) - ranlib $(LIB) -$(LIB): $(LIB)(f2clib.o) \ - $(LIB)(analys.o) \ - $(LIB)(bsynz.o) \ - $(LIB)(chanwr.o) \ - $(LIB)(dcbias.o) \ - $(LIB)(decode.o) \ - $(LIB)(deemp.o) \ - $(LIB)(difmag.o) \ - $(LIB)(dyptrk.o) \ - $(LIB)(encode.o) \ - $(LIB)(energy.o) \ - $(LIB)(ham84.o) \ - $(LIB)(hp100.o) \ - $(LIB)(invert.o) \ - $(LIB)(irc2pc.o) \ - $(LIB)(ivfilt.o) \ - $(LIB)(lpcdec.o) \ - $(LIB)(lpcenc.o) \ - $(LIB)(lpcini.o) \ - $(LIB)(lpfilt.o) \ - $(LIB)(median.o) \ - $(LIB)(mload.o) \ - $(LIB)(onset.o) \ - $(LIB)(pitsyn.o) \ - $(LIB)(placea.o) \ - $(LIB)(placev.o) \ - $(LIB)(preemp.o) \ - $(LIB)(prepro.o) \ - $(LIB)(random.o) \ - $(LIB)(rcchk.o) \ - $(LIB)(synths.o) \ - $(LIB)(tbdm.o) \ - $(LIB)(voicin.o) \ - $(LIB)(vparms.o) +OBJ= f2clib.o analys.o bsynz.o chanwr.o dcbias.o decode.o \ + deemp.o difmag.o dyptrk.o encode.o energy.o ham84.o \ + hp100.o invert.o irc2pc.o ivfilt.o lpcdec.o lpcenc.o \ + lpcini.o lpfilt.o median.o mload.o onset.o pitsyn.o \ + placea.o placev.o preemp.o prepro.o random.o rcchk.o \ + synths.o tbdm.o voicin.o vparms.o + +$(LIB): $(OBJ) + $(AR) cr $@ $(OBJ) + ranlib $@ clean: -rm -f *.o $(LIB) diff --git a/db1-ast/db/db.c b/db1-ast/db/db.c index ab739ed7898a07f8d43ce2a6251ea74de1e6836f..5a74061e0b40b0ec799dbb744538d585af534a3d 100755 --- a/db1-ast/db/db.c +++ b/db1-ast/db/db.c @@ -44,7 +44,9 @@ static char sccsid[] = "@(#)db.c 8.4 (Berkeley) 2/21/94"; #include <db.h> +#ifndef __APPLE__ #define dbopen __dbopen +#endif DB * dbopen(fname, flags, mode, type, openinfo) @@ -74,8 +76,8 @@ dbopen(fname, flags, mode, type, openinfo) 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) diff --git a/db1-ast/mpool/mpool.c b/db1-ast/mpool/mpool.c index b09f801f57dd3435130c7d87f24f2882a9e7df0e..6773e4e2338fe9a0f64317dfd21862f607e24aed 100755 --- a/db1-ast/mpool/mpool.c +++ b/db1-ast/mpool/mpool.c @@ -50,6 +50,7 @@ static char sccsid[] = "@(#)mpool.c 8.5 (Berkeley) 7/26/94"; #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 @@ static char sccsid[] = "@(#)mpool.c 8.5 (Berkeley) 7/26/94"; #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 @@ mpool_sync(mp) return (fsync(mp->fd) ? RET_ERROR : RET_SUCCESS); } +#ifndef __APPLE__ #undef mpool_open #undef mpool_filter #undef mpool_new @@ -317,7 +320,6 @@ mpool_sync(mp) #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) diff --git a/enum.c b/enum.c index 2fac1bd472dc04a160cfd32fd6c1f79c77b0d4f2..143b22281b78c80321f526af613bcb5ef99b0829 100755 --- a/enum.c +++ b/enum.c @@ -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> diff --git a/include/asterisk/frame.h b/include/asterisk/frame.h index d477f052843aa56f322cd6781e2a1ac54ea02207..9c5ba203efd1579fbe6618929634aa48941b2cbe 100755 --- a/include/asterisk/frame.h +++ b/include/asterisk/frame.h @@ -26,7 +26,7 @@ extern "C" { #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 @@ extern "C" { #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 */ diff --git a/include/asterisk/localtime.h b/include/asterisk/localtime.h index 320c293d79c178a199eaf210a410e44a1f741af3..d7d6bbe22cb2718d031d4d007c8c7bc530b0f148 100755 --- a/include/asterisk/localtime.h +++ b/include/asterisk/localtime.h @@ -18,5 +18,7 @@ extern int ast_tzsetwall(void); extern void ast_tzset(const char *name); extern struct tm *ast_localtime(const time_t *timep, struct tm *p_tm, const char *zone); extern time_t ast_mktime(struct tm * const tmp, const char *zone); +extern char *ast_ctime(const time_t * const timep); +extern char *ast_ctime_r(const time_t * const timep, char *buf); #endif diff --git a/srv.c b/srv.c index 19f62851ffe51ab68d1955c6dfbfe027b8e2e721..c49abbf14c71f8f96b44ec6c60072c50fbb7fefd 100755 --- a/srv.c +++ b/srv.c @@ -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> @@ -36,22 +39,6 @@ struct srv { unsigned short portnum; } __attribute__ ((__packed__)); -static int parse_ie(unsigned char *data, int maxdatalen, unsigned char *src, int srclen) -{ - int len, olen; - len = olen = (int)src[0]; - src++; - srclen--; - if (len > srclen) { - ast_log(LOG_WARNING, "Want %d, got %d\n", len, srclen); - return -1; - } - if (len > maxdatalen) - len = maxdatalen; - memcpy(data, src, len); - return olen + 1; -} - static int parse_srv(unsigned char *host, int hostlen, int *portno, unsigned char *answer, int len, unsigned char *msg) { int res = 0; diff --git a/stdtime/localtime.c b/stdtime/localtime.c index 1ad9bf6c90987860c2d9de6acac697ee1b7fdeb9..f0b67e67ee4247fe763207835ecc22e0b75b2bcd 100755 --- a/stdtime/localtime.c +++ b/stdtime/localtime.c @@ -1187,8 +1187,8 @@ register struct tm * const tmp; #endif /* defined TM_GMTOFF */ } -static char * -ctime(timep) +char * +ast_ctime(timep) const time_t * const timep; { /* @@ -1200,8 +1200,8 @@ const time_t * const timep; return asctime(localtime(timep)); } -static char * -ctime_r(timep, buf) +char * +ast_ctime_r(timep, buf) const time_t * const timep; char *buf; {