1 ###############################################################################
3 AC_INIT([wimlib], [1.9.1], [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])
10 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
13 AC_CONFIG_HEADERS([config.h])
14 AC_CONFIG_FILES([Makefile] [doc/Doxyfile] [wimlib.pc])
15 AC_CONFIG_FILES([programs/mkwinpeimg], [chmod +x programs/mkwinpeimg])
17 PKGCONFIG_PRIVATE_REQUIRES=""
18 PKGCONFIG_PRIVATE_LIBS=""
20 ###############################################################################
21 # General platform features #
22 ###############################################################################
28 WINDOWS_NATIVE_BUILD="no"
30 PLATFORM_CFLAGS="-fvisibility=hidden"
36 WINDOWS_NATIVE_BUILD="yes"
37 PLATFORM_CPPFLAGS="-D_POSIX -D_POSIX_THREAD_SAFE_FUNCTIONS -DUNICODE -D_UNICODE -D_CRT_NON_CONFORMING_SWPRINTFS"
38 PLATFORM_CFLAGS="-municode -mno-ms-bitfields"
39 PLATFORM_LDFLAGS="-no-undefined"
40 WITH_NTFS_3G_DEFAULT="no"
41 WITH_FUSE_DEFAULT="no"
45 WITH_NTFS_3G_DEFAULT="yes"
46 WITH_FUSE_DEFAULT="yes"
50 WITH_NTFS_3G_DEFAULT="yes"
51 WITH_FUSE_DEFAULT="no"
55 AC_SUBST([PLATFORM_CPPFLAGS], [$PLATFORM_CPPFLAGS])
56 AC_SUBST([PLATFORM_CFLAGS], [$PLATFORM_CFLAGS])
57 AC_SUBST([PLATFORM_LDFLAGS], [$PLATFORM_LDFLAGS])
58 AM_CONDITIONAL([WINDOWS_NATIVE_BUILD], [test "$WINDOWS_NATIVE_BUILD" = "yes"])
60 # Useful functions which we can do without.
61 AC_CHECK_FUNCS([futimens utimensat flock mempcpy \
62 openat fstatat readlinkat fdopendir])
64 # Header checks, most of which are only here to satisfy conditional includes
65 # made by the libntfs-3g headers.
66 AC_CHECK_HEADERS([alloca.h \
85 # Does stat() support nanosecond-precision timestamps? (This is relevant on
86 # UNIX but not on Windows.)
87 AC_CHECK_MEMBER([struct stat.st_mtim],
88 [AC_DEFINE([HAVE_STAT_NANOSECOND_PRECISION], [1],
89 [Define to 1 if stat() supports nanosecond precision
92 [#include <sys/stat.h>])
94 ###############################################################################
95 # Required libraries #
96 ###############################################################################
98 # ------------------------------ pthreads -------------------------------------
99 AX_PTHREAD([], [AC_MSG_ERROR(["cannot find pthreads library"])])
101 # ------------------------------ libxml2 --------------------------------------
102 PKG_CHECK_MODULES([LIBXML2], [libxml-2.0])
103 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libxml-2.0"
105 # ------------------------------ libiconv -------------------------------------
107 if test "$am_cv_func_iconv" != "yes"; then
108 AC_MSG_ERROR([Cannot find the iconv() function. iconv() is used to
109 convert between encodings of WIM filenames and XML data.
110 wimlib cannot be compiled without it. iconv() is
111 available in the latest version of glibc and sometimes in
115 ###############################################################################
116 # Configuration options #
117 ###############################################################################
119 # ------------------------- ntfs-3g support -----------------------------------
121 AC_MSG_CHECKING([whether to include support for ntfs-3g])
122 AC_ARG_WITH([ntfs-3g],
123 [AS_HELP_STRING([--without-ntfs-3g],
124 [build without libntfs-3g. This will disable the
125 ability to capture or apply a WIM image directly
126 from/to an unmounted NTFS volume.])],
127 [WITH_NTFS_3G=$withval],
128 [WITH_NTFS_3G=$WITH_NTFS_3G_DEFAULT])
129 AC_MSG_RESULT([$WITH_NTFS_3G])
131 if test "$WITH_NTFS_3G" = "yes"; then
132 PKG_CHECK_MODULES([LIBNTFS_3G], [libntfs-3g >= 2011.4.12], [],
133 [AC_MSG_ERROR([Cannot find libntfs-3g version 2011-4-12 or
134 later! Without libntfs-3g, wimlib cannot include support for
135 capturing or applying a WIM image directly from/to an unmounted
136 NTFS volume while preserving NTFS-specific data such as
137 security descriptors and named data streams. Either install
138 libntfs-3g, or configure --without-ntfs-3g to disable this
140 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libntfs-3g"
141 AC_DEFINE([WITH_NTFS_3G], [1], [Define to 1 if using NTFS-3G support])
143 AM_CONDITIONAL([WITH_NTFS_3G], [test "$WITH_NTFS_3G" = "yes"])
145 # ------------------------ FUSE mount support ---------------------------------
147 AC_MSG_CHECKING([whether to include support for mounting WIMs])
149 [AS_HELP_STRING([--without-fuse],
150 [build without libfuse. This will disable the
151 ability to mount WIM images.])],
152 [WITH_FUSE=$withval],
153 [WITH_FUSE=$WITH_FUSE_DEFAULT])
154 AC_MSG_RESULT([$WITH_FUSE])
156 if test "$WITH_FUSE" = "yes"; then
158 PKG_CHECK_MODULES([LIBFUSE], [fuse], [],
159 [AC_MSG_ERROR([Cannot find libfuse!
160 Without libfuse, wimlib cannot include support for mounting WIM
161 images. Either install libfuse, or configure --without-fuse to
162 disable this feature.])])
163 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES fuse"
164 AC_DEFINE([WITH_FUSE], [1], [Define to 1 if using FUSE support])
166 AC_CHECK_LIB([rt], [mq_open], [],
167 [AC_MSG_ERROR([Cannot find librt (the POSIX.1b Realtime
168 Extensions Library)! wimlib needs this for the POSIX message queue
169 functions, which are used in the code for mounting WIM images. Recent
170 versions of glibc include this library. Either install this library, or
171 configure --without-fuse to disable support for mounting WIM images.])])
173 AC_CHECK_LIB([attr], [getxattr], [],
174 [AC_MSG_ERROR([Cannot find libattr!
175 wimlib needs this for the extended attribute functions, which are used
176 in the code for mounting WIM images. Either install this library, or
177 configure --without-fuse to disable support for mounting WIM images.])])
179 PKGCONFIG_PRIVATE_LIBS="$PKGCONFIG_PRIVATE_LIBS -lrt"
180 AC_SUBST([LIBRT_LIBS], [-lrt])
182 AM_CONDITIONAL([WITH_FUSE], [test "$WITH_FUSE" = "yes"])
184 # ------------------------ SHA-1 implementation ---------------------------------
186 AC_MSG_CHECKING([whether to use SSSE3-accelerated SHA-1])
187 AC_ARG_ENABLE([ssse3-sha1],
188 [AS_HELP_STRING([--enable-ssse3-sha1],
189 [Include SSSE3-accelerated SHA-1 implementation by
190 Intel. This implies --without-libcrypto.])],
191 [ENABLE_SSSE3_SHA1=$enableval],
192 [ENABLE_SSSE3_SHA1=no])
193 AC_MSG_RESULT([$ENABLE_SSSE3_SHA1])
195 if test "$ENABLE_SSSE3_SHA1" = "yes" ; then
196 AC_DEFINE([ENABLE_SSSE3_SHA1], [1],
197 [Define to 1 if using SSSE3 implementation of SHA-1])
199 NASM_SYMBOL_PREFIX=""
200 NASM_PLATFORM_FLAGS=""
201 if test "$WINDOWS_NATIVE_BUILD" = "yes"; then
202 NASM_PLATFORM_FLAGS="-DWIN_ABI"
205 darwin* | rhapsody* | nextstep* | openstep* | macos*)
206 NASM_SYMBOL_PREFIX="_"
209 AC_SUBST([NASM_PLATFORM_FLAGS], [$NASM_PLATFORM_FLAGS])
210 AC_SUBST([NASM_SYMBOL_PREFIX], [$NASM_SYMBOL_PREFIX])
212 AC_MSG_CHECKING([whether to use SHA-1 implementation from system libcrypto])
213 AC_ARG_WITH([libcrypto],
214 [AS_HELP_STRING([--without-libcrypto],
215 [build in the SHA-1 algorithm, rather than
216 use external libcrypto from OpenSSL
217 (default is autodetect)])],
218 [WITH_LIBCRYPTO=$withval],
219 [WITH_LIBCRYPTO=auto])
220 AC_MSG_RESULT([$WITH_LIBCRYPTO])
221 if test "$WITH_LIBCRYPTO" != "no"; then
222 PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto], [
223 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libcrypto"
224 AC_DEFINE([WITH_LIBCRYPTO], [1],
225 [Define to 1 if using libcrypto SHA-1])
226 ], [AC_MSG_WARN([Cannot find libcrypto: using stand-alone SHA-1 code instead])])
229 AM_CONDITIONAL([ENABLE_SSSE3_SHA1], [test "$ENABLE_SSSE3_SHA1" = "yes"])
231 # ----------------------------- Other options ---------------------------------
233 AC_MSG_CHECKING([whether to include error messages])
234 AC_ARG_ENABLE([error_messages],
235 AS_HELP_STRING([--disable-error-messages], [do not compile in error messsages]),
236 [ENABLE_ERROR_MESSAGES=$enableval],
237 [ENABLE_ERROR_MESSAGES=yes])
238 AC_MSG_RESULT([$ENABLE_ERROR_MESSAGES])
239 if test "$ENABLE_ERROR_MESSAGES" = "yes"; then
240 AC_DEFINE([ENABLE_ERROR_MESSAGES], [1], [Define to 1 if including error messages])
243 AC_MSG_CHECKING([whether to include assertions])
244 AC_ARG_ENABLE([assertions],
245 AS_HELP_STRING([--disable-assertions], [do not include assertions]),
246 [ENABLE_ASSERTIONS=$enableval],
247 [ENABLE_ASSERTIONS=yes])
248 AC_MSG_RESULT([$ENABLE_ASSERTIONS])
249 if test "$ENABLE_ASSERTIONS" = "yes"; then
250 AC_DEFINE([ENABLE_ASSERTIONS], [1], [Define to 1 if including assertions])
253 AC_MSG_CHECKING([whether to include support for multi-threaded compression])
254 AC_ARG_ENABLE([multithreaded-compression],
255 AS_HELP_STRING([--disable-multithreaded-compression],
256 [disable support for multithreaded compression]),
257 [ENABLE_MULTITHREADED_COMPRESSION=$enableval],
258 [ENABLE_MULTITHREADED_COMPRESSION=yes])
259 AC_MSG_RESULT([$ENABLE_MULTITHREADED_COMPRESSION])
260 if test "$ENABLE_MULTITHREADED_COMPRESSION" = "yes"; then
261 AC_DEFINE([ENABLE_MULTITHREADED_COMPRESSION], [1],
262 [Define to 1 to support multithreaded compression])
265 AC_ARG_WITH(pkgconfigdir,
266 [ --with-pkgconfigdir=DIR pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@],
267 [pkgconfigdir=$withval],
268 [pkgconfigdir='${libdir}/pkgconfig'])
269 AC_SUBST(pkgconfigdir)
271 AC_MSG_CHECKING([whether to enable supporting code for tests])
272 AC_ARG_ENABLE([test-support],
273 [AS_HELP_STRING([--enable-test-support],
274 [Enable supporting code for tests (developers only)])],
275 [ENABLE_TEST_SUPPORT=$enableval],
276 [ENABLE_TEST_SUPPORT=no])
277 AC_MSG_RESULT([$ENABLE_TEST_SUPPORT])
278 if test "$ENABLE_TEST_SUPPORT" = "yes" ; then
279 AC_DEFINE([ENABLE_TEST_SUPPORT], [1],
280 [Define to 1 to enable supporting code for tests])
282 AM_CONDITIONAL([ENABLE_TEST_SUPPORT], [test "$ENABLE_TEST_SUPPORT" = "yes"])
284 ###############################################################################
286 AC_SUBST([PKGCONFIG_PRIVATE_REQUIRES], [$PKGCONFIG_PRIVATE_REQUIRES])
287 AC_SUBST([PKGCONFIG_PRIVATE_LIBS], [$PKGCONFIG_PRIVATE_LIBS])