[Asterisk-Dev] Asterisk on NetBSD & LP64/strict alignment/non-x86 issues

Rafal Boni rafal at pobox.com
Sun Jun 8 19:20:14 MST 2003


Folks:
	Attached is a patch necessary to build Asterisk on NetBSD on the
	sparc64 platform... I've not yet tested the functionality, but 
	at least now it starts up and gets running far enough so I have
	the command-line interface.

	There are still some issues I haven't tracked down -- the ILBC,
	MP3_D and LPC10 codecs all cause asterisk to crash on load, so
	for now I have 'noload' statements for them in modules.conf --
	these were of secondary importance to me, but I'll probably have
	a look at them sometime as well.

	Additionally, the MD5 which is part of Asterisk is not safe for
	architectures like NetBSD/sparc64 where the processor has strict
	alignment requirements and the OS does not emulate unaligned loads
	or stores... For now, I've worked around this by using the system
	MD5 library, but the MD5 implementation in the Asterisk code should
	probably be upgraded (I'd suggest NetBSD's code, since it already
	runs on a host of differing architectures).

	A few more comments:
		* The patches to chan_oss.c are due to a bug in NetBSD's
		  OSS emulation.  I'll try and get that addressed in the
		  NetBSD code, but the attached hacks should at least get
		  it building.
		* The enum.c hacks are just a rehash of what was posted
		  to the list already.
		* The missing ast_mutex_init() in chan_iax.c actually
		  make NetBSD's libpthread barf about an uninitialized
		  mutex!  How's that programmer support? :-)

Anyway, enjoy!
--rafal

Index: Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/Makefile,v
retrieving revision 1.14
diff -u -r1.14 Makefile
--- Makefile	13 May 2003 20:37:08 -0000	1.14
+++ Makefile	9 Jun 2003 02:14:04 -0000
@@ -24,6 +24,9 @@
 ifeq (${OSARCH},Linux)
 PROC=$(shell uname -m)
 endif
+ifeq (${OSARCH},NetBSD)
+PROC=$(shell uname -m)
+endif
 PWD=$(shell pwd)
 
 ######### More GSM codec optimization
@@ -79,6 +82,10 @@
 CFLAGS+=-pthread
 endif
 
+ifeq (${OSARCH},NetBSD)
+CFLAGS+=-pthread
+endif
+
 #CFLAGS+=$(shell if [ -f /usr/include/linux/zaptel.h ]; then echo "-DZAPTEL_OPTIMIZATIONS"; fi)
 
 LIBEDIT=editline/libedit.a
@@ -106,15 +113,27 @@
 ifeq (${OSARCH},Linux)
 LIBS=-ldl
 endif
-LIBS+=-lpthread -lncurses -lm -lresolv  #-lnjamd
+ifneq (${OSARCH},NetBSD)
+LIBS+=-lncurses
+else
+LIBS+=-lcurses -ltermcap
+endif
+
+LIBS+=-lpthread -lm -lresolv  #-lnjamd
 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 \
+	translate.o file.o say.o pbx.o cli.o term.o \
 	ulaw.o alaw.o callerid.o fskmodem.o image.o app.o \
 	cdr.o tdd.o acl.o rtp.o manager.o asterisk.o ast_expr.o \
 	dsp.o chanvars.o indications.o autoservice.o db.o privacy.o \
 	astmm.o enum.o
+ifneq (${OSARCH},NetBSD)
+OBJS+=md5.c
+endif
 CC=gcc
 INSTALL=install
+ifneq (${OSARCH},Linux)
+INSTALL=install -c
+endif
 
 _all: all
 	@echo " +--------- Asterisk Build Complete ---------+"  
@@ -188,7 +207,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; \
@@ -196,7 +215,7 @@
 	done
 	for x in sounds/vm-* sounds/transfer* sounds/pbx-* sounds/ss-* sounds/beep* sounds/dir-* sounds/conf-* sounds/agent-* sounds/invalid* sounds/tt-* sounds/auth-* sounds/privacy-*; do \
 		if grep -q "^%`basename $$x`%" sounds.txt; then \
-			install $$x $(ASTVARLIBDIR)/sounds ; \
+			$(INSTALL) $$x $(ASTVARLIBDIR)/sounds ; \
 		else \
 			echo "No description for $$x"; \
 			exit 1; \
