summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter S. Mazinger <ps.m@gmx.net>2009-10-17 04:27:18 +0200
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2009-11-19 23:12:55 +0100
commite9e0fd1a2ef7757aebef832af6fdc0c306ba87d7 (patch)
tree93f3898cf74096faab6db658abd60e69e9563261
parent343c9c0f915dc7dce19c9b30f2197d61389ef4f4 (diff)
features.h: reorganize
Reorganize so uClibc related changes are better seen when syncing with glibc. Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
-rw-r--r--include/features.h125
1 files changed, 59 insertions, 66 deletions
diff --git a/include/features.h b/include/features.h
index 2ecf1987a..1d47b5660 100644
--- a/include/features.h
+++ b/include/features.h
@@ -19,32 +19,6 @@
#ifndef _FEATURES_H
#define _FEATURES_H 1
-/* This macro indicates that the installed library is uClibc. Use
- * __UCLIBC_MAJOR__ and __UCLIBC_MINOR__ to test for the features in
- * specific releases. */
-#define __UCLIBC__ 1
-
-/* Load up the current set of uClibc supported features along
- * with the current uClibc major and minor version numbers.
- * For uClibc release 0.9.26, these numbers would be:
- * #define __UCLIBC_MAJOR__ 0
- * #define __UCLIBC_MINOR__ 9
- * #define __UCLIBC_SUBLEVEL__ 26
- */
-#define __need_uClibc_config_h
-#include <bits/uClibc_config.h>
-#undef __need_uClibc_config_h
-
-/* For uClibc, always optimize for size -- this should disable
- * a lot of expensive inlining...
- * TODO: this is wrong! __OPTIMIZE_SIZE__ is an indicator of
- * gcc -Os compile. We should not mess with compiler inlines.
- * We should instead disable __USE_EXTERN_INLINES unconditionally,
- * or maybe actually audit and test uclibc to work correctly
- * with __USE_EXTERN_INLINES on.
- */
-#define __OPTIMIZE_SIZE__ 1
-
/* These are defined by the user (or the compiler)
to specify the desired environment:
@@ -186,10 +160,8 @@
# define _XOPEN_SOURCE 700
# undef _XOPEN_SOURCE_EXTENDED
# define _XOPEN_SOURCE_EXTENDED 1
-# ifdef __UCLIBC_HAS_LFS__
-# undef _LARGEFILE64_SOURCE
-# define _LARGEFILE64_SOURCE 1
-# endif /* __UCLIBC_HAS_LFS__ */
+# undef _LARGEFILE64_SOURCE
+# define _LARGEFILE64_SOURCE 1
# undef _BSD_SOURCE
# define _BSD_SOURCE 1
# undef _SVID_SOURCE
@@ -198,6 +170,57 @@
# define _ATFILE_SOURCE 1
#endif
+/* This macro indicates that the installed library is uClibc. Use
+ * __UCLIBC_MAJOR__ and __UCLIBC_MINOR__ to test for the features in
+ * specific releases. */
+#define __UCLIBC__ 1
+
+#ifdef __UCLIBC__
+/* Load up the current set of uClibc supported features along
+ * with the current uClibc major and minor version numbers.
+ * For uClibc release 0.9.26, these numbers would be:
+ * #define __UCLIBC_MAJOR__ 0
+ * #define __UCLIBC_MINOR__ 9
+ * #define __UCLIBC_SUBLEVEL__ 26
+ */
+# define __need_uClibc_config_h
+# include <bits/uClibc_config.h>
+# undef __need_uClibc_config_h
+
+/* For uClibc, always optimize for size -- this should disable
+ * a lot of expensive inlining...
+ * TODO: this is wrong! __OPTIMIZE_SIZE__ is an indicator of
+ * gcc -Os compile. We should not mess with compiler inlines.
+ * We should instead disable __USE_EXTERN_INLINES unconditionally,
+ * or maybe actually audit and test uclibc to work correctly
+ * with __USE_EXTERN_INLINES on.
+ */
+# define __OPTIMIZE_SIZE__ 1
+
+/* disable unsupported features */
+# undef _FORTIFY_SOURCE
+# undef __LDBL_COMPAT
+
+# ifndef __UCLIBC_HAS_THREADS__
+# if defined _REENTRANT || defined _THREAD_SAFE
+# warning requested reentrant code, but thread support was disabled
+# undef _REENTRANT
+# undef _THREAD_SAFE
+# endif
+# endif
+
+# ifndef __UCLIBC_HAS_LFS__
+# undef _LARGEFILE64_SOURCE
+/* NOTE: This is probably incorrect on a 64-bit arch... */
+# if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
+# error It appears you have defined _FILE_OFFSET_BITS=64. Unfortunately, \
+uClibc was built without large file support enabled.
+# endif
+# elif defined __BCC__
+# error BCC does not support LFS, please disable it
+# endif
+#endif /* __UCLIBC__ */
+
/* If nothing (other than _GNU_SOURCE) is defined,
define _BSD_SOURCE and _SVID_SOURCE. */
#if (!defined __STRICT_ANSI__ && !defined _ISOC99_SOURCE && \
@@ -326,8 +349,6 @@
# define __USE_REENTRANT 1
#endif
-/* uClibc does not support _FORTIFY_SOURCE */
-#undef _FORTIFY_SOURCE
#if defined _FORTIFY_SOURCE && _FORTIFY_SOURCE > 0 \
&& __GNUC_PREREQ (4, 1) && defined __OPTIMIZE__ && __OPTIMIZE__ > 0
# if _FORTIFY_SOURCE > 1
@@ -396,7 +417,9 @@
__USE_FILE_OFFSET64 but not __USE_LARGEFILE[64]. */
# if defined __USE_FILE_OFFSET64 && !defined __REDIRECT
# define __USE_LARGEFILE 1
+# ifdef __UCLIBC_HAS_LFS__
# define __USE_LARGEFILE64 1
+# endif
# endif
#endif /* !ASSEMBLER */
@@ -414,41 +437,11 @@
# define __USE_EXTERN_INLINES 1
#endif
-
-/* Make sure users large file options agree with uClibc's configuration. */
-#ifndef __UCLIBC_HAS_LFS__
-
-/* If uClibc was built without large file support, output an error if
- * 64-bit file offsets were requested.
- * NOTE: This is probably incorrect on a 64-bit arch... */
-# ifdef __USE_FILE_OFFSET64
-# error It appears you have defined _FILE_OFFSET_BITS=64. Unfortunately, \
-uClibc was built without large file support enabled.
-# endif
-
-/* If uClibc was built without large file support and _LARGEFILE64_SOURCE
- * is defined, undefine it. */
-# ifdef _LARGEFILE64_SOURCE
-# undef _LARGEFILE64_SOURCE
-# undef __USE_LARGEFILE64
-# endif
-
-/* If we're actually building uClibc with large file support,
- * define __USE_LARGEFILE64 and __USE_LARGEFILE. */
-#elif defined _LIBC
-# undef _LARGEFILE_SOURCE
-# undef _LARGEFILE64_SOURCE
-# undef _FILE_OFFSET_BITS
-# undef __USE_LARGEFILE
-# undef __USE_LARGEFILE64
-# undef __USE_FILE_OFFSET64
-# define _LARGEFILE_SOURCE 1
-# define _LARGEFILE64_SOURCE 1
-# define __USE_LARGEFILE 1
-# define __USE_LARGEFILE64 1
-#endif
-
#ifdef _LIBC
+# ifdef __UCLIBC_HAS_LFS__
+# undef _FILE_OFFSET_BITS
+# undef __USE_FILE_OFFSET64
+# endif
# include <libc-internal.h>
#endif