|
|
|
# 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], [
|
|
|
|
if test -z "$HAVE_$1"; then
|
|
|
|
HAVE_$1=1
|
|
|
|
AC_MSG_CHECKING([for $2])
|
|
|
|
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
|
|
|
|
HAVE_$1=0
|
|
|
|
$1=""
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
AC_SUBST($1)
|
|
|
|
AM_CONDITIONAL(HAVE_$1, test $HAVE_$1 -eq 1)
|
|
|
|
if test $HAVE_$1 -eq 1; then
|
|
|
|
AC_MSG_RESULT([$$1])
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([not found])
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
|
|
|
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_CHECK_VALID_FLAG], [
|
|
|
|
AC_MSG_CHECKING([m4_default([$2], [for valid flag in "$1"])])
|
|
|
|
save_cxxflags="$CXXFLAGS"
|
|
|
|
newflag="no"
|
|
|
|
for test_flag in $1; do
|
|
|
|
CXXFLAGS+=" ${test_flag}"
|
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
|
|
|
|
newflag="$test_flag"
|
|
|
|
AM_CXXFLAGS+=" ${test_flag}"
|
|
|
|
CXXFLAGS="$save_cxxflags"
|
|
|
|
break;
|
|
|
|
])
|
|
|
|
CXXFLAGS="$save_cxxflags"
|
|
|
|
done
|
|
|
|
AC_SUBST(AM_CXXFLAGS)
|
|
|
|
AC_MSG_RESULT([$newflag])
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFUN([AX_CHECK_QT], [
|
|
|
|
qt_modules="$2"
|
|
|
|
qt_modules_optional="$3"
|
|
|
|
AX_CXX_QT_TOOLS
|
|
|
|
HAVE_$1=0
|
|
|
|
PKG_PROG_PKG_CONFIG
|
|
|
|
PKG_CHECK_MODULES([$1]5, [${qt_modules//Qt/Qt5}], [
|
|
|
|
HAVE_$1=1
|
|
|
|
AC_DEFINE([HAVE_$1])
|
|
|
|
AM_CPPFLAGS+=" ${[$1]5_CFLAGS}"
|
|
|
|
MOC_FLAGS+=" -DHAVE_$1=1 ${[$1]5_CFLAGS}"
|
|
|
|
AM_CXXFLAGS+=" ${[$1]5_CFLAGS}"
|
|
|
|
LIBS+=" ${[$1]5_LIBS}"
|
|
|
|
if test -n "${qt_modules_optional}"; then
|
|
|
|
PKG_CHECK_MODULES([$1]5_OPTIONAL, [${qt_modules_optional//Qt/Qt5}], [
|
|
|
|
AM_CPPFLAGS+=" ${[$1]5_OPTIONAL_CFLAGS}"
|
|
|
|
MOC_FLAGS+=" ${[$1]5_OPTIONAL_CFLAGS}"
|
|
|
|
AM_CXXFLAGS+=" ${[$1]5_OPTIONAL_CFLAGS}"
|
|
|
|
LIBS+=" ${[$1]5_OPTIONAL_LIBS}"
|
|
|
|
], [
|
|
|
|
AC_MSG_NOTICE([Not found: ${qt_modules_optional//Qt/Qt5}])
|
|
|
|
])
|
|
|
|
fi
|
|
|
|
], [
|
|
|
|
PKG_CHECK_MODULES([$1], [${qt_modules}], [
|
|
|
|
HAVE_$1=1
|
|
|
|
AC_DEFINE([HAVE_$1])
|
|
|
|
AM_CPPFLAGS+=" ${$1_CFLAGS}"
|
|
|
|
MOC_FLAGS+=" -DHAVE_$1=1 ${$1_CFLAGS}"
|
|
|
|
AM_CXXFLAGS+=" ${$1_CFLAGS}"
|
|
|
|
LIBS+=" ${$1_LIBS}"
|
|
|
|
if test -n "$3"; then
|
|
|
|
PKG_CHECK_MODULES($1_OPTIONAL, [${qt_modules_optional}], [
|
|
|
|
AM_CPPFLAGS+=" ${$1_OPTIONAL_CFLAGS}"
|
|
|
|
MOC_FLAGS+=" ${$1_OPTIONAL_CFLAGS}"
|
|
|
|
AM_CXXFLAGS+=" ${$1_OPTIONAL_CFLAGS}"
|
|
|
|
LIBS+=" ${$1_OPTIONAL_LIBS}"
|
|
|
|
], [
|
|
|
|
AC_MSG_NOTICE([Not found: ${qt_modules_optional}])
|
|
|
|
])
|
|
|
|
fi
|
|
|
|
], [HAVE_$1=0])
|
|
|
|
])
|
|
|
|
AM_CONDITIONAL(HAVE_$1, test $HAVE_$1 -eq 1)
|
|
|
|
AX_CHECK_VALID_FLAG([-fPIC -fPIE], [position independent code flag])
|
|
|
|
AC_SUBST(AM_CPPFLAGS)
|
|
|
|
AC_SUBST(MOC_FLAGS)
|
|
|
|
AC_SUBST(AM_CXXFLAGS)
|
|
|
|
AX_ADDITIONAL_QT_RULES_HACK='
|
|
|
|
ui_%.hxx: %.ui
|
|
|
|
$(UIC) -o [$][@] $<
|
|
|
|
|
|
|
|
moc_%.cxx: %.hxx
|
|
|
|
$(MOC) $(MOC_FLAGS) -o [$][@] $<
|
|
|
|
|
|
|
|
qrc_%.cxx: %.qrc
|
|
|
|
$(RCC) -o [$][@] $<'
|
|
|
|
AC_SUBST(AX_ADDITIONAL_QT_RULES_HACK)
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFUN([AX_REQUIRE_QT], [
|
|
|
|
AX_CHECK_QT([$1], [$2], [$3])
|
|
|
|
if ! test "$HAVE_$1" -eq 1; then
|
|
|
|
AC_MSG_ERROR([Required Qt modules not found: $2])
|
|
|
|
fi
|
|
|
|
])
|