@@ -205,7 +224,7 @@
 	mkdir -p $(ASTVARLIBDIR)/mohmp3
 	mkdir -p $(ASTVARLIBDIR)/images
 	for x in images/*.jpg; do \
-		install $$x $(ASTVARLIBDIR)/images ; \
+		$(INSTALL) $$x $(ASTVARLIBDIR)/images ; \
 	done
 	mkdir -p $(AGI_DIR)
 
@@ -226,12 +245,12 @@
 	mkdir -p $(ASTSBINDIR)
 	mkdir -p $(ASTVARRUNDIR)
 	mkdir -p $(ASTSPOOLDIR)/voicemail
-	install -m 755 asterisk $(ASTSBINDIR)/
-	install -m 755 astgenkey $(ASTSBINDIR)/
-	install -m 755 safe_asterisk $(ASTSBINDIR)/
+	$(INSTALL) -m 755 asterisk $(ASTSBINDIR)/
+	$(INSTALL) -m 755 astgenkey $(ASTSBINDIR)/
+	$(INSTALL) -m 755 safe_asterisk $(ASTSBINDIR)/
 	for x in $(SUBDIRS); do $(MAKE) -C $$x install || exit 1 ; done
 	install -d $(ASTHEADERDIR)
-	install include/asterisk/*.h $(ASTHEADERDIR)
+	$(INSTALL) include/asterisk/*.h $(ASTHEADERDIR)
 	rm -f $(ASTVARLIBDIR)/sounds/vm
 	rm -f $(ASTVARLIBDIR)/sounds/voicemail
 	if [ ! -h $(ASTSPOOLDIR)/vm ] && [ -d $(ASTSPOOLDIR)/vm ]; then \
@@ -246,7 +265,7 @@
 	mkdir -p $(ASTVARLIBDIR)/sounds
 	mkdir -p $(ASTLOGDIR)/cdr-csv
 	mkdir -p $(ASTVARLIBDIR)/keys
-	install -m 644 keys/iaxtel.pub $(ASTVARLIBDIR)/keys
+	$(INSTALL) -m 644 keys/iaxtel.pub $(ASTVARLIBDIR)/keys
 	( cd $(ASTVARLIBDIR)/sounds  ; ln -s $(ASTSPOOLDIR)/vm . )
 	( cd $(ASTVARLIBDIR)/sounds  ; ln -s $(ASTSPOOLDIR)/voicemail . )
 	@echo " +---- Asterisk Installation Complete -------+"  
@@ -279,7 +298,7 @@
 	mkdir -p $(ASTETCDIR)
 	for x in configs/*.adsi; do \
 		if ! [ -f $(ASTETCDIRX)/$$x ]; then \
-			install -m 644 $$x $(ASTETCDIR)/`basename $$x` ; \
+			$(INSTALL) -m 644 $$x $(ASTETCDIR)/`basename $$x` ; \
 		fi ; \
 	done
 
@@ -289,7 +308,7 @@
 		if [ -f $(ASTETCDIR)/`basename $$x .sample` ]; then \
 			mv -f $(ASTETCDIR)/`basename $$x .sample` $(ASTETCDIR)/`basename $$x .sample`.old ; \
 		fi ; \
-		install $$x $(ASTETCDIR)/`basename $$x .sample` ;\
+		$(INSTALL) $$x $(ASTETCDIR)/`basename $$x .sample` ;\
 	done
 	echo "[directories]" > $(ASTETCDIR)/asterisk.conf
 	echo "astetcdir => $(ASTETCDIR)" >> $(ASTETCDIR)/asterisk.conf
@@ -301,14 +320,14 @@
 	echo "astlogdir => $(ASTLOGDIR)" >> $(ASTETCDIR)/asterisk.conf
 	for x in sounds/demo-*; do \
 		if grep -q "^%`basename $$x`%" sounds.txt; then \
-			install $$x $(ASTVARLIBDIR)/sounds ; \
+			$(INSTALL) $$x $(ASTVARLIBDIR)/sounds ; \
 		else \
 			echo "No description for $$x"; \
 			exit 1; \
 		fi; \
 	done
 	for x in sounds/*.mp3; do \
-		install $$x $(ASTVARLIBDIR)/mohmp3 ; \
+		$(INSTALL) $$x $(ASTVARLIBDIR)/mohmp3 ; \
 	done
 	mkdir -p $(ASTSPOOLDIR)/voicemail/default/1234/INBOX
 	:> $(ASTVARLIBDIR)/sounds/voicemail/default/1234/unavail.gsm
@@ -324,10 +343,10 @@
 	@[ -d $(HTTPDIR) ] || ( echo "No HTTP directory" && exit 1 )
 	@[ -d $(HTTPDIR)/html ] || ( echo "No http directory" && exit 1 )
 	@[ -d $(HTTPDIR)/cgi-bin ] || ( echo "No cgi-bin directory" && exit 1 )
-	install -m 4755 -o root -g root vmail.cgi $(HTTPDIR)/cgi-bin/vmail.cgi
+	$(INSTALL) -m 4755 -o root -g root vmail.cgi $(HTTPDIR)/cgi-bin/vmail.cgi
 	mkdir -p $(HTTPDIR)/html/_asterisk
 	for x in images/*.gif; do \
-		install -m 644 $$x $(HTTPDIR)/html/_asterisk/; \
+		$(INSTALL) -m 644 $$x $(HTTPDIR)/html/_asterisk/; \
 	done
 	@echo " +--------- Asterisk Web Voicemail ----------+"  
 	@echo " +                                           +"
@@ -363,10 +382,10 @@
 
 config:
 	if [ -d /etc/rc.d/init.d ]; then \
-		install -m 755 init.asterisk /etc/rc.d/init.d/asterisk; \
+		$(INSTALL) -m 755 init.asterisk /etc/rc.d/init.d/asterisk; \
 		/sbin/chkconfig --add asterisk; \
 	elif [ -d /etc/init.d ]; then \
-		install -m 755 init.asterisk /etc/init.d/asterisk; \
+		$(INSTALL) -m 755 init.asterisk /etc/init.d/asterisk; \
 	fi 
 
 	
Index: enum.c
===================================================================
RCS file: /usr/cvsroot/asterisk/enum.c,v
retrieving revision 1.4
diff -u -r1.4 enum.c
--- enum.c	16 May 2003 23:33:41 -0000	1.4
+++ enum.c	9 Jun 2003 02:14:05 -0000
@@ -278,8 +278,12 @@
 	int ret = -1;
 	struct enum_search *s = NULL;
 	int version = -1;
+#ifdef __Linux__
 	struct __res_state enumstate;
 	res_ninit(&enumstate);	
+#else
+	res_init();	
+#endif
 	if (chan && ast_autoservice_start(chan) < 0)
 		return -1;
 	
@@ -307,7 +311,11 @@
 		ast_pthread_mutex_unlock(&enumlock);
 		if (!s)
 			break;
+#ifdef __Linux__
 		res = res_nsearch(&enumstate, tmp, C_IN, T_NAPTR, answer, sizeof(answer));
+#else
+		res = res_search(tmp, C_IN, T_NAPTR, answer, sizeof(answer));
+#endif
 		if (res > 0)
 			break;
 	}
@@ -325,7 +333,11 @@
 	}
 	if (chan)
 		ret |= ast_autoservice_stop(chan);
+#ifdef __Linux__
 	res_nclose(&enumstate);
+#else
+	res_close();
+#endif
 	return ret;
 }
 
Index: loader.c
===================================================================
RCS file: /usr/cvsroot/asterisk/loader.c,v
retrieving revision 1.5
diff -u -r1.5 loader.c
--- loader.c	16 May 2003 02:50:46 -0000	1.5
+++ loader.c	9 Jun 2003 02:14:05 -0000
@@ -26,7 +26,11 @@
 #include <asterisk/enum.h>
 #include <asterisk/rtp.h>
 #include <dlfcn.h>
+#if defined(__NetBSD__)
+#include <md5.h>
+#else
 #include <asterisk/md5.h>
+#endif
 #include <pthread.h>
 #include "asterisk.h"
 #include "astconf.h"
Index: manager.c
===================================================================
RCS file: /usr/cvsroot/asterisk/manager.c,v
retrieving revision 1.9
diff -u -r1.9 manager.c
--- manager.c	5 May 2003 06:14:25 -0000	1.9
+++ manager.c	9 Jun 2003 02:14:06 -0000
@@ -35,7 +35,11 @@
 #include <asterisk/cli.h>
 #include <asterisk/app.h>
 #include <asterisk/pbx.h>
+#if defined(__NetBSD__)
+#include <md5.h>
+#else
 #include <asterisk/md5.h>
+#endif
 #include <asterisk/acl.h>
 
 static int enabled = 0;
Index: md5.c
===================================================================
RCS file: /usr/cvsroot/asterisk/md5.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 md5.c
--- md5.c	12 Feb 2003 13:59:13 -0000	1.1.1.1
+++ md5.c	9 Jun 2003 02:14:06 -0000
@@ -22,7 +22,11 @@
  * will fill a supplied 16-byte array with the digest.
  */
 #include <string.h>		/* for memcpy() */
