1 AC_INIT([wimlib], [1.3.3], [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])
10 AC_ARG_WITH(imagex-progname,
11 [AS_HELP_STRING([--with-imagex-progname=NAME],
12 [Set the name of installed ImageX program (default: wimlib-imagex)])],
13 [IMAGEX_PROGNAME=$withval],
14 [IMAGEX_PROGNAME="wimlib-imagex"])
16 AC_SUBST([IMAGEX_PROGNAME], [$IMAGEX_PROGNAME])
17 AC_DEFINE_UNQUOTED([IMAGEX_PROGNAME], ["$IMAGEX_PROGNAME"],
18 [Binary name for the implementation of ImageX distributed with wimlib])
20 AC_CONFIG_HEADERS([config.h])
21 AC_CONFIG_FILES([Makefile]
24 [doc/"$IMAGEX_PROGNAME".1:doc/imagex.1.in]
25 [doc/"$IMAGEX_PROGNAME"-append.1:doc/imagex-append.1.in]
26 [doc/"$IMAGEX_PROGNAME"-apply.1:doc/imagex-apply.1.in]
27 [doc/"$IMAGEX_PROGNAME"-capture.1:doc/imagex-capture.1.in]
28 [doc/"$IMAGEX_PROGNAME"-delete.1:doc/imagex-delete.1.in]
29 [doc/"$IMAGEX_PROGNAME"-dir.1:doc/imagex-dir.1.in]
30 [doc/"$IMAGEX_PROGNAME"-export.1:doc/imagex-export.1.in]
31 [doc/"$IMAGEX_PROGNAME"-extract.1:doc/imagex-extract.1.in]
32 [doc/"$IMAGEX_PROGNAME"-info.1:doc/imagex-info.1.in]
33 [doc/"$IMAGEX_PROGNAME"-join.1:doc/imagex-join.1.in]
34 [doc/"$IMAGEX_PROGNAME"-mount.1:doc/imagex-mount.1.in]
35 [doc/"$IMAGEX_PROGNAME"-mountrw.1:doc/imagex-mountrw.1.in]
36 [doc/"$IMAGEX_PROGNAME"-optimize.1:doc/imagex-optimize.1.in]
37 [doc/"$IMAGEX_PROGNAME"-split.1:doc/imagex-split.1.in]
38 [doc/"$IMAGEX_PROGNAME"-unmount.1:doc/imagex-unmount.1.in]
41 AC_CONFIG_FILES([programs/mkwinpeimg], [chmod +x programs/mkwinpeimg])
47 AC_CHECK_FUNCS([utimensat lutimes utime flock])
48 AC_CHECK_HEADERS([endian.h byteswap.h sys/byteorder.h sys/endian.h \
49 sys/param.h machine/endian.h alloca.h stdlib.h stdarg.h \
50 errno.h attr/xattr.h utime.h sys/file.h glob.h])
52 AC_CHECK_MEMBER([struct stat.st_mtim],
53 [AC_DEFINE([HAVE_STAT_NANOSECOND_PRECISION], [1],
54 [Define to 1 if nanosecond precision timestamps are
57 [[#include <sys/stat.h>]])
60 AC_ARG_WITH(pkgconfigdir,
61 [ --with-pkgconfigdir=DIR pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@],
62 [pkgconfigdir=$withval],
63 [pkgconfigdir='${libdir}/pkgconfig'])
64 AC_SUBST(pkgconfigdir)
66 AC_CHECK_LIB([xml2], [xmlParseFile], [have_libxml=true],
67 [AC_MSG_ERROR(["cannot find libxml2"])])
68 LIBXML2_LDADD=`pkg-config libxml-2.0 --libs`
69 LIBXML2_CFLAGS=`pkg-config libxml-2.0 --cflags`
70 AC_SUBST([LIBXML2_LDADD], [$LIBXML2_LDADD])
71 AC_SUBST([LIBXML2_CFLAGS], [$LIBXML2_CFLAGS])
73 AC_MSG_CHECKING([whether to include debugging messages])
74 AC_ARG_ENABLE([debug],
75 AS_HELP_STRING([--enable-debug], [include lots of debugging messages]),
76 [ENABLE_DEBUG=$enableval],
79 AC_MSG_RESULT([$ENABLE_DEBUG])
80 if test "x$ENABLE_DEBUG" = "xyes"; then
81 AC_DEFINE([ENABLE_DEBUG], [1],
82 [Define to 1 if including lots of debug messages.])
85 AC_MSG_CHECKING([whether to include more debugging messages])
86 AC_ARG_ENABLE([more_debug],
87 AS_HELP_STRING([--enable-more-debug],
88 [include even more debugging messages]),
89 [ENABLE_MORE_DEBUG=$enableval],
90 [ENABLE_MORE_DEBUG=no]
92 AC_MSG_RESULT([$ENABLE_MORE_DEBUG])
93 if test "x$ENABLE_MORE_DEBUG" = "xyes"; then
94 AC_DEFINE([ENABLE_MORE_DEBUG], [1],
95 [Define to 1 if including even more debug messages.])
98 AC_MSG_CHECKING([whether to include error messages])
99 AC_ARG_ENABLE([error_messages],
100 AS_HELP_STRING([--disable-error-messages],
101 [do not compile in error messsages]),
102 [ENABLE_ERROR_MESSAGES=$enableval],
103 [ENABLE_ERROR_MESSAGES=yes]
105 AC_MSG_RESULT([$ENABLE_ERROR_MESSAGES])
106 if test "x$ENABLE_ERROR_MESSAGES" = "xyes"; then
107 AC_DEFINE([ENABLE_ERROR_MESSAGES], [1],
108 [Define to 1 if including error messages])
111 AC_MSG_CHECKING([whether to support custom memory allocation functions])
112 AC_ARG_ENABLE([custom_memory_allocator],
113 AS_HELP_STRING([--disable-custom-memory-allocator],
114 [do not support the use of custom memory allocation
116 [ENABLE_CUSTOM_MEMORY_ALLOCATOR=$enableval],
117 [ENABLE_CUSTOM_MEMORY_ALLOCATOR=yes]
119 AC_MSG_RESULT([$ENABLE_CUSTOM_MEMORY_ALLOCATOR])
120 if test "x$ENABLE_CUSTOM_MEMORY_ALLOCATOR" = "xyes"; then
121 AC_DEFINE([ENABLE_CUSTOM_MEMORY_ALLOCATOR], [1],
122 [Define to 1 if supporting custom memory allocation functions])
125 AC_MSG_CHECKING([whether to include assertions])
126 AC_ARG_ENABLE([assertions],
127 AS_HELP_STRING([--disable-assertions], [do not include assertions]),
128 [ENABLE_ASSERTIONS=$enableval],
129 [ENABLE_ASSERTIONS=yes]
131 AC_MSG_RESULT([$ENABLE_ASSERTIONS])
132 if test "x$ENABLE_ASSERTIONS" = "xyes"; then
133 AC_DEFINE([ENABLE_ASSERTIONS], [1], [Define to 1 if including assertions.])
136 AC_MSG_CHECKING([whether to include more assertions])
137 AC_ARG_ENABLE([more-assertions],
138 AS_HELP_STRING([--enable-more-assertions], [include even more assertions]),
139 [ENABLE_MORE_ASSERTIONS=$enableval],
140 [ENABLE_MORE_ASSERTIONS=no]
142 AC_MSG_RESULT([$ENABLE_MORE_ASSERTIONS])
143 if test "x$ENABLE_MORE_ASSERTIONS" = "xyes"; then
144 AC_DEFINE([ENABLE_MORE_ASSERTIONS], [1], [Define to 1 if including more assertions.])
148 AC_MSG_CHECKING([whether to include compression verification])
149 AC_ARG_ENABLE([verify_compression],
150 AS_HELP_STRING([--enable-verify-compression], [always
151 check if blocks we compress can be correctly
153 [ENABLE_VERIFY_COMPRESSION=$enableval],
154 [ENABLE_VERIFY_COMPRESSION=no]
156 AC_MSG_RESULT([$ENABLE_VERIFY_COMPRESSION])
157 if test "x$ENABLE_VERIFY_COMPRESSION" = "xyes"; then
158 AC_DEFINE([ENABLE_VERIFY_COMPRESSION], [1], [Define to 1 to verify
162 AC_MSG_CHECKING([whether to include support for multi-threaded compression])
163 AC_ARG_ENABLE([multithreaded-compression],
164 AS_HELP_STRING([--disable-multithreaded-compression],
165 [do not compile in the code for multi-threaded compression]),
166 [ENABLE_MULTITHREADED_COMPRESSION=$enableval],
167 [ENABLE_MULTITHREADED_COMPRESSION=yes]
169 AC_MSG_RESULT([$ENABLE_MULTITHREADED_COMPRESSION])
170 if test "x$ENABLE_MULTITHREADED_COMPRESSION" = "xyes"; then
171 AC_DEFINE([ENABLE_MULTITHREADED_COMPRESSION], [1],
172 [Define to 1 if including support for multithreaded
176 PTHREAD_LDADD="-lpthread"
177 AC_SUBST([PTHREAD_LDADD], [$PTHREAD_LDADD])
179 WITH_NTFS_3G_DEFAULT="yes"
180 WITH_FUSE_DEFAULT="yes"
181 WINDOWS_NATIVE_BUILD="no"
182 VISIBILITY_CFLAGS="-fvisibility=hidden"
191 WITH_NTFS_3G_DEFAULT="no"
192 WITH_FUSE_DEFAULT="no"
193 WINDOWS_NATIVE_BUILD="yes"
195 WINDOWS_CFLAGS="-municode"
196 WINDOWS_CPPFLAGS="-D_POSIX -DUNICODE -D_UNICODE"
197 WINDOWS_LDFLAGS="-no-undefined"
198 WINDOWS_LDADD="-lshlwapi"
201 # Cygwin (WARNING: not well supported)
202 AC_MSG_WARN([wimlib has not been tested with Cygwin! Please do
203 a Windows-native build with MinGW-w64 instead])
204 WITH_NTFS_3G_DEFAULT="no"
205 WITH_FUSE_DEFAULT="no"
213 AC_SUBST([VISIBILITY_CFLAGS], [$VISIBILITY_CFLAGS])
214 AC_SUBST([WINDOWS_LDFLAGS], [$WINDOWS_LDFLAGS])
215 AC_SUBST([WINDOWS_LDADD], [$WINDOWS_LDADD])
216 AC_SUBST([WINDOWS_CPPFLAGS], [$WINDOWS_CPPFLAGS])
217 AC_SUBST([WINDOWS_CFLAGS], [$WINDOWS_CFLAGS])
218 AM_CONDITIONAL([WINDOWS_NATIVE_BUILD], [test "x$WINDOWS_NATIVE_BUILD" = "xyes"])
220 AC_MSG_CHECKING([whether to include support for ntfs-3g])
221 AC_ARG_WITH([ntfs-3g],
222 AS_HELP_STRING([--without-ntfs-3g], [build without NTFS-3g.
223 This will disable the ability to use NTFS-specific
224 information when capturing or applying WIMs to a
226 [WITH_NTFS_3G=$withval],
227 [WITH_NTFS_3G=$WITH_NTFS_3G_DEFAULT]
229 AC_MSG_RESULT([$WITH_NTFS_3G])
230 if test "x$WITH_NTFS_3G" = "xyes"; then
231 AC_DEFINE([WITH_NTFS_3G], [1], [Define to 1 to enable support for
232 NTFS-specific information])
234 dnl This effectively checks for NTFS-3g 2011.4.12 or later
235 AC_CHECK_LIB([ntfs-3g], [ntfs_xattr_system_setxattr], [],
236 [AC_MSG_ERROR([Cannot find libntfs-3g version 2011-4-12
237 or later. Without libntfs-3g, wimlib cannot include support for
238 capturing and applying WIMs on NTFS filesystems while preserving
239 NTFS-specific data such as security descriptors and alternate data
240 streams. You should either install libntfs-3g, or configure with
241 --without-ntfs-3g to disable support for these NTFS-specific
243 LIBNTFS_3G_LDADD="`pkg-config --libs libntfs-3g`"
244 LIBNTFS_3G_CFLAGS="`pkg-config --cflags libntfs-3g`"
246 dnl This checks for a NTFS-3g interface that was changed in the
247 dnl 2013.1.13 release
248 AC_CHECK_DECL([NTFS_MNT_RDONLY],
249 [AC_DEFINE([HAVE_NTFS_MNT_RDONLY],
251 [Define to 1 if ntfs_mount() takes the flag NTFS_MNT_RDONLY])],
253 [#include <ntfs-3g/volume.h>])
259 AM_CONDITIONAL([WITH_NTFS_3G], [test "x$WITH_NTFS_3G" = "xyes"])
261 AC_SUBST([LIBNTFS_3G_LDADD], [$LIBNTFS_3G_LDADD])
262 AC_SUBST([LIBNTFS_3G_CFLAGS], [$LIBNTFS_3G_CFLAGS])
265 if test "x$am_cv_func_iconv" != "xyes"; then
266 AC_MSG_ERROR([Cannot find the iconv() function.
267 iconv() is used to convert between encodings of WIM filenames and XML data.
268 wimlib cannot be compiled without it. iconv() is available in the latest
269 version of glibc and sometimes in other libraries.])
272 AC_MSG_CHECKING([whether to include support for mounting WIMs])
274 AS_HELP_STRING([--without-fuse], [build without libfuse.
275 This will disable the ability to mount
277 [WITH_FUSE=$withval],
278 [WITH_FUSE=$WITH_FUSE_DEFAULT]
280 AC_MSG_RESULT([$WITH_FUSE])
281 if test "x$WITH_FUSE" = "xyes"; then
282 AC_DEFINE([WITH_FUSE], [1], [Define to 1 if using FUSE.])
285 AC_CHECK_LIB([fuse], [fuse_main_real], [have_fuse=true],
286 [AC_MSG_ERROR([Cannot find libfuse.
287 Without libfuse, wimlib cannot include support for mounting WIMs. You
288 should either install libfuse, or configure with --without-fuse to
289 disable support for mounting WIMs.])
291 AC_CHECK_LIB([rt], [mq_open], [have_posix_mq=true],
292 [AC_MSG_ERROR([Cannot find librt for POSIX message queue
293 functions. Without these functions, wimlib cannot include support for
294 mounting WIMs. You should either update your C library to a recent
295 version of glibc, or configure with --without-fuse to disable support
298 LIBFUSE_LDADD="`pkg-config --libs fuse` -lrt"
299 LIBFUSE_CFLAGS="`pkg-config --cflags fuse`"
304 AM_CONDITIONAL([WITH_FUSE], [test "x$WITH_FUSE" = "xyes"])
305 AC_SUBST([LIBFUSE_LDADD], [$LIBFUSE_LDADD])
306 AC_SUBST([LIBFUSE_CFLAGS], [$LIBFUSE_CFLAGS])
309 AC_ARG_ENABLE([xattr],
310 [AS_HELP_STRING([--enable-xattr], [Enable the xattr interface to access WIM
311 alternate data streams (default: autodetect)])],
312 [ENABLE_XATTR=$enableval],
313 [AC_CHECK_FUNC([setxattr],
314 [AC_CHECK_HEADER([attr/xattr.h],
316 [AC_MSG_WARN([Cannot find the "attr/xattr.h" header. You will not be
317 able to use the xattr interface to access WIM alternate data
319 [AC_MSG_WARN([Cannot find the setxattr() function. You will not be
320 able to use the xattr interface to access WIM alternate data
323 if test "x$ENABLE_XATTR" = "xyes"; then
324 AC_DEFINE([ENABLE_XATTR], [1], [Define to 1 if using the xattr
325 interface to WIM alternate data streams])
328 AC_MSG_CHECKING([whether to use SSSE3-accelerated SHA1 ])
329 AC_ARG_ENABLE([ssse3-sha1],
330 AS_HELP_STRING([--enable-ssse3-sha1], [use assembly language implementation
331 of SHA1 from Intel, accelerated with vector
332 instructions (SSSE3-enabled CPU required)]),
333 [ENABLE_SSSE3_SHA1=$enableval],
334 [ENABLE_SSSE3_SHA1=no]
337 AC_MSG_RESULT([$ENABLE_SSSE3_SHA1])
338 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
339 AC_DEFINE([ENABLE_SSSE3_SHA1], [1],
340 [Define to 1 if using vectorized implementation of SHA1])
341 SSSE3_SHA1_OBJ=sha1-ssse3.lo
343 AC_SUBST([NASM], [$nasm])
347 AC_SUBST([SSSE3_SHA1_OBJ], [$SSSE3_SHA1_OBJ])
349 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
352 AC_ARG_WITH([libcrypto],
353 AS_HELP_STRING([--without-libcrypto], [build in the SHA1 algorithm,
354 rather than use external libcrypto from
355 OpenSSL (default is autodetect)]),
356 [WITH_LIBCRYPTO=$withval],
357 [AC_CHECK_LIB([crypto], [SHA1],
358 [WITH_LIBCRYPTO=yes],
359 [AC_MSG_WARN([Cannot find libcrypto: using stand-alone SHA1 code instead of OpenSSL])
363 AC_MSG_CHECKING([whether to use SHA1 function from system libcrypto])
364 AC_MSG_RESULT([$WITH_LIBCRYPTO])
366 if test "x$WITH_LIBCRYPTO" = "xyes" -a "x$ENABLE_SSSE3_SHA1" = "xno"; then
367 AC_DEFINE([WITH_LIBCRYPTO], [1], [Define to 1 if using libcrypto SHA1])
368 LIBCRYPTO_LDADD=`pkg-config --libs libcrypto 2>/dev/null`
369 if test $? -ne 0; then
370 LIBCRYPTO_LDADD=-lcrypto;
372 LIBCRYPTO_CFLAGS=`pkg-config --cflags libcrypto 2>/dev/null`
377 AC_SUBST([LIBCRYPTO_LDADD], [$LIBCRYPTO_LDADD])
378 AC_SUBST([LIBCRYPTO_CFLAGS], [$LIBCRYPTO_CFLAGS])
379 AC_SUBST([SHA1_SOURCES], [$SHA1_SOURCES])