OSDN Git Service

Replace FSF snail mail address with URLs
[uclinux-h8/uClibc.git] / include / features.h
index 5ee2b33..dcf1348 100644 (file)
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
 
 #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:
 
 # 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
 # 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 __LDBL_COMPAT
+
+# ifndef __UCLIBC_HAS_FORTIFY__
+#  undef _FORTIFY_SOURCE
+# endif
+
+# 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 && \
 # 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
 /* This macro indicates that the installed library is the GNU C Library.
    For historic reasons the value now is 6 and this will stay from now
    on.  The use of this variable is deprecated.  */
-# undef  __GNU_LIBRARY__
-# define __GNU_LIBRARY__ 6
+/* uClibc WARNING: leave these aligned to the left, don't put a space after '#', else
+ * broken apps could fail the check. */
+#undef  __GNU_LIBRARY__
+#define __GNU_LIBRARY__ 6
 
 /* Major and minor version number of the GNU C library package.  Use
    these macros to test for features in specific releases.  */
 /* Don't do it, if you want to keep uClibc happy.  */
-# define       __GLIBC__       2
-# define       __GLIBC_MINOR__ 2
+#define        __GLIBC__       2
+#define        __GLIBC_MINOR__ 2
 #endif
 
 #define __GLIBC_PREREQ(maj, min) \
    __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 */
  */
 #if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \
     && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__ \
-    && (defined __extern_inline || defined __GNUC_GNU_INLINE__)
+    && (defined __extern_inline || defined __GNUC_GNU_INLINE__ || defined __GNUC_STDC_INLINE__)
 # 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