Next: Command-line options, Previous: Include files, Up: The programmer’s perspective [Contents][Index]
The library to link with is called libtextstyle
, with a
system-dependent suffix. You link with it though link options of the
form -ltextstyle
for a library installed in system locations, or
-Llibdir -ltextstyle
for a static library installed in other
locations, or -Llibdir -ltextstyle -Wl,-rpath,libdir
for a shared library installed in other locations (assuming a GCC
compatible compiler and linker and no libtool
), or
-Llibdir -ltextstyle -Rlibdir
for a shared library
installed in other locations (with libtool
). Additionally, the
link options may need to include the dependencies: -lm
, and
-lncurses
or (on NetBSD) -ltermcap
or (on AIX)
-lxcurses
or (on HP-UX) -lcurses
, and on some systems also
-liconv
.
It is a bit complicated to determine the right link options in a portable
way. Therefore an Autoconf macro is provided in the file
libtextstyle.m4
in Gnulib, that makes this task easier. Assuming
the build system of your package is based on GNU Autoconf, you invoke it
through gl_LIBTEXTSTYLE
. It searches for an installed
libtextstyle
. If found, it sets and AC_SUBSTs
HAVE_LIBTEXTSTYLE=yes
and the LIBTEXTSTYLE
and
LTLIBTEXTSTYLE
variables, and augments the CPPFLAGS
variable, and #defines HAVE_LIBTEXTSTYLE
to 1. Otherwise, it sets
and AC_SUBSTs HAVE_LIBTEXTSTYLE=no
and LIBTEXTSTYLE
and
LTLIBTEXTSTYLE
to empty. In link commands that use libtool
,
use LTLIBTEXTSTYLE
; in link commands that don’t use libtool
,
use LIBTEXTSTYLE
.
If you use GNU Automake, the proper place to use the link options is
program_LDADD
for programs and library_LIBADD
for libraries.