Support for OSX build; tested using OSX 10.9/clang-500.2.79

This commit is contained in:
Roderick Sheeter
2013-12-12 10:43:05 -08:00
parent e70949119a
commit 2e5995bd96
5 changed files with 17 additions and 21 deletions
+1
View File
@@ -20,6 +20,7 @@
#include <algorithm>
#include <limits>
#include <vector>
#include <cstdlib>
#include "./histogram.h"
+1
View File
@@ -23,6 +23,7 @@
#include <string.h>
#include <sys/types.h>
#include <algorithm>
#include <cstdlib>
#include "./fast_log.h"
#include "./find_match_length.h"
+5 -1
View File
@@ -18,7 +18,11 @@
#define BROTLI_ENC_WRITE_BITS_H_
#include <assert.h>
#include <endian.h>
#if defined(OS_MACOSX)
#include <machine/endian.h>
#else
#include <endian.h>
#endif
#include <stdint.h>
#include <stdio.h>
+8 -1
View File
@@ -1,10 +1,17 @@
OS := $(shell uname)
IDIRS=-I../brotli/dec/ -I../brotli/enc/ -I../
GFLAGS=-no-canonical-prefixes -fno-omit-frame-pointer -fno-tree-vrp -m64
GFLAGS=-no-canonical-prefixes -fno-omit-frame-pointer -m64
CPP = g++
LFLAGS =
CPPFLAGS = -c $(IDIRS) -std=c++0x $(GFLAGS)
ifeq ($(OS), Darwin)
CPPFLAGS += -DOS_MACOSX
else
CPPFLAGS += -fno-tree-vrp
endif
%.o : %.c
$(CPP) $(CPPFLAGS) $< -o $@
+2 -19
View File
@@ -18,31 +18,14 @@
#ifndef BROTLI_WOFF2_OTS_H_
#define BROTLI_WOFF2_OTS_H_
#include <stdint.h>
#include <arpa/inet.h>
#include <cstdlib>
#include <cstring>
#include <limits>
namespace ots {
#if defined(_WIN32)
#include <stdlib.h>
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef short int16_t;
typedef unsigned short uint16_t;
typedef int int32_t;
typedef unsigned int uint32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#define ntohl(x) _byteswap_ulong (x)
#define ntohs(x) _byteswap_ushort (x)
#define htonl(x) _byteswap_ulong (x)
#define htons(x) _byteswap_ushort (x)
#else
#include <arpa/inet.h>
#include <stdint.h>
#endif
#if defined(_MSC_VER) || !defined(OTS_DEBUG)
#define OTS_FAILURE() false
#else