xref: /freebsd/contrib/libarchive/cpio/cpio_platform.h (revision b9128a37faafede823eb456aa65a11ac69997284)
1caf54c4fSMartin Matuska /*-
2caf54c4fSMartin Matuska  * Copyright (c) 2003-2007 Tim Kientzle
3caf54c4fSMartin Matuska  * All rights reserved.
4caf54c4fSMartin Matuska  *
5caf54c4fSMartin Matuska  * Redistribution and use in source and binary forms, with or without
6caf54c4fSMartin Matuska  * modification, are permitted provided that the following conditions
7caf54c4fSMartin Matuska  * are met:
8caf54c4fSMartin Matuska  * 1. Redistributions of source code must retain the above copyright
9caf54c4fSMartin Matuska  *    notice, this list of conditions and the following disclaimer.
10caf54c4fSMartin Matuska  * 2. Redistributions in binary form must reproduce the above copyright
11caf54c4fSMartin Matuska  *    notice, this list of conditions and the following disclaimer in the
12caf54c4fSMartin Matuska  *    documentation and/or other materials provided with the distribution.
13caf54c4fSMartin Matuska  *
14caf54c4fSMartin Matuska  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15caf54c4fSMartin Matuska  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16caf54c4fSMartin Matuska  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17caf54c4fSMartin Matuska  * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18caf54c4fSMartin Matuska  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19caf54c4fSMartin Matuska  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20caf54c4fSMartin Matuska  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21caf54c4fSMartin Matuska  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22caf54c4fSMartin Matuska  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23caf54c4fSMartin Matuska  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24caf54c4fSMartin Matuska  */
25caf54c4fSMartin Matuska 
26caf54c4fSMartin Matuska /*
27caf54c4fSMartin Matuska  * This header is the first thing included in any of the cpio
28caf54c4fSMartin Matuska  * source files.  As far as possible, platform-specific issues should
29caf54c4fSMartin Matuska  * be dealt with here and not within individual source files.
30caf54c4fSMartin Matuska  */
31caf54c4fSMartin Matuska 
32caf54c4fSMartin Matuska #ifndef CPIO_PLATFORM_H_INCLUDED
33caf54c4fSMartin Matuska #define	CPIO_PLATFORM_H_INCLUDED
34caf54c4fSMartin Matuska 
35caf54c4fSMartin Matuska #if defined(PLATFORM_CONFIG_H)
36caf54c4fSMartin Matuska /* Use hand-built config.h in environments that need it. */
37caf54c4fSMartin Matuska #include PLATFORM_CONFIG_H
38caf54c4fSMartin Matuska #else
39caf54c4fSMartin Matuska /* Read config.h or die trying. */
40caf54c4fSMartin Matuska #include "config.h"
41caf54c4fSMartin Matuska #endif
42caf54c4fSMartin Matuska 
43cdf63a70SMartin Matuska #if defined(_WIN32) && !defined(__CYGWIN__)
44cdf63a70SMartin Matuska #include "cpio_windows.h"
45cdf63a70SMartin Matuska #endif
46cdf63a70SMartin Matuska 
47caf54c4fSMartin Matuska #ifdef HAVE_LIBARCHIVE
48caf54c4fSMartin Matuska /* If we're using the platform libarchive, include system headers. */
49caf54c4fSMartin Matuska #include <archive.h>
50caf54c4fSMartin Matuska #include <archive_entry.h>
51caf54c4fSMartin Matuska #else
52caf54c4fSMartin Matuska /* Otherwise, include user headers. */
53caf54c4fSMartin Matuska #include "archive.h"
54caf54c4fSMartin Matuska #include "archive_entry.h"
55caf54c4fSMartin Matuska #endif
56caf54c4fSMartin Matuska 
57caf54c4fSMartin Matuska /* How to mark functions that don't return. */
58caf54c4fSMartin Matuska #if defined(__GNUC__) && (__GNUC__ > 2 || \
59caf54c4fSMartin Matuska                           (__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
60*b9128a37SMartin Matuska #define __LA_NORETURN __attribute__((__noreturn__))
61*b9128a37SMartin Matuska #elif defined(_MSC_VER)
62*b9128a37SMartin Matuska #define __LA_NORETURN __declspec(noreturn)
63caf54c4fSMartin Matuska #else
64*b9128a37SMartin Matuska #define __LA_NORETURN
65caf54c4fSMartin Matuska #endif
66caf54c4fSMartin Matuska 
67caf54c4fSMartin Matuska #endif /* !CPIO_PLATFORM_H_INCLUDED */
68