1 AC_INIT([wimlib], [1.7.0-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/mkwinpeimg.1])
45 AC_CONFIG_FILES([programs/mkwinpeimg], [chmod +x programs/mkwinpeimg])
51 AC_CHECK_FUNCS([futimens utimensat utime flock mempcpy \
52 openat fstatat readlinkat fdopendir])
54 # Note: some of the following header checks are only to define the appropriate
55 # HAVE_*_H macro so that the NTFS-3g headers don't get confused and try to skip
56 # including certain headers.
57 AC_CHECK_HEADERS([alloca.h \
75 AC_CHECK_MEMBER([struct stat.st_mtim],
76 [AC_DEFINE([HAVE_STAT_NANOSECOND_PRECISION], [1],
77 [Define to 1 if nanosecond precision timestamps are
80 [[#include <sys/stat.h>]])
83 AC_ARG_WITH(pkgconfigdir,
84 [ --with-pkgconfigdir=DIR pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@],
85 [pkgconfigdir=$withval],
86 [pkgconfigdir='${libdir}/pkgconfig'])
87 AC_SUBST(pkgconfigdir)
89 AC_CHECK_LIB([xml2], [xmlParseFile], [have_libxml=true],
90 [AC_MSG_ERROR(["cannot find libxml2"])])
91 PKG_CHECK_MODULES([LIBXML2], [libxml-2.0])
92 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libxml-2.0"
94 AC_MSG_CHECKING([whether to include debugging messages])
95 AC_ARG_ENABLE([debug],
96 AS_HELP_STRING([--enable-debug], [include lots of debugging messages]),
97 [ENABLE_DEBUG=$enableval],
100 AC_MSG_RESULT([$ENABLE_DEBUG])
101 if test "x$ENABLE_DEBUG" = "xyes"; then
102 AC_DEFINE([ENABLE_DEBUG], [1],
103 [Define to 1 if including lots of debug messages.])
106 AC_MSG_CHECKING([whether to include error messages])
107 AC_ARG_ENABLE([error_messages],
108 AS_HELP_STRING([--disable-error-messages],
109 [do not compile in error messsages]),
110 [ENABLE_ERROR_MESSAGES=$enableval],
111 [ENABLE_ERROR_MESSAGES=yes]
113 AC_MSG_RESULT([$ENABLE_ERROR_MESSAGES])
114 if test "x$ENABLE_ERROR_MESSAGES" = "xyes"; then
115 AC_DEFINE([ENABLE_ERROR_MESSAGES], [1],
116 [Define to 1 if including error messages])
119 AC_MSG_CHECKING([whether to include assertions])
120 AC_ARG_ENABLE([assertions],
121 AS_HELP_STRING([--disable-assertions], [do not include assertions]),
122 [ENABLE_ASSERTIONS=$enableval],
123 [ENABLE_ASSERTIONS=yes]
125 AC_MSG_RESULT([$ENABLE_ASSERTIONS])
126 if test "x$ENABLE_ASSERTIONS" = "xyes"; then
127 AC_DEFINE([ENABLE_ASSERTIONS], [1], [Define to 1 if including assertions.])
130 AC_MSG_CHECKING([whether to include more assertions])
131 AC_ARG_ENABLE([more-assertions],
132 AS_HELP_STRING([--enable-more-assertions], [include even more assertions]),
133 [ENABLE_MORE_ASSERTIONS=$enableval],
134 [ENABLE_MORE_ASSERTIONS=no]
136 AC_MSG_RESULT([$ENABLE_MORE_ASSERTIONS])
137 if test "x$ENABLE_MORE_ASSERTIONS" = "xyes"; then
138 AC_DEFINE([ENABLE_MORE_ASSERTIONS], [1], [Define to 1 if including more assertions.])
142 AC_MSG_CHECKING([whether to include compression verification])
143 AC_ARG_ENABLE([verify_compression],
144 AS_HELP_STRING([--enable-verify-compression], [always
145 check if blocks we compress can be correctly
147 [ENABLE_VERIFY_COMPRESSION=$enableval],
148 [ENABLE_VERIFY_COMPRESSION=no]
150 AC_MSG_RESULT([$ENABLE_VERIFY_COMPRESSION])
151 if test "x$ENABLE_VERIFY_COMPRESSION" = "xyes"; then
152 AC_DEFINE([ENABLE_VERIFY_COMPRESSION], [1], [Define to 1 to verify
156 AC_MSG_CHECKING([whether to include support for multi-threaded compression])
157 AC_ARG_ENABLE([multithreaded-compression],
158 AS_HELP_STRING([--disable-multithreaded-compression],
159 [do not compile in the code for multi-threaded compression]),
160 [ENABLE_MULTITHREADED_COMPRESSION=$enableval],
161 [ENABLE_MULTITHREADED_COMPRESSION=yes]
163 AC_MSG_RESULT([$ENABLE_MULTITHREADED_COMPRESSION])
164 if test "x$ENABLE_MULTITHREADED_COMPRESSION" = "xyes"; then
165 AC_DEFINE([ENABLE_MULTITHREADED_COMPRESSION], [1],
166 [Define to 1 if including support for multithreaded
170 PTHREAD_LDADD="-lpthread"
171 AC_SUBST([PTHREAD_LDADD], [$PTHREAD_LDADD])
173 WITH_NTFS_3G_DEFAULT="yes"
174 WITH_FUSE_DEFAULT="yes"
175 WINDOWS_NATIVE_BUILD="no"
176 VISIBILITY_CFLAGS="-fvisibility=hidden"
185 WITH_NTFS_3G_DEFAULT="no"
186 WITH_FUSE_DEFAULT="no"
187 WINDOWS_NATIVE_BUILD="yes"
189 WINDOWS_CFLAGS="-municode"
190 WINDOWS_CPPFLAGS="-D_POSIX -DUNICODE -D_UNICODE -D_CRT_NON_CONFORMING_SWPRINTFS"
191 WINDOWS_LDFLAGS="-no-undefined"
192 WINDOWS_LDADD="-lshlwapi"
195 # Cygwin (WARNING: not well supported)
196 AC_MSG_WARN([wimlib has not been tested with Cygwin! Please do
197 a Windows-native build with MinGW-w64 instead])
198 WITH_NTFS_3G_DEFAULT="no"
199 WITH_FUSE_DEFAULT="no"
207 AC_SUBST([VISIBILITY_CFLAGS], [$VISIBILITY_CFLAGS])
208 AC_SUBST([WINDOWS_LDFLAGS], [$WINDOWS_LDFLAGS])
209 AC_SUBST([WINDOWS_LDADD], [$WINDOWS_LDADD])
210 AC_SUBST([WINDOWS_CPPFLAGS], [$WINDOWS_CPPFLAGS])
211 AC_SUBST([WINDOWS_CFLAGS], [$WINDOWS_CFLAGS])
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 On UNIX, 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], [On UNIX, define to 1 to enable support
226 for 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
238 PKG_CHECK_MODULES([LIBNTFS_3G], [libntfs-3g])
239 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libntfs-3g"
241 dnl This checks for an NTFS-3g interface that was changed in the
242 dnl 2013.1.13 release
243 AC_CHECK_DECL([NTFS_MNT_RDONLY],
244 [AC_DEFINE([HAVE_NTFS_MNT_RDONLY],
246 [Define to 1 if ntfs_mount() takes the flag NTFS_MNT_RDONLY])],
248 [#include <ntfs-3g/volume.h>])
250 AM_CONDITIONAL([WITH_NTFS_3G], [test "x$WITH_NTFS_3G" = "xyes"])
253 if test "x$am_cv_func_iconv" != "xyes"; then
254 AC_MSG_ERROR([Cannot find the iconv() function.
255 iconv() is used to convert between encodings of WIM filenames and XML data.
256 wimlib cannot be compiled without it. iconv() is available in the latest
257 version of glibc and sometimes in other libraries.])
260 AC_MSG_CHECKING([whether to include support for mounting WIMs])
262 AS_HELP_STRING([--without-fuse], [build without libfuse.
263 This will disable the ability to mount
265 [WITH_FUSE=$withval],
266 [WITH_FUSE=$WITH_FUSE_DEFAULT]
268 AC_MSG_RESULT([$WITH_FUSE])
269 if test "x$WITH_FUSE" = "xyes"; then
270 AC_DEFINE([WITH_FUSE], [1], [Define to 1 if using FUSE.])
273 AC_CHECK_LIB([fuse], [fuse_main_real], [have_fuse=true],
274 [AC_MSG_ERROR([Cannot find libfuse.
275 Without libfuse, wimlib cannot include support for mounting WIMs. You
276 should either install libfuse, or configure with --without-fuse to
277 disable support for mounting WIMs.])
279 AC_CHECK_LIB([rt], [mq_open], [have_posix_mq=true],
280 [AC_MSG_ERROR([Cannot find librt for POSIX message queue
281 functions. Without these functions, wimlib cannot include support for
282 mounting WIMs. You should either update your C library to a recent
283 version of glibc, or configure with --without-fuse to disable support
286 PKG_CHECK_MODULES([LIBFUSE], [fuse])
287 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES fuse"
288 PKGCONFIG_PRIVATE_LIBS="$PKGCONFIG_PRIVATE_LIBS -lrt"
289 AC_SUBST([LIBRT_LIBS], [-lrt])
291 AM_CONDITIONAL([WITH_FUSE], [test "x$WITH_FUSE" = "xyes"])
293 AC_MSG_CHECKING([whether to use SSSE3-accelerated SHA1 ])
294 AC_ARG_ENABLE([ssse3-sha1],
295 AS_HELP_STRING([--enable-ssse3-sha1], [use assembly language implementation
296 of SHA1 from Intel, accelerated with vector
297 instructions (SSSE3-enabled CPU required)]),
298 [ENABLE_SSSE3_SHA1=$enableval],
299 [ENABLE_SSSE3_SHA1=no]
302 AC_MSG_RESULT([$ENABLE_SSSE3_SHA1])
303 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
304 AC_DEFINE([ENABLE_SSSE3_SHA1], [1],
305 [Define to 1 if using vectorized implementation of SHA1])
306 SSSE3_SHA1_OBJ=sha1-ssse3.lo
308 AC_SUBST([NASM], [$nasm])
312 AC_SUBST([SSSE3_SHA1_OBJ], [$SSSE3_SHA1_OBJ])
314 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
317 AC_ARG_WITH([libcrypto],
318 AS_HELP_STRING([--without-libcrypto], [build in the SHA1 algorithm,
319 rather than use external libcrypto from
320 OpenSSL (default is autodetect)]),
321 [WITH_LIBCRYPTO=$withval],
322 [AC_CHECK_LIB([crypto], [SHA1],
323 [WITH_LIBCRYPTO=yes],
324 [AC_MSG_WARN([Cannot find libcrypto: using stand-alone SHA1 code instead of OpenSSL])
328 AC_MSG_CHECKING([whether to use SHA1 function from system libcrypto])
329 AC_MSG_RESULT([$WITH_LIBCRYPTO])
331 if test "x$WITH_LIBCRYPTO" = "xyes" -a "x$ENABLE_SSSE3_SHA1" = "xno"; then
332 AC_DEFINE([WITH_LIBCRYPTO], [1], [Define to 1 if using libcrypto SHA1])
333 PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto])
334 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libcrypto"
336 AC_SUBST([SHA1_SOURCES], [$SHA1_SOURCES])
338 AC_SUBST([PKGCONFIG_PRIVATE_REQUIRES], [$PKGCONFIG_PRIVATE_REQUIRES])
339 AC_SUBST([PKGCONFIG_PRIVATE_LIBS], [$PKGCONFIG_PRIVATE_LIBS])