From 7f792d2acc0d3eeb95c6f8e0acd72ae304cec9be Mon Sep 17 00:00:00 2001 Message-Id: <7f792d2acc0d3eeb95c6f8e0acd72ae304cec9be.1692813549.git.mirai@makinata.eu> From: Jonathan Wakely Date: Wed, 27 Feb 2019 11:25:44 +0000 Subject: [PATCH] PR libstdc++/89466 avoid slow xsltproc command in configure Note: Backported from a4395a846a9343960714568e7cf8af4425e63a50. Certain broken versions of xsltproc ignore the --nonet option and will attempt to fetch the docbook stylesheet from the WWW when it isn't in the local XML catalog. This patch checks for the local stylesheet directory first, and doesn't use xsltproc if no local stylesheets are found. Checking for the local directory is done using xmlcatalog if available, only checking the hardcoded list of directories if xmlcatalog fails. The right directory for Suse is added to the hardcoded list. This should avoid doing an xsltproc check that would need to download the stylesheet, so no network connection is made even if a broken xsltproc is present. PR libstdc++/89466 * acinclude.m4 (GLIBCXX_CONFIGURE_DOCBOOK): Reorder check for local stylesheet directories before check for xsltproc. Try to use xmlcatalog to find local stylesheet directory before trying hardcoded paths. Add path used by suse to hardcoded paths. Adjust xsltproc check to look for the same stylesheet as doc/Makefile.am uses. Don't use xsltproc if xmlcatalog fails to find a local stylesheet. * configure.ac: Check for xmlcatalog. * Makefile.in: Regenerate. * configure: Likewise. * doc/Makefile.in: Likewise. * include/Makefile.in: Likewise. * libsupc++/Makefile.in: Likewise. * po/Makefile.in: Likewise. * python/Makefile.in: Likewise. * src/Makefile.in: Likewise. * src/c++11/Makefile.in: Likewise. * src/c++98/Makefile.in: Likewise. * src/filesystem/Makefile.in: Likewise. * testsuite/Makefile.in: Likewise. From-SVN: r269249 Modified-by: Bruno Victal --- libstdc++-v3/Makefile.in | 1 + libstdc++-v3/acinclude.m4 | 47 +++++++------ libstdc++-v3/configure | 90 +++++++++++++++++++------ libstdc++-v3/configure.ac | 1 + libstdc++-v3/doc/Makefile.in | 1 + libstdc++-v3/include/Makefile.in | 1 + libstdc++-v3/libsupc++/Makefile.in | 1 + libstdc++-v3/po/Makefile.in | 1 + libstdc++-v3/python/Makefile.in | 1 + libstdc++-v3/src/Makefile.in | 1 + libstdc++-v3/src/c++11/Makefile.in | 1 + libstdc++-v3/src/c++98/Makefile.in | 1 + libstdc++-v3/src/filesystem/Makefile.in | 1 + libstdc++-v3/testsuite/Makefile.in | 1 + 14 files changed, 109 insertions(+), 40 deletions(-) diff --git a/libstdc++-v3/Makefile.in b/libstdc++-v3/Makefile.in index a9451e19a96..6aee8281f77 100644 --- a/libstdc++-v3/Makefile.in +++ b/libstdc++-v3/Makefile.in @@ -230,6 +230,7 @@ VTV_CXXLINKFLAGS = @VTV_CXXLINKFLAGS@ VTV_PCH_CXXFLAGS = @VTV_PCH_CXXFLAGS@ WARN_FLAGS = @WARN_FLAGS@ WERROR = @WERROR@ +XMLCATALOG = @XMLCATALOG@ XMLLINT = @XMLLINT@ XSLTPROC = @XSLTPROC@ XSL_STYLE_DIR = @XSL_STYLE_DIR@ diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index 18b7b6638ec..fde3fb6da6e 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -674,34 +674,43 @@ dnl XSL_STYLE_DIR dnl AC_DEFUN([GLIBCXX_CONFIGURE_DOCBOOK], [ -AC_MSG_CHECKING([for docbook stylesheets for documentation creation]) -glibcxx_stylesheets=no -if test x${XSLTPROC} = xyes && echo '' | xsltproc --noout --nonet --xinclude http://docbook.sourceforge.net/release/xsl-ns/current/xhtml-1_1/docbook.xsl - 2>/dev/null; then - glibcxx_stylesheets=yes -fi -AC_MSG_RESULT($glibcxx_stylesheets) +glibcxx_docbook_url=http://docbook.sourceforge.net/release/xsl-ns/current/ AC_MSG_CHECKING([for local stylesheet directory]) glibcxx_local_stylesheets=no -if test x"$glibcxx_stylesheets" = x"yes"; then - if test -d /usr/share/sgml/docbook/xsl-ns-stylesheets; then - glibcxx_local_stylesheets=yes - XSL_STYLE_DIR=/usr/share/sgml/docbook/xsl-ns-stylesheets - fi - if test -d /usr/share/xml/docbook/stylesheet/docbook-xsl-ns; then - glibcxx_local_stylesheets=yes - XSL_STYLE_DIR=/usr/share/xml/docbook/stylesheet/docbook-xsl-ns - fi - if test -d /usr/share/xml/docbook/stylesheet/nwalsh5/current; then - glibcxx_local_stylesheets=yes - XSL_STYLE_DIR=/usr/share/xml/docbook/stylesheet/nwalsh5/current - fi +if test x${XMLCATALOG} = xyes && xsl_style_dir=`xmlcatalog "" $glibcxx_docbook_url 2>/dev/null` +then + XSL_STYLE_DIR=`echo $xsl_style_dir | sed -n 's;^file://;;p'` + glibcxx_local_stylesheets=yes +else + for dir in \ + /usr/share/sgml/docbook/xsl-ns-stylesheets \ + /usr/share/xml/docbook/stylesheet/docbook-xsl-ns \ + /usr/share/xml/docbook/stylesheet/nwalsh5/current \ + /usr/share/xml/docbook/stylesheet/nwalsh/current + do + if test -d $dir; then + glibcxx_local_stylesheets=yes + XSL_STYLE_DIR=$dir + break + fi + done fi AC_MSG_RESULT($glibcxx_local_stylesheets) if test x"$glibcxx_local_stylesheets" = x"yes"; then AC_SUBST(XSL_STYLE_DIR) AC_MSG_NOTICE($XSL_STYLE_DIR) + + AC_MSG_CHECKING([for docbook stylesheets for documentation creation]) + glibcxx_stylesheets=no + if test x${XMLCATALOG} = xno || xmlcatalog "" $glibcxx_docbook_url/xhtml/docbook.xsl >/dev/null 2>&1; then + if test x${XSLTPROC} = xyes && echo '<title/>' | xsltproc --noout --nonet --xinclude $glibcxx_docbook_url/xhtml/docbook.xsl - 2>/dev/null; then + glibcxx_stylesheets=yes + fi + fi + AC_MSG_RESULT($glibcxx_stylesheets) + else glibcxx_stylesheets=no fi diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index a51dfe6eb13..0c462490b81 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -634,6 +634,7 @@ BUILD_EPUB_TRUE XSL_STYLE_DIR XMLLINT XSLTPROC +XMLCATALOG DOT DOXYGEN BUILD_INFO_FALSE @@ -79678,6 +79679,44 @@ fi # Check for docbook +# Extract the first word of "xmlcatalog", so it can be a program name with args. +set dummy xmlcatalog; 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_prog_XMLCATALOG+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$XMLCATALOG"; then + ac_cv_prog_XMLCATALOG="$XMLCATALOG" # Let the user override the test. +else +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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_XMLCATALOG="yes" + $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 + + test -z "$ac_cv_prog_XMLCATALOG" && ac_cv_prog_XMLCATALOG="no" +fi +fi +XMLCATALOG=$ac_cv_prog_XMLCATALOG +if test -n "$XMLCATALOG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XMLCATALOG" >&5 +$as_echo "$XMLCATALOG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + # Extract the first word of "xsltproc", so it can be a program name with args. set dummy xsltproc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 @@ -79756,31 +79795,28 @@ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for docbook stylesheets for documentation creation" >&5 -$as_echo_n "checking for docbook stylesheets for documentation creation... " >&6; } -glibcxx_stylesheets=no -if test x${XSLTPROC} = xyes && echo '<title/>' | xsltproc --noout --nonet --xinclude http://docbook.sourceforge.net/release/xsl-ns/current/xhtml-1_1/docbook.xsl - 2>/dev/null; then - glibcxx_stylesheets=yes -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_stylesheets" >&5 -$as_echo "$glibcxx_stylesheets" >&6; } +glibcxx_docbook_url=http://docbook.sourceforge.net/release/xsl-ns/current/ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for local stylesheet directory" >&5 $as_echo_n "checking for local stylesheet directory... " >&6; } glibcxx_local_stylesheets=no -if test x"$glibcxx_stylesheets" = x"yes"; then - if test -d /usr/share/sgml/docbook/xsl-ns-stylesheets; then - glibcxx_local_stylesheets=yes - XSL_STYLE_DIR=/usr/share/sgml/docbook/xsl-ns-stylesheets - fi - if test -d /usr/share/xml/docbook/stylesheet/docbook-xsl-ns; then - glibcxx_local_stylesheets=yes - XSL_STYLE_DIR=/usr/share/xml/docbook/stylesheet/docbook-xsl-ns - fi - if test -d /usr/share/xml/docbook/stylesheet/nwalsh5/current; then - glibcxx_local_stylesheets=yes - XSL_STYLE_DIR=/usr/share/xml/docbook/stylesheet/nwalsh5/current - fi +if test x${XMLCATALOG} = xyes && xsl_style_dir=`xmlcatalog "" $glibcxx_docbook_url 2>/dev/null` +then + XSL_STYLE_DIR=`echo $xsl_style_dir | sed -n 's;^file://;;p'` + glibcxx_local_stylesheets=yes +else + for dir in \ + /usr/share/sgml/docbook/xsl-ns-stylesheets \ + /usr/share/xml/docbook/stylesheet/docbook-xsl-ns \ + /usr/share/xml/docbook/stylesheet/nwalsh5/current \ + /usr/share/xml/docbook/stylesheet/nwalsh/current + do + if test -d $dir; then + glibcxx_local_stylesheets=yes + XSL_STYLE_DIR=$dir + break + fi + done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_local_stylesheets" >&5 $as_echo "$glibcxx_local_stylesheets" >&6; } @@ -79789,6 +79825,18 @@ if test x"$glibcxx_local_stylesheets" = x"yes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: $XSL_STYLE_DIR" >&5 $as_echo "$as_me: $XSL_STYLE_DIR" >&6;} + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for docbook stylesheets for documentation creation" >&5 +$as_echo_n "checking for docbook stylesheets for documentation creation... " >&6; } + glibcxx_stylesheets=no + if test x${XMLCATALOG} = xno || xmlcatalog "" $glibcxx_docbook_url/xhtml/docbook.xsl >/dev/null 2>&1; then + if test x${XSLTPROC} = xyes && echo '<title/>' | xsltproc --noout --nonet --xinclude $glibcxx_docbook_url/xhtml/docbook.xsl - 2>/dev/null; then + glibcxx_stylesheets=yes + fi + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_stylesheets" >&5 +$as_echo "$glibcxx_stylesheets" >&6; } + else glibcxx_stylesheets=no fi diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac index 580fb8b2eb8..92a18b88135 100644 --- a/libstdc++-v3/configure.ac +++ b/libstdc++-v3/configure.ac @@ -422,6 +422,7 @@ AC_CHECK_PROG([DOXYGEN], doxygen, yes, no) AC_CHECK_PROG([DOT], dot, yes, no) # Check for docbook +AC_CHECK_PROG([XMLCATALOG], xmlcatalog, yes, no) AC_CHECK_PROG([XSLTPROC], xsltproc, yes, no) AC_CHECK_PROG([XMLLINT], xmllint, yes, no) GLIBCXX_CONFIGURE_DOCBOOK diff --git a/libstdc++-v3/doc/Makefile.in b/libstdc++-v3/doc/Makefile.in index 4690fad8ac6..522a96c681d 100644 --- a/libstdc++-v3/doc/Makefile.in +++ b/libstdc++-v3/doc/Makefile.in @@ -202,6 +202,7 @@ VTV_CXXLINKFLAGS = @VTV_CXXLINKFLAGS@ VTV_PCH_CXXFLAGS = @VTV_PCH_CXXFLAGS@ WARN_FLAGS = @WARN_FLAGS@ WERROR = @WERROR@ +XMLCATALOG = @XMLCATALOG@ # Validate existing XML structure. XMLLINT = xmllint diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in index 591301add5f..c28b1f4504f 100644 --- a/libstdc++-v3/include/Makefile.in +++ b/libstdc++-v3/include/Makefile.in @@ -202,6 +202,7 @@ VTV_CXXLINKFLAGS = @VTV_CXXLINKFLAGS@ VTV_PCH_CXXFLAGS = @VTV_PCH_CXXFLAGS@ WARN_FLAGS = @WARN_FLAGS@ WERROR = @WERROR@ +XMLCATALOG = @XMLCATALOG@ XMLLINT = @XMLLINT@ XSLTPROC = @XSLTPROC@ XSL_STYLE_DIR = @XSL_STYLE_DIR@ diff --git a/libstdc++-v3/libsupc++/Makefile.in b/libstdc++-v3/libsupc++/Makefile.in index 8f627c6bcd3..5f63c6c0f72 100644 --- a/libstdc++-v3/libsupc++/Makefile.in +++ b/libstdc++-v3/libsupc++/Makefile.in @@ -273,6 +273,7 @@ VTV_CXXLINKFLAGS = @VTV_CXXLINKFLAGS@ VTV_PCH_CXXFLAGS = @VTV_PCH_CXXFLAGS@ WARN_FLAGS = @WARN_FLAGS@ WERROR = @WERROR@ +XMLCATALOG = @XMLCATALOG@ XMLLINT = @XMLLINT@ XSLTPROC = @XSLTPROC@ XSL_STYLE_DIR = @XSL_STYLE_DIR@ diff --git a/libstdc++-v3/po/Makefile.in b/libstdc++-v3/po/Makefile.in index 5bcf4da7fa5..cabd3f3368c 100644 --- a/libstdc++-v3/po/Makefile.in +++ b/libstdc++-v3/po/Makefile.in @@ -202,6 +202,7 @@ VTV_CXXLINKFLAGS = @VTV_CXXLINKFLAGS@ VTV_PCH_CXXFLAGS = @VTV_PCH_CXXFLAGS@ WARN_FLAGS = @WARN_FLAGS@ WERROR = @WERROR@ +XMLCATALOG = @XMLCATALOG@ XMLLINT = @XMLLINT@ XSLTPROC = @XSLTPROC@ XSL_STYLE_DIR = @XSL_STYLE_DIR@ diff --git a/libstdc++-v3/python/Makefile.in b/libstdc++-v3/python/Makefile.in index 26eb2abfb19..c1f46c02ea1 100644 --- a/libstdc++-v3/python/Makefile.in +++ b/libstdc++-v3/python/Makefile.in @@ -232,6 +232,7 @@ VTV_CXXLINKFLAGS = @VTV_CXXLINKFLAGS@ VTV_PCH_CXXFLAGS = @VTV_PCH_CXXFLAGS@ WARN_FLAGS = @WARN_FLAGS@ WERROR = @WERROR@ +XMLCATALOG = @XMLCATALOG@ XMLLINT = @XMLLINT@ XSLTPROC = @XSLTPROC@ XSL_STYLE_DIR = @XSL_STYLE_DIR@ diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in index 5221a5d5c29..e0c7bab1e78 100644 --- a/libstdc++-v3/src/Makefile.in +++ b/libstdc++-v3/src/Makefile.in @@ -265,6 +265,7 @@ VTV_CXXLINKFLAGS = @VTV_CXXLINKFLAGS@ VTV_PCH_CXXFLAGS = @VTV_PCH_CXXFLAGS@ WARN_FLAGS = @WARN_FLAGS@ WERROR = @WERROR@ +XMLCATALOG = @XMLCATALOG@ XMLLINT = @XMLLINT@ XSLTPROC = @XSLTPROC@ XSL_STYLE_DIR = @XSL_STYLE_DIR@ diff --git a/libstdc++-v3/src/c++11/Makefile.in b/libstdc++-v3/src/c++11/Makefile.in index 4f92d71d19c..88a2dd5c7a0 100644 --- a/libstdc++-v3/src/c++11/Makefile.in +++ b/libstdc++-v3/src/c++11/Makefile.in @@ -235,6 +235,7 @@ VTV_CXXLINKFLAGS = @VTV_CXXLINKFLAGS@ VTV_PCH_CXXFLAGS = @VTV_PCH_CXXFLAGS@ WARN_FLAGS = @WARN_FLAGS@ WERROR = @WERROR@ +XMLCATALOG = @XMLCATALOG@ XMLLINT = @XMLLINT@ XSLTPROC = @XSLTPROC@ XSL_STYLE_DIR = @XSL_STYLE_DIR@ diff --git a/libstdc++-v3/src/c++98/Makefile.in b/libstdc++-v3/src/c++98/Makefile.in index 8dca17f360e..58ea47a9db6 100644 --- a/libstdc++-v3/src/c++98/Makefile.in +++ b/libstdc++-v3/src/c++98/Makefile.in @@ -236,6 +236,7 @@ VTV_CXXLINKFLAGS = @VTV_CXXLINKFLAGS@ VTV_PCH_CXXFLAGS = @VTV_PCH_CXXFLAGS@ WARN_FLAGS = @WARN_FLAGS@ WERROR = @WERROR@ +XMLCATALOG = @XMLCATALOG@ XMLLINT = @XMLLINT@ XSLTPROC = @XSLTPROC@ XSL_STYLE_DIR = @XSL_STYLE_DIR@ diff --git a/libstdc++-v3/src/filesystem/Makefile.in b/libstdc++-v3/src/filesystem/Makefile.in index f8f0180f9ba..c7c997686cb 100644 --- a/libstdc++-v3/src/filesystem/Makefile.in +++ b/libstdc++-v3/src/filesystem/Makefile.in @@ -244,6 +244,7 @@ VTV_CXXLINKFLAGS = @VTV_CXXLINKFLAGS@ VTV_PCH_CXXFLAGS = @VTV_PCH_CXXFLAGS@ WARN_FLAGS = @WARN_FLAGS@ WERROR = @WERROR@ +XMLCATALOG = @XMLCATALOG@ XMLLINT = @XMLLINT@ XSLTPROC = @XSLTPROC@ XSL_STYLE_DIR = @XSL_STYLE_DIR@ diff --git a/libstdc++-v3/testsuite/Makefile.in b/libstdc++-v3/testsuite/Makefile.in index 4f67a37966d..d7417fe5a1f 100644 --- a/libstdc++-v3/testsuite/Makefile.in +++ b/libstdc++-v3/testsuite/Makefile.in @@ -202,6 +202,7 @@ VTV_CXXLINKFLAGS = @VTV_CXXLINKFLAGS@ VTV_PCH_CXXFLAGS = @VTV_PCH_CXXFLAGS@ WARN_FLAGS = @WARN_FLAGS@ WERROR = @WERROR@ +XMLCATALOG = @XMLCATALOG@ XMLLINT = @XMLLINT@ XSLTPROC = @XSLTPROC@ XSL_STYLE_DIR = @XSL_STYLE_DIR@ -- 2.40.1