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]
39 [doc/"$IMAGEX_PROGNAME"-update.1:doc/imagex-update.1.in]
42 AC_CONFIG_FILES([programs/mkwinpeimg], [chmod +x programs/mkwinpeimg])
48 AC_CHECK_FUNCS([utimensat lutimes utime flock])
49 AC_CHECK_HEADERS([endian.h byteswap.h sys/byteorder.h sys/endian.h \
50 sys/param.h machine/endian.h alloca.h stdlib.h stdarg.h \
51 errno.h attr/xattr.h utime.h sys/file.h glob.h])
53 AC_CHECK_MEMBER([struct stat.st_mtim],
54 [AC_DEFINE([HAVE_STAT_NANOSECOND_PRECISION], [1],
55 [Define to 1 if nanosecond precision timestamps are
58 [[#include <sys/stat.h>]])
61 AC_ARG_WITH(pkgconfigdir,
62 [ --with-pkgconfigdir=DIR pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@],
63 [pkgconfigdir=$withval],
64 [pkgconfigdir='${libdir}/pkgconfig'])
65 AC_SUBST(pkgconfigdir)
67 AC_CHECK_LIB([xml2], [xmlParseFile], [have_libxml=true],
68 [AC_MSG_ERROR(["cannot find libxml2"])])
69 LIBXML2_LDADD=`pkg-config libxml-2.0 --libs`
70 LIBXML2_CFLAGS=`pkg-config libxml-2.0 --cflags`
71 AC_SUBST([LIBXML2_LDADD], [$LIBXML2_LDADD])
72 AC_SUBST([LIBXML2_CFLAGS], [$LIBXML2_CFLAGS])
74 AC_MSG_CHECKING([whether to include debugging messages])
75 AC_ARG_ENABLE([debug],
76 AS_HELP_STRING([--enable-debug], [include lots of debugging messages]),
77 [ENABLE_DEBUG=$enableval],
80 AC_MSG_RESULT([$ENABLE_DEBUG])
81 if test "x$ENABLE_DEBUG" = "xyes"; then
82 AC_DEFINE([ENABLE_DEBUG], [1],
83 [Define to 1 if including lots of debug messages.])
86 AC_MSG_CHECKING([whether to include more debugging messages])
87 AC_ARG_ENABLE([more_debug],
88 AS_HELP_STRING([--enable-more-debug],
89 [include even more debugging messages]),
90 [ENABLE_MORE_DEBUG=$enableval],
91 [ENABLE_MORE_DEBUG=no]
93 AC_MSG_RESULT([$ENABLE_MORE_DEBUG])
94 if test "x$ENABLE_MORE_DEBUG" = "xyes"; then
95 AC_DEFINE([ENABLE_MORE_DEBUG], [1],
96 [Define to 1 if including even more debug messages.])
99 AC_MSG_CHECKING([whether to include error messages])
100 AC_ARG_ENABLE([error_messages],
101 AS_HELP_STRING([--disable-error-messages],
102 [do not compile in error messsages]),
103 [ENABLE_ERROR_MESSAGES=$enableval],
104 [ENABLE_ERROR_MESSAGES=yes]
106 AC_MSG_RESULT([$ENABLE_ERROR_MESSAGES])
107 if test "x$ENABLE_ERROR_MESSAGES" = "xyes"; then
108 AC_DEFINE([ENABLE_ERROR_MESSAGES], [1],
109 [Define to 1 if including error messages])
112 AC_MSG_CHECKING([whether to support custom memory allocation functions])
113 AC_ARG_ENABLE([custom_memory_allocator],
114 AS_HELP_STRING([--disable-custom-memory-allocator],
115 [do not support the use of custom memory allocation
117 [ENABLE_CUSTOM_MEMORY_ALLOCATOR=$enableval],
118 [ENABLE_CUSTOM_MEMORY_ALLOCATOR=yes]
120 AC_MSG_RESULT([$ENABLE_CUSTOM_MEMORY_ALLOCATOR])
121 if test "x$ENABLE_CUSTOM_MEMORY_ALLOCATOR" = "xyes"; then
122 AC_DEFINE([ENABLE_CUSTOM_MEMORY_ALLOCATOR], [1],
123 [Define to 1 if supporting custom memory allocation functions])
126 AC_MSG_CHECKING([whether to include assertions])
127 AC_ARG_ENABLE([assertions],
128 AS_HELP_STRING([--disable-assertions], [do not include assertions]),
129 [ENABLE_ASSERTIONS=$enableval],
130 [ENABLE_ASSERTIONS=yes]
132 AC_MSG_RESULT([$ENABLE_ASSERTIONS])
133 if test "x$ENABLE_ASSERTIONS" = "xyes"; then
134 AC_DEFINE([ENABLE_ASSERTIONS], [1], [Define to 1 if including assertions.])
137 AC_MSG_CHECKING([whether to include more assertions])
138 AC_ARG_ENABLE([more-assertions],
139 AS_HELP_STRING([--enable-more-assertions], [include even more assertions]),
140 [ENABLE_MORE_ASSERTIONS=$enableval],
141 [ENABLE_MORE_ASSERTIONS=no]
143 AC_MSG_RESULT([$ENABLE_MORE_ASSERTIONS])
144 if test "x$ENABLE_MORE_ASSERTIONS" = "xyes"; then
145 AC_DEFINE([ENABLE_MORE_ASSERTIONS], [1], [Define to 1 if including more assertions.])
149 AC_MSG_CHECKING([whether to include compression verification])
150 AC_ARG_ENABLE([verify_compression],
151 AS_HELP_STRING([--enable-verify-compression], [always
152 check if blocks we compress can be correctly
154 [ENABLE_VERIFY_COMPRESSION=$enableval],
155 [ENABLE_VERIFY_COMPRESSION=no]
157 AC_MSG_RESULT([$ENABLE_VERIFY_COMPRESSION])
158 if test "x$ENABLE_VERIFY_COMPRESSION" = "xyes"; then
159 AC_DEFINE([ENABLE_VERIFY_COMPRESSION], [1], [Define to 1 to verify
163 AC_MSG_CHECKING([whether to include support for multi-threaded compression])
164 AC_ARG_ENABLE([multithreaded-compression],
165 AS_HELP_STRING([--disable-multithreaded-compression],
166 [do not compile in the code for multi-threaded compression]),
167 [ENABLE_MULTITHREADED_COMPRESSION=$enableval],
168 [ENABLE_MULTITHREADED_COMPRESSION=yes]
170 AC_MSG_RESULT([$ENABLE_MULTITHREADED_COMPRESSION])
171 if test "x$ENABLE_MULTITHREADED_COMPRESSION" = "xyes"; then
172 AC_DEFINE([ENABLE_MULTITHREADED_COMPRESSION], [1],
173 [Define to 1 if including support for multithreaded
177 PTHREAD_LDADD="-lpthread"
178 AC_SUBST([PTHREAD_LDADD], [$PTHREAD_LDADD])
180 WITH_NTFS_3G_DEFAULT="yes"
181 WITH_FUSE_DEFAULT="yes"
182 WINDOWS_NATIVE_BUILD="no"
183 VISIBILITY_CFLAGS="-fvisibility=hidden"
192 WITH_NTFS_3G_DEFAULT="no"
193 WITH_FUSE_DEFAULT="no"
194 WINDOWS_NATIVE_BUILD="yes"
196 WINDOWS_CFLAGS="-municode"
197 WINDOWS_CPPFLAGS="-D_POSIX -DUNICODE -D_UNICODE"
198 WINDOWS_LDFLAGS="-no-undefined"
199 WINDOWS_LDADD="-lshlwapi"
202 # Cygwin (WARNING: not well supported)
203 AC_MSG_WARN([wimlib has not been tested with Cygwin! Please do
204 a Windows-native build with MinGW-w64 instead])
205 WITH_NTFS_3G_DEFAULT="no"
206 WITH_FUSE_DEFAULT="no"
214 AC_SUBST([VISIBILITY_CFLAGS], [$VISIBILITY_CFLAGS])
215 AC_SUBST([WINDOWS_LDFLAGS], [$WINDOWS_LDFLAGS])
216 AC_SUBST([WINDOWS_LDADD], [$WINDOWS_LDADD])
217 AC_SUBST([WINDOWS_CPPFLAGS], [$WINDOWS_CPPFLAGS])
218 AC_SUBST([WINDOWS_CFLAGS], [$WINDOWS_CFLAGS])
219 AM_CONDITIONAL([WINDOWS_NATIVE_BUILD], [test "x$WINDOWS_NATIVE_BUILD" = "xyes"])
221 AC_MSG_CHECKING([whether to include support for ntfs-3g])
222 AC_ARG_WITH([ntfs-3g],
223 AS_HELP_STRING([--without-ntfs-3g], [build without NTFS-3g.
224 This will disable the ability to use NTFS-specific
225 information when capturing or applying WIMs to a
227 [WITH_NTFS_3G=$withval],
228 [WITH_NTFS_3G=$WITH_NTFS_3G_DEFAULT]
230 AC_MSG_RESULT([$WITH_NTFS_3G])
231 if test "x$WITH_NTFS_3G" = "xyes"; then
232 AC_DEFINE([WITH_NTFS_3G], [1], [Define to 1 to enable support for
233 NTFS-specific information])
235 dnl This effectively checks for NTFS-3g 2011.4.12 or later
236 AC_CHECK_LIB([ntfs-3g], [ntfs_xattr_system_setxattr], [],
237 [AC_MSG_ERROR([Cannot find libntfs-3g version 2011-4-12
238 or later. Without libntfs-3g, wimlib cannot include support for
239 capturing and applying WIMs on NTFS filesystems while preserving
240 NTFS-specific data such as security descriptors and alternate data
241 streams. You should either install libntfs-3g, or configure with
242 --without-ntfs-3g to disable support for these NTFS-specific
244 LIBNTFS_3G_LDADD="`pkg-config --libs libntfs-3g`"
245 LIBNTFS_3G_CFLAGS="`pkg-config --cflags libntfs-3g`"
247 dnl This checks for a NTFS-3g interface that was changed in the
248 dnl 2013.1.13 release
249 AC_CHECK_DECL([NTFS_MNT_RDONLY],
250 [AC_DEFINE([HAVE_NTFS_MNT_RDONLY],
252 [Define to 1 if ntfs_mount() takes the flag NTFS_MNT_RDONLY])],
254 [#include <ntfs-3g/volume.h>])
260 AM_CONDITIONAL([WITH_NTFS_3G], [test "x$WITH_NTFS_3G" = "xyes"])
262 AC_SUBST([LIBNTFS_3G_LDADD], [$LIBNTFS_3G_LDADD])
263 AC_SUBST([LIBNTFS_3G_CFLAGS], [$LIBNTFS_3G_CFLAGS])
266 if test "x$am_cv_func_iconv" != "xyes"; then
267 AC_MSG_ERROR([Cannot find the iconv() function.
268 iconv() is used to convert between encodings of WIM filenames and XML data.
269 wimlib cannot be compiled without it. iconv() is available in the latest
270 version of glibc and sometimes in other libraries.])
273 AC_MSG_CHECKING([whether to include support for mounting WIMs])
275 AS_HELP_STRING([--without-fuse], [build without libfuse.
276 This will disable the ability to mount
278 [WITH_FUSE=$withval],
279 [WITH_FUSE=$WITH_FUSE_DEFAULT]
281 AC_MSG_RESULT([$WITH_FUSE])
282 if test "x$WITH_FUSE" = "xyes"; then
283 AC_DEFINE([WITH_FUSE], [1], [Define to 1 if using FUSE.])
286 AC_CHECK_LIB([fuse], [fuse_main_real], [have_fuse=true],
287 [AC_MSG_ERROR([Cannot find libfuse.
288 Without libfuse, wimlib cannot include support for mounting WIMs. You
289 should either install libfuse, or configure with --without-fuse to
290 disable support for mounting WIMs.])
292 AC_CHECK_LIB([rt], [mq_open], [have_posix_mq=true],
293 [AC_MSG_ERROR([Cannot find librt for POSIX message queue
294 functions. Without these functions, wimlib cannot include support for
295 mounting WIMs. You should either update your C library to a recent
296 version of glibc, or configure with --without-fuse to disable support
299 LIBFUSE_LDADD="`pkg-config --libs fuse` -lrt"
300 LIBFUSE_CFLAGS="`pkg-config --cflags fuse`"
305 AM_CONDITIONAL([WITH_FUSE], [test "x$WITH_FUSE" = "xyes"])
306 AC_SUBST([LIBFUSE_LDADD], [$LIBFUSE_LDADD])
307 AC_SUBST([LIBFUSE_CFLAGS], [$LIBFUSE_CFLAGS])
310 AC_ARG_ENABLE([xattr],
311 [AS_HELP_STRING([--enable-xattr], [Enable the xattr interface to access WIM
312 alternate data streams (default: autodetect)])],
313 [ENABLE_XATTR=$enableval],
314 [AC_CHECK_FUNC([setxattr],
315 [AC_CHECK_HEADER([attr/xattr.h],
317 [AC_MSG_WARN([Cannot find the "attr/xattr.h" header. You will not be
318 able to use the xattr interface to access WIM alternate data
320 [AC_MSG_WARN([Cannot find the setxattr() function. You will not be
321 able to use the xattr interface to access WIM alternate data
324 if test "x$ENABLE_XATTR" = "xyes"; then
325 AC_DEFINE([ENABLE_XATTR], [1], [Define to 1 if using the xattr
326 interface to WIM alternate data streams])
329 AC_MSG_CHECKING([whether to use SSSE3-accelerated SHA1 ])
330 AC_ARG_ENABLE([ssse3-sha1],
331 AS_HELP_STRING([--enable-ssse3-sha1], [use assembly language implementation
332 of SHA1 from Intel, accelerated with vector
333 instructions (SSSE3-enabled CPU required)]),
334 [ENABLE_SSSE3_SHA1=$enableval],
335 [ENABLE_SSSE3_SHA1=no]
338 AC_MSG_RESULT([$ENABLE_SSSE3_SHA1])
339 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
340 AC_DEFINE([ENABLE_SSSE3_SHA1], [1],
341 [Define to 1 if using vectorized implementation of SHA1])
342 SSSE3_SHA1_OBJ=sha1-ssse3.lo
344 AC_SUBST([NASM], [$nasm])
348 AC_SUBST([SSSE3_SHA1_OBJ], [$SSSE3_SHA1_OBJ])
350 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
353 AC_ARG_WITH([libcrypto],
354 AS_HELP_STRING([--without-libcrypto], [build in the SHA1 algorithm,
355 rather than use external libcrypto from
356 OpenSSL (default is autodetect)]),
357 [WITH_LIBCRYPTO=$withval],
358 [AC_CHECK_LIB([crypto], [SHA1],
359 [WITH_LIBCRYPTO=yes],
360 [AC_MSG_WARN([Cannot find libcrypto: using stand-alone SHA1 code instead of OpenSSL])
364 AC_MSG_CHECKING([whether to use SHA1 function from system libcrypto])
365 AC_MSG_RESULT([$WITH_LIBCRYPTO])
367 if test "x$WITH_LIBCRYPTO" = "xyes" -a "x$ENABLE_SSSE3_SHA1" = "xno"; then
368 AC_DEFINE([WITH_LIBCRYPTO], [1], [Define to 1 if using libcrypto SHA1])
369 LIBCRYPTO_LDADD=`pkg-config --libs libcrypto 2>/dev/null`
370 if test $? -ne 0; then
371 LIBCRYPTO_LDADD=-lcrypto;
373 LIBCRYPTO_CFLAGS=`pkg-config --cflags libcrypto 2>/dev/null`
378 AC_SUBST([LIBCRYPTO_LDADD], [$LIBCRYPTO_LDADD])
379 AC_SUBST([LIBCRYPTO_CFLAGS], [$LIBCRYPTO_CFLAGS])
380 AC_SUBST([SHA1_SOURCES], [$SHA1_SOURCES])