aboutsummaryrefslogtreecommitdiff
path: root/build-aux
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2013-12-18 11:39:28 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2013-12-18 11:39:28 +0200
commitfa0d6d088a1fe22b178ef2565351f15622a1d6d2 (patch)
tree2c894d8d3797ba6577710e38761f7d0c1d65e76b /build-aux
parent57a00b140954a2c22ba2fdebc93e8e6eda41b2a3 (diff)
downloadgrecs-fa0d6d088a1fe22b178ef2565351f15622a1d6d2.tar.gz
grecs-fa0d6d088a1fe22b178ef2565351f15622a1d6d2.tar.bz2
New option program_version (OPTION_BEGIN macro).
When used, the variable program_version is defined as a string containing canonical project name and version. Optionally, the variable name can be overridden by supplying the desired name as the option value (e.g. program_version=myver). * build-aux/getopt.m4 (_getopt_if_option_null): New macro. (STDFUNC): Handle program_version.
Diffstat (limited to 'build-aux')
-rw-r--r--build-aux/getopt.m49
1 files changed, 9 insertions, 0 deletions
diff --git a/build-aux/getopt.m4 b/build-aux/getopt.m4
index 8a9b675..4f11139 100644
--- a/build-aux/getopt.m4
+++ b/build-aux/getopt.m4
@@ -43,6 +43,12 @@ dnl Check if option NAME is set.
define([<_getopt_if_option_set>],
[<ifdef(_getopt_mangle_option([<$1>]),[<$2>],[<$3>])>])
+dnl _getopt_if_option_null(NAME,IF-NULL,IF-NOT-NULL)
+dnl ---------------------------------------------
+dnl Check if option NAME is set.
+define([<_getopt_if_option_null>],
+ [<ifelse(indir(_getopt_mangle_option([<$1>])),,[<$2>],[<$3>])>])
+
dnl _getopt_option_switch(NAME1,IF-SET1,[NAME2,IF-SET2,[...]],[IF-NOT-SET])
dnl ------------------------------------------------------------------------
dnl If NAME1 is set, run IF-SET1. Otherwise, if NAME2 is set, run IF-SET2.
@@ -327,6 +333,9 @@ _getopt_if_option_set([<copyright_holder>],dnl
};
static struct grecs_node *cmdline_tree;
+_getopt_if_option_set([<program_version>],dnl
+[<const char *_getopt_if_option_null(program_version,program_version,[<_getopt_get_option(program_version)>]) = $2 " (" PACKAGE_NAME ") " PACKAGE_VERSION;
+>])
divert(-1)
>])

Return to:

Send suggestions and report system problems to the System administrator.