Convert alsa-utils to use automake

This commit is contained in:
Chris Cannam 1999-01-30 19:12:34 +00:00
parent 69f215efe9
commit d9158162d0
25 changed files with 142 additions and 297 deletions

View File

@ -1,61 +0,0 @@
#
# Makefile for ALSA Utilities
# Copyright (c) 1994-98 by Jaroslav Kysela <perex@jcu.cz>
#
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

5
Makefile.am Normal file
View File

@ -0,0 +1,5 @@
INCLUDES=-I$(top_srcdir)/include
SUBDIRS=include alsactl alsamixer amixer aplay utils
rpm: dist
$(MAKE) -C $@

View File

@ -1,33 +0,0 @@
#
# Configuration Makefile for ALSA Utilities
# Copyright (c) 1994-98 by Jaroslav Kysela <perex@jcu.cz>
#
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="<ncurses.h>"
NCURSESLIB=-lncurses
LN_S=@LN_S@

5
acconfig.h Normal file
View File

@ -0,0 +1,5 @@
/* Package name */
#undef PACKAGE
/* Package version */
#undef VERSION

View File

@ -1,45 +0,0 @@
#
# Makefile for alsactl program
# Copyright (c) 1994-98 by Jaroslav Kysela <perex@jcu.cz>
#
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

6
alsactl/Makefile.am Normal file
View File

@ -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

View File

@ -21,6 +21,7 @@
#include "alsactl.h"
#include "aconfig.h"
#include "version.h"
#include <getopt.h>
#include <stdarg.h>
@ -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;
}

View File

@ -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 *~

5
alsamixer/Makefile.am Normal file
View File

@ -0,0 +1,5 @@
LDADD = $(CURSESLIB) -lasound
bin_PROGRAMS = alsamixer
man_MANS = alsamixer.1
alsamixer_INCLUDES = -I$(top_srcdir)/include -DCURSESINC="$(CURSESINC)"

View File

@ -30,10 +30,10 @@
#include <unistd.h>
#include <sys/signal.h>
#ifndef NCURSESINC
#ifndef CURSESINC
#include <ncurses.h>
#else
#include NCURSESINC
#include CURSESINC
#endif
#include <time.h>

View File

@ -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 *~

8
amixer/Makefile.am Normal file
View File

@ -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

View File

@ -1,34 +0,0 @@
#
# Makefile for aplay program
# Copyright (c) 1994-98 by Jaroslav Kysela <perex@jcu.cz>
#
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

24
aplay/Makefile.am Normal file
View File

@ -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)

View File

@ -38,6 +38,7 @@
#include <sys/asoundlib.h>
#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 <perex@jcu.cz>\n", command);
printf("%s: version " SND_UTIL_VERSION_STR " by Jaroslav Kysela <perex@jcu.cz>\n", command);
}
int main(int argc, char *argv[])

View File

@ -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='<ncurses.h>'; CURSESLIB='-lncurses'; ], [
AC_CHECK_LIB(curses, initscr,
[ CURSESINC='<curses.h>'; 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 <sys/asoundlib.h>
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)

9
cvscompile Normal file
View File

@ -0,0 +1,9 @@
#!/bin/bash
aclocal
automake --foreign
autoconf
export CFLAGS='-O2 -fomit-frame-pointer -Wall -pipe -g'
./configure
unset CFLAGS
make

View File

@ -1,10 +0,0 @@
#
# Makefile for ALSA utils package
# Copyright (c) 1994-98 by Jaroslav Kysela <perex@jcu.cz>
#
include ../Makefile.conf
clean:
rm -f core .depend *.o *.orig *~

25
include/Makefile.am Normal file
View File

@ -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

View File

@ -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 <sys/time.h> and <time.h>. */
#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

1
include/stamp-h.in Normal file
View File

@ -0,0 +1 @@
timestamp

View File

@ -1,10 +0,0 @@
#
# Makefile for ALSA utils package
# Copyright (c) 1994-98 by Jaroslav Kysela <perex@jcu.cz>
#
include ../Makefile.conf
clean:
rm -f core .depend *.o *.orig *~

4
utils/Makefile.am Normal file
View File

@ -0,0 +1,4 @@
EXTRA_DIST = buildrpm
rpm: buildrpm alsa-lib.spec
VERSION=$(VERSION) $(srcdir)/buildrpm

View File

@ -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"