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.
PACKAGE_STRING := @PACKAGE_STRING@
install_sh := @install_sh@
executables := @executables@
PACKAGE_STRING := @PACKAGE_STRING@
install_sh := @install_sh@
executables := @executables@
+ggo_descriptions_declared := @ggo_descriptions_declared@
GENGETOPT := @gengetopt@
HELP2MAN := @help2man@
GENGETOPT := @gengetopt@
HELP2MAN := @help2man@
if test ${have_ucred} = yes; then
AC_DEFINE(HAVE_UCRED, 1, define to 1 you have struct ucred)
fi
if test ${have_ucred} = yes; then
AC_DEFINE(HAVE_UCRED, 1, define to 1 you have struct ucred)
fi
+########################################################################### gengetopt
+echo 'option "z" z "" flag off' | $gengetopt --file-name conftest-ggo &&
+AC_CHECK_DECL(
+ [gengetopt_args_info_description],
+ [ggo_descriptions_declared=yes],
+ [ggo_descriptions_declared=no],
+ [#include "conftest-ggo.h"]
+)
+AC_SUBST(ggo_descriptions_declared)
########################################################################### curses
have_curses="yes"
OLD_CPPFLAGS="$CPPFLAGS"
########################################################################### curses
have_curses="yes"
OLD_CPPFLAGS="$CPPFLAGS"
$(cmdline_dir)/%.cmdline.h $(cmdline_dir)/%.cmdline.c: $(ggo_dir)/%.ggo git-version.h | $(cmdline_dir)
@[ -z "$(Q)" ] || echo 'GGO $<'
$(Q) $(GENGETOPT) $(ggo_opts) < $<
$(cmdline_dir)/%.cmdline.h $(cmdline_dir)/%.cmdline.c: $(ggo_dir)/%.ggo git-version.h | $(cmdline_dir)
@[ -z "$(Q)" ] || echo 'GGO $<'
$(Q) $(GENGETOPT) $(ggo_opts) < $<
+ifeq ($(ggo_descriptions_declared),no)
+ echo 'extern const char *$(*F)_args_info_description;' >> $(cmdline_dir)/$(*F).cmdline.h
+endif
$(ggo_dir)/server.ggo $(ggo_dir)/audiod.ggo: \
$(m4_ggo_dir)/loglevel.m4 $(m4_ggo_dir)/color.m4 \
$(ggo_dir)/server.ggo $(ggo_dir)/audiod.ggo: \
$(m4_ggo_dir)/loglevel.m4 $(m4_ggo_dir)/color.m4 \
args "--unamed-opts=audio_file --no-handle-version --conf-parser --no-handle-help"
args "--unamed-opts=audio_file --no-handle-version --conf-parser --no-handle-help"
+
+description "para_play operates either in command mode or in insert
+mode. In insert mode it presents a prompt and allows to enter commands
+like stop, play, pause etc. In command mode the current audio file
+is shown and the program reads single key strokes from stdin. Keys
+may be mapped to commands. Whenever a mapped key is pressed, the
+associated command is executed."
+
include(header.m4)
define(CURRENT_PROGRAM,para_play)
define(DEFAULT_CONFIG_FILE,~/.paraslash/play.conf)
include(header.m4)
define(CURRENT_PROGRAM,para_play)
define(DEFAULT_CONFIG_FILE,~/.paraslash/play.conf)
-/** Description to be included in the --detailed-help output. */
-#define PP_DESC \
-"para_play is a command line audio player.\n" \
-"\n" \
-"It operates either in command mode or in insert mode. In insert mode it\n" \
-"presents a prompt and allows to enter para_play commands like stop, play, pause\n" \
-"etc. In command mode, the current audio file is shown and the program reads\n" \
-"single key strokes from stdin. Keys may be mapped to para_play commands.\n" \
-"Whenever a mapped key is pressed, the associated command is executed.\n" \
-
__noreturn static void print_help_and_die(void)
{
int d = conf.detailed_help_given;
__noreturn static void print_help_and_die(void)
{
int d = conf.detailed_help_given;
printf_or_die("%s\n\n", version_single_line("play"));
printf_or_die("%s\n\n", play_args_info_usage);
if (d)
printf_or_die("%s\n\n", version_single_line("play"));
printf_or_die("%s\n\n", play_args_info_usage);
if (d)
- printf_or_die("%s\n", PP_DESC);
+ printf_or_die("%s\n", play_args_info_description);
for (; *p; p++)
printf_or_die("%s\n", *p);
exit(0);
for (; *p; p++)
printf_or_die("%s\n", *p);
exit(0);