[libdvdcss-devel] generate version.h

Petri Hintukainen git at videolan.org
Wed Dec 16 12:23:44 CET 2015


libdvdcss | branch: master | Petri Hintukainen <phintuka at gmail.com> | Wed Dec 16 11:21:42 2015 +0200| [a7e814e3bfc6b7b8507c0e1083153611edb66748] | committer: Petri Hintukainen

generate version.h

> http://git.videolan.org/gitweb.cgi/libdvdcss.git/?a=commit;h=a7e814e3bfc6b7b8507c0e1083153611edb66748
---

 Makefile.am             |    5 ++++-
 configure.ac            |   17 ++++++++++++++++-
 src/dvdcss/dvdcss.h     |    2 ++
 src/dvdcss/version.h.in |   37 +++++++++++++++++++++++++++++++++++++
 4 files changed, 59 insertions(+), 2 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index fff0579..13abfcc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,5 @@
 ACLOCAL_AMFLAGS = -I m4
+AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_builddir)/src/dvdcss
 
 EXTRA_DIST = msvc libdvdcss.spec INSTALL
 
@@ -46,7 +47,9 @@ test_dvd_region_LDADD = libdvdcss.la
 test_dvd_region_CFLAGS = -I $(top_srcdir)/src
 
 pkgincludedir = $(includedir)/dvdcss
-pkginclude_HEADERS = src/dvdcss/dvdcss.h
+pkginclude_HEADERS = \
+	src/dvdcss/dvdcss.h \
+	src/dvdcss/version.h
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = src/libdvdcss.pc
diff --git a/configure.ac b/configure.ac
index 20ba9c6..0c1430e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,10 @@
-AC_INIT(libdvdcss, 1.3.99, , , https://www.videolan.org/developers/libdvdcss.html)
+dnl library version number
+m4_define([dvdcss_major], 1)
+m4_define([dvdcss_minor], 3)
+m4_define([dvdcss_micro], 99)
+m4_define([dvdcss_version],[dvdcss_major.dvdcss_minor.dvdcss_micro])
+
+AC_INIT(libdvdcss, dvdcss_version, , , https://www.videolan.org/developers/libdvdcss.html)
 AC_CONFIG_SRCDIR([src/libdvdcss.c])
 
 AC_PREREQ(2.50)
@@ -231,10 +237,19 @@ AM_CONDITIONAL([APIDOC], [test "x$DOXYGEN" != "x"])
 AC_PATH_PROG([GIT], [git])
 AM_CONDITIONAL([GIT], [test "x$GIT" != "x"])
 
+dnl export library version number
+DVDCSS_VERSION_MAJOR=dvdcss_major()
+DVDCSS_VERSION_MINOR=dvdcss_minor()
+DVDCSS_VERSION_MICRO=dvdcss_micro()
+AC_SUBST(DVDCSS_VERSION_MAJOR)
+AC_SUBST(DVDCSS_VERSION_MINOR)
+AC_SUBST(DVDCSS_VERSION_MICRO)
+
 AC_SUBST(DVDCSS_LDFLAGS)
 AC_OUTPUT([
   Makefile
   libdvdcss.spec
   doc/doxygen.cfg
   src/libdvdcss.pc
+  src/dvdcss/version.h
 ])
diff --git a/src/dvdcss/dvdcss.h b/src/dvdcss/dvdcss.h
index a630107..c2ae786 100644
--- a/src/dvdcss/dvdcss.h
+++ b/src/dvdcss/dvdcss.h
@@ -33,6 +33,8 @@
 
 #include <stdint.h>
 
+#include "version.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
diff --git a/src/dvdcss/version.h.in b/src/dvdcss/version.h.in
new file mode 100644
index 0000000..3210e22
--- /dev/null
+++ b/src/dvdcss/version.h.in
@@ -0,0 +1,37 @@
+/*
+ * This file is part of libdvdcss
+ * 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 DVDCSS_VERSION_H_
+#define DVDCSS_VERSION_H_
+
+#define DVDCSS_VERSION_CODE(major, minor, micro) \
+    (((major) * 10000) +                         \
+     ((minor) *   100) +                         \
+     ((micro) *     1))
+
+#define DVDCSS_VERSION_MAJOR @DVDCSS_VERSION_MAJOR@
+#define DVDCSS_VERSION_MINOR @DVDCSS_VERSION_MINOR@
+#define DVDCSS_VERSION_MICRO @DVDCSS_VERSION_MICRO@
+
+#define DVDCSS_VERSION_STRING "@DVDCSS_VERSION_MAJOR at .@DVDCSS_VERSION_MINOR at .@DVDCSS_VERSION_MICRO@"
+
+#define DVDCSS_VERSION \
+    DVDCSS_VERSION_CODE(DVDCSS_VERSION_MAJOR, DVDCSS_VERSION_MINOR, DVDCSS_VERSION_MICRO)
+
+#endif /* DVDCSS_VERSION_H_ */



More information about the libdvdcss-devel mailing list