More Asterisk sparc patches (courtesy Belgarath)
authorMark Spencer <markster@digium.com>
Tue, 31 Aug 2004 16:33:00 +0000 (16:33 +0000)
committerMark Spencer <markster@digium.com>
Tue, 31 Aug 2004 16:33:00 +0000 (16:33 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3693 65c4cc65-6c06-0410-ace0-fbb531ad65f3

Makefile
cdr/Makefile
channels/Makefile
channels/chan_sip.c
codecs/gsm/Makefile
codecs/lpc10/Makefile
db1-ast/Makefile

index c922957..2457ea8 100755 (executable)
--- a/Makefile
+++ b/Makefile
@@ -27,8 +27,15 @@ PROC=k8
 OPTIONS+=-m64
 endif
 ifeq ($(PROC),sparc64)
+#The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
+#This works for even old (2.96) versions of gcc and provides a small boost either way.
+#A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
+#So we go lowest common available by gcc and go a step down, still a step up from
+#the default as we now have a better instruction set to work with. - Belgarath
 PROC=ultrasparc
-CFLAGS+=$(shell if $(CC) -mtune=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mtune=$(PROC)"; fi)
+OPTIONS+=$(shell if $(CC) -mtune=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mtune=$(PROC)"; fi)
+OPTIONS+=$(shell if $(CC) -mcpu=v8 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mcpu=v8"; fi)
+OPTIONS+=-fomit-frame-pointer
 endif
 
 endif
@@ -55,7 +62,7 @@ PWD=$(shell pwd)
 #K6OPT  = -DK6OPT
 
 #Tell gcc to optimize the asterisk's code
-OPTIMIZE=-O6
+OPTIMIZE+=-O6
 
 #Include debug symbols in the executables (-g) and profiling info (-pg)
 DEBUG=-g #-pg
index d2ba09c..5430f5c 100755 (executable)
@@ -17,11 +17,23 @@ MODS=cdr_csv.so cdr_manager.so
 
 CFLAGS+=-fPIC
 
+PROC=$(shell uname -m)
 OSARCH=$(shell uname -s)
+
 ifeq (${OSARCH},FreeBSD)
 SOLINK+=-L/usr/local/lib
 endif
 
+#The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
+#This works for even old (2.96) versions of gcc and provides a small boost either way.
+#A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn.t support it.
+#So we go lowest common available by gcc and go a step down, still a step up from
+#the default as we now have a better instruction set to work with. - Belgarath
+ifeq ($(PROC),sparc64)
+PROC=ultrasparc
+CFLAGS += -mtune=$(PROC) -O3 -pipe -fomit-frame-pointer -mcpu=v8
+endif
+
 #
 # unixODBC stuff...
 #
index d9b6709..f73ce05 100755 (executable)
@@ -7,11 +7,15 @@
 #
 # Mark Spencer <markster@linux-support.net>
 #
+# Edited By Belgarath <> Aug 28 2004
+# Added bare bones ultrasparc-linux support.
+#
 # This program is free software, distributed under the terms of
 # the GNU General Public License
 #
 
 OSARCH=$(shell uname -s)
+PROC=$(shell uname -m)
 
 USE_MYSQL_FRIENDS=0
 USE_SIP_MYSQL_FRIENDS=0
@@ -45,6 +49,12 @@ MYSQLLIB=-L/usr/lib/mysql -lmysqlclient
 PTLIB=-lpt_linux_x86_r
 H323LIB=-lh323_linux_x86_r
 CHANH323LIB=-ldl
+
+ifeq ($(PROC),sparc64)
+PROC=ultrasparc
+CFLAGS += -mtune=$(PROC) -O3 -pipe -fomit-frame-pointer -mcpu=v8
+endif
+
 endif
 ifeq (${OSARCH},FreeBSD)
 PTLIB=-lpt_FreeBSD_x86_r
index 86675b7..59dbf32 100755 (executable)
@@ -3685,21 +3685,19 @@ static void initreqprep(struct sip_request *req, struct sip_pvt *p, char *cmd, c
        } else {
                snprintf(invite, sizeof(invite), "sip:%s", p->tohost);
        }
+       if (!ast_strlen_zero(p->extraparams)) {
+               strncat(invite, ";", sizeof(invite) - strlen(invite));
+               strncat(invite, p->extraparams, sizeof(invite) - strlen(invite));
+       }
        strncpy(p->uri, invite, sizeof(p->uri) - 1);
        /* If there is a VXML URL append it to the SIP URL */
        if (vxml_url)
        {
-               if (strlen(p->extraparams))
-                       snprintf(to, sizeof(to), "<%s;%s>;%s", invite, p->extraparams, vxml_url);
-               else
-                       snprintf(to, sizeof(to), "<%s>;%s", invite, vxml_url);
+               snprintf(to, sizeof(to), "<%s>;%s", invite, vxml_url);
        }
        else
        {
-               if (strlen(p->extraparams))
-                       snprintf(to, sizeof(to), "<%s;%s>", invite, p->extraparams);
-               else
-                       snprintf(to, sizeof(to), "<%s>", invite);
+               snprintf(to, sizeof(to), "<%s>", invite);
        }
        memset(req, 0, sizeof(struct sip_request));
        init_req(req, cmd, invite);
index 572f61e..a21bd7e 100755 (executable)
@@ -49,6 +49,15 @@ endif
 endif
 endif
 
+#The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
+#This works for even old (2.96) versions of gcc and provides a small boost either way.
+#A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
+#So we go lowest common available by gcc and go a step down, still a step up from
+#the default as we now have a better instruction set to work with. - Belgarath
+ifeq (${PROC},ultrasparc)
+OPTIMIZE+=-mcpu=v8 -mtune=$(PROC) -O3 -fomit-frame-pointer
+endif
+
 PG =
 #PG = -g -pg
 ######### Profiling flags.  If you don't know what that means, leave it blank.
index f747e64..23d6886 100755 (executable)
@@ -31,8 +31,13 @@ ifneq ($(findstring BSD,${OSARCH}),BSD)
 ifneq ($(PROC),ppc)
 ifneq ($(PROC),x86_64)
 ifneq ($(PROC),alpha)
+#The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
+#This works for even old (2.96) versions of gcc and provides a small boost either way.
+#A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn.t support it.
+#So we go lowest common available by gcc and go a step down, still a step up from
+#the default as we now have a better instruction set to work with. - Belgarath
 ifeq ($(PROC),ultrasparc)
-        CFLAGS+= -mtune=$(PROC)
+        CFLAGS+= -mtune=$(PROC) -mcpu=v8 -O3 -fomit-frame-pointer
 else
         CFLAGS+= -march=$(PROC)
 endif
index 0bb8ea5..f8192f7 100755 (executable)
@@ -7,6 +7,12 @@ SOVER=2.1
 else
 SOVER=2
 endif
+#Added support for UltraSparc - Belgarath
+ifeq ($(ARCH),sparc64)
+PROC=ultrasparc
+CFLAGS += -mtune=$(PROC) -O3 -pipe -fomit-frame-pointer -mcpu=v8
+endif
+
 LIBDBSO=libdb.so.$(SOVER)
 PROG=  db_dump185
 OBJ1=  hash.o hash_bigkey.o hash_buf.o hash_func.o hash_log2.o hash_page.o \