? asterisk/asterisk.tar
Index: asterisk/Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/Makefile,v
retrieving revision 1.33
diff -u -r1.33 Makefile
--- asterisk/Makefile	27 Sep 2003 15:52:17 -0000	1.33
+++ asterisk/Makefile	11 Oct 2003 03:07:09 -0000
@@ -1,5 +1,5 @@
 #
-# Asterisk -- A telephony toolkit for Linux.
+# Asterisk -- A telephony toolkit for Linux, FreeBSD, & OpenBSD.
 # 
 # Top level Makefile
 #
@@ -21,6 +21,7 @@
 ifeq (${OSARCH},Linux)
 PROC=$(shell uname -m)
 endif
+
 # Pentium Pro Optimize
 #PROC=i686
 
@@ -62,9 +63,18 @@
 #
 MALLOC_DEBUG = #-include $(PWD)/include/asterisk/astmm.h
 
+
 # Where to install asterisk after compiling
 # Default -> leave empty
 INSTALL_PREFIX=
+INSTALL_VAR_PREFIX=$(INSTALL_PREFIX)
+
+ifeq (${OSARCH},Linux)
+INSTALL_NEW_PREFIX=$(INSTALL_PREFIX)/usr
+else
+INSTALL_NEW_PREFIX=$(INSTALL_PREFIX)/usr/local
+endif
+
 
 # Original busydetect routine
 BUSYDETECT = #-DBUSYDETECT
@@ -78,31 +88,41 @@
 # Don't use together with -DBUSYDETECT_TONEONLY
 BUSYDETECT+= #-DBUSYDETECT_COMPARE_TONE_AND_SILENCE
 
-ASTLIBDIR=$(INSTALL_PREFIX)/usr/lib/asterisk
-ASTVARLIBDIR=$(INSTALL_PREFIX)/var/lib/asterisk
+ASTLIBDIR=$(INSTALL_NEW_PREFIX)/lib/asterisk
+ASTVARLIBDIR=$(INSTALL_VAR_PREFIX)/var/lib/asterisk
+ifeq (${OSARCH},Linux)
 ASTETCDIR=$(INSTALL_PREFIX)/etc/asterisk
-ASTSPOOLDIR=$(INSTALL_PREFIX)/var/spool/asterisk
-ASTLOGDIR=$(INSTALL_PREFIX)/var/log/asterisk
-ASTHEADERDIR=$(INSTALL_PREFIX)/usr/include/asterisk
+else
+ASTETCDIR=$(INSTALL_NEW_PREFIX)/etc/asterisk
+endif
+ASTSPOOLDIR=$(INSTALL_VAR_PREFIX)/var/spool/asterisk
+ASTLOGDIR=$(INSTALL_VAR_PREFIX)/var/log/asterisk
+ASTHEADERDIR=$(INSTALL_NEW_PREFIX)/include/asterisk
 ASTCONFPATH=$(ASTETCDIR)/asterisk.conf
-ASTBINDIR=$(INSTALL_PREFIX)/usr/bin
-ASTSBINDIR=$(INSTALL_PREFIX)/usr/sbin
-ASTVARRUNDIR=$(INSTALL_PREFIX)/var/run
-
+ASTBINDIR=$(INSTALL_NEW_PREFIX)/bin
+ASTSBINDIR=$(INSTALL_NEW_PREFIX)/sbin
+ASTVARRUNDIR=$(INSTALL_VAR_PREFIX)/var/run
 
 MODULES_DIR=$(ASTLIBDIR)/modules
 AGI_DIR=$(ASTVARLIBDIR)/agi-bin
 
+ifeq (${OSARCH},Linux)
 INCLUDE=-Iinclude -I../include
+else
+INCLUDE=-Iinclude -I../include -I/usr/include -I/usr/local/include -I/usr/local/include/glib-2.0 -I/usr/local/include/atk-1.0
+INCLUDE+=-I/usr/X11R6/include -I/usr/X11R6/include/gtk-2.0 -I/usr/X11R6/include/pango-1.0
+endif
 CFLAGS=-pipe  -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG) $(INCLUDE) -D_REENTRANT -D_GNU_SOURCE #-DMAKE_VALGRIND_HAPPY
 CFLAGS+=$(OPTIMIZE)
 CFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
 CFLAGS+=$(shell if uname -m | grep -q ppc; then echo "-fsigned-char"; fi)
