If libdispatch provides integration hooks for the main queue

(i.e. nickhutchinson/libdispatch), use these to drain the main
queue using the main run loop.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39617 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Niels Grewe 2016-04-04 08:17:08 +00:00
parent 29d4e2981e
commit c0282c4073
9 changed files with 1811 additions and 2207 deletions

View file

@ -1,3 +1,17 @@
2016-04-04 Niels Grewe <niels.grewe@halbordnung.de>
* configure.ac: Check for runloop integration hooks in libdispatch
* configure
* Headers/GNUstepBase/config.h.in
* SSL/config.h.in
* SSL/configure:
Regenerate
* Source/NSRunLoop.m: If available, monitor the file descriptor for
the libdispatch main queue and drain it when it becomes readable.
* Tests/base/NSRunLoop/dispatch.m
* Tests/base/NSRunLoop/GNUmakefile.preamble:
Tests for libdispatch runloop integration
2016-03-25 Richard Frith-Macdonald <rfm@gnu.org>
* Headers/Foundation/NSObject.h:

View file

@ -215,9 +215,16 @@
/* Define to 1 if you have the <dispatch/dispatch.h> header file. */
#undef HAVE_DISPATCH_DISPATCH_H
/* Define to 1 if you have the `dispatch_get_main_queue_handle_np' function.
*/
#undef HAVE_DISPATCH_GET_MAIN_QUEUE_HANDLE_NP
/* Define to 1 if you have the <dispatch.h> header file. */
#undef HAVE_DISPATCH_H
/* Define to 1 if you have the `dispatch_main_queue_drain_np' function. */
#undef HAVE_DISPATCH_MAIN_QUEUE_DRAIN_NP
/* Define to 1 if you have the `dladdr' function. */
#undef HAVE_DLADDR
@ -242,15 +249,6 @@
/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
#undef HAVE_FSEEKO
/* Define if GC_allow_register_threads function is available */
#undef HAVE_GC_ALLOW_REGISTER_THREADS
/* Define to 1 if you have the <gc/gc.h> header file. */
#undef HAVE_GC_GC_H
/* Define if GC_register_my_thread function is available */
#undef HAVE_GC_REGISTER_MY_THREAD
/* Define to 1 if you have the `getaddrinfo' function. */
#undef HAVE_GETADDRINFO

View file

@ -96,6 +96,9 @@
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION

3489
SSL/configure vendored

File diff suppressed because it is too large Load diff

View file

