What is ltmain.sh, and why does automake say it is missing? What is a good auto (make/conf/etc) generator?
Asked Answered
S

3

6

I just want to develop a C app in linux with the auto(make/conf/...) stuff automatically generated. I tried generating it with ede and anjuta, but it doesn't seem to generate Makefile.am. So, I tried running automake, and it says "ltmain.sh" isn't found. Is there some easy to generate the basic build files for linux C/C++ apps. What is the standard practice? Do most people write these files themselves?

Soddy answered 11/5, 2010 at 3:34 Comment(1)
read here gnu.org/software/hello/manual/autoconf/index.html#TopMcgruder
R
5

Generating a really trivial set of autotool files is pretty easy. Here's a (really basic) example. After you run these, you should get a copy of ltmain.sh in the directory, and you'll be all set to run the configure script:


$ mkdir sample
$ cd sample
$ echo 'int main( void ) { return 0; }' > foo.c
$ echo 'bin_PROGRAMS = foo' > Makefile.am
$ autoscan
$ mv configure.scan configure.ac
$ # edit configure.ac, add AM_INIT_AUTOMAKE([foreign])
$ # and LT_INIT, set project name and bug-report-address
$ autoreconf -ivf

Note that in this example, libtool really isn't necessary since the example is just building a simple app. But you asked about ltmain.sh, and that's a libtool thing so LT_INIT is needed to address that portion of the question. If you want to build a library, change bin_PROGRAMS to lib_LTLIBRARIES.

Regrate answered 23/5, 2010 at 8:1 Comment(0)
A
2

EDE can work with your Automake files in two different ways. If you write your own automake files, it will read them, and tweak them via the UI.

If you prefer, you can have EDE do the whole thing for you. First, create your first C file, then when it is on disk, do:

M-x ede-new RET Automake RET

then from the project/project options menu, add a target, like "program".

If you fill in your C file, you can then choose Project->Build->build currentproject from the menu, and it will create and setup everything needed for Automake to do it's thing, in addition to running all the misc automake commands needed.

Lastly, there is a 'run' option somewhere to run your program.

Avrom answered 11/5, 2010 at 23:2 Comment(0)
M
-4

I'd consider not using autoconf and automake at all -- their complexity outweighs their benefit, particularly if you're targeting only Linux.

Note that "git", for example, doesn't use them at all; instead it simply has a moderately-complex (but comprehensible) Makefile.

Marhtamari answered 11/5, 2010 at 14:44 Comment(4)
This does not answer the question and is thus a completely irrelevant opinion on a different topic.Bennett
git certainly does use autoconf. And the Makefile in git is far less comprehensible than the equivalent Makefile.am would be.Regrate
Actually automake/autoconf make things far simpler, especially if you're targetting linux, unless your program is completely trivial. An automake input file (Makefile.am) is a thing of beauty, and far simpler to write or understand (and yet much more functional), than an equivalent Makefile. For cases where configuration isn't really necessary, the autoconf input file (configure.ac) can be trivial, and if some configuration is necessary, autoconf is a far nicer way to do it than ad-hoc methods which seem to be the alternative.Rufinaruford
btw, I should note that in the old days, the hardest part of the autotools was just figuring out which tools to run when (and remembering to do it)... but nowadays, (1) in a fully set-up project, one just runs configure, and the resulting Makefile has all the dependencies needed to thereafter always do "the right thing" just by typing make, or (2) in a "raw" project (with no configure file), one just types autoreconf --install first, and then does (1). The only really bad thing about autotools these days is the crufty implementation—but most people don't really have to care...Rufinaruford

© 2022 - 2024 — McMap. All rights reserved.