-ifeq (${OSARCH},OpenBSD)
+ifeq (${OSARCH},OpenBSD,FreeBSD)
 CFLAGS+=-pthread
 endif
-
+ifeq (${OSARCH},Linux)
 CFLAGS+=$(shell if [ -f /usr/include/linux/zaptel.h ]; then echo "-DZAPTEL_OPTIMIZATIONS"; fi)
+endif
+
 
 LIBEDIT=editline/libedit.a
 
@@ -110,7 +130,7 @@
 HTTPDIR=$(shell if [ -d /var/www ]; then echo "/var/www"; else echo "/home/httpd"; fi)
 RPMVERSION=$(shell if [ -f .version ]; then sed 's/[-\/:]/_/g' .version; else echo "unknown" ; fi)
 CFLAGS+=-DASTERISK_VERSION=\"$(ASTERISKVERSION)\"
-CFLAGS+=-DINSTALL_PREFIX=\"$(INSTALL_PREFIX)\"
+CFLAGS+=-DINSTALL_PREFIX=\"$(INSTALL_NEW_PREFIX)\"
 CFLAGS+=-DASTETCDIR=\"$(ASTETCDIR)\"
 CFLAGS+=-DASTLIBDIR=\"$(ASTLIBDIR)\"
 CFLAGS+=-DASTVARLIBDIR=\"$(ASTVARLIBDIR)\"
@@ -131,7 +151,11 @@
 ifeq (${OSARCH},Linux)
 LIBS=-ldl
 endif
+ifeq (${OSARCH},Linux)
 LIBS+=-lpthread -lncurses -lm -lresolv  #-lnjamd
