Browse code

- 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 authored on 16/04/2003 16:17:09
Showing 5 changed files
... ...
@@ -4,7 +4,8 @@
4 4
 #
5 5
 # Environment variables:
6 6
 #   PREFIX, LOCALBASE, BASEDIR
7
-#   INSTALL, TAR , CC, LEX, YACC
7
+#   INSTALL, TAR , CC, LEX, YACC,
8
+#   CPU, CC_EXTRA_OPTS
8 9
 #
9 10
 # History:
10 11
 # --------
... ...
@@ -14,7 +15,9 @@
14 14
 #  2003-02-25  added -DDISABLE_NAGLE
15 15
 #  2003-03-02  added -DDIGEST_DOMAIN (janakj)
16 16
 #  2003-03-10  added -xcode=pic32 for module compilation w/ sun cc
17
-#              (too many symbols for pic13)  (andrei)
17
+#               (too many symbols for pic13)  (andrei)
18
+#  2003-04-16  added CC_EXTRA_OPTS, s/march/mcpu, added CPU (cpu to optimize 
19
+#               for, used only with gcc-3.x)
18 20
 
19 21
 
20 22
 #version number
... ...
@@ -28,6 +31,8 @@ OS = $(shell uname -s | sed -e s/SunOS/solaris/ | tr "[A-Z]" "[a-z]")
28 28
 ARCH = $(shell uname -m |sed -e s/i.86/i386/ -e s/sun4u/sparc64/  \
29 29
 			-e s/armv4l/arm/)
30 30
 
31
+# extra CC command line options (e.g  -march=athlon-mp)
32
+CC_EXTRA_OPTS ?=
31 33
  # install location
32 34
 PREFIX ?= /usr/local
33 35
 LOCALBASE ?= /usr/local
... ...
@@ -178,7 +183,7 @@ YACC := $(shell echo "$${YACC}")
178 178
 
179 179
 
180 180
 DEFS+= -DNAME='"$(NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
181
-	 -DOS='"$(OS)"' -DCOMPILER='"$(CC_VER)"' -D__CPU_$(ARCH)\
181
+	 -DOS='"$(OS)"' -DCOMPILER='"$(CC_VER)"' -D__CPU_$(ARCH) -D__OS_$(OS) \
182 182
 	 -DCFG_DIR='"$(cfg-target)"'\
183 183
 	 -DPKG_MALLOC \
184 184
 	 -DSHM_MEM  -DSHM_MMAP \
... ...
@@ -362,9 +367,10 @@ ifeq		($(CC_NAME), gcc)
362 362
 					-Wall   \
363 363
 			#if gcc 3.0
364 364
 ifeq			($(CC_SHORTVER), 3.0)
365
+					CPU ?= athlon
365 366
 					CFLAGS+=-minline-all-stringops -malign-double \
366 367
 							-falign-loops \
367
-							-march=athlon \
368
+							-mcpu=$(CPU) \
368 369
 							#-mcpu=athlon
369 370
 else
370 371
 ifeq			($(CC_SHORTVER), 2.9x) #older gcc version (2.9[1-5])
... ...
@@ -408,8 +414,9 @@ ifeq		($(CC_NAME), gcc)
408 408
 					#-Wmissing-prototypes 
409 409
 				#if gcc 3.0
410 410
 ifeq			($(CC_SHORTVER), 3.0)
411
+					CPU ?= ultrasparc
411 412
 					#use 32bit for now
412
-					CFLAGS+= -mcpu=ultrasparc -mtune=ultrasparc  -m32  \
413
+					CFLAGS+= -mcpu=ultrasparc -mtune=$(CPU)  -m32  \
413 414
 					# -mcpu=v9 or ultrasparc? # -mtune implied by -mcpu
414 415
 					#-mno-epilogue #try to inline function exit code
415 416
 					#-mflat # omit save/restore
... ...
@@ -483,7 +490,8 @@ endif		#CC_NAME, gcc
483 483
 endif	#ARCH, i386
484 484
 
485 485
 
486
-	
486
+CFLAGS+= $(CC_EXTRA_OPTS)
487
+
487 488
 
