efl/ecore_x: add version and backend to header file.
authorGustavo Sverzut Barbieri <barbieri@gmail.com>
Sat, 8 Dec 2012 15:26:27 +0000 (15:26 +0000)
committerGustavo Sverzut Barbieri <barbieri@gmail.com>
Sat, 8 Dec 2012 15:26:27 +0000 (15:26 +0000)
instead of -DHAVE_ECORE_X_XCB in the pc, which is a super-hack, add a
proper compile-time generated ecore_x_version.h that is included by
Ecore_X.h

This file contains HAVE_ECORE_X_XLIB or HAVE_ECORE_X_XCB defined and
will also define ECORE_X_VERSION_MAJOR and ECORE_X_VERSION_MINOR as
per other EFL (Ecore), also defining the runtime version in
Ecore_X_Version.

SVN revision: 80524

configure.ac
pc/ecore-x.pc.in
src/Makefile_Ecore_X.am
src/lib/ecore_x/Ecore_X.h
src/lib/ecore_x/ecore_x_version.h.in [new file with mode: 0644]
src/lib/ecore_x/xcb/ecore_xcb.c
src/lib/ecore_x/xlib/ecore_x.c

index aa8cec21c6b6ce91f6ee9fde6b22c5b873521513..bf1ef6120c68e61e50cb85108113ead33a6d43b5 100644 (file)
@@ -45,7 +45,9 @@ AC_DEFINE_UNQUOTED([VMIN], [v_min], [Minor version])
 AC_DEFINE_UNQUOTED([VMIC], [v_mic], [Micro version])
 AC_DEFINE_UNQUOTED([VREV], [v_rev], [Revison])
 VMAJ=v_maj
+VMIN=v_min
 AC_SUBST([VMAJ])
+AC_SUBST([VMIN])
 
 
 #### Additional options to configure
@@ -2637,11 +2639,6 @@ if test "x${want_x11_xlib}" = "xyes" ; then
 fi
 
 ## XCB
-have_ecore_x_xcb_define=""
-if test "${with_x11}" = "xcb" ; then
-   have_ecore_x_xcb_define="-DHAVE_ECORE_X_XCB"
-fi
-AC_SUBST(have_ecore_x_xcb_define)
 
 ### Checks for header files
 
@@ -2760,6 +2757,7 @@ if test "x${want_x11_xlib}" = "xyes" ; then
    fi
 
    AC_DEFINE([HAVE_ECORE_X_XLIB], [1], [Defined to 1 if Xlib is enabled.])
+   HAVE_ECORE_X_BACKEND="HAVE_ECORE_X_XLIB"
 fi
 
 ## XCB
@@ -2799,10 +2797,13 @@ dnl AC_DEFINE([ECORE_XCB_DRI], [1], [Build support for XCB dri])
 
    PKG_CHECK_MODULES([ECORE_X], [${requirements_pc_deps_ecore_x}])
    EFL_CHECK_FUNCS([ECORE_X], [dlopen iconv])
+
+   HAVE_ECORE_X_BACKEND="HAVE_ECORE_X_XCB"
 fi
 
 requirements_libs_ecore_x="${requirements_libs_ecore_x} ${ECORE_X_LIBS}"
 
+AC_SUBST([HAVE_ECORE_X_BACKEND])
 AC_SUBST([ECORE_X_CFLAGS])
 AC_SUBST([ECORE_X_LIBS])
 
index ec7fae791602c43195c8a4d7aec8515ef850b112..aa4abc5cd46d81c1c8ba48a2bbabfb099c89c5b9 100644 (file)
@@ -9,4 +9,4 @@ Requires.private: @requirements_pc_ecore_x@
 Version: @VERSION@
 Libs: -L${libdir} -lecore_x
 Libs.private: @requirements_libs_ecore_x@
-Cflags: -I${includedir}/ecore-@VMAJ@ @have_ecore_x_xcb_define@
+Cflags: -I${includedir}/ecore-@VMAJ@
index 4562e86062b9387ef1e5c11a51c25cb7a9d3d70b..eaff7f5606876b736600e36b3527883a89518418 100644 (file)
@@ -6,6 +6,7 @@ lib_LTLIBRARIES += lib/ecore_x/libecore_x.la
 installed_ecorexmainheadersdir = $(includedir)/ecore-@VMAJ@
 dist_installed_ecorexmainheaders_DATA = \
 lib/ecore_x/Ecore_X.h \
