]>
Commit | Line | Data |
---|---|---|
b3cfa26b TK |
1 | dnl Process this file with autoconf to produce a configure script. |
2 | ||
3 | dnl First, define all of the version numbers up front. | |
4 | dnl In particular, this allows the version macro to be used in AC_INIT | |
5 | ||
6 | dnl These first two version numbers are updated automatically on each release. | |
b3be94ba MM |
7 | m4_define([LIBARCHIVE_VERSION_S],[3.7.4dev]) |
8 | m4_define([LIBARCHIVE_VERSION_N],[3007004]) | |
b3cfa26b | 9 | |
80bdb4b4 | 10 | dnl bsdtar and bsdcpio versioning tracks libarchive |
b3cfa26b | 11 | m4_define([BSDTAR_VERSION_S],LIBARCHIVE_VERSION_S()) |
80bdb4b4 | 12 | m4_define([BSDCPIO_VERSION_S],LIBARCHIVE_VERSION_S()) |
5d3f56d2 | 13 | m4_define([BSDCAT_VERSION_S],LIBARCHIVE_VERSION_S()) |
a8578c0b | 14 | m4_define([BSDUNZIP_VERSION_S],LIBARCHIVE_VERSION_S()) |
b3cfa26b | 15 | |
013aef12 | 16 | AC_PREREQ([2.71]) |
77cfbb98 | 17 | |
b3cfa26b TK |
18 | # |
19 | # Now starts the "real" configure script. | |
20 | # | |
21 | ||
a580c98e | 22 | AC_INIT([libarchive],[LIBARCHIVE_VERSION_S()],[libarchive-discuss@googlegroups.com]) |
b3cfa26b TK |
23 | # Make sure the srcdir contains "libarchive" directory |
24 | AC_CONFIG_SRCDIR([libarchive]) | |
25 | # Use auxiliary subscripts from this subdirectory (cleans up root) | |
4c9c2bcd | 26 | AC_CONFIG_AUX_DIR([build/autoconf]) |
79cb8e5b | 27 | # M4 scripts |
80b5f20f | 28 | AC_CONFIG_MACRO_DIR([build/autoconf]) |
b3cfa26b | 29 | # Must follow AC_CONFIG macros above... |
dc064872 | 30 | AM_INIT_AUTOMAKE([1.11 dist-xz dist-zip]) |
3bf4a20e | 31 | AM_MAINTAINER_MODE([enable]) |
fcfe9113 | 32 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
b3cfa26b | 33 | |
f2488cf6 TK |
34 | # Libtool's "interface version" can be computed from the libarchive version. |
35 | ||
36 | # Libtool interface version bumps on any API change, so increments | |
37 | # whenever libarchive minor version does. | |
b3cfa26b | 38 | ARCHIVE_MINOR=$(( (LIBARCHIVE_VERSION_N() / 1000) % 1000 )) |
f2488cf6 TK |
39 | # Libarchive 2.7 == libtool interface 9 = 2 + 7 |
40 | # Libarchive 2.8 == libtool interface 10 = 2 + 8 | |
7eeddea4 TK |
41 | # Libarchive 2.9 == libtool interface 11 = 2 + 8 |
42 | # Libarchive 3.0 == libtool interface 12 | |
bdf2c171 AM |
43 | # Libarchive 3.1 == libtool interface 13 |
44 | ARCHIVE_INTERFACE=`echo $((13 + ${ARCHIVE_MINOR}))` | |
f2488cf6 | 45 | # Libarchive revision is bumped on any source change === libtool revision |
b3cfa26b | 46 | ARCHIVE_REVISION=$(( LIBARCHIVE_VERSION_N() % 1000 )) |
f2488cf6 | 47 | # Libarchive minor is bumped on any interface addition === libtool age |
7f6d230a | 48 | ARCHIVE_LIBTOOL_VERSION=$ARCHIVE_INTERFACE:$ARCHIVE_REVISION:$ARCHIVE_MINOR |
b3cfa26b TK |
49 | |
50 | # Stick the version numbers into config.h | |
0d8b61ea AR |
51 | AC_DEFINE([__LIBARCHIVE_CONFIG_H_INCLUDED], [1], |
52 | [Internal macro for sanity checks]) | |
b3cfa26b TK |
53 | AC_DEFINE([LIBARCHIVE_VERSION_STRING],"LIBARCHIVE_VERSION_S()", |
54 | [Version number of libarchive]) | |
55 | AC_DEFINE_UNQUOTED([LIBARCHIVE_VERSION_NUMBER],"LIBARCHIVE_VERSION_N()", | |
56 | [Version number of libarchive as a single integer]) | |
57 | AC_DEFINE([BSDCPIO_VERSION_STRING],"BSDCPIO_VERSION_S()", | |
58 | [Version number of bsdcpio]) | |
59 | AC_DEFINE([BSDTAR_VERSION_STRING],"BSDTAR_VERSION_S()", | |
60 | [Version number of bsdtar]) | |
5d3f56d2 MK |
61 | AC_DEFINE([BSDCAT_VERSION_STRING],"BSDTAR_VERSION_S()", |
62 | [Version number of bsdcat]) | |
a8578c0b MM |
63 | AC_DEFINE([BSDUNZIP_VERSION_STRING],"BSDUNZIP_VERSION_S()", |
64 | [Version number of bsdunzip]) | |
b3cfa26b TK |
65 | |
66 | # The shell variables here must be the same as the AC_SUBST() variables | |
67 | # below, but the shell variable names apparently cannot be the same as | |
68 | # the m4 macro names above. Why? Ask autoconf. | |
69 | BSDCPIO_VERSION_STRING=BSDCPIO_VERSION_S() | |
70 | BSDTAR_VERSION_STRING=BSDTAR_VERSION_S() | |
5d3f56d2 | 71 | BSDCAT_VERSION_STRING=BSDCAT_VERSION_S() |
a8578c0b | 72 | BSDUNZIP_VERSION_STRING=BSDUNZIP_VERSION_S() |
b3cfa26b TK |
73 | LIBARCHIVE_VERSION_STRING=LIBARCHIVE_VERSION_S() |
74 | LIBARCHIVE_VERSION_NUMBER=LIBARCHIVE_VERSION_N() | |
75 | ||
76 | # Substitute the above version numbers into the various files below. | |
77 | # Yes, I believe this is the fourth time we define what are essentially | |
78 | # the same symbols. Why? Ask autoconf. | |
79 | AC_SUBST(ARCHIVE_LIBTOOL_VERSION) | |
80 | AC_SUBST(BSDCPIO_VERSION_STRING) | |
81 | AC_SUBST(BSDTAR_VERSION_STRING) | |
5d3f56d2 | 82 | AC_SUBST(BSDCAT_VERSION_STRING) |
a8578c0b | 83 | AC_SUBST(BSDUNZIP_VERSION_STRING) |
b3cfa26b TK |
84 | AC_SUBST(LIBARCHIVE_VERSION_STRING) |
85 | AC_SUBST(LIBARCHIVE_VERSION_NUMBER) | |
86 | ||
87 | AC_CONFIG_HEADERS([config.h]) | |
88 | AC_CONFIG_FILES([Makefile]) | |
bafc3c6b | 89 | AC_CONFIG_FILES([build/pkgconfig/libarchive.pc]) |
b3cfa26b | 90 | |
79cb8e5b CW |
91 | # Check for host type |
92 | AC_CANONICAL_HOST | |
93 | ||
94 | dnl Compilation on mingw and Cygwin needs special Makefile rules | |
95 | inc_windows_files=no | |
96 | inc_cygwin_files=no | |
97 | case "$host_os" in | |
98 | *mingw* ) inc_windows_files=yes ;; | |
1e2b6c98 | 99 | *cygwin* | *msys*) inc_cygwin_files=yes ;; |
79cb8e5b CW |
100 | esac |
101 | AM_CONDITIONAL([INC_WINDOWS_FILES], [test $inc_windows_files = yes]) | |
102 | AM_CONDITIONAL([INC_CYGWIN_FILES], [test $inc_cygwin_files = yes]) | |
103 | ||
c31d1bc4 CW |
104 | dnl Defines that are required for specific platforms (e.g. -D_POSIX_SOURCE, etc) |
105 | PLATFORMCPPFLAGS= | |
106 | case "$host_os" in | |
0348e24b | 107 | *mingw* ) PLATFORMCPPFLAGS=-D__USE_MINGW_ANSI_STDIO -D__MINGW_USE_VC2005_COMPAT ;; |
c31d1bc4 CW |
108 | esac |
109 | AC_SUBST(PLATFORMCPPFLAGS) | |
110 | ||
b3cfa26b TK |
111 | # Checks for programs. |
112 | AC_PROG_CC | |
113 | AM_PROG_CC_C_O | |
b4c5bf51 | 114 | AC_PROG_CPP |
6ca9835b | 115 | AC_USE_SYSTEM_EXTENSIONS |
01a4df54 | 116 | AC_LIBTOOL_WIN32_DLL |
b3cfa26b TK |
117 | AC_PROG_LIBTOOL |
118 | AC_CHECK_TOOL([STRIP],[strip]) | |
1c6adda3 | 119 | AC_PROG_MKDIR_P |
b3cfa26b TK |
120 | |
121 | # | |
122 | # Options for building bsdtar. | |
123 | # | |
124 | # Default is to build bsdtar, but allow people to override that. | |
125 | # | |
126 | AC_ARG_ENABLE([bsdtar], | |
127 | [AS_HELP_STRING([--enable-bsdtar], [enable build of bsdtar (default)]) | |
128 | AS_HELP_STRING([--enable-bsdtar=static], [force static build of bsdtar]) | |
129 | AS_HELP_STRING([--enable-bsdtar=shared], [force dynamic build of bsdtar]) | |
130 | AS_HELP_STRING([--disable-bsdtar], [disable build of bsdtar])], | |
131 | [], [enable_bsdtar=yes]) | |
132 | ||
133 | case "$enable_bsdtar" in | |
134 | yes) | |
135 | if test "$enable_static" = "no"; then | |
136 | static_bsdtar=no | |
137 | else | |
138 | static_bsdtar=yes | |
139 | fi | |
140 | build_bsdtar=yes | |
141 | ;; | |
142 | dynamic|shared) | |
143 | if test "$enable_shared" = "no"; then | |
144 | AC_MSG_FAILURE([Shared linking of bsdtar requires shared libarchive]) | |
145 | fi | |
146 | build_bsdtar=yes | |
147 | static_bsdtar=no | |
148 | ;; | |
149 | static) | |
150 | build_bsdtar=yes | |
151 | static_bsdtar=yes | |
152 | ;; | |
153 | no) | |
154 | build_bsdtar=no | |
155 | static_bsdtar=no | |
156 | ;; | |
157 | *) | |
158 | AC_MSG_FAILURE([Unsupported value for --enable-bsdtar]) | |
159 | ;; | |
160 | esac | |
161 | ||
162 | AM_CONDITIONAL([BUILD_BSDTAR], [ test "$build_bsdtar" = yes ]) | |
163 | AM_CONDITIONAL([STATIC_BSDTAR], [ test "$static_bsdtar" = yes ]) | |
164 | ||
5d3f56d2 MK |
165 | # |
166 | # Options for building bsdcat. | |
167 | # | |
168 | # Default is to build bsdcat, but allow people to override that. | |
169 | # | |
170 | AC_ARG_ENABLE([bsdcat], | |
171 | [AS_HELP_STRING([--enable-bsdcat], [enable build of bsdcat (default)]) | |
172 | AS_HELP_STRING([--enable-bsdcat=static], [force static build of bsdcat]) | |
173 | AS_HELP_STRING([--enable-bsdcat=shared], [force dynamic build of bsdcat]) | |
174 | AS_HELP_STRING([--disable-bsdcat], [disable build of bsdcat])], | |
175 | [], [enable_bsdcat=yes]) | |
176 | ||
177 | case "$enable_bsdcat" in | |
178 | yes) | |
179 | if test "$enable_static" = "no"; then | |
180 | static_bsdcat=no | |
181 | else | |
182 | static_bsdcat=yes | |
183 | fi | |
184 | build_bsdcat=yes | |
185 | ;; | |
186 | dynamic|shared) | |
187 | if test "$enable_shared" = "no"; then | |
188 | AC_MSG_FAILURE([Shared linking of bsdcat requires shared libarchive]) | |
189 | fi | |
190 | build_bsdcat=yes | |
191 | static_bsdcat=no | |
192 | ;; | |
193 | static) | |
194 | build_bsdcat=yes | |
195 | static_bsdcat=yes | |
196 | ;; | |
197 | no) | |
198 | build_bsdcat=no | |
199 | static_bsdcat=no | |
200 | ;; | |
201 | *) | |
202 | AC_MSG_FAILURE([Unsupported value for --enable-bsdcat]) | |
203 | ;; | |
204 | esac | |
205 | ||
206 | AM_CONDITIONAL([BUILD_BSDCAT], [ test "$build_bsdcat" = yes ]) | |
207 | AM_CONDITIONAL([STATIC_BSDCAT], [ test "$static_bsdcat" = yes ]) | |
208 | ||
b3cfa26b TK |
209 | # |
210 | # Options for building bsdcpio. | |
211 | # | |
212 | # Default is not to build bsdcpio, but that can be overridden. | |
213 | # | |
214 | AC_ARG_ENABLE([bsdcpio], | |
f9a97a03 | 215 | [AS_HELP_STRING([--enable-bsdcpio], [enable build of bsdcpio (default)]) |
b3cfa26b TK |
216 | AS_HELP_STRING([--enable-bsdcpio=static], [static build of bsdcpio]) |
217 | AS_HELP_STRING([--enable-bsdcpio=shared], [dynamic build of bsdcpio]) | |
f9a97a03 TK |
218 | AS_HELP_STRING([--disable-bsdcpio], [disable build of bsdcpio])], |
219 | [], [enable_bsdcpio=yes]) | |
b3cfa26b TK |
220 | |
221 | case "$enable_bsdcpio" in | |
222 | yes) | |
223 | if test "$enable_static" = "no"; then | |
224 | static_bsdcpio=no | |
225 | else | |
226 | static_bsdcpio=yes | |
227 | fi | |
228 | build_bsdcpio=yes | |
229 | ;; | |
230 | dynamic|shared) | |
231 | if test "$enabled_shared" = "no"; then | |
232 | AC_MSG_FAILURE([Shared linking of bsdcpio requires shared libarchive]) | |
233 | fi | |
234 | build_bsdcpio=yes | |
235 | ;; | |
236 | static) | |
237 | build_bsdcpio=yes | |
238 | static_bsdcpio=yes | |
239 | ;; | |
240 | no) | |
241 | build_bsdcpio=no | |
242 | static_bsdcpio=no | |
243 | ;; | |
244 | *) | |
245 | AC_MSG_FAILURE([Unsupported value for --enable-bsdcpio]) | |
246 | ;; | |
247 | esac | |
248 | ||
249 | AM_CONDITIONAL([BUILD_BSDCPIO], [ test "$build_bsdcpio" = yes ]) | |
250 | AM_CONDITIONAL([STATIC_BSDCPIO], [ test "$static_bsdcpio" = yes ]) | |
251 | ||
197cc2d1 CW |
252 | # Set up defines needed before including any headers |
253 | case $host in | |
1e2b6c98 | 254 | *mingw* | *cygwin* | *msys* ) |
1fd0c015 SL |
255 | AC_PREPROC_IFELSE([AC_LANG_PROGRAM( |
256 | [[#ifdef _WIN32_WINNT | |
257 | # error _WIN32_WINNT already defined | |
258 | #endif | |
259 | ]],[[;]]) | |
260 | ],[ | |
261 | AC_DEFINE([_WIN32_WINNT], 0x0502, [Define to '0x0502' for Windows Server 2003 APIs.]) | |
262 | AC_DEFINE([NTDDI_VERSION], 0x05020000, [Define to '0x05020000' for Windows Server 2003 APIs.]) | |
263 | ]) | |
264 | AC_PREPROC_IFELSE([AC_LANG_PROGRAM( | |
265 | [[#ifdef WINVER | |
266 | # error WINVER already defined | |
267 | #endif | |
268 | ]],[[;]]) | |
269 | ],[ | |
270 | AC_DEFINE([WINVER], 0x0502, [Define to '0x0502' for Windows Server 2003 APIs.]) | |
271 | ]) | |
197cc2d1 CW |
272 | ;; |
273 | esac | |
274 | ||
c157e4ce AV |
275 | # |
276 | # Options for building bsdunzip. | |
277 | # | |
278 | # Default is to build bsdunzip, but allow people to override that. | |
386412e2 | 279 | # Bsdunzip has not yet been ported for Windows |
c157e4ce | 280 | # |
386412e2 MM |
281 | case "$host_os" in |
282 | *mingw* | *msys*) | |
283 | enable_bsdunzip=no | |
284 | ;; | |
285 | *) | |
286 | AC_ARG_ENABLE([bsdunzip], | |
287 | [AS_HELP_STRING([--enable-bsdunzip], [enable build of bsdunzip (default)]) | |
288 | AS_HELP_STRING([--enable-bsdunzip=static], [force static build of bsdunzip]) | |
289 | AS_HELP_STRING([--enable-bsdunzip=shared], [force dynamic build of bsdunzip]) | |
290 | AS_HELP_STRING([--disable-bsdunzip], [disable build of bsdunzip])], | |
291 | [], [enable_bsdunzip=yes]) | |
292 | ;; | |
293 | esac | |
c157e4ce AV |
294 | |
295 | case "$enable_bsdunzip" in | |
296 | yes) | |
297 | if test "$enable_static" = "no"; then | |
298 | static_bsdunzip=no | |
299 | else | |
300 | static_bsdunzip=yes | |
301 | fi | |
302 | build_bsdunzip=yes | |
303 | ;; | |
304 | dynamic|shared) | |
305 | if test "$enable_shared" = "no"; then | |
306 | AC_MSG_FAILURE([Shared linking of bsdunzip requires shared libarchive]) | |
307 | fi | |
308 | build_bsdunzip=yes | |
309 | static_bsdunzip=no | |
310 | ;; | |
311 | static) | |
312 | build_bsdunzip=yes | |
313 | static_bsdunzip=yes | |
314 | ;; | |
315 | no) | |
316 | build_bsdunzip=no | |
317 | static_bsdunzip=no | |
318 | ;; | |
319 | *) | |
320 | AC_MSG_FAILURE([Unsupported value for --enable-bsdunzip]) | |
321 | ;; | |
322 | esac | |
323 | ||
324 | AM_CONDITIONAL([BUILD_BSDUNZIP], [ test "$build_bsdunzip" = yes ]) | |
325 | AM_CONDITIONAL([STATIC_BSDUNZIP], [ test "$static_bsdunzip" = yes ]) | |
326 | ||
b3cfa26b | 327 | # Checks for header files. |
b3cfa26b TK |
328 | AC_HEADER_DIRENT |
329 | AC_HEADER_SYS_WAIT | |
365a91de | 330 | AC_CHECK_HEADERS([acl/libacl.h attr/xattr.h]) |
b30c530a | 331 | AC_CHECK_HEADERS([copyfile.h ctype.h]) |
27ca5119 | 332 | AC_CHECK_HEADERS([errno.h ext2fs/ext2_fs.h fcntl.h fnmatch.h grp.h]) |
95c74682 JS |
333 | |
334 | AC_CACHE_CHECK([whether EXT2_IOC_GETFLAGS is usable], | |
335 | [ac_cv_have_decl_EXT2_IOC_GETFLAGS], | |
336 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([@%:@include <sys/ioctl.h> | |
337 | @%:@include <ext2fs/ext2_fs.h>], | |
338 | [int x = EXT2_IOC_GETFLAGS])], | |
339 | [AS_VAR_SET([ac_cv_have_decl_EXT2_IOC_GETFLAGS], [yes])], | |
340 | [AS_VAR_SET([ac_cv_have_decl_EXT2_IOC_GETFLAGS], [no])])]) | |
341 | ||
342 | AS_VAR_IF([ac_cv_have_decl_EXT2_IOC_GETFLAGS], [yes], | |
343 | [AC_DEFINE_UNQUOTED([HAVE_WORKING_EXT2_IOC_GETFLAGS], [1], | |
344 | [Define to 1 if you have a working EXT2_IOC_GETFLAGS])]) | |
345 | ||
d216d028 | 346 | AC_CHECK_HEADERS([inttypes.h io.h langinfo.h limits.h]) |
407f6e94 | 347 | AC_CHECK_HEADERS([linux/fiemap.h linux/fs.h linux/magic.h linux/types.h]) |
a9c5818b MM |
348 | |
349 | AC_CACHE_CHECK([whether FS_IOC_GETFLAGS is usable], | |
350 | [ac_cv_have_decl_FS_IOC_GETFLAGS], | |
351 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([@%:@include <sys/ioctl.h> | |
352 | @%:@include <linux/fs.h>], | |
353 | [int x = FS_IOC_GETFLAGS])], | |
354 | [AS_VAR_SET([ac_cv_have_decl_FS_IOC_GETFLAGS], [yes])], | |
355 | [AS_VAR_SET([ac_cv_have_decl_FS_IOC_GETFLAGS], [no])])]) | |
356 | ||
357 | AS_VAR_IF([ac_cv_have_decl_FS_IOC_GETFLAGS], [yes], | |
358 | [AC_DEFINE_UNQUOTED([HAVE_WORKING_FS_IOC_GETFLAGS], [1], | |
359 | [Define to 1 if you have a working FS_IOC_GETFLAGS])]) | |
360 | ||
f57d129d | 361 | AC_CHECK_HEADERS([locale.h membership.h paths.h poll.h pthread.h pwd.h]) |
9769e6f7 | 362 | AC_CHECK_HEADERS([readpassphrase.h signal.h spawn.h]) |
8c1c0a7a | 363 | AC_CHECK_HEADERS([stdarg.h stdint.h stdlib.h string.h]) |
365a91de | 364 | AC_CHECK_HEADERS([sys/acl.h sys/cdefs.h sys/ea.h sys/extattr.h]) |
386412e2 | 365 | AC_CHECK_HEADERS([sys/ioctl.h sys/mkdev.h sys/mount.h sys/queue.h]) |
bea9f9cf | 366 | AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/richacl.h]) |
4925fd0b | 367 | AC_CHECK_HEADERS([sys/select.h sys/statfs.h sys/statvfs.h sys/sysmacros.h]) |
365a91de | 368 | AC_CHECK_HEADERS([sys/time.h sys/utime.h sys/utsname.h sys/vfs.h sys/xattr.h]) |
996334f3 | 369 | AC_CHECK_HEADERS([time.h unistd.h utime.h wchar.h wctype.h]) |
d7ae3cca TK |
370 | AC_CHECK_HEADERS([windows.h]) |
371 | # check windows.h first; the other headers require it. | |
372 | AC_CHECK_HEADERS([wincrypt.h winioctl.h],[],[], | |
373 | [[#ifdef HAVE_WINDOWS_H | |
374 | # include <windows.h> | |
375 | #endif | |
376 | ]]) | |
b3cfa26b TK |
377 | |
378 | # Checks for libraries. | |
2186dc24 TK |
379 | AC_ARG_WITH([zlib], |
380 | AS_HELP_STRING([--without-zlib], [Don't build support for gzip through zlib])) | |
381 | ||
382 | if test "x$with_zlib" != "xno"; then | |
383 | AC_CHECK_HEADERS([zlib.h]) | |
384 | AC_CHECK_LIB(z,inflate) | |
385 | fi | |
386 | ||
387 | AC_ARG_WITH([bz2lib], | |
388 | AS_HELP_STRING([--without-bz2lib], [Don't build support for bzip2 through bz2lib])) | |
389 | ||
390 | if test "x$with_bz2lib" != "xno"; then | |
391 | AC_CHECK_HEADERS([bzlib.h]) | |
1a0f8974 | 392 | case "$host_os" in |
1e2b6c98 | 393 | *mingw* | *cygwin* | *msys*) |
1a0f8974 AM |
394 | dnl AC_CHECK_LIB cannot be used on the Windows port of libbz2, therefore |
395 | dnl use AC_LINK_IFELSE. | |
396 | AC_MSG_CHECKING([for BZ2_bzDecompressInit in -lbz2]) | |
397 | old_LIBS="$LIBS" | |
398 | LIBS="-lbz2 $LIBS" | |
399 | AC_LINK_IFELSE( | |
400 | [AC_LANG_SOURCE(#include <bzlib.h> | |
401 | int main() { return BZ2_bzDecompressInit(NULL, 0, 0); })], | |
402 | [ac_cv_lib_bz2_BZ2_bzDecompressInit=yes], | |
403 | [ac_cv_lib_bz2_BZ2_bzDecompressInit=no]) | |
404 | LIBS="$old_LIBS" | |
405 | AC_MSG_RESULT($ac_cv_lib_bz2_BZ2_bzDecompressInit) | |
406 | if test "x$ac_cv_lib_bz2_BZ2_bzDecompressInit" = xyes; then | |
407 | AC_DEFINE([HAVE_LIBBZ2], [1], [Define to 1 if you have the `bz2' library (-lbz2).]) | |
408 | LIBS="-lbz2 $LIBS" | |
409 | fi | |
410 | ;; | |
411 | *) | |
412 | AC_CHECK_LIB(bz2,BZ2_bzDecompressInit) | |
413 | ;; | |
414 | esac | |
2186dc24 TK |
415 | fi |
416 | ||
c5013112 MM |
417 | AC_ARG_WITH([libb2], |
418 | AS_HELP_STRING([--without-libb2], [Don't build support for BLAKE2 through libb2])) | |
419 | ||
420 | if test "x$with_libb2" != "xno"; then | |
421 | AC_CHECK_HEADERS([blake2.h]) | |
422 | AC_CHECK_LIB(b2,blake2sp_init) | |
423 | fi | |
424 | ||
425 | AM_CONDITIONAL([INC_BLAKE2], [test "x$ac_cv_lib_b2_blake2sp_init" != "xyes"]) | |
426 | ||
c91b3538 TK |
427 | AC_ARG_WITH([iconv], |
428 | AS_HELP_STRING([--without-iconv], [Don't try to link against iconv])) | |
429 | ||
430 | if test "x$with_iconv" != "xno"; then | |
d975ebec | 431 | AM_ICONV |
1354b7df | 432 | AC_CHECK_HEADERS([iconv.h],[],[],[#include <stdlib.h>]) |
17fd872a | 433 | if test "x$am_cv_func_iconv" = "xyes"; then |
89032bfd MN |
434 | AC_CHECK_HEADERS([localcharset.h]) |
435 | am_save_LIBS="$LIBS" | |
436 | LIBS="${LIBS} ${LIBICONV}" | |
1f35c466 PP |
437 | if test -n "$LIBICONV"; then |
438 | LIBSREQUIRED="$LIBSREQUIRED${LIBSREQUIRED:+ }iconv" | |
439 | fi | |
89032bfd MN |
440 | AC_CHECK_FUNCS([locale_charset]) |
441 | LIBS="${am_save_LIBS}" | |
442 | if test "x$ac_cv_func_locale_charset" != "xyes"; then | |
057c8b91 | 443 | # If locale_charset() is not in libiconv, we have to find libcharset. |
89032bfd MN |
444 | AC_CHECK_LIB(charset,locale_charset) |
445 | fi | |
446 | fi | |
c91b3538 TK |
447 | fi |
448 | ||
724f3f91 MN |
449 | AC_ARG_WITH([lz4], |
450 | AS_HELP_STRING([--without-lz4], [Don't build support for lz4 through liblz4])) | |
451 | ||
452 | if test "x$with_lz4" != "xno"; then | |
453 | AC_CHECK_HEADERS([lz4.h lz4hc.h]) | |
454 | AC_CHECK_LIB(lz4,LZ4_decompress_safe) | |
455 | fi | |
456 | ||
26838cf5 SP |
457 | AC_ARG_WITH([zstd], |
458 | AS_HELP_STRING([--without-zstd], [Don't build support for zstd through libzstd])) | |
459 | ||
460 | if test "x$with_zstd" != "xno"; then | |
461 | AC_CHECK_HEADERS([zstd.h]) | |
406165fc PM |
462 | AC_CHECK_LIB(zstd,ZSTD_decompressStream) |
463 | AC_CHECK_LIB(zstd,ZSTD_compressStream, | |
771f434c | 464 | AC_DEFINE([HAVE_ZSTD_compressStream], [1], [Define to 1 if you have the `zstd' library (-lzstd) with compression support.])) |
26838cf5 SP |
465 | fi |
466 | ||
c25e0da2 MN |
467 | AC_ARG_WITH([lzma], |
468 | AS_HELP_STRING([--without-lzma], [Don't build support for xz through lzma])) | |
469 | ||
470 | if test "x$with_lzma" != "xno"; then | |
471 | AC_CHECK_HEADERS([lzma.h]) | |
472 | AC_CHECK_LIB(lzma,lzma_stream_decoder) | |
b05a2733 TK |
473 | # Some pre-release (but widely distributed) versions of liblzma |
474 | # included a disabled version of lzma_stream_encoder_mt that | |
475 | # fools a naive AC_CHECK_LIB or AC_CHECK_FUNC, so we need | |
476 | # to do something more complex here: | |
477 | AC_CACHE_CHECK( | |
478 | [whether we have multithread support in lzma], | |
479 | ac_cv_lzma_has_mt, | |
7c3148ec JS |
480 | [AC_LINK_IFELSE([ |
481 | AC_LANG_PROGRAM([[#include <lzma.h>] | |
482 | [#if LZMA_VERSION < 50020000] | |
483 | [#error unsupported] | |
484 | [#endif]], | |
2ba3d927 | 485 | [[int ignored __attribute__((unused)); ignored = lzma_stream_encoder_mt(0, 0);]])], |
b05a2733 | 486 | [ac_cv_lzma_has_mt=yes], [ac_cv_lzma_has_mt=no])]) |
9690ea4f JR |
487 | if test "x$ac_cv_lzma_has_mt" != xno; then |
488 | AC_DEFINE([HAVE_LZMA_STREAM_ENCODER_MT], [1], [Define to 1 if you have the `lzma_stream_encoder_mt' function.]) | |
489 | fi | |
eb2b5ad6 MBM |
490 | |
491 | AC_CACHE_CHECK( | |
492 | [whether we have ARM64 filter support in lzma], | |
493 | ac_cv_lzma_has_arm64, | |
494 | [AC_LINK_IFELSE([ | |
495 | AC_LANG_PROGRAM([[#include <lzma.h>] | |
496 | [#ifndef LZMA_FILTER_ARM64] | |
497 | [#error unsupported] | |
498 | [#endif]])], | |
499 | [ac_cv_lzma_has_arm64=yes], [ac_cv_lzma_has_arm64=no])]) | |
500 | if test "x$ac_cv_lzma_has_arm64" != xno; then | |
501 | AC_DEFINE([HAVE_LZMA_FILTER_ARM64], [1], [Define to 1 if you have the `LZMA_FILTER_ARM64' macro.]) | |
502 | fi | |
c25e0da2 MN |
503 | fi |
504 | ||
6b29a1cc | 505 | AC_ARG_WITH([lzo2], |
6a509898 | 506 | AS_HELP_STRING([--with-lzo2], [Build with LZO support from liblzo2])) |
6b29a1cc | 507 | |
525f55c9 | 508 | if test "x$with_lzo2" = "xyes"; then |
6b29a1cc MN |
509 | AC_CHECK_HEADERS([lzo/lzoconf.h lzo/lzo1x.h]) |
510 | AC_CHECK_LIB(lzo2,lzo1x_decompress_safe) | |
511 | fi | |
512 | ||
0869c13c PM |
513 | AC_ARG_WITH([cng], |
514 | AS_HELP_STRING([--without-cng], [Don't build support of CNG(Crypto Next Generation)])) | |
515 | ||
f96a7114 MM |
516 | AC_ARG_WITH([mbedtls], |
517 | AS_HELP_STRING([--with-mbedtls], [Build with crypto support from mbed TLS])) | |
00ac9023 | 518 | AC_ARG_WITH([nettle], |
f96a7114 | 519 | AS_HELP_STRING([--with-nettle], [Build with crypto support from Nettle])) |
eace4421 | 520 | AC_ARG_WITH([openssl], |
d2c0930d | 521 | AS_HELP_STRING([--without-openssl], [Don't build support for mtree and xar hashes through openssl])) |
b0f3a5e1 TK |
522 | case "$host_os" in |
523 | *darwin* ) with_openssl=no ;; | |
524 | esac | |
d2c0930d MN |
525 | |
526 | AC_ARG_WITH([xml2], | |
527 | AS_HELP_STRING([--without-xml2], [Don't build support for xar through libxml2])) | |
528 | AC_ARG_WITH([expat], | |
529 | AS_HELP_STRING([--without-expat], [Don't build support for xar through expat])) | |
530 | ||
531 | if test "x$with_xml2" != "xno"; then | |
f7b0a9f3 KM |
532 | PKG_PROG_PKG_CONFIG |
533 | PKG_CHECK_MODULES(LIBXML2_PC, [libxml-2.0], [ | |
534 | CPPFLAGS="${CPPFLAGS} ${LIBXML2_PC_CFLAGS}" | |
535 | LIBS="${LIBS} ${LIBXML2_PC_LIBS}" | |
5256aa1a | 536 | AC_CHECK_LIB(xml2,xmlInitParser,[true],AC_MSG_FAILURE(Missing xml2 library)) |
f7b0a9f3 | 537 | ], [ |
5256aa1a | 538 | AC_CHECK_LIB(xml2,xmlInitParser) |
f7b0a9f3 | 539 | ]) |
b7115a7d | 540 | AC_CHECK_HEADERS([libxml/xmlreader.h libxml/xmlwriter.h]) |
d2c0930d MN |
541 | fi |
542 | if test "x$ac_cv_header_libxml_xmlreader_h" != "xyes"; then | |
543 | if test "x$with_expat" != "xno"; then | |
aa5b327f MN |
544 | AC_CHECK_HEADERS([expat.h]) |
545 | AC_CHECK_LIB(expat,XML_ParserCreate) | |
d2c0930d MN |
546 | fi |
547 | fi | |
eace4421 | 548 | |
9fe06744 AM |
549 | AC_ARG_ENABLE([posix-regex-lib], |
550 | [AS_HELP_STRING([--enable-posix-regex-lib], | |
551 | [choose what library to use for POSIX regular expression support (default: auto)]) | |
552 | AS_HELP_STRING([--enable-posix-regex-lib=libc], [use libc POSIX regular expression support]) | |
553 | AS_HELP_STRING([--enable-posix-regex-lib=libregex], [use libregex POSIX regular expression support]) | |
554 | AS_HELP_STRING([--enable-posix-regex-lib=libpcreposix], [use libpcreposix POSIX regular expression support]) | |
d1231a7e | 555 | AS_HELP_STRING([--enable-posix-regex-lib=libpcre2posix], [use libpcre2-posix POSIX regular expression support]) |
9fe06744 AM |
556 | AS_HELP_STRING([--disable-posix-regex-lib], [don't enable POSIX regular expression support])], |
557 | [], [enable_posix_regex_lib=auto]) | |
558 | ||
559 | posix_regex_lib_found= | |
560 | if test "$enable_posix_regex_lib" = "auto" || test "$enable_posix_regex_lib" = "libc" || test "$enable_posix_regex_lib" = "libregex"; then | |
561 | AC_CHECK_HEADERS([regex.h]) | |
c9b68f41 | 562 | if test "x$ac_cv_header_regex_h" != "xno"; then |
9797fb4e AM |
563 | AC_CHECK_FUNC(regcomp) |
564 | if test "x$ac_cv_func_regcomp" = xyes; then | |
565 | posix_regex_lib_found=1 | |
566 | else | |
567 | AC_CHECK_LIB(regex,regcomp) | |
568 | if test "x$ac_cv_lib_regex_regcomp" = xyes; then | |
569 | posix_regex_lib_found=1 | |
570 | fi | |
571 | fi | |
c9b68f41 MN |
572 | fi |
573 | fi | |
9fe06744 AM |
574 | if test -z $posix_regex_lib_found && (test "$enable_posix_regex_lib" = "auto" || test "$enable_posix_regex_lib" = "libpcreposix"); then |
575 | AC_CHECK_HEADERS([pcreposix.h]) | |
9797fb4e | 576 | AC_CHECK_LIB(pcreposix,regcomp) |
d16c4871 AM |
577 | if test "x$ac_cv_lib_pcreposix_regcomp" != xyes; then |
578 | AC_MSG_NOTICE(trying libpcreposix check again with libpcre) | |
579 | unset ac_cv_lib_pcreposix_regcomp | |
580 | AC_CHECK_LIB(pcre,pcre_exec) | |
581 | AC_CHECK_LIB(pcreposix,regcomp) | |
582 | if test "x$ac_cv_lib_pcre_pcre_exec" = xyes && test "x$ac_cv_lib_pcreposix_regcomp" = xyes; then | |
583 | AC_MSG_CHECKING(if PCRE_STATIC needs to be defined) | |
584 | AC_LINK_IFELSE( | |
585 | [AC_LANG_SOURCE(#include <pcreposix.h> | |
586 | int main() { return regcomp(NULL, NULL, 0); })], | |
587 | [without_pcre_static=yes], | |
588 | [without_pcre_static=no]) | |
589 | AC_LINK_IFELSE( | |
590 | [AC_LANG_SOURCE(#define PCRE_STATIC | |
591 | #include <pcreposix.h> | |
592 | int main() { return regcomp(NULL, NULL, 0); })], | |
593 | [with_pcre_static=yes], | |
594 | [with_pcre_static=no]) | |
595 | if test "x$without_pcre_static" != xyes && test "x$with_pcre_static" = xyes; then | |
596 | AC_MSG_RESULT(yes) | |
597 | AC_DEFINE([PCRE_STATIC], [1], [Define to 1 if PCRE_STATIC needs to be defined.]) | |
598 | elif test "x$without_pcre_static" = xyes || test "x$with_pcre_static" = xyes; then | |
599 | AC_MSG_RESULT(no) | |
600 | fi | |
601 | posix_regex_lib_found=1 | |
91717f72 | 602 | fi |
d16c4871 AM |
603 | else |
604 | posix_regex_lib_found=1 | |
9797fb4e | 605 | fi |
9fe06744 | 606 | fi |
d1231a7e MBM |
607 | if test -z $posix_regex_lib_found && (test "$enable_posix_regex_lib" = "auto" || test "$enable_posix_regex_lib" = "libpcre2posix"); then |
608 | AC_CHECK_HEADERS([pcre2posix.h]) | |
609 | AC_CHECK_LIB(pcre2-posix,regcomp) | |
610 | if test "x$ac_cv_lib_pcre2posix_regcomp" != xyes; then | |
611 | AC_MSG_NOTICE(trying libpcre2posix check again with libpcre2-8) | |
612 | unset ac_cv_lib_pcre2posix_regcomp | |
613 | AC_CHECK_LIB(pcre2,pcre2_regexec) | |
614 | AC_CHECK_LIB(pcre2-posix,pcre2_regcomp) | |
615 | if test "x$ac_cv_lib_pcre2_pcre_exec" = xyes && test "x$ac_cv_lib_pcre2posix_regcomp" = xyes; then | |
616 | AC_MSG_CHECKING(if PCRE2_STATIC needs to be defined) | |
617 | AC_LINK_IFELSE( | |
618 | [AC_LANG_SOURCE(#include <pcre2posix.h> | |
619 | int main() { return pcre2_regcomp(NULL, NULL, 0); })], | |
620 | [without_pcre2_static=yes], | |
621 | [without_pcre2_static=no]) | |
622 | AC_LINK_IFELSE( | |
623 | [AC_LANG_SOURCE(#define PCRE2_STATIC | |
624 | #include <pcre2posix.h> | |
625 | int main() { return pcre2_regcomp(NULL, NULL, 0); })], | |
626 | [with_pcre2_static=yes], | |
627 | [with_pcre2_static=no]) | |
628 | if test "x$without_pcre2_static" != xyes && test "x$with_pcre2_static" = xyes; then | |
629 | AC_MSG_RESULT(yes) | |
630 | AC_DEFINE([PCRE2_STATIC], [1], [Define to 1 if PCRE2_STATIC needs to be defined.]) | |
631 | elif test "x$without_pcre2_static" = xyes || test "x$with_pcre2_static" = xyes; then | |
632 | AC_MSG_RESULT(no) | |
633 | fi | |
634 | posix_regex_lib_found=1 | |
635 | fi | |
636 | else | |
637 | posix_regex_lib_found=1 | |
638 | fi | |
639 | fi | |
c9b68f41 | 640 | |
b3cfa26b TK |
641 | # TODO: Give the user the option of using a pre-existing system |
642 | # libarchive. This will define HAVE_LIBARCHIVE which will cause | |
643 | # bsdtar_platform.h to use #include <...> for the libarchive headers. | |
644 | # Need to include Makefile.am magic to link against system | |
645 | # -larchive in that case. | |
646 | #AC_CHECK_LIB(archive,archive_version) | |
647 | ||
9f6c6d5d EVW |
648 | # Checks for supported compiler flags |
649 | AX_APPEND_COMPILE_FLAGS([-Wall -Wformat -Wformat-security]) | |
650 | ||
be09cb72 MBM |
651 | # Place the functions and data into separate sections, allowing GNU style |
652 | # linkers to garbage collect the unused ones. | |
fc075823 EV |
653 | save_LDFLAGS=$LDFLAGS |
654 | LDFLAGS="$LDFLAGS -Wl,--gc-sections" | |
655 | AC_MSG_CHECKING([whether ld supports --gc-sections]) | |
656 | AC_LINK_IFELSE( | |
657 | [AC_LANG_SOURCE([static char UnusedFunc() { return 5; } int main() { return 0;}])], | |
658 | [AC_MSG_RESULT([yes]) | |
be09cb72 | 659 | DEAD_CODE_REMOVAL="-Wl,--gc-sections"; |
fc075823 EV |
660 | AX_APPEND_COMPILE_FLAGS([-ffunction-sections -fdata-sections])], |
661 | [AC_MSG_RESULT([no]) | |
be09cb72 | 662 | DEAD_CODE_REMOVAL="";]) |
fc075823 EV |
663 | LDFLAGS=$save_LDFLAGS |
664 | ||
be09cb72 MBM |
665 | if test "$DEAD_CODE_REMOVAL" == ""; then |
666 | # Macos linkers have a -dead_strip flag, which is similar to --gc-sections. | |
667 | save_LDFLAGS=$LDFLAGS | |
668 | LDFLAGS="$LDFLAGS -Wl,-dead_strip" | |
669 | AC_MSG_CHECKING([whether ld supports -dead_strip]) | |
670 | AC_LINK_IFELSE( | |
671 | [AC_LANG_SOURCE([static char UnusedFunc() { return 5; } int main() { return 0;}])], | |
672 | [AC_MSG_RESULT([yes]) | |
673 | DEAD_CODE_REMOVAL="-Wl,-dead_strip";], | |
674 | [AC_MSG_RESULT([no]) | |
675 | DEAD_CODE_REMOVAL="";]) | |
676 | LDFLAGS=$save_LDFLAGS | |
677 | fi | |
678 | ||
679 | AC_SUBST(DEAD_CODE_REMOVAL) | |
fc075823 | 680 | |
b3cfa26b TK |
681 | # Checks for typedefs, structures, and compiler characteristics. |
682 | AC_C_CONST | |
a580c98e | 683 | # la_TYPE_UID_T defaults to "int", which is incorrect for MinGW |
92165c97 CW |
684 | # and MSVC. Use a customized version. |
685 | la_TYPE_UID_T | |
b3cfa26b TK |
686 | AC_TYPE_MODE_T |
687 | # AC_TYPE_OFF_T defaults to "long", which limits us to 4GB files on | |
688 | # most systems... default to "long long" instead. | |
689 | AC_CHECK_TYPE(off_t, [long long]) | |
690 | AC_TYPE_SIZE_T | |
691 | AC_CHECK_TYPE(id_t, [unsigned long]) | |
692 | AC_CHECK_TYPE(uintptr_t, [unsigned int]) | |
8ac32d27 | 693 | |
9d72ea76 MN |
694 | # Check for tm_gmtoff in struct tm |
695 | AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct tm.__tm_gmtoff],,, | |
696 | [ | |
697 | #include <time.h> | |
698 | ]) | |
699 | ||
a3b61f44 MN |
700 | # Check for f_namemax in struct statfs |
701 | AC_CHECK_MEMBERS([struct statfs.f_namemax],,, | |
702 | [ | |
703 | #include <sys/param.h> | |
704 | #include <sys/mount.h> | |
705 | ]) | |
706 | ||
b8e4320b CZ |
707 | # Check for f_iosize in struct statfs |
708 | AC_CHECK_MEMBERS([struct statfs.f_iosize],,, | |
709 | [ | |
710 | #include <sys/param.h> | |
711 | #include <sys/mount.h> | |
712 | ]) | |
713 | ||
19c22e92 BK |
714 | # Check for f_iosize in struct statvfs |
715 | AC_CHECK_MEMBERS([struct statvfs.f_iosize],,, | |
716 | [ | |
717 | #include <sys/statvfs.h> | |
718 | ]) | |
719 | ||
8ac32d27 TK |
720 | # Check for birthtime in struct stat |
721 | AC_CHECK_MEMBERS([struct stat.st_birthtime]) | |
722 | ||
b3cfa26b | 723 | # Check for high-resolution timestamps in struct stat |
8ac32d27 | 724 | AC_CHECK_MEMBERS([struct stat.st_birthtimespec.tv_nsec]) |
b3cfa26b TK |
725 | AC_CHECK_MEMBERS([struct stat.st_mtimespec.tv_nsec]) |
726 | AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec]) | |
d831cc4b BJ |
727 | AC_CHECK_MEMBERS([struct stat.st_mtime_n]) # AIX |
728 | AC_CHECK_MEMBERS([struct stat.st_umtime]) # Tru64 | |
a0b5f839 | 729 | AC_CHECK_MEMBERS([struct stat.st_mtime_usec]) # Hurd |
c15d8e24 TK |
730 | # Check for block size support in struct stat |
731 | AC_CHECK_MEMBERS([struct stat.st_blksize]) | |
c5e9786e TK |
732 | # Check for st_flags in struct stat (BSD fflags) |
733 | AC_CHECK_MEMBERS([struct stat.st_flags]) | |
b3cfa26b TK |
734 | |
735 | # If you have uintmax_t, we assume printf supports %ju | |
736 | # If you have unsigned long long, we assume printf supports %llu | |
737 | # TODO: Check for %ju and %llu support directly. | |
738 | AC_CHECK_TYPES([uintmax_t, unsigned long long]) | |
739 | ||
566a6636 TK |
740 | # We use C99-style integer types |
741 | # Declare them if the local platform doesn't already do so. | |
b3cfa26b | 742 | AC_TYPE_INTMAX_T |
b3cfa26b | 743 | AC_TYPE_UINTMAX_T |
566a6636 | 744 | AC_TYPE_INT64_T |
b3cfa26b | 745 | AC_TYPE_UINT64_T |
566a6636 TK |
746 | AC_TYPE_INT32_T |
747 | AC_TYPE_UINT32_T | |
748 | AC_TYPE_INT16_T | |
749 | AC_TYPE_UINT16_T | |
3de335e1 | 750 | AC_TYPE_UINT8_T |
b3cfa26b | 751 | |
2f637b08 TK |
752 | AC_CHECK_DECLS([SIZE_MAX, INT32_MAX, INT32_MIN]) |
753 | AC_CHECK_DECLS([INT64_MAX, INT64_MIN, UINT64_MAX, UINT32_MAX]) | |
b699d5c6 | 754 | AC_CHECK_DECLS([INTMAX_MAX, INTMAX_MIN, UINTMAX_MAX]) |
a1f91bd1 MN |
755 | |
756 | AC_CHECK_DECL([SSIZE_MAX], | |
757 | [AC_DEFINE(HAVE_DECL_SSIZE_MAX, 1, [Define to 1 if you have the declaration of `SSIZE_MAX', and to 0 if you don't.])], | |
758 | [], | |
759 | [#include <limits.h>]) | |
b3cfa26b TK |
760 | |
761 | AC_CHECK_DECL([EFTYPE], | |
762 | [AC_DEFINE(HAVE_EFTYPE, 1, [A possible errno value for invalid file format errors])], | |
763 | [], | |
764 | [#include <errno.h>]) | |
765 | AC_CHECK_DECL([EILSEQ], | |
766 | [AC_DEFINE(HAVE_EILSEQ, 1, [A possible errno value for invalid file format errors])], | |
767 | [], | |
768 | [#include <errno.h>]) | |
778a496c CW |
769 | AC_CHECK_TYPE([wchar_t], |
770 | [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]wchar_t), 1, [Define to 1 if the system has the type `wchar_t'.])dnl | |
771 | AC_CHECK_SIZEOF([wchar_t])], | |
772 | []) | |
773 | ||
9a6a8e77 | 774 | AX_COMPILE_CHECK_SIZEOF(int) |
775 | AX_COMPILE_CHECK_SIZEOF(long) | |
776 | ||
013aef12 | 777 | AC_CHECK_HEADERS_ONCE([sys/time.h]) |
b3cfa26b TK |
778 | |
779 | # Checks for library functions. | |
780 | AC_PROG_GCC_TRADITIONAL | |
781 | AC_HEADER_MAJOR | |
782 | AC_FUNC_FSEEKO | |
783 | AC_FUNC_MEMCMP | |
784 | AC_FUNC_LSTAT | |
785 | AC_FUNC_STAT | |
786 | AC_FUNC_STRERROR_R | |
787 | AC_FUNC_STRFTIME | |
788 | AC_FUNC_VPRINTF | |
197cc2d1 CW |
789 | # check for: |
790 | # CreateHardLinkA(LPCSTR, LPCSTR, LPSECURITY_ATTRIBUTES) | |
791 | # To avoid necessity for including windows.h or special forward declaration | |
792 | # workarounds, we use 'void *' for 'struct SECURITY_ATTRIBUTES *' | |
793 | AC_CHECK_STDCALL_FUNC([CreateHardLinkA],[const char *, const char *, void *]) | |
d5ed4f85 | 794 | AC_CHECK_FUNCS([arc4random_buf chflags chown chroot ctime_r]) |
386412e2 | 795 | AC_CHECK_FUNCS([fchdir fchflags fchmod fchown fcntl fdopendir fnmatch fork]) |
4f1939c9 MN |
796 | AC_CHECK_FUNCS([fstat fstatat fstatfs fstatvfs ftruncate]) |
797 | AC_CHECK_FUNCS([futimens futimes futimesat]) | |
5397c4ed | 798 | AC_CHECK_FUNCS([geteuid getline getpid getgrgid_r getgrnam_r]) |
21467bd9 | 799 | AC_CHECK_FUNCS([getpwnam_r getpwuid_r getvfsbyname gmtime_r]) |
5e646b89 | 800 | AC_CHECK_FUNCS([lchflags lchmod lchown link linkat localtime_r lstat lutimes]) |
47a98250 | 801 | AC_CHECK_FUNCS([mbrtowc memmove memset]) |
496b1876 | 802 | AC_CHECK_FUNCS([mkdir mkfifo mknod mkstemp]) |
8c1c0a7a | 803 | AC_CHECK_FUNCS([nl_langinfo openat pipe poll posix_spawnp readlink readlinkat]) |
9769e6f7 | 804 | AC_CHECK_FUNCS([readpassphrase]) |
4ba1f7d7 | 805 | AC_CHECK_FUNCS([select setenv setlocale sigaction statfs statvfs]) |
c581b317 MM |
806 | AC_CHECK_FUNCS([strchr strdup strerror strncpy_s strnlen strrchr symlink]) |
807 | AC_CHECK_FUNCS([timegm tzset unlinkat unsetenv utime utimensat utimes vfork]) | |
b6ba5603 | 808 | AC_CHECK_FUNCS([wcrtomb wcscmp wcscpy wcslen wctomb wmemcmp wmemcpy wmemmove]) |
0348e24b RP |
809 | AC_CHECK_FUNCS([_fseeki64 _get_timezone]) |
810 | AC_CHECK_DECL([cmtime_s], | |
811 | [AC_DEFINE(HAVE_CMTIME_S, 1, [cmtime_s function])], | |
812 | [], | |
813 | [#include <time.h>]) | |
814 | AC_CHECK_DECL([gmtime_s], | |
815 | [AC_DEFINE(HAVE_GMTIME_S, 1, [gmtime_s function])], | |
816 | [], | |
817 | [#include <time.h>]) | |
818 | AC_CHECK_TYPE([localtime_s], | |
819 | [AC_DEFINE(HAVE_LOCALTIME_S, 1, [localtime_s function])], | |
820 | [], | |
821 | [#include <time.h>]) | |
822 | AC_CHECK_DECL([_mkgmtime], | |
823 | [AC_DEFINE(HAVE__MKGMTIME, 1, [_mkgmtime function])], | |
824 | [], | |
825 | [#include <time.h>]) | |
826 | ||
ed585028 CW |
827 | # detects cygwin-1.7, as opposed to older versions |
828 | AC_CHECK_FUNCS([cygwin_conv_path]) | |
b3cfa26b | 829 | |
e7642e12 JS |
830 | # DragonFly uses vfsconf, FreeBSD xvfsconf. |
831 | AC_CHECK_TYPES(struct vfsconf,,, | |
832 | [#if HAVE_SYS_TYPES_H | |
833 | #include <sys/types.h> | |
834 | #endif | |
835 | #include <sys/mount.h> | |
836 | ]) | |
837 | ||
a847b455 TK |
838 | AC_CHECK_TYPES(struct xvfsconf,,, |
839 | [#if HAVE_SYS_TYPES_H | |
840 | #include <sys/types.h> | |
841 | #endif | |
842 | #include <sys/mount.h> | |
843 | ]) | |
844 | ||
c4970dcd CZ |
845 | AC_CHECK_TYPES(struct statfs,,, |
846 | [#if HAVE_SYS_TYPES_H | |
847 | #include <sys/types.h> | |
848 | #endif | |
849 | #include <sys/mount.h> | |
850 | ]) | |
851 | ||
09654df8 TK |
852 | # There are several variants of readdir_r around; we only |
853 | # accept the POSIX-compliant version. | |
3f8f054e | 854 | AC_LINK_IFELSE( |
09654df8 TK |
855 | [AC_LANG_PROGRAM([[#include <dirent.h>]], |
856 | [[DIR *dir; struct dirent e, *r; | |
c8f97841 | 857 | return(readdir_r(dir, &e, &r));]])], |
09654df8 TK |
858 | [AC_DEFINE(HAVE_READDIR_R,1,[Define to 1 if you have a POSIX compatible readdir_r])] |
859 | ) | |
d5ed4f85 | 860 | # dirfd can be either a function or a macro. |
3f8f054e | 861 | AC_LINK_IFELSE( |
d5ed4f85 JS |
862 | [AC_LANG_PROGRAM([[#include <dirent.h> |
863 | DIR *dir;]], | |
864 | [[return(dirfd(dir));]])], | |
865 | [AC_DEFINE(HAVE_DIRFD,1,[Define to 1 if you have a dirfd function or macro])] | |
866 | ) | |
09654df8 | 867 | |
b3cfa26b TK |
868 | # FreeBSD's nl_langinfo supports an option to specify whether the |
869 | # current locale uses month/day or day/month ordering. It makes the | |
870 | # output a little prettier... | |
871 | AC_CHECK_DECL([D_MD_ORDER], | |
872 | [AC_DEFINE(HAVE_D_MD_ORDER, 1, [Define to 1 if nl_langinfo supports D_MD_ORDER])], | |
873 | [], | |
874 | [#if HAVE_LANGINFO_H | |
875 | #include <langinfo.h> | |
876 | #endif | |
877 | ]) | |
878 | ||
b3cfa26b TK |
879 | # Check for dirent.d_namlen field explicitly |
880 | # (This is a bit more straightforward than, if not quite as portable as, | |
881 | # the recipe given by the autoconf maintainers.) | |
882 | AC_CHECK_MEMBER(struct dirent.d_namlen,,, | |
883 | [#if HAVE_DIRENT_H | |
884 | #include <dirent.h> | |
885 | #endif | |
886 | ]) | |
887 | ||
888 | # Check for Extended Attributes support | |
889 | AC_ARG_ENABLE([xattr], | |
890 | AS_HELP_STRING([--disable-xattr], | |
b30c530a | 891 | [Disable Extended Attributes support (default: check)])) |
b3cfa26b TK |
892 | |
893 | if test "x$enable_xattr" != "xno"; then | |
37740e26 | 894 | AC_SEARCH_LIBS([setxattr], [attr gnu]) |
365a91de | 895 | AC_CHECK_DECLS([EXTATTR_NAMESPACE_USER], [], [], [#include <sys/types.h> |
6d23f1c5 JS |
896 | #include <sys/extattr.h> |
897 | ]) | |
365a91de MM |
898 | AC_CHECK_DECLS([XATTR_NOFOLLOW], [], [], [#include <sys/xattr.h> |
899 | ]) | |
900 | if test "x$ac_cv_header_sys_xattr_h" = "xyes" \ | |
901 | -a "x$ac_cv_have_decl_XATTR_NOFOLLOW" = "xyes"; then | |
902 | # Darwin extended attributes support | |
903 | AC_CACHE_VAL([ac_cv_archive_xattr_darwin], | |
904 | [AC_CHECK_FUNCS(fgetxattr \ | |
905 | flistxattr \ | |
906 | fsetxattr \ | |
907 | getxattr \ | |
908 | listxattr \ | |
909 | setxattr, | |
910 | [ac_cv_archive_xattr_darwin=yes], | |
911 | [ac_cv_archive_xattr_darwin=no], | |
912 | [#include <sys/xattr.h> | |
913 | ]) | |
914 | ] | |
915 | ) | |
916 | elif test "x$ac_cv_header_sys_extattr_h" = "xyes" \ | |
917 | -a "x$ac_cv_have_decl_EXTATTR_NAMESPACE_USER" = "xyes"; then | |
918 | # FreeBSD extended attributes support | |
919 | AC_CACHE_VAL([ac_cv_archive_xattr_freebsd], | |
920 | [AC_CHECK_FUNCS(extattr_get_fd \ | |
921 | extattr_get_file \ | |
922 | extattr_get_link \ | |
923 | extattr_list_fd \ | |
924 | extattr_list_file \ | |
925 | extattr_list_link \ | |
926 | extattr_set_fd \ | |
927 | extattr_set_link, | |
928 | [ac_cv_archive_xattr_freebsd=yes], | |
929 | [ac_cv_archive_xattr_freebsd=no], | |
930 | [#include <sys/types.h> | |
931 | #include <sys/extattr.h> | |
932 | ]) | |
933 | ] | |
934 | ) | |
935 | elif test "x$ac_cv_header_sys_xattr_h" = "xyes" \ | |
936 | -o "x$ac_cv_header_attr_xattr_h" = "xyes"; then | |
937 | # Linux extended attributes support | |
938 | AC_CACHE_VAL([ac_cv_archive_xattr_linux], | |
939 | [AC_CHECK_FUNCS(fgetxattr \ | |
940 | flistxattr \ | |
941 | fsetxattr \ | |
942 | getxattr \ | |
943 | lgetxattr \ | |
944 | listxattr \ | |
945 | llistxattr \ | |
946 | lsetxattr, | |
947 | [ac_cv_archive_xattr_linux=yes], | |
948 | [ac_cv_archive_xattr_linux=no], | |
949 | [#if HAVE_SYS_TYPES_H | |
950 | #include <sys/types.h> | |
951 | #endif | |
952 | #if HAVE_SYS_XATTR_H | |
953 | #include <sys/xattr.h> | |
954 | #endif | |
955 | #if HAVE_ATTR_XATTR_H | |
956 | #include <attr/xatr.h> | |
957 | #endif | |
958 | ]) | |
959 | ] | |
960 | ) | |
961 | elif test "x$ac_cv_header_sys_ea_h" = "xyes"; then | |
962 | # AIX extended attributes support | |
963 | AC_CACHE_VAL([ac_cv_archive_xattr_aix], | |
964 | [AC_CHECK_FUNCS(fgetea \ | |
965 | flistea \ | |
966 | fsetea \ | |
967 | getea \ | |
968 | lgetea \ | |
969 | listea \ | |
970 | llistea \ | |
971 | lsetea, | |
972 | [ac_cv_archive_xattr_aix=yes], | |
973 | [ac_cv_archive_xattr_aix=no], | |
974 | [#include <sys/ea.h> | |
975 | ]) | |
976 | ] | |
977 | ) | |
978 | fi | |
979 | ||
980 | AC_MSG_CHECKING([for extended attributes support]) | |
981 | if test "x$ac_cv_archive_xattr_linux" = "xyes"; then | |
982 | AC_DEFINE([ARCHIVE_XATTR_LINUX], [1], [Linux xattr support]) | |
983 | AC_MSG_RESULT([Linux]) | |
984 | elif test "x$ac_cv_archive_xattr_darwin" = "xyes"; then | |
985 | AC_DEFINE([ARCHIVE_XATTR_DARWIN], [1], [Darwin xattr support]) | |
986 | AC_MSG_RESULT([Darwin]) | |
987 | elif test "x$ac_cv_archive_xattr_freebsd" = "xyes"; then | |
988 | AC_DEFINE([ARCHIVE_XATTR_FREEBSD], [1], [FreeBSD xattr support]) | |
989 | AC_MSG_RESULT([FreeBSD]) | |
990 | elif test "x$ac_cv_archive_xattr_aix" = "xyes"; then | |
991 | AC_DEFINE([ARCHIVE_XATTR_AIX], [1], [AIX xattr support]) | |
992 | AC_MSG_RESULT([AIX]) | |
993 | else | |
994 | AC_MSG_RESULT([none]) | |
995 | fi | |
b3cfa26b TK |
996 | fi |
997 | ||
998 | # Check for ACL support | |
999 | # | |
1000 | # The ACL support in libarchive is written against the POSIX1e draft, | |
1001 | # which was never officially approved and varies quite a bit across | |
1002 | # platforms. Worse, some systems have completely non-POSIX acl functions, | |
1003 | # which makes the following checks rather more complex than I would like. | |
1004 | # | |
1005 | AC_ARG_ENABLE([acl], | |
1006 | AS_HELP_STRING([--disable-acl], | |
b30c530a | 1007 | [Disable ACL support (default: check)])) |
b3cfa26b TK |
1008 | |
1009 | if test "x$enable_acl" != "xno"; then | |
f57d129d MM |
1010 | # Libacl |
1011 | AC_CHECK_LIB([acl], [acl_get_file]) | |
1012 | ||
1013 | AC_CHECK_TYPES([acl_t, acl_entry_t, acl_permset_t, acl_tag_t], [], [], [ | |
1014 | #if HAVE_SYS_TYPES_H | |
1015 | #include <sys/types.h> | |
1016 | #endif | |
1017 | #if HAVE_SYS_ACL_H | |
1018 | #include <sys/acl.h> | |
1019 | #endif | |
1020 | ]) | |
b3cfa26b | 1021 | |
bea9f9cf MM |
1022 | AC_CHECK_LIB([richacl], [richacl_get_file]) |
1023 | ||
1024 | AC_CHECK_TYPES([[struct richace], [struct richacl]], [], [], [ | |
1025 | #if HAVE_SYS_RICHACL_H | |
1026 | #include <sys/richacl.h> | |
1027 | #endif | |
1028 | ]) | |
1029 | ||
f57d129d MM |
1030 | # Solaris and derivates ACLs |
1031 | AC_CHECK_FUNCS(acl facl) | |
b3cfa26b | 1032 | |
bea9f9cf MM |
1033 | if test "x$ac_cv_lib_richacl_richacl_get_file" = "xyes" \ |
1034 | -a "x$ac_cv_type_struct_richace" = "xyes" \ | |
1035 | -a "x$ac_cv_type_struct_richacl" = "xyes"; then | |
1036 | AC_CACHE_VAL([ac_cv_archive_acl_librichacl], | |
1037 | [AC_CHECK_FUNCS(richacl_alloc \ | |
1038 | richacl_equiv_mode \ | |
1039 | richacl_free \ | |
1040 | richacl_get_fd \ | |
1041 | richacl_get_file \ | |
1042 | richacl_set_fd \ | |
1043 | richacl_set_file, | |
1044 | [ac_cv_archive_acl_librichacl=yes], [ac_cv_archive_acl_librichacl=no], [#include <sys/richacl.h>])]) | |
1045 | fi | |
1046 | ||
f57d129d MM |
1047 | if test "x$ac_cv_func_acl" = "xyes" \ |
1048 | -a "x$ac_cv_func_facl" = "xyes"; then | |
1049 | AC_CHECK_TYPES([aclent_t], [], [], [[#include <sys/acl.h>]]) | |
1050 | if test "x$ac_cv_type_aclent_t" = "xyes"; then | |
1051 | AC_CACHE_VAL([ac_cv_archive_acl_sunos], | |
1052 | [AC_CHECK_DECLS([GETACL, SETACL, GETACLCNT], | |
1053 | [ac_cv_archive_acl_sunos=yes], [ac_cv_archive_acl_sunos=no], | |
1054 | [#include <sys/acl.h>])]) | |
1055 | AC_CHECK_TYPES([ace_t], [], [], [[#include <sys/acl.h>]]) | |
1056 | if test "x$ac_cv_type_ace_t" = "xyes"; then | |
1057 | AC_CACHE_VAL([ac_cv_archive_acl_sunos_nfs4], | |
1058 | [AC_CHECK_DECLS([ACE_GETACL, ACE_SETACL, ACE_GETACLCNT], | |
1059 | [ac_cv_archive_acl_sunos_nfs4=yes], | |
1060 | [ac_cv_archive_acl_sonos_nfs4=no], | |
1061 | [#include <sys/acl.h>])]) | |
1062 | fi | |
1063 | fi | |
1064 | elif test "x$ac_cv_type_acl_t" = "xyes" \ | |
1065 | -a "x$ac_cv_type_acl_entry_t" = "xyes" \ | |
1066 | -a "x$ac_cv_type_acl_permset_t" = "xyes" \ | |
1067 | -a "x$ac_cv_type_acl_tag_t" = "xyes"; then | |
1068 | # POSIX.1e ACL functions | |
1069 | AC_CACHE_VAL([ac_cv_posix_acl_funcs], | |
1070 | [AC_CHECK_FUNCS(acl_add_perm \ | |
1071 | acl_clear_perms \ | |
1072 | acl_create_entry \ | |
1073 | acl_delete_def_file \ | |
1074 | acl_free \ | |
1075 | acl_get_entry \ | |
1076 | acl_get_fd \ | |
1077 | acl_get_file \ | |
1078 | acl_get_permset \ | |
1079 | acl_get_qualifier \ | |
1080 | acl_get_tag_type \ | |
1081 | acl_init \ | |
1082 | acl_set_fd \ | |
1083 | acl_set_file \ | |
1084 | acl_set_qualifier \ | |
1085 | acl_set_tag_type, | |
1086 | [ac_cv_posix_acl_funcs=yes], [ac_cv_posix_acl_funcs=no], | |
1087 | [#if HAVE_SYS_TYPES_H | |
1088 | #include <sys/types.h> | |
1089 | #endif | |
1090 | #if HAVE_SYS_ACL_H | |
1091 | #include <sys/acl.h> | |
1092 | #endif | |
1093 | ]) | |
992652f4 MM |
1094 | ]) |
1095 | ||
f57d129d | 1096 | AC_CHECK_FUNCS(acl_get_perm) |
9f43a7d6 | 1097 | |
f57d129d MM |
1098 | if test "x$ac_cv_posix_acl_funcs" = "xyes" \ |
1099 | -a "x$ac_cv_header_acl_libacl_h" = "xyes" \ | |
1100 | -a "x$ac_cv_lib_acl_acl_get_file" = "xyes" \ | |
1101 | -a "x$ac_cv_func_acl_get_perm"; then | |
1102 | AC_CACHE_VAL([ac_cv_archive_acl_libacl], | |
1103 | [ac_cv_archive_acl_libacl=yes]) | |
1104 | AC_DEFINE([ARCHIVE_ACL_LIBACL], [1], | |
1105 | [POSIX.1e ACL support via libacl]) | |
1106 | else | |
1107 | # FreeBSD/Darwin | |
1108 | AC_CHECK_FUNCS(acl_add_flag_np \ | |
1109 | acl_clear_flags_np \ | |
1110 | acl_get_brand_np \ | |
1111 | acl_get_entry_type_np \ | |
1112 | acl_get_flag_np \ | |
1113 | acl_get_flagset_np \ | |
1114 | acl_get_fd_np \ | |
1115 | acl_get_link_np \ | |
1116 | acl_get_perm_np \ | |
1117 | acl_is_trivial_np \ | |
1118 | acl_set_entry_type_np \ | |
1119 | acl_set_fd_np \ | |
1120 | acl_set_link_np,,, | |
1121 | [#include <sys/types.h> | |
1122 | #include <sys/acl.h>]) | |
1123 | ||
1124 | AC_CHECK_FUNCS(mbr_uid_to_uuid \ | |
1125 | mbr_uuid_to_id \ | |
1126 | mbr_gid_to_uuid,,, | |
1127 | [#include <membership.h>]) | |
1128 | ||
1129 | AC_CHECK_DECLS([ACL_TYPE_EXTENDED, ACL_TYPE_NFS4, ACL_USER, | |
1130 | ACL_SYNCHRONIZE], [], [], | |
1131 | [#include <sys/types.h> | |
1132 | #include <sys/acl.h>]) | |
1133 | if test "x$ac_cv_posix_acl_funcs" = "xyes" \ | |
1134 | -a "x$ac_cv_func_acl_get_fd_np" = "xyes" \ | |
1135 | -a "x$ac_cv_func_acl_get_perm" != "xyes" \ | |
1136 | -a "x$ac_cv_func_acl_get_perm_np" = "xyes" \ | |
1137 | -a "x$ac_cv_func_acl_set_fd_np" = "xyes"; then | |
1138 | if test "x$ac_cv_have_decl_ACL_USER" = "xyes"; then | |
1139 | AC_CACHE_VAL([ac_cv_archive_acl_freebsd], | |
1140 | [ac_cv_archive_acl_freebsd=yes]) | |
1141 | if test "x$ac_cv_have_decl_ACL_TYPE_NFS4" = "xyes" \ | |
1142 | -a "x$ac_cv_func_acl_add_flag_np" = "xyes" \ | |
1143 | -a "x$ac_cv_func_acl_get_brand_np" = "xyes" \ | |
1144 | -a "x$ac_cv_func_acl_get_entry_type_np" = "xyes" \ | |
1145 | -a "x$ac_cv_func_acl_get_flagset_np" = "xyes" \ | |
1146 | -a "x$ac_cv_func_acl_set_entry_type_np" = "xyes"; then | |
1147 | AC_CACHE_VAL([ac_cv_archive_acl_freebsd_nfs4], | |
1148 | [ac_cv_archive_acl_freebsd_nfs4=yes]) | |
1149 | fi | |
1150 | elif test "x$ac_cv_have_decl_ACL_TYPE_EXTENDED" = "xyes" \ | |
1151 | -a "x$ac_cv_func_acl_add_flag_np" = "xyes" \ | |
1152 | -a "x$ac_cv_func_acl_get_flagset_np" = "xyes" \ | |
1153 | -a "x$ac_cv_func_acl_get_link_np" = "xyes" \ | |
1154 | -a "x$ac_cv_func_acl_set_link_np" = "xyes" \ | |
1155 | -a "x$ac_cv_func_mbr_uid_to_uuid" = "xyes" \ | |
1156 | -a "x$ac_cv_func_mbr_uuid_to_id" = "xyes" \ | |
1157 | -a "x$ac_cv_func_mbr_gid_to_uuid" = "xyes"; then | |
1158 | AC_CACHE_VAL([ac_cv_archive_acl_darwin], | |
1159 | [ac_cv_archive_acl_darwin=yes]) | |
1160 | fi | |
1161 | fi | |
1162 | fi | |
1163 | fi | |
1164 | AC_MSG_CHECKING([for ACL support]) | |
bea9f9cf MM |
1165 | if test "x$ac_cv_archive_acl_libacl" = "xyes" \ |
1166 | -a "x$ac_cv_archive_acl_librichacl" = "xyes"; then | |
1167 | AC_MSG_RESULT([libacl (POSIX.1e) + librichacl (NFSv4)]) | |
1168 | AC_DEFINE([ARCHIVE_ACL_LIBACL], [1], | |
1169 | [Linux POSIX.1e ACL support via libacl]) | |
1170 | AC_DEFINE([ARCHIVE_ACL_LIBRICHACL], [1], | |
1171 | [Linux NFSv4 ACL support via librichacl]) | |
1172 | elif test "x$ac_cv_archive_acl_libacl" = "xyes"; then | |
f57d129d | 1173 | AC_MSG_RESULT([libacl (POSIX.1e)]) |
bea9f9cf MM |
1174 | AC_DEFINE([ARCHIVE_ACL_LIBACL], [1], |
1175 | [Linux POSIX.1e ACL support via libacl]) | |
1176 | elif test "x$ac_cv_archive_acl_librichacl" = "xyes"; then | |
1177 | AC_MSG_RESULT([librichacl (NFSv4)]) | |
1178 | AC_DEFINE([ARCHIVE_ACL_LIBRICHACL], [1], | |
1179 | [Linux NFSv4 ACL support via librichacl]) | |
f57d129d MM |
1180 | elif test "x$ac_cv_archive_acl_darwin" = "xyes"; then |
1181 | AC_DEFINE([ARCHIVE_ACL_DARWIN], [1], [Darwin ACL support]) | |
1182 | AC_MSG_RESULT([Darwin (limited NFSv4)]) | |
1183 | elif test "x$ac_cv_archive_acl_sunos" = "xyes"; then | |
1184 | AC_DEFINE([ARCHIVE_ACL_SUNOS], [1], [Solaris ACL support]) | |
1185 | if test "x$ac_cv_archive_acl_sunos_nfs4" = "xyes"; then | |
1186 | AC_DEFINE([ARCHIVE_ACL_SUNOS_NFS4], [1], | |
1187 | [Solaris NFSv4 ACL support]) | |
1188 | AC_MSG_RESULT([Solaris (POSIX.1e and NFSv4)]) | |
1189 | else | |
1190 | AC_MSG_RESULT([Solaris (POSIX.1e)]) | |
1191 | fi | |
1192 | elif test "x$ac_cv_archive_acl_freebsd" = "xyes"; then | |
1193 | AC_DEFINE([ARCHIVE_ACL_FREEBSD], [1], [FreeBSD ACL support]) | |
1194 | if test "x$ac_cv_archive_acl_freebsd_nfs4" = "xyes"; then | |
1195 | AC_DEFINE([ARCHIVE_ACL_FREEBSD_NFS4], [1], | |
1196 | [FreeBSD NFSv4 ACL support]) | |
1197 | AC_MSG_RESULT([FreeBSD (POSIX.1e and NFSv4)]) | |
1198 | else | |
1199 | AC_MSG_RESULT([FreeBSD (POSIX.1e)]) | |
1200 | fi | |
1201 | else | |
1202 | AC_MSG_RESULT([none]) | |
1203 | fi | |
b3cfa26b TK |
1204 | fi |
1205 | ||
f57d129d | 1206 | |
bea9f9cf MM |
1207 | AM_CONDITIONAL([INC_LINUX_ACL], |
1208 | [test "x$ac_cv_archive_acl_libacl" = "xyes" \ | |
1209 | -o "x$ac_cv_archive_acl_librichacl" = "xyes"]) | |
f57d129d MM |
1210 | AM_CONDITIONAL([INC_SUNOS_ACL], [test "x$ac_cv_archive_acl_sunos" = "xyes"]) |
1211 | AM_CONDITIONAL([INC_DARWIN_ACL], | |
1212 | [test "x$ac_cv_archive_acl_darwin" = "xyes"]) | |
1213 | AM_CONDITIONAL([INC_FREEBSD_ACL], | |
1214 | [test "x$ac_cv_archive_acl_freebsd" = "xyes"]) | |
1215 | ||
b3cfa26b TK |
1216 | # Additional requirements |
1217 | AC_SYS_LARGEFILE | |
1218 | ||
2d53ab9e AM |
1219 | dnl NOTE: Crypto checks must run last. |
1220 | AC_DEFUN([CRYPTO_CHECK], [ | |
1221 | if test "$found_$1" != yes; then | |
2d53ab9e | 1222 | saved_CPPFLAGS="$CPPFLAGS" |
38644a9a | 1223 | CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" |
2d53ab9e AM |
1224 | touch "check_crypto_md.h" |
1225 | AC_MSG_CHECKING([support for ARCHIVE_CRYPTO_$1_$2]) | |
1226 | AC_LINK_IFELSE([AC_LANG_SOURCE([ | |
1227 | #define ARCHIVE_$1_COMPILE_TEST | |
1228 | #define ARCHIVE_CRYPTO_$1_$2 | |
1229 | #define PLATFORM_CONFIG_H "check_crypto_md.h" | |
1230 | ||
c4c6533b | 1231 | $(cat "$srcdir/libarchive/archive_digest.c") |
2d53ab9e AM |
1232 | |
1233 | int | |
1234 | main(int argc, char **argv) | |
1235 | { | |
1236 | archive_$3_ctx ctx; | |
1237 | archive_$3_init(&ctx); | |
1238 | archive_$3_update(&ctx, *argv, argc); | |
1239 | archive_$3_final(&ctx, NULL); | |
1240 | return 0; | |
1241 | } | |
1242 | ])], | |
1243 | [ AC_MSG_RESULT([yes]) | |
1244 | found_$1=yes | |
177cf35b | 1245 | found_$2=yes |
2d53ab9e AM |
1246 | AC_DEFINE(ARCHIVE_CRYPTO_$1_$2, 1, [ $1 via ARCHIVE_CRYPTO_$1_$2 supported.]) |
1247 | ], | |
1248 | [ AC_MSG_RESULT([no])]) | |
2d53ab9e AM |
1249 | CPPFLAGS="$saved_CPPFLAGS" |
1250 | rm "check_crypto_md.h" | |
1251 | fi | |
1252 | ]) | |
1253 | ||
275000df MN |
1254 | AC_DEFUN([CRYPTO_CHECK_WIN], [ |
1255 | if test "$found_$1" != yes; then | |
1256 | AC_MSG_CHECKING([support for ARCHIVE_CRYPTO_$1_WIN]) | |
1257 | AC_LINK_IFELSE([AC_LANG_SOURCE([ | |
275000df MN |
1258 | #define ARCHIVE_$1_COMPILE_TEST |
1259 | #include <windows.h> | |
1260 | #include <wincrypt.h> | |
1261 | ||
1262 | int | |
1263 | main(int argc, char **argv) | |
1264 | { | |
1265 | (void)argc; | |
1266 | (void)argv; | |
1267 | ||
1268 | return ($2); | |
1269 | } | |
1270 | ])], | |
1271 | [ AC_MSG_RESULT([yes]) | |
1272 | found_$1=yes | |
177cf35b | 1273 | found_WIN=yes |
275000df MN |
1274 | AC_DEFINE(ARCHIVE_CRYPTO_$1_WIN, 1, [ $1 via ARCHIVE_CRYPTO_$1_WIN supported.]) |
1275 | ], | |
1276 | [ AC_MSG_RESULT([no])]) | |
1277 | fi | |
1278 | ]) | |
1279 | ||
1280 | case "$host_os" in | |
1e2b6c98 | 1281 | *mingw* | *cygwin* | *msys*) |
275000df MN |
1282 | ;; |
1283 | *) | |
1284 | CRYPTO_CHECK(MD5, LIBC, md5) | |
1285 | CRYPTO_CHECK(MD5, LIBSYSTEM, md5) | |
1286 | CRYPTO_CHECK(RMD160, LIBC, rmd160) | |
1287 | CRYPTO_CHECK(SHA1, LIBC, sha1) | |
1288 | CRYPTO_CHECK(SHA1, LIBSYSTEM, sha1) | |
1289 | CRYPTO_CHECK(SHA256, LIBC, sha256) | |
1290 | CRYPTO_CHECK(SHA256, LIBC2, sha256) | |
1291 | CRYPTO_CHECK(SHA256, LIBC3, sha256) | |
1292 | CRYPTO_CHECK(SHA256, LIBSYSTEM, sha256) | |
1293 | CRYPTO_CHECK(SHA384, LIBC, sha384) | |
1294 | CRYPTO_CHECK(SHA384, LIBC2, sha384) | |
1295 | CRYPTO_CHECK(SHA384, LIBC3, sha384) | |
1296 | CRYPTO_CHECK(SHA384, LIBSYSTEM, sha384) | |
1297 | CRYPTO_CHECK(SHA512, LIBC, sha512) | |
1298 | CRYPTO_CHECK(SHA512, LIBC2, sha512) | |
1299 | CRYPTO_CHECK(SHA512, LIBC3, sha512) | |
1300 | CRYPTO_CHECK(SHA512, LIBSYSTEM, sha512) | |
1301 | ;; | |
1302 | esac | |
2d53ab9e | 1303 | |
0869c13c PM |
1304 | if test "x$with_cng" != "xno"; then |
1305 | AC_CHECK_HEADERS([bcrypt.h],[ | |
1306 | LIBS="$LIBS -lbcrypt" | |
1307 | ],[], | |
1308 | [[#ifdef HAVE_WINDOWS_H | |
1309 | # include <windows.h> | |
1310 | #endif | |
1311 | ]]) | |
1312 | fi | |
1313 | ||
f96a7114 MM |
1314 | if test "x$with_mbedtls" = "xyes"; then |
1315 | AC_CHECK_HEADERS([mbedtls/aes.h mbedtls/md.h mbedtls/pkcs5.h]) | |
1316 | saved_LIBS=$LIBS | |
1317 | AC_CHECK_LIB(mbedcrypto,mbedtls_sha1_init) | |
1318 | CRYPTO_CHECK(MD5, MBEDTLS, md5) | |
1319 | CRYPTO_CHECK(RMD160, MBEDTLS, rmd160) | |
1320 | CRYPTO_CHECK(SHA1, MBEDTLS, sha1) | |
1321 | CRYPTO_CHECK(SHA256, MBEDTLS, sha256) | |
1322 | CRYPTO_CHECK(SHA384, MBEDTLS, sha384) | |
1323 | CRYPTO_CHECK(SHA512, MBEDTLS, sha512) | |
1324 | if test "x$found_MBEDTLS" != "xyes"; then | |
1325 | LIBS=$saved_LIBS | |
1326 | fi | |
1327 | fi | |
1328 | ||
1329 | if test "x$with_nettle" = "xyes"; then | |
177cf35b | 1330 | AC_CHECK_HEADERS([nettle/md5.h nettle/ripemd160.h nettle/sha.h]) |
48e40df7 | 1331 | AC_CHECK_HEADERS([nettle/pbkdf2.h nettle/aes.h nettle/hmac.h]) |
177cf35b | 1332 | saved_LIBS=$LIBS |
48e40df7 | 1333 | AC_CHECK_LIB(nettle,nettle_sha1_init) |
177cf35b AM |
1334 | CRYPTO_CHECK(MD5, NETTLE, md5) |
1335 | CRYPTO_CHECK(RMD160, NETTLE, rmd160) | |
1336 | CRYPTO_CHECK(SHA1, NETTLE, sha1) | |
1337 | CRYPTO_CHECK(SHA256, NETTLE, sha256) | |
1338 | CRYPTO_CHECK(SHA384, NETTLE, sha384) | |
1339 | CRYPTO_CHECK(SHA512, NETTLE, sha512) | |
1340 | if test "x$found_NETTLE" != "xyes"; then | |
1341 | LIBS=$saved_LIBS | |
1342 | fi | |
00ac9023 | 1343 | fi |
48e40df7 | 1344 | |
2d53ab9e | 1345 | if test "x$with_openssl" != "xno"; then |
177cf35b AM |
1346 | AC_CHECK_HEADERS([openssl/evp.h]) |
1347 | saved_LIBS=$LIBS | |
1f3c62eb | 1348 | LIBSREQUIRED="$LIBSREQUIRED${LIBSREQUIRED:+ }libcrypto" |
9210f025 | 1349 | AC_CHECK_LIB(crypto,OPENSSL_config) |
fdd5acfe AM |
1350 | CRYPTO_CHECK(MD5, OPENSSL, md5) |
1351 | CRYPTO_CHECK(RMD160, OPENSSL, rmd160) | |
1352 | CRYPTO_CHECK(SHA1, OPENSSL, sha1) | |
1353 | CRYPTO_CHECK(SHA256, OPENSSL, sha256) | |
1354 | CRYPTO_CHECK(SHA384, OPENSSL, sha384) | |
1355 | CRYPTO_CHECK(SHA512, OPENSSL, sha512) | |
b2b69d4f | 1356 | AC_CHECK_FUNCS([PKCS5_PBKDF2_HMAC_SHA1]) |
2d53ab9e | 1357 | fi |
f8709112 | 1358 | |
a83f3d32 BN |
1359 | AC_SUBST(LIBSREQUIRED) |
1360 | ||
f8709112 TK |
1361 | # Probe libmd AFTER OpenSSL/libcrypto. |
1362 | # The two are incompatible and OpenSSL is more complete. | |
177cf35b AM |
1363 | AC_CHECK_HEADERS([md5.h ripemd.h sha.h sha256.h sha512.h]) |
1364 | saved_LIBS=$LIBS | |
48e40df7 | 1365 | AC_CHECK_LIB(md,MD5Init) |
fdd5acfe AM |
1366 | CRYPTO_CHECK(MD5, LIBMD, md5) |
1367 | CRYPTO_CHECK(RMD160, LIBMD, rmd160) | |
1368 | CRYPTO_CHECK(SHA1, LIBMD, sha1) | |
1369 | CRYPTO_CHECK(SHA256, LIBMD, sha256) | |
1370 | CRYPTO_CHECK(SHA512, LIBMD, sha512) | |
177cf35b AM |
1371 | if test "x$found_LIBMD" != "xyes"; then |
1372 | LIBS=$saved_LIBS | |
1373 | fi | |
2d53ab9e | 1374 | |
c078ff5d | 1375 | case "$host_os" in |
1e2b6c98 | 1376 | *mingw* | *cygwin* | *msys*) |
c078ff5d AM |
1377 | CRYPTO_CHECK_WIN(MD5, CALG_MD5) |
1378 | CRYPTO_CHECK_WIN(SHA1, CALG_SHA1) | |
1379 | CRYPTO_CHECK_WIN(SHA256, CALG_SHA_256) | |
1380 | CRYPTO_CHECK_WIN(SHA384, CALG_SHA_384) | |
1381 | CRYPTO_CHECK_WIN(SHA512, CALG_SHA_512) | |
1382 | ;; | |
1383 | esac | |
1384 | ||
5235554e YG |
1385 | dnl Visibility annotations... |
1386 | saved_CFLAGS="$CFLAGS" | |
1387 | CFLAGS="$CFLAGS -fvisibility=hidden -Werror" | |
1388 | AC_MSG_CHECKING(whether compiler supports visibility annotations) | |
1389 | AC_LINK_IFELSE([AC_LANG_PROGRAM([ | |
1390 | int foo( void ) __attribute__((visibility("default"))); | |
1391 | ])], | |
1392 | [CFLAGS="$saved_CFLAGS -fvisibility=hidden -D__LIBARCHIVE_ENABLE_VISIBILITY"; | |
1393 | AC_MSG_RESULT(yes)], | |
1394 | [CFLAGS="$saved_CFLAGS" | |
1395 | AC_MSG_RESULT(no)]) | |
1396 | ||
af77429c PB |
1397 | # Ensure test directories are present if building out-of-tree |
1398 | AC_CONFIG_COMMANDS([mkdirs], | |
41a759a7 | 1399 | [mkdir -p libarchive/test tar/test cat/test cpio/test]) |
af77429c | 1400 | |
b3cfa26b | 1401 | AC_OUTPUT |