forked from enlightenment/efl
* modify the way eina_config.h is built (see eina_config.h.in
and configure.ac) * include eina_config.h explicitely in files where the macros of eina_config.h are used * define eina_magic_string_init() and eina_magic_string_shutdown() even when the mugle option is set (magic disabled) * formatting and fix in configure.ac SVN revision: 40962
This commit is contained in:
parent
735a71ecfe
commit
5bd14d2a05
|
@ -54,83 +54,82 @@ EFL_CHECK_PTHREAD([have_pthread="yes"], [have_pthread="no"])
|
|||
|
||||
# Magic debug
|
||||
AC_ARG_ENABLE([magic-debug],
|
||||
[AC_HELP_STRING([--enable-magic-debug], [enable magic debug of eina structure])],
|
||||
[AC_HELP_STRING([--disable-magic-debug], [disable magic debug of eina structure [default=enabled]])],
|
||||
[
|
||||
if test "x${enableval}" = "xyes" ; then
|
||||
enable_magic_debug="yes"
|
||||
have_magic_debug="yes"
|
||||
else
|
||||
enable_magic_debug="no"
|
||||
have_magic_debug="no"
|
||||
fi
|
||||
],
|
||||
[enable_magic_debug="yes"]
|
||||
)
|
||||
AC_MSG_CHECKING([whether magic debug is enable])
|
||||
AC_MSG_RESULT([${enable_magic_debug}])
|
||||
[have_magic_debug="yes"])
|
||||
|
||||
EINA_MAGIC_DEBUG=0
|
||||
if test "x${enable_magic_debug}" = "xyes" ; then
|
||||
EINA_MAGIC_DEBUG=1
|
||||
AC_MSG_CHECKING([whether magic debug is enable])
|
||||
AC_MSG_RESULT([${have_magic_debug}])
|
||||
|
||||
if test "x${have_magic_debug}" = "xyes" ; then
|
||||
EINA_CONFIGURE_MAGIC_DEBUG="#define EINA_MAGIC_DEBUG"
|
||||
fi
|
||||
AC_SUBST(EINA_MAGIC_DEBUG)
|
||||
AC_SUBST(EINA_CONFIGURE_MAGIC_DEBUG)
|
||||
|
||||
# Safety checks (avoid crashes on wrong api usage)
|
||||
want_safety_checks="yes"
|
||||
AC_MSG_CHECKING(whether to do safety checking on api parameters)
|
||||
AC_ARG_ENABLE(safety-checks,
|
||||
AC_HELP_STRING(
|
||||
[--disable-safety-checks],
|
||||
[disable safety checks for NULL pointers and like. [[default=enabled]]]
|
||||
),
|
||||
[ want_safety_checks="$enableval" ]
|
||||
)
|
||||
AC_MSG_RESULT($want_safety_checks)
|
||||
[AC_HELP_STRING([--disable-safety-checks], [disable safety checks for NULL pointers and like. [default=enabled]])],
|
||||
[
|
||||
if test "x${enableval}" = "xyes" ; then
|
||||
have_safety_checks="yes"
|
||||
else
|
||||
have_safety_checks="no"
|
||||
fi
|
||||
],
|
||||
[have_safety_checks="yes"])
|
||||
|
||||
AM_CONDITIONAL(SAFETY_CHECKS, test "x$want_safety_checks" = "xyes")
|
||||
if test "x$want_safety_checks" = "xyes"; then
|
||||
AC_MSG_CHECKING(whether to do safety checking on api parameters)
|
||||
AC_MSG_RESULT($have_safety_checks)
|
||||
|
||||
AM_CONDITIONAL(SAFETY_CHECKS, test "x$have_safety_checks" = "xyes")
|
||||
if test "x$have_safety_checks" = "xyes"; then
|
||||
AC_DEFINE(EINA_SAFETY_CHECKS, 1, [disable safety checks for NULL pointers and like.])
|
||||
EINA_SAFETY_CHECKS=1
|
||||
else
|
||||
EINA_SAFETY_CHECKS=0
|
||||
EINA_CONFIGURE_SAFETY_CHECKS="#define EINA_SAFETY_CHECKS"
|
||||
fi
|
||||
AC_SUBST(EINA_SAFETY_CHECKS)
|
||||
AC_SUBST(EINA_CONFIGURE_SAFETY_CHECKS)
|
||||
|
||||
# Choose best memory pool
|
||||
AC_ARG_ENABLE([default-mempool],
|
||||
[AC_HELP_STRING([--enable-default-mempool], [Default memory allocator could be faster for some computer])],
|
||||
[AC_HELP_STRING([--enable-default-mempool], [Default memory allocator could be faster for some computer. [default=disabled]])],
|
||||
[
|
||||
if test "x${enableval}" = "xyes"; then
|
||||
enable_default_mempool="yes"
|
||||
have_default_mempool="yes"
|
||||
else
|
||||
enable_default_mempool="no"
|
||||
have_default_mempool="no"
|
||||
fi
|
||||
],
|
||||
[enable_default_mempool="no"]
|
||||
[have_default_mempool="no"]
|
||||
)
|
||||
AC_MSG_CHECKING([whether to use default mempool allocator])
|
||||
AC_MSG_RESULT([${enable_default_mempool}])
|
||||
AC_MSG_RESULT([${have_default_mempool}])
|
||||
|
||||
EINA_DEFAULT_MEMPOOL=0
|
||||
if test "x${enable_default_mempool}" = "xyes" ; then
|
||||
EINA_DEFAULT_MEMPOOL=1
|
||||
if test "x${have_default_mempool}" = "xyes" ; then
|
||||
EINA_CONFIGURE_DEFAULT_MEMPOOL="#define EINA_DEFAULT_MEMPOOL"
|
||||
fi
|
||||
AC_SUBST(EINA_DEFAULT_MEMPOOL)
|
||||
AC_SUBST(EINA_CONFIGURE_DEFAULT_MEMPOOL)
|
||||
|
||||
# Report stringshare usage
|
||||
AC_ARG_ENABLE([stringshare-usage],
|
||||
[AC_HELP_STRING([--enable-stringshare-usage], [Report stringshare usage on stringshare shutdown])],
|
||||
[AC_HELP_STRING([--enable-stringshare-usage], [Report stringshare usage on stringshare shutdown. [default=disabled]])],
|
||||
[
|
||||
if test "x${enableval}" = "xyes"; then
|
||||
enable_stringshare_usage="yes"
|
||||
have_stringshare_usage="yes"
|
||||
else
|
||||
enable_stringshare_usage="no"
|
||||
have_stringshare_usage="no"
|
||||
fi
|
||||
],
|
||||
[enable_stringshare_usage="no"]
|
||||
[have_stringshare_usage="no"]
|
||||
)
|
||||
AC_MSG_CHECKING([whether to report stringshare usage])
|
||||
AC_MSG_RESULT([${enable_stringshare_usage}])
|
||||
AC_MSG_RESULT([${have_stringshare_usage}])
|
||||
|
||||
if test "x${enable_stringshare_usage}" = "xyes"; then
|
||||
if test "x${have_stringshare_usage}" = "xyes"; then
|
||||
AC_DEFINE(EINA_STRINGSHARE_USAGE, 1, [Report Eina stringshare usage pattern])
|
||||
fi
|
||||
|
||||
|
@ -158,16 +157,13 @@ EINA_CHECK_STATIC([ememoa-unknown], [ememoa unknown])
|
|||
EINA_CHECK_STATIC([pass-through], [pass through])
|
||||
EINA_CHECK_STATIC([fixed-bitmap], [fixed bitmap])
|
||||
|
||||
# Unit tests, coverage and benchmarking
|
||||
|
||||
EFL_CHECK_TESTS([enable_tests="yes"], [enable_tests="no"])
|
||||
EFL_CHECK_COVERAGE([${enable_tests}], [enable_coverage="yes"], [enable_coverage="no"])
|
||||
EFL_CHECK_BENCHMARK([enable_benchmark="yes"], [enable_benchmark="no"])
|
||||
|
||||
|
||||
### Checks for programs
|
||||
AC_PROG_CC
|
||||
|
||||
# pkg-config
|
||||
PKG_PROG_PKG_CONFIG
|
||||
|
||||
# doxygen program for documentation building
|
||||
|
||||
EFL_CHECK_DOXYGEN([build_doc="yes"], [build_doc="no"])
|
||||
|
@ -175,8 +171,6 @@ EFL_CHECK_DOXYGEN([build_doc="yes"], [build_doc="no"])
|
|||
|
||||
### Checks for libraries
|
||||
|
||||
PKG_PROG_PKG_CONFIG
|
||||
|
||||
# Evil library for compilation on Windows CE
|
||||
|
||||
case "$host_os" in
|
||||
|
@ -382,6 +376,12 @@ AC_SUBST(dlopen_libs)
|
|||
|
||||
### Make the debug preprocessor configurable
|
||||
|
||||
### Unit tests, coverage and benchmarking
|
||||
|
||||
EFL_CHECK_TESTS([enable_tests="yes"], [enable_tests="no"])
|
||||
EFL_CHECK_COVERAGE([${enable_tests}], [enable_coverage="yes"], [enable_coverage="no"])
|
||||
EFL_CHECK_BENCHMARK([enable_benchmark="yes"], [enable_benchmark="no"])
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
eina-0.pc
|
||||
|
@ -416,6 +416,12 @@ echo
|
|||
echo
|
||||
echo "Configuration Options Summary:"
|
||||
echo
|
||||
echo " Magic debug..........: ${have_magic_debug}"
|
||||
echo " Safety checks........: ${have_safety_checks}"
|
||||
echo " Report string usage..: ${have_stringshare_usage}"
|
||||
echo " Default mempool......: ${have_default_mempool}"
|
||||
echo " Thread Support.......: ${have_pthread}"
|
||||
echo
|
||||
echo " Documentation........: ${build_doc}"
|
||||
echo " Tests................: ${enable_tests}"
|
||||
echo " Coverage.............: ${enable_coverage}"
|
||||
|
@ -434,14 +440,6 @@ echo " SSE..................: ${have_sse}"
|
|||
echo " SSE2.................: ${have_sse2}"
|
||||
echo " ALTIVEC..............: ${have_altivec}"
|
||||
echo
|
||||
echo " Thread Support.......: ${have_pthread}"
|
||||
echo
|
||||
echo " Magic debug..........: ${enable_magic_debug}"
|
||||
echo
|
||||
echo " Report string usage..: ${enable_stringshare_usage}"
|
||||
echo
|
||||
echo " Default mempool......: ${enable_default_mempool}"
|
||||
echo
|
||||
echo " Memory pool:"
|
||||
echo " Ememoa.............: ${enable_ememoa}"
|
||||
echo
|
||||
|
|
|
@ -19,19 +19,19 @@
|
|||
#ifndef EINA_CONFIG_H_
|
||||
#define EINA_CONFIG_H_
|
||||
|
||||
#undef EINA_MAGIC_DEBUG
|
||||
#if @EINA_MAGIC_DEBUG@
|
||||
#define EINA_MAGIC_DEBUG
|
||||
#ifdef EINA_MAGIC_DEBUG
|
||||
# undef EINA_MAGIC_DEBUG
|
||||
#endif
|
||||
@EINA_CONFIGURE_MAGIC_DEBUG@
|
||||
|
||||
#undef EINA_DEFAULT_MEMPOOL
|
||||
#if @EINA_DEFAULT_MEMPOOL@
|
||||
#define EINA_DEFAULT_MEMPOOL
|
||||
#ifdef EINA_DEFAULT_MEMPOOL
|
||||
# undef EINA_DEFAULT_MEMPOOL
|
||||
#endif
|
||||
@EINA_CONFIGURE_DEFAULT_MEMPOOL@
|
||||
|
||||
#undef EINA_SAFETY_CHECKS
|
||||
#if @EINA_SAFETY_CHECKS@
|
||||
#define EINA_SAFETY_CHECKS
|
||||
#ifdef EINA_SAFETY_CHECKS
|
||||
# undef EINA_SAFETY_CHECKS
|
||||
#endif
|
||||
@EINA_CONFIGURE_SAFETY_CHECKS@
|
||||
|
||||
#endif /* EINA_CONFIG_H_ */
|
||||
|
|
|
@ -19,10 +19,17 @@
|
|||
#ifndef EINA_MAGIC_H_
|
||||
#define EINA_MAGIC_H_
|
||||
|
||||
#ifdef EINA_MAGIC_DEBUG
|
||||
|
||||
#include "eina_config.h"
|
||||
#include "eina_types.h"
|
||||
|
||||
|
||||
EAPI int eina_magic_string_init(void);
|
||||
EAPI int eina_magic_string_shutdown(void);
|
||||
|
||||
|
||||
#ifdef EINA_MAGIC_DEBUG
|
||||
|
||||
#define EINA_MAGIC_NONE 0x1234fedc
|
||||
|
||||
#define EINA_MAGIC Eina_Magic __magic;
|
||||
|
@ -33,9 +40,6 @@
|
|||
|
||||
typedef unsigned int Eina_Magic;
|
||||
|
||||
EAPI int eina_magic_string_init(void);
|
||||
EAPI int eina_magic_string_shutdown(void);
|
||||
|
||||
EAPI const char* eina_magic_string_get(Eina_Magic magic) EINA_PURE EINA_WARN_UNUSED_RESULT;
|
||||
EAPI void eina_magic_string_set(Eina_Magic magic, const char *magic_name) EINA_ARG_NONNULL(2);
|
||||
EAPI void eina_magic_fail(void *d, Eina_Magic m, Eina_Magic req_m,
|
||||
|
@ -52,8 +56,6 @@ EAPI void eina_magic_fail(void *d, Eina_Magic m, Eina_Magic req_m,
|
|||
#define eina_magic_string_get(Magic) (NULL)
|
||||
#define eina_magic_string_set(Magic, Magic_Name) ((void) 0)
|
||||
#define eina_magic_fail(d, m, req_m, file, fnx, line) ((void) 0)
|
||||
#define eina_magic_string_init() do {} while(0)
|
||||
#define eina_magic_string_shutdown() do {} while(0)
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -18,6 +18,10 @@
|
|||
|
||||
#ifndef EINA_SAFETY_CHECKS_H_
|
||||
#define EINA_SAFETY_CHECKS_H_
|
||||
|
||||
|
||||
#include "eina_config.h"
|
||||
|
||||
#ifdef EINA_SAFETY_CHECKS
|
||||
|
||||
#include "eina_error.h"
|
||||
|
|
|
@ -19,6 +19,12 @@
|
|||
#ifndef EINA_TYPES_H_
|
||||
#define EINA_TYPES_H_
|
||||
|
||||
/**
|
||||
* @defgroup Eina_Types_Group Types
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifdef EAPI
|
||||
# undef EAPI
|
||||
#endif
|
||||
|
@ -45,6 +51,8 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#include "eina_config.h"
|
||||
|
||||
#ifdef EINA_WARN_UNUSED_RESULT
|
||||
# undef EINA_WARN_UNUSED_RESULT
|
||||
#endif
|
||||
|
@ -173,7 +181,17 @@
|
|||
#endif
|
||||
|
||||
typedef unsigned char Eina_Bool;
|
||||
|
||||
/**
|
||||
* @def EINA_FALSE
|
||||
* boolean value FALSE (numerical value 0)
|
||||
*/
|
||||
#define EINA_FALSE ((Eina_Bool)0)
|
||||
|
||||
/**
|
||||
* @def EINA_TRUE
|
||||
* boolean value TRUE (numerical value 1)
|
||||
*/
|
||||
#define EINA_TRUE ((Eina_Bool)1)
|
||||
|
||||
EAPI extern const unsigned int eina_prime_table[];
|
||||
|
@ -192,4 +210,8 @@ typedef Eina_Bool (*Eina_Each)(const void *container,
|
|||
typedef void (*Eina_Free_Cb)(void *data);
|
||||
#define EINA_FREE_CB(Function) ((Eina_Free_Cb)Function)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* EINA_TYPES_H_ */
|
||||
|
|
|
@ -72,6 +72,7 @@
|
|||
# include <Evil.h>
|
||||
#endif
|
||||
|
||||
#include "eina_config.h"
|
||||
#include "eina_error.h"
|
||||
#include "eina_list.h"
|
||||
#include "eina_mempool.h"
|
||||
|
|
|
@ -27,10 +27,8 @@
|
|||
# include <Evil.h>
|
||||
#endif
|
||||
|
||||
#define EINA_MAGIC_DEBUG
|
||||
#include "eina_magic.h"
|
||||
|
||||
#include "eina_config.h"
|
||||
#include "eina_magic.h"
|
||||
#include "eina_private.h"
|
||||
#include "eina_error.h"
|
||||
#include "eina_inlist.h"
|
||||
|
@ -39,6 +37,8 @@
|
|||
* Local *
|
||||
*============================================================================*/
|
||||
|
||||
#ifdef EINA_MAGIC_DEBUG
|
||||
|
||||
typedef struct _Eina_Magic_String Eina_Magic_String;
|
||||
struct _Eina_Magic_String
|
||||
{
|
||||
|
@ -51,6 +51,8 @@ struct _Eina_Magic_String
|
|||
static int _eina_magic_string_count = 0;
|
||||
static Eina_Inlist *strings = NULL;
|
||||
|
||||
#endif
|
||||
|
||||
/*============================================================================*
|
||||
* Global *
|
||||
*============================================================================*/
|
||||
|
@ -62,14 +64,19 @@ static Eina_Inlist *strings = NULL;
|
|||
EAPI int
|
||||
eina_magic_string_init(void)
|
||||
{
|
||||
#ifdef EINA_MAGIC_DEBUG
|
||||
++_eina_magic_string_count;
|
||||
|
||||
return _eina_magic_string_count;
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
EAPI int
|
||||
eina_magic_string_shutdown(void)
|
||||
{
|
||||
#ifdef EINA_MAGIC_DEBUG
|
||||
--_eina_magic_string_count;
|
||||
|
||||
if (_eina_magic_string_count == 0)
|
||||
|
@ -88,8 +95,13 @@ eina_magic_string_shutdown(void)
|
|||
}
|
||||
|
||||
return _eina_magic_string_count;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef EINA_MAGIC_DEBUG
|
||||
|
||||
EAPI const char*
|
||||
eina_magic_string_get(Eina_Magic magic)
|
||||
{
|
||||
|
@ -172,3 +184,4 @@ eina_magic_fail(void *d, Eina_Magic m, Eina_Magic req_m, const char *file, const
|
|||
if (getenv("EINA_ERROR_ABORT")) abort();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "eina_config.h"
|
||||
#include "eina_rectangle.h"
|
||||
#include "eina_magic.h"
|
||||
#include "eina_inlist.h"
|
||||
|
|
Loading…
Reference in New Issue