+else
+LIBS+=-pthread -lncurses -lm #-lresolv  #-lnjamd
+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 \
@@ -222,7 +246,7 @@
 	mkdir -p $(ASTVARLIBDIR)/sounds/digits
 	for x in sounds/digits/*.gsm; do \
 		if grep -q "^%`basename $$x`%" sounds.txt; then \
-			install $$x $(ASTVARLIBDIR)/sounds/digits ; \
+                        install $$x $(ASTVARLIBDIR)/sounds/digits ; \
 		else \
 			echo "No description for $$x"; \
 			exit 1; \
@@ -382,8 +406,8 @@
 __rpm: _version
 	rm -rf /tmp/asterisk ; \
 	mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
-	$(MAKE) INSTALL_PREFIX=/tmp/asterisk install ; \
-	$(MAKE) INSTALL_PREFIX=/tmp/asterisk samples ; \
+	$(MAKE/tmp/asterisk install ; \
+	$(MAKE/tmp/asterisk samples ; \
 	mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
 	cp -f redhat/asterisk /tmp/asterisk/etc/rc.d/init.d/ ; \
 	cp -f redhat/rpmrc /tmp/asterisk/ ; \
Index: asterisk/astmm.c
===================================================================
RCS file: /usr/cvsroot/asterisk/astmm.c,v
retrieving revision 1.6
diff -u -r1.6 astmm.c
--- asterisk/astmm.c	21 Aug 2003 01:06:52 -0000	1.6
+++ asterisk/astmm.c	11 Oct 2003 03:07:09 -0000
@@ -15,7 +15,7 @@
 
 #ifdef __AST_DEBUG_MALLOC
 
-#include <malloc.h>
+#include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <pthread.h>
Index: asterisk/apps/Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/Makefile,v
retrieving revision 1.21
diff -u -r1.21 Makefile
--- asterisk/apps/Makefile	4 Oct 2003 22:08:02 -0000	1.21
+++ asterisk/apps/Makefile	11 Oct 2003 03:07:10 -0000
@@ -15,7 +15,7 @@
 USE_POSTGRES_VM_INTERFACE=0
 
 #APPS=app_dial.so app_playback.so app_directory.so app_intercom.so app_mp3.so 
-APPS=app_dial.so app_playback.so app_voicemail.so app_directory.so app_intercom.so app_mp3.so \
+APPS=app_dial.so app_playback.so app_voicemail.so app_directory.so app_mp3.so \
      app_system.so app_echo.so app_record.so app_image.so app_url.so app_disa.so \
      app_agi.so app_qcall.so app_adsiprog.so app_getcpeid.so app_milliwatt.so \
      app_zapateller.so app_datetime.so app_setcallerid.so app_festival.so \
@@ -26,12 +26,16 @@
      app_enumlookup.so app_voicemail2.so app_transfer.so app_setcidnum.so app_cdr.so \
      app_hasnewvoicemail.so app_sayunixtime.so
 
+ifneq ($(OSARCH),FreeBSD)
+APPS+=app_intercom.so
+endif
 #APPS+=app_sql_postgres.so
 #APPS+=app_sql_odbc.so
-
+ifeq (${OSARCH},Linux)
 APPS+=$(shell if [ -f /usr/include/linux/zaptel.h ]; then echo "app_zapras.so app_meetme.so app_flash.so app_zapbarge.so" ; fi)
-#APPS+=$(shell if [ -f /usr/include/zap.h ]; then echo "app_rpt.so" ; fi)
-
+else
+APPS+=$(shell if [ -f /usr/include/zap.h ]; then echo "app_rpt.so" ; fi)
+endif
 CFLAGS+=-fPIC
 
 ifeq ($(USE_POSTGRES_VM_INTERFACE),1)
@@ -73,7 +77,7 @@
 	$(CC) -pipe -I/usr/local/pgsql/include $(CFLAGS) -c -o app_sql_postgres.o app_sql_postgres.c
 
 app_sql_postgres.so: app_sql_postgres.o
-	$(CC) -shared -Xlinker -x -o $@ $< -L/usr/local/pgsql/lib -lpq
+	$(CC) -shared -Xlinker -x -o $@ $< -L/usr/local/lib/postgresql -lpq
 
 app_sql_odbc.so: app_sql_odbc.o
 	$(CC) -shared -Xlinker -x -o $@ $< -lodbc
Index: asterisk/apps/app_intercom.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_intercom.c,v
retrieving revision 1.3
diff -u -r1.3 app_intercom.c
--- asterisk/apps/app_intercom.c	13 Aug 2003 15:25:16 -0000	1.3
+++ asterisk/apps/app_intercom.c	11 Oct 2003 03:07:10 -0000
@@ -29,7 +29,7 @@
 #ifdef __linux__
 #include <linux/soundcard.h>
 #else
-#include <soundcard.h>
+#include <sys/soundcard.h>
 #endif
 #include <netinet/in.h>
 
Index: asterisk/channels/Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/Makefile,v
retrieving revision 1.10
diff -u -r1.10 Makefile
--- asterisk/channels/Makefile	11 Sep 2003 19:45:43 -0000	1.10
+++ asterisk/channels/Makefile	11 Oct 2003 03:07:10 -0000
@@ -14,11 +14,10 @@
 OSARCH=$(shell uname -s)
 
 CHANNEL_LIBS=chan_modem.so chan_iax.so chan_sip.so \
-	     chan_modem_aopen.so chan_oss.so \
+	     chan_modem_aopen.so \
              chan_modem_bestdata.so chan_modem_i4l.so \
              chan_agent.so chan_mgcp.so chan_iax2.so \
 	     chan_local.so chan_skinny.so
-
 #
 # If you really want VoFR you can have it :-P
 #
@@ -27,6 +26,9 @@
 CHANNEL_LIBS+=$(shell [ -f /usr/include/linux/ixjuser.h ] && echo chan_phone.so)
 CHANNEL_LIBS+=$(shell [ -f h323/libchanh323.a ] && echo chan_h323.so)
 
+ifneq ($(OSARCH),FreeBSD)
+CHANNEL_LIBS+=chan_oss.so
+endif
 CFLAGS+=-Wno-missing-prototypes -Wno-missing-declarations
 CFLAGS+=$(shell [ ! -f /usr/include/linux/if_wanpipe.h ] && echo " -DOLD_SANGOMA_API")
 CHANNEL_LIBS+=$(shell [ -f /usr/include/alsa/asoundlib.h ] && echo "chan_alsa.so")
@@ -93,9 +95,9 @@
 
 chan_iax2.so: chan_iax2.o iax2-parser.o
 ifeq (${OSARCH},Linux)
-	$(CC) -shared -Xlinker -x -o $@ chan_iax2.o iax2-parser.o
-else
 	$(CC) -shared -Xlinker -x -o $@ chan_iax2.o iax2-parser.o -lossaudio
+else
+	$(CC) -shared -Xlinker -x -o $@ chan_iax2.o iax2-parser.o
 endif
 
 chan_zap.o: $(CHANZAP)
Index: asterisk/channels/chan_oss.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_oss.c,v
retrieving revision 1.6
diff -u -r1.6 chan_oss.c
--- asterisk/channels/chan_oss.c	13 Aug 2003 15:25:16 -0000	1.6
+++ asterisk/channels/chan_oss.c	11 Oct 2003 03:07:11 -0000
@@ -36,7 +36,7 @@
 #ifdef __linux
 #include <linux/soundcard.h>
 #else
-#include <soundcard.h>
+#include <sys/soundcard.h>
 #endif
 #include "busy.h"
 #include "ringtone.h"
Index: asterisk/codecs/Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/codecs/Makefile,v
retrieving revision 1.5
diff -u -r1.5 Makefile
--- asterisk/codecs/Makefile	6 May 2003 00:00:20 -0000	1.5
+++ asterisk/codecs/Makefile	11 Oct 2003 03:07:11 -0000
@@ -19,7 +19,9 @@
 #MODG723=codec_g723_1.so codec_g723_1b.so
 MODG723=$(shell [ -f g723.1/coder.c ] && echo "codec_g723_1.so")
 MODG723+=$(shell [ -f g723.1b/coder2.c ] && echo "codec_g723_1b.so")
+ifeq (${OSARCH},FreeBSD)
 MODSPEEX=$(shell [ -f /usr/include/speex.h ] || [ -f /usr/local/include/speex.h ] && echo "codec_speex.so")
+endif
 MODILBC=$(shell [ -f ilbc/iLBC_decode.h ] && echo "codec_ilbc.so")
 CFLAGS+=-fPIC
 
@@ -30,7 +32,11 @@
 LIBGSMT=$(shell if uname -m | grep -q 86; then echo gsm/lib/libgsm.a; fi)
 LIBMP3=mp3/libmp3.a
 LIBLPC10=lpc10/liblpc10.a
+ifeq (${OSARCH},Linux)
 LIBSPEEX=-lspeex -lm
+else
+LIBSPEEX=-lm
+endif
 LIBILBC=ilbc/libilbc.a
 
 CODECS+=$(MODG723) $(MODSPEEX) $(MODILBC) codec_gsm.so codec_mp3_d.so codec_lpc10.so  \
Index: asterisk/codecs/gsm/Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/codecs/gsm/Makefile,v
retrieving revision 1.5
diff -u -r1.5 Makefile
--- asterisk/codecs/gsm/Makefile	27 Sep 2003 02:45:37 -0000	1.5
+++ asterisk/codecs/gsm/Makefile	11 Oct 2003 03:07:12 -0000
@@ -53,8 +53,16 @@
 
 # CC		= /usr/lang/acc
 # CCFLAGS 	= -c -O
-
+ifeq (${OSARCH},Linux)
 CC		= gcc $(OPTIMIZE) -march=$(PROC) -fomit-frame-pointer 
+else
+CC             = gcc -ansi -pedantic $(OPTIMIZE) -fschedule-insns2  -fomit-frame-pointer
+endif
+
+ifneq ($(OSARCH),FreeBSD)
+CC             += -march=$(PROC)
+endif
+
 CCFLAGS 	+= -c -DNeedFunctionPrototypes=1 -funroll-loops -fPIC
 
 LD 		= $(CC)
Index: asterisk/codecs/gsm/src/gsm_create.c
===================================================================
RCS file: /usr/cvsroot/asterisk/codecs/gsm/src/gsm_create.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 gsm_create.c
--- asterisk/codecs/gsm/src/gsm_create.c	12 Feb 2003 13:59:14 -0000	1.1.1.1
+++ asterisk/codecs/gsm/src/gsm_create.c	11 Oct 2003 03:07:12 -0000
@@ -15,14 +15,10 @@
 	extern char	* memset P((char *, int, int));
 #endif
 
-#ifdef	HAS_STDLIB_H
+#ifdef HAS_STDLIB_H
 #	include	<stdlib.h>
 #else
-#	ifdef	HAS_MALLOC_H
-#		include 	<malloc.h>
-#	else
-		extern char * malloc();
-#	endif
+               extern char * malloc();
 #endif
 
 #include <stdio.h>
Index: asterisk/codecs/gsm/src/gsm_destroy.c
===================================================================
RCS file: /usr/cvsroot/asterisk/codecs/gsm/src/gsm_destroy.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 gsm_destroy.c
--- asterisk/codecs/gsm/src/gsm_destroy.c	12 Feb 2003 13:59:14 -0000	1.1.1.1
+++ asterisk/codecs/gsm/src/gsm_destroy.c	11 Oct 2003 03:07:12 -0000
@@ -11,13 +11,9 @@
 #include "proto.h"
 
 #ifdef	HAS_STDLIB_H
-#	include	<stdlib.h>
+#include <stdlib.h>
 #else
-#	ifdef	HAS_MALLOC_H
-#		include 	<malloc.h>
-#	else
-		extern void free();
-#	endif
+      extern void free();
 #endif
 
 void gsm_destroy P1((S), gsm S)
Index: asterisk/codecs/lpc10/Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/codecs/lpc10/Makefile,v
retrieving revision 1.3
diff -u -r1.3 Makefile
--- asterisk/codecs/lpc10/Makefile	27 Apr 2003 18:13:11 -0000	1.3
+++ asterisk/codecs/lpc10/Makefile	11 Oct 2003 03:07:12 -0000
@@ -27,7 +27,9 @@
 
 #fix for PPC processors
 ifneq ($(PROC),ppc)
-	CFLAGS+= -march=$(PROC)
+	ifneq ($(OSARCH),FreeBSD)
+		CFLAGS+= -march=$(PROC)
+	endif
 endif
 
 LIB = $(LIB_TARGET_DIR)/liblpc10.a
Index: asterisk/codecs/lpc10/lpcini.c
===================================================================
RCS file: /usr/cvsroot/asterisk/codecs/lpc10/lpcini.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 lpcini.c
--- asterisk/codecs/lpc10/lpcini.c	12 Feb 2003 13:59:15 -0000	1.1.1.1
+++ asterisk/codecs/lpc10/lpcini.c	11 Oct 2003 03:07:13 -0000
@@ -31,7 +31,7 @@
 
 #include "f2c.h"
 
-#include <malloc.h>
+#include <stdlib.h>
 
 /* Common Block Declarations */
 