+#if defined(__NetBSD__)
+#include <md5.h>
+#else
 #include <asterisk/md5.h>
+#endif
 
 #ifndef HIGHFIRST
 #define byteReverse(buf, len)	/* Nothing */
Index: mkdep
===================================================================
RCS file: /usr/cvsroot/asterisk/mkdep,v
retrieving revision 1.2
diff -u -r1.2 mkdep
--- mkdep	6 May 2003 22:27:46 -0000	1.2
+++ mkdep	9 Jun 2003 02:14:06 -0000
@@ -1,4 +1,4 @@
-#!/bin/bash -
+#!/bin/sh -
 #
 #	$OpenBSD: mkdep.gcc.sh,v 1.8 1998/09/02 06:40:07 deraadt Exp $
 #	$NetBSD: mkdep.gcc.sh,v 1.9 1994/12/23 07:34:59 jtc Exp $
Index: apps/app_festival.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_festival.c,v
retrieving revision 1.2
diff -u -r1.2 app_festival.c
--- apps/app_festival.c	23 Apr 2003 19:09:13 -0000	1.2
+++ apps/app_festival.c	9 Jun 2003 02:14:06 -0000
@@ -17,7 +17,11 @@
 #include <asterisk/channel.h>
 #include <asterisk/pbx.h>
 #include <asterisk/module.h>
