summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgregory guy <gregory-tde@laposte.net>2021-07-14 12:50:17 +0200
committergregory guy <gregory-tde@laposte.net>2021-07-19 14:17:02 +0200
commitb4149315024044440d69dbe9a4961ffb6e45989f (patch)
treee46e9de0e581189f0106593c4d86b61e40d921cf
parentdefa7b64d793db74f47a706cb2565684f9577104 (diff)
downloadknemo-b4149315.tar.gz
knemo-b4149315.zip
Make the Nettools backend optional.
Signed-off-by: gregory guy <gregory-tde@laposte.net>
-rw-r--r--CMakeLists.txt1
-rw-r--r--ConfigureChecks.cmake49
-rw-r--r--config.h.cmake3
-rw-r--r--src/knemod/backends/CMakeLists.txt12
-rw-r--r--src/knemod/backends/daemonregistry.h6
-rw-r--r--src/knemod/backends/kcmregistry.h18
6 files changed, 55 insertions, 34 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c8fdd9d..967d19a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -43,6 +43,7 @@ tde_setup_paths( )
option( WITH_ALL_OPTIONS "Enable all optional support" OFF )
option( WITH_GCC_VISIBILITY "Enable fvisibility and fvisibility-inlines-hidden" ${WITH_ALL_OPTIONS} )
+option( WITH_NETTOOLS "Enable net-tools backend support" OFF )
option( WITH_LIBIW "Enable build with libiw" ${WITH_ALL_OPTIONS} )
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index 9db25bd..5870728 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -25,30 +25,31 @@ if( WITH_GCC_VISIBILITY )
endif( WITH_GCC_VISIBILITY )
-##### search for programs
-
-message( STATUS "Checking for ifconfig" )
-find_program( PATH_IFCONFIG "ifconfig" DOC "Path for the ifconfig program" )
-if( NOT PATH_IFCONFIG )
- tde_message_fatal( "Program ifconfig is required but was not found on your system." )
-endif( )
-message( STATUS "Checking for ifconfig - found ${PATH_IFCONFIG}" )
-
-message( STATUS "Checking for route" )
-find_program( PATH_ROUTE "route" DOC "Path for the route program" )
-if( NOT PATH_ROUTE )
- message( STATUS "Checking for route - not found" )
-else( )
- message( STATUS "Checking for route - found ${PATH_ROUTE}" )
-endif( )
-
-message( STATUS "Checking for iwconfig" )
-find_program( PATH_IWCONFIG "iwconfig" DOC "Path for the iwconfig program" )
-if( NOT PATH_IWCONFIG )
- message( STATUS "Checking for iwconfig - not found" )
-else( )
- message( STATUS "Checking for iwconfig - found ${PATH_IWCONFIG}" )
-endif( )
+##### net-tools support
+
+if( WITH_NETTOOLS )
+ find_program( PATH_IFCONFIG "ifconfig" DOC "Path for the ifconfig program" )
+ find_program( PATH_ROUTE "route" DOC "Path for the route program" )
+ find_program( PATH_IWCONFIG "iwconfig" DOC "Path for the iwconfig program" )
+
+ if( PATH_IFCONFIG-NOTFOUND )
+ tde_message_fatal( "Program ifconfig is required but was not found on your system." )
+ endif()
+ message( STATUS "Checking for ifconfig - found ${PATH_IFCONFIG}" )
+
+ if( PATH_ROUTE-NOTFOUND )
+ message( STATUS "Checking for route - not found" )
+ else()
+ message( STATUS "Checking for route - found ${PATH_ROUTE}" )
+ endif()
+
+ if( PATH_IWCONFIG-NOTFOUND )
+ message( STATUS "Checking for iwconfig - not found" )
+ else()
+ message( STATUS "Checking for iwconfig - found ${PATH_IWCONFIG}" )
+ endif()
+ set( WITH_NETTOOLS 1 )
+endif( WITH_NETTOOLS )
##### support for libiw
diff --git a/config.h.cmake b/config.h.cmake
index 791fded..f663a08 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -18,3 +18,6 @@
/* Defined if you have the <iwlib.h> header */
#cmakedefine HAVE_LIBIW @HAVE_LIBIW@
+
+/* Defined if you build with the Nettools backend */
+#cmakedefine WITH_NETTOOLS
diff --git a/src/knemod/backends/CMakeLists.txt b/src/knemod/backends/CMakeLists.txt
index 3e9ef71..afe94d3 100644
--- a/src/knemod/backends/CMakeLists.txt
+++ b/src/knemod/backends/CMakeLists.txt
@@ -14,14 +14,20 @@ link_directories(
)
+set( _SRC_ backendbase.cpp
+ sysbackend.cpp
+)
+if( WITH_NETTOOLS )
+ list( APPEND _SRC_ nettoolsbackend.cpp )
+endif()
+
+
##### knemo_backends (static)
tde_add_library( knemo_backends STATIC_PIC AUTOMOC
SOURCES
- backendbase.cpp
- nettoolsbackend.cpp
- sysbackend.cpp
+ ${_SRC_}
LINK
tdeio-shared
${IW_LIBRARIES}
diff --git a/src/knemod/backends/daemonregistry.h b/src/knemod/backends/daemonregistry.h
index 26af5ae..d3ec3b9 100644
--- a/src/knemod/backends/daemonregistry.h
+++ b/src/knemod/backends/daemonregistry.h
@@ -20,6 +20,10 @@
#ifndef DAEMONREGISTRY_H
#define DAEMONREGISTRY_H
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <tqstring.h>
#include <tdelocale.h>
@@ -47,7 +51,9 @@ struct DaemonRegistryEntry
DaemonRegistryEntry DaemonRegistry[] =
{
{ "Sys", SysBackend::createInstance },
+#if defined( WITH_NETTOOLS )
{ "Nettools", NetToolsBackend::createInstance },
+#endif
{ TQString(), 0 }
};
diff --git a/src/knemod/backends/kcmregistry.h b/src/knemod/backends/kcmregistry.h
index 28ffec4..38a95c6 100644
--- a/src/knemod/backends/kcmregistry.h
+++ b/src/knemod/backends/kcmregistry.h
@@ -20,6 +20,10 @@
#ifndef KCMREGISTRY_H
#define KCMREGISTRY_H
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <tqstring.h>
#include <tdelocale.h>
@@ -42,13 +46,13 @@ struct KCMRegistryEntry
KCMRegistryEntry KCMRegistry[] =
{
- { "Sys",
- i18n( "Uses the sys filesystem available in 2.6 kernels and " \
- "direct system calls to the Linux kernel." ) },
- { "Nettools",
- i18n( "Uses the tools from the net-tools package like ifconfig, " \
- "iwconfig and route to read the necessary information " \
- "from the ouput of these commands.") },
+ { "Sys", i18n( "Uses the sys filesystem available in 2.6 kernels and " \
+ "direct system calls to the Linux kernel." ) },
+#if defined( WITH_NETTOOLS )
+ { "Nettools", i18n( "Uses the tools from the net-tools package like ifconfig, " \
+ "iwconfig and route to read the necessary information " \
+ "from the ouput of these commands.") },
+#endif
{ TQString(), TQString() }
};