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"
138 PLATFORM_CFLAGS="-fvisibility=hidden"
144 WINDOWS_NATIVE_BUILD="yes"
145 PLATFORM_CPPFLAGS="-D_POSIX -DUNICODE -D_UNICODE -D_CRT_NON_CONFORMING_SWPRINTFS"
146 PLATFORM_CFLAGS="-municode -mno-ms-bitfields"
147 PLATFORM_LDFLAGS="-no-undefined"
151 WITH_FUSE_DEFAULT="yes"
152 WITH_NTFS_3G_DEFAULT="yes"
156 WITH_NTFS_3G_DEFAULT="yes"
160 AC_SUBST([PLATFORM_CPPFLAGS], [$PLATFORM_CPPFLAGS])
161 AC_SUBST([PLATFORM_CFLAGS], [$PLATFORM_CFLAGS])
162 AC_SUBST([PLATFORM_LDFLAGS], [$PLATFORM_LDFLAGS])
163 AM_CONDITIONAL([WINDOWS_NATIVE_BUILD], [test "x$WINDOWS_NATIVE_BUILD" = "xyes"])
167 if test "x$am_cv_func_iconv" != "xyes"; then
168 AC_MSG_ERROR([Cannot find the iconv() function. iconv() is used to
169 convert between encodings of WIM filenames and XML data.
170 wimlib cannot be compiled without it. iconv() is
171 available in the latest version of glibc and sometimes in
175 AC_MSG_CHECKING([whether to include support for ntfs-3g])
176 AC_ARG_WITH([ntfs-3g],
177 [AS_HELP_STRING([--without-ntfs-3g],
178 [build without libntfs-3g. This will disable the
179 ability to capture or apply a WIM image directly
180 from/to an unmounted NTFS volume.])],
181 [WITH_NTFS_3G=$withval],
182 [WITH_NTFS_3G=$WITH_NTFS_3G_DEFAULT])
184 AC_MSG_RESULT([$WITH_NTFS_3G])
185 if test "x$WITH_NTFS_3G" = "xyes"; then
186 AC_DEFINE([WITH_NTFS_3G], [1], [Define to 1 to enable NTFS-3g support.])
188 dnl This effectively checks for NTFS-3g 2011.4.12 or later
189 AC_CHECK_LIB([ntfs-3g], [ntfs_xattr_system_setxattr], [],
190 [AC_MSG_ERROR([Cannot find libntfs-3g version 2011-4-12
191 or later! Without libntfs-3g, wimlib cannot include support for
192 capturing or applying a WIM image directly from/to an unmounted NTFS
193 volume while preserving NTFS-specific data such as security descriptors
194 and named data streams. Either install libntfs-3g, or configure
195 --without-ntfs-3g to disable this feature.])])
197 PKG_CHECK_MODULES([LIBNTFS_3G], [libntfs-3g])
198 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libntfs-3g"
200 dnl This checks for an NTFS-3g interface that was changed in the
201 dnl 2013.1.13 release
202 AC_CHECK_DECL([NTFS_MNT_RDONLY],
203 [AC_DEFINE([HAVE_NTFS_MNT_RDONLY],
205 [Define to 1 if ntfs_mount() takes the flag NTFS_MNT_RDONLY])],
207 [#include <ntfs-3g/volume.h>])
209 AM_CONDITIONAL([WITH_NTFS_3G], [test "x$WITH_NTFS_3G" = "xyes"])
211 AC_MSG_CHECKING([whether to include support for mounting WIMs])
213 [AS_HELP_STRING([--without-fuse],
214 [build without libfuse. This will disable the ability
215 to mount WIM images.])],
216 [WITH_FUSE=$withval],
217 [WITH_FUSE=$WITH_FUSE_DEFAULT])
219 AC_MSG_RESULT([$WITH_FUSE])
220 if test "x$WITH_FUSE" = "xyes"; then
221 AC_DEFINE([WITH_FUSE], [1], [Define to 1 if using FUSE.])
223 AC_CHECK_LIB([fuse], [fuse_main_real], [],
224 [AC_MSG_ERROR([Cannot find libfuse!
225 Without libfuse, wimlib cannot include support for mounting WIM images.
226 Either install libfuse, or configure --without-fuse to disable this
229 AC_CHECK_LIB([rt], [mq_open], [],
230 [AC_MSG_ERROR([Cannot find librt (the POSIX.1b Realtime
231 Extensions Library)! wimlib needs this for the POSIX message queue
232 functions, which are used in the code for mounting WIM images. Recent
233 versions of glibc include this library. Either install this library, or
234 configure --without-fuse to disable support for mounting WIM images.])])
236 AC_CHECK_LIB([attr], [getxattr], [],
237 [AC_MSG_ERROR([Cannot find libattr!
238 wimlib needs this for the extended attribute functions, which are used
239 in the code for mounting WIM images. Either install this library, or
240 configure --without-fuse to disable support for mounting WIM images.])])
242 PKG_CHECK_MODULES([LIBFUSE], [fuse])
243 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES fuse"
244 PKGCONFIG_PRIVATE_LIBS="$PKGCONFIG_PRIVATE_LIBS -lrt"
245 AC_SUBST([LIBRT_LIBS], [-lrt])
247 AM_CONDITIONAL([WITH_FUSE], [test "x$WITH_FUSE" = "xyes"])
249 AC_MSG_CHECKING([whether to use SSSE3-accelerated SHA-1])
250 AC_ARG_ENABLE([ssse3-sha1],
251 [AS_HELP_STRING([--enable-ssse3-sha1],
252 [Include SSSE3-accelerated SHA-1 implementation by
253 Intel. This implies --without-libcrypto.])],
254 [ENABLE_SSSE3_SHA1=$enableval],
255 [ENABLE_SSSE3_SHA1=no])
257 AC_MSG_RESULT([$ENABLE_SSSE3_SHA1])
258 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
259 AC_DEFINE([ENABLE_SSSE3_SHA1], [1],
260 [Define to 1 if using SSSE3 implementation of SHA-1])
261 SSSE3_SHA1_OBJ=src/sha1-ssse3.lo
263 NASM_SYMBOL_PREFIX=""
264 NASM_PLATFORM_FLAGS=""
265 if test "x$WINDOWS_NATIVE_BUILD" = "xyes"; then
266 NASM_PLATFORM_FLAGS="-DWIN_ABI"
269 darwin* | rhapsody* | nextstep* | openstep* | macos*)
270 NASM_SYMBOL_PREFIX="_"
273 AC_SUBST([NASM_PLATFORM_FLAGS], $NASM_PLATFORM_FLAGS)
274 AC_SUBST([NASM_SYMBOL_PREFIX], $NASM_SYMBOL_PREFIX)
278 AC_SUBST([SSSE3_SHA1_OBJ], [$SSSE3_SHA1_OBJ])
280 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
283 AC_ARG_WITH([libcrypto],
284 [AS_HELP_STRING([--without-libcrypto],
285 [build in the SHA-1 algorithm, rather than
286 use external libcrypto from OpenSSL
287 (default is autodetect)])],
288 [WITH_LIBCRYPTO=$withval],
289 [AC_CHECK_LIB([crypto],
291 [WITH_LIBCRYPTO=yes],
292 [AC_MSG_WARN([Cannot find libcrypto: using stand-alone
293 SHA-1 code instead of OpenSSL])
294 WITH_LIBCRYPTO=no])])
296 AC_MSG_CHECKING([whether to use SHA-1 implementation from system libcrypto])
297 AC_MSG_RESULT([$WITH_LIBCRYPTO])
299 if test "x$WITH_LIBCRYPTO" = "xyes" -a "x$ENABLE_SSSE3_SHA1" = "xno"; then
300 AC_DEFINE([WITH_LIBCRYPTO], [1], [Define to 1 if using libcrypto SHA-1])
301 PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto])
302 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libcrypto"
305 AC_SUBST([PKGCONFIG_PRIVATE_REQUIRES], [$PKGCONFIG_PRIVATE_REQUIRES])
306 AC_SUBST([PKGCONFIG_PRIVATE_LIBS], [$PKGCONFIG_PRIVATE_LIBS])