3 # The script is created for Cygnus by vmakarov@cygnus.com and based on
6 # This script is designed for x86 with gnulibc of version 2.0 and less
7 # for solution of problems with invalid asm-statements by creating
8 # small wrappers around the include files containg the asm-statements.
10 # See README-fixinc for more information.
13 # Directory in which to store the results.
14 LIB
=${1?"fixincludes: output directory not specified"}
16 # Make sure it exists.
17 if [ ! -d $LIB ]; then
21 # Make LIB absolute if it is relative.
22 # Don't do this if not necessary, since may screw up automounters.
27 cd $LIB; LIB
=`${PWDCMD-pwd}`
31 echo Building fixed headers
in ${LIB}
34 echo Fixed
$file for glibc-2.0.x
36 cat <<'__EOF__' >$LIB/$file
37 /* This file fixes __FD_ZERO bug for glibc-2.0.x. */
38 #ifndef _SELECTBITS_H_WRAPPER
40 #include_next <selectbits.h>
42 #if defined(__FD_ZERO) && defined(__GLIBC__) && defined(__GLIBC_MINOR__) && __GLIBC__ == 2 && __GLIBC_MINOR__ == 0
44 #define __FD_ZERO(fdsetp) \
47 __asm__ __volatile__ ("cld; rep; stosl" \
48 : "=&c" (__d0), "=&D" (__d1) \
49 : "a" (0), "0" (sizeof (__fd_set) \
50 / sizeof (__fd_mask)), \
51 "1" ((__fd_mask *) (fdsetp)) \
56 #define _SELECTBITS_H_WRAPPER
57 #endif /* _SELECTBITS_H_WRAPPER */
59 # Define _SELECTBITS_H_WRAPPER at the end of the wrapper, not
60 # the start, so that if #include_next gets another instance of
61 # the wrapper, this will follow the #include_next chain until
62 # we arrive at the real <selectbits.h>.
65 # asm/posix_types.h for libc version 1.x
66 file=asm
/posix_types.h
67 echo Fixed
$file for glibc-1.x
69 dir
=`dirname $LIB/$file`
70 if [ ! -d $dir ]; then
71 mkdir
-p $dir ||
exit 1
73 cat <<'__EOF__' >$LIB/$file
74 /* This file fixes __FD_ZERO bug for glibc-1.x. */
75 #ifndef _POSIX_TYPES_H_WRAPPER
77 #include_next <asm/posix_types.h>
79 #if defined(__FD_ZERO) && !defined(__GLIBC__)
81 #define __FD_ZERO(fdsetp) \
84 __asm__ __volatile__("cld ; rep ; stosl" \
85 : "=&c" (__d0), "=&D" (__d1) \
86 : "a" (0), "0" (__FDSET_LONGS), \
87 "1" ((__kernel_fd_set *) (fdsetp)) :"memory"); \
91 #define _POSIX_TYPES_H_WRAPPER
92 #endif /* _POSIX_TYPES_H_WRAPPER */
94 # Define _POSIX_TYPES_H_WRAPPER at the end of the wrapper, not
95 # the start, so that if #include_next gets another instance of
96 # the wrapper, this will follow the #include_next chain until
97 # we arrive at the real <asm/posix_types.h>.
100 # gnu/types.h for libc version 1.x
102 echo Fixed
$file for glibc-1.x
104 dir
=`dirname $LIB/$file`
105 if [ ! -d $dir ]; then
106 mkdir
-p $dir ||
exit 1
108 cat <<'__EOF__' >$LIB/$file
109 /* This file fixes __FD_ZERO bug for glibc-1.x. */
110 #ifndef _TYPES_H_WRAPPER
111 #include <features.h>
112 #include_next <gnu/types.h>
114 #if defined(__FD_ZERO) && !defined(__GLIBC__)
116 # define __FD_ZERO(fdsetp) \
119 __asm__ __volatile__("cld ; rep ; stosl" \
120 : "=&c" (__d0), "=&D" (__d1) \
121 : "a" (0), "0" (__FDSET_LONGS), \
122 "1" ((__fd_set *) (fdsetp)) :"memory"); \
126 #define _TYPES_H_WRAPPER
127 #endif /* _TYPES_H_WRAPPER */
129 # Define _TYPES_H_WRAPPER at the end of the wrapper, not the start,
130 # so that if #include_next gets another instance of the wrapper,
131 # this will follow the #include_next chain until we arrive at
132 # the real <gnu/types.h>.
135 if [ x
${INSTALL_ASSERT_H} != x
]
138 rm -f include
/assert.h
139 cp ${srcdir}/assert.h include
/assert.h ||
exit 1
140 chmod a
+r include
/assert.h