Author: bnicholes Date: Thu Apr 14 16:38:52 2005 New Revision: 161365 URL: http://svn.apache.org/viewcvs?view=rev&rev=161365 Log: Allow Apache on NetWare to build using either the standard socket libraries or the Winsock libraries.
Modified: apr/apr/trunk/NWGNUmakefile apr/apr/trunk/build/NWGNUenvironment.inc apr/apr/trunk/build/NWGNUmakefile apr/apr/trunk/build/NWGNUtail.inc apr/apr/trunk/include/apr.hnw apr/apr/trunk/include/apr_errno.h apr/apr/trunk/include/arch/netware/apr_arch_networkio.h apr/apr/trunk/include/arch/netware/apr_private.h apr/apr/trunk/misc/netware/libprews.c apr/apr/trunk/misc/netware/start.c apr/apr/trunk/misc/unix/errorcodes.c Modified: apr/apr/trunk/NWGNUmakefile URL: http://svn.apache.org/viewcvs/apr/apr/trunk/NWGNUmakefile?view=diff&r1=161364&r2=161365 ============================================================================== --- apr/apr/trunk/NWGNUmakefile (original) +++ apr/apr/trunk/NWGNUmakefile Thu Apr 14 16:38:52 2005 @@ -188,6 +188,7 @@ libcpre.o \ $(APRLIB) \ $(APRUTLIB) \ + $(APULDAPLIB) \ $(XMLLIB) \ $(EOLIST) @@ -197,9 +198,14 @@ # FILES_nlm_modules = \ Libc \ - ws2_32 \ $(EOLIST) - + +# Include the Winsock libraries if Winsock is being used +ifndef USE_STDSOCKETS +FILES_nlm_modules += ws2_32 \ + $(EOLIST) +endif + #If the LDAP support is defined then add the auto-load modules ifneq "$(LDAPSDK)" "" FILES_nlm_modules += \ @@ -208,7 +214,6 @@ lldapx \ $(EOLIST) endif - # # If the nlm has a msg file, put it's path here @@ -230,11 +235,17 @@ # FILES_nlm_Ximports = \ @libc.imp \ - @ws2nlm.imp \ @netware.imp \ + $(EOLIST) + +# Include the Winsock imports if Winsock is being used +ifndef USE_STDSOCKETS +FILES_nlm_Ximports += \ + @ws2nlm.imp \ WSAStartupRTags \ WSACleanupRTag \ $(EOLIST) +endif #If the LDAP support is defined then add the imports ifneq "$(LDAPSDK)" "" @@ -370,8 +381,15 @@ vpath %.c atomic/netware:strings:tables:passwd:lib:time/unix vpath %.c file_io/unix:locks/netware:misc/netware:misc/unix:threadproc/netware -vpath %.c dso/netware:memory/unix:mmap/unix:user/netware:network_io/win32 -vpath %.c network_io/unix:poll/unix:shmem\unix:support/unix:random/unix +vpath %.c poll/unix:shmem\unix:support/unix:random/unix +vpath %.c dso/netware:memory/unix:mmap/unix:user/netware + +# Use the win32 network_io if Winsock is being used +ifdef USE_STDSOCKETS +vpath %.c network_io/unix +else +vpath %.c network_io/win32:network_io/unix +endif $(OBJDIR)/%.o: file_io/netware/%.c $(OBJDIR)\$(NLM_NAME)_cc.opt @echo Compiling $< Modified: apr/apr/trunk/build/NWGNUenvironment.inc URL: http://svn.apache.org/viewcvs/apr/apr/trunk/build/NWGNUenvironment.inc?view=diff&r1=161364&r2=161365 ============================================================================== --- apr/apr/trunk/build/NWGNUenvironment.inc (original) +++ apr/apr/trunk/build/NWGNUenvironment.inc Thu Apr 14 16:38:52 2005 @@ -116,6 +116,9 @@ INCDIRS = $(NOVELLLIBC)\include;$(NOVELLLIBC)\include\nks;$(NOVELLLIBC)\include\winsock; DEFINES = -DNETWARE +ifndef USE_STDSOCKETS +DEFINES += -DUSE_WINSOCK +endif # # MetroWerks static Libraries @@ -262,10 +265,11 @@ # Common directories # -APR = $(APR_WORK) +APR = $(APR_WORK) APRTEST = $(APR_WORK)/test APRUTIL = $(APU_WORK) -XML = $(APRUTIL)/xml +APULDAP = $(APU_WORK)/ldap +XML = $(APRUTIL)/xml # # Internal Libraries @@ -273,6 +277,7 @@ APRLIB = $(APR)/$(OBJDIR)/aprlib.lib APRUTLIB = $(APRUTIL)/$(OBJDIR)/aprutil.lib +APULDAPLIB = $(APULDAP)/$(OBJDIR)/apuldap.lib XMLLIB = $(XML)/$(OBJDIR)/xmllib.lib # Modified: apr/apr/trunk/build/NWGNUmakefile URL: http://svn.apache.org/viewcvs/apr/apr/trunk/build/NWGNUmakefile?view=diff&r1=161364&r2=161365 ============================================================================== --- apr/apr/trunk/build/NWGNUmakefile (original) +++ apr/apr/trunk/build/NWGNUmakefile Thu Apr 14 16:38:52 2005 @@ -42,7 +42,7 @@ @echo -EP >> $@ @echo -nosyspath >> $@ @echo -w nocmdline >> $@ - @echo -DNETWARE >> $@ + @echo $(DEFINES) -DGENEXPORTS >> $@ @echo -I$(APR)\include >> $@ @echo -I$(APR)\include\arch\netware >> $@ @echo -I$(APR)\include\arch\unix >> $@ Modified: apr/apr/trunk/build/NWGNUtail.inc URL: http://svn.apache.org/viewcvs/apr/apr/trunk/build/NWGNUtail.inc?view=diff&r1=161364&r2=161365 ============================================================================== --- apr/apr/trunk/build/NWGNUtail.inc (original) +++ apr/apr/trunk/build/NWGNUtail.inc Thu Apr 14 16:38:52 2005 @@ -234,6 +234,7 @@ endif @echo -l $(APR)/$(OBJDIR) >> $@ @echo -l $(APRUTIL)/$(OBJDIR) >> $@ + @echo -l $(APULDAP)/$(OBJDIR) >> $@ @echo -l $(XML)/$(OBJDIR) >> $@ @echo -l "$(METROWERKS)/Novell Support/Metrowerks Support/Libraries/Runtime" >> $@ @echo -l "$(METROWERKS)/Novell Support/Metrowerks Support/Libraries/MSL C++" >> $@ Modified: apr/apr/trunk/include/apr.hnw URL: http://svn.apache.org/viewcvs/apr/apr/trunk/include/apr.hnw?view=diff&r1=161364&r2=161365 ============================================================================== --- apr/apr/trunk/include/apr.hnw (original) +++ apr/apr/trunk/include/apr.hnw Thu Apr 14 16:38:52 2005 @@ -51,7 +51,11 @@ #include <nks/synch.h> #include <nks/time.h> #include <signal.h> +#ifdef USE_WINSOCK #include <novsock2.h> +#else +#include <sys/socket.h> +#endif #include <sys/types.h> #ifdef NW_BUILD_IPV6 @@ -89,8 +93,15 @@ #define APR_HAVE_FCNTL_H 1 #define APR_HAVE_IO_H 0 #define APR_HAVE_LIMITS_H 1 +#ifdef USE_WINSOCK +#define APR_HAVE_ARPA_INET_H 0 #define APR_HAVE_NETDB_H 0 #define APR_HAVE_NETINET_IN_H 0 +#else +#define APR_HAVE_ARPA_INET_H 1 +#define APR_HAVE_NETDB_H 1 +#define APR_HAVE_NETINET_IN_H 1 +#endif #define APR_HAVE_NETINET_SCTP_H 0 #define APR_HAVE_NETINET_SCTP_UIO_H 0 #define APR_HAVE_NETINET_TCP_H 0 @@ -104,15 +115,21 @@ #define APR_HAVE_STRINGS_H 0 #define APR_HAVE_STRTOLL 1 #define APR_HAVE_SYS_SENDFILE_H 0 -#define APR_HAVE_SYS_SIGNAL_H 0 +#define APR_HAVE_SYS_SYSLIMITS_H 0 +#ifdef USE_WINSOCK #define APR_HAVE_SYS_SOCKET_H 0 #define APR_HAVE_SYS_SOCKIO_H 0 -#define APR_HAVE_SYS_SYSLIMITS_H 0 #define APR_HAVE_SYS_TIME_H 0 +#else +#define APR_HAVE_SYS_SOCKET_H 1 +#define APR_HAVE_SYS_SOCKIO_H 1 +#define APR_HAVE_SYS_TIME_H 1 +#endif +#define APR_HAVE_SYS_SIGNAL_H 1 #define APR_HAVE_SYS_TYPES_H 1 #define APR_HAVE_SYS_UIO_H 1 -#define APR_HAVE_SYS_UN_H 0 -#define APR_HAVE_SYS_WAIT_H 0 +#define APR_HAVE_SYS_UN_H 1 +#define APR_HAVE_SYS_WAIT_H 1 #define APR_HAVE_TIME_H 1 #define APR_HAVE_UNISTD_H 1 @@ -232,7 +249,11 @@ #else typedef off_t apr_off_t; #endif +#ifdef USE_WINSOCK typedef int apr_socklen_t; +#else +typedef size_t apr_socklen_t; +#endif /* Are we big endian? */ /* XXX: Fatal assumption on Alpha platforms */ Modified: apr/apr/trunk/include/apr_errno.h URL: http://svn.apache.org/viewcvs/apr/apr/trunk/include/apr_errno.h?view=diff&r1=161364&r2=161365 ============================================================================== --- apr/apr/trunk/include/apr_errno.h (original) +++ apr/apr/trunk/include/apr_errno.h Thu Apr 14 16:38:52 2005 @@ -1046,7 +1046,7 @@ #define APR_STATUS_IS_ENOTEMPTY(s) ((s) == APR_ENOTEMPTY \ || (s) == APR_OS_START_SYSERR + ERROR_DIR_NOT_EMPTY) -#elif defined(NETWARE) && !defined(DOXYGEN) /* !defined(OS2) && !defined(WIN32) */ +#elif defined(NETWARE) && defined(USE_WINSOCK) && !defined(DOXYGEN) /* !defined(OS2) && !defined(WIN32) */ #define APR_FROM_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e + APR_OS_START_SYSERR) #define APR_TO_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e - APR_OS_START_SYSERR) Modified: apr/apr/trunk/include/arch/netware/apr_arch_networkio.h URL: http://svn.apache.org/viewcvs/apr/apr/trunk/include/arch/netware/apr_arch_networkio.h?view=diff&r1=161364&r2=161365 ============================================================================== --- apr/apr/trunk/include/arch/netware/apr_arch_networkio.h (original) +++ apr/apr/trunk/include/arch/netware/apr_arch_networkio.h Thu Apr 14 16:38:52 2005 @@ -16,12 +16,16 @@ #ifndef NETWORK_IO_H +#ifdef USE_WINSOCK /* Making sure that we include the correct networkio.h since the the project file is configured to first look for headers in arch/netware and then arch/unix. But in this specific case we want arch/win32. */ #include <../win32/apr_arch_networkio.h> +#else +#include <../unix/apr_arch_networkio.h> +#endif #endif /* ! NETWORK_IO_H */ Modified: apr/apr/trunk/include/arch/netware/apr_private.h URL: http://svn.apache.org/viewcvs/apr/apr/trunk/include/arch/netware/apr_private.h?view=diff&r1=161364&r2=161365 ============================================================================== --- apr/apr/trunk/include/arch/netware/apr_private.h (original) +++ apr/apr/trunk/include/arch/netware/apr_private.h Thu Apr 14 16:38:52 2005 @@ -46,6 +46,10 @@ #define HAVE_SIGNAL_H 1 #define HAVE_STDDEF_H 1 #define HAVE_STDLIB_H 1 +#ifndef USE_WINSOCK +#define HAVE_SYS_SELECT_H 1 +#define HAVE_WRITEV 1 +#endif #define HAVE_SYS_STAT_H 1 #define HAVE_SYS_MMAN_H 1 #define HAVE_FCNTL_H 1 Modified: apr/apr/trunk/misc/netware/libprews.c URL: http://svn.apache.org/viewcvs/apr/apr/trunk/misc/netware/libprews.c?view=diff&r1=161364&r2=161365 ============================================================================== --- apr/apr/trunk/misc/netware/libprews.c (original) +++ apr/apr/trunk/misc/netware/libprews.c Thu Apr 14 16:38:52 2005 @@ -16,7 +16,9 @@ #include <netware.h> #include <library.h> #include <nks/synch.h> +#ifdef USE_WINSOCK #include "novsock2.h" +#endif #include "apr_pools.h" #include "apr_private.h" @@ -58,7 +60,9 @@ #pragma unused(messageCount) #pragma unused(messages) +#ifdef USE_WINSOCK WSADATA wsaData; +#endif apr_status_t status; gLibId = register_library(DisposeLibraryData); @@ -84,14 +88,20 @@ if ((status = apr_pool_initialize()) != APR_SUCCESS) return status; +#ifdef USE_WINSOCK return WSAStartup((WORD) MAKEWORD(2, 0), &wsaData); +#else + return 0; +#endif } void _NonAppStop( void ) { apr_pool_terminate(); +#ifdef USE_WINSOCK WSACleanup(); +#endif unregister_library(gLibId); NXMutexFree(gLibLock); Modified: apr/apr/trunk/misc/netware/start.c URL: http://svn.apache.org/viewcvs/apr/apr/trunk/misc/netware/start.c?view=diff&r1=161364&r2=161365 ============================================================================== --- apr/apr/trunk/misc/netware/start.c (original) +++ apr/apr/trunk/misc/netware/start.c Thu Apr 14 16:38:52 2005 @@ -23,6 +23,7 @@ #include "apr_arch_proc_mutex.h" /* for apr_proc_mutex_unix_setup_lock() */ #include "apr_arch_internal_time.h" +#ifdef USE_WINSOCK /* ** Resource tag signatures for using NetWare WinSock 2. These will no longer ** be needed by anyone once the new WSAStartupWithNlmHandle() is available @@ -103,6 +104,7 @@ return err; } +#endif @@ -140,11 +142,13 @@ apr_pool_tag(pool, "apr_initilialize"); +#ifdef USE_WINSOCK err = RegisterAppWithWinSock (nlmhandle); if (err) { return err; } +#endif apr_signal_init(pool); @@ -173,7 +177,9 @@ away. */ netware_pool_proc_cleanup (); +#ifdef USE_WINSOCK UnregisterAppWithWinSock (app_data->gs_nlmhandle); +#endif } APR_DECLARE(void) apr_terminate2(void) Modified: apr/apr/trunk/misc/unix/errorcodes.c URL: http://svn.apache.org/viewcvs/apr/apr/trunk/misc/unix/errorcodes.c?view=diff&r1=161364&r2=161365 ============================================================================== --- apr/apr/trunk/misc/unix/errorcodes.c (original) +++ apr/apr/trunk/misc/unix/errorcodes.c Thu Apr 14 16:38:52 2005 @@ -183,7 +183,7 @@ return stuffbuffer(buf, bufsize, result); } -#elif defined(WIN32) || defined(NETWARE) +#elif defined(WIN32) || (defined(NETWARE) && defined(USE_WINSOCK)) static const struct { apr_status_t code;