]> git.ipfire.org Git - thirdparty/squid.git/blame - acinclude/ax_cxx_0x_types.m4
Source Format Enforcement (#763)
[thirdparty/squid.git] / acinclude / ax_cxx_0x_types.m4
CommitLineData
f70aedc4 1## Copyright (C) 1996-2021 The Squid Software Foundation and contributors
5d2e6f19
AJ
2##
3## Squid software is distributed under GPLv2+ license and includes
4## contributions from numerous individuals and organizations.
5## Please see the COPYING and CONTRIBUTORS files for details.
6##
7
249b93df
AJ
8## Hand crafted for Squid under GPL version 2
9AC_DEFUN([AX_CXX_TYPE_UNIFORM_DISTRIBUTIONS],[
10 AC_REQUIRE([AC_PROG_CXX])
11 AC_LANG_PUSH([C++])
8ed8fa40
FC
12 AC_CHECK_HEADERS(tr1/random)
13 AC_CACHE_CHECK([whether std::uniform_int_distribution<T> is supported],
14 [squid_cv_std_uniform_int_distribution_works],[
15 AC_TRY_COMPILE([#include <random>],[std::uniform_int_distribution<int> c;],
16 [squid_cv_std_uniform_int_distribution_works=yes],
17 [squid_cv_std_uniform_int_distribution_works=no])
18 ])
19 SQUID_DEFINE_BOOL([HAVE_STD_UNIFORM_INT_DISTRIBUTION],
20 [$squid_cv_std_uniform_int_distribution_works],
21 [Define if c++11 std::uniform_int_distribution is supported])
22
23 AC_CACHE_CHECK([whether std::uniform_real_distribution<T> is supported],
24 [squid_cv_std_uniform_real_distribution_works],[
25 AC_REQUIRE([AC_PROG_CXX])
26 AC_LANG_PUSH([C++])
27 AC_TRY_COMPILE([#include <random>],[std::uniform_real_distribution<double> c;],
28 [squid_cv_std_uniform_real_distribution_works=yes],
29 [squid_cv_std_uniform_real_distribution_works=no])
30 ])
31 SQUID_DEFINE_BOOL([HAVE_STD_UNIFORM_REAL_DISTRIBUTION],
32 [$squid_cv_std_uniform_real_distribution_works],
33 [Define if c++11 std::uniform_real_distribution is supported])
34
249b93df
AJ
35 AC_LANG_POP
36])
2fefc43c
FC
37
38## SQUID_CXX_STD_UNDERLYING_TYPE
39## checks whether the std::underlying_type<enumType>::type trait exists
40AC_DEFUN([SQUID_CXX_STD_UNDERLYING_TYPE],[
41 AC_CACHE_CHECK([whether compiler supports std::underlying_type],
42 [squid_cv_have_std_underlying_type],[
43 AC_REQUIRE([AC_PROG_CXX])
44 AC_LANG_PUSH([C++])
45 AC_COMPILE_IFELSE([
46 AC_LANG_PROGRAM([
47#include <type_traits>
48enum class testEnum { one, two, three };
49 ],[
50 std::underlying_type<testEnum>::type testNum = 0;
51 ])],
52 [squid_cv_have_std_underlying_type=yes],
53 [squid_cv_have_std_underlying_type=no])
54 AC_LANG_POP
55 ])
56 SQUID_DEFINE_BOOL([HAVE_STD_UNDERLYING_TYPE],
57 [$squid_cv_have_std_underlying_type],
58 [Define if stdlibc support std::underlying_type for enums])
59])