1 AC_INIT([wimlib], [1.2.1], [ebiggers3@gmail.com])
2 AC_CONFIG_SRCDIR([src/wim.c])
3 AC_CONFIG_MACRO_DIR([m4])
4 AC_CONFIG_AUX_DIR([build-aux])
5 AM_INIT_AUTOMAKE([-Wall -Werror subdir-objects])
7 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
9 AC_CONFIG_HEADERS([config.h])
10 AC_CONFIG_FILES([Makefile
32 AC_CHECK_FUNCS([utimensat lutimes utime flock])
33 AC_CHECK_HEADERS([endian.h byteswap.h sys/byteorder.h sys/endian.h \
34 sys/param.h machine/endian.h alloca.h stdlib.h stdarg.h \
35 errno.h attr/xattr.h utime.h sys/file.h])
37 AC_CHECK_MEMBER([struct stat.st_mtim],
38 [AC_DEFINE([HAVE_STAT_NANOSECOND_PRECISION], [1],
39 [Define to 1 if nanosecond precision timestamps are
42 [[#include <sys/stat.h>]])
45 if test "x$am_cv_func_iconv" != "xyes"; then
46 AC_MSG_ERROR([Cannot find the iconv() function.
47 iconv() is used to convert between UTF-8 and UTF-16 encodings of WIM
48 filenames and XML data. Wimlib cannot be compiled without it. iconv()
49 is available in the latest version of glibc and sometimes in other
54 AC_ARG_WITH(pkgconfigdir,
55 [ --with-pkgconfigdir=DIR pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@],
56 [pkgconfigdir=$withval],
57 [pkgconfigdir='${libdir}/pkgconfig'])
58 AC_SUBST(pkgconfigdir)
60 AC_CHECK_LIB([xml2], [xmlParseFile], [have_libxml=true],
61 [AC_MSG_ERROR(["cannot find libxml2"])])
62 LIBXML2_LDADD=`pkg-config libxml-2.0 --libs`
63 LIBXML2_CFLAGS=`pkg-config libxml-2.0 --cflags`
64 AC_SUBST([LIBXML2_LDADD], [$LIBXML2_LDADD])
65 AC_SUBST([LIBXML2_CFLAGS], [$LIBXML2_CFLAGS])
67 AC_MSG_CHECKING([whether to include debugging messages])
68 AC_ARG_ENABLE([debug],
69 AS_HELP_STRING([--enable-debug], [include lots of debugging messages]),
70 [ENABLE_DEBUG=$enableval],
73 AC_MSG_RESULT([$ENABLE_DEBUG])
74 if test "x$ENABLE_DEBUG" = "xyes"; then
75 AC_DEFINE([ENABLE_DEBUG], [1],
76 [Define to 1 if including lots of debug messages.])
79 AC_MSG_CHECKING([whether to include more debugging messages])
80 AC_ARG_ENABLE([more_debug],
81 AS_HELP_STRING([--enable-more-debug],
82 [include even more debugging messages]),
83 [ENABLE_MORE_DEBUG=$enableval],
84 [ENABLE_MORE_DEBUG=no]
86 AC_MSG_RESULT([$ENABLE_MORE_DEBUG])
87 if test "x$ENABLE_MORE_DEBUG" = "xyes"; then
88 AC_DEFINE([ENABLE_MORE_DEBUG], [1],
89 [Define to 1 if including even more debug messages.])
92 AC_MSG_CHECKING([whether to include error messages])
93 AC_ARG_ENABLE([error_messages],
94 AS_HELP_STRING([--disable-error-messages],
95 [do not compile in error messsages]),
96 [ENABLE_ERROR_MESSAGES=$enableval],
97 [ENABLE_ERROR_MESSAGES=yes]
99 AC_MSG_RESULT([$ENABLE_ERROR_MESSAGES])
100 if test "x$ENABLE_ERROR_MESSAGES" = "xyes"; then
101 AC_DEFINE([ENABLE_ERROR_MESSAGES], [1],
102 [Define to 1 if including error messages])
105 AC_MSG_CHECKING([whether to support custom memory allocation functions])
106 AC_ARG_ENABLE([custom_memory_allocator],
107 AS_HELP_STRING([--disable-custom-memory-allocator],
108 [do not support the use of custom memory allocation
110 [ENABLE_CUSTOM_MEMORY_ALLOCATOR=$enableval],
111 [ENABLE_CUSTOM_MEMORY_ALLOCATOR=yes]
113 AC_MSG_RESULT([$ENABLE_CUSTOM_MEMORY_ALLOCATOR])
114 if test "x$ENABLE_CUSTOM_MEMORY_ALLOCATOR" = "xyes"; then
115 AC_DEFINE([ENABLE_CUSTOM_MEMORY_ALLOCATOR], [1],
116 [Define to 1 if supporting custom memory allocation functions])
119 AC_MSG_CHECKING([whether to include assertions])
120 AC_ARG_ENABLE([assertions],
121 AS_HELP_STRING([--disable-assertions], [do not include assertions]),
122 [ENABLE_ASSERTIONS=$enableval],
123 [ENABLE_ASSERTIONS=yes]
125 AC_MSG_RESULT([$ENABLE_ASSERTIONS])
126 if test "x$ENABLE_ASSERTIONS" = "xyes"; then
127 AC_DEFINE([ENABLE_ASSERTIONS], [1], [Define to 1 if including assertions.])
131 AC_MSG_CHECKING([whether to include compression verification])
132 AC_ARG_ENABLE([verify_compression],
133 AS_HELP_STRING([--disable-verify-compression], [disable
134 checking if blocks we compress can be correctly
136 [ENABLE_VERIFY_COMPRESSION=$enableval],
137 [ENABLE_VERIFY_COMPRESSION=yes]
139 AC_MSG_RESULT([$ENABLE_VERIFY_COMPRESSION])
140 if test "x$ENABLE_VERIFY_COMPRESSION" = "xyes"; then
141 AC_DEFINE([ENABLE_VERIFY_COMPRESSION], [1], [Define to 1 to verify
145 AC_MSG_CHECKING([whether to include support for multi-threaded compression])
146 AC_ARG_ENABLE([multithreaded-compression],
147 AS_HELP_STRING([--disable-multithreaded-compression],
148 [do not compile in the code for multi-threaded compression]),
149 [ENABLE_MULTITHREADED_COMPRESSION=$enableval],
150 [ENABLE_MULTITHREADED_COMPRESSION=yes]
152 AC_MSG_RESULT([$ENABLE_MULTITHREADED_COMPRESSION])
153 if test "x$ENABLE_MULTITHREADED_COMPRESSION" = "xyes"; then
154 AC_DEFINE([ENABLE_MULTITHREADED_COMPRESSION], [1],
155 [Define to 1 if including support for multithreaded
157 PTHREAD_LDADD="-lpthread"
161 AC_SUBST([PTHREAD_LDADD], [$PTHREAD_LDADD])
163 AC_MSG_CHECKING([whether to include support for ntfs-3g])
164 AC_ARG_WITH([ntfs-3g],
165 AS_HELP_STRING([--without-ntfs-3g], [build without NTFS-3g.
166 This will disable the ability to use NTFS-specific
167 information when capturing or applying WIMs to a
169 [WITH_NTFS_3G=$withval],
172 AC_MSG_RESULT([$WITH_NTFS_3G])
173 if test "x$WITH_NTFS_3G" = "xyes"; then
174 AC_DEFINE([WITH_NTFS_3G], [1], [Define to 1 to enable support for
175 NTFS-specific information])
177 AC_CHECK_LIB([ntfs-3g], [ntfs_xattr_system_setxattr], [],
178 [AC_MSG_ERROR([Cannot find libntfs-3g version 2011-4-12
179 or later. Without libntfs-3g, wimlib cannot include support for
180 capturing and applying WIMs on NTFS filesystems while preserving
181 NTFS-specific data such as security descriptors and alternate data
182 streams. You should either install libntfs-3g, or configure with
183 --without-ntfs-3g to disable support for these NTFS-specific
185 LIBNTFS_3G_LDADD="`pkg-config --libs libntfs-3g`"
186 LIBNTFS_3G_CFLAGS="`pkg-config --cflags libntfs-3g`"
191 AM_CONDITIONAL([WITH_NTFS_3G], [test "x$WITH_NTFS_3G" = "xyes"])
193 AC_SUBST([LIBNTFS_3G_LDADD], [$LIBNTFS_3G_LDADD])
194 AC_SUBST([LIBNTFS_3G_CFLAGS], [$LIBNTFS_3G_CFLAGS])
196 AC_MSG_CHECKING([whether to include support for mounting WIMs])
198 AS_HELP_STRING([--without-fuse], [build without libfuse.
199 This will disable the ability to mount
201 [WITH_FUSE=$withval],
204 AC_MSG_RESULT([$WITH_FUSE])
205 if test "x$WITH_FUSE" = "xyes"; then
206 AC_DEFINE([WITH_FUSE], [1], [Define to 1 if using FUSE.])
209 AC_CHECK_LIB([fuse], [fuse_main_real], [have_fuse=true],
210 [AC_MSG_ERROR([Cannot find libfuse.
211 Without libfuse, wimlib cannot include support for mounting WIMs. You
212 should either install libfuse, or configure with --without-fuse to
213 disable support for mounting WIMs.])
215 AC_CHECK_LIB([rt], [mq_open], [have_posix_mq=true],
216 [AC_MSG_ERROR([Cannot find librt for POSIX message queue
217 functions. Without these functions, wimlib cannot include support for
218 mounting WIMs. You should either update your C library to a recent
219 version of glibc, or configure with --without-fuse to disable support
222 LIBFUSE_LDADD="`pkg-config --libs fuse` -lrt"
223 LIBFUSE_CFLAGS="`pkg-config --cflags fuse`"
228 AM_CONDITIONAL([WITH_FUSE], [test "x$WITH_FUSE" = "xyes"])
229 AC_SUBST([LIBFUSE_LDADD], [$LIBFUSE_LDADD])
230 AC_SUBST([LIBFUSE_CFLAGS], [$LIBFUSE_CFLAGS])
233 AC_ARG_ENABLE([xattr],
234 [AS_HELP_STRING([--enable-xattr], [Enable the xattr interface to access WIM
235 alternate data streams (default: autodetect)])],
236 [ENABLE_XATTR=$enableval],
237 [AC_CHECK_FUNC([setxattr],
238 [AC_CHECK_HEADER([attr/xattr.h],
240 [AC_MSG_WARN([Cannot find the "attr/xattr.h" header. You will not be
241 able to use the xattr interface to access WIM alternate data
243 [AC_MSG_WARN([Cannot find the setxattr() function. You will not be
244 able to use the xattr interface to access WIM alternate data
247 if test "x$ENABLE_XATTR" = "xyes"; then
248 AC_DEFINE([ENABLE_XATTR], [1], [Define to 1 if using the xattr
249 interface to WIM alternate data streams])
252 AC_MSG_CHECKING([whether to use SSSE3-accelerated SHA1 ])
253 AC_ARG_ENABLE([ssse3-sha1],
254 AS_HELP_STRING([--enable-ssse3-sha1], [use assembly language implementation
255 of SHA1 from Intel, accelerated with vector
256 instructions (SSSE3-enabled CPU required)]),
257 [ENABLE_SSSE3_SHA1=$enableval],
258 [ENABLE_SSSE3_SHA1=no]
261 AC_MSG_RESULT([$ENABLE_SSSE3_SHA1])
262 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
263 AC_DEFINE([ENABLE_SSSE3_SHA1], [1],
264 [Define to 1 if using vectorized implementation of SHA1])
265 SSSE3_SHA1_OBJ=sha1-ssse3.lo
267 AC_SUBST([NASM], [$nasm])
271 AC_SUBST([SSSE3_SHA1_OBJ], [$SSSE3_SHA1_OBJ])
273 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
276 AC_ARG_WITH([libcrypto],
277 AS_HELP_STRING([--without-libcrypto], [build in the SHA1 algorithm,
278 rather than use external libcrypto from
279 OpenSSL (default is autodetect)]),
280 [WITH_LIBCRYPTO=$withval],
281 [AC_CHECK_LIB([crypto], [SHA1],
282 [WITH_LIBCRYPTO=yes],
283 [AC_MSG_WARN([Cannot find libcrypto: using stand-alone SHA1 code instead of OpenSSL])
287 AC_MSG_CHECKING([whether to use SHA1 function from system libcrypto])
288 AC_MSG_RESULT([$WITH_LIBCRYPTO])
290 if test "x$WITH_LIBCRYPTO" = "xyes" -a "x$ENABLE_SSSE3_SHA1" = "xno"; then
291 AC_DEFINE([WITH_LIBCRYPTO], [1], [Define to 1 if using libcrypto SHA1])
292 LIBCRYPTO_LDADD=`pkg-config --libs libcrypto 2>/dev/null`
293 if test $? -ne 0; then
294 LIBCRYPTO_LDADD=-lcrypto;
296 LIBCRYPTO_CFLAGS=`pkg-config --cflags libcrypto 2>/dev/null`
301 AC_SUBST([LIBCRYPTO_LDADD], [$LIBCRYPTO_LDADD])
302 AC_SUBST([LIBCRYPTO_CFLAGS], [$LIBCRYPTO_CFLAGS])
303 AC_SUBST([SHA1_SOURCES], [$SHA1_SOURCES])