1 AC_INIT([wimlib], [1.0.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
35 if test "x$am_cv_func_iconv" != "xyes"; then
36 AC_MSG_ERROR([Cannot find the iconv() function.
37 iconv() is used to convert between UTF-8 and UTF-16 encodings of WIM
38 filenames and XML data. Wimlib cannot be compiled without it. iconv()
39 is available in the latest version of glibc and sometimes in other
43 AC_ARG_WITH(pkgconfigdir,
44 [ --with-pkgconfigdir=DIR pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@],
45 [pkgconfigdir=$withval],
46 [pkgconfigdir='${libdir}/pkgconfig'])
47 AC_SUBST(pkgconfigdir)
49 AC_CHECK_LIB([xml2], [xmlParseFile], [have_libxml=true],
50 [AC_MSG_ERROR(["cannot find libxml2"])])
51 LIBXML2_LDADD=`pkg-config libxml-2.0 --libs`
52 LIBXML2_CFLAGS=`pkg-config libxml-2.0 --cflags`
53 AC_SUBST([LIBXML2_LDADD], [$LIBXML2_LDADD])
54 AC_SUBST([LIBXML2_CFLAGS], [$LIBXML2_CFLAGS])
56 AC_MSG_CHECKING([whether to include debugging messages])
57 AC_ARG_ENABLE([debug],
58 AS_HELP_STRING([--enable-debug], [include lots of debugging messages]),
59 [ENABLE_DEBUG=$enableval],
62 AC_MSG_RESULT([$ENABLE_DEBUG])
63 if test "x$ENABLE_DEBUG" = "xyes"; then
64 AC_DEFINE([ENABLE_DEBUG], [1],
65 [Define to 1 if including lots of debug messages.])
68 AC_MSG_CHECKING([whether to include more debugging messages])
69 AC_ARG_ENABLE([more_debug],
70 AS_HELP_STRING([--enable-more-debug],
71 [include even more debugging messages]),
72 [ENABLE_MORE_DEBUG=$enableval],
73 [ENABLE_MORE_DEBUG=no]
75 AC_MSG_RESULT([$ENABLE_MORE_DEBUG])
76 if test "x$ENABLE_MORE_DEBUG" = "xyes"; then
77 AC_DEFINE([ENABLE_MORE_DEBUG], [1],
78 [Define to 1 if including even more debug messages.])
81 AC_MSG_CHECKING([whether to include error messages])
82 AC_ARG_ENABLE([error_messages],
83 AS_HELP_STRING([--disable-error-messages],
84 [do not compile in error messsages]),
85 [ENABLE_ERROR_MESSAGES=$enableval],
86 [ENABLE_ERROR_MESSAGES=yes]
88 AC_MSG_RESULT([$ENABLE_ERROR_MESSAGES])
89 if test "x$ENABLE_ERROR_MESSAGES" = "xyes"; then
90 AC_DEFINE([ENABLE_ERROR_MESSAGES], [1],
91 [Define to 1 if including error messages])
94 AC_MSG_CHECKING([whether to support custom memory allocation functions])
95 AC_ARG_ENABLE([custom_memory_allocator],
96 AS_HELP_STRING([--disable-custom-memory-allocator],
97 [do not support the use of custom memory allocation
99 [ENABLE_CUSTOM_MEMORY_ALLOCATOR=$enableval],
100 [ENABLE_CUSTOM_MEMORY_ALLOCATOR=yes]
102 AC_MSG_RESULT([$ENABLE_CUSTOM_MEMORY_ALLOCATOR])
103 if test "x$ENABLE_CUSTOM_MEMORY_ALLOCATOR" = "xyes"; then
104 AC_DEFINE([ENABLE_CUSTOM_MEMORY_ALLOCATOR], [1],
105 [Define to 1 if supporting custom memory allocation functions])
108 AC_MSG_CHECKING([whether to include assertions])
109 AC_ARG_ENABLE([assertions],
110 AS_HELP_STRING([--disable-assertions], [do not include assertions]),
111 [ENABLE_ASSERTIONS=$enableval],
112 [ENABLE_ASSERTIONS=yes]
114 AC_MSG_RESULT([$ENABLE_ASSERTIONS])
115 if test "x$ENABLE_ASSERTIONS" = "xyes"; then
116 AC_DEFINE([ENABLE_ASSERTIONS], [1], [Define to 1 if including assertions.])
120 AC_MSG_CHECKING([whether to include compression verification])
121 AC_ARG_ENABLE([verify_compression],
122 AS_HELP_STRING([--disable-verify-compression], [disable
123 checking if blocks we compress can be correctly
125 [ENABLE_VERIFY_COMPRESSION=$enableval],
126 [ENABLE_VERIFY_COMPRESSION=yes]
128 AC_MSG_RESULT([$ENABLE_VERIFY_COMPRESSION])
129 if test "x$ENABLE_VERIFY_COMPRESSION" = "xyes"; then
130 AC_DEFINE([ENABLE_VERIFY_COMPRESSION], [1], [Define to 1 to verify
134 AC_MSG_CHECKING([whether to include support for ntfs-3g])
135 AC_ARG_WITH([ntfs-3g],
136 AS_HELP_STRING([--without-ntfs-3g], [build without NTFS-3g.
137 This will disable the ability to use NTFS-specific
138 information when capturing or applying WIMs to a
140 [WITH_NTFS_3G=$withval],
143 AC_MSG_RESULT([$WITH_NTFS_3G])
144 if test "x$WITH_NTFS_3G" = "xyes"; then
145 AC_DEFINE([WITH_NTFS_3G], [1], [Define to 1 to enable support for
146 NTFS-specific information])
148 AC_CHECK_LIB([ntfs-3g], [ntfs_set_file_security], [],
149 [AC_MSG_ERROR([Cannot find libntfs-3g.
150 Without libntfs-3g, wimlib cannot include support for capturing and
151 applying WIMs on NTFS filesystems while preserving NTFS-specific data
152 such as security descriptors and alternate data streams. You should
153 either install libntfs-3g, or configure with --without-ntfs-3g to
154 disable support for these NTFS-specific features.])])
155 LIBNTFS_3G_LDADD="`pkg-config --libs libntfs-3g`"
156 LIBNTFS_3G_CFLAGS="`pkg-config --cflags libntfs-3g`"
161 AM_CONDITIONAL([WITH_NTFS_3G], [test "x$WITH_NTFS_3G" = "xyes"])
163 AC_SUBST([LIBNTFS_3G_LDADD], [$LIBNTFS_3G_LDADD])
164 AC_SUBST([LIBNTFS_3G_CFLAGS], [$LIBNTFS_3G_CFLAGS])
166 AC_MSG_CHECKING([whether to use patched upstream libntfs-3g])
167 AC_ARG_WITH([new-ntfs-3g],
168 [AS_HELP_STRING([--with-new-ntfs-3g], [build using patched upstream
169 NTFS-3g instead of version 2012-1-15])],
170 [WITH_NEW_NTFS_3G=$withval],
171 [WITH_NEW_NTFS_3G=no]
174 AC_MSG_RESULT([$WITH_NEW_NTFS_3G])
175 if test "x$WITH_NEW_NTFS_3G" = "xyes"; then
176 if test "x$WITH_NTFS_3G" != "xyes"; then
177 AC_MSG_ERROR([Cannot use new NTFS-3g if configuring
180 AC_DEFINE([WITH_NEW_NTFS_3G], [1], [Define to 1 to use patched upstream
181 NTFS-3g instead of version 2012-1-15])
183 AM_CONDITIONAL([WITH_NEW_NTFS_3G], [test "x$WITH_NEW_NTFS_3G" = "xyes"])
185 AC_MSG_CHECKING([whether to include support for mounting WIMs])
187 AS_HELP_STRING([--without-fuse], [build without libfuse.
188 This will disable the ability to mount
190 [WITH_FUSE=$withval],
193 AC_MSG_RESULT([$WITH_FUSE])
194 if test "x$WITH_FUSE" = "xyes"; then
195 AC_DEFINE([WITH_FUSE], [1], [Define to 1 if using FUSE.])
198 AC_CHECK_LIB([fuse], [fuse_main_real], [have_fuse=true],
199 [AC_MSG_ERROR([Cannot find libfuse.
200 Without libfuse, wimlib cannot include support for mounting WIMs. You
201 should either install libfuse, or configure with --without-fuse to
202 disable support for mounting WIMs.])
204 AC_CHECK_LIB([rt], [mq_open], [have_posix_mq=true],
205 [AC_MSG_ERROR([Cannot find librt for POSIX message queue
206 functions. Without these functions, wimlib cannot include support for
207 mounting WIMs. You should either update your C library to a recent
208 version of glibc, or configure with --without-fuse to disable support
211 LIBFUSE_LDADD="`pkg-config --libs fuse` -lrt"
212 LIBFUSE_CFLAGS="`pkg-config --cflags fuse`"
217 AC_SUBST([LIBFUSE_LDADD], [$LIBFUSE_LDADD])
218 AC_SUBST([LIBFUSE_CFLAGS], [$LIBFUSE_CFLAGS])
221 AC_ARG_ENABLE([xattr],
222 [AS_HELP_STRING([--enable-xattr], [Enable the xattr interface to access WIM
223 alternate data streams (default: autodetect)])],
224 [ENABLE_XATTR=$enableval],
225 [AC_CHECK_FUNC([setxattr],
226 [AC_CHECK_HEADER([attr/xattr.h],
228 [AC_MSG_WARN([Cannot find the "attr/xattr.h" header. You will not be
229 able to use the xattr interface to access WIM alternate data
231 [AC_MSG_WARN([Cannot find the setxattr() function. You will not be
232 able to use the xattr interface to access WIM alternate data
235 if test "x$ENABLE_XATTR" = "xyes"; then
236 AC_DEFINE([ENABLE_XATTR], [1], [Define to 1 if using the xattr
237 interface to WIM alternate data streams])
240 AC_MSG_CHECKING([whether to use SSSE3-accelerated SHA1 ])
241 AC_ARG_ENABLE([ssse3-sha1],
242 AS_HELP_STRING([--enable-ssse3-sha1], [use assembly language implementation
243 of SHA1 from Intel, accelerated with vector
244 instructions (SSSE3-enabled CPU required)]),
245 [ENABLE_SSSE3_SHA1=$enableval],
246 [ENABLE_SSSE3_SHA1=no]
249 AC_MSG_RESULT([$ENABLE_SSSE3_SHA1])
250 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
251 AC_DEFINE([ENABLE_SSSE3_SHA1], [1],
252 [Define to 1 if using vectorized implementation of SHA1])
253 SSSE3_SHA1_OBJ=sha1-ssse3.lo
255 AC_SUBST([NASM], [$nasm])
259 AC_SUBST([SSSE3_SHA1_OBJ], [$SSSE3_SHA1_OBJ])
261 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
264 AC_ARG_WITH([libcrypto],
265 AS_HELP_STRING([--without-libcrypto], [build in the SHA1 algorithm,
266 rather than use external libcrypto from
267 OpenSSL (default is autodetect)]),
268 [WITH_LIBCRYPTO=$withval],
269 [AC_CHECK_LIB([crypto], [SHA1],
270 [WITH_LIBCRYPTO=yes],
271 [AC_MSG_WARN([Cannot find libcrypto: using stand-alone SHA1 code instead of OpenSSL])
275 AC_MSG_CHECKING([whether to use SHA1 function from system libcrypto])
276 AC_MSG_RESULT([$WITH_LIBCRYPTO])
278 if test "x$WITH_LIBCRYPTO" = "xyes" -a "x$ENABLE_SSSE3_SHA1" = "xno"; then
279 AC_DEFINE([WITH_LIBCRYPTO], [1], [Define to 1 if using libcrypto SHA1])
280 LIBCRYPTO_LDADD=`pkg-config --libs libcrypto 2>/dev/null`
281 if test $? -ne 0; then
282 LIBCRYPTO_LDADD=-lcrypto;
284 LIBCRYPTO_CFLAGS=`pkg-config --cflags libcrypto 2>/dev/null`
289 AC_SUBST([LIBCRYPTO_LDADD], [$LIBCRYPTO_LDADD])
290 AC_SUBST([LIBCRYPTO_CFLAGS], [$LIBCRYPTO_CFLAGS])
291 AC_SUBST([SHA1_SOURCES], [$SHA1_SOURCES])