annotate acinclude.m4 @ 516:449a0355f864 v2.0_osx_deploy

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