]> wimlib.net Git - wimlib/blob - configure.ac
Add additional reparse point tests to win32-test-imagex-capture_and_apply.bat
[wimlib] / configure.ac
1 ###############################################################################
2
3 AC_INIT([wimlib], [1.8.0], [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 AC_C_BIGENDIAN
9 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
10 LT_INIT
11
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])
15
16 PKGCONFIG_PRIVATE_REQUIRES=""
17 PKGCONFIG_PRIVATE_LIBS=""
18
19 ###############################################################################
20 #                         General platform features                           #
21 ###############################################################################
22
23 AC_PROG_CC
24 AM_PROG_CC_C_O
25 AC_CANONICAL_HOST
26
27 WINDOWS_NATIVE_BUILD="no"
28 PLATFORM_CPPFLAGS=""
29 PLATFORM_CFLAGS="-fvisibility=hidden"
30 PLATFORM_LDFLAGS=""
31
32 case "$host_os" in
33 mingw*)
34         # Native Windows
35         WINDOWS_NATIVE_BUILD="yes"
36         PLATFORM_CPPFLAGS="-D_POSIX -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"
41         ;;
42 linux*)
43         # Linux
44         WITH_NTFS_3G_DEFAULT="yes"
45         WITH_FUSE_DEFAULT="yes"
46         ;;
47 *)
48         # Other UNIX
49         WITH_NTFS_3G_DEFAULT="yes"
50         WITH_FUSE_DEFAULT="no"
51         ;;
52 esac
53
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"])
58
59 # Useful functions which we can do without.
60 AC_CHECK_FUNCS([futimens utimensat flock mempcpy        \
61                 openat fstatat readlinkat fdopendir])
62
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              \
66                   byteswap.h            \
67                   endian.h              \
68                   errno.h               \
69                   glob.h                \
70                   machine/endian.h      \
71                   stdarg.h              \
72                   stddef.h              \
73                   stdlib.h              \
74                   sys/byteorder.h       \
75                   sys/endian.h          \
76                   sys/file.h            \
77                   sys/param.h           \
78                   sys/sysctl.h          \
79                   sys/times.h           \
80                   time.h                \
81                   utime.h])
82
83 # Does stat() support nanosecond-precision timestamps?  (This is relevant on
84 # UNIX but not on Windows.)
85 AC_CHECK_MEMBER([struct stat.st_mtim],
86                 [AC_DEFINE([HAVE_STAT_NANOSECOND_PRECISION], [1],
87                            [Define to 1 if stat() supports nanosecond precision
88                             timestamps])],
89                 [],
90                 [#include <sys/stat.h>])
91
92 ###############################################################################
93 #                            Required libraries                               #
94 ###############################################################################
95
96 # ------------------------------ pthreads -------------------------------------
97 AX_PTHREAD([], [AC_MSG_ERROR(["cannot find pthreads library"])])
98
99 # ------------------------------ libxml2 --------------------------------------
100 AC_CHECK_LIB([xml2], [xmlReadMemory], [],
101              [AC_MSG_ERROR(["cannot find libxml2"])])
102 PKG_CHECK_MODULES([LIBXML2], [libxml-2.0])
103 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libxml-2.0"
104
105 # ------------------------------ libiconv -------------------------------------
106 AM_ICONV
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
112                       other libraries.])
113 fi
114
115 ###############################################################################
116 #                         Configuration options                               #
117 ###############################################################################
118
119 # ------------------------- ntfs-3g support -----------------------------------
120
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])
130
131 if test "$WITH_NTFS_3G" = "yes"; then
132         # This effectively checks for NTFS-3g 2011.4.12 or later
133         AC_CHECK_LIB([ntfs-3g], [ntfs_xattr_system_setxattr], [],
134                      [AC_MSG_ERROR([Cannot find libntfs-3g version 2011-4-12
135         or later!  Without libntfs-3g, wimlib cannot include support for
136         capturing or applying a WIM image directly from/to an unmounted NTFS
137         volume while preserving NTFS-specific data such as security descriptors
138         and named data streams.  Either install libntfs-3g, or configure
139         --without-ntfs-3g to disable this feature.])])
140
141         # This checks a definition that was changed in NTFS-3g 2013.1.13
142         AC_CHECK_DECL([NTFS_MNT_RDONLY],
143                       [AC_DEFINE([HAVE_NTFS_MNT_RDONLY], [1],
144                                  [Define to 1 if ntfs_mount() takes the flag
145                                   NTFS_MNT_RDONLY])],
146                       [],
147                       [#include <ntfs-3g/volume.h>])
148
149         AC_DEFINE([WITH_NTFS_3G], [1], [Define to 1 if using NTFS-3g support])
150         PKG_CHECK_MODULES([LIBNTFS_3G], [libntfs-3g])
151         PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libntfs-3g"
152 fi
153 AM_CONDITIONAL([WITH_NTFS_3G], [test "$WITH_NTFS_3G" = "yes"])
154
155 # ------------------------ FUSE mount support ---------------------------------
156
157 AC_MSG_CHECKING([whether to include support for mounting WIMs])
158 AC_ARG_WITH([fuse],
159             [AS_HELP_STRING([--without-fuse],
160                             [build without libfuse.  This will disable the
161                              ability to mount WIM images.])],
162             [WITH_FUSE=$withval],
163             [WITH_FUSE=$WITH_FUSE_DEFAULT])
164 AC_MSG_RESULT([$WITH_FUSE])
165
166 if test "$WITH_FUSE" = "yes"; then
167         AC_CHECK_LIB([fuse], [fuse_main_real], [],
168                      [AC_MSG_ERROR([Cannot find libfuse!
169         Without libfuse, wimlib cannot include support for mounting WIM images.
170         Either install libfuse, or configure --without-fuse to disable this
171         feature.])])
172
173         AC_CHECK_LIB([rt], [mq_open], [],
174                      [AC_MSG_ERROR([Cannot find librt (the POSIX.1b Realtime
175         Extensions Library)!  wimlib needs this for the POSIX message queue
176         functions, which are used in the code for mounting WIM images.  Recent
177         versions of glibc include this library.  Either install this library, or
178         configure --without-fuse to disable support for mounting WIM images.])])
179
180         AC_CHECK_LIB([attr], [getxattr], [],
181                      [AC_MSG_ERROR([Cannot find libattr!
182         wimlib needs this for the extended attribute functions, which are used
183         in the code for mounting WIM images.  Either install this library, or
184         configure --without-fuse to disable support for mounting WIM images.])])
185
186         AC_DEFINE([WITH_FUSE], [1], [Define to 1 if using FUSE support])
187         PKG_CHECK_MODULES([LIBFUSE], [fuse])
188         PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES fuse"
189         PKGCONFIG_PRIVATE_LIBS="$PKGCONFIG_PRIVATE_LIBS -lrt"
190         AC_SUBST([LIBRT_LIBS], [-lrt])
191 fi
192 AM_CONDITIONAL([WITH_FUSE], [test "$WITH_FUSE" = "yes"])
193
194 # ------------------------ SHA-1 implementation ---------------------------------
195
196 AC_MSG_CHECKING([whether to use SSSE3-accelerated SHA-1])
197 AC_ARG_ENABLE([ssse3-sha1],
198               [AS_HELP_STRING([--enable-ssse3-sha1],
199                               [Include SSSE3-accelerated SHA-1 implementation by
200                                Intel.  This implies --without-libcrypto.])],
201               [ENABLE_SSSE3_SHA1=$enableval],
202               [ENABLE_SSSE3_SHA1=no])
203 AC_MSG_RESULT([$ENABLE_SSSE3_SHA1])
204
205 if test "$ENABLE_SSSE3_SHA1" = "yes" ; then
206         AC_DEFINE([ENABLE_SSSE3_SHA1], [1],
207                   [Define to 1 if using SSSE3 implementation of SHA-1])
208         AC_PROG_NASM
209         NASM_SYMBOL_PREFIX=""
210         NASM_PLATFORM_FLAGS=""
211         if test "$WINDOWS_NATIVE_BUILD" = "yes"; then
212                 NASM_PLATFORM_FLAGS="-DWIN_ABI"
213         fi
214         case "$host_os" in
215         darwin* | rhapsody* | nextstep* | openstep* | macos*)
216                 NASM_SYMBOL_PREFIX="_"
217                 ;;
218         esac
219         AC_SUBST([NASM_PLATFORM_FLAGS], [$NASM_PLATFORM_FLAGS])
220         AC_SUBST([NASM_SYMBOL_PREFIX], [$NASM_SYMBOL_PREFIX])
221 else
222         AC_ARG_WITH([libcrypto],
223                     [AS_HELP_STRING([--without-libcrypto],
224                                     [build in the SHA-1 algorithm, rather than
225                                      use external libcrypto from OpenSSL
226                                      (default is autodetect)])],
227                     [WITH_LIBCRYPTO=$withval],
228                     [AC_CHECK_LIB([crypto], [SHA1], [WITH_LIBCRYPTO=yes],
229                                   [AC_MSG_WARN([Cannot find libcrypto: using
230                                                 stand-alone SHA-1 code instead of OpenSSL])
231                                         WITH_LIBCRYPTO=no])])
232         AC_MSG_CHECKING([whether to use SHA-1 implementation from system libcrypto])
233         AC_MSG_RESULT([$WITH_LIBCRYPTO])
234         if test "$WITH_LIBCRYPTO" = "yes"; then
235                 AC_DEFINE([WITH_LIBCRYPTO], [1], [Define to 1 if using libcrypto SHA-1])
236                 PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto])
237                 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libcrypto"
238         fi
239 fi
240 AM_CONDITIONAL([ENABLE_SSSE3_SHA1], [test "$ENABLE_SSSE3_SHA1" = "yes"])
241
242 # ----------------------------- Other options ---------------------------------
243
244 AC_MSG_CHECKING([whether to include debugging messages])
245 AC_ARG_ENABLE([debug],
246         AS_HELP_STRING([--enable-debug], [include debugging messages]),
247         [ENABLE_DEBUG=$enableval],
248         [ENABLE_DEBUG=no])
249 AC_MSG_RESULT([$ENABLE_DEBUG])
250 if test "$ENABLE_DEBUG" = "yes"; then
251         AC_DEFINE([ENABLE_DEBUG], [1], [Define to 1 if including debug messages])
252 fi
253
254 AC_MSG_CHECKING([whether to include error messages])
255 AC_ARG_ENABLE([error_messages],
256         AS_HELP_STRING([--disable-error-messages], [do not compile in error messsages]),
257         [ENABLE_ERROR_MESSAGES=$enableval],
258         [ENABLE_ERROR_MESSAGES=yes])
259 AC_MSG_RESULT([$ENABLE_ERROR_MESSAGES])
260 if test "$ENABLE_ERROR_MESSAGES" = "yes"; then
261         AC_DEFINE([ENABLE_ERROR_MESSAGES], [1], [Define to 1 if including error messages])
262 fi
263
264 AC_MSG_CHECKING([whether to include assertions])
265 AC_ARG_ENABLE([assertions],
266         AS_HELP_STRING([--disable-assertions], [do not include assertions]),
267         [ENABLE_ASSERTIONS=$enableval],
268         [ENABLE_ASSERTIONS=yes])
269 AC_MSG_RESULT([$ENABLE_ASSERTIONS])
270 if test "$ENABLE_ASSERTIONS" = "yes"; then
271         AC_DEFINE([ENABLE_ASSERTIONS], [1], [Define to 1 if including assertions])
272 fi
273
274 AC_MSG_CHECKING([whether to include automatic compression verification])
275 AC_ARG_ENABLE([verify_compression],
276         AS_HELP_STRING([--enable-verify-compression],
277                        [verify all compression results (makes compression
278                         slower; intended for debugging only)]),
279         [ENABLE_VERIFY_COMPRESSION=$enableval],
280         [ENABLE_VERIFY_COMPRESSION=no])
281 AC_MSG_RESULT([$ENABLE_VERIFY_COMPRESSION])
282 if test "$ENABLE_VERIFY_COMPRESSION" = "yes"; then
283         AC_DEFINE([ENABLE_VERIFY_COMPRESSION], [1], [Define to 1 to verify compression results])
284 fi
285
286 AC_MSG_CHECKING([whether to include support for multi-threaded compression])
287 AC_ARG_ENABLE([multithreaded-compression],
288         AS_HELP_STRING([--disable-multithreaded-compression],
289                        [disable support for multithreaded compression]),
290         [ENABLE_MULTITHREADED_COMPRESSION=$enableval],
291         [ENABLE_MULTITHREADED_COMPRESSION=yes])
292 AC_MSG_RESULT([$ENABLE_MULTITHREADED_COMPRESSION])
293 if test "$ENABLE_MULTITHREADED_COMPRESSION" = "yes"; then
294         AC_DEFINE([ENABLE_MULTITHREADED_COMPRESSION], [1],
295                   [Define to 1 to support multithreaded compression])
296 fi
297
298 AC_ARG_WITH(pkgconfigdir,
299             [  --with-pkgconfigdir=DIR      pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@],
300             [pkgconfigdir=$withval],
301             [pkgconfigdir='${libdir}/pkgconfig'])
302 AC_SUBST(pkgconfigdir)
303
304 ###############################################################################
305
306 AC_SUBST([PKGCONFIG_PRIVATE_REQUIRES], [$PKGCONFIG_PRIVATE_REQUIRES])
307 AC_SUBST([PKGCONFIG_PRIVATE_LIBS], [$PKGCONFIG_PRIVATE_LIBS])
308 AC_OUTPUT