[libdvdnav-devel] [PATCH] configure: generate version.h
Petri Hintukainen
phintuka at gmail.com
Wed Sep 9 09:13:21 CEST 2015
---
Makefile.am | 5 +++--
configure.ac | 17 ++++++++++++++++-
src/dvdread/dvd_reader.h | 2 +-
src/dvdread/version.h.in | 37 +++++++++++++++++++++++++++++++++++++
4 files changed, 57 insertions(+), 4 deletions(-)
create mode 100644 src/dvdread/version.h.in
diff --git a/Makefile.am b/Makefile.am
index 57ca371..edab5bb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,6 @@
ACLOCAL_AMFLAGS = -Im4
-AM_CPPFLAGS = -I$(top_srcdir)/src $(CSS_CFLAGS)
+AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_builddir)/src/dvdread $(CSS_CFLAGS)
dist_doc_DATA = AUTHORS ChangeLog COPYING NEWS README TODO
@@ -46,7 +46,8 @@ pkginclude_HEADERS = \
src/dvdread/ifo_types.h \
src/dvdread/nav_print.h \
src/dvdread/nav_read.h \
- src/dvdread/nav_types.h
+ src/dvdread/nav_types.h \
+ src/dvdread/version.h
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = misc/dvdread.pc
diff --git a/configure.ac b/configure.ac
index 187b19a..5cb5848 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,10 @@
-AC_INIT(libdvdread, 5.0.3)
+dnl library version number
+m4_define([dvdread_major], 5)
+m4_define([dvdread_minor], 0)
+m4_define([dvdread_micro], 3)
+m4_define([dvdread_version],[dvdread_major.dvdread_minor.dvdread_micro])
+
+AC_INIT(libdvdread, dvdread_version)
AC_CONFIG_SRCDIR([src/dvd_reader.c])
AC_PREREQ(2.53)
@@ -105,6 +111,14 @@ AS_IF([test "x$ac_cv_c_compiler_gnu" = "xyes"], [
AC_DEFINE([UNUSED], [], [Unused parameter annotation])
])
+dnl export library version number
+DVDREAD_VERSION_MAJOR=dvdread_major()
+DVDREAD_VERSION_MINOR=dvdread_minor()
+DVDREAD_VERSION_MICRO=dvdread_micro()
+AC_SUBST(DVDREAD_VERSION_MAJOR)
+AC_SUBST(DVDREAD_VERSION_MINOR)
+AC_SUBST(DVDREAD_VERSION_MICRO)
+
dnl ---------------------------------------------
dnl Output configuration files
dnl ---------------------------------------------
@@ -112,4 +126,5 @@ AC_OUTPUT([
Makefile
doc/doxygen.cfg
misc/dvdread.pc
+src/dvdread/version.h
])
diff --git a/src/dvdread/dvd_reader.h b/src/dvdread/dvd_reader.h
index eabd302..9c7be9d 100644
--- a/src/dvdread/dvd_reader.h
+++ b/src/dvdread/dvd_reader.h
@@ -43,7 +43,7 @@
/**
* The current version.
*/
-#define DVDREAD_VERSION 50300
+#include "version.h"
/**
* The length of one Logical Block of a DVD.
diff --git a/src/dvdread/version.h.in b/src/dvdread/version.h.in
new file mode 100644
index 0000000..0ab1676
--- /dev/null
+++ b/src/dvdread/version.h.in
@@ -0,0 +1,37 @@
+/*
+ * This file is part of libdvdread
+ * Copyright (C) 2015 VideoLAN
+ *
+ * This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef DVDREAD_VERSION_H_
+#define DVDREAD_VERSION_H_
+
+#define DVDREAD_VERSION_CODE(major, minor, micro) \
+ (((major) * 10000) + \
+ ((minor) * 100) + \
+ ((micro) * 1))
+
+#define DVDREAD_VERSION_MAJOR @DVDREAD_VERSION_MAJOR@
+#define DVDREAD_VERSION_MINOR @DVDREAD_VERSION_MINOR@
+#define DVDREAD_VERSION_MICRO @DVDREAD_VERSION_MICRO@
+
+#define DVDREAD_VERSION_STRING "@DVDREAD_VERSION_MAJOR at .@DVDREAD_VERSION_MINOR at .@DVDREAD_VERSION_MICRO@"
+
+#define DVDREAD_VERSION \
+ DVDREAD_VERSION_CODE(DVDREAD_VERSION_MAJOR, DVDREAD_VERSION_MINOR, DVDREAD_VERSION_MICRO)
+
+#endif /* DVDREAD_VERSION_H_ */
--
2.1.4
More information about the libdvdnav-devel
mailing list