xref: /freebsd/contrib/libarchive/cpio/cpio_platform.h (revision bd66c1b43e33540205dbc1187c2f2a15c58b57ba)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause
3  *
4  * Copyright (c) 2003-2007 Tim Kientzle
5  * All rights reserved.
6  */
7 
8 /*
9  * This header is the first thing included in any of the cpio
10  * source files.  As far as possible, platform-specific issues should
11  * be dealt with here and not within individual source files.
12  */
13 
14 #ifndef CPIO_PLATFORM_H_INCLUDED
15 #define	CPIO_PLATFORM_H_INCLUDED
16 
17 #if defined(PLATFORM_CONFIG_H)
18 /* Use hand-built config.h in environments that need it. */
19 #include PLATFORM_CONFIG_H
20 #else
21 /* Read config.h or die trying. */
22 #include "config.h"
23 #endif
24 
25 #if defined(_WIN32) && !defined(__CYGWIN__)
26 #include "cpio_windows.h"
27 #endif
28 
29 #ifdef HAVE_LIBARCHIVE
30 /* If we're using the platform libarchive, include system headers. */
31 #include <archive.h>
32 #include <archive_entry.h>
33 #else
34 /* Otherwise, include user headers. */
35 #include "archive.h"
36 #include "archive_entry.h"
37 #endif
38 
39 /* How to mark functions that don't return. */
40 #if defined(__GNUC__) && (__GNUC__ > 2 || \
41                           (__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
42 #define __LA_NORETURN __attribute__((__noreturn__))
43 #elif defined(_MSC_VER)
44 #define __LA_NORETURN __declspec(noreturn)
45 #else
46 #define __LA_NORETURN
47 #endif
48 
49 #endif /* !CPIO_PLATFORM_H_INCLUDED */
50