build: generate version.c during configure

The TOOLSVERSION was inconsistent in configure.ac and Makefile:
* Rename the second parameter to AC_INIT() into short_version
* Calculate TOOLSVERSION during configure and use it to
  generate version.c from version.c.in
* For now, leave duplicate TOOLSVERSION in Makefile (for make dist)

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
This commit is contained in:
Oron Peled 2014-12-14 17:37:33 -05:00 committed by Tzafrir Cohen
parent fbb6c1a17e
commit 41532ca8a1
4 changed files with 14 additions and 20 deletions

View File

@ -143,13 +143,6 @@ programs: libs utils
utils: $(BINS) utils-subdirs
version.c: FORCE
@TOOLSVERSION="${TOOLSVERSION}" build_tools/make_version_c > $@.tmp
@if cmp -s $@.tmp $@ ; then :; else \
mv $@.tmp $@ ; \
fi
@rm -f $@.tmp
tests: $(TEST_BINS)
$(UTILS): %: %.o

View File

@ -1,10 +0,0 @@
#!/bin/sh
cat << END
/*
* version.c
* Automatically generated
*/
const char dahdi_tools_version[] = "DAHDI Tools Version - ${TOOLSVERSION}";
END

View File

@ -2,11 +2,11 @@
AC_PREREQ(2.59)
m4_define([TOOLSVERSION],
m4_define([short_version],
m4_bpatsubst(m4_esyscmd([build_tools/make_version . dahdi/tools]),
[\([0-9.]*\)\(\w\|\W\)*],
[\1]))
AC_INIT(dahdi, TOOLSVERSION, www.asterisk.org)
AC_INIT(dahdi, short_version, www.asterisk.org)
# check existence of the package
AC_CONFIG_SRCDIR([dahdi_cfg.c])
@ -211,7 +211,12 @@ fi
AC_SUBST(PPPD_VERSION)
AC_CONFIG_FILES([makeopts])
AC_SUBST([TOOLSVERSION], m4_esyscmd([build_tools/make_version . dahdi/tools]))
AC_CONFIG_FILES([
makeopts
version.c
])
AC_OUTPUT
AC_MSG_NOTICE(*** dahdi-tools build successfully configured ***)

6
version.c.in Normal file
View File

@ -0,0 +1,6 @@
/*
* version.c.in
*/
const char dahdi_tools_version[] = "DAHDI Tools Version - @TOOLSVERSION@";