]> wimlib.net Git - wimlib/commitdiff
Fix building on NetBSD
authorEric Biggers <ebiggers3@gmail.com>
Fri, 20 Jul 2018 07:38:56 +0000 (00:38 -0700)
committerEric Biggers <ebiggers3@gmail.com>
Fri, 20 Jul 2018 07:47:56 +0000 (00:47 -0700)
configure.ac
include/wimlib/endianness.h
include/wimlib/util.h
programs/imagex.c

index 072da7d06407a1bc52269e7d16ac5181abd51b93..329a5d9df86068a897cd719af52909b31d07410e 100644 (file)
@@ -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.
index ed0b7ec443eb26cf679810a26820278306d6db25..38e2bc2c042ab64c9b642b6aab712196a763cc79 100644 (file)
 #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 <sys/endian.h>
+#  undef bswap16
+#  undef bswap32
+#  undef bswap64
+#endif
+
 /* Watch out for conflict with ntfs-3g/endians.h ... */
 #ifndef _NTFS_ENDIANS_H
 
index 3dc59f454faae2099979af514a7a4994b052a345..12b1b120a46ef0d1be9ee47e975ec1e928ced870 100644 (file)
@@ -26,6 +26,7 @@
 
 /* Round 'v' up to the next 'alignment'-byte aligned boundary.  'alignment' must
  * be a power of 2.  */
+#undef ALIGN   /* NetBSD <sys/param.h> defines this already */
 #define ALIGN(v, alignment)    (((v) + ((alignment) - 1)) & ~((alignment) - 1))
 
 /* Maximum number of bytes that can be allocated on the stack.
index a10ac488fdfbc4bb66949fdeae18a3193f253890..781718e32fe82217a60c308b6b9c796c03f174a6 100644 (file)
 #  include <alloca.h>
 #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__