Index: asterisk/codecs/mp3/Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/codecs/mp3/Makefile,v
retrieving revision 1.3
diff -u -r1.3 Makefile
--- asterisk/codecs/mp3/Makefile	27 Sep 2003 02:45:37 -0000	1.3
+++ asterisk/codecs/mp3/Makefile	11 Oct 2003 03:07:13 -0000
@@ -1,7 +1,10 @@
 #
 # LMC section
-
+ifeq (${OSARCH},Linux)
 CFLAGS+= -I../include -Iinclude -O3 -march=$(PROC) -funroll-loops -Wall -Wno-missing-prototypes -Wno-missing-declarations -g -fPIC
+else
+CFLAGS+= -I../include -Iinclude -O3 -funroll-loops -Wall -Wno-missing-prototypes -Wno-missing-declarations -g -fPIC
+endif
 RANLIB=ranlib
 
 # the XING decoder objs and dependencies:
Index: asterisk/codecs/mp3/include/L3.h
===================================================================
RCS file: /usr/cvsroot/asterisk/codecs/mp3/include/L3.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 L3.h
--- asterisk/codecs/mp3/include/L3.h	12 Feb 2003 13:59:14 -0000	1.1.1.1
+++ asterisk/codecs/mp3/include/L3.h	11 Oct 2003 03:07:13 -0000
@@ -33,6 +33,10 @@
 
 ******************************************************************/
 
