some rearrangements; refs #33
This commit is contained in:
87
m4/ax_check_qt.m4
Normal file
87
m4/ax_check_qt.m4
Normal file
@@ -0,0 +1,87 @@
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_CXX_CHECK_QT([qt_prefix], [list-of-qt-modules])
|
||||
#
|
||||
# DESCRIPTIONS
|
||||
#
|
||||
# qt_prefix
|
||||
#
|
||||
# Each call to AX_CXX_CHECK_QT should have a different prefix
|
||||
# value (with a few exceptions discussed later on). This value,
|
||||
# usually provided in uppercase, is used as prefix to the
|
||||
# variables holding the compiler flags and libraries reported by
|
||||
# pkg-config.
|
||||
#
|
||||
# For instance, if your prefix was to be FOO you'll be provided
|
||||
# two variables FOO_CFLAGS and FOO_LIBS.
|
||||
#
|
||||
# This will also be used as message during the configure checks:
|
||||
# checking for FOO....
|
||||
#
|
||||
# list-of-modules
|
||||
#
|
||||
# A single call to the macro can check for the presence of one or
|
||||
# more qt modules; you'll see later how to make good use of this
|
||||
# feature. Each entry in the list can have a version comparison
|
||||
# specifier, with the same syntax as the Requires keyword in the
|
||||
# data files themselves.
|
||||
|
||||
AC_DEFUN([AX_CXX_QT_TOOL], [
|
||||
AC_ARG_VAR([$1], [path to Qt tool $2])
|
||||
$1=${$1:-$(pkg-config --variable=$2_location Qt5Core)}
|
||||
$1=${$1:-$(pkg-config --variable=host_bins Qt5Core)/$2}
|
||||
$1=${$1:-$(pkg-config --variable=$2_location QtCore)}
|
||||
$1=${$1:-$(pkg-config --variable=host_bins QtCore)/$2}
|
||||
if ! which "$$1" > /dev/null; then
|
||||
if which "$2" > /dev/null; then
|
||||
$1=$2
|
||||
else
|
||||
if test -n "$$1"; then
|
||||
AC_MSG_ERROR([Missing Qt program: $2 (tested: $$1)])
|
||||
else
|
||||
AC_MSG_ERROR([Missing Qt program: $2 (specify variable $1)])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
AC_SUBST($1)
|
||||
AC_MSG_NOTICE([using $$1 for $2])
|
||||
])
|
||||
|
||||
AC_DEFUN([AX_CXX_QT_TOOLS], [
|
||||
AX_CXX_QT_TOOL(QMAKE, qmake)
|
||||
AX_CXX_QT_TOOL(MOC, moc)
|
||||
AX_CXX_QT_TOOL(UIC, uic)
|
||||
AX_CXX_QT_TOOL(RCC, rcc)
|
||||
AX_CXX_QT_TOOL(LUPDATE, lupdate)
|
||||
AX_CXX_QT_TOOL(LRELEASE, lrelease)
|
||||
])
|
||||
|
||||
AC_DEFUN([AX_CXX_CHECK_QT], [
|
||||
qt_modules="$2"
|
||||
AX_CXX_QT_TOOLS
|
||||
HAVE_$1=0
|
||||
PKG_CHECK_MODULES([$1], [${qt_modules//Qt/Qt5}], [
|
||||
HAVE_$1=1
|
||||
AC_DEFINE([HAVE_$1])
|
||||
AM_CPPFLAGS+=" ${$1_CFLAGS}"
|
||||
AM_CXXFLAGS+=" ${$1_CFLAGS}"
|
||||
LIBS+=" ${$1_LIBS}"
|
||||
], [
|
||||
PKG_CHECK_MODULES([$1], [${qt_modules}], [
|
||||
HAVE_$1=1
|
||||
AC_DEFINE([HAVE_$1])
|
||||
AM_CPPFLAGS+=" ${$1_CFLAGS}"
|
||||
AM_CXXFLAGS+=" ${$1_CFLAGS}"
|
||||
LIBS+=" ${$1_LIBS}"
|
||||
])
|
||||
])
|
||||
AM_CONDITIONAL(HAVE_$1, test $HAVE_$1 -eq 1)
|
||||
AC_SUBST(AM_CPPFLAGS)
|
||||
AC_SUBST(AM_CXXFLAGS)
|
||||
AX_CHECK_COMPILE_FLAG(-fPIC, [AM_CXXFLAGS+=" -fPIC"])
|
||||
AX_CHECK_COMPILE_FLAG(-DPIC, [AM_CXXFLAGS+=" -DPIC"])
|
||||
AX_CHECK_COMPILE_FLAG(-fPIE, [AM_CXXFLAGS+=" -fPIE"])
|
||||
AX_CHECK_LINK_FLAG(-fPIC, [LDFLAGS+=" -fPIC"])
|
||||
AX_CHECK_LINK_FLAG(-DPIC, [LDFLAGS+=" -DPIC"])
|
||||
AX_CHECK_LINK_FLAG(-fPIE, [LDFLAGS+=" -fPIE"])
|
||||
])
|
133
m4/ax_cxx_compile_stdcxx_11.m4
Normal file
133
m4/ax_cxx_compile_stdcxx_11.m4
Normal file
@@ -0,0 +1,133 @@
|
||||
# ============================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html
|
||||
# ============================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_CXX_COMPILE_STDCXX_11([ext|noext],[mandatory|optional])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Check for baseline language coverage in the compiler for the C++11
|
||||
# standard; if necessary, add switches to CXXFLAGS to enable support.
|
||||
#
|
||||
# The first argument, if specified, indicates whether you insist on an
|
||||
# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
|
||||
# -std=c++11). If neither is specified, you get whatever works, with
|
||||
# preference for an extended mode.
|
||||
#
|
||||
# The second argument, if specified 'mandatory' or if left unspecified,
|
||||
# indicates that baseline C++11 support is required and that the macro
|
||||
# should error out if no mode with that support is found. If specified
|
||||
# 'optional', then configuration proceeds regardless, after defining
|
||||
# HAVE_CXX11 if and only if a supporting mode is found.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
|
||||
# Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
|
||||
# Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 3
|
||||
|
||||
m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [
|
||||
template <typename T>
|
||||
struct check
|
||||
{
|
||||
static_assert(sizeof(int) <= sizeof(T), "not big enough");
|
||||
};
|
||||
|
||||
typedef check<check<bool>> right_angle_brackets;
|
||||
|
||||
int a;
|
||||
decltype(a) b;
|
||||
|
||||
typedef check<int> check_type;
|
||||
check_type c;
|
||||
check_type&& cr = static_cast<check_type&&>(c);
|
||||
|
||||
auto d = a;
|
||||
])
|
||||
|
||||
AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
|
||||
m4_if([$1], [], [],
|
||||
[$1], [ext], [],
|
||||
[$1], [noext], [],
|
||||
[m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_11])])dnl
|
||||
m4_if([$2], [], [ax_cxx_compile_cxx11_required=true],
|
||||
[$2], [mandatory], [ax_cxx_compile_cxx11_required=true],
|
||||
[$2], [optional], [ax_cxx_compile_cxx11_required=false],
|
||||
[m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX_11])])dnl
|
||||
AC_LANG_PUSH([C++])dnl
|
||||
ac_success=no
|
||||
AC_CACHE_CHECK(whether $CXX supports C++11 features by default,
|
||||
ax_cv_cxx_compile_cxx11,
|
||||
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
|
||||
[ax_cv_cxx_compile_cxx11=yes],
|
||||
[ax_cv_cxx_compile_cxx11=no])])
|
||||
if test x$ax_cv_cxx_compile_cxx11 = xyes; then
|
||||
ac_success=yes
|
||||
fi
|
||||
|
||||
m4_if([$1], [noext], [], [dnl
|
||||
if test x$ac_success = xno; then
|
||||
for switch in -std=gnu++11 -std=gnu++0x; do
|
||||
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
|
||||
AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
|
||||
$cachevar,
|
||||
[ac_save_CXXFLAGS="$CXXFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $switch"
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
|
||||
[eval $cachevar=yes],
|
||||
[eval $cachevar=no])
|
||||
CXXFLAGS="$ac_save_CXXFLAGS"])
|
||||
if eval test x\$$cachevar = xyes; then
|
||||
CXXFLAGS="$CXXFLAGS $switch"
|
||||
ac_success=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi])
|
||||
|
||||
m4_if([$1], [ext], [], [dnl
|
||||
if test x$ac_success = xno; then
|
||||
for switch in -std=c++11 -std=c++0x; do
|
||||
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
|
||||
AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
|
||||
$cachevar,
|
||||
[ac_save_CXXFLAGS="$CXXFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $switch"
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
|
||||
[eval $cachevar=yes],
|
||||
[eval $cachevar=no])
|
||||
CXXFLAGS="$ac_save_CXXFLAGS"])
|
||||
if eval test x\$$cachevar = xyes; then
|
||||
CXXFLAGS="$CXXFLAGS $switch"
|
||||
ac_success=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi])
|
||||
AC_LANG_POP([C++])
|
||||
if test x$ax_cxx_compile_cxx11_required = xtrue; then
|
||||
if test x$ac_success = xno; then
|
||||
AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.])
|
||||
fi
|
||||
else
|
||||
if test x$ac_success = xno; then
|
||||
HAVE_CXX11=0
|
||||
AC_MSG_NOTICE([No compiler with C++11 support was found])
|
||||
else
|
||||
HAVE_CXX11=1
|
||||
AC_DEFINE(HAVE_CXX11,1,
|
||||
[define if the compiler supports basic C++11 syntax])
|
||||
fi
|
||||
|
||||
AC_SUBST(HAVE_CXX11)
|
||||
fi
|
||||
])
|
Reference in New Issue
Block a user