summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbnicholes <bnicholes@13f79535-47bb-0310-9956-ffa450edef68>2005-04-14 23:38:52 +0000
committerbnicholes <bnicholes@13f79535-47bb-0310-9956-ffa450edef68>2005-04-14 23:38:52 +0000
commitd3c5b967f137ff47b51fb3ece755066c768038e9 (patch)
tree4728da134aaf0111cf5f5937eeb41d8ca5273dea
parent1aae97b6804314f49024d41e0aea57a4085b798c (diff)
downloadlibapr-d3c5b967f137ff47b51fb3ece755066c768038e9.tar.gz
Allow Apache on NetWare to build using either the standard socket libraries or the Winsock libraries.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@161365 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--NWGNUmakefile30
-rw-r--r--build/NWGNUenvironment.inc9
-rw-r--r--build/NWGNUmakefile2
-rw-r--r--build/NWGNUtail.inc1
-rw-r--r--include/apr.hnw29
-rw-r--r--include/apr_errno.h2
-rw-r--r--include/arch/netware/apr_arch_networkio.h4
-rw-r--r--include/arch/netware/apr_private.h4
-rw-r--r--misc/netware/libprews.c10
-rw-r--r--misc/netware/start.c6
-rw-r--r--misc/unix/errorcodes.c2
11 files changed, 84 insertions, 15 deletions
diff --git a/NWGNUmakefile b/NWGNUmakefile
index ed11cad61..8bc6e2fdd 100644
--- a/NWGNUmakefile
+++ b/NWGNUmakefile
@@ -188,6 +188,7 @@ FILES_nlm_libs = \
libcpre.o \
$(APRLIB) \
$(APRUTLIB) \
+ $(APULDAPLIB) \
$(XMLLIB) \
$(EOLIST)
@@ -197,9 +198,14 @@ FILES_nlm_libs = \
#
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 @@ FILES_nlm_modules += \
lldapx \
$(EOLIST)
endif
-
#
# If the nlm has a msg file, put it's path here
@@ -230,11 +235,17 @@ FILE_nlm_copyright =
#
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 @@ endif
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 $<
diff --git a/build/NWGNUenvironment.inc b/build/NWGNUenvironment.inc
index c6b860afb..ada821715 100644
--- a/build/NWGNUenvironment.inc
+++ b/build/NWGNUenvironment.inc
@@ -116,6 +116,9 @@ NOVI = $(NOVELLLIBC)\imports
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 @@ endif
# 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 @@ XML = $(APRUTIL)/xml
APRLIB = $(APR)/$(OBJDIR)/aprlib.lib
APRUTLIB = $(APRUTIL)/$(OBJDIR)/aprutil.lib
+APULDAPLIB = $(APULDAP)/$(OBJDIR)/apuldap.lib
XMLLIB = $(XML)/$(OBJDIR)/xmllib.lib
#
diff --git a/build/NWGNUmakefile b/build/NWGNUmakefile
index 6a003ab65..6f9b32dd0 100644
--- a/build/NWGNUmakefile
+++ b/build/NWGNUmakefile
@@ -42,7 +42,7 @@ $(NLM_NAME)_cc.opt : NWGNUmakefile $(APR_WORK)\build\NWGNUenvironment.inc $(APR_
@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 >> $@
diff --git a/build/NWGNUtail.inc b/build/NWGNUtail.inc
index 6ac21b90b..b2574ec0c 100644
--- a/build/NWGNUtail.inc
+++ b/build/NWGNUtail.inc
@@ -234,6 +234,7 @@ else
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++" >> $@
diff --git a/include/apr.hnw b/include/apr.hnw
index e8d14dc8b..f1be62e1b 100644
--- a/include/apr.hnw
+++ b/include/apr.hnw
@@ -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 @@ extern "C" {
#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 @@ extern "C" {
#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 @@ typedef off64_t apr_off_t;
#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 */
diff --git a/include/apr_errno.h b/include/apr_errno.h
index 30a047b5f..2046f3e2b 100644
--- a/include/apr_errno.h
+++ b/include/apr_errno.h
@@ -1046,7 +1046,7 @@ APR_DECLARE(char *) apr_strerror(apr_status_t statcode, char *buf,
#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)
diff --git a/include/arch/netware/apr_arch_networkio.h b/include/arch/netware/apr_arch_networkio.h
index 0485b0b41..a15afc586 100644
--- a/include/arch/netware/apr_arch_networkio.h
+++ b/include/arch/netware/apr_arch_networkio.h
@@ -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 */
diff --git a/include/arch/netware/apr_private.h b/include/arch/netware/apr_private.h
index 3881f7379..04a3b0b91 100644
--- a/include/arch/netware/apr_private.h
+++ b/include/arch/netware/apr_private.h
@@ -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
diff --git a/misc/netware/libprews.c b/misc/netware/libprews.c
index 6395adee4..a1dda594c 100644
--- a/misc/netware/libprews.c
+++ b/misc/netware/libprews.c
@@ -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 @@ int _NonAppStart
#pragma unused(messageCount)
#pragma unused(messages)
+#ifdef USE_WINSOCK
WSADATA wsaData;
+#endif
apr_status_t status;
gLibId = register_library(DisposeLibraryData);
@@ -84,14 +88,20 @@ int _NonAppStart
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);
diff --git a/misc/netware/start.c b/misc/netware/start.c
index d359c3de4..2cbfe9bfc 100644
--- a/misc/netware/start.c
+++ b/misc/netware/start.c
@@ -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 @@ static int RegisterAppWithWinSock (void *nlm_handle)
return err;
}
+#endif
@@ -140,11 +142,13 @@ APR_DECLARE(apr_status_t) apr_initialize(void)
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 @@ APR_DECLARE_NONSTD(void) apr_terminate(void)
away. */
netware_pool_proc_cleanup ();
+#ifdef USE_WINSOCK
UnregisterAppWithWinSock (app_data->gs_nlmhandle);
+#endif
}
APR_DECLARE(void) apr_terminate2(void)
diff --git a/misc/unix/errorcodes.c b/misc/unix/errorcodes.c
index d814763b5..45b8e21ec 100644
--- a/misc/unix/errorcodes.c
+++ b/misc/unix/errorcodes.c
@@ -183,7 +183,7 @@ static char *apr_os_strerror(char* buf, apr_size_t bufsize, int err)
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;