Search code examples
qtautotoolsm4

How to use QT and GNU Autotools by using AutoTroll?


I would like to use Autotools and QT4 together. For this i would like to use AutoTroll. As the Website says, it should be very easy to use it. Unfortunately i was not able to do so. I have a working Hello World example:

This is how my configure.ac looks like:

AC_INIT([Hello], [0.1], [bug-report@hello.example.com], [hello],  [http://hello.example.com/])
AC_PREREQ([2.59])
AM_INIT_AUTOMAKE([1.10 no-define foreign])
AC_PROG_CXX
AC_PROG_CC
AT_WITH_QT
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

My Makefile.am:

AUTOMAKE_OPTIONS = subdir-objects
ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS}

bin_PROGRAMS = hello
hello_SOURCES = src/*.cpp

My simple main.cpp with a QT include:

#include <iostream>
#include <QApplication> \\Added this to test if Autotools works correctly
int main()
{
std::cout << "Hello Worlasdasdsadd!" << std::endl;
return 0;
}

Can someone please help mit with this? An short Step by step would be very nice. Thank you in advance.

Edit: I don't know how to integrate this m4 makro (Autotroll) in my configuration. This is why i cannot provide any "Errors" or something else. The of the website does not help me to understand what to do.


Solution

  • I won't recommend you to mix QT and autotools. For QT projects is most recommended to use cmake/qmake. When you get any problems it would be easier to find answers, etc.

    Furthermore, Autotroll seems unmaintained since 2008 and not tested with QT >= 4.4+, and it has rained a lot (really a lot, QML and QT 5.0 as examples) since then:

    AutoTroll has been tested successfully with Qt 4.0+, Qt 4.1+, Qt 4.2+ and Qt 4.3+

    If you just want to learn autotools, gtk/gnome, gnu-tools or just any c++/c/whatever-language project would make it easier for you. Find projects using autotools and learn what they need and what they use.

    Another recommendation is that you look for presentations and talks explaining the autotools basis and tools flows. All I can say is that Autotools is a big world, be patient.