summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2018-09-02 19:28:21 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2018-09-02 19:30:21 (EDT)
commit3901e13de2b65d332f714638ebf8871cd3eceb9d (patch)
tree9e246de62bb629109752e569b5c5a4f3cef61acc
parentbf206e5d2818b4f12c434f268834e2655c5178f1 (diff)
configure.ac, config.sh.in: Check for date with %s
-rw-r--r--config.sh.in1
-rw-r--r--configure.ac32
2 files changed, 33 insertions, 0 deletions
diff --git a/config.sh.in b/config.sh.in
index e882179..767586f 100644
--- a/config.sh.in
+++ b/config.sh.in
@@ -1,2 +1,3 @@
PACKAGE='@PACKAGE@'
PACKAGE_NAME='@PACKAGE_NAME@'
+DATE='@DATE@'
diff --git a/configure.ac b/configure.ac
index 756e494..ae4fbab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -58,6 +58,38 @@ AC_ARG_WITH(
]
)
+AC_ARG_WITH(
+ [date],
+ [AS_HELP_STRING([--with-date=PATH],
+ [path to date utility with `%s' format specifier])],
+ dnl This `dnl' is needed to workaround Vim syntax highlighting.
+ [
+ case "${withval}" in
+ 'yes'|'')
+ AC_MSG_ERROR(
+ [--with-date requires an argument])
+ ;;
+ 'no')
+ AC_MSG_ERROR([date is required])
+ ;;
+ *)
+ DATE="${withval}"
+ AC_SUBST([DATE])
+ ;;
+ esac
+ ],
+ [
+ AC_PATH_PROG([DATE], [date])
+ if test -z "${DATE}"; then
+ AC_MSG_ERROR([date not found])
+ fi
+ ]
+)
+dnl Ugh, quadrigraphs.
+case "$(date '+%s' 2>/dev/null)" in *@<:@!0-9@:>@*)
+ AC_MSG_ERROR([${DATE} doesn't support the `%s' format sequence])
+esac
+
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([config.sh])
AC_CONFIG_FILES([tests/aux/defs.sh])