]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Make the __FBSDID() handling more platform-agnostic by using
authorTim Kientzle <kientzle@gmail.com>
Sun, 1 Nov 2009 06:56:20 +0000 (01:56 -0500)
committerTim Kientzle <kientzle@gmail.com>
Sun, 1 Nov 2009 06:56:20 +0000 (01:56 -0500)
HAVE_SYS_CDEFS_H to control the inclusion of sys/cdefs.h and
defining a fake __FBSDID() macro if we need one.  In particular,
this deals a lot more gracefully with systems that are not
FreeBSD but use FreeBSD-derived system headers.

See Issue 46 on libarchive.googlecode.com for discussion.
Submitted by: cpr420

SVN-Revision: 1565

13 files changed:
CMakeLists.txt
build/cmake/config.h.in
configure.ac
cpio/config_freebsd.h
cpio/cpio_platform.h
cpio/test/test.h
libarchive/archive_platform.h
libarchive/config_freebsd.h
libarchive/test/test.h
libarchive_fe/lafe_platform.h
tar/bsdtar_platform.h
tar/config_freebsd.h
tar/test/test.h

index ed2fde01ac86ccd2d082528448d8610b7c6c7b23..d549c128804be7935787ba753dbbc96380dfe094 100644 (file)
@@ -228,6 +228,7 @@ LA_CHECK_INCLUDE_FILE("stdlib.h" HAVE_STDLIB_H)
 LA_CHECK_INCLUDE_FILE("string.h" HAVE_STRING_H)
 LA_CHECK_INCLUDE_FILE("strings.h" HAVE_STRINGS_H)
 LA_CHECK_INCLUDE_FILE("sys/acl.h" HAVE_SYS_ACL_H)
+LA_CHECK_INCLUDE_FILE("sys/cdefs.h" HAVE_SYS_CDEFS_H)
 LA_CHECK_INCLUDE_FILE("sys/extattr.h" HAVE_SYS_EXTATTR_H)
 LA_CHECK_INCLUDE_FILE("sys/ioctl.h" HAVE_SYS_IOCTL_H)
 LA_CHECK_INCLUDE_FILE("sys/mkdev.h" HAVE_SYS_MKDEV_H)
index be3e0463e670f237f70f214997c4608f84802485..2db556c7925935eaa5d64365dd0818e0bfafd28e 100644 (file)
 /* Define to 1 if you have the <sys/acl.h> header file. */
 #cmakedefine HAVE_SYS_ACL_H 1
 
+/* Define to 1 if you have the <sys/cdefs.h> header file. */
+#cmakedefine HAVE_SYS_CDEFS_H 1
+
 /* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
    */
 #cmakedefine HAVE_SYS_DIR_H 1
index d9652336cc4047fb38b2cea6e8e6d3d23cb3e3cc..21b3a7215dd5783b7d545109bbaf6da077c20585 100644 (file)
@@ -196,7 +196,7 @@ AC_CHECK_HEADERS([ext2fs/ext2_fs.h fcntl.h grp.h])
 AC_CHECK_HEADERS([inttypes.h io.h langinfo.h limits.h linux/fs.h])
 AC_CHECK_HEADERS([locale.h paths.h poll.h pwd.h regex.h signal.h stdarg.h])
 AC_CHECK_HEADERS([stdint.h stdlib.h string.h])
-AC_CHECK_HEADERS([sys/acl.h sys/extattr.h sys/ioctl.h sys/mkdev.h])
+AC_CHECK_HEADERS([sys/acl.h sys/cdefs.h sys/extattr.h sys/ioctl.h sys/mkdev.h])
 AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/select.h sys/time.h sys/utime.h])
 AC_CHECK_HEADERS([time.h unistd.h utime.h wchar.h wctype.h windows.h])
 
index 0d449d993d0f2f11735f0c01b3ae74d77af6c291..c52ddccf9f825cb5089243b0c093914f8fb09f3c 100644 (file)
@@ -44,6 +44,7 @@
 #define        HAVE_STDLIB_H 1
 #define        HAVE_STRING_H 1
 #define        HAVE_SYMLINK 1
+#define        HAVE_SYS_CDEFS_H 1
 #define        HAVE_SYS_STAT_H 1
 #define        HAVE_SYS_TIME_H 1
 #define        HAVE_TIME_H 1
index 57e2450bf6fde9c4eea0ce6b6cfd0c97c7a8c1df..31d9a738fcb0a98da1d6755d0bd131eedeb513cd 100644 (file)
 #include "config.h"
 #endif
 
-/* No non-FreeBSD platform will have __FBSDID, so just define it here. */
-#ifdef __FreeBSD__
-#include <sys/cdefs.h>  /* For __FBSDID */
-#elif !defined(__FBSDID)
-/* Just leaving this macro replacement empty leads to a dangling semicolon. */
+/* Get a real definition for __FBSDID if we can */
+#if HAVE_SYS_CDEFS_H
+#include <sys/cdefs.h>
+#endif
+
+/* If not, define it so as to avoid dangling semicolons. */
+#ifndef __FBSDID
 #define        __FBSDID(a)     struct _undefined_hack
 #endif
 
index bbab584ac854656cb277de46cd1f0afb969a37cc..ca54b9f862d5ef44c24f17efc22a3415518e8ef3 100644 (file)
 #include <stdint.h>
 #endif
 
