Skip to content

Commit

Permalink
Get Solaris 11 working.
Browse files Browse the repository at this point in the history
  • Loading branch information
nemequ committed Mar 15, 2016
1 parent 1805c89 commit 6ed9231
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 26 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ set (SQUASH_SOVERSION_CURRENT ${SQUASH_VERSION_MAJOR})
set (SQUASH_SOVERSION_REVISION ${SQUASH_VERSION_MINOR})
set (SQUASH_SOVERSION_AGE ${SQUASH_VERSION_REVISION})

cmake_minimum_required (VERSION 2.8.7)
cmake_minimum_required (VERSION 2.8.6)

if (CMAKE_BUILD_TYPE STREQUAL "")
set (CMAKE_BUILD_TYPE "Debug")
Expand Down
16 changes: 16 additions & 0 deletions plugins/crush/crush.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,26 @@
# include <libkern/OSByteOrder.h>
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__)
# include <sys/endian.h>
#elif defined(__sun) || defined(sun)
# include <sys/byteorder.h>
#else
# include <endian.h>
#endif

#if !defined(LITTLE_ENDIAN)
# define LITTLE_ENDIAN 4321
#endif
#if !defined(BIG_ENDIAN)
# define BIG_ENDIAN 1234
#endif
#if !defined(BYTE_ORDER)
# if defined(_BIG_ENDIAN)
# define BYTE_ORDER BIG_ENDIAN
# else
# define BYTE_ORDER LITTLE_ENDIAN
# endif
#endif

#if defined(__GNUC__)
# define ENDIAN_BSWAP16(v) __builtin_bswap16(v)
# define ENDIAN_BSWAP32(v) __builtin_bswap32(v)
Expand Down
36 changes: 15 additions & 21 deletions plugins/ncompress/compress.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,34 +39,28 @@

#define INIT_BITS 9 /* initial number of bits/code */

#if !defined(BYTEORDER) && defined(_WIN32)
#if defined(_WIN32)
# define BYTEORDER 4321
#endif

#ifndef BYTEORDER
# if !defined(BYTE_ORDER)
# if defined(__APPLE__)
# include <libkern/OSByteOrder.h>
# elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragoFly__)
# include <sys/endian.h>
#elif defined(sun) || defined(__sun)
# include <sys/byteorder.h>
# if defined(_BIG_ENDIAN)
# define BYTEORDER 1234
# else
# include <endian.h>
# define BYTEORDER 4321
# endif
# endif
# if defined(BYTE_ORDER)
# if BYTE_ORDER == LITTLE_ENDIAN
# define BYTEORDER 4321
#else
# if defined(__APPLE__)
# include <libkern/OSByteOrder.h>
# elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__)
# include <sys/endian.h>
# else
# define BYTEORDER 1234
# include <endian.h>
# endif
# else
# ifdef _MSC_VER
# pragma message("Unable to figure out byteorder, defaulting to slow byte swapping")
# if (BYTE_ORDER == BIG_ENDIAN)
# define BYTEORDER 1234
# else
# warning Unable to figure out byteorder, defaulting to slow byte swapping
# define BYTEORDER 4321
# endif
# define BYTEORDER 0000
# endif
#endif

#ifndef NOALLIGN
Expand Down
10 changes: 8 additions & 2 deletions plugins/snappy/snappy-stubs-public.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,21 @@
#define SNAPPY_VERSION \
((SNAPPY_MAJOR << 16) | (SNAPPY_MINOR << 8) | SNAPPY_PATCHLEVEL)

#if !defined(_WIN32)
#if defined(_WIN32)
#elif defined(sun) || defined(__sun)
# include <sys/byteorder.h>
# if defined(_BIG_ENDIAN)
# define WORDS_BIGENDIAN
# endif
#else
# if defined(__APPLE__)
# include <libkern/OSByteOrder.h>
# elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__)
# include <sys/endian.h>
# else
# include <endian.h>
# endif
# if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && (BYTE_ORDER == BIG_ENDIAN)
# if (BYTE_ORDER == BIG_ENDIAN)
# define WORDS_BIGENDIAN
# endif
#endif
Expand Down
1 change: 1 addition & 0 deletions squash/charset.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "internal.h"

#include <string.h>
#include <strings.h>
#include <iconv.h>
#include <errno.h>
#include <wchar.h>
Expand Down
1 change: 1 addition & 0 deletions squash/codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
* Evan Nemerson <[email protected]>
*/

#define _XOPEN_SOURCE 600
#define _POSIX_C_SOURCE 200809L

#include <assert.h>
Expand Down
5 changes: 5 additions & 0 deletions squash/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
# error "You must include internal.h instead of squash.h"
#endif

/* Solaris freaks out if you try to use older standards with C99. */
#if defined(__sun) && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
# define _XOPEN_SOURCE 600
#endif

#ifndef SQUASH_FILE_BUF_SIZE
# define SQUASH_FILE_BUF_SIZE ((size_t) (1024 * 1024))
#endif
Expand Down
1 change: 1 addition & 0 deletions squash/license.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include <squash/internal.h>
#include <string.h>
#include <strings.h>

/**
* @def SQUASH_LICENSE_UNKNOWN
Expand Down
2 changes: 1 addition & 1 deletion squash/squash.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
# define SQUASH_END_DECLS
#endif

#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && !defined(__cplusplus)
# define SQUASH_ARRAY_PARAM(name) name
#else
# define SQUASH_ARRAY_PARAM(name)
Expand Down
2 changes: 1 addition & 1 deletion tests/munit

0 comments on commit 6ed9231

Please sign in to comment.