~ubuntu-branches/ubuntu/hardy/autoconf-archive/hardy

« back to all changes in this revision

Viewing changes to htmldoc/ac_need_stdint_h.html

  • Committer: Bazaar Package Importer
  • Author(s): Martin A. Godisch
  • Date: 2004-06-26 09:43:57 UTC
  • Revision ID: james.westby@ubuntu.com-20040626094357-3be3jwcz1vcdhpe8
Tags: upstream-20040616
ImportĀ upstreamĀ versionĀ 20040616

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
 
2
"http://www.w3.org/TR/html4/strict.dtd">
 
3
 
 
4
<html lang="en">
 
5
<head>
 
6
  <title>Autoconf Macro: ac_need_stdint_h</title>
 
7
  <link rel="stylesheet" type="text/css" href="ac-archive.css">
 
8
</head>
 
9
 
 
10
<body>
 
11
  <table summary="web navigation" style="width:100%;">
 
12
    <tbody>
 
13
      <tr>
 
14
        <td style="width:50%;" align="center">[<a href="index.html">Macro Index
 
15
        Page</a>]</td>
 
16
 
 
17
        <td style="width:50%;" align="center">[<a href=
 
18
        "../m4source/ac_need_stdint_h.m4">Download M4 Source</a>]</td>
 
19
      </tr>
 
20
    </tbody>
 
21
  </table>
 
22
  <hr>
 
23
 
 
24
  <h1>ac_need_stdint_h</h1>
 
25
 
 
26
  <h2>Synopsis</h2>
 
27
 
 
28
  <div class="indent">
 
29
    <p style="text-align:left; white-space:nowrap;"><code>AC_NEED_STDINT_H [(
 
30
    HEADER-TO-GENERATE [, HEDERS-TO-CHECK])]</code></p>
 
31
  </div>
 
32
 
 
33
  <h2>Description</h2>
 
34
 
 
35
  <div class="indent">
 
36
    <p>obsoleted - superseded by AC_CREATE_STDINT_H</p>
 
37
 
 
38
    <p>the "ISO C9X: 7.18 Integer types &lt;stdint.h&gt;" section requires the
 
39
    existence of an include file &lt;stdint.h&gt; that defines a set of
 
40
    typedefs, especially uint8_t,int32_t,uintptr_t. Many older installations
 
41
    will not provide this file, but some will have the very same definitions in
 
42
    &lt;inttypes.h&gt;. In other enviroments we can use the inet-types in
 
43
    &lt;sys/types.h&gt; which would define the typedefs int8_t and u_int8_t
 
44
    respectivly.</p>
 
45
 
 
46
    <p>This macros will create a local "stdint.h" if it cannot find the global
 
47
    &lt;stdint.h&gt; (or it will create the headerfile given as an argument).
 
48
    In many cases that file will just have a singular "#include
 
49
    &lt;inttypes.h&gt;" statement, while in other environments it will provide
 
50
    the set of basic stdint's defined:
 
51
    int8_t,uint8_t,int16_t,uint16_t,int32_t,uint32_t,intptr_t,uintptr_t
 
52
    int_least32_t.. int_fast32_t.. intmax_t which may or may not rely on the
 
53
    definitions of other files, or using the AC_COMPILE_CHECK_SIZEOF macro to
 
54
    determine the actual sizeof each type.</p>
 
55
 
 
56
    <p>if your header files require the stdint-types you will want to create an
 
57
    installable file package-stdint.h that all your other installable header
 
58
    may include. So if you have a library package named "mylib", just use</p>
 
59
    <pre>
 
60
     AC_NEED_STDINT(zziplib-stdint.h) 
 
61
</pre>
 
62
 
 
63
    <p>in configure.in and go to install that very header file in Makefile.am
 
64
    along with the other headers (mylib.h) - and the mylib-specific headers can
 
65
    simply use "#include &lt;mylib-stdint.h&gt;" to obtain the
 
66
    stdint-types.</p>
 
67
 
 
68
    <p>Remember, if the system already had a valid &lt;stdint.h&gt;, the
 
69
    generated file will include it directly. No need for fuzzy HAVE_STDINT_H
 
70
    things...</p>
 
71
  </div>
 
