1 dnl configure.in.int64_t --
2 dnl
3 dnl autoconf rules for 64-bit integers
4 dnl
5 dnl Copyright (c) 2000-2002 The Regents of the University of California.
6 dnl All rights reserved.
7 dnl
8 dnl Redistribution and use in source and binary forms, with or without
9 dnl modification, are permitted provided that the following conditions are met:
10 dnl
11 dnl A. Redistributions of source code must retain the above copyright notice,
12 dnl this list of conditions and the following disclaimer.
13 dnl B. Redistributions in binary form must reproduce the above copyright
14 dnl notice, this list of conditions and the following disclaimer in the
15 dnl documentation and/or other materials provided with the distribution.
16 dnl C. Neither the names of the copyright holders nor the names of its
17 dnl contributors may be used to endorse or promote products derived from
18 dnl this software without specific prior written permission.
19 dnl
20 dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
21 dnl IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 dnl THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 dnl PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
24 dnl LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 dnl CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 dnl SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 dnl INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 dnl CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 dnl ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 dnl POSSIBILITY OF SUCH DAMAGE.
31 dnl
32 dnl $Id: configure.in.int64_t,v 1.2 2002/02/03 03:02:48 lim Exp $
33
34 dnl
35 dnl start by looking for supporting functions
36 dnl
37 AC_CHECK_FUNCS(strtoq strtoll)
38
39 dnl
40 dnl int64_t seems to be what C 9x will have (in stdint.h),
41 dnl but we're not there yet, so poke around for alternatives.
42 dnl
43
44 INT64_T_ALTERNATIVE=none
45 HAVE_SUPPORTING_FUNC=false
46
47 AC_CHECK_SIZEOF(long,0)
48 if test $ac_cv_sizeof_long -ge 8
49 then
50 INT64_T_ALTERNATIVE=long
51 AC_CHECK_FUNC(strtol)
52 fi
53
54 AC_CACHE_CHECK([for __int64_t],int64_t_HAVE___INT64_T,[
55 AC_TRY_RUN([
56 main() { __int64_t x; exit (sizeof(x) >= 8 ? 0 : 1); }
57 ],
58 int64_t_HAVE___INT64_T=yes,int64_t_HAVE___INT64_T=no,int64_t_HAVE___INT64_T=cross)])
59 if test x"$int64_t_HAVE___INT64_T" = x"yes" -a "x$INT64_T_ALTERNATIVE" = xnone; then
60 INT64_T_ALTERNATIVE=__int64_t
61 fi
62
63 AC_CACHE_CHECK([for long long],int64_t_HAVE_LONG_LONG,[
64 AC_TRY_RUN([
65 main() { long long x; exit (sizeof(x) >= 8 ? 0 : 1); }
66 ],
67 int64_t_HAVE_LONG_LONG=yes,int64_t_HAVE_LONG_LONG=no,int64_t_HAVE_LONG_LONG=cross)])
68 if test x"$int64_t_HAVE_LONG_LONG" = x"yes" -a "x$INT64_T_ALTERNATIVE" = xnone; then
69 INT64_T_ALTERNATIVE="long long"
70 fi
71
72 dnl
73 dnl icky icky
74 dnl
75 dnl AC_CHECK_TYPE_UNQUOTED(TYPE, DEFAULT)
76 AC_DEFUN(AC_CHECK_TYPE_UNQUOTED,
77 [AC_REQUIRE([AC_HEADER_STDC])dnl
78 AC_MSG_CHECKING(for $1)
79 AC_CACHE_VAL(ac_cv_type_$1,
80 [AC_EGREP_CPP(dnl
81 changequote(<<,>>)dnl
82 <<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl
83 changequote([,]), [#include <sys/types.h>
84 #if STDC_HEADERS
85 #include <stdlib.h>
86 #include <stddef.h>
87 #endif], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl
88 AC_MSG_RESULT($ac_cv_type_$1)
89 if test $ac_cv_type_$1 = no; then
90 AC_DEFINE_UNQUOTED($1, $2)
91 fi
92 ])
93
94 dnl
95 dnl now set up int64_t
96 dnl
97 AC_CHECK_TYPE_UNQUOTED(int64_t,$INT64_T_ALTERNATIVE)
98
99 dnl
100 dnl and broadcast our discovery
101 dnl
102 AC_MSG_CHECKING([which kind of 64-bit int to use])
103 if test $ac_cv_type_int64_t = yes -o "$INT64_T_ALTERNATIVE" != none
104 then
105 if test "$INT64_T_ALTERNATIVE" = long -o "$ac_cv_func_strtoq" = yes -o "$ac_cv_func_strtoll" = yes
106 then
107 AC_DEFINE(HAVE_INT64)
108 if test $ac_cv_type_int64_t = yes
109 then
110 AC_MSG_RESULT([int64_t])
111 else
112 AC_MSG_RESULT($INT64_T_ALTERNATIVE)
113 fi
114 else
115 AC_MSG_RESULT([missing strto 64-bit-type])
116 fi
117 else
118 AC_MSG_RESULT(none)
119 fi
120
121 dnl
122 dnl see tclcl or ns's config.h for other STRTOI64 and STRTOI64_FMTSTR
123 dnl
124
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.