# 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.
#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
/* 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.
# 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__