Make buildable on BSD-systems other than Apple. Mostly this
simply replaces #ifdef __APPLE__ with #ifdef BSD, but not
only...

	-mi

+++ src/io/DecoderPlatform.hh
@@ -26,7 +26,7 @@
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
-#if defined (__linux) || defined (__APPLE__)
+#if defined (__linux) || defined (BSD)
 #define SIRIKATA_FUNCTION_EXPORT __attribute__ ((visibility("default")))
 #define SIRIKATA_EXPORT __attribute__ ((visibility("default")))
 #define SIRIKATA_PLUGIN_EXPORT __attribute__ ((visibility("default")))
+++ src/io/MemMgrAllocator.cc
@@ -41,7 +41,7 @@
 #include <cstdint>
 #include "DecoderPlatform.hh"
 #include "MemMgrAllocator.hh"
-#if (defined(__APPLE__) || __cplusplus <= 199711L) && !defined(_WIN32)
+#if (defined(BSD) || __cplusplus <= 199711L) && !defined(_WIN32)
 #define THREAD_LOCAL_STORAGE __thread
 #else
 #include <atomic>
@@ -151,7 +151,7 @@ void setup_memmgr(MemMgrState& memmgr, u
 }
 void memmgr_init(size_t main_thread_pool_size, size_t worker_thread_pool_size, size_t num_workers, size_t x_min_pool_alloc_quantas, bool needs_huge_pages)
 {
-#ifdef __APPLE__
+#ifdef BSD
     // in apple, the thread_local storage winds up different when destroying the thread
     num_workers *= 2;
 #endif
+++ src/lepton/fork_serve.cc
@@ -10,7 +10,7 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include <algorithm>
-#ifndef __APPLE__
+#ifndef BSD
 #include <wait.h>
 #else
 #include <sys/wait.h>
+++ src/lepton/socket_serve.cc
@@ -11,7 +11,7 @@
 #include <algorithm>
 #include <netinet/in.h>
 #include <sys/time.h>
-#ifndef __APPLE__
+#ifndef BSD
 #include <sys/signalfd.h>
 #include <wait.h>
 #else
@@ -127,7 +127,7 @@ int should_wait_bitmask(size_t children_
 
 int make_sigchld_fd() {
     int fd = -1;
-#ifndef __APPLE__
+#ifndef BSD
     sigset_t sigset;
     int err = sigemptyset(&sigset);
     always_assert(err == 0);
@@ -233,7 +233,7 @@ void serving_loop(int unix_domain_socket
             if (fds[i].revents & POLLIN) {
                 fds[i].revents = 0;
                 if (fds[i].fd == sigchild_fd) {
-#ifndef __APPLE__
+#ifndef BSD
                     struct signalfd_siginfo info;
                     ssize_t ignore = read(fds[i].fd, &info, sizeof(info));
                     (void)ignore;
+++ src/vp8/model/jpeg_meta.hh
@@ -3,7 +3,7 @@
 
 #include <vector>
 #include <type_traits>
-#ifndef __APPLE__
+#ifndef BSD
 #ifndef _WIN32
 #include <endian.h>
 #endif
+++ src/vp8/util/memory.cc
@@ -13,7 +13,7 @@
 #ifdef _WIN32
 #define USE_STANDARD_MEMORY_ALLOCATORS
 #endif
-#if defined(__APPLE__) || (__cplusplus <= 199711L && !defined(_WIN32))
+#if defined(BSD) || (__cplusplus <= 199711L && !defined(_WIN32))
 #define THREAD_LOCAL_STORAGE __thread
 #else
 #define THREAD_LOCAL_STORAGE thread_local
+++ src/vp8/util/vpx_config.hh
@@ -44,6 +44,6 @@
 #ifndef _BSD_SOURCE
 #define _BSD_SOURCE       /* See feature_test_macros(7) */
 #endif
-#include <endian.h>
+#include <sys/endian.h>
 #endif
 #endif
+++ test_suite/timing_driver.cc
@@ -6,11 +6,13 @@
 #include <unistd.h>
 #include <assert.h>
 #include <errno.h>
+#include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <fcntl.h>
 #include <sys/select.h>
+#include <sys/signal.h>
 #include <sys/time.h>
 #include "smalljpg.hh"
 
+++ src/lepton/jpgcoder.cc
@@ -77,11 +77,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
 int g_argc = 0;
 const char** g_argv = NULL;
 #ifndef GIT_REVISION
-#include "version.hh"
-#ifndef GIT_REVISION
 #define GIT_REVISION "unknown"
 #endif
-#endif
 bool fast_exit = true;
 #ifdef SKIP_VALIDATION
 bool g_skip_validation = true;
+++ src/io/ioutil.cc
@@ -325,13 +325,13 @@
     int input_tee_flags = 0;
     int copy_to_storage_flags = 0;
-#ifndef __APPLE__
+#ifndef BSD
     input_tee_flags = fcntl(input_tee, F_GETFL, 0);
 #endif
     fcntl(input_tee, F_SETFL, input_tee_flags | O_NONBLOCK);
-#ifndef __APPLE__
+#ifndef BSD
     copy_to_input_tee_flags = fcntl(copy_to_input_tee, F_GETFL, 0);
 #endif
     fcntl(copy_to_input_tee, F_SETFL, copy_to_input_tee_flags | O_NONBLOCK);
-#ifndef __APPLE__
+#ifndef BSD
     copy_to_storage_flags = fcntl(copy_to_storage, F_GETFL, 0);
 #endif
