change tests for pthread_setname_np

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38221 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2014-12-02 06:52:55 +00:00
parent f7c21dd5d1
commit 7ad1a2c134
2 changed files with 169 additions and 133 deletions

265
configure vendored
View file

@ -13711,9 +13711,13 @@ CFLAGS=$saved_CFLAGS
#--------------------------------------------------------------------
{ $as_echo "$as_me:$LINENO: checking for pthread_setname_np" >&5
$as_echo_n "checking for pthread_setname_np... " >&6; }
if test "${ac_cv_func_pthread_setname_np+set}" = set; then
for ac_func in pthread_set_name_np
do
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
$as_echo_n "checking for $ac_func... " >&6; }
if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
$as_echo_n "(cached) " >&6
else
cat >conftest.$ac_ext <<_ACEOF
@ -13722,12 +13726,12 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Define pthread_setname_np to an innocuous variant, in case <limits.h> declares pthread_setname_np.
/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
For example, HP-UX 11i <limits.h> declares gettimeofday. */
#define pthread_setname_np innocuous_pthread_setname_np
#define $ac_func innocuous_$ac_func
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char pthread_setname_np (); below.
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. */
@ -13737,7 +13741,7 @@ cat >>conftest.$ac_ext <<_ACEOF
# include <assert.h>
#endif
#undef pthread_setname_np
#undef $ac_func
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
@ -13745,18 +13749,18 @@ cat >>conftest.$ac_ext <<_ACEOF
#ifdef __cplusplus
extern "C"
#endif
char pthread_setname_np ();
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_pthread_setname_np || defined __stub___pthread_setname_np
#if defined __stub_$ac_func || defined __stub___$ac_func
choke me
#endif
int
main ()
{
return pthread_setname_np ();
return $ac_func ();
;
return 0;
}
@ -13782,141 +13786,158 @@ $as_echo "$ac_try_echo") >&5
test "$cross_compiling" = yes ||
$as_test_x conftest$ac_exeext
}; then
ac_cv_func_pthread_setname_np=yes
eval "$as_ac_var=yes"
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_func_pthread_setname_np=no
eval "$as_ac_var=no"
fi
rm -rf conftest.dSYM
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_pthread_setname_np" >&5
$as_echo "$ac_cv_func_pthread_setname_np" >&6; }
if test "x$ac_cv_func_pthread_setname_np" = x""yes; then
pthread_setname_ok=yes
ac_res=`eval 'as_val=${'$as_ac_var'}
$as_echo "$as_val"'`
{ $as_echo "$as_me:$LINENO: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
as_val=`eval 'as_val=${'$as_ac_var'}
$as_echo "$as_val"'`
if test "x$as_val" = x""yes; then
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
if test $ac_cv_func_pthread_set_name_np == yes; then
cat >>confdefs.h <<\_ACEOF
#define PTHREAD_SETNAME(a,b) pthread_set_name_np(b)
_ACEOF
else
pthread_setname_ok=no
{ $as_echo "$as_me:$LINENO: checking for pthread_setname_np() variant" >&5
$as_echo_n "checking for pthread_setname_np() variant... " >&6; }
if test "${gs_cv_pthread_setname_np+set}" = set; then
$as_echo_n "(cached) " >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <pthread.h>
int
main ()
{
pthread_setname_np(pthread_self(), "name");
;
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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$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
$as_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 && {
test "$cross_compiling" = yes ||
$as_test_x conftest$ac_exeext
}; then
gs_cv_pthread_setname_np=glibc
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <pthread.h>
int
main ()
{
pthread_setname_np(pthread_self(), "%s", "name");
;
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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$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
$as_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 && {
test "$cross_compiling" = yes ||
$as_test_x conftest$ac_exeext
}; then
gs_cv_pthread_setname_np=netbsd
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
gs_cv_pthread_setname_np=none
fi
if test $pthread_setname_ok = yes ; then
case "$target_os" in
darwin*)
cat >>confdefs.h <<\_ACEOF
#define PTHREAD_SETNAME(a,b) pthread_setname_np(b)
_ACEOF
;;
*)
rm -rf conftest.dSYM
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
fi
rm -rf conftest.dSYM
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:$LINENO: result: $gs_cv_pthread_setname_np" >&5
$as_echo "$gs_cv_pthread_setname_np" >&6; }
case $gs_cv_pthread_setname_np in
glibc)
cat >>confdefs.h <<\_ACEOF
#define PTHREAD_SETNAME(a,b) pthread_setname_np(a,b)
_ACEOF
;;
esac
fi
{ $as_echo "$as_me:$LINENO: checking for pthread_set_name_np" >&5
$as_echo_n "checking for pthread_set_name_np... " >&6; }
if test "${ac_cv_func_pthread_set_name_np+set}" = set; then
$as_echo_n "(cached) " >&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 pthread_set_name_np to an innocuous variant, in case <limits.h> declares pthread_set_name_np.
For example, HP-UX 11i <limits.h> declares gettimeofday. */
#define pthread_set_name_np innocuous_pthread_set_name_np
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char pthread_set_name_np (); 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 pthread_set_name_np
/* 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 pthread_set_name_np ();
/* 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_pthread_set_name_np || defined __stub___pthread_set_name_np
choke me
#endif
int
main ()
{
return pthread_set_name_np ();
;
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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$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
$as_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 && {
test "$cross_compiling" = yes ||
$as_test_x conftest$ac_exeext
}; then
ac_cv_func_pthread_set_name_np=yes
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_func_pthread_set_name_np=no
fi
rm -rf conftest.dSYM
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_pthread_set_name_np" >&5
$as_echo "$ac_cv_func_pthread_set_name_np" >&6; }
if test "x$ac_cv_func_pthread_set_name_np" = x""yes; then
pthread_set_name_ok=yes
else
pthread_set_name_ok=no
fi
if test $pthread_set_name_ok = yes ; then
;;
netbsd)
cat >>confdefs.h <<\_ACEOF
#define PTHREAD_SETNAME(a,b) pthread_set_name_np(a,b)
#define PTHREAD_SETNAME(a,b) pthread_setname_np(a,"%s",b)
_ACEOF
;;
esac
fi
#--------------------------------------------------------------------
# Check whether Objective-C /really/ works
#--------------------------------------------------------------------

View file

@ -1749,20 +1749,35 @@ CFLAGS=$saved_CFLAGS
#--------------------------------------------------------------------
AC_CHECK_FUNC(pthread_setname_np, pthread_setname_ok=yes, pthread_setname_ok=no)
if test $pthread_setname_ok = yes ; then
case "$target_os" in
darwin*) AC_DEFINE(PTHREAD_SETNAME(a,b), pthread_setname_np(b), [Description: Define set name function for pthread]);;
*) AC_DEFINE(PTHREAD_SETNAME(a,b), pthread_setname_np(a,b), [Description: Define set name function for pthread]);;
AC_CHECK_FUNCS(pthread_set_name_np)
if test $ac_cv_func_pthread_set_name_np == yes; then
AC_DEFINE(PTHREAD_SETNAME(a,b), pthread_set_name_np(b),
[Description: Define set name function for pthread])
else
AC_CACHE_CHECK(
[for pthread_setname_np() variant],
[gs_cv_pthread_setname_np],
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <pthread.h>],
[pthread_setname_np(pthread_self(), "name");])],
[gs_cv_pthread_setname_np=glibc],
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <pthread.h>],
[pthread_setname_np(pthread_self(), "%s", "name");])],
[gs_cv_pthread_setname_np=netbsd],
[gs_cv_pthread_setname_np=none])])])
case $gs_cv_pthread_setname_np in
glibc)
AC_DEFINE(PTHREAD_SETNAME(a,b), pthread_setname_np(a,b),
[Description: Define set name function for pthread])
;;
netbsd)
AC_DEFINE(PTHREAD_SETNAME(a,b), pthread_setname_np(a,"%s",b),
[Description: Define set name function for pthread])
;;
esac
fi
AC_CHECK_FUNC(pthread_set_name_np, pthread_set_name_ok=yes, pthread_set_name_ok=no)
if test $pthread_set_name_ok = yes ; then
AC_DEFINE(PTHREAD_SETNAME(a,b), pthread_set_name_np(a,b), [Description: Define set name function for pthread])
fi
#--------------------------------------------------------------------
# Check whether Objective-C /really/ works
#--------------------------------------------------------------------