소스 검색

- core warning fixes for 64 bits archs
- added include netinet/in_systm.h in tcp_*, udp_* (needed for IP_TOS on non
linux systems)
- now when using gcc 3.x/x86 ser is optimized for athlon, but "normal" i386
instructions are used. All this is overwritable from the environment or command line: CPU=athlon-mp make , or to also generate athlon instructions:
CPU=athlon-mp CC_EXTRA_OPTS=-march=athlon-mp make

Andrei Pelinescu-Onciul 22 년 전
부모
커밋
1f2c924e85
5개의 변경된 파일22개의 추가작업 그리고 14개의 파일을 삭제
  1. 14 6
      Makefile.defs
  2. 0 3
      msg_translator.c
  3. 5 5
      parser/parse_uri.c
  4. 2 0
      tcp_main.c
  5. 1 0
      udp_server.c

+ 14 - 6
Makefile.defs

@@ -4,7 +4,8 @@
 #
 #
 # Environment variables:
 # Environment variables:
 #   PREFIX, LOCALBASE, BASEDIR
 #   PREFIX, LOCALBASE, BASEDIR
-#   INSTALL, TAR , CC, LEX, YACC
+#   INSTALL, TAR , CC, LEX, YACC,
+#   CPU, CC_EXTRA_OPTS
 #
 #
 # History:
 # History:
 # --------
 # --------
@@ -14,7 +15,9 @@
 #  2003-02-25  added -DDISABLE_NAGLE
 #  2003-02-25  added -DDISABLE_NAGLE
 #  2003-03-02  added -DDIGEST_DOMAIN (janakj)
 #  2003-03-02  added -DDIGEST_DOMAIN (janakj)
 #  2003-03-10  added -xcode=pic32 for module compilation w/ sun cc
 #  2003-03-10  added -xcode=pic32 for module compilation w/ sun cc
-#              (too many symbols for pic13)  (andrei)
+#               (too many symbols for pic13)  (andrei)
+#  2003-04-16  added CC_EXTRA_OPTS, s/march/mcpu, added CPU (cpu to optimize 
+#               for, used only with gcc-3.x)
 
 
 
 
 #version number
 #version number
@@ -28,6 +31,8 @@ OS = $(shell uname -s | sed -e s/SunOS/solaris/ | tr "[A-Z]" "[a-z]")
 ARCH = $(shell uname -m |sed -e s/i.86/i386/ -e s/sun4u/sparc64/  \
 ARCH = $(shell uname -m |sed -e s/i.86/i386/ -e s/sun4u/sparc64/  \
 			-e s/armv4l/arm/)
 			-e s/armv4l/arm/)
 
 
+# extra CC command line options (e.g  -march=athlon-mp)
+CC_EXTRA_OPTS ?=
  # install location
  # install location
 PREFIX ?= /usr/local
 PREFIX ?= /usr/local
 LOCALBASE ?= /usr/local
 LOCALBASE ?= /usr/local
@@ -178,7 +183,7 @@ YACC := $(shell echo "$${YACC}")
 
 
 
 
 DEFS+= -DNAME='"$(NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
 DEFS+= -DNAME='"$(NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
-	 -DOS='"$(OS)"' -DCOMPILER='"$(CC_VER)"' -D__CPU_$(ARCH)\
+	 -DOS='"$(OS)"' -DCOMPILER='"$(CC_VER)"' -D__CPU_$(ARCH) -D__OS_$(OS) \
 	 -DCFG_DIR='"$(cfg-target)"'\
 	 -DCFG_DIR='"$(cfg-target)"'\
 	 -DPKG_MALLOC \
 	 -DPKG_MALLOC \
 	 -DSHM_MEM  -DSHM_MMAP \
 	 -DSHM_MEM  -DSHM_MMAP \
@@ -362,9 +367,10 @@ ifeq		($(CC_NAME), gcc)
 					-Wall   \
 					-Wall   \
 			#if gcc 3.0
 			#if gcc 3.0
 ifeq			($(CC_SHORTVER), 3.0)
 ifeq			($(CC_SHORTVER), 3.0)
+					CPU ?= athlon
 					CFLAGS+=-minline-all-stringops -malign-double \
 					CFLAGS+=-minline-all-stringops -malign-double \
 							-falign-loops \
 							-falign-loops \
