Chris@198
|
1
|
Chris@198
|
2 AC_DEFUN([SV_MODULE_REQUIRED],
|
Chris@198
|
3 [
|
Chris@198
|
4 SV_MODULE_MODULE=$1
|
Chris@198
|
5 SV_MODULE_VERSION_TEST="$2"
|
Chris@198
|
6 SV_MODULE_HEADER=$3
|
Chris@198
|
7 SV_MODULE_LIB=$4
|
Chris@198
|
8 SV_MODULE_FUNC=$5
|
Chris@198
|
9 SV_MODULE_HAVE=HAVE_$(echo $1 | tr '[a-z]' '[A-Z]')
|
Chris@198
|
10 SV_MODULE_FAILED=1
|
Chris@216
|
11 if test -n "$$1_LIBS" ; then
|
Chris@216
|
12 AC_MSG_NOTICE([User set ${SV_MODULE_MODULE}_LIBS explicitly, skipping test for $SV_MODULE_MODULE])
|
Chris@216
|
13 CXXFLAGS="$CXXFLAGS $$1_CFLAGS"
|
Chris@216
|
14 LIBS="$LIBS $$1_LIBS"
|
Chris@216
|
15 SV_MODULE_FAILED=""
|
Chris@216
|
16 fi
|
Chris@198
|
17 if test -z "$SV_MODULE_VERSION_TEST" ; then
|
Chris@198
|
18 SV_MODULE_VERSION_TEST=$SV_MODULE_MODULE
|
Chris@198
|
19 fi
|
Chris@216
|
20 if test -n "$SV_MODULE_FAILED" && test -n "$PKG_CONFIG"; then
|
Chris@198
|
21 PKG_CHECK_MODULES($1,[$SV_MODULE_VERSION_TEST],[HAVES="$HAVES $SV_MODULE_HAVE";CXXFLAGS="$CXXFLAGS $$1_CFLAGS";LIBS="$LIBS $$1_LIBS";SV_MODULE_FAILED=""],[AC_MSG_NOTICE([Failed to find required module $SV_MODULE_MODULE using pkg-config, trying again by old-fashioned means])])
|
Chris@198
|
22 fi
|
Chris@198
|
23 if test -n "$SV_MODULE_FAILED"; then
|
Chris@198
|
24 AC_CHECK_HEADER([$SV_MODULE_HEADER],[HAVES="$HAVES $SV_MODULE_HAVE"],[AC_MSG_ERROR([Failed to find header $SV_MODULE_HEADER for required module $SV_MODULE_MODULE])])
|
Chris@198
|
25 if test -n "$SV_MODULE_LIB"; then
|
Chris@198
|
26 AC_CHECK_LIB([$SV_MODULE_LIB],[$SV_MODULE_FUNC],[LIBS="$LIBS -l$SV_MODULE_LIB"],[AC_MSG_ERROR([Failed to find library $SV_MODULE_LIB for required module $SV_MODULE_MODULE])])
|
Chris@198
|
27 fi
|
Chris@198
|
28 fi
|
Chris@198
|
29 ])
|
Chris@198
|
30
|
Chris@198
|
31 AC_DEFUN([SV_MODULE_OPTIONAL],
|
Chris@198
|
32 [
|
Chris@198
|
33 SV_MODULE_MODULE=$1
|
Chris@198
|
34 SV_MODULE_VERSION_TEST="$2"
|
Chris@198
|
35 SV_MODULE_HEADER=$3
|
Chris@198
|
36 SV_MODULE_LIB=$4
|
Chris@198
|
37 SV_MODULE_FUNC=$5
|
Chris@198
|
38 SV_MODULE_HAVE=HAVE_$(echo $1 | tr '[a-z]' '[A-Z]')
|
Chris@198
|
39 SV_MODULE_FAILED=1
|
Chris@216
|
40 if test -n "$$1_LIBS" ; then
|
Chris@216
|
41 AC_MSG_NOTICE([User set ${SV_MODULE_MODULE}_LIBS explicitly, skipping test for $SV_MODULE_MODULE])
|
Chris@216
|
42 CXXFLAGS="$CXXFLAGS $$1_CFLAGS"
|
Chris@216
|
43 LIBS="$LIBS $$1_LIBS"
|
Chris@216
|
44 SV_MODULE_FAILED=""
|
Chris@216
|
45 fi
|
Chris@198
|
46 if test -z "$SV_MODULE_VERSION_TEST" ; then
|
Chris@198
|
47 SV_MODULE_VERSION_TEST=$SV_MODULE_MODULE
|
Chris@198
|
48 fi
|
Chris@216
|
49 if test -n "$SV_MODULE_FAILED" && test -n "$PKG_CONFIG"; then
|
Chris@200
|
50 PKG_CHECK_MODULES($1,[$SV_MODULE_VERSION_TEST],[HAVES="$HAVES $SV_MODULE_HAVE";CXXFLAGS="$CXXFLAGS $$1_CFLAGS";LIBS="$LIBS $$1_LIBS";SV_MODULE_FAILED=""],[AC_MSG_NOTICE([Failed to find optional module $SV_MODULE_MODULE using pkg-config, trying again by old-fashioned means])])
|
Chris@198
|
51 fi
|
Chris@198
|
52 if test -n "$SV_MODULE_FAILED"; then
|
Chris@198
|
53 AC_CHECK_HEADER([$SV_MODULE_HEADER],[HAVES="$HAVES $SV_MODULE_HAVE";SV_MODULE_FAILED=""],[AC_MSG_NOTICE([Failed to find header $SV_MODULE_HEADER for optional module $SV_MODULE_MODULE])])
|
Chris@198
|
54 if test -z "$SV_MODULE_FAILED"; then
|
Chris@198
|
55 if test -n "$SV_MODULE_LIB"; then
|
Chris@198
|
56 AC_CHECK_LIB([$SV_MODULE_LIB],[$SV_MODULE_FUNC],[LIBS="$LIBS -l$SV_MODULE_LIB"],[AC_MSG_NOTICE([Failed to find library $SV_MODULE_LIB for optional module $SV_MODULE_MODULE])])
|
Chris@198
|
57 fi
|
Chris@198
|
58 fi
|
Chris@198
|
59 fi
|
Chris@198
|
60 ])
|
Chris@198
|
61
|
Chris@202
|
62 # Check for Qt. The only part of Qt we use directly is qmake.
|
Chris@202
|
63
|
Chris@198
|
64 AC_DEFUN([SV_CHECK_QT],
|
Chris@198
|
65 [
|
Chris@198
|
66 AC_REQUIRE([AC_PROG_CXX])
|
Chris@198
|
67
|
Chris@202
|
68 if test x$QMAKE = x ; then
|
Chris@282
|
69 AC_CHECK_PROG(QMAKE, qmake-qt5, $QTDIR/bin/qmake-qt5,,$QTDIR/bin/)
|
Chris@202
|
70 fi
|
Chris@202
|
71 if test x$QMAKE = x ; then
|
Chris@202
|
72 AC_CHECK_PROG(QMAKE, qmake, $QTDIR/bin/qmake,,$QTDIR/bin/)
|
Chris@202
|
73 fi
|
Chris@202
|
74 if test x$QMAKE = x ; then
|
Chris@202
|
75 AC_CHECK_PROG(QMAKE, qmake.exe, $QTDIR/bin/qmake.exe,,$QTDIR/bin/)
|
Chris@202
|
76 fi
|
Chris@202
|
77 if test x$QMAKE = x ; then
|
Chris@282
|
78 AC_CHECK_PROG(QMAKE, qmake-qt5, qmake-qt5,,$PATH)
|
Chris@202
|
79 fi
|
Chris@202
|
80 if test x$QMAKE = x ; then
|
Chris@202
|
81 AC_CHECK_PROG(QMAKE, qmake, qmake,,$PATH)
|
Chris@202
|
82 fi
|
Chris@202
|
83 if test x$QMAKE = x ; then
|
Chris@202
|
84 AC_MSG_ERROR([
|
Chris@282
|
85 Failed to find the required qmake-qt5 or qmake program. Please
|
Chris@282
|
86 ensure you have the necessary Qt5 development files installed, and
|
Chris@282
|
87 if necessary set QTDIR to the location of your Qt5 installation.
|
Chris@198
|
88 ])
|
Chris@198
|
89 fi
|
Chris@198
|
90
|
Chris@198
|
91 # Suitable versions of qmake should print out something like:
|
Chris@198
|
92 #
|
Chris@198
|
93 # QMake version 2.01a
|
Chris@198
|
94 # Using Qt version 4.6.3 in /usr/lib
|
Chris@198
|
95 #
|
Chris@198
|
96 # This may be translated, so we check only for the numbers (2.x and 4.x
|
Chris@198
|
97 # in that order).
|
Chris@198
|
98 #
|
Chris@198
|
99 QMAKE_VERSION_OUTPUT=`$QMAKE -v`
|
Chris@198
|
100 case "$QMAKE_VERSION_OUTPUT" in
|
Chris@282
|
101 *5.*) ;;
|
Chris@198
|
102 *) AC_MSG_WARN([
|
Chris@198
|
103 *** The version of qmake found in "$QMAKE" looks like it might be
|
Chris@282
|
104 from the wrong version of Qt (Qt5 is required). Please check
|
Chris@282
|
105 that this is the correct version of qmake for Qt5 builds.
|
Chris@198
|
106 ])
|
Chris@198
|
107 esac
|
Chris@198
|
108
|
Chris@207
|
109 case "`uname`" in
|
Chris@207
|
110 *Darwin*) QMAKE="$QMAKE -spec macx-g++";;
|
Chris@207
|
111 esac
|
Chris@207
|
112
|
Chris@198
|
113 ])
|
Chris@198
|
114
|
Chris@421
|
115 # From autoconf archive:
|
Chris@421
|
116
|
Chris@421
|
117 # ============================================================================
|
Chris@421
|
118 # http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html
|
Chris@421
|
119 # ============================================================================
|
Chris@421
|
120 #
|
Chris@421
|
121 # SYNOPSIS
|
Chris@421
|
122 #
|
Chris@421
|
123 # AX_CXX_COMPILE_STDCXX_11([ext|noext],[mandatory|optional])
|
Chris@421
|
124 #
|
Chris@421
|
125 # DESCRIPTION
|
Chris@421
|
126 #
|
Chris@421
|
127 # Check for baseline language coverage in the compiler for the C++11
|
Chris@421
|
128 # standard; if necessary, add switches to CXXFLAGS to enable support.
|
Chris@421
|
129 #
|
Chris@421
|
130 # The first argument, if specified, indicates whether you insist on an
|
Chris@421
|
131 # extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
|
Chris@421
|
132 # -std=c++11). If neither is specified, you get whatever works, with
|
Chris@421
|
133 # preference for an extended mode.
|
Chris@421
|
134 #
|
Chris@421
|
135 # The second argument, if specified 'mandatory' or if left unspecified,
|
Chris@421
|
136 # indicates that baseline C++11 support is required and that the macro
|
Chris@421
|
137 # should error out if no mode with that support is found. If specified
|
Chris@421
|
138 # 'optional', then configuration proceeds regardless, after defining
|
Chris@421
|
139 # HAVE_CXX11 if and only if a supporting mode is found.
|
Chris@421
|
140 #
|
Chris@421
|
141 # LICENSE
|
Chris@421
|
142 #
|
Chris@421
|
143 # Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
|
Chris@421
|
144 # Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
|
Chris@421
|
145 # Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu>
|
Chris@421
|
146 # Copyright (c) 2014 Alexey Sokolov <sokolov@google.com>
|
Chris@421
|
147 #
|
Chris@421
|
148 # Copying and distribution of this file, with or without modification, are
|
Chris@421
|
149 # permitted in any medium without royalty provided the copyright notice
|
Chris@421
|
150 # and this notice are preserved. This file is offered as-is, without any
|
Chris@421
|
151 # warranty.
|
Chris@421
|
152
|
Chris@421
|
153 m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [[
|
Chris@421
|
154 template <typename T>
|
Chris@421
|
155 struct check
|
Chris@421
|
156 {
|
Chris@421
|
157 static_assert(sizeof(int) <= sizeof(T), "not big enough");
|
Chris@421
|
158 };
|
Chris@421
|
159
|
Chris@421
|
160 struct Base {
|
Chris@421
|
161 virtual void f() {}
|
Chris@421
|
162 };
|
Chris@421
|
163 struct Child : public Base {
|
Chris@421
|
164 virtual void f() override {}
|
Chris@421
|
165 };
|
Chris@421
|
166
|
Chris@421
|
167 typedef check<check<bool>> right_angle_brackets;
|
Chris@421
|
168
|
Chris@421
|
169 int a;
|
Chris@421
|
170 decltype(a) b;
|
Chris@421
|
171
|
Chris@421
|
172 typedef check<int> check_type;
|
Chris@421
|
173 check_type c;
|
Chris@421
|
174 check_type&& cr = static_cast<check_type&&>(c);
|
Chris@421
|
175
|
Chris@421
|
176 auto d = a;
|
Chris@421
|
177 auto l = [](){};
|
Chris@421
|
178 ]])
|
Chris@421
|
179
|
Chris@421
|
180 AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
|
Chris@421
|
181 m4_if([$1], [], [],
|
Chris@421
|
182 [$1], [ext], [],
|
Chris@421
|
183 [$1], [noext], [],
|
Chris@421
|
184 [m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_11])])dnl
|
Chris@421
|
185 m4_if([$2], [], [ax_cxx_compile_cxx11_required=true],
|
Chris@421
|
186 [$2], [mandatory], [ax_cxx_compile_cxx11_required=true],
|
Chris@421
|
187 [$2], [optional], [ax_cxx_compile_cxx11_required=false],
|
Chris@421
|
188 [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX_11])])
|
Chris@421
|
189 AC_LANG_PUSH([C++])dnl
|
Chris@421
|
190 ac_success=no
|
Chris@421
|
191 AC_CACHE_CHECK(whether $CXX supports C++11 features by default,
|
Chris@421
|
192 ax_cv_cxx_compile_cxx11,
|
Chris@421
|
193 [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
|
Chris@421
|
194 [ax_cv_cxx_compile_cxx11=yes],
|
Chris@421
|
195 [ax_cv_cxx_compile_cxx11=no])])
|
Chris@421
|
196 if test x$ax_cv_cxx_compile_cxx11 = xyes; then
|
Chris@421
|
197 ac_success=yes
|
Chris@421
|
198 fi
|
Chris@421
|
199
|
Chris@421
|
200 m4_if([$1], [noext], [], [dnl
|
Chris@421
|
201 if test x$ac_success = xno; then
|
Chris@421
|
202 for switch in -std=gnu++11 -std=gnu++0x; do
|
Chris@421
|
203 cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
|
Chris@421
|
204 AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
|
Chris@421
|
205 $cachevar,
|
Chris@421
|
206 [ac_save_CXXFLAGS="$CXXFLAGS"
|
Chris@421
|
207 CXXFLAGS="$CXXFLAGS $switch"
|
Chris@421
|
208 AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
|
Chris@421
|
209 [eval $cachevar=yes],
|
Chris@421
|
210 [eval $cachevar=no])
|
Chris@421
|
211 CXXFLAGS="$ac_save_CXXFLAGS"])
|
Chris@421
|
212 if eval test x\$$cachevar = xyes; then
|
Chris@421
|
213 CXXFLAGS="$CXXFLAGS $switch"
|
Chris@421
|
214 ac_success=yes
|
Chris@421
|
215 break
|
Chris@421
|
216 fi
|
Chris@421
|
217 done
|
Chris@421
|
218 fi])
|
Chris@421
|
219
|
Chris@421
|
220 m4_if([$1], [ext], [], [dnl
|
Chris@421
|
221 if test x$ac_success = xno; then
|
Chris@421
|
222 for switch in -std=c++11 -std=c++0x; do
|
Chris@421
|
223 cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
|
Chris@421
|
224 AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
|
Chris@421
|
225 $cachevar,
|
Chris@421
|
226 [ac_save_CXXFLAGS="$CXXFLAGS"
|
Chris@421
|
227 CXXFLAGS="$CXXFLAGS $switch"
|
Chris@421
|
228 AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
|
Chris@421
|
229 [eval $cachevar=yes],
|
Chris@421
|
230 [eval $cachevar=no])
|
Chris@421
|
231 CXXFLAGS="$ac_save_CXXFLAGS"])
|
Chris@421
|
232 if eval test x\$$cachevar = xyes; then
|
Chris@421
|
233 CXXFLAGS="$CXXFLAGS $switch"
|
Chris@421
|
234 ac_success=yes
|
Chris@421
|
235 break
|
Chris@421
|
236 fi
|
Chris@421
|
237 done
|
Chris@421
|
238 fi])
|
Chris@421
|
239 AC_LANG_POP([C++])
|
Chris@421
|
240 if test x$ax_cxx_compile_cxx11_required = xtrue; then
|
Chris@421
|
241 if test x$ac_success = xno; then
|
Chris@421
|
242 AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.])
|
Chris@421
|
243 fi
|
Chris@421
|
244 else
|
Chris@421
|
245 if test x$ac_success = xno; then
|
Chris@421
|
246 HAVE_CXX11=0
|
Chris@421
|
247 AC_MSG_NOTICE([No compiler with C++11 support was found])
|
Chris@421
|
248 else
|
Chris@421
|
249 HAVE_CXX11=1
|
Chris@421
|
250 AC_DEFINE(HAVE_CXX11,1,
|
Chris@421
|
251 [define if the compiler supports basic C++11 syntax])
|
Chris@421
|
252 fi
|
Chris@421
|
253
|
Chris@421
|
254 AC_SUBST(HAVE_CXX11)
|
Chris@421
|
255 fi
|
Chris@421
|
256 ])
|
Chris@421
|
257
|