2
votes

I am trying to generate shared and static library with autotools, so far I have

configure.ac:

  # Process this file with autoconf to produce a configure script.

  AC_PREREQ([2.68])
  AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])
  AM_INIT_AUTOMAKE(memory,1.0.0)
  #AC_CONFIG_SRCDIR([include/memory.h])
  #AC_CONFIG_HEADERS([config.h])

  # Checks for programs.
  AC_PROG_CC

  AM_PROG_CC_C_O
  AC_PROG_RANLIB
  AC_PROG_LIBTOOL


  # Checks for libraries.

  # Checks for header files.
  AC_CHECK_HEADERS([stdlib.h])

  # Checks for typedefs, structures, and compiler characteristics.

  # Checks for library functions.
  AC_FUNC_MALLOC

  AC_CONFIG_FILES([Makefile])
  AC_OUTPUT

makefile.am in my main dir:

lib_LTLIBRARIES = libmemory.la
libmemory_la_SOURCES = src/memory.c
libmemory_la_CFLAGS = -I./include

and I want him to just create two files, .a and .so in this dir, but instead he creates ./libs dir and there such files:

libmemory.a
libmemory.la -> ../libmemory.la
libmemory.lai
ibmemory_la-memory.o
libmemory.so -> libmemory.so.0.0.0
libmemory.so.0 -> libmemory.so.0.0.0
libmemory.so.0.0.0

so what should I do, to just create one simple library in static in dynamic version?

1

1 Answers

4
votes

.libs is a directory specific to the internal implementation of libtool, in other words, you are not to think too hard about it. You get a libmemory.la, which represents all variants (static, shared, ..) that you built. They all will be properly installed as expected when doing make install.

Libraries use various schemes for versioning, and libtool has to default to something, which is why you get a libmemory.so.0.0.0.