From 4bde407b3c7c0b75b420f49fb3d8ce1d347fef7e Mon Sep 17 00:00:00 2001 From: Thomas Kuehne Date: Dec 11 2021 20:29:46 +0000 Subject: [PATCH 1/7] rename configure.in to configure.ac Fix: autoupdate-2.71: warning: autoconf input should be named 'configure.ac', not 'configure.in' Signed-off-by: Thomas Kuehne (cherry picked from commit 6e4e5bc1c7285e77df837d4b0c3e5a82779df778) --- diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..8352663 --- /dev/null +++ b/configure.ac @@ -0,0 +1,162 @@ +AC_INIT(xmlto, 0.0.28) +AC_CONFIG_SRCDIR(xmlto.spec.in) +AM_INIT_AUTOMAKE([dist-bzip2 subdir-objects 1.6]) +AC_CONFIG_HEADERS(config.h) + +AC_PROG_CC +AM_PROG_CC_C_O +AM_PROG_LEX + + +dnl +dnl tools +dnl + +AC_ARG_VAR([MKTEMP], [Name of the `mktemp' program.]) +AC_CHECK_PROG([MKTEMP], [mktemp],, [mktemp]) + +AC_ARG_VAR([FIND], [Name of the GNU `find' program.]) +AC_CHECK_PROG([FIND], [find],, [find] ) + +AC_ARG_VAR([BASH], [Name and path of the GNU `bash' shell.]) +AC_PATH_PROG([BASH], [bash], [/bin/bash]) + +AC_ARG_VAR([GETOPT], [Name of the `getopt' program (requires longopt support).]) +AC_CHECK_PROG([GETOPT], [getopt],, [getopt]) + +AC_MSG_CHECKING([for long options support in $GETOPT]) +opts=`$GETOPT --longoptions=help x -x` +if test x"$opts" != x" -x --"; then + AC_MSG_RESULT([no]) + AC_MSG_ERROR([ +You need getopt from , or +else some other implementation that supports --longoptions. +]) +fi +AC_MSG_RESULT([yes]) + +AC_ARG_VAR([PAPER_CONF], [Name and path of the `paperconf' (libpaper) program.]) +AC_PATH_PROG([PAPER_CONF], [paperconf], [paperconf]) + +AC_ARG_VAR([LOCALE], [Name and path of the `locale' program.]) +AC_PATH_PROG([LOCALE], [locale], [locale]) + +AC_ARG_VAR([XMLLINT], [Name and path of the `xmllint' program.]) +AC_PATH_PROG([XMLLINT], [xmllint], [xmllint]) + +AC_ARG_VAR([XSLTPROC], [Name and path of the `xsltproc' program.]) +AC_PATH_PROG([XSLTPROC], [xsltproc], [xsltproc]) + +dnl +dnl toolchains +dnl + +AC_ARG_VAR([DBLATEX], [Name and path of the `dblatex' utility.]) +AC_PATH_PROG([DBLATEX], [dblatex], [dblatex]) + +AC_ARG_VAR([FOP], [Name and path of the `fop' utility.]) +AC_PATH_PROG([FOP], [fop], [fop]) + +AC_ARG_VAR([XMLTEX], [Name and path of the `xmltex' utility.]) +AC_PATH_PROG([XMLTEX], [xmltex], [xmltex]) + +AC_ARG_VAR([PDFXMLTEX], [Name and path of the `pdfxmltex' utility.]) +AC_PATH_PROG([PDFXMLTEX], [pdfxmltex], [pdfxmltex]) + +dnl +dnl default backend +dnl + +AC_ARG_WITH( + [backend], + AC_HELP_STRING( + [--with-backend=@<:@passivetex|fop|dblatex@:>@], + [The default processing backend @<:@default=DEFAULT@:>@] + ), + [ + case "x$withval" in + xfop) + BACKEND="FOP" + ;; + xdblatex) + BACKEND="DBLATEX" + ;; + *) + BACKEND="DEFAULT" + ;; + esac + ], + [BACKEND="DEFAULT"] +) + +AC_MSG_CHECKING([for default backend]) +AC_MSG_RESULT([$BACKEND]) +AC_SUBST([BACKEND]) + +dnl +dnl web browsers +dnl + +AC_ARG_VAR([LYNX], [Name and path of the `lynx' browser.]) +AC_PATH_PROG([LYNX], [lynx], [lynx]) + +AC_ARG_VAR([LINKS], [Name and path of the `elinks' browser.]) +AC_PATH_PROG([LINKS], [elinks], [elinks]) + +AC_ARG_VAR([W3M], [Name and path of the `w3m' browser.]) +AC_PATH_PROG([W3M], [w3m], [w3m]) + +AC_ARG_VAR([TAIL], [Name and path of a tail binary that supports -n.]) +AC_PATH_PROG([TAIL], [tail], [tail]) + +AC_ARG_VAR([GREP], [Name and path of a GNU grep binary.]) +AC_PATH_PROG([GREP], [grep], [grep]) + +AC_ARG_VAR([SED], [Name and path of a GNU sed binary.]) +AC_PATH_PROG([SED], [sed], [sed]) + +AC_ARG_VAR([GCP], [Name and path of a GNU cp binary (need at least -P)]) +AC_PATH_PROG([GCP], [cp], [cp]) + +AC_ARG_VAR([ZIP], [Name and path of a zip binary (compatible with PKZIP)]) +AC_PATH_PROG([ZIP], [zip], [zip]) + +dnl +dnl default webrowser +dnl + +AC_ARG_WITH( + [webbrowser], + AC_HELP_STRING( + [--with-webbrowser=@<:@w3m|lynx|links|any@:>@], + [The default processing backend @<:@default=w3m@:>@] + ), + [ + case "x$withval" in + xlinks) + WEBBROWSER="links" + ;; + xlynx) + WEBBROWSER="lynx" + ;; + xany) + WEBBROWSER="text-www-browser" + ;; + *) + WEBBROWSER="w3m" + ;; + esac + ], + [WEBBROWSER="w3m"] +) + +AC_MSG_CHECKING([for default web browser]) +AC_MSG_RESULT([$WEBBROWSER]) +AC_SUBST([WEBBROWSER]) + +dnl +dnl done +dnl + +AC_CONFIG_FILES([Makefile xmlto xmlto.spec]) +AC_OUTPUT diff --git a/configure.in b/configure.in deleted file mode 100644 index 8352663..0000000 --- a/configure.in +++ /dev/null @@ -1,162 +0,0 @@ -AC_INIT(xmlto, 0.0.28) -AC_CONFIG_SRCDIR(xmlto.spec.in) -AM_INIT_AUTOMAKE([dist-bzip2 subdir-objects 1.6]) -AC_CONFIG_HEADERS(config.h) - -AC_PROG_CC -AM_PROG_CC_C_O -AM_PROG_LEX - - -dnl -dnl tools -dnl - -AC_ARG_VAR([MKTEMP], [Name of the `mktemp' program.]) -AC_CHECK_PROG([MKTEMP], [mktemp],, [mktemp]) - -AC_ARG_VAR([FIND], [Name of the GNU `find' program.]) -AC_CHECK_PROG([FIND], [find],, [find] ) - -AC_ARG_VAR([BASH], [Name and path of the GNU `bash' shell.]) -AC_PATH_PROG([BASH], [bash], [/bin/bash]) - -AC_ARG_VAR([GETOPT], [Name of the `getopt' program (requires longopt support).]) -AC_CHECK_PROG([GETOPT], [getopt],, [getopt]) - -AC_MSG_CHECKING([for long options support in $GETOPT]) -opts=`$GETOPT --longoptions=help x -x` -if test x"$opts" != x" -x --"; then - AC_MSG_RESULT([no]) - AC_MSG_ERROR([ -You need getopt from , or -else some other implementation that supports --longoptions. -]) -fi -AC_MSG_RESULT([yes]) - -AC_ARG_VAR([PAPER_CONF], [Name and path of the `paperconf' (libpaper) program.]) -AC_PATH_PROG([PAPER_CONF], [paperconf], [paperconf]) - -AC_ARG_VAR([LOCALE], [Name and path of the `locale' program.]) -AC_PATH_PROG([LOCALE], [locale], [locale]) - -AC_ARG_VAR([XMLLINT], [Name and path of the `xmllint' program.]) -AC_PATH_PROG([XMLLINT], [xmllint], [xmllint]) - -AC_ARG_VAR([XSLTPROC], [Name and path of the `xsltproc' program.]) -AC_PATH_PROG([XSLTPROC], [xsltproc], [xsltproc]) - -dnl -dnl toolchains -dnl - -AC_ARG_VAR([DBLATEX], [Name and path of the `dblatex' utility.]) -AC_PATH_PROG([DBLATEX], [dblatex], [dblatex]) - -AC_ARG_VAR([FOP], [Name and path of the `fop' utility.]) -AC_PATH_PROG([FOP], [fop], [fop]) - -AC_ARG_VAR([XMLTEX], [Name and path of the `xmltex' utility.]) -AC_PATH_PROG([XMLTEX], [xmltex], [xmltex]) - -AC_ARG_VAR([PDFXMLTEX], [Name and path of the `pdfxmltex' utility.]) -AC_PATH_PROG([PDFXMLTEX], [pdfxmltex], [pdfxmltex]) - -dnl -dnl default backend -dnl - -AC_ARG_WITH( - [backend], - AC_HELP_STRING( - [--with-backend=@<:@passivetex|fop|dblatex@:>@], - [The default processing backend @<:@default=DEFAULT@:>@] - ), - [ - case "x$withval" in - xfop) - BACKEND="FOP" - ;; - xdblatex) - BACKEND="DBLATEX" - ;; - *) - BACKEND="DEFAULT" - ;; - esac - ], - [BACKEND="DEFAULT"] -) - -AC_MSG_CHECKING([for default backend]) -AC_MSG_RESULT([$BACKEND]) -AC_SUBST([BACKEND]) - -dnl -dnl web browsers -dnl - -AC_ARG_VAR([LYNX], [Name and path of the `lynx' browser.]) -AC_PATH_PROG([LYNX], [lynx], [lynx]) - -AC_ARG_VAR([LINKS], [Name and path of the `elinks' browser.]) -AC_PATH_PROG([LINKS], [elinks], [elinks]) - -AC_ARG_VAR([W3M], [Name and path of the `w3m' browser.]) -AC_PATH_PROG([W3M], [w3m], [w3m]) - -AC_ARG_VAR([TAIL], [Name and path of a tail binary that supports -n.]) -AC_PATH_PROG([TAIL], [tail], [tail]) - -AC_ARG_VAR([GREP], [Name and path of a GNU grep binary.]) -AC_PATH_PROG([GREP], [grep], [grep]) - -AC_ARG_VAR([SED], [Name and path of a GNU sed binary.]) -AC_PATH_PROG([SED], [sed], [sed]) - -AC_ARG_VAR([GCP], [Name and path of a GNU cp binary (need at least -P)]) -AC_PATH_PROG([GCP], [cp], [cp]) - -AC_ARG_VAR([ZIP], [Name and path of a zip binary (compatible with PKZIP)]) -AC_PATH_PROG([ZIP], [zip], [zip]) - -dnl -dnl default webrowser -dnl - -AC_ARG_WITH( - [webbrowser], - AC_HELP_STRING( - [--with-webbrowser=@<:@w3m|lynx|links|any@:>@], - [The default processing backend @<:@default=w3m@:>@] - ), - [ - case "x$withval" in - xlinks) - WEBBROWSER="links" - ;; - xlynx) - WEBBROWSER="lynx" - ;; - xany) - WEBBROWSER="text-www-browser" - ;; - *) - WEBBROWSER="w3m" - ;; - esac - ], - [WEBBROWSER="w3m"] -) - -AC_MSG_CHECKING([for default web browser]) -AC_MSG_RESULT([$WEBBROWSER]) -AC_SUBST([WEBBROWSER]) - -dnl -dnl done -dnl - -AC_CONFIG_FILES([Makefile xmlto xmlto.spec]) -AC_OUTPUT From c32baae979b9f79d965765a3839e8cf4e9ffff02 Mon Sep 17 00:00:00 2001 From: Thomas Kuehne Date: Dec 11 2021 20:33:18 +0000 Subject: [PATCH 2/7] Don't hardcode paths to utilities incorporate patch from Gentoo: (See https://bugs.gentoo.org/828520 too) From: Sam James Date: Wed, 10 Nov 2021 04:53:33 +0000 Subject: [PATCH] Don't hardcode paths to utilities The path to e.g. links at build time is not necessarily the same as the path at runtime. TODO: Could chop out the checks from configure but this package is fragile enough. Leaving it for now. (cherry picked from commit 85cbe37bb85c8234317f6f2b547155cb1af43663) --- diff --git a/xmlto.in b/xmlto.in index aed5458..fbf2254 100755 --- a/xmlto.in +++ b/xmlto.in @@ -272,13 +272,13 @@ then USE_BACKEND=DEFAULT fi -LINKS_PATH=@LINKS@ -W3M_PATH=@W3M@ -LYNX_PATH=@LYNX@ -GCP_PATH=@GCP@ -SED_PATH=@SED@ -GREP_PATH=@GREP@ -ZIP_PATH=@ZIP@ +LINKS_PATH=$(command -v elinks || command -v links) +W3M_PATH=$(command -v w3m) +LYNX_PATH=$(command -v lynx) +GCP_PATH=$(command -v cp) +SED_PATH=$(command -v sed) +GREP_PATH=$(command -v grep) +ZIP_PATH=$(command -v zip) # Process any options ARGS=$(${GETOPT} \ From dd50a27160ab369279cf30a1a70d37471f1fcb8a Mon Sep 17 00:00:00 2001 From: Thomas Kuehne Date: Dec 11 2021 20:36:40 +0000 Subject: [PATCH 3/7] update configure.ac to autoupdate-2.71 Signed-off-by: Thomas Kuehne (cherry picked from commit 995bd5460844ed760772e68c7bc4e44570c77817) --- diff --git a/configure.ac b/configure.ac index 8352663..cbffb0d 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT(xmlto, 0.0.28) +AC_INIT([xmlto],[0.0.28]) AC_CONFIG_SRCDIR(xmlto.spec.in) AM_INIT_AUTOMAKE([dist-bzip2 subdir-objects 1.6]) AC_CONFIG_HEADERS(config.h) @@ -69,7 +69,7 @@ dnl AC_ARG_WITH( [backend], - AC_HELP_STRING( + AS_HELP_STRING( [--with-backend=@<:@passivetex|fop|dblatex@:>@], [The default processing backend @<:@default=DEFAULT@:>@] ), @@ -127,7 +127,7 @@ dnl AC_ARG_WITH( [webbrowser], - AC_HELP_STRING( + AS_HELP_STRING( [--with-webbrowser=@<:@w3m|lynx|links|any@:>@], [The default processing backend @<:@default=w3m@:>@] ), From 1375e2df75530cd198bd16ac3de38e2b0d126276 Mon Sep 17 00:00:00 2001 From: Thomas Kuehne Date: Dec 11 2021 20:45:45 +0000 Subject: [PATCH 4/7] fix -Wimplicit-int for ifsense fixes: xmlif/xmlif.l:46:8: warning: type defaults to ‘int’ in declaration of ‘ifsense’ [-Wimplicit-int] 46 | static ifsense; /* sense of last `if' or unless seen */ | ^~~~~~~ Signed-off-by: Thomas Kuehne --- diff --git a/xmlif/xmlif.l b/xmlif/xmlif.l index ac42136..6e5970e 100644 --- a/xmlif/xmlif.l +++ b/xmlif/xmlif.l @@ -43,7 +43,7 @@ static char **selections; /* selection tokens */ static int nselections; /* number of selections */ -static ifsense; /* sense of last `if' or unless seen */ +static int ifsense; /* sense of last `if' or unless seen */ static char *attribute; /* last attribute scanned */ struct stack_t { From 412f97cdc00d2bbf7e8121012b49fc07b3fe3d2b Mon Sep 17 00:00:00 2001 From: Thomas Kuehne Date: Dec 11 2021 20:45:59 +0000 Subject: [PATCH 5/7] fix extra ‘;’ outside of a function Fixes: xmlif/xmlif.l:240:24: warning: ISO C does not allow extra ‘;’ outside of a function [-Wpedantic] 240 | int yywrap() {exit(0);}; | ^ Signed-off-by: Thomas Kuehne --- diff --git a/xmlif/xmlif.l b/xmlif/xmlif.l index 6e5970e..fe85eec 100644 --- a/xmlif/xmlif.l +++ b/xmlif/xmlif.l @@ -237,7 +237,7 @@ WS [ \t\n]* #include "config.h" -int yywrap() {exit(0);}; +int yywrap() {exit(0);} main(int argc, char *argv[]) { From 8e34f087bf410bcc5fe445933d6ad9bae54f24b5 Mon Sep 17 00:00:00 2001 From: Thomas Kuehne Date: Dec 11 2021 20:56:00 +0000 Subject: [PATCH 6/7] Fix return type of main function Fixes: xmlif/xmlif.l:242:1: warning: return type defaults to ‘int’ [-Wimplicit-int] 242 | main(int argc, char *argv[]) | ^~~~ Signed-off-by: Thomas Kuehne --- diff --git a/xmlif/xmlif.l b/xmlif/xmlif.l index fe85eec..7dd9dc0 100644 --- a/xmlif/xmlif.l +++ b/xmlif/xmlif.l @@ -239,7 +239,7 @@ WS [ \t\n]* int yywrap() {exit(0);} -main(int argc, char *argv[]) +int main(int argc, char *argv[]) { int i; @@ -265,7 +265,7 @@ main(int argc, char *argv[]) exit(1); } - yylex(); + return yylex(); } /* From 6fa6a0e07644f20abf2596f78a60112713e11cbe Mon Sep 17 00:00:00 2001 From: Thomas Kuehne Date: Dec 11 2021 21:03:42 +0000 Subject: [PATCH 7/7] add strings.h import Fixes: xmlif/xmlif.l:162:13: warning: implicit declaration of function ‘strncasecmp’; did you mean ‘strncmp’? [-Wimplicit-function-declaration] 162 | if (strncasecmp(selections[i], attr, eqoffset) == 0) | ^~~~~~~~~~~ Signed-off-by: Thomas Kuehne --- diff --git a/xmlif/xmlif.l b/xmlif/xmlif.l index 7dd9dc0..294fbc7 100644 --- a/xmlif/xmlif.l +++ b/xmlif/xmlif.l @@ -37,6 +37,7 @@ */ #include #include +#include #define TRUE 1 #define FALSE 0