Search code examples
autotoolslibtool

How to switch between shared library output and executable output in libtool/autotools projects?


I have some autotools-managed project. Apart from source code files it has autogen.sh, configure.ac, Makefile.am, src/Makefile.am.

  1. How to find out looking at these file if it is a library or application? For example, in Qt I have "TEMPLATE = app" or "TEMPLATE = lib" which decides this. What is it in autotools?

  2. How to switch from generating a executable application to generating the library and back?


Solution

  • In your Makefile.am you should have something that looks like:

    bin_PROGRAMS = foo (or sbin or something else depending on where it lands)

    Change that to:

    lib_LTLIBRARIES = foo.la