5

After getting used and comfortable to GNU autoconf and GNU automake. I decided to start learning about libtool. But still I cannot see clearly the benefit of using it in the real world.

As I read the main benefit is the main portability issue which is whether the system support dynamic libraries. However, nowadays as most of the UNIX-like OS are mainly GNU/Linux, BSD-flavors or Mac OS it's hardly possible to face an OS which does not support dynamic library or has an odd library standard.

So here is my question, is it worthy to use libtool?

Vicente Bolea
  • 1,409
  • 16
  • 39

2 Answers2

4

Yes. It's difficult to write a makefile for a shared library that will build properly, both on Linux and on Mac OS. With Libtool it works out of the box.

ptomato
  • 56,175
  • 13
  • 112
  • 165
  • 1
    Can you give any advantage comparing with autoconf + RANLIB? – Vicente Bolea Apr 14 '15 at 05:01
  • 1
    If you are building static libraries, ranlib is probably OK. If you are building shared libraries, or especially plugin modules, there are so many custom things that you have to do in a platform-dependent way, even differing between Unixes like Linux and Mac OS. – ptomato Apr 16 '15 at 03:41
4

As an example, GNU ld and Darwin's native Mach-O ld have very different options. libtool takes care of that, and can also use .la files to manage dependencies, versioning information, etc.

Consider a build system that creates DSOs, or modules that can be loaded and resolved at run time. libtool provides platform-independent options to create these objects, and the ltdl API for the application.

Brett Hale
  • 21,653
  • 2
  • 61
  • 90
  • How libtools knows which flags should be activated in each operating system? Do you specify that information in the `.la` file? – Vicente Bolea Apr 14 '15 at 08:43
  • @VicenteAdolfoBoleaSánchez - [libtool](http://www.gnu.org/software/libtool/manual/libtool.html#Introduction) is implemented as a script. It detects the OS. – Brett Hale Apr 14 '15 at 12:45
  • I was not what I was asking but, I found out the function of the `.la` files. Thanks for the info! – Vicente Bolea Apr 14 '15 at 12:53