ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I am reading the man-pages for autoconf, autoscan, etc but I can't really understand how I can get my program to be installed by the usual "configure && make && make install"-steps.
Do I have to write configure.ac manually and what should be in it? Are there any good guides on how to create this? I would really like to make my program being able to be compiled and installed with these steps instead of using g++ as I do now. :P Since many of my friends are not programmers and that would make my program behave like any program in the compile/installation-process.
It seems that the first step is to create configure.ac and then run autoscan. After that I can't really figure out how ifnames are used and so on.
Please help, this is really confusing, giving me headache. :P
I found a great link to what seems to be a good tutorial about all this. Here it is
Now run these commands from the shell (order is more or less important, and you may want to put this in a script "reconf.sh" or whatever):
touch NEWS README AUTHORS ChangeLog
You'll now have a working configure script.
Run this to create a source tarball:
You now have a file "hello-0.1.tar.gz" ready for distribution. "make distcheck" also tests unpacking, configuring, compiling and installing in a temporary directory, which is cleaned up automatically . If you just want to make the package, use "make dist", which is much faster (but doesn't do any testing)
On my (small) website, there is a little bigger autotools example. It uses a config.h, it includes a custom --with-foo switch for the configure-script to enable linking against a (non-existant) "libfoo.so", and a way to #define the datadirectory in config.h (the directory where xpm's, themes or whatever data the program needs), so the program "knows" where to find its data files.
I have now a program that uses Qt libraries. When I compile manually I do this:
moc on all three .h-files (moc -o moc_file.cc file.h)
Create all object-file (g++ -c -I/usr/lib/qt/include/ -o file.o file.cc), this include the new moc_-files.
Create the binary by linking them together (g++ -L/usr/lib/qt/lib/ -lqt-mt -o bin <all .o-files>)
Notice that I have to specify Qt's include and library, and at the last linking I also use "-lqt-mt". This and running the headers through moc, how can I tell autoconf to do that?
I want configure to check if Qt is installed and compile these files correctly.
Qt is a bit of a problem, because the MOC-stuff is unusual. I've tried to fix this myself once by making a FIND_QT m4 module, but succeeded only partly. See http://qleuren.sf.net/ for this. But this works only with Qt2, so it can be considered broken.
It's probably better to get the m4 module "bnv_have_qt" from the autconf-archive, and include it in your package. How to do this (including a m4 module), see the link I posted before, as it includes the simple "ac_define_dir.m4" as an example.
I check it out and it was very easy to get working. Now my configure can check if Qt is installed but I still have problems with the Makefile.
I noticed that when configure was done the docs on bnv_have_qt said that these vars was defined:
How shall I use these in Makefile.am so make will compile everything the "right" way (moc the .h-files, create objects, link the objects)?
Here are an example of the files I have:
Now I normaly moc the myclass.h, make object-files from the two sources and the moc'ed file and finally link all together to a binary file. I want this to be done by "make".