File: configure.in.int64_t

package info (click to toggle)
ns2 2.35%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 78,756 kB
  • ctags: 27,476
  • sloc: cpp: 172,923; tcl: 107,130; perl: 6,391; sh: 6,143; ansic: 5,846; makefile: 812; awk: 525; csh: 355
file content (94 lines) | stat: -rw-r--r-- 2,488 bytes parent folder | download | duplicates (17)
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
dnl autoconf rules for 64-bit integers
dnl $Id: configure.in.int64_t,v 1.7 2009/05/22 19:30:45 tom_henderson Exp $

dnl
dnl start by looking for supporting functions
dnl
AC_CHECK_FUNCS(strtoq strtoll)

dnl
dnl int64_t seems to be what C 9x will have (in stdint.h),
dnl but we're not there yet, so poke around for alternatives.
dnl

INT64_T_ALTERNATIVE=none
HAVE_SUPPORTING_FUNC=false

AC_CHECK_SIZEOF(long,0)
if test $ac_cv_sizeof_long -ge 8
then
	INT64_T_ALTERNATIVE=long
	AC_CHECK_FUNC(strtol)
fi

AC_CACHE_CHECK([for __int64_t],nsnam_cv_int64_t_HAVE___INT64_T,[
AC_TRY_RUN([
main() { __int64_t x; exit (sizeof(x) >= 8 ? 0 : 1); }
],
nsnam_cv_int64_t_HAVE___INT64_T=yes,nsnam_cv_int64_t_HAVE___INT64_T=no,nsnam_cv_int64_t_HAVE___INT64_T=cross)])
if test x"$nsnam_cv_int64_t_HAVE___INT64_T" = x"yes" -a "x$INT64_T_ALTERNATIVE" = xnone; then
	INT64_T_ALTERNATIVE=__int64_t
fi

AC_CACHE_CHECK([for long long],nsnam_cv_int64_t_HAVE_LONG_LONG,[
AC_TRY_RUN([
main() { long long x; exit (sizeof(x) >= 8 ? 0 : 1); }
],
nsnam_cv_int64_t_HAVE_LONG_LONG=yes,nsnam_cv_int64_t_HAVE_LONG_LONG=no,nsnam_cv_int64_t_HAVE_LONG_LONG=cross)])
if test x"$nsnam_cv_int64_t_HAVE_LONG_LONG" = x"yes" -a "x$INT64_T_ALTERNATIVE" = xnone; then
	INT64_T_ALTERNATIVE="long long"
fi

dnl
dnl icky icky
dnl
dnl AC_CHECK_TYPE_UNQUOTED(TYPE, DEFAULT)
AC_DEFUN(AC_CHECK_TYPE_UNQUOTED,
[AC_REQUIRE([AC_HEADER_STDC])dnl
AC_MSG_CHECKING(for $1)
AC_CACHE_VAL(ac_cv_type_$1,
[AC_EGREP_CPP(dnl
changequote(<<,>>)dnl
<<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl
changequote([,]), [#include <sys/types.h>
#if STDC_HEADERS
#include <stdlib.h>
#include <stddef.h>
#endif], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl
AC_MSG_RESULT($ac_cv_type_$1)
if test $ac_cv_type_$1 = no; then
  AC_DEFINE_UNQUOTED([$1], [$2], [description])
fi
])

dnl
dnl now set up int64_t
dnl
AC_CHECK_TYPE_UNQUOTED(int64_t,$INT64_T_ALTERNATIVE)

dnl
dnl and broadcast our discovery
dnl
AC_MSG_CHECKING([which kind of 64-bit int to use])
if test $ac_cv_type_int64_t = yes -o "$INT64_T_ALTERNATIVE" != none
then
	if test "$INT64_T_ALTERNATIVE" = long -o "$ac_cv_func_strtoq" = yes -o "$ac_cv_func_strtoll" = yes
	then
		AC_DEFINE([HAVE_INT64], [1], ["do we have int64 type ?"])
		if test $ac_cv_type_int64_t = yes
		then
			AC_MSG_RESULT([int64_t])
		else
			AC_MSG_RESULT($INT64_T_ALTERNATIVE)
		fi
	else
		AC_MSG_RESULT([missing strto 64-bit-type])
	fi
else
	AC_MSG_RESULT(none)
fi

dnl
dnl see tclcl or ns's config.h for other STRTOI64 and STRTOI64_FMTSTR
dnl