From 3e4f5bdfdb0837c03338bb37c1d02e57a3d402f8 Mon Sep 17 00:00:00 2001
From: Leorize <alaviss@users.noreply.github.com>
Date: Thu, 14 Dec 2017 14:19:01 +0700
Subject: Add Haiku support

Disable pkg-config if flags has been provided

sha2: include endian.h

diff --git a/Makefile b/Makefile
index 3b188ac..1d13ece 100644
--- a/Makefile
+++ b/Makefile
@@ -148,17 +148,22 @@ $S: $(libbsd_INCLUDE)/bsd/bsd.h
 
 else
 
+LIBBSD_DEPS    :=
+ifdef LIBBSD_CFLAGS
+
+else
+
 LIBBSD_PKG_VERSION := 0.7
 LIBBSD_PKG_CHECK   := $(shell pkg-config libbsd --atleast-version=$(LIBBSD_PKG_VERSION) && echo ok)
 ifneq ($(strip $(LIBBSD_PKG_CHECK)),ok)
   $(error libbsd is not installed or version is older than $(LIBBSD_PKG_VERSION))
 endif
-LIBBSD_DEPS    :=
 LIBBSD_CFLAGS  := $(shell pkg-config libbsd --cflags)
 LIBBSD_LDFLAGS := $(shell pkg-config libbsd --libs)
 
 endif
 
+endif
 
 # In order to use libwaive, we need libseccomp and making sure that the
 # Git submodule corresponding to libwaive is properly checked out.
diff --git a/sha2.c b/sha2.c
index 7bf187f..c284114 100644
--- a/sha2.c
+++ b/sha2.c
@@ -35,6 +35,7 @@
  */
 
 #include <sys/types.h>
+#include <endian.h>
 
 #include <bsd/string.h>
 #include "sha2.h"
-- 
2.15.0

