1 AC_INIT([wimlib], [1.3.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])
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"
189 WITH_NTFS_3G_DEFAULT="no"
190 WITH_FUSE_DEFAULT="no"
191 WINDOWS_NATIVE_BUILD="yes"
193 WINDOWS_CPPFLAGS="-D_POSIX"
194 WINDOWS_LDFLAGS="-no-undefined"
195 WINDOWS_LDADD="-lshlwapi"
198 # Cygwin (WARNING: not well supported)
199 WITH_NTFS_3G_DEFAULT="no"
200 WITH_FUSE_DEFAULT="no"
208 AC_SUBST([VISIBILITY_CFLAGS], [$VISIBILITY_CFLAGS])
209 AC_SUBST([WINDOWS_LDFLAGS], [$WINDOWS_LDFLAGS])
210 AC_SUBST([WINDOWS_LDADD], [$WINDOWS_LDADD])
211 AC_SUBST([WINDOWS_CPPFLAGS], [$WINDOWS_CPPFLAGS])
212 AM_CONDITIONAL([WINDOWS_NATIVE_BUILD], [test "x$WINDOWS_NATIVE_BUILD" = "xyes"])
214 AC_MSG_CHECKING([whether to include support for ntfs-3g])
215 AC_ARG_WITH([ntfs-3g],
216 AS_HELP_STRING([--without-ntfs-3g], [build without NTFS-3g.
217 This will disable the ability to use NTFS-specific
218 information when capturing or applying WIMs to a
220 [WITH_NTFS_3G=$withval],
221 [WITH_NTFS_3G=$WITH_NTFS_3G_DEFAULT]
223 AC_MSG_RESULT([$WITH_NTFS_3G])
224 if test "x$WITH_NTFS_3G" = "xyes"; then
225 AC_DEFINE([WITH_NTFS_3G], [1], [Define to 1 to enable support for
226 NTFS-specific information])
228 dnl This effectively checks for NTFS-3g 2011.4.12 or later
229 AC_CHECK_LIB([ntfs-3g], [ntfs_xattr_system_setxattr], [],
230 [AC_MSG_ERROR([Cannot find libntfs-3g version 2011-4-12
231 or later. Without libntfs-3g, wimlib cannot include support for
232 capturing and applying WIMs on NTFS filesystems while preserving
233 NTFS-specific data such as security descriptors and alternate data
234 streams. You should either install libntfs-3g, or configure with
235 --without-ntfs-3g to disable support for these NTFS-specific
237 LIBNTFS_3G_LDADD="`pkg-config --libs libntfs-3g`"
238 LIBNTFS_3G_CFLAGS="`pkg-config --cflags libntfs-3g`"
240 dnl This checks for a NTFS-3g interface that was changed in the
241 dnl 2013.1.13 release
242 AC_CHECK_DECL([NTFS_MNT_RDONLY],
243 [AC_DEFINE([HAVE_NTFS_MNT_RDONLY],
245 [Define to 1 if ntfs_mount() takes the flag NTFS_MNT_RDONLY])],
247 [#include <ntfs-3g/volume.h>])
253 AM_CONDITIONAL([WITH_NTFS_3G], [test "x$WITH_NTFS_3G" = "xyes"])
255 AC_SUBST([LIBNTFS_3G_LDADD], [$LIBNTFS_3G_LDADD])
256 AC_SUBST([LIBNTFS_3G_CFLAGS], [$LIBNTFS_3G_CFLAGS])
259 if test "x$am_cv_func_iconv" != "xyes"; then
260 AC_MSG_ERROR([Cannot find the iconv() function.
261 iconv() is used to convert between encodings of WIM filenames and XML data.
262 wimlib cannot be compiled without it. iconv() is available in the latest
263 version of glibc and sometimes in other libraries.])
266 AC_MSG_CHECKING([whether to include support for mounting WIMs])
268 AS_HELP_STRING([--without-fuse], [build without libfuse.
269 This will disable the ability to mount
271 [WITH_FUSE=$withval],
272 [WITH_FUSE=$WITH_FUSE_DEFAULT]
274 AC_MSG_RESULT([$WITH_FUSE])
275 if test "x$WITH_FUSE" = "xyes"; then
276 AC_DEFINE([WITH_FUSE], [1], [Define to 1 if using FUSE.])
279 AC_CHECK_LIB([fuse], [fuse_main_real], [have_fuse=true],
280 [AC_MSG_ERROR([Cannot find libfuse.
281 Without libfuse, wimlib cannot include support for mounting WIMs. You
282 should either install libfuse, or configure with --without-fuse to
283 disable support for mounting WIMs.])
285 AC_CHECK_LIB([rt], [mq_open], [have_posix_mq=true],
286 [AC_MSG_ERROR([Cannot find librt for POSIX message queue
287 functions. Without these functions, wimlib cannot include support for
288 mounting WIMs. You should either update your C library to a recent
289 version of glibc, or configure with --without-fuse to disable support
292 LIBFUSE_LDADD="`pkg-config --libs fuse` -lrt"
293 LIBFUSE_CFLAGS="`pkg-config --cflags fuse`"
298 AM_CONDITIONAL([WITH_FUSE], [test "x$WITH_FUSE" = "xyes"])
299 AC_SUBST([LIBFUSE_LDADD], [$LIBFUSE_LDADD])
300 AC_SUBST([LIBFUSE_CFLAGS], [$LIBFUSE_CFLAGS])
303 AC_ARG_ENABLE([xattr],
304 [AS_HELP_STRING([--enable-xattr], [Enable the xattr interface to access WIM
305 alternate data streams (default: autodetect)])],
306 [ENABLE_XATTR=$enableval],
307 [AC_CHECK_FUNC([setxattr],
308 [AC_CHECK_HEADER([attr/xattr.h],
310 [AC_MSG_WARN([Cannot find the "attr/xattr.h" header. You will not be
311 able to use the xattr interface to access WIM alternate data
313 [AC_MSG_WARN([Cannot find the setxattr() function. You will not be
314 able to use the xattr interface to access WIM alternate data
317 if test "x$ENABLE_XATTR" = "xyes"; then
318 AC_DEFINE([ENABLE_XATTR], [1], [Define to 1 if using the xattr
319 interface to WIM alternate data streams])
322 AC_MSG_CHECKING([whether to use SSSE3-accelerated SHA1 ])
323 AC_ARG_ENABLE([ssse3-sha1],
324 AS_HELP_STRING([--enable-ssse3-sha1], [use assembly language implementation
325 of SHA1 from Intel, accelerated with vector
326 instructions (SSSE3-enabled CPU required)]),
327 [ENABLE_SSSE3_SHA1=$enableval],
328 [ENABLE_SSSE3_SHA1=no]
331 AC_MSG_RESULT([$ENABLE_SSSE3_SHA1])
332 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
333 AC_DEFINE([ENABLE_SSSE3_SHA1], [1],
334 [Define to 1 if using vectorized implementation of SHA1])
335 SSSE3_SHA1_OBJ=sha1-ssse3.lo
337 AC_SUBST([NASM], [$nasm])
341 AC_SUBST([SSSE3_SHA1_OBJ], [$SSSE3_SHA1_OBJ])
343 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
346 AC_ARG_WITH([libcrypto],
347 AS_HELP_STRING([--without-libcrypto], [build in the SHA1 algorithm,
348 rather than use external libcrypto from
349 OpenSSL (default is autodetect)]),
350 [WITH_LIBCRYPTO=$withval],
351 [AC_CHECK_LIB([crypto], [SHA1],
352 [WITH_LIBCRYPTO=yes],
353 [AC_MSG_WARN([Cannot find libcrypto: using stand-alone SHA1 code instead of OpenSSL])
357 AC_MSG_CHECKING([whether to use SHA1 function from system libcrypto])
358 AC_MSG_RESULT([$WITH_LIBCRYPTO])
360 if test "x$WITH_LIBCRYPTO" = "xyes" -a "x$ENABLE_SSSE3_SHA1" = "xno"; then
361 AC_DEFINE([WITH_LIBCRYPTO], [1], [Define to 1 if using libcrypto SHA1])
362 LIBCRYPTO_LDADD=`pkg-config --libs libcrypto 2>/dev/null`
363 if test $? -ne 0; then
364 LIBCRYPTO_LDADD=-lcrypto;
366 LIBCRYPTO_CFLAGS=`pkg-config --cflags libcrypto 2>/dev/null`
371 AC_SUBST([LIBCRYPTO_LDADD], [$LIBCRYPTO_LDADD])
372 AC_SUBST([LIBCRYPTO_CFLAGS], [$LIBCRYPTO_CFLAGS])
373 AC_SUBST([SHA1_SOURCES], [$SHA1_SOURCES])