@ -62,6 +62,15 @@
#include <math.h>
#include <time.h>
#if HAVE_DISPATCH_GET_MAIN_QUEUE_HANDLE_NP && HAVE_DISPATCH_MAIN_QUEUE_DRAIN_NP
# define RL_INTEGRATE_DISPATCH 1
# ifdef HAVE_DISPATCH_H
# include <dispatch.h>
# elif HAVE_DISPATCH_DISPATCH_H
# include <dispatch/dispatch.h>
# endif
#endif
NSString * const NSDefaultRunLoopMode = @"NSDefaultRunLoopMode";
@ -381,7 +390,26 @@ static inline BOOL timerInvalidated(NSTimer *t)
@end
#ifdef RL_INTEGRATE_DISPATCH
@interface GSMainQueueDrainer : NSObject <RunLoopEvents>
+ (void*) mainQueueFileDescriptor;
@end
@implementation GSMainQueueDrainer
+ (void*) mainQueueFileDescriptor
{
return (void*)(uintptr_t)dispatch_get_main_queue_handle_np();
}
- (void) receivedEvent: (void*)data
type: (RunLoopEventType)type
extra: (void*)extra
forMode: (NSString*)mode
{
dispatch_main_queue_drain_np();
}
@end
#endif
@interface NSRunLoop (Private)
@ -739,7 +767,7 @@ static inline BOOL timerInvalidated(NSTimer *t)
[inv setSelector: sel];
[inv setArgument: &not atIndex: 2];
[inv retainArguments];
context = NSMapGet(current->_contextMap, NSDefaultRunLoopMode);
if (context == nil)
{
@ -761,6 +789,18 @@ static inline BOOL timerInvalidated(NSTimer *t)
userInfo: nil
repeats: YES];
context->housekeeper = timer;
#ifdef RL_INTEGRATE_DISPATCH
// We leak the queue drainer, because it's integral part of RL
// operations
GSMainQueueDrainer *drain =
[NSObject leak: [[GSMainQueueDrainer new] autorelease]];
[current addEvent: [GSMainQueueDrainer mainQueueFileDescriptor]
type: ET_RDESC
watcher: drain
forMode: NSDefaultRunLoopMode];
#endif
[arp drain];
}
}
@ -1247,8 +1287,8 @@ updateTimer(NSTimer *t, NSDate *d, NSTimeInterval now)
/* Process any pending notifications.
*/
GSPrivateCheckTasks();
GSPrivateNotifyASAP(mode);
GSPrivateCheckTasks();
GSPrivateNotifyASAP(mode);
/* And process any performers scheduled in the loop (eg something from
* another thread.
@ -1519,4 +1559,3 @@ updateTimer(NSTimer *t, NSDate *d, NSTimeInterval now)
}
@end

View file

@ -0,0 +1,4 @@
include ../../../config.mak
ifeq ($(GNUSTEP_BASE_HAVE_LIBDISPATCH),1)
dispatch_TOOL_LIBS = -ldispatch
endif

View file

@ -0,0 +1,125 @@
#import "ObjectTesting.h"
#import <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSThread.h>
#import <Foundation/NSTimer.h>
#import <Foundation/NSRunLoop.h>
#import "../../../Source/config.h"
const NSTimeInterval kDelay = 0.01;
#if HAVE_DISPATCH_GET_MAIN_QUEUE_HANDLE_NP && HAVE_DISPATCH_MAIN_QUEUE_DRAIN_NP && __has_feature(blocks)
# define DISPATCH_RL_INTEGRATION 1
# ifdef HAVE_DISPATCH_H
# include <dispatch.h>
# else
# ifdef HAVE_DISPATCH_DISPATCH_H
# include <dispatch/dispatch.h>
# endif
# endif
#endif
/**
* This is a simple counter object that gets incremented from a different
* thread, but by using dispatch_async() to put the actual increment operation
* onto the main queue.
*/
@interface Counter : NSObject
{
NSUInteger counter;
}
- (void)increment;
- (NSUInteger)counter;
@end
/**
* This is the object running in the other thread. It's purpose is to dispatch
* five increments to the main queue and then exit.
*/
@interface Queuer : NSObject
- (void)worker: (Counter*)counter;
- (void)run;
- (void)timeout: (NSTimer*)t;
@end
@implementation Counter
- (void)increment
{
counter++;
}
- (NSUInteger)counter
{
return counter;
}
@end
@implementation Queuer
- (void)worker: (Counter*)counter
{
NSUInteger i = 0;
NSAutoreleasePool *pool = [NSAutoreleasePool new];
for (i = 0; i < 5; i++)
{
# ifdef DISPATCH_RL_INTEGRATION
dispatch_async(dispatch_get_main_queue(), ^ {
[counter increment];
});
# endif
NSDate *d = [NSDate dateWithTimeIntervalSinceNow: kDelay];
while ([d timeIntervalSinceNow] > 0)
{
[[NSRunLoop currentRunLoop] runUntilDate: d];
}
}
[pool release];
}
- (void)timeout: (NSTimer*)t
{
PASS(NO, "Timeout while trying to run blocks on main thread");
}
- (void) run
{
NSDate *until = [NSDate dateWithTimeIntervalSinceNow: 1.0];
Counter *c = [Counter new];
[NSTimer scheduledTimerWithTimeInterval: 1.0
target: self
selector: @selector(timeout:)
userInfo: nil
repeats: YES];
[NSThread detachNewThreadSelector: @selector(worker:)
toTarget: self
withObject: c];
while ([until timeIntervalSinceNow] > 0)
{
NSDate *tick = [NSDate dateWithTimeIntervalSinceNow: kDelay * 2];
[[NSRunLoop currentRunLoop] runUntilDate: tick];
if ([c counter] == 5)
{
break;
}
}
PASS([c counter] == 5, "Dispatch blocks execute on main queue");
}
@end
int main(int argc, char *argv[])
{
NSAutoreleasePool *pool = [NSAutoreleasePool new];
START_SET("NSRunLoop libdispatch integration")
# ifndef DISPATCH_RL_INTEGRATION
SKIP("No libdispatch, no blocks support or no runloop integration hooks in libdispatch")
# else
[[[Queuer new] autorelease] run];
# endif
END_SET("NSRunLoop libdispatch integration")
[pool release];
return 0;
}

