features.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. /* GNUish things */
  69. #define __CONSTVALUE
  70. #define __CONSTVALUE2
  71. #define __USE_BSD
  72. #define __USE_MISC
  73. #define __USE_POSIX
  74. #define __USE_POSIX2
  75. #define __USE_XOPEN
  76. #undef __KERNEL_STRICT_NAMES
  77. #ifndef _LOOSE_KERNEL_NAMES
  78. # define __KERNEL_STRICT_NAMES
  79. #endif
  80. #ifdef _GNU_SOURCE
  81. # define __USE_GNU 1
  82. #endif
  83. #include <sys/cdefs.h>
  84. #define __need_uClibc_config_h
  85. #include <bits/uClibc_config.h>
  86. #undef __need_uClibc_config_h
  87. /* Some nice features only work properly with ELF */
  88. #if defined HAVE_ELF
  89. # define link_warning(symbol, msg) \
  90. asm (".section " ".gnu.warning." #symbol "\n\t.previous"); \
  91. static const char __evoke_link_warning_##symbol[] \
  92. __attribute__ ((section (".gnu.warning." #symbol "\n\t#"))) = msg;
  93. # define weak_alias(name, aliasname) \
  94. asm(".global " #name ";.weak " #aliasname ";" #aliasname "=" #name ";");
  95. #else
  96. # define link_warning(symbol, msg) \
  97. asm (".stabs \"" msg "\",30,0,0,0\n\t" \
  98. ".stabs \"" #symbol "\",1,0,0,0\n");
  99. # define weak_alias(name, aliasname) \
  100. __asm__(".global alias\n.set alias,original");
  101. #endif
  102. #endif