From f8c480fc831b53c06ca745bf6b6875e503bb3b59 Mon Sep 17 00:00:00 2001 From: Gustavo Sverzut Barbieri Date: Sat, 8 Dec 2012 15:26:27 +0000 Subject: [PATCH] efl/ecore_x: add version and backend to header file. 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 | 11 ++++++----- pc/ecore-x.pc.in | 2 +- src/Makefile_Ecore_X.am | 11 +++++++++++ src/lib/ecore_x/Ecore_X.h | 2 ++ src/lib/ecore_x/ecore_x_version.h.in | 21 +++++++++++++++++++++ src/lib/ecore_x/xcb/ecore_xcb.c | 3 +++ src/lib/ecore_x/xlib/ecore_x.c | 3 +++ 7 files changed, 47 insertions(+), 6 deletions(-) create mode 100644 src/lib/ecore_x/ecore_x_version.h.in diff --git a/configure.ac b/configure.ac index aa8cec21c6..bf1ef6120c 100644 --- a/configure.ac +++ b/configure.ac @@ -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]) diff --git a/pc/ecore-x.pc.in b/pc/ecore-x.pc.in index ec7fae7916..aa4abc5cd4 100644 --- a/pc/ecore-x.pc.in +++ b/pc/ecore-x.pc.in @@ -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@ diff --git a/src/Makefile_Ecore_X.am b/src/Makefile_Ecore_X.am index 4562e86062..eaff7f5606 100644 --- a/src/Makefile_Ecore_X.am +++ b/src/Makefile_Ecore_X.am @@ -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 \ diff --git a/src/lib/ecore_x/Ecore_X.h b/src/lib/ecore_x/Ecore_X.h index a072103cc6..4764c996f4 100644 --- a/src/lib/ecore_x/Ecore_X.h +++ b/src/lib/ecore_x/Ecore_X.h @@ -25,6 +25,8 @@ # endif // ifdef __GNUC__ #endif // ifdef _MSC_VER +#include "ecore_x_version.h" + #include /** 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 index 0000000000..24de5f86fd --- /dev/null +++ b/src/lib/ecore_x/ecore_x_version.h.in @@ -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 diff --git a/src/lib/ecore_x/xcb/ecore_xcb.c b/src/lib/ecore_x/xcb/ecore_xcb.c index 2f1e1a2601..62bd7d445d 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb.c +++ b/src/lib/ecore_x/xcb/ecore_xcb.c @@ -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; diff --git a/src/lib/ecore_x/xlib/ecore_x.c b/src/lib/ecore_x/xlib/ecore_x.c index d9b81bc0f8..051145de76 100644 --- a/src/lib/ecore_x/xlib/ecore_x.c +++ b/src/lib/ecore_x/xlib/ecore_x.c @@ -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,