72
 
 
73
  <h2>Version</h2>
 
74
 
 
75
  <div class="indent">
 
76
    <p>1.5 (last modified: 2003-02-02)</p>
 
77
  </div>
 
78
 
 
79
  <h2>Author</h2>
 
80
 
 
81
  <div class="indent">
 
82
    <p>Guido Draheim &lt;guidod@gmx.de&gt;</p>
 
83
  </div>
 
84
 
 
85
  <h2>M4 Source Code</h2>
 
86
 
 
87
  <div class="indent">
 
88
    <pre class="m4source">
 
89
AC_DEFUN([AC_NEED_STDINT_H],
 
90
[AC_MSG_CHECKING([for stdint-types])
 
91
 ac_cv_header_stdint="no-file"
 
92
 ac_cv_header_stdint_u="no-file"
 
93
 for i in $1 inttypes.h sys/inttypes.h sys/int_types.h stdint.h ; do
 
94
   AC_CHECK_TYPEDEF_(uint32_t, $i, [ac_cv_header_stdint=$i])
 
95
 done
 
96
 for i in $1 sys/types.h inttypes.h sys/inttypes.h sys/int_types.h ; do
 
97
   AC_CHECK_TYPEDEF_(u_int32_t, $i, [ac_cv_header_stdint_u=$i])
 
98
 done
 
99
 dnl debugging: __AC_MSG( !$ac_cv_header_stdint!$ac_cv_header_stdint_u! ...)
 
100
 
 
101
 ac_stdint_h=`echo ifelse($1, , stdint.h, $1)`
 
102
 if test "$ac_cv_header_stdint" != "no-file" ; then
 
103
   if test "$ac_cv_header_stdint" != "$ac_stdint_h" ; then
 
104
     AC_MSG_RESULT(found in $ac_cv_header_stdint)
 
105
     echo "#include &lt;$ac_cv_header_stdint&gt;" &gt;$ac_stdint_h
 
106
     AC_MSG_RESULT(creating $ac_stdint_h - (just to include  $ac_cv_header_stdint) )
 
107
   else
 
108
     AC_MSG_RESULT(found in $ac_stdint_h)
 
109
   fi
 
110
   ac_cv_header_stdint_generated=false
 
111
 elif test "$ac_cv_header_stdint_u" != "no-file" ; then
 
112
   AC_MSG_RESULT(found u_types in $ac_cv_header_stdint_u)
 
113
   if test $ac_cv_header_stdint = "$ac_stdint_h" ; then
 
114
     AC_MSG_RESULT(creating $ac_stdint_h - includes $ac_cv_header_stdint, expect problems!)
 
115
   else
 
116
     AC_MSG_RESULT(creating $ac_stdint_h - (include inet-types in $ac_cv_header_stdint_u and re-typedef))
 
117
   fi
 
118
echo "#ifndef __AC_STDINT_H" &gt;$ac_stdint_h
 
119
echo "#define __AC_STDINT_H" '"'$ac_stdint_h'"' &gt;&gt;$ac_stdint_h
 
120
echo "#ifndef _GENERATED_STDINT_H" &gt;&gt;$ac_stdint_h
 
121
echo "#define _GENERATED_STDINT_H" '"'$PACKAGE $VERSION'"' &gt;&gt;$ac_stdint_h
 
122
   cat &gt;&gt;$ac_stdint_h &lt;&lt;EOF
 
123
 
 
124
#include &lt;stddef.h&gt;
 
125
#include &lt;$ac_cv_header_stdint_u&gt;
 
126
 
 
127
/* int8_t int16_t int32_t defined by inet code */
 
128
typedef u_int8_t uint8_t;
 
129
typedef u_int16_t uint16_t;
 
130
typedef u_int32_t uint32_t;
 
131
 
 
132
/* it's a networkable system, but without any stdint.h */
 
133
/* hence it's an older 32-bit system... (a wild guess that seems to work) */
 
134
typedef u_int32_t uintptr_t;
 
135
typedef   int32_t  intptr_t;
 
136
EOF
 
137
   ac_cv_header_stdint_generated=true
 
138
 else
 
139
   AC_MSG_RESULT(not found, need to guess the types now... )
 
140
   AC_COMPILE_CHECK_SIZEOF(long, 32)
 
141
   AC_COMPILE_CHECK_SIZEOF(void*, 32)
 
142
   AC_MSG_RESULT( creating $ac_stdint_h - using detected values for sizeof long and sizeof void* )
 
143
echo "#ifndef __AC_STDINT_H" &gt;$ac_stdint_h
 
144
echo "#define __AC_STDINT_H" '"'$ac_stdint_h'"' &gt;&gt;$ac_stdint_h
 
145
echo "#ifndef _GENERATED_STDINT_H" &gt;&gt;$ac_stdint_h
 
146
echo "#define _GENERATED_STDINT_H" '"'$PACKAGE $VERSION'"' &gt;&gt;$ac_stdint_h
 
147
   cat &gt;&gt;$ac_stdint_h &lt;&lt;EOF
 
148
 
 
149
/* ISO C 9X: 7.18 Integer types &lt;stdint.h&gt; */
 
150
 
 
151
#define __int8_t_defined  
 
152
typedef   signed char    int8_t;
 
153
typedef unsigned char   uint8_t;
 
154
typedef   signed short  int16_t;
 
155
typedef unsigned short uint16_t;
 
156
EOF
 
157
 
 
158
   if test "$ac_cv_sizeof_long" = "64" ; then
 
159
     cat &gt;&gt;$ac_stdint_h &lt;&lt;EOF
 
160
 
 
161
typedef   signed int    int32_t;
 
162
typedef unsigned int   uint32_t;
 
163
typedef   signed long   int64_t;
 
164
typedef unsigned long  uint64_t;
 
165
#define  int64_t  int64_t
 
166
#define uint64_t uint64_t
 
167
EOF
 
168
 
 
169
   else
 
170
    cat &gt;&gt;$ac_stdint_h &lt;&lt;EOF
 
171
 
 
172
typedef   signed long   int32_t;
 
173
typedef unsigned long  uint32_t;
 
174
EOF
 
175
 
 
176
   fi
 
177
   if test "$ac_cv_sizeof_long" != "$ac_cv_sizeof_voidp" ; then
 
178
     cat &gt;&gt;$ac_stdint_h &lt;&lt;EOF
 
179
 
 
180
typedef   signed int   intptr_t;
 
181
typedef unsigned int  uintptr_t;
 
182
EOF
 
183
   else
 
184
     cat &gt;&gt;$ac_stdint_h &lt;&lt;EOF
 
185
 
 
186
typedef   signed long   intptr_t;
 
187
typedef unsigned long  uintptr_t;
 
188
EOF
 
189
     ac_cv_header_stdint_generated=true
 
190
   fi
 
191
 fi   
 
192
 
 
193
 if "$ac_cv_header_stdint_generated" ; then
 
194
     cat &gt;&gt;$ac_stdint_h &lt;&lt;EOF
 
195
 
 
196
typedef  int8_t    int_least8_t;
 
197
typedef  int16_t   int_least16_t;
 
198
typedef  int32_t   int_least32_t;
 
199
 
 
200
typedef uint8_t   uint_least8_t;
 
201
typedef uint16_t  uint_least16_t;
 
202
typedef uint32_t  uint_least32_t;
 
203
 
 
204
typedef  int8_t    int_fast8_t; 
 
205
typedef  int32_t   int_fast16_t;
 
206
typedef  int32_t   int_fast32_t;
 
207
 
 
208
typedef uint8_t   uint_fast8_t; 
 
209
typedef uint32_t  uint_fast16_t;
 
210
typedef uint32_t  uint_fast32_t;
 
211
 
 
212
typedef long int       intmax_t;
 
213
typedef unsigned long uintmax_t;
 
214
 
 
215
 /* once */
 
216
#endif
 
217
#endif
 
218
EOF
 
219
  fi dnl
 
220
])
 
221
 
 
222
 
 
223
</pre>
 
224
  </div>
 
225
 
 
226
  <h2>Copyright</h2>
 
227
 
 
228
  <div class="indent">
 
229
    <a href="COPYING.html">GNU General Public License</a> with this special
 
230
    <a href="COPYING-Exception.html">exception</a>.
 
231
  </div>
 
232
</body>
 
233
</html>