aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGravatar Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-05-26 13:10:10 +0000
committerGravatar Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-05-26 13:10:10 +0000
commite00fc16aaa0c1adb27bca40a9871b165c3ca3fb7 (patch)
treef7fa57904f8e69310988294c52ddb23e703a9c29 /include
parent7fd9983c568d447d66d41c3132d3800e895f3f5a (diff)
downloadbusybox-e00fc16aaa0c1adb27bca40a9871b165c3ca3fb7.tar.gz
busybox-e00fc16aaa0c1adb27bca40a9871b165c3ca3fb7.tar.bz2
- move libc checks from busybox.h to platform.h
- add ATTRIBUTE_ALWAYS_INLINE, endian handling for DEC UNIX, some more compiler dependent defines to platform.h - add conditional bb_setpgrp define to platform.h - remove superfluous specifying args from "#define fdprintf dprintf"
Diffstat (limited to 'include')
-rw-r--r--include/busybox.h8
-rw-r--r--include/platform.h105
2 files changed, 101 insertions, 12 deletions
diff --git a/include/busybox.h b/include/busybox.h
index 59d800e8b..1f9f9775f 100644
--- a/include/busybox.h
+++ b/include/busybox.h
@@ -15,16 +15,8 @@
#include <sys/types.h>
#include <sys/stat.h>
-#if __GNU_LIBRARY__ < 5 && \
- !defined(__dietlibc__) && \
- !defined(_NEWLIB_VERSION)
-#error "Sorry, this libc version is not supported :("
-#endif
-
extern const char BB_BANNER[];
-#include <features.h>
-
/* Pull in the utility routines from libbb */
#include "libbb.h"
diff --git a/include/platform.h b/include/platform.h
index 62b4efba9..68cd2cc8e 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -33,6 +33,26 @@
# endif
#endif
+#undef inline
+#if __STDC_VERSION__ > 199901L
+/* it's a keyword */
+#else
+# if __GNUC_PREREQ (2,7)
+# define inline __inline__
+# else
+# define inline
+# endif
+#endif
+
+#ifndef __const
+# define __const const
+#endif
+
+#ifndef __THROW
+# define __THROW
+#endif
+
+
#ifndef ATTRIBUTE_UNUSED
# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
#endif /* ATTRIBUTE_UNUSED */
@@ -49,6 +69,14 @@
# define ATTRIBUTE_ALIGNED(m) __attribute__ ((__aligned__(m)))
#endif /* ATTRIBUTE_ALIGNED */
+#ifndef ATTRIBUTE_ALWAYS_INLINE
+# if __GNUC_PREREQ (3,0)
+# define ATTRIBUTE_ALWAYS_INLINE __attribute__ ((always_inline)) inline
+# else
+# define ATTRIBUTE_ALWAYS_INLINE inline
+# endif
+#endif
+
/* -fwhole-program makes all symbols local. The attribute externally_visible
forces a symbol global. */
#ifndef ATTRIBUTE_EXTERNALLY_VISIBLE
@@ -69,11 +97,18 @@
#endif
/* ---- Endian Detection ------------------------------------ */
-#ifndef __APPLE__
+#if !defined __APPLE__ && !(defined __digital__ && defined __unix__)
# include <byteswap.h>
# include <endian.h>
#endif
+#if (defined __digital__ && defined __unix__)
+# include <sex.h>
+# define __BIG_ENDIAN__ (BYTE_ORDER == BIG_ENDIAN)
+# define __BYTE_ORDER BYTE_ORDER
+#endif
+
+
#ifdef __BIG_ENDIAN__
# define BB_BIG_ENDIAN 1
# define BB_LITTLE_ENDIAN 0
@@ -92,19 +127,81 @@
# include <netinet/in.h>
#endif
+#ifndef __socklen_t_defined
+typedef int socklen_t;
+#endif
+
+/* ---- Compiler dependent settings ------------------------- */
+#ifndef __GNUC__
+#if defined __INTEL_COMPILER
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
+#endif /* __INTEL_COMPILER */
+#endif /* ifndef __GNUC__ */
+
+#if (defined __digital__ && defined __unix__)
+# undef HAVE_STDBOOL_H
+# undef HAVE_MNTENT_H
+#else
+# define HAVE_STDBOOL_H 1
+# define HAVE_MNTENT_H 1
+#endif /* ___digital__ && __unix__ */
+
/*----- Kernel versioning ------------------------------------*/
#ifdef __linux__
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
-#else
-#error implement KERNEL_VERSION for your platform
#endif
/* ---- miscellaneous --------------------------------------- */
+
+#if __GNU_LIBRARY__ < 5 && \
+ !defined(__dietlibc__) && \
+ !defined(_NEWLIB_VERSION) && \
+ !(defined __digital__ && defined __unix__)
+#error "Sorry, this libc version is not supported :("
+#endif
+
+#if defined __GLIBC__ || defined __UCLIBC__ \
+ || defined __dietlibc__ || defined _NEWLIB_VERSION
+#include <features.h>
+#define HAVE_FEATURES_H
+#include <stdint.h>
+#define HAVE_STDINT_H
+#else
+/* Largest integral types. */
+#if __BIG_ENDIAN__
+typedef long int intmax_t;
+typedef unsigned long int uintmax_t;
+#else
+__extension__
+typedef long long int intmax_t;
+__extension__
+typedef unsigned long long int uintmax_t;
+#endif
+#endif
+
+#if (defined __digital__ && defined __unix__)
+#include <standards.h>
+#define HAVE_STANDARDS_H
+#include <inttypes.h>
+#define HAVE_INTTYPES_H
+#define PRIu32 "u"
+#endif
+
+
/* NLS stuff */
/* THIS SHOULD BE CLEANED OUT OF THE TREE ENTIRELY */
#define _(Text) Text
#define N_(Text) (Text)
-#define fdprintf(...) dprintf(__VA_ARGS__)
+/* THIS SHOULD BE CLEANED OUT OF THE TREE ENTIRELY */
+#define fdprintf dprintf
+/* move to platform.c */
+#if (defined __digital__ && defined __unix__)
+/* use legacy setpgrp(pidt_,pid_t) for now.. */
+#define bb_setpgrp do{pid_t __me = getpid();setpgrp(__me,__me);}while(0)
+#else
+#define bb_setpgrp setpgrp()
+#endif
#endif /* platform.h */