Browse code

- compile fixes for freebsd & sun (won't compile on sun w/ ipv6)

Andrei Pelinescu-Onciul authored on 28/05/2002 19:01:38
Showing 9 changed files
... ...
@@ -87,7 +87,7 @@ DEFS+= -DNAME='"$(NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
87 87
 	 -DSHM_MEM  -DSHM_MMAP \
88 88
 	 -DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=1024 \
89 89
 	 -DWAIT -DNEW_HNAME \
90
-	 -DUSE_IPV6 \
90
+	  -DUSE_IPV6 \
91 91
 	 #-DVERY_NOISY_REPLIES\
92 92
 	 #-DSILENT_FR \
93 93
 	 #-DNO_DEBUG \
... ...
@@ -230,7 +230,7 @@ ifeq	($(ARCH), sparc64)
230 230
 ifeq		($(CC_NAME), gcc)
231 231
 				#common stuff
232 232
 				CFLAGS=-O9 -funroll-loops  -Wcast-align $(PROFILE) -Winline\
233
-					#-Wmissing-prototypes \
233
+					-Wall #-Wmissing-prototypes \
234 234
 				#if gcc 3.0
235 235
 ifeq			($(CC_SHORTVER), 3.0)
236 236
 					#use 32bit for now
... ...
@@ -318,7 +318,7 @@ endif
318 318
 	# -andrei
319 319
 else	#mode,release
320 320
 ifeq	($(CC_NAME), gcc)
321
-		CFLAGS=-g -Wcast-align -Winline $(PROFILE)
321
+		CFLAGS=-g -Wcast-align -Winline $(PROFILE) -Wall
322 322
 		LDFLAGS+=-g -Wl,-E $(PROFILE)
323 323
 endif
324 324
 ifeq	($(CC_NAME), icc)
... ...
@@ -375,7 +375,8 @@ ifeq  ($(OS), SunOS)
375 375
 ifeq ($(CC_NAME), suncc)
376 376
 	LIBS=-lfast
377 377
 endif
378
-	LIBS+=-ldl -L/usr/local/lib -L/usr/lib/mysql -lfl -lxnet -lrt
378
+	LIBS+=-ldl -L/usr/local/lib -L/usr/lib/mysql -lfl -lresolv -lnsl \
379
+		-lsocket -lrt
379 380
 	# -lrt needed for sched_yield
380 381
 endif
381 382
 
... ...
@@ -322,13 +322,14 @@ ipv6:	IPV6ADDR {
322 322
 						memset($$, 0, sizeof(struct ip_addr));
323 323
 						$$->af=AF_INET6;
324 324
 						$$->len=16;
325
-					#ifndef USE_IPV6
326
-						yyerror("ipv6 address & no ipv6 support compiled in");
327
-						YYABORT;
328
-					#endif
325
+					#ifdef USE_IPV6
329 326
 						if (inet_pton(AF_INET6, $1, $$->u.addr)<=0){
330 327
 							yyerror("bad ipv6 address");
331 328
 						}
329
+					#else
330
+						yyerror("ipv6 address & no ipv6 support compiled in");
331
+						YYABORT;
332
+					#endif
332 333
 					}
333 334
 				}
334 335
 	;
... ...
@@ -5,6 +5,7 @@
5 5
  * ip address & address family related functions
6 6
  */
7 7
 
8
+#include <stdlib.h>
8 9
 #include <stdio.h>
9 10
 
10 11
 #include "ip_addr.h"
... ...
@@ -7,16 +7,12 @@
7 7
 #define ip_addr_h
8 8
 
9 9
 #include <string.h>
10
+#include <sys/types.h>
11
+#include <sys/socket.h>
10 12
 #include <netinet/in.h>
11 13
 #include <netdb.h>
12 14
 #include "str.h"
13 15
 
14
-#ifdef USE_IPV6
15
-	#ifdef FreeBSD			/* freebsd is brain damaged and needs a different
16
-							   include */
17
-#include <netinet6/in6.h>
18
-	#endif
19
-#endif
20 16
 
21 17
 #include "dprint.h"
22 18
 
... ...
@@ -30,6 +30,7 @@
30 30
 #if defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)
31 31
 	/* union semun is defined by including <sys/sem.h> */
32 32
 #else
33
+#ifndef __FreeBSD__
33 34
 	/* according to X/OPEN we have to define it ourselves */
34 35
 	union semun {
35 36
 		int val;                    /* value for SETVAL */
... ...
@@ -38,6 +39,7 @@
38 38
 		struct seminfo *__buf;      /* buffer for IPC_INFO */
39 39
 	};
40 40
 #endif
