claws-mail/m4/size_max.m4

60 lines
1.9 KiB
Text
Raw Normal View History

2005-12-20 [colin] 1.9.100cvs97 * ABOUT-NLS * Makefile.am * autogen.sh * configure.ac * config/config.rpath * config/mkinstalldirs * m4/Makefile.am * m4/glibc2.m4 * m4/gnupg.m4 * m4/gpgme.m4 * m4/intmax.m4 * m4/longdouble.m4 * m4/longlong.m4 * m4/printf-posix.m4 * m4/signed.m4 * m4/size_max.m4 * m4/ulonglong.m4 * m4/wchar_t.m4 * m4/wint_t.m4 * m4/xsize.m4 * po/Makefile.in.in * po/Makevars * po/bg.po * po/ca.po * po/cs.po * po/de.po * po/el.po * po/en_GB.po * po/es.po * po/fi.po * po/fr.po * po/hr.po * po/hu.po * po/it.po * po/ja.po * po/ko.po * po/nb.po * po/nl.po * po/pl.po * po/pt_BR.po * po/ru.po * po/sk.po * po/sr.po * po/stamp-po * po/sv.po * po/zh_CN.po * po/zh_TW.po * src/Makefile.am * src/codeconv.c * src/compose.c * src/exporthtml.c * src/exportldif.c * src/folder.c * src/main.c * src/manual.c * src/mh.c * src/mimeview.c * src/send_message.c * src/common/Makefile.am * src/common/fnmatch.c * src/common/fnmatch.h * src/common/fnmatch_loop.c * src/common/nntp.c * src/common/plugin.c * src/common/smtp.c * src/common/socket.c * src/common/string_match.c * src/common/sylpheed.c * src/common/utils.c * src/common/utils.h * src/common/w32_dirent.c * src/common/w32_reg.c * src/common/w32_signal.c * src/common/w32_stat.c * src/common/w32_stdio.c * src/common/w32_stdlib.c * src/common/w32_string.c * src/common/w32_time.c * src/common/w32_unistd.c * src/common/w32_wait.c * src/common/w32lib.h * src/etpan/Makefile.am * src/gtk/Makefile.am * src/plugins/clamav/Makefile.am * src/plugins/demo/Makefile.am * src/plugins/dillo_viewer/Makefile.am * src/plugins/pgpcore/Makefile.am * src/plugins/pgpcore/passphrase.c * src/plugins/pgpcore/plugin.def * src/plugins/pgpcore/sgpgme.c * src/plugins/pgpcore/sylpheed.def * src/plugins/pgpcore/version.rc * src/plugins/pgpinline/Makefile.am * src/plugins/pgpinline/plugin.def * src/plugins/pgpinline/sylpheed.def * src/plugins/pgpinline/version.rc * src/plugins/pgpmime/Makefile.am * src/plugins/pgpmime/mypgpcore.def * src/plugins/pgpmime/plugin.def * src/plugins/pgpmime/sylpheed.def * src/plugins/pgpmime/version.rc * src/plugins/spamassassin/Makefile.am Very little ;-) patch from Werner Koch, providing infrastructure for cross-compiling to Win32
2005-12-20 18:43:40 +01:00
# size_max.m4 serial 2
dnl Copyright (C) 2003 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl From Bruno Haible.
AC_DEFUN([gl_SIZE_MAX],
[
AC_CHECK_HEADERS(stdint.h)
dnl First test whether the system already has SIZE_MAX.
AC_MSG_CHECKING([for SIZE_MAX])
result=
AC_EGREP_CPP([Found it], [
#include <limits.h>
#if HAVE_STDINT_H
#include <stdint.h>
#endif
#ifdef SIZE_MAX
Found it
#endif
], result=yes)
if test -z "$result"; then
dnl Define it ourselves. Here we assume that the type 'size_t' is not wider
dnl than the type 'unsigned long'.
dnl The _AC_COMPUTE_INT macro works up to LONG_MAX, since it uses 'expr',
dnl which is guaranteed to work from LONG_MIN to LONG_MAX.
_AC_COMPUTE_INT([~(size_t)0 / 10], res_hi,
[#include <stddef.h>], result=?)
_AC_COMPUTE_INT([~(size_t)0 % 10], res_lo,
[#include <stddef.h>], result=?)
_AC_COMPUTE_INT([sizeof (size_t) <= sizeof (unsigned int)], fits_in_uint,
[#include <stddef.h>], result=?)
if test "$fits_in_uint" = 1; then
dnl Even though SIZE_MAX fits in an unsigned int, it must be of type
dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'.
AC_TRY_COMPILE([#include <stddef.h>
extern size_t foo;
extern unsigned long foo;
], [], fits_in_uint=0)
fi
if test -z "$result"; then
if test "$fits_in_uint" = 1; then
result="$res_hi$res_lo"U
else
result="$res_hi$res_lo"UL
fi
else
dnl Shouldn't happen, but who knows...
result='~(size_t)0'
fi
fi
AC_MSG_RESULT([$result])
if test "$result" != yes; then
AC_DEFINE_UNQUOTED([SIZE_MAX], [$result],
[Define as the maximum value of type 'size_t', if the system doesn't define it.])
fi
])