To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / acinclude.m4 @ 110:125520c3dc05
History | View | Annotate | Download (10.9 KB)
| 1 |
|
|---|---|
| 2 |
AC_DEFUN([SV_MODULE_REQUIRED], |
| 3 |
[ |
| 4 |
SV_MODULE_MODULE=$1 |
| 5 |
SV_MODULE_VERSION_TEST="$2" |
| 6 |
SV_MODULE_HEADER=$3 |
| 7 |
SV_MODULE_LIB=$4 |
| 8 |
SV_MODULE_FUNC=$5 |
| 9 |
SV_MODULE_HAVE=HAVE_$(echo $1 | tr '[a-z]' '[A-Z]') |
| 10 |
SV_MODULE_FAILED=1 |
| 11 |
if test -n "$$1_LIBS" ; then |
| 12 |
AC_MSG_NOTICE([User set ${SV_MODULE_MODULE}_LIBS explicitly, skipping test for $SV_MODULE_MODULE])
|
| 13 |
CXXFLAGS="$CXXFLAGS $$1_CFLAGS" |
| 14 |
LIBS="$LIBS $$1_LIBS" |
| 15 |
SV_MODULE_FAILED="" |
| 16 |
fi |
| 17 |
if test -z "$SV_MODULE_VERSION_TEST" ; then |
| 18 |
SV_MODULE_VERSION_TEST=$SV_MODULE_MODULE |
| 19 |
fi |
| 20 |
if test -n "$SV_MODULE_FAILED" && test -n "$PKG_CONFIG"; then |
| 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])]) |
| 22 |
fi |
| 23 |
if test -n "$SV_MODULE_FAILED"; then |
| 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])]) |
| 25 |
if test -n "$SV_MODULE_LIB"; then |
| 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])]) |
| 27 |
fi |
| 28 |
fi |
| 29 |
]) |
| 30 |
|
| 31 |
AC_DEFUN([SV_MODULE_OPTIONAL], |
| 32 |
[ |
| 33 |
SV_MODULE_MODULE=$1 |
| 34 |
SV_MODULE_VERSION_TEST="$2" |
| 35 |
SV_MODULE_HEADER=$3 |
| 36 |
SV_MODULE_LIB=$4 |
| 37 |
SV_MODULE_FUNC=$5 |
| 38 |
SV_MODULE_HAVE=HAVE_$(echo $1 | tr '[a-z]' '[A-Z]') |
| 39 |
SV_MODULE_FAILED=1 |
| 40 |
if test -n "$$1_LIBS" ; then |
| 41 |
AC_MSG_NOTICE([User set ${SV_MODULE_MODULE}_LIBS explicitly, skipping test for $SV_MODULE_MODULE])
|
| 42 |
CXXFLAGS="$CXXFLAGS $$1_CFLAGS" |
| 43 |
LIBS="$LIBS $$1_LIBS" |
| 44 |
SV_MODULE_FAILED="" |
| 45 |
fi |
| 46 |
if test -z "$SV_MODULE_VERSION_TEST" ; then |
| 47 |
SV_MODULE_VERSION_TEST=$SV_MODULE_MODULE |
| 48 |
fi |
| 49 |
if test -n "$SV_MODULE_FAILED" && test -n "$PKG_CONFIG"; then |
| 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])]) |
| 51 |
fi |
| 52 |
if test -n "$SV_MODULE_FAILED"; then |
| 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])]) |
| 54 |
if test -z "$SV_MODULE_FAILED"; then |
| 55 |
if test -n "$SV_MODULE_LIB"; then |
| 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])]) |
| 57 |
fi |
| 58 |
fi |
| 59 |
fi |
| 60 |
]) |
| 61 |
|
| 62 |
# Check for Qt. The only part of Qt we use directly is qmake. |
| 63 |
|
| 64 |
AC_DEFUN([SV_CHECK_QT], |
| 65 |
[ |
| 66 |
AC_REQUIRE([AC_PROG_CXX]) |
| 67 |
|
| 68 |
if test x$QMAKE = x ; then |
| 69 |
AC_CHECK_PROG(QMAKE, qmake-qt5, $QTDIR/bin/qmake-qt5,,$QTDIR/bin/) |
| 70 |
fi |
| 71 |
if test x$QMAKE = x ; then |
| 72 |
AC_CHECK_PROG(QMAKE, qt5-qmake, $QTDIR/bin/qt5-qmake,,$QTDIR/bin/) |
| 73 |
fi |
| 74 |
if test x$QMAKE = x ; then |
| 75 |
AC_CHECK_PROG(QMAKE, qmake, $QTDIR/bin/qmake,,$QTDIR/bin/) |
| 76 |
fi |
| 77 |
if test x$QMAKE = x ; then |
| 78 |
AC_CHECK_PROG(QMAKE, qmake.exe, $QTDIR/bin/qmake.exe,,$QTDIR/bin/) |
| 79 |
fi |
| 80 |
if test x$QMAKE = x ; then |
| 81 |
AC_CHECK_PROG(QMAKE, qmake-qt5, qmake-qt5,,$PATH) |
| 82 |
fi |
| 83 |
if test x$QMAKE = x ; then |
| 84 |
AC_CHECK_PROG(QMAKE, qt5-qmake, qt5-qmake,,$PATH) |
| 85 |
fi |
| 86 |
if test x$QMAKE = x ; then |
| 87 |
AC_CHECK_PROG(QMAKE, qmake, qmake,,$PATH) |
| 88 |
fi |
| 89 |
if test x$QMAKE = x ; then |
| 90 |
AC_MSG_ERROR([ |
| 91 |
Failed to find the required qmake-qt5 or qmake program. Please |
| 92 |
ensure you have the necessary Qt5 development files installed, and |
| 93 |
if necessary set QTDIR to the location of your Qt5 installation. |
| 94 |
]) |
| 95 |
fi |
| 96 |
|
| 97 |
# Suitable versions of qmake should print out something like: |
| 98 |
# |
| 99 |
# QMake version 2.01a |
| 100 |
# Using Qt version 4.6.3 in /usr/lib |
| 101 |
# |
| 102 |
# This may be translated, so we check only for the numbers (2.x and 4.x |
| 103 |
# in that order). |
| 104 |
# |
| 105 |
QMAKE_VERSION_OUTPUT=`$QMAKE -v` |
| 106 |
case "$QMAKE_VERSION_OUTPUT" in |
| 107 |
*5.*) ;; |
| 108 |
*) AC_MSG_WARN([ |
| 109 |
*** The version of qmake found in "$QMAKE" looks like it might be |
| 110 |
from the wrong version of Qt (Qt5 is required). Please check |
| 111 |
that this is the correct version of qmake for Qt5 builds. |
| 112 |
]) |
| 113 |
esac |
| 114 |
|
| 115 |
case "`uname`" in |
| 116 |
*Darwin*) QMAKE="$QMAKE -spec macx-g++";; |
| 117 |
esac |
| 118 |
|
| 119 |
]) |
| 120 |
|
| 121 |
# From autoconf archive: |
| 122 |
|
| 123 |
# ============================================================================ |
| 124 |
# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html |
| 125 |
# ============================================================================ |
| 126 |
# |
| 127 |
# SYNOPSIS |
| 128 |
# |
| 129 |
# AX_CXX_COMPILE_STDCXX_11([ext|noext],[mandatory|optional]) |
| 130 |
# |
| 131 |
# DESCRIPTION |
| 132 |
# |
| 133 |
# Check for baseline language coverage in the compiler for the C++11 |
| 134 |
# standard; if necessary, add switches to CXXFLAGS to enable support. |
| 135 |
# |
| 136 |
# The first argument, if specified, indicates whether you insist on an |
| 137 |
# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. |
| 138 |
# -std=c++11). If neither is specified, you get whatever works, with |
| 139 |
# preference for an extended mode. |
| 140 |
# |
| 141 |
# The second argument, if specified 'mandatory' or if left unspecified, |
| 142 |
# indicates that baseline C++11 support is required and that the macro |
| 143 |
# should error out if no mode with that support is found. If specified |
| 144 |
# 'optional', then configuration proceeds regardless, after defining |
| 145 |
# HAVE_CXX11 if and only if a supporting mode is found. |
| 146 |
# |
| 147 |
# LICENSE |
| 148 |
# |
| 149 |
# Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com> |
| 150 |
# Copyright (c) 2012 Zack Weinberg <zackw@panix.com> |
| 151 |
# Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu> |
| 152 |
# Copyright (c) 2014 Alexey Sokolov <sokolov@google.com> |
| 153 |
# |
| 154 |
# Copying and distribution of this file, with or without modification, are |
| 155 |
# permitted in any medium without royalty provided the copyright notice |
| 156 |
# and this notice are preserved. This file is offered as-is, without any |
| 157 |
# warranty. |
| 158 |
|
| 159 |
m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [[ |
| 160 |
template <typename T> |
| 161 |
struct check |
| 162 |
{
|
| 163 |
static_assert(sizeof(int) <= sizeof(T), "not big enough"); |
| 164 |
}; |
| 165 |
|
| 166 |
struct Base {
|
| 167 |
virtual void f() {}
|
| 168 |
}; |
| 169 |
struct Child : public Base {
|
| 170 |
virtual void f() override {}
|
| 171 |
}; |
| 172 |
|
| 173 |
typedef check<check<bool>> right_angle_brackets; |
| 174 |
|
| 175 |
int a; |
| 176 |
decltype(a) b; |
| 177 |
|
| 178 |
typedef check<int> check_type; |
| 179 |
check_type c; |
| 180 |
check_type&& cr = static_cast<check_type&&>(c); |
| 181 |
|
| 182 |
auto d = a; |
| 183 |
auto l = [](){};
|
| 184 |
]]) |
| 185 |
|
| 186 |
AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl |
| 187 |
m4_if([$1], [], [], |
| 188 |
[$1], [ext], [], |
| 189 |
[$1], [noext], [], |
| 190 |
[m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_11])])dnl |
| 191 |
m4_if([$2], [], [ax_cxx_compile_cxx11_required=true], |
| 192 |
[$2], [mandatory], [ax_cxx_compile_cxx11_required=true], |
| 193 |
[$2], [optional], [ax_cxx_compile_cxx11_required=false], |
| 194 |
[m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX_11])]) |
| 195 |
AC_LANG_PUSH([C++])dnl |
| 196 |
ac_success=no |
| 197 |
AC_CACHE_CHECK(whether $CXX supports C++11 features by default, |
| 198 |
ax_cv_cxx_compile_cxx11, |
| 199 |
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], |
| 200 |
[ax_cv_cxx_compile_cxx11=yes], |
| 201 |
[ax_cv_cxx_compile_cxx11=no])]) |
| 202 |
if test x$ax_cv_cxx_compile_cxx11 = xyes; then |
| 203 |
ac_success=yes |
| 204 |
fi |
| 205 |
|
| 206 |
m4_if([$1], [noext], [], [dnl |
| 207 |
if test x$ac_success = xno; then |
| 208 |
for switch in -std=gnu++11 -std=gnu++0x; do |
| 209 |
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch]) |
| 210 |
AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch, |
| 211 |
$cachevar, |
| 212 |
[ac_save_CXXFLAGS="$CXXFLAGS" |
| 213 |
CXXFLAGS="$CXXFLAGS $switch" |
| 214 |
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], |
| 215 |
[eval $cachevar=yes], |
| 216 |
[eval $cachevar=no]) |
| 217 |
CXXFLAGS="$ac_save_CXXFLAGS"]) |
| 218 |
if eval test x\$$cachevar = xyes; then |
| 219 |
CXXFLAGS="$CXXFLAGS $switch" |
| 220 |
ac_success=yes |
| 221 |
break |
| 222 |
fi |
| 223 |
done |
| 224 |
fi]) |
| 225 |
|
| 226 |
m4_if([$1], [ext], [], [dnl |
| 227 |
if test x$ac_success = xno; then |
| 228 |
for switch in -std=c++11 -std=c++0x; do |
| 229 |
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch]) |
| 230 |
AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch, |
| 231 |
$cachevar, |
| 232 |
[ac_save_CXXFLAGS="$CXXFLAGS" |
| 233 |
CXXFLAGS="$CXXFLAGS $switch" |
| 234 |
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], |
| 235 |
[eval $cachevar=yes], |
| 236 |
[eval $cachevar=no]) |
| 237 |
CXXFLAGS="$ac_save_CXXFLAGS"]) |
| 238 |
if eval test x\$$cachevar = xyes; then |
| 239 |
CXXFLAGS="$CXXFLAGS $switch" |
| 240 |
ac_success=yes |
| 241 |
break |
| 242 |
fi |
| 243 |
done |
| 244 |
fi]) |
| 245 |
AC_LANG_POP([C++]) |
| 246 |
if test x$ax_cxx_compile_cxx11_required = xtrue; then |
| 247 |
if test x$ac_success = xno; then |
| 248 |
AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.]) |
| 249 |
fi |
| 250 |
else |
| 251 |
if test x$ac_success = xno; then |
| 252 |
HAVE_CXX11=0 |
| 253 |
AC_MSG_NOTICE([No compiler with C++11 support was found]) |
| 254 |
else |
| 255 |
HAVE_CXX11=1 |
| 256 |
AC_DEFINE(HAVE_CXX11,1, |
| 257 |
[define if the compiler supports basic C++11 syntax]) |
| 258 |
fi |
| 259 |
|
| 260 |
AC_SUBST(HAVE_CXX11) |
| 261 |
fi |
| 262 |
]) |
| 263 |
|
| 264 |
# =========================================================================== |
| 265 |
# https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html |
| 266 |
# =========================================================================== |
| 267 |
# |
| 268 |
# SYNOPSIS |
| 269 |
# |
| 270 |
# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) |
| 271 |
# |
| 272 |
# DESCRIPTION |
| 273 |
# |
| 274 |
# Check whether the given FLAG works with the current language's compiler |
| 275 |
# or gives an error. (Warnings, however, are ignored) |
| 276 |
# |
| 277 |
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on |
| 278 |
# success/failure. |
| 279 |
# |
| 280 |
# If EXTRA-FLAGS is defined, it is added to the current language's default |
| 281 |
# flags (e.g. CFLAGS) when the check is done. The check is thus made with |
| 282 |
# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to |
| 283 |
# force the compiler to issue an error when a bad flag is given. |
| 284 |
# |
| 285 |
# INPUT gives an alternative input source to AC_COMPILE_IFELSE. |
| 286 |
# |
| 287 |
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this |
| 288 |
# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
|
| 289 |
# |
| 290 |
# LICENSE |
| 291 |
# |
| 292 |
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de> |
| 293 |
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com> |
| 294 |
# |
| 295 |
# Copying and distribution of this file, with or without modification, are |
| 296 |
# permitted in any medium without royalty provided the copyright notice |
| 297 |
# and this notice are preserved. This file is offered as-is, without any |
| 298 |
# warranty. |
| 299 |
|
| 300 |
AC_DEFUN([AX_CHECK_COMPILE_FLAG], |
| 301 |
[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF |
| 302 |
AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl |
| 303 |
AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ |
| 304 |
ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS |
| 305 |
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" |
| 306 |
AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], |
| 307 |
[AS_VAR_SET(CACHEVAR,[yes])], |
| 308 |
[AS_VAR_SET(CACHEVAR,[no])]) |
| 309 |
_AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) |
| 310 |
AS_VAR_IF(CACHEVAR,yes, |
| 311 |
[m4_default([$2], :)], |
| 312 |
[m4_default([$3], :)]) |
| 313 |
AS_VAR_POPDEF([CACHEVAR])dnl |
| 314 |
])dnl AX_CHECK_COMPILE_FLAGS |
| 315 |
|