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