1 AC_INIT([wimlib], [1.7.4-BETA], [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 foreign])
7 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
10 PKGCONFIG_PRIVATE_REQUIRES=""
11 PKGCONFIG_PRIVATE_LIBS=""
13 AC_CONFIG_HEADERS([config.h])
14 AC_CONFIG_FILES([Makefile]
18 AC_CONFIG_FILES([programs/mkwinpeimg], [chmod +x programs/mkwinpeimg])
24 AC_CHECK_FUNCS([futimens utimensat utime flock mempcpy \
25 openat fstatat readlinkat fdopendir])
27 # Note: some of the following header checks are only to define the appropriate
28 # HAVE_*_H macro so that the NTFS-3g headers don't get confused and try to skip
29 # including certain headers.
30 AC_CHECK_HEADERS([alloca.h \
48 AC_CHECK_MEMBER([struct stat.st_mtim],
49 [AC_DEFINE([HAVE_STAT_NANOSECOND_PRECISION], [1],
50 [Define to 1 if nanosecond precision timestamps are
53 [[#include <sys/stat.h>]])
56 AC_ARG_WITH(pkgconfigdir,
57 [ --with-pkgconfigdir=DIR pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@],
58 [pkgconfigdir=$withval],
59 [pkgconfigdir='${libdir}/pkgconfig'])
60 AC_SUBST(pkgconfigdir)
62 AC_CHECK_LIB([xml2], [xmlParseFile], [have_libxml=true],
63 [AC_MSG_ERROR(["cannot find libxml2"])])
64 PKG_CHECK_MODULES([LIBXML2], [libxml-2.0])
65 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libxml-2.0"
67 AC_MSG_CHECKING([whether to include debugging messages])
68 AC_ARG_ENABLE([debug],
69 AS_HELP_STRING([--enable-debug], [include lots of debugging messages]),
70 [ENABLE_DEBUG=$enableval],
73 AC_MSG_RESULT([$ENABLE_DEBUG])
74 if test "x$ENABLE_DEBUG" = "xyes"; then
75 AC_DEFINE([ENABLE_DEBUG], [1],
76 [Define to 1 if including lots of debug messages.])
79 AC_MSG_CHECKING([whether to include error messages])
80 AC_ARG_ENABLE([error_messages],
81 AS_HELP_STRING([--disable-error-messages],
82 [do not compile in error messsages]),
83 [ENABLE_ERROR_MESSAGES=$enableval],
84 [ENABLE_ERROR_MESSAGES=yes]
86 AC_MSG_RESULT([$ENABLE_ERROR_MESSAGES])
87 if test "x$ENABLE_ERROR_MESSAGES" = "xyes"; then
88 AC_DEFINE([ENABLE_ERROR_MESSAGES], [1],
89 [Define to 1 if including error messages])
92 AC_MSG_CHECKING([whether to include assertions])
93 AC_ARG_ENABLE([assertions],
94 AS_HELP_STRING([--disable-assertions], [do not include assertions]),
95 [ENABLE_ASSERTIONS=$enableval],
96 [ENABLE_ASSERTIONS=yes]
98 AC_MSG_RESULT([$ENABLE_ASSERTIONS])
99 if test "x$ENABLE_ASSERTIONS" = "xyes"; then
100 AC_DEFINE([ENABLE_ASSERTIONS], [1], [Define to 1 if including assertions.])
103 AC_MSG_CHECKING([whether to include automatic compression verification])
104 AC_ARG_ENABLE([verify_compression],
105 AS_HELP_STRING([--enable-verify-compression], [always
106 check if blocks we compress can be correctly
108 [ENABLE_VERIFY_COMPRESSION=$enableval],
109 [ENABLE_VERIFY_COMPRESSION=no]
111 AC_MSG_RESULT([$ENABLE_VERIFY_COMPRESSION])
112 if test "x$ENABLE_VERIFY_COMPRESSION" = "xyes"; then
113 AC_DEFINE([ENABLE_VERIFY_COMPRESSION], [1], [Define to 1 to verify
117 AC_MSG_CHECKING([whether to include support for multi-threaded compression])
118 AC_ARG_ENABLE([multithreaded-compression],
119 AS_HELP_STRING([--disable-multithreaded-compression],
120 [do not compile in the code for multi-threaded compression]),
121 [ENABLE_MULTITHREADED_COMPRESSION=$enableval],
122 [ENABLE_MULTITHREADED_COMPRESSION=yes]
124 AC_MSG_RESULT([$ENABLE_MULTITHREADED_COMPRESSION])
125 if test "x$ENABLE_MULTITHREADED_COMPRESSION" = "xyes"; then
126 AC_DEFINE([ENABLE_MULTITHREADED_COMPRESSION], [1],
127 [Define to 1 if including support for multithreaded
131 PTHREAD_LDADD="-lpthread"
132 AC_SUBST([PTHREAD_LDADD], [$PTHREAD_LDADD])
134 WITH_NTFS_3G_DEFAULT="no"
135 WITH_FUSE_DEFAULT="no"
136 WINDOWS_NATIVE_BUILD="no"
137 VISIBILITY_CFLAGS="-fvisibility=hidden"
145 WINDOWS_NATIVE_BUILD="yes"
147 WINDOWS_CFLAGS="-municode"
148 WINDOWS_CPPFLAGS="-D_POSIX -DUNICODE -D_UNICODE -D_CRT_NON_CONFORMING_SWPRINTFS"
149 WINDOWS_LDFLAGS="-no-undefined"
153 WITH_FUSE_DEFAULT="yes"
154 WITH_NTFS_3G_DEFAULT="yes"
158 WITH_NTFS_3G_DEFAULT="yes"
162 AC_SUBST([VISIBILITY_CFLAGS], [$VISIBILITY_CFLAGS])
163 AC_SUBST([WINDOWS_LDFLAGS], [$WINDOWS_LDFLAGS])
164 AC_SUBST([WINDOWS_CPPFLAGS], [$WINDOWS_CPPFLAGS])
165 AC_SUBST([WINDOWS_CFLAGS], [$WINDOWS_CFLAGS])
166 AM_CONDITIONAL([WINDOWS_NATIVE_BUILD], [test "x$WINDOWS_NATIVE_BUILD" = "xyes"])
170 if test "x$am_cv_func_iconv" != "xyes"; then
171 AC_MSG_ERROR([Cannot find the iconv() function. iconv() is used to
172 convert between encodings of WIM filenames and XML data.
173 wimlib cannot be compiled without it. iconv() is
174 available in the latest version of glibc and sometimes in
178 AC_MSG_CHECKING([whether to include support for ntfs-3g])
179 AC_ARG_WITH([ntfs-3g],
180 [AS_HELP_STRING([--without-ntfs-3g],
181 [build without libntfs-3g. This will disable the
182 ability to capture or apply a WIM image directly
183 from/to an unmounted NTFS volume.])],
184 [WITH_NTFS_3G=$withval],
185 [WITH_NTFS_3G=$WITH_NTFS_3G_DEFAULT])
187 AC_MSG_RESULT([$WITH_NTFS_3G])
188 if test "x$WITH_NTFS_3G" = "xyes"; then
189 AC_DEFINE([WITH_NTFS_3G], [1], [Define to 1 to enable NTFS-3g support.])
191 dnl This effectively checks for NTFS-3g 2011.4.12 or later
192 AC_CHECK_LIB([ntfs-3g], [ntfs_xattr_system_setxattr], [],
193 [AC_MSG_ERROR([Cannot find libntfs-3g version 2011-4-12
194 or later! Without libntfs-3g, wimlib cannot include support for
195 capturing or applying a WIM image directly from/to an unmounted NTFS
196 volume while preserving NTFS-specific data such as security descriptors
197 and named data streams. Either install libntfs-3g, or configure
198 --without-ntfs-3g to disable this feature.])])
200 PKG_CHECK_MODULES([LIBNTFS_3G], [libntfs-3g])
201 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libntfs-3g"
203 dnl This checks for an NTFS-3g interface that was changed in the
204 dnl 2013.1.13 release
205 AC_CHECK_DECL([NTFS_MNT_RDONLY],
206 [AC_DEFINE([HAVE_NTFS_MNT_RDONLY],
208 [Define to 1 if ntfs_mount() takes the flag NTFS_MNT_RDONLY])],
210 [#include <ntfs-3g/volume.h>])
212 AM_CONDITIONAL([WITH_NTFS_3G], [test "x$WITH_NTFS_3G" = "xyes"])
214 AC_MSG_CHECKING([whether to include support for mounting WIMs])
216 [AS_HELP_STRING([--without-fuse],
217 [build without libfuse. This will disable the ability
218 to mount WIM images.])],
219 [WITH_FUSE=$withval],
220 [WITH_FUSE=$WITH_FUSE_DEFAULT])
222 AC_MSG_RESULT([$WITH_FUSE])
223 if test "x$WITH_FUSE" = "xyes"; then
224 AC_DEFINE([WITH_FUSE], [1], [Define to 1 if using FUSE.])
226 AC_CHECK_LIB([fuse], [fuse_main_real], [],
227 [AC_MSG_ERROR([Cannot find libfuse!
228 Without libfuse, wimlib cannot include support for mounting WIM images.
229 Either install libfuse, or configure --without-fuse to disable this
232 AC_CHECK_LIB([rt], [mq_open], [],
233 [AC_MSG_ERROR([Cannot find librt (the POSIX.1b Realtime
234 Extensions Library)! wimlib needs this for the POSIX message queue
235 functions, which are used in the code for mounting WIM images. Recent
236 versions of glibc include this library. Either install this library, or
237 configure --without-fuse to disable support for mounting WIM images.])])
239 AC_CHECK_LIB([attr], [getxattr], [],
240 [AC_MSG_ERROR([Cannot find libattr!
241 wimlib needs this for the extended attribute functions, which are used
242 in the code for mounting WIM images. Either install this library, or
243 configure --without-fuse to disable support for mounting WIM images.])])
245 PKG_CHECK_MODULES([LIBFUSE], [fuse])
246 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES fuse"
247 PKGCONFIG_PRIVATE_LIBS="$PKGCONFIG_PRIVATE_LIBS -lrt"
248 AC_SUBST([LIBRT_LIBS], [-lrt])
250 AM_CONDITIONAL([WITH_FUSE], [test "x$WITH_FUSE" = "xyes"])
252 AC_MSG_CHECKING([whether to use SSSE3-accelerated SHA-1])
253 AC_ARG_ENABLE([ssse3-sha1],
254 [AS_HELP_STRING([--enable-ssse3-sha1],
255 [Include SSSE3-accelerated SHA-1 implementation by
256 Intel. This implies --without-libcrypto.])],
257 [ENABLE_SSSE3_SHA1=$enableval],
258 [ENABLE_SSSE3_SHA1=no])
260 AC_MSG_RESULT([$ENABLE_SSSE3_SHA1])
261 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
262 AC_DEFINE([ENABLE_SSSE3_SHA1], [1],
263 [Define to 1 if using SSSE3 implementation of SHA-1])
264 SSSE3_SHA1_OBJ=src/sha1-ssse3.lo
266 NASM_SYMBOL_PREFIX=""
268 if test "x$WINDOWS_NATIVE_BUILD" = "xyes"; then
269 NASM_WINDOWS_FLAGS="-DWIN_ABI"
272 darwin* | rhapsody* | nextstep* | openstep* | macos*)
273 NASM_SYMBOL_PREFIX="_"
276 AC_SUBST([NASM_WINDOWS_FLAGS], $NASM_WINDOWS_FLAGS)
277 AC_SUBST([NASM_SYMBOL_PREFIX], $NASM_SYMBOL_PREFIX)
281 AC_SUBST([SSSE3_SHA1_OBJ], [$SSSE3_SHA1_OBJ])
283 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
286 AC_ARG_WITH([libcrypto],
287 [AS_HELP_STRING([--without-libcrypto],
288 [build in the SHA-1 algorithm, rather than
289 use external libcrypto from OpenSSL
290 (default is autodetect)])],
291 [WITH_LIBCRYPTO=$withval],
292 [AC_CHECK_LIB([crypto],
294 [WITH_LIBCRYPTO=yes],
295 [AC_MSG_WARN([Cannot find libcrypto: using stand-alone
296 SHA-1 code instead of OpenSSL])
297 WITH_LIBCRYPTO=no])])
299 AC_MSG_CHECKING([whether to use SHA-1 implementation from system libcrypto])
300 AC_MSG_RESULT([$WITH_LIBCRYPTO])
302 if test "x$WITH_LIBCRYPTO" = "xyes" -a "x$ENABLE_SSSE3_SHA1" = "xno"; then
303 AC_DEFINE([WITH_LIBCRYPTO], [1], [Define to 1 if using libcrypto SHA-1])
304 PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto])
305 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libcrypto"
308 AC_SUBST([PKGCONFIG_PRIVATE_REQUIRES], [$PKGCONFIG_PRIVATE_REQUIRES])
309 AC_SUBST([PKGCONFIG_PRIVATE_LIBS], [$PKGCONFIG_PRIVATE_LIBS])