1 ## Copyright (C) 1996-2021 The Squid Software Foundation and contributors
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.
8 ## Hand crafted for Squid under GPL version 2
9 AC_DEFUN([AX_CXX_TYPE_UNIFORM_DISTRIBUTIONS],[
10 AC_REQUIRE([AC_PROG_CXX])
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])
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])
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])
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])
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])
38 ## SQUID_CXX_STD_UNDERLYING_TYPE
39 ## checks whether the std::underlying_type<enumType>::type trait exists
40 AC_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])
47 #include <type_traits>
48 enum class testEnum { one, two, three };
50 std::underlying_type<testEnum>::type testNum = 0;
52 [squid_cv_have_std_underlying_type=yes],
53 [squid_cv_have_std_underlying_type=no])
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])