]> git.ipfire.org Git - thirdparty/squid.git/blame - acinclude/ax_cxx_0x_types.m4
Cleanup: remove unnecessary if-conditions
[thirdparty/squid.git] / acinclude / ax_cxx_0x_types.m4
CommitLineData
bde978a6 1## Copyright (C) 1996-2015 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
8##
9## AX_CXX_TYPE_NULLPTR shamelessly copied from the DUNE sources under GPL version 2
a203dec7
AJ
10##
11AC_DEFUN([AX_CXX_TYPE_NULLPTR],[
12 AC_REQUIRE([AC_PROG_CXX])
13 AC_LANG_PUSH([C++])
14 AC_MSG_CHECKING([whether nullptr is supported])
15 AC_TRY_COMPILE([],[char* ch = nullptr;], [
16 HAVE_NULLPTR=yes
17 AC_MSG_RESULT(yes)], [
18 HAVE_NULLPTR=no
19 AC_MSG_RESULT(no)])
20 if test "x$HAVE_NULLPTR" = xyes; then
21 AC_DEFINE(HAVE_NULLPTR, 1, [Define to 1 if nullptr is supported])
22 fi
23 AC_MSG_CHECKING([whether nullptr_t is supported])
24 AC_TRY_COMPILE([#include <cstddef>],[typedef nullptr_t peng;], [
25 HAVE_NULLPTR_T=yes
26 AC_MSG_RESULT(yes)], [
27 HAVE_NULLPTR_T=no
28 AC_MSG_RESULT(no)])
29 if test "x$HAVE_NULLPTR_T" = xyes; then
30 AC_DEFINE(HAVE_NULLPTR_T, 1, [Define to 1 if nullptr_t is supported])
31 fi
32 AC_LANG_POP
33])
34
35## Hand crafted for Squid under GPL version 2
36AC_DEFUN([AX_CXX_TYPE_UNIQUE_PTR],[
37 AC_REQUIRE([AC_PROG_CXX])
38 AC_LANG_PUSH([C++])
39 AC_MSG_CHECKING([whether std::unique_ptr<T> is supported])
40 AC_TRY_COMPILE([#include <memory>],[std::unique_ptr<char> c;], [
41 HAVE_UNIQUE_PTR=yes
42 AC_MSG_RESULT(yes)], [
43 HAVE_UNIQUE_PTR=no
44 AC_MSG_RESULT(no)])
45 if test "x$HAVE_UNIQUE_PTR" = xyes; then
46 AC_DEFINE(HAVE_UNIQUE_PTR, 1, [Define to 1 if std::unique_ptr<T> is supported])
47 fi
48 AC_LANG_POP
49])
249b93df
AJ
50
51## Hand crafted for Squid under GPL version 2
52AC_DEFUN([AX_CXX_TYPE_UNIFORM_DISTRIBUTIONS],[
53 AC_REQUIRE([AC_PROG_CXX])
54 AC_LANG_PUSH([C++])
55 AC_MSG_CHECKING([whether std::uniform_int_distribution<T> is supported])
56 AC_TRY_COMPILE([#include <random>],[std::uniform_int_distribution<int> c;], [
57 HAVE_UNIFORM_INT_DISTRIBUTION=yes
58 AC_MSG_RESULT(yes)], [
59 HAVE_UNIFORM_INT_DISTRIBUTION=no
60 AC_MSG_RESULT(no)])
61 if test "x$HAVE_UNIFORM_INT_DISTRIBUTION" = xno; then
62 AC_DEFINE(uniform_int_distributon, tr1::uniform_int, [Leave undefined if std::uniform_int_distribution<T> is supported])
63 fi
64 AC_MSG_CHECKING([whether std::uniform_real_distribution<T> is supported])
65 AC_TRY_COMPILE([#include <random>],[std::uniform_real_distribution<double> c;], [
66 HAVE_UNIFORM_REAL_DISTRIBUTION=yes
67 AC_MSG_RESULT(yes)], [
68 HAVE_UNIFORM_REAL_DISTRIBUTION=no
69 AC_MSG_RESULT(no)])
70 if test "x$HAVE_UNIFORM_REAL_DISTRIBUTION" = xno; then
71 AC_DEFINE(uniform_real_distributon, tr1::uniform_real, [Leave undefined if std::uniform_real_distribution<T> is supported])
72 fi
73 AC_LANG_POP
74])