diff --git a/ChangeLog b/ChangeLog index 75ddd5933..2577bc976 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,28 @@ +2002-01-28 Richard Frith-Macdonald + + * Headers/Foundation/NSRunLoop.h: Removed previously deprecated methods. + Completely changed ivar layout. + * Headers/Foundation/NSRunLoop.m: Removed previously deprecated methods. + Completely changed ivar layout. Modified most methods to work with + changed ivar layout. Now stores per-mode context information in a + new GSRunLoopCtxt class - one instance for each mode used in each + runloop instance. Rewrite select() and poll() based mechanisms + using the new class - should hopefully be more efficient and fix + minor and obscure problems with re-entrancy. + ### WARNING ... radical change ... may be buggy ... WARNING ### + +2002-01-23 Kaelin Colclasure + + * configure.in: Check for poll(2) system call and header file. + * configure: Regenerated. + * config.h.in: Regenerated. + * Source/NSRunLoop.m ([-acceptInputForMode:beforeDate:]): + Refactored to put all code specific to the select(2) system call + into a separate method. + ([-_pollInputForMode:withTimeout:]): New private method with two + implementations. If HAVE_POLL is defined, the poll version is + used. Otherwise, we fall back to select. + 2002-01-25 Richard Frith-Macdonald * acconfig.h: Add HAVE_SA_LEN diff --git a/Headers/gnustep/base/NSRunLoop.h b/Headers/gnustep/base/NSRunLoop.h index 42e8297a5..5d4e2127f 100644 --- a/Headers/gnustep/base/NSRunLoop.h +++ b/Headers/gnustep/base/NSRunLoop.h @@ -34,15 +34,10 @@ GS_EXPORT NSString* const NSDefaultRunLoopMode; @interface NSRunLoop : NSObject { @private - id _current_mode; - NSMapTable *_mode_2_timers; - NSMapTable *_mode_2_watchers; - NSMapTable *_mode_2_performers; - NSMutableArray *_timedPerformers; - NSMapTable *_efdMap; - NSMapTable *_rfdMap; - NSMapTable *_wfdMap; - int _fdStart; + NSString *_current_mode; + NSMutableArray *_timedPerformers; + NSMapTable *_mode_2_context; + void *_extra; } + (NSRunLoop*) currentRunLoop; @@ -55,7 +50,7 @@ GS_EXPORT NSString* const NSDefaultRunLoopMode; - (NSString*) currentMode; -- (NSDate*)limitDateForMode: (NSString*)mode; +- (NSDate*) limitDateForMode: (NSString*)mode; - (void) run; @@ -72,14 +67,14 @@ GS_EXPORT NSString* const NSDefaultRunLoopMode; forMode: (NSString*)mode; - (void) cancelPerformSelector: (SEL)aSelector - target: target - argument: argument; + target: (id)target + argument: (id)argument; - (void) configureAsServer; - (void) performSelector: (SEL)aSelector - target: target - argument: argument + target: (id)target + argument: (id)argument order: (unsigned int)order modes: (NSArray*)modes; @@ -93,10 +88,10 @@ GS_EXPORT NSString* const NSDefaultRunLoopMode; */ typedef enum { - ET_RDESC, /* Watch for descriptor becoming readable. */ - ET_WDESC, /* Watch for descriptor becoming writeable. */ - ET_RPORT, /* Watch for message arriving on port. */ - ET_EDESC /* Watch for descriptor with exception data. */ + ET_RDESC, /* Watch for descriptor becoming readable. */ + ET_WDESC, /* Watch for descriptor becoming writeable. */ + ET_RPORT, /* Watch for message arriving on port. */ + ET_EDESC /* Watch for descriptor with exception data. */ } RunLoopEventType; @protocol RunLoopEvents @@ -125,29 +120,9 @@ typedef enum { @interface NSRunLoop(GNUstepExtensions) -#if 0 /* - * The following ten methods are DEPRECATED - * They will be removed in later releases of GNUstep - */ -+ currentInstance; -+ (NSString*) currentMode; -+ (void) run; -+ (BOOL) runOnceBeforeDate: (NSDate*)date; -+ (BOOL) runOnceBeforeDate: (NSDate*)date - forMode: (NSString*)mode; -+ (void) runUntilDate: (NSDate*)date; -+ (void) runUntilDate: (NSDate*)date - forMode: (NSString*)mode; -- (BOOL) runOnceBeforeDate: (NSDate*)date; -- (BOOL) runOnceBeforeDate: (NSDate*)date - forMode: (NSString*)mode; -- (void) runUntilDate: (NSDate*)date - forMode: (NSString*)mode; -#endif -/* - * These next two are general purpose methods for letting objects - * ask the runloop to watch for events for them. Only one object + * These are general purpose methods for letting objects ask + * the runloop to watch for events for them. Only one object * at a time may be watching for a particular event in a mode, but * that object may add itsself as a watcher many times as long as * each addition is matched by a removal (the run loop keeps count). diff --git a/Headers/gnustep/base/config.h.in b/Headers/gnustep/base/config.h.in index 71722ba94..2c8fb9d4b 100644 --- a/Headers/gnustep/base/config.h.in +++ b/Headers/gnustep/base/config.h.in @@ -127,6 +127,9 @@ /* Define if you have the objc_thread_add function. */ #undef HAVE_OBJC_THREAD_ADD +/* Define if you have the poll function. */ +#undef HAVE_POLL + /* Define if you have the readlink function. */ #undef HAVE_READLINK @@ -220,6 +223,9 @@ /* Define if you have the header file. */ #undef HAVE_OPENSSL_SSL_H +/* Define if you have the header file. */ +#undef HAVE_POLL_H + /* Define if you have the header file. */ #undef HAVE_PTHREAD_H diff --git a/Source/NSNotificationQueue.m b/Source/NSNotificationQueue.m index dee5f5c19..3efbad126 100644 --- a/Source/NSNotificationQueue.m +++ b/Source/NSNotificationQueue.m @@ -435,7 +435,7 @@ add_to_queue(NSNotificationQueueList *queue, NSNotification *notification, - (void) postNotification: (NSNotification*)notification forModes: (NSArray*)modes { - NSString *mode = [NSRunLoop currentMode]; + NSString *mode = [[NSRunLoop currentRunLoop] currentMode]; // check to see if run loop is in a valid mode if (mode == nil || modes == nil diff --git a/Source/NSRunLoop.m b/Source/NSRunLoop.m index 61e037c3d..686e0498f 100644 --- a/Source/NSRunLoop.m +++ b/Source/NSRunLoop.m @@ -1,4 +1,6 @@ -/** Implementation of object for waiting on several input seurces +/** Implementation of object for waiting on several input sources + NSRunLoop.m + Copyright (C) 1996-1999 Free Software Foundation, Inc. Original by: Andrew Kachites McCallum @@ -46,6 +48,9 @@ #if HAVE_SYS_TIME_H #include #endif +#if HAVE_POLL_H +#include +#endif #include #include #include /* for memset() */ @@ -160,30 +165,6 @@ static inline BOOL timerInvalidated(NSTimer* timer) -/* - * Setup for inline operation of arrays. - */ - -#define GSI_ARRAY_TYPES GSUNION_OBJ - -#if GS_WITH_GC == 0 -#define GSI_ARRAY_RELEASE(X) [(X).obj release] -#define GSI_ARRAY_RETAIN(X) [(X).obj retain] -#else -#define GSI_ARRAY_RELEASE(X) -#define GSI_ARRAY_RETAIN(X) -#endif - -#include - -static NSComparisonResult aSort(GSIArrayItem i0, GSIArrayItem i1) -{ - return [((GSRunLoopWatcher *)(i0.obj))->_date - compare: ((GSRunLoopWatcher *)(i1.obj))->_date]; -} - - - /* * The GSRunLoopPerformer class is used to hold information about * messages which are due to be sent to objects once each runloop @@ -312,6 +293,830 @@ static NSComparisonResult aSort(GSIArrayItem i0, GSIArrayItem i1) } @end + + +/* + * Setup for inline operation of arrays. + */ + +#define GSI_ARRAY_TYPES GSUNION_OBJ + +#if GS_WITH_GC == 0 +#define GSI_ARRAY_RELEASE(X) [(X).obj release] +#define GSI_ARRAY_RETAIN(X) [(X).obj retain] +#else +#define GSI_ARRAY_RELEASE(X) +#define GSI_ARRAY_RETAIN(X) +#endif + +#include + +static NSComparisonResult aSort(GSIArrayItem i0, GSIArrayItem i1) +{ + return [((GSRunLoopWatcher *)(i0.obj))->_date + compare: ((GSRunLoopWatcher *)(i1.obj))->_date]; +} + +#if GS_WITH_GC == 0 +static SEL wRelSel; +static SEL wRetSel; +static IMP wRelImp; +static IMP wRetImp; + +static void +wRelease(void* t, id w) +{ + (*wRelImp)(w, wRelSel); +} + +static id +wRetain(void* t, id w) +{ + return (*wRetImp)(w, wRetSel); +} + +const NSMapTableValueCallBacks WatcherMapValueCallBacks = +{ + (NSMT_retain_func_t) wRetain, + (NSMT_release_func_t) wRelease, + (NSMT_describe_func_t) 0 +}; +#else +#define WatcherMapValueCallBacks NSOwnedPointerMapValueCallBacks +#endif + +static void* +aRetain(void* t, GSIArray a) +{ + return t; +} + +static void +aRelease(void* t, GSIArray a) +{ + GSIArrayEmpty(a); + NSZoneFree(a->zone, (void*)a); +} + +const NSMapTableValueCallBacks ArrayMapValueCallBacks = +{ + (NSMT_retain_func_t) aRetain, + (NSMT_release_func_t) aRelease, + (NSMT_describe_func_t) 0 +}; + + + +/** + * The GSRunLoopCtxt stores context information to handle polling for + * events. This information is associated with a particular runloop + * mode, and persists throughout the life of the runloop instance. + */ +@interface GSRunLoopCtxt : NSObject +{ +@public + GSIArray performers; /** The actions to perform regularly. */ + GSIArray timers; /** The timers set for the runloop mode */ + GSIArray watchers; /** The inputs set for the runloop mode */ +@private + NSMapTable *_efdMap; + NSMapTable *_rfdMap; + NSMapTable *_wfdMap; + int fdStart; // For trying to ensure fair handling. + BOOL completed; // To mark operation as completed. +#if HAVE_POLL + int pollfds_capacity; + int pollfds_count; + struct pollfd *pollfds; + int fd_limit; + short *fd_pollfds; +#endif +} +- (void) endPoll; +- (BOOL) pollUntil: (int)milliseconds forMode: (NSString*)mode; +@end + +@implementation GSRunLoopCtxt +- (void) dealloc +{ + GSIArrayEmpty(performers); + NSZoneFree(performers->zone, (void*)performers); + GSIArrayEmpty(timers); + NSZoneFree(timers->zone, (void*)timers); + GSIArrayEmpty(watchers); + NSZoneFree(watchers->zone, (void*)watchers); + NSFreeMapTable(_efdMap); + NSFreeMapTable(_rfdMap); + NSFreeMapTable(_wfdMap); +#if HAVE_POLL + if (pollfds != 0) + { + objc_free(pollfds); + } + if (fd_pollfds != 0) + { + objc_free(fd_pollfds); + } +#endif + [super dealloc]; +} + +/** + * Mark this poll conext as having completed, so that if we are + * executing a re-entrant poll, the enclosing poll operations + * know they can stop what they are doing because an inner + * operation has done the job. + */ +- (void) endPoll +{ + completed = YES; +} + +- (id) init +{ + self = [super init]; + if (self != nil) + { + NSZone *z = [self zone]; + + performers = NSZoneMalloc(z, sizeof(GSIArray_t)); + GSIArrayInitWithZoneAndCapacity(performers, z, 8); + timers = NSZoneMalloc(z, sizeof(GSIArray_t)); + GSIArrayInitWithZoneAndCapacity(timers, z, 8); + watchers = NSZoneMalloc(z, sizeof(GSIArray_t)); + GSIArrayInitWithZoneAndCapacity(watchers, z, 8); + + _efdMap = NSCreateMapTable (NSIntMapKeyCallBacks, + WatcherMapValueCallBacks, 0); + _rfdMap = NSCreateMapTable (NSIntMapKeyCallBacks, + WatcherMapValueCallBacks, 0); + _wfdMap = NSCreateMapTable (NSIntMapKeyCallBacks, + WatcherMapValueCallBacks, 0); + } + return self; +} + +#if HAVE_POLL + +static void setPollfd(int fd, int event, + int *pollfds_capacity_inout, + int *pollfds_count_inout, + struct pollfd **pollfds_inout, + short **fd_pollfds, + int *fd_limit) +{ + int index; + struct pollfd *pollfds = *pollfds_inout; + + if (fd >= *fd_limit) + { + int oldfd_limit = *fd_limit; + + *fd_limit = fd + 1; + if (*fd_pollfds == 0) + { + *fd_pollfds = objc_malloc(*fd_limit * sizeof (**fd_pollfds)); + } + else + { + *fd_pollfds = + objc_realloc(*fd_pollfds, *fd_limit * sizeof (**fd_pollfds)); + } + do + { + (*fd_pollfds)[oldfd_limit++] = -1; + } + while (oldfd_limit < *fd_limit); + } + index = (*fd_pollfds)[fd]; + if (index == -1) + { + if (*pollfds_count_inout >= *pollfds_capacity_inout) + { + (*pollfds_capacity_inout) += 8; + pollfds = + objc_realloc(pollfds, *pollfds_capacity_inout * sizeof (*pollfds)); + *pollfds_inout = pollfds; + } + index = (*pollfds_count_inout)++; + (*fd_pollfds)[fd] = index; + pollfds[index].fd = fd; + pollfds[index].events = 0; + pollfds[index].revents = 0; + } + pollfds[index].events |= event; +} + +- (BOOL) pollUntil: (int)milliseconds forMode: (NSString*)mode +{ + int poll_return; + int fdIndex; + int fdFinish; + unsigned i; + int num_inputs = 0; /* Number of descriptors being monitored. */ + int end_inputs = 0; /* Highest numbered descriptor plus one. */ + + i = GSIArrayCount(watchers); + if (i == 0) + { + return NO; + } + + /* + * Get ready to listen to file descriptors. + * The maps will not have been emptied by any previous call. + */ + NSResetMapTable(_efdMap); + NSResetMapTable(_rfdMap); + NSResetMapTable(_wfdMap); + + /* + * Do the pre-listening set-up for the file descriptors of this mode. + */ + if (pollfds_capacity < i + 1) + { + pollfds_capacity = i + 1; + if (pollfds == 0) + { + pollfds = objc_malloc(pollfds_capacity * sizeof(*pollfds)); + } + else + { + pollfds = objc_realloc(pollfds, pollfds_capacity * sizeof(*pollfds)); + } + } + pollfds_count = 0; + fd_limit = 0; + end_inputs = 0; + + while (i-- > 0) + { + GSRunLoopWatcher *info; + int fd; + + info = GSIArrayItemAtIndex(watchers, i).obj; + if (info->_invalidated == YES) + { + GSIArrayRemoveItemAtIndex(watchers, i); + continue; + } + + switch (info->type) + { + case ET_EDESC: + fd = (int)info->data; + if (fd > end_inputs) + end_inputs = fd; + setPollfd(fd, POLLERR, &pollfds_capacity, + &pollfds_count, &pollfds, &fd_pollfds, &fd_limit); + NSMapInsert(_efdMap, (void*)fd, info); + num_inputs++; + break; + + case ET_RDESC: + fd = (int)info->data; + if (fd > end_inputs) + end_inputs = fd; + setPollfd(fd, POLLIN, &pollfds_capacity, + &pollfds_count, &pollfds, &fd_pollfds, &fd_limit); + NSMapInsert(_rfdMap, (void*)fd, info); + num_inputs++; + break; + + case ET_WDESC: + fd = (int)info->data; + if (fd > end_inputs) + end_inputs = fd; + setPollfd(fd, POLLOUT, &pollfds_capacity, + &pollfds_count, &pollfds, &fd_pollfds, &fd_limit); + NSMapInsert(_wfdMap, (void*)fd, info); + num_inputs++; + break; + + case ET_RPORT: + if ([info->receiver isValid] == NO) + { + /* + * We must remove an invalidated port. + */ + info->_invalidated = YES; + GSIArrayRemoveItemAtIndex(watchers, i); + } + else + { + id port = info->receiver; + int port_fd_count = 128; // FIXME + int port_fd_array[port_fd_count]; + + if ([port respondsToSelector: + @selector(getFds:count:)]) + { + [port getFds: port_fd_array + count: &port_fd_count]; + } + if (debug_run_loop) + { + printf("\tNSRunLoop listening to %d sckts\n", + port_fd_count); + } + while (port_fd_count--) + { + fd = port_fd_array[port_fd_count]; + setPollfd(fd, POLLIN, &pollfds_capacity, + &pollfds_count, &pollfds, + &fd_pollfds, &fd_limit); + if (fd > end_inputs) + { + end_inputs = fd; + } + NSMapInsert(_rfdMap, + (void*)port_fd_array[port_fd_count], info); + num_inputs++; + } + } + break; + } + } + end_inputs++; + + /* + * If there are notifications in the 'idle' queue, we try an + * instantaneous select so that, if there is no input pending, + * we can service the queue. Similarly, if a task has completed, + * we need to deliver it's notifications. + */ + if (GSCheckTasks() || GSNotifyMore()) + { + milliseconds = 0; + } + +if (0) { + int i; + fprintf(stderr, "poll %d %d:", milliseconds, pollfds_count); + for (i = 0; i < pollfds_count; i++) + fprintf(stderr, " %d,%x", pollfds[i].fd, pollfds[i].events); + fprintf(stderr, "\n"); +} + poll_return = poll (pollfds, pollfds_count, milliseconds); +if (0) { + int i; + fprintf(stderr, "ret %d %d:", poll_return, pollfds_count); + for (i = 0; i < pollfds_count; i++) + fprintf(stderr, " %d,%x", pollfds[i].fd, pollfds[i].revents); + fprintf(stderr, "\n"); +} + + if (debug_run_loop) + { + printf ("\tNSRunLoop poll returned %d\n", poll_return); + } + + if (poll_return < 0) + { + if (errno == EINTR) + { + GSCheckTasks(); + poll_return = 0; + } +#ifdef __MINGW__ + else if (errno == 0) + { + /* MinGW often returns an errno == 0. Not sure why */ + poll_return = 0; + } +#endif + else + { + /* Some exceptional condition happened. */ + /* xxx We can do something with exception_fds, instead of + aborting here. */ + NSLog (@"poll() error in -acceptInputForMode:beforeDate: '%s'", + GSLastErrorStr(errno)); + abort (); + } + } + + if (poll_return == 0) + { + return NO; + } + + /* + * Look at all the file descriptors select() says are ready for action; + * notify the corresponding object for each of the ready fd's. + * NB. It is possible for a watcher to be missing from the map - if + * the event handler of a previous watcher has 'run' the loop again + * before returning. + * NB. Each time this loop is entered, the starting position (fdStart) + * is incremented - this is to ensure a fair distribion over all + * inputs where multiple inputs are in use. Note - fdStart can be + * modified while we are in the loop (by recursive calls). + */ + if (fdStart >= end_inputs) + { + fdStart = 0; + fdIndex = 0; + fdFinish = 0; + } + else + { + fdStart++; + fdIndex = fdStart; + fdFinish = fdStart; + } + completed = NO; + while (completed == NO) + { + if (pollfds[fdIndex].revents != 0) + { + int fd = pollfds[fdIndex].fd; + GSRunLoopWatcher *watcher; + BOOL found = NO; + + if (pollfds[fdIndex].revents & (POLLERR | POLLHUP | POLLNVAL)) + { + watcher = (GSRunLoopWatcher*)NSMapGet(_efdMap, + (void*)fd); + if (watcher != nil && watcher->_invalidated == NO) + { + /* + * The watcher is still valid - so call it's + * receivers event handling method. + */ + (*watcher->handleEvent)(watcher->receiver, + eventSel, watcher->data, watcher->type, + (void*)(gsaddr)fd, mode); + } + GSNotifyASAP(); + if (completed == YES) + { + break; // A nested poll has done the job. + } + found = YES; + } + if (pollfds[fdIndex].revents & POLLOUT) + { + watcher = (GSRunLoopWatcher*)NSMapGet(_wfdMap, + (void*)fd); + if (watcher != nil && watcher->_invalidated == NO) + { + /* + * The watcher is still valid - so call it's + * receivers event handling method. + */ + (*watcher->handleEvent)(watcher->receiver, + eventSel, watcher->data, watcher->type, + (void*)(gsaddr)fd, mode); + } + GSNotifyASAP(); + if (completed == YES) + { + break; // A nested poll has done the job. + } + found = YES; + } + if (pollfds[fdIndex].revents & POLLIN) + { + watcher = (GSRunLoopWatcher*)NSMapGet(_rfdMap, + (void*)fd); + if (watcher != nil && watcher->_invalidated == NO) + { + /* + * The watcher is still valid - so call it's + * receivers event handling method. + */ + (*watcher->handleEvent)(watcher->receiver, + eventSel, watcher->data, watcher->type, + (void*)(gsaddr)fd, mode); + } + GSNotifyASAP(); + if (completed == YES) + { + break; // A nested poll has done the job. + } + found = YES; + } + if (found == YES && --poll_return == 0) + { + completed = YES; + } + } + if (++fdIndex >= end_inputs) + { + fdIndex = 0; + } + if (fdIndex == fdFinish) + { + completed = YES; + } + } + completed = YES; + return YES; +} + +#else + +- (BOOL) pollUntil: (int)milliseconds forMode: (NSString*)mode +{ + struct timeval timeout; + void *select_timeout; + fd_set read_fds; /* Copy for listening to read-ready fds. */ + fd_set exception_fds; /* Copy for listening to exception fds. */ + fd_set write_fds; /* Copy for listening for write-ready fds. */ + int select_return; + int fdIndex; + int fdFinish; + int num_inputs = 0; /* Number of descriptors being monitored. */ + int end_inputs = 0; /* Highest numbered descriptor plus one. */ + unsigned i; + + i = GSIArrayCount(watchers); + if (i == 0) + { + return NO; + } + + /* Find out how much time we should wait, and set SELECT_TIMEOUT. */ + if (milliseconds == 0) + { + /* Don't wait at all. */ + timeout.tv_sec = 0; + timeout.tv_usec = 0; + select_timeout = &timeout; + } + else if (milliseconds > 0) + { + timeout.tv_sec = milliseconds/1000; + timeout.tv_usec = (milliseconds - 1000 * timeout.tv_sec) * 1000; + select_timeout = &timeout; + } + else + { + select_timeout = NULL; + } + + /* + * Get ready to listen to file descriptors. + * Initialize the set of FDS we'll pass to select(), and make sure we + * have empty maps for keeping track of which watcher is associated + * with which file descriptor. + * The maps may not have been emptied if a previous call to this + * method was terminated by an exception. + */ + memset(&exception_fds, '\0', sizeof(exception_fds)); + memset(&read_fds, '\0', sizeof(read_fds)); + memset(&write_fds, '\0', sizeof(write_fds)); + NSResetMapTable(_efdMap); + NSResetMapTable(_rfdMap); + NSResetMapTable(_wfdMap); + + while (i-- > 0) + { + GSRunLoopWatcher *info; + int fd; + + info = GSIArrayItemAtIndex(watchers, i).obj; + if (info->_invalidated == YES) + { + GSIArrayRemoveItemAtIndex(watchers, i); + continue; + } + switch (info->type) + { + case ET_EDESC: + fd = (int)info->data; + if (fd > end_inputs) + end_inputs = fd; + FD_SET (fd, &exception_fds); + NSMapInsert(_efdMap, (void*)fd, info); + num_inputs++; + break; + + case ET_RDESC: + fd = (int)info->data; + if (fd > end_inputs) + end_inputs = fd; + FD_SET (fd, &read_fds); + NSMapInsert(_rfdMap, (void*)fd, info); + num_inputs++; + break; + + case ET_WDESC: + fd = (int)info->data; + if (fd > end_inputs) + end_inputs = fd; + FD_SET (fd, &write_fds); + NSMapInsert(_wfdMap, (void*)fd, info); + num_inputs++; + break; + + case ET_RPORT: + if ([info->receiver isValid] == NO) + { + /* + * We must remove an invalidated port. + */ + info->_invalidated = YES; + GSIArrayRemoveItemAtIndex(watchers, i); + } + else + { + id port = info->receiver; + int port_fd_count = 128; // xxx #define this constant + int port_fd_array[port_fd_count]; + + if ([port respondsToSelector: + @selector(getFds:count:)]) + { + [port getFds: port_fd_array + count: &port_fd_count]; + } + if (debug_run_loop) + { + printf("\tNSRunLoop listening to %d sockets\n", + port_fd_count); + } + while (port_fd_count--) + { + fd = port_fd_array[port_fd_count]; + FD_SET (port_fd_array[port_fd_count], &read_fds); + if (fd > end_inputs) + { + end_inputs = fd; + } + NSMapInsert(_rfdMap, + (void*)port_fd_array[port_fd_count], info); + num_inputs++; + } + } + break; + } + } + end_inputs++; + + /* + * If there are notifications in the 'idle' queue, we try an + * instantaneous select so that, if there is no input pending, + * we can service the queue. Similarly, if a task has completed, + * we need to deliver it's notifications. + */ + if (GSCheckTasks() || GSNotifyMore()) + { + timeout.tv_sec = 0; + timeout.tv_usec = 0; + select_timeout = &timeout; + } + select_return = select (end_inputs, &read_fds, &write_fds, + &exception_fds, select_timeout); + + if (debug_run_loop) + { + printf ("\tNSRunLoop select returned %d\n", select_return); + } + + if (select_return < 0) + { + if (errno == EINTR) + { + GSCheckTasks(); + select_return = 0; + } +#ifdef __MINGW__ + else if (errno == 0) + { + /* MinGW often returns an errno == 0. Not sure why */ + select_return = 0; + } +#endif + else + { + /* Some exceptional condition happened. */ + /* xxx We can do something with exception_fds, instead of + aborting here. */ + NSLog (@"select() error in -acceptInputForMode:beforeDate: '%s'", + GSLastErrorStr(errno)); + abort (); + } + } + if (select_return == 0) + { + return NO; + } + + /* + * Look at all the file descriptors select() says are ready for action; + * notify the corresponding object for each of the ready fd's. + * NB. Each time this roop is entered, the starting position (fdStart) + * is incremented - this is to ensure a fair distribtion over all + * inputs where multiple inputs are in use. Note - fdStart can be + * modified while we are in the loop (by recursive calls). + */ + if (fdStart >= end_inputs) + { + fdStart = 0; + fdIndex = 0; + fdFinish = 0; + } + else + { + fdStart++; + fdIndex = fdStart; + fdFinish = fdStart; + } + completed = NO; + while (completed == NO) + { + BOOL found = NO; + + if (FD_ISSET (fdIndex, &exception_fds)) + { + GSRunLoopWatcher *watcher; + + watcher = (GSRunLoopWatcher*)NSMapGet(_efdMap, + (void*)fdIndex); + if (watcher != nil && watcher->_invalidated == NO) + { + /* + * The watcher is still valid - so call it's receivers + * event handling method. + */ + (*watcher->handleEvent)(watcher->receiver, + eventSel, watcher->data, watcher->type, + (void*)(gsaddr)fdIndex, mode); + } + GSNotifyASAP(); + if (completed == YES) + { + break; + } + found = YES; + } + if (FD_ISSET (fdIndex, &write_fds)) + { + GSRunLoopWatcher *watcher; + + watcher = NSMapGet(_wfdMap, (void*)fdIndex); + if (watcher != nil && watcher->_invalidated == NO) + { + /* + * The watcher is still valid - so call it's receivers + * event handling method. + */ + (*watcher->handleEvent)(watcher->receiver, + eventSel, watcher->data, watcher->type, + (void*)(gsaddr)fdIndex, mode); + } + GSNotifyASAP(); + if (completed == YES) + { + break; + } + found = YES; + } + if (FD_ISSET (fdIndex, &read_fds)) + { + GSRunLoopWatcher *watcher; + + watcher = (GSRunLoopWatcher*)NSMapGet(_rfdMap, (void*)fdIndex); + if (watcher != nil && watcher->_invalidated == NO) + { + /* + * The watcher is still valid - so call it's receivers + * event handling method. + */ + (*watcher->handleEvent)(watcher->receiver, + eventSel, watcher->data, watcher->type, + (void*)(gsaddr)fdIndex, mode); + } + GSNotifyASAP(); + if (completed == YES) + { + break; + } + found = YES; + } + if (found == YES && --select_return == 0) + { + completed = YES; + } + if (++fdIndex >= end_inputs) + { + fdIndex = 0; + } + if (fdIndex == fdFinish) + { + completed = YES; + } + } + completed = YES; + return YES; +} + +#endif +@end + + + @implementation NSObject (TimedPerformers) + (void) cancelPreviousPerformRequestsWithTarget: (id)target @@ -395,7 +1200,7 @@ static NSComparisonResult aSort(GSIArrayItem i0, GSIArrayItem i1) - (void) _addWatcher: (GSRunLoopWatcher*)item forMode: (NSString*)mode; -- (void) _checkPerformers; +- (void) _checkPerformers: (GSRunLoopCtxt*)context; - (GSRunLoopWatcher*) _getWatcher: (void*)data type: (RunLoopEventType)type forMode: (NSString*)mode; @@ -411,18 +1216,18 @@ static NSComparisonResult aSort(GSIArrayItem i0, GSIArrayItem i1) limit-date order. */ - (void) _addWatcher: (GSRunLoopWatcher*) item forMode: (NSString*)mode { + GSRunLoopCtxt *context; GSIArray watchers; id obj; - watchers = NSMapGet(_mode_2_watchers, mode); - if (watchers == 0) + context = NSMapGet(_mode_2_context, mode); + if (context == nil) { - NSZone *z = [self zone]; - - watchers = NSZoneMalloc(z, sizeof(GSIArray_t)); - GSIArrayInitWithZoneAndCapacity(watchers, z, 8); - NSMapInsert(_mode_2_watchers, mode, watchers); + context = [GSRunLoopCtxt new]; + NSMapInsert(_mode_2_context, mode, context); + RELEASE(context); } + watchers = context->watchers; /* * If the receiver or its delegate (if any) respond to @@ -453,57 +1258,65 @@ static NSComparisonResult aSort(GSIArrayItem i0, GSIArrayItem i1) GSIArrayInsertSorted(watchers, (GSIArrayItem)item, aSort); } -- (void) _checkPerformers +- (void) _checkPerformers: (GSRunLoopCtxt*)context { - GSIArray performers = NSMapGet(_mode_2_performers, _current_mode); - unsigned count; - - if (performers != 0 && (count = GSIArrayCount(performers)) > 0) + if (context != nil) { - GSRunLoopPerformer *array[count]; - NSMapEnumerator enumerator; - GSIArray tmp; - void *mode; - unsigned i; + GSIArray performers = context->performers; + unsigned count = GSIArrayCount(performers); - /* - * Copy the array - because we have to cancel the requests before firing. - */ - for (i = 0; i < count; i++) + if (count > 0) { - array[i] = RETAIN(GSIArrayItemAtIndex(performers, i).obj); - } + GSRunLoopPerformer *array[count]; + NSMapEnumerator enumerator; + GSRunLoopCtxt *context; + void *mode; + unsigned i; - /* - * Remove the requests that we are about to fire from all modes. - */ - enumerator = NSEnumerateMapTable(_mode_2_performers); - while (NSNextMapEnumeratorPair(&enumerator, &mode, (void**)&tmp)) - { - unsigned tmpCount = GSIArrayCount(tmp); - - while (tmpCount--) + /* + * Copy the array - because we have to cancel the requests + * before firing. + */ + for (i = 0; i < count; i++) { - GSRunLoopPerformer *p; + array[i] = RETAIN(GSIArrayItemAtIndex(performers, i).obj); + } - p = GSIArrayItemAtIndex(tmp, tmpCount).obj; - for (i = 0; i < count; i++) + /* + * Remove the requests that we are about to fire from all modes. + */ + enumerator = NSEnumerateMapTable(_mode_2_context); + while (NSNextMapEnumeratorPair(&enumerator, &mode, (void**)&context)) + { + if (context != nil) { - if (p == array[i]) + GSIArray performers = context->performers; + unsigned tmpCount = GSIArrayCount(performers); + + while (tmpCount--) { - GSIArrayRemoveItemAtIndex(tmp, tmpCount); + GSRunLoopPerformer *p; + + p = GSIArrayItemAtIndex(performers, tmpCount).obj; + for (i = 0; i < count; i++) + { + if (p == array[i]) + { + GSIArrayRemoveItemAtIndex(performers, tmpCount); + } + } } } } - } - /* - * Finally, fire the requests. - */ - for (i = 0; i < count; i++) - { - [array[i] fire]; - RELEASE(array[i]); + /* + * Finally, fire the requests. + */ + for (i = 0; i < count; i++) + { + [array[i] fire]; + RELEASE(array[i]); + } } } } @@ -517,7 +1330,7 @@ static NSComparisonResult aSort(GSIArrayItem i0, GSIArrayItem i1) type: (RunLoopEventType)type forMode: (NSString*)mode { - GSIArray watchers; + GSRunLoopCtxt *context; if (mode == nil) { @@ -528,10 +1341,11 @@ static NSComparisonResult aSort(GSIArrayItem i0, GSIArrayItem i1) } } - watchers = NSMapGet(_mode_2_watchers, mode); - if (watchers) + context = NSMapGet(_mode_2_context, mode); + if (context != nil) { - unsigned i = GSIArrayCount(watchers); + GSIArray watchers = context->watchers; + unsigned i = GSIArrayCount(watchers); while (i-- > 0) { @@ -556,7 +1370,7 @@ static NSComparisonResult aSort(GSIArrayItem i0, GSIArrayItem i1) type: (RunLoopEventType)type forMode: (NSString*)mode { - GSIArray watchers; + GSRunLoopCtxt *context; if (mode == nil) { @@ -567,9 +1381,10 @@ static NSComparisonResult aSort(GSIArrayItem i0, GSIArrayItem i1) } } - watchers = NSMapGet(_mode_2_watchers, mode); - if (watchers) + context = NSMapGet(_mode_2_context, mode); + if (context != nil) { + GSIArray watchers = context->watchers; unsigned i = GSIArrayCount(watchers); while (i-- > 0) @@ -591,21 +1406,6 @@ static NSComparisonResult aSort(GSIArrayItem i0, GSIArrayItem i1) @implementation NSRunLoop(GNUstepExtensions) -+ (id) currentInstance -{ - return [self currentRunLoop]; -} - -+ (NSString*) currentMode -{ - return [[self currentRunLoop] currentMode]; -} - -+ (void) run -{ - [[self currentRunLoop] run]; -} - /** * Adds a runloop watcher matching the specified data and type in this * runloop. If the mode is nil, either the currentMode is used (if the @@ -693,108 +1493,12 @@ static NSComparisonResult aSort(GSIArrayItem i0, GSIArrayItem i1) } } -/* Running the run loop once through for timers and input listening. */ - -- (BOOL) runOnceBeforeDate: (NSDate*)date forMode: (NSString*)mode -{ - return [self runMode: mode beforeDate: date]; -} - -- (BOOL) runOnceBeforeDate: (NSDate*)date -{ - return [self runOnceBeforeDate: date forMode: _current_mode]; -} - -- (void) runUntilDate: (NSDate*)date forMode: (NSString*)mode -{ - double ti = [date timeIntervalSinceNow]; - BOOL mayDoMore = YES; - - /* Positive values are in the future. */ - while (ti > 0 && mayDoMore == YES) - { - if (debug_run_loop) - printf ("\tNSRunLoop run until date %f seconds from now\n", ti); - mayDoMore = [self runMode: mode beforeDate: date]; - ti = [date timeIntervalSinceNow]; - } -} - -+ (void) runUntilDate: (NSDate*)date forMode: (NSString*)mode -{ - [[self currentRunLoop] runUntilDate: date forMode: mode]; -} - -+ (void) runUntilDate: (NSDate*)date -{ - [[self currentRunLoop] runUntilDate: date]; -} - -+ (BOOL) runOnceBeforeDate: (NSDate*)date forMode: (NSString*)mode -{ - return [[self currentRunLoop] runOnceBeforeDate: date forMode: mode]; -} - -+ (BOOL) runOnceBeforeDate: (NSDate*)date -{ - return [[self currentRunLoop] runOnceBeforeDate: date]; -} - @end @implementation NSRunLoop -#if GS_WITH_GC == 0 -static SEL wRelSel; -static SEL wRetSel; -static IMP wRelImp; -static IMP wRetImp; - -static void -wRelease(void* t, id w) -{ - (*wRelImp)(w, wRelSel); -} - -static id -wRetain(void* t, id w) -{ - return (*wRetImp)(w, wRetSel); -} - -const NSMapTableValueCallBacks WatcherMapValueCallBacks = -{ - (NSMT_retain_func_t) wRetain, - (NSMT_release_func_t) wRelease, - (NSMT_describe_func_t) 0 -}; -#else -#define WatcherMapValueCallBacks NSOwnedPointerMapValueCallBacks -#endif - -static void* -aRetain(void* t, GSIArray a) -{ - return t; -} - -static void -aRelease(void* t, GSIArray a) -{ - GSIArrayEmpty(a); - NSZoneFree(a->zone, (void*)a); -} - -const NSMapTableValueCallBacks ArrayMapValueCallBacks = -{ - (NSMT_retain_func_t) aRetain, - (NSMT_release_func_t) aRelease, - (NSMT_describe_func_t) 0 -}; - - + (void) initialize { if (self == [NSRunLoop class]) @@ -837,19 +1541,9 @@ const NSMapTableValueCallBacks ArrayMapValueCallBacks = self = [super init]; if (self != nil) { - _mode_2_timers = NSCreateMapTable (NSNonRetainedObjectMapKeyCallBacks, - ArrayMapValueCallBacks, 0); - _mode_2_watchers = NSCreateMapTable (NSObjectMapKeyCallBacks, - ArrayMapValueCallBacks, 0); - _mode_2_performers = NSCreateMapTable (NSObjectMapKeyCallBacks, - ArrayMapValueCallBacks, 0); + _mode_2_context = NSCreateMapTable (NSNonRetainedObjectMapKeyCallBacks, + NSObjectMapValueCallBacks, 0); _timedPerformers = [[NSMutableArray alloc] initWithCapacity: 8]; - _efdMap = NSCreateMapTable (NSIntMapKeyCallBacks, - WatcherMapValueCallBacks, 0); - _rfdMap = NSCreateMapTable (NSIntMapKeyCallBacks, - WatcherMapValueCallBacks, 0); - _wfdMap = NSCreateMapTable (NSIntMapKeyCallBacks, - WatcherMapValueCallBacks, 0); } return self; } @@ -857,18 +1551,13 @@ const NSMapTableValueCallBacks ArrayMapValueCallBacks = - (void) dealloc { [self gcFinalize]; - RELEASE(_timedPerformers); [super dealloc]; } - (void) gcFinalize { - NSFreeMapTable(_mode_2_timers); - NSFreeMapTable(_mode_2_watchers); - NSFreeMapTable(_mode_2_performers); - NSFreeMapTable(_efdMap); - NSFreeMapTable(_rfdMap); - NSFreeMapTable(_wfdMap); + NSFreeMapTable(_mode_2_context); + RELEASE(_timedPerformers); } /** @@ -886,17 +1575,17 @@ const NSMapTableValueCallBacks ArrayMapValueCallBacks = - (void) addTimer: (NSTimer*)timer forMode: (NSString*)mode { - GSIArray timers; + GSRunLoopCtxt *context; + GSIArray timers; - timers = NSMapGet(_mode_2_timers, mode); - if (!timers) + context = NSMapGet(_mode_2_context, mode); + if (context == nil) { - NSZone *z = [self zone]; - - timers = NSZoneMalloc(z, sizeof(GSIArray_t)); - GSIArrayInitWithZoneAndCapacity(timers, z, 8); - NSMapInsert(_mode_2_timers, mode, timers); + context = [GSRunLoopCtxt new]; + NSMapInsert(_mode_2_context, mode, context); + RELEASE(context); } + timers = context->timers; GSIArrayInsertSorted(timers, (GSIArrayItem)timer, aSort); } @@ -909,8 +1598,6 @@ const NSMapTableValueCallBacks ArrayMapValueCallBacks = { id saved_mode; NSDate *when; - GSIArray timers; - GSIArray watchers; NSTimer *min_timer = nil; GSRunLoopWatcher *min_watcher = nil; CREATE_AUTORELEASE_POOL(arp); @@ -920,9 +1607,13 @@ const NSMapTableValueCallBacks ArrayMapValueCallBacks = NS_DURING { - timers = NSMapGet(_mode_2_timers, mode); - if (timers) + GSRunLoopCtxt *context = NSMapGet(_mode_2_context, mode); + + if (context != nil) { + GSIArray timers = context->timers; + GSIArray watchers = context->watchers; + while (GSIArrayCount(timers) != 0) { min_timer = GSIArrayItemAtIndex(timers, 0).obj; @@ -953,13 +1644,9 @@ const NSMapTableValueCallBacks ArrayMapValueCallBacks = min_timer = nil; GSNotifyASAP(); /* Post notifications. */ } - } - /* Is this right? At the moment we invalidate and discard watchers - whose limit-dates have passed. */ - watchers = NSMapGet(_mode_2_watchers, mode); - if (watchers) - { + /* Is this right? At the moment we invalidate and discard watchers + whose limit-dates have passed. */ while (GSIArrayCount(watchers) != 0) { min_watcher = GSIArrayItemAtIndex(watchers, 0).obj; @@ -1082,18 +1769,10 @@ const NSMapTableValueCallBacks ArrayMapValueCallBacks = - (void) acceptInputForMode: (NSString*)mode beforeDate: (NSDate*)limit_date { - NSTimeInterval ti; - struct timeval timeout; - void *select_timeout; - fd_set read_fds; /* Copy for listening to read-ready fds. */ - fd_set exception_fds; /* Copy for listening to exception fds. */ - fd_set write_fds; /* Copy for listening for write-ready fds. */ - int select_return; - int fdIndex; - int fdEnd; - id saved_mode; - int num_inputs = 0; /* Number of descriptors being monitored. */ - int end_inputs = 0; /* Highest numbered descriptor plus one. */ + GSRunLoopCtxt *context = nil; + NSTimeInterval ti; + int timeout_ms; + id saved_mode; CREATE_AUTORELEASE_POOL(arp); NSAssert(mode, NSInvalidArgumentException); @@ -1106,13 +1785,27 @@ const NSMapTableValueCallBacks ArrayMapValueCallBacks = NS_DURING { + GSRunLoopCtxt *context = NSMapGet(_mode_2_context, mode); + GSIArray watchers; + unsigned i; + + if (context == nil || (watchers = context->watchers) == 0 + || (i = GSIArrayCount(watchers)) == 0) + { + GSCheckTasks(); + GSNotifyASAP(); + if (debug_run_loop) + printf ("\tNSRunLoop with no inputs in mode\n"); + _current_mode = saved_mode; + RELEASE(arp); + NS_VOIDRETURN; + } + /* Find out how much time we should wait, and set SELECT_TIMEOUT. */ if (!limit_date) { /* Don't wait at all. */ - timeout.tv_sec = 0; - timeout.tv_usec = 0; - select_timeout = &timeout; + timeout_ms = 0; } else if ((ti = [limit_date timeIntervalSinceNow]) < LONG_MAX && ti > 0.0) @@ -1122,16 +1815,14 @@ const NSMapTableValueCallBacks ArrayMapValueCallBacks = printf ("\tNSRunLoop accept input before %f (sec from now %f)\n", [limit_date timeIntervalSinceReferenceDate], ti); /* If LIMIT_DATE has already past, return immediately. */ - timeout.tv_sec = ti; - timeout.tv_usec = (ti - timeout.tv_sec) * 1000000.0; - select_timeout = &timeout; + timeout_ms = ti * 1000; } else if (ti <= 0.0) { /* The LIMIT_DATE has already past; return immediately without polling any inputs. */ GSCheckTasks(); - [self _checkPerformers]; + [self _checkPerformers: context]; GSNotifyASAP(); if (debug_run_loop) printf ("\tNSRunLoop limit date past, returning\n"); @@ -1144,286 +1835,25 @@ const NSMapTableValueCallBacks ArrayMapValueCallBacks = /* Wait forever. */ if (debug_run_loop) printf ("\tNSRunLoop accept input waiting forever\n"); - select_timeout = NULL; + timeout_ms = -1; } - /* - * Get ready to listen to file descriptors. - * Initialize the set of FDS we'll pass to select(), and make sure we - * have empty maps for keeping track of which watcher is associated - * with which file descriptor. - * The maps may not have been emptied if a previous call to this - * method was terminated by an exception. - */ - memset(&exception_fds, '\0', sizeof(exception_fds)); - memset(&read_fds, '\0', sizeof(read_fds)); - memset(&write_fds, '\0', sizeof(write_fds)); - NSResetMapTable(_efdMap); - NSResetMapTable(_rfdMap); - NSResetMapTable(_wfdMap); - - /* - * Do the pre-listening set-up for the file descriptors of this mode. - */ - { - GSIArray watchers; - - watchers = NSMapGet(_mode_2_watchers, mode); - if (watchers) - { - unsigned i = GSIArrayCount(watchers); - - while (i-- > 0) - { - GSRunLoopWatcher *info; - int fd; - - info = GSIArrayItemAtIndex(watchers, i).obj; - if (info->_invalidated == YES) - { - GSIArrayRemoveItemAtIndex(watchers, i); - continue; - } - switch (info->type) - { - case ET_EDESC: - fd = (int)info->data; - if (fd > end_inputs) - end_inputs = fd; - FD_SET (fd, &exception_fds); - NSMapInsert(_efdMap, (void*)fd, info); - num_inputs++; - break; - - case ET_RDESC: - fd = (int)info->data; - if (fd > end_inputs) - end_inputs = fd; - FD_SET (fd, &read_fds); - NSMapInsert(_rfdMap, (void*)fd, info); - num_inputs++; - break; - - case ET_WDESC: - fd = (int)info->data; - if (fd > end_inputs) - end_inputs = fd; - FD_SET (fd, &write_fds); - NSMapInsert(_wfdMap, (void*)fd, info); - num_inputs++; - break; - - case ET_RPORT: - if ([info->receiver isValid] == NO) - { - /* - * We must remove an invalidated port. - */ - info->_invalidated = YES; - GSIArrayRemoveItemAtIndex(watchers, i); - } - else - { - id port = info->receiver; - int port_fd_count = 128; // xxx #define this constant - int port_fd_array[port_fd_count]; - - if ([port respondsToSelector: - @selector(getFds:count:)]) - { - [port getFds: port_fd_array - count: &port_fd_count]; - } - if (debug_run_loop) - { - printf("\tNSRunLoop listening to %d sockets\n", - port_fd_count); - } - while (port_fd_count--) - { - fd = port_fd_array[port_fd_count]; - FD_SET (port_fd_array[port_fd_count], &read_fds); - if (fd > end_inputs) - { - end_inputs = fd; - } - NSMapInsert(_rfdMap, - (void*)port_fd_array[port_fd_count], info); - num_inputs++; - } - } - break; - } - } - } - } - end_inputs++; - - /* - * If there are notifications in the 'idle' queue, we try an - * instantaneous select so that, if there is no input pending, - * we can service the queue. Similarly, if a task has completed, - * we need to deliver it's notifications. - */ - if (GSCheckTasks() || GSNotifyMore()) + if ([context pollUntil: timeout_ms forMode: _current_mode] == NO) { - timeout.tv_sec = 0; - timeout.tv_usec = 0; - select_timeout = &timeout; - select_return = select (end_inputs, &read_fds, &write_fds, - &exception_fds, select_timeout); - } - else - { - select_return = select (end_inputs, &read_fds, &write_fds, - &exception_fds, select_timeout); - } - - if (debug_run_loop) - { - printf ("\tNSRunLoop select returned %d\n", select_return); - } - - if (select_return < 0) - { - if (errno == EINTR) - { - GSCheckTasks(); - select_return = 0; - } - #ifdef __MINGW__ - else if (errno == 0) - { - /* MinGW often returns an errno == 0. Not sure why */ - select_return = 0; - } - #endif - else - { - /* Some exceptional condition happened. */ - /* xxx We can do something with exception_fds, instead of - aborting here. */ - NSLog (@"select() error in -acceptInputForMode:beforeDate: '%s'", - GSLastErrorStr(errno)); - abort (); - } - } - if (select_return == 0) - { - NSResetMapTable(_efdMap); - NSResetMapTable(_rfdMap); - NSResetMapTable(_wfdMap); GSNotifyIdle(); - [self _checkPerformers]; - _current_mode = saved_mode; - RELEASE(arp); - NS_VOIDRETURN; } - - /* - * Look at all the file descriptors select() says are ready for action; - * notify the corresponding object for each of the ready fd's. - * NB. It is possible for a watcher to be missing from the map - if - * the event handler of a previous watcher has 'run' the loop again - * before returning. - * NB. Each time this roop is entered, the starting position (_fdStart) - * is incremented - this is to ensure a fair distribtion over all - * inputs where multiple inputs are in use. Note - _fdStart can be - * modified while we are in the loop (by recursive calls). - */ - if (_fdStart >= end_inputs) - { - _fdStart = 0; - fdIndex = 0; - fdEnd = 0; - } - else - { - _fdStart++; - fdIndex = _fdStart; - fdEnd = _fdStart; - } - do - { - BOOL found = NO; - - if (FD_ISSET (fdIndex, &exception_fds)) - { - GSRunLoopWatcher *watcher; - - watcher = (GSRunLoopWatcher*)NSMapGet(_efdMap, (void*)fdIndex); - if (watcher != nil && watcher->_invalidated == NO) - { - /* - * The watcher is still valid - so call it's receivers - * event handling method. - */ - (*watcher->handleEvent)(watcher->receiver, - eventSel, watcher->data, watcher->type, - (void*)(gsaddr)fdIndex, _current_mode); - } - GSNotifyASAP(); - found = YES; - } - if (FD_ISSET (fdIndex, &write_fds)) - { - GSRunLoopWatcher *watcher; - - watcher = NSMapGet(_wfdMap, (void*)fdIndex); - if (watcher != nil && watcher->_invalidated == NO) - { - /* - * The watcher is still valid - so call it's receivers - * event handling method. - */ - (*watcher->handleEvent)(watcher->receiver, - eventSel, watcher->data, watcher->type, - (void*)(gsaddr)fdIndex, _current_mode); - } - GSNotifyASAP(); - found = YES; - } - if (FD_ISSET (fdIndex, &read_fds)) - { - GSRunLoopWatcher *watcher; - - watcher = (GSRunLoopWatcher*)NSMapGet(_rfdMap, (void*)fdIndex); - if (watcher != nil && watcher->_invalidated == NO) - { - /* - * The watcher is still valid - so call it's receivers - * event handling method. - */ - (*watcher->handleEvent)(watcher->receiver, - eventSel, watcher->data, watcher->type, - (void*)(gsaddr)fdIndex, _current_mode); - } - GSNotifyASAP(); - found = YES; - } - if (found == YES && --select_return == 0) - { - break; - } - if (++fdIndex >= end_inputs) - { - fdIndex = 0; - } - } - while (fdIndex != fdEnd); - - /* Clean up before returning. */ - NSResetMapTable(_efdMap); - NSResetMapTable(_rfdMap); - NSResetMapTable(_wfdMap); - - [self _checkPerformers]; + [self _checkPerformers: context]; GSNotifyASAP(); _current_mode = saved_mode; } NS_HANDLER { _current_mode = saved_mode; + /* + * Perform any tidyup necessary for the poll operation in which + * the exception occurred. + */ + [context endPoll]; [localException raise]; } NS_ENDHANDLER @@ -1531,24 +1961,28 @@ const NSMapTableValueCallBacks ArrayMapValueCallBacks = argument: (id) argument { NSMapEnumerator enumerator; - GSIArray performers; + GSRunLoopCtxt *context; void *mode; - enumerator = NSEnumerateMapTable(_mode_2_performers); + enumerator = NSEnumerateMapTable(_mode_2_context); - while (NSNextMapEnumeratorPair(&enumerator, &mode, (void**)&performers)) + while (NSNextMapEnumeratorPair(&enumerator, &mode, (void**)&context)) { - unsigned count = GSIArrayCount(performers); - - while (count--) + if (context != nil) { - GSRunLoopPerformer *p; + GSIArray performers = context->performers; + unsigned count = GSIArrayCount(performers); - p = GSIArrayItemAtIndex(performers, count).obj; - if (p->target == target && sel_eq(p->selector, aSelector) - && p->argument == argument) + while (count--) { - GSIArrayRemoveItemAtIndex(performers, count); + GSRunLoopPerformer *p; + + p = GSIArrayItemAtIndex(performers, count).obj; + if (p->target == target && sel_eq(p->selector, aSelector) + && p->argument == argument) + { + GSIArrayRemoveItemAtIndex(performers, count); + } } } } @@ -1581,18 +2015,19 @@ const NSMapTableValueCallBacks ArrayMapValueCallBacks = while (count-- > 0) { NSString *mode = array[count]; - GSIArray performers = NSMapGet(_mode_2_performers, mode); unsigned end; unsigned i; + GSRunLoopCtxt *context; + GSIArray performers; - if (performers == 0) + context = NSMapGet(_mode_2_context, mode); + if (context == nil) { - NSZone *z = [self zone]; - - performers = NSZoneMalloc(z, sizeof(GSIArray_t)); - GSIArrayInitWithZoneAndCapacity(performers, z, 8); - NSMapInsert(_mode_2_performers, mode, performers); + context = [GSRunLoopCtxt new]; + NSMapInsert(_mode_2_context, mode, context); + RELEASE(context); } + performers = context->performers; end = GSIArrayCount(performers); for (i = 0; i < end; i++) diff --git a/configure b/configure index 3115b9d66..530ac8fe1 100755 --- a/configure +++ b/configure @@ -3097,9 +3097,9 @@ done #-------------------------------------------------------------------- -# Check for pthread.h (only when building on Darwin machines) +# These headers/functions needed by NSRunLoop.m #-------------------------------------------------------------------- -for ac_hdr in pthread.h +for ac_hdr in poll.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 @@ -3139,24 +3139,15 @@ else fi done -HAVE_PTHREAD_H=no -if test $ac_cv_header_pthread_h = yes ; then - HAVE_PTHREAD_H=yes -fi - - -#-------------------------------------------------------------------- -# This function needed by StdioStream.m -#-------------------------------------------------------------------- -for ac_func in vsprintf vasprintf +for ac_func in poll do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3155: checking for $ac_func" >&5 +echo "configure:3146: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3174: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + + + +#-------------------------------------------------------------------- +# Check for pthread.h (only when building on Darwin machines) +#-------------------------------------------------------------------- +for ac_hdr in pthread.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:3207: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:3217: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + +HAVE_PTHREAD_H=no +if test $ac_cv_header_pthread_h = yes ; then + HAVE_PTHREAD_H=yes +fi + + +#-------------------------------------------------------------------- +# This function needed by StdioStream.m +#-------------------------------------------------------------------- +for ac_func in vsprintf vasprintf +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:3255: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:3283: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3208,11 +3308,11 @@ if test $ac_cv_func_vsprintf = yes ; then VSPRINTF_RETURNS_LENGTH=1 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3316: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then VSPRINTF_RETURNS_LENGTH=1 else @@ -3234,11 +3334,11 @@ if test $ac_cv_func_vasprintf = yes ; then VASPRINTF_RETURNS_LENGTH=1 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3342: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then VASPRINTF_RETURNS_LENGTH=1 else @@ -3262,12 +3362,12 @@ fi for ac_func in getcwd do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3266: checking for $ac_func" >&5 +echo "configure:3366: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3394: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3319,12 +3419,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:3323: checking for $ac_hdr that defines DIR" >&5 +echo "configure:3423: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_hdr> @@ -3332,7 +3432,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:3336: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3436: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -3357,7 +3457,7 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:3361: checking for opendir in -ldir" >&5 +echo "configure:3461: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3365,7 +3465,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3480: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3398,7 +3498,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:3402: checking for opendir in -lx" >&5 +echo "configure:3502: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3406,7 +3506,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3521: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3447,17 +3547,17 @@ for ac_hdr in getopt.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3451: checking for $ac_hdr" >&5 +echo "configure:3551: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3461: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3561: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3490,12 +3590,12 @@ done for ac_func in valloc do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3494: checking for $ac_func" >&5 +echo "configure:3594: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3622: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3549,12 +3649,12 @@ done for ac_func in times do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3553: checking for $ac_func" >&5 +echo "configure:3653: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3681: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3608,12 +3708,12 @@ done for ac_func in mkstemp do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3612: checking for $ac_func" >&5 +echo "configure:3712: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3740: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3663,12 +3763,12 @@ done for ac_func in shmctl do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3667: checking for $ac_func" >&5 +echo "configure:3767: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3795: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3718,12 +3818,12 @@ done for ac_func in mmap do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3722: checking for $ac_func" >&5 +echo "configure:3822: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3850: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3777,12 +3877,12 @@ done for ac_func in inet_aton do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3781: checking for $ac_func" >&5 +echo "configure:3881: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3909: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3834,17 +3934,17 @@ for ac_hdr in zlib.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3838: checking for $ac_hdr" >&5 +echo "configure:3938: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3848: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3948: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3872,7 +3972,7 @@ done if test $ac_cv_header_zlib_h = yes; then echo $ac_n "checking for gzseek in -lz""... $ac_c" 1>&6 -echo "configure:3876: checking for gzseek in -lz" >&5 +echo "configure:3976: checking for gzseek in -lz" >&5 ac_lib_var=`echo z'_'gzseek | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3880,7 +3980,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lz $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3995: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3926,12 +4026,12 @@ fi for ac_func in killpg setpgrp setpgid do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3930: checking for $ac_func" >&5 +echo "configure:4030: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4058: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3979,7 +4079,7 @@ fi done echo $ac_n "checking whether setpgrp takes no argument""... $ac_c" 1>&6 -echo "configure:3983: checking whether setpgrp takes no argument" >&5 +echo "configure:4083: checking whether setpgrp takes no argument" >&5 if eval "test \"`echo '$''{'ac_cv_func_setpgrp_void'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3987,7 +4087,7 @@ else { echo "configure: error: cannot check setpgrp if cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4111: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_setpgrp_void=no else @@ -4047,17 +4147,17 @@ for ac_hdr in libc.h limits.h malloc.h memory.h string.h signal.h sys/signal.h s do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4051: checking for $ac_hdr" >&5 +echo "configure:4151: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4061: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4161: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4090,12 +4190,12 @@ done for ac_func in usleep do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4094: checking for $ac_func" >&5 +echo "configure:4194: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4222: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4149,12 +4249,12 @@ done for ac_func in strerror do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4153: checking for $ac_func" >&5 +echo "configure:4253: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4281: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4206,9 +4306,9 @@ done # This type needed by GSFormat #-------------------------------------------------------------------- echo $ac_n "checking whether stdint.h or inttypes.h defines uintmax_t""... $ac_c" 1>&6 -echo "configure:4210: checking whether stdint.h or inttypes.h defines uintmax_t" >&5 +echo "configure:4310: checking whether stdint.h or inttypes.h defines uintmax_t" >&5 cat > conftest.$ac_ext < @@ -4220,7 +4320,7 @@ int main() { int i = sizeof(uintmax_t); ; return 0; } EOF -if { (eval echo configure:4224: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4324: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* uintmax_t=1 else @@ -4241,9 +4341,9 @@ else fi echo $ac_n "checking whether precompiler handles LONG_LONG_MAX""... $ac_c" 1>&6 -echo "configure:4245: checking whether precompiler handles LONG_LONG_MAX" >&5 +echo "configure:4345: checking whether precompiler handles LONG_LONG_MAX" >&5 cat > conftest.$ac_ext < @@ -4259,7 +4359,7 @@ cat > conftest.$ac_ext <&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4363: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4286,10 +4386,10 @@ fi # Solaris and *BSD use LLONG_MAX instead # echo $ac_n "checking whether we have LLONG_MAX""... $ac_c" 1>&6 -echo "configure:4290: checking whether we have LLONG_MAX" >&5 +echo "configure:4390: checking whether we have LLONG_MAX" >&5 cat > conftest.$ac_ext < #if defined(LLONG_MAX) @@ -4302,7 +4402,7 @@ cat > conftest.$ac_ext <&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4406: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4329,17 +4429,17 @@ for ac_hdr in wchar.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4333: checking for $ac_hdr" >&5 +echo "configure:4433: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4343: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4443: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4370,12 +4470,12 @@ done # This function needed by NSString for handling of %@ printf directive. #-------------------------------------------------------------------- echo $ac_n "checking for register_printf_function""... $ac_c" 1>&6 -echo "configure:4374: checking for register_printf_function" >&5 +echo "configure:4474: checking for register_printf_function" >&5 if eval "test \"`echo '$''{'ac_cv_func_register_printf_function'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4502: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_register_printf_function=yes" else @@ -4423,11 +4523,11 @@ if test $register_printf = 1; then working_register_printf=1 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4531: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then working_register_printf=1 else @@ -4453,12 +4553,12 @@ fi for ac_func in realpath do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4457: checking for $ac_func" >&5 +echo "configure:4557: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4585: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4511,7 +4611,7 @@ done # Used in critical cases by NSProcessInfo.m #-------------------------------------------------------------------- echo $ac_n "checking program_invocation_name in C Library""... $ac_c" 1>&6 -echo "configure:4515: checking program_invocation_name in C Library" >&5 +echo "configure:4615: checking program_invocation_name in C Library" >&5 if eval "test \"`echo '$''{'program_invocation_name_worked'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4519,7 +4619,7 @@ else program_invocation_name_worked=no else cat > conftest.$ac_ext < @@ -4531,7 +4631,7 @@ main (int argc, char *argv[]) } EOF -if { (eval echo configure:4535: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4635: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then program_invocation_name_worked=yes else @@ -4569,7 +4669,7 @@ fi echo $ac_n "checking kernel support for /proc filesystem""... $ac_c" 1>&6 -echo "configure:4573: checking kernel support for /proc filesystem" >&5 +echo "configure:4673: checking kernel support for /proc filesystem" >&5 if eval "test \"`echo '$''{'ac_cv_sys_procfs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4606,7 +4706,7 @@ EOF echo $ac_n "checking link to exe of process in /proc""... $ac_c" 1>&6 -echo "configure:4610: checking link to exe of process in /proc" >&5 +echo "configure:4710: checking link to exe of process in /proc" >&5 if eval "test \"`echo '$''{'ac_cv_sys_procfs_exe_link'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4639,16 +4739,16 @@ EOF # Check if /proc/$$/cmdline terminates the last argument with a nul #-------------------------------------------------------------------- echo $ac_n "checking /proc/$$/cmdline terminated by nul""... $ac_c" 1>&6 -echo "configure:4643: checking /proc/$$/cmdline terminated by nul" >&5 +echo "configure:4743: checking /proc/$$/cmdline terminated by nul" >&5 if test "$cross_compiling" = yes; then CMDLINE_TERMINATED=0 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4752: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then CMDLINE_TERMINATED=1 else @@ -4674,16 +4774,16 @@ fi # Check if short and int values need to be word aligned #-------------------------------------------------------------------- echo $ac_n "checking short/int needs to be word aligned""... $ac_c" 1>&6 -echo "configure:4678: checking short/int needs to be word aligned" >&5 +echo "configure:4778: checking short/int needs to be word aligned" >&5 if test "$cross_compiling" = yes; then NEED_WORD_ALIGNMENT=1 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4787: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then NEED_WORD_ALIGNMENT=0 else @@ -4711,7 +4811,7 @@ fi # doesn't work. Allow NSProcessInfo initialization method also. #-------------------------------------------------------------------- echo $ac_n "checking "use of pass-through arguments"""... $ac_c" 1>&6 -echo "configure:4715: checking "use of pass-through arguments"" >&5 +echo "configure:4815: checking "use of pass-through arguments"" >&5 # Check whether --enable-pass-arguments or --disable-pass-arguments was given. if test "${enable_pass_arguments+set}" = set; then enableval="$enable_pass_arguments" @@ -4733,7 +4833,7 @@ fi echo "$ac_t""$enable_pass_arguments" 1>&6 echo $ac_n "checking "use of fake-main definition"""... $ac_c" 1>&6 -echo "configure:4737: checking "use of fake-main definition"" >&5 +echo "configure:4837: checking "use of fake-main definition"" >&5 # Check whether --enable-fake-main or --disable-fake-main was given. if test "${enable_fake_main+set}" = set; then enableval="$enable_fake_main" @@ -4793,17 +4893,17 @@ fi ac_safe=`echo "ffi.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for ffi.h""... $ac_c" 1>&6 -echo "configure:4797: checking for ffi.h" >&5 +echo "configure:4897: checking for ffi.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4807: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4907: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4827,9 +4927,9 @@ fi echo $ac_n "checking "for forwarding callback in runtime"""... $ac_c" 1>&6 -echo "configure:4831: checking "for forwarding callback in runtime"" >&5 +echo "configure:4931: checking "for forwarding callback in runtime"" >&5 cat > conftest.$ac_ext < EOF @@ -4847,17 +4947,17 @@ for ac_hdr in callback.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4851: checking for $ac_hdr" >&5 +echo "configure:4951: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4861: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4961: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4886,7 +4986,7 @@ done echo $ac_n "checking "FFI library usage"""... $ac_c" 1>&6 -echo "configure:4890: checking "FFI library usage"" >&5 +echo "configure:4990: checking "FFI library usage"" >&5 WITH_FFI=none if test $enable_libffi = yes; then cat >> confdefs.h <<\EOF @@ -4951,7 +5051,7 @@ fi # Extract the first word of "xml2-config", so it can be a program name with args. set dummy xml2-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4955: checking for $ac_word" >&5 +echo "configure:5055: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XML2_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4988,7 +5088,7 @@ fi # Extract the first word of "xml-config", so it can be a program name with args. set dummy xml-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4992: checking for $ac_word" >&5 +echo "configure:5092: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XML_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5026,7 +5126,7 @@ fi fi min_xml_version=2.2.3 echo $ac_n "checking for libxml - version >= $min_xml_version""... $ac_c" 1>&6 -echo "configure:5030: checking for libxml - version >= $min_xml_version" >&5 +echo "configure:5130: checking for libxml - version >= $min_xml_version" >&5 no_xml="" if test "$XML_CONFIG" = "no" ; then no_xml=yes @@ -5049,7 +5149,7 @@ echo "configure:5030: checking for libxml - version >= $min_xml_version" >&5 echo $ac_n "cross compiling; assumed OK... $ac_c" else cat > conftest.$ac_ext < @@ -5124,7 +5224,7 @@ main() } EOF -if { (eval echo configure:5128: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5228: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -5236,17 +5336,17 @@ if test $enable_openssl = yes; then do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5240: checking for $ac_hdr" >&5 +echo "configure:5340: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5250: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5350: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5281,7 +5381,7 @@ done ssl_ok=no else echo $ac_n "checking for CRYPTO_malloc in -lcrypto""... $ac_c" 1>&6 -echo "configure:5285: checking for CRYPTO_malloc in -lcrypto" >&5 +echo "configure:5385: checking for CRYPTO_malloc in -lcrypto" >&5 ac_lib_var=`echo crypto'_'CRYPTO_malloc | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5289,7 +5389,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcrypto $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5404: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5325,7 +5425,7 @@ fi base_libs="$LIBS" LIBS="$LIBS -lcrypto" echo $ac_n "checking for ssl2_clear in -lssl""... $ac_c" 1>&6 -echo "configure:5329: checking for ssl2_clear in -lssl" >&5 +echo "configure:5429: checking for ssl2_clear in -lssl" >&5 ac_lib_var=`echo ssl'_'ssl2_clear | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5333,7 +5433,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lssl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5448: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5379,7 +5479,7 @@ fi fi echo $ac_n "checking for des_setkey in -lcipher""... $ac_c" 1>&6 -echo "configure:5383: checking for des_setkey in -lcipher" >&5 +echo "configure:5483: checking for des_setkey in -lcipher" >&5 ac_lib_var=`echo cipher'_'des_setkey | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5387,7 +5487,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcipher $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5502: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5482,17 +5582,17 @@ for ac_hdr in gmp.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5486: checking for $ac_hdr" >&5 +echo "configure:5586: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5496: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5596: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5520,7 +5620,7 @@ done if test $ac_cv_header_gmp_h = yes; then echo $ac_n "checking for mpf_abs in -lgmp""... $ac_c" 1>&6 -echo "configure:5524: checking for mpf_abs in -lgmp" >&5 +echo "configure:5624: checking for mpf_abs in -lgmp" >&5 ac_lib_var=`echo gmp'_'mpf_abs | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5528,7 +5628,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lgmp $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5643: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5562,7 +5662,7 @@ fi if test "$gmp_ok" = no; then echo $ac_n "checking for __gmpf_abs in -lgmp""... $ac_c" 1>&6 -echo "configure:5566: checking for __gmpf_abs in -lgmp" >&5 +echo "configure:5666: checking for __gmpf_abs in -lgmp" >&5 ac_lib_var=`echo gmp'_'__gmpf_abs | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5570,7 +5670,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lgmp $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5685: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5623,12 +5723,12 @@ fi for ac_func in iconv do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5627: checking for $ac_func" >&5 +echo "configure:5727: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5755: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5693,7 +5793,7 @@ fi # BSDs install this lib as libgiconv echo $ac_n "checking for main in -lgiconv""... $ac_c" 1>&6 -echo "configure:5697: checking for main in -lgiconv" >&5 +echo "configure:5797: checking for main in -lgiconv" >&5 ac_lib_var=`echo giconv'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5701,14 +5801,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lgiconv $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5812: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5746,7 +5846,7 @@ EOF else echo $ac_n "checking for main in -liconv""... $ac_c" 1>&6 -echo "configure:5750: checking for main in -liconv" >&5 +echo "configure:5850: checking for main in -liconv" >&5 ac_lib_var=`echo iconv'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5754,14 +5854,14 @@ else ac_save_LIBS="$LIBS" LIBS="-liconv $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5865: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5807,7 +5907,7 @@ subdirs="Source/mframe" # Record the version #-------------------------------------------------------------------- echo $ac_n "checking for the version of gnustep-base we are compiling""... $ac_c" 1>&6 -echo "configure:5811: checking for the version of gnustep-base we are compiling" >&5 +echo "configure:5911: checking for the version of gnustep-base we are compiling" >&5 if test -f "Version"; then . ./Version fi diff --git a/configure.in b/configure.in index a7a35f9b9..0f11125d7 100644 --- a/configure.in +++ b/configure.in @@ -518,6 +518,13 @@ dnl AC_REPLACE_FUNCS(recvfrom) AC_CHECK_HEADERS(syslog.h) AC_CHECK_FUNCS(syslog) +#-------------------------------------------------------------------- +# These headers/functions needed by NSRunLoop.m +#-------------------------------------------------------------------- +AC_CHECK_HEADERS(poll.h) +AC_CHECK_FUNCS(poll) + + #-------------------------------------------------------------------- # Check for pthread.h (only when building on Darwin machines) #--------------------------------------------------------------------