I understand the importance of shared vs static libraries. However, several programs I have come across recommend compiling with
--enable-static
while other recommend
--disable-shared
Are these the same thing? And if not, what is the difference?
If possible, please give an example of when to use one as opposed to the other.
In the common case that these are switches to a "configure" script generated by Autoconf and Libtool, then they officially mean closely-related, but different, things. --enable-static
means do build static libraries; --disable-shared
means don't build shared libraries.
If you want to be sure to get only static libraries, no matter what, you need to give both options. However, often just --disable-shared
will have that effect, because think about the possibilities: if the package builds only static libraries by default, then --disable-shared
is a no-op; if it builds both static and shared libraries by default, then you just have to turn off the shared libraries to get what you want; and if it builds only shared libraries by default, then you might think you need both options, but if you just say --disable-shared
, Libtool will usually notice that it's now being asked to build nothing, assume that that couldn't possibly be what you wanted, and flip the --enable-static
switch for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With