OSDN Git Service

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