]> wimlib.net Git - wimlib/blob - configure.ac
Replace WIMLIB_OPEN_FLAG_SPLIT_OK with WIMLIB_OPEN_FLAG_ERROR_IF_SPLIT
[wimlib] / configure.ac
1 AC_INIT([wimlib], [1.5.0], [ebiggers3@gmail.com])
2 AC_CONFIG_SRCDIR([src/wim.c])
3 AC_CONFIG_MACRO_DIR([m4])
4 AC_CONFIG_AUX_DIR([build-aux])
5 AM_INIT_AUTOMAKE([-Wall -Werror subdir-objects])
6 AC_C_BIGENDIAN
7 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
8 LT_INIT
9
10 PKGCONFIG_PRIVATE_REQUIRES=""
11 PKGCONFIG_PRIVATE_LIBS=""
12
13 AC_ARG_WITH(imagex-progname,
14             [AS_HELP_STRING([--with-imagex-progname=NAME],
15                             [Set the name of installed ImageX program (default: wimlib-imagex)])],
16             [IMAGEX_PROGNAME=$withval],
17             [IMAGEX_PROGNAME="wimlib-imagex"])
18
19 AC_SUBST([IMAGEX_PROGNAME], [$IMAGEX_PROGNAME])
20 AC_DEFINE_UNQUOTED([IMAGEX_PROGNAME], ["$IMAGEX_PROGNAME"],
21                    [Binary name for the implementation of ImageX distributed with wimlib])
22
23 AC_CONFIG_HEADERS([config.h])
24 AC_CONFIG_FILES([Makefile]
25                 [doc/Doxyfile]
26                 [wimlib.pc]
27                 [doc/"$IMAGEX_PROGNAME".1:doc/imagex.1.in]
28                 [doc/"$IMAGEX_PROGNAME"-append.1:doc/imagex-append.1.in]
29                 [doc/"$IMAGEX_PROGNAME"-apply.1:doc/imagex-apply.1.in]
30                 [doc/"$IMAGEX_PROGNAME"-capture.1:doc/imagex-capture.1.in]
31                 [doc/"$IMAGEX_PROGNAME"-delete.1:doc/imagex-delete.1.in]
32                 [doc/"$IMAGEX_PROGNAME"-dir.1:doc/imagex-dir.1.in]
33                 [doc/"$IMAGEX_PROGNAME"-export.1:doc/imagex-export.1.in]
34                 [doc/"$IMAGEX_PROGNAME"-extract.1:doc/imagex-extract.1.in]
35                 [doc/"$IMAGEX_PROGNAME"-info.1:doc/imagex-info.1.in]
36                 [doc/"$IMAGEX_PROGNAME"-join.1:doc/imagex-join.1.in]
37                 [doc/"$IMAGEX_PROGNAME"-mount.1:doc/imagex-mount.1.in]
38                 [doc/"$IMAGEX_PROGNAME"-mountrw.1:doc/imagex-mountrw.1.in]
39                 [doc/"$IMAGEX_PROGNAME"-optimize.1:doc/imagex-optimize.1.in]
40                 [doc/"$IMAGEX_PROGNAME"-split.1:doc/imagex-split.1.in]
41                 [doc/"$IMAGEX_PROGNAME"-unmount.1:doc/imagex-unmount.1.in]
42                 [doc/"$IMAGEX_PROGNAME"-update.1:doc/imagex-update.1.in]
43                 [doc/mkwinpeimg.1])
44
45 AC_CONFIG_FILES([programs/mkwinpeimg], [chmod +x programs/mkwinpeimg])
46
47 AC_PROG_CC
48 AM_PROG_CC_C_O
49 AC_CANONICAL_HOST
50
51 AC_CHECK_FUNCS([utimensat lutimes utime flock mempcpy])
52
53 # Note: some of the following header checks are only to define the appropriate
54 # HAVE_*_H macro so that the NTFS-3g headers don't get confused and try to skip
55 # including certain headers.
56 AC_CHECK_HEADERS([alloca.h              \
57                   attr/xattr.h          \
58                   byteswap.h            \
59                   endian.h              \
60                   errno.h               \
61                   glob.h                \
62                   machine/endian.h      \
63                   stdarg.h              \
64                   stdlib.h              \
65                   sys/byteorder.h       \
66                   sys/endian.h          \
67                   sys/file.h            \
68                   sys/param.h           \
69                   sys/times.h           \
70                   time.h                \
71                   utime.h])
72
73 AC_CHECK_MEMBER([struct stat.st_mtim],
74                 [AC_DEFINE([HAVE_STAT_NANOSECOND_PRECISION], [1],
75                           [Define to 1 if nanosecond precision timestamps are
76                            supported])],
77                 [],
78                 [[#include <sys/stat.h>]])
79
80
81 AC_ARG_WITH(pkgconfigdir,
82             [  --with-pkgconfigdir=DIR      pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@],
83             [pkgconfigdir=$withval],
84             [pkgconfigdir='${libdir}/pkgconfig'])
85 AC_SUBST(pkgconfigdir)
86
87 AC_CHECK_LIB([xml2], [xmlParseFile], [have_libxml=true],
88              [AC_MSG_ERROR(["cannot find libxml2"])])
89 PKG_CHECK_MODULES([LIBXML2], [libxml-2.0])
90 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libxml-2.0"
91
92 AC_MSG_CHECKING([whether to include debugging messages])
93 AC_ARG_ENABLE([debug],
94         AS_HELP_STRING([--enable-debug], [include lots of debugging messages]),
95         [ENABLE_DEBUG=$enableval],
96         [ENABLE_DEBUG=no]
97         )
98 AC_MSG_RESULT([$ENABLE_DEBUG])
99 if test "x$ENABLE_DEBUG" = "xyes"; then
100         AC_DEFINE([ENABLE_DEBUG], [1],
101                         [Define to 1 if including lots of debug messages.])
102 fi
103
104 AC_MSG_CHECKING([whether to include more debugging messages])
105 AC_ARG_ENABLE([more_debug],
106         AS_HELP_STRING([--enable-more-debug],
107                         [include even more debugging messages]),
108         [ENABLE_MORE_DEBUG=$enableval],
109         [ENABLE_MORE_DEBUG=no]
110         )
111 AC_MSG_RESULT([$ENABLE_MORE_DEBUG])
112 if test "x$ENABLE_MORE_DEBUG" = "xyes"; then
113         AC_DEFINE([ENABLE_MORE_DEBUG], [1],
114                         [Define to 1 if including even more debug messages.])
115 fi
116
117 AC_MSG_CHECKING([whether to include error messages])
118 AC_ARG_ENABLE([error_messages],
119         AS_HELP_STRING([--disable-error-messages],
120                         [do not compile in error messsages]),
121         [ENABLE_ERROR_MESSAGES=$enableval],
122         [ENABLE_ERROR_MESSAGES=yes]
123         )
124 AC_MSG_RESULT([$ENABLE_ERROR_MESSAGES])
125 if test "x$ENABLE_ERROR_MESSAGES" = "xyes"; then
126         AC_DEFINE([ENABLE_ERROR_MESSAGES], [1],
127                         [Define to 1 if including error messages])
128 fi
129
130 AC_MSG_CHECKING([whether to support custom memory allocation functions])
131 AC_ARG_ENABLE([custom_memory_allocator],
132         AS_HELP_STRING([--disable-custom-memory-allocator],
133                        [do not support the use of custom memory allocation
134                         functions]),
135         [ENABLE_CUSTOM_MEMORY_ALLOCATOR=$enableval],
136         [ENABLE_CUSTOM_MEMORY_ALLOCATOR=yes]
137         )
138 AC_MSG_RESULT([$ENABLE_CUSTOM_MEMORY_ALLOCATOR])
139 if test "x$ENABLE_CUSTOM_MEMORY_ALLOCATOR" = "xyes"; then
140         AC_DEFINE([ENABLE_CUSTOM_MEMORY_ALLOCATOR], [1],
141                 [Define to 1 if supporting custom memory allocation functions])
142 fi
143
144 AC_MSG_CHECKING([whether to include assertions])
145 AC_ARG_ENABLE([assertions],
146         AS_HELP_STRING([--disable-assertions], [do not include assertions]),
147         [ENABLE_ASSERTIONS=$enableval],
148         [ENABLE_ASSERTIONS=yes]
149         )
150 AC_MSG_RESULT([$ENABLE_ASSERTIONS])
151 if test "x$ENABLE_ASSERTIONS" = "xyes"; then
152         AC_DEFINE([ENABLE_ASSERTIONS], [1], [Define to 1 if including assertions.])
153 fi
154
155 AC_MSG_CHECKING([whether to include more assertions])
156 AC_ARG_ENABLE([more-assertions],
157         AS_HELP_STRING([--enable-more-assertions], [include even more assertions]),
158         [ENABLE_MORE_ASSERTIONS=$enableval],
159         [ENABLE_MORE_ASSERTIONS=no]
160         )
161 AC_MSG_RESULT([$ENABLE_MORE_ASSERTIONS])
162 if test "x$ENABLE_MORE_ASSERTIONS" = "xyes"; then
163         AC_DEFINE([ENABLE_MORE_ASSERTIONS], [1], [Define to 1 if including more assertions.])
164 fi
165
166
167 AC_MSG_CHECKING([whether to include compression verification])
168 AC_ARG_ENABLE([verify_compression],
169               AS_HELP_STRING([--enable-verify-compression], [always
170                                 check if blocks we compress can be correctly
171                                 decompressed]),
172         [ENABLE_VERIFY_COMPRESSION=$enableval],
173         [ENABLE_VERIFY_COMPRESSION=no]
174         )
175 AC_MSG_RESULT([$ENABLE_VERIFY_COMPRESSION])
176 if test "x$ENABLE_VERIFY_COMPRESSION" = "xyes"; then
177         AC_DEFINE([ENABLE_VERIFY_COMPRESSION], [1], [Define to 1 to verify
178                    compressed data])
179 fi
180
181 AC_MSG_CHECKING([whether to include support for multi-threaded compression])
182 AC_ARG_ENABLE([multithreaded-compression],
183         AS_HELP_STRING([--disable-multithreaded-compression],
184                         [do not compile in the code for multi-threaded compression]),
185         [ENABLE_MULTITHREADED_COMPRESSION=$enableval],
186         [ENABLE_MULTITHREADED_COMPRESSION=yes]
187         )
188 AC_MSG_RESULT([$ENABLE_MULTITHREADED_COMPRESSION])
189 if test "x$ENABLE_MULTITHREADED_COMPRESSION" = "xyes"; then
190         AC_DEFINE([ENABLE_MULTITHREADED_COMPRESSION], [1],
191                         [Define to 1 if including support for multithreaded
192                          compression])
193 fi
194
195 PTHREAD_LDADD="-lpthread"
196 AC_SUBST([PTHREAD_LDADD], [$PTHREAD_LDADD])
197
198 WITH_NTFS_3G_DEFAULT="yes"
199 WITH_FUSE_DEFAULT="yes"
200 WINDOWS_NATIVE_BUILD="no"
201 VISIBILITY_CFLAGS="-fvisibility=hidden"
202 WINDOWS_CFLAGS=""
203 WINDOWS_CPPFLAGS=""
204 WINDOWS_LDFLAGS=""
205 WINDOWS_LDADD=""
206 ENABLE_XATTR_DEFAULT="autodetect"
207
208 case "$host" in
209         *-*-mingw*)
210                 # Native Windows
211                 WITH_NTFS_3G_DEFAULT="no"
212                 WITH_FUSE_DEFAULT="no"
213                 WINDOWS_NATIVE_BUILD="yes"
214                 VISIBILITY_CFLAGS=""
215                 WINDOWS_CFLAGS="-municode"
216                 WINDOWS_CPPFLAGS="-D_POSIX -DUNICODE -D_UNICODE -D_CRT_NON_CONFORMING_SWPRINTFS"
217                 WINDOWS_LDFLAGS="-no-undefined"
218                 WINDOWS_LDADD="-lshlwapi"
219                 ENABLE_XATTR_DEFAULT="no"
220                 ;;
221         *-*-cygwin*)
222                 # Cygwin (WARNING: not well supported)
223                 AC_MSG_WARN([wimlib has not been tested with Cygwin!  Please do
224                              a Windows-native build with MinGW-w64 instead])
225                 WITH_NTFS_3G_DEFAULT="no"
226                 WITH_FUSE_DEFAULT="no"
227                 VISIBILITY_CFLAGS=""
228                 ;;
229         *)
230                 # UNIX / other
231                 ;;
232 esac
233
234 AC_ARG_WITH([ntdll],
235             AS_HELP_STRING([--without-ntdll], [Windows only:  do not try to
236                             use functions from ntdll.  By default, in some parts
237                             of its code, wimlib uses Windows NT system calls to
238                             work around flaws in the Win32 API.  This support
239                             can be omitted if needed, but some annoying bugs
240                             will surface (e.g.  permission denied errors even
241                                           when running as the Administrator).]),
242         [WITH_NTDLL=$withval],
243         [WITH_NTDLL=yes])
244
245 if test "x$WINDOWS_NATIVE_BUILD" = "xyes"; then
246         if test "x$WITH_NTDLL" = "xyes"; then
247                 WINDOWS_LDADD="$WINDOWS_LDADD"
248                 AC_DEFINE([WITH_NTDLL], [1], [Define to 1 to try to use ntdll
249                                                 functions])
250         fi
251 fi
252
253 AC_SUBST([VISIBILITY_CFLAGS], [$VISIBILITY_CFLAGS])
254 AC_SUBST([WINDOWS_LDFLAGS], [$WINDOWS_LDFLAGS])
255 AC_SUBST([WINDOWS_LDADD], [$WINDOWS_LDADD])
256 AC_SUBST([WINDOWS_CPPFLAGS], [$WINDOWS_CPPFLAGS])
257 AC_SUBST([WINDOWS_CFLAGS], [$WINDOWS_CFLAGS])
258 AM_CONDITIONAL([WINDOWS_NATIVE_BUILD], [test "x$WINDOWS_NATIVE_BUILD" = "xyes"])
259
260 AC_MSG_CHECKING([whether to include support for ntfs-3g])
261 AC_ARG_WITH([ntfs-3g],
262               AS_HELP_STRING([--without-ntfs-3g], [build without NTFS-3g.
263                               On UNIX, this will disable the ability to use NTFS-specific
264                               information when capturing or applying WIMs to a
265                               NTFS filesystem.]),
266         [WITH_NTFS_3G=$withval],
267         [WITH_NTFS_3G=$WITH_NTFS_3G_DEFAULT]
268         )
269 AC_MSG_RESULT([$WITH_NTFS_3G])
270 if test "x$WITH_NTFS_3G" = "xyes"; then
271         AC_DEFINE([WITH_NTFS_3G], [1], [On UNIX, define to 1 to enable support
272                    for NTFS-specific information])
273
274         dnl This effectively checks for NTFS-3g 2011.4.12 or later
275         AC_CHECK_LIB([ntfs-3g], [ntfs_xattr_system_setxattr], [],
276                         [AC_MSG_ERROR([Cannot find libntfs-3g version 2011-4-12
277         or later. Without libntfs-3g, wimlib cannot include support for
278         capturing and applying WIMs on NTFS filesystems while preserving
279         NTFS-specific data such as security descriptors and alternate data
280         streams.  You should either install libntfs-3g, or configure with
281         --without-ntfs-3g to disable support for these NTFS-specific
282         features.])])
283
284         PKG_CHECK_MODULES([LIBNTFS_3G], [libntfs-3g])
285         PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libntfs-3g"
286
287         dnl This checks for a NTFS-3g interface that was changed in the
288         dnl 2013.1.13 release
289         AC_CHECK_DECL([NTFS_MNT_RDONLY],
290                       [AC_DEFINE([HAVE_NTFS_MNT_RDONLY],
291                                  [1],
292                                  [Define to 1 if ntfs_mount() takes the flag NTFS_MNT_RDONLY])],
293                       [],
294                       [#include <ntfs-3g/volume.h>])
295 fi
296 AM_CONDITIONAL([WITH_NTFS_3G], [test "x$WITH_NTFS_3G" = "xyes"])
297
298 AM_ICONV
299 if test "x$am_cv_func_iconv" != "xyes"; then
300         AC_MSG_ERROR([Cannot find the iconv() function.
301         iconv() is used to convert between encodings of WIM filenames and XML data.
302         wimlib cannot be compiled without it.  iconv() is available in the latest
303         version of glibc and sometimes in other libraries.])
304 fi
305
306 AC_MSG_CHECKING([whether to include support for mounting WIMs])
307 AC_ARG_WITH([fuse],
308                 AS_HELP_STRING([--without-fuse], [build without libfuse.
309                                         This will disable the ability to mount
310                                         WIM files.]),
311         [WITH_FUSE=$withval],
312         [WITH_FUSE=$WITH_FUSE_DEFAULT]
313         )
314 AC_MSG_RESULT([$WITH_FUSE])
315 if test "x$WITH_FUSE" = "xyes"; then
316         AC_DEFINE([WITH_FUSE], [1], [Define to 1 if using FUSE.])
317
318
319         AC_CHECK_LIB([fuse], [fuse_main_real], [have_fuse=true],
320                         [AC_MSG_ERROR([Cannot find libfuse.
321         Without libfuse, wimlib cannot include support for mounting WIMs.  You
322         should either install libfuse, or configure with --without-fuse to
323         disable support for mounting WIMs.])
324         ])
325         AC_CHECK_LIB([rt], [mq_open], [have_posix_mq=true],
326                      [AC_MSG_ERROR([Cannot find librt for POSIX message queue
327         functions.  Without these functions, wimlib cannot include support for
328         mounting WIMs.  You should either update your C library to a recent
329         version of glibc, or configure with --without-fuse to disable support
330         for mounting WIMs.])
331         ])
332         PKG_CHECK_MODULES([LIBFUSE], [fuse])
333         PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES fuse"
334         PKGCONFIG_PRIVATE_LIBS="$PKGCONFIG_PRIVATE_LIBS -lrt"
335         AC_SUBST([LIBRT_LIBS], [-lrt])
336 fi
337 AM_CONDITIONAL([WITH_FUSE], [test "x$WITH_FUSE" = "xyes"])
338
339 ENABLE_XATTR=no
340 AC_ARG_ENABLE([xattr],
341         [AS_HELP_STRING([--enable-xattr], [Enable the xattr interface to access WIM
342                         alternate data streams (default: autodetect)])],
343         [ENABLE_XATTR=$enableval],
344         [if test "x$ENABLE_XATTR_DEFAULT" = "xautodetect"; then
345                 AC_CHECK_FUNC([setxattr],
346                         [AC_CHECK_HEADER([attr/xattr.h],
347                                 [ENABLE_XATTR=yes],
348                                 [AC_MSG_WARN([Cannot find the "attr/xattr.h" header.  You will not be
349                                  able to use the xattr interface to access WIM alternate data
350                                  streams.])])],
351                         [AC_MSG_WARN([Cannot find the setxattr() function.  You will not be
352                          able to use the xattr interface to access WIM alternate data
353                          streams.])])
354         fi])
355
356 if test "x$ENABLE_XATTR" = "xyes"; then
357         AC_DEFINE([ENABLE_XATTR], [1], [Define to 1 if using the xattr
358                         interface to WIM alternate data streams])
359 fi
360
361 AC_MSG_CHECKING([whether to use SSSE3-accelerated SHA1 ])
362 AC_ARG_ENABLE([ssse3-sha1],
363             AS_HELP_STRING([--enable-ssse3-sha1], [use assembly language implementation
364                                 of SHA1 from Intel, accelerated with vector
365                                 instructions (SSSE3-enabled CPU required)]),
366         [ENABLE_SSSE3_SHA1=$enableval],
367         [ENABLE_SSSE3_SHA1=no]
368         )
369
370 AC_MSG_RESULT([$ENABLE_SSSE3_SHA1])
371 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
372         AC_DEFINE([ENABLE_SSSE3_SHA1], [1],
373                         [Define to 1 if using vectorized implementation of SHA1])
374         SSSE3_SHA1_OBJ=sha1-ssse3.lo
375         AX_PROG_NASM
376         AC_SUBST([NASM], [$nasm])
377 else
378         SSSE3_SHA1_OBJ=
379 fi
380 AC_SUBST([SSSE3_SHA1_OBJ], [$SSSE3_SHA1_OBJ])
381
382 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
383         WITH_LIBCRYPTO=no
384 else
385         AC_ARG_WITH([libcrypto],
386             AS_HELP_STRING([--without-libcrypto], [build in the SHA1 algorithm,
387                                         rather than use external libcrypto from
388                                         OpenSSL (default is autodetect)]),
389         [WITH_LIBCRYPTO=$withval],
390         [AC_CHECK_LIB([crypto], [SHA1],
391                      [WITH_LIBCRYPTO=yes],
392                      [AC_MSG_WARN([Cannot find libcrypto: using stand-alone SHA1 code instead of OpenSSL])
393                      WITH_LIBCRYPTO=no
394                      ])])
395 fi
396 AC_MSG_CHECKING([whether to use SHA1 function from system libcrypto])
397 AC_MSG_RESULT([$WITH_LIBCRYPTO])
398
399 if test "x$WITH_LIBCRYPTO" = "xyes" -a "x$ENABLE_SSSE3_SHA1" = "xno"; then
400         AC_DEFINE([WITH_LIBCRYPTO], [1], [Define to 1 if using libcrypto SHA1])
401         PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto])
402         PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libcrypto"
403 fi
404 AC_SUBST([SHA1_SOURCES], [$SHA1_SOURCES])
405
406 AC_SUBST([PKGCONFIG_PRIVATE_REQUIRES], [$PKGCONFIG_PRIVATE_REQUIRES])
407 AC_SUBST([PKGCONFIG_PRIVATE_LIBS], [$PKGCONFIG_PRIVATE_LIBS])
408
409 AC_OUTPUT