[olsr-dev] MacOSX success

Michael Bauer (spam-protected)
Fri Nov 5 10:57:11 CET 2004


hi
after some build problems etc i succeded in building olsrd for mac os x 
it runs, it adds routes, thats all i was intrested in. You will need
libdl to compile as for example
http://star.mfn.unipmn.it/osxgnu/Libraries/dlcompat-10505X.pkg.sit
or 
http://download.sourceforge.net/fink/dlcompat-20021117.tar.gz

i will produce a binary and put it on the web somewhere.

here comes the patch to olsrd-current.

happy routing 
	mihi



-- 
think radical, act radical.
-------------- next part --------------
diff -ru olsrd-current/Makefile olsrd-current-osX/Makefile
--- olsrd-current/Makefile	Fri Nov  5 10:50:21 2004
+++ olsrd-current-osX/Makefile	Fri Nov  5 10:49:42 2004
@@ -25,6 +25,7 @@
 OS =		linux
 #OS =		fbsd
 #OS =		win32
+#OS = 		osx
 
 CC ?= 		gcc
 
@@ -92,6 +93,21 @@
 		-Wstrict-prototypes -mno-cygwin -O2 -g -DWIN32
 
 LIBS =		-mno-cygwin -lws2_32 -liphlpapi
+
+endif
+ifeq ($(OS), osx)
+
+SRCS +=		$(wildcard src/bsd/*.c) $(wildcard src/unix/*.c)
+
+HDRS +=		$(wildcard src/bsd/*.h) $(wildcard src/unix/*.h)
+
+OBJS +=		$(patsubst %.c,%.o,$(wildcard src/bsd/*.c)) \
+		$(patsubst %.c,%.o,$(wildcard src/unix/*.c))
+
+CFLAGS ?=	-D__MacOSX__ -Isrc -Wall -Wmissing-prototypes -Wstrict-prototypes \
+		-O2 -g 
+
+LIBS =		-lm -ldl
 
 endif
 
diff -ru olsrd-current/src/defs.h olsrd-current-osX/src/defs.h
--- olsrd-current/src/defs.h	Fri Nov  5 03:06:13 2004
+++ olsrd-current-osX/src/defs.h	Fri Nov  5 10:29:58 2004
@@ -27,6 +27,9 @@
 #define _OLSR_DEFS
 
 /* Common includes */
+#ifdef __MacOSX__
+#include "olsr_protocol.h"
+#endif
 #include <sys/time.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
@@ -38,7 +41,9 @@
 #include <time.h>
 
 #include "log.h"
+#ifndef __MacOSX__
 #include "olsr_protocol.h"
+#endif
 #include "process_routes.h" /* Needed for rt_entry */
 #include "net.h" /* IPaddr -> string conversions is used by everyone */
 #include "olsr.h" /* Everybody uses theese */
@@ -134,7 +139,10 @@
 
 /* routing socket */
 
-#ifdef __FreeBSD__
+#ifdef __FreeBSD__ 
+int rts;
+#endif
+#ifdef __MacOSX__
 int rts;
 #endif
 
diff -ru olsrd-current/src/ipc_frontend.c olsrd-current-osX/src/ipc_frontend.c
--- olsrd-current/src/ipc_frontend.c	Fri Nov  5 03:06:13 2004
+++ olsrd-current-osX/src/ipc_frontend.c	Fri Nov  5 09:55:32 2004
@@ -43,7 +43,7 @@
 #define MSG_NOSIGNAL 0
 void 
 WinSockPError(char *);
-#elif defined __FreeBSD__
+#elif defined __FreeBSD__ || __MacOSX__
 #define MSG_NOSIGNAL 0
 #endif
 
diff -ru olsrd-current/src/ipc_frontend.h olsrd-current-osX/src/ipc_frontend.h
--- olsrd-current/src/ipc_frontend.h	Fri Nov  5 03:06:13 2004
+++ olsrd-current-osX/src/ipc_frontend.h	Fri Nov  5 10:25:15 2004
@@ -33,6 +33,9 @@
 #ifndef _OLSR_IPC
 #define _OLSR_IPC
 
+#ifdef __MacOSX__
+#include "defs.h"
+#endif
 #include <sys/types.h>
 #include <netinet/in.h>
 #include <unistd.h>
@@ -40,8 +43,9 @@
 #include <pthread.h>
 #include <arpa/inet.h>
 #include <signal.h>
-
+#ifndef __MacOSX__
 #include "defs.h"
+#endif
 
 #define IPC_PORT 1212
 #define IPC_PACK_SIZE 44 /* Size of the IPC_ROUTE packet */
diff -ru olsrd-current/src/link_set.c olsrd-current-osX/src/link_set.c
--- olsrd-current/src/link_set.c	Fri Nov  5 03:06:13 2004
+++ olsrd-current-osX/src/link_set.c	Fri Nov  5 09:57:12 2004
@@ -394,7 +394,7 @@
 {
   struct link_entry *tmp_link_set, *new_link;
   struct neighbor_entry *neighbor;
-#if !defined WIN32 && !defined __FreeBSD__
+#if !defined WIN32 && !defined __FreeBSD__ && !defined __MacOSX__
   struct interface *local_if;
 #endif
 
@@ -512,7 +512,7 @@
     }
 
   /* Add to link-layer spy list */
-#if !defined WIN32 && !defined __FreeBSD__
+#if !defined WIN32 && !defined __FreeBSD__ && !defined __MacOSX__
   if(llinfo)
     {
       local_if = if_ifwithaddr(local);
@@ -603,7 +603,7 @@
 {
   int status;
   struct link_entry *entry;
-#if !defined WIN32 && !defined __FreeBSD__
+#if !defined WIN32 && !defined __FreeBSD__ && !defined __MacOSX__
   struct interface *local_if;
 #endif
 
@@ -615,7 +615,7 @@
 
   /* Update link layer info */
   /* Add to link-layer spy list */
-#if !defined WIN32 && !defined __FreeBSD__
+#if !defined WIN32 && !defined __FreeBSD__ && !defined __MacOSX__
   if(llinfo && !entry->spy_activated)
     {
       local_if = if_ifwithaddr(local);
diff -ru olsrd-current/src/main.c olsrd-current-osX/src/main.c
--- olsrd-current/src/main.c	Fri Nov  5 03:06:13 2004
+++ olsrd-current-osX/src/main.c	Fri Nov  5 10:35:17 2004
@@ -48,7 +48,7 @@
 #include "win32/tunnel.h"
 int __stdcall SignalHandler(unsigned long signal);
 void ListInterfaces(void);
-#elif defined __FreeBSD__
+#elif defined __FreeBSD__ || defined __MacOSX__
 static void
 olsr_shutdown(int);
 #else
@@ -488,7 +488,7 @@
       olsr_exit(__func__, 0);
     }
 
-#ifdef __FreeBSD__
+#if defined __FreeBSD__ || defined __MacOSX__
   if ((rts = socket(PF_ROUTE, SOCK_RAW, 0)) < 0)
     {
       olsr_syslog(OLSR_LOG_ERR, "routing socket: %m");
@@ -591,7 +591,7 @@
   if(olsr_cnf->open_ipc)
       ipc_init();
 
-#if !defined WIN32 && !defined __FreeBSD__
+#if !defined WIN32 && !defined __FreeBSD__ && !defined __MacOSX__
   /* Initialize link-layer notifications */
   if(llinfo)
     init_link_layer_notification();
@@ -603,7 +603,7 @@
   /* Load plugins */
   olsr_load_plugins();
 
-#ifndef __FreeBSD__
+#if !defined __FreeBSD__ && !defined __MacOSX__
   /* Set up recieving tunnel if Inet gw */
   if(use_tunnel && check_inet_gw())
     set_up_gw_tunnel(&main_addr);
@@ -702,7 +702,7 @@
   /* ioctl socket */
   close(ioctl_s);
 
-#ifdef __FreeBSD__
+#if defined __FreeBSD__ || defined __MacOSX__
   /* routing socket */
   close(rts);
 #endif
diff -ru olsrd-current/src/net.c olsrd-current-osX/src/net.c
--- olsrd-current/src/net.c	Fri Nov  5 03:06:13 2004
+++ olsrd-current-osX/src/net.c	Fri Nov  5 09:59:34 2004
@@ -410,7 +410,7 @@
   COPY_IP(&mcastreq.ipv6mr_multiaddr, &ifs->int6_multaddr.sin6_addr);
   mcastreq.ipv6mr_interface = ifs->if_index;
 
-#if !defined __FreeBSD__
+#if !defined __FreeBSD__ && !defined __MacOSX__
   olsr_printf(3, "Interface %s joining multicast %s...",	ifs->int_name, olsr_ip_to_string((union olsr_ip_addr *)&ifs->int6_multaddr.sin6_addr));
   /* Send multicast */
   if(setsockopt(sock, 
diff -ru olsrd-current/src/olsr_protocol.h olsrd-current-osX/src/olsr_protocol.h
--- olsrd-current/src/olsr_protocol.h	Fri Nov  5 09:23:29 2004
+++ olsrd-current-osX/src/olsr_protocol.h	Fri Nov  5 09:52:18 2004
@@ -77,6 +77,16 @@
 typedef short           olsr_16_t;
 typedef int             olsr_32_t;
  
+#elif defined __MacOSX__
+
+
+typedef u_int8_t        olsr_u8_t;
+typedef u_int16_t       olsr_u16_t;
+typedef u_int32_t       olsr_u32_t;
+typedef int8_t          olsr_8_t;
+typedef int16_t         olsr_16_t;
+typedef int32_t         olsr_32_t;
+
 #else
 #       error "Unsupported system"
 #endif
diff -ru olsrd-current/src/process_package.c olsrd-current-osX/src/process_package.c
--- olsrd-current/src/process_package.c	Fri Nov  5 03:06:14 2004
+++ olsrd-current-osX/src/process_package.c	Fri Nov  5 10:36:54 2004
@@ -405,7 +405,7 @@
 
   while(hna_tmp)
     {
-#ifndef __FreeBSD__
+#if !defined __FreeBSD__ && !defined __MacOSX__
       /*
        * Set up tunnel to Internet gateway
        */
diff -ru olsrd-current/src/process_routes.c olsrd-current-osX/src/process_routes.c
--- olsrd-current/src/process_routes.c	Fri Nov  5 03:06:14 2004
+++ olsrd-current-osX/src/process_routes.c	Fri Nov  5 10:34:23 2004
@@ -34,7 +34,8 @@
 #include "win32/tunnel.h"
 #undef strerror
 #define strerror(x) StrError(x)
-#elif defined __FreeBSD__
+#elif defined __FreeBSD__ 
+#elif defined __MacOSX__
 #else
 #       error "Unsupported system"
 #endif
@@ -155,13 +156,13 @@
   struct destination_n *delete_kernel_list=NULL;
   struct destination_n *tmp=NULL;
   union olsr_ip_addr *tmp_addr;
-#ifndef __FreeBSD__
+#if !defined __FreeBSD__ && !defined __MacOSX__
   olsr_u32_t tmp_tnl_addr;
 #endif
 
   olsr_printf(1, "Deleting all routes...\n");
 
-#ifndef __FreeBSD__
+#if !defined __FreeBSD__ && !defined __MacOSX__
   if(use_tunnel)
     {
       /* Delete Internet GW tunnel */
diff -ru olsrd-current/src/socket_parser.c olsrd-current-osX/src/socket_parser.c
--- olsrd-current/src/socket_parser.c	Wed Nov  3 10:22:59 2004
+++ olsrd-current-osX/src/socket_parser.c	Fri Nov  5 10:27:42 2004
@@ -23,10 +23,16 @@
  *
  */
 
+#ifndef __MacOSX__
 #include <unistd.h>
 #include "socket_parser.h"
+#endif
 #include "olsr.h"
 #include "defs.h"
+#ifdef __MacOSX__
+#include <unistd.h>
+#include "socket_parser.h"
+#endif
 
 #ifdef WIN32
 #undef EINTR
diff -ru olsrd-current/src/unix/ifnet.c olsrd-current-osX/src/unix/ifnet.c
--- olsrd-current/src/unix/ifnet.c	Fri Nov  5 03:06:14 2004
+++ olsrd-current-osX/src/unix/ifnet.c	Fri Nov  5 10:31:40 2004
@@ -39,7 +39,7 @@
 #define SIOCGIWMODE	0x8B07		/* get operation mode */
 #define SIOCSIWSENS	0x8B08		/* set sensitivity (dBm) */
 #define SIOCGIWSENS	0x8B09		/* get sensitivity (dBm) */
-#elif defined __FreeBSD__
+#elif defined __FreeBSD__ || defined __MacOSX__
 #define ifr_netmask ifr_addr
 #endif
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
URL: <http://lists.olsr.org/pipermail/olsr-dev/attachments/20041105/38993778/attachment.sig>


More information about the Olsr-dev mailing list