mirror of
https://gitlab.xiph.org/xiph/ezstream.git
synced 2024-11-03 04:17:18 -05:00
Initial revision
git-svn-id: https://svn.xiph.org/trunk/ezstream@5800 0101bb08-14d6-0310-b084-bc0e0c8e3800
This commit is contained in:
commit
35f54caeba
340
COPYING
Normal file
340
COPYING
Normal file
@ -0,0 +1,340 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
12
Makefile.am
Normal file
12
Makefile.am
Normal file
@ -0,0 +1,12 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
AUTOMAKE_OPTIONS = 1.6 foreign dist-zip
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
SUBDIRS = src win32 conf
|
||||
|
||||
debug:
|
||||
$(MAKE) all CFLAGS="@DEBUG@"
|
||||
|
||||
profile:
|
||||
$(MAKE) all CFLAGS="@PROFILE@"
|
63
README
Normal file
63
README
Normal file
@ -0,0 +1,63 @@
|
||||
ezstream README
|
||||
------------------------------
|
||||
|
||||
WHAT IS IT ?
|
||||
::::::::::::
|
||||
|
||||
ezstream is a command line utility which is a improved version of the old
|
||||
"shout" utility. It enables you to stream mp3 or vorbis files to an icecast
|
||||
server without reencoding and thus requires very little CPU. ezstream is
|
||||
controlled via a XML config file (a few examples are provided in the conf
|
||||
directory).
|
||||
|
||||
ezstream can stream mp3 and ogg vorbis files as well as reading from stdin.
|
||||
Currently, reading from stdin is not working under win32.
|
||||
ID3v1 tags are supported in mp3 files and all ogg vorbis tags are propagated
|
||||
as metadata as well.
|
||||
|
||||
|
||||
CONFIG FILE
|
||||
:::::::::::
|
||||
|
||||
The following is an example config file :
|
||||
|
||||
<ezstream>
|
||||
<url>http://localhost:8000/testmount.ogg</url>
|
||||
<sourcepassword>hackme</sourcepassword>
|
||||
<format>OGGVORBIS</format>
|
||||
<filename>sunking.ogg</filename>
|
||||
<svrinfoname>My Stream</svrinfoname>
|
||||
<svrinfourl>http://www.oddsock.org</svrinfourl>
|
||||
<svrinfogenre>RockNRoll</svrinfogenre>
|
||||
<svrinfodescription>This is a stream description</svrinfodescription>
|
||||
<svrinfobitrate>192</svrinfobitrate>
|
||||
<svrinfoquality>4.0</svrinfoquality>
|
||||
<svrinfochannels>2</svrinfochannels>
|
||||
<svrinfosamplerate>44100</svrinfosamplerate>
|
||||
<svrinfopublic>1</svrinfopublic>
|
||||
</ezstream>
|
||||
|
||||
URL - this URL specified the location and mountpoint of the icecast server
|
||||
to which the stream will be sent.
|
||||
SOURCEPASSWORD - the source password for the icecast server
|
||||
FORMAT - either MP3 or OGGVORBIS, you must specify which format you input
|
||||
files are in.
|
||||
FILENAME - This can be a single file (in which ezstream will stream that
|
||||
file over and over continuously) or can be a .m3u file which
|
||||
is a playlist of files. currently, ezstream will go through
|
||||
the files sequentially. If you specify "stdin" as the filename
|
||||
then ezstream will read the input from stdin.
|
||||
SVRINFONAME - Broadcast name (informational only)
|
||||
SVRINFOURL - Website associated with the broadcast (informational only)
|
||||
SVRINFOGENRE - Genre of broadcast (informational only) (used for YP)
|
||||
SVRINFODESCRIPTION - Description of broadcast (informational only) (used for YP)
|
||||
SVRINFOBITRATE - Bitrate of broadcast (informational only) (used for YP)
|
||||
It is YOUR responsibility to ensure that the bitrate specified
|
||||
here matches up with your input. Note that this info is not
|
||||
for anything OTHER than YP listing info.
|
||||
SVRINFOQUALITY - Used only for OggVorbis streams, similar to the bitrate
|
||||
in that it is used only for informational and YP purposes.
|
||||
SVRINFOCHANNELS - 1 = MONO, 2 = STEREO (informational only) (used for YP)
|
||||
SVRINFOSAMPLERATE - (informational only) (used for YP)
|
||||
SVRINFOPUBLIC - Indicates wether to list this stream in a public YP.
|
||||
|
4961
aclocal.m4
vendored
Normal file
4961
aclocal.m4
vendored
Normal file
File diff suppressed because it is too large
Load Diff
113
autogen.sh
Executable file
113
autogen.sh
Executable file
@ -0,0 +1,113 @@
|
||||
#!/bin/sh
|
||||
# Run this to set up the build system: configure, makefiles, etc.
|
||||
# (based on the version in enlightenment's cvs)
|
||||
|
||||
package="icecast"
|
||||
|
||||
olddir=`pwd`
|
||||
srcdir=`dirname $0`
|
||||
test -z "$srcdir" && srcdir=.
|
||||
|
||||
cd "$srcdir"
|
||||
DIE=0
|
||||
|
||||
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "You must have autoconf installed to compile $package."
|
||||
echo "Download the appropriate package for your distribution,"
|
||||
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
|
||||
DIE=1
|
||||
}
|
||||
VERSIONGREP="sed -e s/.*[^0-9\.]\([0-9]\.[0-9]\).*/\1/"
|
||||
|
||||
# do we need automake?
|
||||
if test -r Makefile.am; then
|
||||
echo Checking for automake version
|
||||
options=`fgrep AUTOMAKE_OPTIONS Makefile.am`
|
||||
AM_NEEDED=`echo "$options" | $VERSIONGREP`
|
||||
AM_PROGS=automake
|
||||
AC_PROGS=aclocal
|
||||
if test -n "$AM_NEEDED" && test "x$AM_NEEDED" != "x$options"
|
||||
then
|
||||
AM_PROGS="automake-$AM_NEEDED automake$AM_NEEDED $AM_PROGS"
|
||||
AC_PROGS="aclocal-$AM_NEEDED aclocal$AM_NEEDED $AC_PROGS"
|
||||
else
|
||||
AM_NEEDED=""
|
||||
fi
|
||||
AM_PROGS="$AUTOMAKE $AM_PROGS"
|
||||
AC_PROGS="$ACLOCAL $AC_PROGS"
|
||||
for am in $AM_PROGS; do
|
||||
($am --version > /dev/null 2>&1) 2>/dev/null || continue
|
||||
ver=`$am --version | head -1 | $VERSIONGREP`
|
||||
AWK_RES=`echo $ver $AM_NEEDED | awk '{ if ( $1 >= $2 ) print "yes"; else print "no" }'`
|
||||
if test "$AWK_RES" = "yes"; then
|
||||
AUTOMAKE=$am
|
||||
echo " found $AUTOMAKE"
|
||||
break
|
||||
fi
|
||||
done
|
||||
for ac in $AC_PROGS; do
|
||||
($ac --version > /dev/null 2>&1) 2>/dev/null || continue
|
||||
ver=`$ac --version < /dev/null | head -1 | $VERSIONGREP`
|
||||
AWK_RES=`echo $ver $AM_NEEDED | awk '{ if ( $1 >= $2 ) print "yes"; else print "no" }'`
|
||||
if test "$AWK_RES" = "yes"; then
|
||||
ACLOCAL=$ac
|
||||
echo " found $ACLOCAL"
|
||||
break
|
||||
fi
|
||||
done
|
||||
test -z $AUTOMAKE || test -z $ACLOCAL && {
|
||||
echo
|
||||
if test -n "$AM_NEEDED"; then
|
||||
echo "You must have automake version $AM_NEEDED installed"
|
||||
echo "to compile $package."
|
||||
else
|
||||
echo "You must have automake installed to compile $package."
|
||||
fi
|
||||
echo "Download the appropriate package for your distribution,"
|
||||
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
|
||||
DIE=1
|
||||
}
|
||||
fi
|
||||
|
||||
(libtoolize --version) > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "You must have libtool installed to compile $package."
|
||||
echo "Download the appropriate package for your system,"
|
||||
echo "or get the source from one of the GNU ftp sites"
|
||||
echo "listed in http://www.gnu.org/order/ftp.html"
|
||||
DIE=1
|
||||
}
|
||||
|
||||
if test "$DIE" -eq 1; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Generating configuration files for $package, please wait...."
|
||||
|
||||
ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I m4"
|
||||
if test -n "$ACLOCAL"; then
|
||||
echo " $ACLOCAL $ACLOCAL_FLAGS"
|
||||
$ACLOCAL $ACLOCAL_FLAGS
|
||||
fi
|
||||
|
||||
echo " autoheader"
|
||||
autoheader
|
||||
|
||||
echo " libtoolize --automake"
|
||||
libtoolize --automake
|
||||
|
||||
if test -n "$AUTOMAKE"; then
|
||||
echo " $AUTOMAKE --add-missing"
|
||||
$AUTOMAKE --add-missing
|
||||
fi
|
||||
|
||||
echo " autoconf"
|
||||
autoconf
|
||||
|
||||
if test -z "$*"; then
|
||||
echo "I am going to run ./configure with no arguments - if you wish "
|
||||
echo "to pass any to it, please specify them on the $0 command line."
|
||||
fi
|
||||
cd $olddir
|
||||
$srcdir/configure "$@" && echo
|
5
conf/Makefile.am
Normal file
5
conf/Makefile.am
Normal file
@ -0,0 +1,5 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
EXTRA_DIST = ezstream_m3u.xml ezstream_mp3.xml ezstream_vorbis.xml
|
20
conf/ezstream_m3u.xml
Normal file
20
conf/ezstream_m3u.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<ezstream>
|
||||
<url>http://localhost:8000/testmount</url>
|
||||
<sourcepassword>hackme</sourcepassword>
|
||||
<format>MP3</format>
|
||||
<filename>mymp3tracks.m3u</filename>
|
||||
<!-- The following settings are used to describe your stream
|
||||
to the server. It's up to you to make sure the
|
||||
bitrate/quality/samplerate/channels
|
||||
match up to your input stream -->
|
||||
<svrinfoname>My Stream</svrinfoname>
|
||||
<svrinfourl>http://www.oddsock.org</svrinfourl>
|
||||
<svrinfogenre>RockNRoll</svrinfogenre>
|
||||
<svrinfodescription>This is a stream description</svrinfodescription>
|
||||
<svrinfobitrate>128</svrinfobitrate>
|
||||
<!-- Quality is only applicable to ogg vorbis streams -->
|
||||
<!-- <svrinfoquality>1.0</svrinfoquality> -->
|
||||
<svrinfochannels>2</svrinfochannels>
|
||||
<svrinfosamplerate>44100</svrinfosamplerate>
|
||||
<svrinfopublic>1</svrinfopublic>
|
||||
</ezstream>
|
20
conf/ezstream_mp3.xml
Normal file
20
conf/ezstream_mp3.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<ezstream>
|
||||
<url>http://localhost:8000/testmount</url>
|
||||
<sourcepassword>hackme</sourcepassword>
|
||||
<format>MP3</format>
|
||||
<filename>Track13.mp3</filename>
|
||||
<!-- The following settings are used to describe your stream
|
||||
to the server. It's up to you to make sure the
|
||||
bitrate/quality/samplerate/channels
|
||||
match up to your input stream -->
|
||||
<svrinfoname>My Stream</svrinfoname>
|
||||
<svrinfourl>http://www.oddsock.org</svrinfourl>
|
||||
<svrinfogenre>RockNRoll</svrinfogenre>
|
||||
<svrinfodescription>This is a stream description</svrinfodescription>
|
||||
<svrinfobitrate>128</svrinfobitrate>
|
||||
<!-- Quality is only applicable to ogg vorbis streams -->
|
||||
<!-- <svrinfoquality>1.0</svrinfoquality> -->
|
||||
<svrinfochannels>2</svrinfochannels>
|
||||
<svrinfosamplerate>44100</svrinfosamplerate>
|
||||
<svrinfopublic>1</svrinfopublic>
|
||||
</ezstream>
|
15
conf/ezstream_vorbis.xml
Normal file
15
conf/ezstream_vorbis.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<ezstream>
|
||||
<url>http://localhost:8000/testmount.ogg</url>
|
||||
<sourcepassword>hackme</sourcepassword>
|
||||
<format>OGGVORBIS</format>
|
||||
<filename>sunking.ogg</filename>
|
||||
<svrinfoname>My Stream</svrinfoname>
|
||||
<svrinfourl>http://www.oddsock.org</svrinfourl>
|
||||
<svrinfogenre>RockNRoll</svrinfogenre>
|
||||
<svrinfodescription>This is a stream description</svrinfodescription>
|
||||
<svrinfobitrate>192</svrinfobitrate>
|
||||
<svrinfoquality>4.0</svrinfoquality>
|
||||
<svrinfochannels>2</svrinfochannels>
|
||||
<svrinfosamplerate>44100</svrinfosamplerate>
|
||||
<svrinfopublic>1</svrinfopublic>
|
||||
</ezstream>
|
94
configure.in
Normal file
94
configure.in
Normal file
@ -0,0 +1,94 @@
|
||||
AC_INIT([ezstream], [0.1.0], [icecast@xiph.org])
|
||||
|
||||
AC_PREREQ(2.54)
|
||||
AC_CONFIG_SRCDIR(src/ezstream.c)
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
|
||||
AM_INIT_AUTOMAKE
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
AC_PROG_CC
|
||||
AC_CANONICAL_HOST
|
||||
AM_PROG_LIBTOOL
|
||||
|
||||
dnl Set some options based on environment
|
||||
|
||||
DEBUG="-g"
|
||||
if test -z "$GCC"; then
|
||||
XIPH_CPPFLAGS="-D_REENTRANT"
|
||||
case $host in
|
||||
*-*-irix*)
|
||||
XIPH_CPPFLAGS="$XIPH_CPPFLAGS -w -signed"
|
||||
PROFILE="-p -g3 -O2 -signed -D_REENTRANT"
|
||||
;;
|
||||
*-*-solaris*)
|
||||
XIPH_CFLAGS="-xO4 -xcg92"
|
||||
XIPH_CPPFLAGS="$XIPH_CPPFLAGS -v -w -fsimple -fast"
|
||||
PROFILE="-xpg -g -Dsuncc"
|
||||
;;
|
||||
*)
|
||||
XIPH_CFLAGS="-O"
|
||||
PROFILE="-g -p"
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$host" in
|
||||
*openbsd* | *irix*)
|
||||
;;
|
||||
*) AC_DEFINE([_XOPEN_SOURCE], 600, [Define if you have POSIX and XPG specifications])
|
||||
;;
|
||||
esac
|
||||
|
||||
else
|
||||
XIPH_CPPFLAGS="-Wall -ffast-math -fsigned-char"
|
||||
PROFILE="-pg -g"
|
||||
AC_DEFINE([_GNU_SOURCE], 1, [Define to include GNU extensions to POSIX])
|
||||
fi
|
||||
|
||||
dnl Checks for programs.
|
||||
|
||||
dnl Checks for libraries.
|
||||
|
||||
dnl Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
|
||||
dnl Check for types
|
||||
|
||||
dnl Checks for library functions.
|
||||
|
||||
dnl -- configure options --
|
||||
|
||||
XIPH_PATH_SHOUT(, AC_MSG_ERROR([must have libshout installed!]))
|
||||
if test "$SHOUT_THREADSAFE" != "yes"
|
||||
then
|
||||
AC_MSG_ERROR([This libshout isn't threadsafe])
|
||||
fi
|
||||
|
||||
XIPH_PATH_XML
|
||||
|
||||
XIPH_VAR_APPEND([XIPH_CFLAGS], [$XML_CFLAGS])
|
||||
XIPH_VAR_PREPEND([XIPH_LIBS], [$XML_LIBS])
|
||||
|
||||
XIPH_VAR_APPEND([XIPH_CPPFLAGS], [$SHOUT_CPPFLAGS])
|
||||
XIPH_VAR_APPEND([XIPH_CFLAGS], [$SHOUT_CFLAGS])
|
||||
XIPH_VAR_PREPEND([XIPH_LIBS], [$SHOUT_LIBS])
|
||||
|
||||
XIPH_PATH_VORBIS(, AC_MSG_ERROR([must have Ogg Vorbis v1.0 installed!]))
|
||||
XIPH_VAR_APPEND([XIPH_CPPFLAGS],[$VORBIS_CFLAGS])
|
||||
XIPH_VAR_PREPEND([XIPH_LIBS],[$VORBIS_LIBS])
|
||||
|
||||
dnl Make substitutions
|
||||
|
||||
AC_SUBST(XIPH_CPPFLAGS)
|
||||
AC_SUBST(XIPH_CFLAGS)
|
||||
AC_SUBST(XIPH_LIBS)
|
||||
AC_SUBST(LIBTOOL_DEPS)
|
||||
AC_SUBST(LIBS)
|
||||
AC_SUBST(DEBUG)
|
||||
AC_SUBST(CFLAGS)
|
||||
AC_SUBST(PROFILE)
|
||||
|
||||
AC_OUTPUT([Makefile win32/Makefile conf/Makefile src/Makefile])
|
270
m4/ac_config_libconfig_in.m4
Normal file
270
m4/ac_config_libconfig_in.m4
Normal file
@ -0,0 +1,270 @@
|
||||
dnl Available from the GNU Autoconf Macro Archive at:
|
||||
dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_config_libconfig_in.html
|
||||
dnl
|
||||
# AC_CONFIG_LIBCONFIG_IN(LIBRARY, DESTINATION, MODULES)
|
||||
# -----------------------------------------------------
|
||||
# Generate a custom LIBRARY-config script. Create the script in the
|
||||
# DESTINATION directory, including support for MODULES.
|
||||
AC_DEFUN([AC_CONFIG_LIBCONFIG_IN],
|
||||
[# create a custom library-config file ($1-config)
|
||||
m4_if(AC_CONFIG_LIBCONFIG_IN_USEPKGCONFIG, [true],
|
||||
[AC_PATH_PROG(PKG_CONFIG, pkg-config)])
|
||||
pushdef([LIBCONFIG_DIR], [m4_if([$2], , , [$2/])])
|
||||
LIBCONFIG_FILE="LIBCONFIG_DIR[]$1-config.in"
|
||||
AC_SUBST(target)dnl
|
||||
AC_SUBST(host)dnl
|
||||
AC_SUBST(build)dnl
|
||||
dnl create directory if it does not preexist
|
||||
m4_if([$2], , , [AS_MKDIR_P([$2])])
|
||||
AC_MSG_NOTICE([creating $LIBCONFIG_FILE])
|
||||
echo '#! /bin/sh' >$LIBCONFIG_FILE
|
||||
echo "# $1-config library configuration script" >>$LIBCONFIG_FILE
|
||||
echo '# generated by ac_config_libconfig_in.m4' >>$LIBCONFIG_FILE
|
||||
echo ' ' >>$LIBCONFIG_FILE
|
||||
echo 'template_version="1.0.0"' >>$LIBCONFIG_FILE
|
||||
echo ' ' >>$LIBCONFIG_FILE
|
||||
echo 'package="@PACKAGE@"' >>$LIBCONFIG_FILE
|
||||
echo ' ' >>$LIBCONFIG_FILE
|
||||
echo '# usage instructions if no options given' >>$LIBCONFIG_FILE
|
||||
echo 'if test "'"\$""#"'" -eq 0; then' >>$LIBCONFIG_FILE
|
||||
echo ' cat <<EOF' >>$LIBCONFIG_FILE
|
||||
m4_if($3, ,
|
||||
[echo 'Usage: $1-config [[OPTIONS]]' >>$LIBCONFIG_FILE],
|
||||
[echo 'Usage: $1-config [[OPTIONS]] [[LIBRARIES]]' >>$LIBCONFIG_FILE])
|
||||
echo 'Options:' >>$LIBCONFIG_FILE
|
||||
echo ' [[--prefix[=DIR]]]' >>$LIBCONFIG_FILE
|
||||
echo ' [[--exec-prefix[=DIR]]]' >>$LIBCONFIG_FILE
|
||||
echo ' [[--package]]' >>$LIBCONFIG_FILE
|
||||
echo ' [[--version]]' >>$LIBCONFIG_FILE
|
||||
echo ' [[--cppflags]]' >>$LIBCONFIG_FILE
|
||||
echo ' [[--cflags-only]]' >>$LIBCONFIG_FILE
|
||||
echo ' [[--cflags]]' >>$LIBCONFIG_FILE
|
||||
echo ' [[--libs]]' >>$LIBCONFIG_FILE
|
||||
echo ' [[--help]]' >>$LIBCONFIG_FILE
|
||||
m4_if($3, , ,
|
||||
[echo 'Libraries:' >>$LIBCONFIG_FILE
|
||||
for module in $1 $3 ; do
|
||||
echo " $module" >>$LIBCONFIG_FILE ;
|
||||
done])
|
||||
echo 'EOF' >>$LIBCONFIG_FILE
|
||||
echo 'fi' >>$LIBCONFIG_FILE
|
||||
echo ' ' >>$LIBCONFIG_FILE
|
||||
echo '# parse options' >>$LIBCONFIG_FILE
|
||||
echo 'o=""' >>$LIBCONFIG_FILE
|
||||
echo 'h=""' >>$LIBCONFIG_FILE
|
||||
echo 'for i' >>$LIBCONFIG_FILE
|
||||
echo 'do' >>$LIBCONFIG_FILE
|
||||
echo ' case $i in' >>$LIBCONFIG_FILE
|
||||
options="prefix exec-prefix eprefix package version cppflags cflags-only cflags libs bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir infodir mandir target host build pkgdatadir pkglibdir pkgincludedir template-version help"
|
||||
echo ' --prefix=*) prefix=`echo $i | sed -e "s/--prefix=//"` ;;' >>$LIBCONFIG_FILE
|
||||
echo ' --exec-prefix=*) exec_prefix=`echo $i | sed -e "s/--exec-prefix=//"` ;;' >>$LIBCONFIG_FILE
|
||||
echo ' --eprefix=*) exec_prefix=`echo $i | sed -e "s/--eprefix=//"` ;;' >>$LIBCONFIG_FILE
|
||||
for option in $options ; do
|
||||
case $option in
|
||||
exec-prefix) echo " --$option) echo_exec_prefix=\"yes\" ;;" >>$LIBCONFIG_FILE ;;
|
||||
template-version) echo " --$option) echo_template_version=\"yes\" ;;" >>$LIBCONFIG_FILE ;;
|
||||
cflags-only) echo " --$option) echo_cflags_only=\"yes\" ;;" >>$LIBCONFIG_FILE ;;
|
||||
*) echo " --$option) echo_$option=\"yes\" ;;" >>$LIBCONFIG_FILE ;;
|
||||
esac
|
||||
done
|
||||
m4_if($3, , ,
|
||||
[for module in $1 $3 ; do
|
||||
echo " $module) echo_module_$module=\"yes\" ;" >>$LIBCONFIG_FILE ;
|
||||
echo ' echo_module="yes" ;;' >>$LIBCONFIG_FILE ;
|
||||
done])
|
||||
echo ' //*|/*//*|./*//*) echo_extra="yes" ;;' >>$LIBCONFIG_FILE
|
||||
echo ' *) eval "echo Unknown option: $i" ; exit 1 ;;' >>$LIBCONFIG_FILE
|
||||
echo ' esac' >>$LIBCONFIG_FILE
|
||||
echo 'done' >>$LIBCONFIG_FILE
|
||||
echo ' ' >>$LIBCONFIG_FILE
|
||||
# in the order of occurence a standard automake Makefile
|
||||
echo '# defaults from configure; set only if not set previously' >>$LIBCONFIG_FILE
|
||||
vars="prefix exec_prefix bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir infodir mandir includedir target host build"
|
||||
for var in $vars ; do
|
||||
echo "if test -z \"\$$var\" ; then" >>$LIBCONFIG_FILE
|
||||
echo " $var=\"@$var@\"" >>$LIBCONFIG_FILE
|
||||
echo 'fi' >>$LIBCONFIG_FILE
|
||||
done
|
||||
echo ' ' >>$LIBCONFIG_FILE
|
||||
echo '# generate output' >>$LIBCONFIG_FILE
|
||||
echo 'if test x$echo_module != xyes ; then' >>$LIBCONFIG_FILE
|
||||
echo ' echo_module_$1="yes"' >>$LIBCONFIG_FILE
|
||||
echo 'fi' >>$LIBCONFIG_FILE
|
||||
AC_CONFIG_LIBCONFIG_IN_MODULES(m4_if([$3], , [$1], [m4_translit([$1 $3], [ ], [,])]))dnl
|
||||
for option in $options extra; do
|
||||
case $option in
|
||||
exec-prefix) echo "if test x\$echo_exec_prefix = xyes ; then" >>$LIBCONFIG_FILE ;;
|
||||
template-version) echo "if test x\$echo_template_version = xyes ; then" >>$LIBCONFIG_FILE ;;
|
||||
cflags-only) echo "if test x\$echo_cflags_only = xyes ; then" >>$LIBCONFIG_FILE ;;
|
||||
*) echo "if test x\$echo_$option = xyes ; then" >>$LIBCONFIG_FILE ;;
|
||||
esac
|
||||
case $option in
|
||||
exec-prefix | eprefix) echo ' o="$o $exec_prefix"' >>$LIBCONFIG_FILE ;;
|
||||
template-version) echo ' o="$o $template_version"' >>$LIBCONFIG_FILE ;;
|
||||
cflags-only) echo ' o="$o $cflags"' >>$LIBCONFIG_FILE ;;
|
||||
cppflags) echo ' o="$o $cppflags"' >>$LIBCONFIG_FILE ;;
|
||||
cflags)
|
||||
# echo ' i=`eval echo "$includedir"`' >>$LIBCONFIG_FILE ;
|
||||
# echo ' i=`eval echo "$i"`' >>$LIBCONFIG_FILE ;
|
||||
# echo ' if test "_$i" != "_/usr/include" ; then' >>$LIBCONFIG_FILE ;
|
||||
# echo ' o="$o -I$includedir"' >>$LIBCONFIG_FILE ;
|
||||
# echo ' fi' >>$LIBCONFIG_FILE ;
|
||||
echo ' o="$o $cppflags $cflags"' >>$LIBCONFIG_FILE ;;
|
||||
libs) echo ' o="$o -L$libdir $libs"' >>$LIBCONFIG_FILE ;;
|
||||
help) echo ' h="1"' >>$LIBCONFIG_FILE ;;
|
||||
pkgdatadir) echo " o=\"$o \${datadir}/\${package}\"" >>$LIBCONFIG_FILE ;;
|
||||
pkglibdir) echo " o=\"$o \${libdir}/\${package}\"" >>$LIBCONFIG_FILE ;;
|
||||
pkgincludedir) echo " o=\"$o \${includedir}/\${package}\"" >>$LIBCONFIG_FILE ;;
|
||||
extra)
|
||||
echo ' v=`echo $i | sed -e s://:\$:g`' >>$LIBCONFIG_FILE ;
|
||||
echo ' v=`eval "echo $v"`' >>$LIBCONFIG_FILE ;
|
||||
echo ' o="$o $v"' >>$LIBCONFIG_FILE ;;
|
||||
*) echo " o=\"$o \$$option\"" >>$LIBCONFIG_FILE
|
||||
esac
|
||||
echo 'fi' >>$LIBCONFIG_FILE
|
||||
done
|
||||
echo ' ' >>$LIBCONFIG_FILE
|
||||
echo '# output data' >>$LIBCONFIG_FILE
|
||||
echo 'o=`eval "echo $o"`' >>$LIBCONFIG_FILE
|
||||
echo 'o=`eval "echo $o"`' >>$LIBCONFIG_FILE
|
||||
echo 'if test -n "$o" ; then ' >>$LIBCONFIG_FILE
|
||||
echo ' eval "echo $o"' >>$LIBCONFIG_FILE
|
||||
echo 'fi' >>$LIBCONFIG_FILE
|
||||
echo ' ' >>$LIBCONFIG_FILE
|
||||
echo '# help text' >>$LIBCONFIG_FILE
|
||||
echo 'if test ! -z "$h" ; then ' >>$LIBCONFIG_FILE
|
||||
echo ' cat <<EOF' >>$LIBCONFIG_FILE
|
||||
echo 'All available options:' >>$LIBCONFIG_FILE
|
||||
echo ' --prefix=DIR and change \$prefix and \$exec-prefix' >>$LIBCONFIG_FILE
|
||||
echo ' --exec-prefix=DIR (affects all other options)' >>$LIBCONFIG_FILE
|
||||
echo ' --prefix \$prefix $prefix' >>$LIBCONFIG_FILE
|
||||
echo ' --exec_prefix or... ' >>$LIBCONFIG_FILE
|
||||
echo ' --eprefix \$exec_prefix $exec_prefix' >>$LIBCONFIG_FILE
|
||||
echo ' --version \$version $version' >>$LIBCONFIG_FILE
|
||||
echo ' --cppflags C preprocessor flags' >>$LIBCONFIG_FILE
|
||||
echo ' --cflags-only C compiler flags' >>$LIBCONFIG_FILE
|
||||
echo ' --cflags C preprocessor and compiler flags' >>$LIBCONFIG_FILE
|
||||
echo ' --libs -L\$libdir \$LIBS $libs' >>$LIBCONFIG_FILE
|
||||
echo ' --package \$package $package' >>$LIBCONFIG_FILE
|
||||
echo ' --bindir \$bindir $bindir' >>$LIBCONFIG_FILE
|
||||
echo ' --sbindir \$sbindir $sbindir' >>$LIBCONFIG_FILE
|
||||
echo ' --libexecdir \$libexecdir $libexecdir' >>$LIBCONFIG_FILE
|
||||
echo ' --datadir \$datadir $datadir' >>$LIBCONFIG_FILE
|
||||
echo ' --sysconfdir \$sysconfdir $sysconfdir' >>$LIBCONFIG_FILE
|
||||
echo ' --sharedstatedir \$sharedstatedir$sharedstatedir' >>$LIBCONFIG_FILE
|
||||
echo ' --localstatedir \$localstatedir $localstatedir' >>$LIBCONFIG_FILE
|
||||
echo ' --libdir \$libdir $libdir' >>$LIBCONFIG_FILE
|
||||
echo ' --infodir \$infodir $infodir' >>$LIBCONFIG_FILE
|
||||
echo ' --mandir \$mandir $mandir' >>$LIBCONFIG_FILE
|
||||
echo ' --target \$target $target' >>$LIBCONFIG_FILE
|
||||
echo ' --host \$host $host' >>$LIBCONFIG_FILE
|
||||
echo ' --build \$build $build' >>$LIBCONFIG_FILE
|
||||
echo ' --pkgdatadir \$datadir/\$package ${datadir}/${package}' >>$LIBCONFIG_FILE
|
||||
echo ' --pkglibdir \$libdir/\$package ${libdir}/${package}' >>$LIBCONFIG_FILE
|
||||
echo ' --pkgincludedir \$includedir/\$package ${includedir}/${package}' >>$LIBCONFIG_FILE
|
||||
echo ' --template-version \$template_version $template_version' >>$LIBCONFIG_FILE
|
||||
echo ' --help' >>$LIBCONFIG_FILE
|
||||
echo 'EOF' >>$LIBCONFIG_FILE
|
||||
echo 'fi' >>$LIBCONFIG_FILE
|
||||
m4_pushdef([LIBCONFIG_UP], [m4_translit([$1], [a-z], [A-Z])])dnl
|
||||
LIBCONFIG_UP[]_CONFIG="LIBCONFIG_DIR[]$1-config"
|
||||
AC_SUBST(LIBCONFIG_UP[]_CONFIG)
|
||||
dnl AC_CONFIG_FILES(LIBCONFIG_DIR[]$1[-config], [chmod +x ]LIBCONFIG_DIR[]$1[-config])
|
||||
m4_popdef([LIBCONFIG_DIR])
|
||||
m4_popdef([LIBCONFIG_UP])
|
||||
])
|
||||
|
||||
|
||||
# AC_CONFIG_LIBCONFIG_IN_MODULES [(MODULE1 [, MODULE2 [, ...]])]
|
||||
# --------------------------------------------------------------
|
||||
#Output shell script using custom module variables.
|
||||
AC_DEFUN([AC_CONFIG_LIBCONFIG_IN_MODULES],
|
||||
[m4_if([$1], , ,
|
||||
[# create module definition for $1
|
||||
dnl we're going to need uppercase, lowercase and user-friendly versions of the
|
||||
dnl string `MODULE'
|
||||
m4_pushdef([MODULE_UP], m4_translit([$1], [a-z], [A-Z]))dnl
|
||||
m4_pushdef([MODULE_DOWN], m4_translit([$1], [A-Z], [a-z]))dnl
|
||||
if test -z "$MODULE_DOWN[]_cppflags" ; then
|
||||
if test -n "$MODULE_UP[]_CPPFLAGS" ; then
|
||||
MODULE_DOWN[]_cppflags="$MODULE_UP[]_CPPFLAGS"
|
||||
else
|
||||
dnl AC_MSG_WARN([variable `MODULE_DOWN[]_cppflags' undefined])
|
||||
MODULE_DOWN[]_cppflags=''
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(MODULE_DOWN[]_cppflags)
|
||||
if test -z "$MODULE_DOWN[]_cflags" ; then
|
||||
if test -n "$MODULE_UP[]_CFLAGS" ; then
|
||||
MODULE_DOWN[]_cflags="$MODULE_UP[]_CFLAGS"
|
||||
else
|
||||
dnl AC_MSG_WARN([variable `MODULE_DOWN[]_cflags' undefined])
|
||||
MODULE_DOWN[]_cflags=''
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(MODULE_DOWN[]_cflags)dnl
|
||||
if test -z "$MODULE_DOWN[]_libs" ; then
|
||||
if test -n "$MODULE_UP[]_LIBS" ; then
|
||||
MODULE_DOWN[]_libs="$MODULE_UP[]_LIBS"
|
||||
else
|
||||
AC_MSG_WARN([variable `MODULE_DOWN[]_libs' and `MODULE_UP[]_LIBS' undefined])
|
||||
MODULE_DOWN[]_libs='-l$1'
|
||||
fi
|
||||
if test -n "$MODULE_UP[]_LIBDEPS" ; then
|
||||
MODULE_DOWN[]_libs="$MODULE_DOWN[]_libs $MODULE_UP[]_LIBDEPS"
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(MODULE_DOWN[]_libs)dnl
|
||||
if test -z "$MODULE_UP[]_VERSION" ; then
|
||||
AC_MSG_WARN([variable `MODULE_UP[]_VERSION' undefined])
|
||||
MODULE_UP[]_VERSION="$VERSION"
|
||||
fi
|
||||
AC_SUBST(MODULE_UP[]_VERSION)dnl
|
||||
echo 'if test x$echo_module_$1 = xyes ; then' >>$LIBCONFIG_FILE
|
||||
AC_CONFIG_LIBCONFIG_IN_MODULES_VARS([cppflags], [MODULE_DOWN[]_cppflags], [cppflags])
|
||||
AC_CONFIG_LIBCONFIG_IN_MODULES_VARS([cflags], [MODULE_DOWN[]_cflags], [cflags])
|
||||
AC_CONFIG_LIBCONFIG_IN_MODULES_VARS([libs], [MODULE_DOWN[]_libs], [libs])
|
||||
AC_CONFIG_LIBCONFIG_IN_MODULES_VARS([version], [MODULE_UP[]_VERSION], [modversion])
|
||||
echo 'fi' >>$LIBCONFIG_FILE
|
||||
m4_popdef([MODULE_UP])dnl
|
||||
m4_popdef([MODULE_DOWN])dnl
|
||||
AC_CONFIG_LIBCONFIG_IN_MODULES(m4_shift($@))])dnl
|
||||
])
|
||||
|
||||
|
||||
# AC_CONFIG_LIBCONFIG_IN_MODULES_VARS [(VAR, SUBSTITUTION,
|
||||
# PKGCONFIG_ARGS)]
|
||||
# --------------------------------------------------------
|
||||
# Output AC_CONFIG_LIBCONFIG_IN_MODULES variables.
|
||||
# VAR = variable to set
|
||||
# SUBSTITUTION = set if pkg-config is not available
|
||||
# PKGCONFIG_ARGS = args for pkg-config
|
||||
AC_DEFUN([AC_CONFIG_LIBCONFIG_IN_MODULES_VARS],
|
||||
[m4_if(AC_CONFIG_LIBCONFIG_IN_USEPKGCONFIG, [true],
|
||||
[
|
||||
echo 'if test -x "`which pkg-config`" ; then' >>$LIBCONFIG_FILE
|
||||
echo ' if pkg-config --atleast-pkgconfig-version=0.7 --exists "MODULE_DOWN"; then' >>$LIBCONFIG_FILE
|
||||
echo ' $1="@S|@$1 `pkg-config --$3 MODULE_DOWN`"' >>$LIBCONFIG_FILE
|
||||
echo ' fi' >>$LIBCONFIG_FILE
|
||||
echo 'else' >>$LIBCONFIG_FILE
|
||||
echo ' $1="@S|@$1 @$2@"' >>$LIBCONFIG_FILE
|
||||
echo 'fi' >>$LIBCONFIG_FILE
|
||||
],
|
||||
[echo ' $1="@S|@$1 @$2@"' >>$LIBCONFIG_FILE
|
||||
])])
|
||||
|
||||
|
||||
# AC_CONFIG_LIBCONFIG_IN_PKGCONFIG
|
||||
# --------------------------------
|
||||
# Enable pkgconfig support in libconfig script (default)
|
||||
AC_DEFUN([AC_CONFIG_LIBCONFIG_IN_PKGCONFIG],
|
||||
[m4_define([AC_CONFIG_LIBCONFIG_IN_USEPKGCONFIG], [true])
|
||||
])dnl
|
||||
|
||||
|
||||
# AC_CONFIG_LIBCONFIG_IN_STATIC
|
||||
# -----------------------------
|
||||
# Disable pkgconfig support in libconfig script
|
||||
AC_DEFUN([AC_CONFIG_LIBCONFIG_IN_STATIC],
|
||||
[m4_define([AC_CONFIG_LIBCONFIG_IN_USEPKGCONFIG], [false])
|
||||
])dnl
|
192
m4/acx_pthread.m4
Normal file
192
m4/acx_pthread.m4
Normal file
@ -0,0 +1,192 @@
|
||||
dnl Available from the GNU Autoconf Macro Archive at:
|
||||
dnl http://www.gnu.org/software/ac-archive/htmldoc/acx_pthread.html
|
||||
dnl
|
||||
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="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt"
|
||||
|
||||
# The ordering *is* (sometimes) important. Some notes on the
|
||||
# individual items follow:
|
||||
|
||||
# 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"
|
||||
;;
|
||||
|
||||
*)
|
||||
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.h>],
|
||||
[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 <pthread.h>],
|
||||
[int attr=PTHREAD_CREATE_JOINABLE;],
|
||||
ok=PTHREAD_CREATE_JOINABLE, ok=unknown)
|
||||
if test x"$ok" = xunknown; then
|
||||
AC_TRY_LINK([#include <pthread.h>],
|
||||
[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_CPPFLAGS="$flag $PTHREAD_CPPFLAGS"
|
||||
fi
|
||||
AC_CHECK_TYPES(pthread_rwlock_t,,,[#include <pthread.h>])
|
||||
|
||||
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_CPPFLAGS)
|
||||
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
|
55
m4/ogg.m4
Normal file
55
m4/ogg.m4
Normal file
@ -0,0 +1,55 @@
|
||||
# Configure paths for libogg
|
||||
# updated by Karl Heyes 10-Jun-2003
|
||||
# Jack Moffitt <jack@icecast.org> 10-21-2000
|
||||
# Shamelessly stolen from Owen Taylor and Manish Singh
|
||||
|
||||
dnl XIPH_PATH_OGG([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
||||
dnl Test for libogg, and define OGG_CFLAGS OGG_LDFLAGS and OGG_LIBS
|
||||
dnl
|
||||
AC_DEFUN([XIPH_PATH_OGG],
|
||||
[dnl
|
||||
AC_ARG_VAR([OGG_PREFIX],[path to ogg installation])
|
||||
AC_ARG_WITH(ogg,
|
||||
[AC_HELP_STRING([--with-ogg=PREFIX],
|
||||
[Prefix where libogg is installed (optional)])],
|
||||
ogg_prefix="$withval",
|
||||
ogg_prefix="$OGG_PREFIX"
|
||||
)
|
||||
if test "x$ogg_prefix" = "x"; then
|
||||
if test "x$prefix" = "xNONE"; then
|
||||
ogg_prefix=/usr/local
|
||||
else
|
||||
ogg_prefix="$prefix"
|
||||
fi
|
||||
fi
|
||||
|
||||
XIPH_GCC_WARNING([-I$ogg_prefix/include],,
|
||||
[OGG_CFLAGS="-I$ogg_prefix/include"
|
||||
OGG_LDFLAGS="-L$ogg_prefix/lib"
|
||||
])
|
||||
OGG_LIBS="-logg"
|
||||
|
||||
#
|
||||
# check if the installed Ogg is sufficiently new.
|
||||
#
|
||||
AC_MSG_CHECKING([for ogg_sync_init in libogg])
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
ac_save_LDFLAGS="$LDFLAGS"
|
||||
CFLAGS="$CFLAGS $OGG_CFLAGS"
|
||||
LIBS="$LIBS $OGG_LIBS"
|
||||
LDFLAGS="$LDFLAGS $OGG_LDFLAGS"
|
||||
AC_TRY_LINK_FUNC(ogg_sync_init,
|
||||
[ifelse([$1],, [AC_MSG_RESULT([ok])], [$1])],
|
||||
[AC_TRY_LINK([#include <ogg/ogg.h>],,
|
||||
[ ifelse([$2], ,[AC_MSG_ERROR([found, but needs updating])], [$2])],
|
||||
[ ifelse([$2], ,[AC_MSG_ERROR([not found, maybe you need to set LD_LIBRARY_PATH or /etc/ld.so.conf])], [$2])])
|
||||
])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LDFLAGS="$ac_save_LDFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
|
||||
AC_SUBST(OGG_CFLAGS)
|
||||
AC_SUBST(OGG_LDFLAGS)
|
||||
AC_SUBST(OGG_LIBS)
|
||||
])
|
79
m4/shout.m4
Normal file
79
m4/shout.m4
Normal file
@ -0,0 +1,79 @@
|
||||
dnl XIPH_PATH_SHOUT
|
||||
dnl Jack Moffitt <jack@icecast.org> 08-06-2001
|
||||
dnl Rewritten for libshout 2
|
||||
dnl Brendan Cully <brendan@xiph.org> 20030612
|
||||
dnl
|
||||
dnl $Id: shout.m4,v 1.1 2004/01/30 17:19:56 oddsock Exp $
|
||||
|
||||
# XIPH_PATH_SHOUT([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
||||
# Test for libshout, and define SHOUT_CPPFLAGS SHOUT_CFLAGS SHOUT_LIBS, and
|
||||
# SHOUT_THREADSAFE
|
||||
AC_DEFUN([XIPH_PATH_SHOUT],
|
||||
[dnl
|
||||
xt_have_shout="no"
|
||||
SHOUT_THREADSAFE="no"
|
||||
SHOUT_CPPFLAGS=""
|
||||
SHOUT_CFLAGS=""
|
||||
SHOUT_LIBS=""
|
||||
|
||||
# NB: PKG_CHECK_MODULES exits if pkg-config is unavailable on the targe
|
||||
# system, so we can't use it.
|
||||
|
||||
# seed pkg-config with the default libshout location
|
||||
PKG_CONFIG_PATH=${PKG_CONFIG_PATH:-/usr/local/lib/pkgconfig}
|
||||
export PKG_CONFIG_PATH
|
||||
|
||||
# Step 1: Use pkg-config if available
|
||||
AC_PATH_PROG([PKGCONFIG], [pkg-config], [no])
|
||||
if test "$PKGCONFIG" != "no" && `$PKGCONFIG --exists shout`
|
||||
then
|
||||
SHOUT_CFLAGS=`$PKGCONFIG --variable=cflags_only shout`
|
||||
SHOUT_CPPFLAGS=`$PKGCONFIG --variable=cppflags shout`
|
||||
SHOUT_LIBS=`$PKGCONFIG --libs shout`
|
||||
xt_have_shout="maybe"
|
||||
else
|
||||
if test "$PKGCONFIG" != "no"
|
||||
then
|
||||
AC_MSG_NOTICE([$PKGCONFIG couldn't find libshout. Try adjusting PKG_CONFIG_PATH.])
|
||||
fi
|
||||
# pkg-config unavailable, try shout-config
|
||||
AC_PATH_PROG([SHOUTCONFIG], [shout-config], [no])
|
||||
if test "$SHOUTCONFIG" != "no" && test `$SHOUTCONFIG --package` = "libshout"
|
||||
then
|
||||
SHOUT_CPPFLAGS=`$SHOUTCONFIG --cppflags`
|
||||
SHOUT_CFLAGS=`$SHOUTCONFIG --cflags-only`
|
||||
SHOUT_LIBS=`$SHOUTCONFIG --libs`
|
||||
xt_have_shout="maybe"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Now try actually using libshout
|
||||
if test "$xt_have_shout" != "no"
|
||||
then
|
||||
ac_save_CPPFLAGS="$CPPFLAGS"
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CPPFLAGS="$CPPFLAGS $SHOUT_CPPFLAGS"
|
||||
CFLAGS="$CFLAGS $SHOUT_CFLAGS"
|
||||
LIBS="$SHOUT_LIBS $LIBS"
|
||||
AC_CHECK_HEADERS([shout/shout.h], [
|
||||
AC_CHECK_FUNC([shout_new], [
|
||||
ifelse([$1], , :, [$1])
|
||||
xt_have_shout="yes"
|
||||
])
|
||||
AC_EGREP_CPP([yes], [#include <shout/shout.h>
|
||||
#if SHOUT_THREADSAFE
|
||||
yes
|
||||
#endif
|
||||
], [SHOUT_THREADSAFE="yes"])
|
||||
])
|
||||
CPPFLAGS="$ac_save_CPPFLAGS"
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
|
||||
if test "$xt_have_shout" != "yes"
|
||||
then
|
||||
ifelse([$2], , :, [$2])
|
||||
fi
|
||||
])dnl XIPH_PATH_SHOUT
|
82
m4/vorbis.m4
Normal file
82
m4/vorbis.m4
Normal file
@ -0,0 +1,82 @@
|
||||
# Configure paths for libvorbis
|
||||
# Jack Moffitt <jack@icecast.org> 10-21-2000
|
||||
# updated by Karl Heyes 31-Mar-2003
|
||||
# Shamelessly stolen from Owen Taylor and Manish Singh
|
||||
|
||||
dnl XIPH_PATH_VORBIS([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
||||
dnl Test for libvorbis, and define VORBIS_CFLAGS VORBIS_LIBS
|
||||
dnl VORBIS_VORBISENC_LIBS VORBIS_VORBISFILE_LIBS VORBIS_LDFLAGS
|
||||
dnl
|
||||
|
||||
AC_DEFUN([XIPH_PATH_VORBIS],
|
||||
[
|
||||
XIPH_PATH_OGG([$1],[$2])
|
||||
|
||||
dnl Get the cflags and libraries for vorbis
|
||||
dnl
|
||||
AC_ARG_VAR([VORBIS_PREFIX],[path to vorbis installation])
|
||||
AC_ARG_WITH(vorbis,
|
||||
AC_HELP_STRING([--with-vorbis=PREFIX],
|
||||
[Prefix where libvorbis is installed (optional)]),
|
||||
vorbis_prefix="$withval",
|
||||
vorbis_prefix="$VORBIS_PREFIX"
|
||||
)
|
||||
if test "x$vorbis_prefix" = "x"; then
|
||||
if test "x$prefix" = "xNONE"; then
|
||||
vorbis_prefix="/usr/local"
|
||||
else
|
||||
vorbis_prefix="$prefix"
|
||||
fi
|
||||
fi
|
||||
|
||||
VORBIS_CFLAGS="$OGG_CFLAGS"
|
||||
VORBIS_LDFLAGS="$OGG_LDFLAGS"
|
||||
if test "x$vorbis_prefix" != "x$ogg_prefix"; then
|
||||
XIPH_GCC_WARNING(-I"$vorbis_prefix/include",,
|
||||
[VORBIS_CFLAGS="$VORBIS_CFLAGS -I$vorbis_prefix/include"
|
||||
VORBIS_LDFLAGS="-L$vorbis_prefix/lib $VORBIS_LDFLAGS"
|
||||
])
|
||||
fi
|
||||
|
||||
VORBIS_LIBS="-lvorbis"
|
||||
VORBISFILE_LIBS="-lvorbisfile"
|
||||
VORBISENC_LIBS="-lvorbisenc"
|
||||
|
||||
ac_save_LIBS="$LIBS"
|
||||
ac_save_LDFLAGS="$LDFLAGS"
|
||||
LDFLAGS="$LDFLAGS $VORBIS_LDFLAGS"
|
||||
LIBS="$LIBS $VORBIS_LIBS"
|
||||
AC_MSG_CHECKING([for libvorbis])
|
||||
AC_TRY_LINK_FUNC(vorbis_info_init, [AC_MSG_RESULT([ok])],
|
||||
[LIBS="$LIBS $OGG_LIBS -lm"
|
||||
AC_TRY_LINK_FUNC(vorbis_info_init,
|
||||
[AC_MSG_RESULT([found, adding extra libs])
|
||||
VORBIS_LIBS="$VORBIS_LIBS $OGG_LIBS -lm"],
|
||||
[ifelse([$2], , AC_MSG_ERROR([Unable to link to libvorbis]), [$2])
|
||||
])
|
||||
])
|
||||
|
||||
LIBS="$ac_save_LIBS"
|
||||
LDFLAGS="$ac_save_LDFLAGS"
|
||||
|
||||
#
|
||||
# Now check if the installed Vorbis is sufficiently new.
|
||||
#
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $VORBIS_CFLAGS"
|
||||
LIBS="$LIBS $VORBIS_LDFLAGS $VORBIS_LIBS"
|
||||
|
||||
AC_CHECK_TYPES([struct ovectl_ratemanage_arg],[vorbis_ok=yes],
|
||||
[ifelse([$2], ,[AC_MSG_ERROR([libvorbis needs updating])], [$2])], [
|
||||
#include <vorbis/codec.h>
|
||||
#include <vorbis/vorbisenc.h>
|
||||
])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
AC_SUBST(VORBIS_CFLAGS)
|
||||
AC_SUBST(VORBIS_LDFLAGS)
|
||||
AC_SUBST(VORBIS_LIBS)
|
||||
AC_SUBST(VORBISFILE_LIBS)
|
||||
AC_SUBST(VORBISENC_LIBS)
|
||||
])
|
168
m4/xiph_compiler.m4
Normal file
168
m4/xiph_compiler.m4
Normal file
@ -0,0 +1,168 @@
|
||||
dnl xiph_compiler.m4
|
||||
dnl $Id: xiph_compiler.m4,v 1.1 2004/01/30 17:19:56 oddsock Exp $
|
||||
|
||||
dnl XIPH_FUNC_VA_COPY
|
||||
dnl Karl Heyes
|
||||
dnl
|
||||
# XIPH_FUNC_VA_COPY
|
||||
# Test for implementation of va_copy, or define appropriately if missing
|
||||
AC_DEFUN([XIPH_FUNC_VA_COPY],
|
||||
[dnl
|
||||
AC_MSG_CHECKING([for va_copy])
|
||||
AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; va_copy(ap1, ap2);],
|
||||
AC_MSG_RESULT([va_copy]),
|
||||
[dnl
|
||||
AH_TEMPLATE([va_copy], [define if va_copy is not available])
|
||||
AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; __va_copy(ap1, ap2);],
|
||||
[dnl
|
||||
AC_DEFINE([va_copy], [__va_copy])
|
||||
AC_MSG_RESULT([__va_copy])],
|
||||
[dnl
|
||||
AC_DEFINE([va_copy(dest,src)], [memcpy(&dest,&src,sizeof(va_list))])
|
||||
AC_MSG_RESULT([memcpy])
|
||||
])
|
||||
])
|
||||
])
|
||||
])dnl XIPH_FUNC_VA_COPY
|
||||
|
||||
dnl XIPH_C_ATTRIBUTE
|
||||
dnl Karl Heyes
|
||||
dnl
|
||||
# XIPH_C_ATTRIBUTE
|
||||
# Define __attribute__ to be empty if the compiler does not support it
|
||||
AC_DEFUN([XIPH_C_ATTRIBUTE],
|
||||
[dnl
|
||||
AC_TRY_COMPILE([int func(void) __attribute__((unused));],
|
||||
[int x __attribute__ ((unused));],,[dnl
|
||||
AC_DEFINE([__attribute__(x)],, [Define to empty if __attribute__ is not supported])
|
||||
])
|
||||
])dnl XIPH_C_ATTRIBUTE
|
||||
|
||||
dnl XIPH_GCC_WARNING
|
||||
dnl Karl Heyes
|
||||
dnl
|
||||
# XIPH_GCC_WARNING(flag, action-if-warning, action-if-not)
|
||||
# Tests whether GCC emits a warning if explicitly asked to use flag.
|
||||
# Useful for eg system default include paths
|
||||
AC_DEFUN([XIPH_GCC_WARNING],
|
||||
[AC_REQUIRE([AC_PROG_CC])
|
||||
xt_warning=no
|
||||
if test x"$GCC" = "xyes"
|
||||
then
|
||||
save_cflags="$CFLAGS"
|
||||
CFLAGS="-Werror $1"
|
||||
AC_TRY_COMPILE(,,,xt_warning=yes)
|
||||
CFLAGS="$save_cflags"
|
||||
fi
|
||||
if test "$xt_warning" = "yes"
|
||||
then
|
||||
ifelse([$2],,:,[$2])
|
||||
else
|
||||
ifelse([$3],,:,[$3])
|
||||
fi
|
||||
])dnl XIPH_GCC_WARNING
|
||||
|
||||
dnl XIPH_CLEAN_CCFLAGS
|
||||
dnl Brendan Cully <brendan@xiph.org> 20030612
|
||||
dnl
|
||||
# XIPH_CLEAN_CCFLAGS(flag-list, dest-shell-var-name)
|
||||
# Filters out duplicate compiler flags, and -I flags if XIPH_GCC_WARNING
|
||||
# complains about them
|
||||
# Operates right-to-left on -l flags, left-to-right on everything else
|
||||
# eg XIPH_CLEAN_CCFLAGS([-L/opt/lib -lfoo -lm -L/opt/lib -lbar -lm], [MY_LDFLAGS])
|
||||
# => MY_LDFLAGS="-L/opt/lib -lfoo -lbar -lm"
|
||||
# the cat<<EOF construct makes sure echo doesn't pick, say, -n
|
||||
AC_DEFUN([XIPH_CLEAN_CCFLAGS],
|
||||
[AC_REQUIRE([AC_PROG_FGREP])
|
||||
xt_FLAGS=''
|
||||
|
||||
for flag in $1
|
||||
do
|
||||
case "$flag" in
|
||||
-l*)
|
||||
xt_FLAGS="$flag $xt_FLAGS"
|
||||
;;
|
||||
*)
|
||||
if { cat <<EOF
|
||||
$xt_FLAGS x
|
||||
EOF
|
||||
} | $FGREP -v -e " $flag " > /dev/null
|
||||
then
|
||||
xt_FLAGS="$flag $xt_FLAGS"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
$2=''
|
||||
for flag in $xt_FLAGS
|
||||
do
|
||||
if { cat <<EOF
|
||||
$$2 x
|
||||
EOF
|
||||
} | $FGREP -v -e " $flag " > /dev/null
|
||||
then
|
||||
$2="$flag $$2"
|
||||
fi
|
||||
done
|
||||
|
||||
# Prune -I flags if $CC warns about them
|
||||
xt_FLAGS=''
|
||||
for flag in $$2
|
||||
do
|
||||
case "$flag" in
|
||||
-I*)
|
||||
XIPH_GCC_WARNING([$flag], [], [xt_FLAGS="$xt_FLAGS $flag"])
|
||||
;;
|
||||
*)
|
||||
xt_FLAGS="$xt_FLAGS $flag"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
$2="$xt_FLAGS"
|
||||
])dnl XIPH_CLEAN_CCFLAGS
|
||||
|
||||
dnl XIPH_VAR_APPEND
|
||||
dnl Karl Heyes
|
||||
dnl
|
||||
# XIPH_VAR_APPEND(shell-var, list)
|
||||
# Append each item in list to shell-var iff shell-var doesn't already have it
|
||||
# eg XIPH_VAR_APPEND([CFLAGS], [-O2 -I/opt/packages/include])
|
||||
AC_DEFUN([XIPH_VAR_APPEND],
|
||||
[dnl
|
||||
AC_REQUIRE([AC_PROG_FGREP])
|
||||
for arg in $2
|
||||
do
|
||||
if { cat <<EOF
|
||||
$$1 x
|
||||
EOF
|
||||
} | $FGREP -v -e " $arg " > /dev/null
|
||||
then
|
||||
$1="$$1 $arg"
|
||||
fi
|
||||
done
|
||||
])dnl XIPH_VAR_APPEND
|
||||
|
||||
dnl XIPH_VAR_PREPEND
|
||||
dnl Karl Heyes
|
||||
dnl
|
||||
# XIPH_VAR_PREPEND(shell-var, list)
|
||||
# see XIPH_VAR_APPEND
|
||||
AC_DEFUN([XIPH_VAR_PREPEND],
|
||||
[dnl
|
||||
AC_REQUIRE([AC_PROG_FGREP])
|
||||
xt_compare="$$1"
|
||||
xt_filtered=""
|
||||
for arg in $2
|
||||
do
|
||||
if { cat <<EOF
|
||||
$xt_compare x
|
||||
EOF
|
||||
} | $FGREP -v -e " $arg " > /dev/null
|
||||
then
|
||||
xt_compare="$arg $xt_compare"
|
||||
xt_filtered="$xt_filtered $arg"
|
||||
fi
|
||||
done
|
||||
$1="$xt_filtered $$1"
|
||||
])dnl XIPH_VAR_PREPEND
|
67
m4/xiph_curl.m4
Normal file
67
m4/xiph_curl.m4
Normal file
@ -0,0 +1,67 @@
|
||||
dnl XIPH_PATH_CURL([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
||||
dnl Test for libcurl, and define CURL_CFLAGS and CURL_LIBS
|
||||
dnl
|
||||
AC_DEFUN(XIPH_PATH_CURL,
|
||||
[dnl
|
||||
dnl Get the cflags and libraries
|
||||
dnl
|
||||
AC_ARG_WITH(curl,
|
||||
AC_HELP_STRING([--with-curl=PFX],[Prefix where libcurl is installed (optional)]),
|
||||
curl_prefix="$withval", curl_prefix="")
|
||||
AC_ARG_WITH(curl-config,
|
||||
AC_HELP_STRING([--with-curl-config=curl-config],[Use curl-config to find libcurl]),
|
||||
CURL_CONFIG="$withval", [AC_PATH_PROGS(CURL_CONFIG, [curl-config], "")])
|
||||
|
||||
if test "x$curl_prefix" != "x"; then
|
||||
CURL_LIBS="-L$curl_prefix/lib -lcurl"
|
||||
CURL_CFLAGS="-I$curl_prefix/include"
|
||||
elif test "x$CURL_CONFIG" != "x"; then
|
||||
if ! test -x "$CURL_CONFIG"; then
|
||||
AC_MSG_ERROR([$CURL_CONFIG cannot be executed])
|
||||
fi
|
||||
CURL_LIBS="$($CURL_CONFIG --libs)"
|
||||
CURL_CFLAGS="$($CURL_CONFIG --cflags)"
|
||||
else
|
||||
if test "x$prefix" = "xNONE"; then
|
||||
curl_prefix="/usr/local"
|
||||
else
|
||||
curl_prefix="$prefix"
|
||||
fi
|
||||
CURL_LIBS="-L$curl_prefix/lib -lcurl"
|
||||
CURL_CFLAGS="-I$curl_prefix/include"
|
||||
fi
|
||||
|
||||
curl_ok="yes"
|
||||
|
||||
xt_curl_CPPFLAGS="$CPPFLAGS"
|
||||
xt_curl_LIBS="$LIBS"
|
||||
CPPFLAGS="$CPPFLAGS $CURL_CFLAGS"
|
||||
LIBS="$CURL_LIBS $LIBS"
|
||||
dnl
|
||||
dnl Now check if the installed libcurl is sufficiently new.
|
||||
dnl
|
||||
AC_CHECK_HEADERS([curl/curl.h],, curl_ok="no")
|
||||
AC_MSG_CHECKING(for libcurl)
|
||||
if test "$curl_ok" = "yes"
|
||||
then
|
||||
AC_RUN_IFELSE(AC_LANG_SOURCE([
|
||||
#include <curl/curl.h>
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
]),,[curl_ok="no"])
|
||||
fi
|
||||
if test "$curl_ok" = "yes"; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_CURL, 1, [Define if you have libcurl.])
|
||||
ifelse([$1], , :, [$1])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
CURL_LIBS=""
|
||||
CURL_CFLAGS=""
|
||||
ifelse([$2], , :, [$2])
|
||||
fi
|
||||
CPPFLAGS="$xt_curl_CPPFLAGS"
|
||||
LIBS="$xt_curl_LIBS"
|
||||
])
|
26
m4/xiph_net.m4
Normal file
26
m4/xiph_net.m4
Normal file
@ -0,0 +1,26 @@
|
||||
# XIPH_NET
|
||||
# Perform tests required by the net module
|
||||
AC_DEFUN([XIPH_NET],
|
||||
[dnl
|
||||
AC_REQUIRE([XIPH_TYPE_SOCKLEN_T])
|
||||
AC_REQUIRE([XIPH_FUNC_VA_COPY])
|
||||
AC_CHECK_HEADERS([sys/select.h sys/uio.h])
|
||||
AC_CHECK_HEADER([winsock2.h],
|
||||
[AC_DEFINE([HAVE_WINSOCK2_H], [1], [Define if you have winsock2.h on MINGW])
|
||||
LIBS="$LIBS -lwsock32"])
|
||||
|
||||
# These tests are ordered based on solaris 8 tests
|
||||
AC_SEARCH_LIBS([sethostent], [nsl],
|
||||
[AC_DEFINE([HAVE_SETHOSTENT], [1],
|
||||
[Define if you have the sethostent function])])
|
||||
AC_SEARCH_LIBS([getnameinfo], [socket],
|
||||
[AC_DEFINE([HAVE_GETNAMEINFO], [1],
|
||||
[Define if you have the getnameinfo function])])
|
||||
AC_CHECK_FUNCS([endhostent getaddrinfo inet_aton writev])
|
||||
|
||||
# Irix defines INET_PTON but not sockaddr_storage!
|
||||
AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family],
|
||||
[AC_CHECK_FUNCS([inet_pton])],,
|
||||
[#include <sys/types.h>
|
||||
#include <sys/socket.h>])
|
||||
])
|
73
m4/xiph_path_python.m4
Normal file
73
m4/xiph_path_python.m4
Normal file
@ -0,0 +1,73 @@
|
||||
dnl local M4 configure macros
|
||||
dnl Brendan Cully <brendan@xiph.org>
|
||||
dnl $Id: xiph_path_python.m4,v 1.1 2004/01/30 17:19:57 oddsock Exp $
|
||||
|
||||
# XIPH_PATH_PYTHON(PATH)
|
||||
# Search for python in PATH, or in the path if none is given.
|
||||
# Defines PYTHON_CPPFLAGS and PYTHON_LIBS if found
|
||||
AC_DEFUN([XIPH_PATH_PYTHON],
|
||||
[
|
||||
m4_pushdef([xpp_path], [$1])
|
||||
|
||||
PYTHON="no"
|
||||
|
||||
if test "xpp_path" != "yes"
|
||||
then
|
||||
AC_MSG_CHECKING([python])
|
||||
if test -x "xpp_path"
|
||||
then
|
||||
PYTHON="xpp_path"
|
||||
fi
|
||||
AC_MSG_RESULT([$PYTHON])
|
||||
else
|
||||
AC_PATH_PROGS([PYTHON], [python python2 python2.3 python2.2])
|
||||
fi
|
||||
|
||||
m4_popdef([xpp_path])
|
||||
|
||||
if test "$PYTHON" != "no"
|
||||
then
|
||||
# The library we're linking against
|
||||
PYTHON_LIB="_XIPH_PYTHON_CFG([$PYTHON], [LIBRARY])"
|
||||
|
||||
# if LIBRARY is nonsensical, bail out
|
||||
if test $? -ne 0 -o -z "$PYTHON_LIB"
|
||||
then
|
||||
AC_MSG_WARN([Could not find library for $PYTHON])
|
||||
break
|
||||
fi
|
||||
# make library linker friendly. This is a hack, but I don't know what's better
|
||||
PYTHON_LIB=`echo "$PYTHON_LIB" | sed 's/lib//;s/\.a.*//;s/\.so.*//;s/\.dylib.*//'`
|
||||
|
||||
# LDFLAGS
|
||||
PYTHON_LDFLAGS="-L[]_XIPH_PYTHON_CFG([$PYTHON], [LIBPL])"
|
||||
|
||||
# Extra libraries required by python
|
||||
PYTHON_EXTRA_LIBS="_XIPH_PYTHON_CFG([$PYTHON], [LIBS])"
|
||||
PYTHON_EXTRA_LIBS="$PYTHON_EXTRA_LIBS _XIPH_PYTHON_CFG([$PYTHON], [SYSLIBS])"
|
||||
PYTHON_EXTRA_LIBS="$PYTHON_EXTRA_LIBS _XIPH_PYTHON_CFG([$PYTHON], [SHLIBS])"
|
||||
|
||||
PYTHON_CPPFLAGS="-I[]_XIPH_PYTHON_CFG([$PYTHON], [INCLUDEPY])"
|
||||
|
||||
# test header and library functionality
|
||||
saved_CPPFLAGS="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS"
|
||||
AC_CHECK_HEADER([Python.h],
|
||||
[
|
||||
saved_LDFLAGS="$LDFLAGS"
|
||||
LDFLAGS="$LDFLAGS $PYTHON_LDFLAGS"
|
||||
AC_CHECK_LIB([$PYTHON_LIB], [Py_Initialize],
|
||||
[PYTHON_LIBS="-l$PYTHON_LIB $PYTHON_EXTRA_LIBS"],
|
||||
[AC_MSG_WARN([Could not link to the python library])],
|
||||
[$PYTHON_EXTRA_LIBS])
|
||||
LDFLAGS="$saved_LDFLAGS"
|
||||
],
|
||||
[AC_MSG_WARN([Python.h doesn't appear to be usable])])
|
||||
CPPFLAGS="$saved_CPPFLAGS"
|
||||
fi
|
||||
])dnl
|
||||
|
||||
# _XIPH_PYTHON_CFG(PYTHONPATH, CFGVAR)
|
||||
# Ask python in PYTHONPATH for the definition of CFGVAR
|
||||
m4_define([_XIPH_PYTHON_CFG],
|
||||
[`$1 -c 'from distutils.sysconfig import get_config_var; print get_config_var("$2")' | sed 's/None//'`])
|
59
m4/xiph_types.m4
Normal file
59
m4/xiph_types.m4
Normal file
@ -0,0 +1,59 @@
|
||||
dnl xiph_types.m4
|
||||
dnl macros for type checks not covered by autoconf
|
||||
|
||||
dnl XIPH_C99_INTTYPES
|
||||
dnl Brendan Cully
|
||||
dnl
|
||||
# XIPH_C99_INTTYPES
|
||||
# Check for C99 integer type definitions, or define if missing
|
||||
AC_DEFUN([XIPH_C99_INTTYPES],
|
||||
[dnl
|
||||
AC_CHECK_HEADERS([inttypes.h])
|
||||
AC_CHECK_TYPE([uint32_t],
|
||||
[AC_DEFINE(HAVE_C99_INTTYPES, 1, [Define if you have the C99 integer types])],
|
||||
[AC_CHECK_SIZEOF(short)
|
||||
AC_CHECK_SIZEOF(int)
|
||||
AC_CHECK_SIZEOF(long)
|
||||
AC_CHECK_SIZEOF(long long)])
|
||||
AH_VERBATIM([X_HAVE_C99_INTTYPES],
|
||||
[#ifndef HAVE_C99_INTTYPES
|
||||
# if SIZEOF_SHORT == 4
|
||||
typedef unsigned short uint32_t;
|
||||
# elif SIZEOF_INT == 4
|
||||
typedef unsigned int uint32_t;
|
||||
# elif SIZEOF_LONG == 4
|
||||
typedef unsigned long uint32_t;
|
||||
# endif
|
||||
# if SIZEOF_INT == 8
|
||||
typedef unsigned int uint64_t;
|
||||
# elif SIZEOF_LONG == 8
|
||||
typedef unsigned long uint64_t;
|
||||
# elif SIZEOF_LONG_LONG == 8
|
||||
typedef unsigned long long uint64_t;
|
||||
# endif
|
||||
#endif
|
||||
])
|
||||
])
|
||||
|
||||
dnl XIPH_TYPE_SOCKLEN_T
|
||||
dnl Brendan Cully
|
||||
dnl
|
||||
# XIPH_TYPE_SOCKLEN_T
|
||||
# Check for socklen_t, or define as int if missing
|
||||
AC_DEFUN([XIPH_TYPE_SOCKLEN_T],
|
||||
[dnl
|
||||
AC_CHECK_HEADERS([sys/socket.h])
|
||||
AC_CHECK_TYPES([socklen_t],,,
|
||||
[#if HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
#if HAVE_SYS_SOCKET_H
|
||||
# include <sys/socket.h>
|
||||
#endif
|
||||
])
|
||||
AH_VERBATIM([X_HAVE_SOCKLEN_T],
|
||||
[#ifndef HAVE_SOCKLEN_T
|
||||
typedef int socklen_t;
|
||||
#endif
|
||||
])
|
||||
])
|
58
m4/xiph_xml2.m4
Normal file
58
m4/xiph_xml2.m4
Normal file
@ -0,0 +1,58 @@
|
||||
dnl XIPH_PATH_XML
|
||||
dnl Populate XML_CFLAGS and XML_LIBS with infomation for
|
||||
dnl linking with libxml2
|
||||
AC_DEFUN([XIPH_PATH_XML],
|
||||
[dnl
|
||||
AC_MSG_RESULT([checking for XML configuration])
|
||||
AC_ARG_VAR([XMLCONFIG],[XML configuration program])
|
||||
AC_ARG_WITH(xml-config,
|
||||
[AC_HELP_STRING([--with-xml-config=PATH],
|
||||
[use xml-config in PATH to find libxml])],
|
||||
[XMLCONFIG="$withval"],
|
||||
[AC_PATH_PROGS(XMLCONFIG, [xml2-config xml-config], "")]
|
||||
)
|
||||
if test "x$XMLCONFIG" = "x"; then
|
||||
AC_MSG_ERROR([XML configuration could not be found])
|
||||
fi
|
||||
if ! test -x "$XMLCONFIG"; then
|
||||
AC_MSG_ERROR([$XMLCONFIG cannot be executed])
|
||||
fi
|
||||
XML_LIBS="$($XMLCONFIG --libs)"
|
||||
XML_CFLAGS="$($XMLCONFIG --cflags)"
|
||||
ac_xml_save_LIBS="$LIBS"
|
||||
ac_xml_save_CFLAGS="$CFLAGS"
|
||||
LIBS="$XML_LIBS $LIBS"
|
||||
CFLAGS="$CFLAGS $XML_CFLAGS"
|
||||
AC_CHECK_FUNC(xmlParseFile,, [AC_MSG_ERROR([Unable to link with libxml])])
|
||||
CFLAGS="$ac_xml_save_CFLAGS"
|
||||
LIBS="$ac_xml_save_LIBS"
|
||||
])
|
||||
|
||||
dnl XIPH_PATH_XSLT
|
||||
dnl Populate XSLT_CFLAGS and XSLT_LIBS with infomation for
|
||||
dnl linking with libxml2
|
||||
AC_DEFUN([XIPH_PATH_XSLT],
|
||||
[dnl
|
||||
AC_ARG_VAR([XSLTCONFIG],[XSLT configuration program])
|
||||
AC_ARG_WITH(xslt-config,
|
||||
[AC_HELP_STRING([--with-xslt-config=PATH],
|
||||
[use xslt-config in PATH to find libxslt])],
|
||||
[XSLTCONFIG="$withval"],
|
||||
[AC_PATH_PROGS(XSLTCONFIG, [xslt-config], "")]
|
||||
)
|
||||
if test "x$XSLTCONFIG" = "x"; then
|
||||
AC_MSG_ERROR([XSLT configuration could not be found])
|
||||
fi
|
||||
if ! test -x "$XSLTCONFIG"; then
|
||||
AC_MSG_ERROR([$XSLTCONFIG cannot be executed])
|
||||
fi
|
||||
XSLT_LIBS="$($XSLTCONFIG --libs)"
|
||||
XSLT_CFLAGS="$($XSLTCONFIG --cflags)"
|
||||
ac_xslt_save_LIBS="$LIBS"
|
||||
ac_xslt_save_CFLAGS="$CFLAGS"
|
||||
LIBS="$XSLT_LIBS $LIBS"
|
||||
CFLAGS="$CFLAGS $XSLT_CFLAGS"
|
||||
AC_CHECK_FUNC(xsltParseStylesheetFile,,[AC_MSG_ERROR([Unable to link with libxslt])])
|
||||
CFLAGS="$ac_xslt_save_CFLAGS"
|
||||
LIBS="$ac_xslt_save_LIBS"
|
||||
])
|
143
src/.deps/configfile.Po
Normal file
143
src/.deps/configfile.Po
Normal file
@ -0,0 +1,143 @@
|
||||
configfile.o: configfile.c /usr/include/string.h /usr/include/features.h \
|
||||
/usr/include/sys/cdefs.h /usr/include/gnu/stubs.h \
|
||||
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/stddef.h \
|
||||
/usr/include/bits/string.h /usr/include/bits/string2.h \
|
||||
/usr/include/endian.h /usr/include/bits/endian.h \
|
||||
/usr/include/bits/types.h /usr/include/bits/wordsize.h \
|
||||
/usr/include/bits/typesizes.h /usr/include/stdlib.h configfile.h \
|
||||
/usr/include/libxml2/libxml/parser.h \
|
||||
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/stdarg.h \
|
||||
/usr/include/libxml2/libxml/xmlversion.h \
|
||||
/usr/include/libxml2/libxml/xmlexports.h \
|
||||
/usr/include/libxml2/libxml/tree.h /usr/include/stdio.h \
|
||||
/usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \
|
||||
/usr/include/bits/wchar.h /usr/include/gconv.h \
|
||||
/usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
|
||||
/usr/include/bits/stdio.h /usr/include/libxml2/libxml/xmlregexp.h \
|
||||
/usr/include/libxml2/libxml/dict.h /usr/include/libxml2/libxml/hash.h \
|
||||
/usr/include/libxml2/libxml/valid.h \
|
||||
/usr/include/libxml2/libxml/xmlerror.h \
|
||||
/usr/include/libxml2/libxml/list.h \
|
||||
/usr/include/libxml2/libxml/xmlautomata.h \
|
||||
/usr/include/libxml2/libxml/entities.h \
|
||||
/usr/include/libxml2/libxml/encoding.h /usr/include/iconv.h \
|
||||
/usr/include/libxml2/libxml/xmlIO.h \
|
||||
/usr/include/libxml2/libxml/globals.h /usr/include/libxml2/libxml/SAX.h \
|
||||
/usr/include/sys/types.h /usr/include/time.h /usr/include/sys/select.h \
|
||||
/usr/include/bits/select.h /usr/include/bits/sigset.h \
|
||||
/usr/include/bits/time.h /usr/include/sys/sysmacros.h \
|
||||
/usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h \
|
||||
/usr/include/alloca.h /usr/include/libxml2/libxml/xlink.h \
|
||||
/usr/include/libxml2/libxml/SAX2.h \
|
||||
/usr/include/libxml2/libxml/xmlmemory.h \
|
||||
/usr/include/libxml2/libxml/threads.h
|
||||
|
||||
/usr/include/string.h:
|
||||
|
||||
/usr/include/features.h:
|
||||
|
||||
/usr/include/sys/cdefs.h:
|
||||
|
||||
/usr/include/gnu/stubs.h:
|
||||
|
||||
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/stddef.h:
|
||||
|
||||
/usr/include/bits/string.h:
|
||||
|
||||
/usr/include/bits/string2.h:
|
||||
|
||||
/usr/include/endian.h:
|
||||
|
||||
/usr/include/bits/endian.h:
|
||||
|
||||
/usr/include/bits/types.h:
|
||||
|
||||
/usr/include/bits/wordsize.h:
|
||||
|
||||
/usr/include/bits/typesizes.h:
|
||||
|
||||
/usr/include/stdlib.h:
|
||||
|
||||
configfile.h:
|
||||
|
||||
/usr/include/libxml2/libxml/parser.h:
|
||||
|
||||
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/stdarg.h:
|
||||
|
||||
/usr/include/libxml2/libxml/xmlversion.h:
|
||||
|
||||
/usr/include/libxml2/libxml/xmlexports.h:
|
||||
|
||||
/usr/include/libxml2/libxml/tree.h:
|
||||
|
||||
/usr/include/stdio.h:
|
||||
|
||||
/usr/include/libio.h:
|
||||
|
||||
/usr/include/_G_config.h:
|
||||
|
||||
/usr/include/wchar.h:
|
||||
|
||||
/usr/include/bits/wchar.h:
|
||||
|
||||
/usr/include/gconv.h:
|
||||
|
||||
/usr/include/bits/stdio_lim.h:
|
||||
|
||||
/usr/include/bits/sys_errlist.h:
|
||||
|
||||
/usr/include/bits/stdio.h:
|
||||
|
||||
/usr/include/libxml2/libxml/xmlregexp.h:
|
||||
|
||||
/usr/include/libxml2/libxml/dict.h:
|
||||
|
||||
/usr/include/libxml2/libxml/hash.h:
|
||||
|
||||
/usr/include/libxml2/libxml/valid.h:
|
||||
|
||||
/usr/include/libxml2/libxml/xmlerror.h:
|
||||
|
||||
/usr/include/libxml2/libxml/list.h:
|
||||
|
||||
/usr/include/libxml2/libxml/xmlautomata.h:
|
||||
|
||||
/usr/include/libxml2/libxml/entities.h:
|
||||
|
||||
/usr/include/libxml2/libxml/encoding.h:
|
||||
|
||||
/usr/include/iconv.h:
|
||||
|
||||
/usr/include/libxml2/libxml/xmlIO.h:
|
||||
|
||||
/usr/include/libxml2/libxml/globals.h:
|
||||
|
||||
/usr/include/libxml2/libxml/SAX.h:
|
||||
|
||||
/usr/include/sys/types.h:
|
||||
|
||||
/usr/include/time.h:
|
||||
|
||||
/usr/include/sys/select.h:
|
||||
|
||||
/usr/include/bits/select.h:
|
||||
|
||||
/usr/include/bits/sigset.h:
|
||||
|
||||
/usr/include/bits/time.h:
|
||||
|
||||
/usr/include/sys/sysmacros.h:
|
||||
|
||||
/usr/include/bits/pthreadtypes.h:
|
||||
|
||||
/usr/include/bits/sched.h:
|
||||
|
||||
/usr/include/alloca.h:
|
||||
|
||||
/usr/include/libxml2/libxml/xlink.h:
|
||||
|
||||
/usr/include/libxml2/libxml/SAX2.h:
|
||||
|
||||
/usr/include/libxml2/libxml/xmlmemory.h:
|
||||
|
||||
/usr/include/libxml2/libxml/threads.h:
|
148
src/.deps/ezstream.Po
Normal file
148
src/.deps/ezstream.Po
Normal file
@ -0,0 +1,148 @@
|
||||
ezstream.o: ezstream.c /usr/include/stdio.h /usr/include/features.h \
|
||||
/usr/include/sys/cdefs.h /usr/include/gnu/stubs.h \
|
||||
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/stddef.h \
|
||||
/usr/include/bits/types.h /usr/include/bits/wordsize.h \
|
||||
/usr/include/bits/typesizes.h /usr/include/libio.h \
|
||||
/usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \
|
||||
/usr/include/gconv.h \
|
||||
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/stdarg.h \
|
||||
/usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
|
||||
/usr/include/bits/stdio.h /usr/include/stdlib.h \
|
||||
/usr/include/sys/types.h /usr/include/time.h /usr/include/endian.h \
|
||||
/usr/include/bits/endian.h /usr/include/sys/select.h \
|
||||
/usr/include/bits/select.h /usr/include/bits/sigset.h \
|
||||
/usr/include/bits/time.h /usr/include/sys/sysmacros.h \
|
||||
/usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h \
|
||||
/usr/include/alloca.h /usr/include/string.h /usr/include/bits/string.h \
|
||||
/usr/include/bits/string2.h /usr/local/include/shout/shout.h getopt.h \
|
||||
configfile.h /usr/include/libxml2/libxml/parser.h \
|
||||
/usr/include/libxml2/libxml/xmlversion.h \
|
||||
/usr/include/libxml2/libxml/xmlexports.h \
|
||||
/usr/include/libxml2/libxml/tree.h \
|
||||
/usr/include/libxml2/libxml/xmlregexp.h \
|
||||
/usr/include/libxml2/libxml/dict.h /usr/include/libxml2/libxml/hash.h \
|
||||
/usr/include/libxml2/libxml/valid.h \
|
||||
/usr/include/libxml2/libxml/xmlerror.h \
|
||||
/usr/include/libxml2/libxml/list.h \
|
||||
/usr/include/libxml2/libxml/xmlautomata.h \
|
||||
/usr/include/libxml2/libxml/entities.h \
|
||||
/usr/include/libxml2/libxml/encoding.h /usr/include/iconv.h \
|
||||
/usr/include/libxml2/libxml/xmlIO.h \
|
||||
/usr/include/libxml2/libxml/globals.h /usr/include/libxml2/libxml/SAX.h \
|
||||
/usr/include/libxml2/libxml/xlink.h /usr/include/libxml2/libxml/SAX2.h \
|
||||
/usr/include/libxml2/libxml/xmlmemory.h \
|
||||
/usr/include/libxml2/libxml/threads.h
|
||||
|
||||
/usr/include/stdio.h:
|
||||
|
||||
/usr/include/features.h:
|
||||
|
||||
/usr/include/sys/cdefs.h:
|
||||
|
||||
/usr/include/gnu/stubs.h:
|
||||
|
||||
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/stddef.h:
|
||||
|
||||
/usr/include/bits/types.h:
|
||||
|
||||
/usr/include/bits/wordsize.h:
|
||||
|
||||
/usr/include/bits/typesizes.h:
|
||||
|
||||
/usr/include/libio.h:
|
||||
|
||||
/usr/include/_G_config.h:
|
||||
|
||||
/usr/include/wchar.h:
|
||||
|
||||
/usr/include/bits/wchar.h:
|
||||
|
||||
/usr/include/gconv.h:
|
||||
|
||||
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/stdarg.h:
|
||||
|
||||
/usr/include/bits/stdio_lim.h:
|
||||
|
||||
/usr/include/bits/sys_errlist.h:
|
||||
|
||||
/usr/include/bits/stdio.h:
|
||||
|
||||
/usr/include/stdlib.h:
|
||||
|
||||
/usr/include/sys/types.h:
|
||||
|
||||
/usr/include/time.h:
|
||||
|
||||
/usr/include/endian.h:
|
||||
|
||||
/usr/include/bits/endian.h:
|
||||
|
||||
/usr/include/sys/select.h:
|
||||
|
||||
/usr/include/bits/select.h:
|
||||
|
||||
/usr/include/bits/sigset.h:
|
||||
|
||||
/usr/include/bits/time.h:
|
||||
|
||||
/usr/include/sys/sysmacros.h:
|
||||
|
||||
/usr/include/bits/pthreadtypes.h:
|
||||
|
||||
/usr/include/bits/sched.h:
|
||||
|
||||
/usr/include/alloca.h:
|
||||
|
||||
/usr/include/string.h:
|
||||
|
||||
/usr/include/bits/string.h:
|
||||
|
||||
/usr/include/bits/string2.h:
|
||||
|
||||
/usr/local/include/shout/shout.h:
|
||||
|
||||
getopt.h:
|
||||
|
||||
configfile.h:
|
||||
|
||||
/usr/include/libxml2/libxml/parser.h:
|
||||
|
||||
/usr/include/libxml2/libxml/xmlversion.h:
|
||||
|
||||
/usr/include/libxml2/libxml/xmlexports.h:
|
||||
|
||||
/usr/include/libxml2/libxml/tree.h:
|
||||
|
||||
/usr/include/libxml2/libxml/xmlregexp.h:
|
||||
|
||||
/usr/include/libxml2/libxml/dict.h:
|
||||
|
||||
/usr/include/libxml2/libxml/hash.h:
|
||||
|
||||
/usr/include/libxml2/libxml/valid.h:
|
||||
|
||||
/usr/include/libxml2/libxml/xmlerror.h:
|
||||
|
||||
/usr/include/libxml2/libxml/list.h:
|
||||
|
||||
/usr/include/libxml2/libxml/xmlautomata.h:
|
||||
|
||||
/usr/include/libxml2/libxml/entities.h:
|
||||
|
||||
/usr/include/libxml2/libxml/encoding.h:
|
||||
|
||||
/usr/include/iconv.h:
|
||||
|
||||
/usr/include/libxml2/libxml/xmlIO.h:
|
||||
|
||||
/usr/include/libxml2/libxml/globals.h:
|
||||
|
||||
/usr/include/libxml2/libxml/SAX.h:
|
||||
|
||||
/usr/include/libxml2/libxml/xlink.h:
|
||||
|
||||
/usr/include/libxml2/libxml/SAX2.h:
|
||||
|
||||
/usr/include/libxml2/libxml/xmlmemory.h:
|
||||
|
||||
/usr/include/libxml2/libxml/threads.h:
|
21
src/Makefile.am
Normal file
21
src/Makefile.am
Normal file
@ -0,0 +1,21 @@
|
||||
## Process this with automake to create Makefile.in
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
bin_PROGRAMS = ezstream
|
||||
|
||||
ezstream_SOURCES = ezstream.c configfile.c
|
||||
ezstream_LDADD = @XIPH_LIBS@
|
||||
|
||||
AM_CFLAGS = @XIPH_CFLAGS@
|
||||
AM_CPPFLAGS = @XIPH_CPPFLAGS@
|
||||
|
||||
EXTRA_DIST = getopt.c getopt.h configfile.h
|
||||
|
||||
|
||||
debug:
|
||||
$(MAKE) all CFLAGS="@DEBUG@"
|
||||
|
||||
profile:
|
||||
$(MAKE) all CFLAGS="@PROFILE@"
|
||||
|
267
src/configfile.c
Normal file
267
src/configfile.c
Normal file
@ -0,0 +1,267 @@
|
||||
#include <string.h>
|
||||
#include "configfile.h"
|
||||
|
||||
static EZCONFIG ezConfig;
|
||||
|
||||
EZCONFIG *getEZConfig() {
|
||||
return &ezConfig;
|
||||
}
|
||||
|
||||
void printConfig()
|
||||
{
|
||||
if (ezConfig.URL) {
|
||||
printf("URL to connect to (%s)\n", ezConfig.URL);
|
||||
}
|
||||
else {
|
||||
printf("URL not SET\n");
|
||||
}
|
||||
if (ezConfig.password) {
|
||||
printf("source password (%s)\n", ezConfig.password);
|
||||
}
|
||||
else {
|
||||
printf("source password not SET\n");
|
||||
}
|
||||
if (ezConfig.format == MP3_FORMAT) {
|
||||
printf("Broadcasting in MP3 format\n");
|
||||
}
|
||||
if (ezConfig.format == OGGVORBIS_FORMAT) {
|
||||
printf("Broadcasting in Ogg Vorbis format\n");
|
||||
}
|
||||
if (ezConfig.format == 0) {
|
||||
printf("Broadcast format not set\n");
|
||||
}
|
||||
if (ezConfig.fileName) {
|
||||
printf("File to broadcast (%s)\n", ezConfig.fileName);
|
||||
}
|
||||
else {
|
||||
printf("broadcast file not SET\n");
|
||||
}
|
||||
if (ezConfig.serverName) {
|
||||
printf("Server Info Name (%s)\n", ezConfig.serverName);
|
||||
}
|
||||
else {
|
||||
printf("Server Info Name not SET\n");
|
||||
}
|
||||
if (ezConfig.serverURL) {
|
||||
printf("Server Info URL (%s)\n", ezConfig.serverURL);
|
||||
}
|
||||
else {
|
||||
printf("Server Info URL not SET\n");
|
||||
}
|
||||
if (ezConfig.serverGenre) {
|
||||
printf("Server Info Genre (%s)\n", ezConfig.serverGenre);
|
||||
}
|
||||
else {
|
||||
printf("Server Info Genre not SET\n");
|
||||
}
|
||||
if (ezConfig.serverDescription) {
|
||||
printf("Server Info Description (%s)\n", ezConfig.serverDescription);
|
||||
}
|
||||
else {
|
||||
printf("Server Info Description not SET\n");
|
||||
}
|
||||
if (ezConfig.serverBitrate) {
|
||||
printf("Server Info Bitrate (%s)\n", ezConfig.serverBitrate);
|
||||
}
|
||||
else {
|
||||
printf("Server Info Bitrate not SET\n");
|
||||
}
|
||||
if (ezConfig.serverChannels) {
|
||||
printf("Server Info Channels (%s)\n", ezConfig.serverChannels);
|
||||
}
|
||||
else {
|
||||
printf("Server Info Channels not SET\n");
|
||||
}
|
||||
if (ezConfig.serverSamplerate) {
|
||||
printf("Server Info Samplerate (%s)\n", ezConfig.serverSamplerate);
|
||||
}
|
||||
else {
|
||||
printf("Server Info Samplerate not SET\n");
|
||||
}
|
||||
if (ezConfig.serverQuality) {
|
||||
printf("Server Info Quality (%s)\n", ezConfig.serverQuality);
|
||||
}
|
||||
else {
|
||||
printf("Server Info Quality not SET\n");
|
||||
}
|
||||
if (ezConfig.serverPublic) {
|
||||
printf("Server is a public server\n");
|
||||
}
|
||||
else {
|
||||
printf("Server is a private server\n");
|
||||
}
|
||||
|
||||
}
|
||||
int parseConfig(char *fileName)
|
||||
{
|
||||
xmlDocPtr doc;
|
||||
xmlNodePtr cur;
|
||||
char *ls_xmlContentPtr;
|
||||
|
||||
doc = xmlParseFile(fileName);
|
||||
if (doc == NULL) {
|
||||
printf("Unable to parse config file (%s)", fileName);
|
||||
return 0;
|
||||
}
|
||||
|
||||
cur = xmlDocGetRootElement(doc);
|
||||
|
||||
if (cur == NULL) {
|
||||
printf("Unable to parse config file (empty document)(%s)", fileName);
|
||||
xmlFreeDoc(doc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
memset(&ezConfig, '\000', sizeof(ezConfig));
|
||||
|
||||
cur = cur->xmlChildrenNode;
|
||||
while (cur != NULL) {
|
||||
if (!xmlStrcmp(cur->name, (const xmlChar *) "url")) {
|
||||
if (cur->xmlChildrenNode != NULL) {
|
||||
ls_xmlContentPtr = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode,1);
|
||||
if ( strlen(ls_xmlContentPtr) > 0 ) {
|
||||
ezConfig.URL = (char *)malloc(strlen(ls_xmlContentPtr) +1);
|
||||
memset(ezConfig.URL, '\000', strlen(ls_xmlContentPtr) +1);
|
||||
strcpy(ezConfig.URL, ls_xmlContentPtr);
|
||||
}
|
||||
xmlFree(ls_xmlContentPtr);
|
||||
}
|
||||
}
|
||||
if (!xmlStrcmp(cur->name, (const xmlChar *) "sourcepassword")) {
|
||||
if (cur->xmlChildrenNode != NULL) {
|
||||
ls_xmlContentPtr = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode,1);
|
||||
if ( strlen(ls_xmlContentPtr) > 0 ) {
|
||||
ezConfig.password = (char *)malloc(strlen(ls_xmlContentPtr) +1);
|
||||
memset(ezConfig.password, '\000', strlen(ls_xmlContentPtr) +1);
|
||||
strcpy(ezConfig.password, ls_xmlContentPtr);
|
||||
}
|
||||
xmlFree(ls_xmlContentPtr);
|
||||
}
|
||||
}
|
||||
if (!xmlStrcmp(cur->name, (const xmlChar *) "format")) {
|
||||
if (cur->xmlChildrenNode != NULL) {
|
||||
ls_xmlContentPtr = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode,1);
|
||||
if ( strlen(ls_xmlContentPtr) > 0 ) {
|
||||
if (!strcmp(ls_xmlContentPtr, "MP3")) {
|
||||
ezConfig.format = MP3_FORMAT;
|
||||
}
|
||||
if (!strcmp(ls_xmlContentPtr, "OGGVORBIS")) {
|
||||
ezConfig.format = OGGVORBIS_FORMAT;
|
||||
}
|
||||
}
|
||||
xmlFree(ls_xmlContentPtr);
|
||||
}
|
||||
}
|
||||
if (!xmlStrcmp(cur->name, (const xmlChar *) "filename")) {
|
||||
if (cur->xmlChildrenNode != NULL) {
|
||||
ls_xmlContentPtr = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode,1);
|
||||
if ( strlen(ls_xmlContentPtr) > 0 ) {
|
||||
ezConfig.fileName = (char *)malloc(strlen(ls_xmlContentPtr) +1);
|
||||
memset(ezConfig.fileName, '\000', strlen(ls_xmlContentPtr) +1);
|
||||
strcpy(ezConfig.fileName, ls_xmlContentPtr);
|
||||
}
|
||||
xmlFree(ls_xmlContentPtr);
|
||||
}
|
||||
}
|
||||
if (!xmlStrcmp(cur->name, (const xmlChar *) "svrinfoname")) {
|
||||
if (cur->xmlChildrenNode != NULL) {
|
||||
ls_xmlContentPtr = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode,1);
|
||||
if ( strlen(ls_xmlContentPtr) > 0 ) {
|
||||
ezConfig.serverName = (char *)malloc(strlen(ls_xmlContentPtr) +1);
|
||||
memset(ezConfig.serverName, '\000', strlen(ls_xmlContentPtr) +1);
|
||||
strcpy(ezConfig.serverName, ls_xmlContentPtr);
|
||||
}
|
||||
xmlFree(ls_xmlContentPtr);
|
||||
}
|
||||
}
|
||||
if (!xmlStrcmp(cur->name, (const xmlChar *) "svrinfourl")) {
|
||||
if (cur->xmlChildrenNode != NULL) {
|
||||
ls_xmlContentPtr = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode,1);
|
||||
if ( strlen(ls_xmlContentPtr) > 0 ) {
|
||||
ezConfig.serverURL = (char *)malloc(strlen(ls_xmlContentPtr) +1);
|
||||
memset(ezConfig.serverURL, '\000', strlen(ls_xmlContentPtr) +1);
|
||||
strcpy(ezConfig.serverURL, ls_xmlContentPtr);
|
||||
}
|
||||
xmlFree(ls_xmlContentPtr);
|
||||
}
|
||||
}
|
||||
if (!xmlStrcmp(cur->name, (const xmlChar *) "svrinfogenre")) {
|
||||
if (cur->xmlChildrenNode != NULL) {
|
||||
ls_xmlContentPtr = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode,1);
|
||||
if ( strlen(ls_xmlContentPtr) > 0 ) {
|
||||
ezConfig.serverGenre = (char *)malloc(strlen(ls_xmlContentPtr) +1);
|
||||
memset(ezConfig.serverGenre, '\000', strlen(ls_xmlContentPtr) +1);
|
||||
strcpy(ezConfig.serverGenre, ls_xmlContentPtr);
|
||||
}
|
||||
xmlFree(ls_xmlContentPtr);
|
||||
}
|
||||
}
|
||||
if (!xmlStrcmp(cur->name, (const xmlChar *) "svrinfodescription")) {
|
||||
if (cur->xmlChildrenNode != NULL) {
|
||||
ls_xmlContentPtr = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode,1);
|
||||
if ( strlen(ls_xmlContentPtr) > 0 ) {
|
||||
ezConfig.serverDescription = (char *)malloc(strlen(ls_xmlContentPtr) +1);
|
||||
memset(ezConfig.serverDescription, '\000', strlen(ls_xmlContentPtr) +1);
|
||||
strcpy(ezConfig.serverDescription, ls_xmlContentPtr);
|
||||
}
|
||||
xmlFree(ls_xmlContentPtr);
|
||||
}
|
||||
}
|
||||
if (!xmlStrcmp(cur->name, (const xmlChar *) "svrinfobitrate")) {
|
||||
if (cur->xmlChildrenNode != NULL) {
|
||||
ls_xmlContentPtr = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode,1);
|
||||
if ( strlen(ls_xmlContentPtr) > 0 ) {
|
||||
ezConfig.serverBitrate = (char *)malloc(strlen(ls_xmlContentPtr) +1);
|
||||
memset(ezConfig.serverBitrate, '\000', strlen(ls_xmlContentPtr) +1);
|
||||
strcpy(ezConfig.serverBitrate, ls_xmlContentPtr);
|
||||
}
|
||||
xmlFree(ls_xmlContentPtr);
|
||||
}
|
||||
}
|
||||
|
||||
if (!xmlStrcmp(cur->name, (const xmlChar *) "svrinfochannels")) {
|
||||
if (cur->xmlChildrenNode != NULL) {
|
||||
ls_xmlContentPtr = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode,1);
|
||||
if ( strlen(ls_xmlContentPtr) > 0 ) {
|
||||
ezConfig.serverChannels = (char *)malloc(strlen(ls_xmlContentPtr) +1);
|
||||
memset(ezConfig.serverChannels, '\000', strlen(ls_xmlContentPtr) +1);
|
||||
strcpy(ezConfig.serverChannels, ls_xmlContentPtr);
|
||||
}
|
||||
xmlFree(ls_xmlContentPtr);
|
||||
}
|
||||
}
|
||||
if (!xmlStrcmp(cur->name, (const xmlChar *) "svrinfosamplerate")) {
|
||||
if (cur->xmlChildrenNode != NULL) {
|
||||
ls_xmlContentPtr = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode,1);
|
||||
if ( strlen(ls_xmlContentPtr) > 0 ) {
|
||||
ezConfig.serverSamplerate = (char *)malloc(strlen(ls_xmlContentPtr) +1);
|
||||
memset(ezConfig.serverSamplerate, '\000', strlen(ls_xmlContentPtr) +1);
|
||||
strcpy(ezConfig.serverSamplerate, ls_xmlContentPtr);
|
||||
}
|
||||
xmlFree(ls_xmlContentPtr);
|
||||
}
|
||||
}
|
||||
if (!xmlStrcmp(cur->name, (const xmlChar *) "svrinfoquality")) {
|
||||
if (cur->xmlChildrenNode != NULL) {
|
||||
ls_xmlContentPtr = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode,1);
|
||||
if ( strlen(ls_xmlContentPtr) > 0 ) {
|
||||
ezConfig.serverQuality = (char *)malloc(strlen(ls_xmlContentPtr) +1);
|
||||
memset(ezConfig.serverQuality, '\000', strlen(ls_xmlContentPtr) +1);
|
||||
strcpy(ezConfig.serverQuality, ls_xmlContentPtr);
|
||||
}
|
||||
xmlFree(ls_xmlContentPtr);
|
||||
}
|
||||
}
|
||||
if (!xmlStrcmp(cur->name, (const xmlChar *) "svrinfopublic")) {
|
||||
if (cur->xmlChildrenNode != NULL) {
|
||||
ls_xmlContentPtr = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode,1);
|
||||
if ( strlen(ls_xmlContentPtr) > 0 ) {
|
||||
ezConfig.serverPublic = atoi(ls_xmlContentPtr);
|
||||
}
|
||||
xmlFree(ls_xmlContentPtr);
|
||||
}
|
||||
}
|
||||
cur = cur->next;
|
||||
}
|
||||
return(1);
|
||||
}
|
29
src/configfile.h
Normal file
29
src/configfile.h
Normal file
@ -0,0 +1,29 @@
|
||||
#ifndef __EZSTREAM_CONFIG_H__
|
||||
#define __EZSTREAM_CONFIG_H__
|
||||
|
||||
#include <libxml/parser.h>
|
||||
|
||||
|
||||
#define MP3_FORMAT 1
|
||||
#define OGGVORBIS_FORMAT 2
|
||||
|
||||
typedef struct tag_EZCONFIG {
|
||||
char *URL;
|
||||
char *password;
|
||||
int format;
|
||||
char *fileName;
|
||||
char *serverName;
|
||||
char *serverURL;
|
||||
char *serverGenre;
|
||||
char *serverDescription;
|
||||
char *serverBitrate;
|
||||
char *serverChannels;
|
||||
char *serverSamplerate;
|
||||
char *serverQuality;
|
||||
int serverPublic;
|
||||
} EZCONFIG;
|
||||
|
||||
void printConfig();
|
||||
int parseConfig(char *fileName);
|
||||
EZCONFIG *getEZConfig();
|
||||
#endif
|
356
src/ezstream.c
Normal file
356
src/ezstream.c
Normal file
@ -0,0 +1,356 @@
|
||||
/* example.c: Demonstration of the libshout API. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <shout/shout.h>
|
||||
#include <getopt.h>
|
||||
#include "configfile.h"
|
||||
|
||||
EZCONFIG *pezConfig = NULL;
|
||||
|
||||
typedef struct tag_ID3Tag {
|
||||
char tag[3];
|
||||
char trackName[30];
|
||||
char artistName[30];
|
||||
char albumName[30];
|
||||
char year[3];
|
||||
char comment[30];
|
||||
char genre;
|
||||
} ID3Tag;
|
||||
|
||||
void usage() {
|
||||
fprintf(stdout, "usage: ezstream -h -c ezstream.xml\n");
|
||||
fprintf(stdout, "where :\n");
|
||||
fprintf(stdout, " -h = display this help\n");
|
||||
fprintf(stdout, " -c = ezstream config file\n");
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int strrcmp(char *s, char *sub)
|
||||
{
|
||||
int slen = strlen(s);
|
||||
int sublen = strlen(sub);
|
||||
|
||||
if (sublen > slen) {
|
||||
return 1;
|
||||
}
|
||||
return memcmp(s + slen - sublen, sub, sublen);
|
||||
}
|
||||
|
||||
|
||||
int urlParse(char *url, char *hostname, int *port, char *mountname)
|
||||
{
|
||||
char *p1;
|
||||
char *p2;
|
||||
char *p3;
|
||||
char tmpPort[25] = "";
|
||||
|
||||
if (strncmp(url, "http://", strlen("http://"))) {
|
||||
printf("Invalid URL, must be of the form http://server:port/mountpoint\n");
|
||||
return 0;
|
||||
}
|
||||
p1 = url + strlen("http://");
|
||||
p2 = strchr(p1, ':');
|
||||
if (!p2) {
|
||||
printf("Invalid URL, must be of the form http://server:port/mountpoint\n");
|
||||
return 0;
|
||||
}
|
||||
strncpy(hostname, p1, p2-p1);
|
||||
p2++;
|
||||
p3 = strchr(p2, '/');
|
||||
if (!p3) {
|
||||
printf("Invalid URL, must be of the form http://server:port/mountpoint\n");
|
||||
return 0;
|
||||
}
|
||||
memset(tmpPort, '\000', sizeof(tmpPort));
|
||||
strncpy(tmpPort, p2, p3-p2);
|
||||
*port = atoi(tmpPort);
|
||||
strcpy(mountname, p3);
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
int streamFile(shout_t *shout, char *fileName) {
|
||||
FILE *filepstream = NULL;
|
||||
char buff[4096];
|
||||
long read, ret, total;
|
||||
ID3Tag id3tag;
|
||||
|
||||
|
||||
printf("Streaming %s\n", fileName);
|
||||
|
||||
if (!strcmp(pezConfig->fileName, "stdin")) {
|
||||
filepstream = stdin;
|
||||
}
|
||||
else {
|
||||
filepstream = fopen(fileName, "rb");
|
||||
}
|
||||
if (!filepstream) {
|
||||
printf("Cannot open %s\n", fileName);
|
||||
return 0;
|
||||
}
|
||||
if (pezConfig->format == MP3_FORMAT) {
|
||||
/* Look for the ID3 tag */
|
||||
memset(&id3tag, '\000', sizeof(id3tag));
|
||||
fseek(filepstream, -128L, SEEK_END);
|
||||
fread(&id3tag, 1, sizeof(id3tag), filepstream);
|
||||
if (!strncmp(id3tag.tag, "TAG", strlen("TAG"))) {
|
||||
/* We have an Id3 tag */
|
||||
shout_metadata_t *pmetadata = shout_metadata_new();
|
||||
char songInfo[135] = "";
|
||||
sprintf(songInfo, "%s - %s", id3tag.artistName, id3tag.trackName);
|
||||
shout_metadata_add(pmetadata, "song", songInfo);
|
||||
shout_set_metadata(shout, pmetadata);
|
||||
shout_metadata_free(pmetadata);
|
||||
}
|
||||
rewind(filepstream);
|
||||
}
|
||||
total = 0;
|
||||
while (!feof(filepstream)) {
|
||||
read = fread(buff, 1, sizeof(buff), filepstream);
|
||||
total = total + read;
|
||||
|
||||
if (read > 0) {
|
||||
ret = shout_send(shout, buff, read);
|
||||
if (ret != SHOUTERR_SUCCESS) {
|
||||
printf("DEBUG: Send error: %s\n", shout_get_error(shout));
|
||||
break;
|
||||
}
|
||||
shout_delay(shout);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
shout_sync(shout);
|
||||
}
|
||||
fclose(filepstream);
|
||||
filepstream = NULL;
|
||||
return 1;
|
||||
}
|
||||
int streamPlaylist(shout_t *shout, char *fileName) {
|
||||
FILE *filep = NULL;
|
||||
char streamFileName[8096] = "";
|
||||
int loop = 1;
|
||||
|
||||
filep = fopen(fileName, "r");
|
||||
if (filep == 0) {
|
||||
printf("Cannot open %s\n", fileName);
|
||||
return(0);
|
||||
}
|
||||
while (loop) {
|
||||
while (!feof(filep)) {
|
||||
memset(streamFileName, '\000', sizeof(streamFileName));
|
||||
fgets(streamFileName, sizeof(streamFileName), filep);
|
||||
streamFileName[strlen(streamFileName)-1] = '\000';
|
||||
if (strlen(streamFileName) > 0) {
|
||||
/* Skip entries that begin with a # */
|
||||
if (strncmp(streamFileName, "#", 1)) {
|
||||
streamFile(shout, streamFileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
rewind(filep);
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char c;
|
||||
char *configFile = NULL;
|
||||
char *host = NULL;
|
||||
int port = 0;
|
||||
char *mount = NULL;
|
||||
shout_t *shout;
|
||||
|
||||
|
||||
pezConfig = getEZConfig();
|
||||
|
||||
shout_init();
|
||||
|
||||
while ((c = getopt(argc, argv, "hc:")) != -1) {
|
||||
switch (c) {
|
||||
case 'c':
|
||||
configFile = optarg;
|
||||
break;
|
||||
case 'h':
|
||||
usage();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!configFile) {
|
||||
printf("You must supply a config file\n");
|
||||
usage();
|
||||
}
|
||||
else {
|
||||
parseConfig(configFile);
|
||||
}
|
||||
|
||||
if (pezConfig->URL) {
|
||||
host = (char *)malloc(strlen(pezConfig->URL) +1);
|
||||
memset(host, '\000', strlen(pezConfig->URL) +1);
|
||||
mount = (char *)malloc(strlen(pezConfig->URL) +1);
|
||||
memset(mount, '\000', strlen(pezConfig->URL) +1);
|
||||
if (!urlParse(pezConfig->URL, host, &port, mount)) {
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
if ((host == NULL)) {
|
||||
printf("server is required\n");
|
||||
usage();
|
||||
}
|
||||
if ((port == 0)) {
|
||||
printf("port is required\n");
|
||||
usage();
|
||||
}
|
||||
if ((pezConfig->password == NULL)) {
|
||||
printf("-p password is required\n");
|
||||
usage();
|
||||
}
|
||||
if ((mount == NULL)) {
|
||||
printf("mountpoint is required\n");
|
||||
usage();
|
||||
}
|
||||
if ((pezConfig->fileName == NULL)) {
|
||||
printf("-f fileName is required\n");
|
||||
usage();
|
||||
}
|
||||
if (pezConfig->format == 0) {
|
||||
printf("You must specify a format type of MP3 or OGGVORBIS\n");
|
||||
}
|
||||
if (!(shout = shout_new())) {
|
||||
printf("Could not allocate shout_t\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if (shout_set_host(shout, host) != SHOUTERR_SUCCESS) {
|
||||
printf("Error setting hostname: %s\n", shout_get_error(shout));
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (shout_set_protocol(shout, SHOUT_PROTOCOL_HTTP) != SHOUTERR_SUCCESS) {
|
||||
printf("Error setting protocol: %s\n", shout_get_error(shout));
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (shout_set_port(shout, port) != SHOUTERR_SUCCESS) {
|
||||
printf("Error setting port: %s\n", shout_get_error(shout));
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (shout_set_password(shout, pezConfig->password) != SHOUTERR_SUCCESS) {
|
||||
printf("Error setting password: %s\n", shout_get_error(shout));
|
||||
return 1;
|
||||
}
|
||||
if (shout_set_mount(shout, mount) != SHOUTERR_SUCCESS) {
|
||||
printf("Error setting mount: %s\n", shout_get_error(shout));
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (shout_set_user(shout, "source") != SHOUTERR_SUCCESS) {
|
||||
printf("Error setting user: %s\n", shout_get_error(shout));
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (pezConfig->format == MP3_FORMAT) {
|
||||
if (shout_set_format(shout, SHOUT_FORMAT_MP3) != SHOUTERR_SUCCESS) {
|
||||
printf("Error setting user: %s\n", shout_get_error(shout));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (pezConfig->format == OGGVORBIS_FORMAT) {
|
||||
if (shout_set_format(shout, SHOUT_FORMAT_VORBIS) != SHOUTERR_SUCCESS) {
|
||||
printf("Error setting user: %s\n", shout_get_error(shout));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (pezConfig->serverName) {
|
||||
if (shout_set_name(shout, pezConfig->serverName) != SHOUTERR_SUCCESS) {
|
||||
printf("Error setting server name: %s\n", shout_get_error(shout));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (pezConfig->serverURL) {
|
||||
if (shout_set_url(shout, pezConfig->serverURL) != SHOUTERR_SUCCESS) {
|
||||
printf("Error setting server url: %s\n", shout_get_error(shout));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (pezConfig->serverGenre) {
|
||||
if (shout_set_genre(shout, pezConfig->serverGenre) != SHOUTERR_SUCCESS) {
|
||||
printf("Error setting server genre: %s\n", shout_get_error(shout));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (pezConfig->serverDescription) {
|
||||
if (shout_set_description(shout, pezConfig->serverDescription) != SHOUTERR_SUCCESS) {
|
||||
printf("Error setting server description: %s\n", shout_get_error(shout));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (pezConfig->serverBitrate) {
|
||||
if (shout_set_audio_info(shout, SHOUT_AI_BITRATE, pezConfig->serverBitrate) != SHOUTERR_SUCCESS) {
|
||||
printf("Error setting server bitrate: %s\n", shout_get_error(shout));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (pezConfig->serverChannels) {
|
||||
if (shout_set_audio_info(shout, SHOUT_AI_CHANNELS, pezConfig->serverChannels) != SHOUTERR_SUCCESS) {
|
||||
printf("Error setting server channels: %s\n", shout_get_error(shout));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (pezConfig->serverSamplerate) {
|
||||
if (shout_set_audio_info(shout, SHOUT_AI_SAMPLERATE, pezConfig->serverSamplerate) != SHOUTERR_SUCCESS) {
|
||||
printf("Error setting server samplerate: %s\n", shout_get_error(shout));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (pezConfig->serverQuality) {
|
||||
if (shout_set_audio_info(shout, SHOUT_AI_QUALITY, pezConfig->serverQuality) != SHOUTERR_SUCCESS) {
|
||||
printf("Error setting server quality: %s\n", shout_get_error(shout));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (shout_set_public(shout, pezConfig->serverPublic) != SHOUTERR_SUCCESS) {
|
||||
printf("Error setting server public flag: %s\n", shout_get_error(shout));
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("Connecting to %s...", pezConfig->URL);
|
||||
if (shout_open(shout) == SHOUTERR_SUCCESS) {
|
||||
printf("SUCCESS.\n");
|
||||
while (1) {
|
||||
if (!strrcmp(pezConfig->fileName, ".m3u")) {
|
||||
streamPlaylist(shout, pezConfig->fileName);
|
||||
}
|
||||
else {
|
||||
streamFile(shout, pezConfig->fileName);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
printf("FAILED: %s\n", shout_get_error(shout));
|
||||
}
|
||||
|
||||
shout_close(shout);
|
||||
|
||||
shout_shutdown();
|
||||
|
||||
if (host) {
|
||||
free(host);
|
||||
}
|
||||
if (mount) {
|
||||
free(mount);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
694
src/getopt.c
Normal file
694
src/getopt.c
Normal file
@ -0,0 +1,694 @@
|
||||
/* Getopt for GNU.
|
||||
NOTE: getopt is now part of the C library, so if you don't know what
|
||||
"Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu
|
||||
before changing it!
|
||||
|
||||
Copyright (C) 1987, 88, 89, 90, 91, 92, 1993
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any
|
||||
later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifndef __STDC__
|
||||
# ifndef const
|
||||
# define const
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>. */
|
||||
#ifndef _NO_PROTO
|
||||
#define _NO_PROTO
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
/* Comment out all this code if we are using the GNU C Library, and are not
|
||||
actually compiling the library itself. This code is part of the GNU C
|
||||
Library, but also included in many other GNU distributions. Compiling
|
||||
and linking in this code is a waste when using the GNU C library
|
||||
(especially if it is a shared library). Rather than having every GNU
|
||||
program understand `configure --with-gnu-libc' and omit the object files,
|
||||
it is simpler to just do this in the source for each such file. */
|
||||
|
||||
#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
|
||||
|
||||
|
||||
/* This needs to come after some library #include
|
||||
to get __GNU_LIBRARY__ defined. */
|
||||
#ifdef __GNU_LIBRARY__
|
||||
/* Don't include stdlib.h for non-GNU C libraries because some of them
|
||||
contain conflicting prototypes for getopt. */
|
||||
#include <stdlib.h>
|
||||
#endif /* GNU C library. */
|
||||
|
||||
/* If GETOPT_COMPAT is defined, `+' as well as `--' can introduce a
|
||||
long-named option. Because this is not POSIX.2 compliant, it is
|
||||
being phased out. */
|
||||
/* #define GETOPT_COMPAT */
|
||||
|
||||
/* This version of `getopt' appears to the caller like standard Unix `getopt'
|
||||
but it behaves differently for the user, since it allows the user
|
||||
to intersperse the options with the other arguments.
|
||||
|
||||
As `getopt' works, it permutes the elements of ARGV so that,
|
||||
when it is done, all the options precede everything else. Thus
|
||||
all application programs are extended to handle flexible argument order.
|
||||
|
||||
Setting the environment variable POSIXLY_CORRECT disables permutation.
|
||||
Then the behavior is completely standard.
|
||||
|
||||
GNU application programs can use a third alternative mode in which
|
||||
they can distinguish the relative order of options and other arguments. */
|
||||
|
||||
#include "getopt.h"
|
||||
|
||||
/* For communication from `getopt' to the caller.
|
||||
When `getopt' finds an option that takes an argument,
|
||||
the argument value is returned here.
|
||||
Also, when `ordering' is RETURN_IN_ORDER,
|
||||
each non-option ARGV-element is returned here. */
|
||||
|
||||
char *optarg = 0;
|
||||
|
||||
/* Index in ARGV of the next element to be scanned.
|
||||
This is used for communication to and from the caller
|
||||
and for communication between successive calls to `getopt'.
|
||||
|
||||
On entry to `getopt', zero means this is the first call; initialize.
|
||||
|
||||
When `getopt' returns EOF, this is the index of the first of the
|
||||
non-option elements that the caller should itself scan.
|
||||
|
||||
Otherwise, `optind' communicates from one call to the next
|
||||
how much of ARGV has been scanned so far. */
|
||||
|
||||
/* XXX 1003.2 says this must be 1 before any call. */
|
||||
int optind = 0;
|
||||
|
||||
/* The next char to be scanned in the option-element
|
||||
in which the last option character we returned was found.
|
||||
This allows us to pick up the scan where we left off.
|
||||
|
||||
If this is zero, or a null string, it means resume the scan
|
||||
by advancing to the next ARGV-element. */
|
||||
|
||||
static char *nextchar;
|
||||
|
||||
/* Callers store zero here to inhibit the error message
|
||||
for unrecognized options. */
|
||||
|
||||
int opterr = 1;
|
||||
|
||||
/* Set to an option character which was unrecognized.
|
||||
This must be initialized on some systems to avoid linking in the
|
||||
system's own getopt implementation. */
|
||||
|
||||
#define BAD_OPTION '\0'
|
||||
int optopt = BAD_OPTION;
|
||||
|
||||
/* Describe how to deal with options that follow non-option ARGV-elements.
|
||||
|
||||
If the caller did not specify anything,
|
||||
the default is REQUIRE_ORDER if the environment variable
|
||||
POSIXLY_CORRECT is defined, PERMUTE otherwise.
|
||||
|
||||
REQUIRE_ORDER means don't recognize them as options;
|
||||
stop option processing when the first non-option is seen.
|
||||
This is what Unix does.
|
||||
This mode of operation is selected by either setting the environment
|
||||
variable POSIXLY_CORRECT, or using `+' as the first character
|
||||
of the list of option characters.
|
||||
|
||||
PERMUTE is the default. We permute the contents of ARGV as we scan,
|
||||
so that eventually all the non-options are at the end. This allows options
|
||||
to be given in any order, even with programs that were not written to
|
||||
expect this.
|
||||
|
||||
RETURN_IN_ORDER is an option available to programs that were written
|
||||
to expect options and other ARGV-elements in any order and that care about
|
||||
the ordering of the two. We describe each non-option ARGV-element
|
||||
as if it were the argument of an option with character code 1.
|
||||
Using `-' as the first character of the list of option characters
|
||||
selects this mode of operation.
|
||||
|
||||
The special argument `--' forces an end of option-scanning regardless
|
||||
of the value of `ordering'. In the case of RETURN_IN_ORDER, only
|
||||
`--' can cause `getopt' to return EOF with `optind' != ARGC. */
|
||||
|
||||
static enum {
|
||||
REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
|
||||
} ordering;
|
||||
|
||||
#ifdef __GNU_LIBRARY__
|
||||
/* We want to avoid inclusion of string.h with non-GNU libraries
|
||||
because there are many ways it can cause trouble.
|
||||
On some systems, it contains special magic macros that don't work
|
||||
in GCC. */
|
||||
#include <string.h>
|
||||
#define my_index strchr
|
||||
#define my_strlen strlen
|
||||
#else
|
||||
|
||||
/* Avoid depending on library functions or files
|
||||
whose names are inconsistent. */
|
||||
|
||||
#if __STDC__ || defined(PROTO)
|
||||
extern char *getenv(const char *name);
|
||||
extern int strcmp(const char *s1, const char *s2);
|
||||
extern int strncmp(const char *s1, const char *s2, int n);
|
||||
|
||||
static int my_strlen(const char *s);
|
||||
static char *my_index(const char *str, int chr);
|
||||
#else
|
||||
extern char *getenv();
|
||||
#endif
|
||||
|
||||
static int my_strlen(const char *str)
|
||||
{
|
||||
int n = 0;
|
||||
while (*str++)
|
||||
n++;
|
||||
return n;
|
||||
}
|
||||
|
||||
static char *my_index(const char *str, int chr)
|
||||
{
|
||||
while (*str) {
|
||||
if (*str == chr)
|
||||
return (char *) str;
|
||||
str++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* GNU C library. */
|
||||
|
||||
/* Handle permutation of arguments. */
|
||||
|
||||
/* Describe the part of ARGV that contains non-options that have
|
||||
been skipped. `first_nonopt' is the index in ARGV of the first of them;
|
||||
`last_nonopt' is the index after the last of them. */
|
||||
|
||||
static int first_nonopt;
|
||||
static int last_nonopt;
|
||||
|
||||
/* Exchange two adjacent subsequences of ARGV.
|
||||
One subsequence is elements [first_nonopt,last_nonopt)
|
||||
which contains all the non-options that have been skipped so far.
|
||||
The other is elements [last_nonopt,optind), which contains all
|
||||
the options processed since those non-options were skipped.
|
||||
|
||||
`first_nonopt' and `last_nonopt' are relocated so that they describe
|
||||
the new indices of the non-options in ARGV after they are moved.
|
||||
|
||||
To perform the swap, we first reverse the order of all elements. So
|
||||
all options now come before all non options, but they are in the
|
||||
wrong order. So we put back the options and non options in original
|
||||
order by reversing them again. For example:
|
||||
original input: a b c -x -y
|
||||
reverse all: -y -x c b a
|
||||
reverse options: -x -y c b a
|
||||
reverse non options: -x -y a b c
|
||||
*/
|
||||
|
||||
#if __STDC__ || defined(PROTO)
|
||||
static void exchange(char **argv);
|
||||
#endif
|
||||
|
||||
static void exchange(char **argv)
|
||||
{
|
||||
char *temp, **first, **last;
|
||||
|
||||
/* Reverse all the elements [first_nonopt, optind) */
|
||||
first = &argv[first_nonopt];
|
||||
last = &argv[optind - 1];
|
||||
while (first < last) {
|
||||
temp = *first;
|
||||
*first = *last;
|
||||
*last = temp;
|
||||
first++;
|
||||
last--;
|
||||
}
|
||||
/* Put back the options in order */
|
||||
first = &argv[first_nonopt];
|
||||
first_nonopt += (optind - last_nonopt);
|
||||
last = &argv[first_nonopt - 1];
|
||||
while (first < last) {
|
||||
temp = *first;
|
||||
*first = *last;
|
||||
*last = temp;
|
||||
first++;
|
||||
last--;
|
||||
}
|
||||
|
||||
/* Put back the non options in order */
|
||||
first = &argv[first_nonopt];
|
||||
last_nonopt = optind;
|
||||
last = &argv[last_nonopt - 1];
|
||||
while (first < last) {
|
||||
temp = *first;
|
||||
*first = *last;
|
||||
*last = temp;
|
||||
first++;
|
||||
last--;
|
||||
}
|
||||
}
|
||||
|
||||
/* Scan elements of ARGV (whose length is ARGC) for option characters
|
||||
given in OPTSTRING.
|
||||
|
||||
If an element of ARGV starts with '-', and is not exactly "-" or "--",
|
||||
then it is an option element. The characters of this element
|
||||
(aside from the initial '-') are option characters. If `getopt'
|
||||
is called repeatedly, it returns successively each of the option characters
|
||||
from each of the option elements.
|
||||
|
||||
If `getopt' finds another option character, it returns that character,
|
||||
updating `optind' and `nextchar' so that the next call to `getopt' can
|
||||
resume the scan with the following option character or ARGV-element.
|
||||
|
||||
If there are no more option characters, `getopt' returns `EOF'.
|
||||
Then `optind' is the index in ARGV of the first ARGV-element
|
||||
that is not an option. (The ARGV-elements have been permuted
|
||||
so that those that are not options now come last.)
|
||||
|
||||
OPTSTRING is a string containing the legitimate option characters.
|
||||
If an option character is seen that is not listed in OPTSTRING,
|
||||
return BAD_OPTION after printing an error message. If you set `opterr' to
|
||||
zero, the error message is suppressed but we still return BAD_OPTION.
|
||||
|
||||
If a char in OPTSTRING is followed by a colon, that means it wants an arg,
|
||||
so the following text in the same ARGV-element, or the text of the following
|
||||
ARGV-element, is returned in `optarg'. Two colons mean an option that
|
||||
wants an optional arg; if there is text in the current ARGV-element,
|
||||
it is returned in `optarg', otherwise `optarg' is set to zero.
|
||||
|
||||
If OPTSTRING starts with `-' or `+', it requests different methods of
|
||||
handling the non-option ARGV-elements.
|
||||
See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
|
||||
|
||||
Long-named options begin with `--' instead of `-'.
|
||||
Their names may be abbreviated as long as the abbreviation is unique
|
||||
or is an exact match for some defined option. If they have an
|
||||
argument, it follows the option name in the same ARGV-element, separated
|
||||
from the option name by a `=', or else the in next ARGV-element.
|
||||
When `getopt' finds a long-named option, it returns 0 if that option's
|
||||
`flag' field is nonzero, the value of the option's `val' field
|
||||
if the `flag' field is zero.
|
||||
|
||||
The elements of ARGV aren't really const, because we permute them.
|
||||
But we pretend they're const in the prototype to be compatible
|
||||
with other systems.
|
||||
|
||||
LONGOPTS is a vector of `struct option' terminated by an
|
||||
element containing a name which is zero.
|
||||
|
||||
LONGIND returns the index in LONGOPT of the long-named option found.
|
||||
It is only valid when a long-named option has been found by the most
|
||||
recent call.
|
||||
|
||||
If LONG_ONLY is nonzero, '-' as well as '--' can introduce
|
||||
long-named options. */
|
||||
|
||||
int _getopt_internal(int argc, char *const *argv, const char *optstring,
|
||||
const struct option *longopts, int *longind, int long_only)
|
||||
{
|
||||
int option_index;
|
||||
|
||||
optarg = 0;
|
||||
|
||||
/* Initialize the internal data when the first call is made.
|
||||
Start processing options with ARGV-element 1 (since ARGV-element 0
|
||||
is the program name); the sequence of previously skipped
|
||||
non-option ARGV-elements is empty. */
|
||||
|
||||
if (optind == 0) {
|
||||
first_nonopt = last_nonopt = optind = 1;
|
||||
|
||||
nextchar = NULL;
|
||||
|
||||
/* Determine how to handle the ordering of options and nonoptions. */
|
||||
|
||||
if (optstring[0] == '-') {
|
||||
ordering = RETURN_IN_ORDER;
|
||||
++optstring;
|
||||
} else if (optstring[0] == '+') {
|
||||
ordering = REQUIRE_ORDER;
|
||||
++optstring;
|
||||
} else if (getenv("POSIXLY_CORRECT") != NULL)
|
||||
ordering = REQUIRE_ORDER;
|
||||
else
|
||||
ordering = PERMUTE;
|
||||
}
|
||||
|
||||
if (nextchar == NULL || *nextchar == '\0') {
|
||||
if (ordering == PERMUTE) {
|
||||
/* If we have just processed some options following some non-options,
|
||||
exchange them so that the options come first. */
|
||||
|
||||
if (first_nonopt != last_nonopt && last_nonopt != optind)
|
||||
exchange((char **) argv);
|
||||
else if (last_nonopt != optind)
|
||||
first_nonopt = optind;
|
||||
|
||||
/* Now skip any additional non-options
|
||||
and extend the range of non-options previously skipped. */
|
||||
|
||||
while (optind < argc && (argv[optind][0] != '-' || argv[optind][1] == '\0')
|
||||
#ifdef GETOPT_COMPAT
|
||||
&& (longopts == NULL
|
||||
|| argv[optind][0] != '+' || argv[optind][1] == '\0')
|
||||
#endif /* GETOPT_COMPAT */
|
||||
)
|
||||
optind++;
|
||||
last_nonopt = optind;
|
||||
}
|
||||
|
||||
/* Special ARGV-element `--' means premature end of options.
|
||||
Skip it like a null option,
|
||||
then exchange with previous non-options as if it were an option,
|
||||
then skip everything else like a non-option. */
|
||||
|
||||
if (optind != argc && !strcmp(argv[optind], "--")) {
|
||||
optind++;
|
||||
|
||||
if (first_nonopt != last_nonopt && last_nonopt != optind)
|
||||
exchange((char **) argv);
|
||||
else if (first_nonopt == last_nonopt)
|
||||
first_nonopt = optind;
|
||||
last_nonopt = argc;
|
||||
|
||||
optind = argc;
|
||||
}
|
||||
|
||||
/* If we have done all the ARGV-elements, stop the scan
|
||||
and back over any non-options that we skipped and permuted. */
|
||||
|
||||
if (optind == argc) {
|
||||
/* Set the next-arg-index to point at the non-options
|
||||
that we previously skipped, so the caller will digest them. */
|
||||
if (first_nonopt != last_nonopt)
|
||||
optind = first_nonopt;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
/* If we have come to a non-option and did not permute it,
|
||||
either stop the scan or describe it to the caller and pass it by. */
|
||||
|
||||
if ((argv[optind][0] != '-' || argv[optind][1] == '\0')
|
||||
#ifdef GETOPT_COMPAT
|
||||
&& (longopts == NULL || argv[optind][0] != '+' || argv[optind][1] == '\0')
|
||||
#endif /* GETOPT_COMPAT */
|
||||
) {
|
||||
if (ordering == REQUIRE_ORDER)
|
||||
return EOF;
|
||||
optarg = argv[optind++];
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* We have found another option-ARGV-element.
|
||||
Start decoding its characters. */
|
||||
|
||||
nextchar = (argv[optind] + 1 + (longopts != NULL && argv[optind][1] == '-'));
|
||||
}
|
||||
|
||||
if (longopts != NULL && ((argv[optind][0] == '-' && (argv[optind][1] == '-' || long_only))
|
||||
#ifdef GETOPT_COMPAT
|
||||
|| argv[optind][0] == '+'
|
||||
#endif /* GETOPT_COMPAT */
|
||||
)) {
|
||||
const struct option *p;
|
||||
char *s = nextchar;
|
||||
int exact = 0;
|
||||
int ambig = 0;
|
||||
const struct option *pfound = NULL;
|
||||
int indfound = 0;
|
||||
|
||||
while (*s && *s != '=')
|
||||
s++;
|
||||
|
||||
/* Test all options for either exact match or abbreviated matches. */
|
||||
for (p = longopts, option_index = 0; p->name; p++, option_index++)
|
||||
if (!strncmp(p->name, nextchar, s - nextchar)) {
|
||||
if (s - nextchar == my_strlen(p->name)) {
|
||||
/* Exact match found. */
|
||||
pfound = p;
|
||||
indfound = option_index;
|
||||
exact = 1;
|
||||
break;
|
||||
} else if (pfound == NULL) {
|
||||
/* First nonexact match found. */
|
||||
pfound = p;
|
||||
indfound = option_index;
|
||||
} else
|
||||
/* Second nonexact match found. */
|
||||
ambig = 1;
|
||||
}
|
||||
|
||||
if (ambig && !exact) {
|
||||
if (opterr)
|
||||
fprintf(stderr, "%s: option `%s' is ambiguous\n",
|
||||
argv[0], argv[optind]);
|
||||
nextchar += my_strlen(nextchar);
|
||||
optind++;
|
||||
return BAD_OPTION;
|
||||
}
|
||||
|
||||
if (pfound != NULL) {
|
||||
option_index = indfound;
|
||||
optind++;
|
||||
if (*s) {
|
||||
/* Don't test has_arg with >, because some C compilers don't
|
||||
allow it to be used on enums. */
|
||||
if (pfound->has_arg)
|
||||
optarg = s + 1;
|
||||
else {
|
||||
if (opterr) {
|
||||
if (argv[optind - 1][1] == '-')
|
||||
/* --option */
|
||||
fprintf(stderr,
|
||||
"%s: option `--%s' doesn't allow an argument\n",
|
||||
argv[0], pfound->name);
|
||||
else
|
||||
/* +option or -option */
|
||||
fprintf(stderr,
|
||||
"%s: option `%c%s' doesn't allow an argument\n",
|
||||
argv[0], argv[optind - 1][0],
|
||||
pfound->name);
|
||||
}
|
||||
nextchar += my_strlen(nextchar);
|
||||
return BAD_OPTION;
|
||||
}
|
||||
} else if (pfound->has_arg == 1) {
|
||||
if (optind < argc)
|
||||
optarg = argv[optind++];
|
||||
else {
|
||||
if (opterr)
|
||||
fprintf(stderr,
|
||||
"%s: option `%s' requires an argument\n",
|
||||
argv[0], argv[optind - 1]);
|
||||
nextchar += my_strlen(nextchar);
|
||||
return optstring[0] == ':' ? ':' : BAD_OPTION;
|
||||
}
|
||||
}
|
||||
nextchar += my_strlen(nextchar);
|
||||
if (longind != NULL)
|
||||
*longind = option_index;
|
||||
if (pfound->flag) {
|
||||
*(pfound->flag) = pfound->val;
|
||||
return 0;
|
||||
}
|
||||
return pfound->val;
|
||||
}
|
||||
/* Can't find it as a long option. If this is not getopt_long_only,
|
||||
or the option starts with '--' or is not a valid short
|
||||
option, then it's an error.
|
||||
Otherwise interpret it as a short option. */
|
||||
if (!long_only || argv[optind][1] == '-'
|
||||
#ifdef GETOPT_COMPAT
|
||||
|| argv[optind][0] == '+'
|
||||
#endif /* GETOPT_COMPAT */
|
||||
|| my_index(optstring, *nextchar) == NULL) {
|
||||
if (opterr) {
|
||||
if (argv[optind][1] == '-')
|
||||
/* --option */
|
||||
fprintf(stderr, "%s: unrecognized option `--%s'\n",
|
||||
argv[0], nextchar);
|
||||
else
|
||||
/* +option or -option */
|
||||
fprintf(stderr, "%s: unrecognized option `%c%s'\n",
|
||||
argv[0], argv[optind][0], nextchar);
|
||||
}
|
||||
nextchar = (char *) "";
|
||||
optind++;
|
||||
return BAD_OPTION;
|
||||
}
|
||||
}
|
||||
|
||||
/* Look at and handle the next option-character. */
|
||||
|
||||
{
|
||||
char c = *nextchar++;
|
||||
char *temp = my_index(optstring, c);
|
||||
|
||||
/* Increment `optind' when we start to process its last character. */
|
||||
if (*nextchar == '\0')
|
||||
++optind;
|
||||
|
||||
if (temp == NULL || c == ':') {
|
||||
if (opterr) {
|
||||
#if 0
|
||||
if (c < 040 || c >= 0177)
|
||||
fprintf(stderr,
|
||||
"%s: unrecognized option, character code 0%o\n",
|
||||
argv[0], c);
|
||||
else
|
||||
fprintf(stderr, "%s: unrecognized option `-%c'\n", argv[0],
|
||||
c);
|
||||
#else
|
||||
/* 1003.2 specifies the format of this message. */
|
||||
fprintf(stderr, "%s: illegal option -- %c\n", argv[0], c);
|
||||
#endif
|
||||
}
|
||||
optopt = c;
|
||||
return BAD_OPTION;
|
||||
}
|
||||
if (temp[1] == ':') {
|
||||
if (temp[2] == ':') {
|
||||
/* This is an option that accepts an argument optionally. */
|
||||
if (*nextchar != '\0') {
|
||||
optarg = nextchar;
|
||||
optind++;
|
||||
} else
|
||||
optarg = 0;
|
||||
nextchar = NULL;
|
||||
} else {
|
||||
/* This is an option that requires an argument. */
|
||||
if (*nextchar != '\0') {
|
||||
optarg = nextchar;
|
||||
/* If we end this ARGV-element by taking the rest as an arg,
|
||||
we must advance to the next element now. */
|
||||
optind++;
|
||||
} else if (optind == argc) {
|
||||
if (opterr) {
|
||||
#if 0
|
||||
fprintf(stderr,
|
||||
"%s: option `-%c' requires an argument\n",
|
||||
argv[0], c);
|
||||
#else
|
||||
/* 1003.2 specifies the format of this message. */
|
||||
fprintf(stderr,
|
||||
"%s: option requires an argument -- %c\n",
|
||||
argv[0], c);
|
||||
#endif
|
||||
}
|
||||
optopt = c;
|
||||
if (optstring[0] == ':')
|
||||
c = ':';
|
||||
else
|
||||
c = BAD_OPTION;
|
||||
} else
|
||||
/* We already incremented `optind' once;
|
||||
increment it again when taking next ARGV-elt as argument. */
|
||||
optarg = argv[optind++];
|
||||
nextchar = NULL;
|
||||
}
|
||||
}
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
int getopt(int argc, char *const *argv, const char *optstring)
|
||||
{
|
||||
return _getopt_internal(argc, argv, optstring, (const struct option *) 0, (int *) 0, 0);
|
||||
}
|
||||
|
||||
int getopt_long(int argc, char *const *argv, const char *options, const struct option long_options, int *opt_index)
|
||||
{
|
||||
return _getopt_internal(argc, argv, options, long_options, opt_index, 0);
|
||||
}
|
||||
|
||||
#endif /* _LIBC or not __GNU_LIBRARY__. */
|
||||
|
||||
#ifdef TEST
|
||||
|
||||
/* Compile with -DTEST to make an executable for use in testing
|
||||
the above definition of `getopt'. */
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int c;
|
||||
int digit_optind = 0;
|
||||
|
||||
while (1) {
|
||||
int this_option_optind = optind ? optind : 1;
|
||||
|
||||
c = getopt(argc, argv, "abc:d:0123456789");
|
||||
if (c == EOF)
|
||||
break;
|
||||
|
||||
switch (c) {
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
if (digit_optind != 0 && digit_optind != this_option_optind)
|
||||
printf("digits occur in two different argv-elements.\n");
|
||||
digit_optind = this_option_optind;
|
||||
printf("option %c\n", c);
|
||||
break;
|
||||
|
||||
case 'a':
|
||||
printf("option a\n");
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
printf("option b\n");
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
printf("option c with value `%s'\n", optarg);
|
||||
break;
|
||||
|
||||
case BAD_OPTION:
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("?? getopt returned character code 0%o ??\n", c);
|
||||
}
|
||||
}
|
||||
|
||||
if (optind < argc) {
|
||||
printf("non-option ARGV-elements: ");
|
||||
while (optind < argc)
|
||||
printf("%s ", argv[optind++]);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
#endif /* TEST */
|
||||
|
130
src/getopt.h
Normal file
130
src/getopt.h
Normal file
@ -0,0 +1,130 @@
|
||||
/* Declarations for getopt.
|
||||
Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any
|
||||
later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#ifndef _GETOPT_H
|
||||
#define _GETOPT_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* For communication from `getopt' to the caller.
|
||||
When `getopt' finds an option that takes an argument,
|
||||
the argument value is returned here.
|
||||
Also, when `ordering' is RETURN_IN_ORDER,
|
||||
each non-option ARGV-element is returned here. */
|
||||
|
||||
extern char *optarg;
|
||||
|
||||
/* Index in ARGV of the next element to be scanned.
|
||||
This is used for communication to and from the caller
|
||||
and for communication between successive calls to `getopt'.
|
||||
|
||||
On entry to `getopt', zero means this is the first call; initialize.
|
||||
|
||||
When `getopt' returns EOF, this is the index of the first of the
|
||||
non-option elements that the caller should itself scan.
|
||||
|
||||
Otherwise, `optind' communicates from one call to the next
|
||||
how much of ARGV has been scanned so far. */
|
||||
|
||||
extern int optind;
|
||||
|
||||
/* Callers store zero here to inhibit the error message `getopt' prints
|
||||
for unrecognized options. */
|
||||
|
||||
extern int opterr;
|
||||
|
||||
/* Set to an option character which was unrecognized. */
|
||||
|
||||
extern int optopt;
|
||||
|
||||
/* Describe the long-named options requested by the application.
|
||||
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
|
||||
of `struct option' terminated by an element containing a name which is
|
||||
zero.
|
||||
|
||||
The field `has_arg' is:
|
||||
no_argument (or 0) if the option does not take an argument,
|
||||
required_argument (or 1) if the option requires an argument,
|
||||
optional_argument (or 2) if the option takes an optional argument.
|
||||
|
||||
If the field `flag' is not NULL, it points to a variable that is set
|
||||
to the value given in the field `val' when the option is found, but
|
||||
left unchanged if the option is not found.
|
||||
|
||||
To have a long-named option do something other than set an `int' to
|
||||
a compiled-in constant, such as set a value from `optarg', set the
|
||||
option's `flag' field to zero and its `val' field to a nonzero
|
||||
value (the equivalent single-letter option character, if there is
|
||||
one). For long options that have a zero `flag' field, `getopt'
|
||||
returns the contents of the `val' field. */
|
||||
|
||||
struct option
|
||||
{
|
||||
#if __STDC__
|
||||
const char *name;
|
||||
#else
|
||||
char *name;
|
||||
#endif
|
||||
/* has_arg can't be an enum because some compilers complain about
|
||||
type mismatches in all the code that assumes it is an int. */
|
||||
int has_arg;
|
||||
int *flag;
|
||||
int val;
|
||||
};
|
||||
|
||||
/* Names for the values of the `has_arg' field of `struct option'. */
|
||||
|
||||
#define no_argument 0
|
||||
#define required_argument 1
|
||||
#define optional_argument 2
|
||||
|
||||
#if __STDC__ || defined(PROTO)
|
||||
#if defined(__GNU_LIBRARY__)
|
||||
/* Many other libraries have conflicting prototypes for getopt, with
|
||||
differences in the consts, in stdlib.h. To avoid compilation
|
||||
errors, only prototype getopt for the GNU C library. */
|
||||
extern int getopt (int argc, char *const *argv, const char *shortopts);
|
||||
#endif /* not __GNU_LIBRARY__ */
|
||||
extern int getopt_long (int argc, char *const *argv, const char *shortopts,
|
||||
const struct option *longopts, int *longind);
|
||||
extern int getopt_long_only (int argc, char *const *argv,
|
||||
const char *shortopts,
|
||||
const struct option *longopts, int *longind);
|
||||
|
||||
/* Internal only. Users should not call this directly. */
|
||||
extern int _getopt_internal (int argc, char *const *argv,
|
||||
const char *shortopts,
|
||||
const struct option *longopts, int *longind,
|
||||
int long_only);
|
||||
#else /* not __STDC__ */
|
||||
//JCMOD, needed to define the full deal here for VC++
|
||||
//extern int getopt ();
|
||||
extern int getopt (int argc, char *const *argv, const char *shortopts);
|
||||
extern int getopt_long ();
|
||||
extern int getopt_long_only ();
|
||||
|
||||
extern int _getopt_internal ();
|
||||
#endif /* not __STDC__ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _GETOPT_H */
|
||||
|
5
win32/Makefile.am
Normal file
5
win32/Makefile.am
Normal file
@ -0,0 +1,5 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
EXTRA_DIST = ezstream.dsp ezstream.dsw
|
118
win32/ezstream.dsp
Normal file
118
win32/ezstream.dsp
Normal file
@ -0,0 +1,118 @@
|
||||
# Microsoft Developer Studio Project File - Name="ezstream" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=ezstream - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "ezstream.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "ezstream.mak" CFG="ezstream - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "ezstream - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "ezstream - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "ezstream - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../libshout-2.0/include" /I "../src" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libshout.lib ..\..\oggvorbis-win32sdk-1.0.1\lib\ogg_static.lib ..\..\oggvorbis-win32sdk-1.0.1\lib\vorbis_static.lib ..\..\pthreads\pthreadVSE.lib ws2_32.lib winmm.lib /nologo /subsystem:console /machine:I386 /libpath:"../../libshout-2.0/win32/Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ezstream - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../libshout-2.0/include" /I "../src" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libshout.lib ..\..\oggvorbis-win32sdk-1.0.1\lib\ogg_static.lib ..\..\oggvorbis-win32sdk-1.0.1\lib\vorbis_static.lib ..\..\pthreads\pthreadVSE.lib ws2_32.lib winmm.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"../../libshout-2.0/win32/Debug"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "ezstream - Win32 Release"
|
||||
# Name "ezstream - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\src\configfile.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\src\configfile.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\src\ezstream.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\src\getopt.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\src\getopt.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
44
win32/ezstream.dsw
Normal file
44
win32/ezstream.dsw
Normal file
@ -0,0 +1,44 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "ezstream"=".\ezstream.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name libshout
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "libshout"="..\..\libshout-2.0\win32\libshout.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
39
win32/ezstream.iss
Normal file
39
win32/ezstream.iss
Normal file
@ -0,0 +1,39 @@
|
||||
; Script generated by the Inno Setup Script Wizard.
|
||||
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
|
||||
|
||||
[Setup]
|
||||
AppName=ezstream
|
||||
AppVerName=ezstream v0.1.0
|
||||
AppPublisherURL=http://www.icecast.org
|
||||
AppSupportURL=http://www.icecast.org
|
||||
AppUpdatesURL=http://www.icecast.org
|
||||
DefaultDirName={pf}\ezstream
|
||||
DefaultGroupName=ezstream
|
||||
AllowNoIcons=yes
|
||||
LicenseFile=..\COPYING
|
||||
InfoAfterFile=..\README
|
||||
OutputDir=.
|
||||
OutputBaseFilename=ezstream_win32_0.1.0_setup
|
||||
; uncomment the following line if you want your installation to run on NT 3.51 too.
|
||||
; MinVersion=4,3.51
|
||||
|
||||
[Tasks]
|
||||
Name: "desktopicon"; Description: "Create a &desktop icon"; GroupDescription: "Additional icons:"; MinVersion: 4,4
|
||||
|
||||
[Dirs]
|
||||
Name: "{app}"
|
||||
|
||||
|
||||
[Files]
|
||||
Source: "Release\ezstream.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "..\..\pthreads\pthreadVSE.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "..\conf\ezstream_mp3.xml"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "..\conf\ezstream_m3u.xml"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "..\conf\ezstream_vorbis.xml"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "..\..\iconv\lib\iconv.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "..\..\libxml2\lib\libxml2.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||
|
||||
[Icons]
|
||||
|
||||
[Run]
|
||||
|
Loading…
Reference in New Issue
Block a user