mirror of
https://gitee.com/openharmony/third_party_libnl
synced 2025-02-20 03:00:49 +00:00
build: merge branch 'cli-no-dlfcn-h'
https://github.com/thom311/libnl/pull/141
This commit is contained in:
commit
dad421eaac
@ -521,7 +521,7 @@ pkglib_qdiscdir = $(pkglibdir)/cli/qdisc
|
||||
pkglib_cls_LTLIBRARIES = $(lib_cli_ltlibraries_cls)
|
||||
pkglib_qdisc_LTLIBRARIES = $(lib_cli_ltlibraries_qdisc)
|
||||
else
|
||||
noinst_LTLIBRARIES += \
|
||||
check_LTLIBRARIES += \
|
||||
$(lib_cli_ltlibraries_cls) \
|
||||
$(lib_cli_ltlibraries_qdisc)
|
||||
endif
|
||||
|
@ -101,6 +101,8 @@ AM_CONDITIONAL([ENABLE_CLI], [test "$enable_cli" != "no"])
|
||||
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"])
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include <stdint.h>
|
||||
#include <ctype.h>
|
||||
#include <getopt.h>
|
||||
#include <dlfcn.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
|
@ -24,6 +24,12 @@
|
||||
#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.
|
||||
@ -220,14 +226,23 @@ struct nl_cache *nl_cli_alloc_cache_flags(struct nl_sock *sock,
|
||||
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
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
Loading…
x
Reference in New Issue
Block a user