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
31 AC_CHECK_FUNCS([utimensat lutimes utime])
32 AC_CHECK_HEADERS([endian.h byteswap.h sys/byteorder.h sys/endian.h \
33 sys/param.h machine/endian.h alloca.h stdlib.h stdarg.h \
34 errno.h attr/xattr.h utime.h])
38 if test "x$am_cv_func_iconv" != "xyes"; then
39 AC_MSG_ERROR([Cannot find the iconv() function.
40 iconv() is used to convert between UTF-8 and UTF-16 encodings of WIM
41 filenames and XML data. Wimlib cannot be compiled without it. iconv()
42 is available in the latest version of glibc and sometimes in other
47 AC_ARG_WITH(pkgconfigdir,
48 [ --with-pkgconfigdir=DIR pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@],
49 [pkgconfigdir=$withval],
50 [pkgconfigdir='${libdir}/pkgconfig'])
51 AC_SUBST(pkgconfigdir)
53 AC_CHECK_LIB([xml2], [xmlParseFile], [have_libxml=true],
54 [AC_MSG_ERROR(["cannot find libxml2"])])
55 LIBXML2_LDADD=`pkg-config libxml-2.0 --libs`
56 LIBXML2_CFLAGS=`pkg-config libxml-2.0 --cflags`
57 AC_SUBST([LIBXML2_LDADD], [$LIBXML2_LDADD])
58 AC_SUBST([LIBXML2_CFLAGS], [$LIBXML2_CFLAGS])
60 AC_MSG_CHECKING([whether to include debugging messages])
61 AC_ARG_ENABLE([debug],
62 AS_HELP_STRING([--enable-debug], [include lots of debugging messages]),
63 [ENABLE_DEBUG=$enableval],
66 AC_MSG_RESULT([$ENABLE_DEBUG])
67 if test "x$ENABLE_DEBUG" = "xyes"; then
68 AC_DEFINE([ENABLE_DEBUG], [1],
69 [Define to 1 if including lots of debug messages.])
72 AC_MSG_CHECKING([whether to include more debugging messages])
73 AC_ARG_ENABLE([more_debug],
74 AS_HELP_STRING([--enable-more-debug],
75 [include even more debugging messages]),
76 [ENABLE_MORE_DEBUG=$enableval],
77 [ENABLE_MORE_DEBUG=no]
79 AC_MSG_RESULT([$ENABLE_MORE_DEBUG])
80 if test "x$ENABLE_MORE_DEBUG" = "xyes"; then
81 AC_DEFINE([ENABLE_MORE_DEBUG], [1],
82 [Define to 1 if including even more debug messages.])
85 AC_MSG_CHECKING([whether to include error messages])
86 AC_ARG_ENABLE([error_messages],
87 AS_HELP_STRING([--disable-error-messages],
88 [do not compile in error messsages]),
89 [ENABLE_ERROR_MESSAGES=$enableval],
90 [ENABLE_ERROR_MESSAGES=yes]
92 AC_MSG_RESULT([$ENABLE_ERROR_MESSAGES])
93 if test "x$ENABLE_ERROR_MESSAGES" = "xyes"; then
94 AC_DEFINE([ENABLE_ERROR_MESSAGES], [1],
95 [Define to 1 if including error messages])
98 AC_MSG_CHECKING([whether to support custom memory allocation functions])
99 AC_ARG_ENABLE([custom_memory_allocator],
100 AS_HELP_STRING([--disable-custom-memory-allocator],
101 [do not support the use of custom memory allocation
103 [ENABLE_CUSTOM_MEMORY_ALLOCATOR=$enableval],
104 [ENABLE_CUSTOM_MEMORY_ALLOCATOR=yes]
106 AC_MSG_RESULT([$ENABLE_CUSTOM_MEMORY_ALLOCATOR])
107 if test "x$ENABLE_CUSTOM_MEMORY_ALLOCATOR" = "xyes"; then
108 AC_DEFINE([ENABLE_CUSTOM_MEMORY_ALLOCATOR], [1],
109 [Define to 1 if supporting custom memory allocation functions])
112 AC_MSG_CHECKING([whether to include assertions])
113 AC_ARG_ENABLE([assertions],
114 AS_HELP_STRING([--disable-assertions], [do not include assertions]),
115 [ENABLE_ASSERTIONS=$enableval],
116 [ENABLE_ASSERTIONS=yes]
118 AC_MSG_RESULT([$ENABLE_ASSERTIONS])
119 if test "x$ENABLE_ASSERTIONS" = "xyes"; then
120 AC_DEFINE([ENABLE_ASSERTIONS], [1], [Define to 1 if including assertions.])
124 AC_MSG_CHECKING([whether to include compression verification])
125 AC_ARG_ENABLE([verify_compression],
126 AS_HELP_STRING([--disable-verify-compression], [disable
127 checking if blocks we compress can be correctly
129 [ENABLE_VERIFY_COMPRESSION=$enableval],
130 [ENABLE_VERIFY_COMPRESSION=yes]
132 AC_MSG_RESULT([$ENABLE_VERIFY_COMPRESSION])
133 if test "x$ENABLE_VERIFY_COMPRESSION" = "xyes"; then
134 AC_DEFINE([ENABLE_VERIFY_COMPRESSION], [1], [Define to 1 to verify
138 AC_MSG_CHECKING([whether to include support for multi-threaded compression])
139 AC_ARG_ENABLE([multithreaded-compression],
140 AS_HELP_STRING([--disable-multithreaded-compression],
141 [do not compile in the code for multi-threaded compression]),
142 [ENABLE_MULTITHREADED_COMPRESSION=$enableval],
143 [ENABLE_MULTITHREADED_COMPRESSION=yes]
145 AC_MSG_RESULT([$ENABLE_MULTITHREADED_COMPRESSION])
146 if test "x$ENABLE_MULTITHREADED_COMPRESSION" = "xyes"; then
147 AC_DEFINE([ENABLE_MULTITHREADED_COMPRESSION], [1],
148 [Define to 1 if including support for multithreaded
150 PTHREAD_LDADD="-lpthread"
154 AC_SUBST([PTHREAD_LDADD], [$PTHREAD_LDADD])
156 AC_MSG_CHECKING([whether to include support for ntfs-3g])
157 AC_ARG_WITH([ntfs-3g],
158 AS_HELP_STRING([--without-ntfs-3g], [build without NTFS-3g.
159 This will disable the ability to use NTFS-specific
160 information when capturing or applying WIMs to a
162 [WITH_NTFS_3G=$withval],
165 AC_MSG_RESULT([$WITH_NTFS_3G])
166 if test "x$WITH_NTFS_3G" = "xyes"; then
167 AC_DEFINE([WITH_NTFS_3G], [1], [Define to 1 to enable support for
168 NTFS-specific information])
170 AC_CHECK_LIB([ntfs-3g], [ntfs_xattr_system_setxattr], [],
171 [AC_MSG_ERROR([Cannot find libntfs-3g version 2011-4-12
172 or later. Without libntfs-3g, wimlib cannot include support for
173 capturing and applying WIMs on NTFS filesystems while preserving
174 NTFS-specific data such as security descriptors and alternate data
175 streams. You should either install libntfs-3g, or configure with
176 --without-ntfs-3g to disable support for these NTFS-specific
178 LIBNTFS_3G_LDADD="`pkg-config --libs libntfs-3g`"
179 LIBNTFS_3G_CFLAGS="`pkg-config --cflags libntfs-3g`"
184 AM_CONDITIONAL([WITH_NTFS_3G], [test "x$WITH_NTFS_3G" = "xyes"])
186 AC_SUBST([LIBNTFS_3G_LDADD], [$LIBNTFS_3G_LDADD])
187 AC_SUBST([LIBNTFS_3G_CFLAGS], [$LIBNTFS_3G_CFLAGS])
189 AC_MSG_CHECKING([whether to include support for mounting WIMs])
191 AS_HELP_STRING([--without-fuse], [build without libfuse.
192 This will disable the ability to mount
194 [WITH_FUSE=$withval],
197 AC_MSG_RESULT([$WITH_FUSE])
198 if test "x$WITH_FUSE" = "xyes"; then
199 AC_DEFINE([WITH_FUSE], [1], [Define to 1 if using FUSE.])
202 AC_CHECK_LIB([fuse], [fuse_main_real], [have_fuse=true],
203 [AC_MSG_ERROR([Cannot find libfuse.
204 Without libfuse, wimlib cannot include support for mounting WIMs. You
205 should either install libfuse, or configure with --without-fuse to
206 disable support for mounting WIMs.])
208 AC_CHECK_LIB([rt], [mq_open], [have_posix_mq=true],
209 [AC_MSG_ERROR([Cannot find librt for POSIX message queue
210 functions. Without these functions, wimlib cannot include support for
211 mounting WIMs. You should either update your C library to a recent
212 version of glibc, or configure with --without-fuse to disable support
215 LIBFUSE_LDADD="`pkg-config --libs fuse` -lrt"
216 LIBFUSE_CFLAGS="`pkg-config --cflags fuse`"
221 AM_CONDITIONAL([WITH_FUSE], [test "x$WITH_FUSE" = "xyes"])
222 AC_SUBST([LIBFUSE_LDADD], [$LIBFUSE_LDADD])
223 AC_SUBST([LIBFUSE_CFLAGS], [$LIBFUSE_CFLAGS])
226 AC_ARG_ENABLE([xattr],
227 [AS_HELP_STRING([--enable-xattr], [Enable the xattr interface to access WIM
228 alternate data streams (default: autodetect)])],
229 [ENABLE_XATTR=$enableval],
230 [AC_CHECK_FUNC([setxattr],
231 [AC_CHECK_HEADER([attr/xattr.h],
233 [AC_MSG_WARN([Cannot find the "attr/xattr.h" header. You will not be
234 able to use the xattr interface to access WIM alternate data
236 [AC_MSG_WARN([Cannot find the setxattr() function. You will not be
237 able to use the xattr interface to access WIM alternate data
240 if test "x$ENABLE_XATTR" = "xyes"; then
241 AC_DEFINE([ENABLE_XATTR], [1], [Define to 1 if using the xattr
242 interface to WIM alternate data streams])
245 AC_MSG_CHECKING([whether to use SSSE3-accelerated SHA1 ])
246 AC_ARG_ENABLE([ssse3-sha1],
247 AS_HELP_STRING([--enable-ssse3-sha1], [use assembly language implementation
248 of SHA1 from Intel, accelerated with vector
249 instructions (SSSE3-enabled CPU required)]),
250 [ENABLE_SSSE3_SHA1=$enableval],
251 [ENABLE_SSSE3_SHA1=no]
254 AC_MSG_RESULT([$ENABLE_SSSE3_SHA1])
255 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
256 AC_DEFINE([ENABLE_SSSE3_SHA1], [1],
257 [Define to 1 if using vectorized implementation of SHA1])
258 SSSE3_SHA1_OBJ=sha1-ssse3.lo
260 AC_SUBST([NASM], [$nasm])
264 AC_SUBST([SSSE3_SHA1_OBJ], [$SSSE3_SHA1_OBJ])
266 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
269 AC_ARG_WITH([libcrypto],
270 AS_HELP_STRING([--without-libcrypto], [build in the SHA1 algorithm,
271 rather than use external libcrypto from
272 OpenSSL (default is autodetect)]),
273 [WITH_LIBCRYPTO=$withval],
274 [AC_CHECK_LIB([crypto], [SHA1],
275 [WITH_LIBCRYPTO=yes],
276 [AC_MSG_WARN([Cannot find libcrypto: using stand-alone SHA1 code instead of OpenSSL])
280 AC_MSG_CHECKING([whether to use SHA1 function from system libcrypto])
281 AC_MSG_RESULT([$WITH_LIBCRYPTO])
283 if test "x$WITH_LIBCRYPTO" = "xyes" -a "x$ENABLE_SSSE3_SHA1" = "xno"; then
284 AC_DEFINE([WITH_LIBCRYPTO], [1], [Define to 1 if using libcrypto SHA1])
285 LIBCRYPTO_LDADD=`pkg-config --libs libcrypto 2>/dev/null`
286 if test $? -ne 0; then
287 LIBCRYPTO_LDADD=-lcrypto;
289 LIBCRYPTO_CFLAGS=`pkg-config --cflags libcrypto 2>/dev/null`
294 AC_SUBST([LIBCRYPTO_LDADD], [$LIBCRYPTO_LDADD])
295 AC_SUBST([LIBCRYPTO_CFLAGS], [$LIBCRYPTO_CFLAGS])
296 AC_SUBST([SHA1_SOURCES], [$SHA1_SOURCES])