tree_config.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*-
  2. * Copyright (c) 2003-2007 Tim Kientzle
  3. * All rights reserved.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions
  7. * are met:
  8. * 1. Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. * 2. Redistributions in binary form must reproduce the above copyright
  11. * notice, this list of conditions and the following disclaimer in the
  12. * documentation and/or other materials provided with the distribution.
  13. *
  14. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
  15. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  16. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  17. * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
  18. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  19. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  20. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  21. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  22. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  23. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24. *
  25. * $FreeBSD$
  26. */
  27. #ifndef TREE_CONFIG_H_INCLUDED
  28. #define TREE_CONFIG_H_INCLUDED
  29. #if defined(PLATFORM_CONFIG_H)
  30. /*
  31. * Use hand-built config.h in environments that need it.
  32. */
  33. #include PLATFORM_CONFIG_H
  34. #elif defined(HAVE_CONFIG_H)
  35. /*
  36. * Most POSIX platforms use the 'configure' script to build config.h
  37. */
  38. #include "../config.h"
  39. #elif defined(__FreeBSD__)
  40. /*
  41. * Built-in definitions for FreeBSD.
  42. */
  43. #define HAVE_DIRENT_D_NAMLEN 1
  44. #define HAVE_DIRENT_H 1
  45. #define HAVE_ERRNO_H 1
  46. #define HAVE_FCNTL_H 1
  47. #define HAVE_LIBARCHIVE 1
  48. #define HAVE_STDLIB_H 1
  49. #define HAVE_STRING_H 1
  50. #define HAVE_SYS_STAT_H 1
  51. #define HAVE_UNISTD_H 1
  52. #else
  53. /*
  54. * Warn if there's no platform configuration.
  55. */
  56. #error Oops: No config.h and no built-in configuration in bsdtar_platform.h.
  57. #endif /* !HAVE_CONFIG_H */
  58. /* No non-FreeBSD platform will have __FBSDID, so just define it here. */
  59. #ifdef __FreeBSD__
  60. #include <sys/cdefs.h> /* For __FBSDID */
  61. #else
  62. /* Just leaving this macro replacement empty leads to a dangling semicolon. */
  63. #define __FBSDID(a) struct _undefined_hack
  64. #endif
  65. #ifdef HAVE_LIBARCHIVE
  66. /* If we're using the platform libarchive, include system headers. */
  67. #include <archive.h>
  68. #include <archive_entry.h>
  69. #else
  70. /* Otherwise, include user headers. */
  71. #include "archive.h"
  72. #include "archive_entry.h"
  73. #endif
  74. #endif /* !TREE_CONFIG_H_INCLUDED */