]> wimlib.net Git - wimlib/blob - configure.ac
Don't run man pages through configure
[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 VISIBILITY_CFLAGS="-fvisibility=hidden"
138 WINDOWS_CFLAGS=""
139 WINDOWS_CPPFLAGS=""
140 WINDOWS_LDFLAGS=""
141
142 case "$host_os" in
143         mingw*)
144                 # Native Windows
145                 WINDOWS_NATIVE_BUILD="yes"
146                 VISIBILITY_CFLAGS=""
147                 WINDOWS_CFLAGS="-municode"
148                 WINDOWS_CPPFLAGS="-D_POSIX -DUNICODE -D_UNICODE -D_CRT_NON_CONFORMING_SWPRINTFS"
149                 WINDOWS_LDFLAGS="-no-undefined"
150                 ;;
151         linux*)
152                 # Linux
153                 WITH_FUSE_DEFAULT="yes"
154                 WITH_NTFS_3G_DEFAULT="yes"
155                 ;;
156         *)
157                 # Other UNIX
158                 WITH_NTFS_3G_DEFAULT="yes"
159                 ;;
160 esac
161
162 AC_SUBST([VISIBILITY_CFLAGS], [$VISIBILITY_CFLAGS])
163 AC_SUBST([WINDOWS_LDFLAGS], [$WINDOWS_LDFLAGS])
164 AC_SUBST([WINDOWS_CPPFLAGS], [$WINDOWS_CPPFLAGS])
165 AC_SUBST([WINDOWS_CFLAGS], [$WINDOWS_CFLAGS])
166 AM_CONDITIONAL([WINDOWS_NATIVE_BUILD], [test "x$WINDOWS_NATIVE_BUILD" = "xyes"])
167
168
169 AM_ICONV
170 if test "x$am_cv_func_iconv" != "xyes"; then
171         AC_MSG_ERROR([Cannot find the iconv() function.  iconv() is used to
172                       convert between encodings of WIM filenames and XML data.
173                       wimlib cannot be compiled without it.  iconv() is
174                       available in the latest version of glibc and sometimes in
175                       other libraries.])
176 fi
177
178 AC_MSG_CHECKING([whether to include support for ntfs-3g])
179 AC_ARG_WITH([ntfs-3g],
180             [AS_HELP_STRING([--without-ntfs-3g],
181                             [build without libntfs-3g.  This will disable the
182                              ability to capture or apply a WIM image directly
183                              from/to an unmounted NTFS volume.])],
184             [WITH_NTFS_3G=$withval],
185             [WITH_NTFS_3G=$WITH_NTFS_3G_DEFAULT])
186
187 AC_MSG_RESULT([$WITH_NTFS_3G])
188 if test "x$WITH_NTFS_3G" = "xyes"; then
189         AC_DEFINE([WITH_NTFS_3G], [1], [Define to 1 to enable NTFS-3g support.])
190
191         dnl This effectively checks for NTFS-3g 2011.4.12 or later
192         AC_CHECK_LIB([ntfs-3g], [ntfs_xattr_system_setxattr], [],
193                         [AC_MSG_ERROR([Cannot find libntfs-3g version 2011-4-12
194         or later!  Without libntfs-3g, wimlib cannot include support for
195         capturing or applying a WIM image directly from/to an unmounted NTFS
196         volume while preserving NTFS-specific data such as security descriptors
197         and named data streams.  Either install libntfs-3g, or configure
198         --without-ntfs-3g to disable this feature.])])
199
200         PKG_CHECK_MODULES([LIBNTFS_3G], [libntfs-3g])
201         PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libntfs-3g"
202
203         dnl This checks for an NTFS-3g interface that was changed in the
204         dnl 2013.1.13 release
205         AC_CHECK_DECL([NTFS_MNT_RDONLY],
206                       [AC_DEFINE([HAVE_NTFS_MNT_RDONLY],
207                                  [1],
208                                  [Define to 1 if ntfs_mount() takes the flag NTFS_MNT_RDONLY])],
209                       [],
210                       [#include <ntfs-3g/volume.h>])
211 fi
212 AM_CONDITIONAL([WITH_NTFS_3G], [test "x$WITH_NTFS_3G" = "xyes"])
213
214 AC_MSG_CHECKING([whether to include support for mounting WIMs])
215 AC_ARG_WITH([fuse],
216         [AS_HELP_STRING([--without-fuse],
217                         [build without libfuse.  This will disable the ability
218                          to mount WIM images.])],
219         [WITH_FUSE=$withval],
220         [WITH_FUSE=$WITH_FUSE_DEFAULT])
221
222 AC_MSG_RESULT([$WITH_FUSE])
223 if test "x$WITH_FUSE" = "xyes"; then
224         AC_DEFINE([WITH_FUSE], [1], [Define to 1 if using FUSE.])
225
226         AC_CHECK_LIB([fuse], [fuse_main_real], [],
227                         [AC_MSG_ERROR([Cannot find libfuse!
228         Without libfuse, wimlib cannot include support for mounting WIM images.
229         Either install libfuse, or configure --without-fuse to disable this
230         feature.])])
231
232         AC_CHECK_LIB([rt], [mq_open], [],
233                      [AC_MSG_ERROR([Cannot find librt (the POSIX.1b Realtime
234         Extensions Library)!  wimlib needs this for the POSIX message queue
235         functions, which are used in the code for mounting WIM images.  Recent
236         versions of glibc include this library.  Either install this library, or
237         configure --without-fuse to disable support for mounting WIM images.])])
238
239         AC_CHECK_LIB([attr], [getxattr], [],
240                      [AC_MSG_ERROR([Cannot find libattr!
241         wimlib needs this for the extended attribute functions, which are used
242         in the code for mounting WIM images.  Either install this library, or
243         configure --without-fuse to disable support for mounting WIM images.])])
244
245         PKG_CHECK_MODULES([LIBFUSE], [fuse])
246         PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES fuse"
247         PKGCONFIG_PRIVATE_LIBS="$PKGCONFIG_PRIVATE_LIBS -lrt"
248         AC_SUBST([LIBRT_LIBS], [-lrt])
249 fi
250 AM_CONDITIONAL([WITH_FUSE], [test "x$WITH_FUSE" = "xyes"])
251
252 AC_MSG_CHECKING([whether to use SSSE3-accelerated SHA-1])
253 AC_ARG_ENABLE([ssse3-sha1],
254               [AS_HELP_STRING([--enable-ssse3-sha1],
255                               [Include SSSE3-accelerated SHA-1 implementation by
256                                Intel.  This implies --without-libcrypto.])],
257               [ENABLE_SSSE3_SHA1=$enableval],
258               [ENABLE_SSSE3_SHA1=no])
259
260 AC_MSG_RESULT([$ENABLE_SSSE3_SHA1])
261 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
262         AC_DEFINE([ENABLE_SSSE3_SHA1], [1],
263                   [Define to 1 if using SSSE3 implementation of SHA-1])
264         SSSE3_SHA1_OBJ=src/sha1-ssse3.lo
265         AC_PROG_NASM
266         NASM_SYMBOL_PREFIX=""
267         NASM_WINDOWS_FLAGS=
268         if test "x$WINDOWS_NATIVE_BUILD" = "xyes"; then
269                 NASM_WINDOWS_FLAGS="-DWIN_ABI"
270         fi
271         case "$host_os" in
272                 darwin* | rhapsody* | nextstep* | openstep* | macos*)
273                         NASM_SYMBOL_PREFIX="_"
274                         ;;
275         esac
276         AC_SUBST([NASM_WINDOWS_FLAGS], $NASM_WINDOWS_FLAGS)
277         AC_SUBST([NASM_SYMBOL_PREFIX], $NASM_SYMBOL_PREFIX)
278 else
279         SSSE3_SHA1_OBJ=
280 fi
281 AC_SUBST([SSSE3_SHA1_OBJ], [$SSSE3_SHA1_OBJ])
282
283 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
284         WITH_LIBCRYPTO=no
285 else
286         AC_ARG_WITH([libcrypto],
287                     [AS_HELP_STRING([--without-libcrypto],
288                                     [build in the SHA-1 algorithm, rather than
289                                      use external libcrypto from OpenSSL
290                                      (default is autodetect)])],
291         [WITH_LIBCRYPTO=$withval],
292         [AC_CHECK_LIB([crypto],
293                       [SHA1],
294                       [WITH_LIBCRYPTO=yes],
295                       [AC_MSG_WARN([Cannot find libcrypto: using stand-alone
296                                     SHA-1 code instead of OpenSSL])
297                        WITH_LIBCRYPTO=no])])
298 fi
299 AC_MSG_CHECKING([whether to use SHA-1 implementation from system libcrypto])
300 AC_MSG_RESULT([$WITH_LIBCRYPTO])
301
302 if test "x$WITH_LIBCRYPTO" = "xyes" -a "x$ENABLE_SSSE3_SHA1" = "xno"; then
303         AC_DEFINE([WITH_LIBCRYPTO], [1], [Define to 1 if using libcrypto SHA-1])
304         PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto])
305         PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libcrypto"
306 fi
307
308 AC_SUBST([PKGCONFIG_PRIVATE_REQUIRES], [$PKGCONFIG_PRIVATE_REQUIRES])
309 AC_SUBST([PKGCONFIG_PRIVATE_LIBS], [$PKGCONFIG_PRIVATE_LIBS])
310
311 AC_OUTPUT