annotate acinclude.m4 @ 1392:667e369cfeab

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