From 3fc6faf1ae48f15f627ccd4fae92d9c085876d42 Mon Sep 17 00:00:00 2001 From: Gunter Knauf Date: Sat, 30 Jun 2007 20:02:51 +0000 Subject: enabled building for NetWare CLIB architecture. --- lib/Makefile.netware | 76 +++++++++++++++++++++++++++++++++++----------------- lib/nwlib.c | 39 ++++++++++++++++++++++----- src/Makefile.netware | 49 +++++++++++++++++++++------------ 3 files changed, 116 insertions(+), 48 deletions(-) diff --git a/lib/Makefile.netware b/lib/Makefile.netware index f089d11b8..ea3acd398 100644 --- a/lib/Makefile.netware +++ b/lib/Makefile.netware @@ -95,8 +95,9 @@ ifeq ($(LIBARCH),LIBC) PRELUDE = $(SDK_LIBC)/imports/libcpre.o CFLAGS += -align 4 else - PRELUDE = "$(METROWERKS)/Novell Support/libraries/runtime/prelude.obj" -# CFLAGS += -include "$(METROWERKS)/Novell Support/headers/nlm_prefix.h" + PRELUDE = "$(subst \,/,$(METROWERKS))/Novell Support/libraries/runtime/prelude.obj" + PRELUDE += "$(subst \,/,$(METROWERKS))/Novell Support/libraries/runtime/mwcrtl.lib" + CFLAGS += -include "$(subst \,/,$(METROWERKS))/Novell Support/headers/nlm_clib_prefix.h" CFLAGS += -align 1 endif else @@ -112,6 +113,7 @@ ifeq ($(LIBARCH),LIBC) PRELUDE = $(SDK_LIBC)/imports/libcpre.gcc.o else PRELUDE = $(SDK_CLIB)/imports/clibpre.gcc.o + PRELUDE += c:/usr/lib/gcc-lib/i586-netware/3.2.3/libgcc.$(LIBEXT) CFLAGS += -include $(NDKBASE)/nlmconv/genlm.h endif endif @@ -128,7 +130,7 @@ INCLUDES = -I$(CURL_INC) -I$(CURL_LIB) ifdef WITH_ARES INCLUDES += -I$(ARES_LIB) - LDLIBS = $(ARES_LIB)/libcares.$(LIBEXT) + LDLIBS += $(ARES_LIB)/libcares.$(LIBEXT) endif ifdef WITH_ZLIB INCLUDES += -I$(ZLIB_PATH) @@ -165,7 +167,10 @@ else INCLUDES += -I$(SDK_CLIB)/include/nlm -I$(SDK_CLIB)/include # INCLUDES += -I$(SDK_CLIB)/include/nlm/obsolete # INCLUDES += -I$(SDK_LDAP)/clib/inc - CFLAGS += -DNETDB_USE_INTERNET + # CFLAGS += -DNETDB_USE_INTERNET + # for now disable LDAP unless we have coded a CLIB dynaloader. + DISABLE_LDAP = 1 + endif CFLAGS += $(INCLUDES) @@ -332,24 +337,55 @@ config.h: Makefile.netware @echo $(DL)#ifndef NETWARE$(DL) >> $@ @echo $(DL)#error This $(notdir $@) is created for NetWare platform!$(DL) >> $@ @echo $(DL)#endif$(DL) >> $@ - @echo $(DL)#define OS "i586-pc-NetWare"$(DL) >> $@ @echo $(DL)#define VERSION "$(LIBCURL_VERSION_STR)"$(DL) >> $@ @echo $(DL)#define PACKAGE_BUGREPORT "a suitable curl mailing list => http://curl.haxx.se/mail/"$(DL) >> $@ - @echo $(DL)#define HAVE_ARPA_INET_H 1$(DL) >> $@ - @echo $(DL)#define HAVE_ASSERT_H 1$(DL) >> $@ +ifeq ($(LIBARCH),CLIB) + @echo $(DL)#define OS "i586-clib-NetWare"$(DL) >> $@ + @echo $(DL)#define NETDB_USE_INTERNET 1$(DL) >> $@ + @echo $(DL)#define CURL_DISABLE_CRYPTO_AUTH 1$(DL) >> $@ + @echo $(DL)#define HAVE_INET_NTOA 1$(DL) >> $@ +# @echo $(DL)#define HAVE_INET_NTOA_R_DECL 1$(DL) >> $@ + @echo $(DL)#define HAVE_LL 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRICMP 1$(DL) >> $@ + @echo $(DL)#define socklen_t int$(DL) >> $@ + @echo $(DL)#define DL_LDAP_FILE "ldapsdk.nlm"$(DL) >> $@ +else + @echo $(DL)#define OS "i586-libc-NetWare"$(DL) >> $@ @echo $(DL)#define HAVE_DLFCN_H 1$(DL) >> $@ @echo $(DL)#define HAVE_DLOPEN 1$(DL) >> $@ + @echo $(DL)#define HAVE_FTRUNCATE 1$(DL) >> $@ + @echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@ + @echo $(DL)#define HAVE_INET_PTON 1$(DL) >> $@ + @echo $(DL)#define HAVE_LIMITS_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_INTTYPES_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_STDINT_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRCASECMP 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRLCAT 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRLCPY 1$(DL) >> $@ + @echo $(DL)#define HAVE_SYS_PARAM_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_SYS_SELECT_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_TERMIOS_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_AF_INET6 1$(DL) >> $@ + @echo $(DL)#define HAVE_PF_INET6 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRUCT_IN6_ADDR 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRUCT_SOCKADDR_IN6 1$(DL) >> $@ + @echo $(DL)#define SIZEOF_STRUCT_IN6_ADDR 16$(DL) >> $@ + @echo $(DL)#define DL_LDAP_FILE "lldapsdk.nlm"$(DL) >> $@ +endif + @echo $(DL)#define HAVE_ARPA_INET_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_ASSERT_H 1$(DL) >> $@ @echo $(DL)#define HAVE_ERR_H 1$(DL) >> $@ @echo $(DL)#define HAVE_FCNTL_H 1$(DL) >> $@ @echo $(DL)#define HAVE_FIONBIO 1$(DL) >> $@ @echo $(DL)#define HAVE_GETHOSTBYADDR 1$(DL) >> $@ - @echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@ + @echo $(DL)#define HAVE_GETHOSTBYNAME 1$(DL) >> $@ + @echo $(DL)#define HAVE_GETPROTOBYNAME 1$(DL) >> $@ + @echo $(DL)#define HAVE_GMTIME_R 1$(DL) >> $@ @echo $(DL)#define HAVE_INET_ADDR 1$(DL) >> $@ @echo $(DL)#define HAVE_INET_NTOA 1$(DL) >> $@ - @echo $(DL)#define HAVE_INET_PTON 1$(DL) >> $@ - @echo $(DL)#define HAVE_INTTYPES_H 1$(DL) >> $@ - @echo $(DL)#define HAVE_LIMITS_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_LOCALTIME_R 1$(DL) >> $@ @echo $(DL)#define HAVE_LONGLONG 1$(DL) >> $@ + @echo $(DL)#define HAVE_MALLOC_H 1$(DL) >> $@ @echo $(DL)#define HAVE_NETINET_IN_H 1$(DL) >> $@ @echo $(DL)#define HAVE_RECV 1$(DL) >> $@ @echo $(DL)#define HAVE_SELECT 1$(DL) >> $@ @@ -359,22 +395,18 @@ config.h: Makefile.netware @echo $(DL)#define HAVE_SIGNAL_H 1$(DL) >> $@ @echo $(DL)#define HAVE_SIG_ATOMIC_T 1$(DL) >> $@ @echo $(DL)#define HAVE_SOCKET 1$(DL) >> $@ - @echo $(DL)#define HAVE_STDINT_H 1$(DL) >> $@ @echo $(DL)#define HAVE_STDLIB_H 1$(DL) >> $@ - @echo $(DL)#define HAVE_STRCASECMP 1$(DL) >> $@ @echo $(DL)#define HAVE_STRDUP 1$(DL) >> $@ @echo $(DL)#define HAVE_STRFTIME 1$(DL) >> $@ @echo $(DL)#define HAVE_STRING_H 1$(DL) >> $@ - @echo $(DL)#define HAVE_STRLCAT 1$(DL) >> $@ - @echo $(DL)#define HAVE_STRLCPY 1$(DL) >> $@ @echo $(DL)#define HAVE_STRSTR 1$(DL) >> $@ - @echo $(DL)#define HAVE_SYS_PARAM_H 1$(DL) >> $@ - @echo $(DL)#define HAVE_SYS_SELECT_H 1$(DL) >> $@ @echo $(DL)#define HAVE_SYS_STAT_H 1$(DL) >> $@ @echo $(DL)#define HAVE_SYS_TIME_H 1$(DL) >> $@ - @echo $(DL)#define HAVE_TERMIOS_H 1$(DL) >> $@ @echo $(DL)#define HAVE_TIME_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_UNAME 1$(DL) >> $@ @echo $(DL)#define HAVE_UNISTD_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_UTIME 1$(DL) >> $@ + @echo $(DL)#define HAVE_UTIME_H 1$(DL) >> $@ @echo $(DL)#define RECV_TYPE_ARG1 int$(DL) >> $@ @echo $(DL)#define RECV_TYPE_ARG2 char *$(DL) >> $@ @echo $(DL)#define RECV_TYPE_ARG3 int$(DL) >> $@ @@ -390,18 +422,11 @@ config.h: Makefile.netware @echo $(DL)#define SIZEOF_CURL_OFF_T 4$(DL) >> $@ @echo $(DL)#define STDC_HEADERS 1$(DL) >> $@ @echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@ - @echo $(DL)#define HAVE_AF_INET6 1$(DL) >> $@ - @echo $(DL)#define HAVE_PF_INET6 1$(DL) >> $@ @echo $(DL)#define HAVE_STRUCT_ADDRINFO 1$(DL) >> $@ - @echo $(DL)#define HAVE_STRUCT_IN6_ADDR 1$(DL) >> $@ - @echo $(DL)#define HAVE_STRUCT_SOCKADDR_IN6 1$(DL) >> $@ @echo $(DL)#define HAVE_STRUCT_TIMEVAL 1$(DL) >> $@ - @echo $(DL)#define SIZEOF_STRUCT_IN6_ADDR 16$(DL) >> $@ @echo $(DL)#define SIZEOF_STRUCT_IN_ADDR 4$(DL) >> $@ ifdef DISABLE_LDAP @echo $(DL)#define CURL_DISABLE_LDAP 1$(DL) >> $@ -else - @echo $(DL)#define DL_LDAP_FILE "lldapsdk.nlm"$(DL) >> $@ endif ifdef ENABLE_IPV6 @echo $(DL)#define ENABLE_IPV6 1$(DL) >> $@ @@ -463,6 +488,7 @@ endif info: $(OBJDIR)/version.inc @echo Configured to build $(TARGET) with these options: + @echo libarchitecture: $(LIBARCH) @echo curl version: $(LIBCURL_VERSION_STR) @echo compiler/linker: $(CC) / $(LD) ifdef CABUNDLE diff --git a/lib/nwlib.c b/lib/nwlib.c index 846353aba..da155ac90 100644 --- a/lib/nwlib.c +++ b/lib/nwlib.c @@ -23,9 +23,12 @@ #ifdef NETWARE /* Novell NetWare */ +#include + +#ifdef __NOVELL_LIBC__ +/* For native LibC-based NLM we need to register as a real lib. */ #include #include -#include #include #include #include @@ -148,7 +151,7 @@ void _NonAppStop( void ) ** we return a non-zero value. Right now, there isn't any reason not to allow ** it. */ -int _NonAppCheckUnload( void ) +int _NonAppCheckUnload( void ) { return 0; } @@ -275,10 +278,10 @@ int GetOrSetUpData(int id, libdata_t **appData, return err; } -int DisposeLibraryData( void *data) +int DisposeLibraryData( void *data ) { if (data) { - void *tenbytes = ((libdata_t *) data)->tenbytes; + void *tenbytes = ((libdata_t *) data)->tenbytes; if (tenbytes) free(tenbytes); @@ -289,10 +292,10 @@ int DisposeLibraryData( void *data) return 0; } -void DisposeThreadData(void *data) +void DisposeThreadData( void *data ) { if (data) { - void *twentybytes = ((libthreaddata_t *) data)->twentybytes; + void *twentybytes = ((libthreaddata_t *) data)->twentybytes; if (twentybytes) free(twentybytes); @@ -301,4 +304,28 @@ void DisposeThreadData(void *data) } } +#else /* __NOVELL_LIBC__ */ +/* For native CLib-based NLM seems we can do a bit more simple. */ +#include + +/* Make the CLIB Ctx stuff link */ +/* +#include +#include +NETDB_DEFINE_CONTEXT +*/ + +int main ( void ) +{ + /* initialize any globals here... */ + + /* do this if any global initializing was done + SynchronizeStart(); + */ + ExitThread (TSR_THREAD, 0); + return 0; +} + +#endif /* __NOVELL_LIBC__ */ + #endif /* NETWARE */ diff --git a/src/Makefile.netware b/src/Makefile.netware index d625013ab..70df5d5a3 100644 --- a/src/Makefile.netware +++ b/src/Makefile.netware @@ -41,7 +41,7 @@ MTSAFE = YES STACK = 64000 SCREEN = $(TARGET) commandline utility # Comment the line below if you dont want to load protected automatically. -LDRING = 3 +#LDRING = 3 # Edit the var below to point to your lib architecture. ifndef LIBARCH @@ -93,7 +93,8 @@ ifeq ($(LIBARCH),LIBC) CFLAGS += -align 4 else PRELUDE = "$(METROWERKS)/Novell Support/libraries/runtime/prelude.obj" -# CFLAGS += -include "$(METROWERKS)/Novell Support/headers/nlm_prefix.h" + PRELUDE += "$(subst \,/,$(METROWERKS))/Novell Support/libraries/runtime/mwcrtl.lib" + CFLAGS += -include "$(subst \,/,$(METROWERKS))/Novell Support/headers/nlm_clib_prefix.h" CFLAGS += -align 1 endif else @@ -317,25 +318,44 @@ config.h: Makefile.netware @echo $(DL)#ifndef NETWARE$(DL) >> $@ @echo $(DL)#error This $(notdir $@) is created for NetWare platform!$(DL) >> $@ @echo $(DL)#endif$(DL) >> $@ - @echo $(DL)#define OS "i586-pc-NetWare"$(DL) >> $@ @echo $(DL)#define VERSION "$(LIBCURL_VERSION_STR)"$(DL) >> $@ @echo $(DL)#define PACKAGE_BUGREPORT "a suitable curl mailing list => http://curl.haxx.se/mail/"$(DL) >> $@ +ifeq ($(LIBARCH),CLIB) + @echo $(DL)#define OS "i586-clib-NetWare"$(DL) >> $@ + @echo $(DL)#define NETDB_USE_INTERNET 1$(DL) >> $@ + @echo $(DL)#define CURL_DISABLE_CRYPTO_AUTH 1$(DL) >> $@ + @echo $(DL)#define HAVE_INET_NTOA 1$(DL) >> $@ +# @echo $(DL)#define HAVE_INET_NTOA_R_DECL 1$(DL) >> $@ + @echo $(DL)#define HAVE_LL 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRICMP 1$(DL) >> $@ + @echo $(DL)#define socklen_t int$(DL) >> $@ + @echo $(DL)#define pressanykey PressAnyKeyToContinue$(DL) >> $@ +else + @echo $(DL)#define OS "i586-libc-NetWare"$(DL) >> $@ + @echo $(DL)#define HAVE_DLFCN_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_DLOPEN 1$(DL) >> $@ + @echo $(DL)#define HAVE_FTRUNCATE 1$(DL) >> $@ + @echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@ + @echo $(DL)#define HAVE_INET_PTON 1$(DL) >> $@ + @echo $(DL)#define HAVE_LIMITS_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_INTTYPES_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_STDINT_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRCASECMP 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRLCAT 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRLCPY 1$(DL) >> $@ + @echo $(DL)#define HAVE_SYS_PARAM_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_SYS_SELECT_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_TERMIOS_H 1$(DL) >> $@ +endif @echo $(DL)#define USE_MANUAL 1$(DL) >> $@ @echo $(DL)#define HAVE_ARPA_INET_H 1$(DL) >> $@ @echo $(DL)#define HAVE_ASSERT_H 1$(DL) >> $@ - @echo $(DL)#define HAVE_DLFCN_H 1$(DL) >> $@ - @echo $(DL)#define HAVE_DLOPEN 1$(DL) >> $@ @echo $(DL)#define HAVE_ERR_H 1$(DL) >> $@ @echo $(DL)#define HAVE_FCNTL_H 1$(DL) >> $@ @echo $(DL)#define HAVE_FIONBIO 1$(DL) >> $@ - @echo $(DL)#define HAVE_FTRUNCATE 1$(DL) >> $@ @echo $(DL)#define HAVE_GETHOSTBYADDR 1$(DL) >> $@ - @echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@ @echo $(DL)#define HAVE_INET_ADDR 1$(DL) >> $@ @echo $(DL)#define HAVE_INET_NTOA 1$(DL) >> $@ - @echo $(DL)#define HAVE_INET_PTON 1$(DL) >> $@ - @echo $(DL)#define HAVE_INTTYPES_H 1$(DL) >> $@ - @echo $(DL)#define HAVE_LIMITS_H 1$(DL) >> $@ @echo $(DL)#define HAVE_LONGLONG 1$(DL) >> $@ @echo $(DL)#define HAVE_MALLOC_H 1$(DL) >> $@ @echo $(DL)#define HAVE_NETINET_IN_H 1$(DL) >> $@ @@ -347,23 +367,18 @@ config.h: Makefile.netware @echo $(DL)#define HAVE_SIGNAL_H 1$(DL) >> $@ @echo $(DL)#define HAVE_SIG_ATOMIC_T 1$(DL) >> $@ @echo $(DL)#define HAVE_SOCKET 1$(DL) >> $@ - @echo $(DL)#define HAVE_STDINT_H 1$(DL) >> $@ @echo $(DL)#define HAVE_STDLIB_H 1$(DL) >> $@ - @echo $(DL)#define HAVE_STRCASECMP 1$(DL) >> $@ @echo $(DL)#define HAVE_STRDUP 1$(DL) >> $@ @echo $(DL)#define HAVE_STRFTIME 1$(DL) >> $@ @echo $(DL)#define HAVE_STRING_H 1$(DL) >> $@ - @echo $(DL)#define HAVE_STRLCAT 1$(DL) >> $@ - @echo $(DL)#define HAVE_STRLCPY 1$(DL) >> $@ @echo $(DL)#define HAVE_STRSTR 1$(DL) >> $@ - @echo $(DL)#define HAVE_SYS_PARAM_H 1$(DL) >> $@ - @echo $(DL)#define HAVE_SYS_SELECT_H 1$(DL) >> $@ @echo $(DL)#define HAVE_SYS_STAT_H 1$(DL) >> $@ @echo $(DL)#define HAVE_SYS_TIME_H 1$(DL) >> $@ - @echo $(DL)#define HAVE_TERMIOS_H 1$(DL) >> $@ @echo $(DL)#define HAVE_TIME_H 1$(DL) >> $@ @echo $(DL)#define HAVE_UNAME 1$(DL) >> $@ @echo $(DL)#define HAVE_UNISTD_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_UTIME 1$(DL) >> $@ + @echo $(DL)#define HAVE_UTIME_H 1$(DL) >> $@ @echo $(DL)#define RECV_TYPE_ARG1 int$(DL) >> $@ @echo $(DL)#define RECV_TYPE_ARG2 char *$(DL) >> $@ @echo $(DL)#define RECV_TYPE_ARG3 int$(DL) >> $@ -- cgit v1.2.1