]>
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. | |
aa296382 TK |
7 | m4_define([LIBARCHIVE_VERSION_S],[3.0.0a]) |
8 | m4_define([LIBARCHIVE_VERSION_N],[3000000]) | |
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()) |
b3cfa26b | 13 | |
77cfbb98 JS |
14 | AC_PREREQ(2.65) |
15 | ||
b3cfa26b TK |
16 | # |
17 | # Now starts the "real" configure script. | |
18 | # | |
19 | ||
20 | AC_INIT([libarchive],LIBARCHIVE_VERSION_S(),[kientzle@freebsd.org]) | |
21 | # Make sure the srcdir contains "libarchive" directory | |
22 | AC_CONFIG_SRCDIR([libarchive]) | |
23 | # Use auxiliary subscripts from this subdirectory (cleans up root) | |
4c9c2bcd | 24 | AC_CONFIG_AUX_DIR([build/autoconf]) |
79cb8e5b | 25 | # M4 scripts |
80b5f20f | 26 | AC_CONFIG_MACRO_DIR([build/autoconf]) |
b3cfa26b TK |
27 | # Must follow AC_CONFIG macros above... |
28 | AM_INIT_AUTOMAKE() | |
29 | ||
30 | # Libtool versioning uses different conventions on different | |
31 | # platforms. At least on FreeBSD, libtool uses an overly complex | |
32 | # convention that attempts to solve problems that most people just | |
33 | # don't have and which just causes confusion for most end users. | |
34 | ARCHIVE_MAJOR=$(( LIBARCHIVE_VERSION_N() / 1000000 )) | |
35 | ARCHIVE_MINOR=$(( (LIBARCHIVE_VERSION_N() / 1000) % 1000 )) | |
36 | ARCHIVE_REVISION=$(( LIBARCHIVE_VERSION_N() % 1000 )) | |
37 | ARCHIVE_LIBTOOL_MAJOR=`echo $((${ARCHIVE_MAJOR} + ${ARCHIVE_MINOR}))` | |
38 | ARCHIVE_LIBTOOL_VERSION=$ARCHIVE_LIBTOOL_MAJOR:$ARCHIVE_REVISION:$ARCHIVE_MINOR | |
39 | ||
40 | # Stick the version numbers into config.h | |
41 | AC_DEFINE([LIBARCHIVE_VERSION_STRING],"LIBARCHIVE_VERSION_S()", | |
42 | [Version number of libarchive]) | |
43 | AC_DEFINE_UNQUOTED([LIBARCHIVE_VERSION_NUMBER],"LIBARCHIVE_VERSION_N()", | |
44 | [Version number of libarchive as a single integer]) | |
45 | AC_DEFINE([BSDCPIO_VERSION_STRING],"BSDCPIO_VERSION_S()", | |
46 | [Version number of bsdcpio]) | |
47 | AC_DEFINE([BSDTAR_VERSION_STRING],"BSDTAR_VERSION_S()", | |
48 | [Version number of bsdtar]) | |
49 | ||
50 | # The shell variables here must be the same as the AC_SUBST() variables | |
51 | # below, but the shell variable names apparently cannot be the same as | |
52 | # the m4 macro names above. Why? Ask autoconf. | |
53 | BSDCPIO_VERSION_STRING=BSDCPIO_VERSION_S() | |
54 | BSDTAR_VERSION_STRING=BSDTAR_VERSION_S() | |
55 | LIBARCHIVE_VERSION_STRING=LIBARCHIVE_VERSION_S() | |
56 | LIBARCHIVE_VERSION_NUMBER=LIBARCHIVE_VERSION_N() | |
57 | ||
58 | # Substitute the above version numbers into the various files below. | |
59 | # Yes, I believe this is the fourth time we define what are essentially | |
60 | # the same symbols. Why? Ask autoconf. | |
61 | AC_SUBST(ARCHIVE_LIBTOOL_VERSION) | |
62 | AC_SUBST(BSDCPIO_VERSION_STRING) | |
63 | AC_SUBST(BSDTAR_VERSION_STRING) | |
64 | AC_SUBST(LIBARCHIVE_VERSION_STRING) | |
65 | AC_SUBST(LIBARCHIVE_VERSION_NUMBER) | |
66 | ||
67 | AC_CONFIG_HEADERS([config.h]) | |
68 | AC_CONFIG_FILES([Makefile]) | |
bafc3c6b | 69 | AC_CONFIG_FILES([build/pkgconfig/libarchive.pc]) |
b3cfa26b | 70 | |
79cb8e5b CW |
71 | # Check for host type |
72 | AC_CANONICAL_HOST | |
73 | ||
74 | dnl Compilation on mingw and Cygwin needs special Makefile rules | |
75 | inc_windows_files=no | |
76 | inc_cygwin_files=no | |
77 | case "$host_os" in | |
78 | *mingw* ) inc_windows_files=yes ;; | |
79 | *cygwin*) inc_cygwin_files=yes ;; | |
80 | esac | |
81 | AM_CONDITIONAL([INC_WINDOWS_FILES], [test $inc_windows_files = yes]) | |
82 | AM_CONDITIONAL([INC_CYGWIN_FILES], [test $inc_cygwin_files = yes]) | |
83 | ||
c31d1bc4 CW |
84 | dnl Defines that are required for specific platforms (e.g. -D_POSIX_SOURCE, etc) |
85 | PLATFORMCPPFLAGS= | |
86 | case "$host_os" in | |
87 | *mingw* ) PLATFORMCPPFLAGS=-D__USE_MINGW_ANSI_STDIO ;; | |
88 | esac | |
89 | AC_SUBST(PLATFORMCPPFLAGS) | |
90 | ||
b3cfa26b TK |
91 | # Checks for programs. |
92 | AC_PROG_CC | |
93 | AM_PROG_CC_C_O | |
6ca9835b | 94 | AC_USE_SYSTEM_EXTENSIONS |
01a4df54 | 95 | AC_LIBTOOL_WIN32_DLL |
b3cfa26b TK |
96 | AC_PROG_LIBTOOL |
97 | AC_CHECK_TOOL([STRIP],[strip]) | |
98 | ||
99 | # | |
100 | # Options for building bsdtar. | |
101 | # | |
102 | # Default is to build bsdtar, but allow people to override that. | |
103 | # | |
104 | AC_ARG_ENABLE([bsdtar], | |
105 | [AS_HELP_STRING([--enable-bsdtar], [enable build of bsdtar (default)]) | |
106 | AS_HELP_STRING([--enable-bsdtar=static], [force static build of bsdtar]) | |
107 | AS_HELP_STRING([--enable-bsdtar=shared], [force dynamic build of bsdtar]) | |
108 | AS_HELP_STRING([--disable-bsdtar], [disable build of bsdtar])], | |
109 | [], [enable_bsdtar=yes]) | |
110 | ||
111 | case "$enable_bsdtar" in | |
112 | yes) | |
113 | if test "$enable_static" = "no"; then | |
114 | static_bsdtar=no | |
115 | else | |
116 | static_bsdtar=yes | |
117 | fi | |
118 | build_bsdtar=yes | |
119 | ;; | |
120 | dynamic|shared) | |
121 | if test "$enable_shared" = "no"; then | |
122 | AC_MSG_FAILURE([Shared linking of bsdtar requires shared libarchive]) | |
123 | fi | |
124 | build_bsdtar=yes | |
125 | static_bsdtar=no | |
126 | ;; | |
127 | static) | |
128 | build_bsdtar=yes | |
129 | static_bsdtar=yes | |
130 | ;; | |
131 | no) | |
132 | build_bsdtar=no | |
133 | static_bsdtar=no | |
134 | ;; | |
135 | *) | |
136 | AC_MSG_FAILURE([Unsupported value for --enable-bsdtar]) | |
137 | ;; | |
138 | esac | |
139 | ||
140 | AM_CONDITIONAL([BUILD_BSDTAR], [ test "$build_bsdtar" = yes ]) | |
141 | AM_CONDITIONAL([STATIC_BSDTAR], [ test "$static_bsdtar" = yes ]) | |
142 | ||
143 | # | |
144 | # Options for building bsdcpio. | |
145 | # | |
146 | # Default is not to build bsdcpio, but that can be overridden. | |
147 | # | |
148 | AC_ARG_ENABLE([bsdcpio], | |
f9a97a03 | 149 | [AS_HELP_STRING([--enable-bsdcpio], [enable build of bsdcpio (default)]) |
b3cfa26b TK |
150 | AS_HELP_STRING([--enable-bsdcpio=static], [static build of bsdcpio]) |
151 | AS_HELP_STRING([--enable-bsdcpio=shared], [dynamic build of bsdcpio]) | |
f9a97a03 TK |
152 | AS_HELP_STRING([--disable-bsdcpio], [disable build of bsdcpio])], |
153 | [], [enable_bsdcpio=yes]) | |
b3cfa26b TK |
154 | |
155 | case "$enable_bsdcpio" in | |
156 | yes) | |
157 | if test "$enable_static" = "no"; then | |
158 | static_bsdcpio=no | |
159 | else | |
160 | static_bsdcpio=yes | |
161 | fi | |
162 | build_bsdcpio=yes | |
163 | ;; | |
164 | dynamic|shared) | |
165 | if test "$enabled_shared" = "no"; then | |
166 | AC_MSG_FAILURE([Shared linking of bsdcpio requires shared libarchive]) | |
167 | fi | |
168 | build_bsdcpio=yes | |
169 | ;; | |
170 | static) | |
171 | build_bsdcpio=yes | |
172 | static_bsdcpio=yes | |
173 | ;; | |
174 | no) | |
175 | build_bsdcpio=no | |
176 | static_bsdcpio=no | |
177 | ;; | |
178 | *) | |
179 | AC_MSG_FAILURE([Unsupported value for --enable-bsdcpio]) | |
180 | ;; | |
181 | esac | |
182 | ||
183 | AM_CONDITIONAL([BUILD_BSDCPIO], [ test "$build_bsdcpio" = yes ]) | |
184 | AM_CONDITIONAL([STATIC_BSDCPIO], [ test "$static_bsdcpio" = yes ]) | |
185 | ||
197cc2d1 CW |
186 | # Set up defines needed before including any headers |
187 | case $host in | |
188 | *mingw* | *cygwin* ) | |
189 | AC_DEFINE([_WIN32_WINNT], 0x0500, [Define to '0x0500' for Windows 2000 APIs.]) | |
190 | AC_DEFINE([WINVER], 0x0500, [Define to '0x0500' for Windows 2000 APIs.]) | |
191 | ;; | |
192 | esac | |
193 | ||
b3cfa26b | 194 | # Checks for header files. |
b3cfa26b TK |
195 | AC_HEADER_DIRENT |
196 | AC_HEADER_SYS_WAIT | |
dc3047d5 | 197 | AC_CHECK_HEADERS([acl/libacl.h attr/xattr.h copyfile.h ctype.h errno.h]) |
d1899374 | 198 | AC_CHECK_HEADERS([ext2fs/ext2_fs.h fcntl.h grp.h iconv.h]) |
d216d028 | 199 | AC_CHECK_HEADERS([inttypes.h io.h langinfo.h limits.h]) |
996334f3 | 200 | AC_CHECK_HEADERS([linux/fiemap.h linux/fs.h linux/magic.h]) |
2008fc21 | 201 | AC_CHECK_HEADERS([locale.h paths.h poll.h pwd.h regex.h signal.h stdarg.h]) |
b21f351a | 202 | AC_CHECK_HEADERS([stdint.h stdlib.h string.h]) |
e3d450a7 MN |
203 | AC_CHECK_HEADERS([sys/acl.h sys/cdefs.h sys/extattr.h sys/ioctl.h]) |
204 | AC_CHECK_HEADERS([sys/mkdev.h sys/mount.h]) | |
0cb2837d | 205 | AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/select.h sys/statfs.h sys/statvfs.h]) |
996334f3 MN |
206 | AC_CHECK_HEADERS([sys/time.h sys/utime.h sys/utsname.h sys/vfs.h]) |
207 | AC_CHECK_HEADERS([time.h unistd.h utime.h wchar.h wctype.h]) | |
d216d028 | 208 | AC_CHECK_HEADERS([windows.h winioctl]) |
b3cfa26b TK |
209 | |
210 | # Checks for libraries. | |
2186dc24 TK |
211 | AC_ARG_WITH([zlib], |
212 | AS_HELP_STRING([--without-zlib], [Don't build support for gzip through zlib])) | |
213 | ||
214 | if test "x$with_zlib" != "xno"; then | |
215 | AC_CHECK_HEADERS([zlib.h]) | |
216 | AC_CHECK_LIB(z,inflate) | |
217 | fi | |
218 | ||
219 | AC_ARG_WITH([bz2lib], | |
220 | AS_HELP_STRING([--without-bz2lib], [Don't build support for bzip2 through bz2lib])) | |
221 | ||
222 | if test "x$with_bz2lib" != "xno"; then | |
223 | AC_CHECK_HEADERS([bzlib.h]) | |
224 | AC_CHECK_LIB(bz2,BZ2_bzDecompressInit) | |
225 | fi | |
226 | ||
227 | AC_ARG_WITH([lzmadec], | |
228 | AS_HELP_STRING([--without-lzmadec], [Don't build support for lzma through lzmadec])) | |
229 | ||
230 | if test "x$with_lzmadec" != "xno"; then | |
231 | AC_CHECK_HEADERS([lzmadec.h]) | |
232 | AC_CHECK_LIB(lzmadec,lzmadec_decode) | |
233 | fi | |
b3cfa26b | 234 | |
c25e0da2 MN |
235 | AC_ARG_WITH([lzma], |
236 | AS_HELP_STRING([--without-lzma], [Don't build support for xz through lzma])) | |
237 | ||
238 | if test "x$with_lzma" != "xno"; then | |
239 | AC_CHECK_HEADERS([lzma.h]) | |
240 | AC_CHECK_LIB(lzma,lzma_stream_decoder) | |
241 | fi | |
242 | ||
eace4421 | 243 | AC_ARG_WITH([openssl], |
d2c0930d MN |
244 | AS_HELP_STRING([--without-openssl], [Don't build support for mtree and xar hashes through openssl])) |
245 | ||
246 | AC_ARG_WITH([xml2], | |
247 | AS_HELP_STRING([--without-xml2], [Don't build support for xar through libxml2])) | |
248 | AC_ARG_WITH([expat], | |
249 | AS_HELP_STRING([--without-expat], [Don't build support for xar through expat])) | |
250 | ||
251 | if test "x$with_xml2" != "xno"; then | |
252 | AC_PATH_PROG([XML2_CONFIG], [xml2-config],, [${PATH}]) | |
253 | if test "x$XML2_CONFIG" != "x"; then | |
254 | CPPFLAGS="${CPPFLAGS} `${XML2_CONFIG} --cflags`" | |
e8610993 | 255 | LIBS="${LIBS} `${XML2_CONFIG} --libs`" |
d2c0930d | 256 | fi |
b7115a7d | 257 | AC_CHECK_HEADERS([libxml/xmlreader.h libxml/xmlwriter.h]) |
d2c0930d MN |
258 | AC_CHECK_LIB(xml2,xmlInitParser) |
259 | fi | |
260 | if test "x$ac_cv_header_libxml_xmlreader_h" != "xyes"; then | |
261 | if test "x$with_expat" != "xno"; then | |
aa5b327f MN |
262 | AC_CHECK_HEADERS([expat.h]) |
263 | AC_CHECK_LIB(expat,XML_ParserCreate) | |
d2c0930d MN |
264 | fi |
265 | fi | |
eace4421 | 266 | |
2ce66f4b JS |
267 | AC_DEFUN([MD_CHECK], [ |
268 | if test "$found_$1" != yes; then | |
269 | saved_LIBS="$LIBS" | |
270 | saved_CPPFLAGS="$CPPFLAGS" | |
271 | CPPFLAGS="$CPPFLAGS -I$srcdir/libarchive" | |
272 | LIBS="$LIBS $4" | |
273 | AC_MSG_CHECKING([support for ARCHIVE_HASH_$1_$2]) | |
01a4df54 | 274 | AC_LINK_IFELSE([AC_LANG_SOURCE([ |
2ce66f4b JS |
275 | #define $1_COMPILE_TEST |
276 | #define ARCHIVE_HASH_$1_$2 | |
277 | #define __LIBARCHIVE_BUILD | |
278 | #include "archive_hash.h" | |
279 | ||
280 | int | |
281 | main(int argc, char **argv) | |
282 | { | |
283 | archive_$3_ctx ctx; | |
284 | ||
285 | archive_$3_init(&ctx); | |
286 | archive_$3_update(&ctx, *argv, argc); | |
287 | archive_$3_final(&ctx, *argv); | |
288 | return 0; | |
289 | } | |
01a4df54 | 290 | ])], |
2ce66f4b JS |
291 | [ AC_MSG_RESULT([yes]) |
292 | found_$1=yes | |
293 | mdLIBS="$mdLIBS $4" | |
294 | AC_DEFINE(ARCHIVE_HASH_$1_$2, 1, [ $1 via ARCHIVE_HASH_$1_$2 supported.]) | |
295 | ], | |
296 | [ AC_MSG_RESULT([no])]) | |
297 | LIBS="$saved_LIBS" | |
298 | CPPFLAGS="$saved_CPPFLAGS" | |
eace4421 | 299 | fi |
2ce66f4b JS |
300 | ]) |
301 | ||
302 | MD_CHECK(MD5, LIBC, md5) | |
8be5e0fa | 303 | MD_CHECK(MD5, LIBSYSTEM, md5) |
2ce66f4b JS |
304 | MD_CHECK(RMD160, LIBC, rmd160) |
305 | MD_CHECK(SHA1, LIBC, sha1) | |
8be5e0fa | 306 | MD_CHECK(SHA1, LIBSYSTEM, sha1) |
2ce66f4b JS |
307 | MD_CHECK(SHA256, LIBC, sha256) |
308 | MD_CHECK(SHA256, LIBC2, sha256) | |
309 | MD_CHECK(SHA256, LIBC3, sha256) | |
8be5e0fa | 310 | MD_CHECK(SHA256, LIBSYSTEM, sha256) |
2ce66f4b JS |
311 | MD_CHECK(SHA384, LIBC, sha384) |
312 | MD_CHECK(SHA384, LIBC2, sha384) | |
313 | MD_CHECK(SHA384, LIBC3, sha384) | |
8be5e0fa | 314 | MD_CHECK(SHA384, LIBSYSTEM, sha384) |
2ce66f4b JS |
315 | MD_CHECK(SHA512, LIBC, sha512) |
316 | MD_CHECK(SHA512, LIBC2, sha512) | |
317 | MD_CHECK(SHA512, LIBC3, sha512) | |
8be5e0fa | 318 | MD_CHECK(SHA512, LIBSYSTEM, sha512) |
6d54e699 | 319 | |
2ce66f4b JS |
320 | if test "x$with_openssl" != "xno"; then |
321 | MD_CHECK(MD5, OPENSSL, md5, -lcrypto) | |
322 | MD_CHECK(RMD160, OPENSSL, rmd160, -lcrypto) | |
323 | MD_CHECK(SHA1, OPENSSL, sha1, -lcrypto) | |
324 | MD_CHECK(SHA256, OPENSSL, sha256, -lcrypto) | |
325 | MD_CHECK(SHA384, OPENSSL, sha384, -lcrypto) | |
326 | MD_CHECK(SHA512, OPENSSL, sha512, -lcrypto) | |
4484ff55 | 327 | fi |
2ce66f4b | 328 | LIBS="$LIBS $mdLIBS" |
22b1a517 | 329 | |
b3cfa26b TK |
330 | # TODO: Give the user the option of using a pre-existing system |
331 | # libarchive. This will define HAVE_LIBARCHIVE which will cause | |
332 | # bsdtar_platform.h to use #include <...> for the libarchive headers. | |
333 | # Need to include Makefile.am magic to link against system | |
334 | # -larchive in that case. | |
335 | #AC_CHECK_LIB(archive,archive_version) | |
336 | ||
337 | # Checks for typedefs, structures, and compiler characteristics. | |
338 | AC_C_CONST | |
92165c97 CW |
339 | # AC_TYPE_UID_T defaults to "int", which is incorrect for MinGW |
340 | # and MSVC. Use a customized version. | |
341 | la_TYPE_UID_T | |
b3cfa26b TK |
342 | AC_TYPE_MODE_T |
343 | # AC_TYPE_OFF_T defaults to "long", which limits us to 4GB files on | |
344 | # most systems... default to "long long" instead. | |
345 | AC_CHECK_TYPE(off_t, [long long]) | |
346 | AC_TYPE_SIZE_T | |
347 | AC_CHECK_TYPE(id_t, [unsigned long]) | |
348 | AC_CHECK_TYPE(uintptr_t, [unsigned int]) | |
8ac32d27 | 349 | |
9d72ea76 MN |
350 | # Check for tm_gmtoff in struct tm |
351 | AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct tm.__tm_gmtoff],,, | |
352 | [ | |
353 | #include <time.h> | |
354 | ]) | |
355 | ||
a3b61f44 MN |
356 | # Check for f_namemax in struct statfs |
357 | AC_CHECK_MEMBERS([struct statfs.f_namemax],,, | |
358 | [ | |
359 | #include <sys/param.h> | |
360 | #include <sys/mount.h> | |
361 | ]) | |
362 | ||
8ac32d27 TK |
363 | # Check for birthtime in struct stat |
364 | AC_CHECK_MEMBERS([struct stat.st_birthtime]) | |
365 | ||
b3cfa26b | 366 | # Check for high-resolution timestamps in struct stat |
8ac32d27 | 367 | AC_CHECK_MEMBERS([struct stat.st_birthtimespec.tv_nsec]) |
b3cfa26b TK |
368 | AC_CHECK_MEMBERS([struct stat.st_mtimespec.tv_nsec]) |
369 | AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec]) | |
d831cc4b BJ |
370 | AC_CHECK_MEMBERS([struct stat.st_mtime_n]) # AIX |
371 | AC_CHECK_MEMBERS([struct stat.st_umtime]) # Tru64 | |
a0b5f839 | 372 | AC_CHECK_MEMBERS([struct stat.st_mtime_usec]) # Hurd |
c15d8e24 TK |
373 | # Check for block size support in struct stat |
374 | AC_CHECK_MEMBERS([struct stat.st_blksize]) | |
c5e9786e TK |
375 | # Check for st_flags in struct stat (BSD fflags) |
376 | AC_CHECK_MEMBERS([struct stat.st_flags]) | |
b3cfa26b TK |
377 | |
378 | # If you have uintmax_t, we assume printf supports %ju | |
379 | # If you have unsigned long long, we assume printf supports %llu | |
380 | # TODO: Check for %ju and %llu support directly. | |
381 | AC_CHECK_TYPES([uintmax_t, unsigned long long]) | |
382 | ||
566a6636 TK |
383 | # We use C99-style integer types |
384 | # Declare them if the local platform doesn't already do so. | |
b3cfa26b | 385 | AC_TYPE_INTMAX_T |
b3cfa26b | 386 | AC_TYPE_UINTMAX_T |
566a6636 | 387 | AC_TYPE_INT64_T |
b3cfa26b | 388 | AC_TYPE_UINT64_T |
566a6636 TK |
389 | AC_TYPE_INT32_T |
390 | AC_TYPE_UINT32_T | |
391 | AC_TYPE_INT16_T | |
392 | AC_TYPE_UINT16_T | |
b3cfa26b | 393 | |
c15d8e24 | 394 | AC_CHECK_DECLS([SIZE_MAX, SSIZE_MAX, INT64_MAX, INT64_MIN, UINT64_MAX, UINT32_MAX]) |
b3cfa26b TK |
395 | |
396 | AC_CHECK_DECL([EFTYPE], | |
397 | [AC_DEFINE(HAVE_EFTYPE, 1, [A possible errno value for invalid file format errors])], | |
398 | [], | |
399 | [#include <errno.h>]) | |
400 | AC_CHECK_DECL([EILSEQ], | |
401 | [AC_DEFINE(HAVE_EILSEQ, 1, [A possible errno value for invalid file format errors])], | |
402 | [], | |
403 | [#include <errno.h>]) | |
778a496c CW |
404 | AC_CHECK_TYPE([wchar_t], |
405 | [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]wchar_t), 1, [Define to 1 if the system has the type `wchar_t'.])dnl | |
406 | AC_CHECK_SIZEOF([wchar_t])], | |
407 | []) | |
408 | ||
b3cfa26b TK |
409 | AC_HEADER_TIME |
410 | ||
411 | # Checks for library functions. | |
412 | AC_PROG_GCC_TRADITIONAL | |
413 | AC_HEADER_MAJOR | |
414 | AC_FUNC_FSEEKO | |
415 | AC_FUNC_MEMCMP | |
416 | AC_FUNC_LSTAT | |
417 | AC_FUNC_STAT | |
418 | AC_FUNC_STRERROR_R | |
419 | AC_FUNC_STRFTIME | |
420 | AC_FUNC_VPRINTF | |
197cc2d1 CW |
421 | # check for: |
422 | # CreateHardLinkA(LPCSTR, LPCSTR, LPSECURITY_ATTRIBUTES) | |
423 | # To avoid necessity for including windows.h or special forward declaration | |
424 | # workarounds, we use 'void *' for 'struct SECURITY_ATTRIBUTES *' | |
425 | AC_CHECK_STDCALL_FUNC([CreateHardLinkA],[const char *, const char *, void *]) | |
411d7de8 | 426 | AC_CHECK_FUNCS([chflags chown chroot ctime_r]) |
ba463cc3 | 427 | AC_CHECK_FUNCS([fchdir fchflags fchmod fchown fcntl fdopendir fork]) |
ba23ec82 | 428 | AC_CHECK_FUNCS([fstat fstatat fstatfs fstatvfs ftruncate futimens futimes]) |
a3b61f44 | 429 | AC_CHECK_FUNCS([geteuid getpid getgrgid_r getgrnam_r]) |
d1899374 | 430 | AC_CHECK_FUNCS([getpwnam_r getpwuid_r getvfsbyname gmtime_r iconv]) |
593c0d35 | 431 | AC_CHECK_FUNCS([lchflags lchmod lchown link localtime_r lstat]) |
9d72ea76 | 432 | AC_CHECK_FUNCS([lutimes mbrtowc memmove memset mkdir mkfifo mknod mkstemp]) |
09654df8 | 433 | AC_CHECK_FUNCS([nl_langinfo openat pipe poll readlink readlinkat]) |
4ba1f7d7 | 434 | AC_CHECK_FUNCS([select setenv setlocale sigaction statfs statvfs]) |
125047fc | 435 | AC_CHECK_FUNCS([strchr strdup strerror strncpy_s strrchr symlink timegm]) |
c9ad879b | 436 | AC_CHECK_FUNCS([tzset unsetenv utime utimensat utimes vfork]) |
86eb88d7 | 437 | AC_CHECK_FUNCS([wcrtomb wcscmp wcscpy wcslen wctomb wmemcmp wmemcpy]) |
ed585028 CW |
438 | # detects cygwin-1.7, as opposed to older versions |
439 | AC_CHECK_FUNCS([cygwin_conv_path]) | |
b3cfa26b | 440 | |
09654df8 TK |
441 | # There are several variants of readdir_r around; we only |
442 | # accept the POSIX-compliant version. | |
443 | AC_COMPILE_IFELSE( | |
444 | [AC_LANG_PROGRAM([[#include <dirent.h>]], | |
445 | [[DIR *dir; struct dirent e, *r; | |
c8f97841 | 446 | return(readdir_r(dir, &e, &r));]])], |
09654df8 TK |
447 | [AC_DEFINE(HAVE_READDIR_R,1,[Define to 1 if you have a POSIX compatible readdir_r])] |
448 | ) | |
449 | ||
b3cfa26b TK |
450 | # FreeBSD's nl_langinfo supports an option to specify whether the |
451 | # current locale uses month/day or day/month ordering. It makes the | |
452 | # output a little prettier... | |
453 | AC_CHECK_DECL([D_MD_ORDER], | |
454 | [AC_DEFINE(HAVE_D_MD_ORDER, 1, [Define to 1 if nl_langinfo supports D_MD_ORDER])], | |
455 | [], | |
456 | [#if HAVE_LANGINFO_H | |
457 | #include <langinfo.h> | |
458 | #endif | |
459 | ]) | |
460 | ||
b3cfa26b TK |
461 | # Check for dirent.d_namlen field explicitly |
462 | # (This is a bit more straightforward than, if not quite as portable as, | |
463 | # the recipe given by the autoconf maintainers.) | |
464 | AC_CHECK_MEMBER(struct dirent.d_namlen,,, | |
465 | [#if HAVE_DIRENT_H | |
466 | #include <dirent.h> | |
467 | #endif | |
468 | ]) | |
469 | ||
470 | # Check for Extended Attributes support | |
471 | AC_ARG_ENABLE([xattr], | |
472 | AS_HELP_STRING([--disable-xattr], | |
473 | [Enable Extended Attributes support (default: check)])) | |
474 | ||
475 | if test "x$enable_xattr" != "xno"; then | |
476 | AC_CHECK_HEADERS([attr/xattr.h]) | |
9204d6e8 | 477 | AC_CHECK_HEADERS([sys/xattr.h sys/ea.h]) |
b3cfa26b | 478 | AC_CHECK_LIB(attr,setxattr) |
faec39ad TK |
479 | AC_CHECK_FUNCS([extattr_get_file extattr_list_file]) |
480 | AC_CHECK_FUNCS([extattr_set_fd extattr_set_file]) | |
0f5b79c8 | 481 | AC_CHECK_FUNCS([fgetxattr flistxattr fsetxattr getxattr]) |
faec39ad | 482 | AC_CHECK_FUNCS([lgetxattr listxattr llistxattr lsetxattr]) |
9204d6e8 BJ |
483 | AC_CHECK_FUNCS([fgetea flistea fsetea getea]) |
484 | AC_CHECK_FUNCS([lgetea listea llistea lsetea]) | |
6d23f1c5 JS |
485 | AC_CHECK_DECLS([EXTATTR_NAMESPACE_USER], [], [], [#include <sys/types.h> |
486 | #include <sys/extattr.h> | |
487 | ]) | |
b3cfa26b TK |
488 | fi |
489 | ||
490 | # Check for ACL support | |
491 | # | |
492 | # The ACL support in libarchive is written against the POSIX1e draft, | |
493 | # which was never officially approved and varies quite a bit across | |
494 | # platforms. Worse, some systems have completely non-POSIX acl functions, | |
495 | # which makes the following checks rather more complex than I would like. | |
496 | # | |
497 | AC_ARG_ENABLE([acl], | |
498 | AS_HELP_STRING([--disable-acl], | |
499 | [Enable ACL support (default: check)])) | |
500 | ||
501 | if test "x$enable_acl" != "xno"; then | |
502 | AC_CHECK_HEADERS([sys/acl.h]) | |
503 | AC_CHECK_LIB([acl],[acl_get_file]) | |
504 | AC_CHECK_FUNCS([acl_create_entry acl_init acl_set_fd acl_set_fd_np acl_set_file]) | |
505 | ||
506 | AC_CHECK_TYPES(acl_permset_t,,, | |
507 | [#if HAVE_SYS_TYPES_H | |
508 | #include <sys/types.h> | |
509 | #endif | |
510 | #if HAVE_SYS_ACL_H | |
511 | #include <sys/acl.h> | |
512 | #endif | |
513 | ]) | |
514 | ||
515 | # The "acl_get_perm()" function was omitted from the POSIX draft. | |
516 | # (It's a pretty obvious oversight; otherwise, there's no way to | |
517 | # test for specific permissions in a permset.) Linux uses the obvious | |
518 | # name, FreeBSD adds _np to mark it as "non-Posix extension." | |
519 | # Test for both as a double-check that we really have POSIX-style ACL support. | |
fc68ea32 | 520 | AC_CHECK_FUNCS(acl_get_perm_np acl_get_perm acl_get_link acl_get_link_np,,, |
b3cfa26b TK |
521 | [#if HAVE_SYS_TYPES_H |
522 | #include <sys/types.h> | |
523 | #endif | |
524 | #if HAVE_SYS_ACL_H | |
525 | #include <sys/acl.h> | |
526 | #endif | |
527 | ]) | |
528 | ||
529 | # MacOS has an acl.h that isn't POSIX. It can be detected by | |
530 | # checking for ACL_USER | |
531 | AC_CHECK_DECL([ACL_USER], | |
532 | [AC_DEFINE(HAVE_ACL_USER, 1, [True for systems with POSIX ACL support])], | |
533 | [], | |
534 | [#include <sys/acl.h>]) | |
535 | fi | |
536 | ||
537 | # Additional requirements | |
538 | AC_SYS_LARGEFILE | |
539 | ||
b3cfa26b | 540 | AC_OUTPUT |