configure.ac 8.66 KB
Newer Older
Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
1
# -*- coding: utf-8 -*-
Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
2
3
# Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016,
# 2017 Laboratoire de Recherche et Développement de l'Epita (LRDE).
4
5
6
# Copyright (C) 2003, 2004, 2005, 2006, 2007 Laboratoire
# d'Informatique de Paris 6 (LIP6), département Systèmes Répartis
# Coopératifs (SRC), Université Pierre et Marie Curie.
Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
7
8
9
10
11
#
# This file is part of Spot, a model checking library.
#
# Spot is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
12
# the Free Software Foundation; either version 3 of the License, or
Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
13
14
15
16
17
18
19
20
# (at your option) any later version.
#
# Spot is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License
21
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
22

23
AC_PREREQ([2.61])
Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
24
AC_INIT([spot], [2.3.3], [spot@lrde.epita.fr])
25
AC_CONFIG_AUX_DIR([tools])
26
AC_CONFIG_MACRO_DIR([m4])
27
28
AM_INIT_AUTOMAKE([1.11 gnu tar-ustar color-tests parallel-tests])
AC_CONFIG_HEADERS([config.h])dnl Private config, not to be used in .hh files.
29
AX_PREFIX_CONFIG_H([spot/misc/_config.h])dnl Public config, for .hh files.
30

31
# If the user didn't supply a CFLAGS value,
32
33
34
35
# set an empty one to prevent autoconf to stick -O2 -g here.
test -z "$CFLAGS" && CFLAGS=
test -z "$CXXFLAGS" && CXXFLAGS=

36
adl_ENABLE_DEVEL
37

38
AC_PROG_CC
39
40
gl_EARLY

41
AM_PROG_CC_C_O
42
43
44
AC_PROG_CXX

AM_PROG_LEX
45
adl_CHECK_BISON
46

47
48
49
# Decrease verbosity when passing argument V=0
AM_SILENT_RULES([no])

50
51
52
53
54
55
# 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])

56
# Activate at C11 for gnulib tests
57
58
59
60
61
if test x"${enable_14}" = xyes; then
  AX_CHECK_COMPILE_FLAG([-std=c14], [CFLAGS="$CFLAGS -std=c14"])
else
  AX_CHECK_COMPILE_FLAG([-std=c11], [CFLAGS="$CFLAGS -std=c11"])
fi
62

63
gl_INIT
64

65
66
67
# 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],
68
69
70
71
  [CFLAGS="$CFLAGS -fvisibility=hidden"])
AC_LANG(C++)
AX_CHECK_COMPILE_FLAG([-Werror -fvisibility=hidden],
  [CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
72
  AX_CHECK_COMPILE_FLAG([-fvisibility-inlines-hidden],
73
74
    [CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden"])])
CXXFLAGS="$CXXFLAGS -DSPOT_BUILD"
75

76
# Turn on C++11 support
77
78
79
m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody],
[AC_LANG_SOURCE([#include <memory>
#include <string>
80
81
#include <chrono>  // fails with some installation of clang
#include <map>
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
    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
    }
])])

# 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>
119
120
121
122
123
124
125
    struct check
    {
      static_assert(sizeof(int) <= sizeof(T), "not big enough");
    };

    typedef check<check<bool>> right_angle_brackets;

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

128
129
130
131
132
133
134
135
    int a;
    decltype(a) b;

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

    auto d = a;
136
137
138
139
140
141

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

144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
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
164
fi
165

166
167
AX_CHECK_BUDDY

168
AC_CHECK_HEADERS([sys/times.h])
169
AC_CHECK_FUNCS([times kill alarm sigaction])
170

171
LT_CONFIG_LTDL_DIR([ltdl])
172
LT_INIT([win32-dll])
173
LTDL_INIT([subproject convenience])
174
175
176
177
178
179
# Debian resets this to no, but this break both Spot and the libtool
# test suite itself.  Instead of requiring developer to install a
# non-patched version of Libtool on any Debian they use, we just
# cancel the effect of Debian's patch here.
link_all_deplibs=yes
link_all_deplibs_CXX=yes
180

181
AX_BSYMBOLIC
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197

AC_ARG_ENABLE([python],
              [AC_HELP_STRING([--disable-python],
                              [do not compile Python bindings])],
              [], [enable_python=yes])

case $enable_shared:$enable_python in
 no:no);;
 no:*)
    enable_python=no
    AC_MSG_NOTICE([Not building Python bindings because of --disable-shared.])
    ;;
esac

AM_CONDITIONAL([USE_PYTHON], [test "x${enable_python:-yes}" = xyes])

198
199
AM_CONDITIONAL([USE_LTSMIN], [test "x${enable_shared:-yes}" = xyes])

