From: Eric Biggers Date: Fri, 20 Jul 2018 07:38:56 +0000 (-0700) Subject: Fix building on NetBSD X-Git-Tag: v1.13.0~10 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=b6223f9fdee97d0a9ee53a3eae984952a8e5ed02 Fix building on NetBSD --- diff --git a/configure.ac b/configure.ac index 072da7d0..329a5d9d 100644 --- a/configure.ac +++ b/configure.ac @@ -61,7 +61,7 @@ AM_CONDITIONAL([WINDOWS_NATIVE_BUILD], [test "$WINDOWS_NATIVE_BUILD" = "yes"]) # Useful functions which we can do without. AC_CHECK_FUNCS([futimens utimensat flock mempcpy \ openat fstatat readlinkat fdopendir posix_fallocate \ - llistxattr lgetxattr fsetxattr lsetxattr]) + llistxattr lgetxattr fsetxattr lsetxattr getopt_long_only]) # Header checks, most of which are only here to satisfy conditional includes # made by the libntfs-3g headers. diff --git a/include/wimlib/endianness.h b/include/wimlib/endianness.h index ed0b7ec4..38e2bc2c 100644 --- a/include/wimlib/endianness.h +++ b/include/wimlib/endianness.h @@ -24,6 +24,14 @@ #include "wimlib/compiler.h" #include "wimlib/types.h" +#ifdef HAVE_SYS_ENDIAN_H + /* Needed on NetBSD to stop system bswap macros from messing things up */ +# include +# undef bswap16 +# undef bswap32 +# undef bswap64 +#endif + /* Watch out for conflict with ntfs-3g/endians.h ... */ #ifndef _NTFS_ENDIANS_H diff --git a/include/wimlib/util.h b/include/wimlib/util.h index 3dc59f45..12b1b120 100644 --- a/include/wimlib/util.h +++ b/include/wimlib/util.h @@ -26,6 +26,7 @@ /* Round 'v' up to the next 'alignment'-byte aligned boundary. 'alignment' must * be a power of 2. */ +#undef ALIGN /* NetBSD defines this already */ #define ALIGN(v, alignment) (((v) + ((alignment) - 1)) & ~((alignment) - 1)) /* Maximum number of bytes that can be allocated on the stack. diff --git a/programs/imagex.c b/programs/imagex.c index a10ac488..781718e3 100644 --- a/programs/imagex.c +++ b/programs/imagex.c @@ -46,6 +46,11 @@ # include #endif +/* NetBSD is missing getopt_long_only() but has getopt_long() */ +#ifndef HAVE_GETOPT_LONG_ONLY +# define getopt_long_only getopt_long +#endif + #define WIMLIB_COMPRESSION_TYPE_INVALID (-1) #ifdef __WIN32__