Mercurial > hg > octave-terminal
changeset 15291:7ae14907ae43
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.
author | Rik <rik@octave.org> |
---|---|
date | Tue, 04 Sep 2012 15:54:12 -0700 |
parents | 99db33cae82b |
children | 637e3b7d6a56 |
files | configure.ac libgui/src/m-editor/find-dialog.cc libgui/src/qtinfo/webinfo.cc m4/acinclude.m4 |
diffstat | 4 files changed, 63 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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 ;; *)
--- 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 );
--- 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);
--- 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 <Qsci/qsciglobal.h> + ]], [[ + #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 <Qt/qglobal.h> + ]], [[ + #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], [