200
201
202
203
204
205
206
if test "x${enable_python:-yes}" = xyes; then
  AC_MSG_NOTICE([You may configure with --disable-python ]dnl
[if you do not need Python bindings.])
  adl_CHECK_PYTHON
fi


207
208
209
adl_ENABLE_DEBUG
ad_GCC_OPTIM
adl_NDEBUG
210
adl_ENABLE_GLIBCXX_DEBUG
211

212
spot_INTEL
213
214
215
if test x$enable_warnings = xyes; then
  CF_GXX_WARNINGS
fi
216

217
AM_CONDITIONAL([NEVER], [false])
218
# We need the absolute path for dot in the "doc/dot" script. Other places
219
220
# only require a relative path.
AC_PATH_PROG([DOT], [dot])
221
222
AC_CHECK_PROG([LBT], [lbt], [lbt])
AC_CHECK_PROG([LTL2BA], [ltl2ba], [ltl2ba])
223
AC_CHECK_PROG([LTL3BA], [ltl3ba], [ltl3ba])
224
225
AC_CHECK_PROG([MODELLA], [modella], [modella])
AC_CHECK_PROG([LTL2NBA], [script4lbtt.py], [script4lbtt.py])
226
AC_CHECK_PROG([PERL], [perl], [perl])
227
AC_CHECK_PROG([SPIN], [spin], [spin])
Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
228
AC_CHECK_PROG([LBTT], [lbtt], [lbtt])
229
AC_CHECK_PROG([EMACS], [emacs], [emacs])
230
AC_CHECK_PROGS([IPYTHON], [ipython3 ipython], [ipython])
Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
231
AC_CHECK_PROG([LBTT_TRANSLATE], [lbtt-translate], [lbtt-translate])
232
AX_CHECK_VALGRIND
233
AC_CHECK_PROG([WRING2LBTT], [wring2lbtt], [wring2lbtt])
234
235
236
# Debian has a binary for SWIG 3.0 named swig3.0 and they kept swig as
# an alias for swig-2.0.  Let's use the former when available.
AC_CHECK_PROGS([SWIG], [swig3.0 swig], [swig])
237

238
239
AC_SUBST([CROSS_COMPILING], [$cross_compiling])

240
AC_SUBST([GITPATCH], [$(if (git rev-parse) >/dev/null 2>&1; then
241
242
 echo ".$(git rev-list $(git rev-list --tags --no-walk --max-count=1)..HEAD \
 --count)"
243
244
fi)])

245
246
AC_CONFIG_FILES([
  Makefile
247
248
  bin/Makefile
  bin/man/Makefile
249
  bench/Makefile
250
  bench/dtgbasat/Makefile
251
252
  bench/emptchk/Makefile
  bench/emptchk/defs
253
  bench/ltlcounter/Makefile
254
  bench/ltlclasses/Makefile
255
256
  bench/ltl2tgba/Makefile
  bench/ltl2tgba/defs
257
  bench/spin13/Makefile
Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
258
  bench/wdba/Makefile
259
  bench/stutter/Makefile
260
  doc/Doxyfile
261
  doc/Makefile
262
  doc/tl/Makefile
263
  doc/org/.dir-locals.el
264
  doc/org/init.el
265
  elisp/Makefile
266
  lib/Makefile
267
  picosat/Makefile
268
269
  spot/graph/Makefile
  spot/kripke/Makefile
270
  spot/ltsmin/Makefile
271
272
273
274
275
276
277
278
279
280
281
  spot/Makefile
  spot/misc/Makefile
  spot/parseaut/Makefile
  spot/parsetl/Makefile
  spot/priv/Makefile
  spot/taalgos/Makefile
  spot/ta/Makefile
  spot/tl/Makefile
  spot/twaalgos/gtec/Makefile
  spot/twaalgos/Makefile
  spot/twa/Makefile
282
283
  python/ajax/Makefile
  python/Makefile
284
  tests/core/defs
285
  tests/ltsmin/defs:tests/core/defs.in
286
  tests/Makefile
287
  tools/x-to-1
288
])
289
AC_CONFIG_FILES([doc/org/g++wrap], [chmod +x doc/org/g++wrap])
290
AC_CONFIG_FILES([doc/dot], [chmod +x doc/dot])
291
AC_CONFIG_FILES([tests/run], [chmod +x tests/run])
292
AC_OUTPUT
Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
293
294
295
296
297
298
299
300
301
302
303

case $VERSION:$enable_devel in
  *[[abcdefghijklmnopqrstuvwxyz]]:yes)
    echo
    echo '==================================================================='
    echo ' This is a development version of Spot: Assertions and debuging    '
    echo ' code are enabled by default.  If you find this too slow or        '
    echo ' plan to do some benchmarking, run configure with --disable-devel. '
    echo '==================================================================='
  ;;
esac