Commit 4356080a authored by Ondřej Surý's avatar Ondřej Surý

Read the Knot DNS version from libknot.h

parent 3d31a919
# -*- Autoconf -*-
AC_PREREQ([2.60])
AC_INIT([knot], [2.1.0-dev], [knot-dns@labs.nic.cz])
AC_CONFIG_SRCDIR([src/knot/main.c])
# We extract version numbers from src/libknot/libknot.h
define([gv],[perl ./getver.pl ]$1 ./src/libknot/libknot.h)
m4_define([libknot_MAJOR],esyscmd(gv(MAJOR)))dnl
m4_define([libknot_MINOR],esyscmd(gv(MINOR)))dnl
m4_define([libknot_REVISION],esyscmd(gv(RELEASE)))dnl
m4_define([libknot_EXTRA],esyscmd(gv(EXTRA)))dnl
m4_define([libknot_PKG_VERSION],[libknot_MAJOR.libknot_MINOR.libknot_REVISION]libknot_EXTRA)]dnl
AC_INIT([knot], libknot_PKG_VERSION, [knot-dns@labs.nic.cz])
AM_INIT_AUTOMAKE([gnits subdir-objects no-dist-gzip dist-xz -Wall -Werror])
AM_SILENT_RULES([yes])
AC_CONFIG_SRCDIR([src/knot/main.c])
AC_CONFIG_HEADERS([src/config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_USE_SYSTEM_EXTENSIONS([_GNU_SOURCE])
......
#!/usr/bin/env perl
# Simple script to extract the version number parts from
# src/libknot/libknot.h. If called with the middle word of the
# version macro, it prints the value of that macro. If called with no
# argument, it outputs a human-readable version string. This must be
# run in the project root. It is used by configure.ac and
# docs/naturaldocs/run_docs.sh.
use strict;
my $key = shift;
my $file = shift;
my @version_parts = ();
open FH, "<$file" # old-style filehandle for max. portability
or die "Unable to open 'src/libknot/libknot.h' for reading.\n";
while(<FH>) {
next unless m{versiong3d31a91};
next unless /^#define\s+LIBKNOT_([A-Z0-9]+)_VERSION+\s+(\S+)/;
my ($lk, $lv) = ($1, $2);
if ($lk eq $key) {
chomp $lv;
$lv =~ s/"//g;
print $lv; # no newline
exit(0); # success!
}
push @version_parts, $lv if (!$key);
}
close(FH);
if (scalar @version_parts == 4) {
my $result = join(".", @version_parts[0..2]);
$result .= $version_parts[3];
$result =~ s/"//g;
print $result;
exit(0);
}
exit(1); # failure
......@@ -26,6 +26,16 @@
#pragma once
/* Version information. This gets parsed by build scripts as well as
* gcc so each #define line in this group must also be splittable on
* whitespace, take the form LIBKNOT_*_VERSION and contain the magical
* trailing comment. */
#define LIBKNOT_MAJOR_VERSION 2 /*versiong3d31a91*/
#define LIBKNOT_MINOR_VERSION 1 /*versiong3d31a91*/
#define LIBKNOT_RELEASE_VERSION 0 /*versiong3d31a91*/
#define LIBKNOT_EXTRA_VERSION "-dev" /*versiong3d31a91*/
/* End parsable section. */
#include "libknot/binary.h"
#include "libknot/codes.h"
#include "libknot/consts.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment