From: Konstantin Pavlov Date: Fri, 27 Jan 2023 23:10:57 +0000 (-0800) Subject: Added pkg-config-based libxml2 detection. X-Git-Tag: 0.7.10~12 X-Git-Url: http://www.kaiwu.me/postgresql/commit/?a=commitdiff_plain;h=82725ba5b11ada02acfa2658e207ba38e7ef910d;p=njs.git Added pkg-config-based libxml2 detection. --- diff --git a/auto/libxml2 b/auto/libxml2 index e2410731..d3352e36 100644 --- a/auto/libxml2 +++ b/auto/libxml2 @@ -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 #include @@ -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'` + 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