41
+#endif
41 42
 
42 43
 
43 44
 
... ...
@@ -3,6 +3,7 @@
3 3
  */
4 4
 
5 5
 
6
+#include <sys/types.h>
6 7
 #include <sys/socket.h>
7 8
 #include <netdb.h>
8 9
 #include <string.h>
... ...
@@ -25,14 +25,14 @@ enum { INITIAL=0,
25 25
 		TO1,
26 26
 		C_START, CSEQ2, CSEQ3,
27 27
 		         CALLID2, CALLID3, CALLID4, CALLID5, CALLID6,
28
-		         CONTACT2, CONTACT3, CONTACT4, CONTACT5, CONTACT6,
29
-		M_START,      MAXFORWARDS2, MAXFORWARDS3, MAXFORWARDS4, MAXFORWARDS5,
28
+		         CONTACT2, CONTACT3, CONTACT4, CONTACT5, CONTACT6, 
29
+ 		M_FOUND,      MAXFORWARDS2, MAXFORWARDS3, MAXFORWARDS4, MAXFORWARDS5,
30 30
 		MAXFORWARDS6, MAXFORWARDS7, MAXFORWARDS8, MAXFORWARDS9, MAXFORWARDS10,
31 31
 		MAXFORWARDS11,
32 32
 		ROUTE1, ROUTE2, ROUTE3, ROUTE4,
33 33
                 RECROUTE1, RECROUTE2, RECROUTE3, RECROUTE4, RECROUTE5, 
34 34
                 RECROUTE6, RECROUTE7, RECROUTE8, RECROUTE9, RECROUTE10,
35
-       
35
+
36 36
 		/* final states*/
37 37
 		F_VIA=1000, F_FROM, F_TO, F_CSEQ, F_CALLID, F_CONTACT, F_MAXFORWARDS,
38 38
                 F_ROUTE, F_RECROUTE,
... ...
@@ -40,7 +40,7 @@ enum { INITIAL=0,
40 40
 
41 41
 		UNKNOWN_HEADER=200,
42 42
 		BODY=220,
43
-		LF=25000,
43
+		LF=25000
44 44
 	};
45 45
 
46 46
 
... ...
@@ -103,7 +103,7 @@ char* parse_hname1(char* p, char* end, struct hdr_field* hdr)
103 103
 						case CONTACT4:
104 104
 								state=CONTACT5;
105 105
 								break;
106
-						case M_START:
106
+						case M_FOUND:
107 107
 								state=MAXFORWARDS2;
108 108
 								break;
109 109
 						case MAXFORWARDS8:
... ...
@@ -192,7 +192,7 @@ char* parse_hname1(char* p, char* end, struct hdr_field* hdr)
192 192
 			case 'm':
193 193
 						switch(state){
194 194
 							case INITIAL:
195
-								state=M_START;
195
+								state=M_FOUND;
196 196
 								hdr->name.s=t;
197 197
 								break;
198 198
 							case FROM3:
... ...
@@ -454,7 +454,7 @@ char* parse_hname1(char* p, char* end, struct hdr_field* hdr)
454 454
 								/*compact form i: (Call-ID)*/
455 455
 								state=F_CALLID;
456 456
 								break;
457
-							case M_START:
457
+							case M_FOUND:
458 458
 								/*compact form m: (Contact)*/
459 459
 								state=F_CONTACT;
460 460
 								break;
... ...
@@ -495,7 +495,7 @@ char* parse_hname1(char* p, char* end, struct hdr_field* hdr)
495 495
 								hdr->type=HDR_CALLID;
496 496
 								goto skip;
497 497
 							case F_CONTACT:
498
-							case M_START: /*compact form*/
498
+							case M_FOUND: /*compact form*/
499 499
 								*t=0;
500 500
 								hdr->name.len=t-hdr->name.s;
501 501
 								hdr->type=HDR_CONTACT;
... ...
@@ -9,8 +9,6 @@
9 9
 
10 10
 #include <stdio.h>
11 11
 #include <stdlib.h>
12
-#include <sys/types.h>
13
-#include <netinet/in.h>
14 12
 #include <string.h>
15 13
 
16 14
 #include "dprint.h"
... ...
@@ -141,7 +141,7 @@ int load_module(char* path)
141 141
 	}
142 142
 	/* launch register */
143 143
 	exp = (struct module_exports*)dlsym(handle, "exports");
144
-	if ( (error =dlerror())!=0 ){
144
+	if ( (error =(char*)dlerror())!=0 ){
145 145
 		LOG(L_ERR, "ERROR: load_module: %s\n", error);
146 146
 		goto error1;
147 147
 	}