From 05eb70c54969191c6833901d8af6a52d17d0adea Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Tue, 15 Nov 2022 15:16:18 +0900 Subject: doc: Update the description about pkg-config. -- Signed-off-by: NIIBE Yutaka --- doc/assuan.texi | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/doc/assuan.texi b/doc/assuan.texi index 0a197c2..7ecf544 100644 --- a/doc/assuan.texi +++ b/doc/assuan.texi @@ -464,18 +464,18 @@ directory in which the header file is located to the compilers include file search path (via the @option{-I} option). However, the path to the include file is determined at the time the -source is configured. To solve this problem, @code{libassuan} ships with -a small helper program @command{libassuan-config} that knows the path to -the include file and other configuration options. The options that need -to be added to the compiler invocation at compile time are output by the -@option{--cflags} option to @command{libassuan-config}. The following +source is configured. To solve this problem, @code{libassuan} ships +with @code{libassuan.pc} file, that knows the path to the include file +and other configuration options. The options that need to be added to +the compiler invocation at compile time are output by the +@option{--cflags} option to @command{pkg-config libassuan}. The following example shows how it can be used at the command line: @example -gcc -c foo.c $(libassuan-config --cflags) +gcc -c foo.c $(pkg-config --cflags libassuan) @end example -Adding the output of @samp{libassuan-config --cflags} to the compiler's +Adding the output of @samp{pkg-config --cflags libassuan} to the compiler's command line will ensure that the compiler can find the @file{assuan.h} header file. @@ -483,7 +483,7 @@ A similar problem occurs when linking the program with the library. Again, the compiler/linker has to find the library files. For this to work, the path to the library files has to be added to the library search path (via the @option{-L} option). For this, the option -@option{--libs} to @command{libassuan-config} can be used. For +@option{--libs} to @command{pkg-config libassuan} can be used. For convenience, this option also outputs all other options that are required to link the program with the @code{libassuan} libraries (in particular, the @option{-lassuan} option). The example shows how to @@ -491,14 +491,14 @@ link @file{foo.o} with the @code{libassuan} library to a program @command{foo}. @example -gcc -o foo foo.o $(libassuan-config --libs) +gcc -o foo foo.o $(pkg-config --libs libassuan) @end example You can also combine both examples to a single command by specifying -both options to @command{libassuan-config}: +both options to @command{pkg-config libassuan}: @example -gcc -o foo foo.c $(libassuan-config --cflags --libs) +gcc -o foo foo.c $(pkg-config --cflags --libs libassuan) @end example @@ -507,7 +507,9 @@ gcc -o foo foo.c $(libassuan-config --cflags --libs) It is much easier if you use GNU Automake instead of writing your own Makefiles. If you do that you do not have to worry about finding and -invoking the @command{libassuan-config} script at all. @code{libassuan} +invoking the @command{pkg-config} script at all. + +You can use @code{PKG_CHECK_MODULES} macro, or, @code{libassuan} also provides an Automake macro that does all the work for you. @defmac AM_PATH_LIBASSUAN (@ovar{minimum-version}, @ovar{action-if-found}, @ovar{action-if-not-found}) -- cgit v1.2.1