Mercurial > hg > octave-terminal
changeset 15596:5f031158c693
Use pkg-config to discover Qt (pkg-config is already a requirement anyway).
* build-aux/common.mk (do_subst_config_vals): Replace QT_INCDIR and QT_LIBDIR
with QT_CPPFLAGS, QT_LDFLAGS and QT_LIBS.
* configure.ac: Likewise and use pkg-config to discover the new variables.
* libgui/Makefile.am (QT_INCDIR, QT_LIBDIR, QT_LIBS, QT_LDFLAGS): Delete
variable definitions.
* libgui/link-deps.mk (LIBOCTGUI_LINK_DEPS): Use automake @QT_LIBS@.
(LIBOCTGUI_LIK_OPTS): Use automake @QT_LDFLAGS@.
* libgui/qterminal-module.mk (qterminal_libqterminal_la_CPPFLAGS): Use
automake @QT_CPPFLAGS@ instead of QT_INCDIR-based include paths.
(MOC_CPPFLAGS): Define Q_OS_WIN32 instead of WIN32.
* libgui/src/module.mk (src_libgui_src_la_CPPFLAGS): Use automake
@QT_CPPFLAGS@ instead of QT_INCDIR-based include paths.
* libinterp/interpfcn/toplev.cc (Foctave_config_info): Replace QT_INCDIR and
QT_LIBDIR with QT_CPPFLAGS, QT_LDFLAGS and QT_LIBS.
* libinterp/oct-conf.in.h: Replace OCTAVE_CONF_QT_INCDIR and
OCTAVE_CONF_QT_LIBDIR with OCTAVE_CONF_QT_CPPFLAGS, OCTAVE_CONF_QT_LDFLAGS
and OCTAVE_CONF_QT_LIBS.
* m4/acinclude.m4 (OCTAVE_CHECK_FUNC_FINDFIRST_MODERN,
OCTAVE_CHECK_FUNC_SETPLACEHOLDERTEXT): Use QT_CPPFLAGS instead of QT_INCDIR.
author | Michael Goffioul <michael.goffioul@gmail.com> |
---|---|
date | Mon, 05 Nov 2012 01:47:49 +0000 |
parents | 6e780fb15c14 |
children | 9046ee786fe1 |
files | build-aux/common.mk configure.ac libgui/Makefile.am libgui/link-deps.mk libgui/qterminal-module.mk libgui/src/module.mk libinterp/interpfcn/toplev.cc libinterp/oct-conf.in.h m4/acinclude.m4 |
diffstat | 9 files changed, 44 insertions(+), 48 deletions(-) [+] |
line wrap: on
line diff
--- a/build-aux/common.mk +++ b/build-aux/common.mk @@ -576,8 +576,9 @@ -e "s|%OCTAVE_CONF_QRUPDATE_CPPFLAGS%|\"${QRUPDATE_CPPFLAGS}\"|" \ -e "s|%OCTAVE_CONF_QRUPDATE_LDFLAGS%|\"${QRUPDATE_LDFLAGS}\"|" \ -e "s|%OCTAVE_CONF_QRUPDATE_LIBS%|\"${QRUPDATE_LIBS}\"|" \ - -e "s|%OCTAVE_CONF_QT_INCDIR%|\"${QT_INCDIR}\"|" \ - -e "s|%OCTAVE_CONF_QT_LIBDIR%|\"${QT_LIBDIR}\"|" \ + -e "s|%OCTAVE_CONF_QT_CPPFLAGS%|\"${QT_CPPFLAGS}\"|" \ + -e "s|%OCTAVE_CONF_QT_LDFLAGS%|\"${QT_LDFLAGS}\"|" \ + -e "s|%OCTAVE_CONF_QT_LIBS%|\"${QT_LIBS}\"|" \ -e "s|%OCTAVE_CONF_RANLIB%|\"${RANLIB}\"|" \ -e "s|%OCTAVE_CONF_RDYNAMIC_FLAG%|\"${RDYNAMIC_FLAG}\"|" \ -e "s|%OCTAVE_CONF_READLINE_LIBS%|\"${READLINE_LIBS}\"|" \
--- a/configure.ac +++ b/configure.ac @@ -2179,8 +2179,9 @@ ### GUI/Qt related tests. HAVE_QT=false -QT_INCDIR= -QT_LIBDIR= +QT_CPPFLAGS= +QT_LDFLAGS= +QT_LIBS= win32_terminal=no build_gui=true GUIDIR=libgui @@ -2194,17 +2195,14 @@ [], [AC_MSG_ERROR([Qt libraries are required to build the GUI])]) - ## Check for Qt utility programs - AC_CHECK_PROGS(QMAKE, [qmake-qt5 qmake-qt4 qmake]) - if test -z "$QMAKE"; then - AC_MSG_ERROR([qmake is required to build the GUI]) - fi + ## Retrieve Qt compilation and linker flags + QT_CPPFLAGS="`$PKG_CONFIG --cflags-only-I QtCore QtGui QtNetwork`" + QT_LDFLAGS="`$PKG_CONFIG --libs-only-L QtCore QtGui QtNetwork`" + QT_LIBS="`$PKG_CONFIG --libs-only-l QtCore QtGui QtNetwork`" - QT_INCDIR=`$QMAKE -query QT_INSTALL_HEADERS | sed -e 's,\\\\,/,g'` - QT_LIBDIR=`$QMAKE -query QT_INSTALL_LIBS | sed -e 's,\\\\,/,g'` - - if test "$QT_INCDIR" = "**Unknown**"; then - AC_MSG_ERROR([qmake >= Qt4 is required to build the GUI]) + ## Check for Qt4 + if ! `$PKG_CONFIG --atleast-version=4.0.0 QtCore`; then + AC_MSG_ERROR([Qt >= 4.0.0 is required to build the GUI]) fi AC_CHECK_PROGS(MOC, [moc-qt5 moc-qt4 moc]) @@ -2216,7 +2214,7 @@ HAVE_QT=true AC_DEFINE(HAVE_QT, 1, - [Define to 1 if Qt is available (libraries, developer header files, utility programs (qmake, moc, uic, and rcc))]) + [Define to 1 if Qt is available (libraries, developer header files, utility programs (moc, uic, and rcc))]) ## Check for Qscintilla library which is used in the GUI editor. AC_CACHE_CHECK([whether Qscintilla library is installed], @@ -2224,9 +2222,9 @@ [save_CPPFLAGS="$CPPFLAGS" save_LDFLAGS="$LDFLAGS" save_LIBS="$LIBS" - CPPFLAGS="-I$QT_INCDIR -I$QT_INCDIR/Qt $CPPFLAGS" - LDFLAGS="-L$QT_LIBDIR $LDFLAGS" - LIBS="-lqscintilla2" + CPPFLAGS="$QT_CPPFLAGS $CPPFLAGS" + LDFLAGS="$QT_LDFLAGS $LDFLAGS" + LIBS="$QT_LIBS -lqscintilla2" AC_LANG_PUSH(C++) AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <Qsci/qscilexersql.h> @@ -2243,6 +2241,9 @@ if test $octave_cv_lib_qscintilla = no; then AC_MSG_ERROR([Qscintilla library is required to build the GUI]) fi + ## Let's assume Qscintilla library is at the same location as + ## other regular Qt libraries. + QT_LIBS="$QT_LIBS -lqscintilla2" ## Check for Qt functions which have changed their API over time OCTAVE_CHECK_FUNC_FINDFIRST_MODERN @@ -2271,8 +2272,9 @@ fi AM_CONDITIONAL([AMCOND_BUILD_GUI], [test $build_gui = true]) AM_CONDITIONAL([WIN32_TERMINAL], [test $win32_terminal = yes]) -AC_SUBST(QT_INCDIR) -AC_SUBST(QT_LIBDIR) +AC_SUBST(QT_CPPFLAGS) +AC_SUBST(QT_LDFLAGS) +AC_SUBST(QT_LIBS) AC_SUBST(GUIDIR) ### Run configure in subdirectories. @@ -2549,8 +2551,9 @@ QRUPDATE CPPFLAGS: $QRUPDATE_CPPFLAGS QRUPDATE LDFLAGS: $QRUPDATE_LDFLAGS QRUPDATE libraries: $QRUPDATE_LIBS - Qt headers: $QT_INCDIR - Qt libraries: $QT_LIBDIR + Qt CPPFLAGS: $QT_CPPFLAGS + Qt LDFLAGS: $QT_LDFLAGS + Qt libraries: $QT_LIBS READLINE libraries: $READLINE_LIBS REGEX libraries: $REGEX_LIBS TERM libraries: $TERM_LIBS
--- a/libgui/Makefile.am +++ b/libgui/Makefile.am @@ -22,14 +22,6 @@ AUTOMAKE_OPTIONS = subdir-objects -QT_INCDIR = @QT_INCDIR@ - -QT_LIBDIR = @QT_LIBDIR@ - -QT_LIBS = -lQtCore -lQtGui -lQtNetwork -lqscintilla2 - -QT_LDFLAGS = -L$(QT_LIBDIR) - MOC_CPPFLAGS = octlib_LTLIBRARIES = liboctgui.la
--- a/libgui/link-deps.mk +++ b/libgui/link-deps.mk @@ -7,10 +7,10 @@ endif LIBOCTGUI_LINK_DEPS += \ - $(QT_LIBS) + @QT_LIBS@ LIBOCTGUI_LINK_OPTS = \ - $(QT_LDFLAGS) + @QT_LDFLAGS@ if AMCOND_LINK_ALL_DEPS LIBOCTGUI_LINK_DEPS += $(LIBOCTINTERP_LINK_DEPS)
--- a/libgui/qterminal-module.mk +++ b/libgui/qterminal-module.mk @@ -35,9 +35,7 @@ qterminal_libqterminal_la_CPPFLAGS = \ $(AM_CPPFLAGS) \ - -I$(QT_INCDIR) \ - -I$(QT_INCDIR)/QtCore \ - -I$(QT_INCDIR)/QtGui \ + @QT_CPPFLAGS@ \ -I$(srcdir)/qterminal/libqterminal qterminal_libqterminal_la_CFLAGS = $(AM_CFLAGS) @@ -56,7 +54,7 @@ qterminal_libqterminal_la_CPPFLAGS += -DUNICODE # This flag is required to let MOC know about Q_OS_WIN32. -MOC_CPPFLAGS += -DWIN32 +MOC_CPPFLAGS += -DQ_OS_WIN32 else
--- a/libgui/src/module.mk +++ b/libgui/src/module.mk @@ -126,10 +126,7 @@ src_libgui_src_la_CPPFLAGS = \ $(AM_CPPFLAGS) \ @OCTGUI_DLL_DEFS@ \ - -I$(QT_INCDIR) \ - -I$(QT_INCDIR)/QtCore \ - -I$(QT_INCDIR)/QtGui \ - -I$(QT_INCDIR)/QtNetwork \ + @QT_CPPFLAGS@ \ -I$(srcdir)/qterminal/libqterminal \ -Isrc -I$(srcdir)/src \ -I$(srcdir)/src/m-editor \
--- a/libinterp/interpfcn/toplev.cc +++ b/libinterp/interpfcn/toplev.cc @@ -1346,8 +1346,9 @@ { false, "QRUPDATE_CPPFLAGS", OCTAVE_CONF_QRUPDATE_CPPFLAGS }, { false, "QRUPDATE_LDFLAGS", OCTAVE_CONF_QRUPDATE_LDFLAGS }, { false, "QRUPDATE_LIBS", OCTAVE_CONF_QRUPDATE_LIBS }, - { false, "QT_INCDIR", OCTAVE_CONF_QT_INCDIR }, - { false, "QT_LIBDIR", OCTAVE_CONF_QT_LIBDIR }, + { false, "QT_CPPFLAGS", OCTAVE_CONF_QT_CPPFLAGS }, + { false, "QT_LDFLAGS", OCTAVE_CONF_QT_LDFLAGS }, + { false, "QT_LIBS", OCTAVE_CONF_QT_LIBS }, { false, "RANLIB", OCTAVE_CONF_RANLIB }, { false, "RDYNAMIC_FLAG", OCTAVE_CONF_RDYNAMIC_FLAG }, { false, "READLINE_LIBS", OCTAVE_CONF_READLINE_LIBS },
--- a/libinterp/oct-conf.in.h +++ b/libinterp/oct-conf.in.h @@ -482,12 +482,16 @@ #define OCTAVE_CONF_QRUPDATE_LIBS %OCTAVE_CONF_QRUPDATE_LIBS% #endif -#ifndef OCTAVE_CONF_QT_INCDIR -#define OCTAVE_CONF_QT_INCDIR %OCTAVE_CONF_QT_INCDIR% +#ifndef OCTAVE_CONF_QT_CPPFLAGS +#define OCTAVE_CONF_QT_CPPFLAGS %OCTAVE_CONF_QT_CPPFLAGS% #endif -#ifndef OCTAVE_CONF_QT_LIBDIR -#define OCTAVE_CONF_QT_LIBDIR %OCTAVE_CONF_QT_LIBDIR% +#ifndef OCTAVE_CONF_QT_LDFLAGS +#define OCTAVE_CONF_QT_LDFLAGS %OCTAVE_CONF_QT_LDFLAGS% +#endif + +#ifndef OCTAVE_CONF_QT_LIBS +#define OCTAVE_CONF_QT_LIBS %OCTAVE_CONF_QT_LIBS% #endif #ifndef OCTAVE_CONF_RANLIB
--- a/m4/acinclude.m4 +++ b/m4/acinclude.m4 @@ -153,7 +153,7 @@ [octave_cv_func_findfirst_modern], [AC_LANG_PUSH(C++) ac_octave_save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="-I$QT_INCDIR -I$QT_INCDIR/Qt $CPPFLAGS" + CPPFLAGS="$QT_CPPFLAGS $CPPFLAGS" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <Qsci/qsciglobal.h> ]], [[ @@ -231,7 +231,7 @@ [octave_cv_func_setplaceholdertext], [AC_LANG_PUSH(C++) ac_octave_save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="-I$QT_INCDIR $CPPFLAGS" + CPPFLAGS="$QT_CPPFLAGS $CPPFLAGS" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <Qt/qglobal.h> ]], [[