Hi Konstantin!

On 1/31/23 01:52, Konstantin Pavlov wrote:
details:   https://hg.nginx.org/njs/rev/c789bb7313d4
branches:
changeset: 2030:c789bb7313d4
user:      Konstantin Pavlov <thr...@nginx.com>
date:      Fri Jan 27 15:10:57 2023 -0800
description:
Added pkg-config-based libxml2 detection.

diffstat:

  auto/libxml2 |  26 +++++++++++++++++++++-----
  1 files changed, 21 insertions(+), 5 deletions(-)

diffs (45 lines):

diff -r b0f3bc578f08 -r c789bb7313d4 auto/libxml2
--- a/auto/libxml2      Fri Jan 27 15:08:41 2023 -0800
+++ b/auto/libxml2      Fri Jan 27 15:10:57 2023 -0800
@@ -6,12 +6,8 @@ NJS_HAVE_LIBXML2=NO
if [ $NJS_LIBXML2 = YES ]; then
      njs_found=no
-
-    njs_feature="libxml2"
      njs_feature_name=NJS_HAVE_LIBXML2
      njs_feature_run=no
-    njs_feature_incs="/usr/include/libxml2"
-    njs_feature_libs="-lxml2"
      njs_feature_test="#include <libxml/parser.h>
                        #include <libxml/tree.h>
@@ -22,7 +18,27 @@ if [ $NJS_LIBXML2 = YES ]; then
                            xmlCleanupParser();
                            return 0;
                        }"
-    . auto/feature
+
+
+    if /bin/sh -c "(pkg-config libxml-2.0 --exists)" >> $NJS_AUTOCONF_ERR 
2>&1; then
+
+        # pkg-config
+
+        njs_feature="libxml2 via pkg-config"
+        njs_feature_incs=`pkg-config libxml-2.0 --cflags | sed -n -e 's/.*-I 
*\([^ ][^ ]*\).*/\1/p'`

I think you want -‐cflags‐only‐I
I'm not sure if it has any portability issues to old versions of pkg-config 
maybe?

Cheers,

Alex

+        njs_feature_libs=`pkg-config libxml-2.0 --libs`
+
+        . auto/feature
+    fi
+
+    if [ $njs_found = no ]; then
+
+        njs_feature="libxml2"
+        njs_feature_incs="/usr/include/libxml2"
+        njs_feature_libs="-lxml2"
+
+        . auto/feature
+    fi
if [ $njs_found = no ]; then _______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx-devel

--
<http://www.alejandro-colomar.es/>

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx-devel

Reply via email to