1 ###############################################################################
3 AC_INIT([wimlib], [1.7.4-BETA], [ebiggers3@gmail.com])
4 AC_CONFIG_SRCDIR([src/wim.c])
5 AC_CONFIG_MACRO_DIR([m4])
6 AC_CONFIG_AUX_DIR([build-aux])
7 AM_INIT_AUTOMAKE([-Wall -Werror subdir-objects foreign])
8 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
11 AC_CONFIG_HEADERS([config.h])
12 AC_CONFIG_FILES([Makefile] [doc/Doxyfile] [wimlib.pc])
13 AC_CONFIG_FILES([programs/mkwinpeimg], [chmod +x programs/mkwinpeimg])
15 PKGCONFIG_PRIVATE_REQUIRES=""
16 PKGCONFIG_PRIVATE_LIBS=""
18 ###############################################################################
19 # General platform features #
20 ###############################################################################
26 WINDOWS_NATIVE_BUILD="no"
28 PLATFORM_CFLAGS="-fvisibility=hidden"
34 WINDOWS_NATIVE_BUILD="yes"
35 PLATFORM_CPPFLAGS="-D_POSIX -DUNICODE -D_UNICODE -D_CRT_NON_CONFORMING_SWPRINTFS"
36 PLATFORM_CFLAGS="-municode -mno-ms-bitfields"
37 PLATFORM_LDFLAGS="-no-undefined"
38 WITH_NTFS_3G_DEFAULT="no"
39 WITH_FUSE_DEFAULT="no"
43 WITH_NTFS_3G_DEFAULT="yes"
44 WITH_FUSE_DEFAULT="yes"
48 WITH_NTFS_3G_DEFAULT="yes"
49 WITH_FUSE_DEFAULT="no"
53 AC_SUBST([PLATFORM_CPPFLAGS], [$PLATFORM_CPPFLAGS])
54 AC_SUBST([PLATFORM_CFLAGS], [$PLATFORM_CFLAGS])
55 AC_SUBST([PLATFORM_LDFLAGS], [$PLATFORM_LDFLAGS])
56 AM_CONDITIONAL([WINDOWS_NATIVE_BUILD], [test "$WINDOWS_NATIVE_BUILD" = "yes"])
58 # Useful functions which we can do without.
59 AC_CHECK_FUNCS([futimens utimensat flock mempcpy \
60 openat fstatat readlinkat fdopendir])
62 # Header checks, most of which are only here to satisfy conditional includes
63 # made by the libntfs-3g headers.
64 AC_CHECK_HEADERS([alloca.h \
82 # Does stat() support nanosecond-precision timestamps? (This is relevant on
83 # UNIX but not on Windows.)
84 AC_CHECK_MEMBER([struct stat.st_mtim],
85 [AC_DEFINE([HAVE_STAT_NANOSECOND_PRECISION], [1],
86 [Define to 1 if stat() supports nanosecond precision
89 [#include <sys/stat.h>])
91 ###############################################################################
92 # Required libraries #
93 ###############################################################################
95 # ------------------------------ pthreads -------------------------------------
96 AX_PTHREAD([], [AC_MSG_ERROR(["cannot find pthreads library"])])
98 # ------------------------------ libxml2 --------------------------------------
99 AC_CHECK_LIB([xml2], [xmlReadMemory], [],
100 [AC_MSG_ERROR(["cannot find libxml2"])])
101 PKG_CHECK_MODULES([LIBXML2], [libxml-2.0])
102 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libxml-2.0"
104 # ------------------------------ libiconv -------------------------------------
106 if test "$am_cv_func_iconv" != "yes"; then
107 AC_MSG_ERROR([Cannot find the iconv() function. iconv() is used to
108 convert between encodings of WIM filenames and XML data.
109 wimlib cannot be compiled without it. iconv() is
110 available in the latest version of glibc and sometimes in
114 ###############################################################################
115 # Configuration options #
116 ###############################################################################
118 # ------------------------- ntfs-3g support -----------------------------------
120 AC_MSG_CHECKING([whether to include support for ntfs-3g])
121 AC_ARG_WITH([ntfs-3g],
122 [AS_HELP_STRING([--without-ntfs-3g],
123 [build without libntfs-3g. This will disable the
124 ability to capture or apply a WIM image directly
125 from/to an unmounted NTFS volume.])],
126 [WITH_NTFS_3G=$withval],
127 [WITH_NTFS_3G=$WITH_NTFS_3G_DEFAULT])
128 AC_MSG_RESULT([$WITH_NTFS_3G])
130 if test "$WITH_NTFS_3G" = "yes"; then
131 # This effectively checks for NTFS-3g 2011.4.12 or later
132 AC_CHECK_LIB([ntfs-3g], [ntfs_xattr_system_setxattr], [],
133 [AC_MSG_ERROR([Cannot find libntfs-3g version 2011-4-12
134 or later! Without libntfs-3g, wimlib cannot include support for
135 capturing or applying a WIM image directly from/to an unmounted NTFS
136 volume while preserving NTFS-specific data such as security descriptors
137 and named data streams. Either install libntfs-3g, or configure
138 --without-ntfs-3g to disable this feature.])])
140 # This checks a definition that was changed in NTFS-3g 2013.1.13
141 AC_CHECK_DECL([NTFS_MNT_RDONLY],
142 [AC_DEFINE([HAVE_NTFS_MNT_RDONLY], [1],
143 [Define to 1 if ntfs_mount() takes the flag
146 [#include <ntfs-3g/volume.h>])
148 AC_DEFINE([WITH_NTFS_3G], [1], [Define to 1 if using NTFS-3g support])
149 PKG_CHECK_MODULES([LIBNTFS_3G], [libntfs-3g])
150 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libntfs-3g"
152 AM_CONDITIONAL([WITH_NTFS_3G], [test "$WITH_NTFS_3G" = "yes"])
154 # ------------------------ FUSE mount support ---------------------------------
156 AC_MSG_CHECKING([whether to include support for mounting WIMs])
158 [AS_HELP_STRING([--without-fuse],
159 [build without libfuse. This will disable the
160 ability to mount WIM images.])],
161 [WITH_FUSE=$withval],
162 [WITH_FUSE=$WITH_FUSE_DEFAULT])
163 AC_MSG_RESULT([$WITH_FUSE])
165 if test "$WITH_FUSE" = "yes"; then
166 AC_CHECK_LIB([fuse], [fuse_main_real], [],
167 [AC_MSG_ERROR([Cannot find libfuse!
168 Without libfuse, wimlib cannot include support for mounting WIM images.
169 Either install libfuse, or configure --without-fuse to disable this
172 AC_CHECK_LIB([rt], [mq_open], [],
173 [AC_MSG_ERROR([Cannot find librt (the POSIX.1b Realtime
174 Extensions Library)! wimlib needs this for the POSIX message queue
175 functions, which are used in the code for mounting WIM images. Recent
176 versions of glibc include this library. Either install this library, or
177 configure --without-fuse to disable support for mounting WIM images.])])
179 AC_CHECK_LIB([attr], [getxattr], [],
180 [AC_MSG_ERROR([Cannot find libattr!
181 wimlib needs this for the extended attribute functions, which are used
182 in the code for mounting WIM images. Either install this library, or
183 configure --without-fuse to disable support for mounting WIM images.])])
185 AC_DEFINE([WITH_FUSE], [1], [Define to 1 if using FUSE support])
186 PKG_CHECK_MODULES([LIBFUSE], [fuse])
187 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES fuse"
188 PKGCONFIG_PRIVATE_LIBS="$PKGCONFIG_PRIVATE_LIBS -lrt"
189 AC_SUBST([LIBRT_LIBS], [-lrt])
191 AM_CONDITIONAL([WITH_FUSE], [test "$WITH_FUSE" = "yes"])
193 # ------------------------ SHA-1 implementation ---------------------------------
195 AC_MSG_CHECKING([whether to use SSSE3-accelerated SHA-1])
196 AC_ARG_ENABLE([ssse3-sha1],
197 [AS_HELP_STRING([--enable-ssse3-sha1],
198 [Include SSSE3-accelerated SHA-1 implementation by
199 Intel. This implies --without-libcrypto.])],
200 [ENABLE_SSSE3_SHA1=$enableval],
201 [ENABLE_SSSE3_SHA1=no])
202 AC_MSG_RESULT([$ENABLE_SSSE3_SHA1])
204 if test "$ENABLE_SSSE3_SHA1" = "yes" ; then
205 AC_DEFINE([ENABLE_SSSE3_SHA1], [1],
206 [Define to 1 if using SSSE3 implementation of SHA-1])
208 NASM_SYMBOL_PREFIX=""
209 NASM_PLATFORM_FLAGS=""
210 if test "$WINDOWS_NATIVE_BUILD" = "yes"; then
211 NASM_PLATFORM_FLAGS="-DWIN_ABI"
214 darwin* | rhapsody* | nextstep* | openstep* | macos*)
215 NASM_SYMBOL_PREFIX="_"
218 AC_SUBST([NASM_PLATFORM_FLAGS], [$NASM_PLATFORM_FLAGS])
219 AC_SUBST([NASM_SYMBOL_PREFIX], [$NASM_SYMBOL_PREFIX])
221 AC_ARG_WITH([libcrypto],
222 [AS_HELP_STRING([--without-libcrypto],
223 [build in the SHA-1 algorithm, rather than
224 use external libcrypto from OpenSSL
225 (default is autodetect)])],
226 [WITH_LIBCRYPTO=$withval],
227 [AC_CHECK_LIB([crypto], [SHA1], [WITH_LIBCRYPTO=yes],
228 [AC_MSG_WARN([Cannot find libcrypto: using
229 stand-alone SHA-1 code instead of OpenSSL])
230 WITH_LIBCRYPTO=no])])
231 AC_MSG_CHECKING([whether to use SHA-1 implementation from system libcrypto])
232 AC_MSG_RESULT([$WITH_LIBCRYPTO])
233 if test "$WITH_LIBCRYPTO" = "yes"; then
234 AC_DEFINE([WITH_LIBCRYPTO], [1], [Define to 1 if using libcrypto SHA-1])
235 PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto])
236 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libcrypto"
239 AM_CONDITIONAL([ENABLE_SSSE3_SHA1], [test "$ENABLE_SSSE3_SHA1" = "yes"])
241 # ----------------------------- Other options ---------------------------------
243 AC_MSG_CHECKING([whether to include debugging messages])
244 AC_ARG_ENABLE([debug],
245 AS_HELP_STRING([--enable-debug], [include debugging messages]),
246 [ENABLE_DEBUG=$enableval],
248 AC_MSG_RESULT([$ENABLE_DEBUG])
249 if test "$ENABLE_DEBUG" = "yes"; then
250 AC_DEFINE([ENABLE_DEBUG], [1], [Define to 1 if including debug messages])
253 AC_MSG_CHECKING([whether to include error messages])
254 AC_ARG_ENABLE([error_messages],
255 AS_HELP_STRING([--disable-error-messages], [do not compile in error messsages]),
256 [ENABLE_ERROR_MESSAGES=$enableval],
257 [ENABLE_ERROR_MESSAGES=yes])
258 AC_MSG_RESULT([$ENABLE_ERROR_MESSAGES])
259 if test "$ENABLE_ERROR_MESSAGES" = "yes"; then
260 AC_DEFINE([ENABLE_ERROR_MESSAGES], [1], [Define to 1 if including error messages])
263 AC_MSG_CHECKING([whether to include assertions])
264 AC_ARG_ENABLE([assertions],
265 AS_HELP_STRING([--disable-assertions], [do not include assertions]),
266 [ENABLE_ASSERTIONS=$enableval],
267 [ENABLE_ASSERTIONS=yes])
268 AC_MSG_RESULT([$ENABLE_ASSERTIONS])
269 if test "$ENABLE_ASSERTIONS" = "yes"; then
270 AC_DEFINE([ENABLE_ASSERTIONS], [1], [Define to 1 if including assertions])
273 AC_MSG_CHECKING([whether to include automatic compression verification])
274 AC_ARG_ENABLE([verify_compression],
275 AS_HELP_STRING([--enable-verify-compression],
276 [verify all compression results (makes compression
277 slower; intended for debugging only)]),
278 [ENABLE_VERIFY_COMPRESSION=$enableval],
279 [ENABLE_VERIFY_COMPRESSION=no])
280 AC_MSG_RESULT([$ENABLE_VERIFY_COMPRESSION])
281 if test "$ENABLE_VERIFY_COMPRESSION" = "yes"; then
282 AC_DEFINE([ENABLE_VERIFY_COMPRESSION], [1], [Define to 1 to verify compression results])
285 AC_MSG_CHECKING([whether to include support for multi-threaded compression])
286 AC_ARG_ENABLE([multithreaded-compression],
287 AS_HELP_STRING([--disable-multithreaded-compression],
288 [disable support for multithreaded compression]),
289 [ENABLE_MULTITHREADED_COMPRESSION=$enableval],
290 [ENABLE_MULTITHREADED_COMPRESSION=yes])
291 AC_MSG_RESULT([$ENABLE_MULTITHREADED_COMPRESSION])
292 if test "$ENABLE_MULTITHREADED_COMPRESSION" = "yes"; then
293 AC_DEFINE([ENABLE_MULTITHREADED_COMPRESSION], [1],
294 [Define to 1 to support multithreaded compression])
297 AC_ARG_WITH(pkgconfigdir,
298 [ --with-pkgconfigdir=DIR pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@],
299 [pkgconfigdir=$withval],
300 [pkgconfigdir='${libdir}/pkgconfig'])
301 AC_SUBST(pkgconfigdir)
303 ###############################################################################
305 AC_SUBST([PKGCONFIG_PRIVATE_REQUIRES], [$PKGCONFIG_PRIVATE_REQUIRES])
306 AC_SUBST([PKGCONFIG_PRIVATE_LIBS], [$PKGCONFIG_PRIVATE_LIBS])