diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-03-17 23:12:15 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-03-17 23:12:15 +0000 |
commit | 57710533e753388fd7a1721f66a4d847c8b6e44b (patch) | |
tree | 3fa0c3a5fb61e3662f4353566a235dca4291f79a | |
parent | 3c174d1548595cc0b59a08b7b10dad9f8145471b (diff) |
Add support for Solaris/x86 (bug #3064)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5199 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-x | channels/chan_zap.c | 4 | ||||
-rwxr-xr-x | channels/iax2-parser.c | 2 | ||||
-rwxr-xr-x | db1-ast/hash/hash.c | 4 | ||||
-rwxr-xr-x | include/asterisk/channel.h | 3 | ||||
-rwxr-xr-x | include/asterisk/logger.h | 4 | ||||
-rwxr-xr-x | include/asterisk/utils.h | 3 | ||||
-rwxr-xr-x | include/solaris-compat/compat.h | 34 | ||||
-rwxr-xr-x | mkpkgconfig | 12 | ||||
-rwxr-xr-x | res/res_agi.c | 3 | ||||
-rwxr-xr-x | rtp.c | 4 | ||||
-rwxr-xr-x | strcompat.c | 9 | ||||
-rwxr-xr-x | utils.c | 1 | ||||
-rwxr-xr-x | utils/Makefile | 5 | ||||
-rwxr-xr-x | utils/smsq.c | 5 |
14 files changed, 70 insertions, 23 deletions
diff --git a/channels/chan_zap.c b/channels/chan_zap.c index 2df1590f9..b77776d75 100755 --- a/channels/chan_zap.c +++ b/channels/chan_zap.c @@ -1055,7 +1055,7 @@ static int str2r2prot(char *swtype) } #endif -static char *sig2str(int sig) +static char *zap_sig2str(int sig) { static char buf[256]; switch(sig) { @@ -1111,6 +1111,8 @@ static char *sig2str(int sig) } } +#define sig2str zap_sig2str + static int conf_add(struct zt_pvt *p, struct zt_subchannel *c, int index, int slavechannel) { /* If the conference already exists, and we're already in it diff --git a/channels/iax2-parser.c b/channels/iax2-parser.c index edc15ec07..66a69b447 100755 --- a/channels/iax2-parser.c +++ b/channels/iax2-parser.c @@ -30,7 +30,7 @@ static int frames = 0; static int iframes = 0; static int oframes = 0; -#ifdef SOLARIS +#if defined(SOLARIS) && defined(__sparc__) static unsigned int get_uint32(unsigned char *p) { return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]; diff --git a/db1-ast/hash/hash.c b/db1-ast/hash/hash.c index 99592eac5..349af6c63 100755 --- a/db1-ast/hash/hash.c +++ b/db1-ast/hash/hash.c @@ -51,6 +51,10 @@ static char sccsid[] = "@(#)hash.c 8.9 (Berkeley) 6/16/94"; #include <assert.h> #endif +#ifdef SOLARIS +#include <solaris-compat/compat.h> +#endif + #include <db.h> #include "hash.h" #include "page.h" diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h index 1ebcb3064..25b483b11 100755 --- a/include/asterisk/channel.h +++ b/include/asterisk/channel.h @@ -14,6 +14,9 @@ #ifndef _ASTERISK_CHANNEL_H #define _ASTERISK_CHANNEL_H +#ifdef SOLARIS +#include <solaris-compat/compat.h> +#endif #include <asterisk/frame.h> #include <asterisk/sched.h> #include <asterisk/chanvars.h> diff --git a/include/asterisk/logger.h b/include/asterisk/logger.h index 1f7eab530..2e8a786b5 100755 --- a/include/asterisk/logger.h +++ b/include/asterisk/logger.h @@ -13,7 +13,9 @@ #ifndef _LOGGER_H #define _LOGGER_H - +#ifdef SOLARIS +#include <solaris-compat/compat.h> +#endif #include <stdarg.h> #if defined(__cplusplus) || defined(c_plusplus) diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h index 590815320..b1b71d73e 100755 --- a/include/asterisk/utils.h +++ b/include/asterisk/utils.h @@ -12,6 +12,9 @@ #ifndef _ASTERISK_UTIL_H #define _ASTERISK_UTIL_H +#ifdef SOLARIS +#include <solaris-compat/compat.h> +#endif #include <netinet/in.h> #include <netdb.h> #include <pthread.h> diff --git a/include/solaris-compat/compat.h b/include/solaris-compat/compat.h index 6b304b2ba..3f448117d 100755 --- a/include/solaris-compat/compat.h +++ b/include/solaris-compat/compat.h @@ -8,18 +8,29 @@ #define __P(p) p #endif -#define LITTLE_ENDIAN 1234 -#define BIG_ENDIAN 4321 - -#define __LITTLE_ENDIAN 1234 -#define __BIG_ENDIAN 4321 +#include <alloca.h> +#include <strings.h> +#include <string.h> +#include <pthread.h> +#include <sys/stat.h> +#include <signal.h> +#include <netinet/in.h> + +#ifndef BYTE_ORDER +#define LITTLE_ENDIAN 1234 +#define BIG_ENDIAN 4321 #ifdef __sparc__ -#define BYTE_ORDER BIG_ENDIAN -#define __BYTE_ORDER BIG_ENDIAN +#define BYTE_ORDER BIG_ENDIAN #else -#define BYTE_ORDER LITTLE_ENDIAN -#define ____BYTE_ORDER BIG_ENDIAN +#define BYTE_ORDER LITTLE_ENDIAN +#endif +#endif + +#ifndef __BYTE_ORDER +#define __LITTLE_ENDIAN LITTLE_ENDIAN +#define __BIG_ENDIAN BIG_ENDIAN +#define __BYTE_ORDER BYTE_ORDER #endif #ifndef __BIT_TYPES_DEFINED__ @@ -29,6 +40,9 @@ typedef unsigned short u_int16_t; typedef unsigned int u_int32_t; #endif +char* strsep(char** str, const char* delims); +uint64_t +strtoq(const char *nptr, char **endptr, int base); int setenv(const char *name, const char *value, int overwrite); - +int unsetenv(const char *name); #endif diff --git a/mkpkgconfig b/mkpkgconfig index 3b097a9fe..0ae2a24bf 100755 --- a/mkpkgconfig +++ b/mkpkgconfig @@ -15,12 +15,12 @@ fi ## Clean out CFLAGS for the spec file. -LOCAL_CFLAGS=$(echo $CFLAGS | sed -e 's/\s*-pipe\s*//g' | sed -e 's/-[Wmp]\S*\s*//g' | \ - sed -r -e 's/-I(include|\.\.\/include) //g' | - sed -e 's/-DINSTALL_PREFIX=\S* //g' | - sed -r -e 's/-DASTERISK_VERSION=\S* //g' | - sed -r -e 's/-DAST(ETCDIR|LIBDIR|VARLIBDIR|VARRUNDIR|SPOOLDIR|LOGDIR|CONFPATH|MODDIR|AGIDIR)=\S* //g' -) +LOCAL_CFLAGS=`echo $CFLAGS | sed -e 's/\s*-pipe\s*//g' | sed -e 's/-[Wmp]\S*\s*//g' | \ + sed -r -e 's/-I(include|\.\.\/include) //g' | \ + sed -e 's/-DINSTALL_PREFIX=\S* //g' | \ + sed -r -e 's/-DASTERISK_VERSION=\S* //g' | \ + sed -r -e 's/-DAST(ETCDIR|LIBDIR|VARLIBDIR|VARRUNDIR|SPOOLDIR|LOGDIR|CONFPATH|MODDIR|AGIDIR)=\S* //g'` + cat <<EOF > $PPATH/asterisk.pc install_prefix=$INSTALL_PREFIX diff --git a/res/res_agi.c b/res/res_agi.c index 6557dc9fc..ecf539128 100755 --- a/res/res_agi.c +++ b/res/res_agi.c @@ -48,6 +48,9 @@ #include <asterisk/agi.h> #include "../asterisk.h" #include "../astconf.h" +#ifdef SOLARIS +#include <asterisk/astmm.h> +#endif #define MAX_ARGS 128 #define MAX_COMMANDS 128 @@ -1170,11 +1170,9 @@ int ast_rtp_sendcng(struct ast_rtp *rtp, int level) return 0; } -#ifdef SOLARIS +#if defined(SOLARIS) && defined(__sparc__) static void put_uint32(unsigned char *buf, int i) { - unsigned char *c = (unsigned char *)&i; - buf[0] = (i>>24) & 0xff; buf[1] = (i>>16) & 0xff; buf[2] = (i>>8) & 0xff; diff --git a/strcompat.c b/strcompat.c index 289116476..b8f9f0e49 100755 --- a/strcompat.c +++ b/strcompat.c @@ -2,6 +2,9 @@ #include <sys/types.h> #include <stdio.h> +#ifdef SOLARIS +#include <solaris-compat/compat.h> +#endif char* strsep(char** str, const char* delims) { @@ -142,3 +145,9 @@ int setenv(const char *name, const char *value, int overwrite) return ret; } + +int unsetenv(const char *name) +{ + setenv(name,"",0); +} + @@ -164,6 +164,7 @@ struct hostent *ast_gethostbyname(const char *host, struct ast_hostent *hp) integers, we break with tradition and refuse to look up a pure integer */ s = host; + res = 0; while(s && *s) { if (!isdigit(*s)) break; diff --git a/utils/Makefile b/utils/Makefile index dcacce210..a3f04d10f 100755 --- a/utils/Makefile +++ b/utils/Makefile @@ -12,6 +12,9 @@ TARGET=stereorize TARGET+=$(shell if [ -f /usr/include/popt.h ]; then echo "smsq"; else if [ -f /usr/local/include/popt.h ]; then echo "smsq"; fi ; fi) TARGET+=$(shell if [ -f /usr/include/newt.h ]; then echo "astman"; else if [ -f /usr/local/include/newt.h ]; then echo "astman"; fi ; fi) +ifeq (${OSARCH},SunOS) +SOL=../strcompat.o +endif all: depend $(TARGET) @@ -32,7 +35,7 @@ stereorize: stereorize.o frame.o $(CC) $(CFLAGS) -o stereorize stereorize.o frame.o -lm smsq: smsq.o - $(CC) $(CFLAGS) -o smsq smsq.o -lpopt + $(CC) $(CFLAGS) -o smsq ${SOL} smsq.o -lpopt ifneq ($(wildcard .depend),) include .depend diff --git a/utils/smsq.c b/utils/smsq.c index 9bdcfe353..0da4c83db 100755 --- a/utils/smsq.c +++ b/utils/smsq.c @@ -9,6 +9,11 @@ #include <stdlib.h> #include <unistd.h> #include <time.h> +#ifdef SOLARIS +#include <solaris-compat/compat.h> +#define POPT_ARGFLAG_SHOW_DEFAULT 0x00800000 +#endif + /* SMS queuing application for use with asterisk app_sms */ /* by Adrian Kennard, 2004 - 2005 */ |