488 489
 LDFLAGS=
489 490
 # setting LDFLAGS
... ...
@@ -1781,9 +1781,6 @@ char * build_res_buf_with_body_from_sip_req( unsigned int code, char *text ,
1781 1781
 	}
1782 1782
 	*(p) = 0;
1783 1783
 	*returned_len = len;
1784
-	DBG("build_*: len=%d, diff=%d\n", len, p-buf);
1785
-	DBG("build_*: rport_len=%d, delete_len=%d\n", rport_len, delete_len);
1786
-	DBG("build_*: message=\n%.*s\n", (int)len, buf);
1787 1784
 	/* in req2reply, received_buf is not introduced to lumps and
1788 1785
 	   needs to be deleted here
1789 1786
 	*/
... ...
@@ -908,24 +908,24 @@ error_too_short:
908 908
 error_bad_char:
909 909
 	LOG(L_ERR, "ERROR: parse_uri: bad char '%c' in state %d"
910 910
 			" parsed: <%.*s> (%d) / <%.*s> (%d)\n",
911
-			*p, state, (p-buf), buf, (p-buf), len, buf, len);
911
+			*p, state, (int)(p-buf), buf, (int)(p-buf), len, buf, len);
912 912
 	return E_BAD_URI;
913 913
 error_bad_host:
914 914
 	LOG(L_ERR, "ERROR: parse_uri: bad host in uri (error at char %c in"
915 915
 			" state %d) parsed: <%.*s>(%d) /<%.*s> (%d)\n",
916
-			*p, state, (p-buf), buf, (p-buf), len, buf, len);
916
+			*p, state, (int)(p-buf), buf, (int)(p-buf), len, buf, len);
917 917
 	ser_error=E_BAD_URI;
918 918
 	return E_BAD_URI;
919 919
 error_bad_port:
920 920
 	LOG(L_ERR, "ERROR: parse_uri: bad port in uri (error at char %c in"
921 921
 			" state %d) parsed: <%.*s>(%d) /<%.*s> (%d)\n",
922
-			*p, state, (p-buf), buf, (p-buf), len, buf, len);
922
+			*p, state, (int)(p-buf), buf, (int)(p-buf), len, buf, len);
923 923
 	ser_error=E_BAD_URI;
924 924
 	return E_BAD_URI;
925 925
 error_bad_uri:
926 926
 	LOG(L_ERR, "ERROR: parse_uri: bad uri,  state %d"
927 927
 			" parsed: <%.*s> (%d) / <%.*s> (%d)\n",
928
-			 state, (p-buf), buf, (p-buf), len, buf, len);
928
+			 state, (int)(p-buf), buf, (int)(p-buf), len, buf, len);
929 929
 	ser_error=E_BAD_URI;
930 930
 	return E_BAD_URI;
931 931
 error_headers:
... ...
@@ -938,7 +938,7 @@ error_headers:
938 938
 error_bug:
939 939
 	LOG(L_CRIT, "BUG: parse_uri: bad  state %d"
940 940
 			" parsed: <%.*s> (%d) / <%.*s> (%d)\n",
941
-			 state, (p-buf), buf, (p-buf), len, buf, len);
941
+			 state, (int)(p-buf), buf, (int)(p-buf), len, buf, len);
942 942
 	ser_error=E_BAD_URI;
943 943
 	return E_BAD_URI;
944 944
 }
... ...
@@ -54,6 +54,8 @@
54 54
 #include <sys/types.h>
55 55
 #include <sys/select.h>
56 56
 #include <sys/socket.h>
57
+#include <netinet/in.h>
58
+#include <netinet/in_systm.h>
57 59
 #include <netinet/ip.h>
58 60
 #include <netinet/tcp.h>
59 61
 #include <sys/uio.h>  /* writev*/
... ...
@@ -38,6 +38,7 @@
38 38
 #include <sys/types.h>
39 39
 #include <sys/socket.h>
40 40
 #include <netinet/in.h>
41
+#include <netinet/in_systm.h>
41 42
 #include <netinet/ip.h>
42 43
 #include <errno.h>
43 44
 #include <arpa/inet.h>