[gnome-terminal] Add terminal-version.h containing the usual defines and macros



commit 945ca6bd7ddfeb660e78115a844ab36623ea910b
Author: Christian Persch <chpe gnome org>
Date:   Sun May 24 00:29:01 2009 +0200

    Add terminal-version.h containing the usual defines and macros
    
    Part of bug #562718.

 configure.ac              |   10 ++++++++++
 src/Makefile.am           |    2 ++
 src/terminal-version.h.in |   35 +++++++++++++++++++++++++++++++++++
 3 files changed, 47 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 442a1b0..c09c103 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,6 +4,8 @@ m4_define([gt_version_micro],[0])
 m4_define([gt_version_extra],[-git])
 m4_define([gt_version],[gt_version_major().gt_version_minor().gt_version_micro()gt_version_extra])
 
+m4_define([gt_api_version],[0])
+
 AC_INIT([GNOME Terminal],[gt_version],[http://bugzilla.gnome.org/enter_bug.cgi?product=gnome-terminal],[gnome-terminal])
 AC_CONFIG_SRCDIR([src/terminal.c])
 AC_CONFIG_HEADERS([config.h])
@@ -110,10 +112,18 @@ GNOME_DOC_INIT
 
 # ****************************
 
+AC_SUBST([TERMINAL_MAJOR_VERSION],[gt_version_major])
+AC_SUBST([TERMINAL_MINOR_VERSION],[gt_version_minor])
+AC_SUBST([TERMINAL_MICRO_VERSION],[gt_version_micro])
+AC_SUBST([TERMINAL_API_VERSION],[gt_api_version])
+
+# ****************************
+
 AC_CONFIG_FILES([
 Makefile
 gnome-terminal.desktop.in
 src/Makefile
+src/terminal-version.h
 src/skey/Makefile
 help/Makefile
 help/bg/Makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index 83aac77..eb3b6de 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -41,11 +41,13 @@ gnome_terminal_SOURCES= \
 	terminal-type-builtins.h \
 	terminal-util.c \
 	terminal-util.h \
+	terminal-version.h \
 	terminal-window.c \
 	terminal-window.h \
 	$(NULL)
 
 gnome_terminal_CPPFLAGS = \
+	-DTERMINAL_COMPILATION \
 	-DEXECUTABLE_NAME=\"gnome-terminal\" \
 	-DTERM_DATADIR="\"$(datadir)\"" \
 	-DTERM_LOCALEDIR="\"$(datadir)/locale\"" \
diff --git a/src/terminal-version.h.in b/src/terminal-version.h.in
new file mode 100644
index 0000000..5bc4f2d
--- /dev/null
+++ b/src/terminal-version.h.in
@@ -0,0 +1,35 @@
+/*
+ * Copyright © 2009 Christian Persch
+ *
+ * This library 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 library 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
+ * 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, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02110-1301  USA
+ */
+
+#if !defined (__TERMINAL_TERMINAL_H_INSIDE__) && !defined (TERMINAL_COMPILATION)
+#error "Only <terminal/terminal.h> can be included directly."
+#endif
+
+#ifndef TERMINAL_VERSION_H
+#define TERMINAL_VERSION_H
+
+#define TERMINAL_MAJOR_VERSION (@TERMINAL_MAJOR_VERSION@)
+#define TERMINAL_MINOR_VERSION (@TERMINAL_MINOR_VERSION@)
+#define TERMINAL_MICRO_VERSION (@TERMINAL_MICRO_VERSION@)
+
+#define TERMINAL_CHECK_VERSION(major,minor,micro) \
+  (TERMINAL_MAJOR_VERSION > (major) || \
+   (TERMINAL_MAJOR_VERSION == (major) && TERMINAL_MINOR_VERSION > (minor)) || \
+   (TERMINAL_MAJOR_VERSION == (major) && TERMINAL_MINOR_VERSION == (minor) && TERMINAL_MICRO_VERSION >= (micro)))
+
+#endif /* !TERMINAL_VERSION_H */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]