+lib/ecore_x/ecore_x_version.h \
 lib/ecore_x/Ecore_X_Atoms.h \
 lib/ecore_x/Ecore_X_Cursor.h
 
@@ -119,6 +120,16 @@ lib/eina/libeina.la \
 
 lib_ecore_x_libecore_x_la_LDFLAGS = -no-undefined -version-info @version_info@ @release_info@
 
+MAINTAINERCLEANFILES += \
+$(top_builddir)/src/lib/ecore_x/ecore_x_version.h
+
+BUILT_SOURCES += \
+$(top_builddir)/src/lib/ecore_x/ecore_x_version.h
+
+$(top_builddir)/src/lib/ecore_x/ecore_x_version.h: $(top_srcdir)/src/lib/ecore_x/ecore_x_version.h.in $(top_builddir)/Makefile
+       $(SED) -e 's/[@]VMAJ[@]/$(VMAJ)/g;s/[@]VMIN[@]/$(VMIN)/g;s/[@]HAVE_ECORE_X_BACKEND[@]/$(HAVE_ECORE_X_BACKEND)/g' $< > $@
+
+
 if HAVE_ECORE_X_XCB
 MAINTAINERCLEANFILES += \
 $(top_builddir)/src/lib/ecore_x/xcb/ecore_xcb_keysym_table.h \
index a072103cc6275c74f97d4e2883de69bdc6406c7e..4764c996f4410b03757e2222efafb5b1e4a04b7e 100644 (file)
@@ -25,6 +25,8 @@
 # endif // ifdef __GNUC__
 #endif // ifdef _MSC_VER
 
+#include "ecore_x_version.h"
+
 #include <sys/types.h>
 
 /**
diff --git a/src/lib/ecore_x/ecore_x_version.h.in b/src/lib/ecore_x/ecore_x_version.h.in
new file mode 100644 (file)
index 0000000..24de5f8
--- /dev/null
@@ -0,0 +1,21 @@
+#ifndef _ECORE_X_VERSION_H_
+#define _ECORE_X_VERSION_H_ 1
+
+#define ECORE_X_VERSION_MAJOR @VMAJ@
+#define ECORE_X_VERSION_MINOR @VMIN@
+
+typedef struct _Ecore_X_Version
+{
+   int major;
+   int minor;
+   int micro;
+   int revision;
+} Ecore_X_Version;
+
+EAPI extern Ecore_X_Version *ecore_x_version;
+
+#ifndef @HAVE_ECORE_X_BACKEND@
+#define @HAVE_ECORE_X_BACKEND@ 1
+#endif
+
+#endif
index 2f1e1a2601acf7a25d49a63351cfe2bfa75dbfb3..62bd7d445d32b43252e23f26db21cc260e21e821 100644 (file)
@@ -15,6 +15,9 @@ static Ecore_Fd_Handler *_ecore_xcb_fd_handler = NULL;
 static xcb_generic_event_t *_ecore_xcb_event_buffered = NULL;
 static Ecore_Idle_Enterer *_ecore_xcb_idle_enterer = NULL;
 
+static Ecore_X_Version _version = { VMAJ, VMIN, VMIC, VREV };
+EAPI Ecore_X_Version *elm_version = &_version;
+
 /* external variables */
 int _ecore_xcb_log_dom = -1;
 Ecore_X_Display *_ecore_xcb_display = NULL;
index d9b81bc0f80d64526f8a927b7a7e2f4d641a33c1..051145de7637dbb3e43597eb1ad9a32eba8622cb 100644 (file)
@@ -45,6 +45,9 @@ void *alloca (size_t);
 #include "Ecore_X_Atoms.h"
 #include "Ecore_Input.h"
 
+static Ecore_X_Version _version = { VMAJ, VMIN, VMIC, VREV };
+EAPI Ecore_X_Version *elm_version = &_version;
+
 static Eina_Bool _ecore_x_fd_handler(void *data,
                                      Ecore_Fd_Handler *fd_handler);
 static Eina_Bool _ecore_x_fd_handler_buf(void *data,