#include <memory> // for std::auto_ptr
#include <string>
#include <vector>
+#include <ctime> // for time_t
+
#include <simgear/structure/SGReferenced.hxx>
#include <simgear/structure/SGSharedPtr.hxx>
//#include <stdint.h>
//#include <string.h>
+#if defined(__FreeBSD__) || defined(__APPLE__)
+# include <machine/endian.h>
+#elif !defined(_WIN32)
+# include <endian.h>
+#endif
#ifdef __BIG_ENDIAN__
# define SHA_BIG_ENDIAN
-#elif defined __LITTLE_ENDIAN__
-/* override */
#elif defined __BYTE_ORDER
# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
# define SHA_BIG_ENDIAN
# endif
-#elif defined _WIN32
-/* assume little-endian, there is no endian.h on MSVC */
-#else // ! defined __LITTLE_ENDIAN__
-# include <endian.h> // machine/endian.h
-# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
-# define SHA_BIG_ENDIAN
+#elif defined BYTE_ORDER
+# if BYTE_ORDER == BIG_ENDIAN
+# define SHA_BIG_ENDIAN
# endif
#endif
-
/* code */
#define SHA1_K0 0x5a827999
#define SHA1_K20 0x6ed9eba1
retcode = strerror_s(buf, sizeof(buf), errnum);
#elif defined(_GNU_SOURCE)
return std::string(strerror_r(errnum, buf, sizeof(buf)));
-#elif (_POSIX_C_SOURCE >= 200112L) || defined(SG_MAC)
+#elif (_POSIX_C_SOURCE >= 200112L) || defined(SG_MAC) || defined(__FreeBSD__)
int retcode;
// POSIX.1-2001 and POSIX.1-2008
retcode = strerror_r(errnum, buf, sizeof(buf));