features.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. #ifndef __FEATURES_H
  2. #define __FEATURES_H
  3. /* Major and minor version number of the uClibc library package. Use
  4. these macros to test for features in specific releases. */
  5. #define __UCLIBC__ 0
  6. #define __UCLIBC_MAJOR__ 9
  7. #define __UCLIBC_MINOR__ 5
  8. /* There is an unwholesomely huge amount of code out there that depends on the
  9. * presence of GNU libc header files. We have GNU libc header files. So here
  10. * we commit a horrible sin. At this point, we _lie_ and claim to be GNU libc
  11. * to make things like /usr/include/linux/socket.h and lots of apps work as
  12. * their developers intended. This is IMHO, pardonable, since these defines
  13. * are not really intended to check for the presence of a particular library,
  14. * but rather are used to define an _interface_. */
  15. #if !defined _LIBC || defined __FORCE_GLIBC__
  16. # define __GNU_LIBRARY__ 6
  17. # define __GLIBC__ 2
  18. # define __GLIBC_MINOR__ 1
  19. #endif
  20. /* Make a half-hearted attempt to accomodate non-gcc compilers */
  21. #ifndef __GNUC__
  22. #define __attribute(foo) /* Ignore */
  23. #endif
  24. /* Convenience macro to test the version of gcc.
  25. * Use it like this:
  26. * #if __GNUC_PREREQ (2,8)
  27. * ... code requiring gcc 2.8 or later ...
  28. * #endif
  29. * Note - they won't work for gcc1, since the _MINOR macros
  30. * were not defined then. */
  31. #if defined __GNUC__ && defined __GNUC_MINOR__
  32. #define __GNUC_PREREQ(maj, min) \
  33. ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
  34. #else
  35. #define __GNUC_PREREQ(maj,min) 0
  36. #endif
  37. /* __restrict is known in EGCS 1.2 and above. */
  38. #if !defined __GNUC__ || __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 92)
  39. # define __restrict /* Ignore */
  40. #endif
  41. /* __extension__ is known in gcc 2.8 above. */
  42. #if !defined __GNUC__ || __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
  43. # define __extension__ /* Ignore */
  44. #endif
  45. #ifdef __STDC__
  46. #define __P(x) x
  47. #define __PMT(x) x
  48. #ifndef __const
  49. #define __const const
  50. #endif
  51. /* Almost ansi */
  52. #if __STDC__ != 1
  53. #ifndef const
  54. #define const
  55. #endif
  56. #define volatile
  57. #endif
  58. #else /* K&R */
  59. #define __P(x) ()
  60. #ifndef __const
  61. #define __const
  62. #endif
  63. #ifndef const
  64. #define const
  65. #endif
  66. #define volatile
  67. #endif
  68. /* No C++ */
  69. #define __BEGIN_DECLS
  70. #define __END_DECLS
  71. /* GNUish things */
  72. #define __CONSTVALUE
  73. #define __CONSTVALUE2
  74. #define __USE_BSD
  75. #define __USE_MISC
  76. #define __USE_POSIX
  77. #define __USE_POSIX2
  78. #define __USE_XOPEN
  79. #undef __KERNEL_STRICT_NAMES
  80. #ifndef _LOOSE_KERNEL_NAMES
  81. # define __KERNEL_STRICT_NAMES
  82. #endif
  83. #ifdef _GNU_SOURCE
  84. # define __USE_GNU 1
  85. #endif
  86. #include <sys/cdefs.h>
  87. #define __need_uClibc_config_h
  88. #include <bits/uClibc_config.h>
  89. #undef __need_uClibc_config_h
  90. /* Some nice features only work properly with ELF */
  91. #if defined HAVE_ELF
  92. # define link_warning(symbol, msg) \
  93. asm (".section " ".gnu.warning." #symbol "\n\t.previous"); \
  94. static const char __evoke_link_warning_##symbol[] \
  95. __attribute__ ((section (".gnu.warning." #symbol "\n\t#"))) = msg;
  96. # define weak_alias(name, aliasname) \
  97. extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));
  98. #else
  99. # define link_warning(symbol, msg) \
  100. asm (".stabs \"" msg "\",30,0,0,0\n\t" \
  101. ".stabs \"" #symbol "\",1,0,0,0\n");
  102. # define weak_alias(name, aliasname) \
  103. __asm__(".global alias\n.set alias,original");
  104. #endif
  105. #endif