Remove dependance on Source/Foundation link, additional MINGW ports.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@7505 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fedor 2000-09-13 19:52:42 +00:00
parent caf7f359e1
commit 9dda3a1adb
13 changed files with 144 additions and 68 deletions

View file

@ -1,5 +1,20 @@
2000-09-13 Adam Fedor <fedor@gnu.org>
* Remove dependance on Source/Foundation link, additional MINGW ports.
* Makefile.postamble (header-links): Remove Source/Foundation link.
* Source/Makefile.preamble (HEADER_DIR): New variable.
(ADDITIONAL_INCLUDE_DIRS): Include ../Headers.
* Source/GNUmakefile (GENERATED_HEADERS): Change Foundation
to $(HEADER_DIR).
* Source/Makefile.postamble: Likewise.
* Source/GSTcpPost.m: Update to handle MINGW (mostly copied from
gdomap.c).
* Source/NSFileManager.m (-findNextFile): Check if lstat,
geteuid implemented.
* Source/NSHost.m: Change includes for MINGW.
* Source/NSPipe.m (init): Port to MINGW.
* configure.in: Do preface.h substitutions here.
* Source/Makefile.postamble (preface.h): Remove target.

View file

@ -69,6 +69,9 @@
/* Define if you have the getcwd function. */
#undef HAVE_GETCWD
/* Define if you have the geteuid function. */
#undef HAVE_GETEUID
/* Define if you have the inet_aton function. */
#undef HAVE_INET_ATON

View file

@ -87,7 +87,7 @@
#include <sys/param.h> /* Hack to get rid of warning in GNU libc 2.0.3. */
#endif
/* The following group of lines maintained by the gstep-base src/Makefile */
/* The following group of lines maintained by the gstep-base configure */
#define GNUSTEP_BASE_VERSION @VERSION@
#define GNUSTEP_BASE_MAJOR_VERSION @MAJOR_VERSION@
#define GNUSTEP_BASE_MINOR_VERSION @MINOR_VERSION@

View file

