From 90abc3cf170a3d5da8bbc5307cf5032d6af5ed6c Mon Sep 17 00:00:00 2001 From: David Steele Date: Fri, 24 Jan 2020 10:08:05 -0700 Subject: [PATCH] Use pkg-config instead of xml2-config for libxml2 build options. pkg-config is a generic way to get build options rather than relying on a package-specific utility. XML2_CONFIG can be used to override this utility for systems that do not ship pkg-config. --- doc/xml/release.xml | 12 +++ doc/xml/user-guide.xml | 2 +- libc/Makefile.PL | 2 +- src/configure | 75 ++----------------- src/configure.ac | 32 ++------ test/container.yaml | 8 +- .../pgBackRestTest/Common/ContainerTest.pm | 2 +- test/lib/pgBackRestTest/Common/JobTest.pm | 2 +- test/travis.pl | 3 +- 9 files changed, 34 insertions(+), 104 deletions(-) diff --git a/doc/xml/release.xml b/doc/xml/release.xml index 8d4b232be..8587040aa 100644 --- a/doc/xml/release.xml +++ b/doc/xml/release.xml @@ -13,6 +13,18 @@ + + + + + + + + +

Use pkg-config instead of xml2-config for libxml2 build options.

+
+
+
diff --git a/doc/xml/user-guide.xml b/doc/xml/user-guide.xml index 19432dcc8..2cd7d2563 100644 --- a/doc/xml/user-guide.xml +++ b/doc/xml/user-guide.xml @@ -763,7 +763,7 @@ - apt-get install make gcc libpq-dev libssl-dev libxml2-dev + apt-get install make gcc libpq-dev libssl-dev libxml2-dev pkg-config -y 2>&1 diff --git a/libc/Makefile.PL b/libc/Makefile.PL index de6a5ad6e..2a5c7eaa1 100644 --- a/libc/Makefile.PL +++ b/libc/Makefile.PL @@ -131,7 +131,7 @@ WriteMakefile -std=c99 -D_POSIX_C_SOURCE=200112L -D_FILE_OFFSET_BITS=64 - `xml2-config --cflags` + `pkg-config libxml-2.0 --cflags` -I`pg_config --includedir` )), diff --git a/src/configure b/src/configure index ba071d78f..4948f3db6 100755 --- a/src/configure +++ b/src/configure @@ -1324,7 +1324,7 @@ Some influential environment variables: LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory - XML2_CONFIG path to xml2-config utility + XML2_CONFIG path to xml2 config utility CPP C preprocessor Use these variables to override the choices made by `configure' or to help @@ -3009,10 +3009,6 @@ fi -# Wrap AC_PATH_PROGS to check if the value is already set before looking for programs. AC_PATH_PROGS preserves the value only if it -# looks like an absolute path. - - # Enable internal test code and assertions by undefining NDEBUG warning='-Wall -Wextra -Wno-clobbered -Wno-missing-field-initializers' @@ -3202,73 +3198,12 @@ fi # Check required xml library + if test -z "$XML2_CONFIG"; then - for ac_prog in xml2-config -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_XML2_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $XML2_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_XML2_CONFIG="$XML2_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_XML2_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -XML2_CONFIG=$ac_cv_path_XML2_CONFIG -if test -n "$XML2_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XML2_CONFIG" >&5 -$as_echo "$XML2_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + XML2_CONFIG="pkg-config libxml-2.0" fi - - test -n "$XML2_CONFIG" && break -done - -else - # Report the value of XML2_CONFIG in configure's output - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XML2_CONFIG" >&5 -$as_echo_n "checking for XML2_CONFIG... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XML2_CONFIG" >&5 -$as_echo "$XML2_CONFIG" >&6; } -fi - - -if test -n "$XML2_CONFIG"; then - for ac_option in `$XML2_CONFIG --cflags`; do - case $ac_option in - -I*|-D*) CPPFLAGS="$CPPFLAGS $ac_option";; - esac - done - for pgac_option in `$XML2_CONFIG --libs`; do - case $ac_option in - -L*) LDFLAGS="$LDFLAGS $ac_option";; - esac - done -fi +CPPFLAGS="$CPPFLAGS `$XML2_CONFIG --cflags`" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xmlSaveToBuffer in -lxml2" >&5 $as_echo_n "checking for xmlSaveToBuffer in -lxml2... " >&6; } @@ -3722,7 +3657,7 @@ else fi -CLIBRARY="$CLIBRARY `$XML2_CONFIG --cflags`" +CLIBRARY="$CLIBRARY `pkg-config libxml-2.0 --cflags`" # Check required gzip library diff --git a/src/configure.ac b/src/configure.ac index 8a4f5d7f9..188d92c1a 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -6,18 +6,6 @@ AC_CONFIG_SRCDIR([version.h]) # Check compiler AC_PROG_CC_C99 -# Wrap AC_PATH_PROGS to check if the value is already set before looking for programs. AC_PATH_PROGS preserves the value only if it -# looks like an absolute path. -AC_DEFUN([BRAC_PATH_PROGS], -[if test -z "$$1"; then - AC_PATH_PROGS($@) -else - # Report the value of $1 in configure's output - AC_MSG_CHECKING([for $1]) - AC_MSG_RESULT([$$1]) -fi -]) - # Enable internal test code and assertions by undefining NDEBUG warning='-Wall -Wextra -Wno-clobbered -Wno-missing-field-initializers' @@ -54,25 +42,17 @@ AC_CHECK_LIB([crypto], [EVP_get_digestbyname], [], [AC_MSG_ERROR([library 'crypt AC_CHECK_LIB([ssl], [SSL_new], [], [AC_MSG_ERROR([library 'ssl' is required])]) # Check required xml library -BRAC_PATH_PROGS(XML2_CONFIG, [xml2-config]) -AC_ARG_VAR(XML2_CONFIG, [path to xml2-config utility])dnl +AC_ARG_VAR(XML2_CONFIG, [path to xml2 config utility])dnl -if test -n "$XML2_CONFIG"; then - for ac_option in `$XML2_CONFIG --cflags`; do - case $ac_option in - -I*|-D*) CPPFLAGS="$CPPFLAGS $ac_option";; - esac - done - for pgac_option in `$XML2_CONFIG --libs`; do - case $ac_option in - -L*) LDFLAGS="$LDFLAGS $ac_option";; - esac - done +if test -z "$XML2_CONFIG"; then + XML2_CONFIG="pkg-config libxml-2.0" fi +CPPFLAGS="$CPPFLAGS `$XML2_CONFIG --cflags`" + AC_CHECK_LIB([xml2], [xmlSaveToBuffer], [], [AC_MSG_ERROR([library 'xml2' is required])]) AC_CHECK_HEADER(libxml/parser.h, [], [AC_MSG_ERROR([header file is required])]) -AC_SUBST(CLIBRARY, "$CLIBRARY `$XML2_CONFIG --cflags`") +AC_SUBST(CLIBRARY, "$CLIBRARY `pkg-config libxml-2.0 --cflags`") # Check required gzip library AC_CHECK_LIB([z], [deflate], [], [AC_MSG_ERROR([library 'z' is required])]) diff --git a/test/container.yaml b/test/container.yaml index e2a62c134..635b16191 100644 --- a/test/container.yaml +++ b/test/container.yaml @@ -12,10 +12,12 @@ # - docker login -u pgbackrest # - VM=XXX;DATE=YYYYMMDDX;BASE=pgbackrest/test:${VM?}-base;docker tag ${BASE?} ${BASE?}-${DATE?} && docker push ${BASE?}-${DATE?} # ********************************************************************************************************************************** +20200124A: + u12: 0f2fcf1bc79ee35e78121773c9a2155a77cb10d5 + u18: e0d670be1f7167152748e36832081b5b09aabc70 + u19: 9d057b1081efedfce0f7ba38092b867a125fde37 + 20191122A: f30: 3a60318c275cdbfa6daa0f2b502a5551562e6db6 co6: 63527115fd269dfee74bda70da8a5b0569f94886 co7: 0b4c4b953709dc086f95fcc5c8ca45dee1a5eee9 - u12: 333122fe71a766b78398a1e86bafd1d8703fef1f - u18: c4dd9d5586eb67d77dfa6e0b89c5ebf9e27820a4 - u19: e68f7b969d12c2c43b47a83053a5241092c28524 diff --git a/test/lib/pgBackRestTest/Common/ContainerTest.pm b/test/lib/pgBackRestTest/Common/ContainerTest.pm index 3b51d3e5a..aa5ac55be 100755 --- a/test/lib/pgBackRestTest/Common/ContainerTest.pm +++ b/test/lib/pgBackRestTest/Common/ContainerTest.pm @@ -380,7 +380,7 @@ sub containerBuild " apt-get -y install openssh-server wget sudo gcc make valgrind git \\\n" . " libdbd-pg-perl libhtml-parser-perl libssl-dev libperl-dev \\\n" . " libyaml-libyaml-perl tzdata devscripts lintian libxml-checker-perl txt2man debhelper \\\n" . - " libppi-html-perl libtemplate-perl libtest-differences-perl zlib1g-dev libxml2-dev"; + " libppi-html-perl libtemplate-perl libtest-differences-perl zlib1g-dev libxml2-dev pkg-config"; if ($strOS eq VM_U12) { diff --git a/test/lib/pgBackRestTest/Common/JobTest.pm b/test/lib/pgBackRestTest/Common/JobTest.pm index f00f21624..27618c549 100644 --- a/test/lib/pgBackRestTest/Common/JobTest.pm +++ b/test/lib/pgBackRestTest/Common/JobTest.pm @@ -454,7 +454,7 @@ sub run # Flags that are common to all builds my $strCommonFlags = '-I. -Itest -std=c99 -fPIC -g -Wno-clobbered -D_POSIX_C_SOURCE=200809L -D_FILE_OFFSET_BITS=64' . - ' `xml2-config --cflags`' . ($self->{bProfile} ? " -pg" : '') . + ' `pkg-config libxml-2.0 --cflags`' . ($self->{bProfile} ? " -pg" : '') . ' -I`pg_config --includedir`' . ($self->{oTest}->{&TEST_DEBUG_UNIT_SUPPRESS} ? '' : " -DDEBUG_UNIT") . (vmWithBackTrace($self->{oTest}->{&TEST_VM}) && $self->{bBackTrace} ? ' -DWITH_BACKTRACE' : '') . diff --git a/test/travis.pl b/test/travis.pl index dd92fef49..244ed052a 100755 --- a/test/travis.pl +++ b/test/travis.pl @@ -132,7 +132,8 @@ eval processBegin('install common packages'); processExec('sudo apt-get -qq update', {bSuppressStdErr => true, bSuppressError => true}); processExec( - 'sudo apt-get install -y rsync zlib1g-dev libssl-dev libxml2-dev libpq-dev libxml-checker-perl libyaml-libyaml-perl', + 'sudo apt-get install -y rsync zlib1g-dev libssl-dev libxml2-dev libpq-dev libxml-checker-perl libyaml-libyaml-perl' . + ' pkg-config', {bSuppressStdErr => true}); processEnd();