+
+#if defined(__GNU_LIBRARY__) && __GNU_LIBRARY__ < 5 && \
+ !defined(__dietlibc__) && \
+ !defined(_NEWLIB_VERSION) && \
+ !(defined __digital__ && defined __unix__)
+# error "Sorry, this libc version is not supported :("
+#endif
+
+// Don't perpetuate e2fsck crap into the headers. Clean up e2fsck instead.
+
+#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
+
+/* uclibc does not implement daemon() for no-mmu systems.
+ * For 0.9.29 and svn, __ARCH_USE_MMU__ indicates no-mmu reliably.
+ * For earlier versions there is no reliable way to check if we are building
+ * for a mmu-less system; the user should pass EXTRA_CFLAGS="-DBB_NOMMU"
+ * on his own.
+ */
+#if defined __UCLIBC__ && __UCLIBC_MAJOR__ >= 0 && __UCLIBC_MINOR__ >= 9 && \
+ __UCLIBC_SUBLEVEL__ > 28 && !defined __ARCH_USE_MMU__
+#define BB_NOMMU
+#endif
+
+/* Platforms that haven't got dprintf need to implement fdprintf() in
+ * libbb. This would require a platform.c. It's not going to be cleaned
+ * out of the tree, so stop saying it should be. */
+#if !defined(__dietlibc__)
+/* Needed for: glibc */
+/* Not needed for: dietlibc */
+/* Others: ?? (add as needed) */
+#define fdprintf dprintf
+#endif
+
+#if defined(__dietlibc__)
+static ATTRIBUTE_ALWAYS_INLINE char* strchrnul(const char *s, char c) {
+ while (*s && *s != c) ++s;
+ return (char*)s;
+}
+#endif
+
+/* Don't use lchown with glibc older than 2.1.x ... uC-libc lacks it */
+#if (defined __GLIBC__ && __GLIBC__ <= 2 && __GLIBC_MINOR__ < 1) || \
+ defined __UC_LIBC__
+# define lchown chown
+#endif
+