build: Remove m4/gengetopt. This directory only contained a single file: the makefile for generating the command line parsers with gengetopt. Since we no longer rely on gengetopt, we may remove $(m4_ggo_dir), m4/gengetopt/makefile and the corresponding include directive in Makefile.real.
build: Insist on m4 being installed. Unlike stated in the manual, m4 is not an optional package that is only needed on developer machines to build the html version of the manual. Rather, the m4 macro processor is an essential requirement because the gengetopt input files are generated with m4 from their templates in m4/gengetopt. This patch moves the documentation item on m4 from the development section of the manual to the list of required packages for building the paraslash package. It also adds a check for the m4 executable to configure.ac to let the generated configure script fail the build early on systems where m4 is not installed.
build: Fix m4 dependencies for BSD m4. FreeBSD and NetBSD ship an m4 version which does not understand the --debug=i option which we use to generate the .m4d dependency files. This results in empty dependency files on those systems. This was broken since m4 dependencies were introduced two years ago in commit e249d105 (Generate ggo dependencies automatically). The bug went unnoticed for so long because the problematic m4 command is the first command of a pipeline (hence the exit code is lost), and because the command redirects stderr, so the error message is not printed to the terminal. This commit fixes the bug by using the (portable) -s option of m4 rather than --debug. The -s option outputs line synchronization directives which include the file name, so it is equally well suited for generating the dependency files.
build: Silence ggo_descriptions_declared command. This command makes the build output a bit noisy.
Include options for receivers/filters/writer in man pages This broke in v0.5.0 when we started to create the man pages in a way that works also in a cross-compile setup. This fix introduces a new script man_util.bash which does the real work and hides all the ugliness from the Makefiles.
build: Generate man pages directly from ggo files. Currently all man pages are created by help2man which executes the para_xxx binaries just compiled with the --detailed-help and --version options given to obtain the input for the man page to create. The obvious shortcoming of this approach is that it simply does not work when cross-compiling. There is another disadvantage though: Since the man page file (para_xxx.1) depends on the executable (para_xxx), any code change causes all affected man pages to be recreated, even if nothing has changed that would alter the man page content. The good news is that gengetopt can create the help output without generating or compiling any code. The bad news is that help2man insists on executing a program with --help and --version to get the output. This commit teaches Makefile to create a dummy shell script for each executable which accepts the above options and runs gengetopt on the .ggo file to obtain the help text. This makes cross-compiling possible and shortens rebuild times since with the patch applied, the man page is only recreated when the ggo file changes.
Don't include $codename in ggo version string. This variable no longer used. Since we do not rely on gengetopt's implementation of --version any more, this does not matter much. Let's fix it anyway.
Generate ggo dependencies automatically. Currently we maintain the dependency list of each ggo file manually in m4/gengetopt/makefile. This is tedious and error-prone, and missing dependencies result in build failures which are not repeatable and hard to locate. This changes the build system to keep track of these dependencies automatically. We now create one .m4d file for each executable. This file lists the dependencies of the corresponding ggo file, i.e. those m4 files which are included in order to make the ggo. All .m4d files are pulled in from the main Makefile via the -include directive, in the same way we include the object dependency files (.d) generated by gcc.
Use self-made help to avoid recompilations on version changes. This provides print_help() for all remaining commands so that we can get rid of the gengetopt generated help output completely. Hence the *.cmdline.[ch] files no longer depend on git-version.h which saves a lot of recompilations.
Make gengetopt descriptions work. With gengetopt's text and description options it is not possible to print a text only when --detailed-help was given, but not when only --help is given. Moreover, headers generated with old versions of gengetopt do not export the description text. However, declaring it unconditionally causes compiler warnings on new systems. To circumvent these problems, we introduce a new test for configure which checks whether the description string is declared. If it is not, we simply append the declaration to the *.cmdline.h files. This change allows to move the description string of para_play to the gengetopt source file.
Make all commands print git version and improve version string. Currently the format of the first line of the help output varies between executables, for example: para_afh git (0.4.12.12.g15a4: spectral gravity) para_audioc git This difference comes from the fact that para_afh has its own ->print_help method which uses the VERSION_SINGLE_LINE macro of version.h while para_audioc relies on gengetopt's help output. The latter uses the make variable PACKAGE_VERSION which gets initialized at configure time through the second argument in AC_INIT of configure.ac. This value is either the version number for or the string "git". It's a good thing to have the abbreviated git version encoded in all executables, so this commit changes the argument of gengetopt's --set-version to the git version string including the codename. With the patch applied, the output of all commands looks like this if --version was given: para_filter 0.4.12.12.g11d7 (spectral gravity) To make sure things stay consistent, the patch introduces the VERSION_SINGLE_LINE macro and changes all commands to use it instead of open coding the version string.
Speed up dep target. By default "make" removes intermediate files during the build. However, some of the files generated by gengetopt are needed again later for a different target. This patch declares these generated files as "precious", so they will no longer be removed. On one system the build time went down from 30s to 25s due to this one-liner.
Merge branch 't/resample' Was cooking for quite some time. The merge conflicted slightly, but this was easy to fix. However, even with the conflict resolved, the merged tree would not compile because after the merge para_play depends on libsamplerate, but this dependency was not encoded in configure.ac. There was no way to fix this issue in either of the two branches involved without rewriting history: The recently merged t/afh_receiver branch (which introduced para_play) had no idea of libsamplerate while t/resample has no idea of para_play. This merge commit fixes both issues. 0eb69b resample filter: Implementation. cad284 resample filter: Infrastructure. 37e0df check_wav: Ask parent nodes before falling back to defaults. 216399 Replace check_wav_task by write_task. 1af65c Move wav detection code to a separate file. d5dc1c write: Make wav-related config options modular. c25d04 para_filter: Call proper ->free_config method on shutdown. Conflicts: m4/gengetopt/makefile
resample filter: Implementation. The resample filter allows to change the sample rate of a stream on the fly. All the magic happens within libsamplerate, so the implementation is quite simple. However, one tricky thing to consider is how wav headers are treated: Although the resample filter creates only a single task, it adds two different nodes to the buffer tree, one for the wav detector and another one for the resample filter itself. At startup the generic code of para_filter or para_audiod adds only the resample filter node, which in turn inserts the wav detector as its own parent node. This requires to insert a new internal node to the buffer tree which is currently not supported by the buffer tree API. It is easy to implement this feature though, so this commit adds the missing functionality to buffer_tree.c.
write: Make wav-related config options modular. The --channels, --sample-rate and --sample-format options will also be used by the resample filter. This moves these options to separate files which are included from write.m4. This allows to include them also from the config file of the resample filter.
para_play, infrastructure. Now that the preparatory changes to the interactive subsystem (single key mode, status bar, signal handling) and the writer nodes (notifications) and receiver nodes (btr exec mechanism) are in place, we can move on to the para_play executable. This patch adds only the necessary changes to the build system and provides a dummy implementation of para_play. The real implementation will be provided as as a separate patch in the next commit.
fade: Add --loglevel option. All the infrastructure is already in place, so this patch is quite simple.
Simplify ggo makefile. Currently we have three different targets for creating *_cmdline.[ch] files. This is because receivers, filters and writers need slightly different command line options. This patch defines the common options in the ggo makefile and moves additional parameters to the individual .m4 files so that a single target to create *_cmdline.[ch] is now sufficient. The name of the command line parsers of some filters and writers changed due to this unification, so these are updated accordingly.
write: Get rid of gengetopt's string parser. It causes gengetopt to generate quite some additional code for the string parsers of all writers. Moreover, this string parser is inferior to create_argv() and create_shifted_argv() of string.c as gengetopt's parser does not honor any quoting at all. This commit changes the signature of the ->parse_config_or_die method of struct writer to take an (argc, argv) pair instead of a string. All writers can thus call the vanilla command line parser of gengetopt. The single user in write_common.c now calls ->parse_config_or_die() with an (argc, argv) pair obtained from create_shifted_argv().
ggo: Move options from makefile to .m4 files. It's easier to specify these options for gengetopt in the corresponding m4 files, together with the command line options of the program.