From: Andrei Pavel Date: Tue, 17 Jun 2025 19:12:48 +0000 (+0300) Subject: [#3680] Document the use of the kea.pc file X-Git-Tag: Kea-3.0.0~72 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=479158cb83cebeda25abcd27e7aa4d39ccb0179a;p=thirdparty%2Fkea.git [#3680] Document the use of the kea.pc file --- diff --git a/src/lib/hooks/hooks_user.dox b/src/lib/hooks/hooks_user.dox index d865a1cf5d..5d9d8fd9ee 100644 --- a/src/lib/hooks/hooks_user.dox +++ b/src/lib/hooks/hooks_user.dox @@ -655,7 +655,7 @@ case, so the code for the first callout (used to classify the client's hardware address) is: @code -// pkt_receive4.cc +// pkt4_receive.cc #include #include @@ -876,31 +876,30 @@ configuration derived from the root logger. Building the code requires building a sharable library. This requires the code be compiled as position-independent code (using the -compiler's "-fpic" switch) and linked as a shared library (with the -linker's "-shared" switch). The build command also needs to point to +compiler's ``-fpic`` switch) and linked as a shared library (with the +linker's ``-shared`` switch). The build command also needs to point to the Kea include directory and link in the appropriate libraries. +Fortunately, the Kea installation holds a kea.pc pkg-config file +that provides the necessary include flags ``-I``, library flags ``-L``, +and link flags ``-l``. Assuming that Kea has been installed in the default location, the -command line needed to create the library using the Gnu C++ compiler on a -Linux system is: +command line needed to create the library on a Linux system is: @code -g++ -I /include/kea -L /lib -fpic -shared -o example.so \ - load_unload.cc pkt4_receive.cc pkt4_send.cc version.cc \ - -lkea-dhcpsrv -lkea-dhcp++ -lkea-hooks -lkea-log -lkea-util -lkea-exceptions +c++ \ + $(pkg-config --cflags --libs /usr/local/lib/pkgconfig/kea.pc) \ + -fpic -shared -o example.so \ + load_unload.cc multi_threading_compatible.cc pkt4_receive.cc pkt4_send.cc version.cc @endcode Notes: -- Replace "" with the location in which you installed Kea. Unless -you specified the "--prefix" switch on the "meson setup" command line when -building Kea, it will be installed in the default location, usually /usr/local. - The compilation command and switches required may vary depending on your operating system and compiler - consult the relevant documentation for details. - The list of libraries that need to be included in the command line depends on the functionality used by the hook code and the module to -which they are attached. Depending on operating system, you may also need -to explicitly list libraries on which the Kea libraries you link against depend. +which they are attached. @subsection hooksdgConfiguration Configuring the Hooks Library