diff m4/acinclude.m4 @ 27842:e79999c5d782

fix Qt4 build errors (bug #57420) * acinclude.m4 (OCTAVE_CHECK_FUNC_QCOMBOBOX_SETCURRENTTEXT): New macro. (OCTAVE_CHECK_QT_VERSION): Use it. * find-dialog.cc (find_dialog::init_search_text): Provide replacement for QComboBox::setCurrentText. * octave-qscintilla.h: Include <QTemporaryFile> header.
author John W. Eaton <jwe@octave.org>
date Mon, 16 Dec 2019 01:47:18 -0500
parents a8c5255c34b1
children b442ec6dda5c
line wrap: on
line diff
--- a/m4/acinclude.m4	Mon Dec 16 07:12:05 2019 +0100
+++ b/m4/acinclude.m4	Mon Dec 16 01:47:18 2019 -0500
@@ -344,6 +344,37 @@
   fi
 ])
 dnl
+dnl Check whether the Qt QComboBox class has the setCurrentText
+dnl function.  This function was introduced in Qt 5.
+dnl
+dnl FIXME: Delete this entirely when we drop support for Qt 4.
+dnl
+AC_DEFUN([OCTAVE_CHECK_FUNC_QCOMBOBOX_SETCURRENTTEXT], [
+  AC_CACHE_CHECK([for QComboBox::setCurrentText],
+    [octave_cv_func_qcombobox_setcurrenttext],
+    [AC_LANG_PUSH(C++)
+    ac_octave_save_CPPFLAGS="$CPPFLAGS"
+    ac_octave_save_CXXFLAGS="$CXXFLAGS"
+    CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS"
+    CXXFLAGS="$CXXPICFLAG $CPPFLAGS"
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+        #include <QComboBox>
+        ]], [[
+        QComboBox combo_box (nullptr);
+        combo_box.setCurrentText ("text");
+        ]])],
+      octave_cv_func_qcombobox_setcurrenttext=yes,
+      octave_cv_func_qcombobox_setcurrenttext=no)
+    CPPFLAGS="$ac_octave_save_CPPFLAGS"
+    CXXFLAGS="$ac_octave_save_CXXFLAGS"
+    AC_LANG_POP(C++)
+  ])
+  if test $octave_cv_func_qcombobox_setcurrenttext = yes; then
+    AC_DEFINE(HAVE_QCOMBOBOX_SETCURRENTTEXT, 1,
+      [Define to 1 if you have the `QComboBox::setCurrentText' member function.])
+  fi
+])
+dnl
 dnl Check whether the Qt QGuiApplication class has the setDesktopFileName
 dnl static member function.  This function was introduced in Qt 5.7.
 dnl
@@ -2155,6 +2186,7 @@
     ## tests if they fail because we have already decided that the Qt
     ## version that we are testing now will be the one used.
 
+    OCTAVE_CHECK_FUNC_QCOMBOBOX_SETCURRENTTEXT
     OCTAVE_CHECK_FUNC_QGUIAPPLICATION_SETDESKTOPFILENAME
     OCTAVE_CHECK_FUNC_QHEADERVIEW_SETSECTIONRESIZEMODE
     OCTAVE_CHECK_FUNC_QHEADERVIEW_SETSECTIONSCLICKABLE