Merge pull request #475 from DimitryAndric/fix-build-on-freebsd-1

Make zstd build out of the box properly on FreeBSD
This commit is contained in:
Yann Collet 2016-12-13 11:39:23 +01:00 committed by GitHub
commit 90ce45e565
4 changed files with 11 additions and 14 deletions

View File

@ -22,19 +22,13 @@
defined(__CYGWIN__) defined(__CYGWIN__)
#include <io.h> /* _isatty */ #include <io.h> /* _isatty */
#define IS_CONSOLE(stdStream) _isatty(_fileno(stdStream)) #define IS_CONSOLE(stdStream) _isatty(_fileno(stdStream))
#else #elif defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || defined(_POSIX_SOURCE) || (defined(__APPLE__) && defined(__MACH__)) || \
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) /* https://sourceforge.net/p/predef/wiki/OperatingSystems/ */
defined(_POSIX_SOURCE) || \
(defined(__APPLE__) && \
defined( \
__MACH__)) /* https://sourceforge.net/p/predef/wiki/OperatingSystems/ \
*/
#include <unistd.h> /* isatty */ #include <unistd.h> /* isatty */
#define IS_CONSOLE(stdStream) isatty(fileno(stdStream)) #define IS_CONSOLE(stdStream) isatty(fileno(stdStream))
#else #else
#define IS_CONSOLE(stdStream) 0 #define IS_CONSOLE(stdStream) 0
#endif #endif
#endif
namespace pzstd { namespace pzstd {

View File

@ -98,7 +98,7 @@ extern "C" {
# define SET_HIGH_PRIORITY /* disabled */ # define SET_HIGH_PRIORITY /* disabled */
# endif # endif
# define UTIL_sleep(s) sleep(s) # define UTIL_sleep(s) sleep(s)
# if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 199309L) # if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || (defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 199309L))
# define UTIL_sleepMilli(milli) { struct timespec t; t.tv_sec=0; t.tv_nsec=milli*1000000ULL; nanosleep(&t, NULL); } # define UTIL_sleepMilli(milli) { struct timespec t; t.tv_sec=0; t.tv_nsec=milli*1000000ULL; nanosleep(&t, NULL); }
# else # else
# define UTIL_sleepMilli(milli) /* disabled */ # define UTIL_sleepMilli(milli) /* disabled */

View File

@ -43,7 +43,8 @@
#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) #if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)
# include <io.h> /* _isatty */ # include <io.h> /* _isatty */
# define IS_CONSOLE(stdStream) _isatty(_fileno(stdStream)) # define IS_CONSOLE(stdStream) _isatty(_fileno(stdStream))
#elif defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || defined(_POSIX_SOURCE) || (defined(__APPLE__) && defined(__MACH__)) /* https://sourceforge.net/p/predef/wiki/OperatingSystems/ */ #elif defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || defined(_POSIX_SOURCE) || (defined(__APPLE__) && defined(__MACH__)) || \
defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) /* https://sourceforge.net/p/predef/wiki/OperatingSystems/ */
# include <unistd.h> /* isatty */ # include <unistd.h> /* isatty */
# define IS_CONSOLE(stdStream) isatty(fileno(stdStream)) # define IS_CONSOLE(stdStream) isatty(fileno(stdStream))
#else #else

View File

@ -31,8 +31,10 @@ case "$OS" in
;; ;;
esac esac
case "$OSTYPE" in UNAME=$(uname)
darwin*) MD5SUM="md5 -r" ;; case "$UNAME" in
Darwin) MD5SUM="md5 -r" ;;
FreeBSD) MD5SUM="gmd5sum" ;;
*) MD5SUM="md5sum" ;; *) MD5SUM="md5sum" ;;
esac esac
@ -228,8 +230,8 @@ cp ../programs/*.h dirTestDict
$MD5SUM dirTestDict/* > tmph1 $MD5SUM dirTestDict/* > tmph1
$ZSTD -f --rm dirTestDict/* -D tmpDictC $ZSTD -f --rm dirTestDict/* -D tmpDictC
$ZSTD -d --rm dirTestDict/*.zst -D tmpDictC # note : use internal checksum by default $ZSTD -d --rm dirTestDict/*.zst -D tmpDictC # note : use internal checksum by default
case "$OSTYPE" in case "$UNAME" in
darwin*) $ECHO "md5sum -c not supported on OS-X : test skipped" ;; # not compatible with OS-X's md5 Darwin) $ECHO "md5sum -c not supported on OS-X : test skipped" ;; # not compatible with OS-X's md5
*) $MD5SUM -c tmph1 ;; *) $MD5SUM -c tmph1 ;;
esac esac
rm -rf dirTestDict rm -rf dirTestDict