comparison acinclude.m4 @ 248:c8e5fcddf8be

Merge
author Chris Cannam
date Fri, 18 Mar 2016 15:15:55 +0000
parents 6153429ebf89
children 9d547101e7cd
comparison
equal deleted inserted replaced
247:5eadb3b687bb 248:c8e5fcddf8be
67 67
68 if test x$QMAKE = x ; then 68 if test x$QMAKE = x ; then
69 AC_CHECK_PROG(QMAKE, qmake-qt5, $QTDIR/bin/qmake-qt5,,$QTDIR/bin/) 69 AC_CHECK_PROG(QMAKE, qmake-qt5, $QTDIR/bin/qmake-qt5,,$QTDIR/bin/)
70 fi 70 fi
71 if test x$QMAKE = x ; then 71 if test x$QMAKE = x ; then
72 AC_CHECK_PROG(QMAKE, qt5-qmake, $QTDIR/bin/qt5-qmake,,$QTDIR/bin/)
73 fi
74 if test x$QMAKE = x ; then
72 AC_CHECK_PROG(QMAKE, qmake, $QTDIR/bin/qmake,,$QTDIR/bin/) 75 AC_CHECK_PROG(QMAKE, qmake, $QTDIR/bin/qmake,,$QTDIR/bin/)
73 fi 76 fi
74 if test x$QMAKE = x ; then 77 if test x$QMAKE = x ; then
75 AC_CHECK_PROG(QMAKE, qmake.exe, $QTDIR/bin/qmake.exe,,$QTDIR/bin/) 78 AC_CHECK_PROG(QMAKE, qmake.exe, $QTDIR/bin/qmake.exe,,$QTDIR/bin/)
76 fi 79 fi
77 if test x$QMAKE = x ; then 80 if test x$QMAKE = x ; then
78 AC_CHECK_PROG(QMAKE, qmake-qt5, qmake-qt5,,$PATH) 81 AC_CHECK_PROG(QMAKE, qmake-qt5, qmake-qt5,,$PATH)
82 fi
83 if test x$QMAKE = x ; then
84 AC_CHECK_PROG(QMAKE, qt5-qmake, qt5-qmake,,$PATH)
79 fi 85 fi
80 if test x$QMAKE = x ; then 86 if test x$QMAKE = x ; then
81 AC_CHECK_PROG(QMAKE, qmake, qmake,,$PATH) 87 AC_CHECK_PROG(QMAKE, qmake, qmake,,$PATH)
82 fi 88 fi
83 if test x$QMAKE = x ; then 89 if test x$QMAKE = x ; then
110 *Darwin*) QMAKE="$QMAKE -spec macx-g++";; 116 *Darwin*) QMAKE="$QMAKE -spec macx-g++";;
111 esac 117 esac
112 118
113 ]) 119 ])
114 120
121 # From autoconf archive:
122
123 # ============================================================================
124 # http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html
125 # ============================================================================
126 #
127 # SYNOPSIS
128 #
129 # AX_CXX_COMPILE_STDCXX_11([ext|noext],[mandatory|optional])
130 #
131 # DESCRIPTION
132 #
133 # Check for baseline language coverage in the compiler for the C++11
134 # standard; if necessary, add switches to CXXFLAGS to enable support.
135 #
136 # The first argument, if specified, indicates whether you insist on an
137 # extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
138 # -std=c++11). If neither is specified, you get whatever works, with
139 # preference for an extended mode.
140 #
141 # The second argument, if specified 'mandatory' or if left unspecified,
142 # indicates that baseline C++11 support is required and that the macro
143 # should error out if no mode with that support is found. If specified
144 # 'optional', then configuration proceeds regardless, after defining
145 # HAVE_CXX11 if and only if a supporting mode is found.
146 #
147 # LICENSE
148 #
149 # Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
150 # Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
151 # Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu>
152 # Copyright (c) 2014 Alexey Sokolov <sokolov@google.com>
153 #
154 # Copying and distribution of this file, with or without modification, are
155 # permitted in any medium without royalty provided the copyright notice
156 # and this notice are preserved. This file is offered as-is, without any
157 # warranty.
158
159 m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [[
160 template <typename T>
161 struct check
162 {
163 static_assert(sizeof(int) <= sizeof(T), "not big enough");
164 };
165
166 struct Base {
167 virtual void f() {}
168 };
169 struct Child : public Base {
170 virtual void f() override {}
171 };
172
173 typedef check<check<bool>> right_angle_brackets;
174
175 int a;
176 decltype(a) b;
177
178 typedef check<int> check_type;
179 check_type c;
180 check_type&& cr = static_cast<check_type&&>(c);
181
182 auto d = a;
183 auto l = [](){};
184 ]])
185
186 AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
187 m4_if([$1], [], [],
188 [$1], [ext], [],
189 [$1], [noext], [],
190 [m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_11])])dnl
191 m4_if([$2], [], [ax_cxx_compile_cxx11_required=true],
192 [$2], [mandatory], [ax_cxx_compile_cxx11_required=true],
193 [$2], [optional], [ax_cxx_compile_cxx11_required=false],
194 [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX_11])])
195 AC_LANG_PUSH([C++])dnl
196 ac_success=no
197 AC_CACHE_CHECK(whether $CXX supports C++11 features by default,
198 ax_cv_cxx_compile_cxx11,
199 [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
200 [ax_cv_cxx_compile_cxx11=yes],
201 [ax_cv_cxx_compile_cxx11=no])])
202 if test x$ax_cv_cxx_compile_cxx11 = xyes; then
203 ac_success=yes
204 fi
205
206 m4_if([$1], [noext], [], [dnl
207 if test x$ac_success = xno; then
208 for switch in -std=gnu++11 -std=gnu++0x; do
209 cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
210 AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
211 $cachevar,
212 [ac_save_CXXFLAGS="$CXXFLAGS"
213 CXXFLAGS="$CXXFLAGS $switch"
214 AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
215 [eval $cachevar=yes],
216 [eval $cachevar=no])
217 CXXFLAGS="$ac_save_CXXFLAGS"])
218 if eval test x\$$cachevar = xyes; then
219 CXXFLAGS="$CXXFLAGS $switch"
220 ac_success=yes
221 break
222 fi
223 done
224 fi])
225
226 m4_if([$1], [ext], [], [dnl
227 if test x$ac_success = xno; then
228 for switch in -std=c++11 -std=c++0x; do
229 cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
230 AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
231 $cachevar,
232 [ac_save_CXXFLAGS="$CXXFLAGS"
233 CXXFLAGS="$CXXFLAGS $switch"
234 AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
235 [eval $cachevar=yes],
236 [eval $cachevar=no])
237 CXXFLAGS="$ac_save_CXXFLAGS"])
238 if eval test x\$$cachevar = xyes; then
239 CXXFLAGS="$CXXFLAGS $switch"
240 ac_success=yes
241 break
242 fi
243 done
244 fi])
245 AC_LANG_POP([C++])
246 if test x$ax_cxx_compile_cxx11_required = xtrue; then
247 if test x$ac_success = xno; then
248 AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.])
249 fi
250 else
251 if test x$ac_success = xno; then
252 HAVE_CXX11=0
253 AC_MSG_NOTICE([No compiler with C++11 support was found])
254 else
255 HAVE_CXX11=1
256 AC_DEFINE(HAVE_CXX11,1,
257 [define if the compiler supports basic C++11 syntax])
258 fi
259
260 AC_SUBST(HAVE_CXX11)
261 fi
262 ])
263