Autotools: Difference between revisions

From miki
Jump to navigation Jump to search
(Created page with "== Configure == === Add extra library on link commands == <source lang="bash"> ./configure LDFLAGS="-lintl -liconv" </source>")
 
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
Anything about <code>libtoolize</code>, <code>autogen</code>, <code>configure</code>

== Basic usage ==
The default sequence is:
<source lang="bash">
autoreconf -ivf
./configure # Possibly add things like: --prefix=/usr
make
sudo make install
</source>

== Configure ==
== Configure ==
=== Add extra library on link commands ==
=== Add extra link flags or libraries ===

To add extra link flags (like location of libraries), use <code>LDFLAGS</code>:
<source lang="bash">
./configure LDFLAGS="-L/path/to/libs"
</source>

To add extra libraries, use <code>LDLIBS</code>:
<source lang="bash">
./configure LDLIBS="-lintl -liconv"
</source>
* '''Note''': Don't use <code>LDFLAGS</code> to add extra libraries, because it appears before list of source objects, and hence will be ignored by gcc.
* '''Note''': If <code>LDLIBS</code> does not work, try <code>LIBS</code> instead.

== Build 32-bit libraries on x86_64 ==
Do the following export before the build recipe (also with <code>cmake</code>):


<source lang="bash">
<source lang="bash">
./configure LDFLAGS="-lintl -liconv"
export LDFLAGS="-32" CXXFLAGS="-32" CFLAGS="-32"
</source>
</source>

Latest revision as of 11:47, 5 June 2023

Anything about libtoolize, autogen, configure

Basic usage

The default sequence is:

autoreconf -ivf
./configure             # Possibly add things like: --prefix=/usr
make
sudo make install

Configure

Add extra link flags or libraries

To add extra link flags (like location of libraries), use LDFLAGS:

./configure LDFLAGS="-L/path/to/libs"

To add extra libraries, use LDLIBS:

./configure LDLIBS="-lintl -liconv"
  • Note: Don't use LDFLAGS to add extra libraries, because it appears before list of source objects, and hence will be ignored by gcc.
  • Note: If LDLIBS does not work, try LIBS instead.

Build 32-bit libraries on x86_64

Do the following export before the build recipe (also with cmake):

export LDFLAGS="-32" CXXFLAGS="-32" CFLAGS="-32"