From 1a7c2fedf559793ac52ac7b9b2525031c9368a85 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 20 Aug 2001 11:27:44 +0000 Subject: [PATCH] Use autoconf/automake GNU tools. --- sb16_csp/Makefile | 27 --------------------------- sb16_csp/Makefile.am | 11 +++++++++++ sb16_csp/configure.in | 10 ++++++++++ sb16_csp/cspctl.c | 18 +++++++++++++++--- sb16_csp/cvscompile | 24 ++++++++++++++++++++++++ sb16_csp/make.conf | 12 ------------ 6 files changed, 60 insertions(+), 42 deletions(-) delete mode 100644 sb16_csp/Makefile create mode 100644 sb16_csp/Makefile.am create mode 100644 sb16_csp/configure.in create mode 100644 sb16_csp/cvscompile delete mode 100644 sb16_csp/make.conf diff --git a/sb16_csp/Makefile b/sb16_csp/Makefile deleted file mode 100644 index 82768df..0000000 --- a/sb16_csp/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -TOP = . -include $(TOP)/make.conf - -CFLAGS = $(COPTS) $(INCLUDES) -LIBS = $(ASOUND) - -OBJS = cspctl.o - - -# Build all the targets. -# -all: $(OBJS) - $(CC) -o cspctl $(CFLAGS) $(OBJS) $(LIBS) - -install: all - $(INSTALL) cspctl $(INSTDIR) - -# Remove all object files and exectutables -# -clean: - rm -f cspctl $(OBJS) core a.out - -# Remove all generated and built files. -# -clobber: clean - -cspctl.o : cspctl.c diff --git a/sb16_csp/Makefile.am b/sb16_csp/Makefile.am new file mode 100644 index 0000000..5b00c27 --- /dev/null +++ b/sb16_csp/Makefile.am @@ -0,0 +1,11 @@ +# # Process this file with automake to produce Makefile.in. +AUTOMAKE_OPTIONS = 1.3 foreign + +CFLAGS = -Wall -g + +bin_PROGRAMS = cspctl +man_MANS = cspctl.1 + +cspctl_SOURCES = cspctl.c + +EXTRA_DIST = README COPYING diff --git a/sb16_csp/configure.in b/sb16_csp/configure.in new file mode 100644 index 0000000..d3bf7f2 --- /dev/null +++ b/sb16_csp/configure.in @@ -0,0 +1,10 @@ +AC_INIT(cspctl.c) +AM_INIT_AUTOMAKE(cspctl, 0.2.0) +AC_PROG_CC +AC_PROG_INSTALL +AC_HEADER_STDC +AM_PATH_ALSA(0.9.0) +CFLAGS="$CFLAGS $ALSA_FLAGS" +LDFLAGS="$LDFLAGS $ALSA_LIBS" + +AC_OUTPUT(Makefile) diff --git a/sb16_csp/cspctl.c b/sb16_csp/cspctl.c index be9e2b4..95d4596 100644 --- a/sb16_csp/cspctl.c +++ b/sb16_csp/cspctl.c @@ -65,6 +65,11 @@ static void help(char *command) , command); } +static void version(void) +{ + printf("Version: " VERSION "\n"); +} + static int csp_command (int idx, int dev, int command, char *filename) { int fd, err; @@ -130,14 +135,21 @@ int main(int argc, char *argv[]) help(argv[0]); return 0; } + if (argc > 1 && !strcmp(argv[1], "--version")) { + version(); + return 0; + } strcpy (microcode.info.codec_name, "UNKNOWN"); microcode.info.func_req = 1; - while ((c = getopt(argc, argv, "hc:f:d:")) != EOF) { + while ((c = getopt(argc, argv, "hvc:f:d:")) != EOF) { switch (c) { case 'h': help(argv[0]); return 0; + case 'v': + version(); + return 0; case 'c': { card = snd_card_get_index(optarg); @@ -186,13 +198,13 @@ int main(int argc, char *argv[]) // Get control handle for selected card sprintf(card_id, "hw:%i", card); - if (err = snd_ctl_open(&ctl_handle, card_id, 0) < 0) { + if ((err = snd_ctl_open(&ctl_handle, card_id, 0)) < 0) { error("control open (%s): %s", card_id, snd_strerror(err)); return 1; } // Read control hardware info from card - if (err = snd_ctl_card_info(ctl_handle, card_info) < 0) { + if ((err = snd_ctl_card_info(ctl_handle, card_info)) < 0) { error("control hardware info (%s): %s", card_id, snd_strerror(err)); exit(1); } diff --git a/sb16_csp/cvscompile b/sb16_csp/cvscompile new file mode 100644 index 0000000..01e8151 --- /dev/null +++ b/sb16_csp/cvscompile @@ -0,0 +1,24 @@ +#!/bin/bash + +if test "x$AUTOMAKE_DIR" = "x"; then + if test -d /usr/local/share/automake; then + AUTOMAKE_DIR=/usr/local/share/automake + fi + if test -d /usr/share/automake; then + AUTOMAKE_DIR="/usr/share/automake" + fi +fi + +for f in install-sh mkinstalldirs missing; do + cp -av $AUTOMAKE_DIR/$f . +done + +aclocal $ACLOCAL_FLAGS +automake --foreign --add-missing +autoconf +export CFLAGS='-O2 -Wall -pipe -g' +echo "CFLAGS=$CFLAGS" +echo "./configure $@" +./configure $@ +unset CFLAGS +make diff --git a/sb16_csp/make.conf b/sb16_csp/make.conf deleted file mode 100644 index 74256c6..0000000 --- a/sb16_csp/make.conf +++ /dev/null @@ -1,12 +0,0 @@ -# Options required by the C compiler -COPTS = -O - -# Path to include files -INCLUDES = -I . - -# Options to link with alsa sound library -ASOUND = -lasound - -# Installation options -INSTALL = install -s -INSTDIR = /usr/local/bin -- 2.47.1