1 ## Copyright (C) 1996-2018 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.
9 ## AX_CXX_TYPE_NULLPTR shamelessly copied from the DUNE sources under GPL version 2
11 AC_DEFUN([AX_CXX_TYPE_NULLPTR],[
12 AC_REQUIRE([AC_PROG_CXX])
14 AC_MSG_CHECKING([whether nullptr is supported])
15 AC_TRY_COMPILE([],[char* ch = nullptr;], [
17 AC_MSG_RESULT(yes)], [
20 if test "x$HAVE_NULLPTR" = xno; then
21 AC_DEFINE(nullptr, NULL, [Leave undefined if nullptr is supported])
23 AC_MSG_CHECKING([whether nullptr_t is supported])
24 AC_TRY_COMPILE([#include <cstddef>],[typedef nullptr_t peng;], [
26 AC_MSG_RESULT(yes)], [
29 if test "x$HAVE_NULLPTR_T" = xyes; then
30 AC_DEFINE(HAVE_NULLPTR_T, 1, [Define to 1 if nullptr_t is supported])
35 ## Hand crafted for Squid under GPL version 2
36 AC_DEFUN([AX_CXX_TYPE_UNIQUE_PTR],[
37 AC_REQUIRE([AC_PROG_CXX])
39 AC_MSG_CHECKING([whether std::unique_ptr<T> is supported])
40 AC_TRY_COMPILE([#include <memory>],[std::unique_ptr<char> c;], [
42 AC_MSG_RESULT(yes)], [
45 if test "x$HAVE_UNIQUE_PTR" = xno; then
46 AC_DEFINE(unique_ptr, auto_ptr, [Leave undefined if std::unique_ptr<T> is supported])
48 if test "x$HAVE_UNIQUE_PTR" = xyes; then
49 AC_DEFINE(HAVE_UNIQUE_PTR, 1, [Define to 1 if std::unique_ptr<T> is supported])
54 ## Hand crafted for Squid under GPL version 2
55 AC_DEFUN([AX_CXX_TYPE_UNIFORM_DISTRIBUTIONS],[
56 AC_REQUIRE([AC_PROG_CXX])
58 AC_CHECK_HEADERS(tr1/random)
59 AC_CACHE_CHECK([whether std::uniform_int_distribution<T> is supported],
60 [squid_cv_std_uniform_int_distribution_works],[
61 AC_TRY_COMPILE([#include <random>],[std::uniform_int_distribution<int> c;],
62 [squid_cv_std_uniform_int_distribution_works=yes],
63 [squid_cv_std_uniform_int_distribution_works=no])
65 SQUID_DEFINE_BOOL([HAVE_STD_UNIFORM_INT_DISTRIBUTION],
66 [$squid_cv_std_uniform_int_distribution_works],
67 [Define if c++11 std::uniform_int_distribution is supported])
69 AC_CACHE_CHECK([whether std::uniform_real_distribution<T> is supported],
70 [squid_cv_std_uniform_real_distribution_works],[
71 AC_REQUIRE([AC_PROG_CXX])
73 AC_TRY_COMPILE([#include <random>],[std::uniform_real_distribution<double> c;],
74 [squid_cv_std_uniform_real_distribution_works=yes],
75 [squid_cv_std_uniform_real_distribution_works=no])
77 SQUID_DEFINE_BOOL([HAVE_STD_UNIFORM_REAL_DISTRIBUTION],
78 [$squid_cv_std_uniform_real_distribution_works],
79 [Define if c++11 std::uniform_real_distribution is supported])
84 ## SQUID_CXX_STD_UNDERLYING_TYPE
85 ## checks whether the std::underlying_type<enumType>::type trait exists
86 AC_DEFUN([SQUID_CXX_STD_UNDERLYING_TYPE],[
87 AC_CACHE_CHECK([whether compiler supports std::underlying_type],
88 [squid_cv_have_std_underlying_type],[
89 AC_REQUIRE([AC_PROG_CXX])
93 #include <type_traits>
94 enum class testEnum { one, two, three };
96 std::underlying_type<testEnum>::type testNum = 0;
98 [squid_cv_have_std_underlying_type=yes],
99 [squid_cv_have_std_underlying_type=no])
102 SQUID_DEFINE_BOOL([HAVE_STD_UNDERLYING_TYPE],
103 [$squid_cv_have_std_underlying_type],
104 [Define if stdlibc support std::underlying_type for enums])