-							-march=athlon \
+							-mcpu=$(CPU) \
 							#-mcpu=athlon
 							#-mcpu=athlon
 else
 else
 ifeq			($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
 ifeq			($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
@@ -408,8 +414,9 @@ ifeq		($(CC_NAME), gcc)
 					#-Wmissing-prototypes 
 					#-Wmissing-prototypes 
 				#if gcc 3.0
 				#if gcc 3.0
 ifeq			($(CC_SHORTVER), 3.0)
 ifeq			($(CC_SHORTVER), 3.0)
+					CPU ?= ultrasparc
 					#use 32bit for now
 					#use 32bit for now
-					CFLAGS+= -mcpu=ultrasparc -mtune=ultrasparc  -m32  \
+					CFLAGS+= -mcpu=ultrasparc -mtune=$(CPU)  -m32  \
 					# -mcpu=v9 or ultrasparc? # -mtune implied by -mcpu
 					# -mcpu=v9 or ultrasparc? # -mtune implied by -mcpu
 					#-mno-epilogue #try to inline function exit code
 					#-mno-epilogue #try to inline function exit code
 					#-mflat # omit save/restore
 					#-mflat # omit save/restore
@@ -483,7 +490,8 @@ endif		#CC_NAME, gcc
 endif	#ARCH, i386
 endif	#ARCH, i386
 
 
 
 
-	
+CFLAGS+= $(CC_EXTRA_OPTS)
+
 
 
 LDFLAGS=
 LDFLAGS=
 # setting LDFLAGS
 # setting LDFLAGS

+ 0 - 3
msg_translator.c

@@ -1781,9 +1781,6 @@ char * build_res_buf_with_body_from_sip_req( unsigned int code, char *text ,
 	}
 	}
 	*(p) = 0;
 	*(p) = 0;
 	*returned_len = len;
 	*returned_len = len;
-	DBG("build_*: len=%d, diff=%d\n", len, p-buf);
-	DBG("build_*: rport_len=%d, delete_len=%d\n", rport_len, delete_len);
-	DBG("build_*: message=\n%.*s\n", (int)len, buf);
 	/* in req2reply, received_buf is not introduced to lumps and
 	/* in req2reply, received_buf is not introduced to lumps and
 	   needs to be deleted here
 	   needs to be deleted here
 	*/
 	*/

+ 5 - 5
parser/parse_uri.c

@@ -908,24 +908,24 @@ error_too_short:
 error_bad_char:
 error_bad_char:
 	LOG(L_ERR, "ERROR: parse_uri: bad char '%c' in state %d"
 	LOG(L_ERR, "ERROR: parse_uri: bad char '%c' in state %d"
 			" parsed: <%.*s> (%d) / <%.*s> (%d)\n",
 			" parsed: <%.*s> (%d) / <%.*s> (%d)\n",
-			*p, state, (p-buf), buf, (p-buf), len, buf, len);
+			*p, state, (int)(p-buf), buf, (int)(p-buf), len, buf, len);
 	return E_BAD_URI;
 	return E_BAD_URI;
 error_bad_host:
 error_bad_host:
 	LOG(L_ERR, "ERROR: parse_uri: bad host in uri (error at char %c in"
 	LOG(L_ERR, "ERROR: parse_uri: bad host in uri (error at char %c in"
 			" state %d) parsed: <%.*s>(%d) /<%.*s> (%d)\n",
 			" state %d) parsed: <%.*s>(%d) /<%.*s> (%d)\n",
-			*p, state, (p-buf), buf, (p-buf), len, buf, len);
+			*p, state, (int)(p-buf), buf, (int)(p-buf), len, buf, len);
 	ser_error=E_BAD_URI;
 	ser_error=E_BAD_URI;
 	return E_BAD_URI;
 	return E_BAD_URI;
 error_bad_port:
 error_bad_port:
 	LOG(L_ERR, "ERROR: parse_uri: bad port in uri (error at char %c in"
 	LOG(L_ERR, "ERROR: parse_uri: bad port in uri (error at char %c in"
 			" state %d) parsed: <%.*s>(%d) /<%.*s> (%d)\n",
 			" state %d) parsed: <%.*s>(%d) /<%.*s> (%d)\n",
-			*p, state, (p-buf), buf, (p-buf), len, buf, len);
+			*p, state, (int)(p-buf), buf, (int)(p-buf), len, buf, len);
 	ser_error=E_BAD_URI;
 	ser_error=E_BAD_URI;
 	return E_BAD_URI;
 	return E_BAD_URI;
 error_bad_uri:
 error_bad_uri:
 	LOG(L_ERR, "ERROR: parse_uri: bad uri,  state %d"
 	LOG(L_ERR, "ERROR: parse_uri: bad uri,  state %d"
 			" parsed: <%.*s> (%d) / <%.*s> (%d)\n",
 			" parsed: <%.*s> (%d) / <%.*s> (%d)\n",
-			 state, (p-buf), buf, (p-buf), len, buf, len);
+			 state, (int)(p-buf), buf, (int)(p-buf), len, buf, len);
 	ser_error=E_BAD_URI;
 	ser_error=E_BAD_URI;
 	return E_BAD_URI;
 	return E_BAD_URI;
 error_headers:
 error_headers:
@@ -938,7 +938,7 @@ error_headers:
 error_bug:
 error_bug:
 	LOG(L_CRIT, "BUG: parse_uri: bad  state %d"
 	LOG(L_CRIT, "BUG: parse_uri: bad  state %d"
 			" parsed: <%.*s> (%d) / <%.*s> (%d)\n",
 			" parsed: <%.*s> (%d) / <%.*s> (%d)\n",
-			 state, (p-buf), buf, (p-buf), len, buf, len);
+			 state, (int)(p-buf), buf, (int)(p-buf), len, buf, len);
 	ser_error=E_BAD_URI;
 	ser_error=E_BAD_URI;
 	return E_BAD_URI;
 	return E_BAD_URI;
 }
 }

+ 2 - 0
tcp_main.c

@@ -54,6 +54,8 @@
 #include <sys/types.h>
 #include <sys/types.h>
 #include <sys/select.h>
 #include <sys/select.h>
 #include <sys/socket.h>
 #include <sys/socket.h>
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
 #include <netinet/ip.h>
 #include <netinet/ip.h>
 #include <netinet/tcp.h>
 #include <netinet/tcp.h>
 #include <sys/uio.h>  /* writev*/
 #include <sys/uio.h>  /* writev*/

+ 1 - 0
udp_server.c

@@ -38,6 +38,7 @@
 #include <sys/types.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <netinet/in.h>
+#include <netinet/in_systm.h>
 #include <netinet/ip.h>
 #include <netinet/ip.h>
 #include <errno.h>
 #include <errno.h>
 #include <arpa/inet.h>
 #include <arpa/inet.h>