+#ifdef __FreeBSD__
+#include <machine/endian.h>
+#endif
+
 #define GLOBAL_GAIN_SCALE (4*15)
 /* #define GLOBAL_GAIN_SCALE 0 */
 
Index: asterisk/db1-ast/mpool/mpool.c
===================================================================
RCS file: /usr/cvsroot/asterisk/db1-ast/mpool/mpool.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 mpool.c
--- asterisk/db1-ast/mpool/mpool.c	12 Feb 2003 13:59:15 -0000	1.1.1.1
+++ asterisk/db1-ast/mpool/mpool.c	11 Oct 2003 03:07:13 -0000
@@ -38,7 +38,6 @@
 #include <sys/param.h>
 #include <sys/queue.h>
 #include <sys/stat.h>
-
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
Index: asterisk/editline/sys.h
===================================================================
RCS file: /usr/cvsroot/asterisk/editline/sys.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 sys.h
--- asterisk/editline/sys.h	12 Feb 2003 13:59:15 -0000	1.1.1.1
+++ asterisk/editline/sys.h	11 Oct 2003 03:07:13 -0000
@@ -90,7 +90,7 @@
 #ifdef SUNOS
 # undef REGEX
 # undef REGEXP
-# include <malloc.h>
+# include <stdlib.h>
 typedef void (*sig_t)(int);
 # ifdef __GNUC__
 /*
