]> wimlib.net Git - wimlib/blob - configure.ac
6803b90b0a4bada51a6932248f4bda051fb61ffd
[wimlib] / configure.ac
1 AC_INIT([wimlib], [1.7.4-BETA], [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 foreign])
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_CONFIG_HEADERS([config.h])
14 AC_CONFIG_FILES([Makefile]
15                 [doc/Doxyfile]
16                 [wimlib.pc]
17                 [doc/man1/wimlib-imagex.1:doc/man1/imagex.1.in]
18                 [doc/man1/wimlib-imagex-append.1:doc/man1/imagex-append.1.in]
19                 [doc/man1/wimlib-imagex-apply.1:doc/man1/imagex-apply.1.in]
20                 [doc/man1/wimlib-imagex-capture.1:doc/man1/imagex-capture.1.in]
21                 [doc/man1/wimlib-imagex-delete.1:doc/man1/imagex-delete.1.in]
22                 [doc/man1/wimlib-imagex-dir.1:doc/man1/imagex-dir.1.in]
23                 [doc/man1/wimlib-imagex-export.1:doc/man1/imagex-export.1.in]
24                 [doc/man1/wimlib-imagex-extract.1:doc/man1/imagex-extract.1.in]
25                 [doc/man1/wimlib-imagex-info.1:doc/man1/imagex-info.1.in]
26                 [doc/man1/wimlib-imagex-join.1:doc/man1/imagex-join.1.in]
27                 [doc/man1/wimlib-imagex-mount.1:doc/man1/imagex-mount.1.in]
28                 [doc/man1/wimlib-imagex-mountrw.1:doc/man1/imagex-mountrw.1.in]
29                 [doc/man1/wimlib-imagex-optimize.1:doc/man1/imagex-optimize.1.in]
30                 [doc/man1/wimlib-imagex-split.1:doc/man1/imagex-split.1.in]
31                 [doc/man1/wimlib-imagex-unmount.1:doc/man1/imagex-unmount.1.in]
32                 [doc/man1/wimlib-imagex-update.1:doc/man1/imagex-update.1.in]
33                 [doc/man1/wimlib-imagex-verify.1:doc/man1/imagex-verify.1.in]
34                 [doc/man1/mkwinpeimg.1])
35
36 AC_CONFIG_FILES([programs/mkwinpeimg], [chmod +x programs/mkwinpeimg])
37
38 AC_PROG_CC
39 AM_PROG_CC_C_O
40 AC_CANONICAL_HOST
41
42 AC_CHECK_FUNCS([futimens utimensat utime flock mempcpy  \
43                 openat fstatat readlinkat fdopendir])
44
45 # Note: some of the following header checks are only to define the appropriate
46 # HAVE_*_H macro so that the NTFS-3g headers don't get confused and try to skip
47 # including certain headers.
48 AC_CHECK_HEADERS([alloca.h              \
49                   byteswap.h            \
50                   endian.h              \
51                   errno.h               \
52                   glob.h                \
53                   machine/endian.h      \
54                   stdarg.h              \
55                   stddef.h              \
56                   stdlib.h              \
57                   sys/byteorder.h       \
58                   sys/endian.h          \
59                   sys/file.h            \
60                   sys/param.h           \
61                   sys/sysctl.h          \
62                   sys/times.h           \
63                   time.h                \
64                   utime.h])
65
66 AC_CHECK_MEMBER([struct stat.st_mtim],
67                 [AC_DEFINE([HAVE_STAT_NANOSECOND_PRECISION], [1],
68                           [Define to 1 if nanosecond precision timestamps are
69                            supported])],
70                 [],
71                 [[#include <sys/stat.h>]])
72
73
74 AC_ARG_WITH(pkgconfigdir,
75             [  --with-pkgconfigdir=DIR      pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@],
76             [pkgconfigdir=$withval],
77             [pkgconfigdir='${libdir}/pkgconfig'])
78 AC_SUBST(pkgconfigdir)
79
80 AC_CHECK_LIB([xml2], [xmlParseFile], [have_libxml=true],
81              [AC_MSG_ERROR(["cannot find libxml2"])])
82 PKG_CHECK_MODULES([LIBXML2], [libxml-2.0])
83 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libxml-2.0"
84
85 AC_MSG_CHECKING([whether to include debugging messages])
86 AC_ARG_ENABLE([debug],
87         AS_HELP_STRING([--enable-debug], [include lots of debugging messages]),
88         [ENABLE_DEBUG=$enableval],
89         [ENABLE_DEBUG=no]
90         )
91 AC_MSG_RESULT([$ENABLE_DEBUG])
92 if test "x$ENABLE_DEBUG" = "xyes"; then
93         AC_DEFINE([ENABLE_DEBUG], [1],
94                         [Define to 1 if including lots of debug messages.])
95 fi
96
97 AC_MSG_CHECKING([whether to include error messages])
98 AC_ARG_ENABLE([error_messages],
99         AS_HELP_STRING([--disable-error-messages],
100                         [do not compile in error messsages]),
101         [ENABLE_ERROR_MESSAGES=$enableval],
102         [ENABLE_ERROR_MESSAGES=yes]
103         )
104 AC_MSG_RESULT([$ENABLE_ERROR_MESSAGES])
105 if test "x$ENABLE_ERROR_MESSAGES" = "xyes"; then
106         AC_DEFINE([ENABLE_ERROR_MESSAGES], [1],
107                         [Define to 1 if including error messages])
108 fi
109
110 AC_MSG_CHECKING([whether to include assertions])
111 AC_ARG_ENABLE([assertions],
112         AS_HELP_STRING([--disable-assertions], [do not include assertions]),
113         [ENABLE_ASSERTIONS=$enableval],
114         [ENABLE_ASSERTIONS=yes]
115         )
116 AC_MSG_RESULT([$ENABLE_ASSERTIONS])
117 if test "x$ENABLE_ASSERTIONS" = "xyes"; then
118         AC_DEFINE([ENABLE_ASSERTIONS], [1], [Define to 1 if including assertions.])
119 fi
120
121 AC_MSG_CHECKING([whether to include automatic compression verification])
122 AC_ARG_ENABLE([verify_compression],
123               AS_HELP_STRING([--enable-verify-compression], [always
124                                 check if blocks we compress can be correctly
125                                 decompressed]),
126         [ENABLE_VERIFY_COMPRESSION=$enableval],
127         [ENABLE_VERIFY_COMPRESSION=no]
128         )
129 AC_MSG_RESULT([$ENABLE_VERIFY_COMPRESSION])
130 if test "x$ENABLE_VERIFY_COMPRESSION" = "xyes"; then
131         AC_DEFINE([ENABLE_VERIFY_COMPRESSION], [1], [Define to 1 to verify
132                    compressed data])
133 fi
134
135 AC_MSG_CHECKING([whether to include support for multi-threaded compression])
136 AC_ARG_ENABLE([multithreaded-compression],
137         AS_HELP_STRING([--disable-multithreaded-compression],
138                         [do not compile in the code for multi-threaded compression]),
139         [ENABLE_MULTITHREADED_COMPRESSION=$enableval],
140         [ENABLE_MULTITHREADED_COMPRESSION=yes]
141         )
142 AC_MSG_RESULT([$ENABLE_MULTITHREADED_COMPRESSION])
143 if test "x$ENABLE_MULTITHREADED_COMPRESSION" = "xyes"; then
144         AC_DEFINE([ENABLE_MULTITHREADED_COMPRESSION], [1],
145                         [Define to 1 if including support for multithreaded
146                          compression])
147 fi
148
149 PTHREAD_LDADD="-lpthread"
150 AC_SUBST([PTHREAD_LDADD], [$PTHREAD_LDADD])
151
152 WITH_NTFS_3G_DEFAULT="no"
153 WITH_FUSE_DEFAULT="no"
154 WINDOWS_NATIVE_BUILD="no"
155 VISIBILITY_CFLAGS="-fvisibility=hidden"
156 WINDOWS_CFLAGS=""
157 WINDOWS_CPPFLAGS=""
158 WINDOWS_LDFLAGS=""
159
160 case "$host_os" in
161         mingw*)
162                 # Native Windows
163                 WINDOWS_NATIVE_BUILD="yes"
164                 VISIBILITY_CFLAGS=""
165                 WINDOWS_CFLAGS="-municode"
166                 WINDOWS_CPPFLAGS="-D_POSIX -DUNICODE -D_UNICODE -D_CRT_NON_CONFORMING_SWPRINTFS"
167                 WINDOWS_LDFLAGS="-no-undefined"
168                 ;;
169         linux*)
170                 # Linux
171                 WITH_FUSE_DEFAULT="yes"
172                 WITH_NTFS_3G_DEFAULT="yes"
173                 ;;
174         *)
175                 # Other UNIX
176                 WITH_NTFS_3G_DEFAULT="yes"
177                 ;;
178 esac
179
180 AC_SUBST([VISIBILITY_CFLAGS], [$VISIBILITY_CFLAGS])
181 AC_SUBST([WINDOWS_LDFLAGS], [$WINDOWS_LDFLAGS])
182 AC_SUBST([WINDOWS_CPPFLAGS], [$WINDOWS_CPPFLAGS])
183 AC_SUBST([WINDOWS_CFLAGS], [$WINDOWS_CFLAGS])
184 AM_CONDITIONAL([WINDOWS_NATIVE_BUILD], [test "x$WINDOWS_NATIVE_BUILD" = "xyes"])
185
186
187 AM_ICONV
188 if test "x$am_cv_func_iconv" != "xyes"; then
189         AC_MSG_ERROR([Cannot find the iconv() function.  iconv() is used to
190                       convert between encodings of WIM filenames and XML data.
191                       wimlib cannot be compiled without it.  iconv() is
192                       available in the latest version of glibc and sometimes in
193                       other libraries.])
194 fi
195
196 AC_MSG_CHECKING([whether to include support for ntfs-3g])
197 AC_ARG_WITH([ntfs-3g],
198             [AS_HELP_STRING([--without-ntfs-3g],
199                             [build without libntfs-3g.  This will disable the
200                              ability to capture or apply a WIM image directly
201                              from/to an unmounted NTFS volume.])],
202             [WITH_NTFS_3G=$withval],
203             [WITH_NTFS_3G=$WITH_NTFS_3G_DEFAULT])
204
205 AC_MSG_RESULT([$WITH_NTFS_3G])
206 if test "x$WITH_NTFS_3G" = "xyes"; then
207         AC_DEFINE([WITH_NTFS_3G], [1], [Define to 1 to enable NTFS-3g support.])
208
209         dnl This effectively checks for NTFS-3g 2011.4.12 or later
210         AC_CHECK_LIB([ntfs-3g], [ntfs_xattr_system_setxattr], [],
211                         [AC_MSG_ERROR([Cannot find libntfs-3g version 2011-4-12
212         or later!  Without libntfs-3g, wimlib cannot include support for
213         capturing or applying a WIM image directly from/to an unmounted NTFS
214         volume while preserving NTFS-specific data such as security descriptors
215         and named data streams.  Either install libntfs-3g, or configure
216         --without-ntfs-3g to disable this feature.])])
217
218         PKG_CHECK_MODULES([LIBNTFS_3G], [libntfs-3g])
219         PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libntfs-3g"
220
221         dnl This checks for an NTFS-3g interface that was changed in the
222         dnl 2013.1.13 release
223         AC_CHECK_DECL([NTFS_MNT_RDONLY],
224                       [AC_DEFINE([HAVE_NTFS_MNT_RDONLY],
225                                  [1],
226                                  [Define to 1 if ntfs_mount() takes the flag NTFS_MNT_RDONLY])],
227                       [],
228                       [#include <ntfs-3g/volume.h>])
229 fi
230 AM_CONDITIONAL([WITH_NTFS_3G], [test "x$WITH_NTFS_3G" = "xyes"])
231
232 AC_MSG_CHECKING([whether to include support for mounting WIMs])
233 AC_ARG_WITH([fuse],
234         [AS_HELP_STRING([--without-fuse],
235                         [build without libfuse.  This will disable the ability
236                          to mount WIM images.])],
237         [WITH_FUSE=$withval],
238         [WITH_FUSE=$WITH_FUSE_DEFAULT])
239
240 AC_MSG_RESULT([$WITH_FUSE])
241 if test "x$WITH_FUSE" = "xyes"; then
242         AC_DEFINE([WITH_FUSE], [1], [Define to 1 if using FUSE.])
243
244         AC_CHECK_LIB([fuse], [fuse_main_real], [],
245                         [AC_MSG_ERROR([Cannot find libfuse!
246         Without libfuse, wimlib cannot include support for mounting WIM images.
247         Either install libfuse, or configure --without-fuse to disable this
248         feature.])])
249
250         AC_CHECK_LIB([rt], [mq_open], [],
251                      [AC_MSG_ERROR([Cannot find librt (the POSIX.1b Realtime
252         Extensions Library)!  wimlib needs this for the POSIX message queue
253         functions, which are used in the code for mounting WIM images.  Recent
254         versions of glibc include this library.  Either install this library, or
255         configure --without-fuse to disable support for mounting WIM images.])])
256
257         AC_CHECK_LIB([attr], [getxattr], [],
258                      [AC_MSG_ERROR([Cannot find libattr!
259         wimlib needs this for the extended attribute functions, which are used
260         in the code for mounting WIM images.  Either install this library, or
261         configure --without-fuse to disable support for mounting WIM images.])])
262
263         PKG_CHECK_MODULES([LIBFUSE], [fuse])
264         PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES fuse"
265         PKGCONFIG_PRIVATE_LIBS="$PKGCONFIG_PRIVATE_LIBS -lrt"
266         AC_SUBST([LIBRT_LIBS], [-lrt])
267 fi
268 AM_CONDITIONAL([WITH_FUSE], [test "x$WITH_FUSE" = "xyes"])
269
270 AC_MSG_CHECKING([whether to use SSSE3-accelerated SHA-1])
271 AC_ARG_ENABLE([ssse3-sha1],
272               [AS_HELP_STRING([--enable-ssse3-sha1],
273                               [Include SSSE3-accelerated SHA-1 implementation by
274                                Intel.  This implies --without-libcrypto.])],
275               [ENABLE_SSSE3_SHA1=$enableval],
276               [ENABLE_SSSE3_SHA1=no])
277
278 AC_MSG_RESULT([$ENABLE_SSSE3_SHA1])
279 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
280         AC_DEFINE([ENABLE_SSSE3_SHA1], [1],
281                   [Define to 1 if using SSSE3 implementation of SHA-1])
282         SSSE3_SHA1_OBJ=src/sha1-ssse3.lo
283         AC_PROG_NASM
284         NASM_SYMBOL_PREFIX=""
285         NASM_WINDOWS_FLAGS=
286         if test "x$WINDOWS_NATIVE_BUILD" = "xyes"; then
287                 NASM_WINDOWS_FLAGS="-DWIN_ABI"
288         fi
289         case "$host_os" in
290                 darwin* | rhapsody* | nextstep* | openstep* | macos*)
291                         NASM_SYMBOL_PREFIX="_"
292                         ;;
293         esac
294         AC_SUBST([NASM_WINDOWS_FLAGS], $NASM_WINDOWS_FLAGS)
295         AC_SUBST([NASM_SYMBOL_PREFIX], $NASM_SYMBOL_PREFIX)
296 else
297         SSSE3_SHA1_OBJ=
298 fi
299 AC_SUBST([SSSE3_SHA1_OBJ], [$SSSE3_SHA1_OBJ])
300
301 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
302         WITH_LIBCRYPTO=no
303 else
304         AC_ARG_WITH([libcrypto],
305                     [AS_HELP_STRING([--without-libcrypto],
306                                     [build in the SHA-1 algorithm, rather than
307                                      use external libcrypto from OpenSSL
308                                      (default is autodetect)])],
309         [WITH_LIBCRYPTO=$withval],
310         [AC_CHECK_LIB([crypto],
311                       [SHA1],
312                       [WITH_LIBCRYPTO=yes],
313                       [AC_MSG_WARN([Cannot find libcrypto: using stand-alone
314                                     SHA-1 code instead of OpenSSL])
315                        WITH_LIBCRYPTO=no])])
316 fi
317 AC_MSG_CHECKING([whether to use SHA-1 implementation from system libcrypto])
318 AC_MSG_RESULT([$WITH_LIBCRYPTO])
319
320 if test "x$WITH_LIBCRYPTO" = "xyes" -a "x$ENABLE_SSSE3_SHA1" = "xno"; then
321         AC_DEFINE([WITH_LIBCRYPTO], [1], [Define to 1 if using libcrypto SHA-1])
322         PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto])
323         PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libcrypto"
324 fi
325
326 AC_SUBST([PKGCONFIG_PRIVATE_REQUIRES], [$PKGCONFIG_PRIVATE_REQUIRES])
327 AC_SUBST([PKGCONFIG_PRIVATE_LIBS], [$PKGCONFIG_PRIVATE_LIBS])
328
329 AC_OUTPUT