@ -65,6 +65,9 @@ before-all:: header-links
# Things to do after distcleaning
after-distclean::
rm -f config.status config.log config.cache TAGS config.mak
rm -f Headers/gnustep/base/config.h \
Headers/gnustep/base/GSConfig.h \
Headers/gnustep/base/preface.h
cd Headers; rm -f Foundation
cd Source; rm -f Foundation
@ -79,16 +82,12 @@ header-links: $(HEADER_LINK_DEPENDS)
-rm -f Headers/Foundation/*
-mkdir Headers/Foundation
cp -f Headers/gnustep/base/*.h Headers/Foundation
-rm -f Source/Foundation/*
-mkdir Source/Foundation
cp -f Headers/gnustep/base/*.h Source/Foundation
else
header-links: $(HEADER_LINK_DEPENDS)
-rm -f Headers/Foundation
-rm -f Source/Foundation
$(LN_S) gnustep/base Headers/Foundation
$(LN_S) ../Headers/gnustep/base Source/Foundation
endif
configure: configure.in

View file

@ -343,11 +343,11 @@ HEADERS_INSTALL = $(GNU_HEADERS) \
GENERATED_HFILES = \
dynamic-load.h \
Foundation/preface.h \
Foundation/o_array.h \
Foundation/o_hash.h \
Foundation/o_list.h \
Foundation/o_map.h \
$(HEADER_DIR)/preface.h \
$(HEADER_DIR)/o_array.h \
$(HEADER_DIR)/o_hash.h \
$(HEADER_DIR)/o_list.h \
$(HEADER_DIR)/o_map.h \
$(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS)/mframe.h \
$(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS)/config.h \
$(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS)/GSConfig.h

View file

@ -42,15 +42,57 @@
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#ifndef __MINGW__
#include <unistd.h> /* for gethostname() */
#include <netinet/in.h> /* for inet_ntoa() */
#ifndef __MINGW__
#include <sys/param.h> /* for MAXHOSTNAMELEN */
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h> /* for inet_ntoa() */
#endif /* !__MINGW__ */
#include <errno.h>
#include <limits.h>
#include <string.h> /* for strchr() */
#include <ctype.h> /* for strchr() */
#include <fcntl.h>
#include <arpa/inet.h>
#ifdef __MINGW__
#include <winsock.h>
#include <wininet.h>
#include <process.h>
#include <sys/time.h>
#else
#include <sys/time.h>
#include <sys/resource.h>
#include <netdb.h>
#include <signal.h>
#include <sys/socket.h>
#include <sys/file.h>
/*
* Stuff for setting the sockets into non-blocking mode.
*/
#ifdef __POSIX_SOURCE
#define NBLK_OPT O_NONBLOCK
#else
#define NBLK_OPT FNDELAY
#endif
extern int errno;
#include <netinet/in.h>
#include <net/if.h>
#if !defined(SIOCGIFCONF) || defined(__CYGWIN__)
#include <sys/ioctl.h>
#ifndef SIOCGIFCONF
#include <sys/sockio.h>
#endif
#endif
#if defined(__svr4__)
#include <sys/stropts.h>
#endif
#endif /* !__MINGW__ */
#ifdef __MINGW__
#define close closesocket
#endif
static BOOL multi_threaded = NO;
@ -70,24 +112,6 @@ static gsu32 maxDataLength = 10 * 1024 * 1024;
#define GS_CONNECTION_MSG 0
#define NETBLOCK 8192
/*
* Stuff for setting the sockets into non-blocking mode.
*/
#ifdef __POSIX_SOURCE
#define NBLK_OPT O_NONBLOCK
#else
#define NBLK_OPT FNDELAY
#endif
#endif /* !__MINGW__ */
#include <string.h> /* for memset() and strchr() */
#ifndef __MINGW__
#include <time.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <errno.h>
#endif /* !__MINGW__ */
#ifndef INADDR_NONE
#define INADDR_NONE -1
#endif
@ -340,12 +364,23 @@ static Class runLoopClass;
{
GSTcpHandle *handle;
int e;
#ifdef __MINGW__
unsigned long dummy;
#endif /* __MINGW__ */
if (d < 0)
{
NSLog(@"illegal descriptor (%d) for Tcp Handle", d);
return nil;
}
#ifdef __MINGW__
dummy = 1;
if (ioctlsocket(udp_desc, FIONBIO, &dummy) < 0)
{
NSLog(@"unable to set non-blocking mode - %s", strerror(errno));
return nil;
}
#else /* !__MINGW__ */
if ((e = fcntl(d, F_GETFL, 0)) >= 0)
{
e |= NBLK_OPT;
@ -355,6 +390,7 @@ static Class runLoopClass;
return nil;
}
}
#endif
else
{
NSLog(@"unable to get non-blocking mode - %s", strerror(errno));
@ -375,6 +411,13 @@ static Class runLoopClass;
{
if (self == [GSTcpHandle class])
{
#ifdef __MINGW__
WORD wVersionRequested;
WSADATA wsaData;
wVersionRequested = MAKEWORD(2, 0);
WSAStartup(wVersionRequested, &wsaData);
#endif
mutableArrayClass = [NSMutableArray class];
mutableDataClass = [NSMutableData class];
portMessageClass = [NSPortMessage class];
@ -445,7 +488,11 @@ static Class runLoopClass;
if (connect(desc, (struct sockaddr*)&sin, sizeof(sin)) < 0)
{
#ifdef __MINGW__
if (WSAGetLastError() != WSAEINPROGRESS)
#else
if (errno != EINPROGRESS)
#endif
{
NSLog(@"unable to make connection to %s:%d - %s",
inet_ntoa(sin.sin_addr),

View file

@ -103,8 +103,7 @@ after-uninstall::
# Things to do after distcleaning
after-distclean::
rm -f Foundation/config.h Foundation/GSConfig.h Foundation/dynamic-load.h \
Foundation/preface.h mframe/mframe.h Foundation base \
rm -f mframe/mframe.h Foundation \
NSNumber[0-9]*.m NSValue[0-9]*.m o_*_bas.m
rm -rf $(GNUSTEP_TARGET_CPU)
@ -114,10 +113,6 @@ after-distclean::
# Things to do after checking
# after-check::
# Local links to the include files
Foundation:
$(LN_S) $(srcdir)/../Headers/gnustep/base Foundation
# Creation of NSValue and NSNumber concrete classes from templates
$(NSVALUE_MFILES) : NSCTemplateValue.m
rm -f $@
@ -134,19 +129,19 @@ dynamic-load.h: ../config.status
rm -f dynamic-load.h
cp $(srcdir)/$(DYNAMIC_LINKER)-load.h dynamic-load.h
$(GNUSTEP_OBJ_DIR)/preface${OEXT}: Foundation/preface.h
$(GNUSTEP_OBJ_DIR)/preface${OEXT}: $(HEADER_DIR)/preface.h
#
# The config.h file is specific to a target
#
$(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS)/config.h: ../config.status
$(MKDIRS) $(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS)
-mv Foundation/config.h $(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS)
-mv $(HEADER_DIR)/config.h $(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS)
-touch $(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS)/config.h
$(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS)/GSConfig.h: ../config.status
$(MKDIRS) $(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS)
-mv Foundation/GSConfig.h $(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS)
-mv $(HEADER_DIR)/GSConfig.h $(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS)
-touch $(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS)/GSConfig.h
$(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS)/mframe.h: mframe/config.status
@ -154,26 +149,26 @@ $(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS)/mframe.h: mframe/config.status
-mv mframe/mframe.h $(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS)
-touch $(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS)/mframe.h
Foundation/o_%_bas.h: Foundation/o_x_bas.h.in
$(HEADER_DIR)/o_%_bas.h: $(HEADER_DIR)/o_x_bas.h.in
sed -e "s/@XX@/$*/g" $< > $@
Foundation/o_%_cbs.h: Foundation/o_x_cbs.h.in
$(HEADER_DIR)/o_%_cbs.h: $(HEADER_DIR)/o_x_cbs.h.in
sed -e "s/@YY@/$*/g" $< > $@
o_%_bas.m: o_x_bas.m.in Foundation/o_%.h
o_%_bas.m: o_x_bas.m.in $(HEADER_DIR)/o_%.h
sed -e "s/@XX@/$*/g" $< > $@
o_%_cbs.m: o_x_cbs.m.in Foundation/o_%.h
o_%_cbs.m: o_x_cbs.m.in $(HEADER_DIR)/o_%.h
sed -e "s/@YY@/$*/g" $< > $@
$(GNUSTEP_OBJ_DIR)/o_array.o: o_array.m Foundation/o_array.h
Foundation/o_array.h: Foundation/o_array_bas.h Foundation/o_array_cbs.h Foundation/o_hash.h
$(GNUSTEP_OBJ_DIR)/o_hash.o: o_hash.m Foundation/o_hash.h
Foundation/o_hash.h: Foundation/o_hash_bas.h Foundation/o_hash_cbs.h
$(GNUSTEP_OBJ_DIR)/o_list.o: o_list.m Foundation/o_list.h
Foundation/o_list.h: Foundation/o_list_bas.h Foundation/o_list_cbs.h Foundation/o_array.h Foundation/o_hash.h
$(GNUSTEP_OBJ_DIR)/o_map.o: o_map.m Foundation/o_map.h
Foundation/o_map.h: Foundation/o_map_bas.h Foundation/o_map_cbs.h Foundation/o_hash.h
$(GNUSTEP_OBJ_DIR)/o_array.o: o_array.m $(HEADER_DIR)/o_array.h
$(HEADER_DIR)/o_array.h: $(HEADER_DIR)/o_array_bas.h $(HEADER_DIR)/o_array_cbs.h $(HEADER_DIR)/o_hash.h
$(GNUSTEP_OBJ_DIR)/o_hash.o: o_hash.m $(HEADER_DIR)/o_hash.h
$(HEADER_DIR)/o_hash.h: $(HEADER_DIR)/o_hash_bas.h $(HEADER_DIR)/o_hash_cbs.h
$(GNUSTEP_OBJ_DIR)/o_list.o: o_list.m $(HEADER_DIR)/o_list.h
$(HEADER_DIR)/o_list.h: $(HEADER_DIR)/o_list_bas.h $(HEADER_DIR)/o_list_cbs.h $(HEADER_DIR)/o_array.h $(HEADER_DIR)/o_hash.h
$(GNUSTEP_OBJ_DIR)/o_map.o: o_map.m $(HEADER_DIR)/o_map.h
$(HEADER_DIR)/o_map.h: $(HEADER_DIR)/o_map_bas.h $(HEADER_DIR)/o_map_cbs.h $(HEADER_DIR)/o_hash.h
#
# Files that include mframe.h will need a rebuild if it is changed.
@ -216,7 +211,7 @@ $(GNUSTEP_OBJ_DIR)/NSNotificationCenter.o \
$(GNUSTEP_OBJ_DIR)/NSRunLoop.o \
$(GNUSTEP_OBJ_DIR)/NSSerializer.o \
$(GNUSTEP_OBJ_DIR)/NSUnarchiver.o \
: Foundation/GSIArray.h Foundation/GSUnion.h
: $(HEADER_DIR)/GSIArray.h $(HEADER_DIR)/GSUnion.h
#
# Files that include GSIMap.h will need a rebuild if it is changed.
@ -227,7 +222,7 @@ $(GNUSTEP_OBJ_DIR)/NSGDictionary.o \
$(GNUSTEP_OBJ_DIR)/NSGSet.o \
$(GNUSTEP_OBJ_DIR)/NSNotificationCenter.o \
$(GNUSTEP_OBJ_DIR)/NSSerializer.o \
: Foundation/GSIMap.h Foundation/GSUnion.h
: $(HEADER_DIR)/GSIMap.h $(HEADER_DIR)/GSUnion.h
#
# Files that include fast.x will need a rebuild if it is changed.
@ -244,7 +239,7 @@ $(GNUSTEP_OBJ_DIR)/NSObject.o \
$(GNUSTEP_OBJ_DIR)/NSSerializer.o \
$(GNUSTEP_OBJ_DIR)/NSString.o \
$(GNUSTEP_OBJ_DIR)/NSUnarchiver.o \
: Foundation/fast.x
: $(HEADER_DIR)/fast.x
#
# Files that include propList.h will need a rebuild if it is changed.
@ -266,7 +261,7 @@ $(GNUSTEP_OBJ_DIR)/NSGCString.o \
# NSGeometry.m needs a recompile if NSGeometry.h is changed.
#
$(GNUSTEP_OBJ_DIR)/NSGeometry.o \
: Foundation/NSGeometry.h
: $(HEADER_DIR)/NSGeometry.h
#

View file

@ -48,7 +48,7 @@ ADDITIONAL_OBJCFLAGS =
ADDITIONAL_CFLAGS =
# Additional include directories the compiler should search
ADDITIONAL_INCLUDE_DIRS = -I../Headers/gnustep \
ADDITIONAL_INCLUDE_DIRS = -I../Headers/gnustep -I../Headers \
-I./$(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS)
# Additional LDFLAGS to pass to the linker
@ -74,4 +74,5 @@ ADDITIONAL_INSTALL_DIRS = $(GNUSTEP_HEADERS)/gnustep/base \
$(GNUSTEP_HEADERS)/gnustep/unicode \
$(GNUSTEP_HEADERS)/$(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS)
HEADER_DIR=$(srcdir)/../Headers/gnustep/base

View file

@ -224,6 +224,7 @@ static NSFileManager* defaultManager = nil;
#if defined(__MINGW__)
NSEnumerator *paths = [[path pathComponents] objectEnumerator];
NSString *subPath;
NSString *completePath = nil;
while ((subPath = [paths nextObject]))
{
@ -237,7 +238,7 @@ static NSFileManager* defaultManager = nil;
{
if (!isDir)
NSLog(@"WARNING: during creation of directory %@:"
" sub path %@ exists, but is not a directory !",
@" sub path %@ exists, but is not a directory !",
path, completePath);
}
else
@ -250,7 +251,7 @@ static NSFileManager* defaultManager = nil;
}
// change attributes of last directory
return [self changeFileAttributes:a ttributes atPath: path];
return [self changeFileAttributes: attributes atPath: path];
#else
const char *cpath;
@ -621,12 +622,12 @@ static NSFileManager* defaultManager = nil;
contents: (NSData*)contents
attributes: (NSDictionary*)attributes
{
int len;
int written;
const char *cpath = [self fileSystemRepresentationWithPath: path];
#if defined(__MINGW__)
HANDLE fh;
DWORD written = 0;
DWORD len = [contents length];
fh = CreateFile(cpath, GENERIC_WRITE, 0, 0, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, 0);
@ -636,8 +637,6 @@ static NSFileManager* defaultManager = nil;
}
else
{
DWORD len = [contents length];
DWORD written = 0;
if (len > 0)
{
@ -651,6 +650,8 @@ static NSFileManager* defaultManager = nil;
}
#else
int fd;
int len;
int written;
fd = open (cpath, O_WRONLY|O_TRUNC|O_CREAT, 0644);
if (fd < 0)
@ -1352,6 +1353,7 @@ static NSFileManager* defaultManager = nil;
if (_flags.isRecursive == YES)
{
// Do not follow links
#ifdef S_IFLNK
if (!_flags.isFollowing)
{
if (lstat(cpath, &statbuf) != 0)
@ -1361,6 +1363,7 @@ static NSFileManager* defaultManager = nil;
break;
}
else
#endif
{
if (stat(cpath, &statbuf) != 0)
break;
@ -1749,11 +1752,13 @@ static NSFileManager* defaultManager = nil;
if (stat(cpath, &statbuf) != 0)
return nil;
}
#ifdef S_IFLNK
else
{
if (lstat(cpath, &statbuf) != 0)
return nil;
}
#endif
values[0] = [NSNumber numberWithUnsignedLongLong: statbuf.st_size];
values[1] = [NSDate dateWithTimeIntervalSince1970: statbuf.st_mtime];
@ -1845,10 +1850,12 @@ static NSFileManager* defaultManager = nil;
* If we are running setuid to root - we need to specify the user
* to be the owner of copied files.
*/
#if HAVE_GETEUID
if (geteuid() == 0 && [@"root" isEqualToString: u] == NO)
{
values[count++] = u;
}
#endif
}
return [NSDictionary dictionaryWithObjects: values

View file

@ -32,12 +32,11 @@
#include <Foundation/NSSet.h>
#include <Foundation/NSString.h>
#include <Foundation/NSCoder.h>
#include <netdb.h>
/* #include <libc.h>*/
#if defined(__MINGW__)
#include <winsock.h>
#else
#include <netdb.h>
#include <unistd.h>
#include <sys/param.h>
#include <sys/socket.h>

View file

@ -48,6 +48,7 @@
self = [super init];
if (self)
{
#ifndef __MINGW__
int p[2];
if (pipe(p) == 0)
@ -55,6 +56,15 @@
readHandle = [[NSFileHandle alloc] initWithFileDescriptor:p[0]];
writeHandle = [[NSFileHandle alloc] initWithFileDescriptor:p[1]];
}
#else
HANDLE readh, writeh;
if (CreatePipe(&readh, &writeh, NULL, 0) != 0)
{
readHandle = [[NSFileHandle alloc] initWithNativeHandle: readh];
writeHandle = [[NSFileHandle alloc] initWithNativeHandle: writeh];
}
#endif
}
return self;
}

2
configure vendored
View file

@ -2831,7 +2831,7 @@ else
fi
done
for ac_func in statvfs symlink readlink
for ac_func in statvfs symlink readlink geteuid
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:2838: checking for $ac_func" >&5

View file

@ -541,7 +541,7 @@ AC_CHECK_HEADERS(values.h)
#--------------------------------------------------------------------
AC_CHECK_HEADERS(sys/stat.h sys/vfs.h sys/statfs.h sys/statvfs.h pwd.h grp.h)
AC_CHECK_HEADERS(sys/mount.h sys/types.h)
AC_CHECK_FUNCS(statvfs symlink readlink)
AC_CHECK_FUNCS(statvfs symlink readlink geteuid)
#--------------------------------------------------------------------
# These two headers (functions) needed by Time.m