Skip to content

Commit

Permalink
Fixes for building on NetBSD.
Browse files Browse the repository at this point in the history
Closes #258.

Thanks to Daniel Ölschlegel.
  • Loading branch information
ralight committed Aug 9, 2018
1 parent c757cb0 commit 10b19a4
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 13 deletions.
3 changes: 3 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ Library:
- Fix connection problems when mosquitto_loop_start() was called before
mosquitto_connect_async(). Closes #848.

Build:
- Fixes for building on NetBSD. Closes #258.


1.5 - 20180502
==============
Expand Down
4 changes: 4 additions & 0 deletions config.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,8 @@
# define _POSIX_C_SOURCE 200809L
#endif

#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__SYMBIAN32__) || defined(__QNX__)
# define HAVE_NETINET_IN_H
#endif

#endif
4 changes: 2 additions & 2 deletions config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ LIB_LDFLAGS:=${LDFLAGS}
BROKER_CFLAGS:=${LIB_CFLAGS} ${CPPFLAGS} -DVERSION="\"${VERSION}\"" -DWITH_BROKER
CLIENT_CFLAGS:=${CFLAGS} ${CPPFLAGS} -I../lib -DVERSION="\"${VERSION}\""

ifneq ($(or $(findstring $(UNAME),FreeBSD), $(findstring $(UNAME),OpenBSD)),)
ifneq ($(or $(findstring $(UNAME),FreeBSD), $(findstring $(UNAME),OpenBSD), $(findstring $(UNAME),NetBSD)),)
BROKER_LIBS:=-lm
else
BROKER_LIBS:=-ldl -lm
Expand Down Expand Up @@ -277,7 +277,7 @@ localedir=${prefix}/share/locale
STRIP?=strip

ifeq ($(WITH_STRIP),yes)
STRIP_OPTS:=-s --strip-program=${CROSS_COMPILE}${STRIP}
STRIP_OPTS?=-s --strip-program=${CROSS_COMPILE}${STRIP}
endif

ifeq ($(WITH_EPOLL),yes)
Expand Down
2 changes: 1 addition & 1 deletion lib/memory_mosq.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ and the Eclipse Distribution License is available at
#include <stdio.h>
#include <sys/types.h>

#if defined(WITH_MEMORY_TRACKING) && defined(WITH_BROKER) && !defined(WIN32) && !defined(__SYMBIAN32__) && !defined(__ANDROID__) && !defined(__UCLIBC__) && !defined(__OpenBSD__)
#if defined(WITH_MEMORY_TRACKING) && defined(WITH_BROKER) && defined(__GLIBC__)
#define REAL_WITH_MEMORY_TRACKING
#endif

Expand Down
7 changes: 1 addition & 6 deletions lib/net_mosq.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,12 @@ and the Eclipse Distribution License is available at
#include <sys/endian.h>
#endif

#ifdef __FreeBSD__
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif

#ifdef __SYMBIAN32__
#include <netinet/in.h>
#endif

#ifdef __QNX__
#include <net/netbyte.h>
#include <netinet/in.h>
#endif

#ifdef WITH_TLS
Expand Down
5 changes: 1 addition & 4 deletions src/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,12 @@ and the Eclipse Distribution License is available at
#include <tcpd.h>
#endif

#ifdef __FreeBSD__
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
# include <sys/socket.h>
#endif

#ifdef __QNX__
#include <netinet/in.h>
#include <net/netbyte.h>
#include <sys/socket.h>
#endif

#include "mosquitto_broker_internal.h"
Expand Down

0 comments on commit 10b19a4

Please sign in to comment.