231
configure vendored
View file

@ -716,7 +716,6 @@ ac_cv_sizeof_short
GS_UINT8
GS_SINT8
GS_WORDS_BIGENDIAN
OBJC_WITH_GC
PKGCONFIG
WHOAMI
EGREP
@ -2011,73 +2010,6 @@ $as_echo "$ac_res" >&6; }
} # ac_fn_c_check_type
# ac_fn_c_check_func LINENO FUNC VAR
# ----------------------------------
# Tests whether FUNC exists, setting the cache variable VAR accordingly
ac_fn_c_check_func ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
For example, HP-UX 11i <limits.h> declares gettimeofday. */
#define $2 innocuous_$2
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $2 (); below.
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
<limits.h> exists even on freestanding compilers. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
#undef $2
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char $2 ();
/* 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_$2 || defined __stub___$2
choke me
#endif
int
main ()
{
return $2 ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
eval "$3=yes"
else
eval "$3=no"
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_func
# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
# --------------------------------------------
# Tries to find the compile-time value of EXPR in a program that includes
@ -2261,6 +2193,73 @@ rm -f conftest.val
} # ac_fn_c_compute_int
# ac_fn_c_check_func LINENO FUNC VAR
# ----------------------------------
# Tests whether FUNC exists, setting the cache variable VAR accordingly
ac_fn_c_check_func ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
For example, HP-UX 11i <limits.h> declares gettimeofday. */
#define $2 innocuous_$2
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $2 (); below.
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
<limits.h> exists even on freestanding compilers. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
#undef $2
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char $2 ();
/* 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_$2 || defined __stub___$2
choke me
#endif
int
main ()
{
return $2 ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
eval "$3=yes"
else
eval "$3=no"
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_func
# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES
# ----------------------------------------------------
# Tries to find if the field MEMBER exists in type AGGR, after including
@ -5419,7 +5418,7 @@ else
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@ -5465,7 +5464,7 @@ else
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@ -5489,7 +5488,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@ -5534,7 +5533,7 @@ else
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@ -5558,7 +5557,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@ -5844,7 +5843,6 @@ esac
#--------------------------------------------------------------------
# Set Apple/Darwin/OSX/NeXT information for other tests
#--------------------------------------------------------------------
OBJC_WITH_GC=no
OBJC_RUNTIME_LIB=`echo $LIBRARY_COMBO | tr '-' ' ' | awk '{print $1}'`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the Objective-C runtime" >&5
$as_echo_n "checking the Objective-C runtime... " >&6; }
@ -5852,11 +5850,6 @@ if test "$OBJC_RUNTIME_LIB" = "nx" -o "$OBJC_RUNTIME_LIB" = "apple"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: NeXT" >&5
$as_echo "NeXT" >&6; }
OBJCFLAGS="$OBJCFLAGS -fnext-runtime -DNeXT_RUNTIME"
elif test "$OBJC_RUNTIME_LIB" = "gnugc"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: GNU" >&5
$as_echo "GNU" >&6; }
OBJCFLAGS="$OBJCFLAGS -fgnu-runtime"
OBJC_WITH_GC=yes
elif test "$OBJC_RUNTIME_LIB" = "ng"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Next Gen" >&5
$as_echo "Next Gen" >&6; }
@ -5984,71 +5977,6 @@ if test $ac_cv_header_objc_objc_h = no; then
as_fn_error $? "Could not find Objective-C headers" "$LINENO" 5
fi
if test $OBJC_WITH_GC = yes; then
for ac_header in gc/gc.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "gc/gc.h" "ac_cv_header_gc_gc_h" "$ac_includes_default"
if test "x$ac_cv_header_gc_gc_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_GC_GC_H 1
_ACEOF
gc_ok=yes
else
gc_ok=no
fi
done
if test "$gc_ok" = no; then
as_fn_error $? "Garbage collection was required, but the gc/gc.h header couldn't be found." "$LINENO" 5
fi
saved_LIBS="$LIBS"
LIBS+=" -lgc"
ac_fn_c_check_func "$LINENO" "GC_malloc" "ac_cv_func_GC_malloc"
if test "x$ac_cv_func_GC_malloc" = xyes; then :
gc_ok=yes
else
gc_ok=no
fi
if test "$gc_ok" = no; then
as_fn_error $? "Garbage collection was required, but the gc library couldn't be found." "$LINENO" 5
fi
ac_fn_c_check_func "$LINENO" "GC_register_my_thread" "ac_cv_func_GC_register_my_thread"
if test "x$ac_cv_func_GC_register_my_thread" = xyes; then :
fi
if test "$ac_cv_func_GC_register_my_thread" = yes; then
$as_echo "#define HAVE_GC_REGISTER_MY_THREAD 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "GC_allow_register_threads" "ac_cv_func_GC_allow_register_threads"
if test "x$ac_cv_func_GC_allow_register_threads" = xyes; then :
fi
if test "$ac_cv_func_GC_allow_register_threads" = yes; then
$as_echo "#define HAVE_GC_ALLOW_REGISTER_THREADS 1" >>confdefs.h
fi
LIBS="-lobjc_gc -ldl"
ac_fn_c_check_func "$LINENO" "class_ivar_set_gcinvisible" "ac_cv_func_class_ivar_set_gcinvisible"
if test "x$ac_cv_func_class_ivar_set_gcinvisible" = xyes; then :
gc_ok=yes
else
gc_ok=no
fi
if test "$gc_ok" = no; then
as_fn_error $? "Garbage collection was required, but the gc runtime couldn't be found." "$LINENO" 5
fi
LIBS="$saved_LIBS"
fi
#--------------------------------------------------------------------
# Check for strange network stuff used by gdomap
#--------------------------------------------------------------------
@ -12416,6 +12344,21 @@ $as_echo "no" >&6; };
fi
if test $HAVE_LIBDISPATCH = 1; then
# We check whether we
for ac_func in dispatch_main_queue_drain_np dispatch_get_main_queue_handle_np
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
fi
#--------------------------------------------------------------------
# Check GMP for NSDecimal

View file

@ -12,7 +12,7 @@
# modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@ -133,7 +133,7 @@ fi
# This variable might get temporarily overwritten with the
# GNUSTEP_MAKEFILES of the runtime configuration, make sure we keep
# track of the original one. CURRENT_GNUSTEP_MAKEFILES is the one
# that we use to locate the actual gnustep-make installation that
# that we use to locate the actual gnustep-make installation that
# will build the software.
CURRENT_GNUSTEP_MAKEFILES="$GNUSTEP_MAKEFILES"
@ -162,7 +162,7 @@ AC_ARG_WITH(cross-compilation-info,
contains information for the configure script in
case of cross compilation. This information
replaces those obtained from running programmes
during the configuration phase.],
during the configuration phase.],
cross_result="$withval",
cross_result="no"
)
@ -170,7 +170,7 @@ CROSS_CONFIG="./cross.config"
if test "$cross_result" != "no"
then
if test -f "$cross_result" && test -r "$cross_result"
then
then
CROSS_CONFIG="$cross_result"
else
AC_MSG_ERROR(["Could not load cross-compilation variables from $cross_result"])
@ -224,7 +224,7 @@ AC_ARG_WITH(config-file,
environment variable at runtime.
If a trailing '/' is specified, the path is
used for locating domains but no GNUstep
config file is read at runtime.],
config file is read at runtime.],
result="$withval",
result="no"
)
@ -255,7 +255,7 @@ case "$target_os" in
*) enable_env_config=yes;;
esac
AC_MSG_CHECKING([whether the GNUstep.conf file path can be set in the environment])
AC_ARG_ENABLE(environment-config-file,
AC_ARG_ENABLE(environment-config-file,
[ --disable-environment-config-file
Disables the use of the GNUSTEP_CONFIG_FILE
environment variable to specify/override
@ -272,7 +272,7 @@ AC_ARG_ENABLE(environment-config-file,
system (and containing unix-style paths
which cannot be used by windows apps).
Normally this should be left at its default
setting.],
setting.],
ac_cv_environment_config_file=$enableval,
ac_cv_environment_config_file=$enable_env_config)
if test "$ac_cv_environment_config_file" = "yes"; then
@ -316,7 +316,7 @@ esac
# It can be annoying in certain cases though; this option lets you
# turn it off.
AC_MSG_CHECKING([if we should import an existing configuration file now])
AC_ARG_ENABLE(importing-config-file,
AC_ARG_ENABLE(importing-config-file,
[ --disable-importing-config-file
Disable importing of an existing GNUstep config
file and use inbuilt defaults instead.],
@ -382,8 +382,8 @@ then
# It looks like we need to make sure the user knows what they
# are doing, as there is a high chance they don't and might end
# up with a confused/non-working system. As far as we know, the
# system might be already screwed. If they don't want to import
# a config file (eg, they don't have one and they don't care about
# system might be already screwed. If they don't want to import
# a config file (eg, they don't have one and they don't care about
# the hardcoded paths) they should just say so. ;-)
AC_MSG_ERROR([Please run configure again with the --disable-importing-config-file option or specifying an alternative file using the --with-default-config= option])
exit 1
@ -550,7 +550,7 @@ case "$target_os" in
# so we can not use the 'short' option if we want gnustep-base
# to work with older versions of gnustep-make.
# Once everyone has upgraded to gnustep-make >= 2.0.5 (I'd say
# two years after it has been released ?), we could switch to the
# two years after it has been released ?), we could switch to the
# 'short' output though.
GNUSTEP_SYSTEM_APPS=`$GNUSTEP_MAKEFILES/relative_path.sh $GNUSTEP_BASE_PATH $GNUSTEP_SYSTEM_APPS`
GNUSTEP_SYSTEM_ADMIN_APPS=`$GNUSTEP_MAKEFILES/relative_path.sh $GNUSTEP_BASE_PATH $GNUSTEP_SYSTEM_ADMIN_APPS`
@ -1065,7 +1065,7 @@ fi
#
# Add standard library and header directories for configure to use to locate
# plain C developer headers/libraries which have been installed in the
# GNUstep hierarchy. These take precedence
# GNUstep hierarchy. These take precedence
#
CPPFLAGS="$CPPFLAGS -I$GNUSTEP_LOCAL_HEADERS -I$GNUSTEP_NETWORK_HEADERS -I$GNUSTEP_SYSTEM_HEADERS"
LDFLAGS="$LDFLAGS -L$GNUSTEP_LOCAL_LIBRARIES -L$GNUSTEP_NETWORK_LIBRARIES -L$GNUSTEP_SYSTEM_LIBRARIES"
@ -1139,14 +1139,14 @@ AC_MSG_CHECKING([whether the compiler supports atomic operations]);
if test "$CC" = "gcc"; then
saved_CFLAGS="$CFLAGS";
ATOMIC_CFLAGS="";
# FIXME: Forcing -march=i568 for any i568 or later CPU is a
# stop gap measure to make the compiler emit native assembly
# for atomic operations on i586 or latter processors (GCC by
# default emits code compatible with the original i386 and
# requires library functions to emulate atomic operations).
# When gnustep-make takes care of this kind of target setting,
# the check can safely be removed.
# the check can safely be removed.
case "$target_cpu" in
i586*|i686*|i786*)
ATOMIC_CFLAGS="-march=i586"
@ -1186,7 +1186,7 @@ AC_MSG_CHECKING([whether the compiler supports atomic operations]);
LDFLAGS="$saved_LDFLAGS";
AC_MSG_RESULT([no]);
fi
fi
fi
fi
fi
AC_LANG_POP(C)
@ -1203,7 +1203,7 @@ LDIR_FLAGS="$LDFLAGS"
# This is just for configuring. Later, in config.make, INCLUDE_FLAGS
# goes in CONFIG_SYSTEM_INCL and LIBS goes in CONFIG_SYSTEM_LIBS
case "$target_os" in
freebsd* | openbsd* )
freebsd* | openbsd* )
CPPFLAGS="$CPPFLAGS -I/usr/local/include"
LDFLAGS="$LDFLAGS -L/usr/local/lib";;
netbsd*) CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
@ -1640,7 +1640,7 @@ AC_SUBST(BUGGY_PTR_LIMITS)
AC_LANG_POP(C)
#--------------------------------------------------------------------
# Setup dynamic linking
# Setup dynamic linking
#--------------------------------------------------------------------
OBJC_SYS_DYNAMIC_LINKER()
# NOTE: libdl should be in LIBS now if it's available.
@ -1655,7 +1655,7 @@ fi
AC_CHECK_FUNCS(getaddrinfo)
#--------------------------------------------------------------------
# Check for pthread.h
# Check for pthread.h
#--------------------------------------------------------------------
AC_CHECK_HEADERS(pthread.h pthread_np.h)
if test $ac_cv_header_pthread_h = yes ; then
@ -1824,8 +1824,8 @@ fi
LIBS="$LIBS $extra_LIBS"
AC_CACHE_VAL(gs_cv_objc_works,
AC_TRY_RUN([#include "$srcdir/config/config.objc.m"],
gs_cv_objc_works=yes,
gs_cv_objc_works=no,
gs_cv_objc_works=yes,
gs_cv_objc_works=no,
gs_cv_objc_works="$cross_gs_cv_objc_works")
)
if test $gs_cv_objc_works = yes; then
@ -1890,8 +1890,8 @@ AC_SUBST(NX_CONST_STRING_CLASS)
# Don't revert any Objective-C flags as they are used in the next test
#---------------------------------------------------------------------
# Guess if we are using a compiler which has the (GNU extension) +load
# method which is executed before main.
# Guess if we are using a compiler which has the (GNU extension) +load
# method which is executed before main.
# Defines HAVE_LOAD_METHOD if +load methods are called before main.
# Needed by NSProcessInfo.m
#---------------------------------------------------------------------
@ -1999,7 +1999,7 @@ AC_SUBST(GS_MIXEDABI)
#--------------------------------------------------------------------
# get_uninstalled_dtable used by behavior.m and objc-load.m
#--------------------------------------------------------------------
AC_EGREP_HEADER(objc_get_uninstalled_dtable, objc/objc-api.h,
AC_EGREP_HEADER(objc_get_uninstalled_dtable, objc/objc-api.h,
AC_DEFINE(HAVE_OBJC_GET_UNINSTALLED_DTABLE,1,
[ Define if objc-api.h defines this function]),)
@ -2196,7 +2196,7 @@ AC_CACHE_CHECK([for pw_gecos field in struct passwd],
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pwd.h> ]],
[[ struct passwd p; p.pw_gecos = 0; ]])],
[ ac_cv_have_pw_gecos_in_struct_passwd="yes" ],
[ ac_cv_have_pw_gecos_in_struct_passwd="no"
[ ac_cv_have_pw_gecos_in_struct_passwd="no"
])
])
if test "x$ac_cv_have_pw_gecos_in_struct_passwd" = "xyes" ; then
@ -2209,7 +2209,7 @@ AC_CACHE_CHECK([for currency_symbol field in struct lconv],
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <locale.h> ]],
[[ struct lconv l; l.currency_symbol = NULL; ]])],
[ ac_cv_have_currency_symbol_in_struct_lconv="yes" ],
[ ac_cv_have_currency_symbol_in_struct_lconv="no"
[ ac_cv_have_currency_symbol_in_struct_lconv="no"
])
])
if test "x$ac_cv_have_currency_symbol_in_struct_lconv" = "xyes" ; then
@ -2227,7 +2227,7 @@ AC_CHECK_FUNCS(time ctime tzset)
# Check if tzfile contains the proper definitions
if test $ac_cv_header_tzfile_h = yes; then
AC_EGREP_HEADER(tzhead, tzfile.h,
AC_EGREP_HEADER(tzhead, tzfile.h,
AC_DEFINE(HAVE_TZHEAD,1,
[ Define if tzfile.h includes the proper definitions]),)
fi
@ -2290,7 +2290,7 @@ have_poll=no
if test $ac_cv_header_poll_h = yes; then
have_poll=yes
AC_MSG_CHECKING(for poll emulation)
AC_EGREP_CPP(emulating_poll, [#include "config/config.poll.c"],
AC_EGREP_CPP(emulating_poll, [#include "config/config.poll.c"],
have_poll=no,)
if test $have_poll = yes; then
AC_MSG_RESULT(no)
@ -2522,17 +2522,17 @@ fi
# This needed by NSString for handling of %@ printf directive.
#--------------------------------------------------------------------
AC_CHECK_FUNCS(register_printf_specifier)
AC_CHECK_FUNC(register_printf_function, register_printf=1,
AC_CHECK_FUNC(register_printf_function, register_printf=1,
register_printf=0)
if test $register_printf = 1; then
AC_TRY_RUN([#include "$srcdir/config/config.printf.c"],
working_register_printf=1, working_register_printf=0,
working_register_printf=1, working_register_printf=0,
working_register_printf="$cross_working_register_printf")
if test $working_register_printf = 1; then
AC_DEFINE(HAVE_REGISTER_PRINTF_FUNCTION,1,
[Define if you have the register_printf_function function])
AC_TRY_RUN([#include "$srcdir/config/config.wprintf.c"],
wide_register_printf=1, wide_register_printf=0,
wide_register_printf=1, wide_register_printf=0,
wide_register_printf="$cross_wide_register_printf")
if test $wide_register_printf = 1; then
AC_DEFINE(HAVE_WIDE_PRINTF_FUNCTION,1,
@ -2555,7 +2555,7 @@ AC_MSG_CHECKING(program_invocation_name in C Library)
AC_CACHE_VAL(gs_cv_program_invocation_name_worked,
[AC_TRY_RUN([
#include <string.h>
int
int
main (int argc, char *argv[])
{
extern char *program_invocation_name;
@ -2572,19 +2572,19 @@ else
fi
#--------------------------------------------------------------------
# Check for uname header used by NSProcessInfo.m
# Check for uname header used by NSProcessInfo.m
#--------------------------------------------------------------------
AC_CHECK_HEADERS(sys/utsname.h)
#--------------------------------------------------------------------
# Check for sysctlbyname used by NSProcessInfo.m
# Check for sysctlbyname used by NSProcessInfo.m
#--------------------------------------------------------------------
AC_CHECK_HEADERS(sys/sysctl.h)
AC_CHECK_FUNCS(sysctlbyname)
#--------------------------------------------------------------------
# Defines HAVE_PROCFS if the kernel supports the /proc filesystem.
# Needed by NSProcessInfo.m
# Defines HAVE_PROCFS if the kernel supports the /proc filesystem.
# Needed by NSProcessInfo.m
#--------------------------------------------------------------------
AC_CHECK_HEADERS(procfs.h)
AC_SYS_PROCFS
@ -2621,7 +2621,7 @@ if test "$ac_cv_lib_kvm_kvm_getenvv" = yes; then
have_kvm_env="$cross_have_kvm_env")
if test $have_kvm_env = 1; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_KVM_ENV, 1,
AC_DEFINE(HAVE_KVM_ENV, 1,
[Define if you can access the kernel via kvm_open])
else
AC_MSG_RESULT(no)
@ -2781,7 +2781,7 @@ if test "$do_broken_libffi" = "no"; then
if test "$PKGCONFIG" = "yes"; then
if pkg-config --exists libffi; then
pkg_config_libffi=yes
ffi_CFLAGS=`pkg-config --cflags libffi`;
ffi_CFLAGS=`pkg-config --cflags libffi`;
CPPFLAGS="$CPPFLAGS $ffi_CFLAGS"
INCLUDE_FLAGS="$INCLUDE_FLAGS $ffi_CFLAGS"
fi
@ -2875,7 +2875,7 @@ if test $enable_ffcall = yes -a $ffi_ok = yes; then
AC_MSG_CHECKING(if ffcall trampolines work)
AC_RUN_IFELSE(
[AC_LANG_SOURCE([[#include "$srcdir/config/config.trampoline.c"]])],
have_working_trampoline=yes, have_working_trampoline=no,
have_working_trampoline=yes, have_working_trampoline=no,
have_working_trampoline=yes)
AC_MSG_RESULT($have_working_trampoline)
fi
@ -3309,9 +3309,9 @@ if test $enable_icu = yes; then
LDFLAGS="$LDFLAGS $LIBS $ICU_LDFLAGS -licui18n -licuuc -licudata -lm"
AC_TRY_LINK([],[], have_icu="yes", have_icu="no");
LDFLAGS="$saved_LDFLAGS";
ICU_LIBS="-licui18n -licuuc -licudata -lm"
ICU_LIBS="-licui18n -licuuc -licudata -lm"
fi
if test "$have_icu" = "yes"; then
AC_MSG_RESULT(yes)
AC_CHECK_HEADERS(unicode/uloc.h unicode/ulocdata.h unicode/ucol.h unicode/ucurr.h unicode/uregex.h unicode/ucal.h unicode/unorm2.h unicode/unum.h unicode/udat.h unicode/udatpg.h unicode/ustring.h unicode/usearch.h unicode/ucnv.h)
@ -3371,6 +3371,11 @@ if test $enable_libdispatch = yes; then
fi
AC_SUBST(HAVE_LIBDISPATCH)
if test $HAVE_LIBDISPATCH = 1; then
# We check whether we have a variant of libdispatch that allows runloop
# integration
AC_CHECK_FUNCS(dispatch_main_queue_drain_np dispatch_get_main_queue_handle_np)
fi
#--------------------------------------------------------------------
# Check GMP for NSDecimal
@ -3413,7 +3418,7 @@ AC_SUBST(USE_GMP)
# Check which sorting algorithm to use.
#--------------------------------------------------------------------
AC_ARG_WITH(sort-algorithm,
[ --with-sort-algorithm=ALG force use of a specific sorting algorithm.
[ --with-sort-algorithm=ALG force use of a specific sorting algorithm.
Possible values are timsort, quicksort, and shellsort.
Defaults to shellsort (others broken).],
sort_algorithm="$withval", sort_algorithm="shellsort")