darkice-1.2/0000755000175000017500000000000012170707217007763 500000000000000darkice-1.2/README0000644000175000017500000000307512170706611010565 00000000000000DarkIce live audio streamer, http://code.google.com/p/darkice/ Copyright (c) 2000-2007, Tyrell Hungary, http://tyrell.hu/ Copyright (c) 2008, Ákos Maróy, akos@maroy.hu Copyright (c) 2009, Rafael Diniz, rafael@riseup.net Contents -------- 1. What is DarkIce? 2. Compiling and installing 3. Reporting crashes 1. What is DarkIce? ------------------- DarkIce is an IceCast, IceCast2 and ShoutCast live audio streamer. It takes audio input from a sound card, encodes it into mp3 and/or Ogg Vorbis, and sends the mp3 stream to one or more IceCast and/or ShoutCast servers, the Ogg Vorbis stream to one or more IceCast2 servers. DarkIce website: http://code.google.com/p/darkice/ 2. Compiling and installing --------------------------- On how to compile and install, please read the file INSTALL. If you're impatient, try: ./configure make The executable built is src/darkice. To install, try as root: make install For documentation, try: man darkice 3. Reporting crashes -------------------- When DarkIce core dumps, please send the backtrace along with your error report to the darkice mailing list: http://www.freelists.org/list/darkice Alternatively you could file a bug report at http://code.google.com/p/darkice/issues/list To get the backtrace information, you need gdb, the GNU debugger: 1. configure and compile using the --with-debug option: ./configure --with-debug=yes make clean all 2. run darkice from within gdb: gdb src/darkice 3. set parameters within gdb: (gdb) set args -c darkice.cfg 4. run: (gdb) run 5. after coredump, print the backtrace: (gdb) bt darkice-1.2/Makefile.am0000644000175000017500000000016512170706611011736 00000000000000SUBDIRS = src man sysconf_DATA = darkice.cfg EXTRA_DIST = darkice.cfg INSTALL.lame INSTALL.vorbis FAQ rc.darkice darkice-1.2/missing0000755000175000017500000002415212170706611011303 00000000000000#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2012-01-06.13; # UTC # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, # 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' sed_minuso='s/.* -o \([^ ]*\).*/\1/p' # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case $1 in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' autom4te touch the output file, or create a stub one automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file yacc create \`y.tab.[ch]', if possible, from existing .[ch] Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and \`g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # normalize program name to check for. program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). This is about non-GNU programs, so use $1 not # $program. case $1 in lex*|yacc*) # Not GNU programs, they don't have --version. ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case $program in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case $f in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te*) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison*|yacc*) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if test $# -ne 1; then eval LASTARG=\${$#} case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.h fi ;; esac fi if test ! -f y.tab.h; then echo >y.tab.h fi if test ! -f y.tab.c; then echo 'main() { return 0; }' >y.tab.c fi ;; lex*|flex*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if test $# -ne 1; then eval LASTARG=\${$#} case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if test ! -f lex.yy.c; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit $? fi ;; makeinfo*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n ' /^@setfilename/{ s/.* \([^ ]*\) *$/\1/ p q }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: darkice-1.2/rc.darkice0000644000175000017500000000474212170706611011637 00000000000000#!/bin/sh # generic init file for darkice # # Niels Dettenbach - nd@syndicat.com - 2009-11-05 # Last Change: 2010-12-21 # # thanks to: # - Roland Whitehead # GPL (2009) # 0.7 ## settings ## # check your paths! program=/usr/bin/darkice pidfile=/var/run/darkice.pid configfile=/etc/darkice.cfg logfile=/var/log/darkice.log progname="darkice" restart_delay=2 verbose="5" ## end of settings ## RETVAL=0 if [ ! -f $configfile ] then echo "$progname: config file not found" exit fi if [ ! -f $program ] then echo "$progname: programm file $program not found" exit fi case $1 in 'start') if [ -f $pidfile ]; then PID=`cat $pidfile` running=`ps --no-headers -o "%c" -p $PID` if ( [ "$progname" == "$running" ] ); then echo "$progname is still running" else echo "$progname seems crashed - PID ($PID) does not match the deamon" echo "removing stale PID File $pidfile" rm -f $pidfile $0 start exit $? fi exit 0 else echo -n $"Starting $progname " RETVAL=1 $program -v $verbose -c $configfile 2>%1 >> $logfile & echo RETVAL=$? if [ $RETVAL -eq 0 ]; then echo $! > $pidfile echo " started" else echo " not started" echo $RETVAL exit 0 fi RETVAL=$? fi ;; 'stop') if [ -f $pidfile ]; then echo -n $"Stop $progname " PID=`cat $pidfile` kill -s TERM $PID 2> /dev/null echo sleep $restart_delay rm -f $pidfile echo " stopped" else echo "$progname not running" fi RETVAL=$? ;; 'status') if [ -f $pidfile ]; then PID=`cat $pidfile` running=`ps --no-headers -o "%c" -p $PID` if ( [ "$progname" == "$running" ] ); then echo "$progname IS running with PID `cat $pidfile`." else echo "$progname process is dead or stale PID File $pidfile" exit 0 fi else echo "$progname is not running" exit 0 fi ;; 'restart') $0 stop $0 start RETVAL=$? ;; 'restartifdown') if [ -f $pidfile ]; then PID=`cat $pidfile` running=`ps --no-headers -o "%c" -p $PID` if ( [ "$progname" == "$running" ] ); then echo "$progname IS running with PID `cat $pidfile` - no restart." else echo "$progname PID $PID seems dead - restart" $0 stop $0 start RETVAL=$? fi else echo "PID file $pidfile found - restart" $0 stop $0 start RETVAL=$? fi ;; *) echo "Usage: $0 {start|stop|restart|status|restartifdown} " exit 1; ;; esac exit $RETVAL darkice-1.2/configure.in0000644000175000017500000004351012170706611012214 00000000000000dnl Process this file with autoconf to produce a configure script. AC_INIT(darkice, 1.2) AC_CONFIG_SRCDIR(src/DarkIce.cpp) AM_CONFIG_HEADER(src/config.h) AM_INIT_AUTOMAKE AC_PROG_CC AC_PROG_CXX AC_PROG_INSTALL dnl AC_STDC_HEADERS AC_HAVE_HEADERS(errno.h fcntl.h stdio.h stdlib.h string.h unistd.h limits.h) AC_HAVE_HEADERS(signal.h time.h sys/time.h sys/types.h sys/wait.h math.h) AC_HAVE_HEADERS(netdb.h netinet/in.h sys/ioctl.h sys/socket.h sys/stat.h) AC_HAVE_HEADERS(sched.h pthread.h termios.h) AC_HAVE_HEADERS(sys/soundcard.h sys/audio.h sys/audioio.h) AC_HEADER_SYS_WAIT() AC_TYPE_PID_T() AC_TYPE_SIZE_T() AC_C_BIGENDIAN() AC_CHECK_LIB(socket, socket) AC_CHECK_LIB(nsl, gethostbyname) AC_CHECK_LIB(rt, sched_getscheduler) AC_CHECK_FUNC(getaddrinfo, AC_DEFINE(HAVE_GETADDRINFO, 1, [Does function getaddrinfo exist?] )) dnl----------------------------------------------------------------------------- dnl funky posix threads checking, thanks to dnl Steven G. Johnson dnl and Alejandro Forero Cuervo dnl see http://www.gnu.org/software/ac-archive/htmldoc/acx_pthread.html dnl----------------------------------------------------------------------------- ACX_PTHREAD(, AC_MSG_ERROR( [pthread library not found] )) SYSTEM_INCLUDE=/usr/include dnl----------------------------------------------------------------------------- dnl link the lame library if requested dnl----------------------------------------------------------------------------- AC_SUBST(LAME_INCFLAGS) AC_SUBST(LAME_LDFLAGS) AC_ARG_WITH(lame, [ --with-lame use lame for encoding mp3 streams [yes] ], USE_LAME=${withval}, USE_LAME="yes" ) AC_ARG_WITH(lame-prefix, [ --with-lame-prefix=DIR alternate location for lame [/usr] look for libraries in LAME-PREFIX/lib, for headers in LAME-PREFIX/include], CONFIG_LAME_PREFIX="${withval}", CONFIG_LAME_PREFIX="/usr") if test "x${USE_LAME}" = "xyes" ; then AC_MSG_CHECKING( [for lame library at ${CONFIG_LAME_PREFIX}] ) LA_SEARCH_LIB( LAME_LIB_LOC, LAME_INC_LOC, libmp3lame.a libmp3lame.so, lame/lame.h, ${CONFIG_LAME_PREFIX}) if test "x${LAME_LIB_LOC}" != "x" ; then AC_DEFINE( HAVE_LAME_LIB, 1, [build with lame library] ) if test "x${LAME_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then LAME_INCFLAGS="-I${LAME_INC_LOC}" fi LAME_LDFLAGS="-L${LAME_LIB_LOC} -lmp3lame" AC_MSG_RESULT( [found at ${CONFIG_LAME_PREFIX}] ) else AC_MSG_WARN( [not found, building without lame]) fi else AC_MSG_RESULT( [building without lame] ) fi dnl----------------------------------------------------------------------------- dnl link the ogg vorbis libraries if requested dnl----------------------------------------------------------------------------- AC_SUBST(VORBIS_INCFLAGS) AC_SUBST(VORBIS_LDFLAGS) AC_ARG_WITH(vorbis, [ --with-vorbis use Ogg Vorbis for encoding vorbis streams [yes] ], USE_VORBIS=${withval}, USE_VORBIS="yes" ) AC_ARG_WITH(vorbis-prefix, [ --with-vorbis-prefix=DIR alternate location for vorbis [/usr] look for libraries in VORBIS-PREFIX/lib, for headers in VORBIS-PREFIX/include], CONFIG_VORBIS_PREFIX="${withval}", CONFIG_VORBIS_PREFIX="/usr") if test "x${USE_VORBIS}" = "xyes" ; then AC_MSG_CHECKING( [for vorbis libraries at ${CONFIG_VORBIS_PREFIX}] ) LA_SEARCH_LIB( OGG_LIB_LOC, OGG_INC_LOC, libogg.a libogg.so, ogg/ogg.h, ${CONFIG_VORBIS_PREFIX}) LA_SEARCH_LIB( VORBIS_LIB_LOC, VORBIS_INC_LOC, libvorbis.a libvorbis.so, vorbis/codec.h, ${CONFIG_VORBIS_PREFIX}) LA_SEARCH_LIB( VORBISENC_LIB_LOC, VORBISENC_INC_LOC, libvorbisenc.a libvorbisenc.so, vorbis/vorbisenc.h, ${CONFIG_VORBIS_PREFIX}) if test "x${OGG_LIB_LOC}" != "x" -a \ "x${VORBIS_LIB_LOC}" != "x" -a \ "x${VORBISENC_LIB_LOC}" != "x" ; then AC_DEFINE( HAVE_VORBIS_LIB, 1, [build with Ogg Vorbis library] ) if test "x${OGG_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then VORBIS_INCFLAGS="-I${OGG_INC_LOC}" fi VORBIS_LDFLAGS="-L${OGG_LIB_LOC} -logg -lvorbis -lvorbisenc" AC_MSG_RESULT( [found at ${CONFIG_VORBIS_PREFIX}] ) else AC_MSG_WARN( [not found, building without Ogg Vorbis]) fi else AC_MSG_RESULT( [building without Ogg Vorbis] ) fi dnl----------------------------------------------------------------------------- dnl link the ogg / opus libraries if requested dnl----------------------------------------------------------------------------- AC_SUBST(OPUS_INCFLAGS) AC_SUBST(OPUS_LDFLAGS) AC_ARG_WITH(opus, [ --with-opus use Ogg Opus for encoding opus streams [yes] ], USE_OPUS=${withval}, USE_OPUS="yes" ) AC_ARG_WITH(opus-prefix, [ --with-opus-prefix=DIR alternate location for opus [/usr] look for libraries in OPUS-PREFIX/lib, for headers in OPUS-PREFIX/include], CONFIG_OPUS_PREFIX="${withval}", CONFIG_OPUS_PREFIX="/usr") if test "x${USE_OPUS}" = "xyes" ; then AC_MSG_CHECKING( [for opus libraries at ${CONFIG_OPUS_PREFIX}] ) LA_SEARCH_LIB( OGG_LIB_LOC, OGG_INC_LOC, libogg.a libogg.so, ogg/ogg.h, ${CONFIG_OPUS_PREFIX}) LA_SEARCH_LIB( OPUS_LIB_LOC, OPUS_INC_LOC, libopus.a libopus.so, opus/opus.h, ${CONFIG_OPUS_PREFIX}) if test "x${OGG_LIB_LOC}" != "x" -a \ "x${OPUS_LIB_LOC}" != "x" ; then AC_DEFINE( HAVE_OPUS_LIB, 1, [build with Ogg Opus library] ) if test "x${OGG_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then OPUS_INCFLAGS="-I${OGG_INC_LOC}" fi OPUS_LDFLAGS="-L${OGG_LIB_LOC} -logg -lopus" AC_MSG_RESULT( [found at ${CONFIG_OPUS_PREFIX}] ) else AC_MSG_WARN( [not found, building without Ogg Opus]) fi else AC_MSG_RESULT( [building without Ogg Opus] ) fi dnl----------------------------------------------------------------------------- dnl link the faac library if requested dnl----------------------------------------------------------------------------- AC_SUBST(FAAC_INCFLAGS) AC_SUBST(FAAC_LDFLAGS) AC_ARG_WITH(faac, [ --with-faac use faac for encoding AAC streams [yes] ], USE_FAAC=${withval}, USE_FAAC="yes" ) AC_ARG_WITH(faac-prefix, [ --with-faac-prefix=DIR alternate location for faac [/usr] look for libraries in FAAC-PREFIX/lib, for headers in FAAC-PREFIX/include], CONFIG_FAAC_PREFIX="${withval}", CONFIG_FAAC_PREFIX="/usr") if test "x${USE_FAAC}" = "xyes" ; then AC_MSG_CHECKING( [for faac library at ${CONFIG_FAAC_PREFIX}] ) LA_SEARCH_LIB( FAAC_LIB_LOC, FAAC_INC_LOC, libfaac.a libfaac.so, faac.h, ${CONFIG_FAAC_PREFIX}) if test "x${FAAC_LIB_LOC}" != "x" ; then AC_DEFINE( HAVE_FAAC_LIB, 1, [build with faac library] ) if test "x${FAAC_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then FAAC_INCFLAGS="-I${FAAC_INC_LOC}" fi FAAC_LDFLAGS="-L${FAAC_LIB_LOC} -lfaac" AC_MSG_RESULT( [found at ${CONFIG_FAAC_PREFIX}] ) else AC_MSG_WARN( [not found, building without faac]) fi else AC_MSG_RESULT( [building without faac] ) fi dnl----------------------------------------------------------------------------- dnl link the aacplus library if requested dnl----------------------------------------------------------------------------- AC_SUBST(AACPLUS_INCFLAGS) AC_SUBST(AACPLUS_LDFLAGS) AC_ARG_WITH(aacplus, [ --with-aacplus use aacplus for encoding AAC HEv2 streams [yes] ], USE_AACPLUS=${withval}, USE_AACPLUS="yes" ) AC_ARG_WITH(aacplus-prefix, [ --with-aacplus-prefix=DIR alternate location for aacplus [/usr] look for libraries in AACPLUS-PREFIX/lib, for headers in AACPLUS-PREFIX/include], CONFIG_AACPLUS_PREFIX="${withval}", CONFIG_AACPLUS_PREFIX="/usr") if test "x${USE_AACPLUS}" = "xyes" ; then AC_MSG_CHECKING( [for aacplus library at ${CONFIG_AACPLUS_PREFIX}] ) LA_SEARCH_LIB( AACPLUS_LIB_LOC, AACPLUS_INC_LOC, libaacplus.a libaacplus.so, aacplus.h, ${CONFIG_AACPLUS_PREFIX}) if test "x${AACPLUS_LIB_LOC}" != "x" ; then AC_DEFINE( HAVE_AACPLUS_LIB, 1, [build with aacplus library] ) if test "x${AACPLUS_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then AACPLUS_INCFLAGS="-I${AACPLUS_INC_LOC}" fi AACPLUS_LDFLAGS="-L${AACPLUS_LIB_LOC} -laacplus" AC_MSG_RESULT( [found at ${CONFIG_AACPLUS_PREFIX}] ) else AC_MSG_WARN( [not found, building without aacplus]) fi else AC_MSG_RESULT( [building without aacplus] ) fi dnl----------------------------------------------------------------------------- dnl link the twolame library if requested dnl----------------------------------------------------------------------------- AC_SUBST(TWOLAME_INCFLAGS) AC_SUBST(TWOLAME_LDFLAGS) AC_ARG_WITH(twolame, [ --with-twolame use twolame for encoding MP2 streams [yes] ], USE_TWOLAME=${withval}, USE_TWOLAME="yes" ) AC_ARG_WITH(twolame-prefix, [ --with-twolame-prefix=DIR alternate location for twolame [/usr] look for libraries in TWOLAME-PREFIX/lib, for headers in TWOLAME-PREFIX/include], CONFIG_TWOLAME_PREFIX="${withval}", CONFIG_TWOLAME_PREFIX="/usr") if test "x${USE_TWOLAME}" = "xyes" ; then AC_MSG_CHECKING( [for twolame library at ${CONFIG_TWOLAME_PREFIX}] ) LA_SEARCH_LIB( TWOLAME_LIB_LOC, TWOLAME_INC_LOC, libtwolame.a libtwolame.so, twolame.h, ${CONFIG_TWOLAME_PREFIX}) if test "x${TWOLAME_LIB_LOC}" != "x" ; then AC_DEFINE( HAVE_TWOLAME_LIB, 1, [build with twolame library] ) if test "x${TWOLAME_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then TWOLAME_INCFLAGS="-I${TWOLAME_INC_LOC}" fi TWOLAME_LDFLAGS="-L${TWOLAME_LIB_LOC} -ltwolame" AC_MSG_RESULT( [found at ${CONFIG_TWOLAME_PREFIX}] ) else AC_MSG_WARN( [not found, building without twolame]) fi else AC_MSG_RESULT( [building without twolame] ) fi dnl----------------------------------------------------------------------------- dnl make sure at least one of lame and vorbis present dnl----------------------------------------------------------------------------- if test "x${LAME_LDFLAGS}" = "x" \ -a "x${VORBIS_LDFLAGS}" = "x" \ -a "x${FAAC_LDFLAGS}" = "x" \ -a "x${AACPLUS_LDFLAGS}" = "x" \ -a "x${TWOLAME_LDFLAGS}" = "x"; then AC_MSG_ERROR([neither lame, Ogg Vorbis, faac, aac+ nor twolame configured]) fi dnl----------------------------------------------------------------------------- dnl link ALSA sound system if requested dnl----------------------------------------------------------------------------- AC_SUBST(ALSA_INCFLAGS) AC_SUBST(ALSA_LDFLAGS) AC_ARG_WITH(alsa, [ --with-alsa use ALSA sound system [yes] ], USE_ALSA=${withval}, USE_ALSA="yes" ) AC_ARG_WITH(alsa-prefix, [ --with-alsa-prefix=DIR alternate location for ALSA [/usr] look for libraries in ALSA-PREFIX/lib, for headers in ALSA-PREFIX/include], CONFIG_ALSA_PREFIX="${withval}", CONFIG_ALSA_PREFIX="/usr") if test "x${USE_ALSA}" = "xyes" ; then AC_MSG_CHECKING( [for alsa libraries at ${CONFIG_ALSA_PREFIX}] ) LA_SEARCH_LIB( ALSA_LIB_LOC, ALSA_INC_LOC, libasound.so, alsa/asoundlib.h, ${CONFIG_ALSA_PREFIX}) if test "x${ALSA_LIB_LOC}" != "x" ; then AC_DEFINE( HAVE_ALSA_LIB, 1, [build with ALSA sound system] ) if test "x${ALSA_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then ALSA_INCFLAGS="-I${ALSA_INC_LOC}" fi ALSA_LDFLAGS="-L${ALSA_LIB_LOC} -lasound" AC_MSG_RESULT( [found at ${CONFIG_ALSA_PREFIX}] ) else AC_MSG_WARN( [not found, building without ALSA support]) fi else AC_MSG_RESULT( [building without ALSA support] ) fi dnl----------------------------------------------------------------------------- dnl link PULSEAUDIO sound system if requested dnl----------------------------------------------------------------------------- AC_SUBST(PULSEAUDIO_INCFLAGS) AC_SUBST(PULSEAUDIO_LDFLAGS) AC_ARG_WITH(pulseaudio, [ --with-pulseaudio use PULSEAUDIO sound system [yes] ], USE_PULSEAUDIO=${withval}, USE_PULSEAUDIO="yes" ) AC_ARG_WITH(pulseaudio-prefix, [ --with-pulseaudio-prefix=DIR alternate location for PULSEAUDIO [/usr] look for libraries in PULSEAUDIO-PREFIX/lib, for headers in PULSEAUDIO-PREFIX/include], CONFIG_PULSEAUDIO_PREFIX="${withval}", CONFIG_PULSEAUDIO_PREFIX="/usr") if test "x${USE_PULSEAUDIO}" = "xyes" ; then AC_MSG_CHECKING( [for pulseaudio libraries at ${CONFIG_PULSEAUDIO_PREFIX}] ) LA_SEARCH_LIB( PULSEAUDIO_LIB_LOC, PULSEAUDIO_INC_LOC, libpulse.so, pulse/pulseaudio.h, ${CONFIG_PULSEAUDIO_PREFIX}) if test "x${PULSEAUDIO_LIB_LOC}" != "x" ; then AC_DEFINE( HAVE_PULSEAUDIO_LIB, 1, [build with PULSEAUDIO sound system] ) if test "x${PULSEAUDIO_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then PULSEAUDIO_INCFLAGS="-I${PULSEAUDIO_INC_LOC}" fi PULSEAUDIO_LDFLAGS="-L${PULSEAUDIO_LIB_LOC} -lpulse-simple -L${PULSEAUDIO_LIB_LOC} -lpulse" AC_MSG_RESULT( [found at ${CONFIG_PULSEAUDIO_PREFIX}] ) else AC_MSG_WARN( [not found, building without PULSEAUDIO support]) fi else AC_MSG_RESULT( [building without PULSEAUDIO support] ) fi dnl----------------------------------------------------------------------------- dnl link JACK sound server if requested dnl----------------------------------------------------------------------------- AC_SUBST(JACK_CFLAGS) AC_SUBST(JACK_LDFLAGS) AC_SUBST(JACK_INCFLAGS) AC_ARG_WITH(jack, [ --with-jack use JACK sound system [yes] ], USE_JACK=${withval}, USE_JACK="yes" ) AC_ARG_WITH(jack-prefix, [ --with-jack-prefix=DIR alternate location for JACK [/usr] look for libraries in JACK-PREFIX/lib, for headers in JACK-PREFIX/include], CONFIG_JACK_PREFIX="${withval}", CONFIG_JACK_PREFIX="/usr") if test "x${USE_JACK}" = "xyes" ; then AC_MSG_CHECKING( [for jack libraries at ${CONFIG_JACK_PREFIX}] ) LA_SEARCH_LIB( JACK_LIB_LOC, JACK_INC_LOC, libjack.la libjack.so libjack.dylib, jack/jack.h, ${CONFIG_JACK_PREFIX}) if test "x${JACK_LIB_LOC}" != "x" ; then AC_DEFINE( HAVE_JACK_LIB, 1, [build with JACK audio server support] ) if test "x${JACK_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then JACK_INCFLAGS="-I${JACK_INC_LOC}" fi JACK_LDFLAGS="-L${JACK_LIB_LOC} -ljack" AC_MSG_RESULT( [found at ${CONFIG_JACK_PREFIX}] ) else AC_MSG_WARN( [not found, building without JACK support]) fi else AC_MSG_RESULT( [building without JACK support] ) fi dnl----------------------------------------------------------------------------- dnl link Secret Rabbit Code (aka libsamplerate) if requested dnl----------------------------------------------------------------------------- AC_SUBST(SRC_CFLAGS) AC_SUBST(SRC_LDFLAGS) AC_SUBST(SRC_INCFLAGS) AC_ARG_WITH(samplerate, [ --with-samplerate use Secret Rabbit Code (aka libsamplerate) for samplerate conversion [yes] ], USE_SRC=${withval}, USE_SRC="yes" ) AC_ARG_WITH(samplerate-prefix, [ --with-samplerate-prefix=DIR alternate location for samplerate [/usr] look for libraries in SRC-PREFIX/lib, for headers in SRC-PREFIX/include], CONFIG_SRC_PREFIX="${withval}", CONFIG_SRC_PREFIX="/usr") if test "x${USE_SRC}" = "xyes" ; then AC_MSG_CHECKING( [for samplerate libraries at ${CONFIG_SRC_PREFIX}] ) LA_SEARCH_LIB( SRC_LIB_LOC, SRC_INC_LOC, libsamplerate.la libsamplerate.so libsamplerate.dylib, samplerate.h, ${CONFIG_SRC_PREFIX}) if test "x${SRC_LIB_LOC}" != "x" ; then AC_DEFINE( HAVE_SRC_LIB, 1, [build with samplerate conversion through libsamplerate] ) if test "x${SRC_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then SRC_INCFLAGS="-I${SRC_INC_LOC}" fi SRC_LDFLAGS="-L${SRC_LIB_LOC} -lsamplerate" AC_MSG_RESULT( [found at ${CONFIG_SRC_PREFIX}] ) else AC_MSG_WARN( [not found, building libsamplerate support]) fi else AC_MSG_RESULT( [building without libsamplerate support] ) fi AM_CONDITIONAL(HAVE_SRC_LIB, test "x${SRC_LIB_LOC}" != "x") dnl----------------------------------------------------------------------------- dnl check for MSG_NOSIGNAL for the send() function in libsocket dnl----------------------------------------------------------------------------- AC_MSG_CHECKING(for MSG_NOSIGNAL) AC_TRY_COMPILE([#include ], [ int f = MSG_NOSIGNAL; ], [ # Yes, we have it... AC_MSG_RESULT(yes) AC_DEFINE(HAVE_MSG_NOSIGNAL, 1, [use MSG_NOSIGNAL for send()]) ], [ # We'll have to use signals AC_MSG_RESULT(no) ]) dnl----------------------------------------------------------------------------- dnl check for POSIX real-time scheduling dnl----------------------------------------------------------------------------- AC_CHECK_FUNCS( sched_getscheduler sched_getparam ) dnl----------------------------------------------------------------------------- dnl enable compilation with debug flags dnl----------------------------------------------------------------------------- AC_SUBST(DEBUG_CXXFLAGS) AC_ARG_WITH(debug, [ --with-debug enable debug mode [no] ], USE_DEBUG=${withval}, USE_DEBUG="no" ) if test "x${USE_DEBUG}" == "xyes" ; then DEBUG_CXXFLAGS="-g" AC_MSG_RESULT([compiling in debug mode]) else AC_MSG_RESULT([not compiling in debug mode]) fi AC_OUTPUT(Makefile src/Makefile man/Makefile) darkice-1.2/man/0000755000175000017500000000000012170707217010536 500000000000000darkice-1.2/man/Makefile.am0000644000175000017500000000007612170706611012512 00000000000000man_MANS = darkice.1 darkice.cfg.5 EXTRA_DIST = ${man_MANS} darkice-1.2/man/darkice.10000644000175000017500000000720712170706611012145 00000000000000.TH darkice 1 "November 20, 2007" "DarkIce" "DarkIce live audio streamer" .SH NAME darkice \- an icecast / shoutcast live audio streamer .SH SYNOPSIS .B darkice [options] -c config.file .SH DESCRIPTION .PP DarkIce as a live audio streamer. It records audio from an audio interface (e.g. sound card), encodes it and sends it to a streaming server. DarkIce can record from: * OSS audio devices * ALSA audio devices * Solaris audio interface * Jack sources * PulseAudio sources DarkIce can encode in the following formats: * mp3 - using the lame library * mp2 - using the twolame library * Ogg Vorbis * Ogg Opus * AAC - using the faac library * AAC HEv2 - using the libaacplus (3GPP reference code) DarkIce can send the encoded stream to the following streaming servers: * ShoutCast * IceCast 1.3.x and 2.x * Darwin Streaming Server Darkice runs on the following operating systems: * FreeBSD * Linux on intel and PowerPC * MacOS X * NetBSD / OpenBSD * SUN Solaris .B DarkIce uses .SM POSIX real-time scheduling to keep up with sound card input. .SM POSIX real-time scheduling is only available if the program is run as root. Therefore it is recommended that .B DarkIce is run as root. .SH OPTIONS .TP .BI "\-c " config.file Specifies what configuration file to use. If not specified, /etc/darkice.cfg will be used. .TP .BI "\-v " n Sets the verbosity level, between 0 and 10. 0 is silent, 10 is loud. Defaults to 1. .TP .BI "\-h " Prints the help page and exits. .SH BUGS .PP Lots of bugs. .SH "SEE ALSO" darkice.cfg(5) .SH AUTHOR Akos Maroy .I .SH ACKNOWLEDGEMENTS Developed with contributions by Jim Crilly, aNa|0Gue, Robin P. Blanchard, Tom Gray, Michael Smith, Julius O. Smith, the OSALP team, http://osalp.sourceforge.net Kristjan G. Bjarnason Nicu Pavel Kai Krakow Atsuhiko Yamanaka Ricardo Galli John Hay Christian Forster John Deeny Robert Lunnon Enrico Ardizzoni Deti Fliegl Nicholas J. Humfrey Joel Ebel Alexander Vlasov Mariusz Mazur dsk Clyde Stubbs Jens Maurer Elod Horvath Pierre Souchay Daniel Hazelbaker Alessandro Beretta Roland Hermans Rafael Diniz .SH LINKS Project homepage: .I http://code.google.com/p/darkice/ .B IceCast homepage: .I http://www.icecast.org/ .B ShoutCast homepage: .I http://www.shoutcast.com/ .B Darwin Streaming Server homepage: .I http://developer.apple.com/darwin/projects/streaming/ .B Lame homepage: .I http://www.mp3dev.org/mp3/ .B TwoLame homepage: .I http://www.twolame.org/ .B Ogg Vorbis homepage: .I http://www.xiph.org/ogg/vorbis/ .B Ogg Opus homepage .I http://www.opus-codec.org/ .B faac homepage: .I http://www.audiocoding.com/ .B libaacplus homepage: .I http://tipok.org.ua/node/17 .B DarkSnow GTK front-end: .I http://darksnow.radiolivre.org/index.en.html written by Rafael Diniz darkice-1.2/man/darkice.cfg.50000644000175000017500000004254512170706611012713 00000000000000.TH darkice.cfg 5 "February 25, 2007" "DarkIce" "DarkIce live audio streamer" .SH NAME darkice.cfg \- configuration file for darkice .SH DESCRIPTION .PP The configuration file consists of sections, with key = value pairs separated with spaces and/or tabs inside each secion: .nf [section1] # this is a whole line comment key = value an ugly key name = long value # this end is a comment too [section2] # this is a whole line comment in section 2 key = value an ugly key name = long value # this end is a comment too .fi A proper .B DarkIce configuration file contains the following sections: .nf [general] [input] [icecast-0] ... [icecast-7] [icecast2-0] ... [icecast2-7] [shoutcast-0] ... [shoutcast-7] [file-0] ... [file-7] .fi The order of the sections is not important. Sections [general] and [input] are required, and at least one of [icecast-x], [icecast2-x], [shoutcast-x] or [file-x] is needed. In particular, the following sections and values are recognized: .PP .B [general] This section describes general operational parameters (required). Required values: .TP .I duration Time for DarkIce to run, in seconds. If 0, run forever. .TP .I bufferSecs Data read from the sound card is buffered before sent to the encoder. Each buffer will be able to hold this many seconds of samples. .PP Optional values: .TP .I reconnect Try to reconnect to the server(s) if the connection is broken during streaming, "yes" or "no". (optional parameter, defaults to "yes") .TP .I realtime Use POSIX realtime scheduling, "yes" or "no". (optional parameter, defaults to "yes") .TP .I rtprio Scheduling priority for the realtime threads. (optional parameter, defaults to 4) .PP .B [input] This section describes the input (required). Required values: .TP .I device Specify the device to record from, which can be an OSS DSP device, an ALSA source, PulseAudio source or you can use Jack audio. - OSS DSP audio device to record from (e.g. /dev/dsp) - ALSA DSP device name (e.g. hwplug:0,0) - for PulseAudio use "pulseaudio" - the string 'jack', to have an unconnected Jack port, or 'jack_auto' to automatically make Jack connect to the first source. .TP .I sampleRate The sample rate to record with, samples per second (e.g. 44100 for 44.1kHz CD-quality audio, 22050 for 22kHz or 11025 for 11kHz) .TP .I bitsPerSample Number of bits to use for each sample (e.g. 8 bits or 16 bits) .TP .I channel Number of channels to record (e.g. 1 for mono, 2 for stereo) .TP .I jackClientName The name of the jack input channel created by darkice if device=jack is specified. .TP .I paSourceName The name of the PulseAudio source to use. It can be "default", an index or a device string obtained from running "pactl list" .PP .B [icecast-x] This section describes an output to an .B IceCast 1.3.x server or .B Darwin Streaming Server , while encoding with a lame encoder. There may be at most 8 outputs, numbered from 0 ... 7. The number is included in the section name (e.g. [icecast-0] ... [icecast-7]). The stream will be reachable at .I http://:/ Required values: .TP .I bitrateMode The bit rate mode of the encoding, either "cbr", "abr" or "vbr", standing for constant bit rate, average bit rate and variable bit respectively. Use the bitrate and/or quality values to specify details of the appropriate bit rate mode. .TP .I bitrate Bit rate to encode to in kBits / sec (e.g. 96). Only used when cbr or abr bit rate modes are specified. .TP .I quality The quality of encoding a value between 0.0 .. 1.0 (e.g. 0.8), with 1.0 being the highest quality. Use a value greater than 0.0. Only used when cbr or vbr bit rate modes are specified. .TP .I server The .B IceCast server's name (e.g. yp.yourserver.com) .TP .I port The port to connect to the IceCast server (e.g. 8000) .TP .I password The password to use to connect to the .B IceCast server .TP .I mountPoint Mount point for the stream on the server .PP Optional values: .TP .I sampleRate The sample rate of the encoded mp3 output. If not specified, defaults to the value of the input sample rate. .TP .I channel Number of channels for the mp3 output (e.g. 1 for mono, 2 for stereo). If not specified, defaults to the value of the input sample rate. .TP .I name Name of the stream .TP .I description Description of the stream .TP .I url Url related to the stream .TP .I genre Genre of the stream .TP .I public "yes" or "no", wether the stream is public .TP .I remoteDumpFile The file the .B IceCast server should dump the contents of this stream on its side. .TP .I localDumpFile Dump the same mp3 data sent to the .B IceCast server to this local file. .TP .I fileAddDate "yes" or "no" if you want to automaticaly insert a date string in the localDumpFile name before its extension or at the end of file name if no extension present .TP .I fileDateFormat The date format to use for appending the date to the dump file name. Defaults to "[%m-%d-%Y-%H-%M-%S]". All format strings acceptable by strftime() can be used, see the strftime man page for details. Only applicable is fileAddDate is "true". .TP .I lowpass Lowpass filter setting for the lame encoder, in Hz. Frequencies above the specified value will be cut. If not set or set to 0, the encoder's default behaviour is used. If set to -1, the filter is disabled. .TP .I highpass Highpass filter setting for the lame encoder, in Hz. Frequencies below the specified value will be cut. If not set or set to 0, the encoder's default behaviour is used. If set to -1, the filter is disabled. .PP .B [icecast2-x] This section describes an output to an .B IceCast2 server, while encoding with the ogg vobis encoder. There may be at most 8 outputs, numbered from 0 ... 7. The number is included in the section name (e.g. [icecast2-0] ... [icecast2-7]). The stream will be reachable at .I http://:/ .P .B DarkIce supports both fixed bitrate and variable bitrate vorbis streams. When using fixed bitrate, specify the bitrate using the .I bitrate field. When using variable bitrate, specify the quality of the stream by the .I quality field, which is a value between 0.0 and 1.0. Required values: .TP .I format Format of the stream sent to the .B IceCast2 server. Supported formats are 'vorbis', 'opus', 'mp3', 'mp2', 'aac' and 'aacp'. .TP .I bitrateMode The bit rate mode of the encoding, either "cbr", "abr" or "vbr", standing for constant bit rate, average bit rate and variable bit respectively. Use the bitrate and/or quality values to specify details of the appropriate bit rate mode. Ogg Opus only supports 'cbr' and 'abr'. .TP .I bitrate Bit rate to encode to in kBits / sec (e.g. 96). Only used when cbr or abr bit rate modes are specified. .TP .I quality The quality of encoding a value between 0.0 .. 1.0 (e.g. 0.8), with 1.0 being the highest quality. Use a value greater than 0.0. Only used when vbr bit rate mode is specified for Ogg Vorbis format, or in vbr and abr modes for mp3 and mp2 format. .TP .I server The .B IceCast2 server's name (e.g. yp.yourserver.com) .TP .I port The port to connect to the IceCast server (e.g. 8000) .TP .I password The password to use to connect to the .B IceCast2 server .TP .I mountPoint Mount point for the stream on the server .PP Optional values: .TP .I sampleRate The sample rate of the encoded output. If not specified, defaults to the value of the input sample rate. Please note that Ogg Opus only supports 48kHz sample rate, and will resample to this rate. .TP .I channel Number of channels for the output (e.g. 1 for mono, 2 for stereo). If not specified, defaults to the value of the input sample rate. Different channels for input and output are only supported for mp3, but not for Ogg Vorbis. .TP .I maxBitrate The maximum bitrate of the stream. Only used when in cbr mode and in Ogg Vorbis format. .TP .I name Name of the stream .TP .I description Description of the stream .TP .I url Url related to the stream .TP .I genre Genre of the stream .TP .I public "yes" or "no", wether the stream is public .TP .I localDumpFile Dump the same Ogg Vorbis data sent to the .B IceCast2 server to this local file. .TP .I fileAddDate "yes" or "no" if you want to automaticaly insert a date string in the localDumpFile name before its extension or at the end of file name if no extension present .TP .I fileDateFormat The date format to use for appending the date to the dump file name. Defaults to "[%m-%d-%Y-%H-%M-%S]". All format strings acceptable by strftime() can be used, see the strftime man page for details. Only applicable is fileAddDate is "true". .TP .I lowpass Lowpass filter setting for the lame encoder, in Hz. Frequencies above the specified value will be cut. If not set or set to 0, the encoder's default behaviour is used. If set to -1, the filter is disabled. Only has effect if the mp3 or mp2 format is used. .TP .I highpass Highpass filter setting for the lame encoder, in Hz. Frequencies below the specified value will be cut. If not set or set to 0, the encoder's default behaviour is used. If set to -1, the filter is disabled. Only has effect if the mp3 or mp2 format is used. .PP .B [shoutcast-x] This section describes an output to a .B ShoutCast server, while encoding with a lame encoder. There may be at most 8 outputs, numbered from 0 ... 7. The number is included in the section name (e.g. [shoutcast-0] ... [shoutcast-7]). The stream will be reachable at .I http://:/ Required values: .TP .I bitrateMode The bit rate mode of the encoding, either "cbr", "abr" or "vbr", standing for constant bit rate, average bit rate and variable bit respectively. Use the bitrate and/or quality values to specify details of the appropriate bit rate mode. .TP .I bitrate Bit rate to encode to in kBits / sec (e.g. 96). Only used when cbr or abr bit rate modes are specified. .TP .I quality The quality of encoding a value between 0.0 .. 1.0 (e.g. 0.8), with 1.0 being the highest quality. Use a value greater than 0.0. Only used when cbr or vbr bit rate modes are specified. .TP .I server The .B ShoutCast server's name (e.g. yp.yourserver.com) .TP .I port The source port to connect to the ShoutCast server (e.g. 8001) .TP .I password The password to use to connect to the .B ShoutCast server .PP Optional values: .TP .I mountPoint Mount point for the stream on the server. Only works on Darwin Streaming Server, the original Shoutcast server does not support mount points .TP .I sampleRate The sample rate of the encoded mp3 output. If not specified, defaults to the value of the input sample rate. .TP .I channel Number of channels for the mp3 output (e.g. 1 for mono, 2 for stereo). If not specified, defaults to the value of the input sample rate. .TP .I name Name of the stream .TP .I url Url related to the stream .TP .I genre Genre of the stream .TP .I public "yes" or "no", wether the stream is public .TP .I irc IRC information related to the stream .TP .I aim AIM information related to the stream .TP .I icq ICQ information related to the stream .TP .I lowpass Lowpass filter setting for the lame encoder, in Hz. Frequencies above the specified value will be cut. If not set or set to 0, the encoder's default behaviour is used. If set to -1, the filter is disabled. .TP .I highpass Highpass filter setting for the lame encoder, in Hz. Frequencies below the specified value will be cut. If not set or set to 0, the encoder's default behaviour is used. If set to -1, the filter is disabled. .TP .I localDumpFile Dump the same mp3 data sent to the .B ShoutCast server to this local file. .TP .I fileAddDate "yes" or "no" if you want to automaticaly insert a date string in the localDumpFile name before its extension or at the end of file name if no extension present .TP .I fileDateFormat The date format to use for appending the date to the dump file name. Defaults to "[%m-%d-%Y-%H-%M-%S]". All format strings acceptable by strftime() can be used, see the strftime man page for details. Only applicable is fileAddDate is "true". .PP .B [file-x] This section describes an output to a local file in either Ogg Vorbis or mp3 format. There may be at most 8 outputs, numbered from 0 ... 7. The number is included in the section name (e.g. [file-0] ... [file-7]). Required values: .TP .I format Format to encode in. Must be either 'mp3', 'mp2', 'vorbis', 'opus', 'aac' or 'aacp'. .TP .I bitrateMode The bit rate mode of the encoding, either "cbr", "abr" or "vbr", standing for constant bit rate, average bit rate and variable bit respectively. Use the bitrate and/or quality values to specify details of the appropriate bit rate mode. .TP .I bitrate Bit rate to encode to in kBits / sec (e.g. 96). Only used when cbr or abr bit rate modes are specified. .TP .I quality The quality of encoding a value between 0.0 .. 1.0 (e.g. 0.8), with 1.0 being the highest quality. Use a value greater than 0.0. Only used when cbr or vbr bit rate modes are specified. .TP .I fileName The name of the local file to save the encoded data into. .PP Optional values: .TP .I sampleRate The sample rate of the encoded mp3 output. If not specified, defaults to the value of the input sample rate. Only used if the output format is mp3. .TP .I lowpass Lowpass filter setting for the lame encoder, in Hz. Frequencies above the specified value will be cut. If not set or set to 0, the encoder's default behaviour is used. If set to -1, the filter is disabled. Only used if the output format is mp3. .TP .I highpass Highpass filter setting for the lame encoder, in Hz. Frequencies below the specified value will be cut. If not set or set to 0, the encoder's default behaviour is used. If set to -1, the filter is disabled. Only used if the output format is mp3. .PP A sample configuration file follows. This file makes .B DarkIce stream for 1 minute (60 seconds) from the audio device .I /dev/dsp at 22.05kHz, 16 bit stereo. It will build up a connection to the .B IceCast server yp.yourserver.com on port 8000 with the password "hackme". The stream will be encoded to 96 kb/s mp3 with quality 0.8, and will be reachable at .I http://yp.yourserver.com:8000/live96 to mp3 players. The encoding session will be stored by .B IceCast in the file .I /tmp/server-dump.mp3 on the server side, and also by .B DarkIce in the file .I /tmp/encoder-dump.mp3 on the encoder side. .nf [general] duration = 60 bufferSecs = 5 [input] device = /dev/dsp sampleRate = 22050 bitsPerSample = 16 channel = 2 [icecast-0] bitrateMode = cbr bitrate = 96 quality = 0.8 server = yp.yourserver.com port = 8000 password = hackme mountPoint = live96 name = DarkIce trial description = This is only a trial url = http://www.yourserver.com genre = live public = no remoteDumpFile = /tmp/server-dump.mp3 localDumpFile = /tmp/encoder-dump.mp3 fileAddDate = no .fi .PP The following sample configuration file simply encodes the 16 bit stereo 44.1 kHz sound card input into Ogg Vorbis at average bit rate 96 kb/s for 60 seconds, and saves it in the local file at /tmp/save.ogg. .nf [general] duration = 60 bufferSecs = 5 [input] device = /dev/dsp sampleRate = 44100 bitsPerSample = 16 channel = 2 [file-0] format = vorbis bitrateMode = abr bitrate = 96 fileName = /tmp/save.ogg .fi .PP A bit more complicated sample follows. This one makes .B DarkIce stream for 1 hour (3600 seconds) from the audio device .I /dev/dsp at 44.1kHz, 16 bit stereo. It will build up a connection to an .B IceCast server yp.your-ice-server.com on port 8000 with the password "ice-hackme". The sound for this stream will be cut at 10500 Hz from above. The stream will be encoded to average bit rate 96 kb/s mp3 and resampled to 22.05kHz and 1 channel (mono). The stream will be reachable at .I http://yp.your-ice-server.com:8000/live96 to mp3 players. The encoding session will be stored by .B IceCast in the file .I /tmp/live96.mp3 on the server side. It will also connect to a .I ShoutCast server at yp.your-shout-server.com on port 8001 with the password "shout-hackme" This stream will be encoded to constant bit rate 128 kb/s mp3 with quality 0.8, and will be reachable at .I http://yp.your-shout-server.com:8000 to mp3 players. .nf [general] duration = 3600 bufferSecs = 5 [input] device = /dev/dsp sampleRate = 22050 bitsPerSample = 16 channel = 2 [icecast-0] sampleRate = 22050 channel = 1 bitrateMode = abr bitrate = 96 lowpass = 10500 server = yp.your-ice-server.com port = 8000 password = ice-hackme mountPoint = live96 name = DarkIce trial description = This is only a trial url = http://www.yourserver.com genre = live public = yes remoteDumpFile = /tmp/live96.mp3 [shoutcast-0] bitrateMode = cbr bitrate = 128 quality = 0.8 server = yp.your-shout-server.com port = 8001 password = shout-hackme name = DarkIce trial url = http://www.yourserver.com genre = live public = yes irc = irc.yourserver.com aim = aim here icq = I see you too .fi .SH BUGS .PP Lots of bugs. .SH "SEE ALSO" darkice(1) .SH AUTHOR Akos Maroy .I .SH LINKS Project homepage: .I http://code.google.com/p/darkice/ .B IceCast homepage: .I http://www.icecast.org/ .B ShoutCast homepage: .I http://www.shoutcast.com/ .B Lame homepage: .I http://www.mp3dev.org/mp3/ .B Ogg Vorbis homepage: .I http://www.xiph.org/ogg/vorbis/ .B Ogg Opus homepage: .I http://www.opus-codec.org/ darkice-1.2/man/Makefile.in0000644000175000017500000003753412170707117012536 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = man DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } man1dir = $(mandir)/man1 am__installdirs = "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man5dir)" man5dir = $(mandir)/man5 NROFF = nroff MANS = $(man_MANS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) AACPLUS_INCFLAGS = @AACPLUS_INCFLAGS@ AACPLUS_LDFLAGS = @AACPLUS_LDFLAGS@ ACLOCAL = @ACLOCAL@ ALSA_INCFLAGS = @ALSA_INCFLAGS@ ALSA_LDFLAGS = @ALSA_LDFLAGS@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG_CXXFLAGS = @DEBUG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FAAC_INCFLAGS = @FAAC_INCFLAGS@ FAAC_LDFLAGS = @FAAC_LDFLAGS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JACK_CFLAGS = @JACK_CFLAGS@ JACK_INCFLAGS = @JACK_INCFLAGS@ JACK_LDFLAGS = @JACK_LDFLAGS@ LAME_INCFLAGS = @LAME_INCFLAGS@ LAME_LDFLAGS = @LAME_LDFLAGS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ OPUS_INCFLAGS = @OPUS_INCFLAGS@ OPUS_LDFLAGS = @OPUS_LDFLAGS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PULSEAUDIO_INCFLAGS = @PULSEAUDIO_INCFLAGS@ PULSEAUDIO_LDFLAGS = @PULSEAUDIO_LDFLAGS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SRC_CFLAGS = @SRC_CFLAGS@ SRC_INCFLAGS = @SRC_INCFLAGS@ SRC_LDFLAGS = @SRC_LDFLAGS@ STRIP = @STRIP@ TWOLAME_INCFLAGS = @TWOLAME_INCFLAGS@ TWOLAME_LDFLAGS = @TWOLAME_LDFLAGS@ VERSION = @VERSION@ VORBIS_INCFLAGS = @VORBIS_INCFLAGS@ VORBIS_LDFLAGS = @VORBIS_LDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ man_MANS = darkice.1 darkice.cfg.5 EXTRA_DIST = ${man_MANS} all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu man/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu man/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-man1: $(man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(man_MANS)'; \ test -n "$(man1dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.1[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ done; } uninstall-man1: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) install-man5: $(man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(man_MANS)'; \ test -n "$(man5dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man5dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man5dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.5[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man5dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man5dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man5dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man5dir)" || exit $$?; }; \ done; } uninstall-man5: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man5dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.5[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man5dir)'; $(am__uninstall_files_from_dir) tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @list='$(MANS)'; if test -n "$$list"; then \ list=`for p in $$list; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ if test -n "$$list" && \ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ echo " typically \`make maintainer-clean' will remove them" >&2; \ exit 1; \ else :; fi; \ else :; fi @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(MANS) installdirs: for dir in "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man5dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-man install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-man1 install-man5 install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-man uninstall-man: uninstall-man1 uninstall-man5 .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-man1 install-man5 install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am uninstall uninstall-am uninstall-man \ uninstall-man1 uninstall-man5 # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: darkice-1.2/darkice.cfg0000644000175000017500000001021412170706611011761 00000000000000# sample DarkIce configuration file, edit for your needs before using # see the darkice.cfg man page for details # this section describes general aspects of the live streaming session [general] duration = 60 # duration of encoding, in seconds. 0 means forever bufferSecs = 5 # size of internal slip buffer, in seconds reconnect = yes # reconnect to the server(s) if disconnected realtime = yes # run the encoder with POSIX realtime priority rtprio = 3 # scheduling priority for the realtime threads # this section describes the audio input that will be streamed [input] device = /dev/dsp # OSS DSP soundcard device for the audio input sampleRate = 22050 # sample rate in Hz. try 11025, 22050 or 44100 bitsPerSample = 16 # bits per sample. try 16 channel = 2 # channels. 1 = mono, 2 = stereo # this section describes a streaming connection to an IceCast2 server # there may be up to 8 of these sections, named [icecast2-0] ... [icecast2-7] # these can be mixed with [icecast-x] and [shoutcast-x] sections [icecast2-0] bitrateMode = abr # average bit rate format = vorbis # format of the stream: ogg vorbis bitrate = 96 # bitrate of the stream sent to the server server = yp.yourserver.com # host name of the server port = 8000 # port of the IceCast2 server, usually 8000 password = hackme # source password to the IceCast2 server mountPoint = sample96 # mount point of this stream on the IceCast2 server name = DarkIce trial # name of the stream description = This is only a trial # description of the stream url = http://www.yourserver.com # URL related to the stream genre = my own # genre of the stream public = yes # advertise this stream? localDumpFile = dump.ogg # local dump file # this section describes a streaming connection to an IceCast server # there may be up to 8 of these sections, named [icecast-0] ... [icecast-7] # these can be mixed with [icecast2-x] and [shoutcast-x] sections [icecast-0] bitrateMode = cbr # constant bit rate bitrate = 96 # bitrate of the mp3 stream sent to the server quality = 0.8 # encoding quality server = yp.yourserver.com # host name of the server port = 8000 # port of the IceCast server, usually 8000 password = hackme # source password to the IceCast server mountPoint = sample96 # mount point of this stream on the IceCast server name = DarkIce trial # name of the stream description = This is only a trial # description of the stream url = http://www.yourserver.com # URL related to the stream genre = my own # genre of the stream public = yes # advertise this stream? # this section describes a streaming connection to a ShoutCast server # there may be up to 8 of these sections, named [shoutcast-0] ... [shoutcast-7] # these can be mixed with [icecast-x] and [icecast2-x] sections [shoutcast-0] bitrateMode = vbr # variable bit rate mode quality = 0.5 # encoding quality server = yp.yourserver.com # host name of the server port = 8001 # source port of the ShoutCast server, usually 8001 password = hackme # source password to the ShoutCast server name = DarkIce trial # name of the stream url = http://www.yourserver.com # URL related to the stream genre = my own # genre of the stream public = yes # advertise this stream? irc = irc.yourserver.com # IRC info related to the stream aim = aim here # AIM info related to the stream icq = I see you too # ICQ info related to the stream darkice-1.2/src/0000755000175000017500000000000012170707217010552 500000000000000darkice-1.2/src/ConfigSection.h0000644000175000017500000001240712170706662013404 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell ConfigSection File : ConfigSection.h Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/ConfigSection.h $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef CONFIG_SECTION_H #define CONFIG_SECTION_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include #include #include "Referable.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * A configuration file representation. The file is of the syntax: * *
 *  # this is a whole line comment
 *  key = value
 *  an ugly key name = long value    # this end is a comment too
 *  
* * also empty lines are ignored and all white space is removed * from the front and end of keys / values * * Knwon problem: you can't use '#' in any part of a key / value pair * * @author $Author: rafael@riseup.net $ * @version $Revision: 553 $ */ class ConfigSection : public virtual Referable { private: /** * Type of the hash table used in this class. */ typedef std::map TableType; /** * Hash table holding the configuration information. */ TableType table; protected: public: /** * Default constructor. * * @exception Exception */ inline ConfigSection ( void ) throw ( Exception ) { } /** * Destructor. * * @exception Exception */ inline virtual ~ConfigSection ( void ) throw ( Exception ) { } /* TODO inline ConfigSection ( const ConfigSection & di ) throw ( Exception ) { } inline ConfigSection & operator= ( const ConfigSection * di ) throw ( Exception ) { } */ /** * Add a key / value pair to the configuration information. * * @param key the key to add the value by * @param value the value to add for the key * @return true if adding was successful, false otherwise * @exception Exception */ virtual bool add ( const char * key, const char * value ) throw ( Exception ); /** * Get a value for a key. * * @param key the key to get the value for * @return the value for the key, or NULL if the key doesn't exist. * @exception Exception */ virtual const char * get ( const char * key ) const throw ( Exception ); /** * Get a value for a key, or throw an Exception. * * @param key the key to get the value for * @param message1 message part 1 of the Exception to be thrown. * @param message2 message part 2 of the Exception to be thrown. * @param code error code of the Exception to be thrown. * @return the value for the key. The return value is never NULL. * @exception Exception */ virtual const char * getForSure ( const char * key, const char * message1 = 0, const char * message2 = 0, int code = 0 ) const throw ( Exception ); /** * Add a line of configuration information. * * @param line the line to add. * @return true if a new key was added, false otherwise. * @exception Exception */ virtual bool addLine ( const char * line ) throw ( Exception ); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* CONFIG_SECTION_H */ darkice-1.2/src/CastSink.h0000644000175000017500000003114512170706662012371 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : CastSink.h Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/CastSink.h $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef CAST_SINK_H #define CAST_SINK_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include "Ref.h" #include "Reporter.h" #include "Sink.h" #include "TcpSocket.h" #include "BufferedSink.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * Data output to a ShoutCast / IceCast / etc. server * This is an abstract class. A subclass should override at least * the sendLogin() function. * * @author $Author: rafael@riseup.net $ * @version $Revision: 553 $ */ class CastSink : public Sink, public virtual Reporter { private: /** * The socket connection to the server. */ Ref socket; /** * An optional Sink to enable stream dumps. */ Ref streamDump; /** * Password to the server. */ char * password; /** * Name of the stream. */ char * name; /** * URL associated with the stream. */ char * url; /** * Genre of the stream. */ char * genre; /** * Bitrate of the stream (e.g. mp3 bitrate). */ unsigned int bitRate; /** * Is the stream public? */ bool isPublic; /** * Initalize the object. * * @param socket socket connection to the server. * @param password password to the server. * @param name name of the stream. * @param url URL associated with the stream. * @param genre genre of the stream. * @param bitRate bitrate of the stream (e.g. mp3 bitrate). * @param isPublic is the stream public? * @exception Exception */ void init ( TcpSocket * socket, Sink * streamDump, const char * password, unsigned int bitRate, const char * name, const char * url, const char * genre, bool isPublic) throw ( Exception ); /** * De-initalize the object. * * @exception Exception */ void strip ( void ) throw ( Exception ); protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline CastSink ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } /** * Log in to the server using the socket avialable. * * @return true if login was successful, false otherwise. * @exception Exception */ virtual bool sendLogin ( void ) throw ( Exception ) = 0; /** * Get the Sink underneath this CastSink. * * @return pointer to the Sink underneath this CastSink. */ inline Sink * getSink ( void ) const throw () { return getSocket(); } /** * Get the TcpSocket underneath this CastSink. * * @return pointer to the TcpSocket underneath this CastSink. */ inline TcpSocket * getSocket ( void ) const throw () { return socket.get(); } public: /** * Constructor. * * @param socket socket connection to the server. * @param password password to the server. * @param name name of the stream. * @param url URL associated with the stream. * @param genre genre of the stream. * @param bitRate bitrate of the stream (e.g. mp3 bitrate). * @param isPublic is the stream public? * @param streamDump a Sink to dump the streamed binary data to * * @exception Exception */ inline CastSink ( TcpSocket * socket, const char * password, unsigned int bitRate, const char * name = 0, const char * url = 0, const char * genre = 0, bool isPublic = false, Sink * streamDump = 0) throw ( Exception ) { init( socket, streamDump, password, bitRate, name, url, genre, isPublic ); } /** * Copy constructor. * * @param cs the CastSink to copy. */ inline CastSink( const CastSink & cs ) throw ( Exception ) : Sink( cs ) { init( cs.socket.get(), cs.streamDump.get(), cs.password, cs.bitRate, cs.name, cs.url, cs.genre, cs.isPublic ); } /** * Destructor. * * @exception Exception */ inline virtual ~CastSink( void ) throw ( Exception ) { strip(); } /** * Assignment operator. * * @param cs the CastSink to assign this to. * @return a reference to this CastSink. * @exception Exception */ inline virtual CastSink & operator= ( const CastSink & cs ) throw ( Exception ) { if ( this != &cs ) { strip(); Sink::operator=( cs ); init( cs.socket.get(), cs.streamDump.get(), cs.password, cs.bitRate, cs.name, cs.url, cs.genre, cs.isPublic ); } return *this; } /** * Open the CastSink. * Logs in to the server. * * @return true if opening was successfull, false otherwise. * @exception Exception */ virtual bool open ( void ) throw ( Exception ); /** * Check if the CastSink is open. * * @return true if the CastSink is open, false otherwise. */ inline virtual bool isOpen ( void ) const throw () { if( !getSink() ) { return false; } return getSink()->isOpen(); } /** * Check if the CastSink is ready to accept data. * Blocks until the specified time for data to be available. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true if the CastSink is ready to accept data, * false otherwise. * @exception Exception */ inline virtual bool canWrite ( unsigned int sec, unsigned int usec ) throw ( Exception ) { return getSink()->canWrite( sec, usec); } /** * Write data to the CastSink. * * @param buf the data to write. * @param len number of bytes to write from buf. * @return the number of bytes written (may be less than len). * @exception Exception */ inline virtual unsigned int write ( const void * buf, unsigned int len ) throw ( Exception ) { if ( streamDump != 0 ) { streamDump->write( buf, len); } return getSink()->write( buf, len); } /** * Flush all data that was written to the CastSink to the server. * * @exception Exception */ inline virtual void flush ( void ) throw ( Exception ) { if ( streamDump != 0 ) { streamDump->flush(); } return getSink()->flush(); } /** * Cut what the sink has been doing so far, and start anew. * This usually means separating the data sent to the sink up * until now, and start saving a new chunk of data. */ inline virtual void cut ( void ) throw () { if ( streamDump != 0 ) { streamDump->cut(); } } /** * Close the CastSink. * * @exception Exception */ inline virtual void close ( void ) throw ( Exception ) { if ( streamDump != 0 ) { streamDump->close(); } return getSink()->close(); } /** * Get the password to the server. * * @return the password to the server. */ inline const char * getPassword ( void ) const throw () { return password; } /** * Get the name of the stream. * * @return the name of the stream. */ inline const char * getName ( void ) const throw () { return name; } /** * Get the URL associated with the stream. * * @return the URL associated with the stream. */ inline const char * getUrl ( void ) const throw () { return url; } /** * Get the genre of the stream. * * @return the genre of the stream. */ inline const char * getGenre ( void ) const throw () { return genre; } /** * Get the bitrate of the stream (e.g. mp3 bitrate). * * @return the bitrate of the stream (e.g. mp3 bitrate). */ inline unsigned int getBitRate ( void ) const throw () { return bitRate; } /** * Get wether this stream is public. * * @return true if the stream is public, false otherwise. */ inline bool getIsPublic ( void ) const throw () { return isPublic; } }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* CAST_SINK_H */ darkice-1.2/src/SerialUlaw.h0000644000175000017500000001700012170706662012714 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Copyright (c) 2007 Clyde Stubbs Tyrell DarkIce File : SerialUlaw.h Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/SerialUlaw.h $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef SERIAL_ULAW_SOURCE_H #define SERIAL_ULAW_SOURCE_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include "Reporter.h" #include "AudioSource.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * An audio input based on /dev/dsp-like raw devices * * @author $Author: rafael@riseup.net $ * @version $Revision: 553 $ */ class SerialUlaw : public AudioSource, public virtual Reporter { private: /** * The file name of the OSS DSP device (e.g. /dev/dsp or /dev/dsp0). */ char * fileName; /** * The low-level file descriptor of the OSS DSP device. */ int fileDescriptor; /** * Indicates wether the low-level OSS DSP device is in a recording * state. */ bool running; protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline SerialUlaw ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } /** * Initialize the object * * @param name the file name of the OSS DSP device. * @exception Exception */ void init ( const char * name ) throw ( Exception ); /** * De-iitialize the object * * @exception Exception */ void strip ( void ) throw ( Exception ); public: /** * Constructor. * * @param name the file name of the OSS DSP device * (e.g. /dev/dsp or /dev/dsp0). * @param sampleRate samples per second (e.g. 44100 for 44.1kHz). * @param bitsPerSample bits per sample (e.g. 16 bits). * @param channel number of channels of the audio source * (e.g. 1 for mono, 2 for stereo, etc.). * @exception Exception */ inline SerialUlaw ( const char * name, int sampleRate = 44100, int bitsPerSample = 16, int channel = 2 ) throw ( Exception ) : AudioSource( sampleRate, bitsPerSample, channel) { init( name); } /** * Copy Constructor. * * @param ods the object to copy. * @exception Exception */ inline SerialUlaw ( const SerialUlaw & ods ) throw ( Exception ) : AudioSource( ods ) { init( ods.fileName); } /** * Destructor. * * @exception Exception */ inline virtual ~SerialUlaw ( void ) throw ( Exception ) { strip(); } /** * Assignment operator. * * @param ds the object to assign to this one. * @return a reference to this object. * @exception Exception */ inline virtual SerialUlaw & operator= ( const SerialUlaw & ds ) throw ( Exception ) { if ( this != &ds ) { strip(); AudioSource::operator=( ds); init( ds.fileName); } return *this; } /** * Tell if the data from this source comes in big or little endian. * * @return true if the source is big endian, false otherwise */ virtual bool isBigEndian ( void ) const throw (); /** * Open the SerialUlaw. * This does not put the OSS DSP device into recording mode. * To start getting samples, call either canRead() or read(). * * @return true if opening was successful, false otherwise * @exception Exception * * @see #canRead * @see #read */ virtual bool open ( void ) throw ( Exception ); /** * Check if the SerialUlaw is open. * * @return true if the SerialUlaw is open, false otherwise. */ inline virtual bool isOpen ( void ) const throw () { return fileDescriptor != 0; } /** * Check if the SerialUlaw can be read from. * Blocks until the specified time for data to be available. * Puts the OSS DSP device into recording mode. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true if the SerialUlaw is ready to be read from, * false otherwise. * @exception Exception */ virtual bool canRead ( unsigned int sec, unsigned int usec ) throw ( Exception ); /** * Read from the SerialUlaw. * Puts the OSS DSP device into recording mode. * * @param buf the buffer to read into. * @param len the number of bytes to read into buf * @return the number of bytes read (may be less than len). * @exception Exception */ virtual unsigned int read ( void * buf, unsigned int len ) throw ( Exception ); /** * Close the SerialUlaw. * * @exception Exception */ virtual void close ( void ) throw ( Exception ); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* SERIAL_ULAW_SOURCE_H */ darkice-1.2/src/IceCast.cpp0000644000175000017500000001511112170706662012513 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : IceCast.cpp Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/IceCast.cpp $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_STDIO_H #include #else #error need stdio.h #endif #ifdef HAVE_STRING_H #include #else #error need string.h #endif #ifdef HAVE_MATH_H #include #else #error need math.h #endif #include "Exception.h" #include "Source.h" #include "Sink.h" #include "Util.h" #include "IceCast.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: IceCast.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $"; /*------------------------------------------------------------------------------ * Size of string conversion buffer *----------------------------------------------------------------------------*/ #define STRBUF_SIZE 32 /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Initialize the object *----------------------------------------------------------------------------*/ void IceCast :: init ( const char * mountPoint, const char * description, const char * remoteDumpFile ) throw ( Exception ) { this->mountPoint = Util::strDup( mountPoint); this->description = description ? Util::strDup( description) : 0; this->remoteDumpFile = remoteDumpFile ? Util::strDup( remoteDumpFile) : 0; } /*------------------------------------------------------------------------------ * De-initialize the object *----------------------------------------------------------------------------*/ void IceCast :: strip ( void ) throw ( Exception ) { delete[] mountPoint; if ( description ) { delete[] description; } if ( remoteDumpFile ) { delete[] remoteDumpFile; } } /*------------------------------------------------------------------------------ * Log in to the IceCast server *----------------------------------------------------------------------------*/ bool IceCast :: sendLogin ( void ) throw ( Exception ) { Sink * sink = getSink(); Source * source = getSocket(); const char * str; char resp[STRBUF_SIZE]; unsigned int len; if ( !source->isOpen() ) { return false; } if ( !sink->isOpen() ) { return false; } /* send the request, a string like: * "SOURCE /\n" */ str = "SOURCE "; sink->write( str, strlen( str)); str = getPassword(); sink->write( str, strlen( str)); str = " /"; sink->write( str, strlen( str)); str = getMountPoint(); sink->write( str, strlen( str)); /* send the x-audiocast headers */ str = "\nx-audiocast-bitrate: "; sink->write( str, strlen( str)); if ( log10(getBitRate()) >= (STRBUF_SIZE-2) ) { throw Exception( __FILE__, __LINE__, "bitrate does not fit string buffer", getBitRate()); } sprintf( resp, "%d", getBitRate()); sink->write( resp, strlen( resp)); str = "\nx-audiocast-public: "; sink->write( str, strlen( str)); str = getIsPublic() ? "1" : "0"; sink->write( str, strlen( str)); if ( getName() ) { str = "\nx-audiocast-name: "; sink->write( str, strlen( str)); str = getName(); sink->write( str, strlen( str)); } if ( getDescription() ) { str = "\nx-audiocast-description: "; sink->write( str, strlen( str)); str = getDescription(); sink->write( str, strlen( str)); } if ( getUrl() ) { str = "\nx-audiocast-url: "; sink->write( str, strlen( str)); str = getUrl(); sink->write( str, strlen( str)); } if ( getGenre() ) { str = "\nx-audiocast-genre: "; sink->write( str, strlen( str)); str = getGenre(); sink->write( str, strlen( str)); } if ( getRemoteDumpFile() ) { str = "\nx-audiocast-dumpfile: "; sink->write( str, strlen( str)); str = getRemoteDumpFile(); sink->write( str, strlen( str)); } str = "\n\n"; sink->write( str, strlen( str)); sink->flush(); /* read the anticipated response: "OK" */ len = source->read( resp, STRBUF_SIZE); reportEvent(5,resp); if ( Util::strEq( resp, "ERROR - Bad Password",20) ) { throw Exception( __FILE__, __LINE__, "Icecast - wrong password"); } if ( Util::strEq( resp, "ERROR - Mount Point Taken or Inv",32) ) { throw Exception( __FILE__, __LINE__, "Icecast - Mount point taken or invalid"); } if ( len < 2 || resp[0] != 'O' || resp[1] != 'K' ) { return false; } /* suck anything that the other side has to say */ while ( source->canRead( 0, 0) && (len = source->read( resp, STRBUF_SIZE)) ) { ; } return true; } darkice-1.2/src/FaacEncoder.h0000644000175000017500000004223012170706662013001 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : FaacEncoder.h Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/FaacEncoder.h $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef AAC_ENCODER_H #define AAC_ENCODER_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_FAAC_LIB #include #else #error configure with faac #endif #include "Ref.h" #include "Exception.h" #include "Reporter.h" #include "AudioEncoder.h" #include "Sink.h" #ifdef HAVE_SRC_LIB #include #else #include "aflibConverter.h" #endif /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * A class representing faac AAC encoder. * * @author $Author: rafael@riseup.net $ * @version $Revision: 553 $ */ class FaacEncoder : public AudioEncoder, public virtual Reporter { private: /** * A flag to indicate if the encoding session is open. */ bool faacOpen; /** * The handle to the AAC encoder instance. */ faacEncHandle encoderHandle; /** * The maximum number of input samples to supply to the encoder. */ unsigned long inputSamples; /** * The maximum number of output bytes the encoder returns in one call. */ unsigned long maxOutputBytes; /** * Lowpass filter. Sound frequency in Hz, from where up the * input is cut. */ int lowpass; /** * Resample ratio */ double resampleRatio; /** * sample rate converter object for possible resampling */ #ifdef HAVE_SRC_LIB SRC_STATE *converter; SRC_DATA converterData; float *resampledOffset; #else aflibConverter *converter; short *resampledOffset; #endif unsigned int resampledOffsetSize; /** * Initialize the object. * * @param lowpass frequency threshold for the lowpass filter. * Input above this frequency is cut. * If 0, faac's default values are used, * which depends on the out sample rate. * @exception Exception */ inline void init ( int lowpass) throw (Exception) { this->faacOpen = false; this->lowpass = lowpass; if ( getInBitsPerSample() != 16 && getInBitsPerSample() != 8 ) { throw Exception( __FILE__, __LINE__, "specified bits per sample not supported", getInBitsPerSample() ); } if ( getInChannel() != 1 && getInChannel() != 2 ) { throw Exception( __FILE__, __LINE__, "unsupported number of input channels for the encoder", getInChannel() ); } if ( getOutChannel() != 1 && getOutChannel() != 2 ) { throw Exception( __FILE__, __LINE__, "unsupported number of output channels for the encoder", getOutChannel() ); } if ( getInChannel() != getOutChannel() ) { throw Exception( __FILE__, __LINE__, "input channels and output channels do not match"); } if ( getOutSampleRate() == getInSampleRate() ) { resampleRatio = 1; converter = 0; } else if (getInBitsPerSample() == 16) { resampleRatio = ( (double) getOutSampleRate() / (double) getInSampleRate() ); // Determine if we can use linear interpolation. // The inverse of the ratio must be a power of two for linear mode to // be of sufficient quality. bool useLinear = true; double inverse = 1 / resampleRatio; int integer = (int) inverse; // Check that the inverse of the ratio is an integer if( integer == inverse ) { while( useLinear && integer ) { // Loop through the bits // If the lowest order bit is not the only one set if( integer & 1 && integer != 1 ) { // Not a power of two; cannot use linear useLinear = false; } else { // Shift all the bits over and try again integer >>= 1; } } } else { useLinear = false; } // If we get here and useLinear is still true, then we have // a power of two. // open the aflibConverter in // - high quality // - linear or quadratic (non-linear) based on algorithm // - not filter interpolation #ifdef HAVE_SRC_LIB int srcError = 0; converter = src_new(useLinear == true ? SRC_LINEAR : SRC_SINC_FASTEST, getInChannel(), &srcError); if(srcError) throw Exception (__FILE__, __LINE__, "libsamplerate error: ", src_strerror (srcError)); #else converter = new aflibConverter( true, useLinear, false); #endif } else { throw Exception( __FILE__, __LINE__, "specified bits per sample with samplerate conversion not supported", getInBitsPerSample() ); } } /** * De-initialize the object. * * @exception Exception */ inline void strip ( void ) throw ( Exception ) { if ( converter ) { #ifdef HAVE_SRC_LIB delete [] converterData.data_in; src_delete (converter); #else delete converter; #endif delete [] resampledOffset; } } protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline FaacEncoder ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } public: /** * Constructor. * * @param sink the sink to send mp3 output to * @param inSampleRate sample rate of the input. * @param inBitsPerSample number of bits per sample of the input. * @param inChannel number of channels of the input. * @param inBigEndian shows if the input is big or little endian * @param outBitrateMode the bit rate mode of the output. * @param outBitrate bit rate of the output (kbits/sec). * @param outQuality the quality of the stream. * @param outSampleRate sample rate of the output. * If 0, inSampleRate is used. * @param outChannel number of channels of the output. * If 0, inChannel is used. * @param lowpass frequency threshold for the lowpass filter. * Input above this frequency is cut. * If 0, faac's default values are used, * which depends on the out sample rate. * @exception Exception */ inline FaacEncoder ( Sink * sink, unsigned int inSampleRate, unsigned int inBitsPerSample, unsigned int inChannel, bool inBigEndian, BitrateMode outBitrateMode, unsigned int outBitrate, double outQuality, unsigned int outSampleRate = 0, unsigned int outChannel = 0, int lowpass = 0) throw ( Exception ) : AudioEncoder ( sink, inSampleRate, inBitsPerSample, inChannel, inBigEndian, outBitrateMode, outBitrate, outQuality, outSampleRate, outChannel ) { init( lowpass); } /** * Constructor. * * @param sink the sink to send mp3 output to * @param as get input sample rate, bits per sample and channels * from this AudioSource. * @param outBitrateMode the bit rate mode of the output. * @param outBitrate bit rate of the output (kbits/sec). * @param outQuality the quality of the stream. * @param outSampleRate sample rate of the output. * If 0, input sample rate is used. * @param outChannel number of channels of the output. * If 0, input channel is used. * @param lowpass frequency threshold for the lowpass filter. * Input above this frequency is cut. * If 0, faac's default values are used, * which depends on the out sample rate. * @exception Exception */ inline FaacEncoder ( Sink * sink, const AudioSource * as, BitrateMode outBitrateMode, unsigned int outBitrate, double outQuality, unsigned int outSampleRate = 0, unsigned int outChannel = 0, int lowpass = 0) throw ( Exception ) : AudioEncoder ( sink, as, outBitrateMode, outBitrate, outQuality, outSampleRate, outChannel ) { init( lowpass); } /** * Copy constructor. * * @param encoder the FaacEncoder to copy. */ inline FaacEncoder ( const FaacEncoder & encoder ) throw ( Exception ) : AudioEncoder( encoder ) { init( encoder.lowpass); } /** * Destructor. * * @exception Exception */ inline virtual ~FaacEncoder ( void ) throw ( Exception ) { if ( isOpen() ) { close(); } strip(); } /** * Assignment operator. * * @param encoder the FaacEncoder to assign this to. * @return a reference to this FaacEncoder. * @exception Exception */ inline virtual FaacEncoder & operator= ( const FaacEncoder & encoder ) throw ( Exception ) { if ( this != &encoder ) { strip(); AudioEncoder::operator=( encoder); init( encoder.lowpass); } return *this; } /** * Get the version string of the underlying faac library. * * @return the version string of the underlying faac library. */ inline const char * getFaacVersion( void ) { char * id; char * copyright; faacEncGetVersion(&id, ©right); return id; } /** * Check wether encoding is in progress. * * @return true if encoding is in progress, false otherwise. */ inline virtual bool isRunning ( void ) const throw () { return isOpen(); } /** * Start encoding. This function returns as soon as possible, * with encoding started in the background. * * @return true if encoding has started, false otherwise. * @exception Exception */ inline virtual bool start ( void ) throw ( Exception ) { return open(); } /** * Stop encoding. Stops the encoding running in the background. * * @exception Exception */ inline virtual void stop ( void ) throw ( Exception ) { return close(); } /** * Open an encoding session. * * @return true if opening was successfull, false otherwise. * @exception Exception */ virtual bool open ( void ) throw ( Exception ); /** * Check if the encoding session is open. * * @return true if the encoding session is open, false otherwise. */ inline virtual bool isOpen ( void ) const throw () { return faacOpen; } /** * Check if the encoder is ready to accept data. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true if the encoder is ready to accept data, * false otherwise. * @exception Exception */ inline virtual bool canWrite ( unsigned int sec, unsigned int usec ) throw ( Exception ) { if ( !isOpen() ) { return false; } return true; } /** * Write data to the encoder. * Buf is expected to be a sequence of big-endian 16 bit values, * with left and right channels interleaved. Len is the number of * bytes, must be a multiple of 4. * * @param buf the data to write. * @param len number of bytes to write from buf. * @return the number of bytes written (may be less than len). * @exception Exception */ virtual unsigned int write ( const void * buf, unsigned int len ) throw ( Exception ); /** * Flush all data that was written to the encoder to the underlying * connection. * * @exception Exception */ virtual void flush ( void ) throw ( Exception ); /** * Close the encoding session. * * @exception Exception */ virtual void close ( void ) throw ( Exception ); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* AAC_ENCODER_H */ darkice-1.2/src/CastSink.cpp0000644000175000017500000001030012170706662012712 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : CastSink.cpp Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/CastSink.cpp $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #include "Util.h" #include "Exception.h" #include "CastSink.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: CastSink.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $"; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Initialize the object *----------------------------------------------------------------------------*/ void CastSink :: init ( TcpSocket * socket, Sink * streamDump, const char * password, unsigned int bitRate, const char * name, const char * url, const char * genre, bool isPublic ) throw ( Exception ) { this->socket = socket; this->streamDump = streamDump; this->password = password ? Util::strDup( password) : 0; this->bitRate = bitRate; this->name = name ? Util::strDup( name) : 0; this->url = url ? Util::strDup( url) : 0; this->genre = genre ? Util::strDup( genre) : 0; this->isPublic = isPublic; } /*------------------------------------------------------------------------------ * De-initialize the object *----------------------------------------------------------------------------*/ void CastSink :: strip ( void ) throw ( Exception ) { if ( isOpen() ) { close(); } if ( password ) { delete[] password; } if ( name ) { delete[] name; } if ( url ) { delete[] url; } if ( genre ) { delete[] genre; } } /*------------------------------------------------------------------------------ * Open the connection *----------------------------------------------------------------------------*/ bool CastSink :: open ( void ) throw ( Exception ) { if ( isOpen() ) { return false; } if ( !getSink()->open() ) { return false; } if ( !sendLogin() ) { close(); return false; } if ( streamDump != 0 ) { if ( !streamDump->isOpen() ) { if ( !streamDump->open() ) { reportEvent( 2, "can't open stream dump"); } } } return true; } darkice-1.2/src/aflibConverter.cc0000644000175000017500000005637612170706611013764 00000000000000/* * Copyright: (C) 2000 Julius O. Smith * * 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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Julius O. Smith jos@ccrma.stanford.edu * */ /* This code was modified by Bruce Forsberg (forsberg@tns.net) to make it into a C++ class */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include "aflibConverter.h" #include "aflibConverterLargeFilter.h" #include "aflibConverterSmallFilter.h" #include "aflibDebug.h" #if (!defined(TRUE) || !defined(FALSE)) # define TRUE 1 # define FALSE 0 #endif /* * The configuration constants below govern * the number of bits in the input sample and filter coefficients, the * number of bits to the right of the binary-point for fixed-point math, etc. */ /* Conversion constants */ #define Nhc 8 #define Na 7 #define Np (Nhc+Na) #define Npc (1< (inCount - (int)framecount)) { Nsamps = inCount - framecount; } for (c = 0; c < _nChans; c++) { ptr = outPtr[c]; ptr += Xoff; /* Start at designated sample number */ for (i = 0; i < Nsamps; i++) *ptr++ = (short) inArray[c * inCount + i + framecount]; } framecount += Nsamps; if ((int)framecount >= inCount) /* return index of last samp */ return (((Nsamps - (framecount - inCount)) - 1) + Xoff); else return 0; } int aflibConverter::SrcLinear( short X[], short Y[], double factor, unsigned int *Time, unsigned short& Nx, unsigned short Nout) { short iconst; short *Xp, *Ystart; int v,x1,x2; double dt; /* Step through input signal */ unsigned int dtb; /* Fixed-point version of Dt */ // unsigned int endTime; /* When Time reaches EndTime, return to user */ unsigned int start_sample, end_sample; dt = 1.0/factor; /* Output sampling period */ dtb = (unsigned int)(dt*(1<>Np; Ystart = Y; // endTime = *Time + (1<>Np]; /* Ptr to current input sample */ x1 = *Xp++; x2 = *Xp; x1 *= ((1<>Np; Nx = end_sample - start_sample; return (Y - Ystart); /* Return number of output samples */ } int aflibConverter::SrcUp( short X[], short Y[], double factor, unsigned int *Time, unsigned short& Nx, unsigned short Nout, unsigned short Nwing, unsigned short LpScl, short Imp[], short ImpD[], bool Interp) { short *Xp, *Ystart; int v; double dt; /* Step through input signal */ unsigned int dtb; /* Fixed-point version of Dt */ // unsigned int endTime; /* When Time reaches EndTime, return to user */ unsigned int start_sample, end_sample; dt = 1.0/factor; /* Output sampling period */ dtb = (unsigned int)(dt*(1<>Np; Ystart = Y; // endTime = *Time + (1<>Np]; /* Ptr to current input sample */ /* Perform left-wing inner product */ v = FilterUp(Imp, ImpD, Nwing, Interp, Xp, (short)(*Time&Pmask),-1); /* Perform right-wing inner product */ v += FilterUp(Imp, ImpD, Nwing, Interp, Xp+1, (short)((((*Time)^Pmask)+1)&Pmask), 1); v >>= Nhg; /* Make guard bits */ v *= LpScl; /* Normalize for unity filter gain */ *Y++ = WordToHword(v,NLpScl); /* strip guard bits, deposit output */ *Time += dtb; /* Move to next sample by time increment */ } end_sample = (*Time)>>Np; Nx = end_sample - start_sample; return (Y - Ystart); /* Return the number of output samples */ } int aflibConverter::SrcUD( short X[], short Y[], double factor, unsigned int *Time, unsigned short& Nx, unsigned short Nout, unsigned short Nwing, unsigned short LpScl, short Imp[], short ImpD[], bool Interp) { short *Xp, *Ystart; int v; double dh; /* Step through filter impulse response */ double dt; /* Step through input signal */ // unsigned int endTime; /* When Time reaches EndTime, return to user */ unsigned int dhb, dtb; /* Fixed-point versions of Dh,Dt */ unsigned int start_sample, end_sample; dt = 1.0/factor; /* Output sampling period */ dtb = (unsigned int)(dt*(1<>Np; Ystart = Y; // endTime = *Time + (1<>Np]; /* Ptr to current input sample */ v = FilterUD(Imp, ImpD, Nwing, Interp, Xp, (short)(*Time&Pmask), -1, dhb); /* Perform left-wing inner product */ v += FilterUD(Imp, ImpD, Nwing, Interp, Xp+1, (short)((((*Time)^Pmask)+1)&Pmask), 1, dhb); /* Perform right-wing inner product */ v >>= Nhg; /* Make guard bits */ v *= LpScl; /* Normalize for unity filter gain */ *Y++ = WordToHword(v,NLpScl); /* strip guard bits, deposit output */ *Time += dtb; /* Move to next sample by time increment */ } end_sample = (*Time)>>Np; Nx = end_sample - start_sample; return (Y - Ystart); /* Return the number of output samples */ } int aflibConverter::resampleFast( /* number of output samples returned */ int& inCount, /* number of input samples to convert */ int outCount, /* number of output samples to compute */ short inArray[], /* input data */ short outArray[]) /* output data */ { unsigned int Time2; /* Current time/pos in input sample */ #if 0 unsigned short Ncreep; #endif unsigned short Xp, Xoff, Xread; int OBUFFSIZE = (int)(((double)IBUFFSIZE)*_factor); unsigned short Nout = 0, Nx, orig_Nx; unsigned short maxOutput; int total_inCount = 0; int c, i, Ycount, last; bool first_pass = TRUE; Xoff = 10; Nx = IBUFFSIZE - 2*Xoff; /* # of samples to process each iteration */ last = 0; /* Have not read last input sample yet */ Ycount = 0; /* Current sample and length of output file */ Xp = Xoff; /* Current "now"-sample pointer for input */ Xread = Xoff; /* Position in input array to read into */ if (_initial == TRUE) _Time = (Xoff< (OBUFFSIZE - (2*Xoff*_factor)) ) maxOutput = OBUFFSIZE - (unsigned short)(2*Xoff*_factor); else maxOutput = outCount-Ycount; for (c = 0; c < _nChans; c++) { orig_Nx = Nx; Time2 = _Time; /* Resample stuff in input buffer */ Nout=SrcLinear(_II[c],_JJ[c],_factor,&Time2,orig_Nx,maxOutput); } Nx = orig_Nx; _Time = Time2; _Time -= (Nx<>Np) - Xoff; /* Calc time accumulation in Time */ if (Ncreep) { Time -= (Ncreep<outCount) { Nout -= (Ycount-outCount); Ycount = outCount; } if (Nout > OBUFFSIZE) /* Check to see if output buff overflowed */ return err_ret("Output array overflow"); for (c = 0; c < _nChans; c++) for (i = 0; i < Nout; i++) outArray[c * outCount + i + Ycount - Nout] = _JJ[c][i]; total_inCount += Nx; } while (Ycount < outCount); /* Continue until done */ inCount = total_inCount; return(Ycount); /* Return # of samples in output file */ } int aflibConverter::resampleWithFilter( /* number of output samples returned */ int& inCount, /* number of input samples to convert */ int outCount, /* number of output samples to compute */ short inArray[], /* input data */ short outArray[], /* output data */ short Imp[], short ImpD[], unsigned short LpScl, unsigned short Nmult, unsigned short Nwing) { unsigned int Time2; /* Current time/pos in input sample */ #if 0 unsigned short Ncreep; #endif unsigned short Xp, Xoff, Xread; int OBUFFSIZE = (int)(((double)IBUFFSIZE)*_factor); unsigned short Nout = 0, Nx, orig_Nx; unsigned short maxOutput; int total_inCount = 0; int c, i, Ycount, last; bool first_pass = TRUE; /* Account for increased filter gain when using factors less than 1 */ if (_factor < 1) LpScl = (unsigned short)(LpScl*_factor + 0.5); /* Calc reach of LP filter wing & give some creeping room */ Xoff = (unsigned short)(((Nmult+1)/2.0) * MAX(1.0,1.0/_factor) + 10); if (IBUFFSIZE < 2*Xoff) /* Check input buffer size */ return err_ret("IBUFFSIZE (or factor) is too small"); Nx = IBUFFSIZE - 2*Xoff; /* # of samples to process each iteration */ last = 0; /* Have not read last input sample yet */ Ycount = 0; /* Current sample and length of output file */ Xp = Xoff; /* Current "now"-sample pointer for input */ Xread = Xoff; /* Position in input array to read into */ if (_initial == TRUE) _Time = (Xoff< (OBUFFSIZE - (2*Xoff*_factor)) ) maxOutput = OBUFFSIZE - (unsigned short)(2*Xoff*_factor); else maxOutput = outCount-Ycount; for (c = 0; c < _nChans; c++) { orig_Nx = Nx; Time2 = _Time; /* Resample stuff in input buffer */ if (_factor >= 1) { /* SrcUp() is faster if we can use it */ Nout=SrcUp(_II[c],_JJ[c],_factor, &Time2,Nx,maxOutput,Nwing,LpScl,Imp,ImpD,interpFilt); } else { Nout=SrcUD(_II[c],_JJ[c],_factor, &Time2,Nx,maxOutput,Nwing,LpScl,Imp,ImpD,interpFilt); } } _Time = Time2; _Time -= (Nx<>Np) - Xoff; /* Calc time accumulation in Time */ if (Ncreep) { Time -= (Ncreep< outCount) { Nout -= (Ycount - outCount); Ycount = outCount; } if (Nout > OBUFFSIZE) /* Check to see if output buff overflowed */ return err_ret("Output array overflow"); for (c = 0; c < _nChans; c++) { for (i = 0; i < Nout; i++) { outArray[c * outCount + i + Ycount - Nout] = _JJ[c][i]; } } int act_incount = (int)Nx; for (c = 0; c < _nChans; c++) { for (i=0; i>Na]; End = &Imp[Nwing]; if (Interp) { Hdp = &ImpD[Ph>>Na]; a = Ph & Amask; } if (Inc == 1) /* If doing right wing... */ { /* ...drop extra coeff, so when Ph is */ End--; /* 0.5, we don't do too many mult's */ if (Ph == 0) /* If the phase is zero... */ { /* ...then we've already skipped the */ Hp += Npc; /* first sample, so we must also */ Hdp += Npc; /* skip ahead in Imp[] and ImpD[] */ } } if (Interp) { while (Hp < End) { t = *Hp; /* Get filter coeff */ t += (((int)*Hdp)*a)>>Na; /* t is now interp'd filter coeff */ Hdp += Npc; /* Filter coeff differences step */ t *= *Xp; /* Mult coeff by input sample */ if (t & (1<<(Nhxn-1))) /* Round, if needed */ t += (1<<(Nhxn-1)); t >>= Nhxn; /* Leave some guard bits, but come back some */ v += t; /* The filter output */ Hp += Npc; /* Filter coeff step */ Xp += Inc; /* Input signal step. NO CHECK ON BOUNDS */ } } else { while (Hp < End) { t = *Hp; /* Get filter coeff */ t *= *Xp; /* Mult coeff by input sample */ if (t & (1<<(Nhxn-1))) /* Round, if needed */ t += (1<<(Nhxn-1)); t >>= Nhxn; /* Leave some guard bits, but come back some */ v += t; /* The filter output */ Hp += Npc; /* Filter coeff step */ Xp += Inc; /* Input signal step. NO CHECK ON BOUNDS */ } } return(v); } int aflibConverter::FilterUD( short Imp[], short ImpD[], unsigned short Nwing, bool Interp, short *Xp, short Ph, short Inc, unsigned short dhb) { short a; short *Hp, *Hdp, *End; int v, t; unsigned int Ho; v=0; Ho = (Ph*(unsigned int)dhb)>>Np; End = &Imp[Nwing]; if (Inc == 1) /* If doing right wing... */ { /* ...drop extra coeff, so when Ph is */ End--; /* 0.5, we don't do too many mult's */ if (Ph == 0) /* If the phase is zero... */ Ho += dhb; /* ...then we've already skipped the */ } /* first sample, so we must also */ /* skip ahead in Imp[] and ImpD[] */ if (Interp) { while ((Hp = &Imp[Ho>>Na]) < End) { t = *Hp; /* Get IR sample */ Hdp = &ImpD[Ho>>Na]; /* get interp (lower Na) bits from diff table*/ a = Ho & Amask; /* a is logically between 0 and 1 */ t += (((int)*Hdp)*a)>>Na; /* t is now interp'd filter coeff */ t *= *Xp; /* Mult coeff by input sample */ if (t & 1<<(Nhxn-1)) /* Round, if needed */ t += 1<<(Nhxn-1); t >>= Nhxn; /* Leave some guard bits, but come back some */ v += t; /* The filter output */ Ho += dhb; /* IR step */ Xp += Inc; /* Input signal step. NO CHECK ON BOUNDS */ } } else { while ((Hp = &Imp[Ho>>Na]) < End) { t = *Hp; /* Get IR sample */ t *= *Xp; /* Mult coeff by input sample */ if (t & 1<<(Nhxn-1)) /* Round, if needed */ t += 1<<(Nhxn-1); t >>= Nhxn; /* Leave some guard bits, but come back some */ v += t; /* The filter output */ Ho += dhb; /* IR step */ Xp += Inc; /* Input signal step. NO CHECK ON BOUNDS */ } } return(v); } darkice-1.2/src/Makefile.am0000644000175000017500000000643712170706611012535 00000000000000bin_PROGRAMS = darkice AM_CXXFLAGS = -O2 -pedantic -Wall @DEBUG_CXXFLAGS@ @PTHREAD_CFLAGS@ @JACK_CFLAGS@ INCLUDES = @LAME_INCFLAGS@ @VORBIS_INCFLAGS@ @OPUS_INCFLAGS@ @FAAC_INCFLAGS@ @AACPLUS_INCFLAGS@ @TWOLAME_INCFLAGS@ \ @ALSA_INCFLAGS@ @PULSEAUDIO_INCFLAGS@ @JACK_INCFLAGS@ @SRC_INCFLAGS@ LDADD = @PTHREAD_LIBS@ @LAME_LDFLAGS@ @VORBIS_LDFLAGS@ @OPUS_LDFLAGS@ @FAAC_LDFLAGS@ @AACPLUS_LDFLAGS@ @TWOLAME_LDFLAGS@ \ @ALSA_LDFLAGS@ @PULSEAUDIO_LDFLAGS@ @JACK_LDFLAGS@ @SRC_LDFLAGS@ if HAVE_SRC_LIB AFLIB_SOURCE = else AFLIB_SOURCE = aflibDebug.h\ aflibDebug.cc\ aflibConverter.h\ aflibConverter.cc\ aflibConverterLargeFilter.h\ aflibConverterSmallFilter.h endif darkice_SOURCES = AudioEncoder.h\ AudioSource.h\ AudioSource.cpp\ BufferedSink.cpp\ BufferedSink.h\ CastSink.cpp\ CastSink.h\ FileSink.h\ FileSink.cpp\ Connector.cpp\ Connector.h\ MultiThreadedConnector.cpp\ MultiThreadedConnector.h\ DarkIce.cpp\ DarkIce.h\ Exception.cpp\ Exception.h\ IceCast.cpp\ IceCast.h\ IceCast2.cpp\ IceCast2.h\ ShoutCast.cpp\ ShoutCast.h\ FileCast.h\ FileCast.cpp\ LameLibEncoder.cpp\ LameLibEncoder.h\ TwoLameLibEncoder.cpp\ TwoLameLibEncoder.h\ VorbisLibEncoder.cpp\ VorbisLibEncoder.h\ OpusLibEncoder.cpp\ OpusLibEncoder.h\ FaacEncoder.cpp\ FaacEncoder.h\ aacPlusEncoder.cpp\ aacPlusEncoder.h\ OssDspSource.cpp\ OssDspSource.h\ SerialUlaw.cpp\ SerialUlaw.h\ SolarisDspSource.cpp\ SolarisDspSource.h\ Ref.h\ Referable.h\ Sink.h\ Source.h\ TcpSocket.cpp\ TcpSocket.h\ Util.cpp\ Util.h\ ConfigSection.h\ ConfigSection.cpp\ DarkIceConfig.h\ DarkIceConfig.cpp\ Reporter.h\ Reporter.cpp\ AlsaDspSource.h\ AlsaDspSource.cpp\ PulseAudioDspSource.h\ PulseAudioDspSource.cpp\ JackDspSource.h\ JackDspSource.cpp\ main.cpp \ $(AFLIB_SOURCE) EXTRA_darkice_SOURCES = aflibDebug.h\ aflibDebug.cc\ aflibConverter.h\ aflibConverter.cc\ aflibConverterLargeFilter.h\ aflibConverterSmallFilter.h darkice-1.2/src/Ref.h0000644000175000017500000001744312170706662011373 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : Ref.h Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/Ref.h $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef REF_H #define REF_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include "Exception.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * Java-like object reference class. * Objects used with this reference class have to be descandents * of class Referable. * * sample usage: * *
 *  #include "Ref.h"
 *  #include "Referable.h"
 *
 *  class  A : public virtual Referable;
 *
 *  ...
 *   
 *  A        * a = new A();
 *  Ref     ref1 = a;       // 1 reference to a
 *  Ref     ref2 = ref1;    // 2 references to a
 *
 *  ref1 = 0;      // 1 reference to a
 *  ref2 = 0;      // at this point object a is destroyed
 *  
* * Based on Tima Saarinen's work, * http://gamma.nic.fi/~timosa/comp/refcount.html * * @ref Referable * * @author $Author: rafael@riseup.net $ * @version $Revision: 553 $ */ template class Ref { private: /** * The object referenced by this Ref. * Must be a descandant of Referable. */ T* object; protected: public: /** * Default constructor. */ inline Ref ( void ) throw () { object = NULL; } /** * Copy constructor. * * @param other the Ref to copy. * @exception Exception */ inline Ref ( const Ref & other ) throw ( Exception ) { object = NULL; set( other.object); } /** * Constructor based on an object to reference. * * @param obj the object to reference. * @exception Exception */ inline Ref ( T * obj ) throw ( Exception ) { object = obj; obj->increaseReferenceCount(); } /** * Destructor. * * @exception Exception */ inline virtual ~Ref ( void ) throw ( Exception ) { set( 0 ); } /** * Operator overload to make the reference seem like a pointer. * * @return the pointer to the object referenced. */ inline T* operator->() const throw ( Exception ) { if ( !object ) { throw Exception( __FILE__, __LINE__, "reference to NULL object"); } return object; } /** * Assignment operator. * * @param other the Ref to assign to this one. * @return a reference to this Ref. * @exception Exception */ inline Ref & operator= ( Ref other ) throw ( Exception ) { set( other.object); return *this; } /** * Assignment operator. * * @param obj pointer to the object to assign to this Ref. * @return a reference to this Ref. * @exception Exception */ inline Ref & operator= ( T* obj ) throw ( Exception ) { set( obj); return *this; } /** * Set the object referenced. * Deletes the old referenced object is this was it's last reference. * * @param newobj pointer to the object to reference by this Ref. * @exception Exception */ inline void set ( T * newobj ) throw ( Exception ) { // If equal do nothing if ( newobj == object ) { return; } // Increase reference count if ( newobj ) { newobj->increaseReferenceCount(); } // Decrease the reference count of the old referable if ( object ) { if ( object->decreaseReferenceCount() == 0 ) { delete object; } } // Assign object = newobj; } /** * Return object pointer. This method should be used with * care because it breaks the encapsulation. * Typically this method is needed for the method calls * which require literal object pointer. * * It may not be bad idea to pass the Ref * objects as method arguments. * * @return Object pointer or NULL. */ inline T* get ( void ) const throw () { return object; } /** * Equality operator. * * @param other the pointer to compare this with. * @return true is this Ref refers to the same object as other, * false otherwise. */ inline bool operator== ( const T * other ) const throw () { return object == other; } /** * Equality operator. * * @param other the Ref to compare this with. * @return true is the two Refs refer to the same object, * false otherwise. */ inline bool operator== ( const Ref & other ) const throw () { return object == other.object; } /** * Unequality operator. * * @param other the pointer to compare this with. * @return false is this Ref refers to a different object then other, * true otherwise. */ inline bool operator!= ( const T * other ) const throw () { return object != other; } /** * Unequality operator. * * @param other the Ref to compare this with. * @return false is the two Refs refer to the same object, * true otherwise. */ inline bool operator!= ( const Ref & other ) const throw () { return object != other.object; } }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* REF_H */ darkice-1.2/src/OssDspSource.cpp0000644000175000017500000002017712170706662013604 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : OssDspSource.cpp Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/OssDspSource.cpp $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #include "OssDspSource.h" #ifdef SUPPORT_OSS_DSP // only compile this code if there is support for it #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_UNISTD_H #include #else #error need unistd.h #endif #ifdef HAVE_STRING_H #include #else #error need string.h #endif #ifdef HAVE_SYS_TYPES_H #include #else #error need sys/types.h #endif #ifdef HAVE_SYS_STAT_H #include #else #error need sys/stat.h #endif #ifdef HAVE_FCNTL_H #include #else #error need fcntl.h #endif #ifdef HAVE_SYS_TIME_H #include #else #error need sys/time.h #endif #ifdef HAVE_SYS_IOCTL_H #include #else #error need sys/ioctl.h #endif #ifdef HAVE_SIGNAL_H #include #else #error need signal.h #endif #ifdef HAVE_SYS_SOUNDCARD_H #include #else #error need sys/soundcard.h #endif #include "Util.h" #include "Exception.h" #include "OssDspSource.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: OssDspSource.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $"; /*------------------------------------------------------------------------------ * Define the natural endiannes of 16 bit recording if not defined, * based on the endiannes of the system *----------------------------------------------------------------------------*/ #ifndef AFMT_S16_NE # ifdef WORDS_BIGENDIAN # define AFMT_S16_NE AFMT_S16_BE # else # define AFMT_S16_NE AFMT_S16_LE # endif #endif /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Tell if source id big endian *----------------------------------------------------------------------------*/ bool OssDspSource :: isBigEndian ( void ) const throw () { return AFMT_S16_NE == AFMT_S16_BE; } /*------------------------------------------------------------------------------ * Initialize the object *----------------------------------------------------------------------------*/ void OssDspSource :: init ( const char * name ) throw ( Exception ) { fileName = Util::strDup( name); fileDescriptor = 0; running = false; } /*------------------------------------------------------------------------------ * De-initialize the object *----------------------------------------------------------------------------*/ void OssDspSource :: strip ( void ) throw ( Exception ) { if ( isOpen() ) { close(); } delete[] fileName; } /*------------------------------------------------------------------------------ * Open the audio source *----------------------------------------------------------------------------*/ bool OssDspSource :: open ( void ) throw ( Exception ) { int format; int i; unsigned int u; if ( isOpen() ) { return false; } switch ( getBitsPerSample() ) { case 8: format = AFMT_U8; break; case 16: format = AFMT_S16_NE; break; default: return false; } if ( (fileDescriptor = ::open( fileName, O_RDONLY)) == -1 ) { fileDescriptor = 0; return false; } i = format; if ( ioctl( fileDescriptor, SNDCTL_DSP_SETFMT, &i) == -1 || i != format ) { close(); throw Exception( __FILE__, __LINE__, "can't set format", i); } u = getChannel(); if ( ioctl( fileDescriptor, SNDCTL_DSP_CHANNELS, &u) == -1 || u != getChannel() ) { close(); throw Exception( __FILE__, __LINE__, "can't set channels", u); } u = getSampleRate(); if ( ioctl( fileDescriptor, SNDCTL_DSP_SPEED, &u) == -1 ) { close(); throw Exception( __FILE__, __LINE__, "can't set soundcard recording sample rate", u); } if ( u != getSampleRate() ) { reportEvent( 2, "sound card recording sample rate set to ", u, " while trying to set it to ", getSampleRate()); reportEvent( 2, "this is probably not a problem, but a slight " "drift in the sound card driver"); } return true; } /*------------------------------------------------------------------------------ * Check wether read() would return anything *----------------------------------------------------------------------------*/ bool OssDspSource :: canRead ( unsigned int sec, unsigned int usec ) throw ( Exception ) { fd_set fdset; struct timespec timespec; sigset_t sigset; int ret; if ( !isOpen() ) { return false; } if ( !running ) { /* ugly workaround to get the dsp into recording state */ unsigned char * b = new unsigned char[getChannel()*getBitsPerSample()/8]; read( b, getChannel()*getBitsPerSample()/8); delete[] b; } FD_ZERO( &fdset); FD_SET( fileDescriptor, &fdset); timespec.tv_sec = sec; timespec.tv_nsec = usec * 1000L; // mask out SIGUSR1, as we're expecting that signal for other reasons sigemptyset(&sigset); sigaddset(&sigset, SIGUSR1); ret = pselect( fileDescriptor + 1, &fdset, NULL, NULL, ×pec, &sigset); if ( ret == -1 ) { throw Exception( __FILE__, __LINE__, "select error"); } return ret > 0; } /*------------------------------------------------------------------------------ * Read from the audio source *----------------------------------------------------------------------------*/ unsigned int OssDspSource :: read ( void * buf, unsigned int len ) throw ( Exception ) { ssize_t ret; if ( !isOpen() ) { return 0; } ret = ::read( fileDescriptor, buf, len); if ( ret == -1 ) { throw Exception( __FILE__, __LINE__, "read error"); } running = true; return ret; } /*------------------------------------------------------------------------------ * Close the audio source *----------------------------------------------------------------------------*/ void OssDspSource :: close ( void ) throw ( Exception ) { if ( !isOpen() ) { return; } ::close( fileDescriptor); fileDescriptor = 0; running = false; } #endif // SUPPORT_OSS_DSP darkice-1.2/src/aacPlusEncoder.h0000644000175000017500000004207412170706662013545 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : aacPlusEncoder.h Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/aacPlusEncoder.h $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef AACP_ENCODER_H #define AACP_ENCODER_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_AACPLUS_LIB #include #else #error configure with aacplus #endif #include #include #include "Ref.h" #include "Exception.h" #include "Reporter.h" #include "AudioEncoder.h" #include "Sink.h" #ifdef HAVE_SRC_LIB #include #else #include "aflibConverter.h" #endif /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * A class representing aacplus AAC+ encoder. * * @author $Author: rafael@riseup.net $ * @version $Revision: 553 $ */ class aacPlusEncoder : public AudioEncoder, public virtual Reporter { private: /** * A flag to indicate if the encoding session is open. */ bool aacplusOpen; /** * Resample ratio */ double resampleRatio; /** * sample rate converter object for possible resampling */ #ifdef HAVE_SRC_LIB SRC_STATE *converter; SRC_DATA converterData; float *resampledOffset; #else aflibConverter *converter; short *resampledOffset; #endif unsigned int resampledOffsetSize; /** * The Sink to dump aac+ data to */ Ref sink; /** * The handle to the AAC+ encoder instance. */ aacplusEncHandle encoderHandle; /** * The maximum number of input samples to supply to the encoder. */ unsigned long inputSamples; /** * The maximum number of output bytes the encoder returns in one call. */ unsigned long maxOutputBytes; /** * Lowpass filter. Sound frequency in Hz, from where up the * input is cut. */ int lowpass; /** * Initialize the object. * * @param sink the sink to send mp3 output to * @exception Exception */ inline void init ( Sink * sink, int lowpass) throw (Exception) { this->aacplusOpen = false; this->sink = sink; this->lowpass = lowpass; /* TODO: if we have float as input, we don't need conversion */ if ( getInBitsPerSample() != 16 && getInBitsPerSample() != 32 ) { throw Exception( __FILE__, __LINE__, "specified bits per sample not supported", getInBitsPerSample() ); } if ( getInChannel() > 2 ) { throw Exception( __FILE__, __LINE__, "unsupported number of input channels for the encoder", getInChannel() ); } if ( getOutChannel() > 2 ) { throw Exception( __FILE__, __LINE__, "unsupported number of output channels for the encoder", getOutChannel() ); } if ( getOutSampleRate() == getInSampleRate() ) { resampleRatio = 1; converter = 0; } else if (getInBitsPerSample() == 16) { resampleRatio = ( (double) getOutSampleRate() / (double) getInSampleRate() ); // Determine if we can use linear interpolation. // The inverse of the ratio must be a power of two for linear mode to // be of sufficient quality. bool useLinear = true; double inverse = 1 / resampleRatio; int integer = (int) inverse; // Check that the inverse of the ratio is an integer if( integer == inverse ) { while( useLinear && integer ) { // Loop through the bits // If the lowest order bit is not the only one set if( integer & 1 && integer != 1 ) { // Not a power of two; cannot use linear useLinear = false; } else { // Shift all the bits over and try again integer >>= 1; } } } else { useLinear = false; } // If we get here and useLinear is still true, then we have // a power of two. // open the aflibConverter in // - high quality // - linear or quadratic (non-linear) based on algorithm // - not filter interpolation #ifdef HAVE_SRC_LIB int srcError = 0; converter = src_new(useLinear == true ? SRC_LINEAR : SRC_SINC_FASTEST, getInChannel(), &srcError); if(srcError) throw Exception (__FILE__, __LINE__, "libsamplerate error: ", src_strerror (srcError)); #else converter = new aflibConverter( true, useLinear, false); #endif } else { throw Exception( __FILE__, __LINE__, "specified bits per sample with samplerate conversion not supported", getInBitsPerSample() ); } } /** * De-initialize the object. * * @exception Exception */ inline void strip ( void ) throw ( Exception ) { if ( converter ) { #ifdef HAVE_SRC_LIB delete [] converterData.data_in; src_delete (converter); #else delete converter; #endif delete [] resampledOffset; } } protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline aacPlusEncoder ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } public: /** * Constructor. * * @param sink the sink to send mp3 output to * @param inSampleRate sample rate of the input. * @param inBitsPerSample number of bits per sample of the input. * @param inChannel number of channels of the input. * @param inBigEndian shows if the input is big or little endian * @param outBitrateMode the bit rate mode of the output. * @param outBitrate bit rate of the output (kbits/sec). * @param outQuality the quality of the stream. * @param outSampleRate sample rate of the output. * If 0, inSampleRate is used. * @param outChannel number of channels of the output. * If 0, inChannel is used. * @param lowpass frequency threshold for the lowpass filter. * Input above this frequency is cut. * If 0, aacplus's default values are used, * which depends on the out sample rate. * @exception Exception */ inline aacPlusEncoder ( Sink * sink, unsigned int inSampleRate, unsigned int inBitsPerSample, unsigned int inChannel, bool inBigEndian, BitrateMode outBitrateMode, unsigned int outBitrate, double outQuality, unsigned int outSampleRate = 0, unsigned int outChannel = 0, int lowpass = 0) throw ( Exception ) : AudioEncoder ( sink, inSampleRate, inBitsPerSample, inChannel, inBigEndian, outBitrateMode, outBitrate, outQuality, outSampleRate, outChannel ) { init( sink, lowpass); } /** * Constructor. * * @param sink the sink to send mp3 output to * @param as get input sample rate, bits per sample and channels * from this AudioSource. * @param outBitrateMode the bit rate mode of the output. * @param outBitrate bit rate of the output (kbits/sec). * @param outQuality the quality of the stream. * @param outSampleRate sample rate of the output. * If 0, input sample rate is used. * @param outChannel number of channels of the output. * If 0, input channel is used. * @param lowpass frequency threshold for the lowpass filter. * Input above this frequency is cut. * If 0, aacplus's default values are used, * which depends on the out sample rate. * @exception Exception */ inline aacPlusEncoder ( Sink * sink, const AudioSource * as, BitrateMode outBitrateMode, unsigned int outBitrate, double outQuality, unsigned int outSampleRate = 0, unsigned int outChannel = 0, int lowpass = 0) throw ( Exception ) : AudioEncoder ( sink, as, outBitrateMode, outBitrate, outQuality, outSampleRate, outChannel ) { init( sink, lowpass ); } /** * Copy constructor. * * @param encoder the aacPlusEncoder to copy. */ inline aacPlusEncoder ( const aacPlusEncoder & encoder ) throw ( Exception ) : AudioEncoder( encoder ) { init( encoder.sink.get(), encoder.lowpass); } /** * Destructor. * * @exception Exception */ inline virtual ~aacPlusEncoder ( void ) throw ( Exception ) { if ( isOpen() ) { close(); } strip(); } /** * Assignment operator. * * @param encoder the aacPlusEncoder to assign this to. * @return a reference to this aacPlusEncoder. * @exception Exception */ inline virtual aacPlusEncoder & operator= ( const aacPlusEncoder & encoder ) throw ( Exception ) { if ( this != &encoder ) { strip(); AudioEncoder::operator=( encoder); init( encoder.sink.get(), encoder.lowpass); } return *this; } /** * Get the version string of the underlying aacplus library. * * @return the version string of the underlying aacplus library. */ inline const char * getAacPlusVersion( void ) { char * id; //char * copyright; /* aacplusEncGetVersion(&id, ©right); */ return id; } /** * Check wether encoding is in progress. * * @return true if encoding is in progress, false otherwise. */ inline virtual bool isRunning ( void ) const throw () { return isOpen(); } /** * Start encoding. This function returns as soon as possible, * with encoding started in the background. * * @return true if encoding has started, false otherwise. * @exception Exception */ inline virtual bool start ( void ) throw ( Exception ) { return open(); } /** * Stop encoding. Stops the encoding running in the background. * * @exception Exception */ inline virtual void stop ( void ) throw ( Exception ) { return close(); } /** * Open an encoding session. * * @return true if opening was successfull, false otherwise. * @exception Exception */ virtual bool open ( void ) throw ( Exception ); /** * Check if the encoding session is open. * * @return true if the encoding session is open, false otherwise. */ inline virtual bool isOpen ( void ) const throw () { return aacplusOpen; } /** * Check if the encoder is ready to accept data. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true if the encoder is ready to accept data, * false otherwise. * @exception Exception */ inline virtual bool canWrite ( unsigned int sec, unsigned int usec ) throw ( Exception ) { if ( !isOpen() ) { return false; } return true; } /** * Write data to the encoder. * Buf is expected to be a sequence of big-endian 16 bit values, * with left and right channels interleaved. Len is the number of * bytes, must be a multiple of 4. * * @param buf the data to write. * @param len number of bytes to write from buf. * @return the number of bytes written (may be less than len). * @exception Exception */ virtual unsigned int write ( const void * buf, unsigned int len ) throw ( Exception ); /** * Flush all data that was written to the encoder to the underlying * connection. * * @exception Exception */ virtual void flush ( void ) throw ( Exception ); /** * Close the encoding session. * * @exception Exception */ virtual void close ( void ) throw ( Exception ); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* AACP_ENCODER_H */ darkice-1.2/src/Referable.h0000644000175000017500000001066612170706662012546 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : Referable.h Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/Referable.h $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef REFERABLE_H #define REFERABLE_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include "Exception.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * Base class for an object for which references can be made * with the reference class Ref. * * usage: * *
 *  class A : public virtual Referable
 *  {
 *     ...
 *  };
 *  
* * @ref Ref * * @author $Author: rafael@riseup.net $ * @version $Revision: 553 $ */ class Referable { private: /** * Number of references to the object. */ unsigned int referenceCount; /** * Maximum number of references before an overflow occurs. */ static const unsigned int maxCount = ~((unsigned int)0); protected: /** * Default constructor. */ inline Referable ( void ) throw () { referenceCount = 0; } /** * Desctructor. * * @exception Exception */ inline virtual ~Referable ( void ) throw ( Exception ) { if ( referenceCount > 0 ) { throw Exception( __FILE__, __LINE__, "reference count positive in destructor", referenceCount); } } public: /** * Increase reference count. * * @return the new reference count. * @exception Exception */ inline unsigned int increaseReferenceCount ( void ) throw ( Exception ) { if ( referenceCount >= maxCount ) { throw Exception( __FILE__, __LINE__, "reference count overflow", referenceCount ); } return ++referenceCount; } /** * Decrease reference count. * * @return the new reference count. * @exception Exception */ inline unsigned int decreaseReferenceCount ( void ) throw ( Exception ) { if ( referenceCount == 0 ) { throw Exception( __FILE__, __LINE__, "reference count underflow", referenceCount ); } return --referenceCount; } /** * Get the reference count. * * @return the reference count. */ inline unsigned int getReferenceCount ( void ) const throw () { return referenceCount; } }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* REFERABLE_H */ darkice-1.2/src/Connector.h0000644000175000017500000001771012170706662012606 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : Connector.h Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/Connector.h $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef CONNECTOR_H #define CONNECTOR_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include "Referable.h" #include "Ref.h" #include "Reporter.h" #include "Source.h" #include "Sink.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * Connects a source to one or more sinks. * * @author $Author: rafael@riseup.net $ * @version $Revision: 553 $ */ class Connector : public virtual Referable, public virtual Reporter { private: /** * Initialize the object. * * @param source the source to read from. * @exception Exception */ void init ( Source * source ) throw ( Exception ); /** * De-initialize the object. * * @exception Exception */ void strip ( void ) throw ( Exception ); protected: /** * The source to read from. */ Ref source; /** * The sinks to connect the source to. */ Ref * sinks; /** * Total number of sinks. */ unsigned int numSinks; /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline Connector ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } /** * Detach an already attached Sink from the Source of this Connector. * * @param sink the Sink to detach. * @return true if the detachment was successful, false otherwise. * @exception Exception */ virtual bool detach ( Sink * sink ) throw ( Exception ); public: /** * Constructor based on a Source. * * @param source the source to connect to the sinks. * @exception Exception */ inline Connector ( Source * source ) throw ( Exception ) { init( source); } /** * Constructor based on a Source and a Sink. * * @param source the source to connect to the sinks. * @param sink a sink to connect to the source. * @exception Exception */ inline Connector ( Source * source, Sink * sink ) throw ( Exception ) { init( source); attach( sink); } /** * Copy constructor. * * @param connector the object to copy. * @exception Exception */ Connector ( const Connector & connector ) throw ( Exception ); /** * Destructor. * * @exception Exception */ inline virtual ~Connector( void ) throw ( Exception ) { strip(); } /** * Assignment operator. * * @param connector the object to assign to this one. * @return a reference to this object. * @exception Exception */ virtual Connector & operator= ( const Connector & connector ) throw ( Exception ); /** * Get the number of Sinks in the Connector. * * @return the number of Sinks in the Connector. * @exception Exception */ inline virtual unsigned int getNumSinks ( void ) const throw () { return numSinks; } /** * Attach a Sink to the Source of this Connector. * * @param sink the Sink to attach. * @exception Exception */ virtual void attach ( Sink * sink ) throw ( Exception ); /** * Open the connector. Opens the Source and the Sinks if necessary. * * @return true if opening was successful, false otherwise. * @exception Exception */ virtual bool open ( void ) throw ( Exception ); /** * Transfer a given amount of data from the Source to all the * Sinks attached. * If an attached Sink closes or encounteres an error during the * process, it is detached and the function carries on with the * rest of the Sinks. If no Sinks remain, or an error is encountered * with the Source, the function returns prematurely. * * @param bytes the amount of data to transfer, in bytes. * If 0, transfer forever. * @param bufSize the size of the buffer to use for transfering. * This amount of data is read from the Source and * written to each Sink on each turn. * @param sec the number of seconds to wait for the Source to have * data available in each turn, and the number of seconds * to wait for the Sinks to accept data. * @param usec the number of micro seconds to wait for the Source to * have data available in each turn, and the number of * micro seconds to wait for the Sinks to accept data. * @return the number of bytes read from the Source. * @exception Exception */ virtual unsigned int transfer ( unsigned long bytes, unsigned int bufSize, unsigned int sec, unsigned int usec ) throw ( Exception ); /** * Signal to each sink we have that they need to cut what they are * doing, and start again. For FileSinks, this usually means to * save the archive file recorded so far, and start a new archive * file. */ virtual void cut ( void ) throw (); /** * Close the Connector. The Source and all Sinks are closed. * * @exception Exception */ virtual void close ( void ) throw ( Exception ); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* CONNECTOR_H */ darkice-1.2/src/FileSink.cpp0000644000175000017500000002350112170706662012706 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : FileSink.cpp Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/FileSink.cpp $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_UNISTD_H #include #else #error need unistd.h #endif #ifdef HAVE_STDLIB_H #include #else #error need stdlib.h #endif #ifdef HAVE_SYS_TYPES_H #include #else #error need sys/types.h #endif #ifdef HAVE_ERRNO_H #include #else #error need errno.h #endif #ifdef HAVE_SYS_STAT_H #include #else #error need sys/stat.h #endif #ifdef HAVE_FCNTL_H #include #else #error need fcntl.h #endif #ifdef HAVE_SYS_TIME_H #include #else #error need sys/time.h #endif #ifdef HAVE_STRING_H #include #else #error need string.h #endif #ifdef HAVE_SIGNAL_H #include #else #error need signal.h #endif #include #include #include #include "Util.h" #include "Exception.h" #include "FileSink.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: FileSink.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $"; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Initialize the object *----------------------------------------------------------------------------*/ void FileSink :: init ( const char * configName, const char * name ) throw ( Exception ) { this->configName = Util::strDup(configName); fileName = Util::strDup(name); fileDescriptor = 0; } /*------------------------------------------------------------------------------ * De-initialize the object *----------------------------------------------------------------------------*/ void FileSink :: strip ( void) throw ( Exception ) { if ( isOpen() ) { close(); } delete[] fileName; } /*------------------------------------------------------------------------------ * Copy Constructor *----------------------------------------------------------------------------*/ FileSink :: FileSink ( const FileSink & fs ) throw ( Exception ) : Sink( fs ) { int fd; init( fs.configName, fs.fileName); if ( (fd = fs.fileDescriptor ? dup( fs.fileDescriptor) : 0) == -1 ) { strip(); throw Exception( __FILE__, __LINE__, "dup failure"); } fileDescriptor = fd; } /*------------------------------------------------------------------------------ * Assignment operator *----------------------------------------------------------------------------*/ FileSink & FileSink :: operator= ( const FileSink & fs ) throw ( Exception ) { if ( this != &fs ) { int fd; /* first strip */ strip(); /* then build up */ Sink::operator=( fs ); init( fs.configName, fs.fileName); if ( (fd = fs.fileDescriptor ? dup( fs.fileDescriptor) : 0) == -1 ) { strip(); throw Exception( __FILE__, __LINE__, "dup failure"); } fileDescriptor = fd; } return *this; } /*------------------------------------------------------------------------------ * Check wether a file exists and is regular file *----------------------------------------------------------------------------*/ bool FileSink :: exists ( void ) const throw () { struct stat st; if ( stat( (const char*)fileName, &st) == -1 ) { return false; } return S_ISREG( st.st_mode); } /*------------------------------------------------------------------------------ * Create a file, truncate if already exists *----------------------------------------------------------------------------*/ bool FileSink :: create ( void ) throw ( Exception ) { int fd; if ( isOpen() ) { return false; } /* filemode default to 0666 */ const int filemode = (S_IRUSR|S_IWUSR|S_IWGRP|S_IRGRP|S_IROTH|S_IWOTH) ; /* create the file */ if ( (fd = ::creat( fileName, filemode )) == -1 ) { reportEvent( 3, "can't create file", fileName, errno); return false; } ::close( fd); return true; } /*------------------------------------------------------------------------------ * Open the file *----------------------------------------------------------------------------*/ bool FileSink :: open ( void ) throw ( Exception ) { if ( isOpen() ) { return false; } if ( (fileDescriptor = ::open( fileName, O_WRONLY | O_TRUNC, 0)) == -1 ) { fileDescriptor = 0; return false; } return true; } /*------------------------------------------------------------------------------ * Check wether the file can be written to *----------------------------------------------------------------------------*/ bool FileSink :: canWrite ( unsigned int sec, unsigned int usec ) throw ( Exception ) { fd_set fdset; struct timespec timespec; sigset_t sigset; int ret; if ( !isOpen() ) { return false; } FD_ZERO( &fdset); FD_SET( fileDescriptor, &fdset); timespec.tv_sec = sec; timespec.tv_nsec = usec * 1000L; // mask out SIGUSR1, as we're expecting that signal for other reasons sigemptyset(&sigset); sigaddset(&sigset, SIGUSR1); ret = pselect( fileDescriptor + 1, NULL, &fdset, NULL, ×pec, &sigset); if ( ret == -1 ) { throw Exception( __FILE__, __LINE__, "select error"); } return ret > 0; } /*------------------------------------------------------------------------------ * Write to the FileSink *----------------------------------------------------------------------------*/ unsigned int FileSink :: write ( const void * buf, unsigned int len ) throw ( Exception ) { ssize_t ret; if ( !isOpen() ) { return 0; } ret = ::write( fileDescriptor, buf, len); if ( ret == -1 ) { if ( errno == EAGAIN ) { ret = 0; } else { throw Exception( __FILE__, __LINE__, "write error", errno); } } return ret; } /*------------------------------------------------------------------------------ * Get the file name to where to move the data saved so far. * The trick is to read the file name from a file named * /tmp/darkice.$configName.$PID , where: * - $configName is the name of the configuration section for this file sink * - $PID is the current process id *----------------------------------------------------------------------------*/ std::string FileSink :: getArchiveFileName ( void ) throw ( Exception ) { pid_t pid = getpid(); std::stringstream metaFileName; metaFileName << "/tmp/darkice." << configName << "." << pid; std::ifstream ifs(metaFileName.str().c_str()); if (!ifs.good()) { throw Exception(__FILE__, __LINE__, "can't find file ", metaFileName.str().c_str(), 0); } std::string archiveFileName; ifs >> archiveFileName; ifs.close(); return archiveFileName; } /*------------------------------------------------------------------------------ * Cut what we've done so far, and start anew. *----------------------------------------------------------------------------*/ void FileSink :: cut ( void ) throw () { flush(); close(); try { std::string archiveFileName = getArchiveFileName(); if (::rename(fileName, archiveFileName.c_str()) != 0) { reportEvent(2, "couldn't move file", fileName, "to", archiveFileName); } } catch ( Exception &e ) { reportEvent(2, "error during archive cut", e); } create(); open(); } /*------------------------------------------------------------------------------ * Close the FileSink *----------------------------------------------------------------------------*/ void FileSink :: close ( void ) throw ( Exception ) { if ( !isOpen() ) { return; } flush(); ::close( fileDescriptor); fileDescriptor = 0; } darkice-1.2/src/config.h.in0000644000175000017500000001153112170707217012516 00000000000000/* src/config.h.in. Generated from configure.in by autoheader. */ /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD /* build with aacplus library */ #undef HAVE_AACPLUS_LIB /* build with ALSA sound system */ #undef HAVE_ALSA_LIB /* Define to 1 if you have the header file. */ #undef HAVE_ERRNO_H /* build with faac library */ #undef HAVE_FAAC_LIB /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Does function getaddrinfo exist? */ #undef HAVE_GETADDRINFO /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* build with JACK audio server support */ #undef HAVE_JACK_LIB /* build with lame library */ #undef HAVE_LAME_LIB /* Define to 1 if you have the `nsl' library (-lnsl). */ #undef HAVE_LIBNSL /* Define to 1 if you have the `rt' library (-lrt). */ #undef HAVE_LIBRT /* Define to 1 if you have the `socket' library (-lsocket). */ #undef HAVE_LIBSOCKET /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H /* Define to 1 if you have the header file. */ #undef HAVE_MATH_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* use MSG_NOSIGNAL for send() */ #undef HAVE_MSG_NOSIGNAL /* Define to 1 if you have the header file. */ #undef HAVE_NETDB_H /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_IN_H /* build with Ogg Opus library */ #undef HAVE_OPUS_LIB /* Define if you have POSIX threads libraries and header files. */ #undef HAVE_PTHREAD /* Define to 1 if you have the header file. */ #undef HAVE_PTHREAD_H /* build with PULSEAUDIO sound system */ #undef HAVE_PULSEAUDIO_LIB /* Define to 1 if you have the `sched_getparam' function. */ #undef HAVE_SCHED_GETPARAM /* Define to 1 if you have the `sched_getscheduler' function. */ #undef HAVE_SCHED_GETSCHEDULER /* Define to 1 if you have the header file. */ #undef HAVE_SCHED_H /* Define to 1 if you have the header file. */ #undef HAVE_SIGNAL_H /* build with samplerate conversion through libsamplerate */ #undef HAVE_SRC_LIB /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDIO_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_AUDIOIO_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_AUDIO_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IOCTL_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SOCKET_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SOUNDCARD_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have that is POSIX.1 compatible. */ #undef HAVE_SYS_WAIT_H /* Define to 1 if you have the header file. */ #undef HAVE_TERMIOS_H /* Define to 1 if you have the header file. */ #undef HAVE_TIME_H /* build with twolame library */ #undef HAVE_TWOLAME_LIB /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* build with Ogg Vorbis library */ #undef HAVE_VORBIS_LIB /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to the necessary symbol if this constant uses a non-standard name on your system. */ #undef PTHREAD_CREATE_JOINABLE /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN # undef WORDS_BIGENDIAN # endif #endif /* Define to `int' if does not define. */ #undef pid_t /* Define to `unsigned int' if does not define. */ #undef size_t darkice-1.2/src/aflibConverterLargeFilter.h0000644000175000017500000021372612170706611015741 00000000000000/* * Copyright: (C) 2000 Julius O. Smith * * 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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Julius O. Smith jos@ccrma.stanford.edu * */ /* The default filter requires an oversampling factor of around 20% to avoid aliasing. The expensive filter is five times more computationally expensive and requires only about a 5-10% oversampling factor. Both filters have comparable stop-band attenuations (approximately 80 dB). The expensive filter is not yet documented because its cut-off frequency should be retuned slightly for optimal performance. Also, we plan to compute truly optimized resampling filters sometime in the future. In the meantime, the default filter is fast, well tuned, and works very well for its level of computational expense. */ #ifdef HAVE_CONFIG_H #include #endif #define LARGE_FILTER_NMULT ((short)65) #define LARGE_FILTER_SCALE 14746 /* Unity-gain scale factor */ #define LARGE_FILTER_NWING 8192 /* Filter table length */ short aflibConverter::LARGE_FILTER_IMP[] /* Impulse response */ = { 32767, 32766, 32764, 32761, 32756, 32750, 32743, 32734, 32724, 32713, 32700, 32686, 32671, 32654, 32636, 32617, 32596, 32574, 32551, 32526, 32500, 32473, 32445, 32415, 32383, 32351, 32317, 32282, 32246, 32208, 32169, 32129, 32087, 32044, 32000, 31955, 31908, 31860, 31811, 31760, 31708, 31655, 31601, 31545, 31489, 31431, 31371, 31311, 31249, 31186, 31122, 31056, 30990, 30922, 30853, 30783, 30711, 30639, 30565, 30490, 30414, 30337, 30258, 30179, 30098, 30016, 29933, 29849, 29764, 29677, 29590, 29501, 29411, 29321, 29229, 29136, 29042, 28947, 28851, 28753, 28655, 28556, 28456, 28354, 28252, 28149, 28044, 27939, 27833, 27725, 27617, 27508, 27398, 27287, 27175, 27062, 26948, 26833, 26717, 26601, 26483, 26365, 26246, 26125, 26005, 25883, 25760, 25637, 25512, 25387, 25261, 25135, 25007, 24879, 24750, 24620, 24490, 24358, 24226, 24094, 23960, 23826, 23691, 23556, 23420, 23283, 23146, 23008, 22869, 22730, 22590, 22449, 22308, 22166, 22024, 21881, 21738, 21594, 21449, 21304, 21159, 21013, 20866, 20719, 20572, 20424, 20275, 20127, 19977, 19828, 19678, 19527, 19376, 19225, 19073, 18921, 18769, 18616, 18463, 18310, 18157, 18003, 17849, 17694, 17539, 17384, 17229, 17074, 16918, 16762, 16606, 16450, 16294, 16137, 15980, 15823, 15666, 15509, 15352, 15195, 15037, 14880, 14722, 14564, 14407, 14249, 14091, 13933, 13775, 13618, 13460, 13302, 13144, 12987, 12829, 12671, 12514, 12356, 12199, 12042, 11885, 11728, 11571, 11414, 11257, 11101, 10945, 10789, 10633, 10477, 10322, 10167, 10012, 9857, 9702, 9548, 9394, 9241, 9087, 8934, 8781, 8629, 8477, 8325, 8174, 8023, 7872, 7722, 7572, 7422, 7273, 7124, 6976, 6828, 6681, 6534, 6387, 6241, 6096, 5951, 5806, 5662, 5518, 5375, 5233, 5091, 4949, 4808, 4668, 4528, 4389, 4250, 4112, 3975, 3838, 3702, 3566, 3431, 3297, 3163, 3030, 2898, 2766, 2635, 2505, 2375, 2246, 2118, 1990, 1864, 1738, 1612, 1487, 1364, 1240, 1118, 996, 875, 755, 636, 517, 400, 283, 166, 51, -63, -176, -289, -401, -513, -623, -733, -841, -949, -1056, -1162, -1268, -1372, -1476, -1578, -1680, -1781, -1881, -1980, -2078, -2176, -2272, -2367, -2462, -2556, -2648, -2740, -2831, -2921, -3010, -3098, -3185, -3271, -3356, -3441, -3524, -3606, -3688, -3768, -3848, -3926, -4004, -4080, -4156, -4231, -4304, -4377, -4449, -4519, -4589, -4658, -4726, -4792, -4858, -4923, -4987, -5050, -5111, -5172, -5232, -5291, -5349, -5406, -5462, -5517, -5571, -5624, -5675, -5726, -5776, -5825, -5873, -5920, -5966, -6011, -6055, -6098, -6140, -6181, -6222, -6261, -6299, -6336, -6372, -6407, -6441, -6475, -6507, -6538, -6569, -6598, -6626, -6654, -6680, -6706, -6730, -6754, -6777, -6798, -6819, -6839, -6858, -6876, -6893, -6909, -6924, -6938, -6951, -6964, -6975, -6986, -6995, -7004, -7012, -7019, -7025, -7030, -7035, -7038, -7040, -7042, -7043, -7043, -7042, -7040, -7038, -7034, -7030, -7025, -7019, -7012, -7004, -6996, -6986, -6976, -6965, -6954, -6941, -6928, -6914, -6899, -6884, -6867, -6850, -6832, -6814, -6794, -6774, -6753, -6732, -6709, -6686, -6663, -6638, -6613, -6587, -6561, -6534, -6506, -6478, -6448, -6419, -6388, -6357, -6325, -6293, -6260, -6226, -6192, -6157, -6122, -6086, -6049, -6012, -5975, -5936, -5897, -5858, -5818, -5778, -5737, -5695, -5653, -5611, -5568, -5524, -5480, -5436, -5391, -5345, -5300, -5253, -5207, -5159, -5112, -5064, -5015, -4966, -4917, -4868, -4818, -4767, -4716, -4665, -4614, -4562, -4510, -4457, -4404, -4351, -4298, -4244, -4190, -4136, -4081, -4026, -3971, -3916, -3860, -3804, -3748, -3692, -3635, -3578, -3521, -3464, -3406, -3349, -3291, -3233, -3175, -3117, -3058, -3000, -2941, -2882, -2823, -2764, -2705, -2646, -2587, -2527, -2468, -2408, -2349, -2289, -2229, -2169, -2110, -2050, -1990, -1930, -1870, -1811, -1751, -1691, -1631, -1571, -1512, -1452, -1392, -1333, -1273, -1214, -1154, -1095, -1036, -977, -918, -859, -800, -741, -683, -624, -566, -508, -450, -392, -335, -277, -220, -163, -106, -49, 6, 63, 119, 175, 230, 286, 341, 396, 450, 505, 559, 613, 667, 720, 773, 826, 878, 931, 983, 1034, 1086, 1137, 1187, 1238, 1288, 1337, 1387, 1436, 1484, 1533, 1581, 1628, 1675, 1722, 1769, 1815, 1861, 1906, 1951, 1996, 2040, 2084, 2127, 2170, 2212, 2255, 2296, 2338, 2378, 2419, 2459, 2498, 2538, 2576, 2615, 2652, 2690, 2727, 2763, 2799, 2834, 2870, 2904, 2938, 2972, 3005, 3038, 3070, 3102, 3133, 3164, 3194, 3224, 3253, 3282, 3310, 3338, 3365, 3392, 3418, 3444, 3469, 3494, 3518, 3542, 3566, 3588, 3611, 3632, 3653, 3674, 3694, 3714, 3733, 3752, 3770, 3788, 3805, 3821, 3837, 3853, 3868, 3882, 3896, 3910, 3923, 3935, 3947, 3958, 3969, 3980, 3989, 3999, 4007, 4016, 4023, 4031, 4037, 4044, 4049, 4054, 4059, 4063, 4067, 4070, 4073, 4075, 4076, 4077, 4078, 4078, 4078, 4077, 4076, 4074, 4071, 4068, 4065, 4061, 4057, 4052, 4047, 4041, 4035, 4028, 4021, 4013, 4005, 3997, 3988, 3978, 3968, 3958, 3947, 3936, 3924, 3912, 3899, 3886, 3872, 3858, 3844, 3829, 3814, 3798, 3782, 3766, 3749, 3731, 3714, 3696, 3677, 3658, 3639, 3619, 3599, 3578, 3558, 3536, 3515, 3493, 3470, 3448, 3425, 3401, 3378, 3353, 3329, 3304, 3279, 3254, 3228, 3202, 3175, 3149, 3122, 3094, 3067, 3039, 3011, 2982, 2953, 2924, 2895, 2865, 2835, 2805, 2775, 2744, 2713, 2682, 2651, 2619, 2587, 2555, 2523, 2490, 2457, 2424, 2391, 2358, 2324, 2290, 2256, 2222, 2188, 2153, 2119, 2084, 2049, 2014, 1978, 1943, 1907, 1872, 1836, 1800, 1764, 1727, 1691, 1655, 1618, 1581, 1545, 1508, 1471, 1434, 1397, 1360, 1322, 1285, 1248, 1210, 1173, 1135, 1098, 1060, 1023, 985, 947, 910, 872, 834, 797, 759, 721, 684, 646, 608, 571, 533, 496, 458, 421, 383, 346, 308, 271, 234, 197, 160, 123, 86, 49, 12, -23, -60, -96, -133, -169, -205, -241, -277, -313, -348, -384, -419, -455, -490, -525, -559, -594, -628, -663, -697, -731, -765, -798, -832, -865, -898, -931, -963, -996, -1028, -1060, -1092, -1124, -1155, -1186, -1217, -1248, -1279, -1309, -1339, -1369, -1398, -1428, -1457, -1486, -1514, -1542, -1571, -1598, -1626, -1653, -1680, -1707, -1733, -1760, -1785, -1811, -1836, -1862, -1886, -1911, -1935, -1959, -1982, -2006, -2029, -2051, -2074, -2096, -2118, -2139, -2160, -2181, -2202, -2222, -2242, -2261, -2280, -2299, -2318, -2336, -2354, -2372, -2389, -2406, -2423, -2439, -2455, -2470, -2486, -2500, -2515, -2529, -2543, -2557, -2570, -2583, -2595, -2607, -2619, -2631, -2642, -2652, -2663, -2673, -2683, -2692, -2701, -2710, -2718, -2726, -2734, -2741, -2748, -2754, -2760, -2766, -2772, -2777, -2782, -2786, -2790, -2794, -2797, -2800, -2803, -2805, -2807, -2809, -2810, -2811, -2812, -2812, -2812, -2812, -2811, -2810, -2808, -2807, -2804, -2802, -2799, -2796, -2792, -2789, -2785, -2780, -2775, -2770, -2765, -2759, -2753, -2746, -2740, -2732, -2725, -2717, -2709, -2701, -2692, -2683, -2674, -2664, -2655, -2644, -2634, -2623, -2612, -2601, -2589, -2577, -2565, -2552, -2539, -2526, -2513, -2499, -2485, -2471, -2457, -2442, -2427, -2412, -2396, -2380, -2364, -2348, -2331, -2315, -2297, -2280, -2263, -2245, -2227, -2209, -2190, -2171, -2152, -2133, -2114, -2094, -2075, -2055, -2034, -2014, -1993, -1972, -1951, -1930, -1909, -1887, -1865, -1843, -1821, -1799, -1776, -1754, -1731, -1708, -1685, -1662, -1638, -1614, -1591, -1567, -1543, -1519, -1494, -1470, -1445, -1421, -1396, -1371, -1346, -1321, -1295, -1270, -1244, -1219, -1193, -1167, -1142, -1116, -1090, -1064, -1037, -1011, -985, -958, -932, -905, -879, -852, -826, -799, -772, -745, -719, -692, -665, -638, -611, -584, -557, -530, -503, -476, -449, -422, -395, -368, -341, -314, -287, -260, -234, -207, -180, -153, -126, -100, -73, -46, -20, 6, 32, 59, 85, 111, 138, 164, 190, 216, 242, 268, 294, 319, 345, 370, 396, 421, 446, 471, 496, 521, 546, 571, 595, 619, 644, 668, 692, 716, 739, 763, 787, 810, 833, 856, 879, 902, 924, 947, 969, 991, 1013, 1035, 1056, 1078, 1099, 1120, 1141, 1162, 1182, 1202, 1223, 1243, 1262, 1282, 1301, 1320, 1339, 1358, 1377, 1395, 1413, 1431, 1449, 1467, 1484, 1501, 1518, 1535, 1551, 1567, 1583, 1599, 1615, 1630, 1645, 1660, 1674, 1689, 1703, 1717, 1731, 1744, 1757, 1770, 1783, 1795, 1808, 1820, 1831, 1843, 1854, 1865, 1876, 1886, 1897, 1907, 1916, 1926, 1935, 1944, 1953, 1961, 1970, 1978, 1985, 1993, 2000, 2007, 2014, 2020, 2026, 2032, 2038, 2043, 2048, 2053, 2058, 2062, 2066, 2070, 2073, 2077, 2080, 2083, 2085, 2087, 2089, 2091, 2093, 2094, 2095, 2095, 2096, 2096, 2096, 2096, 2095, 2094, 2093, 2092, 2090, 2088, 2086, 2084, 2081, 2079, 2075, 2072, 2069, 2065, 2061, 2056, 2052, 2047, 2042, 2037, 2031, 2025, 2019, 2013, 2006, 2000, 1993, 1986, 1978, 1971, 1963, 1955, 1946, 1938, 1929, 1920, 1911, 1901, 1892, 1882, 1872, 1862, 1851, 1841, 1830, 1819, 1807, 1796, 1784, 1772, 1760, 1748, 1735, 1723, 1710, 1697, 1684, 1670, 1657, 1643, 1629, 1615, 1601, 1586, 1572, 1557, 1542, 1527, 1512, 1496, 1481, 1465, 1449, 1433, 1417, 1401, 1384, 1368, 1351, 1334, 1317, 1300, 1283, 1265, 1248, 1230, 1212, 1195, 1177, 1159, 1140, 1122, 1104, 1085, 1067, 1048, 1029, 1010, 991, 972, 953, 934, 915, 895, 876, 856, 837, 817, 797, 777, 758, 738, 718, 698, 678, 658, 637, 617, 597, 577, 556, 536, 516, 495, 475, 454, 434, 414, 393, 373, 352, 332, 311, 291, 270, 250, 229, 208, 188, 168, 147, 127, 106, 86, 65, 45, 25, 5, -15, -35, -55, -75, -95, -115, -135, -155, -175, -195, -215, -234, -254, -274, -293, -313, -332, -351, -370, -390, -409, -428, -446, -465, -484, -503, -521, -539, -558, -576, -594, -612, -630, -648, -666, -683, -701, -718, -735, -752, -769, -786, -803, -819, -836, -852, -868, -885, -900, -916, -932, -947, -963, -978, -993, -1008, -1023, -1038, -1052, -1066, -1081, -1095, -1108, -1122, -1136, -1149, -1162, -1175, -1188, -1201, -1214, -1226, -1238, -1250, -1262, -1274, -1285, -1297, -1308, -1319, -1330, -1340, -1351, -1361, -1371, -1381, -1390, -1400, -1409, -1418, -1427, -1436, -1445, -1453, -1461, -1469, -1477, -1485, -1492, -1499, -1506, -1513, -1520, -1526, -1532, -1538, -1544, -1550, -1555, -1560, -1566, -1570, -1575, -1579, -1584, -1588, -1592, -1595, -1599, -1602, -1605, -1608, -1610, -1613, -1615, -1617, -1619, -1620, -1622, -1623, -1624, -1625, -1625, -1626, -1626, -1626, -1626, -1625, -1625, -1624, -1623, -1622, -1621, -1619, -1617, -1615, -1613, -1611, -1608, -1605, -1603, -1599, -1596, -1593, -1589, -1585, -1581, -1577, -1572, -1568, -1563, -1558, -1553, -1547, -1542, -1536, -1530, -1524, -1518, -1511, -1505, -1498, -1491, -1484, -1477, -1469, -1462, -1454, -1446, -1438, -1430, -1421, -1413, -1404, -1395, -1386, -1377, -1367, -1358, -1348, -1338, -1328, -1318, -1308, -1297, -1287, -1276, -1265, -1254, -1243, -1232, -1221, -1209, -1198, -1186, -1174, -1162, -1150, -1138, -1125, -1113, -1100, -1087, -1075, -1062, -1049, -1035, -1022, -1009, -995, -982, -968, -954, -941, -927, -913, -898, -884, -870, -856, -841, -827, -812, -797, -783, -768, -753, -738, -723, -708, -692, -677, -662, -647, -631, -616, -600, -585, -569, -554, -538, -522, -506, -491, -475, -459, -443, -427, -411, -395, -379, -363, -347, -331, -315, -299, -283, -267, -251, -235, -218, -202, -186, -170, -154, -138, -122, -106, -90, -74, -58, -42, -26, -10, 5, 21, 37, 53, 69, 85, 100, 116, 132, 147, 163, 179, 194, 209, 225, 240, 256, 271, 286, 301, 316, 331, 346, 361, 376, 391, 405, 420, 434, 449, 463, 477, 492, 506, 520, 534, 548, 561, 575, 589, 602, 615, 629, 642, 655, 668, 681, 694, 706, 719, 731, 744, 756, 768, 780, 792, 804, 816, 827, 839, 850, 861, 872, 883, 894, 905, 915, 926, 936, 946, 956, 966, 976, 986, 995, 1005, 1014, 1023, 1032, 1041, 1049, 1058, 1066, 1075, 1083, 1091, 1099, 1106, 1114, 1121, 1128, 1135, 1142, 1149, 1156, 1162, 1169, 1175, 1181, 1187, 1192, 1198, 1203, 1208, 1214, 1218, 1223, 1228, 1232, 1237, 1241, 1245, 1249, 1252, 1256, 1259, 1262, 1265, 1268, 1271, 1273, 1276, 1278, 1280, 1282, 1284, 1285, 1287, 1288, 1289, 1290, 1291, 1292, 1292, 1292, 1293, 1293, 1292, 1292, 1292, 1291, 1290, 1289, 1288, 1287, 1285, 1284, 1282, 1280, 1278, 1276, 1274, 1271, 1269, 1266, 1263, 1260, 1257, 1253, 1250, 1246, 1242, 1238, 1234, 1230, 1225, 1221, 1216, 1211, 1206, 1201, 1196, 1190, 1185, 1179, 1173, 1167, 1161, 1155, 1149, 1142, 1136, 1129, 1122, 1115, 1108, 1101, 1094, 1086, 1078, 1071, 1063, 1055, 1047, 1039, 1030, 1022, 1013, 1005, 996, 987, 978, 969, 960, 951, 941, 932, 922, 913, 903, 893, 883, 873, 863, 853, 842, 832, 821, 811, 800, 789, 778, 768, 757, 746, 734, 723, 712, 701, 689, 678, 666, 654, 643, 631, 619, 607, 596, 584, 572, 559, 547, 535, 523, 511, 498, 486, 474, 461, 449, 436, 424, 411, 399, 386, 373, 361, 348, 335, 322, 310, 297, 284, 271, 258, 246, 233, 220, 207, 194, 181, 168, 156, 143, 130, 117, 104, 91, 78, 65, 53, 40, 27, 14, 1, -10, -23, -36, -48, -61, -74, -86, -99, -111, -124, -136, -149, -161, -174, -186, -198, -211, -223, -235, -247, -259, -271, -283, -295, -307, -319, -330, -342, -354, -365, -377, -388, -399, -411, -422, -433, -444, -455, -466, -477, -488, -499, -509, -520, -530, -541, -551, -561, -571, -581, -591, -601, -611, -621, -631, -640, -650, -659, -668, -677, -686, -695, -704, -713, -722, -730, -739, -747, -755, -763, -771, -779, -787, -795, -803, -810, -817, -825, -832, -839, -846, -853, -859, -866, -873, -879, -885, -891, -897, -903, -909, -915, -920, -926, -931, -936, -941, -946, -951, -955, -960, -964, -969, -973, -977, -981, -985, -988, -992, -995, -999, -1002, -1005, -1008, -1011, -1013, -1016, -1018, -1020, -1023, -1025, -1026, -1028, -1030, -1031, -1033, -1034, -1035, -1036, -1037, -1038, -1038, -1039, -1039, -1039, -1039, -1039, -1039, -1039, -1038, -1038, -1037, -1036, -1036, -1034, -1033, -1032, -1031, -1029, -1027, -1026, -1024, -1022, -1019, -1017, -1015, -1012, -1010, -1007, -1004, -1001, -998, -995, -991, -988, -984, -980, -977, -973, -969, -965, -960, -956, -951, -947, -942, -937, -932, -927, -922, -917, -912, -906, -901, -895, -889, -883, -877, -871, -865, -859, -853, -846, -840, -833, -826, -819, -812, -805, -798, -791, -784, -777, -769, -762, -754, -746, -739, -731, -723, -715, -707, -699, -691, -682, -674, -665, -657, -648, -640, -631, -622, -614, -605, -596, -587, -578, -569, -559, -550, -541, -532, -522, -513, -503, -494, -484, -474, -465, -455, -445, -436, -426, -416, -406, -396, -386, -376, -366, -356, -346, -336, -325, -315, -305, -295, -285, -274, -264, -254, -243, -233, -223, -212, -202, -192, -181, -171, -161, -150, -140, -129, -119, -108, -98, -88, -77, -67, -57, -46, -36, -25, -15, -5, 5, 15, 25, 35, 46, 56, 66, 76, 86, 97, 107, 117, 127, 137, 147, 157, 167, 177, 186, 196, 206, 216, 225, 235, 245, 254, 264, 273, 283, 292, 301, 311, 320, 329, 338, 347, 356, 365, 374, 383, 392, 400, 409, 418, 426, 435, 443, 451, 460, 468, 476, 484, 492, 500, 508, 515, 523, 531, 538, 546, 553, 560, 568, 575, 582, 589, 596, 602, 609, 616, 622, 629, 635, 642, 648, 654, 660, 666, 672, 678, 683, 689, 694, 700, 705, 710, 715, 720, 725, 730, 735, 739, 744, 748, 753, 757, 761, 765, 769, 773, 777, 780, 784, 787, 791, 794, 797, 800, 803, 806, 809, 811, 814, 816, 818, 821, 823, 825, 827, 828, 830, 832, 833, 835, 836, 837, 838, 839, 840, 841, 841, 842, 842, 843, 843, 843, 843, 843, 843, 843, 842, 842, 841, 840, 840, 839, 838, 837, 835, 834, 833, 831, 830, 828, 826, 824, 822, 820, 818, 816, 813, 811, 808, 806, 803, 800, 797, 794, 791, 788, 784, 781, 777, 774, 770, 766, 763, 759, 755, 750, 746, 742, 738, 733, 729, 724, 719, 714, 710, 705, 700, 694, 689, 684, 679, 673, 668, 662, 657, 651, 645, 639, 633, 627, 621, 615, 609, 603, 596, 590, 584, 577, 571, 564, 557, 551, 544, 537, 530, 523, 516, 509, 502, 495, 487, 480, 473, 465, 458, 450, 443, 435, 428, 420, 413, 405, 397, 389, 381, 374, 366, 358, 350, 342, 334, 326, 318, 310, 301, 293, 285, 277, 269, 260, 252, 244, 236, 227, 219, 211, 202, 194, 185, 177, 169, 160, 152, 143, 135, 126, 118, 110, 101, 93, 84, 76, 67, 59, 50, 42, 34, 25, 17, 8, 0, -7, -16, -24, -32, -41, -49, -57, -66, -74, -82, -90, -98, -106, -115, -123, -131, -139, -147, -155, -163, -171, -179, -186, -194, -202, -210, -217, -225, -233, -240, -248, -255, -263, -270, -278, -285, -292, -299, -307, -314, -321, -328, -335, -342, -349, -356, -362, -369, -376, -382, -389, -396, -402, -408, -415, -421, -427, -433, -439, -445, -451, -457, -463, -469, -475, -480, -486, -491, -497, -502, -507, -513, -518, -523, -528, -533, -538, -542, -547, -552, -556, -561, -565, -570, -574, -578, -582, -586, -590, -594, -598, -602, -605, -609, -612, -616, -619, -622, -625, -629, -632, -634, -637, -640, -643, -645, -648, -650, -653, -655, -657, -659, -661, -663, -665, -667, -668, -670, -671, -673, -674, -675, -676, -678, -679, -679, -680, -681, -682, -682, -683, -683, -683, -684, -684, -684, -684, -684, -684, -683, -683, -682, -682, -681, -681, -680, -679, -678, -677, -676, -675, -674, -672, -671, -669, -668, -666, -664, -662, -661, -659, -657, -654, -652, -650, -648, -645, -643, -640, -637, -635, -632, -629, -626, -623, -620, -617, -613, -610, -607, -603, -600, -596, -593, -589, -585, -581, -577, -573, -569, -565, -561, -557, -552, -548, -544, -539, -534, -530, -525, -520, -516, -511, -506, -501, -496, -491, -486, -481, -475, -470, -465, -460, -454, -449, -443, -438, -432, -426, -421, -415, -409, -403, -398, -392, -386, -380, -374, -368, -362, -355, -349, -343, -337, -331, -324, -318, -312, -305, -299, -292, -286, -280, -273, -266, -260, -253, -247, -240, -234, -227, -220, -213, -207, -200, -193, -187, -180, -173, -166, -159, -153, -146, -139, -132, -125, -118, -112, -105, -98, -91, -84, -77, -70, -64, -57, -50, -43, -36, -29, -22, -16, -9, -2, 4, 11, 17, 24, 31, 38, 44, 51, 58, 64, 71, 78, 84, 91, 98, 104, 111, 117, 124, 130, 137, 143, 149, 156, 162, 168, 175, 181, 187, 193, 199, 205, 212, 218, 224, 230, 236, 241, 247, 253, 259, 265, 270, 276, 282, 287, 293, 298, 304, 309, 314, 320, 325, 330, 335, 340, 345, 350, 355, 360, 365, 370, 375, 380, 384, 389, 393, 398, 402, 407, 411, 415, 419, 424, 428, 432, 436, 440, 443, 447, 451, 455, 458, 462, 465, 469, 472, 475, 479, 482, 485, 488, 491, 494, 497, 499, 502, 505, 507, 510, 512, 515, 517, 519, 522, 524, 526, 528, 530, 532, 533, 535, 537, 538, 540, 541, 543, 544, 545, 546, 548, 549, 550, 550, 551, 552, 553, 553, 554, 554, 555, 555, 555, 556, 556, 556, 556, 556, 556, 555, 555, 555, 554, 554, 553, 553, 552, 551, 551, 550, 549, 548, 547, 546, 545, 543, 542, 541, 539, 538, 536, 534, 533, 531, 529, 527, 525, 523, 521, 519, 517, 514, 512, 510, 507, 505, 502, 500, 497, 494, 492, 489, 486, 483, 480, 477, 474, 471, 467, 464, 461, 457, 454, 450, 447, 443, 440, 436, 432, 429, 425, 421, 417, 413, 409, 405, 401, 397, 393, 388, 384, 380, 375, 371, 367, 362, 358, 353, 349, 344, 339, 335, 330, 325, 321, 316, 311, 306, 301, 296, 291, 286, 281, 276, 271, 266, 261, 256, 251, 245, 240, 235, 230, 225, 219, 214, 209, 203, 198, 193, 187, 182, 176, 171, 165, 160, 154, 149, 144, 138, 132, 127, 121, 116, 110, 105, 99, 94, 88, 83, 77, 71, 66, 60, 55, 49, 44, 38, 33, 27, 21, 16, 10, 5, 0, -5, -11, -16, -22, -27, -33, -38, -43, -49, -54, -60, -65, -70, -76, -81, -86, -92, -97, -102, -107, -113, -118, -123, -128, -133, -138, -143, -148, -153, -158, -163, -168, -173, -178, -183, -188, -192, -197, -202, -207, -211, -216, -221, -225, -230, -234, -239, -243, -247, -252, -256, -260, -265, -269, -273, -277, -281, -285, -289, -293, -297, -301, -305, -308, -312, -316, -319, -323, -327, -330, -334, -337, -340, -344, -347, -350, -353, -357, -360, -363, -366, -369, -372, -374, -377, -380, -383, -385, -388, -390, -393, -395, -398, -400, -402, -405, -407, -409, -411, -413, -415, -417, -419, -420, -422, -424, -425, -427, -429, -430, -431, -433, -434, -435, -436, -438, -439, -440, -441, -442, -442, -443, -444, -445, -445, -446, -446, -447, -447, -448, -448, -448, -448, -449, -449, -449, -449, -449, -448, -448, -448, -448, -447, -447, -446, -446, -445, -445, -444, -443, -442, -442, -441, -440, -439, -438, -437, -435, -434, -433, -432, -430, -429, -427, -426, -424, -423, -421, -419, -418, -416, -414, -412, -410, -408, -406, -404, -402, -400, -397, -395, -393, -390, -388, -385, -383, -380, -378, -375, -373, -370, -367, -364, -361, -359, -356, -353, -350, -347, -344, -340, -337, -334, -331, -328, -324, -321, -318, -314, -311, -307, -304, -300, -297, -293, -290, -286, -282, -279, -275, -271, -267, -263, -260, -256, -252, -248, -244, -240, -236, -232, -228, -224, -220, -216, -212, -207, -203, -199, -195, -191, -186, -182, -178, -174, -169, -165, -161, -156, -152, -148, -143, -139, -134, -130, -126, -121, -117, -112, -108, -103, -99, -95, -90, -86, -81, -77, -72, -68, -63, -59, -54, -50, -45, -41, -36, -32, -27, -23, -18, -14, -9, -5, 0, 3, 7, 12, 16, 21, 25, 29, 34, 38, 43, 47, 51, 56, 60, 64, 69, 73, 77, 81, 85, 90, 94, 98, 102, 106, 110, 115, 119, 123, 127, 131, 135, 139, 143, 146, 150, 154, 158, 162, 166, 169, 173, 177, 181, 184, 188, 192, 195, 199, 202, 206, 209, 212, 216, 219, 223, 226, 229, 232, 236, 239, 242, 245, 248, 251, 254, 257, 260, 263, 266, 268, 271, 274, 277, 279, 282, 284, 287, 289, 292, 294, 297, 299, 301, 304, 306, 308, 310, 312, 314, 316, 318, 320, 322, 324, 326, 328, 329, 331, 333, 334, 336, 337, 339, 340, 341, 343, 344, 345, 346, 348, 349, 350, 351, 352, 353, 354, 354, 355, 356, 357, 357, 358, 358, 359, 359, 360, 360, 361, 361, 361, 361, 362, 362, 362, 362, 362, 362, 362, 361, 361, 361, 361, 360, 360, 360, 359, 359, 358, 358, 357, 356, 356, 355, 354, 353, 352, 351, 350, 349, 348, 347, 346, 345, 344, 343, 341, 340, 339, 337, 336, 334, 333, 331, 330, 328, 326, 324, 323, 321, 319, 317, 315, 313, 311, 309, 307, 305, 303, 301, 299, 297, 294, 292, 290, 288, 285, 283, 280, 278, 275, 273, 270, 268, 265, 263, 260, 257, 254, 252, 249, 246, 243, 240, 238, 235, 232, 229, 226, 223, 220, 217, 214, 211, 208, 204, 201, 198, 195, 192, 188, 185, 182, 179, 175, 172, 169, 165, 162, 159, 155, 152, 149, 145, 142, 138, 135, 131, 128, 124, 121, 117, 114, 110, 107, 103, 100, 96, 93, 89, 85, 82, 78, 75, 71, 67, 64, 60, 57, 53, 49, 46, 42, 39, 35, 31, 28, 24, 21, 17, 14, 10, 6, 3, 0, -3, -7, -10, -14, -18, -21, -25, -28, -32, -35, -39, -42, -45, -49, -52, -56, -59, -63, -66, -69, -73, -76, -79, -83, -86, -89, -93, -96, -99, -102, -105, -109, -112, -115, -118, -121, -124, -127, -130, -133, -136, -139, -142, -145, -148, -151, -154, -157, -160, -162, -165, -168, -171, -173, -176, -179, -181, -184, -186, -189, -191, -194, -196, -199, -201, -204, -206, -208, -211, -213, -215, -217, -219, -221, -224, -226, -228, -230, -232, -234, -236, -237, -239, -241, -243, -245, -246, -248, -250, -251, -253, -254, -256, -257, -259, -260, -262, -263, -264, -266, -267, -268, -269, -270, -271, -273, -274, -275, -275, -276, -277, -278, -279, -280, -281, -281, -282, -283, -283, -284, -284, -285, -285, -286, -286, -286, -287, -287, -287, -287, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -287, -287, -287, -287, -286, -286, -286, -285, -285, -284, -284, -283, -283, -282, -281, -281, -280, -279, -278, -277, -277, -276, -275, -274, -273, -272, -271, -270, -269, -267, -266, -265, -264, -262, -261, -260, -258, -257, -256, -254, -253, -251, -250, -248, -247, -245, -243, -242, -240, -238, -236, -235, -233, -231, -229, -227, -225, -223, -221, -219, -217, -215, -213, -211, -209, -207, -205, -203, -201, -198, -196, -194, -192, -189, -187, -185, -182, -180, -178, -175, -173, -170, -168, -165, -163, -160, -158, -155, -153, -150, -148, -145, -142, -140, -137, -135, -132, -129, -127, -124, -121, -118, -116, -113, -110, -108, -105, -102, -99, -96, -94, -91, -88, -85, -82, -80, -77, -74, -71, -68, -65, -63, -60, -57, -54, -51, -48, -45, -42, -40, -37, -34, -31, -28, -25, -22, -20, -17, -14, -11, -8, -5, -2, 0, 2, 5, 8, 11, 13, 16, 19, 22, 25, 27, 30, 33, 36, 38, 41, 44, 47, 49, 52, 55, 57, 60, 63, 65, 68, 71, 73, 76, 78, 81, 83, 86, 88, 91, 93, 96, 98, 101, 103, 106, 108, 110, 113, 115, 117, 120, 122, 124, 127, 129, 131, 133, 135, 137, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 161, 163, 165, 167, 169, 171, 172, 174, 176, 177, 179, 181, 182, 184, 185, 187, 188, 190, 191, 193, 194, 195, 197, 198, 199, 201, 202, 203, 204, 205, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 216, 217, 218, 219, 219, 220, 221, 222, 222, 223, 223, 224, 224, 225, 225, 226, 226, 227, 227, 227, 227, 228, 228, 228, 228, 228, 229, 229, 229, 229, 229, 229, 229, 229, 228, 228, 228, 228, 228, 228, 227, 227, 227, 226, 226, 225, 225, 225, 224, 224, 223, 222, 222, 221, 221, 220, 219, 218, 218, 217, 216, 215, 214, 214, 213, 212, 211, 210, 209, 208, 207, 206, 205, 203, 202, 201, 200, 199, 197, 196, 195, 194, 192, 191, 190, 188, 187, 185, 184, 182, 181, 179, 178, 176, 175, 173, 172, 170, 168, 167, 165, 163, 162, 160, 158, 156, 155, 153, 151, 149, 147, 146, 144, 142, 140, 138, 136, 134, 132, 130, 128, 126, 124, 122, 120, 118, 116, 114, 112, 110, 108, 106, 104, 102, 99, 97, 95, 93, 91, 89, 87, 84, 82, 80, 78, 76, 73, 71, 69, 67, 64, 62, 60, 58, 56, 53, 51, 49, 47, 44, 42, 40, 38, 35, 33, 31, 28, 26, 24, 22, 19, 17, 15, 13, 10, 8, 6, 4, 1, 0, -2, -4, -6, -9, -11, -13, -15, -17, -20, -22, -24, -26, -28, -30, -33, -35, -37, -39, -41, -43, -45, -47, -49, -52, -54, -56, -58, -60, -62, -64, -66, -68, -70, -72, -74, -76, -77, -79, -81, -83, -85, -87, -89, -90, -92, -94, -96, -98, -99, -101, -103, -105, -106, -108, -110, -111, -113, -114, -116, -118, -119, -121, -122, -124, -125, -127, -128, -130, -131, -132, -134, -135, -136, -138, -139, -140, -142, -143, -144, -145, -146, -148, -149, -150, -151, -152, -153, -154, -155, -156, -157, -158, -159, -160, -161, -162, -162, -163, -164, -165, -166, -166, -167, -168, -168, -169, -170, -170, -171, -171, -172, -172, -173, -173, -174, -174, -175, -175, -175, -176, -176, -176, -177, -177, -177, -177, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -177, -177, -177, -177, -177, -176, -176, -176, -175, -175, -175, -174, -174, -173, -173, -172, -172, -171, -171, -170, -170, -169, -168, -168, -167, -166, -166, -165, -164, -163, -163, -162, -161, -160, -159, -158, -158, -157, -156, -155, -154, -153, -152, -151, -150, -149, -148, -147, -145, -144, -143, -142, -141, -140, -139, -137, -136, -135, -134, -132, -131, -130, -128, -127, -126, -124, -123, -122, -120, -119, -118, -116, -115, -113, -112, -110, -109, -107, -106, -104, -103, -101, -100, -98, -97, -95, -94, -92, -90, -89, -87, -86, -84, -82, -81, -79, -77, -76, -74, -72, -71, -69, -67, -66, -64, -62, -60, -59, -57, -55, -54, -52, -50, -48, -47, -45, -43, -41, -40, -38, -36, -34, -33, -31, -29, -27, -25, -24, -22, -20, -18, -17, -15, -13, -11, -10, -8, -6, -4, -3, -1, 0, 2, 3, 5, 7, 8, 10, 12, 14, 15, 17, 19, 20, 22, 24, 25, 27, 29, 30, 32, 34, 35, 37, 39, 40, 42, 43, 45, 47, 48, 50, 51, 53, 54, 56, 57, 59, 60, 62, 63, 65, 66, 68, 69, 70, 72, 73, 75, 76, 77, 79, 80, 81, 83, 84, 85, 87, 88, 89, 90, 92, 93, 94, 95, 96, 97, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 117, 118, 119, 120, 121, 121, 122, 123, 124, 124, 125, 126, 126, 127, 128, 128, 129, 129, 130, 130, 131, 131, 132, 132, 133, 133, 134, 134, 135, 135, 135, 136, 136, 136, 136, 137, 137, 137, 137, 138, 138, 138, 138, 138, 138, 138, 138, 139, 139, 139, 139, 139, 139, 139, 138, 138, 138, 138, 138, 138, 138, 138, 137, 137, 137, 137, 136, 136, 136, 136, 135, 135, 134, 134, 134, 133, 133, 132, 132, 132, 131, 131, 130, 129, 129, 128, 128, 127, 127, 126, 125, 125, 124, 123, 123, 122, 121, 121, 120, 119, 118, 117, 117, 116, 115, 114, 113, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 87, 86, 85, 84, 83, 82, 81, 79, 78, 77, 76, 75, 73, 72, 71, 70, 68, 67, 66, 65, 63, 62, 61, 60, 58, 57, 56, 54, 53, 52, 50, 49, 48, 47, 45, 44, 43, 41, 40, 39, 37, 36, 34, 33, 32, 30, 29, 28, 26, 25, 24, 22, 21, 20, 18, 17, 16, 14, 13, 11, 10, 9, 7, 6, 5, 3, 2, 1, 0, -1, -2, -4, -5, -6, -8, -9, -10, -11, -13, -14, -15, -17, -18, -19, -20, -22, -23, -24, -26, -27, -28, -29, -30, -32, -33, -34, -35, -37, -38, -39, -40, -41, -42, -44, -45, -46, -47, -48, -49, -50, -51, -53, -54, -55, -56, -57, -58, -59, -60, -61, -62, -63, -64, -65, -66, -67, -68, -69, -70, -71, -71, -72, -73, -74, -75, -76, -77, -77, -78, -79, -80, -81, -81, -82, -83, -84, -84, -85, -86, -87, -87, -88, -89, -89, -90, -90, -91, -92, -92, -93, -93, -94, -94, -95, -95, -96, -96, -97, -97, -98, -98, -99, -99, -99, -100, -100, -100, -101, -101, -101, -102, -102, -102, -102, -103, -103, -103, -103, -103, -104, -104, -104, -104, -104, -104, -104, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -104, -104, -104, -104, -104, -104, -104, -104, -103, -103, -103, -103, -103, -102, -102, -102, -102, -101, -101, -101, -100, -100, -100, -99, -99, -99, -98, -98, -97, -97, -97, -96, -96, -95, -95, -94, -94, -93, -93, -92, -92, -91, -90, -90, -89, -89, -88, -87, -87, -86, -86, -85, -84, -84, -83, -82, -81, -81, -80, -79, -79, -78, -77, -76, -76, -75, -74, -73, -72, -72, -71, -70, -69, -68, -67, -67, -66, -65, -64, -63, -62, -61, -61, -60, -59, -58, -57, -56, -55, -54, -53, -52, -51, -50, -49, -48, -48, -47, -46, -45, -44, -43, -42, -41, -40, -39, -38, -37, -36, -35, -34, -33, -32, -31, -30, -29, -28, -27, -26, -25, -24, -23, -21, -20, -19, -18, -17, -16, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 32, 33, 34, 35, 36, 37, 38, 38, 39, 40, 41, 42, 42, 43, 44, 45, 46, 46, 47, 48, 49, 49, 50, 51, 52, 52, 53, 54, 54, 55, 56, 56, 57, 58, 58, 59, 59, 60, 61, 61, 62, 62, 63, 64, 64, 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 69, 70, 70, 71, 71, 72, 72, 72, 73, 73, 73, 74, 74, 74, 75, 75, 75, 76, 76, 76, 76, 77, 77, 77, 77, 77, 78, 78, 78, 78, 78, 78, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 78, 78, 78, 78, 78, 78, 77, 77, 77, 77, 77, 76, 76, 76, 76, 75, 75, 75, 74, 74, 74, 74, 73, 73, 72, 72, 72, 71, 71, 71, 70, 70, 69, 69, 69, 68, 68, 67, 67, 66, 66, 65, 65, 64, 64, 63, 63, 62, 62, 61, 61, 60, 60, 59, 59, 58, 57, 57, 56, 56, 55, 55, 54, 53, 53, 52, 51, 51, 50, 50, 49, 48, 48, 47, 46, 46, 45, 44, 44, 43, 42, 41, 41, 40, 39, 39, 38, 37, 37, 36, 35, 34, 34, 33, 32, 31, 31, 30, 29, 28, 28, 27, 26, 25, 25, 24, 23, 22, 22, 21, 20, 19, 19, 18, 17, 16, 16, 15, 14, 13, 12, 12, 11, 10, 9, 9, 8, 7, 6, 6, 5, 4, 3, 3, 2, 1, 0, 0, 0, -1, -2, -2, -3, -4, -5, -5, -6, -7, -8, -8, -9, -10, -10, -11, -12, -13, -13, -14, -15, -15, -16, -17, -17, -18, -19, -19, -20, -21, -21, -22, -23, -23, -24, -25, -25, -26, -27, -27, -28, -28, -29, -30, -30, -31, -31, -32, -33, -33, -34, -34, -35, -35, -36, -36, -37, -37, -38, -38, -39, -39, -40, -40, -41, -41, -42, -42, -43, -43, -44, -44, -45, -45, -45, -46, -46, -47, -47, -47, -48, -48, -49, -49, -49, -50, -50, -50, -51, -51, -51, -51, -52, -52, -52, -53, -53, -53, -53, -54, -54, -54, -54, -54, -55, -55, -55, -55, -55, -56, -56, -56, -56, -56, -56, -56, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -56, -56, -56, -56, -56, -56, -56, -55, -55, -55, -55, -55, -54, -54, -54, -54, -54, -53, -53, -53, -53, -52, -52, -52, -52, -51, -51, -51, -50, -50, -50, -50, -49, -49, -49, -48, -48, -48, -47, -47, -46, -46, -46, -45, -45, -45, -44, -44, -43, -43, -43, -42, -42, -41, -41, -40, -40, -40, -39, -39, -38, -38, -37, -37, -36, -36, -35, -35, -35, -34, -34, -33, -33, -32, -32, -31, -31, -30, -30, -29, -29, -28, -28, -27, -26, -26, -25, -25, -24, -24, -23, -23, -22, -22, -21, -21, -20, -19, -19, -18, -18, -17, -17, -16, -16, -15, -15, -14, -13, -13, -12, -12, -11, -11, -10, -9, -9, -8, -8, -7, -7, -6, -6, -5, -4, -4, -3, -3, -2, -2, -1, -1, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 22, 23, 23, 24, 24, 25, 25, 25, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 30, 30, 30, 31, 31, 31, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 35, 35, 35, 35, 36, 36, 36, 36, 37, 37, 37, 37, 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, 40, 40, 40, 40, 40, 40, 40, 41, 41, 41, 41, 41, 41, 41, 41, 41, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 40, 40, 40, 40, 40, 40, 40, 39, 39, 39, 39, 39, 38, 38, 38, 38, 38, 37, 37, 37, 37, 37, 36, 36, 36, 36, 35, 35, 35, 35, 34, 34, 34, 34, 33, 33, 33, 33, 32, 32, 32, 31, 31, 31, 30, 30, 30, 30, 29, 29, 29, 28, 28, 28, 27, 27, 27, 26, 26, 26, 25, 25, 25, 24, 24, 23, 23, 23, 22, 22, 22, 21, 21, 21, 20, 20, 19, 19, 19, 18, 18, 18, 17, 17, 16, 16, 16, 15, 15, 14, 14, 14, 13, 13, 12, 12, 12, 11, 11, 10, 10, 10, 9, 9, 8, 8, 8, 7, 7, 6, 6, 6, 5, 5, 4, 4, 4, 3, 3, 2, 2, 2, 1, 1, 1, 0, 0, 0, 0, 0, -1, -1, -2, -2, -2, -3, -3, -3, -4, -4, -5, -5, -5, -6, -6, -6, -7, -7, -7, -8, -8, -9, -9, -9, -10, -10, -10, -11, -11, -11, -12, -12, -12, -13, -13, -13, -14, -14, -14, -14, -15, -15, -15, -16, -16, -16, -17, -17, -17, -17, -18, -18, -18, -19, -19, -19, -19, -20, -20, -20, -20, -21, -21, -21, -21, -21, -22, -22, -22, -22, -23, -23, -23, -23, -23, -24, -24, -24, -24, -24, -25, -25, -25, -25, -25, -25, -26, -26, -26, -26, -26, -26, -26, -27, -27, -27, -27, -27, -27, -27, -27, -27, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -26, -26, -26, -26, -26, -26, -26, -25, -25, -25, -25, -25, -25, -25, -24, -24, -24, -24, -24, -24, -23, -23, -23, -23, -23, -22, -22, -22, -22, -22, -21, -21, -21, -21, -21, -20, -20, -20, -20, -20, -19, -19, -19, -19, -18, -18, -18, -18, -17, -17, -17, -17, -16, -16, -16, -16, -15, -15, -15, -15, -14, -14, -14, -14, -13, -13, -13, -13, -12, -12, -12, -12, -11, -11, -11, -11, -10, -10, -10, -9, -9, -9, -9, -8, -8, -8, -7, -7, -7, -7, -6, -6, -6, -6, -5, -5, -5, -4, -4, -4, -4, -3, -3, -3, -2, -2, -2, -2, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 17, 17, 17, 17, 17, 17, 17, 17, 16, 16, 16, 16, 16, 16, 16, 16, 15, 15, 15, 15, 15, 15, 15, 14, 14, 14, 14, 14, 14, 14, 13, 13, 13, 13, 13, 13, 12, 12, 12, 12, 12, 12, 11, 11, 11, 11, 11, 11, 10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -2, -2, -2, -2, -2, -2, -3, -3, -3, -3, -3, -3, -4, -4, -4, -4, -4, -4, -5, -5, -5, -5, -5, -5, -5, -6, -6, -6, -6, -6, -6, -6, -7, -7, -7, -7, -7, -7, -7, -7, -8, -8, -8, -8, -8, -8, -8, -8, -9, -9, -9, -9, -9, -9, -9, -9, -9, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -7, -7, -7, -7, -7, -7, -7, -7, -7, -6, -6, -6, -6, -6, -6, -6, -6, -6, -5, -5, -5, -5, -5, -5, -5, -5, -4, -4, -4, -4, -4, -4, -4, -4, -4, -3, -3, -3, -3, -3, -3, -3, -3, -2, -2, -2, -2, -2, -2, -2, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; static short LARGE_FILTER_IMPD[] /* Impulse response differences */ = { -1, -2, -3, -5, -6, -7, -9, -10, -11, -13, -14, -15, -17, -18, -19, -21, -22, -23, -25, -26, -27, -28, -30, -32, -32, -34, -35, -36, -38, -39, -40, -42, -43, -44, -45, -47, -48, -49, -51, -52, -53, -54, -56, -56, -58, -60, -60, -62, -63, -64, -66, -66, -68, -69, -70, -72, -72, -74, -75, -76, -77, -79, -79, -81, -82, -83, -84, -85, -87, -87, -89, -90, -90, -92, -93, -94, -95, -96, -98, -98, -99, -100, -102, -102, -103, -105, -105, -106, -108, -108, -109, -110, -111, -112, -113, -114, -115, -116, -116, -118, -118, -119, -121, -120, -122, -123, -123, -125, -125, -126, -126, -128, -128, -129, -130, -130, -132, -132, -132, -134, -134, -135, -135, -136, -137, -137, -138, -139, -139, -140, -141, -141, -142, -142, -143, -143, -144, -145, -145, -145, -146, -147, -147, -147, -148, -149, -148, -150, -149, -150, -151, -151, -151, -152, -152, -152, -153, -153, -153, -153, -154, -154, -155, -155, -155, -155, -155, -156, -156, -156, -156, -156, -157, -157, -157, -157, -157, -157, -157, -158, -157, -158, -158, -157, -158, -158, -158, -158, -157, -158, -158, -158, -157, -158, -158, -157, -158, -157, -157, -157, -157, -157, -157, -157, -156, -156, -156, -156, -156, -155, -155, -155, -155, -155, -154, -154, -153, -154, -153, -153, -152, -152, -152, -151, -151, -151, -150, -150, -150, -149, -149, -148, -148, -147, -147, -147, -146, -145, -145, -145, -144, -144, -143, -142, -142, -142, -141, -140, -140, -139, -139, -138, -137, -137, -136, -136, -135, -134, -134, -133, -132, -132, -131, -130, -130, -129, -128, -128, -126, -126, -126, -125, -123, -124, -122, -122, -121, -120, -119, -119, -117, -117, -117, -115, -114, -113, -113, -112, -112, -110, -110, -108, -108, -107, -106, -106, -104, -104, -102, -102, -101, -100, -99, -98, -98, -96, -95, -95, -94, -92, -92, -91, -90, -89, -88, -87, -86, -85, -85, -83, -82, -82, -80, -80, -78, -78, -76, -76, -75, -73, -73, -72, -70, -70, -69, -68, -66, -66, -65, -64, -63, -61, -61, -60, -59, -58, -57, -56, -55, -54, -53, -51, -51, -50, -49, -48, -47, -46, -45, -44, -43, -42, -41, -41, -39, -38, -37, -36, -35, -34, -34, -32, -31, -31, -29, -28, -28, -26, -26, -24, -24, -23, -21, -21, -20, -19, -18, -17, -16, -15, -14, -13, -13, -11, -11, -9, -9, -8, -7, -6, -5, -5, -3, -2, -2, -1, 0, 1, 2, 2, 4, 4, 5, 6, 7, 8, 8, 10, 10, 11, 11, 13, 13, 14, 15, 15, 17, 17, 18, 18, 20, 20, 21, 21, 23, 23, 23, 25, 25, 26, 26, 27, 28, 28, 30, 29, 31, 31, 32, 32, 33, 34, 34, 35, 35, 36, 37, 37, 37, 39, 39, 39, 40, 40, 41, 42, 42, 42, 43, 44, 44, 44, 45, 46, 45, 47, 46, 48, 47, 48, 49, 49, 49, 49, 50, 51, 51, 51, 51, 52, 52, 53, 53, 53, 53, 54, 54, 54, 55, 55, 55, 55, 56, 56, 56, 56, 57, 57, 57, 57, 58, 57, 58, 58, 58, 58, 59, 58, 59, 59, 59, 59, 59, 59, 59, 60, 59, 60, 59, 60, 60, 60, 59, 60, 60, 60, 60, 59, 60, 60, 60, 60, 59, 60, 60, 59, 60, 59, 60, 59, 59, 59, 59, 59, 59, 59, 58, 59, 58, 58, 58, 58, 57, 58, 57, 57, 57, 57, 55, 57, 56, 56, 55, 56, 55, 55, 54, 55, 54, 54, 54, 53, 53, 53, 52, 53, 52, 51, 52, 51, 50, 51, 50, 49, 50, 49, 48, 49, 48, 47, 47, 47, 47, 46, 46, 45, 45, 45, 44, 44, 43, 43, 42, 43, 41, 42, 40, 41, 40, 39, 40, 38, 39, 37, 38, 37, 36, 36, 35, 36, 34, 34, 34, 33, 33, 32, 32, 31, 31, 30, 30, 29, 29, 28, 28, 27, 27, 26, 26, 25, 25, 24, 24, 24, 22, 23, 21, 21, 21, 20, 20, 19, 19, 18, 18, 17, 16, 16, 16, 15, 14, 14, 14, 13, 12, 12, 11, 11, 11, 9, 10, 8, 9, 7, 8, 6, 7, 5, 5, 5, 4, 4, 3, 3, 2, 1, 1, 1, 0, 0, -1, -1, -2, -3, -3, -3, -4, -4, -5, -5, -6, -6, -7, -7, -8, -8, -8, -9, -10, -10, -10, -11, -11, -12, -12, -13, -13, -14, -14, -14, -15, -15, -16, -16, -16, -17, -18, -17, -18, -19, -19, -19, -20, -20, -21, -20, -22, -21, -22, -23, -22, -23, -24, -23, -25, -24, -25, -25, -25, -26, -26, -27, -26, -27, -28, -27, -28, -28, -29, -29, -29, -29, -30, -30, -30, -30, -31, -31, -31, -31, -32, -32, -32, -32, -33, -33, -33, -33, -33, -34, -34, -34, -34, -34, -35, -34, -35, -35, -35, -36, -35, -36, -35, -36, -36, -36, -37, -36, -36, -37, -37, -36, -37, -37, -37, -37, -37, -38, -37, -37, -38, -37, -38, -37, -38, -37, -38, -38, -37, -38, -38, -37, -38, -38, -37, -38, -38, -37, -38, -37, -38, -37, -38, -37, -38, -37, -37, -37, -37, -37, -37, -37, -37, -35, -37, -36, -37, -36, -36, -36, -36, -36, -35, -36, -35, -36, -35, -35, -34, -35, -34, -35, -34, -34, -34, -33, -34, -33, -33, -33, -32, -33, -32, -32, -32, -32, -31, -31, -31, -31, -31, -30, -30, -30, -29, -30, -29, -29, -28, -28, -29, -27, -28, -27, -27, -27, -26, -27, -25, -26, -25, -26, -24, -25, -24, -24, -23, -24, -23, -22, -23, -22, -22, -21, -21, -21, -21, -20, -20, -19, -19, -19, -19, -18, -18, -18, -17, -17, -17, -16, -16, -15, -16, -14, -15, -14, -14, -14, -13, -13, -12, -12, -12, -12, -11, -10, -11, -10, -10, -9, -9, -9, -8, -8, -8, -7, -7, -6, -6, -6, -6, -5, -5, -4, -4, -4, -3, -3, -3, -2, -2, -2, -1, -1, -1, 0, 0, 0, 1, 1, 2, 1, 3, 2, 3, 3, 4, 3, 4, 5, 5, 5, 5, 6, 6, 7, 6, 8, 7, 8, 8, 8, 9, 9, 9, 10, 9, 11, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 16, 16, 16, 16, 17, 16, 18, 17, 17, 18, 18, 18, 19, 19, 19, 19, 19, 20, 19, 20, 21, 20, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 23, 22, 23, 23, 23, 23, 24, 24, 23, 24, 24, 24, 25, 24, 25, 24, 25, 25, 25, 25, 26, 25, 26, 25, 26, 26, 25, 26, 26, 26, 27, 26, 26, 27, 26, 27, 26, 27, 26, 27, 27, 27, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 26, 27, 27, 27, 27, 26, 27, 27, 26, 26, 26, 27, 26, 26, 27, 26, 26, 26, 26, 26, 26, 25, 26, 25, 26, 25, 25, 25, 25, 25, 25, 25, 24, 24, 25, 24, 24, 24, 23, 24, 24, 23, 23, 23, 23, 23, 22, 23, 22, 22, 22, 22, 21, 22, 21, 21, 21, 21, 20, 20, 21, 20, 19, 20, 19, 19, 19, 19, 19, 18, 18, 18, 18, 18, 17, 17, 17, 17, 16, 16, 16, 16, 16, 15, 15, 15, 14, 15, 14, 14, 14, 13, 13, 13, 13, 12, 13, 12, 11, 12, 11, 11, 11, 10, 11, 10, 9, 10, 9, 9, 9, 8, 9, 8, 7, 8, 7, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 4, 4, 4, 3, 4, 3, 3, 2, 2, 2, 2, 2, 1, 1, 0, 1, 0, 0, 0, -1, -1, -1, -1, -2, -2, -2, -2, -3, -2, -4, -3, -3, -4, -4, -5, -4, -5, -5, -5, -6, -6, -6, -6, -7, -6, -7, -7, -8, -7, -8, -8, -9, -8, -9, -9, -9, -10, -9, -10, -10, -10, -11, -10, -11, -11, -12, -11, -12, -12, -12, -12, -13, -12, -13, -13, -13, -14, -13, -14, -14, -14, -14, -15, -14, -15, -15, -15, -15, -16, -15, -16, -16, -16, -16, -16, -17, -16, -17, -17, -17, -17, -17, -18, -17, -18, -18, -17, -18, -18, -19, -18, -18, -19, -18, -19, -19, -19, -19, -19, -19, -19, -19, -20, -19, -20, -19, -20, -20, -20, -19, -20, -20, -20, -20, -20, -21, -20, -20, -20, -21, -20, -20, -21, -20, -21, -20, -20, -21, -20, -21, -20, -21, -20, -21, -20, -21, -21, -20, -20, -21, -20, -21, -20, -21, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -19, -20, -20, -19, -20, -19, -19, -19, -20, -19, -19, -18, -19, -19, -19, -18, -18, -19, -18, -18, -18, -18, -18, -18, -17, -18, -17, -17, -17, -17, -17, -17, -16, -17, -16, -16, -17, -15, -16, -16, -15, -16, -15, -15, -15, -15, -15, -14, -14, -15, -14, -13, -14, -14, -13, -13, -13, -13, -13, -13, -12, -12, -12, -12, -12, -11, -12, -11, -11, -11, -10, -11, -10, -10, -10, -9, -10, -9, -9, -9, -9, -9, -8, -8, -8, -8, -8, -7, -7, -7, -7, -7, -6, -6, -6, -6, -6, -5, -5, -6, -4, -5, -4, -5, -4, -4, -3, -4, -3, -3, -3, -2, -3, -2, -2, -2, -1, -2, -1, -1, -1, 0, -1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 2, 4, 3, 3, 4, 4, 4, 4, 5, 4, 5, 5, 5, 6, 5, 6, 6, 6, 6, 7, 6, 7, 7, 7, 7, 8, 7, 8, 8, 8, 8, 9, 8, 9, 9, 9, 9, 10, 9, 10, 10, 10, 10, 10, 11, 10, 11, 11, 11, 11, 11, 11, 12, 11, 12, 12, 12, 12, 12, 13, 12, 13, 13, 12, 13, 13, 14, 13, 13, 14, 13, 14, 14, 13, 14, 14, 15, 14, 14, 14, 15, 14, 15, 15, 14, 15, 15, 15, 15, 15, 16, 15, 15, 15, 16, 15, 16, 15, 16, 15, 16, 16, 16, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 16, 16, 15, 16, 16, 15, 16, 16, 15, 15, 16, 15, 16, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 14, 15, 14, 14, 15, 14, 14, 14, 14, 13, 14, 14, 13, 13, 14, 13, 13, 13, 13, 13, 12, 13, 12, 13, 12, 12, 12, 12, 12, 12, 11, 12, 11, 11, 11, 11, 11, 11, 10, 11, 10, 10, 10, 10, 10, 10, 9, 10, 9, 9, 9, 9, 8, 9, 8, 9, 8, 8, 8, 7, 8, 7, 7, 7, 7, 7, 7, 6, 7, 6, 6, 6, 5, 6, 5, 5, 6, 4, 5, 5, 4, 5, 4, 4, 4, 3, 4, 3, 3, 3, 3, 3, 2, 3, 2, 2, 2, 2, 1, 2, 1, 1, 1, 1, 1, 0, 0, 1, 0, -1, 0, 0, -1, -1, -1, -1, -1, -2, -1, -2, -2, -2, -2, -2, -3, -2, -3, -3, -3, -3, -4, -3, -4, -4, -4, -4, -4, -5, -4, -5, -5, -5, -5, -5, -6, -5, -6, -6, -6, -6, -6, -6, -7, -6, -7, -7, -7, -7, -7, -7, -8, -8, -7, -8, -8, -8, -8, -9, -8, -9, -8, -9, -9, -9, -9, -9, -9, -10, -9, -10, -9, -10, -10, -10, -10, -10, -10, -11, -10, -11, -10, -11, -11, -11, -10, -11, -11, -12, -11, -11, -11, -12, -11, -12, -12, -11, -12, -12, -12, -11, -12, -12, -13, -12, -12, -12, -12, -13, -12, -12, -13, -12, -13, -12, -13, -12, -13, -13, -12, -13, -13, -13, -12, -13, -13, -13, -13, -12, -13, -13, -13, -13, -13, -13, -12, -13, -13, -13, -13, -13, -13, -13, -12, -13, -13, -13, -13, -11, -13, -13, -12, -13, -13, -12, -13, -12, -13, -12, -13, -12, -13, -12, -12, -13, -12, -12, -12, -12, -12, -12, -12, -12, -12, -11, -12, -12, -11, -12, -11, -11, -12, -11, -11, -11, -11, -11, -11, -11, -11, -10, -11, -10, -11, -10, -10, -10, -10, -10, -10, -10, -10, -10, -9, -10, -9, -9, -9, -9, -9, -9, -9, -9, -8, -9, -8, -8, -8, -8, -8, -8, -8, -8, -7, -7, -8, -7, -7, -7, -7, -6, -7, -7, -6, -6, -6, -6, -6, -6, -6, -5, -6, -5, -5, -5, -5, -5, -4, -5, -4, -5, -4, -4, -4, -4, -3, -4, -3, -4, -3, -3, -3, -3, -2, -3, -2, -2, -3, -2, -1, -2, -2, -1, -2, -1, -1, -1, -1, -1, 0, -1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 2, 1, 1, 1, 2, 2, 1, 2, 2, 3, 2, 2, 3, 2, 3, 3, 3, 3, 3, 4, 3, 4, 4, 3, 4, 4, 4, 5, 4, 5, 4, 5, 5, 5, 5, 5, 5, 5, 6, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 7, 8, 8, 7, 8, 8, 8, 8, 8, 8, 9, 8, 9, 8, 9, 8, 9, 9, 8, 9, 9, 9, 9, 9, 10, 9, 9, 9, 10, 9, 10, 9, 10, 10, 9, 10, 10, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 10, 10, 10, 10, 11, 10, 10, 11, 10, 10, 11, 10, 10, 11, 10, 10, 11, 10, 11, 10, 11, 10, 10, 11, 10, 10, 11, 10, 11, 10, 10, 10, 10, 10, 10, 11, 10, 10, 10, 10, 11, 10, 10, 10, 10, 10, 10, 10, 10, 9, 10, 10, 10, 9, 10, 10, 9, 10, 9, 10, 9, 9, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 9, 9, 8, 9, 8, 8, 9, 8, 8, 8, 8, 8, 8, 7, 8, 8, 7, 8, 7, 7, 8, 7, 7, 7, 7, 6, 7, 7, 6, 7, 6, 7, 6, 6, 6, 6, 6, 6, 5, 6, 5, 6, 5, 5, 5, 5, 5, 5, 5, 4, 5, 4, 5, 4, 4, 4, 4, 4, 4, 3, 4, 3, 4, 3, 3, 3, 3, 3, 3, 2, 3, 2, 2, 3, 2, 2, 2, 1, 2, 2, 1, 2, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, -1, 0, -1, -1, 0, -1, -1, -1, -2, -1, -1, -2, -1, -2, -2, -2, -2, -2, -2, -2, -3, -2, -3, -2, -3, -3, -3, -3, -3, -3, -4, -3, -4, -3, -4, -4, -3, -4, -4, -5, -4, -4, -4, -5, -4, -5, -5, -5, -4, -5, -5, -6, -5, -5, -5, -6, -5, -6, -5, -6, -6, -6, -6, -6, -6, -6, -6, -6, -7, -6, -6, -7, -6, -7, -7, -6, -7, -7, -7, -7, -7, -7, -7, -7, -8, -7, -7, -8, -7, -8, -7, -8, -7, -8, -7, -8, -8, -8, -8, -7, -8, -8, -8, -8, -8, -8, -8, -8, -9, -8, -8, -8, -8, -9, -8, -8, -8, -9, -8, -8, -9, -8, -9, -8, -8, -9, -8, -9, -8, -9, -8, -8, -9, -8, -9, -8, -9, -8, -9, -8, -8, -9, -8, -9, -8, -7, -9, -8, -8, -9, -8, -8, -9, -8, -8, -8, -8, -8, -9, -8, -8, -8, -8, -8, -8, -8, -8, -7, -8, -8, -8, -7, -8, -8, -7, -8, -7, -8, -7, -8, -7, -7, -7, -8, -7, -7, -7, -7, -7, -7, -7, -6, -7, -7, -6, -7, -7, -6, -6, -7, -6, -6, -6, -6, -6, -6, -6, -6, -6, -6, -5, -6, -5, -6, -5, -5, -6, -5, -5, -5, -5, -5, -4, -5, -5, -4, -5, -4, -5, -4, -4, -4, -4, -4, -4, -4, -4, -3, -4, -3, -4, -3, -3, -3, -4, -3, -2, -3, -3, -3, -2, -3, -2, -3, -2, -2, -2, -2, -2, -2, -2, -1, -2, -1, -2, -1, -1, -1, -2, -1, 0, -1, -1, -1, 0, -1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 2, 2, 1, 2, 2, 3, 2, 2, 2, 3, 2, 3, 3, 2, 3, 3, 3, 3, 3, 3, 4, 3, 3, 4, 3, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 4, 4, 5, 5, 4, 5, 5, 4, 5, 5, 5, 5, 5, 5, 5, 6, 5, 5, 5, 6, 5, 6, 5, 6, 6, 5, 6, 6, 6, 5, 6, 6, 6, 6, 6, 6, 7, 6, 6, 6, 6, 7, 6, 6, 7, 6, 7, 6, 6, 7, 7, 6, 7, 6, 7, 6, 7, 7, 7, 6, 7, 7, 6, 7, 7, 7, 7, 6, 7, 7, 7, 7, 7, 6, 7, 7, 7, 7, 7, 7, 6, 7, 7, 7, 7, 7, 7, 6, 7, 7, 6, 7, 6, 7, 7, 7, 6, 7, 7, 6, 7, 7, 6, 7, 7, 6, 7, 6, 7, 6, 7, 6, 6, 7, 6, 6, 7, 6, 6, 6, 6, 6, 7, 6, 6, 6, 6, 5, 6, 6, 6, 6, 5, 6, 6, 5, 6, 5, 6, 5, 5, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 5, 4, 5, 4, 5, 4, 4, 4, 5, 4, 4, 4, 4, 3, 4, 4, 4, 3, 4, 3, 4, 3, 3, 4, 3, 3, 3, 3, 3, 3, 2, 3, 3, 2, 3, 2, 3, 2, 2, 3, 2, 2, 2, 2, 2, 1, 2, 2, 1, 2, 1, 2, 1, 1, 1, 2, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, -1, 0, 0, -1, 0, -1, 0, -1, -1, 0, -1, -1, -1, -1, -1, -1, -2, -1, -1, -2, -1, -2, -2, -1, -2, -2, -2, -2, -2, -2, -2, -2, -3, -2, -2, -3, -2, -3, -2, -3, -3, -2, -3, -3, -3, -3, -3, -3, -3, -4, -3, -3, -4, -3, -4, -3, -4, -3, -4, -4, -3, -4, -4, -4, -4, -4, -4, -4, -4, -4, -5, -4, -4, -5, -4, -4, -5, -4, -5, -4, -5, -5, -4, -5, -5, -4, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -6, -5, -5, -5, -5, -6, -5, -5, -6, -5, -5, -6, -5, -6, -5, -6, -5, -6, -5, -5, -6, -6, -5, -6, -5, -6, -5, -6, -5, -6, -5, -6, -6, -5, -6, -5, -6, -5, -6, -5, -6, -6, -5, -6, -5, -5, -5, -6, -5, -6, -5, -6, -5, -5, -6, -5, -6, -5, -5, -6, -5, -5, -6, -5, -5, -5, -6, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -4, -5, -5, -5, -4, -5, -5, -4, -5, -4, -5, -4, -4, -5, -4, -4, -5, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -3, -4, -4, -3, -4, -4, -3, -4, -3, -3, -4, -3, -3, -3, -4, -3, -3, -3, -3, -3, -2, -3, -3, -3, -2, -3, -2, -3, -2, -3, -2, -2, -3, -2, -2, -2, -2, -2, -2, -2, -1, -2, -2, -1, -2, -2, -1, -1, -2, -1, -1, -1, -2, -1, -1, -1, -1, 0, -1, -1, -1, 0, -1, 0, -1, 0, -1, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 4, 3, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 4, 3, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 5, 4, 4, 5, 4, 4, 5, 4, 5, 4, 4, 5, 4, 5, 4, 5, 4, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 3, 4, 5, 4, 5, 4, 4, 5, 4, 5, 4, 4, 5, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 4, 5, 4, 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 3, 4, 4, 4, 3, 4, 4, 3, 4, 3, 4, 3, 3, 4, 3, 4, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 1, 2, 1, 2, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, -1, 0, -1, 0, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, -2, -1, -2, -1, -2, -1, -2, -2, -2, -1, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -3, -2, -2, -2, -3, -2, -3, -2, -3, -2, -3, -2, -3, -2, -3, -3, -3, -2, -3, -3, -3, -3, -2, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -4, -3, -3, -3, -3, -4, -3, -3, -3, -4, -3, -3, -4, -3, -3, -4, -3, -3, -4, -3, -4, -3, -4, -3, -4, -3, -4, -3, -4, -3, -4, -3, -4, -3, -4, -4, -3, -4, -3, -4, -4, -3, -4, -3, -4, -4, -3, -4, -3, -4, -4, -3, -4, -3, -4, -3, -4, -4, -3, -3, -3, -4, -3, -4, -4, -3, -4, -3, -4, -3, -4, -3, -3, -4, -3, -4, -3, -4, -3, -3, -4, -3, -3, -4, -3, -3, -4, -3, -3, -3, -3, -4, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -2, -3, -3, -3, -2, -3, -3, -2, -3, -2, -3, -2, -3, -2, -3, -2, -3, -2, -2, -3, -2, -2, -2, -2, -2, -3, -2, -2, -2, -2, -2, -2, -1, -2, -2, -2, -2, -1, -2, -2, -1, -2, -1, -2, -1, -2, -1, -2, -1, -1, -2, -1, -1, -1, -1, -1, -2, -1, -1, 0, -1, -1, -1, -1, -1, -1, 0, -1, -1, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 2, 3, 2, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 3, 2, 3, 2, 3, 3, 2, 3, 3, 3, 2, 3, 3, 2, 3, 3, 3, 3, 2, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 2, 2, 3, 3, 3, 2, 3, 3, 3, 3, 2, 3, 3, 3, 2, 3, 3, 3, 2, 3, 3, 2, 3, 3, 2, 3, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 2, 3, 2, 2, 3, 2, 2, 3, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, -1, 0, -1, 0, -1, -1, -1, 0, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, -1, -1, -2, -1, -1, -1, -2, -1, -1, -2, -1, -2, -1, -2, -1, -2, -1, -2, -1, -2, -1, -2, -2, -1, -2, -2, -1, -2, -2, -2, -1, -2, -2, -2, -2, -1, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -3, -2, -2, -2, -2, -2, -2, -3, -2, -2, -2, -2, -3, -2, -2, -2, -3, -2, -2, -2, -2, -3, -2, -2, -2, -3, -2, -2, -2, -3, -2, -2, -3, -2, -2, -2, -3, -2, -2, -2, -3, -2, -2, -2, -3, -1, -2, -2, -2, -3, -2, -2, -2, -2, -3, -2, -2, -2, -2, -2, -3, -2, -2, -2, -2, -2, -2, -2, -2, -3, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -1, -2, -2, -2, -2, -2, -2, -1, -2, -2, -2, -2, -1, -2, -2, -2, -1, -2, -2, -1, -2, -1, -2, -2, -1, -2, -1, -2, -1, -2, -1, -2, -1, -1, -2, -1, -1, -2, -1, -1, -2, -1, -1, -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, 0, -1, -1, 0, -1, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 2, 1, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, -1, 0, -1, 0, -1, 0, -1, -1, 0, -1, -1, 0, -1, -1, 0, -1, -1, -1, -1, 0, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, -1, -1, -1, -1, -2, -1, -1, -1, -1, -2, -1, -1, -1, -2, -1, -1, -1, -2, -1, -1, -1, -2, -1, -1, -2, -1, -1, -2, -1, -1, -1, -2, -1, -1, -2, -1, -1, -2, -1, -2, -1, -1, -2, -1, -1, -2, -1, -1, -2, -1, -1, -2, -1, -1, -2, -1, -2, -1, -1, -2, -1, -1, -2, -1, -1, -1, -1, -1, -2, -1, -1, -2, -1, -1, -1, -2, -1, -1, -2, -1, -1, -1, -2, -1, -1, -2, -1, -1, -1, -1, -2, -1, -1, -1, -2, -1, -1, -1, -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, 0, -1, -1, -1, 0, -1, -1, -1, 0, -1, -1, 0, -1, 0, -1, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, -1, 0, -1, 0, -1, 0, -1, -1, 0, -1, -1, 0, -1, 0, -1, -1, 0, -1, -1, 0, -1, -1, 0, -1, -1, -1, 0, -1, -1, 0, -1, -1, 0, -1, -1, -1, 0, -1, -1, -1, 0, -1, -1, -1, 0, -1, -1, -1, 0, -1, -1, -1, 0, -1, -1, -1, 0, -1, -1, -1, 0, -1, -1, -1, -1, 0, -1, -1, -1, 0, -1, -1, -1, 0, -1, -1, -1, 0, -1, -1, -1, 0, 0, -1, -1, 0, -1, -1, -1, 0, -1, -1, -1, 0, -1, -1, 0, -1, -1, -1, 0, -1, -1, 0, -1, -1, 0, -1, -1, 0, -1, -1, 0, -1, -1, 0, -1, -1, 0, -1, -1, 0, -1, 0, -1, -1, 0, -1, 0, -1, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0, 0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; darkice-1.2/src/ConfigSection.cpp0000644000175000017500000001310612170706662013734 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell ConfigSection File : ConfigSection.cpp Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/ConfigSection.cpp $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "ConfigSection.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: ConfigSection.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $"; /*------------------------------------------------------------------------------ * string containing all white space characters *----------------------------------------------------------------------------*/ #define WHITE_SPACE_STR " \t" /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Add a key / value pair *----------------------------------------------------------------------------*/ bool ConfigSection :: add ( const char * key, const char * value ) throw ( Exception ) { if ( !key || !value ) { throw Exception( __FILE__, __LINE__, "no key or value"); } std::pair element( key, value); std::pair res; res = table.insert( element); return res.second; } /*------------------------------------------------------------------------------ * Get a value for a key *----------------------------------------------------------------------------*/ const char * ConfigSection :: get ( const char * key ) const throw ( Exception ) { if ( !key ) { throw Exception( __FILE__, __LINE__, "no key"); } TableType::const_iterator it = table.find( key); if ( it == table.end() ) { return 0; } return it->second.c_str(); } /*------------------------------------------------------------------------------ * Get a value for a key, in the key does not exist, throw an exception *----------------------------------------------------------------------------*/ const char * ConfigSection :: getForSure ( const char * key, const char * message1, const char * message2, int code ) const throw ( Exception ) { const char * value; if ( !(value = get( key)) ) { throw Exception( __FILE__, __LINE__, key, message1, message2, code); } return value; } /*------------------------------------------------------------------------------ * Add a configuration line *----------------------------------------------------------------------------*/ bool ConfigSection :: addLine ( const char * line ) throw ( Exception ) { if ( !line ) { throw Exception( __FILE__, __LINE__, "no line"); } std::string::size_type ix; std::string str( line); /* delete everything after the first # */ if ( (ix = str.find( '#')) != str.npos ) { str.erase( ix); } /* eat up all white space from the front */ if ( (ix = str.find_first_not_of( WHITE_SPACE_STR)) != str.npos ) { str.erase( 0, ix); } /* eat up all white space from the end */ if ( (ix = str.find_last_not_of( WHITE_SPACE_STR)) != str.npos ) { str.erase( ix + 1); } if ( !str.length() ) { return true; } /* find the '=' delimiter between key and value */ if ( (ix = str.find( '=')) == str.npos ) { return false; } std::string key( str, 0, ix); std::string value( str, ix + 1); /* eat up all white space from the front of value */ if ( (ix = value.find_first_not_of( WHITE_SPACE_STR)) != value.npos ) { value.erase( 0, ix); } /* eat up all white space from the end of key */ if ( (ix = key.find_last_not_of( WHITE_SPACE_STR)) != key.npos ) { key.erase( ix + 1); } /* now add the new key / value pair */ return add( key.c_str(), value.c_str()); } darkice-1.2/src/SolarisDspSource.h0000644000175000017500000001711412170706662014116 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : SolarisDspSource.h Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/SolarisDspSource.h $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef SOLARIS_DSP_SOURCE_H #define SOLARIS_DSP_SOURCE_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include "Reporter.h" #include "AudioSource.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * An audio input based on Solaris /dev/audio devices * * @author $Author: rafael@riseup.net $ * @version $Revision: 553 $ */ class SolarisDspSource : public AudioSource, public virtual Reporter { private: /** * The file name of the OSS DSP device (e.g. /dev/audio) */ char * fileName; /** * The low-level file descriptor of the Solaris DSP device. */ int fileDescriptor; protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline SolarisDspSource ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } /** * Initialize the object * * @param name the file name of the Solaris DSP device. * @exception Exception */ void init ( const char * name ) throw ( Exception ); /** * De-iitialize the object * * @exception Exception */ void strip ( void ) throw ( Exception ); public: /** * Constructor. * * @param name the file name of the Solaris DSP device * (e.g. /dev/audio or /dev/sound/0) * @param sampleRate samples per second (e.g. 44100 for 44.1kHz). * @param bitsPerSample bits per sample (e.g. 16 bits). * @param channel number of channels of the audio source * (e.g. 1 for mono, 2 for stereo, etc.). * @exception Exception */ inline SolarisDspSource ( const char * name, int sampleRate = 44100, int bitsPerSample = 16, int channel = 2 ) throw ( Exception ) : AudioSource( sampleRate, bitsPerSample, channel) { init( name); } /** * Copy Constructor. * * @param sds the object to copy. * @exception Exception */ inline SolarisDspSource ( const SolarisDspSource & sds ) throw ( Exception ) : AudioSource( sds ) { init( sds.fileName); } /** * Destructor. * * @exception Exception */ inline virtual ~SolarisDspSource ( void ) throw ( Exception ) { strip(); } /** * Assignment operator. * * @param ds the object to assign to this one. * @return a reference to this object. * @exception Exception */ inline virtual SolarisDspSource & operator= ( const SolarisDspSource & ds ) throw ( Exception ) { if ( this != &ds ) { strip(); AudioSource::operator=( ds); init( ds.fileName); } return *this; } /** * Tell if the data from this source comes in big or little endian. * * @return true */ virtual inline bool isBigEndian ( void ) const throw () { #ifdef WORDS_BIGENDIAN return true; #else return false; #endif } /** * Open the SolarisDspSource. * This does not put the Solaris DSP device into recording mode. * To start getting samples, call either canRead() or read(). * * @return true if opening was successful, false otherwise * @exception Exception * * @see #canRead * @see #read */ virtual bool open ( void ) throw ( Exception ); /** * Check if the SolarisDspSource is open. * * @return true if the SolarisDspSource is open, false otherwise. */ inline virtual bool isOpen ( void ) const throw () { return fileDescriptor != 0; } /** * Check if the SolarisDspSource can be read from. * Blocks until the specified time for data to be available. * Puts the Solaris DSP device into recording mode. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true if the SolarisDspSource is ready to be read from, * false otherwise. * @exception Exception */ virtual bool canRead ( unsigned int sec, unsigned int usec ) throw ( Exception ); /** * Read from the SolarisDspSource. * Puts the Solaris DSP device into recording mode. * * @param buf the buffer to read into. * @param len the number of bytes to read into buf * @return the number of bytes read (may be less than len). * @exception Exception */ virtual unsigned int read ( void * buf, unsigned int len ) throw ( Exception ); /** * Close the SolarisDspSource. * * @exception Exception */ virtual void close ( void ) throw ( Exception ); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* SOLARIS_DSP_SOURCE_H */ darkice-1.2/src/JackDspSource.cpp0000644000175000017500000003646412170706662013716 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Copyright (c) 2005 Nicholas Humfrey. All rights reserved. Tyrell DarkIce File : JackDspSource.cpp Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/JackDspSource.cpp $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #include "AudioSource.h" #ifdef SUPPORT_JACK_DSP // only compile this code if there is support for it #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_STDIO_H #include #else #error need stdio.h #endif #ifdef HAVE_UNISTD_H #include #else #error need unistd.h #endif #ifdef HAVE_STRING_H #include #else #error need string.h #endif #ifdef HAVE_SYS_TYPES_H #include #else #error need sys/types.h #endif #ifdef HAVE_MATH_H #include #else #error need math.h #endif #ifdef HAVE_STDLIB_H #include #else #error needs stdlib.h #endif #ifdef HAVE_LIMITS_H #include #else #error need limits.h #endif #include "Util.h" #include "Exception.h" #include "JackDspSource.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: JackDspSource.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $"; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Initialize the object *----------------------------------------------------------------------------*/ void JackDspSource :: init ( const char* name ) throw ( Exception ) { // Set defaults ports[0] = NULL; // Left Port ports[1] = NULL; // Right Port rb[0] = NULL; // Left Ring Buffer rb[1] = NULL; // Right Ring Buffer client = NULL; auto_connect = false; // Default is to not auto connect the JACK ports tmp_buffer = NULL; // Buffer big enough for one 'read' of audio // Auto connect the ports ? if ( Util::strEq( name, "jack_auto", 9) ) { auto_connect = true; } // Check the sample size if (getBitsPerSample() != 16) { throw Exception( __FILE__, __LINE__, "JackDspSource doesn't support non 16-bit samples"); } } /*------------------------------------------------------------------------------ * De-initialize the object *----------------------------------------------------------------------------*/ void JackDspSource :: strip ( void ) throw ( Exception ) { if ( isOpen() ) { close(); } // Free the temporary buffer if (tmp_buffer) { free(tmp_buffer); tmp_buffer = NULL; } } /*------------------------------------------------------------------------------ * Attempt to connect up the JACK ports automatically * - Just connect left&right to the first two output ports we find *----------------------------------------------------------------------------*/ void JackDspSource :: do_auto_connect ( void ) throw ( Exception ) { const char **all_ports; unsigned int ch = 0; int i; Reporter::reportEvent( 10, "JackDspSource :: do_auto_connect"); // Get a list of all the jack ports all_ports = jack_get_ports (client, NULL, NULL, JackPortIsOutput); if (!ports) { throw Exception( __FILE__, __LINE__, "jack_get_ports() returned NULL."); } // Step through each port name for (i = 0; all_ports[i]; ++i) { const char* in = all_ports[i]; const char* out = jack_port_name( ports[ch] ); Reporter::reportEvent( 2, "Connecting", in, "to", out); if (jack_connect(client, in, out)) { throw Exception( __FILE__, __LINE__, "Failed to jack_connect() ports", in, out); } // Found enough ports ? if (++ch >= getChannel()) break; } free( all_ports ); } /*------------------------------------------------------------------------------ * Open the audio source *----------------------------------------------------------------------------*/ bool JackDspSource :: open ( void ) throw ( Exception ) { char client_name[255]; size_t rb_size; unsigned int c; if ( isOpen() ) { return false; } // Register client with Jack if ( jack_client_name != NULL ) { snprintf(client_name, 255, "%s", jack_client_name); } else { snprintf(client_name, 255, "darkice-%d", getpid()); } if ((client = jack_client_open(client_name, (jack_options_t)0, NULL)) == NULL) { throw Exception( __FILE__, __LINE__, "JACK server not running?"); } Reporter::reportEvent( 1, "Registering as JACK client", client_name); // Check the sample rate is correct if (jack_get_sample_rate( client ) != (jack_nframes_t)getSampleRate()) { throw Exception( __FILE__, __LINE__, "JACK server sample rate is different than " "sample rate in darkice config file"); } // Register ports with Jack if (getChannel() == 1) { if (!(ports[0] = jack_port_register(client, "mono", JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0))) { throw Exception( __FILE__, __LINE__, "Cannot register input port", "mono"); } } else if (getChannel() == 2) { if (!(ports[0] = jack_port_register(client, "left", JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0))) { throw Exception( __FILE__, __LINE__, "Cannot register input port", "left"); } if (!(ports[1] = jack_port_register(client, "right", JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0))) { throw Exception( __FILE__, __LINE__, "Cannot register input port", "right"); } } else { throw Exception( __FILE__, __LINE__, "Invalid number of channels", getChannel()); } // Create a ring buffer for each channel /* will take about 1 MB buffer for each channel */ rb_size = 5 /* number of seconds */ * jack_get_sample_rate(client) /* eg 48000 */ * sizeof (jack_default_audio_sample_t); /* eg 4 bytes */ for (c=0; c < getChannel(); c++) { rb[c] = jack_ringbuffer_create(rb_size); if (!rb[c]) { throw Exception( __FILE__, __LINE__, "Failed to create ringbuffer for", "channel", c); } } // Set the callbacks jack_on_shutdown(client, JackDspSource::shutdown_callback, (void*)this); if (jack_set_process_callback(client, JackDspSource::process_callback, (void*)this)) { throw Exception( __FILE__, __LINE__, "Failed to set process callback"); } // Activate client if (jack_activate(client)) { throw Exception( __FILE__, __LINE__, "Can't activate client"); } // Attempt to automatically connect up our input ports to something ? if (auto_connect) { do_auto_connect(); } return true; } /*------------------------------------------------------------------------------ * Check wether read() would return anything *----------------------------------------------------------------------------*/ bool JackDspSource :: canRead ( unsigned int sec, unsigned int usec ) throw ( Exception ) { const unsigned int max_wait_time = sec * 1000000; const unsigned int wait_increment = 10000; unsigned int cur_wait = 0; if ( !isOpen() ) { return false; } while (max_wait_time > cur_wait) { bool canRead = true; for (unsigned int c = 0 ; c < getChannel() ; c++) { if (jack_ringbuffer_read_space(rb[c]) <= 0) { canRead = false; } } if (canRead) { return true; } cur_wait += wait_increment; usleep ( wait_increment ); } usleep( usec ); for (unsigned int c = 0 ; c < getChannel() ; c++) { if (jack_ringbuffer_read_space(rb[c]) <= 0) { return false; } } return true; } /*------------------------------------------------------------------------------ * Read from the audio source *----------------------------------------------------------------------------*/ unsigned int JackDspSource :: read ( void * buf, unsigned int len ) throw ( Exception ) { jack_nframes_t samples = len / 2 / getChannel(); jack_nframes_t samples_read[2] = { 0, 0 }; short * output = (short*) buf; unsigned int c, n; if ( !isOpen() ) { return 0; } // Ensure the temporary buffer is big enough tmp_buffer = (jack_default_audio_sample_t*)realloc(tmp_buffer, samples * sizeof( jack_default_audio_sample_t ) ); if (!tmp_buffer) { throw Exception( __FILE__, __LINE__, "realloc on tmp_buffer failed"); } // We must be sure to fetch as many data on both channels int minBytesAvailable = samples * sizeof( jack_default_audio_sample_t ); for (c=0; c < getChannel(); c++) { int readable = jack_ringbuffer_read_space(rb[c]); if (readable < minBytesAvailable) { minBytesAvailable = readable; } } for (c=0; c < getChannel(); c++) { // Copy frames from ring buffer to temporary buffer // and then convert samples to output buffer int bytes_read = jack_ringbuffer_read(rb[c], (char*)tmp_buffer, minBytesAvailable); samples_read[c] = bytes_read / sizeof( jack_default_audio_sample_t ); // Convert samples from float to short and put in output buffer for(n=0; n SHRT_MAX) { output[n*getChannel()+c] = SHRT_MAX; } else if (tmp < SHRT_MIN) { output[n*getChannel()+c] = SHRT_MIN; } else { output[n*getChannel()+c] = (short) tmp; } } } // Didn't get as many samples as we wanted ? if (getChannel() == 2 && samples_read[0] != samples_read[1]) { Reporter::reportEvent( 2, "Warning: Read a different number of samples " "for left and right channels"); } // Return the number of bytes put in the output buffer return samples_read[0] * 2 * getChannel(); } /*------------------------------------------------------------------------------ * Close the audio source *----------------------------------------------------------------------------*/ void JackDspSource :: close ( void ) throw ( Exception ) { unsigned int i; if ( !isOpen() ) { return; } for(i = 0; i < getChannel(); i++) { // Close the port for channel if ( ports[i] ) { jack_port_unregister( client, ports[i] ); ports[i] = NULL; } // Free up the ring buffer for channel if ( rb[i] ) { jack_ringbuffer_free( rb[i] ); rb[i] = NULL; } } /* Leave the jack graph */ if (client) { jack_client_close(client); client = NULL; } } /*------------------------------------------------------------------------------ * Callback called by JACK when audio is available * * Don't do anything too expensive here * - just shove audio samples in ring buffer *----------------------------------------------------------------------------*/ int JackDspSource :: process_callback( jack_nframes_t nframes, void *arg ) { JackDspSource* self = (JackDspSource*)arg; size_t to_write = sizeof (jack_default_audio_sample_t) * nframes; unsigned int c; // Wait until it is ready if (self->client == NULL) { return 0; } /* copy data to ringbuffer; one per channel */ for (c=0; c < self->getChannel(); c++) { /* check space */ size_t len; if (jack_ringbuffer_write_space(self->rb[c]) < to_write) { /* buffer is overflowing, skip the incoming data */ jack_ringbuffer_write_advance(self->rb[c], to_write); /* prevent blocking the ring buffer by updating internal pointers * jack will now not terminate on xruns */ Reporter::reportEvent( 1, "ring buffer full, skipping data"); /* We do not return error to jack callback handler and keep going */ } else { /* buffer has space, put data into ringbuffer */ len = jack_ringbuffer_write(self->rb[c], (char *) jack_port_get_buffer( self->ports[c], nframes), to_write); if (len != to_write) Reporter::reportEvent( 1, "failed to write to ring buffer (can not happen)"); } } // Success return 0; } /*------------------------------------------------------------------------------ * Callback called when *----------------------------------------------------------------------------*/ void JackDspSource :: shutdown_callback( void *arg ) { //JackDspSource* self = (JackDspSource*)arg; Reporter::reportEvent( 1, "JackDspSource :: shutdown_callback"); } #endif // SUPPORT_JACK_DSP darkice-1.2/src/Reporter.cpp0000644000175000017500000000432512170706662013007 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell Reporter File : Reporter.cpp Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/Reporter.cpp $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #include #include "Reporter.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: Reporter.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $"; /*------------------------------------------------------------------------------ * Initial values for static members of the class *----------------------------------------------------------------------------*/ unsigned int Reporter::verbosity = 1; std::ostream * Reporter::os = &std::cout; /* =============================================== local function prototypes */ /* ============================================================= module code */ darkice-1.2/src/DarkIceConfig.cpp0000644000175000017500000001234612170706662013637 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell Config File : DarkIceConfig.cpp Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/DarkIceConfig.cpp $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "DarkIceConfig.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: DarkIceConfig.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $"; /*------------------------------------------------------------------------------ * Max line size *----------------------------------------------------------------------------*/ #define LINE_SIZE 256 /*------------------------------------------------------------------------------ * string containing all white space characters *----------------------------------------------------------------------------*/ #define WHITE_SPACE_STR " \t" /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Get a value for a key *----------------------------------------------------------------------------*/ const ConfigSection * Config :: get ( const char * key ) const throw ( Exception ) { if ( !key ) { throw Exception( __FILE__, __LINE__, "no key"); } TableType::const_iterator it = table.find( key); if ( it == table.end() ) { return 0; } return &(it->second); } /*------------------------------------------------------------------------------ * Add a configuration line *----------------------------------------------------------------------------*/ bool Config :: addLine ( const char * line ) throw ( Exception ) { if ( !line ) { throw Exception( __FILE__, __LINE__, "no line"); } std::string::size_type ix; std::string str( line); /* delete everything after the first # */ if ( (ix = str.find( '#')) != str.npos ) { str.erase( ix); } /* eat up all white space from the front */ if ( (ix = str.find_first_not_of( WHITE_SPACE_STR)) != str.npos ) { str.erase( 0, ix); } /* eat up all white space from the end */ if ( (ix = str.find_last_not_of( WHITE_SPACE_STR)) != str.npos ) { str.erase( ix + 1); } if ( !str.length() ) { return true; } if ( str[0] == '[' && str[str.size()-1] == ']' ) { // a new section starts std::string section( str, 1, str.size()-2); ConfigSection cSection; std::pair element( section, cSection); std::pair res; res = table.insert( element); currentSection = section; return res.second; } else { // it's a line for the current section TableType::iterator it = table.find( currentSection); if ( it == table.end() ) { throw Exception( __FILE__, __LINE__, "no current section"); } return it->second.addLine( line); } } /*------------------------------------------------------------------------------ * Add a configuration line *----------------------------------------------------------------------------*/ void Config :: read ( std::istream & is ) throw ( Exception ) { char line[LINE_SIZE]; unsigned int num; for ( num = 0; !is.fail() && !is.eof(); ++num ) { is.getline( line, LINE_SIZE); if ( is.eof() ) { break; } else if ( is.fail() ) { throw Exception( __FILE__, __LINE__, "line too long", num); } addLine( line); } } darkice-1.2/src/LameLibEncoder.cpp0000644000175000017500000003154612170706662014017 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : LameLibEncoder.cpp Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/LameLibEncoder.cpp $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif // compile the whole file only if lame support configured in #ifdef HAVE_LAME_LIB #include "Exception.h" #include "Util.h" #include "LameLibEncoder.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: LameLibEncoder.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $"; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Open an encoding session *----------------------------------------------------------------------------*/ bool LameLibEncoder :: open ( void ) throw ( Exception ) { if ( isOpen() ) { close(); } // open the underlying sink if ( !getSink()->open() ) { throw Exception( __FILE__, __LINE__, "lame lib opening underlying sink error"); } lameGlobalFlags = lame_init(); // ugly lame returns -1 in a pointer on allocation errors // this is cast to (long int) so that the pointer can be handled // on 64 bit systems as well if ( !lameGlobalFlags || ((long int)lameGlobalFlags) == -1 ) { throw Exception( __FILE__, __LINE__, "lame lib init error", (long int) lameGlobalFlags); } if ( 0 > lame_set_num_channels( lameGlobalFlags, getInChannel()) ) { throw Exception( __FILE__, __LINE__, "lame lib setting channels error", getInChannel() ); } if ( 0 > lame_set_mode( lameGlobalFlags, getOutChannel() == 1 ? MONO : JOINT_STEREO) ) { throw Exception( __FILE__, __LINE__, "lame lib setting mode error", JOINT_STEREO ); } reportEvent( 5, "set lame mode", lame_get_mode( lameGlobalFlags)); reportEvent( 5, "set lame channels", lame_get_num_channels( lameGlobalFlags)); if ( 0 > lame_set_in_samplerate( lameGlobalFlags, getInSampleRate()) ) { throw Exception( __FILE__, __LINE__, "lame lib setting input sample rate error", getInSampleRate() ); } reportEvent( 5, "set lame in sample rate", lame_get_in_samplerate( lameGlobalFlags)); if ( 0 > lame_set_out_samplerate( lameGlobalFlags, getOutSampleRate()) ) { throw Exception( __FILE__, __LINE__, "lame lib setting output sample rate error", getOutSampleRate() ); } reportEvent( 5, "set lame out sample rate", lame_get_out_samplerate( lameGlobalFlags)); switch ( getOutBitrateMode() ) { case cbr: { if ( 0 > lame_set_brate( lameGlobalFlags, getOutBitrate()) ) { throw Exception( __FILE__, __LINE__, "lame lib setting output bit rate error", getOutBitrate() ); } reportEvent( 5, "set lame bit rate", lame_get_brate( lameGlobalFlags)); double d = (1.0 - getOutQuality()) * 10.0; if ( d > 9 ) { d = 9; } int q = int (d); if ( 0 > lame_set_quality( lameGlobalFlags, q) ) { throw Exception( __FILE__, __LINE__, "lame lib setting quality error", q); } reportEvent( 5, "set lame quality", lame_get_quality( lameGlobalFlags)); } break; case abr: if ( 0 > lame_set_VBR( lameGlobalFlags,vbr_abr)) { throw Exception( __FILE__, __LINE__, "lame lib setting abr error", vbr_abr); } reportEvent( 5, "set lame abr bitrate", lame_get_VBR( lameGlobalFlags)); if ( 0 > lame_set_VBR_mean_bitrate_kbps( lameGlobalFlags, getOutBitrate())) { throw Exception( __FILE__, __LINE__, "lame lib setting abr mean bitrate error", getOutBitrate()); } reportEvent( 5, "set lame abr mean bitrate", lame_get_VBR_mean_bitrate_kbps( lameGlobalFlags)); break; case vbr: { if ( 0 > lame_set_VBR( lameGlobalFlags, vbr_mtrh)) { throw Exception( __FILE__, __LINE__, "lame lib setting vbr error", vbr_mtrh ); } reportEvent( 5, "set lame vbr bitrate", lame_get_VBR( lameGlobalFlags)); double d = (1.0 - getOutQuality()) * 10.0; if ( d > 9 ) { d = 9; } int q = int (d); if ( 0 > lame_set_VBR_q( lameGlobalFlags, q) ) { throw Exception( __FILE__, __LINE__, "lame lib setting vbr quality error", q); } reportEvent( 5, "set lame vbr quality", lame_get_VBR_q( lameGlobalFlags)); } break; } if ( 0 > lame_set_lowpassfreq( lameGlobalFlags, lowpass) ) { throw Exception( __FILE__, __LINE__, "lame lib setting lowpass frequency error", lowpass ); } reportEvent( 5, "set lame lowpass frequency", lame_get_lowpassfreq( lameGlobalFlags)); if ( 0 > lame_set_highpassfreq( lameGlobalFlags, highpass) ) { throw Exception( __FILE__, __LINE__, "lame lib setting highpass frequency error", lowpass ); } reportEvent( 5, "set lame highpass frequency", lame_get_highpassfreq( lameGlobalFlags)); // not configurable lame settings if ( 0 > lame_set_exp_nspsytune( lameGlobalFlags, 1) ) { throw Exception( __FILE__, __LINE__, "lame lib setting psycho acoustic model error"); } reportEvent( 5, "set lame psycho acoustic model", lame_get_exp_nspsytune( lameGlobalFlags)); if ( 0 > lame_set_error_protection( lameGlobalFlags, 1) ) { throw Exception( __FILE__, __LINE__, "lame lib setting error protection error", 1 ); } reportEvent( 5, "set lame error protection", lame_get_error_protection( lameGlobalFlags)); // let lame init its own params based on our settings if ( 0 > lame_init_params( lameGlobalFlags) ) { throw Exception( __FILE__, __LINE__, "lame lib initializing params error" ); } if (getReportVerbosity() >= 3) { lame_print_config( lameGlobalFlags); } return true; } /*------------------------------------------------------------------------------ * Write data to the encoder *----------------------------------------------------------------------------*/ unsigned int LameLibEncoder :: write ( const void * buf, unsigned int len ) throw ( Exception ) { if ( !isOpen() || len == 0 ) { return 0; } unsigned int bitsPerSample = getInBitsPerSample(); unsigned int inChannels = getInChannel(); unsigned int sampleSize = (bitsPerSample / 8) * inChannels; unsigned char * b = (unsigned char*) buf; unsigned int processed = len - (len % sampleSize); unsigned int nSamples = processed / sampleSize; short int * leftBuffer = new short int[nSamples]; short int * rightBuffer = new short int[nSamples]; if ( bitsPerSample == 8 ) { Util::conv8( b, processed, leftBuffer, rightBuffer, inChannels); } else if ( bitsPerSample == 16 ) { Util::conv16( b, processed, leftBuffer, rightBuffer, inChannels, isInBigEndian()); } else { delete[] leftBuffer; delete[] rightBuffer; throw Exception( __FILE__, __LINE__, "unsupported number of bits per sample for the encoder", bitsPerSample ); } // data chunk size estimate according to lame documentation // NOTE: mp3Size is calculated based on the number of input channels // which may be bigger than need, as output channels can be less unsigned int mp3Size = (unsigned int) (1.25 * nSamples + 7200); unsigned char * mp3Buf = new unsigned char[mp3Size]; int ret; ret = lame_encode_buffer( lameGlobalFlags, leftBuffer, inChannels == 2 ? rightBuffer : leftBuffer, nSamples, mp3Buf, mp3Size ); delete[] leftBuffer; delete[] rightBuffer; if ( ret < 0 ) { reportEvent( 3, "lame encoding error", ret); delete[] mp3Buf; return 0; } unsigned int written = getSink()->write( mp3Buf, ret); delete[] mp3Buf; // just let go data that could not be written if ( written < (unsigned int) ret ) { reportEvent( 2, "couldn't write all from encoder to underlying sink", ret - written); } return processed; } /*------------------------------------------------------------------------------ * Flush the data from the encoder *----------------------------------------------------------------------------*/ void LameLibEncoder :: flush ( void ) throw ( Exception ) { if ( !isOpen() ) { return; } // data chunk size estimate according to lame documentation unsigned int mp3Size = 7200; unsigned char * mp3Buf = new unsigned char[mp3Size]; int ret; ret = lame_encode_flush( lameGlobalFlags, mp3Buf, mp3Size ); unsigned int written = getSink()->write( mp3Buf, ret); delete[] mp3Buf; // just let go data that could not be written if ( written < (unsigned int) ret ) { reportEvent( 2, "couldn't write all from encoder to underlying sink", ret - written); } getSink()->flush(); } /*------------------------------------------------------------------------------ * Close the encoding session *----------------------------------------------------------------------------*/ void LameLibEncoder :: close ( void ) throw ( Exception ) { if ( isOpen() ) { flush(); lame_close( lameGlobalFlags); lameGlobalFlags = 0; getSink()->close(); } } #endif // HAVE_LAME_LIB darkice-1.2/src/PulseAudioDspSource.cpp0000644000175000017500000001557412170706662015117 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Copyright (c) 2004 LS Informationstechnik (LIKE) University of Erlangen Nuremberg All rights reserved. Tyrell DarkIce File : PulseAudioDspSource.cpp Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/PulseAudioDspSource.cpp $ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #include "AudioSource.h" // compile only if configured for PULSEAUDIO #ifdef SUPPORT_PULSEAUDIO_DSP #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "Util.h" #include "Exception.h" #include "PulseAudioDspSource.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: PulseAudioDspSource.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $"; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Initialize the object *----------------------------------------------------------------------------*/ void PulseAudioDspSource :: init ( const char * paSourceName ) throw ( Exception ) { if (paSourceName == NULL) { throw Exception( __FILE__, __LINE__, "no paSourceName specified"); } Reporter::reportEvent( 1, "Using PulseAudio source: ", paSourceName); Util::strEq( paSourceName , "default" ); if (Util::strEq( paSourceName , "default" )) { sourceName = NULL; } else { sourceName = Util::strDup( paSourceName); } ss.channels = getChannel(); ss.rate = getSampleRate(); running = 0; //Supported for some bits per sample, both Big and Little endian if (isBigEndian()) { switch (getBitsPerSample()) { case 8: ss.format = PA_SAMPLE_U8; break; case 16: ss.format = PA_SAMPLE_S16BE; break; case 24: ss.format = PA_SAMPLE_S24BE; break; case 32: ss.format = PA_SAMPLE_S32BE; break; default: ss.format = PA_SAMPLE_INVALID; } } else { switch (getBitsPerSample()) { case 8: ss.format = PA_SAMPLE_U8; break; case 16: ss.format = PA_SAMPLE_S16LE; break; case 24: ss.format = PA_SAMPLE_S24LE; break; case 32: ss.format = PA_SAMPLE_S32LE; break; default: ss.format = PA_SAMPLE_INVALID; } } } /*------------------------------------------------------------------------------ * De-initialize the object *----------------------------------------------------------------------------*/ void PulseAudioDspSource :: strip ( void ) throw ( Exception ) { if ( isOpen() ) { close(); } delete[] sourceName; } /*------------------------------------------------------------------------------ * Open the audio source *----------------------------------------------------------------------------*/ bool PulseAudioDspSource :: open ( void ) throw ( Exception ) { char client_name[255]; //to identify each darkice on pulseaudio server snprintf(client_name, 255, "darkice-%d", getpid()); if (!(s = pa_simple_new(NULL, client_name, PA_STREAM_RECORD, sourceName, "darkice record", &ss, NULL, NULL, &error))) { throw Exception( __FILE__, __LINE__, ": pa_simple_new() failed: %s\n", pa_strerror(error)); } running = 1; return true; } /*------------------------------------------------------------------------------ * Check wether read() would return anything *----------------------------------------------------------------------------*/ bool PulseAudioDspSource :: canRead ( unsigned int sec, unsigned int usec ) throw ( Exception ) { /** Strange have to remove this, need to investigate... */ /* if ( !isOpen() ) { return false; } */ if (running == 0) { char client_name[255]; //to identify each darkice on pulseaudio server snprintf(client_name, 255, "darkice-%d", getpid()); if (!(s = pa_simple_new(NULL, client_name, PA_STREAM_RECORD, sourceName, "darkice record", &ss, NULL, NULL, &error))) { throw Exception( __FILE__, __LINE__, ": pa_simple_new() failed: %s\n", pa_strerror(error)); } running = 1; } return true; } /*------------------------------------------------------------------------------ * Read from the audio source *----------------------------------------------------------------------------*/ unsigned int PulseAudioDspSource :: read ( void * buf, unsigned int len ) throw ( Exception ) { int ret; ret = pa_simple_read(s, buf, len, &error); if ( ret < 0) { throw Exception(__FILE__, __LINE__, ": pa_simple_read() failed: %s\n", pa_strerror(error)); } return len; } /*------------------------------------------------------------------------------ * Close the audio source *----------------------------------------------------------------------------*/ void PulseAudioDspSource :: close ( void ) throw ( Exception ) { if ( !isOpen() ) { return; } pa_simple_free(s); running = 0; } #endif // HAVE_PULSEAUDIO_LIB darkice-1.2/src/LameLibEncoder.h0000644000175000017500000003567512170706662013473 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : LameLibEncoder.h Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/LameLibEncoder.h $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef LAME_LIB_ENCODER_H #define LAME_LIB_ENCODER_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_LAME_LIB #include #else #error configure with lame #endif #include "Ref.h" #include "Exception.h" #include "Reporter.h" #include "AudioEncoder.h" #include "Sink.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * A class representing the lame encoder linked as a shared object or as * a static library. * * @author $Author: rafael@riseup.net $ * @version $Revision: 553 $ */ class LameLibEncoder : public AudioEncoder, public virtual Reporter { private: /** * Lame library global flags */ lame_global_flags * lameGlobalFlags; /** * Lowpass filter. Sound frequency in Hz, from where up the * input is cut. */ int lowpass; /** * Highpass filter. Sound frequency in Hz, from where down the * input is cut. */ int highpass; /** * Initialize the object. * * @param lowpass frequency threshold for the lowpass filter. * Input above this frequency is cut. * If 0, lame's default values are used, * which depends on the out sample rate. * @param highpass frequency threshold for the highpass filter. * Input below this frequency is cut. * If 0, lame's default values are used, * which depends on the out sample rate. * @exception Exception */ inline void init ( int lowpass, int highpass ) throw ( Exception ) { this->lameGlobalFlags = NULL; this->lowpass = lowpass; this->highpass = highpass; if ( getInBitsPerSample() != 16 && getInBitsPerSample() != 8 ) { throw Exception( __FILE__, __LINE__, "specified bits per sample not supported", getInBitsPerSample() ); } if ( getInChannel() != 1 && getInChannel() != 2 ) { throw Exception( __FILE__, __LINE__, "unsupported number of input channels for the encoder", getInChannel() ); } if ( getOutChannel() != 1 && getOutChannel() != 2 ) { throw Exception( __FILE__, __LINE__, "unsupported number of output channels for the encoder", getOutChannel() ); } if ( getInChannel() < getOutChannel() ) { throw Exception( __FILE__, __LINE__, "output channels greater then input channels", getOutChannel() ); } } /** * De-initialize the object. * * @exception Exception */ inline void strip ( void ) throw ( Exception ) { } protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline LameLibEncoder ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } public: /** * Constructor. * * @param sink the sink to send mp3 output to * @param inSampleRate sample rate of the input. * @param inBitsPerSample number of bits per sample of the input. * @param inChannel number of channels of the input. * @param inBigEndian shows if the input is big or little endian * @param outBitrateMode the bit rate mode of the output. * @param outBitrate bit rate of the output (kbits/sec). * @param outQuality the quality of the stream. * @param outSampleRate sample rate of the output. * If 0, inSampleRate is used. * @param outChannel number of channels of the output. * If 0, inChannel is used. * @param lowpass frequency threshold for the lowpass filter. * Input above this frequency is cut. * If 0, lame's default values are used, * which depends on the out sample rate. * @param highpass frequency threshold for the highpass filter. * Input below this frequency is cut. * If 0, lame's default values are used, * which depends on the out sample rate. * @exception Exception */ inline LameLibEncoder ( Sink * sink, unsigned int inSampleRate, unsigned int inBitsPerSample, unsigned int inChannel, bool inBigEndian, BitrateMode outBitrateMode, unsigned int outBitrate, double outQuality, unsigned int outSampleRate = 0, unsigned int outChannel = 0, int lowpass = 0, int highpass = 0 ) throw ( Exception ) : AudioEncoder ( sink, inSampleRate, inBitsPerSample, inChannel, inBigEndian, outBitrateMode, outBitrate, outQuality, outSampleRate, outChannel ) { init( lowpass, highpass); } /** * Constructor. * * @param sink the sink to send mp3 output to * @param as get input sample rate, bits per sample and channels * from this AudioSource. * @param outBitrateMode the bit rate mode of the output. * @param outBitrate bit rate of the output (kbits/sec). * @param outQuality the quality of the stream. * @param outSampleRate sample rate of the output. * If 0, input sample rate is used. * @param outChannel number of channels of the output. * If 0, input channel is used. * @param lowpass frequency threshold for the lowpass filter. * Input above this frequency is cut. * If 0, lame's default values are used, * which depends on the out sample rate. * @param highpass frequency threshold for the highpass filter. * Input below this frequency is cut. * If 0, lame's default values are used, * which depends on the out sample rate. * @exception Exception */ inline LameLibEncoder ( Sink * sink, const AudioSource * as, BitrateMode outBitrateMode, unsigned int outBitrate, double outQuality, unsigned int outSampleRate = 0, unsigned int outChannel = 0, int lowpass = 0, int highpass = 0 ) throw ( Exception ) : AudioEncoder ( sink, as, outBitrateMode, outBitrate, outQuality, outSampleRate, outChannel ) { init( lowpass, highpass); } /** * Copy constructor. * * @param encoder the LameLibEncoder to copy. */ inline LameLibEncoder ( const LameLibEncoder & encoder ) throw ( Exception ) : AudioEncoder( encoder ) { init( encoder.lowpass, encoder.highpass ); } /** * Destructor. * * @exception Exception */ inline virtual ~LameLibEncoder ( void ) throw ( Exception ) { if ( isOpen() ) { close(); } strip(); } /** * Assignment operator. * * @param encoder the LameLibEncoder to assign this to. * @return a reference to this LameLibEncoder. * @exception Exception */ inline virtual LameLibEncoder & operator= ( const LameLibEncoder & encoder ) throw ( Exception ) { if ( this != &encoder ) { strip(); AudioEncoder::operator=( encoder); init( encoder.lowpass, encoder.highpass ); } return *this; } /** * Get the version string of the underlying lame library. * * @return the version string of the underlying lame library. */ inline const char * getLameVersion( void ) { return get_lame_version(); } /** * Check wether encoding is in progress. * * @return true if encoding is in progress, false otherwise. */ inline virtual bool isRunning ( void ) const throw () { return isOpen(); } /** * Start encoding. This function returns as soon as possible, * with encoding started in the background. * * @return true if encoding has started, false otherwise. * @exception Exception */ inline virtual bool start ( void ) throw ( Exception ) { return open(); } /** * Stop encoding. Stops the encoding running in the background. * * @exception Exception */ inline virtual void stop ( void ) throw ( Exception ) { return close(); } /** * Open an encoding session. * * @return true if opening was successfull, false otherwise. * @exception Exception */ virtual bool open ( void ) throw ( Exception ); /** * Check if the encoding session is open. * * @return true if the encoding session is open, false otherwise. */ inline virtual bool isOpen ( void ) const throw () { return lameGlobalFlags != 0; } /** * Check if the encoder is ready to accept data. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true if the encoder is ready to accept data, * false otherwise. * @exception Exception */ inline virtual bool canWrite ( unsigned int sec, unsigned int usec ) throw ( Exception ) { if ( !isOpen() ) { return false; } return true; } /** * Write data to the encoder. * Buf is expected to be a sequence of big-endian 16 bit values, * with left and right channels interleaved. Len is the number of * bytes, must be a multiple of 4. * * @param buf the data to write. * @param len number of bytes to write from buf. * @return the number of bytes written (may be less than len). * @exception Exception */ virtual unsigned int write ( const void * buf, unsigned int len ) throw ( Exception ); /** * Flush all data that was written to the encoder to the underlying * connection. * * @exception Exception */ virtual void flush ( void ) throw ( Exception ); /** * Close the encoding session. * * @exception Exception */ virtual void close ( void ) throw ( Exception ); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* LAME_LIB_ENCODER_H */ darkice-1.2/src/SolarisDspSource.cpp0000644000175000017500000001653112170706662014453 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : SolarisDspSource.cpp Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/SolarisDspSource.cpp $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #include "SolarisDspSource.h" #ifdef SUPPORT_SOLARIS_DSP // only compile this code if there is support for it #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_UNISTD_H #include #else #error need unistd.h #endif #ifdef HAVE_STRING_H #include #else #error need string.h #endif #ifdef HAVE_SYS_TYPES_H #include #else #error need sys/types.h #endif #ifdef HAVE_SYS_STAT_H #include #else #error need sys/stat.h #endif #ifdef HAVE_FCNTL_H #include #else #error need fcntl.h #endif #ifdef HAVE_SYS_TIME_H #include #else #error need sys/time.h #endif #ifdef HAVE_SYS_IOCTL_H #include #else #error need sys/ioctl.h #endif #ifdef HAVE_SIGNAL_H #include #else #error need signal.h #endif #if defined( HAVE_SYS_AUDIO_H ) #include #elif defined( HAVE_SYS_AUDIOIO_H ) #include #else #error need sys/audio.h or sys/audioio.h #endif #include "Util.h" #include "Exception.h" #include "SolarisDspSource.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: SolarisDspSource.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $"; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Initialize the object *----------------------------------------------------------------------------*/ void SolarisDspSource :: init ( const char * name ) throw ( Exception ) { fileName = Util::strDup( name); fileDescriptor = 0; } /*------------------------------------------------------------------------------ * De-initialize the object *----------------------------------------------------------------------------*/ void SolarisDspSource :: strip ( void ) throw ( Exception ) { if ( isOpen() ) { close(); } delete[] fileName; } #include /*------------------------------------------------------------------------------ * Open the audio source *----------------------------------------------------------------------------*/ bool SolarisDspSource :: open ( void ) throw ( Exception ) { audio_info_t audioInfo; if ( isOpen() ) { return false; } if ( (fileDescriptor = ::open( fileName, O_RDONLY)) == -1 ) { fileDescriptor = 0; return false; } AUDIO_INITINFO( &audioInfo); audioInfo.record.sample_rate = getSampleRate(); audioInfo.record.channels = getChannel(); audioInfo.record.precision = getBitsPerSample(); audioInfo.record.encoding = AUDIO_ENCODING_LINEAR; // for stupid OpenBSD we need to add the following, as it masks // read/write calls when using -pthread audioInfo.record.pause = 0; if ( ioctl( fileDescriptor, AUDIO_SETINFO, &audioInfo) == -1 ) { close(); throw Exception( __FILE__, __LINE__, "ioctl error"); } if ( audioInfo.record.channels != getChannel() ) { close(); throw Exception( __FILE__, __LINE__, "can't set channels", audioInfo.record.channels); } if ( audioInfo.record.precision != getBitsPerSample() ) { close(); throw Exception( __FILE__, __LINE__, "can't set bits per sample", audioInfo.record.precision); } if ( audioInfo.record.sample_rate != getSampleRate() ) { reportEvent( 2, "sound card recording sample rate set to ", audioInfo.record.sample_rate, " while trying to set it to ", getSampleRate()); reportEvent( 2, "this is probably not a problem, but a slight " "drift in the sound card driver"); } return true; } /*------------------------------------------------------------------------------ * Check wether read() would return anything *----------------------------------------------------------------------------*/ bool SolarisDspSource :: canRead ( unsigned int sec, unsigned int usec ) throw ( Exception ) { fd_set fdset; struct timespec timespec; sigset_t sigset; int ret; if ( !isOpen() ) { return false; } FD_ZERO( &fdset); FD_SET( fileDescriptor, &fdset); timespec.tv_sec = sec; timespec.tv_nsec = usec * 1000L; // mask out SIGUSR1, as we're expecting that signal for other reasons sigemptyset(&sigset); sigaddset(&sigset, SIGUSR1); ret = pselect( fileDescriptor + 1, &fdset, NULL, NULL, ×pec, &sigset); if ( ret == -1 ) { throw Exception( __FILE__, __LINE__, "select error"); } return ret > 0; } /*------------------------------------------------------------------------------ * Read from the audio source *----------------------------------------------------------------------------*/ unsigned int SolarisDspSource :: read ( void * buf, unsigned int len ) throw ( Exception ) { ssize_t ret; if ( !isOpen() ) { return 0; } ret = ::read( fileDescriptor, buf, len); if ( ret == -1 ) { throw Exception( __FILE__, __LINE__, "read error"); } return ret; } /*------------------------------------------------------------------------------ * Close the audio source *----------------------------------------------------------------------------*/ void SolarisDspSource :: close ( void ) throw ( Exception ) { if ( !isOpen() ) { return; } ::close( fileDescriptor); fileDescriptor = 0; } #endif // SUPPORT_SOLARIS_DSP darkice-1.2/src/AudioSource.cpp0000644000175000017500000001337312170706662013432 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : AudioSource.cpp Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/AudioSource.cpp $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "AudioSource.h" #include "Util.h" #include "Exception.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: AudioSource.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $"; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Return an audio source based on the compiled DSP supports and the * supplied device name parameter. *----------------------------------------------------------------------------*/ AudioSource * AudioSource :: createDspSource( const char * deviceName, const char * jackClientName, const char * paSourceName, int sampleRate, int bitsPerSample, int channel) throw ( Exception ) { if ( Util::strEq( deviceName, "/dev/tty", 8) ) { #if defined( SUPPORT_SERIAL_ULAW ) Reporter::reportEvent( 1, "Using Serial Ulaw input device:", deviceName); return new SerialUlaw( deviceName, sampleRate, bitsPerSample, channel); #else throw Exception( __FILE__, __LINE__, "trying to open Serial ULaw device " "without support compiled", deviceName); #endif } else if ( Util::strEq( deviceName, "/dev", 4) ) { #if defined( SUPPORT_OSS_DSP ) Reporter::reportEvent( 1, "Using OSS DSP input device:", deviceName); return new OssDspSource( deviceName, sampleRate, bitsPerSample, channel); #elif defined( SUPPORT_SOLARIS_DSP ) Reporter::reportEvent( 1, "Using Solaris DSP input device:",deviceName); return new SolarisDspSource( deviceName, sampleRate, bitsPerSample, channel); #else throw Exception( __FILE__, __LINE__, "trying to open OSS or Solaris DSP device " "without support compiled", deviceName); #endif } else if ( Util::strEq( deviceName, "jack", 4) ) { #if defined( SUPPORT_JACK_DSP ) Reporter::reportEvent( 1, "Using JACK audio server as input device."); return new JackDspSource( deviceName, jackClientName, sampleRate, bitsPerSample, channel); #else throw Exception( __FILE__, __LINE__, "trying to open JACK device without " "support compiled", deviceName); #endif } else if ( Util::strEq( deviceName, "pulseaudio", 10) ) { #if defined( SUPPORT_PULSEAUDIO_DSP ) Reporter::reportEvent( 1, "Using PulseAudio audio server as input device."); return new PulseAudioDspSource( paSourceName, sampleRate, bitsPerSample, channel); #else throw Exception( __FILE__, __LINE__, "trying to open PulseAudio device without " "support compiled", deviceName); #endif } else { #if defined( SUPPORT_ALSA_DSP ) Reporter::reportEvent( 1, "Using ALSA DSP input device:", deviceName); return new AlsaDspSource( deviceName, sampleRate, bitsPerSample, channel); #else throw Exception( __FILE__, __LINE__, "trying to open ALSA DSP device without " "support compiled", deviceName); #endif } } darkice-1.2/src/AudioEncoder.h0000644000175000017500000003626512170706662013223 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : AudioEncoder.h Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/AudioEncoder.h $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef AUDIO_ENCODER_H #define AUDIO_ENCODER_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include "Referable.h" #include "Sink.h" #include "AudioSource.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * An audio encoder * * @author $Author: rafael@riseup.net $ * @version $Revision: 553 $ */ class AudioEncoder : public Sink, public virtual Referable { public: /** * Type to specify bitrate mode. Possible values: * - cbr - constant bitrate mode * described by bitrate * - abr - average bitrate mode * described by an average bitrate and quality * - vbr - variable bitrate mode * described by quality */ enum BitrateMode { cbr, abr, vbr }; private: /** * The Sink to dump the encoded data to */ Ref sink; /** * Sample rate of the input. */ unsigned int inSampleRate; /** * Number of bits per sample of the input. */ unsigned int inBitsPerSample; /** * Number of channels of the input. */ unsigned int inChannel; /** * Is the input big endian or little endian? */ bool inBigEndian; /** * The bitrate mode of the encoder */ BitrateMode outBitrateMode; /** * Bit rate of the output in kbits/sec, for fixed bitrate encodings. */ unsigned int outBitrate; /** * Quality of the output, for variable bitrate encodings. */ double outQuality; /** * Sample rate of the output. */ unsigned int outSampleRate; /** * Number of channels of the output. */ unsigned int outChannel; /** * Initialize the object. * * @param sink the sink to send encoded output to * @param inSampleRate sample rate of the input. * @param inBitsPerSample number of bits per sample of the input. * @param inChannel number of channels of the input. * @param inBigEndian shows if the input is big or little endian. * @param outBitrateMode the bit rate mode of the output. * @param outBitrate bit rate of the output. * @param outSampleRate sample rate of the output. * @param outChannel number of channels of the output. * @exception Exception */ inline void init ( Sink * sink, unsigned int inSampleRate, unsigned int inBitsPerSample, unsigned int inChannel, bool inBigEndian, BitrateMode outBitrateMode, unsigned int outBitrate, double outQuality, unsigned int outSampleRate, unsigned int outChannel ) throw ( Exception ) { this->sink = sink; this->inSampleRate = inSampleRate; this->inBitsPerSample = inBitsPerSample; this->inChannel = inChannel; this->inBigEndian = inBigEndian; this->outBitrateMode = outBitrateMode; this->outBitrate = outBitrate; this->outQuality = outQuality; this->outSampleRate = outSampleRate; this->outChannel = outChannel; if ( outQuality < -0.1 || 1.0 < outQuality ) { throw Exception( __FILE__, __LINE__, "invalid encoder quality"); } } /** * De-iitialize the object. * * @exception Exception */ inline void strip ( void ) throw ( Exception ) { } protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline AudioEncoder ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } /** * Constructor. * * @param sink the sink to send encoded output to * @param inSampleRate sample rate of the input. * @param inBitsPerSample number of bits per sample of the input. * @param inChannel number of channels of the input. * @param inBigEndian shows if the input is big or little endian * @param outBitrateMode the bit rate mode of the output. * @param outBitrate bit rate of the output (kbits/sec). * @param outQuality the quality of the stream. * @param outSampleRate sample rate of the output. * If 0, inSampleRate is used. * @param outChannel number of channels of the output. * If 0, inChannel is used. * @exception Exception */ inline AudioEncoder ( Sink * sink, unsigned int inSampleRate, unsigned int inBitsPerSample, unsigned int inChannel, bool inBigEndian, BitrateMode outBitrateMode, unsigned int outBitrate, double outQuality, unsigned int outSampleRate = 0, unsigned int outChannel = 0 ) throw ( Exception ) { init ( sink, inSampleRate, inBitsPerSample, inChannel, inBigEndian, outBitrateMode, outBitrate, outQuality, outSampleRate ? outSampleRate : inSampleRate, outChannel ? outChannel : inChannel ); } /** * Constructor. * * @param sink the sink to send encoded output to * @param as get input sample rate, bits per sample and channels * from this AudioSource. * @param outBitrateMode the bit rate mode of the output. * @param outBitrate bit rate of the output (kbits/sec). * @param outQuality the quality of the stream. * @param outSampleRate sample rate of the output. * If 0, input sample rate is used. * @param outChannel number of channels of the output. * If 0, input channel is used. * @exception Exception */ inline AudioEncoder ( Sink * sink, const AudioSource * as, BitrateMode outBitrateMode, unsigned int outBitrate, double outQuality, unsigned int outSampleRate = 0, unsigned int outChannel = 0 ) throw ( Exception) { init( sink, as->getSampleRate(), as->getBitsPerSample(), as->getChannel(), as->isBigEndian(), outBitrateMode, outBitrate, outQuality, outSampleRate ? outSampleRate : as->getSampleRate(), outChannel ? outChannel : as->getChannel() ); } /** * Copy constructor. * * @param encoder the AudioEncoder to copy. */ inline AudioEncoder ( const AudioEncoder & encoder ) throw ( Exception ) { init ( encoder.sink.get(), encoder.inSampleRate, encoder.inBitsPerSample, encoder.inChannel, encoder.inBigEndian, encoder.outBitrateMode, encoder.outBitrate, encoder.outQuality, encoder.outSampleRate, encoder.outChannel ); } /** * Assignment operator. * * @param encoder the AudioEncoder to assign this to. * @return a reference to this AudioEncoder. * @exception Exception */ inline virtual AudioEncoder & operator= ( const AudioEncoder & encoder ) throw ( Exception ) { if ( this != &encoder ) { strip(); init ( encoder.sink.get(), encoder.inSampleRate, encoder.inBitsPerSample, encoder.inChannel, encoder.inBigEndian, encoder.outBitrateMode, encoder.outBitrate, encoder.outQuality, encoder.outSampleRate, encoder.outChannel ); } return *this; } public: /** * Destructor. * * @exception Exception */ inline virtual ~AudioEncoder ( void ) throw ( Exception ) { strip(); } /** * Get the underlying sink, that the encoded content is sent to. * * @return the underlying sink */ inline virtual Ref getSink(void) throw () { return sink; } /** * Get the number of channels of the input. * * @return the number of channels of the input. */ inline int getInChannel ( void ) const throw () { return inChannel; } /** * Tell if the input is big or little endian. * * @return true if the input is big endian, false if little endian. */ inline bool isInBigEndian ( void ) const throw () { return inBigEndian; } /** * Get the sample rate of the input. * * @return the sample rate of the input. */ inline int getInSampleRate ( void ) const throw () { return inSampleRate; } /** * Get the number of bits per sample of the input. * * @return the number of bits per sample of the input. */ inline int getInBitsPerSample ( void ) const throw () { return inBitsPerSample; } /** * Get the number of channels of the output. * * @return the number of channels of the output. */ inline int getOutChannel ( void ) const throw () { return outChannel; } /** * Get the sample rate of the output. * * @return the sample rate of the output. */ inline int getOutSampleRate ( void ) const throw () { return outSampleRate; } /** * Get the bit rate mode of the output. * * @return the bit rate mode of the output. */ inline BitrateMode getOutBitrateMode ( void ) const throw () { return outBitrateMode; } /** * Get the bit rate of the output in kbits/sec, for fixed bitrate * encodings. * * @return the bit rate of the output. */ inline unsigned int getOutBitrate ( void ) const throw () { return outBitrate; } /** * Get the encoding quality of the output, for variable bitrate * encodings. * * @return the encoding quality of the output. */ inline double getOutQuality ( void ) const throw () { return outQuality; } /** * Check wether encoding is in progress. * * @return true if encoding is in progress, false otherwise. */ virtual bool isRunning ( void ) const throw () = 0; /** * Start encoding. This function returns as soon as possible, * with encoding started in the background. * * @return true if encoding has started, false otherwise. * @exception Exception */ virtual bool start ( void ) throw ( Exception ) = 0; /** * Stop encoding. Stops the encoding running in the background. * * @exception Exception */ virtual void stop ( void ) throw ( Exception ) = 0; /** * Cut what the sink has been doing so far, and start anew. * This usually means separating the data sent to the sink up * until now, and start saving a new chunk of data. * * Typically this action is delegated to the underlying sink. */ inline virtual void cut ( void ) throw () { sink->cut(); } }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* AUDIO_ENCODER_H */ darkice-1.2/src/ShoutCast.cpp0000644000175000017500000001657512170706662013134 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : ShoutCast.cpp Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $Source$ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_STDIO_H #include #else #error need stdio.h #endif #ifdef HAVE_STRING_H #include #else #error need string.h #endif #ifdef HAVE_MATH_H #include #else #error need math.h #endif #include #include "Exception.h" #include "Source.h" #include "Sink.h" #include "Util.h" #include "ShoutCast.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: ShoutCast.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $"; /*------------------------------------------------------------------------------ * Size of string conversion buffer *----------------------------------------------------------------------------*/ #define STRBUF_SIZE 32 #define HEADERLINE_LENGTH 50 /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Initialize the object *----------------------------------------------------------------------------*/ void ShoutCast :: init ( const char * irc, const char * aim, const char * icq, const char * mountPoint ) throw ( Exception ) { this->irc = irc ? Util::strDup( irc) : 0; this->aim = aim ? Util::strDup( aim) : 0; this->icq = icq ? Util::strDup( icq) : 0; this->mountPoint = mountPoint ? Util::strDup( mountPoint ) : 0; } /*------------------------------------------------------------------------------ * De-initialize the object *----------------------------------------------------------------------------*/ void ShoutCast :: strip ( void ) throw ( Exception ) { if ( irc ) { delete[] irc; } if ( aim ) { delete[] aim; } if ( icq ) { delete[] icq; } if (mountPoint ){ delete[] mountPoint; } } /*------------------------------------------------------------------------------ * Log in to the ShoutCast server using the icy login scheme *----------------------------------------------------------------------------*/ bool ShoutCast :: sendLogin ( void ) throw ( Exception ) { Sink * sink = getSink(); Source * source = getSocket(); const char * str; char resp[STRBUF_SIZE]; unsigned int len; bool needsMountPoint = false; const char * mountPoint = getMountPoint(); char header_line[HEADERLINE_LENGTH+2]; // ... + \n + \0 if ( !source->isOpen() ) { return false; } if ( !sink->isOpen() ) { return false; } // We will add SOURCE only if really needed: if the mountPoint is not null // and is different of "/". This is to keep maximum compatibility with // NullSoft Shoutcast server. if (mountPoint != 0L && strlen(mountPoint) > 0 && 0 != strcmp("/", mountPoint)) { needsMountPoint = true; } std::ostringstream os; if (needsMountPoint) { os << "SOURCE "; } /* first line is the password in itself */ os << getPassword(); os << "\n"; // send the mount point if (needsMountPoint) { os << " "; if (strncmp("/", mountPoint, 1) != 0) { os << "/"; } os << mountPoint; os << "\n"; } str = os.str().c_str(); // Ok, now we send login which will be different of classical Shoutcast // if mountPoint is not null and is different from "/" ... sink->write( str, strlen( str)); sink->flush(); /* read the anticipated response: "OK" */ len = source->read( resp, STRBUF_SIZE); reportEvent(8, "server response length: ", len); reportEvent(8, "server response: ", resp); if ( Util::strEq( resp, "invalid password",16) ) { throw Exception( __FILE__, __LINE__, "ShoutCast - wrong password"); } if ( len < 2 || resp[0] != 'O' || resp[1] != 'K' ) { return false; } /* suck anything that the other side has to say */ while ( source->canRead( 0, 0) && (len = source->read( resp, STRBUF_SIZE)) ) { ; } /* send the icy headers */ if ( getName() ) { snprintf(header_line, HEADERLINE_LENGTH, "icy-name:%s", getName()); strcat(header_line, "\n"); sink->write( header_line, strlen( header_line)); } if ( getUrl() ) { snprintf(header_line, HEADERLINE_LENGTH, "icy-url:%s", getUrl()); strcat(header_line, "\n"); sink->write( header_line, strlen( header_line)); } if ( getGenre() ) { snprintf(header_line, HEADERLINE_LENGTH, "icy-genre:%s", getGenre()); strcat(header_line, "\n"); sink->write( header_line, strlen( header_line)); } if ( getIrc() ) { snprintf(header_line, HEADERLINE_LENGTH, "icy-irc:%s", getIrc()); strcat(header_line, "\n"); sink->write( header_line, strlen( header_line)); } if ( getAim() ) { snprintf(header_line, HEADERLINE_LENGTH, "icy-aim:%s", getAim()); strcat(header_line, "\n"); sink->write( header_line, strlen( header_line)); } if ( getIcq() ) { snprintf(header_line, HEADERLINE_LENGTH, "icy-icq:%s", getIcq()); strcat(header_line, "\n"); sink->write( header_line, strlen( header_line)); } snprintf(header_line, HEADERLINE_LENGTH, "icy-br:%d", getBitRate()); strcat(header_line, "\n"); sink->write( header_line, strlen( header_line)); snprintf(header_line, HEADERLINE_LENGTH, "icy-pub:%s", getIsPublic() ? "1" : "0"); strcat(header_line, "\n"); sink->write( header_line, strlen( header_line)); str = "\n"; sink->write( str, strlen( str)); sink->flush(); return true; } darkice-1.2/src/BufferedSink.h0000644000175000017500000002652012170706662013222 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : BufferedSink.h Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/BufferedSink.h $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef BUFFERED_SINK_H #define BUFFERED_SINK_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include "Ref.h" #include "Reporter.h" #include "Sink.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * A Sink First-In First-Out buffer. * This buffer can always be written to, it overwrites any * data contained if needed. * The class is not thread-safe. * * @author $Author: rafael@riseup.net $ * @version $Revision: 553 $ */ class BufferedSink : public Sink, public virtual Reporter { private: /** * The buffer. */ unsigned char * buffer; /** * The end of the buffer. */ unsigned char * bufferEnd; /** * The size of the buffer. */ unsigned int bufferSize; /** * The highest usage of the buffer. */ unsigned int peak; /** * All data written to this BufferedSink is handled by chuncks * of this size. */ unsigned int chunkSize; /** * Number of bytes the underlying stream is misaligned with * chunkSize. (It needs this many bytes more to be aligned.) */ unsigned int misalignment; /** * Start of free territory in buffer. */ unsigned char * inp; /** * Start of sensible data in buffer. */ unsigned char * outp; /** * The underlying Sink. */ Ref sink; /** * Initialize the object. * * @param sink the Sink to attach this BufferedSink to. * @param size the size of the internal buffer to use. * @param chunkSize size of chunks to handle data in. * @exception Exception */ void init ( Sink * sink, unsigned int size, unsigned int chunkSize ) throw ( Exception ); /** * De-initialize the object. * * @exception Exception */ void strip ( void ) throw ( Exception ); /** * Slide a pointer in the internal buffer by offset. If the pointer * would reach beyond the end of the buffer, it goes wraps around. * * @param p the pointer to slide. * @param offset the amount to slide with. * @return pointer p + offset, wrapped around if needed. */ inline unsigned char * slidePointer ( unsigned char * p, unsigned int offset ) throw () { p += offset; while ( p >= bufferEnd ) { p -= bufferSize; } return p; } /** * Update the peak buffer usage indicator. * * @see #peak */ inline void updatePeak ( void ) throw () { unsigned int u; u = outp <= inp ? inp - outp : (bufferEnd - outp) + (inp - buffer); if ( peak < u ) { peak = u; reportEvent( 4, "BufferedSink, new peak:", peak); reportEvent( 4, "BufferedSink, remaining:", bufferSize - peak); } } /** * If the underlying Sink is misaligned on chunkSize, write as * many 0s as needed to get it aligned. * * @see #misalignment * @see #chunkSize */ inline bool align ( void ) throw ( Exception ) { char b[] = { 0 }; while ( misalignment ) { if ( sink->canWrite( 0, 0) ) { unsigned int ret; if ( !(ret = sink->write( b, 1)) ) { return false; } --misalignment; } else { return false; } } return true; } protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline BufferedSink ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } /** * Get the size of the buffer. * * @return the size of the buffer. */ inline unsigned int getSize ( void ) const throw () { return bufferSize; } /** * Store data in the internal buffer. If there is not enough space, * discard all in the buffer and the beginning of the supplied * buffer if needed. * * @param buffer the data to store. * @param bufferSize the amount of data to store in bytes. * @return number of bytes really stored. */ unsigned int store ( const void * buffer, unsigned int bufferSize ) throw ( Exception ); public: /** * Constructor by an underlying Sink, buffer size and chunk size. * * @param sink the Sink to attach this BufferSink to. * @param size the size of the buffer to use for buffering. * @param chunkSize hanlde all data in write() as chunks of * chunkSize * @exception Exception */ inline BufferedSink ( Sink * sink, unsigned int size, unsigned int chunkSize = 1 ) throw ( Exception ) { init( sink, size, chunkSize); } /** * Copy constructor. * * @param buffer the object to copy. * @exception Exception */ BufferedSink ( const BufferedSink & buffer ) throw ( Exception ); /** * Destructor. * * @exception Exception */ inline virtual ~BufferedSink ( void ) throw ( Exception ) { strip(); } /** * Assignment operator. * * @param bs the object to assign to this one. * @return a reference to this object. * @exception Exception */ virtual BufferedSink & operator= ( const BufferedSink & bs ) throw ( Exception ); /** * Get the peak usage of the internal buffer. * * @return the peak usage of the internal buffer. */ inline unsigned int getPeak ( void ) const throw () { return peak; } /** * Open the BufferedSink. Opens the underlying Sink. * * @return true if opening was successful, false otherwise. * @exception Exception */ inline virtual bool open ( void ) throw ( Exception ) { return sink->open(); } /** * Check if a BufferedSink is open. * * @return true if the BufferedSink is open, false otherwise. */ inline virtual bool isOpen ( void ) const throw () { return sink->isOpen(); } /** * Check if the BufferedSink is ready to accept data. * Always returns true immediately. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true * @exception Exception */ inline virtual bool canWrite ( unsigned int sec, unsigned int usec ) throw ( Exception ) { return true; } /** * Write data to the BufferedSink. * Always reads the maximum number of chunkSize chunks buf * holds. If the data can not be written to the underlying * stream, it is buffered. If the buffer overflows, the oldest * data is discarded. * * @param buf the data to write. * @param len number of bytes to write from buf. * @return the number of bytes written (may be less than len). * @exception Exception */ virtual unsigned int write ( const void * buf, unsigned int len ) throw ( Exception ); /** * Flush all data that was written to the BufferedSink to the * underlying Sink. * * @exception Exception */ inline virtual void flush ( void ) throw ( Exception ) { unsigned char b[1]; write( b, 0); } /** * Cut what the sink has been doing so far, and start anew. * This usually means separating the data sent to the sink up * until now, and start saving a new chunk of data. */ inline virtual void cut ( void ) throw () { flush(); sink->cut(); } /** * Close the BufferedSink. Closes the underlying Sink. * * @exception Exception */ virtual void close ( void ) throw ( Exception ); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* BUFFERED_SINK_H */ darkice-1.2/src/ShoutCast.h0000644000175000017500000002037512170706662012572 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : ShoutCast.h Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/ShoutCast.h $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef SHOUT_CAST_H #define SHOUT_CAST_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include "Sink.h" #include "TcpSocket.h" #include "CastSink.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * Class representing output to a ShoutCast server with * icy login * * @author $Author: rafael@riseup.net $ * @version $Revision: 553 $ */ class ShoutCast : public CastSink { private: /** * IRC info string for the stream */ char * irc; /** * AIM info string for the stream */ char * aim; /** * ICQ info string for the stream */ char * icq; /** * The optional mountPoint */ char * mountPoint; /** * Initalize the object. * * @param irc IRC info string for the stream. * @param aim AIM info string for the stream. * @param icq ICQ info string for the stream. * @param mountPoint Optional mount point information * @exception Exception */ void init ( const char * irc, const char * aim, const char * icq, const char * mountPoint ) throw ( Exception ); /** * De-initalize the object. * * @exception Exception */ void strip ( void ) throw ( Exception ); protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline ShoutCast ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } /** * Log in to the server using the socket avialable. * * @return true if login was successful, false otherwise. * @exception Exception */ virtual bool sendLogin ( void ) throw ( Exception ); public: /** * Constructor. * * @param socket socket connection to the server. * @param password password to the server. * @param mountPoint Optional mount point for DSS. * @param name name of the stream. * @param url URL associated with the stream. * @param genre genre of the stream. * @param bitRate bitrate of the stream (e.g. mp3 bitrate). * @param isPublic is the stream public? * @param irc IRC info string for the stream. * @param aim AIM info string for the stream. * @param icq ICQ info string for the stream. * @param streamDump an optional sink to dump the binary stream * data to. * @param bufferDuration duration of the BufferedSink buffer * in seconds. * @exception Exception */ inline ShoutCast ( TcpSocket * socket, const char * password, const char * mountPoint, unsigned int bitRate, const char * name = 0, const char * url = 0, const char * genre = 0, bool isPublic = false, const char * irc = 0, const char * aim = 0, const char * icq = 0, Sink * streamDump = 0 ) throw ( Exception ) : CastSink( socket, password, bitRate, name, url, genre, isPublic, streamDump ) { init( irc, aim, icq, mountPoint ); } /** * Copy constructor. * * @param cs the ShoutCast to copy. */ inline ShoutCast( const ShoutCast & cs ) throw ( Exception ) : CastSink( cs ) { init( cs.getIrc(), cs.getAim(), cs.getIcq(), cs.getMountPoint()); } /** * Destructor. * * @exception Exception */ inline virtual ~ShoutCast( void ) throw ( Exception ) { strip(); } /** * Assignment operator. * * @param cs the ShoutCast to assign this to. * @return a reference to this ShoutCast. * @exception Exception */ inline virtual ShoutCast & operator= ( const ShoutCast & cs ) throw ( Exception ) { if ( this != &cs ) { strip(); CastSink::operator=( cs ); init( cs.getIrc(), cs.getAim(), cs.getIcq(), getMountPoint()); } return *this; } /** * Get the mount point of the stream on the server. * The mount point can be null if it has not been set * (typical Shoutcast server) or not null (for instance * with Darwin Streaming Server). In that case, the * authentication process will be slightly different. * * @return the mount point of the stream on the server. */ inline const char * getMountPoint ( void ) const throw () { return mountPoint; } /** * Get the IRC info string for the stream. * * @return the IRC info string for the stream. */ inline const char * getIrc ( void ) const throw () { return irc; } /** * Get the AIM info string for the stream. * * @return the AIM info string for the stream. */ inline const char * getAim ( void ) const throw () { return aim; } /** * Get the ICQ info string for the stream. * * @return the ICQ info string for the stream. */ inline const char * getIcq ( void ) const throw () { return icq; } }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* SHOUT_CAST_H */ darkice-1.2/src/AlsaDspSource.h0000644000175000017500000002050012170706662013353 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Copyright (c) 2004 LS Informationstechnik (LIKE) University of Erlangen Nuremberg All rights reserved. Tyrell DarkIce File : AlsaDspSource.h Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/AlsaDspSource.h $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef ALSA_SOURCE_H #define ALSA_SOURCE_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "Reporter.h" #include "AudioSource.h" #ifdef HAVE_ALSA_LIB #include #else #error configure for ALSA #endif /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * An audio input based on the ALSA sound system * * @author $Author: rafael@riseup.net $ * @version $Revision: 553 $ */ class AlsaDspSource : public AudioSource, public virtual Reporter { private: /** * Name of the capture PCM stream. */ char *pcmName; /** * Handle to access PCM stream data. */ snd_pcm_t *captureHandle; /** * Stores number of bytes per frame. One frame * contains all samples per time instance. */ int bytesPerFrame; /** * Is the stream running? */ bool running; /** * Number of useconds to do buffering in the audio device. */ unsigned int bufferTime; protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline AlsaDspSource ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } /** * Initialize the object * * @param name the PCM to open. * @exception Exception */ void init ( const char * name ) throw ( Exception ); /** * De-iitialize the object * * @exception Exception */ void strip ( void ) throw ( Exception ); public: /** * Constructor. * * @param name the PCM (e.g. "hwplug:0,0"). * @param sampleRate samples per second (e.g. 44100 for 44.1kHz). * @param bitsPerSample bits per sample (e.g. 16 bits). * @param channel number of channels of the audio source * (e.g. 1 for mono, 2 for stereo, etc.). * @exception Exception */ inline AlsaDspSource ( const char * name, int sampleRate = 44100, int bitsPerSample = 16, int channel = 2 ) throw ( Exception ) : AudioSource( sampleRate, bitsPerSample, channel) { init( name); } /** * Copy Constructor. * * @param ds the object to copy. * @exception Exception */ inline AlsaDspSource ( const AlsaDspSource & ds ) throw ( Exception ) : AudioSource( ds ) { init( ds.pcmName); } /** * Destructor. * * @exception Exception */ inline virtual ~AlsaDspSource ( void ) throw ( Exception ) { strip(); } /** * Assignment operator. * * @param ds the object to assign to this one. * @return a reference to this object. * @exception Exception */ inline virtual AlsaDspSource & operator= ( const AlsaDspSource & ds ) throw ( Exception ) { if ( this != &ds ) { strip(); AudioSource::operator=( ds); init( ds.pcmName); } return *this; } /** * Tell if the data from this source comes in big or little endian. * * @return true if the source is big endian, false otherwise */ virtual bool isBigEndian ( void ) const throw (); /** * Open the AlsaDspSource. * This does not put Alsa device into recording mode. * To start getting samples, call either canRead() or read(). * * @return true if opening was successful, false otherwise * @exception Exception * * @see #canRead * @see #read */ virtual bool open ( void ) throw ( Exception ); /** * Check if the AlsaDspSource is open. * * @return true if the AlsaDspSource is open, false otherwise. */ inline virtual bool isOpen ( void ) const throw () { return captureHandle != 0; } /** * Check if the AlsaDspSource can be read from. * Blocks until the specified time for data to be available. * Puts the PCM into recording mode. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true if the AlsaDspSource is ready to be read from, * false otherwise. * @exception Exception */ virtual bool canRead ( unsigned int sec, unsigned int usec ) throw ( Exception ); /** * Read from the AlsaDspSource. * Puts the PCM into recording mode. * * @param buf the buffer to read into. * @param len the number of bytes to read into buf * @return the number of bytes read (may be less than len). * @exception Exception */ virtual unsigned int read ( void * buf, unsigned int len ) throw ( Exception ); /** * Close the AlsaDspSource. * * @exception Exception */ virtual void close ( void ) throw ( Exception ); /** * Returns the buffer size in useconds. * * @return the number of useconds audio will be buffered in ALSA */ inline virtual unsigned int getBufferTime( void ) const { return bufferTime; } /** * Sets the number of useconds to buffer audio in ALSA * * @param time buffer time */ inline virtual void setBufferTime( unsigned int time ) { bufferTime = time; } }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* ALSA_SOURCE_H */ darkice-1.2/src/FileSink.h0000644000175000017500000002003312170706662012350 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : FileSink.h Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/FileSink.h $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef FILE_SINK_H #define FILE_SINK_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include "Reporter.h" #include "Sink.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * File data output * * @author $Author: rafael@riseup.net $ * @version $Revision: 553 $ */ class FileSink : public Sink, public virtual Reporter { private: /** * The name of the configuration related to * this file sink. something like "file-0" or "file-2". */ char * configName; /** * Name of the file represented by the FileSink. */ char * fileName; /** * Initialize the object. * * @param configName the name of the configuration related to * this file sink. something like "file-0" or "file-2". * @param name name of the file to be represented by the object. * @exception Exception */ void init ( const char * configName, const char * name ) throw ( Exception ); /** * De-initialize the object. * * @exception Exception */ void strip ( void ) throw ( Exception ); /** * Get the file name to where to move the data saved so far. * Used in cut(). * * @return the file name where to move the data saved so far. * @throws Exception on file operation errors */ std::string getArchiveFileName( void ) throw ( Exception ); protected: /** * Low-level file descriptor for the file represented by this object. */ int fileDescriptor; /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline FileSink ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } public: /** * Constructor by a file name. * * @param configName the name of the configuration related to * this file sink. something like "file-0" or "file-2". * @param name name of the file to be represented by the object. * @exception Exception */ inline FileSink( const char * configName, const char * name ) throw ( Exception ) { init( configName, name); } /** * Copy constructor. * * @param fsink the FileSink to copy. * @exception Exception */ FileSink( const FileSink & fsink ) throw ( Exception ); /** * Destructor. * * @exception Exception */ inline virtual ~FileSink( void ) throw ( Exception ) { strip(); } /** * Assignment operator. * * @param fs the FileSink to assign to this object. * @return a reference to this object. * @exception Exception */ virtual FileSink & operator= ( const FileSink & fs ) throw ( Exception ); /** * Get the file name this FileSink represents. * * @return the file name this FileSink represents. */ inline const char * getFileName ( void ) const throw () { return fileName; } /** * Check for the existence of the file this FileSink represents. * * @return true if the file exists and is a regular file, * false otherwise. */ virtual bool exists ( void ) const throw (); /** * Create the file. * * @return true if creation was successful, false otherwise. * @exception Exception */ virtual bool create ( void ) throw ( Exception ); /** * Open the file. Truncates the file. * * @return true if opening was successful, false otherwise. * @exception Exception */ virtual bool open ( void ) throw ( Exception ); /** * Check if the FileSink is open. * * @return true if the FileSink is open, false otherwise. */ inline virtual bool isOpen ( void ) const throw () { return fileDescriptor != 0; } /** * Check if the FileSink is ready to accept data. * Blocks until the specified time for data to be available. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true if the Sink is ready to accept data, false otherwise. * @exception Exception */ virtual bool canWrite ( unsigned int sec, unsigned int usec ) throw ( Exception ); /** * Write data to the FileSink. * * @param buf the data to write. * @param len number of bytes to write from buf. * @return the number of bytes written (may be less than len). * @exception Exception */ virtual unsigned int write ( const void * buf, unsigned int len ) throw ( Exception ); /** * This is a no-op in this FileSink. * * @exception Exception */ inline virtual void flush ( void ) throw ( Exception ) { } /** * Cut what the sink has been doing so far, and start anew. * This usually means separating the data sent to the sink up * until now, and start saving a new chunk of data. */ virtual void cut ( void ) throw (); /** * Close the FileSink. * * @exception Exception */ virtual void close ( void ) throw ( Exception ); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* FILE_SINK_H */ darkice-1.2/src/OpusLibEncoder.cpp0000644000175000017500000004720312170706662014064 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : OpusLibEncoder.cpp Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/OpusLibEncoder.cpp $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif // compile only if configured for Ogg / Opus #ifdef HAVE_OPUS_LIB #include "Exception.h" #include "Util.h" #include "OpusLibEncoder.h" #include "CastSink.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: OpusLibEncoder.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $"; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Initialize the encoder *----------------------------------------------------------------------------*/ void OpusLibEncoder :: init ( unsigned int outMaxBitrate ) throw ( Exception ) { this->outMaxBitrate = outMaxBitrate; if ( getInBitsPerSample() != 16 && getInBitsPerSample() != 8 ) { throw Exception( __FILE__, __LINE__, "specified bits per sample not supported", getInBitsPerSample() ); } if ( getInChannel() != 1 && getInChannel() != 2 ) { throw Exception( __FILE__, __LINE__, "unsupported number of channels for the encoder", getInChannel() ); } if ( getOutSampleRate() != 48000 ) { throw Exception( __FILE__, __LINE__, "unsupported sample rate for this encoder, you should resample your input to 48000Hz", getOutSampleRate() ); } if ( getOutSampleRate() == getInSampleRate() ) { resampleRatio = 1; converter = 0; } else { resampleRatio = ( (double) getOutSampleRate() / (double) getInSampleRate() ); // Determine if we can use linear interpolation. // The inverse of the ratio must be a power of two for linear mode to // be of sufficient quality. bool useLinear = true; double inverse = 1 / resampleRatio; int integer = (int) inverse; // Check that the inverse of the ratio is an integer if( integer == inverse ) { while( useLinear && integer ) { // Loop through the bits // If the lowest order bit is not the only one set if( integer & 1 && integer != 1 ) { // Not a power of two; cannot use linear useLinear = false; } else { // Shift all the bits over and try again integer >>= 1; } } } else { useLinear = false; } // If we get here and useLinear is still true, then we have // a power of two. // open the aflibConverter in // - high quality // - linear or quadratic (non-linear) based on algorithm // - not filter interpolation #ifdef HAVE_SRC_LIB int srcError = 0; converter = src_new(useLinear == true ? SRC_LINEAR : SRC_SINC_FASTEST, getInChannel(), &srcError); if(srcError) throw Exception (__FILE__, __LINE__, "libsamplerate error: ", src_strerror (srcError)); #else converter = new aflibConverter( true, useLinear, false); #endif } encoderOpen = false; } /*------------------------------------------------------------------------------ * Open an encoding session *----------------------------------------------------------------------------*/ bool OpusLibEncoder :: open ( void ) throw ( Exception ) { int ret; if ( isOpen() ) { close(); } // open the underlying sink if ( !getSink()->open() ) { throw Exception( __FILE__, __LINE__, "opus lib opening underlying sink error"); } int bufferSize = (getInBitsPerSample()/8) * getInChannel() * 480; internalBuffer = new unsigned char[bufferSize]; internalBufferLength = 0; memset( internalBuffer, 0, bufferSize); int err; opusEncoder = opus_encoder_create( getOutSampleRate(), getInChannel(), OPUS_APPLICATION_AUDIO, &err); if( err != OPUS_OK ) { throw Exception( __FILE__, __LINE__, "opus encoder creation error", err); } opus_encoder_ctl(opusEncoder, OPUS_SET_COMPLEXITY(10)); opus_encoder_ctl(opusEncoder, OPUS_SET_SIGNAL(OPUS_SIGNAL_MUSIC)); switch ( getOutBitrateMode() ) { case cbr: { int maxBitrate = getOutBitrate() * 1000; if ( !maxBitrate ) { maxBitrate = 96000; } opus_encoder_ctl(opusEncoder, OPUS_SET_BITRATE(maxBitrate)); opus_encoder_ctl(opusEncoder, OPUS_SET_VBR(0)); } break; case abr: { int maxBitrate = getOutBitrate() * 1000; if ( !maxBitrate ) { maxBitrate = 96000; } /* set non-managed VBR around the average bitrate */ opus_encoder_ctl(opusEncoder, OPUS_SET_BITRATE(maxBitrate)); opus_encoder_ctl(opusEncoder, OPUS_SET_VBR(1)); opus_encoder_ctl(opusEncoder, OPUS_SET_VBR_CONSTRAINT(1)); } break; case vbr: int maxBitrate = getOutBitrate() * 1000; if ( !maxBitrate ) { maxBitrate = 96000; } /* set non-managed VBR around the average bitrate */ opus_encoder_ctl(opusEncoder, OPUS_SET_BITRATE(maxBitrate)); opus_encoder_ctl(opusEncoder, OPUS_SET_VBR(1)); opus_encoder_ctl(opusEncoder, OPUS_SET_VBR_CONSTRAINT(0)); break; } if ( (ret = ogg_stream_init( &oggStreamState, 0)) ) { throw Exception( __FILE__, __LINE__, "ogg stream init error", ret); } // First, we need to assemble and send a OggOpus header. OpusIdHeader header; strncpy(header.magic, "OpusHead", 8); header.version = 1; header.channels = getOutChannel(); header.preskip = 0; header.samplerate = getInSampleRate(); header.gain = 0; // technically a fixed-point decimal. header.chanmap = 0; // And, now we need to send a Opus comment header. // Anything after this can be audio. char vendor[8] = "darkice"; char titlestr[7] = "TITLE="; OpusCommentHeader::Tags tags[1]; char name[40]; CastSink* sink = dynamic_cast(getSink().get()); if( sink && sink->getName() ) { strncpy(name, (char*)sink->getName(), 39); name[39] = 0; } else { strncpy(name, "Darkice Stream", 39); } tags[0].tag_len = strlen(titlestr) + strlen(name); tags[0].tag_str = (char*) malloc( tags[0].tag_len + 1 ); if( tags[0].tag_str == NULL ) { throw Exception( __FILE__, __LINE__, "malloc failed"); } strncpy( tags[0].tag_str, titlestr, tags[0].tag_len); strncat( tags[0].tag_str, name, tags[0].tag_len); OpusCommentHeader commentHeader; strncpy(commentHeader.magic, "OpusTags", 8); commentHeader.vendor_length = strlen(vendor); commentHeader.vendor_string = vendor; commentHeader.num_tags = 1; commentHeader.tags = tags; ogg_packet oggHeader; ogg_packet oggCommentHeader; memset(&oggHeader, 0, sizeof(oggHeader)); memset(&oggCommentHeader, 0, sizeof(oggCommentHeader)); unsigned char* headerData = NULL; unsigned char* commentData = NULL; int headerLen = 0; int commentLen = 0; headerLen = header.buildPacket( &headerData); commentLen = commentHeader.buildPacket( &commentData); oggHeader.packet = headerData; oggHeader.bytes = headerLen; oggHeader.b_o_s = 1; oggHeader.e_o_s = 0; oggHeader.granulepos = 0; oggHeader.packetno = 0; oggCommentHeader.packet = commentData; oggCommentHeader.bytes = commentLen; oggCommentHeader.b_o_s = 0; oggCommentHeader.e_o_s = 0; oggCommentHeader.granulepos = 0; oggCommentHeader.packetno = 1; oggPacketNumber = 2; oggGranulePosition = 0; ogg_stream_packetin( &oggStreamState, &oggHeader); ogg_stream_packetin( &oggStreamState, &oggCommentHeader); ogg_page oggPage; while ( ogg_stream_flush( &oggStreamState, &oggPage) ) { getSink()->write( oggPage.header, oggPage.header_len); getSink()->write( oggPage.body, oggPage.body_len); } free(tags[0].tag_str); free(headerData); free(commentData); // initialize the resampling coverter if needed if ( converter ) { #ifdef HAVE_SRC_LIB converterData.input_frames = 4096/((getInBitsPerSample() / 8) * getInChannel()); converterData.data_in = new float[converterData.input_frames*getInChannel()]; converterData.output_frames = (int) (converterData.input_frames * resampleRatio + 1); converterData.data_out = new float[getInChannel() * converterData.output_frames]; converterData.src_ratio = resampleRatio; converterData.end_of_input = 0; #else converter->initialize( resampleRatio, getInChannel()); #endif } encoderOpen = true; reconnectError = false; return true; } /*------------------------------------------------------------------------------ * Write data to the encoder *----------------------------------------------------------------------------*/ unsigned int OpusLibEncoder :: write ( const void * buf, unsigned int len ) throw ( Exception ) { if ( !isOpen() || len == 0 ) { return 0; } unsigned int channels = getInChannel(); unsigned int bitsPerSample = getInBitsPerSample(); unsigned int sampleSize = (bitsPerSample / 8) * channels; unsigned int i; if ( getInChannel() == 2 && getOutChannel() == 1 ) { for ( i = 0; i < len/sampleSize; i++) { if ( bitsPerSample == 8 ) { char * buf8 = (char *) buf; unsigned int ix = sampleSize * i; unsigned int iix = ix; buf8[i] = (buf8[ix] + buf8[++iix]) / 2; } if ( bitsPerSample == 16 ) { short * buf16 = (short *) buf; unsigned int ix = (bitsPerSample >> 3) * i; unsigned int iix = ix; buf16[i] = (buf16[ix] + buf16[++iix]) / 2; } } len >>= 1; channels = 1; } sampleSize = (bitsPerSample / 8) * channels; unsigned int processed = 0; unsigned int bytesToProcess = len - (len % sampleSize); unsigned int totalProcessed = 0; unsigned char * b = (unsigned char*) buf; unsigned char * tempBuffer = NULL; if( internalBufferLength > 0 ) { tempBuffer = new unsigned char[len + internalBufferLength]; memset( tempBuffer, 0, len + internalBufferLength); if( !tempBuffer ) { throw Exception( __FILE__, __LINE__, "could not allocate temp buffer"); } memcpy( tempBuffer, internalBuffer, internalBufferLength); memcpy( tempBuffer+internalBufferLength, buf, len); b = tempBuffer; bytesToProcess += internalBufferLength; } while ( bytesToProcess / resampleRatio >= 480 * sampleSize ) { unsigned int toProcess = bytesToProcess / (resampleRatio * sampleSize); if( toProcess >= 480 / resampleRatio) { processed = 480 / resampleRatio; } int opusBufferSize = (1275*3+7)*channels; unsigned char* opusBuffer = new unsigned char[opusBufferSize]; // convert the byte-based raw input into a short buffer // with channels still interleaved unsigned int totalSamples = processed * channels; short int * shortBuffer = new short int[totalSamples]; Util::conv( bitsPerSample, b, processed*sampleSize, shortBuffer, isInBigEndian()); if ( converter && processed > 0 ) { // resample if needed int inCount = processed; int outCount = 480; //(int) (inCount * resampleRatio); short int * resampledBuffer = new short int[(outCount+1)* channels]; int converted; #ifdef HAVE_SRC_LIB (void)inCount; converterData.input_frames = processed; src_short_to_float_array (shortBuffer, converterData.data_in, totalSamples); int srcError = src_process (converter, &converterData); if (srcError) throw Exception (__FILE__, __LINE__, "libsamplerate error: ", src_strerror (srcError)); converted = converterData.output_frames_gen; src_float_to_short_array(converterData.data_out, resampledBuffer, converted*channels); #else converted = converter->resample( inCount, outCount, shortBuffer, resampledBuffer ); #endif if( converted != 480) { throw Exception( __FILE__, __LINE__, "resampler error: expected 480 samples", converted); } int encBytes = opus_encode( opusEncoder, resampledBuffer, 480, opusBuffer, opusBufferSize); if( encBytes == -1 ) { throw Exception( __FILE__, __LINE__, "opus encoder error"); } oggGranulePosition += converted; opusBlocksOut( encBytes, opusBuffer); delete[] resampledBuffer; } else if( processed > 0) { memset( opusBuffer, 0, opusBufferSize); int encBytes = opus_encode( opusEncoder, shortBuffer, processed, opusBuffer, opusBufferSize); if( encBytes == -1 ) { throw Exception( __FILE__, __LINE__, "opus encoder error"); } oggGranulePosition += processed; opusBlocksOut( encBytes, opusBuffer); } delete[] shortBuffer; delete[] opusBuffer; bytesToProcess -= processed * sampleSize; totalProcessed += processed * sampleSize; b = ((unsigned char*)b) + (processed * sampleSize); } int newLen = len - (len % sampleSize) + internalBufferLength - totalProcessed; newLen -= newLen % sampleSize; if( newLen > 0 ) { memcpy( internalBuffer, b, newLen); totalProcessed += newLen; internalBufferLength = newLen; } else { internalBufferLength = 0; } if( tempBuffer ) { delete[] tempBuffer; tempBuffer = NULL; } return totalProcessed; } /*------------------------------------------------------------------------------ * Flush the data from the encoder *----------------------------------------------------------------------------*/ void OpusLibEncoder :: flush ( void ) throw ( Exception ) { if ( !isOpen() || reconnectError == true ) { return; } int opusBufferSize = (1275*3+7)*getOutChannel(); unsigned char * opusBuffer = new unsigned char[opusBufferSize]; short int * shortBuffer = new short int[480]; // Send an empty audio packet along to flush out the stream. memset( shortBuffer, 0, 480); memset( opusBuffer, 0, opusBufferSize); int encBytes = opus_encode( opusEncoder, shortBuffer, 480, opusBuffer, opusBufferSize); if( encBytes == -1 ) { throw Exception( __FILE__, __LINE__, "opus encoder error"); } oggGranulePosition += 480; // Send the empty block to the Ogg layer, and mark the // EOS flag. This will trigger any remaining packets to be // sent. opusBlocksOut( encBytes, opusBuffer, true); delete[] opusBuffer; delete[] shortBuffer; getSink()->flush(); } /*------------------------------------------------------------------------------ * Send pending Opus blocks to the underlying stream *----------------------------------------------------------------------------*/ void OpusLibEncoder :: opusBlocksOut ( int bytes, unsigned char* data, bool eos ) throw ( Exception ) { ogg_packet oggPacket; ogg_page oggPage; oggPacket.packet = data; oggPacket.bytes = bytes; oggPacket.b_o_s = 0; oggPacket.e_o_s = ( eos ) ? 1 : 0; oggPacket.granulepos = oggGranulePosition; oggPacket.packetno = oggPacketNumber; oggPacketNumber++; if( ogg_stream_packetin( &oggStreamState, &oggPacket) == 0) { while( ogg_stream_pageout( &oggStreamState, &oggPage) || ( eos && ogg_stream_flush( &oggStreamState, &oggPage) ) ) { int written; written = getSink()->write(oggPage.header, oggPage.header_len); written += getSink()->write( oggPage.body, oggPage.body_len); if ( written < oggPage.header_len + oggPage.body_len ) { reconnectError = true; // just let go data that could not be written reportEvent( 2, "couldn't write full opus data to underlying sink", oggPage.header_len + oggPage.body_len - written); } } } else { throw Exception( __FILE__, __LINE__, "internal ogg error"); } } /*------------------------------------------------------------------------------ * Close the encoding session *----------------------------------------------------------------------------*/ void OpusLibEncoder :: close ( void ) throw ( Exception ) { if ( isOpen() ) { flush(); ogg_stream_clear( &oggStreamState); opus_encoder_destroy( opusEncoder); opusEncoder = NULL; encoderOpen = false; if (internalBuffer) { delete[] internalBuffer; internalBuffer = NULL; } else { fprintf(stderr, "Opus internalBuffer is NULL!\n"); } getSink()->close(); } } #endif // HAVE_OPUS_LIB darkice-1.2/src/IceCast2.h0000644000175000017500000001731412170706662012251 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : IceCast2.h Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/IceCast2.h $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef ICE_CAST2_H #define ICE_CAST2_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include "Sink.h" #include "TcpSocket.h" #include "CastSink.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * Class representing output to an IceCast2 server with * ice login * * @author $Author: rafael@riseup.net $ * @version $Revision: 553 $ */ class IceCast2 : public CastSink { public: /** * Type for specifying the format of the stream. */ enum StreamFormat { mp3, mp2, oggVorbis, oggOpus, aac, aacp }; private: /** * The format of the stream. */ StreamFormat format; /** * Mount point of the stream on the server. */ char * mountPoint; /** * Description of the stream. */ char * description; /** * Initalize the object. * * @param mountPoint mount point of the stream on the server. * @param remoteDumpFile remote dump file (may be NULL). * @param description description of the stream. * @exception Exception */ void init ( StreamFormat format, const char * mountPoint, const char * description ) throw ( Exception ); /** * De-initalize the object. * * @exception Exception */ void strip ( void ) throw ( Exception ); protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline IceCast2 ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } /** * Log in to the server using the socket avialable. * * @return true if login was successful, false otherwise. * @exception Exception */ virtual bool sendLogin ( void ) throw ( Exception ); public: /** * Constructor. * * @param socket socket connection to the server. * @param password password to the server. * @param mountPoint mount point of the stream on the server. * @param format the format of the stream. * @param name name of the stream. * @param description description of the stream. * @param url URL associated with the stream. * @param genre genre of the stream. * @param bitRate bitrate of the stream (e.g. mp3 bitrate). * @param isPublic is the stream public? * @param streamDump an optional sink to dump the binary stream * data to. * @param bufferDuration duration of the BufferedSink buffer * in seconds. * @exception Exception */ inline IceCast2 ( TcpSocket * socket, const char * password, const char * mountPoint, StreamFormat format, unsigned int bitRate, const char * name = 0, const char * description = 0, const char * url = 0, const char * genre = 0, bool isPublic = false, Sink * streamDump = 0 ) throw ( Exception ) : CastSink( socket, password, bitRate, name, url, genre, isPublic, streamDump ) { init( format, mountPoint, description); } /** * Copy constructor. * * @param cs the IceCast2 to copy. */ inline IceCast2( const IceCast2 & cs ) throw ( Exception ) : CastSink( cs ) { init( cs.getFormat(), cs.getMountPoint(), cs.getDescription() ); } /** * Destructor. * * @exception Exception */ inline virtual ~IceCast2( void ) throw ( Exception ) { strip(); } /** * Assignment operator. * * @param cs the IceCast2 to assign this to. * @return a reference to this IceCast2. * @exception Exception */ inline virtual IceCast2 & operator= ( const IceCast2 & cs ) throw ( Exception ) { if ( this != &cs ) { strip(); CastSink::operator=( cs ); init( cs.getFormat(), cs.getMountPoint(), cs.getDescription() ); } return *this; } /** * Get the format of the stream. * * @return the format of the stream. */ inline StreamFormat getFormat ( void ) const throw () { return format; } /** * Get the mount point of the stream on the server. * * @return the mount point of the stream on the server. */ inline const char * getMountPoint ( void ) const throw () { return mountPoint; } /** * Get the description of the stream. * * @return the description of the stream. */ inline const char * getDescription ( void ) const throw () { return description; } }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* ICE_CAST2_H */ darkice-1.2/src/aacPlusEncoder.cpp0000644000175000017500000002414012170706662014072 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2005 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : aacPlusEncoder.cpp Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/aacPlusEncoder.cpp $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif // compile the whole file only if aacplus support configured in #ifdef HAVE_AACPLUS_LIB #include "Exception.h" #include "Util.h" #include "aacPlusEncoder.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: aacPlusEncoder.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $"; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Open an encoding session *----------------------------------------------------------------------------*/ bool aacPlusEncoder :: open ( void ) throw ( Exception ) { if ( isOpen() ) { close(); } // open the underlying sink if ( !sink->open() ) { throw Exception( __FILE__, __LINE__, "aacplus lib opening underlying sink error"); } reportEvent(1, "Using aacplus codec"); encoderHandle = aacplusEncOpen(getOutSampleRate(), getInChannel(), &inputSamples, &maxOutputBytes); aacplusEncConfiguration * aacplusConfig; aacplusConfig = aacplusEncGetCurrentConfiguration(encoderHandle); aacplusConfig->bitRate = getOutBitrate() * 1000; aacplusConfig->bandWidth = lowpass; aacplusConfig->outputFormat = 1; aacplusConfig->inputFormat = AACPLUS_INPUT_16BIT; aacplusConfig->nChannelsOut = getOutChannel(); if (!aacplusEncSetConfiguration(encoderHandle, aacplusConfig)) { throw Exception(__FILE__, __LINE__, "error configuring libaacplus library"); } // initialize the resampling coverter if needed if ( converter ) { #ifdef HAVE_SRC_LIB converterData.input_frames = 4096/((getInBitsPerSample() / 8) * getInChannel()); converterData.data_in = new float[converterData.input_frames*getInChannel()]; converterData.output_frames = (int) (converterData.input_frames * resampleRatio + 1); if ((int) inputSamples > getInChannel() * converterData.output_frames) { resampledOffset = new float[2 * inputSamples]; } else { resampledOffset = new float[2 * getInChannel() * converterData.input_frames]; } converterData.src_ratio = resampleRatio; converterData.end_of_input = 0; #else converter->initialize( resampleRatio, getInChannel()); //needed 2x(converted input samples) to handle offsets int outCount = 2 * getInChannel() * (inputSamples + 1); if (resampleRatio > 1) outCount = (int) (outCount * resampleRatio); resampledOffset = new short int[outCount]; #endif resampledOffsetSize = 0; } aacplusOpen = true; reportEvent(10, "nChannelsAAC", aacplusConfig->nChannelsOut); reportEvent(10, "sampleRateAAC", aacplusConfig->sampleRate); reportEvent(10, "inSamples", inputSamples); return true; } /*------------------------------------------------------------------------------ * Write data to the encoder *----------------------------------------------------------------------------*/ unsigned int aacPlusEncoder :: write ( const void * buf, unsigned int len ) throw ( Exception ) { if ( !isOpen() || len == 0) { return 0; } unsigned int channels = getInChannel(); unsigned int bitsPerSample = getInBitsPerSample(); unsigned int sampleSize = (bitsPerSample / 8) * channels; unsigned char * b = (unsigned char*) buf; unsigned int processed = len - (len % sampleSize); unsigned int nSamples = processed / sampleSize; unsigned char * aacplusBuf = new unsigned char[maxOutputBytes]; int samples = (int) nSamples * channels; int processedSamples = 0; if ( converter ) { unsigned int converted; #ifdef HAVE_SRC_LIB src_short_to_float_array ((short *) b, converterData.data_in, samples); converterData.input_frames = nSamples; converterData.data_out = resampledOffset + (resampledOffsetSize * channels); int srcError = src_process (converter, &converterData); if (srcError) throw Exception (__FILE__, __LINE__, "libsamplerate error: ", src_strerror (srcError)); converted = converterData.output_frames_gen; #else int inCount = nSamples; short int * shortBuffer = new short int[samples]; int outCount = (int) (inCount * resampleRatio); Util::conv( bitsPerSample, b, processed, shortBuffer, isInBigEndian()); converted = converter->resample( inCount, outCount+1, shortBuffer, &resampledOffset[resampledOffsetSize*channels]); delete[] shortBuffer; #endif resampledOffsetSize += converted; // encode samples (if enough) while(resampledOffsetSize - processedSamples >= inputSamples/channels) { int outputBytes; #ifdef HAVE_SRC_LIB short *shortData = new short[inputSamples]; src_float_to_short_array(resampledOffset + (processedSamples * channels), shortData, inputSamples) ; outputBytes = aacplusEncEncode(encoderHandle, (int32_t*) shortData, inputSamples, aacplusBuf, maxOutputBytes); delete [] shortData; #else outputBytes = aacplusEncEncode(encoderHandle, (int32_t*) &resampledOffset[processedSamples*channels], inputSamples, aacplusBuf, maxOutputBytes); #endif getSink()->write(aacplusBuf, outputBytes); processedSamples+=inputSamples/channels; } if (processedSamples && (int) resampledOffsetSize >= processedSamples) { resampledOffsetSize -= processedSamples; //move least part of resampled data to beginning if(resampledOffsetSize) #ifdef HAVE_SRC_LIB resampledOffset = (float *) memmove(resampledOffset, &resampledOffset[processedSamples*channels], resampledOffsetSize*channels*sizeof(float)); #else resampledOffset = (short *) memmove(resampledOffset, &resampledOffset[processedSamples*channels], resampledOffsetSize*sampleSize); #endif } } else { while (processedSamples < samples) { int outputBytes; int inSamples = samples - processedSamples < (int) inputSamples ? samples - processedSamples : inputSamples; outputBytes = aacplusEncEncode(encoderHandle, (int32_t*) (b + processedSamples/sampleSize), inSamples, aacplusBuf, maxOutputBytes); getSink()->write(aacplusBuf, outputBytes); processedSamples += inSamples; } } delete[] aacplusBuf; // return processedSamples; return samples * sampleSize; } /*------------------------------------------------------------------------------ * Flush the data from the encoder *----------------------------------------------------------------------------*/ void aacPlusEncoder :: flush ( void ) throw ( Exception ) { if ( !isOpen() ) { return; } sink->flush(); } /*------------------------------------------------------------------------------ * Close the encoding session *----------------------------------------------------------------------------*/ void aacPlusEncoder :: close ( void ) throw ( Exception ) { if ( isOpen() ) { flush(); aacplusEncClose(encoderHandle); aacplusOpen = false; sink->close(); } } #endif // HAVE_AACPLUS_LIB darkice-1.2/src/DarkIce.cpp0000644000175000017500000014717112170706662012516 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : DarkIce.cpp Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/DarkIce.cpp $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_STDLIB_H #include #else #error need stdlib.h #endif #ifdef HAVE_UNISTD_H #include #else #error need unistd.h #endif #ifdef HAVE_SYS_TYPES_H #include #else #error need sys/types.h #endif #ifdef HAVE_SYS_WAIT_H #include #else #error need sys/wait.h #endif #ifdef HAVE_ERRNO_H #include #else #error need errno.h #endif #ifdef HAVE_SCHED_H #include #else #error need sched.h #endif #include "Util.h" #include "IceCast.h" #include "IceCast2.h" #include "ShoutCast.h" #include "FileCast.h" #include "MultiThreadedConnector.h" #include "DarkIce.h" #ifdef HAVE_LAME_LIB #include "LameLibEncoder.h" #endif #ifdef HAVE_TWOLAME_LIB #include "TwoLameLibEncoder.h" #endif #ifdef HAVE_VORBIS_LIB #include "VorbisLibEncoder.h" #endif #ifdef HAVE_OPUS_LIB #include "OpusLibEncoder.h" #endif #ifdef HAVE_FAAC_LIB #include "FaacEncoder.h" #endif #ifdef HAVE_AACPLUS_LIB #include "aacPlusEncoder.h" #endif /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: DarkIce.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $"; /*------------------------------------------------------------------------------ * Make sure wait-related stuff is what we expect *----------------------------------------------------------------------------*/ #ifndef WEXITSTATUS # define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) #endif #ifndef WIFEXITED # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) #endif /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Initialize the object *----------------------------------------------------------------------------*/ void DarkIce :: init ( const Config & config ) throw ( Exception ) { unsigned int bufferSecs; const ConfigSection * cs; const char * str; unsigned int sampleRate; unsigned int bitsPerSample; unsigned int channel; bool reconnect; const char * device; const char * jackClientName; const char * paSourceName; // the [general] section if ( !(cs = config.get( "general")) ) { throw Exception( __FILE__, __LINE__, "no section [general] in config"); } str = cs->getForSure( "duration", " missing in section [general]"); duration = Util::strToL( str); str = cs->getForSure( "bufferSecs", " missing in section [general]"); bufferSecs = Util::strToL( str); if (bufferSecs == 0) { throw Exception(__FILE__, __LINE__, "setting bufferSecs to 0 not supported"); } str = cs->get( "reconnect"); reconnect = str ? (Util::strEq( str, "yes") ? true : false) : true; // real-time scheduling is enabled by default str = cs->get( "realtime" ); enableRealTime = str ? (Util::strEq( str, "yes") ? true : false) : true; // get realtime scheduling priority. If unspecified, set it to 4. // Why 4? jackd's default priority is 10, jackd client threads run // at 5, so make the encoder thread use 4. jackd automatically sets // the process callback priority to the right value, so all we have // to care about is the encoder priority. str = cs->get( "rtprio" ); realTimeSchedPriority = (str != NULL) ? Util::strToL( str ) : 4; // the [input] section if ( !(cs = config.get( "input")) ) { throw Exception( __FILE__, __LINE__, "no section [input] in config"); } str = cs->getForSure( "sampleRate", " missing in section [input]"); sampleRate = Util::strToL( str); str = cs->getForSure( "bitsPerSample", " missing in section [input]"); bitsPerSample = Util::strToL( str); str = cs->getForSure( "channel", " missing in section [input]"); channel = Util::strToL( str); device = cs->getForSure( "device", " missing in section [input]"); jackClientName = cs->get ( "jackClientName"); paSourceName = cs->get ( "paSourceName"); dsp = AudioSource::createDspSource( device, jackClientName, paSourceName, sampleRate, bitsPerSample, channel ); encConnector = new MultiThreadedConnector( dsp.get(), reconnect ); noAudioOuts = 0; configIceCast( config, bufferSecs); configIceCast2( config, bufferSecs); configShoutCast( config, bufferSecs); configFileCast( config); } /*------------------------------------------------------------------------------ * Look for the IceCast stream outputs in the config file *----------------------------------------------------------------------------*/ void DarkIce :: configIceCast ( const Config & config, unsigned int bufferSecs ) throw ( Exception ) { // look for IceCast encoder output streams, // sections [icecast-0], [icecast-1], ... char stream[] = "icecast- "; size_t streamLen = Util::strLen( stream); unsigned int u; for ( u = noAudioOuts; u < maxOutput; ++u ) { const ConfigSection * cs; // ugly hack to change the section name to "stream0", "stream1", etc. stream[streamLen-1] = '0' + (u - noAudioOuts); if ( !(cs = config.get( stream)) ) { break; } #if !defined HAVE_LAME_LIB && !defined HAVE_TWOLAME_LIB throw Exception( __FILE__, __LINE__, "DarkIce not compiled with lame or twolame support, " "thus can't connect to IceCast 1.x, stream: ", stream); #else const char * str; unsigned int sampleRate = 0; unsigned int channel = 0; AudioEncoder::BitrateMode bitrateMode; unsigned int bitrate = 0; double quality = 0.0; const char * server = 0; unsigned int port = 0; const char * password = 0; const char * mountPoint = 0; const char * remoteDumpFile = 0; const char * name = 0; const char * description = 0; const char * url = 0; const char * genre = 0; bool isPublic = false; int lowpass = 0; int highpass = 0; const char * localDumpName = 0; FileSink * localDumpFile = 0; bool fileAddDate = false; const char * fileDateFormat = 0; AudioEncoder * encoder = 0; int bufferSize = 0; str = cs->get( "sampleRate"); sampleRate = str ? Util::strToL( str) : dsp->getSampleRate(); str = cs->get( "channel"); channel = str ? Util::strToL( str) : dsp->getChannel(); str = cs->get( "bitrate"); bitrate = str ? Util::strToL( str) : 0; str = cs->get( "quality"); quality = str ? Util::strToD( str) : 0.0; str = cs->getForSure( "bitrateMode", " not specified in section ", stream); if ( Util::strEq( str, "cbr") ) { bitrateMode = AudioEncoder::cbr; if ( bitrate == 0 ) { throw Exception( __FILE__, __LINE__, "bitrate not specified for CBR encoding"); } if ( cs->get( "quality" ) == 0 ) { throw Exception( __FILE__, __LINE__, "quality not specified for CBR encoding"); } } else if ( Util::strEq( str, "abr") ) { bitrateMode = AudioEncoder::abr; if ( bitrate == 0 ) { throw Exception( __FILE__, __LINE__, "bitrate not specified for ABR encoding"); } } else if ( Util::strEq( str, "vbr") ) { bitrateMode = AudioEncoder::vbr; if ( cs->get( "quality" ) == 0 ) { throw Exception( __FILE__, __LINE__, "quality not specified for VBR encoding"); } } else { throw Exception( __FILE__, __LINE__, "invalid bitrate mode: ", str); } server = cs->getForSure( "server", " missing in section ", stream); str = cs->getForSure( "port", " missing in section ", stream); port = Util::strToL( str); password = cs->getForSure("password"," missing in section ",stream); mountPoint = cs->getForSure( "mountPoint", " missing in section ", stream); remoteDumpFile = cs->get( "remoteDumpFile"); name = cs->get( "name"); description = cs->get("description"); url = cs->get( "url"); genre = cs->get( "genre"); str = cs->get( "public"); isPublic = str ? (Util::strEq( str, "yes") ? true : false) : false; str = cs->get( "lowpass"); lowpass = str ? Util::strToL( str) : 0; str = cs->get( "highpass"); highpass = str ? Util::strToL( str) : 0; str = cs->get("fileAddDate"); fileAddDate = str ? (Util::strEq( str, "yes") ? true : false) : false; fileDateFormat = cs->get("fileDateFormat"); bufferSize = dsp->getSampleSize() * dsp->getSampleRate() * bufferSecs; reportEvent( 3, "buffer size: ", bufferSize); localDumpName = cs->get( "localDumpFile"); // go on and create the things // check for and create the local dump file if needed if ( localDumpName != 0 ) { if ( fileAddDate ) { if (fileDateFormat == 0) { localDumpName = Util::fileAddDate(localDumpName); } else { localDumpName = Util::fileAddDate( localDumpName, fileDateFormat ); } } localDumpFile = new FileSink( stream, localDumpName); if ( !localDumpFile->exists() ) { if ( !localDumpFile->create() ) { reportEvent( 1, "can't create local dump file", localDumpName); localDumpFile = 0; } } if ( fileAddDate ) { delete[] localDumpName; } } // streaming related stuff audioOuts[u].socket = new TcpSocket( server, port); audioOuts[u].server = new IceCast( audioOuts[u].socket.get(), password, mountPoint, bitrate, name, description, url, genre, isPublic, remoteDumpFile, localDumpFile); str = cs->getForSure( "format", " missing in section ", stream); if (!Util::strEq(str, "mp3") && !Util::strEq(str, "mp2")) { throw Exception( __FILE__, __LINE__, "unsupported stream format: ", str); } #ifdef HAVE_LAME_LIB if ( Util::strEq( str, "mp3") ) { encoder = new LameLibEncoder( audioOuts[u].server.get(), dsp.get(), bitrateMode, bitrate, quality, sampleRate, channel, lowpass, highpass ); } #endif #ifdef HAVE_TWOLAME_LIB if ( Util::strEq( str, "mp2") ) { encoder = new TwoLameLibEncoder( audioOuts[u].server.get(), dsp.get(), bitrateMode, bitrate, sampleRate, channel ); } #endif audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getSampleSize()); encConnector->attach( audioOuts[u].encoder.get()); #endif // HAVE_LAME_LIB || HAVE_TWOLAME_LIB } noAudioOuts += u; } /*------------------------------------------------------------------------------ * Look for the IceCast2 stream outputs in the config file *----------------------------------------------------------------------------*/ void DarkIce :: configIceCast2 ( const Config & config, unsigned int bufferSecs ) throw ( Exception ) { // look for IceCast2 encoder output streams, // sections [icecast2-0], [icecast2-1], ... char stream[] = "icecast2- "; size_t streamLen = Util::strLen( stream); unsigned int u; for ( u = noAudioOuts; u < maxOutput; ++u ) { const ConfigSection * cs; // ugly hack to change the section name to "stream0", "stream1", etc. stream[streamLen-1] = '0' + (u - noAudioOuts); if ( !(cs = config.get( stream)) ) { break; } const char * str; IceCast2::StreamFormat format; unsigned int sampleRate = 0; unsigned int channel = 0; AudioEncoder::BitrateMode bitrateMode; unsigned int bitrate = 0; unsigned int maxBitrate = 0; double quality = 0.0; const char * server = 0; unsigned int port = 0; const char * password = 0; const char * mountPoint = 0; const char * name = 0; const char * description = 0; const char * url = 0; const char * genre = 0; bool isPublic = false; int lowpass = 0; int highpass = 0; const char * localDumpName = 0; FileSink * localDumpFile = 0; bool fileAddDate = false; const char * fileDateFormat = 0; AudioEncoder * encoder = 0; int bufferSize = 0; str = cs->getForSure( "format", " missing in section ", stream); if ( Util::strEq( str, "vorbis") ) { format = IceCast2::oggVorbis; } else if ( Util::strEq( str, "opus") ) { format = IceCast2::oggOpus; } else if ( Util::strEq( str, "mp3") ) { format = IceCast2::mp3; } else if ( Util::strEq( str, "mp2") ) { format = IceCast2::mp2; } else if ( Util::strEq( str, "aac") ) { format = IceCast2::aac; } else if ( Util::strEq( str, "aacp") ) { format = IceCast2::aacp; } else { throw Exception( __FILE__, __LINE__, "unsupported stream format: ", str); } str = cs->get( "sampleRate"); sampleRate = str ? Util::strToL( str) : dsp->getSampleRate(); str = cs->get( "channel"); channel = str ? Util::strToL( str) : dsp->getChannel(); // determine fixed bitrate or variable bitrate quality str = cs->get( "bitrate"); bitrate = str ? Util::strToL( str) : 0; str = cs->get( "maxBitrate"); maxBitrate = str ? Util::strToL( str) : 0; str = cs->get( "quality"); quality = str ? Util::strToD( str) : 0.0; str = cs->getForSure( "bitrateMode", " not specified in section ", stream); if ( Util::strEq( str, "cbr") ) { bitrateMode = AudioEncoder::cbr; if ( bitrate == 0 ) { throw Exception( __FILE__, __LINE__, "bitrate not specified for CBR encoding"); } } else if ( Util::strEq( str, "abr") ) { bitrateMode = AudioEncoder::abr; if ( bitrate == 0 ) { throw Exception( __FILE__, __LINE__, "bitrate not specified for ABR encoding"); } } else if ( Util::strEq( str, "vbr") ) { bitrateMode = AudioEncoder::vbr; if ( cs->get( "quality" ) == 0 ) { throw Exception( __FILE__, __LINE__, "quality not specified for VBR encoding"); } } else { throw Exception( __FILE__, __LINE__, "invalid bitrate mode: ", str); } server = cs->getForSure( "server", " missing in section ", stream); str = cs->getForSure( "port", " missing in section ", stream); port = Util::strToL( str); password = cs->getForSure("password"," missing in section ",stream); mountPoint = cs->getForSure( "mountPoint", " missing in section ", stream); name = cs->get( "name"); description = cs->get( "description"); url = cs->get( "url"); genre = cs->get( "genre"); str = cs->get( "public"); isPublic = str ? (Util::strEq( str, "yes") ? true : false) : false; str = cs->get( "lowpass"); lowpass = str ? Util::strToL( str) : 0; str = cs->get( "highpass"); highpass = str ? Util::strToL( str) : 0; str = cs->get( "fileAddDate"); fileAddDate = str ? (Util::strEq( str, "yes") ? true : false) : false; fileDateFormat = cs->get( "fileDateFormat"); bufferSize = dsp->getSampleSize() * dsp->getSampleRate() * bufferSecs; reportEvent( 3, "buffer size: ", bufferSize); localDumpName = cs->get( "localDumpFile"); // go on and create the things // check for and create the local dump file if needed if ( localDumpName != 0 ) { if ( fileAddDate ) { if (fileDateFormat == 0) { localDumpName = Util::fileAddDate(localDumpName); } else { localDumpName = Util::fileAddDate( localDumpName, fileDateFormat ); } } localDumpFile = new FileSink( stream, localDumpName); if ( !localDumpFile->exists() ) { if ( !localDumpFile->create() ) { reportEvent( 1, "can't create local dump file", localDumpName); localDumpFile = 0; } } if ( fileAddDate ) { delete[] localDumpName; } } // streaming related stuff audioOuts[u].socket = new TcpSocket( server, port); audioOuts[u].server = new IceCast2( audioOuts[u].socket.get(), password, mountPoint, format, bitrate, name, description, url, genre, isPublic, localDumpFile); switch ( format ) { case IceCast2::mp3: #ifndef HAVE_LAME_LIB throw Exception( __FILE__, __LINE__, "DarkIce not compiled with lame support, " "thus can't create mp3 stream: ", stream); #else encoder = new LameLibEncoder( audioOuts[u].server.get(), dsp.get(), bitrateMode, bitrate, quality, sampleRate, channel, lowpass, highpass ); audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getSampleSize()); #endif // HAVE_LAME_LIB break; case IceCast2::oggVorbis: #ifndef HAVE_VORBIS_LIB throw Exception( __FILE__, __LINE__, "DarkIce not compiled with Ogg Vorbis support, " "thus can't Ogg Vorbis stream: ", stream); #else encoder = new VorbisLibEncoder( audioOuts[u].server.get(), dsp.get(), bitrateMode, bitrate, quality, sampleRate, dsp->getChannel(), maxBitrate); audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getSampleSize()); #endif // HAVE_VORBIS_LIB break; case IceCast2::oggOpus: #ifndef HAVE_OPUS_LIB throw Exception( __FILE__, __LINE__, "DarkIce not compiled with Ogg Opus support, " "thus can't Ogg Opus stream: ", stream); #else encoder = new OpusLibEncoder( audioOuts[u].server.get(), dsp.get(), bitrateMode, bitrate, quality, sampleRate, dsp->getChannel(), maxBitrate); audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getBitsPerSample() / 8); #endif // HAVE_OPUS_LIB break; case IceCast2::mp2: #ifndef HAVE_TWOLAME_LIB throw Exception( __FILE__, __LINE__, "DarkIce not compiled with TwoLame support, " "thus can't create mp2 stream: ", stream); #else encoder = new TwoLameLibEncoder( audioOuts[u].server.get(), dsp.get(), bitrateMode, bitrate, sampleRate, channel ); audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getSampleSize()); #endif // HAVE_TWOLAME_LIB break; case IceCast2::aac: #ifndef HAVE_FAAC_LIB throw Exception( __FILE__, __LINE__, "DarkIce not compiled with AAC support, " "thus can't aac stream: ", stream); #else encoder = new FaacEncoder( audioOuts[u].server.get(), dsp.get(), bitrateMode, bitrate, quality, sampleRate, dsp->getChannel()); audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getSampleSize()); #endif // HAVE_FAAC_LIB break; case IceCast2::aacp: #ifndef HAVE_AACPLUS_LIB throw Exception( __FILE__, __LINE__, "DarkIce not compiled with AAC+ support, " "thus can't aacp stream: ", stream); #else encoder = new aacPlusEncoder( audioOuts[u].server.get(), dsp.get(), bitrateMode, bitrate, quality, sampleRate, channel ); audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getSampleSize()); #endif // HAVE_AACPLUS_LIB break; default: throw Exception( __FILE__, __LINE__, "Illegal stream format: ", format); } encConnector->attach( audioOuts[u].encoder.get()); } noAudioOuts += u; } /*------------------------------------------------------------------------------ * Look for the ShoutCast stream outputs in the config file *----------------------------------------------------------------------------*/ void DarkIce :: configShoutCast ( const Config & config, unsigned int bufferSecs ) throw ( Exception ) { // look for Shoutcast encoder output streams, // sections [shoutcast-0], [shoutcast-1], ... char stream[] = "shoutcast- "; size_t streamLen = Util::strLen( stream); unsigned int u; for ( u = noAudioOuts; u < maxOutput; ++u ) { const ConfigSection * cs; // ugly hack to change the section name to "stream0", "stream1", etc. stream[streamLen-1] = '0' + (u - noAudioOuts); if ( !(cs = config.get( stream)) ) { break; } #ifndef HAVE_LAME_LIB throw Exception( __FILE__, __LINE__, "DarkIce not compiled with lame support, " "thus can't connect to ShoutCast, stream: ", stream); #else const char * str; unsigned int sampleRate = 0; unsigned int channel = 0; AudioEncoder::BitrateMode bitrateMode; unsigned int bitrate = 0; double quality = 0.0; const char * server = 0; unsigned int port = 0; const char * password = 0; const char * name = 0; const char * url = 0; const char * genre = 0; bool isPublic = false; const char * mountPoint = 0; int lowpass = 0; int highpass = 0; const char * irc = 0; const char * aim = 0; const char * icq = 0; const char * localDumpName = 0; FileSink * localDumpFile = 0; bool fileAddDate = false; const char * fileDateFormat = 0; AudioEncoder * encoder = 0; int bufferSize = 0; str = cs->get( "sampleRate"); sampleRate = str ? Util::strToL( str) : dsp->getSampleRate(); str = cs->get( "channel"); channel = str ? Util::strToL( str) : dsp->getChannel(); str = cs->get( "bitrate"); bitrate = str ? Util::strToL( str) : 0; str = cs->get( "quality"); quality = str ? Util::strToD( str) : 0.0; str = cs->getForSure( "bitrateMode", " not specified in section ", stream); if ( Util::strEq( str, "cbr") ) { bitrateMode = AudioEncoder::cbr; if ( bitrate == 0 ) { throw Exception( __FILE__, __LINE__, "bitrate not specified for CBR encoding"); } if ( cs->get( "quality" ) == 0 ) { throw Exception( __FILE__, __LINE__, "quality not specified for CBR encoding"); } } else if ( Util::strEq( str, "abr") ) { bitrateMode = AudioEncoder::abr; if ( bitrate == 0 ) { throw Exception( __FILE__, __LINE__, "bitrate not specified for ABR encoding"); } } else if ( Util::strEq( str, "vbr") ) { bitrateMode = AudioEncoder::vbr; if ( cs->get( "quality" ) == 0 ) { throw Exception( __FILE__, __LINE__, "quality not specified for VBR encoding"); } } else { throw Exception( __FILE__, __LINE__, "invalid bitrate mode: ", str); } server = cs->getForSure( "server", " missing in section ", stream); str = cs->getForSure( "port", " missing in section ", stream); port = Util::strToL( str); password = cs->getForSure("password"," missing in section ",stream); name = cs->get( "name"); mountPoint = cs->get( "mountPoint" ); url = cs->get( "url"); genre = cs->get( "genre"); str = cs->get( "public"); isPublic = str ? (Util::strEq( str, "yes") ? true : false) : false; str = cs->get( "lowpass"); lowpass = str ? Util::strToL( str) : 0; str = cs->get( "highpass"); highpass = str ? Util::strToL( str) : 0; irc = cs->get( "irc"); aim = cs->get( "aim"); icq = cs->get( "icq"); str = cs->get("fileAddDate"); fileAddDate = str ? (Util::strEq( str, "yes") ? true : false) : false; fileDateFormat = cs->get( "fileDateFormat"); bufferSize = dsp->getBitsPerSample() / 8 * dsp->getSampleRate() * dsp->getChannel() * bufferSecs; reportEvent( 3, "buffer size: ", bufferSize); localDumpName = cs->get( "localDumpFile"); // go on and create the things // check for and create the local dump file if needed if ( localDumpName != 0 ) { if ( fileAddDate ) { if (fileDateFormat == 0) { localDumpName = Util::fileAddDate(localDumpName); } else { localDumpName = Util::fileAddDate( localDumpName, fileDateFormat ); } } localDumpFile = new FileSink( stream, localDumpName); if ( !localDumpFile->exists() ) { if ( !localDumpFile->create() ) { reportEvent( 1, "can't create local dump file", localDumpName); localDumpFile = 0; } } if ( fileAddDate ) { delete[] localDumpName; } } // streaming related stuff audioOuts[u].socket = new TcpSocket( server, port); audioOuts[u].server = new ShoutCast( audioOuts[u].socket.get(), password, mountPoint, bitrate, name, url, genre, isPublic, irc, aim, icq, localDumpFile); encoder = new LameLibEncoder( audioOuts[u].server.get(), dsp.get(), bitrateMode, bitrate, quality, sampleRate, channel, lowpass, highpass ); audioOuts[u].encoder = new BufferedSink(encoder, bufferSize, dsp->getSampleSize()); encConnector->attach( audioOuts[u].encoder.get()); #endif // HAVE_LAME_LIB } noAudioOuts += u; } /*------------------------------------------------------------------------------ * Look for the FileCast stream outputs in the config file *----------------------------------------------------------------------------*/ void DarkIce :: configFileCast ( const Config & config ) throw ( Exception ) { // look for FileCast encoder output streams, // sections [file-0], [file-1], ... char stream[] = "file- "; size_t streamLen = Util::strLen( stream); unsigned int u; for ( u = noAudioOuts; u < maxOutput; ++u ) { const ConfigSection * cs; // ugly hack to change the section name to "stream0", "stream1", etc. stream[streamLen-1] = '0' + (u - noAudioOuts); if ( !(cs = config.get( stream)) ) { break; } const char * str; const char * format = 0; AudioEncoder::BitrateMode bitrateMode; unsigned int bitrate = 0; double quality = 0.0; const char * targetFileName = 0; unsigned int sampleRate = 0; int lowpass = 0; int highpass = 0; bool fileAddDate = false; const char * fileDateFormat = 0; format = cs->getForSure( "format", " missing in section ", stream); if ( !Util::strEq( format, "vorbis") && !Util::strEq( format, "opus") && !Util::strEq( format, "mp3") && !Util::strEq( format, "mp2") && !Util::strEq( format, "aac") && !Util::strEq( format, "aacp") ) { throw Exception( __FILE__, __LINE__, "unsupported stream format: ", format); } str = cs->getForSure("bitrate", " missing in section ", stream); bitrate = Util::strToL( str); targetFileName = cs->getForSure( "fileName", " missing in section ", stream); str = cs->get( "fileAddDate"); fileAddDate = str ? (Util::strEq( str, "yes") ? true : false) : false; fileDateFormat = cs->get( "fileDateFormat"); str = cs->get( "sampleRate"); sampleRate = str ? Util::strToL( str) : dsp->getSampleRate(); str = cs->get( "bitrate"); bitrate = str ? Util::strToL( str) : 0; str = cs->get( "quality"); quality = str ? Util::strToD( str) : 0.0; str = cs->getForSure( "bitrateMode", " not specified in section ", stream); if ( Util::strEq( str, "cbr") ) { bitrateMode = AudioEncoder::cbr; if ( bitrate == 0 ) { throw Exception( __FILE__, __LINE__, "bitrate not specified for CBR encoding"); } } else if ( Util::strEq( str, "abr") ) { bitrateMode = AudioEncoder::abr; if ( bitrate == 0 ) { throw Exception( __FILE__, __LINE__, "bitrate not specified for ABR encoding"); } } else if ( Util::strEq( str, "vbr") ) { bitrateMode = AudioEncoder::vbr; if ( cs->get( "quality" ) == 0 ) { throw Exception( __FILE__, __LINE__, "quality not specified for VBR encoding"); } } else { throw Exception( __FILE__, __LINE__, "invalid bitrate mode: ", str); } if (Util::strEq(format, "aac") && bitrateMode != AudioEncoder::abr) { throw Exception(__FILE__, __LINE__, "currently the AAC format only supports " "average bitrate mode"); } if (Util::strEq(format, "aacp") && bitrateMode != AudioEncoder::cbr) { throw Exception(__FILE__, __LINE__, "currently the AAC+ format only supports " "constant bitrate mode"); } str = cs->get( "lowpass"); lowpass = str ? Util::strToL( str) : 0; str = cs->get( "highpass"); highpass = str ? Util::strToL( str) : 0; // go on and create the things // the underlying file if ( fileAddDate ) { if (fileDateFormat == 0) { targetFileName = Util::fileAddDate( targetFileName); } else { targetFileName = Util::fileAddDate( targetFileName, fileDateFormat ); } } FileSink * targetFile = new FileSink( stream, targetFileName); if ( !targetFile->exists() ) { if ( !targetFile->create() ) { throw Exception( __FILE__, __LINE__, "can't create output file", targetFileName); } } // streaming related stuff audioOuts[u].socket = 0; audioOuts[u].server = new FileCast( targetFile ); if ( Util::strEq( format, "mp3") ) { #ifndef HAVE_LAME_LIB throw Exception( __FILE__, __LINE__, "DarkIce not compiled with lame support, " "thus can't create mp3 stream: ", stream); #else audioOuts[u].encoder = new LameLibEncoder( audioOuts[u].server.get(), dsp.get(), bitrateMode, bitrate, quality, sampleRate, dsp->getChannel(), lowpass, highpass ); #endif // HAVE_TWOLAME_LIB } else if ( Util::strEq( format, "mp2") ) { #ifndef HAVE_TWOLAME_LIB throw Exception( __FILE__, __LINE__, "DarkIce not compiled with TwoLAME support, " "thus can't create MPEG Audio Layer 2 stream: ", stream); #else audioOuts[u].encoder = new TwoLameLibEncoder( audioOuts[u].server.get(), dsp.get(), bitrateMode, bitrate, sampleRate, dsp->getChannel() ); #endif // HAVE_TWOLAME_LIB } else if ( Util::strEq( format, "vorbis") ) { #ifndef HAVE_VORBIS_LIB throw Exception( __FILE__, __LINE__, "DarkIce not compiled with Ogg Vorbis support, " "thus can't Ogg Vorbis stream: ", stream); #else audioOuts[u].encoder = new VorbisLibEncoder( audioOuts[u].server.get(), dsp.get(), bitrateMode, bitrate, quality, dsp->getSampleRate(), dsp->getChannel() ); #endif // HAVE_VORBIS_LIB } else if ( Util::strEq( format, "opus") ) { #ifndef HAVE_OPUS_LIB throw Exception( __FILE__, __LINE__, "DarkIce not compiled with Ogg Opus support, " "thus can't Ogg Opus stream: ", stream); #else audioOuts[u].encoder = new OpusLibEncoder( audioOuts[u].server.get(), dsp.get(), bitrateMode, bitrate, quality, dsp->getSampleRate(), dsp->getChannel() ); #endif // HAVE_OPUS_LIB } else if ( Util::strEq( format, "aac") ) { #ifndef HAVE_FAAC_LIB throw Exception( __FILE__, __LINE__, "DarkIce not compiled with AAC support, " "thus can't aac stream: ", stream); #else audioOuts[u].encoder = new FaacEncoder( audioOuts[u].server.get(), dsp.get(), bitrateMode, bitrate, quality, sampleRate, dsp->getChannel()); #endif // HAVE_FAAC_LIB } else if ( Util::strEq( format, "aacp") ) { #ifndef HAVE_AACPLUS_LIB throw Exception( __FILE__, __LINE__, "DarkIce not compiled with AAC+ support, " "thus can't aacplus stream: ", stream); #else audioOuts[u].encoder = new aacPlusEncoder( audioOuts[u].server.get(), dsp.get(), bitrateMode, bitrate, quality, sampleRate, dsp->getChannel()); #endif // HAVE_AACPLUS_LIB } else { throw Exception( __FILE__, __LINE__, "Illegal stream format: ", format); } encConnector->attach( audioOuts[u].encoder.get()); } noAudioOuts += u; } /*------------------------------------------------------------------------------ * Set POSIX real-time scheduling *----------------------------------------------------------------------------*/ void DarkIce :: setRealTimeScheduling ( void ) throw ( Exception ) { // Only if the OS has the POSIX real-time scheduling functions implemented. #if defined( HAVE_SCHED_GETSCHEDULER ) && defined( HAVE_SCHED_GETPARAM ) int high_priority; struct sched_param param; /* store the old scheduling parameters */ if ( (origSchedPolicy = sched_getscheduler(0)) == -1 ) { throw Exception( __FILE__, __LINE__, "sched_getscheduler", errno); } if ( sched_getparam( 0, ¶m) == -1 ) { throw Exception( __FILE__, __LINE__, "sched_getparam", errno); } origSchedPriority = param.sched_priority; /* set SCHED_FIFO with max - 1 priority or user configured value */ if ( (high_priority = sched_get_priority_max(SCHED_FIFO)) == -1 ) { throw Exception(__FILE__,__LINE__,"sched_get_priority_max",errno); } reportEvent( 8, "scheduler high priority", high_priority); if (realTimeSchedPriority > high_priority) { param.sched_priority = high_priority - 1; } else { param.sched_priority = realTimeSchedPriority; } if ( sched_setscheduler( 0, SCHED_FIFO, ¶m) == -1 ) { reportEvent( 1, "Could not set POSIX real-time scheduling, " "this may cause recording skips.\n" "Try to run darkice as the super-user."); } else { /* ask the new priortiy and report it */ if ( sched_getparam( 0, ¶m) == -1 ) { throw Exception( __FILE__, __LINE__, "sched_getparam", errno); } reportEvent( 1, "Using POSIX real-time scheduling, priority", param.sched_priority ); } #else reportEvent( 1, "POSIX scheduling not supported on this system, " "this may cause recording skips"); #endif // HAVE_SCHED_GETSCHEDULER && HAVE_SCHED_GETPARAM } /*------------------------------------------------------------------------------ * Set the original scheduling of the process, the one prior to the * setRealTimeScheduling call. * WARNING: make sure you don't call this before setRealTimeScheduling!! *----------------------------------------------------------------------------*/ void DarkIce :: setOriginalScheduling ( void ) throw ( Exception ) { // Only if the OS has the POSIX real-time scheduling functions implemented. #if defined( HAVE_SCHED_GETSCHEDULER ) && defined( HAVE_SCHED_GETPARAM ) uid_t euid; euid = geteuid(); if ( euid == 0 ) { struct sched_param param; if ( sched_getparam( 0, ¶m) == -1 ) { throw Exception( __FILE__, __LINE__, "sched_getparam", errno); } param.sched_priority = origSchedPriority; if ( sched_setscheduler( 0, origSchedPolicy, ¶m) == -1 ) { throw Exception( __FILE__, __LINE__, "sched_setscheduler", errno); } reportEvent( 5, "reverted to original scheduling"); } #endif // HAVE_SCHED_GETSCHEDULER && HAVE_SCHED_GETPARAM } /*------------------------------------------------------------------------------ * Run the encoder *----------------------------------------------------------------------------*/ bool DarkIce :: encode ( void ) throw ( Exception ) { unsigned int len; unsigned long bytes; if ( !encConnector->open() ) { throw Exception( __FILE__, __LINE__, "can't open connector"); } bytes = dsp->getSampleRate() * dsp->getSampleSize() * duration; len = encConnector->transfer( bytes, 4096, 1, 0 ); reportEvent( 1, len, "bytes transfered to the encoders"); encConnector->close(); return true; } /*------------------------------------------------------------------------------ * Run *----------------------------------------------------------------------------*/ int DarkIce :: run ( void ) throw ( Exception ) { reportEvent( 3, "encoding"); if (enableRealTime) { setRealTimeScheduling(); } encode(); if (enableRealTime) { setOriginalScheduling(); } reportEvent( 3, "encoding ends"); return 0; } /*------------------------------------------------------------------------------ * Tell each sink to cut what they are doing, and start again. *----------------------------------------------------------------------------*/ void DarkIce :: cut ( void ) throw () { reportEvent( 5, "cutting"); encConnector->cut(); reportEvent( 5, "cutting ends"); } darkice-1.2/src/Exception.h0000644000175000017500000002143412170706662012610 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : Exception.h Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/Exception.h $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef EXCEPTION_H #define EXCEPTION_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * An exception class. * * This class should not depend on any other class * should not throw any exceptions itself. * * Typical usage: * *
 *  throw Exception( __FILE__, __LINE__, "describe the exception", code);
 *  
* * @author $Author: rafael@riseup.net $ * @version $Revision: 553 $ */ class Exception { private: /** * Source file the exception was thrown in. */ char * file; /** * Line number in the source file the exception was thrown in. */ unsigned int line; /** * Textual description of the exception. */ char * description; /** * Numerical error code. */ int code; /** * Initalize the object. * * @param file the source file the exception was thrown in. * @param line the line in the source file. * @param description textual description of the exception. * @param code numerical error code. */ void init ( const char * file, unsigned int line, const char * description, int code ) throw (); /** * De-initalize the object. */ void strip () throw (); protected: public: /** * Default constructor. */ inline Exception ( void ) throw () { init( 0, 0, 0, 0); } /** * Copy constructor. */ inline Exception ( const Exception & e ) throw () { init( e.file, e.line, e.description, e.code); } /** * Construct by a description and error code. * * @param description textual description of the exception. * @param code numerical error code. */ inline Exception ( const char * description, int code = 0 ) throw () { init( 0, 0, description, code); } /** * Construct by source file information, a description and error code. * * @param file the source file the exception was thrown in. * @param line the line in the source file. * @param description textual description of the exception. * @param code numerical error code. */ inline Exception ( const char * file, unsigned int line, const char * description = 0, int code = 0 ) throw () { init( file, line, description, code); } /** * Construct by source file information, a description and error code. * The description is constructed from two strings, any of which * may be NULL. * * @param file the source file the exception was thrown in. * @param line the line in the source file. * @param description1 textual description of the exception part 1. * @param description2 textual description of the exception part 2. * @param code numerical error code. */ Exception ( const char * file, unsigned int line, const char * description1, const char * description2, int code = 0 ) throw (); /** * Construct by source file information, a description and error code. * The description is constructed from three strings, any of * which may be NULL. * * @param file the source file the exception was thrown in. * @param line the line in the source file. * @param description1 textual description of the exception part 1. * @param description2 textual description of the exception part 2. * @param description3 textual description of the exception part 3. * @param code numerical error code. */ Exception ( const char * file, unsigned int line, const char * description1, const char * description2, const char * description3, int code = 0 ) throw (); /** * Desctructor. */ inline ~Exception ( void ) throw () { strip(); } /** * Assignment operator. * * @param e the Exception to assign this to. * @return a reference to this Exception. */ inline Exception & operator= ( const Exception & e ) throw () { if ( this != &e ) { strip(); init( e.file, e.line, e.description, e.code); } return *this; } /** * Return the textual description of the Exception. * * @return the textual description of the Exception. */ inline const char * getDescription( void ) const throw () { return description; } /** * Return the line number in the source file this Exception was * thrown in. * * @return the line number in the source file this Exception was * thrown in. */ inline unsigned int getLine ( void ) const throw () { return line; } /** * Return the source file this Exception was thrown in. * * @return the source file this Exception was thrown in. */ inline const char * getFile ( void ) const throw () { return file; } /** * Return the numerical code of the Exception. * * @return the numerical code of the Exception. */ inline int getCode ( void ) const throw () { return code; } }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ /** * Print an Exception to an ostream. * * @param os the output stream to print to. * @param e the Exception to print. * @return a reference to the supplied output stream. */ inline std::ostream & operator<< ( std::ostream & os, const Exception & e ) { os << e.getFile() << ":" << e.getLine() << ": " << e.getDescription() << " [" << e.getCode() << "]"; return os; } #endif /* EXCEPTION_H */ darkice-1.2/src/AudioSource.h0000644000175000017500000002324712170706662013100 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : AudioSource.h Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/AudioSource.h $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef AUDIO_SOURCE_H #define AUDIO_SOURCE_H #ifndef __cplusplus #error This is a C++ include file #endif #ifdef HAVE_CONFIG_H #include "config.h" #endif /* ============================================================ include files */ #include "Source.h" #include "Reporter.h" /* ================================================================ constants */ /* =================================================================== macros */ /*------------------------------------------------------------------------------ * Determine the kind of audio device based on the system *----------------------------------------------------------------------------*/ #if defined( HAVE_ALSA_LIB ) // we have an ALSA sound system available #define SUPPORT_ALSA_DSP 1 #endif #if defined( HAVE_PULSEAUDIO_LIB ) // we have an PULSEAUDIO sound system available #define SUPPORT_PULSEAUDIO_DSP 1 #endif #if defined( HAVE_SYS_SOUNDCARD_H ) // we have an OSS DSP sound source device available #define SUPPORT_OSS_DSP 1 #endif #if defined( HAVE_SYS_AUDIO_H ) || defined( HAVE_SYS_AUDIOIO_H ) // we have a Solaris DSP sound device available (same for OpenBSD) #define SUPPORT_SOLARIS_DSP 1 #endif #if defined( HAVE_JACK_LIB ) // we have JACK audio server #define SUPPORT_JACK_DSP 1 #endif #if defined ( HAVE_TERMIOS_H ) #define SUPPORT_SERIAL_ULAW 1 #endif #if !defined( SUPPORT_ALSA_DSP ) \ && !defined( SUPPORT_PULSEAUDIO_DSP ) \ && !defined( SUPPORT_OSS_DSP ) \ && !defined( SUPPORT_JACK_DSP ) \ && !defined( SUPPORT_SOLARIS_DSP ) \ && !defined( SUPPORT_SERIAL_ULAW) // there was no DSP audio system found #error No DSP audio input device found on system #endif /* =============================================================== data types */ /** * Audio data input * * @author $Author: rafael@riseup.net $ * @version $Revision: 553 $ */ class AudioSource : public Source, public virtual Reporter { private: /** * Number of channels of the audio source * (e.g. 1 for mono, 2 for stereo, etc.) */ unsigned int channel; /** * Samples per second (e.g. 44100 for 44.1kHz CD quality) */ unsigned int sampleRate; /** * Bits per sample (e.g. 8 bits, 16 bits, etc.) */ unsigned int bitsPerSample; /** * Initialize the object. * * @param sampleRate samples per second. * @param bitsPerSample bits per sample. * @param channel number of channels of the audio source. * @exception Exception */ inline void init ( unsigned int sampleRate, unsigned int bitsPerSample, unsigned int channel ) throw ( Exception ) { this->sampleRate = sampleRate; this->bitsPerSample = bitsPerSample; this->channel = channel; } /** * De-initialize the object. * * @exception Exception */ inline void strip ( void ) throw ( Exception ) { } protected: /** * Constructor. * Because all values have defaults, this is also the default * constructor. * * @param sampleRate samples per second (e.g. 44100 for 44.1kHz). * @param bitsPerSample bits per sample (e.g. 16 bits). * @param channel number of channels of the audio source * (e.g. 1 for mono, 2 for stereo, etc.). * @exception Exception */ inline AudioSource ( unsigned int sampleRate = 44100, unsigned int bitsPerSample = 16, unsigned int channel = 2 ) throw ( Exception ) { init ( sampleRate, bitsPerSample, channel); } /** * Copy Constructor. * * @param as the object to copy. * @exception Exception */ inline AudioSource ( const AudioSource & as ) throw ( Exception ) : Source( as ) { init ( as.sampleRate, as.bitsPerSample, as.channel); } /** * Assignment operator. * * @param as the object to assign to this one. * @return a reference to this object. * @exception Exception */ inline virtual AudioSource & operator= ( const AudioSource & as ) throw ( Exception ) { if ( this != &as ) { strip(); Source::operator=( as ); init ( as.sampleRate, as.bitsPerSample, as.channel); } return *this; } public: /** * Destructor. * * @exception Exception */ virtual inline ~AudioSource ( void ) throw ( Exception ) { } /** * Get the number of channels for this AudioSource. * * @return the number of channels. */ inline unsigned int getChannel ( void ) const throw () { return channel; } /** * Tell if the data from this source comes in big or little endian. * * @return true if the data is big endian, false if little endian */ virtual bool isBigEndian ( void ) const throw () { #ifdef WORDS_BIGENDIAN return true; #else return false; #endif } /** * Get the sample rate per seconds for this AudioSource. * * @return the sample rate per seconds. */ inline unsigned int getSampleRate ( void ) const throw () { return sampleRate; } /** * Get the number of bits per sample for this AudioSource. * * @return the number of bits per sample. */ inline unsigned int getBitsPerSample ( void ) const throw () { return bitsPerSample; } /** * Get the number of bytes for a sample for each channel * (returns 4 bytes for 16 bits par sample in stereo) * * @return the number of bits per sample. */ inline unsigned int getSampleSize ( void ) const throw () { return bitsPerSample / 8 * channel; } /** * Factory method for creating an AudioSource object of the * appropriate type, based on the compiled DSP support and * the supplied DSP name parameter. * * @param deviceName the audio device (/dev/dspX, hwplug:0,0, etc) * @param jackClientName the source name for jack server * @param paSourceName the pulse audio source * @param sampleRate samples per second (e.g. 44100 for 44.1kHz). * @param bitsPerSample bits per sample (e.g. 16 bits). * @param channel number of channels of the audio source * (e.g. 1 for mono, 2 for stereo, etc.). * @exception Exception */ static AudioSource * createDspSource( const char * deviceName, const char * jackClientName, const char * paSourceName, int sampleRate = 44100, int bitsPerSample = 16, int channel = 2) throw ( Exception ); }; /* ================================================= external data structures */ /*------------------------------------------------------------------------------ * Determine the kind of audio device based on the system *----------------------------------------------------------------------------*/ #if defined( SUPPORT_ALSA_DSP ) #include "AlsaDspSource.h" #endif #if defined( SUPPORT_PULSEAUDIO_DSP ) #include "PulseAudioDspSource.h" #endif #if defined( SUPPORT_OSS_DSP ) #include "OssDspSource.h" #endif #if defined( SUPPORT_SOLARIS_DSP ) #include "SolarisDspSource.h" #endif #if defined( SUPPORT_JACK_DSP ) #include "JackDspSource.h" #endif #if defined ( SUPPORT_SERIAL_ULAW ) #include "SerialUlaw.h" #endif /* ====================================================== function prototypes */ #endif /* AUDIO_SOURCE_H */ darkice-1.2/src/TcpSocket.cpp0000644000175000017500000002470112170706662013104 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : TcpSocket.cpp Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/TcpSocket.cpp $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_STRING_H #include #else #error need string.h #endif #ifdef HAVE_SYS_TYPES_H #include #else #error need sys/types.h #endif #ifdef HAVE_ERRNO_H #include #else #error need errno.h #endif #ifdef HAVE_SYS_SOCKET_H #include #else #error need sys/socket.h #endif #ifdef HAVE_NETINET_IN_H #include #else #error need netinet/in.h #endif #ifdef HAVE_NETDB_H #include #else #error need netdb.h #endif #ifdef HAVE_UNISTD_H #include #else #error need unistd.h #endif #ifdef HAVE_SYS_TIME_H #include #else #error need sys/time.h #endif #ifdef HAVE_SIGNAL_H #include #else #error need signal.h #endif #include "Util.h" #include "Exception.h" #include "TcpSocket.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: TcpSocket.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $"; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Initialize the object *----------------------------------------------------------------------------*/ void TcpSocket :: init ( const char * host, unsigned short port ) throw ( Exception ) { this->host = Util::strDup( host); this->port = port; this->sockfd = 0; } /*------------------------------------------------------------------------------ * De-initialize the object *----------------------------------------------------------------------------*/ void TcpSocket :: strip ( void) throw ( Exception ) { if ( isOpen() ) { close(); } delete[] host; } /*------------------------------------------------------------------------------ * Copy Constructor *----------------------------------------------------------------------------*/ TcpSocket :: TcpSocket ( const TcpSocket & ss ) throw ( Exception ) : Source( ss), Sink( ss ) { int fd; init( ss.host, ss.port); if ( (fd = ss.sockfd ? dup( ss.sockfd) : 0) == -1 ) { strip(); throw Exception( __FILE__, __LINE__, "dup failure"); } sockfd = fd; } /*------------------------------------------------------------------------------ * Assignment operator *----------------------------------------------------------------------------*/ TcpSocket & TcpSocket :: operator= ( const TcpSocket & ss ) throw ( Exception ) { if ( this != &ss ) { int fd; /* first strip */ strip(); /* then build up */ Sink::operator=( ss ); Source::operator=( ss ); init( ss.host, ss.port); if ( (fd = ss.sockfd ? dup( ss.sockfd) : 0) == -1 ) { strip(); throw Exception( __FILE__, __LINE__, "dup failure"); } sockfd = fd; } return *this; } /*------------------------------------------------------------------------------ * Open the file *----------------------------------------------------------------------------*/ bool TcpSocket :: open ( void ) throw ( Exception ) { int optval; socklen_t optlen; #ifdef HAVE_ADDRINFO struct addrinfo hints struct addrinfo * ptr; struct sockaddr_storage addr; char portstr[6]; #else struct sockaddr_in addr; struct hostent * pHostEntry; #endif if ( isOpen() ) { return false; } #ifdef HAVE_ADDRINFO memset(&hints, 0, sizeof(hints)); hints.ai_socktype = SOCK_STREAM; hints.ai_family = AF_ANY; snprintf(portstr, sizeof(portstr), "%d", port); if (getaddrinfo(host , portstr, &hints, &ptr)) { sockfd = 0; throw Exception( __FILE__, __LINE__, "getaddrinfo error", errno); } memcpy ( addr, ptr->ai_addr, ptr->ai_addrlen); freeaddrinfo(ptr); #else if ( !(pHostEntry = gethostbyname( host)) ) { sockfd = 0; throw Exception( __FILE__, __LINE__, "gethostbyname error", errno); } memset( &addr, 0, sizeof(addr)); addr.sin_family = AF_INET; addr.sin_port = htons(port); addr.sin_addr.s_addr = *((long*) pHostEntry->h_addr_list[0]); #endif if ( (sockfd = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1 ) { sockfd = 0; throw Exception( __FILE__, __LINE__, "socket error", errno); } // set TCP keep-alive optval = 1; optlen = sizeof(optval); if (setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, &optval, optlen) == -1) { reportEvent(5, "can't set TCP socket keep-alive mode", errno); } // connect if ( connect( sockfd, (struct sockaddr*)&addr, sizeof(addr)) == -1 ) { ::close( sockfd); sockfd = 0; throw Exception( __FILE__, __LINE__, "connect error", errno); } return true; } /*------------------------------------------------------------------------------ * Check wether read() would return anything *----------------------------------------------------------------------------*/ bool TcpSocket :: canRead ( unsigned int sec, unsigned int usec ) throw ( Exception ) { fd_set fdset; struct timespec timespec; sigset_t sigset; int ret; if ( !isOpen() ) { return false; } FD_ZERO( &fdset); FD_SET( sockfd, &fdset); timespec.tv_sec = sec; timespec.tv_nsec = usec * 1000L; // mask out SIGUSR1, as we're expecting that signal for other reasons sigemptyset(&sigset); sigaddset(&sigset, SIGUSR1); ret = pselect( sockfd + 1, &fdset, NULL, NULL, ×pec, &sigset); if ( ret == -1 ) { ::close( sockfd); sockfd = 0; throw Exception( __FILE__, __LINE__, "select error"); } return ret > 0; } /*------------------------------------------------------------------------------ * Read from the socket *----------------------------------------------------------------------------*/ unsigned int TcpSocket :: read ( void * buf, unsigned int len ) throw ( Exception ) { int ret; if ( !isOpen() ) { return 0; } ret = recv( sockfd, buf, len, 0); if ( ret == -1 ) { switch (errno) { case ECONNRESET: // re-open the socket if it has been reset by the peer close(); Util::sleep(1L, 0L); open(); break; default: ::close( sockfd); sockfd = 0; throw Exception( __FILE__, __LINE__, "recv error", errno); } } return ret; } /*------------------------------------------------------------------------------ * Check wether read() would return anything *----------------------------------------------------------------------------*/ bool TcpSocket :: canWrite ( unsigned int sec, unsigned int usec ) throw ( Exception ) { fd_set fdset; struct timespec timespec; sigset_t sigset; int ret; if ( !isOpen() ) { return false; } FD_ZERO( &fdset); FD_SET( sockfd, &fdset); timespec.tv_sec = sec; timespec.tv_nsec = usec * 1000L; // mask out SIGUSR1, as we're expecting that signal for other reasons sigemptyset(&sigset); sigaddset(&sigset, SIGUSR1); ret = pselect( sockfd + 1, NULL, &fdset, NULL, ×pec, &sigset); if ( ret == -1 ) { ::close( sockfd); sockfd = 0; throw Exception( __FILE__, __LINE__, "select error"); } return ret > 0; } /*------------------------------------------------------------------------------ * Write to the socket *----------------------------------------------------------------------------*/ unsigned int TcpSocket :: write ( const void * buf, unsigned int len ) throw ( Exception ) { int ret; if ( !isOpen() ) { return 0; } #ifdef HAVE_MSG_NOSIGNAL ret = send( sockfd, buf, len, MSG_NOSIGNAL); #else ret = send( sockfd, buf, len, 0); #endif if ( ret == -1 ) { if ( errno == EAGAIN ) { ret = 0; } else { ::close( sockfd); sockfd = 0; throw Exception( __FILE__, __LINE__, "send error", errno); } } return ret; } /*------------------------------------------------------------------------------ * Close the socket *----------------------------------------------------------------------------*/ void TcpSocket :: close ( void ) throw ( Exception ) { if ( !isOpen() ) { return; } flush(); ::close( sockfd); sockfd = 0; } darkice-1.2/src/Exception.cpp0000644000175000017500000001320112170706662013134 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : Exception.cpp Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/Exception.cpp $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_STRING_H #include #else #error need string.h #endif #include "Exception.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: Exception.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $"; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Constructor *----------------------------------------------------------------------------*/ Exception :: Exception ( const char * file, unsigned int line, const char * description1, const char * description2, int code ) throw () { size_t len = 0; if ( description1 ) { len += strlen( description1); } if ( description2 ) { len += strlen( description2); } if ( len ) { char * str = new char[len+1]; str[0] = '\0'; if ( description1 ) { strcat( str, description1); } if ( description2 ) { strcat( str, description2); } init( file, line, str, code); delete[] str; } else { init( file, line, 0, code); } } /*------------------------------------------------------------------------------ * Constructor *----------------------------------------------------------------------------*/ Exception :: Exception ( const char * file, unsigned int line, const char * description1, const char * description2, const char * description3, int code ) throw () { size_t len = 0; if ( description1 ) { len += strlen( description1); } if ( description2 ) { len += strlen( description2); } if ( description3 ) { len += strlen( description3); } if ( len ) { char * str = new char[len+1]; str[0] = '\0'; if ( description1 ) { strcat( str, description1); } if ( description2 ) { strcat( str, description2); } if ( description3 ) { strcat( str, description3); } init( file, line, str, code); delete[] str; } else { init( file, line, 0, code); } } /*------------------------------------------------------------------------------ * Initialize the class *----------------------------------------------------------------------------*/ void Exception :: init ( const char * file, unsigned int line, const char * description = 0, int code = 0 ) throw () { if ( !file ) { this->file = 0; } else { size_t len; len = strlen( file ) + 1; this->file = new char[len]; if ( this->file ) { memcpy( this->file, file, len); } } if ( !description ) { this->description = 0; } else { size_t len; len = strlen( description ) + 1; this->description = new char[len]; if ( this->description ) { memcpy( this->description, description, len); } } this->line = line; this->code = code; } /*------------------------------------------------------------------------------ * De-initialize the class *----------------------------------------------------------------------------*/ void Exception :: strip ( void ) throw () { if ( description ) { delete[] description; } if ( file ) { delete[] file; } } darkice-1.2/src/aflibDebug.h0000644000175000017500000000744212170706611012673 00000000000000 /* Copyright (C) 2000 Stefan Westerfeld stefan@space.twc.de This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Some inspiration taken from glib. Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald Modified by the GLib Team and others 1997-1999. */ #ifndef _AFLIBDEBUG_H_ #define _AFLIBDEBUG_H_ /* * BC - Status (2000-09-30): Debug. * * Collection class, no instance, no members. Thus binary compatible (will * be kept). */ #define aflib_fatal ::aflibDebug::fatal #define aflib_warning ::aflibDebug::warning #define aflib_info ::aflibDebug::info #define aflib_debug ::aflibDebug::debug /* source compatibility with older sources */ #define aflibdebug ::aflibDebug::debug #define setaflibdebug(x) aflib_warning("setaflibdebug is obsolete") #ifdef __GNUC__ #define aflib_return_if_fail(expr) \ if (!(expr)) \ { \ aflib_warning ("file %s: line %d (%s): assertion failed: (%s)", \ __FILE__, __LINE__, __PRETTY_FUNCTION__, #expr); \ return; \ } #define aflib_return_val_if_fail(expr,val) \ if (!(expr)) \ { \ aflib_warning ("file %s: line %d (%s): assertion failed: (%s)", \ __FILE__, __LINE__, __PRETTY_FUNCTION__, #expr); \ return (val); \ } #define aflib_assert(expr) \ if (!(expr)) \ aflib_fatal ("file %s: line %d (%s): assertion failed: (%s)", \ __FILE__, __LINE__, __PRETTY_FUNCTION__, #expr); \ #else #define aflib_return_if_fail(expr) \ if (!(expr)) \ { \ aflib_warning ("file %s: line %d: assertion failed: (%s)", \ __FILE__, __LINE__, #expr); \ return; \ } #define aflib_return_val_if_fail(expr,val) \ if (!(expr)) \ { \ aflib_warning ("file %s: line %d: assertion failed: (%s)", \ __FILE__, __LINE__, #expr); \ return (val); \ } #define aflib_assert(expr) \ if (!(expr)) \ aflib_fatal ("file %s: line %d: assertion failed: (%s)", \ __FILE__, __LINE__, #expr); \ #endif class aflibDebug { public: enum Level { lFatal = 3, lWarning = 2, lInfo = 1, lDebug = 0 }; /** * Initializes at which is the minimum level to react to. If you * call this, call this before creating the Arts::Dispatcher object. */ static void init(const char *prefix, Level level); static void fatal(const char *fmt,...); // print on stderr & abort static void warning(const char *fmt,...); // print on stderr static void info(const char *fmt,...); // print on stdout static void debug(const char *fmt,...); // print on stdout /** * This method sets the name of an external application to * display messages graphically. */ static void messageApp(const char *appName); }; #endif darkice-1.2/src/MultiThreadedConnector.h0000644000175000017500000002650412170706662015263 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : MultiThreadedConnector.h Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/MultiThreadedConnector.h $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef MULTI_THREADED_CONNECTOR_H #define MULTI_THREADED_CONNECTOR_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif // check for __NetBSD__ because it won't be found by AC_CHECK_HEADER on NetBSD // as pthread.h is in /usr/pkg/include, not /usr/include #if defined( HAVE_PTHREAD_H ) || defined( __NetBSD__ ) #include #else #error need pthread.h #endif #include "Referable.h" #include "Ref.h" #include "Reporter.h" #include "Source.h" #include "Sink.h" #include "Connector.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * Connects a source to one or more sinks, using a multi-threaded * producer - consumer approach. * * @author $Author: rafael@riseup.net $ * @version $Revision: 553 $ */ class MultiThreadedConnector : public virtual Connector { private: /** * Helper class to collect information for starting threads. */ class ThreadData { public: /** * The connector starting the thread */ MultiThreadedConnector * connector; /** * The index of the sink this thread writes to. */ unsigned int ixSink; /** * The POSIX thread itself. */ pthread_t thread; /** * Marks if the thread is accepting data. */ bool accepting; /** * Marks if the thread has processed the last batch * of data. */ bool isDone; /** * A flag to show that the sink should be made to cut in the * next iteration. */ bool cut; /** * Default constructor. */ inline ThreadData() { this->connector = 0; this->ixSink = 0; this->thread = 0; this->accepting = false; this->isDone = false; this->cut = false; } /** * The thread function. * * @param param thread parameter, a pointer to a * ThreadData * @return nothing */ static void * threadFunction( void * param ); }; /** * The mutex of this object. */ pthread_mutex_t mutexProduce; /** * The conditional variable for presenting new data. */ pthread_cond_t condProduce; /** * The thread attributes. */ pthread_attr_t threadAttr; /** * The threads for the sinks. */ ThreadData * threads; /** * Signal if we're running or not, so the threads no if to stop. */ bool running; /** * Flag to show if the connector should try to reconnect if * the connection is dropped on the other side. */ bool reconnect; /** * The buffer of information presented to each thread. */ unsigned char * dataBuffer; /** * The amount of information presented to each thread. */ unsigned int dataSize; /** * Initialize the object. * * @param reconnect flag to indicate if the connector should * try to reconnect if the connection was * dropped by the other end * @exception Exception */ void init ( bool reconnect ) throw ( Exception ); /** * De-initialize the object. * * @exception Exception */ void strip ( void ) throw ( Exception ); protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline MultiThreadedConnector ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } public: /** * Constructor based on a Source. * * @param source the source to connect to the sinks. * @param reconnect flag to indicate if the connector should * try to reconnect if the connection was * dropped by the other end * @exception Exception */ inline MultiThreadedConnector ( Source * source, bool reconnect ) throw ( Exception ) : Connector( source ) { init(reconnect); } /** * Constructor based on a Source and a Sink. * * @param source the source to connect to the sinks. * @param sink a sink to connect to the source. * @param reconnect flag to indicate if the connector should * try to reconnect if the connection was * dropped by the other end * @exception Exception */ inline MultiThreadedConnector ( Source * source, Sink * sink, bool reconnect ) throw ( Exception ) : Connector( source, sink) { init(reconnect); } /** * Copy constructor. * * @param connector the object to copy. * @exception Exception */ MultiThreadedConnector ( const MultiThreadedConnector & connector ) throw ( Exception ); /** * Destructor. * * @exception Exception */ inline virtual ~MultiThreadedConnector( void ) throw ( Exception ) { strip(); } /** * Assignment operator. * * @param connector the object to assign to this one. * @return a reference to this object. * @exception Exception */ virtual MultiThreadedConnector & operator= ( const MultiThreadedConnector & connector ) throw ( Exception ); /** * Open the connector. Opens the Source and the Sinks if necessary. * * @return true if opening was successful, false otherwise. * @exception Exception */ virtual bool open ( void ) throw ( Exception ); /** * Transfer a given amount of data from the Source to all the * Sinks attached. * If an attached Sink closes or encounteres an error during the * process, it is detached and the function carries on with the * rest of the Sinks. If no Sinks remain, or an error is encountered * with the Source, the function returns prematurely. * * @param bytes the amount of data to transfer, in bytes. * If 0, transfer forever. * @param bufSize the size of the buffer to use for transfering. * This amount of data is read from the Source and * written to each Sink on each turn. * @param sec the number of seconds to wait for the Source to have * data available in each turn, and the number of seconds * to wait for the Sinks to accept data. * @param usec the number of micros seconds to wait for the Source to * have data available in each turn, and the number of * micro seconds to wait for the Sinks to accept data. * @return the number of bytes read from the Source. * @exception Exception */ virtual unsigned int transfer ( unsigned long bytes, unsigned int bufSize, unsigned int sec, unsigned int usec ) throw ( Exception ); /** * Signal to each sink we have that they need to cut what they are * doing, and start again. For FileSinks, this usually means to * save the archive file recorded so far, and start a new archive * file. */ virtual void cut ( void ) throw (); /** * Close the Connector. The Source and all Sinks are closed. * * @exception Exception */ virtual void close ( void ) throw ( Exception ); /** * This is the worker function for each thread. * This function has to return fast * * @param ixSink the index of the sink this thread works on. */ void sinkThread( int ixSink ); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* MULTI_THREADED_CONNECTOR_H */ darkice-1.2/src/DarkIceConfig.h0000644000175000017500000001277312170706662013310 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell Config File : DarkIceConfig.h Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/DarkIceConfig.h $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef CONFIG_H #define CONFIG_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include #include #include #include "Referable.h" #include "ConfigSection.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * A configuration file representation. The file is of the syntax: * *
 *  [section1]
 *  # this is a whole line comment
 *  key = value
 *  an ugly key name = long value    # this end is a comment too
 *
 *  [section2]
 *  # this is a whole line comment in section 2
 *  key = value
 *  an ugly key name = long value    # this end is a comment too
 *  
* * also empty lines are ignored and all white space is removed * from the front and end of keys / values * * Knwon problem: you can't use '#' in any part of a key / value pair * * @author $Author: rafael@riseup.net $ * @version $Revision: 553 $ */ class Config : public virtual Referable { private: /** * Type declaration of the hash table type. */ typedef std::map TableType; /** * Hash table holding the configuration sections. * * @see ConfigSection */ TableType table; /** * Hash table holding the configuration sections. * * @see ConfigSection */ std::string currentSection; protected: public: /** * Default constructor. * * @exception Exception */ inline Config ( void ) throw ( Exception ) { } /** * Constructor based on an input stream. * * @param is configuration will be read from this input stream * until end of stream is reached. * @exception Exception */ inline Config ( std::istream & is ) throw ( Exception ) { read( is ); } /** * Destructor. * * @exception Exception */ inline virtual ~Config ( void ) throw ( Exception ) { } /* TODO inline Config ( const Config & di ) throw ( Exception ) { } inline Config & operator= ( const Config * di ) throw ( Exception ) { } */ /** * Delete the configuration information stored in the object. * Resets the object to a clean state. * * @exception Exception */ inline virtual void reset ( void ) throw ( Exception ) { table.clear(); currentSection = ""; } /** * Read a line of confiugration information. * * @param line the line to read. * @return true if the line was correct, false otherwise. * @exception Exception */ virtual bool addLine ( const char * line ) throw ( Exception ); /** * Read a line of confiugration information. * * @param is the input stream to read from * @return true if the line was correct, false otherwise. * @exception Exception */ virtual void read ( std::istream & is ) throw ( Exception ); /** * Get a ConfigSection by name. * * @param key the name of the ConfigSection * @return the ConfigSection requested, or NULL if it doesn't exists. * @exception Exception */ virtual const ConfigSection * get ( const char * key ) const throw ( Exception ); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* CONFIG_H */ darkice-1.2/src/VorbisLibEncoder.h0000644000175000017500000003372312170706662014051 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : VorbisLibEncoder.h Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/VorbisLibEncoder.h $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef VORBIS_LIB_ENCODER_H #define VORBIS_LIB_ENCODER_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_VORBIS_LIB #include #else #error configure for Ogg Vorbis #endif #include "Ref.h" #include "Exception.h" #include "Reporter.h" #include "AudioEncoder.h" #include "CastSink.h" #ifdef HAVE_SRC_LIB #include #else #include "aflibConverter.h" #endif /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * A class representing the ogg vorbis encoder linked as a shared object or * as a static library. * * @author $Author: rafael@riseup.net $ * @version $Revision: 553 $ */ class VorbisLibEncoder : public AudioEncoder, public virtual Reporter { private: /** * Value indicating if the encoding process is going on */ bool encoderOpen; /** * Ogg Vorbis library global info */ vorbis_info vorbisInfo; /** * Ogg Vorbis library global DSP state */ vorbis_dsp_state vorbisDspState; /** * Ogg Vorbis library global block */ vorbis_block vorbisBlock; /** * Ogg Vorbis library global comment */ vorbis_comment vorbisComment; /** * Ogg library global stream state */ ogg_stream_state oggStreamState; /** * Maximum bitrate of the output in kbits/sec. If 0, don't care. */ unsigned int outMaxBitrate; /** * Resample ratio */ double resampleRatio; /** * sample rate converter object for possible resampling */ #ifdef HAVE_SRC_LIB SRC_STATE * converter; SRC_DATA converterData; #else aflibConverter * converter; #endif /** * Initialize the object. * * @param the maximum bit rate * @exception Exception */ void init ( unsigned int outMaxBitrate ) throw ( Exception ); /** * De-initialize the object. * * @exception Exception */ inline void strip ( void ) throw ( Exception ) { if ( converter ) { #ifdef HAVE_SRC_LIB delete [] converterData.data_in; delete [] converterData.data_out; src_delete (converter); #else delete converter; #endif } } /** * Send pending Vorbis blocks to the underlying stream */ void vorbisBlocksOut( void ) throw ( Exception ); protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline VorbisLibEncoder ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } public: /** * Constructor. * * @param sink the sink to send encoded output to * @param inSampleRate sample rate of the input. * @param inBitsPerSample number of bits per sample of the input. * @param inChannel number of channels of the input. * @param inBigEndian shows if the input is big or little endian * @param outBitrateMode the bit rate mode of the output. * @param outBitrate bit rate of the output (kbits/sec). * @param outQuality the quality of the stream. * @param outSampleRate sample rate of the output. * If 0, inSampleRate is used. * @param outMaxBitrate maximum output bitrate. * 0 if not used. * @param outChannel number of channels of the output. * If 0, inChannel is used. * @exception Exception */ inline VorbisLibEncoder ( CastSink * sink, unsigned int inSampleRate, unsigned int inBitsPerSample, unsigned int inChannel, bool inBigEndian, BitrateMode outBitrateMode, unsigned int outBitrate, double outQuality, unsigned int outSampleRate = 0, unsigned int outChannel = 0, unsigned int outMaxBitrate = 0 ) throw ( Exception ) : AudioEncoder ( sink, inSampleRate, inBitsPerSample, inChannel, inBigEndian, outBitrateMode, outBitrate, outQuality, outSampleRate, outChannel ) { init( outMaxBitrate); } /** * Constructor. * * @param sink the sink to send encoded output to * @param as get input sample rate, bits per sample and channels * from this AudioSource. * @param outBitrateMode the bit rate mode of the output. * @param outBitrate bit rate of the output (kbits/sec). * @param outQuality the quality of the stream. * @param outSampleRate sample rate of the output. * If 0, input sample rate is used. * @param outMaxBitrate maximum output bitrate. * 0 if not used. * @param outChannel number of channels of the output. * If 0, input channel is used. * @exception Exception */ inline VorbisLibEncoder ( CastSink * sink, const AudioSource * as, BitrateMode outBitrateMode, unsigned int outBitrate, double outQuality, unsigned int outSampleRate = 0, unsigned int outChannel = 0, unsigned int outMaxBitrate = 0 ) throw ( Exception ) : AudioEncoder ( sink, as, outBitrateMode, outBitrate, outQuality, outSampleRate, outChannel ) { init( outMaxBitrate); } /** * Copy constructor. * * @param encoder the VorbisLibEncoder to copy. */ inline VorbisLibEncoder ( const VorbisLibEncoder & encoder ) throw ( Exception ) : AudioEncoder( encoder ) { if( encoder.isOpen() ) { throw Exception(__FILE__, __LINE__, "don't copy open encoders"); } init( encoder.getOutMaxBitrate() ); } /** * Destructor. * * @exception Exception */ inline virtual ~VorbisLibEncoder ( void ) throw ( Exception ) { if ( isOpen() ) { close(); } strip(); } /** * Assignment operator. * * @param encoder the VorbisLibEncoder to assign this to. * @return a reference to this VorbisLibEncoder. * @exception Exception */ inline virtual VorbisLibEncoder & operator= ( const VorbisLibEncoder & encoder ) throw ( Exception ) { if( encoder.isOpen() ) { throw Exception(__FILE__, __LINE__, "don't copy open encoders"); } if ( this != &encoder ) { strip(); AudioEncoder::operator=( encoder); init( encoder.getOutMaxBitrate() ); } return *this; } /** * Get the maximum bit rate of the output in kbits/sec, * for fixed / average bitrate encodings. * * @return the maximum bit rate of the output, or 0 if not set. */ inline unsigned int getOutMaxBitrate ( void ) const throw () { return outMaxBitrate; } /** * Check wether encoding is in progress. * * @return true if encoding is in progress, false otherwise. */ inline virtual bool isRunning ( void ) const throw () { return isOpen(); } /** * Start encoding. This function returns as soon as possible, * with encoding started in the background. * * @return true if encoding has started, false otherwise. * @exception Exception */ inline virtual bool start ( void ) throw ( Exception ) { return open(); } /** * Stop encoding. Stops the encoding running in the background. * * @exception Exception */ inline virtual void stop ( void ) throw ( Exception ) { return close(); } /** * Open an encoding session. * * @return true if opening was successfull, false otherwise. * @exception Exception */ virtual bool open ( void ) throw ( Exception ); /** * Check if the encoding session is open. * * @return true if the encoding session is open, false otherwise. */ inline virtual bool isOpen ( void ) const throw () { return encoderOpen; } /** * Check if the encoder is ready to accept data. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true if the encoder is ready to accept data, * false otherwise. * @exception Exception */ inline virtual bool canWrite ( unsigned int sec, unsigned int usec ) throw ( Exception ) { if ( !isOpen() ) { return false; } return getSink()->canWrite(sec, usec); } /** * Write data to the encoder. * Buf is expected to be a sequence of big-endian 16 bit values, * with left and right channels interleaved. Len is the number of * bytes, must be a multiple of 4. * * @param buf the data to write. * @param len number of bytes to write from buf. * @return the number of bytes written (may be less than len). * @exception Exception */ virtual unsigned int write ( const void * buf, unsigned int len ) throw ( Exception ); /** * Flush all data that was written to the encoder to the underlying * connection. * * @exception Exception */ virtual void flush ( void ) throw ( Exception ); /** * Close the encoding session. * * @exception Exception */ virtual void close ( void ) throw ( Exception ); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* VORBIS_LIB_ENCODER_H */ darkice-1.2/src/TcpSocket.h0000644000175000017500000002032612170706662012550 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : TcpSocket.h Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/TcpSocket.h $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef TCP_SOCKET_H #define TCP_SOCKET_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include "Source.h" #include "Sink.h" #include "Reporter.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * A TCP network socket * * @author $Author: rafael@riseup.net $ * @version $Revision: 553 $ */ class TcpSocket : public Source, public Sink, public virtual Reporter { private: /** * Name of the host this socket connects to. */ char * host; /** * Port to connect to. */ unsigned short port; /** * Low-level socket descriptor. */ int sockfd; /** * Initialize the object. * * @param host name of the host this socket connects to. * @param port port to connect to. * @exception Exception */ void init ( const char * host, unsigned short port ) throw ( Exception ); /** * De-initialize the object. * * @exception Exception */ void strip ( void ) throw ( Exception ); protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline TcpSocket ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } public: /** * Constructor. * * @param host name of the host this socket connects to. * @param port port to connect to. * @exception Exception */ inline TcpSocket( const char * host, unsigned short port ) throw ( Exception ) { init( host, port); } /** * Copy constructor. * * @param ss the TcpSocket to copy. * @exception Exception */ TcpSocket( const TcpSocket & ss ) throw ( Exception ); /** * Destructor. * * @exception Exception */ inline virtual ~TcpSocket( void ) throw ( Exception ) { strip(); } /** * Assignment operator. * * @param ss the TcpSocket to assign this to. * @return a reference to this TcpSocket. * @exception Exception */ inline virtual TcpSocket & operator= ( const TcpSocket & ss ) throw ( Exception ); /** * Get the host this socket connects to. * * @return the host this socket connects to. */ inline const char * getHost ( void ) const throw () { return host; } /** * Get the port this socket connects to. * * @return the port this socket connects to. */ inline unsigned int getPort ( void ) const throw () { return port; } /** * Open the TcpSocket. * * @return true if opening was successfull, false otherwise. * @exception Exception */ virtual bool open ( void ) throw ( Exception ); /** * Check if the TcpSocket is open. * * @return true if the TcpSocket is open, false otherwise. */ inline virtual bool isOpen ( void ) const throw () { return sockfd != 0; } /** * Check if the TcpScoket can be read from. * Blocks until the specified time for data to be available. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true if the TcpSocket is ready to be read from, * false otherwise. * @exception Exception */ virtual bool canRead ( unsigned int sec, unsigned int usec ) throw ( Exception ); /** * Read from the TcpSocket. * * @param buf the buffer to read into. * @param len the number of bytes to read into buf * @return the number of bytes read (may be less than len). * @exception Exception */ virtual unsigned int read ( void * buf, unsigned int len ) throw ( Exception ); /** * Check if the TcpSocket is ready to accept data. * Blocks until the specified time for data to be available. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true if the TcpSocket is ready to accept data, * false otherwise. * @exception Exception */ virtual bool canWrite ( unsigned int sec, unsigned int usec ) throw ( Exception ); /** * Write data to the TcpSocket. * * @param buf the data to write. * @param len number of bytes to write from buf. * @return the number of bytes written (may be less than len). * @exception Exception */ virtual unsigned int write ( const void * buf, unsigned int len ) throw ( Exception ); /** * Flush all data that was written to the TcpSocket to the underlying * connection. * * @exception Exception */ inline virtual void flush ( void ) throw ( Exception ) { } /** * Cut what the sink has been doing so far, and start anew. * This usually means separating the data sent to the sink up * until now, and start saving a new chunk of data. * * For TcpSocket, this is a no-op. */ inline virtual void cut ( void ) throw () { } /** * Close the TcpSocket. * * @exception Exception */ virtual void close ( void ) throw ( Exception ); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* TCP_SOCKET_H */ darkice-1.2/src/Reporter.h0000644000175000017500000002240412170706662012452 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell Reporter File : Reporter.h Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/Reporter.h $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef REPORTER_H #define REPORTER_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_UNISTD_H #include #else #error need unistd.h #endif #ifdef HAVE_TIME_H #include #else #error need time.h #endif #include #include "Exception.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * Class for reporting events. All objects of this class share * the same verbosity level. Typical usage is to inherit this class * and use the report() function to report events. Only reports * which are of suffucient importance are really reported. * * The default verbosity is 1, and the default ostream is cout. * * Known problems: this class is not thread-safe. * * @author $Author: rafael@riseup.net $ * @version $Revision: 553 $ */ class Reporter { private: /** * Verbosity level shared among all Reporter objects */ static unsigned int verbosity; /** * The output stream to report to. */ static std::ostream * os; /** * Print timestamp for every report only if verbosity level * is above this value. */ static const unsigned int prefixVerbosity = 3; /** * Print a prefix to each report. */ static void printPrefix( void ) throw () { if ( verbosity > prefixVerbosity ) { char str[32]; time_t now; now = time(NULL); strftime( str, 32, "%d-%b-%Y %H:%M:%S ", localtime(&now) ); (*(Reporter::os)) << str; } } protected: public: /** * Destructor. * * @exception Exception */ inline virtual ~Reporter ( void ) throw ( Exception ) { (Reporter::os)->flush(); } /** * Set the verbosity level. This sets the verbosity for all * Reporter objects. * * @param verbosity the new verbosity level. */ static inline void setReportVerbosity ( unsigned int verbosity ) throw () { Reporter::verbosity = verbosity; } /** * Get the verbosity level. * * @return the current verbosity level. */ static inline unsigned int getReportVerbosity ( void ) throw () { return Reporter::verbosity; } /** * Set the output stream to report to. This setting effects all * Reporter objects. * * @param os the output stream */ static inline void setReportOutputStream ( std::ostream & os ) throw () { Reporter::os = &os; } /** * Get the output stream to report to. * * @return the output stream */ static inline std::ostream & getReportOutputStream ( void ) throw () { return *(Reporter::os); } /** * Report an event with a given verbosity. * * @param verbosity the importance of the event, with 0 being * the most important. * @param t the object to report. Must have an * ostream & operator<<( ostream&, const T) * operator overload. */ template static inline void reportEvent ( unsigned int verbosity, const T t ) throw () { if ( Reporter::verbosity >= verbosity ) { printPrefix(); (*(Reporter::os)) << t << std::endl; } } /** * Report an event with a given verbosity. * * @param verbosity the importance of the event, with 0 being * the most important. * @param t the object 1 to report. Must have an * ostream & operator<<( ostream&, const T) * operator overload. * @param u the object 2 to report. Must have an * ostream & operator<<( ostream&, const U) * operator overload. */ template inline void static reportEvent ( unsigned int verbosity, const T t, const U u ) throw () { if ( Reporter::verbosity >= verbosity ) { printPrefix(); (*(Reporter::os)) << t << " " << u << std::endl; } } /** * Report an event with a given verbosity. * * @param verbosity the importance of the event, with 0 being * the most important. * @param t the object 1 to report. Must have an * ostream & operator<<( ostream&, const T) * operator overload. * @param u the object 2 to report. Must have an * ostream & operator<<( ostream&, const U) * operator overload. * @param v the object 3 to report. Must have an * ostream & operator<<( ostream&, const V) * operator overload. */ template static inline void reportEvent ( unsigned int verbosity, const T t, const U u, const V v ) throw () { if ( Reporter::verbosity >= verbosity ) { printPrefix(); (*(Reporter::os)) << t << " " << u << " " << v << std::endl; } } /** * Report an event with a given verbosity. * * @param verbosity the importance of the event, with 0 being * the most important. * @param t the object 1 to report. Must have an * ostream & operator<<( ostream&, const T) * operator overload. * @param u the object 2 to report. Must have an * ostream & operator<<( ostream&, const U) * operator overload. * @param v the object 3 to report. Must have an * ostream & operator<<( ostream&, const V) * operator overload. * @param w the object 4 to report. Must have an * ostream & operator<<( ostream&, const W) * operator overload. */ template static inline void reportEvent ( unsigned int verbosity, const T t, const U u, const V v, const W w ) throw () { if ( Reporter::verbosity >= verbosity ) { printPrefix(); (*(Reporter::os)) << t << " " << u << " " << v << " " << w << std::endl; } } }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* REPORTER_H */ darkice-1.2/src/AlsaDspSource.cpp0000644000175000017500000002105012170706662013707 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Copyright (c) 2004 LS Informationstechnik (LIKE) University of Erlangen Nuremberg All rights reserved. Tyrell DarkIce File : AlsaDspSource.cpp Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/AlsaDspSource.cpp $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #include "AudioSource.h" // compile only if configured for ALSA #ifdef SUPPORT_ALSA_DSP #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "Util.h" #include "Exception.h" #include "AlsaDspSource.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: AlsaDspSource.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $"; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Tell if source id big endian *----------------------------------------------------------------------------*/ bool AlsaDspSource :: isBigEndian ( void ) const throw () { return SND_PCM_FORMAT_S16 == SND_PCM_FORMAT_S16_BE; } /*------------------------------------------------------------------------------ * Initialize the object *----------------------------------------------------------------------------*/ void AlsaDspSource :: init ( const char * name ) throw ( Exception ) { pcmName = Util::strDup( name); captureHandle = 0; bufferTime = 1000000; // Do 1s buffering running = false; } /*------------------------------------------------------------------------------ * De-initialize the object *----------------------------------------------------------------------------*/ void AlsaDspSource :: strip ( void ) throw ( Exception ) { if ( isOpen() ) { close(); } delete[] pcmName; } /*------------------------------------------------------------------------------ * Open the audio source *----------------------------------------------------------------------------*/ bool AlsaDspSource :: open ( void ) throw ( Exception ) { unsigned int u; snd_pcm_format_t format; snd_pcm_hw_params_t *hwParams; if ( isOpen() ) { return false; } switch ( getBitsPerSample() ) { case 8: format = SND_PCM_FORMAT_S8; break; case 16: format = SND_PCM_FORMAT_S16; break; default: return false; } if (snd_pcm_open(&captureHandle, pcmName, SND_PCM_STREAM_CAPTURE, 0) < 0) { captureHandle = 0; return false; } if (snd_pcm_hw_params_malloc(&hwParams) < 0) { close(); throw Exception( __FILE__, __LINE__, "can't alloc hardware "\ "parameter structure"); } if (snd_pcm_hw_params_any(captureHandle, hwParams) < 0) { snd_pcm_hw_params_free(hwParams); close(); throw Exception( __FILE__, __LINE__, "can't initialize hardware "\ "parameter structure"); } if (snd_pcm_hw_params_set_access(captureHandle, hwParams, SND_PCM_ACCESS_RW_INTERLEAVED) < 0) { snd_pcm_hw_params_free(hwParams); close(); throw Exception( __FILE__, __LINE__, "can't set access type"); } if (snd_pcm_hw_params_set_format(captureHandle, hwParams, format) < 0) { snd_pcm_hw_params_free(hwParams); close(); throw Exception( __FILE__, __LINE__, "can't set sample format"); } u = getSampleRate(); if (snd_pcm_hw_params_set_rate_near(captureHandle, hwParams, &u, 0) < 0) { snd_pcm_hw_params_free(hwParams); close(); throw Exception( __FILE__, __LINE__, "can't set sample rate", u); } u = getChannel(); if (snd_pcm_hw_params_set_channels(captureHandle, hwParams, u) < 0) { snd_pcm_hw_params_free(hwParams); close(); throw Exception( __FILE__, __LINE__, "can't set channels", u); } u = 4; if (snd_pcm_hw_params_set_periods_near(captureHandle, hwParams, &u, 0) < 0) { snd_pcm_hw_params_free(hwParams); close(); throw Exception( __FILE__, __LINE__, "can't set interrupt frequency"); } u = getBufferTime(); if (snd_pcm_hw_params_set_buffer_time_near(captureHandle, hwParams, &u, 0) < 0) { snd_pcm_hw_params_free(hwParams); close(); throw Exception( __FILE__, __LINE__, "can't set buffer size"); } if (snd_pcm_hw_params(captureHandle, hwParams) < 0) { snd_pcm_hw_params_free(hwParams); close(); throw Exception( __FILE__, __LINE__, "can't set hardware parameters"); } snd_pcm_hw_params_free(hwParams); if (snd_pcm_prepare(captureHandle) < 0) { close(); throw Exception( __FILE__, __LINE__, "can't prepare audio interface "\ "for use"); } bytesPerFrame = getChannel() * getBitsPerSample() / 8; return true; } /*------------------------------------------------------------------------------ * Check wether read() would return anything *----------------------------------------------------------------------------*/ bool AlsaDspSource :: canRead ( unsigned int sec, unsigned int usec ) throw ( Exception ) { if ( !isOpen() ) { return false; } if ( !running ) { snd_pcm_start(captureHandle); running = true; } /* * FIXME How to check for available frames? It * seems like snd_pcm_wait stops working when * it comes to ALSA plugins... :-( * * int milliDelay = sec * 1000 + usec/1000; * return snd_pcm_wait(captureHandle, milliDelay)!=0; */ return true; // bad!! } /*------------------------------------------------------------------------------ * Read from the audio source *----------------------------------------------------------------------------*/ unsigned int AlsaDspSource :: read ( void * buf, unsigned int len ) throw ( Exception ) { snd_pcm_sframes_t ret; if ( !isOpen() ) { return 0; } do { ret = snd_pcm_readi(captureHandle, buf, len/bytesPerFrame); // Check for buffer overrun if (ret == -EPIPE) { reportEvent(1, "Buffer overrun!"); snd_pcm_prepare(captureHandle); ret = -EAGAIN; } } while (ret == -EAGAIN); if ( ret < 0 ) { throw Exception(__FILE__, __LINE__, snd_strerror(ret)); } running = true; return ret * bytesPerFrame; } /*------------------------------------------------------------------------------ * Close the audio source *----------------------------------------------------------------------------*/ void AlsaDspSource :: close ( void ) throw ( Exception ) { if ( !isOpen() ) { return; } snd_pcm_close(captureHandle); captureHandle = 0; running = false; } #endif // HAVE_ALSA_LIB darkice-1.2/src/FileCast.h0000644000175000017500000001663212170706662012350 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : FileCast.h Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/FileCast.h $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef FILE_CAST_H #define FILE_CAST_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include "Ref.h" #include "Sink.h" #include "CastSink.h" #include "FileSink.h" #include "FileCast.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * Class representing output to a local file. * * @author $Author: rafael@riseup.net $ * @version $Revision: 553 $ */ class FileCast : public CastSink { private: /** * The file to send the encoded data to. */ Ref targetFile; /** * Initalize the object. * * @param targetFile the file to send the encoded data to. * @exception Exception */ inline void init ( FileSink * targetFile ) throw ( Exception ) { this->targetFile = targetFile; } /** * De-initalize the object. * * @exception Exception */ inline void strip ( void ) throw ( Exception ) { if ( isOpen() ) { close(); } } protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline FileCast ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } /** * Log in to the server using the socket avialable. * No need to log in to a file. * * @return true if login was successful, false otherwise. * @exception Exception */ inline virtual bool sendLogin ( void ) throw ( Exception ) { return true; } public: /** * Constructor. * * @param targetFile the file to send all the data to. * @exception Exception */ inline FileCast ( FileSink * targetFile ) throw ( Exception ) : CastSink( 0, 0, 0) { init( targetFile ); } /** * Copy constructor. * * @param cs the FileCast to copy. */ inline FileCast( const FileCast & cs ) throw ( Exception ) { init( targetFile.get() ); } /** * Destructor. * * @exception Exception */ inline virtual ~FileCast( void ) throw ( Exception ) { strip(); } /** * Assignment operator. * * @param cs the FileCast to assign this to. * @return a reference to this FileCast. * @exception Exception */ inline virtual FileCast & operator= ( const FileCast & cs ) throw ( Exception ) { if ( this != &cs ) { strip(); init( targetFile.get() ); } return *this; } /** * Open the FileCast. * * @return true if opening was successfull, false otherwise. * @exception Exception */ virtual bool open ( void ) throw ( Exception ); /** * Check if the FileCast is open. * * @return true if the FileCast is open, false otherwise. */ inline virtual bool isOpen ( void ) const throw () { return targetFile->isOpen(); } /** * Check if the FileCast is ready to accept data. * Blocks until the specified time for data to be available. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true if the FileCast is ready to accept data, * false otherwise. * @exception Exception */ inline virtual bool canWrite ( unsigned int sec, unsigned int usec ) throw ( Exception ) { return targetFile->canWrite( sec, usec); } /** * Write data to the FileCast. * * @param buf the data to write. * @param len number of bytes to write from buf. * @return the number of bytes written (may be less than len). * @exception Exception */ inline virtual unsigned int write ( const void * buf, unsigned int len ) throw ( Exception ) { return targetFile->write( buf, len); } /** * Flush all data that was written to the FileCast to the server. * * @exception Exception */ inline virtual void flush ( void ) throw ( Exception ) { return targetFile->flush(); } /** * Cut what the sink has been doing so far, and start anew. * This usually means separating the data sent to the sink up * until now, and start saving a new chunk of data. */ inline virtual void cut ( void ) throw () { targetFile->cut(); } /** * Close the FileCast. * * @exception Exception */ inline virtual void close ( void ) throw ( Exception ) { return targetFile->close(); } }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* FILE_CAST_H */ darkice-1.2/src/MultiThreadedConnector.cpp0000644000175000017500000003307112170706662015613 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : MultiThreadedConnector.cpp Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/MultiThreadedConnector.cpp $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_SYS_TYPES_H #include #else #error need sys/types.h #endif #include "Exception.h" #include "MultiThreadedConnector.h" #include "Util.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: MultiThreadedConnector.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $"; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Initialize the object *----------------------------------------------------------------------------*/ void MultiThreadedConnector :: init ( bool reconnect ) throw ( Exception ) { this->reconnect = reconnect; pthread_mutex_init( &mutexProduce, 0); pthread_cond_init( &condProduce, 0); threads = 0; } /*------------------------------------------------------------------------------ * De-initialize the object *----------------------------------------------------------------------------*/ void MultiThreadedConnector :: strip ( void ) throw ( Exception ) { if ( threads ) { delete[] threads; threads = 0; } pthread_cond_destroy( &condProduce); pthread_mutex_destroy( &mutexProduce); } /*------------------------------------------------------------------------------ * Constructor *----------------------------------------------------------------------------*/ MultiThreadedConnector :: MultiThreadedConnector ( const MultiThreadedConnector & connector ) throw ( Exception ) : Connector( connector) { reconnect = connector.reconnect; mutexProduce = connector.mutexProduce; condProduce = connector.condProduce; if ( threads ) { delete[] threads; } threads = new ThreadData[numSinks]; for ( unsigned int i = 0; i < numSinks; ++i ) { threads[i] = connector.threads[i]; } } /*------------------------------------------------------------------------------ * Assignment operator *----------------------------------------------------------------------------*/ MultiThreadedConnector & MultiThreadedConnector :: operator= ( const MultiThreadedConnector & connector ) throw ( Exception ) { if ( this != &connector ) { Connector::operator=( connector); reconnect = connector.reconnect; mutexProduce = connector.mutexProduce; condProduce = connector.condProduce; if ( threads ) { delete[] threads; } threads = new ThreadData[numSinks]; for ( unsigned int i = 0; i < numSinks; ++i ) { threads[i] = connector.threads[i]; } } return *this; } /*------------------------------------------------------------------------------ * Open the source and all the sinks if needed * Create the sink threads *----------------------------------------------------------------------------*/ bool MultiThreadedConnector :: open ( void ) throw ( Exception ) { unsigned int i; size_t st; if ( !Connector::open() ) { return false; } running = true; pthread_attr_init( &threadAttr); pthread_attr_getstacksize(&threadAttr, &st); if (st < 128 * 1024) { reportEvent( 5, "MultiThreadedConnector :: open, stack size ", (long)st); st = 128 * 1024; pthread_attr_setstacksize(&threadAttr, st); } pthread_attr_setdetachstate( &threadAttr, PTHREAD_CREATE_JOINABLE); threads = new ThreadData[numSinks]; for ( i = 0; i < numSinks; ++i ) { ThreadData * threadData = threads + i; threadData->connector = this; threadData->ixSink = i; threadData->accepting = true; threadData->isDone = true; if ( pthread_create( &(threadData->thread), &threadAttr, ThreadData::threadFunction, threadData ) ) { break; } } // if could not create all, delete the ones created if ( i < numSinks ) { unsigned int j; // signal to stop for all running threads pthread_mutex_lock( &mutexProduce); running = false; pthread_cond_broadcast( &condProduce); pthread_mutex_unlock( &mutexProduce); for ( j = 0; j < i; ++j ) { pthread_join( threads[j].thread, 0); } delete[] threads; threads = 0; return false; } return true; } /*------------------------------------------------------------------------------ * Transfer some data from the source to the sink *----------------------------------------------------------------------------*/ unsigned int MultiThreadedConnector :: transfer ( unsigned long bytes, unsigned int bufSize, unsigned int sec, unsigned int usec ) throw ( Exception ) { unsigned int b; if ( numSinks == 0 ) { return 0; } if ( bufSize == 0 ) { return 0; } dataBuffer = new unsigned char[bufSize]; dataSize = 0; reportEvent( 6, "MultiThreadedConnector :: tranfer, bytes", bytes); for ( b = 0; !bytes || b < bytes; ) { if ( source->canRead( sec, usec) ) { unsigned int i; pthread_mutex_lock( &mutexProduce); dataSize = source->read( dataBuffer, bufSize); b += dataSize; // check for EOF if ( dataSize == 0 ) { reportEvent( 3, "MultiThreadedConnector :: transfer, EOF"); pthread_mutex_unlock( &mutexProduce); break; } for ( i = 0; i < numSinks; ++i ) { threads[i].isDone = false; } // tell sink threads that there is some data available pthread_cond_broadcast( &condProduce); // wait for all sink threads to get done with this data while ( true ) { for ( i = 0; i < numSinks && threads[i].isDone; ++i ); if ( i == numSinks ) { break; } pthread_cond_wait( &condProduce, &mutexProduce); } pthread_mutex_unlock( &mutexProduce); } else { reportEvent( 3, "MultiThreadedConnector :: transfer, can't read"); break; } } delete[] dataBuffer; return b; } /*------------------------------------------------------------------------------ * The function for each thread. * Read the presented data *----------------------------------------------------------------------------*/ void MultiThreadedConnector :: sinkThread( int ixSink ) { ThreadData * threadData = &threads[ixSink]; Sink * sink = sinks[ixSink].get(); while ( running ) { // wait for some data to become available pthread_mutex_lock( &mutexProduce); while ( running && threadData->isDone ) { pthread_cond_wait( &condProduce, &mutexProduce); } if ( !running ) { pthread_mutex_unlock( &mutexProduce); break; } if ( threadData->cut) { sink->cut(); threadData->cut = false; } if ( threadData->accepting ) { if ( sink->canWrite( 0, 0) ) { try { sink->write( dataBuffer, dataSize); } catch ( Exception & e ) { // something wrong. don't accept more data, try to // reopen the sink next time around threadData->accepting = false; } } else { reportEvent( 4, "MultiThreadedConnector :: sinkThread can't write ", ixSink); // don't care if we can't write } } threadData->isDone = true; pthread_cond_broadcast( &condProduce); pthread_mutex_unlock( &mutexProduce); if ( !threadData->accepting ) { if ( reconnect ) { reportEvent( 4, "MultiThreadedConnector :: sinkThread reconnecting ", ixSink); // if we're not accepting, try to reopen the sink try { sink->close(); Util::sleep(1L, 0L); sink->open(); sched_yield(); threadData->accepting = sink->isOpen(); } catch ( Exception & e ) { // don't care, just try and try again } } else { // if !reconnect, just stop the connector running = false; } } } } /*------------------------------------------------------------------------------ * Signal to each sink to cut what they've done so far, and start anew. *----------------------------------------------------------------------------*/ void MultiThreadedConnector :: cut ( void ) throw () { for ( unsigned int i = 0; i < numSinks; ++i ) { threads[i].cut = true; } // TODO: it might be more appropriate to signal all the threads here // but, they'll get signaled on new data anyway, and it might be // enough for them to cut at that time } /*------------------------------------------------------------------------------ * Stop the treads * Close the source and all the sinks if needed *----------------------------------------------------------------------------*/ void MultiThreadedConnector :: close ( void ) throw ( Exception ) { unsigned int i; // signal to stop for all threads pthread_mutex_lock( &mutexProduce); running = false; pthread_cond_broadcast( &condProduce); pthread_mutex_unlock( &mutexProduce); // wait for all the threads to finish for ( i = 0; i < numSinks; ++i ) { pthread_join( threads[i].thread, 0); } pthread_attr_destroy( &threadAttr); Connector::close(); } /*------------------------------------------------------------------------------ * The thread function *----------------------------------------------------------------------------*/ void * MultiThreadedConnector :: ThreadData :: threadFunction( void * param ) { struct sched_param sched; int sched_type; ThreadData * threadData = (ThreadData*) param; pthread_getschedparam( threadData->thread, &sched_type, &sched ); reportEvent( 5, "MultiThreadedConnector :: ThreadData :: threadFunction, " "was (thread, priority, type): ", param, sched.sched_priority, sched_type == SCHED_FIFO ? "SCHED_FIFO" : sched_type == SCHED_RR ? "SCHED_RR" : sched_type == SCHED_OTHER ? "SCHED_OTHER" : "INVALID" ); sched.sched_priority = 1; pthread_setschedparam( threadData->thread, SCHED_FIFO, &sched); pthread_getschedparam( threadData->thread, &sched_type, &sched ); reportEvent( 5, "MultiThreadedConnector :: ThreadData :: threadFunction, " "now is (thread, priority, type): ", param, sched.sched_priority, sched_type == SCHED_FIFO ? "SCHED_FIFO" : sched_type == SCHED_RR ? "SCHED_RR" : sched_type == SCHED_OTHER ? "SCHED_OTHER" : "INVALID" ); threadData->connector->sinkThread( threadData->ixSink); return 0; } darkice-1.2/src/JackDspSource.h0000644000175000017500000002013012170706662013342 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Copyright (c) 2005 Nicholas Humfrey. All rights reserved. Tyrell DarkIce File : JackDspSource.h Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/JackDspSource.h $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef JACK_DSP_SOURCE_H #define JACK_DSP_SOURCE_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include "Reporter.h" #include "AudioSource.h" #if defined( HAVE_JACK_LIB ) #include #include #else #error configure for JACK #endif /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * An audio input based on JACK * * @author $Author: rafael@riseup.net $ * @version $Revision: 553 $ */ class JackDspSource : public AudioSource, public virtual Reporter { private: /** * The jack client name. */ const char * jack_client_name; /** * The jack port */ jack_port_t * ports[2]; /** * The jack ring buffer. */ jack_ringbuffer_t * rb[2]; /** * The jack client. */ jack_client_t * client; /** * The jack audio sample buffer. */ jack_default_audio_sample_t * tmp_buffer; /** * Automatically connect the jack ports ? (default is to not) */ bool auto_connect; protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline JackDspSource ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } /** * Initialize the object * * @exception Exception */ void init ( const char* name ) throw ( Exception ); /** * De-initialize the object * * @exception Exception */ void strip ( void ) throw ( Exception ); /** * Attempt to connect up the JACK ports automatically */ void do_auto_connect( ) throw ( Exception ); /** * Callback called by JACK when audio is available */ static int process_callback( jack_nframes_t nframes, void *arg ); /** * Callback called by JACK when jackd is shutting down */ static void shutdown_callback( void *arg ); public: /** * Constructor. * * @param name the name of the jack device * @param sampleRate samples per second (e.g. 44100 for 44.1kHz). * @param bitsPerSample bits per sample (e.g. 16 bits). * @param channels number of channels of the audio source * (e.g. 1 for mono, 2 for stereo, etc.). * @exception Exception */ inline JackDspSource ( const char * name, const char * jackClientName, int sampleRate = 44100, int bitsPerSample = 16, int channels = 2 ) throw ( Exception ) : AudioSource( sampleRate, bitsPerSample, channels ) { jack_client_name = jackClientName; init( name ); } /** * Copy Constructor. * * @param jds the object to copy. * @exception Exception */ inline JackDspSource ( const JackDspSource & jds ) throw ( Exception ) : AudioSource( jds ) { throw Exception( __FILE__, __LINE__, "JackDspSource doesn't copy"); } /** * Destructor. * * @exception Exception */ inline virtual ~JackDspSource ( void ) throw ( Exception ) { strip(); } /** * Assignment operator. * * @param ds the object to assign to this one. * @return a reference to this object. * @exception Exception */ inline virtual JackDspSource & operator= ( const JackDspSource & ds ) throw ( Exception ) { throw Exception( __FILE__, __LINE__, "JackDspSource doesn't assign"); } /** * Open the JackDspSource. * This does not put the Jack DSP device into recording mode. * To start getting samples, call either canRead() or read(). * * @return true if opening was successful, false otherwise * @exception Exception * * @see #canRead * @see #read */ virtual bool open ( void ) throw ( Exception ); /** * Check if the JackDspSource is registered * * @return true if Jack client is setup */ inline virtual bool isOpen ( void ) const throw () { return client != NULL; } /** * Check if the JackDspSource can be read from. * Blocks until the specified time for data to be available. * Puts the Jack DSP device into recording mode. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true if the JackDspSource is ready to be read from, * false otherwise. * @exception Exception */ virtual bool canRead ( unsigned int sec, unsigned int usec ) throw ( Exception ); /** * Read from the JackDspSource. * Puts the Jack DSP device into recording mode. * * @param buf the buffer to read into. * @param len the number of bytes to read into buf * @return the number of bytes read (may be less than len). * @exception Exception */ virtual unsigned int read ( void * buf, unsigned int len ) throw ( Exception ); /** * Close the JackDspSource. * * @exception Exception */ virtual void close ( void ) throw ( Exception ); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* JACK_DSP_SOURCE_H */ darkice-1.2/src/Util.cpp0000644000175000017500000003766612170706662012140 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : Util.cpp Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/Util.cpp $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_ERRNO_H #include #else #error need errno.h #endif #ifdef HAVE_STRING_H #include #else #error need string.h #endif #ifdef HAVE_STDLIB_H #include #else #error need stdlib.h #endif #ifdef HAVE_LIMITS_H #include #else #error need limits.h #endif #ifdef HAVE_MATH_H #include #else #error need math.h #endif #ifdef HAVE_TIME_H #include #else #error need time.h #endif #ifdef HAVE_UNISTD_H #include #else #error need unistd.h #endif #ifdef HAVE_SYS_TIME_H #include #else #error need sys/time.h #endif #ifdef HAVE_SIGNAL_H #include #else #error need signal.h #endif #include "Util.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: Util.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $"; /* =============================================== local function prototypes */ /* ============================================================= module code */ char Util :: base64Table[] = { 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P', 'Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f', 'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v', 'w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/' }; /*------------------------------------------------------------------------------ * Calculate the length of a zero-terminated C string, * w/o the zero-termination *----------------------------------------------------------------------------*/ unsigned int Util :: strLen( const char * str ) throw ( Exception ) { size_t len; if ( !str ) { throw Exception( __FILE__, __LINE__, "no str"); } len = strlen( str); return len; } /*------------------------------------------------------------------------------ * Copy the contents of a string into another *----------------------------------------------------------------------------*/ void Util :: strCpy ( char * dest, const char * src ) throw ( Exception ) { if ( !dest || !src ) { throw Exception( __FILE__, __LINE__, "no src or dest"); } strcpy( dest, src); } /*------------------------------------------------------------------------------ * Concatenate the contents of a string onto another *----------------------------------------------------------------------------*/ void Util :: strCat ( char * dest, const char * src ) throw ( Exception ) { if ( !dest || !src ) { throw Exception( __FILE__, __LINE__, "no src or dest"); } strcat( dest, src); } /*------------------------------------------------------------------------------ * Duplicate a string by allocating space with new[] * The returned string must be freed with delete[] *----------------------------------------------------------------------------*/ char * Util :: strDup( const char * str ) throw ( Exception ) { size_t len; char * s; if ( !str ) { throw Exception( __FILE__, __LINE__, "no str"); } len = strlen( str) + 1; s = new char[len]; memcpy( s, str, len); return s; } /*------------------------------------------------------------------------------ * Convert a string into base64 encoding. *----------------------------------------------------------------------------*/ char * Util :: base64Encode( const char * str ) throw ( Exception ) { if ( !str ) { throw Exception( __FILE__, __LINE__, "no str"); } const char * data = str; size_t len = strlen( data); char * out = new char[len * 4 / 3 + 4]; char * result = out; unsigned chunk; while ( len > 0 ) { chunk = (len > 3) ? 3 : len; *out++ = base64Table[(*data & 0xfc) >> 2]; *out++ = base64Table[((*data & 0x03) << 4) | ((*(data+1) & 0xf0) >> 4)]; switch ( chunk ) { case 3: *out++ = base64Table[((*(data+1) & 0x0f) << 2) | ((*(data+2) & 0xc0) >> 6)]; *out++ = base64Table[(*(data+2)) & 0x3f]; break; case 2: *out++ = base64Table[((*(data+1) & 0x0f) << 2)]; *out++ = '='; break; case 1: *out++ = '='; *out++ = '='; break; } data += chunk; len -= chunk; } *out = 0; return result; } /*------------------------------------------------------------------------------ * Check wether two strings are equal *----------------------------------------------------------------------------*/ bool Util :: strEq( const char * str1, const char * str2, unsigned int len ) throw ( Exception ) { if ( !str1 || !str2 ) { throw Exception( __FILE__, __LINE__, "no str1 or no str2"); } return len == 0 ? !strcmp( str1, str2) : !strncmp( str1, str2, len); } /*------------------------------------------------------------------------------ * Convert a string to a long integer *----------------------------------------------------------------------------*/ long int Util :: strToL( const char *str) throw ( Exception ) { long int val; char *end; if ( NULL == str ) throw Exception( __FILE__, __LINE__, "null pointer parameter, not string"); errno = 0; // set it, strtol() can change it val = strtol( str, &end, 10); if (end == str) throw Exception( __FILE__, __LINE__, "number conversion error, not a decimal string"); if ((LONG_MIN == val || LONG_MAX == val) && ERANGE == errno) throw Exception( __FILE__, __LINE__, "number conversion error, out of range of type long"); return val; } /*------------------------------------------------------------------------------ * Convert a string to a double *----------------------------------------------------------------------------*/ double Util :: strToD( const char * str ) throw ( Exception ) { double val; char * s; if ( !str ) { throw Exception( __FILE__, __LINE__, "no str"); } val = strtod( str, &s); if ( s == str || val == HUGE_VAL ) { throw Exception( __FILE__, __LINE__, "number conversion error"); } return val; } /*------------------------------------------------------------------------------ * add current date to a file name, before the file extension (if any) *----------------------------------------------------------------------------*/ char * Util :: fileAddDate ( const char * str, const char * format ) throw ( Exception ) { unsigned int size; const char * last; char * s; char * strdate; time_t now; if ( !str ) { throw Exception( __FILE__, __LINE__, "no str"); } strdate = new char[128]; now = time(NULL); strftime( strdate, 128, format, localtime (&now)); // search for the part before the extension of the file name if ( !(last = strrchr( str, '.')) ) { last = (char *) str + strlen( str); } size = strlen( str) + strlen( strdate) + 1; s = new char [size]; memcpy( s, str, strlen (str)-strlen(last)); memcpy( s + strlen(str) - strlen(last), strdate, strlen (strdate)); memcpy( s + strlen(str) - strlen(last) + strlen(strdate), last, strlen(last)); s[size-1] = '\0'; delete[] strdate; return s; } /*------------------------------------------------------------------------------ * Convert an unsigned char buffer holding 8 or 16 bit PCM values with * channels interleaved to a short int buffer, still with channels interleaved *----------------------------------------------------------------------------*/ void Util :: conv ( unsigned int bitsPerSample, unsigned char * pcmBuffer, unsigned int lenPcmBuffer, short int * outBuffer, bool isBigEndian ) throw ( Exception ) { if ( bitsPerSample == 8 ) { unsigned int i, j; for ( i = 0, j = 0; i < lenPcmBuffer; ) { outBuffer[j] = pcmBuffer[i++]; ++j; } } else if ( bitsPerSample == 16 ) { if ( isBigEndian ) { unsigned int i, j; for ( i = 0, j = 0; i < lenPcmBuffer; ) { short int value; value = pcmBuffer[i++] << 8; value |= pcmBuffer[i++]; outBuffer[j] = value; ++j; } } else { unsigned int i, j; for ( i = 0, j = 0; i < lenPcmBuffer; ) { short int value; value = pcmBuffer[i++]; value |= pcmBuffer[i++] << 8; outBuffer[j] = value; ++j; } } } else { throw Exception( __FILE__, __LINE__, "this number of bits per sample not supported", bitsPerSample); } } /*------------------------------------------------------------------------------ * Convert a short buffer holding PCM values with channels interleaved * to one or more float buffers, one for each channel *----------------------------------------------------------------------------*/ void Util :: conv ( short int * shortBuffer, unsigned int lenShortBuffer, float ** floatBuffers, unsigned int channels ) throw ( Exception ) { unsigned int i, j; for ( i = 0, j = 0; i < lenShortBuffer; ) { for ( unsigned int c = 0; c < channels; ++c ) { floatBuffers[c][j] = ((float) shortBuffer[i++]) / 32768.f; } ++j; } } /*------------------------------------------------------------------------------ * Convert an unsigned char buffer holding 8 bit PCM values with channels * interleaved to two short int buffers (one for each channel) *----------------------------------------------------------------------------*/ void Util :: conv8 ( unsigned char * pcmBuffer, unsigned int lenPcmBuffer, short int * leftBuffer, short int * rightBuffer, unsigned int channels ) throw ( Exception ) { if ( channels == 1 ) { unsigned int i, j; for ( i = 0, j = 0; i < lenPcmBuffer; ) { unsigned short int value; value = pcmBuffer[i++]; leftBuffer[j] = (short int) value; ++j; } } else if ( channels == 2 ) { unsigned int i, j; for ( i = 0, j = 0; i < lenPcmBuffer; ) { unsigned short int value; value = pcmBuffer[i++]; leftBuffer[j] = (short int) value; value = pcmBuffer[i++]; rightBuffer[j] = (short int) value; ++j; } } else { throw Exception( __FILE__, __LINE__, "this number of channels not supported", channels); } } /*------------------------------------------------------------------------------ * Convert an unsigned char buffer holding 16 bit PCM values with channels * interleaved to two short int buffers (one for each channel) *----------------------------------------------------------------------------*/ void Util :: conv16 ( unsigned char * pcmBuffer, unsigned int lenPcmBuffer, short int * leftBuffer, short int * rightBuffer, unsigned int channels, bool isBigEndian ) throw ( Exception ) { if ( isBigEndian ) { if ( channels == 1 ) { unsigned int i, j; for ( i = 0, j = 0; i < lenPcmBuffer; ) { unsigned short int value; value = pcmBuffer[i++] << 8; value |= pcmBuffer[i++]; leftBuffer[j] = (short int) value; ++j; } } else { unsigned int i, j; for ( i = 0, j = 0; i < lenPcmBuffer; ) { unsigned short int value; value = pcmBuffer[i++] << 8; value |= pcmBuffer[i++]; leftBuffer[j] = (short int) value; value = pcmBuffer[i++] << 8; value |= pcmBuffer[i++]; rightBuffer[j] = (short int) value; ++j; } } } else { if ( channels == 1 ) { unsigned int i, j; for ( i = 0, j = 0; i < lenPcmBuffer; ) { unsigned short int value; value = pcmBuffer[i++]; value |= pcmBuffer[i++] << 8; leftBuffer[j] = (short int) value; ++j; } } else { unsigned int i, j; for ( i = 0, j = 0; i < lenPcmBuffer; ) { unsigned short int value; value = pcmBuffer[i++]; value |= pcmBuffer[i++] << 8; leftBuffer[j] = (short int) value; value = pcmBuffer[i++]; value |= pcmBuffer[i++] << 8; rightBuffer[j] = (short int) value; ++j; } } } } /*------------------------------------------------------------------------------ * Make a thread sleep for a specified amount of time. *----------------------------------------------------------------------------*/ void Util :: sleep ( long sec, long nsec) { struct timespec timespec; sigset_t sigset; timespec.tv_sec = sec; timespec.tv_nsec = nsec; // mask out SIGUSR1, as we're expecting that signal for other reasons sigemptyset(&sigset); sigaddset(&sigset, SIGUSR1); pselect( 0, NULL, NULL, NULL, ×pec, &sigset); } darkice-1.2/src/Sink.h0000644000175000017500000001221412170706662011552 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : Sink.h Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/Sink.h $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef SINK_H #define SINK_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include "Referable.h" #include "Exception.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * A general data sink * * @author $Author: rafael@riseup.net $ * @version $Revision: 553 $ */ class Sink : public virtual Referable { private: protected: /** * Default constructor. */ inline Sink ( void ) throw () { } /** * Copy constructor. * * @param sink the Sink to copy. */ inline Sink ( const Sink & sink ) throw () { } /** * Assignment operator. * * @param sink the Sink to assign this to. * @return a reference to this Sink. * @exception Exception */ inline virtual Sink & operator= ( const Sink & sink ) throw ( Exception ) { return *this; } public: /** * Destructor. * * @exception Exception */ inline virtual ~Sink ( void ) throw ( Exception ) { } /** * Open the sink. * * @return true if opening was successfull, false otherwise. * @exception Exception */ virtual bool open ( void ) throw ( Exception ) = 0; /** * Check if the Sink is open. * * @return true if the Sink is open, false otherwise. */ virtual bool isOpen ( void ) const throw () = 0; /** * Check if the Sink is ready to accept data. * Blocks until the specified time for data to be available. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true if the Sink is ready to accept data, false otherwise. * @exception Exception */ virtual bool canWrite ( unsigned int sec, unsigned int usec ) throw ( Exception ) = 0; /** * Write data to the Sink. * * @param buf the data to write. * @param len number of bytes to write from buf. * @return the number of bytes written (may be less than len). * @exception Exception */ virtual unsigned int write ( const void * buf, unsigned int len ) throw ( Exception ) = 0; /** * Flush all data that was written to the Sink to the underlying * construct. * * @exception Exception */ virtual void flush ( void ) throw ( Exception ) = 0; /** * Cut what the sink has been doing so far, and start anew. * This usually means separating the data sent to the sink up * until now, and start saving a new chunk of data. */ virtual void cut ( void ) throw () = 0; /** * Close the Sink. * * @exception Exception */ virtual void close ( void ) throw ( Exception ) = 0; }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* SINK_H */ darkice-1.2/src/DarkIce.h0000644000175000017500000002172712170706662012161 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : DarkIce.h Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/DarkIce.h $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef DARK_ICE_H #define DARK_ICE_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_UNISTD_H #include #else #error need unistd.h #endif #include #include "Referable.h" #include "Reporter.h" #include "Exception.h" #include "Ref.h" #include "AudioSource.h" #include "BufferedSink.h" #include "Connector.h" #include "AudioEncoder.h" #include "TcpSocket.h" #include "CastSink.h" #include "DarkIceConfig.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * Program main object. * * @author $Author: rafael@riseup.net $ * @version $Revision: 553 $ */ class DarkIce : public virtual Referable, public virtual Reporter { private: /** * The maximum number of supported outputs. This should be * * */ static const unsigned int maxOutput = 4 * 7; /** * Type describing each lame library output. */ typedef struct { Ref encoder; Ref socket; Ref server; } Output; /** * The outputs. */ Output audioOuts[maxOutput]; /** * Number of lame library outputs. */ unsigned int noAudioOuts; /** * Duration of playing, in seconds. */ unsigned int duration; /** * The dsp to record from. */ Ref dsp; /** * The encoding Connector, connecting the dsp to the encoders. */ Ref encConnector; /** * Should we turn real-time scheduling on ? */ int enableRealTime; /** * Scheduling priority for the realtime threads */ int realTimeSchedPriority; /** * Original scheduling policy */ int origSchedPolicy; /** * Original scheduling priority */ int origSchedPriority; /** * Initialize the object. * * @param config the config Object to read initialization * information from. * @exception Exception */ void init ( const Config & config ) throw ( Exception ); /** * Look for the icecast stream outputs from the config file. * Called from init() * * @param config the config Object to read initialization * information from. * @param bufferSecs number of seconds to buffer audio for * @exception Exception */ void configIceCast ( const Config & config, unsigned int bufferSecs ) throw ( Exception ); /** * Look for the icecast2 stream outputs from the config file. * Called from init() * * @param config the config Object to read initialization * information from. * @param bufferSecs number of seconds to buffer audio for * @exception Exception */ void configIceCast2 ( const Config & config, unsigned int bufferSecs ) throw ( Exception ); /** * Look for the shoutcast stream outputs from the config file. * Called from init() * * @param config the config Object to read initialization * information from. * @param bufferSecs number of seconds to buffer audio for * @exception Exception */ void configShoutCast ( const Config & config, unsigned int bufferSecs ) throw ( Exception ); /** * Look for file outputs from the config file. * Called from init() * * @param config the config Object to read initialization * information from. * @exception Exception */ void configFileCast ( const Config & config ) throw ( Exception ); /** * Set POSIX real-time scheduling for the encoding process, * if user permissions enable it. * * @exception Exception */ void setRealTimeScheduling ( void ) throw ( Exception ); /** * Set the scheduling that was before setting real-time scheduling. * This function must be called _only_ after setRealTimeScheduling. * * @exception Exception */ void setOriginalScheduling ( void ) throw ( Exception ); /** * Start encoding. Spawns all encoders, opens the dsp and * starts sending data to the encoders. * * @return if encoding was successful. * @exception Exception */ bool encode ( void ) throw ( Exception ); /** * Start shouting. fork()-s a process for each output, reads * the output of the encoders and sends them to an IceCast server. * * @return if shouting was successful. * @exception Exception */ bool shout ( unsigned int ) throw ( Exception ); protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline DarkIce ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } public: /** * Constructor based on a configuration object. * * @param config the config Object to read initialization * information from. * @exception Exception */ inline DarkIce ( const Config & config ) throw ( Exception ) { init( config); } /** * Destructor. * * @exception Exception */ inline virtual ~DarkIce ( void ) throw ( Exception ) { } /* TODO inline DarkIce ( const DarkIce & di ) throw ( Exception ) { } inline DarkIce & operator= ( const DarkIce * di ) throw ( Exception ) { } */ /** * Run the process of recording / encoding / sending to the servers. * * @return 0 on success * @exception Exception */ virtual int run ( void ) throw ( Exception ); /** * Signal to each sink we have that they need to cut what they are * doing, and start again. For FileSinks, this usually means to * save the archive file recorded so far, and start a new archive * file. */ virtual void cut ( void ) throw (); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* DARK_ICE_H */ darkice-1.2/src/Util.h0000644000175000017500000002604412170706662011571 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : Util.h Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/Util.h $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef UTIL_H #define UTIL_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include "Exception.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * Widely used utilities. * This class can not be instantiated, but contains useful (?) static * functions. * * Typical usage: * *
 *  #include "Util.h"
 *  
 *  char  * str = Util::strDup( otherStr);
 *  
* * @author $Author: rafael@riseup.net $ * @version $Revision: 553 $ */ class Util { private: /** * Helper table for base64 encoding. */ static char base64Table[]; protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline Util ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } /** * Copy constructor. Always throws an Exception. * * @exception Exception */ inline Util ( const Util & e ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } /** * Destructor. Always throws an Exception. * * @exception Exception */ inline ~Util ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } /** * Assignment operator. Always throws an Exception. * * @param u the object to assign to this one. * @exception Exception */ inline Util & operator= ( const Util & u ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } public: /** * Determine a C string's length. * * @param str a zero-terminated C string. * @return length of str * @exception Exception */ static unsigned int strLen ( const char * str ) throw ( Exception ); /** * Copy a C string into another. * * @param dest place for the copy. Storage size must be at least * Util::strLen(src) + 1 long. * @param src the string to copy. * @exception Exception */ static void strCpy ( char * dest, const char * src ) throw ( Exception ); /** * Concatenate a string to another's end. * * @param dest the string to concatenate to. * Storage size of dest must be at least * Util::strLen(dest) + Util::strLen(src) + 1 long. * @param src the string to concatenate. * @exception Exception */ static void strCat ( char * dest, const char * src ) throw ( Exception ); /** * Duplicate a string by allocating space with new[]. * The returned string must be freed with delete[]. * * @param str the string to duplicate. * @exception Exception */ static char * strDup ( const char * str ) throw ( Exception ); /** * Determine wether two string are equal. * * @param str1 one of the strings. * @param str2 the other string. * @param len check the first most len characters. if 0, check * the whole string * @return true if the two strings are equal, false othersize. * @exception Exception */ static bool strEq ( const char * str1, const char * str2, unsigned int len = 0 ) throw ( Exception ); /** * Convert a string to long. * * @param str the string to convert. * @return the value of str as a long int * @exception Exception */ static long int strToL ( const char * str) throw ( Exception ); /** * Convert a string to double. * * @param str the string to convert. * @return the value of str as a double * @exception Exception */ static double strToD ( const char * str ) throw ( Exception ); /** * Add current date to a file name, before the file extension (if any) * * @param str the string to convert (file name). * @return the new string with the date appended before * extension of the file name. the string has to be * deleted with delete[] after it is not needed * @exception Exception */ static char * fileAddDate ( const char * str, const char * format = "[%m-%d-%Y-%H-%M-%S]" ) throw ( Exception ); /** * Convert a string into base64 encoding. * base64 is described in RFC 2045, section 6.8 * The returned string must be freed with delete[]. * * @param str the string to convert. * @return the supplied string in base64 encoding. * @exception Exception */ static char * base64Encode ( const char * str ) throw ( Exception ); /** * Convert an unsigned char buffer holding 8 or 16 bit PCM values * with channels interleaved to a short int buffer, still * with channels interleaved. * * @param bitsPerSample the number of bits per sample in the input * @param pcmBuffer the input buffer * @param lenPcmBuffer the number of samples total in pcmBuffer * (e.g. if 2 channel input, this is twice the * number of sound samples) * @param outBuffer the output buffer, must be big enough * @param isBigEndian true if the input is big endian, false otherwise */ static void conv ( unsigned int bitsPerSample, unsigned char * pcmBuffer, unsigned int lenPcmBuffer, short int * outBuffer, bool isBigEndian = true ) throw ( Exception ); /** * Convert a short buffer holding PCM values with channels interleaved * to one or more float buffers, one for each channel * * @param shortBuffer the input buffer * @param lenShortBuffer total length of the input buffer * @param floatBuffers an array of float buffers, each * (lenShortBuffer / channels) long * @param channels number of channels to separate the input to */ static void conv ( short int * shortBuffer, unsigned int lenShortBuffer, float ** floatBuffers, unsigned int channels ) throw ( Exception ); /** * Convert a char buffer holding 8 bit PCM values to a short buffer * * @param pcmBuffer buffer holding 8 bit PCM audio values, * channels are interleaved * @param lenPcmBuffer length of pcmBuffer * @param leftBuffer put the left channel here (must be big enough) * @param rightBuffer put the right channel here (not touched if mono, * must be big enough) * @param channels number of channels (1 = mono, 2 = stereo) */ static void conv8 ( unsigned char * pcmBuffer, unsigned int lenPcmBuffer, short int * leftBuffer, short int * rightBuffer, unsigned int channels ) throw ( Exception ); /** * Convert a char buffer holding 16 bit PCM values to a short buffer * * @param pcmBuffer buffer holding 16 bit PCM audio values, * channels are interleaved * @param lenPcmBuffer length of pcmBuffer * @param leftBuffer put the left channel here (must be big enough) * @param rightBuffer put the right channel here (not touched if mono, * must be big enough) * @param channels number of channels (1 = mono, 2 = stereo) * @param isBigEndian true if input is big endian, false otherwise */ static void conv16 ( unsigned char * pcmBuffer, unsigned int lenPcmBuffer, short int * leftBuffer, short int * rightBuffer, unsigned int channels, bool isBigEndian ) throw ( Exception ); /** * Make a thread sleep for specified amount of time. * Only the thread which this is called in will sleep. * The SIGUSR1 signal will be blocked during the sleep. * * @param sec the number of seconds to sleep. * @param nsec the number of nano-seconds to sleep. */ static void sleep( long sec, long nsec); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* UTIL_H */ darkice-1.2/src/BufferedSink.cpp0000644000175000017500000002677112170706662013565 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : BufferedSink.cpp Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/BufferedSink.cpp $ the buffer is filled like this: buffer bufferEnd | | +----------+--------------------------+--------------+ |<---- valid data -------->| outp inp buffer bufferEnd | | +----------------+--------------+--------------------+ -- valid data -->| |--- valid data -----> inp outp Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_STRING_H #include #else #error need string.h #endif #include "Exception.h" #include "BufferedSink.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: BufferedSink.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $"; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Initialize the object *----------------------------------------------------------------------------*/ void BufferedSink :: init ( Sink * sink, unsigned int size, unsigned int chunkSize ) throw ( Exception ) { if ( !sink ) { throw Exception( __FILE__, __LINE__, "no sink"); } this->sink = sink; // create a reference this->chunkSize = chunkSize ? chunkSize : 1; this->bufferSize = size; // make bufferSize a multiple of chunkSize this->bufferSize -= this->bufferSize % this->chunkSize; this->peak = 0; this->misalignment = 0; this->buffer = new unsigned char[bufferSize]; this->bufferEnd = buffer + bufferSize; this->inp = buffer; this->outp = buffer; } /*------------------------------------------------------------------------------ * Copy Constructor *----------------------------------------------------------------------------*/ BufferedSink :: BufferedSink ( const BufferedSink & buffer ) throw ( Exception ) { init( buffer.sink.get(), buffer.bufferSize, buffer.chunkSize); this->peak = buffer.peak; this->misalignment = buffer.misalignment; memcpy( this->buffer, buffer.buffer, this->bufferSize); } /*------------------------------------------------------------------------------ * De-initalize the object *----------------------------------------------------------------------------*/ void BufferedSink :: strip ( void ) throw ( Exception ) { if ( isOpen() ) { close(); } sink = 0; // delete the reference delete buffer; } /*------------------------------------------------------------------------------ * Assignment operator *----------------------------------------------------------------------------*/ BufferedSink & BufferedSink :: operator= ( const BufferedSink & buffer ) throw ( Exception ) { if ( this != &buffer ) { strip(); Sink::operator=( buffer ); init( buffer.sink.get(), buffer.bufferSize, buffer.chunkSize); this->peak = buffer.peak; this->misalignment = buffer.misalignment; memcpy( this->buffer, buffer.buffer, this->bufferSize); } return *this; } /*------------------------------------------------------------------------------ * Store bufferSize bytes into the buffer * All data is consumed. The return value is less then bufferSize only * if the BufferedSink's internal buffer is smaller than bufferSize, * thus can't hold that much * The data to be stored is treated as parts with chunkSize size * Only full chunkSize sized parts are stored *----------------------------------------------------------------------------*/ unsigned int BufferedSink :: store ( const void * buffer, unsigned int bufferSize ) throw ( Exception ) { const unsigned char * buf; unsigned int size; unsigned int i; unsigned char * oldInp; if ( !buffer ) { throw Exception( __FILE__, __LINE__, "buffer is null"); } if ( !bufferSize ) { return 0; } oldInp = inp; buf = (const unsigned char *) buffer; // adjust so it is a multiple of chunkSize bufferSize -= bufferSize % chunkSize; // cut the front of the supplied buffer if it wouldn't fit if ( bufferSize > this->bufferSize ) { size = this->bufferSize - 1; size -= size % chunkSize; // keep it a multiple of chunkSize buf += bufferSize - size; } else { size = bufferSize; } // copy the data into the buffer i = bufferEnd - inp; if ( (i % chunkSize) != 0 ) { throw Exception( __FILE__, __LINE__, "copy quantity not aligned", i); } if ( size <= i ) { // the place between inp and bufferEnd is // big enough to hold the data memcpy( inp, buf, size); inp = slidePointer( inp, size); // adjust outp, lose the data that was overwritten, if any if ( outp > oldInp && outp <= inp ) { outp = slidePointer( inp, chunkSize); } } else { // the place between inp and bufferEnd is not // big enough to hold the data // writing will take place in two turns, once from // inp -> bufferEnd, then from buffer -> memcpy( inp, buf, i); i = size - i; if ( (i % chunkSize) != 0 ) { throw Exception(__FILE__, __LINE__, "copy quantity not aligned", i); } memcpy( this->buffer, buf, i); inp = slidePointer( this->buffer, i); // adjust outp, lose the data that was overwritten, if any if ( outp <= oldInp ) { if ( outp < inp ) { outp = slidePointer( inp, chunkSize); } } else { outp = slidePointer( inp, chunkSize); } } updatePeak(); if ( ((inp - this->buffer) % chunkSize) != 0 ) { throw Exception( __FILE__, __LINE__, "inp not aligned", inp - this->buffer); } if ( ((outp - this->buffer) % chunkSize) != 0 ) { throw Exception( __FILE__, __LINE__, "outp not aligned", outp - this->buffer); } return size; } /*------------------------------------------------------------------------------ * Write some data to the sink * if len == 0, try to flush the buffer *----------------------------------------------------------------------------*/ unsigned int BufferedSink :: write ( const void * buf, unsigned int len ) throw ( Exception ) { unsigned int length; unsigned int soFar; unsigned char * b = (unsigned char *) buf; if ( !buf ) { throw Exception( __FILE__, __LINE__, "buf is null"); } if ( !isOpen() ) { return 0; } if ( !align() ) { return 0; } // make it a multiple of chunkSize len -= len % chunkSize; // try to write data from the buffer first, if any if ( inp != outp ) { unsigned int size = 0; unsigned int total = 0; if ( outp > inp ) { // valuable data is between outp -> bufferEnd and buffer -> inp // try to write the outp -> bufferEnd // the rest will be written in the next if size = bufferEnd - outp - 1; size -= size % chunkSize; soFar = 0; while ( outp > inp && soFar < size && sink->canWrite( 0, 0) ) { length = sink->write( outp + soFar, size - soFar); outp = slidePointer( outp, length); soFar += length; } total += soFar; } if ( outp < inp ) { // valuable data is between outp and inp // in the previous if wrote all data from the end // this part will write the rest size = inp - outp; soFar = 0; while ( soFar < size && sink->canWrite( 0, 0) ) { length = sink->write( outp + soFar, size - soFar); outp = slidePointer( outp, length); soFar += length; } total += soFar; } while ( (outp - buffer) % chunkSize ) { slidePointer( outp, 1); } // calulate the misalignment to chunkSize boundaries misalignment = (chunkSize - (total % chunkSize)) % chunkSize; } if ( !align() ) { return 0; } // the internal buffer is empty, try to write the fresh data soFar = 0; if ( inp == outp ) { while ( soFar < len && sink->canWrite( 0, 0) ) { try { soFar += sink->write( b + soFar, len - soFar); } catch (Exception &e) { reportEvent(3,"Exception caught in BufferedSink :: write3\n"); throw; /* up a level */ } } } length = soFar; // calulate the misalignment to chunkSize boundaries misalignment = (chunkSize - (length % chunkSize)) % chunkSize; if ( length < len ) { // if not all fresh could be written, store the remains store( b + length, len - length); } // tell them we ate everything up to chunkSize alignment return len; } /*------------------------------------------------------------------------------ * Close the sink, lose all pending data *----------------------------------------------------------------------------*/ void BufferedSink :: close ( void ) throw ( Exception ) { if ( !isOpen() ) { return; } flush(); sink->close(); inp = outp = buffer; } darkice-1.2/src/Connector.cpp0000644000175000017500000002307112170706662013136 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : Connector.cpp Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/Connector.cpp $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #include "Exception.h" #include "Connector.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: Connector.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $"; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Initialize the object *----------------------------------------------------------------------------*/ void Connector :: init ( Source * source ) throw ( Exception ) { this->source = source; this->sinks = 0; this->numSinks = 0; } /*------------------------------------------------------------------------------ * De-initialize the object *----------------------------------------------------------------------------*/ void Connector :: strip ( void ) throw ( Exception ) { source = 0; if ( sinks ) { unsigned int u; for ( u = 0; u < numSinks; ++u ) { sinks[u] = 0; } delete[] sinks; } } /*------------------------------------------------------------------------------ * Constructor *----------------------------------------------------------------------------*/ Connector :: Connector ( const Connector & connector ) throw ( Exception ) { unsigned int u; init( connector.source.get()); for ( u = 0; u < connector.numSinks; ++u ) { attach( connector.sinks[u].get() ); } } /*------------------------------------------------------------------------------ * Assignment operator *----------------------------------------------------------------------------*/ Connector & Connector :: operator= ( const Connector & connector ) throw ( Exception ) { if ( this != &connector ) { unsigned int u; // first free everything strip(); // then fill in init( connector.source.get() ); for ( u = 0; u < connector.numSinks; ++u ) { attach( connector.sinks[u].get() ); } } return *this; } /*------------------------------------------------------------------------------ * Attach a sink to the connector *----------------------------------------------------------------------------*/ void Connector :: attach ( Sink * sink ) throw ( Exception ) { if ( !sinks ) { numSinks = 1; sinks = new Ref[1]; sinks[0] = sink; } else { unsigned int u; Ref * s = new Ref[numSinks + 1]; for ( u = 0; u < numSinks; ++u ) { s[u] = sinks[u].get(); } s[numSinks] = sink; delete[] sinks; sinks = s; ++numSinks; } } /*------------------------------------------------------------------------------ * Detach a sink to the connector *----------------------------------------------------------------------------*/ bool Connector :: detach ( Sink * sink ) throw ( Exception ) { if ( numSinks == 0 ) { return false; } else if ( numSinks == 1 ) { if ( sinks[0].get() != sink ) { return false; } sinks[0] = 0; delete[] sinks; sinks = 0; --numSinks; return true; } else { unsigned int u; unsigned int v; unsigned int ix; Ref * s; ix = numSinks; for ( u = 0; u < numSinks; ++u ) { if ( sinks[u].get() == sink ) { ix = u; break; } } if ( ix == numSinks ) { return false; } s = new Ref[numSinks - 1]; for ( u = 0, v = 0; u < numSinks; ++u ) { if ( u != ix ) { s[v++] = sinks[u]; } } sinks[ix] = 0; delete[] sinks; sinks = s; --numSinks; return true; } } /*------------------------------------------------------------------------------ * Open the source and all the sinks if needed *----------------------------------------------------------------------------*/ bool Connector :: open ( void ) throw ( Exception ) { unsigned int u; if ( !source->isOpen() ) { if ( !source->open() ) { return false; } } for ( u = 0; u < numSinks; ++u ) { if ( !sinks[u]->isOpen() ) { if ( !sinks[u]->open() ) { break; } } } // if not all could be opened, close those that were if ( u < numSinks ) { unsigned int v; for ( v = 0; v < u; ++v ) { sinks[v]->close(); } source->close(); return false; } return true; } /*------------------------------------------------------------------------------ * Transfer some data from the source to the sink *----------------------------------------------------------------------------*/ unsigned int Connector :: transfer ( unsigned long bytes, unsigned int bufSize, unsigned int sec, unsigned int usec ) throw ( Exception ) { unsigned int u; unsigned long b; if ( numSinks == 0 ) { return 0; } if ( bufSize == 0 ) { return 0; } unsigned char * buf = new unsigned char[bufSize]; reportEvent( 6, "Connector :: transfer, bytes", bytes); for ( b = 0; !bytes || b < bytes; ) { unsigned int d = 0; unsigned int e = 0; if ( source->canRead( sec, usec) ) { d = source->read( buf, bufSize); // check for EOF if ( d == 0 ) { reportEvent( 3, "Connector :: transfer, EOF"); break; } for ( u = 0; u < numSinks; ++u ) { if ( sinks[u]->canWrite( sec, usec) ) { try { // we expect the sink to accept all data written e = sinks[u]->write( buf, d); } catch ( Exception & e ) { sinks[u]->close(); detach( sinks[u].get() ); reportEvent( 4, "Connector :: transfer, sink removed, remaining", numSinks); if ( numSinks == 0 ) { reportEvent( 4, "Connector :: transfer, no more sinks"); delete[] buf; return b; } // with the call to detach, numSinks gets 1 lower, // and the next sink comes to sinks[u] --u; } } } b += d; } else { reportEvent( 3, "Connector :: transfer, can't read"); break; } } delete[] buf; return b; } /*------------------------------------------------------------------------------ * Signal to each sink to cut what they've done so far, and start anew. *----------------------------------------------------------------------------*/ void Connector :: cut ( void ) throw () { unsigned int u; for ( u = 0; u < numSinks; ++u ) { if ( sinks[u]->isOpen() ) { sinks[u]->cut(); } } } /*------------------------------------------------------------------------------ * Close the source and all the sinks if needed *----------------------------------------------------------------------------*/ void Connector :: close ( void ) throw ( Exception ) { unsigned int u; source->close(); for ( u = 0; u < numSinks; ++u ) { sinks[u]->close(); } } darkice-1.2/src/TwoLameLibEncoder.cpp0000644000175000017500000002313512170706662014504 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : TwoLameLibEncoder.cpp Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/TwoLameLibEncoder.cpp $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif // compile the whole file only if TwoLame support configured in #ifdef HAVE_TWOLAME_LIB #include "Exception.h" #include "Util.h" #include "TwoLameLibEncoder.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: TwoLameLibEncoder.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $"; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Initialize the object *----------------------------------------------------------------------------*/ void TwoLameLibEncoder :: init ( void ) throw ( Exception ) { this->twolame_opts = NULL; if ( getInBitsPerSample() != 16 ) { throw Exception( __FILE__, __LINE__, "specified bits per sample not supported", getInBitsPerSample() ); } if ( getInChannel() != 1 && getInChannel() != 2 ) { throw Exception( __FILE__, __LINE__, "unsupported number of input channels for the encoder", getInChannel() ); } if ( getOutChannel() != 1 && getOutChannel() != 2 ) { throw Exception( __FILE__, __LINE__, "unsupported number of output channels for the encoder", getOutChannel() ); } if ( getInChannel() < getOutChannel() ) { throw Exception( __FILE__, __LINE__, "output channels greater then input channels", getOutChannel() ); } } /*------------------------------------------------------------------------------ * Open an encoding session *----------------------------------------------------------------------------*/ bool TwoLameLibEncoder :: open ( void ) throw ( Exception ) { if ( isOpen() ) { close(); } // open the underlying sink if ( !getSink()->open() ) { throw Exception( __FILE__, __LINE__, "TwoLAME lib opening underlying sink error"); } twolame_opts = ::twolame_init(); // ugly twolame returns -1 in a pointer on allocation errors if ( !twolame_opts ) { throw Exception( __FILE__, __LINE__, "TwoLAME lib init error", (long int) twolame_opts); } if ( 0 > twolame_set_num_channels( twolame_opts, getInChannel()) ) { throw Exception( __FILE__, __LINE__, "TwoLAME lib setting channels error", getInChannel() ); } if ( 0 > twolame_set_mode( twolame_opts, getOutChannel() == 1 ? TWOLAME_MONO : TWOLAME_JOINT_STEREO) ) { throw Exception( __FILE__, __LINE__, "TwoLAME lib setting mode error", TWOLAME_JOINT_STEREO ); } if ( 0 > twolame_set_in_samplerate( twolame_opts, getInSampleRate()) ) { throw Exception( __FILE__, __LINE__, "TwoLAME lib setting input sample rate error", getInSampleRate() ); } if ( 0 > twolame_set_out_samplerate( twolame_opts, getOutSampleRate()) ) { throw Exception( __FILE__, __LINE__, "TwoLAME lib setting output sample rate error", getOutSampleRate() ); } switch ( getOutBitrateMode() ) { case cbr: { if ( 0 > twolame_set_brate( twolame_opts, getOutBitrate()) ) { throw Exception( __FILE__, __LINE__, "TwoLAME lib setting output bit rate error", getOutBitrate() ); } } break; default: { throw Exception( __FILE__, __LINE__, "Unsupported bitrate mode." ); } } // let TwoLAME init its own params based on our settings if ( 0 > twolame_init_params( twolame_opts) ) { throw Exception( __FILE__, __LINE__, "TwoLAME lib initializing params error" ); } // Information about TwoLame's setup if (getReportVerbosity() >= 3) { twolame_print_config( twolame_opts); } return true; } /*------------------------------------------------------------------------------ * Write data to the encoder *----------------------------------------------------------------------------*/ unsigned int TwoLameLibEncoder :: write ( const void * buf, unsigned int len ) throw ( Exception ) { if ( !isOpen() || len == 0 ) { return 0; } unsigned int bitsPerSample = getInBitsPerSample(); unsigned int inChannels = getInChannel(); unsigned int sampleSize = (bitsPerSample / 8) * inChannels; unsigned char * b = (unsigned char*) buf; unsigned int processed = len - (len % sampleSize); unsigned int nSamples = processed / sampleSize; short int * leftBuffer = new short int[nSamples]; short int * rightBuffer = new short int[nSamples]; if ( bitsPerSample == 8 ) { Util::conv8( b, processed, leftBuffer, rightBuffer, inChannels); } else if ( bitsPerSample == 16 ) { Util::conv16( b, processed, leftBuffer, rightBuffer, inChannels, isInBigEndian()); } else { delete[] leftBuffer; delete[] rightBuffer; throw Exception( __FILE__, __LINE__, "unsupported number of bits per sample for the encoder", bitsPerSample ); } // data chunk size estimate according to TwoLAME documentation // NOTE: mp2Size is calculated based on the number of input channels // which may be bigger than need, as output channels can be less unsigned int mp2Size = (unsigned int) (1.25 * nSamples + 7200); unsigned char * mp2Buf = new unsigned char[mp2Size]; int ret; ret = twolame_encode_buffer( twolame_opts, leftBuffer, inChannels == 2 ? rightBuffer : leftBuffer, nSamples, mp2Buf, mp2Size ); delete[] leftBuffer; delete[] rightBuffer; if ( ret < 0 ) { reportEvent( 3, "TwoLAME encoding error", ret); delete[] mp2Buf; return 0; } unsigned int written = getSink()->write( mp2Buf, ret); delete[] mp2Buf; // just let go data that could not be written if ( written < (unsigned int) ret ) { reportEvent( 2, "couldn't write all from encoder to underlying sink", ret - written); } return processed; } /*------------------------------------------------------------------------------ * Flush the data from the encoder *----------------------------------------------------------------------------*/ void TwoLameLibEncoder :: flush ( void ) throw ( Exception ) { if ( !isOpen() ) { return; } // data chunk size estimate according to TwoLAME documentation unsigned int mp2Size = 7200; unsigned char * mp2Buf = new unsigned char[mp2Size]; int ret; ret = twolame_encode_flush( twolame_opts, mp2Buf, mp2Size ); unsigned int written = getSink()->write( mp2Buf, ret); delete[] mp2Buf; // just let go data that could not be written if ( written < (unsigned int) ret ) { reportEvent( 2, "couldn't write all from encoder to underlying sink", ret - written); } getSink()->flush(); } /*------------------------------------------------------------------------------ * Close the encoding session *----------------------------------------------------------------------------*/ void TwoLameLibEncoder :: close ( void ) throw ( Exception ) { if ( isOpen() ) { flush(); twolame_close( &twolame_opts ); getSink()->close(); } } #endif // HAVE_TWOLAME_LIB darkice-1.2/src/FaacEncoder.cpp0000644000175000017500000002430312170706662013335 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : FaacEncoder.cpp Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/FaacEncoder.cpp $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif // compile the whole file only if faac support configured in #ifdef HAVE_FAAC_LIB #include "Exception.h" #include "Util.h" #include "FaacEncoder.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: FaacEncoder.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $"; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Open an encoding session *----------------------------------------------------------------------------*/ bool FaacEncoder :: open ( void ) throw ( Exception ) { if ( isOpen() ) { close(); } // open the underlying sink if ( !getSink()->open() ) { throw Exception( __FILE__, __LINE__, "faac lib opening underlying sink error"); } char * faacVersion; char * faacCopyright; faacEncGetVersion(&faacVersion, &faacCopyright); reportEvent(1, "Using faac codec version", faacVersion); encoderHandle = faacEncOpen(getOutSampleRate(), getInChannel(), &inputSamples, &maxOutputBytes); faacEncConfiguration * faacConfig; faacConfig = faacEncGetCurrentConfiguration(encoderHandle); faacConfig->aacObjectType = MAIN; faacConfig->mpegVersion = MPEG2; faacConfig->useTns = 1; faacConfig->shortctl = SHORTCTL_NORMAL; faacConfig->useLfe = 0; faacConfig->allowMidside = 1; faacConfig->bitRate = getOutBitrate() * 1000 / getOutChannel(); faacConfig->bandWidth = lowpass; faacConfig->quantqual = (unsigned long) (getOutQuality() * 1000.0); faacConfig->outputFormat = 1; faacConfig->inputFormat = FAAC_INPUT_16BIT; if (!faacEncSetConfiguration(encoderHandle, faacConfig)) { throw Exception(__FILE__, __LINE__, "error configuring faac library"); } // initialize the resampling coverter if needed if ( converter ) { #ifdef HAVE_SRC_LIB converterData.input_frames = 4096/((getInBitsPerSample() / 8) * getInChannel()); converterData.data_in = new float[converterData.input_frames*getInChannel()]; converterData.output_frames = (int) (converterData.input_frames * resampleRatio + 1); if ((int) inputSamples > getInChannel() * converterData.output_frames) { resampledOffset = new float[2 * inputSamples]; } else { resampledOffset = new float[2 * getInChannel() * converterData.input_frames]; } converterData.src_ratio = resampleRatio; converterData.end_of_input = 0; #else converter->initialize( resampleRatio, getInChannel()); //needed 2x(converted input samples) to handle offsets int outCount = 2 * getInChannel() * (inputSamples + 1); if (resampleRatio > 1) outCount = (int) (outCount * resampleRatio); resampledOffset = new short int[outCount]; #endif resampledOffsetSize = 0; } faacOpen = true; return true; } /*------------------------------------------------------------------------------ * Write data to the encoder *----------------------------------------------------------------------------*/ unsigned int FaacEncoder :: write ( const void * buf, unsigned int len ) throw ( Exception ) { if ( !isOpen() || len == 0 ) { return 0; } unsigned int channels = getInChannel(); unsigned int bitsPerSample = getInBitsPerSample(); unsigned int sampleSize = (bitsPerSample / 8) * channels; unsigned char * b = (unsigned char*) buf; unsigned int processed = len - (len % sampleSize); unsigned int nSamples = processed / sampleSize; unsigned char * faacBuf = new unsigned char[maxOutputBytes]; int samples = (int) nSamples * channels; int processedSamples = 0; if ( converter ) { unsigned int converted; #ifdef HAVE_SRC_LIB src_short_to_float_array ((short *) b, converterData.data_in, samples); converterData.input_frames = nSamples; converterData.data_out = resampledOffset + (resampledOffsetSize * channels); int srcError = src_process (converter, &converterData); if (srcError) throw Exception (__FILE__, __LINE__, "libsamplerate error: ", src_strerror (srcError)); converted = converterData.output_frames_gen; #else int inCount = nSamples; short int * shortBuffer = new short int[samples]; int outCount = (int) (inCount * resampleRatio); Util::conv( bitsPerSample, b, processed, shortBuffer, isInBigEndian()); converted = converter->resample( inCount, outCount+1, shortBuffer, &resampledOffset[resampledOffsetSize*channels]); delete[] shortBuffer; #endif resampledOffsetSize += converted; // encode samples (if enough) while(resampledOffsetSize - processedSamples >= inputSamples/channels) { int outputBytes; #ifdef HAVE_SRC_LIB short *shortData = new short[inputSamples]; src_float_to_short_array(resampledOffset + (processedSamples * channels), shortData, inputSamples) ; outputBytes = faacEncEncode(encoderHandle, (int32_t*) shortData, inputSamples, faacBuf, maxOutputBytes); delete [] shortData; #else outputBytes = faacEncEncode(encoderHandle, (int32_t*) &resampledOffset[processedSamples*channels], inputSamples, faacBuf, maxOutputBytes); #endif getSink()->write(faacBuf, outputBytes); processedSamples+=inputSamples/channels; } if (processedSamples && (int) resampledOffsetSize >= processedSamples) { resampledOffsetSize -= processedSamples; //move least part of resampled data to beginning if(resampledOffsetSize) #ifdef HAVE_SRC_LIB resampledOffset = (float *) memmove(resampledOffset, &resampledOffset[processedSamples*channels], resampledOffsetSize*channels*sizeof(float)); #else resampledOffset = (short *) memmove(resampledOffset, &resampledOffset[processedSamples*channels], resampledOffsetSize*sampleSize); #endif } } else { while (processedSamples < samples) { int outputBytes; int inSamples = samples - processedSamples < (int) inputSamples ? samples - processedSamples : inputSamples; outputBytes = faacEncEncode(encoderHandle, (int32_t*) (b + processedSamples/sampleSize), inSamples, faacBuf, maxOutputBytes); getSink()->write(faacBuf, outputBytes); processedSamples += inSamples; } } delete[] faacBuf; return samples * sampleSize; } /*------------------------------------------------------------------------------ * Flush the data from the encoder *----------------------------------------------------------------------------*/ void FaacEncoder :: flush ( void ) throw ( Exception ) { if ( !isOpen() ) { return; } getSink()->flush(); } /*------------------------------------------------------------------------------ * Close the encoding session *----------------------------------------------------------------------------*/ void FaacEncoder :: close ( void ) throw ( Exception ) { if ( isOpen() ) { flush(); faacEncClose(encoderHandle); faacOpen = false; getSink()->close(); } } #endif // HAVE_FAAC_LIB darkice-1.2/src/Source.h0000644000175000017500000001125512170706662012112 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : Source.h Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/Source.h $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef SOURCE_H #define SOURCE_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include "Referable.h" #include "Exception.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * A general data source * * @author $Author: rafael@riseup.net $ * @version $Revision: 553 $ */ class Source : public virtual Referable { private: protected: /** * Default Constructor. * * @exception Exception */ inline Source ( void ) throw ( Exception ) { } /** * Copy Constructor. * * @param source the object to copy. * @exception Exception */ inline Source ( const Source & source ) throw ( Exception ) { } /** * Assignment operator. * * @param source the object to assign to this one. * @return a reference to this object. * @exception Exception */ inline virtual Source & operator= ( const Source & source ) throw ( Exception ) { return *this; } public: /** * Destructor. * * @exception Exception */ inline virtual ~Source ( void ) throw ( Exception ) { } /** * Open the Source. * * @return true if opening was successful, false otherwise * @exception Exception */ virtual bool open ( void ) throw ( Exception ) = 0; /** * Check if the Source is open. * * @return true if the Source is open, false otherwise. */ virtual bool isOpen ( void ) const throw () = 0; /** * Check if the Source can be read from. * Blocks until the specified time for data to be available. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true if the Source is ready to be read from, * false otherwise. * @exception Exception */ virtual bool canRead ( unsigned int sec, unsigned int usec ) throw ( Exception ) = 0; /** * Read from the Source. * * @param buf the buffer to read into. * @param len the number of bytes to read into buf * @return the number of bytes read (may be less than len). * @exception Exception */ virtual unsigned int read ( void * buf, unsigned int len ) throw ( Exception ) = 0; /** * Close the Source. * * @exception Exception */ virtual void close ( void ) throw ( Exception ) = 0; }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* SOURCE_H */ darkice-1.2/src/IceCast2.cpp0000644000175000017500000002006412170706662012600 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : IceCast2.cpp Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/IceCast2.cpp $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_STDIO_H #include #else #error need stdio.h #endif #ifdef HAVE_STRING_H #include #else #error need string.h #endif #ifdef HAVE_MATH_H #include #else #error need math.h #endif #include "Exception.h" #include "Source.h" #include "Sink.h" #include "Util.h" #include "IceCast2.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: IceCast2.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $"; /*------------------------------------------------------------------------------ * Expected positive response from server begins like this. *----------------------------------------------------------------------------*/ static const char responseOK[] = "HTTP/1.0 200"; static const char responseWrongPasswd[] = "HTTP/1.0 401"; static const char responseForbidden[] = "HTTP/1.0 403"; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Initialize the object *----------------------------------------------------------------------------*/ void IceCast2 :: init ( StreamFormat format, const char * mountPoint, const char * description ) throw ( Exception ) { this->format = format; this->mountPoint = Util::strDup( mountPoint); this->description = description ? Util::strDup( description) : 0; } /*------------------------------------------------------------------------------ * De-initialize the object *----------------------------------------------------------------------------*/ void IceCast2 :: strip ( void ) throw ( Exception ) { delete[] mountPoint; if ( description ) { delete[] description; } } /*------------------------------------------------------------------------------ * Log in to the IceCast2 server *----------------------------------------------------------------------------*/ bool IceCast2 :: sendLogin ( void ) throw ( Exception ) { Sink * sink = getSink(); Source * source = getSocket(); const char * str; const int buflen = 1024; // some small buffer size char resp[buflen]; // a little buffer unsigned int len; unsigned int lenExpected; if ( !source->isOpen() ) { return false; } if ( !sink->isOpen() ) { return false; } // send the request, a string like: // "SOURCE ICE/1.0" str = "SOURCE /"; sink->write( str, strlen( str)); str = getMountPoint(); sink->write( str, strlen( str)); str = " HTTP/1.0"; sink->write( str, strlen( str)); // send the content type, Ogg Vorbis str = "\nContent-type: "; sink->write( str, strlen( str)); switch ( format ) { case mp3: case mp2: str = "audio/mpeg"; break; case oggVorbis: str = "application/ogg"; break; case oggOpus: str = "application/ogg"; break; case aac: str = "audio/aac"; break; case aacp: str = "audio/aacp"; break; default: throw Exception( __FILE__, __LINE__, "unsupported stream format", format); break; } sink->write( str, strlen( str)); // send the authentication info str = "\nAuthorization: Basic "; sink->write( str, strlen(str)); { // send source: encoded as base64 const char * source = "source:"; const char * pwd = getPassword(); char * tmp = new char[Util::strLen(source) + Util::strLen(pwd) + 1]; Util::strCpy( tmp, source); Util::strCat( tmp, pwd); char * base64 = Util::base64Encode( tmp); delete[] tmp; sink->write( base64, strlen(base64)); delete[] base64; } // send user agent info str = "\nUser-Agent: DarkIce/" VERSION " (http://code.google.com/p/darkice/)"; sink->write( str, strlen( str)); // send the ice- headers str = "\nice-bitrate: "; sink->write( str, strlen( str)); sprintf( resp, "%d", getBitRate()); sink->write( resp, strlen( resp)); str = "\nice-public: "; sink->write( str, strlen( str)); str = getIsPublic() ? "1" : "0"; sink->write( str, strlen( str)); if ( getName() ) { str = "\nice-name: "; sink->write( str, strlen( str)); str = getName(); sink->write( str, strlen( str)); } if ( getDescription() ) { str = "\nice-description: "; sink->write( str, strlen( str)); str = getDescription(); sink->write( str, strlen( str)); } if ( getUrl() ) { str = "\nice-url: "; sink->write( str, strlen( str)); str = getUrl(); sink->write( str, strlen( str)); } if ( getGenre() ) { str = "\nice-genre: "; sink->write( str, strlen( str)); str = getGenre(); sink->write( str, strlen( str)); } str = "\n\n"; sink->write( str, strlen( str)); sink->flush(); // read the response, expected response begins with responseOK lenExpected = Util::strLen( responseOK); if ( (len = source->read( resp, buflen )) < lenExpected ) { return false; // short read, no need to continue } resp[lenExpected] = '\x00'; // end string, truncate to expected length reportEvent(5,resp); if ( Util::strEq( resp, responseWrongPasswd) ) { throw Exception( __FILE__, __LINE__, "Icecast2 - wrong password"); } if ( Util::strEq( resp, responseForbidden) ) { throw Exception( __FILE__, __LINE__, "Icecast2 - forbidden. Is the mountpoint occupied, or maximum sources reached?"); } if ( !Util::strEq( resp, responseOK) ) { // some unexpected response from server throw Exception( __FILE__, __LINE__, "Icecast2 - Unexpected response from server"); } // suck anything that the other side has to say while ( source->canRead( 0, 0) && (len = source->read( resp, buflen ))); // all is well, we are connected return true; } darkice-1.2/src/VorbisLibEncoder.cpp0000644000175000017500000003717312170706662014407 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : VorbisLibEncoder.cpp Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/VorbisLibEncoder.cpp $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif // compile only if configured for Ogg Vorbis #ifdef HAVE_VORBIS_LIB #include "Exception.h" #include "Util.h" #include "VorbisLibEncoder.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: VorbisLibEncoder.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $"; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Initialize the encoder *----------------------------------------------------------------------------*/ void VorbisLibEncoder :: init ( unsigned int outMaxBitrate ) throw ( Exception ) { this->outMaxBitrate = outMaxBitrate; if ( getInBitsPerSample() != 16 && getInBitsPerSample() != 8 ) { throw Exception( __FILE__, __LINE__, "specified bits per sample not supported", getInBitsPerSample() ); } if ( getInChannel() != 1 && getInChannel() != 2 ) { throw Exception( __FILE__, __LINE__, "unsupported number of channels for the encoder", getInChannel() ); } if ( getOutSampleRate() == getInSampleRate() ) { resampleRatio = 1; converter = 0; } else { resampleRatio = ( (double) getOutSampleRate() / (double) getInSampleRate() ); // Determine if we can use linear interpolation. // The inverse of the ratio must be a power of two for linear mode to // be of sufficient quality. bool useLinear = true; double inverse = 1 / resampleRatio; int integer = (int) inverse; // Check that the inverse of the ratio is an integer if( integer == inverse ) { while( useLinear && integer ) { // Loop through the bits // If the lowest order bit is not the only one set if( integer & 1 && integer != 1 ) { // Not a power of two; cannot use linear useLinear = false; } else { // Shift all the bits over and try again integer >>= 1; } } } else { useLinear = false; } // If we get here and useLinear is still true, then we have // a power of two. // open the aflibConverter in // - high quality // - linear or quadratic (non-linear) based on algorithm // - not filter interpolation #ifdef HAVE_SRC_LIB int srcError = 0; converter = src_new(useLinear == true ? SRC_LINEAR : SRC_SINC_FASTEST, getInChannel(), &srcError); if(srcError) throw Exception (__FILE__, __LINE__, "libsamplerate error: ", src_strerror (srcError)); #else converter = new aflibConverter( true, useLinear, false); #endif } encoderOpen = false; } /*------------------------------------------------------------------------------ * Open an encoding session *----------------------------------------------------------------------------*/ bool VorbisLibEncoder :: open ( void ) throw ( Exception ) { int ret; if ( isOpen() ) { close(); } // open the underlying sink if ( !getSink()->open() ) { throw Exception( __FILE__, __LINE__, "vorbis lib opening underlying sink error"); } vorbis_info_init( &vorbisInfo); switch ( getOutBitrateMode() ) { case cbr: { int maxBitrate = getOutMaxBitrate() * 1000; if ( !maxBitrate ) { maxBitrate = -1; } if ( (ret = vorbis_encode_init( &vorbisInfo, getOutChannel(), getOutSampleRate(), maxBitrate, getOutBitrate() * 1000, -1)) ) { throw Exception( __FILE__, __LINE__, "vorbis encode init error", ret); } } break; case abr: /* set non-managed VBR around the average bitrate */ ret = vorbis_encode_setup_managed( &vorbisInfo, getOutChannel(), getOutSampleRate(), -1, getOutBitrate() * 1000, -1 ) || vorbis_encode_ctl( &vorbisInfo, OV_ECTL_RATEMANAGE_SET, NULL) || vorbis_encode_setup_init( &vorbisInfo); if ( ret ) { throw Exception( __FILE__, __LINE__, "vorbis encode init error", ret); } break; case vbr: if ( (ret = vorbis_encode_init_vbr( &vorbisInfo, getOutChannel(), getOutSampleRate(), getOutQuality() )) ) { throw Exception( __FILE__, __LINE__, "vorbis encode init error", ret); } break; } if ( (ret = vorbis_analysis_init( &vorbisDspState, &vorbisInfo)) ) { throw Exception( __FILE__, __LINE__, "vorbis analysis init error", ret); } if ( (ret = vorbis_block_init( &vorbisDspState, &vorbisBlock)) ) { throw Exception( __FILE__, __LINE__, "vorbis block init error", ret); } if ( (ret = ogg_stream_init( &oggStreamState, 0)) ) { throw Exception( __FILE__, __LINE__, "ogg stream init error", ret); } // create an empty vorbis_comment structure vorbis_comment_init( &vorbisComment); /* FIXME: removed title metadata when the sink type was changed from * CastSink to the more generic Sink. * make sure to add metadata somehow // Add comment to vorbis headers to show title in players // stupid cast to (char*) because of stupid vorbis API if ( getSink()->getName() ) { vorbis_comment_add_tag(&vorbisComment, "TITLE", (char*) getSink()->getName()); } */ // create the vorbis stream headers and send them to the underlying sink ogg_packet header; ogg_packet commentHeader; ogg_packet codeHeader; if ( (ret = vorbis_analysis_headerout( &vorbisDspState, &vorbisComment, &header, &commentHeader, &codeHeader )) ) { throw Exception( __FILE__, __LINE__, "vorbis header init error", ret); } ogg_stream_packetin( &oggStreamState, &header); ogg_stream_packetin( &oggStreamState, &commentHeader); ogg_stream_packetin( &oggStreamState, &codeHeader); ogg_page oggPage; while ( ogg_stream_flush( &oggStreamState, &oggPage) ) { getSink()->write( oggPage.header, oggPage.header_len); getSink()->write( oggPage.body, oggPage.body_len); } vorbis_comment_clear( &vorbisComment ); // initialize the resampling coverter if needed if ( converter ) { #ifdef HAVE_SRC_LIB converterData.input_frames = 4096/((getInBitsPerSample() / 8) * getInChannel()); converterData.data_in = new float[converterData.input_frames*getInChannel()]; converterData.output_frames = (int) (converterData.input_frames * resampleRatio + 1); converterData.data_out = new float[getInChannel() * converterData.output_frames]; converterData.src_ratio = resampleRatio; converterData.end_of_input = 0; #else converter->initialize( resampleRatio, getInChannel()); #endif } encoderOpen = true; return true; } /*------------------------------------------------------------------------------ * Write data to the encoder *----------------------------------------------------------------------------*/ unsigned int VorbisLibEncoder :: write ( const void * buf, unsigned int len ) throw ( Exception ) { if ( !isOpen() || len == 0 ) { return 0; } unsigned int channels = getInChannel(); unsigned int bitsPerSample = getInBitsPerSample(); unsigned int sampleSize = (bitsPerSample / 8) * channels; unsigned int i; if ( getInChannel() == 2 && getOutChannel() == 1 ) { for ( i = 0; i < len/sampleSize; i++) { if ( bitsPerSample == 8 ) { char * buf8 = (char *) buf; unsigned int ix = sampleSize * i; unsigned int iix = ix; buf8[i] = (buf8[ix] + buf8[++iix]) / 2; } if ( bitsPerSample == 16 ) { short * buf16 = (short *) buf; unsigned int ix = (bitsPerSample >> 3) * i; unsigned int iix = ix; buf16[i] = (buf16[ix] + buf16[++iix]) / 2; } } len >>= 1; channels = 1; } sampleSize = (bitsPerSample / 8) * channels; unsigned char * b = (unsigned char*) buf; unsigned int processed = len - (len % sampleSize); unsigned int nSamples = processed / sampleSize; float ** vorbisBuffer; // convert the byte-based raw input into a short buffer // with channels still interleaved unsigned int totalSamples = nSamples * channels; short int * shortBuffer = new short int[totalSamples]; Util::conv( bitsPerSample, b, processed, shortBuffer, isInBigEndian()); if ( converter ) { // resample if needed int inCount = nSamples; int outCount = (int) (inCount * resampleRatio); short int * resampledBuffer = new short int[(outCount+1)* channels]; int converted; #ifdef HAVE_SRC_LIB converterData.input_frames = nSamples; src_short_to_float_array (shortBuffer, converterData.data_in, totalSamples); int srcError = src_process (converter, &converterData); if (srcError) throw Exception (__FILE__, __LINE__, "libsamplerate error: ", src_strerror (srcError)); converted = converterData.output_frames_gen; src_float_to_short_array(converterData.data_out, resampledBuffer, converted*channels); #else converted = converter->resample( inCount, outCount, shortBuffer, resampledBuffer ); #endif vorbisBuffer = vorbis_analysis_buffer( &vorbisDspState, converted); Util::conv( resampledBuffer, converted * channels, vorbisBuffer, channels); delete[] resampledBuffer; vorbis_analysis_wrote( &vorbisDspState, converted); } else { vorbisBuffer = vorbis_analysis_buffer( &vorbisDspState, nSamples); Util::conv( shortBuffer, totalSamples, vorbisBuffer, channels); vorbis_analysis_wrote( &vorbisDspState, nSamples); } delete[] shortBuffer; vorbisBlocksOut(); return processed; } /*------------------------------------------------------------------------------ * Flush the data from the encoder *----------------------------------------------------------------------------*/ void VorbisLibEncoder :: flush ( void ) throw ( Exception ) { if ( !isOpen() ) { return; } vorbis_analysis_wrote( &vorbisDspState, 0); vorbisBlocksOut(); getSink()->flush(); } /*------------------------------------------------------------------------------ * Send pending Vorbis blocks to the underlying stream *----------------------------------------------------------------------------*/ void VorbisLibEncoder :: vorbisBlocksOut ( void ) throw ( Exception ) { while ( 1 == vorbis_analysis_blockout( &vorbisDspState, &vorbisBlock) ) { ogg_packet oggPacket; ogg_page oggPage; vorbis_analysis( &vorbisBlock, &oggPacket); vorbis_bitrate_addblock( &vorbisBlock); while ( vorbis_bitrate_flushpacket( &vorbisDspState, &oggPacket) ) { ogg_stream_packetin( &oggStreamState, &oggPacket); while ( ogg_stream_pageout( &oggStreamState, &oggPage) ) { int written; written = getSink()->write(oggPage.header, oggPage.header_len); written += getSink()->write( oggPage.body, oggPage.body_len); if ( written < oggPage.header_len + oggPage.body_len ) { // just let go data that could not be written reportEvent( 2, "couldn't write full vorbis data to underlying sink", oggPage.header_len + oggPage.body_len - written); } } } } } /*------------------------------------------------------------------------------ * Close the encoding session *----------------------------------------------------------------------------*/ void VorbisLibEncoder :: close ( void ) throw ( Exception ) { if ( isOpen() ) { flush(); ogg_stream_clear( &oggStreamState); vorbis_block_clear( &vorbisBlock); vorbis_dsp_clear( &vorbisDspState); vorbis_comment_clear( &vorbisComment); vorbis_info_clear( &vorbisInfo); encoderOpen = false; getSink()->close(); } } #endif // HAVE_VORBIS_LIB darkice-1.2/src/FileCast.cpp0000644000175000017500000000505112170706662012674 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : FileCast.cpp Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/FileCast.cpp $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_STDIO_H #include #else #error need stdio.h #endif #ifdef HAVE_STRING_H #include #else #error need string.h #endif #include "Exception.h" #include "Source.h" #include "Sink.h" #include "Util.h" #include "FileCast.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: FileCast.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $"; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Open the connection *----------------------------------------------------------------------------*/ bool FileCast :: open ( void ) throw ( Exception ) { if ( isOpen() ) { return false; } if ( !targetFile->open() ) { return false; } return true; } darkice-1.2/src/aflibConverter.h0000644000175000017500000001553112170706611013612 00000000000000/* * Copyright: (C) 2000 Julius O. Smith * * 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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Julius O. Smith jos@ccrma.stanford.edu * */ /* This code was modified by Bruce Forsberg (forsberg@tns.net) to make it into a C++ class */ #ifndef _AFLIBCONVERTER_H_ #define _AFLIBCONVERTER_H_ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifndef MAX #define MAX(x,y) ((x)>(y) ?(x):(y)) #endif #ifndef MIN #define MIN(x,y) ((x)<(y) ?(x):(y)) #endif #define MAX_HWORD (32767) #define MIN_HWORD (-32768) #define IBUFFSIZE 4096 /* Input buffer size */ /*! \class aflibConverter \brief Provides sample rate conversion. This class will perform audio resampling. With the constructor you can choose the type of resampling to be done. Simple linear interpolation can be done by setting linear_interpolation to be TRUE in the constructor. The other two flags are ignored if this is set. If linear_interpolation is FALSE then some form of filtering will be done. IF high_quality is FALSE then a small filter will be performed. If high_quality is TRUE then a large filter (higher quality) will be performed. For both the small and large filters another parameter can be specified, filter_interpolation. With filter_interpolation set then the filter coefficients used for both the small and large filtering will be interpolated as well. This class was designed to stream audio data. It also expects audio data as 16 bit values. Each time a new stream is started some initialization needs to be done. Thus the function initialize should be called to initialize everything. This initialize function will set the conversion factor as well as a multiplecation factor for volume. The volume only applies to the small and large filter. Since this filter uses a history of the audio data it is possible for it to vary in amplitude. This allows users to scale the data. This class will work on any number of channels. Once everything is specified then resample should be called as many times as is necessary to process all the data. The value inCount will be returned indicating how many inArray samples were actually used to produce the output. This value can be used to indicate where the next block of inArray data should start. The resample function is driven by the outCount value specified. The inArray should contain at least: outCount / factor + extra_samples. extra_samples depends on the type of filtering done. As a rule of thumb 50 should be adequate for any type of filter. */ class aflibData; class aflibConverter { public: // Available contructors and destructors aflibConverter ( bool high_quality, bool linear_interpolation, bool filter_interpolation); ~aflibConverter(); void initialize( double factor, /* factor = Sndout/Sndin */ int channels, /* number of sound channels */ double volume = 1.0); /* factor to multiply amplitude */ int resample( /* number of output samples returned */ int& inCount, /* number of input samples to convert */ int outCount, /* number of output samples to compute */ short inArray[], /* input array data (length inCount * nChans) */ short outArray[]);/* output array data (length outCount * nChans) */ private: aflibConverter(); aflibConverter(const aflibConverter& op); const aflibConverter& operator=(const aflibConverter& op); int err_ret(const char *s); void deleteMemory(); int readData( int inCount, /* _total_ number of frames in input file */ short inArray[], /* input data */ short *outPtr[], /* array receiving chan samps */ int dataArraySize, /* size of these arrays */ int Xoff, /* read into input array starting at this index */ bool init_count); inline short WordToHword(int v, int scl) { short out; int llsb = (1<<(scl-1)); v += llsb; /* round */ v >>= scl; if (v>MAX_HWORD) { v = MAX_HWORD; } else if (v < MIN_HWORD) { v = MIN_HWORD; } out = (short) v; return out; }; int SrcLinear( short X[], short Y[], double factor, unsigned int *Time, unsigned short& Nx, unsigned short Nout); int SrcUp( short X[], short Y[], double factor, unsigned int *Time, unsigned short& Nx, unsigned short Nout, unsigned short Nwing, unsigned short LpScl, short Imp[], short ImpD[], bool Interp); int SrcUD( short X[], short Y[], double factor, unsigned int *Time, unsigned short& Nx, unsigned short Nout, unsigned short Nwing, unsigned short LpScl, short Imp[], short ImpD[], bool Interp); int FilterUp( short Imp[], short ImpD[], unsigned short Nwing, bool Interp, short *Xp, short Ph, short Inc); int FilterUD( short Imp[], short ImpD[], unsigned short Nwing, bool Interp, short *Xp, short Ph, short Inc, unsigned short dhb); int resampleFast( /* number of output samples returned */ int& inCount, /* number of input samples to convert */ int outCount, /* number of output samples to compute */ short inArray[], /* input array data (length inCount * nChans) */ short outArray[]);/* output array data (length outCount * nChans) */ int resampleWithFilter( /* number of output samples returned */ int& inCount, /* number of input samples to convert */ int outCount, /* number of output samples to compute */ short inArray[], /* input array data (length inCount * nChans) */ short outArray[], /* output array data (length outCount * nChans) */ short Imp[], short ImpD[], unsigned short LpScl, unsigned short Nmult, unsigned short Nwing); static short SMALL_FILTER_IMP[]; static short LARGE_FILTER_IMP[]; bool interpFilt; bool largeFilter; bool linearInterp; short ** _II; short ** _JJ; unsigned int _Time; double _factor; int _nChans; bool _initial; double _vol; }; #endif darkice-1.2/src/OssDspSource.h0000644000175000017500000001677212170706662013257 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : OssDspSource.h Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/OssDspSource.h $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef OSS_DSP_SOURCE_H #define OSS_DSP_SOURCE_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include "Reporter.h" #include "AudioSource.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * An audio input based on /dev/dsp-like raw devices * * @author $Author: rafael@riseup.net $ * @version $Revision: 553 $ */ class OssDspSource : public AudioSource, public virtual Reporter { private: /** * The file name of the OSS DSP device (e.g. /dev/dsp or /dev/dsp0). */ char * fileName; /** * The low-level file descriptor of the OSS DSP device. */ int fileDescriptor; /** * Indicates wether the low-level OSS DSP device is in a recording * state. */ bool running; protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline OssDspSource ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } /** * Initialize the object * * @param name the file name of the OSS DSP device. * @exception Exception */ void init ( const char * name ) throw ( Exception ); /** * De-iitialize the object * * @exception Exception */ void strip ( void ) throw ( Exception ); public: /** * Constructor. * * @param name the file name of the OSS DSP device * (e.g. /dev/dsp or /dev/dsp0). * @param sampleRate samples per second (e.g. 44100 for 44.1kHz). * @param bitsPerSample bits per sample (e.g. 16 bits). * @param channel number of channels of the audio source * (e.g. 1 for mono, 2 for stereo, etc.). * @exception Exception */ inline OssDspSource ( const char * name, int sampleRate = 44100, int bitsPerSample = 16, int channel = 2 ) throw ( Exception ) : AudioSource( sampleRate, bitsPerSample, channel) { init( name); } /** * Copy Constructor. * * @param ods the object to copy. * @exception Exception */ inline OssDspSource ( const OssDspSource & ods ) throw ( Exception ) : AudioSource( ods ) { init( ods.fileName); } /** * Destructor. * * @exception Exception */ inline virtual ~OssDspSource ( void ) throw ( Exception ) { strip(); } /** * Assignment operator. * * @param ds the object to assign to this one. * @return a reference to this object. * @exception Exception */ inline virtual OssDspSource & operator= ( const OssDspSource & ds ) throw ( Exception ) { if ( this != &ds ) { strip(); AudioSource::operator=( ds); init( ds.fileName); } return *this; } /** * Tell if the data from this source comes in big or little endian. * * @return true if the source is big endian, false otherwise */ virtual bool isBigEndian ( void ) const throw (); /** * Open the OssDspSource. * This does not put the OSS DSP device into recording mode. * To start getting samples, call either canRead() or read(). * * @return true if opening was successful, false otherwise * @exception Exception * * @see #canRead * @see #read */ virtual bool open ( void ) throw ( Exception ); /** * Check if the OssDspSource is open. * * @return true if the OssDspSource is open, false otherwise. */ inline virtual bool isOpen ( void ) const throw () { return fileDescriptor != 0; } /** * Check if the OssDspSource can be read from. * Blocks until the specified time for data to be available. * Puts the OSS DSP device into recording mode. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true if the OssDspSource is ready to be read from, * false otherwise. * @exception Exception */ virtual bool canRead ( unsigned int sec, unsigned int usec ) throw ( Exception ); /** * Read from the OssDspSource. * Puts the OSS DSP device into recording mode. * * @param buf the buffer to read into. * @param len the number of bytes to read into buf * @return the number of bytes read (may be less than len). * @exception Exception */ virtual unsigned int read ( void * buf, unsigned int len ) throw ( Exception ); /** * Close the OssDspSource. * * @exception Exception */ virtual void close ( void ) throw ( Exception ); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* OSS_DSP_SOURCE_H */ darkice-1.2/src/SerialUlaw.cpp0000644000175000017500000002246312170706662013260 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000 Tyrell Corporation. Copyright (c) 2006 Clyde Stubbs. Tyrell DarkIce File : SerialUlaw.cpp Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $Source: /cvsroot/darkice/darkice/src/SerialUlaw.cpp,v $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #include "SerialUlaw.h" #ifdef SUPPORT_SERIAL_ULAW // only compile this code if there's support for it #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_STDIO_H #include #else #error need stdio.h #endif #ifdef HAVE_UNISTD_H #include #else #error need unistd.h #endif #ifdef HAVE_STRING_H #include #else #error need string.h #endif #ifdef HAVE_SYS_TYPES_H #include #else #error need sys/types.h #endif #ifdef HAVE_SYS_STAT_H #include #else #error need sys/stat.h #endif #ifdef HAVE_FCNTL_H #include #else #error need fcntl.h #endif #ifdef HAVE_SYS_TIME_H #include #else #error need sys/time.h #endif #ifdef HAVE_SYS_IOCTL_H #include #else #error need sys/ioctl.h #endif #ifdef HAVE_TERMIOS_H #include #else #error need termios.h #endif #include "Util.h" #include "Exception.h" #include "SerialUlaw.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: SerialUlaw.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $"; /*------------------------------------------------------------------------------ * Ulaw decode table *----------------------------------------------------------------------------*/ static unsigned int ulawdecode[256] = { 0x8284,0x8684,0x8a84,0x8e84,0x9284,0x9684,0x9a84,0x9e84, 0xa284,0xa684,0xaa84,0xae84,0xb284,0xb684,0xba84,0xbe84, 0xc184,0xc384,0xc584,0xc784,0xc984,0xcb84,0xcd84,0xcf84, 0xd184,0xd384,0xd584,0xd784,0xd984,0xdb84,0xdd84,0xdf84, 0xe104,0xe204,0xe304,0xe404,0xe504,0xe604,0xe704,0xe804, 0xe904,0xea04,0xeb04,0xec04,0xed04,0xee04,0xef04,0xf004, 0xf0c4,0xf144,0xf1c4,0xf244,0xf2c4,0xf344,0xf3c4,0xf444, 0xf4c4,0xf544,0xf5c4,0xf644,0xf6c4,0xf744,0xf7c4,0xf844, 0xf8a4,0xf8e4,0xf924,0xf964,0xf9a4,0xf9e4,0xfa24,0xfa64, 0xfaa4,0xfae4,0xfb24,0xfb64,0xfba4,0xfbe4,0xfc24,0xfc64, 0xfc94,0xfcb4,0xfcd4,0xfcf4,0xfd14,0xfd34,0xfd54,0xfd74, 0xfd94,0xfdb4,0xfdd4,0xfdf4,0xfe14,0xfe34,0xfe54,0xfe74, 0xfe8c,0xfe9c,0xfeac,0xfebc,0xfecc,0xfedc,0xfeec,0xfefc, 0xff0c,0xff1c,0xff2c,0xff3c,0xff4c,0xff5c,0xff6c,0xff7c, 0xff88,0xff90,0xff98,0xffa0,0xffa8,0xffb0,0xffb8,0xffc0, 0xffc8,0xffd0,0xffd8,0xffe0,0xffe8,0xfff0,0xfff8,0x0000, 0x7d7c,0x797c,0x757c,0x717c,0x6d7c,0x697c,0x657c,0x617c, 0x5d7c,0x597c,0x557c,0x517c,0x4d7c,0x497c,0x457c,0x417c, 0x3e7c,0x3c7c,0x3a7c,0x387c,0x367c,0x347c,0x327c,0x307c, 0x2e7c,0x2c7c,0x2a7c,0x287c,0x267c,0x247c,0x227c,0x207c, 0x1efc,0x1dfc,0x1cfc,0x1bfc,0x1afc,0x19fc,0x18fc,0x17fc, 0x16fc,0x15fc,0x14fc,0x13fc,0x12fc,0x11fc,0x10fc,0x0ffc, 0x0f3c,0x0ebc,0x0e3c,0x0dbc,0x0d3c,0x0cbc,0x0c3c,0x0bbc, 0x0b3c,0x0abc,0x0a3c,0x09bc,0x093c,0x08bc,0x083c,0x07bc, 0x075c,0x071c,0x06dc,0x069c,0x065c,0x061c,0x05dc,0x059c, 0x055c,0x051c,0x04dc,0x049c,0x045c,0x041c,0x03dc,0x039c, 0x036c,0x034c,0x032c,0x030c,0x02ec,0x02cc,0x02ac,0x028c, 0x026c,0x024c,0x022c,0x020c,0x01ec,0x01cc,0x01ac,0x018c, 0x0174,0x0164,0x0154,0x0144,0x0134,0x0124,0x0114,0x0104, 0x00f4,0x00e4,0x00d4,0x00c4,0x00b4,0x00a4,0x0094,0x0084, 0x0078,0x0070,0x0068,0x0060,0x0058,0x0050,0x0048,0x0040, 0x0038,0x0030,0x0028,0x0020,0x0018,0x0010,0x0008,0x0000, }; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Tell if source id big endian *----------------------------------------------------------------------------*/ bool SerialUlaw :: isBigEndian ( void ) const throw () { return false; } /*------------------------------------------------------------------------------ * Initialize the object *----------------------------------------------------------------------------*/ void SerialUlaw :: init ( const char * name ) throw ( Exception ) { fileName = Util::strDup( name); fileDescriptor = 0; running = false; } /*------------------------------------------------------------------------------ * De-initialize the object *----------------------------------------------------------------------------*/ void SerialUlaw :: strip ( void ) throw ( Exception ) { if ( isOpen() ) { close(); } delete[] fileName; } /*------------------------------------------------------------------------------ * Open the audio source *----------------------------------------------------------------------------*/ bool SerialUlaw :: open ( void ) throw ( Exception ) { struct termios ts; if ( isOpen() ) { return false; } switch ( getBitsPerSample() ) { case 16: break; default: return false; } if (getChannel() != 1) { reportEvent(3, "Only mono input supported for Serial ULaw"); return false; } if (getSampleRate() != 8000) { reportEvent(3, "Only 8000 Hz sample rate supported for Serial ULaw"); return false; } if ( (fileDescriptor = ::open( fileName, O_RDONLY)) == -1 ) { fileDescriptor = 0; return false; } if(tcgetattr(fileDescriptor, &ts) < 0) { close(); throw Exception( __FILE__, __LINE__, "can't get tty settings"); } cfsetispeed(&ts, B115200); cfmakeraw(&ts); ts.c_cflag |= CLOCAL; if(tcsetattr(fileDescriptor, TCSANOW, &ts) < 0) { close(); throw Exception( __FILE__, __LINE__, "can't set tty settings"); } tcflush(fileDescriptor, TCIFLUSH); return true; } /*------------------------------------------------------------------------------ * Check whether read() would return anything *----------------------------------------------------------------------------*/ bool SerialUlaw :: canRead ( unsigned int sec, unsigned int usec ) throw ( Exception ) { fd_set fdset; struct timeval tv; int ret; if ( !isOpen() ) { return false; } FD_ZERO( &fdset); FD_SET( fileDescriptor, &fdset); tv.tv_sec = sec; tv.tv_usec = usec; ret = select( fileDescriptor + 1, &fdset, NULL, NULL, &tv); if ( ret == -1 ) { throw Exception( __FILE__, __LINE__, "select error"); } return ret > 0; } /*------------------------------------------------------------------------------ * Read from the audio source *----------------------------------------------------------------------------*/ unsigned int SerialUlaw :: read ( void * buf, unsigned int len ) throw ( Exception ) { ssize_t ret; unsigned char ubuf[256], * ptr; int i, plen; if ( !isOpen() ) { return 0; } ret = 0; ptr = (unsigned char *)buf; while(len > 1) { plen = sizeof(ubuf); if (plen > (int)len/2) { plen = len/2; } plen = ::read( fileDescriptor, ubuf, plen); if(plen < 0) { perror("read"); throw Exception( __FILE__, __LINE__, "read error"); } for(i = 0 ; i != plen ; i++) { *ptr++ = ulawdecode[ubuf[i]] & 0xFF; *ptr++ = ulawdecode[ubuf[i]] >> 8; } len -= plen*2; ret += plen*2; } running = true; return ret; } /*------------------------------------------------------------------------------ * Close the audio source *----------------------------------------------------------------------------*/ void SerialUlaw :: close ( void ) throw ( Exception ) { if ( !isOpen() ) { return; } ::close( fileDescriptor); fileDescriptor = 0; running = false; } #endif // SUPPORT_SERIAL_ULAW darkice-1.2/src/Makefile.in0000644000175000017500000006157212170707117012551 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = darkice$(EXEEXT) subdir = src DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/config.h.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am__darkice_SOURCES_DIST = AudioEncoder.h AudioSource.h \ AudioSource.cpp BufferedSink.cpp BufferedSink.h CastSink.cpp \ CastSink.h FileSink.h FileSink.cpp Connector.cpp Connector.h \ MultiThreadedConnector.cpp MultiThreadedConnector.h \ DarkIce.cpp DarkIce.h Exception.cpp Exception.h IceCast.cpp \ IceCast.h IceCast2.cpp IceCast2.h ShoutCast.cpp ShoutCast.h \ FileCast.h FileCast.cpp LameLibEncoder.cpp LameLibEncoder.h \ TwoLameLibEncoder.cpp TwoLameLibEncoder.h VorbisLibEncoder.cpp \ VorbisLibEncoder.h OpusLibEncoder.cpp OpusLibEncoder.h \ FaacEncoder.cpp FaacEncoder.h aacPlusEncoder.cpp \ aacPlusEncoder.h OssDspSource.cpp OssDspSource.h \ SerialUlaw.cpp SerialUlaw.h SolarisDspSource.cpp \ SolarisDspSource.h Ref.h Referable.h Sink.h Source.h \ TcpSocket.cpp TcpSocket.h Util.cpp Util.h ConfigSection.h \ ConfigSection.cpp DarkIceConfig.h DarkIceConfig.cpp Reporter.h \ Reporter.cpp AlsaDspSource.h AlsaDspSource.cpp \ PulseAudioDspSource.h PulseAudioDspSource.cpp JackDspSource.h \ JackDspSource.cpp main.cpp aflibDebug.h aflibDebug.cc \ aflibConverter.h aflibConverter.cc aflibConverterLargeFilter.h \ aflibConverterSmallFilter.h @HAVE_SRC_LIB_FALSE@am__objects_1 = aflibDebug.$(OBJEXT) \ @HAVE_SRC_LIB_FALSE@ aflibConverter.$(OBJEXT) am_darkice_OBJECTS = AudioSource.$(OBJEXT) BufferedSink.$(OBJEXT) \ CastSink.$(OBJEXT) FileSink.$(OBJEXT) Connector.$(OBJEXT) \ MultiThreadedConnector.$(OBJEXT) DarkIce.$(OBJEXT) \ Exception.$(OBJEXT) IceCast.$(OBJEXT) IceCast2.$(OBJEXT) \ ShoutCast.$(OBJEXT) FileCast.$(OBJEXT) \ LameLibEncoder.$(OBJEXT) TwoLameLibEncoder.$(OBJEXT) \ VorbisLibEncoder.$(OBJEXT) OpusLibEncoder.$(OBJEXT) \ FaacEncoder.$(OBJEXT) aacPlusEncoder.$(OBJEXT) \ OssDspSource.$(OBJEXT) SerialUlaw.$(OBJEXT) \ SolarisDspSource.$(OBJEXT) TcpSocket.$(OBJEXT) Util.$(OBJEXT) \ ConfigSection.$(OBJEXT) DarkIceConfig.$(OBJEXT) \ Reporter.$(OBJEXT) AlsaDspSource.$(OBJEXT) \ PulseAudioDspSource.$(OBJEXT) JackDspSource.$(OBJEXT) \ main.$(OBJEXT) $(am__objects_1) darkice_OBJECTS = $(am_darkice_OBJECTS) darkice_LDADD = $(LDADD) darkice_DEPENDENCIES = DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(darkice_SOURCES) $(EXTRA_darkice_SOURCES) DIST_SOURCES = $(am__darkice_SOURCES_DIST) $(EXTRA_darkice_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) AACPLUS_INCFLAGS = @AACPLUS_INCFLAGS@ AACPLUS_LDFLAGS = @AACPLUS_LDFLAGS@ ACLOCAL = @ACLOCAL@ ALSA_INCFLAGS = @ALSA_INCFLAGS@ ALSA_LDFLAGS = @ALSA_LDFLAGS@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG_CXXFLAGS = @DEBUG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FAAC_INCFLAGS = @FAAC_INCFLAGS@ FAAC_LDFLAGS = @FAAC_LDFLAGS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JACK_CFLAGS = @JACK_CFLAGS@ JACK_INCFLAGS = @JACK_INCFLAGS@ JACK_LDFLAGS = @JACK_LDFLAGS@ LAME_INCFLAGS = @LAME_INCFLAGS@ LAME_LDFLAGS = @LAME_LDFLAGS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ OPUS_INCFLAGS = @OPUS_INCFLAGS@ OPUS_LDFLAGS = @OPUS_LDFLAGS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PULSEAUDIO_INCFLAGS = @PULSEAUDIO_INCFLAGS@ PULSEAUDIO_LDFLAGS = @PULSEAUDIO_LDFLAGS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SRC_CFLAGS = @SRC_CFLAGS@ SRC_INCFLAGS = @SRC_INCFLAGS@ SRC_LDFLAGS = @SRC_LDFLAGS@ STRIP = @STRIP@ TWOLAME_INCFLAGS = @TWOLAME_INCFLAGS@ TWOLAME_LDFLAGS = @TWOLAME_LDFLAGS@ VERSION = @VERSION@ VORBIS_INCFLAGS = @VORBIS_INCFLAGS@ VORBIS_LDFLAGS = @VORBIS_LDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CXXFLAGS = -O2 -pedantic -Wall @DEBUG_CXXFLAGS@ @PTHREAD_CFLAGS@ INCLUDES = @LAME_INCFLAGS@ @VORBIS_INCFLAGS@ @OPUS_INCFLAGS@ @FAAC_INCFLAGS@ @AACPLUS_INCFLAGS@ @TWOLAME_INCFLAGS@ \ @ALSA_INCFLAGS@ @PULSEAUDIO_INCFLAGS@ @JACK_INCFLAGS@ @SRC_INCFLAGS@ LDADD = @PTHREAD_LIBS@ @LAME_LDFLAGS@ @VORBIS_LDFLAGS@ @OPUS_LDFLAGS@ @FAAC_LDFLAGS@ @AACPLUS_LDFLAGS@ @TWOLAME_LDFLAGS@ \ @ALSA_LDFLAGS@ @PULSEAUDIO_LDFLAGS@ @JACK_LDFLAGS@ @SRC_LDFLAGS@ @HAVE_SRC_LIB_FALSE@AFLIB_SOURCE = aflibDebug.h\ @HAVE_SRC_LIB_FALSE@ aflibDebug.cc\ @HAVE_SRC_LIB_FALSE@ aflibConverter.h\ @HAVE_SRC_LIB_FALSE@ aflibConverter.cc\ @HAVE_SRC_LIB_FALSE@ aflibConverterLargeFilter.h\ @HAVE_SRC_LIB_FALSE@ aflibConverterSmallFilter.h @HAVE_SRC_LIB_TRUE@AFLIB_SOURCE = darkice_SOURCES = AudioEncoder.h\ AudioSource.h\ AudioSource.cpp\ BufferedSink.cpp\ BufferedSink.h\ CastSink.cpp\ CastSink.h\ FileSink.h\ FileSink.cpp\ Connector.cpp\ Connector.h\ MultiThreadedConnector.cpp\ MultiThreadedConnector.h\ DarkIce.cpp\ DarkIce.h\ Exception.cpp\ Exception.h\ IceCast.cpp\ IceCast.h\ IceCast2.cpp\ IceCast2.h\ ShoutCast.cpp\ ShoutCast.h\ FileCast.h\ FileCast.cpp\ LameLibEncoder.cpp\ LameLibEncoder.h\ TwoLameLibEncoder.cpp\ TwoLameLibEncoder.h\ VorbisLibEncoder.cpp\ VorbisLibEncoder.h\ OpusLibEncoder.cpp\ OpusLibEncoder.h\ FaacEncoder.cpp\ FaacEncoder.h\ aacPlusEncoder.cpp\ aacPlusEncoder.h\ OssDspSource.cpp\ OssDspSource.h\ SerialUlaw.cpp\ SerialUlaw.h\ SolarisDspSource.cpp\ SolarisDspSource.h\ Ref.h\ Referable.h\ Sink.h\ Source.h\ TcpSocket.cpp\ TcpSocket.h\ Util.cpp\ Util.h\ ConfigSection.h\ ConfigSection.cpp\ DarkIceConfig.h\ DarkIceConfig.cpp\ Reporter.h\ Reporter.cpp\ AlsaDspSource.h\ AlsaDspSource.cpp\ PulseAudioDspSource.h\ PulseAudioDspSource.cpp\ JackDspSource.h\ JackDspSource.cpp\ main.cpp \ $(AFLIB_SOURCE) EXTRA_darkice_SOURCES = aflibDebug.h\ aflibDebug.cc\ aflibConverter.h\ aflibConverter.cc\ aflibConverterLargeFilter.h\ aflibConverterSmallFilter.h all: config.h $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .cc .cpp .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): config.h: stamp-h1 @if test ! -f $@; then rm -f stamp-h1; else :; fi @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status src/config.h $(srcdir)/config.h.in: $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p; \ then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) darkice$(EXEEXT): $(darkice_OBJECTS) $(darkice_DEPENDENCIES) $(EXTRA_darkice_DEPENDENCIES) @rm -f darkice$(EXEEXT) $(CXXLINK) $(darkice_OBJECTS) $(darkice_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AlsaDspSource.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AudioSource.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BufferedSink.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CastSink.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ConfigSection.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Connector.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DarkIce.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DarkIceConfig.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Exception.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FaacEncoder.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FileCast.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FileSink.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IceCast.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IceCast2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/JackDspSource.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LameLibEncoder.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MultiThreadedConnector.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OpusLibEncoder.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OssDspSource.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PulseAudioDspSource.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Reporter.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SerialUlaw.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ShoutCast.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SolarisDspSource.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TcpSocket.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TwoLameLibEncoder.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Util.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/VorbisLibEncoder.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aacPlusEncoder.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aflibConverter.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aflibDebug.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ .cc.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cpp.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) config.h installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS .MAKE: all install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic ctags distclean distclean-compile \ distclean-generic distclean-hdr distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-binPROGRAMS install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-binPROGRAMS @JACK_CFLAGS@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: darkice-1.2/src/main.cpp0000644000175000017500000001414212170706662012127 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : main.cpp Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/main.cpp $ Abstract : Program entry point Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_STDLIB_H #include #else #error needs stdlib.h #endif #ifdef HAVE_SIGNAL_H #include #else #error needs signal.h #endif #include #include #include "Ref.h" #include "Exception.h" #include "Util.h" #include "DarkIce.h" /* =================================================== local data structures */ /*------------------------------------------------------------------------------ * The DarkIce object we're running *----------------------------------------------------------------------------*/ static Ref darkice; /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: main.cpp 553 2013-07-15 05:50:56Z rafael@riseup.net $"; /*------------------------------------------------------------------------------ * Default config file name *----------------------------------------------------------------------------*/ static const char *DEFAULT_CONFIG_FILE = "/etc/darkice.cfg"; /* =============================================== local function prototypes */ /*------------------------------------------------------------------------------ * Show program usage *----------------------------------------------------------------------------*/ static void showUsage ( std::ostream & os ); /*------------------------------------------------------------------------------ * Handler for the SIGUSR1 signal *----------------------------------------------------------------------------*/ static void sigusr1Handler(int value); /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Program entry point *----------------------------------------------------------------------------*/ int main ( int argc, char * argv[] ) { int res = -1; std::cout << "DarkIce " << VERSION << " live audio streamer, http://code.google.com/p/darkice/" << std::endl << "Copyright (c) 2000-2007, Tyrell Hungary, http://tyrell.hu/" << std::endl << "Copyright (c) 2008-2013, Akos Maroy and Rafael Diniz" << std::endl << "This is free software, and you are welcome to redistribute it " << std::endl << "under the terms of The GNU General Public License version 3 or" << std::endl << "any later version." << std::endl << std::endl; try { const char * configFileName = DEFAULT_CONFIG_FILE; unsigned int verbosity = 1; int i; const char opts[] = "hc:v:"; while ( (i = getopt( argc, argv, opts)) != -1 ) { switch ( i ) { case 'c': configFileName = optarg; break; case 'v': verbosity = Util::strToL( optarg); break; default: case ':': case '?': case 'h': showUsage( std::cout); return 1; } } std::cout << "Using config file: " << configFileName << std::endl; std::ifstream configFile( configFileName); Reporter::setReportVerbosity( verbosity ); Reporter::setReportOutputStream( std::cout ); Config config( configFile); darkice = new DarkIce( config); signal(SIGUSR1, sigusr1Handler); res = darkice->run(); } catch ( Exception & e ) { std::cout << "DarkIce: " << e << std::endl << std::flush; } return res; } /*------------------------------------------------------------------------------ * Show program usage *----------------------------------------------------------------------------*/ static void showUsage ( std::ostream & os ) { os << "usage: darkice [-v n] -c config.file" << std::endl << std::endl << "options:" << std::endl << " -c config.file use configuration file config.file" << std::endl << " if not specified, /etc/darkice.cfg is used" << std::endl << " -v n verbosity level (0 = silent, 10 = loud)" << std::endl << " -h print this message and exit" << std::endl << std::endl; } /*------------------------------------------------------------------------------ * Handle the SIGUSR1 signal here *----------------------------------------------------------------------------*/ static void sigusr1Handler(int value) { darkice->cut(); } darkice-1.2/src/aflibConverterSmallFilter.h0000644000175000017500000005350512170706611015754 00000000000000/* * Copyright: (C) 2000 Julius O. Smith * * 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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Julius O. Smith jos@ccrma.stanford.edu * */ #ifdef HAVE_CONFIG_H #include #endif #define SMALL_FILTER_NMULT ((short)13) #define SMALL_FILTER_SCALE 13128 /* Unity-gain scale factor */ #define SMALL_FILTER_NWING 1536 /* Filter table length */ short aflibConverter::SMALL_FILTER_IMP[] /* Impulse response */ = { 32767, 32766, 32764, 32760, 32755, 32749, 32741, 32731, 32721, 32708, 32695, 32679, 32663, 32645, 32625, 32604, 32582, 32558, 32533, 32506, 32478, 32448, 32417, 32385, 32351, 32316, 32279, 32241, 32202, 32161, 32119, 32075, 32030, 31984, 31936, 31887, 31836, 31784, 31731, 31676, 31620, 31563, 31504, 31444, 31383, 31320, 31256, 31191, 31124, 31056, 30987, 30916, 30845, 30771, 30697, 30621, 30544, 30466, 30387, 30306, 30224, 30141, 30057, 29971, 29884, 29796, 29707, 29617, 29525, 29433, 29339, 29244, 29148, 29050, 28952, 28852, 28752, 28650, 28547, 28443, 28338, 28232, 28125, 28017, 27908, 27797, 27686, 27574, 27461, 27346, 27231, 27115, 26998, 26879, 26760, 26640, 26519, 26398, 26275, 26151, 26027, 25901, 25775, 25648, 25520, 25391, 25262, 25131, 25000, 24868, 24735, 24602, 24467, 24332, 24197, 24060, 23923, 23785, 23647, 23507, 23368, 23227, 23086, 22944, 22802, 22659, 22515, 22371, 22226, 22081, 21935, 21789, 21642, 21494, 21346, 21198, 21049, 20900, 20750, 20600, 20449, 20298, 20146, 19995, 19842, 19690, 19537, 19383, 19230, 19076, 18922, 18767, 18612, 18457, 18302, 18146, 17990, 17834, 17678, 17521, 17365, 17208, 17051, 16894, 16737, 16579, 16422, 16264, 16106, 15949, 15791, 15633, 15475, 15317, 15159, 15001, 14843, 14685, 14527, 14369, 14212, 14054, 13896, 13739, 13581, 13424, 13266, 13109, 12952, 12795, 12639, 12482, 12326, 12170, 12014, 11858, 11703, 11548, 11393, 11238, 11084, 10929, 10776, 10622, 10469, 10316, 10164, 10011, 9860, 9708, 9557, 9407, 9256, 9106, 8957, 8808, 8659, 8511, 8364, 8216, 8070, 7924, 7778, 7633, 7488, 7344, 7200, 7057, 6914, 6773, 6631, 6490, 6350, 6210, 6071, 5933, 5795, 5658, 5521, 5385, 5250, 5115, 4981, 4848, 4716, 4584, 4452, 4322, 4192, 4063, 3935, 3807, 3680, 3554, 3429, 3304, 3180, 3057, 2935, 2813, 2692, 2572, 2453, 2335, 2217, 2101, 1985, 1870, 1755, 1642, 1529, 1418, 1307, 1197, 1088, 979, 872, 765, 660, 555, 451, 348, 246, 145, 44, -54, -153, -250, -347, -443, -537, -631, -724, -816, -908, -998, -1087, -1175, -1263, -1349, -1435, -1519, -1603, -1685, -1767, -1848, -1928, -2006, -2084, -2161, -2237, -2312, -2386, -2459, -2531, -2603, -2673, -2742, -2810, -2878, -2944, -3009, -3074, -3137, -3200, -3261, -3322, -3381, -3440, -3498, -3554, -3610, -3665, -3719, -3772, -3824, -3875, -3925, -3974, -4022, -4069, -4116, -4161, -4205, -4249, -4291, -4333, -4374, -4413, -4452, -4490, -4527, -4563, -4599, -4633, -4666, -4699, -4730, -4761, -4791, -4820, -4848, -4875, -4901, -4926, -4951, -4974, -4997, -5019, -5040, -5060, -5080, -5098, -5116, -5133, -5149, -5164, -5178, -5192, -5205, -5217, -5228, -5238, -5248, -5257, -5265, -5272, -5278, -5284, -5289, -5293, -5297, -5299, -5301, -5303, -5303, -5303, -5302, -5300, -5298, -5295, -5291, -5287, -5282, -5276, -5270, -5263, -5255, -5246, -5237, -5228, -5217, -5206, -5195, -5183, -5170, -5157, -5143, -5128, -5113, -5097, -5081, -5064, -5047, -5029, -5010, -4991, -4972, -4952, -4931, -4910, -4889, -4867, -4844, -4821, -4797, -4774, -4749, -4724, -4699, -4673, -4647, -4620, -4593, -4566, -4538, -4510, -4481, -4452, -4422, -4393, -4363, -4332, -4301, -4270, -4238, -4206, -4174, -4142, -4109, -4076, -4042, -4009, -3975, -3940, -3906, -3871, -3836, -3801, -3765, -3729, -3693, -3657, -3620, -3584, -3547, -3510, -3472, -3435, -3397, -3360, -3322, -3283, -3245, -3207, -3168, -3129, -3091, -3052, -3013, -2973, -2934, -2895, -2855, -2816, -2776, -2736, -2697, -2657, -2617, -2577, -2537, -2497, -2457, -2417, -2377, -2337, -2297, -2256, -2216, -2176, -2136, -2096, -2056, -2016, -1976, -1936, -1896, -1856, -1817, -1777, -1737, -1698, -1658, -1619, -1579, -1540, -1501, -1462, -1423, -1384, -1345, -1306, -1268, -1230, -1191, -1153, -1115, -1077, -1040, -1002, -965, -927, -890, -854, -817, -780, -744, -708, -672, -636, -600, -565, -530, -494, -460, -425, -391, -356, -322, -289, -255, -222, -189, -156, -123, -91, -59, -27, 4, 35, 66, 97, 127, 158, 188, 218, 247, 277, 306, 334, 363, 391, 419, 447, 474, 501, 528, 554, 581, 606, 632, 657, 683, 707, 732, 756, 780, 803, 827, 850, 872, 895, 917, 939, 960, 981, 1002, 1023, 1043, 1063, 1082, 1102, 1121, 1139, 1158, 1176, 1194, 1211, 1228, 1245, 1262, 1278, 1294, 1309, 1325, 1340, 1354, 1369, 1383, 1397, 1410, 1423, 1436, 1448, 1461, 1473, 1484, 1496, 1507, 1517, 1528, 1538, 1548, 1557, 1566, 1575, 1584, 1592, 1600, 1608, 1616, 1623, 1630, 1636, 1643, 1649, 1654, 1660, 1665, 1670, 1675, 1679, 1683, 1687, 1690, 1694, 1697, 1700, 1702, 1704, 1706, 1708, 1709, 1711, 1712, 1712, 1713, 1713, 1713, 1713, 1712, 1711, 1710, 1709, 1708, 1706, 1704, 1702, 1700, 1697, 1694, 1691, 1688, 1685, 1681, 1677, 1673, 1669, 1664, 1660, 1655, 1650, 1644, 1639, 1633, 1627, 1621, 1615, 1609, 1602, 1596, 1589, 1582, 1575, 1567, 1560, 1552, 1544, 1536, 1528, 1520, 1511, 1503, 1494, 1485, 1476, 1467, 1458, 1448, 1439, 1429, 1419, 1409, 1399, 1389, 1379, 1368, 1358, 1347, 1337, 1326, 1315, 1304, 1293, 1282, 1271, 1260, 1248, 1237, 1225, 1213, 1202, 1190, 1178, 1166, 1154, 1142, 1130, 1118, 1106, 1094, 1081, 1069, 1057, 1044, 1032, 1019, 1007, 994, 981, 969, 956, 943, 931, 918, 905, 892, 879, 867, 854, 841, 828, 815, 802, 790, 777, 764, 751, 738, 725, 713, 700, 687, 674, 662, 649, 636, 623, 611, 598, 585, 573, 560, 548, 535, 523, 510, 498, 486, 473, 461, 449, 437, 425, 413, 401, 389, 377, 365, 353, 341, 330, 318, 307, 295, 284, 272, 261, 250, 239, 228, 217, 206, 195, 184, 173, 163, 152, 141, 131, 121, 110, 100, 90, 80, 70, 60, 51, 41, 31, 22, 12, 3, -5, -14, -23, -32, -41, -50, -59, -67, -76, -84, -93, -101, -109, -117, -125, -133, -140, -148, -156, -163, -170, -178, -185, -192, -199, -206, -212, -219, -226, -232, -239, -245, -251, -257, -263, -269, -275, -280, -286, -291, -297, -302, -307, -312, -317, -322, -327, -332, -336, -341, -345, -349, -354, -358, -362, -366, -369, -373, -377, -380, -384, -387, -390, -394, -397, -400, -402, -405, -408, -411, -413, -416, -418, -420, -422, -424, -426, -428, -430, -432, -433, -435, -436, -438, -439, -440, -442, -443, -444, -445, -445, -446, -447, -447, -448, -448, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -448, -448, -447, -447, -446, -445, -444, -443, -443, -442, -441, -440, -438, -437, -436, -435, -433, -432, -430, -429, -427, -426, -424, -422, -420, -419, -417, -415, -413, -411, -409, -407, -405, -403, -400, -398, -396, -393, -391, -389, -386, -384, -381, -379, -376, -374, -371, -368, -366, -363, -360, -357, -355, -352, -349, -346, -343, -340, -337, -334, -331, -328, -325, -322, -319, -316, -313, -310, -307, -304, -301, -298, -294, -291, -288, -285, -282, -278, -275, -272, -269, -265, -262, -259, -256, -252, -249, -246, -243, -239, -236, -233, -230, -226, -223, -220, -217, -213, -210, -207, -204, -200, -197, -194, -191, -187, -184, -181, -178, -175, -172, -168, -165, -162, -159, -156, -153, -150, -147, -143, -140, -137, -134, -131, -128, -125, -122, -120, -117, -114, -111, -108, -105, -102, -99, -97, -94, -91, -88, -86, -83, -80, -78, -75, -72, -70, -67, -65, -62, -59, -57, -55, -52, -50, -47, -45, -43, -40, -38, -36, -33, -31, -29, -27, -25, -22, -20, -18, -16, -14, -12, -10, -8, -6, -4, -2, 0, 0, 2, 4, 6, 8, 9, 11, 13, 14, 16, 17, 19, 21, 22, 24, 25, 27, 28, 29, 31, 32, 33, 35, 36, 37, 38, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 56, 57, 58, 59, 59, 60, 61, 62, 62, 63, 63, 64, 64, 65, 66, 66, 66, 67, 67, 68, 68, 69, 69, 69, 70, 70, 70, 70, 71, 71, 71, 71, 71, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 71, 71, 71, 71, 71, 70, 70, 70, 70, 69, 69, 69, 69, 68, 68, 68, 67, 67, 67, 66, 66, 66, 65, 65, 64, 64, 64, 63, 63, 62, 62, 62, 61, 61, 60, 60, 59, 59, 58, 58, 58, 57, 57, 56, 56, 55, 55, 54, 54, 53, 53, 52, 52, 51, 51, 50, 50, 49, 48, 48, 47, 47, 46, 46, 45, 45, 44, 44, 43, 43, 42, 42, 41, 41, 40, 39, 39, 38, 38, 37, 37, 36, 36, 35, 35, 34, 34, 33, 33, 32, 32, 31, 31, 30, 30, 29, 29, 28, 28, 27, 27, 26, 26, 25, 25, 24, 24, 23, 23, 23, 22, 22, 21, 21, 20, 20, 20, 19, 19, 18, 18, 17, 17, 17, 16, 16, 15, 15, 15, 14, 14, 14, 13, 13, 12, 12, 12, 11, 11, 11, 10, 10, 10, 9, 9, 9, 9, 8, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; static short SMALL_FILTER_IMPD[] = { -1, -2, -4, -5, -6, -8, -10, -10, -13, -13, -16, -16, -18, -20, -21, -22, -24, -25, -27, -28, -30, -31, -32, -34, -35, -37, -38, -39, -41, -42, -44, -45, -46, -48, -49, -51, -52, -53, -55, -56, -57, -59, -60, -61, -63, -64, -65, -67, -68, -69, -71, -71, -74, -74, -76, -77, -78, -79, -81, -82, -83, -84, -86, -87, -88, -89, -90, -92, -92, -94, -95, -96, -98, -98, -100, -100, -102, -103, -104, -105, -106, -107, -108, -109, -111, -111, -112, -113, -115, -115, -116, -117, -119, -119, -120, -121, -121, -123, -124, -124, -126, -126, -127, -128, -129, -129, -131, -131, -132, -133, -133, -135, -135, -135, -137, -137, -138, -138, -140, -139, -141, -141, -142, -142, -143, -144, -144, -145, -145, -146, -146, -147, -148, -148, -148, -149, -149, -150, -150, -151, -151, -152, -151, -153, -152, -153, -154, -153, -154, -154, -155, -155, -155, -155, -156, -156, -156, -156, -157, -156, -157, -157, -157, -157, -158, -157, -158, -158, -157, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -157, -158, -158, -157, -158, -157, -158, -157, -157, -157, -156, -157, -156, -156, -156, -156, -155, -155, -155, -155, -154, -155, -153, -154, -153, -153, -152, -153, -151, -152, -151, -150, -151, -150, -149, -149, -149, -148, -147, -148, -146, -146, -146, -145, -145, -144, -144, -143, -143, -141, -142, -141, -140, -140, -139, -138, -138, -137, -137, -136, -135, -135, -134, -133, -132, -132, -132, -130, -130, -129, -128, -128, -127, -126, -125, -125, -124, -123, -122, -122, -121, -120, -119, -118, -118, -116, -116, -115, -115, -113, -113, -111, -111, -110, -109, -109, -107, -107, -105, -105, -104, -103, -102, -101, -101, -98, -99, -97, -97, -96, -94, -94, -93, -92, -92, -90, -89, -88, -88, -86, -86, -84, -84, -82, -82, -81, -80, -78, -78, -77, -76, -75, -74, -73, -72, -72, -70, -69, -68, -68, -66, -65, -65, -63, -63, -61, -61, -59, -59, -58, -56, -56, -55, -54, -53, -52, -51, -50, -49, -48, -47, -47, -45, -44, -44, -42, -42, -41, -39, -39, -38, -37, -36, -36, -34, -33, -33, -31, -31, -30, -29, -28, -27, -26, -25, -25, -23, -23, -22, -21, -20, -20, -18, -18, -17, -16, -15, -14, -14, -13, -12, -11, -10, -10, -9, -8, -7, -6, -6, -5, -4, -4, -2, -2, -2, 0, 0, 1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 8, 9, 9, 9, 11, 11, 11, 12, 13, 13, 14, 15, 15, 16, 16, 17, 17, 18, 19, 19, 19, 20, 21, 21, 21, 22, 23, 23, 24, 23, 25, 25, 25, 26, 26, 27, 27, 27, 28, 28, 29, 29, 30, 29, 30, 31, 31, 31, 32, 32, 32, 32, 33, 33, 34, 33, 34, 35, 34, 35, 35, 35, 36, 36, 36, 36, 37, 36, 37, 37, 38, 37, 38, 37, 38, 39, 38, 38, 39, 39, 38, 39, 39, 40, 39, 39, 40, 39, 40, 40, 39, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 41, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 39, 40, 40, 39, 40, 39, 40, 39, 39, 39, 39, 39, 39, 39, 38, 38, 39, 38, 38, 38, 37, 38, 37, 38, 37, 36, 37, 37, 36, 36, 36, 36, 36, 35, 35, 36, 34, 35, 34, 35, 34, 33, 34, 33, 33, 33, 33, 32, 32, 32, 31, 31, 31, 31, 30, 31, 30, 30, 29, 30, 29, 28, 29, 28, 28, 28, 27, 27, 27, 26, 27, 25, 26, 25, 26, 24, 25, 24, 24, 23, 24, 23, 22, 23, 22, 22, 21, 21, 21, 21, 20, 20, 19, 20, 19, 18, 19, 18, 18, 17, 17, 17, 17, 16, 16, 15, 16, 15, 14, 15, 14, 14, 13, 13, 13, 12, 13, 12, 11, 12, 11, 10, 11, 10, 10, 9, 9, 9, 9, 8, 8, 8, 8, 7, 7, 6, 7, 6, 5, 6, 5, 5, 5, 4, 4, 4, 3, 4, 3, 3, 2, 2, 2, 2, 1, 2, 1, 0, 1, 0, 0, 0, -1, -1, -1, -1, -1, -2, -2, -2, -2, -3, -3, -3, -3, -3, -4, -4, -4, -4, -5, -4, -5, -5, -6, -5, -6, -6, -6, -6, -6, -7, -6, -7, -7, -7, -8, -7, -8, -8, -8, -8, -8, -9, -8, -9, -9, -9, -9, -9, -10, -9, -10, -10, -10, -10, -10, -10, -11, -10, -11, -10, -11, -11, -11, -11, -11, -11, -11, -12, -11, -12, -12, -11, -12, -12, -12, -12, -12, -12, -12, -12, -12, -13, -12, -12, -13, -12, -13, -12, -13, -13, -12, -13, -13, -12, -13, -13, -13, -13, -12, -13, -13, -13, -13, -13, -12, -13, -13, -13, -13, -13, -12, -13, -13, -13, -12, -13, -13, -13, -12, -13, -13, -12, -13, -12, -13, -12, -13, -12, -12, -13, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -11, -12, -11, -12, -11, -12, -11, -11, -11, -11, -11, -11, -11, -11, -11, -10, -11, -11, -10, -10, -11, -10, -10, -10, -10, -10, -9, -10, -10, -9, -10, -9, -8, -9, -9, -9, -9, -9, -9, -8, -9, -8, -9, -8, -8, -8, -8, -8, -7, -8, -8, -7, -7, -8, -7, -7, -7, -7, -6, -7, -7, -6, -7, -6, -6, -6, -6, -6, -6, -5, -6, -5, -6, -5, -5, -5, -5, -5, -5, -5, -4, -5, -4, -4, -5, -4, -4, -4, -3, -4, -4, -3, -4, -3, -3, -4, -3, -3, -2, -3, -3, -3, -2, -3, -2, -2, -2, -2, -2, -2, -2, -2, -1, -2, -1, -2, -1, -1, -2, -1, -1, -1, 0, -1, -1, 0, -1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 3, 2, 2, 3, 2, 3, 2, 3, 2, 3, 3, 2, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 4, 3, 3, 3, 4, 3, 3, 3, 4, 3, 3, 3, 4, 3, 3, 3, 4, 3, 3, 3, 4, 3, 3, 3, 4, 3, 3, 3, 4, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 2, 3, 3, 2, 3, 3, 2, 3, 2, 3, 3, 2, 2, 3, 2, 3, 2, 2, 3, 2, 2, 3, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, -2, -4, -5, -6, -8, -10, -10, -13, -13, -16, -16, -18, -20, -21, -22, -24, -25, -27, -28, -30, -31, -32, -34, -35, -37, -38, -39, -41, -42, -44, -45, -46, -48, -49, -51, -52, -53, -55, -56, -57, -59, -60, -61, -63, -64, -65, -67, -68, -69, -71, -71, -74, -74, -76, -77, -78, -79, -81, -82, -83, -84, -86, -87, -88, -89, -90, -92, -92, -94, -95, -96, -98, -98, -100, -100, -102, -103, -104, -105, -106, -107, -108, -109, -111, -111, -112, -113, -115, -115, -116, -117, -119, -119, -120, -121, -121, -123, -124, -124, -126, -126, -127, -128, -129, -129, -131, -131, -132, -133, -133, -135, -135, -135, -137, -137, -138, -138, -140, -139, -141, -141, -142, -142, -143, -144, -144, -145, -145, -146, -146, -147, -148, -148, -148, -149, -149, -150, -150, -151, -151, -152, -151, -153, -152, -153, -154, -153, -154, -154, -155, -155, -155, -155, -156, -156, -156, -156, -157, -156, -157, -157, -157, -157, -158, -157, -158, -158, -157, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -157, -158, -158, -157, -158, -157, -158, -157, -157, -157, -156, -157, -156, -156, -156, -156, -155, -155, -155, -155, -154, -155, -153, -154, -153, -153, -152, -153, -151, -152, -151, -150, -151, -150, -149, -149, -149, -148, -147, -148, -146, -146, -146, -145, -145, -144, -144, -143, -143, -141, -142, -141, -140, -140, -139, -138, -138, -137, -137, -136, -135, -135, -134, -133, -132, -132, -132, -130, -130, -129, -128, -128, -127, -126, -125, -125, -124, -123, -122, -122, -121, -120, -119, -118, -118, -116, -116, -115, -115, -113, -113, -111, -111, -110, -109, -109, -107, -107, -105, -105, -104, -103, -102, -101, -101, -98, -99, -97, -97, -96, -94, -94, -93, -92, -92, -90, -89, -88, -88, -86, -86, -84, -84, -82, -82, -81, -80, -78, -78, -77, -76, -75, -74, -73, -72, -72, -70, -69, -68, -68, -66, -65, -65, -63, -63, -61, -61, -59, -59, -58, -56, -56, -55, -54, -53, -52, -51, -50, -49, -48, -47, -47, -45, -44, -44, -42, -42, -41, -39, -39, -38, -37, -36, -36, -34, -33, -33, -31, -31, -30, -29, -28, -27, -26, -25, -25, -23, -23, -22, -21, -20, -20, -18, -18, -17, -16, -15, -14, -14, -13, -12, -11, -10, -10, -9, -8, -7, -6, -6, -5, -4, -4, -2, -2, -2, 0, 0, 1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 8, 9, 9, 9, 11, 11, 11, 12, 13, 13, 14, 15, 15, 16, 16, 17, 17, 18, 19, 19, 19, 20, 21, 21, 21, 22, 23, 23, 24, 23, 25, 25, 25, 26, 26, 27, 27, 27, 28, 28, 29, 29, 30, 29, 30, 31, 31, 31, 32, 32, 32, 32, 33, 33, 34, 33, 34, 35, 34, 35, 35, 35, 36, 36, 36, 36, 37, 36, 37, 37, 38, 37, 38, 37, 38, 39, 38, 38, 39, 39, 38, 39, 39, 40, 39, 39, 40, 39, 40, 40, 39, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 41, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 39, 40, 40, 39, 40, 39, 40, 39, 39, 39, 39, 39, 39, 39, 38, 38, 39, 38, 38, 38, 37, 38, 37, 38, 37, 36, 37, 37, 36, 36, 36, 36, 36, 35, 35, 36, 34, 35, 34, 35, 34, 33, 34, 33, 33, 33, 33, 32, 32, 32, 31, 31, 31, 31, 30, 31, 30, 30, 29, 30, 29, 28, 29, 28, 28, 28, 27, 27, 27, 26, 27, 25, 26, 25, 26, 24, 25, 24, 24, 23, 24, 23, 22, 23, 22, 22, 21, 21, 21, 21, 20, 20, 19, 20, 19, 18, 19, 18, 18, 17, 17, 17, 17, 16, 16, 15, 16, 15, 14, 15, 14, 14, 13, 13, 13, 12, 13, 12, 11, 12, 11, 10, 11, 10, 10, 9, 9, 9, 9, 8, 8, 8, 8, 7, 7, 6, 7, 6, 5, 6, 5, 5, 5, 4, 4, 4, 3, 4, 3, 3, 2, 2, 2, 2, 1, 2, 1, 0, 1, 0, 0, 0, -1, -1, -1, -1, -1, -2, -2, -2, -2, -3, -3, -3, -3, -3, -4, -4, -4, -4, -5, -4, -5, -5, -6, -5, -6, -6, -6, -6, -6, -7, -6, -7, -7, -7, -8, -7, -8, -8, -8, -8, -8, -9, -8, -9, -9, -9, -9, -9, -10, -9, -10, -10, -10, -10, -10, -10, -11, -10, -11, -10, -11, -11, -11, -11, -11, -11, -11, -12, -11, -12, -12, -11, -12, -12, -12, -12, -12, -12, -12, -12, -12, -13, -12, -12, -13, -12, -13, -12, -13, -13, -12, -13, -13, -12, -13, -13, -13, -13, -12, -13, -13, -13, -13, -13, -12, -13, -13, -13, -13, -13, -12, -13, -13, -13, -12, -13, -13, -13, -12, -13, -13, -12, -13, -12, -13, -12, -13, -12, -12, -13, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -11, -12, -11, -12, -11, -12, -11, -11, -11, -11, -11, -11, -11, -11, -11, -10, -11, -11, -10, -10, -11, -10, -10, -10, -10, -10, -9, -10, -10, -9, -10, -9, -8, -9, -9, -9, -9, -9, -9, -8, -9, -8, -9, -8, -8, -8, -8, -8, -7, -8, -8, -7, -7, -8, -7, -7, -7, -7, -6, -7, -7, -6, -7, -6, -6, -6, -6, -6, -6, -5, -6, -5, -6, -5, -5, -5, -5, -5, -5, -5, -4, -5, -4, -4, -5, -4, -4, -4, -3, -4, -4, -3, -4, -3, -3, -4, -3, -3, -2, -3, -3, -3, -2, -3, -2, -2, -2, -2, -2, -2, -2, -2, -1, -2, -1, -2, -1, -1, -2, -1, -1, -1, 0, -1, -1, 0, -1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 3, 2, 2, 3, 2, 3, 2, 3, 2, 3, 3, 2, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 4, 3, 3, 3, 4, 3, 3, 3, 4, 3, 3, 3, 4, 3, 3, 3, 4, 3, 3, 3, 4, 3, 3, 3, 4, 3, 3, 3, 4, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 2, 3, 3, 2, 3, 3, 2, 3, 2, 3, 3, 2, 2, 3, 2, 3, 2, 2, 3, 2, 2, 3, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; darkice-1.2/src/OpusLibEncoder.h0000644000175000017500000004376412170706662013541 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : OpusLibEncoder.h Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/OpusLibEncoder.h $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef OPUS_LIB_ENCODER_H #define OPUS_LIB_ENCODER_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_OPUS_LIB #include #include #else #error configure for Ogg Opus #endif #include "Ref.h" #include "Exception.h" #include "Reporter.h" #include "AudioEncoder.h" #include "CastSink.h" #ifdef HAVE_SRC_LIB #include #else #include "aflibConverter.h" #endif /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * A struct for containing the ogg opus header format, sent at the stream * beginning. * * @author $Author: rafael@riseup.net $ * @version $Revision: 553 $ */ struct OpusIdHeader { char magic[8]; /* "OpusHead" */ unsigned char version; /* Version (currently 1) */ unsigned char channels; /* Number of channels */ unsigned short preskip; /* Pre-skip */ unsigned int samplerate; /* Original samplerate; informational only */ unsigned short gain; /* Output gain, stored in Q7.8 in dB */ unsigned char chanmap; /* 0 = mono or stereo L/R, 1=vorbis spec order, 2..254=reserved, 255=undef */ /** * Build an Ogg packet from the header. * @param packet output pointer, must be freed by caller * * @return number of bytes in packet. */ inline int buildPacket( unsigned char** packet) throw ( Exception ) { int i = 0; // FIXME - doesn't support multistream unsigned char* out = (unsigned char*)malloc(19); if( out == NULL ) { throw Exception( __FILE__, __LINE__, "cannot alloc buffer"); } for( ; i < 8; i++) { out[i] = magic[i]; } out[i++] = version; out[i++] = channels; out[i++] = preskip & 0xff; out[i++] = (preskip >> 8) & 0xff; out[i++] = samplerate & 0xff; out[i++] = (samplerate >> 8) & 0xff; out[i++] = (samplerate >> 16) & 0xff; out[i++] = (samplerate >> 24) & 0xff; out[i++] = gain & 0xff; out[i++] = (gain >> 8) & 0xff; out[i++] = chanmap; *packet = out; return i; } }; /** * A struct for containing the ogg opus comment header format * * @author $Author: rafael@riseup.net $ * @version $Revision: 553 $ */ struct OpusCommentHeader { /** * Struct for each tag pair, in the form of a UTF-8 * string, "TAG=value" * * @author $Author: rafael@riseup.net $ * @version $Revision: 553 $ */ struct Tags { unsigned int tag_len; /* For each tag, how long the following tag is */ char* tag_str; /* For each tag, UTF-8 encoded string, in tag=value */ }; char magic[8]; /* "OpusTags" */ unsigned int vendor_length; /* Length of the vendor string */ char* vendor_string; /* Vendor string -- parsed as utf-8 */ unsigned int num_tags; /* Number of tags following */ Tags* tags; /* Pointer to allocated tag array */ /** * Build an Ogg packet from the header. * @param packet output pointer, must be freed by caller * * @return number of bytes in packet. */ inline int buildPacket( unsigned char** packet) throw ( Exception ) { int len = 8 + sizeof(unsigned int) * 2 + vendor_length; int pos = 0; for( unsigned int i = 0; i < num_tags; i++ ) { len += sizeof(unsigned int) + tags[i].tag_len; } unsigned char* out = (unsigned char*)malloc(len); if( out == NULL ) { throw Exception( __FILE__, __LINE__, "cannot alloc buffer"); } for( ; pos < 8; pos++) { out[pos] = magic[pos]; } out[pos++] = vendor_length & 0xff; out[pos++] = (vendor_length >> 8) & 0xff; out[pos++] = (vendor_length >> 16) & 0xff; out[pos++] = (vendor_length >> 24) & 0xff; for( unsigned int i = 0; i < vendor_length; i++ ) { out[pos++] = vendor_string[i]; } out[pos++] = num_tags & 0xff; out[pos++] = (num_tags >> 8) & 0xff; out[pos++] = (num_tags >> 16) & 0xff; out[pos++] = (num_tags >> 24) & 0xff; for( unsigned int i = 0; i < num_tags; i++ ) { out[pos++] = tags[i].tag_len & 0xff; out[pos++] = (tags[i].tag_len >> 8) & 0xff; out[pos++] = (tags[i].tag_len >> 16) & 0xff; out[pos++] = (tags[i].tag_len >> 24) & 0xff; for( unsigned int j = 0; j < tags[i].tag_len; j++ ) { out[pos++] = tags[i].tag_str[j]; } } *packet = out; return len; } }; /** * A class representing the ogg opus encoder linked as a shared object or * as a static library. * * @author $Author: rafael@riseup.net $ * @version $Revision: 553 $ */ class OpusLibEncoder : public AudioEncoder, public virtual Reporter { private: /** * Value indicating if the encoding process is going on */ bool encoderOpen; /** * Ogg Opus library global info */ OpusEncoder* opusEncoder; /** * Ogg library global stream state */ ogg_stream_state oggStreamState; ogg_int64_t oggGranulePosition; ogg_int64_t oggPacketNumber; unsigned char* internalBuffer; int internalBufferLength; bool reconnectError; /** * Maximum bitrate of the output in kbits/sec. If 0, don't care. */ unsigned int outMaxBitrate; /** * Resample ratio */ double resampleRatio; /** * sample rate converter object for possible resampling */ #ifdef HAVE_SRC_LIB SRC_STATE * converter; SRC_DATA converterData; #else aflibConverter * converter; #endif /** * Initialize the object. * * @param the maximum bit rate * @exception Exception */ void init ( unsigned int outMaxBitrate ) throw ( Exception ); /** * De-initialize the object. * * @exception Exception */ inline void strip ( void ) throw ( Exception ) { if ( converter ) { #ifdef HAVE_SRC_LIB delete [] converterData.data_in; delete [] converterData.data_out; src_delete (converter); #else delete converter; #endif } } /** * Send pending Opus blocks to the underlying stream */ void opusBlocksOut( int bytes, unsigned char* data, bool eos = false ) throw ( Exception ); protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline OpusLibEncoder ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } public: /** * Constructor. * * @param sink the sink to send encoded output to * @param inSampleRate sample rate of the input. * @param inBitsPerSample number of bits per sample of the input. * @param inChannel number of channels of the input. * @param inBigEndian shows if the input is big or little endian * @param outBitrateMode the bit rate mode of the output. * @param outBitrate bit rate of the output (kbits/sec). * @param outQuality the quality of the stream. * @param outSampleRate sample rate of the output. * If 0, inSampleRate is used. * @param outMaxBitrate maximum output bitrate. * 0 if not used. * @param outChannel number of channels of the output. * If 0, inChannel is used. * @exception Exception */ inline OpusLibEncoder ( CastSink * sink, unsigned int inSampleRate, unsigned int inBitsPerSample, unsigned int inChannel, bool inBigEndian, BitrateMode outBitrateMode, unsigned int outBitrate, double outQuality, unsigned int outSampleRate = 0, unsigned int outChannel = 0, unsigned int outMaxBitrate = 0 ) throw ( Exception ) : AudioEncoder ( sink, inSampleRate, inBitsPerSample, inChannel, inBigEndian, outBitrateMode, outBitrate, outQuality, outSampleRate, outChannel ) { init( outMaxBitrate); } /** * Constructor. * * @param sink the sink to send encoded output to * @param as get input sample rate, bits per sample and channels * from this AudioSource. * @param outBitrateMode the bit rate mode of the output. * @param outBitrate bit rate of the output (kbits/sec). * @param outQuality the quality of the stream. * @param outSampleRate sample rate of the output. * If 0, input sample rate is used. * @param outMaxBitrate maximum output bitrate. * 0 if not used. * @param outChannel number of channels of the output. * If 0, input channel is used. * @exception Exception */ inline OpusLibEncoder ( CastSink * sink, const AudioSource * as, BitrateMode outBitrateMode, unsigned int outBitrate, double outQuality, unsigned int outSampleRate = 0, unsigned int outChannel = 0, unsigned int outMaxBitrate = 0 ) throw ( Exception ) : AudioEncoder ( sink, as, outBitrateMode, outBitrate, outQuality, outSampleRate, outChannel ) { init( outMaxBitrate); } /** * Copy constructor. * * @param encoder the OpusLibEncoder to copy. */ inline OpusLibEncoder ( const OpusLibEncoder & encoder ) throw ( Exception ) : AudioEncoder( encoder ) { if( encoder.isOpen() ) { throw Exception(__FILE__, __LINE__, "don't copy open encoders"); } init( encoder.getOutMaxBitrate() ); } /** * Destructor. * * @exception Exception */ inline virtual ~OpusLibEncoder ( void ) throw ( Exception ) { if ( isOpen() ) { close(); } strip(); } /** * Assignment operator. * * @param encoder the OpusLibEncoder to assign this to. * @return a reference to this OpusLibEncoder. * @exception Exception */ inline virtual OpusLibEncoder & operator= ( const OpusLibEncoder & encoder ) throw ( Exception ) { if( encoder.isOpen() ) { throw Exception(__FILE__, __LINE__, "don't copy open encoders"); } if ( this != &encoder ) { strip(); AudioEncoder::operator=( encoder); init( encoder.getOutMaxBitrate() ); } return *this; } /** * Get the maximum bit rate of the output in kbits/sec, * for fixed / average bitrate encodings. * * @return the maximum bit rate of the output, or 0 if not set. */ inline unsigned int getOutMaxBitrate ( void ) const throw () { return outMaxBitrate; } /** * Check wether encoding is in progress. * * @return true if encoding is in progress, false otherwise. */ inline virtual bool isRunning ( void ) const throw () { return isOpen(); } /** * Start encoding. This function returns as soon as possible, * with encoding started in the background. * * @return true if encoding has started, false otherwise. * @exception Exception */ inline virtual bool start ( void ) throw ( Exception ) { return open(); } /** * Stop encoding. Stops the encoding running in the background. * * @exception Exception */ inline virtual void stop ( void ) throw ( Exception ) { return close(); } /** * Open an encoding session. * * @return true if opening was successfull, false otherwise. * @exception Exception */ virtual bool open ( void ) throw ( Exception ); /** * Check if the encoding session is open. * * @return true if the encoding session is open, false otherwise. */ inline virtual bool isOpen ( void ) const throw () { return encoderOpen; } /** * Check if the encoder is ready to accept data. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true if the encoder is ready to accept data, * false otherwise. * @exception Exception */ inline virtual bool canWrite ( unsigned int sec, unsigned int usec ) throw ( Exception ) { if ( !isOpen() ) { return false; } return getSink()->canWrite(sec, usec); } /** * Write data to the encoder. * Buf is expected to be a sequence of big-endian 16 bit values, * with left and right channels interleaved. Len is the number of * bytes, must be a multiple of 4. * * @param buf the data to write. * @param len number of bytes to write from buf. * @return the number of bytes written (may be less than len). * @exception Exception */ virtual unsigned int write ( const void * buf, unsigned int len ) throw ( Exception ); /** * Flush all data that was written to the encoder to the underlying * connection. * * @exception Exception */ virtual void flush ( void ) throw ( Exception ); /** * Close the encoding session. * * @exception Exception */ virtual void close ( void ) throw ( Exception ); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* OPUS_LIB_ENCODER_H */ darkice-1.2/src/IceCast.h0000644000175000017500000001716212170706662012170 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : IceCast.h Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/IceCast.h $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef ICE_CAST_H #define ICE_CAST_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include "Sink.h" #include "TcpSocket.h" #include "CastSink.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * Class representing output to an IceCast server with * x-audiocast login * * @author $Author: rafael@riseup.net $ * @version $Revision: 553 $ */ class IceCast : public CastSink { private: /** * Mount point of the stream on the server. */ char * mountPoint; /** * Remote dump file if any. */ char * remoteDumpFile; /** * Description of the stream. */ char * description; /** * Initalize the object. * * @param mountPoint mount point of the stream on the server. * @param remoteDumpFile remote dump file (may be NULL). * @param description description of the stream. * @exception Exception */ void init ( const char * mountPoint, const char * description, const char * remoteDumpFile ) throw ( Exception ); /** * De-initalize the object. * * @exception Exception */ void strip ( void ) throw ( Exception ); protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline IceCast ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } /** * Log in to the server using the socket avialable. * * @return true if login was successful, false otherwise. * @exception Exception */ virtual bool sendLogin ( void ) throw ( Exception ); public: /** * Constructor. * * @param socket socket connection to the server. * @param password password to the server. * @param mountPoint mount point of the stream on the server. * @param remoteDumpFile remote dump file (may be NULL). * @param name name of the stream. * @param description description of the stream. * @param url URL associated with the stream. * @param genre genre of the stream. * @param bitRate bitrate of the stream (e.g. mp3 bitrate). * @param isPublic is the stream public? * @param streamDump an optional sink to dump the binary stream * data to. * @param bufferDuration duration of the BufferedSink buffer * in seconds. * @exception Exception */ inline IceCast ( TcpSocket * socket, const char * password, const char * mountPoint, unsigned int bitRate, const char * name = 0, const char * description = 0, const char * url = 0, const char * genre = 0, bool isPublic = false, const char * remoteDumpFile = 0, Sink * streamDump = 0 ) throw ( Exception ) : CastSink( socket, password, bitRate, name, url, genre, isPublic, streamDump ) { init( mountPoint, description, remoteDumpFile); } /** * Copy constructor. * * @param cs the IceCast to copy. */ inline IceCast( const IceCast & cs ) throw ( Exception ) : CastSink( cs ) { init( cs.getMountPoint(), cs.getDescription(), cs.getRemoteDumpFile() ); } /** * Destructor. * * @exception Exception */ inline virtual ~IceCast( void ) throw ( Exception ) { strip(); } /** * Assignment operator. * * @param cs the IceCast to assign this to. * @return a reference to this IceCast. * @exception Exception */ inline virtual IceCast & operator= ( const IceCast & cs ) throw ( Exception ) { if ( this != &cs ) { strip(); CastSink::operator=( cs ); init( cs.getMountPoint(), cs.getDescription(), cs.getRemoteDumpFile() ); } return *this; } /** * Get the mount point of the stream on the server. * * @return the mount point of the stream on the server. */ inline const char * getMountPoint ( void ) const throw () { return mountPoint; } /** * Get the remote dump file if any. * * @return the remote dump file. May be NULL. */ inline const char * getRemoteDumpFile ( void ) const throw () { return remoteDumpFile; } /** * Get the description of the stream. * * @return the description of the stream. */ inline const char * getDescription ( void ) const throw () { return description; } }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* ICE_CAST_H */ darkice-1.2/src/TwoLameLibEncoder.h0000644000175000017500000002653212170706662014155 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : TwoLameLibEncoder.cpp Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/TwoLameLibEncoder.h $ Copyright notice: 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef TWOLAME_LIB_ENCODER_H #define TWOLAME_LIB_ENCODER_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_TWOLAME_LIB #include #else #error configure with twolame #endif #include "Ref.h" #include "Exception.h" #include "Reporter.h" #include "AudioEncoder.h" #include "Sink.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * A class representing the TwoLame encoder linked as a shared object or as * a static library. * * @author $Author: rafael@riseup.net $ * @version $Revision: 553 $ */ class TwoLameLibEncoder : public AudioEncoder, public virtual Reporter { private: /** * TwoLame library global flags */ twolame_options * twolame_opts; /** * Initialize the object. * * @param sink the sink to send mp2 output to * @exception Exception */ void init ( void ) throw ( Exception ); /** * De-initialize the object. * * @exception Exception */ inline void strip ( void ) throw ( Exception ) { } protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline TwoLameLibEncoder ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } public: /** * Constructor. * * @param sink the sink to send mp2 output to * @param inSampleRate sample rate of the input. * @param inBitsPerSample number of bits per sample of the input. * @param inChannel number of channels of the input. * @param inBigEndian shows if the input is big or little endian * @param outBitrateMode the bit rate mode of the output. * @param outBitrate bit rate of the output (kbits/sec). * @param outSampleRate sample rate of the output. * If 0, inSampleRate is used. * @param outChannel number of channels of the output. * If 0, inChannel is used. * @exception Exception */ inline TwoLameLibEncoder ( Sink * sink, unsigned int inSampleRate, unsigned int inBitsPerSample, unsigned int inChannel, bool inBigEndian, BitrateMode outBitrateMode, unsigned int outBitrate, unsigned int outSampleRate = 0, unsigned int outChannel = 0 ) throw ( Exception ) : AudioEncoder ( sink, inSampleRate, inBitsPerSample, inChannel, inBigEndian, outBitrateMode, outBitrate, 0.0f, // outQuality outSampleRate, outChannel ) { init(); } /** * Constructor. * * @param sink the sink to send mp2 output to * @param as get input sample rate, bits per sample and channels * from this AudioSource. * @param outBitrateMode the bit rate mode of the output. * @param outBitrate bit rate of the output (kbits/sec). * @param outSampleRate sample rate of the output. * If 0, input sample rate is used. * @param outChannel number of channels of the output. * If 0, input channel is used. * @exception Exception */ inline TwoLameLibEncoder ( Sink * sink, const AudioSource * as, BitrateMode outBitrateMode, unsigned int outBitrate, unsigned int outSampleRate = 0, unsigned int outChannel = 0 ) throw ( Exception ) : AudioEncoder ( sink, as, outBitrateMode, outBitrate, 0.0f, // outQuality outSampleRate, outChannel ) { init(); } /** * Copy constructor. * * @param encoder the TwoLameLibEncoder to copy. */ inline TwoLameLibEncoder ( const TwoLameLibEncoder & encoder ) throw ( Exception ) : AudioEncoder( encoder ) { init(); } /** * Destructor. * * @exception Exception */ inline virtual ~TwoLameLibEncoder ( void ) throw ( Exception ) { if ( isOpen() ) { close(); } strip(); } /** * Assignment operator. * * @param encoder the TwoLameLibEncoder to assign this to. * @return a reference to this TwoLameLibEncoder. * @exception Exception */ inline virtual TwoLameLibEncoder & operator= ( const TwoLameLibEncoder & encoder ) throw ( Exception ) { if ( this != &encoder ) { strip(); AudioEncoder::operator=( encoder); init(); } return *this; } /** * Get the version string of the underlying lame library. * * @return the version string of the underlying lame library. */ inline const char * getLameVersion( void ) { return get_twolame_version(); } /** * Check wether encoding is in progress. * * @return true if encoding is in progress, false otherwise. */ inline virtual bool isRunning ( void ) const throw () { return isOpen(); } /** * Start encoding. This function returns as soon as possible, * with encoding started in the background. * * @return true if encoding has started, false otherwise. * @exception Exception */ inline virtual bool start ( void ) throw ( Exception ) { return open(); } /** * Stop encoding. Stops the encoding running in the background. * * @exception Exception */ inline virtual void stop ( void ) throw ( Exception ) { return close(); } /** * Open an encoding session. * * @return true if opening was successfull, false otherwise. * @exception Exception */ virtual bool open ( void ) throw ( Exception ); /** * Check if the encoding session is open. * * @return true if the encoding session is open, false otherwise. */ inline virtual bool isOpen ( void ) const throw () { return twolame_opts != 0; } /** * Check if the encoder is ready to accept data. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true if the encoder is ready to accept data, * false otherwise. * @exception Exception */ inline virtual bool canWrite ( unsigned int sec, unsigned int usec ) throw ( Exception ) { if ( !isOpen() ) { return false; } return true; } /** * Write data to the encoder. * Buf is expected to be a sequence of big-endian 16 bit values, * with left and right channels interleaved. Len is the number of * bytes, must be a multiple of 4. * * @param buf the data to write. * @param len number of bytes to write from buf. * @return the number of bytes written (may be less than len). * @exception Exception */ virtual unsigned int write ( const void * buf, unsigned int len ) throw ( Exception ); /** * Flush all data that was written to the encoder to the underlying * connection. * * @exception Exception */ virtual void flush ( void ) throw ( Exception ); /** * Close the encoding session. * * @exception Exception */ virtual void close ( void ) throw ( Exception ); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* TWOLAME_LIB_ENCODER_H */ darkice-1.2/src/aflibDebug.cc0000644000175000017500000001316712170706611013032 00000000000000 /* Copyright (C) 2000 Stefan Westerfeld stefan@space.twc.de This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "aflibDebug.h" #include #include #include #include static int aflib_debug_level = ::aflibDebug::lInfo; static bool aflib_debug_abort = false; static const char *aflib_debug_prefix = ""; static char *messageAppName = 0; /* static char* status_strs[] = { "Success", "Error Open", "Unsupported", "AFLIB_ERROR_INITIALIZATION_FAILURE", "AFLIB_NOT_FOUND", "AFLIB_END_OF_FILE", "AFLIB_NO_DATA", 0 }; static char* data_size_strs[] = { "UNDEFINED", "8 bit signed", "8 bit unsigned", "16 bit signed", "16 bit unsigned", "32 bit signed", "32 bit unsigned", 0 }; static char* data_endian_strs[] = { "UNDEFINED", "ENDIAN_LITTLE", "ENDIAN_BIG", 0 }; */ /* * Call the graphical application to display a message, if * defined. Otherwise, send to standard error. Debug messages are * always sent to standard error because they tend to be very verbose. * Note that the external application is run in the background to * avoid blocking the sound server. */ void output_message(::aflibDebug::Level level, const char *msg) { char buff[1024]; /* default to text output if no message app is defined or if it is a debug message. */ if (messageAppName == 0 || !strcmp(messageAppName, "") || (level == ::aflibDebug::lDebug)) { fprintf(stderr, "%s\n", msg); return; } switch (level) { case ::aflibDebug::lFatal: sprintf(buff, "%s -e \"aflib fatal error:\n\n%s\" &", messageAppName, msg); break; case ::aflibDebug::lWarning: sprintf(buff, "%s -w \"aflib warning message:\n\n%s\" &", messageAppName, msg); break; case ::aflibDebug::lInfo: sprintf(buff, "%s -i \"aflib informational message:\n\n%s\" &", messageAppName, msg); break; default: break; // avoid compile warning } int r = system(buff); if (r<0) fprintf(stderr, "aflibDebug, system() failed\n"); } /* * Display a message using output_message. If the message is the same * as the previous one, just increment a count but don't display * it. This prevents flooding the user with duplicate warnings. If the * message is not the same as the previous one, then we report the * previously repeated message (if any) and reset the last message and * count. */ void display_message(::aflibDebug::Level level, const char *msg) { static char lastMsg[1024]; static ::aflibDebug::Level lastLevel; static int msgCount = 0; if (!strncmp(msg, lastMsg, 1024)) { msgCount++; } else { if (msgCount > 0) { char buff[1024]; sprintf(buff, "%s\n(The previous message was repeated %d times.)", lastMsg, msgCount); output_message(lastLevel, buff); } strncpy(lastMsg, msg, 1024); lastLevel = level; msgCount = 0; output_message(level, msg); } } static class DebugInitFromEnv { public: DebugInitFromEnv() { const char *env = getenv("AFLIB_DEBUG"); if(env) { if(strcmp(env,"debug") == 0) aflib_debug_level = ::aflibDebug::lDebug; else if(strcmp(env,"info") == 0) aflib_debug_level = ::aflibDebug::lInfo; else if(strcmp(env,"warning") == 0) aflib_debug_level = ::aflibDebug::lWarning; else if(strcmp(env,"quiet") == 0) aflib_debug_level = ::aflibDebug::lFatal; else { fprintf(stderr, "AFLIB_DEBUG must be one of debug,info,warning,quiet\n"); } } env = getenv("AFLIB_DEBUG_ABORT"); if(env) aflib_debug_abort = true; } } debugInitFromEnv; void aflibDebug::init(const char *prefix, Level level) { aflib_debug_level = level; aflib_debug_prefix = prefix; } void aflibDebug::fatal(const char *fmt, ...) { char buff[1024]; va_list ap; va_start(ap, fmt); vsprintf(buff, fmt, ap); va_end(ap); display_message(::aflibDebug::lFatal, buff); if(aflib_debug_abort) abort(); exit(1); } void aflibDebug::warning(const char *fmt, ...) { if(lWarning >= aflib_debug_level) { char buff[1024]; va_list ap; va_start(ap, fmt); vsprintf(buff, fmt, ap); va_end(ap); display_message(::aflibDebug::lWarning, buff); } } void aflibDebug::info(const char *fmt, ...) { if(lInfo >= aflib_debug_level) { char buff[1024]; va_list ap; va_start(ap, fmt); vsprintf(buff, fmt, ap); va_end(ap); display_message(::aflibDebug::lInfo, buff); } } void aflibDebug::debug(const char *fmt, ...) { if(lDebug >= aflib_debug_level) { char buff[1024]; va_list ap; va_start(ap, fmt); vsprintf(buff, fmt, ap); va_end(ap); display_message(::aflibDebug::lDebug, buff); } } void aflibDebug::messageApp(const char *appName) { messageAppName = (char*) realloc(messageAppName, strlen(appName)+1); strcpy(messageAppName, appName); } darkice-1.2/src/PulseAudioDspSource.h0000644000175000017500000003436612170706662014564 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Copyright (c) 2004 LS Informationstechnik (LIKE) University of Erlangen Nuremberg All rights reserved. Tyrell DarkIce File : PulseAudioDspSource.h Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/PulseAudioDspSource.h $ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef PULSEAUDIO_SOURCE_H #define PULSEAUDIO_SOURCE_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "Reporter.h" #include "AudioSource.h" #ifdef HAVE_PULSEAUDIO_LIB #include #include #include #else #error configure for PULSEAUDIO #endif /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * An audio input based on the PULSEAUDIO sound system * * @author $Author: rafael@riseup.net $ * @version $Revision: 553 $ */ class PulseAudioDspSource : public AudioSource, public virtual Reporter { private: /** * Name of the capture PCM stream. */ char *sourceName; /** * Handle for PulseAudio */ pa_simple *s ; /** * format definitions for pulseaudio */ pa_sample_spec ss; int running; int error; protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline PulseAudioDspSource ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } /** * Initialize the object * * @param name the PCM to open. * @exception Exception */ void init ( const char * name ) throw ( Exception ); /** * De-iitialize the object * * @exception Exception */ void strip ( void ) throw ( Exception ); public: /** * Constructor. * * @param name the PCM (e.g. "hwplug:0,0"). * @param sampleRate samples per second (e.g. 44100 for 44.1kHz). * @param bitsPerSample bits per sample (e.g. 16 bits). * @param channel number of channels of the audio source * (e.g. 1 for mono, 2 for stereo, etc.). * @exception Exception */ inline PulseAudioDspSource ( const char * paSourceName, int sampleRate = 44100, int bitsPerSample = 16, int channel = 2 ) throw ( Exception ) : AudioSource( sampleRate, bitsPerSample, channel) { init( paSourceName); } /** * Copy Constructor. * * @param ds the object to copy. * @exception Exception */ inline PulseAudioDspSource ( const PulseAudioDspSource & ds ) throw ( Exception ) : AudioSource( ds ) { init( ds.sourceName); } /** * Destructor. * * @exception Exception */ inline virtual ~PulseAudioDspSource ( void ) throw ( Exception ) { strip(); } /** * Assignment operator. * * @param ds the object to assign to this one. * @return a reference to this object. * @exception Exception */ inline virtual PulseAudioDspSource & operator= ( const PulseAudioDspSource & ds ) throw ( Exception ) { if ( this != &ds ) { strip(); AudioSource::operator=( ds); init( ds.sourceName); } return *this; } /** * Open the PulseAudioDspSource. * * @return true if opening was successful, false otherwise * @exception Exception */ virtual bool open ( void ) throw ( Exception ); /** * Check if the PulseAudioDspSource is open. * * @return true if the PulseAudioDspSource is open, false otherwise. */ inline virtual bool isOpen ( void ) const throw () { return s==NULL; } /** * Check if the PulseAudioDspSource can be read from. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true if the PulseAudioDspSource is ready to be read from, * false otherwise. * @exception Exception */ virtual bool canRead ( unsigned int sec, unsigned int usec ) throw ( Exception ); /** * Read from the PulseAudioDspSource. * * @param buf the buffer to read into. * @param len the number of bytes to read into buf * @return the number of bytes read (may be less than len). * @exception Exception */ virtual unsigned int read ( void * buf, unsigned int len ) throw ( Exception ); /** * Close the PulseAudioDspSource. * * @exception Exception */ virtual void close ( void ) throw ( Exception ); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* PULSEAUDIO_SOURCE_H */ /*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Copyright (c) 2004 LS Informationstechnik (LIKE) University of Erlangen Nuremberg All rights reserved. Tyrell DarkIce File : PulseAudioDspSource.h Version : $Revision: 553 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL: https://darkice.googlecode.com/svn/darkice/tags/darkice-1_2/src/PulseAudioDspSource.h $ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef PULSEAUDIO_SOURCE_H #define PULSEAUDIO_SOURCE_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "Reporter.h" #include "AudioSource.h" #ifdef HAVE_PULSEAUDIO_LIB #include #include #include #else #error configure for PULSEAUDIO #endif /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * An audio input based on the PULSEAUDIO sound system * * @author $Author: rafael@riseup.net $ * @version $Revision: 553 $ */ class PulseAudioDspSource : public AudioSource, public virtual Reporter { private: /** * Name of the capture PCM stream. */ char *sourceName; /** * Handle for PulseAudio */ pa_simple *s ; /** * format definitions for pulseaudio */ pa_sample_spec ss; int error; protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline PulseAudioDspSource ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } /** * Initialize the object * * @param name the PCM to open. * @exception Exception */ void init ( const char * name ) throw ( Exception ); /** * De-iitialize the object * * @exception Exception */ void strip ( void ) throw ( Exception ); public: /** * Constructor. * * @param name the PCM (e.g. "hwplug:0,0"). * @param sampleRate samples per second (e.g. 44100 for 44.1kHz). * @param bitsPerSample bits per sample (e.g. 16 bits). * @param channel number of channels of the audio source * (e.g. 1 for mono, 2 for stereo, etc.). * @exception Exception */ inline PulseAudioDspSource ( const char * paSourceName, int sampleRate = 44100, int bitsPerSample = 16, int channel = 2 ) throw ( Exception ) : AudioSource( sampleRate, bitsPerSample, channel) { init( paSourceName); } /** * Copy Constructor. * * @param ds the object to copy. * @exception Exception */ inline PulseAudioDspSource ( const PulseAudioDspSource & ds ) throw ( Exception ) : AudioSource( ds ) { init( ds.sourceName); } /** * Destructor. * * @exception Exception */ inline virtual ~PulseAudioDspSource ( void ) throw ( Exception ) { strip(); } /** * Assignment operator. * * @param ds the object to assign to this one. * @return a reference to this object. * @exception Exception */ inline virtual PulseAudioDspSource & operator= ( const PulseAudioDspSource & ds ) throw ( Exception ) { if ( this != &ds ) { strip(); AudioSource::operator=( ds); init( ds.sourceName); } return *this; } /** * Open the PulseAudioDspSource. * * @return true if opening was successful, false otherwise * @exception Exception */ virtual bool open ( void ) throw ( Exception ); /** * Check if the PulseAudioDspSource is open. * * @return true if the PulseAudioDspSource is open, false otherwise. */ inline virtual bool isOpen ( void ) const throw () { return s==NULL; } /** * Check if the PulseAudioDspSource can be read from. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true if the PulseAudioDspSource is ready to be read from, * false otherwise. * @exception Exception */ virtual bool canRead ( unsigned int sec, unsigned int usec ) throw ( Exception ); /** * Read from the PulseAudioDspSource. * * @param buf the buffer to read into. * @param len the number of bytes to read into buf * @return the number of bytes read (may be less than len). * @exception Exception */ virtual unsigned int read ( void * buf, unsigned int len ) throw ( Exception ); /** * Close the PulseAudioDspSource. * * @exception Exception */ virtual void close ( void ) throw ( Exception ); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* PULSEAUDIO_SOURCE_H */ darkice-1.2/configure0000755000175000017500000070240712170707117011623 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for darkice 1.2. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='darkice' PACKAGE_TARNAME='darkice' PACKAGE_VERSION='1.2' PACKAGE_STRING='darkice 1.2' PACKAGE_BUGREPORT='' PACKAGE_URL='' ac_unique_file="src/DarkIce.cpp" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS DEBUG_CXXFLAGS HAVE_SRC_LIB_FALSE HAVE_SRC_LIB_TRUE SRC_INCFLAGS SRC_LDFLAGS SRC_CFLAGS JACK_INCFLAGS JACK_LDFLAGS JACK_CFLAGS PULSEAUDIO_LDFLAGS PULSEAUDIO_INCFLAGS ALSA_LDFLAGS ALSA_INCFLAGS TWOLAME_LDFLAGS TWOLAME_INCFLAGS AACPLUS_LDFLAGS AACPLUS_INCFLAGS FAAC_LDFLAGS FAAC_INCFLAGS OPUS_LDFLAGS OPUS_INCFLAGS VORBIS_LDFLAGS VORBIS_INCFLAGS LAME_LDFLAGS LAME_INCFLAGS PTHREAD_CFLAGS PTHREAD_LIBS PTHREAD_CC acx_pthread_config host_os host_vendor host_cpu host build_os build_vendor build_cpu build EGREP GREP CPP am__fastdepCXX_FALSE am__fastdepCXX_TRUE CXXDEPMODE ac_ct_CXX CXXFLAGS CXX am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_dependency_tracking with_lame with_lame_prefix with_vorbis with_vorbis_prefix with_opus with_opus_prefix with_faac with_faac_prefix with_aacplus with_aacplus_prefix with_twolame with_twolame_prefix with_alsa with_alsa_prefix with_pulseaudio with_pulseaudio_prefix with_jack with_jack_prefix with_samplerate with_samplerate_prefix with_debug ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CXX CXXFLAGS CCC CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures darkice 1.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/darkice] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of darkice 1.2:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-lame use lame for encoding mp3 streams yes --with-lame-prefix=DIR alternate location for lame /usr look for libraries in LAME-PREFIX/lib, for headers in LAME-PREFIX/include --with-vorbis use Ogg Vorbis for encoding vorbis streams yes --with-vorbis-prefix=DIR alternate location for vorbis /usr look for libraries in VORBIS-PREFIX/lib, for headers in VORBIS-PREFIX/include --with-opus use Ogg Opus for encoding opus streams yes --with-opus-prefix=DIR alternate location for opus /usr look for libraries in OPUS-PREFIX/lib, for headers in OPUS-PREFIX/include --with-faac use faac for encoding AAC streams yes --with-faac-prefix=DIR alternate location for faac /usr look for libraries in FAAC-PREFIX/lib, for headers in FAAC-PREFIX/include --with-aacplus use aacplus for encoding AAC HEv2 streams yes --with-aacplus-prefix=DIR alternate location for aacplus /usr look for libraries in AACPLUS-PREFIX/lib, for headers in AACPLUS-PREFIX/include --with-twolame use twolame for encoding MP2 streams yes --with-twolame-prefix=DIR alternate location for twolame /usr look for libraries in TWOLAME-PREFIX/lib, for headers in TWOLAME-PREFIX/include --with-alsa use ALSA sound system yes --with-alsa-prefix=DIR alternate location for ALSA /usr look for libraries in ALSA-PREFIX/lib, for headers in ALSA-PREFIX/include --with-pulseaudio use PULSEAUDIO sound system yes --with-pulseaudio-prefix=DIR alternate location for PULSEAUDIO /usr look for libraries in PULSEAUDIO-PREFIX/lib, for headers in PULSEAUDIO-PREFIX/include --with-jack use JACK sound system yes --with-jack-prefix=DIR alternate location for JACK /usr look for libraries in JACK-PREFIX/lib, for headers in JACK-PREFIX/include --with-samplerate use Secret Rabbit Code (aka libsamplerate) for samplerate conversion yes --with-samplerate-prefix=DIR alternate location for samplerate /usr look for libraries in SRC-PREFIX/lib, for headers in SRC-PREFIX/include --with-debug enable debug mode no Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CXX C++ compiler command CXXFLAGS C++ compiler flags CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF darkice configure 1.2 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_cxx_try_compile LINENO # ---------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by darkice $as_me 1.2, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers src/config.h" am__api_version='1.11' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='darkice' VERSION='1.2' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 $as_echo "$CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 $as_echo "$ac_ct_CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CXX" && break done if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 $as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } if ${ac_cv_cxx_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 $as_echo "$ac_cv_cxx_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 $as_echo_n "checking whether $CXX accepts -g... " >&6; } if ${ac_cv_prog_cxx_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes else CXXFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : else ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 $as_echo "$ac_cv_prog_cxx_g" >&6; } if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi 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 depcc="$CXX" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CXX_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CXX_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CXX_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CXX_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 $as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then am__fastdepCXX_TRUE= am__fastdepCXX_FALSE='#' else am__fastdepCXX_TRUE='#' am__fastdepCXX_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in errno.h fcntl.h stdio.h stdlib.h string.h unistd.h limits.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in signal.h time.h sys/time.h sys/types.h sys/wait.h math.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in netdb.h netinet/in.h sys/ioctl.h sys/socket.h sys/stat.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in sched.h pthread.h termios.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in sys/soundcard.h sys/audio.h sys/audioio.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5 $as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; } if ${ac_cv_header_sys_wait_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #ifndef WEXITSTATUS # define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8) #endif #ifndef WIFEXITED # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) #endif int main () { int s; wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_sys_wait_h=yes else ac_cv_header_sys_wait_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_wait_h" >&5 $as_echo "$ac_cv_header_sys_wait_h" >&6; } if test $ac_cv_header_sys_wait_h = yes; then $as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" if test "x$ac_cv_type_pid_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define pid_t int _ACEOF fi ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } if ${ac_cv_c_bigendian+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_bigendian=unknown # See if we're dealing with a universal compiler. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __APPLE_CC__ not a universal capable compiler #endif typedef int dummy; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # Check for potential -arch flags. It is not universal unless # there are at least two -arch flags with different values. ac_arch= ac_prev= for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do if test -n "$ac_prev"; then case $ac_word in i?86 | x86_64 | ppc | ppc64) if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then ac_arch=$ac_word else ac_cv_c_bigendian=universal break fi ;; esac ac_prev= elif test "x$ac_word" = "x-arch"; then ac_prev=arch fi done fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_c_bigendian = unknown; then # See if sys/param.h defines the BYTE_ORDER macro. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ && LITTLE_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # It does; now see whether it defined to BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # It does; now see whether it defined to _BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #ifndef _BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # Compile a test program. if test "$cross_compiling" = yes; then : # Try to guess by grepping values from an object file. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; int use_ascii (int i) { return ascii_mm[i] + ascii_ii[i]; } short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; int use_ebcdic (int i) { return ebcdic_mm[i] + ebcdic_ii[i]; } extern int foo; int main () { return use_ascii (foo) == use_ebcdic (foo); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then ac_cv_c_bigendian=yes fi if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then if test "$ac_cv_c_bigendian" = unknown; then ac_cv_c_bigendian=no else # finding both strings is unlikely to happen, but who knows? ac_cv_c_bigendian=unknown fi fi fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* Are we little or big endian? From Harbison&Steele. */ union { long int l; char c[sizeof (long int)]; } u; u.l = 1; return u.c[sizeof (long int) - 1] == 1; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_c_bigendian=no else ac_cv_c_bigendian=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 $as_echo "$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in #( yes) $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h ;; #( no) ;; #( universal) $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h ;; #( *) as_fn_error $? "unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lsocket" >&5 $as_echo_n "checking for socket in -lsocket... " >&6; } if ${ac_cv_lib_socket_socket+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char socket (); int main () { return socket (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_socket_socket=yes else ac_cv_lib_socket_socket=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_socket" >&5 $as_echo "$ac_cv_lib_socket_socket" >&6; } if test "x$ac_cv_lib_socket_socket" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBSOCKET 1 _ACEOF LIBS="-lsocket $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5 $as_echo_n "checking for gethostbyname in -lnsl... " >&6; } if ${ac_cv_lib_nsl_gethostbyname+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gethostbyname (); int main () { return gethostbyname (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_nsl_gethostbyname=yes else ac_cv_lib_nsl_gethostbyname=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_gethostbyname" >&5 $as_echo "$ac_cv_lib_nsl_gethostbyname" >&6; } if test "x$ac_cv_lib_nsl_gethostbyname" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBNSL 1 _ACEOF LIBS="-lnsl $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sched_getscheduler in -lrt" >&5 $as_echo_n "checking for sched_getscheduler in -lrt... " >&6; } if ${ac_cv_lib_rt_sched_getscheduler+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lrt $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char sched_getscheduler (); int main () { return sched_getscheduler (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_rt_sched_getscheduler=yes else ac_cv_lib_rt_sched_getscheduler=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_sched_getscheduler" >&5 $as_echo "$ac_cv_lib_rt_sched_getscheduler" >&6; } if test "x$ac_cv_lib_rt_sched_getscheduler" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBRT 1 _ACEOF LIBS="-lrt $LIBS" fi ac_fn_c_check_func "$LINENO" "getaddrinfo" "ac_cv_func_getaddrinfo" if test "x$ac_cv_func_getaddrinfo" = xyes; then : $as_echo "#define HAVE_GETADDRINFO 1" >>confdefs.h fi # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu acx_pthread_ok=no # We used to check for pthread.h first, but this fails if pthread.h # requires special compiler flags (e.g. on True64 or Sequent). # It gets checked for in the link test anyway. # First of all, check if the user has set any of the PTHREAD_LIBS, # etcetera environment variables, and if threads linking works using # them: if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS" >&5 $as_echo_n "checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_join (); int main () { return pthread_join (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : acx_pthread_ok=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_ok" >&5 $as_echo "$acx_pthread_ok" >&6; } if test x"$acx_pthread_ok" = xno; then PTHREAD_LIBS="" PTHREAD_CFLAGS="" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" fi # We must check for the threads library under a number of different # names; the ordering is very important because some systems # (e.g. DEC) have both -lpthread and -lpthreads, where one of the # libraries is broken (non-POSIX). # Create a list of thread flags to try. Items starting with a "-" are # C compiler flags, and other items are library names, except for "none" # which indicates that we try without any flags at all. acx_pthread_flags="pthread-config pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt" # The ordering *is* (sometimes) important. Some notes on the # individual items follow: # pthread-config: use pthread-config program (on NetBSD) # pthreads: AIX (must check this before -lpthread) # none: in case threads are in libc; should be tried before -Kthread and # other compiler flags to prevent continual compiler warnings # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) # -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) # -pthreads: Solaris/gcc # -mthreads: Mingw32/gcc, Lynx/gcc # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it # doesn't hurt to check since this sometimes defines pthreads too; # also defines -D_REENTRANT) # pthread: Linux, etcetera # --thread-safe: KAI C++ case "${host_cpu}-${host_os}" in *solaris*) # On Solaris (at least, for some versions), libc contains stubbed # (non-functional) versions of the pthreads routines, so link-based # tests will erroneously succeed. (We need to link with -pthread or # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather # a function called by this macro, so we could check for that, but # who knows whether they'll stub that too in a future libc.) So, # we'll just look for -pthreads and -lpthread first: acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags" ;; esac if test x"$acx_pthread_ok" = xno; then for flag in $acx_pthread_flags; do case $flag in none) { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work without any flags" >&5 $as_echo_n "checking whether pthreads work without any flags... " >&6; } ;; -*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with $flag" >&5 $as_echo_n "checking whether pthreads work with $flag... " >&6; } PTHREAD_CFLAGS="$flag" ;; pthread-config) # Extract the first word of "pthread-config", so it can be a program name with args. set dummy pthread-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_acx_pthread_config+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$acx_pthread_config"; then ac_cv_prog_acx_pthread_config="$acx_pthread_config" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_acx_pthread_config="yes" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_acx_pthread_config" && ac_cv_prog_acx_pthread_config="no" fi fi acx_pthread_config=$ac_cv_prog_acx_pthread_config if test -n "$acx_pthread_config"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_config" >&5 $as_echo "$acx_pthread_config" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test x"$acx_pthread_config" = xno; then continue; fi PTHREAD_CFLAGS="`pthread-config --cflags`" PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$flag" >&5 $as_echo_n "checking for the pthreads library -l$flag... " >&6; } PTHREAD_LIBS="-l$flag" ;; esac save_LIBS="$LIBS" save_CFLAGS="$CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Check for various functions. We must include pthread.h, # since some functions may be macros. (On the Sequent, we # need a special flag -Kthread to make this header compile.) # We check for pthread_join because it is in -lpthread on IRIX # while pthread_create is in libc. We check for pthread_attr_init # due to DEC craziness with -lpthreads. We check for # pthread_cleanup_push because it is one of the few pthread # functions on Solaris that doesn't have a non-functional libc stub. # We try pthread_create on general principles. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { pthread_t th; pthread_join(th, 0); pthread_attr_init(0); pthread_cleanup_push(0, 0); pthread_create(0,0,0,0); pthread_cleanup_pop(0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : acx_pthread_ok=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_ok" >&5 $as_echo "$acx_pthread_ok" >&6; } if test "x$acx_pthread_ok" = xyes; then break; fi PTHREAD_LIBS="" PTHREAD_CFLAGS="" done fi # Various other checks: if test "x$acx_pthread_ok" = xyes; then save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Detect AIX lossage: threads are created detached by default # and the JOINABLE attribute has a nonstandard name (UNDETACHED). { $as_echo "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5 $as_echo_n "checking for joinable pthread attribute... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { int attr=PTHREAD_CREATE_JOINABLE; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ok=PTHREAD_CREATE_JOINABLE else ok=unknown fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test x"$ok" = xunknown; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { int attr=PTHREAD_CREATE_UNDETACHED; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ok=PTHREAD_CREATE_UNDETACHED else ok=unknown fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then $as_echo "#define PTHREAD_CREATE_JOINABLE \$ok" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ok}" >&5 $as_echo "${ok}" >&6; } if test x"$ok" = xunknown; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: we do not know how to create joinable pthreads" >&5 $as_echo "$as_me: WARNING: we do not know how to create joinable pthreads" >&2;} fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if more special flags are required for pthreads" >&5 $as_echo_n "checking if more special flags are required for pthreads... " >&6; } flag=no case "${host_cpu}-${host_os}" in *-aix* | *-freebsd*) flag="-D_THREAD_SAFE";; *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${flag}" >&5 $as_echo "${flag}" >&6; } if test "x$flag" != xno; then PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" # More AIX lossage: must compile with cc_r # Extract the first word of "cc_r", so it can be a program name with args. set dummy cc_r; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_PTHREAD_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$PTHREAD_CC"; then ac_cv_prog_PTHREAD_CC="$PTHREAD_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_PTHREAD_CC="cc_r" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_PTHREAD_CC" && ac_cv_prog_PTHREAD_CC="${CC}" fi fi PTHREAD_CC=$ac_cv_prog_PTHREAD_CC if test -n "$PTHREAD_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PTHREAD_CC" >&5 $as_echo "$PTHREAD_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else PTHREAD_CC="$CC" fi # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test x"$acx_pthread_ok" = xyes; then $as_echo "#define HAVE_PTHREAD 1" >>confdefs.h : else acx_pthread_ok=no as_fn_error $? "pthread library not found " "$LINENO" 5 fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu SYSTEM_INCLUDE=/usr/include # Check whether --with-lame was given. if test "${with_lame+set}" = set; then : withval=$with_lame; USE_LAME=${withval} else USE_LAME="yes" fi # Check whether --with-lame-prefix was given. if test "${with_lame_prefix+set}" = set; then : withval=$with_lame_prefix; CONFIG_LAME_PREFIX="${withval}" else CONFIG_LAME_PREFIX="/usr" fi if test "x${USE_LAME}" = "xyes" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lame library at ${CONFIG_LAME_PREFIX} " >&5 $as_echo_n "checking for lame library at ${CONFIG_LAME_PREFIX} ... " >&6; } LAME_LIB_LOC= for FILE in libmp3lame.a libmp3lame.so; do for DIR in ${CONFIG_LAME_PREFIX} ${CONFIG_LAME_PREFIX}/lib64 ${CONFIG_LAME_PREFIX}/lib ${CONFIG_LAME_PREFIX}/lib/x86_64-linux-gnu ; do if test ".LAME_LIB_LOC"="." && test -f "$DIR/$FILE"; then LAME_LIB_LOC=$DIR fi done done LAME_INC_LOC= for FILE in lame/lame.h; do for DIR in ${CONFIG_LAME_PREFIX} ${CONFIG_LAME_PREFIX}/include ; do if test ".LAME_INC_LOC"="." && test -f "$DIR/$FILE"; then LAME_INC_LOC=$DIR fi done done if test ".LAME_LIB_LOC" = "." || test ".LAME_INC_LOC" = "."; then LAME_LIB_LOC= LAME_INC_LOC= fi if test "x${LAME_LIB_LOC}" != "x" ; then $as_echo "#define HAVE_LAME_LIB 1" >>confdefs.h if test "x${LAME_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then LAME_INCFLAGS="-I${LAME_INC_LOC}" fi LAME_LDFLAGS="-L${LAME_LIB_LOC} -lmp3lame" { $as_echo "$as_me:${as_lineno-$LINENO}: result: found at ${CONFIG_LAME_PREFIX} " >&5 $as_echo "found at ${CONFIG_LAME_PREFIX} " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: not found, building without lame" >&5 $as_echo "$as_me: WARNING: not found, building without lame" >&2;} fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: building without lame " >&5 $as_echo "building without lame " >&6; } fi # Check whether --with-vorbis was given. if test "${with_vorbis+set}" = set; then : withval=$with_vorbis; USE_VORBIS=${withval} else USE_VORBIS="yes" fi # Check whether --with-vorbis-prefix was given. if test "${with_vorbis_prefix+set}" = set; then : withval=$with_vorbis_prefix; CONFIG_VORBIS_PREFIX="${withval}" else CONFIG_VORBIS_PREFIX="/usr" fi if test "x${USE_VORBIS}" = "xyes" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for vorbis libraries at ${CONFIG_VORBIS_PREFIX} " >&5 $as_echo_n "checking for vorbis libraries at ${CONFIG_VORBIS_PREFIX} ... " >&6; } OGG_LIB_LOC= for FILE in libogg.a libogg.so; do for DIR in ${CONFIG_VORBIS_PREFIX} ${CONFIG_VORBIS_PREFIX}/lib64 ${CONFIG_VORBIS_PREFIX}/lib ${CONFIG_VORBIS_PREFIX}/lib/x86_64-linux-gnu ; do if test ".OGG_LIB_LOC"="." && test -f "$DIR/$FILE"; then OGG_LIB_LOC=$DIR fi done done OGG_INC_LOC= for FILE in ogg/ogg.h; do for DIR in ${CONFIG_VORBIS_PREFIX} ${CONFIG_VORBIS_PREFIX}/include ; do if test ".OGG_INC_LOC"="." && test -f "$DIR/$FILE"; then OGG_INC_LOC=$DIR fi done done if test ".OGG_LIB_LOC" = "." || test ".OGG_INC_LOC" = "."; then OGG_LIB_LOC= OGG_INC_LOC= fi VORBIS_LIB_LOC= for FILE in libvorbis.a libvorbis.so; do for DIR in ${CONFIG_VORBIS_PREFIX} ${CONFIG_VORBIS_PREFIX}/lib64 ${CONFIG_VORBIS_PREFIX}/lib ${CONFIG_VORBIS_PREFIX}/lib/x86_64-linux-gnu ; do if test ".VORBIS_LIB_LOC"="." && test -f "$DIR/$FILE"; then VORBIS_LIB_LOC=$DIR fi done done VORBIS_INC_LOC= for FILE in vorbis/codec.h; do for DIR in ${CONFIG_VORBIS_PREFIX} ${CONFIG_VORBIS_PREFIX}/include ; do if test ".VORBIS_INC_LOC"="." && test -f "$DIR/$FILE"; then VORBIS_INC_LOC=$DIR fi done done if test ".VORBIS_LIB_LOC" = "." || test ".VORBIS_INC_LOC" = "."; then VORBIS_LIB_LOC= VORBIS_INC_LOC= fi VORBISENC_LIB_LOC= for FILE in libvorbisenc.a libvorbisenc.so; do for DIR in ${CONFIG_VORBIS_PREFIX} ${CONFIG_VORBIS_PREFIX}/lib64 ${CONFIG_VORBIS_PREFIX}/lib ${CONFIG_VORBIS_PREFIX}/lib/x86_64-linux-gnu ; do if test ".VORBISENC_LIB_LOC"="." && test -f "$DIR/$FILE"; then VORBISENC_LIB_LOC=$DIR fi done done VORBISENC_INC_LOC= for FILE in vorbis/vorbisenc.h; do for DIR in ${CONFIG_VORBIS_PREFIX} ${CONFIG_VORBIS_PREFIX}/include ; do if test ".VORBISENC_INC_LOC"="." && test -f "$DIR/$FILE"; then VORBISENC_INC_LOC=$DIR fi done done if test ".VORBISENC_LIB_LOC" = "." || test ".VORBISENC_INC_LOC" = "."; then VORBISENC_LIB_LOC= VORBISENC_INC_LOC= fi if test "x${OGG_LIB_LOC}" != "x" -a \ "x${VORBIS_LIB_LOC}" != "x" -a \ "x${VORBISENC_LIB_LOC}" != "x" ; then $as_echo "#define HAVE_VORBIS_LIB 1" >>confdefs.h if test "x${OGG_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then VORBIS_INCFLAGS="-I${OGG_INC_LOC}" fi VORBIS_LDFLAGS="-L${OGG_LIB_LOC} -logg -lvorbis -lvorbisenc" { $as_echo "$as_me:${as_lineno-$LINENO}: result: found at ${CONFIG_VORBIS_PREFIX} " >&5 $as_echo "found at ${CONFIG_VORBIS_PREFIX} " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: not found, building without Ogg Vorbis" >&5 $as_echo "$as_me: WARNING: not found, building without Ogg Vorbis" >&2;} fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: building without Ogg Vorbis " >&5 $as_echo "building without Ogg Vorbis " >&6; } fi # Check whether --with-opus was given. if test "${with_opus+set}" = set; then : withval=$with_opus; USE_OPUS=${withval} else USE_OPUS="yes" fi # Check whether --with-opus-prefix was given. if test "${with_opus_prefix+set}" = set; then : withval=$with_opus_prefix; CONFIG_OPUS_PREFIX="${withval}" else CONFIG_OPUS_PREFIX="/usr" fi if test "x${USE_OPUS}" = "xyes" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for opus libraries at ${CONFIG_OPUS_PREFIX} " >&5 $as_echo_n "checking for opus libraries at ${CONFIG_OPUS_PREFIX} ... " >&6; } OGG_LIB_LOC= for FILE in libogg.a libogg.so; do for DIR in ${CONFIG_OPUS_PREFIX} ${CONFIG_OPUS_PREFIX}/lib64 ${CONFIG_OPUS_PREFIX}/lib ${CONFIG_OPUS_PREFIX}/lib/x86_64-linux-gnu ; do if test ".OGG_LIB_LOC"="." && test -f "$DIR/$FILE"; then OGG_LIB_LOC=$DIR fi done done OGG_INC_LOC= for FILE in ogg/ogg.h; do for DIR in ${CONFIG_OPUS_PREFIX} ${CONFIG_OPUS_PREFIX}/include ; do if test ".OGG_INC_LOC"="." && test -f "$DIR/$FILE"; then OGG_INC_LOC=$DIR fi done done if test ".OGG_LIB_LOC" = "." || test ".OGG_INC_LOC" = "."; then OGG_LIB_LOC= OGG_INC_LOC= fi OPUS_LIB_LOC= for FILE in libopus.a libopus.so; do for DIR in ${CONFIG_OPUS_PREFIX} ${CONFIG_OPUS_PREFIX}/lib64 ${CONFIG_OPUS_PREFIX}/lib ${CONFIG_OPUS_PREFIX}/lib/x86_64-linux-gnu ; do if test ".OPUS_LIB_LOC"="." && test -f "$DIR/$FILE"; then OPUS_LIB_LOC=$DIR fi done done OPUS_INC_LOC= for FILE in opus/opus.h; do for DIR in ${CONFIG_OPUS_PREFIX} ${CONFIG_OPUS_PREFIX}/include ; do if test ".OPUS_INC_LOC"="." && test -f "$DIR/$FILE"; then OPUS_INC_LOC=$DIR fi done done if test ".OPUS_LIB_LOC" = "." || test ".OPUS_INC_LOC" = "."; then OPUS_LIB_LOC= OPUS_INC_LOC= fi if test "x${OGG_LIB_LOC}" != "x" -a \ "x${OPUS_LIB_LOC}" != "x" ; then $as_echo "#define HAVE_OPUS_LIB 1" >>confdefs.h if test "x${OGG_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then OPUS_INCFLAGS="-I${OGG_INC_LOC}" fi OPUS_LDFLAGS="-L${OGG_LIB_LOC} -logg -lopus" { $as_echo "$as_me:${as_lineno-$LINENO}: result: found at ${CONFIG_OPUS_PREFIX} " >&5 $as_echo "found at ${CONFIG_OPUS_PREFIX} " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: not found, building without Ogg Opus" >&5 $as_echo "$as_me: WARNING: not found, building without Ogg Opus" >&2;} fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: building without Ogg Opus " >&5 $as_echo "building without Ogg Opus " >&6; } fi # Check whether --with-faac was given. if test "${with_faac+set}" = set; then : withval=$with_faac; USE_FAAC=${withval} else USE_FAAC="yes" fi # Check whether --with-faac-prefix was given. if test "${with_faac_prefix+set}" = set; then : withval=$with_faac_prefix; CONFIG_FAAC_PREFIX="${withval}" else CONFIG_FAAC_PREFIX="/usr" fi if test "x${USE_FAAC}" = "xyes" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for faac library at ${CONFIG_FAAC_PREFIX} " >&5 $as_echo_n "checking for faac library at ${CONFIG_FAAC_PREFIX} ... " >&6; } FAAC_LIB_LOC= for FILE in libfaac.a libfaac.so; do for DIR in ${CONFIG_FAAC_PREFIX} ${CONFIG_FAAC_PREFIX}/lib64 ${CONFIG_FAAC_PREFIX}/lib ${CONFIG_FAAC_PREFIX}/lib/x86_64-linux-gnu ; do if test ".FAAC_LIB_LOC"="." && test -f "$DIR/$FILE"; then FAAC_LIB_LOC=$DIR fi done done FAAC_INC_LOC= for FILE in faac.h; do for DIR in ${CONFIG_FAAC_PREFIX} ${CONFIG_FAAC_PREFIX}/include ; do if test ".FAAC_INC_LOC"="." && test -f "$DIR/$FILE"; then FAAC_INC_LOC=$DIR fi done done if test ".FAAC_LIB_LOC" = "." || test ".FAAC_INC_LOC" = "."; then FAAC_LIB_LOC= FAAC_INC_LOC= fi if test "x${FAAC_LIB_LOC}" != "x" ; then $as_echo "#define HAVE_FAAC_LIB 1" >>confdefs.h if test "x${FAAC_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then FAAC_INCFLAGS="-I${FAAC_INC_LOC}" fi FAAC_LDFLAGS="-L${FAAC_LIB_LOC} -lfaac" { $as_echo "$as_me:${as_lineno-$LINENO}: result: found at ${CONFIG_FAAC_PREFIX} " >&5 $as_echo "found at ${CONFIG_FAAC_PREFIX} " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: not found, building without faac" >&5 $as_echo "$as_me: WARNING: not found, building without faac" >&2;} fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: building without faac " >&5 $as_echo "building without faac " >&6; } fi # Check whether --with-aacplus was given. if test "${with_aacplus+set}" = set; then : withval=$with_aacplus; USE_AACPLUS=${withval} else USE_AACPLUS="yes" fi # Check whether --with-aacplus-prefix was given. if test "${with_aacplus_prefix+set}" = set; then : withval=$with_aacplus_prefix; CONFIG_AACPLUS_PREFIX="${withval}" else CONFIG_AACPLUS_PREFIX="/usr" fi if test "x${USE_AACPLUS}" = "xyes" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for aacplus library at ${CONFIG_AACPLUS_PREFIX} " >&5 $as_echo_n "checking for aacplus library at ${CONFIG_AACPLUS_PREFIX} ... " >&6; } AACPLUS_LIB_LOC= for FILE in libaacplus.a libaacplus.so; do for DIR in ${CONFIG_AACPLUS_PREFIX} ${CONFIG_AACPLUS_PREFIX}/lib64 ${CONFIG_AACPLUS_PREFIX}/lib ${CONFIG_AACPLUS_PREFIX}/lib/x86_64-linux-gnu ; do if test ".AACPLUS_LIB_LOC"="." && test -f "$DIR/$FILE"; then AACPLUS_LIB_LOC=$DIR fi done done AACPLUS_INC_LOC= for FILE in aacplus.h; do for DIR in ${CONFIG_AACPLUS_PREFIX} ${CONFIG_AACPLUS_PREFIX}/include ; do if test ".AACPLUS_INC_LOC"="." && test -f "$DIR/$FILE"; then AACPLUS_INC_LOC=$DIR fi done done if test ".AACPLUS_LIB_LOC" = "." || test ".AACPLUS_INC_LOC" = "."; then AACPLUS_LIB_LOC= AACPLUS_INC_LOC= fi if test "x${AACPLUS_LIB_LOC}" != "x" ; then $as_echo "#define HAVE_AACPLUS_LIB 1" >>confdefs.h if test "x${AACPLUS_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then AACPLUS_INCFLAGS="-I${AACPLUS_INC_LOC}" fi AACPLUS_LDFLAGS="-L${AACPLUS_LIB_LOC} -laacplus" { $as_echo "$as_me:${as_lineno-$LINENO}: result: found at ${CONFIG_AACPLUS_PREFIX} " >&5 $as_echo "found at ${CONFIG_AACPLUS_PREFIX} " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: not found, building without aacplus" >&5 $as_echo "$as_me: WARNING: not found, building without aacplus" >&2;} fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: building without aacplus " >&5 $as_echo "building without aacplus " >&6; } fi # Check whether --with-twolame was given. if test "${with_twolame+set}" = set; then : withval=$with_twolame; USE_TWOLAME=${withval} else USE_TWOLAME="yes" fi # Check whether --with-twolame-prefix was given. if test "${with_twolame_prefix+set}" = set; then : withval=$with_twolame_prefix; CONFIG_TWOLAME_PREFIX="${withval}" else CONFIG_TWOLAME_PREFIX="/usr" fi if test "x${USE_TWOLAME}" = "xyes" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for twolame library at ${CONFIG_TWOLAME_PREFIX} " >&5 $as_echo_n "checking for twolame library at ${CONFIG_TWOLAME_PREFIX} ... " >&6; } TWOLAME_LIB_LOC= for FILE in libtwolame.a libtwolame.so; do for DIR in ${CONFIG_TWOLAME_PREFIX} ${CONFIG_TWOLAME_PREFIX}/lib64 ${CONFIG_TWOLAME_PREFIX}/lib ${CONFIG_TWOLAME_PREFIX}/lib/x86_64-linux-gnu ; do if test ".TWOLAME_LIB_LOC"="." && test -f "$DIR/$FILE"; then TWOLAME_LIB_LOC=$DIR fi done done TWOLAME_INC_LOC= for FILE in twolame.h; do for DIR in ${CONFIG_TWOLAME_PREFIX} ${CONFIG_TWOLAME_PREFIX}/include ; do if test ".TWOLAME_INC_LOC"="." && test -f "$DIR/$FILE"; then TWOLAME_INC_LOC=$DIR fi done done if test ".TWOLAME_LIB_LOC" = "." || test ".TWOLAME_INC_LOC" = "."; then TWOLAME_LIB_LOC= TWOLAME_INC_LOC= fi if test "x${TWOLAME_LIB_LOC}" != "x" ; then $as_echo "#define HAVE_TWOLAME_LIB 1" >>confdefs.h if test "x${TWOLAME_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then TWOLAME_INCFLAGS="-I${TWOLAME_INC_LOC}" fi TWOLAME_LDFLAGS="-L${TWOLAME_LIB_LOC} -ltwolame" { $as_echo "$as_me:${as_lineno-$LINENO}: result: found at ${CONFIG_TWOLAME_PREFIX} " >&5 $as_echo "found at ${CONFIG_TWOLAME_PREFIX} " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: not found, building without twolame" >&5 $as_echo "$as_me: WARNING: not found, building without twolame" >&2;} fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: building without twolame " >&5 $as_echo "building without twolame " >&6; } fi if test "x${LAME_LDFLAGS}" = "x" \ -a "x${VORBIS_LDFLAGS}" = "x" \ -a "x${FAAC_LDFLAGS}" = "x" \ -a "x${AACPLUS_LDFLAGS}" = "x" \ -a "x${TWOLAME_LDFLAGS}" = "x"; then as_fn_error $? "neither lame, Ogg Vorbis, faac, aac+ nor twolame configured" "$LINENO" 5 fi # Check whether --with-alsa was given. if test "${with_alsa+set}" = set; then : withval=$with_alsa; USE_ALSA=${withval} else USE_ALSA="yes" fi # Check whether --with-alsa-prefix was given. if test "${with_alsa_prefix+set}" = set; then : withval=$with_alsa_prefix; CONFIG_ALSA_PREFIX="${withval}" else CONFIG_ALSA_PREFIX="/usr" fi if test "x${USE_ALSA}" = "xyes" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for alsa libraries at ${CONFIG_ALSA_PREFIX} " >&5 $as_echo_n "checking for alsa libraries at ${CONFIG_ALSA_PREFIX} ... " >&6; } ALSA_LIB_LOC= for FILE in libasound.so; do for DIR in ${CONFIG_ALSA_PREFIX} ${CONFIG_ALSA_PREFIX}/lib64 ${CONFIG_ALSA_PREFIX}/lib ${CONFIG_ALSA_PREFIX}/lib/x86_64-linux-gnu ; do if test ".ALSA_LIB_LOC"="." && test -f "$DIR/$FILE"; then ALSA_LIB_LOC=$DIR fi done done ALSA_INC_LOC= for FILE in alsa/asoundlib.h; do for DIR in ${CONFIG_ALSA_PREFIX} ${CONFIG_ALSA_PREFIX}/include ; do if test ".ALSA_INC_LOC"="." && test -f "$DIR/$FILE"; then ALSA_INC_LOC=$DIR fi done done if test ".ALSA_LIB_LOC" = "." || test ".ALSA_INC_LOC" = "."; then ALSA_LIB_LOC= ALSA_INC_LOC= fi if test "x${ALSA_LIB_LOC}" != "x" ; then $as_echo "#define HAVE_ALSA_LIB 1" >>confdefs.h if test "x${ALSA_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then ALSA_INCFLAGS="-I${ALSA_INC_LOC}" fi ALSA_LDFLAGS="-L${ALSA_LIB_LOC} -lasound" { $as_echo "$as_me:${as_lineno-$LINENO}: result: found at ${CONFIG_ALSA_PREFIX} " >&5 $as_echo "found at ${CONFIG_ALSA_PREFIX} " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: not found, building without ALSA support" >&5 $as_echo "$as_me: WARNING: not found, building without ALSA support" >&2;} fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: building without ALSA support " >&5 $as_echo "building without ALSA support " >&6; } fi # Check whether --with-pulseaudio was given. if test "${with_pulseaudio+set}" = set; then : withval=$with_pulseaudio; USE_PULSEAUDIO=${withval} else USE_PULSEAUDIO="yes" fi # Check whether --with-pulseaudio-prefix was given. if test "${with_pulseaudio_prefix+set}" = set; then : withval=$with_pulseaudio_prefix; CONFIG_PULSEAUDIO_PREFIX="${withval}" else CONFIG_PULSEAUDIO_PREFIX="/usr" fi if test "x${USE_PULSEAUDIO}" = "xyes" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pulseaudio libraries at ${CONFIG_PULSEAUDIO_PREFIX} " >&5 $as_echo_n "checking for pulseaudio libraries at ${CONFIG_PULSEAUDIO_PREFIX} ... " >&6; } PULSEAUDIO_LIB_LOC= for FILE in libpulse.so; do for DIR in ${CONFIG_PULSEAUDIO_PREFIX} ${CONFIG_PULSEAUDIO_PREFIX}/lib64 ${CONFIG_PULSEAUDIO_PREFIX}/lib ${CONFIG_PULSEAUDIO_PREFIX}/lib/x86_64-linux-gnu ; do if test ".PULSEAUDIO_LIB_LOC"="." && test -f "$DIR/$FILE"; then PULSEAUDIO_LIB_LOC=$DIR fi done done PULSEAUDIO_INC_LOC= for FILE in pulse/pulseaudio.h; do for DIR in ${CONFIG_PULSEAUDIO_PREFIX} ${CONFIG_PULSEAUDIO_PREFIX}/include ; do if test ".PULSEAUDIO_INC_LOC"="." && test -f "$DIR/$FILE"; then PULSEAUDIO_INC_LOC=$DIR fi done done if test ".PULSEAUDIO_LIB_LOC" = "." || test ".PULSEAUDIO_INC_LOC" = "."; then PULSEAUDIO_LIB_LOC= PULSEAUDIO_INC_LOC= fi if test "x${PULSEAUDIO_LIB_LOC}" != "x" ; then $as_echo "#define HAVE_PULSEAUDIO_LIB 1" >>confdefs.h if test "x${PULSEAUDIO_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then PULSEAUDIO_INCFLAGS="-I${PULSEAUDIO_INC_LOC}" fi PULSEAUDIO_LDFLAGS="-L${PULSEAUDIO_LIB_LOC} -lpulse-simple -L${PULSEAUDIO_LIB_LOC} -lpulse" { $as_echo "$as_me:${as_lineno-$LINENO}: result: found at ${CONFIG_PULSEAUDIO_PREFIX} " >&5 $as_echo "found at ${CONFIG_PULSEAUDIO_PREFIX} " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: not found, building without PULSEAUDIO support" >&5 $as_echo "$as_me: WARNING: not found, building without PULSEAUDIO support" >&2;} fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: building without PULSEAUDIO support " >&5 $as_echo "building without PULSEAUDIO support " >&6; } fi # Check whether --with-jack was given. if test "${with_jack+set}" = set; then : withval=$with_jack; USE_JACK=${withval} else USE_JACK="yes" fi # Check whether --with-jack-prefix was given. if test "${with_jack_prefix+set}" = set; then : withval=$with_jack_prefix; CONFIG_JACK_PREFIX="${withval}" else CONFIG_JACK_PREFIX="/usr" fi if test "x${USE_JACK}" = "xyes" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jack libraries at ${CONFIG_JACK_PREFIX} " >&5 $as_echo_n "checking for jack libraries at ${CONFIG_JACK_PREFIX} ... " >&6; } JACK_LIB_LOC= for FILE in libjack.la libjack.so libjack.dylib; do for DIR in ${CONFIG_JACK_PREFIX} ${CONFIG_JACK_PREFIX}/lib64 ${CONFIG_JACK_PREFIX}/lib ${CONFIG_JACK_PREFIX}/lib/x86_64-linux-gnu ; do if test ".JACK_LIB_LOC"="." && test -f "$DIR/$FILE"; then JACK_LIB_LOC=$DIR fi done done JACK_INC_LOC= for FILE in jack/jack.h; do for DIR in ${CONFIG_JACK_PREFIX} ${CONFIG_JACK_PREFIX}/include ; do if test ".JACK_INC_LOC"="." && test -f "$DIR/$FILE"; then JACK_INC_LOC=$DIR fi done done if test ".JACK_LIB_LOC" = "." || test ".JACK_INC_LOC" = "."; then JACK_LIB_LOC= JACK_INC_LOC= fi if test "x${JACK_LIB_LOC}" != "x" ; then $as_echo "#define HAVE_JACK_LIB 1" >>confdefs.h if test "x${JACK_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then JACK_INCFLAGS="-I${JACK_INC_LOC}" fi JACK_LDFLAGS="-L${JACK_LIB_LOC} -ljack" { $as_echo "$as_me:${as_lineno-$LINENO}: result: found at ${CONFIG_JACK_PREFIX} " >&5 $as_echo "found at ${CONFIG_JACK_PREFIX} " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: not found, building without JACK support" >&5 $as_echo "$as_me: WARNING: not found, building without JACK support" >&2;} fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: building without JACK support " >&5 $as_echo "building without JACK support " >&6; } fi # Check whether --with-samplerate was given. if test "${with_samplerate+set}" = set; then : withval=$with_samplerate; USE_SRC=${withval} else USE_SRC="yes" fi # Check whether --with-samplerate-prefix was given. if test "${with_samplerate_prefix+set}" = set; then : withval=$with_samplerate_prefix; CONFIG_SRC_PREFIX="${withval}" else CONFIG_SRC_PREFIX="/usr" fi if test "x${USE_SRC}" = "xyes" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for samplerate libraries at ${CONFIG_SRC_PREFIX} " >&5 $as_echo_n "checking for samplerate libraries at ${CONFIG_SRC_PREFIX} ... " >&6; } SRC_LIB_LOC= for FILE in libsamplerate.la libsamplerate.so libsamplerate.dylib; do for DIR in ${CONFIG_SRC_PREFIX} ${CONFIG_SRC_PREFIX}/lib64 ${CONFIG_SRC_PREFIX}/lib ${CONFIG_SRC_PREFIX}/lib/x86_64-linux-gnu ; do if test ".SRC_LIB_LOC"="." && test -f "$DIR/$FILE"; then SRC_LIB_LOC=$DIR fi done done SRC_INC_LOC= for FILE in samplerate.h; do for DIR in ${CONFIG_SRC_PREFIX} ${CONFIG_SRC_PREFIX}/include ; do if test ".SRC_INC_LOC"="." && test -f "$DIR/$FILE"; then SRC_INC_LOC=$DIR fi done done if test ".SRC_LIB_LOC" = "." || test ".SRC_INC_LOC" = "."; then SRC_LIB_LOC= SRC_INC_LOC= fi if test "x${SRC_LIB_LOC}" != "x" ; then $as_echo "#define HAVE_SRC_LIB 1" >>confdefs.h if test "x${SRC_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then SRC_INCFLAGS="-I${SRC_INC_LOC}" fi SRC_LDFLAGS="-L${SRC_LIB_LOC} -lsamplerate" { $as_echo "$as_me:${as_lineno-$LINENO}: result: found at ${CONFIG_SRC_PREFIX} " >&5 $as_echo "found at ${CONFIG_SRC_PREFIX} " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: not found, building libsamplerate support" >&5 $as_echo "$as_me: WARNING: not found, building libsamplerate support" >&2;} fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: building without libsamplerate support " >&5 $as_echo "building without libsamplerate support " >&6; } fi if test "x${SRC_LIB_LOC}" != "x"; then HAVE_SRC_LIB_TRUE= HAVE_SRC_LIB_FALSE='#' else HAVE_SRC_LIB_TRUE='#' HAVE_SRC_LIB_FALSE= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MSG_NOSIGNAL" >&5 $as_echo_n "checking for MSG_NOSIGNAL... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { int f = MSG_NOSIGNAL; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # Yes, we have it... { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } $as_echo "#define HAVE_MSG_NOSIGNAL 1" >>confdefs.h else # We'll have to use signals { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext for ac_func in sched_getscheduler sched_getparam do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done # Check whether --with-debug was given. if test "${with_debug+set}" = set; then : withval=$with_debug; USE_DEBUG=${withval} else USE_DEBUG="no" fi if test "x${USE_DEBUG}" == "xyes" ; then DEBUG_CXXFLAGS="-g" { $as_echo "$as_me:${as_lineno-$LINENO}: result: compiling in debug mode" >&5 $as_echo "compiling in debug mode" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: not compiling in debug mode" >&5 $as_echo "not compiling in debug mode" >&6; } fi ac_config_files="$ac_config_files Makefile src/Makefile man/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_SRC_LIB_TRUE}" && test -z "${HAVE_SRC_LIB_FALSE}"; then as_fn_error $? "conditional \"HAVE_SRC_LIB\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by darkice $as_me 1.2, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ darkice config.status 1.2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "src/config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi darkice-1.2/FAQ0000644000175000017500000000112212170706611010226 00000000000000DarkIce Frequenty Asked Questions Q: I get the following error: DarkIce: LameLibEncoder.cpp:75: lame lib opening underlying sink error [0] What am I doing wrong? A: This error means (quite anti-intuitively), that darkice coulnd't connect to the streaming server. Please double-check the following values in your config file: - server - port - password If you're streaming to a shoutcast server, make sure that the port you use is the _source_ port, which is usually 1 above the _client_ port for shoutcast (the defaults are 8000 for client, 8001 for source). darkice-1.2/AUTHORS0000644000175000017500000000335012170706611010751 00000000000000DarkIce initial author: Akos Maroy, DarkIce current maintainer: Rafael Diniz, with contributions by: Jim Crilly, aNa|0Gue, Robin P. Blanchard, Tom Gray, Michael Smith, Julius O. Smith, the OSALP team, http://osalp.sourceforge.net Kristjan G. Bjarnason Nicu Pavel Kai Krakow Atsuhiko Yamanaka Ricardo Galli John Hay Christian Forster John Deeny Robert Lunnon Enrico Ardizzoni Deti Fliegl Nicholas J. Humfrey Joel Ebel Alexander Vlasov Mariusz Mazur dsk Clyde Stubbs Jens Maurer Elod Horvath Pierre Souchay Daniel Hazelbaker Alessandro Beretta Roland Hermans Sergiy Clemens Ladisch Edwin van den Oetelaar Adrian Knoth Filipe Roque Johann Fot Alban Peignier darkice-1.2/acinclude.m40000644000175000017500000002672412170706662012112 00000000000000dnl acinclude.m4. Change *this* file to add new or change macros. dnl When changes have been made, delete aclocal.m4 and run dnl "aclocal". dnl dnl DO NOT change aclocal.m4 ! dnl dnl----------------------------------------------------------------------------- dnl LA_SEARCH_FILE(variable, filename, PATH) dnl Search "filename" in the specified "PATH", "variable" will dnl contain the full pathname or the empty string dnl PATH is space-separated list of directories. dnl by Florian Bomers dnl----------------------------------------------------------------------------- AC_DEFUN([LA_SEARCH_FILE],[ $1= dnl hack: eliminate line feeds in $2 for FILE in $2; do for DIR in $3; do dnl use PATH in order if test ".$1"="." && test -f "$DIR/$FILE"; then $1=$DIR fi done done ]) dnl----------------------------------------------------------------------------- dnl LA_SEARCH_LIB(lib-variable, include-variable, lib-filename, header-filename, prefix) dnl looks for "lib-filename" and "header-filename" in the area of "prefix". dnl if found, "lib-variable" and "include-variable" are set to the dnl respective paths. dnl prefix is a single path dnl libs are searched in prefix, prefix/lib dnl headers are searched in prefix, prefix/include, dnl dnl If one of them is not found, both "lib-variable", "include-variable" are dnl set to the empty string. dnl dnl TODO: assert function call to verify lib dnl dnl by Florian Bomers dnl----------------------------------------------------------------------------- AC_DEFUN([LA_SEARCH_LIB],[ dnl look for lib LA_SEARCH_FILE($1, $3, $5 $5/lib64 $5/lib $5/lib/x86_64-linux-gnu ) dnl look for header. LA_SEARCH_FILE($2, $4, $5 $5/include ) if test ".$1" = "." || test ".$2" = "."; then $1= $2= fi ]) dnl----------------------------------------------------------------------------- dnl funky posix threads checking, thanks to dnl Steven G. Johnson dnl and Alejandro Forero Cuervo dnl see http://www.gnu.org/software/ac-archive/htmldoc/acx_pthread.html dnl----------------------------------------------------------------------------- dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) dnl dnl This macro figures out how to build C programs using POSIX dnl threads. It sets the PTHREAD_LIBS output variable to the threads dnl library and linker flags, and the PTHREAD_CFLAGS output variable dnl to any special C compiler flags that are needed. (The user can also dnl force certain compiler flags/libs to be tested by setting these dnl environment variables.) dnl dnl Also sets PTHREAD_CC to any special C compiler that is needed for dnl multi-threaded programs (defaults to the value of CC otherwise). dnl (This is necessary on AIX to use the special cc_r compiler alias.) dnl dnl NOTE: You are assumed to not only compile your program with these dnl flags, but also link it with them as well. e.g. you should link dnl with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS dnl dnl If you are only building threads programs, you may wish to dnl use these variables in your default LIBS, CFLAGS, and CC: dnl dnl LIBS="$PTHREAD_LIBS $LIBS" dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS" dnl CC="$PTHREAD_CC" dnl dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE dnl to that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). dnl dnl ACTION-IF-FOUND is a list of shell commands to run if a threads dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands dnl to run it if it is not found. If ACTION-IF-FOUND is not specified, dnl the default action will define HAVE_PTHREAD. dnl dnl Please let the authors know if this macro fails on any platform, dnl or if you have any other suggestions or comments. This macro was dnl based on work by SGJ on autoconf scripts for FFTW (www.fftw.org) dnl (with help from M. Frigo), as well as ac_pthread and hb_pthread dnl macros posted by AFC to the autoconf macro repository. We are also dnl grateful for the helpful feedback of numerous users. dnl dnl @version $Id: acinclude.m4 553 2013-07-15 05:50:56Z rafael@riseup.net $ dnl @author Steven G. Johnson and Alejandro Forero Cuervo AC_DEFUN([ACX_PTHREAD], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_LANG_SAVE AC_LANG_C acx_pthread_ok=no # We used to check for pthread.h first, but this fails if pthread.h # requires special compiler flags (e.g. on True64 or Sequent). # It gets checked for in the link test anyway. # First of all, check if the user has set any of the PTHREAD_LIBS, # etcetera environment variables, and if threads linking works using # them: if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes) AC_MSG_RESULT($acx_pthread_ok) if test x"$acx_pthread_ok" = xno; then PTHREAD_LIBS="" PTHREAD_CFLAGS="" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" fi # We must check for the threads library under a number of different # names; the ordering is very important because some systems # (e.g. DEC) have both -lpthread and -lpthreads, where one of the # libraries is broken (non-POSIX). # Create a list of thread flags to try. Items starting with a "-" are # C compiler flags, and other items are library names, except for "none" # which indicates that we try without any flags at all. acx_pthread_flags="pthread-config pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt" # The ordering *is* (sometimes) important. Some notes on the # individual items follow: # pthread-config: use pthread-config program (on NetBSD) # pthreads: AIX (must check this before -lpthread) # none: in case threads are in libc; should be tried before -Kthread and # other compiler flags to prevent continual compiler warnings # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) # -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) # -pthreads: Solaris/gcc # -mthreads: Mingw32/gcc, Lynx/gcc # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it # doesn't hurt to check since this sometimes defines pthreads too; # also defines -D_REENTRANT) # pthread: Linux, etcetera # --thread-safe: KAI C++ case "${host_cpu}-${host_os}" in *solaris*) # On Solaris (at least, for some versions), libc contains stubbed # (non-functional) versions of the pthreads routines, so link-based # tests will erroneously succeed. (We need to link with -pthread or # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather # a function called by this macro, so we could check for that, but # who knows whether they'll stub that too in a future libc.) So, # we'll just look for -pthreads and -lpthread first: acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags" ;; esac if test x"$acx_pthread_ok" = xno; then for flag in $acx_pthread_flags; do case $flag in none) AC_MSG_CHECKING([whether pthreads work without any flags]) ;; -*) AC_MSG_CHECKING([whether pthreads work with $flag]) PTHREAD_CFLAGS="$flag" ;; pthread-config) AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no) if test x"$acx_pthread_config" = xno; then continue; fi PTHREAD_CFLAGS="`pthread-config --cflags`" PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" ;; *) AC_MSG_CHECKING([for the pthreads library -l$flag]) PTHREAD_LIBS="-l$flag" ;; esac save_LIBS="$LIBS" save_CFLAGS="$CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Check for various functions. We must include pthread.h, # since some functions may be macros. (On the Sequent, we # need a special flag -Kthread to make this header compile.) # We check for pthread_join because it is in -lpthread on IRIX # while pthread_create is in libc. We check for pthread_attr_init # due to DEC craziness with -lpthreads. We check for # pthread_cleanup_push because it is one of the few pthread # functions on Solaris that doesn't have a non-functional libc stub. # We try pthread_create on general principles. AC_TRY_LINK([#include ], [pthread_t th; pthread_join(th, 0); pthread_attr_init(0); pthread_cleanup_push(0, 0); pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], [acx_pthread_ok=yes]) LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" AC_MSG_RESULT($acx_pthread_ok) if test "x$acx_pthread_ok" = xyes; then break; fi PTHREAD_LIBS="" PTHREAD_CFLAGS="" done fi # Various other checks: if test "x$acx_pthread_ok" = xyes; then save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Detect AIX lossage: threads are created detached by default # and the JOINABLE attribute has a nonstandard name (UNDETACHED). AC_MSG_CHECKING([for joinable pthread attribute]) AC_TRY_LINK([#include ], [int attr=PTHREAD_CREATE_JOINABLE;], ok=PTHREAD_CREATE_JOINABLE, ok=unknown) if test x"$ok" = xunknown; then AC_TRY_LINK([#include ], [int attr=PTHREAD_CREATE_UNDETACHED;], ok=PTHREAD_CREATE_UNDETACHED, ok=unknown) fi if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then AC_DEFINE(PTHREAD_CREATE_JOINABLE, $ok, [Define to the necessary symbol if this constant uses a non-standard name on your system.]) fi AC_MSG_RESULT(${ok}) if test x"$ok" = xunknown; then AC_MSG_WARN([we do not know how to create joinable pthreads]) fi AC_MSG_CHECKING([if more special flags are required for pthreads]) flag=no case "${host_cpu}-${host_os}" in *-aix* | *-freebsd*) flag="-D_THREAD_SAFE";; *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; esac AC_MSG_RESULT(${flag}) if test "x$flag" != xno; then PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" # More AIX lossage: must compile with cc_r AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC}) else PTHREAD_CC="$CC" fi AC_SUBST(PTHREAD_LIBS) AC_SUBST(PTHREAD_CFLAGS) AC_SUBST(PTHREAD_CC) # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test x"$acx_pthread_ok" = xyes; then ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1]) : else acx_pthread_ok=no $2 fi AC_LANG_RESTORE ])dnl ACX_PTHREAD darkice-1.2/depcomp0000755000175000017500000005064312170706611011265 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2012-03-27.16; # UTC # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010, # 2011, 2012 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # A tabulation character. tab=' ' # A newline character. nl=' ' if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' "$nl" < "$tmpdepfile" | ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependent.h'. # Do two passes, one to just change these to # '$object: dependent.h' and one to simply 'dependent.h:'. sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'. # However on # $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\': # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... # tcc 0.9.26 (FIXME still under development at the moment of writing) # will emit a similar output, but also prepend the continuation lines # with horizontal tabulation characters. "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form 'foo.o: dependent.h', # or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'. # Do two passes, one to just change these to # '$object: dependent.h' and one to simply 'dependent.h:'. sed -e "s/^[ $tab][ $tab]*/ /" -e "s,^[^:]*:,$object :," \ < "$tmpdepfile" > "$depfile" sed ' s/[ '"$tab"'][ '"$tab"']*/ /g s/^ *// s/ *\\*$// s/^[^:]*: *// /^$/d /:$/d s/$/ :/ ' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mechanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test "$stat" = 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' "$nl" < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: darkice-1.2/INSTALL.lame0000644000175000017500000000331312170706611011646 00000000000000Installing Lame --------------- To install DarkIce, you need the Lame 3.89 or later libraries and related header files already installed on your system. It is recommended that use install Lame to the usual system locations, /usr/lib, /usr/include, so that DarkIce will find the header files and libraries. Thus when configuring, add --prefix=/usr to the configure options. Grab the latest lame source tarball from a download site found at http://www.mp3dev.org/mp3/download/download.html or from the DarkIce SourceForge project download area http://sourceforge.net/project/showfiles.php?group_id=14111 I took lame lame-3.91.tar.gz. Go to the directory where you saved it, and issue the following commands: tar xfz lame-3.91.tar.gz cd lame-3.91 ./configure --with-fileio=lame --without-vorbis --disable-gtktest --enable-expopt=full --prefix=/usr make make install For the last step, you need to be root or have write permissions in the target directories. You might consider using nasm if you're on a i386 system, with the configure option --enable-nasmm, for maximum performance. On RedHat Linux --------------- Compiling Lame on RedHat Linux is a tricky issue, because of gcc 2.96 packaged with the distributions 7.0 and 7.1. You either have to use the comaptibility compiler package (compat-egcs and related packages, providing gcc 2.91), or even better, gcc 3.0. It is recommended that you compile lame with gcc 3. For maximum performance, use the nasm assembler to compile assembly optimizations into lame. Try the following commands: tar xfz lame-3.91.tar.gz cd lame-3.91 export CC=gcc3 ./configure --with-fileio=lame --without-vorbis --disable-gtktest --enable-nasm --enable-expopt=full --prefix=/usr make make install darkice-1.2/NEWS0000644000175000017500000000576412170706611010413 0000000000000014-11-2009, Rafael Diniz, rafael@riseup.net Released version 0.20.1. See ChangeLog for changes. 05-11-2009, Rafael Diniz, rafael@riseup.net Released version 0.20. See ChangeLog for changes. 07-07-2008, Akos Maroy, darkeye@tyrell.hu Released version 0.19. See ChangeLog for changes. 26-04-2007, Akos Maroy, darkeye@tyrell.hu Released version 0.18.1. See ChangeLog for changes. 05-03-2007, Akos Maroy, darkeye@users.sourceforge.net Released version 0.18. See ChangeLog for changes. 19-05-2006, Akos Maroy, darkeye@users.sourceforge.net Released version 0.17.1. See ChangeLog for changes. 26-01-2006, Akos Maroy, darkeye@users.sourceforge.net Released version 0.17. See ChangeLog for changes. 22-10-2005, Akos Maroy, darkeye@users.sourceforge.net Released version 0.16. See ChangeLog for changes. 14-04-2005, Akos Maroy, darkeye@users.sourceforge.net Released version 0.15. See ChangeLog for changes. 15-02-2004, Akos Maroy, darkeye@users.sourceforge.net Released version 0.14. See ChangeLog for changes. 07-01-2004, Akos Maroy, darkeye@users.sourceforge.net Released version 0.13.2. See ChangeLog for changes. 12-02-2003, Akos Maroy, darkeye@users.sourceforge.net Released version 0.13.1. See ChangeLog for changes. 09-02-2003, Akos Maroy, darkeye@users.sourceforge.net Released version 0.13. See ChangeLog for changes. 20-10-2002, Akos Maroy, darkeye@users.sourceforge.net Released version 0.12. See ChangeLog for changes. 20-08-2002, Akos Maroy, darkeye@users.sourceforge.net Released version 0.11. See ChangeLog for changes. 02-08-2002, Akos Maroy, darkeye@users.sourceforge.net Released version 0.10.1. See ChangeLog for changes. 20-07-2002, Akos Maroy, darkeye@users.sourceforge.net Released version 0.10. See ChangeLog for changes. 09-04-2002, Akos Maroy, darkeye@users.sourceforge.net Released version 0.9.1. See ChangeLog for changes. 28-03-2002, Akos Maroy, darkeye@users.sourceforge.net Released version 0.9. See ChangeLog for changes. 20-02-2002, Akos Maroy, darkeye@users.sourceforge.net Released version 0.8. See ChangeLog for changes. 19-10-2001, Akos Maroy, darkeye@users.sourceforge.net Released version 0.7. See ChangeLog for changes. 18-09-2001, Akos Maroy, darkeye@users.sourceforge.net Released version 0.6. See ChangeLog for changes. 09-09-2001, Akos Maroy, darkeye@users.sourceforge.net Released version 0.5. See ChangeLog for changes. 02-09-2001, Akos Maroy, darkeye@users.sourceforge.net Released version 0.4. See ChangeLog for changes. 26-08-2001, Akos Maroy, darkeye@users.sourceforge.net Released version 0.3.1. See ChangeLog for changes. 20-12-2000, Akos Maroy, darkeye@users.sourceforge.net Released version 0.3. See ChangeLog for changes. 18-11-2000, Akos Maroy, darkeye@users.sourceforge.net Released version 0.2. See ChangeLog for changes. 13-11-2000, Akos Maroy, darkeye@users.sourceforge.net Initial release. Supports the lame encoder. darkice-1.2/config.guess0000755000175000017500000012743212170706611012231 00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011, 2012 Free Software Foundation, Inc. timestamp='2012-02-10' # 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, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner. Please send patches (context # diff format) to and include a 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. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 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 tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ 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'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; 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 ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; 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:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) 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 -q __LP64__ 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:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-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 ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-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 -q ld.so.1 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-gnu else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-gnueabi else echo ${UNAME_MACHINE}-unknown-linux-gnueabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:Linux:*:*) LIBC=gnu eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` echo "${UNAME_MACHINE}-pc-linux-${LIBC}" 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:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-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 ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu 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.[02]*:*) 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 i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-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; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' 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; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; 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.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in i386) eval $set_cc_for_build if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then UNAME_PROCESSOR="x86_64" fi fi ;; 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 ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} 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 ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx 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: darkice-1.2/INSTALL.vorbis0000644000175000017500000000164312170706611012240 00000000000000Installing Ogg Vorbis --------------------- To install DarkIce, you need the following Ogg Vorbis 1.0 or later libraries (and related header files): - libogg - libvoribs - libvorbisenc installed on your system. It is recommended that use install these to the usual system locations, /usr/lib, /usr/include, so that DarkIce will find the header files and libraries. Thus when configuring, add --prefix=/usr to the configure options. Grab the latest Ogg Vorbis tarballs from http://www.xiph.org/ogg/vorbis/download.html I took libogg-1.0.tar.gz and libvorbis-1.0.tar.gz. Go to the directory where you saved them, and issue the following commands: tar xfz libogg-1.0.tar.gz cd libogg-1.0 ./configure --prefix=/usr make make install cd .. tar xfz libvorbis-1.0.tar.gz cd libvorbis-1.0 ./configure --prefix=/usr make make install For the install steps, you need to be root or have write permissions in the target directories. darkice-1.2/TODO0000644000175000017500000000115612170706611010373 00000000000000o Add samplerate conversion for samplerate audio output different from audio source o Add Coreaudio support o change Ref to follow inheritance o make a master config file, and a small one ? o add support for multiple servers for one stream ? o revisit real-time scheduling o look into performance o create proper error-reporting module o set comment fields for Ogg Vorbis streams as in http://www.xiph.org/ogg/vorbis/doc/v-comment.html o change config file to separate descriptions of input, streams and stream targets (servers, files, etc.) o add support for 24 and 32 bit input and higher sample rates (up to 96kHz) darkice-1.2/aclocal.m40000644000175000017500000010507012170707116011544 00000000000000# generated automatically by aclocal 1.11.6 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, # Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software # Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.11.6], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.11.6])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 9 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, # 2010, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 12 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], UPC, [depcc="$UPC" am_compiler_list=], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. #serial 5 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 8 # AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2008, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 16 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.62])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl dnl The `parallel-tests' driver may need to know about EXEEXT, so add the dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation, # Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 6 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation, # Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software # Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 3 # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([acinclude.m4]) darkice-1.2/ltmain.sh0000644000175000017500000105202611765467473011551 00000000000000 # libtool (GNU libtool) 2.4.2 # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, # 2007, 2008, 2009, 2010, 2011 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. # GNU Libtool 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. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, # or obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Usage: $progname [OPTION]... [MODE-ARG]... # # Provide generalized library-building support services. # # --config show all configuration variables # --debug enable verbose shell tracing # -n, --dry-run display commands without modifying any files # --features display basic configuration information and exit # --mode=MODE use operation mode MODE # --preserve-dup-deps don't remove duplicate dependency libraries # --quiet, --silent don't print informational messages # --no-quiet, --no-silent # print informational messages (default) # --no-warn don't display warning messages # --tag=TAG use configuration variables from tag TAG # -v, --verbose print more informational messages than default # --no-verbose don't print the extra informational messages # --version print version information # -h, --help, --help-all print short, long, or detailed help message # # MODE must be one of the following: # # clean remove files from the build directory # compile compile a source file into a libtool object # execute automatically set library path, then run a program # finish complete the installation of libtool libraries # install install libraries or executables # link create a library or an executable # uninstall remove libraries from an installed directory # # MODE-ARGS vary depending on the MODE. When passed as first option, # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. # Try `$progname --help --mode=MODE' for a more detailed description of MODE. # # When reporting a bug, please describe a test case to reproduce it and # include the following information: # # host-triplet: $host # shell: $SHELL # compiler: $LTCC # compiler flags: $LTCFLAGS # linker: $LD (gnu? $with_gnu_ld) # $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1.1 # automake: $automake_version # autoconf: $autoconf_version # # Report bugs to . # GNU libtool home page: . # General help using GNU software: . PROGRAM=libtool PACKAGE=libtool VERSION="2.4.2 Debian-2.4.2-1.1" TIMESTAMP="" package_revision=1.3337 # 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+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } # NLS nuisances: We save the old values to restore during execute mode. lt_user_locale= lt_safe_locale= for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${$lt_var+set}\" = set; then save_$lt_var=\$$lt_var $lt_var=C export $lt_var lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" fi" done LC_ALL=C LANGUAGE=C export LANGUAGE LC_ALL $lt_unset CDPATH # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" : ${CP="cp -f"} test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} : ${Xsed="$SED -e 1s/^X//"} # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. exit_status=$EXIT_SUCCESS # Make sure IFS has a sensible default lt_nl=' ' IFS=" $lt_nl" dirname="s,/[^/]*$,," basename="s,^.*/,," # func_dirname file append nondir_replacement # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. func_dirname () { func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi } # func_dirname may be replaced by extended shell implementation # func_basename file func_basename () { func_basename_result=`$ECHO "${1}" | $SED "$basename"` } # func_basename may be replaced by extended shell implementation # func_dirname_and_basename file append nondir_replacement # perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # Implementation must be kept synchronized with func_dirname # and func_basename. For efficiency, we do not delegate to # those functions but instead duplicate the functionality here. func_dirname_and_basename () { # Extract subdirectory from the argument. func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` } # func_dirname_and_basename may be replaced by extended shell implementation # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # func_strip_suffix prefix name func_stripname () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname may be replaced by extended shell implementation # These SED scripts presuppose an absolute path with a trailing slash. pathcar='s,^/\([^/]*\).*$,\1,' pathcdr='s,^/[^/]*,,' removedotparts=':dotsl s@/\./@/@g t dotsl s,/\.$,/,' collapseslashes='s@/\{1,\}@/@g' finalslash='s,/*$,/,' # func_normal_abspath PATH # Remove doubled-up and trailing slashes, "." path components, # and cancel out any ".." path components in PATH after making # it an absolute path. # value returned in "$func_normal_abspath_result" func_normal_abspath () { # Start from root dir and reassemble the path. func_normal_abspath_result= func_normal_abspath_tpath=$1 func_normal_abspath_altnamespace= case $func_normal_abspath_tpath in "") # Empty path, that just means $cwd. func_stripname '' '/' "`pwd`" func_normal_abspath_result=$func_stripname_result return ;; # The next three entries are used to spot a run of precisely # two leading slashes without using negated character classes; # we take advantage of case's first-match behaviour. ///*) # Unusual form of absolute path, do nothing. ;; //*) # Not necessarily an ordinary path; POSIX reserves leading '//' # and for example Cygwin uses it to access remote file shares # over CIFS/SMB, so we conserve a leading double slash if found. func_normal_abspath_altnamespace=/ ;; /*) # Absolute path, do nothing. ;; *) # Relative path, prepend $cwd. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath ;; esac # Cancel out all the simple stuff to save iterations. We also want # the path to end with a slash for ease of parsing, so make sure # there is one (and only one) here. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` while :; do # Processed it all yet? if test "$func_normal_abspath_tpath" = / ; then # If we ascended to the root using ".." the result may be empty now. if test -z "$func_normal_abspath_result" ; then func_normal_abspath_result=/ fi break fi func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$pathcar"` func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$pathcdr"` # Figure out what to do with it case $func_normal_abspath_tcomponent in "") # Trailing empty path component, ignore it. ;; ..) # Parent dir; strip last assembled component from result. func_dirname "$func_normal_abspath_result" func_normal_abspath_result=$func_dirname_result ;; *) # Actual path component, append it. func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent ;; esac done # Restore leading double-slash if one was found on entry. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result } # func_relative_path SRCDIR DSTDIR # generates a relative path from SRCDIR to DSTDIR, with a trailing # slash if non-empty, suitable for immediately appending a filename # without needing to append a separator. # value returned in "$func_relative_path_result" func_relative_path () { func_relative_path_result= func_normal_abspath "$1" func_relative_path_tlibdir=$func_normal_abspath_result func_normal_abspath "$2" func_relative_path_tbindir=$func_normal_abspath_result # Ascend the tree starting from libdir while :; do # check if we have found a prefix of bindir case $func_relative_path_tbindir in $func_relative_path_tlibdir) # found an exact match func_relative_path_tcancelled= break ;; $func_relative_path_tlibdir*) # found a matching prefix func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" func_relative_path_tcancelled=$func_stripname_result if test -z "$func_relative_path_result"; then func_relative_path_result=. fi break ;; *) func_dirname $func_relative_path_tlibdir func_relative_path_tlibdir=${func_dirname_result} if test "x$func_relative_path_tlibdir" = x ; then # Have to descend all the way to the root! func_relative_path_result=../$func_relative_path_result func_relative_path_tcancelled=$func_relative_path_tbindir break fi func_relative_path_result=../$func_relative_path_result ;; esac done # Now calculate path; take care to avoid doubling-up slashes. func_stripname '' '/' "$func_relative_path_result" func_relative_path_result=$func_stripname_result func_stripname '/' '/' "$func_relative_path_tcancelled" if test "x$func_stripname_result" != x ; then func_relative_path_result=${func_relative_path_result}/${func_stripname_result} fi # Normalisation. If bindir is libdir, return empty string, # else relative path ending with a slash; either way, target # file name can be directly appended. if test ! -z "$func_relative_path_result"; then func_stripname './' '' "$func_relative_path_result/" func_relative_path_result=$func_stripname_result fi } # The name of this program: func_dirname_and_basename "$progpath" progname=$func_basename_result # Make sure we have an absolute path for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) progdir=$func_dirname_result progdir=`cd "$progdir" && pwd` progpath="$progdir/$progname" ;; *) save_IFS="$IFS" IFS=${PATH_SEPARATOR-:} for progdir in $PATH; do IFS="$save_IFS" test -x "$progdir/$progname" && break done IFS="$save_IFS" test -n "$progdir" || progdir=`pwd` progpath="$progdir/$progname" ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed="${SED}"' -e 1s/^X//' sed_quote_subst='s/\([`"$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution that turns a string into a regex matching for the # string literally. sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' # Sed substitution that converts a w32 file name or path # which contains forward slashes, into one that contains # (escaped) backslashes. A very naive implementation. lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Re-`\' parameter expansions in output of double_quote_subst that were # `\'-ed in input to the same. If an odd number of `\' preceded a '$' # in input to double_quote_subst, that '$' was protected from expansion. # Since each input `\' is now two `\'s, look for any number of runs of # four `\'s followed by two `\'s and then a '$'. `\' that '$'. bs='\\' bs2='\\\\' bs4='\\\\\\\\' dollar='\$' sed_double_backslash="\ s/$bs4/&\\ /g s/^$bs2$dollar/$bs&/ s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g s/\n//g" # Standard options: opt_dry_run=false opt_help=false opt_quiet=false opt_verbose=false opt_warning=: # func_echo arg... # Echo program name prefixed message, along with the current mode # name if it has been set yet. func_echo () { $ECHO "$progname: ${opt_mode+$opt_mode: }$*" } # func_verbose arg... # Echo program name prefixed message in verbose mode only. func_verbose () { $opt_verbose && func_echo ${1+"$@"} # A bug in bash halts the script if the last line of a function # fails when set -e is in force, so we need another command to # work around that: : } # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } # func_error arg... # Echo program name prefixed message to standard error. func_error () { $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 } # func_warning arg... # Echo program name prefixed warning message to standard error. func_warning () { $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 # bash bug again: : } # func_fatal_error arg... # Echo program name prefixed message to standard error, and exit. func_fatal_error () { func_error ${1+"$@"} exit $EXIT_FAILURE } # func_fatal_help arg... # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { func_error ${1+"$@"} func_fatal_error "$help" } help="Try \`$progname --help' for more information." ## default # func_grep expression filename # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { $GREP "$1" "$2" >/dev/null 2>&1 } # func_mkdir_p directory-path # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { my_directory_path="$1" my_dir_list= if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then # Protect directory names starting with `-' case $my_directory_path in -*) my_directory_path="./$my_directory_path" ;; esac # While some portion of DIR does not yet exist... while test ! -d "$my_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list incase some portion of path contains whitespace. my_dir_list="$my_directory_path:$my_dir_list" # If the last portion added has no slash in it, the list is done case $my_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` done my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` save_mkdir_p_IFS="$IFS"; IFS=':' for my_dir in $my_dir_list; do IFS="$save_mkdir_p_IFS" # mkdir can fail with a `File exist' error if two processes # try to create one of the directories concurrently. Don't # stop in that case! $MKDIR "$my_dir" 2>/dev/null || : done IFS="$save_mkdir_p_IFS" # Bail out if we (or some other process) failed to create a directory. test -d "$my_directory_path" || \ func_fatal_error "Failed to create \`$1'" fi } # func_mktempdir [string] # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, STRING is the basename for that directory. func_mktempdir () { my_template="${TMPDIR-/tmp}/${1-$progname}" if test "$opt_dry_run" = ":"; then # Return a directory name, but don't create it in dry-run mode my_tmpdir="${my_template}-$$" else # If mktemp works, use that first and foremost my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` if test ! -d "$my_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race my_tmpdir="${my_template}-${RANDOM-0}$$" save_mktempdir_umask=`umask` umask 0077 $MKDIR "$my_tmpdir" umask $save_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$my_tmpdir" || \ func_fatal_error "cannot create temporary directory \`$my_tmpdir'" fi $ECHO "$my_tmpdir" } # func_quote_for_eval arg # Aesthetically quote ARG to be evaled later. # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT # is double-quoted, suitable for a subsequent eval, whereas # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters # which are still active within double quotes backslashified. func_quote_for_eval () { case $1 in *[\\\`\"\$]*) func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; *) func_quote_for_eval_unquoted_result="$1" ;; esac case $func_quote_for_eval_unquoted_result in # Double-quote args containing shell metacharacters to delay # word splitting, command substitution and and variable # expansion for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" ;; *) func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" esac } # func_quote_for_expand arg # Aesthetically quote ARG to be evaled later; same as above, # but do not quote variable references. func_quote_for_expand () { case $1 in *[\\\`\"]*) my_arg=`$ECHO "$1" | $SED \ -e "$double_quote_subst" -e "$sed_double_backslash"` ;; *) my_arg="$1" ;; esac case $my_arg in # Double-quote args containing shell metacharacters to delay # word splitting and command substitution for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") my_arg="\"$my_arg\"" ;; esac func_quote_for_expand_result="$my_arg" } # func_show_eval cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$my_cmd" my_status=$? if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_show_eval_locale cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$lt_user_locale $my_cmd" my_status=$? eval "$lt_safe_locale" if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_tr_sh # Turn $1 into a string suitable for a shell variable name. # Result is stored in $func_tr_sh_result. All characters # not in the set a-zA-Z0-9_ are replaced with '_'. Further, # if $1 begins with a digit, a '_' is prepended as well. func_tr_sh () { case $1 in [0-9]* | *[!a-zA-Z0-9_]*) func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` ;; * ) func_tr_sh_result=$1 ;; esac } # func_version # Echo version message to standard output and exit. func_version () { $opt_debug $SED -n '/(C)/!b go :more /\./!{ N s/\n# / / b more } :go /^# '$PROGRAM' (GNU /,/# warranty; / { s/^# // s/^# *$// s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ p }' < "$progpath" exit $? } # func_usage # Echo short help message to standard output and exit. func_usage () { $opt_debug $SED -n '/^# Usage:/,/^# *.*--help/ { s/^# // s/^# *$// s/\$progname/'$progname'/ p }' < "$progpath" echo $ECHO "run \`$progname --help | more' for full usage" exit $? } # func_help [NOEXIT] # Echo long help message to standard output and exit, # unless 'noexit' is passed as argument. func_help () { $opt_debug $SED -n '/^# Usage:/,/# Report bugs to/ { :print s/^# // s/^# *$// s*\$progname*'$progname'* s*\$host*'"$host"'* s*\$SHELL*'"$SHELL"'* s*\$LTCC*'"$LTCC"'* s*\$LTCFLAGS*'"$LTCFLAGS"'* s*\$LD*'"$LD"'* s/\$with_gnu_ld/'"$with_gnu_ld"'/ s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/ s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/ p d } /^# .* home page:/b print /^# General help using/b print ' < "$progpath" ret=$? if test -z "$1"; then exit $ret fi } # func_missing_arg argname # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { $opt_debug func_error "missing argument for $1." exit_cmd=exit } # func_split_short_opt shortopt # Set func_split_short_opt_name and func_split_short_opt_arg shell # variables after splitting SHORTOPT after the 2nd character. func_split_short_opt () { my_sed_short_opt='1s/^\(..\).*$/\1/;q' my_sed_short_rest='1s/^..\(.*\)$/\1/;q' func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` } # func_split_short_opt may be replaced by extended shell implementation # func_split_long_opt longopt # Set func_split_long_opt_name and func_split_long_opt_arg shell # variables after splitting LONGOPT at the `=' sign. func_split_long_opt () { my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' my_sed_long_arg='1s/^--[^=]*=//' func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` } # func_split_long_opt may be replaced by extended shell implementation exit_cmd=: magic="%%%MAGIC variable%%%" magic_exe="%%%MAGIC EXE variable%%%" # Global variables. nonopt= preserve_args= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" extracted_archives= extracted_serial=0 # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= # func_append var value # Append VALUE to the end of shell variable VAR. func_append () { eval "${1}=\$${1}\${2}" } # func_append may be replaced by extended shell implementation # func_append_quoted var value # Quote VALUE and append to the end of shell variable VAR, separated # by a space. func_append_quoted () { func_quote_for_eval "${2}" eval "${1}=\$${1}\\ \$func_quote_for_eval_result" } # func_append_quoted may be replaced by extended shell implementation # func_arith arithmetic-term... func_arith () { func_arith_result=`expr "${@}"` } # func_arith may be replaced by extended shell implementation # func_len string # STRING may not start with a hyphen. func_len () { func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` } # func_len may be replaced by extended shell implementation # func_lo2o object func_lo2o () { func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` } # func_lo2o may be replaced by extended shell implementation # func_xform libobj-or-source func_xform () { func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` } # func_xform may be replaced by extended shell implementation # func_fatal_configuration arg... # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func_error ${1+"$@"} func_error "See the $PACKAGE documentation for more information." func_fatal_error "Fatal configuration error." } # func_config # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $? } # func_features # Display the features supported by this script. func_features () { echo "host: $host" if test "$build_libtool_libs" = yes; then echo "enable shared libraries" else echo "disable shared libraries" fi if test "$build_old_libs" = yes; then echo "enable static libraries" else echo "disable static libraries" fi exit $? } # func_enable_tag tagname # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname="$1" re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf="/$re_begincf/,/$re_endcf/p" # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable quotes within backquotes within # quotes we have to do it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } # func_check_version_match # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set dummy --mode clean ${1+"$@"}; shift ;; compile|compil|compi|comp|com|co|c) shift; set dummy --mode compile ${1+"$@"}; shift ;; execute|execut|execu|exec|exe|ex|e) shift; set dummy --mode execute ${1+"$@"}; shift ;; finish|finis|fini|fin|fi|f) shift; set dummy --mode finish ${1+"$@"}; shift ;; install|instal|insta|inst|ins|in|i) shift; set dummy --mode install ${1+"$@"}; shift ;; link|lin|li|l) shift; set dummy --mode link ${1+"$@"}; shift ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; esac # Option defaults: opt_debug=: opt_dry_run=false opt_config=false opt_preserve_dup_deps=false opt_features=false opt_finish=false opt_help=false opt_help_all=false opt_silent=: opt_warning=: opt_verbose=: opt_silent=false opt_verbose=false # Parse options once, thoroughly. This comes as soon as possible in the # script to make things like `--version' happen as quickly as we can. { # this just eases exit handling while test $# -gt 0; do opt="$1" shift case $opt in --debug|-x) opt_debug='set -x' func_echo "enabling shell trace mode" $opt_debug ;; --dry-run|--dryrun|-n) opt_dry_run=: ;; --config) opt_config=: func_config ;; --dlopen|-dlopen) optarg="$1" opt_dlopen="${opt_dlopen+$opt_dlopen }$optarg" shift ;; --preserve-dup-deps) opt_preserve_dup_deps=: ;; --features) opt_features=: func_features ;; --finish) opt_finish=: set dummy --mode finish ${1+"$@"}; shift ;; --help) opt_help=: ;; --help-all) opt_help_all=: opt_help=': help-all' ;; --mode) test $# = 0 && func_missing_arg $opt && break optarg="$1" opt_mode="$optarg" case $optarg in # Valid mode arguments: clean|compile|execute|finish|install|link|relink|uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $opt" exit_cmd=exit break ;; esac shift ;; --no-silent|--no-quiet) opt_silent=false func_append preserve_args " $opt" ;; --no-warning|--no-warn) opt_warning=false func_append preserve_args " $opt" ;; --no-verbose) opt_verbose=false func_append preserve_args " $opt" ;; --silent|--quiet) opt_silent=: func_append preserve_args " $opt" opt_verbose=false ;; --verbose|-v) opt_verbose=: func_append preserve_args " $opt" opt_silent=false ;; --tag) test $# = 0 && func_missing_arg $opt && break optarg="$1" opt_tag="$optarg" func_append preserve_args " $opt $optarg" func_enable_tag "$optarg" shift ;; -\?|-h) func_usage ;; --help) func_help ;; --version) func_version ;; # Separate optargs to long options: --*=*) func_split_long_opt "$opt" set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} shift ;; # Separate non-argument short options: -\?*|-h*|-n*|-v*) func_split_short_opt "$opt" set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} shift ;; --) break ;; -*) func_fatal_help "unrecognized option \`$opt'" ;; *) set dummy "$opt" ${1+"$@"}; shift; break ;; esac done # Validate options: # save first non-option argument if test "$#" -gt 0; then nonopt="$opt" shift fi # preserve --debug test "$opt_debug" = : || func_append preserve_args " --debug" case $host in *cygwin* | *mingw* | *pw32* | *cegcc*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps ;; esac $opt_help || { # Sanity checks first: func_check_version_match if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then func_fatal_configuration "not configured to build any kind of library" fi # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$opt_dlopen" && test "$opt_mode" != execute; then func_error "unrecognized option \`-dlopen'" $ECHO "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$progname --help --mode=$opt_mode' for more information." } # Bail if the options were screwed $exit_cmd $EXIT_FAILURE } ## ----------- ## ## Main. ## ## ----------- ## # func_lalib_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && $SED -e 4q "$1" 2>/dev/null \ | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # func_lalib_unsafe_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be # fatal anyway. Works if `file' does not exist. func_lalib_unsafe_p () { lalib_p=no if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read lalib_p_line case "$lalib_p_line" in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi test "$lalib_p" = yes } # func_ltwrapper_script_p file # True iff FILE is a libtool wrapper script # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_script_p () { func_lalib_p "$1" } # func_ltwrapper_executable_p file # True iff FILE is a libtool wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_executable_p () { func_ltwrapper_exec_suffix= case $1 in *.exe) ;; *) func_ltwrapper_exec_suffix=.exe ;; esac $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 } # func_ltwrapper_scriptname file # Assumes file is an ltwrapper_executable # uses $file to determine the appropriate filename for a # temporary ltwrapper_script. func_ltwrapper_scriptname () { func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" } # func_ltwrapper_p file # True iff FILE is a libtool wrapper script or wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_p () { func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" } # func_execute_cmds commands fail_cmd # Execute tilde-delimited COMMANDS. # If FAIL_CMD is given, eval that upon failure. # FAIL_CMD may read-access the current command in variable CMD! func_execute_cmds () { $opt_debug save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$save_ifs eval cmd=\"$cmd\" func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs } # func_source file # Source FILE, adding directory component if necessary. # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. func_source () { $opt_debug case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; esac } # func_resolve_sysroot PATH # Replace a leading = in PATH with a sysroot. Store the result into # func_resolve_sysroot_result func_resolve_sysroot () { func_resolve_sysroot_result=$1 case $func_resolve_sysroot_result in =*) func_stripname '=' '' "$func_resolve_sysroot_result" func_resolve_sysroot_result=$lt_sysroot$func_stripname_result ;; esac } # func_replace_sysroot PATH # If PATH begins with the sysroot, replace it with = and # store the result into func_replace_sysroot_result. func_replace_sysroot () { case "$lt_sysroot:$1" in ?*:"$lt_sysroot"*) func_stripname "$lt_sysroot" '' "$1" func_replace_sysroot_result="=$func_stripname_result" ;; *) # Including no sysroot. func_replace_sysroot_result=$1 ;; esac } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { $opt_debug if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case "$@ " in " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with \`--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_write_libtool_object output_name pic_name nonpic_name # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. func_write_libtool_object () { write_libobj=${1} if test "$build_libtool_libs" = yes; then write_lobj=\'${2}\' else write_lobj=none fi if test "$build_old_libs" = yes; then write_oldobj=\'${3}\' else write_oldobj=none fi $opt_dry_run || { cat >${write_libobj}T </dev/null` if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | $SED -e "$lt_sed_naive_backslashify"` else func_convert_core_file_wine_to_w32_result= fi fi } # end: func_convert_core_file_wine_to_w32 # func_convert_core_path_wine_to_w32 ARG # Helper function used by path conversion functions when $build is *nix, and # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly # configured wine environment available, with the winepath program in $build's # $PATH. Assumes ARG has no leading or trailing path separator characters. # # ARG is path to be converted from $build format to win32. # Result is available in $func_convert_core_path_wine_to_w32_result. # Unconvertible file (directory) names in ARG are skipped; if no directory names # are convertible, then the result may be empty. func_convert_core_path_wine_to_w32 () { $opt_debug # unfortunately, winepath doesn't convert paths, only file names func_convert_core_path_wine_to_w32_result="" if test -n "$1"; then oldIFS=$IFS IFS=: for func_convert_core_path_wine_to_w32_f in $1; do IFS=$oldIFS func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" if test -n "$func_convert_core_file_wine_to_w32_result" ; then if test -z "$func_convert_core_path_wine_to_w32_result"; then func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" else func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" fi fi done IFS=$oldIFS fi } # end: func_convert_core_path_wine_to_w32 # func_cygpath ARGS... # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or # (2), returns the Cygwin file name or path in func_cygpath_result (input # file name or path is assumed to be in w32 format, as previously converted # from $build's *nix or MSYS format). In case (3), returns the w32 file name # or path in func_cygpath_result (input file name or path is assumed to be in # Cygwin format). Returns an empty string on error. # # ARGS are passed to cygpath, with the last one being the file name or path to # be converted. # # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH # environment variable; do not put it in $PATH. func_cygpath () { $opt_debug if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` if test "$?" -ne 0; then # on failure, ensure result is empty func_cygpath_result= fi else func_cygpath_result= func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" fi } #end: func_cygpath # func_convert_core_msys_to_w32 ARG # Convert file name or path ARG from MSYS format to w32 format. Return # result in func_convert_core_msys_to_w32_result. func_convert_core_msys_to_w32 () { $opt_debug # awkward: cmd appends spaces to result func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` } #end: func_convert_core_msys_to_w32 # func_convert_file_check ARG1 ARG2 # Verify that ARG1 (a file name in $build format) was converted to $host # format in ARG2. Otherwise, emit an error message, but continue (resetting # func_to_host_file_result to ARG1). func_convert_file_check () { $opt_debug if test -z "$2" && test -n "$1" ; then func_error "Could not determine host file name corresponding to" func_error " \`$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: func_to_host_file_result="$1" fi } # end func_convert_file_check # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH # Verify that FROM_PATH (a path in $build format) was converted to $host # format in TO_PATH. Otherwise, emit an error message, but continue, resetting # func_to_host_file_result to a simplistic fallback value (see below). func_convert_path_check () { $opt_debug if test -z "$4" && test -n "$3"; then func_error "Could not determine the host path corresponding to" func_error " \`$3'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This is a deliberately simplistic "conversion" and # should not be "improved". See libtool.info. if test "x$1" != "x$2"; then lt_replace_pathsep_chars="s|$1|$2|g" func_to_host_path_result=`echo "$3" | $SED -e "$lt_replace_pathsep_chars"` else func_to_host_path_result="$3" fi fi } # end func_convert_path_check # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT # and appending REPL if ORIG matches BACKPAT. func_convert_path_front_back_pathsep () { $opt_debug case $4 in $1 ) func_to_host_path_result="$3$func_to_host_path_result" ;; esac case $4 in $2 ) func_append func_to_host_path_result "$3" ;; esac } # end func_convert_path_front_back_pathsep ################################################## # $build to $host FILE NAME CONVERSION FUNCTIONS # ################################################## # invoked via `$to_host_file_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # Result will be available in $func_to_host_file_result. # func_to_host_file ARG # Converts the file name ARG from $build format to $host format. Return result # in func_to_host_file_result. func_to_host_file () { $opt_debug $to_host_file_cmd "$1" } # end func_to_host_file # func_to_tool_file ARG LAZY # converts the file name ARG from $build format to toolchain format. Return # result in func_to_tool_file_result. If the conversion in use is listed # in (the comma separated) LAZY, no conversion takes place. func_to_tool_file () { $opt_debug case ,$2, in *,"$to_tool_file_cmd",*) func_to_tool_file_result=$1 ;; *) $to_tool_file_cmd "$1" func_to_tool_file_result=$func_to_host_file_result ;; esac } # end func_to_tool_file # func_convert_file_noop ARG # Copy ARG to func_to_host_file_result. func_convert_file_noop () { func_to_host_file_result="$1" } # end func_convert_file_noop # func_convert_file_msys_to_w32 ARG # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_file_result. func_convert_file_msys_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_to_host_file_result="$func_convert_core_msys_to_w32_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_w32 # func_convert_file_cygwin_to_w32 ARG # Convert file name ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_file_cygwin_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then # because $build is cygwin, we call "the" cygpath in $PATH; no need to use # LT_CYGPATH in this case. func_to_host_file_result=`cygpath -m "$1"` fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_cygwin_to_w32 # func_convert_file_nix_to_w32 ARG # Convert file name ARG from *nix to w32 format. Requires a wine environment # and a working winepath. Returns result in func_to_host_file_result. func_convert_file_nix_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_file_wine_to_w32 "$1" func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_w32 # func_convert_file_msys_to_cygwin ARG # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_file_msys_to_cygwin () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_cygpath -u "$func_convert_core_msys_to_w32_result" func_to_host_file_result="$func_cygpath_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_cygwin # func_convert_file_nix_to_cygwin ARG # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed # in a wine environment, working winepath, and LT_CYGPATH set. Returns result # in func_to_host_file_result. func_convert_file_nix_to_cygwin () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. func_convert_core_file_wine_to_w32 "$1" func_cygpath -u "$func_convert_core_file_wine_to_w32_result" func_to_host_file_result="$func_cygpath_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_cygwin ############################################# # $build to $host PATH CONVERSION FUNCTIONS # ############################################# # invoked via `$to_host_path_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # The result will be available in $func_to_host_path_result. # # Path separators are also converted from $build format to $host format. If # ARG begins or ends with a path separator character, it is preserved (but # converted to $host format) on output. # # All path conversion functions are named using the following convention: # file name conversion function : func_convert_file_X_to_Y () # path conversion function : func_convert_path_X_to_Y () # where, for any given $build/$host combination the 'X_to_Y' value is the # same. If conversion functions are added for new $build/$host combinations, # the two new functions must follow this pattern, or func_init_to_host_path_cmd # will break. # func_init_to_host_path_cmd # Ensures that function "pointer" variable $to_host_path_cmd is set to the # appropriate value, based on the value of $to_host_file_cmd. to_host_path_cmd= func_init_to_host_path_cmd () { $opt_debug if test -z "$to_host_path_cmd"; then func_stripname 'func_convert_file_' '' "$to_host_file_cmd" to_host_path_cmd="func_convert_path_${func_stripname_result}" fi } # func_to_host_path ARG # Converts the path ARG from $build format to $host format. Return result # in func_to_host_path_result. func_to_host_path () { $opt_debug func_init_to_host_path_cmd $to_host_path_cmd "$1" } # end func_to_host_path # func_convert_path_noop ARG # Copy ARG to func_to_host_path_result. func_convert_path_noop () { func_to_host_path_result="$1" } # end func_convert_path_noop # func_convert_path_msys_to_w32 ARG # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_path_result. func_convert_path_msys_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # Remove leading and trailing path separator characters from ARG. MSYS # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; # and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result="$func_convert_core_msys_to_w32_result" func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_msys_to_w32 # func_convert_path_cygwin_to_w32 ARG # Convert path ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_path_cygwin_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_cygwin_to_w32 # func_convert_path_nix_to_w32 ARG # Convert path ARG from *nix to w32 format. Requires a wine environment and # a working winepath. Returns result in func_to_host_file_result. func_convert_path_nix_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_nix_to_w32 # func_convert_path_msys_to_cygwin ARG # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_path_msys_to_cygwin () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_msys_to_w32_result" func_to_host_path_result="$func_cygpath_result" func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_msys_to_cygwin # func_convert_path_nix_to_cygwin ARG # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a # a wine environment, working winepath, and LT_CYGPATH set. Returns result in # func_to_host_file_result. func_convert_path_nix_to_cygwin () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them # into '.;' and ';.', and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" func_to_host_path_result="$func_cygpath_result" func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_nix_to_cygwin # func_mode_compile arg... func_mode_compile () { $opt_debug # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= pie_flag= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify \`-o' more than once" arg_mode=target continue ;; -pie | -fpie | -fPIE) func_append pie_flag " $arg" continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) func_append later " $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" func_append_quoted lastarg "$arg" done IFS="$save_ifs" func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result # Add the arguments to base_compile. func_append base_compile " $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. func_append_quoted base_compile "$lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with \`-o'" ;; *) # Get the name of the library object. test -z "$libobj" && { func_basename "$srcfile" libobj="$func_basename_result" } ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo case $libobj in *.[cCFSifmso] | \ *.ada | *.adb | *.ads | *.asm | \ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) func_xform "$libobj" libobj=$func_xform_result ;; esac case $libobj in *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; *) func_fatal_error "cannot determine name of library object from \`$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done func_quote_for_eval "$libobj" test "X$libobj" != "X$func_quote_for_eval_result" \ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ && func_warning "libobj name \`$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" objname="$func_basename_result" xdir="$func_dirname_result" lobj=${xdir}$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2* | cegcc*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $ECHO "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi func_append removelist " $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist func_append removelist " $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 srcfile=$func_to_tool_file_result func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result # Only build a PIC object if we are building libtool libraries. if test "$build_libtool_libs" = yes; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test "$pic_mode" != no; then command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code command="$base_compile $qsrcfile" fi func_mkdir_p "$xdir$objdir" if test -z "$output_obj"; then # Place PIC objects in $objdir func_append command " -o $lobj" fi func_show_eval_locale "$command" \ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then func_show_eval '$MV "$output_obj" "$lobj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi # Allow error messages only from the first compilation. if test "$suppress_opt" = yes; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. if test "$build_old_libs" = yes; then if test "$pic_mode" != yes; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test "$compiler_c_o" = yes; then func_append command " -o $obj" fi # Suppress compiler output if we already did a PIC compilation. func_append command "$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then func_show_eval '$MV "$output_obj" "$obj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi fi $opt_dry_run || { func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" # Unlock the critical section if it was locked if test "$need_locks" != no; then removelist=$lockfile $RM "$lockfile" fi } exit $EXIT_SUCCESS } $opt_help || { test "$opt_mode" = compile && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. case $opt_mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $ECHO \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $ECHO \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to build PIC objects only -prefer-non-pic try to build non-PIC objects only -shared do not build a \`.o' file suitable for static linking -static only build a \`.o' file suitable for static linking -Wc,FLAG pass FLAG directly to the compiler COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $ECHO \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $ECHO \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $ECHO \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $ECHO \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -bindir BINDIR specify path to binaries directory (for systems where libraries must be found in the PATH setting at runtime) -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface -Wc,FLAG -Xcompiler FLAG pass linker-specific FLAG directly to the compiler -Wl,FLAG -Xlinker FLAG pass linker-specific FLAG directly to the linker -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $ECHO \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode \`$opt_mode'" ;; esac echo $ECHO "Try \`$progname --help' for more information about other modes." } # Now that we've collected a possible --mode arg, show help if necessary if $opt_help; then if test "$opt_help" = :; then func_mode_help else { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do func_mode_help done } | sed -n '1p; 2,$s/^Usage:/ or: /p' { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do echo func_mode_help done } | sed '1d /^When reporting/,/^Report/{ H d } $x /information about other modes/d /more detailed .*MODE/d s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' fi exit $? fi # func_mode_execute arg... func_mode_execute () { $opt_debug # The first argument is the command name. cmd="$nonopt" test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $opt_dlopen; do test -f "$file" \ || func_fatal_help "\`$file' is not a file" dir= case $file in *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= func_source "$file" # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "\`$file' was not linked with \`-export-dynamic'" continue fi func_dirname "$file" "" "." dir="$func_dirname_result" if test -f "$dir/$objdir/$dlname"; then func_append dir "/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" fi fi ;; *.lo) # Just add the directory containing the .lo file. func_dirname "$file" "" "." dir="$func_dirname_result" ;; *) func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -* | *.la | *.lo ) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then func_source "$file" # Transform arg to wrapped name. file="$progdir/$program" elif func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" func_source "$func_ltwrapper_scriptname_result" # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). func_append_quoted args "$file" done if test "X$opt_dry_run" = Xfalse; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var else $lt_unset $lt_var fi" done # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" echo "export $shlibpath_var" fi $ECHO "$cmd$args" exit $EXIT_SUCCESS fi } test "$opt_mode" = execute && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $opt_debug libs= libdirs= admincmds= for opt in "$nonopt" ${1+"$@"} do if test -d "$opt"; then func_append libdirs " $opt" elif test -f "$opt"; then if func_lalib_unsafe_p "$opt"; then func_append libs " $opt" else func_warning "\`$opt' is not a valid libtool archive" fi else func_fatal_error "invalid argument \`$opt'" fi done if test -n "$libs"; then if test -n "$lt_sysroot"; then sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" else sysroot_cmd= fi # Remove sysroot references if $opt_dry_run; then for lib in $libs; do echo "removing references to $lt_sysroot and \`=' prefixes from $lib" done else tmpdir=`func_mktempdir` for lib in $libs; do sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ > $tmpdir/tmp-la mv -f $tmpdir/tmp-la $lib done ${RM}r "$tmpdir" fi fi if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds '"$cmd"'"' fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $opt_dry_run || eval "$cmds" || func_append admincmds " $cmds" fi done fi # Exit here if they wanted silent mode. $opt_silent && exit $EXIT_SUCCESS if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" for libdir in $libdirs; do $ECHO " $libdir" done echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" echo "specify the full pathname of the library, or use the \`-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then echo " - add LIBDIR to the \`$shlibpath_var' environment variable" echo " during execution" fi if test -n "$runpath_var"; then echo " - add LIBDIR to the \`$runpath_var' environment variable" echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $ECHO " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $ECHO " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi echo echo "See any operating system documentation about shared libraries for" case $host in solaris2.[6789]|solaris2.1[0-9]) echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" echo "pages." ;; *) echo "more information, such as the ld(1) and ld.so(8) manual pages." ;; esac echo "----------------------------------------------------------------------" fi exit $EXIT_SUCCESS } test "$opt_mode" = finish && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { $opt_debug # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. case $nonopt in *shtool*) :;; *) false;; esac; then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " arg=$1 shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" func_append install_prog "$func_quote_for_eval_result" install_shared_prog=$install_prog case " $install_prog " in *[\\\ /]cp\ *) install_cp=: ;; *) install_cp=false ;; esac # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= no_mode=: for arg do arg2= if test -n "$dest"; then func_append files " $dest" dest=$arg continue fi case $arg in -d) isdir=yes ;; -f) if $install_cp; then :; else prev=$arg fi ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then if test "x$prev" = x-m && test -n "$install_override_mode"; then arg2=$install_override_mode no_mode=false fi prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. func_quote_for_eval "$arg" func_append install_prog " $func_quote_for_eval_result" if test -n "$arg2"; then func_quote_for_eval "$arg2" fi func_append install_shared_prog " $func_quote_for_eval_result" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the \`$prev' option requires an argument" if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else func_quote_for_eval "$install_override_mode" func_append install_shared_prog " -m $func_quote_for_eval_result" fi fi if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. func_stripname '' '/' "$dest" dest=$func_stripname_result # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else func_dirname_and_basename "$dest" "" "." destdir="$func_dirname_result" destname="$func_basename_result" # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ func_fatal_help "\`$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "\`$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. func_append staticlibs " $file" ;; *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$file' is not a valid libtool archive" library_names= old_library= relink_command= func_source "$file" # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) func_append current_libdirs " $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) func_append future_libdirs " $libdir" ;; esac fi func_dirname "$file" "/" "" dir="$func_dirname_result" func_append dir "$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking \`$file'" func_show_eval "$relink_command" \ 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' fi # See the names of the shared library. set dummy $library_names; shift if test -n "$1"; then realname="$1" shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme="$stripme" case $host_os in cygwin* | mingw* | pw32* | cegcc*) case $realname in *.dll.a) tstripme="" ;; esac ;; esac if test -n "$tstripme" && test -n "$striplib"; then func_show_eval "$striplib $destdir/$realname" 'exit $?' fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try `ln -sf' first, because the `ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do test "$linkname" != "$realname" \ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" done fi # Do each command in the postinstall commands. lib="$destdir/$realname" func_execute_cmds "$postinstall_cmds" 'exit $?' fi # Install the pseudo-library for information purposes. func_basename "$file" name="$func_basename_result" instname="$dir/$name"i func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. test -n "$old_library" && func_append staticlibs " $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) func_lo2o "$destfile" staticdest=$func_lo2o_result ;; *.$objext) staticdest="$destfile" destfile= ;; *) func_fatal_help "cannot copy a libtool object to \`$destfile'" ;; esac # Install the libtool object if requested. test -n "$destfile" && \ func_show_eval "$install_prog $file $destfile" 'exit $?' # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then func_stripname '' '.exe' "$file" file=$func_stripname_result stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin* | *mingw*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result else func_stripname '' '.exe' "$file" wrapper=$func_stripname_result fi ;; *) wrapper=$file ;; esac if func_ltwrapper_script_p "$wrapper"; then notinst_deplibs= relink_command= func_source "$wrapper" # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ func_fatal_error "invalid libtool wrapper script \`$wrapper'" finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then func_warning "\`$lib' has not been installed in \`$libdir'" finalize=no fi done relink_command= func_source "$wrapper" outputname= if test "$fast_install" = no && test -n "$relink_command"; then $opt_dry_run || { if test "$finalize" = yes; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" file="$func_basename_result" outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_silent || { func_quote_for_expand "$relink_command" eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else func_error "error: relink \`$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi file="$outputname" else func_warning "cannot relink \`$file'" fi } else # Install the binary that we compiled earlier. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) func_stripname '' '.exe' "$destfile" destfile=$func_stripname_result ;; esac ;; esac func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' $opt_dry_run || if test -n "$outputname"; then ${RM}r "$tmpdir" fi ;; esac done for file in $staticlibs; do func_basename "$file" name="$func_basename_result" # Set up the ranlib parameters. oldlib="$destdir/$name" func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then func_show_eval "$old_striplib $tool_oldlib" 'exit $?' fi # Do each command in the postinstall commands. func_execute_cmds "$old_postinstall_cmds" 'exit $?' done test -n "$future_libdirs" && \ func_warning "remember to run \`$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. $opt_dry_run && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } test "$opt_mode" = install && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { $opt_debug my_outputname="$1" my_originator="$2" my_pic_p="${3-no}" my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms="${my_outputname}S.c" else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${my_outputname}.nm" func_show_eval "$RM $nlist ${nlist}S ${nlist}T" # Parse the name list into a source file. func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" #endif /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then func_verbose "generating symbol list for \`$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do func_to_tool_file "$progfile" func_convert_file_msys_to_w32 func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $opt_dry_run || { eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi if test -n "$export_symbols_regex"; then $opt_dry_run || { eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$outputname.exp" $opt_dry_run || { $RM $export_symbols eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac } else $opt_dry_run || { eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac } fi fi for dlprefile in $dlprefiles; do func_verbose "extracting global C symbols from \`$dlprefile'" func_basename "$dlprefile" name="$func_basename_result" case $host in *cygwin* | *mingw* | *cegcc* ) # if an import library, we need to obtain dlname if func_win32_import_lib_p "$dlprefile"; then func_tr_sh "$dlprefile" eval "curr_lafile=\$libfile_$func_tr_sh_result" dlprefile_dlbasename="" if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then # Use subshell, to avoid clobbering current variable values dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` if test -n "$dlprefile_dlname" ; then func_basename "$dlprefile_dlname" dlprefile_dlbasename="$func_basename_result" else # no lafile. user explicitly requested -dlpreopen . $sharedlib_from_linklib_cmd "$dlprefile" dlprefile_dlbasename=$sharedlib_from_linklib_result fi fi $opt_dry_run || { if test -n "$dlprefile_dlbasename" ; then eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' else func_warning "Could not compute DLL name from $name" eval '$ECHO ": $name " >> "$nlist"' fi func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" } else # not an import lib $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } fi ;; *) $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } ;; esac done $opt_dry_run || { # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $MV "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; extern LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[]; LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = {\ { \"$my_originator\", (void *) 0 }," case $need_lib_prefix in no) eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; *) eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " } # !$opt_dry_run pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) if test "X$my_pic_p" != Xno; then pic_flag_for_symtable=" $pic_flag" fi ;; esac ;; esac symtab_cflags= for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; *) func_append symtab_cflags " $arg" ;; esac done # Now compile the dynamic symbol file. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' # Clean up the generated files. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' # Transform the symbol file into the correct name. symfileobj="$output_objdir/${my_outputname}S.$objext" case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` fi ;; *) compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` ;; esac ;; *) func_fatal_error "unknown suffix for \`$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` fi } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. # Despite the name, also deal with 64 bit binaries. func_win32_libid () { $opt_debug win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then func_to_tool_file "$1" func_convert_file_msys_to_w32 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | $SED -n -e ' 1,100{ / I /{ s,.*,import, p q } }'` case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $ECHO "$win32_libid_type" } # func_cygming_dll_for_implib ARG # # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib () { $opt_debug sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` } # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs # # The is the core of a fallback implementation of a # platform-specific function to extract the name of the # DLL associated with the specified import library LIBNAME. # # SECTION_NAME is either .idata$6 or .idata$7, depending # on the platform and compiler that created the implib. # # Echos the name of the DLL associated with the # specified import library. func_cygming_dll_for_implib_fallback_core () { $opt_debug match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` $OBJDUMP -s --section "$1" "$2" 2>/dev/null | $SED '/^Contents of section '"$match_literal"':/{ # Place marker at beginning of archive member dllname section s/.*/====MARK====/ p d } # These lines can sometimes be longer than 43 characters, but # are always uninteresting /:[ ]*file format pe[i]\{,1\}-/d /^In archive [^:]*:/d # Ensure marker is printed /^====MARK====/p # Remove all lines with less than 43 characters /^.\{43\}/!d # From remaining lines, remove first 43 characters s/^.\{43\}//' | $SED -n ' # Join marker and all lines until next marker into a single line /^====MARK====/ b para H $ b para b :para x s/\n//g # Remove the marker s/^====MARK====// # Remove trailing dots and whitespace s/[\. \t]*$// # Print /./p' | # we now have a list, one entry per line, of the stringified # contents of the appropriate section of all members of the # archive which possess that section. Heuristic: eliminate # all those which have a first or second character that is # a '.' (that is, objdump's representation of an unprintable # character.) This should work for all archives with less than # 0x302f exports -- but will fail for DLLs whose name actually # begins with a literal '.' or a single character followed by # a '.'. # # Of those that remain, print the first one. $SED -e '/^\./d;/^.\./d;q' } # func_cygming_gnu_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is a GNU/binutils-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_gnu_implib_p () { $opt_debug func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` test -n "$func_cygming_gnu_implib_tmp" } # func_cygming_ms_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is an MS-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_ms_implib_p () { $opt_debug func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` test -n "$func_cygming_ms_implib_tmp" } # func_cygming_dll_for_implib_fallback ARG # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # # This fallback implementation is for use when $DLLTOOL # does not support the --identify-strict option. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib_fallback () { $opt_debug if func_cygming_gnu_implib_p "$1" ; then # binutils import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` elif func_cygming_ms_implib_p "$1" ; then # ms-generated import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` else # unknown sharedlib_from_linklib_result="" fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { $opt_debug f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" if test "$lock_old_archive_extraction" = yes; then lockfile=$f_ex_an_ar_oldlib.lock until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done fi func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 'stat=$?; rm -f "$lockfile"; exit $stat' if test "$lock_old_archive_extraction" = yes; then $opt_dry_run || rm -f "$lockfile" fi if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" fi } # func_extract_archives gentop oldlib ... func_extract_archives () { $opt_debug my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac func_basename "$my_xlib" my_xlib="$func_basename_result" my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) func_arith $extracted_serial + 1 extracted_serial=$func_arith_result my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir="$my_gentop/$my_xlib_u" func_mkdir_p "$my_xdir" case $host in *-darwin*) func_verbose "Extracting $my_xabs" # Do not bother doing anything if just a dry run $opt_dry_run || { darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`basename "$darwin_archive"` darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" func_extract_an_archive "`pwd`" "${darwin_base_archive}" cd "$darwin_curdir" $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" done # $darwin_arches ## Okay now we've a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches } # !$opt_dry_run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # func_emit_wrapper [arg=no] # # Emit a libtool wrapper script on stdout. # Don't directly open a file because we may want to # incorporate the script contents within a cygwin/mingw # wrapper executable. Must ONLY be called from within # func_mode_link because it depends on a number of variables # set therein. # # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script # will assume that the directory in which it is stored is # the $objdir directory. This is a cygwin/mingw-specific # behavior. func_emit_wrapper () { func_emit_wrapper_arg1=${1-no} $ECHO "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='$sed_quote_subst' # 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+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variables: generated_by_libtool_version='$macro_version' notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$ECHO are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then file=\"\$0\"" qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` $ECHO "\ # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } ECHO=\"$qECHO\" fi # Very basic option parsing. These options are (a) specific to # the libtool wrapper, (b) are identical between the wrapper # /script/ and the wrapper /executable/ which is used only on # windows platforms, and (c) all begin with the string "--lt-" # (application programs are unlikely to have options which match # this pattern). # # There are only two supported options: --lt-debug and # --lt-dump-script. There is, deliberately, no --lt-help. # # The first argument to this parsing function should be the # script's $0 value, followed by "$@". lt_option_debug= func_parse_lt_options () { lt_script_arg0=\$0 shift for lt_opt do case \"\$lt_opt\" in --lt-debug) lt_option_debug=1 ;; --lt-dump-script) lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` cat \"\$lt_dump_D/\$lt_dump_F\" exit 0 ;; --lt-*) \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 exit 1 ;; esac done # Print the debug banner immediately: if test -n \"\$lt_option_debug\"; then echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 fi } # Used when --lt-debug. Prints its arguments to stdout # (redirection is the responsibility of the caller) func_lt_dump_args () { lt_dump_args_N=1; for lt_arg do \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` done } # Core function for launching the target application func_exec_program_core () { " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2* | *-cegcc*) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $ECHO "\ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 exit 1 } # A function to encapsulate launching the target application # Strips options in the --lt-* namespace from \$@ and # launches target application with the remaining arguments. func_exec_program () { case \" \$* \" in *\\ --lt-*) for lt_wr_arg do case \$lt_wr_arg in --lt-*) ;; *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; esac shift done ;; esac func_exec_program_core \${1+\"\$@\"} } # Parse options func_parse_lt_options \"\$0\" \${1+\"\$@\"} # Find the directory that this script lives in. thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` done # Usually 'no', except on cygwin/mingw when embedded into # the cwrapper. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then thisdir=\`pwd\` fi # remove .libs from thisdir case \"\$thisdir\" in *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $ECHO "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $MKDIR \"\$progdir\" else $RM \"\$progdir/\$file\" fi" $ECHO "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $ECHO \"\$relink_command_output\" >&2 $RM \"\$progdir/\$file\" exit 1 fi fi $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $RM \"\$progdir/\$program\"; $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } $RM \"\$progdir/\$file\" fi" else $ECHO "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $ECHO "\ if test -f \"\$progdir/\$program\"; then" # fixup the dll searchpath if we need to. # # Fix the DLL searchpath if we need to. Do this before prepending # to shlibpath, because on Windows, both are PATH and uninstalled # libraries must come first. if test -n "$dllsearchpath"; then $ECHO "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` export $shlibpath_var " fi $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. func_exec_program \${1+\"\$@\"} fi else # The program doesn't exist. \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " } # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout # Must ONLY be called from within func_mode_link because # it depends on a number of variable set therein. func_emit_cwrapperexe_src () { cat < #include #ifdef _MSC_VER # include # include # include #else # include # include # ifdef __CYGWIN__ # include # endif #endif #include #include #include #include #include #include #include #include /* declarations of non-ANSI functions */ #if defined(__MINGW32__) # ifdef __STRICT_ANSI__ int _putenv (const char *); # endif #elif defined(__CYGWIN__) # ifdef __STRICT_ANSI__ char *realpath (const char *, char *); int putenv (char *); int setenv (const char *, const char *, int); # endif /* #elif defined (other platforms) ... */ #endif /* portability defines, excluding path handling macros */ #if defined(_MSC_VER) # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv # define S_IXUSR _S_IEXEC # ifndef _INTPTR_T_DEFINED # define _INTPTR_T_DEFINED # define intptr_t int # endif #elif defined(__MINGW32__) # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv #elif defined(__CYGWIN__) # define HAVE_SETENV # define FOPEN_WB "wb" /* #elif defined (other platforms) ... */ #endif #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef S_IXOTH # define S_IXOTH 0 #endif #ifndef S_IXGRP # define S_IXGRP 0 #endif /* path handling portability macros */ #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # define FOPEN_WB "wb" # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #ifndef FOPEN_WB # define FOPEN_WB "w" #endif #ifndef _O_BINARY # define _O_BINARY 0 #endif #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) #if defined(LT_DEBUGWRAPPER) static int lt_debug = 1; #else static int lt_debug = 0; #endif const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ void *xmalloc (size_t num); char *xstrdup (const char *string); const char *base_name (const char *name); char *find_executable (const char *wrapper); char *chase_symlinks (const char *pathspec); int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); void lt_debugprintf (const char *file, int line, const char *fmt, ...); void lt_fatal (const char *file, int line, const char *message, ...); static const char *nonnull (const char *s); static const char *nonempty (const char *s); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); char **prepare_spawn (char **argv); void lt_dump_script (FILE *f); EOF cat <= 0) && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) return 1; else return 0; } int make_executable (const char *path) { int rval = 0; struct stat st; lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", nonempty (path)); if ((!path) || (!*path)) return 0; if (stat (path, &st) >= 0) { rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); } return rval; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise Does not chase symlinks, even on platforms that support them. */ char * find_executable (const char *wrapper) { int has_slash = 0; const char *p; const char *p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char *concat_name; lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", nonempty (wrapper)); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char *path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char *q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR (*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); return NULL; } char * chase_symlinks (const char *pathspec) { #ifndef S_ISLNK return xstrdup (pathspec); #else char buf[LT_PATHMAX]; struct stat s; char *tmp_pathspec = xstrdup (pathspec); char *p; int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { lt_debugprintf (__FILE__, __LINE__, "checking path component for symlinks: %s\n", tmp_pathspec); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) { has_symlinks = 1; break; } /* search backwards for last DIR_SEPARATOR */ p = tmp_pathspec + strlen (tmp_pathspec) - 1; while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) p--; if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) { /* no more DIR_SEPARATORS left */ break; } *p = '\0'; } else { lt_fatal (__FILE__, __LINE__, "error accessing file \"%s\": %s", tmp_pathspec, nonnull (strerror (errno))); } } XFREE (tmp_pathspec); if (!has_symlinks) { return xstrdup (pathspec); } tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { lt_fatal (__FILE__, __LINE__, "could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif } char * strendzap (char *str, const char *pat) { size_t len, patlen; assert (str != NULL); assert (pat != NULL); len = strlen (str); patlen = strlen (pat); if (patlen <= len) { str += len - patlen; if (strcmp (str, pat) == 0) *str = '\0'; } return str; } void lt_debugprintf (const char *file, int line, const char *fmt, ...) { va_list args; if (lt_debug) { (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); va_start (args, fmt); (void) vfprintf (stderr, fmt, args); va_end (args); } } static void lt_error_core (int exit_status, const char *file, int line, const char *mode, const char *message, va_list ap) { fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *file, int line, const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); va_end (ap); } static const char * nonnull (const char *s) { return s ? s : "(null)"; } static const char * nonempty (const char *s) { return (s && !*s) ? "(empty)" : nonnull (s); } void lt_setenv (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_setenv) setting '%s' to '%s'\n", nonnull (name), nonnull (value)); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ char *str = xstrdup (value); setenv (name, str, 1); #else int len = strlen (name) + 1 + strlen (value) + 1; char *str = XMALLOC (char, len); sprintf (str, "%s=%s", name, value); if (putenv (str) != EXIT_SUCCESS) { XFREE (str); } #endif } } char * lt_extend_str (const char *orig_value, const char *add, int to_end) { char *new_value; if (orig_value && *orig_value) { int orig_value_len = strlen (orig_value); int add_len = strlen (add); new_value = XMALLOC (char, add_len + orig_value_len + 1); if (to_end) { strcpy (new_value, orig_value); strcpy (new_value + orig_value_len, add); } else { strcpy (new_value, add); strcpy (new_value + add_len, orig_value); } } else { new_value = xstrdup (add); } return new_value; } void lt_update_exe_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); /* some systems can't cope with a ':'-terminated path #' */ int len = strlen (new_value); while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { new_value[len-1] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); } } void lt_update_lib_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); } } EOF case $host_os in mingw*) cat <<"EOF" /* Prepares an argument vector before calling spawn(). Note that spawn() does not by itself call the command interpreter (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&v); v.dwPlatformId == VER_PLATFORM_WIN32_NT; }) ? "cmd.exe" : "command.com"). Instead it simply concatenates the arguments, separated by ' ', and calls CreateProcess(). We must quote the arguments since Win32 CreateProcess() interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a special way: - Space and tab are interpreted as delimiters. They are not treated as delimiters if they are surrounded by double quotes: "...". - Unescaped double quotes are removed from the input. Their only effect is that within double quotes, space and tab are treated like normal characters. - Backslashes not followed by double quotes are not special. - But 2*n+1 backslashes followed by a double quote become n backslashes followed by a double quote (n >= 0): \" -> " \\\" -> \" \\\\\" -> \\" */ #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" char ** prepare_spawn (char **argv) { size_t argc; char **new_argv; size_t i; /* Count number of arguments. */ for (argc = 0; argv[argc] != NULL; argc++) ; /* Allocate new argument vector. */ new_argv = XMALLOC (char *, argc + 1); /* Put quoted arguments into the new argument vector. */ for (i = 0; i < argc; i++) { const char *string = argv[i]; if (string[0] == '\0') new_argv[i] = xstrdup ("\"\""); else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) { int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); size_t length; unsigned int backslashes; const char *s; char *quoted_string; char *p; length = 0; backslashes = 0; if (quote_around) length++; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') length += backslashes + 1; length++; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) length += backslashes + 1; quoted_string = XMALLOC (char, length + 1); p = quoted_string; backslashes = 0; if (quote_around) *p++ = '"'; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') { unsigned int j; for (j = backslashes + 1; j > 0; j--) *p++ = '\\'; } *p++ = c; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) { unsigned int j; for (j = backslashes; j > 0; j--) *p++ = '\\'; *p++ = '"'; } *p = '\0'; new_argv[i] = quoted_string; } else new_argv[i] = (char *) string; } new_argv[argc] = NULL; return new_argv; } EOF ;; esac cat <<"EOF" void lt_dump_script (FILE* f) { EOF func_emit_wrapper yes | $SED -n -e ' s/^\(.\{79\}\)\(..*\)/\1\ \2/ h s/\([\\"]\)/\\\1/g s/$/\\n/ s/\([^\n]*\).*/ fputs ("\1", f);/p g D' cat <<"EOF" } EOF } # end: func_emit_cwrapperexe_src # func_win32_import_lib_p ARG # True if ARG is an import lib, as indicated by $file_magic_cmd func_win32_import_lib_p () { $opt_debug case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in *import*) : ;; *) false ;; esac } # func_mode_link arg... func_mode_link () { $opt_debug case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args=$nonopt base_compile="$nonopt $@" compile_command=$nonopt finalize_command=$nonopt compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= new_inherited_linker_flags= avoid_version=no bindir= dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=no prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= single_module="${wl}-single_module" func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift func_quote_for_eval "$arg" qarg=$func_quote_for_eval_unquoted_result func_append libtool_args " $func_quote_for_eval_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) func_append compile_command " @OUTPUT@" func_append finalize_command " @OUTPUT@" ;; esac case $prev in bindir) bindir="$arg" prev= continue ;; dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then func_append dlfiles " $arg" else func_append dlprefiles " $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" test -f "$arg" \ || func_fatal_error "symbol file \`$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) func_append deplibs " $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat "$save_arg"` do # func_append moreargs " $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi done else func_fatal_error "link input file \`$arg' does not exist" fi arg=$save_arg prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) func_append rpath " $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) func_append xrpath " $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds="$arg" prev= continue ;; weak) func_append weak_libs " $arg" prev= continue ;; xcclinker) func_append linker_flags " $qarg" func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) func_append linker_flags " $qarg" func_append compiler_flags " $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then # See comment for -static flag below, for more details. func_append compile_command " $link_static_flag" func_append finalize_command " $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "\`-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -bindir) prev=bindir continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) func_append compile_command " $arg" func_append finalize_command " $arg" ;; esac continue ;; -L*) func_stripname "-L" '' "$arg" if test -z "$func_stripname_result"; then if test "$#" -gt 0; then func_fatal_error "require no space between \`-L' and \`$1'" else func_fatal_error "need path for \`-L' option" fi fi func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of \`$dir'" dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "* | *" $arg "*) # Will only happen for absolute or sysroot arguments ;; *) # Preserve sysroot, but never include relative directories case $dir in [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; *) func_append deplibs " -L$dir" ;; esac func_append lib_search_path " $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; *) func_append dllsearchpath ":$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework func_append deplibs " System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test "X$arg" = "X-lc" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test "X$arg" = "X-lc" && continue ;; esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi func_append deplibs " $arg" continue ;; -module) module=yes continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. -model|-arch|-isysroot|--sysroot) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; * ) func_append new_inherited_linker_flags " $arg" ;; esac continue ;; -multi_module) single_module="${wl}-multi_module" continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. func_warning "\`-no-install' is ignored for $host" func_warning "assuming \`-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) func_stripname '-R' '' "$arg" dir=$func_stripname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; =*) func_stripname '=' '' "$dir" dir=$lt_sysroot$func_stripname_result ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" func_append arg " $func_quote_for_eval_result" func_append compiler_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Wl,*) func_stripname '-Wl,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" func_append arg " $wl$func_quote_for_eval_result" func_append compiler_flags " $wl$func_quote_for_eval_result" func_append linker_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # -msg_* for osf cc -msg_*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; # Flags to be passed through unchanged, with rationale: # -64, -mips[0-9] enable 64-bit mode for the SGI compiler # -r[0-9][0-9]* specify processor for the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler # +DA*, +DD* enable 64-bit mode for the HP compiler # -q* compiler args for the IBM compiler # -m*, -t[45]*, -txscale* architecture-specific flags for GCC # -F/path path to uninstalled frameworks, gcc on darwin # -p, -pg, --coverage, -fprofile-* profiling flags for GCC # @file GCC response files # -tp=* Portland pgcc target processor selection # --sysroot=* for sysroot support # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -O*|-flto*|-fwhopr*|-fuse-linker-plugin) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" func_append compile_command " $arg" func_append finalize_command " $arg" func_append compiler_flags " $arg" continue ;; # Some other compiler flag. -* | +*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; *.$objext) # A standard object. func_append objs " $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi ;; *.$libext) # An archive. func_append deplibs " $arg" func_append old_deplibs " $arg" continue ;; *.la) # A libtool-controlled library. func_resolve_sysroot "$arg" if test "$prev" = dlfiles; then # This library was specified with -dlopen. func_append dlfiles " $func_resolve_sysroot_result" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. func_append dlprefiles " $func_resolve_sysroot_result" prev= else func_append deplibs " $func_resolve_sysroot_result" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then func_append compile_command " $arg" func_append finalize_command " $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the \`$prevarg' option requires an argument" if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" func_append compile_command " $arg" func_append finalize_command " $arg" fi oldlibs= # calculate the name of the file, without its directory func_basename "$output" outputname="$func_basename_result" libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" func_dirname "$output" "/" "" output_objdir="$func_dirname_result$objdir" func_to_tool_file "$output_objdir/" tool_output_objdir=$func_to_tool_file_result # Create the object directory. func_mkdir_p "$output_objdir" # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_preserve_dup_deps ; then case "$libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append libs " $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; esac func_append pre_post_deps " $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do # The preopen pass in lib mode reverses $deplibs; put it back here # so that -L comes before libs that need it for instance... if test "$linkmode,$pass" = "lib,link"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done deplibs="$tmp_deplibs" fi if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS%" test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" ;; esac fi if test "$linkmode,$pass" = "lib,dlpreopen"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= func_resolve_sysroot "$lib" case $lib in *.la) func_source "$func_resolve_sysroot_result" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do func_basename "$deplib" deplib_base=$func_basename_result case " $weak_libs " in *" $deplib_base "*) ;; *) func_append deplibs " $deplib" ;; esac done done libs="$dlprefiles" fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append compiler_flags " $deplib" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then func_warning "\`-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result if test "$linkmode" = lib; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" fi for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if func_lalib_p "$lib"; then library_names= old_library= func_source "$lib" for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no func_dirname "$lib" "" "." ladir="$func_dirname_result" lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l *.ltframework) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; *) func_warning "\`-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then func_stripname '-R' '' "$deplib" func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) func_resolve_sysroot "$deplib" lib=$func_resolve_sysroot_result ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $deplib "*) ;; *) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then echo $ECHO "*** Warning: Trying to link with static lib archive $deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because the file extensions .$libext of this argument makes me believe" echo "*** that it is just a static archive that I should not use here." else echo $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi ;; esac continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. func_append newdlprefiles " $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append newdlfiles " $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" fi # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$lib" \ || func_fatal_error "\`$lib' is not a valid libtool archive" func_dirname "$lib" "" "." ladir="$func_dirname_result" dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file func_source "$lib" # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; esac done fi dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && func_append dlfiles " $dlopen" test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. func_append convenience " $ladir/$objdir/$old_library" func_append old_convenience " $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then func_fatal_error "\`$lib' is not a convenience library" fi continue fi # $pass = conv # Get the name of the library we link against. linklib= if test -n "$old_library" && { test "$prefer_static_libs" = yes || test "$prefer_static_libs,$installed" = "built,no"; }; then linklib=$old_library else for l in $old_library $library_names; do linklib="$l" done fi if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then func_fatal_error "cannot -dlopen a convenience library: \`$lib'" fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. func_append dlprefiles " $lib $dependency_libs" else func_append newdlfiles " $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of \`$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir="$ladir" fi ;; esac func_basename "$lib" laname="$func_basename_result" # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library \`$lib' was moved." dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$lt_sysroot$libdir" absdir="$lt_sysroot$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later func_append notinst_path " $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later func_append notinst_path " $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" name=$func_stripname_result # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir" && test "$linkmode" = prog; then func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi case "$host" in # special handling for platforms with PE-DLLs. *cygwin* | *mingw* | *cegcc* ) # Linker will automatically link against shared library if both # static and shared are present. Therefore, ensure we extract # symbols from the import library if a shared library is present # (otherwise, the dlopen module name will be incorrect). We do # this by putting the import library name into $newdlprefiles. # We recover the dlopen module name by 'saving' the la file # name in a special purpose variable, and (later) extracting the # dlname from the la file. if test -n "$dlname"; then func_tr_sh "$dir/$linklib" eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" func_append newdlprefiles " $dir/$linklib" else func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" fi ;; * ) # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then func_append newdlprefiles " $dir/$dlname" else func_append newdlprefiles " $dir/$linklib" fi ;; esac fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { { test "$prefer_static_libs" = no || test "$prefer_static_libs,$installed" = "built,yes"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. case "$temp_rpath:" in *"$absdir:"*) ;; *) func_append temp_rpath "$absdir:" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test "$use_static_libs" = built && test "$installed" = yes; then use_static_libs=no fi if test -n "$library_names" && { test "$use_static_libs" = no || test -z "$old_library"; }; then case $host in *cygwin* | *mingw* | *cegcc*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" need_relink=no ;; *) if test "$installed" = no; then func_append notinst_deplibs " $lib" need_relink=yes fi ;; esac # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule="" for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule="$dlpremoduletest" break fi done if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then echo if test "$linkmode" = prog; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi $ECHO "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names shift realname="$1" shift libname=`eval "\\$ECHO \"$libname_spec\""` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw* | *cegcc*) func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" func_basename "$soroot" soname="$func_basename_result" func_stripname 'lib' '.dll' "$soname" newlib=libimp-$func_stripname_result.a # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else func_verbose "extracting exported symbol list from \`$soname'" func_execute_cmds "$extract_expsyms_cmds" 'exit $?' fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else func_verbose "generating import library for \`$soname'" func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$opt_mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; *-*-sysv4*uw2*) add_dir="-L$dir" ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we can not # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP ": [^:]* bundle" >/dev/null ; then if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library" ; then echo echo "*** And there doesn't seem to be a static archive available" echo "*** The link will probably fail, sorry" else add="$dir/$old_library" fi elif test -n "$old_library"; then add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$absdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) func_append compile_shlibpath "$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && test "$hardcode_minus_L" != yes && test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$opt_mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. echo $ECHO "*** Warning: This system can not link to static lib archive $lib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then echo "*** But as you try to build a module library, libtool will still create " echo "*** a static module, that should work as long as the dlopening application" echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) func_stripname '-R' '' "$libdir" temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; *) func_append xrpath " $temp_xrpath";; esac;; *) func_append temp_deplibs " $libdir";; esac done dependency_libs="$temp_deplibs" fi func_append newlib_search_path " $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result";; *) func_resolve_sysroot "$deplib" ;; esac if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $func_resolve_sysroot_result "*) func_append specialdeplibs " $func_resolve_sysroot_result" ;; esac fi func_append tmp_libs " $func_resolve_sysroot_result" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do path= case $deplib in -L*) path="$deplib" ;; *.la) func_resolve_sysroot "$deplib" deplib=$func_resolve_sysroot_result func_dirname "$deplib" "" "." dir=$func_dirname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of \`$dir'" absdir="$dir" fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl" ; then depdepl="$absdir/$objdir/$depdepl" darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` if test -z "$darwin_install_name"; then darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" path= fi fi ;; *) path="-L$absdir/$objdir" ;; esac else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "\`$deplib' seems to be moved" path="-L$absdir" fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs if test "$pass" = link; then if test "$linkmode" = "prog"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) func_append lib_search_path " $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) func_append tmp_libs " $deplib" ;; esac ;; *) func_append tmp_libs " $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" fi if test "$linkmode" = prog || test "$linkmode" = lib; then dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for archives" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for archives" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "\`-R' is ignored for archives" test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "\`-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "\`-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" func_append objs "$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) func_stripname 'lib' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test "$module" = no && \ func_fatal_help "libtool library \`$output' must begin with \`lib'" if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required func_stripname '' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else func_stripname '' '.la' "$outputname" libname=$func_stripname_result fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else echo $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" func_append libobjs " $objs" fi fi test "$dlself" != no && \ func_warning "\`-dlopen self' is ignored for libtool libraries" set dummy $rpath shift test "$#" -gt 1 && \ func_warning "ignoring multiple \`-rpath's for a libtool library" install_libdir="$1" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "\`-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 shift IFS="$save_ifs" test -n "$7" && \ func_fatal_help "too many parameters to \`-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$1" number_minor="$2" number_revision="$3" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in # correct linux to gnu/linux during the next big refactor darwin|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|qnx|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_minor" lt_irix_increment=no ;; *) func_fatal_configuration "$modename: unknown library version type \`$version_type'" ;; esac ;; no) current="$1" revision="$2" age="$3" ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "CURRENT \`$current' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "REVISION \`$revision' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "AGE \`$age' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE \`$age' is greater than the current interface number \`$current'" func_fatal_error "\`$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... func_arith $current + 1 minor_current=$func_arith_result xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current" ;; irix | nonstopux) if test "X$lt_irix_increment" = "Xno"; then func_arith $current - $age else func_arith $current - $age + 1 fi major=$func_arith_result case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do func_arith $revision - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) # correct to gnu/linux during the next big refactor func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" ;; osf) func_arith $current - $age major=.$func_arith_result versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do func_arith $current - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring:${iface}.0" done # Make executables depend on our current version. func_append verstring ":${current}.0" ;; qnx) major=".$current" versuffix=".$current" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; *) func_fatal_configuration "unknown library version type \`$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then func_warning "undefined symbols not allowed in $host shared libraries" build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi func_generate_dlsyms "$libname" "$libname" "yes" func_append libobjs " $symfileobj" test "X$libobjs" = "X " && libobjs= if test "$opt_mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$ECHO "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext | *.gcno) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi func_append removelist " $p" ;; *) ;; esac done test -n "$removelist" && \ func_show_eval "${RM}r \$removelist" fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then func_append oldlibs " $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do func_replace_sysroot "$libdir" func_append temp_xrpath " -R$func_replace_sysroot_result" case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) func_append dlfiles " $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) func_append dlprefiles " $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework func_append deplibs " System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then func_append deplibs " -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $opt_dry_run || $RM conftest.c cat > conftest.c </dev/null` $nocaseglob else potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` fi for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a file magic. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do case $a_deplib in -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) func_append newdeplibs " $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval "\\$ECHO \"$libname_spec\""` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a regex pattern. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` done fi case $tmp_deplibs in *[!\ \ ]*) echo if test "X$deplibs_check_method" = "Xnone"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." fi echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes ;; esac ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" echo "*** a static module, that should work as long as the dlopening" echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then echo echo "*** Since this library must not contain undefined symbols," echo "*** because either the platform does not support them or" echo "*** it was explicitly requested with -no-undefined," echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done deplibs="$new_libs" # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then # Remove ${wl} instances when linking with ld. # FIXME: should test the right _cmds variable. case $archive_cmds in *\$LD\ *) wl= ;; esac if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$opt_mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then func_replace_sysroot "$libdir" libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append dep_rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names shift realname="$1" shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" linknames= for link do func_append linknames " $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols="$output_objdir/$libname.uexp" func_append delfiles " $export_symbols" fi orig_export_symbols= case $host_os in cygwin* | mingw* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile if test "x`$SED 1q $export_symbols`" != xEXPORTS; then # and it's NOT already a .def file. Must figure out # which of the given symbols are data symbols and tag # them as such. So, trigger use of export_symbols_cmds. # export_symbols gets reassigned inside the "prepare # the list of exported symbols" if statement, so the # include_expsyms logic still works. orig_export_symbols="$export_symbols" export_symbols= always_export_symbols=yes fi fi ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd1 in $cmds; do IFS="$save_ifs" # Take the normal branch if the nm_file_list_spec branch # doesn't work or if tool conversion is not needed. case $nm_file_list_spec~$to_tool_file_cmd in *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) try_normal_branch=yes eval cmd=\"$cmd1\" func_len " $cmd" len=$func_len_result ;; *) try_normal_branch=no ;; esac if test "$try_normal_branch" = yes \ && { test "$len" -lt "$max_cmd_len" \ || test "$max_cmd_len" -le -1; } then func_show_eval "$cmd" 'exit $?' skipped_export=false elif test -n "$nm_file_list_spec"; then func_basename "$output" output_la=$func_basename_result save_libobjs=$libobjs save_output=$output output=${output_objdir}/${output_la}.nm func_to_tool_file "$output" libobjs=$nm_file_list_spec$func_to_tool_file_result func_append delfiles " $output" func_verbose "creating $NM input file list: $output" for obj in $save_libobjs; do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > "$output" eval cmd=\"$cmd1\" func_show_eval "$cmd" 'exit $?' output=$save_output libobjs=$save_libobjs skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS="$save_ifs" if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) func_append tmp_deplibs " $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec" && test "$compiler_needs_object" = yes && test -z "$libobjs"; then # extract the archives, so we have objects to list. # TODO: could optimize this to just extract one archive. whole_archive_flag_spec= fi if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= else gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $convenience func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" func_append linker_flags " $flag" fi # Make a backup of the uninstalled library when relinking if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && func_len " $test_cmds" && len=$func_len_result && test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output func_basename "$output" output_la=$func_basename_result # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= last_robj= k=1 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then output=${output_objdir}/${output_la}.lnkscript func_verbose "creating GNU ld script: $output" echo 'INPUT (' > $output for obj in $save_libobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done echo ')' >> $output func_append delfiles " $output" func_to_tool_file "$output" output=$func_to_tool_file_result elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then output=${output_objdir}/${output_la}.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= if test "$compiler_needs_object" = yes; then firstobj="$1 " shift fi for obj do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done func_append delfiles " $output" func_to_tool_file "$output" output=$firstobj\"$file_list_spec$func_to_tool_file_result\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." output=$output_objdir/$output_la-${k}.$objext eval test_cmds=\"$reload_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 # Loop over the list of objects to be linked. for obj in $save_libobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result if test "X$objlist" = X || test "$len" -lt "$max_cmd_len"; then func_append objlist " $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. reload_objs=$objlist eval concat_cmds=\"$reload_cmds\" else # All subsequent reloadable object files will link in # the last one created. reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-${k}.$objext objlist=" $obj" func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ reload_objs="$objlist $last_robj" eval concat_cmds=\"\${concat_cmds}$reload_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" fi func_append delfiles " $output" else output= fi if ${skipped_export-false}; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols libobjs=$output # Append the command to create the export file. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi fi test -n "$save_libobjs" && func_verbose "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" if test -n "$export_symbols_regex" && ${skipped_export-false}; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi if ${skipped_export-false}; then if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi fi libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi fi if test -n "$delfiles"; then # Append the command to remove temporary files to $cmds. eval cmds=\"\$cmds~\$RM $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then func_show_eval '${RM}r "$gentop"' fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for objects" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for objects" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "\`-R' is ignored for objects" test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for objects" test -n "$release" && \ func_warning "\`-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object \`$output' from non-libtool objects" libobj=$output func_lo2o "$libobj" obj=$func_lo2o_result ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $opt_dry_run || $RM $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec and hope we can get by with # turning comma into space.. wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` else gentop="$output_objdir/${obj}x" func_append generated " $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # If we're not building shared, we need to use non_pic_objs test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" # Create the old-style object. reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" func_execute_cmds "$reload_cmds" 'exit $?' # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" func_execute_cmds "$reload_cmds" 'exit $?' fi if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) func_stripname '' '.exe' "$output" output=$func_stripname_result.exe;; esac test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for programs" test -n "$release" && \ func_warning "\`-release' is ignored for programs" test "$preload" = yes \ && test "$dlopen_support" = unknown \ && test "$dlopen_self" = unknown \ && test "$dlopen_self_static" = unknown && \ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors # But is supposedly fixed on 10.4 or later (yay!). if test "$tagname" = CXX ; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) func_append compile_command " ${wl}-bind_at_load" func_append finalize_command " ${wl}-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done compile_deplibs="$new_libs" func_append compile_command " $compile_deplibs" func_append finalize_command " $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; *) func_append dllsearchpath ":$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) func_append finalize_perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" "no" # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi wrappers_required=yes case $host in *cegcc* | *mingw32ce*) # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. wrappers_required=no ;; *cygwin* | *mingw* ) if test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; *) if test "$need_relink" = no || test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; esac if test "$wrappers_required" = no; then # Replace the output file specification. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' fi exit $exit_status fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do func_append rpath "$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" func_warning "this platform does not like uninstalled shared libraries" func_warning "\`$output' will be relinked during installation" else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output_objdir/$outputname" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Now create the wrapper script. func_verbose "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. $opt_dry_run || { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) func_stripname '' '.exe' "$output" output=$func_stripname_result ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe func_stripname '' '.exe' "$outputname" outputname=$func_stripname_result ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result cwrappersource="$output_path/$objdir/lt-$output_name.c" cwrapper="$output_path/$output_name.exe" $RM $cwrappersource $cwrapper trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 func_emit_cwrapperexe_src > $cwrappersource # The wrapper executable is built using the $host compiler, # because it contains $host paths and files. If cross- # compiling, it, like the target executable, must be # executed on the $host or under an emulation environment. $opt_dry_run || { $LTCC $LTCFLAGS -o $cwrapper $cwrappersource $STRIP $cwrapper } # Now, create the wrapper script for func_source use: func_ltwrapper_scriptname $cwrapper $RM $func_ltwrapper_scriptname_result trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 $opt_dry_run || { # note: this script will not be executed, so do not chmod. if test "x$build" = "x$host" ; then $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result else func_emit_wrapper no > $func_ltwrapper_scriptname_result fi } ;; * ) $RM $output trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 func_emit_wrapper no > $output chmod +x $output ;; esac } exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save $symfileobj" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" if test "$preload" = yes && test -f "$symfileobj"; then func_append oldobjs " $symfileobj" fi fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $addlibs func_append oldobjs " $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append oldobjs " $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do func_basename "$obj" $ECHO "$func_basename_result" done | sort | sort -uc >/dev/null 2>&1); then : else echo "copying selected object files to avoid basename conflicts..." gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do func_basename "$obj" objbase="$func_basename_result" case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase func_arith $counter + 1 counter=$func_arith_result case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" func_append oldobjs " $gentop/$newobj" ;; *) func_append oldobjs " $obj" ;; esac done fi func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result eval cmds=\"$old_archive_cmds\" func_len " $cmds" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds elif test -n "$archiver_list_spec"; then func_verbose "using command file archive linking..." for obj in $oldobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > $output_objdir/$libname.libcmd func_to_tool_file "$output_objdir/$libname.libcmd" oldobjs=" $archiver_list_spec$func_to_tool_file_result" cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs oldobjs= # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done eval test_cmds=\"$old_archive_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 for obj in $save_oldobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result func_append objlist " $obj" if test "$len" -lt "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= len=$len0 fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi func_execute_cmds "$cmds" 'exit $?' done test -n "$generated" && \ func_show_eval "${RM}r$generated" # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" func_verbose "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) func_basename "$deplib" name="$func_basename_result" func_resolve_sysroot "$deplib" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" ;; -L*) func_stripname -L '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -L$func_replace_sysroot_result" ;; -R*) func_stripname -R '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -R$func_replace_sysroot_result" ;; *) func_append newdependency_libs " $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do case $lib in *.la) func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" ;; *) func_append newdlfiles " $lib" ;; esac done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" ;; esac done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlfiles " $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlprefiles " $abs" done dlprefiles="$newdlprefiles" fi $RM $output # place dlname in correct position for cygwin # In fact, it would be nice if we could use this code for all target # systems that can't hard-code library paths into their executables # and that have no shared library path variable independent of PATH, # but it turns out we can't easily determine that from inspecting # libtool variables, so we have to hard-code the OSs to which it # applies here; at the moment, that means platforms that use the PE # object format with DLL files. See the long comment at the top of # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) # If a -bindir argument was supplied, place the dll there. if test "x$bindir" != x ; then func_relative_path "$install_libdir" "$bindir" tdlname=$func_relative_path_result$dlname else # Otherwise fall back on heuristic. tdlname=../bin/$dlname fi ;; esac $ECHO > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that can not go in dependency_libs. inherited_linker_flags='$new_inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi done } # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' ;; esac exit $EXIT_SUCCESS } { test "$opt_mode" = link || test "$opt_mode" = relink; } && func_mode_link ${1+"$@"} # func_mode_uninstall arg... func_mode_uninstall () { $opt_debug RM="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) func_append RM " $arg"; rmforce=yes ;; -*) func_append RM " $arg" ;; *) func_append files " $arg" ;; esac done test -z "$RM" && \ func_fatal_help "you must specify an RM program" rmdirs= for file in $files; do func_dirname "$file" "" "." dir="$func_dirname_result" if test "X$dir" = X.; then odir="$objdir" else odir="$dir/$objdir" fi func_basename "$file" name="$func_basename_result" test "$opt_mode" = uninstall && odir="$dir" # Remember odir for removal later, being careful to avoid duplicates if test "$opt_mode" = clean; then case " $rmdirs " in *" $odir "*) ;; *) func_append rmdirs " $odir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if { test -L "$file"; } >/dev/null 2>&1 || { test -h "$file"; } >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if func_lalib_p "$file"; then func_source $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do func_append rmfiles " $odir/$n" done test -n "$old_library" && func_append rmfiles " $odir/$old_library" case "$opt_mode" in clean) case " $library_names " in *" $dlname "*) ;; *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; esac test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if func_lalib_p "$file"; then # Read the .lo file func_source $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test "$pic_object" != none; then func_append rmfiles " $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test "$non_pic_object" != none; then func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) if test "$opt_mode" = clean ; then noexename=$name case $file in *.exe) func_stripname '' '.exe' "$file" file=$func_stripname_result func_stripname '' '.exe' "$name" noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe func_append rmfiles " $file" ;; esac # Do a test to see if this is a libtool program. if func_ltwrapper_p "$file"; then if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result func_append rmfiles " $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename fi # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles func_append rmfiles " $odir/$name $odir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then func_append rmfiles " $odir/lt-$name" fi if test "X$noexename" != "X$name" ; then func_append rmfiles " $odir/lt-${noexename}.c" fi fi fi ;; esac func_show_eval "$RM $rmfiles" 'exit_status=1' done # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then func_show_eval "rmdir $dir >/dev/null 2>&1" fi done exit $exit_status } { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && func_mode_uninstall ${1+"$@"} test -z "$opt_mode" && { help="$generic_help" func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode \`$opt_mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi exit $exit_status # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: # vi:sw=2 darkice-1.2/install-sh0000755000175000017500000003325612170706611011715 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2011-01-19.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 # Protect names problematic for `test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for `test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for `test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writeable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: darkice-1.2/config.sub0000755000175000017500000010532712170706611011673 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011, 2012 Free Software Foundation, Inc. timestamp='2012-04-18' # 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, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted GNU 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. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 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-android* | linux-dietlibc | linux-newlib* | \ linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) 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 | -microblaze) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -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*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -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 \ | aarch64 | aarch64_be \ | 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 \ | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 \ | ns16k | ns32k \ | open8 \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | 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 \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-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-* \ | aarch64-* | aarch64_be-* \ | 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-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | 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-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze) basic_machine=microblaze-xilinx ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i386-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; 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 ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; 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 ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | 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. -auroraux) os=-auroraux ;; -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* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) 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 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-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: darkice-1.2/ChangeLog0000644000175000017500000003046212170707071011460 0000000000000015-07-2013 Darkice 1.2 released o Issue #75: Added Ogg/Opus support. Patch by Doug Kelly dougk.ff7@gmail.com o Fix 'Ring Ruffer' reports. - Increased buffer for jack to 5 seconds - prevent darkice termination by jack, report no fatal problem when we have a ringbuffer overflow, can happen during startup If we can not handle input audio fast enough we just ignore the buffer and skip it, and just report it. - new multithreaded connector code, now handles encoders in parallel and does not spin waiting, cpu load will be very much lower now Codes uses 2 condition variables to report data availability and consumer thread availability - Hopes are that glitching reports will be a thing of the past - minor compiler warnings fixed (Fix by Edwin van den Oetelaar) o Issue #56: Wrong icecast2 password isn't properly reported, fixed. thanks to Filipe Roque o Issue #57: BufferedSink makes streams invalid, fixed. thanks to Alban Peignier o Issue #30: Segmentation Fault when creating file with fileAddDate, fixed thanks to Filipe Roque 27-10-2011 Darkice 1.1 released o Updated aac+ encoding to use libaacplus-2.0.0 api. thanks to Sergiy o Added pulseaudio support closes ticket #25 thanks to Filipe Roque and and Johann Fot o Added rtprio parameter and revisited realtime priority closes ticket #21 thanks to Adrian Knoth o Fixed a call to a deprecated jack call closes ticket #22 thanks to Adrian Knoth again. 09-05-2010 Darkice 1.0 released o fixed a bug in BufferedSink.cpp that leads to some buffers being written twice, causing corruption of datastream, closes ticked #20 thanks to Edwin van den Oetelaar o implemented samplerate conversion for all codecs using libsamplerate, and keeping internal aflibConverter as fallback, thanks to Sergiy o bugfix: fix for alsa driver - closes ticked #8 thanks to Clemens Ladisch 14-11-2009 Darkice 0.20.1 released o added rc.darkice init script thanks to Niels Dettenbach o bugfix: fix for gcc 4.4 05-11-2009 Darkice 0.20 released o new maintainer: Rafael Diniz o added AAC HEv2 encoding support (branch darkice-aacp merged) through libaacplus, http://tipok.org.ua/ru/node/17 thanks to tipok and others for the contribution. o bugfix: the configure script recognizes Ogg Vorbis shared objects now, not just static libraries. Thanks to omroepvenray. o bugfix: enabling jack source compilation on Debian Lenny, thanks to Alessandro Beretta 07-07-2008 Darkice 0.19 released o added mount point option for Darwin Streaming Server thanks to Pierre Souchay o fix for some reliablity issues when using a Jack source thanks to Pierre Souchay o enable easier finding of jack libraries on MacOS X, thanks to Daniel Hazelbaker o added ability to specify name of jack device created by darkice, thanks to Alessandro Beretta 26-04-2007 DarkIce 0.18.1 released o enable real-time scheduling for non-super-users, if they have the proper operating system permissions, thanks to Jens Maurer o fix to enable compliation of the Serial ULAW code on MacOS X, thanks to Elod Horvath o fix to solve Shoutcast login failures, introduced in 0.18 05-03-2007 DarkIce 0.18 released o added serial ulaw input device support, thanks to Clyde Stubbs o improvements on reconnecting: added TCP connection keep-alive to TCP sockets added graceful sleep when trying to reconnect o added user-defined date formatting for the fileAddDate options, thanks to dsk o added logging facility - [file-X] targets will cut the saved file and rename it as needed when darkice recieves the SIGUSR1 signal o added default configuration file handling - if no configuration file is specified, /etc/darkice.cfg is used o fix to enable compiling on 64 bit platforms thanks to Alexander Vlasov and Mariusz Mazur o fix to enable file dump feature using ogg vorbis. thanks to dsk o fix to enable compiling with jack installed at arbitrary locations 19-05-2006 DarkIce 0.17.1 released o bugfix: automatic reconnect works more reliably 26-01-2006 DarkIce 0.17 released o added check for bufferSecs set to 0 thanks to Toph o added realtime parameter to the general section o added MPEG2 support through the TwoLame library. thanks to Nicholas J Humfrey 22-10-2005 DarkIce 0.16 released o added AAC support through the faac codec, http://www.audiocoding.com o bug fix: icecast2 sections didn't honor lowpass or highpass filters when using the mp3 format 14-04-2005 DarkIce 0.15 released o ported to OpenBSD and NetBSD, though real-time scheduling not supported, since it is not implemented in OpenBSD / NetBSD o added possibility to downsample from stereo to mono when encoding to Ogg Vorbis, thanks to Deti Fliegl, o added support for Jack inputs, enabling a lot of interesting usage, including support for MacOS X. Thanks to Nicholas J. Humfrey o various improvements by Joel Ebel o added option to turn off automatic reconnect feature o added IPv6 support, thanks to 15-02-2004: DarkIce 0.14 released o added ALSA support, thanks to Christian Forster o added fix to enable downsampling from stereo to mono of mp3 streams when streaming to an icecast2 server. thanks to John Deeny o removed _X and _Y symbols from aflibConverter files, which caused a naming collision on Solaris. thanks to Robert Lunnon, o bug fix: ogg vorbis recording to only a file caused a segfault. now fixed, thanks to Enrico Ardizzoni 07-01-2004: DarkIce 0.13.2 released o bug fix: two bugs fixed that caused core dump when encoding into mp3 of FreeBSD. thanks to John Hay o added configure option --with-debug to enable compilation for debug mode 12-02-2003: Darkice 0.13.1 released o added cross-platform pthread detection, thanks to Steven G. Johnson and Alejandro Forero Cuervo see http://www.gnu.org/software/ac-archive/htmldoc/acx_pthread.html o added proper detection of netural endiannes for 16 bit recording o basically these changes allow compilation on FreeBSD 09-02-2003: DarkIce 0.13 released o added feature for setting the TITLE comment field for vorbis streams. thanks to Ricardo Galli o bugfix: fixed minor bug in IcecCast2.cpp, which could have lead to a buffer overflow. thanks to Atsuhiko Yamanaka o bugfix: MultiThreadedConnector::sinkThread() was private, now public o added fileAddDate configuration option thanks to Nicu Pavel o added support for big endian OSS devices (like Linux PowerPC) 20-10-2002: DarkIce 0.12 released o ported to FreeBSD (removed reference to MSG_NOSIGNAL in TcpSocket.cpp) o bug fix: maximum bitrate setting fixed for Ogg Vorbis streams o changed internals so that now each encoding/server connection is a separate thread o when a connection is dropped, DarkIce tries to reconnect, indefinitely 20-08-2002: DarkIce 0.11 released o added possibility to specify maximum bitrate for Ogg Vorbis streams o added HTTP Basic authentication for icecast2 logins o added mp3 streaming for icecast2 o added possibility to stream in mono even when recording in stereo, thus enabling mono and stereo streams with the same darkice instance. only for mp3 streams at the moment thanks to Kai Krakow o bug fix: resampling audio for vorbis streams bugs fixed 02-08-2002: DarkIce 0.10.1 released o bug fix: when the last server dropped connection, darkice crashed thanks to Nicu Pavel o bug fix for LameLibEncoder: the mp3 encoding buffer was deleted too early, resulting in mp3 data corruption. thanks to Nicu Pavel 20-07-2002: DarkIce 0.10 released o added possibility to select constant, average and variable bit rate encoding modes with specifying encoding quality as well. thanks to Nicu Pavel o added support for Ogg Vorbis 1.0 final, removed support for rc2 o added fault tolerance: if one of several server connection drops, DarkIce carries on with the rest of the servers still connected 09-04-2002: DarkIce 0.9.1 released o bugfix: a memory leak was introduced in 0.9, which is fixed thanks to Kristjan G. Bjarnason and Nicu Pavel o minor documentation fix 28-03-2002: DarkIce 0.9 released o added possibility to simply read from the soundcard, encode, and save the encoded data into a local file (no streaming server needed) o added variable bitrate support for vorbis streams o support for both rc2 and rc3 versions of vorbis libraries o added support for resampling when encoding to vorbis thanks to the OSALP project for the resampling class, http://osalp.sourceforge.net/ and Julius O. Smith, for the original code 20-02-2002: DarkIce 0.8 released o added possibility to disable lowpass and highpass filtering for lame o fixed incorrect vorbis bitrate setting o fix: DarkIce now reports public streams correctly thanks to Tom Gray, o made up-to-date with Ogg Vorbis rc3 libs thanks to Michael Smith, o made up-to-date with current IceCast2 cvs version o added local stream dump possibility 19-10-2001: DarkIce 0.7 released o added support for FreeBSD thanks to Robin P. Blanchard, o added support for resampling mp3 streams o DarkIce config file now may contain spaces and tabs as white space o configure script enables build with or without lame / Ogg Vorbis also possibility to specify alternate locations for these 18-09-2001: DarkIce 0.6 released o added support for IceCast2 server with Ogg Vorbis streaming Ogg Vorbis support thanks to aNa|0Gue o added support for SUN Solaris o removed long command line options (as these are extensions to UNIX) o removed configure option to specify location of lame library o removed configure option to compile static executable 09-09-2001: DarkIce 0.5 released o added support for ShoutCast servers o removed local copy of SGI STL, uses STL of the C++ compiler o compiles with gcc3-c++ o added man page darkice.cfg.5 o bugfix: config files can have comments before the first section 02-09-2001: DarkIce 0.4 released o support for external command line encoder removed, replaced with using lame as a shared object or statically linked library o added darkice man page o created RPM packages o DarkIce no longer reports an error if the sound card recording sample rate could not be set to the exact specified amount (e.g. the sound card reports 44101 Hz instead of 44100 Hz) 26-08-2001: DarkIce 0.3.1 released o support for unlimited time encoding thanks to Jim Crilly, 20-12-2000: DarkIce 0.3 released o added POSIX real-time scheduling 18-11-2000: DarkIce 0.2 released o code cleanup o first real tests made o added verbosity command line option 13-11-2000: DarkIce 0.1 released darkice-1.2/Makefile.in0000644000175000017500000006247712170707117011767 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(top_srcdir)/configure AUTHORS COPYING \ ChangeLog INSTALL NEWS TODO config.guess config.sub depcomp \ install-sh ltmain.sh missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(sysconfdir)" DATA = $(sysconf_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir dist dist-all distcheck ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print AACPLUS_INCFLAGS = @AACPLUS_INCFLAGS@ AACPLUS_LDFLAGS = @AACPLUS_LDFLAGS@ ACLOCAL = @ACLOCAL@ ALSA_INCFLAGS = @ALSA_INCFLAGS@ ALSA_LDFLAGS = @ALSA_LDFLAGS@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG_CXXFLAGS = @DEBUG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FAAC_INCFLAGS = @FAAC_INCFLAGS@ FAAC_LDFLAGS = @FAAC_LDFLAGS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JACK_CFLAGS = @JACK_CFLAGS@ JACK_INCFLAGS = @JACK_INCFLAGS@ JACK_LDFLAGS = @JACK_LDFLAGS@ LAME_INCFLAGS = @LAME_INCFLAGS@ LAME_LDFLAGS = @LAME_LDFLAGS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ OPUS_INCFLAGS = @OPUS_INCFLAGS@ OPUS_LDFLAGS = @OPUS_LDFLAGS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PULSEAUDIO_INCFLAGS = @PULSEAUDIO_INCFLAGS@ PULSEAUDIO_LDFLAGS = @PULSEAUDIO_LDFLAGS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SRC_CFLAGS = @SRC_CFLAGS@ SRC_INCFLAGS = @SRC_INCFLAGS@ SRC_LDFLAGS = @SRC_LDFLAGS@ STRIP = @STRIP@ TWOLAME_INCFLAGS = @TWOLAME_INCFLAGS@ TWOLAME_LDFLAGS = @TWOLAME_LDFLAGS@ VERSION = @VERSION@ VORBIS_INCFLAGS = @VORBIS_INCFLAGS@ VORBIS_LDFLAGS = @VORBIS_LDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = src man sysconf_DATA = darkice.cfg EXTRA_DIST = darkice.cfg INSTALL.lame INSTALL.vorbis FAQ rc.darkice all: all-recursive .SUFFIXES: am--refresh: Makefile @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): install-sysconfDATA: $(sysconf_DATA) @$(NORMAL_INSTALL) @list='$(sysconf_DATA)'; test -n "$(sysconfdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sysconfdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sysconfdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(sysconfdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(sysconfdir)" || exit $$?; \ done uninstall-sysconfDATA: @$(NORMAL_UNINSTALL) @list='$(sysconf_DATA)'; test -n "$(sysconfdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(sysconfdir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__remove_distdir) dist-lzma: distdir tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma $(am__remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod u+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(sysconfdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-sysconfDATA install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-sysconfDATA .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am am--refresh check check-am clean clean-generic \ ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ dist-lzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \ distcheck distclean distclean-generic distclean-tags \ distcleancheck distdir distuninstallcheck dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip install-sysconfDATA \ installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am uninstall-sysconfDATA # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: darkice-1.2/INSTALL0000644000175000017500000003660012170706611010736 00000000000000Installation Instructions ************************* Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without warranty of any kind. Basic Installation ================== Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. Some packages provide this `INSTALL' file but do not implement all of the features documented below. The lack of an optional feature in a given package is not necessarily a bug. More recommendations for GNU packages can be found in *note Makefile Conventions: (standards)Makefile Conventions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package, generally using the just-built uninstalled binaries. 4. Type `make install' to install the programs and any data files and documentation. When installing into a prefix owned by root, it is recommended that the package be configured and built as a regular user, and only the `make install' phase executed with root privileges. 5. Optionally, type `make installcheck' to repeat any self-tests, but this time using the binaries in their final installed location. This target does not install anything. Running this target as a regular user, particularly if the prior `make install' required root privileges, verifies that the installation completed correctly. 6. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 7. Often, you can also type `make uninstall' to remove the installed files again. In practice, not all packages have tested that uninstallation works correctly, even though it is required by the GNU Coding Standards. 8. Some packages, particularly those that use Automake, provide `make distcheck', which can by used by developers to test that all other targets like `make install' and `make uninstall' work correctly. This target is generally not run by end users. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. This is known as a "VPATH" build. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX', where PREFIX must be an absolute file name. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. In general, the default for these options is expressed in terms of `${prefix}', so that specifying just `--prefix' will affect all of the other directory specifications that were not explicitly provided. The most portable way to affect installation locations is to pass the correct locations to `configure'; however, many packages provide one or both of the following shortcuts of passing variable assignments to the `make install' command line to change installation locations without having to reconfigure or recompile. The first method involves providing an override variable for each affected directory. For example, `make install prefix=/alternate/directory' will choose an alternate location for all directory configuration variables that were expressed in terms of `${prefix}'. Any directories that were specified during `configure', but not in terms of `${prefix}', must each be overridden at install time for the entire installation to be relocated. The approach of makefile variable overrides for each directory variable is required by the GNU Coding Standards, and ideally causes no recompilation. However, some platforms have known limitations with the semantics of shared libraries that end up requiring recompilation when using this method, particularly noticeable in packages that use GNU Libtool. The second method involves providing the `DESTDIR' variable. For example, `make install DESTDIR=/alternate/directory' will prepend `/alternate/directory' before all installation names. The approach of `DESTDIR' overrides is not required by the GNU Coding Standards, and does not work on platforms that have drive letters. On the other hand, it does better at avoiding recompilation issues, and works well even when some directory options were not specified in terms of `${prefix}' at `configure' time. Optional Features ================= If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Some packages offer the ability to configure how verbose the execution of `make' will be. For these packages, running `./configure --enable-silent-rules' sets the default to minimal output, which can be overridden with `make V=1'; while running `./configure --disable-silent-rules' sets the default to verbose, which can be overridden with `make V=0'. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" and if that doesn't work, install pre-built binaries of GCC for HP-UX. HP-UX `make' updates targets which have the same time stamps as their prerequisites, which makes it generally unusable when shipped generated files such as `configure' are involved. Use GNU `make' instead. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" On Solaris, don't put `/usr/ucb' early in your `PATH'. This directory contains several dysfunctional programs; working variants of these programs are available in `/usr/bin'. So, if you need `/usr/ucb' in your `PATH', put it _after_ `/usr/bin'. On Haiku, software installed for all users goes in `/boot/common', not `/usr/local'. It is recommended to use the following options: ./configure --prefix=/boot/common Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf bug. Until the bug is fixed you can use this workaround: CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. darkice-1.2/COPYING0000644000175000017500000010470112170706611010736 00000000000000All source code in the src directory is covered under the GNU General Public License version 3 or any later version. GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. 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 them 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 prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. 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. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey 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; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If 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 convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU 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 that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. 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. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 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. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. 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 state 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 3 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, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program 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, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU 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. But first, please read .