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 \
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")
######### 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.
# 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)
$(SRC)/gsm_option.c \
$(SRC)/short_term.c \
$(SRC)/table.c
-ifneq (${OSARCH},OpenBSD)
+ifeq (${OSARCH},Linux)
GSM_SOURCES+= $(SRC)/k6opt.s
endif
$(SRC)/gsm_option.o \
$(SRC)/short_term.o \
$(SRC)/table.o
-ifneq (${OSARCH},OpenBSD)
+ifeq (${OSARCH},Linux)
GSM_OBJECTS+= $(SRC)/k6opt.o
endif
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);
.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)
#include <db.h>
+#ifndef __APPLE__
#define dbopen __dbopen
+#endif
DB *
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)
#define __MPOOLINTERFACE_PRIVATE
#include <mpool.h>
+#ifndef __APPLE__
#define mpool_open __mpool_open
#define mpool_filter __mpool_filter
#define mpool_new __mpool_new
#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));
return (fsync(mp->fd) ? RET_ERROR : RET_SUCCESS);
}
+#ifndef __APPLE__
#undef mpool_open
#undef mpool_filter
#undef mpool_new
#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)
#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>
#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
#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 */
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
#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>
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;
#endif /* defined TM_GMTOFF */
}
-static char *
-ctime(timep)
+char *
+ast_ctime(timep)
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;
{