9

Creating bin program is really easy using autotools I need to just define two files.

`Makefile.am'

bin_PROGRAMS = hello
hello_SOURCES = hello.c

`configure.in'

AC_INIT(hello.c)
AM_INIT_AUTOMAKE(hello,1.0)
AC_PROG_CC
AC_PROG_INSTALL
AC_OUTPUT(Makefile)

can any body give a smallest example for creating static library using autotools ?

Vivek Goel
  • 22,942
  • 29
  • 114
  • 186
  • 2
    The syntax you use for `configure.in` is seriously outdated! Please read the "Hello World" example from the Automake manual for the current syntax. http://sourceware.org/automake/automake.html#Hello-World – adl Sep 28 '11 at 14:39
  • @adi I just started learning it. and found that as example – Vivek Goel Sep 28 '11 at 16:51
  • 2
    Yes, it's a problem when you begin: a lot of tutorials you find on the Internet has been written around 1999-2000 when Automake 1.4 and Autoconf 2.13 were everywhere. But these tools have been huge improvement over the year, and the syntax changed a lot. As a rule of thumb, if your document uses `configure.in` instead of `configure.ac`, it is likely to be outdated. I have a tutorial with up-to-date syntax at http://www.lrde.epita.fr/~adl/autotools.html if you want. – adl Sep 28 '11 at 19:41

1 Answers1

16

Makefile.am:

lib_LIBRARIES = libhello.a
libhello_a_SOURCES = hello.c

configure.ac:

AC_INIT([libhello], [1.0], [bug@libhello.org])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_PROG_CC
AC_PROG_RANLIB
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

The documentation for building libraries with Automake is here.

adl
  • 15,627
  • 6
  • 51
  • 65