1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
|
From 44789af6c23b13911c982883656d6c3238a2e51f Mon Sep 17 00:00:00 2001
From: NIIBE Yutaka <gniibe@fsij.org>
Date: Tue, 15 Nov 2022 15:04:35 +0900
Subject: [PATCH] doc: Update document for pkg-config and libgcrypt.m4.
--
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
---
doc/gcrypt.texi | 46 ++++++++++++++++++----------------------------
1 file changed, 18 insertions(+), 28 deletions(-)
diff --git a/doc/gcrypt.texi b/doc/gcrypt.texi
index f82745f8..360a1604 100644
--- a/doc/gcrypt.texi
+++ b/doc/gcrypt.texi
@@ -256,54 +256,55 @@ file, you must make sure that the compiler can find it in the
directory hierarchy. This is accomplished by adding the path to the
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, Libgcrypt ships with a small
-helper program @command{libgcrypt-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{libgcrypt-config}. The following
-example shows how it can be used at the command line:
+source is configured. To solve this problem, Libgcrypt ships with
+@code{libgcrypt.pc} file, that knows about 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 libgcrypt}. The
+following example shows how it can be used at the command line:
@example
-gcc -c foo.c `libgcrypt-config --cflags`
+gcc -c foo.c `pkg-config --cflags libgcrypt`
@end example
-Adding the output of @samp{libgcrypt-config --cflags} to the
+Adding the output of @samp{pkg-config --cflags libgcrypt} to the
compiler's command line will ensure that the compiler can find the
Libgcrypt header file.
A similar problem occurs when linking the program with the library.
Again, the compiler 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{libgcrypt-config} can be used. For convenience, this option
+@command{pkg-config libgcrypt} can be used. For convenience, this option
also outputs all other options that are required to link the program
with the Libgcrypt libraries (in particular, the @samp{-lgcrypt}
option). The example shows how to link @file{foo.o} with the Libgcrypt
library to a program @command{foo}.
@example
-gcc -o foo foo.o `libgcrypt-config --libs`
+gcc -o foo foo.o `pkg-config --libs libgcrypt`
@end example
Of course you can also combine both examples to a single command by
-specifying both options to @command{libgcrypt-config}:
+specifying both options to @command{pkg-config libgcrypt}:
@example
-gcc -o foo foo.c `libgcrypt-config --cflags --libs`
+gcc -o foo foo.c `pkg-config --cflags --libs libgcrypt`
@end example
@node Building sources using Automake
@section Building sources using Automake
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{libgcrypt-config} script at all.
-Libgcrypt provides an extension to Automake that does all
-the work for you.
+invoking the @command{pkg-config} script at all.
+
+You can use @code{PKG_CHECK_MODULES} macro, or, libgcrypt also
+provides an extension to Automake that does all the work for you.
@c A simple macro for optional variables.
@macro ovar{varname}
@r{[}@var{\varname\}@r{]}
@end macro
@@ -314,24 +315,13 @@ found, execute @var{action-if-found}, otherwise do
@var{action-if-not-found}, if given.
Additionally, the function defines @code{LIBGCRYPT_CFLAGS} to the
flags needed for compilation of the program to find the
@file{gcrypt.h} header file, and @code{LIBGCRYPT_LIBS} to the linker
-flags needed to link the program to the Libgcrypt library. If the
-used helper script does not match the target type you are building for,
-a warning is printed and the string @code{libgcrypt} is appended to the
-variable @code{gpg_config_script_warn}.
-
-This macro searches for @command{libgcrypt-config} along the PATH. If
-you are cross-compiling, it is useful to set the environment variable
-@code{SYSROOT} to the top directory of your target. The macro will
-then first look for the helper program in the @file{bin} directory
-below that top directory. An absolute directory name must be used for
-@code{SYSROOT}. Finally, if the configure command line option
-@code{--with-libgcrypt-prefix} is used, only its value is used for the top
-directory below which the helper script is expected.
+flags needed to link the program to the Libgcrypt library.
+This macro locates for @code{libgcrypt.pc}, with cross-compile support.
@end defmac
You can use the defined Autoconf variables like this in your
@file{Makefile.am}:
--
2.35.1
|