Chris@198: Chris@198: AC_DEFUN([SV_MODULE_REQUIRED], Chris@198: [ Chris@198: SV_MODULE_MODULE=$1 Chris@198: SV_MODULE_VERSION_TEST="$2" Chris@198: SV_MODULE_HEADER=$3 Chris@198: SV_MODULE_LIB=$4 Chris@198: SV_MODULE_FUNC=$5 Chris@198: SV_MODULE_HAVE=HAVE_$(echo $1 | tr '[a-z]' '[A-Z]') Chris@198: SV_MODULE_FAILED=1 Chris@216: if test -n "$$1_LIBS" ; then Chris@216: AC_MSG_NOTICE([User set ${SV_MODULE_MODULE}_LIBS explicitly, skipping test for $SV_MODULE_MODULE]) Chris@216: CXXFLAGS="$CXXFLAGS $$1_CFLAGS" Chris@216: LIBS="$LIBS $$1_LIBS" Chris@216: SV_MODULE_FAILED="" Chris@216: fi Chris@198: if test -z "$SV_MODULE_VERSION_TEST" ; then Chris@198: SV_MODULE_VERSION_TEST=$SV_MODULE_MODULE Chris@198: fi Chris@216: if test -n "$SV_MODULE_FAILED" && test -n "$PKG_CONFIG"; then Chris@198: 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: fi Chris@198: if test -n "$SV_MODULE_FAILED"; then Chris@198: 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: if test -n "$SV_MODULE_LIB"; then Chris@198: 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: fi Chris@198: fi Chris@198: ]) Chris@198: Chris@198: AC_DEFUN([SV_MODULE_OPTIONAL], Chris@198: [ Chris@198: SV_MODULE_MODULE=$1 Chris@198: SV_MODULE_VERSION_TEST="$2" Chris@198: SV_MODULE_HEADER=$3 Chris@198: SV_MODULE_LIB=$4 Chris@198: SV_MODULE_FUNC=$5 Chris@198: SV_MODULE_HAVE=HAVE_$(echo $1 | tr '[a-z]' '[A-Z]') Chris@198: SV_MODULE_FAILED=1 Chris@216: if test -n "$$1_LIBS" ; then Chris@216: AC_MSG_NOTICE([User set ${SV_MODULE_MODULE}_LIBS explicitly, skipping test for $SV_MODULE_MODULE]) Chris@216: CXXFLAGS="$CXXFLAGS $$1_CFLAGS" Chris@216: LIBS="$LIBS $$1_LIBS" Chris@216: SV_MODULE_FAILED="" Chris@216: fi Chris@198: if test -z "$SV_MODULE_VERSION_TEST" ; then Chris@198: SV_MODULE_VERSION_TEST=$SV_MODULE_MODULE Chris@198: fi Chris@216: if test -n "$SV_MODULE_FAILED" && test -n "$PKG_CONFIG"; then Chris@200: 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: fi Chris@198: if test -n "$SV_MODULE_FAILED"; then Chris@198: 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: if test -z "$SV_MODULE_FAILED"; then Chris@198: if test -n "$SV_MODULE_LIB"; then Chris@198: 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: fi Chris@198: fi Chris@198: fi Chris@198: ]) Chris@198: Chris@202: # Check for Qt. The only part of Qt we use directly is qmake. Chris@202: Chris@198: AC_DEFUN([SV_CHECK_QT], Chris@198: [ Chris@198: AC_REQUIRE([AC_PROG_CXX]) Chris@198: Chris@202: if test x$QMAKE = x ; then Chris@282: AC_CHECK_PROG(QMAKE, qmake-qt5, $QTDIR/bin/qmake-qt5,,$QTDIR/bin/) Chris@202: fi Chris@202: if test x$QMAKE = x ; then Chris@202: AC_CHECK_PROG(QMAKE, qmake, $QTDIR/bin/qmake,,$QTDIR/bin/) Chris@202: fi Chris@202: if test x$QMAKE = x ; then Chris@202: AC_CHECK_PROG(QMAKE, qmake.exe, $QTDIR/bin/qmake.exe,,$QTDIR/bin/) Chris@202: fi Chris@202: if test x$QMAKE = x ; then Chris@282: AC_CHECK_PROG(QMAKE, qmake-qt5, qmake-qt5,,$PATH) Chris@202: fi Chris@202: if test x$QMAKE = x ; then Chris@202: AC_CHECK_PROG(QMAKE, qmake, qmake,,$PATH) Chris@202: fi Chris@202: if test x$QMAKE = x ; then Chris@202: AC_MSG_ERROR([ Chris@282: Failed to find the required qmake-qt5 or qmake program. Please Chris@282: ensure you have the necessary Qt5 development files installed, and Chris@282: if necessary set QTDIR to the location of your Qt5 installation. Chris@198: ]) Chris@198: fi Chris@198: Chris@198: # Suitable versions of qmake should print out something like: Chris@198: # Chris@198: # QMake version 2.01a Chris@198: # Using Qt version 4.6.3 in /usr/lib Chris@198: # Chris@198: # This may be translated, so we check only for the numbers (2.x and 4.x Chris@198: # in that order). Chris@198: # Chris@198: QMAKE_VERSION_OUTPUT=`$QMAKE -v` Chris@198: case "$QMAKE_VERSION_OUTPUT" in Chris@282: *5.*) ;; Chris@198: *) AC_MSG_WARN([ Chris@198: *** The version of qmake found in "$QMAKE" looks like it might be Chris@282: from the wrong version of Qt (Qt5 is required). Please check Chris@282: that this is the correct version of qmake for Qt5 builds. Chris@198: ]) Chris@198: esac Chris@198: Chris@207: case "`uname`" in Chris@207: *Darwin*) QMAKE="$QMAKE -spec macx-g++";; Chris@207: esac Chris@207: Chris@198: ]) Chris@198: Chris@421: # From autoconf archive: Chris@421: Chris@421: # ============================================================================ Chris@421: # http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html Chris@421: # ============================================================================ Chris@421: # Chris@421: # SYNOPSIS Chris@421: # Chris@421: # AX_CXX_COMPILE_STDCXX_11([ext|noext],[mandatory|optional]) Chris@421: # Chris@421: # DESCRIPTION Chris@421: # Chris@421: # Check for baseline language coverage in the compiler for the C++11 Chris@421: # standard; if necessary, add switches to CXXFLAGS to enable support. Chris@421: # Chris@421: # The first argument, if specified, indicates whether you insist on an Chris@421: # extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. Chris@421: # -std=c++11). If neither is specified, you get whatever works, with Chris@421: # preference for an extended mode. Chris@421: # Chris@421: # The second argument, if specified 'mandatory' or if left unspecified, Chris@421: # indicates that baseline C++11 support is required and that the macro Chris@421: # should error out if no mode with that support is found. If specified Chris@421: # 'optional', then configuration proceeds regardless, after defining Chris@421: # HAVE_CXX11 if and only if a supporting mode is found. Chris@421: # Chris@421: # LICENSE Chris@421: # Chris@421: # Copyright (c) 2008 Benjamin Kosnik Chris@421: # Copyright (c) 2012 Zack Weinberg Chris@421: # Copyright (c) 2013 Roy Stogner Chris@421: # Copyright (c) 2014 Alexey Sokolov Chris@421: # Chris@421: # Copying and distribution of this file, with or without modification, are Chris@421: # permitted in any medium without royalty provided the copyright notice Chris@421: # and this notice are preserved. This file is offered as-is, without any Chris@421: # warranty. Chris@421: Chris@421: m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [[ Chris@421: template Chris@421: struct check Chris@421: { Chris@421: static_assert(sizeof(int) <= sizeof(T), "not big enough"); Chris@421: }; Chris@421: Chris@421: struct Base { Chris@421: virtual void f() {} Chris@421: }; Chris@421: struct Child : public Base { Chris@421: virtual void f() override {} Chris@421: }; Chris@421: Chris@421: typedef check> right_angle_brackets; Chris@421: Chris@421: int a; Chris@421: decltype(a) b; Chris@421: Chris@421: typedef check check_type; Chris@421: check_type c; Chris@421: check_type&& cr = static_cast(c); Chris@421: Chris@421: auto d = a; Chris@421: auto l = [](){}; Chris@421: ]]) Chris@421: Chris@421: AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl Chris@421: m4_if([$1], [], [], Chris@421: [$1], [ext], [], Chris@421: [$1], [noext], [], Chris@421: [m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_11])])dnl Chris@421: m4_if([$2], [], [ax_cxx_compile_cxx11_required=true], Chris@421: [$2], [mandatory], [ax_cxx_compile_cxx11_required=true], Chris@421: [$2], [optional], [ax_cxx_compile_cxx11_required=false], Chris@421: [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX_11])]) Chris@421: AC_LANG_PUSH([C++])dnl Chris@421: ac_success=no Chris@421: AC_CACHE_CHECK(whether $CXX supports C++11 features by default, Chris@421: ax_cv_cxx_compile_cxx11, Chris@421: [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], Chris@421: [ax_cv_cxx_compile_cxx11=yes], Chris@421: [ax_cv_cxx_compile_cxx11=no])]) Chris@421: if test x$ax_cv_cxx_compile_cxx11 = xyes; then Chris@421: ac_success=yes Chris@421: fi Chris@421: Chris@421: m4_if([$1], [noext], [], [dnl Chris@421: if test x$ac_success = xno; then Chris@421: for switch in -std=gnu++11 -std=gnu++0x; do Chris@421: cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch]) Chris@421: AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch, Chris@421: $cachevar, Chris@421: [ac_save_CXXFLAGS="$CXXFLAGS" Chris@421: CXXFLAGS="$CXXFLAGS $switch" Chris@421: AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], Chris@421: [eval $cachevar=yes], Chris@421: [eval $cachevar=no]) Chris@421: CXXFLAGS="$ac_save_CXXFLAGS"]) Chris@421: if eval test x\$$cachevar = xyes; then Chris@421: CXXFLAGS="$CXXFLAGS $switch" Chris@421: ac_success=yes Chris@421: break Chris@421: fi Chris@421: done Chris@421: fi]) Chris@421: Chris@421: m4_if([$1], [ext], [], [dnl Chris@421: if test x$ac_success = xno; then Chris@421: for switch in -std=c++11 -std=c++0x; do Chris@421: cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch]) Chris@421: AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch, Chris@421: $cachevar, Chris@421: [ac_save_CXXFLAGS="$CXXFLAGS" Chris@421: CXXFLAGS="$CXXFLAGS $switch" Chris@421: AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], Chris@421: [eval $cachevar=yes], Chris@421: [eval $cachevar=no]) Chris@421: CXXFLAGS="$ac_save_CXXFLAGS"]) Chris@421: if eval test x\$$cachevar = xyes; then Chris@421: CXXFLAGS="$CXXFLAGS $switch" Chris@421: ac_success=yes Chris@421: break Chris@421: fi Chris@421: done Chris@421: fi]) Chris@421: AC_LANG_POP([C++]) Chris@421: if test x$ax_cxx_compile_cxx11_required = xtrue; then Chris@421: if test x$ac_success = xno; then Chris@421: AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.]) Chris@421: fi Chris@421: else Chris@421: if test x$ac_success = xno; then Chris@421: HAVE_CXX11=0 Chris@421: AC_MSG_NOTICE([No compiler with C++11 support was found]) Chris@421: else Chris@421: HAVE_CXX11=1 Chris@421: AC_DEFINE(HAVE_CXX11,1, Chris@421: [define if the compiler supports basic C++11 syntax]) Chris@421: fi Chris@421: Chris@421: AC_SUBST(HAVE_CXX11) Chris@421: fi Chris@421: ]) Chris@421: