diff --git a/makefile b/makefile index c05ed593..12735414 100644 --- a/makefile +++ b/makefile @@ -577,21 +577,21 @@ ifeq (${WIN32},) #*nix Environments (&& cygwin) endif ifneq (,$(call find_include,dlfcn)) ifneq (,$(call find_lib,dl)) - OS_CCDEFS += -DHAVE_DLOPEN=$(LIBSOEXT) + OS_CCDEFS += -DSIM_HAVE_DLOPEN=$(LIBSOEXT) OS_LDFLAGS += -ldl $(info using libdl: $(call find_lib,dl) $(call find_include,dlfcn)) else 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)) else ifneq (,$(call find_lib,dld)) - OS_CCDEFS += -DHAVE_DLOPEN=$(LIBSOEXT) + OS_CCDEFS += -DSIM_HAVE_DLOPEN=$(LIBSOEXT) OS_LDFLAGS += -ldld $(info using libdld: $(call find_lib,dld) $(call find_include,dlfcn)) else ifeq (Darwin,$(OSTYPE)) - OS_CCDEFS += -DHAVE_DLOPEN=dylib + OS_CCDEFS += -DSIM_HAVE_DLOPEN=dylib $(info using macOS dlopen with .dylib) endif endif diff --git a/scp.c b/scp.c index 2987072e..3497c8ff 100644 --- a/scp.c +++ b/scp.c @@ -238,7 +238,7 @@ #endif #include -#if defined(HAVE_DLOPEN) /* Dynamic Readline support */ +#if defined(SIM_HAVE_DLOPEN) /* Dynamic Readline support */ #include #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 *tptr; -#if defined(HAVE_DLOPEN) +#if defined(SIM_HAVE_DLOPEN) static int initialized = 0; typedef char *(*readline_func)(const char *); static readline_func p_readline = NULL; @@ -10104,15 +10104,15 @@ if (prompt && (!initialized)) { #define S__STR_QUOTE(tok) #tok #define S__STR(tok) S__STR_QUOTE(tok) - handle = dlopen("libncurses." S__STR(HAVE_DLOPEN), RTLD_NOW|RTLD_GLOBAL); - handle = dlopen("libcurses." S__STR(HAVE_DLOPEN), RTLD_NOW|RTLD_GLOBAL); - handle = dlopen("libreadline." 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(SIM_HAVE_DLOPEN), RTLD_NOW|RTLD_GLOBAL); + handle = dlopen("libreadline." S__STR(SIM_HAVE_DLOPEN), RTLD_NOW|RTLD_GLOBAL); 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) - 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) - 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) { p_readline = (readline_func)((size_t)dlsym(handle, "readline")); p_add_history = (add_history_func)((size_t)dlsym(handle, "add_history")); @@ -10165,7 +10165,7 @@ if ((*cptr == ';') || (*cptr == '#')) { /* ignore comment */ *cptr = 0; } -#if defined (HAVE_DLOPEN) +#if defined (SIM_HAVE_DLOPEN) if (prompt && p_add_history && *cptr) /* Save non blank lines in history */ p_add_history (cptr); #endif diff --git a/sim_disk.c b/sim_disk.c index 57214ae3..c866a127 100644 --- a/sim_disk.c +++ b/sim_disk.c @@ -5222,7 +5222,7 @@ if (UuidCreate_c) else _rand_uuid_gen (uuidaddr); } -#elif defined (HAVE_DLOPEN) +#elif defined (SIM_HAVE_DLOPEN) #include static void @@ -5233,7 +5233,7 @@ void *handle; #define S__STR_QUOTE(tok) #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) uuid_generate_c = (void (*)(void *))((size_t)dlsym(handle, "uuid_generate")); if (uuid_generate_c) diff --git a/sim_ether.c b/sim_ether.c index 7fd2883e..bfee3645 100644 --- a/sim_ether.c +++ b/sim_ether.c @@ -1225,11 +1225,11 @@ extern "C" { #include #endif -#ifdef HAVE_DLOPEN +#ifdef SIM_HAVE_DLOPEN #include #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 Etherial/WireShark capture_pcap.c */ @@ -1249,7 +1249,7 @@ static const char* lib_name = #elif defined(__APPLE__) "/usr/lib/libpcap.A.dylib"; #else - "libpcap." __STR(HAVE_DLOPEN); + "libpcap." __STR(SIM_HAVE_DLOPEN); #endif static char no_pcap[PCAP_ERRBUF_SIZE] = @@ -1258,7 +1258,7 @@ static char no_pcap[PCAP_ERRBUF_SIZE] = #elif defined(__APPLE__) "/usr/lib/libpcap.A.dylib failed to load, install libpcap to use pcap networking"; #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 #undef __STR #undef __STR_QUOTE @@ -1529,7 +1529,7 @@ int pcap_setnonblock(pcap_t* a, int nonblock, char *errbuf) { 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 */ #if defined(_WIN32) || defined(__VMS) diff --git a/sim_ether.h b/sim_ether.h index f3edab8d..5b5c9128 100644 --- a/sim_ether.h +++ b/sim_ether.h @@ -124,8 +124,8 @@ extern "C" { #if defined(USE_NETWORK) && defined(USE_SHARED) #undef USE_SHARED #endif -/* USE_SHARED only works on Windows or if HAVE_DLOPEN */ -#if defined(USE_SHARED) && !defined(_WIN32) && !defined(HAVE_DLOPEN) +/* USE_SHARED only works on Windows or if SIM_HAVE_DLOPEN */ +#if defined(USE_SHARED) && !defined(_WIN32) && !defined(SIM_HAVE_DLOPEN) #undef USE_SHARED #endif diff --git a/sim_sock.c b/sim_sock.c index 6f357cc3..9b291c92 100644 --- a/sim_sock.c +++ b/sim_sock.c @@ -55,7 +55,7 @@ extern "C" { #include #endif -#ifdef HAVE_DLOPEN +#ifdef SIM_HAVE_DLOPEN #include #endif