Chris@350: Chris@350: AC_DEFUN([SV_MODULE_REQUIRED], Chris@350: [ Chris@350: SV_MODULE_MODULE=$1 Chris@350: SV_MODULE_VERSION_TEST="$2" Chris@350: SV_MODULE_HEADER=$3 Chris@350: SV_MODULE_LIB=$4 Chris@350: SV_MODULE_FUNC=$5 Chris@350: SV_MODULE_HAVE=HAVE_$(echo $1 | tr '[a-z]' '[A-Z]') Chris@350: SV_MODULE_FAILED=1 Chris@405: if test -n "$$1_LIBS" ; then Chris@405: AC_MSG_NOTICE([User set ${SV_MODULE_MODULE}_LIBS explicitly, skipping test for $SV_MODULE_MODULE]) Chris@405: CXXFLAGS="$CXXFLAGS $$1_CFLAGS" Chris@405: LIBS="$LIBS $$1_LIBS" Chris@405: SV_MODULE_FAILED="" Chris@405: fi Chris@350: if test -z "$SV_MODULE_VERSION_TEST" ; then Chris@350: SV_MODULE_VERSION_TEST=$SV_MODULE_MODULE Chris@350: fi Chris@405: if test -n "$SV_MODULE_FAILED" && test -n "$PKG_CONFIG"; then Chris@350: 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: fi Chris@350: if test -n "$SV_MODULE_FAILED"; then Chris@350: 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: if test -n "$SV_MODULE_LIB"; then Chris@350: 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: fi Chris@350: fi Chris@350: ]) Chris@350: Chris@350: AC_DEFUN([SV_MODULE_OPTIONAL], Chris@350: [ Chris@350: SV_MODULE_MODULE=$1 Chris@350: SV_MODULE_VERSION_TEST="$2" Chris@350: SV_MODULE_HEADER=$3 Chris@350: SV_MODULE_LIB=$4 Chris@350: SV_MODULE_FUNC=$5 Chris@350: SV_MODULE_HAVE=HAVE_$(echo $1 | tr '[a-z]' '[A-Z]') Chris@350: SV_MODULE_FAILED=1 Chris@405: if test -n "$$1_LIBS" ; then Chris@405: AC_MSG_NOTICE([User set ${SV_MODULE_MODULE}_LIBS explicitly, skipping test for $SV_MODULE_MODULE]) Chris@405: CXXFLAGS="$CXXFLAGS $$1_CFLAGS" Chris@405: LIBS="$LIBS $$1_LIBS" Chris@405: SV_MODULE_FAILED="" Chris@405: fi Chris@350: if test -z "$SV_MODULE_VERSION_TEST" ; then Chris@350: SV_MODULE_VERSION_TEST=$SV_MODULE_MODULE Chris@350: fi Chris@405: if test -n "$SV_MODULE_FAILED" && test -n "$PKG_CONFIG"; then Chris@352: 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: fi Chris@350: if test -n "$SV_MODULE_FAILED"; then Chris@350: 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: if test -z "$SV_MODULE_FAILED"; then Chris@350: if test -n "$SV_MODULE_LIB"; then Chris@350: 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: fi Chris@350: fi Chris@350: fi Chris@350: ]) Chris@350: Chris@354: # Check for Qt. The only part of Qt we use directly is qmake. Chris@354: Chris@350: AC_DEFUN([SV_CHECK_QT], Chris@350: [ Chris@350: AC_REQUIRE([AC_PROG_CXX]) Chris@350: Chris@354: if test x$QMAKE = x ; then Chris@545: AC_CHECK_PROG(QMAKE, qmake-qt5, $QTDIR/bin/qmake-qt5,,$QTDIR/bin/) Chris@354: fi Chris@354: if test x$QMAKE = x ; then Chris@1119: AC_CHECK_PROG(QMAKE, qt5-qmake, $QTDIR/bin/qt5-qmake,,$QTDIR/bin/) Chris@1119: fi Chris@1119: if test x$QMAKE = x ; then Chris@354: AC_CHECK_PROG(QMAKE, qmake, $QTDIR/bin/qmake,,$QTDIR/bin/) Chris@354: fi Chris@354: if test x$QMAKE = x ; then Chris@354: AC_CHECK_PROG(QMAKE, qmake.exe, $QTDIR/bin/qmake.exe,,$QTDIR/bin/) Chris@354: fi Chris@354: if test x$QMAKE = x ; then Chris@545: AC_CHECK_PROG(QMAKE, qmake-qt5, qmake-qt5,,$PATH) Chris@354: fi Chris@354: if test x$QMAKE = x ; then Chris@1119: AC_CHECK_PROG(QMAKE, qt5-qmake, qt5-qmake,,$PATH) Chris@1119: fi Chris@1119: if test x$QMAKE = x ; then Chris@354: AC_CHECK_PROG(QMAKE, qmake, qmake,,$PATH) Chris@354: fi Chris@354: if test x$QMAKE = x ; then Chris@354: AC_MSG_ERROR([ Chris@545: Failed to find the required qmake-qt5 or qmake program. Please Chris@545: ensure you have the necessary Qt5 development files installed, and Chris@545: if necessary set QTDIR to the location of your Qt5 installation. Chris@350: ]) Chris@350: fi Chris@350: Chris@350: # Suitable versions of qmake should print out something like: Chris@350: # Chris@350: # QMake version 2.01a Chris@350: # Using Qt version 4.6.3 in /usr/lib Chris@350: # Chris@350: # This may be translated, so we check only for the numbers (2.x and 4.x Chris@350: # in that order). Chris@350: # Chris@350: QMAKE_VERSION_OUTPUT=`$QMAKE -v` Chris@350: case "$QMAKE_VERSION_OUTPUT" in Chris@545: *5.*) ;; Chris@350: *) AC_MSG_WARN([ Chris@350: *** The version of qmake found in "$QMAKE" looks like it might be Chris@545: from the wrong version of Qt (Qt5 is required). Please check Chris@545: that this is the correct version of qmake for Qt5 builds. Chris@350: ]) Chris@350: esac Chris@350: Chris@359: case "`uname`" in Chris@359: *Darwin*) QMAKE="$QMAKE -spec macx-g++";; Chris@359: esac Chris@359: Chris@350: ]) Chris@350: Chris@884: # From autoconf archive: Chris@884: Chris@884: # ============================================================================ Chris@884: # http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html Chris@884: # ============================================================================ Chris@884: # Chris@884: # SYNOPSIS Chris@884: # Chris@884: # AX_CXX_COMPILE_STDCXX_11([ext|noext],[mandatory|optional]) Chris@884: # Chris@884: # DESCRIPTION Chris@884: # Chris@884: # Check for baseline language coverage in the compiler for the C++11 Chris@884: # standard; if necessary, add switches to CXXFLAGS to enable support. Chris@884: # Chris@884: # The first argument, if specified, indicates whether you insist on an Chris@884: # extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. Chris@884: # -std=c++11). If neither is specified, you get whatever works, with Chris@884: # preference for an extended mode. Chris@884: # Chris@884: # The second argument, if specified 'mandatory' or if left unspecified, Chris@884: # indicates that baseline C++11 support is required and that the macro Chris@884: # should error out if no mode with that support is found. If specified Chris@884: # 'optional', then configuration proceeds regardless, after defining Chris@884: # HAVE_CXX11 if and only if a supporting mode is found. Chris@884: # Chris@884: # LICENSE Chris@884: # Chris@884: # Copyright (c) 2008 Benjamin Kosnik Chris@884: # Copyright (c) 2012 Zack Weinberg Chris@884: # Copyright (c) 2013 Roy Stogner Chris@884: # Copyright (c) 2014 Alexey Sokolov Chris@884: # Chris@884: # Copying and distribution of this file, with or without modification, are Chris@884: # permitted in any medium without royalty provided the copyright notice Chris@884: # and this notice are preserved. This file is offered as-is, without any Chris@884: # warranty. Chris@884: Chris@884: m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [[ Chris@884: template Chris@884: struct check Chris@884: { Chris@884: static_assert(sizeof(int) <= sizeof(T), "not big enough"); Chris@884: }; Chris@884: Chris@884: struct Base { Chris@884: virtual void f() {} Chris@884: }; Chris@884: struct Child : public Base { Chris@884: virtual void f() override {} Chris@884: }; Chris@884: Chris@884: typedef check> right_angle_brackets; Chris@884: Chris@884: int a; Chris@884: decltype(a) b; Chris@884: Chris@884: typedef check check_type; Chris@884: check_type c; Chris@884: check_type&& cr = static_cast(c); Chris@884: Chris@884: auto d = a; Chris@884: auto l = [](){}; Chris@884: ]]) Chris@884: Chris@884: AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl Chris@884: m4_if([$1], [], [], Chris@884: [$1], [ext], [], Chris@884: [$1], [noext], [], Chris@884: [m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_11])])dnl Chris@884: m4_if([$2], [], [ax_cxx_compile_cxx11_required=true], Chris@884: [$2], [mandatory], [ax_cxx_compile_cxx11_required=true], Chris@884: [$2], [optional], [ax_cxx_compile_cxx11_required=false], Chris@884: [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX_11])]) Chris@884: AC_LANG_PUSH([C++])dnl Chris@884: ac_success=no Chris@884: AC_CACHE_CHECK(whether $CXX supports C++11 features by default, Chris@884: ax_cv_cxx_compile_cxx11, Chris@884: [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], Chris@884: [ax_cv_cxx_compile_cxx11=yes], Chris@884: [ax_cv_cxx_compile_cxx11=no])]) Chris@884: if test x$ax_cv_cxx_compile_cxx11 = xyes; then Chris@884: ac_success=yes Chris@884: fi Chris@884: Chris@884: m4_if([$1], [noext], [], [dnl Chris@884: if test x$ac_success = xno; then Chris@884: for switch in -std=gnu++11 -std=gnu++0x; do Chris@884: cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch]) Chris@884: AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch, Chris@884: $cachevar, Chris@884: [ac_save_CXXFLAGS="$CXXFLAGS" Chris@884: CXXFLAGS="$CXXFLAGS $switch" Chris@884: AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], Chris@884: [eval $cachevar=yes], Chris@884: [eval $cachevar=no]) Chris@884: CXXFLAGS="$ac_save_CXXFLAGS"]) Chris@884: if eval test x\$$cachevar = xyes; then Chris@884: CXXFLAGS="$CXXFLAGS $switch" Chris@884: ac_success=yes Chris@884: break Chris@884: fi Chris@884: done Chris@884: fi]) Chris@884: Chris@884: m4_if([$1], [ext], [], [dnl Chris@884: if test x$ac_success = xno; then Chris@884: for switch in -std=c++11 -std=c++0x; do Chris@884: cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch]) Chris@884: AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch, Chris@884: $cachevar, Chris@884: [ac_save_CXXFLAGS="$CXXFLAGS" Chris@884: CXXFLAGS="$CXXFLAGS $switch" Chris@884: AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], Chris@884: [eval $cachevar=yes], Chris@884: [eval $cachevar=no]) Chris@884: CXXFLAGS="$ac_save_CXXFLAGS"]) Chris@884: if eval test x\$$cachevar = xyes; then Chris@884: CXXFLAGS="$CXXFLAGS $switch" Chris@884: ac_success=yes Chris@884: break Chris@884: fi Chris@884: done Chris@884: fi]) Chris@884: AC_LANG_POP([C++]) Chris@884: if test x$ax_cxx_compile_cxx11_required = xtrue; then Chris@884: if test x$ac_success = xno; then Chris@884: AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.]) Chris@884: fi Chris@884: else Chris@884: if test x$ac_success = xno; then Chris@884: HAVE_CXX11=0 Chris@884: AC_MSG_NOTICE([No compiler with C++11 support was found]) Chris@884: else Chris@884: HAVE_CXX11=1 Chris@884: AC_DEFINE(HAVE_CXX11,1, Chris@884: [define if the compiler supports basic C++11 syntax]) Chris@884: fi Chris@884: Chris@884: AC_SUBST(HAVE_CXX11) Chris@884: fi Chris@884: ]) Chris@884: Chris@1976: # =========================================================================== Chris@1976: # https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html Chris@1976: # =========================================================================== Chris@1976: # Chris@1976: # SYNOPSIS Chris@1976: # Chris@1976: # AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) Chris@1976: # Chris@1976: # DESCRIPTION Chris@1976: # Chris@1976: # Check whether the given FLAG works with the current language's compiler Chris@1976: # or gives an error. (Warnings, however, are ignored) Chris@1976: # Chris@1976: # ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on Chris@1976: # success/failure. Chris@1976: # Chris@1976: # If EXTRA-FLAGS is defined, it is added to the current language's default Chris@1976: # flags (e.g. CFLAGS) when the check is done. The check is thus made with Chris@1976: # the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to Chris@1976: # force the compiler to issue an error when a bad flag is given. Chris@1976: # Chris@1976: # INPUT gives an alternative input source to AC_COMPILE_IFELSE. Chris@1976: # Chris@1976: # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this Chris@1976: # macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. Chris@1976: # Chris@1976: # LICENSE Chris@1976: # Chris@1976: # Copyright (c) 2008 Guido U. Draheim Chris@1976: # Copyright (c) 2011 Maarten Bosmans Chris@1976: # Chris@1976: # Copying and distribution of this file, with or without modification, are Chris@1976: # permitted in any medium without royalty provided the copyright notice Chris@1976: # and this notice are preserved. This file is offered as-is, without any Chris@1976: # warranty. Chris@1976: Chris@1976: AC_DEFUN([AX_CHECK_COMPILE_FLAG], Chris@1976: [AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF Chris@1976: AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl Chris@1976: AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ Chris@1976: ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS Chris@1976: _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" Chris@1976: AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], Chris@1976: [AS_VAR_SET(CACHEVAR,[yes])], Chris@1976: [AS_VAR_SET(CACHEVAR,[no])]) Chris@1976: _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) Chris@1976: AS_VAR_IF(CACHEVAR,yes, Chris@1976: [m4_default([$2], :)], Chris@1976: [m4_default([$3], :)]) Chris@1976: AS_VAR_POPDEF([CACHEVAR])dnl Chris@1976: ])dnl AX_CHECK_COMPILE_FLAGS