Browse Source

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

Andrei Pelinescu-Onciul 23 years ago
parent
commit
381659ac58
9 changed files with 25 additions and 25 deletions
  1. 5 4
      Makefile.defs
  2. 5 4
      cfg.y
  3. 1 0
      ip_addr.c
  4. 2 6
      ip_addr.h
  5. 2 0
      mem/shm_mem.c
  6. 1 0
      msg_translator.c
  7. 8 8
      parser/parse_hname.c
  8. 0 2
      route_struct.c
  9. 1 1
      sr_module.c

+ 5 - 4
Makefile.defs

@@ -87,7 +87,7 @@ DEFS+= -DNAME='"$(NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
 	 -DSHM_MEM  -DSHM_MMAP \
 	 -DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=1024 \
 	 -DWAIT -DNEW_HNAME \
-	 -DUSE_IPV6 \
+	  -DUSE_IPV6 \
 	 #-DVERY_NOISY_REPLIES\
 	 #-DSILENT_FR \
 	 #-DNO_DEBUG \
@@ -230,7 +230,7 @@ ifeq	($(ARCH), sparc64)
 ifeq		($(CC_NAME), gcc)
 				#common stuff
 				CFLAGS=-O9 -funroll-loops  -Wcast-align $(PROFILE) -Winline\
-					#-Wmissing-prototypes \
+					-Wall #-Wmissing-prototypes \
 				#if gcc 3.0
 ifeq			($(CC_SHORTVER), 3.0)
 					#use 32bit for now
@@ -318,7 +318,7 @@ endif
 	# -andrei
 else	#mode,release
 ifeq	($(CC_NAME), gcc)
-		CFLAGS=-g -Wcast-align -Winline $(PROFILE)
+		CFLAGS=-g -Wcast-align -Winline $(PROFILE) -Wall
 		LDFLAGS+=-g -Wl,-E $(PROFILE)
 endif
 ifeq	($(CC_NAME), icc)
@@ -375,7 +375,8 @@ ifeq  ($(OS), SunOS)
 ifeq ($(CC_NAME), suncc)
 	LIBS=-lfast
 endif
-	LIBS+=-ldl -L/usr/local/lib -L/usr/lib/mysql -lfl -lxnet -lrt
+	LIBS+=-ldl -L/usr/local/lib -L/usr/lib/mysql -lfl -lresolv -lnsl \
+		-lsocket -lrt
 	# -lrt needed for sched_yield
 endif
 

+ 5 - 4
cfg.y

@@ -322,13 +322,14 @@ ipv6:	IPV6ADDR {
 						memset($$, 0, sizeof(struct ip_addr));
 						$$->af=AF_INET6;
 						$$->len=16;
-					#ifndef USE_IPV6
-						yyerror("ipv6 address & no ipv6 support compiled in");
-						YYABORT;
-					#endif
+					#ifdef USE_IPV6
 						if (inet_pton(AF_INET6, $1, $$->u.addr)<=0){
 							yyerror("bad ipv6 address");
 						}
+					#else
+						yyerror("ipv6 address & no ipv6 support compiled in");
+						YYABORT;
+					#endif
 					}
 				}
 	;

+ 1 - 0
ip_addr.c

@@ -5,6 +5,7 @@
  * ip address & address family related functions
  */
 
+#include <stdlib.h>
 #include <stdio.h>
 
 #include "ip_addr.h"

+ 2 - 6
ip_addr.h

@@ -7,16 +7,12 @@
 #define ip_addr_h
 
 #include <string.h>
+#include <sys/types.h>
+#include <sys/socket.h>
 #include <netinet/in.h>
 #include <netdb.h>
 #include "str.h"
 
-#ifdef USE_IPV6
-	#ifdef FreeBSD			/* freebsd is brain damaged and needs a different
-							   include */
-#include <netinet6/in6.h>
-	#endif
-#endif
 
 #include "dprint.h"
 

+ 2 - 0
mem/shm_mem.c

@@ -30,6 +30,7 @@
 #if defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)
 	/* union semun is defined by including <sys/sem.h> */
 #else