+#if defined(__NetBSD__)
+#include <md5.h>
+#else
 #include <asterisk/md5.h>
+#endif
 #include <asterisk/config.h>
 #include <stdlib.h>
 #include <unistd.h>
Index: astman/astman.c
===================================================================
RCS file: /usr/cvsroot/asterisk/astman/astman.c,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 astman.c
--- astman/astman.c	16 Mar 2003 06:00:10 -0000	1.1.1.3
+++ astman/astman.c	9 Jun 2003 02:14:07 -0000
@@ -20,7 +20,11 @@
 #include <unistd.h>
 #include <stdlib.h>
 
+#if defined(__NetBSD__)
+#include <md5.h>
+#else
 #include <asterisk/md5.h>
+#endif
 #include <asterisk/manager.h>
 
 #define MAX_HEADERS 80
Index: channels/chan_iax.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax.c,v
retrieving revision 1.9
diff -u -r1.9 chan_iax.c
--- channels/chan_iax.c	19 May 2003 00:48:48 -0000	1.9
+++ channels/chan_iax.c	9 Jun 2003 02:14:11 -0000
@@ -24,7 +24,11 @@
 #include <asterisk/options.h>
 #include <asterisk/cli.h>
 #include <asterisk/translate.h>
+#if defined(__NetBSD__)
+#include <md5.h>
+#else
 #include <asterisk/md5.h>
+#endif
 #include <asterisk/cdr.h>
 #include <asterisk/crypto.h>
 #include <asterisk/acl.h>
@@ -5101,6 +5105,7 @@
 
 	ast_pthread_mutex_init(&iaxq.lock);
 	ast_pthread_mutex_init(&userl.lock);
+	ast_pthread_mutex_init(&peerl.lock);
 
 	ast_cli_register(&cli_show_users);
 	ast_cli_register(&cli_show_channels);
Index: channels/chan_iax2.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax2.c,v
retrieving revision 1.25
diff -u -r1.25 chan_iax2.c
--- channels/chan_iax2.c	22 May 2003 03:08:39 -0000	1.25
+++ channels/chan_iax2.c	9 Jun 2003 02:14:16 -0000
@@ -24,7 +24,11 @@
 #include <asterisk/options.h>
 #include <asterisk/cli.h>
 #include <asterisk/translate.h>
+#if defined(__NetBSD__)
+#include <md5.h>
+#else
 #include <asterisk/md5.h>
