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_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/man1/"$IMAGEX_PROGNAME".1:doc/man1/imagex.1.in]
28 [doc/man1/"$IMAGEX_PROGNAME"-append.1:doc/man1/imagex-append.1.in]
29 [doc/man1/"$IMAGEX_PROGNAME"-apply.1:doc/man1/imagex-apply.1.in]
30 [doc/man1/"$IMAGEX_PROGNAME"-capture.1:doc/man1/imagex-capture.1.in]
31 [doc/man1/"$IMAGEX_PROGNAME"-delete.1:doc/man1/imagex-delete.1.in]
32 [doc/man1/"$IMAGEX_PROGNAME"-dir.1:doc/man1/imagex-dir.1.in]
33 [doc/man1/"$IMAGEX_PROGNAME"-export.1:doc/man1/imagex-export.1.in]
34 [doc/man1/"$IMAGEX_PROGNAME"-extract.1:doc/man1/imagex-extract.1.in]
35 [doc/man1/"$IMAGEX_PROGNAME"-info.1:doc/man1/imagex-info.1.in]
36 [doc/man1/"$IMAGEX_PROGNAME"-join.1:doc/man1/imagex-join.1.in]
37 [doc/man1/"$IMAGEX_PROGNAME"-mount.1:doc/man1/imagex-mount.1.in]
38 [doc/man1/"$IMAGEX_PROGNAME"-mountrw.1:doc/man1/imagex-mountrw.1.in]
39 [doc/man1/"$IMAGEX_PROGNAME"-optimize.1:doc/man1/imagex-optimize.1.in]
40 [doc/man1/"$IMAGEX_PROGNAME"-split.1:doc/man1/imagex-split.1.in]
41 [doc/man1/"$IMAGEX_PROGNAME"-unmount.1:doc/man1/imagex-unmount.1.in]
42 [doc/man1/"$IMAGEX_PROGNAME"-update.1:doc/man1/imagex-update.1.in]
43 [doc/man1/"$IMAGEX_PROGNAME"-verify.1:doc/man1/imagex-verify.1.in]
44 [doc/man1/mkwinpeimg.1])
46 AC_CONFIG_FILES([programs/mkwinpeimg], [chmod +x programs/mkwinpeimg])
52 AC_CHECK_FUNCS([futimens utimensat utime flock mempcpy \
53 openat fstatat readlinkat fdopendir])
55 # Note: some of the following header checks are only to define the appropriate
56 # HAVE_*_H macro so that the NTFS-3g headers don't get confused and try to skip
57 # including certain headers.
58 AC_CHECK_HEADERS([alloca.h \
76 AC_CHECK_MEMBER([struct stat.st_mtim],
77 [AC_DEFINE([HAVE_STAT_NANOSECOND_PRECISION], [1],
78 [Define to 1 if nanosecond precision timestamps are
81 [[#include <sys/stat.h>]])
84 AC_ARG_WITH(pkgconfigdir,
85 [ --with-pkgconfigdir=DIR pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@],
86 [pkgconfigdir=$withval],
87 [pkgconfigdir='${libdir}/pkgconfig'])
88 AC_SUBST(pkgconfigdir)
90 AC_CHECK_LIB([xml2], [xmlParseFile], [have_libxml=true],
91 [AC_MSG_ERROR(["cannot find libxml2"])])
92 PKG_CHECK_MODULES([LIBXML2], [libxml-2.0])
93 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libxml-2.0"
95 AC_MSG_CHECKING([whether to include debugging messages])
96 AC_ARG_ENABLE([debug],
97 AS_HELP_STRING([--enable-debug], [include lots of debugging messages]),
98 [ENABLE_DEBUG=$enableval],
101 AC_MSG_RESULT([$ENABLE_DEBUG])
102 if test "x$ENABLE_DEBUG" = "xyes"; then
103 AC_DEFINE([ENABLE_DEBUG], [1],
104 [Define to 1 if including lots of debug messages.])
107 AC_MSG_CHECKING([whether to include error messages])
108 AC_ARG_ENABLE([error_messages],
109 AS_HELP_STRING([--disable-error-messages],
110 [do not compile in error messsages]),
111 [ENABLE_ERROR_MESSAGES=$enableval],
112 [ENABLE_ERROR_MESSAGES=yes]
114 AC_MSG_RESULT([$ENABLE_ERROR_MESSAGES])
115 if test "x$ENABLE_ERROR_MESSAGES" = "xyes"; then
116 AC_DEFINE([ENABLE_ERROR_MESSAGES], [1],
117 [Define to 1 if including error messages])
120 AC_MSG_CHECKING([whether to include assertions])
121 AC_ARG_ENABLE([assertions],
122 AS_HELP_STRING([--disable-assertions], [do not include assertions]),
123 [ENABLE_ASSERTIONS=$enableval],
124 [ENABLE_ASSERTIONS=yes]
126 AC_MSG_RESULT([$ENABLE_ASSERTIONS])
127 if test "x$ENABLE_ASSERTIONS" = "xyes"; then
128 AC_DEFINE([ENABLE_ASSERTIONS], [1], [Define to 1 if including assertions.])
131 AC_MSG_CHECKING([whether to include automatic compression verification])
132 AC_ARG_ENABLE([verify_compression],
133 AS_HELP_STRING([--enable-verify-compression], [always
134 check if blocks we compress can be correctly
136 [ENABLE_VERIFY_COMPRESSION=$enableval],
137 [ENABLE_VERIFY_COMPRESSION=no]
139 AC_MSG_RESULT([$ENABLE_VERIFY_COMPRESSION])
140 if test "x$ENABLE_VERIFY_COMPRESSION" = "xyes"; then
141 AC_DEFINE([ENABLE_VERIFY_COMPRESSION], [1], [Define to 1 to verify
145 AC_MSG_CHECKING([whether to include support for multi-threaded compression])
146 AC_ARG_ENABLE([multithreaded-compression],
147 AS_HELP_STRING([--disable-multithreaded-compression],
148 [do not compile in the code for multi-threaded compression]),
149 [ENABLE_MULTITHREADED_COMPRESSION=$enableval],
150 [ENABLE_MULTITHREADED_COMPRESSION=yes]
152 AC_MSG_RESULT([$ENABLE_MULTITHREADED_COMPRESSION])
153 if test "x$ENABLE_MULTITHREADED_COMPRESSION" = "xyes"; then
154 AC_DEFINE([ENABLE_MULTITHREADED_COMPRESSION], [1],
155 [Define to 1 if including support for multithreaded
159 PTHREAD_LDADD="-lpthread"
160 AC_SUBST([PTHREAD_LDADD], [$PTHREAD_LDADD])
162 WITH_NTFS_3G_DEFAULT="no"
163 WITH_FUSE_DEFAULT="no"
164 WINDOWS_NATIVE_BUILD="no"
165 VISIBILITY_CFLAGS="-fvisibility=hidden"
173 WINDOWS_NATIVE_BUILD="yes"
175 WINDOWS_CFLAGS="-municode"
176 WINDOWS_CPPFLAGS="-D_POSIX -DUNICODE -D_UNICODE -D_CRT_NON_CONFORMING_SWPRINTFS"
177 WINDOWS_LDFLAGS="-no-undefined"
181 WITH_FUSE_DEFAULT="yes"
182 WITH_NTFS_3G_DEFAULT="yes"
186 WITH_NTFS_3G_DEFAULT="yes"
190 AC_SUBST([VISIBILITY_CFLAGS], [$VISIBILITY_CFLAGS])
191 AC_SUBST([WINDOWS_LDFLAGS], [$WINDOWS_LDFLAGS])
192 AC_SUBST([WINDOWS_CPPFLAGS], [$WINDOWS_CPPFLAGS])
193 AC_SUBST([WINDOWS_CFLAGS], [$WINDOWS_CFLAGS])
194 AM_CONDITIONAL([WINDOWS_NATIVE_BUILD], [test "x$WINDOWS_NATIVE_BUILD" = "xyes"])
198 if test "x$am_cv_func_iconv" != "xyes"; then
199 AC_MSG_ERROR([Cannot find the iconv() function. iconv() is used to
200 convert between encodings of WIM filenames and XML data.
201 wimlib cannot be compiled without it. iconv() is
202 available in the latest version of glibc and sometimes in
206 AC_MSG_CHECKING([whether to include support for ntfs-3g])
207 AC_ARG_WITH([ntfs-3g],
208 [AS_HELP_STRING([--without-ntfs-3g],
209 [build without libntfs-3g. This will disable the
210 ability to capture or apply a WIM image directly
211 from/to an unmounted NTFS volume.])],
212 [WITH_NTFS_3G=$withval],
213 [WITH_NTFS_3G=$WITH_NTFS_3G_DEFAULT])
215 AC_MSG_RESULT([$WITH_NTFS_3G])
216 if test "x$WITH_NTFS_3G" = "xyes"; then
217 AC_DEFINE([WITH_NTFS_3G], [1], [Define to 1 to enable NTFS-3g support.])
219 dnl This effectively checks for NTFS-3g 2011.4.12 or later
220 AC_CHECK_LIB([ntfs-3g], [ntfs_xattr_system_setxattr], [],
221 [AC_MSG_ERROR([Cannot find libntfs-3g version 2011-4-12
222 or later! Without libntfs-3g, wimlib cannot include support for
223 capturing or applying a WIM image directly from/to an unmounted NTFS
224 volume while preserving NTFS-specific data such as security descriptors
225 and named data streams. Either install libntfs-3g, or configure
226 --without-ntfs-3g to disable this feature.])])
228 PKG_CHECK_MODULES([LIBNTFS_3G], [libntfs-3g])
229 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libntfs-3g"
231 dnl This checks for an NTFS-3g interface that was changed in the
232 dnl 2013.1.13 release
233 AC_CHECK_DECL([NTFS_MNT_RDONLY],
234 [AC_DEFINE([HAVE_NTFS_MNT_RDONLY],
236 [Define to 1 if ntfs_mount() takes the flag NTFS_MNT_RDONLY])],
238 [#include <ntfs-3g/volume.h>])
240 AM_CONDITIONAL([WITH_NTFS_3G], [test "x$WITH_NTFS_3G" = "xyes"])
242 AC_MSG_CHECKING([whether to include support for mounting WIMs])
244 [AS_HELP_STRING([--without-fuse],
245 [build without libfuse. This will disable the ability
246 to mount WIM images.])],
247 [WITH_FUSE=$withval],
248 [WITH_FUSE=$WITH_FUSE_DEFAULT])
250 AC_MSG_RESULT([$WITH_FUSE])
251 if test "x$WITH_FUSE" = "xyes"; then
252 AC_DEFINE([WITH_FUSE], [1], [Define to 1 if using FUSE.])
254 AC_CHECK_LIB([fuse], [fuse_main_real], [],
255 [AC_MSG_ERROR([Cannot find libfuse!
256 Without libfuse, wimlib cannot include support for mounting WIM images.
257 Either install libfuse, or configure --without-fuse to disable this
260 AC_CHECK_LIB([rt], [mq_open], [],
261 [AC_MSG_ERROR([Cannot find librt (the POSIX.1b Realtime
262 Extensions Library)! wimlib needs this for the POSIX message queue
263 functions, which are used in the code for mounting WIM images. Recent
264 versions of glibc include this library. Either install this library, or
265 configure --without-fuse to disable support for mounting WIM images.])])
267 AC_CHECK_LIB([attr], [getxattr], [],
268 [AC_MSG_ERROR([Cannot find libattr!
269 wimlib needs this for the extended attribute functions, which are used
270 in the code for mounting WIM images. Either install this library, or
271 configure --without-fuse to disable support for mounting WIM images.])])
273 PKG_CHECK_MODULES([LIBFUSE], [fuse])
274 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES fuse"
275 PKGCONFIG_PRIVATE_LIBS="$PKGCONFIG_PRIVATE_LIBS -lrt"
276 AC_SUBST([LIBRT_LIBS], [-lrt])
278 AM_CONDITIONAL([WITH_FUSE], [test "x$WITH_FUSE" = "xyes"])
280 AC_MSG_CHECKING([whether to use SSSE3-accelerated SHA-1])
281 AC_ARG_ENABLE([ssse3-sha1],
282 [AS_HELP_STRING([--enable-ssse3-sha1],
283 [Include SSSE3-accelerated SHA-1 implementation by
284 Intel. This implies --without-libcrypto.])],
285 [ENABLE_SSSE3_SHA1=$enableval],
286 [ENABLE_SSSE3_SHA1=no])
288 AC_MSG_RESULT([$ENABLE_SSSE3_SHA1])
289 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
290 AC_DEFINE([ENABLE_SSSE3_SHA1], [1],
291 [Define to 1 if using SSSE3 implementation of SHA-1])
292 SSSE3_SHA1_OBJ=src/sha1-ssse3.lo
294 NASM_SYMBOL_PREFIX=""
296 if test "x$WINDOWS_NATIVE_BUILD" = "xyes"; then
297 NASM_WINDOWS_FLAGS="-DWIN_ABI"
300 darwin* | rhapsody* | nextstep* | openstep* | macos*)
301 NASM_SYMBOL_PREFIX="_"
304 AC_SUBST([NASM_WINDOWS_FLAGS], $NASM_WINDOWS_FLAGS)
305 AC_SUBST([NASM_SYMBOL_PREFIX], $NASM_SYMBOL_PREFIX)
309 AC_SUBST([SSSE3_SHA1_OBJ], [$SSSE3_SHA1_OBJ])
311 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
314 AC_ARG_WITH([libcrypto],
315 [AS_HELP_STRING([--without-libcrypto],
316 [build in the SHA-1 algorithm, rather than
317 use external libcrypto from OpenSSL
318 (default is autodetect)])],
319 [WITH_LIBCRYPTO=$withval],
320 [AC_CHECK_LIB([crypto],
322 [WITH_LIBCRYPTO=yes],
323 [AC_MSG_WARN([Cannot find libcrypto: using stand-alone
324 SHA-1 code instead of OpenSSL])
325 WITH_LIBCRYPTO=no])])
327 AC_MSG_CHECKING([whether to use SHA-1 implementation from system libcrypto])
328 AC_MSG_RESULT([$WITH_LIBCRYPTO])
330 if test "x$WITH_LIBCRYPTO" = "xyes" -a "x$ENABLE_SSSE3_SHA1" = "xno"; then
331 AC_DEFINE([WITH_LIBCRYPTO], [1], [Define to 1 if using libcrypto SHA-1])
332 PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto])
333 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libcrypto"
336 AC_SUBST([PKGCONFIG_PRIVATE_REQUIRES], [$PKGCONFIG_PRIVATE_REQUIRES])
337 AC_SUBST([PKGCONFIG_PRIVATE_LIBS], [$PKGCONFIG_PRIVATE_LIBS])