Updating for 1.0.2 release
[awesomized/libmemcached] / m4 / pandora_cstdint.m4
1 # Copyright (C) 2008 Sun Microsystems, Inc.
2 # This file is free software; Sun Microsystems, Inc.
3 # gives unlimited permission to copy and/or distribute it,
4 # with or without modifications, as long as this notice is preserved.
5
6 # We check two things: where the include file is for cstdint. We
7 # include AC_TRY_COMPILE for all the combinations we've seen in the
8 # wild. We define one of HAVE_CSTDINT or HAVE_TR1_CSTDINT or
9 # HAVE_BOOST_CSTDINT depending
10 # on location.
11
12 AC_DEFUN([PANDORA_CXX_CSTDINT],
13 [AC_MSG_CHECKING(the location of cstdint)
14 AC_LANG_PUSH(C++)
15 save_CXXFLAGS="${CXXFLAGS}"
16 CXXFLAGS="${CXX_STANDARD} ${CXXFLAGS}"
17 ac_cv_cxx_cstdint=""
18 for location in tr1/cstdint boost/cstdint cstdint; do
19 if test -z "$ac_cv_cxx_cstdint"; then
20 AC_TRY_COMPILE([#include <$location>],
21 [uint32_t t],
22 [ac_cv_cxx_cstdint="<$location>";])
23 fi
24 done
25 AC_LANG_POP()
26 CXXFLAGS="${save_CXXFLAGS}"
27 if test -n "$ac_cv_cxx_cstdint"; then
28 AC_MSG_RESULT([$ac_cv_cxx_cstdint])
29 else
30 AC_DEFINE([__STDC_CONSTANT_MACROS],[1],[Use STDC Constant Macros in C++])
31 AC_DEFINE([__STDC_FORMAT_MACROS],[1],[Use STDC Format Macros in C++])
32 ac_cv_cxx_cstdint="<stdint.h>"
33 AC_MSG_RESULT()
34 AC_MSG_WARN([Could not find a cstdint header.])
35 fi
36 AC_DEFINE_UNQUOTED(CSTDINT_H,$ac_cv_cxx_cstdint,
37 [the location of <cstdint>])
38 ])