![](https://seccdn.libravatar.org/avatar/9b845cae896f81bfdc08f0085b83c2cf.jpg?s=120&d=mm&r=g)
From 3a4bbd6d7af8b885d3795ecc5d017707f7e10811 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann <hun@n-dimensional.de> Date: Mon, 15 Oct 2007 23:23:00 +0200 Subject: [PATCH] Check that driver versions in configure.ac and src/rhd.h match
This check is run on "make check" in automake builds, and will prevent the creation of source dist tarballs with inconsistent versions when created with "make distcheck". --- Makefile.am | 2 +- checks/Makefile.am | 6 +++++ checks/version-check.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++ configure.ac | 1 + 4 files changed, 65 insertions(+), 1 deletions(-) create mode 100644 checks/Makefile.am create mode 100644 checks/version-check.c diff --git a/Makefile.am b/Makefile.am index f83dcbb..cc9f143 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,2 +1,2 @@ AUTOMAKE_OPTIONS = foreign -SUBDIRS = src \ No newline at end of file +SUBDIRS = src checks diff --git a/checks/Makefile.am b/checks/Makefile.am new file mode 100644 index 0000000..c2957d6 --- /dev/null +++ b/checks/Makefile.am @@ -0,0 +1,6 @@ +TESTS = $(check_PROGRAMS) +check_PROGRAMS = + +check_PROGRAMS += version-check +version_check_SOURCES = version-check.c +version_check_CPPFLAGS = $(AM_CPPFLAGS) @XORG_CFLAGS@ -I$(top_srcdir)/src $(CPPFLAGS) diff --git a/checks/version-check.c b/checks/version-check.c new file mode 100644 index 0000000..835d2bd --- /dev/null +++ b/checks/version-check.c @@ -0,0 +1,57 @@ +/* + * Copyright 2007 Hans Ulrich Niedermann <hun@n-dimensional.de> + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/* Not using HAVE_CONFIG_H -- this program cannot work without config.h */ +#include "config.h" + +/* rhd.h cannot be included without xf86.h */ +#include "xf86.h" +#include "rhd.h" + +#include <stdio.h> +#include <string.h> + +int main() +{ + /* PACKAGE_* is from config.h (i.e. from configure.ac) + * RHD_* is from rhd.h + */ + if ((PACKAGE_VERSION_MAJOR != RHD_MAJOR_VERSION) || + (PACKAGE_VERSION_MINOR != RHD_MINOR_VERSION) || + (PACKAGE_VERSION_PATCHLEVEL != RHD_PATCHLEVEL)) { + printf("Version number mismatch between configure.ac and src/rhd.h\n" + "configure.ac string: %s\n" + "configure.ac maj.min.patch: %d.%d.%d\n" + "src/rhd.h maj.min.patch: %d.%d.%d\n" + "src/rhd.h single int value: 0x%08x\n", + PACKAGE_VERSION, + PACKAGE_VERSION_MAJOR, + PACKAGE_VERSION_MINOR, + PACKAGE_VERSION_PATCHLEVEL, + RHD_MAJOR_VERSION, + RHD_MINOR_VERSION, + RHD_PATCHLEVEL, + RHD_VERSION); + return 1; + } + return 0; +} diff --git a/configure.ac b/configure.ac index 16d9251..0476725 100644 --- a/configure.ac +++ b/configure.ac @@ -124,5 +124,6 @@ XORG_RELEASE_VERSION AC_OUTPUT([ Makefile + checks/Makefile src/Makefile ]) -- 1.5.3.4 -- To unsubscribe, e-mail: radeonhd+unsubscribe@opensuse.org For additional commands, e-mail: radeonhd+help@opensuse.org