1 AC_INIT([wimlib], [1.1.0], [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])
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])
39 if test "x$am_cv_func_iconv" != "xyes"; then
40 AC_MSG_ERROR([Cannot find the iconv() function.
41 iconv() is used to convert between UTF-8 and UTF-16 encodings of WIM
42 filenames and XML data. Wimlib cannot be compiled without it. iconv()
43 is available in the latest version of glibc and sometimes in other
48 AC_ARG_WITH(pkgconfigdir,
49 [ --with-pkgconfigdir=DIR pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@],
50 [pkgconfigdir=$withval],
51 [pkgconfigdir='${libdir}/pkgconfig'])
52 AC_SUBST(pkgconfigdir)
54 AC_CHECK_LIB([xml2], [xmlParseFile], [have_libxml=true],
55 [AC_MSG_ERROR(["cannot find libxml2"])])
56 LIBXML2_LDADD=`pkg-config libxml-2.0 --libs`
57 LIBXML2_CFLAGS=`pkg-config libxml-2.0 --cflags`
58 AC_SUBST([LIBXML2_LDADD], [$LIBXML2_LDADD])
59 AC_SUBST([LIBXML2_CFLAGS], [$LIBXML2_CFLAGS])
61 AC_MSG_CHECKING([whether to include debugging messages])
62 AC_ARG_ENABLE([debug],
63 AS_HELP_STRING([--enable-debug], [include lots of debugging messages]),
64 [ENABLE_DEBUG=$enableval],
67 AC_MSG_RESULT([$ENABLE_DEBUG])
68 if test "x$ENABLE_DEBUG" = "xyes"; then
69 AC_DEFINE([ENABLE_DEBUG], [1],
70 [Define to 1 if including lots of debug messages.])
73 AC_MSG_CHECKING([whether to include more debugging messages])
74 AC_ARG_ENABLE([more_debug],
75 AS_HELP_STRING([--enable-more-debug],
76 [include even more debugging messages]),
77 [ENABLE_MORE_DEBUG=$enableval],
78 [ENABLE_MORE_DEBUG=no]
80 AC_MSG_RESULT([$ENABLE_MORE_DEBUG])
81 if test "x$ENABLE_MORE_DEBUG" = "xyes"; then
82 AC_DEFINE([ENABLE_MORE_DEBUG], [1],
83 [Define to 1 if including even more debug messages.])
86 AC_MSG_CHECKING([whether to include error messages])
87 AC_ARG_ENABLE([error_messages],
88 AS_HELP_STRING([--disable-error-messages],
89 [do not compile in error messsages]),
90 [ENABLE_ERROR_MESSAGES=$enableval],
91 [ENABLE_ERROR_MESSAGES=yes]
93 AC_MSG_RESULT([$ENABLE_ERROR_MESSAGES])
94 if test "x$ENABLE_ERROR_MESSAGES" = "xyes"; then
95 AC_DEFINE([ENABLE_ERROR_MESSAGES], [1],
96 [Define to 1 if including error messages])
99 AC_MSG_CHECKING([whether to support custom memory allocation functions])
100 AC_ARG_ENABLE([custom_memory_allocator],
101 AS_HELP_STRING([--disable-custom-memory-allocator],
102 [do not support the use of custom memory allocation
104 [ENABLE_CUSTOM_MEMORY_ALLOCATOR=$enableval],
105 [ENABLE_CUSTOM_MEMORY_ALLOCATOR=yes]
107 AC_MSG_RESULT([$ENABLE_CUSTOM_MEMORY_ALLOCATOR])
108 if test "x$ENABLE_CUSTOM_MEMORY_ALLOCATOR" = "xyes"; then
109 AC_DEFINE([ENABLE_CUSTOM_MEMORY_ALLOCATOR], [1],
110 [Define to 1 if supporting custom memory allocation functions])
113 AC_MSG_CHECKING([whether to include assertions])
114 AC_ARG_ENABLE([assertions],
115 AS_HELP_STRING([--disable-assertions], [do not include assertions]),
116 [ENABLE_ASSERTIONS=$enableval],
117 [ENABLE_ASSERTIONS=yes]
119 AC_MSG_RESULT([$ENABLE_ASSERTIONS])
120 if test "x$ENABLE_ASSERTIONS" = "xyes"; then
121 AC_DEFINE([ENABLE_ASSERTIONS], [1], [Define to 1 if including assertions.])
125 AC_MSG_CHECKING([whether to include compression verification])
126 AC_ARG_ENABLE([verify_compression],
127 AS_HELP_STRING([--disable-verify-compression], [disable
128 checking if blocks we compress can be correctly
130 [ENABLE_VERIFY_COMPRESSION=$enableval],
131 [ENABLE_VERIFY_COMPRESSION=yes]
133 AC_MSG_RESULT([$ENABLE_VERIFY_COMPRESSION])
134 if test "x$ENABLE_VERIFY_COMPRESSION" = "xyes"; then
135 AC_DEFINE([ENABLE_VERIFY_COMPRESSION], [1], [Define to 1 to verify
139 AC_MSG_CHECKING([whether to include support for multi-threaded compression])
140 AC_ARG_ENABLE([multithreaded-compression],
141 AS_HELP_STRING([--disable-multithreaded-compression],
142 [do not compile in the code for multi-threaded compression]),
143 [ENABLE_MULTITHREADED_COMPRESSION=$enableval],
144 [ENABLE_MULTITHREADED_COMPRESSION=yes]
146 AC_MSG_RESULT([$ENABLE_MULTITHREADED_COMPRESSION])
147 if test "x$ENABLE_MULTITHREADED_COMPRESSION" = "xyes"; then
148 AC_DEFINE([ENABLE_MULTITHREADED_COMPRESSION], [1],
149 [Define to 1 if including support for multithreaded
151 PTHREAD_LDADD="-lpthread"
155 AC_SUBST([PTHREAD_LDADD], [$PTHREAD_LDADD])
157 AC_MSG_CHECKING([whether to include support for ntfs-3g])
158 AC_ARG_WITH([ntfs-3g],
159 AS_HELP_STRING([--without-ntfs-3g], [build without NTFS-3g.
160 This will disable the ability to use NTFS-specific
161 information when capturing or applying WIMs to a
163 [WITH_NTFS_3G=$withval],
166 AC_MSG_RESULT([$WITH_NTFS_3G])
167 if test "x$WITH_NTFS_3G" = "xyes"; then
168 AC_DEFINE([WITH_NTFS_3G], [1], [Define to 1 to enable support for
169 NTFS-specific information])
171 AC_CHECK_LIB([ntfs-3g], [ntfs_xattr_system_setxattr], [],
172 [AC_MSG_ERROR([Cannot find libntfs-3g version 2011-4-12
173 or later. Without libntfs-3g, wimlib cannot include support for
174 capturing and applying WIMs on NTFS filesystems while preserving
175 NTFS-specific data such as security descriptors and alternate data
176 streams. You should either install libntfs-3g, or configure with
177 --without-ntfs-3g to disable support for these NTFS-specific
179 LIBNTFS_3G_LDADD="`pkg-config --libs libntfs-3g`"
180 LIBNTFS_3G_CFLAGS="`pkg-config --cflags libntfs-3g`"
185 AM_CONDITIONAL([WITH_NTFS_3G], [test "x$WITH_NTFS_3G" = "xyes"])
187 AC_SUBST([LIBNTFS_3G_LDADD], [$LIBNTFS_3G_LDADD])
188 AC_SUBST([LIBNTFS_3G_CFLAGS], [$LIBNTFS_3G_CFLAGS])
190 AC_MSG_CHECKING([whether to include support for mounting WIMs])
192 AS_HELP_STRING([--without-fuse], [build without libfuse.
193 This will disable the ability to mount
195 [WITH_FUSE=$withval],
198 AC_MSG_RESULT([$WITH_FUSE])
199 if test "x$WITH_FUSE" = "xyes"; then
200 AC_DEFINE([WITH_FUSE], [1], [Define to 1 if using FUSE.])
203 AC_CHECK_LIB([fuse], [fuse_main_real], [have_fuse=true],
204 [AC_MSG_ERROR([Cannot find libfuse.
205 Without libfuse, wimlib cannot include support for mounting WIMs. You
206 should either install libfuse, or configure with --without-fuse to
207 disable support for mounting WIMs.])
209 AC_CHECK_LIB([rt], [mq_open], [have_posix_mq=true],
210 [AC_MSG_ERROR([Cannot find librt for POSIX message queue
211 functions. Without these functions, wimlib cannot include support for
212 mounting WIMs. You should either update your C library to a recent
213 version of glibc, or configure with --without-fuse to disable support
216 LIBFUSE_LDADD="`pkg-config --libs fuse` -lrt"
217 LIBFUSE_CFLAGS="`pkg-config --cflags fuse`"
222 AM_CONDITIONAL([WITH_FUSE], [test "x$WITH_FUSE" = "xyes"])
223 AC_SUBST([LIBFUSE_LDADD], [$LIBFUSE_LDADD])
224 AC_SUBST([LIBFUSE_CFLAGS], [$LIBFUSE_CFLAGS])
227 AC_ARG_ENABLE([xattr],
228 [AS_HELP_STRING([--enable-xattr], [Enable the xattr interface to access WIM
229 alternate data streams (default: autodetect)])],
230 [ENABLE_XATTR=$enableval],
231 [AC_CHECK_FUNC([setxattr],
232 [AC_CHECK_HEADER([attr/xattr.h],
234 [AC_MSG_WARN([Cannot find the "attr/xattr.h" header. You will not be
235 able to use the xattr interface to access WIM alternate data
237 [AC_MSG_WARN([Cannot find the setxattr() function. You will not be
238 able to use the xattr interface to access WIM alternate data
241 if test "x$ENABLE_XATTR" = "xyes"; then
242 AC_DEFINE([ENABLE_XATTR], [1], [Define to 1 if using the xattr
243 interface to WIM alternate data streams])
246 AC_MSG_CHECKING([whether to use SSSE3-accelerated SHA1 ])
247 AC_ARG_ENABLE([ssse3-sha1],
248 AS_HELP_STRING([--enable-ssse3-sha1], [use assembly language implementation
249 of SHA1 from Intel, accelerated with vector
250 instructions (SSSE3-enabled CPU required)]),
251 [ENABLE_SSSE3_SHA1=$enableval],
252 [ENABLE_SSSE3_SHA1=no]
255 AC_MSG_RESULT([$ENABLE_SSSE3_SHA1])
256 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
257 AC_DEFINE([ENABLE_SSSE3_SHA1], [1],
258 [Define to 1 if using vectorized implementation of SHA1])
259 SSSE3_SHA1_OBJ=sha1-ssse3.lo
261 AC_SUBST([NASM], [$nasm])
265 AC_SUBST([SSSE3_SHA1_OBJ], [$SSSE3_SHA1_OBJ])
267 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
270 AC_ARG_WITH([libcrypto],
271 AS_HELP_STRING([--without-libcrypto], [build in the SHA1 algorithm,
272 rather than use external libcrypto from
273 OpenSSL (default is autodetect)]),
274 [WITH_LIBCRYPTO=$withval],
275 [AC_CHECK_LIB([crypto], [SHA1],
276 [WITH_LIBCRYPTO=yes],
277 [AC_MSG_WARN([Cannot find libcrypto: using stand-alone SHA1 code instead of OpenSSL])
281 AC_MSG_CHECKING([whether to use SHA1 function from system libcrypto])
282 AC_MSG_RESULT([$WITH_LIBCRYPTO])
284 if test "x$WITH_LIBCRYPTO" = "xyes" -a "x$ENABLE_SSSE3_SHA1" = "xno"; then
285 AC_DEFINE([WITH_LIBCRYPTO], [1], [Define to 1 if using libcrypto SHA1])
286 LIBCRYPTO_LDADD=`pkg-config --libs libcrypto 2>/dev/null`
287 if test $? -ne 0; then
288 LIBCRYPTO_LDADD=-lcrypto;
290 LIBCRYPTO_CFLAGS=`pkg-config --cflags libcrypto 2>/dev/null`
295 AC_SUBST([LIBCRYPTO_LDADD], [$LIBCRYPTO_LDADD])
296 AC_SUBST([LIBCRYPTO_CFLAGS], [$LIBCRYPTO_CFLAGS])
297 AC_SUBST([SHA1_SOURCES], [$SHA1_SOURCES])