b28c74ed5545c1247d0aaff239ee1d843a8f1b1e
[awesomized/libmemcached] / m4 / have_cinttypes.m4
1 # vim:ft=m4
2 # ===========================================================================
3 # http://tangent.org/
4 # ===========================================================================
5 #
6 # SYNOPSIS
7 #
8 # AX_CXX_CINTTYPES
9 #
10 # DESCRIPTION
11 #
12 # Example:
13 #
14 # LICENSE
15 #
16 # Copyright (c) 2012 Brian Aker` <brian@tangent.org>
17 #
18 # This program is free software: you can redistribute it and/or modify it
19 # under the terms of the GNU General Public License as published by the
20 # Free Software Foundation, either version 3 of the License, or (at your
21 # option) any later version.
22 #
23 # This program is distributed in the hope that it will be useful, but
24 # WITHOUT ANY WARRANTY; without even the implied warranty of
25 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
26 # Public License for more details.
27 #
28 # You should have received a copy of the GNU General Public License along
29 # with this program. If not, see <http://www.gnu.org/licenses/>.
30 #
31 # As a special exception, the respective Autoconf Macro's copyright owner
32 # gives unlimited permission to copy, distribute and modify the configure
33 # scripts that are the output of Autoconf when processing the Macro. You
34 # need not follow the terms of the GNU General Public License when using
35 # or distributing such scripts, even though portions of the text of the
36 # Macro appear in them. The GNU General Public License (GPL) does govern
37 # all other use of the material that constitutes the Autoconf Macro.
38 #
39 # This special exception to the GPL applies to versions of the Autoconf
40 # Macro released by the Autoconf Archive. When you make and distribute a
41 # modified version of the Autoconf Macro, you may extend this special
42 # exception to the GPL to apply to your modified version as well.
43
44 #serial 1
45
46
47 AC_DEFUN([AX_CXX_CINTTYPES],
48 [
49 AC_REQUIRE([AC_PROG_CXX])
50 AC_REQUIRE([AC_PROG_CXXCPP])
51 AC_REQUIRE([AX_CXX_CSTDINT])
52 AC_MSG_CHECKING(the location of cinttypes)
53 save_CXXFLAGS="${CXXFLAGS}"
54 CXXFLAGS="${CXX_STANDARD} ${CXXFLAGS}"
55 ac_cv_cxx_cinttypes=""
56
57 AC_LANG_PUSH([C++])
58 # AC_CACHE_CHECK([for location of cinttypes], [ac_cv_cxx_cinttypes],
59 # [
60 # Look for cinttypes
61 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <cinttypes>], [ uint32_t foo= UINT32_C(1) ])],
62 [ac_cv_cxx_cinttypes="<cinttypes>"],
63 [
64 # Look for tr1/cinttypes
65 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <tr1/cinttypes>], [ uint32_t foo= UINT32_C(1) ])],
66 [ac_cv_cxx_cinttypes="<tr1/cinttypes>"],
67 [
68 # Look for boost/cinttypes.hpp
69 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <boost/cinttypes.hpp>], [ uint32_t foo= UINT32_C(1) ])],
70 [ac_cv_cxx_cinttypes="<boost/cinttypes.hpp>"])
71 ])
72 ])
73 # ])
74 AC_LANG_POP()
75
76 CXXFLAGS="${save_CXXFLAGS}"
77 if test -n "$ac_cv_cxx_cinttypes"; then
78 AC_MSG_RESULT([$ac_cv_cxx_cinttypes])
79 else
80 ac_cv_cxx_cinttypes="<inttypes.h>"
81 AC_MSG_WARN([Could not find a cinttypes header.])
82 AC_MSG_RESULT([$ac_cv_cxx_cinttypes])
83 fi
84
85 AC_DEFINE([__STDC_LIMIT_MACROS],[1],[Use STDC Limit Macros in C++])
86 AC_DEFINE_UNQUOTED(CINTTYPES_H,$ac_cv_cxx_cinttypes, [the location of <cinttypes>])
87 ])