OSDN Git Service

Convert alsa-utils to use automake
authorChris Cannam <cannam@all-day-breakfast.com>
Sat, 30 Jan 1999 19:12:34 +0000 (19:12 +0000)
committerChris Cannam <cannam@all-day-breakfast.com>
Sat, 30 Jan 1999 19:12:34 +0000 (19:12 +0000)
25 files changed:
Makefile [deleted file]
Makefile.am [new file with mode: 0644]
Makefile.conf.in [deleted file]
acconfig.h [new file with mode: 0644]
alsactl/Makefile [deleted file]
alsactl/Makefile.am [new file with mode: 0644]
alsactl/alsactl.c
alsamixer/Makefile [deleted file]
alsamixer/Makefile.am [new file with mode: 0644]
alsamixer/alsamixer.c
amixer/Makefile [deleted file]
amixer/Makefile.am [new file with mode: 0644]
aplay/Makefile [deleted file]
aplay/Makefile.am [new file with mode: 0644]
aplay/aplay.1 [moved from aplay/arecord.1 with 100% similarity]
aplay/aplay.c
configure.in
cvscompile [new file with mode: 0644]
include/Makefile [deleted file]
include/Makefile.am [new file with mode: 0644]
include/aconfig.h.in
include/stamp-h.in [new file with mode: 0644]
utils/Makefile [deleted file]
utils/Makefile.am [new file with mode: 0644]
utils/buildrpm

diff --git a/Makefile b/Makefile
deleted file mode 100644 (file)
index 6d9c471..0000000
--- a/Makefile
+++ /dev/null
@@ -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
diff --git a/Makefile.am b/Makefile.am
new file mode 100644 (file)
index 0000000..1213b6b
--- /dev/null
@@ -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 (file)
index de6e0ca..0000000
+++ /dev/null
@@ -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@
diff --git a/acconfig.h b/acconfig.h
new file mode 100644 (file)
index 0000000..f1ce75b
--- /dev/null
@@ -0,0 +1,5 @@
+/* Package name */
+#undef PACKAGE
+
+/* Package version */
+#undef VERSION
diff --git a/alsactl/Makefile b/alsactl/Makefile
deleted file mode 100644 (file)
index 75aef5f..0000000
+++ /dev/null
@@ -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
diff --git a/alsactl/Makefile.am b/alsactl/Makefile.am
new file mode 100644 (file)
index 0000000..419630a
--- /dev/null
@@ -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
index 34beb70..18ebf6d 100644 (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;
 }
+
+
diff --git a/alsamixer/Makefile b/alsamixer/Makefile
deleted file mode 100644 (file)
index 09db3b7..0000000
+++ /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 (file)
index 0000000..4f582a4
--- /dev/null
@@ -0,0 +1,5 @@
+LDADD = $(CURSESLIB) -lasound
+
+bin_PROGRAMS = alsamixer
+man_MANS = alsamixer.1
+alsamixer_INCLUDES = -I$(top_srcdir)/include -DCURSESINC="$(CURSESINC)"
index 4d82105..8b7e6f5 100644 (file)
 #include <unistd.h>
 #include <sys/signal.h>
 
-#ifndef NCURSESINC
+#ifndef CURSESINC
 #include <ncurses.h>
 #else
-#include NCURSESINC
+#include CURSESINC
 #endif
 #include <time.h>
 
diff --git a/amixer/Makefile b/amixer/Makefile
deleted file mode 100644 (file)
index 1f82b6f..0000000
+++ /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 (file)
index 0000000..6d4d0d1
--- /dev/null
@@ -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 (file)
index d10a107..0000000
+++ /dev/null
@@ -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
diff --git a/aplay/Makefile.am b/aplay/Makefile.am
new file mode 100644 (file)
index 0000000..2cfdd72
--- /dev/null
@@ -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)
similarity index 100%
rename from aplay/arecord.1
rename to aplay/aplay.1
index 3b98981..2966e77 100644 (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[])
index da23ee8..c80a927 100644 (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)
diff --git a/cvscompile b/cvscompile
new file mode 100644 (file)
index 0000000..a1758e1
--- /dev/null
@@ -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 (file)
index e1e5789..0000000
+++ /dev/null
@@ -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 *~
-
diff --git a/include/Makefile.am b/include/Makefile.am
new file mode 100644 (file)
index 0000000..9f4f123
--- /dev/null
@@ -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
index 5e078f9..9c26137 100644 (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
diff --git a/include/stamp-h.in b/include/stamp-h.in
new file mode 100644 (file)
index 0000000..9788f70
--- /dev/null
@@ -0,0 +1 @@
+timestamp
diff --git a/utils/Makefile b/utils/Makefile
deleted file mode 100644 (file)
index e1e5789..0000000
+++ /dev/null
@@ -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 *~
-
diff --git a/utils/Makefile.am b/utils/Makefile.am
new file mode 100644 (file)
index 0000000..083e5b4
--- /dev/null
@@ -0,0 +1,4 @@
+EXTRA_DIST = buildrpm
+
+rpm: buildrpm alsa-lib.spec
+       VERSION=$(VERSION) $(srcdir)/buildrpm
index 408cdd3..1898f1c 100644 (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"