Hi,
attached is a patch for Mac OS X. It fixes #include annoyances; some
possibly general.
With this patch, openbsc should compile on OS X (but will not link yet).
- OS X has no malloc.h (malloc is in stdlib.h - as per POSIX/OpenGroup)
- vty/buffer.h and vty/command.h need sys/types.h (looks harmless to me)
- mISDNif.h explicitly wants <linux/types.h> etc., but the declarations
in mISNif.h fairly generic. I have replaced <linux/types.h> with
<sys/types.h>, unless "linux" is defined (which is defined by gcc).
Regarding linking:
OS X has no -lcrypt, but the openbsc binaries link without -lcrypt. I'll
have to restore my autoconf knowledge from cryogenic storage and then
come up with another patch.
- Lars
Index: tests/db/db_test.c
===================================================================
--- tests/db/db_test.c (revision 452)
+++ tests/db/db_test.c (working copy)
@@ -22,7 +22,7 @@
#include <stdio.h>
#include <string.h>
-#include <malloc.h>
+#include <stdlib.h>
#define COMPARE(original, copy) \
if (original->id != copy->id) \
Index: include/mISDNif.h
===================================================================
--- include/mISDNif.h (revision 452)
+++ include/mISDNif.h (working copy)
@@ -19,9 +19,15 @@
#define mISDNIF_H
#include <stdarg.h>
-#include <linux/types.h>
-#include <linux/errno.h>
-#include <linux/socket.h>
+#ifdef linux
+#include <linux/types.h>
+#include <linux/errno.h>
+#include <linux/socket.h>
+#else
+#include <sys/types.h>
+#include <sys/errno.h>
+#include <sys/socket.h>
+#endif
/*
* ABI Version 32 bit
Index: include/vty/buffer.h
===================================================================
--- include/vty/buffer.h (revision 452)
+++ include/vty/buffer.h (working copy)
@@ -23,6 +23,8 @@
#ifndef _ZEBRA_BUFFER_H
#define _ZEBRA_BUFFER_H
+#include <sys/types.h>
+
/* Create a new buffer. Memory will be allocated in chunks of the given
size. If the argument is 0, the library will supply a reasonable
default size suitable for buffering socket I/O. */
Index: include/vty/command.h
===================================================================
--- include/vty/command.h (revision 452)
+++ include/vty/command.h (working copy)
@@ -24,6 +24,7 @@
#define _ZEBRA_COMMAND_H
#include <stdio.h>
+#include <sys/types.h>
#include "vector.h"
#include "vty.h"
Index: include/openbsc/paging.h
===================================================================
--- include/openbsc/paging.h (revision 452)
+++ include/openbsc/paging.h (working copy)
@@ -21,7 +21,7 @@
#ifndef PAGING_H
#define PAGING_H
-#include <malloc.h>
+#include <stdlib.h>
#include <string.h>
#include "linuxlist.h"
Index: src/gsm_utils.c
===================================================================
--- src/gsm_utils.c (revision 452)
+++ src/gsm_utils.c (working copy)
@@ -22,7 +22,7 @@
*/
#include <openbsc/gsm_utils.h>
-#include <malloc.h>
+#include <stdlib.h>
#include <string.h>
/* GSM 03.38 6.2.1 Charachter packing */
Index: src/abis_nm.c
===================================================================
--- src/abis_nm.c (revision 452)
+++ src/abis_nm.c (working copy)
@@ -26,7 +26,7 @@
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
-#include <malloc.h>
+#include <stdlib.h>
#include <libgen.h>
#include <time.h>
#include <limits.h>
Index: src/telnet_interface.c
===================================================================
--- src/telnet_interface.c (revision 452)
+++ src/telnet_interface.c (working copy)
@@ -20,7 +20,7 @@
#include <sys/socket.h>
#include <netinet/in.h>
-#include <malloc.h>
+#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
Index: src/signal.c
===================================================================
--- src/signal.c (revision 452)
+++ src/signal.c (working copy)
@@ -19,7 +19,7 @@
*/
#include <openbsc/signal.h>
-#include <malloc.h>
+#include <stdlib.h>
#include <string.h>