From d9158162d07647d1abcd049bc1192b311c96f097 Mon Sep 17 00:00:00 2001 From: Chris Cannam Date: Sat, 30 Jan 1999 19:12:34 +0000 Subject: [PATCH] Convert alsa-utils to use automake --- Makefile | 61 ------------------------------------ Makefile.am | 5 +++ Makefile.conf.in | 33 ------------------- acconfig.h | 5 +++ alsactl/Makefile | 45 -------------------------- alsactl/Makefile.am | 6 ++++ alsactl/alsactl.c | 5 ++- alsamixer/Makefile | 23 -------------- alsamixer/Makefile.am | 5 +++ alsamixer/alsamixer.c | 4 +-- amixer/Makefile | 29 ----------------- amixer/Makefile.am | 8 +++++ aplay/Makefile | 34 -------------------- aplay/Makefile.am | 24 ++++++++++++++ aplay/{arecord.1 => aplay.1} | 0 aplay/aplay.c | 3 +- configure.in | 60 ++++++++++------------------------- cvscompile | 9 ++++++ include/Makefile | 10 ------ include/Makefile.am | 25 +++++++++++++++ include/aconfig.h.in | 28 ++++++++++++++--- include/stamp-h.in | 1 + utils/Makefile | 10 ------ utils/Makefile.am | 4 +++ utils/buildrpm | 2 +- 25 files changed, 142 insertions(+), 297 deletions(-) delete mode 100644 Makefile create mode 100644 Makefile.am delete mode 100644 Makefile.conf.in create mode 100644 acconfig.h delete mode 100644 alsactl/Makefile create mode 100644 alsactl/Makefile.am delete mode 100644 alsamixer/Makefile create mode 100644 alsamixer/Makefile.am delete mode 100644 amixer/Makefile create mode 100644 amixer/Makefile.am delete mode 100644 aplay/Makefile create mode 100644 aplay/Makefile.am rename aplay/{arecord.1 => aplay.1} (100%) create mode 100644 cvscompile delete mode 100644 include/Makefile create mode 100644 include/Makefile.am create mode 100644 include/stamp-h.in delete mode 100644 utils/Makefile create mode 100644 utils/Makefile.am diff --git a/Makefile b/Makefile deleted file mode 100644 index 6d9c471..0000000 --- a/Makefile +++ /dev/null @@ -1,61 +0,0 @@ -# -# 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 alsactl - $(MAKE) -C aplay - $(MAKE) -C amixer - $(MAKE) -C alsamixer - @echo - @echo "ALSA Utilities were sucessfully compiled." - @echo - -install: all - $(INSTALL) -m 755 -o root -g root -d ${sbindir} - $(INSTALL) -s -m 755 -o root -g root alsactl/alsactl ${sbindir} - $(INSTALL) -m 644 -o root -g root alsactl/alsactl.1 ${mandir}/man1 - $(INSTALL) -m 755 -o root -g root -d ${bindir} - $(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) -d -m 755 -o root -g root ${mandir}/man1 - $(INSTALL) -m 644 -o root -g root amixer/amixer.1 ${mandir}/man1 - $(INSTALL) -s -m 755 -o root -g root alsamixer/alsamixer ${bindir} - $(INSTALL) -m 644 -o root -g root alsamixer/alsamixer.1 ${mandir}/man1 - $(INSTALL) -m 644 -o root -g root aplay/arecord.1 ${mandir}/man1 - ln -sf arecord.1 ${mandir}/man1/aplay.1 - -clean: - $(MAKE) -C include clean - $(MAKE) -C alsactl 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"` - -mrproper: clean - rm -f config.cache config.log config.status Makefile.conf \ - include/aconfig.h utils/alsa-utils.spec - -cvsclean: mrproper - rm -f configure - -pack: mrproper - chown -R root.root ../alsa-utils - mv ../alsa-utils ../alsa-utils-$(SND_UTIL_VERSION) - tar --exclude=CVS -cvz -C .. -f ../alsa-utils-$(SND_UTIL_VERSION).tar.gz alsa-utils-$(SND_UTIL_VERSION) - mv ../alsa-utils-$(SND_UTIL_VERSION) ../alsa-utils diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..1213b6b --- /dev/null +++ b/Makefile.am @@ -0,0 +1,5 @@ +INCLUDES=-I$(top_srcdir)/include +SUBDIRS=include alsactl alsamixer amixer aplay utils + +rpm: dist + $(MAKE) -C $@ diff --git a/Makefile.conf.in b/Makefile.conf.in deleted file mode 100644 index de6e0ca..0000000 --- a/Makefile.conf.in +++ /dev/null @@ -1,33 +0,0 @@ -# -# 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@ -sbindir=@sbindir@ -libdir=@libdir@ -mandir=@mandir@ -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 -FLEX=@LEX@ -BISON=@YACC@ -SNDLIB=-lasound -NCURSESINC="" -NCURSESLIB=-lncurses -LN_S=@LN_S@ diff --git a/acconfig.h b/acconfig.h new file mode 100644 index 0000000..f1ce75b --- /dev/null +++ b/acconfig.h @@ -0,0 +1,5 @@ +/* Package name */ +#undef PACKAGE + +/* Package version */ +#undef VERSION diff --git a/alsactl/Makefile b/alsactl/Makefile deleted file mode 100644 index 75aef5f..0000000 --- a/alsactl/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -# -# Makefile for alsactl program -# Copyright (c) 1994-98 by Jaroslav Kysela -# - -TOPDIR=.. - -include $(TOPDIR)/Makefile.conf - -CFLAGS= -TARGET=alsactl -OBJECTS=alsactl.o setup.o alsactl_parser.o alsactl_lexer.o - -# parser / lexer debug -#CFLAGS += -DYYDEBUG -#FLEXFLAGS = -d -#BISONFLAGS = -v - -.c.o: - $(CC) $(COPTS) $(CFLAGS) $(INCLUDE) -c -o $*.o $< - -all: $(TARGET) - -$(TARGET): .depend $(OBJECTS) - $(CC) $(SNDLIB) $(OBJECTS) -o $(TARGET) - -alsactl_lexer.c: alsactl_lexer.l - $(FLEX) $(FLEXFLAGS) -i -o$@ $< - -alsactl_parser.c: alsactl_parser.y - $(BISON) $(BISONFLAGS) -do $@ $< - -clean: - rm -f core alsactl .depend *.o *.orig *~ \ - alsactl_lexer.c alsactl_parser.[ch] alsactl_parser.output - -.depend: - $(CPP) $(COPTS) $(INCLUDE) -M *.c > .depend - -# -# include a dependency file if one exists -# -ifeq (.depend,$(wildcard .depend)) -include .depend -endif diff --git a/alsactl/Makefile.am b/alsactl/Makefile.am new file mode 100644 index 0000000..419630a --- /dev/null +++ b/alsactl/Makefile.am @@ -0,0 +1,6 @@ +bin_PROGRAMS=alsactl +noinst_HEADERS=alsactl.h +man_MANS=alsactl.1 + +alsactl_SOURCES=alsactl.c alsactl_parser.y setup.c alsactl_lexer.l +YFLAGS=-d diff --git a/alsactl/alsactl.c b/alsactl/alsactl.c index 34beb70..18ebf6d 100644 --- a/alsactl/alsactl.c +++ b/alsactl/alsactl.c @@ -21,6 +21,7 @@ #include "alsactl.h" #include "aconfig.h" +#include "version.h" #include #include @@ -182,7 +183,7 @@ int main(int argc, char *argv[]) break; case 'v': case HELPID_VERSION: - printf("alsactl version " SND_UTIL_VERSION "\n"); + printf("alsactl version " SND_UTIL_VERSION_STR "\n"); return 1; default: fprintf(stderr, "\07Invalid switch or option needs an argument.\n"); @@ -209,3 +210,5 @@ int main(int argc, char *argv[]) return 0; } + + diff --git a/alsamixer/Makefile b/alsamixer/Makefile deleted file mode 100644 index 09db3b7..0000000 --- a/alsamixer/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -# -# 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/Makefile.am b/alsamixer/Makefile.am new file mode 100644 index 0000000..4f582a4 --- /dev/null +++ b/alsamixer/Makefile.am @@ -0,0 +1,5 @@ +LDADD = $(CURSESLIB) -lasound + +bin_PROGRAMS = alsamixer +man_MANS = alsamixer.1 +alsamixer_INCLUDES = -I$(top_srcdir)/include -DCURSESINC="$(CURSESINC)" diff --git a/alsamixer/alsamixer.c b/alsamixer/alsamixer.c index 4d82105..8b7e6f5 100644 --- a/alsamixer/alsamixer.c +++ b/alsamixer/alsamixer.c @@ -30,10 +30,10 @@ #include #include -#ifndef NCURSESINC +#ifndef CURSESINC #include #else -#include NCURSESINC +#include CURSESINC #endif #include diff --git a/amixer/Makefile b/amixer/Makefile deleted file mode 100644 index 1f82b6f..0000000 --- a/amixer/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -# -# 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/Makefile.am b/amixer/Makefile.am new file mode 100644 index 0000000..6d4d0d1 --- /dev/null +++ b/amixer/Makefile.am @@ -0,0 +1,8 @@ +INCLUDES = -I$(top_srcdir)/include +LDADD = -lasound +EXTRA_DIST = README.first + +bin_PROGRAMS = amixer +amixer_SOURCES = amain.cpp amixer.cpp +noinst_HEADERS = amixer.h atypes.h +man_MANS = amixer.1 diff --git a/aplay/Makefile b/aplay/Makefile deleted file mode 100644 index d10a107..0000000 --- a/aplay/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -# -# 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 aplay .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/Makefile.am b/aplay/Makefile.am new file mode 100644 index 0000000..2cfdd72 --- /dev/null +++ b/aplay/Makefile.am @@ -0,0 +1,24 @@ +INCLUDES = -I$(top_srcdir)/include +LDADD = -lasound + +bin_PROGRAMS = aplay +man_MANS = aplay.1 +noinst_HEADERS = formats.h + +EXTRA_CLEAN = arecord + +arecord: aplay + rm -f arecord + $(LN_S) $< $@ + +arecord.1: aplay.1 + rm -f arecord.1 + $(LN_S) $< $@ + +install-exec-hook: + rm -f $(bindir)/arecord + (cd $(bindir) && $(LN_S) aplay arecord) + +install-data-hook: + rm -f $(mandir)/man1/arecord.1 + (cd $(mandir)/man1 && $(LN_S) aplay.1 arecord.1) diff --git a/aplay/arecord.1 b/aplay/aplay.1 similarity index 100% rename from aplay/arecord.1 rename to aplay/aplay.1 diff --git a/aplay/aplay.c b/aplay/aplay.c index 3b98981..2966e77 100644 --- a/aplay/aplay.c +++ b/aplay/aplay.c @@ -38,6 +38,7 @@ #include #include "aconfig.h" #include "formats.h" +#include "version.h" #define DEFAULT_SPEED 8000 @@ -236,7 +237,7 @@ static void device_list(void) static void version(void) { - printf("%s: version " SND_UTIL_VERSION " by Jaroslav Kysela \n", command); + printf("%s: version " SND_UTIL_VERSION_STR " by Jaroslav Kysela \n", command); } int main(int argc, char *argv[]) diff --git a/configure.in b/configure.in index da23ee8..c80a927 100644 --- a/configure.in +++ b/configure.in @@ -1,20 +1,29 @@ dnl Process this file with autoconf to produce a configure script. - -AC_INIT(Makefile.conf.in) +AC_INIT(alsamixer/alsamixer.c) AC_PREFIX_DEFAULT(/usr) +AM_INIT_AUTOMAKE(alsa-utils, 0.3.0-pre3) dnl Checks for programs. AC_PROG_CC -AC_PROG_RANLIB +AC_PROG_CXX AC_PROG_INSTALL AC_PROG_LN_S -AC_PROG_LEX AC_PROG_YACC +AM_PROG_LEX +AM_PATH_ALSA(0.1.1) dnl Checks for header files. AC_HEADER_STDC -AC_CONFIG_HEADER(include/aconfig.h) -AC_CHECK_HEADERS(linux/asound.h sys/asoundlib.h) +AC_CHECK_LIB(ncurses, initscr, + [ CURSESINC=''; CURSESLIB='-lncurses'; ], [ + AC_CHECK_LIB(curses, initscr, + [ CURSESINC=''; CURSESLIB='-lcurses'; ]) +]) + +AC_SUBST(CURSESINC) +AC_SUBST(CURSESLIB) + +AM_CONFIG_HEADER(include/aconfig.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST @@ -24,40 +33,5 @@ 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 -lasound" -#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) +AC_OUTPUT(Makefile alsactl/Makefile alsamixer/Makefile amixer/Makefile aplay/Makefile \ + include/Makefile utils/Makefile utils/alsa-utils.spec) diff --git a/cvscompile b/cvscompile new file mode 100644 index 0000000..a1758e1 --- /dev/null +++ b/cvscompile @@ -0,0 +1,9 @@ +#!/bin/bash + +aclocal +automake --foreign +autoconf +export CFLAGS='-O2 -fomit-frame-pointer -Wall -pipe -g' +./configure +unset CFLAGS +make diff --git a/include/Makefile b/include/Makefile deleted file mode 100644 index e1e5789..0000000 --- a/include/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# -# 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/Makefile.am b/include/Makefile.am new file mode 100644 index 0000000..9f4f123 --- /dev/null +++ b/include/Makefile.am @@ -0,0 +1,25 @@ +noinst_HEADERS=version.h + +version.h: stamp-vh + @: + +stamp-vh: $(top_builddir)/configure.in + @echo "/*" > ver.tmp + @echo " * version.h" >> ver.tmp + @echo " */" >> ver.tmp + @echo "" >> ver.tmp + @echo "#define SND_UTIL_MAJOR $(SND_UTIL_MAJOR)" >> ver.tmp + @echo "#define SND_UTIL_MINOR $(SND_UTIL_MINOR)" >> ver.tmp + @echo "#define SND_UTIL_SUBMINOR $(SND_UTIL_SUBMINOR)" >> ver.tmp + @echo "#define SND_UTIL_VERSION ((SND_UTIL_MAJOR<<16)|\\" >> ver.tmp + @echo " (SND_UTIL_MINOR<<8)|\\" >> ver.tmp + @echo " SND_UTIL_SUBMINOR)" >> ver.tmp + @echo "#define SND_UTIL_VERSION_STR \"$(SND_UTIL_VERSION)\"" >> ver.tmp + @echo >> ver.tmp + @cmp -s version.h ver.tmp \ + || (echo "Updating version.h"; \ + cp ver.tmp version.h; \ + echo timestamp > stamp-vh) + -@rm -f ver.tmp + +INCLUDES=-I$(top_srcdir)/include diff --git a/include/aconfig.h.in b/include/aconfig.h.in index 5e078f9..9c26137 100644 --- a/include/aconfig.h.in +++ b/include/aconfig.h.in @@ -1,5 +1,25 @@ -/* - * Configuration header file for compilation of the ALSA utilities - */ +/* include/aconfig.h.in. Generated automatically from configure.in by autoheader. */ -#undef SND_UTIL_VERSION +/* Define to empty if the keyword does not work. */ +#undef const + +/* Define as __inline if that's what the C compiler calls it. */ +#undef inline + +/* Define if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define if you can safely include both and . */ +#undef TIME_WITH_SYS_TIME + +/* Define if lex declares yytext as a char * by default, not a char[]. */ +#undef YYTEXT_POINTER + +/* Package name */ +#undef PACKAGE + +/* Package version */ +#undef VERSION + +/* Define if you have the asound library (-lasound). */ +#undef HAVE_LIBASOUND diff --git a/include/stamp-h.in b/include/stamp-h.in new file mode 100644 index 0000000..9788f70 --- /dev/null +++ b/include/stamp-h.in @@ -0,0 +1 @@ +timestamp diff --git a/utils/Makefile b/utils/Makefile deleted file mode 100644 index e1e5789..0000000 --- a/utils/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# -# 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/Makefile.am b/utils/Makefile.am new file mode 100644 index 0000000..083e5b4 --- /dev/null +++ b/utils/Makefile.am @@ -0,0 +1,4 @@ +EXTRA_DIST = buildrpm + +rpm: buildrpm alsa-lib.spec + VERSION=$(VERSION) $(srcdir)/buildrpm diff --git a/utils/buildrpm b/utils/buildrpm index 408cdd3..1898f1c 100644 --- a/utils/buildrpm +++ b/utils/buildrpm @@ -4,7 +4,7 @@ source=. version=`cat $source/../version` package=$source/../../alsa-utils-$version.tar.gz -make -C .. pack +make -C .. dist if [ ! -r $package ]; then echo "Error: wrong package: $package"