cdparanoia-3.10.2+debian/0000755000175000017500000000000011063636663014400 5ustar danieldanielcdparanoia-3.10.2+debian/version.h0000644000175000017500000000057711062300232016222 0ustar danieldaniel/****************************************************************** * CopyPolicy: GNU Public License 2 applies * * cdda_paranoia generation III release 10.2 * Copyright (C) 2008 Monty monty@xiph.org * ******************************************************************/ #define VERSIONNUM "10.2" #define VERSION "cdparanoia III release " VERSIONNUM " (September 11, 2008)\n" cdparanoia-3.10.2+debian/configure.sub0000755000175000017500000007730010526475311017100 0ustar danieldaniel#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. timestamp='2006-07-02' # 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 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 \ | 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 \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | 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 \ | 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 | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) 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-* | 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-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | 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-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa-* \ | ymp-* \ | z8k-*) ;; # 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 ;; c90) basic_machine=c90-cray os=-unicos ;; 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 ;; cr16c) basic_machine=cr16c-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 ;; 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 ;; 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 ;; 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 ;; 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 ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; 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 ;; 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 ;; 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* \ | -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*) # 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 ;; -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 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 ;; 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: cdparanoia-3.10.2+debian/COPYING-GPL0000644000175000017500000004335111046366435016057 0ustar danieldanielThe cdparanoia command line tool versions 10.1 and later are distributed under the GNU General Public Licence v2.0 or, at your option, any later version of the GPL. 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 Lesser 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 Lesser General Public License instead of this License. cdparanoia-3.10.2+debian/cdparanoia.spec0000644000175000017500000001463210067614575017364 0ustar danieldaniel%define ver 9.8 %define realver alpha%{ver} Name: cdparanoia Version: %{realver} Release: 22 License: GPL Group: Applications/Multimedia Source: http://www.xiph.org/paranoia/download/%{name}-III-%{realver}.src.tgz Url: http://www.xiph.org/paranoia/index.html BuildRoot: %{_tmppath}/cdparanoia-%{version}-root Requires: cdparanoia-libs = %{version}-%{release} Obsoletes: cdparanoia-III Summary: A Compact Disc Digital Audio (CDDA) extraction tool (or ripper). %description Cdparanoia (Paranoia III) reads digital audio directly from a CD, then writes the data to a file or pipe in WAV, AIFC or raw 16 bit linear PCM format. Cdparanoia doesn't contain any extra features (like the ones included in the cdda2wav sampling utility). Instead, cdparanoia's strength lies in its ability to handle a variety of hardware, including inexpensive drives prone to misalignment, frame jitter and loss of streaming during atomic reads. Cdparanoia is also good at reading and repairing data from damaged CDs. %package -n cdparanoia-devel Summary: Development tools for libcdda_paranoia (Paranoia III). Group: Development/Libraries Requires: cdparanoia-libs = %{version}-%{release} %description -n cdparanoia-devel The cdparanoia-devel package contains the static libraries and header files needed for developing applications to read CD Digital Audio disks. %package -n cdparanoia-libs Summary: Libraries for libcdda_paranoia (Paranoia III). Group: Development/Libraries %description -n cdparanoia-libs The cdparanoia-libs package contains the dynamic libraries needed for applications which read CD Digital Audio disks. %prep %setup -q -n %{name}-III-%{realver} %build [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT export OPT="${CFLAGS:-%optflags}" %configure --includedir=%{_includedir}/cdda make OPT="$OPT" %install [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT install -d $RPM_BUILD_ROOT%{_bindir} install -d $RPM_BUILD_ROOT%{_includedir}/cdda install -d $RPM_BUILD_ROOT%{_libdir} install -d $RPM_BUILD_ROOT%{_mandir}/man1 install -m 0755 cdparanoia $RPM_BUILD_ROOT%{_bindir} install -m 0644 cdparanoia.1 $RPM_BUILD_ROOT%{_mandir}/man1/ install -m 0644 utils.h paranoia/cdda_paranoia.h interface/cdda_interface.h \ $RPM_BUILD_ROOT%{_includedir}/cdda install -m 0755 paranoia/libcdda_paranoia.so.0.%{ver} \ interface/libcdda_interface.so.0.%{ver} \ $RPM_BUILD_ROOT%{_libdir} install -m 0755 paranoia/libcdda_paranoia.a interface/libcdda_interface.a \ $RPM_BUILD_ROOT%{_libdir} /sbin/ldconfig -n $RPM_BUILD_ROOT/%{_libdir} pushd $RPM_BUILD_ROOT%{_libdir} ln -s libcdda_paranoia.so.0.%{ver} libcdda_paranoia.so ln -s libcdda_interface.so.0.%{ver} libcdda_interface.so popd %post -n cdparanoia-libs /sbin/ldconfig %postun -n cdparanoia-libs if [ "$1" -ge "1" ]; then /sbin/ldconfig fi %clean [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT %files -n cdparanoia %defattr(-,root,root) %doc README GPL FAQ.txt %{_bindir}/* %{_mandir}/man1/* %files -n cdparanoia-libs %defattr(-,root,root) %{_libdir}/*.so* %files -n cdparanoia-devel %defattr(-,root,root) %{_includedir}/cdda %{_includedir}/cdda/* %{_libdir}/*.a %changelog * Fri Jun 25 2004 Peter Jones alpha9.8-22 - take ownership of %{_includedir}/cdda - sync to mainline * Tue Jun 15 2004 Elliot Lee - rebuilt * Tue Mar 02 2004 Elliot Lee - rebuilt * Tue Feb 17 2004 Peter Jones alpha9.8-20 - take ownership of %{_includedir}/cdda * Fri Feb 13 2004 Elliot Lee - rebuilt * Wed Jun 04 2003 Elliot Lee - rebuilt * Tue May 20 2003 Peter Jones alpha9.8-17 - typo fix (g_fd -> fd) - add errno output * Tue May 06 2003 Peter Jones alpha9.8-16 - fix warnings on switches - use O_EXCL * Tue Feb 04 2003 Florian La Roche - add symlinks to shared libs * Wed Jan 22 2003 Tim Powers - rebuilt * Wed Dec 25 2002 Tim Powers alpha9.8-13 - fix %%install references in the changelog so that it will rebuild properly * Wed Dec 11 2002 Tim Powers alpha9.8-12 - rebuild on all arches * Fri Jun 21 2002 Tim Powers - automated rebuild * Thu May 23 2002 Tim Powers - automated rebuild * Wed Apr 3 2002 Peter Jones alpha9.8-8 - don't strip, let rpm do that * Mon Feb 25 2002 Tim Powers alpha9.8-7 - fix broken Obsoletes of cdparanoia-devel * Wed Jan 2 2002 Peter Jones alpha9.8-7 - minor cleanups of $RPM_BUILD_ROOT pruning * Thu Dec 6 2001 Peter Jones alpha9.8-6 - move includes to %{_includedir}/cdda/ - add utils.h to %%install - clean up %%install some. * Sun Nov 4 2001 Peter Jones alpha9.8-5 - make a -libs package which contains the .so files - make the cdparanoia dependancy towards that, not -devel * Thu Aug 2 2001 Peter Jones - bump the release not to conflict with on in the RH build tree :/ - reverse devel dependency * Wed Aug 1 2001 Peter Jones - fix %post and %postun to only run ldconfig for devel packages * Wed Jul 18 2001 Crutcher Dunnavant - devel now depends on package * Wed Mar 28 2001 Peter Jones - 9.8 release. * Tue Feb 27 2001 Karsten Hopp - fix spelling error in description * Thu Dec 7 2000 Crutcher Dunnavant - rebuild for new tree * Fri Jul 21 2000 Trond Eivind Glomsrød - use %%{_tmppath} * Wed Jul 12 2000 Prospector - automatic rebuild * Wed Jun 06 2000 Preston Brown - revert name change - use new rpm macro paths * Wed Apr 19 2000 Trond Eivind Glomsrød - Switched spec file from the one used in Red Hat Linux 6.2, which also changes the name - gzip man page * Thu Dec 23 1999 Peter Jones - update package to provide cdparanoia-alpha9.7-2.*.rpm and cdparanoia-devel-alpha9.7-2.*.rpm. Also, URLs point at xiph.org like they should. * Wed Dec 22 1999 Peter Jones - updated package for alpha9.7, based on input from: Monty David Philippi * Mon Apr 12 1999 Michael Maher - updated pacakge * Tue Oct 06 1998 Michael Maher - updated package * Mon Jun 29 1998 Michael Maher - built package cdparanoia-3.10.2+debian/cachetest.c0000644000175000017500000005761611062302252016505 0ustar danieldaniel/* * Copyright: GNU Public License 2 applies * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. * * cdparanoia (C) 2008 Monty * */ /* we can ask most drives what their various caches' sizes are, but no drive will tell if it caches redbook data. None should, many do, and there's no way in (eg) MMC/ATAPI to tell a cdrom drive not to cache when accessing audio. SCSI drives have a FUA facility, but it's not clear how many ignore it. MMC does specify some cache side effect as part of SET READ AHEAD, but it's not clear we can rely on them. For that reason, we need to empirically determine cache size and strategy used for reads. */ #include #include #include #include #include "interface/cdda_interface.h" #include "paranoia/cdda_paranoia.h" #include "version.h" /* not strictly just seeks, but also recapture and read resume when reading/readahead is suspended and idling */ #define MIN_SEEK_MS 6 #define reportC(...) {if(progress){fprintf(progress, __VA_ARGS__);} \ if(log){fprintf(log, __VA_ARGS__);}} #define printC(...) {if(progress){fprintf(progress, __VA_ARGS__);}} #define logC(...) {if(log){fprintf(log, __VA_ARGS__);}} static int time_drive(cdrom_drive *d, FILE *progress, FILE *log, int lba, int len, int initial_seek){ int i,x; int latency=0; double sum=0; double sumsq=0; int sofar; logC("\n"); for(i=0,sofar=0;sofar9999)x=9999; if(x<0)x=0; logC("%d:%d:%d ",lba+sofar,ret,x); sofar+=ret; if(i || !initial_seek){ sum+=x; sumsq+= x*x /(float)ret; }else latency=x; } /* we count even the upper outliers because the drive is almost certainly reading ahead and that will work itself out as we keep reading to catch up. Besides-- the tests would rather see too slow a timing than too fast; the timing data is used as an optimization when sleeping. */ { double mean = sum/(float)(len-1); double stddev = sqrt( (sumsq/(float)(len-1) - mean*mean)); if(initial_seek){ printC("%4dms seek, %.2fms/sec read [%.1fx]",latency,mean,1000./75./mean); logC("\n\tInitial seek latency (%d sectors): %dms",len,latency); } logC("\n\tAverage read latency: %.2fms/sector (raw speed: %.1fx)",mean,1000./75./mean); logC("\n\tRead latency standard deviation: %.2fms/sector",stddev); return sum; } } static float retime_drive(cdrom_drive *d, FILE *progress, FILE *log, int lba, int readahead, float oldmean){ int sectors = 2000; int total; float newmean; if(sectors*oldmean > 5000) sectors=5000/oldmean; readahead*=10; readahead/=9; if(readahead>sectors)sectors=readahead; printC("\bo"); logC("\n\tRetiming drive... "); total = time_drive(d,NULL,log,lba,sectors,1); newmean = total/(float)sectors; logC("\n\tOld mean=%.2fms/sec, New mean=%.2fms/sec\n",oldmean,newmean); printC("\b"); if(newmean>oldmean)return newmean; return oldmean; } int analyze_cache(cdrom_drive *d, FILE *progress, FILE *log, int speed){ /* Some assumptions about timing: We can't perform cache determination timing based on looking at average transfer times; on slow setups, the speed of a drive reading sectors via PIO will not be reliably distinguishable from the same drive returning data from the cache via pio. We need something even more noticable and reliable: the seek time. It is unlikely we'd ever see a seek latency of under ~10ms given the synchronization requirements of a CD and the maximum possible rotational velocity. A cache hit would always be faster, even with PIO. Further complicating things, we have to watch the data collection carefully as we're not always going to be on an unloaded system, and we even have to guard against other apps accessing the drive (something that should never happen on purpose, but could happen by accident). As we know in our testing when seeks should never occur, a sudden seek-sized latency popping up in the middle of a collection is an indication that collection is possibly invalid. A second cause of 'spurious latency' would be media damage; if we're consistently hitting latency on the same sector during initial collection, may need to move past it. */ int i,j,ret=0,x; int firstsector=-1; int lastsector=-1; int firsttest=-1; int lasttest=-1; int offset; int warn=0; int current=1000; int hi=15000; int cachesize=0; int readahead=0; int rollbehind=0; int cachegran=0; float mspersector=0; if(speed<=0)speed=-1; reportC("\n=================== Checking drive cache/timing behavior ===================\n"); d->error_retry=0; /* verify the lib and cache analysis match */ if(strcmp(VERSIONNUM,paranoia_version())){ reportC("\nWARNING: cdparanoia application (and thus the cache tests) does not match the" "\ninstalled (or in use) libcdda_paranoia.so library. The final verdict of this" "\ntesting may or may not be accurate for the actual version of the paranoia" "library. Continuing anyway...\n\n"); } /* find the longest stretch of available audio data */ for(i=0;itracks;i++){ if(cdda_track_audiop(d,i+1)==1){ if(firsttest == -1) firsttest=cdda_track_firstsector(d,i+1); lasttest=cdda_track_lastsector(d,i+1); if(lasttest-firsttest > lastsector-firstsector){ firstsector=firsttest; lastsector=lasttest; } }else{ firsttest=-1; lasttest=-1; } } if(firstsector==-1){ reportC("\n\tNo audio on disc; Cannot determine timing behavior..."); return -1; } /* Dump some initial timing data to give a little context for human eyes. Take readings ten minutes apart (45000 sectors) and at end of disk. */ { int best=0; int bestcount=0; int iterating=0; offset = lastsector-firstsector-current-1; reportC("\nSeek/read timing:\n"); while(offset>=firstsector){ int m = offset/4500; int s = (offset-m*4500)/75; int f = offset-m*4500-s*75; int sofar; if(iterating){ reportC("\n"); }else{ printC("\r"); logC("\n"); } reportC("\t[%02d:%02d.%02d]: ",m,s,f); /* initial seek to put at at a small offset past end of upcoming reads */ if((ret=cdda_read(d,NULL,offset+current+1,1))<0){ /* media error! grr! retry elsewhere */ if(ret==-404)return -1; reportC("\n\tWARNING: media error during read; continuing at next offset..."); offset = (offset-firstsector+44999)/45000*45000+firstsector; offset-=45000; continue; } sofar=time_drive(d,progress, log, offset, current, 1); if(offset==firstsector)mspersector = sofar/(float)current; if(sofar==-404) return -1; else if(sofar<0){ reportC("\n\tWARNING: media error during read; continuing at next offset..."); offset = (offset-firstsector+44999)/45000*45000+firstsector; offset-=45000; continue; }else{ if(!iterating){ if(best==0 || sofar*1.01sofar && bestcount>4000) iterating=1; } } } if(iterating){ offset = (offset-firstsector+44999)/45000*45000+firstsector; offset-=45000; printC(" "); }else{ offset--; printC(" spinning up... "); } } } reportC("\n\nAnalyzing cache behavior...\n"); /* search on cache size; cache hits are fast, seeks are not, so a linear search through cache hits up to a miss are faster than a bisection */ { int under=1; int onex=0; current=0; offset = firstsector+10; while(current <= hi && under){ int i,j; under=0; current++; if(onex){ if(speed==-1){ logC("\tAttempting to reset read speed to full... "); }else{ logC("\tAttempting to reset read speed to %dx... ",speed); } if(cdda_speed_set(d,speed)){ logC("failed.\n"); }else{ logC("drive said OK\n"); } onex=0; } printC("\r"); reportC("\tFast search for approximate cache size... %d sectors ",current-1); logC("\n"); for(i=0;i<25 && !under;i++){ for(j=0;;j++){ int ret1=0,ret2=0; if(i>=15){ int sofar=0; if(i==15){ printC("\r"); reportC("\tSlow verify for approximate cache size... %d sectors",current-1); logC("\n"); logC("\tAttempting to reduce read speed to 1x... "); if(cdda_speed_set(d,1)){ logC("failed.\n"); }else{ logC("drive said OK\n"); } onex=1; } printC("."); logC("\t\t>>> "); while(sofar>> fast_read=%d:%d:%d ",offset+current-1,ret1,x); /* Some drives are 'easily distracted' when readahead is running ahead of the read cursor, causing accesses of the earliest sectors in the cache to show bursty latency. If there's no seek here after a borderline long read of the earliest sector in the cache, then the cache must not have been dumped yet. */ if(ret==1 && i && xlastsector){ reportC("\n\tToo many read errors while performing drive cache checks;" "\n\t aborting test.\n\n"); return(-1); } reportC("\n\tRead error while performing drive cache checks;" "\n\t choosing new offset and trying again.\n"); }else{ if(x==-1){ reportC("\n\tTiming error while performing drive cache checks; aborting test.\n"); return(-1); }else{ if(x paranoia_cachemodel_size(p,-1)){ reportC("\nWARNING: This drive appears to be caching more sectors of\n" " readahead than Paranoia can currently handle!\n"); warn=1; } paranoia_free(p); } if(speed==-1){ logC("\tAttempting to reset read speed to full... "); }else{ logC("\tAttempting to reset read speed to %d... ",speed); } if(cdda_speed_set(d,speed)){ logC("failed.\n"); }else{ logC("drive said OK\n"); } /* This is similar to the Fast search above, but just in case the cache is being tracked as multiple areas that are treated differently if non-contiguous.... */ { int seekoff = cachesize*3; int under=0; reportC("\tVerifying that cache is contiguous..."); for(i=0;i<20 && !under;i++){ printC("."); for(j=0;;j++){ int ret1,ret2; if(offset+seekoff>lastsector){ reportC("\n\tOut of readable space on CDROM while performing drive checks;" "\n\t aborting test.\n\n"); return(-1); } ret1 = cdda_read_timed(d,NULL,offset+seekoff,1,&x); logC("\t\t>>> %d:%d:%d ",offset+seekoff,ret1,x); ret2 = cdda_read_timed(d,NULL,offset,1,&x); logC("seek_read:%d:%d:%d\n",offset,ret2,x); if(ret1<=0 || ret2<=0){ offset+=cachesize+100; if(j==10){ reportC("\n\tToo many read errors while performing drive cache checks;" "\n\t aborting test.\n\n"); return(-1); } reportC("\n\tRead error while performing drive cache checks;" "\n\t choosing new offset and trying again.\n"); }else{ if(x==-1){ reportC("\n\tTiming error while performing drive cache checks; aborting test.\n"); return(-1); }else{ if(x1 || under){ tests++; if(tests>8 && gran<64){ gran<<=3; tests=0; it=3; } if(gran && !under){ gran>>=3; tests=0; if(gran==1)it=10; } under=0; readahead=lower+gran; printC("\r"); logC("\n"); reportC("\tTesting background readahead past read cursor... %d",readahead); printC(" \b\b\b\b\b\b\b\b\b\b\b"); for(i=0;i>> ",i); while(sofarmax)usec=max; logC("sleep=%dus ",usec); usleep(usec); } /* seek to offset+cachesize+readahead */ ret = cdda_read_timed(d,NULL,offset+cachesize+readahead-1,1,&x); if(ret<=0)break; logC("seek=%d:%d:%d",offset+cachesize+readahead-1,ret,x); if(x>> "); printC("."); while(sofar0){ sofar--; ret = cdda_read_timed(d,NULL,offset+sofar,1,&x); if(ret<=0)break; logC("%d:%d:%d ",sofar,ret,x); if(x>=MIN_SEEK_MS){ if(rollbehind != sofar+1){ rollbehind=sofar+1; i=0; }else{ i++; } break; } if(sofar==0)rollbehind=0; } error: if(ret<=0){ offset+=cachesize; retry++; if(retry>10 || offset+cachesize>lastsector){ reportC("\n\tToo many read errors while performing drive cache checks;" "\n\t aborting test.\n\n"); return(-1); } reportC("\n\tRead error while performing drive cache checks;" "\n\t choosing new offset and trying again.\n"); continue; } } /* verify that the drive timing didn't suddenly change */ { float newms=retime_drive(d, progress, log, offset, readahead, mspersector); if(newms > mspersector*1.2){ mspersector=newms; printC("\r"); reportC("\tDrive timing changed during test; retrying..."); continue; } } break; } logC("\n"); printC("\r"); if(rollbehind==0){ reportC("\tCache tail cursor tied to read cursor \n"); }else{ reportC("\tCache tail rollbehind: %d sector(s) \n",rollbehind); } reportC("\tTesting granularity of cache tail"); while(1){ cachegran=cachesize+1; for(i=0;i<10 && cachegran;){ int sofar=0,ret=0,retry=0; logC("\n\t\t>>> "); printC("."); while(sofar=MIN_SEEK_MS){ if(cachegran == sofar+1){ i++; }else{ cachegran=sofar+1; i=0; } break; } if(sofar==0)cachegran=0; } error2: if(ret<=0){ offset+=cachesize; retry++; if(retry>10 || offset+cachesize>lastsector){ reportC("\n\tToo many read errors while performing drive cache checks;" "\n\t aborting test.\n\n"); return(-1); } reportC("\n\tRead error while performing drive cache checks;" "\n\t choosing new offset and trying again.\n"); continue; } } /* verify that the drive timing didn't suddenly change */ { float newms=retime_drive(d, progress, log, offset, readahead, mspersector); if(newms > mspersector*1.2){ mspersector=newms; printC("\r"); reportC("\tDrive timing changed during test; retrying..."); continue; } } break; } cachegran -= rollbehind; logC("\n"); printC("\r"); reportC("\tCache tail granularity: %d sector(s) \n",cachegran); /* Verify that a read that begins before the cached readahead dumps the entire readahead cache */ /* This is tricky because we can't simply read a one sector back seek, then rely on timing/seeking of subsequent sectors; the drive may well not seek ahead if reading linearly would be faster (and it often will be), and simply reading ahead after the seek and watching timing will be inaccurate because the drive may roll some readahead into the initial seek/read before returning the first block. */ /* we will need to use the timing of reading from media in one form or another and thus need to guard against slow bus transfer times [eg, no DMA] swamping the actual read time from media. */ /* sample cache access for five realtime seconds. */ { float cachems; float readms; int readsize = cachesize-rollbehind-8; int retry=0; if(readsize>cachesize-1)readsize=cachesize-1; if(readsize<7){ reportC("\tCache size (considering rollbehind) too small to test cache speed.\n"); }else{ reportC("\tTesting cache transfer speed..."); /* cache timing isn't dependent on rotational speed, so get a good read and then just hammer the cache; we will only need to do it once */ /* we need to time the cache using the most conservative possible read pattern; many drives will flush cache on *any* nonlinear access, but not if the read starts from the same point. The original cache size verification algo knows this, and we need to do it the same way here (this the '0' for 'initial_seek' on time_drve */ while(1){ int ret=time_drive(d, NULL, log, offset, readsize, 0); if(ret==-404) return -1; if(ret>0)break; retry++; if(retry==10){ reportC("\n\tToo many read errors while performing drive cache checks;" "\n\t aborting test.\n\n"); return(-1); } reportC("\n\tRead error while performing drive cache checks;" "\n\t choosing new offset and trying again.\n"); } { int elapsed=0; int sectors=0; int spinner=0; while(elapsed<5000){ sectors += readsize; elapsed += time_drive(d, NULL, log, offset, readsize, 0); spinner = elapsed*5/1000%4; printC("\b%c",(spinner==0?'o':(spinner==1?'O':(spinner==2?'o':'.')))); } printC("\r"); logC("\n"); cachems = elapsed/(float)sectors; reportC("\t Cache read speed: %.2fms/sector [%dx]\n", cachems,(int)(1000./75./cachems)); } if(cachems*3>mspersector){ reportC("\tCache access insufficiently faster than media access to\n" "\t\tperform cache backseek tests\n\n"); }else{ /* now do the read/backseek combo */ reportC("\tTesting that backseek flushes cache..."); { int total=0; int elapsed=0; int sectors=0; int spinner=0; int retry=0; while(elapsed<5000 && total<25){ /* don't kill the drive */ int ret; while(1){ /* need to force seek/flush, but don't kill the drive */ int seekpos = offset+cachesize+20000; if(seekpos>lastsector-150)seekpos=lastsector-150; ret=cdda_read(d, NULL, seekpos, 1); if(ret>0) ret=time_drive(d, NULL, log, offset+1, readsize, 1); if(ret>=0) ret=time_drive(d, NULL, log, offset, readsize, 1); if(ret<=0){ retry++; if(retry==10){ reportC("\n\tToo many read errors while performing drive cache checks;" "\n\t aborting test.\n\n"); return(-1); } reportC("\n\tRead error while performing drive cache checks; retrying..."); }else break; } sectors += (readsize-1); elapsed += ret; total++; spinner = elapsed*5/1000%4; printC("\b%c",(spinner==0?'o':(spinner==1?'O':(spinner==2?'o':'.')))); } printC("\r"); logC("\n"); readms = elapsed/(float)sectors; reportC("\t Access speed after backseek: %.2fms/sector [%dx]\n", readms,(int)(1000./75./readms)); if(readms*2. < mspersector || cachems*2. > readms){ reportC("\tWARNING: Read timing after backseek faster than expected!\n" "\t It's possible/likely that this drive is not\n" "\t flushing the readahead cache on backward seeks!\n\n"); warn=1; }else{ reportC("\tBackseek flushes the cache as expected\n"); } } } } } return warn; } cdparanoia-3.10.2+debian/cdparanoia.10000644000175000017500000002473611062275404016566 0ustar danieldaniel.TH CDPARANOIA 1 "11 Sep 2008" .SH NAME cdparanoia 10.2 (Paranoia release III) \- an audio CD reading utility which includes extra data verification features .SH SYNOPSIS .B cdparanoia .RB [ options ] .B span .RB [ outfile ] .SH DESCRIPTION .B cdparanoia retrieves audio tracks from CDDA capable CDROM drives. The data can be saved to a file or directed to standard output in WAV, AIFF, AIFF-C or raw format. Most ATAPI, SCSI and several proprietary CDROM drive makes are supported; .B cdparanoia can determine if the target drive is CDDA capable. .P In addition to simple reading, .B cdparanoia adds extra-robust data verification, synchronization, error handling and scratch reconstruction capability. .SH OPTIONS .TP .B \-A --analyze-drive Run and log a complete analysis of drive caching, timing and reading behavior; verifies that cdparanoia is correctly modelling a sprcific drive's cache and read behavior. Implies -vQL. .TP .B \-v --verbose Be absurdly verbose about the autosensing and reading process. Good for setup and debugging. .TP .B \-q --quiet Do not print any progress or error information during the reading process. .TP .B \-e --stderr-progress Force output of progress information to stderr (for wrapper scripts). .TP .B \-l --log-summary [file] Save result summary to file, default filename cdparanoia.log. .TP .B \-L --log-debug [file] Save detailed device autosense and debugging output to a file, default filename cdparanoia.log. .TP .B \-V --version Print the program version and quit. .TP .B \-Q --query Perform CDROM drive autosense, query and print the CDROM table of contents, then quit. .TP .B \-s --search-for-drive Forces a complete search for a cdrom drive, even if the /dev/cdrom link exists. .TP .B \-h --help Print a brief synopsis of .B cdparanoia usage and options. .TP .B \-p --output-raw Output headerless data as raw 16 bit PCM data with interleaved samples in host byte order. To force little or big endian byte order, use .B \-r or .B \-R as described below. .TP .B \-r --output-raw-little-endian Output headerless data as raw 16 bit PCM data with interleaved samples in LSB first byte order. .TP .B \-R --output-raw-big-endian Output headerless data as raw 16 bit PCM data with interleaved samples in MSB first byte order. .TP .B \-w --output-wav Output data in Micro$oft RIFF WAV format (note that WAV data is always LSB first byte order). .TP .B \-f --output-aiff Output data in Apple AIFF format (note that AIFC data is always in MSB first byte order). .TP .B \-a --output-aifc Output data in uncompressed Apple AIFF-C format (note that AIFF-C data is always in MSB first byte order). .TP .BI "\-B --batch " Cdda2wav-style batch output flag; cdparanoia will split the output into multiple files at track boundaries. Output file names are prepended with 'track#.' .TP .B \-c --force-cdrom-little-endian Some CDROM drives misreport their endianness (or do not report it at all); it's possible that cdparanoia will guess wrong. Use .B \-c to force cdparanoia to treat the drive as a little endian device. .TP .B \-C --force-cdrom-big-endian As above but force cdparanoia to treat the drive as a big endian device. .TP .BI "\-n --force-default-sectors " n Force the interface backend to do atomic reads of .B n sectors per read. This number can be misleading; the kernel will often split read requests into multiple atomic reads (the automated Paranoia code is aware of this) or allow reads only wihin a restricted size range. .B This option should generally not be used. .TP .BI "\-d --force-cdrom-device " device Force the interface backend to read from .B device rather than the first readable CDROM drive it finds. This can be used to specify devices of any valid interface type (ATAPI, SCSI or proprietary). .TP .BI "\-k --force-cooked-device " device This option forces use of the old 'cooked ioctl' kernel interface with the specified cdrom device. The cooked ioctl interface is obsolete in Linux 2.6 if it is present at all. .B \-k cannot be used with .B \-d or .BR \-g . .TP .BI "\-g --force-generic-device " device This option forces use of the old 'generic scsi' (sg) kernel interface with the specified generic scsi device. .B \-g cannot be used with .BR \-k . .B \-g may be used with .B \-d to explicitly set both the SCSI cdrom and generic (sg) devices seperately. This option is only useful on obsolete SCSI setups and when using the generic scsi (sg) driver. .TP .BI "\-S --force-read-speed " number Use this option explicitly to set the read rate of the CD drive (where supported). This can reduce underruns on machines with slow disks, or which are low on memory. .TP .BI "\-t --toc-offset " number Use this option to force the entire disc LBA addressing to shift by the given amount; the value is added to the beginning offsets in the TOC. This can be used to shift track boundaries for the whole disc manually on sector granularity. The next option does something similar... .TP .BI "\-T --toc-bias " Some drives (usually random Toshibas) report the actual track beginning offset values in the TOC, but then treat the beginning of track 1 index 1 as sector 0 for all read operations. This results in every track seeming to start too late (losing a bit of the beginning and catching a bit of the next track). .B \-T accounts for this behavior. Note that this option will cause cdparanoia to attempt to read sectors before or past the known user data area of the disc, resulting in read errors at disc edges on most drives and possibly even hard lockups on some buggy hardware. .TP .BI "\-O --sample-offset " number Use this option to force the entire disc to shift sample position output by the given amount; This can be used to shift track boundaries for the whole disc manually on sample granularity. Note that this will cause cdparanoia to attempt to read partial sectors before or past the known user data area of the disc, probably causing read errors on most drives and possibly even hard lockups on some buggy hardware. .TP .B \-Z --disable-paranoia Disable .B all data verification and correction features. When using -Z, cdparanoia reads data exactly as would cdda2wav with an overlap setting of zero. This option implies that .B \-Y is active. .TP .B \-z --never-skip[=max_retries] Do not accept any skips; retry forever if needed. An optional maximum number of retries can be specified; for comparison, default without -z is currently 20. .TP .B \-Y --disable-extra-paranoia Disables intra-read data verification; only overlap checking at read boundaries is performed. It can wedge if errors occur in the attempted overlap area. Not recommended. .TP .B \-X --abort-on-skip If the read skips due to imperfect data, a scratch, whatever, abort reading this track. If output is to a file, delete the partially completed file. .SH OUTPUT SMILIES .TP .B :-) Normal operation, low/no jitter .TP .B :-| Normal operation, considerable jitter .TP .B :-/ Read drift .TP .B :-P Unreported loss of streaming in atomic read operation .TP .B 8-| Finding read problems at same point during reread; hard to correct .TP .B :-0 SCSI/ATAPI transport error .TP .B :-( Scratch detected .TP .B ;-( Gave up trying to perform a correction .TP .B 8-X Aborted read due to known, uncorrectable error .TP .B :^D Finished extracting .SH PROGRESS BAR SYMBOLS .TP .B No corrections needed .TP .B - Jitter correction required .TP .B + Unreported loss of streaming/other error in read .TP .B ! Errors found after stage 1 correction; the drive is making the same error through multiple re-reads, and cdparanoia is having trouble detecting them. .TP .B e SCSI/ATAPI transport error (corrected) .TP .B V Uncorrected error/skip .SH SPAN ARGUMENT The span argument specifies which track, tracks or subsections of tracks to read. This argument is required. .B NOTE: Unless the span is a simple number, it's generally a good idea to quote the span argument to protect it from the shell. .P The span argument may be a simple track number or an offset/span specification. The syntax of an offset/span takes the rough form: .P 1[ww:xx:yy.zz]-2[aa:bb:cc.dd] .P Here, 1 and 2 are track numbers; the numbers in brackets provide a finer grained offset within a particular track. [aa:bb:cc.dd] is in hours/minutes/seconds/sectors format. Zero fields need not be specified: [::20], [:20], [20], [20.], etc, would be interpreted as twenty seconds, [10:] would be ten minutes, [.30] would be thirty sectors (75 sectors per second). .P When only a single offset is supplied, it is interpreted as a starting offset and ripping will continue to the end of the track. If a single offset is preceeded or followed by a hyphen, the implicit missing offset is taken to be the start or end of the disc, respectively. Thus: .TP .B 1:[20.35] Specifies ripping from track 1, second 20, sector 35 to the end of track 1. .TP .B 1:[20.35]- Specifies ripping from 1[20.35] to the end of the disc .TP .B \-2 Specifies ripping from the beginning of the disc up to (and including) track 2 .TP .B \-2:[30.35] Specifies ripping from the beginning of the disc up to 2:[30.35] .TP .B 2-4 Specifies ripping from the beginning of track 2 to the end of track 4. .P Again, don't forget to protect square brackets and preceeding hyphens from the shell. .SH EXAMPLES A few examples, protected from the shell: .TP Query only with exhaustive search for a drive and full reporting of autosense: .P cdparanoia -vsQ .TP Extract an entire disc, putting each track in a seperate file: .P cdparanoia -B .TP Extract from track 1, time 0:30.12 to 1:10.00: .P cdparanoia "1[:30.12]-1[1:10]" .TP Extract from the beginning of the disc up to track 3: .P cdparanoia -- "-3" .TP The "--" above is to distinguish "-3" from an option flag. .SH OUTPUT The output file argument is optional; if it is not specified, cdparanoia will output samples to one of .BR cdda.wav ", " cdda.aifc ", or " cdda.raw depending on whether .BR \-w ", " \-a ", " \-r " or " \-R " is used (" \-w is the implicit default). The output file argument of .B \- specifies standard output; all data formats may be piped. .SH ACKNOWLEDGEMENTS Cdparanoia sprang from and once drew heavily from the interface of Heiko Eissfeldt's (heiko@colossus.escape.de) 'cdda2wav' package. Cdparanoia would not have happened without it. .P Joerg Schilling has also contributed SCSI expertise through his generic SCSI transport library. .P .SH AUTHOR Monty .P Cdparanoia's homepage may be found at: http://www.xiph.org/paranoia/ cdparanoia-3.10.2+debian/header.h0000644000175000017500000000056211046366435016002 0ustar danieldaniel/****************************************************************** * CopyPolicy: GNU Public License 2 applies * Copyright (C) 2008 Monty xiphmont@mit.edu ******************************************************************/ #include extern void WriteWav(int f,long bytes); extern void WriteAifc(int f,long bytes); extern void WriteAiff(int f,long bytes); cdparanoia-3.10.2+debian/main.c0000644000175000017500000011765611062304546015477 0ustar danieldaniel/* * Copyright: GNU Public License 2 applies * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. * * cdparanoia (C) 2008 Monty * */ #include #include #include #include #include #include #include #include #include #include #include #include "interface/cdda_interface.h" #include "paranoia/cdda_paranoia.h" #include "utils.h" #include "report.h" #include "version.h" #include "header.h" extern int analyze_cache(cdrom_drive *d, FILE *progress, FILE *log, int speed); static long parse_offset(cdrom_drive *d, char *offset, int begin){ long track=-1; long hours=-1; long minutes=-1; long seconds=-1; long sectors=-1; char *time=NULL,*temp=NULL; long ret; if(offset==NULL)return(-1); /* seperate track from time offset */ temp=strchr(offset,']'); if(temp){ *temp='\0'; temp=strchr(offset,'['); if(temp==NULL){ report("Error parsing span argument"); exit(1); } *temp='\0'; time=temp+1; } /* parse track */ { int chars=strspn(offset,"0123456789"); if(chars>0){ offset[chars]='\0'; track=atoi(offset); if(track<0 || track>d->tracks){ /*take track 0 as pre-gap of 1st track*/ report("Track #%ld does not exist.",track); exit(1); } } } while(time){ long val,chars; char *sec=strrchr(time,'.'); if(!sec)sec=strrchr(time,':'); if(!sec)sec=time-1; chars=strspn(sec+1,"0123456789"); if(chars) val=atoi(sec+1); else val=0; switch(*sec){ case '.': if(sectors!=-1){ report("Error parsing span argument"); exit(1); } sectors=val; break; default: if(seconds==-1) seconds=val; else if(minutes==-1) minutes=val; else if(hours==-1) hours=val; else{ report("Error parsing span argument"); exit(1); } break; } if(sec<=time)break; *sec='\0'; } if(track==-1){ if(seconds==-1 && sectors==-1)return(-1); if(begin==-1) ret=cdda_disc_firstsector(d); else ret=begin; }else{ if(seconds==-1 && sectors==-1){ if(begin==-1){ /* first half of a span */ return(cdda_track_firstsector(d,track)); }else{ return(cdda_track_lastsector(d,track)); } }else{ /* relative offset into a track */ ret=cdda_track_firstsector(d,track); } } /* OK, we had some sort of offset into a track */ if(sectors!=-1)ret+=sectors; if(seconds!=-1)ret+=seconds*75; if(minutes!=-1)ret+=minutes*60*75; if(hours!=-1)ret+=hours*60*60*75; /* We don't want to outside of the track; if it's relative, that's OK... */ if(track!=-1){ if(cdda_sector_gettrack(d,ret)!=track){ report("Time/sector offset goes beyond end of specified track."); exit(1); } } /* Don't pass up end of session */ if(ret>cdda_disc_lastsector(d)){ report("Time/sector offset goes beyond end of disc."); exit(1); } return(ret); } static void display_toc(cdrom_drive *d){ long audiolen=0; int i; report("\nTable of contents (audio tracks only):\n" "track length begin copy pre ch\n" "==========================================================="); for(i=1;i<=d->tracks;i++) if(cdda_track_audiop(d,i)>0){ long sec=cdda_track_firstsector(d,i); long off=cdda_track_lastsector(d,i)-sec+1; report("%3d. %7ld [%02d:%02d.%02d] %7ld [%02d:%02d.%02d] %s %s %s", i, off,(int)(off/(60*75)),(int)((off/75)%60),(int)(off%75), sec,(int)(sec/(60*75)),(int)((sec/75)%60),(int)(sec%75), cdda_track_copyp(d,i)?" OK":" no", cdda_track_preemp(d,i)?" yes":" no", cdda_track_channels(d,i)==2?" 2":" 4"); audiolen+=off; } report("TOTAL %7ld [%02d:%02d.%02d] (audio only)", audiolen,(int)(audiolen/(60*75)),(int)((audiolen/75)%60), (int)(audiolen%75)); report(" "); } static void usage(FILE *f){ fprintf( f, VERSION"\n" "(C) 2008 Monty and Xiph.Org\n\n" \ "Report bugs to paranoia@xiph.org\n"\ "http://www.xiph.org/paranoia/\n" "USAGE:\n" " cdparanoia [options] [outfile]\n\n" "OPTIONS:\n" " -A --analyze-drive : run and log a complete analysis of drive\n" " caching, timing and reading behavior;\n" " verifies that cdparanoia is correctly\n" " modelling a sprcific drive's cache and\n" " read behavior. Implies -vQL\n\n" " -v --verbose : extra verbose operation\n" " -q --quiet : quiet operation\n" " -e --stderr-progress : force output of progress information to\n" " stderr (for wrapper scripts)\n" " -l --log-summary [] : save result summary to file, default\n" " filename cdparanoia.log\n" " -L --log-debug [] : save detailed device autosense and\n" " debugging output to file, default\n" " filename cdparanoia.log\n" " -V --version : print version info and quit\n" " -Q --query : autosense drive, query disc and quit\n" " -B --batch : 'batch' mode (saves each track to a\n" " seperate file.\n" " -s --search-for-drive : do an exhaustive search for drive\n" " -h --help : print help\n\n" " -p --output-raw : output raw 16 bit PCM in host byte \n" " order\n" " -r --output-raw-little-endian : output raw 16 bit little-endian PCM\n" " -R --output-raw-big-endian : output raw 16 bit big-endian PCM\n" " -w --output-wav : output as WAV file (default)\n" " -f --output-aiff : output as AIFF file\n" " -a --output-aifc : output as AIFF-C file\n\n" " -c --force-cdrom-little-endian : force treating drive as little endian\n" " -C --force-cdrom-big-endian : force treating drive as big endian\n" " -n --force-default-sectors : force default number of sectors in read\n" " to n sectors\n" " -o --force-search-overlap : force minimum overlap search during\n" " verification to n sectors\n" " -d --force-cdrom-device : use specified device; disallow \n" " autosense\n" " -k --force-cooked-device : use specified cdrom device and force\n" " use of the old 'cooked ioctl' kernel\n" " interface. -k cannot be used with -d\n" " or -g.\n" " -g --force-generic-device : use specified generic scsi device and\n" " force use of the old SG kernel\n" " interface. -g cannot be used with -k.\n" " -S --force-read-speed : read from device at specified speed; by\n" " default, cdparanoia sets drive to full\n" " speed.\n" " -t --toc-offset : Add sectors to the values reported\n" " when addressing tracks. May be negative\n" " -T --toc-bias : Assume that the beginning offset of \n" " track 1 as reported in the TOC will be\n" " addressed as LBA 0. Necessary for some\n" " Toshiba drives to get track boundaries\n" " correct\n" " -O --sample-offset : Add samples to the offset when\n" " reading data. May be negative.\n" " -z --never-skip[=n] : never accept any less than perfect\n" " data reconstruction (don't allow 'V's)\n" " but if [n] is given, skip after [n]\n" " retries without progress.\n" " -Z --disable-paranoia : disable all paranoia checking\n" " -Y --disable-extra-paranoia : only do cdda2wav-style overlap checking\n" " -X --abort-on-skip : abort on imperfect reads/skips\n\n" "OUTPUT SMILIES:\n" " :-) Normal operation, low/no jitter\n" " :-| Normal operation, considerable jitter\n" " :-/ Read drift\n" " :-P Unreported loss of streaming in atomic read operation\n" " 8-| Finding read problems at same point during reread; hard to correct\n" " :-0 SCSI/ATAPI transport error\n" " :-( Scratch detected\n" " ;-( Gave up trying to perform a correction\n" " 8-X Aborted (as per -X) due to a scratch/skip\n" " :^D Finished extracting\n\n" "PROGRESS BAR SYMBOLS:\n" " No corrections needed\n" " - Jitter correction required\n" " + Unreported loss of streaming/other error in read\n" " ! Errors are getting through stage 1 but corrected in stage2\n" " e SCSI/ATAPI transport error (corrected)\n" " V Uncorrected error/skip\n\n" "SPAN ARGUMENT:\n" "The span argument may be a simple track number or a offset/span\n" "specification. The syntax of an offset/span takes the rough form:\n\n" " 1[ww:xx:yy.zz]-2[aa:bb:cc.dd] \n\n" "Here, 1 and 2 are track numbers; the numbers in brackets provide a\n" "finer grained offset within a particular track. [aa:bb:cc.dd] is in\n" "hours/minutes/seconds/sectors format. Zero fields need not be\n" "specified: [::20], [:20], [20], [20.], etc, would be interpreted as\n" "twenty seconds, [10:] would be ten minutes, [.30] would be thirty\n" "sectors (75 sectors per second).\n\n" "When only a single offset is supplied, it is interpreted as a starting\n" "offset and ripping will continue to the end of he track. If a single\n" "offset is preceeded or followed by a hyphen, the implicit missing\n" "offset is taken to be the start or end of the disc, respectively. Thus:\n\n" " 1:[20.35] Specifies ripping from track 1, second 20, sector 35 to \n" " the end of track 1.\n\n" " 1:[20.35]- Specifies ripping from 1[20.35] to the end of the disc\n\n" " -2 Specifies ripping from the beginning of the disc up to\n" " (and including) track 2\n\n" " -2:[30.35] Specifies ripping from the beginning of the disc up to\n" " 2:[30.35]\n\n" " 2-4 Specifies ripping from the beginning of track two to the\n" " end of track 4.\n\n" "Don't forget to protect square brackets and preceeding hyphens from\n" "the shell...\n\n" "A few examples, protected from the shell:\n" " A) query only with exhaustive search for a drive and full reporting\n" " of autosense:\n" " cdparanoia -vsQ\n\n" " B) extract up to and including track 3, putting each track in a seperate\n" " file:\n" " cdparanoia -B -- \"-3\"\n\n" " C) extract from track 1, time 0:30.12 to 1:10.00:\n" " cdparanoia \"1[:30.12]-1[1:10]\"\n\n" "Submit bug reports to paranoia@xiph.org\n\n"); } long callbegin; long callend; long callscript=0; static char *callback_strings[16]={"wrote", "finished", "read", "verify", "jitter", "correction", "scratch", "scratch repair", "skip", "drift", "backoff", "overlap", "dropped", "duped", "transport error", "cache error"}; static int skipped_flag=0; static int abort_on_skip=0; FILE *logfile = NULL; static void callback(long inpos, int function){ /* (== PROGRESS == [--+!---x--------------> | 007218 01 ] == :-) . ==) */ int graph=30; char buffer[256]; static long c_sector=0,v_sector=0; static char dispcache[]=" "; static int last=0; static long lasttime=0; long sector,osector=0; struct timeval thistime; static char heartbeat=' '; int position=0,aheadposition=0; static int overlap=0; static int printit=-1; static int slevel=0; static int slast=0; static int stimeout=0; static int cacheerr=0; char *smilie="= :-)"; if(callscript) fprintf(stderr,"##: %d [%s] @ %ld\n", function,(function>=-2&&function<=13?callback_strings[function+2]: ""),inpos); else{ if(function==PARANOIA_CB_CACHEERR){ if(!cacheerr){ fprintf(stderr, "\rWARNING: The CDROM drive appears to be seeking impossibly quickly.\n" "This could be due to timer bugs, a drive that really is improbably fast,\n" "or, most likely, a bug in cdparanoia's cache modelling.\n\n" "Please consider using the -A option to perform an analysis run, then mail\n" "the cdparanoia.log file produced by the analysis to paranoia-dev@xiph.org\n" "to assist developers in correcting the problem.\n\n"); } cacheerr++; } } if(!quiet){ long test; osector=inpos; sector=inpos/CD_FRAMEWORDS; if(printit==-1){ if(isatty(STDERR_FILENO)){ printit=1; }else{ printit=0; } } if(printit==1){ /* else don't bother; it's probably being redirected */ position=((float)(sector-callbegin)/ (callend-callbegin))*graph; aheadposition=((float)(c_sector-callbegin)/ (callend-callbegin))*graph; if(function==-2){ v_sector=sector; return; } if(function==-1){ last=8; heartbeat='*'; slevel=0; v_sector=sector; }else if(position=0) switch(function){ case PARANOIA_CB_VERIFY: if(stimeout>=30){ if(overlap>CD_FRAMEWORDS) slevel=2; else slevel=1; } break; case PARANOIA_CB_READ: if(sector>c_sector)c_sector=sector; break; case PARANOIA_CB_FIXUP_EDGE: if(stimeout>=5){ if(overlap>CD_FRAMEWORDS) slevel=2; else slevel=1; } if(dispcache[position]==' ') dispcache[position]='-'; break; case PARANOIA_CB_FIXUP_ATOM: if(slevel<3 || stimeout>5)slevel=3; if(dispcache[position]==' ' || dispcache[position]=='-') dispcache[position]='+'; break; case PARANOIA_CB_READERR: slevel=6; if(dispcache[position]!='V' && dispcache[position]!='C') dispcache[position]='e'; break; case PARANOIA_CB_CACHEERR: slevel=8; dispcache[position]='C'; break; case PARANOIA_CB_SKIP: slevel=8; if(dispcache[position]!='C') dispcache[position]='V'; break; case PARANOIA_CB_OVERLAP: overlap=osector; break; case PARANOIA_CB_SCRATCH: slevel=7; break; case PARANOIA_CB_DRIFT: if(slevel<4 || stimeout>5)slevel=4; break; case PARANOIA_CB_FIXUP_DROPPED: case PARANOIA_CB_FIXUP_DUPED: slevel=5; if(dispcache[position]==' ' || dispcache[position]=='-' || dispcache[position]=='+') dispcache[position]='!'; break; } switch(slevel){ case 0: /* finished, or no jitter */ if(skipped_flag) smilie=" 8-X"; else smilie=" :^D"; break; case 1: /* normal. no atom, low jitter */ smilie=" :-)"; break; case 2: /* normal, overlap > 1 */ smilie=" :-|"; break; case 4: /* drift */ smilie=" :-/"; break; case 3: /* unreported loss of streaming */ smilie=" :-P"; break; case 5: /* dropped/duped bytes */ smilie=" 8-|"; break; case 6: /* scsi error */ smilie=" :-0"; break; case 7: /* scratch */ smilie=" :-("; break; case 8: /* skip */ smilie=" ;-("; skipped_flag=1; break; } gettimeofday(&thistime,NULL); test=thistime.tv_sec*10+thistime.tv_usec/100000; if(lasttime!=test || function==-1 || slast!=slevel){ if(lasttime!=test || function==-1){ last++; lasttime=test; if(last>7)last=0; stimeout++; switch(last){ case 0: heartbeat=' '; break; case 1:case 7: heartbeat='.'; break; case 2:case 6: heartbeat='o'; break; case 3:case 5: heartbeat='0'; break; case 4: heartbeat='O'; break; } if(function==-1) heartbeat='*'; } if(slast!=slevel){ stimeout=0; } slast=slevel; if(abort_on_skip && skipped_flag && function !=-1){ sprintf(buffer, "\r (== PROGRESS == [%s| %06ld %02d ] ==%s %c ==) ", " ...aborting; please wait... ", v_sector,overlap/CD_FRAMEWORDS,smilie,heartbeat); }else{ if(v_sector==0) sprintf(buffer, "\r (== PROGRESS == [%s| ...... %02d ] ==%s %c ==) ", dispcache,overlap/CD_FRAMEWORDS,smilie,heartbeat); else sprintf(buffer, "\r (== PROGRESS == [%s| %06ld %02d ] ==%s %c ==) ", dispcache,v_sector,overlap/CD_FRAMEWORDS,smilie,heartbeat); if(aheadposition>=0 && aheadposition=argc && !query_only){ if(batch) span=NULL; else{ /* D'oh. No span. Fetch me a brain, Igor. */ usage(stderr); exit(1); } }else span=copystring(argv[optind]); report(VERSION); if(verbose){ report("Using cdda library version: %s",cdda_version()); report("Using paranoia library version: %s",paranoia_version()); } /* Query the cdrom/disc; we may need to override some settings */ if(force_cooked_device){ d=cdda_identify_cooked(force_cooked_device,verbose,NULL); }else if(force_generic_device) d=cdda_identify_scsi(force_generic_device,force_cdrom_device,verbose,NULL); else if(force_cdrom_device) d=cdda_identify(force_cdrom_device,verbose,NULL); else if(search) d=cdda_find_a_cdrom(verbose,NULL); else{ /* does the /dev/cdrom link exist? */ struct stat s; if(lstat("/dev/cdrom",&s)){ /* no link. Search anyway */ d=cdda_find_a_cdrom(verbose,NULL); }else{ d=cdda_identify("/dev/cdrom",verbose,NULL); if(d==NULL && !verbose){ verbose=1; report("\n/dev/cdrom exists but isn't accessible. By default,\n" "cdparanoia stops searching for an accessible drive here.\n" "Consider using -sv to force a more complete autosense\n" "of the machine.\n\nMore information about /dev/cdrom:"); d=cdda_identify("/dev/cdrom",CDDA_MESSAGE_PRINTIT,NULL); report("\n"); exit(1); }else report(" "); } } if(!d){ if(!verbose) report("\nUnable to open cdrom drive; -v will give more information."); exit(1); } if(verbose) cdda_verbose_set(d,CDDA_MESSAGE_PRINTIT,CDDA_MESSAGE_PRINTIT); else cdda_verbose_set(d,CDDA_MESSAGE_PRINTIT,CDDA_MESSAGE_FORGETIT); /* possibly force hand on endianness of drive, sector request size */ if(force_cdrom_endian!=-1){ d->bigendianp=force_cdrom_endian; switch(force_cdrom_endian){ case 0: report("Forcing CDROM sense to little-endian; ignoring preset and autosense"); break; case 1: report("Forcing CDROM sense to big-endian; ignoring preset and autosense"); break; } } if(force_cdrom_sectors!=-1){ if(force_cdrom_sectors<0 || force_cdrom_sectors>100){ report("Default sector read size must be 1<= n <= 100\n"); cdda_close(d); d=NULL; exit(1); } report("Forcing default to read %d sectors; " "ignoring preset and autosense",force_cdrom_sectors); d->nsectors=force_cdrom_sectors; d->bigbuff=force_cdrom_sectors*CD_FRAMESIZE_RAW; } if(force_cdrom_overlap!=-1){ if(force_cdrom_overlap<0 || force_cdrom_overlap>75){ report("Search overlap sectors must be 0<= n <=75\n"); cdda_close(d); d=NULL; exit(1); } report("Forcing search overlap to %d sectors; " "ignoring autosense",force_cdrom_overlap); } switch(cdda_open(d)){ case -2:case -3:case -4:case -5: report("\nUnable to open disc. Is there an audio CD in the drive?"); exit(1); case -6: report("\ncdparanoia could not find a way to read audio from this drive."); exit(1); case 0: break; default: report("\nUnable to open disc."); exit(1); } if(force_cdrom_speed==0)force_cdrom_speed=-1; if(force_cdrom_speed!=-1){ report("\nAttempting to set speed to %dx... ",force_cdrom_speed); }else{ if(verbose) report("\nAttempting to set cdrom to full speed... "); } if(cdda_speed_set(d,force_cdrom_speed)){ if(verbose || force_cdrom_speed!=-1) report("\tCDROM speed set FAILED. Continuing anyway..."); }else{ if(verbose) report("\tdrive returned OK."); } if(run_cache_test){ int warn=analyze_cache(d, stderr, reportfile, force_cdrom_speed); if(warn==0){ reportC("\nDrive tests OK with Paranoia.\n\n"); return 0; } if(warn==1) reportC("\nWARNING! PARANOIA MAY NOT BE TRUSTWORTHY WITH THIS DRIVE!\n" "\nThe Paranoia library may not model this CDROM drive's cache" "\ncorrectly according to this analysis run. Analysis is not" "\nalways accurate (it can be fooled by machine load or random" "\nkernel latencies), but if a failed result happens more often" "\nthan one time in twenty on an unloaded machine, please mail" "\nthe %s file produced by this failed analysis to" "\nparanoia-dev@xiph.org to assist developers in extending" "\nParanoia to handle this CDROM properly.\n\n",reportfile_name); return 1; } /* Dump the TOC */ if(query_only || verbose)display_toc(d); if(query_only)exit(0); /* bias the disc. A hack. Of course. */ /* we may need to read before or past user area; this is never default, and we do it because the [allegedly informed] user told us to */ if(sample_offset){ toc_offset+=sample_offset/588; sample_offset%=588; if(sample_offset<0){ sample_offset+=588; toc_offset--; } } if(toc_bias){ toc_offset=-cdda_track_firstsector(d,1); } for(i=0;itracks+1;i++) d->disc_toc[i].dwStartSector+=toc_offset; if(d->nsectors==1){ report("WARNING: The autosensed/selected sectors per read value is\n" " one sector, making it very unlikely Paranoia can \n" " work.\n\n" " Attempting to continue...\n\n"); } /* parse the span, set up begin and end sectors */ { long first_sector; long last_sector; long batch_first; long batch_last; int batch_track; if(span){ /* look for the hyphen */ char *span2=strchr(span,'-'); if(strrchr(span,'-')!=span2){ report("Error parsing span argument"); cdda_close(d); d=NULL; exit(1); } if(span2!=NULL){ *span2='\0'; span2++; } first_sector=parse_offset(d,span,-1); if(first_sector==-1) last_sector=parse_offset(d,span2,cdda_disc_firstsector(d)); else last_sector=parse_offset(d,span2,first_sector); if(first_sector==-1){ if(last_sector==-1){ report("Error parsing span argument"); cdda_close(d); d=NULL; exit(1); }else{ first_sector=cdda_disc_firstsector(d); } }else{ if(last_sector==-1){ if(span2){ /* There was a hyphen */ last_sector=cdda_disc_lastsector(d); }else{ last_sector= cdda_track_lastsector(d,cdda_sector_gettrack(d,first_sector)); } } } }else{ first_sector=cdda_disc_firstsector(d); last_sector=cdda_disc_lastsector(d); } { int track1=cdda_sector_gettrack(d,first_sector); int track2=cdda_sector_gettrack(d,last_sector); long off1=first_sector-cdda_track_firstsector(d,track1); long off2=last_sector-cdda_track_firstsector(d,track2); int i; for(i=track1;i<=track2;i++) if(!cdda_track_audiop(d,i)){ report("Selected span contains non audio tracks. Aborting.\n\n"); exit(1); } report("Ripping from sector %7ld (track %2d [%d:%02d.%02d])\n" "\t to sector %7ld (track %2d [%d:%02d.%02d])\n",first_sector, track1,(int)(off1/(60*75)),(int)((off1/75)%60),(int)(off1%75), last_sector, track2,(int)(off2/(60*75)),(int)((off2/75)%60),(int)(off2%75)); } { long cursor; int16_t offset_buffer[1176]; int offset_buffer_used=0; int offset_skip=sample_offset*4; p=paranoia_init(d); paranoia_modeset(p,paranoia_mode); if(force_cdrom_overlap!=-1)paranoia_overlapset(p,force_cdrom_overlap); if(verbose) cdda_verbose_set(d,CDDA_MESSAGE_LOGIT,CDDA_MESSAGE_LOGIT); else cdda_verbose_set(d,CDDA_MESSAGE_FORGETIT,CDDA_MESSAGE_FORGETIT); paranoia_seek(p,cursor=first_sector,SEEK_SET); /* this is probably a good idea in general */ seteuid(getuid()); setegid(getgid()); /* we'll need to be able to read one sector past user data if we have a sample offset in order to pick up the last bytes. We need to set the disc length forward here so that the libs are willing to read past, assuming that works on the hardware, of course */ if(sample_offset) d->disc_toc[d->tracks].dwStartSector++; while(cursor<=last_sector){ char outfile_name[256]; if(batch){ batch_first=cursor; batch_last= cdda_track_lastsector(d,batch_track= cdda_sector_gettrack(d,cursor)); if(batch_last>last_sector)batch_last=last_sector; }else{ batch_first=first_sector; batch_last=last_sector; batch_track=-1; } callbegin=batch_first; callend=batch_last; /* argv[optind] is the span, argv[optind+1] (if exists) is outfile */ if(optind+1256?256:pos); if(batch) snprintf(outfile_name,246,"%strack%02d.%s",path,batch_track,file); else snprintf(outfile_name,246,"%s%s",path,file); if(file[0]=='\0'){ switch(output_type){ case 0: /* raw */ strcat(outfile_name,"cdda.raw"); break; case 1: strcat(outfile_name,"cdda.wav"); break; case 2: strcat(outfile_name,"cdda.aifc"); break; case 3: strcat(outfile_name,"cdda.aiff"); break; } } out=open(outfile_name,O_RDWR|O_CREAT|O_TRUNC,0666); if(out==-1){ report("Cannot open specified output file %s: %s",outfile_name, strerror(errno)); cdda_close(d); d=NULL; exit(1); } report("outputting to %s\n",outfile_name); if(logfile){ fprintf(logfile,"outputting to %s\n",outfile_name); fflush(logfile); } } }else{ /* default */ if(batch) sprintf(outfile_name,"track%02d.",batch_track); else outfile_name[0]='\0'; switch(output_type){ case 0: /* raw */ strcat(outfile_name,"cdda.raw"); break; case 1: strcat(outfile_name,"cdda.wav"); break; case 2: strcat(outfile_name,"cdda.aifc"); break; case 3: strcat(outfile_name,"cdda.aiff"); break; } out=open(outfile_name,O_RDWR|O_CREAT|O_TRUNC,0666); if(out==-1){ report("Cannot open default output file %s: %s",outfile_name, strerror(errno)); cdda_close(d); d=NULL; exit(1); } report("outputting to %s\n",outfile_name); if(logfile){ fprintf(logfile,"outputting to %s\n",outfile_name); fflush(logfile); } } switch(output_type){ case 0: /* raw */ break; case 1: /* wav */ WriteWav(out,(batch_last-batch_first+1)*CD_FRAMESIZE_RAW); break; case 2: /* aifc */ WriteAifc(out,(batch_last-batch_first+1)*CD_FRAMESIZE_RAW); break; case 3: /* aiff */ WriteAiff(out,(batch_last-batch_first+1)*CD_FRAMESIZE_RAW); break; } /* Off we go! */ if(offset_buffer_used){ /* partial sector from previous batch read */ cursor++; if(buffering_write(out, ((char *)offset_buffer)+offset_buffer_used, CD_FRAMESIZE_RAW-offset_buffer_used)){ report("Error writing output: %s",strerror(errno)); exit(1); } } skipped_flag=0; while(cursor<=batch_last){ /* read a sector */ int16_t *readbuf=paranoia_read_limited(p,callback,max_retries); char *err=cdda_errors(d); char *mes=cdda_messages(d); if(mes || err) fprintf(stderr,"\r " " \r%s%s\n", mes?mes:"",err?err:""); if(err)free(err); if(mes)free(mes); if(readbuf==NULL){ if(errno==EBADF || errno==ENOMEDIUM){ report("\nparanoia_read: CDROM drive unavailable, bailing.\n"); exit(1); } skipped_flag=1; report("\nparanoia_read: Unrecoverable error, bailing.\n"); break; } if(skipped_flag && abort_on_skip){ cursor=batch_last+1; break; } skipped_flag=0; cursor++; if(output_endian!=bigendianp()){ int i; for(i=0;ibatch_last){ int i; /* read a sector and output the partial offset. Save the rest for the next batch iteration */ readbuf=paranoia_read_limited(p,callback,max_retries); err=cdda_errors(d);mes=cdda_messages(d); if(mes || err) fprintf(stderr,"\r " " \r%s%s\n", mes?mes:"",err?err:""); if(err)free(err);if(mes)free(mes); if(readbuf==NULL){ skipped_flag=1; report("\nparanoia_read: Unrecoverable error reading through " "sample_offset shift\n\tat end of track, bailing.\n"); break; } if(skipped_flag && abort_on_skip)break; skipped_flag=0; /* do not move the cursor */ if(output_endian!=bigendianp()) for(i=0;isize) /* =========================================================================== * ib() * * This macro returns the absolute position of the first sample in the vector * indexed by the given sort_info_t. */ #define ib(i) (*i->abspos) /* =========================================================================== * ie() * * This macro returns the absolute position of the sample after the last * sample in the vector indexed by the given sort_info_t. */ #define ie(i) (i->size+*i->abspos) /* =========================================================================== * iv() * * This macro returns the vector indexed by the given sort_info_t. */ #define iv(i) (i->vector) /* =========================================================================== * ipos() * * This macro returns the relative position (offset) within the indexed vector * at which the given match was found. * * It uses a little-known and frightening aspect of C pointer arithmetic: * subtracting a pointer is not an arithmetic subtraction, but rather the * additive inverse. In other words, since * q = p + n returns a pointer to the nth object in p, * q - p = p + n - p, and * q - p = n, not the difference of the two addresses. */ #define ipos(i,l) (l-i->revindex) #endif cdparanoia-3.10.2+debian/paranoia/overlapdef.txt0000644000175000017500000000037306756435167021076 0ustar danieldaniel 0 70 100 A |----------|-----| B |-----|---------| 0 40 100 offset=-30 begin=30 end=100 0 70 100 A |----------|-----| B |-----|---------| 50 90 150 offset=20 begin=30 end=100 cdparanoia-3.10.2+debian/paranoia/isort.c0000644000175000017500000001743311046366435017504 0ustar danieldaniel/*** * CopyPolicy: GNU Lesser General Public License 2.1 applies * Copyright (C) by Monty (xiphmont@mit.edu) * * sorted vector abstraction for paranoia * ***/ /* Old isort got a bit complex. This re-constrains complexity to give a go at speed through a more alpha-6-like mechanism. */ /* "Sort" is a bit of a misnomer in this implementation. It's actually * basically a hash table of sample values (with a linked-list collision * resolution), which lets you quickly determine where in a vector a * particular sample value occurs. * * Collisions aren't due to hash collisions, as the table has one bucket * for each possible sample value. Instead, the "collisions" represent * multiple occurrences of a given value. */ #include #include #include "p_block.h" #include "isort.h" /* =========================================================================== * sort_alloc() * * Allocates and initializes a new, empty sort_info object, which can be * used to index up to (size) samples from a vector. */ sort_info *sort_alloc(long size){ sort_info *ret=calloc(1,sizeof(sort_info)); ret->vector=NULL; ret->sortbegin=-1; ret->size=-1; ret->maxsize=size; ret->head=calloc(65536,sizeof(sort_link *)); ret->bucketusage=malloc(65536*sizeof(long)); ret->revindex=calloc(size,sizeof(sort_link)); ret->lastbucket=0; return(ret); } /* =========================================================================== * sort_unsortall() (internal) * * This function resets the index for further use with a different vector * or range, without the overhead of an unnecessary free/alloc. */ void sort_unsortall(sort_info *i){ /* If there were few enough different samples encountered (and hence few * enough buckets used), we can just zero out those buckets. If there * were many (2000 is picked somewhat arbitrarily), it's faster simply to * zero out all buckets with a memset() rather than walking the data * structure and zeroing them out one by one. */ if(i->lastbucket>2000){ /* a guess */ memset(i->head,0,65536*sizeof(sort_link *)); }else{ long b; for(b=0;blastbucket;b++) i->head[i->bucketusage[b]]=NULL; } i->lastbucket=0; i->sortbegin=-1; /* Curiously, this function preserves the vector association created * by sort_setup(), but it is used only internally by sort_setup, so * preserving this association is unnecessary. */ } /* =========================================================================== * sort_free() * * Releases all memory consumed by a sort_info object. */ void sort_free(sort_info *i){ free(i->revindex); free(i->head); free(i->bucketusage); free(i); } /* =========================================================================== * sort_sort() (internal) * * This function builds the index to allow for fast searching for sample * values within a portion (sortlo - sorthi) of the object's associated * vector. It is called internally and only when needed. */ static void sort_sort(sort_info *i,long sortlo,long sorthi){ long j; /* We walk backward through the range to index because we insert new * samples at the head of each bucket's list. At the end, they'll be * sorted from first to last occurrence. */ for(j=sorthi-1;j>=sortlo;j--){ /* i->vector[j] = the signed 16-bit sample to index. * hv = pointer to the head of the sorted list of occurences * of this sample * l = the node to associate with this sample * * We add 32768 to convert the signed 16-bit integer to an unsigned * range from 0 to 65535. * * Note that l is located within i->revindex at a position * corresponding to the sample's position in the vector. This allows * ipos() to determine the sample position from a returned sort_link. */ sort_link **hv=i->head+i->vector[j]+32768; sort_link *l=i->revindex+j; /* If this is the first time we've encountered this sample, add its * bucket to the list of buckets used. This list is used only for * resetting the index quickly. */ if(*hv==NULL){ i->bucketusage[i->lastbucket]=i->vector[j]+32768; i->lastbucket++; } /* Point the new node at the old head, then assign the new node as * the new head. */ l->next=*hv; *hv=l; } /* Mark the index as initialized. */ i->sortbegin=0; } /* =========================================================================== * sort_setup() * * This function initializes a previously allocated sort_info_t. The * sort_info_t is associated with a vector of samples of length * (size), whose position begins at (*abspos) within the CD's stream * of samples. Only the range of samples between (sortlo, sorthi) * will eventually be indexed for fast searching. (sortlo, sorthi) * are absolute sample positions. * * Note: size *must* be <= the size given to the preceding sort_alloc(), * but no error checking is done here. */ void sort_setup(sort_info *i,int16_t *vector,long *abspos, long size,long sortlo,long sorthi){ /* Reset the index if it has already been built. */ if(i->sortbegin!=-1)sort_unsortall(i); i->vector=vector; i->size=size; i->abspos=abspos; /* Convert the absolute (sortlo, sorthi) to offsets within the vector. * Note that the index will not be built until sort_getmatch() is called. * Here we're simply hanging on to the range to index until then. */ i->lo=min(size,max(sortlo-*abspos,0)); i->hi=max(0,min(sorthi-*abspos,size)); } /* =========================================================================== * sort_getmatch() * * This function returns a sort_link_t pointer which refers to the * first sample equal to (value) in the vector. It only searches for * hits within (overlap) samples of (post), where (post) is an offset * within the vector. The caller can determine the position of the * matched sample using ipos(sort_info *, sort_link *). * * This function returns NULL if no matches were found. */ sort_link *sort_getmatch(sort_info *i,long post,long overlap,int value){ sort_link *ret; /* If the vector hasn't been indexed yet, index it now. */ if(i->sortbegin==-1)sort_sort(i,i->lo,i->hi); /* Now we reuse lo and hi */ /* We'll only return samples within (overlap) samples of (post). * Clamp the boundaries to search to the boundaries of the array, * convert the signed sample to an unsigned offset, and store the * state so that future calls to sort_nextmatch do the right thing. * * Reusing lo and hi this way is awful. */ post=max(0,min(i->size,post)); i->val=value+32768; i->lo=max(0,post-overlap); /* absolute position */ i->hi=min(i->size,post+overlap); /* absolute position */ /* Walk through the linked list of samples with this value, until * we find the first one within the bounds specified. If there * aren't any, return NULL. */ ret=i->head[i->val]; while(ret){ /* ipos() calculates the offset (in terms of the original vector) * of this hit. */ if(ipos(i,ret)lo){ ret=ret->next; }else{ if(ipos(i,ret)>=i->hi) ret=NULL; break; } } /*i->head[i->val]=ret;*/ return(ret); } /* =========================================================================== * sort_nextmatch() * * This function returns a sort_link_t pointer which refers to the next sample * matching the criteria previously passed to sort_getmatch(). See * sort_getmatch() for details. * * This function returns NULL if no further matches were found. */ sort_link *sort_nextmatch(sort_info *i,sort_link *prev){ sort_link *ret=prev->next; /* If there aren't any more hits, or we've passed the boundary requested * of sort_getmatch(), we're done. */ if(!ret || ipos(i,ret)>=i->hi)return(NULL); return(ret); } cdparanoia-3.10.2+debian/paranoia/p_block.h0000644000175000017500000001136211062275404017746 0ustar danieldaniel/*** * CopyPolicy: GNU Lesser General Public License 2.1 applies * Copyright (C) by Monty (xiphmont@mit.edu) ***/ #ifndef _p_block_h_ #define _p_block_h_ #include "../interface/cdda_interface.h" #define MIN_WORDS_OVERLAP 64 /* 16 bit words */ #define MIN_WORDS_SEARCH 64 /* 16 bit words */ #define MIN_WORDS_RIFT 16 /* 16 bit words */ #define MAX_SECTOR_OVERLAP 32 /* sectors */ #define MIN_SECTOR_EPSILON 128 /* words */ #define MIN_SECTOR_BACKUP 16 /* sectors */ #define JIGGLE_MODULO 15 /* sectors */ #define MIN_SILENCE_BOUNDARY 1024 /* 16 bit words */ #define CACHEMODEL_SECTORS 1200 #define min(x,y) ((x)>(y)?(y):(x)) #define max(x,y) ((x)<(y)?(y):(x)) #include "isort.h" typedef struct linked_list{ /* linked list */ struct linked_element *head; struct linked_element *tail; void *(*new_poly)(); void (*free_poly)(void *poly); long current; long active; } linked_list; typedef struct linked_element{ void *ptr; struct linked_element *prev; struct linked_element *next; struct linked_list *list; int stamp; } linked_element; extern linked_list *new_list(void *(*new)(void),void (*free)(void *)); extern linked_element *new_elem(linked_list *list); extern linked_element *add_elem(linked_list *list,void *elem); extern void free_list(linked_list *list,int free_ptr); /* unlink or free */ extern void free_elem(linked_element *e,int free_ptr); /* unlink or free */ extern void *get_elem(linked_element *e); extern linked_list *copy_list(linked_list *list); /* shallow; doesn't copy contained structures */ typedef struct c_block{ /* The buffer */ int16_t *vector; long begin; long size; /* auxiliary support structures */ unsigned char *flags; /* 1 known boundaries in read data 2 known blanked data 4 matched sample 8 reserved 16 reserved 32 reserved 64 reserved 128 reserved */ /* end of session cases */ long lastsector; struct cdrom_paranoia *p; struct linked_element *e; } c_block; extern void free_c_block(c_block *c); extern void i_cblock_destructor(c_block *c); extern c_block *new_c_block(struct cdrom_paranoia *p); typedef struct v_fragment{ c_block *one; long begin; long size; int16_t *vector; /* end of session cases */ long lastsector; /* linked list */ struct cdrom_paranoia *p; struct linked_element *e; } v_fragment; extern void free_v_fragment(v_fragment *c); extern v_fragment *new_v_fragment(struct cdrom_paranoia *p,c_block *one, long begin, long end, int lastsector); extern int16_t *v_buffer(v_fragment *v); extern c_block *c_first(struct cdrom_paranoia *p); extern c_block *c_last(struct cdrom_paranoia *p); extern c_block *c_next(c_block *c); extern c_block *c_prev(c_block *c); extern v_fragment *v_first(struct cdrom_paranoia *p); extern v_fragment *v_last(struct cdrom_paranoia *p); extern v_fragment *v_next(v_fragment *v); extern v_fragment *v_prev(v_fragment *v); typedef struct root_block{ long returnedlimit; long lastsector; struct cdrom_paranoia *p; c_block *vector; /* doesn't use any sorting */ int silenceflag; long silencebegin; } root_block; typedef struct offsets{ long offpoints; long newpoints; long offaccum; long offdiff; long offmin; long offmax; } offsets; typedef struct cdrom_paranoia{ cdrom_drive *d; root_block root; /* verified/reconstructed cached data */ linked_list *cache; /* our data as read from the cdrom */ long cache_limit; linked_list *fragments; /* fragments of blocks that have been 'verified' */ sort_info *sortcache; /* cache tracking */ int cdcache_size; int cdcache_begin; int cdcache_end; int jitter; int enable; long cursor; long current_lastsector; long current_firstsector; /* statistics for drift/overlap */ struct offsets stage1; struct offsets stage2; long dynoverlap; long dyndrift; /* statistics for verification */ } cdrom_paranoia; extern c_block *c_alloc(int16_t *vector,long begin,long size); extern void c_set(c_block *v,long begin); extern void c_insert(c_block *v,long pos,int16_t *b,long size); extern void c_remove(c_block *v,long cutpos,long cutsize); extern void c_overwrite(c_block *v,long pos,int16_t *b,long size); extern void c_append(c_block *v, int16_t *vector, long size); extern void c_removef(c_block *v, long cut); #define ce(v) (v->begin+v->size) #define cb(v) (v->begin) #define cs(v) (v->size) /* pos here is vector position from zero */ extern void recover_cache(cdrom_paranoia *p); extern void i_paranoia_firstlast(cdrom_paranoia *p); #define cv(c) (c->vector) #define fe(f) (f->begin+f->size) #define fb(f) (f->begin) #define fs(f) (f->size) #define fv(f) (v_buffer(f)) #define CDP_COMPILE #endif cdparanoia-3.10.2+debian/paranoia/gap.c0000644000175000017500000004112511051034604017070 0ustar danieldaniel/*** * CopyPolicy: GNU Lesser General Public License 2.1 applies * Copyright (C) by Monty (xiphmont@mit.edu) * * Gap analysis support code for paranoia * ***/ #include "p_block.h" #include "cdda_paranoia.h" #include "gap.h" #include /**** Gap analysis code ***************************************************/ /* =========================================================================== * i_paranoia_overlap_r (internal) * * This function seeks backward through two vectors (starting at the given * offsets) to determine how many consecutive samples agree. It returns * the number of matching samples, which may be 0. * * Unlike its sibling, i_paranoia_overlap_f, this function doesn't need to * be given the size of the vectors (all vectors stop at offset 0). * * This function is used by i_analyze_rift_r() below to find where a * leading rift ends. */ long i_paranoia_overlap_r(int16_t *buffA,int16_t *buffB, long offsetA, long offsetB){ long beginA=offsetA; long beginB=offsetB; /* Start at the given offsets and work our way backwards until we hit * the beginning of one of the vectors. */ for(;beginA>=0 && beginB>=0;beginA--,beginB--) if(buffA[beginA]!=buffB[beginB])break; return(offsetA-beginA); } /* =========================================================================== * i_paranoia_overlap_f (internal) * * This function seeks forward through two vectors (starting at the given * offsets) to determine how many consecutive samples agree. It returns * the number of matching samples, which may be 0. * * Unlike its sibling, i_paranoia_overlap_r, this function needs to given * the size of the vectors. * * This function is used by i_analyze_rift_f() below to find where a * trailing rift ends. */ long i_paranoia_overlap_f(int16_t *buffA,int16_t *buffB, long offsetA, long offsetB, long sizeA,long sizeB){ long endA=offsetA; long endB=offsetB; /* Start at the given offsets and work our way forward until we hit * the end of one of the vectors. */ for(;endA or <- */ /* =========================================================================== * i_analyze_rift_f (internal) * * This function examines a trailing rift to see how far forward the rift goes * and to determine what kind of rift it is. This function is called by * i_stage2_each() when a trailing rift is detected. (aoffset,boffset) are * the offsets into (A,B) of the first mismatching sample. * * This function returns: * matchA > 0 if there are (matchA) samples missing from A * matchA < 0 if there are (-matchA) duplicate samples (stuttering) in A * matchB > 0 if there are (matchB) samples missing from B * matchB < 0 if there are (-matchB) duplicate samples in B * matchC != 0 if there are (matchC) samples of garbage, after which * both A and B are in sync again */ void i_analyze_rift_f(int16_t *A,int16_t *B, long sizeA, long sizeB, long aoffset, long boffset, long *matchA,long *matchB,long *matchC){ long apast=sizeA-aoffset; long bpast=sizeB-boffset; long i; *matchA=0, *matchB=0, *matchC=0; /* Look forward to see where we regain agreement between vectors * A and B (of at least MIN_WORDS_RIFT samples). We look for one of * the following possible matches: * * edge * v * (1) (... A matching run)|(aoffset matches ...) * (... B matching run)| (rift) |(boffset+i matches ...) * * (2) (... A matching run)| (rift) |(aoffset+i matches ...) * (... B matching run)|(boffset matches ...) * * (3) (... A matching run)| (rift) |(aoffset+i matches ...) * (... B matching run)| (rift) |(boffset+i matches ...) * * Anything that doesn't match one of these three is too corrupt to * for us to recover from. E.g.: * * (... A matching run)| (rift) |(eventual match ...) * (... B matching run)| (big rift) |(eventual match ...) * * We won't find the eventual match, since we wouldn't be sure how * to fix the rift. */ for(i=1;;i++){ /* Search for whatever case we hit first, so as to end up with the * smallest rift. */ /* Don't search for (1) past the end of B */ if(i=MIN_WORDS_RIFT){ *matchA=i; break; } /* Don't search for (2) or (3) past the end of A */ if(i=MIN_WORDS_RIFT){ *matchB=i; break; } /* Don't search for (3) past the end of B */ if(i=MIN_WORDS_RIFT){ *matchC=i; break; } }else /* Stop searching when we've reached the end of both vectors. * In theory we could stop when there aren't MIN_WORDS_RIFT samples * left in both vectors, but this case should happen fairly rarely. */ if(i>=bpast)break; /* Try the search again with a larger tentative rift. */ } if(*matchA==0 && *matchB==0 && *matchC==0)return; if(*matchC)return; /* For case (1) or (2), we need to determine whether the rift contains * samples dropped by the other vector (that should be inserted), or * whether the rift contains a stutter (that should be dropped). To * distinguish, we check the contents of the rift against the good samples * just before the rift. If the contents match, then the rift contains * a stutter. * * A stutter in the second vector: * (...good samples... 1234)|(567 ...newly matched run...) * (...good samples... 1234)| (1234) | (567 ...newly matched run) * * Samples missing from the first vector: * (...good samples... 1234)|(901 ...newly matched run...) * (...good samples... 1234)| (5678) |(901 ...newly matched run...) * * Of course, there's no theoretical guarantee that a non-stutter * truly represents missing samples, but given that we're dealing with * verified fragments in stage 2, we can have some confidence that this * is the case. */ if(*matchA){ /* For case (1), we need to determine whether A dropped samples at the * rift or whether B stuttered. * * If the rift doesn't match the good samples in A (and hence in B), * it's not a stutter, and the rift should be inserted into A. */ if(i_stutter_or_gap(A,B,aoffset-*matchA,boffset,*matchA)) return; /* It is a stutter, so we need to signal that we need to remove * (matchA) bytes from B. */ *matchB=-*matchA; *matchA=0; return; }else{ /* Case (2) is the inverse of case (1) above. */ if(i_stutter_or_gap(B,A,boffset-*matchB,aoffset,*matchB)) return; *matchA=-*matchB; *matchB=0; return; } } /* riftv must be first even val of rift moving back */ /* =========================================================================== * i_analyze_rift_r (internal) * * This function examines a leading rift to see how far back the rift goes * and to determine what kind of rift it is. This function is called by * i_stage2_each() when a leading rift is detected. (aoffset,boffset) are * the offsets into (A,B) of the first mismatching sample. * * This function returns: * matchA > 0 if there are (matchA) samples missing from A * matchA < 0 if there are (-matchA) duplicate samples (stuttering) in A * matchB > 0 if there are (matchB) samples missing from B * matchB < 0 if there are (-matchB) duplicate samples in B * matchC != 0 if there are (matchC) samples of garbage, after which * both A and B are in sync again */ void i_analyze_rift_r(int16_t *A,int16_t *B, long sizeA, long sizeB, long aoffset, long boffset, long *matchA,long *matchB,long *matchC){ long apast=aoffset+1; long bpast=boffset+1; long i; *matchA=0, *matchB=0, *matchC=0; /* Look backward to see where we regain agreement between vectors * A and B (of at least MIN_WORDS_RIFT samples). We look for one of * the following possible matches: * * edge * v * (1) (... aoffset matches)|(A matching run ...) * (... boffset-i matches)| (rift) |(B matching run ...) * * (2) (... aoffset-i matches)| (rift) |(A matching run ...) * (... boffset matches)|(B matching run ...) * * (3) (... aoffset-i matches)| (rift) |(A matching run ...) * (... boffset-i matches)| (rift) |(B matching run ...) * * Anything that doesn't match one of these three is too corrupt to * for us to recover from. E.g.: * * (... eventual match)| (rift) |(A matching run ...) * (... eventual match) | (big rift) |(B matching run ...) * * We won't find the eventual match, since we wouldn't be sure how * to fix the rift. */ for(i=1;;i++){ /* Search for whatever case we hit first, so as to end up with the * smallest rift. */ /* Don't search for (1) past the beginning of B */ if(i=MIN_WORDS_RIFT){ *matchA=i; break; } /* Don't search for (2) or (3) past the beginning of A */ if(i=MIN_WORDS_RIFT){ *matchB=i; break; } /* Don't search for (3) past the beginning of B */ if(i=MIN_WORDS_RIFT){ *matchC=i; break; } }else /* Stop searching when we've reached the end of both vectors. * In theory we could stop when there aren't MIN_WORDS_RIFT samples * left in both vectors, but this case should happen fairly rarely. */ if(i>=bpast)break; /* Try the search again with a larger tentative rift. */ } if(*matchA==0 && *matchB==0 && *matchC==0)return; if(*matchC)return; /* For case (1) or (2), we need to determine whether the rift contains * samples dropped by the other vector (that should be inserted), or * whether the rift contains a stutter (that should be dropped). To * distinguish, we check the contents of the rift against the good samples * just after the rift. If the contents match, then the rift contains * a stutter. * * A stutter in the second vector: * (...newly matched run... 234)|(5678 ...good samples...) * (...newly matched run... 234)| (5678) |(5678 ...good samples...) * * Samples missing from the first vector: * (...newly matched run... 890)|(5678 ...good samples...) * (...newly matched run... 890)| (1234) |(5678 ...good samples...) * * Of course, there's no theoretical guarantee that a non-stutter * truly represents missing samples, but given that we're dealing with * verified fragments in stage 2, we can have some confidence that this * is the case. */ if(*matchA){ /* For case (1), we need to determine whether A dropped samples at the * rift or whether B stuttered. * * If the rift doesn't match the good samples in A (and hence in B), * it's not a stutter, and the rift should be inserted into A. * * ???BUG??? It's possible for aoffset+1+*matchA to be > sizeA, in * which case the comparison in i_stutter_or_gap() will extend beyond * the bounds of A. Thankfully, this isn't writing data and thus * trampling memory, but it's still a memory access error that should * be fixed. * * This bug is not fixed yet. */ if(i_stutter_or_gap(A,B,aoffset+1,boffset-*matchA+1,*matchA)) return; /* It is a stutter, so we need to signal that we need to remove * (matchA) bytes from B. */ *matchB=-*matchA; *matchA=0; return; }else{ /* Case (2) is the inverse of case (1) above. */ if(i_stutter_or_gap(B,A,boffset+1,aoffset-*matchB+1,*matchB)) return; *matchA=-*matchB; *matchB=0; return; } } /* =========================================================================== * analyze_rift_silence_f (internal) * * This function examines the fragment and root from the rift onward to * see if they have a rift's worth of silence (or if they end with silence). * It sets (*matchA) to -1 if A's rift is silence, (*matchB) to -1 if B's * rift is silence, and sets them to 0 otherwise. * * Note that, unlike every other function in cdparanoia, this function * considers any repeated value to be silence (which, in effect, it is). * All other functions only consider repeated zeroes to be silence. * * This function is called by i_stage2_each() if it runs into a trailing rift * that i_analyze_rift_f couldn't diagnose. This checks for another variant: * where one vector has silence and the other doesn't. We then assume * that the silence (and anything following it) is garbage. * * Note that while this function checks both A and B for silence, the caller * assumes that only one or the other has silence. */ void analyze_rift_silence_f(int16_t *A,int16_t *B,long sizeA,long sizeB, long aoffset, long boffset, long *matchA, long *matchB){ *matchA=-1; *matchB=-1; /* Search for MIN_WORDS_RIFT samples, or to the end of the vector, * whichever comes first. */ sizeA=min(sizeA,aoffset+MIN_WORDS_RIFT); sizeB=min(sizeB,boffset+MIN_WORDS_RIFT); aoffset++; boffset++; /* Check whether A has only "silence" within the search range. Note * that "silence" here is a single, repeated value (zero or not). */ while(aoffset #include #include #include #include #include "../interface/cdda_interface.h" #include "../interface/smallft.h" #include "../version.h" #include "p_block.h" #include "cdda_paranoia.h" #include "overlap.h" #include "gap.h" #include "isort.h" #include #define MIN_SEEK_MS 6 static inline long re(root_block *root){ if(!root)return(-1); if(!root->vector)return(-1); return(ce(root->vector)); } static inline long rb(root_block *root){ if(!root)return(-1); if(!root->vector)return(-1); return(cb(root->vector)); } static inline long rs(root_block *root){ if(!root)return(-1); if(!root->vector)return(-1); return(cs(root->vector)); } static inline int16_t *rv(root_block *root){ if(!root)return(NULL); if(!root->vector)return(NULL); return(cv(root->vector)); } #define rc(r) (r->vector) /** Flags indicating the status of a read samples. Imagine the below enumeration values are #defines to be used in a bitmask rather than distinct values of an enum. The variable part of the declaration is trickery to force the enum symbol values to be recorded in debug symbol tables. They are used to allow one refer to the enumeration value names in a debugger and in debugger expressions. */ enum { FLAGS_EDGE =0x1, /**< first/last N words of frame */ FLAGS_UNREAD =0x2, /**< unread, hence missing and unmatchable */ FLAGS_VERIFIED=0x4 /**< block read and verified */ } paranoia_read_flags; /**** matching and analysis code *****************************************/ /* =========================================================================== * i_paranoia_overlap() (internal) * * This function is called when buffA[offsetA] == buffB[offsetB]. This * function searches backward and forward to see how many consecutive * samples also match. * * This function is called by do_const_sync() when we're not doing any * verification. Its more complicated sibling is i_paranoia_overlap2. * * This function returns the number of consecutive matching samples. * If (ret_begin) or (ret_end) are not NULL, it fills them with the * offsets of the first and last matching samples in A. */ static inline long i_paranoia_overlap(int16_t *buffA,int16_t *buffB, long offsetA, long offsetB, long sizeA,long sizeB, long *ret_begin, long *ret_end){ long beginA=offsetA,endA=offsetA; long beginB=offsetB,endB=offsetB; /* Scan backward to extend the matching run in that direction. */ for(;beginA>=0 && beginB>=0;beginA--,beginB--) if(buffA[beginA]!=buffB[beginB])break; beginA++; beginB++; /* Scan forward to extend the matching run in that direction. */ for(;endA=0 && beginB>=0;beginA--,beginB--){ if(buffA[beginA]!=buffB[beginB])break; /* don't allow matching across matching sector boundaries. The liklihood of the drive skipping identically in two different reads with the same sector read boundary is actually relatively very high compared to the liklihood of it skipping when one read is continuous across the boundary and other was discontinuous */ /* Stop if both samples were at the edges of a low-level read. */ if((flagsA[beginA]&flagsB[beginB]&FLAGS_EDGE)){ beginA--; beginB--; break; } /* don't allow matching through known missing data */ if((flagsA[beginA]&FLAGS_UNREAD)|| (flagsB[beginB]&FLAGS_UNREAD))break; } beginA++; beginB++; /* Scan forward to extend the matching run in that direction. */ for(;endAflags; long ret=0; /* If we're doing any verification whatsoever, we have flags in stage * 1, and will take them into account. Otherwise (e.g. in stage 2), * we just do the simple equality test for samples on both sides of * the initial match. */ if(flagB==NULL) ret=i_paranoia_overlap(cv(A),iv(B),posA,posB, cs(A),is(B),begin,end); else if((flagB[posB]&FLAGS_UNREAD)==0) ret=i_paranoia_overlap2(cv(A),iv(B),flagA,flagB,posA,posB,cs(A), is(B),begin,end); /* Small matching runs could just be coincidental. We only consider this * a real match if it's long enough. */ if(ret>MIN_WORDS_SEARCH){ *offset=+(posA+cb(A))-(posB+ib(B)); /* Note that try_sort_sync()'s swaps A & B when it calls this function, * so while we adjust begin & end to be relative to A here, that means * it's relative to B in try_sort_sync(). */ *begin+=cb(A); *end+=cb(A); return(ret); } return(0); } /* =========================================================================== * try_sort_sync() (internal) * * Starting from the sample in B with the absolute position (post), look * for a matching run in A. This search will look in A for a first * matching sample within (p->dynoverlap) samples around (post). If it * finds one, it will then determine how many consecutive samples match * both A and B from that point, looking backwards and forwards. If * this search produces a matching run longer than MIN_WORDS_SEARCH, we * consider it a match. * * When used by stage 1, the "post" is planted with respect to the old * c_block being compare to the new c_block. In stage 2, the "post" is * planted with respect to the verified root. * * This function returns 1 if a match is found and 0 if not. When a match * is found, (begin) and (end) are set to the boundaries of the run, and * (offset) is set to the difference in position of the run in A and B. * (begin) and (end) are the absolute positions of the samples in * B. (offset) transforms A to B's frame of reference. I.e., an offset of * 2 would mean that A's absolute 3 is equivalent to B's 5. */ /* post is w.r.t. B. in stage one, we post from old. In stage 2 we post from root. Begin, end, offset count from B's frame of reference */ static inline long try_sort_sync(cdrom_paranoia *p, sort_info *A,unsigned char *Aflags, c_block *B, long post,long *begin,long *end, long *offset,void (*callback)(long,int)){ long dynoverlap=p->dynoverlap; sort_link *ptr=NULL; unsigned char *Bflags=B->flags; /* block flag matches FLAGS_UNREAD (and hence unmatchable) */ if(Bflags==NULL || (Bflags[post-cb(B)]&FLAGS_UNREAD)==0){ /* always try absolute offset zero first! */ { long zeropos=post-ib(A); if(zeropos>=0 && zeroposstage1),*offset,callback); return(1); } } } } }else return(0); /* If the samples with the same absolute position didn't match, it's * either a bad sample, or the two c_blocks are jittered with respect * to each other. Now we search through A for samples that do have * the same value as B's post. The search looks from first to last * occurrence witin (dynoverlap) samples of (post). */ ptr=sort_getmatch(A,post-ib(A),dynoverlap,cv(B)[post-cb(B)]); while(ptr){ /* We've found a matching sample, so try to grow the matching run in * both directions. If we find a long enough run (longer than * MIN_WORDS_SEARCH), we've found a match. */ if(do_const_sync(B,A,Aflags, post-cb(B),ipos(A,ptr), begin,end,offset)){ offset_add_value(p,&(p->stage1),*offset,callback); return(1); } /* The matching sample was just a fluke -- there weren't enough adjacent * samples that matched to consider a matching run. So now we check * for the next occurrence of that value in A. */ ptr=sort_nextmatch(A,ptr); } /* We didn't find any matches. */ *begin=-1; *end=-1; *offset=-1; return(0); } /* =========================================================================== * STAGE 1 MATCHING * =========================================================================== */ /* Top level of the first stage matcher */ /* We match each analysis point of new to the preexisting blocks recursively. We can also optionally maintain a list of fragments of the preexisting block that didn't match anything, and match them back afterward. */ #define OVERLAP_ADJ (MIN_WORDS_OVERLAP/2-1) /* =========================================================================== * stage1_matched() (internal) * * This function is called whenever stage 1 verification finds two identical * runs of samples from different reads. The runs must be more than * MIN_WORDS_SEARCH samples long. They may be jittered (i.e. their absolute * positions on the CD may not match due to inaccurate seeking) with respect * to each other, but they have been verified to have no dropped samples * within them. * * This function provides feedback via the callback mechanism and marks the * runs as verified. The details of the marking are somehwat subtle and * are described near the relevant code. * * Subsequent portions of the stage 1 code will build a verified fragment * from this run. The verified fragment will eventually be merged * into the verified root (and its absolute position determined) in * stage 2. */ static inline void stage1_matched(c_block *old,c_block *new, long matchbegin,long matchend, long matchoffset,void (*callback)(long,int)){ long i; long oldadjbegin=matchbegin-cb(old); long oldadjend=matchend-cb(old); long newadjbegin=matchbegin-matchoffset-cb(new); long newadjend=matchend-matchoffset-cb(new); /* Provide feedback via the callback about the samples we've just * verified. * * "???: How can matchbegin ever be < cb(old)?" * Sorry, old bulletproofing habit. I often use <= to mean "not >" * --Monty * * "???: Why do edge samples get logged only when there's jitter * between the matched runs (matchoffset != 0)?" * FIXUP_EDGE is actually logging a jitter event, not a rift-- * a rift is FIXUP_ATOM --Monty */ if(matchbegin-matchoffset<=cb(new) || matchbegin<=cb(old) || (new->flags[newadjbegin]&FLAGS_EDGE) || (old->flags[oldadjbegin]&FLAGS_EDGE)){ if(matchoffset) if(callback)(*callback)(matchbegin,PARANOIA_CB_FIXUP_EDGE); }else if(callback)(*callback)(matchbegin,PARANOIA_CB_FIXUP_ATOM); if(matchend-matchoffset>=ce(new) || (new->flags[newadjend]&FLAGS_EDGE) || matchend>=ce(old) || (old->flags[oldadjend]&FLAGS_EDGE)){ if(matchoffset) if(callback)(*callback)(matchend,PARANOIA_CB_FIXUP_EDGE); }else if(callback)(*callback)(matchend,PARANOIA_CB_FIXUP_ATOM); /* Mark verified samples as "verified," but trim the verified region * by OVERLAP_ADJ samples on each side. There are several significant * implications of this trimming: * * 1) Why we trim at all: We have to trim to distinguish between two * adjacent verified runs and one long verified run. We encounter this * situation when samples have been dropped: * * matched portion of read 1 ....)(.... matched portion of read 1 * read 2 adjacent run .....)(..... read 2 adjacent run * || * dropped samples in read 2 * * So at this point, the fact that we have two adjacent runs means * that we have not yet verified that the two runs really are adjacent. * (In fact, just the opposite: there are two runs because they were * matched by separate runs, indicating that some samples didn't match * across the length of read 2.) * * If we verify that they are actually adjacent (e.g. if the two runs * are simply a result of matching runs from different reads, not from * dropped samples), we will indeed mark them as one long merged run. * * 2) Why we trim by this amount: We want to ensure that when we * verify the relationship between these two runs, we do so with * an overlapping fragment at least OVERLAP samples long. Following * from the above example: * * (..... matched portion of read 3 .....) * read 2 adjacent run .....)(..... read 2 adjacent run * * Assuming there were no dropped samples between the adjacent runs, * the matching portion of read 3 will need to be at least OVERLAP * samples long to mark the two runs as one long verified run. * If there were dropped samples, read 3 wouldn't match across the * two runs, proving our caution worthwhile. * * 3) Why we partially discard the work we've done: We don't. * When subsequently creating verified fragments from this run, * we compensate for this trimming. Thus the verified fragment will * contain the full length of verified samples. Only the c_blocks * will reflect this trimming. */ /* Mark the verification flags. Don't mark the first or last OVERLAP/2 elements so that overlapping fragments have to overlap by OVERLAP to actually merge. We also remove elements from the sort such that later sorts do not have to sift through already matched data */ newadjbegin+=OVERLAP_ADJ; newadjend-=OVERLAP_ADJ; for(i=newadjbegin;iflags[i]|=FLAGS_VERIFIED; /* mark verified */ oldadjbegin+=OVERLAP_ADJ; oldadjend-=OVERLAP_ADJ; for(i=oldadjbegin;iflags[i]|=FLAGS_VERIFIED; /* mark verified */ } /* =========================================================================== * i_iterate_stage1 (internal) * * This function is called by i_stage1() to compare newly read samples with * previously read samples, searching for contiguous runs of identical * samples. Matching runs indicate that at least two reads of the CD * returned identical data, with no dropped samples in that run. * The runs may be jittered (i.e. their absolute positions on the CD may * not be accurate due to inaccurate seeking) at this point. Their * positions will be determined in stage 2. * * This function compares the new c_block (which has been indexed in * p->sortcache) to a previous c_block. It is called for each previous * c_block. It searches for runs of identical samples longer than * MIN_WORDS_SEARCH. Samples in matched runs are marked as verified. * * Subsequent stage 1 code builds verified fragments from the runs of * verified samples. These fragments are merged into the verified root * in stage 2. * * This function returns the number of distinct runs verified in the new * c_block when compared against this old c_block. */ static long i_iterate_stage1(cdrom_paranoia *p,c_block *old,c_block *new, void(*callback)(long,int)){ long matchbegin=-1,matchend=-1,matchoffset; /* "???: Why do we limit our search only to the samples with overlapping * absolute positions? It could be because it eliminates some further * bounds checking." * Short answer is yes --Monty * * "Why do we "no longer try to spread the ... search" as mentioned * below?" * The search is normally much faster without the spread, * even in heavy jitter. Dynoverlap tends to be a bigger deal in * stage 2. --Monty */ /* we no longer try to spread the stage one search area by dynoverlap */ long searchend=min(ce(old),ce(new)); long searchbegin=max(cb(old),cb(new)); long searchsize=searchend-searchbegin; sort_info *i=p->sortcache; long ret=0; long j; long tried=0,matched=0; if(searchsize<=0)return(0); /* match return values are in terms of the new vector, not old */ /* "???: Why 23?" Odd, prime number --Monty */ for(j=searchbegin;jflags[j-cb(new)]&(FLAGS_VERIFIED|FLAGS_UNREAD))==0){ tried++; /* Starting from the sample in the old c_block with the absolute * position j, look for a matching run in the new c_block. This * search will look a certain distance around j, and if successful * will extend the matching run as far backward and forward as * it can. * * The search will only return 1 if it finds a matching run long * enough to be deemed significant. */ if(try_sort_sync(p,i,new->flags,old,j,&matchbegin,&matchend,&matchoffset, callback)==1){ matched+=matchend-matchbegin; /* purely cosmetic: if we're matching zeros, don't use the callback because they will appear to be all skewed */ { long j=matchbegin-cb(old); long end=matchend-cb(old); for(;jj)j=matchend-1; } } } /* end for */ #ifdef NOISY fprintf(stderr,"iterate_stage1: search area=%ld[%ld-%ld] tried=%ld matched=%ld spans=%ld\n", searchsize,searchbegin,searchend,tried,matched,ret); #endif return(ret); } /* =========================================================================== * i_stage1() (internal) * * Compare newly read samples against previously read samples, searching * for contiguous runs of identical samples. Matching runs indicate that * at least two reads of the CD returned identical data, with no dropped * samples in that run. The runs may be jittered (i.e. their absolute * positions on the CD may not be accurate due to inaccurate seeking) at * this point. Their positions will be determined in stage 2. * * This function compares a new c_block against all other c_blocks in memory, * searching for sufficiently long runs of identical samples. Since each * c_block represents a separate call to read_c_block, this ensures that * multiple reads have returned identical data. (Additionally, read_c_block * varies the reads so that multiple reads are unlikely to produce identical * errors, so any matches between reads are considered verified. See * i_read_c_block for more details.) * * Each time we find such a run (longer than MIN_WORDS_SEARCH), we mark * the samples as "verified" in both c_blocks. Runs of verified samples in * the new c_block are promoted into verified fragments, which will later * be merged into the verified root in stage 2. * * In reality, not all the verified samples are marked as "verified." * See stage1_matched() for an explanation. * * This function returns the number of verified fragments created by the * stage 1 matching. */ static long i_stage1(cdrom_paranoia *p,c_block *new, void(*callback)(long,int)){ long size=cs(new); c_block *ptr=c_last(p); int ret=0; long begin=0,end; /* We're going to be comparing the new c_block against the other * c_blocks in memory. Initialize the "sort cache" index to allow * for fast searching through the new c_block. (The index will * actually be built the first time we search.) */ if(ptr)sort_setup(p->sortcache,cv(new),&cb(new),cs(new), cb(new),ce(new)); /* Iterate from oldest to newest c_block, comparing the new c_block * to each, looking for a sufficiently long run of identical samples * (longer than MIN_WORDS_SEARCH), which will be marked as "verified" * in both c_blocks. * * Since the new c_block is already in the list (at the head), don't * compare it against itself. */ while(ptr && ptr!=new){ if(callback)(*callback)(cb(new),PARANOIA_CB_VERIFY); i_iterate_stage1(p,ptr,new,callback); ptr=c_prev(ptr); } /* parse the verified areas of new into v_fragments */ /* Find each run of contiguous verified samples in the new c_block * and create a verified fragment from each run. */ begin=0; while(beginflags[begin]&FLAGS_VERIFIED)break; for(end=begin;endflags[end]&FLAGS_VERIFIED)==0)break; if(begin>=size)break; ret++; /* We create a new verified fragment from the contiguous run * of verified samples. * * We expand the "verified" range by OVERLAP_ADJ on each side * to compensate for trimming done to the verified range by * stage1_matched(). The samples were actually verified, and * hence belong in the verified fragment. See stage1_matched() * for an explanation of the trimming. */ new_v_fragment(p,new,cb(new)+max(0,begin-OVERLAP_ADJ), cb(new)+min(size,end+OVERLAP_ADJ), (end+OVERLAP_ADJ>=size && new->lastsector)); begin=end; } /* Return the number of distinct verified fragments we found with * stage 1 matching. */ return(ret); } /* =========================================================================== * STAGE 2 MATCHING * =========================================================================== */ typedef struct sync_result { long offset; long begin; long end; } sync_result; /* Reconcile v_fragments to root buffer. Free if matched, fragment/fixup root if necessary. Do *not* match using zero posts */ /* =========================================================================== * i_iterate_stage2 (internal) * * This function searches for a sufficiently long run of identical samples * between the passed verified fragment and the verified root. The search * is similar to that performed by i_iterate_stage1. Of course, what we do * as a result of a match is different. * * Our search is slightly different in that we refuse to match silence to * silence. All silence looks alike, and it would result in too many false * positives here, so we handle silence separately. * * Also, because we're trying to determine whether this fragment as a whole * overlaps with the root at all, we narrow our search (since it should match * immediately or not at all). This is in contrast to stage 1, where we * search the entire vector looking for all possible matches. * * This function returns 0 if no match was found (including failure to find * one due to silence), or 1 if we found a match. * * When a match is found, the sync_result_t is set to the boundaries of * matching run (begin/end, in terms of the root) and how far out of sync * the fragment is from the canonical root (offset). Note that this offset * is opposite in sign from the notion of offset used by try_sort_sync() * and stage 1 generally. */ static long i_iterate_stage2(cdrom_paranoia *p,v_fragment *v, sync_result *r,void(*callback)(long,int)){ root_block *root=&(p->root); long matchbegin=-1,matchend=-1,offset; long fbv,fev; #ifdef NOISY fprintf(stderr,"Stage 2 search: fbv=%ld fev=%ld\n",fb(v),fe(v)); #endif /* Quickly check whether there could possibly be any overlap between * the verified fragment and the root. Our search will allow up to * (p->dynoverlap) jitter between the two, so we expand the fragment * search area by p->dynoverlap on both sides and see if that expanded * area overlaps with the root. * * We could just as easily expand root's boundaries by p->dynoverlap * instead and achieve the same result. */ if(min(fe(v)+p->dynoverlap,re(root))- max(fb(v)-p->dynoverlap,rb(root))<=0)return(0); if(callback)(*callback)(fb(v),PARANOIA_CB_VERIFY); /* We're going to try to match the fragment to the root while allowing * for p->dynoverlap jitter, so we'll actually be looking at samples * in the fragment whose position claims to be up to p->dynoverlap * outside the boundaries of the root. But, of course, don't extend * past the edges of the fragment. */ fbv=max(fb(v),rb(root)-p->dynoverlap); /* Skip past leading zeroes in the fragment, and bail if there's nothing * but silence. We handle silence later separately. */ while(fbvdynoverlap outside the boundaries * of the root, but don't extend past the edges of the fragment. * * However, we also limit the search to no more than 256 samples. * Unlike stage 1, we're not trying to find all possible matches within * two runs -- rather, we're trying to see if the fragment as a whole * overlaps with the root. If we can't find a match within 256 samples, * there's probably no match to be found (because this fragment doesn't * overlap with the root). * * "??? Is this why? Why 256?" 256 is simply a 'large enough number'. --Monty */ fev=min(min(fbv+256,re(root)+p->dynoverlap),fe(v)); { /* Because we'll allow for up to (p->dynoverlap) jitter between the * fragment and the root, we expand the search area (fbv to fev) by * p->dynoverlap on both sides. But, because we're iterating through * root, we need to constrain the search area not to extend beyond * the root's boundaries. */ long searchend=min(fev+p->dynoverlap,re(root)); long searchbegin=max(fbv-p->dynoverlap,rb(root)); sort_info *i=p->sortcache; long j; /* Initialize the "sort cache" index to allow for fast searching * through the verified fragment between (fbv,fev). (The index will * actually be built the first time we search.) */ sort_setup(i,fv(v),&fb(v),fs(v),fbv,fev); for(j=searchbegin;jbegin=matchbegin; r->end=matchend; r->offset=-offset; if(offset)if(callback)(*callback)(r->begin,PARANOIA_CB_FIXUP_EDGE); return(1); } } } return(0); } /* =========================================================================== * i_silence_test() (internal) * * If the entire root is silent, or there's enough trailing silence * to be significant (MIN_SILENCE_BOUNDARY samples), mark the beginning * of the silence and "light" the silence flag. This flag will remain lit * until i_silence_match() appends some non-silent samples to the root. * * We do this because if there's a long enough span of silence, we can't * reliably detect jitter or dropped samples within that span. See * i_silence_match() for details on how we recover from this situation. */ static void i_silence_test(root_block *root){ int16_t *vec=rv(root); long end=re(root)-rb(root)-1; long j; /* Look backward from the end of the root to find the first non-silent * sample. */ for(j=end-1;j>=0;j--)if(vec[j]!=0)break; /* If the entire root is silent, or there's enough trailing silence * to be significant, mark the beginning of the silence and "light" * the silence flag. */ if(j<0 || end-j>MIN_SILENCE_BOUNDARY){ root->silenceflag=1; root->silencebegin=rb(root)+j+1; if(root->silencebeginreturnedlimit) root->silencebegin=root->returnedlimit; } } /* =========================================================================== * i_silence_match() (internal) * * This function is merges verified fragments into the verified root in cases * where there is a problematic amount of silence (MIN_SILENCE_BOUNDARY * samples) at the end of the root. * * We need a special approach because if there's a long enough span of * silence, we can't reliably detect jitter or dropped samples within that * span (since all silence looks alike). * * Only fragments that begin with MIN_SILENCE_BOUNDARY samples are eligible * to be merged in this case. Fragments that are too far beyond the edge * of the root to possibly overlap are also disregarded. * * Our first approach is to assume that such fragments have no jitter (since * we can't establish otherwise) and merge them. However, if it's clear * that there must be jitter (i.e. because non-silent samples overlap when * we assume no jitter), we assume the fragment has the minimum possible * jitter and then merge it. * * This function extends silence fairly aggressively, so it must be called * with fragments in ascending order (beginning position) in case there are * small non-silent regions within the silence. */ static long i_silence_match(root_block *root, v_fragment *v, void(*callback)(long,int)){ cdrom_paranoia *p=v->p; int16_t *vec=fv(v); long end=fs(v),begin; long j; /* See how much leading silence this fragment has. If there are fewer than * MIN_SILENCE_BOUNDARY leading silent samples, we don't do this special * silence matching. * * This fragment could actually belong here, but we can't be sure unless * it has enough silence on its leading edge. This fragment will likely * stick around until we do successfully extend the root, at which point * it will be merged using the usual method. */ if(enddynoverlap samples of the end of root). */ if(fb(v)>=re(root) && fb(v)-p->dynoverlapsilencebegin); end=min(j,re(root)); /* If there is an overlap, we assume that both the root and the fragment * are jitter-free (since there's no way for us to tell otherwise). */ if(beginre(root)){ long voff=begin-fb(v); /* Truncate the overlapping silence from the end of the root. */ c_remove(rc(root),begin-rb(root),-1); /* Append the fragment to the root, starting from the point of overlap. */ c_append(rc(root),vec+voff,fs(v)-voff); } /* Record the fact that we merged this fragment assuming zero jitter. */ offset_add_value(p,&p->stage2,0,callback); }else{ /* We weren't able to merge the fragment assuming zero jitter. * * Check whether the fragment's leading silence ends before the root's * trailing silence begins. If it does, we assume that the root is * jittered forward. */ if(jre(root)){ /* Truncate the trailing silence from the root. */ c_remove(rc(root),root->silencebegin-rb(root),-1); /* Append the non-silent tail of the fragment to the root. */ c_append(rc(root),vec+voff,fs(v)-voff); } /* Record the fact that we merged this fragment assuming (end-begin) * jitter. */ offset_add_value(p,&p->stage2,end-begin,callback); }else /* We only get here if the fragment is past the end of the root, * which means it must be farther than (dynoverlap) away, due to our * root extension above. */ /* We weren't able to merge this fragment into the root after all. */ return(0); } /* We only get here if we merged the fragment into the root. Update * the root's silence flag. * * Note that this is the only place silenceflag is reset. In other words, * once i_silence_test() lights the silence flag, it can only be reset * by i_silence_match(). */ root->silenceflag=0; /* Now see if the new, extended root ends in silence. */ i_silence_test(root); /* Since we merged the fragment, we can free it now. But first we propagate * its lastsector flag. */ if(v->lastsector)root->lastsector=1; free_v_fragment(v); return(1); } /* =========================================================================== * i_stage2_each (internal) * * This function (which is entirely too long) attempts to merge the passed * verified fragment into the verified root. * * First this function looks for a run of identical samples between * the root and the fragment. If it finds a long enough run, it then * checks for "rifts" (see below) and fixes the root and/or fragment as * necessary. Finally, if the fragment will extend the tail of the root, * we merge the fragment and extend the root. * * Most of the ugliness in this function has to do with handling "rifts", * which are points of disagreement between the root and the verified * fragment. This can happen when a drive consistently drops a few samples * or stutters and repeats a few samples. It has to be consistent enough * to result in a verified fragment (i.e. it happens twice), but inconsistent * enough (e.g. due to the jiggled reads) not to happen every time. * * This function returns 1 if the fragment was successfully merged into the * root, and 0 if not. */ static long i_stage2_each(root_block *root, v_fragment *v, void(*callback)(long,int)){ cdrom_paranoia *p=v->p; long dynoverlap=p->dynoverlap/2*2; /* "??? Why do we round down to an even dynoverlap?" Dynoverlap is in samples, not stereo frames --Monty */ /* If this fragment has already been merged & freed, abort. */ if(!v || !v->one)return(0); /* If there's no verified root yet, abort. */ if(!rv(root)){ return(0); }else{ sync_result r; /* Search for a sufficiently long run of identical samples between * the verified fragment and the verified root. There's a little * bit of subtlety in the search when silence is involved. */ if(i_iterate_stage2(p,v,&r,callback)){ /* Convert the results of the search to be relative to the root. */ long begin=r.begin-rb(root); long end=r.end-rb(root); /* Convert offset into a value that will transform a relative * position in the root to the corresponding relative position in * the fragment. I.e., if offset = -2, then the sample at relative * position 2 in the root is at relative position 0 in the fragment. * * While a bit opaque, this does reduce the number of calculations * below. */ long offset=r.begin+r.offset-fb(v)-begin; long temp; c_block *l=NULL; /* we have a match! We don't rematch off rift, we chase the match all the way to both extremes doing rift analysis. */ #ifdef NOISY fprintf(stderr,"Stage 2 match\n"); #endif /* Now that we've found a sufficiently long run of identical samples * between the fragment and the root, we need to check for rifts. * * A "rift", as mentioned above, is a disagreement between the * fragment and the root. When there's a rift, the matching run * found by i_iterate_stage2() will obviously stop where the root * and the fragment disagree. * * So we detect rifts by checking whether the matching run extends * to the ends of the fragment and root. If the run does extend to * the ends of the fragment and root, then all overlapping samples * agreed, and there's no rift. If, however, the matching run * stops with samples left over in both the root and the fragment, * that means the root and fragment disagreed at that point. * Leftover samples at the beginning of the match indicate a * leading rift, and leftover samples at the end of the match indicate * a trailing rift. * * Once we detect a rift, we attempt to fix it, depending on the * nature of the disagreement. See i_analyze_rift_[rf] for details * on how we determine what kind of rift it is. See below for * how we attempt to fix the rifts. */ /* First, check for a leading rift, fix it if possible, and then * extend the match forward until either we hit the limit of the * overlapping samples, or until we encounter another leading rift. * Keep doing this until we hit the beginning of the overlap. * * Note that while we do fix up leading rifts, we don't extend * the root backward (earlier samples) -- only forward (later * samples). */ /* If the beginning of the match didn't reach the beginning of * either the fragment or the root, we have a leading rift to be * examined. * * Remember that (begin) is the offset into the root, and (begin+offset) * is the equivalent offset into the fragment. If neither one is at * zero, then they both have samples before the match, and hence a * rift. */ while((begin+offset>0 && begin>0)){ long matchA=0,matchB=0,matchC=0; /* (begin) is the offset into the root of the first matching sample, * (beginL) is the offset into the fragment of the first matching * sample. These samples are at the edge of the rift. */ long beginL=begin+offset; /* The first time we encounter a leading rift, allocate a * scratch copy of the verified fragment which we'll use if * we need to fix up the fragment before merging it into * the root. */ if(l==NULL){ int16_t *buff=malloc(fs(v)*sizeof(int16_t)); l=c_alloc(buff,fb(v),fs(v)); memcpy(buff,fv(v),fs(v)*sizeof(int16_t)); } /* Starting at the first mismatching sample, see how far back the * rift goes, and determine what kind of rift it is. Note that * we're searching through the fixed up copy of the fragment. * * matchA > 0 if there are samples missing from the root * matchA < 0 if there are duplicate samples (stuttering) in the root * matchB > 0 if there are samples missing from the fragment * matchB < 0 if there are duplicate samples in the fragment * matchC != 0 if there's a section of garbage, after which * the fragment and root agree and are in sync */ i_analyze_rift_r(rv(root),cv(l), rs(root),cs(l), begin-1,beginL-1, &matchA,&matchB,&matchC); #ifdef NOISY fprintf(stderr,"matching rootR: matchA:%ld matchB:%ld matchC:%ld\n", matchA,matchB,matchC); #endif /* "??? The root.returnedlimit checks below are presently a mystery." */ /* Those are for the case where our backtracking wants to take us to back before bytes we've already returned to the application. In short, it's a "we're screwed" check. --Monty */ if(matchA){ /* There's a problem with the root */ if(matchA>0){ /* There were (matchA) samples dropped from the root. We'll add * them back from the fixed up fragment. */ if(callback)(*callback)(begin+rb(root)-1,PARANOIA_CB_FIXUP_DROPPED); if(rb(root)+beginroot.returnedlimit) break; else{ /* At the edge of the rift in the root, insert the missing * samples from the fixed up fragment. They're the (matchA) * samples immediately preceding the edge of the rift in the * fragment. */ c_insert(rc(root),begin,cv(l)+beginL-matchA, matchA); /* We just inserted (matchA) samples into the root, so update * our begin/end offsets accordingly. Also adjust the * (offset) to compensate (since we use it to find samples in * the fragment, and the fragment hasn't changed). */ offset-=matchA; begin+=matchA; end+=matchA; } }else{ /* There were (-matchA) duplicate samples (stuttering) in the * root. We'll drop them. */ if(callback)(*callback)(begin+rb(root)-1,PARANOIA_CB_FIXUP_DUPED); if(rb(root)+begin+matchAroot.returnedlimit) break; else{ /* Remove the (-matchA) samples immediately preceding the * edge of the rift in the root. */ c_remove(rc(root),begin+matchA,-matchA); /* We just removed (-matchA) samples from the root, so update * our begin/end offsets accordingly. Also adjust the offset * to compensate. Remember that matchA < 0, so we're actually * subtracting from begin/end. */ offset-=matchA; begin+=matchA; end+=matchA; } } }else if(matchB){ /* There's a problem with the fragment */ if(matchB>0){ /* There were (matchB) samples dropped from the fragment. We'll * add them back from the root. */ if(callback)(*callback)(begin+rb(root)-1,PARANOIA_CB_FIXUP_DROPPED); /* At the edge of the rift in the fragment, insert the missing * samples from the root. They're the (matchB) samples * immediately preceding the edge of the rift in the root. * Note that we're fixing up the scratch copy of the fragment. */ c_insert(l,beginL,rv(root)+begin-matchB, matchB); /* We just inserted (matchB) samples into the fixed up fragment, * so update (offset), since we use it to find samples in the * fragment based on the root's unchanged offsets. */ offset+=matchB; }else{ /* There were (-matchB) duplicate samples (stuttering) in the * fixed up fragment. We'll drop them. */ if(callback)(*callback)(begin+rb(root)-1,PARANOIA_CB_FIXUP_DUPED); /* Remove the (-matchB) samples immediately preceding the edge * of the rift in the fixed up fragment. */ c_remove(l,beginL+matchB,-matchB); /* We just removed (-matchB) samples from the fixed up fragment, * so update (offset), since we use it to find samples in the * fragment based on the root's unchanged offsets. */ offset+=matchB; } }else if(matchC){ /* There are (matchC) samples that simply disagree between the * fragment and the root. On the other side of the mismatch, the * fragment and root agree again. We can't classify the mismatch * as either a stutter or dropped samples, and we have no way of * telling whether the fragment or the root is right. * * "The original comment indicated that we set "disagree" * flags in the root, but it seems to be historical." The * disagree flags were from a time when we did interpolation * over samples we simply couldn't get to agree. Yes, * historical functionality that didn;t work well. --Monty */ if(rb(root)+begin-matchCroot.returnedlimit) break; /* Overwrite the mismatching (matchC) samples in root with the * samples from the fixed up fragment. * * "??? Do we think the fragment is more likely correct, is this * just arbitrary, or is there some other reason for overwriting * the root?" * We think these samples are more likely to be correct --Monty */ c_overwrite(rc(root),begin-matchC, cv(l)+beginL-matchC,matchC); }else{ /* We may have had a mismatch because we ran into leading silence. * * "??? To be studied: why would this cause a mismatch? * Neither i_analyze_rift_r nor i_iterate_stage2() nor * i_paranoia_overlap() appear to take silence into * consideration in this regard. It could be due to our * skipping of silence when searching for a match." Jitter * and or skipping in sections of silence could end up with * two sets of verified vectors that agree completely except * for the length of the silence. Silence is a huge bugaboo * in general because there's no entropy within it to base * verification on. --Monty * * Since we don't extend the root in that direction, we don't * do anything, just move on to trailing rifts. */ /* If the rift was too complex to fix (see i_analyze_rift_r), * we just stop and leave the leading edge where it is. */ /*RRR(*callback)(post,PARANOIA_CB_XXX);*/ break; } /* Recalculate the offset of the edge of the rift in the fixed * up fragment, in case it changed. * * "??? Why is this done here rather than in the (matchB) case above, * which should be the only time beginL will change." * Because there's no reason not to? --Monty */ beginL=begin+offset; /* Now that we've fixed up the root or fragment as necessary, see * how far we can extend the matching run. This function is * overkill, as it tries to extend the matching run in both * directions (and rematches what we already matched), but it works. */ i_paranoia_overlap(rv(root),cv(l), begin,beginL, rs(root),cs(l), &begin,&end); } /* end while (leading rift) */ /* Second, check for a trailing rift, fix it if possible, and then * extend the match forward until either we hit the limit of the * overlapping samples, or until we encounter another trailing rift. * Keep doing this until we hit the end of the overlap. */ /* If the end of the match didn't reach the end of either the fragment * or the root, we have a trailing rift to be examined. * * Remember that (end) is the offset into the root, and (end+offset) * is the equivalent offset into the fragment. If neither one is * at the end of the vector, then they both have samples after the * match, and hence a rift. * * (temp) is the size of the (potentially fixed-up) fragment. If * there was a leading rift, (l) is the fixed up fragment, and * (offset) is now relative to it. */ temp=l?cs(l):fs(v); while(end+offset 0 if there are samples missing from the root * matchA < 0 if there are duplicate samples (stuttering) in the root * matchB > 0 if there are samples missing from the fragment * matchB < 0 if there are duplicate samples in the fragment * matchC != 0 if there's a section of garbage, after which * the fragment and root agree and are in sync */ i_analyze_rift_f(rv(root),cv(l), rs(root),cs(l), end,endL, &matchA,&matchB,&matchC); #ifdef NOISY fprintf(stderr,"matching rootF: matchA:%ld matchB:%ld matchC:%ld\n", matchA,matchB,matchC); #endif if(matchA){ /* There's a problem with the root */ if(matchA>0){ /* There were (matchA) samples dropped from the root. We'll add * them back from the fixed up fragment. */ if(callback)(*callback)(end+rb(root),PARANOIA_CB_FIXUP_DROPPED); if(end+rb(root)root.returnedlimit) break; /* At the edge of the rift in the root, insert the missing * samples from the fixed up fragment. They're the (matchA) * samples immediately preceding the edge of the rift in the * fragment. */ c_insert(rc(root),end,cv(l)+endL,matchA); /* Although we just inserted samples into the root, we did so * after (begin) and (end), so we needn't update those offsets. */ }else{ /* There were (-matchA) duplicate samples (stuttering) in the * root. We'll drop them. */ if(callback)(*callback)(end+rb(root),PARANOIA_CB_FIXUP_DUPED); if(end+rb(root)root.returnedlimit) break; /* Remove the (-matchA) samples immediately following the edge * of the rift in the root. */ c_remove(rc(root),end,-matchA); /* Although we just removed samples from the root, we did so * after (begin) and (end), so we needn't update those offsets. */ } }else if(matchB){ /* There's a problem with the fragment */ if(matchB>0){ /* There were (matchB) samples dropped from the fragment. We'll * add them back from the root. */ if(callback)(*callback)(end+rb(root),PARANOIA_CB_FIXUP_DROPPED); /* At the edge of the rift in the fragment, insert the missing * samples from the root. They're the (matchB) samples * immediately following the dge of the rift in the root. * Note that we're fixing up the scratch copy of the fragment. */ c_insert(l,endL,rv(root)+end,matchB); /* Although we just inserted samples into the fragment, we did so * after (begin) and (end), so (offset) hasn't changed either. */ }else{ /* There were (-matchB) duplicate samples (stuttering) in the * fixed up fragment. We'll drop them. */ if(callback)(*callback)(end+rb(root),PARANOIA_CB_FIXUP_DUPED); /* Remove the (-matchB) samples immediately following the edge * of the rift in the fixed up fragment. */ c_remove(l,endL,-matchB); /* Although we just removed samples from the fragment, we did so * after (begin) and (end), so (offset) hasn't changed either. */ } }else if(matchC){ /* There are (matchC) samples that simply disagree between the * fragment and the root. On the other side of the mismatch, the * fragment and root agree again. We can't classify the mismatch * as either a stutter or dropped samples, and we have no way of * telling whether the fragment or the root is right. * * The original comment indicated that we set "disagree" flags * in the root, but it seems to be historical. */ if(end+rb(root)root.returnedlimit) break; /* Overwrite the mismatching (matchC) samples in root with the * samples from the fixed up fragment. */ c_overwrite(rc(root),end,cv(l)+endL,matchC); }else{ /* We may have had a mismatch because we ran into trailing silence. */ /* At this point we have a trailing rift. We check whether * one of the vectors (fragment or root) has trailing silence. */ analyze_rift_silence_f(rv(root),cv(l), rs(root),cs(l), end,endL, &matchA,&matchB); if(matchA){ /* The contents of the root's trailing rift are silence. The * fragment's are not (otherwise there wouldn't be a rift). * We therefore assume that the root has garbage from this * point forward and truncate it. * * This will have the effect of eliminating the trailing * rift, causing the fragment's samples to be appended to * the root. */ /* Can only do this if we haven't already returned data */ if(end+rb(root)>=p->root.returnedlimit){ c_remove(rc(root),end,-1); } }else if(matchB){ /* The contents of the fragment's trailing rift are silence. * The root's are not (otherwise there wouldn't be a rift). * We therefore assume that the fragment has garbage from this * point forward. * * We needn't actually truncate the fragment, because the root * has already been fixed up from this fragment as much as * possible, and the truncated fragment wouldn't extend the * root. Therefore, we can consider this (truncated) fragment * to be already merged into the root. So we dispose of it and * return a success. */ if(l)i_cblock_destructor(l); free_v_fragment(v); return(1); }else{ /* If the rift was too complex to fix (see i_analyze_rift_f), * we just stop and leave the trailing edge where it is. */ /*RRR(*callback)(post,PARANOIA_CB_XXX);*/ } break; } /* Now that we've fixed up the root or fragment as necessary, see * how far we can extend the matching run. This function is * overkill, as it tries to extend the matching run in both * directions (and rematches what we already matched), but it works. */ i_paranoia_overlap(rv(root),cv(l), begin,beginL, rs(root),cs(l), NULL,&end); temp=cs(l); } /* end while (trailing rift) */ /* Third and finally, if the overlapping verified fragment extends * our range forward (later samples), we append ("glom") the new * samples to the end of the root. * * Note that while we did fix up leading rifts, we don't extend * the root backward (earlier samples) -- only forward (later * samples). * * This is generally fine, since the verified root is supposed to * slide from earlier samples to later samples across multiple calls * to paranoia_read(). * * "??? But, is this actually right? Because of this, we don't * extend the root to hold the earliest read sample, if we * happened to initialize the root with a later sample due to * jitter. There are probably some ugly side effects from * extending the root backward, in the general case, but it may * not be so dire if we're near sample 0. To be investigated." * In the begin case, any start position is arbitrary due to * inexact seeking. Later, we can't back-extend the root as the * samples preceeding the beginning have already been returned * to the application! --Monty */ { long sizeA=rs(root); long sizeB; long vecbegin; int16_t *vector; /* If there were any rifts, we'll use the fixed up fragment (l), * otherwise, we use the original fragment (v). */ if(l){ sizeB=cs(l); vector=cv(l); vecbegin=cb(l); }else{ sizeB=fs(v); vector=fv(v); vecbegin=fb(v); } /* Convert the fragment-relative offset (sizeB) into an offset * relative to the root (A), and see if the offset is past the * end of the root (> sizeA). If it is, this fragment will extend * our root. * * "??? Why do we check for v->lastsector separately?" Because * of the case where root extends *too* far; if we never get a * read that accidentally extends that far again, we could * hang and loop forever. --Monty */ if(sizeB-offset>sizeA || v->lastsector){ if(v->lastsector){ root->lastsector=1; } /* "??? Why would end be < sizeA? Why do we truncate root?" Because it can happen (seeking is very very inexact) and end of disk tends to be very problematic in terms of stopping point. We also generally believe more recent information over previous information when they disagree and both are 'verified'. --Monty */ if(endstage2,offset+vecbegin-rb(root),callback); } } if(l)i_cblock_destructor(l); free_v_fragment(v); return(1); }else{ /* !i_iterate_stage2(...) */ /* We were unable to merge this fragment into the root. * * Check whether the fragment should have overlapped with the root, * even taking possible jitter into account. (I.e., If the fragment * ends so far before the end of the root that even (dynoverlap) * samples of jitter couldn't push it beyond the end of the root, * it should have overlapped.) * * It is, however, possible that we failed to match using the normal * tests because we're dealing with silence, which we handle * separately. * * If the fragment should have overlapped, and we're not dealing * with the special silence case, we don't know what to make of * this fragment, and we just discard it. */ if(fe(v)+dynoverlapsilenceflag){ /* It *should* have matched. No good; free it. */ free_v_fragment(v); } /* otherwise, we likely want this for an upcoming match */ /* we don't free the sort info (if it was collected) */ return(0); } } /* endif rv(root) */ } static int i_init_root(root_block *root, v_fragment *v,long begin, void(*callback)(long,int)){ if(fb(v)<=begin && fe(v)>begin){ root->lastsector=v->lastsector; root->returnedlimit=begin; if(rv(root)){ i_cblock_destructor(rc(root)); rc(root)=NULL; } { int16_t *buff=malloc(fs(v)*sizeof(int16_t)); memcpy(buff,fv(v),fs(v)*sizeof(int16_t)); root->vector=c_alloc(buff,fb(v),fs(v)); } /* Check whether the new root has a long span of trailing silence. */ i_silence_test(root); return(1); }else return(0); } static int vsort(const void *a,const void *b){ return((*(v_fragment **)a)->begin-(*(v_fragment **)b)->begin); } /* =========================================================================== * i_stage2 (internal) * * This function attempts to extend the verified root by merging verified * fragments into it. It keeps extending the tail end of the root until * it runs out of matching fragments. See i_stage2_each (and * i_iterate_stage2) for details of fragment matching and merging. * * This function is called by paranoia_read_limited when the verified root * doesn't contain sufficient data to satisfy the request for samples. * If this function fails to extend the verified root far enough (having * exhausted the currently available verified fragments), the caller * will then read the device again to try and establish more verified * fragments. * * We first try to merge all the fragments in ascending order using the * standard method (i_stage2_each()), and then we try to merge the * remaining fragments using silence matching (i_silence_match()) * if the root has a long span of trailing silence. See the initial * comments on silence and i_silence_match() for an explanation of this * distinction. * * This function returns the number of verified fragments successfully * merged into the verified root. */ static int i_stage2(cdrom_paranoia *p,long beginword,long endword, void(*callback)(long,int)){ int flag=1,ret=0; root_block *root=&(p->root); #ifdef NOISY fprintf(stderr,"Fragments:%ld\n",p->fragments->active); fflush(stderr); #endif /* even when the 'silence flag' is lit, we try to do non-silence matching in the event that there are still audio vectors with content to be sunk before the silence */ /* This flag is not the silence flag. Rather, it indicates whether * we succeeded in adding a verified fragment to the verified root. * In short, we keep adding fragments until we no longer find a * match. */ while(flag){ /* Convert the linked list of verified fragments into an array, * to be sorted in order of beginning sample position */ v_fragment *first=v_first(p); long active=p->fragments->active,count=0; v_fragment *list[active]; while(first){ v_fragment *next=v_next(first); list[count++]=first; first=next; } /* Reset the flag so that if we don't match any fragments, we * stop looping. Then, proceed only if there are any fragments * to match. */ flag=0; if(count){ /* Sort the array of verified fragments in order of beginning * sample position. */ qsort(list,active,sizeof(v_fragment *),&vsort); /* We don't check for the silence flag yet, because even if the * verified root ends in silence (and thus the silence flag is set), * there may be a non-silent region at the beginning of the verified * root, into which we can merge the verified fragments. */ /* Iterate through the verified fragments, starting at the fragment * with the lowest beginning sample position. */ for(count=0;countone){ /* If we don't have a verified root yet, just promote the first * fragment (with lowest beginning sample) to be the verified * root. * * "??? It seems that this could be fairly arbitrary if jitter * is an issue. If we've verified two fragments allegedly * beginning at "0" (which are actually slightly offset due to * jitter), the root might not begin at the earliest read * sample. Additionally, because subsequent fragments are * only merged at the tail end of the root, this situation * won't be fixed by merging the earlier samples. * * Practically, this ends up not being critical since most * drives insert some extra silent samples at the beginning * of the stream. Missing a few of them doesn't cause any * real lost data. But it is non-deterministic." * * On such a drive, the entire act of CDDA read is highly * nondeterministic. All redbook says is +/- 75 sectors. * If you insist on the earliest possible sample, you can * get into a situation where the first read was far earlier * than all the others and no other read ever repeats the * early positioning. --Monty */ if(rv(root)==NULL){ if(i_init_root(&(p->root),first,beginword,callback)){ free_v_fragment(first); /* Consider this a merged fragment, so set the flag * to keep looping. */ flag=1; ret++; } }else{ /* Try to merge this fragment with the verified root, * extending the tail of the root. */ if(i_stage2_each(root,first,callback)){ /* If we successfully merged the fragment, set the flag * to keep looping. */ ret++; flag=1; } } } } /* If the verified root ends in a long span of silence, iterate * through the remaining unmerged fragments to see if they can be * merged using our special silence matching. */ if(!flag && p->root.silenceflag){ for(count=0;countone){ if(rv(root)!=NULL){ /* Try to merge the fragment into the root. This will only * succeed if the fragment overlaps and begins with sufficient * silence to be a presumed match. * * Note that the fragments must be passed to i_silence_match() * in ascending order, as they are here. */ if(i_silence_match(root,first,callback)){ /* If we successfully merged the fragment, set the flag * to keep looping. */ ret++; flag=1; } } } } /* end for */ } } /* end if(count) */ /* If we were able to extend the verified root at all during this pass * through the loop, loop again to see if we can merge any remaining * fragments with the extended root. */ } /* end while */ /* Return the number of fragments we successfully merged into the * verified root. */ return(ret); } static void i_end_case(cdrom_paranoia *p,long endword, void(*callback)(long,int)){ root_block *root=&p->root; /* have an 'end' flag; if we've just read in the last sector in a session, set the flag. If we verify to the end of a fragment which has the end flag set, we're done (set a done flag). Pad zeroes to the end of the read */ if(root->lastsector==0)return; if(endwordroot); c_block *graft=NULL; int vflag=0; int gend=0; long post; #ifdef NOISY fprintf(stderr,"\nskipping\n"); #endif if(rv(root)==NULL){ post=0; }else{ post=re(root); } if(post==-1)post=0; if(callback)(*callback)(post,PARANOIA_CB_SKIP); /* We want to add a sector. Look for a c_block that spans, preferrably a verified area */ { c_block *c=c_first(p); while(c){ long cbegin=cb(c); long cend=ce(c); if(cbegin<=post && cend>post){ long vend=post; if(c->flags[post-cbegin]&FLAGS_VERIFIED){ /* verified area! */ while(vendflags[vend-cbegin]&FLAGS_VERIFIED))vend++; if(!vflag || vend>vflag){ graft=c; gend=vend; } vflag=1; }else{ /* not a verified area */ if(!vflag){ while(vendflags[vend-cbegin]&FLAGS_VERIFIED)==0)vend++; if(graft==NULL || gend>vend){ /* smallest unverified area */ graft=c; gend=vend; } } } } c=c_next(c); } if(graft){ long cbegin=cb(graft); long cend=ce(graft); while(gendflags[gend-cbegin]&FLAGS_VERIFIED))gend++; gend=min(gend+OVERLAP_ADJ,cend); if(rv(root)==NULL){ int16_t *buff=malloc(cs(graft)); memcpy(buff,cv(graft),cs(graft)); rc(root)=c_alloc(buff,cb(graft),cs(graft)); }else{ c_append(rc(root),cv(graft)+post-cbegin, gend-post); } root->returnedlimit=re(root); return; } } /* No? Fine. Great. Write in some zeroes :-P */ { void *temp=calloc(CD_FRAMESIZE_RAW,sizeof(int16_t)); if(rv(root)==NULL){ rc(root)=c_alloc(temp,post,CD_FRAMESIZE_RAW); }else{ c_append(rc(root),temp,CD_FRAMESIZE_RAW); free(temp); } root->returnedlimit=re(root); } } /**** toplevel ****************************************/ void paranoia_free(cdrom_paranoia *p){ paranoia_resetall(p); sort_free(p->sortcache); free_list(p->cache, 1); free_list(p->fragments, 1); free(p); } void paranoia_modeset(cdrom_paranoia *p,int enable){ p->enable=enable; } long paranoia_seek(cdrom_paranoia *p,long seek,int mode){ long sector; long ret; switch(mode){ case SEEK_SET: sector=seek; break; case SEEK_END: sector=cdda_disc_lastsector(p->d)+seek; break; default: sector=p->cursor+seek; break; } if(cdda_sector_gettrack(p->d,sector)==-1)return(-1); i_cblock_destructor(p->root.vector); p->root.vector=NULL; p->root.lastsector=0; p->root.returnedlimit=0; ret=p->cursor; p->cursor=sector; i_paranoia_firstlast(p); /* Evil hack to fix pregap patch for NEC drives! To be rooted out in a10 */ p->current_firstsector=sector; return(ret); } static void cdrom_cache_update(cdrom_paranoia *p, int lba, int sectors){ if(lba+sectors > p->cdcache_size){ int end = lba+sectors; lba=end-p->cdcache_size; sectors = end-lba; } if(lba < p->cdcache_begin){ /* a backseek flushes the cache */ p->cdcache_begin=lba; p->cdcache_end=lba+sectors; }else{ if(lba+sectors>p->cdcache_end) p->cdcache_end = lba+sectors; if(lba+sectors-p->cdcache_size > p->cdcache_begin){ if(lba+sectors-p->cdcache_size < p->cdcache_end){ p->cdcache_begin = lba+sectors-p->cdcache_size; }else{ p->cdcache_begin = lba; } } } } static void cdrom_cache_handler(cdrom_paranoia *p, int lba, void(*callback)(long,int)){ int seekpos; int ms; if(lba>=p->cdcache_end)return; /* nothing to do */ if(lba<0)lba=0; if(lbacdcache_begin){ /* should always trigger a backseek so let's do that here and look for the timing */ seekpos=(lba==0 || lba-1d) ? lba : lba-1); /* keep reads linear when possible */ }else{ int pre = p->cdcache_begin-1; int post = lba+p->cdcache_size; seekpos = (pred) ? post : pre); } if(cdda_read_timed(p->d,NULL,seekpos,1,&ms)==1) if(seekposcdcache_begin && msreadahead) sectors, encompassing at least * the requested words. * * It returns a c_block which encapsulates these sectors' data and sector * number. The sectors come come from multiple low-level read requests. * * This function reads many sectors in order to exhaust any caching on the * drive itself, as caching would simply return the same incorrect data * over and over. Paranoia depends on truly re-reading portions of the * disc to make sure the reads are accurate and correct any inaccuracies. * * Which precise sectors are read varies ("jiggles") between calls to * read_c_block, to prevent consistent errors across multiple reads * from being misinterpreted as correct data. * * The size of each low-level read is determined by the underlying driver * (p->d->nsectors), which allows the driver to specify how many sectors * can be read in a single request. Historically, the Linux kernel could * only read 8 sectors at a time, with likely dropped samples between each * read request. Other operating systems may have different limitations. * * This function is called by paranoia_read_limited(), which breaks the * c_block of read data into runs of samples that are likely to be * contiguous, verifies them and stores them in verified fragments, and * eventually merges the fragments into the verified root. * * This function returns the last c_block read or NULL on error. */ c_block *i_read_c_block(cdrom_paranoia *p,long beginword,long endword, void(*callback)(long,int)){ /* why do it this way? We need to read lots of sectors to kludge around stupid read ahead buffers on cheap drives, as well as avoid expensive back-seeking. We also want to 'jiggle' the start address to try to break borderline drives more noticeably (and make broken drives with unaddressable sectors behave more often). */ long readat,firstread; long totaltoread=p->cdcache_size; long sectatonce=p->d->nsectors; long driftcomp=(float)p->dyndrift/CD_FRAMEWORDS+.5; c_block *new=NULL; root_block *root=&p->root; int16_t *buffer=NULL; unsigned char *flags=NULL; long sofar; long dynoverlap=(p->dynoverlap+CD_FRAMEWORDS-1)/CD_FRAMEWORDS; long anyflag=0; /* Calculate the first sector to read. This calculation takes * into account the need to jitter the starting point of the read * to reveal consistent errors as well as the low reliability of * the edge words of a read. */ /* What is the first sector to read? want some pre-buffer if we're not at the extreme beginning of the disc */ if(p->enable&(PARANOIA_MODE_VERIFY|PARANOIA_MODE_OVERLAP)){ long target; if(rv(root)==NULL || rb(root)>beginword) target=p->cursor-dynoverlap; else target=re(root)/(CD_FRAMEWORDS)-dynoverlap; /* we want to jitter the read alignment boundary, as some drives, beginning from a specific point, will tend to lose bytes between sectors in the same place. Also, as our vectors are being made up of multiple reads, we want the overlap boundaries to move.... */ readat=(target&(~((long)JIGGLE_MODULO-1)))+p->jitter; if(readat>target)readat-=JIGGLE_MODULO; p->jitter--; if(p->jitter<0)p->jitter+=JIGGLE_MODULO; }else{ readat=p->cursor; } readat+=driftcomp; /* Create a new, empty c_block and add it to the head of the * list of c_blocks in memory. It will be empty until the end of * this subroutine. */ if(p->enable&(PARANOIA_MODE_OVERLAP|PARANOIA_MODE_VERIFY)){ flags=calloc(totaltoread*CD_FRAMEWORDS,1); new=new_c_block(p); recover_cache(p); }else{ /* in the case of root it's just the buffer */ paranoia_resetall(p); new=new_c_block(p); } buffer=malloc(totaltoread*CD_FRAMESIZE_RAW); sofar=0; firstread=-1; /* we have a read span; flush the drive cache if needed */ cdrom_cache_handler(p, readat, callback); /* Issue each of the low-level reads; the optimal read size is * approximately the cachemodel's cdrom cache size. The only reason * to read less would be memory considerations. * * p->readahead = total number of sectors to read * p->d->nsectors = number of sectors to read per request */ /* actual read loop */ while(sofarcurrent_firstsector){ secread-=p->current_firstsector-adjread; adjread=p->current_firstsector; } if(adjread+secread-1>p->current_lastsector) secread=p->current_lastsector-adjread+1; if(sofar+secread>totaltoread)secread=totaltoread-sofar; if(secread>0){ if(firstread<0)firstread=adjread; /* Issue the low-level read to the driver. */ /* If the low-level read returned too few sectors, pad the result * with null data and mark it as invalid (FLAGS_UNREAD). We pad * because we're going to be appending further reads to the current * c_block. * * "???: Why not re-read? It might be to keep you from getting * hung up on a bad sector. Or it might be to avoid * interrupting the streaming as much as possible." * * There are drives on which you will never get a full read in * some positions. They always abort out early due to firmware * boundary cases. Reread will cause exactly the same thing to * happen again. NEC MultiSpeed 4x is one such drive. In these * cases, you take what part of the read you know is good, and * you get substantially better performance. --Monty */ if((thisread=cdda_read(p->d,buffer+sofar*CD_FRAMEWORDS,adjread, secread))current_lastsector) new->lastsector=-1; if(callback)(*callback)((adjread+secread-1)*CD_FRAMEWORDS,PARANOIA_CB_READ); cdrom_cache_update(p,adjread,secread); sofar+=secread; readat=adjread+secread; }else /* secread <= 0 */ if(readatcurrent_firstsector) readat+=sectatonce; /* due to being before the readable area */ else break; /* due to being past the readable area */ /* Keep issuing read requests until we've read enough sectors to * exhaust the drive's cache. */ } /* end while */ /* If we managed to read any sectors at all (anyflag), fill in the * previously allocated c_block with the read data. Otherwise, free * our buffers, dispose of the c_block, and return NULL. */ if(anyflag){ new->vector=buffer; new->begin=firstread*CD_FRAMEWORDS-p->dyndrift; new->size=sofar*CD_FRAMEWORDS; new->flags=flags; }else{ if(new)free_c_block(new); free(buffer); free(flags); new=NULL; } return(new); } /** ========================================================================== * paranoia_read(), paranoia_read_limited() * * These functions "read" the next sector of audio data and returns * a pointer to a full sector of verified samples (2352 bytes). * * The returned buffer is *not* to be freed by the caller. It will * persist only until the next call to paranoia_read() for this p */ int16_t *paranoia_read(cdrom_paranoia *p, void(*callback)(long,int)){ return paranoia_read_limited(p,callback,20); } /* I added max_retry functionality this way in order to avoid breaking any old apps using the nerw libs. cdparanoia 9.8 will need the updated libs, but nothing else will require it. */ int16_t *paranoia_read_limited(cdrom_paranoia *p, void(*callback)(long,int), int max_retries){ long beginword=p->cursor*(CD_FRAMEWORDS); long endword=beginword+CD_FRAMEWORDS; long retry_count=0,lastend=-2; root_block *root=&p->root; if(p->d->opened==0){ errno=EBADF; return NULL; } if(beginword>p->root.returnedlimit)p->root.returnedlimit=beginword; lastend=re(root); /* Since paranoia reads and verifies chunks of data at a time * (which it needs to counteract dropped samples and inaccurate * seeking), the requested samples may already be in memory, * in the verified "root". * * The root is where paranoia stores samples that have been * verified and whose position has been accurately determined. */ /* First, is the sector we want already in the root? */ while(rv(root)==NULL || rb(root)>beginword || (re(root)enable&(PARANOIA_MODE_VERIFY|PARANOIA_MODE_OVERLAP)) || re(root)enable&(PARANOIA_MODE_VERIFY|PARANOIA_MODE_OVERLAP)){ /* We need to make sure our memory consumption doesn't grow * to the size of the whole CD. But at the same time, we * need to hang onto some of the verified data (even perhaps * data that's already been returned by paranoia_read()) in * order to verify and accurately position future samples. * * Therefore, we free some of the verified data that we * no longer need. */ i_paranoia_trim(p,beginword,endword); recover_cache(p); if(rb(root)!=-1 && p->root.lastsector) i_end_case(p,endword+(MAX_SECTOR_OVERLAP*CD_FRAMEWORDS), callback); else /* Merge as many verified fragments into the verified root * as we need to satisfy the pending request. We may * not have all the fragments we need, in which case we'll * read data from the CD further below. */ i_stage2(p,beginword, endword+(MAX_SECTOR_OVERLAP*CD_FRAMEWORDS), callback); }else i_end_case(p,endword+(MAX_SECTOR_OVERLAP*CD_FRAMEWORDS), callback); /* only trips if we're already done */ /* If we were able to fill the verified root with data already * in memory, we don't need to read any more data from the drive. */ if(!(rb(root)==-1 || rb(root)>beginword || re(root)enable&(PARANOIA_MODE_OVERLAP|PARANOIA_MODE_VERIFY)){ /* If we need to verify these samples, send them to * stage 1 verification, which will add verified samples * to the set of verified fragments. Verified fragments * will be merged into the verified root during stage 2 * overlap analysis. */ if(p->enable&PARANOIA_MODE_VERIFY) i_stage1(p,new,callback); /* If we're only doing overlapping reads (no stage 1 * verification), consider each low-level read in the * c_block to be a verified fragment. We exclude the * edges from these fragments to enforce the requirement * that we overlap the reads by the minimum amount. * These fragments will be merged into the verified * root during stage 2 overlap analysis. */ else{ /* just make v_fragments from the boundary information. */ long begin=0,end=0; while(beginflags[begin]&FLAGS_EDGE))begin++; end=begin+1; while(endflags[end]&FLAGS_EDGE)==0)end++; { new_v_fragment(p,new,begin+cb(new), end+cb(new), (new->lastsector && cb(new)+end==ce(new))); } begin=end; } } }else{ /* If we're not doing any overlapping reads or verification * of data, skip over the stage 1 and stage 2 verification and * promote this c_block directly to the current "verified" root. */ if(p->root.vector)i_cblock_destructor(p->root.vector); free_elem(new->e,0); p->root.vector=new; i_end_case(p,endword+(MAX_SECTOR_OVERLAP*CD_FRAMEWORDS), callback); } }else{ /* Was the medium removed or the device closed out from under us? */ if(errno==ENOMEDIUM) return NULL; } } /* Are we doing lots of retries? **************************************/ /* Check unaddressable sectors first. There's no backoff here; jiggle and minimum backseek handle that for us */ if(rb(root)!=-1 && lastend+588dynoverlap==MAX_SECTOR_OVERLAP*CD_FRAMEWORDS || retry_count==max_retries){ if(!(p->enable&PARANOIA_MODE_NEVERSKIP))verify_skip_case(p,callback); retry_count=0; }else{ if(p->stage1.offpoints!=-1){ /* hack */ p->dynoverlap*=1.5; if(p->dynoverlap>MAX_SECTOR_OVERLAP*CD_FRAMEWORDS) p->dynoverlap=MAX_SECTOR_OVERLAP*CD_FRAMEWORDS; if(callback)(*callback)(p->dynoverlap,PARANOIA_CB_OVERLAP); } } } } /* Having read data from the drive and placed it into verified * fragments, we now loop back to try to extend the root with * the newly loaded data. Alternatively, if the root already * contains the needed data, we'll just fall through. */ } /* end while */ p->cursor++; /* Return a pointer into the verified root. Thus, the caller * must NOT free the returned pointer! */ return(rv(root)+(beginword-rb(root))); } /* a temporary hack */ void paranoia_overlapset(cdrom_paranoia *p, long overlap){ p->dynoverlap=overlap*CD_FRAMEWORDS; p->stage1.offpoints=-1; } char *paranoia_version(void){ return VERSIONNUM; } cdparanoia-3.10.2+debian/paranoia/gap.h0000644000175000017500000000170511046366435017113 0ustar danieldaniel/*** * CopyPolicy: GNU Lesser General Public License 2.1 applies * Copyright (C) by Monty (xiphmont@mit.edu) ***/ #ifndef _GAP_H_ #define _GAP_H_ extern long i_paranoia_overlap_r(int16_t *buffA,int16_t *buffB, long offsetA, long offsetB); extern long i_paranoia_overlap_f(int16_t *buffA,int16_t *buffB, long offsetA, long offsetB, long sizeA,long sizeB); extern int i_stutter_or_gap(int16_t *A, int16_t *B,long offA, long offB, long gap); extern void i_analyze_rift_f(int16_t *A,int16_t *B, long sizeA, long sizeB, long aoffset, long boffset, long *matchA,long *matchB,long *matchC); extern void i_analyze_rift_r(int16_t *A,int16_t *B, long sizeA, long sizeB, long aoffset, long boffset, long *matchA,long *matchB,long *matchC); extern void analyze_rift_silence_f(int16_t *A,int16_t *B,long sizeA,long sizeB, long aoffset, long boffset, long *matchA, long *matchB); #endif cdparanoia-3.10.2+debian/paranoia/Makefile.in0000644000175000017500000000270711060030327020223 0ustar danieldaniel# cdda_paranoia makefile.in ready to go for autoconf. # DO NOT EDIT BELOW! ########################################################## # (unless, of course, you know what you are doing :) ########################## .SUFFIXES: .t VPATH=@srcdir@ srcdir=@srcdir@ @SET_MAKE@ FLAGS=@TYPESIZES@ @CFLAGS@ OPT=@OPT@ $(FLAGS) DEBUG=@DEBUG@ CC=@CC@ LD=@CC@ LDFLAGS=@LDFLAGS@ $(FLAGS) AR=@AR@ RANLIB=@RANLIB@ CPPFLAGS+=-D_REENTRANT OFILES = paranoia.o p_block.o overlap.o gap.o isort.o #TFILES = isort.t gap.t p_block.t paranoia.t LIBS = ../interface/libcdda_interface.a -lm export VERSION all: lib slib debug: $(MAKE) libcdda_paranoia.a CFLAGS="$(DEBUG)" lib: $(MAKE) libcdda_paranoia.a CFLAGS="$(OPT)" slib: $(MAKE) lessmessy $(MAKE) libcdda_paranoia.so CFLAGS="$(OPT) -fpic" #test: $(TFILES) # libcdda_paranoia.a: $(OFILES) $(AR) -r libcdda_paranoia.a $(OFILES) $(RANLIB) libcdda_paranoia.a libcdda_paranoia.so: $(OFILES) $(CC) -fpic -shared -o libcdda_paranoia.so.0.$(VERSION) -Wl,-soname -Wl,libcdda_paranoia.so.0 $(OFILES) -L ../interface -lcdda_interface [ -e libcdda_paranoia.so.0 ] || ln -s libcdda_paranoia.so.0.$(VERSION) libcdda_paranoia.so.0 [ -e libcdda_paranoia.so ] || ln -s libcdda_paranoia.so.0.$(VERSION) libcdda_paranoia.so .c.o: $(CC) $(CFLAGS) -c $< .c.t: $(CC) -g -DTEST $(DEBUG) -o $@ $< $(LIBS) $@ lessmessy: -rm -f *.o *.t core *~ clean: lessmessy -rm -f *.a *.so *.so.0 *.so.0.* core distclean: clean -rm -f Makefile cdparanoia-3.10.2+debian/paranoia/overlap.h0000644000175000017500000000111411046366435020006 0ustar danieldaniel/*** * CopyPolicy: GNU Lesser General Public License 2.1 applies * Copyright (C) by Monty (xiphmont@mit.edu) ***/ #ifndef _OVERLAP_H_ #define _OVERLAP_H_ extern void offset_add_value(cdrom_paranoia *p,offsets *o,long value, void(*callback)(long,int)); extern void offset_clear_settings(offsets *o); extern void offset_adjust_settings(cdrom_paranoia *p, void(*callback)(long,int)); extern void i_paranoia_trim(cdrom_paranoia *p,long beginword,long endword); extern void paranoia_resetall(cdrom_paranoia *p); extern void paranoia_resetcache(cdrom_paranoia *p); #endif cdparanoia-3.10.2+debian/paranoia/cdda_paranoia.h0000644000175000017500000000321611062275404021101 0ustar danieldaniel/*** * CopyPolicy: GNU Lesser General Public License 2.1 applies * Copyright (C) by Monty (xiphmont@mit.edu) * ***/ #ifndef _CDROM_PARANOIA_ #define _CDROM_PARANOIA_ #define CD_FRAMEWORDS (CD_FRAMESIZE_RAW/2) #define PARANOIA_CB_READ 0 #define PARANOIA_CB_VERIFY 1 #define PARANOIA_CB_FIXUP_EDGE 2 #define PARANOIA_CB_FIXUP_ATOM 3 #define PARANOIA_CB_SCRATCH 4 #define PARANOIA_CB_REPAIR 5 #define PARANOIA_CB_SKIP 6 #define PARANOIA_CB_DRIFT 7 #define PARANOIA_CB_BACKOFF 8 #define PARANOIA_CB_OVERLAP 9 #define PARANOIA_CB_FIXUP_DROPPED 10 #define PARANOIA_CB_FIXUP_DUPED 11 #define PARANOIA_CB_READERR 12 #define PARANOIA_CB_CACHEERR 13 #define PARANOIA_MODE_FULL 0xff #define PARANOIA_MODE_DISABLE 0 #define PARANOIA_MODE_VERIFY 1 #define PARANOIA_MODE_FRAGMENT 2 #define PARANOIA_MODE_OVERLAP 4 #define PARANOIA_MODE_SCRATCH 8 #define PARANOIA_MODE_REPAIR 16 #define PARANOIA_MODE_NEVERSKIP 32 #ifndef CDP_COMPILE typedef void cdrom_paranoia; #endif #include extern char *paranoia_version(); extern cdrom_paranoia *paranoia_init(cdrom_drive *d); extern void paranoia_modeset(cdrom_paranoia *p,int mode); extern long paranoia_seek(cdrom_paranoia *p,long seek,int mode); extern int16_t *paranoia_read(cdrom_paranoia *p,void(*callback)(long,int)); extern int16_t *paranoia_read_limited(cdrom_paranoia *p,void(*callback)(long,int),int maxretries); extern void paranoia_free(cdrom_paranoia *p); extern void paranoia_overlapset(cdrom_paranoia *p,long overlap); extern int paranoia_cachemodel_size(cdrom_paranoia *p,int sectors); #endif cdparanoia-3.10.2+debian/paranoia/overlap.c0000644000175000017500000001436311046366435020013 0ustar danieldaniel/*** * CopyPolicy: GNU Lesser General Public License 2.1 applies * Copyright (C) by Monty (xiphmont@mit.edu) * * Statistic code and cache management for overlap settings * ***/ #include #include #include #include "p_block.h" #include "cdda_paranoia.h" #include "overlap.h" #include "isort.h" /**** Internal cache management *****************************************/ void paranoia_resetcache(cdrom_paranoia *p){ c_block *c=c_first(p); v_fragment *v; while(c){ free_c_block(c); c=c_first(p); } v=v_first(p); while(v){ free_v_fragment(v); v=v_first(p); } } void paranoia_resetall(cdrom_paranoia *p){ p->root.returnedlimit=0; p->dyndrift=0; p->root.lastsector=0; if(p->root.vector){ i_cblock_destructor(p->root.vector); p->root.vector=NULL; } paranoia_resetcache(p); } void i_paranoia_trim(cdrom_paranoia *p,long beginword,long endword){ root_block *root=&(p->root); if(root->vector!=NULL){ long target=beginword-MAX_SECTOR_OVERLAP*CD_FRAMEWORDS; long rbegin=cb(root->vector); long rend=ce(root->vector); if(rbegin>beginword) goto rootfree; if(rbegin+MAX_SECTOR_OVERLAP*CD_FRAMEWORDSrend) goto rootfree; { long offset=target-rbegin; c_removef(root->vector,offset); } } { c_block *c=c_first(p); while(c){ c_block *next=c_next(c); if(ce(c)vector); root->vector=NULL; root->returnedlimit=-1; root->lastsector=0; } /**** Statistical and heuristic[al? :-] management ************************/ /* =========================================================================== * offset_adjust_settings (internal) * * This function is called by offset_add_value() every time 10 samples have * been accumulated. This function updates the internal statistics for * paranoia (dynoverlap, dyndrift) that compensate for jitter and drift. * * (dynoverlap) influences how far stage 1 and stage 2 search for matching * runs. In low-jitter conditions, it will be very small (or even 0), * narrowing our search. In high-jitter conditions, it will be much larger, * widening our search at the cost of speed. */ void offset_adjust_settings(cdrom_paranoia *p, void(*callback)(long,int)){ if(p->stage2.offpoints>=10){ /* drift: look at the average offset value. If it's over one sector, frob it. We just want a little hysteresis [sp?]*/ long av=(p->stage2.offpoints?p->stage2.offaccum/p->stage2.offpoints:0); if(abs(av)>p->dynoverlap/4){ av=(av/MIN_SECTOR_EPSILON)*MIN_SECTOR_EPSILON; if(callback)(*callback)(ce(p->root.vector),PARANOIA_CB_DRIFT); p->dyndrift+=av; /* Adjust all the values in the cache otherwise we get a (potentially unstable) feedback loop */ { c_block *c=c_first(p); v_fragment *v=v_first(p); while(v && v->one){ /* safeguard beginning bounds case with a hammer */ if(fb(v)one)one=NULL; }else{ fb(v)-=av; } v=v_next(v); } while(c){ long adj=min(av,cb(c)); c_set(c,cb(c)-adj); c=c_next(c); } } p->stage2.offaccum=0; p->stage2.offmin=0; p->stage2.offmax=0; p->stage2.offpoints=0; p->stage2.newpoints=0; p->stage2.offdiff=0; } } if(p->stage1.offpoints>=10){ /* dynoverlap: we arbitrarily set it to 4x the running difference value, unless min/max are more */ p->dynoverlap=(p->stage1.offpoints?p->stage1.offdiff/ p->stage1.offpoints*3:CD_FRAMEWORDS); if(p->dynoverlap<-p->stage1.offmin*1.5) p->dynoverlap=-p->stage1.offmin*1.5; if(p->dynoverlapstage1.offmax*1.5) p->dynoverlap=p->stage1.offmax*1.5; if(p->dynoverlapdynoverlap=MIN_SECTOR_EPSILON; if(p->dynoverlap>MAX_SECTOR_OVERLAP*CD_FRAMEWORDS) p->dynoverlap=MAX_SECTOR_OVERLAP*CD_FRAMEWORDS; if(callback)(*callback)(p->dynoverlap,PARANOIA_CB_OVERLAP); if(p->stage1.offpoints>600){ /* bit of a bug; this routine is called too often due to the overlap mesh alg we use in stage 1 */ p->stage1.offpoints/=1.2; p->stage1.offaccum/=1.2; p->stage1.offdiff/=1.2; } p->stage1.offmin=0; p->stage1.offmax=0; p->stage1.newpoints=0; } } /* =========================================================================== * offset_add_value (internal) * * This function adds the given jitter detected (value) to the statistics * for the given stage (o). It is called whenever jitter has been identified * by stage 1 or 2. After every 10 samples, we update the overall jitter- * compensation settings (e.g. dynoverlap). This allows us to narrow our * search for matching runs (in both stages) in low-jitter conditions * and also widen our search appropriately when there is jitter. * * * "???BUG???: * Note that there is a bug in the way that this is called by try_sort_sync(). * Silence looks like zero jitter, and dynoverlap may be incorrectly reduced * when there's lots of silence but also jitter." * * Strictly speaking, this is only sort-of true. The silence will * incorrectly somewhat reduce dynoverlap. However, it will increase * again once past the silence (even if reduced to zero, it will be * increased by the block read loop if we're not getting matches). * In reality, silence usually passes rapidly. Anyway, long streaks * of silence benefit performance-wise from having dynoverlap decrease * momentarily. There is no correctness bug. --Monty * */ void offset_add_value(cdrom_paranoia *p,offsets *o,long value, void(*callback)(long,int)){ if(o->offpoints!=-1){ /* Track the average magnitude of jitter (in either direction) */ o->offdiff+=abs(value); o->offpoints++; o->newpoints++; /* Track the net value of the jitter (to track drift) */ o->offaccum+=value; /* Track the largest jitter we've encountered in each direction */ if(valueoffmin)o->offmin=value; if(value>o->offmax)o->offmax=value; /* After 10 samples, update dynoverlap, etc. */ if(o->newpoints>=10)offset_adjust_settings(p,callback); } } cdparanoia-3.10.2+debian/paranoia/p_block.c0000644000175000017500000001677311062275404017754 0ustar danieldaniel#include #include #include #include #include "p_block.h" #include "../interface/cdda_interface.h" #include "cdda_paranoia.h" linked_list *new_list(void *(*newp)(void),void (*freep)(void *)){ linked_list *ret=calloc(1,sizeof(linked_list)); ret->new_poly=newp; ret->free_poly=freep; return(ret); } linked_element *add_elem(linked_list *l,void *elem){ linked_element *ret=calloc(1,sizeof(linked_element)); ret->stamp=l->current++; ret->ptr=elem; ret->list=l; if(l->head) l->head->prev=ret; else l->tail=ret; ret->next=l->head; ret->prev=NULL; l->head=ret; l->active++; return(ret); } linked_element *new_elem(linked_list *list){ void *new=list->new_poly(); return(add_elem(list,new)); } void free_elem(linked_element *e,int free_ptr){ linked_list *l=e->list; if(free_ptr)l->free_poly(e->ptr); if(e==l->head) l->head=e->next; if(e==l->tail) l->tail=e->prev; if(e->prev) e->prev->next=e->next; if(e->next) e->next->prev=e->prev; l->active--; free(e); } void free_list(linked_list *list,int free_ptr){ while(list->head) free_elem(list->head,free_ptr); free(list); } void *get_elem(linked_element *e){ return(e->ptr); } linked_list *copy_list(linked_list *list){ linked_list *new=new_list(list->new_poly,list->free_poly); linked_element *i=list->tail; while(i){ add_elem(new,i->ptr); i=i->prev; } return(new); } /**** C_block stuff ******************************************************/ static c_block *i_cblock_constructor(cdrom_paranoia *p){ c_block *ret=calloc(1,sizeof(c_block)); return(ret); } void i_cblock_destructor(c_block *c){ if(c){ if(c->vector)free(c->vector); if(c->flags)free(c->flags); c->e=NULL; free(c); } } c_block *new_c_block(cdrom_paranoia *p){ linked_element *e=new_elem(p->cache); c_block *c=e->ptr; c->e=e; c->p=p; return(c); } void free_c_block(c_block *c){ /* also rid ourselves of v_fragments that reference this block */ v_fragment *v=v_first(c->p); while(v){ v_fragment *next=v_next(v); if(v->one==c)free_v_fragment(v); v=next; } free_elem(c->e,1); } static v_fragment *i_vfragment_constructor(void){ v_fragment *ret=calloc(1,sizeof(v_fragment)); return(ret); } static void i_v_fragment_destructor(v_fragment *v){ free(v); } v_fragment *new_v_fragment(cdrom_paranoia *p,c_block *one, long begin, long end, int last){ linked_element *e=new_elem(p->fragments); v_fragment *b=e->ptr; b->e=e; b->p=p; b->one=one; b->begin=begin; b->vector=one->vector+begin-one->begin; b->size=end-begin; b->lastsector=last; return(b); } void free_v_fragment(v_fragment *v){ free_elem(v->e,1); } c_block *c_first(cdrom_paranoia *p){ if(p->cache->head) return(p->cache->head->ptr); return(NULL); } c_block *c_last(cdrom_paranoia *p){ if(p->cache->tail) return(p->cache->tail->ptr); return(NULL); } c_block *c_next(c_block *c){ if(c->e->next) return(c->e->next->ptr); return(NULL); } c_block *c_prev(c_block *c){ if(c->e->prev) return(c->e->prev->ptr); return(NULL); } v_fragment *v_first(cdrom_paranoia *p){ if(p->fragments->head){ return(p->fragments->head->ptr); } return(NULL); } v_fragment *v_last(cdrom_paranoia *p){ if(p->fragments->tail) return(p->fragments->tail->ptr); return(NULL); } v_fragment *v_next(v_fragment *v){ if(v->e->next) return(v->e->next->ptr); return(NULL); } v_fragment *v_prev(v_fragment *v){ if(v->e->prev) return(v->e->prev->ptr); return(NULL); } void recover_cache(cdrom_paranoia *p){ linked_list *l=p->cache; /* Are we at/over our allowed cache size? */ while(l->active>p->cache_limit) /* cull from the tail of the list */ free_c_block(c_last(p)); } int16_t *v_buffer(v_fragment *v){ if(!v->one)return(NULL); if(!cv(v->one))return(NULL); return(v->vector); } /* alloc a c_block not on a cache list */ c_block *c_alloc(int16_t *vector,long begin,long size){ c_block *c=calloc(1,sizeof(c_block)); c->vector=vector; c->begin=begin; c->size=size; return(c); } void c_set(c_block *v,long begin){ v->begin=begin; } /* pos here is vector position from zero */ void c_insert(c_block *v,long pos,int16_t *b,long size){ int vs=cs(v); if(pos<0 || pos>vs)return; if(v->vector) v->vector=realloc(v->vector,sizeof(int16_t)*(size+vs)); else v->vector=malloc(sizeof(int16_t)*size); if(posvector+pos+size,v->vector+pos, (vs-pos)*sizeof(int16_t)); memcpy(v->vector+pos,b,size*sizeof(int16_t)); v->size+=size; } void c_remove(c_block *v,long cutpos,long cutsize){ int vs=cs(v); if(cutpos<0 || cutpos>vs)return; if(cutpos+cutsize>vs)cutsize=vs-cutpos; if(cutsize<0)cutsize=vs-cutpos; if(cutsize<1)return; memmove(v->vector+cutpos,v->vector+cutpos+cutsize, (vs-cutpos-cutsize)*sizeof(int16_t)); v->size-=cutsize; } void c_overwrite(c_block *v,long pos,int16_t *b,long size){ int vs=cs(v); if(pos<0)return; if(pos+size>vs)size=vs-pos; memcpy(v->vector+pos,b,size*sizeof(int16_t)); } void c_append(c_block *v, int16_t *vector, long size){ int vs=cs(v); /* update the vector */ if(v->vector) v->vector=realloc(v->vector,sizeof(int16_t)*(size+vs)); else v->vector=malloc(sizeof(int16_t)*size); memcpy(v->vector+vs,vector,sizeof(int16_t)*size); v->size+=size; } void c_removef(c_block *v, long cut){ c_remove(v,0,cut); v->begin+=cut; } /**** Initialization *************************************************/ /*! Get the beginning and ending sector bounds given cursor position. There are a couple of subtle differences between this and the cdda_firsttrack_sector and cdda_lasttrack_sector. If the cursor is at a sector later than cdda_firsttrack_sector, that sector will be used. As for the difference between cdda_lasttrack_sector, if the CD is mixed and there is a data track after the cursor but before the last audio track, the end of the audio sector before that is used. */ void i_paranoia_firstlast(cdrom_paranoia *p){ int i; cdrom_drive *d=p->d; p->current_lastsector=-1; for(i=cdda_sector_gettrack(d,p->cursor);icurrent_lastsector=cdda_track_lastsector(d,i-1); if(p->current_lastsector==-1) p->current_lastsector=cdda_disc_lastsector(d); p->current_firstsector=-1; for(i=cdda_sector_gettrack(d,p->cursor);i>0;i--) if(!cdda_track_audiop(d,i)) p->current_firstsector=cdda_track_firstsector(d,i+1); if(p->current_firstsector==-1) p->current_firstsector=cdda_disc_firstsector(d); } cdrom_paranoia *paranoia_init(cdrom_drive *d){ cdrom_paranoia *p=calloc(1,sizeof(cdrom_paranoia)); p->cache=new_list((void *)&i_cblock_constructor, (void *)&i_cblock_destructor); p->fragments=new_list((void *)&i_vfragment_constructor, (void *)&i_v_fragment_destructor); p->cdcache_begin= 9999999; p->cdcache_end= 9999999; p->cdcache_size=CACHEMODEL_SECTORS; p->sortcache=sort_alloc(p->cdcache_size*CD_FRAMEWORDS); p->d=d; p->dynoverlap=MAX_SECTOR_OVERLAP*CD_FRAMEWORDS; p->cache_limit=JIGGLE_MODULO; p->enable=PARANOIA_MODE_FULL; p->cursor=cdda_disc_firstsector(d); /* One last one... in case data and audio tracks are mixed... */ i_paranoia_firstlast(p); return(p); } /* sectors < 0 indicates a query. Returns the number of sectors before the call */ int paranoia_cachemodel_size(cdrom_paranoia *p,int sectors){ int ret = p->cdcache_size; if(sectors>=0) p->cdcache_size=sectors; return ret; } cdparanoia-3.10.2+debian/utils.h0000644000175000017500000000400711053504472015701 0ustar danieldaniel#include #include #include #include #include extern long buffering_write(int outf, char *buffer, long num); extern int buffering_close(int fd); /* I wonder how many alignment issues this is gonna trip in the future... it shouldn't trip any... I guess we'll find out :) */ static inline int bigendianp(void){ int test=1; char *hack=(char *)(&test); if(hack[0])return(0); return(1); } static inline int32_t swap32(int32_t x){ return((((u_int32_t)x & 0x000000ffU) << 24) | (((u_int32_t)x & 0x0000ff00U) << 8) | (((u_int32_t)x & 0x00ff0000U) >> 8) | (((u_int32_t)x & 0xff000000U) >> 24)); } static inline int16_t swap16(int16_t x){ return((((u_int16_t)x & 0x00ffU) << 8) | (((u_int16_t)x & 0xff00U) >> 8)); } #if BYTE_ORDER == LITTLE_ENDIAN static inline int32_t be32_to_cpu(int32_t x){ return(swap32(x)); } static inline int16_t be16_to_cpu(int16_t x){ return(swap16(x)); } static inline int32_t le32_to_cpu(int32_t x){ return(x); } static inline int16_t le16_to_cpu(int16_t x){ return(x); } #else static inline int32_t be32_to_cpu(int32_t x){ return(x); } static inline int16_t be16_to_cpu(int16_t x){ return(x); } static inline int32_t le32_to_cpu(int32_t x){ return(swap32(x)); } static inline int16_t le16_to_cpu(int16_t x){ return(swap16(x)); } #endif static inline int32_t cpu_to_be32(int32_t x){ return(be32_to_cpu(x)); } static inline int32_t cpu_to_le32(int32_t x){ return(le32_to_cpu(x)); } static inline int16_t cpu_to_be16(int16_t x){ return(be16_to_cpu(x)); } static inline int16_t cpu_to_le16(int16_t x){ return(le16_to_cpu(x)); } static inline char *copystring(const char *s){ if(s){ char *ret=malloc((strlen(s)+1)*sizeof(char)); strcpy(ret,s); return(ret); } return(NULL); } static inline char *catstring(char *buff,const char *s){ if(s){ if(buff) buff=realloc(buff,strlen(buff)+strlen(s)+1); else buff=calloc(strlen(s)+1,1); strcat(buff,s); } return(buff); } cdparanoia-3.10.2+debian/configure.guess0000755000175000017500000012626010526475311017435 0ustar danieldaniel#! /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 Free Software Foundation, # Inc. timestamp='2006-07-02' # 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 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 ;; *) 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.*:*) echo i386-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:*:[45]) 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 ;; i*: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 ;; x86:Interix*:[3456]*) echo i586-pc-interix${UNAME_RELEASE} exit ;; EM64T:Interix*:[3456]*) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; [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:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu 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 ;; 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 ;; 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 ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" 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 ;; 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 ;; 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: cdparanoia-3.10.2+debian/README0000644000175000017500000001563011062300232015240 0ustar danieldanielcdparanoia III release 10.2 README [September 11, 2008] Monty This CDDA reader distribution ('cdparanoia') reads audio from the CDROM directly as data, with no analog step between, and writes the data to a file or pipe as .wav, .aifc or as raw 16 bit linear PCM. These are installation notes; for lots of other cdparanoia related information, see: http://www.xiph.org/paranoia/ COPYING ======= cdparanoia (the command line tool) is released under the GPLv2. The interface and paranoia libraries are covered by the LGPLv2.1. Requirements ============ 1. A CDDA capable CDROM drive (ATAPI, SCSI, or proprietary) 2. For proprietary drives: 2a. kernel support for the particular CDROM in use For ATAPI CDROM drives: Best: 2b. IDE cdrom (ATAPI) and SG_IO support (normal in 2.6 kernels) (*or*) Second best: (kernels older than 2.6) 2c. IDE-SCSI host adaptor emulation 2d. SCSI cdrom support (optional) 2e. kernel support for the generic SCSI interface and proper device (/dev/sg?) files in /dev. Most distributions already have the /dev/sg? files. devfs [supported] sets this up automagically. (*or*) Works, but can be cranky: (kernels older than 2.6) 2f. IDE cdrom (ATAPI) support without SG_IO, uses old read ioctl. For SCSI CDROM drives: 2g. SCSI cdrom and SG_IO support (normal in 2.6 kernels) (*or*) 2h. kernel support for the generic SCSI interface and proper device (/dev/sg?) files in /dev. Most distributions already have the /dev/sg? files. (kernels older than 2.6) 3. A Linux 2.4.x, 2.5.x or 2.6.x kernel Timing changes as of cdparanoia 10.2 likely mandate the use of a 2.4 or later kernel (tested). Older kernels may be missing the realtime clock infrastructure now needed for the beefed up cache paranoia added to 10.2. Cdparanoia does not require threading, IPC or sound card support. Compiling cdparanoia ================== To build the cdparanoia utility: ./configure make all This will compile cdparanoia and the shared paranoia libs; make install (as root) will install it. This version uses shared paranoia libs; you can still build the static version as follows: ./configure make all STATIC=TRUE Unlike cdda2wav and readcdda, cdparanoia is smart enough to find CDROM drives and the appropriate interfaces automatically; if you have only one CDROM drive, you'll not need to worry about it. If your machine has more than one CDROM drive and cdparanoia finds the wrong one, you'll need to tell it which device to use on the command line (see the man page and Troubleshooting below). To build the cdda_interface.a and cdda_paranoia.a libraries: ./configure make lib The .so shared libraries can be built as follows: ./configure make slib Other build notes (such as building and using a debugging version of cdparanoia to aid me in tracking down any trouble) can be found on the Cdparanoia web site at the URL given above. Additional installation notes ============================= Most Linux setups automagically perform the steps described below. The list is useful for doublechecking, or for setting up very old linux installs (pre-2002). (for SCSI devices) Cdparanoia requires either: 1. SCSI cdrom support with SG_IO support or 2. the generic SCSI interface. In new kernels, SG_IO support is standard. On kernels older than 2.6, you will need a kernel with compiled-in or module-supplied sg interface. In case of a module, this has to be loaded ('modprobe sg'; usually done in boot time scripts). This can be verified with 'cat /proc/devices'. It should have a line under Character devices: 21 sg When using the generic SCSI interface, cdparanoia also uses (but doesn't really require) the kernel SCSI cdrom driver, ie, a kernel with compiled-in or module-supplied cdrom support. In case of a module, this has to be loaded ('modprobe sr_mod'; again, usually part of boot up scripts). This can be verified with 'cat /proc/devices'. It should have a line under Block devices: 11 sr If the modules are properly configured but not currently loaded, cdparanoia will trigger loading during its autoscanning. In the /dev directory there have to be these descriptors: br-------- 1 cduser user 11, 0 Jan 23 1995 sr0 br-------- 1 cduser user 11, 1 Mar 24 1993 sr1 etc... and crw------- 1 cduser user 21, 0 Aug 27 1995 sga crw------- 1 cduser user 21, 1 Aug 27 1995 sgb crw------- 1 cduser user 21, 2 Aug 27 1995 sgc etc... and a link named 'cdrom' to the cdrom drive used. The link can be to the cdrom device *or* the generic device. The link isn't required, but it will speed autodetection. Permissions and ownership can be changed at will, of course. Here access is permitted only to user 'cduser'. (for ATAPI and proprietary cdrom devices) The kernel must have compiled-in or module-supplied cdrom support. In case of a module, this has to be loaded ('modprobe '; this is normally included in the boot-up scripts). This can be verified with 'cat /proc/devices'. It should have a line under Block devices: In the /dev directory there have to be these descriptors: br-------- 1 cduser user , 0 Jan 23 1995 br-------- 1 cduser user , 1 Mar 24 1993 etc... a link named 'cdrom' to the cdrom drive used will speed up the process of finding the cdrom (cdparanoia checks for the link first) These steps are usually performed automatically during the installation of Linux. (for ATAPI cdrom drives using SG_IO support) There's nothing much to do; make sure the kernel is actually compiled with SG_IO enabled, the appropriate drive entry appears in /dev/, and that the device is r/w accessible by the user. In modern distros, all these steps are automagic. (for ATAPI cdrom drives using IDE-SCSI host adaptor emulation) Overall, the instructions are the same as for normal SCSI drives. To cause the CDROM drive to appear as a SCSI device instead of ATAPI, the kernel must be compiled *with* SCSI and generic SCSI support, and *without* IDE CDROM drive (ATAPI) support. If native ATAPI support is enabled, the kernel will always choose to use the native ATAPI driver. Missing Features: ================== Specifically, 'cdparanoia' will not play to sound cards, do MD5 signatures, do rate reduction, or generally make use of the maximum speed available from a CDROM drive. If your CDROM drive is *not* prone to jitter and you don't have scratched discs to worry about, look into Heiko's original cdda2wav. Troubleshooting =============== lots o' stuff on the website. Contacts ======== The user and troubleshooting mailing list is paranoia@xiph.org. The main distribution site for cdparanoia (and the original Paranoia patches to cdda2wav) is http://www.xiph.org/paranoia/ Happy hunting. Be nice to copyrights. Monty cdparanoia-3.10.2+debian/configure.in0000644000175000017500000000260110470656661016711 0ustar danieldanielAC_INIT(interface/interface.c) cp $srcdir/configure.guess $srcdir/config.guess cp $srcdir/configure.sub $srcdir/config.sub AC_CANONICAL_HOST if test -z "$CC"; then AC_PROG_CC fi AC_PROG_RANLIB AC_CHECK_PROG(AR,ar,ar) AC_CHECK_PROG(INSTALL,install,install) if test -z "$GCC"; then DEBUG="-g" OPT="-O" else case $host in i?86-*-linux*) DEBUG="-g -Wall -fsigned-char" OPT="-O2 -ffast-math -fsigned-char -finline-functions";; *) DEBUG="-g -Wall -fsigned-char" OPT="-O2 -fsigned-char";; esac fi AC_HEADER_STDC AC_CHECK_SIZEOF(short) AC_CHECK_SIZEOF(int) AC_CHECK_SIZEOF(long) AC_CHECK_SIZEOF(long long) case 2 in $ac_cv_sizeof_short) SIZE16="short";; $ac_cv_sizeof_int) SIZE16="int";; esac case 4 in $ac_cv_sizeof_short) SIZE32="short";; $ac_cv_sizeof_int) SIZE32="int";; $ac_cv_sizeof_long) SIZE32="long";; esac AC_CHECK_TYPE(int16_t,SIZE16="int16_t",,) AC_CHECK_TYPE(int32_t,SIZE32="size32_t",,) if test -z "$SIZE16"; then AC_MSG_ERROR(No 16 bit type found on this platform!) fi if test -z "$SIZE32"; then AC_MSG_ERROR(No 32 bit type found on this platform!) fi AC_CHECK_HEADERS(linux/sbpcd.h, SBPCD_H="-DSBPCD_H='1' ") AC_CHECK_HEADERS(linux/ucdrom.h, UCDROM_H="-DUCDROM_H='1' ") AC_PROG_MAKE_SET AC_C_CONST AC_SUBST(SBPCD_H) AC_SUBST(UCDROM_H) AC_SUBST(TYPESIZES) AC_SUBST(OPT) AC_SUBST(DEBUG) AC_SUBST(CC) AC_OUTPUT(Makefile interface/Makefile paranoia/Makefile) cdparanoia-3.10.2+debian/Makefile.in0000644000175000017500000000577511062300232016436 0ustar danieldaniel ############################################################################### # DO NOT EDIT BELOW! ########################################################## # (unless, of course, you know what you are doing :) ########################## VERSION=10.2 VPATH=@srcdir@ srcdir=@srcdir@ @SET_MAKE@ FLAGS=@TYPESIZES@ @CFLAGS@ OPT=@OPT@ $(FLAGS) DEBUG=@DEBUG@ $(FLAGS) CC=@CC@ LD=@CC@ LDFLAGS=@LDFLAGS@ $(FLAGS) AR=@AR@ RANLIB=@RANLIB@ INSTALL=@INSTALL@ prefix=@prefix@ exec_prefix=@exec_prefix@ BINDIR=@bindir@ MANDIR=@mandir@ INCLUDEDIR=@includedir@ LIBDIR=@libdir@ PWD = $(shell pwd) OFILES = main.o report.o header.o buffering_write.o cachetest.o export STATIC export VERSION ifeq ($(STATIC),TRUE) LIBS = interface/libcdda_interface.a paranoia/libcdda_paranoia.a \ -static -lm -lrt LIBDEP = interface/libcdda_interface.a paranoia/libcdda_paranoia.a else LIBS = -lcdda_interface -lcdda_paranoia -lm -lrt LIBDEP = interface/libcdda_interface.so paranoia/libcdda_paranoia.so endif all: cd interface && $(MAKE) all cd paranoia && $(MAKE) all $(MAKE) cdparanoia CFLAGS="$(OPT)" debug: cd interface && $(MAKE) debug cd paranoia && $(MAKE) debug $(MAKE) cdparanoia CFLAGS="$(DEBUG)" STATIC=TRUE test: cd interface && $(MAKE) all cd paranoia && $(MAKE) test lib: cd interface && $(MAKE) lib cd paranoia && $(MAKE) lib slib: cd interface && $(MAKE) slib cd paranoia && $(MAKE) slib install: $(INSTALL) -d -m 0755 $(BINDIR) $(INSTALL) -m 755 $(srcdir)/cdparanoia $(BINDIR) $(INSTALL) -d -m 0755 $(MANDIR) $(INSTALL) -d -m 0755 $(MANDIR)/man1 $(INSTALL) -m 0644 $(srcdir)/cdparanoia.1 $(MANDIR)/man1 $(INSTALL) -d -m 0755 $(INCLUDEDIR) $(INSTALL) -m 0644 $(srcdir)/paranoia/cdda_paranoia.h $(INCLUDEDIR) $(INSTALL) -d -m 0755 $(LIBDIR) $(INSTALL) -m 0644 $(srcdir)/paranoia/libcdda_paranoia.so.0.$(VERSION) $(LIBDIR) $(INSTALL) -m 0644 $(srcdir)/paranoia/libcdda_paranoia.a $(LIBDIR) $(INSTALL) -m 0644 $(srcdir)/interface/cdda_interface.h $(INCLUDEDIR) $(INSTALL) -m 0644 $(srcdir)/interface/libcdda_interface.so.0.$(VERSION) $(LIBDIR) $(INSTALL) -m 0644 $(srcdir)/interface/libcdda_interface.a $(LIBDIR) $(INSTALL) -m 0644 $(srcdir)/utils.h $(INCLUDEDIR) ln -fs libcdda_interface.so.0.$(VERSION) \ $(LIBDIR)/libcdda_interface.so.0 ln -fs libcdda_interface.so.0.$(VERSION) \ $(LIBDIR)/libcdda_interface.so ln -fs libcdda_paranoia.so.0.$(VERSION) \ $(LIBDIR)/libcdda_paranoia.so.0 ln -fs libcdda_paranoia.so.0.$(VERSION) \ $(LIBDIR)/libcdda_paranoia.so cdparanoia: $(OFILES) $(LIBDEP) $(LD) $(CFLAGS) $(LDFLAGS) $(OFILES) \ -L$(PWD)/paranoia -L$(PWD)/interface \ -o cdparanoia $(LIBS) .c.o: $(CC) $(CFLAGS) -c $< clean: cd interface && $(MAKE) clean cd paranoia && $(MAKE) clean -rm -f cdparanoia *~ config.* *.o *.wav *.aifc *.raw \ verify_test core gmon.out distclean: cd interface && $(MAKE) distclean cd paranoia && $(MAKE) distclean -rm -f cdparanoia *~ config.* *.o *.wav *.aifc *.raw test.file \ Makefile verify_test core gmon.out .PHONY: all debug test lib slib install clean distclean cdparanoia-3.10.2+debian/report.h0000644000175000017500000000074111054727664016070 0ustar danieldanielextern int verbose; extern int quiet; extern FILE *reportfile; #define report(...) {if(!quiet){fprintf(stderr, __VA_ARGS__);fputc('\n',stderr);} \ if(reportfile){fprintf(reportfile, __VA_ARGS__);fputc('\n',reportfile);}} #define reportC(...) {if(!quiet){fprintf(stderr, __VA_ARGS__);} \ if(reportfile){fprintf(reportfile, __VA_ARGS__);}} #define printC(...) {if(!quiet){fprintf(stderr, __VA_ARGS__);}} #define logC(...) {if(reportfile){fprintf(reportfile, __VA_ARGS__);}} cdparanoia-3.10.2+debian/header.c0000644000175000017500000000573011046366435015777 0ustar danieldaniel/****************************************************************** * CopyPolicy: GNU Public License 2 applies * Copyright (C) 2008 Monty xiphmont@mit.edu * and Heiko Eissfeldt heiko@escape.colossus.de * * Writes wav and aifc headers * ******************************************************************/ #include #include #include #include static void PutNum(long num,int f,int endianness,int bytes){ int i; unsigned char c; if(!endianness) i=0; else i=bytes-1; while(bytes--){ c=(num>>(i<<3))&0xff; if(write(f,&c,1)==-1){ perror("Could not write to output."); exit(1); } if(endianness) i--; else i++; } } void WriteWav(int f,long bytes){ /* quick and dirty */ write(f,"RIFF",4); /* 0-3 */ PutNum(bytes+44-8,f,0,4); /* 4-7 */ write(f,"WAVEfmt ",8); /* 8-15 */ PutNum(16,f,0,4); /* 16-19 */ PutNum(1,f,0,2); /* 20-21 */ PutNum(2,f,0,2); /* 22-23 */ PutNum(44100,f,0,4); /* 24-27 */ PutNum(44100*2*2,f,0,4); /* 28-31 */ PutNum(4,f,0,2); /* 32-33 */ PutNum(16,f,0,2); /* 34-35 */ write(f,"data",4); /* 36-39 */ PutNum(bytes,f,0,4); /* 40-43 */ } void WriteAiff(int f,long bytes){ long size=bytes+54; long frames=bytes/4; /* Again, quick and dirty */ write(f,"FORM",4); /* 4 */ PutNum(size-8,f,1,4); /* 8 */ write(f,"AIFF",4); /* 12 */ write(f,"COMM",4); /* 16 */ PutNum(18,f,1,4); /* 20 */ PutNum(2,f,1,2); /* 22 */ PutNum(frames,f,1,4); /* 26 */ PutNum(16,f,1,2); /* 28 */ write(f,"@\016\254D\0\0\0\0\0\0",10); /* 38 (44.100 as a float) */ write(f,"SSND",4); /* 42 */ PutNum(bytes+8,f,1,4); /* 46 */ PutNum(0,f,1,4); /* 50 */ PutNum(0,f,1,4); /* 54 */ } void WriteAifc(int f,long bytes){ long size=bytes+86; long frames=bytes/4; /* Again, quick and dirty */ write(f,"FORM",4); /* 4 */ PutNum(size-8,f,1,4); /* 8 */ write(f,"AIFC",4); /* 12 */ write(f,"FVER",4); /* 16 */ PutNum(4,f,1,4); /* 20 */ PutNum(2726318400UL,f,1,4); /* 24 */ write(f,"COMM",4); /* 28 */ PutNum(38,f,1,4); /* 32 */ PutNum(2,f,1,2); /* 34 */ PutNum(frames,f,1,4); /* 38 */ PutNum(16,f,1,2); /* 40 */ write(f,"@\016\254D\0\0\0\0\0\0",10); /* 50 (44.100 as a float) */ write(f,"NONE",4); /* 54 */ PutNum(14,f,1,1); /* 55 */ write(f,"not compressed",14); /* 69 */ PutNum(0,f,1,1); /* 70 */ write(f,"SSND",4); /* 74 */ PutNum(bytes+8,f,1,4); /* 78 */ PutNum(0,f,1,4); /* 82 */ PutNum(0,f,1,4); /* 86 */ } cdparanoia-3.10.2+debian/interface/0000755000175000017500000000000011062306362016325 5ustar danieldanielcdparanoia-3.10.2+debian/interface/cooked_interface.c0000644000175000017500000001570311054751412021764 0ustar danieldaniel/****************************************************************** * CopyPolicy: GNU Lesser General Public License 2.1 applies * Copyright (C) Monty xiphmont@mit.edu * * CDROM code specific to the cooked ioctl interface * ******************************************************************/ #include "low_interface.h" #include "common_interface.h" #include "utils.h" #include static int timed_ioctl(cdrom_drive *d, int fd, int command, void *arg){ struct timespec tv1; struct timespec tv2; int ret1=clock_gettime(d->private->clock,&tv1); int ret2=ioctl(fd, command,arg); int ret3=clock_gettime(d->private->clock,&tv2); if(ret1<0 || ret3<0){ d->private->last_milliseconds=-1; }else{ d->private->last_milliseconds = (tv2.tv_sec-tv1.tv_sec)*1000. + (tv2.tv_nsec-tv1.tv_nsec)/1000000.; } return ret2; } static int cooked_readtoc (cdrom_drive *d){ int i; int tracks; struct cdrom_tochdr hdr; struct cdrom_tocentry entry; /* get TocHeader to find out how many entries there are */ if(ioctl(d->ioctl_fd, CDROMREADTOCHDR, &hdr )) switch(errno){ case EPERM: cderror(d,"102: Permision denied on cdrom (ioctl) device\n"); return(-102); default: cderror(d,"004: Unable to read table of contents header\n"); return(-4); } /* get all TocEntries */ for(i=0;iioctl_fd,CDROMREADTOCENTRY,&entry)){ cderror(d,"005: Unable to read table of contents entry\n"); return(-5); } d->disc_toc[i].bFlags = (entry.cdte_adr << 4) | (entry.cdte_ctrl & 0x0f); d->disc_toc[i].bTrack = i+1; d->disc_toc[i].dwStartSector = entry.cdte_addr.lba; } entry.cdte_track = CDROM_LEADOUT; entry.cdte_format = CDROM_LBA; if(ioctl(d->ioctl_fd, CDROMREADTOCENTRY, &entry)){ cderror(d,"005: Unable to read table of contents entry\n"); return(-5); } d->disc_toc[i].bFlags = (entry.cdte_adr << 4) | (entry.cdte_ctrl & 0x0f); d->disc_toc[i].bTrack = entry.cdte_track; d->disc_toc[i].dwStartSector = entry.cdte_addr.lba; tracks=hdr.cdth_trk1+1; d->cd_extra=FixupTOC(d,tracks); return(--tracks); /* without lead-out */ } /* Set operating speed */ static int cooked_setspeed(cdrom_drive *d, int speed) { if(d->ioctl_fd!=-1) return ioctl(d->ioctl_fd, CDROM_SELECT_SPEED, speed); else return 0; } /* read 'SectorBurst' adjacent sectors of audio sectors * to Buffer '*p' beginning at sector 'lSector' */ static long cooked_read (cdrom_drive *d, void *p, long begin, long sectors){ int retry_count,err,ret=0; struct cdrom_read_audio arg; char *buffer=(char *)p; /* read d->nsectors at a time, max. */ sectors=(sectors>d->nsectors?d->nsectors:sectors); if(p==NULL)buffer = malloc(sectors*CD_FRAMESIZE_RAW); arg.addr.lba = begin; arg.addr_format = CDROM_LBA; arg.nframes = sectors; arg.buf=buffer; retry_count=0; do { if((err=timed_ioctl(d,d->ioctl_fd, CDROMREADAUDIO, &arg))){ if(!d->error_retry){ ret=-7; goto done; } switch(errno){ case ENOMEM: /* D'oh. Possible kernel error. Keep limping */ if(sectors==1){ /* Nope, can't continue */ cderror(d,"300: Kernel memory error\n"); ret=-300; goto done; } case ENXIO: case EBADF: case ENOMEDIUM: errno=ENOMEDIUM; ret=0; goto done; default: if(sectors==1){ /* *Could* be I/O or media error. I think. If we're at 30 retries, we better skip this unhappy little sector. */ if(retry_count>MAX_RETRIES-1){ char b[256]; sprintf(b,"010: Unable to access sector %ld: skipping...\n", begin); cderror(d,b); ret=-10; goto done; } break; } } if(retry_count>4) if(sectors>1) sectors=sectors*3/4; retry_count++; if(retry_count>MAX_RETRIES){ cderror(d,"007: Unknown, unrecoverable error reading data\n"); ret=-7; goto done; } }else break; } while (err); ret=sectors; done: if(p==NULL && buffer)free(buffer); return ret; } /* hook */ static int Dummy (cdrom_drive *d,int Switch){ return(0); } static int verify_read_command(cdrom_drive *d){ int i; int16_t *buff=malloc(CD_FRAMESIZE_RAW); int audioflag=0; cdmessage(d,"Verifying drive can read CDDA...\n"); d->enable_cdda(d,1); for(i=1;i<=d->tracks;i++){ if(cdda_track_audiop(d,i)==1){ long firstsector=cdda_track_firstsector(d,i); long lastsector=cdda_track_lastsector(d,i); long sector=(firstsector+lastsector)>>1; audioflag=1; if(d->read_audio(d,buff,sector,1)>0){ cdmessage(d,"\tExpected command set reads OK.\n"); d->enable_cdda(d,0); free(buff); return(0); } } } d->enable_cdda(d,0); if(!audioflag){ cdmessage(d,"\tCould not find any audio tracks on this disk.\n"); return(-403); } cdmessage(d,"\n\tUnable to read any data; " "drive probably not CDDA capable.\n"); cderror(d,"006: Could not read any data from drive\n"); free(buff); return(-6); } #include "drive_exceptions.h" static void check_exceptions(cdrom_drive *d,exception *list){ int i=0; while(list[i].model){ if(!strncmp(list[i].model,d->drive_model,strlen(list[i].model))){ if(list[i].bigendianp!=-1)d->bigendianp=list[i].bigendianp; return; } i++; } } /* set function pointers to use the ioctl routines */ int cooked_init_drive (cdrom_drive *d){ int ret; switch(d->drive_type){ case MATSUSHITA_CDROM_MAJOR: /* sbpcd 1 */ case MATSUSHITA_CDROM2_MAJOR: /* sbpcd 2 */ case MATSUSHITA_CDROM3_MAJOR: /* sbpcd 3 */ case MATSUSHITA_CDROM4_MAJOR: /* sbpcd 4 */ /* don't make the buffer too big; this sucker don't preempt */ cdmessage(d,"Attempting to set sbpcd buffer size...\n"); d->nsectors=8; while(1){ /* this ioctl returns zero on error; exactly wrong, but that's what it does. */ if(ioctl(d->ioctl_fd, CDROMAUDIOBUFSIZ, d->nsectors)==0){ d->nsectors>>=1; if(d->nsectors==0){ char buffer[256]; d->nsectors=8; sprintf(buffer,"\tTrouble setting buffer size. Defaulting to %d sectors.\n", d->nsectors); cdmessage(d,buffer); break; /* Oh, well. Try to read anyway.*/ } }else{ char buffer[256]; sprintf(buffer,"\tSetting read block size at %d sectors (%ld bytes).\n", d->nsectors,(long)d->nsectors*CD_FRAMESIZE_RAW); cdmessage(d,buffer); break; } } break; case IDE0_MAJOR: case IDE1_MAJOR: case IDE2_MAJOR: case IDE3_MAJOR: d->nsectors=8; /* it's a define in the linux kernel; we have no way of determining other than this guess tho */ d->bigendianp=0; d->is_atapi=1; check_exceptions(d,atapi_list); break; default: d->nsectors=40; } d->enable_cdda = Dummy; d->read_audio = cooked_read; d->read_toc = cooked_readtoc; d->set_speed = cooked_setspeed; ret=d->tracks=d->read_toc(d); if(d->tracks<1) return(ret); d->opened=1; if((ret=verify_read_command(d)))return(ret); d->error_retry=1; return(0); } cdparanoia-3.10.2+debian/interface/toc.c0000644000175000017500000000731311050477564017274 0ustar danieldaniel/****************************************************************** * CopyPolicy: GNU Lesser General Public License 2.1 applies * Copyright (C) 1998-2008 Monty xiphmont@mit.edu * derived from code (C) 1994-1996 Heiko Eissfeldt * * Table of contents convenience functions * ******************************************************************/ #include "low_interface.h" #include "utils.h" long cdda_track_firstsector(cdrom_drive *d,int track){ if(!d->opened){ cderror(d,"400: Device not open\n"); return(-400); } if (track == 0) { if (d->disc_toc[0].dwStartSector == 0) { /* first track starts at lba 0 -> no pre-gap */ cderror(d,"401: Invalid track number\n"); return(-401); } else { return 0; /* pre-gap of first track always starts at lba 0 */ } } if(track<0 || track>d->tracks){ cderror(d,"401: Invalid track number\n"); return(-401); } return(d->disc_toc[track-1].dwStartSector); } long cdda_disc_firstsector(cdrom_drive *d){ int i; if(!d->opened){ cderror(d,"400: Device not open\n"); return(-400); } /* look for an audio track */ for(i=0;itracks;i++) if(cdda_track_audiop(d,i+1)==1) { if (i == 0) /* disc starts at lba 0 if first track is an audio track */ return 0; else return(cdda_track_firstsector(d,i+1)); } cderror(d,"403: No audio tracks on disc\n"); return(-403); } long cdda_track_lastsector(cdrom_drive *d,int track){ if(!d->opened){ cderror(d,"400: Device not open\n"); return(-400); } if (track == 0) { if (d->disc_toc[0].dwStartSector == 0) { /* first track starts at lba 0 -> no pre-gap */ cderror(d,"401: Invalid track number\n"); return(-401); } else { return d->disc_toc[0].dwStartSector-1; } } if(track<1 || track>d->tracks){ cderror(d,"401: Invalid track number\n"); return(-401); } /* Safe, we've always the leadout at disc_toc[tracks] */ return(d->disc_toc[track].dwStartSector-1); } long cdda_disc_lastsector(cdrom_drive *d){ int i; if(!d->opened){ cderror(d,"400: Device not open\n"); return(-400); } /* look for an audio track */ for(i=d->tracks-1;i>=0;i--) if(cdda_track_audiop(d,i+1)==1) return(cdda_track_lastsector(d,i+1)); cderror(d,"403: No audio tracks on disc\n"); return(-403); } long cdda_tracks(cdrom_drive *d){ if(!d->opened){ cderror(d,"400: Device not open\n"); return(-400); } return(d->tracks); } int cdda_sector_gettrack(cdrom_drive *d,long sector){ if(!d->opened){ cderror(d,"400: Device not open\n"); return(-400); }else{ int i; if (sector < d->disc_toc[0].dwStartSector) return 0; /* We're in the pre-gap of first track */ for(i=0;itracks;i++){ if(d->disc_toc[i].dwStartSector<=sector && d->disc_toc[i+1].dwStartSector>sector) return (i+1); } cderror(d,"401: Invalid track number\n"); return -401; } } int cdda_track_bitmap(cdrom_drive *d,int track,int bit,int set,int clear){ if(!d->opened){ cderror(d,"400: Device not open\n"); return(-400); } if (track == 0) track = 1; /* map to first track number */ if(track<1 || track>d->tracks){ cderror(d,"401: Invalid track number\n"); return(-401); } if ((d->disc_toc[track-1].bFlags & bit)) return(set); else return(clear); } int cdda_track_channels(cdrom_drive *d,int track){ return(cdda_track_bitmap(d,track,8,4,2)); } int cdda_track_audiop(cdrom_drive *d,int track){ return(cdda_track_bitmap(d,track,4,0,1)); } int cdda_track_copyp(cdrom_drive *d,int track){ return(cdda_track_bitmap(d,track,2,1,0)); } int cdda_track_preemp(cdrom_drive *d,int track){ return(cdda_track_bitmap(d,track,1,1,0)); } cdparanoia-3.10.2+debian/interface/interface.c0000644000175000017500000000734011062173150020432 0ustar danieldaniel/****************************************************************** * CopyPolicy: GNU Lesser General Public License 2.1 applies * Copyright (C) 1998-2008 Monty xiphmont@mit.edu * * Top-level interface module for cdrom drive access. SCSI, ATAPI, etc * specific stuff are in other modules. Note that SCSI does use * specialized ioctls; these appear in common_interface.c where the * generic_scsi stuff is in scsi_interface.c. * ******************************************************************/ #include "low_interface.h" #include "common_interface.h" #include "utils.h" #include "../version.h" char *cdda_version(void){ return VERSIONNUM; } static void _clean_messages(cdrom_drive *d){ if(d){ if(d->messagebuf)free(d->messagebuf); if(d->errorbuf)free(d->errorbuf); d->messagebuf=NULL; d->errorbuf=NULL; } } /* doubles as "cdrom_drive_free()" */ int cdda_close(cdrom_drive *d){ if(d){ if(d->opened) d->enable_cdda(d,0); _clean_messages(d); if(d->cdda_device_name)free(d->cdda_device_name); if(d->ioctl_device_name)free(d->ioctl_device_name); if(d->drive_model)free(d->drive_model); if(d->cdda_fd!=-1)close(d->cdda_fd); if(d->ioctl_fd!=-1 && d->ioctl_fd!=d->cdda_fd)close(d->ioctl_fd); if(d->private){ if(d->private->sg_hd)free(d->private->sg_hd); free(d->private); } free(d); } return(0); } /* finish initializing the drive! */ int cdda_open(cdrom_drive *d){ int ret; if(d->opened)return(0); switch(d->interface){ case SGIO_SCSI_BUGGY1: case SGIO_SCSI: case GENERIC_SCSI: if((ret=scsi_init_drive(d))) return(ret); break; case COOKED_IOCTL: if((ret=cooked_init_drive(d))) return(ret); break; #ifdef CDDA_TEST case TEST_INTERFACE: if((ret=test_init_drive(d))) return(ret); break; #endif default: cderror(d,"100: Interface not supported\n"); return(-100); } /* Check TOC, enable for CDDA */ /* Some drives happily return a TOC even if there is no disc... */ { int i; for(i=0;itracks;i++) if(d->disc_toc[i].dwStartSector<0 || d->disc_toc[i+1].dwStartSector==0){ d->opened=0; cderror(d,"009: CDROM reporting illegal table of contents\n"); return(-9); } } if((ret=d->enable_cdda(d,1))) return(ret); /* d->select_speed(d,d->maxspeed); most drives are full speed by default */ if(d->bigendianp==-1)d->bigendianp=data_bigendianp(d); return(0); } int cdda_speed_set(cdrom_drive *d, int speed) { if(d->set_speed) if(!d->set_speed(d,speed))return 0; cderror(d,"405: Option not supported by drive\n"); return -405; } long cdda_read_timed(cdrom_drive *d, void *buffer, long beginsector, long sectors, int *ms){ if(ms)*ms= -1; if(d->opened){ if(sectors>0){ sectors=d->read_audio(d,buffer,beginsector,sectors); if(sectors>0){ /* byteswap? */ if(d->bigendianp==-1) /* not determined yet */ d->bigendianp=data_bigendianp(d); if(d->bigendianp!=bigendianp()){ int i; u_int16_t *p=(u_int16_t *)buffer; long els=sectors*CD_FRAMESIZE_RAW/2; for(i=0;iprivate->last_milliseconds; return(sectors); } cderror(d,"400: Device not open\n"); return(-400); } long cdda_read(cdrom_drive *d, void *buffer, long beginsector, long sectors){ return cdda_read_timed(d,buffer,beginsector,sectors,NULL); } void cdda_verbose_set(cdrom_drive *d,int err_action, int mes_action){ d->messagedest=mes_action; d->errordest=err_action; } extern char *cdda_messages(cdrom_drive *d){ char *ret=d->messagebuf; d->messagebuf=NULL; return(ret); } extern char *cdda_errors(cdrom_drive *d){ char *ret=d->errorbuf; d->errorbuf=NULL; return(ret); } cdparanoia-3.10.2+debian/interface/test_interface.c0000644000175000017500000001140711062300232021461 0ustar danieldaniel/****************************************************************** * CopyPolicy: GNU Lessger General Public License 2.1 applies * Copyright (C) Monty xiphmont@mit.edu * * Fake interface backend for testing paranoia layer * ******************************************************************/ #ifdef CDDA_TEST #include "low_interface.h" #include "utils.h" /* Build which test model? */ #define CDDA_TEST_OK #undef CDDA_TEST_JITTER_SMALL #undef CDDA_TEST_JITTER_LARGE #undef CDDA_TEST_JITTER_MASSIVE #undef CDDA_TEST_FRAG_SMALL #undef CDDA_TEST_FRAG_LARGE #undef CDDA_TEST_FRAG_MASSIVE #undef CDDA_TEST_BOGUS_BYTES #undef CDDA_TEST_DROPDUPE_BYTES #undef CDDA_TEST_SCRATCH #undef CDDA_TEST_UNDERRUN #undef CDDA_TEST_ALLJITTER #undef CDDA_TEST_SOMEJITTER #undef CDDA_TEST_SEEKJITTER static int test_readtoc (cdrom_drive *d){ int tracks=0; long bytes; long sectors; /* only one track, as many sectors as the file */ bytes=lseek(d->cdda_fd,0,SEEK_END); lseek(d->cdda_fd,0,SEEK_SET); sectors=bytes/CD_FRAMESIZE_RAW; d->disc_toc[0].bFlags = 0; d->disc_toc[0].bTrack = 1; d->disc_toc[0].dwStartSector = 37; d->disc_toc[1].bFlags = 0x4; d->disc_toc[1].bTrack = CDROM_LEADOUT; d->disc_toc[1].dwStartSector = sectors+37; tracks=2; d->cd_extra=0; return(--tracks); /* without lead-out */ } /* we emulate jitter, scratches, atomic jitter and bogus bytes on boundaries, etc */ static long test_read(cdrom_drive *d, void *p, long begin, long sectors){ int jitter_flag=0; int los_flag=0; static int jitter=0; int bytes_so_far=0; long bytestotal; static FILE *fd=NULL; static long lastread=0; if(!fd)fd=fdopen(d->cdda_fd,"r"); if(beginprivate->last_milliseconds=20; else d->private->last_milliseconds=sectors; #ifdef CDDA_TEST_UNDERRUN sectors-=1; #endif #ifdef CDDA_TEST_SEEKJITTER if(lastread!=begin)jitter_flag=1; #else #ifdef CDDA_TEST_ALLJITTER jitter_flag=1; #else #ifdef CDDA_TEST_SOMEJITTER jitter_flag=(drand48()>.9?1:0); los_flag=(drand48()>.9?1:0); #else los_flag=1; #endif #endif #endif lastread=begin+sectors; bytestotal=sectors*CD_FRAMESIZE_RAW; begin*=CD_FRAMESIZE_RAW; while(bytes_so_far.8) this_jitter=32; else this_jitter=0; #endif #endif #endif #endif #endif #endif #endif #endif if(this_bytes>inner_bytes)this_bytes=inner_bytes; if(begin+jitter+bytes_so_far<0)jitter=0; seeki=begin+bytes_so_far+jitter; if(fseek(fd,seeki,SEEK_SET)<0){ return(0); } if(!inner_buf){ char *temp = malloc(this_bytes); rbytes=fread(temp,1,this_bytes,fd); free(temp); }else rbytes=fread(inner_buf,1,this_bytes,fd); bytes_so_far+=rbytes; if(rbytes==0)break; #ifdef CDDA_TEST_SEEKJITTER jitter_flag=0; los_flag=0; #else #ifdef CDDA_TEST_ALLJITTER jitter_flag=1; los_flag=0; #else #ifdef CDDA_TEST_SOMEJITTER jitter_flag=(drand48()>.9?1:0); los_flag=(drand48()>.9?1:0); #else los_flag=1; #endif #endif #endif } #ifdef CDDA_TEST_SCRATCH { long location=300*CD_FRAMESIZE_RAW+(drand48()*56)+512; if(begin<=location && begin+bytestotal>location){ if(p)memset(p+location-begin,(int)(drand48()*256),1100); } } #endif return(sectors); } /* hook */ static int Dummy (cdrom_drive *d,int Switch){ return(0); } /* set function pointers to use the ioctl routines */ int test_init_drive (cdrom_drive *d){ d->nsectors=13; d->enable_cdda = Dummy; d->read_audio = test_read; d->read_toc = test_readtoc; d->set_speed = Dummy; d->tracks=d->read_toc(d); if(d->tracks==-1) return(d->tracks); d->opened=1; srand48(0); return(0); } #endif cdparanoia-3.10.2+debian/interface/common_interface.c0000644000175000017500000001504011053311426021776 0ustar danieldaniel/****************************************************************** * CopyPolicy: GNU Lesser Public License 2.1 applies * Copyright (C) 1998-2008 Monty monty@xiph.org * * CDROM communication common to all interface methods is done here * (mostly ioctl stuff, but not ioctls specific to the 'cooked' * interface) * ******************************************************************/ #include #include "low_interface.h" #include "utils.h" #include "smallft.h" #include /* Test for presence of a cdrom by pinging with the 'CDROMVOLREAD' ioctl() */ /* Also test using CDROM_GET_CAPABILITY (if available) as some newer DVDROMs will reject CDROMVOLREAD ioctl for god-knows-what reason */ int ioctl_ping_cdrom(int fd){ struct cdrom_volctrl volctl; if (ioctl(fd, CDROMVOLREAD, &volctl) && ioctl(fd, CDROM_GET_CAPABILITY, NULL)<0) return(1); /* failure */ return(0); /* success! */ } /* Use the ioctl thingy above ping the cdrom; this will get model info */ char *atapi_drive_info(int fd){ /* Work around the fact that the struct grew without warning in 2.1/2.0.34 */ struct hd_driveid *id=malloc(512); /* the size in 2.0.34 */ char *ret; if (!(ioctl(fd, HDIO_GET_IDENTITY, id))) { if(id->model==0 || id->model[0]==0) ret=copystring("Generic Unidentifiable ATAPI CDROM"); else ret=copystring(id->model); }else ret=copystring("Generic Unidentifiable CDROM"); free(id); return(ret); } int data_bigendianp(cdrom_drive *d){ float lsb_votes=0; float msb_votes=0; int i,checked; int endiancache=d->bigendianp; float *a=calloc(1024,sizeof(float)); float *b=calloc(1024,sizeof(float)); long readsectors=5; int16_t *buff=malloc(readsectors*CD_FRAMESIZE_RAW); /* look at the starts of the audio tracks */ /* if real silence, tool in until some static is found */ /* Force no swap for now */ d->bigendianp=-1; cdmessage(d,"\nAttempting to determine drive endianness from data..."); d->enable_cdda(d,1); for(i=0,checked=0;itracks;i++){ float lsb_energy=0; float msb_energy=0; if(cdda_track_audiop(d,i+1)==1){ long firstsector=cdda_track_firstsector(d,i+1); long lastsector=cdda_track_lastsector(d,i+1); int zeroflag=-1; long beginsec=0; /* find a block with nonzero data */ while(firstsector+readsectors<=lastsector){ int j; if(d->read_audio(d,buff,firstsector,readsectors)>0){ /* Avoid scanning through jitter at the edges */ for(beginsec=0;beginsecenable_cdda(d,0); free(a); free(b); free(buff); return(-1); } } beginsec*=CD_FRAMESIZE_RAW/2; /* un-interleave for an fft */ if(!zeroflag){ int j; for(j=0;j<128;j++)a[j]=le16_to_cpu(buff[j*2+beginsec+460]); for(j=0;j<128;j++)b[j]=le16_to_cpu(buff[j*2+beginsec+461]); fft_forward(128,a,NULL,NULL); fft_forward(128,b,NULL,NULL); for(j=0;j<128;j++)lsb_energy+=fabs(a[j])+fabs(b[j]); for(j=0;j<128;j++)a[j]=be16_to_cpu(buff[j*2+beginsec+460]); for(j=0;j<128;j++)b[j]=be16_to_cpu(buff[j*2+beginsec+461]); fft_forward(128,a,NULL,NULL); fft_forward(128,b,NULL,NULL); for(j=0;j<128;j++)msb_energy+=fabs(a[j])+fabs(b[j]); } } if(lsb_energymsb_energy){ msb_votes+=lsb_energy/msb_energy; checked++; } if(checked==5 && (lsb_votes==0 || msb_votes==0))break; cdmessage(d,"."); } free(buff); free(a); free(b); d->bigendianp=endiancache; d->enable_cdda(d,0); /* How did we vote? Be potentially noisy */ if(lsb_votes>msb_votes){ char buffer[256]; cdmessage(d,"\n\tData appears to be coming back little endian.\n"); sprintf(buffer,"\tcertainty: %d%%\n",(int) (100.*lsb_votes/(lsb_votes+msb_votes)+.5)); cdmessage(d,buffer); return(0); }else{ if(msb_votes>lsb_votes){ char buffer[256]; cdmessage(d,"\n\tData appears to be coming back big endian.\n"); sprintf(buffer,"\tcertainty: %d%%\n",(int) (100.*msb_votes/(lsb_votes+msb_votes)+.5)); cdmessage(d,buffer); return(1); } cdmessage(d,"\n\tCannot determine CDROM drive endianness.\n"); return(bigendianp()); return(-1); } } /************************************************************************/ /* Here we fix up a couple of things that will never happen. yeah, right. The multisession stuff is from Hannu's code; it assumes it knows the leadout/leadin size. */ int FixupTOC(cdrom_drive *d,int tracks){ struct cdrom_multisession ms_str; int j; /* First off, make sure the 'starting sector' is >=0 */ for(j=0;jdisc_toc[j].dwStartSector<0){ cdmessage(d,"\n\tTOC entry claims a negative start offset: massaging" ".\n"); d->disc_toc[j].dwStartSector=0; } if(jdisc_toc[j].dwStartSector> d->disc_toc[j+1].dwStartSector){ cdmessage(d,"\n\tTOC entry claims an overly large start offset: massaging" ".\n"); d->disc_toc[j].dwStartSector=0; } } /* Make sure the listed 'starting sectors' are actually increasing. Flag things that are blatant/stupid/wrong */ { long last=d->disc_toc[0].dwStartSector; for(j=1;jdisc_toc[j].dwStartSectordisc_toc[j].dwStartSector=last; } last=d->disc_toc[j].dwStartSector; } } /* For a scsi device, the ioctl must go to the specialized SCSI CDROM device, not the generic device. */ if (d->ioctl_fd != -1) { int result; ms_str.addr_format = CDROM_LBA; result = ioctl(d->ioctl_fd, CDROMMULTISESSION, &ms_str); if (result == -1) return -1; if (ms_str.addr.lba > 100) { /* This is an odd little piece of code --Monty */ /* believe the multisession offset :-) */ /* adjust end of last audio track to be in the first session */ for (j = tracks-1; j >= 0; j--) { if (j > 0 && !IS_AUDIO(d,j) && IS_AUDIO(d,j-1)) { if ((d->disc_toc[j].dwStartSector > ms_str.addr.lba - 11400) && (ms_str.addr.lba - 11400 > d->disc_toc[j-1].dwStartSector)) d->disc_toc[j].dwStartSector = ms_str.addr.lba - 11400; break; } } return 1; } } return 0; } cdparanoia-3.10.2+debian/interface/scsi_interface.c0000644000175000017500000013351311062300232021446 0ustar danieldaniel/****************************************************************** * CopyPolicy: GNU Lesser General Public License 2.1 applies * Original interface.c Copyright (C) 1994-1997 * Eissfeldt heiko@colossus.escape.de * Current incarnation Copyright (C) 1998-2008 Monty xiphmont@mit.edu * * Generic SCSI interface specific code. * ******************************************************************/ #include "low_interface.h" #include "common_interface.h" #include "utils.h" #include static int timed_ioctl(cdrom_drive *d, int fd, int command, void *arg){ struct timespec tv1; struct timespec tv2; int ret1=clock_gettime(d->private->clock,&tv1); int ret2=ioctl(fd, command,arg); int ret3=clock_gettime(d->private->clock,&tv2); if(ret1<0 || ret3<0){ d->private->last_milliseconds=-1; }else{ d->private->last_milliseconds = (tv2.tv_sec-tv1.tv_sec)*1000. + (tv2.tv_nsec-tv1.tv_nsec)/1000000.; } return ret2; } /* hook */ static int Dummy (cdrom_drive *d,int s){ return(0); } #include "drive_exceptions.h" static void tweak_SG_buffer(cdrom_drive *d) { int table, reserved, cur, err; char buffer[256]; /* SG_SET_RESERVED_SIZE doesn't actually allocate or reserve anything. * what it _does_ do is give you an error if you ask for a value * larger than q->max_sectors (the length of the device's bio request * queue). So we walk it up from 1 sector until it fails, then get * the value we set it to last. */ /* start with 2 frames, round down to our queue's sector size */ cur = 1; do { cur <<= 1; reserved = cur * (1<<9); err = ioctl(d->cdda_fd, SG_SET_RESERVED_SIZE, &reserved); } while(err >= 0 && (cur*(1<<9) < 0x40000000)); ioctl(d->cdda_fd, SG_GET_RESERVED_SIZE, &reserved); /* this doesn't currently ever work, but someday somebody might implement working sg lists with SG_IO devices, so who knows... */ if (ioctl(d->cdda_fd, SG_GET_SG_TABLESIZE, &table) < 0) table=1; sprintf(buffer,"\tDMA scatter/gather table entries: %d\n\t" "table entry size: %d bytes\n\t" "maximum theoretical transfer: %d sectors\n", table, reserved, table*(reserved/CD_FRAMESIZE_RAW)); cdmessage(d,buffer); cur=reserved; /* only use one entry for now */ /* so since we never go above q->max_sectors, we should never get -EIO. * we might still get -ENOMEM, but we back off for that later. Monty * had an old comment: "not too much; new kernels have trouble with DMA * allocation, so be more conservative: 32kB max until I test more * thoroughly". We're not currently honoring that, because we should * always get -ENOMEM. * * Updated: but we don't always get -ENOMEM. Sometimes USB drives * still fail the wrong way. This needs some kernel-land investigation. */ /* Bumping to 64kB transfer max --Monty */ if (!getenv("CDDA_IGNORE_BUFSIZE_LIMIT")) { cur=(cur>1024*64?1024*64:cur); }else{ cdmessage(d,"\tEnvironment variable CDDA_IGNORE_BUFSIZE_LIMIT set,\n" "\t\tforcing maximum possible sector size. This can break\n" "\t\tspectacularly; use with caution!\n"); } d->nsectors=cur/CD_FRAMESIZE_RAW; d->bigbuff=cur; sprintf(buffer,"\tSetting default read size to %d sectors (%d bytes).\n\n", d->nsectors,d->nsectors*CD_FRAMESIZE_RAW); if(cur==0) exit(1); cdmessage(d,buffer); } static void clear_garbage(cdrom_drive *d){ fd_set fdset; struct timeval tv; struct sg_header *sg_hd=d->private->sg_hd; int flag=0; /* clear out any possibly preexisting garbage */ FD_ZERO(&fdset); FD_SET(d->cdda_fd,&fdset); tv.tv_sec=0; tv.tv_usec=0; /* I like select */ while(select(d->cdda_fd+1,&fdset,NULL,NULL,&tv)==1){ sg_hd->twelve_byte = 0; sg_hd->result = 0; sg_hd->reply_len = SG_OFF; read(d->cdda_fd, sg_hd, 1); /* reset for select */ FD_ZERO(&fdset); FD_SET(d->cdda_fd,&fdset); tv.tv_sec=0; tv.tv_usec=0; if(!flag && d->report_all) cdmessage(d,"Clearing previously returned data from SCSI buffer\n"); flag=1; } } static int check_sbp_error(const unsigned char status, const unsigned char *sbp) { char key = sbp[2] & 0xf; char ASC = sbp[12]; char ASCQ = sbp[13]; if(status==0)return 0; if(status==8)return TR_BUSY; if (sbp[0]) { switch (key){ case 0: if (errno==0) errno = EIO; return(TR_UNKNOWN); case 1: break; case 2: errno = ENOMEDIUM; return(TR_NOTREADY); case 3: if ((ASC==0x0C) & (ASCQ==0x09)) { /* loss of streaming */ if (errno==0) errno = EIO; return(TR_STREAMING); } else { if (errno==0) errno = EIO; return(TR_MEDIUM); } case 4: if (errno==0) errno = EIO; return(TR_FAULT); case 5: if (errno==0) errno = EINVAL; return(TR_ILLEGAL); default: if (errno==0) errno = EIO; return(TR_UNKNOWN); } } return 0; } /* process a complete scsi command. */ static int sg2_handle_scsi_cmd(cdrom_drive *d, unsigned char *cmd, unsigned int cmd_len, unsigned int in_size, unsigned int out_size, unsigned char bytefill, int bytecheck, unsigned char *sense_buffer){ struct timespec tv1; struct timespec tv2; int tret1,tret2; int status = 0; struct sg_header *sg_hd=d->private->sg_hd; long writebytes=SG_OFF+cmd_len+in_size; /* generic scsi device services */ /* clear out any possibly preexisting garbage */ clear_garbage(d); memset(sg_hd,0,sizeof(sg_hd)); memset(sense_buffer,0,SG_MAX_SENSE); memcpy(d->private->sg_buffer,cmd,cmd_len+in_size); sg_hd->twelve_byte = cmd_len == 12; sg_hd->result = 0; sg_hd->reply_len = SG_OFF + out_size; /* The following is one of the scariest hacks I've ever had to use. The idea is this: We want to know if a command fails. The generic scsi driver (as of now) won't tell us; it hands back the uninitialized contents of the preallocated kernel buffer. We force this buffer to a known value via another bug (nonzero data length for a command that doesn't take data) such that we can tell if the command failed. Scared yet? */ if(bytecheck && out_size>in_size){ memset(d->private->sg_buffer+cmd_len+in_size,bytefill,out_size-in_size); /* the size does not remove cmd_len due to the way the kernel driver copies buffers */ writebytes+=(out_size-in_size); } { /* Select on write with a 5 second timeout. This is a hack until a better error reporting layer is in place; right now, always print a message. */ fd_set fdset; struct timeval tv; FD_ZERO(&fdset); FD_SET(d->cdda_fd,&fdset); tv.tv_sec=60; /* Increased to 1m for plextor, as the drive will try to get through rough spots on its own and this can take time 19991129 */ tv.tv_usec=0; while(1){ int ret=select(d->cdda_fd+1,NULL,&fdset,NULL,&tv); if(ret>0)break; if(ret<0 && errno!=EINTR)break; if(ret==0){ fprintf(stderr,"\nSCSI transport error: timeout waiting to write" " packet\n\n"); return(TR_EWRITE); } } } sigprocmask (SIG_BLOCK, &(d->sigset), NULL ); tret1=clock_gettime(d->private->clock,&tv1); errno=0; status = write(d->cdda_fd, sg_hd, writebytes ); if (status<0 || status != writebytes ) { sigprocmask ( SIG_UNBLOCK, &(d->sigset), NULL ); if(errno==0)errno=EIO; return(TR_EWRITE); } { /* Select on read (and write; this signals an error) with a 5 second timeout. This is a hack until a better error reporting layer is in place; right now, always print a message. */ fd_set rset; struct timeval tv; FD_ZERO(&rset); FD_SET(d->cdda_fd,&rset); tv.tv_sec=60; /* Increased to 1m for plextor, as the drive will try to get through rough spots on its own and this can take time 19991129 */ tv.tv_usec=0; while(1){ int ret=select(d->cdda_fd+1,&rset,NULL,NULL,&tv); if(ret<0 && errno!=EINTR)break; if(ret==0){ sigprocmask ( SIG_UNBLOCK, &(d->sigset), NULL ); fprintf(stderr,"\nSCSI transport error: timeout waiting to read" " packet\n\n"); return(TR_EREAD); } if(ret>0){ /* is it readable or something else? */ if(FD_ISSET(d->cdda_fd,&rset))break; sigprocmask ( SIG_UNBLOCK, &(d->sigset), NULL ); fprintf(stderr,"\nSCSI transport: error reading packet\n\n"); return(TR_EREAD); } } } tret2=clock_gettime(d->private->clock,&tv2); errno=0; status = read(d->cdda_fd, sg_hd, SG_OFF + out_size); sigprocmask ( SIG_UNBLOCK, &(d->sigset), NULL ); memcpy(sense_buffer,sg_hd->sense_buffer,SG_MAX_SENSE); if (status<0)return status; if(status != SG_OFF + out_size || sg_hd->result){ if(errno==0)errno=EIO; return(TR_EREAD); } status = check_sbp_error(sg_hd->target_status, sense_buffer); if(status)return status; /* Failed/Partial DMA transfers occasionally get through. Why? No clue, but it's been demonstrated in practice that we occasionally get fewer bytes than we request with no indication anything went wrong. */ if(bytecheck && in_size+cmd_lenprivate->sg_buffer[i]!=bytefill){ flag=1; break; } if(!flag){ errno=EINVAL; return(TR_ILLEGAL); } } errno=0; if(tret1<0 || tret2<0){ d->private->last_milliseconds=-1; }else{ d->private->last_milliseconds = (tv2.tv_sec-tv1.tv_sec)*1000 + (tv2.tv_nsec-tv1.tv_nsec)/1000000; } return(0); } static int sgio_handle_scsi_cmd(cdrom_drive *d, unsigned char *cmd, unsigned int cmd_len, unsigned int in_size, unsigned int out_size, unsigned char bytefill, int bytecheck, unsigned char *sense){ int status = 0; struct sg_io_hdr hdr; memset(&hdr,0,sizeof(hdr)); memset(sense,0,sizeof(sense)); memcpy(d->private->sg_buffer,cmd+cmd_len,in_size); hdr.cmdp = cmd; hdr.cmd_len = cmd_len; hdr.sbp = sense; hdr.mx_sb_len = SG_MAX_SENSE; hdr.timeout = 50000; hdr.interface_id = 'S'; hdr.dxferp = d->private->sg_buffer; hdr.flags = SG_FLAG_DIRECT_IO; /* direct IO if we can get it */ /* scary buffer fill hack */ if(bytecheck && out_size>in_size) memset(hdr.dxferp+in_size,bytefill,out_size-in_size); if (in_size) { hdr.dxfer_len = in_size; hdr.dxfer_direction = SG_DXFER_TO_DEV; errno = 0; status = ioctl(d->ioctl_fd, SG_IO, &hdr); if (status >= 0 && hdr.status){ status = check_sbp_error(hdr.status,hdr.sbp); if(status) return status; } if (status < 0) return TR_EWRITE; } if (!in_size | out_size) { hdr.dxfer_len = out_size; if(bytecheck && d->interface != SGIO_SCSI_BUGGY1) hdr.dxfer_direction = out_size ? SG_DXFER_TO_FROM_DEV : SG_DXFER_NONE; else hdr.dxfer_direction = out_size ? SG_DXFER_FROM_DEV : SG_DXFER_NONE; errno = 0; status = timed_ioctl(d,d->ioctl_fd, SG_IO, &hdr); if (status >= 0 && hdr.status){ status = check_sbp_error(hdr.status,hdr.sbp); if(status) return status; } if (status < 0) return status; } /* Failed/Partial DMA transfers occasionally get through. Why? No clue, but it's been demonstrated in practice that we occasionally get fewer bytes than we request with no indication anything went wrong. */ if(bytecheck && in_sizeprivate->sg_buffer[i]!=bytefill){ flag=1; break; } if(!flag){ errno=EINVAL; return(TR_ILLEGAL); } } /* Can't rely on .duration because we can't be certain kernel has HZ set to something useful */ /* d->private->last_milliseconds = hdr.duration; */ errno = 0; return 0; } static int handle_scsi_cmd(cdrom_drive *d, unsigned char *cmd, unsigned int cmd_len, unsigned int in_size, unsigned int out_size, unsigned char bytefill, int bytecheck, unsigned char *sense){ if(d->interface == SGIO_SCSI || d->interface == SGIO_SCSI_BUGGY1) return sgio_handle_scsi_cmd(d,cmd,cmd_len,in_size,out_size,bytefill,bytecheck,sense); return sg2_handle_scsi_cmd(d,cmd,cmd_len,in_size,out_size,bytefill,bytecheck,sense); } static int test_unit_ready(cdrom_drive *d){ unsigned char sense[SG_MAX_SENSE]; unsigned char key, ASC, ASCQ; unsigned char cmd[6] = { 0x00, /* TEST_UNIT_READY */ 0, /* reserved */ 0, /* reserved */ 0, /* reserved */ 0, /* reserved */ 0};/* control */ handle_scsi_cmd(d, cmd, 6, 0, 56, 0,0, sense); key = d->private->sg_buffer[2] & 0xf; ASC = d->private->sg_buffer[12]; ASCQ = d->private->sg_buffer[13]; if(key == 2 && ASC == 4 && ASCQ == 1) return 0; return 1; } static void reset_scsi(cdrom_drive *d){ int arg,tries=0; d->enable_cdda(d,0); cdmessage(d,"sending SG SCSI reset... "); if(ioctl(d->cdda_fd,SG_SCSI_RESET,&arg)) cdmessage(d,"FAILED: EBUSY\n"); else cdmessage(d,"OK\n"); while(1) { if(test_unit_ready(d))break; tries++; usleep(10); } d->enable_cdda(d,1); } static int mode_sense_atapi(cdrom_drive *d,int size,int page){ unsigned char sense[SG_MAX_SENSE]; unsigned char cmd[10]= {0x5A, /* MODE_SENSE */ 0x00, /* reserved */ 0x00, /* page */ 0, /* reserved */ 0, /* reserved */ 0, /* reserved */ 0, /* reserved */ 0, /* MSB (0) */ 0, /* sizeof(modesense - SG_OFF) */ 0}; /* reserved */ cmd[1]=d->lun<<5; cmd[2]=0x3F&page; cmd[8]=size+4; if (handle_scsi_cmd (d, cmd, 10, 0, size+4,'\377',1,sense)) return(1); { unsigned char *b=d->private->sg_buffer; if(b[0])return(1); /* Handles only up to 256 bytes */ if(b[6])return(1); /* Handles only up to 256 bytes */ b[0]=b[1]-3; b[1]=b[2]; b[2]=b[3]; b[3]=b[7]; memmove(b+4,b+8,size-4); } return(0); } /* group 0 (6b) command */ static int mode_sense_scsi(cdrom_drive *d,int size,int page){ unsigned char sense[SG_MAX_SENSE]; unsigned char cmd[6]={0x1A, /* MODE_SENSE */ 0x00, /* return block descriptor/lun */ 0x00, /* page */ 0, /* reserved */ 0, /* sizeof(modesense - SG_OFF) */ 0}; /* control */ cmd[1]=d->lun<<5; cmd[2]=(0x3F&page); cmd[4]=size; if (handle_scsi_cmd (d, cmd, 6, 0, size, '\377',1, sense)) return(1); /* dump it all... */ return(0); } static int mode_sense(cdrom_drive *d,int size,int page){ if(d->is_atapi) return(mode_sense_atapi(d,size,page)); return(mode_sense_scsi(d,size,page)); } /* Current SG/SGIO impleenmtations specifically disallow mode set unless running as root (or setuid). One can see why (could be disastrous on, eg, a SCSI disk), but it curtails what we can do with older SCSI cdroms. */ static int mode_select(cdrom_drive *d,int density,int secsize){ /* short circut the way Heiko does it; less flexible, but shorter */ unsigned char sense[SG_MAX_SENSE]; if(d->is_atapi){ unsigned char cmd[26] = { 0x55, /* MODE_SELECT */ 0x10, /* no save page */ 0, /* reserved */ 0, /* reserved */ 0, /* reserved */ 0, /* reserved */ 0, /* reserved */ 0, /* reserved */ 16, /* sizeof(mode) */ 0, /* reserved */ /* mode parameter header */ 0, 0, 0, 0, 0, 0, 0, 8, /* Block Descriptor Length */ /* descriptor block */ 0, /* Density Code */ 0, 0, 0, /* # of Blocks */ 0, /* reserved */ 0, 0, 0};/* Blocklen */ unsigned char *mode = cmd + 18; /* prepare to read cds in the previous mode */ mode [0] = density; mode [6] = secsize >> 8; /* block length "msb" */ mode [7] = secsize & 0xFF; /* block length lsb */ /* do the scsi cmd */ return(handle_scsi_cmd (d,cmd,10, 16, 0,0,0,sense)); }else{ unsigned char cmd[18] = { 0x15, /* MODE_SELECT */ 0x10, /* no save page */ 0, /* reserved */ 0, /* reserved */ 12, /* sizeof(mode) */ 0, /* reserved */ /* mode section */ 0, 0, 0, 8, /* Block Descriptor Length */ 0, /* Density Code */ 0, 0, 0, /* # of Blocks */ 0, /* reserved */ 0, 0, 0};/* Blocklen */ unsigned char *mode = cmd + 10; /* prepare to read cds in the previous mode */ mode [0] = density; mode [6] = secsize >> 8; /* block length "msb" */ mode [7] = secsize & 0xFF; /* block length lsb */ /* do the scsi cmd */ return(handle_scsi_cmd (d,cmd,6, 12, 0,0,0,sense)); } } /* get current sector size from SCSI cdrom drive */ static unsigned int get_orig_sectorsize(cdrom_drive *d){ if(mode_sense(d,12,0x01))return(-1); d->orgdens = d->private->sg_buffer[4]; return(d->orgsize = ((int)(d->private->sg_buffer[10])<<8)+d->private->sg_buffer[11]); } /* switch CDROM scsi drives to given sector size */ static int set_sectorsize (cdrom_drive *d,unsigned int secsize){ return(mode_select(d,d->orgdens,secsize)); } /* switch old Toshiba/DEC and HP drives from/to cdda density */ int scsi_enable_cdda (cdrom_drive *d, int fAudioMode){ if (fAudioMode) { if(mode_select(d,d->density,CD_FRAMESIZE_RAW)){ if(d->error_retry) cderror(d,"001: Unable to set CDROM to read audio mode\n"); return(-1); } } else { if(mode_select(d,d->orgdens,d->orgsize)){ if(d->error_retry) cderror(d,"001: Unable to set CDROM to read audio mode\n"); return(-1); } } return(0); } typedef struct scsi_TOC { /* structure of scsi table of contents (cdrom) */ unsigned char reserved1; unsigned char bFlags; unsigned char bTrack; unsigned char reserved2; signed char start_MSB; unsigned char start_1; unsigned char start_2; unsigned char start_LSB; } scsi_TOC; /* read the table of contents from the cd and fill the TOC array */ /* Do it like the kernel ioctl driver; the 'all at once' approach fails on at least one Kodak drive. */ static int scsi_read_toc (cdrom_drive *d){ int i,first,last; unsigned tracks; /* READTOC, MSF format flag, res, res, res, res, Start track, len msb, len lsb, flags */ /* read the header first */ unsigned char sense[SG_MAX_SENSE]; unsigned char cmd[10] = { 0x43, 0, 0, 0, 0, 0, 1, 0, 12, 0}; cmd[1]=d->lun<<5; if (handle_scsi_cmd (d,cmd,10, 0, 12,'\377',1,sense)){ cderror(d,"004: Unable to read table of contents header\n"); return(-4); } first=d->private->sg_buffer[2]; last=d->private->sg_buffer[3]; tracks=last-first+1; if (last > MAXTRK || first > MAXTRK || last<0 || first<0) { cderror(d,"003: CDROM reporting illegal number of tracks\n"); return(-3); } for (i = first; i <= last; i++){ memcpy(cmd, (char []){ 0x43, 0, 0, 0, 0, 0, 0, 0, 12, 0}, 10); cmd[1]=d->lun<<5; cmd[6]=i; if (handle_scsi_cmd (d,cmd, 10, 0, 12,'\377',1,sense)){ cderror(d,"005: Unable to read table of contents entry\n"); return(-5); } { scsi_TOC *toc=(scsi_TOC *)(d->private->sg_buffer+4); d->disc_toc[i-first].bFlags=toc->bFlags; d->disc_toc[i-first].bTrack=i; d->disc_toc[i-first].dwStartSector= d->adjust_ssize * (((int)(toc->start_MSB)<<24) | (toc->start_1<<16)| (toc->start_2<<8)| (toc->start_LSB)); } } memcpy(cmd, (char []){ 0x43, 0, 0, 0, 0, 0, 0, 0, 12, 0}, 10); cmd[1]=d->lun<<5; cmd[6]=0xAA; if (handle_scsi_cmd (d,cmd,10, 0, 12,'\377',1,sense)){ cderror(d,"002: Unable to read table of contents lead-out\n"); return(-2); } { scsi_TOC *toc=(scsi_TOC *)(d->private->sg_buffer+4); d->disc_toc[i-first].bFlags=toc->bFlags; d->disc_toc[i-first].bTrack=0xAA; d->disc_toc[i-first].dwStartSector= d->adjust_ssize * (((int)(toc->start_MSB)<<24) | (toc->start_1<<16)| (toc->start_2<<8)| (toc->start_LSB)); } d->cd_extra = FixupTOC(d,tracks+1); /* include lead-out */ return(tracks); } /* a contribution from Boris for IMS cdd 522 */ /* check this for ACER/Creative/Foo 525,620E,622E, etc? */ static int scsi_read_toc2 (cdrom_drive *d){ u_int32_t foo,bar; int i; unsigned tracks; unsigned char cmd[10] = { 0xe5, 0, 0, 0, 0, 0, 0, 0, 0, 0}; unsigned char sense[SG_MAX_SENSE]; cmd[5]=1; cmd[8]=255; if (handle_scsi_cmd (d,cmd,10, 0, 256,'\377',1,sense)){ cderror(d,"004: Unable to read table of contents header\n"); return(-4); } /* copy to our structure and convert start sector */ tracks = d->private->sg_buffer[1]; if (tracks > MAXTRK) { cderror(d,"003: CDROM reporting illegal number of tracks\n"); return(-3); } for (i = 0; i < tracks; i++){ memcpy(cmd, (char[]){ 0xe5, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 10); cmd[5]=i+1; cmd[8]=255; if (handle_scsi_cmd (d,cmd,10, 0, 256,'\377',1,sense)){ cderror(d,"005: Unable to read table of contents entry\n"); return(-5); } d->disc_toc[i].bFlags = d->private->sg_buffer[10]; d->disc_toc[i].bTrack = i + 1; d->disc_toc[i].dwStartSector= d->adjust_ssize * (((signed char)(d->private->sg_buffer[2])<<24) | (d->private->sg_buffer[3]<<16)| (d->private->sg_buffer[4]<<8)| (d->private->sg_buffer[5])); } d->disc_toc[i].bFlags = 0; d->disc_toc[i].bTrack = i + 1; memcpy (&foo, d->private->sg_buffer+2, 4); memcpy (&bar, d->private->sg_buffer+6, 4); d->disc_toc[i].dwStartSector = d->adjust_ssize * (be32_to_cpu(foo) + be32_to_cpu(bar)); d->disc_toc[i].dwStartSector= d->adjust_ssize * ((((signed char)(d->private->sg_buffer[2])<<24) | (d->private->sg_buffer[3]<<16)| (d->private->sg_buffer[4]<<8)| (d->private->sg_buffer[5]))+ ((((signed char)(d->private->sg_buffer[6])<<24) | (d->private->sg_buffer[7]<<16)| (d->private->sg_buffer[8]<<8)| (d->private->sg_buffer[9])))); d->cd_extra = FixupTOC(d,tracks+1); return(tracks); } static int scsi_set_speed (cdrom_drive *d, int speed){ unsigned char cmd[12]={0xBB, 0, 0, 0, 0xff, 0xff, 0, 0, 0, 0, 0, 0}; unsigned char sense[SG_MAX_SENSE]; if(speed>=0) speed=speed*44100*4/1024; else speed=-1; cmd[2] = (speed >> 8) & 0xFF; cmd[3] = (speed) & 0xFF; return handle_scsi_cmd(d,cmd,12,0,0,0,0,sense); } /* These do one 'extra' copy in the name of clean code */ static int i_read_28 (cdrom_drive *d, void *p, long begin, long sectors, unsigned char *sense){ int ret; unsigned char cmd[10]={0x28, 0, 0, 0, 0, 0, 0, 0, 0, 0}; if(d->fua) cmd[1]=0x08; cmd[1]|=d->lun<<5; cmd[3] = (begin >> 16) & 0xFF; cmd[4] = (begin >> 8) & 0xFF; cmd[5] = begin & 0xFF; cmd[8] = sectors; if((ret=handle_scsi_cmd(d,cmd,10,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense))) return(ret); if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW); return(0); } static int i_read_A8 (cdrom_drive *d, void *p, long begin, long sectors, unsigned char *sense){ int ret; unsigned char cmd[12]={0xA8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; if(d->fua) cmd[1]=0x08; cmd[1]|=d->lun<<5; cmd[3] = (begin >> 16) & 0xFF; cmd[4] = (begin >> 8) & 0xFF; cmd[5] = begin & 0xFF; cmd[9] = sectors; if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense))) return(ret); if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW); return(0); } static int i_read_D4_10 (cdrom_drive *d, void *p, long begin, long sectors, unsigned char *sense){ int ret; unsigned char cmd[10]={0xd4, 0, 0, 0, 0, 0, 0, 0, 0, 0}; if(d->fua) cmd[1]=0x08; cmd[1]|=d->lun<<5; cmd[3] = (begin >> 16) & 0xFF; cmd[4] = (begin >> 8) & 0xFF; cmd[5] = begin & 0xFF; cmd[8] = sectors; if((ret=handle_scsi_cmd(d,cmd,10,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense))) return(ret); if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW); return(0); } static int i_read_D4_12 (cdrom_drive *d, void *p, long begin, long sectors, unsigned char *sense){ int ret; unsigned char cmd[12]={0xd4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; if(d->fua) cmd[1]=0x08; cmd[1]|=d->lun<<5; cmd[3] = (begin >> 16) & 0xFF; cmd[4] = (begin >> 8) & 0xFF; cmd[5] = begin & 0xFF; cmd[9] = sectors; if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense))) return(ret); if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW); return(0); } static int i_read_D5 (cdrom_drive *d, void *p, long begin, long sectors, unsigned char *sense){ int ret; unsigned char cmd[10]={0xd5, 0, 0, 0, 0, 0, 0, 0, 0, 0}; if(d->fua) cmd[1]=0x08; cmd[1]|=d->lun<<5; cmd[3] = (begin >> 16) & 0xFF; cmd[4] = (begin >> 8) & 0xFF; cmd[5] = begin & 0xFF; cmd[8] = sectors; if((ret=handle_scsi_cmd(d,cmd,10,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense))) return(ret); if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW); return(0); } static int i_read_D8 (cdrom_drive *d, void *p, long begin, long sectors, unsigned char *sense){ int ret; unsigned char cmd[12]={0xd8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; if(d->fua) cmd[1]=0x08; cmd[1]|=d->lun<<5; cmd[3] = (begin >> 16) & 0xFF; cmd[4] = (begin >> 8) & 0xFF; cmd[5] = begin & 0xFF; cmd[9] = sectors; if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense))) return(ret); if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW); return(0); } static int i_read_mmc (cdrom_drive *d, void *p, long begin, long sectors, unsigned char *sense){ int ret; unsigned char cmd[12]={0xbe, 0x2, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0}; cmd[3] = (begin >> 16) & 0xFF; cmd[4] = (begin >> 8) & 0xFF; cmd[5] = begin & 0xFF; cmd[8] = sectors; if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense))) return(ret); if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW); return(0); } static int i_read_mmcB (cdrom_drive *d, void *p, long begin, long sectors, unsigned char *sense){ int ret; unsigned char cmd[12]={0xbe, 0x0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0}; cmd[3] = (begin >> 16) & 0xFF; cmd[4] = (begin >> 8) & 0xFF; cmd[5] = begin & 0xFF; cmd[8] = sectors; if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense))) return(ret); if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW); return(0); } static int i_read_mmc2 (cdrom_drive *d, void *p, long begin, long sectors, unsigned char *sense){ int ret; unsigned char cmd[12]={0xbe, 0x2, 0, 0, 0, 0, 0, 0, 0, 0xf8, 0, 0}; cmd[3] = (begin >> 16) & 0xFF; cmd[4] = (begin >> 8) & 0xFF; cmd[5] = begin & 0xFF; cmd[8] = sectors; if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense))) return(ret); if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW); return(0); } static int i_read_mmc2B (cdrom_drive *d, void *p, long begin, long sectors, unsigned char *sense){ int ret; unsigned char cmd[12]={0xbe, 0x0, 0, 0, 0, 0, 0, 0, 0, 0xf8, 0, 0}; cmd[3] = (begin >> 16) & 0xFF; cmd[4] = (begin >> 8) & 0xFF; cmd[5] = begin & 0xFF; cmd[8] = sectors; if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense))) return(ret); if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW); return(0); } static int i_read_mmc3 (cdrom_drive *d, void *p, long begin, long sectors, unsigned char *sense){ int ret; unsigned char cmd[12]={0xbe, 0x6, 0, 0, 0, 0, 0, 0, 0, 0xf8, 0, 0}; cmd[3] = (begin >> 16) & 0xFF; cmd[4] = (begin >> 8) & 0xFF; cmd[5] = begin & 0xFF; cmd[8] = sectors; if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense))) return(ret); if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW); return(0); } static int i_read_mmc3B (cdrom_drive *d, void *p, long begin, long sectors, unsigned char *sense){ int ret; unsigned char cmd[12]={0xbe, 0x4, 0, 0, 0, 0, 0, 0, 0, 0xf8, 0, 0}; cmd[3] = (begin >> 16) & 0xFF; cmd[4] = (begin >> 8) & 0xFF; cmd[5] = begin & 0xFF; cmd[8] = sectors; if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense))) return(ret); if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW); return(0); } /* straight from the MMC3 spec */ static inline void LBA_to_MSF(long lba, unsigned char *M, unsigned char *S, unsigned char *F){ if(lba>=-150){ *M=(lba+150)/(60*75); lba-=(*M)*60*75; *S=(lba+150)/75; lba-=(*S)*75; *F=(lba+150); }else{ *M=(lba+450150)/(60*75); lba-=(*M)*60*75; *S=(lba+450150)/75; lba-=(*S)*75; *F=(lba+450150); } } static int i_read_msf (cdrom_drive *d, void *p, long begin, long sectors, unsigned char *sense){ int ret; unsigned char cmd[12]={0xb9, 0, 0, 0, 0, 0, 0, 0, 0, 0x10, 0, 0}; LBA_to_MSF(begin,cmd+3,cmd+4,cmd+5); LBA_to_MSF(begin+sectors,cmd+6,cmd+7,cmd+8); if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense))) return(ret); if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW); return(0); } static int i_read_msf2 (cdrom_drive *d, void *p, long begin, long sectors, unsigned char *sense){ int ret; unsigned char cmd[12]={0xb9, 0, 0, 0, 0, 0, 0, 0, 0, 0xf8, 0, 0}; LBA_to_MSF(begin,cmd+3,cmd+4,cmd+5); LBA_to_MSF(begin+sectors,cmd+6,cmd+7,cmd+8); if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense))) return(ret); if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW); return(0); } static int i_read_msf3 (cdrom_drive *d, void *p, long begin, long sectors, unsigned char *sense){ int ret; unsigned char cmd[12]={0xb9, 4, 0, 0, 0, 0, 0, 0, 0, 0xf8, 0, 0}; LBA_to_MSF(begin,cmd+3,cmd+4,cmd+5); LBA_to_MSF(begin+sectors,cmd+6,cmd+7,cmd+8); if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense))) return(ret); if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW); return(0); } static long scsi_read_map (cdrom_drive *d, void *p, long begin, long sectors, int (*map)(cdrom_drive *, void *, long, long, unsigned char *)){ unsigned char sense[SG_MAX_SENSE]; int retry_count,err; char *buffer=(char *)p; /* read d->nsectors at a time, max. */ sectors=(sectors>d->nsectors?d->nsectors:sectors); sectors=(sectors<1?1:sectors); retry_count=0; while(1) { if((err=map(d,(p?buffer:NULL),begin,sectors,sense))){ if(d->report_all){ char b[256]; sprintf(b,"scsi_read error: sector=%ld length=%ld retry=%d\n", begin,sectors,retry_count); cdmessage(d,b); sprintf(b," Sense key: %x ASC: %x ASCQ: %x\n", (int)(sense[2]&0xf), (int)(sense[12]), (int)(sense[13])); cdmessage(d,b); sprintf(b," Transport error: %s\n",strerror_tr[err]); cdmessage(d,b); sprintf(b," System error: %s\n",strerror(errno)); cdmessage(d,b); fprintf(stderr,"scsi_read error: sector=%ld length=%ld retry=%d\n", begin,sectors,retry_count); fprintf(stderr," Sense key: %x ASC: %x ASCQ: %x\n", (int)(sense[2]&0xf), (int)(sense[12]), (int)(sense[13])); fprintf(stderr," Transport error: %s\n",strerror_tr[err]); fprintf(stderr," System error: %s\n",strerror(errno)); } switch(errno){ case EINTR: usleep(100); continue; case ENOMEM: /* D'oh. Possible kernel error. Keep limping */ usleep(100); if(sectors==1){ /* Nope, can't continue */ cderror(d,"300: Kernel memory error\n"); return(-300); } if(d->report_all){ char b[256]; sprintf(b,"scsi_read: kernel couldn't alloc %ld bytes. " "backing off...\n",sectors*CD_FRAMESIZE_RAW); cdmessage(d,b); } sectors--; continue; case ENOMEDIUM: cderror(d,"404: No medium present\n"); return(-404); default: if(sectors==1){ if(errno==EIO) if(d->fua==-1) /* testing for FUA support */ return(-7); /* *Could* be I/O or media error. I think. If we're at 30 retries, we better skip this unhappy little sector. */ if(retry_count>MAX_RETRIES-1){ char b[256]; sprintf(b,"010: Unable to access sector %ld\n", begin); cderror(d,b); return(-10); } break; } /* Hmm. OK, this is just a tad silly. just in case this was a timeout and a reset happened, we need to set the drive back to cdda */ reset_scsi(d); } if(!d->error_retry)return(-7); }else{ /* Did we get all the bytes we think we did, or did the kernel suck? */ if(buffer){ long i; for(i=sectors*CD_FRAMESIZE_RAW;i>1;i-=2) if(buffer[i-1]!='\177' || buffer[i-2]!='\177') break; i/=CD_FRAMESIZE_RAW; if(i!=sectors){ if(d->report_all){ char b[256]; sprintf(b,"scsi_read underrun: pos=%ld len=%ld read=%ld retry=%d\n", begin,sectors,i,retry_count); cdmessage(d,b); } reset_scsi(d); } if(i>0)return(i); }else break; } retry_count++; if(sectors==1 && retry_count>MAX_RETRIES){ cderror(d,"007: Unknown, unrecoverable error reading data\n"); return(-7); } if(sectors>1)sectors=sectors/2; d->enable_cdda(d,0); d->enable_cdda(d,1); } return(sectors); } long scsi_read_28 (cdrom_drive *d, void *p, long begin, long sectors){ return(scsi_read_map(d,p,begin,sectors,i_read_28)); } long scsi_read_A8 (cdrom_drive *d, void *p, long begin, long sectors){ return(scsi_read_map(d,p,begin,sectors,i_read_A8)); } long scsi_read_D4_10 (cdrom_drive *d, void *p, long begin, long sectors){ return(scsi_read_map(d,p,begin,sectors,i_read_D4_10)); } long scsi_read_D4_12 (cdrom_drive *d, void *p, long begin, long sectors){ return(scsi_read_map(d,p,begin,sectors,i_read_D4_12)); } long scsi_read_D5 (cdrom_drive *d, void *p, long begin, long sectors){ return(scsi_read_map(d,p,begin,sectors,i_read_D5)); } long scsi_read_D8 (cdrom_drive *d, void *p, long begin, long sectors){ return(scsi_read_map(d,p,begin,sectors,i_read_D8)); } long scsi_read_mmc (cdrom_drive *d, void *p, long begin, long sectors){ return(scsi_read_map(d,p,begin,sectors,i_read_mmc)); } long scsi_read_mmc2 (cdrom_drive *d, void *p, long begin, long sectors){ return(scsi_read_map(d,p,begin,sectors,i_read_mmc2)); } long scsi_read_mmc3 (cdrom_drive *d, void *p, long begin, long sectors){ return(scsi_read_map(d,p,begin,sectors,i_read_mmc3)); } long scsi_read_mmcB (cdrom_drive *d, void *p, long begin, long sectors){ return(scsi_read_map(d,p,begin,sectors,i_read_mmcB)); } long scsi_read_mmc2B (cdrom_drive *d, void *p, long begin, long sectors){ return(scsi_read_map(d,p,begin,sectors,i_read_mmc2B)); } long scsi_read_mmc3B (cdrom_drive *d, void *p, long begin, long sectors){ return(scsi_read_map(d,p,begin,sectors,i_read_mmc3B)); } long scsi_read_msf (cdrom_drive *d, void *p, long begin, long sectors){ return(scsi_read_map(d,p,begin,sectors,i_read_msf)); } long scsi_read_msf2 (cdrom_drive *d, void *p, long begin, long sectors){ return(scsi_read_map(d,p,begin,sectors,i_read_msf2)); } long scsi_read_msf3 (cdrom_drive *d, void *p, long begin, long sectors){ return(scsi_read_map(d,p,begin,sectors,i_read_msf3)); } /* Some drives, given an audio read command, return only 2048 bytes of data as opposed to 2352 bytes. Look for bytess at the end of the single sector verification read */ static int count_2352_bytes(cdrom_drive *d){ long i; for(i=2351;i>=0;i--) if(d->private->sg_buffer[i]!=(unsigned char)'\177') return(((i+3)>>2)<<2); return(0); } static int verify_nonzero(cdrom_drive *d){ long i,flag=0; for(i=0;i<2352;i++) if(d->private->sg_buffer[i]!=0){ flag=1; break; } return(flag); } /* So many different read commands, densities, features... Verify that our selected 'read' command actually reads nonzero data, else search through other possibilities */ static int verify_read_command(cdrom_drive *d){ int i,j,k; int audioflag=0; int (*enablecommand) (struct cdrom_drive *d, int speed); long (*readcommand) (struct cdrom_drive *d, void *p, long begin, long sectors); unsigned char density; int16_t *buff=malloc(CD_FRAMESIZE_RAW); cdmessage(d,"Verifying CDDA command set...\n"); /* try the expected command set; grab the center of each track, look for data */ if(d->enable_cdda(d,1)==0){ for(i=1;i<=d->tracks;i++){ if(cdda_track_audiop(d,i)==1){ long firstsector=cdda_track_firstsector(d,i); long lastsector=cdda_track_lastsector(d,i); long sector=(firstsector+lastsector)>>1; audioflag=1; if(d->read_audio(d,buff,sector,1)>0){ if(count_2352_bytes(d)==2352){ cdmessage(d,"\tExpected command set reads OK.\n"); d->enable_cdda(d,0); free(buff); return(0); } } } } d->enable_cdda(d,0); } if(!audioflag){ cdmessage(d,"\tCould not find any audio tracks on this disk.\n"); return(-403); } { char *es="",*rs=""; d->bigendianp=-1; density=d->density; readcommand=d->read_audio; enablecommand=d->enable_cdda; /* No nonzeroes? D'oh. Exhaustive search */ cdmessage(d,"\tExpected command set FAILED!\n" "\tPerforming full probe for CDDA command set...\n"); /* loops: density/enable no, 0x0/org, 0x04/org, 0x82/org read command read_10 read_12 read_nec read_sony read_mmc read_mmc2 */ /* NEC test must come before sony; the nec drive expects d8 to be 10 bytes, and a 12 byte verson (Sony) crashes the drive */ for(j=0;j<15;j++){ int densitypossible=1; switch(j){ case 0: d->read_audio=scsi_read_28; rs="28 0x,00"; break; case 1: d->read_audio=scsi_read_A8; rs="a8 0x,00"; break; case 2: d->read_audio=scsi_read_mmcB; rs="be 02,10"; densitypossible=0; break; case 3: d->read_audio=scsi_read_mmc2B; rs="be 02,f8"; densitypossible=0; break; case 4: d->read_audio=scsi_read_mmc3B; rs="be 06,f8"; densitypossible=0; break; case 5: d->read_audio=scsi_read_mmc; rs="be 00,10"; densitypossible=0; break; case 6: d->read_audio=scsi_read_mmc2; rs="be 00,f8"; densitypossible=0; break; case 7: d->read_audio=scsi_read_mmc3; rs="be 04,f8"; densitypossible=0; break; case 8: d->read_audio=scsi_read_msf; rs="b9 00,10"; densitypossible=0; break; case 9: d->read_audio=scsi_read_msf2; rs="b9 00,f8"; densitypossible=0; break; case 10: d->read_audio=scsi_read_msf3; rs="b9 04,f8"; densitypossible=0; break; case 11: d->read_audio=scsi_read_D4_10; rs="d4(10)0x"; break; case 12: d->read_audio=scsi_read_D4_12; rs="d4(12)0x"; break; case 13: d->read_audio=scsi_read_D5; rs="d5 0x,00"; break; case 14: d->read_audio=scsi_read_D8; rs="d8 0x,00"; break; } for(i=0;i<5;i++){ switch(i){ case 0: d->density=0; d->enable_cdda=Dummy; es="none "; if(!densitypossible)i=5; /* short circuit MMC style commands */ break; case 1: d->density=0; d->enable_cdda=scsi_enable_cdda; es="yes/0x00"; break; case 2: d->density=0x04; d->enable_cdda=scsi_enable_cdda; es="yes/0x04"; break; case 3: d->density=0x82; d->enable_cdda=scsi_enable_cdda; es="yes/0x82"; break; case 4: d->density=0x81; d->enable_cdda=scsi_enable_cdda; es="yes/0x81"; break; } cdmessage(d,"\ttest -> density: ["); cdmessage(d,es); cdmessage(d,"] command: ["); cdmessage(d,rs); cdmessage(d,"]\n"); { int densityflag=0; int rejectflag=0; int zeroflag=0; int lengthflag=0; if(d->enable_cdda(d,1)==0){ for(k=1;k<=d->tracks;k++){ if(cdda_track_audiop(d,k)==1){ long firstsector=cdda_track_firstsector(d,k); long lastsector=cdda_track_lastsector(d,k); long sector=(firstsector+lastsector)>>1; if(d->read_audio(d,buff,sector,1)>0){ if((lengthflag=count_2352_bytes(d))==2352){ if(verify_nonzero(d)){ cdmessage(d,"\t\tCommand set FOUND!\n"); free(buff); d->enable_cdda(d,0); return(0); }else{ zeroflag++; } } }else{ rejectflag++; break; } } } d->enable_cdda(d,0); }else{ densityflag++; } if(densityflag) cdmessage(d,"\t\tDrive rejected density set\n"); if(rejectflag){ char buffer[256]; sprintf(buffer,"\t\tDrive rejected read command packet(s)\n"); cdmessage(d,buffer); } if(lengthflag>0 && lengthflag<2352){ char buffer[256]; sprintf(buffer,"\t\tDrive returned at least one packet, but with\n" "\t\tincorrect size (%d)\n",lengthflag); cdmessage(d,buffer); } if(zeroflag){ char buffer[256]; sprintf(buffer,"\t\tDrive returned %d packet(s), but contents\n" "\t\twere entirely zero\n",zeroflag); cdmessage(d,buffer); } } } } /* D'oh. */ d->density=density; d->read_audio=readcommand; d->enable_cdda=enablecommand; cdmessage(d,"\tUnable to find any suitable command set from probe;\n" "\tdrive probably not CDDA capable.\n"); cderror(d,"006: Could not read any data from drive\n"); } free(buff); return(-6); } static void check_cache(cdrom_drive *d){ long i; if(!(d->read_audio==scsi_read_mmc || d->read_audio==scsi_read_mmc2 || d->read_audio==scsi_read_mmc3 || d->read_audio==scsi_read_mmcB || d->read_audio==scsi_read_mmc2B || d->read_audio==scsi_read_mmc3B)){ cdmessage(d,"This command set may use a Force Unit Access bit."); cdmessage(d,"\nChecking drive for FUA bit support...\n"); d->enable_cdda(d,1); d->fua=1; for(i=1;i<=d->tracks;i++){ if(cdda_track_audiop(d,i)==1){ long firstsector=cdda_track_firstsector(d,i); long lastsector=cdda_track_lastsector(d,i); long sector=(firstsector+lastsector)>>1; if(d->read_audio(d,NULL,sector,1)>0){ cdmessage(d,"\tDrive accepted FUA bit.\n"); d->enable_cdda(d,0); return; } } } d->fua=0; cdmessage(d,"\tDrive rejected FUA bit.\n"); /* we only use the FUA bit as a possible extra layer of redundancy; too many drives accept it, but still don't force unit access. Still use the old cachebusting algo. */ return; } } static int check_atapi(cdrom_drive *d){ int atapiret=-1; int fd = d->cdda_fd; /* check the device we'll actually be using to read */ cdmessage(d,"\nChecking for SCSI emulation...\n"); if (ioctl(fd,SG_EMULATED_HOST,&atapiret)){ cderror(d,"\tSG_EMULATED_HOST ioctl() failed!\n"); return(-1); } else { if(atapiret==1){ if(d->interface == SGIO_SCSI){ cdmessage(d,"\tDrive is ATAPI (using SG_IO host adaptor emulation)\n"); }else if(d->interface == SGIO_SCSI_BUGGY1){ cdmessage(d,"\tDrive is ATAPI (using SG_IO host adaptor emulation with workarounds)\n"); }else{ cdmessage(d,"\tDrive is ATAPI (using SCSI host adaptor emulation)\n"); /* Disable kernel SCSI command translation layer for access through sg */ if (ioctl(fd,SG_SET_TRANSFORM,0)) cderror(d,"\tCouldn't disable kernel command translation layer\n"); } d->is_atapi=1; }else{ cdmessage(d,"\tDrive is SCSI\n"); d->is_atapi=0; } return(d->is_atapi); } } static int check_mmc(cdrom_drive *d){ unsigned char *b; cdmessage(d,"\nChecking for MMC style command set...\n"); d->is_mmc=0; if(mode_sense(d,22,0x2A)==0){ b=d->private->sg_buffer; b+=b[3]+4; if((b[0]&0x3F)==0x2A){ /* MMC style drive! */ d->is_mmc=1; if(b[1]>=4){ if(b[5]&0x1){ cdmessage(d,"\tDrive is MMC style\n"); return(1); }else{ cdmessage(d,"\tDrive is MMC, but reports CDDA incapable.\n"); cdmessage(d,"\tIt will likely not be able to read audio data.\n"); return(1); } } } } cdmessage(d,"\tDrive does not have MMC CDDA support\n"); return(0); } static void check_exceptions(cdrom_drive *d,exception *list){ int i=0; while(list[i].model){ if(!strncmp(list[i].model,d->drive_model,strlen(list[i].model))){ if(list[i].density)d->density=list[i].density; if(list[i].enable)d->enable_cdda=list[i].enable; if(list[i].read)d->read_audio=list[i].read; if(list[i].bigendianp!=-1)d->bigendianp=list[i].bigendianp; return; } i++; } } /* request vendor brand and model */ unsigned char *scsi_inquiry(cdrom_drive *d){ unsigned char sense[SG_MAX_SENSE]; unsigned char cmd[6]={ 0x12,0,0,0,56,0 }; if(handle_scsi_cmd(d,cmd,6, 0, 56,'\377',1,sense)) { cderror(d,"008: Unable to identify CDROM model\n"); return(NULL); } return (d->private->sg_buffer); } int scsi_init_drive(cdrom_drive *d){ int ret; check_atapi(d); check_mmc(d); /* generic Sony type defaults; specialize from here */ d->density = 0x0; d->enable_cdda = Dummy; d->read_audio = scsi_read_D8; d->fua=0x0; if(d->is_atapi)d->lun=0; /* it should already be; just to make sure */ if(d->is_mmc){ d->read_audio = scsi_read_mmc2B; d->bigendianp=0; check_exceptions(d,mmc_list); }else{ if(d->is_atapi){ /* Not MMC maybe still uses 0xbe */ d->read_audio = scsi_read_mmc2B; d->bigendianp=0; check_exceptions(d,atapi_list); }else{ check_exceptions(d,scsi_list); } } if(!d->is_atapi)set_sectorsize(d,2048); /* we really do want the sector size at 2048 to begin.*/ d->enable_cdda(d,0); d->read_toc = (!memcmp(d->drive_model, "IMS", 3) && !d->is_atapi) ? scsi_read_toc2 : scsi_read_toc; d->set_speed = scsi_set_speed; if(!d->is_atapi){ unsigned sector_size= get_orig_sectorsize(d); if(sector_size<2048 && set_sectorsize(d,2048)) d->adjust_ssize = 2048 / sector_size; else d->adjust_ssize = 1; }else d->adjust_ssize = 1; d->tracks=d->read_toc(d); if(d->tracks<1) return(d->tracks); tweak_SG_buffer(d); d->opened=1; if((ret=verify_read_command(d)))return(ret); check_cache(d); d->error_retry=1; d->private->sg_hd=realloc(d->private->sg_hd,d->nsectors*CD_FRAMESIZE_RAW + SG_OFF + 128); d->private->sg_buffer=((unsigned char *)d->private->sg_hd)+SG_OFF; d->report_all=1; return(0); } cdparanoia-3.10.2+debian/interface/common_interface.h0000644000175000017500000000101511046366435022014 0ustar danieldaniel/****************************************************************** * CopyPolicy: GNU Lesser General Public License 2.1 applies * Copyright (C) 1998-2008 Monty xiphmont@mit.edu * ******************************************************************/ #ifndef _cdda_common_interface_h_ #define _cdda_common_interface_h_ #include "low_interface.h" extern int ioctl_ping_cdrom(int fd); extern char *atapi_drive_info(int fd); extern int data_bigendianp(cdrom_drive *d); extern int FixupTOC(cdrom_drive *d,int tracks); #endif cdparanoia-3.10.2+debian/interface/cdda_interface.h0000644000175000017500000001345311062173150021414 0ustar danieldaniel/****************************************************************** * CopyPolicy: GNU Lesser General Public License 2.1 applies * Copyright (C) 2001-2008 Xiph.org * Original version by Heiko Eissfeldt heiko@escape.colossus.de * * Toplevel interface header; applications include this * ******************************************************************/ #ifndef _cdda_interface_h_ #define _cdda_interface_h_ #ifndef CD_FRAMESIZE #define CD_FRAMESIZE 2048 #endif #ifndef CD_FRAMESIZE_RAW #define CD_FRAMESIZE_RAW 2352 #endif #define CD_FRAMESAMPLES (CD_FRAMESIZE_RAW / 4) #include #include #define MAXTRK 100 typedef struct TOC { /* structure of table of contents */ unsigned char bFlags; unsigned char bTrack; int32_t dwStartSector; } TOC; /* interface types */ #define GENERIC_SCSI 0 #define COOKED_IOCTL 1 #define TEST_INTERFACE 2 #define SGIO_SCSI 3 #define SGIO_SCSI_BUGGY1 4 #define CDDA_MESSAGE_FORGETIT 0 #define CDDA_MESSAGE_PRINTIT 1 #define CDDA_MESSAGE_LOGIT 2 /* cdrom access function pointer */ typedef struct cdda_private_data cdda_private_data_t; typedef struct cdrom_drive{ int opened; /* This struct may just represent a candidate for opening */ char *cdda_device_name; char *ioctl_device_name; int cdda_fd; int ioctl_fd; char *drive_model; int drive_type; int interface; int bigendianp; int nsectors; int cd_extra; int tracks; TOC disc_toc[MAXTRK]; long audio_first_sector; long audio_last_sector; int errordest; int messagedest; char *errorbuf; char *messagebuf; /* functions specific to particular drives/interfaces */ int (*enable_cdda) (struct cdrom_drive *d, int onoff); int (*read_toc) (struct cdrom_drive *d); long (*read_audio) (struct cdrom_drive *d, void *p, long begin, long sectors); int (*set_speed) (struct cdrom_drive *d, int speed); int error_retry; int report_all; int is_atapi; int is_mmc; cdda_private_data_t *private; void *reserved; unsigned char inqbytes[4]; /* Scsi parameters and state */ unsigned char density; unsigned char orgdens; unsigned int orgsize; long bigbuff; int adjust_ssize; int fua; int lun; sigset_t sigset; } cdrom_drive; #define IS_AUDIO(d,i) (!(d->disc_toc[i].bFlags & 0x04)) /******** Identification/autosense functions */ extern cdrom_drive *cdda_find_a_cdrom(int messagedest, char **message); extern cdrom_drive *cdda_identify(const char *device, int messagedest, char **message); extern cdrom_drive *cdda_identify_cooked(const char *device,int messagedest, char **message); extern cdrom_drive *cdda_identify_scsi(const char *generic_device, const char *ioctl_device, int messagedest, char **message); #ifdef CDDA_TEST extern cdrom_drive *cdda_identify_test(const char *filename, int messagedest, char **message); #endif /******** Drive oriented functions */ extern char *cdda_version(); extern int cdda_speed_set(cdrom_drive *d, int speed); extern void cdda_verbose_set(cdrom_drive *d,int err_action, int mes_action); extern char *cdda_messages(cdrom_drive *d); extern char *cdda_errors(cdrom_drive *d); extern int cdda_close(cdrom_drive *d); extern int cdda_open(cdrom_drive *d); extern long cdda_read(cdrom_drive *d, void *buffer, long beginsector, long sectors); extern long cdda_read_timed(cdrom_drive *d, void *buffer, long beginsector, long sectors, int *milliseconds); extern long cdda_track_firstsector(cdrom_drive *d,int track); extern long cdda_track_lastsector(cdrom_drive *d,int track); extern long cdda_tracks(cdrom_drive *d); extern int cdda_sector_gettrack(cdrom_drive *d,long sector); extern int cdda_track_channels(cdrom_drive *d,int track); extern int cdda_track_audiop(cdrom_drive *d,int track); extern int cdda_track_copyp(cdrom_drive *d,int track); extern int cdda_track_preemp(cdrom_drive *d,int track); extern long cdda_disc_firstsector(cdrom_drive *d); extern long cdda_disc_lastsector(cdrom_drive *d); /* transport errors: */ #define TR_OK 0 #define TR_EWRITE 1 /* Error writing packet command (transport) */ #define TR_EREAD 2 /* Error reading packet data (transport) */ #define TR_UNDERRUN 3 /* Read underrun */ #define TR_OVERRUN 4 /* Read overrun */ #define TR_ILLEGAL 5 /* Illegal/rejected request */ #define TR_MEDIUM 6 /* Medium error */ #define TR_BUSY 7 /* Device busy */ #define TR_NOTREADY 8 /* Device not ready */ #define TR_FAULT 9 /* Devive failure */ #define TR_UNKNOWN 10 /* Unspecified error */ #define TR_STREAMING 11 /* loss of streaming */ static char *strerror_tr[]={ "Success", "Error writing packet command to device", "Error reading command from device", "SCSI packet data underrun (too little data)", "SCSI packet data overrun (too much data)", "Illegal SCSI request (rejected by target)", "Medium reading data from medium", "Device busy", "Device not ready", "Target hardware fault", "Unspecified error", "Drive lost streaming" }; /* Errors returned by lib: 001: Unable to set CDROM to read audio mode 002: Unable to read table of contents lead-out 003: CDROM reporting illegal number of tracks 004: Unable to read table of contents header 005: Unable to read table of contents entry 006: Could not read any data from drive 007: Unknown, unrecoverable error reading data 008: Unable to identify CDROM model 009: CDROM reporting illegal table of contents 010: Unaddressable sector 100: Interface not supported 101: Drive is neither a CDROM nor a WORM device 102: Permision denied on cdrom (ioctl) device 103: Permision denied on cdrom (data) device 300: Kernel memory error 400: Device not open 401: Invalid track number 402: Track not audio data 403: No audio tracks on disc 404: No medium present 405: Option not supported by drive */ #endif cdparanoia-3.10.2+debian/interface/utils.h0000644000175000017500000001044011051034604017630 0ustar danieldaniel#include #include #include #include /* I wonder how many alignment issues this is gonna trip in the future... it shouldn't trip any... I guess we'll find out :) */ static inline int bigendianp(void){ int test=1; char *hack=(char *)(&test); if(hack[0])return(0); return(1); } static inline int32_t swap32(int32_t x){ return((((u_int32_t)x & 0x000000ffU) << 24) | (((u_int32_t)x & 0x0000ff00U) << 8) | (((u_int32_t)x & 0x00ff0000U) >> 8) | (((u_int32_t)x & 0xff000000U) >> 24)); } static inline int16_t swap16(int16_t x){ return((((u_int16_t)x & 0x00ffU) << 8) | (((u_int16_t)x & 0xff00U) >> 8)); } #if BYTE_ORDER == LITTLE_ENDIAN static inline int32_t be32_to_cpu(int32_t x){ return(swap32(x)); } static inline int16_t be16_to_cpu(int16_t x){ return(swap16(x)); } static inline int32_t le32_to_cpu(int32_t x){ return(x); } static inline int16_t le16_to_cpu(int16_t x){ return(x); } #else static inline int32_t be32_to_cpu(int32_t x){ return(x); } static inline int16_t be16_to_cpu(int16_t x){ return(x); } static inline int32_t le32_to_cpu(int32_t x){ return(swap32(x)); } static inline int16_t le16_to_cpu(int16_t x){ return(swap16(x)); } #endif static inline int32_t cpu_to_be32(int32_t x){ return(be32_to_cpu(x)); } static inline int32_t cpu_to_le32(int32_t x){ return(le32_to_cpu(x)); } static inline int16_t cpu_to_be16(int16_t x){ return(be16_to_cpu(x)); } static inline int16_t cpu_to_le16(int16_t x){ return(le16_to_cpu(x)); } static inline char *copystring(const char *s){ if(s){ char *ret=malloc((strlen(s)+9)*sizeof(char)); /* +9 to get around a linux libc 5 bug. below too */ strcpy(ret,s); return(ret); } return(NULL); } static inline char *catstring(char *buff,const char *s){ if(s){ if(buff) buff=realloc(buff,strlen(buff)+strlen(s)+9); else buff=calloc(strlen(s)+9,1); strcat(buff,s); } return(buff); } static void cderror(cdrom_drive *d,const char *s){ if(s && d){ switch(d->errordest){ case CDDA_MESSAGE_PRINTIT: write(STDERR_FILENO,s,strlen(s)); break; case CDDA_MESSAGE_LOGIT: d->errorbuf=catstring(d->errorbuf,s); break; case CDDA_MESSAGE_FORGETIT: default: break; } } } static void cdmessage(cdrom_drive *d,const char *s){ if(s && d){ switch(d->messagedest){ case CDDA_MESSAGE_PRINTIT: write(STDERR_FILENO,s,strlen(s)); break; case CDDA_MESSAGE_LOGIT: d->messagebuf=catstring(d->messagebuf,s); break; case CDDA_MESSAGE_FORGETIT: default: break; } } } static void idperror(int messagedest,char **messages,const char *f, const char *s){ char *buffer; int malloced=0; if(!f) buffer=(char *)s; else if(!s) buffer=(char *)f; else{ buffer=malloc(strlen(f)+strlen(s)+9); sprintf(buffer,f,s); malloced=1; } if(buffer){ switch(messagedest){ case CDDA_MESSAGE_PRINTIT: write(STDERR_FILENO,buffer,strlen(buffer)); if(errno){ write(STDERR_FILENO,": ",2); write(STDERR_FILENO,strerror(errno),strlen(strerror(errno))); write(STDERR_FILENO,"\n",1); } break; case CDDA_MESSAGE_LOGIT: if(messages){ *messages=catstring(*messages,buffer); if(errno){ *messages=catstring(*messages,": "); *messages=catstring(*messages,strerror(errno)); *messages=catstring(*messages,"\n"); } } break; case CDDA_MESSAGE_FORGETIT: default: break; } } if(malloced)free(buffer); } static void idmessage(int messagedest,char **messages,const char *f, const char *s){ char *buffer; int malloced=0; if(!f) buffer=(char *)s; else if(!s) buffer=(char *)f; else{ buffer=malloc(strlen(f)+strlen(s)+10); sprintf(buffer,f,s); strcat(buffer,"\n"); malloced=1; } if(buffer){ switch(messagedest){ case CDDA_MESSAGE_PRINTIT: write(STDERR_FILENO,buffer,strlen(buffer)); if(!malloced)write(STDERR_FILENO,"\n",1); break; case CDDA_MESSAGE_LOGIT: if(messages){ *messages=catstring(*messages,buffer); if(!malloced)*messages=catstring(*messages,"\n"); } break; case CDDA_MESSAGE_FORGETIT: default: break; } } if(malloced)free(buffer); } cdparanoia-3.10.2+debian/interface/scan_devices.c0000644000175000017500000005424011054751412021125 0ustar danieldaniel/****************************************************************** * CopyPolicy: GNU Lesser General Public License 2.1 applies * Copyright (C) 1998-2008 Monty xiphmont@mit.edu * * Autoscan for or verify presence of a cdrom device * ******************************************************************/ #define _GNU_SOURCE /* get cuserid */ #define _USE_XOPEN /* get cuserid */ #include #include #include #include #include #include #include #include #include #include "cdda_interface.h" #include "low_interface.h" #include "common_interface.h" #include "utils.h" #define MAX_DEV_LEN 20 /* Safe because strings only come from below */ /* must be absolute paths! */ static char *scsi_cdrom_prefixes[]={ "/dev/scd", "/dev/sr", NULL}; static char *scsi_generic_prefixes[]={ "/dev/sg", NULL}; static char *devfs_scsi_test="/dev/scsi/"; static char *devfs_scsi_cd="cd"; static char *devfs_scsi_generic="generic"; static char *cdrom_devices[]={ "/dev/cdrom", "/dev/cdroms/cdrom?", "/dev/hd?", "/dev/sg?", "/dev/cdu31a", "/dev/cdu535", "/dev/sbpcd", "/dev/sbpcd?", "/dev/sonycd", "/dev/mcd", "/dev/sjcd", /* "/dev/aztcd", timeout is too long */ "/dev/cm206cd", "/dev/gscd", "/dev/optcd",NULL}; /* Functions here look for a cdrom drive; full init of a drive type happens in interface.c */ cdrom_drive *cdda_find_a_cdrom(int messagedest,char **messages){ /* Brute force... */ int i=0; cdrom_drive *d; while(cdrom_devices[i]!=NULL){ /* is it a name or a pattern? */ char *pos; if((pos=strchr(cdrom_devices[i],'?'))){ int j; /* try first eight of each device */ for(j=0;j<4;j++){ char *buffer=copystring(cdrom_devices[i]); /* number, then letter */ buffer[pos-(cdrom_devices[i])]=j+48; if((d=cdda_identify(buffer,messagedest,messages))) return(d); idmessage(messagedest,messages,"",NULL); buffer[pos-(cdrom_devices[i])]=j+97; if((d=cdda_identify(buffer,messagedest,messages))) return(d); idmessage(messagedest,messages,"",NULL); } }else{ /* Name. Go for it. */ if((d=cdda_identify(cdrom_devices[i],messagedest,messages))) return(d); idmessage(messagedest,messages,"",NULL); } i++; } idmessage(messagedest,messages, "\n\nNo cdrom drives accessible to %s found.\n", cuserid(NULL)); return(NULL); } cdrom_drive *cdda_identify(const char *device, int messagedest,char **messages){ struct stat st; cdrom_drive *d=NULL; idmessage(messagedest,messages,"Checking %s for cdrom...",device); if(stat(device,&st)){ idperror(messagedest,messages,"\tCould not stat %s",device); return(NULL); } #ifndef CDDA_TEST if (!S_ISCHR(st.st_mode) && !S_ISBLK(st.st_mode)){ idmessage(messagedest,messages,"\t%s is not a block or character device",device); return(NULL); } #endif /* an IDE device may have scsi-ide support, SG_IO support and cooked support. Prefer the SCSI variants, they give the most control */ d=cdda_identify_scsi(NULL,device,messagedest,messages); if(!d)d=cdda_identify_cooked(device,messagedest,messages); #ifdef CDDA_TEST if(!d)d=cdda_identify_test(device,messagedest,messages); #endif return(d); } char *test_resolve_symlink(const char *file,int messagedest,char **messages){ char resolved[PATH_MAX]; struct stat st; if(lstat(file,&st)){ idperror(messagedest,messages,"\t\tCould not stat %s",file); return(NULL); } if(realpath(file,resolved)) return(strdup(resolved)); idperror(messagedest,messages,"\t\tCould not resolve symlink %s",file); return(NULL); } cdrom_drive *cdda_identify_cooked(const char *dev, int messagedest, char **messages){ cdrom_drive *d=NULL; struct stat st; int fd=-1, i; int type; char *description=NULL; char *device; idmessage(messagedest,messages,"\tTesting %s for cooked ioctl() interface",dev); device=test_resolve_symlink(dev,messagedest,messages); if(device==NULL)return(NULL); if(stat(device,&st)){ idperror(messagedest,messages,"\t\tCould not stat %s",device); free(device); return(NULL); } if (!S_ISCHR(st.st_mode) && !S_ISBLK(st.st_mode)){ idmessage(messagedest,messages,"\t\t%s is not a block or character device",device); free(device); return(NULL); } type=(int)(st.st_rdev>>8); switch (type) { case IDE0_MAJOR: case IDE1_MAJOR: case IDE2_MAJOR: case IDE3_MAJOR: /* Yay, ATAPI... */ /* Ping for CDROM-ness */ fd=open(device,O_RDONLY|O_NONBLOCK); if(fd==-1){ idperror(messagedest,messages,"\t\tUnable to open %s",device); free(device); return(NULL); } if(ioctl_ping_cdrom(fd)){ idmessage(messagedest,messages,"\t\tDevice %s is not a CDROM",device); close(fd); free(device); return(NULL); } { char *temp=atapi_drive_info(fd); description=catstring(NULL,"ATAPI compatible "); description=catstring(description,temp); free(temp); } break; case CDU31A_CDROM_MAJOR: /* major indicates this is a cdrom; no ping necessary. */ description=copystring("Sony CDU31A or compatible"); break; case CDU535_CDROM_MAJOR: /* major indicates this is a cdrom; no ping necessary. */ description=copystring("Sony CDU535 or compatible"); break; case MATSUSHITA_CDROM_MAJOR: case MATSUSHITA_CDROM2_MAJOR: case MATSUSHITA_CDROM3_MAJOR: case MATSUSHITA_CDROM4_MAJOR: /* major indicates this is a cdrom; no ping necessary. */ description=copystring("non-ATAPI IDE-style Matsushita/Panasonic CR-5xx or compatible"); break; case SANYO_CDROM_MAJOR: description=copystring("Sanyo proprietary or compatible: NOT CDDA CAPABLE"); break; case MITSUMI_CDROM_MAJOR: case MITSUMI_X_CDROM_MAJOR: description=copystring("Mitsumi proprietary or compatible: NOT CDDA CAPABLE"); break; case OPTICS_CDROM_MAJOR: description=copystring("Optics Dolphin or compatible: NOT CDDA CAPABLE"); break; case AZTECH_CDROM_MAJOR: description=copystring("Aztech proprietary or compatible: NOT CDDA CAPABLE"); break; case GOLDSTAR_CDROM_MAJOR: description=copystring("Goldstar proprietary: NOT CDDA CAPABLE"); break; case CM206_CDROM_MAJOR: description=copystring("Philips/LMS CM206 proprietary: NOT CDDA CAPABLE"); break; case SCSI_CDROM_MAJOR: case SCSI_GENERIC_MAJOR: /* Nope nope nope */ idmessage(messagedest,messages,"\t\t%s is not a cooked ioctl CDROM.",device); free(device); return(NULL); default: /* What the hell is this? */ idmessage(messagedest,messages,"\t\t%s is not a cooked ioctl CDROM.",device); free(device); return(NULL); } /* Minimum init */ d=calloc(1,sizeof(cdrom_drive)); d->cdda_device_name=device; d->ioctl_device_name=copystring(device); d->drive_model=description; d->drive_type=type; d->cdda_fd=fd; d->ioctl_fd=fd; d->interface=COOKED_IOCTL; d->bigendianp=-1; /* We don't know yet... */ d->nsectors=-1; d->private=calloc(1,sizeof(*d->private)); { /* goddamnit */ struct timespec tv; d->private->clock=(clock_gettime(CLOCK_MONOTONIC,&tv)<0?CLOCK_REALTIME:CLOCK_MONOTONIC); } idmessage(messagedest,messages,"\t\tCDROM sensed: %s\n",description); return(d); } struct sg_id { long l1; /* target | lun << 8 | channel << 16 | low_ino << 24 */ long l2; /* Unique id */ } sg_id; typedef struct scsiid{ int bus; int id; int lun; } scsiid; /* Even *this* isn't as simple as it bloody well should be :-P */ /* SG has an easy interface, but SCSI overall does not */ static int get_scsi_id(int fd, scsiid *id){ struct sg_id argid; int busarg; /* get the host/id/lun */ if(fd==-1)return(-1); if(ioctl(fd,SCSI_IOCTL_GET_IDLUN,&argid))return(-1); id->bus=argid.l2; /* for now */ id->id=argid.l1&0xff; id->lun=(argid.l1>>8)&0xff; if(ioctl(fd,SCSI_IOCTL_GET_BUS_NUMBER,&busarg)==0) id->bus=busarg; return(0); } /* slightly wasteful, but a clean abstraction */ static char *scsi_match(const char *device,char **prefixes, char *devfs_test, char *devfs_other, char *prompt,int messagedest,char **messages){ int dev=open(device,O_RDONLY|O_NONBLOCK); scsiid a,b; int i,j; char buffer[200]; /* if we're running under /devfs, build the device name from the device we already have */ if(!strncmp(device,devfs_test,strlen(devfs_test))){ char *pos; strcpy(buffer,device); pos=strrchr(buffer,'/'); if(pos){ int matchf; sprintf(pos,"/%s",devfs_other); matchf=open(buffer,O_RDONLY|O_NONBLOCK); for (i = 0; (i<10) && (matchf==-1); i++) { fprintf(stderr, "Error trying to open %s exclusively (%s). retrying in 1 seconds.\n", buffer, strerror(errno)); usleep(1000000 + 100000.0 * rand()/(RAND_MAX+1.0)); matchf = open(buffer,O_RDONLY|O_NONBLOCK); } if(matchf!=-1){ close(matchf); close(dev); return(strdup(buffer)); } } } /* get the host/id/lun */ if(dev==-1){ idperror(messagedest,messages,"\t\tCould not access device %s", device); goto matchfail; } if(get_scsi_id(dev,&a)){ idperror(messagedest,messages,"\t\tDevice %s could not perform ioctl()", device); goto matchfail; } /* go through most likely /dev nodes for a match */ for(i=0;i<25;i++){ for(j=0;j<2;j++){ int pattern=0; int matchf, k; while(prefixes[pattern]!=NULL){ switch(j){ case 0: /* number */ sprintf(buffer,"%s%d",prefixes[pattern],i); break; case 1: /* number */ sprintf(buffer,"%s%c",prefixes[pattern],i+'a'); break; } matchf=open(buffer,O_RDONLY|O_NONBLOCK); for (k = 0; (k<10) && (matchf==-1); k++) { fprintf(stderr, "Error trying to open %s exclusively (%s). retrying in 1 second.\n", buffer, strerror(errno)); usleep(1000000 + 100000.0 * rand()/(RAND_MAX+1.0)); matchf=open(buffer,O_RDONLY|O_NONBLOCK); } if(matchf!=-1){ if(get_scsi_id(matchf,&b)==0){ if(a.bus==b.bus && a.id==b.id && a.lun==b.lun){ close(matchf); close(dev); return(strdup(buffer)); } } close(matchf); } pattern++; } } } idmessage(messagedest,messages,prompt,device); matchfail: if(dev!=-1)close(dev); return(NULL); } void strscat(char *a,char *b,int n){ int i; for(i=n;i>0;i--) if(b[i-1]>' ')break; strncat(a,b,i); strcat(a," "); } /* At this point, we're going to punt compatability before SG2, and allow only SG2 and SG3 */ static int verify_SG_version(cdrom_drive *d,int messagedest, char **messages){ /* are we using the new SG driver by Doug Gilbert? If not, punt */ int version,major,minor; char buffer[256]; idmessage(messagedest,messages, "\nFound an accessible SCSI CDROM drive." "\nLooking at revision of the SG interface in use...",""); if(ioctl(d->cdda_fd,SG_GET_VERSION_NUM,&version)){ /* Up, guess not. */ idmessage(messagedest,messages, "\tOOPS! Old 2.0/early 2.1/early 2.2.x (non-ac patch) style " "SG.\n\tCdparanoia no longer supports the old interface.\n",""); return(0); } major=version/10000; version-=major*10000; minor=version/100; version-=minor*100; sprintf(buffer,"\tSG interface version %d.%d.%d; OK.", major,minor,version); idmessage(messagedest,messages,buffer,""); return(major); } int check_sgio(const char *device, int messagedest, char **messages){ int fd; struct sg_io_hdr hdr; if (!device) return 0; /* we don't really care what type of device it is -- if it can do * SG_IO, then we'll put it through the normal mmc/atapi/etc tests * later, but it's good enough for now. */ fd = open(device, O_RDWR|O_NONBLOCK); if (fd < 0){ idperror(messagedest,messages, "\t\tCould not access device %s to test for SG_IO support",device); return 0; } memset(&hdr, 0, sizeof (struct sg_io_hdr)); /* First try with interface_id = 'A'; for all but the sg case, * that'll get us a -EINVAL if it supports SG_IO, and some other * error for all other cases. */ hdr.interface_id = 'A'; if (ioctl(fd, SG_IO, &hdr)) { switch (errno) { case EINVAL: /* sr and ata give us EINVAL when SG_IO is * supported but interface_id is bad. */ case ENOSYS: /* sg gives us ENOSYS when SG_IO is supported but * interface_id is bad. IMHO, this is wrong and * needs fixing in the kernel. */ close(fd); return 1; default: /* everything else gives ENOTTY, I think. I'm just * going to be paranoid and reject everything else. */ close(fd); return 0; } } /* if we get here, something is dreadfuly wrong. ioctl(fd,SG_IO,&hdr) * handled SG_IO, but took hdr.interface_id = 'A' as valid, and an empty * command as good. Don't trust it. */ close(fd); return 0; } /* scanning is always done by specifying a device name in specialized_device; generic_device is only filled when the generic device force option is used, and in that case, use of SG (not SGIO) should indeed be forced */ cdrom_drive *cdda_identify_scsi(const char *generic_device, const char *specialized_device, int messagedest, char **messages){ cdrom_drive *d=NULL; struct stat i_st; struct stat g_st; int use_sgio=1; int i_fd=-1, i; int g_fd=-1; int version; int type; char *p; if(generic_device) idmessage(messagedest,messages,"\tTesting %s for SCSI/MMC interface", generic_device); else if(specialized_device) idmessage(messagedest,messages,"\tTesting %s for SCSI/MMC interface", specialized_device); if(generic_device){ use_sgio = 0; idmessage(messagedest,messages,"\t\tgeneric device forced; not testing for SG_IO interface", generic_device); if(stat(generic_device,&g_st)){ idperror(messagedest,messages,"\t\tCould not access device %s", generic_device); return(NULL); } if((int)(g_st.st_rdev>>8)!=SCSI_GENERIC_MAJOR){ idmessage(messagedest,messages,"\t\t%s is not a generic SCSI device", generic_device); return(NULL); } } if(specialized_device){ if(stat(specialized_device,&i_st)){ idperror(messagedest,messages,"\t\tCould not access device %s", specialized_device); return(NULL); } } /* we need to resolve any symlinks for the lookup code to work */ if(generic_device){ generic_device=test_resolve_symlink(generic_device,messagedest,messages); if(generic_device==NULL)goto cdda_identify_scsi_fail; } if(specialized_device){ specialized_device=test_resolve_symlink(specialized_device,messagedest,messages); if(specialized_device==NULL)goto cdda_identify_scsi_fail; } /* sgio is always preferred if it's there, unless user has forced the generic scsi device name */ if(use_sgio){ if(check_sgio(specialized_device,messagedest,messages)){ idmessage(messagedest,messages,"\t\tSG_IO device: %s",specialized_device); }else{ idmessage(messagedest,messages,"\t\tno SG_IO support for device: %s",specialized_device); use_sgio=0; } } if(!use_sgio){ /* was a generic device passed in as the specialized device name? */ if(specialized_device){ if((int)(i_st.st_rdev>>8)==SCSI_GENERIC_MAJOR){ char *temp=(char *)generic_device; generic_device=specialized_device; specialized_device=temp; } if(!generic_device || !specialized_device){ if(generic_device){ specialized_device= scsi_match(generic_device,scsi_cdrom_prefixes, devfs_scsi_test,devfs_scsi_cd, "\t\tNo cdrom device found to match generic device %s", messagedest,messages); }else{ generic_device= scsi_match(specialized_device,scsi_generic_prefixes, devfs_scsi_test,devfs_scsi_generic, "\t\tNo generic SCSI device found to match CDROM device %s", messagedest,messages); if(!generic_device) goto cdda_identify_scsi_fail; } } } idmessage(messagedest,messages,"\t\tgeneric device: %s",generic_device); idmessage(messagedest,messages,"\t\tioctl device: %s",(specialized_device? specialized_device: "not found")); if(specialized_device){ if(stat(specialized_device,&i_st)){ idperror(messagedest,messages,"\t\tCould not access cdrom device " "%s",specialized_device); goto cdda_identify_scsi_fail; } } if(stat(generic_device,&g_st)){ idperror(messagedest,messages,"\t\tCould not access generic SCSI device " "%s",generic_device); goto cdda_identify_scsi_fail; } } if(specialized_device) { if(use_sgio) i_fd=open(specialized_device,O_RDWR|O_NONBLOCK); else i_fd=open(specialized_device,O_RDONLY|O_NONBLOCK); } if(generic_device) g_fd=open(generic_device,O_RDWR); if(specialized_device && i_fd==-1){ idperror(messagedest,messages,"\t\tCould not open cdrom device " "%s (continuing)",specialized_device); goto cdda_identify_scsi_fail; } if(generic_device && g_fd==-1){ idperror(messagedest,messages,"\t\tCould not open generic SCSI device " "%s",generic_device); goto cdda_identify_scsi_fail; } if(i_fd!=-1){ type=(int)(i_st.st_rdev>>8); if(!use_sgio){ if(type==SCSI_CDROM_MAJOR){ if (!S_ISBLK(i_st.st_mode)) { idmessage(messagedest,messages,"\t\tSCSI CDROM device %s not a " "block device",specialized_device); goto cdda_identify_scsi_fail; } }else{ idmessage(messagedest,messages,"\t\tSCSI CDROM device %s has wrong " "major number",specialized_device); goto cdda_identify_scsi_fail; } } } if(g_fd != -1){ if((int)(g_st.st_rdev>>8)==SCSI_GENERIC_MAJOR){ if (!S_ISCHR(g_st.st_mode)) { idmessage(messagedest,messages,"\t\tGeneric SCSI device %s not a " "char device",generic_device); goto cdda_identify_scsi_fail; } }else{ idmessage(messagedest,messages,"\t\tGeneric SCSI device %s has wrong " "major number",generic_device); goto cdda_identify_scsi_fail; } } d=calloc(1,sizeof(cdrom_drive)); d->drive_type=type; d->cdda_fd=g_fd; d->ioctl_fd=i_fd; d->bigendianp=-1; /* We don't know yet... */ d->nsectors=-1; d->messagedest = messagedest; d->private=calloc(1,sizeof(*d->private)); { /* goddamnit */ struct timespec tv; d->private->clock=(clock_gettime(CLOCK_MONOTONIC,&tv)<0?CLOCK_REALTIME:CLOCK_MONOTONIC); } if(use_sgio){ d->interface=SGIO_SCSI; d->private->sg_buffer=(unsigned char *)(d->private->sg_hd=malloc(MAX_BIG_BUFF_SIZE)); g_fd=d->cdda_fd=dup(d->ioctl_fd); }else{ version=verify_SG_version(d,messagedest,messages); switch(version){ case -1:case 0:case 1: d->interface=GENERIC_SCSI; goto cdda_identify_scsi_fail; case 2:case 3: d->interface=GENERIC_SCSI; break; } /* malloc our big buffer for scsi commands */ d->private->sg_hd=malloc(MAX_BIG_BUFF_SIZE); d->private->sg_buffer=((unsigned char *)d->private->sg_hd)+SG_OFF; } { /* get the lun */ scsiid lun; if(get_scsi_id(i_fd,&lun)) d->lun=0; /* a reasonable guess on a failed ioctl */ else d->lun=lun.lun; } p = (char *)scsi_inquiry(d); if (!p){ /* 2.6 kernels have a bug where the block layer implements SG_DXFER_TO_FROM_DEVICE as a write operation instead of read. I've submitted a kernel patch, but it will take a while to propogate. Work around it for now. --Monty */ if(d->interface == SGIO_SCSI){ /* test the inquiry with the workaround */ d->interface = SGIO_SCSI_BUGGY1; p = (char *)scsi_inquiry(d); if(p){ idmessage(messagedest,messages, "\t\tThis kernel's block layer has a buggy SG_DXFER_TO_FROM_DEVICE;\n\t\t activating workaround.\n",NULL); }else{ /* Failed for some reason other than the buggy ioctl(); set the interface type back */ d->interface = SGIO_SCSI; } } } if (!p){ idmessage(messagedest,messages, "\t\tInquiry command failed; unable to probe drive\n",NULL); goto cdda_identify_scsi_fail; } /* It would seem some TOSHIBA CDROMs gets things wrong */ if (p && !strncmp (p + 8, "TOSHIBA", 7) && !strncmp (p + 16, "CD-ROM", 6) && p[0] == TYPE_DISK) { p[0] = TYPE_ROM; p[1] |= 0x80; /* removable */ } if (*p != TYPE_ROM && *p != TYPE_WORM) { idmessage(messagedest,messages, "\t\tDrive is neither a CDROM nor a WORM device\n",NULL); goto cdda_identify_scsi_fail; } d->drive_model=calloc(36,1); memcpy(d->inqbytes,p,4); d->cdda_device_name=copystring(generic_device); d->ioctl_device_name=copystring(specialized_device); d->drive_model=calloc(36,1); strscat(d->drive_model,p+8,8); strscat(d->drive_model,p+16,16); strscat(d->drive_model,p+32,4); idmessage(messagedest,messages,"\nCDROM model sensed sensed: %s",d->drive_model); return(d); cdda_identify_scsi_fail: if(generic_device)free((char *)generic_device); if(specialized_device)free((char *)specialized_device); if(i_fd!=-1)close(i_fd); if(g_fd!=-1)close(g_fd); if(d){ if(d->private){ if(d->private->sg_hd)free(d->private->sg_hd); free(d->private); } free(d); } return(NULL); } #ifdef CDDA_TEST cdrom_drive *cdda_identify_test(const char *filename, int messagedest, char **messages){ cdrom_drive *d=NULL; struct stat st; int fd=-1,i; idmessage(messagedest,messages,"\tTesting %s for file/test interface", filename); if(stat(filename,&st)){ idperror(messagedest,messages,"\t\tCould not access file %s", filename); return(NULL); } if(!S_ISREG(st.st_mode)){ idmessage(messagedest,messages,"\t\t%s is not a regular file", filename); return(NULL); } fd=open(filename,O_RDONLY); if(fd==-1){ idperror(messagedest,messages,"\t\tCould not open file %s",filename); return(NULL); } d=calloc(1,sizeof(cdrom_drive)); d->cdda_device_name=copystring(filename); d->ioctl_device_name=copystring(filename); d->drive_type=-1; d->cdda_fd=fd; d->ioctl_fd=fd; d->interface=TEST_INTERFACE; d->bigendianp=-1; /* We don't know yet... */ d->nsectors=-1; d->private=calloc(1,sizeof(*d->private)); d->drive_model=copystring("File based test interface"); idmessage(messagedest,messages,"\t\tCDROM sensed: %s\n",d->drive_model); return(d); } #endif cdparanoia-3.10.2+debian/interface/smallft.h0000644000175000017500000000106211046366435020150 0ustar danieldaniel/****************************************************************** * CopyPolicy: GNU Lesser General Public License 2.1 applies * Copyright (C) 1998-2008 Monty xiphmont@mit.edu * * FFT implementation from OggSquish, minus cosine transforms. * Only convenience functions exposed * ******************************************************************/ extern void fft_forward(int n, float *buf, float *trigcache, int *sp); extern void fft_backward(int n, float *buf, float *trigcache, int *sp); extern void fft_i(int n, float **trigcache, int **splitcache); cdparanoia-3.10.2+debian/interface/Makefile.in0000644000175000017500000000315411053311426020372 0ustar danieldaniel# cdda_paranoia makefile.in ready to go for autoconf. # DO NOT EDIT BELOW! ########################################################## # (unless, of course, you know what you are doing :) ########################## VPATH=@srcdir@ srcdir=@srcdir@ @SET_MAKE@ FLAGS=@SBPCD_H@ @UCDROM_H@ @TYPESIZES@ @CFLAGS@ OPT=@OPT@ $(FLAGS) DEBUG=@DEBUG@ -DCDDA_TEST CC=@CC@ LD=@CC@ LDFLAGS=@LDFLAGS@ $(FLAGS) AR=@AR@ RANLIB=@RANLIB@ LIBS = -lm -lrt CPPFLAGS+=-D_REENTRANT OFILES = scan_devices.o common_interface.o cooked_interface.o interface.o\ scsi_interface.o smallft.o toc.o test_interface.o export VERSION all: lib slib debug: $(MAKE) libcdda_interface.a CFLAGS="$(DEBUG)" lib: $(MAKE) libcdda_interface.a CFLAGS="$(OPT)" slib: $(MAKE) lessmessy $(MAKE) libcdda_interface.so CFLAGS="$(OPT) -fpic" [ -e libcdda_interface.so.0 ] || ln -s libcdda_interface.so libcdda_interface.so.0 test: $(MAKE) libcdda_interface.a CFLAGS="$(DEBUG)" $(CC) $(DEBUG) -c test.c $(LD) $(DEBUG) test.o $(LDFLAGS) -o cdda_test $(LIBS) libcdda_interface.a libcdda_interface.a: $(OFILES) $(AR) -r libcdda_interface.a $(OFILES) $(RANLIB) libcdda_interface.a libcdda_interface.so: $(OFILES) $(CC) -fpic -shared -o libcdda_interface.so.0.$(VERSION) -Wl,-soname -Wl,libcdda_interface.so.0 $(OFILES) $(LIBS) [ -e libcdda_interface.so.0 ] || ln -s libcdda_interface.so.0.$(VERSION) libcdda_interface.so.0 [ -e libcdda_interface.so ] || ln -s libcdda_interface.so.0.$(VERSION) libcdda_interface.so .c.o: $(CC) $(CFLAGS) -c $< lessmessy: -rm -f *.o core *~ *.out clean: lessmessy -rm -f *.a *.so *.so.0 *.so.* distclean: clean -rm -f Makefile cdparanoia-3.10.2+debian/interface/drive_exceptions.h0000644000175000017500000000634407102675440022065 0ustar danieldanielextern int scsi_enable_cdda(cdrom_drive *,int); extern long scsi_read_mmc(cdrom_drive *,void *,long,long); extern long scsi_read_mmc2(cdrom_drive *,void *,long,long); extern long scsi_read_D4_10(cdrom_drive *,void *,long,long); extern long scsi_read_D4_12(cdrom_drive *,void *,long,long); extern long scsi_read_D8(cdrom_drive *,void *,long,long); extern long scsi_read_28(cdrom_drive *,void *,long,long); extern long scsi_read_A8(cdrom_drive *,void *,long,long); typedef struct exception { char *model; int atapi; /* If the ioctl doesn't work */ unsigned char density; int (*enable)(struct cdrom_drive *,int); long (*read)(struct cdrom_drive *,void *,long,long); int bigendianp; } exception; /* specific to general */ /* list of drives that affect autosensing in ATAPI specific portions of code (force drives to detect as ATAPI or SCSI, force ATAPI read command */ static exception atapi_list[]={ {"SAMSUNG SCR-830 REV 2.09 2.09 ", 1, 0, Dummy,scsi_read_mmc2,0}, {"Memorex CR-622", 1, 0, Dummy, NULL,0}, {"SONY CD-ROM CDU-561", 0, 0, Dummy, NULL,0}, {"Chinon CD-ROM CDS-525", 0, 0, Dummy, NULL,0}, {NULL,0,0,NULL,NULL,0}}; /* list of drives that affect MMC default settings */ static exception mmc_list[]={ {"SAMSUNG SCR-830 REV 2.09 2.09 ", 1, 0, Dummy,scsi_read_mmc2,0}, {"Memorex CR-622", 1, 0, Dummy, NULL,0}, {"SONY CD-ROM CDU-561", 0, 0, Dummy, NULL,0}, {"Chinon CD-ROM CDS-525", 0, 0, Dummy, NULL,0}, {"KENWOOD CD-ROM UCR", -1, 0, NULL,scsi_read_D8, 0}, {NULL,0,0,NULL,NULL,0}}; /* list of drives that affect SCSI default settings */ static exception scsi_list[]={ {"TOSHIBA", -1,0x82,scsi_enable_cdda,scsi_read_28, 0}, {"IBM", -1,0x82,scsi_enable_cdda,scsi_read_28, 0}, {"DEC", -1,0x82,scsi_enable_cdda,scsi_read_28, 0}, {"IMS", -1, 0,scsi_enable_cdda,scsi_read_28, 1}, {"KODAK", -1, 0,scsi_enable_cdda,scsi_read_28, 1}, {"RICOH", -1, 0,scsi_enable_cdda,scsi_read_28, 1}, {"HP", -1, 0,scsi_enable_cdda,scsi_read_28, 1}, {"PHILIPS", -1, 0,scsi_enable_cdda,scsi_read_28, 1}, {"PLASMON", -1, 0,scsi_enable_cdda,scsi_read_28, 1}, {"GRUNDIG CDR100IPW", -1, 0,scsi_enable_cdda,scsi_read_28, 1}, {"MITSUMI CD-R ", -1, 0,scsi_enable_cdda,scsi_read_28, 1}, {"KENWOOD CD-ROM UCR", -1, 0, NULL,scsi_read_D8, 0}, {"YAMAHA", -1, 0,scsi_enable_cdda, NULL, 0}, {"PLEXTOR", -1, 0, NULL, NULL, 0}, {"SONY", -1, 0, NULL, NULL, 0}, {"NEC", -1, 0, NULL,scsi_read_D4_10,0}, /* the 7501 locks up if hit with the 10 byte version from the autoprobe first */ {"MATSHITA CD-R CW-7501", -1, 0, NULL,scsi_read_D4_12,-1}, {NULL,0,0,NULL,NULL,0}}; cdparanoia-3.10.2+debian/interface/smallft.c0000644000175000017500000002330011046366435020142 0ustar danieldaniel/****************************************************************** * CopyPolicy: GNU Lesser General Public License 2.1 applies * Copyright (C) 1998-2008 Monty xiphmont@mit.edu * * FFT implementation from OggSquish, minus cosine transforms, * minus all but radix 2/4 case * * See OggSquish or NetLib for the version that can do other than just * power-of-two sized vectors. * ******************************************************************/ #include #include #include "smallft.h" static void drfti1(int n, float *wa, int *ifac){ static int ntryh[4] = { 4,2,3,5 }; static float tpi = 6.28318530717958647692528676655900577; float arg,argh,argld,fi; int ntry=0,i,j=-1; int k1, l1, l2, ib; int ld, ii, ip, is, nq, nr; int ido, ipm, nfm1; int nl=n; int nf=0; L101: j++; if (j < 4) ntry=ntryh[j]; else ntry+=2; L104: nq=nl/ntry; nr=nl-ntry*nq; if (nr!=0) goto L101; nf++; ifac[nf+1]=ntry; nl=nq; if(ntry!=2)goto L107; if(nf==1)goto L107; for (i=1;i #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* some include file locations have changed with newer kernels */ #ifdef SBPCD_H #include #endif #ifdef UCDROM_H #include #endif #ifndef CDROMAUDIOBUFSIZ #define CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */ #endif #ifndef CDROM_GET_CAPABILITY #define CDROM_GET_CAPABILITY 0x5331 /* get CDROM capabilites if CDROM */ #endif #include #include #include #include #include "cdda_interface.h" #ifndef SG_EMULATED_HOST /* old kernel version; the check for the ioctl is still runtime, this is just to build */ #define SG_EMULATED_HOST 0x2203 #define SG_SET_TRANSFORM 0x2204 #define SG_GET_TRANSFORM 0x2205 #endif #ifndef SG_IO /* old kernel version; the usage is all runtime-safe, this is just to build */ typedef struct sg_io_hdr { int interface_id; /* [i] 'S' for SCSI generic (required) */ int dxfer_direction; /* [i] data transfer direction */ unsigned char cmd_len; /* [i] SCSI command length ( <= 16 bytes) */ unsigned char mx_sb_len; /* [i] max length to write to sbp */ unsigned short int iovec_count; /* [i] 0 implies no scatter gather */ unsigned int dxfer_len; /* [i] byte count of data transfer */ void * dxferp; /* [i], [*io] points to data transfer memory or scatter gather list */ unsigned char * cmdp; /* [i], [*i] points to command to perform */ unsigned char * sbp; /* [i], [*o] points to sense_buffer memory */ unsigned int timeout; /* [i] MAX_UINT->no timeout (unit: millisec) */ unsigned int flags; /* [i] 0 -> default, see SG_FLAG... */ int pack_id; /* [i->o] unused internally (normally) */ void * usr_ptr; /* [i->o] unused internally */ unsigned char status; /* [o] scsi status */ unsigned char masked_status;/* [o] shifted, masked scsi status */ unsigned char msg_status; /* [o] messaging level data (optional) */ unsigned char sb_len_wr; /* [o] byte count actually written to sbp */ unsigned short int host_status; /* [o] errors from host adapter */ unsigned short int driver_status;/* [o] errors from software driver */ int resid; /* [o] dxfer_len - actual_transferred */ unsigned int duration; /* [o] time taken by cmd (unit: millisec) */ unsigned int info; /* [o] auxiliary information */ } sg_io_hdr_t; #endif struct cdda_private_data { struct sg_header *sg_hd; unsigned char *sg_buffer; /* points into sg_hd */ clockid_t clock; int last_milliseconds; }; #define MAX_RETRIES 8 #define MAX_BIG_BUFF_SIZE 65536 #define MIN_BIG_BUFF_SIZE 4096 #define SG_OFF sizeof(struct sg_header) extern int cooked_init_drive (cdrom_drive *d); extern unsigned char *scsi_inquiry (cdrom_drive *d); extern int scsi_init_drive (cdrom_drive *d); #ifdef CDDA_TEST extern int test_init_drive (cdrom_drive *d); #endif #endif cdparanoia-3.10.2+debian/buffering_write.c0000644000175000017500000000324211013202677017713 0ustar danieldaniel/* Eliminate teeny little writes. patch submitted by Rob Ross --Monty 19991008 */ #include #include #include #include #define OUTBUFSZ 32*1024 #include "utils.h" extern long blocking_write(int outf, char *buffer, long num); /* GLOBALS FOR BUFFERING CALLS */ static int bw_fd = -1; static long bw_pos = 0; static char bw_outbuf[OUTBUFSZ]; /* buffering_write() - buffers data to a specified size before writing. * * Restrictions: * - MUST CALL BUFFERING_CLOSE() WHEN FINISHED!!! * */ long buffering_write(int fd, char *buffer, long num) { if (fd != bw_fd) { /* clean up after buffering for some other file */ if (bw_fd >= 0 && bw_pos > 0) { if (blocking_write(bw_fd, bw_outbuf, bw_pos)) { perror("write (in buffering_write, flushing)"); } } bw_fd = fd; bw_pos = 0; } if (bw_pos + num > OUTBUFSZ) { /* fill our buffer first, then write, then modify buffer and num */ memcpy(&bw_outbuf[bw_pos], buffer, OUTBUFSZ - bw_pos); if (blocking_write(fd, bw_outbuf, OUTBUFSZ)) { perror("write (in buffering_write, full buffer)"); return(-1); } num -= (OUTBUFSZ - bw_pos); buffer += (OUTBUFSZ - bw_pos); bw_pos = 0; } /* save data */ if(buffer && num) memcpy(&bw_outbuf[bw_pos], buffer, num); bw_pos += num; return(0); } /* buffering_close() - writes out remaining buffered data before closing * file. * */ int buffering_close(int fd) { if (fd == bw_fd && bw_pos > 0) { /* write out remaining data and clean up */ if (blocking_write(fd, bw_outbuf, bw_pos)) { perror("write (in buffering_close)"); } bw_fd = -1; bw_pos = 0; } return(close(fd)); } cdparanoia-3.10.2+debian/cdparanoia.1.jp0000644000175000017500000002242706761061561017200 0ustar danieldaniel.TH CDPARANOIA 1 .\" Translated Sun Aug 22 18:02:41 JST 1999 .\" by FUJIWARA Teruyoshi .SH ÌŸÁ° cdparanoia (Paranoia release III) \- ¥ª¡Œ¥Ç¥£¥ª CD ÆÉ€ßŒè€ê¥æ¡Œ¥Æ¥£¥ê¥Æ¥£¡£ÆÃỀʥǡŒ¥¿ŸÈ¹çµ¡Çœ€ò»ý€Ä¡£ .SH ÆüÉÕ ¥Ð¡Œ¥ž¥ç¥óIII ¥ê¥ê¡Œ¥¹ŠÁ9.6 (17 Aug 1999) .SH œñŒ° .B cdparanoia .RB [ options ] .B span .RB [ outfile ] .SH ÀâÌÀ .B cdparanoia €Ï CD-DA µ¡Çœ€ò»ý€Ä CD-ROM ¥É¥é¥€¥Ö€«€é¥ª¡Œ¥Ç¥£¥ª¥È¥é¥Ã¥¯€òŒè€êœÐ€·€Þ €¹¡£€³€Î¥Ç¡Œ¥¿€Ï WAV, AIFF, AIFF-C, raw ·ÁŒ°€Ç¥Õ¥¡¥€¥ë€Ë¥»¡Œ¥Ö€¹€ë€³€È €ä¡¢ÉžœàœÐÎÏ€ËÁ÷€ë€³€È€¬€Ç€­€Þ€¹¡£€Û€È€ó€É€Î ATAPI, SCSI, ¥á¡Œ¥«¡ŒÆÈŒ« €Î CD-ROM ¥É¥é¥€¥Ö€¬¥µ¥Ý¡Œ¥È€µ€ì€Æ€€€Þ€¹¡£ .B cdparanoia €ÏÂП݀Υɥ饀¥Ö€¬ CD-DA µ¡Çœ€ò»ý€Ã€Æ€€€ë€«€É€Š€«€òÈœỀǀ­€Þ€¹¡£ .P ñœã€ÊÆÉ€ßŒè€ê€À€±€Ç€Ê€¯¡¢ .B cdparanoia €ÏÆÃỀˎè·ò€Ê¥Ç¡Œ¥¿ŸÈ¹çµ¡Çœ¡¢Æ±Žüµ¡Çœ¡¢¥š¥é¡ŒœèÍýµ¡Çœ¡¢ÇË»¥Ç¡Œ¥¿€ÎºÆ ¹œÀ®µ¡Çœ€ò»ý€Ã€Æ€€€Þ€¹¡£ .SH ¥ª¥×¥·¥ç¥ó .TP .B \-v --verbose Œ«Æ°ž¡œÐ€ÈÆÉ€ßŒè€ê€ÎœèÍý€Ë€Ä€€€Æ¡¢€Ð€«€Ð€«€·€€€Û€ÉŸéĹ€ÊÉœŒš€ò¹Ô€€€Þ€¹¡£ ÀßÄê€ä¥Ç¥Ð¥Ã¥°€ÎºÝ€ËÊØÍø€Ç€¹¡£ .TP .B \-q --quiet ÆÉ€ßŒè€êœèÍý€ÎÅÓÃæ€Ë¡¢¿Ê¹ÔŸõ¶·€ä¥š¥é¡ŒŸðÊó€òÁŽ€¯ÉœŒš€·€Þ€»€ó¡£ .TP .B \-e --stderr-progress ¿Ê¹ÔŸõ¶·€ò(¥é¥Ã¥Ñ¥¹¥¯¥ê¥×¥È€Î€¿€á€Ë)Éžœà¥š¥é¡ŒœÐÎπ˜ÐÎÏ€·€Þ€¹¡£ .TP .B \-V --version ¥×¥í¥°¥é¥à€Î¥Ð¡Œ¥ž¥ç¥ó€òÉœŒš€·€ÆœªÎ»€·€Þ€¹¡£ .TP .B \-Q --query CD-ROM ¥É¥é¥€¥Ö€ÎŒ«Æ°ž¡œÐ€ò¹Ô€€¡¢CD-ROM €Î TOC €ÎÌ䀀¹ç€ï€»€ÈÉœŒš€ò¹Ô €€¡¢œªÎ»€·€Þ€¹¡£ .TP .B \-s --search-for-drive €¿€È€š /dev/cdrom €Î¥ê¥ó¥¯€¬Âžºß€·€Æ€€€Æ€â¡¢CD-ROM ¥É¥é¥€¥Ö€ÎްÁŽ€Ê ž¡º÷€ò¹Ô€€€Þ€¹¡£ .TP .B \-h --help .B cdparanoia €Î»È€€Êý€È¥ª¥×¥·¥ç¥ó€òŽÊñ€ÊÀâÌÀ€òœÐÎÏ€·€Þ€¹¡£ .TP .B \-p --output-raw ¥Ø¥Ã¥À̵€·€Î¥Ç¡Œ¥¿€ò¥Û¥¹¥È€Î¥Ð¥€¥Èœç€Ç¡¢¥€¥ó¥¿¥ê¡Œ¥ÖœèÍý€ò»Ü€·€¿ ¥µ¥ó¥×¥ë²»ÀŒ€òŽÞ€à raw ·ÁŒ°€Î 16 ¥Ó¥Ã¥È PCM ¥Ç¡Œ¥¿€È€·€ÆœÐÎÏ€·€Þ€¹¡£ ¥Ð¥€¥Èœç€È€·€Æ¥ê¥È¥ë¥š¥ó¥Ç¥£¥¢¥ó€¢€ë€€€Ï¥Ó¥Ã¥°¥š¥ó¥Ç¥£¥¢¥ó€ò»ØÄꀹ€ë€Ë €Ï¡¢žåœÒ€Î .B \-r €Þ€¿€Ï .B \-R ¥ª¥×¥·¥ç¥ó€ò»È€Ã€Æ€¯€À€µ€€¡£ .TP .B \-r --output-raw-little-endian ¥Ø¥Ã¥À̵€·€Î¥Ç¡Œ¥¿€ò LSB first €Î¥Ð¥€¥Èœç€Ç¡¢¥€¥ó¥¿¥ê¡Œ¥ÖœèÍý€ò»Ü€·€¿ ¥µ¥ó¥×¥ë²»ÀŒ€òŽÞ€à raw ·ÁŒ°€Î 16 ¥Ó¥Ã¥È PCM ¥Ç¡Œ¥¿€È€·€ÆœÐÎÏ€·€Þ€¹¡£ .TP .B \-R --output-raw-big-endian ¥Ø¥Ã¥À̵€·€Î¥Ç¡Œ¥¿€ò MSB first €Î¥Ð¥€¥Èœç€Ç¡¢¥€¥ó¥¿¥ê¡Œ¥ÖœèÍý€ò»Ü€·€¿ ¥µ¥ó¥×¥ë²»ÀŒ€òŽÞ€à raw ·ÁŒ°€Î 16 ¥Ó¥Ã¥È PCM ¥Ç¡Œ¥¿€È€·€ÆœÐÎÏ€·€Þ€¹¡£ .TP .B \-w --output-wav ¥Ç¡Œ¥¿€ò Micro$oft €Î RIFF WAV ·ÁŒ°€ÇœÐÎÏ€·€Þ€¹(WAV ¥Ç¡Œ¥¿€Î¥Ð¥€¥Èœç€Ï ɬ€º LSB first €Ç€¢€ëÅÀ€ËÃí°Õ)¡£ .TP .B \-f --output-aiff ¥Ç¡Œ¥¿€ò Apple €Î AIFF ·ÁŒ°€ÇœÐÎÏ€·€Þ€¹(AIFC ¥Ç¡Œ¥¿€Î¥Ð¥€¥Èœç€Ïɬ€º MSB first €Ç€¢€ëÅÀ€ËÃí°Õ)¡£ .TP .B \-a --output-aifc ¥Ç¡Œ¥¿€ò̵°µœÌ €Î Apple AIFF-C ·ÁŒ°€ÇœÐÎÏ€·€Þ€¹(AIFF-C ¥Ç¡Œ¥¿€Î¥Ð¥€¥È œç€Ïɬ€º MSB first €Ç€¢€ëÅÀ€ËÃí°Õ)¡£ .TP .BI "\-B --batch " cdda2wav ·ÁŒ°€Î¥Ð¥Ã¥ÁœÐÎÏ€ò¹Ô€€€Þ€¹¡£cdparanoia €ÏœÐÎÏ€ò¥È¥é¥Ã¥¯¶­³Š€Ç Ê£¿ô¥Õ¥¡¥€¥ë€Ëʬ³ä€·€Þ€¹¡£œÐÎÏ¥Õ¥¡¥€¥ë€Î¥Õ¥¡¥€¥ëÌŸ€ÎÀèÆ¬Éôʬ€Ï¡¢'track(ÈÖ¹æ)' €È€Ê€ê€Þ€¹¡£ .TP .B \-c --force-cdrom-little-endian °ìÉô€Î CD-ROM €ÏŽÖ°ã€Ã€¿¥š¥ó¥Ç¥£¥¢¥ó€òÊó¹ð€·€Þ€¹(€¢€ë€€€Ï¥š¥ó¥Ç¥£¥¢¥ó €ËŽØ€¹€ëŸðÊó€òÁŽ€¯Êó¹ð€·€Þ€»€ó)¡£€œ€Î€¿€á¡¢cdparanoia €¬¥š¥ó¥Ç¥£¥¢¥ó€ò ŽÖ°ã€š€ë€³€È€¬€¢€ê€Þ€¹¡£¥É¥é¥€¥Ö€ò¥ê¥È¥ë¥š¥ó¥Ç¥£¥¢¥ó€Î¥Ç¥Ð¥€¥¹€È€·€Æ cdparanoia €Ë°·€ï€»€ë€Ë€Ï¡¢ .B \-c ¥ª¥×¥·¥ç¥ó€ò»È€€€Þ€¹¡£ .TP .B \-C --force-cdrom-big-endian Á°€Î¥ª¥×¥·¥ç¥ó€ÎµÕ€Ç¡¢¥Ç¥Ð¥€¥¹€ò¥Ó¥Ã¥°¥š¥ó¥Ç¥£¥¢¥ó€Î¥Ç¥Ð¥€¥¹€È€·€Æ cdparanoia €Ë°·€ï€»€Þ€¹¡£ .TP .BI "\-n --force-default-sectors " n ¥€¥ó¥¿¥Õ¥§¡Œ¥¹€Î¥Ð¥Ã¥¯¥š¥ó¥É€¬¹Ô€ŠºÇŸ®Ã±°Ì€ÎÆÉ€ßŒè€ê€ò¡¢ 1 ²ó€ÎÆÉ€ßŒè€ê€Ž€È€Ë .B n ¥»¥¯¥¿€È€·€Þ€¹¡£€³€Î¿ô€ÏÌäÂê€òµ¯€³€¹€ª€œ€ì€¬€¢€ê€Þ€¹¡£¥«¡Œ¥Í¥ë€Ï¿€¯€Î Ÿì¹ç¡¢ÆÉ€ßŒè€êÍ×µá€òºÇŸ®Ã±°Ì€ÎÆÉ€ßŒè€ê(cdparanoia €Ë€è€ëŒ«Æ°œèÍý€Ï€³€ì €ËÂбþ€·€Æ€€€Þ€¹)Ê£¿ôžÄ€Ëʬ³ä€¹€ë€«¡¢À©žÂ€µ€ì€¿Â瀭€µ€ÎÈϰπǀ·€« ÆÉ€ßŒè€ê€òµö²Ä€·€Þ€»€ó¡£ .B ÉáÄ̀π³€Î¥ª¥×¥·¥ç¥ó€ò»È€Š€Ù€­€Ç€Ï€¢€ê€Þ€»€ó¡£ .TP .BI "\-d --force-cdrom-device " device ¥€¥ó¥¿¥Õ¥§¡Œ¥¹€Î¥Ð¥Ã¥¯¥š¥ó¥É€Ë€è€ëÆÉ€ßŒè€ê€ò¡¢ºÇœé€Ëž«€Ä€±€¿ÆÉ€ßŒè€ê²Ä Çœ€Ê CD-ROM ¥É¥é¥€¥Ö€Ç€Ï€Ê€¯¡¢»ØÄꀷ€¿ .B device €«€é¹Ô€Š€è€Š€Ë€·€Þ€¹¡£€³€Î¥ª¥×¥·¥ç¥ó€Ç€Ï¡¢ÍøÍѲÄÇœ€Ç€¢€ëÇ€°Õ€Î ¥€¥ó¥¿¥Õ¥§¡Œ¥¹(ATAPI, SCSI, ¥á¡Œ¥«¡ŒÆÈŒ«)€ò»ý€Ä¥Ç¥Ð¥€¥¹€ò»ØÄꀹ€ë€³€È €¬€Ç€­€Þ€¹¡£ .TP .BI "\-g --force-generic-device " device €³€Î¥ª¥×¥·¥ç¥ó€Ï¡¢SCSI CD-ROM €ÈÈÆÍѥǥХ€¥¹€ÎÀßÄê€òÌÀŒšÅª€ËÊÌ¡¹€ËÀ©žæ €·€¿€€»þ€Ë .B \-d ¥ª¥×¥·¥ç¥ó€ÈÁȀ߹ç€ï€»€Æ»È€€€Þ€¹¡£€³€Î¥ª¥×¥·¥ç¥ó€¬ÌòΩ€Ä€Î€Ï¡¢SCSI €Î ÀßÄꀬɞœà€È°Û€Ê€ëŸì¹ç€À€±€Ç€¹¡£ .TP .BI "\-S --force-read-speed " number CD ¥É¥é¥€¥Ö€«€é€ÎÆÉ€ß¹þ€ß®ÅÙ€òÀßÄꀹ€ë€Ë€Ï¡¢€³€Î¥ª¥×¥·¥ç¥ó€òÌÀŒšÅª€Ë »È€Ã€Æ€¯€À€µ€€(¥É¥é¥€¥Ö€¬Âбþ€·€Æ€€€ëŸì¹ç)¡£€³€Î¥ª¥×¥·¥ç¥ó€òÍÑ€€€ë€È¡¢ ¥Ç¥£¥¹¥¯€¬ÃÙ€€Ÿì¹ç€ä¥á¥â¥ê€¬Ÿ¯€Ê€€Ÿì¹ç€Ëµ¯€³€ë¥¢¥ó¥À¡Œ¥é¥ó€òžº€é€¹€³€È €¬€Ç€­€Þ€¹¡£ .TP .B \-Z --disable-paranoia ¥Ç¡Œ¥¿ŸÈ¹ç€ÈÄûÀµµ¡Çœ€ò .b ÁŽ€Æ Ìµžú€Ë€·€Þ€¹¡£-Z ¥ª¥×¥·¥ç¥ó€òÍÑ€€€ë€È¡¢cdparanoia €Ï ¥ª¡Œ¥Ð¡Œ¥é¥Ã¥×€ÎÀßÄꀬ 0 €Ç€¢€ë cdda2wav €ÈÁŽ€¯Æ±€ž€è€Š€Ë¥Ç¡Œ¥¿€Î ÆÉ€ßŒè€ê€ò¹Ô€€€Þ€¹¡£ €³€Î¥ª¥×¥·¥ç¥ó€ò»ØÄꀹ€ë€È .B \-W , .B \-X , .B \-Y ¥ª¥×¥·¥ç¥ó€âÍ­žú€Ë€Ê€ê€Þ€¹€¬¡¢ .B \-Z \-W \-X \-Y €ÈÁŽ€¯Æ±€ž€Ç€Ï .B €¢€ê€Þ€»€ó¡£ €Ê€Œ€Ê€é¡¢ .B \-W €«€é .B \-Z €Þ€Ç€Î¥ª¥×¥·¥ç¥ó€Ë€è€êŸÈ¹ç€Î¥ì¥Ù¥ë€¬³¬ÁØÅª€ËÊÑ€ï€ë€«€é€Ç€¹¡£ŒÂºÝ€ËÍ­žú €Ë€Ê€ë€Î€ÏºÇžå€Ë»ØÄꀷ€¿¥ª¥×¥·¥ç¥ó€À€±€Ç€¹¡£ .TP .B \-Y --disable-extra-paranoia ÆÉ€ßŒè€Ã€¿¥Ç¡Œ¥¿€ÎÃæŽÖ€Ë€ª€±€ë¥Ç¡Œ¥¿ŸÈ¹ç€ò¹Ô€€€Þ€»€ó¡£€Ä€Þ€ê¡¢ ¥Ç¡Œ¥¿€ÎÆÉ€ßŒè€ê¶­³Š€Ë€ª€±€ë¥ª¡Œ¥Ð¡Œ¥é¥Ã¥×Éôʬ€Î¥Á¥§¥Ã¥¯€·€«¹Ô€€€Þ€»€ó¡£ .TP .B \-X --disable-scratch-detection ŸÈ¹ç€ÎÅÓÃæ€Ç€Ïœý€Îõºº€â¹Ô€ï€º¡¢œý€ËÂЀ·€ÆŽè·ò€ÊƱŽüœèÍý€â¹Ô€€€Þ€»€ó¡£ .B \-X ¥ª¥×¥·¥ç¥ó€ò»ØÄꀷ€¿Ÿì¹ç¡¢œý€Ä€€€¿ CD €òÍ¿€š€ë€È cdparanoia €ÏÆÉ€ßŒè€ê €ÎŒºÇÔ€òµ¯€³€·€Þ€¹¡£ .TP .B \-W --disable-scratch-repair œý€òž¡œÐ€·¡¢Æ±Žü€òÊ݀ĜèÍý€ò¹Ô€€€Þ€¹¡£€¿€À€·²õ€ì€¿¥Ç¡Œ¥¿€Îœ€Éü€Ï¹Ô€€€Þ €»€ó¡£¥í¥°¥Õ¥¡¥€¥ë€ÎœÐÎÏ€ò¹Ô€Š€È( .RB \-i ¥ª¥×¥·¥ç¥ó)¡¢ÁŽ€Æ€Îœý€Î¥Õ¥ì¡Œ¥à°ÌÃÖ€¬¥í¥°¥Õ¥¡¥€¥ë€ËœÐÎÏ€µ€ì€Þ€¹¡£ .SH œÐÎÏ€µ€ì€ëŽéÊž»ú .TP .B :-) ÀµŸïưºî¡£¥ž¥Ã¥¿€ÏŸ¯€Ê€€€«¡¢ÁŽ€¯€Ê€€ .TP .B :-| ÀµŸïưºî¡£¥ž¥Ã¥¿€ÏµöÍÆÈÏ°Ï .TP .B :-/ ÆÉ€ßŒè€ê€Ç¥É¥ê¥Õ¥È€¬È¯Àž .TP .B :-P ºÇŸ®Ã±°Ì€ÎÆÉ€ßŒè€êÁàºî€Ë€ª€€€Æ¡¢Êó¹ð€µ€ì€Æ€€€Ê€€Â»Œº€¬¥¹¥È¥ê¡Œ¥ß¥ó¥°€Ë€¢€ë .TP .B 8-| ·«€êÊÖ€·€ÆÆÉ€ßŒè€ê€ò¹Ô€Ã€¿€¬¡¢Æ±€ž°ÌÃÖ€ÇÌäÂꀬµ¯€­€¿¡£œ€Àµ€Ïº€Æñ€Ç€¢€ë .TP .B :-0 SCSI/ATAPI €Î¥Ç¡Œ¥¿ÅŸÁ÷¥š¥é¡Œ .TP .B :-( œý€¬ž¡œÐ€µ€ì€¿ .TP .B ;-( ¥Ç¡Œ¥¿€ÎÄûÀµ€ò€¢€­€é€á€¿ .TP .B :^D ÆÉ€ßŒè€êœªÎ» .SH ¿Ê¹ÔÉœŒš€Î°ÕÌ£ .TP .B <¥¹¥Ú¡Œ¥¹> ÄûÀµ€ÏÉÔÍ× .TP .B - ¥ž¥Ã¥¿€ÎÄûÀµ€¬É¬Í× .TP .B + Êó¹ð€µ€ì€Æ€€€Ê€€Â»Œº€¬¥¹¥È¥ê¡Œ¥ß¥ó¥°€Ë€¢€ë¡£€¢€ë€€€ÏỀΥš¥é¡Œ€¬ÆÉ€ßŒè€ê »þ€ËȯÀž€·€¿ .TP .B ! ¥¹¥Æ¡Œ¥ž 1 ÄûÀµ€Îžå€Ë¥š¥é¡Œ€¬ž«€Ä€«€Ã€¿¡£ÆÉ€ßŒè€ê€òÊ£¿ô²ó·«€êÊÖ€·€Æ€â Ʊ€ž¥š¥é¡Œ€¬È¯Àž€·¡¢cdparanoia €Ï€œ€Î¥š¥é¡Œ€ò€Š€Þ€¯ž¡œÐ€Ç€­€Ê€€¡£ .TP .B e SCSI/ATAPI €Î¥Ç¡Œ¥¿ÅŸÁ÷¥š¥é¡Œ(ÄûÀµºÑ€ß) .TP .B V ÄûÀµ€Ç€­€Ê€€¥š¥é¡Œ/¥Ç¡Œ¥¿€Î¥¹¥­¥Ã¥× .SH °ú€­¿ô 'span' °ú€­¿ô span €Ï¡¢ÆÉ€ßŒè€ê€ò¹Ô€Š¥È¥é¥Ã¥¯€Þ€¿€Ï¥È¥é¥Ã¥¯€Î°ìÉô€ò»ØÄꀷ€Þ€¹¡£ €³€Î°ú€­¿ô€Ïɬ€ºÉ¬Í׀ǀ¹¡£ .B Ãí°Õ: span €¬Ã±€Ê€ë¿ô»ú€Ç€Ê€±€ì€Ð¡¢¥·¥§¥ë€¬°ú€­¿ô span €òÅž³«€·€Æ€·€Þ€ï€Ê€€ €è€Š€Ë¥¯¥©¡Œ¥È€¹€ë€Î€¬ÉáÄ̀ǀ·€ç€Š¡£ .P °ú€­¿ô span €Ï¡¢Ã±€Ê€ë¥È¥é¥Ã¥¯Èֹ怫¡¢¥ª¥Õ¥»¥Ã¥È€È¥¹¥Ñ¥ó€ÎÁȹ瀻€Î»ØÄê €È€Ê€ê€Þ€¹¡£¥ª¥Õ¥»¥Ã¥È€È¥¹¥Ñ¥ó€ÎÁȹ瀻€ò»ØÄꀹ€ëÊýË¡€Ï¡¢€À€€€¿€€°Ê²Œ€Î €è€Š€Ë€Ê€ê€Þ€¹: .P 1[ww:xx:yy.zz]-2[aa:bb:cc.dd] .P €³€³€Ç 1 €È 2 €Ï¥È¥é¥Ã¥¯ÈÖ¹æ€Ç€¹¡£³Ñ³çžÌ€ÎÃæ€Î¿ôÃ̀ϡ¢»ØÄꀵ€ì€¿¥È¥é¥Ã¥¯ €Ë€ª€±€ë¡¢€è€êºÙ€«€€¥ª¥Õ¥»¥Ã¥È»ØÄê€Ç€¹¡£[aa:bb:cc.dd] €Ï ¡Ö»þŽÖ/ʬ/ÉÃ/¥»¥¯¥¿¡×€Î·ÁŒ°€Ç€¹¡£ÃÍ€¬ 0 €Ç€¢€ë¥Õ¥£¡Œ¥ë¥É€Ï»ØÄꀷ€Ê€¯€Æ €â¹œ€€€Þ€»€ó¡£€Ä€Þ€ê [::20], [:20], [20], [20.] Åù€Ï 20 ÉÀȲòŒá€µ€ì¡¢ [10:] €Ï 10 ÉÀȲòŒá€µ€ì¡¢[.30] €Ï 30 ¥»¥¯¥¿€È²òŒá€µ€ì€Þ€¹(75 ¥»¥¯¥¿€Ç 1 ÉÀǀ¹)¡£ .P ¥ª¥Õ¥»¥Ã¥È€ò 1 €Ä€·€«»ØÄꀷ€Ê€±€ì€Ð¡¢€³€ì€Ï³«»Ï°ÌÃրΥª¥Õ¥»¥Ã¥È€òÉœ€·¡¢ µÛ€€œÐ€·€Ï€œ€Î¥È¥é¥Ã¥¯€Îœª€ï€ê€Þ€Ç¹Ô€ï€ì€Þ€¹¡£¥ª¥Õ¥»¥Ã¥È€¬ 1 €Ä€À€±€¢ €ê¡¢€œ€ÎÁ°žå€Ë¥Ï¥€¥Õ¥ó(-)€¬€¢€ëŸì¹ç€Ë€Ï¡¢ŸÊά€µ€ì€Æ€€€ë¥ª¥Õ¥»¥Ã¥È€Ï ¥Ç¥£¥¹¥¯€ÎÀèÆ¬€¢€ë€€€ÏËöÈø€È€·€Æ²òŒá€µ€ì€Þ€¹¡£Îã€ò°Ê²Œ€ËŒš€·€Þ€¹: .TP .B 1:[20.35] ¥È¥é¥Ã¥¯ 1 €Î 20 Éá¢35 ¥»¥¯¥¿€Î°ÌÃÖ€«€é¡¢¥È¥é¥Ã¥¯ 1 €ÎËöÈø€Þ€Ç€òµÛ€€ œÐ€·€Þ€¹¡£ .TP .B 1:[20.35]- 1[20.35] €Î°ÌÃÖ€«€é¥Ç¥£¥¹¥¯€ÎËöÈø€Þ€Ç€òµÛ€€œÐ€·€Þ€¹¡£ .TP .B \-2 ¥Ç¥£¥¹¥¯€ÎÀèÆ¬€«€é¥È¥é¥Ã¥¯ 2 €Þ€Ç(¥È¥é¥Ã¥¯ 2 €âŽÞ€ß€Þ€¹)€òµÛ€€œÐ€·€Þ€¹¡£ .TP .B \-2:[30.35] ¥Ç¥£¥¹¥¯€ÎÀèÆ¬€«€é 2:[30.35] €Î°ÌÃրހǵۀ€œÐ€·€Þ€¹¡£ .TP .B 2-4 ¥È¥é¥Ã¥¯ 2 €ÎÀèÆ¬€«€é¥È¥é¥Ã¥¯ 4 €ÎËöÈø€Þ€Ç€òµÛ€€œÐ€·€Þ€¹¡£ .P ·«€êÊÖ€·€Ë€Ê€ê€Þ€¹€¬¡¢³Ñ³çžÌ€ª€è€Óñžì€ÎÀèÆ¬€Ë€¢€ë¥Ï¥€¥Õ¥ó€Ïɬ€º¥¯¥©¡Œ¥È €·€Æ¡¢¥·¥§¥ë€ËÅž³«€µ€ì€Ê€€€è€Š€Ë€·€Æ€¯€À€µ€€¡£ .SH »ØÄêÎã ¥¯¥©¡Œ¥È€âŽÞ€á€¿»ØÄêÎã€ò€€€¯€Ä€«Œš€·€Þ€¹: .TP ¥É¥é¥€¥Ö€ÎÄŽºº€À€±€òŰÄìŪ€Ë¹Ô€€¡¢Œ«Æ°ž¡œÐ€Î·ë²Ì€òÁŽ€ÆÊó¹ð€·€Þ€¹: .P cdparanoia -vsQ .TP ¥Ç¥£¥¹¥¯ÁŽÂ΀òµÛ€€œÐ€·€Þ€¹¡£€œ€ì€Ÿ€ì€Î¥È¥é¥Ã¥¯€ÏÊÌ¡¹€Î¥Õ¥¡¥€¥ë€Ë€·€Þ€¹: .P cdparanoia -B "1-" .TP ¥È¥é¥Ã¥¯ 1 €Î»þ¹ï 0:30.12 €«€é»þ¹ï 1:10.00 €Þ€Ç€òµÛ€€œÐ€·€Þ€¹: .P cdparanoia "1[:30.12]-1[1:10]" .TP ¥È¥é¥Ã¥¯ 1 €Î»þ¹ï 0:30.12 €«€é 1 ʬŽÖ€Î¥Ç¡Œ¥¿€òµÛ€€œÐ€·€Þ€¹: .P cdparanoia "1[:30.12]-[1:00]" .SH œÐÎÏ œÐÎÏ¥Õ¥¡¥€¥ë€ò»ØÄꀹ€ë°ú€­¿ô€ÏŸÊά²ÄÇœ€Ç€¹¡£»ØÄꀵ€ì€Æ€€€Ê€±€ì€Ð¡¢ cdparanoia €Ï¥µ¥ó¥×¥ë²»ÀŒ€ò .BR cdda.wav ", " cdda.aifc ", " cdda.raw €Î€€€º€ì€«€ËœÐÎÏ€·€Þ€¹¡£€É€Î¥Õ¥¡¥€¥ë€ËœÐÎÏ€µ€ì€ë€Î€«€Ï¡¢¥ª¥×¥·¥ç¥ó .BR \-w ", " \-a ", " \-r "," \-R €Î€Š€Á€€€º€ì€ò»È€Š€«€Ë€è€Ã€Æ·è€Þ€ê€Þ€¹(²¿€â»ØÄꀷ€Ê€±€ì€Ð .BR \-w €¬¥Ç¥Õ¥©¥ë¥ÈÃ̀ǀ¹)¡£œÐÎÏ¥Õ¥¡¥€¥ë€ò»ØÄꀹ€ë°ú€­¿ô€¬ .B \- €Ê€é€Ð¡¢œÐÎÏ€ÏÉžœàœÐÎÏ€ËÂЀ·€Æ¹Ô€ï€ì€Þ€¹¡£€É€Î¥Ç¡Œ¥¿·ÁŒ°€Ç€â¥Ñ¥€¥×€ËÁ÷ €ë€³€È€¬€Ç€­€Þ€¹¡£ .SH ŒÕŒ­ cdparanoia €ÎŽð€È€Ê€Ã€¿€Î€Ï Heiko Eissfeldt €µ€ó (heiko@colossus.escape.de)€¬ºîÀ®€·€¿ 'cdda2wav' ¥Ñ¥Ã¥±¡Œ¥ž€Ç€¢€ê¡¢ °ÊÁ°€Ï cdparanoia €Î¥€¥ó¥¿¥Õ¥§¡Œ¥¹€ÎÂçÉôʬ€Ï cdda2wav €«€é€â€é€Ã€Æ€­€¿ €â€Î€Ç€·€¿¡£cdda2wav €¬€Ê€±€ì€Ð¡¢cdparanoia €¬ºî€é€ì€ë€³€È€Ï€Ê€«€Ã€¿€Ç €·€ç€Š¡£ .P Joerg Schilling €µ€ó€¬ºîÀ®€·€¿ÈÆÍÑ SCSI ¥Ç¡Œ¥¿ÅŸÁ÷¥é¥€¥Ö¥é¥ê€«€é¡¢SCSI €ÎÀìÌçÃÎŒ±€ò¿€¯³Ø€Ð€»€Æ€€€¿€À€­€Þ€·€¿¡£ .P .SH ºîŒÔ Monty .P cdparanoia €Î¥Û¡Œ¥à¥Ú¡Œ¥ž€Ï°Ê²Œ€ÎŸìœê€Ë€¢€ê€Þ€¹: .P .ce http://www.xiph.org/paranoia/ cdparanoia-3.10.2+debian/report.c0000644000175000017500000000020111054727664016052 0ustar danieldaniel#include #include "interface/cdda_interface.h" int quiet=0; int verbose=CDDA_MESSAGE_FORGETIT; FILE *reportfile=NULL; cdparanoia-3.10.2+debian/install.sh0000644000175000017500000000000006755633252016373 0ustar danieldanielcdparanoia-3.10.2+debian/configure0000755000175000017500000053051010470656661016314 0ustar danieldaniel#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59. # # Copyright (C) 2003 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 Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; 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 || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # 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 # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. 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 ;; 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 { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') 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=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # 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 before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, 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 # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { 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 sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # 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'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # 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` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="interface/interface.c" # Factoring default headers for most tests. ac_includes_default="\ #include #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_STAT_H # include #endif #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_INTTYPES_H # include #else # if HAVE_STDINT_H # include # endif #endif #if HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT RANLIB ac_ct_RANLIB AR INSTALL CPP EGREP SET_MAKE SBPCD_H UCDROM_H TYPESIZES OPT DEBUG LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # 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. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= 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 ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -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 | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$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 ;; -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 ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) 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 ;; -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_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=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 ;; -*) { 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 && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && 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'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac 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 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 # 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 its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | 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 if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP # # 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 this package 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 \`..'] _ACEOF cat <<_ACEOF 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] --datadir=DIR read-only architecture-independent data [PREFIX/share] --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] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF 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 cat <<\_ACEOF 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 CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac cd $ac_dir # Check for guested configure; otherwise get Cygnus style 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 elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd $ac_popdir done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF Copyright (C) 2003 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 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ _ACEOF { 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` hostinfo = `(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=. echo "PATH: $as_dir" done } >&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_sep= 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=`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_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; 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: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. 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, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------- ## ## Output files. ## ## ------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core && rm -rf 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 -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >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 explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 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 { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 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 `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; 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,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 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 { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`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 { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 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 cp $srcdir/configure.guess $srcdir/config.guess cp $srcdir/configure.sub $srcdir/config.sub 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 { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Make sure we can run config.sub. $ac_config_sub sun4 >/dev/null 2>&1 || { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 echo "$as_me: error: cannot run $ac_config_sub" >&2;} { (exit 1); exit 1; }; } echo "$as_me:$LINENO: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6 if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_build_alias=$build_alias test -z "$ac_cv_build_alias" && ac_cv_build_alias=`$ac_config_guess` test -z "$ac_cv_build_alias" && { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6 build=$ac_cv_build build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$as_me:$LINENO: checking host system type" >&5 echo $ECHO_N "checking host system type... $ECHO_C" >&6 if test "${ac_cv_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_host_alias=$host_alias test -z "$ac_cv_host_alias" && ac_cv_host_alias=$ac_cv_build_alias ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6 host=$ac_cv_host host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` if test -z "$CC"; then 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 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}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 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC 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 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" 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 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done 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 echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl 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 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 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. echo "$as_me:$LINENO:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? 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.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. echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= # b.out is created by i960 compilers. for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; conftest.$ac_ext ) # This is the source file. ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool, # but it would be cool to find out if it's true. Does anybody # maintain Libtool? --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 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 echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? 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 { { 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 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 echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? 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 | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 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 echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 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 echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&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.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$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 echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=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 -std1 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 -std1. */ int osf4_cc_array ['\x00' == 0 ? 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 # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext 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 fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then echo "$as_me:$LINENO: result: $RANLIB" >&5 echo "${ECHO_T}$RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 echo "${ECHO_T}$ac_ct_RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi RANLIB=$ac_ct_RANLIB else RANLIB="$ac_cv_prog_RANLIB" fi # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AR+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="ar" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then echo "$as_me:$LINENO: result: $AR" >&5 echo "${ECHO_T}$AR" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "install", so it can be a program name with args. set dummy install; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_INSTALL+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$INSTALL"; then ac_cv_prog_INSTALL="$INSTALL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_INSTALL="install" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi INSTALL=$ac_cv_prog_INSTALL if test -n "$INSTALL"; then echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test -z "$GCC"; then DEBUG="-g" OPT="-O" else case $host in i?86-*-linux*) DEBUG="-g -Wall -fsigned-char" OPT="-O2 -ffast-math -fsigned-char -finline-functions";; *) DEBUG="-g -Wall -fsigned-char" OPT="-O2 -fsigned-char";; esac 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 echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&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 echo $ECHO_N "(cached) $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else 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 non-existent 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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else 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 echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else 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 non-existent 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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else 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 { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 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 echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6 if test "${ac_cv_prog_egrep+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 echo "${ECHO_T}$ac_cv_prog_egrep" >&6 EGREP=$ac_cv_prog_egrep echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f 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 #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)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$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=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done echo "$as_me:$LINENO: checking for short" >&5 echo $ECHO_N "checking for short... $ECHO_C" >&6 if test "${ac_cv_type_short+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&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 int main () { if ((short *) 0) return 0; if (sizeof (short)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_short=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_short=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_short" >&5 echo "${ECHO_T}$ac_cv_type_short" >&6 echo "$as_me:$LINENO: checking size of short" >&5 echo $ECHO_N "checking size of short... $ECHO_C" >&6 if test "${ac_cv_sizeof_short+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$ac_cv_type_short" = yes; then # The cast to unsigned long works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. 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 () { static int test_array [1 - 2 * !(((long) (sizeof (short))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=0 ac_mid=0 while :; do 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 () { static int test_array [1 - 2 * !(((long) (sizeof (short))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 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 () { static int test_array [1 - 2 * !(((long) (sizeof (short))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=-1 ac_mid=-1 while :; do 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 () { static int test_array [1 - 2 * !(((long) (sizeof (short))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` 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 () { static int test_array [1 - 2 * !(((long) (sizeof (short))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_short=$ac_lo;; '') { { echo "$as_me:$LINENO: error: cannot compute sizeof (short), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (short), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } ;; esac else if test "$cross_compiling" = yes; then { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling See \`config.log' for more details." >&5 echo "$as_me: error: cannot run test program while cross compiling See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } 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 long longval () { return (long) (sizeof (short)); } unsigned long ulongval () { return (long) (sizeof (short)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) exit (1); if (((long) (sizeof (short))) < 0) { long i = longval (); if (i != ((long) (sizeof (short)))) exit (1); fprintf (f, "%ld\n", i); } else { unsigned long i = ulongval (); if (i != ((long) (sizeof (short)))) exit (1); fprintf (f, "%lu\n", i); } exit (ferror (f) || fclose (f) != 0); ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_short=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) { { echo "$as_me:$LINENO: error: cannot compute sizeof (short), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (short), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.val else ac_cv_sizeof_short=0 fi fi echo "$as_me:$LINENO: result: $ac_cv_sizeof_short" >&5 echo "${ECHO_T}$ac_cv_sizeof_short" >&6 cat >>confdefs.h <<_ACEOF #define SIZEOF_SHORT $ac_cv_sizeof_short _ACEOF echo "$as_me:$LINENO: checking for int" >&5 echo $ECHO_N "checking for int... $ECHO_C" >&6 if test "${ac_cv_type_int+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&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 int main () { if ((int *) 0) return 0; if (sizeof (int)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_int=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_int=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_int" >&5 echo "${ECHO_T}$ac_cv_type_int" >&6 echo "$as_me:$LINENO: checking size of int" >&5 echo $ECHO_N "checking size of int... $ECHO_C" >&6 if test "${ac_cv_sizeof_int+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$ac_cv_type_int" = yes; then # The cast to unsigned long works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. 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 () { static int test_array [1 - 2 * !(((long) (sizeof (int))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=0 ac_mid=0 while :; do 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 () { static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 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 () { static int test_array [1 - 2 * !(((long) (sizeof (int))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=-1 ac_mid=-1 while :; do 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 () { static int test_array [1 - 2 * !(((long) (sizeof (int))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` 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 () { static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_int=$ac_lo;; '') { { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (int), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } ;; esac else if test "$cross_compiling" = yes; then { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling See \`config.log' for more details." >&5 echo "$as_me: error: cannot run test program while cross compiling See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } 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 long longval () { return (long) (sizeof (int)); } unsigned long ulongval () { return (long) (sizeof (int)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) exit (1); if (((long) (sizeof (int))) < 0) { long i = longval (); if (i != ((long) (sizeof (int)))) exit (1); fprintf (f, "%ld\n", i); } else { unsigned long i = ulongval (); if (i != ((long) (sizeof (int)))) exit (1); fprintf (f, "%lu\n", i); } exit (ferror (f) || fclose (f) != 0); ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_int=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) { { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (int), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.val else ac_cv_sizeof_int=0 fi fi echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5 echo "${ECHO_T}$ac_cv_sizeof_int" >&6 cat >>confdefs.h <<_ACEOF #define SIZEOF_INT $ac_cv_sizeof_int _ACEOF echo "$as_me:$LINENO: checking for long" >&5 echo $ECHO_N "checking for long... $ECHO_C" >&6 if test "${ac_cv_type_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&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 int main () { if ((long *) 0) return 0; if (sizeof (long)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_long=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_long=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5 echo "${ECHO_T}$ac_cv_type_long" >&6 echo "$as_me:$LINENO: checking size of long" >&5 echo $ECHO_N "checking size of long... $ECHO_C" >&6 if test "${ac_cv_sizeof_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$ac_cv_type_long" = yes; then # The cast to unsigned long works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. 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 () { static int test_array [1 - 2 * !(((long) (sizeof (long))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=0 ac_mid=0 while :; do 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 () { static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 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 () { static int test_array [1 - 2 * !(((long) (sizeof (long))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=-1 ac_mid=-1 while :; do 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 () { static int test_array [1 - 2 * !(((long) (sizeof (long))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` 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 () { static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_long=$ac_lo;; '') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (long), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } ;; esac else if test "$cross_compiling" = yes; then { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling See \`config.log' for more details." >&5 echo "$as_me: error: cannot run test program while cross compiling See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } 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 long longval () { return (long) (sizeof (long)); } unsigned long ulongval () { return (long) (sizeof (long)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) exit (1); if (((long) (sizeof (long))) < 0) { long i = longval (); if (i != ((long) (sizeof (long)))) exit (1); fprintf (f, "%ld\n", i); } else { unsigned long i = ulongval (); if (i != ((long) (sizeof (long)))) exit (1); fprintf (f, "%lu\n", i); } exit (ferror (f) || fclose (f) != 0); ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_long=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (long), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.val else ac_cv_sizeof_long=0 fi fi echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5 echo "${ECHO_T}$ac_cv_sizeof_long" >&6 cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG $ac_cv_sizeof_long _ACEOF echo "$as_me:$LINENO: checking for long long" >&5 echo $ECHO_N "checking for long long... $ECHO_C" >&6 if test "${ac_cv_type_long_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&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 int main () { if ((long long *) 0) return 0; if (sizeof (long long)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_long_long=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_long_long=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5 echo "${ECHO_T}$ac_cv_type_long_long" >&6 echo "$as_me:$LINENO: checking size of long long" >&5 echo $ECHO_N "checking size of long long... $ECHO_C" >&6 if test "${ac_cv_sizeof_long_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$ac_cv_type_long_long" = yes; then # The cast to unsigned long works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. 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 () { static int test_array [1 - 2 * !(((long) (sizeof (long long))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=0 ac_mid=0 while :; do 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 () { static int test_array [1 - 2 * !(((long) (sizeof (long long))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 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 () { static int test_array [1 - 2 * !(((long) (sizeof (long long))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=-1 ac_mid=-1 while :; do 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 () { static int test_array [1 - 2 * !(((long) (sizeof (long long))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` 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 () { static int test_array [1 - 2 * !(((long) (sizeof (long long))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_long_long=$ac_lo;; '') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (long long), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } ;; esac else if test "$cross_compiling" = yes; then { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling See \`config.log' for more details." >&5 echo "$as_me: error: cannot run test program while cross compiling See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } 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 long longval () { return (long) (sizeof (long long)); } unsigned long ulongval () { return (long) (sizeof (long long)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) exit (1); if (((long) (sizeof (long long))) < 0) { long i = longval (); if (i != ((long) (sizeof (long long)))) exit (1); fprintf (f, "%ld\n", i); } else { unsigned long i = ulongval (); if (i != ((long) (sizeof (long long)))) exit (1); fprintf (f, "%lu\n", i); } exit (ferror (f) || fclose (f) != 0); ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_long_long=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (long long), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.val else ac_cv_sizeof_long_long=0 fi fi echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_long" >&5 echo "${ECHO_T}$ac_cv_sizeof_long_long" >&6 cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long _ACEOF case 2 in $ac_cv_sizeof_short) SIZE16="short";; $ac_cv_sizeof_int) SIZE16="int";; esac case 4 in $ac_cv_sizeof_short) SIZE32="short";; $ac_cv_sizeof_int) SIZE32="int";; $ac_cv_sizeof_long) SIZE32="long";; esac echo "$as_me:$LINENO: checking for int16_t" >&5 echo $ECHO_N "checking for int16_t... $ECHO_C" >&6 if test "${ac_cv_type_int16_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&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 int main () { if ((int16_t *) 0) return 0; if (sizeof (int16_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_int16_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_int16_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_int16_t" >&5 echo "${ECHO_T}$ac_cv_type_int16_t" >&6 if test $ac_cv_type_int16_t = yes; then SIZE16="int16_t" fi echo "$as_me:$LINENO: checking for int32_t" >&5 echo $ECHO_N "checking for int32_t... $ECHO_C" >&6 if test "${ac_cv_type_int32_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&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 int main () { if ((int32_t *) 0) return 0; if (sizeof (int32_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_int32_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_int32_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_int32_t" >&5 echo "${ECHO_T}$ac_cv_type_int32_t" >&6 if test $ac_cv_type_int32_t = yes; then SIZE32="size32_t" fi if test -z "$SIZE16"; then { { echo "$as_me:$LINENO: error: No 16 bit type found on this platform!" >&5 echo "$as_me: error: No 16 bit type found on this platform!" >&2;} { (exit 1); exit 1; }; } fi if test -z "$SIZE32"; then { { echo "$as_me:$LINENO: error: No 32 bit type found on this platform!" >&5 echo "$as_me: error: No 32 bit type found on this platform!" >&2;} { (exit 1); exit 1; }; } fi for ac_header in linux/sbpcd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else 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 echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------------ ## ## Report this to the AC_PACKAGE_NAME lists. ## ## ------------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF SBPCD_H="-DSBPCD_H='1' " fi done for ac_header in linux/ucdrom.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else 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 echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------------ ## ## Report this to the AC_PACKAGE_NAME lists. ## ## ------------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF UCDROM_H="-DUCDROM_H='1' " fi done echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF all: @echo 'ac_maketemp="$(MAKE)"' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 if test "${ac_cv_c_const+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&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 () { /* FIXME: Include the comments suggested by Paul. */ #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset x; /* SunOS 4.1.1 cc rejects this. */ char const *const *ccp; char **p; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; ccp = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++ccp; p = (char**) ccp; ccp = (char const *const *) p; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; }; struct s *b; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; } #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_const=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_const=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 echo "${ECHO_T}$ac_cv_c_const" >&6 if test $ac_cv_c_const = no; then cat >>confdefs.h <<\_ACEOF #define const _ACEOF fi ac_config_files="$ac_config_files Makefile interface/Makefile paranoia/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, don't put newlines in cache variables' values. # 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. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *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 \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!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" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" 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}' # 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 # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then we branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. cat >confdef2opt.sed <<\_ACEOF t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g t quote s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g t quote d : quote s,[ `~#$^&*(){}\\|;'"<>?],\\&,g s,\[,\\&,g s,\],\\&,g s,\$,$$,g p _ACEOF # We use echo to avoid assuming a particular line-breaking character. # The extra dot is to prevent the shell from consuming trailing # line-breaks from the sub-command output. A line-break within # single-quotes doesn't work because, if this script is created in a # platform that uses two characters for line-breaks (e.g., DOS), tr # would break. ac_LF_and_DOT=`echo; echo .` DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` rm -f confdef2opt.sed 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_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $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 ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; 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 || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # 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 # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. 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 ;; 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 { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') 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=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # 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 before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, 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 # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 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 sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # 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'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by $as_me, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet 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 Configuration files: $config_files Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2003 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. 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 ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 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" ;; 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 if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "interface/Makefile" ) CONFIG_FILES="$CONFIG_FILES interface/Makefile" ;; "paranoia/Makefile" ) CONFIG_FILES="$CONFIG_FILES paranoia/Makefile" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 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 fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $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 -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "\$CONFIG_FILES"; then # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@build@,$build,;t t s,@build_cpu@,$build_cpu,;t t s,@build_vendor@,$build_vendor,;t t s,@build_os@,$build_os,;t t s,@host@,$host,;t t s,@host_cpu@,$host_cpu,;t t s,@host_vendor@,$host_vendor,;t t s,@host_os@,$host_os,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@AR@,$AR,;t t s,@INSTALL@,$INSTALL,;t t s,@CPP@,$CPP,;t t s,@EGREP@,$EGREP,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@SBPCD_H@,$SBPCD_H,;t t s,@UCDROM_H@,$UCDROM_H,;t t s,@TYPESIZES@,$TYPESIZES,;t t s,@OPT@,$OPT,;t t s,@DEBUG@,$DEBUG,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi # 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. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;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,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # 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 cdparanoia-3.10.2+debian/COPYING-LGPL0000644000175000017500000006400411046366435016171 0ustar danieldanielThe 10.1 and later release versions of the cdda-interface and cdda-paranoia libraries are distributed the GNU Lesser General Public License v2.1 or, at your option, any later version of the GNU LGPL. GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 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. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, 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 and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, 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 library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete 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 distribute a copy of this License along with the Library. 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 Library or any portion of it, thus forming a work based on the Library, 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) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, 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 Library, 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 Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you 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. If distribution of 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 satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be 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. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library 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. 9. 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 Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library 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 with this License. 11. 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 Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library 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 Library. 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. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library 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. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser 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 Library 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 Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, 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 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "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 LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. 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 LIBRARY 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 LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), 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 Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. 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 library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; 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. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it!