configure.ac 3.78 KB
Newer Older
1
AC_PREREQ([2.57])
Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
2
AC_INIT([buddy], [2.3a])
3
AC_CONFIG_AUX_DIR([tools])
4
AC_CONFIG_MACRO_DIR([m4])
5
6
AM_INIT_AUTOMAKE([foreign nostdinc no-define 1.7.3])

Alexandre Duret-Lutz's avatar
[buddy]    
Alexandre Duret-Lutz committed
7
8
9
10
11
12
13
# If the user didn't supply a CFLAGS value,
# set an empty one to prevent autoconf to stick -O2 -g here.
test -z "$CFLAGS" && CFLAGS=
test -z "$CXXFLAGS" && CXXFLAGS=

adl_ENABLE_DEVEL

14
15
16
17
18
19
20
AC_PROG_CC

AM_PROG_LEX
AC_PROG_YACC

AC_PROG_CXX

21
22
23
24
25
26
# Option to activate C/C++14
AC_ARG_ENABLE([c++14],
              [AC_HELP_STRING([--enable-c++14],
                              [Use C++14.])],
              [enable_14=yes], [enable_14=no])

27
LT_INIT([win32-dll])
28
AX_BSYMBOLIC
29

30
31
32
33
34
35
36
37
38
39
40
41
# Use -Werror since using -fvisibility under MinGW is only a warning.
# (The option is ignored anyway since this does not make sense under windows).
AX_CHECK_COMPILE_FLAG([-Werror -fvisibility=hidden],
  [CFLAGS="$CFLAGS -fvisibility=hidden"])
AC_LANG(C++)
AX_CHECK_COMPILE_FLAG([-Werror -fvisibility=hidden],
  [CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
  AX_CHECK_COMPILE_FLAG([-fvisibility-inlines-hidden],
    [CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden"])])
AC_LANG(C)


Alexandre Duret-Lutz's avatar
[buddy]    
Alexandre Duret-Lutz committed
42
43
44
45
adl_ENABLE_DEBUG
ad_GCC_OPTIM
adl_NDEBUG

46
buddy_INTEL
47
48
buddy_DEBUG_FLAGS

Alexandre Duret-Lutz's avatar
[buddy]    
Alexandre Duret-Lutz committed
49
50
51
52
if test x$enable_warnings = xyes; then
  CF_GCC_WARNINGS
fi

53
54
55
56
57
# Turn on C++11 support
AC_LANG(C++)
m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody],
[AC_LANG_SOURCE([#include <memory>
#include <string>
58
59
#include <chrono>  // fails with some installation of clang
#include <map>
60

61
    template <typename T>
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
    struct check
    {
      static_assert(sizeof(int) <= sizeof(T), "not big enough");
    };

    typedef check<check<bool>> right_angle_brackets;

    auto f = std::make_shared<std::string>("shared_ptr");

    int a;
    decltype(a) b;

    typedef check<int> check_type;
    check_type c;
    check_type&& cr = static_cast<check_type&&>(c);

    auto d = a;
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119

    void test_emplace()
    {
       std::map<int, int> m;
       m.emplace(1, 2); // fails with g++ 4.6
    }
])])

# Turn on C++14 support
# This is currently a copy of the above code for C++11, feel free to add
# further tests here when necessary.
m4_define([_AX_CXX_COMPILE_STDCXX_14_testbody],
[AC_LANG_SOURCE([#include <memory>
#include <string>
#include <chrono>  // fails with some installation of clang
#include <map>

    template <typename T>
    struct check
    {
      static_assert(sizeof(int) <= sizeof(T), "not big enough");
    };

    typedef check<check<bool>> right_angle_brackets;

    auto f = std::make_shared<std::string>("shared_ptr");

    int a;
    decltype(a) b;

    typedef check<int> check_type;
    check_type c;
    check_type&& cr = static_cast<check_type&&>(c);

    auto d = a;

    void test_emplace()
    {
       std::map<int, int> m;
       m.emplace(1, 2); // fails with g++ 4.6
    }
120
121
])])

122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
if test x"${enable_14}" = xyes; then
  for f in -std=c++14 '-std=c++14 -stdlib=libc++' -std=c++1y
  do
    AX_CHECK_COMPILE_FLAG([$f], [CXXFLAGS="$CXXFLAGS $f" stdpass=true], [], [],
                          [_AX_CXX_COMPILE_STDCXX_14_testbody])
    ${stdpass-false} && break
  done
  if ! "${stdpass-false}"; then
    AC_ERROR([unable to turn on C++14 mode with this compiler])
  fi
else
  for f in -std=c++11 '-std=c++11 -stdlib=libc++' -std=c++0x
  do
    AX_CHECK_COMPILE_FLAG([$f], [CXXFLAGS="$CXXFLAGS $f" stdpass=true], [], [],
                          [_AX_CXX_COMPILE_STDCXX_11_testbody])
    ${stdpass-false} && break
  done
  if ! "${stdpass-false}"; then
    AC_ERROR([unable to turn on C++11 mode with this compiler])
  fi
142
fi
143

144
145
AC_CONFIG_HEADERS([config.h])

146
147
148
149
150
151
AC_CONFIG_FILES([
  Makefile
  src/Makefile
  doc/Makefile
  examples/Makefile
  examples/adder/Makefile
Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
152
153
  examples/bddcalc/Makefile
  examples/bddtest/Makefile
154
155
156
157
158
159
160
161
162
  examples/cmilner/Makefile
  examples/fdd/Makefile
  examples/milner/Makefile
  examples/money/Makefile
  examples/queen/Makefile
  examples/solitare/Makefile
])

AC_OUTPUT