]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Add version definitions to installed headers
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 23 Nov 2012 13:51:12 +0000 (13:51 +0000)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 23 Nov 2012 13:51:12 +0000 (13:51 +0000)
Fix up displaying version in other utilities

Make.inc.in
Makefile
configure
configure.in
src/include/all.mk
src/include/autoconf.h.in
src/main/dhclient.c
src/main/radclient.c
src/main/radmin.c
src/main/radsniff.c

index 684c30c719100feae4feca31207354ba0030a7da..9bb9831e4f7144eedb052c767c7b61b483e68688 100644 (file)
@@ -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
index 9e397abf09dd86be63822eef36664cc5a34578a7..abddbae7b958e71a17a55acdc86c0e27dfde3dc3 100644 (file)
--- 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
 
index 94ea3365c1cb6442c67ded44052e9222089fb546..0d8a4c7c42c2e1037374ddc194b14faccf10aef4 100755 (executable)
--- 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.
 
 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
 
index 2129d6f4c039ddaf5d334946a05f1355a4f3e9f7..d80978dd60d5352fcdd8fc6f6f4631fd04f58e94 100644 (file)
@@ -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 <ma><ma><mi><mi><in><in>])
+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 \
index 6543d46f488958561a7dca61dde4b08f32050b40..e458394167f389a9b3caac232689b6c5c217c275 100644 (file)
@@ -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 $@
index 2739b8e6897178a2cd30ed10f4cacad052387dea..07b0ced7394cfb70da0aabccd501f0ee73c00be5 100644 (file)
 /* Posix-Style ctime_r */
 #undef POSIXSTYLE
 
+/* Version integer in format <ma><ma><mi><mi><in><in> */
+#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
 
index 7519ac2cb782ed819fe52d60cdcb1b5bb493eb95..2f46c73309056df91d211c59a31af2a7d24764aa 100644 (file)
@@ -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] <command>\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':
index 35a54877dca8834851774d80c1591915e582de0b..f33cf94d7f07b2dc062e701d75145972b1762c6b 100644 (file)
@@ -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':
index eb60a6595d03f1005bd9f3e16ed17645c9f3faca..5ca77570623a41c80003a8284e2ced9da260b433 100644 (file)
@@ -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__;
 
 
 /*
index afc6b2b8fd6a5e0ef2456040eb253ec9e7aadc29..74d982f269e74697404a739dd8e2e9e2bed1b3aa 100644 (file)
@@ -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)
 {