1 # ===========================================================================
2 # https://www.gnu.org/software/autoconf-archive/ax_check_sign.html
3 # ===========================================================================
7 # AX_CHECK_SIGN (TYPE, [ACTION-IF-SIGNED], [ACTION-IF-UNSIGNED], [INCLUDES])
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.
16 # This macro assumes that the type exists. Therefore the existence of the
17 # type should be checked before calling this macro. For example:
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]) ], [
31 # Copyright (c) 2008 Ville Laurikari <vl@iki.fi>
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
40 AU_ALIAS([VL_CHECK_SIGN], [AX_CHECK_SIGN])
41 AC_DEFUN([AX_CHECK_SIGN], [
42 typename=`echo $1 | sed "s/@<:@^a-zA-Z0-9_@:>@/_/g"`
43 AC_CACHE_CHECK([whether $1 is signed], ax_cv_decl_${typename}_signed, [
45 [ int foo @<:@ 1 - 2 * !((($1) -1) < 0) @:>@ ],
46 [ eval "ax_cv_decl_${typename}_signed=\"yes\"" ],
47 [ eval "ax_cv_decl_${typename}_signed=\"no\"" ])])
48 symbolname=`echo $1 | sed "s/@<:@^a-zA-Z0-9_@:>@/_/g" | tr "a-z" "A-Z"`
49 if eval "test \"\${ax_cv_decl_${typename}_signed}\" = \"yes\""; then
51 elif eval "test \"\${ax_cv_decl_${typename}_signed}\" = \"no\""; then