SCP, makefile: Rename build conditional HAVE_DLOPEN to SIM_HAVE_DLOPEN
Some dependent packages on some platforms may also define HAVE_DLOPEN and that definition may have different syntax or semantics. This change avoids the potential symbol conflict. As reported in #1098
This commit is contained in:
parent
3621db4e6a
commit
c5cd38afbf
6 changed files with 23 additions and 23 deletions
8
makefile
8
makefile
|
@ -577,21 +577,21 @@ ifeq (${WIN32},) #*nix Environments (&& cygwin)
|
||||||
endif
|
endif
|
||||||
ifneq (,$(call find_include,dlfcn))
|
ifneq (,$(call find_include,dlfcn))
|
||||||
ifneq (,$(call find_lib,dl))
|
ifneq (,$(call find_lib,dl))
|
||||||
OS_CCDEFS += -DHAVE_DLOPEN=$(LIBSOEXT)
|
OS_CCDEFS += -DSIM_HAVE_DLOPEN=$(LIBSOEXT)
|
||||||
OS_LDFLAGS += -ldl
|
OS_LDFLAGS += -ldl
|
||||||
$(info using libdl: $(call find_lib,dl) $(call find_include,dlfcn))
|
$(info using libdl: $(call find_lib,dl) $(call find_include,dlfcn))
|
||||||
else
|
else
|
||||||
ifneq (,$(findstring BSD,$(OSTYPE))$(findstring AIX,$(OSTYPE))$(findstring Haiku,$(OSTYPE)))
|
ifneq (,$(findstring BSD,$(OSTYPE))$(findstring AIX,$(OSTYPE))$(findstring Haiku,$(OSTYPE)))
|
||||||
OS_CCDEFS += -DHAVE_DLOPEN=so
|
OS_CCDEFS += -DSIM_HAVE_DLOPEN=so
|
||||||
$(info using libdl: $(call find_include,dlfcn))
|
$(info using libdl: $(call find_include,dlfcn))
|
||||||
else
|
else
|
||||||
ifneq (,$(call find_lib,dld))
|
ifneq (,$(call find_lib,dld))
|
||||||
OS_CCDEFS += -DHAVE_DLOPEN=$(LIBSOEXT)
|
OS_CCDEFS += -DSIM_HAVE_DLOPEN=$(LIBSOEXT)
|
||||||
OS_LDFLAGS += -ldld
|
OS_LDFLAGS += -ldld
|
||||||
$(info using libdld: $(call find_lib,dld) $(call find_include,dlfcn))
|
$(info using libdld: $(call find_lib,dld) $(call find_include,dlfcn))
|
||||||
else
|
else
|
||||||
ifeq (Darwin,$(OSTYPE))
|
ifeq (Darwin,$(OSTYPE))
|
||||||
OS_CCDEFS += -DHAVE_DLOPEN=dylib
|
OS_CCDEFS += -DSIM_HAVE_DLOPEN=dylib
|
||||||
$(info using macOS dlopen with .dylib)
|
$(info using macOS dlopen with .dylib)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
18
scp.c
18
scp.c
|
@ -238,7 +238,7 @@
|
||||||
#endif
|
#endif
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
|
|
||||||
#if defined(HAVE_DLOPEN) /* Dynamic Readline support */
|
#if defined(SIM_HAVE_DLOPEN) /* Dynamic Readline support */
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -10091,7 +10091,7 @@ return read_line_p (NULL, cptr, size, stream);
|
||||||
char *read_line_p (const char *prompt, char *cptr, int32 size, FILE *stream)
|
char *read_line_p (const char *prompt, char *cptr, int32 size, FILE *stream)
|
||||||
{
|
{
|
||||||
char *tptr;
|
char *tptr;
|
||||||
#if defined(HAVE_DLOPEN)
|
#if defined(SIM_HAVE_DLOPEN)
|
||||||
static int initialized = 0;
|
static int initialized = 0;
|
||||||
typedef char *(*readline_func)(const char *);
|
typedef char *(*readline_func)(const char *);
|
||||||
static readline_func p_readline = NULL;
|
static readline_func p_readline = NULL;
|
||||||
|
@ -10104,15 +10104,15 @@ if (prompt && (!initialized)) {
|
||||||
|
|
||||||
#define S__STR_QUOTE(tok) #tok
|
#define S__STR_QUOTE(tok) #tok
|
||||||
#define S__STR(tok) S__STR_QUOTE(tok)
|
#define S__STR(tok) S__STR_QUOTE(tok)
|
||||||
handle = dlopen("libncurses." S__STR(HAVE_DLOPEN), RTLD_NOW|RTLD_GLOBAL);
|
handle = dlopen("libncurses." S__STR(SIM_HAVE_DLOPEN), RTLD_NOW|RTLD_GLOBAL);
|
||||||
handle = dlopen("libcurses." S__STR(HAVE_DLOPEN), RTLD_NOW|RTLD_GLOBAL);
|
handle = dlopen("libcurses." S__STR(SIM_HAVE_DLOPEN), RTLD_NOW|RTLD_GLOBAL);
|
||||||
handle = dlopen("libreadline." S__STR(HAVE_DLOPEN), RTLD_NOW|RTLD_GLOBAL);
|
handle = dlopen("libreadline." S__STR(SIM_HAVE_DLOPEN), RTLD_NOW|RTLD_GLOBAL);
|
||||||
if (!handle)
|
if (!handle)
|
||||||
handle = dlopen("libreadline." S__STR(HAVE_DLOPEN) ".7", RTLD_NOW|RTLD_GLOBAL);
|
handle = dlopen("libreadline." S__STR(SIM_HAVE_DLOPEN) ".7", RTLD_NOW|RTLD_GLOBAL);
|
||||||
if (!handle)
|
if (!handle)
|
||||||
handle = dlopen("libreadline." S__STR(HAVE_DLOPEN) ".6", RTLD_NOW|RTLD_GLOBAL);
|
handle = dlopen("libreadline." S__STR(SIM_HAVE_DLOPEN) ".6", RTLD_NOW|RTLD_GLOBAL);
|
||||||
if (!handle)
|
if (!handle)
|
||||||
handle = dlopen("libreadline." S__STR(HAVE_DLOPEN) ".5", RTLD_NOW|RTLD_GLOBAL);
|
handle = dlopen("libreadline." S__STR(SIM_HAVE_DLOPEN) ".5", RTLD_NOW|RTLD_GLOBAL);
|
||||||
if (handle) {
|
if (handle) {
|
||||||
p_readline = (readline_func)((size_t)dlsym(handle, "readline"));
|
p_readline = (readline_func)((size_t)dlsym(handle, "readline"));
|
||||||
p_add_history = (add_history_func)((size_t)dlsym(handle, "add_history"));
|
p_add_history = (add_history_func)((size_t)dlsym(handle, "add_history"));
|
||||||
|
@ -10165,7 +10165,7 @@ if ((*cptr == ';') || (*cptr == '#')) { /* ignore comment */
|
||||||
*cptr = 0;
|
*cptr = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined (HAVE_DLOPEN)
|
#if defined (SIM_HAVE_DLOPEN)
|
||||||
if (prompt && p_add_history && *cptr) /* Save non blank lines in history */
|
if (prompt && p_add_history && *cptr) /* Save non blank lines in history */
|
||||||
p_add_history (cptr);
|
p_add_history (cptr);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -5222,7 +5222,7 @@ if (UuidCreate_c)
|
||||||
else
|
else
|
||||||
_rand_uuid_gen (uuidaddr);
|
_rand_uuid_gen (uuidaddr);
|
||||||
}
|
}
|
||||||
#elif defined (HAVE_DLOPEN)
|
#elif defined (SIM_HAVE_DLOPEN)
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -5233,7 +5233,7 @@ void *handle;
|
||||||
|
|
||||||
#define S__STR_QUOTE(tok) #tok
|
#define S__STR_QUOTE(tok) #tok
|
||||||
#define S__STR(tok) S__STR_QUOTE(tok)
|
#define S__STR(tok) S__STR_QUOTE(tok)
|
||||||
handle = dlopen("libuuid." S__STR(HAVE_DLOPEN), RTLD_NOW|RTLD_GLOBAL);
|
handle = dlopen("libuuid." S__STR(SIM_HAVE_DLOPEN), RTLD_NOW|RTLD_GLOBAL);
|
||||||
if (handle)
|
if (handle)
|
||||||
uuid_generate_c = (void (*)(void *))((size_t)dlsym(handle, "uuid_generate"));
|
uuid_generate_c = (void (*)(void *))((size_t)dlsym(handle, "uuid_generate"));
|
||||||
if (uuid_generate_c)
|
if (uuid_generate_c)
|
||||||
|
|
10
sim_ether.c
10
sim_ether.c
|
@ -1225,11 +1225,11 @@ extern "C" {
|
||||||
#include <winreg.h>
|
#include <winreg.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_DLOPEN
|
#ifdef SIM_HAVE_DLOPEN
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(USE_SHARED) && (defined(_WIN32) || defined(HAVE_DLOPEN))
|
#if defined(USE_SHARED) && (defined(_WIN32) || defined(SIM_HAVE_DLOPEN))
|
||||||
/* Dynamic DLL loading technique and modified source comes from
|
/* Dynamic DLL loading technique and modified source comes from
|
||||||
Etherial/WireShark capture_pcap.c */
|
Etherial/WireShark capture_pcap.c */
|
||||||
|
|
||||||
|
@ -1249,7 +1249,7 @@ static const char* lib_name =
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
"/usr/lib/libpcap.A.dylib";
|
"/usr/lib/libpcap.A.dylib";
|
||||||
#else
|
#else
|
||||||
"libpcap." __STR(HAVE_DLOPEN);
|
"libpcap." __STR(SIM_HAVE_DLOPEN);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static char no_pcap[PCAP_ERRBUF_SIZE] =
|
static char no_pcap[PCAP_ERRBUF_SIZE] =
|
||||||
|
@ -1258,7 +1258,7 @@ static char no_pcap[PCAP_ERRBUF_SIZE] =
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
"/usr/lib/libpcap.A.dylib failed to load, install libpcap to use pcap networking";
|
"/usr/lib/libpcap.A.dylib failed to load, install libpcap to use pcap networking";
|
||||||
#else
|
#else
|
||||||
"libpcap." __STR(HAVE_DLOPEN) " failed to load, install libpcap to use pcap networking";
|
"libpcap." __STR(SIM_HAVE_DLOPEN) " failed to load, install libpcap to use pcap networking";
|
||||||
#endif
|
#endif
|
||||||
#undef __STR
|
#undef __STR
|
||||||
#undef __STR_QUOTE
|
#undef __STR_QUOTE
|
||||||
|
@ -1529,7 +1529,7 @@ int pcap_setnonblock(pcap_t* a, int nonblock, char *errbuf) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* defined(USE_SHARED) && (defined(_WIN32) || defined(HAVE_DLOPEN)) */
|
#endif /* defined(USE_SHARED) && (defined(_WIN32) || defined(SIM_HAVE_DLOPEN)) */
|
||||||
|
|
||||||
/* Some platforms have always had pcap_sendpacket */
|
/* Some platforms have always had pcap_sendpacket */
|
||||||
#if defined(_WIN32) || defined(__VMS)
|
#if defined(_WIN32) || defined(__VMS)
|
||||||
|
|
|
@ -124,8 +124,8 @@ extern "C" {
|
||||||
#if defined(USE_NETWORK) && defined(USE_SHARED)
|
#if defined(USE_NETWORK) && defined(USE_SHARED)
|
||||||
#undef USE_SHARED
|
#undef USE_SHARED
|
||||||
#endif
|
#endif
|
||||||
/* USE_SHARED only works on Windows or if HAVE_DLOPEN */
|
/* USE_SHARED only works on Windows or if SIM_HAVE_DLOPEN */
|
||||||
#if defined(USE_SHARED) && !defined(_WIN32) && !defined(HAVE_DLOPEN)
|
#if defined(USE_SHARED) && !defined(_WIN32) && !defined(SIM_HAVE_DLOPEN)
|
||||||
#undef USE_SHARED
|
#undef USE_SHARED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ extern "C" {
|
||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_DLOPEN
|
#ifdef SIM_HAVE_DLOPEN
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue