# HG changeset patch # User Rik # Date 1346799252 25200 # Node ID 7ae14907ae4376660a39711ca1f156f6d876f99a # Parent 99db33cae82b6487a8ac44f760170a55d0ec8fe2 build: Add tests for specific Qt functions to configure.ac * configure.ac: Add OCTAVE_CHECK_FUNC_FINDFIRST_MODERN and OCTAVE_CHECK_FUNC_SETPLACEHOLDERTEXT macro calls * m4/acinclude.m4 (OCTAVE_CHECK_FUNC_SETPLACEHOLDERTEXT): Check whether Qt has SetPlaceholderText function. * (OCTAVE_CHECK_FUNC_FINDFIRST_MODERN): Check whether Qscintilla FindFirst accepts 16 or 17 input arguments. * find-dialog.cc, webinfo.cc: check configure HAVE_XXX values before using possibly unsupported functions. diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -2203,6 +2203,10 @@ fi fi + ## Check for Qt functions which have changed their API over time + OCTAVE_CHECK_FUNC_FINDFIRST_MODERN + OCTAVE_CHECK_FUNC_SETPLACEHOLDERTEXT + case "$canonical_host_type" in *-*-mingw* | *-*-msdosmsvc*) win32_terminal=yes ;; *) diff --git a/libgui/src/m-editor/find-dialog.cc b/libgui/src/m-editor/find-dialog.cc --- a/libgui/src/m-editor/find-dialog.cc +++ b/libgui/src/m-editor/find-dialog.cc @@ -150,8 +150,7 @@ !_backward_check_box->isChecked (), line,col, true -// FIXME: write a proper configure test (is it worth?) -#if QSCINTILLA_VERSION >= 0x020600 +#ifdef HAVE_FINDFIRST_MODERN , true #endif ); diff --git a/libgui/src/qtinfo/webinfo.cc b/libgui/src/qtinfo/webinfo.cc --- a/libgui/src/qtinfo/webinfo.cc +++ b/libgui/src/qtinfo/webinfo.cc @@ -70,8 +70,7 @@ layout->addLayout (hboxLayout); _search_line_edit = new QLineEdit(this); - // FIXME: maybe put in a better test in configure.ac -#if QT_VERSION >= 0x040700 +#ifdef HAVE_SETPLACEHOLDERTEXT _search_line_edit->setPlaceholderText (tr ("Type here and press \'Return\' to search")); #endif hboxLayout->addWidget (_search_line_edit); diff --git a/m4/acinclude.m4 b/m4/acinclude.m4 --- a/m4/acinclude.m4 +++ b/m4/acinclude.m4 @@ -143,6 +143,35 @@ fi ]) dnl +dnl Check whether Qscintilla FindFirst function is old (16 inputs) or +dnl new (17 inputs). +dnl FIXME: This test uses a version number. It potentially could +dnl be re-written to actually call the function, but is it worth it? +dnl +AC_DEFUN([OCTAVE_CHECK_FUNC_FINDFIRST_MODERN], [ + AC_CACHE_CHECK([whether Qscintilla FindFirst uses 16 or 17 input arguments], + [octave_cv_func_findfirst_modern], + [AC_LANG_PUSH(C++) + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="-I$QT_INCDIR -I$QT_INCDIR/Qt $CPPFLAGS" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + #include + ]], [[ + #if QSCINTILLA_VERSION < 0x020600 + Old Form Found; + #endif + ]])], + octave_cv_func_findfirst_modern=yes, + octave_cv_func_findfirst_modern=no) + CPPFLAGS="$save_CPPFLAGS" + AC_LANG_POP(C++) + ]) + if test $octave_cv_func_findfirst_modern = "yes"; then + AC_DEFINE(HAVE_FINDFIRST_MODERN, 1, + [Define to 1 if Qscintilla FindFirst uses modern form with 17 inputs.]) + fi +]) +dnl dnl Check if Fortran compiler has the intrinsic function ISNAN. dnl AC_DEFUN([OCTAVE_CHECK_FUNC_FORTRAN_ISNAN], [ @@ -193,6 +222,34 @@ fi ]) dnl +dnl Check whether Qscintilla SetPlaceholderText function exists. +dnl FIXME: This test uses a version number. It potentially could +dnl be re-written to actually call the function, but is it worth it? +dnl +AC_DEFUN([OCTAVE_CHECK_FUNC_SETPLACEHOLDERTEXT], [ + AC_CACHE_CHECK([whether Qt has SetPlaceholderText function], + [octave_cv_func_setplaceholdertext], + [AC_LANG_PUSH(C++) + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="-I$QT_INCDIR $CPPFLAGS" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + #include + ]], [[ + #if QT_VERSION < 0x040700 + No SetPlacholderText function available; + #endif + ]])], + octave_cv_func_setplaceholdertext=yes, + octave_cv_func_setplaceholdertext=no) + CPPFLAGS="$save_CPPFLAGS" + AC_LANG_POP(C++) + ]) + if test $octave_cv_func_setplaceholdertext = "yes"; then + AC_DEFINE(HAVE_SETPLACEHOLDERTEXT, 1, + [Define to 1 if you have the Qt SetPlaceholderText function.]) + fi +]) +dnl dnl Check whether HDF5 library has version 1.6 API functions. dnl AC_DEFUN([OCTAVE_CHECK_HDF5_HAS_VER_16_API], [