Permalink
Browse files

Support static modules aka modules which are embedded inside libts

This can be usefull for statically linked application or platforms
where dlopen(3) is not available.

A module will be compiled statically if it was requested during
./configure with --enable-$FOO=static.

Static modules will have precedence over shared ones which means
if a module is configured to be embedded inside libts it's
corresponding shared library isn't build and ignored even if
it is in $TSLIB_PLUGINDIR.

Signed-off-by: Marc Andre Tanner <mat@brain-dump.org>
Signed-off-by: Chris Larson <clarson@mvista.com>
  • Loading branch information...
kergoth committed Jan 25, 2010
1 parent 242450b commit 7342fc7d4413a7144f997ecc617f6ad233868d86
View
@@ -50,125 +50,21 @@ AC_FUNC_VPRINTF
AC_CHECK_FUNCS([gettimeofday memmove memset munmap select strcasecmp strchr strdup strtoul])
# filters
-AC_MSG_CHECKING([whether linear modules is requested])
-AC_ARG_ENABLE(linear,
- AS_HELP_STRING([--enable-linear],
- [Enable building of linear scaling (default=yes)]),
- [linear_module=$enableval],
- [linear_module=yes])
-AC_MSG_RESULT($linear_module)
-AM_CONDITIONAL(ENABLE_LINEAR_MODULE, test "$linear_module" = "yes")
-
-AC_MSG_CHECKING([whether dejitter module is requested])
-AC_ARG_ENABLE(dejitter,
- AS_HELP_STRING([--enable-dejitter],
- [Enable building of dejitter filter (default=yes)]),
- [dejitter_module=$enableval],
- [dejitter_module=yes])
-AC_MSG_RESULT($dejitter_module)
-AM_CONDITIONAL(ENABLE_DEJITTER_MODULE, test "$dejitter_module" = "yes")
-
-AC_MSG_CHECKING([whether linear-h2200 module is requested])
-AC_ARG_ENABLE(linear-h2200,
- AS_HELP_STRING([--enable-linear-h2200],
- [Enable building of linearizing filter for iPAQ h2200 (default=yes)]),
- [h2200_linear_module=$enableval],
- [h2200_linear_module=yes])
-AC_MSG_RESULT($h2200_linear_module)
-AM_CONDITIONAL(ENABLE_H2200_LINEAR_MODULE, test "$h2200_linear_module" = "yes")
-
-AC_MSG_CHECKING([whether variance module is requested])
-AC_ARG_ENABLE(variance,
- AS_HELP_STRING([--enable-variance],
- [Enable building of variance filter (default=yes)]),
- [variance_module=$enableval],
- [variance_module=yes])
-AC_MSG_RESULT($variance_module)
-AM_CONDITIONAL(ENABLE_VARIANCE_MODULE, test "$variance_module" = "yes")
-
-AC_MSG_CHECKING([whether pthres module is requested])
-AC_ARG_ENABLE(pthres,
- AS_HELP_STRING([--enable-pthres],
- [Enable building of pthres filter (default=yes)]),
- [pthres_module=$enableval],
- [pthres_module=yes])
-AC_MSG_RESULT($pthres_module)
-AM_CONDITIONAL(ENABLE_PTHRES_MODULE, test "$pthres_module" = "yes")
-
+TSLIB_CHECK_MODULE([linear], [yes], [Enable building of linear scaling])
+TSLIB_CHECK_MODULE([dejitter], [yes], [Enable building of dejitter filter])
+TSLIB_CHECK_MODULE([linear-h2200], [yes], [Enable building of linearizing filter for iPAQ h2200])
+TSLIB_CHECK_MODULE([variance], [yes], [Enable building of variance filter])
+TSLIB_CHECK_MODULE([pthres], [yes], [Enable building of pthres filter])
# hardware access modules
-AC_MSG_CHECKING([whether ucb1x00 module is requested])
-AC_ARG_ENABLE(ucb1x00,
- AS_HELP_STRING([--enable-ucb1x00],
- [Enable building of ucb1x00 raw module (UCB1x00 support) (default=yes)]),
- [ucb1x00_module=$enableval],
- [ucb1x00_module=yes])
-AC_MSG_RESULT($ucb1x00_module)
-AM_CONDITIONAL(ENABLE_UCB1X00_MODULE, test "$ucb1x00_module" = "yes")
-
-AC_MSG_CHECKING([whether corgi module is requested])
-AC_ARG_ENABLE(corgi,
- AS_HELP_STRING([--enable-corgi],
- [Enable building of corgi raw module (Sharp Zaurus sl-c7x0 support) (default=yes)]),
- [corgi_module=$enableval],
- [corgi_module=yes])
-AC_MSG_RESULT($corgi_module)
-AM_CONDITIONAL(ENABLE_CORGI_MODULE, test "$corgi_module" = "yes")
-
-AC_MSG_CHECKING([whether collie module is requested])
-AC_ARG_ENABLE(collie,
- AS_HELP_STRING([--enable-collie],
- [Enable building of collie raw module (Sharp Zaurus sl-5500/5000d support) (default=yes)]),
- [collie_module=$enableval],
- [collie_module=yes])
-AC_MSG_RESULT($collie_module)
-AM_CONDITIONAL(ENABLE_COLLIE_MODULE, test "$collie_module" = "yes")
-
-
-AC_MSG_CHECKING([whether h3600 module is requested])
-AC_ARG_ENABLE(h3600,
- AS_HELP_STRING([--enable-h3600],
- [Enable building of h3600 raw module (HP iPaq H3600 support) (default=yes)]),
- [h3600_module=$enableval],
- [h3600_module=yes])
-AC_MSG_RESULT($h3600_module)
-AM_CONDITIONAL(ENABLE_H3600_MODULE, test "$h3600_module" = "yes")
-
-AC_MSG_CHECKING([whether mk712 module is requested])
-AC_ARG_ENABLE(mk712,
- AS_HELP_STRING([--enable-mk712],
- [Enable building of mk712 raw module (Hi tachi support) (default=yes)]),
- [mk712_module=$enableval],
- [mk712_module=yes])
-AC_MSG_RESULT($mk712_module)
-AM_CONDITIONAL(ENABLE_MK712_MODULE, test "$mk712_module" = "yes")
-
-AC_MSG_CHECKING([whether arctic2 module is requested])
-AC_ARG_ENABLE(arctic2,
- AS_HELP_STRING([--enable-arctic2],
- [Enable building of arctic2 raw module (IBM Arctic II support) (default=yes)]),
- [arctic2_module=$enableval],
- [arctic2_module=yes])
-AC_MSG_RESULT($arctic2_module)
-AM_CONDITIONAL(ENABLE_ARCTIC2_MODULE, test "$arctic2_module" = "yes")
-
-AC_MSG_CHECKING([whether tatung module is requested])
-AC_ARG_ENABLE(tatung,
- AS_HELP_STRING([--enable-tatung],
- [Enable building of tatung raw module (Tatung Webpad support) (default=yes)]),
- [tatung_module=$enableval],
- [tatung_module=yes])
-AC_MSG_RESULT($tatung_module)
-AM_CONDITIONAL(ENABLE_TATUNG_MODULE, test "$tatung_module" = "yes")
-
-AC_MSG_CHECKING([whether input module is requested])
-AC_ARG_ENABLE(input,
- AS_HELP_STRING([--enable-input],
- [Enable building of generic input raw module (Linux /dev/input/eventN support) (default=yes)]),
- [input_module=$enableval],
- [input_module=yes])
-AC_MSG_RESULT($input_module)
-AM_CONDITIONAL(ENABLE_INPUT_MODULE, test "$input_module" = "yes")
+TSLIB_CHECK_MODULE([ucb1x00], [yes], [Enable building of ucb1x00 raw module (UCB1x00 support)])
+TSLIB_CHECK_MODULE([corgi], [yes], [Enable building of corgi raw module (Sharp Zaurus sl-c7x0 support)])
+TSLIB_CHECK_MODULE([collie], [yes], [Enable building of collie raw module (Sharp Zaurus sl-5500/5000d support)])
+TSLIB_CHECK_MODULE([h3600], [yes], [Enable building of h3600 raw module (HP iPaq H3600 support)])
+TSLIB_CHECK_MODULE([mk712], [yes], [Enable building of mk712 raw module (Hi tachi support)])
+TSLIB_CHECK_MODULE([arctic2], [yes], [Enable building of arctic2 raw module (IBM Arctic II support)])
+TSLIB_CHECK_MODULE([tatung], [yes], [Enable building of tatung raw module (Tatung Webpad support)])
+TSLIB_CHECK_MODULE([input], [yes], [Enable building of generic input raw module (Linux /dev/input/eventN support)])
AC_MSG_CHECKING([where to place modules])
AC_ARG_WITH(plugindir,
@@ -0,0 +1,22 @@
+dnl use: TSLIB_CHECK_MODULE(module, default, description)
+AC_DEFUN([TSLIB_CHECK_MODULE],
+[
+m4_pushdef([UP], m4_translit([$1], [-a-z], [_A-Z]))dnl
+
+AC_MSG_CHECKING([whether $1 module is requested])
+
+AC_ARG_ENABLE([$1],
+ AC_HELP_STRING([--enable-$1], [$3 (default=$2)]),
+ [enable_module=$enableval],
+ [enable_module=$2])
+AC_MSG_RESULT($enable_module)
+
+AM_CONDITIONAL(ENABLE_[]UP[]_MODULE, test "x$enable_module" = "xyes")
+AM_CONDITIONAL(ENABLE_STATIC_[]UP[]_MODULE, test "x$enable_module" = "xstatic")
+if test "x$enable_module" = "xstatic" ; then
+ AC_DEFINE(TSLIB_STATIC_[]UP[]_MODULE, 1, whether $1 should be build as part of libts or as a
+ separate shared library which is dlopen()-ed at runtime)
+fi
+
+m4_popdef([UP])
+])
View
@@ -91,7 +91,7 @@ else
INPUT_MODULE =
endif
-if ENABLE_H2200_LINEAR_MODULE
+if ENABLE_LINEAR_H2200_MODULE
H2200_LINEAR_MODULE = linear_h2200.la
else
H2200_LINEAR_MODULE =
View
@@ -48,7 +48,7 @@ static const struct tslib_ops arctic2_ops =
.read = arctic2_read,
};
-TSAPI struct tslib_module_info *mod_init(struct tsdev *dev, const char *params)
+TSAPI struct tslib_module_info *arctic2_mod_init(struct tsdev *dev, const char *params)
{
struct tslib_module_info *m;
@@ -59,3 +59,7 @@ TSAPI struct tslib_module_info *mod_init(struct tsdev *dev, const char *params)
m->ops = &arctic2_ops;
return m;
}
+
+#ifndef TSLIB_STATIC_ARCTIC2_MODULE
+ TSLIB_MODULE_INIT(arctic2_mod_init);
+#endif
View
@@ -48,7 +48,7 @@ static const struct tslib_ops collie_ops =
.read = collie_read,
};
-TSAPI struct tslib_module_info *mod_init(struct tsdev *dev, const char *params)
+TSAPI struct tslib_module_info *collie_mod_init(struct tsdev *dev, const char *params)
{
struct tslib_module_info *m;
@@ -59,3 +59,7 @@ TSAPI struct tslib_module_info *mod_init(struct tsdev *dev, const char *params)
m->ops = &collie_ops;
return m;
}
+
+#ifndef TSLIB_STATIC_COLLIE_MODULE
+ TSLIB_MODULE_INIT(collie_mod_init);
+#endif
View
@@ -47,7 +47,7 @@ static const struct tslib_ops corgi_ops =
.read = corgi_read,
};
-TSAPI struct tslib_module_info *mod_init(struct tsdev *dev, const char *params)
+TSAPI struct tslib_module_info *corgi_mod_init(struct tsdev *dev, const char *params)
{
struct tslib_module_info *m;
@@ -58,3 +58,7 @@ TSAPI struct tslib_module_info *mod_init(struct tsdev *dev, const char *params)
m->ops = &corgi_ops;
return m;
}
+
+#ifndef TSLIB_STATIC_CORGI_MODULE
+ TSLIB_MODULE_INIT(corgi_mod_init);
+#endif
View
@@ -29,6 +29,7 @@
#include <stdio.h>
+#include "config.h"
#include "tslib.h"
#include "tslib-filter.h"
@@ -197,7 +198,7 @@ static const struct tslib_vars dejitter_vars[] =
#define NR_VARS (sizeof(dejitter_vars) / sizeof(dejitter_vars[0]))
-TSAPI struct tslib_module_info *mod_init(struct tsdev *dev, const char *params)
+TSAPI struct tslib_module_info *dejitter_mod_init(struct tsdev *dev, const char *params)
{
struct tslib_dejitter *djt;
@@ -219,3 +220,7 @@ TSAPI struct tslib_module_info *mod_init(struct tsdev *dev, const char *params)
return &djt->module;
}
+
+#ifndef TSLIB_STATIC_DEJITTER_MODULE
+ TSLIB_MODULE_INIT(dejitter_mod_init);
+#endif
View
@@ -47,7 +47,7 @@ static const struct tslib_ops h3600_ops =
.read = h3600_read,
};
-TSAPI struct tslib_module_info *mod_init(struct tsdev *dev, const char *params)
+TSAPI struct tslib_module_info *h3600_mod_init(struct tsdev *dev, const char *params)
{
struct tslib_module_info *m;
@@ -58,3 +58,7 @@ TSAPI struct tslib_module_info *mod_init(struct tsdev *dev, const char *params)
m->ops = &h3600_ops;
return m;
}
+
+#ifndef TSLIB_STATIC_H3600_MODULE
+ TSLIB_MODULE_INIT(h3600_mod_init);
+#endif
View
@@ -326,7 +326,7 @@ static const struct tslib_vars raw_vars[] =
#define NR_VARS (sizeof(raw_vars) / sizeof(raw_vars[0]))
-TSAPI struct tslib_module_info *mod_init(struct tsdev *dev, const char *params)
+TSAPI struct tslib_module_info *input_mod_init(struct tsdev *dev, const char *params)
{
struct tslib_input *i;
@@ -349,3 +349,7 @@ TSAPI struct tslib_module_info *mod_init(struct tsdev *dev, const char *params)
return &(i->module);
}
+
+#ifndef TSLIB_STATIC_INPUT_MODULE
+ TSLIB_MODULE_INIT(input_mod_init);
+#endif
View
@@ -20,6 +20,7 @@
#include <stdio.h>
+#include "config.h"
#include "tslib.h"
#include "tslib-filter.h"
@@ -106,7 +107,7 @@ static const struct tslib_ops linear_h2200_ops =
.fini = linear_h2200_fini,
};
-TSAPI struct tslib_module_info *mod_init(struct tsdev *dev, const char *params)
+TSAPI struct tslib_module_info *linear_h2200_mod_init(struct tsdev *dev, const char *params)
{
struct tslib_linear_h2200 *lin;
@@ -119,3 +120,7 @@ TSAPI struct tslib_module_info *mod_init(struct tsdev *dev, const char *params)
return &lin->module;
}
+
+#ifndef TSLIB_STATIC_LINEAR_H2200_MODULE
+ TSLIB_MODULE_INIT(linear_h2200_mod_init);
+#endif
View
@@ -20,6 +20,7 @@
#include <stdio.h>
+#include "config.h"
#include "tslib-private.h"
#include "tslib-filter.h"
@@ -107,7 +108,7 @@ static const struct tslib_vars linear_vars[] =
#define NR_VARS (sizeof(linear_vars) / sizeof(linear_vars[0]))
-TSAPI struct tslib_module_info *mod_init(struct tsdev *dev, const char *params)
+TSAPI struct tslib_module_info *linear_mod_init(struct tsdev *dev, const char *params)
{
struct tslib_linear *lin;
@@ -163,3 +164,7 @@ TSAPI struct tslib_module_info *mod_init(struct tsdev *dev, const char *params)
return &lin->module;
}
+
+#ifndef TSLIB_STATIC_LINEAR_MODULE
+ TSLIB_MODULE_INIT(linear_mod_init);
+#endif
View
@@ -50,7 +50,7 @@ static const struct tslib_ops mk712_ops =
.read = mk712_read,
};
-TSAPI struct tslib_module_info *mod_init(struct tsdev *dev, const char *params)
+TSAPI struct tslib_module_info *mk712_mod_init(struct tsdev *dev, const char *params)
{
struct tslib_module_info *m;
@@ -61,3 +61,7 @@ TSAPI struct tslib_module_info *mod_init(struct tsdev *dev, const char *params)
m->ops = &mk712_ops;
return m;
}
+
+#ifndef TSLIB_STATIC_MK712_MODULE
+ TSLIB_MODULE_INIT(mk712_mod_init);
+#endif
View
@@ -0,0 +1,17 @@
+#define TSLIB_DECLARE_MODULE(name) \
+ TSAPI struct tslib_module_info *name##_mod_init(struct tsdev *dev, const char *params)
+
+TSLIB_DECLARE_MODULE(linear);
+TSLIB_DECLARE_MODULE(dejitter);
+TSLIB_DECLARE_MODULE(linear_h2200);
+TSLIB_DECLARE_MODULE(variance);
+TSLIB_DECLARE_MODULE(pthres);
+
+TSLIB_DECLARE_MODULE(ucb1x00);
+TSLIB_DECLARE_MODULE(corgi);
+TSLIB_DECLARE_MODULE(collie);
+TSLIB_DECLARE_MODULE(h3600);
+TSLIB_DECLARE_MODULE(mk712);
+TSLIB_DECLARE_MODULE(arctic2);
+TSLIB_DECLARE_MODULE(tatung);
+TSLIB_DECLARE_MODULE(input);
View
@@ -20,6 +20,7 @@
#include <errno.h>
#include <limits.h>
+#include "config.h"
#include "tslib.h"
#include "tslib-filter.h"
@@ -131,7 +132,7 @@ static const struct tslib_vars pthres_vars[] =
#define NR_VARS (sizeof(pthres_vars) / sizeof(pthres_vars[0]))
-TSAPI struct tslib_module_info *mod_init(struct tsdev *dev, const char *params)
+TSAPI struct tslib_module_info *pthres_mod_init(struct tsdev *dev, const char *params)
{
struct tslib_pthres *p;
@@ -155,3 +156,7 @@ TSAPI struct tslib_module_info *mod_init(struct tsdev *dev, const char *params)
return &p->module;
}
+
+#ifndef TSLIB_STATIC_PTHRES_MODULE
+ TSLIB_MODULE_INIT(pthres_mod_init);
+#endif
Oops, something went wrong.

0 comments on commit 7342fc7

Please sign in to comment.