+#ifndef __FreeBSD__
 	/* according to X/OPEN we have to define it ourselves */
 	union semun {
 		int val;                    /* value for SETVAL */
@@ -38,6 +39,7 @@
 		struct seminfo *__buf;      /* buffer for IPC_INFO */
 	};
 #endif
+#endif
 
 
 

+ 1 - 0
msg_translator.c

@@ -3,6 +3,7 @@
  */
 
 
+#include <sys/types.h>
 #include <sys/socket.h>
 #include <netdb.h>
 #include <string.h>

+ 8 - 8
parser/parse_hname.c

@@ -25,14 +25,14 @@ enum { INITIAL=0,
 		TO1,
 		C_START, CSEQ2, CSEQ3,
 		         CALLID2, CALLID3, CALLID4, CALLID5, CALLID6,
-		         CONTACT2, CONTACT3, CONTACT4, CONTACT5, CONTACT6,
-		M_START,      MAXFORWARDS2, MAXFORWARDS3, MAXFORWARDS4, MAXFORWARDS5,
+		         CONTACT2, CONTACT3, CONTACT4, CONTACT5, CONTACT6, 
+ 		M_FOUND,      MAXFORWARDS2, MAXFORWARDS3, MAXFORWARDS4, MAXFORWARDS5,
 		MAXFORWARDS6, MAXFORWARDS7, MAXFORWARDS8, MAXFORWARDS9, MAXFORWARDS10,
 		MAXFORWARDS11,
 		ROUTE1, ROUTE2, ROUTE3, ROUTE4,
                 RECROUTE1, RECROUTE2, RECROUTE3, RECROUTE4, RECROUTE5, 
                 RECROUTE6, RECROUTE7, RECROUTE8, RECROUTE9, RECROUTE10,
-       
+
 		/* final states*/
 		F_VIA=1000, F_FROM, F_TO, F_CSEQ, F_CALLID, F_CONTACT, F_MAXFORWARDS,
                 F_ROUTE, F_RECROUTE,
@@ -40,7 +40,7 @@ enum { INITIAL=0,
 
 		UNKNOWN_HEADER=200,
 		BODY=220,
-		LF=25000,
+		LF=25000
 	};
 
 
@@ -103,7 +103,7 @@ char* parse_hname1(char* p, char* end, struct hdr_field* hdr)
 						case CONTACT4:
 								state=CONTACT5;
 								break;
-						case M_START:
+						case M_FOUND:
 								state=MAXFORWARDS2;
 								break;
 						case MAXFORWARDS8:
@@ -192,7 +192,7 @@ char* parse_hname1(char* p, char* end, struct hdr_field* hdr)
 			case 'm':
 						switch(state){
 							case INITIAL:
-								state=M_START;
+								state=M_FOUND;
 								hdr->name.s=t;
 								break;
 							case FROM3:
@@ -454,7 +454,7 @@ char* parse_hname1(char* p, char* end, struct hdr_field* hdr)
 								/*compact form i: (Call-ID)*/
 								state=F_CALLID;
 								break;
-							case M_START:
+							case M_FOUND:
 								/*compact form m: (Contact)*/
 								state=F_CONTACT;
 								break;
@@ -495,7 +495,7 @@ char* parse_hname1(char* p, char* end, struct hdr_field* hdr)
 								hdr->type=HDR_CALLID;
 								goto skip;
 							case F_CONTACT:
-							case M_START: /*compact form*/
+							case M_FOUND: /*compact form*/
 								*t=0;
 								hdr->name.len=t-hdr->name.s;
 								hdr->type=HDR_CONTACT;

+ 0 - 2
route_struct.c

@@ -9,8 +9,6 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <sys/types.h>
-#include <netinet/in.h>
 #include <string.h>
 
 #include "dprint.h"

+ 1 - 1
sr_module.c

@@ -141,7 +141,7 @@ int load_module(char* path)
 	}
 	/* launch register */
 	exp = (struct module_exports*)dlsym(handle, "exports");
-	if ( (error =dlerror())!=0 ){
+	if ( (error =(char*)dlerror())!=0 ){
 		LOG(L_ERR, "ERROR: load_module: %s\n", error);
 		goto error1;
 	}