xmlstarlet-1.5.0/0000755000175000017500000000000012166350421010715 500000000000000xmlstarlet-1.5.0/test-driver0000755000175000017500000000761112155041134013034 00000000000000#! /bin/sh # test-driver - basic testsuite driver script. scriptversion=2012-06-27.10; # UTC # Copyright (C) 2011-2013 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . # Make unconditional expansion of undefined variables an error. This # helps a lot in preventing typo-related bugs. set -u usage_error () { echo "$0: $*" >&2 print_usage >&2 exit 2 } print_usage () { cat <$log_file 2>&1 estatus=$? if test $enable_hard_errors = no && test $estatus -eq 99; then estatus=1 fi case $estatus:$expect_failure in 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; 0:*) col=$grn res=PASS recheck=no gcopy=no;; 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; *:*) col=$red res=FAIL recheck=yes gcopy=yes;; esac # Report outcome to console. echo "${col}${res}${std}: $test_name" # Register the test result, and other relevant metadata. echo ":test-result: $res" > $trs_file echo ":global-test-result: $res" >> $trs_file echo ":recheck: $recheck" >> $trs_file echo ":copy-in-global-log: $gcopy" >> $trs_file # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: xmlstarlet-1.5.0/m4/0000755000175000017500000000000012166350420011234 500000000000000xmlstarlet-1.5.0/m4/quiet-rule.m40000644000175000017500000000075212000573631013514 00000000000000# serial 1 -*- mode: autoconf -*- # SILENT_RULE(varname, [echo = varname]) # defines V_varname to use for silent make rules AC_DEFUN([np_SILENT_RULE],[dnl m4_pushdef([varname], $1)dnl m4_pushdef([echoname], [m4_default($2, varname)])dnl # make silent rule for $1 AC_SUBST(V_[]varname, ["\$(V_[]varname[]_$AM_V)"])dnl AC_SUBST(V_[]varname[]_, ["\$(V_[]varname[]_$AM_DEFAULT_VERBOSITY)"])dnl AC_SUBST(V_[]varname[]_0, ['@echo " echoname [$]@";'])dnl m4_popdef([varname], [echoname])dnl ]) xmlstarlet-1.5.0/m4/xstar-check-libs.m40000644000175000017500000000436211566543516014603 00000000000000# serial 1 -*- mode: autoconf -*- # XSTAR_LIB_ARGS_WITH(LIBXXX, [with-src = []]) dnl pass [with-src] to get the --with-libxxx-src option AC_DEFUN([XSTAR_LIB_ARGS_WITH], [m4_pushdef([LIBXXX], $1)dnl m4_pushdef([libxxx], m4_tolower(LIBXXX))dnl AC_ARG_WITH(libxxx-prefix, AS_HELP_STRING(--with-libxxx-prefix=[PFX], Specify location of libxxx), [LIBXXX()_PREFIX="$withval"]) AC_ARG_WITH(libxxx-include-prefix, AS_HELP_STRING([--with-libxxx-include-prefix=[PFX]], Specify location of libxxx headers), [LIBXXX()_INCDIR="$withval"]) AC_ARG_WITH(libxxx-libs-prefix, AS_HELP_STRING([--with-libxxx-libs-prefix=[PFX]], Specify location of libxxx libs), [LIBXXX()_LIBDIR="$withval"]) m4_if($2, [with-src], [AC_ARG_WITH(libxxx-src, AS_HELP_STRING([--with-libxxx-src=[DIR]], For libxxx that's not installed yet (sets all three above)), [LIBXXX()_SRCDIR="$withval" LIBXXX()_LIBDIR="$LIBXXX()_SRCDIR/.libs"])]) m4_popdef([libxxx], [LIBXXX])]) # XSTAR_LIB_CHECK(LIBXXX, xxx-config) # set LIBXXX_INCDIR and LIBXXX_LIBDIR based on location of xxx-config # also check xxx-config --version against LIBXXX_REQUIRED_VERSION # Ignores xxx-config if LIBXXX_SRCDIR is set AC_DEFUN([XSTAR_LIB_CHECK], [m4_pushdef([LIBXXX], $1) m4_pushdef([libxxx], m4_tolower(LIBXXX)) m4_pushdef([xxx_config], $2) AS_IF([test "x$LIBXXX()_SRCDIR" != x], [AC_MSG_NOTICE([using libxxx src dir "$LIBXXX()_SRCDIR"]) AC_MSG_WARN([not checking libxxx version])], [AC_PATH_PROG(LIBXXX()_CONFIG, xxx_config(), [], [$LIBXXX()_PREFIX/bin$PATH_SEPARATOR$PATH]) AS_IF([test "x$LIBXXX()_CONFIG" = x], [AC_MSG_FAILURE([xxx_config not found])]) LIBXXX()_VERSION=$($LIBXXX()_CONFIG --version) AS_VERSION_COMPARE([$LIBXXX()_VERSION], [$LIBXXX()_REQUIRED_VERSION], [AC_MSG_ERROR([xmlstarlet needs at least libxxx version $LIBXXX()_REQUIRED_VERSION (http://www.xmlsoft.org/)])]) AC_MSG_NOTICE([using libxxx-$LIBXXX()_VERSION]) LIBXXX()_PREFIX=`AS_DIRNAME($LIBXXX()_CONFIG)` LIBXXX()_PREFIX=`AS_DIRNAME($LIBXXX()_PREFIX)` : ${LIBXXX()_LIBDIR="$LIBXXX()_PREFIX/lib"}]) m4_popdef([xxx_config], [libxxx], [LIBXXX])]) xmlstarlet-1.5.0/usage2c.awk0000755000175000017500000000305312105544606012701 00000000000000#!/usr/bin/awk -f BEGIN { print("#include "); print("#include "); } # text in src/foo-bar.txt results in # static const char foo_text[] = { # 't', 'h', 'e', ' ', 't', 'e', 'x', 't', ... # } length(command_name) == 0 { command_name = FILENAME; sub(/\.txt$/, "", command_name); sub(/^([^\/]+\/)*/, "", command_name); gsub(/-/, "_", command_name); printf("static const char %s[] = {\n", command_name); progs = 0; } # escape percent signs: we are going to use printf(). I don't think there are # any %s currently, but it's bound to happen eventually. { gsub(/%/, "%%"); } # white space separted instances of PROG will be replaced with the final name of # the xmlstarlet executable /PROG/ { for (i = 1; i <= NF; i++) { if ($i == "PROG") { progs++; $i = "%s"; } } } # C-preprocessor directives are unchanged /^#/ # convert plain text lines into equivalent char array literal !/^#/ { for (i = 1; i <= length($0); i++) { c = substr($0, i, 1); if (c == "\\") # \ --> '\\' printf("'\\\\'"); else if (c == "'") # ' --> '\'' printf("'\\''"); else # X --> 'X' printf("'%c'", c); printf(","); } print("'\\n',"); } END { print("0 };"); printf("void fprint_%s(FILE* out, const char* argv0) {\n", command_name); printf(" fprintf(out, %s", command_name); for (i = 1; i <= progs; i++) printf(", argv0"); print(");\n}"); } xmlstarlet-1.5.0/COPYING0000644000175000017500000000210511466626742011704 00000000000000Copyright (c) 2002-2004 Mikhail Grushinskiy. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. xmlstarlet-1.5.0/aclocal.m40000644000175000017500000011742612166023711012507 00000000000000# generated automatically by aclocal 1.13.3 -*- Autoconf -*- # Copyright (C) 1996-2013 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) # Copyright (C) 2002-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.13' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.13.3], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.13.3])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to # '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each '.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) AM_MISSING_PROG([AUTOCONF], [autoconf]) AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) AM_MISSING_PROG([AUTOHEADER], [autoheader]) AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering # Copyright (C) 1996-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAINTAINER_MODE([DEFAULT-MODE]) # ---------------------------------- # Control maintainer-specific portions of Makefiles. # Default is to disable them, unless 'enable' is passed literally. # For symmetry, 'disable' may be passed as well. Anyway, the user # can override the default with the --enable/--disable switch. AC_DEFUN([AM_MAINTAINER_MODE], [m4_case(m4_default([$1], [disable]), [enable], [m4_define([am_maintainer_other], [disable])], [disable], [m4_define([am_maintainer_other], [enable])], [m4_define([am_maintainer_other], [enable]) m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode's default is 'disable' unless 'enable' is passed AC_ARG_ENABLE([maintainer-mode], [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode], am_maintainer_other[ make rules and dependencies not useful (and sometimes confusing) to the casual installer])], [USE_MAINTAINER_MODE=$enableval], [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST([MAINT])dnl ] ) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Copyright (C) 1999-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_CC_C_O # -------------- # Like AC_PROG_CC_C_O, but changed for automake. AC_DEFUN([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC_C_O])dnl AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl # FIXME: we rely on the cache variable name because # there is no other way. set dummy $CC am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']` eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o if test "$am_t" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi dnl Make sure AC_PROG_CC is never called again, or it will override our dnl setting of CC. m4_define([AC_PROG_CC], [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])]) ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it is modern enough. # If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT([yes]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar # AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} for _am_tool in $_am_tools; do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works. rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([m4/quiet-rule.m4]) m4_include([m4/xstar-check-libs.m4]) xmlstarlet-1.5.0/configure0000755000175000017500000066103612166344364012571 00000000000000#! /bin/sh # From configure.ac 1.5.0. # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for XMLStarlet 1.5.0. # # Report bugs to . # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and $0: http://sourceforge.net/projects/xmlstar/support about $0: your system, including any error possibly output before $0: this message. Then install a modern shell, or manually $0: run the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" as_awk_strverscmp=' # Use only awk features that work with 7th edition Unix awk (1978). # My, what an old awk you have, Mr. Solaris! END { while (length(v1) && length(v2)) { # Set d1 to be the next thing to compare from v1, and likewise for d2. # Normally this is a single character, but if v1 and v2 contain digits, # compare them as integers and fractions as strverscmp does. if (v1 ~ /^[0-9]/ && v2 ~ /^[0-9]/) { # Split v1 and v2 into their leading digit string components d1 and d2, # and advance v1 and v2 past the leading digit strings. for (len1 = 1; substr(v1, len1 + 1) ~ /^[0-9]/; len1++) continue for (len2 = 1; substr(v2, len2 + 1) ~ /^[0-9]/; len2++) continue d1 = substr(v1, 1, len1); v1 = substr(v1, len1 + 1) d2 = substr(v2, 1, len2); v2 = substr(v2, len2 + 1) if (d1 ~ /^0/) { if (d2 ~ /^0/) { # Compare two fractions. while (d1 ~ /^0/ && d2 ~ /^0/) { d1 = substr(d1, 2); len1-- d2 = substr(d2, 2); len2-- } if (len1 != len2 && ! (len1 && len2 && substr(d1, 1, 1) == substr(d2, 1, 1))) { # The two components differ in length, and the common prefix # contains only leading zeros. Consider the longer to be less. d1 = -len1 d2 = -len2 } else { # Otherwise, compare as strings. d1 = "x" d1 d2 = "x" d2 } } else { # A fraction is less than an integer. exit 1 } } else { if (d2 ~ /^0/) { # An integer is greater than a fraction. exit 2 } else { # Compare two integers. d1 += 0 d2 += 0 } } } else { # The normal case, without worrying about digits. d1 = substr(v1, 1, 1); v1 = substr(v1, 2) d2 = substr(v2, 1, 1); v2 = substr(v2, 2) } if (d1 < d2) exit 1 if (d1 > d2) exit 2 } # Beware Solaris /usr/xgp4/bin/awk (at least through Solaris 10), # which mishandles some comparisons of empty strings to integers. if (length(v2)) exit 1 if (length(v1)) exit 2 } ' test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='XMLStarlet' PACKAGE_TARNAME='xmlstarlet' PACKAGE_VERSION='1.5.0' PACKAGE_STRING='XMLStarlet 1.5.0' PACKAGE_BUGREPORT='http://sourceforge.net/projects/xmlstar/support' PACKAGE_URL='http://xmlstar.sourceforge.net/' # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_func_list= ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS V_DOCBOOK_0 V_DOCBOOK_ V_DOCBOOK V_FOP_0 V_FOP_ V_FOP LIBXSLT_REQUIRED_VERSION LIBXML_REQUIRED_VERSION LDADD AM_LDFLAGS AM_CPPFLAGS HAVE_EXSLT_XPATH_REGISTER_FALSE HAVE_EXSLT_XPATH_REGISTER_TRUE LIBOBJS EGREP GREP CPP BUILD_DOCS_FALSE BUILD_DOCS_TRUE HAVE_PDF2PS_FALSE HAVE_PDF2PS_TRUE PDF2PS HAVE_FOP_FALSE HAVE_FOP_TRUE FOP XSLTPROC LIBXSLT_CONFIG LIBXML_CONFIG SED GCC_FALSE GCC_TRUE am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC host_os host_vendor host_cpu host build_os build_vendor build_cpu build MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_maintainer_mode with_libxml_prefix with_libxml_include_prefix with_libxml_libs_prefix with_libxml_src with_libxslt_prefix with_libxslt_include_prefix with_libxslt_libs_prefix with_libxslt_src with_libiconv_prefix with_libiconv_include_prefix with_libiconv_libs_prefix enable_static_libs enable_build_docs enable_dependency_tracking ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures XMLStarlet 1.5.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/xmlstarlet] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of XMLStarlet 1.5.0:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --enable-static-libs link statically with libxml2 and lib(e)xslt [default=no] --enable-build-docs include rules to build documentation files --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-libxml-prefix=PFX Specify location of libxml --with-libxml-include-prefix=PFX Specify location of libxml headers --with-libxml-libs-prefix=PFX Specify location of libxml libs --with-libxml-src=DIR For libxml that's not installed yet (sets all three above) --with-libxslt-prefix=PFX Specify location of libxslt --with-libxslt-include-prefix=PFX Specify location of libxslt headers --with-libxslt-libs-prefix=PFX Specify location of libxslt libs --with-libxslt-src=DIR For libxslt that's not installed yet (sets all three above) --with-libiconv-prefix=PFX Specify location of libiconv --with-libiconv-include-prefix=PFX Specify location of libiconv headers --with-libiconv-libs-prefix=PFX Specify location of libiconv libs Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory 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 CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . XMLStarlet home page: . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF XMLStarlet configure 1.5.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( $as_echo "## -------------------------------------------------------------- ## ## Report this to http://sourceforge.net/projects/xmlstar/support ## ## -------------------------------------------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES # --------------------------------------------- # Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR # accordingly. ac_fn_c_check_decl () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack as_decl_name=`echo $2|sed 's/ *(.*//'` as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 $as_echo_n "checking whether $as_decl_name is declared... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { #ifndef $as_decl_name #ifdef __cplusplus (void) $as_decl_use; #else (void) $as_decl_name; #endif #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_decl cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by XMLStarlet $as_me 1.5.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi as_fn_append ac_func_list " lstat" as_fn_append ac_func_list " stat" as_fn_append ac_func_list " setmode" # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu am__api_version='1.13' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; 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_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $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 fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; 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_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $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 fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk 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_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $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 fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='xmlstarlet' VERSION='1.5.0' # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar pax cpio none' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=0;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } # Check whether --enable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then : enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 $as_echo "$USE_MAINTAINER_MODE" >&6; } if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE LIBXML_REQUIRED_VERSION=2.6.27 LIBXSLT_REQUIRED_VERSION=1.1.9 # Check whether --with-libxml-prefix was given. if test "${with_libxml_prefix+set}" = set; then : withval=$with_libxml_prefix; LIBXML_PREFIX="$withval" fi # Check whether --with-libxml-include-prefix was given. if test "${with_libxml_include_prefix+set}" = set; then : withval=$with_libxml_include_prefix; LIBXML_INCDIR="$withval" fi # Check whether --with-libxml-libs-prefix was given. if test "${with_libxml_libs_prefix+set}" = set; then : withval=$with_libxml_libs_prefix; LIBXML_LIBDIR="$withval" fi # Check whether --with-libxml-src was given. if test "${with_libxml_src+set}" = set; then : withval=$with_libxml_src; LIBXML_SRCDIR="$withval" LIBXML_LIBDIR="$LIBXML_SRCDIR/.libs" fi # Check whether --with-libxslt-prefix was given. if test "${with_libxslt_prefix+set}" = set; then : withval=$with_libxslt_prefix; LIBXSLT_PREFIX="$withval" fi # Check whether --with-libxslt-include-prefix was given. if test "${with_libxslt_include_prefix+set}" = set; then : withval=$with_libxslt_include_prefix; LIBXSLT_INCDIR="$withval" fi # Check whether --with-libxslt-libs-prefix was given. if test "${with_libxslt_libs_prefix+set}" = set; then : withval=$with_libxslt_libs_prefix; LIBXSLT_LIBDIR="$withval" fi # Check whether --with-libxslt-src was given. if test "${with_libxslt_src+set}" = set; then : withval=$with_libxslt_src; LIBXSLT_SRCDIR="$withval" LIBXSLT_LIBDIR="$LIBXSLT_SRCDIR/.libs" fi # Check whether --with-libiconv-prefix was given. if test "${with_libiconv_prefix+set}" = set; then : withval=$with_libiconv_prefix; LIBICONV_PREFIX="$withval" fi # Check whether --with-libiconv-include-prefix was given. if test "${with_libiconv_include_prefix+set}" = set; then : withval=$with_libiconv_include_prefix; LIBICONV_INCDIR="$withval" fi # Check whether --with-libiconv-libs-prefix was given. if test "${with_libiconv_libs_prefix+set}" = set; then : withval=$with_libiconv_libs_prefix; LIBICONV_LIBDIR="$withval" fi # Check whether --enable-static-libs was given. if test "${enable_static_libs+set}" = set; then : enableval=$enable_static_libs; STATIC_LIBS=$enableval else STATIC_LIBS=no fi # Check whether --enable-build_docs was given. if test "${enable_build_docs+set}" = set; then : enableval=$enable_build_docs; else enable_build_docs=no fi # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; 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_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $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 fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; 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_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $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 fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; 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_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $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 fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; 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_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no 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 if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $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 if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$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_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $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 fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe 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_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $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 fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi if test x$GCC = xyes; then GCC_TRUE= GCC_FALSE='#' else GCC_TRUE='#' GCC_FALSE= fi if test x$GCC = xyes; then : CFLAGS="-ansi $CFLAGS" fi if test "x$CC" != xcc; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5 $as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5 $as_echo_n "checking whether cc understands -c and -o together... " >&6; } fi set dummy $CC; ac_cc=`$as_echo "$2" | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # We do the test twice because some compilers refuse to overwrite an # existing .o file with -o, though they will create one. ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5' rm -f conftest2.* if { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -f conftest2.$ac_objext && { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then eval ac_cv_prog_cc_${ac_cc}_c_o=yes if test "x$CC" != xcc; then # Test first that cc exists at all. if { ac_try='cc -c conftest.$ac_ext >&5' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5' rm -f conftest2.* if { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -f conftest2.$ac_objext && { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # cc works too. : else # cc exists but doesn't like -o. eval ac_cv_prog_cc_${ac_cc}_c_o=no fi fi fi else eval ac_cv_prog_cc_${ac_cc}_c_o=no fi rm -f core conftest* fi if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h fi # FIXME: we rely on the cache variable name because # there is no other way. set dummy $CC am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o if test "$am_t" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST 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_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed for ac_prog in gawk mawk nawk awk 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_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $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 fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done if test "x$LIBXML_SRCDIR" != x; then : { $as_echo "$as_me:${as_lineno-$LINENO}: using libxml src dir \"$LIBXML_SRCDIR\"" >&5 $as_echo "$as_me: using libxml src dir \"$LIBXML_SRCDIR\"" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: not checking libxml version" >&5 $as_echo "$as_me: WARNING: not checking libxml version" >&2;} else # Extract the first word of "xml2-config", so it can be a program name with args. set dummy xml2-config; 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_LIBXML_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $LIBXML_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_LIBXML_CONFIG="$LIBXML_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $LIBXML_PREFIX/bin$PATH_SEPARATOR$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_LIBXML_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 LIBXML_CONFIG=$ac_cv_path_LIBXML_CONFIG if test -n "$LIBXML_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBXML_CONFIG" >&5 $as_echo "$LIBXML_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$LIBXML_CONFIG" = x; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "xml2-config not found See \`config.log' for more details" "$LINENO" 5; } fi LIBXML_VERSION=$($LIBXML_CONFIG --version) as_arg_v1=$LIBXML_VERSION as_arg_v2=$LIBXML_REQUIRED_VERSION awk "$as_awk_strverscmp" v1="$as_arg_v1" v2="$as_arg_v2" /dev/null case $? in #( 1) : as_fn_error $? "xmlstarlet needs at least libxml version $LIBXML_REQUIRED_VERSION (http://www.xmlsoft.org/)" "$LINENO" 5 ;; #( 0) : ;; #( 2) : ;; #( *) : ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: using libxml-$LIBXML_VERSION" >&5 $as_echo "$as_me: using libxml-$LIBXML_VERSION" >&6;} LIBXML_PREFIX=`$as_dirname -- $LIBXML_CONFIG || $as_expr X$LIBXML_CONFIG : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X$LIBXML_CONFIG : 'X\(//\)[^/]' \| \ X$LIBXML_CONFIG : 'X\(//\)$' \| \ X$LIBXML_CONFIG : 'X\(/\)' \| . 2>/dev/null || $as_echo X$LIBXML_CONFIG | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` LIBXML_PREFIX=`$as_dirname -- $LIBXML_PREFIX || $as_expr X$LIBXML_PREFIX : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X$LIBXML_PREFIX : 'X\(//\)[^/]' \| \ X$LIBXML_PREFIX : 'X\(//\)$' \| \ X$LIBXML_PREFIX : 'X\(/\)' \| . 2>/dev/null || $as_echo X$LIBXML_PREFIX | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` : ${LIBXML_LIBDIR="$LIBXML_PREFIX/lib"} fi if test "x$LIBXML_SRCDIR" != x; then : LIBXML_INCDIR="$LIBXML_SRCDIR/include" fi : ${LIBXML_INCDIR="$LIBXML_PREFIX/include/libxml2"} if test "x$STATIC_LIBS" != xno; then : LIBXML_CPPFLAGS="-I$LIBXML_INCDIR -DLIBXML_STATIC" else LIBXML_CPPFLAGS="-I$LIBXML_INCDIR" fi if test "x$STATIC_LIBS" != xno; then : LIBXML_LIBS="$LIBXML_LIBDIR/libxml2.a" else LIBXML_LIBS="-lxml2" fi LIBXML_LDFLAGS="-L$LIBXML_LIBDIR" if test "x$LIBXSLT_SRCDIR" != x; then : { $as_echo "$as_me:${as_lineno-$LINENO}: using libxslt src dir \"$LIBXSLT_SRCDIR\"" >&5 $as_echo "$as_me: using libxslt src dir \"$LIBXSLT_SRCDIR\"" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: not checking libxslt version" >&5 $as_echo "$as_me: WARNING: not checking libxslt version" >&2;} else # Extract the first word of "xslt-config", so it can be a program name with args. set dummy xslt-config; 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_LIBXSLT_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $LIBXSLT_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_LIBXSLT_CONFIG="$LIBXSLT_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $LIBXSLT_PREFIX/bin$PATH_SEPARATOR$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_LIBXSLT_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 LIBXSLT_CONFIG=$ac_cv_path_LIBXSLT_CONFIG if test -n "$LIBXSLT_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBXSLT_CONFIG" >&5 $as_echo "$LIBXSLT_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$LIBXSLT_CONFIG" = x; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "xslt-config not found See \`config.log' for more details" "$LINENO" 5; } fi LIBXSLT_VERSION=$($LIBXSLT_CONFIG --version) as_arg_v1=$LIBXSLT_VERSION as_arg_v2=$LIBXSLT_REQUIRED_VERSION awk "$as_awk_strverscmp" v1="$as_arg_v1" v2="$as_arg_v2" /dev/null case $? in #( 1) : as_fn_error $? "xmlstarlet needs at least libxslt version $LIBXSLT_REQUIRED_VERSION (http://www.xmlsoft.org/)" "$LINENO" 5 ;; #( 0) : ;; #( 2) : ;; #( *) : ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: using libxslt-$LIBXSLT_VERSION" >&5 $as_echo "$as_me: using libxslt-$LIBXSLT_VERSION" >&6;} LIBXSLT_PREFIX=`$as_dirname -- $LIBXSLT_CONFIG || $as_expr X$LIBXSLT_CONFIG : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X$LIBXSLT_CONFIG : 'X\(//\)[^/]' \| \ X$LIBXSLT_CONFIG : 'X\(//\)$' \| \ X$LIBXSLT_CONFIG : 'X\(/\)' \| . 2>/dev/null || $as_echo X$LIBXSLT_CONFIG | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` LIBXSLT_PREFIX=`$as_dirname -- $LIBXSLT_PREFIX || $as_expr X$LIBXSLT_PREFIX : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X$LIBXSLT_PREFIX : 'X\(//\)[^/]' \| \ X$LIBXSLT_PREFIX : 'X\(//\)$' \| \ X$LIBXSLT_PREFIX : 'X\(/\)' \| . 2>/dev/null || $as_echo X$LIBXSLT_PREFIX | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` : ${LIBXSLT_LIBDIR="$LIBXSLT_PREFIX/lib"} fi if test "x$LIBXSLT_SRCDIR" != x; then : XSLTPROC_PATH="$LIBXSLT_SRCDIR/xsltproc:$PATH" LIBXSLT_INCDIR="$LIBXSLT_SRCDIR" LIBXSLT_LDFLAGS="-L$LIBXSLT_SRCDIR/libexslt/.libs -L$LIBXSLT_SRCDIR/libxslt/.libs" if test "x$STATIC_LIBS" != xno; then : LIBXSLT_LIBS="$LIBXSLT_SRCDIR/libexslt/.libs/libexslt.a $LIBXSLT_SRCDIR/libxslt/.libs/libxslt.a" fi else XSLTPROC_PATH="$PATH" LIBXSLT_LDFLAGS="-L$LIBXSLT_LIBDIR" if test "x$STATIC_LIBS" != xno; then : LIBXSLT_LIBS="$LIBXSLT_LIBDIR/libexslt.a $LIBXSLT_LIBDIR/libxslt.a" fi fi if test x"$enable_build_docs" = xyes; then : # 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 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_XSLTPROC+:} false; then : $as_echo_n "(cached) " >&6 else case $XSLTPROC in [\\/]* | ?:[\\/]*) ac_cv_path_XSLTPROC="$XSLTPROC" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $XSLTPROC_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_XSLTPROC="$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 test -z "$ac_cv_path_XSLTPROC" && ac_cv_path_XSLTPROC="none" ;; esac fi XSLTPROC=$ac_cv_path_XSLTPROC if test -n "$XSLTPROC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XSLTPROC" >&5 $as_echo "$XSLTPROC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "$XSLTPROC" = none; then : as_fn_error $? "xsltproc not found, unable to build documentation" "$LINENO" 5 fi # Extract the first word of "fop", so it can be a program name with args. set dummy fop; 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_FOP+:} false; then : $as_echo_n "(cached) " >&6 else case $FOP in [\\/]* | ?:[\\/]*) ac_cv_path_FOP="$FOP" # 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_FOP="$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 test -z "$ac_cv_path_FOP" && ac_cv_path_FOP="none" ;; esac fi FOP=$ac_cv_path_FOP if test -n "$FOP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FOP" >&5 $as_echo "$FOP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test x"$FOP" != xnone; then HAVE_FOP_TRUE= HAVE_FOP_FALSE='#' else HAVE_FOP_TRUE='#' HAVE_FOP_FALSE= fi if test "$FOP" = none; then : { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: fop not installed, unable to build pdf documentation" >&5 $as_echo "$as_me: WARNING: fop not installed, unable to build pdf documentation" >&2;} fi # Extract the first word of "pdf2ps", so it can be a program name with args. set dummy pdf2ps; 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_PDF2PS+:} false; then : $as_echo_n "(cached) " >&6 else case $PDF2PS in [\\/]* | ?:[\\/]*) ac_cv_path_PDF2PS="$PDF2PS" # 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_PDF2PS="$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 test -z "$ac_cv_path_PDF2PS" && ac_cv_path_PDF2PS="none" ;; esac fi PDF2PS=$ac_cv_path_PDF2PS if test -n "$PDF2PS"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PDF2PS" >&5 $as_echo "$PDF2PS" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test x"$PDF2PS" != xnone; then HAVE_PDF2PS_TRUE= HAVE_PDF2PS_FALSE='#' else HAVE_PDF2PS_TRUE='#' HAVE_PDF2PS_FALSE= fi if test "$PDF2PS" = none; then : { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pdf2ps not installed, unable to build postscript documentation" >&5 $as_echo "$as_me: WARNING: pdf2ps not installed, unable to build postscript documentation" >&2;} fi else # these don't get used when BUILD_DOCS is false but Automake # will get cranky if we don't set the conditional if false; then HAVE_FOP_TRUE= HAVE_FOP_FALSE='#' else HAVE_FOP_TRUE='#' HAVE_FOP_FALSE= fi if false; then HAVE_PDF2PS_TRUE= HAVE_PDF2PS_FALSE='#' else HAVE_PDF2PS_TRUE='#' HAVE_PDF2PS_FALSE= fi fi if test x"$enable_build_docs" = xyes; then BUILD_DOCS_TRUE= BUILD_DOCS_FALSE='#' else BUILD_DOCS_TRUE='#' BUILD_DOCS_FALSE= fi if test "x$STATIC_LIBS" = xno; then : LIBXSLT_LIBS="-lexslt -lxslt" fi : ${LIBXSLT_INCDIR="$LIBXSLT_PREFIX/include"} LIBXSLT_CPPFLAGS="-I$LIBXSLT_INCDIR" WIN32_EXTRA_LDFLAGS= WIN32_EXTRA_LIBS= case "${host}" in #( *-hpux*) : if test "x$GCC" != "xyes"; then : CFLAGS="-Ae" fi ;; #( *mingw*) : WIN32_EXTRA_LIBS='-lwsock32' $as_echo "#define _WINSOCKAPI_ 1" >>confdefs.h ;; #( *) : ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5 $as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; } if ${ac_cv_func_lstat_dereferences_slashed_symlink+:} false; then : $as_echo_n "(cached) " >&6 else rm -f conftest.sym conftest.file echo >conftest.file if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then if test "$cross_compiling" = yes; then : ac_cv_func_lstat_dereferences_slashed_symlink=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { struct stat sbuf; /* Linux will dereference the symlink and fail, as required by POSIX. That is better in the sense that it means we will not have to compile and use the lstat wrapper. */ return lstat ("conftest.sym/", &sbuf) == 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_lstat_dereferences_slashed_symlink=yes else ac_cv_func_lstat_dereferences_slashed_symlink=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi else # If the `ln -s' command failed, then we probably don't even # have an lstat function. ac_cv_func_lstat_dereferences_slashed_symlink=no fi rm -f conftest.sym conftest.file fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5 $as_echo "$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; } test $ac_cv_func_lstat_dereferences_slashed_symlink = yes && cat >>confdefs.h <<_ACEOF #define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 _ACEOF if test "x$ac_cv_func_lstat_dereferences_slashed_symlink" = xno; then case " $LIBOBJS " in *" lstat.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;; esac fi for ac_header in stdlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDLIB_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 $as_echo_n "checking for GNU libc compatible malloc... " >&6; } if ${ac_cv_func_malloc_0_nonnull+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_malloc_0_nonnull=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined STDC_HEADERS || defined HAVE_STDLIB_H # include #else char *malloc (); #endif int main () { return ! malloc (0); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_malloc_0_nonnull=yes else ac_cv_func_malloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 $as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } if test $ac_cv_func_malloc_0_nonnull = yes; then : $as_echo "#define HAVE_MALLOC 1" >>confdefs.h else $as_echo "#define HAVE_MALLOC 0" >>confdefs.h case " $LIBOBJS " in *" malloc.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS malloc.$ac_objext" ;; esac $as_echo "#define malloc rpl_malloc" >>confdefs.h fi for ac_header in stdlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDLIB_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible realloc" >&5 $as_echo_n "checking for GNU libc compatible realloc... " >&6; } if ${ac_cv_func_realloc_0_nonnull+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_realloc_0_nonnull=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined STDC_HEADERS || defined HAVE_STDLIB_H # include #else char *realloc (); #endif int main () { return ! realloc (0, 0); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_realloc_0_nonnull=yes else ac_cv_func_realloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_realloc_0_nonnull" >&5 $as_echo "$ac_cv_func_realloc_0_nonnull" >&6; } if test $ac_cv_func_realloc_0_nonnull = yes; then : $as_echo "#define HAVE_REALLOC 1" >>confdefs.h else $as_echo "#define HAVE_REALLOC 0" >>confdefs.h case " $LIBOBJS " in *" realloc.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS realloc.$ac_objext" ;; esac $as_echo "#define realloc rpl_realloc" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default" if test "x$ac_cv_type_mode_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define mode_t int _ACEOF fi ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi # The trick with USER_LIBS allows make LIBS=-lfoo to add rather than # replace the libraries from ./configure USER_LIBS="$LIBS" LIBS= # shared libraries link to dependant libraries automatically if test "x$STATIC_LIBS" != xno; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 $as_echo_n "checking for library containing dlopen... " >&6; } if ${ac_cv_search_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF for ac_lib in '' dl; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib "$USER_LIBS" $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_dlopen=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_dlopen+:} false; then : break fi done if ${ac_cv_search_dlopen+:} false; then : else ac_cv_search_dlopen=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5 $as_echo "$ac_cv_search_dlopen" >&6; } ac_res=$ac_cv_search_dlopen if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sqrt" >&5 $as_echo_n "checking for library containing sqrt... " >&6; } if ${ac_cv_search_sqrt+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char sqrt (); int main () { return sqrt (); ; return 0; } _ACEOF for ac_lib in '' m; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib "$USER_LIBS" $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_sqrt=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_sqrt+:} false; then : break fi done if ${ac_cv_search_sqrt+:} false; then : else ac_cv_search_sqrt=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_sqrt" >&5 $as_echo "$ac_cv_search_sqrt" >&6; } ac_res=$ac_cv_search_sqrt if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing iconv_open" >&5 $as_echo_n "checking for library containing iconv_open... " >&6; } if ${ac_cv_search_iconv_open+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char iconv_open (); int main () { return iconv_open (); ; return 0; } _ACEOF for ac_lib in '' iconv; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib "$USER_LIBS" $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_iconv_open=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_iconv_open+:} false; then : break fi done if ${ac_cv_search_iconv_open+:} false; then : else ac_cv_search_iconv_open=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_iconv_open" >&5 $as_echo "$ac_cv_search_iconv_open" >&6; } ac_res=$ac_cv_search_iconv_open if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing libiconv_open" >&5 $as_echo_n "checking for library containing libiconv_open... " >&6; } if ${ac_cv_search_libiconv_open+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char libiconv_open (); int main () { return libiconv_open (); ; return 0; } _ACEOF for ac_lib in '' iconv; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib "$USER_LIBS" $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_libiconv_open=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_libiconv_open+:} false; then : break fi done if ${ac_cv_search_libiconv_open+:} false; then : else ac_cv_search_libiconv_open=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_libiconv_open" >&5 $as_echo "$ac_cv_search_libiconv_open" >&6; } ac_res=$ac_cv_search_libiconv_open if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5 $as_echo_n "checking for library containing clock_gettime... " >&6; } if ${ac_cv_search_clock_gettime+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char clock_gettime (); int main () { return clock_gettime (); ; return 0; } _ACEOF for ac_lib in '' rt; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib "$USER_LIBS" $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_clock_gettime=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_clock_gettime+:} false; then : break fi done if ${ac_cv_search_clock_gettime+:} false; then : else ac_cv_search_clock_gettime=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5 $as_echo "$ac_cv_search_clock_gettime" >&6; } ac_res=$ac_cv_search_clock_gettime if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing deflate" >&5 $as_echo_n "checking for library containing deflate... " >&6; } if ${ac_cv_search_deflate+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char deflate (); int main () { return deflate (); ; return 0; } _ACEOF for ac_lib in '' z; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib "$USER_LIBS" $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_deflate=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_deflate+:} false; then : break fi done if ${ac_cv_search_deflate+:} false; then : else ac_cv_search_deflate=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_deflate" >&5 $as_echo "$ac_cv_search_deflate" >&6; } ac_res=$ac_cv_search_deflate if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gcry_cipher_encrypt" >&5 $as_echo_n "checking for library containing gcry_cipher_encrypt... " >&6; } if ${ac_cv_search_gcry_cipher_encrypt+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gcry_cipher_encrypt (); int main () { return gcry_cipher_encrypt (); ; return 0; } _ACEOF for ac_lib in '' gcrypt; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib "$USER_LIBS" $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_gcry_cipher_encrypt=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_gcry_cipher_encrypt+:} false; then : break fi done if ${ac_cv_search_gcry_cipher_encrypt+:} false; then : else ac_cv_search_gcry_cipher_encrypt=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gcry_cipher_encrypt" >&5 $as_echo "$ac_cv_search_gcry_cipher_encrypt" >&6; } ac_res=$ac_cv_search_gcry_cipher_encrypt if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi # Checks for inet libraries: { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gethostent" >&5 $as_echo_n "checking for library containing gethostent... " >&6; } if ${ac_cv_search_gethostent+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gethostent (); int main () { return gethostent (); ; return 0; } _ACEOF for ac_lib in '' nsl; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib "$USER_LIBS" $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_gethostent=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_gethostent+:} false; then : break fi done if ${ac_cv_search_gethostent+:} false; then : else ac_cv_search_gethostent=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gethostent" >&5 $as_echo "$ac_cv_search_gethostent" >&6; } ac_res=$ac_cv_search_gethostent if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing setsockopt" >&5 $as_echo_n "checking for library containing setsockopt... " >&6; } if ${ac_cv_search_setsockopt+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char setsockopt (); int main () { return setsockopt (); ; return 0; } _ACEOF for ac_lib in '' socket net network; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib "$USER_LIBS" $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_setsockopt=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_setsockopt+:} false; then : break fi done if ${ac_cv_search_setsockopt+:} false; then : else ac_cv_search_setsockopt=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_setsockopt" >&5 $as_echo "$ac_cv_search_setsockopt" >&6; } ac_res=$ac_cv_search_setsockopt if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing connect" >&5 $as_echo_n "checking for library containing connect... " >&6; } if ${ac_cv_search_connect+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char connect (); int main () { return connect (); ; return 0; } _ACEOF for ac_lib in '' inet; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib "$USER_LIBS" $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_connect=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_connect+:} false; then : break fi done if ${ac_cv_search_connect+:} false; then : else ac_cv_search_connect=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_connect" >&5 $as_echo "$ac_cv_search_connect" >&6; } ac_res=$ac_cv_search_connect if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi fi for ac_func in $ac_func_list do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done ac_fn_c_check_decl "$LINENO" "O_BINARY" "ac_cv_have_decl_O_BINARY" " #include #include " if test "x$ac_cv_have_decl_O_BINARY" = xyes; then : $as_echo "#define HAVE_DECL_O_BINARY 1" >>confdefs.h else $as_echo "#define HAVE_DECL_O_BINARY 0" >>confdefs.h fi # check for exslt*XpathCtxtRegister() functions OLD_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$LIBXSLT_CPPFLAGS $LIBXML_CPPFLAGS $CPPFLAGS" ac_fn_c_check_decl "$LINENO" "exsltDateXpathCtxtRegister" "ac_cv_have_decl_exsltDateXpathCtxtRegister" "#include " if test "x$ac_cv_have_decl_exsltDateXpathCtxtRegister" = xyes; then : $as_echo "#define HAVE_EXSLT_XPATH_REGISTER 1" >>confdefs.h HAVE_EXSLT_XPATH_REGISTER=1 else $as_echo "#define HAVE_EXSLT_XPATH_REGISTER 0" >>confdefs.h HAVE_EXSLT_XPATH_REGISTER=0 fi if test $HAVE_EXSLT_XPATH_REGISTER = 1; then HAVE_EXSLT_XPATH_REGISTER_TRUE= HAVE_EXSLT_XPATH_REGISTER_FALSE='#' else HAVE_EXSLT_XPATH_REGISTER_TRUE='#' HAVE_EXSLT_XPATH_REGISTER_FALSE= fi CPPFLAGS="$OLD_CPPFLAGS" # make flags AM_CPPFLAGS="$LIBXSLT_CPPFLAGS $LIBXML_CPPFLAGS" AM_LDFLAGS="$LIBXSLT_LDFLAGS $LIBXML_LDFLAGS" LDADD="$LIBXSLT_LIBS $LIBXML_LIBS $WIN32_EXTRA_LIBS $LIBS" LIBS="$USER_LIBS" # make silent rule for FOP V_FOP="\$(V_FOP_$AM_V)" V_FOP_="\$(V_FOP_$AM_DEFAULT_VERBOSITY)" V_FOP_0='@echo " FOP $@";' # make silent rule for DOCBOOK V_DOCBOOK="\$(V_DOCBOOK_$AM_V)" V_DOCBOOK_="\$(V_DOCBOOK_$AM_DEFAULT_VERBOSITY)" V_DOCBOOK_0='@echo " DBOOK $@";' $as_echo "#define _XOPEN_SOURCE 500" >>confdefs.h ac_config_headers="$ac_config_headers config.h" ac_config_files="$ac_config_files xmlstarlet.spec Makefile solaris/package/sol8-sparc/pkginfo solaris/package/sol9-sparc/pkginfo" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs { $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 $as_echo_n "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${GCC_TRUE}" && test -z "${GCC_FALSE}"; then as_fn_error $? "conditional \"GCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_FOP_TRUE}" && test -z "${HAVE_FOP_FALSE}"; then as_fn_error $? "conditional \"HAVE_FOP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_PDF2PS_TRUE}" && test -z "${HAVE_PDF2PS_FALSE}"; then as_fn_error $? "conditional \"HAVE_PDF2PS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_FOP_TRUE}" && test -z "${HAVE_FOP_FALSE}"; then as_fn_error $? "conditional \"HAVE_FOP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_PDF2PS_TRUE}" && test -z "${HAVE_PDF2PS_FALSE}"; then as_fn_error $? "conditional \"HAVE_PDF2PS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${BUILD_DOCS_TRUE}" && test -z "${BUILD_DOCS_FALSE}"; then as_fn_error $? "conditional \"BUILD_DOCS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_EXSLT_XPATH_REGISTER_TRUE}" && test -z "${HAVE_EXSLT_XPATH_REGISTER_FALSE}"; then as_fn_error $? "conditional \"HAVE_EXSLT_XPATH_REGISTER\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by XMLStarlet $as_me 1.5.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to . XMLStarlet home page: ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ XMLStarlet config.status 1.5.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "xmlstarlet.spec") CONFIG_FILES="$CONFIG_FILES xmlstarlet.spec" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "solaris/package/sol8-sparc/pkginfo") CONFIG_FILES="$CONFIG_FILES solaris/package/sol8-sparc/pkginfo" ;; "solaris/package/sol9-sparc/pkginfo") CONFIG_FILES="$CONFIG_FILES solaris/package/sol9-sparc/pkginfo" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi xmlstarlet-1.5.0/compile0000755000175000017500000001624512155041134012217 00000000000000#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2012-10-14.11; # UTC # Copyright (C) 1999-2013 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: xmlstarlet-1.5.0/version.h0000644000175000017500000000003012166350420012463 00000000000000#define VERSION "1.5.0" xmlstarlet-1.5.0/config.h.in0000644000175000017500000000507712161341217012667 00000000000000/* config.h.in. Generated from configure.ac by autoheader. */ /* don't have O_BINARY */ #undef HAVE_DECL_O_BINARY /* have exslt*XpathCtxtRegister() */ #undef HAVE_EXSLT_XPATH_REGISTER /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `lstat' function. */ #undef HAVE_LSTAT /* Define to 1 if your system has a GNU libc compatible `malloc' function, and to 0 otherwise. */ #undef HAVE_MALLOC /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if your system has a GNU libc compatible `realloc' function, and to 0 otherwise. */ #undef HAVE_REALLOC /* Define to 1 if you have the `setmode' function. */ #undef HAVE_SETMODE /* Define to 1 if you have the `stat' function. */ #undef HAVE_STAT /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if `lstat' dereferences a symlink specified with a trailing slash. */ #undef LSTAT_FOLLOWS_SLASHED_SYMLINK /* Define to 1 if your C compiler doesn't accept -c and -o together. */ #undef NO_MINUS_C_MINUS_O /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Using the Win32 Socket implementation */ #undef _WINSOCKAPI_ /* needed to get lstat declaration in -ansi mode */ #undef _XOPEN_SOURCE /* Define to rpl_malloc if the replacement function should be used. */ #undef malloc /* Define to `int' if does not define. */ #undef mode_t /* Define to rpl_realloc if the replacement function should be used. */ #undef realloc /* Define to `unsigned int' if does not define. */ #undef size_t xmlstarlet-1.5.0/src/0000755000175000017500000000000012166350421011504 500000000000000xmlstarlet-1.5.0/src/xml_depyx.c0000644000175000017500000001474612011744543013616 00000000000000/* $Id: xml_depyx.c,v 1.8 2005/03/12 03:24:23 mgrouch Exp $ */ /* XMLStarlet: Command Line Toolkit to query/edit/check/transform XML documents Copyright (c) 2002 Mikhail Grushinskiy. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include #include #include #include "xmlstar.h" #include "escape.h" #define INSZ 4*1024 static void depyxUsage(int argc, char **argv, exit_status status) { extern void fprint_depyx_usage(FILE* o, const char* argv0); extern const char more_info[]; FILE *o = (status == EXIT_SUCCESS)? stdout : stderr; fprint_depyx_usage(o, argv[0]); fprintf(o, "%s", more_info); exit(status); } /** * Decode PYX string * */ void pyxDecode(char *str, xml_C14NNormalizationMode mode) { while (*str) { if ((*str == '\\') && (*(str+1) == 'n')) { printf("\n"); str++; } else if ((*str == '\\') && (*(str+1) == 't')) { printf("\t"); str++; } else if ((*str == '\\') && (*(str+1) == '\\')) { printf("\\"); str++; } else { if ((*str == '<') && ((mode == XML_C14N_NORMALIZE_ATTR) || (mode == XML_C14N_NORMALIZE_TEXT))) { printf("<"); } else if ((*str == '>') && (mode == XML_C14N_NORMALIZE_TEXT)) { printf(">"); } else if ((*str == '&') && ((mode == XML_C14N_NORMALIZE_ATTR) || (mode == XML_C14N_NORMALIZE_TEXT))) { printf("&"); } else if ((*str == '"') && (mode == XML_C14N_NORMALIZE_ATTR)) { printf("""); } else { printf("%c", *str); } } str++; } } /** * Decode PYX file * */ int pyxDePyx(char *file) { static char line[INSZ]; FILE *in = stdin; if (strcmp(file, "-")) { in = fopen(file, "r"); if (in == NULL) { fprintf(stderr, "error: could not open: %s\n", file); exit(EXIT_BAD_FILE); } } while (!feof(in)) { if (fgets(line, INSZ - 1, in)) { if(line[strlen(line)-1] == '\n') line[strlen(line)-1] = '\0'; while (line[0] == '(') { printf("<%s", line+1); if (!feof(in)) { if (fgets(line, INSZ - 1, in)) { if(line[strlen(line)-1] == '\n') line[strlen(line)-1] = '\0'; while(line[0] == 'A') /* attribute */ { char *value; printf(" "); value = line+1; while(*value && (*value != ' ')) { printf("%c", *value); value++; } if (*value == ' ') { value++; printf("=\""); pyxDecode(value, XML_C14N_NORMALIZE_ATTR); /* attribute value */ printf("\""); } if (!feof(in)) { if (fgets(line, INSZ - 1, in)) { if(line[strlen(line)-1] == '\n') line[strlen(line)-1] = '\0'; } } } printf(">"); } } } if (line[0] == '-') { /* text */ pyxDecode(line+1, XML_C14N_NORMALIZE_TEXT); } else if (line[0] == '?') { /* processing instruction */ printf(""); printf("\n"); /* is this correct? */ } else if (line[0] == 'D') { /* processing instruction */ printf(""); printf("\n"); /* is this correct? */ } else if (line[0] == 'C') { /* comment */ printf(""); printf("\n"); /* is this correct? */ } else if (line[0] == '[') { /* CDATA */ printf(""); printf("\n"); /* is this correct? */ } else if (line[0] == ')') { printf("", line+1); } } } return EXIT_SUCCESS; } /** * Main function for 'de-PYX' * */ int depyxMain(int argc, char **argv) { int ret = EXIT_SUCCESS; if ((argc >= 3) && (!strcmp(argv[2], "-h") || !strcmp(argv[2], "--help"))) { depyxUsage(argc, argv, EXIT_SUCCESS); } else if (argc == 3) { ret = pyxDePyx(argv[2]); } else if (argc == 2) { ret = pyxDePyx("-"); } else { depyxUsage(argc, argv, EXIT_BAD_ARGS); } printf("\n"); return ret; } xmlstarlet-1.5.0/src/elem-usage.txt0000644000175000017500000000056612000674564014224 00000000000000XMLStarlet Toolkit: Display element structure of XML document Usage: PROG el [] where - input XML document file name (stdin is used if missing) is one of: -a - show attributes as well -v - show attributes and their values -u - print out sorted unique lines -d - print out sorted unique lines up to depth xmlstarlet-1.5.0/src/escape-usage.txt0000644000175000017500000000033512000674664014535 00000000000000XMLStarlet Toolkit: Escape special XML characters Usage: PROG esc [] [] where are --help - print usage (TODO: more to be added in future) if is missing stdin is used instead. xmlstarlet-1.5.0/src/escape.h0000644000175000017500000000402511470002241013025 00000000000000/* $Id: escape.h,v 1.2 2005/03/12 03:24:23 mgrouch Exp $ */ #ifndef __ESCAPE_H #define __ESCAPE_H /* XMLStarlet: Command Line Toolkit to query/edit/check/transform XML documents Copyright (c) 2004 Mikhail Grushinskiy. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ typedef enum { XML_C14N_NORMALIZE_ATTR = 0, XML_C14N_NORMALIZE_COMMENT = 1, XML_C14N_NORMALIZE_PI = 2, XML_C14N_NORMALIZE_TEXT = 3, XML_C14N_NORMALIZE_NOTHING = 4 } xml_C14NNormalizationMode; extern xmlChar *xml_C11NNormalizeString(const xmlChar * input, xml_C14NNormalizationMode mode); #define xml_C11NNormalizeAttr( a ) \ xml_C11NNormalizeString((a), XML_C14N_NORMALIZE_ATTR) #define xml_C11NNormalizeComment( a ) \ xml_C11NNormalizeString((a), XML_C14N_NORMALIZE_COMMENT) #define xml_C11NNormalizePI( a ) \ xml_C11NNormalizeString((a), XML_C14N_NORMALIZE_PI) #define xml_C11NNormalizeText( a ) \ xml_C11NNormalizeString((a), XML_C14N_NORMALIZE_TEXT) #endif /* __ESCAPE_H */ xmlstarlet-1.5.0/src/ls-usage.txt0000644000175000017500000000022512000674564013710 00000000000000XMLStarlet Toolkit: List directory as XML Usage: PROG ls [ | --help ] Lists current directory in XML format. Time is shown per ISO 8601 spec. xmlstarlet-1.5.0/src/xml_elem.c0000644000175000017500000001742012011744543013377 00000000000000/* $Id: xml_elem.c,v 1.23 2004/11/21 23:40:40 mgrouch Exp $ */ /* XMLStarlet: Command Line Toolkit to query/edit/check/transform XML documents Copyright (c) 2002-2004 Mikhail Grushinskiy. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include #include #include #include #include "xmlstar.h" #include "escape.h" /* TODO: 2. Option to display this only for nodes matching an XPATH expression -p so it will be able to deal with subtrees as well */ typedef struct _elOptions { int show_attr; /* show attributes */ int show_attr_and_val; /* show attributes and values */ int sort_uniq; /* do sort and uniq on output */ int check_depth; /* limit depth */ } elOptions; static elOptions elOps; static xmlHashTablePtr uniq = NULL; static xmlChar *curXPath = NULL; /** * Display usage syntax */ void elUsage(int argc, char **argv, exit_status status) { extern void fprint_elem_usage(FILE* o, const char* argv0); extern const char more_info[]; FILE *o = (status == EXIT_SUCCESS)? stdout : stderr; fprint_elem_usage(o, argv[0]); fprintf(o, "%s", more_info); exit(status); } /** * read file and print element paths */ int parse_xml_file(const char *filename) { int ret, prev_depth = 0; xmlTextReaderPtr reader; for (reader = xmlReaderForFile(filename, NULL, 0);;) { int depth; const xmlChar *name; xmlReaderTypes type; if (!reader) { fprintf(stderr, "couldn't read file '%s'\n", filename); exit(EXIT_BAD_FILE); } ret = xmlTextReaderRead(reader); if (ret <= 0) break; type = xmlTextReaderNodeType(reader); depth = xmlTextReaderDepth(reader); name = xmlTextReaderConstName(reader); if (type != XML_READER_TYPE_ELEMENT) continue; while (curXPath && depth <= prev_depth) { xmlChar *slash = BAD_CAST strrchr((char*) curXPath, '/'); if (slash) *slash = '\0'; prev_depth--; } prev_depth = depth; if (depth > 0) curXPath = xmlStrcat(curXPath, BAD_CAST "/"); curXPath = xmlStrcat(curXPath, name); if (elOps.show_attr) { int have_attr; fprintf(stdout, "%s\n", curXPath); for (have_attr = xmlTextReaderMoveToFirstAttribute(reader); have_attr; have_attr = xmlTextReaderMoveToNextAttribute(reader)) { const xmlChar *aname = xmlTextReaderConstName(reader); fprintf(stdout, "%s/@%s\n", curXPath, aname); } } else if (elOps.show_attr_and_val) { fprintf(stdout, "%s", curXPath); if (xmlTextReaderHasAttributes(reader)) { int have_attr, first = 1; fprintf(stdout, "["); for (have_attr = xmlTextReaderMoveToFirstAttribute(reader); have_attr; have_attr = xmlTextReaderMoveToNextAttribute(reader)) { const xmlChar *aname = xmlTextReaderConstName(reader), *avalue = xmlTextReaderConstValue(reader); char quote; if (!first) fprintf(stdout, " and "); first = 0; quote = xmlStrchr(avalue, '\'')? '"' : '\''; fprintf(stdout, "@%s=%c%s%c", aname, quote, avalue, quote); } fprintf(stdout, "]"); } fprintf(stdout, "\n"); } else if (elOps.sort_uniq) { if ((elOps.check_depth == 0) || (elOps.check_depth != 0 && depth < elOps.check_depth)) { xmlHashAddEntry(uniq, curXPath, (void*) 1); } } else fprintf(stdout, "%s\n", curXPath); } return ret == -1? EXIT_LIB_ERROR : ret; } /** * Initialize options values */ void elInitOptions(elOptions *ops) { ops->show_attr = 0; ops->show_attr_and_val = 0; ops->sort_uniq = 0; ops->check_depth = 0; } typedef struct { xmlChar **array; int offset; } ArrayDest; /** * put @name into @data->array[@data->offset] */ static void hash_key_put(void *payload, void *data, xmlChar *name) { ArrayDest *dest = data; dest->array[dest->offset++] = name; } /** * a compare function for qsort * takes pointers to 2 xmlChar* and compares them */ static int compare_string_ptr(const void *p1, const void *p2) { typedef xmlChar const *const xmlCChar; xmlCChar *str1 = p1, *str2 = p2; return xmlStrcmp(*str1, *str2); } /** * This is the main function for 'el' option */ int elMain(int argc, char **argv) { int errorno = 0; char* inp_file = "-"; if (argc <= 1) elUsage(argc, argv, EXIT_BAD_ARGS); elInitOptions(&elOps); if (argc == 2) errorno = parse_xml_file("-"); else { if (!strcmp(argv[2], "--help") || !strcmp(argv[2], "-h") || !strcmp(argv[2], "-?") || !strcmp(argv[2], "-Z")) { elUsage(argc, argv, EXIT_SUCCESS); } else if (!strcmp(argv[2], "-a")) { elOps.show_attr = 1; if (argc >= 4) inp_file = argv[3]; errorno = parse_xml_file(inp_file); } else if (!strcmp(argv[2], "-v")) { elOps.show_attr_and_val = 1; if (argc >= 4) inp_file = argv[3]; errorno = parse_xml_file(inp_file); } else if (!strcmp(argv[2], "-u")) { elOps.sort_uniq = 1; if (argc >= 4) inp_file = argv[3]; uniq = xmlHashCreate(0); errorno = parse_xml_file(inp_file); } else if (!strncmp(argv[2], "-d", 2)) { elOps.check_depth = atoi(argv[2]+2); /* printf("Checking depth (%d)\n", elOps.check_depth); */ elOps.sort_uniq = 1; if (argc >= 4) inp_file = argv[3]; uniq = xmlHashCreate(0); errorno = parse_xml_file(inp_file); } else if (argv[2][0] != '-') { errorno = parse_xml_file(argv[2]); } else elUsage(argc, argv, EXIT_BAD_ARGS); } if (uniq) { int i; ArrayDest lines; lines.array = xmlMalloc(sizeof(xmlChar*) * xmlHashSize(uniq)); lines.offset = 0; xmlHashScan(uniq, hash_key_put, &lines); qsort(lines.array, lines.offset, sizeof(xmlChar*), compare_string_ptr); for (i = 0; i < lines.offset; i++) { printf("%s\n", lines.array[i]); } xmlFree(lines.array); xmlHashFree(uniq, NULL); } return errorno; } xmlstarlet-1.5.0/src/xml_select.c0000644000175000017500000007663612161331275013752 00000000000000/* $Id: xml_select.c,v 1.67 2005/01/07 02:02:13 mgrouch Exp $ */ /* XMLStarlet: Command Line Toolkit to query/edit/check/transform XML documents Copyright (c) 2002-2004 Mikhail Grushinskiy. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include #include #include #include #include #include #include #include #include "xmlstar.h" #include "trans.h" /* max length of xmlstarlet supplied (ie not from command line) namespaces * currently xalanredirect is longest, at 13 characters*/ #define MAX_NS_PREFIX_LEN 20 typedef struct { const xmlChar *href, *prefix; } NsEntry; static const NsEntry ns_entries[] = { { BAD_CAST "http://exslt.org/common", BAD_CAST "exslt" }, { BAD_CAST "http://exslt.org/math", BAD_CAST "math" }, { BAD_CAST "http://exslt.org/dates-and-times", BAD_CAST "date" }, { BAD_CAST "http://exslt.org/functions", BAD_CAST "func" }, { BAD_CAST "http://exslt.org/sets", BAD_CAST "set" }, { BAD_CAST "http://exslt.org/strings", BAD_CAST "str" }, { BAD_CAST "http://exslt.org/dynamic", BAD_CAST "dyn" }, { BAD_CAST "http://icl.com/saxon", BAD_CAST "saxon" }, { BAD_CAST "org.apache.xalan.xslt.extensions.Redirect", BAD_CAST "xalanredirect"}, /* see MAX_NS_PREFIX_LEN */ { BAD_CAST "http://www.jclark.com/xt", BAD_CAST "xt" }, { BAD_CAST "http://xmlsoft.org/XSLT/namespace", BAD_CAST "libxslt" }, { BAD_CAST "http://xmlsoft.org/XSLT/", BAD_CAST "test" }, }; static const NsEntry* lookup_ns_entry(const char *prefix, int len) { int i; for (i = 0; i < COUNT_OF(ns_entries); i++) { if (xmlStrncmp(BAD_CAST prefix, ns_entries[i].prefix, len) == 0) return &ns_entries[i]; } return NULL; } typedef struct _selOptions { int quiet; /* No output */ int printXSLT; /* Display prepared XSLT */ int printRoot; /* Print root element in output (if XML) */ int outText; /* Output is text */ int indent; /* Indent output */ int noblanks; /* Remove insignificant spaces from XML tree */ int no_omit_decl; /* Print XML declaration line */ int nonet; /* refuse to fetch DTDs or entities over network */ const xmlChar *encoding; /* the "encoding" attribute on the stylesheet's */ } selOptions; typedef selOptions *selOptionsPtr; typedef enum { TARG_NONE = 0, TARG_SORT_OP, TARG_XPATH, TARG_ATTR_STRING, TARG_STRING, TARG_VAR, /* template args below don't consume any command line args */ TARG_NEWLINE, TARG_NO_CMDLINE = TARG_NEWLINE, TARG_INP_NAME, TARG_STR_NAME_SELECT } template_argument_type; typedef struct { const xmlChar *attrname; template_argument_type type; } template_option_argument; #define TEMPLATE_OPT_MAX_ARGS 2 typedef struct { char shortopt; const char *longopt; const xmlChar *xslname; template_option_argument arguments[TEMPLATE_OPT_MAX_ARGS]; int nest; } template_option; static const template_option OPT_TEMPLATE = { 't', "template" }, OPT_COPY_OF = { 'c', "copy-of", BAD_CAST "copy-of", {{BAD_CAST "select", TARG_XPATH}}, 0 }, OPT_VALUE_OF = { 'v', "value-of", BAD_CAST "with-param", {{BAD_CAST "name", TARG_STR_NAME_SELECT}, {BAD_CAST "select", TARG_XPATH}}, -1 }, OPT_OUTPUT = { 'o', "output", BAD_CAST "text", {{NULL, TARG_STRING}}, 0 }, OPT_NL = { 'n', "nl", BAD_CAST "value-of", {{NULL, TARG_NEWLINE}}, 0 }, OPT_INP_NAME = { 'f', "inp-name", BAD_CAST "copy-of", {{NULL, TARG_INP_NAME}}, 0 }, OPT_MATCH = { 'm', "match", BAD_CAST "for-each", {{BAD_CAST "select", TARG_XPATH}}, 1 }, OPT_IF = { 'i', "if", BAD_CAST"when", {{BAD_CAST "test", TARG_XPATH}}, 1 }, OPT_ELIF = { 0, "elif", BAD_CAST "when", {{BAD_CAST "test", TARG_XPATH}}, 1 }, OPT_ELSE = { 0, "else", BAD_CAST "otherwise", {{NULL}}, 1 }, OPT_ELEM = { 'e', "elem", BAD_CAST "element", {{BAD_CAST "name", TARG_ATTR_STRING}}, 1 }, OPT_ATTR = { 'a', "attr", BAD_CAST "attribute", {{BAD_CAST "name", TARG_ATTR_STRING}}, 1 }, OPT_BREAK = { 'b', "break", NULL, {{NULL}}, -1 }, OPT_SORT = { 's', "sort", BAD_CAST "sort", {{NULL, TARG_SORT_OP}, {BAD_CAST "select", TARG_XPATH}}, 0 }, OPT_VAR = { 0, "var", BAD_CAST "variable", {{BAD_CAST "name", TARG_VAR}}, 1}, *TEMPLATE_OPTIONS[] = { &OPT_TEMPLATE, &OPT_COPY_OF, &OPT_VALUE_OF, &OPT_OUTPUT, &OPT_NL, &OPT_INP_NAME, &OPT_MATCH, &OPT_IF, &OPT_ELIF, &OPT_ELSE, &OPT_ELEM, &OPT_ATTR, &OPT_BREAK, &OPT_SORT, &OPT_VAR }; void caseSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts, int nbsorts); /** * Print small help for command line options */ void selUsage(const char *argv0, exit_status status) { extern void fprint_select_usage(FILE* out, const char* argv0); extern const char more_info[]; extern const char libxslt_more_info[]; FILE *o = (status == EXIT_SUCCESS)? stdout : stderr; fprint_select_usage(o, argv0); fprintf(o, "%s", more_info); fprintf(o, "%s", libxslt_more_info); exit(status); } /** * Initialize global command line options */ void selInitOptions(selOptionsPtr ops) { ops->quiet = globalOptions.quiet; ops->printXSLT = 0; ops->printRoot = 0; ops->outText = 0; ops->indent = 0; ops->noblanks = 0; ops->no_omit_decl = 0; ops->nonet = 1; ops->encoding = NULL; } /** * Parse global command line options */ int selParseOptions(selOptionsPtr ops, int argc, char **argv) { int i; i = 2; while((i < argc) && (strcmp(argv[i], "-t")) && strcmp(argv[i], "--template")) { if (!strcmp(argv[i], "-C")) { ops->printXSLT = 1; } else if (!strcmp(argv[i], "-Q") || !strcmp(argv[i], "--quiet")) { ops->quiet = 1; } else if (!strcmp(argv[i], "-B") || !strcmp(argv[i], "--noblanks")) { ops->noblanks = 1; } else if (!strcmp(argv[i], "-T") || !strcmp(argv[i], "--text")) { ops->outText = 1; } else if (!strcmp(argv[i], "-R") || !strcmp(argv[i], "--root")) { ops->printRoot = 1; } else if (!strcmp(argv[i], "-I") || !strcmp(argv[i], "--indent")) { ops->indent = 1; } else if (!strcmp(argv[i], "-D") || !strcmp(argv[i], "--xml-decl")) { ops->no_omit_decl = 1; } else if (!strcmp(argv[i], "-E") || !strcmp(argv[i], "--encode")) { if ((i+1) < argc) { if (argv[i + 1][0] == '-') { fprintf(stderr, "-E option requires argument ex: (utf-8, unicode...)\n"); exit(EXIT_BAD_ARGS); } else { ops->encoding = BAD_CAST argv[i + 1]; } } else { fprintf(stderr, "-E option requires argument ex: (utf-8, unicode...)\n"); exit(EXIT_BAD_ARGS); } } else if (!strcmp(argv[i], "--net")) { ops->nonet = 0; } else if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h") || !strcmp(argv[i], "-?") || !strcmp(argv[i], "-Z")) { selUsage(argv[0], EXIT_SUCCESS); } i++; } return i; } /** * Search for namespace references in @xpath and add them to @root. Note that we * might pickup things that aren't actually namespace references because we * don't have a full XPath parser. That's okay, an extra namespace definition * won't hurt anyone. */ static void checkNsRefs(xmlNodePtr root, const char *xpath) { const char *colon; for (colon = xpath; colon; colon++) { int ns_idx = -1; colon = strchr(colon, ':'); if (!colon) break; for (;; ns_idx--) { if (&colon[ns_idx] < xpath ||!isalnum(colon[ns_idx])) { const NsEntry *ns; ns_idx++; ns = lookup_ns_entry(&colon[ns_idx], -ns_idx); if (ns) xmlNewNs(root, ns->href, ns->prefix); break; } if (-ns_idx >= MAX_NS_PREFIX_LEN) break; } } } /** * Prepare XSLT template based on command line options * Assumes start points to -t option */ int selGenTemplate(xmlNodePtr root, xmlNodePtr template_node, xmlNsPtr xslns, selOptionsPtr ops, int* use_inputfile, int* use_value_of, int* lastTempl, int start, int argc, char **argv) { int i; int templateEmpty; int nextTempl; const template_option *targ = NULL; xmlNodePtr node = template_node; if (strcmp(argv[start], "-t") != 0 && strcmp(argv[start], "--template") != 0) { fprintf(stderr, "not at the beginning of template\n"); abort(); } *lastTempl = 0; templateEmpty = 1; nextTempl = 0; i = start + 1; while(i < argc) { xmlNodePtr newnode = NULL; const template_option *newtarg = NULL; int j; int nesting; if (argv[i][0] == '-' && argv[i][1] != '\0') { for (j = 0; j < sizeof(TEMPLATE_OPTIONS)/sizeof(*TEMPLATE_OPTIONS); j++) { newtarg = TEMPLATE_OPTIONS[j]; if (argv[i][1] == '-' && strcmp(newtarg->longopt, &argv[i][2]) == 0) goto found_option; /* long option */ else if(newtarg->shortopt == argv[i][1]) goto found_option; /* short option */ } fprintf(stderr, "unrecognized option: %s\n", argv[i]); exit(EXIT_BAD_ARGS); } else { break; } found_option: if (newtarg == &OPT_SORT && (targ != &OPT_MATCH && targ != &OPT_SORT)) { fprintf(stderr, "sort(s) must follow match\n"); exit(EXIT_BAD_ARGS); } else if (newtarg == &OPT_TEMPLATE) { nextTempl = 1; i--; break; } else if (newtarg == &OPT_IF) { node = xmlNewChild(node, xslns, BAD_CAST "choose", NULL); node->_private = (void*) &OPT_IF; } else if (newtarg == &OPT_ELIF || newtarg == &OPT_ELSE) { node = node->parent; if (node->_private != &OPT_IF) { fprintf(stderr, "else without if\n"); exit(EXIT_BAD_ARGS); } } else if (newtarg == &OPT_VALUE_OF) { node = xmlNewChild(node, xslns, BAD_CAST "call-template", NULL); xmlNewProp(node, BAD_CAST "name", BAD_CAST "value-of-template"); node->_private = (void*) &OPT_VALUE_OF; *use_value_of = 1; /* value-of-template uses exslt:node-set */ checkNsRefs(root, "exslt:node-set"); } i++; templateEmpty = 0; nesting = newtarg->nest; if (newtarg->xslname) newnode = xmlNewChild(node, xslns, newtarg->xslname, NULL); for (j = 0; j < TEMPLATE_OPT_MAX_ARGS && newtarg->arguments[j].type; j++) { if (i >= argc && newtarg->arguments[j].type < TARG_NO_CMDLINE) selUsage(argv[0], EXIT_BAD_ARGS); switch (newtarg->arguments[j].type) { case TARG_VAR: { char *equals = strchr(argv[i], '='); if (equals) { *equals = '\0'; xmlNewProp(newnode, BAD_CAST "select", BAD_CAST (&equals[1])); nesting = 0; } xmlNewProp(newnode, newtarg->arguments[j].attrname, BAD_CAST argv[i]); break; } case TARG_XPATH: checkNsRefs(root, argv[i]); case TARG_ATTR_STRING: xmlNewProp(newnode, newtarg->arguments[j].attrname, BAD_CAST argv[i]); break; case TARG_STRING: xmlNodeAddContent(newnode, BAD_CAST argv[i]); break; case TARG_NEWLINE: xmlNewProp(newnode, BAD_CAST "select", BAD_CAST "'\n'"); break; case TARG_STR_NAME_SELECT: xmlNewProp(newnode, BAD_CAST "name", BAD_CAST "select"); break; case TARG_INP_NAME: *use_inputfile = 1; xmlNewProp(newnode, BAD_CAST "select", BAD_CAST "$inputFile"); break; case TARG_SORT_OP: { char order, data_type, case_order; int nread; nread = sscanf(argv[i], "%c:%c:%c", &order, &data_type, &case_order); if (nread != 3) selUsage(argv[0], EXIT_BAD_ARGS); /* TODO: allow missing letters */ if (order == 'A' || order == 'D') xmlNewProp(newnode, BAD_CAST "order", BAD_CAST (order == 'A'? "ascending" : "descending")); if (data_type == 'N' || data_type == 'T') xmlNewProp(newnode, BAD_CAST "data-type", BAD_CAST (data_type == 'N'? "number" : "text")); if (case_order == 'U' || case_order == 'L') xmlNewProp(newnode, BAD_CAST "case-order", BAD_CAST (case_order == 'U'? "upper-first" : "lower-first")); } break; default: assert(0); } if (newtarg->arguments[j].type < TARG_NO_CMDLINE) i++; } switch (nesting) { case -1: do { node = node->parent; } while(node->_private); break; case 0: break; case 1: node = newnode; break; default: assert(0); } targ = newtarg; } if (templateEmpty) { fprintf(stderr, "error in arguments:"); fprintf(stderr, " -t or --template option must be followed by"); fprintf(stderr, " --match or other options\n"); exit(EXIT_BAD_ARGS); } if (!nextTempl) { if (i >= argc || argv[i][0] != '-' || strcmp(argv[i], "-") == 0) { *lastTempl = 1; return i; /* return index of next input filename */ } } /* return index to beginning of the next template */ return ++i; } /** * Prepare XSLT stylesheet based on command line options */ int selPrepareXslt(xmlDocPtr style, selOptionsPtr ops, xmlChar *ns_arr[], int start, int argc, char **argv) { int i, t, ns, use_inputfile = 0, use_value_of = 0; xmlNodePtr root, root_template = NULL; xmlNsPtr xslns; xmlBufferPtr attr_buf; root = xmlNewDocRawNode(style, NULL, BAD_CAST "stylesheet", NULL); xmlDocSetRootElement(style, root); xmlNewProp(root, BAD_CAST "version", BAD_CAST "1.0"); xslns = xmlNewNs(root, XSLT_NAMESPACE, BAD_CAST "xsl"); xmlSetNs(root, xslns); ns = 0; while(ns_arr[ns]) { xmlNewNs(root, ns_arr[ns+1], xmlStrlen(ns_arr[ns])?ns_arr[ns] : NULL); ns += 2; } cleanupNSArr(ns_arr); { xmlNodePtr output; output = xmlNewChild(root, xslns, BAD_CAST "output", NULL); xmlNewProp(output, BAD_CAST "omit-xml-declaration", BAD_CAST ((ops->no_omit_decl)?"no":"yes")); xmlNewProp(output, BAD_CAST "indent", BAD_CAST ((ops->indent)?"yes":"no")); if (ops->encoding) xmlNewProp(output, BAD_CAST "encoding", ops->encoding); if (ops->outText) xmlNewProp(output, BAD_CAST "method", BAD_CAST "text"); } for (i = start, t = 0; i < argc; i++) if(!strcmp(argv[i], "-t") || !strcmp(argv[i], "--template")) t++; /* * At least one -t option must be found */ if (t == 0) { fprintf(stderr, "error in arguments:"); fprintf(stderr, " no -t or --template options found\n"); exit(EXIT_BAD_ARGS); } if (t > 1) root_template = xmlNewChild(root, xslns, BAD_CAST "template", NULL); t = 0; i = start; while(i < argc) { if(!strcmp(argv[i], "-t") || !strcmp(argv[i], "--template")) { xmlNodePtr call_template, template; int lastTempl = 0; t++; template = xmlNewChild(root, xslns, BAD_CAST "template", NULL); if (root_template) { xmlChar num_buf[1+10+1]; /* t+maxnumber+NUL */ xmlStrPrintf(num_buf, sizeof num_buf, BAD_CAST "t%d", t); call_template = xmlNewChild(root_template, xslns, BAD_CAST "call-template", NULL); xmlNewProp(call_template, BAD_CAST "name", num_buf); xmlNewProp(template, BAD_CAST "name", num_buf); } else { root_template = template; } i = selGenTemplate(root, template, xslns, ops, &use_inputfile, &use_value_of, &lastTempl, i, argc, argv); if (lastTempl) break; } } if (!ops->outText && ops->printRoot) { xmlNodePtr result_root = root_template; xmlNodeSetName(result_root, BAD_CAST "xsl-select"); xmlSetNs(result_root, NULL); xmlUnlinkNode(result_root); root_template = xmlNewChild(root, xslns, BAD_CAST "template", NULL); xmlAddChild(root_template, result_root); } xmlNewProp(root_template, BAD_CAST "match", BAD_CAST "/"); attr_buf = xmlBufferCreate(); for (ns = 0; ns < COUNT_OF(ns_entries); ns++) { if (xmlSearchNs(NULL, root, ns_entries[ns].prefix)) { if (xmlBufferLength(attr_buf) != 0) xmlBufferWriteChar(attr_buf, " "); xmlBufferCat(attr_buf, ns_entries[ns].prefix); } } if (xmlBufferLength(attr_buf) != 0) xmlNewProp(root, BAD_CAST "extension-element-prefixes", xmlBufferContent(attr_buf)); xmlBufferFree(attr_buf); if (use_inputfile) { xmlNodePtr param; param = xmlNewChild(root, xslns, BAD_CAST "param", BAD_CAST "-"); xmlNewProp(param, BAD_CAST "name", BAD_CAST "inputFile"); } if (use_value_of) { xmlNodePtr value_of_template, for_each, value_of, param; /* */ value_of_template = xmlNewChild(root, xslns, BAD_CAST "template", NULL); xmlNewProp(value_of_template, BAD_CAST "name", BAD_CAST "value-of-template"); /* */ param = xmlNewChild(value_of_template, xslns, BAD_CAST "param", NULL); xmlNewProp(param, BAD_CAST "name", BAD_CAST "select"); /* */ value_of = xmlNewChild(value_of_template, xslns, BAD_CAST "value-of", NULL); xmlNewProp(value_of, BAD_CAST "select", BAD_CAST "$select"); /* */ for_each = xmlNewChild(value_of_template, xslns, BAD_CAST "for-each", NULL); xmlNewProp(for_each, BAD_CAST "select", BAD_CAST "exslt:node-set($select)[position()>1]"); /* */ value_of = xmlNewChild(for_each, xslns, BAD_CAST "value-of", NULL); xmlNewProp(value_of, BAD_CAST "select", BAD_CAST "'\n'"); /* */ value_of = xmlNewChild(for_each, xslns, BAD_CAST "value-of", NULL); xmlNewProp(value_of, BAD_CAST "select", BAD_CAST "."); } return i; } /** * copy namespace definitions from @root to @style_tree */ static void extract_ns_defs(xmlNodePtr root, xmlDocPtr style_tree) { xmlNsPtr nsDef; xmlNodePtr style_root = xmlDocGetRootElement(style_tree); if (!root) return; for (nsDef = root->nsDef; nsDef; nsDef = nsDef->next) { xmlNewNs(style_root, nsDef->href, nsDef->prefix); if (nsDef->prefix == NULL) default_ns = nsDef->href; } if (default_ns) { xmlNewNs(style_root, default_ns, BAD_CAST "_"); xmlNewNs(style_root, default_ns, BAD_CAST "DEFAULT"); } } static void do_file(const char *filename, xmlDocPtr style_tree, int xml_options, const selOptions *ops, xsltOptions *xsltOps, int *status) { xmlChar *value; xmlDocPtr doc; /* Pass input file name as predefined parameter 'inputFile' */ const char *params[2+1] = { "inputFile" }; value = xmlStrdup((const xmlChar *)"'"); value = xmlStrcat(value, (const xmlChar *)filename); value = xmlStrcat(value, (const xmlChar *)"'"); params[1] = (char *) value; doc = xmlReadFile(filename, NULL, xml_options); if (doc != NULL) { xmlDocPtr res; static xsltStylesheetPtr style = NULL; if (!style) { extract_ns_defs(xmlDocGetRootElement(doc), style_tree); /* Parse XSLT stylesheet */ style = xsltParseStylesheetDoc(style_tree); if (!style) exit(EXIT_LIB_ERROR); } res = xsltTransform(xsltOps, doc, params, style, filename); if (!ops->quiet && (!res || xsltSaveResultToFile(stdout, res, style) < 0)) { *status = EXIT_LIB_ERROR; } else if ((ops->quiet || *status == EXIT_FAILURE) && res && res->children) { *status = EXIT_SUCCESS; if (ops->quiet) exit(EXIT_SUCCESS); } } else { *status = EXIT_BAD_FILE; } xmlFree(value); } /** * This is the main function for 'select' option */ int selMain(int argc, char **argv) { static xsltOptions xsltOps; static selOptions ops; int start, i, n, status = EXIT_FAILURE; int nCount = 0; xmlDocPtr style_tree; int xml_options = 0; if (argc <= 2) selUsage(argv[0], EXIT_BAD_ARGS); selInitOptions(&ops); xsltInitOptions(&xsltOps); start = selParseOptions(&ops, argc, argv); xml_options |= XML_PARSE_NOENT; /* substitute entities */ xml_options |= XML_PARSE_DTDATTR; /* use default attrib values */ xml_options |= ops.nonet? XML_PARSE_NONET : 0; xsltOps.nonet = ops.nonet; xsltOps.noblanks = ops.noblanks; xsltInitLibXml(&xsltOps); xsltSetSortFunc(caseSortFunction); /* set parameters */ parseNSArr(ns_arr, &nCount, start, argv+2); style_tree = xmlNewDoc(NULL); i = selPrepareXslt(style_tree, &ops, ns_arr, start, argc, argv); if (ops.printXSLT) { if (i < argc) { xmlTextReaderPtr reader = xmlReaderForFile(argv[i], NULL, xml_options); xmlTextReaderRead(reader); extract_ns_defs(xmlTextReaderCurrentNode(reader), style_tree); xmlTextReaderClose(reader); } xmlDocFormatDump(stdout, style_tree, 1); exit(EXIT_SUCCESS); } for (n=i; nfloatval)) { if (xmlXPathIsNaN(obj2->floatval)) tst = 0; else tst = -1; } else if (xmlXPathIsNaN(obj2->floatval)) tst = 1; else if (obj1->floatval == obj2->floatval) tst = 0; else if (obj1->floatval > obj2->floatval) tst = 1; else tst = -1; } else { tst = xmlStrcasecmp(obj1->stringval, obj2->stringval); if (tst == 0) { tst = xmlStrcmp(obj1->stringval, obj2->stringval); if (lower_first) tst = -tst; } } if (descending) tst = -tst; return tst; } /** * xsltSortFunction: * @ctxt: a XSLT process context * @sorts: array of sort nodes * @nbsorts: the number of sorts in the array * * reorder the current node list accordingly to the set of sorting * requirement provided by the arry of nodes. * * like xsltDefaultSortFunction, but respect case-order attribute */ void caseSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts, int nbsorts) { #ifdef XSLT_REFACTORED xsltStyleItemSortPtr comp; #else xsltStylePreCompPtr comp; #endif xmlXPathObjectPtr *resultsTab[XSLT_MAX_SORT]; xmlXPathObjectPtr *results = NULL, *res; xmlNodeSetPtr list = NULL; int descending, number, desc, numb; int len = 0; int i, j, incr; int tst; int depth; xmlNodePtr node; xmlXPathObjectPtr tmp; int tempstype[XSLT_MAX_SORT], temporder[XSLT_MAX_SORT], tempcaseorder[XSLT_MAX_SORT]; if ((ctxt == NULL) || (sorts == NULL) || (nbsorts <= 0) || (nbsorts >= XSLT_MAX_SORT)) return; if (sorts[0] == NULL) return; comp = sorts[0]->psvi; if (comp == NULL) return; list = ctxt->nodeList; if ((list == NULL) || (list->nodeNr <= 1)) return; /* nothing to do */ for (j = 0; j < nbsorts; j++) { comp = sorts[j]->psvi; tempstype[j] = 0; if ((comp->stype == NULL) && (comp->has_stype != 0)) { comp->stype = xsltEvalAttrValueTemplate(ctxt, sorts[j], (const xmlChar *) "data-type", XSLT_NAMESPACE); if (comp->stype != NULL) { tempstype[j] = 1; if (xmlStrEqual(comp->stype, (const xmlChar *) "text")) comp->number = 0; else if (xmlStrEqual(comp->stype, (const xmlChar *) "number")) comp->number = 1; else { xsltTransformError(ctxt, NULL, sorts[j], "xsltDoSortFunction: no support for data-type = %s\n", comp->stype); comp->number = 0; /* use default */ } } } temporder[j] = 0; if ((comp->order == NULL) && (comp->has_order != 0)) { comp->order = xsltEvalAttrValueTemplate(ctxt, sorts[j], (const xmlChar *) "order", XSLT_NAMESPACE); if (comp->order != NULL) { temporder[j] = 1; if (xmlStrEqual(comp->order, (const xmlChar *) "ascending")) comp->descending = 0; else if (xmlStrEqual(comp->order, (const xmlChar *) "descending")) comp->descending = 1; else { xsltTransformError(ctxt, NULL, sorts[j], "xsltDoSortFunction: invalid value %s for order\n", comp->order); comp->descending = 0; /* use default */ } } } tempcaseorder[j] = 0; if ((comp->case_order == NULL) /* && (comp->has_case_order != 0) */) { comp->case_order = xsltEvalAttrValueTemplate(ctxt, sorts[j], (const xmlChar *) "case-order", XSLT_NAMESPACE); if (comp->case_order != NULL) { tempcaseorder[j] = 1; if (xmlStrEqual(comp->case_order, BAD_CAST "upper-first")) comp->lower_first = 0; else if (xmlStrEqual(comp->case_order, BAD_CAST "lower-first")) comp->lower_first = 1; else { xsltTransformError(ctxt, NULL, sorts[j], "xsltDoSortFunction: invalid value %s for case-order\n", comp->case_order); comp->lower_first = 0; /* use default */ } } } } len = list->nodeNr; resultsTab[0] = xsltComputeSortResult(ctxt, sorts[0]); for (i = 1;i < XSLT_MAX_SORT;i++) resultsTab[i] = NULL; results = resultsTab[0]; comp = sorts[0]->psvi; descending = comp->descending; number = comp->number; if (results == NULL) return; /* Shell's sort of node-set */ for (incr = len / 2; incr > 0; incr /= 2) { for (i = incr; i < len; i++) { j = i - incr; if (results[i] == NULL) continue; while (j >= 0) { if (results[j] == NULL) tst = 1; else tst = compareFunction(results[j], results[j + incr], number, comp->lower_first, descending); if (tst == 0) { /* * Okay we need to use multi level sorts */ depth = 1; while (depth < nbsorts) { if (sorts[depth] == NULL) break; comp = sorts[depth]->psvi; if (comp == NULL) break; desc = comp->descending; numb = comp->number; /* * Compute the result of the next level for the * full set, this might be optimized ... or not */ if (resultsTab[depth] == NULL) resultsTab[depth] = xsltComputeSortResult(ctxt, sorts[depth]); res = resultsTab[depth]; if (res == NULL) break; if (res[j] == NULL) { if (res[j+incr] != NULL) tst = 1; } else { tst = compareFunction(res[j], res[j+incr], numb, comp->lower_first, desc); } /* * if we still can't differenciate at this level * try one level deeper. */ if (tst != 0) break; depth++; } } if (tst == 0) { tst = results[j]->index > results[j + incr]->index; } if (tst > 0) { tmp = results[j]; results[j] = results[j + incr]; results[j + incr] = tmp; node = list->nodeTab[j]; list->nodeTab[j] = list->nodeTab[j + incr]; list->nodeTab[j + incr] = node; depth = 1; while (depth < nbsorts) { if (sorts[depth] == NULL) break; if (resultsTab[depth] == NULL) break; res = resultsTab[depth]; tmp = res[j]; res[j] = res[j + incr]; res[j + incr] = tmp; depth++; } j -= incr; } else break; } } } for (j = 0; j < nbsorts; j++) { comp = sorts[j]->psvi; if (tempstype[j] == 1) { /* The data-type needs to be recomputed each time */ xmlFree((void *)(comp->stype)); comp->stype = NULL; } if (temporder[j] == 1) { /* The order needs to be recomputed each time */ xmlFree((void *)(comp->order)); comp->order = NULL; } if (tempcaseorder[j] == 1) { /* The case-order needs to be recomputed each time */ xmlFree((void *)(comp->case_order)); comp->case_order = NULL; } if (resultsTab[j] != NULL) { for (i = 0;i < len;i++) xmlXPathFreeObject(resultsTab[j][i]); xmlFree(resultsTab[j]); } } } xmlstarlet-1.5.0/src/validate-usage.txt0000644000175000017500000000172112000674564015065 00000000000000XMLStarlet Toolkit: Validate XML document(s) Usage: PROG val [ ... ] where -w or --well-formed - validate well-formedness only (default) -d or --dtd - validate against DTD --net - allow network access #ifdef LIBXML_SCHEMAS_ENABLED -s or --xsd - validate against XSD schema -E or --embed - validate using embedded DTD #endif #ifdef LIBXML_SCHEMAS_ENABLED -r or --relaxng - validate against Relax-NG schema #endif -e or --err - print verbose error messages on stderr -b or --list-bad - list only files which do not validate -g or --list-good - list only files which validate -q or --quiet - do not list files (return result code only) #ifdef LIBXML_SCHEMAS_ENABLED NOTE: XML Schemas are not fully supported yet due to its incomplete support in libxml2 (see http://xmlsoft.org) #endif xmlstarlet-1.5.0/src/unescape-usage.txt0000644000175000017500000000034112000674720015066 00000000000000XMLStarlet Toolkit: Unescape special XML characters Usage: PROG unesc [] [] where are --help - print usage (TODO: more to be added in future) if is missing stdin is used instead. xmlstarlet-1.5.0/src/xml_ls.c0000644000175000017500000001207012011744543013067 00000000000000/* $Id: xml_ls.c,v 1.17 2005/03/19 01:18:02 mgrouch Exp $ */ /* XMLStarlet: Command Line Toolkit to query/edit/check/transform XML documents Copyright (c) 2002-2004 Mikhail Grushinskiy. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include #include #include #include #include #include #include #include #include #include #include "xmlstar.h" #include "escape.h" #if !HAVE_LSTAT # if HAVE_STAT # define lstat stat # else /* TODO: #ifdef out code that uses stat instead */ # error "lstat() or stat() required" # endif #endif #ifndef S_ISLNK # define S_ISLNK(m) 0 #endif #ifndef S_ISSOCK # define S_ISSOCK(m) 0 #endif /** * Print small help for command line options */ void lsUsage(int argc, char **argv, exit_status status) { extern void fprint_ls_usage(FILE* o, const char* argv0); extern const char more_info[]; FILE *o = (status == EXIT_SUCCESS)? stdout : stderr; fprint_ls_usage(o, argv[0]); fprintf(o, "%s", more_info); exit(status); } const char * get_file_type(mode_t mode) { if (S_ISREG(mode)) return "f"; /* regular file */ else if (S_ISDIR(mode)) return "d"; /* directory */ else if (S_ISCHR(mode)) return "c"; /* character device */ else if (S_ISBLK(mode)) return "b"; /* block device */ else if (S_ISLNK(mode)) return "l"; /* symlink */ else if (S_ISFIFO(mode)) return "p"; /* fifo */ else if (S_ISSOCK(mode)) return "s"; /* socket */ else return "u"; /* unknown */ } const char * get_file_perms(mode_t mode) { int i; static char perms[10]; strcpy(perms, "---------"); for(i=0; i < sizeof perms - 1; i+=3) { if(mode &(S_IRUSR>>i)) perms[i+0] = 'r'; if(mode &(S_IWUSR>>i)) perms[i+1] = 'w'; if(mode &(S_IXUSR>>i)) perms[i+2] = 'x'; } #ifdef S_ISUID if((mode & S_ISUID)) perms[2] = 's'; #endif #ifdef S_ISGID if((mode & S_ISGID)) perms[5] = 's'; #endif #ifdef S_ISVTX if((mode & S_ISVTX)) perms[8] = 't'; #endif return(perms); } int xml_print_dir(const char* dir) { DIR *dirp; struct dirent *d; struct stat stats; int num_files = 0; if((dirp = opendir(dir)) == NULL) return(-1); chdir(dir); while((d = readdir(dirp)) != NULL) { xmlChar *xml_str; char atime[20]; char mtime[20]; int size_len; if ((d->d_name == NULL) || !strcmp(d->d_name, ".") || !strcmp(d->d_name, "..")) continue; if(lstat(d->d_name, &stats) != 0) { fprintf(stderr, "couldn't stat: %s\n", d->d_name); } #if defined (__MINGW32__) /* somehow atime is -1 on Windows XP when the atime is in future */ if (stats.st_atime < 0) stats.st_atime = 0; /* somehow mtime is -1 on Windows XP when the mtime is in future */ if (stats.st_mtime < 0) stats.st_mtime = 0; #endif /* format time as per ISO 8601 */ strftime(atime, sizeof atime, "%Y%m%dT%H%M%SZ", gmtime(&stats.st_atime)); strftime(mtime, sizeof mtime, "%Y%m%dT%H%M%SZ", gmtime(&stats.st_mtime)); xml_str = xml_C11NNormalizeAttr((const xmlChar *) d->d_name); printf("<%s p=\"%s\" a=\"%s\" m=\"%s\" s=\"", get_file_type(stats.st_mode), get_file_perms(stats.st_mode), atime, mtime); size_len = printf("%lu", (unsigned long) stats.st_size); printf("\"%.*s", 16-size_len, " "); printf(" n=\"%s\"/>\n", xml_str); num_files++; xmlFree(xml_str); } /* end of for loop */ closedir(dirp); return num_files; } int lsMain(int argc, char** argv) { const char *dir = "."; int files; if (argc == 3) { if (strcmp(argv[2], "--help") == 0) lsUsage(argc, argv, EXIT_SUCCESS); else dir = argv[2]; } else if (argc > 3) { lsUsage(argc, argv, EXIT_BAD_ARGS); } printf("\n"); files = xml_print_dir(dir); printf("\n"); return (files >= 0)? EXIT_SUCCESS : EXIT_FAILURE; } xmlstarlet-1.5.0/src/sources.mk0000644000175000017500000000146112000707114013432 00000000000000usage_texts =\ src/usage.txt\ src/c14n-usage.txt\ src/depyx-usage.txt\ src/edit-usage.txt\ src/elem-usage.txt\ src/escape-usage.txt\ src/format-usage.txt\ src/ls-usage.txt\ src/pyx-usage.txt\ src/select-usage.txt\ src/trans-usage.txt\ src/unescape-usage.txt\ src/validate-usage.txt generated_usage_sources =\ src/usage.c\ src/c14n-usage.c\ src/depyx-usage.c\ src/edit-usage.c\ src/elem-usage.c\ src/escape-usage.c\ src/format-usage.c\ src/ls-usage.c\ src/pyx-usage.c\ src/select-usage.c\ src/trans-usage.c\ src/unescape-usage.c\ src/validate-usage.c xml_SOURCES =\ src/escape.h\ src/trans.c\ src/trans.h\ src/xml.c\ src/xml_C14N.c\ src/xml_depyx.c\ src/xml_edit.c\ src/xml_elem.c\ src/xml_escape.c\ src/xml_format.c\ src/xml_ls.c\ src/xml_pyx.c\ src/xml_select.c\ src/xmlstar.h\ src/xml_trans.c\ src/xml_validate.c xmlstarlet-1.5.0/src/xml.c0000644000175000017500000002622312161332041012366 00000000000000/* $Id: xml.c,v 1.37 2004/11/11 03:39:34 mgrouch Exp $ */ /* XMLStarlet: Command Line Toolkit to query/edit/check/transform XML documents Copyright (c) 2002 Mikhail Grushinskiy. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include #include #include #include #include #include #include #include "xmlstar.h" gOptions globalOptions; static const xmlChar* XMLSTAR_NS = BAD_CAST "http://xmlstar.sourceforge.net"; static const xmlChar* XMLSTAR_NS_PREFIX = BAD_CAST "xstar"; extern int edMain(int argc, char **argv); extern int selMain(int argc, char **argv); extern int trMain(int argc, char **argv); extern int valMain(int argc, char **argv); extern int foMain(int argc, char **argv); extern int elMain(int argc, char **argv); extern int c14nMain(int argc, char **argv); extern int lsMain(int argc, char **argv); extern int pyxMain(int argc, char **argv); extern int depyxMain(int argc, char **argv); extern int escMain(int argc, char **argv, int escape); const char more_info[] = "XMLStarlet is a command line toolkit to query/edit/check/transform\n" "XML documents (for more information see http://xmlstar.sourceforge.net/)\n"; const char libxslt_more_info[] = "\n" "Current implementation uses libxslt from GNOME codebase as XSLT processor\n" "(see http://xmlsoft.org/ for more details)\n"; /** * Display usage syntax */ void usage(int argc, char **argv, exit_status status) { extern void fprint_usage(FILE* o, const char* argv0); FILE* o = (status == EXIT_SUCCESS)? stdout : stderr; fprint_usage(o, argv[0]); fprintf(o, "%s", more_info); exit(status); } /** * Initialize global command line options */ void gInitOptions(gOptionsPtr ops) { ops->quiet = 0; } /** * Error reporting functions */ void reportGenericError(void* ctx, const char * msg, ...) { /* do nothing */ } /* by default errors are reported */ static ErrorInfo errorInfo = { NULL, NULL, VERBOSE }; void reportError(void *ptr, xmlErrorPtr error) { ErrorInfo *errorInfo = (ErrorInfo*) ptr; assert(errorInfo); if (errorInfo->verbose) { int msglen; int domain = error->domain; const char *filename = error->file? error->file : errorInfo? errorInfo->filename : NULL; xmlTextReaderPtr reader = errorInfo->xmlReader; int line = (!filename)? 0 : (reader)? xmlTextReaderGetParserLineNumber(reader) : error->line; int column = (!filename)? 0 : (reader)? xmlTextReaderGetParserColumnNumber(reader) : error->int2; if (line) { fprintf(stderr, "%s:%d.%d: ", filename, line, column); } msglen = strlen(error->message); if (error->message[msglen-1] == '\n') error->message[msglen-1] = '\0'; fprintf(stderr, "%s", error->message); /* only print extra info if it's not in message */ if (error->str1 && strstr(error->message, error->str1) == NULL) { fprintf(stderr, ": %s", error->str1); if (error->str2 && strstr(error->message, error->str2) == NULL) { fprintf(stderr, ", %s", error->str2); } if (error->str3 && strstr(error->message, error->str3) == NULL) { fprintf(stderr, ", %s", error->str3); } } fprintf(stderr, "\n"); if ((domain == XML_FROM_PARSER) || (domain == XML_FROM_HTML) || (domain == XML_FROM_DTD) || (domain == XML_FROM_NAMESPACE) || (domain == XML_FROM_IO) || (domain == XML_FROM_VALID)) { xmlParserCtxtPtr ctxt = error->ctxt; if (ctxt) xmlParserPrintFileContext(ctxt->input); } } } void suppressErrors(void) { xmlSetGenericErrorFunc(NULL, reportGenericError); errorInfo.verbose = QUIET; } #define CHECK_MEM(ret) if (!ret) \ (fprintf(stderr, "out of memory\n"), exit(EXIT_INTERNAL_ERROR)) void* xmalloc(size_t size) { void *ret = malloc(size); CHECK_MEM(ret); return ret; } void* xrealloc(void *ptr, size_t size) { void *ret = realloc(ptr, size); CHECK_MEM(ret); return ret; } char* xstrdup(const char *str) { char *ret = (char*) xmlStrdup(BAD_CAST str); CHECK_MEM(ret); return ret; } /** * Parse global command line options */ void gParseOptions(gOptionsPtr ops, int *argc, char **argv) { int i, j; i = 1; while(i < *argc) { if (!strcmp(argv[i], "--quiet") || !strcmp(argv[i], "-q")) { ops->quiet = 1; i++; } else if (!strcmp(argv[i], "--version")) { fprintf(stdout, "%s\n" "compiled against libxml2 %s, linked with %s\n" "compiled against libxslt %s, linked with %s\n", VERSION, LIBXML_DOTTED_VERSION, xmlParserVersion, LIBXSLT_DOTTED_VERSION, xsltEngineVersion); exit(EXIT_SUCCESS); } else if (!strcmp(argv[i], "--help")) { usage(*argc, argv, EXIT_SUCCESS); } else if (argv[i][0] != '-') { /* remove parsed arguments */ i--; for (j = 1; j < *argc; j++) { if (j < *argc - i) argv[j] = argv[j + i]; else argv[j] = 0; } *argc -= i; return; } else { usage(*argc, argv, EXIT_BAD_ARGS); } } } /** * This is the main function */ int main(int argc, char **argv) { int ret = 0; xmlMemSetup(free, xmalloc, xrealloc, xstrdup); gInitOptions(&globalOptions); gParseOptions(&globalOptions, &argc, argv); xmlSetStructuredErrorFunc(&errorInfo, reportError); if (globalOptions.quiet) suppressErrors(); if (argc <= 1) { usage(argc, argv, EXIT_BAD_ARGS); } else if (!strcmp(argv[1], "ed") || !strcmp(argv[1], "edit")) { ret = edMain(argc, argv); } else if (!strcmp(argv[1], "sel") || !strcmp(argv[1], "select")) { ret = selMain(argc, argv); } else if (!strcmp(argv[1], "tr") || !strcmp(argv[1], "transform")) { ret = trMain(argc, argv); } else if (!strcmp(argv[1], "fo") || !strcmp(argv[1], "format")) { ret = foMain(argc, argv); } else if (!strcmp(argv[1], "val") || !strcmp(argv[1], "validate")) { ret = valMain(argc, argv); } else if (!strcmp(argv[1], "el") || !strcmp(argv[1], "elements")) { ret = elMain(argc, argv); } else if (!strcmp(argv[1], "c14n") || !strcmp(argv[1], "canonic")) { ret = c14nMain(argc, argv); } else if (!strcmp(argv[1], "ls") || !strcmp(argv[1], "list")) { ret = lsMain(argc, argv); } else if (!strcmp(argv[1], "pyx") || !strcmp(argv[1], "xmln")) { ret = pyxMain(argc, argv); } else if (!strcmp(argv[1], "depyx") || !strcmp(argv[1], "p2x")) { ret = depyxMain(argc, argv); } else if (!strcmp(argv[1], "esc") || !strcmp(argv[1], "escape")) { ret = escMain(argc, argv, 1); } else if (!strcmp(argv[1], "unesc") || !strcmp(argv[1], "unescape")) { ret = escMain(argc, argv, 0); } else { usage(argc, argv, EXIT_BAD_ARGS); } exit(ret); } void registerXstarVariable(xmlXPathContextPtr ctxt, const char* name, xmlXPathObjectPtr value) { xmlXPathRegisterVariableNS(ctxt, BAD_CAST name, XMLSTAR_NS, value); } static xmlXPathObjectPtr varLookupFallbackToXstarNS(void* ctxt_vp, const xmlChar* name, const xmlChar* ns_uri) { xmlXPathObjectPtr ret; xmlXPathContextPtr ctxt = ctxt_vp; ctxt->varLookupFunc = NULL; /* avoid infinite recursion! */ /* first get the default lookup value */ ret = xmlXPathVariableLookupNS(ctxt, name, ns_uri); if (!ret && !ns_uri) { /* if we didn't find anything, and there was no namespace given, try looking in XMLStarlet namespace */ ret = xmlXPathVariableLookupNS(ctxt, name, XMLSTAR_NS); } ctxt->varLookupFunc = &varLookupFallbackToXstarNS; return ret; } void registerXstarNs(xmlXPathContextPtr ctxt) { xmlXPathRegisterVariableLookup(ctxt, &varLookupFallbackToXstarNS, ctxt); xmlXPathRegisterNs(ctxt, XMLSTAR_NS_PREFIX, XMLSTAR_NS); } static void bad_ns_opt(const char *msg) { fprintf(stderr, "Bad namespace option: %s\n", msg); exit(EXIT_BAD_ARGS); } const char* DEFAULT_NS_FAIL_MESSAGE = "None of the XPaths matched; to match a node in the default namespace\n" "use '_' as the prefix (see section 5.1 in the manual).\n" "For instance, use /_:node instead of /node\n"; const xmlChar *default_ns = NULL; #define MAX_NS_ARGS 256 xmlChar *ns_arr[2 * MAX_NS_ARGS + 1]; /** * Parse command line for -N = arguments */ int parseNSArr(xmlChar** ns_arr, int* plen, int argc, char **argv) { int i = 0; *plen = 0; ns_arr[0] = 0; for (i=0; i= argc) bad_ns_opt("-N without argument"); equal_sign = xmlStrchr((const xmlChar*) argv[i], '='); if (!equal_sign) bad_ns_opt("namespace should have the form ="); prefix_len = equal_sign - (const xmlChar*) argv[i]; name = xmlStrndup((const xmlChar*) argv[i], prefix_len); value = xmlStrdup((const xmlChar*) argv[i]+prefix_len+1); if (*plen >= MAX_NS_ARGS) { fprintf(stderr, "too many namespaces increase MAX_NS_ARGS\n"); exit(EXIT_BAD_ARGS); } ns_arr[*plen] = name; (*plen)++; ns_arr[*plen] = value; (*plen)++; ns_arr[*plen] = 0; } return i; } /** * Cleanup memory allocated by namespaces arguments */ void cleanupNSArr(xmlChar **ns_arr) { xmlChar **p = ns_arr; while (*p) { xmlFree(*p); p++; } } xmlstarlet-1.5.0/src/xml_edit.c0000644000175000017500000005361312161333553013407 00000000000000/* $Id: xml_edit.c,v 1.45 2005/01/08 00:07:03 mgrouch Exp $ */ /* XMLStarlet: Command Line Toolkit to query/edit/check/transform XML documents Copyright (c) 2002 Mikhail Grushinskiy. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "xmlstar.h" /* TODO: 1. Should this be allowed ? ./xml ed -m /xml /xml/table/rec/object ../examples/xml/tab-obj.xml */ typedef struct _edOptions { /* Global 'edit' options */ int noblanks; /* Remove insignificant spaces from XML tree */ int preserveFormat; /* Preserve original XML formatting */ int omit_decl; /* Omit XML declaration line */ int inplace; /* Edit file inplace (no output on stdout) */ int nonet; /* Disallow network access */ } edOptions; typedef edOptions *edOptionsPtr; typedef enum _XmlEdOp { XML_ED_DELETE, XML_ED_VAR, XML_ED_INSERT, XML_ED_APPEND, XML_ED_UPDATE, XML_ED_RENAME, XML_ED_MOVE, XML_ED_SUBNODE } XmlEdOp; /* TODO ??? */ typedef enum _XmlNodeType { XML_UNDEFINED, XML_ATTR, XML_ELEM, XML_TEXT, XML_COMT, XML_CDATA, XML_EXPR } XmlNodeType; typedef struct { char shortOpt; const char* longOpt; /* include "--" */ XmlNodeType type; } OptionSpec; static const OptionSpec OPT_VAL_OR_EXP[] = { {'x', "--expr", XML_EXPR}, {'v', "--value", XML_TEXT} }, OPT_JUST_VAL[] = { {'v', "--value", XML_TEXT} }, OPT_JUST_TYPE[] = { {'t', "--type"} }, OPT_NODE_TYPE[] = { {0, "elem", XML_ELEM}, {0, "attr", XML_ATTR}, {0, "text", XML_TEXT} }, OPT_JUST_NAME[] = { {'n', "--name"} }; typedef const char* XmlEdArg; typedef struct _XmlEdAction { XmlEdOp op; XmlEdArg arg1; XmlEdArg arg2; XmlEdArg arg3; XmlNodeType type; } XmlEdAction; /** * display short help message */ static void edUsage(const char *argv0, exit_status status) { extern void fprint_edit_usage(FILE* o, const char* argv0); extern const char more_info[]; FILE *o = (status == EXIT_SUCCESS)? stdout : stderr; fprint_edit_usage(o, argv0); fprintf(o, "%s", more_info); exit(status); } /** * Initialize global command line options */ static void edInitOptions(edOptionsPtr ops) { ops->noblanks = 1; ops->omit_decl = 0; ops->preserveFormat = 0; ops->inplace = 0; ops->nonet = 1; } /** * Parse global command line options */ static int edParseOptions(edOptionsPtr ops, int argc, char **argv) { int i; i = 2; while((i < argc) && (argv[i][0] == '-')) { if (!strcmp(argv[i], "-S") || !strcmp(argv[i], "--ps")) { ops->noblanks = 0; /* preserve spaces */ } else if (!strcmp(argv[i], "-P") || !strcmp(argv[i], "--pf")) { ops->preserveFormat = 1; /* preserve format */ } else if (!strcmp(argv[i], "-O") || !strcmp(argv[i], "--omit-decl")) { ops->omit_decl = 1; } else if (!strcmp(argv[i], "-L") || !strcmp(argv[i], "--inplace")) { ops->inplace = 1; } else if (!strcmp(argv[i], "--net")) { ops->nonet = 0; } else if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h") || !strcmp(argv[i], "-?") || !strcmp(argv[i], "-Z")) { edUsage(argv[0], EXIT_SUCCESS); } else { break; } i++; } return i; } /** * register the namespace from @ns_arr to @ctxt */ static void nsarr_xpath_register(xmlXPathContextPtr ctxt) { int ns; for (ns = 0; ns_arr[ns]; ns += 2) { xmlXPathRegisterNs(ctxt, ns_arr[ns], ns_arr[ns+1]); } } /** * register top-level namespace definitions from @doc to @ctxt */ static void extract_ns_defs(xmlDocPtr doc, xmlXPathContextPtr ctxt) { xmlNsPtr nsDef; xmlNodePtr root = xmlDocGetRootElement(doc); if (!root) return; for (nsDef = root->nsDef; nsDef; nsDef = nsDef->next) { if (nsDef->prefix != NULL) { /* can only register ns with prefix */ xmlXPathRegisterNs(ctxt, nsDef->prefix, nsDef->href); } else { default_ns = nsDef->href; } } if (default_ns) { xmlXPathRegisterNs(ctxt, BAD_CAST "_", default_ns); xmlXPathRegisterNs(ctxt, BAD_CAST "DEFAULT", default_ns); } } static void update_string(xmlDocPtr doc, xmlNodePtr dest, const xmlChar* newstr) { /* TODO: do we need xmlEncodeEntitiesReentrant() too/instead? */ xmlChar* string = xmlEncodeSpecialChars(doc, newstr); xmlNodeSetContent(dest, string); xmlFree(string); } /** * 'update' operation */ static void edUpdate(xmlDocPtr doc, xmlNodeSetPtr nodes, const char *val, XmlNodeType type, xmlXPathContextPtr ctxt) { int i; xmlXPathCompExprPtr xpath = NULL; if (type == XML_EXPR) { xpath = xmlXPathCompile((const xmlChar*) val); if (!xpath) return; } for (i = 0; i < nodes->nodeNr; i++) { /* update node */ if (type == XML_EXPR) { xmlXPathObjectPtr res; ctxt->node = nodes->nodeTab[i]; res = xmlXPathCompiledEval(xpath, ctxt); if (res->type == XPATH_NODESET || res->type == XPATH_XSLT_TREE) { int j; xmlNodePtr oldChild; xmlNodeSetPtr oldChildren = xmlXPathNodeSetCreate(NULL); /* NOTE: newChildren can be NULL for empty result set */ xmlNodeSetPtr newChildren = res->nodesetval; /* NOTE: nodes can be both oldChildren and newChildren */ /* unlink the old children */ for (oldChild = nodes->nodeTab[i]->children; oldChild; oldChild = oldChild->next) { xmlUnlinkNode(oldChild); /* we can't free it now because an oldChild can also be newChild! just put it in the list */ xmlXPathNodeSetAdd(oldChildren, oldChild); } /* add the new children */ for (j = 0; newChildren && j < newChildren->nodeNr; j++) { xmlNodePtr node = newChildren->nodeTab[j]; xmlAddChild(nodes->nodeTab[i], /* if node is linked to this doc we need to copy */ (node->doc == doc)? xmlDocCopyNode(node, doc, 1) : node); newChildren->nodeTab[j] = NULL; } newChildren->nodeNr = 0; /* NOTE: if any oldChildren were newChildren, they've been copied so we can free them all now */ for (j = 0; j < oldChildren->nodeNr; j++) { xmlFreeNode(oldChildren->nodeTab[j]); oldChildren->nodeTab[j] = NULL; } oldChildren->nodeNr = 0; xmlXPathFreeNodeSet(oldChildren); } else { res = xmlXPathConvertString(res); update_string(doc, nodes->nodeTab[i], res->stringval); } xmlXPathFreeObject(res); } else { update_string(doc, nodes->nodeTab[i], (const xmlChar*) val); } } xmlXPathFreeCompExpr(xpath); } /* holds the node that was last inserted */ static xmlNodeSetPtr previous_insertion; /** * We must not keep free'd nodes in @previous_insertion. * This is a callback from xmlFreeNode() */ static void removeNodeFromPrev(xmlNodePtr node) { xmlXPathNodeSetDel(previous_insertion, node); } /** * 'insert' operation */ static void edInsert(xmlDocPtr doc, xmlNodeSetPtr nodes, const char *val, const char *name, XmlNodeType type, int mode) { int i; xmlXPathEmptyNodeSet(previous_insertion); for (i = 0; i < nodes->nodeNr; i++) { xmlNodePtr node; if (nodes->nodeTab[i] == (void*) doc && mode != 0) { fprintf(stderr, "The document node cannot have siblings.\n"); exit(EXIT_INTERNAL_ERROR); } /* update node */ if (type == XML_ATTR) { node = (xmlNodePtr) xmlNewProp(nodes->nodeTab[i], BAD_CAST name, BAD_CAST val); } else if (type == XML_ELEM) { node = xmlNewDocNode(doc, NULL /* TODO: NS */, BAD_CAST name, BAD_CAST val); if (mode > 0) xmlAddNextSibling(nodes->nodeTab[i], node); else if (mode < 0) xmlAddPrevSibling(nodes->nodeTab[i], node); else xmlAddChild(nodes->nodeTab[i], node); } else if (type == XML_TEXT) { node = xmlNewDocText(doc, BAD_CAST val); if (mode > 0) xmlAddNextSibling(nodes->nodeTab[i], node); else if (mode < 0) xmlAddPrevSibling(nodes->nodeTab[i], node); else xmlAddChild(nodes->nodeTab[i], node); } xmlXPathNodeSetAdd(previous_insertion, node); } } /** * 'rename' operation */ static void edRename(xmlDocPtr doc, xmlNodeSetPtr nodes, const char *val, XmlNodeType type) { int i; for (i = 0; i < nodes->nodeNr; i++) { if (nodes->nodeTab[i] == (void*) doc) { fprintf(stderr, "The document node cannot be renamed.\n"); exit(EXIT_INTERNAL_ERROR); } xmlNodeSetName(nodes->nodeTab[i], BAD_CAST val); } } /** * 'delete' operation */ static void edDelete(xmlDocPtr doc, xmlNodeSetPtr nodes) { int i; for (i = nodes->nodeNr - 1; i >= 0; i--) { if (nodes->nodeTab[i] == (void*) doc) { fprintf(stderr, "The document node cannot be deleted.\n"); exit(EXIT_INTERNAL_ERROR); } if (nodes->nodeTab[i]->type == XML_NAMESPACE_DECL) { fprintf(stderr, "FIXME: can't delete namespace nodes\n"); exit(EXIT_INTERNAL_ERROR); } /* delete node */ xmlUnlinkNode(nodes->nodeTab[i]); /* Free node and children */ xmlFreeNode(nodes->nodeTab[i]); nodes->nodeTab[i] = NULL; } } /** * 'move' operation */ static void edMove(xmlDocPtr doc, xmlNodeSetPtr nodes, xmlNodePtr to) { int i; for (i = 0; i < nodes->nodeNr; i++) { if (nodes->nodeTab[i] == (void*) doc) { fprintf(stderr, "The document node cannot be moved.\n"); exit(EXIT_INTERNAL_ERROR); } if (nodes->nodeTab[i]->type == XML_NAMESPACE_DECL) { fprintf(stderr, "FIXME: can't move namespace nodes\n"); exit(EXIT_INTERNAL_ERROR); } /* move node */ xmlUnlinkNode(nodes->nodeTab[i]); xmlAddChild(to, nodes->nodeTab[i]); } } /** * Loop through array of operations and perform them * @return number of successful operations */ static int edProcess(xmlDocPtr doc, const XmlEdAction* ops, int ops_count) { int op_applied = 0; int k; xmlXPathContextPtr ctxt = xmlXPathNewContext(doc); /* NOTE: later registrations override earlier ones */ registerXstarNs(ctxt); /* variables */ previous_insertion = xmlXPathNodeSetCreate(NULL); registerXstarVariable(ctxt, "prev", xmlXPathWrapNodeSet(previous_insertion)); xmlDeregisterNodeDefault(&removeNodeFromPrev); #if HAVE_EXSLT_XPATH_REGISTER /* register extension functions */ exsltDateXpathCtxtRegister(ctxt, BAD_CAST "date"); exsltMathXpathCtxtRegister(ctxt, BAD_CAST "math"); exsltSetsXpathCtxtRegister(ctxt, BAD_CAST "set"); exsltStrXpathCtxtRegister(ctxt, BAD_CAST "str"); #endif /* namespaces from doc */ extract_ns_defs(doc, ctxt); /* namespaces from command line */ nsarr_xpath_register(ctxt); for (k = 0; k < ops_count; k++) { xmlXPathObjectPtr res; xmlNodeSetPtr nodes; /* NOTE: to make relative paths match as if from "/", set context to document; setting to root would match as if from "/node()/" */ ctxt->node = (xmlNodePtr) doc; if (ops[k].op == XML_ED_VAR) { res = xmlXPathEvalExpression(BAD_CAST ops[k].arg2, ctxt); xmlXPathRegisterVariable(ctxt, BAD_CAST ops[k].arg1, res); continue; } res = xmlXPathEvalExpression(BAD_CAST ops[k].arg1, ctxt); if (!res || res->type != XPATH_NODESET || !res->nodesetval) continue; nodes = res->nodesetval; op_applied += (nodes->nodeNr > 0); switch (ops[k].op) { case XML_ED_DELETE: edDelete(doc, nodes); break; case XML_ED_MOVE: { xmlXPathObjectPtr res_to; ctxt->node = (xmlNodePtr) doc; res_to = xmlXPathEvalExpression(BAD_CAST ops[k].arg2, ctxt); if (!res_to || res_to->type != XPATH_NODESET || res_to->nodesetval->nodeNr != 1) { fprintf(stderr, "move destination is not a single node\n"); continue; } edMove(doc, nodes, res_to->nodesetval->nodeTab[0]); xmlXPathFreeObject(res_to); break; } case XML_ED_UPDATE: edUpdate(doc, nodes, ops[k].arg2, ops[k].type, ctxt); break; case XML_ED_RENAME: edRename(doc, nodes, ops[k].arg2, ops[k].type); break; case XML_ED_INSERT: edInsert(doc, nodes, ops[k].arg2, ops[k].arg3, ops[k].type, -1); break; case XML_ED_APPEND: edInsert(doc, nodes, ops[k].arg2, ops[k].arg3, ops[k].type, 1); break; case XML_ED_SUBNODE: edInsert(doc, nodes, ops[k].arg2, ops[k].arg3, ops[k].type, 0); break; default: break; } xmlXPathFreeObject(res); } /* NOTE: free()ing ctxt also free()s previous_insertion */ previous_insertion = NULL; xmlDeregisterNodeDefault(NULL); xmlXPathFreeContext(ctxt); return op_applied; } /** * Output document */ static void edOutput(const char* filename, const XmlEdAction* ops, int ops_count, const edOptions* g_ops) { int op_applied; xmlDocPtr doc; int save_options = #if LIBXML_VERSION >= 20708 (g_ops->noblanks? 0 : XML_SAVE_WSNONSIG) | #endif (g_ops->preserveFormat? 0 : XML_SAVE_FORMAT) | (g_ops->omit_decl? XML_SAVE_NO_DECL : 0); int read_options = (g_ops->nonet? XML_PARSE_NONET : 0); xmlSaveCtxtPtr save; doc = xmlReadFile(filename, NULL, read_options); if (!doc) { cleanupNSArr(ns_arr); xmlCleanupParser(); xmlCleanupGlobals(); exit(EXIT_BAD_FILE); } op_applied = edProcess(doc, ops, ops_count); /* avoid getting ASCII CRs in UTF-16/UCS-(2,4) text */ if ((xmlStrcasestr(doc->encoding, BAD_CAST "UTF") == 0 && xmlStrcasestr(doc->encoding, BAD_CAST "16") == 0) || (xmlStrcasestr(doc->encoding, BAD_CAST "UCS") == 0 && (xmlStrcasestr(doc->encoding, BAD_CAST "2") == 0 || xmlStrcasestr(doc->encoding, BAD_CAST "4") == 0))) { set_stdout_binary(); } save = xmlSaveToFilename(g_ops->inplace? filename : "-", NULL, save_options); xmlSaveDoc(save, doc); xmlSaveClose(save); xmlFreeDoc(doc); if (!op_applied && ops_count > 0 && default_ns && !globalOptions.quiet) { fprintf(stderr, DEFAULT_NS_FAIL_MESSAGE); } } /** * get next command line arg, or print error exit and exit if there isn't one * @returns pointer to the arg * @argi is incremented */ static const char* nextArg(char *const*const argv, int *argi) { const char *arg = argv[*argi]; if (arg == NULL) { edUsage(argv[0], EXIT_BAD_ARGS); } *argi += 1; return arg; } /** * like nextArg(), but additionally look for next arg in @choices */ static XmlNodeType parseNextArg(char *const*const argv, int *argi, const OptionSpec choices[], int choices_count) { const char* arg = nextArg(argv, argi); int i; for (i = 0; i < choices_count; i++) { if ((arg[0] == '-' && arg[1] == choices[i].shortOpt) || (strcmp(arg, choices[i].longOpt) == 0)) return choices[i].type; } edUsage(argv[0], EXIT_BAD_ARGS); return 0; /* never reach here */ } #define parseNextArg(argv, argi, choices) \ parseNextArg(argv, argi, choices, COUNT_OF(choices)) /** --insert, --append, and --subnode all take the same arguments */ static void parseInsertionArgs(XmlEdOp op_type, XmlEdAction* op, char *const*const argv, int *argi) { XmlEdArg arg; op->op = op_type; op->arg1 = nextArg(argv, argi); parseNextArg(argv, argi, OPT_JUST_TYPE); op->type = parseNextArg(argv, argi, OPT_NODE_TYPE); parseNextArg(argv, argi, OPT_JUST_NAME); op->arg3 = nextArg(argv, argi); /* test if value is given */ op->arg2 = 0; arg = argv[*argi]; if (!arg) return; if (!strcmp(arg, "-v") || !strcmp(arg, "--value")) { parseNextArg(argv, argi, OPT_JUST_VAL); op->arg2 = nextArg(argv, argi); } } /** * This is the main function for 'edit' option */ int edMain(int argc, char **argv) { int i, ops_count, max_ops_count = 8, n, start = 0; XmlEdAction* ops = xmlMalloc(sizeof(XmlEdAction) * max_ops_count); static edOptions g_ops; int nCount = 0; if (argc < 3) edUsage(argv[0], EXIT_BAD_ARGS); edInitOptions(&g_ops); start = edParseOptions(&g_ops, argc, argv); parseNSArr(ns_arr, &nCount, argc-start, argv+start); /* * Parse command line and fill array of operations */ ops_count = 0; i = start + nCount; while (i < argc) { const char *arg = nextArg(argv, &i); if (arg[0] == '-') { if (ops_count >= max_ops_count) { max_ops_count *= 2; ops = xmlRealloc(ops, sizeof(XmlEdAction) * max_ops_count); } ops[ops_count].type = XML_UNDEFINED; if (!strcmp(arg, "-d") || !strcmp(arg, "--delete")) { ops[ops_count].op = XML_ED_DELETE; ops[ops_count].arg1 = nextArg(argv, &i); ops[ops_count].arg2 = 0; } else if (!strcmp(arg, "--var")) { ops[ops_count].op = XML_ED_VAR; ops[ops_count].arg1 = nextArg(argv, &i); ops[ops_count].arg2 = nextArg(argv, &i); } else if (!strcmp(arg, "-m") || !strcmp(arg, "--move")) { ops[ops_count].op = XML_ED_MOVE; ops[ops_count].arg1 = nextArg(argv, &i); ops[ops_count].arg2 = nextArg(argv, &i); } else if (!strcmp(arg, "-u") || !strcmp(arg, "--update")) { ops[ops_count].op = XML_ED_UPDATE; ops[ops_count].arg1 = nextArg(argv, &i); ops[ops_count].type = parseNextArg(argv, &i, OPT_VAL_OR_EXP); ops[ops_count].arg2 = nextArg(argv, &i); } else if (!strcmp(arg, "-r") || !strcmp(arg, "--rename")) { ops[ops_count].op = XML_ED_RENAME; ops[ops_count].arg1 = nextArg(argv, &i); ops[ops_count].type = parseNextArg(argv, &i, OPT_JUST_VAL); ops[ops_count].arg2 = nextArg(argv, &i); } else if (!strcmp(arg, "-i") || !strcmp(arg, "--insert")) { parseInsertionArgs(XML_ED_INSERT, &ops[ops_count], argv, &i); } else if (!strcmp(arg, "-a") || !strcmp(arg, "--append")) { parseInsertionArgs(XML_ED_APPEND, &ops[ops_count], argv, &i); } else if (!strcmp(arg, "-s") || !strcmp(arg, "--subnode")) { parseInsertionArgs(XML_ED_SUBNODE, &ops[ops_count], argv, &i); } else { fprintf(stderr, "Warning: unrecognized option '%s'\n", arg); } ops_count++; } else { i--; /* it was a filename, we didn't use it */ break; } } xmlKeepBlanksDefault(0); if ((!g_ops.noblanks) || g_ops.preserveFormat) xmlKeepBlanksDefault(1); if (i >= argc) { edOutput("-", ops, ops_count, &g_ops); } for (n=i; n #include "trans.h" #include "xmlstar.h" /* * This code is based on xsltproc by Daniel Veillard (daniel@veillard.com) * (see also http://xmlsoft.org/) */ int errorno = 0; /** * Initialize global command line options */ void xsltInitOptions(xsltOptionsPtr ops) { ops->noval = 1; ops->nonet = 1; ops->omit_decl = 0; ops->show_extensions = 0; ops->noblanks = 0; ops->embed = 0; #ifdef LIBXML_XINCLUDE_ENABLED ops->xinclude = 0; #endif #ifdef LIBXML_HTML_ENABLED ops->html = 0; #endif #ifdef LIBXML_CATALOG_ENABLED ops->catalogs = 0; #endif } /** * Initialize LibXML */ void xsltInitLibXml(xsltOptionsPtr ops) { /* * Initialize library memory */ xmlInitMemory(); LIBXML_TEST_VERSION /* * Store line numbers in the document tree */ xmlLineNumbersDefault(1); /* * Register the EXSLT extensions */ exsltRegisterAll(); /* * Register the test module */ xsltRegisterTestModule(); if (ops->show_extensions) { xsltDebugDumpExtensions(stderr); exit(EXIT_SUCCESS); } xmlKeepBlanksDefault(1); if (ops->noblanks) xmlKeepBlanksDefault(0); xmlPedanticParserDefault(0); xmlGetWarningsDefaultValue = 1; /*xmlDoValidityCheckingDefaultValue = 0;*/ xmlLoadExtDtdDefaultValue = 1; /* * DTD validation options */ if (ops->noval == 0) { xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; } else { xmlLoadExtDtdDefaultValue = 0; } #ifdef LIBXML_XINCLUDE_ENABLED /* * enable XInclude */ if (ops->xinclude) xsltSetXIncludeDefault(1); #endif #ifdef LIBXML_CATALOG_ENABLED /* * enable SGML catalogs */ if (ops->catalogs) { char *catalogs = getenv("SGML_CATALOG_FILES"); if (catalogs == NULL) fprintf(stderr, "Variable $SGML_CATALOG_FILES not set\n"); else xmlLoadCatalogs(catalogs); } #endif } /* get result of XSL transformation */ xmlDocPtr xsltTransform(xsltOptionsPtr ops, xmlDocPtr doc, const char** params, xsltStylesheetPtr cur, const char *filename) { xsltTransformContextPtr ctxt; xmlDocPtr res; if (ops->omit_decl) { cur->omitXmlDeclaration = 1; } #ifdef LIBXML_XINCLUDE_ENABLED if (ops->xinclude) xmlXIncludeProcess(doc); #endif ctxt = xsltNewTransformContext(cur, doc); if (ctxt == NULL) return NULL; res = xsltApplyStylesheetUser(cur, doc, params, NULL, NULL, ctxt); if (ctxt->state == XSLT_STATE_ERROR) errorno = 9; if (ctxt->state == XSLT_STATE_STOPPED) errorno = 10; xsltFreeTransformContext(ctxt); xmlFreeDoc(doc); if (res == NULL) { fprintf(stderr, "no result for %s\n", filename); } return res; } /** * Run stylesheet on XML document */ void xsltProcess(xsltOptionsPtr ops, xmlDocPtr doc, const char** params, xsltStylesheetPtr cur, const char *filename) { xmlDocPtr res = xsltTransform(ops, doc, params, cur, filename); if (res && xsltSaveResultToFile(stdout, res, cur) < 0) { errorno = EXIT_LIB_ERROR; } xmlFreeDoc(res); } /** * run XSLT on documents */ int xsltRun(xsltOptionsPtr ops, char* xsl, const char** params, int count, char **docs) { xsltStylesheetPtr cur = NULL; xmlDocPtr doc, style; int i, options = 0; options = XSLT_PARSE_OPTIONS; /* * Compile XSLT Sylesheet */ style = xmlReadFile((const char *) xsl, NULL, options); if (style == NULL) { fprintf(stderr, "cannot parse %s\n", xsl); cur = NULL; errorno = 4; } else { if (ops->embed) { cur = xsltLoadStylesheetPI(style); if (cur != NULL) { /* it is an embedded stylesheet */ xsltProcess(ops, style, params, cur, xsl); xsltFreeStylesheet(cur); cur = NULL; } for (i=0; ierrors != 0) { errorno = 5; goto done; } if (cur->indent == 1) xmlIndentTreeOutput = 1; else xmlIndentTreeOutput = 0; } else { xmlFreeDoc(style); errorno = 5; goto done; } } /* * run XSLT */ if ((cur != NULL) && (cur->errors == 0)) { for (i=0; ihtml) doc = htmlReadFile(docs[i], NULL, options); else #endif { doc = xmlReadFile((const char *) docs[i], NULL, options); } if (doc == NULL) { fprintf(stderr, "unable to parse %s\n", docs[i]); errorno = 6; continue; } xsltProcess(ops, doc, params, cur, docs[i]); } if (count == 0) { /* stdin */ doc = NULL; #ifdef LIBXML_HTML_ENABLED if (ops->html) doc = htmlParseFile("-", NULL); else #endif doc = xmlReadFile("-", NULL, options); xsltProcess(ops, doc, params, cur, "-"); } } done: /* * Clean up */ if (cur != NULL) xsltFreeStylesheet(cur); return(errorno); } xmlstarlet-1.5.0/src/c14n-usage.txt0000644000175000017500000000166612000674564014051 00000000000000XMLStarlet Toolkit: XML canonicalization Usage: PROG c14n [--net] [] [] where - input XML document file name (stdin is used if '-') - XML file containing XPath expression for c14n XML canonicalization Example: (//. | //@* | //namespace::*)[ancestor-or-self::n1:elem1] - the list of inclusive namespace prefixes (only for exclusive canonicalization) Example: 'n1 n2' is one of following: --with-comments XML file canonicalization w comments (default) --without-comments XML file canonicalization w/o comments --exc-with-comments Exclusive XML file canonicalization w comments --exc-without-comments Exclusive XML file canonicalization w/o comments xmlstarlet-1.5.0/src/xml_C14N.c0000644000175000017500000002336312011744543013125 00000000000000/* * $Id: xml_C14N.c,v 1.12 2004/11/24 03:00:10 mgrouch Exp $ * * Canonical XML implementation test program * (http://www.w3.org/TR/2001/REC-xml-c14n-20010315) * * See Copyright for the status of this software. * * Author: Aleksey Sanin */ #include #include #if defined(LIBXML_C14N_ENABLED) #include #include #ifdef HAVE_STDLIB_H #include #endif #include #include #include #include #include #include "xmlstar.h" static void c14nUsage(const char *name, exit_status status) { extern void fprint_c14n_usage(FILE* o, const char* argv0); extern const char more_info[]; FILE *o = (status == EXIT_SUCCESS)? stdout : stderr; fprint_c14n_usage(o, name); fprintf(o, "%s", more_info); exit(status); } static xmlXPathObjectPtr load_xpath_expr (xmlDocPtr parent_doc, const char* filename); static xmlChar **parse_list(xmlChar *str); #if 0 static void print_xpath_nodes(xmlNodeSetPtr nodes); #endif static int run_c14n(const char* xml_filename, int with_comments, int exclusive, const char* xpath_filename, xmlChar **inclusive_namespaces, int nonet) { xmlDocPtr doc; xmlXPathObjectPtr xpath = NULL; int ret; /* * build an XML tree from a the file; we need to add default * attributes and resolve all character and entities references */ doc = xmlReadFile(xml_filename, NULL, XML_PARSE_NOENT | XML_PARSE_DTDLOAD | XML_PARSE_DTDATTR | (nonet? XML_PARSE_NONET:0)); if (doc == NULL) { fprintf(stderr, "Error: unable to parse file \"%s\"\n", xml_filename); return(EXIT_BAD_FILE); } /* * Check the document is of the right kind */ if(xmlDocGetRootElement(doc) == NULL) { fprintf(stderr,"Error: empty document for file \"%s\"\n", xml_filename); xmlFreeDoc(doc); return(EXIT_BAD_FILE); } /* * load xpath file if specified */ if(xpath_filename) { xpath = load_xpath_expr(doc, xpath_filename); if(xpath == NULL) { fprintf(stderr,"Error: unable to evaluate xpath expression\n"); xmlFreeDoc(doc); return(EXIT_BAD_FILE); } } /* * Canonical form */ set_stdout_binary(); /* avoid line ending conversion */ ret = xmlC14NDocSave(doc, (xpath) ? xpath->nodesetval : NULL, exclusive, inclusive_namespaces, with_comments, "-", 0); if(ret < 0) { fprintf(stderr,"Error: failed to canonicalize XML file \"%s\" (ret=%d)\n", xml_filename, ret); xmlFreeDoc(doc); return(EXIT_FAILURE); } /* * Cleanup */ if(xpath != NULL) xmlXPathFreeObject(xpath); xmlFreeDoc(doc); return(ret >= 0? EXIT_SUCCESS : EXIT_FAILURE); } int c14nMain(int argc, char **argv) { int ret = -1, nonet = 1; /* * Init libxml */ xmlInitParser(); LIBXML_TEST_VERSION /* * Parse command line and process file */ if (argc > 2 && strcmp(argv[2], "--net") == 0) { nonet = 0; /* TODO: parse options properly */ argc--; argv++; } if (argc < 4) { if (argc >= 3) { if (strcmp(argv[2], "--help") == 0 || strcmp(argv[2], "-h") == 0) c14nUsage(argv[0], EXIT_SUCCESS); } ret = run_c14n((argc > 2)? argv[2] : "-", 1, 0, NULL, NULL, nonet); } else if(strcmp(argv[2], "--with-comments") == 0) { ret = run_c14n(argv[3], 1, 0, (argc > 4) ? argv[4] : NULL, NULL, nonet); } else if(strcmp(argv[2], "--without-comments") == 0) { ret = run_c14n(argv[3], 0, 0, (argc > 4) ? argv[4] : NULL, NULL, nonet); } else if(strcmp(argv[2], "--exc-with-comments") == 0) { xmlChar **list; /* load exclusive namespace from command line */ list = (argc > 5) ? parse_list((xmlChar *)argv[5]) : NULL; ret = run_c14n(argv[3], 1, 1, (argc > 4) ? argv[4] : NULL, list, nonet); if(list != NULL) xmlFree(list); } else if(strcmp(argv[2], "--exc-without-comments") == 0) { xmlChar **list; /* load exclusive namespace from command line */ list = (argc > 5) ? parse_list((xmlChar *)argv[5]) : NULL; ret = run_c14n(argv[3], 0, 1, (argc > 4) ? argv[4] : NULL, list, nonet); if(list != NULL) xmlFree(list); } else { fprintf(stderr, "error: bad arguments.\n"); c14nUsage(argv[0], EXIT_BAD_ARGS); } /* * Shutdown libxml */ xmlCleanupParser(); xmlMemoryDump(); return ret; } /* * Macro used to grow the current buffer. */ #define growBufferReentrant() { \ buffer_size *= 2; \ buffer = (xmlChar **) \ xmlRealloc(buffer, buffer_size * sizeof(xmlChar*)); \ if (buffer == NULL) { \ perror("realloc failed"); \ return(NULL); \ } \ } static xmlChar ** parse_list(xmlChar *str) { xmlChar **buffer; xmlChar **out = NULL; int buffer_size = 0; int len; if(str == NULL) { return(NULL); } len = xmlStrlen(str); if((str[0] == '\'') && (str[len - 1] == '\'')) { str[len - 1] = '\0'; str++; len -= 2; } /* * allocate an translation buffer. */ buffer_size = 1000; buffer = xmlMalloc(buffer_size * sizeof(xmlChar*)); out = buffer; while(*str != '\0') { if (out - buffer > buffer_size - 10) { int indx = out - buffer; growBufferReentrant(); out = &buffer[indx]; } (*out++) = str; while(*str != ',' && *str != '\0') ++str; if(*str == ',') *(str++) = '\0'; } (*out) = NULL; return buffer; } static xmlXPathObjectPtr load_xpath_expr (xmlDocPtr parent_doc, const char* filename) { xmlXPathObjectPtr xpath; xmlDocPtr doc; xmlChar *expr; xmlXPathContextPtr ctx; xmlNodePtr node; xmlNsPtr ns; /* * load XPath expr as a file */ xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; xmlSubstituteEntitiesDefault(1); doc = xmlReadFile(filename, NULL, XML_PARSE_DTDLOAD | XML_PARSE_DTDATTR); if (doc == NULL) { fprintf(stderr, "Error: unable to parse file \"%s\"\n", filename); return(NULL); } /* * Check the document is of the right kind */ if(xmlDocGetRootElement(doc) == NULL) { fprintf(stderr,"Error: empty document for file \"%s\"\n", filename); xmlFreeDoc(doc); return(NULL); } node = doc->children; while(node != NULL && !xmlStrEqual(node->name, (const xmlChar *)"XPath")) { node = node->next; } if(node == NULL) { fprintf(stderr,"Error: XPath element expected in the file \"%s\"\n", filename); xmlFreeDoc(doc); return(NULL); } expr = xmlNodeGetContent(node); if(expr == NULL) { fprintf(stderr,"Error: XPath content element is NULL \"%s\"\n", filename); xmlFreeDoc(doc); return(NULL); } ctx = xmlXPathNewContext(parent_doc); if(ctx == NULL) { fprintf(stderr,"Error: unable to create new context\n"); xmlFree(expr); xmlFreeDoc(doc); return(NULL); } /* * Register namespaces */ ns = node->nsDef; while(ns != NULL) { if(xmlXPathRegisterNs(ctx, ns->prefix, ns->href) != 0) { fprintf(stderr,"Error: unable to register NS with prefix=\"%s\" and href=\"%s\"\n", ns->prefix, ns->href); xmlFree(expr); xmlXPathFreeContext(ctx); xmlFreeDoc(doc); return(NULL); } ns = ns->next; } /* * Evaluate xpath */ xpath = xmlXPathEvalExpression(expr, ctx); if(xpath == NULL) { fprintf(stderr,"Error: unable to evaluate xpath expression\n"); xmlFree(expr); xmlXPathFreeContext(ctx); xmlFreeDoc(doc); return(NULL); } /* print_xpath_nodes(xpath->nodesetval); */ xmlFree(expr); xmlXPathFreeContext(ctx); xmlFreeDoc(doc); return(xpath); } #if 0 static void print_xpath_nodes(xmlNodeSetPtr nodes) { xmlNodePtr cur; int i; if(nodes == NULL ){ fprintf(stderr, "Error: no nodes set defined\n"); return; } fprintf(stderr, "Nodes Set:\n-----\n"); for(i = 0; i < nodes->nodeNr; ++i) { if(nodes->nodeTab[i]->type == XML_NAMESPACE_DECL) { xmlNsPtr ns; ns = (xmlNsPtr)nodes->nodeTab[i]; cur = (xmlNodePtr)ns->next; fprintf(stderr, "namespace \"%s\"=\"%s\" for node %s:%s\n", ns->prefix, ns->href, (cur->ns) ? cur->ns->prefix : BAD_CAST "", cur->name); } else if(nodes->nodeTab[i]->type == XML_ELEMENT_NODE) { cur = nodes->nodeTab[i]; fprintf(stderr, "element node \"%s:%s\"\n", (cur->ns) ? cur->ns->prefix : BAD_CAST "", cur->name); } else { cur = nodes->nodeTab[i]; fprintf(stderr, "node \"%s\": type %d\n", cur->name, cur->type); } } } #endif #else #include int c14nMain(int argc, char **argv) { printf("%s : XPath/Canonicalization support not compiled in\n", argv[0]); return 2; } #endif /* LIBXML_C14N_ENABLED */ xmlstarlet-1.5.0/src/xml_validate.c0000644000175000017500000003232312121177764014254 00000000000000/* $Id: xml_validate.c,v 1.36 2005/01/07 01:52:43 mgrouch Exp $ */ /* XMLStarlet: Command Line Toolkit to query/edit/check/transform XML documents Copyright (c) 2002-2004 Mikhail Grushinskiy. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include #include #include #include "xmlstar.h" #include "trans.h" #ifdef LIBXML_SCHEMAS_ENABLED #include #include #endif #ifdef LIBXML_SCHEMAS_ENABLED #include #endif #include /* * TODO: Use cases * 1. find malfomed XML documents in a given set of XML files * 2. find XML documents which do not match DTD/XSD in a given set of XML files * 3. precompile DTD once */ typedef struct _valOptions { char *dtd; /* External DTD URL or file name */ char *schema; /* External Schema URL or file name */ char *relaxng; /* External Relax-NG Schema URL or file name */ int err; /* Allow stderr messages */ int embed; /* Validate using embeded DTD */ int wellFormed; /* Check if well formed only */ int listGood; /* >0 list good, <0 list bad */ int show_val_res; /* display file names and valid/invalid message */ int nonet; /* disallow network access */ } valOptions; typedef valOptions *valOptionsPtr; /** * display short help message */ void valUsage(int argc, char **argv, exit_status status) { extern void fprint_validate_usage(FILE* o, const char* argv0); extern const char more_info[]; FILE *o = (status == EXIT_SUCCESS)? stdout : stderr; fprint_validate_usage(o, argv[0]); fprintf(o, "%s", more_info); exit(status); } /** * Initialize global command line options */ void valInitOptions(valOptionsPtr ops) { ops->wellFormed = 1; ops->err = 0; ops->embed = 0; ops->dtd = NULL; ops->schema = NULL; ops->relaxng = NULL; ops->nonet = 1; if (globalOptions.quiet) { ops->listGood = 0; ops->show_val_res = 0; } else { ops->listGood = -1; ops->show_val_res = 1; } } /** * Parse global command line options */ int valParseOptions(valOptionsPtr ops, int argc, char **argv) { int i; i = 2; while(i < argc) { if (!strcmp(argv[i], "--well-formed") || !strcmp(argv[i], "-w")) { ops->wellFormed = 1; i++; } else if (!strcmp(argv[i], "--err") || !strcmp(argv[i], "-e")) { ops->err = 1; i++; } else if (!strcmp(argv[i], "--embed") || !strcmp(argv[i], "-E")) { ops->embed = 1; i++; } else if (!strcmp(argv[i], "--list-good") || !strcmp(argv[i], "-g")) { ops->listGood = 1; ops->show_val_res = 0; i++; } else if (!strcmp(argv[i], "--list-bad") || !strcmp(argv[i], "-b")) { ops->listGood = -1; ops->show_val_res = 0; i++; } else if (!strcmp(argv[i], "--quiet") || !strcmp(argv[i], "-q")) { ops->listGood = 0; ops->show_val_res = 0; i++; } else if (!strcmp(argv[i], "--dtd") || !strcmp(argv[i], "-d")) { i++; if (i >= argc) valUsage(argc, argv, EXIT_BAD_ARGS); ops->dtd = argv[i]; i++; } else if (!strcmp(argv[i], "--xsd") || !strcmp(argv[i], "-s")) { i++; if (i >= argc) valUsage(argc, argv, EXIT_BAD_ARGS); ops->schema = argv[i]; i++; } else if (!strcmp(argv[i], "--relaxng") || !strcmp(argv[i], "-r")) { i++; if (i >= argc) valUsage(argc, argv, EXIT_BAD_ARGS); ops->relaxng = argv[i]; i++; } else if (!strcmp(argv[i], "--net")) { ops->nonet = 0; i++; } else if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")) { valUsage(argc, argv, EXIT_SUCCESS); } else if (!strcmp(argv[i], "-")) { i++; break; } else if (argv[i][0] == '-') { valUsage(argc, argv, EXIT_BAD_ARGS); } else { i++; break; } } return i-1; } /** * Validate XML document against DTD */ int valAgainstDtd(valOptionsPtr ops, char* dtdvalid, xmlDocPtr doc, char* filename) { int result = 0; if (dtdvalid != NULL) { xmlDtdPtr dtd; #if !defined(LIBXML_VALID_ENABLED) xmlGenericError(xmlGenericErrorContext, "libxml2 has no validation support"); return 2; #endif dtd = xmlParseDTD(NULL, (const xmlChar *)dtdvalid); if (dtd == NULL) { xmlGenericError(xmlGenericErrorContext, "Could not parse DTD %s\n", dtdvalid); result = 2; } else { xmlValidCtxtPtr cvp; if ((cvp = xmlNewValidCtxt()) == NULL) { xmlGenericError(xmlGenericErrorContext, "Couldn't allocate validation context\n"); exit(-1); } if (ops->err) { cvp->userData = (void *) stderr; cvp->error = (xmlValidityErrorFunc) fprintf; cvp->warning = (xmlValidityWarningFunc) fprintf; } else { cvp->userData = (void *) NULL; cvp->error = (xmlValidityErrorFunc) NULL; cvp->warning = (xmlValidityWarningFunc) NULL; } if (!xmlValidateDtd(cvp, doc, dtd)) { if ((ops->listGood < 0) && !ops->show_val_res) { fprintf(stdout, "%s\n", filename); } else if (ops->listGood == 0) xmlGenericError(xmlGenericErrorContext, "%s: does not match %s\n", filename, dtdvalid); result = 3; } else { if ((ops->listGood > 0) && !ops->show_val_res) { fprintf(stdout, "%s\n", filename); } } xmlFreeDtd(dtd); xmlFreeValidCtxt(cvp); } } return result; } /** * This is the main function for 'validate' option */ int valMain(int argc, char **argv) { int start; static valOptions ops; static ErrorInfo errorInfo; int invalidFound = 0; int options = XML_PARSE_DTDLOAD | XML_PARSE_DTDATTR; if (argc <= 2) valUsage(argc, argv, EXIT_BAD_ARGS); valInitOptions(&ops); start = valParseOptions(&ops, argc, argv); if (ops.nonet) options |= XML_PARSE_NONET; errorInfo.verbose = ops.err; xmlSetStructuredErrorFunc(&errorInfo, reportError); xmlLineNumbersDefault(1); if (ops.dtd) { /* xmlReader doesn't work with external dtd, have to use SAX * interface */ int i; for (i=start; i 0) && (ret == 0)) fprintf(stdout, "%s\n", argv[i]); if ((ops.listGood < 0) && (ret != 0)) fprintf(stdout, "%s\n", argv[i]); } else { if (ret == 0) fprintf(stdout, "%s - valid\n", argv[i]); else fprintf(stdout, "%s - invalid\n", argv[i]); } } errorInfo.xmlReader = NULL; xmlFreeTextReader(reader); #ifdef LIBXML_SCHEMAS_ENABLED schemaCleanup: xmlSchemaFreeValidCtxt(schemaCtxt); xmlRelaxNGFree(relaxng); xmlSchemaFree(schema); xmlRelaxNGCleanupTypes(); xmlSchemaCleanupTypes(); #endif /* LIBXML_SCHEMAS_ENABLED */ } xmlCleanupParser(); return invalidFound; } xmlstarlet-1.5.0/src/trans-usage.txt0000644000175000017500000000204612000674564014424 00000000000000XMLStarlet Toolkit: Transform XML document(s) using XSLT Usage: PROG tr [] {-p|-s =} [...] where - main XSLT stylesheet for transformation - input XML document file/URL (stdin is used if missing) = - name and value of the parameter passed to XSLT processor -p - parameter is XPATH expression ("'string'" to quote string) -s - parameter is a string literal are: --help or -h - display help message --omit-decl - omit xml declaration --embed or -E - allow applying embedded stylesheet --show-ext - show list of extensions --val - allow validate against DTDs or schemas --net - allow fetch DTDs or entities over network #ifdef LIBXML_XINCLUDE_ENABLED --xinclude - do XInclude processing on document input #endif --maxdepth val - increase the maximum depth #ifdef LIBXML_HTML_ENABLED --html - input document(s) is(are) in HTML format #endif xmlstarlet-1.5.0/src/xmlstar.h0000644000175000017500000000254112161332137013270 00000000000000#ifndef XMLSTAR_H #define XMLSTAR_H #include #include #if HAVE_SETMODE && HAVE_DECL_O_BINARY # include # include # define set_stdout_binary() setmode(1, O_BINARY) #else # define set_stdout_binary() #endif #include #include #include typedef enum { /* EXIT_SUCCESS = 0, EXIT_FAILURE = 1, */ EXIT_BAD_ARGS = EXIT_FAILURE+1, EXIT_BAD_FILE, EXIT_LIB_ERROR, EXIT_INTERNAL_ERROR } exit_status; #define COUNT_OF(array) (sizeof(array)/sizeof(*array)) typedef enum { QUIET, VERBOSE } Verbosity; typedef struct _errorInfo { const char *filename; /* file error occured in, if any, else NULL */ xmlTextReaderPtr xmlReader; Verbosity verbose; } ErrorInfo; void reportError(void *ptr, xmlErrorPtr error); void suppressErrors(void); typedef struct _gOptions { int quiet; /* no error output */ } gOptions; typedef gOptions *gOptionsPtr; extern gOptions globalOptions; void registerXstarVariable(xmlXPathContextPtr ctxt, const char* name, xmlXPathObjectPtr value); void registerXstarNs(xmlXPathContextPtr ctxt); const char* DEFAULT_NS_FAIL_MESSAGE; extern const xmlChar *default_ns; int parseNSArr(xmlChar** ns_arr, int* plen, int argc, char **argv); void cleanupNSArr(xmlChar **ns_arr); extern xmlChar *ns_arr[]; #endif /* XMLSTAR_H */ xmlstarlet-1.5.0/src/trans.h0000644000175000017500000000626012011744543012731 00000000000000/* $Id: trans.h,v 1.11 2004/11/21 23:40:40 mgrouch Exp $ */ #ifndef __TRANS_H #define __TRANS_H /* XMLStarlet: Command Line Toolkit to query/edit/check/transform XML documents Copyright (c) 2002-2004 Mikhail Grushinskiy. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef LIBXML_XINCLUDE_ENABLED #include #endif #ifdef LIBXML_CATALOG_ENABLED #include #endif #define MAX_PARAMETERS 256 #define MAX_PATHS 256 typedef struct _xsltOptions { int noval; /* do not validate against DTDs or schemas */ int nonet; /* refuse to fetch DTDs or entities over network */ int show_extensions; /* display list of extensions */ int omit_decl; /* omit xml declaration */ int noblanks; /* Remove insignificant spaces from XML tree */ int embed; /* Allow applying embedded stylesheet */ #ifdef LIBXML_XINCLUDE_ENABLED int xinclude; /* do XInclude processing on input documents */ #endif #ifdef LIBXML_HTML_ENABLED int html; /* inputs are in HTML format */ #endif #ifdef LIBXML_CATALOG_ENABLED int catalogs; /* use SGML catalogs from $SGML_CATALOG_FILES */ #endif } xsltOptions; typedef xsltOptions *xsltOptionsPtr; extern int errorno; void xsltInitOptions(xsltOptionsPtr ops); void xsltInitLibXml(xsltOptionsPtr ops); void xsltProcess(xsltOptionsPtr ops, xmlDocPtr doc, const char **params, xsltStylesheetPtr cur, const char *filename); xmlDocPtr xsltTransform(xsltOptionsPtr ops, xmlDocPtr doc, const char **params, xsltStylesheetPtr cur, const char *filename); int xsltRun(xsltOptionsPtr ops, char* xsl, const char **params, int count, char **docs); #endif /* __TRANS_H */ xmlstarlet-1.5.0/src/xml_pyx.c0000644000175000017500000001762712164170134013304 00000000000000/* $Id: xml_pyx.c,v 1.9 2005/03/12 03:24:23 mgrouch Exp $ */ /** * Based on xmln from pyxie project * * The PYX format is a line-oriented representation of * XML documents that is derived from the SGML ESIS format. * (see ESIS - ISO 8879 Element Structure Information Set spec, * ISO/IEC JTC1/SC18/WG8 N931 (ESIS)) * * A non-validating, ESIS generating tool * ESIS Generation by Sean Mc Grath http://www.digitome.com/sean.html */ #include #include #include #include #include #include "xmlstar.h" /** * Output newline and tab characters as escapes * Required both for attribute values and character data (#PCDATA) */ static void SanitizeData(const xmlChar *s, int len) { while (len--) { switch (*s) { case 10: printf("\\n"); break; case 13: break; case 9: printf ("\\t"); break; case '\\': printf ("\\\\"); break; default: putchar (*s); } s++; } } static void print_qname(const xmlChar *prefix, const xmlChar *localname) { if (prefix) printf("%s:", prefix); printf("%s", localname); } int CompareAttributes(const void *a1,const void *a2) { typedef xmlChar const *const xmlCStr; xmlCStr *attr1 = *(xmlCStr* const* const)a1; xmlCStr *attr2 = *(xmlCStr* const* const)a2; return xmlStrcmp(*attr1, *attr2); } void pyxStartElement (void * ctx, const xmlChar * localname, const xmlChar * prefix, const xmlChar * URI, int nb_namespaces, const xmlChar ** namespaces, int nb_attributes, int nb_defaulted, const xmlChar ** attributes) { int i; /* DON'T modify the attributes array, ever. */ const xmlChar*** atts = &attributes; fprintf(stdout,"("); print_qname(prefix, localname); fprintf(stdout, "\n"); if (nb_attributes > 1) { atts = calloc(nb_attributes, sizeof(*atts)); for (i = 0; i < nb_attributes; ++i) { atts[i] = &(attributes[i * 5]); } /* Sort the pairs based on the name part of the pair */ qsort (atts, nb_attributes, sizeof(*atts), CompareAttributes); } for (i = 0; i < nb_namespaces; i++) { int aidx = i * 2; const xmlChar *prefix = namespaces[aidx], *uri = namespaces[aidx+1]; /* namespace definitions take the form xmlns:prefix=uri*/ putchar('A'); if (xmlStrlen(prefix) > 0) print_qname(BAD_CAST "xmlns", prefix); else fputs("xmlns", stdout); putchar(' '); SanitizeData(uri, xmlStrlen(uri)); putchar('\n'); } for (i = 0; i < nb_attributes; i++) { const xmlChar *localname = atts[i][0], *prefix = atts[i][1], /* *nsURI = attributes[atts][2], */ *valueBegin = atts[i][3], *valueEnd = atts[i][4]; int valueLen = valueEnd - valueBegin; /* Attribute Name */ putchar('A'); print_qname(prefix, localname); putchar(' '); /* value - can contain literal "\n" so escape */ SanitizeData(valueBegin, valueLen); putchar('\n'); } /* we did only allocate memory if nb_attributes > 1 */ if (nb_attributes > 1) free(atts); } void pyxEndElement(void *userData, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI) { fprintf(stdout,")"); print_qname(prefix, localname); putchar('\n'); } void pyxCharacterData(void *userData, const xmlChar *s, int len) { fprintf(stdout, "-"); SanitizeData(s, len); putchar('\n'); } void pyxProcessingInstruction(void *userData, const xmlChar *target, const xmlChar *data) { fprintf(stdout,"?%s ",target); SanitizeData(data, xmlStrlen(data)); fprintf(stdout,"\n"); } void pyxUnparsedEntityDeclHandler(void *userData, const xmlChar *entityName, const xmlChar *publicId, const xmlChar *systemId, const xmlChar *notationName) { fprintf(stdout, "U%s %s %s%s%s\n", (char *)entityName, (char *)notationName, (char *)systemId, (publicId == NULL? "": " "), (publicId == NULL? "": (char *) publicId)); } void pyxNotationDeclHandler(void *userData, const xmlChar *notationName, const xmlChar *publicId, const xmlChar *systemId) { fprintf(stdout, "N%s %s%s%s\n", (char*) notationName, (char*) systemId, (publicId == NULL? "": " "), (publicId == NULL? "": (const char*) publicId)); } void pyxExternalEntityReferenceHandler(void* userData, const xmlChar *name) { const xmlChar *p = name; fprintf (stdout, "&"); /* Up to space is the name of the referenced entity */ while (*p && (*p != ' ')) { putchar (*p); p++; } } static void pyxExternalSubsetHandler(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID) { fprintf(stdout, "D %s PUBLIC", name); /* TODO: re-check */ if (ExternalID == NULL) fprintf(stdout, " "); else fprintf(stdout, " \"%s\"", ExternalID); if (SystemID == NULL) fprintf(stdout, "\n"); else fprintf(stdout, " \"%s\"\n", SystemID); } static void pyxCommentHandler(void *ctx ATTRIBUTE_UNUSED, const xmlChar *value) { fprintf(stdout,"C"); SanitizeData(value, xmlStrlen(value)); fprintf(stdout,"\n"); } static void pyxCdataBlockHandler(void *ctx ATTRIBUTE_UNUSED, const xmlChar *value, int len) { fprintf(stdout,"["); SanitizeData(value, len); fprintf(stdout,"\n"); } static void pyxUsage(const char *argv0, exit_status status) { extern void fprint_pyx_usage(FILE* o, const char* argv0); extern const char more_info[]; FILE *o = (status == EXIT_SUCCESS)? stdout : stderr; fprint_pyx_usage(o, argv0); fprintf(o, "%s", more_info); exit(status); } static xmlSAXHandler pyxSAX; static int pyx_process_file(const char *filename) { int ret; xmlParserCtxtPtr ctxt; ctxt = xmlCreateFileParserCtxt(filename); if (!ctxt) /* assume it failed because of filename */ return EXIT_BAD_FILE; ctxt->sax = &pyxSAX; ret = xmlParseDocument(ctxt); ctxt->sax = NULL; /* don't try to free pyxSAX */ xmlFreeParserCtxt(ctxt); return (ret == 0)? 0 : EXIT_LIB_ERROR; } int pyxMain(int argc,const char *argv[]) { int status = 0; if ((argc > 2) && ( (strcmp(argv[2],"-h") == 0) || (strcmp(argv[2],"-H") == 0) || (strcmp(argv[2],"-Z") == 0) || (strcmp(argv[2],"-?") == 0) || (strcmp(argv[2],"--help") == 0) )) { pyxUsage(argv[0], EXIT_SUCCESS); } xmlInitParser(); /* Establish Event Handlers */ pyxSAX.startElementNs = pyxStartElement; pyxSAX.endElementNs = pyxEndElement; pyxSAX.processingInstruction = pyxProcessingInstruction; pyxSAX.characters = pyxCharacterData; pyxSAX.notationDecl = pyxNotationDeclHandler; pyxSAX.reference = pyxExternalEntityReferenceHandler; pyxSAX.unparsedEntityDecl = pyxUnparsedEntityDeclHandler; pyxSAX.externalSubset = pyxExternalSubsetHandler; pyxSAX.comment = pyxCommentHandler; pyxSAX.cdataBlock = pyxCdataBlockHandler; pyxSAX.initialized = XML_SAX2_MAGIC; if (argc == 2) { status = pyx_process_file("-"); } else { argv++; argc--; for (++argv; argc>1; argc--,argv++) { int ret = pyx_process_file(*argv); if (ret != 0) status = ret; } } xmlCleanupParser(); return status; } xmlstarlet-1.5.0/src/depyx-usage.txt0000644000175000017500000000054212000674564014425 00000000000000XMLStarlet Toolkit: Convert PYX into XML Usage: PROG p2x [] where - input PYX document file name (stdin is used if missing) The PYX format is a line-oriented representation of XML documents that is derived from the SGML ESIS format. (see ESIS - ISO 8879 Element Structure Information Set spec, ISO/IEC JTC1/SC18/WG8 N931 (ESIS)) xmlstarlet-1.5.0/src/xml_escape.c0000644000175000017500000002401412121177744013717 00000000000000/* $Id: xml_escape.c,v 1.11 2004/11/21 23:40:40 mgrouch Exp $ */ /* XMLStarlet: Command Line Toolkit to query/edit/check/transform XML documents Copyright (c) 2002-2004 Mikhail Grushinskiy. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include #include #include #include #include #include #include #include #include "xmlstar.h" #include "escape.h" #define INSZ 4*1024 /** * Print small help for command line options */ void escUsage(int argc, char **argv, int escape, exit_status status) { extern void fprint_escape_usage(FILE* o, const char* argv0); extern void fprint_unescape_usage(FILE* o, const char* argv0); extern const char more_info[]; FILE *o = (status == EXIT_SUCCESS)? stdout : stderr; if (escape) fprint_escape_usage(o, argv[0]); else fprint_unescape_usage(o, argv[0]); fprintf(o, "%s", more_info); exit(status); } /* "apos" or "quot" are biggest, add 1 for leading "&" */ enum { MAX_ENTITY_NAME = 1+4 }; /* return 1 if entity was recognized and value output, 0 otherwise */ static int put_entity_value(const char* entname, FILE* out) { if (entname[1] == '#') { char* endptr; const char* entnul = entname + strlen(entname); int num = (entname[2] == 'x')? strtol(&entname[3], &endptr, 16): strtol(&entname[2], &endptr, 10); if (endptr == entnul) { putc(num, out); return 1; } } else { xmlEntityPtr entity = xmlGetPredefinedEntity((xmlChar*) &entname[1]); if (entity) { fputs((char*) (entity->content), out); return 1; } } return 0; } /* * Macro used to grow the current buffer. */ #define grow_BufferReentrant() { \ buffer_size *= 2; \ buffer = (xmlChar *) \ xmlRealloc(buffer, buffer_size * sizeof(xmlChar)); \ if (buffer == NULL) { \ fprintf(stderr, "growing buffer error"); \ abort(); \ } \ } /** * xml_C11NNormalizeString: * @input: the input string * @mode: the normalization mode (attribute, comment, PI or text) * * Converts a string to a canonical (normalized) format. The code is stolen * from xmlEncodeEntitiesReentrant(). Added normalization of \x09, \x0a, \x0A * and the @mode parameter * * Returns a normalized string (caller is responsible for calling xmlFree()) * or NULL if an error occurs */ xmlChar * xml_C11NNormalizeString(const xmlChar * input, xml_C14NNormalizationMode mode) { const xmlChar *cur = input; xmlChar *buffer = NULL; xmlChar *out = NULL; int buffer_size = 0; if (input == NULL) return (NULL); /* * allocate an translation buffer. */ buffer_size = 1000; buffer = (xmlChar *) xmlMallocAtomic(buffer_size * sizeof(xmlChar)); if (buffer == NULL) { fprintf(stderr, "allocating buffer error"); abort(); } out = buffer; while (*cur != '\0') { if ((out - buffer) > (buffer_size - 10)) { int indx = out - buffer; grow_BufferReentrant(); out = &buffer[indx]; } if ((*cur == '<') && ((mode == XML_C14N_NORMALIZE_ATTR) || (mode == XML_C14N_NORMALIZE_TEXT))) { *out++ = '&'; *out++ = 'l'; *out++ = 't'; *out++ = ';'; } else if ((*cur == '>') && (mode == XML_C14N_NORMALIZE_TEXT)) { *out++ = '&'; *out++ = 'g'; *out++ = 't'; *out++ = ';'; } else if ((*cur == '&') && ((mode == XML_C14N_NORMALIZE_ATTR) || (mode == XML_C14N_NORMALIZE_TEXT))) { *out++ = '&'; *out++ = 'a'; *out++ = 'm'; *out++ = 'p'; *out++ = ';'; } else if ((*cur == '"') && (mode == XML_C14N_NORMALIZE_ATTR)) { *out++ = '&'; *out++ = 'q'; *out++ = 'u'; *out++ = 'o'; *out++ = 't'; *out++ = ';'; } else if ((*cur == '\x09') && (mode == XML_C14N_NORMALIZE_ATTR)) { *out++ = '&'; *out++ = '#'; *out++ = 'x'; *out++ = '9'; *out++ = ';'; } else if ((*cur == '\x0A') && (mode == XML_C14N_NORMALIZE_ATTR)) { *out++ = '&'; *out++ = '#'; *out++ = 'x'; *out++ = 'A'; *out++ = ';'; } else if ((*cur == '\x0D') && ((mode == XML_C14N_NORMALIZE_ATTR) || (mode == XML_C14N_NORMALIZE_TEXT) || (mode == XML_C14N_NORMALIZE_COMMENT) || (mode == XML_C14N_NORMALIZE_PI))) { *out++ = '&'; *out++ = '#'; *out++ = 'x'; *out++ = 'D'; *out++ = ';'; } else { /* * Works because on UTF-8, all extended sequences cannot * result in bytes in the ASCII range. */ *out++ = *cur; } cur++; } *out++ = 0; return (buffer); } /** * write unescaped version of @str to @out, if @str appears to end in the middle * of entity, return the entity. */ static const char * xml_unescape(const char* str, FILE* out) { static char entity[MAX_ENTITY_NAME+1]; /* +1 for NUL terminator */ int i; for (i = 0; str[i]; i++) { if (str[i] == '&') { int entity_len; int semicolon_off = i+1; for (;;) { if (str[semicolon_off] == ';' || str[semicolon_off] == '\0' || isspace(str[semicolon_off])) break; semicolon_off++; } entity_len = semicolon_off - i; if (entity_len < MAX_ENTITY_NAME) { memcpy(entity, &str[i], entity_len); entity[entity_len] = '\0'; if (str[semicolon_off] == ';') { if (put_entity_value(entity, out)) { i = semicolon_off; continue; } if (!globalOptions.quiet) fprintf(stderr, "unrecognized entity: %s\n", entity); } else if (str[semicolon_off] == '\0') { return entity; } else { if (!globalOptions.quiet) fprintf(stderr, "unterminated entity name: %.*s\n", entity_len, &str[i]); } } else { if (!globalOptions.quiet) fprintf(stderr, "entity name too long: %.*s\n", entity_len, &str[i]); } } putc(str[i], out); } return NULL; } /** * This is the main function for 'escape/unescape' options */ int escMain(int argc, char **argv, int escape) { int ret = 0; int readStdIn = 0; char* inp = NULL; xmlChar* outBuf = NULL; if (argc < 2) escUsage(argc, argv, escape, EXIT_BAD_ARGS); inp = argv[2]; if (argc > 2) { if (!strcmp(argv[2], "--help") || !strcmp(argv[2], "-h") || !strcmp(argv[2], "-?") || !strcmp(argv[2], "-Z")) escUsage(argc, argv, escape, EXIT_SUCCESS); if (!strcmp(argv[2], "-")) readStdIn = 1; } else { readStdIn = 1; } if (readStdIn) { static char line[INSZ]; int offset = 0; while (!feof(stdin)) { if (fgets(line + offset, INSZ - offset, stdin)) { if (escape) { outBuf = xmlEncodeEntitiesReentrant(NULL, (xmlChar*) line); if (outBuf) { fprintf(stdout, "%s", outBuf); xmlFree(outBuf); } } else { const char* partial_entity = xml_unescape(line, stdout); if (partial_entity) { offset = strlen(partial_entity); memcpy(line, partial_entity, offset); } else { offset = 0; } } } } if (offset) { fprintf(stdout, "%.*s", offset, line); if (!globalOptions.quiet) fprintf(stderr, "partial entity: %.*s\n", offset, line); } return ret; } if (escape) { outBuf = xmlEncodeEntitiesReentrant(NULL, (xmlChar*) inp); if (outBuf) { fprintf(stdout, "%s\n", outBuf); xmlFree(outBuf); } } else { const char* partial_entity = xml_unescape(inp, stdout); if (partial_entity) { fprintf(stdout, "%s\n", partial_entity); if (!globalOptions.quiet) fprintf(stderr, "partial entity: %s\n", partial_entity); } } return ret; } xmlstarlet-1.5.0/src/pyx-usage.txt0000644000175000017500000000107212000674564014113 00000000000000XMLStarlet Toolkit: Convert XML into PYX format (based on ESIS - ISO 8879) Usage: PROG pyx {} where - input XML document file name (stdin is used if missing) The PYX format is a line-oriented representation of XML documents that is derived from the SGML ESIS format. (see ESIS - ISO 8879 Element Structure Information Set spec, ISO/IEC JTC1/SC18/WG8 N931 (ESIS)) A non-validating, ESIS generating tool originally developed for pyxie project (see http://pyxie.sourceforge.net/) ESIS Generation by Sean Mc Grath http://www.digitome.com/sean.html xmlstarlet-1.5.0/src/edit-usage.txt0000644000175000017500000000241712067322576014232 00000000000000XMLStarlet Toolkit: Edit XML document(s) Usage: PROG ed {} [ ... ] where - global options for editing - input XML document file name/uri (stdin otherwise) are: -P, or -S - preserve whitespace nodes. (or --pf, --ps) Note that space between attributes is not preserved -O (or --omit-decl) - omit XML declaration () -L (or --inplace) - edit file inplace -N = - predefine namespaces (name without 'xmlns:') ex: xsql=urn:oracle-xsql Multiple -N options are allowed. -N options must be last global options. --net - allow network access --help or -h - display help where -d or --delete --var -i or --insert -t (--type) elem|text|attr -n [-v (--value) ] -a or --append -t (--type) elem|text|attr -n [-v (--value) ] -s or --subnode -t (--type) elem|text|attr -n [-v (--value) ] -m or --move -r or --rename -v -u or --update -v (--value) -x (--expr) xmlstarlet-1.5.0/src/usage.txt0000644000175000017500000000214512105544620013272 00000000000000XMLStarlet Toolkit: Command line utilities for XML Usage: PROG [] [] where is one of: ed (or edit) - Edit/Update XML document(s) sel (or select) - Select data or query XML document(s) (XPATH, etc) tr (or transform) - Transform XML document(s) using XSLT val (or validate) - Validate XML document(s) (well-formed/DTD/XSD/RelaxNG) fo (or format) - Format XML document(s) el (or elements) - Display element structure of XML document c14n (or canonic) - XML canonicalization ls (or list) - List directory as XML esc (or escape) - Escape special XML characters unesc (or unescape) - Unescape special XML characters pyx (or xmln) - Convert XML into PYX format (based on ESIS - ISO 8879) p2x (or depyx) - Convert PYX into XML are: -q or --quiet - no error output --version - show version --help - show help Wherever file name mentioned in command help it is assumed that URL can be used instead as well. Type: PROG --help for command help xmlstarlet-1.5.0/src/format-usage.txt0000644000175000017500000000155612105544620014565 00000000000000XMLStarlet Toolkit: Format XML document Usage: PROG fo [] where are -n or --noindent - do not indent -t or --indent-tab - indent output with tabulation -s or --indent-spaces - indent output with spaces -o or --omit-decl - omit xml declaration --net - allow network access -R or --recover - try to recover what is parsable -D or --dropdtd - remove the DOCTYPE of the input docs -C or --nocdata - replace cdata section with text nodes -N or --nsclean - remove redundant namespace declarations -e or --encode - output in the given encoding (utf-8, unicode...) #ifdef LIBXML_HTML_ENABLED -H or --html - input is HTML #endif -h or --help - print help xmlstarlet-1.5.0/src/xml_format.c0000644000175000017500000002224512121177764013755 00000000000000/* $Id: xml_format.c,v 1.25 2005/01/07 02:33:40 mgrouch Exp $ */ /* XMLStarlet: Command Line Toolkit to query/edit/check/transform XML documents Copyright (c) 2002 Mikhail Grushinskiy. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "xmlstar.h" /* * TODO: 1. Attribute formatting options (as every attribute on a new line) * 2. exit values on errors */ typedef struct _foOptions { int indent; /* indent output */ int indent_tab; /* indent output with tab */ int indent_spaces; /* num spaces for indentation */ int omit_decl; /* omit xml declaration */ int recovery; /* try to recover what is parsable */ int dropdtd; /* remove the DOCTYPE of the input docs */ int options; /* global parsing flags */ #ifdef LIBXML_HTML_ENABLED int html; /* inputs are in HTML format */ #endif int quiet; /* quiet mode */ } foOptions; typedef foOptions *foOptionsPtr; const char *encoding = NULL; static char *spaces = NULL; /** * Print small help for command line options */ void foUsage(int argc, char **argv, exit_status status) { extern void fprint_format_usage(FILE* o, const char* argv0); extern const char more_info[]; FILE *o = (status == EXIT_SUCCESS)? stdout : stderr; fprint_format_usage(o, argv[0]); fprintf(o, "%s", more_info); exit(status); } /** * Initialize global command line options */ void foInitOptions(foOptionsPtr ops) { ops->indent = 1; ops->indent_tab = 0; ops->indent_spaces = 2; ops->omit_decl = 0; ops->recovery = 0; ops->dropdtd = 0; ops->options = XML_PARSE_NONET; #ifdef LIBXML_HTML_ENABLED ops->html = 0; #endif ops->quiet = globalOptions.quiet; } /** * Initialize LibXML */ void foInitLibXml(foOptionsPtr ops) { /* * Initialize library memory */ xmlInitMemory(); LIBXML_TEST_VERSION /* * Store line numbers in the document tree */ xmlLineNumbersDefault(1); xmlSubstituteEntitiesDefault(1); xmlKeepBlanksDefault(0); xmlPedanticParserDefault(0); xmlGetWarningsDefaultValue = 1; xmlDoValidityCheckingDefaultValue = 0; xmlLoadExtDtdDefaultValue = 0; xmlTreeIndentString = NULL; if (ops->indent) { xmlIndentTreeOutput = 1; if (ops->indent_tab) { xmlTreeIndentString = "\t"; } else if (ops->indent_spaces > 0) { spaces = xmlMalloc(ops->indent_spaces + 1); xmlTreeIndentString = spaces; memset(spaces, ' ', ops->indent_spaces); spaces[ops->indent_spaces] = '\0'; } } else xmlIndentTreeOutput = 0; } /** * Parse global command line options */ int foParseOptions(foOptionsPtr ops, int argc, char **argv) { int i; i = 2; while(i < argc) { if (!strcmp(argv[i], "--noindent") || !strcmp(argv[i], "-n")) { ops->indent = 0; i++; } else if (!strcmp(argv[i], "--encode") || !strcmp(argv[i], "-e")) { i++; encoding = argv[i]; i++; } else if (!strcmp(argv[i], "--indent-tab") || !strcmp(argv[i], "-t")) { ops->indent_tab = 1; i++; } else if (!strcmp(argv[i], "--omit-decl") || !strcmp(argv[i], "-o")) { ops->omit_decl = 1; i++; } else if (!strcmp(argv[i], "--dropdtd") || !strcmp(argv[i], "-D")) { ops->dropdtd = 1; i++; } else if (!strcmp(argv[i], "--recover") || !strcmp(argv[i], "-R")) { ops->recovery = 1; ops->options |= XML_PARSE_RECOVER; i++; } else if (!strcmp(argv[i], "--nocdata") || !strcmp(argv[i], "-C")) { ops->options |= XML_PARSE_NOCDATA; i++; } else if (!strcmp(argv[i], "--nsclean") || !strcmp(argv[i], "-N")) { ops->options |= XML_PARSE_NSCLEAN; i++; } else if (!strcmp(argv[i], "--indent-spaces") || !strcmp(argv[i], "-s")) { int value; i++; if (i >= argc) foUsage(argc, argv, EXIT_BAD_ARGS); if (sscanf(argv[i], "%d", &value) == 1) { if (value > 0) ops->indent_spaces = value; } else { foUsage(argc, argv, EXIT_BAD_ARGS); } ops->indent_tab = 0; i++; } else if (!strcmp(argv[i], "--quiet") || !strcmp(argv[i], "-Q")) { ops->quiet = 1; i++; } #ifdef LIBXML_HTML_ENABLED else if (!strcmp(argv[i], "--html") || !strcmp(argv[i], "-H")) { ops->html = 1; i++; } #endif else if (!strcmp(argv[i], "--net")) { ops->options &= ~XML_PARSE_NONET; i++; } else if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")) { foUsage(argc, argv, EXIT_SUCCESS); } else if (!strcmp(argv[i], "-")) { i++; break; } else if (argv[i][0] == '-') { foUsage(argc, argv, EXIT_BAD_ARGS); } else { i++; break; } } return i-1; } /** * 'process' xml document(s) */ int foProcess(foOptionsPtr ops, int start, int argc, char **argv) { int ret = 0; xmlDocPtr doc = NULL; char *fileName = "-"; if ((start > 1) && (start < argc) && (argv[start][0] != '-') && strcmp(argv[start-1], "--indent-spaces") && strcmp(argv[start-1], "-s")) { fileName = argv[start]; } /* if (ops->recovery) { doc = xmlRecoverFile(fileName); } else */ if (ops->quiet) suppressErrors(); #ifdef LIBXML_HTML_ENABLED if (ops->html) { doc = htmlReadFile(fileName, NULL, ops->options); } else #endif doc = xmlReadFile(fileName, NULL, ops->options); if (doc == NULL) { /*fprintf(stderr, "%s:: error: XML parse error\n", fileName);*/ return 2; } /* * Remove DOCTYPE nodes */ if (ops->dropdtd) { xmlDtdPtr dtd; dtd = xmlGetIntSubset(doc); if (dtd != NULL) { xmlUnlinkNode((xmlNodePtr)dtd); xmlFreeDtd(dtd); } } if (!ops->omit_decl) { if (encoding != NULL) { xmlSaveFormatFileEnc("-", doc, encoding, 1); } else { xmlSaveFormatFile("-", doc, 1); } } else { int format = 1; xmlOutputBufferPtr buf = NULL; xmlCharEncodingHandlerPtr handler = NULL; buf = xmlOutputBufferCreateFile(stdout, handler); if (doc->children != NULL) { xmlNodePtr child = doc->children; while (child != NULL) { xmlNodeDumpOutput(buf, doc, child, 0, format, encoding); xmlOutputBufferWriteString(buf, "\n"); child = child->next; } } ret = xmlOutputBufferClose(buf); } xmlFreeDoc(doc); return ret; } /** * Cleanup memory */ void foCleanup() { free(spaces); spaces = NULL; xmlCleanupParser(); #if 0 xmlMemoryDump(); #endif } /** * This is the main function for 'format' option */ int foMain(int argc, char **argv) { int ret = 0; int start; static foOptions ops; if (argc <=1) foUsage(argc, argv, EXIT_BAD_ARGS); foInitOptions(&ops); start = foParseOptions(&ops, argc, argv); if (argc-start > 1) foUsage(argc, argv, EXIT_BAD_ARGS); foInitLibXml(&ops); ret = foProcess(&ops, start, argc, argv); foCleanup(); return ret; } xmlstarlet-1.5.0/src/select-usage.txt0000644000175000017500000000632712000674564014562 00000000000000XMLStarlet Toolkit: Select from XML document(s) Usage: PROG sel {