On Sun, May 18, 2008 at 6:50 PM, David Jensen <[EMAIL PROTECTED]> wrote:
> On Sun, 18 May 2008 23:00:42 +0200
> Thomas Trepl <[EMAIL PROTECTED]> wrote:
>
>> Am Sonntag, 18. Mai 2008 17:10:03 schrieb David Jensen:
>> > ...
>> > You will probably want to learn autoconf and friends, sigh...
>> hmm, any suggestions one that one?  I started to look around a bit
>> but i found only very basic samples or too sophisticated things or
>> outdated ones...
>
> Yes, it's a pain.  As you said, a lot of examples are outdated.
> Actually, I started with the original BLFS hint.

The autotools are really not that hard. The best way to learn it is
just to make a silly project. Here is a barebones project making use
of autoconf, automake and libtool:

cat > configure.ac << "EOF"
AC_INIT([foo],[0.1],[EMAIL PROTECTED])
dnl foreign is just so automake doesn't complain about missing COPYING, etc.
AM_INIT_AUTOMAKE([foreign])
AC_PROG_LIBTOOL
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
EOF

cat > Makefile.am << "EOF"
# create a shared libary libbaz and a program foo linking to it
lib_LTLIBRARIES = libbaz.la
libbaz_la_SOURCES = baz.c baz.h
include_HEADERS = baz.h
bin_PROGRAMS = foo
foo_SOURCES = foo.c
foo_LDADD = libbaz.la
EOF

cat > baz.h << "EOF"
void jimmy(void);
EOF

cat > baz.c << "EOF"
void jimmy(void)
{
        return;
}
EOF

cat > foo.c << "EOF"
#include "baz.h"
int main(void)
{
        jimmy();
        return 0;
}
EOF

Rebuild the autotools, configure, make
autoreconf -iv
./configure
make

And there is a ton of documentation on the autotools, with the
autobook being a great high level tutorial.

http://sourceware.org/autobook/autobook/autobook_toc.html
http://www.gnu.org/software/autoconf/manual/
http://www.gnu.org/software/automake/manual/
http://www.gnu.org/software/libtool/manual/

What I've also found useful is just to read some of the autoconf
macros. They're in m4, but not that difficult to understand without
knowing m4. Look in /usr/share/autoconf/autoconf and
/usr/share/aclocal. You'll probably want to be somewhat familiar with
the pkg-config macros in aclocal/pkg.m4.

--
Dan
-- 
http://linuxfromscratch.org/mailman/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to