AM_CONDITIONAL([ENABLE_CLI_INSTALL_BIN], [test "$enable_cli" = "bin"])
AM_CONDITIONAL([ENABLE_CLI_INSTALL_SBIN], [test "$enable_cli" = "sbin"])
+AC_CHECK_HEADERS(dlfcn.h, [], [])
+
AC_ARG_ENABLE([pthreads],
AS_HELP_STRING([--disable-pthreads], [Disable pthreads support]),
[enable_pthreads="$enableval"], [enable_pthreads="yes"])
#include <netlink/cli/utils.h>
#include <locale.h>
+#include "lib/defs.h"
+
+#ifdef HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
/**
* Parse a text based 32 bit unsigned integer argument
* @arg arg Integer in text form.
void nl_cli_load_module(const char *prefix, const char *name)
{
char path[FILENAME_MAX+1];
- void *handle;
snprintf(path, sizeof(path), "%s/%s/%s.so",
PKGLIBDIR, prefix, name);
- if (!(handle = dlopen(path, RTLD_NOW)))
- nl_cli_fatal(ENOENT, "Unable to load module \"%s\": %s\n",
- path, dlerror());
+#ifdef HAVE_DLFCN_H
+ {
+ void *handle;
+
+ if (!(handle = dlopen(path, RTLD_NOW))) {
+ nl_cli_fatal(ENOENT, "Unable to load module \"%s\": %s\n",
+ path, dlerror());
+ }
+ }
+#else
+ nl_cli_fatal(ENOTSUP, "Unable to load module \"%s\": built without dynamic libraries support\n",
+ path);
+#endif
}
/** @} */