]> wimlib.net Git - wimlib/blob - configure.ac
xpress_decompress: tweak comment about end-of-block symbol
[wimlib] / configure.ac
1 ###############################################################################
2
3 AC_INIT([wimlib], [1.10.0-BETA], [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 AM_SILENT_RULES([yes])
9 AC_C_BIGENDIAN
10 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
11 LT_INIT
12
13 AC_CONFIG_HEADERS([config.h])
14 AC_CONFIG_FILES([Makefile] [doc/Doxyfile] [wimlib.pc])
15 AC_CONFIG_FILES([programs/mkwinpeimg], [chmod +x programs/mkwinpeimg])
16
17 PKGCONFIG_PRIVATE_REQUIRES=""
18 PKGCONFIG_PRIVATE_LIBS=""
19
20 ###############################################################################
21 #                         General platform features                           #
22 ###############################################################################
23
24 AC_PROG_CC
25 AM_PROG_CC_C_O
26 AC_CANONICAL_HOST
27
28 WINDOWS_NATIVE_BUILD="no"
29 PLATFORM_CPPFLAGS=""
30 PLATFORM_CFLAGS="-fvisibility=hidden"
31 PLATFORM_LDFLAGS=""
32
33 case "$host_os" in
34 mingw*)
35         # Native Windows
36         WINDOWS_NATIVE_BUILD="yes"
37         PLATFORM_CPPFLAGS="-D_POSIX -D_POSIX_THREAD_SAFE_FUNCTIONS -DUNICODE -D_UNICODE -D_CRT_NON_CONFORMING_SWPRINTFS"
38         PLATFORM_CFLAGS="-municode -mno-ms-bitfields"
39         PLATFORM_LDFLAGS="-no-undefined"
40         WITH_NTFS_3G_DEFAULT="no"
41         WITH_FUSE_DEFAULT="no"
42         ;;
43 linux*)
44         # Linux
45         WITH_NTFS_3G_DEFAULT="yes"
46         WITH_FUSE_DEFAULT="yes"
47         ;;
48 *)
49         # Other UNIX
50         WITH_NTFS_3G_DEFAULT="yes"
51         WITH_FUSE_DEFAULT="no"
52         ;;
53 esac
54
55 AC_SUBST([PLATFORM_CPPFLAGS], [$PLATFORM_CPPFLAGS])
56 AC_SUBST([PLATFORM_CFLAGS], [$PLATFORM_CFLAGS])
57 AC_SUBST([PLATFORM_LDFLAGS], [$PLATFORM_LDFLAGS])
58 AM_CONDITIONAL([WINDOWS_NATIVE_BUILD], [test "$WINDOWS_NATIVE_BUILD" = "yes"])
59
60 # Useful functions which we can do without.
61 AC_CHECK_FUNCS([futimens utimensat flock mempcpy        \
62                 openat fstatat readlinkat fdopendir])
63
64 # Header checks, most of which are only here to satisfy conditional includes
65 # made by the libntfs-3g headers.
66 AC_CHECK_HEADERS([alloca.h              \
67                   attr/xattr.h          \
68                   byteswap.h            \
69                   endian.h              \
70                   errno.h               \
71                   glob.h                \
72                   machine/endian.h      \
73                   stdarg.h              \
74                   stddef.h              \
75                   stdlib.h              \
76                   sys/byteorder.h       \
77                   sys/endian.h          \
78                   sys/file.h            \
79                   sys/param.h           \
80                   sys/sysctl.h          \
81                   sys/times.h           \
82                   time.h                \
83                   utime.h])
84
85 # Does stat() support nanosecond-precision timestamps?  (This is relevant on
86 # UNIX but not on Windows.)
87 AC_CHECK_MEMBER([struct stat.st_mtim],
88                 [AC_DEFINE([HAVE_STAT_NANOSECOND_PRECISION], [1],
89                            [Define to 1 if stat() supports nanosecond precision
90                             timestamps])],
91                 [],
92                 [#include <sys/stat.h>])
93
94 ###############################################################################
95 #                            Required libraries                               #
96 ###############################################################################
97
98 # ------------------------------ pthreads -------------------------------------
99 AX_PTHREAD([], [AC_MSG_ERROR(["cannot find pthreads library"])])
100
101 # ------------------------------ libxml2 --------------------------------------
102 PKG_CHECK_MODULES([LIBXML2], [libxml-2.0])
103 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libxml-2.0"
104
105 ###############################################################################
106 #                         Configuration options                               #
107 ###############################################################################
108
109 # ------------------------- ntfs-3g support -----------------------------------
110
111 AC_MSG_CHECKING([whether to include support for ntfs-3g])
112 AC_ARG_WITH([ntfs-3g],
113             [AS_HELP_STRING([--without-ntfs-3g],
114                             [build without libntfs-3g.  This will disable the
115                              ability to capture or apply a WIM image directly
116                              from/to an unmounted NTFS volume.])],
117             [WITH_NTFS_3G=$withval],
118             [WITH_NTFS_3G=$WITH_NTFS_3G_DEFAULT])
119 AC_MSG_RESULT([$WITH_NTFS_3G])
120
121 if test "$WITH_NTFS_3G" = "yes"; then
122         PKG_CHECK_MODULES([LIBNTFS_3G], [libntfs-3g >= 2011.4.12], [],
123                 [AC_MSG_ERROR([Cannot find libntfs-3g version 2011-4-12 or
124                  later!  Without libntfs-3g, wimlib cannot include support for
125                  capturing or applying a WIM image directly from/to an unmounted
126                  NTFS volume while preserving NTFS-specific data such as
127                  security descriptors and named data streams.  Either install
128                  libntfs-3g, or configure --without-ntfs-3g to disable this
129                  feature.])])
130         PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libntfs-3g"
131         AC_DEFINE([WITH_NTFS_3G], [1], [Define to 1 if using NTFS-3G support])
132 fi
133 AM_CONDITIONAL([WITH_NTFS_3G], [test "$WITH_NTFS_3G" = "yes"])
134
135 # ------------------------ FUSE mount support ---------------------------------
136
137 AC_MSG_CHECKING([whether to include support for mounting WIMs])
138 AC_ARG_WITH([fuse],
139             [AS_HELP_STRING([--without-fuse],
140                             [build without libfuse.  This will disable the
141                              ability to mount WIM images.])],
142             [WITH_FUSE=$withval],
143             [WITH_FUSE=$WITH_FUSE_DEFAULT])
144 AC_MSG_RESULT([$WITH_FUSE])
145
146 if test "$WITH_FUSE" = "yes"; then
147
148         PKG_CHECK_MODULES([LIBFUSE], [fuse], [],
149                 [AC_MSG_ERROR([Cannot find libfuse!
150                 Without libfuse, wimlib cannot include support for mounting WIM
151                 images.  Either install libfuse, or configure --without-fuse to
152                 disable this feature.])])
153         PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES fuse"
154         AC_DEFINE([WITH_FUSE], [1], [Define to 1 if using FUSE support])
155
156         AC_CHECK_LIB([rt], [mq_open], [],
157                      [AC_MSG_ERROR([Cannot find librt (the POSIX.1b Realtime
158         Extensions Library)!  wimlib needs this for the POSIX message queue
159         functions, which are used in the code for mounting WIM images.  Recent
160         versions of glibc include this library.  Either install this library, or
161         configure --without-fuse to disable support for mounting WIM images.])])
162
163         AC_CHECK_LIB([attr], [getxattr], [],
164                      [AC_MSG_ERROR([Cannot find libattr!
165         wimlib needs this for the extended attribute functions, which are used
166         in the code for mounting WIM images.  Either install this library, or
167         configure --without-fuse to disable support for mounting WIM images.])])
168
169         PKGCONFIG_PRIVATE_LIBS="$PKGCONFIG_PRIVATE_LIBS -lrt"
170         AC_SUBST([LIBRT_LIBS], [-lrt])
171 fi
172 AM_CONDITIONAL([WITH_FUSE], [test "$WITH_FUSE" = "yes"])
173
174 # ------------------------ SHA-1 implementation ---------------------------------
175
176 AC_MSG_CHECKING([whether to use SSSE3-accelerated SHA-1])
177 AC_ARG_ENABLE([ssse3-sha1],
178               [AS_HELP_STRING([--enable-ssse3-sha1],
179                               [Include SSSE3-accelerated SHA-1 implementation by
180                                Intel.  This implies --without-libcrypto.])],
181               [ENABLE_SSSE3_SHA1=$enableval],
182               [ENABLE_SSSE3_SHA1=no])
183 AC_MSG_RESULT([$ENABLE_SSSE3_SHA1])
184
185 if test "$ENABLE_SSSE3_SHA1" = "yes" ; then
186         AC_DEFINE([ENABLE_SSSE3_SHA1], [1],
187                   [Define to 1 if using SSSE3 implementation of SHA-1])
188         AC_PROG_NASM
189         NASM_SYMBOL_PREFIX=""
190         NASM_PLATFORM_FLAGS=""
191         if test "$WINDOWS_NATIVE_BUILD" = "yes"; then
192                 NASM_PLATFORM_FLAGS="-DWIN_ABI"
193         fi
194         case "$host_os" in
195         darwin* | rhapsody* | nextstep* | openstep* | macos*)
196                 NASM_SYMBOL_PREFIX="_"
197                 ;;
198         esac
199         AC_SUBST([NASM_PLATFORM_FLAGS], [$NASM_PLATFORM_FLAGS])
200         AC_SUBST([NASM_SYMBOL_PREFIX], [$NASM_SYMBOL_PREFIX])
201 else
202         AC_MSG_CHECKING([whether to use SHA-1 implementation from system libcrypto])
203         AC_ARG_WITH([libcrypto],
204                     [AS_HELP_STRING([--without-libcrypto],
205                                     [build in the SHA-1 algorithm, rather than
206                                      use external libcrypto from OpenSSL
207                                      (default is autodetect)])],
208                     [WITH_LIBCRYPTO=$withval],
209                     [WITH_LIBCRYPTO=auto])
210         AC_MSG_RESULT([$WITH_LIBCRYPTO])
211         if test "$WITH_LIBCRYPTO" != "no"; then
212                 PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto], [
213                         PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libcrypto"
214                         AC_DEFINE([WITH_LIBCRYPTO], [1],
215                                   [Define to 1 if using libcrypto SHA-1])
216                 ], [AC_MSG_WARN([Cannot find libcrypto: using stand-alone SHA-1 code instead])])
217         fi
218 fi
219 AM_CONDITIONAL([ENABLE_SSSE3_SHA1], [test "$ENABLE_SSSE3_SHA1" = "yes"])
220
221 # ----------------------------- Other options ---------------------------------
222
223 AC_MSG_CHECKING([whether to include error messages])
224 AC_ARG_ENABLE([error_messages],
225         AS_HELP_STRING([--disable-error-messages], [do not compile in error messsages]),
226         [ENABLE_ERROR_MESSAGES=$enableval],
227         [ENABLE_ERROR_MESSAGES=yes])
228 AC_MSG_RESULT([$ENABLE_ERROR_MESSAGES])
229 if test "$ENABLE_ERROR_MESSAGES" = "yes"; then
230         AC_DEFINE([ENABLE_ERROR_MESSAGES], [1], [Define to 1 if including error messages])
231 fi
232
233 AC_MSG_CHECKING([whether to include assertions])
234 AC_ARG_ENABLE([assertions],
235         AS_HELP_STRING([--disable-assertions], [do not include assertions]),
236         [ENABLE_ASSERTIONS=$enableval],
237         [ENABLE_ASSERTIONS=yes])
238 AC_MSG_RESULT([$ENABLE_ASSERTIONS])
239 if test "$ENABLE_ASSERTIONS" = "yes"; then
240         AC_DEFINE([ENABLE_ASSERTIONS], [1], [Define to 1 if including assertions])
241 fi
242
243 AC_MSG_CHECKING([whether to include support for multi-threaded compression])
244 AC_ARG_ENABLE([multithreaded-compression],
245         AS_HELP_STRING([--disable-multithreaded-compression],
246                        [disable support for multithreaded compression]),
247         [ENABLE_MULTITHREADED_COMPRESSION=$enableval],
248         [ENABLE_MULTITHREADED_COMPRESSION=yes])
249 AC_MSG_RESULT([$ENABLE_MULTITHREADED_COMPRESSION])
250 if test "$ENABLE_MULTITHREADED_COMPRESSION" = "yes"; then
251         AC_DEFINE([ENABLE_MULTITHREADED_COMPRESSION], [1],
252                   [Define to 1 to support multithreaded compression])
253 fi
254
255 AC_ARG_WITH(pkgconfigdir,
256             [  --with-pkgconfigdir=DIR      pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@],
257             [pkgconfigdir=$withval],
258             [pkgconfigdir='${libdir}/pkgconfig'])
259 AC_SUBST(pkgconfigdir)
260
261 AC_MSG_CHECKING([whether to enable supporting code for tests])
262 AC_ARG_ENABLE([test-support],
263               [AS_HELP_STRING([--enable-test-support],
264                               [Enable supporting code for tests (developers only)])],
265               [ENABLE_TEST_SUPPORT=$enableval],
266               [ENABLE_TEST_SUPPORT=no])
267 AC_MSG_RESULT([$ENABLE_TEST_SUPPORT])
268 if test "$ENABLE_TEST_SUPPORT" = "yes" ; then
269         AC_DEFINE([ENABLE_TEST_SUPPORT], [1],
270                   [Define to 1 to enable supporting code for tests])
271 fi
272 AM_CONDITIONAL([ENABLE_TEST_SUPPORT], [test "$ENABLE_TEST_SUPPORT" = "yes"])
273
274 ###############################################################################
275
276 AC_SUBST([PKGCONFIG_PRIVATE_REQUIRES], [$PKGCONFIG_PRIVATE_REQUIRES])
277 AC_SUBST([PKGCONFIG_PRIVATE_LIBS], [$PKGCONFIG_PRIVATE_LIBS])
278 AC_OUTPUT