From 41fa97c22175ead1dca81440fbc03bd7cd59a5b2 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Fri, 11 Sep 2026 14:04:24 +0200 Subject: [PATCH 1/3] Document pkg-config --- doc/book.xml | 51 +++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 41 insertions(+), 10 deletions(-) diff --git a/doc/book.xml b/doc/book.xml index a407e54a..35e5b48e 100644 --- a/doc/book.xml +++ b/doc/book.xml @@ -756,6 +756,16 @@ YAZ client for more information. + + yaz.pc, + yaz-icu.pc, + yaz-server.pc + Files generated by configure for + pkg-config, specifying compiler and linker flags + for the main &yaz; library, ICU wrapper library, and Generic Frontend + server library, respectively. + + util/yaz-config A Bourne-shell script, generated by configure, that @@ -822,6 +832,16 @@ make install + + This also installs the pkg-config files + yaz.pc, yaz-icu.pc, and + yaz-server.pc in + ${libdir}/pkgconfig (by default, + /usr/local/lib/pkgconfig), and the legacy + yaz-config script in + ${bindir} (by default, + /usr/local/bin). + You probably need to have root access in order to perform this. You must specify the --prefix option for configure if @@ -936,16 +956,27 @@ How to make apps using YAZ on UNIX - This section describes how to compile - and link your own - applications using the &yaz; toolkit. - If you're used to Makefiles this shouldn't be hard. As for - other libraries you have used before, you need to set a proper include - path for your C/C++ compiler and specify the location of - &yaz; libraries. You can do it by hand, but generally we suggest - you use the yaz-config that is generated - by configure. This is especially - important if you're using the threaded version of &yaz; which - require you to pass more options to your linker/compiler. + Use pkg-config to obtain the compiler and linker + flags for applications using &yaz;. The installed packages are + yaz for the main library, + yaz-icu for the ICU wrapper library, and + yaz-server for the Generic Frontend server library. + For example, pkg-config --cflags yaz prints the + compiler flags and pkg-config --libs yaz prints the + linker flags. Substitute yaz-icu or + yaz-server when using those libraries; their flags + include the main library dependency. The ICU wrapper requires &yaz; + to have been built with ICU support. If the installation directory + is outside the search path of pkg-config, add + ${libdir}/pkgconfig to + PKG_CONFIG_PATH. + + + The legacy alternative is the yaz-config script + generated by configure. The following examples + describe how to use this script to set the include path for your + C/C++ compiler and specify the &yaz; libraries and other required + compiler and linker options. The yaz-config script accepts command line From fad39eb06e431c1dce70d246e5c607a8ce3801be Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Sat, 12 Sep 2026 14:33:29 +0200 Subject: [PATCH 2/3] Fix path for generated yaz-config --- doc/book.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/book.xml b/doc/book.xml index 35e5b48e..f6b2b3ad 100644 --- a/doc/book.xml +++ b/doc/book.xml @@ -767,7 +767,7 @@ - util/yaz-config + src/yaz-config A Bourne-shell script, generated by configure, that specifies how external applications should compile - and link with &yaz;. From b6d8084c816f022df56e98a19a690d421ac0d430 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Sat, 12 Sep 2026 14:36:02 +0200 Subject: [PATCH 3/3] Proper pkg-config xml libs depending on config --- configure.ac | 6 +++++- yaz-icu.pc.in | 2 +- yaz-server.pc.in | 2 +- yaz.pc.in | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 997e74df..66dc21c4 100644 --- a/configure.ac +++ b/configure.ac @@ -11,6 +11,7 @@ dnl AC_DEFINE([_POSIX_C_SOURCE],[200809L],[Enable POSIX]) AC_SUBST([READLINE_LIBS]) AC_SUBST([YAZ_CONF_CFLAGS]) +AC_SUBST([PKGCONFIG_XML]) dnl ------ Checking programs AC_PROG_CC AC_PROG_CPP @@ -338,7 +339,7 @@ if test "$enable_threads" = "yes" -a "$HAVETHREADS" = "0"; then LIBS="$lib $OLIBS" AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include ]], [[ pthread_t id; pthread_join(id, 0); ]])], - [ PTHREAD_LIBS=$lib; break + [ PTHREAD_LIBS=$lib; break ],[]) done LIBS=$OLIBS @@ -357,16 +358,19 @@ YAZ_LIBXML2([ AC_DEFINE([YAZ_HAVE_XML2], [1], [Define to 1 if Libxml2 is present]) YAZ_CONFIG_CFLAGS="$YAZ_CONFIG_CFLAGS -DYAZ_HAVE_XML2=1" xml_enabled=true + PKGCONFIG_XML=libxml-2.0 ]) if test "$xml_enabled" = "true"; then YAZ_LIBXSLT([ AC_DEFINE([YAZ_HAVE_XSLT], [1], [Define to 1 if Libxslt is present]) YAZ_CONFIG_CFLAGS="$YAZ_CONFIG_CFLAGS -DYAZ_HAVE_XSLT=1" + PKGCONFIG_XML=libxslt ]) YAZ_LIBEXSLT([ AC_DEFINE([YAZ_HAVE_EXSLT], [1], [Define to 1 if EXSLT is present]) YAZ_CONFIG_CFLAGS="$YAZ_CONFIG_CFLAGS -DYAZ_HAVE_EXSLT=1" + PKGCONFIG_XML=libexslt ]) fi diff --git a/yaz-icu.pc.in b/yaz-icu.pc.in index 0a668d41..8f2f2503 100644 --- a/yaz-icu.pc.in +++ b/yaz-icu.pc.in @@ -6,6 +6,6 @@ includedir=@includedir@ Name: YAZ ICU Version: @VERSION@ Description: YAZ ICU library for building Z39.50 applications -Requires: yaz libexslt icu-i18n +Requires: yaz icu-i18n Libs: -L${libdir} -lyaz_icu @PTHREAD_LIBS@ Cflags: @ICU_CPPFLAGS@ diff --git a/yaz-server.pc.in b/yaz-server.pc.in index 47911947..3376df18 100644 --- a/yaz-server.pc.in +++ b/yaz-server.pc.in @@ -6,5 +6,5 @@ includedir=@includedir@ Name: YAZ server Version: @VERSION@ Description: YAZ server library for building Z39.50 applications -Requires: yaz libexslt +Requires: yaz Libs: -L${libdir} -lyaz_server @PTHREAD_LIBS@ diff --git a/yaz.pc.in b/yaz.pc.in index 2c016b03..eb4c6a70 100644 --- a/yaz.pc.in +++ b/yaz.pc.in @@ -6,7 +6,7 @@ includedir=@includedir@ Name: YAZ Version: @VERSION@ Description: YAZ library for building Z39.50 applications -Requires: libexslt +Requires: @PKGCONFIG_XML@ Libs: -L${libdir} -lyaz Libs.private: @LIBS@ Cflags: -I${includedir} @YAZ_CONFIG_CFLAGS@