1 AC_INIT([wimlib], [1.5.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 PKGCONFIG_PRIVATE_REQUIRES=""
11 PKGCONFIG_PRIVATE_LIBS=""
13 AC_ARG_WITH(imagex-progname,
14 [AS_HELP_STRING([--with-imagex-progname=NAME],
15 [Set the name of installed ImageX program (default: wimlib-imagex)])],
16 [IMAGEX_PROGNAME=$withval],
17 [IMAGEX_PROGNAME="wimlib-imagex"])
19 AC_SUBST([IMAGEX_PROGNAME], [$IMAGEX_PROGNAME])
20 AC_DEFINE_UNQUOTED([IMAGEX_PROGNAME], ["$IMAGEX_PROGNAME"],
21 [Binary name for the implementation of ImageX distributed with wimlib])
23 AC_CONFIG_HEADERS([config.h])
24 AC_CONFIG_FILES([Makefile]
27 [doc/"$IMAGEX_PROGNAME".1:doc/imagex.1.in]
28 [doc/"$IMAGEX_PROGNAME"-append.1:doc/imagex-append.1.in]
29 [doc/"$IMAGEX_PROGNAME"-apply.1:doc/imagex-apply.1.in]
30 [doc/"$IMAGEX_PROGNAME"-capture.1:doc/imagex-capture.1.in]
31 [doc/"$IMAGEX_PROGNAME"-delete.1:doc/imagex-delete.1.in]
32 [doc/"$IMAGEX_PROGNAME"-dir.1:doc/imagex-dir.1.in]
33 [doc/"$IMAGEX_PROGNAME"-export.1:doc/imagex-export.1.in]
34 [doc/"$IMAGEX_PROGNAME"-extract.1:doc/imagex-extract.1.in]
35 [doc/"$IMAGEX_PROGNAME"-info.1:doc/imagex-info.1.in]
36 [doc/"$IMAGEX_PROGNAME"-join.1:doc/imagex-join.1.in]
37 [doc/"$IMAGEX_PROGNAME"-mount.1:doc/imagex-mount.1.in]
38 [doc/"$IMAGEX_PROGNAME"-mountrw.1:doc/imagex-mountrw.1.in]
39 [doc/"$IMAGEX_PROGNAME"-optimize.1:doc/imagex-optimize.1.in]
40 [doc/"$IMAGEX_PROGNAME"-split.1:doc/imagex-split.1.in]
41 [doc/"$IMAGEX_PROGNAME"-unmount.1:doc/imagex-unmount.1.in]
42 [doc/"$IMAGEX_PROGNAME"-update.1:doc/imagex-update.1.in]
45 AC_CONFIG_FILES([programs/mkwinpeimg], [chmod +x programs/mkwinpeimg])
51 AC_CHECK_FUNCS([utimensat lutimes utime flock mempcpy])
53 # Note: some of the following header checks are only to define the appropriate
54 # HAVE_*_H macro so that the NTFS-3g headers don't get confused and try to skip
55 # including certain headers.
56 AC_CHECK_HEADERS([alloca.h \
74 AC_CHECK_MEMBER([struct stat.st_mtim],
75 [AC_DEFINE([HAVE_STAT_NANOSECOND_PRECISION], [1],
76 [Define to 1 if nanosecond precision timestamps are
79 [[#include <sys/stat.h>]])
82 AC_ARG_WITH(pkgconfigdir,
83 [ --with-pkgconfigdir=DIR pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@],
84 [pkgconfigdir=$withval],
85 [pkgconfigdir='${libdir}/pkgconfig'])
86 AC_SUBST(pkgconfigdir)
88 AC_CHECK_LIB([xml2], [xmlParseFile], [have_libxml=true],
89 [AC_MSG_ERROR(["cannot find libxml2"])])
90 PKG_CHECK_MODULES([LIBXML2], [libxml-2.0])
91 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libxml-2.0"
93 AC_MSG_CHECKING([whether to include debugging messages])
94 AC_ARG_ENABLE([debug],
95 AS_HELP_STRING([--enable-debug], [include lots of debugging messages]),
96 [ENABLE_DEBUG=$enableval],
99 AC_MSG_RESULT([$ENABLE_DEBUG])
100 if test "x$ENABLE_DEBUG" = "xyes"; then
101 AC_DEFINE([ENABLE_DEBUG], [1],
102 [Define to 1 if including lots of debug messages.])
105 AC_MSG_CHECKING([whether to include more debugging messages])
106 AC_ARG_ENABLE([more_debug],
107 AS_HELP_STRING([--enable-more-debug],
108 [include even more debugging messages]),
109 [ENABLE_MORE_DEBUG=$enableval],
110 [ENABLE_MORE_DEBUG=no]
112 AC_MSG_RESULT([$ENABLE_MORE_DEBUG])
113 if test "x$ENABLE_MORE_DEBUG" = "xyes"; then
114 AC_DEFINE([ENABLE_MORE_DEBUG], [1],
115 [Define to 1 if including even more debug messages.])
118 AC_MSG_CHECKING([whether to include error messages])
119 AC_ARG_ENABLE([error_messages],
120 AS_HELP_STRING([--disable-error-messages],
121 [do not compile in error messsages]),
122 [ENABLE_ERROR_MESSAGES=$enableval],
123 [ENABLE_ERROR_MESSAGES=yes]
125 AC_MSG_RESULT([$ENABLE_ERROR_MESSAGES])
126 if test "x$ENABLE_ERROR_MESSAGES" = "xyes"; then
127 AC_DEFINE([ENABLE_ERROR_MESSAGES], [1],
128 [Define to 1 if including error messages])
131 AC_MSG_CHECKING([whether to support custom memory allocation functions])
132 AC_ARG_ENABLE([custom_memory_allocator],
133 AS_HELP_STRING([--disable-custom-memory-allocator],
134 [do not support the use of custom memory allocation
136 [ENABLE_CUSTOM_MEMORY_ALLOCATOR=$enableval],
137 [ENABLE_CUSTOM_MEMORY_ALLOCATOR=yes]
139 AC_MSG_RESULT([$ENABLE_CUSTOM_MEMORY_ALLOCATOR])
140 if test "x$ENABLE_CUSTOM_MEMORY_ALLOCATOR" = "xyes"; then
141 AC_DEFINE([ENABLE_CUSTOM_MEMORY_ALLOCATOR], [1],
142 [Define to 1 if supporting custom memory allocation functions])
145 AC_MSG_CHECKING([whether to include assertions])
146 AC_ARG_ENABLE([assertions],
147 AS_HELP_STRING([--disable-assertions], [do not include assertions]),
148 [ENABLE_ASSERTIONS=$enableval],
149 [ENABLE_ASSERTIONS=yes]
151 AC_MSG_RESULT([$ENABLE_ASSERTIONS])
152 if test "x$ENABLE_ASSERTIONS" = "xyes"; then
153 AC_DEFINE([ENABLE_ASSERTIONS], [1], [Define to 1 if including assertions.])
156 AC_MSG_CHECKING([whether to include more assertions])
157 AC_ARG_ENABLE([more-assertions],
158 AS_HELP_STRING([--enable-more-assertions], [include even more assertions]),
159 [ENABLE_MORE_ASSERTIONS=$enableval],
160 [ENABLE_MORE_ASSERTIONS=no]
162 AC_MSG_RESULT([$ENABLE_MORE_ASSERTIONS])
163 if test "x$ENABLE_MORE_ASSERTIONS" = "xyes"; then
164 AC_DEFINE([ENABLE_MORE_ASSERTIONS], [1], [Define to 1 if including more assertions.])
168 AC_MSG_CHECKING([whether to include compression verification])
169 AC_ARG_ENABLE([verify_compression],
170 AS_HELP_STRING([--enable-verify-compression], [always
171 check if blocks we compress can be correctly
173 [ENABLE_VERIFY_COMPRESSION=$enableval],
174 [ENABLE_VERIFY_COMPRESSION=no]
176 AC_MSG_RESULT([$ENABLE_VERIFY_COMPRESSION])
177 if test "x$ENABLE_VERIFY_COMPRESSION" = "xyes"; then
178 AC_DEFINE([ENABLE_VERIFY_COMPRESSION], [1], [Define to 1 to verify
182 AC_MSG_CHECKING([whether to include support for multi-threaded compression])
183 AC_ARG_ENABLE([multithreaded-compression],
184 AS_HELP_STRING([--disable-multithreaded-compression],
185 [do not compile in the code for multi-threaded compression]),
186 [ENABLE_MULTITHREADED_COMPRESSION=$enableval],
187 [ENABLE_MULTITHREADED_COMPRESSION=yes]
189 AC_MSG_RESULT([$ENABLE_MULTITHREADED_COMPRESSION])
190 if test "x$ENABLE_MULTITHREADED_COMPRESSION" = "xyes"; then
191 AC_DEFINE([ENABLE_MULTITHREADED_COMPRESSION], [1],
192 [Define to 1 if including support for multithreaded
196 PTHREAD_LDADD="-lpthread"
197 AC_SUBST([PTHREAD_LDADD], [$PTHREAD_LDADD])
199 WITH_NTFS_3G_DEFAULT="yes"
200 WITH_FUSE_DEFAULT="yes"
201 WINDOWS_NATIVE_BUILD="no"
202 VISIBILITY_CFLAGS="-fvisibility=hidden"
207 ENABLE_XATTR_DEFAULT="autodetect"
212 WITH_NTFS_3G_DEFAULT="no"
213 WITH_FUSE_DEFAULT="no"
214 WINDOWS_NATIVE_BUILD="yes"
216 WINDOWS_CFLAGS="-municode"
217 WINDOWS_CPPFLAGS="-D_POSIX -DUNICODE -D_UNICODE -D_CRT_NON_CONFORMING_SWPRINTFS"
218 WINDOWS_LDFLAGS="-no-undefined"
219 WINDOWS_LDADD="-lshlwapi"
220 ENABLE_XATTR_DEFAULT="no"
223 # Cygwin (WARNING: not well supported)
224 AC_MSG_WARN([wimlib has not been tested with Cygwin! Please do
225 a Windows-native build with MinGW-w64 instead])
226 WITH_NTFS_3G_DEFAULT="no"
227 WITH_FUSE_DEFAULT="no"
236 AS_HELP_STRING([--without-ntdll], [Windows only: do not try to
237 use functions from ntdll. By default, in some parts
238 of its code, wimlib uses Windows NT system calls to
239 work around flaws in the Win32 API. This support
240 can be omitted if needed, but some annoying bugs
241 will surface (e.g. permission denied errors even
242 when running as the Administrator).]),
243 [WITH_NTDLL=$withval],
246 if test "x$WINDOWS_NATIVE_BUILD" = "xyes"; then
247 if test "x$WITH_NTDLL" = "xyes"; then
248 WINDOWS_LDADD="$WINDOWS_LDADD"
249 AC_DEFINE([WITH_NTDLL], [1], [Define to 1 to try to use ntdll
254 AC_SUBST([VISIBILITY_CFLAGS], [$VISIBILITY_CFLAGS])
255 AC_SUBST([WINDOWS_LDFLAGS], [$WINDOWS_LDFLAGS])
256 AC_SUBST([WINDOWS_LDADD], [$WINDOWS_LDADD])
257 AC_SUBST([WINDOWS_CPPFLAGS], [$WINDOWS_CPPFLAGS])
258 AC_SUBST([WINDOWS_CFLAGS], [$WINDOWS_CFLAGS])
259 AM_CONDITIONAL([WINDOWS_NATIVE_BUILD], [test "x$WINDOWS_NATIVE_BUILD" = "xyes"])
261 AC_MSG_CHECKING([whether to include support for ntfs-3g])
262 AC_ARG_WITH([ntfs-3g],
263 AS_HELP_STRING([--without-ntfs-3g], [build without NTFS-3g.
264 On UNIX, this will disable the ability to use NTFS-specific
265 information when capturing or applying WIMs to a
267 [WITH_NTFS_3G=$withval],
268 [WITH_NTFS_3G=$WITH_NTFS_3G_DEFAULT]
270 AC_MSG_RESULT([$WITH_NTFS_3G])
271 if test "x$WITH_NTFS_3G" = "xyes"; then
272 AC_DEFINE([WITH_NTFS_3G], [1], [On UNIX, define to 1 to enable support
273 for NTFS-specific information])
275 dnl This effectively checks for NTFS-3g 2011.4.12 or later
276 AC_CHECK_LIB([ntfs-3g], [ntfs_xattr_system_setxattr], [],
277 [AC_MSG_ERROR([Cannot find libntfs-3g version 2011-4-12
278 or later. Without libntfs-3g, wimlib cannot include support for
279 capturing and applying WIMs on NTFS filesystems while preserving
280 NTFS-specific data such as security descriptors and alternate data
281 streams. You should either install libntfs-3g, or configure with
282 --without-ntfs-3g to disable support for these NTFS-specific
285 PKG_CHECK_MODULES([LIBNTFS_3G], [libntfs-3g])
286 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libntfs-3g"
288 dnl This checks for a NTFS-3g interface that was changed in the
289 dnl 2013.1.13 release
290 AC_CHECK_DECL([NTFS_MNT_RDONLY],
291 [AC_DEFINE([HAVE_NTFS_MNT_RDONLY],
293 [Define to 1 if ntfs_mount() takes the flag NTFS_MNT_RDONLY])],
295 [#include <ntfs-3g/volume.h>])
297 AM_CONDITIONAL([WITH_NTFS_3G], [test "x$WITH_NTFS_3G" = "xyes"])
300 if test "x$am_cv_func_iconv" != "xyes"; then
301 AC_MSG_ERROR([Cannot find the iconv() function.
302 iconv() is used to convert between encodings of WIM filenames and XML data.
303 wimlib cannot be compiled without it. iconv() is available in the latest
304 version of glibc and sometimes in other libraries.])
307 AC_MSG_CHECKING([whether to include support for mounting WIMs])
309 AS_HELP_STRING([--without-fuse], [build without libfuse.
310 This will disable the ability to mount
312 [WITH_FUSE=$withval],
313 [WITH_FUSE=$WITH_FUSE_DEFAULT]
315 AC_MSG_RESULT([$WITH_FUSE])
316 if test "x$WITH_FUSE" = "xyes"; then
317 AC_DEFINE([WITH_FUSE], [1], [Define to 1 if using FUSE.])
320 AC_CHECK_LIB([fuse], [fuse_main_real], [have_fuse=true],
321 [AC_MSG_ERROR([Cannot find libfuse.
322 Without libfuse, wimlib cannot include support for mounting WIMs. You
323 should either install libfuse, or configure with --without-fuse to
324 disable support for mounting WIMs.])
326 AC_CHECK_LIB([rt], [mq_open], [have_posix_mq=true],
327 [AC_MSG_ERROR([Cannot find librt for POSIX message queue
328 functions. Without these functions, wimlib cannot include support for
329 mounting WIMs. You should either update your C library to a recent
330 version of glibc, or configure with --without-fuse to disable support
333 PKG_CHECK_MODULES([LIBFUSE], [fuse])
334 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES fuse"
335 PKGCONFIG_PRIVATE_LIBS="$PKGCONFIG_PRIVATE_LIBS -lrt"
336 AC_SUBST([LIBRT_LIBS], [-lrt])
338 AM_CONDITIONAL([WITH_FUSE], [test "x$WITH_FUSE" = "xyes"])
341 AC_ARG_ENABLE([xattr],
342 [AS_HELP_STRING([--enable-xattr], [Enable the xattr interface to access WIM
343 alternate data streams (default: autodetect)])],
344 [ENABLE_XATTR=$enableval],
345 [if test "x$ENABLE_XATTR_DEFAULT" = "xautodetect"; then
346 AC_CHECK_FUNC([setxattr],
347 [AC_CHECK_HEADER([attr/xattr.h],
349 [AC_MSG_WARN([Cannot find the "attr/xattr.h" header. You will not be
350 able to use the xattr interface to access WIM alternate data
352 [AC_MSG_WARN([Cannot find the setxattr() function. You will not be
353 able to use the xattr interface to access WIM alternate data
357 if test "x$ENABLE_XATTR" = "xyes"; then
358 AC_DEFINE([ENABLE_XATTR], [1], [Define to 1 if using the xattr
359 interface to WIM alternate data streams])
362 AC_MSG_CHECKING([whether to use SSSE3-accelerated SHA1 ])
363 AC_ARG_ENABLE([ssse3-sha1],
364 AS_HELP_STRING([--enable-ssse3-sha1], [use assembly language implementation
365 of SHA1 from Intel, accelerated with vector
366 instructions (SSSE3-enabled CPU required)]),
367 [ENABLE_SSSE3_SHA1=$enableval],
368 [ENABLE_SSSE3_SHA1=no]
371 AC_MSG_RESULT([$ENABLE_SSSE3_SHA1])
372 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
373 AC_DEFINE([ENABLE_SSSE3_SHA1], [1],
374 [Define to 1 if using vectorized implementation of SHA1])
375 SSSE3_SHA1_OBJ=sha1-ssse3.lo
377 AC_SUBST([NASM], [$nasm])
381 AC_SUBST([SSSE3_SHA1_OBJ], [$SSSE3_SHA1_OBJ])
383 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
386 AC_ARG_WITH([libcrypto],
387 AS_HELP_STRING([--without-libcrypto], [build in the SHA1 algorithm,
388 rather than use external libcrypto from
389 OpenSSL (default is autodetect)]),
390 [WITH_LIBCRYPTO=$withval],
391 [AC_CHECK_LIB([crypto], [SHA1],
392 [WITH_LIBCRYPTO=yes],
393 [AC_MSG_WARN([Cannot find libcrypto: using stand-alone SHA1 code instead of OpenSSL])
397 AC_MSG_CHECKING([whether to use SHA1 function from system libcrypto])
398 AC_MSG_RESULT([$WITH_LIBCRYPTO])
400 if test "x$WITH_LIBCRYPTO" = "xyes" -a "x$ENABLE_SSSE3_SHA1" = "xno"; then
401 AC_DEFINE([WITH_LIBCRYPTO], [1], [Define to 1 if using libcrypto SHA1])
402 PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto])
403 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libcrypto"
405 AC_SUBST([SHA1_SOURCES], [$SHA1_SOURCES])
407 AC_SUBST([PKGCONFIG_PRIVATE_REQUIRES], [$PKGCONFIG_PRIVATE_REQUIRES])
408 AC_SUBST([PKGCONFIG_PRIVATE_LIBS], [$PKGCONFIG_PRIVATE_LIBS])