mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-01 09:02:01 +00:00
Implement stack size limit. Add workaround for versions of libobjc which
leak thread memory. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@25790 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
8dc5f2ad2f
commit
a6c91ff216
6 changed files with 404 additions and 12 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2007-12-26 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* config/config.joinable.m: test for joinable threads.
|
||||||
|
* configure.ac: Add test for setrlimit and joinable threads
|
||||||
|
* configure: regenerate
|
||||||
|
* Headers/Additions/GNUstepBase/config.h.in: regenerate
|
||||||
|
* Source/NSThread.m: implement setting stack size for new
|
||||||
|
threads. Hack in workaround for versions of libobjc which
|
||||||
|
leak thread resource memory.
|
||||||
|
|
||||||
2007-12-24 Adam Fedor <fedor@gnu.org>
|
2007-12-24 Adam Fedor <fedor@gnu.org>
|
||||||
|
|
||||||
* configure.ac: Don't fail if ffcall trampolines don't work.
|
* configure.ac: Don't fail if ffcall trampolines don't work.
|
||||||
|
|
|
@ -174,6 +174,9 @@
|
||||||
/* Define if this constant is defined */
|
/* Define if this constant is defined */
|
||||||
#undef HANDLE_LONG_LONG_MAX
|
#undef HANDLE_LONG_LONG_MAX
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <alloca.h> header file. */
|
||||||
|
#undef HAVE_ALLOCA_H
|
||||||
|
|
||||||
/* Define to 1 if you have the <bfd.h> header file. */
|
/* Define to 1 if you have the <bfd.h> header file. */
|
||||||
#undef HAVE_BFD_H
|
#undef HAVE_BFD_H
|
||||||
|
|
||||||
|
@ -313,9 +316,6 @@
|
||||||
/* Define if your Obj-C compiler calls +load methods before main */
|
/* Define if your Obj-C compiler calls +load methods before main */
|
||||||
#undef HAVE_LOAD_METHOD
|
#undef HAVE_LOAD_METHOD
|
||||||
|
|
||||||
/* Define to 1 if you have the <alloca.h> header file. */
|
|
||||||
#undef HAVE_ALLOCA_H
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <locale.h> header file. */
|
/* Define to 1 if you have the <locale.h> header file. */
|
||||||
#undef HAVE_LOCALE_H
|
#undef HAVE_LOCALE_H
|
||||||
|
|
||||||
|
@ -403,6 +403,9 @@
|
||||||
/* Define to 1 if you have the `setpgrp' function. */
|
/* Define to 1 if you have the `setpgrp' function. */
|
||||||
#undef HAVE_SETPGRP
|
#undef HAVE_SETPGRP
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `setrlimit' function. */
|
||||||
|
#undef HAVE_SETRLIMIT
|
||||||
|
|
||||||
/* Define to 1 if you have the `shmctl' function. */
|
/* Define to 1 if you have the `shmctl' function. */
|
||||||
#undef HAVE_SHMCTL
|
#undef HAVE_SHMCTL
|
||||||
|
|
||||||
|
@ -468,6 +471,9 @@
|
||||||
/* Define to 1 if you have the <sys/param.h> header file. */
|
/* Define to 1 if you have the <sys/param.h> header file. */
|
||||||
#undef HAVE_SYS_PARAM_H
|
#undef HAVE_SYS_PARAM_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/resource.h> header file. */
|
||||||
|
#undef HAVE_SYS_RESOURCE_H
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/rusage.h> header file. */
|
/* Define to 1 if you have the <sys/rusage.h> header file. */
|
||||||
#undef HAVE_SYS_RUSAGE_H
|
#undef HAVE_SYS_RUSAGE_H
|
||||||
|
|
||||||
|
@ -588,6 +594,9 @@
|
||||||
/* Define as the link to exe of process in /proc filesystem. */
|
/* Define as the link to exe of process in /proc filesystem. */
|
||||||
#undef PROCFS_EXE_LINK
|
#undef PROCFS_EXE_LINK
|
||||||
|
|
||||||
|
/* Define if objc runtime creates jointable threads */
|
||||||
|
#undef PTHREAD_JOINABLE
|
||||||
|
|
||||||
/* Define to 1 if the `setpgrp' function takes no argument. */
|
/* Define to 1 if the `setpgrp' function takes no argument. */
|
||||||
#undef SETPGRP_VOID
|
#undef SETPGRP_VOID
|
||||||
|
|
||||||
|
|
|
@ -39,12 +39,22 @@
|
||||||
#ifdef HAVE_NANOSLEEP
|
#ifdef HAVE_NANOSLEEP
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_SYS_TIME_H
|
||||||
|
#include <sys/time.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_SYS_RESOURCE_H
|
||||||
|
#include <sys/resource.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_PTHREAD_H
|
||||||
|
#include <pthread.h>
|
||||||
|
#endif
|
||||||
#ifdef NeXT_RUNTIME
|
#ifdef NeXT_RUNTIME
|
||||||
#include "thr-mach.h"
|
#include "thr-mach.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include "Foundation/NSDebug.h"
|
||||||
#include "Foundation/NSException.h"
|
#include "Foundation/NSException.h"
|
||||||
#include "Foundation/NSThread.h"
|
#include "Foundation/NSThread.h"
|
||||||
#include "Foundation/NSLock.h"
|
#include "Foundation/NSLock.h"
|
||||||
|
@ -703,11 +713,6 @@ gnustep_base_thread_callback(void)
|
||||||
- (void) cancel
|
- (void) cancel
|
||||||
{
|
{
|
||||||
_cancelled = YES;
|
_cancelled = YES;
|
||||||
if (_active == YES)
|
|
||||||
{
|
|
||||||
[self notImplemented: _cmd];
|
|
||||||
// FIXME
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
|
@ -808,6 +813,21 @@ gnustep_base_thread_callback(void)
|
||||||
NSStringFromSelector(_cmd)];
|
NSStringFromSelector(_cmd)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(HAVE_SETRLIMIT) && defined(RLIMIT_STACK)
|
||||||
|
if (_stackSize > 0)
|
||||||
|
{
|
||||||
|
struct rlimit rl;
|
||||||
|
|
||||||
|
rl.rlim_cur = _stackSize;
|
||||||
|
rl.rlim_max = _stackSize;
|
||||||
|
if (setrlimit(RLIMIT_STACK, &rl) < 0)
|
||||||
|
{
|
||||||
|
NSDebugMLog(@"Unable to set thread stack size to %u: %@",
|
||||||
|
_stackSize, [NSError _last]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We are running in the new thread - so we store ourself in the thread
|
* We are running in the new thread - so we store ourself in the thread
|
||||||
* dictionary and release ourself - thus, when the thread exits, we will
|
* dictionary and release ourself - thus, when the thread exits, we will
|
||||||
|
@ -815,6 +835,15 @@ gnustep_base_thread_callback(void)
|
||||||
*/
|
*/
|
||||||
objc_thread_set_data(self);
|
objc_thread_set_data(self);
|
||||||
|
|
||||||
|
#if defined(PTHREAD_JOINABLE)
|
||||||
|
/* Hack to work around the fact that
|
||||||
|
* some versions of the objective-c
|
||||||
|
* library fail to create the thread detached.
|
||||||
|
* We should really do this only in such cases.
|
||||||
|
*/
|
||||||
|
pthread_detach(pthread_self());
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Let observers know a new thread is starting.
|
* Let observers know a new thread is starting.
|
||||||
*/
|
*/
|
||||||
|
@ -843,8 +872,10 @@ gnustep_base_thread_callback(void)
|
||||||
|
|
||||||
- (void) setStackSize: (unsigned)stackSize
|
- (void) setStackSize: (unsigned)stackSize
|
||||||
{
|
{
|
||||||
[self notImplemented: _cmd];
|
_stackSize = stackSize;
|
||||||
_stackSize = stackSize; // FIXME
|
#if !defined(HAVE_SETRLIMIT) || !defined(RLIMIT_STACK)
|
||||||
|
GSOnceMLog(@"Warning ... -setStackSize: not implemented on this system");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
- (unsigned) stackSize
|
- (unsigned) stackSize
|
||||||
|
|
20
config/config.joinable.m
Normal file
20
config/config.joinable.m
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
/* Test whether Objective-C runtime uses pthreads and doesn't detach
|
||||||
|
* them properly. If the join attempt succeeds, the thread was created
|
||||||
|
* joinable (which it shouldn't be) and this program returns 0.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <objc/thr.h>
|
||||||
|
#include <objc/Object.h>
|
||||||
|
#include <pthread.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
id o = [Object new];
|
||||||
|
pthread_t tid;
|
||||||
|
void *value_ptr;
|
||||||
|
|
||||||
|
tid = (pthread_t)objc_thread_detach (@selector(hash), o, nil);
|
||||||
|
return pthread_join (tid, &value_ptr);
|
||||||
|
}
|
||||||
|
|
301
configure
vendored
301
configure
vendored
|
@ -11899,7 +11899,7 @@ echo "${ECHO_T}yes" >&6; }
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Check for pthread.h (only when building on Darwin machines)
|
# Check for pthread.h
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
for ac_header in pthread.h
|
for ac_header in pthread.h
|
||||||
|
@ -12044,6 +12044,67 @@ done
|
||||||
HAVE_PTHREAD_H=no
|
HAVE_PTHREAD_H=no
|
||||||
if test $ac_cv_header_pthread_h = yes ; then
|
if test $ac_cv_header_pthread_h = yes ; then
|
||||||
HAVE_PTHREAD_H=yes
|
HAVE_PTHREAD_H=yes
|
||||||
|
if test x"$objc_threaded" != x""; then
|
||||||
|
saved_LIBS="$LIBS"
|
||||||
|
saved_CPPFLAGS="$CPPFLAGS"
|
||||||
|
LIBS="$LIBS $LIBOBJC"
|
||||||
|
CPPFLAGS="$CPPFLAGS $OBJCFLAGS -x objective-c"
|
||||||
|
LIBS="$LIBS $objc_threaded"
|
||||||
|
LIBS="$LIBS $extra_LIBS"
|
||||||
|
if test "$cross_compiling" = yes; then
|
||||||
|
pthread_joinable=1
|
||||||
|
else
|
||||||
|
cat >conftest.$ac_ext <<_ACEOF
|
||||||
|
/* confdefs.h. */
|
||||||
|
_ACEOF
|
||||||
|
cat confdefs.h >>conftest.$ac_ext
|
||||||
|
cat >>conftest.$ac_ext <<_ACEOF
|
||||||
|
/* end confdefs.h. */
|
||||||
|
#include "$srcdir/config/config.joinable.m"
|
||||||
|
_ACEOF
|
||||||
|
rm -f conftest$ac_exeext
|
||||||
|
if { (ac_try="$ac_link"
|
||||||
|
case "(($ac_try" in
|
||||||
|
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||||
|
*) ac_try_echo=$ac_try;;
|
||||||
|
esac
|
||||||
|
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
||||||
|
(eval "$ac_link") 2>&5
|
||||||
|
ac_status=$?
|
||||||
|
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||||
|
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
|
||||||
|
{ (case "(($ac_try" in
|
||||||
|
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||||
|
*) ac_try_echo=$ac_try;;
|
||||||
|
esac
|
||||||
|
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
||||||
|
(eval "$ac_try") 2>&5
|
||||||
|
ac_status=$?
|
||||||
|
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||||
|
(exit $ac_status); }; }; then
|
||||||
|
pthread_joinable=1
|
||||||
|
else
|
||||||
|
echo "$as_me: program exited with status $ac_status" >&5
|
||||||
|
echo "$as_me: failed program was:" >&5
|
||||||
|
sed 's/^/| /' conftest.$ac_ext >&5
|
||||||
|
|
||||||
|
( exit $ac_status )
|
||||||
|
pthread_joinable=0
|
||||||
|
fi
|
||||||
|
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if test $pthread_joinable = 1; then
|
||||||
|
|
||||||
|
cat >>confdefs.h <<\_ACEOF
|
||||||
|
#define PTHREAD_JOINABLE 1
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
fi
|
||||||
|
LIBS="$saved_LIBS"
|
||||||
|
CPPFLAGS="$saved_CPPFLAGS"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
@ -14026,6 +14087,244 @@ fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# For setting thread stack size
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
|
for ac_header in sys/resource.h
|
||||||
|
do
|
||||||
|
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||||
|
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
|
||||||
|
{ echo "$as_me:$LINENO: checking for $ac_header" >&5
|
||||||
|
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
|
||||||
|
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
|
||||||
|
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||||
|
fi
|
||||||
|
ac_res=`eval echo '${'$as_ac_Header'}'`
|
||||||
|
{ echo "$as_me:$LINENO: result: $ac_res" >&5
|
||||||
|
echo "${ECHO_T}$ac_res" >&6; }
|
||||||
|
else
|
||||||
|
# Is the header compilable?
|
||||||
|
{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
|
||||||
|
echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
|
||||||
|
cat >conftest.$ac_ext <<_ACEOF
|
||||||
|
/* confdefs.h. */
|
||||||
|
_ACEOF
|
||||||
|
cat confdefs.h >>conftest.$ac_ext
|
||||||
|
cat >>conftest.$ac_ext <<_ACEOF
|
||||||
|
/* end confdefs.h. */
|
||||||
|
$ac_includes_default
|
||||||
|
#include <$ac_header>
|
||||||
|
_ACEOF
|
||||||
|
rm -f conftest.$ac_objext
|
||||||
|
if { (ac_try="$ac_compile"
|
||||||
|
case "(($ac_try" in
|
||||||
|
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||||
|
*) ac_try_echo=$ac_try;;
|
||||||
|
esac
|
||||||
|
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
||||||
|
(eval "$ac_compile") 2>conftest.er1
|
||||||
|
ac_status=$?
|
||||||
|
grep -v '^ *+' conftest.er1 >conftest.err
|
||||||
|
rm -f conftest.er1
|
||||||
|
cat conftest.err >&5
|
||||||
|
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||||
|
(exit $ac_status); } && {
|
||||||
|
test -z "$ac_c_werror_flag" ||
|
||||||
|
test ! -s conftest.err
|
||||||
|
} && test -s conftest.$ac_objext; then
|
||||||
|
ac_header_compiler=yes
|
||||||
|
else
|
||||||
|
echo "$as_me: failed program was:" >&5
|
||||||
|
sed 's/^/| /' conftest.$ac_ext >&5
|
||||||
|
|
||||||
|
ac_header_compiler=no
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||||
|
{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
|
||||||
|
echo "${ECHO_T}$ac_header_compiler" >&6; }
|
||||||
|
|
||||||
|
# Is the header present?
|
||||||
|
{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
|
||||||
|
echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
|
||||||
|
cat >conftest.$ac_ext <<_ACEOF
|
||||||
|
/* confdefs.h. */
|
||||||
|
_ACEOF
|
||||||
|
cat confdefs.h >>conftest.$ac_ext
|
||||||
|
cat >>conftest.$ac_ext <<_ACEOF
|
||||||
|
/* end confdefs.h. */
|
||||||
|
#include <$ac_header>
|
||||||
|
_ACEOF
|
||||||
|
if { (ac_try="$ac_cpp conftest.$ac_ext"
|
||||||
|
case "(($ac_try" in
|
||||||
|
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||||
|
*) ac_try_echo=$ac_try;;
|
||||||
|
esac
|
||||||
|
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
||||||
|
(eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
|
||||||
|
ac_status=$?
|
||||||
|
grep -v '^ *+' conftest.er1 >conftest.err
|
||||||
|
rm -f conftest.er1
|
||||||
|
cat conftest.err >&5
|
||||||
|
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||||
|
(exit $ac_status); } >/dev/null && {
|
||||||
|
test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
|
||||||
|
test ! -s conftest.err
|
||||||
|
}; then
|
||||||
|
ac_header_preproc=yes
|
||||||
|
else
|
||||||
|
echo "$as_me: failed program was:" >&5
|
||||||
|
sed 's/^/| /' conftest.$ac_ext >&5
|
||||||
|
|
||||||
|
ac_header_preproc=no
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f conftest.err conftest.$ac_ext
|
||||||
|
{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
|
||||||
|
echo "${ECHO_T}$ac_header_preproc" >&6; }
|
||||||
|
|
||||||
|
# So? What about this header?
|
||||||
|
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
|
||||||
|
yes:no: )
|
||||||
|
{ echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
|
||||||
|
echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
|
||||||
|
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
|
||||||
|
echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
|
||||||
|
ac_header_preproc=yes
|
||||||
|
;;
|
||||||
|
no:yes:* )
|
||||||
|
{ echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
|
||||||
|
echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
|
||||||
|
{ echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
|
||||||
|
echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
|
||||||
|
{ echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
|
||||||
|
echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
|
||||||
|
{ echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
|
||||||
|
echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
|
||||||
|
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
|
||||||
|
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
|
||||||
|
{ echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
|
||||||
|
echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
|
||||||
|
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
{ echo "$as_me:$LINENO: checking for $ac_header" >&5
|
||||||
|
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
|
||||||
|
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
|
||||||
|
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||||
|
else
|
||||||
|
eval "$as_ac_Header=\$ac_header_preproc"
|
||||||
|
fi
|
||||||
|
ac_res=`eval echo '${'$as_ac_Header'}'`
|
||||||
|
{ echo "$as_me:$LINENO: result: $ac_res" >&5
|
||||||
|
echo "${ECHO_T}$ac_res" >&6; }
|
||||||
|
|
||||||
|
fi
|
||||||
|
if test `eval echo '${'$as_ac_Header'}'` = yes; then
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
for ac_func in setrlimit
|
||||||
|
do
|
||||||
|
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||||
|
{ echo "$as_me:$LINENO: checking for $ac_func" >&5
|
||||||
|
echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
|
||||||
|
if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
|
||||||
|
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||||
|
else
|
||||||
|
cat >conftest.$ac_ext <<_ACEOF
|
||||||
|
/* confdefs.h. */
|
||||||
|
_ACEOF
|
||||||
|
cat confdefs.h >>conftest.$ac_ext
|
||||||
|
cat >>conftest.$ac_ext <<_ACEOF
|
||||||
|
/* end confdefs.h. */
|
||||||
|
/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
|
||||||
|
For example, HP-UX 11i <limits.h> declares gettimeofday. */
|
||||||
|
#define $ac_func innocuous_$ac_func
|
||||||
|
|
||||||
|
/* System header to define __stub macros and hopefully few prototypes,
|
||||||
|
which can conflict with char $ac_func (); 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 $ac_func
|
||||||
|
|
||||||
|
/* 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 $ac_func ();
|
||||||
|
/* 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
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
return $ac_func ();
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||||
|
if { (ac_try="$ac_link"
|
||||||
|
case "(($ac_try" in
|
||||||
|
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||||
|
*) ac_try_echo=$ac_try;;
|
||||||
|
esac
|
||||||
|
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
||||||
|
(eval "$ac_link") 2>conftest.er1
|
||||||
|
ac_status=$?
|
||||||
|
grep -v '^ *+' conftest.er1 >conftest.err
|
||||||
|
rm -f conftest.er1
|
||||||
|
cat conftest.err >&5
|
||||||
|
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||||
|
(exit $ac_status); } && {
|
||||||
|
test -z "$ac_c_werror_flag" ||
|
||||||
|
test ! -s conftest.err
|
||||||
|
} && test -s conftest$ac_exeext &&
|
||||||
|
$as_test_x conftest$ac_exeext; then
|
||||||
|
eval "$as_ac_var=yes"
|
||||||
|
else
|
||||||
|
echo "$as_me: failed program was:" >&5
|
||||||
|
sed 's/^/| /' conftest.$ac_ext >&5
|
||||||
|
|
||||||
|
eval "$as_ac_var=no"
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
|
||||||
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
|
fi
|
||||||
|
ac_res=`eval echo '${'$as_ac_var'}'`
|
||||||
|
{ echo "$as_me:$LINENO: result: $ac_res" >&5
|
||||||
|
echo "${ECHO_T}$ac_res" >&6; }
|
||||||
|
if test `eval echo '${'$as_ac_var'}'` = yes; then
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# One of these functions needed by NSDebug.m and NSProcessInfo.m
|
# One of these functions needed by NSDebug.m and NSProcessInfo.m
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
|
|
25
configure.ac
25
configure.ac
|
@ -1397,12 +1397,29 @@ if test $ac_cv_header_poll_h = yes; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Check for pthread.h (only when building on Darwin machines)
|
# Check for pthread.h
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
AC_CHECK_HEADERS(pthread.h)
|
AC_CHECK_HEADERS(pthread.h)
|
||||||
HAVE_PTHREAD_H=no
|
HAVE_PTHREAD_H=no
|
||||||
if test $ac_cv_header_pthread_h = yes ; then
|
if test $ac_cv_header_pthread_h = yes ; then
|
||||||
HAVE_PTHREAD_H=yes
|
HAVE_PTHREAD_H=yes
|
||||||
|
if test x"$objc_threaded" != x""; then
|
||||||
|
saved_LIBS="$LIBS"
|
||||||
|
saved_CPPFLAGS="$CPPFLAGS"
|
||||||
|
LIBS="$LIBS $LIBOBJC"
|
||||||
|
CPPFLAGS="$CPPFLAGS $OBJCFLAGS -x objective-c"
|
||||||
|
LIBS="$LIBS $objc_threaded"
|
||||||
|
LIBS="$LIBS $extra_LIBS"
|
||||||
|
AC_TRY_RUN([#include "$srcdir/config/config.joinable.m"],
|
||||||
|
pthread_joinable=1, pthread_joinable=0,
|
||||||
|
pthread_joinable=1)
|
||||||
|
if test $pthread_joinable = 1; then
|
||||||
|
AC_DEFINE(PTHREAD_JOINABLE,1,
|
||||||
|
[Define if objc runtime creates joinable threads])
|
||||||
|
fi
|
||||||
|
LIBS="$saved_LIBS"
|
||||||
|
CPPFLAGS="$saved_CPPFLAGS"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
AC_SUBST(HAVE_PTHREAD_H)
|
AC_SUBST(HAVE_PTHREAD_H)
|
||||||
|
|
||||||
|
@ -1550,6 +1567,12 @@ AC_SUBST(HAVE_INET_PTON)
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
AC_CHECK_FUNCS(nanosleep usleep)
|
AC_CHECK_FUNCS(nanosleep usleep)
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# For setting thread stack size
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
AC_CHECK_HEADERS(sys/resource.h)
|
||||||
|
AC_CHECK_FUNCS(setrlimit)
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# One of these functions needed by NSDebug.m and NSProcessInfo.m
|
# One of these functions needed by NSDebug.m and NSProcessInfo.m
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue