new HAVE_XXX macro for acinclude.m4

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

new HAVE_XXX macro for acinclude.m4

Richard Crozier
I'm trying to add a test for a Qt feature to acinclude.m4, and inserted
the following text at line 456:

dnl
dnl Check whether the Qt QTabWidget::setMovable() function exists.
dnl This function was added in Qt 4.5.
dnl
AC_DEFUN([OCTAVE_CHECK_FUNC_QTABWIDGET_SETMOVABLE], [
   AC_CACHE_CHECK([whether Qt has the QTabWidget::setMovable() function],
     [octave_cv_func_qtabwidget_setmovable],
     [AC_LANG_PUSH(C++)
     ac_octave_save_CPPFLAGS="$CPPFLAGS"
     CPPFLAGS="$QT_CPPFLAGS $CPPFLAGS"
     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
         #include <QTabWidget>
         class tab_widget : public QTabWidget
         {
         public:
           tab_widget (QObject *parent = 0) : QTabWidget (parent) {
this->setMovable (true); }
           ~tab_widget () {}
         };
         ]], [[
         tab_widget tw;
         ]])],
       octave_cv_func_qtabwidget_setmovable=yes,
       octave_cv_func_qtabwidget_setmovable=no)
     CPPFLAGS="$ac_octave_save_CPPFLAGS"
     AC_LANG_POP(C++)
   ])
   if test $octave_cv_func_qtabwidget_setmovable = yes; then
     AC_DEFINE(HAVE_QTABWIDGET_SETMOVABLE, 1,
       [Define to 1 if Qt has the QTabWidget::setMovable() function.])
   fi
])


However, this is completely ignored by configure as far as I can tell.
I'm building out-of-tree and I did ./bootstrap ; cd build ; configure.
Am I missing some step here? Or is there some mistake in the macro I
don't see?

Thanks
Richard

--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

Reply | Threaded
Open this post in threaded view
|

Re: new HAVE_XXX macro for acinclude.m4

John W. Eaton
Administrator
On 12/16/2013 09:55 AM, Richard wrote:

> I'm trying to add a test for a Qt feature to acinclude.m4, and inserted
> the following text at line 456:
>
> dnl
> dnl Check whether the Qt QTabWidget::setMovable() function exists.
> dnl This function was added in Qt 4.5.
> dnl
> AC_DEFUN([OCTAVE_CHECK_FUNC_QTABWIDGET_SETMOVABLE], [
> AC_CACHE_CHECK([whether Qt has the QTabWidget::setMovable() function],
> [octave_cv_func_qtabwidget_setmovable],
> [AC_LANG_PUSH(C++)
> ac_octave_save_CPPFLAGS="$CPPFLAGS"
> CPPFLAGS="$QT_CPPFLAGS $CPPFLAGS"
> AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
> #include <QTabWidget>
> class tab_widget : public QTabWidget
> {
> public:
> tab_widget (QObject *parent = 0) : QTabWidget (parent) {
> this->setMovable (true); }
> ~tab_widget () {}
> };
> ]], [[
> tab_widget tw;
> ]])],
> octave_cv_func_qtabwidget_setmovable=yes,
> octave_cv_func_qtabwidget_setmovable=no)
> CPPFLAGS="$ac_octave_save_CPPFLAGS"
> AC_LANG_POP(C++)
> ])
> if test $octave_cv_func_qtabwidget_setmovable = yes; then
> AC_DEFINE(HAVE_QTABWIDGET_SETMOVABLE, 1,
> [Define to 1 if Qt has the QTabWidget::setMovable() function.])
> fi
> ])
>
>
> However, this is completely ignored by configure as far as I can tell.
> I'm building out-of-tree and I did ./bootstrap ; cd build ; configure.
> Am I missing some step here? Or is there some mistake in the macro I
> don't see?

AC_DEFUN defines a macro.  Now you need to use it.  The right place for
that is the configure.ac file along with the other Qt feature tests.

jwe
Reply | Threaded
Open this post in threaded view
|

Re: new HAVE_XXX macro for acinclude.m4

Richard Crozier
On 16/12/2013 16:06, John W. Eaton wrote:

> On 12/16/2013 09:55 AM, Richard wrote:
>> I'm trying to add a test for a Qt feature to acinclude.m4, and inserted
>> the following text at line 456:
>>
>> dnl
>> dnl Check whether the Qt QTabWidget::setMovable() function exists.
>> dnl This function was added in Qt 4.5.
>> dnl
>> AC_DEFUN([OCTAVE_CHECK_FUNC_QTABWIDGET_SETMOVABLE], [
>> AC_CACHE_CHECK([whether Qt has the QTabWidget::setMovable() function],
>> [octave_cv_func_qtabwidget_setmovable],
>> [AC_LANG_PUSH(C++)
>> ac_octave_save_CPPFLAGS="$CPPFLAGS"
>> CPPFLAGS="$QT_CPPFLAGS $CPPFLAGS"
>> AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
>> #include <QTabWidget>
>> class tab_widget : public QTabWidget
>> {
>> public:
>> tab_widget (QObject *parent = 0) : QTabWidget (parent) {
>> this->setMovable (true); }
>> ~tab_widget () {}
>> };
>> ]], [[
>> tab_widget tw;
>> ]])],
>> octave_cv_func_qtabwidget_setmovable=yes,
>> octave_cv_func_qtabwidget_setmovable=no)
>> CPPFLAGS="$ac_octave_save_CPPFLAGS"
>> AC_LANG_POP(C++)
>> ])
>> if test $octave_cv_func_qtabwidget_setmovable = yes; then
>> AC_DEFINE(HAVE_QTABWIDGET_SETMOVABLE, 1,
>> [Define to 1 if Qt has the QTabWidget::setMovable() function.])
>> fi
>> ])
>>
>>
>> However, this is completely ignored by configure as far as I can tell.
>> I'm building out-of-tree and I did ./bootstrap ; cd build ; configure.
>> Am I missing some step here? Or is there some mistake in the macro I
>> don't see?
>
> AC_DEFUN defines a macro.  Now you need to use it.  The right place for
> that is the configure.ac file along with the other Qt feature tests.
>
> jwe
>


Doh! Of course.

Richard

--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

Reply | Threaded
Open this post in threaded view
|

Re: new HAVE_XXX macro for acinclude.m4

Rik-4
In reply to this post by Richard Crozier
On 12/16/2013 07:55 AM, Richard wrote:
> I'm trying to add a test for a Qt feature to acinclude.m4, and inserted the following text at line 456:
>
> dnl
> dnl Check whether the Qt QTabWidget::setMovable() function exists.
> dnl This function was added in Qt 4.5.
> dnl
> AC_DEFUN([OCTAVE_CHECK_FUNC_QTABWIDGET_SETMOVABLE], [
>   AC_CACHE_CHECK([whether Qt has the QTabWidget::setMovable() function],
>     [octave_cv_func_qtabwidget_setmovable],
>     [AC_LANG_PUSH(C++)
>     ac_octave_save_CPPFLAGS="$CPPFLAGS"
>     CPPFLAGS="$QT_CPPFLAGS $CPPFLAGS"
>     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
>         #include <QTabWidget>
>         class tab_widget : public QTabWidget
>         {
>         public:
>           tab_widget (QObject *parent = 0) : QTabWidget (parent) { this->setMovable (true); }
>           ~tab_widget () {}
>         };
>         ]], [[
>         tab_widget tw;
>         ]])],
>       octave_cv_func_qtabwidget_setmovable=yes,
>       octave_cv_func_qtabwidget_setmovable=no)
>     CPPFLAGS="$ac_octave_save_CPPFLAGS"
>     AC_LANG_POP(C++)
>   ])
>   if test $octave_cv_func_qtabwidget_setmovable = yes; then
>     AC_DEFINE(HAVE_QTABWIDGET_SETMOVABLE, 1,
>       [Define to 1 if Qt has the QTabWidget::setMovable() function.])
>   fi
> ])
>
>
> However, this is completely ignored by configure as far as I can tell. I'm building out-of-tree and I did ./bootstrap ; cd build ; configure. Am I missing some step here? Or is there some mistake in the macro I don't see?

12/16/13

Richard,

It's a two-step process.  First you need to define the macro (done!), and then you need to call it from configure.ac.

The right place looks to be around line 2723 where we have determined that the Qt GUI can be built and then check for some miscellaneous functions.

--- configure.ac:2723 ---
if test $build_gui = yes; then
  OCTAVE_CHECK_QFONT_MONOSPACE
  OCTAVE_CHECK_FUNC_SETPLACEHOLDERTEXT
fi
-------------------------

Add the macro call there and then run bootstrap to regenerate configure from configure.ac and it should all work out.

--Rik