2 * Copyright (c) 2003-2004 Tim Kientzle
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer
10 * in this position and unchanged.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 * $FreeBSD: src/usr.bin/tar/bsdtar_platform.h,v 1.11 2004/11/06 18:38:13 kientzle Exp $
30 * This header is the first thing included in any of the bsdtar
31 * source files. As far as possible, platform-specific issues should
32 * be dealt with here and not within individual source files.
35 #ifndef BSDTAR_PLATFORM_H_INCLUDED
36 #define BSDTAR_PLATFORM_H_INCLUDED
43 /* A default configuration for FreeBSD, used if there is no config.h. */
44 #define PACKAGE_NAME "bsdtar"
46 #define HAVE_BZLIB_H 1
47 #define HAVE_CHFLAGS 1
48 #define HAVE_DIRENT_H 1
49 #define HAVE_D_MD_ORDER 1
51 #define HAVE_FCNTL_H 1
52 #define HAVE_FNMATCH 1
53 #define HAVE_FTRUNCATE 1
54 #define HAVE_GETOPT_LONG 1
55 #define HAVE_INTTYPES_H 1
56 #define HAVE_LANGINFO_H 1
57 #define HAVE_LIBARCHIVE 1
60 #define HAVE_LIMITS_H 1
61 #define HAVE_LOCALE_H 1
63 #define HAVE_MEMMOVE 1
64 #define HAVE_MEMORY_H 1
66 #if __FreeBSD_version >= 450002 /* nl_langinfo introduced */
67 #define HAVE_NL_LANGINFO 1
69 #define HAVE_PATHS_H 1
70 #define HAVE_SETLOCALE 1
71 #define HAVE_STDINT_H 1
72 #define HAVE_STDLIB_H 1
75 #define HAVE_STRERROR 1
76 #define HAVE_STRFTIME 1
77 #define HAVE_STRINGS_H 1
78 #define HAVE_STRING_H 1
79 #define HAVE_STRRCHR 1
80 #define HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 1
81 #define HAVE_STRUCT_STAT_ST_RDEV 1
83 #define HAVE_SYS_ACL_H 1
85 #define HAVE_SYS_IOCTL_H 1
86 #define HAVE_SYS_PARAM_H 1
87 #define HAVE_SYS_STAT_H 1
88 #define HAVE_SYS_TYPES_H 1
89 #define HAVE_UINTMAX_T 1
90 #define HAVE_UNISTD_H 1
91 #define HAVE_VPRINTF 1
93 #define STDC_HEADERS 1
95 #else /* !__FreeBSD__ */
96 /* Warn if the library hasn't been (automatically or manually) configured. */
97 #error Oops: No config.h and no built-in configuration in archive_platform.h.
98 #endif /* !__FreeBSD__ */
100 #endif /* !HAVE_CONFIG_H */
102 /* No non-FreeBSD platform will have __FBSDID, so just define it here. */
104 #include <sys/cdefs.h> /* For __FBSDID */
106 #define __FBSDID(a) /* null */
109 #ifndef HAVE_LIBARCHIVE
110 #error Configuration error: did not find libarchive.
113 /* TODO: Test for the functions we use as well... */
115 #define HAVE_POSIX_ACLS 1
119 * We need to be able to display a filesize using printf(). The type
120 * and format string here must be compatible with one another and
121 * large enough for any file.
124 #define BSDTAR_FILESIZE_TYPE uintmax_t
125 #define BSDTAR_FILESIZE_PRINTF "%ju"
127 #if HAVE_UNSIGNED_LONG_LONG
128 #define BSDTAR_FILESIZE_TYPE unsigned long long
129 #define BSDTAR_FILESIZE_PRINTF "%llu"
131 #define BSDTAR_FILESIZE_TYPE unsigned long
132 #define BSDTAR_FILESIZE_PRINTF "%lu"
136 #if HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC
137 #define ARCHIVE_STAT_MTIME_NANOS(st) (st)->st_mtimespec.tv_nsec
139 #if HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
140 #define ARCHIVE_STAT_MTIME_NANOS(st) (st)->st_mtim.tv_nsec
142 #define ARCHIVE_STAT_MTIME_NANOS(st) (0)
146 #endif /* !BSDTAR_PLATFORM_H_INCLUDED */