File: vl_check_sign.html

package info (click to toggle)
autoconf-archive 20060312-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 4,180 kB
  • ctags: 13
  • sloc: sh: 455; makefile: 44
file content (95 lines) | stat: -rw-r--r-- 2,589 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
 <head>
  <title>
   Autoconf Macro: vl_check_sign
  </title>
  <link rel="stylesheet" type="text/css" href="ac-archive.css">
 </head>
 <body>
  <table summary="web navigation" style="width:100%;">
   <tbody>
    <tr>
     <td style="width:50%;" align="center">
      <a href="http://autoconf-archive.cryp.to/vl_check_sign.m4">Download M4
      Source</a>
     </td>
     <td style="width:50%;" align="center">
      <a href="macros-by-category.html">Macro Index Page</a>
     </td>
    </tr>
   </tbody>
  </table>
  <hr>
  <h1>
   vl_check_sign
  </h1>
  <h2>
   Synopsis
  </h2>
  <p class="indent" style="white-space:nowrap;">
   <code>VL_CHECK_SIGN (TYPE, [ACTION-IF-SIGNED], [ACTION-IF-UNSIGNED],
   [INCLUDES])</code>
  </p>
  <h2>
   Description
  </h2>
  <div class="indent">
   <p>
    Checks whether TYPE is signed or not. If no INCLUDES are specified, the
    default includes are used. If ACTION-IF-SIGNED is given, it is additional
    shell code to execute when the type is signed. If ACTION-IF-UNSIGNED is
    given, it is executed when the type is unsigned.
   </p>
   <p>
    This macro assumes that the type exists. Therefore the existence of the
    type should be checked before calling this macro. For example:
   </p>
   <pre>
  AC_CHECK_HEADERS([wchar.h])
  AC_CHECK_TYPE([wchar_t],,[ AC_MSG_ERROR([Type wchar_t not found.]) ])
  VL_CHECK_SIGN([wchar_t],
    [ AC_DEFINE(WCHAR_T_SIGNED, 1, [Define if wchar_t is signed]) ],
    [ AC_DEFINE(WCHAR_T_UNSIGNED, 1, [Define if wchar_t is unsigned]) ], [
  #ifdef HAVE_WCHAR_H
  #include &lt;wchar.h&gt;
  #endif
  ])
</pre>
  </div>
  <h2>
   Author
  </h2>
  <p class="indent">
   Ville Laurikari &lt;vl@iki.fi&gt;
  </p>
  <h2>
   Last Modified
  </h2>
  <p class="indent">
   2002-04-04
  </p>
  <h2>
   M4 Source Code
  </h2>
  <div class="indent">
   <pre class="m4source">
AC_DEFUN([VL_CHECK_SIGN], [
 typename=`echo $1 | sed "s/@&lt;:@^a-zA-Z0-9_@:&gt;@/_/g"`
 AC_CACHE_CHECK([whether $1 is signed], vl_cv_decl_${typename}_signed, [
   AC_TRY_COMPILE([$4],
     [ int foo @&lt;:@ 1 - 2 * !((($1) -1) &lt; 0) @:&gt;@ ],
     [ eval "vl_cv_decl_${typename}_signed=\"yes\"" ],
     [ eval "vl_cv_decl_${typename}_signed=\"no\"" ])])
 symbolname=`echo $1 | sed "s/@&lt;:@^a-zA-Z0-9_@:&gt;@/_/g" | tr "a-z" "A-Z"`
 if eval "test \"\${vl_cv_decl_${typename}_signed}\" = \"yes\""; then
   $2
 elif eval "test \"\${vl_cv_decl_${typename}_signed}\" = \"no\""; then
   $3
 fi
])dnl
</pre>
  </div>
 </body>
</html>