From: Arran Cudbard-Bell Date: Fri, 23 Nov 2012 13:51:12 +0000 (+0000) Subject: Add version definitions to installed headers X-Git-Tag: release_3_0_0_beta1~1497 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ad5d401ddd0ca1e36b73f0c2b1e99bb035f23fa2;p=thirdparty%2Ffreeradius-server.git Add version definitions to installed headers Fix up displaying version in other utilities --- diff --git a/Make.inc.in b/Make.inc.in index 684c30c7191..9bb9831e4f7 100644 --- a/Make.inc.in +++ b/Make.inc.in @@ -85,24 +85,9 @@ SQL_ODBC_LIBS = @ODBC_LIBS@ SQL_ODBC_INCLUDE = @ODBC_INCLUDE@ # -# Make version info available to the build targets and linker +# Version to use for packaging and other Make related things # -RADIUSD_MAJOR_VERSION = @RADIUSD_MAJOR_VERSION@ -RADIUSD_MINOR_VERSION = @RADIUSD_MINOR_VERSION@ -RADIUSD_INCRM_VERSION = @RADIUSD_INCRM_VERSION@ -RADIUSD_VERSION = @RADIUSD_VERSION@ -RADIUSD_VERSION_STRING = @RADIUSD_VERSION_STRING@ -RADIUSD_VERSION_COMMIT = @RADIUSD_VERSION_COMMIT@ - -CFLAGS += -DRADIUSD_MAJOR_VERSION=\"${RADIUSD_MAJOR_VERSION}\" -CFLAGS += -DRADIUSD_MINOR_VERSION=\"${RADIUSD_MINOR_VERSION}\" -CFLAGS += -DRADIUSD_INCRM_VERSION=\"${RADIUSD_INCRM_VERSION}\" -CFLAGS += -DRADIUSD_VERSION=\"${RADIUSD_VERSION}\" -CFLAGS += -DRADIUSD_VERSION_STRING=\"${RADIUSD_VERSION_STRING}\" - -ifdef RADIUSD_VERSION_COMMIT -CFLAGS += -DRADIUSD_VERSION_COMMIT=\"${RADIUSD_VERSION_COMMIT}\" -endif +RADIUSD_VERSION_STRING = @RADIUSD_VERSION_STRING@ # # This allows dlopen to do runtime checks for version mistmatches diff --git a/Makefile b/Makefile index 9e397abf09d..abddbae7b95 100644 --- a/Makefile +++ b/Makefile @@ -16,13 +16,9 @@ MFLAGS += --no-print-directory # ifeq "$(BOILER)" "yes" -# Require at least GNU Make 3.81 for the new build system -# Don't allow 3.80. Allow any 3.8x. This will need to be changed -# in a decade or two when GNU Make 3.90 is released. -BOILERMAKE=$(subst 3.8,yes,$(subst 3.80,,$(MAKE_VERSION))) - -# The version of GNU Make is too old, don't use it. -ifeq "" "$(findstring yes,$(BOILERMAKE))" +# The version of GNU Make is too old, don't use it (.FEATURES variable was +# wad added in 3.81) +ifndef .FEATURES $(error The build system requires GNU Make 3.81 or later.) endif diff --git a/configure b/configure index 94ea3365c1c..0d8a4c7c42c 100755 --- a/configure +++ b/configure @@ -635,12 +635,6 @@ ac_includes_default="\ enable_option_checking=no ac_subst_vars='LTLIBOBJS LIBOBJS -RADIUSD_VERSION_COMMIT -RADIUSD_VERSION_STRING -RADIUSD_VERSION -RADIUSD_INCRM_VERSION -RADIUSD_MINOR_VERSION -RADIUSD_MAJOR_VERSION STATIC_MODULES USE_STATIC_LIBS USE_SHARED_LIBS @@ -719,6 +713,7 @@ LDFLAGS CFLAGS CC MAKEFLAGS +RADIUSD_VERSION_STRING target_alias host_alias build_alias @@ -2490,7 +2485,19 @@ RADIUSD_VERSION=`echo | awk -v major="$RADIUSD_MAJOR_VERSION" \ '{ printf "%02i%02i%02i", major, minor, incrm }'` RADIUSD_VERSION_STRING=`cat VERSION` -PACKAGE=freeradius + + + + +cat >>confdefs.h <<_ACEOF +#define RADIUSD_VERSION ${RADIUSD_VERSION} +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define RADIUSD_VERSION_STRING "${RADIUSD_VERSION_STRING}" +_ACEOF + # Check whether --enable-developer was given. @@ -18044,6 +18051,11 @@ fi if test -d $srcdir/.git -a "x$GIT" = "xyes"; then RADIUSD_VERSION_COMMIT=`git log --pretty=format:'%h' -n 1` + +cat >>confdefs.h <<_ACEOF +#define RADIUSD_VERSION_COMMIT "${RADIUSD_VERSION_COMMIT}" +_ACEOF + fi @@ -18537,12 +18549,6 @@ USE_STATIC_LIBS=$enable_static - - - - - - unset ac_cv_env_LIBS_set unset ac_cv_env_LIBS_value diff --git a/configure.in b/configure.in index 2129d6f4c03..d80978dd60d 100644 --- a/configure.in +++ b/configure.in @@ -23,11 +23,9 @@ dnl ############################################################# AC_PREREQ([2.59]) export CFLAGS LIBS LDFLAGS CPPFLAGS -m4_define(PACKAGE_MAIN, freeradius) - -AC_INIT(PACKAGE_MAIN,[$]Id[$],http://bugs.freeradius.org,,http://www.freeradius.org) -AC_CONFIG_SRCDIR(src/main/radiusd.c) -AC_CONFIG_HEADER(src/include/autoconf.h) +AC_INIT([freeradius],[$]Id[$],[http://bugs.freeradius.org],,[http://www.freeradius.org]) +AC_CONFIG_SRCDIR([src/main/radiusd.c]) +AC_CONFIG_HEADER([src/include/autoconf.h]) dnl ############################################################# dnl # @@ -46,7 +44,18 @@ RADIUSD_VERSION=`echo | awk -v major="$RADIUSD_MAJOR_VERSION" \ dnl # Still useful for custom builds RADIUSD_VERSION_STRING=`cat VERSION` -PACKAGE=PACKAGE_MAIN + +dnl # +dnl # Add definitions to Make.inc as it's used by various build targets +dnl # +AC_SUBST([RADIUSD_VERSION_STRING]) + +dnl # +dnl # Add definitions to autoconf.h, so that the headers that we install +dnl # contain the version number of the server. +dnl # +AC_DEFINE_UNQUOTED([RADIUSD_VERSION], [${RADIUSD_VERSION}], [Version integer in format ]) +AC_DEFINE_UNQUOTED([RADIUSD_VERSION_STRING], ["${RADIUSD_VERSION_STRING}"], [Raw version string from VERSION file]) dnl ############################################################# dnl # @@ -1042,6 +1051,7 @@ fi dnl append the current git hash onto the version string if test -d $srcdir/.git -a "x$GIT" = "xyes"; then RADIUSD_VERSION_COMMIT=`git log --pretty=format:'%h' -n 1` + AC_DEFINE_UNQUOTED([RADIUSD_VERSION_COMMIT],["${RADIUSD_VERSION_COMMIT}"],[Commit HEAD at time of configuring]) fi FR_TLS @@ -1301,12 +1311,6 @@ AC_SUBST(USE_SHARED_LIBS) USE_STATIC_LIBS=$enable_static AC_SUBST(USE_STATIC_LIBS) AC_SUBST(STATIC_MODULES) -AC_SUBST(RADIUSD_MAJOR_VERSION) -AC_SUBST(RADIUSD_MINOR_VERSION) -AC_SUBST(RADIUSD_INCRM_VERSION) -AC_SUBST(RADIUSD_VERSION) -AC_SUBST(RADIUSD_VERSION_STRING) -AC_SUBST(RADIUSD_VERSION_COMMIT) AC_OUTPUT(\ ./Make.inc \ diff --git a/src/include/all.mk b/src/include/all.mk index 6543d46f488..e458394167f 100644 --- a/src/include/all.mk +++ b/src/include/all.mk @@ -28,6 +28,7 @@ src/include/features.h: src/include/features-h src/include/autoconf.h @$(ECHO) HEADER $@ @cp $< $@ @grep "^#define[[:blank:]]\{1,\}WITH_" src/include/autoconf.h >> $@ + @grep "^#define[[:blank:]]\{1,\}RADIUSD_VERSION" src/include/autoconf.h >> $@ src/include/missing.h: src/include/missing-h src/include/autoconf.sed @$(ECHO) HEADER $@ diff --git a/src/include/autoconf.h.in b/src/include/autoconf.h.in index 2739b8e6897..07b0ced7394 100644 --- a/src/include/autoconf.h.in +++ b/src/include/autoconf.h.in @@ -416,6 +416,15 @@ /* Posix-Style ctime_r */ #undef POSIXSTYLE +/* Version integer in format */ +#undef RADIUSD_VERSION + +/* Commit HEAD at time of configuring */ +#undef RADIUSD_VERSION_COMMIT + +/* Raw version string from VERSION */ +#undef RADIUSD_VERSION_STRING + /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE diff --git a/src/main/dhclient.c b/src/main/dhclient.c index 7519ac2cb78..2f46c733090 100644 --- a/src/main/dhclient.c +++ b/src/main/dhclient.c @@ -65,6 +65,12 @@ static RADIUS_PACKET *reply = NULL; #define DHCP_VEND_LEN (308) #define DHCP_OPTION_MAGIC_NUMBER (0x63825363) +const char *dhclient_version = "dhclient version " RADIUSD_VERSION_STRING +#ifdef RADIUSD_VERSION_COMMIT +" (git #" RADIUSD_VERSION_COMMIT ")" +#endif +", built on " __DATE__ " at " __TIME__; + static void NEVER_RETURNS usage(void) { fprintf(stderr, "Usage: dhclient [options] server[:port] \n"); @@ -285,7 +291,7 @@ int main(int argc, char **argv) timeout = atof(optarg); break; case 'v': - printf("dhclient: $Id$ built on " __DATE__ " at " __TIME__ "\n"); + printf("%s\n", dhclient_version); exit(0); break; case 'x': diff --git a/src/main/radclient.c b/src/main/radclient.c index 35a54877dca..f33cf94d7f0 100644 --- a/src/main/radclient.c +++ b/src/main/radclient.c @@ -1022,7 +1022,7 @@ int main(int argc, char **argv) timeout = atof(optarg); break; case 'v': - printf("%s", radclient_version); + printf("%s\n", radclient_version); exit(0); break; case 'x': diff --git a/src/main/radmin.c b/src/main/radmin.c index eb60a6595d0..5ca77570623 100644 --- a/src/main/radmin.c +++ b/src/main/radmin.c @@ -82,7 +82,7 @@ const char *radmin_version = "radmin version " RADIUSD_VERSION_STRING #ifdef RADIUSD_VERSION_COMMIT " (git #" RADIUSD_VERSION_COMMIT ")" #endif -; +", built on " __DATE__ " at " __TIME__; /* diff --git a/src/main/radsniff.c b/src/main/radsniff.c index afc6b2b8fd6..74d982f269e 100644 --- a/src/main/radsniff.c +++ b/src/main/radsniff.c @@ -63,7 +63,7 @@ static const char *radsniff_version = "radsniff version " RADIUSD_VERSION_STRING #ifdef RADIUSD_VERSION_COMMIT " (git #" RADIUSD_VERSION_COMMIT ")" #endif -; +", built on " __DATE__ " at " __TIME__; static int filter_packet(RADIUS_PACKET *packet) {