diff --git a/linux/toku_htonl.h b/linux/toku_htonl.h index 5293beecc040a3fc881ca70c060c210779ff4e11..d76723ee0e2e9a51eda197b26fa981806159f1ef 100644 --- a/linux/toku_htonl.h +++ b/linux/toku_htonl.h @@ -1,7 +1,7 @@ #ifndef _TOKU_HTONL_H #define _TOKU_HTONL_H -#if !__linux__ +#if !__linux__ && !__FreeBSD__ #error #endif diff --git a/newbrt/includes.h b/newbrt/includes.h index 3afa8a70e50ab85615a29d34b7b8ac219fc12f12..519ad91acfb605a6eafc14a9cf216bdda0784a25 100644 --- a/newbrt/includes.h +++ b/newbrt/includes.h @@ -5,12 +5,6 @@ #ident "Copyright (c) 2007, 2008, 2009 Tokutek Inc. All rights reserved." #ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it." - -#ifndef _XOPEN_SOURCE -#define _XOPEN_SOURCE 500 -#endif -#define _FILE_OFFSET_BITS 64 - // Portability first! #include "stdint.h" #include <toku_portability.h> diff --git a/toku_include/Makefile.include b/toku_include/Makefile.include index 582ddc4caccb72c1374f534ac8f1050e57cc4284..aa62a38b5ba9f35e6b16aed2709d8ef4a968732c 100644 --- a/toku_include/Makefile.include +++ b/toku_include/Makefile.include @@ -64,6 +64,8 @@ endif OPT_OPTFLAGS = -O3 -finline-functions DBG_OPTFLAGS = -O0 +SYSTEM = $(shell uname -s | tr [A-Z] [a-z]) + ifeq ($(VERBOSE),2) VERBVERBOSE=-v MAYBEATSIGN= @@ -76,13 +78,21 @@ else ifeq ($(VERBOSE),1) endif CPPFLAGS = $(INCLUDEDIRS) -I$(PORTABILITY_HEADERS) -I$(TOKUROOT)toku_include +ifeq ($(SYSTEM),freebsd) +CPPFLAGS += -DTOKU_ALLOW_DEPRECATED +endif + # TODO: 1398 Get rid of this hack. CPPFLAGS+=-DBRT_LEVEL_STRADDLE_CALLBACK_LOGIC_NOT_READY=1 #CFLAG default options # Add -Wconversion #DISABLED for now. +ifeq ($(SYSTEM),freebsd) +WERROR = +else WERROR = -Werror +endif WALL = -Wall -Wextra -Wcast-align -Wbad-function-cast -Wno-missing-noreturn FORMAT = -Wmissing-format-attribute @@ -96,7 +106,7 @@ COMBINE_C = -combine -c LIBPORTABILITY = $(TOKUROOT)lib/libtokuportability.$(AEXT) LIBPORTABILITY_BUNDLE = $(TOKUROOT)lib/libtokuportability.bundle -PORTABILITY_HEADERS= $(TOKUROOT)linux +PORTABILITY_HEADERS= $(TOKUROOT)$(SYSTEM) ALWAYS_LINK= $(LIBPORTABILITY) -lz -lpthread ifeq ($(CC),icc) ifeq ($(CYGWIN),) @@ -145,14 +155,14 @@ DEPEND_LINK += \ ifeq ($(CYGWIN),) - OS_CHOICE=linux + OS_CHOICE=$(SYSTEM) OS_NOTCHOICE=windows else ifneq ($(CC),icc) - OS_CHOICE=linux + OS_CHOICE=$(SYSTEM) OS_NOTCHOICE=windows else OS_CHOICE=windows - OS_NOTCHOICE=linux + OS_NOTCHOICE=$(SYSTEM) endif DEPEND_COMPILE += $(wildcard $(TOKUROOT)$(OS_CHOICE)/*.h) @@ -289,7 +299,9 @@ LDFLAGS += -$(CRUNTIME) CFLAGS += -$(CRUNTIME) endif # Need XOPEN_SOURCE=600 to get strtoll() +ifeq ($(SYSTEM),linux) CPPFLAGS+=-D_SVID_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_XOPEN_SOURCE=600 +endif #TODO: Fix this up if we want to keep using CIL. #ifeq ($(CIL),1) @@ -345,11 +357,11 @@ clean-default: ifeq ($(SKIP_LIBPORTABILITYRULE),) ifeq ($(CYGWIN),) -$(LIBPORTABILITY): $(TOKUROOT)linux/*.[ch] - pwd && cd $(TOKUROOT)linux && $(MAKE) install +$(LIBPORTABILITY): $(TOKUROOT)$(SYSTEM)/*.[ch] + pwd && cd $(TOKUROOT)$(SYSTEM) && $(MAKE) install else ifneq ($(CC),icc) -$(LIBPORTABILITY): $(TOKUROOT)linux/*.[ch] - cd $(TOKUROOT)linux && $(MAKE) install +$(LIBPORTABILITY): $(TOKUROOT)$(SYSTEM)/*.[ch] + cd $(TOKUROOT)$(SYSTEM) && $(MAKE) install else $(LIBPORTABILITY): $(TOKUROOT)windows/*.[ch] cd $(TOKUROOT)windows && $(MAKE) install diff --git a/toku_include/toku_portability.h b/toku_include/toku_portability.h index e39b52ba39e633ea5604f9065b3363c7099174d5..b9b379efb1d12d39ac445ca02dab7dafd5a62bf8 100644 --- a/toku_include/toku_portability.h +++ b/toku_include/toku_portability.h @@ -64,6 +64,7 @@ typedef int64_t toku_off_t; #include <unistd.h> #include <sys/types.h> #include <sys/time.h> +#include <sys/stat.h> #else