1 ###############################################################################
3 AC_INIT([wimlib], [1.8.2], [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])
9 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
12 AC_CONFIG_HEADERS([config.h])
13 AC_CONFIG_FILES([Makefile] [doc/Doxyfile] [wimlib.pc])
14 AC_CONFIG_FILES([programs/mkwinpeimg], [chmod +x programs/mkwinpeimg])
16 PKGCONFIG_PRIVATE_REQUIRES=""
17 PKGCONFIG_PRIVATE_LIBS=""
19 ###############################################################################
20 # General platform features #
21 ###############################################################################
27 WINDOWS_NATIVE_BUILD="no"
29 PLATFORM_CFLAGS="-fvisibility=hidden"
35 WINDOWS_NATIVE_BUILD="yes"
36 PLATFORM_CPPFLAGS="-D_POSIX -D_POSIX_THREAD_SAFE_FUNCTIONS -DUNICODE -D_UNICODE -D_CRT_NON_CONFORMING_SWPRINTFS"
37 PLATFORM_CFLAGS="-municode -mno-ms-bitfields"
38 PLATFORM_LDFLAGS="-no-undefined"
39 WITH_NTFS_3G_DEFAULT="no"
40 WITH_FUSE_DEFAULT="no"
44 WITH_NTFS_3G_DEFAULT="yes"
45 WITH_FUSE_DEFAULT="yes"
49 WITH_NTFS_3G_DEFAULT="yes"
50 WITH_FUSE_DEFAULT="no"
54 AC_SUBST([PLATFORM_CPPFLAGS], [$PLATFORM_CPPFLAGS])
55 AC_SUBST([PLATFORM_CFLAGS], [$PLATFORM_CFLAGS])
56 AC_SUBST([PLATFORM_LDFLAGS], [$PLATFORM_LDFLAGS])
57 AM_CONDITIONAL([WINDOWS_NATIVE_BUILD], [test "$WINDOWS_NATIVE_BUILD" = "yes"])
59 # Useful functions which we can do without.
60 AC_CHECK_FUNCS([futimens utimensat flock mempcpy \
61 openat fstatat readlinkat fdopendir])
63 # Header checks, most of which are only here to satisfy conditional includes
64 # made by the libntfs-3g headers.
65 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 # ------------------------------ 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 PKG_CHECK_MODULES([LIBNTFS_3G], [libntfs-3g >= 2011.4.12], [],
132 [AC_MSG_ERROR([Cannot find libntfs-3g version 2011-4-12 or
133 later! Without libntfs-3g, wimlib cannot include support for
134 capturing or applying a WIM image directly from/to an unmounted
135 NTFS volume while preserving NTFS-specific data such as
136 security descriptors and named data streams. Either install
137 libntfs-3g, or configure --without-ntfs-3g to disable this
139 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libntfs-3g"
140 AC_DEFINE([WITH_NTFS_3G], [1], [Define to 1 if using NTFS-3g support])
142 AM_CONDITIONAL([WITH_NTFS_3G], [test "$WITH_NTFS_3G" = "yes"])
144 # ------------------------ FUSE mount support ---------------------------------
146 AC_MSG_CHECKING([whether to include support for mounting WIMs])
148 [AS_HELP_STRING([--without-fuse],
149 [build without libfuse. This will disable the
150 ability to mount WIM images.])],
151 [WITH_FUSE=$withval],
152 [WITH_FUSE=$WITH_FUSE_DEFAULT])
153 AC_MSG_RESULT([$WITH_FUSE])
155 if test "$WITH_FUSE" = "yes"; then
157 PKG_CHECK_MODULES([LIBFUSE], [fuse], [],
158 [AC_MSG_ERROR([Cannot find libfuse!
159 Without libfuse, wimlib cannot include support for mounting WIM
160 images. Either install libfuse, or configure --without-fuse to
161 disable this feature.])])
162 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES fuse"
163 AC_DEFINE([WITH_FUSE], [1], [Define to 1 if using FUSE support])
165 AC_CHECK_LIB([rt], [mq_open], [],
166 [AC_MSG_ERROR([Cannot find librt (the POSIX.1b Realtime
167 Extensions Library)! wimlib needs this for the POSIX message queue
168 functions, which are used in the code for mounting WIM images. Recent
169 versions of glibc include this library. Either install this library, or
170 configure --without-fuse to disable support for mounting WIM images.])])
172 AC_CHECK_LIB([attr], [getxattr], [],
173 [AC_MSG_ERROR([Cannot find libattr!
174 wimlib needs this for the extended attribute functions, which are used
175 in the code for mounting WIM images. Either install this library, or
176 configure --without-fuse to disable support for mounting WIM images.])])
178 PKGCONFIG_PRIVATE_LIBS="$PKGCONFIG_PRIVATE_LIBS -lrt"
179 AC_SUBST([LIBRT_LIBS], [-lrt])
181 AM_CONDITIONAL([WITH_FUSE], [test "$WITH_FUSE" = "yes"])
183 # ------------------------ SHA-1 implementation ---------------------------------
185 AC_MSG_CHECKING([whether to use SSSE3-accelerated SHA-1])
186 AC_ARG_ENABLE([ssse3-sha1],
187 [AS_HELP_STRING([--enable-ssse3-sha1],
188 [Include SSSE3-accelerated SHA-1 implementation by
189 Intel. This implies --without-libcrypto.])],
190 [ENABLE_SSSE3_SHA1=$enableval],
191 [ENABLE_SSSE3_SHA1=no])
192 AC_MSG_RESULT([$ENABLE_SSSE3_SHA1])
194 if test "$ENABLE_SSSE3_SHA1" = "yes" ; then
195 AC_DEFINE([ENABLE_SSSE3_SHA1], [1],
196 [Define to 1 if using SSSE3 implementation of SHA-1])
198 NASM_SYMBOL_PREFIX=""
199 NASM_PLATFORM_FLAGS=""
200 if test "$WINDOWS_NATIVE_BUILD" = "yes"; then
201 NASM_PLATFORM_FLAGS="-DWIN_ABI"
204 darwin* | rhapsody* | nextstep* | openstep* | macos*)
205 NASM_SYMBOL_PREFIX="_"
208 AC_SUBST([NASM_PLATFORM_FLAGS], [$NASM_PLATFORM_FLAGS])
209 AC_SUBST([NASM_SYMBOL_PREFIX], [$NASM_SYMBOL_PREFIX])
211 AC_MSG_CHECKING([whether to use SHA-1 implementation from system libcrypto])
212 AC_ARG_WITH([libcrypto],
213 [AS_HELP_STRING([--without-libcrypto],
214 [build in the SHA-1 algorithm, rather than
215 use external libcrypto from OpenSSL
216 (default is autodetect)])],
217 [WITH_LIBCRYPTO=$withval],
218 [WITH_LIBCRYPTO=auto])
219 AC_MSG_RESULT([$WITH_LIBCRYPTO])
220 if test "$WITH_LIBCRYPTO" != "no"; then
221 PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto], [
222 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libcrypto"
223 AC_DEFINE([WITH_LIBCRYPTO], [1],
224 [Define to 1 if using libcrypto SHA-1])
225 ], [AC_MSG_WARN([Cannot find libcrypto: using stand-alone SHA-1 code instead])])
228 AM_CONDITIONAL([ENABLE_SSSE3_SHA1], [test "$ENABLE_SSSE3_SHA1" = "yes"])
230 # ----------------------------- Other options ---------------------------------
232 AC_MSG_CHECKING([whether to include error messages])
233 AC_ARG_ENABLE([error_messages],
234 AS_HELP_STRING([--disable-error-messages], [do not compile in error messsages]),
235 [ENABLE_ERROR_MESSAGES=$enableval],
236 [ENABLE_ERROR_MESSAGES=yes])
237 AC_MSG_RESULT([$ENABLE_ERROR_MESSAGES])
238 if test "$ENABLE_ERROR_MESSAGES" = "yes"; then
239 AC_DEFINE([ENABLE_ERROR_MESSAGES], [1], [Define to 1 if including error messages])
242 AC_MSG_CHECKING([whether to include assertions])
243 AC_ARG_ENABLE([assertions],
244 AS_HELP_STRING([--disable-assertions], [do not include assertions]),
245 [ENABLE_ASSERTIONS=$enableval],
246 [ENABLE_ASSERTIONS=yes])
247 AC_MSG_RESULT([$ENABLE_ASSERTIONS])
248 if test "$ENABLE_ASSERTIONS" = "yes"; then
249 AC_DEFINE([ENABLE_ASSERTIONS], [1], [Define to 1 if including assertions])
252 AC_MSG_CHECKING([whether to include support for multi-threaded compression])
253 AC_ARG_ENABLE([multithreaded-compression],
254 AS_HELP_STRING([--disable-multithreaded-compression],
255 [disable support for multithreaded compression]),
256 [ENABLE_MULTITHREADED_COMPRESSION=$enableval],
257 [ENABLE_MULTITHREADED_COMPRESSION=yes])
258 AC_MSG_RESULT([$ENABLE_MULTITHREADED_COMPRESSION])
259 if test "$ENABLE_MULTITHREADED_COMPRESSION" = "yes"; then
260 AC_DEFINE([ENABLE_MULTITHREADED_COMPRESSION], [1],
261 [Define to 1 to support multithreaded compression])
264 AC_ARG_WITH(pkgconfigdir,
265 [ --with-pkgconfigdir=DIR pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@],
266 [pkgconfigdir=$withval],
267 [pkgconfigdir='${libdir}/pkgconfig'])
268 AC_SUBST(pkgconfigdir)
270 ###############################################################################
272 AC_SUBST([PKGCONFIG_PRIVATE_REQUIRES], [$PKGCONFIG_PRIVATE_REQUIRES])
273 AC_SUBST([PKGCONFIG_PRIVATE_LIBS], [$PKGCONFIG_PRIVATE_LIBS])