build: setup plugin selection logic

This commit is contained in:
Aleksander Morgado
2019-11-21 18:28:51 +01:00
parent 1d1f597b55
commit 09080073ff
5 changed files with 999 additions and 585 deletions

View File

@@ -399,7 +399,88 @@ dnl
AM_CONDITIONAL(QCDM_STANDALONE, test "yes" = "no")
dnl-----------------------------------------------------------------------------
dnl Protocol libs
dnl Plugins
dnl
dnl By default all plugins are built and installed. If the user wants to build only
dnl some specific plugins, this can be done by disabling all first and then enabling
dnl only the ones required, e.g.:
dnl $ ./configure \
dnl --disable-all-plugins \
dnl --enable-plugin-generic \
dnl --enable-plugin-zte ...
dnl
dnl If the user wants all plugins except for some specific ones, those can be
dnl explicitly disabled, e.g.:
dnl $ ./configure \
dnl --disable-plugin-generic \
dnl --disable-plugin-zte ...
dnl
MM_ENABLE_ALL_PLUGINS
MM_ENABLE_PLUGIN([generic])
MM_ENABLE_PLUGIN([altair-lte])
MM_ENABLE_PLUGIN([anydata])
MM_ENABLE_PLUGIN([cinterion])
MM_ENABLE_PLUGIN([dell],
[with_shared_sierra,
with_shared_novatel,
with_shared_xmm,
with_shared_telit,
with_shared_foxconn])
MM_ENABLE_PLUGIN([dlink])
MM_ENABLE_PLUGIN([fibocom],
[with_shared_xmm])
MM_ENABLE_PLUGIN([foxconn],
[with_shared_foxconn])
MM_ENABLE_PLUGIN([haier])
MM_ENABLE_PLUGIN([huawei])
MM_ENABLE_PLUGIN([iridium])
MM_ENABLE_PLUGIN([linktop])
MM_ENABLE_PLUGIN([longcheer])
MM_ENABLE_PLUGIN([mbm])
MM_ENABLE_PLUGIN([motorola])
MM_ENABLE_PLUGIN([mtk])
MM_ENABLE_PLUGIN([nokia])
MM_ENABLE_PLUGIN([nokia-icera],
[with_shared_icera])
MM_ENABLE_PLUGIN([novatel],
[with_shared_novatel])
MM_ENABLE_PLUGIN([novatel-lte])
MM_ENABLE_PLUGIN([option],
[with_shared_option])
MM_ENABLE_PLUGIN([option-hso],
[with_shared_option])
MM_ENABLE_PLUGIN([pantech])
MM_ENABLE_PLUGIN([quectel])
MM_ENABLE_PLUGIN([samsung],
[with_shared_icera])
MM_ENABLE_PLUGIN([sierra-legacy],
[with_shared_icera,
with_shared_sierra])
MM_ENABLE_PLUGIN([sierra])
MM_ENABLE_PLUGIN([simtech])
MM_ENABLE_PLUGIN([telit],
[with_shared_telit])
MM_ENABLE_PLUGIN([thuraya])
MM_ENABLE_PLUGIN([tplink])
MM_ENABLE_PLUGIN([ublox])
MM_ENABLE_PLUGIN([via])
MM_ENABLE_PLUGIN([wavecom])
MM_ENABLE_PLUGIN([x22x])
MM_ENABLE_PLUGIN([zte],
[with_shared_icera])
MM_BUILD_SHARED([icera])
MM_BUILD_SHARED([sierra])
MM_BUILD_SHARED([option])
MM_BUILD_SHARED([novatel])
MM_BUILD_SHARED([xmm])
MM_BUILD_SHARED([telit])
MM_BUILD_SHARED([foxconn])
dnl-----------------------------------------------------------------------------
dnl Output
dnl
AC_CONFIG_FILES([
@@ -467,6 +548,53 @@ echo "
systemd journal: ${with_systemd_journal}
at command via dbus: ${with_at_command_via_dbus}
Shared utils:
icera: ${with_shared_icera}
sierra: ${with_shared_sierra}
option: ${with_shared_option}
novatel: ${with_shared_novatel}
xmm: ${with_shared_xmm}
telit: ${with_shared_telit}
foxconn: ${with_shared_foxconn}
Plugins:
generic: ${enable_plugin_generic}
altair lte: ${enable_plugin_altair_lte}
anydata: ${enable_plugin_anydata}
cinterion: ${enable_plugin_cinterion}
dell: ${enable_plugin_dell}
dlink: ${enable_plugin_dlink}
fibocom: ${enable_plugin_fibocom}
foxconn: ${enable_plugin_foxconn}
haier: ${enable_plugin_haier}
huawei: ${enable_plugin_huawei}
iridium: ${enable_plugin_iridium}
linktop: ${enable_plugin_linktop}
longcheer: ${enable_plugin_longcheer}
mbm: ${enable_plugin_mbm}
motorola: ${enable_plugin_motorola}
mtk: ${enable_plugin_mtk}
nokia: ${enable_plugin_nokia}
nokia icera: ${enable_plugin_nokia_icera}
novatel: ${enable_plugin_novatel}
novatel lte: ${enable_plugin_novatel_lte}
option: ${enable_plugin_option}
option hso: ${enable_plugin_option_hso}
pantech: ${enable_plugin_pantech}
quectel: ${enable_plugin_quectel}
samsung: ${enable_plugin_samsung}
sierra legacy: ${enable_plugin_sierra_legacy}
sierra: ${enable_plugin_sierra}
simtech: ${enable_plugin_simtech}
telit: ${enable_plugin_telit}
thuraya: ${enable_plugin_thuraya}
tplink: ${enable_plugin_tplink}
ublox: ${enable_plugin_ublox}
via: ${enable_plugin_via}
wavecom: ${enable_plugin_wavecom}
x22x: ${enable_plugin_x22x}
zte: ${enable_plugin_zte}
Miscellaneous:
gobject introspection: ${found_introspection}
vala bindings: ${enable_vala}

57
m4/mm-enable-plugin.m4 Normal file
View File

@@ -0,0 +1,57 @@
dnl -*- mode: autoconf -*-
dnl Copyright 2019 Aleksander Morgado
dnl
dnl This file is free software; the author(s) gives unlimited
dnl permission to copy and/or distribute it, with or without
dnl modifications, as long as this notice is preserved.
dnl
# serial 1
dnl Usage:
dnl MM_ENABLE_ALL_PLUGINS
AC_DEFUN([MM_ENABLE_ALL_PLUGINS],
[dnl
AC_ARG_ENABLE(all-plugins,
AS_HELP_STRING([--enable-all-plugins],
[Build all plugins [[default=yes]]]),
[],
[enable_all_plugins=yes])
])
dnl Usage:
dnl MM_ENABLE_PLUGIN([NAME],[WITH_SHARED_NAME_1,WITH_SHARED_NAME_2,...])
AC_DEFUN([MM_ENABLE_PLUGIN],
[dnl
m4_pushdef([var_enable_plugin], patsubst([enable_plugin_$1], -, _))dnl
m4_pushdef([VAR_ENABLE_PLUGIN], patsubst(translit([enable_plugin_$1], [a-z], [A-Z]), -, _))dnl
AC_ARG_ENABLE(plugin-$1,
AS_HELP_STRING([--enable-plugin-$1], [Build $1 plugin]),
[],
[var_enable_plugin=$enable_all_plugins])
if test "x$var_enable_plugin" = "xyes"; then
AC_DEFINE([VAR_ENABLE_PLUGIN], 1, [Define if $1 plugin is enabled])
m4_ifval([$2],[m4_foreach(with_shared,[$2],[dnl
with_shared="yes"
])])dnl
fi
AM_CONDITIONAL(VAR_ENABLE_PLUGIN, [test "x$var_enable_plugin" = "xyes"])
m4_popdef([VAR_ENABLE_PLUGIN])dnl
m4_popdef([var_enable_plugin])dnl
])
dnl Usage:
dnl MM_BUILD_SHARED([NAME])
AC_DEFUN([MM_BUILD_SHARED],
[dnl
m4_pushdef([with_shared], patsubst([with_shared_$1], -, _))dnl
m4_pushdef([WITH_SHARED], patsubst(translit([with_shared_$1], [a-z], [A-Z]), -, _))dnl
AM_CONDITIONAL(WITH_SHARED, test "x$with_shared" = "xyes")
if test "x$with_shared" = "xyes"; then
AC_DEFINE([WITH_SHARED], 1, [Define if $1 utils are built])
else
with_shared="no"
fi
m4_popdef([WITH_SHARED])dnl
m4_popdef([with_shared])dnl
])

File diff suppressed because it is too large Load Diff

View File

@@ -12,6 +12,7 @@
*
* Copyright (C) 2018 Aleksander Morgado <aleksander@aleksander.es>
*/
#include <config.h>
#include <glib.h>
#include <glib-object.h>
@@ -42,11 +43,13 @@ common_test (const gchar *keyfile_path)
/************************************************************/
#if defined ENABLE_PLUGIN_FOXCONN
static void
test_foxconn_t77w968 (void)
{
common_test (TESTKEYFILE_FOXCONN_T77W968);
}
#endif
/************************************************************/
@@ -76,7 +79,9 @@ int main (int argc, char **argv)
g_test_init (&argc, &argv, NULL);
#if defined ENABLE_PLUGIN_FOXCONN
g_test_add_func ("/MM/test-keyfiles/foxconn/t77w968", test_foxconn_t77w968);
#endif
return g_test_run ();
}

View File

@@ -13,6 +13,8 @@
* Copyright (C) 2016 Aleksander Morgado <aleksander@aleksander.es>
*/
#include <config.h>
#include <glib.h>
#include <glib-object.h>
#include <string.h>
@@ -43,83 +45,109 @@ common_test (const gchar *plugindir)
/************************************************************/
#if defined ENABLE_PLUGIN_HUAWEI
static void
test_huawei (void)
{
common_test (TESTUDEVRULESDIR_HUAWEI);
}
#endif
#if defined ENABLE_PLUGIN_MBM
static void
test_mbm (void)
{
common_test (TESTUDEVRULESDIR_MBM);
}
#endif
#if defined ENABLE_PLUGIN_NOKIA_ICERA
static void
test_nokia (void)
test_nokia_icera (void)
{
common_test (TESTUDEVRULESDIR_NOKIA);
common_test (TESTUDEVRULESDIR_NOKIA_ICERA);
}
#endif
#if defined ENABLE_PLUGIN_ZTE
static void
test_zte (void)
{
common_test (TESTUDEVRULESDIR_ZTE);
}
#endif
#if defined ENABLE_PLUGIN_LONGCHEER
static void
test_longcheer (void)
{
common_test (TESTUDEVRULESDIR_LONGCHEER);
}
#endif
#if defined ENABLE_PLUGIN_SIMTECH
static void
test_simtech (void)
{
common_test (TESTUDEVRULESDIR_SIMTECH);
}
#endif
#if defined ENABLE_PLUGIN_X22X
static void
test_x22x (void)
{
common_test (TESTUDEVRULESDIR_X22X);
}
#endif
#if defined ENABLE_PLUGIN_CINTERION
static void
test_cinterion (void)
{
common_test (TESTUDEVRULESDIR_CINTERION);
}
#endif
#if defined ENABLE_PLUGIN_DELL
static void
test_dell (void)
{
common_test (TESTUDEVRULESDIR_DELL);
}
#endif
#if defined ENABLE_PLUGIN_TELIT
static void
test_telit (void)
{
common_test (TESTUDEVRULESDIR_TELIT);
}
#endif
#if defined ENABLE_PLUGIN_MTK
static void
test_mtk (void)
{
common_test (TESTUDEVRULESDIR_MTK);
}
#endif
#if defined ENABLE_PLUGIN_HAIER
static void
test_haier (void)
{
common_test (TESTUDEVRULESDIR_HAIER);
}
#endif
#if defined ENABLE_PLUGIN_FIBOCOM
static void
test_fibocom (void)
{
common_test (TESTUDEVRULESDIR_FIBOCOM);
}
#endif
/************************************************************/
@@ -149,19 +177,45 @@ int main (int argc, char **argv)
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/MM/test-udev-rules/huawei", test_huawei);
g_test_add_func ("/MM/test-udev-rules/mbm", test_mbm);
g_test_add_func ("/MM/test-udev-rules/nokia", test_nokia);
g_test_add_func ("/MM/test-udev-rules/zte", test_zte);
#if defined ENABLE_PLUGIN_HUAWEI
g_test_add_func ("/MM/test-udev-rules/huawei", test_huawei);
#endif
#if defined ENABLE_PLUGIN_MBM
g_test_add_func ("/MM/test-udev-rules/mbm", test_mbm);
#endif
#if defined ENABLE_PLUGIN_NOKIA_ICERA
g_test_add_func ("/MM/test-udev-rules/nokia-icera", test_nokia_icera);
#endif
#if defined ENABLE_PLUGIN_ZTE
g_test_add_func ("/MM/test-udev-rules/zte", test_zte);
#endif
#if defined ENABLE_PLUGIN_LONGCHEER
g_test_add_func ("/MM/test-udev-rules/longcheer", test_longcheer);
g_test_add_func ("/MM/test-udev-rules/simtech", test_simtech);
g_test_add_func ("/MM/test-udev-rules/x22x", test_x22x);
#endif
#if defined ENABLE_PLUGIN_SIMTECH
g_test_add_func ("/MM/test-udev-rules/simtech", test_simtech);
#endif
#if defined ENABLE_PLUGIN_X22X
g_test_add_func ("/MM/test-udev-rules/x22x", test_x22x);
#endif
#if defined ENABLE_PLUGIN_CINTERION
g_test_add_func ("/MM/test-udev-rules/cinterion", test_cinterion);
g_test_add_func ("/MM/test-udev-rules/dell", test_dell);
g_test_add_func ("/MM/test-udev-rules/telit", test_telit);
g_test_add_func ("/MM/test-udev-rules/mtk", test_mtk);
g_test_add_func ("/MM/test-udev-rules/haier", test_haier);
g_test_add_func ("/MM/test-udev-rules/fibocom", test_fibocom);
#endif
#if defined ENABLE_PLUGIN_DELL
g_test_add_func ("/MM/test-udev-rules/dell", test_dell);
#endif
#if defined ENABLE_PLUGIN_TELIT
g_test_add_func ("/MM/test-udev-rules/telit", test_telit);
#endif
#if defined ENABLE_PLUGIN_MTK
g_test_add_func ("/MM/test-udev-rules/mtk", test_mtk);
#endif
#if defined ENABLE_PLUGIN_HAIER
g_test_add_func ("/MM/test-udev-rules/haier", test_haier);
#endif
#if defined ENABLE_PLUGIN_FIBOCOM
g_test_add_func ("/MM/test-udev-rules/fibocom", test_fibocom);
#endif
return g_test_run ();
}