160b4ad09SPeter Avalos /*- 260b4ad09SPeter Avalos * Copyright (c) 2003-2007 Tim Kientzle 360b4ad09SPeter Avalos * All rights reserved. 460b4ad09SPeter Avalos * 560b4ad09SPeter Avalos * Redistribution and use in source and binary forms, with or without 660b4ad09SPeter Avalos * modification, are permitted provided that the following conditions 760b4ad09SPeter Avalos * are met: 860b4ad09SPeter Avalos * 1. Redistributions of source code must retain the above copyright 960b4ad09SPeter Avalos * notice, this list of conditions and the following disclaimer. 1060b4ad09SPeter Avalos * 2. Redistributions in binary form must reproduce the above copyright 1160b4ad09SPeter Avalos * notice, this list of conditions and the following disclaimer in the 1260b4ad09SPeter Avalos * documentation and/or other materials provided with the distribution. 1360b4ad09SPeter Avalos * 1460b4ad09SPeter Avalos * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 1560b4ad09SPeter Avalos * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1660b4ad09SPeter Avalos * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 1760b4ad09SPeter Avalos * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 1860b4ad09SPeter Avalos * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 1960b4ad09SPeter Avalos * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2060b4ad09SPeter Avalos * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2160b4ad09SPeter Avalos * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2260b4ad09SPeter Avalos * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 2360b4ad09SPeter Avalos * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2460b4ad09SPeter Avalos * 258029ab02SPeter Avalos * $FreeBSD: src/usr.bin/cpio/cpio_platform.h,v 1.2 2008/12/06 07:15:42 kientzle Exp $ 2660b4ad09SPeter Avalos */ 2760b4ad09SPeter Avalos 2860b4ad09SPeter Avalos /* 2960b4ad09SPeter Avalos * This header is the first thing included in any of the cpio 3060b4ad09SPeter Avalos * source files. As far as possible, platform-specific issues should 3160b4ad09SPeter Avalos * be dealt with here and not within individual source files. 3260b4ad09SPeter Avalos */ 3360b4ad09SPeter Avalos 3460b4ad09SPeter Avalos #ifndef CPIO_PLATFORM_H_INCLUDED 3560b4ad09SPeter Avalos #define CPIO_PLATFORM_H_INCLUDED 3660b4ad09SPeter Avalos 3760b4ad09SPeter Avalos #if defined(PLATFORM_CONFIG_H) 3860b4ad09SPeter Avalos /* Use hand-built config.h in environments that need it. */ 3960b4ad09SPeter Avalos #include PLATFORM_CONFIG_H 4060b4ad09SPeter Avalos #else 419c82a63eSPeter Avalos /* Read config.h or die trying. */ 429c82a63eSPeter Avalos #include "config.h" 439c82a63eSPeter Avalos #endif 4460b4ad09SPeter Avalos 45*6b384f39SPeter Avalos #if defined(_WIN32) && !defined(__CYGWIN__) 46*6b384f39SPeter Avalos #include "cpio_windows.h" 47*6b384f39SPeter Avalos #endif 48*6b384f39SPeter Avalos 499c82a63eSPeter Avalos /* Get a real definition for __FBSDID if we can */ 509c82a63eSPeter Avalos #if HAVE_SYS_CDEFS_H 519c82a63eSPeter Avalos #include <sys/cdefs.h> 529c82a63eSPeter Avalos #endif 539c82a63eSPeter Avalos 549c82a63eSPeter Avalos /* If not, define it so as to avoid dangling semicolons. */ 559c82a63eSPeter Avalos #ifndef __FBSDID 5660b4ad09SPeter Avalos #define __FBSDID(a) struct _undefined_hack 5760b4ad09SPeter Avalos #endif 5860b4ad09SPeter Avalos 5960b4ad09SPeter Avalos #ifdef HAVE_LIBARCHIVE 6060b4ad09SPeter Avalos /* If we're using the platform libarchive, include system headers. */ 6160b4ad09SPeter Avalos #include <archive.h> 6260b4ad09SPeter Avalos #include <archive_entry.h> 6360b4ad09SPeter Avalos #else 6460b4ad09SPeter Avalos /* Otherwise, include user headers. */ 6560b4ad09SPeter Avalos #include "archive.h" 6660b4ad09SPeter Avalos #include "archive_entry.h" 6760b4ad09SPeter Avalos #endif 6860b4ad09SPeter Avalos 698029ab02SPeter Avalos /* How to mark functions that don't return. */ 708029ab02SPeter Avalos #if defined(__GNUC__) && (__GNUC__ > 2 || \ 718029ab02SPeter Avalos (__GNUC__ == 2 && __GNUC_MINOR__ >= 5)) 728029ab02SPeter Avalos #define __LA_DEAD __attribute__((__noreturn__)) 738029ab02SPeter Avalos #else 748029ab02SPeter Avalos #define __LA_DEAD 758029ab02SPeter Avalos #endif 768029ab02SPeter Avalos 7760b4ad09SPeter Avalos #endif /* !CPIO_PLATFORM_H_INCLUDED */ 78