+#endif
 #include <asterisk/cdr.h>
 #include <asterisk/crypto.h>
 #include <asterisk/acl.h>
Index: channels/chan_oss.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_oss.c,v
retrieving revision 1.5
diff -u -r1.5 chan_oss.c
--- channels/chan_oss.c	27 Apr 2003 21:34:27 -0000	1.5
+++ channels/chan_oss.c	9 Jun 2003 02:14:17 -0000
@@ -364,7 +364,11 @@
 		return 0;
 	readmode = 0;
 	if (force || time_has_passed()) {
+#ifdef __NetBSD__
+		ioctl(sounddev, SNDCTL_DSP_RESET, NULL);
+#else
 		ioctl(sounddev, SNDCTL_DSP_RESET);
+#endif
 		/* Keep the same fd reserved by closing the sound device and copying stdin at the same
 		   time. */
 		/* dup2(0, sound); */ 
@@ -394,7 +398,11 @@
 		return 0;
 	readmode = -1;
 	if (force || time_has_passed()) {
+#ifdef __NetBSD__
+		ioctl(sounddev, SNDCTL_DSP_RESET, NULL);
+#else
 		ioctl(sounddev, SNDCTL_DSP_RESET);
+#endif
 		close(sounddev);
 		/* dup2(0, sound); */
 		fd = open(DEV_DSP, O_RDONLY | O_NONBLOCK);
Index: channels/chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.120
diff -u -r1.120 chan_sip.c
--- channels/chan_sip.c	8 Jun 2003 16:26:08 -0000	1.120
+++ channels/chan_sip.c	9 Jun 2003 02:14:22 -0000
@@ -30,7 +30,11 @@
 #include <asterisk/acl.h>
 #include <asterisk/callerid.h>
 #include <asterisk/cli.h>
+#if defined(__NetBSD__)
+#include <md5.h>
+#else
 #include <asterisk/md5.h>
+#endif
 #include <asterisk/app.h>
 #include <asterisk/musiconhold.h>
 #include <asterisk/dsp.h>
Index: codecs/Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/codecs/Makefile,v
retrieving revision 1.5
diff -u -r1.5 Makefile
--- codecs/Makefile	6 May 2003 00:00:20 -0000	1.5
+++ codecs/Makefile	9 Jun 2003 02:14:22 -0000
@@ -25,9 +25,13 @@
 
 LIBG723=g723.1/libg723.a
 LIBG723B=g723.1b/libg723b.a
-LIBGSM=gsm/lib/libgsm.a
+ifneq (${OSARCH},NetBSD)
 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)
+else
+LIBGSM=gsm/lib/libgsm.a
+LIBGSMT=$(LIBGSM)
+endif
 LIBMP3=mp3/libmp3.a
 LIBLPC10=lpc10/liblpc10.a
 LIBSPEEX=-lspeex -lm
Index: codecs/gsm/Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/codecs/gsm/Makefile,v
retrieving revision 1.3
diff -u -r1.3 Makefile
--- codecs/gsm/Makefile	27 Apr 2003 18:13:11 -0000	1.3
+++ codecs/gsm/Makefile	9 Jun 2003 02:14:22 -0000
@@ -54,7 +54,8 @@
 # CC		= /usr/lang/acc
 # CCFLAGS 	= -c -O
 
-CC		= gcc -ansi -pedantic $(OPTIMIZE) -march=$(PROC) -fschedule-insns2  -fomit-frame-pointer 
+ARCH=$(shell if uname -m | grep -q 86; then echo "-march=$(PROC)"; fi)
+CC		= gcc -ansi -pedantic $(OPTIMIZE) $(ARCH) -fschedule-insns2  -fomit-frame-pointer 
 CCFLAGS 	+= -c -DNeedFunctionPrototypes=1 -finline-functions -funroll-loops -fPIC
 
 LD 		= $(CC)
@@ -190,7 +191,9 @@
 		$(SRC)/short_term.c	\
 		$(SRC)/table.c
 ifneq (${OSARCH},OpenBSD)
+  ifneq (${OSARCH},NetBSD)
 GSM_SOURCES+=	$(SRC)/k6opt.s
+  endif
 endif
 
 TOAST_SOURCES = $(SRC)/toast.c 		\
@@ -237,7 +240,9 @@
 		$(SRC)/short_term.o	\
 		$(SRC)/table.o
 ifneq (${OSARCH},OpenBSD)
+  ifneq (${OSARCH},NetBSD)
 GSM_OBJECTS+=	$(SRC)/k6opt.o
+  endif
 endif
 
 TOAST_OBJECTS =	$(SRC)/toast.o 		\
Index: codecs/lpc10/Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/codecs/lpc10/Makefile,v
retrieving revision 1.3
diff -u -r1.3 Makefile
--- codecs/lpc10/Makefile	27 Apr 2003 18:13:11 -0000	1.3
+++ codecs/lpc10/Makefile	9 Jun 2003 02:14:22 -0000
@@ -25,9 +25,11 @@
 CFLAGS = $(OPTIMIZE) -I$(LIB_TARGET_DIR) $(WARNINGS) -fPIC
 #CFLAGS+= $(shell if uname -m | grep -q 86; then echo "-mpentium" ; fi)
 
-#fix for PPC processors
+#fix for PPC and sparc64 processors
 ifneq ($(PROC),ppc)
+  ifneq ($(PROC),sparc64)
 	CFLAGS+= -march=$(PROC)
+  endif
 endif
 
 LIB = $(LIB_TARGET_DIR)/liblpc10.a
Index: codecs/lpc10/lpc10.h
===================================================================
RCS file: /usr/cvsroot/asterisk/codecs/lpc10/lpc10.h,v
retrieving revision 1.2
diff -u -r1.2 lpc10.h
--- codecs/lpc10/lpc10.h	23 Apr 2003 19:13:35 -0000	1.2
+++ codecs/lpc10/lpc10.h	9 Jun 2003 02:14:23 -0000
@@ -35,7 +35,7 @@
 
  */
 
-#if defined(unix) || defined(__unix__)
+#if defined(unix) || defined(__unix__) || defined (__NetBSD__)
 typedef short		INT16;
 typedef int		INT32;
 #endif
Index: include/asterisk/channel.h
===================================================================
RCS file: /usr/cvsroot/asterisk/include/asterisk/channel.h,v
retrieving revision 1.12
diff -u -r1.12 channel.h
--- include/asterisk/channel.h	30 May 2003 04:41:18 -0000	1.12
+++ include/asterisk/channel.h	9 Jun 2003 02:14:24 -0000
@@ -18,6 +18,7 @@
 #include <asterisk/sched.h>
 #include <asterisk/chanvars.h>
 #include <setjmp.h>
+#include <unistd.h>
 #include <pthread.h>
 
 #if defined(__cplusplus) || defined(c_plusplus)
Index: include/asterisk/frame.h
===================================================================
RCS file: /usr/cvsroot/asterisk/include/asterisk/frame.h,v
retrieving revision 1.7
diff -u -r1.7 frame.h
--- include/asterisk/frame.h	16 May 2003 23:33:41 -0000	1.7
+++ include/asterisk/frame.h	9 Jun 2003 02:14:24 -0000
@@ -26,7 +26,7 @@
 #ifndef __BYTE_ORDER
 #ifdef __linux__
 #include <endian.h>
-#elif defined(__OpenBSD__)
+#elif defined(__OpenBSD__) || defined(__NetBSD__)
 #include <machine/endian.h>
 #define __BYTE_ORDER BYTE_ORDER
 #define __LITTLE_ENDIAN LITTLE_ENDIAN
Index: res/res_crypto.c
===================================================================
RCS file: /usr/cvsroot/asterisk/res/res_crypto.c,v
retrieving revision 1.2
diff -u -r1.2 res_crypto.c
--- res/res_crypto.c	23 Apr 2003 19:09:13 -0000	1.2
+++ res/res_crypto.c	9 Jun 2003 02:14:24 -0000
@@ -18,8 +18,13 @@
 #include <asterisk/say.h>
 #include <asterisk/module.h>
 #include <asterisk/options.h>
-#include <asterisk/crypto.h>
+#if defined(__NetBSD__)
+#include <md5.h>
+#define HEADER_MD5_H	/* XXXrkb: so we don't pull in OpenSSL MD5 foo */
+#else
 #include <asterisk/md5.h>
+#endif
+#include <asterisk/crypto.h>
 #include <asterisk/cli.h>
 #include <asterisk/io.h>
 #include <openssl/ssl.h>



More information about the asterisk-dev mailing list