new author url
This commit is contained in:
149
ax_check_qt.m4
149
ax_check_qt.m4
@@ -1,10 +1,10 @@
|
||||
# SYNOPSIS
|
||||
#
|
||||
# Check if a module exists:
|
||||
# AX_CHECK_QT([qt_prefix], [list-of-qt-modules], [optional-modules])
|
||||
# AX_CHECK_QT([qt_prefix], [list-of-qt-modules], [optional-modules] [flags])
|
||||
#
|
||||
# Abort if a module does not exist:
|
||||
# AX_REQUIRE_QT([qt_prefix], [list-of-qt-modules], [optional-modules])
|
||||
# AX_REQUIRE_QT([qt_prefix], [list-of-qt-modules], [optional-modules] [flags])
|
||||
#
|
||||
# DESCRIPTIONS
|
||||
#
|
||||
@@ -35,9 +35,22 @@
|
||||
# Optional list of more, optional modules, e.g. modules that
|
||||
# exist only in Qt5, but not in Qt4, such as QtWidgets or
|
||||
# QtWebKitWidgets
|
||||
#
|
||||
# flags
|
||||
#
|
||||
# Optional flages, space separated from this list:
|
||||
#
|
||||
# manualflags
|
||||
#
|
||||
# CXXFLAGS, CPPFLAGS and LIBS variables are not
|
||||
# automatically expanded, but you need to add the
|
||||
# qt_prefix_CXXFLAGS, qt_prefix_CPPFLAGS and qt_prefix_LIBS
|
||||
# variables manually where you need them. This is useful,
|
||||
# if some build targets need a feature and some don't.
|
||||
|
||||
|
||||
AC_DEFUN([AX_CXX_QT_TOOL], [
|
||||
PKG_PROG_PKG_CONFIG
|
||||
if test -z "$HAVE_$1"; then
|
||||
HAVE_$1=1
|
||||
AC_MSG_CHECKING([for $2])
|
||||
@@ -61,7 +74,7 @@ AC_DEFUN([AX_CXX_QT_TOOL], [
|
||||
fi
|
||||
fi
|
||||
AC_SUBST($1)
|
||||
AM_CONDITIONAL(HAVE_$1, test $HAVE_$1 -eq 1)
|
||||
AM_CONDITIONAL(HAVE_$1, test $HAVE_[$1] -eq 1)
|
||||
if test $HAVE_$1 -eq 1; then
|
||||
AC_MSG_RESULT([$$1])
|
||||
else
|
||||
@@ -79,27 +92,10 @@ AC_DEFUN([AX_CXX_QT_TOOLS], [
|
||||
AX_CXX_QT_TOOL(LRELEASE, lrelease)
|
||||
])
|
||||
|
||||
AC_DEFUN([AX_CHECK_VALID_FLAG], [
|
||||
AC_MSG_CHECKING([m4_default([$2], [for valid flag in "$1"])])
|
||||
save_cppflags="$CPPFLAGS"
|
||||
newflag="no"
|
||||
for test_flag in $1; do
|
||||
CPPFLAGS+=" ${test_flag}"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
|
||||
newflag="$test_flag"
|
||||
CPPFLAGS="$save_cppflags"
|
||||
CPPFLAGS+=" ${test_flag}"
|
||||
break;
|
||||
])
|
||||
CPPFLAGS="$save_cppflags"
|
||||
done
|
||||
AC_SUBST(CPPFLAGS)
|
||||
AC_MSG_RESULT([$newflag])
|
||||
])
|
||||
|
||||
AC_DEFUN([AX_CHECK_QT], [
|
||||
qt_modules="$2"
|
||||
qt_modules_optional="$3"
|
||||
qt_flags="$4"
|
||||
AX_CXX_QT_TOOLS
|
||||
HAVE_$1=0
|
||||
PKG_PROG_PKG_CONFIG
|
||||
@@ -108,17 +104,37 @@ AC_DEFUN([AX_CHECK_QT], [
|
||||
AC_DEFINE([HAVE_$1])
|
||||
QTDIR=$(${PKG_CONFIG} --variable=prefix Qt5Core)
|
||||
QT_PLUGIN_PATH=${QTDIR}/share/qt5/plugins
|
||||
CPPFLAGS+=" ${[$1]5_CFLAGS}"
|
||||
MOC_FLAGS+=" -DHAVE_$1=1 ${[$1]5_CFLAGS}"
|
||||
CXXFLAGS+=" ${[$1]5_CFLAGS}"
|
||||
LIBS+=" ${[$1]5_LIBS}"
|
||||
[$1]_CPPFLAGS="${[$1]5_CFLAGS}"
|
||||
[$1]_CXXFLAGS="${[$1]5_CFLAGS}"
|
||||
[$1]_LIBS="${[$1]5_LIBS}"
|
||||
AC_SUBST([$1]_CPPFLAGS)
|
||||
AC_SUBST([$1]_CXXFLAGS)
|
||||
if test "${qt_flags/manualflags/}" = "${qt_flags}"; then
|
||||
CPPFLAGS+=" ${[$1]_CPPFLAGS}"
|
||||
CXXFLAGS+=" ${[$1]_CXXFLAGS}"
|
||||
LIBS+=" ${[$1]_LIBS}"
|
||||
AC_MSG_NOTICE([Adding flags for $1])
|
||||
else
|
||||
AC_MSG_NOTICE([To enable $1, add $1_CPPFLAGS, $1_CXXFLAGS and $1_LIBS])
|
||||
fi
|
||||
PKG_REQUIREMENTS+=" ${qt_modules//Qt/Qt5}"
|
||||
if test -n "${qt_modules_optional}"; then
|
||||
PKG_CHECK_MODULES([$1]5_OPTIONAL, [${qt_modules_optional//Qt/Qt5}], [
|
||||
CPPFLAGS+=" ${[$1]5_OPTIONAL_CFLAGS}"
|
||||
MOC_FLAGS+=" ${[$1]5_OPTIONAL_CFLAGS}"
|
||||
CXXFLAGS+=" ${[$1]5_OPTIONAL_CFLAGS}"
|
||||
LIBS+=" ${[$1]5_OPTIONAL_LIBS}"
|
||||
[$1]_CPPFLAGS+=" ${[$1]5_OPTIONAL_CFLAGS}"
|
||||
[$1]_CXXFLAGS+=" ${[$1]5_OPTIONAL_CFLAGS}"
|
||||
[$1]_LIBS+=" ${[$1]5_OPTIONAL_LIBS}"
|
||||
AC_SUBST([$1]_CPPFLAGS)
|
||||
AC_SUBST([$1]_CXXFLAGS)
|
||||
if test "${qt_flags/manualflags/}" = "${qt_flags}"; then
|
||||
CPPFLAGS+=" ${[$1]5_OPTIONAL_CFLAGS}"
|
||||
CXXFLAGS+=" ${[$1]5_OPTIONAL_CFLAGS}"
|
||||
LIBS+=" ${[$1]5_OPTIONAL_LIBS}"
|
||||
AC_MSG_NOTICE([Adding flags for $1])
|
||||
else
|
||||
AC_MSG_NOTICE([To enable $1, add $1_CPPFLAGS, $1_CXXFLAGS and $1_LIBS])
|
||||
fi
|
||||
PKG_REQUIREMENTS+=" ${qt_modules_optional//Qt/Qt5}"
|
||||
], [
|
||||
AC_MSG_NOTICE([Not found: ${qt_modules_optional//Qt/Qt5}])
|
||||
@@ -130,17 +146,36 @@ AC_DEFUN([AX_CHECK_QT], [
|
||||
AC_DEFINE([HAVE_$1])
|
||||
QTDIR=$(${PKG_CONFIG} --variable=prefix QtCore)
|
||||
QT_PLUGIN_PATH=${QTDIR}/share/qt/plugins
|
||||
CPPFLAGS+=" ${$1_CFLAGS}"
|
||||
MOC_FLAGS+=" -DHAVE_$1=1 ${$1_CFLAGS}"
|
||||
CXXFLAGS+=" ${$1_CFLAGS}"
|
||||
LIBS+=" ${$1_LIBS}"
|
||||
[$1]_CPPFLAGS="${[$1]_CFLAGS}"
|
||||
[$1]_CXXFLAGS="${[$1]_CFLAGS}"
|
||||
AC_SUBST([$1]_CPPFLAGS)
|
||||
AC_SUBST([$1]_CXXFLAGS)
|
||||
if test "${qt_flags/manualflags/}" = "${qt_flags}"; then
|
||||
CPPFLAGS+=" ${[$1]_CPPFLAGS}"
|
||||
CXXFLAGS+=" ${[$1]_CXXFLAGS}"
|
||||
LIBS+=" ${[$1]_LIBS}"
|
||||
AC_MSG_NOTICE([Adding flags for $1])
|
||||
else
|
||||
AC_MSG_NOTICE([To enable $1, add $1_CPPFLAGS, $1_CXXFLAGS and $1_LIBS])
|
||||
fi
|
||||
PKG_REQUIREMENTS+=" ${qt_modules}"
|
||||
if test -n "$3"; then
|
||||
PKG_CHECK_MODULES($1_OPTIONAL, [${qt_modules_optional}], [
|
||||
CPPFLAGS+=" ${$1_OPTIONAL_CFLAGS}"
|
||||
MOC_FLAGS+=" ${$1_OPTIONAL_CFLAGS}"
|
||||
CXXFLAGS+=" ${$1_OPTIONAL_CFLAGS}"
|
||||
LIBS+=" ${$1_OPTIONAL_LIBS}"
|
||||
MOC_FLAGS+="${$1_OPTIONAL_CFLAGS}"
|
||||
[$1]_CPPFLAGS+=" ${$1_OPTIONAL_CFLAGS}"
|
||||
[$1]_CXXFLAGS+=" ${$1_OPTIONAL_CFLAGS}"
|
||||
[$1]_LIBS+=" ${$1_OPTIONAL_LIBS}"
|
||||
AC_SUBST([$1]_CPPFLAGS)
|
||||
AC_SUBST([$1]_CXXFLAGS)
|
||||
if test "${qt_flags/manualflags/}" = "${qt_flags}"; then
|
||||
CPPFLAGS+=" ${$1_OPTIONAL_CFLAGS}"
|
||||
CXXFLAGS+=" ${$1_OPTIONAL_CFLAGS}"
|
||||
LIBS+=" ${$1_OPTIONAL_LIBS}"
|
||||
AC_MSG_NOTICE([Adding flags for $1])
|
||||
else
|
||||
AC_MSG_NOTICE([To enable $1, add $1_CPPFLAGS, $1_CXXFLAGS and $1_LIBS])
|
||||
fi
|
||||
PKG_REQUIREMENTS+=" ${qt_modules_optional}"
|
||||
], [
|
||||
AC_MSG_NOTICE([Not found: ${qt_modules_optional}])
|
||||
@@ -148,8 +183,11 @@ AC_DEFUN([AX_CHECK_QT], [
|
||||
fi
|
||||
], [HAVE_$1=0])
|
||||
])
|
||||
AM_CONDITIONAL(HAVE_$1, test $HAVE_$1 -eq 1)
|
||||
AX_CHECK_VALID_FLAG([-fPIC -fPIE], [position independent code flag])
|
||||
AM_CONDITIONAL(HAVE_$1, test $HAVE_[$1] -eq 1)
|
||||
AX_CHECK_VALID_CXX_FLAG([-fPIC -fPIE], [position independent code flag])
|
||||
if test -n "${MINGW}"; then
|
||||
AX_CHECK_VALID_CXX_FLAG([-Wl,-subsystem,windows], [windows console flag])
|
||||
fi
|
||||
AC_SUBST(QTDIR)
|
||||
AC_SUBST(QT_PLUGIN_PATH)
|
||||
AC_SUBST(CPPFLAGS)
|
||||
@@ -176,49 +214,15 @@ qrc_%.cxx: %.qrc
|
||||
%.qm: %.ts
|
||||
${LRELEASE} $< -qm [$][@]
|
||||
|
||||
#%.ts: ${LANGUAGE_FILES}
|
||||
#%.ts: ${LANGUAGE_FILES:%=%}
|
||||
# ${LUPDATE} -no-obsolete \
|
||||
# -target-language ${@:${LANGUAGE_FILE_BASE}_%.ts=%} \
|
||||
# -ts [$][@] $<
|
||||
|
||||
'])
|
||||
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_CHECK_QT([qt_prefix], [list-of-qt-modules], [optional-modules])
|
||||
#
|
||||
# DESCRIPTIONS
|
||||
#
|
||||
# qt_prefix
|
||||
#
|
||||
# Each call to AX_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.
|
||||
#
|
||||
# optional-modules
|
||||
#
|
||||
# Optional list of more, optional modules, e.g. modules that
|
||||
# exist only in Qt5, but not in Qt4, such as QtWidgets or
|
||||
# QtWebKitWidgets
|
||||
|
||||
AC_DEFUN([AX_REQUIRE_QT], [
|
||||
AX_CHECK_QT([$1], [$2], [$3])
|
||||
AX_CHECK_QT([$1], [$2], [$3], [$4])
|
||||
if ! test "$HAVE_$1" -eq 1; then
|
||||
AC_MSG_ERROR([Required Qt modules not found: $2])
|
||||
fi
|
||||
@@ -227,7 +231,6 @@ AC_DEFUN([AX_REQUIRE_QT], [
|
||||
|
||||
# Omit Qt Keywords
|
||||
# AX_QT_NO_KEYWORDS
|
||||
|
||||
AC_DEFUN([AX_QT_NO_KEYWORDS], [
|
||||
CPPFLAGS+=" -DQT_NO_KEYWORDS"
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user