shntool-3.0.10/0000777000077100007710000000000011164065154010275 500000000000000shntool-3.0.10/aclocal.m40000644000077100007710000007740711164057351012070 00000000000000# generated automatically by aclocal 1.10.2 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008 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_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.63],, [m4_warning([this file was generated for autoconf 2.63. 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, 2003, 2005, 2006, 2007, 2008 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.10' 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.10.2], [], [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.10.2])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, 2003, 2005 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, 2000, 2001, 2003, 2004, 2005, 2006 # 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. # serial 8 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$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 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, 2000, 2001, 2002, 2003, 2004, 2005, 2006 # 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. # serial 9 # 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", "GCJ", or "OBJC". # 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 ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" 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'. 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 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 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in 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 ;; none) break ;; esac # 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. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} 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 sub/conftest.${OBJEXT-o} 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, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 # 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. #serial 4 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [# Autoconf 2.62 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"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //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' -e 's/\$U/'"$U"'/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, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2008 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. # serial 13 # 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.60])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], [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], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [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) AM_PROG_INSTALL_SH AM_PROG_INSTALL_STRIP AC_REQUIRE([AM_PROG_MKDIR_P])dnl # 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)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) ]) # 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, 2003, 2005 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 install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 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. # serial 2 # 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])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005 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. # serial 3 # 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 done .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 # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005 # 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. # serial 5 # 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 supports --run. # If it does, 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 test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005, 2006 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_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2008 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. # serial 4 # _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, 1997, 2000, 2001, 2003, 2005 # 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. # serial 4 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # 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 ( 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 rm -f conftest.file 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 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)]) # Copyright (C) 2001, 2003, 2005 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 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]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005 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. # serial 2 # _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. AM_MISSING_PROG([AMTAR], [tar]) m4_if([$1], [v7], [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. 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 shntool-3.0.10/INSTALL0000644000077100007710000002231010543326317011241 00000000000000Installation Instructions ************************* Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf bug. Until the bug is fixed you can use this workaround: CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of the options to `configure', and exit. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. shntool-3.0.10/include/0000777000077100007710000000000011164065154011720 500000000000000shntool-3.0.10/include/format.h0000644000077100007710000000326011155771111013273 00000000000000/* format.h - format module definitions * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* * $Id: format.h,v 1.35 2009/03/11 17:18:01 jason Exp $ */ #ifndef __FORMAT_H__ #define __FORMAT_H__ #include "format-types.h" #include "module.h" #define FILENAME_PLACEHOLDER "%f" /* copies an arbitrary-length tag, without the NULL byte */ void tagcpy(unsigned char *,unsigned char *); /* compares what was received to the expected tag */ int tagcmp(unsigned char *,unsigned char *); /* function to check if a file name is about to be clobbered, and if so, asks whether this is OK */ int clobber_check(char *); /* find an output format module with the given name */ format_module *find_format(char *); /* launch encoders/decoders */ FILE *launch_input(format_module *,char *,proc_info *); FILE *launch_output(format_module *,char *,proc_info *); /* generic check for "magic" strings at known offsets */ bool check_for_magic(char *,char *,int); #endif shntool-3.0.10/include/binary.h0000644000077100007710000000722710303534540013273 00000000000000/* * $Id: binary.h,v 1.7 2005/08/26 06:40:32 jason Exp $ */ #include #include #include #include #include #include #include #include #ifdef __CYGWIN__ #include #endif #if defined _WIN32 || defined __TURBOC__ || defined __ZTC__ || defined _MSC_VER # include # include # include # include # include #elif defined __unix__ || defined __linux__ # include # include # include # include # include # include #else /* .... hier Includes für neues Betriebssystem einfügen (mit vorgestellten: #elif defined) */ # include # include # include # include #endif #ifndef O_BINARY # ifdef _O_BINARY # define O_BINARY _O_BINARY # else # define O_BINARY 0 # endif #endif #if defined __BORLANDC__ || defined _WIN32 # define FILENO(__fp) _fileno ((__fp)) #elif defined __CYGWIN__ || defined __TURBOC__ || defined __unix__ || defined __EMX__ || defined _MSC_VER # define FILENO(__fp) fileno ((__fp)) #else # define FILENO(__fp) fileno ((__fp)) #endif /* * If we have access to a file via file name, we can open the file with an * additional "b" or a O_BINARY within the (f)open function to get a * transparent untranslated data stream which is necessary for audio bitstream * data and also for PCM data. If we are working with * stdin/stdout/FILENO_STDIN/FILENO_STDOUT we can't open the file with this * attributes, because the files are already open. So we need a non * standardized sequence to switch to this mode (not necessary for Unix). * Mostly the sequency is the same for incoming and outgoing streams, but only * mostly so we need one for IN and one for OUT. * Macros are called with the file pointer and you get back the untransalted file * pointer which can be equal or different from the original. */ #if defined __EMX__ # define SETBINARY_FD(__fp) (_fsetmode ( (__fp), "b" )) # define SETBINARY_IN(__fp) (_fsetmode ( (__fp), "b" )) # define SETBINARY_OUT(__fp) (_fsetmode ( (__fp), "b" )) #elif defined __TURBOC__ || defined __BORLANDC__ # define SETBINARY_FD(__fp) (setmode ( (__fp), O_BINARY )) # define SETBINARY_IN(__fp) (setmode ( FILENO ((__fp)), O_BINARY )) # define SETBINARY_OUT(__fp) (setmode ( FILENO ((__fp)), O_BINARY )) #elif defined __CYGWIN__ # define SETBINARY_FD(__fp) (setmode ( (__fp), _O_BINARY )) # define SETBINARY_IN(__fp) (setmode ( FILENO ((__fp)), _O_BINARY )) # define SETBINARY_OUT(__fp) (setmode ( FILENO ((__fp)), _O_BINARY )) #elif defined _WIN32 # define SETBINARY_FD(__fp) (_setmode ( (__fp), _O_BINARY )) # define SETBINARY_IN(__fp) (_setmode ( FILENO ((__fp)), _O_BINARY )) # define SETBINARY_OUT(__fp) (_setmode ( FILENO ((__fp)), _O_BINARY )) #elif defined _MSC_VER # define SETBINARY_FD(__fp) (setmode ( (__fp), O_BINARY )) # define SETBINARY_IN(__fp) (setmode ( FILENO ((__fp)), O_BINARY )) # define SETBINARY_OUT(__fp) (setmode ( FILENO ((__fp)), O_BINARY )) #elif defined __unix__ # define SETBINARY_FD(__fp) (void)(__fp) # define SETBINARY_IN(__fp) (void)(__fp) # define SETBINARY_OUT(__fp) (void)(__fp) #elif 0 # define SETBINARY_FD(__fp) (void)(__fp) # define SETBINARY_IN(__fp) (freopen ( NULL, "rb", (__fp) )) # define SETBINARY_OUT(__fp) (freopen ( NULL, "wb", (__fp) )) #else # define SETBINARY_FD(__fp) (void)(__fp) # define SETBINARY_IN(__fp) (void)(__fp) # define SETBINARY_OUT(__fp) (void)(__fp) #endif shntool-3.0.10/include/format-types.h0000644000077100007710000001147511155771111014444 00000000000000/* format-types.h - format module type definitions * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* * $Id: format-types.h,v 1.17 2009/03/11 17:18:01 jason Exp $ */ #ifndef __FORMAT_TYPES_H__ #define __FORMAT_TYPES_H__ #include #include "module-types.h" #include "wave.h" #define MAX_CHILD_ARGS 256 /* child argument lists */ typedef struct _child_args { int num_args; char *args[MAX_CHILD_ARGS]; } child_args; typedef struct _format_module { /* set at compile time */ char *const name; /* format name, specified on command line in certain modes */ char *const description; /* one line description of this format */ char *const cvsid; /* CVS revision (used to prevent it from being stripped) */ bool const supports_input; /* does this format support input? */ bool const supports_output; /* does this format support output? */ bool const is_translated; /* is this file format a simple translation (e.g. byte-swap) of WAV? */ bool const is_compressed; /* is this file format a compression format? */ bool const remove_output_file; /* remove output file before opening it for output? (prevents some encoders from complaining that the file already exists) */ bool const kill_when_input_done; /* kill() decoder when finished reading input? (prevents delays introduced by decoders that don't exit when we close stdout) */ char *const stdin_for_id3v2_kluge; /* if not NULL, try to skip id3v2 tags on input files by passing data on decoder's stdin using this as the stdin argument */ char *const magic; /* if not NULL, shntool will check for this string at position magic_offset in the input file */ int const magic_offset; /* offset within the file at which the magic string is expected to occur */ /* can be changed at run time */ char *extension; /* extension to append to files created by this module */ char *decoder; /* name of external program to handle decoding of this format - set to NULL if not applicable */ char *decoder_args; /* decoder arguments */ char *encoder; /* name of external program to handle encoding of this format - set to NULL if not applicable */ char *encoder_args; /* encoder arguments */ /* optional functions - set to NULL if not applicable */ bool (*is_our_file)(char *); /* routine to determine whether the given file belongs to this format plugin */ FILE *(*input_func)(char *,proc_info *); /* routine to open a file of this format for input - if NULL, shntool will launch the decoder */ FILE *(*output_func)(char *,proc_info *); /* routine to open a file of this format for output - if NULL, shntool will launch the encoder */ void (*extra_info)(char *); /* routine to display extra information in info mode */ void (*create_output_filename)(char *); /* routine to create a custom output filename */ bool (*input_header_kluge)(unsigned char *,struct _wave_info *); /* routine to determine correct header info for when decoders are unable to do so themselves */ /* internal argument lists (do not assign these in format modules) */ child_args input_args_template; /* input argument template (filled out by shntool, based on default_decoder_args) */ child_args input_args; /* input arguments, filled out (used by shntool when launching decoder) */ child_args output_args_template; /* output argument template (filled out by shntool, based on default_encoder_args) */ child_args output_args; /* output arguments, filled out (used by shntool when launching encoder) */ } format_module; /* child process types */ typedef enum { CHILD_INPUT, CHILD_OUTPUT } child_types; /* closed child process return codes */ typedef enum { CLOSE_SUCCESS, CLOSE_CHILD_ERROR_INPUT, CLOSE_CHILD_ERROR_OUTPUT } close_retcodes; #endif shntool-3.0.10/include/mode-types.h0000644000077100007710000000427211155771111014075 00000000000000/* mode-types.h - mode module type definitions * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* * $Id: mode-types.h,v 1.19 2009/03/11 17:18:01 jason Exp $ */ #ifndef __MODE_TYPES_H__ #define __MODE_TYPES_H__ #include "module-types.h" typedef struct _mode_module { char *const name; /* mode name, specified on command line */ char *const alias; /* alternate name that invokes this mode */ char *const description; /* one line description of this mode */ char *const cvsid; /* CVS revision (used to prevent it from being stripped) */ bool const creates_files; /* does this mode create output files? */ bool (*run_main)(int,char **); /* main() function for this mode */ void (*run_help)(void); /* help() function for this mode */ } mode_module; /* mode-accessible global options */ typedef struct _global_opts { char *output_directory; char *output_prefix; char *output_postfix; format_module *output_format; } global_opts; /* mode progress status output */ typedef struct _progress_info { char *prefix; char *clause; char *filename1; char *filedesc1; char *filename2; char *filedesc2; wlong bytes_written; wlong bytes_total; int dot_step; int percent; int last_percent; bool initialized; bool progress_shown; } progress_info; /* filename ordering options */ typedef enum { ORDER_AS_IS, ORDER_ASK, ORDER_ASCII, ORDER_NATURAL } ordering_types; #endif shntool-3.0.10/include/md5.h0000644000077100007710000001100410543064664012473 00000000000000/* Declaration of functions and data types used for MD5 sum computing library functions. Copyright (C) 1995-1997,1999-2005 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu. 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _MD5_H #define _MD5_H 1 #include #include #if HAVE_INTTYPES_H # include #endif #if HAVE_STDINT_H || _LIBC # include #endif #ifndef __GNUC_PREREQ # if defined __GNUC__ && defined __GNUC_MINOR__ # define __GNUC_PREREQ(maj, min) \ ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) # else # define __GNUC_PREREQ(maj, min) 0 # endif #endif #ifndef __THROW # if defined __cplusplus && __GNUC_PREREQ (2,8) # define __THROW throw () # else # define __THROW # endif #endif #ifndef __attribute__ # if ! __GNUC_PREREQ (2,8) || __STRICT_ANSI__ # define __attribute__(x) # endif #endif #ifndef _LIBC # define __md5_buffer md5_buffer # define __md5_finish_ctx md5_finish_ctx # define __md5_init_ctx md5_init_ctx # define __md5_process_block md5_process_block # define __md5_process_bytes md5_process_bytes # define __md5_read_ctx md5_read_ctx # define __md5_stream md5_stream #endif #ifndef uint32_t #define uint32_t unsigned int #endif typedef uint32_t md5_uint32; /* Structure to save state of computation between the single steps. */ struct md5_ctx { md5_uint32 A; md5_uint32 B; md5_uint32 C; md5_uint32 D; md5_uint32 total[2]; md5_uint32 buflen; char buffer[128] __attribute__ ((__aligned__ (__alignof__ (md5_uint32)))); }; /* * The following three functions are build up the low level used in * the functions `md5_stream' and `md5_buffer'. */ /* Initialize structure containing state of computation. (RFC 1321, 3.3: Step 3) */ extern void __md5_init_ctx (struct md5_ctx *ctx) __THROW; /* Starting with the result of former calls of this function (or the initialization function update the context for the next LEN bytes starting at BUFFER. It is necessary that LEN is a multiple of 64!!! */ extern void __md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx) __THROW; /* Starting with the result of former calls of this function (or the initialization function update the context for the next LEN bytes starting at BUFFER. It is NOT required that LEN is a multiple of 64. */ extern void __md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx) __THROW; /* Process the remaining bytes in the buffer and put result from CTX in first 16 bytes following RESBUF. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. IMPORTANT: On some systems it is required that RESBUF be correctly aligned for a 32 bits value. */ extern void *__md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) __THROW; /* Put result from CTX in first 16 bytes following RESBUF. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ extern void *__md5_read_ctx (const struct md5_ctx *ctx, void *resbuf) __THROW; /* Compute MD5 message digest for bytes read from STREAM. The resulting message digest number will be written into the 16 bytes beginning at RESBLOCK. */ extern int __md5_stream (FILE *stream, void *resblock) __THROW; /* Compute MD5 message digest for LEN bytes beginning at BUFFER. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. */ extern void *__md5_buffer (const char *buffer, size_t len, void *resblock) __THROW; #endif /* md5.h */ shntool-3.0.10/include/core.h0000644000077100007710000000730011157354613012740 00000000000000/* core.h - private type definitions, defines and macros * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* * $Id: core.h,v 1.96 2009/03/16 04:46:03 jason Exp $ */ #ifndef __CORE_H__ #define __CORE_H__ /* program info */ #define RELEASE VERSION #define COPYRIGHT "Copyright (C) 2000-2009" #define AUTHOR "Jason Jordan " #define URL1 "http://www.etree.org/shnutils/" #define URL2 "http://shnutils.freeshell.org/" /* options for core (non-mode) use */ #define GLOBAL_OPTS_CORE "afhjmv" /* options reserved for global use - modes cannot use these */ #define GLOBAL_OPTS "DF:HP:hi:qr:vw" #define GLOBAL_OPTS_OUTPUT "O:a:d:o:z:" /* set this environment variable to enable debugging. can also use -D, but this enables it earlier */ #define SHNTOOL_DEBUG_ENV "ST_DEBUG" /* various buffer sizes */ #define PROGNAME_SIZE 256 #define MAX_FILENAMES 32768 #ifdef HAVE_VSNPRINTF #define st_vsnprintf(a,b,c,d) vsnprintf(a,b,c,d) #else #define st_vsnprintf(a,b,c,d) vsprintf(a,c,d) #endif #ifndef HAVE_STRERROR extern char *sys_errlist[]; #define strerror(x) sys_errlist[x] #endif /* macro for natural filename sorting */ #ifndef PARAMS # if defined PROTOTYPES || (defined __STDC__ && __STDC__) # define PARAMS(Args) Args # else # define PARAMS(Args) () # endif #endif /* ID3v2 definitions */ #define ID3V2_MAGIC "ID3" /* id3v2 header */ typedef struct _id3v2_header { char magic[3]; unsigned char version[2]; unsigned char flags[1]; unsigned char size[4]; } id3v2_header; /* file clobber actions */ typedef enum { CLOBBER_ACTION_ASK, CLOBBER_ACTION_ALWAYS, CLOBBER_ACTION_NEVER } clobber_action_types; /* progress indicator types */ typedef enum { PROGRESS_NONE, PROGRESS_PERCENT, PROGRESS_DOT, PROGRESS_SPIN, PROGRESS_FACE } progress_types; /* argument sources */ typedef enum { ARGSRC_FORMAT, ARGSRC_CMDLINE, ARGSRC_ENV } argument_sources; /* input file sources */ typedef enum { INPUT_CMDLINE, INPUT_STDIN, INPUT_FILE, INPUT_INTERNAL } input_sources; /* mode and format module arrays */ extern mode_module *st_modes[]; extern format_module *st_formats[]; /* private global options */ typedef struct _private_opts { char *progname; char *progmode; char fullprogname[PROGNAME_SIZE]; int debug_level; int clobber_action; int reorder_type; int progress_type; bool is_aliased; bool show_hmmss; bool suppress_warnings; bool suppress_stderr; bool screen_dirty; mode_module *mode; } private_opts; typedef struct _input_files { int type; char *filename_source; FILE *fd; int argn; int argc; char **argv; int filecur; int filemax; char *filenames[MAX_FILENAMES]; } input_files; extern private_opts st_priv; extern input_files st_input; /* miscellaneous functions */ /* generic version printing function */ void st_version(void); /* functions for building argument lists in format modules */ void arg_init(format_module *); #endif shntool-3.0.10/include/shntool.h0000644000077100007710000000213011155771111013464 00000000000000/* shntool.h - global private definitions * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* * $Id: shntool.h,v 1.31 2009/03/11 17:18:01 jason Exp $ */ #ifndef __SHNTOOL_H__ #define __SHNTOOL_H__ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "format.h" #include "mode.h" #include "core.h" #include "convert.h" #include "binary.h" #endif shntool-3.0.10/include/config.h.in0000644000077100007710000000417211164057353013665 00000000000000/* include/config.h.in. Generated from configure.ac by autoheader. */ /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD /* Define to 1 if you have the `atol' function. */ #undef HAVE_ATOL /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* 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 `strerror' function. */ #undef HAVE_STRERROR /* 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 `sysconf' function. */ #undef HAVE_SYSCONF /* 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 you have the `vsnprintf' function. */ #undef HAVE_VSNPRINTF /* Define to 1 if you have the header file. */ #undef HAVE_WINDOWS_H /* Name of package */ #undef PACKAGE /* 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 version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN # undef WORDS_BIGENDIAN # endif #endif shntool-3.0.10/include/wave.h0000644000077100007710000002001411155771111012741 00000000000000/* wave.h - WAVE data definitions * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* * $Id: wave.h,v 1.48 2009/03/11 17:18:01 jason Exp $ */ #ifndef __WAVE_H__ #define __WAVE_H__ #include #include "format-types.h" #define WAVE_RIFF "RIFF" #define WAVE_WAVE "WAVE" #define WAVE_FMT "fmt " #define WAVE_DATA "data" #define AIFF_FORM "FORM" #define AIFF_FORM_TYPE_AIFF "AIFF" #define AIFF_FORM_TYPE_AIFC "AIFC" #define AIFF_COMM "COMM" #define AIFF_COMPRESSION_NONE "NONE" #define AIFF_COMPRESSION_SOWT "sowt" #define AIFF_SSND "SSND" #define WAVE_FORMAT_UNKNOWN (0x0000) #define WAVE_FORMAT_PCM (0x0001) #define WAVE_FORMAT_ADPCM (0x0002) #define WAVE_FORMAT_IEEE_FLOAT (0x0003) #define WAVE_FORMAT_ALAW (0x0006) #define WAVE_FORMAT_MULAW (0x0007) #define WAVE_FORMAT_OKI_ADPCM (0x0010) #define WAVE_FORMAT_IMA_ADPCM (0x0011) #define WAVE_FORMAT_DIGISTD (0x0015) #define WAVE_FORMAT_DIGIFIX (0x0016) #define WAVE_FORMAT_DOLBY_AC2 (0x0030) #define WAVE_FORMAT_GSM610 (0x0031) #define WAVE_FORMAT_ROCKWELL_ADPCM (0x003b) #define WAVE_FORMAT_ROCKWELL_DIGITALK (0x003c) #define WAVE_FORMAT_G721_ADPCM (0x0040) #define WAVE_FORMAT_G728_CELP (0x0041) #define WAVE_FORMAT_MPEG (0x0050) #define WAVE_FORMAT_MPEGLAYER3 (0x0055) #define WAVE_FORMAT_G726_ADPCM (0x0064) #define WAVE_FORMAT_G722_ADPCM (0x0065) #define CD_BLOCK_SIZE (2352) #define CD_BLOCKS_PER_SEC (75) #define CD_BLOCK_ALIGN (4) #define CD_MIN_BURNABLE_SIZE (705600) #define CD_CHANNELS (2) #define CD_SAMPLES_PER_SEC (44100) #define CD_BITS_PER_SAMPLE (16) #define CD_RATE (176400) #define CANONICAL_HEADER_SIZE (44) #define PROBLEM_NOT_CD_QUALITY (0x00000001) #define PROBLEM_CD_BUT_BAD_BOUND (0x00000002) #define PROBLEM_CD_BUT_TOO_SHORT (0x00000004) #define PROBLEM_HEADER_NOT_CANONICAL (0x00000008) #define PROBLEM_EXTRA_CHUNKS (0x00000010) #define PROBLEM_HEADER_INCONSISTENT (0x00000020) #define PROBLEM_MAY_BE_TRUNCATED (0x00000040) #define PROBLEM_JUNK_APPENDED (0x00000080) #define PROBLEM_DATA_NOT_ALIGNED (0x00000100) /* macros to determine if files have certain problems */ #define PROB_NOT_CD(f) ((f->problems) & (PROBLEM_NOT_CD_QUALITY)) #define PROB_BAD_BOUND(f) ((f->problems) & (PROBLEM_CD_BUT_BAD_BOUND)) #define PROB_TOO_SHORT(f) ((f->problems) & (PROBLEM_CD_BUT_TOO_SHORT)) #define PROB_HDR_NOT_CANONICAL(f) ((f->problems) & (PROBLEM_HEADER_NOT_CANONICAL)) #define PROB_EXTRA_CHUNKS(f) ((f->problems) & (PROBLEM_EXTRA_CHUNKS)) #define PROB_HDR_INCONSISTENT(f) ((f->problems) & (PROBLEM_HEADER_INCONSISTENT)) #define PROB_TRUNCATED(f) ((f->problems) & (PROBLEM_MAY_BE_TRUNCATED)) #define PROB_JUNK_APPENDED(f) ((f->problems) & (PROBLEM_JUNK_APPENDED)) #define PROB_DATA_NOT_ALIGNED(f) ((f->problems) & (PROBLEM_DATA_NOT_ALIGNED)) #define PROB_ODD_SIZED_DATA(f) (f->data_size & 1) typedef struct _wave_info { char *filename, /* file name of input file */ m_ss[16]; /* length, in m:ss.nnn or m:ss.ff format */ wint header_size; /* length of header, in bytes */ long extra_riff_size; /* total size of any extra RIFF chunks */ wshort channels, /* number of channels */ block_align, /* block align */ bits_per_sample, /* bits per sample */ wave_format; /* WAVE data format */ wlong samples_per_sec, /* samples per second */ avg_bytes_per_sec, /* average bytes per second (should equal rate) */ rate, /* calculated rate (should equal avg_bytes_per_sec) */ length, /* length of file, in seconds */ data_size, /* length of data chunk, as reported in the header */ padded_data_size, /* length of data chunk, including possible pad byte */ total_size, /* total length of the WAVE data, header and all */ chunk_size, /* read from header, should be total_size - 8 */ actual_size, /* set to the size of input file - this is misleading, */ /* since the input file may be compressed */ new_data_size, /* (set and used only in certain modes, ignore) */ beginning_byte, /* (set and used only in certain modes, ignore) */ new_beginning_byte; /* (set and used only in certain modes, ignore) */ double exact_length; /* length of file, in seconds (with ms precision) */ unsigned long problems; /* bitmap of problems found with the file, see above */ struct _format_module *input_format; /* pointer to the input format module that opens this */ FILE *input, *output; /* input/output file pointers (= NULL, use as needed) */ proc_info input_proc; /* pid (and handle on WIN32) of child input process */ proc_info output_proc; /* pid (and handle on WIN32) of child output process */ bool file_has_id3v2_tag; /* does this file contain an ID3v2 tag? */ bool stream_has_id3v2_tag; /* does the decoded input stream contain an ID3v2 tag? */ wlong id3v2_tag_size; /* size of the ID3v2 tag this file contains, if any */ } wave_info; /* returns a wave_info struct, filled out with the values of the WAVE data contained in the filename given. */ /* If called with NULL as the argument, then a wave_info struct is returned with all fields zero'd out. */ wave_info *new_wave_info(char *); /* constructs a canonical WAVE header from the values in the wave_info struct */ void make_canonical_header(unsigned char *buf,wave_info *info); /* returns a string corresponding to the WAVE format code given */ char *format_to_str(wshort); /* replaces the size chunk size at beginning of the wave header */ void put_chunk_size(unsigned char *,unsigned long); /* replaces the size reported in the "data" chunk of the wave header with the new size - also updates chunk size at beginning of the wave header */ void put_data_size(unsigned char *,int,unsigned long); /* kluges the WAVE header to get correct values when helper programs don't provide them */ bool do_header_kluges(unsigned char *,wave_info *); /* verifies that data coming in on the associated file descriptor describes a valid WAVE header */ bool verify_wav_header_internal(wave_info *,bool); #define verify_wav_header(a) verify_wav_header_internal(a,FALSE) #endif shntool-3.0.10/include/module.h0000644000077100007710000000476111155771111013277 00000000000000/* module.h - definitions common to mode and format modules * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* * $Id: module.h,v 1.15 2009/03/11 17:18:01 jason Exp $ */ #ifndef __MODULE_H__ #define __MODULE_H__ #include #include "fileio.h" #include "output.h" #include "wave.h" #include "module-types.h" /* macro to set cvsid string */ #define CVSID(x) static const char cvsid[] = x; #define CVSIDSTR ((char *const)&cvsid) /* misc definitions */ #define FILENAME_SIZE 2048 #define NO_CHILD_PID -740 #ifdef min #undef min #endif #ifdef max #undef max #endif #define min(x,y) ((x)<(y)?(x):(y)) #define max(x,y) ((x)>(y)?(x):(y)) #define st_free(x) if (x) { free(x); x = NULL; } /* boolean definitions */ #ifdef TRUE #undef TRUE #endif #ifdef FALSE #undef FALSE #endif #define TRUE (1==1) #define FALSE (0==1) /* function to open an input file for reading and skip past the ID3v2 tag, if one exists */ FILE *open_input_internal(char *,bool *,wlong *); #define open_input(a) open_input_internal(a,NULL,NULL) /* function to open an output file for writing */ FILE *open_output(char *); /* function to scan environment and return a pointer to the variable if it exists and is nonempty, otherwise returns NULL */ char *scan_env(char *); /* function to determine whether the data on the given file pointer contains an ID3v2 tag */ unsigned long check_for_id3v2_tag(FILE *); /* function to trim carriage returns and newlines from the end of strings */ void trim(char *); /* function to return a pointer to the filename with all directory components removed */ char *basename(char *); /* function to return a pointer to the extension of a filename, if one exists */ char *extname(char *); /* replacement snprintf */ void st_snprintf(char *,int,char *,...); #endif shntool-3.0.10/include/module-types.h0000644000077100007710000000315511155771111014435 00000000000000/* module-types.h - type definitions common to both modes and formats * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* * $Id: module-types.h,v 1.8 2009/03/11 17:18:01 jason Exp $ */ #ifndef __MODULE_TYPES_H__ #define __MODULE_TYPES_H__ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_WINDOWS_H #define WIN32_LEAN_AND_MEAN #include #endif #ifdef WIN32 #define NULLDEVICE "NUL" #define TERMIDEVICE "CON" #define TERMODEVICE "CON" #define PATHSEPCHAR '\\' #else #define NULLDEVICE "/dev/null" #define TERMIDEVICE "/dev/stdin" #define TERMODEVICE "/dev/stdout" #define PATHSEPCHAR '/' #endif /* boolean type */ typedef int bool; /* wtypes */ typedef unsigned long wlong; typedef unsigned short wshort; typedef unsigned int wint; /* process information */ typedef struct _proc_info { int pid; #ifdef WIN32 HANDLE hProcess; #endif } proc_info; #endif shntool-3.0.10/include/sha1.h0000644000077100007710000000634610341634040012642 00000000000000/* Declarations of functions and data types used for SHA1 sum library functions. Copyright (C) 2000, 2001, 2003, 2005 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef SHA1_H # define SHA1_H 1 # include # include "md5.h" /* Structure to save state of computation between the single steps. */ struct sha1_ctx { md5_uint32 A; md5_uint32 B; md5_uint32 C; md5_uint32 D; md5_uint32 E; md5_uint32 total[2]; md5_uint32 buflen; char buffer[128] __attribute__ ((__aligned__ (__alignof__ (md5_uint32)))); }; /* Initialize structure containing state of computation. */ extern void sha1_init_ctx (struct sha1_ctx *ctx); /* Starting with the result of former calls of this function (or the initialization function update the context for the next LEN bytes starting at BUFFER. It is necessary that LEN is a multiple of 64!!! */ extern void sha1_process_block (const void *buffer, size_t len, struct sha1_ctx *ctx); /* Starting with the result of former calls of this function (or the initialization function update the context for the next LEN bytes starting at BUFFER. It is NOT required that LEN is a multiple of 64. */ extern void sha1_process_bytes (const void *buffer, size_t len, struct sha1_ctx *ctx); /* Process the remaining bytes in the buffer and put result from CTX in first 20 bytes following RESBUF. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. IMPORTANT: On some systems it is required that RESBUF be correctly aligned for a 32 bits value. */ extern void *sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf); /* Put result from CTX in first 20 bytes following RESBUF. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ extern void *sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf); /* Compute SHA1 message digest for bytes read from STREAM. The resulting message digest number will be written into the 20 bytes beginning at RESBLOCK. */ extern int sha1_stream (FILE *stream, void *resblock); /* Compute SHA1 message digest for LEN bytes beginning at BUFFER. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. */ extern void *sha1_buffer (const char *buffer, size_t len, void *resblock); #endif shntool-3.0.10/include/convert.h0000644000077100007710000000411411155771111013462 00000000000000/* convert.h - conversion function definitions * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* * $Id: convert.h,v 1.15 2009/03/11 17:18:01 jason Exp $ */ #ifndef __CONVERT_H__ #define __CONVERT_H__ /* converts 4 bytes stored in little-endian format to an unsigned long */ unsigned long uchar_to_ulong_le(unsigned char *); /* converts 2 bytes stored in little-endian format to an unsigned short */ unsigned short uchar_to_ushort_le(unsigned char *); /* converts an unsigned long to 4 bytes stored in little-endian format */ void ulong_to_uchar_le(unsigned char *,unsigned long); /* converts an unsigned short to 2 bytes stored in little-endian format */ void ushort_to_uchar_le(unsigned char *,unsigned short); /* converts 4 bytes stored in big-endian format to an unsigned long */ unsigned long uchar_to_ulong_be(unsigned char *); /* converts 2 bytes stored in big-endian format to an unsigned short */ unsigned short uchar_to_ushort_be(unsigned char *); /* converts an unsigned long to 4 bytes stored in big-endian format */ void ulong_to_uchar_be(unsigned char *,unsigned long); /* converts an unsigned short to 2 bytes stored in big-endian format */ void ushort_to_uchar_be(unsigned char *,unsigned short); /* converts 4 bytes stored in synchsafe integer format to an unsigned long */ unsigned long synchsafe_int_to_ulong(unsigned char *); #endif shntool-3.0.10/include/fileio.h0000644000077100007710000000433511155771111013256 00000000000000/* fileio.h - file I/O function definitions * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* * $Id: fileio.h,v 1.29 2009/03/11 17:18:01 jason Exp $ */ #ifndef __FILEIO_H__ #define __FILEIO_H__ #include #include "mode-types.h" /* writes the specified number of zero bytes to the file descriptor given */ int write_padding(FILE *,int,progress_info *); /* reads n bytes from a file into a buffer */ int read_n_bytes(FILE *,unsigned char *,int,progress_info *); /* writes n bytes from a buffer into a file */ int write_n_bytes(FILE *,unsigned char *,int,progress_info *); /* transfers n bytes from a file into another file */ unsigned long transfer_n_bytes_internal(FILE *,FILE *,FILE *,unsigned long,progress_info *); #define transfer_n_bytes(a,b,c,d) transfer_n_bytes_internal(a,b,NULL,c,d) #define transfer_n_bytes2(a,b,c,d,e) transfer_n_bytes_internal(a,b,c,d,e) /* reads an unsigned long in big- and/or little-endian format from a file descriptor */ bool read_value_long(FILE * file,unsigned long *,unsigned long *,unsigned char *); #define read_tag(f,t) read_value_long(f,NULL,NULL,t) #define read_be_long(f,b) read_value_long(f,b,NULL,NULL) #define read_le_long(f,l) read_value_long(f,NULL,l,NULL) /* reads an unsigned short in big- and/or little-endian format from a file descriptor */ bool read_value_short(FILE * file,unsigned short *,unsigned short *); #define read_be_short(f,b) read_value_short(f,b,NULL) #define read_le_short(f,l) read_value_short(f,NULL,l) #endif shntool-3.0.10/include/output.h0000644000077100007710000000223411155771111013343 00000000000000/* output.h - output functions * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* * $Id: output.h,v 1.11 2009/03/11 17:18:01 jason Exp $ */ #ifndef __OUTPUT_H__ #define __OUTPUT_H__ void st_output(char *, ...); void st_info(char *, ...); void st_warning(char *, ...); void st_error(char *, ...); void st_help(char *, ...); void st_debug1(char *, ...); void st_debug2(char *, ...); void st_debug3(char *, ...); #endif shntool-3.0.10/include/mode.h0000644000077100007710000000743711164065132012740 00000000000000/* mode.h - mode module definitions * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* * $Id: mode.h,v 1.39 2009/03/30 06:44:42 jason Exp $ */ #ifndef __MODE_H__ #define __MODE_H__ #include #include #include "format-types.h" #include "mode-types.h" #include "module.h" #include "binary.h" /* default output directories */ #define CURRENT_DIR "." #define INPUT_FILE_DIR "" /* various buffer sizes */ #define BUF_SIZE 2048 #define XFER_SIZE 262144 /* error codes */ #define ST_EXIT_SUCCESS 0 #define ST_EXIT_ERROR 1 #define ST_EXIT_QUIT 255 /* global mode-accessible options */ extern global_opts st_ops; /* function to open an input stream and skip past the ID3v2 tag, if one exists */ bool open_input_stream(wave_info *); /* function to handle command-line option parsing with global (i.e. non-mode-specific) options */ int st_getopt(int,char **,char *); /* global usage screen */ void st_global_usage(); /* returns program name ("prog mode" or "alias") */ char *st_progname(void); /* function to convert a file's length to m:ss or m:ss.ff format */ void length_to_str(wave_info *); /* close a file descriptor, and wait for a child process if necessary */ int close_and_wait(FILE *,proc_info *,int,format_module *); #define close_input(a,b) close_and_wait(a,&b,CHILD_INPUT,NULL) #define close_output(a,b) close_and_wait(a,&b,CHILD_OUTPUT,NULL) #define close_input_stream(a) close_and_wait(a->input,&a->input_proc,CHILD_INPUT,a->input_format) #define close_output_stream(a) close_and_wait(a->output,&a->output_proc,CHILD_OUTPUT,NULL) /* function to discard the WAVE header, leaving the file pointer at the beginning of the audio data */ void discard_header(wave_info *); /* wrapper function to name output filename based on input filename and extension */ void create_output_filename(char *,char *,char *); /* wrapper function to open an output stream */ FILE *open_output_stream(char *,proc_info *); /* function to determine if two filenames point to the same file */ int files_are_identical(char *,char *); /* function to remove a file if it exists */ void remove_file(char *); /* a simple menu system to alter the order in which given input files will be processed */ void alter_file_order(wave_info **,int); /* function to reorder files based on user preference */ void reorder_files(wave_info **,int); /* functions to aid in parsing input length formats */ wlong smrt_parse(unsigned char *,wave_info *); /* function to determine whether odd-sized data chunks are NULL-padded to an even length */ bool odd_sized_data_chunk_is_null_padded(wave_info *); /* functions for building argument lists in format modules */ void arg_reset(child_args *); void arg_add(child_args *,char *); void arg_replace(child_args *,int,char *); /* functions for progress output */ void prog_update(progress_info *); void prog_success(progress_info *); void prog_error(progress_info *); /* functions for managing the input file source */ void input_init(int,int,char **); char *input_get_filename(); void input_read_all_files(); int input_get_file_count(); #endif shntool-3.0.10/include/config.h0000644000077100007710000000453211164057373013262 00000000000000/* include/config.h. Generated from config.h.in by configure. */ /* include/config.h.in. Generated from configure.ac by autoheader. */ /* Define if building universal (internal helper macro) */ /* #undef AC_APPLE_UNIVERSAL_BUILD */ /* Define to 1 if you have the `atol' function. */ #define HAVE_ATOL 1 /* Define to 1 if you have the header file. */ #define HAVE_INTTYPES_H 1 /* Define to 1 if you have the header file. */ #define HAVE_MEMORY_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STDINT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STDLIB_H 1 /* Define to 1 if you have the `strerror' function. */ #define HAVE_STRERROR 1 /* Define to 1 if you have the header file. */ #define HAVE_STRINGS_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STRING_H 1 /* Define to 1 if you have the `sysconf' function. */ #define HAVE_SYSCONF 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_STAT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the header file. */ #define HAVE_UNISTD_H 1 /* Define to 1 if you have the `vsnprintf' function. */ #define HAVE_VSNPRINTF 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_WINDOWS_H */ /* Name of package */ #define PACKAGE "shntool" /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "shnutils@freeshell.org" /* Define to the full name of this package. */ #define PACKAGE_NAME "shntool" /* Define to the full name and version of this package. */ #define PACKAGE_STRING "shntool 3.0.10" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "shntool" /* Define to the version of this package. */ #define PACKAGE_VERSION "3.0.10" /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Version number of package */ #define VERSION "3.0.10" /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN /* # undef WORDS_BIGENDIAN */ # endif #endif shntool-3.0.10/include/stamp-h10000644000077100007710000000003711164057373013215 00000000000000timestamp for include/config.h shntool-3.0.10/configure0000744000077100007710000062347611164057360012140 00000000000000#! /bin/sh # From configure.ac Id: configure.ac,v 1.125 2009/03/30 05:55:33 jason Exp . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.63 for shntool 3.0.10. # # Report bugs to . # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008 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 # PATH needs CR # 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_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 if (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 # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false 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. 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); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # Required to use basename. 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 # Name of the executable. 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'` # CDPATH. $as_unset CDPATH if test "x$CONFIG_SHELL" = x; then if (eval ":") 2>/dev/null; then as_have_required=yes else as_have_required=no fi if test $as_have_required = yes && (eval ": (as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=\$LINENO as_lineno_2=\$LINENO test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } ") 2> /dev/null; then : else as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. case $as_dir in /*) for as_base in sh bash ksh sh5; do as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac done IFS=$as_save_IFS for as_shell in $as_candidate_shells $SHELL; do # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF 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 : _ASEOF }; then CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF 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_func_return () { (exit $1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = "$1" ); then : else exitcode=1 echo positional parameters were not saved. fi test $exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } _ASEOF }; then break fi fi done if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test $as_have_required = no; then echo This script requires a shell more modern than all the echo shells that I found on your system. Please install a echo modern shell, or manually run the script under such a echo shell if you do have one. { (exit 1); exit 1; } fi fi fi (eval "as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0") || { echo No shell found that supports shell functions. echo Please tell bug-autoconf@gnu.org about your system, echo including any error possibly output before this message. echo This can help us improve future autoconf versions. echo Configuration will now proceed without shell functions. } as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. 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 { (exit 1); exit 1; }; } # 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 } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi 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 -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' 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=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # 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 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, 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= SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='shntool' PACKAGE_TARNAME='shntool' PACKAGE_VERSION='3.0.10' PACKAGE_STRING='shntool 3.0.10' PACKAGE_BUGREPORT='shnutils@freeshell.org' ac_unique_file="src/core_shntool.c" # 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_subst_vars='LTLIBOBJS LIBOBJS KEXIS BONK TAKC MKWCON ALS TTA LA ALAC WAVPACK LPAC OPTIMFROG MAC SOX FLAC SHORTEN MODES_CONFIGURED FORMAT_OBJS MODE_OBJS EGREP GREP CPP LN_S am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC 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 host_os host_vendor host_cpu host build_os build_vendor build_cpu build 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_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_dependency_tracking with_modes with_formats with_extra_modes with_extra_formats ' 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=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_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 { (exit 1); exit 1; }; } 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_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 { (exit 1); exit 1; }; } 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_echo "$as_me: error: invalid package name: $ac_useropt" >&2 { (exit 1); exit 1; }; } 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_echo "$as_me: error: invalid package name: $ac_useropt" >&2 { (exit 1); exit 1; }; } 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_echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } 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_echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2 { (exit 1); exit 1; }; } ;; *) $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_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } 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 $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 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_echo "$as_me: error: working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || { $as_echo "$as_me: error: pwd does not report name of working directory" >&2 { (exit 1); exit 1; }; } # 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_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } 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 shntool 3.0.10 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/shntool] --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 shntool 3.0.10:";; 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] --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-modes=LIST Specify default modes --with-formats=LIST Specify default file formats --with-extra-modes=LIST Specify additional modes --with-extra-formats=LIST Specify additional file formats 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 C/C++/Objective 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 . _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 shntool configure 3.0.10 generated by GNU Autoconf 2.63 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 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 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 shntool $as_me 3.0.10, which was generated by GNU Autoconf 2.63. 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) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$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 ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export 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 cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX 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:$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= ;; #( *) $as_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 cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX 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 cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX 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 cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX 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'; { (exit 1); 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 # 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 # 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 ac_site_file1=$CONFIG_SITE 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 -r "$ac_site_file"; then { $as_echo "$as_me:$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" 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. if test -f "$cache_file"; then { $as_echo "$as_me:$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:$LINENO: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # 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:$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:$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:$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:$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:$LINENO: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:$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. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:$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_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 $as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } 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 ac_config_headers="$ac_config_headers include/config.h" 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_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 $as_echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} { (exit 1); exit 1; }; } 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. # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || { { $as_echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 $as_echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} { (exit 1); exit 1; }; } { $as_echo "$as_me:$LINENO: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if test "${ac_cv_build+set}" = set; 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_echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 $as_echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 $as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} { (exit 1); exit 1; }; } fi { $as_echo "$as_me:$LINENO: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 $as_echo "$as_me: error: invalid value of canonical build" >&2;} { (exit 1); exit 1; }; };; 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:$LINENO: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if test "${ac_cv_host+set}" = set; 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_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 $as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} { (exit 1); exit 1; }; } fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 $as_echo "$as_me: error: invalid value of canonical host" >&2;} { (exit 1); exit 1; }; };; 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 am__api_version='1.10' # 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:$LINENO: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; 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 { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$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:$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:$LINENO: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 echo timestamp > conftest.file # 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 ( 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 rm -f conftest.file 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_echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&5 $as_echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&2;} { (exit 1); exit 1; }; } fi test "$2" = conftest.file ) then # Ok. : else { { $as_echo "$as_me:$LINENO: error: newly created file is older than distributed files! Check your system clock" >&5 $as_echo "$as_me: error: newly created file is older than distributed files! Check your system clock" >&2;} { (exit 1); exit 1; }; } fi { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } 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` test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { $as_echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi { $as_echo "$as_me:$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 test "${ac_cv_path_mkdir+set}" = set; 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 { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$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 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. test -d ./--version && rmdir ./--version MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:$LINENO: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac 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:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_AWK+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:$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:$LINENO: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:$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 { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; 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:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:$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 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_echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 $as_echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } 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='shntool' VERSION='3.0.10' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # 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"} install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} # 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:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_STRIP+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:$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:$LINENO: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:$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:$LINENO: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:$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:$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" # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' 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 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:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:$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:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:$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:$LINENO: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:$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:$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:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:$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:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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:$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:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:$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:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:$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:$LINENO: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:$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:$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:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 $as_echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } # Provide some information about the compiler. $as_echo "$as_me:$LINENO: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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:$LINENO: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; 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 { $as_echo "$as_me:$LINENO: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } if test -z "$ac_file"; then $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 $as_echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } fi ac_exeext=$ac_cv_exeext # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } fi fi fi { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } { $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } { $as_echo "$as_me:$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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; 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:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } fi rm -f conftest$ac_cv_exeext { $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT { $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if test "${ac_cv_objext+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; 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:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:$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 test "${ac_cv_c_compiler_gnu+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 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:$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:$LINENO: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if test "${ac_cv_prog_cc_g+set}" = set; 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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 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:$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:$LINENO: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* 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" 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 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:$LINENO: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:$LINENO: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; 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 DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:$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 # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi { $as_echo "$as_me:$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='\' 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:$LINENO: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if test "${am_cv_CC_dependencies_compiler_type+set}" = set; 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'. 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 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 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in 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 ;; none) break ;; esac # 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. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} 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 sub/conftest.${OBJEXT-o} 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:$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 # 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:$LINENO: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; 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 { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$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:$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' 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:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_AWK+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:$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:$LINENO: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:$LINENO: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:$LINENO: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi { $as_echo "$as_me:$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 { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; 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:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" 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:$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 test "${ac_cv_prog_CPP+set}" = set; 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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f 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:$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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 $as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } 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:$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 test "${ac_cv_path_GREP+set}" = set; 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" { test -f "$ac_path_GREP" && $as_test_x "$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 ac_count=`expr $ac_count + 1` 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_echo "$as_me:$LINENO: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 $as_echo "$as_me: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:$LINENO: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if test "${ac_cv_path_EGREP+set}" = set; 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" { test -f "$ac_path_EGREP" && $as_test_x "$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 ac_count=`expr $ac_count + 1` 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_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 $as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if test "${ac_cv_header_stdc+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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 rm -f 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : 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 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF 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` { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } if test "${ac_cv_c_bigendian+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_c_bigendian=unknown # See if we're dealing with a universal compiler. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifndef __APPLE_CC__ not a universal capable compiler #endif typedef int dummy; _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then # Check for potential -arch flags. It is not universal unless # there are some -arch flags. Note that *ppc* also matches # ppc64. This check is also rather less than ideal. case "${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}" in #( *-arch*ppc*|*-arch*i386*|*-arch*x86_64*) ac_cv_c_bigendian=universal;; esac else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_c_bigendian = unknown; then # See if sys/param.h defines the BYTE_ORDER macro. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { #if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ && LITTLE_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then # It does; now see whether it defined to BIG_ENDIAN or not. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_bigendian=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { #if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then # It does; now see whether it defined to _BIG_ENDIAN or not. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { #ifndef _BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_bigendian=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # Compile a test program. if test "$cross_compiling" = yes; then # Try to guess by grepping values from an object file. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; int use_ascii (int i) { return ascii_mm[i] + ascii_ii[i]; } short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; int use_ebcdic (int i) { return ebcdic_mm[i] + ebcdic_ii[i]; } extern int foo; int main () { return use_ascii (foo) == use_ebcdic (foo); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then ac_cv_c_bigendian=yes fi if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then if test "$ac_cv_c_bigendian" = unknown; then ac_cv_c_bigendian=no else # finding both strings is unlikely to happen, but who knows? ac_cv_c_bigendian=unknown fi fi else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { /* Are we little or big endian? From Harbison&Steele. */ union { long int l; char c[sizeof (long int)]; } u; u.l = 1; return u.c[sizeof (long int) - 1] == 1; ; return 0; } _ACEOF rm -f 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_bigendian=no 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 ( exit $ac_status ) ac_cv_c_bigendian=yes fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 $as_echo "$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in #( yes) cat >>confdefs.h <<\_ACEOF #define WORDS_BIGENDIAN 1 _ACEOF ;; #( no) ;; #( universal) cat >>confdefs.h <<\_ACEOF #define AC_APPLE_UNIVERSAL_BUILD 1 _ACEOF ;; #( *) { { $as_echo "$as_me:$LINENO: error: unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" >&5 $as_echo "$as_me: error: unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} { (exit 1); exit 1; }; } ;; esac ac_build_modes="len fix hash pad join split cat cmp cue conv info strip gen trim" ac_build_formats="wav aiff shn flac ape alac tak ofr tta als wv lpac la mkw bonk kxs cust term null" ac_alternate_modes= ac_alternate_formats= ac_alternate_modes_flag=false ac_alternate_formats_flag=false # Check whether --with-modes was given. if test "${with_modes+set}" = set; then withval=$with_modes; ac_alternate_modes_flag=true ; ac_alternate_modes="`echo "$withval" | sed -e 's/,/ /g'`" fi # Check whether --with-formats was given. if test "${with_formats+set}" = set; then withval=$with_formats; ac_alternate_formats_flag="true" ; ac_alternate_formats="`echo "$withval" | sed -e 's/,/ /g'`" fi if test "x$ac_alternate_modes_flag" = "xfalse"; then ac_current_modes="$ac_build_modes" else ac_current_modes="$ac_alternate_modes" fi if test "x$ac_alternate_formats_flag" = "xfalse"; then ac_current_formats="$ac_build_formats" else ac_current_formats="$ac_alternate_formats" fi # Check whether --with-extra-modes was given. if test "${with_extra_modes+set}" = set; then withval=$with_extra_modes; ac_more_modes="`echo "$withval" | sed -e 's/,/ /g'`" ; ac_current_modes="$ac_current_modes $ac_more_modes" fi # Check whether --with-extra-formats was given. if test "${with_extra_formats+set}" = set; then withval=$with_extra_formats; ac_more_formats="`echo "$withval" | sed -e 's/,/ /g'`" ; ac_current_formats="$ac_current_formats $ac_more_formats" fi ac_list_modes= ac_list_formats= mode_exists=false format_exists=false MODE_OBJS= FORMAT_OBJS= MODES_CONFIGURED= for mode in $ac_current_modes; do if test "`echo "$ac_list_modes" | grep -c "mode_${mode}\.c"`" = "0"; then if test -f ${srcdir}/src/mode_${mode}.c; then ac_list_modes="${ac_list_modes}mode_${mode}.c " MODE_OBJS="${MODE_OBJS}mode_${mode}.\$(OBJEXT) " MODES_CONFIGURED="${MODES_CONFIGURED}${mode} " mode_exists=true else { $as_echo "$as_me:$LINENO: WARNING: missing ${srcdir}/src/mode_${mode}.c -- mode '${mode}' will not be compiled" >&5 $as_echo "$as_me: WARNING: missing ${srcdir}/src/mode_${mode}.c -- mode '${mode}' will not be compiled" >&2;} fi fi done for format in $ac_current_formats; do if test "`echo "$ac_list_formats" | grep -c "format_${format}\.c"`" = "0"; then if test -f ${srcdir}/src/format_${format}.c; then ac_list_formats="${ac_list_formats}format_${format}.c " FORMAT_OBJS="${FORMAT_OBJS}format_${format}.\$(OBJEXT) " format_exists=true case $format in aiff ) format_aiff=true ;; ape ) format_ape=true ;; flac ) format_flac=true ;; lpac ) format_lpac=true ;; ofr ) format_ofr=true ;; shn ) format_shn=true ;; wv ) format_wv=true ;; alac ) format_alac=true ;; la ) format_la=true ;; tta ) format_tta=true ;; als ) format_als=true ;; tak ) format_tak=true ;; bonk ) format_bonk=true ;; kxs ) format_kxs=true ;; mkw ) format_mkw=true ;; esac else { $as_echo "$as_me:$LINENO: WARNING: missing ${srcdir}/src/format_${format}.c -- format '${format}' will not be compiled" >&5 $as_echo "$as_me: WARNING: missing ${srcdir}/src/format_${format}.c -- format '${format}' will not be compiled" >&2;} fi fi done if test x$mode_exists = xfalse; then { { $as_echo "$as_me:$LINENO: error: at least one valid mode must be specified" >&5 $as_echo "$as_me: error: at least one valid mode must be specified" >&2;} { (exit 1); exit 1; }; } fi if test x$format_exists = xfalse; then { { $as_echo "$as_me:$LINENO: error: at least one valid file format must be specified" >&5 $as_echo "$as_me: error: at least one valid file format must be specified" >&2;} { (exit 1); exit 1; }; } fi echo { $as_echo "$as_me:$LINENO: checking for optional helper programs" >&5 $as_echo "$as_me: checking for optional helper programs" >&6;} echo if test x$format_shn = xtrue; then # Extract the first word of "shorten", so it can be a program name with args. set dummy shorten; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_SHORTEN+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$SHORTEN"; then ac_cv_prog_SHORTEN="$SHORTEN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_SHORTEN="yes" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_SHORTEN" && ac_cv_prog_SHORTEN="no (install for shn support)" fi fi SHORTEN=$ac_cv_prog_SHORTEN if test -n "$SHORTEN"; then { $as_echo "$as_me:$LINENO: result: $SHORTEN" >&5 $as_echo "$SHORTEN" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test x$format_flac = xtrue; then # Extract the first word of "flac", so it can be a program name with args. set dummy flac; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_FLAC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$FLAC"; then ac_cv_prog_FLAC="$FLAC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_FLAC="yes" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_FLAC" && ac_cv_prog_FLAC="no (install for flac support)" fi fi FLAC=$ac_cv_prog_FLAC if test -n "$FLAC"; then { $as_echo "$as_me:$LINENO: result: $FLAC" >&5 $as_echo "$FLAC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test x$format_aiff = xtrue; then # Extract the first word of "sox", so it can be a program name with args. set dummy sox; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_SOX+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$SOX"; then ac_cv_prog_SOX="$SOX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_SOX="yes" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_SOX" && ac_cv_prog_SOX="no (install for aiff support)" fi fi SOX=$ac_cv_prog_SOX if test -n "$SOX"; then { $as_echo "$as_me:$LINENO: result: $SOX" >&5 $as_echo "$SOX" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test x$format_ape = xtrue; then # Extract the first word of "mac", so it can be a program name with args. set dummy mac; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_MAC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$MAC"; then ac_cv_prog_MAC="$MAC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_MAC="yes" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_MAC" && ac_cv_prog_MAC="no (install for ape support)" fi fi MAC=$ac_cv_prog_MAC if test -n "$MAC"; then { $as_echo "$as_me:$LINENO: result: $MAC" >&5 $as_echo "$MAC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test x$format_ofr = xtrue; then # Extract the first word of "ofr", so it can be a program name with args. set dummy ofr; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_OPTIMFROG+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$OPTIMFROG"; then ac_cv_prog_OPTIMFROG="$OPTIMFROG" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OPTIMFROG="yes" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_OPTIMFROG" && ac_cv_prog_OPTIMFROG="no (install for ofr support)" fi fi OPTIMFROG=$ac_cv_prog_OPTIMFROG if test -n "$OPTIMFROG"; then { $as_echo "$as_me:$LINENO: result: $OPTIMFROG" >&5 $as_echo "$OPTIMFROG" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test x$format_lpac = xtrue; then # Extract the first word of "lpac", so it can be a program name with args. set dummy lpac; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_LPAC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$LPAC"; then ac_cv_prog_LPAC="$LPAC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_LPAC="yes" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_LPAC" && ac_cv_prog_LPAC="no (install for lpac support)" fi fi LPAC=$ac_cv_prog_LPAC if test -n "$LPAC"; then { $as_echo "$as_me:$LINENO: result: $LPAC" >&5 $as_echo "$LPAC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test x$format_wv = xtrue; then # Extract the first word of "wvunpack", so it can be a program name with args. set dummy wvunpack; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_WAVPACK+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$WAVPACK"; then ac_cv_prog_WAVPACK="$WAVPACK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_WAVPACK="yes" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_WAVPACK" && ac_cv_prog_WAVPACK="no (install for wv support)" fi fi WAVPACK=$ac_cv_prog_WAVPACK if test -n "$WAVPACK"; then { $as_echo "$as_me:$LINENO: result: $WAVPACK" >&5 $as_echo "$WAVPACK" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test x$format_alac = xtrue; then # Extract the first word of "alac", so it can be a program name with args. set dummy alac; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ALAC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ALAC"; then ac_cv_prog_ALAC="$ALAC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ALAC="yes" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_ALAC" && ac_cv_prog_ALAC="no (install for alac support)" fi fi ALAC=$ac_cv_prog_ALAC if test -n "$ALAC"; then { $as_echo "$as_me:$LINENO: result: $ALAC" >&5 $as_echo "$ALAC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test x$format_la = xtrue; then # Extract the first word of "la", so it can be a program name with args. set dummy la; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_LA+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$LA"; then ac_cv_prog_LA="$LA" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_LA="yes" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_LA" && ac_cv_prog_LA="no (install for la support)" fi fi LA=$ac_cv_prog_LA if test -n "$LA"; then { $as_echo "$as_me:$LINENO: result: $LA" >&5 $as_echo "$LA" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test x$format_tta = xtrue; then # Extract the first word of "ttaenc", so it can be a program name with args. set dummy ttaenc; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_TTA+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$TTA"; then ac_cv_prog_TTA="$TTA" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_TTA="yes" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_TTA" && ac_cv_prog_TTA="no (install for tta support)" fi fi TTA=$ac_cv_prog_TTA if test -n "$TTA"; then { $as_echo "$as_me:$LINENO: result: $TTA" >&5 $as_echo "$TTA" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test x$format_als = xtrue; then # Extract the first word of "mp4als", so it can be a program name with args. set dummy mp4als; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ALS+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ALS"; then ac_cv_prog_ALS="$ALS" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ALS="yes" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_ALS" && ac_cv_prog_ALS="no (install for als support)" fi fi ALS=$ac_cv_prog_ALS if test -n "$ALS"; then { $as_echo "$as_me:$LINENO: result: $ALS" >&5 $as_echo "$ALS" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test x$format_mkw = xtrue; then # Extract the first word of "mkwcon", so it can be a program name with args. set dummy mkwcon; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_MKWCON+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$MKWCON"; then ac_cv_prog_MKWCON="$MKWCON" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_MKWCON="yes" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_MKWCON" && ac_cv_prog_MKWCON="no (install for mkw support)" fi fi MKWCON=$ac_cv_prog_MKWCON if test -n "$MKWCON"; then { $as_echo "$as_me:$LINENO: result: $MKWCON" >&5 $as_echo "$MKWCON" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test x$format_tak = xtrue; then # Extract the first word of "takc", so it can be a program name with args. set dummy takc; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_TAKC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$TAKC"; then ac_cv_prog_TAKC="$TAKC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_TAKC="yes" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_TAKC" && ac_cv_prog_TAKC="no (install for tak support)" fi fi TAKC=$ac_cv_prog_TAKC if test -n "$TAKC"; then { $as_echo "$as_me:$LINENO: result: $TAKC" >&5 $as_echo "$TAKC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test x$format_bonk = xtrue; then # Extract the first word of "bonk", so it can be a program name with args. set dummy bonk; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_BONK+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$BONK"; then ac_cv_prog_BONK="$BONK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_BONK="yes" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_BONK" && ac_cv_prog_BONK="no (install for bonk support)" fi fi BONK=$ac_cv_prog_BONK if test -n "$BONK"; then { $as_echo "$as_me:$LINENO: result: $BONK" >&5 $as_echo "$BONK" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test x$format_kxs = xtrue; then # Extract the first word of "kexis", so it can be a program name with args. set dummy kexis; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_KEXIS+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$KEXIS"; then ac_cv_prog_KEXIS="$KEXIS" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_KEXIS="yes" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_KEXIS" && ac_cv_prog_KEXIS="no (install for kxs support)" fi fi KEXIS=$ac_cv_prog_KEXIS if test -n "$KEXIS"; then { $as_echo "$as_me:$LINENO: result: $KEXIS" >&5 $as_echo "$KEXIS" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi echo { $as_echo "$as_me:$LINENO: checking for win32 environment" >&5 $as_echo "$as_me: checking for win32 environment" >&6;} echo for ac_header in windows.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 $as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 $as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$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:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------- ## ## Report this to shnutils@freeshell.org ## ## ------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done echo { $as_echo "$as_me:$LINENO: checking for library functions" >&5 $as_echo "$as_me: checking for library functions" >&6;} echo for ac_func in strerror vsnprintf atol sysconf do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 $as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* 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 $ac_func (); /* 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_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF 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:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then eval "$as_ac_var=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done echo { $as_echo "$as_me:$LINENO: creating build files" >&5 $as_echo "$as_me: creating build files" >&6;} echo ac_config_files="$ac_config_files man/Makefile src/Makefile Makefile" 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:$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= ;; #( *) $as_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 test "x$cache_file" != "x/dev/null" && { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { $as_echo "$as_me:$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= 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. ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 $as_echo "$as_me: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 $as_echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } 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:$LINENO: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF || ac_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} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_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 # PATH needs CR # 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_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 if (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 # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false 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. 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); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # Required to use basename. 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 # Name of the executable. 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'` # CDPATH. $as_unset CDPATH as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. 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 { (exit 1); exit 1; }; } # 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 } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi 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 -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' 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=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # 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 # 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 shntool $as_me 3.0.10, which was generated by GNU Autoconf 2.63. 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 from templates according to the current configuration. Usage: $0 [OPTION]... [FILE]... -h, --help print this help, then exit -V, --version print version number and configuration settings, 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 ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ shntool config.status 3.0.10 configured by $0, generated by GNU Autoconf 2.63, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2008 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=$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 ;; --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"` ;; esac CONFIG_FILES="$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 CONFIG_HEADERS="$CONFIG_HEADERS '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header { $as_echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; };; --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_echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *) ac_config_targets="$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 "include/config.h") CONFIG_HEADERS="$CONFIG_HEADERS include/config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 $as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; 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= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || { $as_echo "$as_me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } # 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=' ' 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 {' >"$tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 $as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } 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_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 $as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } 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_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 $as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } 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 >>"\$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 >>"\$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 < "$tmp/subs1.awk" > "$tmp/subs.awk" \ || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5 $as_echo "$as_me: error: could not setup config files machinery" >&2;} { (exit 1); exit 1; }; } _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ 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[ ]*=/{ s/:*\$(srcdir):*/:/ s/:*\${srcdir}:*/:/ s/:*@srcdir@:*/:/ s/^\([^=]*=[ ]*\):*/\1/ s/:*$// 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 >"$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_t=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_t"; then break elif $ac_last_try; then { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_HEADERS" >&5 $as_echo "$as_me: error: could not make $CONFIG_HEADERS" >&2;} { (exit 1); exit 1; }; } 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_echo "$as_me:$LINENO: error: could not setup config headers machinery" >&5 $as_echo "$as_me: error: could not setup config headers machinery" >&2;} { (exit 1); exit 1; }; } 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_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5 $as_echo "$as_me: error: invalid tag $ac_tag" >&2;} { (exit 1); exit 1; }; };; :[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="$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_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 $as_echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac ac_file_inputs="$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:$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 >"$tmp/stdin" \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } ;; 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" case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { 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_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 $as_echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } 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:$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 "$tmp/subs.awk" >$tmp/out \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:$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 "$tmp/stdin" case $ac_file in -) cat "$tmp/out" && rm -f "$tmp/out";; *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; esac \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" } >"$tmp/config.h" \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:$LINENO: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$tmp/config.h" "$ac_file" \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ || { { $as_echo "$as_me:$LINENO: error: could not create -" >&5 $as_echo "$as_me: error: could not create -" >&2;} { (exit 1); exit 1; }; } 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:$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"" || # Autoconf 2.62 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"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //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' -e 's/\$U/'"$U"'/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 case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { 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_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 $as_echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ;; esac done # for ac_tag { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5 $as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } # 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 || { (exit 1); exit 1; } fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi ac_compiled_modes="`echo "$ac_list_modes" | sed -e 's/mode_//g' -e 's/\.c//g'`" ac_compiled_formats="`echo "$ac_list_formats" | sed -e 's/format_//g' -e 's/\.c//g'`" echo { $as_echo "$as_me:$LINENO: creating module glue files" >&5 $as_echo "$as_me: creating module glue files" >&6;} echo echo "processing modes..." sh ${srcdir}/utils/glue.sh mode $ac_compiled_modes > src/glue_modes.c echo "processing formats..." sh ${srcdir}/utils/glue.sh format $ac_compiled_formats > src/glue_formats.c echo { $as_echo "$as_me:$LINENO: ready to compile. $PACKAGE is now configured with the following options: version : $VERSION modes : $ac_compiled_modes formats : $ac_compiled_formats install : ${prefix}/bin " >&5 $as_echo "$as_me: ready to compile. $PACKAGE is now configured with the following options: version : $VERSION modes : $ac_compiled_modes formats : $ac_compiled_formats install : ${prefix}/bin " >&6;} shntool-3.0.10/README0000644000077100007710000000612410550461217011072 00000000000000Installation ------------ You will most likely need GNU make to build and install shntool. So far, the standard make program is known to fail on NetBSD and Solaris. If 'make' fails, try 'gmake'. If you don't have 'gmake', then you will need to install GNU make. The latest version of GNU make as of shntool's release is 3.81, and you can build it from source available here: http://ftp.gnu.org/gnu/make/ Generic instructions on how to build and install shntool are contained in the INSTALL file. Be sure to read it, especially if you have any problems, as it will contain important notes related to building and installing. However, for most people this process will be as simple as: % ./configure % make (or gmake, if make gives you trouble) % su -c "make install" (or install-strip, where strip is supported) If you want to customize which mode and/or format modules are built, see the "shntool-specific configure options" section below. Documentation ------------- A description of shntool's modes and command-line arguments are contained in the man page. To see what changes were made since previous releases, consult the ChangeLog file. shntool-specific configure options ---------------------------------- In addition to the standard command-line switches described in the "Basic Installation" section below, the configure script for shntool also recognizes the following four options: --with-modes=LIST Specify default modes --with-formats=LIST Specify default file formats --with-extra-modes=LIST Specify additional modes --with-extra-formats=LIST Specify additional file formats The --with-modes and --with-formats switches are intended to allow you to selectively compile certain modes and/or file formats from the list of built-in modules. They also allow you to alter the order of their appearance in the modes[] and formats[] arrays internal to shntool, which may be useful if, for instance, you want to have the default output file format be 'shn' instead of 'wav' for modes that create files (since they default to the first file format that supports output, which will be 'wav' if the default order is not changed). For example, if you want support only for WAVE and shorten-compressed files, and you want 'shn' to be the default output format, then pass '--with-formats=shn,wav' to the configure script. Or, suppose you never intend to fix files, and would only like to view information about them. Then you can configure shntool to only support the 'len' and 'info' modes by passing '--with-modes=len,info' to the configure script. The --with-extra-modes and --with-extra-formats switches are intended to be used by module developers as a way to get their module compiled into shntool. For example, suppose you create a file format module for the 'bar' format. Then you can simply run './configure --with-extra-formats=bar' and your module will be included in the list of modules to be built. Mode modules are configured similarly. ================== Document revision: ================== $Id: README,v 1.10 2007/01/08 15:26:07 jason Exp $ shntool-3.0.10/doc/0000777000077100007710000000000011164065154011042 500000000000000shntool-3.0.10/doc/CREDITS0000644000077100007710000001521611164063461012002 00000000000000Thanks go to the following people, in no particular order: Tim [tmo], whose ideas prompted the creation of this program's predecessor (shnlen), and whose diligent testing helped iron out the bugs in that program. Herschel Gelman, who had the great suggestion that shnlen could check to see whether the .wav files inside the .shn's were properly cut on sector boundaries. He also suggested that join mode could write to stdout, so that large amounts of data could be piped into an external program, such as an mp3 encoder. Caleb Epstein, for sending patches and helping to debug shntool, as well as providing documentation and binary packages. Also, for reporting the fix mode hang, as well as providing a set of files that helped me reproduce it. Additionally, for suggesting that info mode could tell whether .shn files were seekable. Jeff Kempka, for helping me obtain unruly files to aid in figuring out a rare bug in the 0.9x series, as well as usability suggestions. Bill Bumgarner, for suggesting that shntool move to GNU autoconf. I learned a lot in the process. :^) Paul Mather, for reporting bugs and compilation problems on platforms on which I currently have no access, as well as testing and verifying their respective fixes. Also, for reporting the m:ss.ff rounding bug, as well as providing a detailed analysis of the problem which expedited its fix. Mike Kelleher, for contributing toward the design of split mode, as well as helping to test it. Mike Vernal, for providing the impetus (and nearly the code) to support AIFF, as well as testing it. Scott Brown, for putting the AIFF support through the wringer, helping to iron out the kinks. Also, for informing me that sox 12.17.4 now supports sowt- compressed AIFF-C files. jelly, for suggesting that join mode be able to join non-CD quality files. Michael Dougherty, for reporting a bug where shntool would inadvertently include extra RIFF chunks when calculating audio MD5 fingerprints. Christian Weisgerber, who provided a Makefile patch. Boogie Shafer, who was the first to suggest that shntool should support CUE sheets. Also, for the idea that split mode could split a file based on multiples of a given time interval. Finally, for enduring and reporting a seriously nasty data-destroying bug in conv mode, which led to the implementation of file clobber checks and the eventual instatement of 'ask' as the default overwrite action. :-/ John Cook, who was the first of several to ask for the ability to prepad files. Also, for suggesting that shntool generate split points from an existing set of files, and for suggesting that info mode show the sector-misalignment of CD-quality files. David Loehr, who was the first to report a set of files that could not be read by shntool, which turned out to be caused by the existence of ID3v2 tags. These tags are now skipped by shntool, leaving it up to external decoder programs to handle them. deep_elem, who reported a situation in which split mode would round extremely small split points (0:00.001 - 0:00.020) to 0, causing shntool to error out. Tim Ebben, whose keen eye noticed that the m:ss.ff value on the totals line was reporting an incorrect value. Greg Eriksen, for suggesting that shntool have an option not to add predefined strings (e.g. "-fixed") to files. This led to the ability to specify arbitrary user-defined prefixes and postfixes. Also, for suggesting that md5 mode allow file reordering, for use with composite md5s. M Blake, who was the first of several people to request the ability to trim leading and/or trailing silence from files. Dave Maley, who didn't like that split mode moved to a three-digit numbering scheme (split-track001.wav, ...). This led to the ability to specify your own number format, in printf syntax (e.g. "%02d"). Krzysiek Wojszko, whose CUE file tripped up split mode so badly that I decided I better try to support the whole CUE specification. :) Mike Harder, who reported a bug in split mode that prevented extremely large files from being split correctly when using the -l option. Michael Barnes, for contributing a patch to support natural filename sorting, and for the idea that shntool can better utilize exit codes. John, for suggesting that split mode be able to name output files based on TITLE keywords in CUE sheets. rob, for reporting a bug that prevented shntool from processing filenames read from stdin under Windows. Pierre-Yves, for offering to contribute code to name output files in split mode based on several fields in CUE sheets. David Bonde, for suggesting that split mode support user-defined lead-in and/or lead-out. Wim Speekenbrink, for reporting a bug where the last line of a CUE sheet that lacks a newline character was not getting parsed in split mode. Samson, for reporting a WavPack format detection issue and working with me to discover the cause, which turned out to be a bug triggered by 64-bit systems. Also, for providing me with sample CUE sheets that helped make split mode's CUE sheet parsing more robust. Thomas Strosslin, for reporting a major shortcoming in shntool's exit code reporting (especially affecting conv mode), and for providing a patch to address this issue. Tom, for suggesting that hash mode use progress indicators, like other modes. Paolo Saggese, for suggesting that shntool allow user-specified byte-shift comparison buffer sizes in cmp mode, for those times when DAE is off by more than the default of 3 seconds. German Pulido, for reporting an issue in which self-extracting WavPack files were not being properly detected by shntool. Albin Larsson, for suggesting that fix mode should handle the case where just a single file is specified (essentially postpad the file), which is especially useful when using the -c option to check files for boundary issues. Robert Rozee, for suggesting that shntool could read input filenames from a file, instead of listing everything on the command line. Mark, for reporting multiple issues with cat mode and providing fixes. ------- Thanks also goes to the developers of the following software, from which I have taken both ideas and code for shntool: xmms - shntool's WAVE header parsing algorithm was based on the one in xmms's WAVE input plugin proftpd - shntool's method for gluing modules together was adapted from the way proftpd handles it sox - the WAVE_FORMAT_* defines and format_to_str() function were taken from the sox distribution coreutils - the MD5 and natural filename sorting algorithms were lifted from the GNU coreutils distribution v2strip - shntool's ID3v2 detection was based on the v2strip implementation ================== Document revision: ================== $Id: CREDITS,v 1.30 2009/03/30 06:31:13 jason Exp $ shntool-3.0.10/doc/modules.howto0000644000077100007710000002175410627717476013537 00000000000000How to write modules for shntool -------------------------------- shntool has been designed to aid in the development of mode and format modules by separating their code from the core of shntool. Thus, by providing the appropriate data and functions, you can easily write a module to do just about anything you can imagine. Contents: 1. Mode modules 2. Format modules 3. Guidelines for module creation 4. Global data/functions available to modules --------------- 1. Mode modules --------------- Mode modules define the different running modes in shntool. To create a new mode module for shntool, you simply need to fill in a mode_module struct with the appropriate data/functions for your mode. This struct is defined as follows: typedef struct _mode_module { char *const name; /* mode name, specified on command line */ char *const alias; /* alternate name that invokes this mode */ char *const description; /* one line description of this mode */ char *const cvsid; /* CVS revision (used to prevent it from being stripped) */ bool const creates_files; /* does this mode create output files? */ bool (*run_main)(int,char **); /* main() function for this mode */ void (*run_help)(void); /* help() function for this mode */ } mode_module; If you are writing a mode module called 'rev', you could define your struct thusly: /* this is essentially main() for your module, which is called after shntool * sees that it was invoked with a mode of 'rev', or was invoked as 'do_rev' * via a symbolic link to shntool. shntool passes argc and argv to this * function. */ void rev_main(int,char **); mode_module mode_rev = { "rev", "do_rev", "reverses PCM WAVE data", CVSIDSTR, TRUE, rev_main, rev_help }; Note that if your mode is named "rev", and you specify an alias for your mode that is not equal to "shnrev", then you are responsible for installing your own symbolic or hard link for that alias. ----------------- 2. Format modules ----------------- Format modules provide a way for shntool to read and/or write to different file formats. To create a new format module for shntool, you simply need to fill in a format_module struct with the appropriate data/functions for your format. This struct is defined as follows: typedef struct _format_module { /* set at compile time */ char *const name; /* format name, specified on command line in certain modes */ char *const description; /* one line description of this format */ char *const cvsid; /* CVS revision (used to prevent it from being stripped) */ bool const supports_input; /* does this format support input? */ bool const supports_output; /* does this format support output? */ bool const is_translated; /* is this file format a simple translation (e.g. byte-swap) of WAV? */ bool const is_compressed; /* is this file format a compression format? */ bool const remove_output_file; /* remove output file before opening it for output? (prevents some encoders from complaining that the file already exists) */ bool const kill_when_input_done; /* kill() decoder when finished reading input? (prevents delays introduced by decoders that don't exit when we close stdout) */ char *const stdin_for_id3v2_kluge; /* if not NULL, try to skip id3v2 tags on input files by passing data on decoder's stdin using this as the stdin argument */ char *const magic; /* if not NULL, shntool will check for this string at position magic_offset in the input file */ int const magic_offset; /* offset within the file at which the magic string is expected to occur */ /* can be changed at run time */ char *extension; /* extension to append to files created by this module */ char *decoder; /* name of external program to handle decoding of this format - set to NULL if not applicable */ char *decoder_args; /* decoder arguments */ char *encoder; /* name of external program to handle encoding of this format - set to NULL if not applicable */ char *encoder_args; /* encoder arguments */ /* optional functions - set to NULL if not applicable */ bool (*is_our_file)(char *); /* routine to determine whether the given file belongs to this format plugin */ FILE *(*input_func)(char *,proc_info *); /* routine to open a file of this format for input - if NULL, shntool will launch the decoder */ FILE *(*output_func)(char *,proc_info *); /* routine to open a file of this format for output - if NULL, shntool will launch the encoder */ void (*extra_info)(char *); /* routine to display extra information in info mode */ void (*create_output_filename)(char *); /* routine to create a custom output filename */ bool (*input_header_kluge)(unsigned char *,struct _wave_info *); /* routine to determine correct header info for when decoders are unable to do so themselves */ /* internal argument lists (do not assign these in format modules) */ child_args input_args_template; /* input argument template (filled out by shntool, based on default_decoder_args) */ child_args input_args; /* input arguments, filled out (used by shntool when launching decoder) */ child_args output_args_template; /* output argument template (filled out by shntool, based on default_encoder_args) */ child_args output_args; /* output arguments, filled out (used by shntool when launching encoder) */ } format_module; If you are writing a format module called 'mp3', you could define your struct thusly: #define LAME "lame" static char default_encoder_args[] = "--quiet - " FILENAME_PLACEHOLDER; format_module format_mp3 = { "mp3", "MPEG 1.0 Layer 3", CVSIDSTR, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, NULL, NULL, 0, "mp3", NULL, NULL, LAME, default_encoder_args, NULL, NULL, NULL, NULL, NULL, NULL }; In this example, the 'mp3' format module relies on external program "lame" to function, only supports output to that format, and does not have any format-specific information to display in info mode. is_our_file() would always return FALSE. --------------------------------- 3. Guidelines for module creation --------------------------------- There are four things to note if you are creating a new mode or format module: 1. All modules must be placed in the 'src/' directory. Mode module source files must be named after the mode module it defines, e.g. code for a mode_module named 'mode_foo' should be placed in 'mode_foo.c'. Likewise, format module source files must be named after the format module it defines, e.g. code for a format_module named 'format_bar' should be placed in 'format_bar.c'. The reason for the strict file/module naming scheme is because both the configure script and the utils/glue.sh script assume this naming convention when putting together Makefile rules as well as the st_modes[] and st_formats[] arrays. 2. I recommend that you place all of your code in one file. It is possible to separate your code into multiple files, but you're on your own if you want to do that. ;) 3. Since your mode or format module will be compiled into shntool, you should either declare your functions and global data as static, or at least name them uniquely. 4. Finally, in order to compile your module into shntool, you simply need to provide the configure script with the name of your module. For example, if you create a mode module named 'mode_foo', you would run the following command: ./configure --with-extra-modes=foo Similarly, if you create a format module named 'format_bar', you would run the following command: ./configure --with-extra-formats=bar (See the INSTALL file for more information on the shntool-specific command-line arguments that you can pass to the configure script.) Now your mode or format module will be compiled into shntool the next time you run 'make' (or 'gmake', as the case may be). --------------------------------------------- 4. Global data/functions available to modules --------------------------------------------- Your modules will have access to several functions and data structures that can be helpful. 1. mode modules can use any of the functions/types in include/mode.h, or any header included by include/mode.h. Make sure to #include "mode.h", and any other global headers as needed (e.g. ). 2. format modules can use any of the functions/types in include/format.h, or any header included by include/format.h. Make sure to #include "format.h", and any other global headers as needed (e.g. ). ================== Document revision: ================== $Id: modules.howto,v 1.28 2007/06/01 04:23:26 jason Exp $ shntool-3.0.10/doc/BUGS0000644000077100007710000000213010034677452011442 00000000000000Each release is distributed with no known bugs; however, they do creep up from time to time. I will keep an updated list of known bugs on shntool's web page, which can be found at: http://www.etree.org/shnutils/ or http://shnutils.freeshell.org/ If you do discover any bugs (e.g. incorrect output and/or spectacular crashes), please send a bug report to me at . Try to provide as much information as you can. It would be helpful to know the following information: - operating system and version - version of shntool affected - a detailed description of how to reproduce the problem (this may require you to provide me with the actual files that cause it) - optionally, any debugging information you can provide (stack traces, raw program output (preferably with the -D option enabled), etc.) I am also interested in general feedback. This includes, but is not necessarily limited to, the following: - questions - comments - suggestions - patches - new mode and/or format modules to be included in the shntool distribution Thanks, and enjoy! Jason shntool-3.0.10/man/0000777000077100007710000000000011164065154011050 500000000000000shntool-3.0.10/man/Makefile.am0000644000077100007710000000005507424430466013026 00000000000000man_MANS = shntool.1 EXTRA_DIST = shntool.1 shntool-3.0.10/man/shntool.10000644000077100007710000006732611164057675012563 00000000000000.TH SHNTOOL 1 "March 2009" "shntool 3.0.10" "local" .SH "NAME" shntool \- a multi\(hypurpose WAVE data processing and reporting utility .SH "SYNOPSIS" .B shntool .IR mode " ..." .br .B shntool .RI "[" "CORE OPTION" "]" .SH "DESCRIPTION" .B shntool is a command\(hyline utility to view and/or modify WAVE data and properties. It runs in several different operating modes, and supports various lossless audio formats. .PP .B shntool is comprised of three parts \(hy its core, .I mode modules, and .I format modules. This helps to make the code easier to maintain, as well as aid other programmers in developing new functionality. The distribution archive contains a file named 'modules.howto' that describes how to create a new mode or format module, for those so inclined. .SS Mode modules .B shntool performs various functions on WAVE data through the use of mode modules. The core of .B shntool is simply a wrapper around the mode modules. In fact, when .B shntool is run with a valid mode as its first argument, it essentially runs the main procedure for the specified mode, and quits. .B shntool comes with several built\(hyin modes, described below: .br .RS .TP .I len Displays length, size and properties of PCM WAVE data .TP .I fix Fixes sector\(hyboundary problems with CD\(hyquality PCM WAVE data .TP .I hash Computes the MD5 or SHA1 fingerprint of PCM WAVE data .TP .I pad Pads CD(hyquality files not aligned on sector boundaries with silence .TP .I join Joins PCM WAVE data from multiple files into one .TP .I split Splits PCM WAVE data from one file into multiple files .TP .I cat Writes PCM WAVE data from one or more files to the terminal .TP .I cmp Compares PCM WAVE data in two files .TP .I cue Generates a CUE sheet or split points from a set of files .TP .I conv Converts files from one format to another .TP .I info Displays detailed information about PCM WAVE data .TP .I strip Strips extra RIFF chunks and/or writes canonical headers .TP .I gen Generates CD\(hyquality PCM WAVE data files containing silence .TP .I trim Trims PCM WAVE silence from the ends of files .RE .PP For more information on the meaning of the various command\(hyline options for each mode, see the .B "MODE\(hySPECIFIC OPTIONS" section below. .PP For convenience, each mode can specify an alternate name or alias that will invoke it (this feature is currently only available on systems that support symbolic or hard linking). In particular, each mode is aliased to 'shn'. For instance, running .I shnlen is equivalent to running .B shntool .I len - thus saving a few keystrokes. .SS Format modules File formats are abstracted from .B shntool through the use of format modules. They provide a means for .B shntool to tranparently read and/or write different file formats. This abstraction allows .B shntool to concentrate on its job without worrying about the details of each file format. .PP The following formats are currently supported: .br .RS .TP .I wav RIFF WAVE file format .TP .I aiff Audio Interchange File Format (AIFF and uncompressed/sowt AIFF\-C only) (via 'sox'): .br .TP .I shn Shorten low complexity waveform coder (via 'shorten'): .br .br .TP .I flac Free Lossless Audio Codec (via 'flac'): .br .TP .I ape Monkey's Audio Compressor (via 'mac'): .br .br .TP .I alac Apple Lossless Audio Codec (via 'alac'): .br .TP .I tak (T)om's lossless (A)udio (K)ompressor (via 'takc'): .br .TP .I ofr OptimFROG Lossless WAVE Audio Coder (via 'ofr'): .br .TP .I tta TTA Lossless Audio Codec (via 'ttaenc'): .br .TP .I als MPEG\-4 Audio Lossless Coding (via 'mp4als'): .br .TP .I wv WavPack Hybrid Lossless Audio Compression (via 'wavpack' and 'wvunpack'): .br .TP .I lpac Lossless Predictive Audio Compression (via 'lpac'): .br .TP .I la Lossless Audio (via 'la'): .br .TP .I bonk Bonk lossy/lossless audio compressor (via 'bonk'): .br .TP .I kxs Kexis lossless WAV file compressor (via 'kexis'): .br .TP .I mkw MKW Audio Compression format (via 'mkwcon'): .br .TP .I cust Custom output format module (output only, useful for encoding to a format that .B shntool does not yet support) .TP .I term sends output to the terminal .TP .I null sends output to /dev/null (output only, useful for dry\(hyruns in several modes, such as .I fix mode or .I strip mode) .RE .PP When reading files for input, .B shntool automatically discovers which, if any, format module handles each file. In modes where files are created as output, you can specify what the output format should be \(hy otherwise, .B shntool decides for you by selecting the first format module it finds that supports output (in a default installation, this will be the .I wav format). .SH "CORE OPTIONS" .SS "Modeless" When run without a mode, .B shntool takes these options: .TP .B \-m Show detailed mode module information .TP .B \-f Show detailed format module information .TP .B \-a Show default format module arguments .TP .B \-v Show version information .TP .B \-h Show a help screen .SH "GLOBAL OPTIONS" .SS "All modes" All modes support the following options: .TP .B \-D Print debugging information .TP .BI "\-F " "file" Specify a file containing a list of filenames to process. This overrides any files specified on the command line or on the terminal. .br .br NOTE: Most modes will accept input filenames from a single source, according to the following order of precedence: file specified by the .B \-F option, otherwise filenames on the command line, otherwise filenames read from the terminal. .TP .B \-H Print times in h:mm:ss.{ff,nnn} format, instead of m:ss.{ff,nnn} .TP .BI "\-P " "type" Specify progress indicator type. .I type is one of: .RI { pct ", " dot ", " spin ", " face ", " none }. .I pct shows the completion percentage of each operation. .I dot shows the progress of each operation by displaying a '.' after each 10% step toward completion. .I spin shows a spinning progress indicator. .I face shows the progress of each operation by displaying six emoticons that become increasingly happy as the operation nears completion. .I none prevents any progress completion information from being displayed. The default is .IR pct . .TP .B \-h Show the help screen for this mode .TP .BI "\-i " "fmt" Specify input file format decoder and/or arguments. The format is: "fmt decoder [arg1 ... argN]", and must be surrounded by quotes. If arguments are given, then one of them must contain "%f", which will be replaced with the input filename. Examples: .br .RS .B \-i .RI "'" "shn shorten\-2.3b" "'" (use official shorten\-2.3b instead of later versions; leave default arguments untouched) .B \-i .RI "'" "shn shorten \-x \-d 2048 %f \-" "'" (force shorten to skip the first 2048 bytes of each file) .RE .TP .B \-q Suppress non\(hycritical output (quiet mode). Output that normally goes to stderr will not be displayed, other than errors or debugging information (if specified). .TP .BI "\-r " "val" Reorder input files? .I val is one of: .RI { ask ", " ascii ", " natural ", " none }. The default is .IR natural . .TP .B \-v Show version information .TP .B \-w Suppress warnings .TP .B \-\- Indicates that everything following it is a filename .SS "Output modes" Additionally, any mode that creates output files supports the the following options: .TP .BI "\-O " "val" Overwrite existing files? .I val is one of: .RI { ask ", " always ", " never }. The default is .IR ask . .TP .BI "\-a " "str" Prefix .I str to base part of output filenames .TP .BI "\-d " "dir" Specify output directory .TP .BI "\-o " "str" Specify output file format extension, encoder and/or arguments. Format is: "fmt [ext=abc] [encoder [arg1 ... argN (%f = filename)]]", and must be surrounded by quotes. If arguments are given, then one of them must contain "%f", which will be replaced with the output filename. Examples: .br .RS .B \-o .RI "'" "shn shorten \-v2 \- %f" "'" (create shorten files without seek tables) .B \-o .RI "'" "flac flake \- %f" "'" (use alternate flac encoder) .B \-o .RI "'" "aiff ext=aif" "'" (override default aiff extension of 'aiff' with 'aif') .B \-o .RI "'" "cust ext=mp3 lame \-\-quiet \- %f" "'" (create mp3 files using lame) .RE .TP .BI "\-z " "str" Postfix .I str to base part of output filenames .SH "MODE\(hySPECIFIC OPTIONS" .SS len mode options .TP .BI "\-U " "unit" Specifies the unit in which the totals will be printed. .I unit is one of: .RI { b ", " kb ", " mb ", " gb ", " tb }. The default is .IR b . .TP .B \-c Do not show column names .TP .B \-t Do not show totals line .TP .BI "\-u " "unit" Specifies the unit in which each file will be printed. .I unit is one of: .RI { b ", " kb ", " mb ", " gb ", " tb }. The default is .IR b . .TP .B "len mode output" .RS The output of len mode may seem cryptic at first, because it attempts to convey a lot of information in just a little bit of space. But it is quite easy to read once you know what the columns represent; and in certain columns, what each character in the column means. Each column is explained below. .TP .B length Shows the length of the WAVE data, in m:ss.nnn (millisecond) format. If the data is CD\(hyquality, then m:ss.ff is shown instead, where ff is a number from 00 to 74 that best approximates the number of frames (2352\(hybyte blocks) remaining after m:ss. If all files are CD\(hyquality, the total length will be shown in m:ss.ff format; otherwise it will be in m:ss.nnn format. NOTE: CD\(hyquality files are rounded to the nearest frame; all other files are rounded to the nearest millisecond. .TP .B "expanded size" Shows the total size of all WAVE chunks within the file (header, data and any extra RIFF chunks). Essentially this is the size that the file would be if it were converted to .wav format, e.g. with .B shntool .IR conv . NOTE: Do not rely on this field for audio size! If you simply want to know how many bytes of audio are in a file, run it through .I info mode, and look at the "data size" field in its output. .TP .B cdr Shows properties related to CD\(hyquality files. A 'c' in the first slot indicates that the WAVE data is not [C]D\(hyquality. A 'b' in the second slot indicates that the CD\(hyquality WAVE data is not cut on a sector [b]oundary. An 's' in the third slot indicates that the CD\(hyquality WAVE data is too [s]hort to be burned. A '\-' in any of these slots indicates that the particular property is OK or normal. An 'x' in any of these slots indicates that the particular property does not apply to this file, or cannot be determined. .TP .B WAVE Shows properties of the WAVE data. An 'h' in the first slot indicates that the WAVE [h]eader is not canonical. An 'e' in the second slot indicates that the WAVE file contains [e]xtra RIFF chunks. A '\-' in any of these slots indicates that the particular property is OK or normal. An 'x' in any of these slots indicates that the particular property does not apply to this file, or cannot be determined. .TP .B problems Shows problems detected with the WAVE header, WAVE data, or the file itself. A '3' in the first slot indicates that the file contains an ID[3]v2 header. An 'a' in the second slot indicates that the audio data is not block\(hy[a]ligned. An 'i' in the third slot indicates that the WAVE header is [i]nconsistent about data size and/or file size. A 't' in the fourth slot indicates that the WAVE file seems to be [t]runcated. A 'j' in the fifth slot indicates that the WAVE file seems to have [j]unk appended to it. A '\-' in any of these slots indicates that the particular problem was not detected. An 'x' in any of these slots indicates that the particular problem does not apply to this file, or cannot be determined. .TP .B fmt Shows which file format handled this file. .TP .B ratio Shows the compression ratio for this file. .TP .B filename Shows the name of the file that's being inspected. .RE .SS fix mode options NOTE: file names for files created in .I fix mode will be based on the input file name with the string '\-fixed' appended to it, and the extension will be the default extension of the output file format. For example, with an output file format of .I shn the file 'foo.wav' would become 'foo\-fixed.shn'. This can be overridden with the .B \-a and/or .B \-z global options described above. .TP .B \-b Shift track breaks backward to the previous sector boundary. This is the default. .TP .B \-c Check whether fixing is needed, without actually fixing anything. .B shntool will exit with status 0 if fixing is needed, and status 1 otherwise. This can be useful in shell scripts, e.g.: "if shntool fix \-c *; then shntool fix *; else ...; fi" .TP .B \-f Shift track breaks forward to the next sector boundary. .TP .B \-k Specifies that all files should be processed, even if the first several of them wouldn't be altered, aside from a possible file format change. The default is to skip the first N files that wouldn't be changed from a WAVE data perspective in order to avoid unnecessary work. .TP .B \-n Specifies that the last file created should not be padded with silence to make its WAVE data size a multiple of 2352 bytes. The default is to pad the last file. .TP .B \-u Round track breaks to the nearest sector boundary. .SS hash mode options .TP .B \-c Specifies that the composite fingerprint for all input files should be generated, instead of the default of one fingerprint per file. The composite fingerprint is simply the fingerprint of the WAVE data from all input files taken as a whole in the order given, and is identical to the one that would be generated from the joined file if the same files were joined into one large file, with no padding added. This option can be used to fingerprint file sets, or to identify file sets in which track breaks have been moved around, but no audio has been modified in any way (e.g. no padding added, no resampling done, etc.). .TP .B \-m Generate MD5 fingerprints. This is the default. .TP .B \-s Generate SHA1 fingerprints. .SS pad mode options NOTE: file names for files created in .I pad mode will be based on the input file name with the string '\-prepadded' or '\-postpadded' appended to it, and the extension will be the default extension of the output file format. For example, with an output file format of .I shn and pre\(hypadding specified on the command line, the file 'foo.wav' would become 'foo\-prepadded.shn'. This can be overridden with the .B \-a and/or .B \-z global options described above. .PP Be aware that some output format encoders (e.g. flac, ape) automatically strip headers and/or extra RIFF chunks. .TP .B \-b Specifies that the file created should be padded at the beginning with silence to make its WAVE data size a multiple of 2352 bytes. .TP .B \-e Specifies that the file created should be padded at the end with silence to make its WAVE data size a multiple of 2352 bytes. This is the default action. .SS join mode options NOTE: file names for files created in .I join mode will be prefixed with 'joined.', and the extension will be the default extension of the output file format. For example, with an output file format of .I wav the files 'files*.wav' would become 'joined.wav'. This can be overridden with the .B \-a and/or .B \-z global options described above. .TP .B \-b Specifies that the file created should be padded at the beginning with silence to make its WAVE data size a multiple of 2352 bytes. Note that this option does not apply if the input files are not CD\(hyquality, since padding is undefined in that case. .TP .B \-e Specifies that the file created should be padded at the end with silence to make its WAVE data size a multiple of 2352 bytes. This is the default action. Note that this option does not apply if the input files are not CD\(hyquality, since padding is undefined in that case. .TP .B \-n Specifies that the file created should not be padded with silence to make its WAVE data size a multiple of 2352 bytes. Note that this option does not apply if the input files are not CD\(hyquality, since padding is undefined in that case. .SS split mode options NOTE: file names for files created in .I split mode are of the form prefixNNN.ext, where NNN is the output file number, and 'ext' is the default extension of the output file format. If an output file format of 'wav' is used, and the prefix is not altered via the .B \-n switch described below, then the output file names will be "split\-track01.wav", "split\-track02.wav", etc. This can be overridden with the .B \-a and/or .B \-z global options described above. .PP For information on specifying split points, see the .B "Specifying split points" section below. .TP .BI "\-c " "num" Specifies the number to start counting from when naming output files. The default is 1. .TP .BI "\-e " "len" Prefix each track with .I len amount of lead\(hyin taken from the previous track. .I len must be given in bytes, m:ss, m:ss.ff or m:ss.nnn format. .TP .BI "\-f " "file" Specifies a file from which to read split point data. If not given, then split points are read from the terminal. .TP .BI "\-l " "len" Specifies that the input file should be split into smaller files based on multiples of the .I len time interval. .I len must be given in bytes, m:ss, m:ss.ff or m:ss.nnn format. .TP .BI "\-m " "str" Specifies a character manipulation string for filenames generated from CUE sheets. These characters, taken one\(hyby\(hyone, represent from/to character translation. They must always be in pairs. Some examples: .br .RS .TP .I ":\-" Translate all instances of ':' to '\-' .TP .I ":\-/\-" Translate both ':' and '/' to '\-' .TP .I ":\-/_*x" Translate ':' to '\-', '/' to '_', and '*' to 'x' .RE .TP .BI "\-n " "fmt" Specifies the file count output format. The default is %02d, which gives two\(hydigit zero\(hypadded numbers (01, 02, 03, ...). .TP .BI "\-t " "fmt" Name output files in user\(hyspecified format based on CUE sheet fields. The following formatting strings are recognized: .br .RS .TP .I "%p" Performer .TP .I "%a" Album .TP .I "%t" Track title .TP .I "%n" Track number .RE .TP .BI "\-u " "len" Postfix each track with .I len amount of lead\(hyout taken from the next track. .I len must be given in bytes, m:ss, m:ss.ff or m:ss.nnn format. .TP .BI "\-x " "list" Only extract tracks in .I list (comma separated, may contain ranges). Examples include: .br .RS .TP .I "7" Only extract track 7 .TP .I "3\-5" Only extract tracks 3 through 5 .TP .I "2\-6,9,11\-13" Only extract tracks 2 through 6, 9, and 11 through 13 .RE .TP .B "Specifying split points" .RS Split points simply mark places within the WAVE data of the input file where tracks will be split. They can be specified in any combination of the following formats: .TP .B bytes where bytes is a specific byte offset .TP .B m:ss where m = minutes and ss = seconds .TP .B m:ss.ff where m = minutes, ss = seconds and ff = frames (75 per second, so ff ranges from 00 to 74) .TP .B m:ss.nnn where m = minutes, ss = seconds and nnn = milliseconds (will be rounded to closest sector boundary, or the first sector boundary if the closest one happens to be the beginning of the file) .TP .B "CUE sheet" - a simple CUE sheet, in which each "INDEX 01 m:ss:ff" line is converted to a m:ss.ff split point .PP Split points must be given in increasing order, and must appear one per line. If the byte offset calculated from the final split point equals the input file's WAVE data size, then it is ignored. Since split points specify locations within the input file where tracks will be split, N split points will create N+1 output files. All m:ss formats will create splits on sector boundaries whenever the input file is CD\(hyquality; to force non\(hysector\(hyaligned splits, use the exact byte format. .RE .SS cat mode options .TP .B \-c Specifies that extra RIFF chunks should be suppressed from the output. The default is to write the extra RIFF chunks. .TP .B \-d Specifies that the WAVE data should be suppressed from the output. The default is to write the data. .TP .B \-e Specifies that the WAVE header should be suppressed from the output. The default is to write the header. .TP .B \-n Specifies that the NULL pad byte at end of odd\-sized data chunks should be suppressed from the output, if present. The default is to write the NULL pad byte. This option only applies when WAVE data is also written, otherwise it is ignored. .SS cmp mode options .TP .BI "\-c " "secs" Sets the number of seconds of audio to use for the byte\(hyshift comparison buffer. This option only makes sense with the .B \-s option. The default is 3 seconds. .TP .BI "\-f " "fuzz" Sets the "fuzz factor" for determining whether byte\(hyshifted data is identical. .I fuzz is a positive integer that represents the maximum number of allowable byte mismatches between the two files in the area searched by the .B \-s option. This allows one to check for differing bytes between to files that (a) are byte\(hyshifted and (b) contain at least one error in the area searched by the .B \-s option. The higher the fuzz factor, the longer the search takes, so set it low to begin with (8 or so), and increase it in small steps if needed. NOTE: this switch can only be used with the .B \-s switch. .TP .B \-l List offsets and values of all differing bytes. Output is similar to 'cmp \-l'; in particular, offsets are 1\(hybased. Can be used with the .B \-s switch. .TP .B \-s Check to see whether the WAVE data contained in the input files are identical modulo a byte\(hyshift. Currently, this will only detect differences up to the first 529200 bytes (equal to 3 seconds of CD\(hyquality data). This can be used to compare WAVE data within a pre\(hyburned file to WAVE data in the corresponding track ripped from the burned CD, which is useful if the ripped track came from a CD burned TAO, and thus might have a 2\(hysecond gap of silence at the beginning. This option can also help identify a CD burner/CD reader combined read/write offset. .SS cue mode options .TP .B \-c Specifies that a simple CUE sheet should be output. This is the default action. NOTE: all input files must be CD\(hyquality for CUE sheets to be valid. .TP .B \-s Specifies that split points in explicit byte\(hyoffset format should be output. .SS conv mode options NOTE: file names for files created in .I conv mode will be named based on the input file name. Specifically, if the input file name ends with the default file extension for that file's format, then the default extension for the desired output format will replace it; otherwise, it will be appended to it. For example, for an output format of .I shn and a .I wav input file named 'file.wav', the converted file will be named 'file.shn', since '.wav' is the default extension for the .I wav format. On the other hand, given the same situation above, but with an input file named 'file.wave', the converted file will be named 'file.wave.shn', since '.wave' does not match '.wav'. This can be overridden with the .B \-a and/or .B \-z global options described above. .PP Be aware that some output format encoders (e.g. flac, ape) automatically strip headers and/or extra RIFF chunks, while others (e.g. sox) might adjust WAVE data sizes in rare instances in order to align the audio on a block boundary. .TP .B \-t Read WAVE data from the terminal. .SS info mode options This mode doesn't support any additional options. .SS strip mode options NOTE: file names for files created in .I strip mode will be based on the input file name with the string '\-stripped' appended to it, and the extension will be the default extension of the output file format. For example, with an output file format of .I wav the file 'bar.shn' would become 'bar\-stripped.wav'. This can be overridden with the .B \-a and/or .B \-z global options described above. .PP Be aware that some output format encoders (e.g. flac, ape) automatically strip headers and/or extra RIFF chunks, while others (e.g. sox) might adjust WAVE data sizes in rare instances in order to align the audio on a block boundary. .TP .B \-c Specifies that extra RIFF chunks should not be stripped. The default is to remove everything that appears after the first data chunk. .TP .B \-e Specifies that WAVE headers should not be made canonical. The default is to canonicalize headers. .SS gen mode options NOTE: file names for files created in .I gen mode will be prefixed with 'silence.', and the extension will be the default extension of the output file format. For example, with an output file format of .I wav the generated file would become 'silence.wav'. This can be overridden with the .B \-a and/or .B \-z global options described above. .TP .BI "\-l " "len" Generate files containing .I len amount of silence. .I len must be given in bytes, m:ss, m:ss.ff or m:ss.nnn format. .SS trim mode options NOTE: file names for files created in .I trim mode will be based on the input file name with the string '\-trimmed' appended to it, and the extension will be the default extension of the output file format. For example, with an output file format of .I shn the file 'foo.wav' would become 'foo\-trimmed.shn'. This can be overridden with the .B \-a and/or .B \-z global options described above. .TP .B \-b Only trim silence from the beginning of files .TP .B \-e Only trim silence from the end of files .SH "ENVIRONMENT VARIABLES" .TP .B ST_DEBUG If set, shntool will print debugging information. This is analogous to the .B \-D global option, with the exception that debugging is enabled immediately, instead of when the command\(hyline is parsed. .TP .B ST__DEC Specify input file format decoder and/or arguments. Replace .B with the format you wish to modify, e.g. .BR ST_SHN_DEC . The format of this variable is analagous to the .B \-i global option, except that the initial format is not included. Examples: .br .RS .BR ST_SHN_DEC "='" "shorten\-2.3b" "'" .BR ST_SHN_DEC "='" "shorten \-x \-d 2048 %f \-" "'" .RE .TP .B ST__ENC Specify output file format extension, encoder and/or arguments. Replace .B with the format you wish to modify, e.g. .BR ST_SHN_ENC . The format of this variable is analagous to the .B \-o global option, except that the initial format is not included. Examples: .br .RS .BR ST_SHN_ENC "='" "shorten \-v2 \- %f" "'" .BR ST_FLAC_ENC "='" "flake \- %f" "'" .BR ST_AIFF_ENC "='" "ext=aif" "'" .BR ST_CUST_ENC "='" "ext=mp3 lame \-\-quiet \- %f" "'" .RE Note that command\(hyline options take precedence over any of these environment variables. .SH "EXIT STATUS" Generally speaking, .B shntool will exit with status 0 upon success, and status 1 if it encounters an error. The only exception is when the 'quit' option is selected from within the interactive file reordering menu, in which case the exist status will be 255. .SH "NOTES" .B shntool is a misnomer, since it processes WAVE data, not shorten data. The name is a holdover from its early days as 'shnlen', a program created specifically to extract information about WAVE data stored within .shn files. .PP Aliases for .B shntool are prefixed with 'shn' instead of 'wav' to avoid possible collisions with existing programs. .SH "AUTHOR" Jason Jordan .br Please send all bug reports to the above address. .br The latest version of .B shntool can always be found at or . .SH "COPYRIGHT" Copyright (C) 2000\-2009 Jason Jordan .br This is free software. You may redistribute copies of it under the terms of the GNU General Public License . There is NO WARRANTY, to the extent permitted by law. .SH "REVISION" $Id: shntool.1,v 1.140 2009/03/30 05:59:25 jason Exp $ shntool-3.0.10/man/Makefile.in0000644000077100007710000002424211164057355013041 00000000000000# Makefile.in generated by automake 1.10.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = man DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = man1dir = $(mandir)/man1 am__installdirs = "$(DESTDIR)$(man1dir)" NROFF = nroff MANS = $(man_MANS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALAC = @ALAC@ ALS = @ALS@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BONK = @BONK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FLAC = @FLAC@ FORMAT_OBJS = @FORMAT_OBJS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KEXIS = @KEXIS@ LA = @LA@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LN_S = @LN_S@ LPAC = @LPAC@ LTLIBOBJS = @LTLIBOBJS@ MAC = @MAC@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MKWCON = @MKWCON@ MODES_CONFIGURED = @MODES_CONFIGURED@ MODE_OBJS = @MODE_OBJS@ OBJEXT = @OBJEXT@ OPTIMFROG = @OPTIMFROG@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SHORTEN = @SHORTEN@ SOX = @SOX@ STRIP = @STRIP@ TAKC = @TAKC@ TTA = @TTA@ VERSION = @VERSION@ WAVPACK = @WAVPACK@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ man_MANS = shntool.1 EXTRA_DIST = shntool.1 all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign man/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign man/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-man1: $(man1_MANS) $(man_MANS) @$(NORMAL_INSTALL) test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)" @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ for i in $$l2; do \ case "$$i" in \ *.1*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ if test -f $$i; then file=$$i; \ else file=$(srcdir)/$$i; fi; \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ case "$$ext" in \ 1*) ;; \ *) ext='1' ;; \ esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \ done uninstall-man1: @$(NORMAL_UNINSTALL) @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ for i in $$l2; do \ case "$$i" in \ *.1*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ case "$$ext" in \ 1*) ;; \ *) ext='1' ;; \ esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \ rm -f "$(DESTDIR)$(man1dir)/$$inst"; \ done tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(MANS) installdirs: for dir in "$(DESTDIR)$(man1dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-man install-dvi: install-dvi-am install-exec-am: install-html: install-html-am install-info: install-info-am install-man: install-man1 install-pdf: install-pdf-am install-ps: install-ps-am installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-man uninstall-man: uninstall-man1 .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-man1 install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \ uninstall-am uninstall-man uninstall-man1 # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: shntool-3.0.10/depcomp0000744000077100007710000004271311164057356011600 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2007-03-29.01 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 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, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # 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. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> $depfile echo >> $depfile # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> $depfile else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" # Add `dependent.h:' lines. sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mechanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # X makedepend shift cleared=no for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes ;; esac case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. "$@" || exit $? IFS=" " for arg do case "$arg" in "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # 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-end: "$" # End: shntool-3.0.10/Makefile.am0000644000077100007710000000024310545755100012243 00000000000000SUBDIRS = man src EXTRA_DIST = doc include utils dist-hook: for cvsdir in `find $(distdir) -name CVS`; do \ [ -d "$$cvsdir" ] && rm -rf "$$cvsdir" ; \ done shntool-3.0.10/COPYING0000644000077100007710000004312210543326317011247 00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 of the License, 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. shntool-3.0.10/utils/0000777000077100007710000000000011164065154011435 500000000000000shntool-3.0.10/utils/glue.sh0000744000077100007710000000100110545753376012646 00000000000000#!/bin/sh # $Id: glue.sh,v 1.8 2006/12/31 15:27:58 jason Exp $ MODULETYPE="$1" shift echo "/* This file is automatically generated by utils/glue.sh," echo " * called from the configure script. Do not edit by hand!" echo " */" echo echo "#include \"shntool.h\"" echo for module in "$@"; do echo "extern ${MODULETYPE}_module ${MODULETYPE}_${module};" done echo echo "${MODULETYPE}_module *st_${MODULETYPE}s[] = {" for module in "$@"; do echo " &${MODULETYPE}_${module}," done echo " NULL" echo "};" shntool-3.0.10/configure.ac0000644000077100007710000001513311164057325012503 00000000000000dnl Process this file with autoconf to produce a configure script. AC_INIT([shntool],[3.0.10],[shnutils@freeshell.org]) AC_REVISION([$Id: configure.ac,v 1.125 2009/03/30 05:55:33 jason Exp $]) AC_CONFIG_SRCDIR([src/core_shntool.c]) AC_CONFIG_HEADERS([include/config.h]) AC_CANONICAL_HOST AM_INIT_AUTOMAKE dnl Checks for programs. AC_LANG([C]) AC_PROG_CC AC_PROG_INSTALL AC_PROG_AWK AC_PROG_LN_S AC_PROG_MAKE_SET dnl Checks for types. AC_C_BIGENDIAN dnl configure command-line options dnl default modes - used if --with-modes is not specified ac_build_modes="len fix hash pad join split cat cmp cue conv info strip gen trim" dnl default file formats - used if --with-formats is not specified ac_build_formats="wav aiff shn flac ape alac tak ofr tta als wv lpac la mkw bonk kxs cust term null" ac_alternate_modes= ac_alternate_formats= ac_alternate_modes_flag=false ac_alternate_formats_flag=false dnl mode module specification AC_ARG_WITH([modes], [ --with-modes=LIST Specify default modes], [ ac_alternate_modes_flag=true ; ac_alternate_modes="`echo "$withval" | sed -e 's/,/ /g'`" ] ) dnl format module specification AC_ARG_WITH([formats], [ --with-formats=LIST Specify default file formats], [ ac_alternate_formats_flag="true" ; ac_alternate_formats="`echo "$withval" | sed -e 's/,/ /g'`"] ) if test "x$ac_alternate_modes_flag" = "xfalse"; then ac_current_modes="$ac_build_modes" else ac_current_modes="$ac_alternate_modes" fi if test "x$ac_alternate_formats_flag" = "xfalse"; then ac_current_formats="$ac_build_formats" else ac_current_formats="$ac_alternate_formats" fi dnl are additional modules specified? AC_ARG_WITH([extra-modes], [ --with-extra-modes=LIST Specify additional modes], [ ac_more_modes="`echo "$withval" | sed -e 's/,/ /g'`" ; ac_current_modes="$ac_current_modes $ac_more_modes" ] ) AC_ARG_WITH([extra-formats], [ --with-extra-formats=LIST Specify additional file formats], [ ac_more_formats="`echo "$withval" | sed -e 's/,/ /g'`" ; ac_current_formats="$ac_current_formats $ac_more_formats" ] ) ac_list_modes= ac_list_formats= mode_exists=false format_exists=false MODE_OBJS= FORMAT_OBJS= MODES_CONFIGURED= for mode in $ac_current_modes; do if test "`echo "$ac_list_modes" | grep -c "mode_${mode}\.c"`" = "0"; then if test -f ${srcdir}/src/mode_${mode}.c; then ac_list_modes="${ac_list_modes}mode_${mode}.c " MODE_OBJS="${MODE_OBJS}mode_${mode}.\$(OBJEXT) " MODES_CONFIGURED="${MODES_CONFIGURED}${mode} " mode_exists=true else AC_MSG_WARN([missing ${srcdir}/src/mode_${mode}.c -- mode '${mode}' will not be compiled]) fi fi done for format in $ac_current_formats; do if test "`echo "$ac_list_formats" | grep -c "format_${format}\.c"`" = "0"; then if test -f ${srcdir}/src/format_${format}.c; then ac_list_formats="${ac_list_formats}format_${format}.c " FORMAT_OBJS="${FORMAT_OBJS}format_${format}.\$(OBJEXT) " format_exists=true case $format in aiff ) format_aiff=true ;; ape ) format_ape=true ;; flac ) format_flac=true ;; lpac ) format_lpac=true ;; ofr ) format_ofr=true ;; shn ) format_shn=true ;; wv ) format_wv=true ;; alac ) format_alac=true ;; la ) format_la=true ;; tta ) format_tta=true ;; als ) format_als=true ;; tak ) format_tak=true ;; bonk ) format_bonk=true ;; kxs ) format_kxs=true ;; mkw ) format_mkw=true ;; esac else AC_MSG_WARN([missing ${srcdir}/src/format_${format}.c -- format '${format}' will not be compiled]) fi fi done if test x$mode_exists = xfalse; then AC_MSG_ERROR([at least one valid mode must be specified],[1]) fi if test x$format_exists = xfalse; then AC_MSG_ERROR([at least one valid file format must be specified],[1]) fi AC_SUBST([MODE_OBJS]) AC_SUBST([FORMAT_OBJS]) AC_SUBST([MODES_CONFIGURED]) dnl Additional program checks, based on whether certain file formats are included in shntool echo AC_MSG_NOTICE([checking for optional helper programs]) echo if test x$format_shn = xtrue; then AC_CHECK_PROG([SHORTEN],[shorten],[yes],[no (install for shn support)]) fi if test x$format_flac = xtrue; then AC_CHECK_PROG([FLAC],[flac],[yes],[no (install for flac support)]) fi if test x$format_aiff = xtrue; then AC_CHECK_PROG([SOX],[sox],[yes],[no (install for aiff support)]) fi if test x$format_ape = xtrue; then AC_CHECK_PROG([MAC],[mac],[yes],[no (install for ape support)]) fi if test x$format_ofr = xtrue; then AC_CHECK_PROG([OPTIMFROG],[ofr],[yes],[no (install for ofr support)]) fi if test x$format_lpac = xtrue; then AC_CHECK_PROG([LPAC],[lpac],[yes],[no (install for lpac support)]) fi if test x$format_wv = xtrue; then AC_CHECK_PROG([WAVPACK],[wvunpack],[yes],[no (install for wv support)]) fi if test x$format_alac = xtrue; then AC_CHECK_PROG([ALAC],[alac],[yes],[no (install for alac support)]) fi if test x$format_la = xtrue; then AC_CHECK_PROG([LA],[la],[yes],[no (install for la support)]) fi if test x$format_tta = xtrue; then AC_CHECK_PROG([TTA],[ttaenc],[yes],[no (install for tta support)]) fi if test x$format_als = xtrue; then AC_CHECK_PROG([ALS],[mp4als],[yes],[no (install for als support)]) fi if test x$format_mkw = xtrue; then AC_CHECK_PROG([MKWCON],[mkwcon],[yes],[no (install for mkw support)]) fi if test x$format_tak = xtrue; then AC_CHECK_PROG([TAKC],[takc],[yes],[no (install for tak support)]) fi if test x$format_bonk = xtrue; then AC_CHECK_PROG([BONK],[bonk],[yes],[no (install for bonk support)]) fi if test x$format_kxs = xtrue; then AC_CHECK_PROG([KEXIS],[kexis],[yes],[no (install for kxs support)]) fi dnl Checks for header files. echo AC_MSG_NOTICE([checking for win32 environment]) echo AC_CHECK_HEADERS([windows.h]) dnl Checks for library functions. echo AC_MSG_NOTICE([checking for library functions]) echo AC_CHECK_FUNCS([strerror vsnprintf atol sysconf]) echo AC_MSG_NOTICE([creating build files]) echo AC_OUTPUT([man/Makefile src/Makefile Makefile]) ac_compiled_modes="`echo "$ac_list_modes" | sed -e 's/mode_//g' -e 's/\.c//g'`" ac_compiled_formats="`echo "$ac_list_formats" | sed -e 's/format_//g' -e 's/\.c//g'`" echo AC_MSG_NOTICE([creating module glue files]) echo echo "processing modes..." sh ${srcdir}/utils/glue.sh mode $ac_compiled_modes > src/glue_modes.c echo "processing formats..." sh ${srcdir}/utils/glue.sh format $ac_compiled_formats > src/glue_formats.c echo AC_MSG_NOTICE([ready to compile. $PACKAGE is now configured with the following options: version : $VERSION modes : $ac_compiled_modes formats : $ac_compiled_formats install : ${prefix}/bin ]) shntool-3.0.10/config.guess0000744000077100007710000013061111164057355012535 00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 # Free Software Foundation, Inc. timestamp='2008-11-15' # This file 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 of the License, 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, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # 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. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if echo '\n#ifdef __amd64\nIS_64BIT_ARCH\n#endif' | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[456]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:[3456]*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; EM64T | authenticamd | genuineintel) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-gnu else echo ${UNAME_MACHINE}-unknown-linux-gnueabi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) LIBC=gnu #else LIBC=gnuaout #endif #endif #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^LIBC/{ s: ::g p }'`" test x"${LIBC}" != x && { echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit } test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp 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` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: shntool-3.0.10/src/0000777000077100007710000000000011164065154011064 500000000000000shntool-3.0.10/src/format_lpac.c0000644000077100007710000000246411155771111013436 00000000000000/* format_lpac.c - lpac format module * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "format.h" CVSID("$Id: format_lpac.c,v 1.51 2009/03/11 17:18:01 jason Exp $") #define LPAC "lpac" #define LPAC_MAGIC "LPAC" static char default_decoder_args[] = "-x " FILENAME_PLACEHOLDER " -"; format_module format_lpac = { "lpac", "Lossless Predictive Audio Compression", CVSIDSTR, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, NULL, LPAC_MAGIC, 0, "pac", LPAC, default_decoder_args, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; shntool-3.0.10/src/mode_join.c0000644000077100007710000002211711157354613013115 00000000000000/* mode_join.c - join mode module * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include #include "mode.h" CVSID("$Id: mode_join.c,v 1.110 2009/03/16 04:46:03 jason Exp $") static bool join_main(int,char **); static void join_help(void); mode_module mode_join = { "join", "shnjoin", "Joins PCM WAVE data from multiple files into one", CVSIDSTR, TRUE, join_main, join_help }; #define JOIN_PREFIX "joined" enum { JOIN_UNKNOWN, JOIN_NOPAD, JOIN_PREPAD, JOIN_POSTPAD }; static bool all_files_cd_quality = TRUE; static int pad_bytes = 0; static int numfiles; static int pad_type = JOIN_UNKNOWN; static wave_info **files; static void join_help() { st_info("Usage: %s [OPTIONS] [file1 file2 ...]\n",st_progname()); st_info("\n"); st_info("Mode-specific options:\n"); st_info("\n"); st_info(" -b pad the beginning of the joined file with silence\n"); st_info(" -e pad the end of the joined file with silence (default)\n"); st_info(" -h show this help screen\n"); st_info(" -n don't pad the joined file with silence\n"); st_info("\n"); } static void parse(int argc,char **argv,int *first_arg) { int c; st_ops.output_directory = CURRENT_DIR; st_ops.output_prefix = JOIN_PREFIX; pad_type = JOIN_POSTPAD; while ((c = st_getopt(argc,argv,"ben")) != -1) { switch (c) { case 'b': pad_type = JOIN_PREPAD; break; case 'e': pad_type = JOIN_POSTPAD; break; case 'n': pad_type = JOIN_NOPAD; break; } } *first_arg = optind; } static bool do_join() { int i,bytes_to_skip,bytes_to_xfer; proc_info output_proc; char outfilename[FILENAME_SIZE]; wlong total=0; unsigned char header[CANONICAL_HEADER_SIZE]; FILE *output; wave_info *joined_info; bool success; progress_info proginfo; success = FALSE; create_output_filename("","",outfilename); for (i=0;idata_size; if (all_files_cd_quality && (total % CD_BLOCK_SIZE) != 0) { pad_bytes = CD_BLOCK_SIZE - (total % CD_BLOCK_SIZE); if (JOIN_NOPAD != pad_type) total += pad_bytes; } if (NULL == (joined_info = new_wave_info(NULL))) { st_error("could not allocate memory for joined file information"); } joined_info->chunk_size = total + CANONICAL_HEADER_SIZE - 8; joined_info->channels = files[0]->channels; joined_info->samples_per_sec = files[0]->samples_per_sec; joined_info->avg_bytes_per_sec = files[0]->avg_bytes_per_sec; joined_info->rate = files[0]->rate; joined_info->block_align = files[0]->block_align; joined_info->bits_per_sample = files[0]->bits_per_sample; joined_info->data_size = total; joined_info->wave_format = files[0]->wave_format; joined_info->problems = (files[0]->problems & PROBLEM_NOT_CD_QUALITY); if (PROB_ODD_SIZED_DATA(joined_info)) joined_info->chunk_size++; joined_info->total_size = joined_info->chunk_size + 8; joined_info->length = joined_info->data_size / joined_info->rate; joined_info->exact_length = (double)joined_info->data_size / (double)joined_info->rate; length_to_str(joined_info); proginfo.initialized = FALSE; proginfo.prefix = "Joining"; proginfo.clause = "-->"; proginfo.filename1 = files[0]->filename; proginfo.filedesc1 = files[0]->m_ss; proginfo.filename2 = outfilename; proginfo.filedesc2 = joined_info->m_ss; proginfo.bytes_total = files[0]->total_size; prog_update(&proginfo); if (NULL == (output = open_output_stream(outfilename,&output_proc))) { st_error("could not open output file"); } make_canonical_header(header,joined_info); if (write_n_bytes(output,header,CANONICAL_HEADER_SIZE,&proginfo) != CANONICAL_HEADER_SIZE) { prog_error(&proginfo); st_warning("error while writing %d-byte WAVE header",CANONICAL_HEADER_SIZE); goto cleanup; } if (all_files_cd_quality && (JOIN_PREPAD == pad_type) && pad_bytes) { if (pad_bytes != write_padding(output,pad_bytes,&proginfo)) { prog_error(&proginfo); st_warning("error while pre-padding with %d zero-bytes",pad_bytes); goto cleanup; } } for (i=0;itotal_size; proginfo.filename1 = files[i]->filename; proginfo.filedesc1 = files[i]->m_ss; prog_update(&proginfo); if (!open_input_stream(files[i])) { prog_error(&proginfo); st_warning("could not reopen input file"); goto cleanup; } bytes_to_skip = files[i]->header_size; while (bytes_to_skip > 0) { bytes_to_xfer = min(bytes_to_skip,CANONICAL_HEADER_SIZE); if (read_n_bytes(files[i]->input,header,bytes_to_xfer,NULL) != bytes_to_xfer) { prog_error(&proginfo); st_warning("error while reading %d bytes of data",bytes_to_xfer); goto cleanup; } bytes_to_skip -= bytes_to_xfer; } if (transfer_n_bytes(files[i]->input,output,files[i]->data_size,&proginfo) != files[i]->data_size) { prog_error(&proginfo); st_warning("error while transferring %lu bytes of data",files[i]->data_size); goto cleanup; } prog_success(&proginfo); close_input_stream(files[i]); } if (all_files_cd_quality && JOIN_POSTPAD == pad_type && pad_bytes) { if (pad_bytes != write_padding(output,pad_bytes,NULL)) { prog_error(&proginfo); st_warning("error while post-padding with %d zero-bytes",pad_bytes); goto cleanup; } } if ((JOIN_NOPAD == pad_type) && PROB_ODD_SIZED_DATA(joined_info) && (1 != write_padding(output,1,NULL))) { prog_error(&proginfo); st_warning("error while NULL-padding odd-sized data chunk"); goto cleanup; } if (all_files_cd_quality) { if (JOIN_NOPAD != pad_type) { if (pad_bytes) st_info("%s-padded output file with %d zero-bytes.\n",((JOIN_PREPAD == pad_type)?"Pre":"Post"),pad_bytes); else st_info("No padding needed.\n"); } else { st_info("Output file was not padded, "); if (pad_bytes) st_info("though it needs %d bytes of padding.\n",pad_bytes); else st_info("nor was it needed.\n"); } } success = TRUE; cleanup: if ((CLOSE_CHILD_ERROR_OUTPUT == close_output(output,output_proc)) || !success) { success = FALSE; remove_file(outfilename); st_error("failed to join files"); } return success; } static void check_headers() { int i; bool ba_warned = 0; for (i=0;ifilename); if (PROB_TRUNCATED(files[i])) st_error("file seems to be truncated: [%s]",files[i]->filename); } for (i=1;iwave_format != files[0]->wave_format) st_error("WAVE format differs among these files"); if (files[i]->channels != files[0]->channels) st_error("number of channels differs among these files"); if (files[i]->samples_per_sec != files[0]->samples_per_sec) st_error("samples per second differs among these files"); if (files[i]->avg_bytes_per_sec != files[0]->avg_bytes_per_sec) st_error("average bytes per second differs among these files"); if (files[i]->bits_per_sample != files[0]->bits_per_sample) st_error("bits per sample differs among these files"); if (files[i]->block_align != files[0]->block_align) { if (!ba_warned) { st_warning("block align differs among these files"); ba_warned = TRUE; } } } } static bool process(int argc,char **argv,int start) { int i; bool success; char *filename; input_init(start,argc,argv); input_read_all_files(); numfiles = input_get_file_count(); if (numfiles < 2) st_help("need two or more files to process"); if (NULL == (files = malloc((numfiles + 1) * sizeof(wave_info *)))) st_error("could not allocate memory for file info array"); for (i=0;i * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include #include "mode.h" CVSID("$Id: mode_gen.c,v 1.53 2009/03/16 04:46:03 jason Exp $") static bool gen_main(int,char **); static void gen_help(void); mode_module mode_gen = { "gen", "shngen", "Generates CD-quality PCM WAVE data files containing silence", CVSIDSTR, TRUE, gen_main, gen_help }; #define GEN_PREFIX "silence" static char *gen_size = NULL; static void gen_help() { st_info("Usage: %s [OPTIONS]\n",st_progname()); st_info("\n"); st_info("Mode-specific options:\n"); st_info("\n"); st_info(" -h show this help screen\n"); st_info(" -l len generate files containing silence of length len (*)\n"); st_info("\n"); st_info(" (*) len must be in bytes, m:ss, m:ss.ff or m:ss.nnn format\n"); st_info("\n"); } static void parse(int argc,char **argv) { int c; st_ops.output_directory = CURRENT_DIR; st_ops.output_prefix = GEN_PREFIX; while ((c = st_getopt(argc,argv,"l:")) != -1) { switch (c) { case 'l': if (NULL == optarg) st_error("missing silence length"); gen_size = optarg; break; } } if (NULL == gen_size) st_error("length must be specified"); } static bool process() { wave_info *info; unsigned char header[CANONICAL_HEADER_SIZE],silence[XFER_SIZE]; char outfilename[FILENAME_SIZE]; FILE *output; proc_info output_proc; wlong gen_bytes,bytes_left,bytes; progress_info proginfo; bool success; success = FALSE; if (NULL == (info = new_wave_info(NULL))) { st_error("could not allocate memory for WAVE info"); } info->rate = CD_RATE; gen_bytes = smrt_parse((unsigned char *)gen_size,info); create_output_filename("","",outfilename); info->channels = CD_CHANNELS; info->samples_per_sec = CD_SAMPLES_PER_SEC; info->avg_bytes_per_sec = CD_RATE; info->block_align = CD_BLOCK_ALIGN; info->bits_per_sample = CD_BITS_PER_SAMPLE; info->wave_format = WAVE_FORMAT_PCM; info->rate = CD_RATE; info->data_size = gen_bytes; info->chunk_size = info->data_size + CANONICAL_HEADER_SIZE - 8; info->length = info->data_size / (wlong)info->rate; info->exact_length = (double)info->data_size / (double)info->rate; if (PROB_ODD_SIZED_DATA(info)) info->chunk_size++; make_canonical_header(header,info); length_to_str(info); bytes_left = gen_bytes; memset((void *)silence,0,XFER_SIZE); proginfo.initialized = FALSE; proginfo.prefix = "Generating"; proginfo.clause = NULL; proginfo.filename1 = NULL; proginfo.filedesc1 = NULL; proginfo.filename2 = outfilename; proginfo.filedesc2 = info->m_ss; proginfo.bytes_total = bytes_left + CANONICAL_HEADER_SIZE; prog_update(&proginfo); if (NULL == (output = open_output_stream(outfilename,&output_proc))) st_error("could not open output file: [%s]",outfilename); if (write_n_bytes(output,header,CANONICAL_HEADER_SIZE,&proginfo) != CANONICAL_HEADER_SIZE) { prog_error(&proginfo); st_error("error while writing %d-byte WAVE header",CANONICAL_HEADER_SIZE); } while (bytes_left > 0) { bytes = min(bytes_left,XFER_SIZE); if (write_n_bytes(output,silence,bytes,&proginfo) != bytes) { prog_error(&proginfo); st_error("error while writing %d-byte chunk of silence",bytes); } bytes_left -= bytes; } if (PROB_ODD_SIZED_DATA(info) && (1 != write_padding(output,1,&proginfo))) { prog_error(&proginfo); st_error("error while NULL-padding odd-sized data chunk"); } success = TRUE; prog_success(&proginfo); if (CLOSE_CHILD_ERROR_OUTPUT == close_output(output,output_proc)) { success = FALSE; } return success; } static bool gen_main(int argc,char **argv) { parse(argc,argv); return process(); } shntool-3.0.10/src/mode_cat.c0000644000077100007710000001413411164063470012721 00000000000000/* mode_cat.c - cat mode module * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mode.h" CVSID("$Id: mode_cat.c,v 1.84 2009/03/30 06:31:20 jason Exp $") static bool cat_main(int,char **); static void cat_help(void); mode_module mode_cat = { "cat", "shncat", "Writes PCM WAVE data from one or more files to the terminal", CVSIDSTR, FALSE, cat_main, cat_help }; static bool cat_header = TRUE; static bool cat_data = TRUE; static bool cat_padded_data = TRUE; static bool cat_extra = TRUE; static void cat_help() { st_info("Usage: %s [OPTIONS] [files]\n",st_progname()); st_info("\n"); st_info("Mode-specific options:\n"); st_info("\n"); st_info(" -c suppress extra RIFF chunks\n"); st_info(" -d suppress WAVE data\n"); st_info(" -e suppress WAVE headers\n"); st_info(" -h show this help screen\n"); st_info(" -n suppress NULL pad byte at end of odd-sized data chunks, if present\n"); st_info("\n"); } static void parse(int argc,char **argv,int *first_arg) { int c; while ((c = st_getopt(argc,argv,"cden")) != -1) { switch (c) { case 'c': cat_extra = FALSE; break; case 'd': cat_data = FALSE; break; case 'e': cat_header = FALSE; break; case 'n': cat_padded_data = FALSE; break; } } if (!cat_header && !cat_data && !cat_extra) st_help("nothing to do if WAVE header, data and extra RIFF chunks are suppressed"); *first_arg = optind; } static bool cat_file(wave_info *info) { unsigned char *header,nullpad[BUF_SIZE]; FILE *devnull,*data_dest; int bytes; progress_info proginfo; bool success; success = FALSE; proginfo.initialized = FALSE; proginfo.prefix = "Catenating"; proginfo.clause = NULL; proginfo.filename1 = info->filename; proginfo.filedesc1 = info->m_ss; proginfo.filename2 = NULL; proginfo.filedesc2 = NULL; proginfo.bytes_total = info->total_size; prog_update(&proginfo); SETBINARY_OUT(stdout); if (NULL == (devnull = open_output(NULLDEVICE))) { prog_error(&proginfo); st_error("could not open output file: [%s]",NULLDEVICE); } if (!cat_header && !cat_data && !PROB_EXTRA_CHUNKS(info)) { prog_error(&proginfo); st_warning("input file contains no extra RIFF chunks -- nothing to do"); return FALSE; } if (!open_input_stream(info)) { prog_error(&proginfo); st_error("could not reopen input file"); } if (NULL == (header = malloc(info->header_size * sizeof(unsigned char)))) { prog_error(&proginfo); st_error("could not allocate %d bytes for WAVE header",info->header_size); } if (read_n_bytes(info->input,header,info->header_size,NULL) != info->header_size) { prog_error(&proginfo); st_error("error while reading %d-byte WAVE header",info->header_size); } if (cat_header) { if (!do_header_kluges(header,info)) { prog_error(&proginfo); st_error("could not fix WAVE header"); } if (write_n_bytes(stdout,header,info->header_size,&proginfo) != info->header_size) { prog_error(&proginfo); st_error("error while writing %d-byte WAVE header",info->header_size); } } else { proginfo.bytes_written += info->header_size; prog_update(&proginfo); } if (cat_data) data_dest = stdout; else data_dest = devnull; if (transfer_n_bytes(info->input,data_dest,info->data_size,&proginfo) != info->data_size) { prog_error(&proginfo); st_error("error while transferring %lu bytes of data",info->data_size); } if (PROB_ODD_SIZED_DATA(info)) { nullpad[0] = 1; bytes = read_n_bytes(info->input,nullpad,1,NULL); if ((1 != bytes) && (0 != bytes)) { prog_error(&proginfo); st_error("error while reading possible NULL pad byte"); } if ((0 == bytes) || ((1 == bytes) && nullpad[0])) { st_debug1("input file does not contain NULL pad byte for odd-sized data chunk per RIFF specs"); } if (1 == bytes) { if ((0 == nullpad[0]) && cat_padded_data) { if (write_n_bytes(data_dest,nullpad,1,&proginfo) != 1) { prog_error(&proginfo); st_error("error while writing NULL pad byte"); } } if (nullpad[0] && cat_extra) { if (write_n_bytes(stdout,nullpad,1,&proginfo) != 1) { prog_error(&proginfo); st_error("error while writing initial extra byte"); } } } } if (cat_extra && PROB_EXTRA_CHUNKS(info)) { if (info->extra_riff_size != transfer_n_bytes(info->input,stdout,info->extra_riff_size,&proginfo)) { prog_error(&proginfo); st_error("error while transferring %lu extra bytes",info->extra_riff_size); } } success = TRUE; prog_success(&proginfo); fclose(devnull); st_free(header); close_input_stream(info); return success; } static bool process_file(char *filename) { wave_info *info; bool success; if (NULL == (info = new_wave_info(filename))) return FALSE; success = cat_file(info); st_free(info); return success; } static bool process(int argc,char **argv,int start) { char *filename; bool success; success = TRUE; input_init(start,argc,argv); while ((filename = input_get_filename())) { success = (process_file(filename) && success); } return success; } static bool cat_main(int argc,char **argv) { int first_arg; parse(argc,argv,&first_arg); return process(argc,argv,first_arg); } shntool-3.0.10/src/format_alac.c0000644000077100007710000000317711155771111013421 00000000000000/* format_alac.c - alac format module * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "format.h" CVSID("$Id: format_alac.c,v 1.39 2009/03/11 17:18:01 jason Exp $") #define ALAC "alac" #define ALAC_MAGIC "M4A " static char default_decoder_args[] = FILENAME_PLACEHOLDER; /* * in theory, the ffmpeg commands below should work, but currently it seems that * incorrect data sizes are written when encoding or decoding over pipes... */ /* #define FFMPEG "ffmpeg" static char default_decoder_args[] = "-i " FILENAME_PLACEHOLDER " -f wav -"; static char default_encoder_args[] = "-i - -acodec alac " FILENAME_PLACEHOLDER; */ format_module format_alac = { "alac", "Apple Lossless Audio Codec", CVSIDSTR, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, "-", ALAC_MAGIC, 8, "m4a", ALAC, default_decoder_args, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; shntool-3.0.10/src/format_flac.c0000644000077100007710000000260211155771111013416 00000000000000/* format_flac.c - flac format module * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "format.h" CVSID("$Id: format_flac.c,v 1.57 2009/03/11 17:18:01 jason Exp $") #define FLAC "flac" #define FLAC_MAGIC "fLaC" static char default_decoder_args[] = "-c -d -s " FILENAME_PLACEHOLDER; static char default_encoder_args[] = "-s -o " FILENAME_PLACEHOLDER " -"; format_module format_flac = { "flac", "Free Lossless Audio Codec", CVSIDSTR, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, NULL, FLAC_MAGIC, 0, "flac", FLAC, default_decoder_args, FLAC, default_encoder_args, NULL, NULL, NULL, NULL, NULL, NULL }; shntool-3.0.10/src/format_term.c0000644000077100007710000000301011155771111013452 00000000000000/* format_term.c - terminal output format module * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include #include "format.h" CVSID("$Id: format_term.c,v 1.15 2009/03/11 17:18:01 jason Exp $") static FILE *open_for_output(char *,proc_info *); static void create_output_filename(char *); format_module format_term = { "term", "Sends output to the terminal", CVSIDSTR, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, open_for_output, NULL, create_output_filename, NULL }; static FILE *open_for_output(char *filename,proc_info *pinfo) { pinfo->pid = NO_CHILD_PID; return stdout; } static void create_output_filename(char *outfilename) { strcpy(outfilename,"terminal"); } shntool-3.0.10/src/core_fileio.c0000644000077100007710000001051211155771111013417 00000000000000/* core_fileio.c - file I/O functions * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include #include "shntool.h" CVSID("$Id: core_fileio.c,v 1.44 2009/03/11 17:18:01 jason Exp $") int read_n_bytes(FILE *in,unsigned char *buf,int num,progress_info *proginfo) /* reads the specified number of bytes from the file descriptor 'in' into buf */ { int read; if ((read = fread(buf,1,num,in)) != num) { st_debug1("tried to read %d bytes, but only read %d -- possible truncated/corrupt file",num,read); } if (proginfo) { proginfo->bytes_written += read; prog_update(proginfo); } return read; } int write_n_bytes(FILE *out,unsigned char *buf,int num,progress_info *proginfo) /* writes the specified number of bytes from buf into the file descriptor 'out' */ { int wrote; if ((wrote = fwrite(buf,1,num,out)) != num) { st_debug1("tried to write %d bytes, but only wrote %d -- make sure that:\n" "+ there is enough disk space\n" "+ the specified output directory exists\n" "+ you have permission to create files in the output directory\n" "+ the output format's encoder is installed and in your PATH",num,wrote); } if (proginfo) { proginfo->bytes_written += wrote; prog_update(proginfo); } return wrote; } unsigned long transfer_n_bytes_internal(FILE *in,FILE *out1,FILE *out2,unsigned long bytes,progress_info *proginfo) /* transfers 'bytes' bytes from file descriptor 'in' to file descriptor 'out' */ { unsigned char buf[XFER_SIZE]; int bytes_to_xfer, actual_bytes_read, actual_bytes_written1, actual_bytes_written2; unsigned long total_bytes_to_xfer = bytes, total_bytes_xfered = 0; while (total_bytes_to_xfer > 0) { bytes_to_xfer = min(total_bytes_to_xfer,XFER_SIZE); actual_bytes_read = read_n_bytes(in,buf,bytes_to_xfer,NULL); actual_bytes_written1 = write_n_bytes(out1,buf,actual_bytes_read,proginfo); actual_bytes_written2 = (out2) ? write_n_bytes(out2,buf,actual_bytes_read,NULL) : 0; total_bytes_xfered += (unsigned long)actual_bytes_written1; if (actual_bytes_read != bytes_to_xfer || actual_bytes_written1 != bytes_to_xfer || (out2 && actual_bytes_written2 != bytes_to_xfer)) break; total_bytes_to_xfer -= bytes_to_xfer; } return total_bytes_xfered; } int write_padding(FILE *out,int bytes,progress_info *proginfo) /* writes the specified number of zero bytes to the file descriptor given */ { unsigned char silence[CD_BLOCK_SIZE]; if (bytes >= CD_BLOCK_SIZE) { /* padding should always be less than the size of the block being padded */ return 0; } memset((void *)silence,0,CD_BLOCK_SIZE); return write_n_bytes(out,silence,bytes,proginfo); } bool read_value_long(FILE *file,unsigned long *be_val,unsigned long *le_val,unsigned char *tag_val) /* reads an unsigned long in big- and/or little-endian format from a file descriptor */ { unsigned char buf[5]; if (fread(buf, 1, 4, file) != 4) return FALSE; buf[4] = 0; if (be_val) *be_val = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]; if (le_val) *le_val = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0]; if (tag_val) tagcpy(tag_val,buf); return TRUE; } bool read_value_short(FILE *file,unsigned short *be_val,unsigned short *le_val) /* reads an unsigned short in big- and/or little-endian format from a file descriptor */ { unsigned char buf[2]; if (fread(buf, 1, 2, file) != 2) return FALSE; if (be_val) *be_val = (buf[0] << 8) | buf[1]; if (le_val) *le_val = (buf[1] << 8) | buf[0]; return TRUE; } shntool-3.0.10/src/format_la.c0000644000077100007710000000243411155771111013110 00000000000000/* format_la.c - Lossless Audio format module * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "format.h" CVSID("$Id: format_la.c,v 1.29 2009/03/11 17:18:01 jason Exp $") #define LA "la" #define LA_MAGIC "LA04" static char default_decoder_args[] = "-cout " FILENAME_PLACEHOLDER; format_module format_la = { "la", "Lossless Audio Compresser", CVSIDSTR, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, NULL, LA_MAGIC, 0, "la", LA, default_decoder_args, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; shntool-3.0.10/src/format_mkw.c0000644000077100007710000000257511155771111013320 00000000000000/* format_mkw.c - mkw format module * Copyright (C) 2000-2009 Jason Jordan * * 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 of the License, 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, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "format.h" CVSID("$Id: format_mkw.c,v 1.10 2009/03/11 17:18:01 jason Exp $") #define MKW_MAGIC "mkw" #define MKWCON "mkwcon" static char default_decoder_args[] = "-x -q " FILENAME_PLACEHOLDER " -"; static char default_encoder_args[] = "-e -q - " FILENAME_PLACEHOLDER; format_module format_mkw = { "mkw", "MKW Audio Compression format", CVSIDSTR, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, NULL, MKW_MAGIC, 0, "mkw", MKWCON, default_decoder_args, MKWCON, default_encoder_args, NULL, NULL, NULL, NULL, NULL, NULL }; shntool-3.0.10/src/mode_pad.c0000644000077100007710000001552611157756171012735 00000000000000/* mode_pad.c - pad mode module * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mode.h" CVSID("$Id: mode_pad.c,v 1.81 2009/03/17 17:23:05 jason Exp $") static bool pad_main(int,char **); static void pad_help(void); mode_module mode_pad = { "pad", "shnpad", "Pads CD-quality files not aligned on sector boundaries with silence", CVSIDSTR, TRUE, pad_main, pad_help }; enum { PAD_UNKNOWN, PAD_PREPAD, PAD_POSTPAD }; #define PAD_POSTFIX "-padded" static int pad_type = PAD_UNKNOWN; static void pad_help() { st_info("Usage: %s [OPTIONS] [files]\n",st_progname()); st_info("\n"); st_info("Mode-specific options:\n"); st_info("\n"); st_info(" -b pad the beginning of files with silence\n"); st_info(" -e pad the end of files with silence (default)\n"); st_info(" -h show this help screen\n"); st_info("\n"); } static void parse(int argc,char **argv,int *first_arg) { int c; st_ops.output_directory = INPUT_FILE_DIR; st_ops.output_postfix = PAD_POSTFIX; pad_type = PAD_POSTPAD; while ((c = st_getopt(argc,argv,"be")) != -1) { switch (c) { case 'b': pad_type = PAD_PREPAD; break; case 'e': pad_type = PAD_POSTPAD; break; } } *first_arg = optind; } static bool pad_file(wave_info *info) { int pad_bytes; proc_info output_proc; FILE *output = NULL; char outfilename[FILENAME_SIZE]; unsigned char *header = NULL,nullpad[BUF_SIZE]; bool has_null_pad; bool success; progress_info proginfo; success = FALSE; create_output_filename(info->filename,info->input_format->extension,outfilename); proginfo.initialized = FALSE; proginfo.prefix = (pad_type == PAD_PREPAD) ? "Pre-padding" : "Post-padding"; proginfo.clause = "-->"; proginfo.filename1 = info->filename; proginfo.filedesc1 = info->m_ss; proginfo.filename2 = outfilename; proginfo.filedesc2 = NULL; proginfo.bytes_total = info->total_size; prog_update(&proginfo); if (files_are_identical(info->filename,outfilename)) { prog_error(&proginfo); st_warning("output file would overwrite input file -- skipping."); return FALSE; } pad_bytes = CD_BLOCK_SIZE - (info->data_size % CD_BLOCK_SIZE); has_null_pad = odd_sized_data_chunk_is_null_padded(info); if (!open_input_stream(info)) { prog_error(&proginfo); st_warning("could not open input file -- skipping."); return FALSE; } if (NULL == (header = malloc(info->header_size * sizeof(unsigned char)))) { prog_error(&proginfo); st_warning("could not allocate %d-byte WAVE header -- skipping.",info->header_size); goto cleanup; } if (NULL == (output = open_output_stream(outfilename,&output_proc))) { prog_error(&proginfo); st_warning("could not open output file -- skipping."); goto cleanup; } if (read_n_bytes(info->input,header,info->header_size,NULL) != info->header_size) { prog_error(&proginfo); st_warning("error while discarding %d-byte WAVE header -- skipping.",info->header_size); goto cleanup; } if (!do_header_kluges(header,info)) { prog_error(&proginfo); st_warning("could not fix WAVE header -- skipping."); goto cleanup; } put_data_size(header,info->header_size,info->data_size+pad_bytes); if (PROB_EXTRA_CHUNKS(info)) { if (!has_null_pad) info->extra_riff_size++; put_chunk_size(header,info->header_size+info->data_size+pad_bytes+info->extra_riff_size-8); } else put_chunk_size(header,info->header_size+info->data_size+pad_bytes-8); if ((info->header_size > 0) && write_n_bytes(output,header,info->header_size,&proginfo) != info->header_size) { prog_error(&proginfo); st_warning("error while writing %d-byte WAVE header -- skipping.",info->header_size); goto cleanup; } if (PAD_PREPAD == pad_type) { if (pad_bytes != write_padding(output,pad_bytes,&proginfo)) { prog_error(&proginfo); st_warning("error while pre-padding with %d zero-bytes -- skipping.",pad_bytes); goto cleanup; } } if ((info->data_size > 0) && (transfer_n_bytes(info->input,output,info->data_size,&proginfo) != info->data_size)) { prog_error(&proginfo); st_warning("error while transferring %lu-byte data chunk -- skipping.",info->data_size); goto cleanup; } if (PAD_POSTPAD == pad_type) { if (pad_bytes != write_padding(output,pad_bytes,&proginfo)) { prog_error(&proginfo); st_warning("error while post-padding with %d zero-bytes -- skipping",pad_bytes); goto cleanup; } } if (PROB_ODD_SIZED_DATA(info) && has_null_pad) { if (1 != read_n_bytes(info->input,nullpad,1,&proginfo)) { prog_error(&proginfo); st_warning("error while discarding NULL pad byte -- skipping."); goto cleanup; } } if ((info->extra_riff_size > 0) && (transfer_n_bytes(info->input,output,info->extra_riff_size,&proginfo) != info->extra_riff_size)) { prog_error(&proginfo); st_warning("error while transferring %lu extra bytes -- skipping.",info->extra_riff_size); goto cleanup; } success = TRUE; prog_success(&proginfo); cleanup: st_free(header); if ((output) && ((CLOSE_CHILD_ERROR_OUTPUT == close_output(output,output_proc)) || !success)) { success = FALSE; remove_file(outfilename); } close_input_stream(info); return success; } static bool process_file(char *filename) { wave_info *info; bool success; if (NULL == (info = new_wave_info(filename))) return FALSE; if (PROB_NOT_CD(info)) { st_warning("file is not CD-quality: [%s]",filename); st_free(info); return FALSE; } if (!PROB_BAD_BOUND(info)) { st_warning("file is already sector-aligned: [%s]",filename); st_free(info); return FALSE; } success = pad_file(info); st_free(info); return success; } static bool process(int argc,char **argv,int start) { char *filename; bool success; success = TRUE; input_init(start,argc,argv); while ((filename = input_get_filename())) { success = (process_file(filename) && success); } return success; } static bool pad_main(int argc,char **argv) { int first_arg; parse(argc,argv,&first_arg); return process(argc,argv,first_arg); } shntool-3.0.10/src/core_output.c0000644000077100007710000000704311155771111013515 00000000000000/* core_output.c - generic output functions * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include #include #include "shntool.h" CVSID("$Id: core_output.c,v 1.36 2009/03/11 17:18:01 jason Exp $") static char msgbuf[BUF_SIZE]; static char errbuf[BUF_SIZE]; void st_output(char *msg, ...) { va_list args; va_start(args,msg); st_vsnprintf(msgbuf,BUF_SIZE,msg,args); fprintf(stdout,"%s",msgbuf); va_end(args); } void st_info(char *msg, ...) { va_list args; if (st_priv.suppress_stderr) return; va_start(args,msg); st_vsnprintf(errbuf,BUF_SIZE,msg,args); fprintf(stderr,"%s",errbuf); va_end(args); } static void print_prefix() { if (st_priv.is_aliased || NULL == st_priv.progmode) fprintf(stderr,"%s: ",st_priv.progname); else fprintf(stderr,"%s [%s]: ",st_priv.progname,st_priv.progmode); } static void print_msgtype(char *msgtype,int line) { int i; if (0 == line) { fprintf(stderr,"%s",msgtype); } else { for (i=0;i st_priv.debug_level) return; st_vsnprintf(msgbuf,BUF_SIZE,msg,args); st_snprintf(debugprefix,16,"debug%d: ",level); print_lines(debugprefix,msgbuf); } void st_debug1(char *msg, ...) { va_list args; va_start(args,msg); st_debug_internal(1,msg,args); va_end(args); } void st_debug2(char *msg, ...) { va_list args; va_start(args,msg); st_debug_internal(2,msg,args); va_end(args); } void st_debug3(char *msg, ...) { va_list args; va_start(args,msg); st_debug_internal(3,msg,args); va_end(args); } shntool-3.0.10/src/mode_fix.c0000644000077100007710000003241111157354613012742 00000000000000/* mode_fix.c - fix mode module * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mode.h" CVSID("$Id: mode_fix.c,v 1.115 2009/03/16 04:46:03 jason Exp $") static bool fix_main(int,char **); static void fix_help(void); mode_module mode_fix = { "fix", "shnfix", "Fixes sector-boundary problems with CD-quality PCM WAVE data", CVSIDSTR, TRUE, fix_main, fix_help }; #define FIX_POSTFIX "-fixed" typedef enum { SHIFT_UNKNOWN, SHIFT_BACKWARD, SHIFT_FORWARD, SHIFT_ROUND } fix_shifts; static bool pad = TRUE; static bool skip = TRUE; static bool check_only = FALSE; static int pad_bytes = 0; static int desired_shift = SHIFT_UNKNOWN; static int numfiles; static wave_info **files; static void fix_help() { st_info("Usage: %s [OPTIONS] [file1 ...]\n",st_progname()); st_info("\n"); st_info("Mode-specific options:\n"); st_info("\n"); st_info(" -b shift track breaks backward to previous sector boundary (default)\n"); st_info(" -c check whether fixing is needed\n"); st_info(" -f shift track breaks forward to next sector boundary\n"); st_info(" -h show this help screen\n"); st_info(" -k don't skip initial unchanged files\n"); st_info(" -n don't pad the last file with silence\n"); st_info(" -u round track breaks to the nearest sector boundary\n"); st_info("\n"); } static void parse(int argc,char **argv,int *first_arg) { int c; st_ops.output_directory = CURRENT_DIR; st_ops.output_postfix = FIX_POSTFIX; desired_shift = SHIFT_BACKWARD; while ((c = st_getopt(argc,argv,"bcfknu")) != -1) { switch (c) { case 'b': desired_shift = SHIFT_BACKWARD; break; case 'c': check_only = TRUE; break; case 'f': desired_shift = SHIFT_FORWARD; break; case 'k': skip = FALSE; break; case 'n': pad = FALSE; break; case 'u': desired_shift = SHIFT_ROUND; break; } } *first_arg = optind; } static void calculate_breaks_backward() { int i,remainder = 0; wlong tmp,begin_before = 0,begin_after = 0; for (i=0;ibeginning_byte = begin_before; files[i]->new_beginning_byte = begin_after; tmp = files[i]->data_size + remainder; remainder = tmp % CD_BLOCK_SIZE; files[i]->new_data_size = tmp - remainder; begin_before += files[i]->data_size; begin_after += files[i]->new_data_size; } files[numfiles-1]->new_data_size = files[numfiles-1]->data_size + remainder; files[numfiles-1]->beginning_byte = begin_before; files[numfiles-1]->new_beginning_byte = begin_after; } static void calculate_breaks_forward() { int i,used = 0,remainder; wlong tmp,begin_before = 0,begin_after = 0; for (i=0;ibeginning_byte = begin_before; files[i]->new_beginning_byte = begin_after; tmp = files[i]->data_size - used; remainder = tmp % CD_BLOCK_SIZE; if (remainder) { used = CD_BLOCK_SIZE - remainder; files[i]->new_data_size = tmp + used; } else { used = 0; files[i]->new_data_size = tmp; } begin_before += files[i]->data_size; begin_after += files[i]->new_data_size; } files[numfiles-1]->new_data_size = files[numfiles-1]->data_size - used; files[numfiles-1]->beginning_byte = begin_before; files[numfiles-1]->new_beginning_byte = begin_after; } static void calculate_breaks_round() { int i,give_or_take = 0; wlong tmp,how_much,begin_before = 0,begin_after = 0; for (i=0;ibeginning_byte = begin_before; files[i]->new_beginning_byte = begin_after; tmp = files[i]->data_size + give_or_take; how_much = (((tmp + CD_BLOCK_SIZE/2) / CD_BLOCK_SIZE) * CD_BLOCK_SIZE); give_or_take = tmp - how_much; files[i]->new_data_size = how_much; begin_before += files[i]->data_size; begin_after += files[i]->new_data_size; } files[numfiles-1]->new_data_size = files[numfiles-1]->data_size + give_or_take; files[numfiles-1]->beginning_byte = begin_before; files[numfiles-1]->new_beginning_byte = begin_after; } static void calculation_sanity_check() { int i; wlong old_total = 0,new_total = 0; for (i=0;idata_size; new_total += files[i]->new_data_size; } if (old_total != new_total) { st_warning("total WAVE data size differs from newly calculated total --\n" "please file a bug report with the following data:"); st_info("\n"); st_info("Shift type: %s\n",(SHIFT_BACKWARD == desired_shift)?"backward": ((SHIFT_FORWARD == desired_shift)?"forward": ((SHIFT_ROUND == desired_shift)?"round":"unknown"))); st_info("\n"); for (i=0;idata_size,files[i]->new_data_size); st_info("\n"); st_info("totals : data size = %10lu, new data size = %10lu\n",old_total,new_total); exit(ST_EXIT_ERROR); } } static bool reopen_input_file(int i,progress_info *proginfo) { unsigned char *header; if (!open_input_stream(files[i])) { prog_error(proginfo); st_warning("could not reopen input file: [%s]",files[i]->filename); return FALSE; } if (NULL == (header = malloc(files[i]->header_size * sizeof(unsigned char)))) { prog_error(proginfo); st_warning("could not allocate %d-byte WAVE header",files[i]->header_size); return FALSE; } if (read_n_bytes(files[i]->input,header,files[i]->header_size,NULL) != files[i]->header_size) { prog_error(proginfo); st_warning("error while reading %d-byte WAVE header",files[i]->header_size); st_free(header); return FALSE; } st_free(header); return TRUE; } static bool open_this_file(int i,char *outfilename,progress_info *proginfo) { unsigned char header[CANONICAL_HEADER_SIZE]; create_output_filename(files[i]->filename,files[i]->input_format->extension,outfilename); proginfo->filename1 = files[i]->filename; proginfo->filedesc1 = files[i]->m_ss; proginfo->filename2 = outfilename; if (NULL == (files[i]->output = open_output_stream(outfilename,&files[i]->output_proc))) { prog_error(proginfo); st_error("could not open output file: [%s]",outfilename); } make_canonical_header(header,files[i]); if ((numfiles - 1 == i) && pad) put_data_size(header,CANONICAL_HEADER_SIZE,files[i]->new_data_size+pad_bytes); else { put_data_size(header,CANONICAL_HEADER_SIZE,files[i]->new_data_size); if (files[i]->new_data_size & 1) put_chunk_size(header,(files[i]->new_data_size + 1) + CANONICAL_HEADER_SIZE - 8); } if (write_n_bytes(files[i]->output,header,CANONICAL_HEADER_SIZE,proginfo) != CANONICAL_HEADER_SIZE) { prog_error(proginfo); st_warning("error while writing %d-byte WAVE header",CANONICAL_HEADER_SIZE); return FALSE; } proginfo->filename2 = outfilename; proginfo->bytes_total = files[i]->new_data_size + CANONICAL_HEADER_SIZE; return TRUE; } static bool write_fixed_files() { int cur_input,cur_output; unsigned long bytes_have,bytes_needed,bytes_to_xfer; char outfilename[FILENAME_SIZE]; bool success; progress_info proginfo; success = FALSE; cur_input = cur_output = 0; bytes_have = (unsigned long)files[cur_input]->data_size; bytes_needed = (unsigned long)files[cur_output]->new_data_size; proginfo.initialized = FALSE; proginfo.prefix = "Fixing"; proginfo.clause = "-->"; proginfo.filename1 = files[0]->filename; proginfo.filedesc1 = files[0]->m_ss; proginfo.filename2 = NULL; proginfo.filedesc2 = NULL; proginfo.bytes_total = 1; if (!open_this_file(cur_output,outfilename,&proginfo)) goto cleanup; if (!reopen_input_file(cur_input,&proginfo)) goto cleanup; while (cur_input < numfiles && cur_output < numfiles) { bytes_to_xfer = min(bytes_have,bytes_needed); if (transfer_n_bytes(files[cur_input]->input,files[cur_output]->output,bytes_to_xfer,&proginfo) != bytes_to_xfer) { prog_error(&proginfo); st_warning("error while transferring %lu bytes of data",bytes_to_xfer); goto cleanup; } bytes_have -= bytes_to_xfer; bytes_needed -= bytes_to_xfer; if (0 == bytes_have) { close_input_stream(files[cur_input]); files[cur_input]->input = NULL; cur_input++; if (cur_input < numfiles) { bytes_have = (unsigned long)files[cur_input]->data_size; if (!reopen_input_file(cur_input,&proginfo)) goto cleanup; } } if (0 == bytes_needed) { prog_success(&proginfo); if (numfiles - 1 == cur_output) { if (pad) { if (pad_bytes) { if (pad_bytes != write_padding(files[cur_output]->output,pad_bytes,NULL)) { prog_error(&proginfo); st_warning("error while padding with %d zero-bytes",pad_bytes); goto cleanup; } st_info("Padded last file with %d zero-bytes.\n",pad_bytes); } else st_info("No padding needed.\n"); } else { st_info("Last file was not padded, "); if (pad_bytes) st_info("though it needs %d bytes of padding.\n",pad_bytes); else st_info("nor was it needed.\n"); if ((files[cur_output]->new_data_size & 1) && (1 != write_padding(files[cur_output]->output,1,NULL))) { prog_error(&proginfo); st_warning("error while NULL-padding odd-sized data chunk"); goto cleanup; } } } close_output_stream(files[cur_output]); files[cur_output]->output = NULL; cur_output++; if (cur_output < numfiles) { bytes_needed = (unsigned long)files[cur_output]->new_data_size; if (!open_this_file(cur_output,outfilename,&proginfo)) goto cleanup; } } } success = TRUE; cleanup: if (!success) { close_output_stream(files[cur_output]); remove_file(outfilename); st_error("failed to fix files"); } return success; } static bool process(int argc,char **argv,int start) { int i,j,remainder; bool needs_fixing = FALSE,found_errors = FALSE,success; char *filename; input_init(start,argc,argv); input_read_all_files(); numfiles = input_get_file_count(); if (numfiles < 1) st_help("need one or more files to process"); if (NULL == (files = malloc((numfiles + 1) * sizeof(wave_info *)))) st_error("could not allocate memory for file info array"); for (i=0;ifilename); found_errors = TRUE; } if (PROB_HDR_INCONSISTENT(files[i])) { st_warning("file has an inconsistent header: [%s]",files[i]->filename); found_errors = TRUE; } if (PROB_TRUNCATED(files[i])) { st_warning("file seems to be truncated: [%s]",files[i]->filename); found_errors = TRUE; } if (PROB_BAD_BOUND(files[i])) needs_fixing = TRUE; } if (found_errors) st_error("could not fix files due to errors, see above"); if (check_only) exit(needs_fixing ? ST_EXIT_SUCCESS : ST_EXIT_ERROR); if (!needs_fixing) st_error("everything seems fine, no need for fixing"); reorder_files(files,numfiles); i = 0; while (!PROB_BAD_BOUND(files[i])) i++; if (skip) { if (i != 0) { st_warning("skipping first %d file%s because %s would not be changed",i,(1==i)?"":"s",(1==i)?"it":"they"); for (j=0;jnew_data_size % CD_BLOCK_SIZE; if (remainder) pad_bytes = CD_BLOCK_SIZE - remainder; success = write_fixed_files(); for (i=0;i * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "format.h" CVSID("$Id: format_shn.c,v 1.65 2009/03/11 17:18:01 jason Exp $") #define SHORTEN "shorten" #define SHORTEN_MAGIC "ajkg" #define SHORTEN_SEEKTABLE_MAGIC "SHNAMPSK" static char default_decoder_args[] = "-x " FILENAME_PLACEHOLDER " -"; static char default_encoder_args[] = "- " FILENAME_PLACEHOLDER; static void show_extra_info(char *); format_module format_shn = { "shn", "Shorten low complexity waveform coder", CVSIDSTR, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, NULL, SHORTEN_MAGIC, 0, "shn", SHORTEN, default_decoder_args, SHORTEN, default_encoder_args, NULL, NULL, NULL, show_extra_info, NULL, NULL }; static void show_extra_info(char *filename) { FILE *f; unsigned char buf[9]; st_output(" Seekable: "); if (NULL == (f = fopen(filename,"r"))) { st_output("(error: could not open file)\n"); return; } if (fseek(f,-8,SEEK_END)) { st_output("(error: could not seek to end of file)\n"); fclose(f); return; } if (8 != fread(buf,1,8,f)) { st_output("(error: could not read last 8 bytes of file)\n"); fclose(f); return; } fclose(f); buf[8] = 0; if (!tagcmp(buf,(unsigned char *)SHORTEN_SEEKTABLE_MAGIC)) st_output("yes\n"); else st_output("no\n"); } shntool-3.0.10/src/format_ape.c0000644000077100007710000000350711155771111013263 00000000000000/* format_ape.c - ape format module * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "format.h" CVSID("$Id: format_ape.c,v 1.54 2009/03/11 17:18:01 jason Exp $") #define MAC "mac" #define MAC_MAGIC "MAC " static char default_decoder_args[] = FILENAME_PLACEHOLDER " - -d"; static char default_encoder_args[] = "- " FILENAME_PLACEHOLDER " -c2000"; static bool input_header_kluge(unsigned char *,wave_info *); format_module format_ape = { "ape", "Monkey's Audio Compressor", CVSIDSTR, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, NULL, MAC_MAGIC, 0, "ape", MAC, default_decoder_args, MAC, default_encoder_args, NULL, NULL, NULL, NULL, NULL, input_header_kluge }; static bool input_header_kluge(unsigned char *header,wave_info *info) { wlong adjusted_data_size; adjusted_data_size = info->data_size; if (PROB_ODD_SIZED_DATA(info)) adjusted_data_size++; if (info->chunk_size < adjusted_data_size) info->chunk_size = info->header_size + adjusted_data_size - 8; put_data_size(header,info->header_size,info->data_size); return TRUE; } shntool-3.0.10/src/core_convert.c0000644000077100007710000000570511155771111013640 00000000000000/* core_convert.c - little-endian conversion functions * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "shntool.h" CVSID("$Id: core_convert.c,v 1.21 2009/03/11 17:18:01 jason Exp $") unsigned long uchar_to_ulong_le(unsigned char * buf) /* converts 4 bytes stored in little-endian format to an unsigned long */ { return (unsigned long)(buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24)); } unsigned short uchar_to_ushort_le(unsigned char * buf) /* converts 2 bytes stored in little-endian format to an unsigned short */ { return (unsigned short)(buf[0] | (buf[1] << 8)); } void ulong_to_uchar_le(unsigned char * buf,unsigned long num) /* converts an unsigned long to 4 bytes stored in little-endian format */ { buf[0] = (unsigned char)(num); buf[1] = (unsigned char)(num >> 8); buf[2] = (unsigned char)(num >> 16); buf[3] = (unsigned char)(num >> 24); } void ushort_to_uchar_le(unsigned char * buf,unsigned short num) /* converts an unsigned short to 2 bytes stored in little-endian format */ { buf[0] = (unsigned char)(num); buf[1] = (unsigned char)(num >> 8); } unsigned long uchar_to_ulong_be(unsigned char * buf) /* converts 4 bytes stored in big-endian format to an unsigned long */ { return (unsigned long)((buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]); } unsigned short uchar_to_ushort_be(unsigned char * buf) /* converts 2 bytes stored in big-endian format to an unsigned short */ { return (unsigned short)((buf[0] << 8) | buf[1]); } void ulong_to_uchar_be(unsigned char * buf,unsigned long num) /* converts an unsigned long to 4 bytes stored in big-endian format */ { buf[0] = (unsigned char)(num >> 24); buf[1] = (unsigned char)(num >> 16); buf[2] = (unsigned char)(num >> 8); buf[3] = (unsigned char)(num); } void ushort_to_uchar_be(unsigned char * buf,unsigned short num) /* converts an unsigned short to 2 bytes stored in big-endian format */ { buf[0] = (unsigned char)(num >> 8); buf[1] = (unsigned char)(num); } unsigned long synchsafe_int_to_ulong(unsigned char *buf) /* converts 4 bytes stored in synchsafe integer format to an unsigned long */ { return (unsigned long)(((buf[0] & 0x7f) << 21) | ((buf[1] & 0x7f) << 14) | ((buf[2] & 0x7f) << 7) | (buf[3] & 0x7f)); } shntool-3.0.10/src/format_wav.c0000644000077100007710000000470011155771111013307 00000000000000/* format_wav.c - WAVE format module * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include #include "format.h" CVSID("$Id: format_wav.c,v 1.61 2009/03/11 17:18:01 jason Exp $") static FILE *open_for_input(char *,proc_info *); static FILE *open_for_output(char *,proc_info *); static bool is_our_file(char *); #define WAVPACK_MAGIC "wvpk" format_module format_wav = { "wav", "RIFF WAVE file format", CVSIDSTR, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, NULL, NULL, 0, "wav", NULL, NULL, NULL, NULL, is_our_file, open_for_input, open_for_output, NULL, NULL, NULL }; static FILE *open_for_input(char *filename,proc_info *pinfo) { pinfo->pid = NO_CHILD_PID; return open_input(filename); } static FILE *open_for_output(char *filename,proc_info *pinfo) { if (!clobber_check(filename)) return NULL; pinfo->pid = NO_CHILD_PID; return open_output(filename); } static bool is_our_file(char *filename) { wave_info *info; unsigned char buf[4]; if (NULL == (info = new_wave_info(NULL))) st_error("could not allocate memory for WAVE info in wav check"); info->filename = filename; if (NULL == (info->input = open_input(filename))) { st_free(info); return FALSE; } info->input_format = &format_wav; if (!verify_wav_header(info)) { fclose(info->input); st_free(info); return FALSE; } /* WavPack header might follow RIFF header - make sure this isn't a WavPack file */ if (4 != fread(buf,1,4,info->input)) { fclose(info->input); st_free(info); return TRUE; } fclose(info->input); st_free(info); if (tagcmp(buf,(unsigned char *)WAVPACK_MAGIC)) return TRUE; /* it's not a WAVE */ return FALSE; } shntool-3.0.10/src/mode_hash.c0000644000077100007710000011163311157756171013110 00000000000000/* mode_hash.c - hash mode module * Portions copyright (C) 2000-2009 Jason Jordan * This mode module is based on the GNU MD5/SHA1 implementation. See the * original author/copyright info below. * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "mode.h" CVSID("$Id: mode_hash.c,v 1.93 2009/03/17 17:23:05 jason Exp $") static bool hash_main(int,char **); static void hash_help(void); mode_module mode_hash = { "hash", "shnhash", "Computes the MD5 or SHA1 fingerprint of PCM WAVE data", CVSIDSTR, FALSE, hash_main, hash_help }; enum { HASH_MD5, HASH_SHA1 }; #define COMPOSITE "composite" static unsigned long maxbytes; static unsigned char audio_hash[32]; static bool composite_hash = FALSE; static int remaining_bytes = 0; static int num_processed = 0; static int numfiles; static int hash_algorithm = HASH_MD5; static progress_info proginfo; static wave_info **files; /* shntool: modified GNU coreutils 5.93 md5/sha1 routines below */ /* md5.c - Functions to compute MD5 message digest of files or memory blocks according to the definition of MD5 in RFC 1321 from April 1992. Copyright (C) 1995, 1996, 2001, 2003, 2004, 2005 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu. 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by Ulrich Drepper , 1995. */ #include "md5.h" #ifdef _LIBC /* We need to keep the namespace clean so define the MD5 function protected using leading __ . */ # define md5_init_ctx __md5_init_ctx # define md5_process_block __md5_process_block # define md5_process_bytes __md5_process_bytes # define md5_finish_ctx __md5_finish_ctx # define md5_read_ctx __md5_read_ctx # define md5_stream __md5_stream # define md5_buffer __md5_buffer #endif /* shntool: use different swapping macros for MD5/SHA1 */ #ifdef WORDS_BIGENDIAN # define SWAP_MD5(n) \ (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24)) # define SWAP_SHA1(n) (n) #else # define SWAP_MD5(n) (n) # define SWAP_SHA1(n) \ (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24)) #endif /* shntool: begin common md5/sha1 definitions */ #define BLOCKSIZE 4096 #if BLOCKSIZE % 64 != 0 # error "invalid BLOCKSIZE" #endif /* This array contains the bytes used to pad the buffer to the next 64-byte boundary. (RFC 1321, 3.1: Step 1) */ static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ }; char global_buffer[BLOCKSIZE + 72]; /* shntool: end common md5/sha1 definitions */ /* shntool: global md5 context */ struct md5_ctx md5_global_ctx; /* Initialize structure containing state of computation. (RFC 1321, 3.3: Step 3) */ void md5_init_ctx (struct md5_ctx *ctx) { ctx->A = 0x67452301; ctx->B = 0xefcdab89; ctx->C = 0x98badcfe; ctx->D = 0x10325476; ctx->total[0] = ctx->total[1] = 0; ctx->buflen = 0; } /* Put result from CTX in first 16 bytes following RESBUF. The result must be in little endian byte order. IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ void * md5_read_ctx (const struct md5_ctx *ctx, void *resbuf) { ((md5_uint32 *) resbuf)[0] = SWAP_MD5 (ctx->A); ((md5_uint32 *) resbuf)[1] = SWAP_MD5 (ctx->B); ((md5_uint32 *) resbuf)[2] = SWAP_MD5 (ctx->C); ((md5_uint32 *) resbuf)[3] = SWAP_MD5 (ctx->D); return resbuf; } /* Process the remaining bytes in the internal buffer and the usual prolog according to the standard and write the result to RESBUF. IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ void * md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) { /* Take yet unprocessed bytes into account. */ md5_uint32 bytes = ctx->buflen; size_t pad; /* Now count remaining bytes. */ ctx->total[0] += bytes; if (ctx->total[0] < bytes) ++ctx->total[1]; pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes; memcpy (&ctx->buffer[bytes], fillbuf, pad); /* Put the 64-bit file length in *bits* at the end of the buffer. */ *(md5_uint32 *) &ctx->buffer[bytes + pad] = SWAP_MD5 (ctx->total[0] << 3); *(md5_uint32 *) &ctx->buffer[bytes + pad + 4] = SWAP_MD5 ((ctx->total[1] << 3) | (ctx->total[0] >> 29)); /* Process last bytes. */ md5_process_block (ctx->buffer, bytes + pad + 8, ctx); return md5_read_ctx (ctx, resbuf); } /* Compute MD5 message digest for bytes read from STREAM. The resulting message digest number will be written into the 16 bytes beginning at RESBLOCK. */ int md5_stream (FILE *stream, void *resblock) { size_t sum; unsigned long totalbytes = 0; /* shntool */ /* shntool: */ if (0 == maxbytes) return 0; /* Initialize the computation context. */ /* shntool: now done outside of this function */ /* md5_init_ctx (&md5_global_ctx); */ /* Iterate over full file contents. */ /* shntool: stop after WAVE data is read */ while (1) { /* We read the file in blocks of BLOCKSIZE bytes. One call of the computation function processes the whole buffer so that with the next round of the loop another block can be read. */ size_t n; sum = 0; /* Read block. Take care for partial reads. */ while (1) { n = read_n_bytes(stream, (unsigned char *)(global_buffer + sum), BLOCKSIZE - sum, &proginfo); sum += n; totalbytes += n; /* shntool */ /* shntool: if total bytes read exceeded the WAVE data size, discard the rest and adjust sum */ if (totalbytes > maxbytes) { sum -= (totalbytes - maxbytes); totalbytes = maxbytes; } if (sum == BLOCKSIZE) break; if (n == 0) { /* Check for the error flag IFF N == 0, so that we don't exit the loop after a partial read due to e.g., EAGAIN or EWOULDBLOCK. */ if (ferror (stream)) return 1; goto md5_process_partial_block; } /* We've read at least one byte, so ignore errors. But always check for EOF, since feof may be true even though N > 0. Otherwise, we could end up calling fread after EOF. */ if (feof (stream)) goto md5_process_partial_block; } /* Process buffer with BLOCKSIZE bytes. Note that BLOCKSIZE % 64 == 0 */ md5_process_block (global_buffer, BLOCKSIZE, &md5_global_ctx); } md5_process_partial_block:; /* Process any remaining bytes. */ /* shntool: now done outside this function */ /* if (sum > 0) md5_process_bytes (global_buffer, sum, &md5_global_ctx); */ /* shntool: keep track of partial blocks */ remaining_bytes = sum; /* Construct result in desired memory. */ /* shntool: now done outside this function */ /* md5_finish_ctx (&md5_global_ctx, resblock); */ /* shntool: use custom return code */ /* return 0; */ return (totalbytes == maxbytes) ? 0 : 2; } /* Compute MD5 message digest for LEN bytes beginning at BUFFER. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. */ void * md5_buffer (const char *buffer, size_t len, void *resblock) { struct md5_ctx ctx; /* Initialize the computation context. */ md5_init_ctx (&ctx); /* Process whole buffer but last len % 64 bytes. */ md5_process_bytes (buffer, len, &ctx); /* Put result in desired memory area. */ return md5_finish_ctx (&ctx, resblock); } void md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx) { /* When we already have some bits in our internal buffer concatenate both inputs first. */ if (ctx->buflen != 0) { size_t left_over = ctx->buflen; size_t add = 128 - left_over > len ? len : 128 - left_over; memcpy (&ctx->buffer[left_over], buffer, add); ctx->buflen += add; if (ctx->buflen > 64) { md5_process_block (ctx->buffer, ctx->buflen & ~63, ctx); ctx->buflen &= 63; /* The regions in the following copy operation cannot overlap. */ memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63], ctx->buflen); } buffer = (const char *) buffer + add; len -= add; } /* Process available complete blocks. */ if (len >= 64) { #if !_STRING_ARCH_unaligned # define alignof(type) offsetof (struct { char c; type x; }, x) # define UNALIGNED_P(p) (((size_t) p) % alignof (md5_uint32) != 0) if (UNALIGNED_P (buffer)) while (len > 64) { md5_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx); buffer = (const char *) buffer + 64; len -= 64; } else #endif { md5_process_block (buffer, len & ~63, ctx); buffer = (const char *) buffer + (len & ~63); len &= 63; } } /* Move remaining bytes in internal buffer. */ if (len > 0) { size_t left_over = ctx->buflen; memcpy (&ctx->buffer[left_over], buffer, len); left_over += len; if (left_over >= 64) { md5_process_block (ctx->buffer, 64, ctx); left_over -= 64; memcpy (ctx->buffer, &ctx->buffer[64], left_over); } ctx->buflen = left_over; } } /* These are the four functions used in the four steps of the MD5 algorithm and defined in the RFC 1321. The first function is a little bit optimized (as found in Colin Plumbs public domain implementation). */ /* #define FF(b, c, d) ((b & c) | (~b & d)) */ #define FF(b, c, d) (d ^ (b & (c ^ d))) #define FG(b, c, d) FF (d, b, c) #define FH(b, c, d) (b ^ c ^ d) #define FI(b, c, d) (c ^ (b | ~d)) /* Process LEN bytes of BUFFER, accumulating context into CTX. It is assumed that LEN % 64 == 0. */ void md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx) { md5_uint32 correct_words[16]; const md5_uint32 *words = buffer; size_t nwords = len / sizeof (md5_uint32); const md5_uint32 *endp = words + nwords; md5_uint32 A = ctx->A; md5_uint32 B = ctx->B; md5_uint32 C = ctx->C; md5_uint32 D = ctx->D; /* First increment the byte count. RFC 1321 specifies the possible length of the file up to 2^64 bits. Here we only compute the number of bytes. Do a double word increment. */ ctx->total[0] += len; if (ctx->total[0] < len) ++ctx->total[1]; /* Process all bytes in the buffer with 64 bytes in each round of the loop. */ while (words < endp) { md5_uint32 *cwp = correct_words; md5_uint32 A_save = A; md5_uint32 B_save = B; md5_uint32 C_save = C; md5_uint32 D_save = D; /* First round: using the given function, the context and a constant the next context is computed. Because the algorithms processing unit is a 32-bit word and it is determined to work on words in little endian byte order we perhaps have to change the byte order before the computation. To reduce the work for the next steps we store the swapped words in the array CORRECT_WORDS. */ #define OP(a, b, c, d, s, T) \ do \ { \ a += FF (b, c, d) + (*cwp++ = SWAP_MD5 (*words)) + T; \ ++words; \ CYCLIC (a, s); \ a += b; \ } \ while (0) /* It is unfortunate that C does not provide an operator for cyclic rotation. Hope the C compiler is smart enough. */ #define CYCLIC(w, s) (w = (w << s) | (w >> (32 - s))) /* Before we start, one word to the strange constants. They are defined in RFC 1321 as T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64 Here is an equivalent invocation using Perl: perl -e 'foreach(1..64){printf "0x%08x\n", int (4294967296 * abs (sin $_))}' */ /* Round 1. */ OP (A, B, C, D, 7, 0xd76aa478); OP (D, A, B, C, 12, 0xe8c7b756); OP (C, D, A, B, 17, 0x242070db); OP (B, C, D, A, 22, 0xc1bdceee); OP (A, B, C, D, 7, 0xf57c0faf); OP (D, A, B, C, 12, 0x4787c62a); OP (C, D, A, B, 17, 0xa8304613); OP (B, C, D, A, 22, 0xfd469501); OP (A, B, C, D, 7, 0x698098d8); OP (D, A, B, C, 12, 0x8b44f7af); OP (C, D, A, B, 17, 0xffff5bb1); OP (B, C, D, A, 22, 0x895cd7be); OP (A, B, C, D, 7, 0x6b901122); OP (D, A, B, C, 12, 0xfd987193); OP (C, D, A, B, 17, 0xa679438e); OP (B, C, D, A, 22, 0x49b40821); /* For the second to fourth round we have the possibly swapped words in CORRECT_WORDS. Redefine the macro to take an additional first argument specifying the function to use. */ #undef OP #define OP(f, a, b, c, d, k, s, T) \ do \ { \ a += f (b, c, d) + correct_words[k] + T; \ CYCLIC (a, s); \ a += b; \ } \ while (0) /* Round 2. */ OP (FG, A, B, C, D, 1, 5, 0xf61e2562); OP (FG, D, A, B, C, 6, 9, 0xc040b340); OP (FG, C, D, A, B, 11, 14, 0x265e5a51); OP (FG, B, C, D, A, 0, 20, 0xe9b6c7aa); OP (FG, A, B, C, D, 5, 5, 0xd62f105d); OP (FG, D, A, B, C, 10, 9, 0x02441453); OP (FG, C, D, A, B, 15, 14, 0xd8a1e681); OP (FG, B, C, D, A, 4, 20, 0xe7d3fbc8); OP (FG, A, B, C, D, 9, 5, 0x21e1cde6); OP (FG, D, A, B, C, 14, 9, 0xc33707d6); OP (FG, C, D, A, B, 3, 14, 0xf4d50d87); OP (FG, B, C, D, A, 8, 20, 0x455a14ed); OP (FG, A, B, C, D, 13, 5, 0xa9e3e905); OP (FG, D, A, B, C, 2, 9, 0xfcefa3f8); OP (FG, C, D, A, B, 7, 14, 0x676f02d9); OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a); /* Round 3. */ OP (FH, A, B, C, D, 5, 4, 0xfffa3942); OP (FH, D, A, B, C, 8, 11, 0x8771f681); OP (FH, C, D, A, B, 11, 16, 0x6d9d6122); OP (FH, B, C, D, A, 14, 23, 0xfde5380c); OP (FH, A, B, C, D, 1, 4, 0xa4beea44); OP (FH, D, A, B, C, 4, 11, 0x4bdecfa9); OP (FH, C, D, A, B, 7, 16, 0xf6bb4b60); OP (FH, B, C, D, A, 10, 23, 0xbebfbc70); OP (FH, A, B, C, D, 13, 4, 0x289b7ec6); OP (FH, D, A, B, C, 0, 11, 0xeaa127fa); OP (FH, C, D, A, B, 3, 16, 0xd4ef3085); OP (FH, B, C, D, A, 6, 23, 0x04881d05); OP (FH, A, B, C, D, 9, 4, 0xd9d4d039); OP (FH, D, A, B, C, 12, 11, 0xe6db99e5); OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8); OP (FH, B, C, D, A, 2, 23, 0xc4ac5665); /* Round 4. */ OP (FI, A, B, C, D, 0, 6, 0xf4292244); OP (FI, D, A, B, C, 7, 10, 0x432aff97); OP (FI, C, D, A, B, 14, 15, 0xab9423a7); OP (FI, B, C, D, A, 5, 21, 0xfc93a039); OP (FI, A, B, C, D, 12, 6, 0x655b59c3); OP (FI, D, A, B, C, 3, 10, 0x8f0ccc92); OP (FI, C, D, A, B, 10, 15, 0xffeff47d); OP (FI, B, C, D, A, 1, 21, 0x85845dd1); OP (FI, A, B, C, D, 8, 6, 0x6fa87e4f); OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0); OP (FI, C, D, A, B, 6, 15, 0xa3014314); OP (FI, B, C, D, A, 13, 21, 0x4e0811a1); OP (FI, A, B, C, D, 4, 6, 0xf7537e82); OP (FI, D, A, B, C, 11, 10, 0xbd3af235); OP (FI, C, D, A, B, 2, 15, 0x2ad7d2bb); OP (FI, B, C, D, A, 9, 21, 0xeb86d391); /* Add the starting values of the context. */ A += A_save; B += B_save; C += C_save; D += D_save; } /* Put checksum in context given as argument. */ ctx->A = A; ctx->B = B; ctx->C = C; ctx->D = D; } /* sha1.c - Functions to compute SHA1 message digest of files or memory blocks according to the NIST specification FIPS-180-1. Copyright (C) 2000, 2001, 2003, 2004, 2005 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by Scott G. Miller Credits: Robert Klep -- Expansion function fix */ #include "sha1.h" /* shntool: global sha1 context */ struct sha1_ctx sha1_global_ctx; /* Takes a pointer to a 160 bit block of data (five 32 bit ints) and intializes it to the start constants of the SHA1 algorithm. This must be called before using hash in the call to sha1_hash. */ void sha1_init_ctx (struct sha1_ctx *ctx) { int i; ctx->A = 0x67452301; ctx->B = 0xefcdab89; ctx->C = 0x98badcfe; ctx->D = 0x10325476; ctx->E = 0xc3d2e1f0; ctx->total[0] = ctx->total[1] = 0; ctx->buflen = 0; for (i=0;i<128;i++) ctx->buffer[i] = '\0'; } /* Put result from CTX in first 20 bytes following RESBUF. The result must be in little endian byte order. IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ void * sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf) { ((md5_uint32 *) resbuf)[0] = SWAP_SHA1 (ctx->A); ((md5_uint32 *) resbuf)[1] = SWAP_SHA1 (ctx->B); ((md5_uint32 *) resbuf)[2] = SWAP_SHA1 (ctx->C); ((md5_uint32 *) resbuf)[3] = SWAP_SHA1 (ctx->D); ((md5_uint32 *) resbuf)[4] = SWAP_SHA1 (ctx->E); return resbuf; } /* Process the remaining bytes in the internal buffer and the usual prolog according to the standard and write the result to RESBUF. IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ void * sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf) { /* Take yet unprocessed bytes into account. */ md5_uint32 bytes = ctx->buflen; size_t pad; /* Now count remaining bytes. */ ctx->total[0] += bytes; if (ctx->total[0] < bytes) ++ctx->total[1]; pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes; memcpy (&ctx->buffer[bytes], fillbuf, pad); /* Put the 64-bit file length in *bits* at the end of the buffer. */ *(md5_uint32 *) &ctx->buffer[bytes + pad + 4] = SWAP_SHA1 (ctx->total[0] << 3); *(md5_uint32 *) &ctx->buffer[bytes + pad] = SWAP_SHA1 ((ctx->total[1] << 3) | (ctx->total[0] >> 29)); /* Process last bytes. */ sha1_process_block (ctx->buffer, bytes + pad + 8, ctx); return sha1_read_ctx (ctx, resbuf); } /* Compute SHA1 message digest for bytes read from STREAM. The resulting message digest number will be written into the 16 bytes beginning at RESBLOCK. */ int sha1_stream (FILE *stream, void *resblock) { size_t sum; unsigned long totalbytes = 0; /* shntool */ /* shntool: */ if (0 == maxbytes) return 0; /* Initialize the computation context. */ /* shntool: now done outside of this function */ /* sha1_init_ctx (&sha1_global_ctx); */ /* Iterate over full file contents. */ /* shntool: stop after WAVE data is read */ while (1) { /* We read the file in blocks of BLOCKSIZE bytes. One call of the computation function processes the whole buffer so that with the next round of the loop another block can be read. */ size_t n; sum = 0; /* Read block. Take care for partial reads. */ while (1) { n = read_n_bytes(stream, (unsigned char *)(global_buffer + sum), BLOCKSIZE - sum, &proginfo); sum += n; totalbytes += n; /* shntool */ /* shntool: if total bytes read exceeded the WAVE data size, discard the rest and adjust sum */ if (totalbytes > maxbytes) { sum -= (totalbytes - maxbytes); totalbytes = maxbytes; } if (sum == BLOCKSIZE) break; if (n == 0) { /* Check for the error flag IFF N == 0, so that we don't exit the loop after a partial read due to e.g., EAGAIN or EWOULDBLOCK. */ if (ferror (stream)) return 1; goto sha1_process_partial_block; } /* We've read at least one byte, so ignore errors. But always check for EOF, since feof may be true even though N > 0. Otherwise, we could end up calling fread after EOF. */ if (feof (stream)) goto sha1_process_partial_block; } /* Process buffer with BLOCKSIZE bytes. Note that BLOCKSIZE % 64 == 0 */ sha1_process_block (global_buffer, BLOCKSIZE, &sha1_global_ctx); } sha1_process_partial_block:; /* Process any remaining bytes. */ /* shntool: now done outside this function */ /* if (sum > 0) sha1_process_bytes (global_buffer, sum, &sha1_global_ctx); */ /* shntool: keep track of partial blocks */ remaining_bytes = sum; /* Construct result in desired memory. */ /* shntool: now done outside this function */ /* sha1_finish_ctx (&sha1_global_ctx, resblock); */ /* shntool: use custom return code */ /* return 0; */ return (totalbytes == maxbytes) ? 0 : 2; } /* Compute MD5 message digest for LEN bytes beginning at BUFFER. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. */ void * sha1_buffer (const char *buffer, size_t len, void *resblock) { struct sha1_ctx ctx; /* Initialize the computation context. */ sha1_init_ctx (&ctx); /* Process whole buffer but last len % 64 bytes. */ sha1_process_bytes (buffer, len, &ctx); /* Put result in desired memory area. */ return sha1_finish_ctx (&ctx, resblock); } void sha1_process_bytes (const void *buffer, size_t len, struct sha1_ctx *ctx) { /* When we already have some bits in our internal buffer concatenate both inputs first. */ if (ctx->buflen != 0) { size_t left_over = ctx->buflen; size_t add = 128 - left_over > len ? len : 128 - left_over; memcpy (&ctx->buffer[left_over], buffer, add); ctx->buflen += add; if (ctx->buflen > 64) { sha1_process_block (ctx->buffer, ctx->buflen & ~63, ctx); ctx->buflen &= 63; /* The regions in the following copy operation cannot overlap. */ memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63], ctx->buflen); } buffer = (const char *) buffer + add; len -= add; } /* Process available complete blocks. */ if (len >= 64) { #if !_STRING_ARCH_unaligned # define alignof(type) offsetof (struct { char c; type x; }, x) # define UNALIGNED_P(p) (((size_t) p) % alignof (md5_uint32) != 0) if (UNALIGNED_P (buffer)) while (len > 64) { sha1_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx); buffer = (const char *) buffer + 64; len -= 64; } else #endif { sha1_process_block (buffer, len & ~63, ctx); buffer = (const char *) buffer + (len & ~63); len &= 63; } } /* Move remaining bytes in internal buffer. */ if (len > 0) { size_t left_over = ctx->buflen; memcpy (&ctx->buffer[left_over], buffer, len); left_over += len; if (left_over >= 64) { sha1_process_block (ctx->buffer, 64, ctx); left_over -= 64; memcpy (ctx->buffer, &ctx->buffer[64], left_over); } ctx->buflen = left_over; } } /* --- Code below is the primary difference between md5.c and sha1.c --- */ /* SHA1 round constants */ #define K1 0x5a827999L #define K2 0x6ed9eba1L #define K3 0x8f1bbcdcL #define K4 0xca62c1d6L /* Round functions. Note that F2 is the same as F4. */ #define F1(B,C,D) ( D ^ ( B & ( C ^ D ) ) ) #define F2(B,C,D) (B ^ C ^ D) #define F3(B,C,D) ( ( B & C ) | ( D & ( B | C ) ) ) #define F4(B,C,D) (B ^ C ^ D) /* Process LEN bytes of BUFFER, accumulating context into CTX. It is assumed that LEN % 64 == 0. Most of this code comes from GnuPG's cipher/sha1.c. */ void sha1_process_block (const void *buffer, size_t len, struct sha1_ctx *ctx) { const md5_uint32 *words = buffer; size_t nwords = len / sizeof (md5_uint32); const md5_uint32 *endp = words + nwords; md5_uint32 x[16]; md5_uint32 a = ctx->A; md5_uint32 b = ctx->B; md5_uint32 c = ctx->C; md5_uint32 d = ctx->D; md5_uint32 e = ctx->E; /* First increment the byte count. RFC 1321 specifies the possible length of the file up to 2^64 bits. Here we only compute the number of bytes. Do a double word increment. */ ctx->total[0] += len; if (ctx->total[0] < len) ++ctx->total[1]; #define rol(x, n) (((x) << (n)) | ((x) >> (32 - (n)))) #define M(I) ( tm = x[I&0x0f] ^ x[(I-14)&0x0f] \ ^ x[(I-8)&0x0f] ^ x[(I-3)&0x0f] \ , (x[I&0x0f] = rol(tm, 1)) ) #define R(A,B,C,D,E,F,K,M) do { E += rol( A, 5 ) \ + F( B, C, D ) \ + K \ + M; \ B = rol( B, 30 ); \ } while(0) while (words < endp) { md5_uint32 tm; int t; for (t = 0; t < 16; t++) { x[t] = SWAP_SHA1 (*words); words++; } R( a, b, c, d, e, F1, K1, x[ 0] ); R( e, a, b, c, d, F1, K1, x[ 1] ); R( d, e, a, b, c, F1, K1, x[ 2] ); R( c, d, e, a, b, F1, K1, x[ 3] ); R( b, c, d, e, a, F1, K1, x[ 4] ); R( a, b, c, d, e, F1, K1, x[ 5] ); R( e, a, b, c, d, F1, K1, x[ 6] ); R( d, e, a, b, c, F1, K1, x[ 7] ); R( c, d, e, a, b, F1, K1, x[ 8] ); R( b, c, d, e, a, F1, K1, x[ 9] ); R( a, b, c, d, e, F1, K1, x[10] ); R( e, a, b, c, d, F1, K1, x[11] ); R( d, e, a, b, c, F1, K1, x[12] ); R( c, d, e, a, b, F1, K1, x[13] ); R( b, c, d, e, a, F1, K1, x[14] ); R( a, b, c, d, e, F1, K1, x[15] ); R( e, a, b, c, d, F1, K1, M(16) ); R( d, e, a, b, c, F1, K1, M(17) ); R( c, d, e, a, b, F1, K1, M(18) ); R( b, c, d, e, a, F1, K1, M(19) ); R( a, b, c, d, e, F2, K2, M(20) ); R( e, a, b, c, d, F2, K2, M(21) ); R( d, e, a, b, c, F2, K2, M(22) ); R( c, d, e, a, b, F2, K2, M(23) ); R( b, c, d, e, a, F2, K2, M(24) ); R( a, b, c, d, e, F2, K2, M(25) ); R( e, a, b, c, d, F2, K2, M(26) ); R( d, e, a, b, c, F2, K2, M(27) ); R( c, d, e, a, b, F2, K2, M(28) ); R( b, c, d, e, a, F2, K2, M(29) ); R( a, b, c, d, e, F2, K2, M(30) ); R( e, a, b, c, d, F2, K2, M(31) ); R( d, e, a, b, c, F2, K2, M(32) ); R( c, d, e, a, b, F2, K2, M(33) ); R( b, c, d, e, a, F2, K2, M(34) ); R( a, b, c, d, e, F2, K2, M(35) ); R( e, a, b, c, d, F2, K2, M(36) ); R( d, e, a, b, c, F2, K2, M(37) ); R( c, d, e, a, b, F2, K2, M(38) ); R( b, c, d, e, a, F2, K2, M(39) ); R( a, b, c, d, e, F3, K3, M(40) ); R( e, a, b, c, d, F3, K3, M(41) ); R( d, e, a, b, c, F3, K3, M(42) ); R( c, d, e, a, b, F3, K3, M(43) ); R( b, c, d, e, a, F3, K3, M(44) ); R( a, b, c, d, e, F3, K3, M(45) ); R( e, a, b, c, d, F3, K3, M(46) ); R( d, e, a, b, c, F3, K3, M(47) ); R( c, d, e, a, b, F3, K3, M(48) ); R( b, c, d, e, a, F3, K3, M(49) ); R( a, b, c, d, e, F3, K3, M(50) ); R( e, a, b, c, d, F3, K3, M(51) ); R( d, e, a, b, c, F3, K3, M(52) ); R( c, d, e, a, b, F3, K3, M(53) ); R( b, c, d, e, a, F3, K3, M(54) ); R( a, b, c, d, e, F3, K3, M(55) ); R( e, a, b, c, d, F3, K3, M(56) ); R( d, e, a, b, c, F3, K3, M(57) ); R( c, d, e, a, b, F3, K3, M(58) ); R( b, c, d, e, a, F3, K3, M(59) ); R( a, b, c, d, e, F4, K4, M(60) ); R( e, a, b, c, d, F4, K4, M(61) ); R( d, e, a, b, c, F4, K4, M(62) ); R( c, d, e, a, b, F4, K4, M(63) ); R( b, c, d, e, a, F4, K4, M(64) ); R( a, b, c, d, e, F4, K4, M(65) ); R( e, a, b, c, d, F4, K4, M(66) ); R( d, e, a, b, c, F4, K4, M(67) ); R( c, d, e, a, b, F4, K4, M(68) ); R( b, c, d, e, a, F4, K4, M(69) ); R( a, b, c, d, e, F4, K4, M(70) ); R( e, a, b, c, d, F4, K4, M(71) ); R( d, e, a, b, c, F4, K4, M(72) ); R( c, d, e, a, b, F4, K4, M(73) ); R( b, c, d, e, a, F4, K4, M(74) ); R( a, b, c, d, e, F4, K4, M(75) ); R( e, a, b, c, d, F4, K4, M(76) ); R( d, e, a, b, c, F4, K4, M(77) ); R( c, d, e, a, b, F4, K4, M(78) ); R( b, c, d, e, a, F4, K4, M(79) ); a = ctx->A += a; b = ctx->B += b; c = ctx->C += c; d = ctx->D += d; e = ctx->E += e; } } /* shntool-specific stuff starts here */ static void hash_help() { st_info("Usage: %s [OPTIONS] [files]\n",st_progname()); st_info("\n"); st_info("Mode-specific options:\n"); st_info("\n"); st_info(" -c generate composite fingerprint from input files\n"); st_info(" -h show this help screen\n"); st_info(" -m generate MD5 fingerprints (default)\n"); st_info(" -s generate SHA1 fingerprints\n"); st_info("\n"); } static void parse(int argc,char **argv,int *first_arg) { int c; while ((c = st_getopt(argc,argv,"cms")) != -1) { switch (c) { case 'c': composite_hash = TRUE; break; case 'm': hash_algorithm = HASH_MD5; break; case 's': hash_algorithm = HASH_SHA1; break; } } *first_arg = optind; } void hash_init_ctx() { switch (hash_algorithm) { case HASH_MD5: md5_init_ctx(&md5_global_ctx); break; case HASH_SHA1: sha1_init_ctx(&sha1_global_ctx); break; } } int hash_stream(FILE *stream) { switch (hash_algorithm) { case HASH_MD5: return md5_stream(stream,audio_hash); break; case HASH_SHA1: return sha1_stream(stream,audio_hash); break; } return 3; } void hash_process_bytes() { switch (hash_algorithm) { case HASH_MD5: md5_process_bytes(global_buffer,remaining_bytes,&md5_global_ctx); break; case HASH_SHA1: sha1_process_bytes(global_buffer,remaining_bytes,&sha1_global_ctx); break; } } void hash_finish_ctx() { switch (hash_algorithm) { case HASH_MD5: md5_finish_ctx(&md5_global_ctx,audio_hash); break; case HASH_SHA1: sha1_finish_ctx(&sha1_global_ctx,audio_hash); break; } } void hash_process_block() { switch (hash_algorithm) { case HASH_MD5: md5_process_block(global_buffer,BLOCKSIZE,&md5_global_ctx); break; case HASH_SHA1: sha1_process_block(global_buffer,BLOCKSIZE,&sha1_global_ctx); break; } } static void print_audio_hash(char *filename) { int i,hash_hex_bytes = 0; switch (hash_algorithm) { case HASH_MD5: hash_hex_bytes = 32; break; case HASH_SHA1: hash_hex_bytes = 40; break; } for (i=0;i<(hash_hex_bytes/2);i++) st_output("%02x",audio_hash[i]); st_output(" [shntool] %s\n",filename); } static bool generate_audio_hash_single(wave_info *info) { unsigned char *header; int retval; bool success; success = FALSE; proginfo.initialized = FALSE; proginfo.filename2 = info->filename; proginfo.filedesc2 = info->m_ss; proginfo.bytes_total = info->data_size; prog_update(&proginfo); if (!open_input_stream(info)) { st_warning("could not reopen input file: [%s]",info->filename); return FALSE; } if (NULL == (header = malloc(info->header_size * sizeof(unsigned char)))) { prog_error(&proginfo); st_warning("could not allocate %d-byte WAVE header",info->header_size); goto cleanup_single1; } if (read_n_bytes(info->input,header,info->header_size,NULL) != info->header_size) { prog_error(&proginfo); st_warning("error while discarding %d-byte WAVE header from file: [%s]",info->header_size,info->filename); goto cleanup_single2; } maxbytes = info->data_size; remaining_bytes = 0; /* Initialize the computation context. */ hash_init_ctx(); retval = hash_stream(info->input); /* Add the last bytes if necessary. */ if (remaining_bytes > 0) hash_process_bytes(); /* Construct result in desired memory. */ hash_finish_ctx(); if (retval) { prog_error(&proginfo); st_warning("possibly truncated and/or corrupt file: [%s]",info->filename); goto cleanup_single2; } success = TRUE; prog_success(&proginfo); print_audio_hash(info->filename); cleanup_single2: st_free(header); cleanup_single1: close_input_stream(info); return success; } static bool generate_audio_hash_composite(wave_info *info) { unsigned char *header; int retval,bytes_to_read; bool success; success = FALSE; if (!open_input_stream(info)) st_error("could not reopen input file: [%s]",info->filename); if (NULL == (header = malloc(info->header_size * sizeof(unsigned char)))) st_error("could not allocate %d-byte WAVE header",info->header_size); if (read_n_bytes(info->input,header,info->header_size,NULL) != info->header_size) st_error("error while discarding %d-byte WAVE header from file: [%s]",info->header_size,info->filename); bytes_to_read = 0; /* in order to generate the correct MD5/SHA1 signature, all data (modulus the * final bytes) must be processed in blocks. if the previous file left * extra bytes that didn't fill out a full block, then try to read enough * from this file to fill it out and process it. */ if (remaining_bytes > 0) { bytes_to_read = min(info->data_size,BLOCKSIZE - remaining_bytes); if (read_n_bytes(info->input,(unsigned char *)(global_buffer + remaining_bytes),bytes_to_read,NULL) != bytes_to_read) st_error("error while filling out block with data from file: [%s]",info->filename); remaining_bytes += bytes_to_read; if (BLOCKSIZE == remaining_bytes) { hash_process_block(); remaining_bytes = 0; } } maxbytes = info->data_size - bytes_to_read; retval = hash_stream(info->input); if (retval) st_error("possibly truncated and/or corrupt file: [%s]",info->filename); success = TRUE; st_free(header); close_input_stream(info); return success; } static bool process_file(char *filename) { wave_info *info; bool success; if (NULL == (info = new_wave_info(filename))) { if (composite_hash) st_error("all files must be valid to generate a composite fingerprint"); return FALSE; } if (composite_hash) success = generate_audio_hash_composite(info); else success = generate_audio_hash_single(info); num_processed++; st_free(info); return success; } static void composite_init(wlong total) { if (!composite_hash) return; /* Initialize the computation context. */ hash_init_ctx(); remaining_bytes = 0; proginfo.initialized = FALSE; proginfo.filename2 = COMPOSITE; proginfo.filedesc2 = NULL; proginfo.bytes_total = total; prog_update(&proginfo); } static void composite_finish() { if (!composite_hash) return; if (0 == num_processed) st_error("need at least one valid file to process"); /* Add the last bytes if necessary. */ if (remaining_bytes > 0) hash_process_bytes(); /* Construct result in desired memory. */ hash_finish_ctx(); prog_success(&proginfo); print_audio_hash(COMPOSITE); } static bool process(int argc,char **argv,int start) { int i,j = 0,badfiles = 0; char *filename; wlong total = 0; bool success; success = TRUE; input_init(start,argc,argv); input_read_all_files(); numfiles = input_get_file_count(); if (NULL == (files = malloc((numfiles + 1) * sizeof(wave_info *)))) st_error("could not allocate memory for file info array"); for (i=0;idata_size; j++; } } numfiles -= badfiles; files[numfiles] = NULL; reorder_files(files,numfiles); proginfo.prefix = "Hashing"; proginfo.clause = NULL; proginfo.filename1 = NULL; proginfo.filedesc1 = NULL; composite_init(total); input_init(start,argc,argv); while ((filename = input_get_filename())) { success = (process_file(filename) && success); } composite_finish(); for (i=0;i * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mode.h" CVSID("$Id: mode_strip.c,v 1.105 2009/03/17 17:23:05 jason Exp $") static bool strip_main(int,char **); static void strip_help(void); mode_module mode_strip = { "strip", "shnstrip", "Strips extra RIFF chunks and/or writes canonical headers", CVSIDSTR, TRUE, strip_main, strip_help }; #define STRIP_POSTFIX "-stripped" static bool strip_header = TRUE; static bool strip_chunks = TRUE; static void strip_help() { st_info("Usage: %s [OPTIONS] [files]\n",st_progname()); st_info("\n"); st_info("Mode-specific options:\n"); st_info("\n"); st_info(" -c don't strip unnecessary RIFF chunks\n"); st_info(" -e don't rewrite WAVE header in canonical format\n"); st_info(" -h show this help screen\n"); st_info("\n"); } static void parse(int argc,char **argv,int *first_arg) { int c; st_ops.output_directory = INPUT_FILE_DIR; st_ops.output_postfix = STRIP_POSTFIX; while ((c = st_getopt(argc,argv,"ce")) != -1) { switch (c) { case 'c': strip_chunks = FALSE; break; case 'e': strip_header = FALSE; break; } } if (!strip_header && !strip_chunks) st_help("nothing to do if not stripping headers or RIFF chunks\n"); *first_arg = optind; } static bool strip_and_canonicize(wave_info *info) { wint new_header_size; wlong new_chunk_size; unsigned char *header = NULL; char outfilename[FILENAME_SIZE]; FILE *output = NULL; proc_info output_proc; long possible_extra_stuff; bool has_null_pad,success; progress_info proginfo; success = FALSE; create_output_filename(info->filename,info->input_format->extension,outfilename); proginfo.initialized = FALSE; proginfo.prefix = "Stripping"; proginfo.clause = "-->"; proginfo.filename1 = info->filename; proginfo.filedesc1 = info->m_ss; proginfo.filename2 = outfilename; proginfo.filedesc2 = NULL; proginfo.bytes_total = info->total_size; prog_update(&proginfo); if (PROB_HDR_INCONSISTENT(info)) { prog_error(&proginfo); st_warning("file has an inconsistent header -- skipping."); return FALSE; } if (PROB_TRUNCATED(info)) { prog_error(&proginfo); st_warning("file seems to be truncated -- skipping."); return FALSE; } if (strip_header && strip_chunks && !PROB_EXTRA_CHUNKS(info) && !PROB_HDR_NOT_CANONICAL(info)) { prog_error(&proginfo); st_warning("file already has a canonical header and no extra RIFF chunks -- skipping."); return FALSE; } if (strip_chunks && !strip_header && !PROB_EXTRA_CHUNKS(info)) { prog_error(&proginfo); st_warning("file already has no extra RIFF chunks -- skipping."); return FALSE; } if (strip_header && !strip_chunks && !PROB_HDR_NOT_CANONICAL(info)) { prog_error(&proginfo); st_warning("file already has a canonical header -- skipping."); return FALSE; } if (files_are_identical(info->filename,outfilename)) { prog_error(&proginfo); st_warning("output file would overwrite input file -- skipping."); return FALSE; } has_null_pad = odd_sized_data_chunk_is_null_padded(info); if (!has_null_pad) info->extra_riff_size++; new_header_size = info->header_size; possible_extra_stuff = (info->extra_riff_size > 0) ? info->extra_riff_size : 0; if (strip_header) new_header_size = CANONICAL_HEADER_SIZE; if (strip_chunks) possible_extra_stuff = 0; new_chunk_size = info->chunk_size - (info->header_size - new_header_size) - (info->extra_riff_size - possible_extra_stuff); if (!open_input_stream(info)) { prog_error(&proginfo); st_warning("could not reopen input file -- skipping."); return FALSE; } if (NULL == (output = open_output_stream(outfilename,&output_proc))) { prog_error(&proginfo); st_warning("could not open output file -- skipping."); goto cleanup; } if (NULL == (header = malloc(info->header_size * sizeof(unsigned char)))) { prog_error(&proginfo); st_warning("could not allocate %d-byte WAVE header -- skipping.",info->header_size); goto cleanup; } if (read_n_bytes(info->input,header,info->header_size,NULL) != info->header_size) { prog_error(&proginfo); st_warning("error while reading %d bytes of data -- skipping.",info->header_size); goto cleanup; } /* already read in header, now check to see if we need to overwrite that with a canonical one */ if (strip_header) make_canonical_header(header,info); put_chunk_size(header,new_chunk_size); if (write_n_bytes(output,header,new_header_size,NULL) != new_header_size) { prog_error(&proginfo); st_warning("error while writing %d bytes of data -- skipping.",new_header_size); goto cleanup; } if (transfer_n_bytes(info->input,output,info->data_size,NULL) != info->data_size) { prog_error(&proginfo); st_warning("error while transferring %lu bytes of data -- skipping.",info->data_size); goto cleanup; } if (PROB_ODD_SIZED_DATA(info) && has_null_pad && (1 != transfer_n_bytes(info->input,output,1,NULL))) { prog_error(&proginfo); st_warning("error while transferring NULL pad byte -- skipping."); goto cleanup; } if ((possible_extra_stuff > 0) && (transfer_n_bytes(info->input,output,possible_extra_stuff,NULL) != possible_extra_stuff)) { prog_error(&proginfo); st_warning("error while transferring %lu extra bytes -- skipping.",possible_extra_stuff); goto cleanup; } success = TRUE; prog_success(&proginfo); cleanup: st_free(header); if ((output) && ((CLOSE_CHILD_ERROR_OUTPUT == close_output(output,output_proc)) || !success)) { success = FALSE; remove_file(outfilename); } close_input_stream(info); return success; } static bool process_file(char *filename) { wave_info *info; bool success; if (NULL == (info = new_wave_info(filename))) return FALSE; success = strip_and_canonicize(info); st_free(info); return success; } static bool process(int argc,char **argv,int start) { char *filename; bool success; success = TRUE; input_init(start,argc,argv); while ((filename = input_get_filename())) { success = (process_file(filename) && success); } return success; } static bool strip_main(int argc,char **argv) { int first_arg; parse(argc,argv,&first_arg); return process(argc,argv,first_arg); } shntool-3.0.10/src/Makefile.am0000644000077100007710000000270210756410262013035 00000000000000CORE_SOURCES = core_convert.c core_fileio.c core_format.c core_mode.c core_module.c core_output.c core_shntool.c core_wave.c GLUE_SOURCES = glue_modes.c glue_formats.c MODE_SOURCES_ALL = mode_cat.c mode_cmp.c mode_conv.c mode_cue.c mode_fix.c mode_gen.c mode_hash.c mode_info.c mode_join.c mode_len.c mode_pad.c mode_split.c mode_strip.c mode_trim.c FORMAT_SOURCES_ALL = format_aiff.c format_alac.c format_als.c format_ape.c format_bonk.c format_cust.c format_flac.c format_kxs.c format_la.c format_lpac.c format_mkw.c format_null.c format_ofr.c format_shn.c format_tak.c format_term.c format_tta.c format_wav.c format_wv.c MODE_ALIASES_ALL = $(shell echo $(MODE_SOURCES_ALL) | sed -e 's/mode_//g' -e 's/\.c//g') MODE_ALIASES = @MODES_CONFIGURED@ MODULE_OBJS = @MODE_OBJS@ @FORMAT_OBJS@ bin_PROGRAMS = shntool shntool_SOURCES = $(CORE_SOURCES) EXTRA_shntool_SOURCES = $(MODE_SOURCES_ALL) $(FORMAT_SOURCES_ALL) nodist_shntool_SOURCES = $(GLUE_SOURCES) shntool_LDADD = $(MODULE_OBJS) shntool_DEPENDENCIES = $(MODULE_OBJS) AM_CPPFLAGS = -I$(top_srcdir)/include AM_CFLAGS = -I$(top_srcdir)/include install-exec-hook: for mode_alias in $(MODE_ALIASES_ALL) ; do \ test -e $(DESTDIR)/$(bindir)/shn$$mode_alias && $(RM) $(DESTDIR)/$(bindir)/shn$$mode_alias ; \ done ; \ for mode_alias in $(MODE_ALIASES) ; do \ test -e $(DESTDIR)/$(bindir)/shn$$mode_alias || $(LN_S) $(PACKAGE) $(DESTDIR)/$(bindir)/shn$$mode_alias ; \ done distclean-local: $(RM) $(GLUE_SOURCES) shntool-3.0.10/src/mode_cmp.c0000644000077100007710000002711011157756171012740 00000000000000/* mode_cmp.c - cmp mode module * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mode.h" CVSID("$Id: mode_cmp.c,v 1.91 2009/03/17 17:23:05 jason Exp $") static bool cmp_main(int,char **); static void cmp_help(void); mode_module mode_cmp = { "cmp", "shncmp", "Compares PCM WAVE data in two files", CVSIDSTR, FALSE, cmp_main, cmp_help }; #define CMP_MATCH_SIZE 2352 /* arbitrary number of bytes that must match before attempting to check whether shifted data in the files is identical */ static bool align = FALSE; static bool list = FALSE; static int fuzz = 0; static wlong shift_secs = 3; static void cmp_help() { st_info("Usage: %s [OPTIONS] [file1 file2]\n",st_progname()); st_info("\n"); st_info("Mode-specific options:\n"); st_info("\n"); st_info(" -c secs check the first secs seconds of data for byte shift (default is %d)\n",shift_secs); st_info(" -f fuzz fuzz factor: allow up to fuzz mismatches when detecting a byte-shift\n"); st_info(" -h show this help screen\n"); st_info(" -l list offsets and values of all differing bytes\n"); st_info(" -s check if WAVE data in the files is identical modulo a byte-shift\n"); st_info("\n"); } static void parse(int argc,char **argv,int *first_arg) { int c; while ((c = st_getopt(argc,argv,"c:f:ls")) != -1) { switch (c) { case 'c': if (NULL == optarg) st_help("missing seconds for byte-shift comparison"); shift_secs = atoi(optarg); if (shift_secs <= 0) st_help("seconds for byte-shift comparison must be positive"); break; case 'f': if (NULL == optarg) st_help("missing fuzz factor"); fuzz = atoi(optarg); if (fuzz < 0) st_help("fuzz factor cannot be negative"); break; case 'l': list = TRUE; break; case 's': align = TRUE; break; } } if (fuzz > 0 && !align) st_help("fuzz factor can only be used with byte-shift"); if (optind != argc && optind != argc - 2) st_help("need exactly two files to process"); *first_arg = optind; } static void check_headers(wave_info *info1,wave_info *info2,int shift) { int data_size1,data_size2,real_shift = (shift < 0) ? -shift : shift; data_size1 = info1->data_size; data_size2 = info2->data_size; if (shift > 0) data_size1 -= real_shift; else if (shift < 0) data_size2 -= real_shift; if (info1->wave_format != info2->wave_format) st_error("WAVE format differs between these files"); if (info1->channels != info2->channels) st_error("number of channels differs between these files"); if (info1->samples_per_sec != info2->samples_per_sec) st_error("samples per second differs between these files"); if (info1->avg_bytes_per_sec != info2->avg_bytes_per_sec) st_error("average bytes per second differs between these files"); if (info1->bits_per_sample != info2->bits_per_sample) st_error("bits per sample differs between these files"); if (info1->block_align != info2->block_align) st_warning("block align differs between these files"); if (data_size1 != data_size2) st_warning("WAVE data size differs between these files -- will check up to smaller size"); } static int memfuzzycmp(unsigned char *str1,unsigned char *str2,int len,int fuzz) { int i,firstbad = -1,badcount = 0; for (i=0;i fuzz) return firstbad; } } return -1; } static void open_file(wave_info *info) { if (!open_input_stream(info)) st_error("could not reopen input file: [%s]",info->filename); } static bool cmp_files(wave_info *info1,wave_info *info2,int shift) { unsigned char *buf1,*buf2; wlong bytes_to_check, bytes_checked = 0, bytes, shifted_data_size1 = info1->data_size, shifted_data_size2 = info2->data_size, xfer_size; int offset, real_shift, i; bool differed = FALSE, did_l_header = FALSE, success; progress_info proginfo; success = FALSE; check_headers(info1,info2,shift); proginfo.initialized = FALSE; proginfo.prefix = "Comparing"; proginfo.clause = "and"; proginfo.filename1 = info1->filename; proginfo.filedesc1 = info1->m_ss; proginfo.filename2 = info2->filename; proginfo.filedesc2 = info2->m_ss; proginfo.bytes_total = 1; prog_update(&proginfo); xfer_size = max(XFER_SIZE,(shift_secs * info1->rate)); /* kluge to work around free(buf2) dumping core if malloc()'d separately */ if (NULL == (buf1 = malloc(2 * xfer_size * sizeof(unsigned char)))) { prog_error(&proginfo); st_error("could not allocate %d-byte comparison buffer",xfer_size); } buf2 = buf1 + xfer_size; real_shift = (shift < 0) ? -shift : shift; open_file(info1); open_file(info2); discard_header(info1); discard_header(info2); if (shift > 0) { if (read_n_bytes(info1->input,buf1,real_shift,NULL) != real_shift) { prog_error(&proginfo); st_error("error while shifting %d bytes from file: [%s]",real_shift,info1->filename); } shifted_data_size1 -= real_shift; } else if (shift < 0) { if (read_n_bytes(info2->input,buf2,real_shift,NULL) != real_shift) { prog_error(&proginfo); st_error("error while shifting %d bytes from file: [%s]",real_shift,info2->filename); } shifted_data_size2 -= real_shift; } bytes_to_check = min(shifted_data_size1,shifted_data_size2); proginfo.filedesc1 = info1->m_ss; proginfo.filedesc2 = info2->m_ss; proginfo.bytes_total = bytes_to_check; while (bytes_to_check > 0) { bytes = min(bytes_to_check,xfer_size); if (read_n_bytes(info1->input,buf1,(int)bytes,&proginfo) != (int)bytes) { prog_error(&proginfo); st_error("error while reading %d bytes from file: [%s]",(int)bytes,info1->filename); } if (read_n_bytes(info2->input,buf2,(int)bytes,NULL) != (int)bytes) { prog_error(&proginfo); st_error("error while reading %d bytes from file: [%s]",(int)bytes,info2->filename); } if (-1 != (offset = memfuzzycmp(buf1,buf2,bytes,0))) { differed = TRUE; if (!list) { prog_error(&proginfo); st_error("WAVE data differs at byte offset: %lu",bytes_checked+(wlong)offset+1); } i = 0; while (offset >= 0) { i += offset + 1; if (!did_l_header) { prog_error(&proginfo); st_info("\n"); st_info(" offset 1 2\n"); st_info(" ----------------\n"); did_l_header = TRUE; } st_info("%10ld %3d %3d\n",bytes_checked + i,(int)*(buf1 + i - 1),(int)*(buf2 + i - 1)); offset = memfuzzycmp(buf1 + i,buf2 + i,bytes - i,0); } } bytes_to_check -= bytes; bytes_checked += bytes; } close_input_stream(info1); close_input_stream(info2); if (!differed) { success = TRUE; prog_success(&proginfo); st_info("\n"); st_info("%s of these files are identical",(0 == shift) ? "Contents" : "Aligned contents"); if (shifted_data_size1 != shifted_data_size2) st_info(" (up to the first %lu bytes of WAVE data)",min(shifted_data_size1,shifted_data_size2)); st_info(".\n"); } else { success = FALSE; st_info("\n"); st_info("%s of these files differed as indicated above.\n",(0 == shift) ? "Contents" : "Aligned contents"); } st_free(buf1); return success; } static void open_and_read_beginning(wave_info *info,unsigned char *buf,int bytes) { open_file(info); discard_header(info); if (read_n_bytes(info->input,buf,(int)bytes,NULL) != (int)bytes) st_error("error while reading %d bytes from file: [%s]",(int)bytes,info->filename); close_input_stream(info); } static bool shift_comparison(wave_info *info1,wave_info *info2) { unsigned char *buf1,*buf2; wlong bytes,cmp_size; int i,shift = 0,real_shift = 0; bool found_possible_shift = FALSE; progress_info proginfo; proginfo.initialized = FALSE; proginfo.prefix = "Scanning"; proginfo.clause = "and"; proginfo.filename1 = info1->filename; proginfo.filedesc1 = NULL; proginfo.filename2 = info2->filename; proginfo.filedesc2 = NULL; proginfo.bytes_total = 1; prog_update(&proginfo); cmp_size = shift_secs * info1->rate; bytes = min(min(info1->data_size,info2->data_size),cmp_size); if (NULL == (buf1 = malloc(2 * bytes * sizeof(unsigned char)))) { prog_error(&proginfo); st_error("could not allocate %d-byte comparison buffer",bytes); } buf2 = buf1 + bytes; open_and_read_beginning(info1,buf1,bytes); open_and_read_beginning(info2,buf2,bytes); for (i=0;i 0) st_info("With fuzz factor %d, file",fuzz); else st_info("File"); if (0 == shift) { st_info("s are identical so far.\n"); } else { st_info(" the %s file seems to have ",(0 < shift) ? "first" : "second"); st_info("%d extra bytes (%d extra samples",real_shift,(real_shift + 2)/4); if (!PROB_NOT_CD(info1) && !PROB_NOT_CD(info2)) st_info(", or %d extra sectors",(real_shift+(CD_BLOCK_SIZE/2))/CD_BLOCK_SIZE); st_info(")\n"); st_info("\n"); st_info("These extra bytes will be ignored in the full comparison.\n"); } st_info("\n"); st_info("Preparing to do a full comparison...\n"); st_info("\n"); return cmp_files(info1,info2,shift); } static bool straight_comparison(wave_info *info1,wave_info *info2) { return cmp_files(info1,info2,0); } static bool process_files(char *filename1,char *filename2) { wave_info *info1,*info2; bool success; if (NULL == (info1 = new_wave_info(filename1))) return FALSE; if (NULL == (info2 = new_wave_info(filename2))) return FALSE; if (align) success = shift_comparison(info1,info2); else success = straight_comparison(info1,info2); st_free(info1); st_free(info2); return success; } static bool process(int argc,char **argv,int start) { char *filename1,*filename2; bool success; success = FALSE; input_init(start,argc,argv); if (!(filename1 = input_get_filename()) || !(filename2 = input_get_filename())) { st_error("need exactly two files to process"); } success = process_files(filename1,filename2); return success; } static bool cmp_main(int argc,char **argv) { int first_arg; parse(argc,argv,&first_arg); return process(argc,argv,first_arg); } shntool-3.0.10/src/format_wv.c0000644000077100007710000001713511155771111013154 00000000000000/* format_wv.c - wavpack format module * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include #include #include #include "format.h" CVSID("$Id: format_wv.c,v 1.72 2009/03/11 17:18:01 jason Exp $") #define WAVPACK "wavpack" #define WVUNPACK "wvunpack" #define WAVPACK_MAGIC "wvpk" #define WV_COMMON_HEADER_SIZE 10 #ifdef WIN32 static char default_decoder_args[] = "-q -y " FILENAME_PLACEHOLDER " -"; static char default_encoder_args[] = "-q -y - " FILENAME_PLACEHOLDER; #else static char default_decoder_args[] = "-q -y " FILENAME_PLACEHOLDER " -o -"; static char default_encoder_args[] = "-q -y - -o " FILENAME_PLACEHOLDER; #endif /* definitions for version 3 and older */ #define NEW_HIGH_FLAG 0x400 /* new high quality mode (lossless only) */ #define WavpackHeader3Format "4LSSSSLLL4L" typedef struct _WavpackHeader3 { char ckID[4]; int ckSize; short version; short bits; short flags, shift; int total_samples, crc, crc2; char extension[4], extra_bc, extras[3]; } WavpackHeader3; /* definitions for version 4 */ #define HYBRID_FLAG 8 #define ID_WVC_BITSTREAM 0xb /* these metadata identify .wvc */ #define ID_SHAPING_WEIGHTS 0x7 #define WavpackHeader4Format "4LS2LLLLL" typedef struct _WavpackHeader4 { char ckID[4]; int ckSize; short version; unsigned char track_no, index_no; int total_samples, block_index, block_samples, flags, crc; } WavpackHeader4; static bool is_our_file(char *); format_module format_wv = { "wv", "WavPack Hybrid Lossless Audio Compression", CVSIDSTR, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, NULL, NULL, 0, "wv", WVUNPACK, default_decoder_args, WAVPACK, default_encoder_args, is_our_file, NULL, NULL, NULL, NULL, NULL }; static char *filespec_ext(char *filespec) { char *cp = filespec + strlen(filespec); while (--cp >= filespec) { if (*cp == '\\' || *cp == ':') return NULL; if (*cp == '.') { if (strlen (cp) > 1 && strlen (cp) <= 4) return cp; else return NULL; } } return NULL; } static void little_endian_to_native (void *data, char *format) { unsigned char *cp = (unsigned char *) data; int temp; while (*format) { switch (*format) { case 'L': temp = cp [0] + (cp [1] << 8) + ((int) cp [2] << 16) + ((int) cp [3] << 24); * (int *) cp = temp; cp += 4; break; case 'S': temp = cp [0] + (cp [1] << 8); * (short *) cp = temp; cp += 2; break; default: if (isdigit (*format)) cp += *format - '0'; break; } format++; } } static bool file_exists_with_alternate_extension(char *filename,char *ext) { char wvc_filename[FILENAME_SIZE]; char *extp; FILE *f; strcpy(wvc_filename,filename); extp = filespec_ext(wvc_filename); if (extp) *extp = 0; strcat(wvc_filename,ext); if ((f = fopen(wvc_filename,"rb"))) { fclose(f); return TRUE; } return FALSE; } static long get_header_offset(FILE *f) { unsigned char buf[4]; long curpos; buf[0] = 'x'; buf[1] = 'x'; buf[2] = 'x'; buf[3] = 'x'; /* like WavPack, we check the first 1 meg of the file for a header. */ /* unlike WavPack, we do it in the most inefficient way possible. */ for (curpos=0;curpos<1024*1024;curpos++) { buf[0] = buf[1]; buf[1] = buf[2]; buf[2] = buf[3]; buf[3] = fgetc(f); if (feof(f)) { return -1; } if (!tagcmp(buf,(unsigned char *)WAVPACK_MAGIC)) { return curpos - 3; } } return -1; } static bool is_our_file(char *filename) { wave_info *info; unsigned char wph[64]; WavpackHeader3 *wph3; WavpackHeader4 *wph4; char first_id; int remaining_bytes; long header_offset; if (NULL == (info = new_wave_info(NULL))) st_error("could not allocate memory for WAVE info in wv check"); info->filename = filename; if (NULL == (info->input = open_input(filename))) { st_free(info); return FALSE; } if (-1 == (header_offset = get_header_offset(info->input))) { fclose(info->input); st_free(info); return FALSE; } fseek(info->input,header_offset,SEEK_SET); /* read up to size of largest header, making sure we read enough to fill the smallest header */ memset((void *)wph,0,64); if (fread(&wph,1,WV_COMMON_HEADER_SIZE,info->input) != WV_COMMON_HEADER_SIZE) { fclose(info->input); st_free(info); return FALSE; } if (wph[9] >= 4) { /* we're dealing with a version 4+ file */ remaining_bytes = sizeof(WavpackHeader4) - WV_COMMON_HEADER_SIZE; if (fread(wph+WV_COMMON_HEADER_SIZE,1,remaining_bytes,info->input) != remaining_bytes) { fclose(info->input); st_free(info); return FALSE; } first_id = getc(info->input) & 0x1f; fclose(info->input); st_free(info); wph4 = (WavpackHeader4 *)wph; little_endian_to_native(wph4,WavpackHeader4Format); if (tagcmp((unsigned char *)wph4->ckID,(unsigned char *)WAVPACK_MAGIC) || wph4->version < 4 || wph4->version > 0x40f) { return FALSE; } st_debug1("examining version >=4 (%d) Wavpack file: [%s]",wph4->version,filename); if (wph4->block_samples) { if ((ID_WVC_BITSTREAM == first_id) || (ID_SHAPING_WEIGHTS == first_id)) { /* these ids belong to the correction file */ st_debug1("this appears to be a hybrid correction file -- skipping."); return FALSE; } if (wph4->flags & HYBRID_FLAG) { /* hybrid */ if (file_exists_with_alternate_extension(filename,".wvc") || file_exists_with_alternate_extension(filename,".WVC")) return TRUE; /* lossy */ st_warning("encountered lossy WavPack file: [%s]",filename); return TRUE; } } /* lossless */ return TRUE; } /* we're dealing with an older file */ remaining_bytes = sizeof(WavpackHeader3) - WV_COMMON_HEADER_SIZE; if (fread(wph+WV_COMMON_HEADER_SIZE,1,remaining_bytes,info->input) != remaining_bytes) { fclose(info->input); st_free(info); return FALSE; } fclose(info->input); st_free(info); wph3 = (WavpackHeader3 *)wph; little_endian_to_native(wph3,WavpackHeader3Format); if (tagcmp((unsigned char *)wph3->ckID,(unsigned char *)WAVPACK_MAGIC) || wph3->version < 1 || wph3->version > 3) { return FALSE; } st_debug1("examining version <=3 (%d) Wavpack file: [%s]",wph3->version,filename); /* lossy */ if (wph3->version == 3 && wph3->bits && (wph3->flags & NEW_HIGH_FLAG) && wph3->crc != wph3->crc2) { st_warning("encountered lossy WavPack file: [%s]",filename); return TRUE; } if (wph3->bits) { /* hybrid */ if (file_exists_with_alternate_extension(filename,".wvc") || file_exists_with_alternate_extension(filename,".WVC")) return TRUE; /* lossy */ st_warning("encountered lossy WavPack file: [%s]",filename); return TRUE; } /* lossless */ return TRUE; } shntool-3.0.10/src/mode_len.c0000644000077100007710000002100511157756171012734 00000000000000/* mode_len.c - len mode module * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include #include "mode.h" CVSID("$Id: mode_len.c,v 1.90 2009/03/17 17:23:05 jason Exp $") static bool len_main(int,char **); static void len_help(void); mode_module mode_len = { "len", "shnlen", "Displays length, size and properties of PCM WAVE data", CVSIDSTR, FALSE, len_main, len_help }; #define LEN_OK "-" #define LEN_NOT_APPLICABLE "x" typedef enum { LEVEL_UNKNOWN = -1, LEVEL_BYTES, LEVEL_KBYTES, LEVEL_MBYTES, LEVEL_GBYTES, LEVEL_TBYTES } len_levels; static int totals_unit_level = LEVEL_UNKNOWN; static int file_unit_level = LEVEL_UNKNOWN; static int num_processed = 0; static bool all_cd_quality = TRUE; static bool suppress_column_names = FALSE; static bool suppress_totals_line = FALSE; static double total_size = 0.0; static double total_data_size = 0.0; static double total_disk_size = 0.0; static double total_length = 0.0; static double unit_divs[5] = {1.0, 1024.0, 1048576.0, 1073741824.0, 1099511627776.0}; static char *units[5] = {"B ", "KB", "MB", "GB", "TB"}; static void len_help() { st_info("Usage: %s [OPTIONS] [files]\n",st_progname()); st_info("\n"); st_info("Mode-specific options:\n"); st_info("\n"); st_info(" -U unit show total size in specified unit (*)\n"); st_info(" -c suppress column names\n"); st_info(" -h show this help screen\n"); st_info(" -t suppress totals line\n"); st_info(" -u unit show file sizes in specified unit (*)\n"); st_info("\n"); st_info(" (*) unit is one of: {[b], kb, mb, gb, tb}\n"); st_info("\n"); } static int get_unit(char *unit) { if (!strcmp(optarg,"b")) return LEVEL_BYTES; if (!strcmp(optarg,"kb")) return LEVEL_KBYTES; if (!strcmp(optarg,"mb")) return LEVEL_MBYTES; if (!strcmp(optarg,"gb")) return LEVEL_GBYTES; if (!strcmp(optarg,"tb")) return LEVEL_TBYTES; return LEVEL_UNKNOWN; } static void parse(int argc,char **argv,int *first_arg) { int c; file_unit_level = LEVEL_BYTES; totals_unit_level = LEVEL_BYTES; while ((c = st_getopt(argc,argv,"U:ctu:")) != -1) { switch (c) { case 'U': if (NULL == optarg) st_error("missing total size unit"); totals_unit_level = get_unit(optarg); if (LEVEL_UNKNOWN == totals_unit_level) st_help("unknown total size unit: [%s]",optarg); break; case 'c': suppress_column_names = TRUE; break; case 't': suppress_totals_line = TRUE; break; case 'u': if (NULL == optarg) st_error("missing file size unit"); file_unit_level = get_unit(optarg); if (LEVEL_UNKNOWN == file_unit_level) st_help("unknown file size unit: [%s]",optarg); break; } } *first_arg = optind; } static void show_len_banner() { if (suppress_column_names) return; st_output(" length expanded size cdr WAVE problems fmt ratio filename\n"); } static void print_formatted_length(wave_info *info) { int i,len; len = strlen(info->m_ss); if (PROB_NOT_CD(info)) { for (i=0;i<13-len;i++) st_output(" "); st_output("%s",info->m_ss); } else { for (i=0;i<12-len;i++) st_output(" "); st_output("%s ",info->m_ss); } } static bool show_stats(wave_info *info) { wlong appended_bytes; bool success; success = FALSE; print_formatted_length(info); if (file_unit_level > 0) st_output("%14.2f",(double)info->total_size / unit_divs[file_unit_level]); else st_output("%14lu",info->total_size); st_output(" %s",units[file_unit_level]); /* CD-R properties */ st_output(" "); if (PROB_NOT_CD(info)) st_output("c%s%s",LEN_NOT_APPLICABLE,LEN_NOT_APPLICABLE); else { st_output("%s",LEN_OK); if (PROB_BAD_BOUND(info)) st_output("b"); else st_output("%s",LEN_OK); if (PROB_TOO_SHORT(info)) st_output("s"); else st_output("%s",LEN_OK); } /* WAVE properties */ st_output(" "); if (PROB_HDR_NOT_CANONICAL(info)) st_output("h"); else st_output("%s",LEN_OK); if (PROB_EXTRA_CHUNKS(info)) st_output("e"); else st_output("%s",LEN_OK); /* problems */ st_output(" "); if (info->file_has_id3v2_tag) st_output("3"); else st_output("%s",LEN_OK); if (PROB_DATA_NOT_ALIGNED(info)) st_output("a"); else st_output("%s",LEN_OK); if (PROB_HDR_INCONSISTENT(info)) st_output("i"); else st_output("%s",LEN_OK); if (!info->input_format->is_compressed && !info->input_format->is_translated) { appended_bytes = info->actual_size - info->total_size - info->id3v2_tag_size; if (PROB_TRUNCATED(info)) st_output("t"); else st_output("%s",LEN_OK); if (PROB_JUNK_APPENDED(info) && appended_bytes > 0) st_output("j"); else st_output("%s",LEN_OK); } else st_output("%s%s",LEN_NOT_APPLICABLE,LEN_NOT_APPLICABLE); /* input file format */ st_output(" %5s",info->input_format->name); /* ratio */ st_output(" %0.4f",(double)info->actual_size/(double)info->total_size); st_output(" %s\n",info->filename); success = TRUE; return success; } static void show_totals_line() { wave_info *info; wlong seconds; double ratio; if (suppress_totals_line) return; if (NULL == (info = new_wave_info(NULL))) st_error("could not allocate memory for totals"); if (all_cd_quality) { /* Note to users from the year 2376: the m:ss.ff value on the totals line will only be * correct as long as the total data size is less than 689 terabytes (2^32 * 176400 bytes). * Hopefully, by then you'll all have 2048-bit processers to go with your petabyte keychain * raid arrays, and this won't be an issue. */ /* calculate floor of total length in seconds */ seconds = (wlong)(total_data_size / (double)CD_RATE); /* since length_to_str() only considers (data_size % CD_RATE) when the file is CD-quality, * we don't need to risk overflowing a 32-bit unsigned long with a double - we can cheat * and just store the modulus. */ info->data_size = (wlong)(total_data_size - (double)(seconds * CD_RATE)); info->length = seconds; info->rate = CD_RATE; } else { info->problems |= PROBLEM_NOT_CD_QUALITY; info->length = (wlong)total_length; } info->exact_length = total_length; length_to_str(info); print_formatted_length(info); ratio = (num_processed > 0) ? (total_disk_size / total_size) : 0.0; total_size /= unit_divs[totals_unit_level]; if (totals_unit_level > 0) st_output("%14.2f",total_size); else st_output("%14.0f",total_size); st_output(" %s %0.4f (%d file%s)\n", units[totals_unit_level],ratio,num_processed,(1 != num_processed)?"s":""); st_free(info); } static void update_totals(wave_info *info) { total_size += (double)info->total_size; total_data_size += (double)info->data_size; total_length += (double)info->data_size / (double)info->avg_bytes_per_sec; if (PROB_NOT_CD(info)) all_cd_quality = FALSE; total_disk_size += (double)info->actual_size; num_processed++; } static bool process_file(char *filename) { wave_info *info; bool success; if (NULL == (info = new_wave_info(filename))) return FALSE; if ((success = show_stats(info))) update_totals(info); st_free(info); return success; } static bool process(int argc,char **argv,int start) { char *filename; bool success; success = TRUE; show_len_banner(); input_init(start,argc,argv); while ((filename = input_get_filename())) { success = (process_file(filename) && success); } show_totals_line(); return success; } static bool len_main(int argc,char **argv) { int first_arg; parse(argc,argv,&first_arg); return process(argc,argv,first_arg); } shntool-3.0.10/src/format_tak.c0000644000077100007710000000261311155771111013272 00000000000000/* format_tak.c - tak format module * Copyright (C) 2000-2009 Jason Jordan * * 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 of the License, 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, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "format.h" CVSID("$Id: format_tak.c,v 1.12 2009/03/11 17:18:01 jason Exp $") #define TAK "takc" #define TAK_MAGIC "tBaK" static char default_decoder_args[] = "-d -silent " FILENAME_PLACEHOLDER " -"; static char default_encoder_args[] = "-e -silent -ihs - " FILENAME_PLACEHOLDER; format_module format_tak = { "tak", "(T)om's lossless (A)udio (K)ompressor", CVSIDSTR, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, NULL, TAK_MAGIC, 0, "tak", TAK, default_decoder_args, TAK, default_encoder_args, NULL, NULL, NULL, NULL, NULL, NULL }; shntool-3.0.10/src/core_shntool.c0000644000077100007710000002345311157354613013654 00000000000000/* core_shntool.c - functions to handle mode verification and execution * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include #include #include "shntool.h" CVSID("$Id: core_shntool.c,v 1.90 2009/03/16 04:46:03 jason Exp $") private_opts st_priv; input_files st_input; void st_version() { st_info( "%s%s " RELEASE "\n" COPYRIGHT " " AUTHOR "\n" "\n" "shorten utilities pages:\n" "\n" " " URL1 "\n" " " URL2 "\n" "\n" "This is free software. You may redistribute copies of it under the terms of\n" "the GNU General Public License .\n" "There is NO WARRANTY, to the extent permitted by law.\n" "\n" ,st_priv.fullprogname,(st_priv.progmode)?" mode module":"" ); } static void show_supported_mode_modules() { int i; st_info("%s %s supported modes:\n",st_priv.fullprogname,RELEASE); st_info("\n"); st_info(" mode description\n"); st_info(" ---- -----------\n"); for (i=0;st_modes[i];i++) st_info(" %5s %s\n",st_modes[i]->name,st_modes[i]->description); st_info("\n"); st_info(" For help with any of the above modes, type: '%s mode -h'\n",st_priv.progname); st_info("\n"); } static void show_supported_format_modules() { int i; char tmp[BUF_SIZE]; st_info("%s %s supported file formats:\n",st_priv.fullprogname,RELEASE); st_info("\n"); st_info(" format ext input output description\n"); st_info(" ------ --- ----- ------ -----------\n"); for (i=0;st_formats[i];i++) { st_info(" %5s",st_formats[i]->name); if (st_formats[i]->supports_output && st_formats[i]->extension) { st_snprintf(tmp,BUF_SIZE,".%s",st_formats[i]->extension); st_info(" %5s",tmp); } else st_info(" -"); if (st_formats[i]->supports_input) { if (st_formats[i]->decoder) { st_info(" %8s",st_formats[i]->decoder); } else { st_info(" shntool"); } } else { st_info(" -"); } if (st_formats[i]->supports_output) { if (st_formats[i]->encoder) { st_info(" %8s",st_formats[i]->encoder); } else { st_info(" shntool"); } } else { st_info(" -"); } st_info(" %s\n",st_formats[i]->description); } st_info("\n"); } static void show_format_module_args() { int i,showed_format; st_info("%s %s default file format arguments:\n",st_priv.fullprogname,RELEASE); st_info("\n"); st_info(" format action arguments\n"); st_info(" ------ ------ ---------\n"); for (i=0;st_formats[i];i++) { if (!st_formats[i]->decoder && !st_formats[i]->encoder) { continue; } showed_format = 0; if (st_formats[i]->decoder) { st_info(" %5s decoding: ",(showed_format)?"":st_formats[i]->name); st_info(" -i \"%s %s %s\"",st_formats[i]->name,st_formats[i]->decoder,st_formats[i]->decoder_args); st_info("\n"); showed_format = 1; } if (st_formats[i]->encoder) { st_info(" %5s encoding: ",(showed_format)?"":st_formats[i]->name); st_info(" -o \"%s ext=%s %s %s\"",st_formats[i]->name,st_formats[i]->extension,st_formats[i]->encoder,st_formats[i]->encoder_args); st_info("\n"); showed_format = 1; } } st_info("\n"); } static void core_help() { st_info("Usage: %s mode ...\n",st_priv.progname); st_info(" %s [OPTIONS]\n",st_priv.progname); st_info("\n"); st_info("Options:\n"); st_info("\n"); st_info(" -m show detailed mode module information\n"); st_info(" -f show detailed format module information\n"); st_info(" -a show default format module arguments\n"); st_info(" -v show version information\n"); st_info(" -h show this help screen\n"); st_info("\n"); } static void module_sanity_check() { int i,j; if (st_modes[0]) { for (i=0;st_modes[i];i++) { if (NULL == st_modes[i]->name) st_error("found a mode module without a name"); if (NULL == st_modes[i]->description) st_error("mode module has no description: [%s]",st_modes[i]->name); if (NULL == st_modes[i]->run_main) st_error("mode module does not provide run_main(): [%s]",st_modes[i]->name); } for (i=0;st_modes[i];i++) { for (j=i+1;st_modes[j];j++) { if (!strcmp(st_modes[i]->name,st_modes[j]->name)) st_error("found modes with identical name: [%s]",st_modes[i]->name); } } } else st_error("no mode modules found"); if (st_formats[0]) { for (i=0;st_formats[i];i++) { if (NULL == st_formats[i]->name) st_error("found a format module without a name"); if (NULL == st_formats[i]->description) st_error("format module has no description: [%s]",st_formats[i]->name); if (!st_formats[i]->supports_input && !st_formats[i]->supports_output) st_error("format module doesn't support input or output: [%s]",st_formats[i]->name); if (!st_formats[i]->supports_input && st_formats[i]->decoder) st_error("format module doesn't support input but defines a decoder: [%s]",st_formats[i]->name); if (!st_formats[i]->supports_output && st_formats[i]->encoder) st_error("format module doesn't support output but defines an encoder: [%s]",st_formats[i]->name); } for (i=0;st_formats[i];i++) { for (j=i+1;st_formats[j];j++) { if (!strcmp(st_formats[i]->name,st_formats[j]->name)) st_error("found formats with identical name: [%s]",st_formats[i]->name); } } } else { st_error("no file formats modules found"); } } static bool parse_main(int argc,char **argv) { int i,j; int c; /* look for a module alias matching progname */ for (i=0;st_modes[i];i++) { if (NULL != st_modes[i]->alias && !strcmp(st_priv.progname,st_modes[i]->alias)) { st_priv.mode = st_modes[i]; st_priv.is_aliased = TRUE; st_priv.progmode = st_modes[i]->name; return st_modes[i]->run_main(argc,argv); } } /* failing that, look for a module name matching argv[1] */ if (argc < 2) st_help("missing arguments"); for (i=0;st_modes[i];i++) { if (!strcmp(argv[1],st_modes[i]->name)) { /* found mode - now run it and quit */ st_priv.mode = st_modes[i]; st_priv.progmode = st_modes[i]->name; strcat(st_priv.fullprogname," "); strcat(st_priv.fullprogname,st_priv.progmode); /* remove mode name from arg list (is this portable?) */ for (j=1;jrun_main(argc,argv); } } while ((c=getopt(argc,argv,GLOBAL_OPTS_CORE)) != -1) { switch (c) { case 'a': show_format_module_args(); exit(ST_EXIT_SUCCESS); break; case 'f': show_supported_format_modules(); exit(ST_EXIT_SUCCESS); break; case 'j': st_info("Guru Meditashn #00000002.9091968B\n"); exit(ST_EXIT_SUCCESS); break; case 'm': show_supported_mode_modules(); exit(ST_EXIT_SUCCESS); break; case '?': case 'h': if ('?' == c) st_info("\n"); core_help(); exit(('?' == c) ? ST_EXIT_ERROR : ST_EXIT_SUCCESS); break; case 'v': st_version(); exit(ST_EXIT_SUCCESS); break; } } if (optind < argc) st_help("invalid mode: [%s]",argv[optind]); return FALSE; } static void modules_init() { int i; /* sanity checks for modules */ module_sanity_check(); /* initialize format modules */ for (i=0;st_formats[i];i++) { arg_init(st_formats[i]); } } static void globals_init(char *program) { char *p; int n; #ifdef WIN32 setvbuf(stdout,NULL,_IONBF,0); #else signal(SIGPIPE,SIG_IGN); #endif /* public globals */ st_ops.output_directory = "."; st_ops.output_prefix = ""; st_ops.output_postfix = ""; st_ops.output_format = NULL; /* private globals */ st_priv.progname = ((p = strrchr(program,PATHSEPCHAR))) ? (p + 1) : program; if ((p = extname(st_priv.progname))) *(p-1) = 0; strcpy(st_priv.fullprogname,st_priv.progname); st_priv.progmode = NULL; st_priv.clobber_action = CLOBBER_ACTION_ASK; st_priv.reorder_type = ORDER_NATURAL; st_priv.progress_type = PROGRESS_PERCENT; st_priv.is_aliased = FALSE; st_priv.show_hmmss = FALSE; st_priv.suppress_warnings = FALSE; st_priv.suppress_stderr = FALSE; st_priv.screen_dirty = FALSE; st_input.type = INPUT_CMDLINE; st_input.filename_source = NULLDEVICE; st_input.fd = NULL; st_input.argn = 0; st_input.argc = 0; st_input.argv = NULL; st_input.filecur = 0; st_input.filemax = 0; p = scan_env(SHNTOOL_DEBUG_ENV); n = p ? atoi(p) : 0; st_priv.debug_level = (n > 0) ? n : 0; } int main(int argc,char **argv) { bool success; /* initialize global variables */ globals_init(argv[0]); /* initialize modules */ modules_init(); /* parse command line */ success = parse_main(argc,argv); return (success) ? ST_EXIT_SUCCESS : ST_EXIT_ERROR; } shntool-3.0.10/src/format_bonk.c0000644000077100007710000000346211155771111013447 00000000000000/* format_bonk.c - bonk format module * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "format.h" CVSID("$Id: format_bonk.c,v 1.24 2009/03/11 17:18:01 jason Exp $") #define BONK "bonk" #define BONK_MAGIC "BONK" #ifdef WIN32 static char default_decoder_args[] = "decode -o - " FILENAME_PLACEHOLDER; static char default_encoder_args[] = "encode -o " FILENAME_PLACEHOLDER " -"; #else static char default_decoder_args[] = "decode -o " TERMODEVICE " " FILENAME_PLACEHOLDER; static char default_encoder_args[] = "encode -o " FILENAME_PLACEHOLDER " " TERMIDEVICE; #endif static bool is_our_file(char *); format_module format_bonk = { "bonk", "Bonk lossy/lossless audio compressor", CVSIDSTR, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, #ifdef WIN32 "-", #else TERMIDEVICE, #endif NULL, 0, "bonk", BONK, default_decoder_args, BONK, default_encoder_args, is_our_file, NULL, NULL, NULL, NULL, NULL }; static bool is_our_file(char *filename) { return (check_for_magic(filename,BONK_MAGIC,0) || check_for_magic(filename,BONK_MAGIC,1)); } shntool-3.0.10/src/mode_conv.c0000644000077100007710000001655511164063470013130 00000000000000/* mode_conv.c - conv mode module * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mode.h" CVSID("$Id: mode_conv.c,v 1.111 2009/03/30 06:31:20 jason Exp $") static bool conv_main(int,char **); static void conv_help(void); mode_module mode_conv = { "conv", "shnconv", "Converts files from one format to another", CVSIDSTR, TRUE, conv_main, conv_help }; static bool read_from_terminal = FALSE; static void conv_help() { st_info("Usage: %s [OPTIONS] [files]\n",st_progname()); st_info("\n"); st_info("Mode-specific options:\n"); st_info("\n"); st_info(" -h show this help screen\n"); st_info(" -t read WAVE data from the terminal\n"); st_info("\n"); } static void parse(int argc,char **argv,int *first_arg) { int c; st_ops.output_directory = INPUT_FILE_DIR; while ((c = st_getopt(argc,argv,"t")) != -1) { switch (c) { case 't': read_from_terminal = TRUE; break; } } *first_arg = optind; } static bool conv_file(wave_info *info) { int bytes; proc_info output_proc; FILE *output = NULL; char outfilename[FILENAME_SIZE]; unsigned char *header = NULL,nullpad[BUF_SIZE]; bool success; progress_info proginfo; create_output_filename(info->filename,info->input_format->extension,outfilename); success = FALSE; proginfo.initialized = FALSE; proginfo.prefix = "Converting"; proginfo.clause = "-->"; proginfo.filename1 = info->filename; proginfo.filedesc1 = info->m_ss; proginfo.filename2 = outfilename; proginfo.filedesc2 = NULL; proginfo.bytes_total = info->total_size; prog_update(&proginfo); if (files_are_identical(info->filename,outfilename)) { prog_error(&proginfo); st_warning("output file would overwrite input file -- skipping."); return FALSE; } if (!open_input_stream(info)) { prog_error(&proginfo); st_warning("could not open input file -- skipping."); return FALSE; } if (NULL == (output = open_output_stream(outfilename,&output_proc))) { prog_error(&proginfo); st_warning("could not open output file -- skipping."); goto cleanup; } if (NULL == (header = malloc(info->header_size * sizeof(unsigned char)))) { prog_error(&proginfo); st_warning("could not allocate %d-byte WAVE header -- skipping.",info->header_size); goto cleanup; } if (read_n_bytes(info->input,header,info->header_size,NULL) != info->header_size) { prog_error(&proginfo); st_warning("error while discarding %d-byte WAVE header -- skipping.",info->header_size); goto cleanup; } if (!do_header_kluges(header,info)) { prog_error(&proginfo); st_warning("could not fix WAVE header -- skipping."); goto cleanup; } if ((info->header_size > 0) && write_n_bytes(output,header,info->header_size,&proginfo) != info->header_size) { prog_error(&proginfo); st_warning("error while writing %d-byte WAVE header -- skipping.",info->header_size); goto cleanup; } if ((info->data_size > 0) && (transfer_n_bytes(info->input,output,info->data_size,&proginfo) != info->data_size)) { prog_error(&proginfo); st_warning("error while transferring %lu-byte data chunk -- skipping.",info->data_size); goto cleanup; } if (PROB_ODD_SIZED_DATA(info)) { nullpad[0] = 1; bytes = read_n_bytes(info->input,nullpad,1,&proginfo); if ((1 != bytes) && (0 != bytes)) { prog_error(&proginfo); st_warning("error while reading possible NULL pad byte from input file -- skipping."); goto cleanup; } if ((0 == bytes) || ((1 == bytes) && nullpad[0])) { st_debug1("missing NULL pad byte for odd-sized data chunk in file: [%s]",info->filename); } if (1 == bytes) { if (0 == nullpad[0]) { if (write_n_bytes(output,nullpad,1,&proginfo) != 1) { prog_error(&proginfo); st_warning("error while writing NULL pad byte -- skipping."); goto cleanup; } } else { if (write_n_bytes(output,nullpad,1,&proginfo) != 1) { prog_error(&proginfo); st_warning("error while writing initial extra byte -- skipping."); goto cleanup; } } } } if (PROB_EXTRA_CHUNKS(info) && (transfer_n_bytes(info->input,output,info->extra_riff_size,&proginfo) != info->extra_riff_size)) { st_warning("error while transferring %lu extra bytes -- skipping.",info->extra_riff_size); goto cleanup; } success = TRUE; prog_success(&proginfo); cleanup: st_free(header); if ((output) && ((CLOSE_CHILD_ERROR_OUTPUT == close_output(output,output_proc)) || !success)) { success = FALSE; remove_file(outfilename); } close_input_stream(info); return success; } static bool conv_terminal() { int bytes_read,bytes_written; proc_info output_proc; FILE *output; char outfilename[FILENAME_SIZE]; unsigned char buf[XFER_SIZE]; bool success; progress_info proginfo; success = TRUE; create_output_filename("terminal","wav",outfilename); if (NULL == (output = open_output_stream(outfilename,&output_proc))) { st_warning("could not open output file: [%s]",outfilename); return FALSE; } SETBINARY_IN(stdin); if (isatty(fileno(stdin))) st_info("enter WAVE data by hand... good luck:\n"); proginfo.initialized = FALSE; proginfo.prefix = "Converting"; proginfo.clause = "-->"; proginfo.filename1 = "data from the terminal"; proginfo.filedesc1 = NULL; proginfo.filename2 = outfilename; proginfo.filedesc2 = NULL; proginfo.bytes_total = (wlong)-1; prog_update(&proginfo); while (!feof(stdin)) { /* read data, write to encoder */ bytes_read = fread(buf,1,XFER_SIZE,stdin); bytes_written = write_n_bytes(output,buf,bytes_read,&proginfo); if (bytes_read != bytes_written) { success = FALSE; break; } } if ((CLOSE_CHILD_ERROR_OUTPUT == close_output(output,output_proc)) || !success) { success = FALSE; prog_error(&proginfo); remove_file(outfilename); } else { success = TRUE; prog_success(&proginfo); } return success; } static bool process_file(char *filename) { wave_info *info; bool success; if (NULL == (info = new_wave_info(filename))) return FALSE; success = conv_file(info); st_free(info); return success; } static bool process(int argc,char **argv,int start) { char *filename; bool success; success = TRUE; if (read_from_terminal) { return conv_terminal(); } input_init(start,argc,argv); while ((filename = input_get_filename())) { success = (process_file(filename) && success); } return success; } static bool conv_main(int argc,char **argv) { int first_arg; parse(argc,argv,&first_arg); return process(argc,argv,first_arg); } shntool-3.0.10/src/format_ofr.c0000644000077100007710000000322211155771111013276 00000000000000/* format_ofr.c - ofr format module * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "format.h" CVSID("$Id: format_ofr.c,v 1.56 2009/03/11 17:18:01 jason Exp $") #define OPTIMFROG "ofr" #define OPTIMFROG_MAGIC "OFR " #define OPTIMFROG_MAGIC_OLD "*RIFF" static char default_decoder_args[] = "--decode " FILENAME_PLACEHOLDER " --output -"; static char default_encoder_args[] = "--encode - --output " FILENAME_PLACEHOLDER; static bool is_our_file(char *); format_module format_ofr = { "ofr", "OptimFROG Lossless WAVE Audio Coder", CVSIDSTR, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, "-", NULL, 0, "ofr", OPTIMFROG, default_decoder_args, OPTIMFROG, default_encoder_args, is_our_file, NULL, NULL, NULL, NULL, NULL }; static bool is_our_file(char *filename) { return (check_for_magic(filename,OPTIMFROG_MAGIC,0) || check_for_magic(filename,OPTIMFROG_MAGIC_OLD,0)); } shntool-3.0.10/src/core_module.c0000644000077100007710000000715311155771111013444 00000000000000/* core_module.c - public functions for both mode and format modules * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include #include "shntool.h" CVSID("$Id: core_module.c,v 1.148 2009/03/11 17:18:01 jason Exp $") /* public functions */ unsigned long check_for_id3v2_tag(FILE *f) { id3v2_header id3v2hdr; unsigned long tag_size; /* read an ID3v2 header's size worth of data */ if (sizeof(id3v2_header) != fread(&id3v2hdr,1,sizeof(id3v2_header),f)) { return 0; } /* verify this is an ID3v2 header */ if (tagcmp((unsigned char *)id3v2hdr.magic,(unsigned char *)ID3V2_MAGIC) || 0xff == id3v2hdr.version[0] || 0xff == id3v2hdr.version[1] || 0x80 <= id3v2hdr.size[0] || 0x80 <= id3v2hdr.size[1] || 0x80 <= id3v2hdr.size[2] || 0x80 <= id3v2hdr.size[3]) { return 0; } /* calculate and return ID3v2 tag size */ tag_size = synchsafe_int_to_ulong(id3v2hdr.size); return tag_size; } FILE *open_input_internal(char *filename,bool *file_has_id3v2_tag,wlong *id3v2_tag_size) /* opens a file, and if it contains an ID3v2 tag, skips past it */ { FILE *f; unsigned long tag_size; if (NULL == (f = fopen(filename,"rb"))) { return NULL; } if (file_has_id3v2_tag) *file_has_id3v2_tag = FALSE; if (id3v2_tag_size) *id3v2_tag_size = 0; /* check for ID3v2 tag on input */ if (0 == (tag_size = check_for_id3v2_tag(f))) { fclose(f); return fopen(filename,"rb"); } if (file_has_id3v2_tag) *file_has_id3v2_tag = TRUE; if (id3v2_tag_size) *id3v2_tag_size = (wlong)(tag_size + sizeof(id3v2_header)); st_debug1("discarding %lu-byte ID3v2 tag at beginning of file: [%s]",tag_size+sizeof(id3v2_header),filename); if (fseek(f,(long)tag_size,SEEK_CUR)) { st_warning("error while discarding ID3v2 tag in file: [%s]",filename); fclose(f); return fopen(filename,"rb"); } return f; } FILE *open_output(char *filename) { return fopen(filename,"wb"); } char *scan_env(char *envvar) /* function to scan environment and return a pointer to the variable if it exists and is nonempty, otherwise returns NULL */ { char *envp; envp = getenv(envvar); if ((NULL == envp) || (!strcmp(envp,""))) return NULL; return envp; } void trim(char *str) /* function to trim carriage returns and newlines from the end of strings */ { int i; i = strlen(str) - 1; while ((i >= 0) && (('\n' == str[i]) || ('\r' == str[i]))) { str[i] = 0; i--; } } char *basename(char *filename) /* function to return the basename of a file (filename minus any directory names) */ { char *base; if ((base = strrchr(filename,PATHSEPCHAR))) base++; else base = filename; return base; } char *extname(char *filename) /* function to return the extension of a file, if any */ { char *base,*ext; base = basename(filename); if ((ext = strrchr(base,'.'))) ext++; else ext = NULL; return ext; } shntool-3.0.10/src/core_wave.c0000644000077100007710000004150511155771111013120 00000000000000/* core_wave.c - functions for parsing WAVE headers * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include #include #include #include #include "shntool.h" CVSID("$Id: core_wave.c,v 1.112 2009/03/11 17:18:01 jason Exp $") bool is_valid_file(wave_info *info) /* determines whether the given filename (info->filename) is a regular file, and is readable */ { struct stat sz; FILE *f; if (stat(info->filename,&sz)) { if (errno == ENOENT) st_warning("cannot open non-existent file: [%s]",info->filename); else if (errno == EACCES) st_warning("insufficient permissions to open file: [%s]",info->filename); else if (errno == EFAULT) st_warning("encountered bad address while opening file: [%s]",info->filename); else if (errno == ENOMEM) st_warning("kernel ran out of memory while opening file: [%s]",info->filename); else if (errno == ENAMETOOLONG) st_warning("filename too long to open file: [%s]",info->filename); else st_warning("encountered system error [%s] while opening file: [%s]",strerror(errno),info->filename); return FALSE; } if (!S_ISREG(sz.st_mode)) { if (S_ISDIR(sz.st_mode)) st_warning("cannot open directory: [%s]",info->filename); else if (S_ISCHR(sz.st_mode)) st_warning("cannot open character device: [%s]",info->filename); else if (S_ISBLK(sz.st_mode)) st_warning("cannot open block device: [%s]",info->filename); else if (S_ISFIFO(sz.st_mode)) st_warning("cannot open named pipe: [%s]",info->filename); #ifndef WIN32 #ifdef S_ISSOCK else if (S_ISSOCK(sz.st_mode)) st_warning("cannot open socket: [%s]",info->filename); #endif else if (S_ISLNK(sz.st_mode)) st_warning("cannot open symbolic link: [%s]",info->filename); #endif return FALSE; } info->actual_size = (wlong)sz.st_size; if (NULL == (f = fopen(info->filename,"rb"))) { st_warning("encountered error [%s] while opening file: [%s]",strerror(errno),info->filename); return FALSE; } fclose(f); return TRUE; } bool do_header_kluges(unsigned char *header,wave_info *info) { bool retval = TRUE; if (info->input_format && info->input_format->input_header_kluge) { st_debug1("performing [%s] input header kluge on file: [%s]",info->input_format->name,info->filename); retval = info->input_format->input_header_kluge(header,info); } if (!retval) st_warning("[%s] input header kluge failed while processing file: [%s]",info->input_format->name,info->filename); return retval; } bool verify_wav_header_internal(wave_info *info,bool verbose) /* verifies that data coming in on the file descriptor info->input describes a valid WAVE header */ { unsigned long le_long=0,bytes; unsigned char buf[2]; unsigned char tag[4]; int header_len = 0; /* look for "RIFF" in header */ if (!read_tag(info->input,tag) || tagcmp(tag,(unsigned char *)WAVE_RIFF)) { if (verbose) { if (!tagcmp(tag,(unsigned char *)AIFF_FORM)) { st_warning("encountered unsupported AIFF data while processing file: [%s]",info->filename); } else { st_warning("WAVE header is missing RIFF tag while processing file: [%s]",info->filename); } } return FALSE; } if (!read_le_long(info->input,&info->chunk_size)) { st_warning("could not read chunk size from WAVE header while processing file: [%s]",info->filename); return FALSE; } /* look for "WAVE" in header */ if (!read_tag(info->input,tag) || tagcmp(tag,(unsigned char *)WAVE_WAVE)) { st_warning("WAVE header is missing WAVE tag while processing file: [%s]",info->filename); return FALSE; } header_len += 12; st_debug1("showing RIFF chunks in file: [%s]",info->filename); for (;;) { if (!read_tag(info->input,tag) || !read_le_long(info->input,&le_long)) { st_warning("reached end of file while looking for fmt tag while processing file: [%s]",info->filename); return FALSE; } st_debug1("found chunk: [%c%c%c%c] with length: %lu",tag[0],tag[1],tag[2],tag[3],le_long); header_len += 8; if (!tagcmp(tag,(unsigned char *)WAVE_FMT)) break; bytes = le_long; while (bytes > 0) { if (fread(buf,1,1,info->input) != 1) { st_warning("reached end of file when jumping ahead %lu bytes during search for fmt tag while processing file: [%s]",info->filename,le_long); return FALSE; } bytes--; } header_len += le_long; } if (le_long < 16) { st_warning("fmt chunk in WAVE header was too short while processing file: [%s]",info->filename); return FALSE; } /* now we read the juicy stuff */ if (!read_le_short(info->input,&info->wave_format)) { st_warning("reached end of file while reading format while processing file: [%s]",info->filename); return FALSE; } switch (info->wave_format) { case WAVE_FORMAT_PCM: break; default: st_warning("unsupported format 0x%04x (%s) while processing file: [%s]", info->wave_format,format_to_str(info->wave_format),info->filename); return FALSE; } if (!read_le_short(info->input,&info->channels)) { st_warning("reached end of file reading channels while processing file: [%s]",info->filename); return FALSE; } if (!read_le_long(info->input,&info->samples_per_sec)) { st_warning("reached end of file reading samples/sec while processing file: [%s]",info->filename); return FALSE; } if (!read_le_long(info->input,&info->avg_bytes_per_sec)) { st_warning("reached end of file reading average bytes/sec while processing file: [%s]",info->filename); return FALSE; } if (!read_le_short(info->input,&info->block_align)) { st_warning("reached end of file reading block align while processing file: [%s]",info->filename); return FALSE; } if (!read_le_short(info->input,&info->bits_per_sample)) { st_warning("reached end of file reading bits/sample while processing file: [%s]",info->filename); return FALSE; } header_len += 16; le_long -= 16; if (le_long) { bytes = le_long; while (bytes > 0) { if (fread(buf,1,1,info->input) != 1) { st_warning("reached end of file jumping ahead %lu bytes while processing file: [%s]",le_long,info->filename); return FALSE; } bytes--; } header_len += le_long; } /* now let's look for the data chunk. Following the string "data" is the length of the following WAVE data. */ for (;;) { if (!read_tag(info->input,tag) || !read_le_long(info->input,&le_long)) { st_warning("reached end of file looking for data tag while processing file: [%s]",info->filename); return FALSE; } st_debug1("found chunk: [%c%c%c%c] with length: %lu",tag[0],tag[1],tag[2],tag[3],le_long); header_len += 8; if (!tagcmp(tag,(unsigned char *)WAVE_DATA)) break; bytes = le_long; while (bytes > 0) { if (fread(buf,1,1,info->input) != 1) { st_warning("reached end of file jumping ahead %lu bytes when looking for data tag while processing file: [%s]",le_long,info->filename); return FALSE; } bytes--; } header_len += le_long; } info->data_size = le_long; info->header_size = header_len; if (!do_header_kluges(NULL,info)) return FALSE; info->rate = ((wint)info->samples_per_sec * (wint)info->channels * (wint)info->bits_per_sample) / 8; info->total_size = info->chunk_size + 8; /* per RIFF specs, data chunk is always an even number of bytes - a NULL pad byte should be present when data size is odd */ info->padded_data_size = info->data_size; if (PROB_ODD_SIZED_DATA(info)) info->padded_data_size++; info->extra_riff_size = info->total_size - (info->padded_data_size + info->header_size); info->length = info->data_size / info->rate; info->exact_length = (double)info->data_size / (double)info->rate; if (info->channels == CD_CHANNELS && info->bits_per_sample == CD_BITS_PER_SAMPLE && info->samples_per_sec == CD_SAMPLES_PER_SEC && /* removed, since this doesn't seem to matter info->block_align == CD_BLOCK_ALIGN && */ info->avg_bytes_per_sec == CD_RATE && info->rate == CD_RATE) { if (info->data_size < CD_MIN_BURNABLE_SIZE) info->problems |= PROBLEM_CD_BUT_TOO_SHORT; if (info->data_size % CD_BLOCK_SIZE != 0) info->problems |= PROBLEM_CD_BUT_BAD_BOUND; } else info->problems |= PROBLEM_NOT_CD_QUALITY; if (info->header_size != CANONICAL_HEADER_SIZE) info->problems |= PROBLEM_HEADER_NOT_CANONICAL; if (info->data_size > info->total_size - (wlong)info->header_size) info->problems |= PROBLEM_HEADER_INCONSISTENT; if ((info->data_size % info->block_align) != 0) info->problems |= PROBLEM_DATA_NOT_ALIGNED; if (info->input_format && !info->input_format->is_compressed && !info->input_format->is_translated) { if (info->total_size < (info->actual_size - info->id3v2_tag_size)) info->problems |= PROBLEM_JUNK_APPENDED; if (info->total_size > (info->actual_size - info->id3v2_tag_size)) info->problems |= PROBLEM_MAY_BE_TRUNCATED; } if (info->extra_riff_size > 0) info->problems |= PROBLEM_EXTRA_CHUNKS; length_to_str(info); /* header looks ok */ return TRUE; } wave_info *new_wave_info(char *filename) /* if filename is NULL, return a fresh wave_info struct with all data zero'd out. * Otherwise, check that the file referenced by filename exists, is readable, and * contains a valid WAVE header - if so, return a wave_info struct filled out with * the values in the WAVE header, otherwise return NULL. */ { int i,bytes; FILE *f; wave_info *info; unsigned char buf[8]; char msg[BUF_SIZE],tmp[BUF_SIZE]; if (NULL == (info = malloc(sizeof(wave_info)))) { st_warning("could not allocate memory for WAVE info struct"); goto invalid_wave_data; } /* set defaults */ memset((void *)info,0,sizeof(wave_info)); if (NULL == filename) return info; info->filename = filename; if (!is_valid_file(info)) goto invalid_wave_data; /* check which format module (if any) handles this file */ for (i=0;st_formats[i];i++) { if (!st_formats[i]->supports_input) continue; if (st_formats[i]->is_our_file) { /* format defines its own checking function - use it */ if (!st_formats[i]->is_our_file(info->filename)) continue; } else { /* otherwise, check for format-defined magic string at a predefined offset (if defined) */ if (!check_for_magic(info->filename,st_formats[i]->magic,st_formats[i]->magic_offset)) continue; } /* found a format that claims to handle this file */ info->input_format = st_formats[i]; /* check if file contains an ID3v2 tag, and set flag accordingly */ if (NULL == (f = open_input_internal(info->filename,&info->file_has_id3v2_tag,&info->id3v2_tag_size))) { st_warning("open failed while setting ID3v2 flag for file: [%s]",info->filename); goto invalid_wave_data; } fclose(f); /* make sure the file can be opened by the output format - this skips over any ID3v2 tags in the stream */ if (!open_input_stream(info)) { st_debug1("input file could not be opened for streaming input by format: [%s]",st_formats[i]->name); goto invalid_wave_data; } /* make sure we can read data from the output format (primarily to ensure the decoder is sending us data) */ if (1 != fread(&buf,1,1,info->input)) { st_snprintf(msg,BUF_SIZE,"failed to read data from input file using format: [%s]\n",info->input_format->name); st_snprintf(tmp,BUF_SIZE,"+ you may not have permission to read file: [%s]\n",info->filename); strcat(msg,tmp); if (info->input_format->decoder) { st_snprintf(tmp,BUF_SIZE,"+ arguments may be incorrect for decoder: [%s]\n",info->input_format->decoder); strcat(msg,tmp); strcat(msg,"+ verify that the decoder is installed and in your PATH\n"); if (info->file_has_id3v2_tag) { strcat(msg,"+ removing the ID3v2 tag from this file may fix this\n"); } } strcat(msg,"+ this file may be unsupported, truncated or corrupt"); st_warning(msg); goto invalid_wave_data; } close_input_stream(info); info->input = NULL; /* reopen as input stream - this skips over any ID3v2 tags in the stream */ if (!open_input_stream(info)) goto invalid_wave_data; /* finally, make sure a proper WAVE header is being sent */ if (!verify_wav_header(info)) goto invalid_wave_data; close_input_stream(info); info->input = NULL; /* success */ return info; } /* if we got here, no file format modules claimed to handle the file */ st_warning("none of the builtin format modules handle input file: [%s]",info->filename); if ((f = open_input_internal(info->filename,&info->file_has_id3v2_tag,&info->id3v2_tag_size))) { bytes = read_n_bytes(f,buf,4,NULL); buf[bytes] = 0; for (i=0;ifile_has_id3v2_tag) st_debug1("after skipping %d-byte ID3v2 tag, found %d-byte magic header 0x%08X [%s] in file: [%s]",info->id3v2_tag_size,i,uchar_to_ulong_be(buf),buf,info->filename); else st_debug1("found %d-byte magic header 0x%08X [%s] in file: [%s]",i,uchar_to_ulong_be(buf),buf,info->filename); fclose(f); } invalid_wave_data: if (info) { if (info->input) { close_input_stream(info); info->input = NULL; } st_free(info); } return NULL; } void make_canonical_header(unsigned char *header,wave_info *info) /* constructs a canonical WAVE header from the values in the wave_info struct */ { if (NULL == header) return; tagcpy(header,(unsigned char *)WAVE_RIFF); ulong_to_uchar_le(header+4,info->chunk_size); tagcpy(header+8,(unsigned char *)WAVE_WAVE); tagcpy(header+12,(unsigned char *)WAVE_FMT); ulong_to_uchar_le(header+16,0x00000010); ushort_to_uchar_le(header+20,info->wave_format); ushort_to_uchar_le(header+22,info->channels); ulong_to_uchar_le(header+24,info->samples_per_sec); ulong_to_uchar_le(header+28,info->avg_bytes_per_sec); ushort_to_uchar_le(header+32,info->block_align); ushort_to_uchar_le(header+34,info->bits_per_sample); tagcpy(header+36,(unsigned char *)WAVE_DATA); ulong_to_uchar_le(header+40,info->data_size); } char *format_to_str(wshort format) { switch (format) { case WAVE_FORMAT_UNKNOWN: return "Microsoft Official Unknown"; case WAVE_FORMAT_PCM: return "Microsoft PCM"; case WAVE_FORMAT_ADPCM: return "Microsoft ADPCM"; case WAVE_FORMAT_IEEE_FLOAT: return "IEEE Float"; case WAVE_FORMAT_ALAW: return "Microsoft A-law"; case WAVE_FORMAT_MULAW: return "Microsoft U-law"; case WAVE_FORMAT_OKI_ADPCM: return "OKI ADPCM format"; case WAVE_FORMAT_IMA_ADPCM: return "IMA ADPCM"; case WAVE_FORMAT_DIGISTD: return "Digistd format"; case WAVE_FORMAT_DIGIFIX: return "Digifix format"; case WAVE_FORMAT_DOLBY_AC2: return "Dolby AC2"; case WAVE_FORMAT_GSM610: return "GSM 6.10"; case WAVE_FORMAT_ROCKWELL_ADPCM: return "Rockwell ADPCM"; case WAVE_FORMAT_ROCKWELL_DIGITALK: return "Rockwell DIGITALK"; case WAVE_FORMAT_G721_ADPCM: return "G.721 ADPCM"; case WAVE_FORMAT_G728_CELP: return "G.728 CELP"; case WAVE_FORMAT_MPEG: return "MPEG"; case WAVE_FORMAT_MPEGLAYER3: return "MPEG Layer 3"; case WAVE_FORMAT_G726_ADPCM: return "G.726 ADPCM"; case WAVE_FORMAT_G722_ADPCM: return "G.722 ADPCM"; } return "Unknown"; } void put_chunk_size(unsigned char *header,unsigned long new_chunk_size) /* replaces the chunk size at beginning of the wave header */ { if (NULL == header) return; ulong_to_uchar_le(header+4,new_chunk_size); } void put_data_size(unsigned char *header,int header_size,unsigned long new_data_size) /* replaces the size reported in the "data" chunk of the wave header with the new size - also updates chunk size at beginning of the wave header */ { if (NULL == header) return; ulong_to_uchar_le(header+header_size-4,new_data_size); put_chunk_size(header,new_data_size+header_size-8); } shntool-3.0.10/src/mode_info.c0000644000077100007710000001470511157756171013122 00000000000000/* mode_info.c - info mode module * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mode.h" CVSID("$Id: mode_info.c,v 1.78 2009/03/17 17:23:05 jason Exp $") static bool info_main(int,char **); static void info_help(void); mode_module mode_info = { "info", "shninfo", "Displays detailed information about PCM WAVE data", CVSIDSTR, FALSE, info_main, info_help }; static void info_help() { st_info("Usage: %s [OPTIONS] [files]\n",st_progname()); st_info("\n"); st_info("Mode-specific options:\n"); st_info("\n"); st_info(" -h show this help screen\n"); st_info("\n"); } static void parse(int argc,char **argv,int *first_arg) { int c; while ((c = st_getopt(argc,argv,"")) != -1); *first_arg = optind; } static bool show_info(wave_info *info) { wlong appended_bytes,missing_bytes; bool success; success = TRUE; st_output("-------------------------------------------------------------------------------\n"); st_output("File name: %s\n",info->filename); st_output("Handled by: %s format module\n",info->input_format->name); st_output("Length: %s\n",info->m_ss); st_output("WAVE format: 0x%04x (%s)\n",info->wave_format,format_to_str(info->wave_format)); st_output("Channels: %hu\n",info->channels); st_output("Bits/sample: %hu\n",info->bits_per_sample); st_output("Samples/sec: %lu\n",info->samples_per_sec); st_output("Average bytes/sec: %lu\n",info->avg_bytes_per_sec); st_output("Rate (calculated): %lu\n",info->rate); st_output("Block align: %hu\n",info->block_align); st_output("Header size: %d bytes\n",info->header_size); st_output("Data size: %lu byte%s\n",info->data_size,(1 == info->data_size)?"":"s"); st_output("Chunk size: %lu bytes\n",info->chunk_size); st_output("Total size (chunk size + 8): %lu bytes\n",info->total_size); st_output("Actual file size: %lu\n",info->actual_size); st_output("File is compressed: %s\n",(info->input_format->is_compressed)?"yes":"no"); st_output("Compression ratio: %0.4f\n",(double)info->actual_size/(double)info->total_size); st_output("CD-quality properties:\n"); st_output(" CD quality: %s\n",(PROB_NOT_CD(info))?"no":"yes"); st_output(" Cut on sector boundary: %s\n",(PROB_NOT_CD(info))?"n/a":((PROB_BAD_BOUND(info))?"no":"yes")); st_output(" Sector misalignment: "); if (PROB_NOT_CD(info)) st_output("n/a\n"); else st_output("%lu byte%s\n",info->data_size % CD_BLOCK_SIZE,(1 == (info->data_size % CD_BLOCK_SIZE))?"":"s"); st_output(" Long enough to be burned: "); if (PROB_NOT_CD(info)) st_output("n/a\n"); else { if (PROB_TOO_SHORT(info)) st_output("no -- needs to be at least %d bytes\n",CD_MIN_BURNABLE_SIZE); else st_output("yes\n"); } st_output("WAVE properties:\n"); st_output(" Non-canonical header: %s\n",(PROB_HDR_NOT_CANONICAL(info))?"yes":"no"); st_output(" Extra RIFF chunks: "); if (PROB_EXTRA_CHUNKS(info)) { if (PROB_ODD_SIZED_DATA(info)) st_output("yes (%ld or %ld bytes)\n",info->extra_riff_size,info->extra_riff_size + 1); else st_output("yes (%ld bytes)\n",info->extra_riff_size); } else st_output("no\n"); st_output("Possible problems:\n"); st_output(" File contains ID3v2 tag: "); if (info->file_has_id3v2_tag) st_output("yes (%lu bytes)\n",info->id3v2_tag_size); else st_output("no\n"); st_output(" Data chunk block-aligned: "); if (PROB_DATA_NOT_ALIGNED(info)) st_output("no\n"); else st_output("yes\n"); st_output(" Inconsistent header: %s\n",(PROB_HDR_INCONSISTENT(info))?"yes":"no"); st_output(" File probably truncated: "); if (!info->input_format->is_compressed && !info->input_format->is_translated) { if (PROB_TRUNCATED(info)) { missing_bytes = info->total_size - (info->actual_size - info->id3v2_tag_size); st_output("yes (missing %lu byte%s)\n",missing_bytes,(1 == missing_bytes)?"":"s"); } else st_output("no\n"); } else st_output("unknown\n"); st_output(" Junk appended to file: "); if (!info->input_format->is_compressed && !info->input_format->is_translated) { appended_bytes = info->actual_size - info->total_size - info->id3v2_tag_size; if (PROB_JUNK_APPENDED(info) && appended_bytes > 0) st_output("yes (%lu byte%s)\n",appended_bytes,(1 == appended_bytes)?"":"s"); else st_output("no\n"); } else st_output("unknown\n"); st_output(" Odd data size has pad byte: "); if (PROB_ODD_SIZED_DATA(info)) { if (-1 == info->extra_riff_size) st_output("no\n"); else if (0 == info->extra_riff_size) st_output("yes\n"); else st_output("unknown\n"); } else { st_output("n/a\n"); } if (info->input_format->extra_info) { st_output("Extra %s-specific info:\n",info->input_format->name); info->input_format->extra_info(info->filename); } return success; } static bool process_file(char *filename) { wave_info *info; bool success; if (NULL == (info = new_wave_info(filename))) return FALSE; success = show_info(info); st_free(info); return success; } static bool process(int argc,char **argv,int start) { char *filename; bool success; success = TRUE; input_init(start,argc,argv); while ((filename = input_get_filename())) { success = (process_file(filename) && success); } return success; } static bool info_main(int argc,char **argv) { int first_arg; parse(argc,argv,&first_arg); return process(argc,argv,first_arg); } shntool-3.0.10/src/core_format.c0000644000077100007710000003347011155771111013450 00000000000000/* core_format.c - public functions for format modules * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include #include #include #include #include #include "shntool.h" CVSID("$Id: core_format.c,v 1.44 2009/03/11 17:18:01 jason Exp $") /* private helper functions */ #define spawn_input(a,b,c,d) spawn(a,b,c,d,CHILD_INPUT,NULL) #define spawn_output(a,b,c,d) spawn(a,b,c,d,CHILD_OUTPUT,NULL) #define spawn_input_fd(a,b,c,d,e) spawn(a,b,c,d,CHILD_INPUT,e) #define spawn_output_fd(a,b,c,d,e) spawn(a,b,c,d,CHILD_OUTPUT,e) static void get_quoted_arg_list(child_args *process_args,char *arg_list) { int i; char tmp[BUF_SIZE]; strcpy(arg_list,""); for (i=0;inum_args;i++) { st_snprintf(tmp,BUF_SIZE,"%s\"%s\"",(0==i)?"":" ",process_args->args[i]); strcat(arg_list,tmp); } } static void spawn(child_args *process_args,FILE **readpipe,FILE **writepipe,proc_info *pinfo,int child_type,FILE *inputstream) /* forks off a process running the command cmd, and sets up read/write * pipes for two-way communication with that process */ { char quoted_args[BUF_SIZE]; #ifdef WIN32 /* the bulk of the following code was taken from Microsoft Knowledge Base * Article ID 190351 (Revision 7.1) -- "How to spawn console processes with * redirected standard handles". URL: */ STARTUPINFO si; PROCESS_INFORMATION pi; SECURITY_ATTRIBUTES sa; HANDLE hOutputReadTmp,hOutputRead,hOutputWrite; HANDLE hInputWriteTmp,hInputRead,hInputWrite; HANDLE hErrorWrite; /* set security attributes */ sa.nLength = sizeof(SECURITY_ATTRIBUTES); sa.lpSecurityDescriptor = NULL; sa.bInheritHandle = TRUE; /* create the child stdout pipe */ if (!CreatePipe(&hOutputReadTmp,&hOutputWrite,&sa,0)) { st_error("error while creating output pipe for two-way communication with child process"); } /* create the child stdin pipe */ if (!CreatePipe(&hInputRead,&hInputWriteTmp,&sa,0)) { st_error("error while creating input pipe for two-way communication with child process"); } /* send child stderr to /dev/null */ if (!(hErrorWrite = CreateFile(NULLDEVICE,GENERIC_WRITE,FILE_SHARE_WRITE,&sa,OPEN_EXISTING,0,NULL))) { st_error("error while redirecting child stderr"); } /* connect child stdin to parent output */ if (!DuplicateHandle(GetCurrentProcess(),hOutputReadTmp,GetCurrentProcess(),&hOutputRead,0,FALSE,DUPLICATE_SAME_ACCESS)) { st_error("error while duplicating input pipe for two-way communication with child process"); } /* connect child stdout to parent input */ if (!DuplicateHandle(GetCurrentProcess(),hInputWriteTmp,GetCurrentProcess(),&hInputWrite,0,FALSE,DUPLICATE_SAME_ACCESS)) { st_error("error while duplicating error pipe for two-way communication with child process"); } /* close unneeded handles */ if (!CloseHandle(hOutputReadTmp) || !CloseHandle(hInputWriteTmp)) { st_error("error while closing handle(s)"); } /* set up child process environment */ ZeroMemory(&si,sizeof(STARTUPINFO)); si.cb = sizeof(STARTUPINFO); si.dwFlags = STARTF_USESTDHANDLES; si.hStdOutput = hOutputWrite; si.hStdInput = hInputRead; si.hStdError = hErrorWrite; si.wShowWindow = SW_HIDE; /* get quoted args */ get_quoted_arg_list(process_args,quoted_args); if (!CreateProcess(NULL,quoted_args,NULL,NULL,TRUE,0,NULL,NULL,&si,&pi)) { st_warning("error while launching helper program: [%s]",process_args->args[0]); *readpipe = NULL; *writepipe = NULL; pinfo->pid = NO_CHILD_PID; pinfo->hProcess = NULL; return; } /* grab the child pid */ pinfo->pid = (int)pi.dwProcessId; pinfo->hProcess = pi.hProcess; if (!CloseHandle(pi.hThread)) { st_error("error closing thread handle"); } if (!CloseHandle(hOutputWrite) || !CloseHandle(hInputRead) || !CloseHandle(hErrorWrite)) { st_error("error while closing handle(s)"); } *readpipe = fdopen(_open_osfhandle((intptr_t)hOutputRead,0),"rb"); *writepipe = fdopen(_open_osfhandle((intptr_t)hInputWrite,0),"wb"); #else int pipe1[2], pipe2[2]; int i,nullfd,max_fds; /* create pipes for two-way communication */ if ((pipe(pipe1) < 0) || (pipe(pipe2) < 0)) { perror("shntool: pipe"); st_error("error while creating pipes for two-way communication with child process"); } /* fork child process */ switch ((pinfo->pid = fork())) { case -1: /* fork failed */ perror("shntool: fork"); st_error("error while forking child process"); break; case 0: /* child */ close(pipe1[1]); close(pipe2[0]); /* Read from parent on pipe1[0], write to parent on pipe2[1]. */ if (inputstream) { dup2(fileno(inputstream),0); close(fileno(inputstream)); } else { dup2(pipe1[0],0); } dup2(pipe2[1],1); close(pipe1[0]); close(pipe2[1]); /* make sure stderr is connected to /dev/null, or closed if that fails */ close(2); nullfd = open(NULLDEVICE,O_WRONLY); if (nullfd > 0 && 2 != nullfd) dup2(nullfd,2); SETBINARY_FD(0); SETBINARY_FD(1); SETBINARY_FD(2); #ifdef HAVE_SYSCONF max_fds = sysconf(_SC_OPEN_MAX); #else max_fds = 1024; #endif /* close all other file descriptors */ for (i=3;iargs[0],process_args->args) < 0) { perror("shntool: execvp"); st_error("error while launching helper program: [%s]",process_args->args[0]); } break; default: /* parent */ close(pipe1[0]); close(pipe2[1]); /* Write to child on pipe1[1], read from child on pipe2[0]. */ *readpipe = fdopen(pipe2[0],"rb"); *writepipe = fdopen(pipe1[1],"wb"); /* set characteristics of pipes */ SETBINARY_IN(*readpipe); SETBINARY_OUT(*writepipe); break; } /* get quoted args */ get_quoted_arg_list(process_args,quoted_args); #endif st_debug2("spawned %s process with pid %d and command line: %s",(CHILD_INPUT == child_type)?"input":"output",pinfo->pid,quoted_args); } static void arg_build(child_args *result,child_args *template,char *filename) { int i; arg_reset(result); for (i=0;inum_args;i++) { if (NULL == template->args[i]) { if (0 == i) { st_error("while building argument list: encoder/decoder not defined or unspecified"); } else { st_error("while building argument list: encoder/decoder argument %d not defined",i); } } if (strstr(template->args[i],FILENAME_PLACEHOLDER)) { arg_add(result,filename); } else { arg_add(result,template->args[i]); } } } static bool clobber_ask(char *filename) { char response[BUF_SIZE]; st_debug1("asking whether to clobber file: [%s]",filename); st_info("\n"); /* some modes read files/split points/etc. from stdin, so we can't ask. force user to use -O option */ if (!isatty(fileno(stdin)) || feof(stdin)) st_error("standard input is not a terminal -- cannot prompt for overwrite action. use \"-O always\" or \"-O never\"."); st_priv.screen_dirty = TRUE; while (1) { st_info("File already exists: [%s]\n",filename); st_info("Overwrite ([y]es, [n]o, [a]lways, ne[v]er, [r]ename)? "); fgets(response,BUF_SIZE-1,stdin); if (feof(stdin)) st_info("\n"); trim(response); switch (response[0]) { case 'y': case 'Y': return TRUE; break; case 'n': case 'N': return FALSE; break; case 'a': case 'A': st_priv.clobber_action = CLOBBER_ACTION_ALWAYS; return TRUE; break; case 'v': case 'V': st_priv.clobber_action = CLOBBER_ACTION_NEVER; return FALSE; break; case 'r': case 'R': strcpy(response,""); while (!strcmp(response,"")) { st_info("New name: "); fgets(response,BUF_SIZE-1,stdin); trim(response); } strcpy(filename,response); return clobber_check(filename); break; default: break; } } } static void verify_format_generic(format_module *fm,child_args *template,char *type) { int i; bool found_filename; found_filename = FALSE; for (i=0;inum_args;i++) { if (NULL == template->args[i]) { if (0 == i) { st_error("%s argument list does not specify the %s for format: [%s]",type,type,fm->name); } else { st_error("%s argument %d is undefined for format: [%s]",type,i,fm->name); } } if ((0 != i) && strstr(template->args[i],FILENAME_PLACEHOLDER)) { found_filename = TRUE; } } if (!found_filename) st_error("%s argument list does not contain filename placeholder [%s] for format: [%s]",type,FILENAME_PLACEHOLDER,fm->name); } static void verify_format_input(format_module *fm) { if (!fm->decoder) st_error("format requires a decoder: [%s]",fm->name); verify_format_generic(fm,&fm->input_args_template,"decoder"); } static void verify_format_output(format_module *fm) { if (!fm->encoder) st_error("format requires an encoder: [%s]",fm->name); verify_format_generic(fm,&fm->output_args_template,"encoder"); } /* public functions */ void tagcpy(unsigned char *dest,unsigned char *src) /* simple copy of a tag from src to dest. NOTE: src MUST be NULL-terminated, * and the trailing NULL byte is NOT copied. This routine assumes that dest * is large enough to contain src. */ { int i; for (i=0;*(src+i);i++) *(dest+i) = *(src+i); } int tagcmp(unsigned char *got,unsigned char *expected) /* compare got against expected, up to the length of expected */ { int i; for (i=0;*(expected+i);i++) { if (*(got+i) != *(expected+i)) return i+1; } return 0; } bool check_for_magic(char *filename,char *magic,int offset) { FILE *file; int magiclen, bytes, bytes_to_discard; unsigned char buf[XFER_SIZE]; if (NULL == magic || !strcmp(magic,"")) return FALSE; if (offset < 0) return FALSE; if (NULL == (file = open_input(filename))) return FALSE; magiclen = strlen(magic); bytes_to_discard = offset; /* skip to magic header */ while (bytes_to_discard > 0) { bytes = min(bytes_to_discard,XFER_SIZE); if (bytes!= fread(buf,1,bytes,file)) { fclose(file); return FALSE; } bytes_to_discard -= bytes; } /* read magic header */ if (magiclen != fread(buf,1,magiclen,file)) { fclose(file); return FALSE; } fclose(file); if (!tagcmp(buf,(unsigned char *)magic)) return TRUE; return FALSE; } format_module *find_format(char *fmtname) { int i; format_module *op = NULL; char *p,*seps = " \t",tmp[BUF_SIZE]; if (NULL == fmtname) st_help("missing file format"); strcpy(tmp,fmtname); p = strtok(tmp,seps); if (NULL == p) return NULL; for (i=0;st_formats[i];i++) { if (!strcmp(p,st_formats[i]->name)) { op = st_formats[i]; break; } } if (NULL == op) st_help("invalid file format: [%s]",p); return op; } FILE *launch_input(format_module *fm,char *filename,proc_info *pinfo) { FILE *input,*output,*f; bool file_has_id3v2_tag; verify_format_input(fm); if (fm->stdin_for_id3v2_kluge) { /* check for ID3v2 tag on input */ f = open_input_internal(filename,&file_has_id3v2_tag,NULL); if (f && file_has_id3v2_tag) { st_debug1("input file has an ID3v2 tag -- attempting to trick helper program: [%s]",fm->decoder); } else { file_has_id3v2_tag = FALSE; } arg_build(&fm->input_args,&fm->input_args_template,(file_has_id3v2_tag)?fm->stdin_for_id3v2_kluge:filename); if (file_has_id3v2_tag) { spawn_input_fd(&fm->input_args,&input,&output,pinfo,f); fclose(f); } else { spawn_input(&fm->input_args,&input,&output,pinfo); } } else { arg_build(&fm->input_args,&fm->input_args_template,filename); spawn_input(&fm->input_args,&input,&output,pinfo); } if (output) fclose(output); return input; } FILE *launch_output(format_module *fm,char *filename,proc_info *pinfo) { FILE *input,*output; verify_format_output(fm); if (!clobber_check(filename)) return NULL; arg_build(&fm->output_args,&fm->output_args_template,filename); spawn_output(&fm->output_args,&input,&output,pinfo); if (input) fclose(input); return output; } bool clobber_check(char *filename) /* function to check if a file is about to be clobbered, and if so, asks whether this is OK */ { struct stat sz; bool retcode = FALSE; if (stat(filename,&sz)) { /* file doesn't exist, so it's ok to clobber it. ;) */ return TRUE; } switch (st_priv.clobber_action) { case CLOBBER_ACTION_ASK: retcode = clobber_ask(filename); break; case CLOBBER_ACTION_ALWAYS: st_debug1("clobbering file: [%s]",filename); retcode = TRUE; break; case CLOBBER_ACTION_NEVER: st_debug1("refusing to clobber file: [%s]",filename); retcode = FALSE; break; } /* remove file if it exists, in case encoders check for its existence */ if (retcode) remove_file(filename); return retcode; } shntool-3.0.10/src/mode_trim.c0000644000077100007710000002420311157756171013134 00000000000000/* mode_trim.c - trim mode module * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mode.h" CVSID("$Id: mode_trim.c,v 1.56 2009/03/17 17:23:05 jason Exp $") static bool trim_main(int,char **); static void trim_help(void); mode_module mode_trim = { "trim", "shntrim", "Trims PCM WAVE silence from the ends of files", CVSIDSTR, TRUE, trim_main, trim_help }; #define TRIM_POSTFIX "-trimmed" static bool trim_beginning = TRUE; static bool trim_end = TRUE; static void trim_help() { st_info("Usage: %s [OPTIONS] [files]\n",st_progname()); st_info("\n"); st_info("Mode-specific options:\n"); st_info("\n"); st_info(" -b only trim silence from the beginning of files\n"); st_info(" -e only trim silence from the end of files\n"); st_info(" -h show this help screen\n"); st_info("\n"); } static void parse(int argc,char **argv,int *first_arg) { int c; st_ops.output_directory = INPUT_FILE_DIR; st_ops.output_postfix = TRIM_POSTFIX; while ((c = st_getopt(argc,argv,"be")) != -1) { switch (c) { case 'b': trim_beginning = TRUE; trim_end = FALSE; break; case 'e': trim_beginning = FALSE; trim_end = TRUE; break; } } *first_arg = optind; } static void do_read_cached(wave_info *info,char *buf,int req_bytes,progress_info *proginfo) /* implements a local cache of data read from a file descriptor. * this is needed because scan_file() below only wants to read a few * bytes at a time, which is inefficient. */ { static char cache[XFER_SIZE]; static int cur_pos; static int cur_max; static int cur_total; int bytes_read, req_filled; /* check if being initialized */ if (NULL == info) { cur_pos = XFER_SIZE; cur_max = XFER_SIZE; cur_total = 0; return; } /* first, read from cached data */ req_filled = 0; while (cur_pos < cur_max && req_filled < req_bytes) { buf[req_filled] = cache[cur_pos]; cur_pos++; req_filled++; cur_total++; } if (req_filled == req_bytes) return; /* ran out of cached data - try to read more from the file descriptor */ cur_pos = 0; cur_max = min(info->data_size - (wlong)cur_total,XFER_SIZE); if (cur_max != (bytes_read = fread(cache,1,cur_max,info->input))) { prog_error(proginfo); st_error("error while reading %d bytes into local cache from input file",cur_max); } proginfo->bytes_written += bytes_read; prog_update(proginfo); do_read_cached(info,buf+req_filled,req_bytes-req_filled,proginfo); } static void scan_file(wave_info *info,wlong *skip_beginning,wlong *skip_end,progress_info *proginfo) { int sample_size,i; bool is_silence,found_noise; char sample[BUF_SIZE]; wlong bytes_to_read,bytes_remaining,tmp_beginning_bytes,tmp_end_bytes; if (!open_input_stream(info)) { st_warning("could not open input file: [%s]",info->filename); return; } discard_header(info); sample_size = ((int)info->bits_per_sample * (int)info->channels) / 8; tmp_beginning_bytes = 0; tmp_end_bytes = 0; found_noise = FALSE; bytes_remaining = info->data_size; do_read_cached(NULL,sample,0,proginfo); while (bytes_remaining > 0) { bytes_to_read = min(bytes_remaining,sample_size); do_read_cached(info,sample,bytes_to_read,proginfo); /* compare this sample against silence (all zeroes) */ is_silence = TRUE; for (i=0;ifilename; proginfo.filedesc1 = info->m_ss; proginfo.filename2 = NULL; proginfo.filedesc2 = NULL; proginfo.bytes_total = info->total_size; prog_update(&proginfo); create_output_filename(info->filename,info->input_format->extension,outfilename); if (files_are_identical(info->filename,outfilename)) { prog_error(&proginfo); st_warning("output file would overwrite input file -- skipping."); return FALSE; } scan_file(info,&skip_beginning,&skip_end,&proginfo); if (!trim_beginning) skip_beginning = 0; if (!trim_end) skip_end = 0; data_bytes = info->data_size - (skip_beginning + skip_end); if ((skip_beginning == info->data_size) || (skip_end == info->data_size)) { prog_error(&proginfo); st_warning("input file contains nothing but silence -- skipping."); return FALSE; } if (data_bytes == info->data_size) { prog_error(&proginfo); st_warning("input file has no silence to trim from %s -- skipping.", (trim_beginning && trim_end) ? "either end" : ((trim_beginning) ? "the beginning" : "the end")); return FALSE; } prog_success(&proginfo); proginfo.prefix = "Trimming"; proginfo.clause = "-->"; proginfo.filename2 = outfilename; proginfo.bytes_total = info->total_size; prog_update(&proginfo); has_null_pad = odd_sized_data_chunk_is_null_padded(info); if (!open_input_stream(info)) { prog_error(&proginfo); st_warning("could not open input file -- skipping."); return FALSE; } if (NULL == (output = open_output_stream(outfilename,&output_proc))) { prog_error(&proginfo); st_warning("could not open output file -- skipping."); goto cleanup; } prog_update(&proginfo); if (NULL == (header = malloc(info->header_size * sizeof(unsigned char)))) { prog_error(&proginfo); st_warning("could not allocate %d-byte WAVE header -- skipping.",info->header_size); goto cleanup; } if (read_n_bytes(info->input,header,info->header_size,&proginfo) != info->header_size) { prog_error(&proginfo); st_warning("error while discarding %d-byte WAVE header -- skipping.",info->header_size); goto cleanup; } if (!do_header_kluges(header,info)) { prog_error(&proginfo); st_warning("could not fix WAVE header -- skipping."); goto cleanup; } put_data_size(header,info->header_size,data_bytes); if (PROB_EXTRA_CHUNKS(info)) { if (!has_null_pad) info->extra_riff_size++; put_chunk_size(header,info->header_size+data_bytes+info->extra_riff_size-8); } else put_chunk_size(header,info->header_size+data_bytes-8); if ((info->header_size > 0) && write_n_bytes(output,header,info->header_size,&proginfo) != info->header_size) { prog_error(&proginfo); st_warning("error while writing %d-byte WAVE header -- skipping.",info->header_size); goto cleanup; } if (NULL == (devnull = open_output(NULLDEVICE))) { prog_error(&proginfo); st_warning("could not open output file: [%s]",NULLDEVICE); goto cleanup; } /* trim from beginning */ if ((skip_beginning > 0) && (transfer_n_bytes(info->input,devnull,skip_beginning,&proginfo) != skip_beginning)) { prog_error(&proginfo); st_warning("error while trimming %lu bytes from beginning of file -- skipping.",skip_beginning); goto cleanup; } /* write middle data */ if (transfer_n_bytes(info->input,output,data_bytes,&proginfo) != data_bytes) { prog_error(&proginfo); st_warning("error while transferring %lu bytes -- skipping.",data_bytes); goto cleanup; } /* trim from end */ if ((skip_end > 0) && (transfer_n_bytes(info->input,devnull,skip_end,&proginfo) != skip_end)) { prog_error(&proginfo); st_warning("error while trimming %lu bytes from end of file -- skipping.",skip_end); goto cleanup; } if (PROB_ODD_SIZED_DATA(info) && has_null_pad) { if (1 != read_n_bytes(info->input,nulltrim,1,NULL)) { prog_error(&proginfo); st_warning("error while discarding NULL pad byte"); goto cleanup; } } /* write extra riff info */ if ((info->extra_riff_size > 0) && (transfer_n_bytes(info->input,output,info->extra_riff_size,&proginfo) != info->extra_riff_size)) { prog_error(&proginfo); st_warning("error while transferring %lu extra bytes -- skipping.",info->extra_riff_size); goto cleanup; } success = TRUE; prog_success(&proginfo); cleanup: st_free(header); if ((output) && ((CLOSE_CHILD_ERROR_OUTPUT == close_output(output,output_proc)) || !success)) { success = FALSE; remove_file(outfilename); } if (devnull) fclose(devnull); close_input_stream(info); return success; } static bool process_file(char *filename) { wave_info *info; bool success; if (NULL == (info = new_wave_info(filename))) return FALSE; success = trim_file(info); st_free(info); return success; } static bool process(int argc,char **argv,int start) { char *filename; bool success; success = TRUE; input_init(start,argc,argv); while ((filename = input_get_filename())) { success = (process_file(filename) && success); } return success; } static bool trim_main(int argc,char **argv) { int first_arg; parse(argc,argv,&first_arg); return process(argc,argv,first_arg); } shntool-3.0.10/src/format_aiff.c0000644000077100007710000001110511155771111013414 00000000000000/* format_aiff.c - aiff format module * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "format.h" CVSID("$Id: format_aiff.c,v 1.80 2009/03/11 17:18:01 jason Exp $") #define SOX "sox" static char default_decoder_args[] = "-t aiff " FILENAME_PLACEHOLDER " -t wav -"; static char default_encoder_args[] = "-t wav - -t aiff " FILENAME_PLACEHOLDER; static bool is_our_file(char *); static bool input_header_kluge(unsigned char *,wave_info *); format_module format_aiff = { "aiff", "Audio Interchange File Format", CVSIDSTR, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, "-", NULL, 0, "aiff", SOX, default_decoder_args, SOX, default_encoder_args, is_our_file, NULL, NULL, NULL, NULL, input_header_kluge }; static bool parse_aiff_header(char *filename,unsigned long *samples,unsigned short *channels,unsigned short *bits_per_sample) /* generic function to parse an AIFF header and store certain values contained therein */ { FILE *f; unsigned long be_long = 0; unsigned short be_short = 0; unsigned char tag[4]; bool is_compressed = FALSE; *samples = 0; *channels = 0; *bits_per_sample = 0; if (NULL == (f = open_input(filename))) return FALSE; /* look for FORM header */ if (!read_tag(f,tag) || tagcmp(tag,(unsigned char *)AIFF_FORM)) goto invalid_aiff_header; /* skip FORM chunk size, read in FORM type */ if (!read_be_long(f,&be_long) || !read_tag(f,tag)) goto invalid_aiff_header; /* if FORM type is not AIFF or AIFC, bail out */ if (tagcmp(tag,(unsigned char *)AIFF_FORM_TYPE_AIFF) && tagcmp(tag,(unsigned char *)AIFF_FORM_TYPE_AIFC)) goto invalid_aiff_header; if (!tagcmp(tag,(unsigned char *)AIFF_FORM_TYPE_AIFC)) is_compressed = TRUE; /* now let's check AIFC compression type - it's in the COMM chunk */ while (1) { /* read chunk id */ if (!read_tag(f,tag)) goto invalid_aiff_header; if (!tagcmp(tag,(unsigned char *)AIFF_COMM)) break; /* not COMM, so read size of this chunk and skip it */ if (!read_be_long(f,&be_long) || fseek(f,(long)be_long,SEEK_CUR)) goto invalid_aiff_header; } /* now read channels, samples, and bits/sample from COMM chunk */ if (!read_be_long(f,&be_long) || !read_be_short(f,channels) || !read_be_long(f,samples) || !read_be_short(f,bits_per_sample) || !read_be_long(f,&be_long) || !read_be_long(f,&be_long) || !read_be_short(f,&be_short)) { goto invalid_aiff_header; } if (is_compressed) { if (!read_tag(f,tag)) goto invalid_aiff_header; if (tagcmp(tag,(unsigned char *)AIFF_COMPRESSION_NONE) && tagcmp(tag,(unsigned char *)AIFF_COMPRESSION_SOWT)) { st_debug1("found unsupported AIFF-C compression type [%c%c%c%c]",tag[0],tag[1],tag[2],tag[3]); goto invalid_aiff_header; } } fclose(f); return TRUE; invalid_aiff_header: fclose(f); return FALSE; } static bool is_our_file(char *filename) { unsigned long be_long=0; unsigned short be_short=0; return parse_aiff_header(filename,&be_long,&be_short,&be_short); } static bool input_header_kluge(unsigned char *header,wave_info *info) /* kluge to set data_size and chunk_size, since sox can't fseek() on * stdout to backfill these values. This relies on values in the * COMM chunk. */ { unsigned long samples = 0; unsigned short channels = 0,bits_per_sample = 0; if (!parse_aiff_header(info->filename,&samples,&channels,&bits_per_sample)) return FALSE; /* set proper data size */ info->data_size = channels * samples * (bits_per_sample/8); st_debug1("adjusting data size to: %lu",info->data_size); /* now set chunk size based on data size, and the canonical WAVE header size, which sox generates */ info->chunk_size = info->data_size + CANONICAL_HEADER_SIZE - 8; if (PROB_ODD_SIZED_DATA(info)) info->chunk_size++; make_canonical_header(header,info); return TRUE; } shntool-3.0.10/src/format_tta.c0000644000077100007710000000256611155771111013312 00000000000000/* format_tta.c - tta format module * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "format.h" CVSID("$Id: format_tta.c,v 1.24 2009/03/11 17:18:01 jason Exp $") #define TTA "ttaenc" #define TTA_MAGIC "TTA1" static char default_decoder_args[] = "-d -o - " FILENAME_PLACEHOLDER; static char default_encoder_args[] = "-e -o " FILENAME_PLACEHOLDER " -"; format_module format_tta = { "tta", "TTA Lossless Audio Codec", CVSIDSTR, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, NULL, TTA_MAGIC, 0, "tta", TTA, default_decoder_args, TTA, default_encoder_args, NULL, NULL, NULL, NULL, NULL, NULL }; shntool-3.0.10/src/core_mode.c0000644000077100007710000013447711164057325013121 00000000000000/* core_mode.c - public functions for mode modules * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include #include #include #include #include #include #ifndef WIN32 #include #endif #include #include "shntool.h" CVSID("$Id: core_mode.c,v 1.88 2009/03/30 05:55:33 jason Exp $") global_opts st_ops; /* private functions */ #define parse_input_args_cmd(a,b) parse_args(a,b,FALSE,ARGSRC_CMDLINE) #define parse_output_args_cmd(a,b) parse_args(a,b,TRUE,ARGSRC_CMDLINE) #define parse_input_args_env(a,b) parse_args(a,b,FALSE,ARGSRC_ENV) #define parse_output_args_env(a,b) parse_args(a,b,TRUE,ARGSRC_ENV) #define parse_input_args_fmt(a,b) parse_args(a,b,FALSE,ARGSRC_FORMAT) #define parse_output_args_fmt(a,b) parse_args(a,b,TRUE,ARGSRC_FORMAT) static void parse_args(format_module *fm,char *argstr,bool is_output,int argsrc) { char *argdup,*token,*seps = " \t",*extstr = "ext=",*argsrcstr; child_args *ca; if (NULL == argstr) return; argdup = strdup(argstr); if (NULL == argdup) st_error("argument string duplication failed"); switch (argsrc) { case ARGSRC_ENV: argsrcstr = "environment"; break; case ARGSRC_CMDLINE: argsrcstr = "command line"; break; case ARGSRC_FORMAT: default: argsrcstr = PACKAGE; break; } st_debug1("parsing [%s] %s argument string originating from %s: [%s]",fm->name,(is_output)?"encoder":"decoder",argsrcstr,argstr); ca = (is_output) ? &fm->output_args_template : &fm->input_args_template; /* read first token */ token = strtok(argdup,seps); /* skip certain arguments based on the source of the string we're parsing. format default = "arg1 arg2 ... argN" environment = "prog arg1 arg2 ... argN" command line = "format prog arg1 arg2 ... argN" */ switch (argsrc) { case ARGSRC_CMDLINE: /* discard format name */ if (NULL == token) return; token = strtok(NULL,seps); /* fall through */ case ARGSRC_ENV: /* check for program name ("prog" or "ext=abc prog") */ if (NULL == token) return; if (is_output) { /* output format: check for "ext=abc" */ if (strstr(token,extstr) == token) { fm->extension = token + strlen(extstr); st_debug1("changing %s output extension to: [%s]",fm->name,fm->extension); token = strtok(NULL,seps); } if (NULL == token) return; /* output format: this is the program name */ fm->encoder = token; } else { /* input format: this is the program name */ fm->decoder = token; } arg_replace(ca,0,token); token = strtok(NULL,seps); /* fall through */ case ARGSRC_FORMAT: default: break; } /* check if there are any program arguments specified */ if (NULL == token) return; /* if more arguments exist, they must be encoder/decoder args, so start modifying the existing arg list */ arg_reset(ca); arg_add(ca,(is_output)?fm->encoder:fm->decoder); while (token) { arg_add(ca,token); token = strtok(NULL,seps); } } static void rename_by_extension(child_args *outargs,char *filename,char *outfilename,char *input_extension,char *output_extension) /* function to properly name an output file based on the input filename, prefix/postfixes, and extensions */ { char dirname[FILENAME_SIZE], newbasename[FILENAME_SIZE], outdirname[FILENAME_SIZE], custprefix[FILENAME_SIZE], custpostfix[FILENAME_SIZE], tmp[FILENAME_SIZE], *base,*ext,*outdir,*p,*extension; int i; /* get user-specified prefix/postfix in %f filename, if any */ strcpy(custprefix,""); strcpy(custpostfix,""); if (outargs) { p = NULL; for (i=0;inum_args;i++) { if (NULL == outargs->args[i]) continue; if ((p = strstr(outargs->args[i],FILENAME_PLACEHOLDER))) break; } if (p) { /* get postfix (everything after %f) */ strcpy(custpostfix,p+strlen(FILENAME_PLACEHOLDER)); /* get prefix (everything before %f) */ strcat(custprefix,outargs->args[i]); *(strstr(custprefix,FILENAME_PLACEHOLDER)) = 0; } } /* next, copy directory name, if any */ strcpy(dirname,filename); base = basename(dirname); if (base) *base = 0; /* now get base filename as well as its extension */ base = basename(filename); strcpy(newbasename,base); ext = extname(newbasename); /* if input filename's extension matches the input format's default extension, then swap it with the output format's extension. otherwise, append the output format's extension to whatever's there */ if (ext && input_extension && !strcmp(ext,input_extension)) *(ext-1) = 0; /* set output directory */ outdir = dirname; if (strcmp(st_ops.output_directory,"")) outdir = st_ops.output_directory; strcpy(outdirname,outdir); #if 0 /* leave this out for now... we may be getting too fancy. let the underlying OS handle it. * the repeated '/' case below is more straightforward, and harder to screw up, so that stays in for now. */ /* remove all occurrences of '/./' - it's redundant */ p = outdirname; while (*p) { if (0 == *(p+1)) break; while ((*(p+2)) && (PATHSEPCHAR == *p) && ('.' == *(p+1)) && (PATHSEPCHAR == *(p+2))) { strcpy(p,p+2); } p++; } #endif /* remove duplicate '/' (e.g. "/path///to/output///dir//" becomes "/path/to/output/dir/") */ p = outdirname; while (*p) { while ((*(p+1)) && (PATHSEPCHAR == *p) && (PATHSEPCHAR == *(p+1))) { strcpy(p+1,p+2); } p++; } st_snprintf(tmp,FILENAME_SIZE,".%c",PATHSEPCHAR); if (!strcmp(outdirname,".") || !strcmp(outdirname,tmp)) strcpy(outdirname,""); st_snprintf(tmp,FILENAME_SIZE,"%c",PATHSEPCHAR); if (strcmp(outdirname,"") && PATHSEPCHAR != outdirname[strlen(outdirname)-1]) strcat(outdirname,tmp); extension = (output_extension) ? output_extension : ""; /* now build full output filename */ st_snprintf(outfilename,FILENAME_SIZE,"%s%s%s%s%s%s.%s",outdirname,custprefix,st_ops.output_prefix,newbasename,st_ops.output_postfix,custpostfix,extension); } static format_module *default_output_format() { int i; for (i=0;st_formats[i];i++) { if (st_formats[i]->supports_output) { return st_formats[i]; } } st_error("no output formats found"); return NULL; } static int is_numeric(unsigned char *buf) { unsigned char *p = buf; wlong bytes; if (0 == strlen((const char *)buf)) return -1; while (*p) { if (!isdigit(*p)) return -1; p++; } bytes = #ifdef HAVE_ATOL (wlong)atol((const char *)buf); #else (wlong)atoi((const char *)buf); #endif return bytes; } static wlong is_m_ss(unsigned char *buf,wave_info *info) { unsigned char *colon,*p; int len,min,sec; wlong bytes; len = strlen((const char *)buf); if (len < 4) return -1; colon = buf + len - 3; if (':' != *colon) return -1; p = buf; while (*p) { if (p != colon) { if (!isdigit(*p)) return -1; } p++; } *colon = 0; min = atoi((const char *)buf); sec = atoi((const char *)(colon+1)); if (sec >= 60) st_error("invalid value for seconds: [%d]",sec); bytes = (wlong)(min * info->rate * 60) + (wlong)(sec * info->rate); return bytes; } static wlong is_m_ss_ff(unsigned char *buf,wave_info *info) { unsigned char *colon,*dot,*p; int len,min,sec,frames; wlong bytes; len = strlen((const char *)buf); if (len < 7) return -1; colon = buf + len - 6; dot = buf + len - 3; if (':' != *colon || '.' != *dot) return -1; p = buf; while (*p) { if (p != colon && p != dot) { if (!isdigit(*p)) return -1; } p++; } *colon = 0; *dot = 0; if (PROB_NOT_CD(info)) st_error("m:ss.ff format can only be used with CD-quality files"); min = atoi((const char *)buf); sec = atoi((const char *)(colon+1)); frames = atoi((const char *)(dot+1)); if (sec >= 60) st_error("invalid value for seconds: [%d]",sec); if (frames >= 75) st_error("invalid value for frames: [%d]",frames); bytes = (wlong)(min * CD_RATE * 60) + (wlong)(sec * CD_RATE) + (wlong)(frames * CD_BLOCK_SIZE); return bytes; } static wlong is_m_ss_nnn(unsigned char *buf,wave_info *info) { unsigned char *colon,*dot,*p; int len,min,sec,ms,nearest_byte,nearest_frame; wlong bytes; len = strlen((const char *)buf); if (len < 8) return -1; colon = buf + len - 7; dot = buf + len - 4; if (':' != *colon || '.' != *dot) return -1; p = buf; while (*p) { if (p != colon && p != dot) { if (!isdigit(*p)) return -1; } p++; } *colon = 0; *dot = 0; min = atoi((const char *)buf); sec = atoi((const char *)(colon+1)); ms = atoi((const char *)(dot+1)); if (sec >= 60) st_error("invalid value for seconds: [%d]",sec); nearest_byte = (int)((((double)ms * (double)info->rate) / 1000.0) + 0.5); bytes = (wlong)(min * info->rate * 60) + (wlong)(sec * info->rate); if (PROB_NOT_CD(info)) { bytes += nearest_byte; } else { nearest_frame = (int)((double)ms * .075 + 0.5) * CD_BLOCK_SIZE; if (0 == nearest_frame && 0 == bytes) { st_warning("closest sector boundary to %d:%02d.%03d is the beginning of the file -- rounding up to first sector boundary",min,sec,ms); nearest_frame = CD_BLOCK_SIZE; } if (nearest_frame != nearest_byte) { st_warning("rounding %d:%02d.%03d (offset: %lu) to nearest sector boundary (offset: %lu)", min,sec,ms,bytes+(wlong)nearest_byte,bytes+(wlong)nearest_frame); bytes += (wlong)nearest_frame; } } return bytes; } /* Compare strings while treating digits characters numerically. Copyright (C) 1997, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jean-François Bignolles , 1997. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* states: S_N: normal, S_I: comparing integral part, S_F: comparing fractional parts, S_Z: idem but with leading Zeroes only */ #define S_N 0x0 #define S_I 0x4 #define S_F 0x8 #define S_Z 0xC /* result_type: CMP: return diff; LEN: compare using len_diff/diff */ #define CMP 2 #define LEN 3 /* ISDIGIT differs from isdigit, as follows: - Its arg may be any int or unsigned int; it need not be an unsigned char. - It's guaranteed to evaluate its argument exactly once. - It's typically faster. Posix 1003.2-1992 section 2.5.2.1 page 50 lines 1556-1558 says that only '0' through '9' are digits. Prefer ISDIGIT to isdigit unless it's important to use the locale's definition of `digit' even when the host does not conform to Posix. */ #define ISDIGIT(c) ((unsigned) (c) - '0' <= 9) #undef __strverscmp #undef strverscmp #ifndef weak_alias # define __strverscmp strverscmp #endif /* Compare S1 and S2 as strings holding indices/version numbers, returning less than, equal to or greater than zero if S1 is less than, equal to or greater than S2 (for more info, see the texinfo doc). */ static int __strverscmp (const char *s1, const char *s2) { const unsigned char *p1 = (const unsigned char *) s1; const unsigned char *p2 = (const unsigned char *) s2; unsigned char c1, c2; int state; int diff; /* Symbol(s) 0 [1-9] others (padding) Transition (10) 0 (01) d (00) x (11) - */ static const unsigned int next_state[] = { /* state x d 0 - */ /* S_N */ S_N, S_I, S_Z, S_N, /* S_I */ S_N, S_I, S_I, S_I, /* S_F */ S_N, S_F, S_F, S_F, /* S_Z */ S_N, S_F, S_Z, S_Z }; static const int result_type[] = { /* state x/x x/d x/0 x/- d/x d/d d/0 d/- 0/x 0/d 0/0 0/- -/x -/d -/0 -/- */ /* S_N */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP, /* S_I */ CMP, -1, -1, CMP, 1, LEN, LEN, CMP, 1, LEN, LEN, CMP, CMP, CMP, CMP, CMP, /* S_F */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP, /* S_Z */ CMP, 1, 1, CMP, -1, CMP, CMP, CMP, -1, CMP, CMP, CMP }; if (p1 == p2) return 0; c1 = *p1++; c2 = *p2++; /* Hint: '0' is a digit too. */ state = S_N | ((c1 == '0') + (ISDIGIT (c1) != 0)); while ((diff = c1 - c2) == 0 && c1 != '\0') { state = next_state[state]; c1 = *p1++; c2 = *p2++; state |= (c1 == '0') + (ISDIGIT (c1) != 0); } state = result_type[state << 2 | ((c2 == '0') + (ISDIGIT (c2) != 0))]; switch (state) { case CMP: return diff; case LEN: while (ISDIGIT (*p1++)) if (!ISDIGIT (*p2++)) return 1; return ISDIGIT (*p2) ? -1 : diff; default: return state; } } #ifdef weak_alias static weak_alias (__strverscmp, strverscmp) #endif static int compare_version(const wave_info **w1,const wave_info **w2) { return strverscmp(w1[0]->filename,w2[0]->filename); } static int compare_ascii(const wave_info **w1,const wave_info **w2) { return strcmp(w1[0]->filename,w2[0]->filename); } static void ascii_sort_files(wave_info **filenames, int numfiles) { int (*cmpfunc) (); cmpfunc = compare_ascii; qsort(filenames,numfiles,sizeof(wave_info *),cmpfunc); } static void version_sort_files(wave_info **filenames,int numfiles) { int (*cmpfunc) (); cmpfunc = compare_version; qsort(filenames,numfiles,sizeof(wave_info *),cmpfunc); } /* public functions */ FILE *open_input_stream_fmt(format_module *fmt,char *infile,proc_info *pinfo) { if (fmt && fmt->supports_input) { /* if this format defines its own input function, run it */ if (fmt->input_func) return fmt->input_func(infile,pinfo); return launch_input(fmt,infile,pinfo); } return NULL; } bool open_input_stream(wave_info *info) /* opens an input stream, and if it contains an ID3v2 tag, skips past it */ { unsigned long bytes_to_read,tag_size; unsigned char tmp[BUF_SIZE]; if (info->file_has_id3v2_tag) { if (info->input_format->decoder) st_debug1("decoder [%s] might fail to process ID3v2 tag detected in file: [%s]",info->input_format->decoder,info->filename); else st_debug1("discarding ID3v2 tag detected in file: [%s]",info->filename); } if (NULL == (info->input = open_input_stream_fmt(info->input_format,info->filename,&info->input_proc))) { st_warning("could not open file for streaming input: [%s]",info->filename); return FALSE; } /* check for ID3v2 tag on input stream */ if ((tag_size = check_for_id3v2_tag(info->input))) { if (!info->stream_has_id3v2_tag) { if (info->input_format->decoder) st_debug1("discarding ID3v2 tag detected in input stream generated by decoder [%s] from file: [%s]",info->input_format->decoder,info->filename); else st_debug1("discarding ID3v2 tag detected in input stream from file: [%s]",info->filename); info->stream_has_id3v2_tag = TRUE; } if (0 == info->id3v2_tag_size) info->id3v2_tag_size = (wlong)(tag_size + sizeof(id3v2_header)); st_debug1("discarding %lu-byte ID3v2 tag in input stream generated by decoder [%s] from file: [%s]", info->id3v2_tag_size,info->filename,info->input_format->decoder); while (tag_size > 0) { bytes_to_read = min(tag_size,BUF_SIZE); if (bytes_to_read != read_n_bytes(info->input,tmp,bytes_to_read,NULL)) { if (info->input_format->decoder) st_warning("error while discarding ID3v2 tag in input stream generated by decoder [%s] from file: [%s]",info->input_format->decoder,info->filename); else st_warning("error while discarding ID3v2 tag in input stream from file: [%s]",info->filename); close_input_stream(info); return FALSE; } tag_size -= bytes_to_read; } } else { close_input_stream(info); if (NULL == (info->input = open_input_stream_fmt(info->input_format,info->filename,&info->input_proc))) { st_warning("could not reopen file for streaming input: [%s]",info->filename); return FALSE; } } return TRUE; } void remove_file(char *filename) { struct stat sz; int retval; if (st_ops.output_format && !st_ops.output_format->remove_output_file) { return; } if (stat(filename,&sz)) { st_debug1("tried to remove nonexistent file: [%s]",filename); return; } if ((retval = unlink(filename))) { st_warning("error while trying to remove partially-written output file: [%s]",filename); return; } st_debug1("successfully removed file: [%s]",filename); } bool files_are_identical(char *file1,char *file2) { struct stat sz1,sz2; if (stat(file1,&sz1) || stat(file2,&sz2)) return FALSE; if (!S_ISREG(sz1.st_mode) || !S_ISREG(sz2.st_mode)) return FALSE; if (sz1.st_dev != sz2.st_dev) return FALSE; if (sz1.st_ino != sz2.st_ino) return FALSE; /* more checks, because windows inodes are always zero, which creates false positives */ if (sz1.st_size != sz2.st_size) return FALSE; if (sz1.st_mtime != sz2.st_mtime) return FALSE; return TRUE; } bool odd_sized_data_chunk_is_null_padded(wave_info *info) /* function to determine whether odd-sized data chunks are NULL-padded to an even length */ { FILE *devnull; unsigned char nullpad[BUF_SIZE]; if (!PROB_ODD_SIZED_DATA(info)) return TRUE; /* with no extra RIFF chunks, we can tell from the extra RIFF size whether it's padded */ if (-1 == info->extra_riff_size) return FALSE; if (0 == info->extra_riff_size) return TRUE; /* it's odd-sized, and has extra RIFF chunks, so we'll have to make a pass through it to know for sure. * most modes don't need to do this, but ones that update chunk sizes on existing files need to know whether * it's padded in order to calculate the correct chunk size (currently this includes pad and strip modes). */ if (NULL == (devnull = open_output(NULLDEVICE))) { return FALSE; } if (!open_input_stream(info)) { fclose(devnull); return FALSE; } st_debug1("scanning WAVE contents to determine whether odd-sized data chunk is padded with a NULL byte per RIFF specs"); if (info->header_size + info->data_size != transfer_n_bytes(info->input,devnull,info->header_size + info->data_size,NULL)) { fclose(devnull); close_input_stream(info); return FALSE; } nullpad[0] = 1; if (0 == read_n_bytes(info->input,nullpad,1,NULL)) { fclose(devnull); close_input_stream(info); return FALSE; } fclose(devnull); close_input_stream(info); st_debug1("odd-sized data chunk is%s padded with a NULL byte in file: [%s]",(0==nullpad[0])?"":" not",info->filename); return (0 == nullpad[0]) ? TRUE : FALSE; } void st_snprintf(char *dest,int maxlen,char *formatstr, ...) /* acts like snprintf, but makes 100% sure the string is NULL-terminated */ { va_list args; va_start(args,formatstr); st_vsnprintf(dest,maxlen,formatstr,args); dest[maxlen-1] = 0; va_end(args); } void length_to_str(wave_info *info) /* converts length of file to a string in m:ss or m:ss.ff format */ { wlong newlength,rem1,rem2,frames,ms,h,m,s; double tmp; char ffnnn[8]; /* get total seconds plus trailing portion of seconds */ if (PROB_NOT_CD(info)) { newlength = (wlong)info->exact_length; tmp = info->exact_length - (double)((wlong)info->exact_length); ms = (wlong)((tmp * 1000.0) + 0.5); if (1000 == ms) { ms = 0; newlength++; } st_snprintf(ffnnn,8,"%03lu",ms); } else { newlength = info->length; rem1 = info->data_size % CD_RATE; rem2 = rem1 % CD_BLOCK_SIZE; frames = rem1 / CD_BLOCK_SIZE; if (rem2 >= (CD_BLOCK_SIZE / 2)) frames++; if (frames == CD_BLOCKS_PER_SEC) { frames = 0; newlength++; } st_snprintf(ffnnn,8,"%02lu",frames); } /* calculate h:m:s */ h = newlength / 3600; newlength -= h * 3600; m = newlength / 60; newlength -= m * 60; s = newlength; if (!st_priv.show_hmmss) m += h * 60; /* now build m_ss string, with h if necessary */ if (st_priv.show_hmmss && h > 0) st_snprintf(info->m_ss,16,"%lu:%02lu:%02lu.%s",h,m,s,ffnnn); else st_snprintf(info->m_ss,16,"%lu:%02lu.%s",m,s,ffnnn); } int close_and_wait(FILE *fd,proc_info *pinfo,int child_type,format_module *fm) { int retval; #ifdef WIN32 DWORD exitcode; #else int gotpid,status; char tmp[BUF_SIZE],debuginfo[BUF_SIZE]; #endif retval = CLOSE_SUCCESS; /* never close stdin/stdout/stderr */ if ((fd == stdin) || (fd == stdout) || (fd == stderr)) return retval; if (fd) { fclose(fd); fd = NULL; } if (NO_CHILD_PID == pinfo->pid) return retval; /* the following seems to work fine under linux, for any decoder. but we really only need it for certain ones. */ if (CHILD_INPUT == child_type) { /* * kill input processes outright, since we're done with them. this prevents programs from stalling us too long. * for example, 'la' doesn't exit when we close its stdout, but instead keeps decoding the whole file. so each * time shntool opens an 'la' file, it will be decoded entirely at least four times before all is said and done, * even for simple things such as checking sizes in len mode. a preemptive 'kill' here prevents this from * happening. note that we can't do this for output child types, since we may unwittingly corrupt the output * file in the process -- for example, we would most certainly cause problems with .shn files by killing * 'shorten' while it is busy creating a seek table. * * this is now done on a per-format basis, with reasons given below: * * la : 'la' decodes entire file no matter what, every time the input file is opened (see above). * aiff : 'sox' takes progressively longer as the input file becomes larger. * bonk : 'bonk' decodes entire file no matter what, every time the input file is opened (see above). * tta : 'ttaenc' decodes entire file no matter what, every time the input file is opened (see above). */ if (fm) { if (fm->kill_when_input_done) { st_debug2("preemptively killing [%s] input process %d to prevent possible delays",fm->decoder,pinfo->pid); #ifdef WIN32 TerminateProcess(pinfo->hProcess,0); #else kill(pinfo->pid,SIGHUP); #endif } else { st_debug2("waiting for [%s] input process %d to exit",fm->decoder,pinfo->pid); } } else { st_debug2("waiting for input process %d to exit",pinfo->pid); } } else { if (st_ops.output_format) { st_debug2("waiting for [%s] output process %d to exit",st_ops.output_format->encoder,pinfo->pid); } else { st_debug2("waiting for output process %d to exit",pinfo->pid); } } #ifdef WIN32 if ((exitcode = WaitForSingleObject(pinfo->hProcess,INFINITE))) st_debug2("WaitForSingleObject() return value: %d",exitcode); if (GetExitCodeProcess(pinfo->hProcess,&exitcode)) { st_debug2("process %d exit status: [%d]",pinfo->pid,exitcode); } else { st_debug2("process %d exit status could not be determined",pinfo->pid); } #else gotpid = (int)waitpid((pid_t)pinfo->pid,&status,0); st_snprintf(debuginfo,BUF_SIZE,"process %d exit status: [%d",gotpid,WIFEXITED(status)); if (WIFEXITED(status)) { st_snprintf(tmp,BUF_SIZE,"/%d",WEXITSTATUS(status)); strcat(debuginfo,tmp); } st_snprintf(tmp,BUF_SIZE,"] [%d",WIFSIGNALED(status)); strcat(debuginfo,tmp); if (WIFSIGNALED(status)) { st_snprintf(tmp,BUF_SIZE,"/%d",WTERMSIG(status)); strcat(debuginfo,tmp); } st_snprintf(tmp,BUF_SIZE,"] [%d",WIFSTOPPED(status)); strcat(debuginfo,tmp); if (WIFSTOPPED(status)) { st_snprintf(tmp,BUF_SIZE,"/%d",WSTOPSIG(status)); strcat(debuginfo,tmp); } strcat(debuginfo,"]"); st_debug2(debuginfo); #endif #ifdef WIN32 if (0 != exitcode) { #else if (WIFEXITED(status) && WEXITSTATUS(status)) { #endif if (CHILD_OUTPUT == child_type) { st_warning("child encoder process %d had non-zero exit status %d",pinfo->pid, #ifdef WIN32 exitcode); #else WEXITSTATUS(status)); #endif retval = CLOSE_CHILD_ERROR_OUTPUT; } else if (CHILD_INPUT == child_type) { retval = CLOSE_CHILD_ERROR_INPUT; } } return retval; } char *st_progname() { return st_priv.fullprogname; } void alter_file_order(wave_info **filenames,int numfiles) /* a simple menu system to change the order of the files as given on the command line */ { int i,current,a,b; char response[BUF_SIZE], *p, *args[3]; wave_info *tmp; bool finished = FALSE; /* some modes read files/split points/etc. from stdin, so we can't ask. force user to use -O option */ if (!isatty(fileno(stdin))) st_error("standard input is not a terminal -- cannot invoke interactive file order editor"); st_info("\nEntering file order editor.\n"); while (!finished) { st_info("\n"); st_info("File list:\n"); st_info("\n"); for (i=0;ifilename); st_info("\n"); st_info("Commands:\n"); st_info("\n"); st_info(" [s]wap a b (swaps positions a and b)\n"); st_info(" [m]ove a b (moves position a to position b, shifting everything in between)\n"); st_info(" [b]egin a (moves position a to the beginning of the list)\n"); st_info(" [e]nd a (moves position a to the end of the list)\n"); st_info(" [n]atural (sorts files using a natural sorting algorithm -- t1, t2, ... t10)\n"); st_info(" [a]scii (sorts files based on their ascii characters -- t1, t10, t2, ...)\n"); st_info(" [d]one (quits this editor, and continues with processing)\n"); st_info(" [q]uit (quits %s [you can also use Ctrl-C])\n",st_priv.progname); st_info("\n? "); fgets(response,BUF_SIZE-1,stdin); if (feof(stdin)) strcpy(response,"done"); trim(response); p = response; current = 0; args[0] = NULL; args[1] = NULL; args[2] = NULL; while (*p) { while (' ' == *p || '\t' == *p || '\n' == *p) { *p = 0; p++; } if (0 == *p) break; if (3 > current) args[current++] = p; while (*p && ' ' != *p && '\t' != *p && '\n' != *p) p++; } if (NULL == args[0]) args[0] = ""; st_info("\n"); switch (args[0][0]) { case 's': case 'S': if (NULL == args[2]) st_info("Not enough positions supplied to the 'swap' command\n"); else { a = atoi(args[1]); b = atoi(args[2]); if ((a<1 || a>numfiles) || (b<1 || b>numfiles)) st_info("One or more of your entries are out of range. Try again.\n"); else { st_info("Swapping positions %d and %d...\n",a,b); tmp = filenames[a-1]; filenames[a-1] = filenames[b-1]; filenames[b-1] = tmp; } } break; case 'm': case 'M': if (NULL == args[2]) st_info("Not enough positions supplied to the 'move' command\n"); else { a = atoi(args[1]); b = atoi(args[2]); if ((a<1 || a>numfiles) || (b<1 || b>numfiles)) st_info("One or more of your entries are out of range. Try again.\n"); else { st_info("Moving position %d to position %d...\n",a,b); tmp = filenames[a-1]; if (a < b) { for (i=a-1;i b) { for (i=a-1;i>b-1;i--) filenames[i] = filenames[i-1]; } filenames[b-1] = tmp; } } break; case 'b': case 'B': if (NULL == args[1]) st_info("Missing a position for the 'begin' command.\n"); else { a = atoi(args[1]); if ((a<1 || a>numfiles)) st_info("Your entry is out of range. Try again.\n"); else { st_info("Moving position %d to the beginning of the list\n",a); tmp = filenames[a-1]; for (i=a-1;i>0;i--) filenames[i] = filenames[i-1]; filenames[0] = tmp; } } break; case 'e': case 'E': if (NULL == args[1]) st_info("Missing a position for the 'end' command.\n"); else { a = atoi(args[1]); if ((a<1 || a>numfiles)) st_info("Your entry is out of range. Try again.\n"); else { st_info("Moving position %d to the end of the list...\n",a); tmp = filenames[a-1]; for (i=a-1;icreates_files) ? GLOBAL_OPTS GLOBAL_OPTS_OUTPUT : GLOBAL_OPTS; /* make sure the calling mode isn't using an option reserved for shntool global use */ c[1] = 0; for (p=global_opts;*p;p++) { if (':' == *p) continue; c[0] = *p; if (strstr(mode_opts,c)) st_error("mode attempted to use global option: [-%s]",c); } if (st_priv.mode->creates_files && (NULL == st_ops.output_format)) st_ops.output_format = default_output_format(); st_snprintf(ops,BUF_SIZE,"%s%s",global_opts,mode_opts); opt = getopt(argc,argv,ops); if (-1 == opt) return opt; /* handle global options before mode options */ switch (opt) { case 'D': st_priv.debug_level++; break; case 'F': if (NULL == optarg) st_help("missing input file filename"); st_input.type = INPUT_FILE; st_input.filename_source = optarg; break; case 'H': st_priv.show_hmmss = TRUE; break; case 'P': if (NULL == optarg) st_help("missing progress indicator type"); if (!strcmp(optarg,"pct")) st_priv.progress_type = PROGRESS_PERCENT; else if (!strcmp(optarg,"dot")) st_priv.progress_type = PROGRESS_DOT; else if (!strcmp(optarg,"spin")) st_priv.progress_type = PROGRESS_SPIN; else if (!strcmp(optarg,"face")) st_priv.progress_type = PROGRESS_FACE; else if (!strcmp(optarg,"none")) st_priv.progress_type = PROGRESS_NONE; else st_help("invalid progress indicator type: [%s]",optarg); break; case '?': case 'h': if ('?' == opt) st_info("\n"); if (st_priv.mode->run_help) st_priv.mode->run_help(); st_global_usage(); exit(('?' == opt) ? ST_EXIT_ERROR : ST_EXIT_SUCCESS); break; case 'i': if (NULL == optarg) st_help("missing input format"); if (NULL == (input_format = find_format(optarg))) st_help("missing input format name"); if (!input_format->supports_input) st_help("format does not support input: [%s]",input_format->name); parse_input_args_cmd(input_format,optarg); break; case 'q': st_priv.suppress_stderr = TRUE; break; case 'r': if (NULL == optarg) st_help("missing reorder type"); if (!strcmp(optarg,"ask")) st_priv.reorder_type = ORDER_ASK; else if (!strcmp(optarg,"ascii")) st_priv.reorder_type = ORDER_ASCII; else if (!strcmp(optarg,"natural")) st_priv.reorder_type = ORDER_NATURAL; else if (!strcmp(optarg,"none")) st_priv.reorder_type = ORDER_AS_IS; else st_help("invalid reorder type: [%s]",optarg); break; case 'v': st_version(); exit(ST_EXIT_SUCCESS); break; case 'w': st_priv.suppress_warnings = TRUE; break; } if (st_priv.mode->creates_files) { switch (opt) { case 'O': if (NULL == optarg) st_help("missing overwrite action"); if (!strcmp(optarg,"ask")) st_priv.clobber_action = CLOBBER_ACTION_ASK; else if (!strcmp(optarg,"always")) st_priv.clobber_action = CLOBBER_ACTION_ALWAYS; else if (!strcmp(optarg,"never")) st_priv.clobber_action = CLOBBER_ACTION_NEVER; else st_help("invalid overwrite action: [%s]",optarg); break; case 'a': if (NULL == optarg) st_help("missing filename prefix"); st_ops.output_prefix = optarg; break; case 'd': if (NULL == optarg) st_help("missing output directory"); st_ops.output_directory = optarg; break; case 'o': if (NULL == optarg) st_help("missing output format"); if (NULL == (st_ops.output_format = find_format(optarg))) st_help("missing output format name"); if (!st_ops.output_format->supports_output) st_help("format does not support output: [%s]",st_ops.output_format->name); parse_output_args_cmd(st_ops.output_format,optarg); break; case 'z': if (NULL == optarg) st_help("missing filename postfix"); st_ops.output_postfix = optarg; break; } } return opt; } void discard_header(wave_info *info) { unsigned char *header; if (NULL == (header = malloc(info->header_size * sizeof(unsigned char)))) st_error("could not allocate %d bytes for WAVE header",info->header_size); if (read_n_bytes(info->input,header,info->header_size,NULL) != info->header_size) st_error("error while discarding %d-byte header from file: [%s]",info->header_size,info->filename); st_free(header); } void create_output_filename(char *infile,char *inext,char *outfile) { strcpy(outfile,""); if (st_ops.output_format) { if (st_ops.output_format->create_output_filename) { st_ops.output_format->create_output_filename(outfile); return; } rename_by_extension( (st_ops.output_format->encoder) ? &st_ops.output_format->output_args_template : NULL, infile,outfile,inext,st_ops.output_format->extension); } } FILE *open_output_stream(char *outfile,proc_info *pinfo) { pinfo->pid = NO_CHILD_PID; if (st_ops.output_format && st_ops.output_format->supports_output) { /* if this format defines its own output function, run it */ if (st_ops.output_format->output_func) return st_ops.output_format->output_func(outfile,pinfo); return launch_output(st_ops.output_format,outfile,pinfo); } return NULL; } void st_global_usage() { st_info("Global options:\n"); st_info("\n"); st_info(" -D print debugging information (each one increases debugging level)\n"); st_info(" -F file get input filenames from file, instead of command line or terminal\n"); st_info(" -H print times in h:mm:ss.{ff,nnn} format, instead of m:ss.{ff,nnn}\n"); if (st_priv.mode->creates_files) { st_info(" -O val overwrite existing files? val is: {[ask], always, never}\n"); } st_info(" -P type progress indicator type. type is: {[pct], dot, spin, face, none}\n"); if (st_priv.mode->creates_files) { st_info(" -a str prefix 'str' to base part of output filenames\n"); st_info(" -d dir specify output directory\n"); } st_info(" -i fmt specify input file format decoder and/or arguments.\n"); st_info(" format is: \"fmt decoder [arg1 ... argN (%s = filename)]\"\n",FILENAME_PLACEHOLDER); if (st_priv.mode->creates_files) { st_info(" -o fmt specify output file format, extension, encoder and/or arguments.\n"); st_info(" format is: \"fmt [ext=abc] [encoder [arg1 ... argN (%s = filename)]]\"\n",FILENAME_PLACEHOLDER); } st_info(" -q suppress non-critical output (quiet mode)\n"); st_info(" -r val reorder input files? val is: {ask, ascii, [natural], none}\n"); st_info(" -v show version information\n"); st_info(" -w suppress warnings\n"); if (st_priv.mode->creates_files) { st_info(" -z str postfix 'str' to base part of output filenames\n"); } st_info(" -- indicates that everything following it is a filename\n"); st_info("\n"); } void arg_init(format_module *fm) { char *p,envname[BUF_SIZE],upper[BUF_SIZE]; strcpy(upper,fm->name); /* convert format name to upper case */ for (p=upper;*p;p++) { if (*p >= 'a' && *p <= 'z') *p = *p - 32; } if (fm->supports_input) { /* initialize with format defaults */ parse_input_args_fmt(fm,fm->decoder_args); /* check environment for user-specified decoder */ st_snprintf(envname,BUF_SIZE,"ST_%s_DEC",upper); parse_input_args_env(fm,scan_env(envname)); } if (fm->supports_output) { /* initialize with format defaults */ parse_output_args_fmt(fm,fm->encoder_args); /* check environment for user-specified extension and/or encoder */ st_snprintf(envname,BUF_SIZE,"ST_%s_ENC",upper); parse_output_args_env(fm,scan_env(envname)); } } void arg_add(child_args *child_args,char *arg) { if (child_args->num_args >= MAX_CHILD_ARGS) st_error("too many arguments specified -- limit is %d",MAX_CHILD_ARGS); child_args->args[child_args->num_args] = arg; child_args->num_args++; } void arg_reset(child_args *child_args) { int i; child_args->num_args = 0; for (i=0;iargs[i] = NULL; } void arg_replace(child_args *child_args,int pos,char *arg) { child_args->args[pos] = arg; } void reorder_files(wave_info **files,int numfiles) { switch (st_priv.reorder_type) { case ORDER_ASK: alter_file_order(files,numfiles); break; case ORDER_NATURAL: version_sort_files(files,numfiles); break; case ORDER_ASCII: ascii_sort_files(files,numfiles); break; case ORDER_AS_IS: default: break; } } static void prog_print_data(progress_info *proginfo) { if (proginfo->prefix) { st_info("%s ",proginfo->prefix); } if (proginfo->filename1) { st_info("[%s] ",proginfo->filename1); if (proginfo->filedesc1) { st_info("(%s) ",proginfo->filedesc1); } } if (proginfo->clause) { st_info("%s ",proginfo->clause); } if (proginfo->filename2) { st_info("[%s] ",proginfo->filename2); if (proginfo->filedesc2) { st_info("(%s) ",proginfo->filedesc2); } } st_info(": "); } static void prog_init(progress_info *proginfo) { if (!proginfo->initialized) { proginfo->bytes_written = 0; proginfo->dot_step = -1; proginfo->last_percent = -1; proginfo->progress_shown = FALSE; prog_print_data(proginfo); proginfo->initialized = TRUE; st_priv.screen_dirty = FALSE; } if (st_priv.screen_dirty) { proginfo->last_percent = -1; proginfo->progress_shown = FALSE; prog_print_data(proginfo); st_priv.screen_dirty = FALSE; } } static void prog_uninit(progress_info *proginfo) { proginfo->initialized = FALSE; proginfo->progress_shown = FALSE; proginfo->bytes_written = 0; proginfo->bytes_total = 0; proginfo->dot_step = 0; proginfo->percent = 0; proginfo->last_percent = 0; } static void prog_erase_chars(progress_info *proginfo,int erasecnt) { int i; if (!proginfo->progress_shown) { proginfo->progress_shown = TRUE; return; } for (i=0;ipercent); } static void prog_show_dot(progress_info *proginfo) { if (-1 == proginfo->dot_step) proginfo->dot_step = 0; while ((proginfo->dot_step + 10) <= proginfo->percent) { st_info("."); proginfo->dot_step += 10; } } static void prog_show_spin(progress_info *proginfo) { char spin[4] = { '|', '/', '-', '\\' }; while ((proginfo->dot_step + 1) <= proginfo->percent) { proginfo->dot_step++; prog_erase_chars(proginfo,2); st_info("%c ",spin[proginfo->dot_step % 4]); } } static void prog_show_face(progress_info *proginfo) { char *faces[6] = { ":-(", ":-/", ":-\\", ":-|", ":-)", ":-D" }; bool show_face = FALSE; if (-1 == proginfo->dot_step) proginfo->dot_step = -20; while ((proginfo->dot_step + 20) <= proginfo->percent) { proginfo->dot_step += 20; show_face = TRUE; } if (!show_face) return; prog_erase_chars(proginfo,4); st_info("%s ",faces[proginfo->dot_step/20]); } static void prog_finish(char *status,progress_info *proginfo) { if (PROGRESS_DOT == st_priv.progress_type) st_info(" "); st_info("%s\n",status); prog_uninit(proginfo); } void prog_update(progress_info *proginfo) { prog_init(proginfo); if (proginfo->bytes_total <= 0) proginfo->percent = 0; else proginfo->percent = (int)(100.0 * ((double)proginfo->bytes_written)/((double)proginfo->bytes_total)); proginfo->percent = min(max(proginfo->percent,0),100); if (proginfo->percent <= proginfo->last_percent) return; switch (st_priv.progress_type) { case PROGRESS_PERCENT: prog_show_pct(proginfo); break; case PROGRESS_DOT: prog_show_dot(proginfo); break; case PROGRESS_SPIN: prog_show_spin(proginfo); break; case PROGRESS_FACE: prog_show_face(proginfo); break; case PROGRESS_NONE: default: break; } proginfo->last_percent = proginfo->percent; } void prog_success(progress_info *proginfo) { proginfo->bytes_written = proginfo->bytes_total; prog_update(proginfo); prog_finish("OK",proginfo); } void prog_error(progress_info *proginfo) { prog_update(proginfo); prog_finish("ERROR",proginfo); } void input_init(int argn,int argc,char **argv) { if (INPUT_FILE != st_input.type && INPUT_INTERNAL != st_input.type) { if (argn >= argc) { st_input.type = INPUT_STDIN; } else { st_input.type = INPUT_CMDLINE; } } switch (st_input.type) { case INPUT_CMDLINE: st_debug1("reading input filenames from command line"); st_input.argn = argn; st_input.argc = argc; st_input.argv = argv; break; case INPUT_STDIN: st_debug1("reading input filenames from stdin"); if (isatty(fileno(stdin))) st_info("enter input filename(s):\n"); st_input.fd = stdin; break; case INPUT_FILE: st_debug1("reading input filenames from file: [%s]",st_input.filename_source); if (NULL == (st_input.fd = fopen(st_input.filename_source,"rb"))) { st_error("could not open input filename file: [%s]",st_input.filename_source); } break; case INPUT_INTERNAL: st_input.filecur = 0; break; default: break; } } char *input_get_filename() { static char internal_filename[FILENAME_SIZE]; char *filename = NULL; switch (st_input.type) { case INPUT_CMDLINE: if (st_input.argn < st_input.argc) { filename = st_input.argv[st_input.argn]; st_input.argn++; } break; case INPUT_STDIN: case INPUT_FILE: fgets(internal_filename,FILENAME_SIZE-1,st_input.fd); if (!feof(st_input.fd)) { trim(internal_filename); filename = internal_filename; } else { if (INPUT_FILE == st_input.type) { fclose(st_input.fd); } } break; case INPUT_INTERNAL: if (st_input.filecur < st_input.filemax) { st_debug1("returning file %d: [%s]",st_input.filecur,st_input.filenames[st_input.filecur]); filename = st_input.filenames[st_input.filecur]; st_input.filecur++; } break; default: break; } return filename; } void input_read_all_files() { char *filename; st_input.filemax = 0; while ((filename = input_get_filename())) { st_input.filenames[st_input.filemax] = strdup(filename); st_input.filemax++; if (st_input.filemax >= MAX_FILENAMES) st_error("exceeded maximum number of filenames: [%s]",MAX_FILENAMES); } st_input.type = INPUT_INTERNAL; st_input.filecur = 0; } int input_get_file_count() { return st_input.filemax; } shntool-3.0.10/src/format_als.c0000644000077100007710000000255711155771111013301 00000000000000/* format_als.c - als format module * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "format.h" CVSID("$Id: format_als.c,v 1.5 2009/03/11 17:18:01 jason Exp $") #define ALS "mp4als" #define ALS_MAGIC "ALS" static char default_decoder_args[] = "-x " FILENAME_PLACEHOLDER " -"; static char default_encoder_args[] = "- " FILENAME_PLACEHOLDER; format_module format_als = { "als", "MPEG-4 Audio Lossless Coding", CVSIDSTR, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, "-", ALS_MAGIC, 0, "als", ALS, default_decoder_args, ALS, default_encoder_args, NULL, NULL, NULL, NULL, NULL, NULL }; shntool-3.0.10/src/format_cust.c0000644000077100007710000000224611155771111013473 00000000000000/* format_cust.c - custom output format module * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "format.h" CVSID("$Id: format_cust.c,v 1.44 2009/03/11 17:18:01 jason Exp $") format_module format_cust = { "cust", "Custom output format module", CVSIDSTR, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; shntool-3.0.10/src/format_kxs.c0000644000077100007710000000245711155771111013326 00000000000000/* format_kxs.c - kxs format module * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "format.h" CVSID("$Id: format_kxs.c,v 1.20 2009/03/11 17:18:01 jason Exp $") #define KEXIS "kexis" #define KEXIS_MAGIC "KEXS" static char default_decoder_args[] = "-x -s " FILENAME_PLACEHOLDER; format_module format_kxs = { "kxs", "Kexis lossless WAV file compressor", CVSIDSTR, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, NULL, KEXIS_MAGIC, 0, "kxs", KEXIS, default_decoder_args, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; shntool-3.0.10/src/mode_split.c0000644000077100007710000006272011160272274013311 00000000000000/* mode_split.c - split mode module * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include #include #include "mode.h" CVSID("$Id: mode_split.c,v 1.145 2009/03/18 22:25:00 jason Exp $") static bool split_main(int,char **); static void split_help(void); mode_module mode_split = { "split", "shnsplit", "Splits PCM WAVE data from one file into multiple files", CVSIDSTR, TRUE, split_main, split_help }; #define SPLIT_PREFIX "split-track" #define SPLIT_MAX_PIECES 256 #define SPLIT_NUM_FORMAT "%02d" enum { SPLIT_INPUT_UNKNOWN, SPLIT_INPUT_RAW, SPLIT_INPUT_CUE }; static bool input_is_cd_quality = FALSE; static int numfiles = 0; static int numextracted = 0; static int offset = 1; static int input_type = SPLIT_INPUT_UNKNOWN; static char *num_format = SPLIT_NUM_FORMAT; static char *split_point_file = NULL; static char *repeated_split_point = NULL; static char *leadin = NULL; static char *leadout = NULL; static char *extract_tracks = NULL; static char *manipulate_chars = NULL; typedef struct _cue_info { /* global */ char *format; char artist[FILENAME_SIZE]; char album[FILENAME_SIZE]; /* per-track */ char artists[SPLIT_MAX_PIECES][FILENAME_SIZE]; char titles[SPLIT_MAX_PIECES][FILENAME_SIZE]; char filenames[SPLIT_MAX_PIECES][FILENAME_SIZE]; /* misc vars */ int trackno; bool in_global_section; bool in_new_track_section; } cue_info; static cue_info cueinfo; static wave_info *files[SPLIT_MAX_PIECES]; static bool extract_track[SPLIT_MAX_PIECES]; static void split_help() { int i; st_info("Usage: %s [OPTIONS] [file]\n",st_progname()); st_info("\n"); st_info("Mode-specific options:\n"); st_info("\n"); st_info(" -c num start counting from num when naming output files (default is 1)\n"); st_info(" -e len prefix each track with len amount of lead-in from previous track (*)\n"); st_info(" -f file read split point data from file\n"); st_info(" -h show this help screen\n"); st_info(" -l len split input file into files of length len (*)\n"); st_info(" -m str specify character manipulation string (alternating from/to)\n"); st_info(" -n fmt specify file count output format (default is %s -- ",SPLIT_NUM_FORMAT); for (i=0;i<3;i++) { st_info(SPLIT_NUM_FORMAT ", ",i+1); } st_info("...)\n"); st_info(" -t fmt name output files in user-specified format based on CUE sheet fields.\n"); st_info(" (%%p = performer, %%a = album, %%t = track title, %%n = track number)\n"); st_info(" -u len postfix each track with len amount of lead-out from next track (*)\n"); st_info(" -x list only extract tracks in list (comma-separated, may contain ranges)\n"); st_info("\n"); st_info(" (*) len must be in bytes, m:ss, m:ss.ff or m:ss.nnn format\n"); st_info("\n"); st_info("If no split point file is given, then split points are read from the terminal.\n"); st_info("\n"); } static void parse(int argc,char **argv,int *first_arg) { int c; st_ops.output_directory = CURRENT_DIR; st_ops.output_prefix = SPLIT_PREFIX; cueinfo.format = NULL; while ((c = st_getopt(argc,argv,"c:e:f:l:n:m:t:u:x:")) != -1) { switch (c) { case 'c': if (NULL == optarg) st_error("missing starting count"); offset = atoi(optarg); if (offset < 0) st_help("starting count cannot be negative"); break; case 'e': if (NULL == optarg) st_error("missing lead-in"); leadin = optarg; break; case 'f': if (NULL == optarg) st_error("missing split point file"); split_point_file = optarg; break; case 'l': if (NULL == optarg) st_error("missing repeated split point"); repeated_split_point = optarg; break; case 'm': if (NULL == optarg) st_error("missing character manipulation list"); manipulate_chars = optarg; break; case 'n': if (NULL == optarg) st_error("missing number output format"); num_format = optarg; break; case 't': if (NULL == optarg) st_error("missing cue format"); cueinfo.format = optarg; /* override existing output prefix, if not changed by the user */ if (!strcmp(st_ops.output_prefix,SPLIT_PREFIX)) st_ops.output_prefix = ""; break; case 'u': if (NULL == optarg) st_error("missing lead-out"); leadout = optarg; break; case 'x': if (NULL == optarg) st_error("missing track numbers to extract"); extract_tracks = optarg; break; } } if (optind >= argc && !split_point_file) st_help("if file to be split is not given, then a split point file must be specified"); *first_arg = optind; } static void adjust_for_leadinout(wlong leadin_bytes,wlong leadout_bytes) { int current,pass; wlong this_leadin,this_leadout; /* adjust WAVE data size for each file based on any lead-in/lead-outs specified */ for (pass=0;pass<2;pass++) { for (current=0;currentdata_size < leadin_bytes) st_error("lead-in length exceeds length of one or more files"); if (numfiles - 1 != current && files[current+1]->data_size < leadout_bytes) st_error("lead-out length exceeds length of one or more files"); break; case 1: /* second pass: actually adjust data sizes */ files[current]->new_data_size = files[current]->data_size; files[current]->data_size += this_leadin + this_leadout; break; default: break; } } } } static bool split_file(wave_info *info) { unsigned char header[CANONICAL_HEADER_SIZE]; char outfilename[FILENAME_SIZE],filenum[FILENAME_SIZE]; int current; wint discard,bytes; bool success; wlong leadin_bytes, leadout_bytes, bytes_to_xfer; progress_info proginfo; success = FALSE; proginfo.initialized = FALSE; proginfo.prefix = "Splitting"; proginfo.clause = "-->"; proginfo.filename1 = info->filename; proginfo.filedesc1 = info->m_ss; proginfo.filename2 = NULL; proginfo.filedesc2 = NULL; proginfo.bytes_total = 0; if (!open_input_stream(info)) { prog_error(&proginfo); st_error("could not reopen input file: [%s]",info->filename); } discard = info->header_size; while (discard > 0) { bytes = min(discard,CANONICAL_HEADER_SIZE); if (read_n_bytes(info->input,header,bytes,NULL) != bytes) { prog_error(&proginfo); st_error("error while discarding %d-byte WAVE header",info->header_size); } discard -= bytes; } leadin_bytes = (leadin) ? smrt_parse((unsigned char *)leadin,info) : 0; leadout_bytes = (leadout) ? smrt_parse((unsigned char *)leadout,info) : 0; adjust_for_leadinout(leadin_bytes,leadout_bytes); for (current=0;currentchunk_size = files[current]->data_size + CANONICAL_HEADER_SIZE - 8; files[current]->channels = info->channels; files[current]->samples_per_sec = info->samples_per_sec; files[current]->avg_bytes_per_sec = info->avg_bytes_per_sec; files[current]->block_align = info->block_align; files[current]->bits_per_sample = info->bits_per_sample; files[current]->wave_format = info->wave_format; files[current]->rate = info->rate; files[current]->length = files[current]->data_size / (wlong)info->rate; files[current]->exact_length = (double)files[current]->data_size / (double)info->rate; files[current]->total_size = files[current]->chunk_size + 8; length_to_str(files[current]); proginfo.filedesc2 = files[current]->m_ss; proginfo.bytes_total = files[current]->total_size; if (extract_track[current]) { proginfo.prefix = "Splitting"; proginfo.filename2 = outfilename; if (NULL == (files[current]->output = open_output_stream(outfilename,&files[current]->output_proc))) { prog_error(&proginfo); st_error("could not open output file"); } } else { proginfo.prefix = "Skipping "; proginfo.filename2 = NULLDEVICE; if (NULL == (files[current]->output = open_output(NULLDEVICE))) { prog_error(&proginfo); st_error("while skipping track %d: could not open output file: [%s]",current+1,NULLDEVICE); } files[current]->output_proc.pid = NO_CHILD_PID; } if (PROB_ODD_SIZED_DATA(files[current])) files[current]->chunk_size++; make_canonical_header(header,files[current]); prog_update(&proginfo); if (write_n_bytes(files[current]->output,header,CANONICAL_HEADER_SIZE,&proginfo) != CANONICAL_HEADER_SIZE) { prog_error(&proginfo); st_warning("error while writing %d-byte WAVE header",CANONICAL_HEADER_SIZE); goto cleanup; } /* if this is not the first file, finish up writing previous file, and simultaneously start writing to current file */ if (0 != current) { /* write overlapping lead-in/lead-out data to both previous and current files */ if (transfer_n_bytes2(info->input,files[current]->output,files[current-1]->output,leadin_bytes+leadout_bytes,&proginfo) != leadin_bytes+leadout_bytes) { prog_error(&proginfo); st_warning("error while transferring %ld bytes of lead-in/lead-out",leadin_bytes+leadout_bytes); goto cleanup; } /* pad and close previous file */ if (PROB_ODD_SIZED_DATA(files[current-1]) && (1 != write_padding(files[current-1]->output,1,&proginfo))) { prog_error(&proginfo); st_warning("error while NULL-padding odd-sized data chunk"); goto cleanup; } close_output(files[current-1]->output,files[current-1]->output_proc); } /* transfer unique non-overlapping data from input file to current file */ bytes_to_xfer = files[current]->new_data_size; if (0 != current) bytes_to_xfer -= leadout_bytes; if (numfiles - 1 != current) bytes_to_xfer -= leadin_bytes; if (transfer_n_bytes(info->input,files[current]->output,bytes_to_xfer,&proginfo) != bytes_to_xfer) { prog_error(&proginfo); st_warning("error while transferring %ld bytes of data",bytes_to_xfer); goto cleanup; } /* if this is the last file, close it */ if (numfiles - 1 == current) { /* pad and close current file */ if (PROB_ODD_SIZED_DATA(files[current]) && (1 != write_padding(files[current]->output,1,&proginfo))) { prog_error(&proginfo); st_warning("error while NULL-padding odd-sized data chunk"); goto cleanup; } close_output(files[current]->output,files[current]->output_proc); } prog_success(&proginfo); } close_input_stream(info); success = TRUE; cleanup: if (!success) { close_output(files[current]->output,files[current]->output_proc); remove_file(outfilename); st_error("failed to split file"); } return success; } static void create_new_splitfile() { if (SPLIT_MAX_PIECES - 1 == numfiles) st_error("too many split files would be created -- maximum is %d",SPLIT_MAX_PIECES); if (NULL == (files[numfiles] = new_wave_info(NULL))) st_error("could not allocate memory for split points array"); } static void adjust_splitfile(int whichfile) { if (input_is_cd_quality) { if (files[whichfile]->data_size < CD_MIN_BURNABLE_SIZE) { files[whichfile]->problems |= PROBLEM_CD_BUT_TOO_SHORT; if (extract_track[whichfile]) st_warning("file %d will be too short to be burned%s",whichfile+1, (files[whichfile]->data_size % CD_BLOCK_SIZE)?", and will not be cut on a sector boundary":""); if (files[whichfile]->data_size % CD_BLOCK_SIZE) files[whichfile]->problems |= PROBLEM_CD_BUT_BAD_BOUND; } else if (files[whichfile]->data_size % CD_BLOCK_SIZE) { files[whichfile]->problems |= PROBLEM_CD_BUT_BAD_BOUND; if (extract_track[whichfile]) st_warning("file %d will not be cut on a sector boundary",whichfile+1); } } else { files[whichfile]->problems |= PROBLEM_NOT_CD_QUALITY; } } static void xlate_chars(char *str,char *xlstr) { int i; char *p; if (!str || !xlstr) return; for (i=0;xlstr[i] && xlstr[i+1];i+=2) { for (p=str;*p;p++) { if (xlstr[i] == *p) { *p = xlstr[i+1]; } } } } static void cue_sprintf(int tracknum,char *filename) { char *p,c[2],num[8],psc[4]; p = cueinfo.format; c[1] = 0; strcpy(filename,""); st_snprintf(psc,4,"%c",PATHSEPCHAR); while (*p) { if ('%' == *p) { if ('a' == *(p+1)) { strcat(filename,cueinfo.album); p+=2; continue; } if ('p' == *(p+1)) { strcat(filename,cueinfo.artists[tracknum]); p+=2; continue; } if ('t' == *(p+1)) { strcat(filename,cueinfo.titles[tracknum]); p+=2; continue; } if ('n' == *(p+1)) { st_snprintf(num,8,num_format,tracknum+offset); strcat(filename,num); p+=2; continue; } } c[0] = *p; strcat(filename,c); p++; } xlate_chars(filename,manipulate_chars); if (extract_track[tracknum] && strstr(filename,psc)) { st_warning("converting illegal path character '%c' to '-' in CUE-originated filename: [%s]",PATHSEPCHAR,filename); st_snprintf(psc,4,"%c%c",PATHSEPCHAR,'-'); xlate_chars(filename,psc); } } static void extract(unsigned char *data) /* parse out raw lengths, or lengths on INDEX lines of cue sheets */ { unsigned char *p,*q; trim((char *)data); if (0 == strlen((const char *)data)) return; if (strstr((const char *)data,"INDEX") && (NULL == strstr((const char *)data,":"))) { strcpy((char *)data,""); return; } /* isolate length */ p = data + strlen((const char *)data) - 1; while (p >= data && (!isdigit(*p) && ':' != *p && '.' != *p)) { *p = 0; p--; } while (p >= data && (isdigit(*p) || ':' == *p || '.' == *p)) p--; p++; /* copy length to beginning of buffer */ q = data; while (*p) { *q = *p; p++; q++; } *q = 0; /* convert m:ss:ff to m:ss.ff */ p = (unsigned char *)strrchr((const char *)data,':'); q = (unsigned char *)strchr((const char *)data,':'); if (p && q && p != q) *p = '.'; } static void get_cue_field(unsigned char *field,unsigned char *line,char *buf) { char *p,tmp[FILENAME_SIZE]; strcpy(tmp,(const char *)line); trim(tmp); /* skip over this keyword to next token */ p = strstr(tmp,(const char *)field); p += strlen((char *)field); while (' ' == *p || '\t' == *p) p++; /* check for quotes, and remove them if present */ if ('"' == *p) p++; if ('"' == p[strlen(p)-1]) p[strlen(p)-1] = 0; strcpy(buf,p); } static bool handle_cue_keyword(unsigned char *keyword,unsigned char *line) { /* REM lines are always ignored */ if (!strcmp((char *)keyword,"REM")) return FALSE; /* TRACK lines indicate beginning of possible TITLES for the tracks */ if (!strcmp((char *)keyword,"TRACK")) { cueinfo.in_global_section = FALSE; cueinfo.trackno++; return FALSE; } /* TITLE lines are parsed for album names and/or song titles */ if (!strcmp((char *)keyword,"TITLE")) { /* TITLE keywords in global section indicate album name */ if (cueinfo.in_global_section) { get_cue_field(keyword,line,cueinfo.album); return FALSE; } /* TITLE keywords in track sections indicate song title */ get_cue_field(keyword,line,cueinfo.titles[cueinfo.trackno-1]); return FALSE; } /* PERFORMER lines are parsed for artist name */ if (!strcmp((char *)keyword,"PERFORMER")) { /* PERFORMER keywords in global section indicate artist name - will override track artist names where not defined */ if (cueinfo.in_global_section) { get_cue_field(keyword,line,cueinfo.artist); return FALSE; } /* PERFORMER keywords in track sections indicate artist name */ get_cue_field(keyword,line,cueinfo.artists[cueinfo.trackno-1]); return FALSE; } /* INDEX 01 lines are parsed for track timings */ if ((!strcmp((char *)keyword,"INDEX")) && (strstr((const char *)line,"INDEX 01"))) return TRUE; /* everything else is skipped */ return FALSE; } static void get_cue_keyword(unsigned char *line,unsigned char *keyword) { unsigned char *p,buf[BUF_SIZE]; p = line; /* skip over any binary junk at the beginning (including Unicode BOMs) */ while (*p && !isprint(*p)) p++; strcpy((char *)buf,(const char *)p); p = (unsigned char *)strtok((char *)buf," \t"); strcpy((char *)keyword,(p)?(const char *)p:""); } static bool get_length_token(FILE *input,unsigned char *token) { unsigned char keyword[BUF_SIZE]; char *p; strcpy((char *)token,""); if (feof(input)) return FALSE; switch (input_type) { case SPLIT_INPUT_UNKNOWN: p = fgets((char *)token,BUF_SIZE-1,input); if (!p && feof(input)) return FALSE; get_cue_keyword(token,keyword); if ( /* CUE global keywords */ (!strcmp((char *)keyword,"FILE")) || (!strcmp((char *)keyword,"CATALOG")) || (!strcmp((char *)keyword,"CDTEXTFILE")) || (!strcmp((char *)keyword,"REM")) || /* CD-TEXT keywords */ (!strcmp((char *)keyword,"TITLE")) || (!strcmp((char *)keyword,"PERFORMER")) || (!strcmp((char *)keyword,"SONGWRITER")) || (!strcmp((char *)keyword,"COMPOSER")) || (!strcmp((char *)keyword,"ARRANGER")) || (!strcmp((char *)keyword,"MESSAGE")) || (!strcmp((char *)keyword,"DISC_ID")) || (!strcmp((char *)keyword,"GENRE")) || (!strcmp((char *)keyword,"TOC_INFO")) || (!strcmp((char *)keyword,"TOC_INFO2")) || (!strcmp((char *)keyword,"UPC_EAN")) || (!strcmp((char *)keyword,"ISRC")) || (!strcmp((char *)keyword,"SIZE_INFO")) ) { input_type = SPLIT_INPUT_CUE; handle_cue_keyword(keyword,token); return get_length_token(input,token); } else { input_type = SPLIT_INPUT_RAW; extract(token); } break; case SPLIT_INPUT_RAW: p = fgets((char *)token,BUF_SIZE-1,input); if (!p && feof(input)) return FALSE; extract(token); break; case SPLIT_INPUT_CUE: p = fgets((char *)token,BUF_SIZE-1,input); while (p || !feof(input)) { get_cue_keyword(token,keyword); if (handle_cue_keyword(keyword,token)) break; p = fgets((char *)token,BUF_SIZE-1,input); } if (!p && feof(input)) return FALSE; extract(token); break; } return TRUE; } static void read_split_points_file(wave_info *info) { FILE *fd; unsigned char data[BUF_SIZE]; wlong current,previous = 0; int i,j; bool got_token; cueinfo.trackno = 0; cueinfo.in_global_section = TRUE; cueinfo.in_new_track_section = FALSE; strcpy(cueinfo.artist,""); strcpy(cueinfo.album,""); for (i=0;ibeginning_byte = current; if (files[numfiles]->beginning_byte <= previous) st_error("split point %lu is not greater than previous split point %lu",files[numfiles]->beginning_byte,previous); files[numfiles]->data_size = files[numfiles]->beginning_byte - previous; adjust_splitfile(numfiles); if (SPLIT_INPUT_CUE == input_type && 1 == cueinfo.trackno) { strcpy(cueinfo.titles[1],cueinfo.titles[0]); strcpy(cueinfo.titles[0],"pregap"); cueinfo.trackno++; offset--; } numfiles++; previous = current; } got_token = get_length_token(fd,data); } if (NULL == (files[numfiles] = new_wave_info(NULL))) st_error("could not allocate memory for split points array"); numfiles++; if (split_point_file) fclose(fd); if (1 == numfiles) st_error("no split points given -- nothing to do"); if (SPLIT_INPUT_CUE == input_type && cueinfo.format) { if (cueinfo.trackno < numfiles) st_error("not enough TITLE keywords in CUE sheet to name each output file"); /* global artist overrides track artist when not defined */ for (i=0;i= info->data_size) st_error("repeated split size is not less than data size of input file -- nothing to do"); bytes_left = info->data_size; while (bytes_left > repeated_split_size) { create_new_splitfile(); files[numfiles]->beginning_byte = (numfiles+1) * repeated_split_size; files[numfiles]->data_size = repeated_split_size; adjust_splitfile(numfiles); numfiles++; bytes_left -= repeated_split_size; } if (NULL == (files[numfiles] = new_wave_info(NULL))) st_error("could not allocate memory for split points array"); numfiles++; } static void get_extractable_tracks() { int i,start,end; char *p,*q,*seps = ","; for (i=0;i end) { i = start; start = end; end = i; } if (start < 1) st_error("track number to extract (%d) is not in range [1 .. %d]",start,SPLIT_MAX_PIECES); if (end > SPLIT_MAX_PIECES) st_error("track number to extract (%d) is not in range [1 .. %d]",end,SPLIT_MAX_PIECES); start--; end--; for (i=start;i<=end;i++) { extract_track[i] = TRUE; numextracted++; } p = strtok(NULL,seps); } return; } /* extract all tracks */ for (i=0;ibeginning_byte > info->data_size) st_error("split points go beyond input file's data size"); if (files[numfiles-2]->beginning_byte == info->data_size) { st_free(files[numfiles-1]); numfiles--; } else { files[numfiles-1]->beginning_byte = info->data_size; files[numfiles-1]->data_size = info->data_size - files[numfiles-2]->beginning_byte; adjust_splitfile(numfiles-1); } success = split_file(info); for (i=0;i * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include #include "format.h" CVSID("$Id: format_null.c,v 1.44 2009/03/11 17:18:01 jason Exp $") static FILE *open_for_output(char *,proc_info *); static void create_output_filename(char *); format_module format_null = { "null", "Sends output to " NULLDEVICE, CVSIDSTR, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, open_for_output, NULL, create_output_filename, NULL }; static FILE *open_for_output(char *filename,proc_info *pinfo) { pinfo->pid = NO_CHILD_PID; return open_output(NULLDEVICE); } static void create_output_filename(char *outfilename) { strcpy(outfilename,NULLDEVICE); } shntool-3.0.10/src/mode_cue.c0000644000077100007710000001206511157756171012740 00000000000000/* mode_cue.c - cue sheet mode module * Copyright (C) 2000-2009 Jason Jordan * * 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 * of the License, 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include #include "mode.h" CVSID("$Id: mode_cue.c,v 1.48 2009/03/17 17:23:05 jason Exp $") static bool cue_main(int,char **); static void cue_help(void); mode_module mode_cue = { "cue", "shncue", "Generates a CUE sheet or split points from a set of files", CVSIDSTR, FALSE, cue_main, cue_help }; enum { TYPE_UNKNOWN, TYPE_CUESHEET, TYPE_SPLITPOINTS }; static int output_type = TYPE_UNKNOWN; static double total_data_size = 0.0; static int numfiles = 0; static wave_info *totals = NULL; static void cue_help() { st_info("Usage: %s [OPTIONS] [files]\n",st_progname()); st_info("\n"); st_info("Mode-specific options:\n"); st_info("\n"); st_info(" -c generate CUE sheet (default)\n"); st_info(" -h show this help screen\n"); st_info(" -s generate split points in explicit byte-offset format\n"); st_info("\n"); } static void parse(int argc,char **argv,int *first_arg) { int c; output_type = TYPE_CUESHEET; while ((c = st_getopt(argc,argv,"cs")) != -1) { switch (c) { case 'c': output_type = TYPE_CUESHEET; break; case 's': output_type = TYPE_SPLITPOINTS; break; } } *first_arg = optind; } static void verify_wave_info(wave_info *info) { if ((TYPE_CUESHEET == output_type) && PROB_NOT_CD(info)) { st_error("file is not CD-quality: [%s]",info->filename); } if (0 == totals->wave_format && 0 == totals->channels && 0 == totals->samples_per_sec && 0 == totals->avg_bytes_per_sec && 0 == totals->bits_per_sample && 0 == totals->block_align) { totals->wave_format = info->wave_format; totals->channels = info->channels; totals->samples_per_sec = info->samples_per_sec; totals->avg_bytes_per_sec = info->avg_bytes_per_sec; totals->bits_per_sample = info->bits_per_sample; totals->block_align = info->block_align; totals->problems = info->problems; return; } if (info->wave_format != totals->wave_format) st_error("WAVE format differs among these files"); if (info->channels != totals->channels) st_error("number of channels differs among these files"); if (info->samples_per_sec != totals->samples_per_sec) st_error("samples per second differs among these files"); if (info->avg_bytes_per_sec != totals->avg_bytes_per_sec) st_error("average bytes per second differs among these files"); if (info->bits_per_sample != totals->bits_per_sample) st_error("bits per sample differs among these files"); if (info->block_align != totals->block_align) { st_warning("block align differs among these files"); } } static void output_init() { if (NULL == (totals = new_wave_info(NULL))) st_error("could not allocate memory for totals"); if (output_type == TYPE_CUESHEET) { st_output("FILE \"joined.wav\" WAVE\n"); } } static bool output_track(char *filename) { wave_info *info; wlong curr_data_size = 0; char *p; if (NULL == (info = new_wave_info(filename))) return FALSE; verify_wave_info(info); numfiles++; curr_data_size = info->data_size; if (output_type == TYPE_CUESHEET) { info->data_size = (wlong)total_data_size; info->length = info->data_size / info->rate; length_to_str(info); if ((p = strstr(info->m_ss,"."))) *p = ':'; st_output(" TRACK %02d AUDIO\n",numfiles); st_output(" INDEX 01 %s\n",info->m_ss); } else if (output_type == TYPE_SPLITPOINTS) { if (total_data_size > 0.0) st_output("%0.0f\n",total_data_size); } total_data_size += (double)curr_data_size; return TRUE; } static void output_end() { if (TYPE_CUESHEET == output_type && numfiles < 1) { st_error("need one or more files in order to generate CUE sheet"); } if (TYPE_SPLITPOINTS == output_type && numfiles < 2) { st_error("need two or more files in order to generate split points"); } } static bool process(int argc,char **argv,int start) { char *filename; bool success; success = TRUE; output_init(); input_init(start,argc,argv); while ((filename = input_get_filename())) { success = (output_track(filename) && success); } output_end(); return success; } static bool cue_main(int argc,char **argv) { int first_arg; parse(argc,argv,&first_arg); return process(argc,argv,first_arg); } shntool-3.0.10/config.sub0000744000077100007710000010175611164057355012210 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 # Free Software Foundation, Inc. timestamp='2008-09-08' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file 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 of the License, 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, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # 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. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | mt \ | msp430 \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | score \ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tile*) basic_machine=tile-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: shntool-3.0.10/NEWS0000644000077100007710000000002607424430466010714 00000000000000No news is good news. shntool-3.0.10/AUTHORS0000644000077100007710000000004607424430466011267 00000000000000Jason Jordan shntool-3.0.10/ChangeLog0000644000077100007710000003755111164063737012003 00000000000000version 3.0.10 (2009-03-30) + cat mode: fixed bug that prevented use of the -d option + cat mode [win32]: properly write WAVE data to the terminal + conv mode [win32]: properly read WAVE data from the terminal version 3.0.9 (2009-03-18) + allow fix mode to fix (essentially postpad) just one file, which is useful when using the -c option to check for boundary issues + added new global -F option to specify a file containing input filenames (most modes will now accept input filenames from a single source, using the following order of precedence: file specified by -F option, otherwise filenames on the command line, otherwise filenames read from the terminal) version 3.0.8 (2008-08-27) + added new -a option to show default encoder/decoder arguments + fixed bug when prompting for overwrite action when stdin was already at EOF on certain platforms (e.g. OS X) + split mode: handle CUE sheets that contain Unicode BOMs + wv format: support self-extracting WavPack files version 3.0.7 (2008-03-02) + support for TAK decoding (requires TAK 1.0.4+) + updated MPEG-4 ALS to version RM20, and added output support + removed detection of unsupported formats RKAU and WMA version 3.0.6 (2007-12-16) + support for TAK encoding (requires TAK 1.0.3+) version 3.0.5 (2007-10-22) + hash mode: show progress indicators + cmp mode: new -c option to specify size of byte-shift comparison buffer version 3.0.4 (2007-09-07) + no longer ignore raw WavPack files (wvunpack creates WAVE header for us) + support for TTA 3.4.x as well as TTA encoding + fixed display bug in joined mode when input files were not CD-quality + split mode: new -m option to allow character manipulation of CUE filenames version 3.0.3 (2007-06-01) + improved use of exit codes + mkw format: removed deprecated input kluge + split mode: override path separation characters in CUE-generated files version 3.0.2 (2007-02-18) + split mode: -c option works again + split mode: support wider range of CUE sheets + aiff format: support for sox 13.x version 3.0.1 (2007-01-24) + fixed bug with WavPack format detection on 64-bit systems + split mode: fixed bug parsing CUE sheets whose last line lacks a newline + added support for MKW files + added support for MPEG-4 ALS files (input only) + added support for detection of TAK files (no input or output yet) + added support for detection of WMA files (no input or output yet) + added support for detection of RKAU files (no input or output yet) version 3.0.0 (2007-01-01) [platform support] + shntool is now a native windows executable (Cygwin is no longer needed) [file formats] + added support for WavPack 4.x files + added support for m4a (Apple Lossless Audio Codec) files (input only) + added support for la (Lossless Audio) files (input only) + added support for tta files (input only) + added support for bonk files + added support for kxs (Kexis) files (input only) + added new format 'term' to send output to a terminal (standard output) + cust format: correct output filenames now shown (instead of "file.custom") + cust format: partially-written output files are now removed on error [modes] + added new mode 'gen' to generate arbitrary-sized files containing silence + added new mode 'trim' to trim silence from front and/or back of files + renamed mode 'md5' to 'hash', since it now calculates MD5 and SHA1 hashes + hash mode: added option to reorder filenames - may be useful with -c + split mode: new -n option to control output count format (01, 001, ...) + split mode: support for wider range of CUE sheets + split mode: new -t option to name files based on keywords in CUE sheets + split mode: fixed bug in which -l option failed with large input files + split mode: new -e/-u options for specifying lead-in/lead-out + split mode: new -x option to extract specific tracks + len mode: show compression ratio for individual files as well as overall + len mode: show input file format for each file + len mode: new -c/-t options to suppress column names/totals line + len mode: configurable units for files and totals + conv mode: new -t option to convert WAVE data read from the terminal + fix, join and hash modes: filenames can now be sorted automatically using a natural sorting algorithm, which orders filenames containing numbers the the same way a human would, e.g. "t1.wav, t2.wav, ... t10.wav" instead of "t1.wav, t10.wav, t2.wav, ...". as this was taken from the sources of GNU ls (see 'ls -v'), it is considered stable enough to be the default. if desired, sorting can still be done interactively, or not at all. [global behavior] + user-configureable progress types (percentage, dots, spin, faces or none) + default overwrite option is now 'ask' - can be overridden with -O option + allow on-the-fly renaming when files exist and overwrite option is 'ask' + new -H option to show h:mm:ss.{ff,nnn} in output, instead of m:ss.{ff,nnn} + new -a and -z options to override default file name prefix and postfix + new options -w to suppress warnings and -q to suppress non-critical output + converted to getopt - this means long options have become single characters + alternate input decoder: -i "fmt decoder [arg1 ... argN]" + alternate output ext/encoder: -o "fmt [ext=abc] [encoder [arg1 ... argN]]" + in addition to the new -i/-o options above, default encoders/decoders and/or their arguments, as well as file extensions, can be overridden using any combination of appropriately named environment variables: ST__DEC="decoder [arg1 ... argN]" ST__ENC="[ext=abc] [encoder [arg1 ... argN]]" e.g.: % ST_SHN_DEC="shorten-2.3b" shntool len *.shn % ST_FLAC_ENC="flake - %f" shntool conv -o flac *.wav % ST_AIFF_ENC="ext=aif" shntool gen -o aiff -l 1:00 version 2.0.3 (2004-05-05) + fixed bug in len mode that sometimes caused the m:ss.ff value on the totals line to be reported as being one second longer than it actually is - this should finally resolve all variants of this bug, which was discovered after 2.0.0 was released, thought to have been fixed in 2.0.1, and has since been determined to have existed from version 0.96 onward + len and info modes now indicate whether audio data is block-aligned version 2.0.2 (2004-05-04) + fixed crash when using -stdout in join mode without specifying an output format version 2.0.1 (2004-05-03) + fixed bug in len mode that sometimes caused the m:ss.ff value on the totals line to be reported as being one second shorter than it actually is version 2.0.0 (2004-04-20) + added new mode 'pad' to individually prepad or postpad CD-quality files + added new mode 'cue' to generate CUE sheets or split points from files + split mode now supports simple CUE sheets for splitting + added "-l len" option in split mode to split file into smaller files based on multiples of time interval "len" + added -c option to md5 mode for calculating composite MD5 fingerprints + added the ability to prepad or postpad files created in join mode + added support for sowt-compressed AIFF-C files (requires sox 12.17.4) + added the ability to skip ID3v2 tags contained in files or input streams: - formats with decoders that natively handle ID3v2 tags: shn, flac, ape - formats that handle ID3v2 tags through clever trickery: wav, aiff, ofr - formats that currently cannot handle ID3v2 tags: lpac, wv + added -O option to all modes that create output files, so that the user can control whether output files that already exist are overwritten + len mode modified to always show overall compression ratio + new column in len mode to indicate whether files contain an ID3v2 tag + changed length format for non-CD quality files from m:ss to m:ss.nnn + several additions and updates to the information shown by info mode + all modes now accept the -D option, which enables debugging information + modes that create files now remove partially-written output files on error (does not apply to the cust format module, since filename cannot be trusted) + updates to handle NULL-padding of odd-sized data chunks, per RIFF specs + fixed nasty bug in conv mode that caused some input files to be overwritten + fixed split mode m:ss.nnn bug that ignored nnn when file was not CD quality version 1.2.3 (2003-03-20) + split mode will now split any file, not just CD-quality ones + cat mode now accepts multiple filenames + fixed bug in split mode where split point files with Windows line endings were considered invalid version 1.2.2 (2003-02-22) + fixed bug in md5 mode that caused extra RIFF chunks to inadvertently be included in the calculation of MD5 fingerprints + relaxed the file name placeholder requirement for the cust format module (the '%f' placeholder can now be a substring of an argument) version 1.2.1 (2003-02-17) + added new mode 'md5' (computes MD5 hash of audio data, independent of format) + added support for wv (WavPack) file format + added new output format module 'cust' that allows one to specify a custom encoder to use in the creation of output files - this enables the user to override the default encoder arguments for formats that shntool already supports, as well as encode to formats that shntool does not yet support version 1.2.0 (2002-12-07) + info mode now supports extra per-format information (currently this is used to indicate seekability of shn files) + join mode now supports joining of non-CD quality files version 1.2.0-rc2 (2002-10-31) + overall compression ratio shown in len mode if all input files are compressed + fixed bug in fix mode that caused shntool to hang in rare instances + added support for ofr (OptimFROG) and lpac file formats version 1.2.0-rc1 (2002-09-12) + added support for aiff, flac and ape file formats; dropped kexis support (aiff format supports only AIFF and uncompressed AIFF-C, not compressed AIFF-C) + added new mode 'conv' (converts files from one format to another) + improved functionality in cmp mode (new -s, -l and -f options) + join mode can now write to stdout (only with 'wav' output format) + shntool now waits for child processes (prevents shorten 3.4/md5sum race condition) + fixed bug in join mode that caused output file to have incorrect data size when the data was not sector-aligned, and -nopad was specified + some debugging output now shown if SHNTOOL_DEBUG environment variable is set (currently limited to the status of child processes - useful if shntool is hanging) version 1.01 (2001-01-23) + fixed rounding error in len and info modes that caused certain non-sector-boundary-aligned CD-quality files to appear to be about one second shorter than they actually are. For example, a file that was just over half of a frame longer than 3:14.74 would have been incorrectly rounded to 3:14.00, when it should have been rounded to 3:15.00. The error occurred when the WAVE data size modulo 176400 fell in the range [175224, 176399]. Assuming that the data sizes of non-sector-aligned CD-quality WAVE files are uniformly distributed, the chance of this error occurring is just over 1 in 150 (1176 in 176325, to be exact). + removed arbitrary 4-byte file size cutoff version 1.00 (2001-01-13) + fixed offset miscalculation in cmp mode for files that differ + fixed design error in cat mode where extra RIFF chunks were not output. If cat mode was used to extract a file (e.g. shncat file.shn > file.wav), then the output file would appear to be truncated to len mode. Extra RIFF chunks can be still suppressed if needed via the new -nr switch. + cat mode now quits when nothing more would be output + minor documentation and output updates version 1.00 beta 9 (2001-01-08) + added 'r' shift type to fix mode (round to nearest sector boundary) + added new mode 'cmp' (compares WAVE data in two files) + added -c switch to split mode + now only installs symbolic links for specified built-in modes + finally wrote a "tutorial" + generalized the file order editor, and added more useful commands to it + added -nd switch to cat mode version 1.00 beta 8 (2001-01-05) + split mode erroneous input bug fixed + minor code cleanup and (hopefully) improved alias installation version 1.00 beta 7 (2001-01-05) + Digital Unix 4.0D compile fix and a 64-bit-architecture header size calculation fix + added new mode 'split' + shortened some command-line arguments in certain modes version 1.00 beta 6 (2001-01-03) + added new mode 'cat' + each mode is now aliased to "shn", e.g. shnlen, shnfix, shncat, etc. + cleaned up all errors reported by gcc -Wall version 1.00 beta 5 (2001-01-01) + fixed display errors when using aliases version 1.00 beta 4 (2001-01-01) + added support for conditional compilation of modules (see the INSTALL file for more information) version 1.00 beta 3 (2000-12-31) + converted to GNU autoconf version 1.00 beta 2 (2000-12-28) + reimplemented mode aliasing, e.g. creating a symbolic link to shntool named 'shnlen' will start shntool in len mode version 1.00 beta 1 (2000-12-23) + completely rewritten to be more modular + added three new modes - 'join', 'strip' and 'info' + see the README file for more information version 0.98 (2000-11-22, never released) + started improving some things, but gave up in favor of a full code redesign version 0.97a (2000-11-22) + fixed help screen bug version 0.97 (2000-11-21) + cleaned up and corrected help screens + check whether files are 'CD-quality', and report if they are not + display file length in m:ss.ff format only if it is CD-quality, and print totals line in m:ss.ff format only if all files were CD-quality - otherwise, display file length in m:ss format + check that all files are CD-quality before proceeding in fix mode + check that at least one file has an error before proceeding in fix mode + some code cleanup + realized that this thing is due for a rewrite :^) version 0.96 (2000-11-18) + now report file length in m:ss.ff format, where ff is a number from 0 to 74 that best approximates the remaining number of 2352-byte blocks after m:ss + more error and sanity checking for input files version 0.95 (2000-10-19) + fixed bug where chunk size wasn't being updated for files that were altered in fix mode + added code to help determine whether shorten is in the default path + WAVE data for headers in .wav (not .shn) files are now verified + added extra debugging information in len mode + file names created in fix mode are now based on input filenames when -f or -b are given version 0.94 (2000-08-24) + added option to pad the last file with zeroed data in fix mode, if necessary version 0.93 (2000-07-06) + I partially broke file reading from stdin in len mode in 0.92 - fixed. + cleaned up code to use the file_info struct for the filename wherever possible + added error checking after some malloc's + made some error messages more descriptive with regard as to why they may have happened + added a generic bug_report() routine (may want to add some diagnostic info to it later) + changed all // comments to standard comments to satisfy some bitchy compilers :) version 0.92 (2000-07-04) + added setlinebuf() support for architectures that don't have it (via the "-D_SETLINEBUF_HACK" compiler option) + added description of the len mode "-debug" flag to its help menu version 0.91 (2000-07-04) + WAVE headers are processed correctly again + added "-debug" switch for len mode + fixed segfaults with headers > 64 bytes version 0.9 (2000-07-03) + initial public release version 0.03 (2000-07-02) + all major bugs seem to be worked out, only minor cosmetic issues remain version 0.02 (2000-07-01) + started merging shnlen with fixwav to form a unified tool version 0.01 (2000-06-30) + some ideas coalesced, and development started on fixwav shntool-3.0.10/missing0000744000077100007710000002557711164057355011632 00000000000000#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2006-05-10.23 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # 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, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # 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. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' sed_minuso='s/.* -o \([^ ]*\).*/\1/p' # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case $1 in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' autom4te touch the output file, or create a stub one automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). case $1 in lex|yacc) # Not GNU programs, they don't have --version. ;; tar) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then exit 1 fi ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case $1 in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case $f in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.h fi ;; esac fi if test ! -f y.tab.h; then echo >y.tab.h fi if test ! -f y.tab.c; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if test ! -f lex.yy.c; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n ' /^@setfilename/{ s/.* \([^ ]*\) *$/\1/ p q }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; tar) shift # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case $firstarg in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case $firstarg in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: shntool-3.0.10/install-sh0000744000077100007710000003246411164057355012230 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2006-12-25.00 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # 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 # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then trap '(exit $?); exit' 1 2 13 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names starting with `-'. case $src in -*) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # Protect names starting with `-'. case $dst in -*) dst=./$dst;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writeable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; -*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test -z "$d" && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: shntool-3.0.10/Makefile.in0000644000077100007710000004647611164057356012304 00000000000000# Makefile.in generated by automake 1.10.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(top_srcdir)/configure \ $(top_srcdir)/include/config.h.in AUTHORS COPYING ChangeLog \ INSTALL NEWS config.guess config.sub depcomp install-sh \ missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d $(distdir) \ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr $(distdir); }; } DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ ALAC = @ALAC@ ALS = @ALS@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BONK = @BONK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FLAC = @FLAC@ FORMAT_OBJS = @FORMAT_OBJS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ KEXIS = @KEXIS@ LA = @LA@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LN_S = @LN_S@ LPAC = @LPAC@ LTLIBOBJS = @LTLIBOBJS@ MAC = @MAC@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MKWCON = @MKWCON@ MODES_CONFIGURED = @MODES_CONFIGURED@ MODE_OBJS = @MODE_OBJS@ OBJEXT = @OBJEXT@ OPTIMFROG = @OPTIMFROG@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SHORTEN = @SHORTEN@ SOX = @SOX@ STRIP = @STRIP@ TAKC = @TAKC@ TTA = @TTA@ VERSION = @VERSION@ WAVPACK = @WAVPACK@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = man src EXTRA_DIST = doc include utils all: all-recursive .SUFFIXES: am--refresh: @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \ cd $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) cd $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) include/config.h: include/stamp-h1 @if test ! -f $@; then \ rm -f include/stamp-h1; \ $(MAKE) $(AM_MAKEFLAGS) include/stamp-h1; \ else :; fi include/stamp-h1: $(top_srcdir)/include/config.h.in $(top_builddir)/config.status @rm -f include/stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status include/config.h $(top_srcdir)/include/config.h.in: $(am__configure_deps) cd $(top_srcdir) && $(AUTOHEADER) rm -f include/stamp-h1 touch $@ distclean-hdr: -rm -f include/config.h include/stamp-h1 # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) $(am__remove_distdir) test -d $(distdir) || mkdir $(distdir) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ distdir=`$(am__cd) $(distdir) && pwd`; \ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$top_distdir" \ distdir="$$distdir/$$subdir" \ am__remove_distdir=: \ am__skip_length_check=: \ distdir) \ || exit 1; \ fi; \ done $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-hook -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-lzma: distdir tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && cd $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @cd $(distuninstallcheck_dir) \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-hdr distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-exec-am: install-html: install-html-recursive install-info: install-info-recursive install-man: install-pdf: install-pdf-recursive install-ps: install-ps-recursive installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ install-strip .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am am--refresh check check-am clean clean-generic \ ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ dist-hook dist-lzma dist-shar dist-tarZ dist-zip distcheck \ distclean distclean-generic distclean-hdr distclean-tags \ distcleancheck distdir distuninstallcheck dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am tags tags-recursive uninstall uninstall-am dist-hook: for cvsdir in `find $(distdir) -name CVS`; do \ [ -d "$$cvsdir" ] && rm -rf "$$cvsdir" ; \ done # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: