1 AC_INIT([wimlib], [1.3.2], [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"-info.1:doc/imagex-info.1.in]
32 [doc/"$IMAGEX_PROGNAME"-join.1:doc/imagex-join.1.in]
33 [doc/"$IMAGEX_PROGNAME"-mount.1:doc/imagex-mount.1.in]
34 [doc/"$IMAGEX_PROGNAME"-mountrw.1:doc/imagex-mountrw.1.in]
35 [doc/"$IMAGEX_PROGNAME"-optimize.1:doc/imagex-optimize.1.in]
36 [doc/"$IMAGEX_PROGNAME"-split.1:doc/imagex-split.1.in]
37 [doc/"$IMAGEX_PROGNAME"-unmount.1:doc/imagex-unmount.1.in]
40 AC_CONFIG_FILES([programs/mkwinpeimg], [chmod +x programs/mkwinpeimg])
46 AC_CHECK_FUNCS([utimensat lutimes utime flock])
47 AC_CHECK_HEADERS([endian.h byteswap.h sys/byteorder.h sys/endian.h \
48 sys/param.h machine/endian.h alloca.h stdlib.h stdarg.h \
49 errno.h attr/xattr.h utime.h sys/file.h glob.h])
51 AC_CHECK_MEMBER([struct stat.st_mtim],
52 [AC_DEFINE([HAVE_STAT_NANOSECOND_PRECISION], [1],
53 [Define to 1 if nanosecond precision timestamps are
56 [[#include <sys/stat.h>]])
59 AC_ARG_WITH(pkgconfigdir,
60 [ --with-pkgconfigdir=DIR pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@],
61 [pkgconfigdir=$withval],
62 [pkgconfigdir='${libdir}/pkgconfig'])
63 AC_SUBST(pkgconfigdir)
65 AC_CHECK_LIB([xml2], [xmlParseFile], [have_libxml=true],
66 [AC_MSG_ERROR(["cannot find libxml2"])])
67 LIBXML2_LDADD=`pkg-config libxml-2.0 --libs`
68 LIBXML2_CFLAGS=`pkg-config libxml-2.0 --cflags`
69 AC_SUBST([LIBXML2_LDADD], [$LIBXML2_LDADD])
70 AC_SUBST([LIBXML2_CFLAGS], [$LIBXML2_CFLAGS])
72 AC_MSG_CHECKING([whether to include debugging messages])
73 AC_ARG_ENABLE([debug],
74 AS_HELP_STRING([--enable-debug], [include lots of debugging messages]),
75 [ENABLE_DEBUG=$enableval],
78 AC_MSG_RESULT([$ENABLE_DEBUG])
79 if test "x$ENABLE_DEBUG" = "xyes"; then
80 AC_DEFINE([ENABLE_DEBUG], [1],
81 [Define to 1 if including lots of debug messages.])
84 AC_MSG_CHECKING([whether to include more debugging messages])
85 AC_ARG_ENABLE([more_debug],
86 AS_HELP_STRING([--enable-more-debug],
87 [include even more debugging messages]),
88 [ENABLE_MORE_DEBUG=$enableval],
89 [ENABLE_MORE_DEBUG=no]
91 AC_MSG_RESULT([$ENABLE_MORE_DEBUG])
92 if test "x$ENABLE_MORE_DEBUG" = "xyes"; then
93 AC_DEFINE([ENABLE_MORE_DEBUG], [1],
94 [Define to 1 if including even more debug messages.])
97 AC_MSG_CHECKING([whether to include error messages])
98 AC_ARG_ENABLE([error_messages],
99 AS_HELP_STRING([--disable-error-messages],
100 [do not compile in error messsages]),
101 [ENABLE_ERROR_MESSAGES=$enableval],
102 [ENABLE_ERROR_MESSAGES=yes]
104 AC_MSG_RESULT([$ENABLE_ERROR_MESSAGES])
105 if test "x$ENABLE_ERROR_MESSAGES" = "xyes"; then
106 AC_DEFINE([ENABLE_ERROR_MESSAGES], [1],
107 [Define to 1 if including error messages])
110 AC_MSG_CHECKING([whether to support custom memory allocation functions])
111 AC_ARG_ENABLE([custom_memory_allocator],
112 AS_HELP_STRING([--disable-custom-memory-allocator],
113 [do not support the use of custom memory allocation
115 [ENABLE_CUSTOM_MEMORY_ALLOCATOR=$enableval],
116 [ENABLE_CUSTOM_MEMORY_ALLOCATOR=yes]
118 AC_MSG_RESULT([$ENABLE_CUSTOM_MEMORY_ALLOCATOR])
119 if test "x$ENABLE_CUSTOM_MEMORY_ALLOCATOR" = "xyes"; then
120 AC_DEFINE([ENABLE_CUSTOM_MEMORY_ALLOCATOR], [1],
121 [Define to 1 if supporting custom memory allocation functions])
124 AC_MSG_CHECKING([whether to include assertions])
125 AC_ARG_ENABLE([assertions],
126 AS_HELP_STRING([--disable-assertions], [do not include assertions]),
127 [ENABLE_ASSERTIONS=$enableval],
128 [ENABLE_ASSERTIONS=yes]
130 AC_MSG_RESULT([$ENABLE_ASSERTIONS])
131 if test "x$ENABLE_ASSERTIONS" = "xyes"; then
132 AC_DEFINE([ENABLE_ASSERTIONS], [1], [Define to 1 if including assertions.])
135 AC_MSG_CHECKING([whether to include more assertions])
136 AC_ARG_ENABLE([more-assertions],
137 AS_HELP_STRING([--enable-more-assertions], [include even more assertions]),
138 [ENABLE_MORE_ASSERTIONS=$enableval],
139 [ENABLE_MORE_ASSERTIONS=no]
141 AC_MSG_RESULT([$ENABLE_MORE_ASSERTIONS])
142 if test "x$ENABLE_MORE_ASSERTIONS" = "xyes"; then
143 AC_DEFINE([ENABLE_MORE_ASSERTIONS], [1], [Define to 1 if including more assertions.])
147 AC_MSG_CHECKING([whether to include compression verification])
148 AC_ARG_ENABLE([verify_compression],
149 AS_HELP_STRING([--disable-verify-compression], [disable
150 checking if blocks we compress can be correctly
152 [ENABLE_VERIFY_COMPRESSION=$enableval],
153 [ENABLE_VERIFY_COMPRESSION=yes]
155 AC_MSG_RESULT([$ENABLE_VERIFY_COMPRESSION])
156 if test "x$ENABLE_VERIFY_COMPRESSION" = "xyes"; then
157 AC_DEFINE([ENABLE_VERIFY_COMPRESSION], [1], [Define to 1 to verify
161 AC_MSG_CHECKING([whether to include support for multi-threaded compression])
162 AC_ARG_ENABLE([multithreaded-compression],
163 AS_HELP_STRING([--disable-multithreaded-compression],
164 [do not compile in the code for multi-threaded compression]),
165 [ENABLE_MULTITHREADED_COMPRESSION=$enableval],
166 [ENABLE_MULTITHREADED_COMPRESSION=yes]
168 AC_MSG_RESULT([$ENABLE_MULTITHREADED_COMPRESSION])
169 if test "x$ENABLE_MULTITHREADED_COMPRESSION" = "xyes"; then
170 AC_DEFINE([ENABLE_MULTITHREADED_COMPRESSION], [1],
171 [Define to 1 if including support for multithreaded
175 PTHREAD_LDADD="-lpthread"
176 AC_SUBST([PTHREAD_LDADD], [$PTHREAD_LDADD])
178 WITH_NTFS_3G_DEFAULT="yes"
179 WITH_FUSE_DEFAULT="yes"
180 WINDOWS_NATIVE_BUILD="no"
181 VISIBILITY_CFLAGS="-fvisibility=hidden"
190 WITH_NTFS_3G_DEFAULT="no"
191 WITH_FUSE_DEFAULT="no"
192 WINDOWS_NATIVE_BUILD="yes"
194 WINDOWS_CFLAGS="-municode"
195 WINDOWS_CPPFLAGS="-D_POSIX -DUNICODE -D_UNICODE"
196 WINDOWS_LDFLAGS="-no-undefined"
197 WINDOWS_LDADD="-lshlwapi"
200 # Cygwin (WARNING: not well supported)
201 AC_MSG_WARN([wimlib has not been tested with Cygwin! Please do
202 a Windows-native build with MinGW-w64 instead])
203 WITH_NTFS_3G_DEFAULT="no"
204 WITH_FUSE_DEFAULT="no"
212 AC_SUBST([VISIBILITY_CFLAGS], [$VISIBILITY_CFLAGS])
213 AC_SUBST([WINDOWS_LDFLAGS], [$WINDOWS_LDFLAGS])
214 AC_SUBST([WINDOWS_LDADD], [$WINDOWS_LDADD])
215 AC_SUBST([WINDOWS_CPPFLAGS], [$WINDOWS_CPPFLAGS])
216 AC_SUBST([WINDOWS_CFLAGS], [$WINDOWS_CFLAGS])
217 AM_CONDITIONAL([WINDOWS_NATIVE_BUILD], [test "x$WINDOWS_NATIVE_BUILD" = "xyes"])
219 AC_MSG_CHECKING([whether to include support for ntfs-3g])
220 AC_ARG_WITH([ntfs-3g],
221 AS_HELP_STRING([--without-ntfs-3g], [build without NTFS-3g.
222 This will disable the ability to use NTFS-specific
223 information when capturing or applying WIMs to a
225 [WITH_NTFS_3G=$withval],
226 [WITH_NTFS_3G=$WITH_NTFS_3G_DEFAULT]
228 AC_MSG_RESULT([$WITH_NTFS_3G])
229 if test "x$WITH_NTFS_3G" = "xyes"; then
230 AC_DEFINE([WITH_NTFS_3G], [1], [Define to 1 to enable support for
231 NTFS-specific information])
233 dnl This effectively checks for NTFS-3g 2011.4.12 or later
234 AC_CHECK_LIB([ntfs-3g], [ntfs_xattr_system_setxattr], [],
235 [AC_MSG_ERROR([Cannot find libntfs-3g version 2011-4-12
236 or later. Without libntfs-3g, wimlib cannot include support for
237 capturing and applying WIMs on NTFS filesystems while preserving
238 NTFS-specific data such as security descriptors and alternate data
239 streams. You should either install libntfs-3g, or configure with
240 --without-ntfs-3g to disable support for these NTFS-specific
242 LIBNTFS_3G_LDADD="`pkg-config --libs libntfs-3g`"
243 LIBNTFS_3G_CFLAGS="`pkg-config --cflags libntfs-3g`"
245 dnl This checks for a NTFS-3g interface that was changed in the
246 dnl 2013.1.13 release
247 AC_CHECK_DECL([NTFS_MNT_RDONLY],
248 [AC_DEFINE([HAVE_NTFS_MNT_RDONLY],
250 [Define to 1 if ntfs_mount() takes the flag NTFS_MNT_RDONLY])],
252 [#include <ntfs-3g/volume.h>])
258 AM_CONDITIONAL([WITH_NTFS_3G], [test "x$WITH_NTFS_3G" = "xyes"])
260 AC_SUBST([LIBNTFS_3G_LDADD], [$LIBNTFS_3G_LDADD])
261 AC_SUBST([LIBNTFS_3G_CFLAGS], [$LIBNTFS_3G_CFLAGS])
264 if test "x$am_cv_func_iconv" != "xyes"; then
265 AC_MSG_ERROR([Cannot find the iconv() function.
266 iconv() is used to convert between encodings of WIM filenames and XML data.
267 wimlib cannot be compiled without it. iconv() is available in the latest
268 version of glibc and sometimes in other libraries.])
271 AC_MSG_CHECKING([whether to include support for mounting WIMs])
273 AS_HELP_STRING([--without-fuse], [build without libfuse.
274 This will disable the ability to mount
276 [WITH_FUSE=$withval],
277 [WITH_FUSE=$WITH_FUSE_DEFAULT]
279 AC_MSG_RESULT([$WITH_FUSE])
280 if test "x$WITH_FUSE" = "xyes"; then
281 AC_DEFINE([WITH_FUSE], [1], [Define to 1 if using FUSE.])
284 AC_CHECK_LIB([fuse], [fuse_main_real], [have_fuse=true],
285 [AC_MSG_ERROR([Cannot find libfuse.
286 Without libfuse, wimlib cannot include support for mounting WIMs. You
287 should either install libfuse, or configure with --without-fuse to
288 disable support for mounting WIMs.])
290 AC_CHECK_LIB([rt], [mq_open], [have_posix_mq=true],
291 [AC_MSG_ERROR([Cannot find librt for POSIX message queue
292 functions. Without these functions, wimlib cannot include support for
293 mounting WIMs. You should either update your C library to a recent
294 version of glibc, or configure with --without-fuse to disable support
297 LIBFUSE_LDADD="`pkg-config --libs fuse` -lrt"
298 LIBFUSE_CFLAGS="`pkg-config --cflags fuse`"
303 AM_CONDITIONAL([WITH_FUSE], [test "x$WITH_FUSE" = "xyes"])
304 AC_SUBST([LIBFUSE_LDADD], [$LIBFUSE_LDADD])
305 AC_SUBST([LIBFUSE_CFLAGS], [$LIBFUSE_CFLAGS])
308 AC_ARG_ENABLE([xattr],
309 [AS_HELP_STRING([--enable-xattr], [Enable the xattr interface to access WIM
310 alternate data streams (default: autodetect)])],
311 [ENABLE_XATTR=$enableval],
312 [AC_CHECK_FUNC([setxattr],
313 [AC_CHECK_HEADER([attr/xattr.h],
315 [AC_MSG_WARN([Cannot find the "attr/xattr.h" header. You will not be
316 able to use the xattr interface to access WIM alternate data
318 [AC_MSG_WARN([Cannot find the setxattr() function. You will not be
319 able to use the xattr interface to access WIM alternate data
322 if test "x$ENABLE_XATTR" = "xyes"; then
323 AC_DEFINE([ENABLE_XATTR], [1], [Define to 1 if using the xattr
324 interface to WIM alternate data streams])
327 AC_MSG_CHECKING([whether to use SSSE3-accelerated SHA1 ])
328 AC_ARG_ENABLE([ssse3-sha1],
329 AS_HELP_STRING([--enable-ssse3-sha1], [use assembly language implementation
330 of SHA1 from Intel, accelerated with vector
331 instructions (SSSE3-enabled CPU required)]),
332 [ENABLE_SSSE3_SHA1=$enableval],
333 [ENABLE_SSSE3_SHA1=no]
336 AC_MSG_RESULT([$ENABLE_SSSE3_SHA1])
337 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
338 AC_DEFINE([ENABLE_SSSE3_SHA1], [1],
339 [Define to 1 if using vectorized implementation of SHA1])
340 SSSE3_SHA1_OBJ=sha1-ssse3.lo
342 AC_SUBST([NASM], [$nasm])
346 AC_SUBST([SSSE3_SHA1_OBJ], [$SSSE3_SHA1_OBJ])
348 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
351 AC_ARG_WITH([libcrypto],
352 AS_HELP_STRING([--without-libcrypto], [build in the SHA1 algorithm,
353 rather than use external libcrypto from
354 OpenSSL (default is autodetect)]),
355 [WITH_LIBCRYPTO=$withval],
356 [AC_CHECK_LIB([crypto], [SHA1],
357 [WITH_LIBCRYPTO=yes],
358 [AC_MSG_WARN([Cannot find libcrypto: using stand-alone SHA1 code instead of OpenSSL])
362 AC_MSG_CHECKING([whether to use SHA1 function from system libcrypto])
363 AC_MSG_RESULT([$WITH_LIBCRYPTO])
365 if test "x$WITH_LIBCRYPTO" = "xyes" -a "x$ENABLE_SSSE3_SHA1" = "xno"; then
366 AC_DEFINE([WITH_LIBCRYPTO], [1], [Define to 1 if using libcrypto SHA1])
367 LIBCRYPTO_LDADD=`pkg-config --libs libcrypto 2>/dev/null`
368 if test $? -ne 0; then
369 LIBCRYPTO_LDADD=-lcrypto;
371 LIBCRYPTO_CFLAGS=`pkg-config --cflags libcrypto 2>/dev/null`
376 AC_SUBST([LIBCRYPTO_LDADD], [$LIBCRYPTO_LDADD])
377 AC_SUBST([LIBCRYPTO_CFLAGS], [$LIBCRYPTO_CFLAGS])
378 AC_SUBST([SHA1_SOURCES], [$SHA1_SOURCES])