cpp: avoid a gazillion calls to memcpy/memmove
[m6w6/ext-psi] / m4 / ax / ax_check_sign.m4
1 # ===========================================================================
2 # http://www.gnu.org/software/autoconf-archive/ax_check_sign.html
3 # ===========================================================================
4 #
5 # SYNOPSIS
6 #
7 # AX_CHECK_SIGN (TYPE, [ACTION-IF-SIGNED], [ACTION-IF-UNSIGNED], [INCLUDES])
8 #
9 # DESCRIPTION
10 #
11 # Checks whether TYPE is signed or not. If no INCLUDES are specified, the
12 # default includes are used. If ACTION-IF-SIGNED is given, it is
13 # additional shell code to execute when the type is signed. If
14 # ACTION-IF-UNSIGNED is given, it is executed when the type is unsigned.
15 #
16 # This macro assumes that the type exists. Therefore the existence of the
17 # type should be checked before calling this macro. For example:
18 #
19 # AC_CHECK_HEADERS([wchar.h])
20 # AC_CHECK_TYPE([wchar_t],,[ AC_MSG_ERROR([Type wchar_t not found.]) ])
21 # AX_CHECK_SIGN([wchar_t],
22 # [ AC_DEFINE(WCHAR_T_SIGNED, 1, [Define if wchar_t is signed]) ],
23 # [ AC_DEFINE(WCHAR_T_UNSIGNED, 1, [Define if wchar_t is unsigned]) ], [
24 # #ifdef HAVE_WCHAR_H
25 # #include <wchar.h>
26 # #endif
27 # ])
28 #
29 # LICENSE
30 #
31 # Copyright (c) 2008 Ville Laurikari <vl@iki.fi>
32 #
33 # Copying and distribution of this file, with or without modification, are
34 # permitted in any medium without royalty provided the copyright notice
35 # and this notice are preserved. This file is offered as-is, without any
36 # warranty.
37
38 #serial 6
39
40 AC_DEFUN([AX_CHECK_SIGN], [
41 typename=`echo $1 | sed "s/@<:@^a-zA-Z0-9_@:>@/_/g"`
42 AC_CACHE_CHECK([whether $1 is signed], ax_cv_decl_${typename}_signed, [
43 AC_TRY_COMPILE($4,
44 [ int foo @<:@ 1 - 2 * !((($1) -1) < 0) @:>@ ],
45 [ eval "ax_cv_decl_${typename}_signed=\"yes\"" ],
46 [ eval "ax_cv_decl_${typename}_signed=\"no\"" ])])
47 symbolname=`echo $1 | sed "s/@<:@^a-zA-Z0-9_@:>@/_/g" | tr "a-z" "A-Z"`
48 if eval "test \"\${ax_cv_decl_${typename}_signed}\" = \"yes\""; then
49 $2
50 elif eval "test \"\${ax_cv_decl_${typename}_signed}\" = \"no\""; then
51 $3
52 fi
53 ])