annotate acinclude.m4 @ 961:f3c1546c8a5c

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