-/* FreeBSD */
-#ifdef __FreeBSD__
-#include <sys/cdefs.h>  /* For __FBSDID */
-#else
-/* Surprisingly, some non-FreeBSD platforms define __FBSDID. */
+/* Get a real definition for __FBSDID if we can */
+#if HAVE_SYS_CDEFS_H
+#include <sys/cdefs.h>
+#endif
+
+/* If not, define it so as to avoid dangling semicolons. */
 #ifndef __FBSDID
 #define        __FBSDID(a)     struct _undefined_hack
 #endif
-#endif
 
 #ifndef O_BINARY
 #define        O_BINARY 0
index 75abc1bade1a038a8a692ebda7a6f4d339fa943d..6a4b08d219875c82dce61b367127a06d0fe50109 100644 (file)
  * headers as required.
  */
 
-/* No non-FreeBSD platform will have __FBSDID, so just define it here. */
-#ifdef __FreeBSD__
-#include <sys/cdefs.h>  /* For __FBSDID */
-#else
-/* Just leaving this macro replacement empty leads to a dangling semicolon. */
+/* Get a real definition for __FBSDID if we can */
+#if HAVE_SYS_CDEFS_H
+#include <sys/cdefs.h>
+#endif
+
+/* If not, define it so as to avoid dangling semicolons. */
+#ifndef __FBSDID
 #define        __FBSDID(a)     struct _undefined_hack
 #endif
 
index 2ebfe209148b0744d28620768d461ce3bf7ff382..f8a5b7428785c08e5f62bc22575a4ff1efcd42c3 100644 (file)
 #define        HAVE_STRUCT_STAT_ST_FLAGS 1
 #define        HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 1
 #define        HAVE_SYMLINK 1
+#define        HAVE_SYS_CDEFS_H 1
 #define        HAVE_SYS_IOCTL_H 1
 #define        HAVE_SYS_SELECT_H 1
 #define        HAVE_SYS_STAT_H 1
index 3e8d36e875d8ea5061c5b36d3bbf3c671307dd39..f6d9fe77245645bd0785cc189af51b052ca55203 100644 (file)
 #include <stdint.h>
 #endif
 
-/* FreeBSD */
-#ifdef __FreeBSD__
-#include <sys/cdefs.h>  /* For __FBSDID */
-#else
-/* Surprisingly, some non-FreeBSD platforms define __FBSDID. */
+/* Get a real definition for __FBSDID if we can */
+#if HAVE_SYS_CDEFS_H
+#include <sys/cdefs.h>
+#endif
+
+/* If not, define it so as to avoid dangling semicolons. */
 #ifndef __FBSDID
 #define        __FBSDID(a)     struct _undefined_hack
 #endif
-#endif
 
 #ifndef O_BINARY
 #define        O_BINARY 0
index dceb5aaf3e7d482beeae39da9ae62e3b8d772951..557124b9f841b14d51c81a87e2a15211ea4c7ddf 100644 (file)
 #include "config.h"
 #endif
 
-/* No non-FreeBSD platform will have __FBSDID, so just define it here. */
-#ifdef __FreeBSD__
-#include <sys/cdefs.h>  /* For __FBSDID */
-#elif !defined(__FBSDID)
-/* Just leaving this macro replacement empty leads to a dangling semicolon. */
+/* Get a real definition for __FBSDID if we can */
+#if HAVE_SYS_CDEFS_H
+#include <sys/cdefs.h>
+#endif
+
+/* If not, define it so as to avoid dangling semicolons. */
+#ifndef __FBSDID
 #define        __FBSDID(a)     struct _undefined_hack
 #endif
 
index d863913372d88cd92c884b7450623deed249406a..fce9c99815a2768a55671dc2745a03daad65c58e 100644 (file)
 #include "config.h"
 #endif
 
-/* No non-FreeBSD platform will have __FBSDID, so just define it here. */
-#ifdef __FreeBSD__
-#include <sys/cdefs.h>  /* For __FBSDID */
-#else
-/* Just leaving this macro replacement empty leads to a dangling semicolon. */
+/* Get a real definition for __FBSDID if we can */
+#if HAVE_SYS_CDEFS_H
+#include <sys/cdefs.h>
+#endif
+
+/* If not, define it so as to avoid dangling semicolons. */
+#ifndef __FBSDID
 #define        __FBSDID(a)     struct _undefined_hack
 #endif
 
index c0b057adef04730188a0db5bda5de9b359e12f15..02145efc05bfaf5e0b2ae78c5d444b9479d3ba93 100644 (file)
@@ -68,6 +68,7 @@
 #define        HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 1
 #undef HAVE_STRUCT_STAT_ST_UMTIME
 #define        HAVE_SYMLINK 1
+#define        HAVE_SYS_CDEFS_H 1
 #undef HAVE_SYS_DIR_H
 #define        HAVE_SYS_IOCTL_H 1
 #undef HAVE_SYS_NDIR_H
index de219a94552d2a2d74dabd821d765d4c5dfd05a0..ac5940227ff4a39bfc178312ff980c2997c3de70 100644 (file)
 #include <stdint.h>
 #endif
 
-/* FreeBSD */
-#ifdef __FreeBSD__
-#include <sys/cdefs.h>  /* For __FBSDID */
-#else
-/* Surprisingly, some non-FreeBSD platforms define __FBSDID. */
+/* Get a real definition for __FBSDID if we can */
+#if HAVE_SYS_CDEFS_H
+#include <sys/cdefs.h>
+#endif
+
+/* If not, define it so as to avoid dangling semicolons. */
 #ifndef __FBSDID
 #define        __FBSDID(a)     struct _undefined_hack
 #endif
-#endif
 
 #ifndef O_BINARY
 #define        O_BINARY 0