1223311Sdougb/*- 2223311Sdougb * Copyright (c) 2003-2007 Tim Kientzle 3223311Sdougb * All rights reserved. 4223311Sdougb * 5223311Sdougb * Redistribution and use in source and binary forms, with or without 6296943Sian * modification, are permitted provided that the following conditions 7223311Sdougb * are met: 8223311Sdougb * 1. Redistributions of source code must retain the above copyright 9294680Sian * notice, this list of conditions and the following disclaimer. 10294680Sian * 2. Redistributions in binary form must reproduce the above copyright 11294680Sian * notice, this list of conditions and the following disclaimer in the 12294680Sian * documentation and/or other materials provided with the distribution. 13294680Sian * 14294680Sian * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 15294680Sian * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16294680Sian * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17294680Sian * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 18294680Sian * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19294680Sian * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20223311Sdougb * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21223311Sdougb * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22223311Sdougb * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23223311Sdougb * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24230099Sdougb * 25223408Sdougb * $FreeBSD$ 26223311Sdougb */ 27223311Sdougb 28223311Sdougb/* 29223311Sdougb * This header is the first thing included in any of the cpio 30223311Sdougb * source files. As far as possible, platform-specific issues should 31294680Sian * be dealt with here and not within individual source files. 32223311Sdougb */ 33294680Sian 34294680Sian#ifndef CPIO_PLATFORM_H_INCLUDED 35223311Sdougb#define CPIO_PLATFORM_H_INCLUDED 36223311Sdougb 37223311Sdougb#if defined(PLATFORM_CONFIG_H) 38223311Sdougb/* Use hand-built config.h in environments that need it. */ 39223311Sdougb#include PLATFORM_CONFIG_H 40223311Sdougb#else 41223311Sdougb/* Read config.h or die trying. */ 42294680Sian#include "config.h" 43294680Sian#endif 44294680Sian 45294680Sian#if defined(_WIN32) && !defined(__CYGWIN__) 46294680Sian#include "cpio_windows.h" 47294680Sian#endif 48294680Sian 49294680Sian/* Get a real definition for __FBSDID if we can */ 50294680Sian#if HAVE_SYS_CDEFS_H 51294680Sian#include <sys/cdefs.h> 52294680Sian#endif 53294680Sian 54294680Sian/* If not, define it so as to avoid dangling semicolons. */ 55294680Sian#ifndef __FBSDID 56294680Sian#define __FBSDID(a) struct _undefined_hack 57294680Sian#endif 58294680Sian 59294680Sian#ifdef HAVE_LIBARCHIVE 60294680Sian/* If we're using the platform libarchive, include system headers. */ 61223311Sdougb#include <archive.h> 62294680Sian#include <archive_entry.h> 63294680Sian#else 64294680Sian/* Otherwise, include user headers. */ 65294680Sian#include "archive.h" 66294680Sian#include "archive_entry.h" 67294680Sian#endif 68294680Sian 69294680Sian/* How to mark functions that don't return. */ 70294680Sian#if defined(__GNUC__) && (__GNUC__ > 2 || \ 71294680Sian (__GNUC__ == 2 && __GNUC_MINOR__ >= 5)) 72294680Sian#define __LA_DEAD __attribute__((__noreturn__)) 73223311Sdougb#else 74223311Sdougb#define __LA_DEAD 75294680Sian#endif 76294680Sian 77294680Sian#endif /* !CPIO_PLATFORM_H_INCLUDED */ 78223311Sdougb