|
|
@ -22,6 +22,7 @@ |
|
|
|
# |
|
|
|
# -DLEVELDB_ATOMIC_PRESENT if <atomic> is present |
|
|
|
# -DLEVELDB_PLATFORM_POSIX=1 for Posix-based platforms |
|
|
|
# -DHAVE_CRC32C=1 if the CRC32C library is present |
|
|
|
# -DHAVE_SNAPPY=1 if the Snappy library is present |
|
|
|
# |
|
|
|
|
|
|
@ -63,7 +64,6 @@ PLATFORM_SHARED_EXT="so" |
|
|
|
PLATFORM_SHARED_LDFLAGS="-shared -Wl,-soname -Wl," |
|
|
|
PLATFORM_SHARED_CFLAGS="-fPIC -fvisibility=hidden" |
|
|
|
PLATFORM_SHARED_VERSIONED=true |
|
|
|
PLATFORM_SSEFLAGS= |
|
|
|
|
|
|
|
MEMCMP_FLAG= |
|
|
|
if [ "$CXX" = "g++" ]; then |
|
|
@ -78,7 +78,6 @@ case "$TARGET_OS" in |
|
|
|
COMMON_FLAGS="$MEMCMP_FLAG -lpthread -DOS_LINUX -DCYGWIN" |
|
|
|
PLATFORM_LDFLAGS="-lpthread" |
|
|
|
PORT_FILE=port/port_posix.cc |
|
|
|
PORT_SSE_FILE=port/port_posix_sse.cc |
|
|
|
;; |
|
|
|
Darwin) |
|
|
|
PLATFORM=OS_MACOSX |
|
|
@ -87,56 +86,48 @@ case "$TARGET_OS" in |
|
|
|
[ -z "$INSTALL_PATH" ] && INSTALL_PATH=`pwd` |
|
|
|
PLATFORM_SHARED_LDFLAGS="-dynamiclib -install_name $INSTALL_PATH/" |
|
|
|
PORT_FILE=port/port_posix.cc |
|
|
|
PORT_SSE_FILE=port/port_posix_sse.cc |
|
|
|
;; |
|
|
|
Linux) |
|
|
|
PLATFORM=OS_LINUX |
|
|
|
COMMON_FLAGS="$MEMCMP_FLAG -pthread -DOS_LINUX" |
|
|
|
PLATFORM_LDFLAGS="-pthread" |
|
|
|
PORT_FILE=port/port_posix.cc |
|
|
|
PORT_SSE_FILE=port/port_posix_sse.cc |
|
|
|
;; |
|
|
|
SunOS) |
|
|
|
PLATFORM=OS_SOLARIS |
|
|
|
COMMON_FLAGS="$MEMCMP_FLAG -D_REENTRANT -DOS_SOLARIS" |
|
|
|
PLATFORM_LIBS="-lpthread -lrt" |
|
|
|
PORT_FILE=port/port_posix.cc |
|
|
|
PORT_SSE_FILE=port/port_posix_sse.cc |
|
|
|
;; |
|
|
|
FreeBSD) |
|
|
|
PLATFORM=OS_FREEBSD |
|
|
|
COMMON_FLAGS="$MEMCMP_FLAG -D_REENTRANT -DOS_FREEBSD" |
|
|
|
PLATFORM_LIBS="-lpthread" |
|
|
|
PORT_FILE=port/port_posix.cc |
|
|
|
PORT_SSE_FILE=port/port_posix_sse.cc |
|
|
|
;; |
|
|
|
NetBSD) |
|
|
|
PLATFORM=OS_NETBSD |
|
|
|
COMMON_FLAGS="$MEMCMP_FLAG -D_REENTRANT -DOS_NETBSD" |
|
|
|
PLATFORM_LIBS="-lpthread -lgcc_s" |
|
|
|
PORT_FILE=port/port_posix.cc |
|
|
|
PORT_SSE_FILE=port/port_posix_sse.cc |
|
|
|
;; |
|
|
|
OpenBSD) |
|
|
|
PLATFORM=OS_OPENBSD |
|
|
|
COMMON_FLAGS="$MEMCMP_FLAG -D_REENTRANT -DOS_OPENBSD" |
|
|
|
PLATFORM_LDFLAGS="-pthread" |
|
|
|
PORT_FILE=port/port_posix.cc |
|
|
|
PORT_SSE_FILE=port/port_posix_sse.cc |
|
|
|
;; |
|
|
|
DragonFly) |
|
|
|
PLATFORM=OS_DRAGONFLYBSD |
|
|
|
COMMON_FLAGS="$MEMCMP_FLAG -D_REENTRANT -DOS_DRAGONFLYBSD" |
|
|
|
PLATFORM_LIBS="-lpthread" |
|
|
|
PORT_FILE=port/port_posix.cc |
|
|
|
PORT_SSE_FILE=port/port_posix_sse.cc |
|
|
|
;; |
|
|
|
OS_ANDROID_CROSSCOMPILE) |
|
|
|
PLATFORM=OS_ANDROID |
|
|
|
COMMON_FLAGS="$MEMCMP_FLAG -D_REENTRANT -DOS_ANDROID -DLEVELDB_PLATFORM_POSIX=1" |
|
|
|
PLATFORM_LDFLAGS="" # All pthread features are in the Android C library |
|
|
|
PORT_FILE=port/port_posix.cc |
|
|
|
PORT_SSE_FILE=port/port_posix_sse.cc |
|
|
|
CROSS_COMPILE=true |
|
|
|
;; |
|
|
|
HP-UX) |
|
|
@ -144,7 +135,6 @@ case "$TARGET_OS" in |
|
|
|
COMMON_FLAGS="$MEMCMP_FLAG -D_REENTRANT -DOS_HPUX" |
|
|
|
PLATFORM_LDFLAGS="-pthread" |
|
|
|
PORT_FILE=port/port_posix.cc |
|
|
|
PORT_SSE_FILE=port/port_posix_sse.cc |
|
|
|
# man ld: +h internal_name |
|
|
|
PLATFORM_SHARED_LDFLAGS="-shared -Wl,+h -Wl," |
|
|
|
;; |
|
|
@ -153,7 +143,6 @@ case "$TARGET_OS" in |
|
|
|
COMMON_FLAGS="$MEMCMP_FLAG" |
|
|
|
[ -z "$INSTALL_PATH" ] && INSTALL_PATH=`pwd` |
|
|
|
PORT_FILE=port/port_posix.cc |
|
|
|
PORT_SSE_FILE=port/port_posix_sse.cc |
|
|
|
PLATFORM_SHARED_EXT= |
|
|
|
PLATFORM_SHARED_LDFLAGS= |
|
|
|
PLATFORM_SHARED_CFLAGS= |
|
|
@ -180,7 +169,7 @@ set +f # re-enable globbing |
|
|
|
|
|
|
|
# The sources consist of the portable files, plus the platform-specific port |
|
|
|
# file. |
|
|
|
echo "SOURCES=$PORTABLE_FILES $PORT_FILE $PORT_SSE_FILE" >> $OUTPUT |
|
|
|
echo "SOURCES=$PORTABLE_FILES $PORT_FILE" >> $OUTPUT |
|
|
|
echo "MEMENV_SOURCES=helpers/memenv/memenv.cc" >> $OUTPUT |
|
|
|
|
|
|
|
if [ "$CROSS_COMPILE" = "true" ]; then |
|
|
@ -202,8 +191,20 @@ EOF |
|
|
|
COMMON_FLAGS="$COMMON_FLAGS -DLEVELDB_PLATFORM_POSIX=1" |
|
|
|
fi |
|
|
|
|
|
|
|
# Test whether CRC32C library is installed |
|
|
|
# https://github.com/google/crc32c |
|
|
|
$CXX $CXXFLAGS -x c++ - -o $CXXOUTPUT 2>/dev/null <<EOF |
|
|
|
#include <crc32c/crc32c.h> |
|
|
|
int main() {} |
|
|
|
EOF |
|
|
|
if [ "$?" = 0 ]; then |
|
|
|
COMMON_FLAGS="$COMMON_FLAGS -DHAVE_CRC32C=1" |
|
|
|
PLATFORM_LIBS="$PLATFORM_LIBS -lcrc32c" |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
# Test whether Snappy library is installed |
|
|
|
# http://code.google.com/p/snappy/ |
|
|
|
# https://github.com/google/snappy |
|
|
|
$CXX $CXXFLAGS -x c++ - -o $CXXOUTPUT 2>/dev/null <<EOF |
|
|
|
#include <snappy.h> |
|
|
|
int main() {} |
|
|
@ -223,22 +224,9 @@ EOF |
|
|
|
|
|
|
|
rm -f $CXXOUTPUT 2>/dev/null |
|
|
|
|
|
|
|
# Test if gcc SSE 4.2 is supported |
|
|
|
$CXX $CXXFLAGS -x c++ - -o $CXXOUTPUT -msse4.2 2>/dev/null <<EOF |
|
|
|
int main() {} |
|
|
|
EOF |
|
|
|
if [ "$?" = 0 ]; then |
|
|
|
PLATFORM_SSEFLAGS="-msse4.2" |
|
|
|
fi |
|
|
|
|
|
|
|
rm -f $CXXOUTPUT 2>/dev/null |
|
|
|
fi |
|
|
|
|
|
|
|
# Use the SSE 4.2 CRC32C intrinsics iff runtime checks indicate compiler supports them. |
|
|
|
if [ -n "$PLATFORM_SSEFLAGS" ]; then |
|
|
|
PLATFORM_SSEFLAGS="$PLATFORM_SSEFLAGS -DLEVELDB_PLATFORM_POSIX_SSE" |
|
|
|
fi |
|
|
|
|
|
|
|
PLATFORM_CCFLAGS="$PLATFORM_CCFLAGS $COMMON_FLAGS" |
|
|
|
PLATFORM_CXXFLAGS="$PLATFORM_CXXFLAGS $COMMON_FLAGS" |
|
|
|
|
|
|
@ -249,7 +237,6 @@ echo "PLATFORM_LDFLAGS=$PLATFORM_LDFLAGS" >> $OUTPUT |
|
|
|
echo "PLATFORM_LIBS=$PLATFORM_LIBS" >> $OUTPUT |
|
|
|
echo "PLATFORM_CCFLAGS=$PLATFORM_CCFLAGS" >> $OUTPUT |
|
|
|
echo "PLATFORM_CXXFLAGS=$PLATFORM_CXXFLAGS" >> $OUTPUT |
|
|
|
echo "PLATFORM_SSEFLAGS=$PLATFORM_SSEFLAGS" >> $OUTPUT |
|
|
|
echo "PLATFORM_SHARED_CFLAGS=$PLATFORM_SHARED_CFLAGS" >> $OUTPUT |
|
|
|
echo "PLATFORM_SHARED_EXT=$PLATFORM_SHARED_EXT" >> $OUTPUT |
|
|
|
echo "PLATFORM_SHARED_LDFLAGS=$PLATFORM_SHARED_LDFLAGS" >> $OUTPUT |
|
|
|