What is the place of libtool, when to use it?
Asked Answered
B

2

8

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?

Botulism answered 13/4, 2015 at 16:31 Comment(0)
P
6

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.

Perrins answered 14/4, 2015 at 6:7 Comment(3)
How libtools knows which flags should be activated in each operating system? Do you specify that information in the .la file?Botulism
@VicenteAdolfoBoleaSánchez - libtool is implemented as a script. It detects the OS.Perrins
I was not what I was asking but, I found out the function of the .la files. Thanks for the info!Botulism
A
6

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.

Anisette answered 14/4, 2015 at 4:57 Comment(2)
Can you give any advantage comparing with autoconf + RANLIB?Botulism
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.Anisette
P
6

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.

Perrins answered 14/4, 2015 at 6:7 Comment(3)
How libtools knows which flags should be activated in each operating system? Do you specify that information in the .la file?Botulism
@VicenteAdolfoBoleaSánchez - libtool is implemented as a script. It detects the OS.Perrins
I was not what I was asking but, I found out the function of the .la files. Thanks for the info!Botulism

© 2022 - 2024 — McMap. All rights reserved.