[libdvdnav-devel] configure: generate version.h

Petri Hintukainen git at videolan.org
Wed Sep 9 09:50:06 CEST 2015


libdvdread | branch: master | Petri Hintukainen <phintuka at gmail.com> | Mon Sep  7 14:46:31 2015 +0300| [105aa319b085b3eb4f67de80cb41af27e0f2fe0f] | committer: Jean-Baptiste Kempf

configure: generate version.h

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/libdvdread.git/?a=commit;h=105aa319b085b3eb4f67de80cb41af27e0f2fe0f
---

 Makefile.am              |    5 +++--
 configure.ac             |   18 +++++++++++++++++-
 src/dvdread/dvd_reader.h |    2 +-
 src/dvdread/version.h.in |   37 +++++++++++++++++++++++++++++++++++++
 4 files changed, 58 insertions(+), 4 deletions(-)

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 f410691..08f6e53 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,11 @@
-AC_INIT(libdvdread, 5.0.4)
+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 +112,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 +127,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 26a6b00..9c7be9d 100644
--- a/src/dvdread/dvd_reader.h
+++ b/src/dvdread/dvd_reader.h
@@ -43,7 +43,7 @@
 /**
  * The current version.
  */
-#define DVDREAD_VERSION 50400
+#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_ */



More information about the libdvdnav-devel mailing list