From fbb20e85ecb0419c4cb8143e3a3fcd0a6f31d9c4 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Thu, 13 Aug 1998 15:43:39 +0000 Subject: [PATCH] Initial revision --- CHANGELOG | 19 + COPYING | 340 ++++++++ Makefile | 46 ++ Makefile.conf | 29 + Makefile.conf.in | 29 + README | 15 + alsamixer/Makefile | 23 + alsamixer/alsamixer.c | 870 ++++++++++++++++++++ amixer/Makefile | 29 + amixer/README.first | 39 + amixer/amain.cpp | 256 ++++++ amixer/amixer | Bin 0 -> 26325 bytes amixer/amixer.cpp | 128 +++ amixer/amixer.h | 73 ++ amixer/atypes.h | 1 + aplay/Makefile | 34 + aplay/aplay | Bin 0 -> 85462 bytes aplay/aplay.c | 1153 +++++++++++++++++++++++++++ aplay/formats.h | 91 +++ config.cache | 29 + config.log | 32 + config.status | 245 ++++++ configure | 1622 ++++++++++++++++++++++++++++++++++++++ configure.in | 61 ++ include/Makefile | 10 + include/config.h | 6 + include/config.h.in | 5 + install-sh | 250 ++++++ utils/Makefile | 10 + utils/alsa-utils.spec | 73 ++ utils/alsa-utils.spec.in | 73 ++ utils/buildrpm | 35 + version | 1 + 33 files changed, 5627 insertions(+) create mode 100644 CHANGELOG create mode 100644 COPYING create mode 100644 Makefile create mode 100644 Makefile.conf create mode 100644 Makefile.conf.in create mode 100644 README create mode 100644 alsamixer/Makefile create mode 100644 alsamixer/alsamixer.c create mode 100644 amixer/Makefile create mode 100644 amixer/README.first create mode 100644 amixer/amain.cpp create mode 100644 amixer/amixer create mode 100644 amixer/amixer.cpp create mode 100644 amixer/amixer.h create mode 100644 amixer/atypes.h create mode 100644 aplay/Makefile create mode 100644 aplay/aplay create mode 100644 aplay/aplay.c create mode 100644 aplay/formats.h create mode 100644 config.cache create mode 100644 config.log create mode 100644 config.status create mode 100644 configure create mode 100644 configure.in create mode 100644 include/Makefile create mode 100644 include/config.h create mode 100644 include/config.h.in create mode 100644 install-sh create mode 100644 utils/Makefile create mode 100644 utils/alsa-utils.spec create mode 100644 utils/alsa-utils.spec.in create mode 100644 utils/buildrpm create mode 100644 version diff --git a/CHANGELOG b/CHANGELOG new file mode 100644 index 0000000..0fd93d5 --- /dev/null +++ b/CHANGELOG @@ -0,0 +1,19 @@ +0.0.3 -> 0.0.4 + +* added check for alsa-lib package +* added spec file for RPM + +0.0.2 -> 0.0.3 + +* included great ncurses alsamixer from Tim Janik +* enhanced Mixer from Andy Lo A Foe renamed to amixer + +0.0.1 -> 0.0.2 + +* fixed small bug in aplay in command line parsing +* fixed fragment size allocation for low rate files in aplay +* a little bit corrected output from Mixer + +0.0.1 + +* initial release (aplay, broken Mixer) diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..dc63aac --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, 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 + + Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + 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., 675 Mass Ave, Cambridge, MA 02139, 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) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e89c839 --- /dev/null +++ b/Makefile @@ -0,0 +1,46 @@ +# +# Makefile for ALSA Utilities +# Copyright (c) 1994-98 by Jaroslav Kysela +# + +ifeq (Makefile.conf,$(wildcard Makefile.conf)) +include Makefile.conf +else +dummy: + @echo + @echo "Please, run configure script as first..." + @echo +endif + + +all: + $(MAKE) -C aplay + $(MAKE) -C amixer + $(MAKE) -C alsamixer + @echo + @echo "ALSA Utilities were sucessfully compiled." + @echo + +install: all + $(INSTALL) -s -m 755 -o root -g root aplay/aplay ${bindir} + ln -sf aplay ${bindir}/arecord + $(INSTALL) -s -m 755 -o root -g root amixer/amixer ${bindir} + $(INSTALL) -s -m 755 -o root -g root alsamixer/alsamixer ${bindir} + +clean: + $(MAKE) -C include clean + $(MAKE) -C aplay clean + $(MAKE) -C amixer clean + $(MAKE) -C alsamixer clean + $(MAKE) -C utils clean + rm -f core .depend *.o *.orig *~ + rm -f `find . -name "out.txt"` + +pack: clean + rm -f config.cache config.log config.status Makefile.conf + chown -R root.root ../alsa-utils + tar cvz -C .. -f ../alsa-utils-$(SND_UTIL_VERSION).tar.gz alsa-utils + +publish: pack + cat ../alsa-utils-$(SND_UTIL_VERSION).tar.gz | \ + ssh -l root zarquon.jcu.cz /home/alsa/publishutils alsa-utils-$(SND_UTIL_VERSION).tar.gz diff --git a/Makefile.conf b/Makefile.conf new file mode 100644 index 0000000..306246e --- /dev/null +++ b/Makefile.conf @@ -0,0 +1,29 @@ +# Generated automatically from Makefile.conf.in by configure. +# +# Configuration Makefile for ALSA Utilities +# Copyright (c) 1994-98 by Jaroslav Kysela +# + +srcdir=. +prefix=/usr +exec_prefix=${prefix} +includedir=${prefix}/include +bindir=${exec_prefix}/bin +libdir=${exec_prefix}/lib +c_opts=-I/usr/include +INSTALL=/usr/bin/install -c +SND_UTIL_VERSION=0.0.4 +SND_UTIL_MAJOR=0 +SND_UTIL_MINOR=0 +SND_UTIL_SUBMINOR=4 + +CC=gcc +CPP=gcc +INCLUDE=-I/usr/local/include -I$(TOPDIR)/include +COPTS = $(c_opts) +COPTS += -Wall -Wstrict-prototypes -fomit-frame-pointer -pipe +LINKER=ld +SNDLIB=-lsound +NCURSESINC="" +NCURSESLIB=-lncurses +LN_S=@LN_S@ diff --git a/Makefile.conf.in b/Makefile.conf.in new file mode 100644 index 0000000..ed8edb9 --- /dev/null +++ b/Makefile.conf.in @@ -0,0 +1,29 @@ +# +# Configuration Makefile for ALSA Utilities +# Copyright (c) 1994-98 by Jaroslav Kysela +# + +srcdir=@srcdir@ +VPATH=@srcdir@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +includedir=@includedir@ +bindir=@bindir@ +libdir=@libdir@ +c_opts=@CFLAGS@ +INSTALL=@INSTALL@ +SND_UTIL_VERSION=@SND_UTIL_VERSION@ +SND_UTIL_MAJOR=@SND_UTIL_MAJOR@ +SND_UTIL_MINOR=@SND_UTIL_MINOR@ +SND_UTIL_SUBMINOR=@SND_UTIL_SUBMINOR@ + +CC=gcc +CPP=gcc +INCLUDE=-I/usr/local/include -I$(TOPDIR)/include +COPTS = $(c_opts) +COPTS += -Wall -Wstrict-prototypes -fomit-frame-pointer -pipe +LINKER=ld +SNDLIB=-lsound +NCURSESINC="" +NCURSESLIB=-lncurses +LN_S=@LN_S@ diff --git a/README b/README new file mode 100644 index 0000000..ecf5a00 --- /dev/null +++ b/README @@ -0,0 +1,15 @@ + + Advanced Linux Sound Architecture - Utilities + ============================================= + +This packages contains command line utilities for the ALSA project. +Package should be compiled only with installed ALSA driver and +ALSA C library. + +aplay/arecord - utility for playback / record of .wav,.voc,.au files +amixer - a command line mixer +alsamixer - ncurses mixer + +You should look for more info about ALSA project to http://alsa.jcu.cz. + + Jaroslav Kysela diff --git a/alsamixer/Makefile b/alsamixer/Makefile new file mode 100644 index 0000000..09db3b7 --- /dev/null +++ b/alsamixer/Makefile @@ -0,0 +1,23 @@ +# +# Makefile for Alsa Mixer +# + +TOPDIR = .. + +include $(TOPDIR)/Makefile.conf + +OBJECTS = alsamixer.o + +.SUFFIXES: +.SUFFIXES: .o .cpp .c .s .S + +.c.o: + $(CC) $(COPTS) $(INCLUDE) -DNCURSESINC=$(NCURSESINC) -c -o $*.o $< + +all: alsamixer + +alsamixer: $(OBJECTS) + $(CPP) -o alsamixer $(OBJECTS) $(SNDLIB) $(NCURSESLIB) + +clean: + rm -f *.o alsamixer *~ diff --git a/alsamixer/alsamixer.c b/alsamixer/alsamixer.c new file mode 100644 index 0000000..377ff71 --- /dev/null +++ b/alsamixer/alsamixer.c @@ -0,0 +1,870 @@ +/* AlsaMixer - Commandline mixer for the ALSA project + * Copyright (C) 1998 Jaroslav Kysela & Tim Janik + * + * 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 Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#ifndef NCURSESINC +#include +#else +#include NCURSESINC +#endif +#include + +#include + +/* example compilation commandline: + * clear; gcc -Wall -pipe -O2 alsamixer.c -o alsamixer -lncurses + */ + +/* --- defines --- */ +#define PRGNAME "alsamixer" +#define PRGNAME_UPPER "AlsaMixer" +#define VERSION "v0.9" + +#undef MAX +#define MAX(a, b) (((a) > (b)) ? (a) : (b)) +#undef MIN +#define MIN(a, b) (((a) < (b)) ? (a) : (b)) +#undef ABS +#define ABS(a) (((a) < 0) ? -(a) : (a)) +#undef CLAMP +#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x))) + +#define MIXER_MIN_X (23) /* minimum: 23 */ +#define MIXER_MIN_Y (19) /* minimum: 19 */ + +#define MIXER_BLACK (COLOR_BLACK) +#define MIXER_DARK_RED (COLOR_RED) +#define MIXER_RED (COLOR_RED | A_BOLD) +#define MIXER_GREEN (COLOR_GREEN | A_BOLD) +#define MIXER_ORANGE (COLOR_YELLOW) +#define MIXER_YELLOW (COLOR_YELLOW | A_BOLD) +#define MIXER_MARIN (COLOR_BLUE) +#define MIXER_BLUE (COLOR_BLUE | A_BOLD) +#define MIXER_MAGENTA (COLOR_MAGENTA) +#define MIXER_DARK_CYAN (COLOR_CYAN) +#define MIXER_CYAN (COLOR_CYAN | A_BOLD) +#define MIXER_GREY (COLOR_WHITE) +#define MIXER_GRAY (MIXER_GREY) +#define MIXER_WHITE (COLOR_WHITE | A_BOLD) + + +/* --- variables --- */ +static WINDOW *mixer_window = NULL; +static int mixer_max_x = 0; +static int mixer_max_y = 0; +static int mixer_ofs_x = 0; +static float mixer_extra_space = 0; +static int mixer_ofs_y = 0; +static int mixer_cbar_height = 0; + +static int card_id = 0; +static int mixer_id = 0; +static void *mixer_handle; +static char *mixer_card_name = NULL; +static char *mixer_device_name = NULL; + +static int mixer_n_channels = 0; +static int mixer_n_vis_channels = 0; +static int mixer_first_vis_channel = 0; +static int mixer_focus_channel = 0; +static int mixer_exact = 0; + +static int mixer_lvolume_delta = 0; +static int mixer_rvolume_delta = 0; +static int mixer_balance_volumes = 0; +static int mixer_toggle_mute_left = 0; +static int mixer_toggle_mute_right = 0; +static int mixer_toggle_record = 0; + + +/* --- draw contexts --- */ +enum +{ + DC_DEFAULT, + DC_BACK, + DC_TEXT, + DC_PROMPT, + DC_CBAR_MUTE, + DC_CBAR_NOMUTE, + DC_CBAR_RECORD, + DC_CBAR_NORECORD, + DC_CBAR_EMPTY, + DC_CBAR_FULL_1, + DC_CBAR_FULL_2, + DC_CBAR_FULL_3, + DC_CBAR_LABEL, + DC_CBAR_FOCUS_LABEL, + DC_FOCUS, + DC_LAST +}; + +static int dc_fg[DC_LAST] = { 0 }; +static int dc_attrib[DC_LAST] = { 0 }; +static int dc_char[DC_LAST] = { 0 }; +static int mixer_do_color = 1; + +static void +mixer_init_dc (int c, + int n, + int f, + int b, + int a) +{ + dc_fg[n] = f; + dc_attrib[n] = a; + dc_char[n] = c; + if (n > 0) + init_pair (n, dc_fg[n] & 0xf, b & 0x0f); +} + +static int +mixer_dc (int n) +{ + if (mixer_do_color) + attrset (COLOR_PAIR (n) | (dc_fg[n] & 0xfffffff0)); + else + attrset (dc_attrib[n]); + + return dc_char[n]; +} + +static void +mixer_init_draw_contexts (void) +{ + start_color (); + + mixer_init_dc ('.', DC_BACK, MIXER_WHITE, MIXER_BLACK, A_NORMAL); + mixer_init_dc ('.', DC_TEXT, MIXER_YELLOW, MIXER_BLACK, A_BOLD); + mixer_init_dc ('.', DC_PROMPT, MIXER_DARK_CYAN, MIXER_BLACK, A_NORMAL); + mixer_init_dc ('M', DC_CBAR_MUTE, MIXER_CYAN, MIXER_BLACK, A_BOLD); + mixer_init_dc ('-', DC_CBAR_NOMUTE, MIXER_CYAN, MIXER_BLACK, A_NORMAL); + mixer_init_dc ('x', DC_CBAR_RECORD, MIXER_DARK_RED, MIXER_BLACK, A_BOLD); + mixer_init_dc ('-', DC_CBAR_NORECORD, MIXER_GRAY, MIXER_BLACK, A_NORMAL); + mixer_init_dc (' ', DC_CBAR_EMPTY, MIXER_GRAY, MIXER_BLACK, A_DIM); + mixer_init_dc ('#', DC_CBAR_FULL_1, MIXER_WHITE, MIXER_BLACK, A_BOLD); + mixer_init_dc ('#', DC_CBAR_FULL_2, MIXER_GREEN, MIXER_BLACK, A_BOLD); + mixer_init_dc ('#', DC_CBAR_FULL_3, MIXER_RED, MIXER_BLACK, A_BOLD); + mixer_init_dc ('.', DC_CBAR_LABEL, MIXER_WHITE, MIXER_BLUE, A_REVERSE | A_BOLD); + mixer_init_dc ('.', DC_CBAR_FOCUS_LABEL, MIXER_RED, MIXER_BLUE, A_REVERSE | A_BOLD); + mixer_init_dc ('.', DC_FOCUS, MIXER_RED, MIXER_BLACK, A_BOLD); +} +#define DC_CBAR_FRAME (DC_CBAR_MUTE) +#define DC_FRAME (DC_PROMPT) + + +/* --- error types --- */ +typedef enum +{ + ERR_NONE, + ERR_OPEN, + ERR_FCN, + ERR_SIGNAL, + ERR_WINSIZE, +} ErrType; + + +/* --- prototypes --- */ +static void mixer_abort (ErrType error, + const char *err_string) + __attribute__ +((noreturn)); + + +/* --- functions --- */ +static void +mixer_clear (void) +{ + int x, y; + + mixer_dc (DC_BACK); + clear (); + + /* buggy ncurses doesn't really write spaces with the specified + * color into the screen on clear (); + */ + for (x = 0; x < mixer_max_x; x++) + for (y = 0; y < mixer_max_y; y++) + mvaddch (y, x, ' '); + refresh (); +} + +static void +mixer_abort (ErrType error, + const char *err_string) +{ + if (mixer_window) + { + mixer_clear (); + endwin (); + mixer_window = NULL; + } + printf ("\n"); + + switch (error) + { + case ERR_OPEN: + fprintf (stderr, + PRGNAME ": failed to open mixer #%i/#%i: %s\n", + card_id, + mixer_id, + snd_strerror(errno)); + break; + case ERR_FCN: + fprintf (stderr, + PRGNAME ": function %s failed: %s\n", + err_string, + snd_strerror(errno)); + break; + case ERR_SIGNAL: + fprintf (stderr, + PRGNAME ": aborting due to signal `%s'\n", + err_string); + break; + case ERR_WINSIZE: + fprintf (stderr, + PRGNAME ": screen size too small (%dx%d)\n", + mixer_max_x, + mixer_max_y); + break; + default: + break; + } + + exit (error); +} + +static int +mixer_cbar_get_pos (int channel_index, + int *x_p, + int *y_p) +{ + int x; + int y; + + if (channel_index < mixer_first_vis_channel || + channel_index - mixer_first_vis_channel >= mixer_n_vis_channels) + return FALSE; + + channel_index -= mixer_first_vis_channel; + + x = mixer_ofs_x + 1; + y = mixer_ofs_y; + x += channel_index * (3 + 2 + 3 + 1 + mixer_extra_space); + y += mixer_max_y / 2; + y += mixer_cbar_height / 2 + 1; + + if (x_p) + *x_p = x; + if (y_p) + *y_p = y; + + return TRUE; +} + +static void +mixer_update_cbar (int channel_index) +{ + char string[64]; + char c; + snd_mixer_channel_info_t cinfo = { 0 }; + snd_mixer_channel_t cdata = { 0 }; + int vleft, vright; + int x, y, i; + + + /* set specified EXACT mode + */ + if (snd_mixer_exact_mode(mixer_handle, mixer_exact)<0) + mixer_abort (ERR_FCN, "snd_mixer_exact"); + + /* set new channel indices and read info + */ + if (snd_mixer_channel_info(mixer_handle, channel_index, &cinfo)<0) + mixer_abort (ERR_FCN, "snd_mixer_channel_info"); + + /* set new channel values + */ + if (channel_index == mixer_focus_channel && + (mixer_lvolume_delta || mixer_rvolume_delta || + mixer_toggle_mute_left || mixer_toggle_mute_right || + mixer_balance_volumes || + mixer_toggle_record)) + { + if (snd_mixer_channel_read(mixer_handle, channel_index, &cdata)<0) + mixer_abort (ERR_FCN, "snd_mixer_channel_read"); + + cdata.flags &= ~SND_MIXER_FLG_DECIBEL; + cdata.left = CLAMP (cdata.left + mixer_lvolume_delta, cinfo.min, cinfo.max); + cdata.right = CLAMP (cdata.right + mixer_rvolume_delta, cinfo.min, cinfo.max); + mixer_lvolume_delta = mixer_rvolume_delta = 0; + if (mixer_balance_volumes) + { + cdata.left = (cdata.left + cdata.right) / 2; + cdata.right = cdata.left; + mixer_balance_volumes = 0; + } + if (mixer_toggle_mute_left) + { + if (cdata.flags & SND_MIXER_FLG_MUTE_LEFT) + cdata.flags &= ~SND_MIXER_FLG_MUTE_LEFT; + else + cdata.flags |= SND_MIXER_FLG_MUTE_LEFT; + } + if (mixer_toggle_mute_right) + { + if (cdata.flags & SND_MIXER_FLG_MUTE_RIGHT) + cdata.flags &= ~SND_MIXER_FLG_MUTE_RIGHT; + else + cdata.flags |= SND_MIXER_FLG_MUTE_RIGHT; + } + mixer_toggle_mute_left = mixer_toggle_mute_right = 0; + if (mixer_toggle_record) + { + if (cdata.flags & SND_MIXER_FLG_RECORD) + cdata.flags &= ~SND_MIXER_FLG_RECORD; + else + cdata.flags |= SND_MIXER_FLG_RECORD; + } + mixer_toggle_record = 0; + + if (snd_mixer_channel_write(mixer_handle, channel_index, &cdata)<0) + mixer_abort (ERR_FCN, "snd_mixer_channel_write"); + } + + /* first, read values for the numbers to be displayed in + * specified EXACT mode + */ + if (snd_mixer_channel_read(mixer_handle, channel_index, &cdata)<0) + mixer_abort (ERR_FCN, "snd_mixer_ioctl_channel_read"); + vleft = cdata.left; + vright = cdata.right; + + /* then, always use percentage values for the bars. if we don't do + * this, we will see aliasing effects on specific circumstances. + * (actually they don't really dissapear, but they are transfered + * to bar<->smaller-scale ambiguities). + */ + if (mixer_exact) + { + i = 0; + if (snd_mixer_exact_mode(mixer_handle, 0)<0) + mixer_abort (ERR_FCN, "snd_mixer_exact"); + if (snd_mixer_channel_read(mixer_handle, channel_index, &cdata)<0) + mixer_abort (ERR_FCN, "snd_mixer_channel_read"); + } + + /* get channel bar position + */ + if (!mixer_cbar_get_pos (channel_index, &x, &y)) + return; + + /* channel bar name + */ + mixer_dc (channel_index == mixer_focus_channel ? DC_CBAR_FOCUS_LABEL : DC_CBAR_LABEL); + cinfo.name[8] = 0; + for (i = 0; i < 8; i++) + { + string[i] = ' '; + } + sprintf(string + (8 - strlen (cinfo.name)) / 2, "%s ", cinfo.name); + string[8] = 0; + mvaddstr (y, x, string); + y--; + + /* current channel values + */ + mixer_dc (DC_BACK); + mvaddstr (y, x, " "); + mixer_dc (DC_TEXT); + sprintf (string, "%d", vleft); + mvaddstr (y, x + 3 - strlen (string), string); + mixer_dc (DC_CBAR_FRAME); + mvaddch (y, x + 3, '<'); + mvaddch (y, x + 4, '>'); + mixer_dc (DC_TEXT); + sprintf (string, "%d", vright); + mvaddstr (y, x + 5, string); + y--; + + /* left/right bar + */ + mixer_dc (DC_CBAR_FRAME); + mvaddstr (y, x, " "); + mvaddch (y, x + 2, ACS_LLCORNER); + mvaddch (y, x + 3, ACS_HLINE); + mvaddch (y, x + 4, ACS_HLINE); + mvaddch (y, x + 5, ACS_LRCORNER); + y--; + for (i = 0; i < mixer_cbar_height; i++) + { + mvaddstr (y - i, x, " "); + mvaddch (y - i, x + 2, ACS_VLINE); + mvaddch (y - i, x + 5, ACS_VLINE); + } + string[2] = 0; + for (i = 0; i < mixer_cbar_height; i++) + { + int dc; + + if (i + 1 >= 0.8 * mixer_cbar_height) + dc = DC_CBAR_FULL_3; + else if (i + 1 >= 0.4 * mixer_cbar_height) + dc = DC_CBAR_FULL_2; + else + dc = DC_CBAR_FULL_1; + mvaddch (y, x + 3, mixer_dc (cdata.left > i * 100 / mixer_cbar_height ? dc : DC_CBAR_EMPTY)); + mvaddch (y, x + 4, mixer_dc (cdata.right > i * 100 / mixer_cbar_height ? dc : DC_CBAR_EMPTY)); + y--; + } + + /* muted? + */ + mixer_dc (DC_BACK); + mvaddstr (y, x, " "); + c = cinfo.caps & SND_MIXER_CINFO_CAP_MUTE ? '-' : ' '; + mixer_dc (DC_CBAR_FRAME); + mvaddch (y, x + 2, ACS_ULCORNER); + mvaddch (y, x + 3, mixer_dc (cdata.flags & SND_MIXER_FLG_MUTE_LEFT ? + DC_CBAR_MUTE : DC_CBAR_NOMUTE)); + mvaddch (y, x + 4, mixer_dc (cdata.flags & SND_MIXER_FLG_MUTE_RIGHT ? + DC_CBAR_MUTE : DC_CBAR_NOMUTE)); + mixer_dc (DC_CBAR_FRAME); + mvaddch (y, x + 5, ACS_URCORNER); + y--; + + /* record input? + */ + if (cdata.flags & SND_MIXER_FLG_RECORD) + { + mixer_dc (DC_CBAR_RECORD); + mvaddstr (y, x + 1, "RECORD"); + } + else if (cinfo.caps & SND_MIXER_CINFO_CAP_RECORD) + for (i = 0; i < 6; i++) + mvaddch (y, x + 1 + i, mixer_dc (DC_CBAR_NORECORD)); + else + { + mixer_dc (DC_BACK); + mvaddstr (y, x, " "); + } + y--; +} + +static void +mixer_update_cbars (void) +{ + static int o_x = 0; + static int o_y = 0; + int i, x, y; + + if (!mixer_cbar_get_pos (mixer_focus_channel, &x, &y)) + { + if (mixer_focus_channel < mixer_first_vis_channel) + mixer_first_vis_channel = mixer_focus_channel; + else if (mixer_focus_channel >= mixer_first_vis_channel + mixer_n_vis_channels) + mixer_first_vis_channel = mixer_focus_channel - mixer_n_vis_channels + 1; + mixer_cbar_get_pos (mixer_focus_channel, &x, &y); + } + for (i = 0; i < mixer_n_vis_channels; i++) + mixer_update_cbar (i + mixer_first_vis_channel); + + /* draw focused cbar + */ + mixer_dc (DC_BACK); + mvaddstr (o_y, o_x, " "); + mvaddstr (o_y, o_x + 9, " "); + o_x = x - 1; + o_y = y; + mixer_dc (DC_FOCUS); + mvaddstr (o_y, o_x, "<"); + mvaddstr (o_y, o_x + 9, ">"); +} + +static void +mixer_draw_frame (void) +{ + char string[128]; + int i; + int max_len; + + mixer_dc (DC_FRAME); + + /* corners + */ + mvaddch (0, 0, ACS_ULCORNER); + mvaddch (mixer_max_y - 1, 0, ACS_LLCORNER); + mvaddch (mixer_max_y - 1, mixer_max_x - 1, ACS_LRCORNER); + mvaddch (0, mixer_max_x - 1, ACS_URCORNER); + + /* lines + */ + for (i = 1; i < mixer_max_y - 1; i++) + { + mvaddch (i, 0, ACS_VLINE); + mvaddch (i, mixer_max_x - 1, ACS_VLINE); + } + for (i = 1; i < mixer_max_x - 1; i++) + { + mvaddch (0, i, ACS_HLINE); + mvaddch (mixer_max_y - 1, i, ACS_HLINE); + } + + /* program title + */ + sprintf (string, "%s %s", PRGNAME_UPPER, VERSION); + max_len = strlen (string); + mvaddch (0, mixer_max_x / 2 - max_len / 2 - 1, '['); + mvaddch (0, mixer_max_x / 2 - max_len / 2 + max_len, ']'); + mixer_dc (DC_TEXT); + mvaddstr (0, mixer_max_x / 2 - max_len / 2, string); + + /* card name + */ + mixer_dc (DC_PROMPT); + mvaddstr (1, 2, "Card:"); + mixer_dc (DC_TEXT); + sprintf (string, "%s", mixer_card_name); + max_len = mixer_max_x - 2 - 6 - 2; + if (strlen (string) > max_len) + string[max_len] = 0; + mvaddstr (1, 2 + 6, string); + + /* device name + */ + mixer_dc (DC_PROMPT); + mvaddstr (2, 2, "Chip: "); + mixer_dc (DC_TEXT); + sprintf (string, "%s", mixer_device_name); + max_len = mixer_max_x - 2 - 6 - 2; + if (strlen (string) > max_len) + string[max_len] = 0; + mvaddstr (2, 2 + 6, string); +} + +static void +mixer_init (void) +{ + static snd_mixer_info_t mixer_info = { 0 }; + static struct snd_ctl_hw_info hw_info; + void *ctl_handle; + + if (snd_ctl_open( &ctl_handle, card_id ) < 0 ) + mixer_abort (ERR_OPEN, "snd_ctl_open" ); + if (snd_ctl_hw_info( ctl_handle, &hw_info ) < 0 ) + mixer_abort (ERR_FCN, "snd_ctl_hw_info" ); + snd_ctl_close( ctl_handle ); + /* open mixer device + */ + if (snd_mixer_open( &mixer_handle, card_id, mixer_id ) < 0) + mixer_abort (ERR_OPEN, "snd_mixer_open" ); + + /* setup global variables + */ + if (snd_mixer_info( mixer_handle, &mixer_info) < 0) + mixer_abort (ERR_FCN, "snd_mixer_info" ); + mixer_n_channels = mixer_info.channels; + mixer_card_name = hw_info.name; + mixer_device_name = mixer_info.name; +} + +static void +mixer_iteration_update(void *dummy, int channel) +{ + mixer_update_cbar(channel); + refresh (); +} + +static int +mixer_iteration (void) +{ + static snd_mixer_callbacks_t callbacks = { + NULL, + mixer_iteration_update, + }; + int key; + int finished = 0; + int mixer_fd; + fd_set in; + + mixer_fd = snd_mixer_file_descriptor( mixer_handle ); + while ( 1 ) { + FD_ZERO(&in); + FD_SET(fileno(stdin), &in); + FD_SET(mixer_fd, &in); + if (select(mixer_fd+1, &in, NULL, NULL, NULL)<=0) + return 1; + if (FD_ISSET(mixer_fd, &in)) + snd_mixer_read(mixer_handle, &callbacks); + if (FD_ISSET(fileno(stdin), &in)) break; + } + key = getch (); + switch (key) + { + case 27: /* Escape */ + finished = 1; + break; + case 9: /* Tab */ + mixer_exact = !mixer_exact; + break; + case KEY_RIGHT: + case 'n': + mixer_focus_channel += 1; + break; + case KEY_LEFT: + case 'p': + mixer_focus_channel -= 1; + break; + case KEY_PPAGE: + if (mixer_exact) + { + mixer_lvolume_delta = 8; + mixer_rvolume_delta = 8; + } + else + { + mixer_lvolume_delta = 10; + mixer_rvolume_delta = 10; + } + break; + case KEY_NPAGE: + if (mixer_exact) + { + mixer_lvolume_delta = -8; + mixer_rvolume_delta = -8; + } + else + { + mixer_lvolume_delta = -10; + mixer_rvolume_delta = -10; + } + break; + case KEY_BEG: + case KEY_HOME: + mixer_lvolume_delta = 512; + mixer_rvolume_delta = 512; + break; + case KEY_LL: + case KEY_END: + mixer_lvolume_delta = -512; + mixer_rvolume_delta = -512; + break; + case '+': + mixer_lvolume_delta = 1; + mixer_rvolume_delta = 1; + break; + case '-': + mixer_lvolume_delta = -1; + mixer_rvolume_delta = -1; + break; + case 'w': + case KEY_UP: + mixer_lvolume_delta = 1; + mixer_rvolume_delta = 1; + case 'W': + mixer_lvolume_delta += 1; + mixer_rvolume_delta += 1; + break; + case 'x': + case KEY_DOWN: + mixer_lvolume_delta = -1; + mixer_rvolume_delta = -1; + case 'X': + mixer_lvolume_delta += -1; + mixer_rvolume_delta += -1; + break; + case 'q': + mixer_lvolume_delta = 1; + case 'Q': + mixer_lvolume_delta += 1; + break; + case 'y': + case 'z': + mixer_lvolume_delta = -1; + case 'Y': + case 'Z': + mixer_lvolume_delta += -1; + break; + case 'e': + mixer_rvolume_delta = 1; + case 'E': + mixer_rvolume_delta += 1; + break; + case 'c': + mixer_rvolume_delta = -1; + case 'C': + mixer_rvolume_delta += -1; + break; + case 'm': + case 'M': + mixer_toggle_mute_left = 1; + mixer_toggle_mute_right = 1; + break; + case 'b': + case 'B': + case '=': + mixer_balance_volumes = 1; + break; + case '<': + case ',': + mixer_toggle_mute_left = 1; + break; + case '>': + case '.': + mixer_toggle_mute_right = 1; + break; + case 'R': + case 'r': + case 'L': + case 'l': + mixer_clear (); + break; + case ' ': + mixer_toggle_record = 1; + break; + } + mixer_focus_channel = CLAMP (mixer_focus_channel, 0, mixer_n_channels - 1); + + return finished; +} + +static void +mixer_init_screen (void) +{ + signal (SIGWINCH, (void *)mixer_init_screen); + + getmaxyx (mixer_window, mixer_max_y, mixer_max_x); + mixer_clear (); + mixer_max_x = MAX (MIXER_MIN_X, mixer_max_x); + mixer_max_y = MAX (MIXER_MIN_Y, mixer_max_y); + mixer_clear (); + mixer_ofs_x = 2; + mixer_ofs_y = 2; + mixer_extra_space = 0; + mixer_n_vis_channels = MIN ((mixer_max_x - 2 * mixer_ofs_x + 1) / (9 + mixer_extra_space), + mixer_n_channels); + mixer_extra_space = ((mixer_max_x - 2 * mixer_ofs_x - 1 - mixer_n_vis_channels * 9.0) / + (mixer_n_vis_channels - 1)); + if (mixer_n_vis_channels < mixer_n_channels) + { + /* recalc + */ + mixer_extra_space = MAX (mixer_extra_space, 1); + mixer_n_vis_channels = MIN ((mixer_max_x - 2 * mixer_ofs_x + 1) / (9 + mixer_extra_space), + mixer_n_channels); + mixer_extra_space = ((mixer_max_x - 2 * mixer_ofs_x - 1 - mixer_n_vis_channels * 9.0) / + (mixer_n_vis_channels - 1)); + } + mixer_first_vis_channel = 0; + mixer_cbar_height = 10 + MAX (0, (mixer_max_y - MIXER_MIN_Y - 1)) / 2; +} + +static void +mixer_signal_handler (int signal) +{ + mixer_abort (ERR_SIGNAL, sys_siglist[signal]); +} + +int +main (int argc, + char **argv) +{ + int opt; + + /* parse args + */ + do + { + opt = getopt (argc, argv, "c:m:ehg" ); + switch (opt) + { + case '?': + case 'h': + fprintf (stderr, "%s %s\n", PRGNAME_UPPER, VERSION); + fprintf (stderr, "Usage: %s [-e] [-c ] [-m ]\n", PRGNAME, snd_cards() ); + mixer_abort (ERR_NONE, ""); + case 'c': + card_id = snd_card_name( optarg ); + break; + case 'e': + mixer_exact = !mixer_exact; + break; + case 'g': + mixer_do_color = !mixer_do_color; + break; + case 'm': + mixer_id = CLAMP (optarg[0], '0', '1'); + break; + } + } + while (opt > 0); + + /* initialize mixer + */ + mixer_init (); + + /* setup signal handlers + */ + signal (SIGINT, mixer_signal_handler); + signal (SIGTRAP, mixer_signal_handler); + signal (SIGABRT, mixer_signal_handler); + signal (SIGQUIT, mixer_signal_handler); + signal (SIGBUS, mixer_signal_handler); + signal (SIGSEGV, mixer_signal_handler); + signal (SIGPIPE, mixer_signal_handler); + signal (SIGTERM, mixer_signal_handler); + + /* initialize ncurses + */ + mixer_window = initscr (); + if (mixer_do_color) + mixer_do_color = has_colors (); + mixer_init_draw_contexts (); + mixer_init_screen (); + if (mixer_max_x < MIXER_MIN_X || + mixer_max_y < MIXER_MIN_Y) + mixer_abort (ERR_WINSIZE, ""); + + /* react on key presses + * and draw window + */ + keypad (mixer_window, TRUE); + leaveok (mixer_window, TRUE); + cbreak (); + noecho (); + do + { + mixer_update_cbars (); + mixer_draw_frame (); + refresh (); + } + while (!mixer_iteration ()); + + mixer_abort (ERR_NONE, ""); +}; diff --git a/amixer/Makefile b/amixer/Makefile new file mode 100644 index 0000000..1f82b6f --- /dev/null +++ b/amixer/Makefile @@ -0,0 +1,29 @@ +# +# Makefile for Mixer +# + +TOPDIR = .. + +include $(TOPDIR)/Makefile.conf + +OBJECTS = amixer.o amain.o + +.SUFFIXES: +.SUFFIXES: .o .cpp .c .s .S + +.cpp.o: + $(CXX) $(COPTS) $(INCLUDE) -c -o $*.o $< + +all: amixer + +amixer.o: amixer.cpp + $(CXX) $(COPTS) $(INCLUDE) -c -o amixer.o amixer.cpp +amain.o: amain.cpp + $(CXX) $(COPTS) $(INCLUDE) -c -o amain.o amain.cpp + +amixer: $(OBJECTS) + $(CXX) -o amixer $(SNDLIB) $(OBJECTS) + +clean: + rm -f *.o amixer *~ + diff --git a/amixer/README.first b/amixer/README.first new file mode 100644 index 0000000..daf520a --- /dev/null +++ b/amixer/README.first @@ -0,0 +1,39 @@ +Intro +----- + +This is a quick mixer program for the ALSA project. It will grow out +to include a GTK interface eventually, if noone beats me to it :) + + +Building +-------- + +Edit the Makefile where the -I (include option) is. This should +point to the directory where the alsadriver is located. Then +type "make" and it should build without complaining. If you have +trouble with it please mail me at + + +Running +------- + +amixer -h should display the syntax + + +Bugs & Todo +----------- + +A lot, let me know.. + + +Changes +------- + +v0.001 March 20 1998 - Initial code +v0.1 Apr 21 1997 - Actually useful now + + +Contact +------- +Andy Lo A Foe +arloafoe@cs.vu.nl diff --git a/amixer/amain.cpp b/amixer/amain.cpp new file mode 100644 index 0000000..761a56a --- /dev/null +++ b/amixer/amain.cpp @@ -0,0 +1,256 @@ +/* + * Copyright 1998, Andy Lo A Foe + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include +#include +#include +#include +#include "amixer.h" + +#define MIXER_RC ".amixerrc" + +char *rc_file(void) +{ + static char rc_path[1024]; + char *p; + + p = getenv("HOME"); + if (p) { + sprintf(rc_path, "%s/%s", p, MIXER_RC); + } else { + printf("Error reading HOME env. variable\n"); + return NULL; + } + return rc_path; +} + +void copyright() +{ + printf("CLI ALSA Mixer v0.11 (c) 1998 Adnans\n\n"); +} + +void usage() +{ + printf("\n" + "Usage: amixer [-c card] [-d dev] device [vol|L:R] [mute|unmute] [rec|norec]\n\n" + " amixer [-p path] -r\tRead %s or settings\n" + " amixer -w\t\tWrite %s settings\n" + " amixer -q ...\t\tQuiet mode\n" + " amixer -h\t\tHelp\n\n" + "Example: amixer line-out 80:50 unmute rec\n\n", rc_file(), rc_file()); +} + + +void read_config(Mixer *mix, const char *path) +{ + FILE *rc; + char buf[1024]; + int opt1; + int opt2; + int left, right; + int dev; + int count = 0; + int flags; + + if ((rc = fopen(path ? path : rc_file(), "r")) == NULL) { + printf("Mixer values not read\n"); + return; + } + while (!feof(rc) && fgets(buf, 1024, rc)) { + count++; + if (buf[0] == '\n') + continue; + if (buf[0] == '#' || strlen(buf) == 0) + continue; + + if (sscanf(buf, "%d %d:%d %d %d\n", &dev, &left, &right, &opt1, &opt2) != 5) { + printf("WARNING: unable to make out line %d of .rc file -> \"%s\"\n", count, buf); + continue; + } + flags = 0; + if (opt1) flags |= E_MIXER_MUTE; + if (opt2) flags |= E_MIXER_RECORD; + // Set mixer settings + mix->DeviceSet(dev); + mix->Write(left, right, flags); + } + + fclose(rc); + return; +} + +void write_config(Mixer *mix) +{ + FILE *rc; + int32 left, right, flags; + + if ((rc = fopen(rc_file(), "w+")) == NULL) { + printf("Mixer values not written\n"); + return; + } + fprintf(rc, "# CLI ALSA mixer settings file. Autogenerated\n" + "# Modify at your own risk :)\n\n"); + for (int i=0; i < mix->NumDevices(); i++) { + mix->DeviceSet(i); + mix->Read(&left, &right, &flags); + fprintf(rc, "%d %d:%d %d %d\n", i, mix->Left(), mix->Right(), flags & E_MIXER_MUTE ? 1 : 0, flags & E_MIXER_RECORD ? 1 : 0); + } + fclose(rc); + return; +} + +int main(int argc, char **argv) +{ + int card = 0, device = 0; + char device_name[64] = ""; + int32 exact, mute, unmute, norec, rec, left, right, flags, device_index; + int32 left_dB, right_dB; + int32 cur_left, cur_right, cur_flags; + int count, quiet = 0; + int i,add; + int pathind = 0; + Mixer *the_mixer; + + exact = mute = rec = norec = unmute = device_index = left = right = -1; + left_dB = right_dB = -1; + + for (add = 0; add + 1 < argc; i++) { + if (!strcmp(argv[add+1],"--help")) { + usage(); + return 0; + } + if (argv[add+1][0] == '-') { + add++; + if (argv[add][1] == 'c') { + card = snd_card_name(argv[++add]); + if (card < 0) { + fprintf(stderr, "Invalid card: %s\n",argv[2]); + exit(1); + } + } else if (argv[add][1] == 'd') { + device = atoi(argv[++add]); + if (device < 0 || device > 128) { + fprintf(stderr, "Invalid device: %s\n",argv[2]); + exit(1); + } + } else if (argv[add][1] == 'h') { + usage(); + return 0; + } else if (argv[add][1] == 'p') { + pathind = ++add; + } else if (argv[add][1] == 'r') { + the_mixer = new Mixer(card,device); + if (the_mixer && the_mixer->Init()) read_config(the_mixer, pathind ? argv[pathind] : (const char *)NULL); + delete the_mixer; + return 0; + } else if (argv[add][1] == 'w') { + the_mixer = new Mixer(card,device); + if (the_mixer && the_mixer->Init()) write_config(the_mixer); + delete the_mixer; + return 0; + } else if (argv[add][1] == 'q') { + quiet = 1; + } else { + fprintf(stderr, "Invalid option: %s\n", argv[add]+1); + return 1; + } + } else { + break; + } + } + for (i=1+add; i < argc; i++) { + if (strcmp(argv[i],"exact")==0) { + exact = 1; + } else if (strcmp(argv[i],"mute")==0) { + mute = 1; + } else if (strcmp(argv[i],"unmute")==0) { + unmute = 1; + } else if (strcmp(argv[i],"rec")==0) { + rec = 1; + } else if (strcmp(argv[i],"norec")==0) { + norec = 1; + } else if (sscanf(argv[i], "%d:%d", &left, &right)==2) { + } else if (sscanf(argv[i], "%d", &left)==1) { + right = left; + } else if (sscanf(argv[i], "%s", device_name)==1) { + } else { + fprintf(stderr, "Wrong keyword: %s\n", argv[i]); + exit(1); + } + + } + Mixer mixer(card,device); + + if (mixer.Init() == false) { + fprintf(stderr, "Failed to open mixer device\n"); + return 1; + } + count = mixer.NumDevices(); + + for (i=0; i < count; i++) { + mixer.DeviceSet(i); + if (strcasecmp(device_name, mixer.Name())==0) + device_index = i; + } + if ( !quiet ) + copyright(); + if (device_index >= 0) { + mixer.DeviceSet(device_index); + mixer.Read(&cur_left, &cur_right, &cur_flags); + if (left >= 0) cur_left = left; + if (right >= 0) cur_right = right; + if (rec == 1) cur_flags |= E_MIXER_RECORD; + else if (norec == 1) cur_flags &= ~E_MIXER_RECORD; + if (mute == 1) cur_flags |= E_MIXER_MUTE; + else if (unmute == 1) cur_flags &= ~E_MIXER_MUTE; + if (left != -1 || rec != -1 || norec != -1 || mute != -1 || unmute != -1) { + mixer.Write(cur_left, cur_right, cur_flags); + } + if ( !quiet ) { + printf("%-16s", mixer.Name()); + mixer.Read(&left, &right, &flags); + mixer.Read_dB(&left_dB, &right_dB); + printf("%-3d%% (%6.2fdB) : %-3d%% (%6.2fdB) %s %s\n\n", + left, ((float)left_dB) / 100.0, + right, ((float)right_dB) / 100.0, + (flags & E_MIXER_MUTE) ? "Mute" : " ", + (flags & E_MIXER_RECORD) ? "Rec" : " " ); + } + } else { + if (quiet) { + usage(); + return 1; + } + if (strlen(device_name)) + printf("Device not found: %s\n\n", device_name); + for (i=0; i < count; i++) { + mixer.DeviceSet(i); + printf("%-16s", mixer.Name()); + mixer.Read(&left, &right, &flags); + mixer.Read_dB(&left_dB, &right_dB); + printf("%-3d%% (%6.2fdB) : %-3d%% (%6.2fdB) %s %s\n", + left, ((float)left_dB)/100.0, right, ((float)right_dB)/100.0, + (flags & E_MIXER_MUTE) ? "Mute" : " ", + (flags & E_MIXER_RECORD) ? "Rec" : " "); + } + return 0; + } + + return 0; +} diff --git a/amixer/amixer b/amixer/amixer new file mode 100644 index 0000000000000000000000000000000000000000..202cbc757cc74825a2ea46d00577553328608226 GIT binary patch literal 26325 zcmeHv4|tSUneQQ)&`F9Vw6u#B+mQwf?GQ4PKjaTsLJ}a?1g3-(D$waLGs!oQ%%t-t zK&3Wq;4af?G;ZtKYFF8{D%z^tyV{MmY8Lvm=vFV=?p@KM(u#JnVS7&YIc?fBWgP{oP!YL?9L_4_8#^_p zO1V^#TA<#ku2IubL|)YZWRUiQW-3B*AQdA06BBq$SAk|CkGgZMfv1qR-J}!~>#I`D z?*s1phQrCU92Fi1lkJjUfXsO_($fwn(*a;6^4Z4Xp2*h4J)uQCk!WgXc_LQsQK|{$ zObd|g$NOxc0`zhdqj~jSleV&%AZ|3lHCCaSFEw-ap#-VH#LUoD^$sN3j7Krj6+$Uh zhn)7f66rFt%#9qwRFz2ONVgy@L|TG059tOZ9xHUFmLZ>mbRCk|5c%aue}+U`y$k7` zNHs`hNK=n@qri(a3#oo86S&bVyWYmDw$XNSh7Ht$eh(7oz&z-Wzwh8&)3+!yOZ{?!_N6a!EVI-MnTLvu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6`|rmKYs;X?yZt&)cW%sLQ(5i6)G1}d2$%$ zd^~P>%an^)twTsdC*Rii{VV&G4#MpBSIaM&BZ!sEH%DevYyIn4{vtak;ESyBdUeod zGwyU}A8Z0;TEmnG+V;Av>QQS_y;^M|S0(rQ#2&0$qJQV(i3ekSyW)5ios?eN-t<~A zs`HVjyMAn9B{=X|hnyuo5LaWfRPe^Sh7oA&%0=3D@3E4;T1EwsWKg)g!mZ;Hw- zGx#Tksoucfsaui}T3JWv#?y1q3}3xY56-kAx&Xh@ZUUcar6*dd&4}eX-nBj6_msCu z3>A(dd|iq#)OGHiJYGUsp~3Y`bl@$N3z%TEZ?grD=2O*W#z+IW;h?8LfQP zg`&+%409ckUB~t| +#include +#include +#include +#include +#include +#include +#include +#include "amixer.h" + + +Mixer::Mixer(int card, int device) +{ + mixer_handle = NULL; + + if (snd_mixer_open(&mixer_handle, card, device) < 0) { + fprintf(stderr, "Can't access mixer %i/%i\n", card+1, device); + mixer_status = ~E_MIXER_SUCCESS; + return; + } + mixer_status = E_MIXER_SUCCESS; + mixer_status |= E_MIXER_NEED_CLOSE; +} + + +bool Mixer::Open(int card, int device) +{ + Close(); + if (snd_mixer_open(&mixer_handle, card, device) < 0) { + fprintf(stderr, "Can't access mixer %i/%i\n", card + 1, device); + mixer_status = ~E_MIXER_SUCCESS; + } else{ + mixer_status = E_MIXER_SUCCESS; + mixer_status |= E_MIXER_NEED_CLOSE; + } + return Init(); +} + + +void Mixer::Close() +{ + if (mixer_handle != NULL && mixer_status & E_MIXER_NEED_CLOSE) { + snd_mixer_close(mixer_handle); + } + mixer_handle = NULL; + mixer_status = ~E_MIXER_SUCCESS; +} + + +Mixer::~Mixer() +{ + Close(); +} + + +bool Mixer::Init() +{ + if (!(mixer_status & E_MIXER_SUCCESS)) + return false; + if ((nr_devices = snd_mixer_channels(mixer_handle)) < 0) + return false; + + return true; +} + + + +char* Mixer::Name() +{ + return Name(current_device); +} + +char* Mixer::Name(int32 device) +{ + if (snd_mixer_channel_info(mixer_handle,device,&ch_info) < 0) + return "Unknown"; + return (char *)ch_info.name; +} + +void Mixer::Update() +{ + if(snd_mixer_channel_read(mixer_handle, current_device, &ch_data) < 0) { + fprintf(stderr, "Can't read data from channel %i\n", current_device); + return; /* No fail code? */ + } +} + +void Mixer::DeviceRead(int32 device, int32 *left, int32 *right, int32 *flags) +{ + current_device = device; + Update(); + *left = ch_data.left; + *right = ch_data.right; + *flags = ch_data.flags; +} + + +void Mixer::DeviceWrite(int32 device, int32 left, int32 right, int32 flags) +{ + current_device = device; + ch_data.channel = device; + ch_data.left = left; + ch_data.right = right; + ch_data.flags = flags; + if(snd_mixer_channel_write(mixer_handle, device, &ch_data) < 0) { + fprintf(stderr, "Can't write data to channel %i\n", device); + return; /* No fail code? */ + } +} + diff --git a/amixer/amixer.h b/amixer/amixer.h new file mode 100644 index 0000000..84600ff --- /dev/null +++ b/amixer/amixer.h @@ -0,0 +1,73 @@ +/* + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include "atypes.h" + +#define E_MIXER_SUCCESS 1 +#define E_MIXER_NEED_CLOSE 2 + +#define E_MIXER_RECORD SND_MIXER_FLG_RECORD +#define E_MIXER_MUTE_LEFT SND_MIXER_FLG_MUTE_LEFT +#define E_MIXER_MUTE_RIGHT SND_MIXER_FLG_MUTE_RIGHT +#define E_MIXER_MUTE SND_MIXER_FLG_MUTE + + +class Mixer +{ +public: + Mixer(int card = 0, int device = 0); + ~Mixer(); + bool Init(); + bool Open(int card, int device); + void Close(); + void DeviceSet(int32 device) { + current_device = device; + Update(); + } + char* Name(int32 device); + char* Name(); + int32 NumDevices() { return nr_devices; } + void Update(); + void DeviceRead(int32 device, int32 *left, int32 *right, int32 *flag); + void DeviceWrite(int32 device, int32 left, int32 right, int32 flag); + void Read(int32 *left, int32 *right, int32 *flags) { + DeviceRead(current_device, left, right, flags); + } + void Read_dB(int32 *left_dB, int32 *right_dB) { + *left_dB = ch_data.left_dB; + *right_dB = ch_data.right_dB; + } + void Write(int32 left, int32 right, int32 flags) { + DeviceWrite(current_device, left, right, flags); + } + int Left() { return ch_data.left; } + int Right() { return ch_data.right; } + Mixer& operator[](int32 device) { + DeviceSet(device); + return (*this); + } +private: + snd_mixer_info_t info; + snd_mixer_channel_t ch_data; + snd_mixer_channel_info_t ch_info; + + void * mixer_handle; + int32 mixer_status; + int32 current_device; + int32 nr_devices; +}; diff --git a/amixer/atypes.h b/amixer/atypes.h new file mode 100644 index 0000000..8ccd461 --- /dev/null +++ b/amixer/atypes.h @@ -0,0 +1 @@ +typedef int int32; diff --git a/aplay/Makefile b/aplay/Makefile new file mode 100644 index 0000000..f797589 --- /dev/null +++ b/aplay/Makefile @@ -0,0 +1,34 @@ +# +# Makefile for aplay program +# Copyright (c) 1994-98 by Jaroslav Kysela +# + +TOPDIR=.. + +include $(TOPDIR)/Makefile.conf + +TARGET=aplay +TARGET1=arecord +OBJECTS=aplay.o + +.c.o: + $(CC) $(COPTS) $(INCLUDE) -c -o $*.o $< + +all: $(TARGET) + +$(TARGET): .depend $(OBJECTS) + $(CC) $(SNDLIB) $(OBJECTS) -o $(TARGET) + ln -sf $(TARGET) $(TARGET1) + +clean: + rm -f core .depend *.o *.orig *~ + +.depend: + $(CPP) $(COPTS) $(INCLUDE) -M *.c > .depend + +# +# include a dependency file if one exists +# +ifeq (.depend,$(wildcard .depend)) +include .depend +endif diff --git a/aplay/aplay b/aplay/aplay new file mode 100644 index 0000000000000000000000000000000000000000..67586888e7a74245a1a23a3483401636a64614d2 GIT binary patch literal 85462 zcmbrH3t&`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!thZKL~o;-=BRqV#G$>vsMdO1~rU zb;BL2pI2i_d^h?*UpIsr=<#~crM$jwXyo8c8vpLV*9~{<#+yMG`F-8+rqRz@d|w}Q z{_j%$x6iLbv_I6L6`dRbv=!Y(_gdrzOLu(_;W`0b-iaT!AFel>vtaiSB>uLcU_DB z>!9C_`H|Z(BL|v7(` z_Zi*S<6O>pqx*W?rtw(#LxPKKr_x z^Zy3uQa`@#=JoR`7)GHt+wqM?_w_Z8|5nh2zpt-3|95~cdgAM7F8_U?pY=%f-xD`x z=u0!P!J>9^e6V}-zN06PuHT1G(vEN9%l3ymeIaZP4)Ic>X3UqkeQLT|4!9Kl@+RLC zGN?tA7c4>z(`|~$W7qZSni$kgLZK}<|)+DdnijO=G`zDy|5%^Io5MCSZ z9WmL)@L+3q8`t+v&#c`WV86;PsuNu0{`SU3q+f8to}bP0cusx$0G|}Y7o8;B+u)7} z-8G}n?7yu2Gx`O@6L!krA^2f$dvACRU!SRV*4X};TBEV#gT1Z$a8EY|>9!nYD_=>i zcHoquim|R~_WI+S(S@m~lYFvM@ zF>b9-P*NADB{+=-VRa$K`SN%Opdav5pReR+Rh4)wYoW9v>@;w-us@nQh zds&6v`L^u>vt72zwA`a{;$|?vYdfUAty{AG|Jscun^>w{Shka~+H&RZGX9g^ZRHK{ z(i^SH{Z&%0vY+ZtZW~o&FVQR6KUMBR>Q{TU$}%@LP5mj`FZH6kq)yx)B`S=qS0`AC;_ literal 0 HcmV?d00001 diff --git a/aplay/aplay.c b/aplay/aplay.c new file mode 100644 index 0000000..f50ef63 --- /dev/null +++ b/aplay/aplay.c @@ -0,0 +1,1153 @@ +/* + * aplay.c - plays and records + * + * CREATIVE LABS VOICE-files + * Microsoft WAVE-files + * SPARC AUDIO .AU-files + * Raw Data + * + * Copyright (c) by Jaroslav Kysela + * Based on vplay program by Michael Beck + * + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "config.h" +#include "formats.h" + +#define DEFAULT_SPEED 8000 + +#define FORMAT_DEFAULT -1 +#define FORMAT_RAW 0 +#define FORMAT_VOC 1 +#define FORMAT_WAVE 2 +#define FORMAT_AU 3 + +/* global data */ + +char *command; +void *pcm_handle; +struct snd_pcm_playback_info pinfo; +struct snd_pcm_record_info rinfo; +snd_pcm_format_t rformat, format; +int timelimit = 0; +int quiet_mode = 0; +int verbose_mode = 0; +int active_format = FORMAT_DEFAULT; +int direction = SND_PCM_OPEN_PLAYBACK; +char *audiobuf = NULL; +int buffer_size = -1; + +int count; +int vocmajor, vocminor; + +/* needed prototypes */ + +static void playback( char *filename ); +static void record( char *filename ); + +static void begin_voc( int fd, u_long count ); +static void end_voc( int fd ); +static void begin_wave( int fd, u_long count ); +static void end_wave( int fd ); +static void begin_au( int fd, u_long count ); + +struct fmt_record { + void (*start)(int fd, u_long count); + void (*end) (int fd); + char *what; +} fmt_rec_table[] = { + { NULL, end_wave, "raw data" }, + { begin_voc, end_voc, "VOC" }, + { begin_wave, end_wave, "WAVE" }, + { begin_au, end_wave, "Sparc Audio" } +}; + +static char *get_format( int format ) +{ + static char *formats[] = { + "Mu-Law", + "A-Law", + "Ima-ADPCM", + "Unsigned 8-bit", + "Signed 16-bit Little Endian", + "Signed 16-bit Big Endian", + "Signed 8-bit", + "Unsigned 16-bit Little Endian", + "Unsigned 16-bit Big Endian", + "MPEG", + "GSM" + }; + if ( format < 0 || format > SND_PCM_SFMT_GSM ) + return "Unknown"; + return formats[ format ]; +} + +static void check_new_format( snd_pcm_format_t *format ) +{ + if ( direction == SND_PCM_OPEN_PLAYBACK ) { + if ( pinfo.min_rate > format -> rate || pinfo.max_rate < format -> rate ) { + fprintf( stderr, "%s: unsupported rate %iHz for playback (valid range is %iHz-%iHz)\n", command, format -> rate, pinfo.min_rate, pinfo.max_rate ); + exit( 1 ); + } + if ( format -> format != SND_PCM_SFMT_MU_LAW ) + if ( !(pinfo.formats & (1 << format -> format)) ) { + fprintf( stderr, "%s: requested format %s isn't supported with hardware\n", command, get_format( format -> format ) ); + exit( 1 ); + } + } else { + if ( rinfo.min_rate > format -> rate || rinfo.max_rate < format -> rate ) { + fprintf( stderr, "%s: unsupported rate %iHz for record (valid range is %iHz-%iHz)\n", command, format -> rate, rinfo.min_rate, rinfo.max_rate ); + exit( 1 ); + } + if ( format -> format != SND_PCM_SFMT_MU_LAW ) + if ( !(rinfo.formats & (1 << format -> format)) ) { + fprintf( stderr, "%s: requested format %s isn't supported with hardware\n", command, get_format( rformat.format ) ); + exit( 1 ); + } + } +} + +static void usage( char *command ) +{ + fprintf (stderr, +"Usage: %s [switches] [filename] ...\n" +"Available switches:\n" +"\n" +" -h,--help help\n" +" -V,--version print current version\n" +" -l list all soundcards and digital audio devices\n" +" -c select card # or card id (1-%i), defaults to 1\n" +" -d select device #, defaults to 0\n" +" -q quiet mode\n" +" -v file format Voc\n" +" -u file format Sparc Audio (.au)\n" +" -w file format Wave\n" +" -r file format Raw\n" +" -S stereo\n" +" -t timelimit (seconds)\n" +" -s speed (Hz)\n" +" -b sample size (8,16 bits)\n" +" -m set CD-ROM quality (44100Hz,stereo,16-bit linear)\n" +" -M set DAT quality (48000Hz,stereo,16-bit linear)\n" +" -p compression type (alaw, ulaw, adpcm)\n" +, command, snd_cards() ); +} + +static void device_list( void ) +{ + void *handle; + int card, err, dev, idx; + unsigned int mask; + struct snd_ctl_hw_info info; + snd_pcm_info_t pcminfo; + snd_pcm_playback_info_t playinfo; + snd_pcm_record_info_t recinfo; + + mask = snd_cards_mask(); + if ( !mask ) { + printf( "%s: no soundcards found...\n", command ); + return; + } + for ( card = 0; card < SND_CARDS; card++ ) { + if ( !(mask & (1 << card)) ) continue; + if ( (err = snd_ctl_open( &handle, card )) < 0 ) { + printf( "Error: control open (%i): %s\n", card, snd_strerror( err ) ); + continue; + } + if ( (err = snd_ctl_hw_info( handle, &info )) < 0 ) { + printf( "Error: control hardware info (%i): %s\n", card, snd_strerror( err ) ); + snd_ctl_close( handle ); + continue; + } + for ( dev = 0; dev < info.pcmdevs; dev++ ) { + if ( (err = snd_ctl_pcm_info( handle, dev, &pcminfo )) < 0 ) { + printf( "Error: control digital audio info (%i): %s\n", card, snd_strerror( err ) ); + continue; + } + printf( "%s: %i [%s] / #%i: %s\n", + info.name, + card + 1, + info.id, + dev, + pcminfo.name ); + printf( " Directions: %s%s%s\n", + pcminfo.flags & SND_PCM_INFO_PLAYBACK ? "playback " : "", + pcminfo.flags & SND_PCM_INFO_RECORD ? "record " : "", + pcminfo.flags & SND_PCM_INFO_DUPLEX ? "duplex " : "" ); + if ( (err = snd_ctl_pcm_playback_info( handle, dev, &playinfo )) < 0 ) { + printf( "Error: control digital audio playback info (%i): %s\n", card, snd_strerror( err ) ); + continue; + } + if ( pcminfo.flags & SND_PCM_INFO_PLAYBACK ) { + printf( " Playback:\n" ); + printf( " Speed range: %iHz-%iHz\n", playinfo.min_rate, playinfo.max_rate ); + printf( " Voices range: %i-%i\n", playinfo.min_channels, playinfo.max_channels ); + printf( " Formats:\n" ); + for ( idx = 0; idx < SND_PCM_SFMT_GSM; idx++ ) { + if ( playinfo.formats & (1 << idx) ) + printf( " %s\n", get_format( idx ) ); + } + if ( (err = snd_ctl_pcm_record_info( handle, dev, &recinfo )) < 0 ) { + printf( "Error: control digital audio record info (%i): %s\n", card, snd_strerror( err ) ); + continue; + } + } + if ( pcminfo.flags & SND_PCM_INFO_RECORD ) { + printf( " Record:\n" ); + printf( " Speed range: %iHz-%iHz\n", recinfo.min_rate, recinfo.max_rate ); + printf( " Voices range: %i-%i\n", recinfo.min_channels, recinfo.max_channels ); + printf( " Formats:\n" ); + for ( idx = 0; idx < SND_PCM_SFMT_GSM; idx++ ) { + if ( recinfo.formats & (1 << idx) ) + printf( " %s\n", get_format( idx ) ); + } + } + } + snd_ctl_close( handle ); + } +} + +static void version( void ) +{ + printf( "%s: version " SND_UTIL_VERSION " by Jaroslav Kysela \n", command ); +} + +int main( int argc, char *argv[] ) +{ + int card, dev, tmp, err, c; + + card = 0; + dev = 0; + command = argv[0]; + active_format = FORMAT_DEFAULT; + if ( strstr( argv[0], "arecord" ) ) { + direction = SND_PCM_OPEN_RECORD; + active_format = FORMAT_WAVE; + command = "Arecord"; + } else if ( strstr( argv[0], "aplay" ) ) { + direction = SND_PCM_OPEN_PLAYBACK; + command = "Aplay"; + } else { + fprintf( stderr, "Error: command should be named either arecord or aplay\n"); + return 1; + } + + buffer_size = -1; + memset( &rformat, 0, sizeof( rformat ) ); + rformat.format = SND_PCM_SFMT_U8; + rformat.rate = DEFAULT_SPEED; + rformat.channels = 1; + + if ( argc > 1 && !strcmp( argv[1], "--help" ) ) { + usage( command ); + return 0; + } + if ( argc > 1 && !strcmp( argv[1], "--version" ) ) { + version(); + return 0; + } + while ( (c = getopt( argc, argv, "hlc:d:qs:So:t:b:vrwuxB:c:p:mM" )) != EOF ) + switch ( c ) { + case 'h': + usage( command ); + return 0; + case 'l': + device_list(); + return 0; + case 'c': + card = snd_card_name( optarg ); + if ( card < 0 ) { + fprintf( stderr, "Error: soundcard '%s' not found\n", optarg ); + return 1; + } + break; + case 'd': + dev = atoi( optarg ); + if ( dev < 0 || dev > 32 ) { + fprintf( stderr, "Error: device %i is invalid\n", dev ); + return 1; + } + break; + case 'S': + rformat.channels = 2; + break; + case 'o': + tmp = atoi( optarg ); + if ( tmp < 1 || tmp > 32 ) { + fprintf( stderr, "Error: value %i for channels is invalid\n", tmp ); + return 1; + } + break; + case 'q': + quiet_mode = 1; + break; + case 'r': + active_format = FORMAT_RAW; + break; + case 'v': + active_format = FORMAT_VOC; + break; + case 'w': + active_format = FORMAT_WAVE; + break; + case 'u': + active_format = FORMAT_AU; + rformat.format = SND_PCM_SFMT_MU_LAW; + break; + case 's': + tmp = atoi( optarg ); + if ( tmp < 300 ) + tmp *= 1000; + rformat.rate = tmp; + if ( tmp < 2000 || tmp > 128000 ) { + fprintf( stderr, "Error: bad speed value %i\n", tmp ); + return 1; + } + break; + case 't': + timelimit = atoi( optarg ); + break; + case 'b': + tmp = atoi( optarg ); + switch( tmp ) { + case 8: + rformat.format = SND_PCM_SFMT_U8; + break; + case 16: + rformat.format = SND_PCM_SFMT_S16_LE; + break; + } + break; + case 'x': + verbose_mode = 1; quiet_mode = 0; + break; + case 'p': + if ( !strcmp( optarg, "alaw" ) ) { + rformat.format = SND_PCM_SFMT_A_LAW; + active_format = FORMAT_RAW; + break; + } else if ( !strcmp( optarg, "ulaw" ) || !strcmp( optarg, "mulaw" ) ) { + rformat.format = SND_PCM_SFMT_MU_LAW; + active_format = FORMAT_RAW; + break; + } if ( !strcmp( optarg, "adpcm" ) ) { + rformat.format = SND_PCM_SFMT_IMA_ADPCM; + active_format = FORMAT_RAW; + break; + } + fprintf( stderr, "Error: wrong extended format '%s'\n", optarg ); + return 1; + case 'm': + case 'M': + rformat.format = SND_PCM_SFMT_S16_LE; + rformat.rate = c == 'M' ? 48000 : 44100; + rformat.channels = 2; + break; + case 'V': + version(); + return 0; + default: + usage( command ); + return 1; + } + + if ( !quiet_mode ) + version(); + + if ( (err = snd_pcm_open( &pcm_handle, card, dev, direction )) < 0 ) { + fprintf( stderr, "Error: audio open error: %s\n", snd_strerror( err ) ); + return 1; + } + + if ( direction == SND_PCM_OPEN_PLAYBACK ) { + if ( (err = snd_pcm_playback_info( pcm_handle, &pinfo )) < 0 ) { + fprintf( stderr, "Error: playback info error: %s\n", snd_strerror( err ) ); + return 1; + } + tmp = pinfo.buffer_size; + tmp /= 4; /* 4 fragments are best */ + } else { + if ( (err = snd_pcm_record_info( pcm_handle, &rinfo )) < 0 ) { + fprintf( stderr, "Error: record info error: %s\n", snd_strerror( err ) ); + return 1; + } + tmp = rinfo.buffer_size; + tmp /= 8; /* 8 fragments are best */ + } + + buffer_size = tmp; + if (buffer_size < 512 || buffer_size > 16L * 1024L * 1024L ) { + fprintf( stderr, "Error: Invalid audio buffer size %d\n", buffer_size ); + return 1; + } + + check_new_format( &rformat ); + format = rformat; + + if ( (audiobuf = malloc( buffer_size )) == NULL ) { + fprintf( stderr, "%s: unable to allocate input/output buffer\n", command ); + return 1; + } + + if ( optind > argc - 1 ) { + if ( direction == SND_PCM_OPEN_PLAYBACK ) + playback( NULL ); + else + record( NULL ); + } else { + while ( optind <= argc - 1 ) { + if ( direction == SND_PCM_OPEN_PLAYBACK ) + playback( argv[optind++] ); + else + record( argv[optind++] ); + } + } + snd_pcm_close( pcm_handle ); + return 0; +} + +/* + * Test, if it is a .VOC file and return >=0 if ok (this is the length of rest) + * < 0 if not + */ +static int test_vocfile(void *buffer) +{ + VocHeader *vp = buffer; + + if (strstr(vp->magic, VOC_MAGIC_STRING) ) { + vocminor = vp->version & 0xFF; + vocmajor = vp->version / 256; + if (vp->version != (0x1233 - vp->coded_ver) ) + return -2; /* coded version mismatch */ + return vp->headerlen - sizeof(VocHeader); /* 0 mostly */ + } + return -1; /* magic string fail */ +} + +/* + * test, if it's a .WAV file, 0 if ok (and set the speed, stereo etc.) + * < 0 if not + */ +static int test_wavefile( void *buffer ) +{ + WaveHeader *wp = buffer; + + if (wp->main_chunk == WAV_RIFF && wp->chunk_type == WAV_WAVE && + wp->sub_chunk == WAV_FMT && wp->data_chunk == WAV_DATA) { + if (wp->format != WAV_PCM_CODE) { + fprintf( stderr, "%s: can't play not PCM-coded WAVE-files\n", command); + exit( 1 ); + } + if (wp -> modus < 1 || wp->modus > 32) { + fprintf(stderr, "%s: can't play WAVE-files with %d tracks\n", + command, wp->modus); + exit( 1 ); + } + format.channels = wp->modus; + switch ( wp->bit_p_spl ) { + case 8: + format.format = SND_PCM_SFMT_U8; + break; + case 16: + format.format = SND_PCM_SFMT_S16_LE; + break; + default: + fprintf(stderr, "%s: can't play WAVE-files with sample %d bits wide\n", + command, wp->bit_p_spl); + } + format.rate = wp -> sample_fq; + count = wp -> data_length; + check_new_format( &format ); + return 0; + } + return -1; +} + +/* + * + */ + +static int test_au( int fd, void *buffer ) +{ + AuHeader *ap = buffer; + + if ( ntohl( ap -> magic ) != AU_MAGIC ) + return -1; + if ( ntohl( ap -> hdr_size ) > 128 || ntohl( ap -> hdr_size ) < 24 ) + return -1; + count = ntohl( ap -> data_size ); + switch ( ntohl( ap -> encoding ) ) { + case AU_FMT_ULAW: + format.format = SND_PCM_SFMT_MU_LAW; + break; + case AU_FMT_LIN8: + format.format = SND_PCM_SFMT_U8; + break; + case AU_FMT_LIN16: + format.format = SND_PCM_SFMT_U16_LE; + break; + default: + return -1; + } + format.rate = ntohl( ap -> sample_rate ); + if ( format.rate < 2000 || format.rate > 256000 ) return -1; + format.channels = ntohl( ap -> channels ); + if ( format.channels < 1 || format.channels > 128 ) return -1; + if ( read( fd, buffer + sizeof( AuHeader ), ntohl( ap -> hdr_size ) - sizeof( AuHeader ) ) < 0 ) { + fprintf( stderr, "%s: read error\n", command ); + exit( 1 ); + } + check_new_format( &format ); + return 0; +} + +/* + * writing zeros from the zerobuf to simulate silence, + * perhaps it's enough to use a long var instead of zerobuf ? + */ +static void write_zeros( unsigned x ) +{ + unsigned l; + char *buf; + + buf = (char *)malloc( buffer_size ); + if ( !buf ) { + fprintf( stderr, "%s: can allocate buffer for zeros\n", command ); + return; /* not fatal error */ + } + memset( buf, 128, buffer_size ); + while ( x > 0 ) { + l = x; + if ( l > buffer_size ) l = buffer_size; + if ( snd_pcm_write( pcm_handle, buf, l ) != l ) { + fprintf( stderr, "%s: write error\n", command ); + exit( 1 ); + } + x -= l; + } +} + +static void set_format(void) +{ + unsigned int bps; /* bytes per second */ + unsigned int size; /* fragment size */ + struct snd_pcm_playback_params pparams; + struct snd_pcm_record_params rparams; + + bps = format.rate * format.channels; + switch ( format.format ) { + case SND_PCM_SFMT_U16_LE: + case SND_PCM_SFMT_U16_BE: + bps <<= 1; + break; + case SND_PCM_SFMT_IMA_ADPCM: + bps >>= 2; + break; + } + bps >>= 2; /* ok.. this buffer should be 0.25 sec */ + if ( bps < 16 ) bps = 16; + size = buffer_size; + while ( size > bps ) size >>= 1; + if ( size < 16 ) size = 16; + + if ( direction == SND_PCM_OPEN_PLAYBACK ) { + if ( snd_pcm_playback_format( pcm_handle, &format ) < 0 ) { + fprintf( stderr, "%s: unable to set playback format %s, %iHz, %i voices\n", command, get_format( format.format ), format.rate, format.channels ); + exit( 1 ); + } + memset( &pparams, 0, sizeof( pparams ) ); + pparams.fragment_size = size; + pparams.fragments_max = -1; /* little trick */ + pparams.fragments_room = 1; + if ( snd_pcm_playback_params( pcm_handle, &pparams ) < 0 ) { + fprintf( stderr, "%s: unable to set playback params\n", command ); + exit( 1 ); + } + } else { + if ( snd_pcm_record_format( pcm_handle, &format ) < 0 ) { + fprintf( stderr, "%s: unable to set record format %s, %iHz, %i voices\n", command, get_format( format.format ), format.rate, format.channels ); + exit( 1 ); + } + memset( &rparams, 0, sizeof( rparams ) ); + rparams.fragment_size = size; + rparams.fragments_min = 1; + if ( snd_pcm_record_params( pcm_handle, &rparams ) < 0 ) { + fprintf( stderr, "%s: unable to set record params\n", command ); + exit( 1 ); + } + } +} + +/* + * ok, let's play a .voc file + */ + +static void voc_play( int fd, int ofs, char *name ) +{ + int l; + VocBlockType *bp; + VocVoiceData *vd; + VocExtBlock *eb; + u_long nextblock, in_buffer; + u_char *data = audiobuf; + char was_extended = 0, output = 0; + u_short *sp, repeat = 0; + u_long silence; + int filepos = 0; + +#define COUNT(x) nextblock -= x; in_buffer -=x ;data += x +#define COUNT1(x) in_buffer -=x ;data += x + + if ( !quiet_mode ) { + fprintf( stderr, "Playing Creative Labs Voice file '%s'...\n", name ); + } + + /* first we waste the rest of header, ugly but we don't need seek */ + while ( ofs > buffer_size ) { + if ( read( fd, audiobuf, buffer_size ) != buffer_size ) { + fprintf( stderr, "%s: read error\n", command ); + exit( 1 ); + } + ofs -= buffer_size; + } + if (ofs) + if ( read( fd, audiobuf, ofs ) != ofs ) { + fprintf( stderr, "%s: read error\n", command ); + exit( 1 ); + } + + format.format = SND_PCM_SFMT_U8; + format.channels = 1; + format.rate = DEFAULT_SPEED; + set_format(); + + in_buffer = nextblock = 0; + while (1) { + Fill_the_buffer: /* need this for repeat */ + if ( in_buffer < 32 ) { + /* move the rest of buffer to pos 0 and fill the audiobuf up */ + if (in_buffer) + memcpy (audiobuf, data, in_buffer); + data = audiobuf; + if ((l = read (fd, audiobuf + in_buffer, buffer_size - in_buffer) ) > 0) + in_buffer += l; + else if (! in_buffer) { + /* the file is truncated, so simulate 'Terminator' + and reduce the datablock for save landing */ + nextblock = audiobuf[0] = 0; + if (l == -1) { + perror (name); + exit (-1); + } + } + } + while (! nextblock) { /* this is a new block */ + if (in_buffertype) { + case 0: +#if 0 + d_printf ("Terminator\n"); +#endif + return; /* VOC-file stop */ + case 1: + vd = (VocVoiceData *)data; COUNT1(sizeof(VocVoiceData)); + /* we need a SYNC, before we can set new SPEED, STEREO ... */ + + if (! was_extended) { + format.rate = (int)(vd->tc); + format.rate = 1000000 / (256 - format.rate); +#if 0 + d_printf ("Voice data %d Hz\n", dsp_speed); +#endif + if (vd->pack) { /* /dev/dsp can't it */ + fprintf (stderr, "%s: can't play packed .voc files\n", command); + return; + } + if (format.channels == 2) { /* if we are in Stereo-Mode, switch back */ + format.channels = 1; + set_format(); + } + } + else { /* there was extended block */ + format.channels = 2; + was_extended = 0; + } + set_format(); + break; + case 2: /* nothing to do, pure data */ +#if 0 + d_printf ("Voice continuation\n"); +#endif + break; + case 3: /* a silence block, no data, only a count */ + sp = (u_short *)data; COUNT1(sizeof(u_short)); + format.rate = (int)(*data); COUNT1(1); + format.rate = 1000000 / (256 - format.rate); + set_format(); + silence = ( ((u_long)*sp) * 1000) / format.rate; +#if 0 + d_printf ("Silence for %d ms\n", (int)silence); +#endif + write_zeros (*sp); + snd_pcm_flush_playback( pcm_handle ); + break; + case 4: /* a marker for syncronisation, no effect */ + sp = (u_short *)data; COUNT1(sizeof(u_short)); +#if 0 + d_printf ("Marker %d\n", *sp); +#endif + break; + case 5: /* ASCII text, we copy to stderr */ + output = 1; +#if 0 + d_printf ("ASCII - text :\n"); +#endif + break; + case 6: /* repeat marker, says repeatcount */ + /* my specs don't say it: maybe this can be recursive, but + I don't think somebody use it */ + repeat = *(u_short *)data; COUNT1(sizeof(u_short)); +#if 0 + d_printf ("Repeat loop %d times\n", repeat); +#endif + if (filepos >= 0) /* if < 0, one seek fails, why test another */ + if ( (filepos = lseek (fd, 0, 1)) < 0 ) { + fprintf(stderr, "%s: can't play loops; %s isn't seekable\n", + command, name); + repeat = 0; + } + else + filepos -= in_buffer; /* set filepos after repeat */ + else + repeat = 0; + break; + case 7: /* ok, lets repeat that be rewinding tape */ + if (repeat) { + if (repeat != 0xFFFF) { +#if 0 + d_printf ("Repeat loop %d\n", repeat); +#endif + --repeat; + } +#if 0 + else + d_printf ("Neverending loop\n"); +#endif + lseek (fd, filepos, 0); + in_buffer = 0; /* clear the buffer */ + goto Fill_the_buffer; + } +#if 0 + else + d_printf ("End repeat loop\n"); +#endif + break; + case 8: /* the extension to play Stereo, I have SB 1.0 :-( */ + was_extended = 1; + eb = (VocExtBlock *)data; COUNT1(sizeof(VocExtBlock)); + format.rate = (int)(eb->tc); + format.rate = 256000000L / (65536 - format.rate); + format.channels = eb->mode == VOC_MODE_STEREO ? 2 : 1; + if (format.channels == 2) + format.rate = format.rate >> 1; + if (eb->pack) { /* /dev/dsp can't it */ + fprintf (stderr, "%s: can't play packed .voc files\n", command); + return; + } +#if 0 + d_printf ("Extended block %s %d Hz\n", + (eb->mode ? "Stereo" : "Mono"), dsp_speed); +#endif + break; + default: + fprintf (stderr, "%s: unknown blocktype %d. terminate.\n", + command, bp->type); + return; + } /* switch (bp->type) */ + } /* while (! nextblock) */ + /* put nextblock data bytes to dsp */ + l = in_buffer; + if ( nextblock < l ) l = nextblock; + if (l) { + if (output && !quiet_mode) { + if ( write( 2, data, l) != l ) { /* to stderr */ + fprintf( stderr, "%s: write error\n", command ); + exit(1); + } + } else { + if (snd_pcm_write(pcm_handle, data, l) != l) { + fprintf( stderr, "%s: write error\n", command ); + exit(1); + } + } + COUNT(l); + } + } /* while(1) */ +} +/* that was a big one, perhaps somebody split it :-) */ + +/* setting the globals for playing raw data */ +static void init_raw_data(void) +{ + format = rformat; +} + +/* calculate the data count to read from/to dsp */ +static u_long calc_count(void) +{ + u_long count; + + if (!timelimit) + count = 0x7fffffff; + else { + count = timelimit * format.rate * format.channels; + switch ( format.format ) { + case SND_PCM_SFMT_S16_LE: + case SND_PCM_SFMT_S16_BE: + case SND_PCM_SFMT_U16_LE: + case SND_PCM_SFMT_U16_BE: + count *= 2; + break; + case SND_PCM_SFMT_IMA_ADPCM: + count /= 4; + break; + } + } + return count; +} + +/* write a .VOC-header */ +static void begin_voc( int fd, u_long cnt ) +{ + VocHeader vh; + VocBlockType bt; + VocVoiceData vd; + VocExtBlock eb; + + strncpy( vh.magic, VOC_MAGIC_STRING, 20 ); + vh.magic[19] = 0x1A; + vh.headerlen = sizeof( VocHeader ); + vh.version = VOC_ACTUAL_VERSION; + vh.coded_ver = 0x1233 - VOC_ACTUAL_VERSION; + + if ( write( fd, &vh, sizeof(VocHeader) ) != sizeof(VocHeader) ) { + fprintf( stderr, "%s: write error\n", command ); + exit(1); + } + + if (format.channels > 1) { + /* write a extended block */ + bt.type = 8; + bt.datalen = 4; + bt.datalen_m = bt.datalen_h = 0; + if ( write (fd, &bt, sizeof(VocBlockType)) != sizeof( VocBlockType ) ) { + fprintf( stderr, "%s: write error\n", command ); + exit(1); + } + eb.tc = (u_short)(65536 - 256000000L / (format.rate << 1)); + eb.pack = 0; + eb.mode = 1; + if ( write(fd, &eb, sizeof(VocExtBlock)) != sizeof(VocExtBlock) ) { + fprintf( stderr, "%s: write error\n", command ); + exit(1); + } + } + bt.type = 1; + cnt += sizeof(VocVoiceData); /* Voice_data block follows */ + bt.datalen = (u_char) (cnt & 0xFF); + bt.datalen_m = (u_char)( (cnt & 0xFF00) >> 8 ); + bt.datalen_h = (u_char)( (cnt & 0xFF0000) >> 16 ); + if ( write (fd, &bt, sizeof(VocBlockType)) != sizeof( VocBlockType ) ) { + fprintf( stderr, "%s: write error\n", command ); + exit(1); + } + vd.tc = (u_char)(256 - (1000000 / format.rate) ); + vd.pack = 0; + if ( write (fd, &vd, sizeof(VocVoiceData) ) != sizeof( VocVoiceData ) ) { + fprintf( stderr, "%s: write error\n", command ); + exit(1); + } +} + +/* write a WAVE-header */ +static void begin_wave(int fd, u_long cnt) +{ + WaveHeader wh; + int bits; + + switch ( format.format ) { + case SND_PCM_SFMT_U8: + bits = 8; + break; + case SND_PCM_SFMT_S16_LE: + bits = 16; + break; + default: + fprintf( stderr, "%s: Wave doesn't support %s format...\n", command, get_format( format.format ) ); + exit( 1 ); + } + wh.main_chunk = WAV_RIFF; + wh.length = cnt + sizeof(WaveHeader) - 8; + wh.chunk_type = WAV_WAVE; + wh.sub_chunk = WAV_FMT; + wh.sc_len = 16; + wh.format = WAV_PCM_CODE; + wh.modus = format.channels; + wh.sample_fq = format.rate; +#if 0 + wh.byte_p_spl = (samplesize == 8) ? 1 : 2; + wh.byte_p_sec = dsp_speed * wh.modus * wh.byte_p_spl; +#else + wh.byte_p_spl = wh.modus * ((bits + 7) / 8); + wh.byte_p_sec = wh.byte_p_spl * format.rate; +#endif + wh.bit_p_spl = bits; + wh.data_chunk = WAV_DATA; + wh.data_length= cnt; + if ( write (fd, &wh, sizeof(WaveHeader)) != sizeof( WaveHeader ) ) { + fprintf( stderr, "%s: write error\n", command ); + exit(1); + } +} + +/* write a Au-header */ +static void begin_au(int fd, u_long cnt) +{ + AuHeader ah; + + ah.magic = htonl( AU_MAGIC ); + ah.hdr_size = htonl( 24 ); + ah.data_size = htonl( cnt ); + switch ( format.format ) { + case SND_PCM_SFMT_MU_LAW: + ah.encoding = htonl( AU_FMT_ULAW ); + break; + case SND_PCM_SFMT_U8: + ah.encoding = htonl( AU_FMT_LIN8 ); + break; + case SND_PCM_SFMT_U16_LE: + ah.encoding = htonl( AU_FMT_LIN16 ); + break; + default: + fprintf( stderr, "%s: Sparc Audio doesn't support %s format...\n", command, get_format( format.format ) ); + exit( 1 ); + } + ah.sample_rate = htonl( format.rate ); + ah.channels = htonl( format.channels ); + if ( write (fd, &ah, sizeof(AuHeader)) != sizeof( AuHeader ) ) { + fprintf( stderr, "%s: write error\n", command ); + exit(1); + } +} + +/* closing .VOC */ +static void end_voc(int fd) +{ + char dummy = 0; /* Write a Terminator */ + if ( write (fd, &dummy, 1) != 1 ) { + fprintf( stderr, "%s: write error", command ); + exit( 1 ); + } + if (fd != 1) + close (fd); +} + +static void end_wave(int fd) +{ /* only close output */ + if (fd != 1) + close (fd); +} + +static void header( int rtype, char *name ) +{ + if (!quiet_mode) { + fprintf (stderr, "%s %s '%s' : ", + (direction == SND_PCM_OPEN_PLAYBACK) ? "Playing" : "Recording", + fmt_rec_table[rtype].what, + name ); + fprintf (stderr, "%s, ", get_format( format.format ) ); + fprintf (stderr, "Speed %d Hz, ", format.rate); + if ( format.channels == 1 ) + fprintf (stderr, "Mono" ); + else if ( format.channels == 2 ) + fprintf (stderr, "Stereo" ); + else fprintf (stderr, "Voices %i", format.channels); + fprintf (stderr, "\n" ); + } +} + +/* playing raw data */ + +void playback_go (int fd, int loaded, u_long count, int rtype, char *name) +{ + int l; + u_long c; + + header( rtype, name ); + set_format(); + + while (count) { + c = count; + + if (c > buffer_size) + c = buffer_size; + + if ((l = read (fd, audiobuf + loaded, c - loaded)) > 0) { + l += loaded; loaded = 0; /* correct the count; ugly but ... */ +#if 0 + sleep( 1 ); +#endif + if (snd_pcm_write(pcm_handle, audiobuf, l) != l) { + fprintf( stderr, "write error\n" ); + exit (1); + } + count -= l; + } else { + if (l == -1) { + perror (name); + exit (-1); + } + count = 0; /* Stop */ + } + } /* while (count) */ +} + +/* recording raw data, this proc handels WAVE files and .VOCs (as one block) */ + +void record_go(int fd, int loaded, u_long count, int rtype, char *name) +{ + int l; + u_long c; + + header( rtype, name ); + set_format(); + + while (count) { + c = count; + if (c > buffer_size) + c = buffer_size; + + if ((l = snd_pcm_read(pcm_handle, audiobuf, c)) > 0) { + if (write (fd, audiobuf, l) != l) { + perror (name); + exit (-1); + } + count -= l; + } + + if (l == -1) { + fprintf( stderr, "read error\n" ); + exit (-1); + } + } +} + +/* + * let's play or record it (record_type says VOC/WAVE/raw) + */ + +static void playback(char *name) +{ + int fd, ofs; + + snd_pcm_flush_playback( pcm_handle ); + if (!name) { + fd = 0; + name = "stdin"; + } else { + if ((fd = open (name, O_RDONLY, 0)) == -1) { + perror (name); + exit(1); + } + } + /* read the file header */ + if ( read( fd, audiobuf, sizeof(AuHeader) ) != sizeof( AuHeader ) ) { + fprintf( stderr, "%s: read error", command ); + exit( 1 ); + } + if ( test_au( fd, audiobuf ) >= 0 ) { + playback_go( fd, 0, count, FORMAT_AU, name ); + goto __end; + } + if ( read( fd, audiobuf + sizeof(AuHeader), + sizeof(VocHeader)-sizeof(AuHeader) ) != + sizeof(VocHeader)-sizeof(AuHeader) ) { + fprintf( stderr, "%s: read error", command ); + exit( 1 ); + } + if ( (ofs = test_vocfile (audiobuf) ) >= 0) { + voc_play (fd, ofs, name); + goto __end; + } + /* read bytes for WAVE-header */ + if ( read (fd, audiobuf + sizeof(VocHeader), + sizeof(WaveHeader) - sizeof(VocHeader) ) != + sizeof(WaveHeader) - sizeof(VocHeader) ) { + fprintf( stderr, "%s: read error", command ); + exit( 1 ); + } + if (test_wavefile (audiobuf) >= 0) { + playback_go(fd, 0, count, FORMAT_WAVE, name); + } else { + /* should be raw data */ + init_raw_data(); + count = calc_count(); + playback_go(fd, sizeof(WaveHeader), count, FORMAT_RAW, name); + } + __end: + if (fd != 0) + close(fd); +} + +static void record(char *name) +{ + int fd; + + snd_pcm_flush_record( pcm_handle ); + if (!name) { + fd = 1; + name = "stdout"; + } else { + remove( name ); + if ((fd = open (name, O_WRONLY | O_CREAT, 0644)) == -1) { + perror (name); + exit(1); + } + } + count = calc_count() & 0xFFFFFFFE; + /* WAVE-file should be even (I'm not sure), but wasting one byte + isn't a problem (this can only be in 8 bit mono) */ + if (fmt_rec_table[active_format].start) + fmt_rec_table[active_format].start(fd, count); + record_go( fd, 0, count, active_format, name); + fmt_rec_table[active_format].end(fd); +} diff --git a/aplay/formats.h b/aplay/formats.h new file mode 100644 index 0000000..57f4277 --- /dev/null +++ b/aplay/formats.h @@ -0,0 +1,91 @@ +#ifndef FORMATS_H +#define FORMATS_H 1 + +#include + +/* Definitions for .VOC files */ + +#define VOC_MAGIC_STRING "Creative Voice File\0x1A" +#define VOC_ACTUAL_VERSION 0x010A +#define VOC_SAMPLESIZE 8 + +#define VOC_MODE_MONO 0 +#define VOC_MODE_STEREO 1 + +#define VOC_DATALEN(bp) ((u_long)(bp->datalen) | \ + ((u_long)(bp->datalen_m) << 8) | \ + ((u_long)(bp->datalen_h) << 16) ) + +typedef struct voc_header { + u_char magic[20]; /* must be MAGIC_STRING */ + u_short headerlen; /* Headerlength, should be 0x1A */ + u_short version; /* VOC-file version */ + u_short coded_ver; /* 0x1233-version */ +} VocHeader; + +typedef struct voc_blocktype { + u_char type; + u_char datalen; /* low-byte */ + u_char datalen_m; /* medium-byte */ + u_char datalen_h; /* high-byte */ +} VocBlockType; + +typedef struct voc_voice_data { + u_char tc; + u_char pack; +} VocVoiceData; + +typedef struct voc_ext_block { + u_short tc; + u_char pack; + u_char mode; +} VocExtBlock; + +/* Definitions for Microsoft WAVE format */ + +#define WAV_RIFF 0x46464952 +#define WAV_WAVE 0x45564157 +#define WAV_FMT 0x20746D66 +#define WAV_DATA 0x61746164 +#define WAV_PCM_CODE 1 + +/* it's in chunks like .voc and AMIGA iff, but my source say there + are in only in this combination, so I combined them in one header; + it works on all WAVE-file I have +*/ +typedef struct wav_header { + u_int main_chunk; /* 'RIFF' */ + u_int length; /* filelen */ + u_int chunk_type; /* 'WAVE' */ + + u_int sub_chunk; /* 'fmt ' */ + u_int sc_len; /* length of sub_chunk, =16 */ + u_short format; /* should be 1 for PCM-code */ + u_short modus; /* 1 Mono, 2 Stereo */ + u_int sample_fq; /* frequence of sample */ + u_int byte_p_sec; + u_short byte_p_spl; /* samplesize; 1 or 2 bytes */ + u_short bit_p_spl; /* 8, 12 or 16 bit */ + + u_int data_chunk; /* 'data' */ + u_int data_length; /* samplecount */ +} WaveHeader; + +/* Definitions for Sparc .au header */ + +#define AU_MAGIC 0x2e736e64 + +#define AU_FMT_ULAW 1 +#define AU_FMT_LIN8 2 +#define AU_FMT_LIN16 3 + +typedef struct au_header { + u_int magic; /* magic '.snd' */ + u_int hdr_size; /* size of header (min 24) */ + u_int data_size; /* size of data */ + u_int encoding; /* see to AU_FMT_XXXX */ + u_int sample_rate; /* sample rate */ + u_int channels; /* number of channels (voices) */ +} AuHeader; + +#endif /* FORMATS */ diff --git a/config.cache b/config.cache new file mode 100644 index 0000000..59c297d --- /dev/null +++ b/config.cache @@ -0,0 +1,29 @@ +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +ac_cv_c_const=${ac_cv_c_const='yes'} +ac_cv_c_inline=${ac_cv_c_inline='inline'} +ac_cv_header_linux_sound_h=${ac_cv_header_linux_sound_h='yes'} +ac_cv_header_stdc=${ac_cv_header_stdc='yes'} +ac_cv_header_sys_soundlib_h=${ac_cv_header_sys_soundlib_h='yes'} +ac_cv_header_time=${ac_cv_header_time='yes'} +ac_cv_path_install=${ac_cv_path_install='/usr/bin/install -c'} +ac_cv_prog_CC=${ac_cv_prog_CC='gcc'} +ac_cv_prog_CPP=${ac_cv_prog_CPP='gcc -E'} +ac_cv_prog_RANLIB=${ac_cv_prog_RANLIB='ranlib'} +ac_cv_prog_cc_cross=${ac_cv_prog_cc_cross='no'} +ac_cv_prog_cc_g=${ac_cv_prog_cc_g='yes'} +ac_cv_prog_cc_works=${ac_cv_prog_cc_works='yes'} +ac_cv_prog_gcc=${ac_cv_prog_gcc='yes'} +ac_cv_prog_gcc_traditional=${ac_cv_prog_gcc_traditional='no'} diff --git a/config.log b/config.log new file mode 100644 index 0000000..018e5ab --- /dev/null +++ b/config.log @@ -0,0 +1,32 @@ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +configure:528: checking for gcc +configure:605: checking whether the C compiler (gcc ) works +configure:619: gcc -o conftest conftest.c 1>&5 +configure:639: checking whether the C compiler (gcc ) is a cross-compiler +configure:644: checking whether we are using GNU C +configure:653: gcc -E conftest.c +configure:668: checking whether gcc accepts -g +configure:698: checking for ranlib +configure:754: checking for a BSD compatible install +configure:805: checking how to run the C preprocessor +configure:826: gcc -E conftest.c >/dev/null 2>conftest.out +configure:866: checking for ANSI C header files +configure:879: gcc -E conftest.c >/dev/null 2>conftest.out +configure:946: gcc -o conftest -g -O2 conftest.c 1>&5 +configure:974: checking for linux/sound.h +configure:984: gcc -E conftest.c >/dev/null 2>conftest.out +configure:974: checking for sys/soundlib.h +configure:984: gcc -E conftest.c >/dev/null 2>conftest.out +configure:1012: checking for working const +configure:1066: gcc -c -g -O2 conftest.c 1>&5 +configure:1087: checking for inline +configure:1101: gcc -c -g -O2 conftest.c 1>&5 +configure:1127: checking whether time.h and sys/time.h may both be included +configure:1141: gcc -c -g -O2 conftest.c 1>&5 +configure:1164: checking whether gcc needs -traditional +configure:1171: sgtty.h: No such file or directory +configure:1219: checking for alsa-lib package +configure:1236: gcc -o conftest -I/usr/include conftest.c -L/usr/lib -lsound 1>&5 +configure:1250: checking for alsa-utils version diff --git a/config.status b/config.status new file mode 100644 index 0000000..8e745dc --- /dev/null +++ b/config.status @@ -0,0 +1,245 @@ +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host entry.jcu.cz: +# +# ./configure +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: ./config.status [--recheck] [--version] [--help]" +for ac_option +do + case "$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running ${CONFIG_SHELL-/bin/sh} ./configure --no-create --no-recursion" + exec ${CONFIG_SHELL-/bin/sh} ./configure --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "./config.status generated by autoconf version 2.12" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "$ac_cs_usage"; exit 0 ;; + *) echo "$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=. +ac_given_INSTALL="/usr/bin/install -c" + +trap 'rm -fr Makefile.conf utils/alsa-utils.spec include/config.h conftest*; exit 1' 1 2 15 + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\&%]/\\&/g; + s/@@/%@/; s/@@/@%/; s/@g$/%g/' > conftest.subs <<\CEOF +/^[ ]*VPATH[ ]*=[^:]*$/d + +s%@CFLAGS@%-I/usr/include%g +s%@CPPFLAGS@%%g +s%@CXXFLAGS@%%g +s%@DEFS@%-DHAVE_CONFIG_H%g +s%@LDFLAGS@%%g +s%@LIBS@%-L/usr/lib -lsound%g +s%@exec_prefix@%${prefix}%g +s%@prefix@%/usr%g +s%@program_transform_name@%s,x,x,%g +s%@bindir@%${exec_prefix}/bin%g +s%@sbindir@%${exec_prefix}/sbin%g +s%@libexecdir@%${exec_prefix}/libexec%g +s%@datadir@%${prefix}/share%g +s%@sysconfdir@%${prefix}/etc%g +s%@sharedstatedir@%${prefix}/com%g +s%@localstatedir@%${prefix}/var%g +s%@libdir@%${exec_prefix}/lib%g +s%@includedir@%${prefix}/include%g +s%@oldincludedir@%/usr/include%g +s%@infodir@%${prefix}/info%g +s%@mandir@%${prefix}/man%g +s%@CC@%gcc%g +s%@RANLIB@%ranlib%g +s%@INSTALL_PROGRAM@%${INSTALL}%g +s%@INSTALL_DATA@%${INSTALL} -m 644%g +s%@CPP@%gcc -E%g +s%@SND_UTIL_VERSION@%0.0.4%g +s%@SND_UTIL_MAJOR@%0%g +s%@SND_UTIL_MINOR@%0%g +s%@SND_UTIL_SUBMINOR@%4%g + +CEOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi + +CONFIG_FILES=${CONFIG_FILES-"Makefile.conf utils/alsa-utils.spec"} +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' +ac_dC='\3' +ac_dD='%g' +# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' +ac_uC=' ' +ac_uD='\4%g' +# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='$%\1#\2define\3' +ac_eC=' ' +ac_eD='%g' + +if test "${CONFIG_HEADERS+set}" != set; then + CONFIG_HEADERS="include/config.h" +fi +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + cat $ac_file_inputs > conftest.in + + cat > conftest.frag < conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag < conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + + + +exit 0 diff --git a/configure b/configure new file mode 100644 index 0000000..b92a8f0 --- /dev/null +++ b/configure @@ -0,0 +1,1622 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.12 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_default_prefix=/usr + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.12" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=Makefile.conf.in + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:528: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:557: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + ac_prog_rejected=no + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:605: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:639: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:644: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:668: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:698: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:754: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + for ac_prog in ginstall installbsd scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + # OSF/1 installbsd also uses dspmsg, but is usable. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:805: checking how to run the C preprocessor" >&5 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:826: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:843: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP=/lib/cpp +fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +echo "$ac_t""$CPP" 1>&6 + +echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 +echo "configure:866: checking for ANSI C header files" >&5 +if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +#include +#include +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:879: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + ac_cv_header_stdc=yes +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. +cat > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. +cat > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. +if test "$cross_compiling" = yes; then + : +else + cat > conftest.$ac_ext < +#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int main () { int i; for (i = 0; i < 256; i++) +if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); +exit (0); } + +EOF +if { (eval echo configure:946: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_header_stdc=no +fi +rm -fr conftest* +fi + +fi +fi + +echo "$ac_t""$ac_cv_header_stdc" 1>&6 +if test $ac_cv_header_stdc = yes; then + cat >> confdefs.h <<\EOF +#define STDC_HEADERS 1 +EOF + +fi + + +for ac_hdr in linux/sound.h sys/soundlib.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:974: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:984: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + + +echo $ac_n "checking for working const""... $ac_c" 1>&6 +echo "configure:1012: checking for working const" >&5 +if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <j = 5; +} +{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; +} + +; return 0; } +EOF +if { (eval echo configure:1066: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_const=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_c_const=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_c_const" 1>&6 +if test $ac_cv_c_const = no; then + cat >> confdefs.h <<\EOF +#define const +EOF + +fi + +echo $ac_n "checking for inline""... $ac_c" 1>&6 +echo "configure:1087: checking for inline" >&5 +if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_inline=$ac_kw; break +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +done + +fi + +echo "$ac_t""$ac_cv_c_inline" 1>&6 +case "$ac_cv_c_inline" in + inline | yes) ;; + no) cat >> confdefs.h <<\EOF +#define inline +EOF + ;; + *) cat >> confdefs.h <&6 +echo "configure:1127: checking whether time.h and sys/time.h may both be included" >&5 +if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +#include +int main() { +struct tm *tp; +; return 0; } +EOF +if { (eval echo configure:1141: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_header_time=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_time=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_header_time" 1>&6 +if test $ac_cv_header_time = yes; then + cat >> confdefs.h <<\EOF +#define TIME_WITH_SYS_TIME 1 +EOF + +fi + + +if test $ac_cv_prog_gcc = yes; then + echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 +echo "configure:1164: checking whether ${CC-cc} needs -traditional" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_pattern="Autoconf.*'x'" + cat > conftest.$ac_ext < +Autoconf TIOCGETP +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "$ac_pattern" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_prog_gcc_traditional=yes +else + rm -rf conftest* + ac_cv_prog_gcc_traditional=no +fi +rm -f conftest* + + + if test $ac_cv_prog_gcc_traditional = no; then + cat > conftest.$ac_ext < +Autoconf TCGETA +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "$ac_pattern" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_prog_gcc_traditional=yes +fi +rm -f conftest* + + fi +fi + +echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6 + if test $ac_cv_prog_gcc_traditional = yes; then + CC="$CC -traditional" + fi +fi + + +myprefix=$prefix +if test "$myprefix" = "NONE"; then + myprefix=$ac_default_prefix +fi +CFLAGS="-I$myprefix/include" +LIBS="-L$myprefix/lib -lsound" +#echo "CFLAGS=$CFLAGS" +#echo "LIBS=$LIBS" +echo $ac_n "checking for alsa-lib package""... $ac_c" 1>&6 +echo "configure:1219: checking for alsa-lib package" >&5 +if test "$cross_compiling" = yes; then + echo "$ac_t"""not supported"" 1>&6; echo "Fatal error: Cross-compiling isn't supported..."; exit 1; + +else + cat > conftest.$ac_ext < +void main(void) +{ + snd_cards(); + exit(0); +} + +EOF +if { (eval echo configure:1236: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + echo "$ac_t"""present"" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + echo "$ac_t"""not found"" 1>&6; echo "Fatal error: Install alsa-lib package at first..."; exit 1; +fi +rm -fr conftest* +fi + + +echo $ac_n "checking for alsa-utils version""... $ac_c" 1>&6 +echo "configure:1250: checking for alsa-utils version" >&5 +SND_UTIL_VERSION=`cat $srcdir/version` +cat >> confdefs.h <&6 + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +DEFS=-DHAVE_CONFIG_H + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.12" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile.conf utils/alsa-utils.spec include/config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@CC@%$CC%g +s%@RANLIB@%$RANLIB%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@CPP@%$CPP%g +s%@SND_UTIL_VERSION@%$SND_UTIL_VERSION%g +s%@SND_UTIL_MAJOR@%$SND_UTIL_MAJOR%g +s%@SND_UTIL_MINOR@%$SND_UTIL_MINOR%g +s%@SND_UTIL_SUBMINOR@%$SND_UTIL_SUBMINOR%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' +ac_dC='\3' +ac_dD='%g' +# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' +ac_uC=' ' +ac_uD='\4%g' +# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='$%\1#\2define\3' +ac_eC=' ' +ac_eD='%g' + +if test "${CONFIG_HEADERS+set}" != set; then +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +fi +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + cat $ac_file_inputs > conftest.in + +EOF + +# Transform confdefs.h into a sed script conftest.vals that substitutes +# the proper values into config.h.in to produce config.h. And first: +# Protect against being on the right side of a sed subst in config.status. +# Protect against being in an unquoted here document in config.status. +rm -f conftest.vals +cat > conftest.hdr <<\EOF +s/[\\&%]/\\&/g +s%[\\$`]%\\&%g +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp +s%ac_d%ac_u%gp +s%ac_u%ac_e%gp +EOF +sed -n -f conftest.hdr confdefs.h > conftest.vals +rm -f conftest.hdr + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >> conftest.vals <<\EOF +s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +EOF + +# Break up conftest.vals because some shells have a limit on +# the size of here documents, and old seds have small limits too. + +rm -f conftest.tail +while : +do + ac_lines=`grep -c . conftest.vals` + # grep -c gives empty output for an empty file on some AIX systems. + if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi + # Write a limited-size here document to conftest.frag. + echo ' cat > conftest.frag <> $CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + echo 'CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in +' >> $CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + rm -f conftest.vals + mv conftest.tail conftest.vals +done +rm -f conftest.vals + +cat >> $CONFIG_STATUS <<\EOF + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff --git a/configure.in b/configure.in new file mode 100644 index 0000000..eed6393 --- /dev/null +++ b/configure.in @@ -0,0 +1,61 @@ +dnl Process this file with autoconf to produce a configure script. + +AC_INIT(Makefile.conf.in) +AC_PREFIX_DEFAULT(/usr) + +dnl Checks for programs. +AC_PROG_CC +AC_PROG_RANLIB +AC_PROG_INSTALL +AC_PROG_LN_S + +dnl Checks for header files. +AC_HEADER_STDC +AC_CONFIG_HEADER(include/config.h) +AC_CHECK_HEADERS(linux/sound.h sys/soundlib.h) + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_C_INLINE +AC_HEADER_TIME + +dnl Checks for library functions. +AC_PROG_GCC_TRADITIONAL + +dnl Check for ALSA library package. +myprefix=$prefix +if test "$myprefix" = "NONE"; then + myprefix=$ac_default_prefix +fi +CFLAGS="-I$myprefix/include" +LIBS="-L$myprefix/lib -lsound" +#echo "CFLAGS=$CFLAGS" +#echo "LIBS=$LIBS" +AC_MSG_CHECKING(for alsa-lib package) +AC_TRY_RUN([ +#include +void main(void) +{ + snd_cards(); + exit(0); +} +], + AC_MSG_RESULT("present"), + AC_MSG_RESULT("not found"); echo "Fatal error: Install alsa-lib package at first..."; exit 1;, + AC_MSG_RESULT("not supported"); echo "Fatal error: Cross-compiling isn't supported..."; exit 1; +) + +dnl Check for version... +AC_MSG_CHECKING(for alsa-utils version) +SND_UTIL_VERSION=`cat $srcdir/version` +AC_DEFINE_UNQUOTED(SND_UTIL_VERSION, "$SND_UTIL_VERSION") +AC_SUBST(SND_UTIL_VERSION) +SND_UTIL_MAJOR=`echo $SND_UTIL_VERSION | cut -d . -f 1` +AC_SUBST(SND_UTIL_MAJOR) +SND_UTIL_MINOR=`echo $SND_UTIL_VERSION | cut -d . -f 2` +AC_SUBST(SND_UTIL_MINOR) +SND_UTIL_SUBMINOR=`echo $SND_UTIL_VERSION | cut -d . -f 3` +AC_SUBST(SND_UTIL_SUBMINOR) +AC_MSG_RESULT($SND_UTIL_VERSION) + +AC_OUTPUT(Makefile.conf utils/alsa-utils.spec) diff --git a/include/Makefile b/include/Makefile new file mode 100644 index 0000000..e1e5789 --- /dev/null +++ b/include/Makefile @@ -0,0 +1,10 @@ +# +# Makefile for ALSA utils package +# Copyright (c) 1994-98 by Jaroslav Kysela +# + +include ../Makefile.conf + +clean: + rm -f core .depend *.o *.orig *~ + diff --git a/include/config.h b/include/config.h new file mode 100644 index 0000000..5c7c548 --- /dev/null +++ b/include/config.h @@ -0,0 +1,6 @@ +/* include/config.h. Generated automatically by configure. */ +/* + * Configuration header file for compilation of the ALSA utilities + */ + +#define SND_UTIL_VERSION "0.0.4" diff --git a/include/config.h.in b/include/config.h.in new file mode 100644 index 0000000..5e078f9 --- /dev/null +++ b/include/config.h.in @@ -0,0 +1,5 @@ +/* + * Configuration header file for compilation of the ALSA utilities + */ + +#undef SND_UTIL_VERSION diff --git a/install-sh b/install-sh new file mode 100644 index 0000000..ebc6691 --- /dev/null +++ b/install-sh @@ -0,0 +1,250 @@ +#! /bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/utils/Makefile b/utils/Makefile new file mode 100644 index 0000000..e1e5789 --- /dev/null +++ b/utils/Makefile @@ -0,0 +1,10 @@ +# +# Makefile for ALSA utils package +# Copyright (c) 1994-98 by Jaroslav Kysela +# + +include ../Makefile.conf + +clean: + rm -f core .depend *.o *.orig *~ + diff --git a/utils/alsa-utils.spec b/utils/alsa-utils.spec new file mode 100644 index 0000000..cd306d0 --- /dev/null +++ b/utils/alsa-utils.spec @@ -0,0 +1,73 @@ +%define ver 0.0.4 +%define rel 1 +%define prefix / + +Summary: Advanced Linux Sound Architecture (ALSA) - Utils +Name: alsa-utils +Version: %ver +Release: %rel +Copyright: GPL +Group: System/Libraries +Source: ftp://alsa.jcu.cz/pub/utils/alsa-utils-%{ver}.tar.gz +BuildRoot: /tmp/alsa-utils-%{ver} +Packager: Helge Jensen +URL: http://alsa.jcu.cz +Docdir: %{prefix}/usr/doc +Requires: alsa-lib alsa-driver +%description + +Advanced Linux Sound Architecture (ALSA) - Utils + +Features +======== + +* general + - modularized architecture with support for 2.0 and latest 2.1 kernels + - support for versioned and exported symbols + - full proc filesystem support - /proc/sound +* ISA soundcards + - support for 128k ISA DMA buffer +* mixer + - new enhanced API for applications + - support for unlimited number of channels + - volume can be set in three ways (percentual (0-100), exact and decibel) + - support for mute (and hardware mute if hardware supports it) + - support for mixer events + - this allows two or more applications to be synchronized +* digital audio (PCM) + - new enhanced API for applications + - full real duplex support + - full duplex support for SoundBlaster 16/AWE soundcards + - digital audio data for playback and record should be read back using + proc filesystem +* OSS/Lite compatibility + - full mixer compatibity + - full PCM (/dev/dsp) compatibility + +%changelog + +* Mon May 28 1998 Helge Jensen + +- Made SPEC file + +%prep +%setup -n alsa-utils +%build + +./configure --prefix=/usr +make + +%install +mkdir -p $RPM_BUILD_ROOT/usr/bin + +make prefix="$RPM_BUILD_ROOT/usr" install + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-, root, root) + +%doc CHANGELOG COPYING README config.status + +%{prefix}/usr/bin/* diff --git a/utils/alsa-utils.spec.in b/utils/alsa-utils.spec.in new file mode 100644 index 0000000..f753e27 --- /dev/null +++ b/utils/alsa-utils.spec.in @@ -0,0 +1,73 @@ +%define ver @SND_UTIL_VERSION@ +%define rel 1 +%define prefix / + +Summary: Advanced Linux Sound Architecture (ALSA) - Utils +Name: alsa-utils +Version: %ver +Release: %rel +Copyright: GPL +Group: System/Libraries +Source: ftp://alsa.jcu.cz/pub/utils/alsa-utils-%{ver}.tar.gz +BuildRoot: /tmp/alsa-utils-%{ver} +Packager: Helge Jensen +URL: http://alsa.jcu.cz +Docdir: %{prefix}/usr/doc +Requires: alsa-lib alsa-driver +%description + +Advanced Linux Sound Architecture (ALSA) - Utils + +Features +======== + +* general + - modularized architecture with support for 2.0 and latest 2.1 kernels + - support for versioned and exported symbols + - full proc filesystem support - /proc/sound +* ISA soundcards + - support for 128k ISA DMA buffer +* mixer + - new enhanced API for applications + - support for unlimited number of channels + - volume can be set in three ways (percentual (0-100), exact and decibel) + - support for mute (and hardware mute if hardware supports it) + - support for mixer events + - this allows two or more applications to be synchronized +* digital audio (PCM) + - new enhanced API for applications + - full real duplex support + - full duplex support for SoundBlaster 16/AWE soundcards + - digital audio data for playback and record should be read back using + proc filesystem +* OSS/Lite compatibility + - full mixer compatibity + - full PCM (/dev/dsp) compatibility + +%changelog + +* Mon May 28 1998 Helge Jensen + +- Made SPEC file + +%prep +%setup -n alsa-utils +%build + +./configure --prefix=/usr +make + +%install +mkdir -p $RPM_BUILD_ROOT/usr/bin + +make prefix="$RPM_BUILD_ROOT/usr" install + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-, root, root) + +%doc CHANGELOG COPYING README config.status + +%{prefix}/usr/bin/* diff --git a/utils/buildrpm b/utils/buildrpm new file mode 100644 index 0000000..95606e1 --- /dev/null +++ b/utils/buildrpm @@ -0,0 +1,35 @@ +#!/bin/bash + +source=. +version=`cat $source/../version` +package=$source/../../alsa-utils-$version.tar.gz + +if [ ! -r $package ]; then + echo "Error: wrong package: $package" + exit 1 +fi + +make -C .. pack + +cp -fv $package /usr/src/redhat/SOURCES + +if [ ! -r $source/buildrpm ]; then + echo "Error: invalid directory: $source" + exit 1 +fi + +if [ ! -d /usr/src/redhat ]; then + echo "Error: /usr/src/redhat directory not found" + exit 1 +fi + +if [ ! -r $source/alsadriver.spec ]; then + cd $source/.. + ./configure + cd utils +fi + +cp -fv $source/alsa-utils.spec /usr/src/redhat/SPECS +cd /usr/src/redhat/SPECS +rpm -ba alsa-utils.spec +cd /usr/src/redhat diff --git a/version b/version new file mode 100644 index 0000000..bbdeab6 --- /dev/null +++ b/version @@ -0,0 +1 @@ +0.0.5