summaryrefslogtreecommitdiff
path: root/m4/ax_decl_wchar_max.m4
diff options
context:
space:
mode:
authorReuben Thomas <rrt@sc3d.org>2009-08-06 13:40:02 +0100
committerReuben Thomas <rrt@sc3d.org>2009-08-06 13:40:02 +0100
commit67e8fe88d9a9a1bc930a906bc12310ed3bae9a86 (patch)
tree89393abb338535957334cb73c2a542919a35e3a9 /m4/ax_decl_wchar_max.m4
parent190f63935ec25ddce7ee9a580f55b27d83efac15 (diff)
downloadautoconf-archive-67e8fe88d9a9a1bc930a906bc12310ed3bae9a86.tar.gz
Rename VL_* macros to AX_* macros.
Diffstat (limited to 'm4/ax_decl_wchar_max.m4')
-rw-r--r--m4/ax_decl_wchar_max.m448
1 files changed, 48 insertions, 0 deletions
diff --git a/m4/ax_decl_wchar_max.m4 b/m4/ax_decl_wchar_max.m4
new file mode 100644
index 0000000..9aad3c8
--- /dev/null
+++ b/m4/ax_decl_wchar_max.m4
@@ -0,0 +1,48 @@
+# ===========================================================================
+# http://www.nongnu.org/autoconf-archive/vl_decl_wchar_max.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_DECL_WCHAR_MAX
+#
+# DESCRIPTION
+#
+# Checks whether the system headers define WCHAR_MAX or not. If it is
+# already defined, does nothing. Otherwise checks the size and signedness
+# of `wchar_t', and defines WCHAR_MAX to the maximum value that can be
+# stored in a variable of type `wchar_t'.
+#
+# LICENSE
+#
+# Copyright (c) 2008 Ville Laurikari <vl@iki.fi>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved.
+
+AC_DEFUN([AX_DECL_WCHAR_MAX], [
+ AC_CACHE_CHECK([whether WCHAR_MAX is defined], vl_cv_decl_wchar_max, [
+ AC_TRY_COMPILE([
+#ifdef HAVE_WCHAR_H
+#include <wchar.h>
+#endif
+],[WCHAR_MAX],[vl_cv_decl_wchar_max="yes"],[vl_cv_decl_wchar_max="no"])])
+ if test $vl_cv_decl_wchar_max = "no"; then
+ AX_CHECK_SIGN([wchar_t],
+ [ wc_signed="yes"
+ AC_DEFINE(WCHAR_T_SIGNED, 1, [Define if wchar_t is signed]) ],
+ [ wc_signed="no"
+ AC_DEFINE(WCHAR_T_UNSIGNED, 1, [Define if wchar_t is unsigned])], [
+#ifdef HAVE_WCHAR_H
+#include <wchar.h>
+#endif
+])
+ if test "$wc_signed" = "yes"; then
+ AC_DEFINE(WCHAR_MAX, [(1L << (sizeof(wchar_t) * 8 - 1) - 1)], [
+Define to the maximum value of wchar_t if not already defined elsewhere])
+ elif test "$wc_signed" = "no"; then
+ AC_DEFINE(WCHAR_MAX, [(1L << (sizeof(wchar_t) * 8) - 1)])
+ fi
+ fi
+])dnl