Add maybe mode for langs and default to it

* configure.ac (languages): Warn and disable langs for which
requirements are not met.

--
If the languages are explicitly enabled on the command line
missing dependencies for them will still lead to errors.
This commit is contained in:
Andre Heinecke 2016-05-06 14:17:15 +02:00
parent 3fad121677
commit cd267791e9

View File

@ -255,45 +255,83 @@ AC_ARG_ENABLE([languages],
[enabled_languages=`echo $enableval | \ [enabled_languages=`echo $enableval | \
tr ',:' ' ' | tr '[A-Z]' '[a-z]' | \ tr ',:' ' ' | tr '[A-Z]' '[a-z]' | \
sed 's/c++/cpp/'`], sed 's/c++/cpp/'`],
[enabled_languages="$default_languages"]) [enabled_languages="maybe"])
if test "x$enabled_languages" = "x" \ if test "x$enabled_languages" = "x" \
-o "$enabled_languages" = "no"; then -o "$enabled_languages" = "no"; then
enabled_languages= enabled_languages=
fi fi
# If languages are explicitly set missing requirements
# for the languages are treated as errors otherwise
# there will be a warning.
explicit_languages=1
if test "x$enabled_languages" = "xmaybe"; then
explicit_languages=0
enabled_languages="$default_languages"
fi
for language in $enabled_languages; do for language in $enabled_languages; do
LIST_MEMBER($language, $available_languages) LIST_MEMBER($language, $available_languages)
if test "$found" = "0"; then if test "$found" = "0"; then
AC_MSG_ERROR([unsupported language binding specified]) AC_MSG_ERROR([unsupported language binding specified])
fi fi
done done
# Enable C++ 11 if cpp language is requested # Enable C++ 11 if cpp language is requested
LIST_MEMBER("cpp", $enabled_languages) LIST_MEMBER("cpp", $enabled_languages)
if test "$found" = "1"; then if test "$found" = "1"; then
AX_CXX_COMPILE_STDCXX(11, noext, optional) AX_CXX_COMPILE_STDCXX(11, noext, optional)
if test "$HAVE_CXX11" != "1"; then
if test "$explicit_languages" = "1"; then
AC_MSG_ERROR([[
***
*** A compiler with c++11 support is required for the c++ binding.
***]])
else
enabled_languages=$(echo $enabled_languages | sed 's/cpp//')
enabled_languages=$(echo $enabled_languages | sed 's/qt//')
AC_MSG_WARN([[
***
*** No c++11 support detected. C++ and Qt bindings will be disabled.
***]])
fi
fi
fi fi
# Check that if qt is enabled cpp also is enabled # Check that if qt is enabled cpp also is enabled
LIST_MEMBER("qt", $enabled_languages) LIST_MEMBER("qt", $enabled_languages)
if test "$found" = "1"; then if test "$found" = "1"; then
# We need to ensure that in the langauge order qt comes after cpp
# so we remove qt first and explicitly add it as last list member.
enabled_languages=$(echo $enabled_languages | sed 's/qt//')
LIST_MEMBER("cpp", $enabled_languages) LIST_MEMBER("cpp", $enabled_languages)
if test "$found" = "0"; then if test "$found" = "0"; then
AC_MSG_ERROR([qt binding depends on cpp language binding]) AC_MSG_ERROR([qt binding depends on cpp language binding])
fi fi
FIND_QT FIND_QT
if test "$have_qt5_libs" != "yes"; then if test "$have_qt5_libs" != "yes"; then
if test "$explicit_languages" = "1"; then
AC_MSG_ERROR([[ AC_MSG_ERROR([[
*** ***
*** Qt5 (Qt5Core) is required for qt binding. *** Qt5 (Qt5Core) is required for qt binding.
***]])
else
AC_MSG_WARN([[
***
*** Qt5 (Qt5Core) not found Qt Binding will be disabled.
***]]) ***]])
fi fi
else
enabled_languages=`echo $enabled_languages qt`
AC_CHECK_PROGS([DOXYGEN], [doxygen]) AC_CHECK_PROGS([DOXYGEN], [doxygen])
if test -z "$DOXYGEN"; if test -z "$DOXYGEN";
# This is not highlighted becase it's not really important.
then AC_MSG_WARN([Doxygen not found - Qt binding doc will not be built.]) then AC_MSG_WARN([Doxygen not found - Qt binding doc will not be built.])
fi fi
# Make sure that qt comes after cpp fi
enabled_languages=`echo $enabled_languages | sed 's/qt//'`
enabled_languages=`echo $enabled_languages qt`
fi fi
AM_CONDITIONAL([HAVE_DOXYGEN], AM_CONDITIONAL([HAVE_DOXYGEN],
[test -n "$DOXYGEN"]) [test -n "$DOXYGEN"])