xref: /dflybsd-src/contrib/libarchive/cat/bsdcat_platform.h (revision 6b384f3989c11f4c0078ee986d3d85a2da3bf92a)
1*6b384f39SPeter Avalos /*-
2*6b384f39SPeter Avalos  * Copyright (c) 2003-2007 Tim Kientzle
3*6b384f39SPeter Avalos  * All rights reserved.
4*6b384f39SPeter Avalos  *
5*6b384f39SPeter Avalos  * Redistribution and use in source and binary forms, with or without
6*6b384f39SPeter Avalos  * modification, are permitted provided that the following conditions
7*6b384f39SPeter Avalos  * are met:
8*6b384f39SPeter Avalos  * 1. Redistributions of source code must retain the above copyright
9*6b384f39SPeter Avalos  *    notice, this list of conditions and the following disclaimer.
10*6b384f39SPeter Avalos  * 2. Redistributions in binary form must reproduce the above copyright
11*6b384f39SPeter Avalos  *    notice, this list of conditions and the following disclaimer in the
12*6b384f39SPeter Avalos  *    documentation and/or other materials provided with the distribution.
13*6b384f39SPeter Avalos  *
14*6b384f39SPeter Avalos  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15*6b384f39SPeter Avalos  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16*6b384f39SPeter Avalos  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17*6b384f39SPeter Avalos  * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18*6b384f39SPeter Avalos  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19*6b384f39SPeter Avalos  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20*6b384f39SPeter Avalos  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21*6b384f39SPeter Avalos  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22*6b384f39SPeter Avalos  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23*6b384f39SPeter Avalos  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24*6b384f39SPeter Avalos  *
25*6b384f39SPeter Avalos  * $FreeBSD: src/usr.bin/tar/bsdtar_platform.h,v 1.26 2008/12/06 07:37:14 kientzle Exp $
26*6b384f39SPeter Avalos  */
27*6b384f39SPeter Avalos 
28*6b384f39SPeter Avalos /*
29*6b384f39SPeter Avalos  * This header is the first thing included in any of the bsdtar
30*6b384f39SPeter Avalos  * source files.  As far as possible, platform-specific issues should
31*6b384f39SPeter Avalos  * be dealt with here and not within individual source files.
32*6b384f39SPeter Avalos  */
33*6b384f39SPeter Avalos 
34*6b384f39SPeter Avalos #ifndef BSDCAT_PLATFORM_H_INCLUDED
35*6b384f39SPeter Avalos #define	BSDCAT_PLATFORM_H_INCLUDED
36*6b384f39SPeter Avalos 
37*6b384f39SPeter Avalos #if defined(PLATFORM_CONFIG_H)
38*6b384f39SPeter Avalos /* Use hand-built config.h in environments that need it. */
39*6b384f39SPeter Avalos #include PLATFORM_CONFIG_H
40*6b384f39SPeter Avalos #else
41*6b384f39SPeter Avalos /* Not having a config.h of some sort is a serious problem. */
42*6b384f39SPeter Avalos #include "config.h"
43*6b384f39SPeter Avalos #endif
44*6b384f39SPeter Avalos 
45*6b384f39SPeter Avalos /* Get a real definition for __FBSDID if we can */
46*6b384f39SPeter Avalos #if HAVE_SYS_CDEFS_H
47*6b384f39SPeter Avalos #include <sys/cdefs.h>
48*6b384f39SPeter Avalos #endif
49*6b384f39SPeter Avalos 
50*6b384f39SPeter Avalos /* If not, define it so as to avoid dangling semicolons. */
51*6b384f39SPeter Avalos #ifndef __FBSDID
52*6b384f39SPeter Avalos #define	__FBSDID(a)     struct _undefined_hack
53*6b384f39SPeter Avalos #endif
54*6b384f39SPeter Avalos 
55*6b384f39SPeter Avalos #ifdef HAVE_LIBARCHIVE
56*6b384f39SPeter Avalos /* If we're using the platform libarchive, include system headers. */
57*6b384f39SPeter Avalos #include <archive.h>
58*6b384f39SPeter Avalos #include <archive_entry.h>
59*6b384f39SPeter Avalos #else
60*6b384f39SPeter Avalos /* Otherwise, include user headers. */
61*6b384f39SPeter Avalos #include "archive.h"
62*6b384f39SPeter Avalos #include "archive_entry.h"
63*6b384f39SPeter Avalos #endif
64*6b384f39SPeter Avalos 
65*6b384f39SPeter Avalos /* How to mark functions that don't return. */
66*6b384f39SPeter Avalos /* This facilitates use of some newer static code analysis tools. */
67*6b384f39SPeter Avalos #undef __LA_DEAD
68*6b384f39SPeter Avalos #if defined(__GNUC__) && (__GNUC__ > 2 || \
69*6b384f39SPeter Avalos 			  (__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
70*6b384f39SPeter Avalos #define	__LA_DEAD	__attribute__((__noreturn__))
71*6b384f39SPeter Avalos #else
72*6b384f39SPeter Avalos #define	__LA_DEAD
73*6b384f39SPeter Avalos #endif
74*6b384f39SPeter Avalos 
75*6b384f39SPeter Avalos #endif /* !BSDCAT_PLATFORM_H_INCLUDED */
76