1/*-
2 * Copyright (c) 2003-2007 Tim Kientzle
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 *
25 * $FreeBSD$
26 */
27#ifndef TREE_CONFIG_H_INCLUDED
28#define	TREE_CONFIG_H_INCLUDED
29
30#if defined(PLATFORM_CONFIG_H)
31/*
32 * Use hand-built config.h in environments that need it.
33 */
34#include PLATFORM_CONFIG_H
35#elif defined(HAVE_CONFIG_H)
36/*
37 * Most POSIX platforms use the 'configure' script to build config.h
38 */
39#include "../config.h"
40#elif defined(__FreeBSD__)
41/*
42 * Built-in definitions for FreeBSD.
43 */
44#define	HAVE_DIRENT_D_NAMLEN 1
45#define	HAVE_DIRENT_H 1
46#define	HAVE_ERRNO_H 1
47#define	HAVE_FCNTL_H 1
48#define	HAVE_LIBARCHIVE 1
49#define	HAVE_STDLIB_H 1
50#define	HAVE_STRING_H 1
51#define	HAVE_SYS_STAT_H 1
52#define	HAVE_UNISTD_H 1
53#else
54/*
55 * Warn if there's no platform configuration.
56 */
57#error Oops: No config.h and no built-in configuration in bsdtar_platform.h.
58#endif /* !HAVE_CONFIG_H */
59
60/* No non-FreeBSD platform will have __FBSDID, so just define it here. */
61#ifdef __FreeBSD__
62#include <sys/cdefs.h>  /* For __FBSDID */
63#else
64/* Just leaving this macro replacement empty leads to a dangling semicolon. */
65#define	__FBSDID(a)     struct _undefined_hack
66#endif
67
68#ifdef HAVE_LIBARCHIVE
69/* If we're using the platform libarchive, include system headers. */
70#include <archive.h>
71#include <archive_entry.h>
72#else
73/* Otherwise, include user headers. */
74#include "archive.h"
75#include "archive_entry.h"
76#endif
77
78#endif /* !TREE_CONFIG_H_INCLUDED */
79