1 ###############################################################################
3 AC_INIT([wimlib], [1.10.0-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])
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 \
84 # Does stat() support nanosecond-precision timestamps? (This is relevant on
85 # UNIX but not on Windows.)
86 AC_CHECK_MEMBER([struct stat.st_mtim],
87 [AC_DEFINE([HAVE_STAT_NANOSECOND_PRECISION], [1],
88 [Define to 1 if stat() supports nanosecond precision
91 [#include <sys/stat.h>])
93 ###############################################################################
94 # Required libraries #
95 ###############################################################################
97 # ------------------------------ pthreads -------------------------------------
98 AX_PTHREAD([], [AC_MSG_ERROR(["cannot find pthreads library"])])
100 # ------------------------------ libxml2 --------------------------------------
101 PKG_CHECK_MODULES([LIBXML2], [libxml-2.0])
102 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libxml-2.0"
104 ###############################################################################
105 # Configuration options #
106 ###############################################################################
108 # ------------------------- ntfs-3g support -----------------------------------
110 AC_MSG_CHECKING([whether to include support for ntfs-3g])
111 AC_ARG_WITH([ntfs-3g],
112 [AS_HELP_STRING([--without-ntfs-3g],
113 [build without libntfs-3g. This will disable the
114 ability to capture or apply a WIM image directly
115 from/to an unmounted NTFS volume.])],
116 [WITH_NTFS_3G=$withval],
117 [WITH_NTFS_3G=$WITH_NTFS_3G_DEFAULT])
118 AC_MSG_RESULT([$WITH_NTFS_3G])
120 if test "$WITH_NTFS_3G" = "yes"; then
121 PKG_CHECK_MODULES([LIBNTFS_3G], [libntfs-3g >= 2011.4.12], [],
122 [AC_MSG_ERROR([Cannot find libntfs-3g version 2011-4-12 or
123 later! Without libntfs-3g, wimlib cannot include support for
124 capturing or applying a WIM image directly from/to an unmounted
125 NTFS volume while preserving NTFS-specific data such as
126 security descriptors and named data streams. Either install
127 libntfs-3g, or configure --without-ntfs-3g to disable this
129 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libntfs-3g"
130 AC_DEFINE([WITH_NTFS_3G], [1], [Define to 1 if using NTFS-3G support])
132 AM_CONDITIONAL([WITH_NTFS_3G], [test "$WITH_NTFS_3G" = "yes"])
134 # ------------------------ FUSE mount support ---------------------------------
136 AC_MSG_CHECKING([whether to include support for mounting WIMs])
138 [AS_HELP_STRING([--without-fuse],
139 [build without libfuse. This will disable the
140 ability to mount WIM images.])],
141 [WITH_FUSE=$withval],
142 [WITH_FUSE=$WITH_FUSE_DEFAULT])
143 AC_MSG_RESULT([$WITH_FUSE])
145 if test "$WITH_FUSE" = "yes"; then
147 PKG_CHECK_MODULES([LIBFUSE], [fuse], [],
148 [AC_MSG_ERROR([Cannot find libfuse!
149 Without libfuse, wimlib cannot include support for mounting WIM
150 images. Either install libfuse, or configure --without-fuse to
151 disable this feature.])])
152 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES fuse"
153 AC_DEFINE([WITH_FUSE], [1], [Define to 1 if using FUSE support])
155 AC_CHECK_LIB([rt], [mq_open], [],
156 [AC_MSG_ERROR([Cannot find librt (the POSIX.1b Realtime
157 Extensions Library)! wimlib needs this for the POSIX message queue
158 functions, which are used in the code for mounting WIM images. Recent
159 versions of glibc include this library. Either install this library, or
160 configure --without-fuse to disable support for mounting WIM images.])])
162 AC_CHECK_LIB([attr], [getxattr], [],
163 [AC_MSG_ERROR([Cannot find libattr!
164 wimlib needs this for the extended attribute functions, which are used
165 in the code for mounting WIM images. Either install this library, or
166 configure --without-fuse to disable support for mounting WIM images.])])
168 PKGCONFIG_PRIVATE_LIBS="$PKGCONFIG_PRIVATE_LIBS -lrt"
169 AC_SUBST([LIBRT_LIBS], [-lrt])
171 AM_CONDITIONAL([WITH_FUSE], [test "$WITH_FUSE" = "yes"])
173 # ------------------------ SHA-1 implementation ---------------------------------
175 AC_MSG_CHECKING([whether to use SSSE3-accelerated SHA-1])
176 AC_ARG_ENABLE([ssse3-sha1],
177 [AS_HELP_STRING([--enable-ssse3-sha1],
178 [Include SSSE3-accelerated SHA-1 implementation by
179 Intel. This implies --without-libcrypto.])],
180 [ENABLE_SSSE3_SHA1=$enableval],
181 [ENABLE_SSSE3_SHA1=no])
182 AC_MSG_RESULT([$ENABLE_SSSE3_SHA1])
184 if test "$ENABLE_SSSE3_SHA1" = "yes" ; then
185 AC_DEFINE([ENABLE_SSSE3_SHA1], [1],
186 [Define to 1 if using SSSE3 implementation of SHA-1])
188 NASM_SYMBOL_PREFIX=""
189 NASM_PLATFORM_FLAGS=""
190 if test "$WINDOWS_NATIVE_BUILD" = "yes"; then
191 NASM_PLATFORM_FLAGS="-DWIN_ABI"
194 darwin* | rhapsody* | nextstep* | openstep* | macos*)
195 NASM_SYMBOL_PREFIX="_"
198 AC_SUBST([NASM_PLATFORM_FLAGS], [$NASM_PLATFORM_FLAGS])
199 AC_SUBST([NASM_SYMBOL_PREFIX], [$NASM_SYMBOL_PREFIX])
201 AC_MSG_CHECKING([whether to use SHA-1 implementation from system libcrypto])
202 AC_ARG_WITH([libcrypto],
203 [AS_HELP_STRING([--without-libcrypto],
204 [build in the SHA-1 algorithm, rather than
205 use external libcrypto from OpenSSL
206 (default is autodetect)])],
207 [WITH_LIBCRYPTO=$withval],
208 [WITH_LIBCRYPTO=auto])
209 AC_MSG_RESULT([$WITH_LIBCRYPTO])
210 if test "$WITH_LIBCRYPTO" != "no"; then
211 PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto], [
212 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libcrypto"
213 AC_DEFINE([WITH_LIBCRYPTO], [1],
214 [Define to 1 if using libcrypto SHA-1])
215 ], [AC_MSG_WARN([Cannot find libcrypto: using stand-alone SHA-1 code instead])])
218 AM_CONDITIONAL([ENABLE_SSSE3_SHA1], [test "$ENABLE_SSSE3_SHA1" = "yes"])
220 # ----------------------------- Other options ---------------------------------
222 AC_MSG_CHECKING([whether to include error messages])
223 AC_ARG_ENABLE([error_messages],
224 AS_HELP_STRING([--disable-error-messages], [do not compile in error messsages]),
225 [ENABLE_ERROR_MESSAGES=$enableval],
226 [ENABLE_ERROR_MESSAGES=yes])
227 AC_MSG_RESULT([$ENABLE_ERROR_MESSAGES])
228 if test "$ENABLE_ERROR_MESSAGES" = "yes"; then
229 AC_DEFINE([ENABLE_ERROR_MESSAGES], [1], [Define to 1 if including error messages])
232 AC_MSG_CHECKING([whether to include assertions])
233 AC_ARG_ENABLE([assertions],
234 AS_HELP_STRING([--disable-assertions], [do not include assertions]),
235 [ENABLE_ASSERTIONS=$enableval],
236 [ENABLE_ASSERTIONS=yes])
237 AC_MSG_RESULT([$ENABLE_ASSERTIONS])
238 if test "$ENABLE_ASSERTIONS" = "yes"; then
239 AC_DEFINE([ENABLE_ASSERTIONS], [1], [Define to 1 if including assertions])
242 AC_MSG_CHECKING([whether to include support for multi-threaded compression])
243 AC_ARG_ENABLE([multithreaded-compression],
244 AS_HELP_STRING([--disable-multithreaded-compression],
245 [disable support for multithreaded compression]),
246 [ENABLE_MULTITHREADED_COMPRESSION=$enableval],
247 [ENABLE_MULTITHREADED_COMPRESSION=yes])
248 AC_MSG_RESULT([$ENABLE_MULTITHREADED_COMPRESSION])
249 if test "$ENABLE_MULTITHREADED_COMPRESSION" = "yes"; then
250 AC_DEFINE([ENABLE_MULTITHREADED_COMPRESSION], [1],
251 [Define to 1 to support multithreaded compression])
254 AC_ARG_WITH(pkgconfigdir,
255 [ --with-pkgconfigdir=DIR pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@],
256 [pkgconfigdir=$withval],
257 [pkgconfigdir='${libdir}/pkgconfig'])
258 AC_SUBST(pkgconfigdir)
260 AC_MSG_CHECKING([whether to enable supporting code for tests])
261 AC_ARG_ENABLE([test-support],
262 [AS_HELP_STRING([--enable-test-support],
263 [Enable supporting code for tests (developers only)])],
264 [ENABLE_TEST_SUPPORT=$enableval],
265 [ENABLE_TEST_SUPPORT=no])
266 AC_MSG_RESULT([$ENABLE_TEST_SUPPORT])
267 if test "$ENABLE_TEST_SUPPORT" = "yes" ; then
268 AC_DEFINE([ENABLE_TEST_SUPPORT], [1],
269 [Define to 1 to enable supporting code for tests])
271 AM_CONDITIONAL([ENABLE_TEST_SUPPORT], [test "$ENABLE_TEST_SUPPORT" = "yes"])
273 ###############################################################################
275 AC_SUBST([PKGCONFIG_PRIVATE_REQUIRES], [$PKGCONFIG_PRIVATE_REQUIRES])
276 AC_SUBST([PKGCONFIG_PRIVATE_LIBS], [$PKGCONFIG_PRIVATE_LIBS])