Packages for Debian, Redhat, and ArchLinux in tree
[wimlib] / configure.ac
1 AC_INIT([wimlib], [0.6.3], [ebiggers3@gmail.com])
2 AC_CONFIG_SRCDIR([src/wim.c])
3 AM_INIT_AUTOMAKE([-Wall -Werror])
4 AC_CONFIG_MACRO_DIR([m4])
5 AC_C_BIGENDIAN
6 AM_PROG_AR
7 LT_INIT
8 AC_CONFIG_HEADERS([config.h])
9 AC_CONFIG_FILES([Makefile 
10                 doc/Makefile 
11                 doc/Doxyfile
12                 src/Makefile 
13                 programs/Makefile
14                 wimlib.pc
15                 doc/imagex.1
16                 doc/imagex-append.1
17                 doc/imagex-apply.1
18                 doc/imagex-capture.1
19                 doc/imagex-delete.1
20                 doc/imagex-dir.1
21                 doc/imagex-export.1
22                 doc/imagex-info.1
23                 doc/imagex-mount.1
24                 doc/imagex-mountrw.1
25                 doc/imagex-unmount.1
26                 doc/mkwinpeimg.1
27                 debian/changelog
28                 rpm/wimlib.spec
29                 archlinux/PKGBUILD
30                 ])
31 AC_PROG_CC
32
33
34 AM_ICONV
35 if test "x$am_cv_func_iconv" != "xyes"; then
36         AC_MSG_ERROR([Cannot find the iconv() function.
37         iconv() is used to convert between UTF-8 and UTF-16 encodings of WIM
38         filenames and XML data.  Wimlib cannot be compiled without it.  iconv()
39         is available in the latest version of glibc and sometimes in other
40         libraries.])
41 fi
42
43 AC_ARG_WITH(pkgconfigdir,
44             [  --with-pkgconfigdir=DIR      pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@],
45             [pkgconfigdir=$withval],
46             [pkgconfigdir='${libdir}/pkgconfig'])
47 AC_SUBST(pkgconfigdir)
48
49 AC_CHECK_LIB([xml2], [xmlParseFile], [have_libxml=true],
50              [AC_MSG_ERROR(["cannot find libxml2"])])
51 LIBXML2_LDADD=`pkg-config libxml-2.0 --libs`
52 LIBXML2_CFLAGS=`pkg-config libxml-2.0 --cflags`
53 AC_SUBST([LIBXML2_LDADD], [$LIBXML2_LDADD])
54 AC_SUBST([LIBXML2_CFLAGS], [$LIBXML2_CFLAGS])
55
56 AC_MSG_CHECKING([whether to include debugging messages])
57 AC_ARG_ENABLE([debug], 
58         AS_HELP_STRING([--enable-debug], [include lots of debugging messages]),
59         [ENABLE_DEBUG=$enableval],
60         [ENABLE_DEBUG=no]
61         )
62 AC_MSG_RESULT([$ENABLE_DEBUG])
63 if test "x$ENABLE_DEBUG" = "xyes"; then
64         AC_DEFINE([ENABLE_DEBUG], [1], 
65                         [Define to 1 if including lots of debug messages.])
66 fi
67
68 AC_MSG_CHECKING([whether to include more debugging messages])
69 AC_ARG_ENABLE([more_debug], 
70         AS_HELP_STRING([--enable-more-debug], 
71                         [include even more debugging messages]),
72         [ENABLE_MORE_DEBUG=$enableval],
73         [ENABLE_MORE_DEBUG=no]
74         )
75 AC_MSG_RESULT([$ENABLE_MORE_DEBUG])
76 if test "x$ENABLE_MORE_DEBUG" = "xyes"; then
77         AC_DEFINE([ENABLE_MORE_DEBUG], [1], 
78                         [Define to 1 if including even more debug messages.])
79 fi
80
81 AC_MSG_CHECKING([whether to include error messages])
82 AC_ARG_ENABLE([error_messages], 
83         AS_HELP_STRING([--disable-error-messages], 
84                         [do not compile in error messsages]),
85         [ENABLE_ERROR_MESSAGES=$enableval],
86         [ENABLE_ERROR_MESSAGES=yes]
87         )
88 AC_MSG_RESULT([$ENABLE_ERROR_MESSAGES])
89 if test "x$ENABLE_ERROR_MESSAGES" = "xyes"; then
90         AC_DEFINE([ENABLE_ERROR_MESSAGES], [1], 
91                         [Define to 1 if including error messages])
92 fi
93
94 AC_MSG_CHECKING([whether to support custom memory allocation functions])
95 AC_ARG_ENABLE([custom_memory_allocator], 
96         AS_HELP_STRING([--disable-custom-memory-allocator], 
97                        [do not support the use of custom memory allocation
98                         functions]),
99         [ENABLE_CUSTOM_MEMORY_ALLOCATOR=$enableval],
100         [ENABLE_CUSTOM_MEMORY_ALLOCATOR=yes]
101         )
102 AC_MSG_RESULT([$ENABLE_CUSTOM_MEMORY_ALLOCATOR])
103 if test "x$ENABLE_CUSTOM_MEMORY_ALLOCATOR" = "xyes"; then
104         AC_DEFINE([ENABLE_CUSTOM_MEMORY_ALLOCATOR], [1], 
105                 [Define to 1 if supporting custom memory allocation functions])
106 fi
107
108 AC_MSG_CHECKING([whether to include assertions])
109 AC_ARG_ENABLE([assertions],
110         AS_HELP_STRING([--disable-assertions], [do not include assertions]),
111         [ENABLE_ASSERTIONS=$enableval],
112         [ENABLE_ASSERTIONS=yes]
113         )
114 AC_MSG_RESULT([$ENABLE_ASSERTIONS])
115 if test "x$ENABLE_ASSERTIONS" = "xyes"; then
116         AC_DEFINE([ENABLE_ASSERTIONS], [1], [Define to 1 if including assertions.])
117 fi
118
119
120 AC_MSG_CHECKING([whether to include compression verification])
121 AC_ARG_ENABLE([verify_compression],
122               AS_HELP_STRING([--disable-verify-compression], [disable
123                                 checking if blocks we compress can be correctly
124                                 decompressed]),
125         [ENABLE_VERIFY_COMPRESSION=$enableval],
126         [ENABLE_VERIFY_COMPRESSION=yes]
127         )
128 AC_MSG_RESULT([$ENABLE_VERIFY_COMPRESSION])
129 if test "x$ENABLE_VERIFY_COMPRESSION" = "xyes"; then
130         AC_DEFINE([ENABLE_VERIFY_COMPRESSION], [1], [Define to 1 to verify
131                    compressed data])
132 fi
133
134 AC_MSG_CHECKING([whether to include support for mounting WIMs])
135 AC_ARG_WITH([fuse],
136                 AS_HELP_STRING([--without-fuse], [build without libfuse.  
137                                         This will disable the ability to mount 
138                                         WIM files.]),
139         [WITH_FUSE=$withval],
140         [WITH_FUSE=yes]
141         )
142 AC_MSG_RESULT([$WITH_FUSE])
143 if test "x$WITH_FUSE" = "xyes"; then
144         AC_DEFINE([WITH_FUSE], [1], [Define to 1 if using FUSE.])
145
146         LIBFUSE_LDADD=`pkg-config --libs fuse`
147         LIBFUSE_CFLAGS=`pkg-config --cflags fuse`
148
149         AC_CHECK_LIB([fuse], [fuse_main_real], [have_fuse=true],
150                         [AC_MSG_ERROR([Cannot find libfuse.  
151         Without libfuse, WIMLIB cannot include support for mounting WIMs.  You
152         should either install libfuse, or configure with --without-fuse to
153         disable support for mounting WIMs.])
154         ])
155         AC_CHECK_LIB([rt], [mq_open], [have_posix_mq=true],
156                      [AC_MSG_ERROR([Cannot find librt for POSIX message queue
157         functions.  Without these functions, WIMLIB cannot include support for
158         mounting WIMs.  You should either update your C library to a recent
159         version of glibc, or configure with --without-fuse to disable support
160         for mounting WIMs.])
161         ])
162 else
163         LIBFUSE_LDADD=
164         LIBFUSE_CFLAGS=
165 fi
166 AC_SUBST([LIBFUSE_LDADD], [$LIBFUSE_LDADD])
167 AC_SUBST([LIBFUSE_CFLAGS], [$LIBFUSE_CFLAGS])
168
169 AC_MSG_CHECKING([whether to use SSSE3-accelerated SHA1 ])
170 AC_ARG_ENABLE([ssse3-sha1],
171             AS_HELP_STRING([--enable-ssse3-sha1], [use assembly language implementation
172                                 of SHA1 from Intel, accelerated with vector
173                                 instructions (SSSE3-enabled CPU required)]),
174         [ENABLE_SSSE3_SHA1=$enableval],
175         [ENABLE_SSSE3_SHA1=no]
176         )
177         
178 AC_MSG_RESULT([$ENABLE_SSSE3_SHA1])
179 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
180         AC_DEFINE([ENABLE_SSSE3_SHA1], [1], 
181                         [Define to 1 if using vectorized implementation of SHA1])
182         SSSE3_SHA1_OBJ=sha1-ssse3.lo
183         AX_PROG_NASM
184         AC_SUBST([NASM], [$nasm])
185 else
186         SSSE3_SHA1_OBJ=
187 fi
188 AC_SUBST([SSSE3_SHA1_OBJ], [$SSSE3_SHA1_OBJ])
189
190 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
191         WITH_LIBCRYPTO=no
192 else
193         AC_ARG_WITH([libcrypto],
194             AS_HELP_STRING([--without-libcrypto], [build in the SHA1 algorithm,
195                                         rather than use external libcrypto from
196                                         OpenSSL (default is autodetect)]),
197         [WITH_LIBCRYPTO=$withval],
198         [AC_CHECK_LIB([crypto], [SHA1], 
199                      [WITH_LIBCRYPTO=yes],
200                      [AC_MSG_WARN([Cannot find libcrypto: using stand-alone SHA1 code instead of OpenSSL])
201                      WITH_LIBCRYPTO=no
202                      ])])
203 fi
204 AC_MSG_CHECKING([whether to use SHA1 function from system libcrypto])
205 AC_MSG_RESULT([$WITH_LIBCRYPTO])
206
207 if test "x$WITH_LIBCRYPTO" = "xyes" -a "x$ENABLE_SSSE3_SHA1" = "xno"; then
208         AC_DEFINE([WITH_LIBCRYPTO], [1], [Define to 1 if using libcrypto SHA1])
209         LIBCRYPTO_LDADD=`pkg-config --libs libcrypto`
210         LIBCRYPTO_CFLAGS=`pkg-config --cflags libcrypto`
211 else
212         LIBCRYPTO_LDADD=
213         LIBCRYPTO_CFLAGS=
214 fi
215 AC_SUBST([LIBCRYPTO_LDADD], [$LIBCRYPTO_LDADD])
216 AC_SUBST([LIBCRYPTO_CFLAGS], [$LIBCRYPTO_CFLAGS])
217 AC_SUBST([SHA1_SOURCES], [$SHA1_SOURCES])
218
219 AC_OUTPUT