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
This commit is contained in:
Gustavo Sverzut Barbieri 2012-12-08 15:26:27 +00:00
parent f74c3dae75
commit f8c480fc83
7 changed files with 47 additions and 6 deletions

View File

@ -45,7 +45,9 @@ AC_DEFINE_UNQUOTED([VMIN], [v_min], [Minor version])
AC_DEFINE_UNQUOTED([VMIC], [v_mic], [Micro version]) AC_DEFINE_UNQUOTED([VMIC], [v_mic], [Micro version])
AC_DEFINE_UNQUOTED([VREV], [v_rev], [Revison]) AC_DEFINE_UNQUOTED([VREV], [v_rev], [Revison])
VMAJ=v_maj VMAJ=v_maj
VMIN=v_min
AC_SUBST([VMAJ]) AC_SUBST([VMAJ])
AC_SUBST([VMIN])
#### Additional options to configure #### Additional options to configure
@ -2637,11 +2639,6 @@ if test "x${want_x11_xlib}" = "xyes" ; then
fi fi
## XCB ## 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 ### Checks for header files
@ -2760,6 +2757,7 @@ if test "x${want_x11_xlib}" = "xyes" ; then
fi fi
AC_DEFINE([HAVE_ECORE_X_XLIB], [1], [Defined to 1 if Xlib is enabled.]) AC_DEFINE([HAVE_ECORE_X_XLIB], [1], [Defined to 1 if Xlib is enabled.])
HAVE_ECORE_X_BACKEND="HAVE_ECORE_X_XLIB"
fi fi
## XCB ## 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}]) PKG_CHECK_MODULES([ECORE_X], [${requirements_pc_deps_ecore_x}])
EFL_CHECK_FUNCS([ECORE_X], [dlopen iconv]) EFL_CHECK_FUNCS([ECORE_X], [dlopen iconv])
HAVE_ECORE_X_BACKEND="HAVE_ECORE_X_XCB"
fi fi
requirements_libs_ecore_x="${requirements_libs_ecore_x} ${ECORE_X_LIBS}" 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_CFLAGS])
AC_SUBST([ECORE_X_LIBS]) AC_SUBST([ECORE_X_LIBS])

View File

@ -9,4 +9,4 @@ Requires.private: @requirements_pc_ecore_x@
Version: @VERSION@ Version: @VERSION@
Libs: -L${libdir} -lecore_x Libs: -L${libdir} -lecore_x
Libs.private: @requirements_libs_ecore_x@ Libs.private: @requirements_libs_ecore_x@
Cflags: -I${includedir}/ecore-@VMAJ@ @have_ecore_x_xcb_define@ Cflags: -I${includedir}/ecore-@VMAJ@

View File

@ -6,6 +6,7 @@ lib_LTLIBRARIES += lib/ecore_x/libecore_x.la
installed_ecorexmainheadersdir = $(includedir)/ecore-@VMAJ@ installed_ecorexmainheadersdir = $(includedir)/ecore-@VMAJ@
dist_installed_ecorexmainheaders_DATA = \ dist_installed_ecorexmainheaders_DATA = \
lib/ecore_x/Ecore_X.h \ 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_Atoms.h \
lib/ecore_x/Ecore_X_Cursor.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@ 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 if HAVE_ECORE_X_XCB
MAINTAINERCLEANFILES += \ MAINTAINERCLEANFILES += \
$(top_builddir)/src/lib/ecore_x/xcb/ecore_xcb_keysym_table.h \ $(top_builddir)/src/lib/ecore_x/xcb/ecore_xcb_keysym_table.h \

View File

@ -25,6 +25,8 @@
# endif // ifdef __GNUC__ # endif // ifdef __GNUC__
#endif // ifdef _MSC_VER #endif // ifdef _MSC_VER
#include "ecore_x_version.h"
#include <sys/types.h> #include <sys/types.h>
/** /**

View File

@ -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

View 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 xcb_generic_event_t *_ecore_xcb_event_buffered = NULL;
static Ecore_Idle_Enterer *_ecore_xcb_idle_enterer = 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 */ /* external variables */
int _ecore_xcb_log_dom = -1; int _ecore_xcb_log_dom = -1;
Ecore_X_Display *_ecore_xcb_display = NULL; Ecore_X_Display *_ecore_xcb_display = NULL;

View File

@ -45,6 +45,9 @@ void *alloca (size_t);
#include "Ecore_X_Atoms.h" #include "Ecore_X_Atoms.h"
#include "Ecore_Input.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, static Eina_Bool _ecore_x_fd_handler(void *data,
Ecore_Fd_Handler *fd_handler); Ecore_Fd_Handler *fd_handler);
static Eina_Bool _ecore_x_fd_handler_buf(void *data, static Eina_Bool _ecore_x_fd_handler_buf(void *data,