Guess at fix for bug #30766

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31186 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2010-08-19 21:02:29 +00:00
parent f7193b19c0
commit e9f6822a09
5 changed files with 805 additions and 4 deletions

View file

@ -1,3 +1,10 @@
2010-08-19 Richard Frith-Macdonald <rfm@gnu.org>
* configure.ac: Check alignment of pthread types
* configure: Regenerate
* Headers/Additions/GNUstepBase/GSConfig.h.in: Record alignment
* Headers/Foundation/NSLock.h: Use alignment.
2010-08-18 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSNumber.m: Modifications to permit generation of NIBs that

View file

@ -216,6 +216,8 @@ typedef struct {
typedef struct {
uint8_t dummy[@GS_SIZEOF_MUTEX_T@];
} gs_mutex_t;
#define GS_ALIGNOF_COND_T @GS_ALIGNOF_COND_T@
#define GS_ALIGNOF_MUTEX_T @GS_ALIGNOF_MUTEX_T@
#define OBJC2RUNTIME @OBJC2RUNTIME@
#define BASE_NATIVE_OBJC_EXCEPTIONS @BASE_NATIVE_OBJC_EXCEPTIONS@

View file

@ -73,7 +73,7 @@ extern "C" {
{
#if GS_EXPOSE(NSLock)
@private
gs_mutex_t _mutex;
gs_mutex_t _mutex __attribute__((aligned(GS_ALIGNOF_MUTEX_T)));
NSString *_name;
#endif
}
@ -117,8 +117,8 @@ extern "C" {
{
#if GS_EXPOSE(NSCondition)
@private
gs_cond_t _condition;
gs_mutex_t _mutex;
gs_cond_t _condition __attribute__((aligned(GS_ALIGNOF_COND_T)));
gs_mutex_t _mutex __attribute__((aligned(GS_ALIGNOF_MUTEX_T)));
NSString *_name;
#endif
}
@ -260,7 +260,7 @@ extern "C" {
{
#if GS_EXPOSE(NSRecursiveLock)
@private
gs_mutex_t _mutex;
gs_mutex_t _mutex __attribute__((aligned(GS_ALIGNOF_MUTEX_T)));
NSString *_name;
#endif
}

778
configure vendored
View file

@ -682,6 +682,8 @@ DEFINE_UINT8_T
DEFINE_INT8_T
INCLUDE_STDINT
HAVE_PTS_STREAM_MODULES
GS_ALIGNOF_COND_T
GS_ALIGNOF_MUTEX_T
GS_SIZEOF_COND_T
GS_SIZEOF_MUTEX_T
HAVE_OBJC_SYNC_ENTER
@ -15214,6 +15216,782 @@ $as_echo "$as_me: error: Unable to find size of pthread_cond_t (required)." >&2;
fi
GS_SIZEOF_COND_T=$ac_cv_sizeof_pthread_cond_t
# The cast to long int works around a bug in the HP C Compiler,
# see AC_CHECK_SIZEOF for more information.
{ $as_echo "$as_me:$LINENO: checking alignment of pthread_mutex_t" >&5
$as_echo_n "checking alignment of pthread_mutex_t... " >&6; }
if test "${ac_cv_alignof_pthread_mutex_t+set}" = set; then
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then
# Depending upon the size, compute the lo and hi bounds.
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
#ifndef offsetof
# define offsetof(type, member) ((char *) &((type *) 0)->member - (char *) 0)
#endif
typedef struct { char x; pthread_mutex_t y; } ac__type_alignof_;
int
main ()
{
static int test_array [1 - 2 * !(((long int) offsetof (ac__type_alignof_, y)) >= 0)];
test_array [0] = 0
;
return 0;
}
_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$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
$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_objext; then
ac_lo=0 ac_mid=0
while :; do
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
#ifndef offsetof
# define offsetof(type, member) ((char *) &((type *) 0)->member - (char *) 0)
#endif
typedef struct { char x; pthread_mutex_t y; } ac__type_alignof_;
int
main ()
{
static int test_array [1 - 2 * !(((long int) offsetof (ac__type_alignof_, y)) <= $ac_mid)];
test_array [0] = 0
;
return 0;
}
_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$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
$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_objext; then
ac_hi=$ac_mid; break
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_lo=`expr $ac_mid + 1`
if test $ac_lo -le $ac_mid; then
ac_lo= ac_hi=
break
fi
ac_mid=`expr 2 '*' $ac_mid + 1`
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
done
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. */
$ac_includes_default
#ifndef offsetof
# define offsetof(type, member) ((char *) &((type *) 0)->member - (char *) 0)
#endif
typedef struct { char x; pthread_mutex_t y; } ac__type_alignof_;
int
main ()
{
static int test_array [1 - 2 * !(((long int) offsetof (ac__type_alignof_, y)) < 0)];
test_array [0] = 0
;
return 0;
}
_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$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
$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_objext; then
ac_hi=-1 ac_mid=-1
while :; do
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
#ifndef offsetof
# define offsetof(type, member) ((char *) &((type *) 0)->member - (char *) 0)
#endif
typedef struct { char x; pthread_mutex_t y; } ac__type_alignof_;
int
main ()
{
static int test_array [1 - 2 * !(((long int) offsetof (ac__type_alignof_, y)) >= $ac_mid)];
test_array [0] = 0
;
return 0;
}
_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$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
$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_objext; then
ac_lo=$ac_mid; break
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_hi=`expr '(' $ac_mid ')' - 1`
if test $ac_mid -le $ac_hi; then
ac_lo= ac_hi=
break
fi
ac_mid=`expr 2 '*' $ac_mid`
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
done
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_lo= ac_hi=
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
# Binary search between lo and hi bounds.
while test "x$ac_lo" != "x$ac_hi"; do
ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
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
#ifndef offsetof
# define offsetof(type, member) ((char *) &((type *) 0)->member - (char *) 0)
#endif
typedef struct { char x; pthread_mutex_t y; } ac__type_alignof_;
int
main ()
{
static int test_array [1 - 2 * !(((long int) offsetof (ac__type_alignof_, y)) <= $ac_mid)];
test_array [0] = 0
;
return 0;
}
_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$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
$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_objext; then
ac_hi=$ac_mid
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_lo=`expr '(' $ac_mid ')' + 1`
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
done
case $ac_lo in
?*) ac_cv_alignof_pthread_mutex_t=$ac_lo;;
'') if test "$ac_cv_type_pthread_mutex_t" = yes; then
{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
{ { $as_echo "$as_me:$LINENO: error: cannot compute alignment of pthread_mutex_t
See \`config.log' for more details." >&5
$as_echo "$as_me: error: cannot compute alignment of pthread_mutex_t
See \`config.log' for more details." >&2;}
{ (exit 77); exit 77; }; }; }
else
ac_cv_alignof_pthread_mutex_t=0
fi ;;
esac
else
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
#ifndef offsetof
# define offsetof(type, member) ((char *) &((type *) 0)->member - (char *) 0)
#endif
typedef struct { char x; pthread_mutex_t y; } ac__type_alignof_;
static long int longval () { return (long int) offsetof (ac__type_alignof_, y); }
static unsigned long int ulongval () { return (long int) offsetof (ac__type_alignof_, y); }
#include <stdio.h>
#include <stdlib.h>
int
main ()
{
FILE *f = fopen ("conftest.val", "w");
if (! f)
return 1;
if (((long int) offsetof (ac__type_alignof_, y)) < 0)
{
long int i = longval ();
if (i != ((long int) offsetof (ac__type_alignof_, y)))
return 1;
fprintf (f, "%ld", i);
}
else
{
unsigned long int i = ulongval ();
if (i != ((long int) offsetof (ac__type_alignof_, y)))
return 1;
fprintf (f, "%lu", i);
}
/* Do not output a trailing newline, as this causes \r\n confusion
on some platforms. */
return ferror (f) || fclose (f) != 0;
;
return 0;
}
_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_link") 2>&5
ac_status=$?
$as_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_try") 2>&5
ac_status=$?
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_alignof_pthread_mutex_t=`cat conftest.val`
else
$as_echo "$as_me: program exited with status $ac_status" >&5
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
if test "$ac_cv_type_pthread_mutex_t" = yes; then
{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
{ { $as_echo "$as_me:$LINENO: error: cannot compute alignment of pthread_mutex_t
See \`config.log' for more details." >&5
$as_echo "$as_me: error: cannot compute alignment of pthread_mutex_t
See \`config.log' for more details." >&2;}
{ (exit 77); exit 77; }; }; }
else
ac_cv_alignof_pthread_mutex_t=0
fi
fi
rm -rf conftest.dSYM
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
rm -f conftest.val
fi
{ $as_echo "$as_me:$LINENO: result: $ac_cv_alignof_pthread_mutex_t" >&5
$as_echo "$ac_cv_alignof_pthread_mutex_t" >&6; }
cat >>confdefs.h <<_ACEOF
#define ALIGNOF_PTHREAD_MUTEX_T $ac_cv_alignof_pthread_mutex_t
_ACEOF
GS_ALIGNOF_MUTEX_T=$ac_cv_alignof_pthread_mutex_t
if test $ac_cv_alignof_pthread_mutex_t = 0 ; then
{ { $as_echo "$as_me:$LINENO: error: Unable to find align of pthread_mutex_t (required)." >&5
$as_echo "$as_me: error: Unable to find align of pthread_mutex_t (required)." >&2;}
{ (exit 1); exit 1; }; }
fi
# The cast to long int works around a bug in the HP C Compiler,
# see AC_CHECK_SIZEOF for more information.
{ $as_echo "$as_me:$LINENO: checking alignment of pthread_cond_t" >&5
$as_echo_n "checking alignment of pthread_cond_t... " >&6; }
if test "${ac_cv_alignof_pthread_cond_t+set}" = set; then
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then
# Depending upon the size, compute the lo and hi bounds.
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
#ifndef offsetof
# define offsetof(type, member) ((char *) &((type *) 0)->member - (char *) 0)
#endif
typedef struct { char x; pthread_cond_t y; } ac__type_alignof_;
int
main ()
{
static int test_array [1 - 2 * !(((long int) offsetof (ac__type_alignof_, y)) >= 0)];
test_array [0] = 0
;
return 0;
}
_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$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
$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_objext; then
ac_lo=0 ac_mid=0
while :; do
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
#ifndef offsetof
# define offsetof(type, member) ((char *) &((type *) 0)->member - (char *) 0)
#endif
typedef struct { char x; pthread_cond_t y; } ac__type_alignof_;
int
main ()
{
static int test_array [1 - 2 * !(((long int) offsetof (ac__type_alignof_, y)) <= $ac_mid)];
test_array [0] = 0
;
return 0;
}
_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$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
$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_objext; then
ac_hi=$ac_mid; break
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_lo=`expr $ac_mid + 1`
if test $ac_lo -le $ac_mid; then
ac_lo= ac_hi=
break
fi
ac_mid=`expr 2 '*' $ac_mid + 1`
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
done
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. */
$ac_includes_default
#ifndef offsetof
# define offsetof(type, member) ((char *) &((type *) 0)->member - (char *) 0)
#endif
typedef struct { char x; pthread_cond_t y; } ac__type_alignof_;
int
main ()
{
static int test_array [1 - 2 * !(((long int) offsetof (ac__type_alignof_, y)) < 0)];
test_array [0] = 0
;
return 0;
}
_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$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
$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_objext; then
ac_hi=-1 ac_mid=-1
while :; do
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
#ifndef offsetof
# define offsetof(type, member) ((char *) &((type *) 0)->member - (char *) 0)
#endif
typedef struct { char x; pthread_cond_t y; } ac__type_alignof_;
int
main ()
{
static int test_array [1 - 2 * !(((long int) offsetof (ac__type_alignof_, y)) >= $ac_mid)];
test_array [0] = 0
;
return 0;
}
_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$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
$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_objext; then
ac_lo=$ac_mid; break
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_hi=`expr '(' $ac_mid ')' - 1`
if test $ac_mid -le $ac_hi; then
ac_lo= ac_hi=
break
fi
ac_mid=`expr 2 '*' $ac_mid`
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
done
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_lo= ac_hi=
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
# Binary search between lo and hi bounds.
while test "x$ac_lo" != "x$ac_hi"; do
ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
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
#ifndef offsetof
# define offsetof(type, member) ((char *) &((type *) 0)->member - (char *) 0)
#endif
typedef struct { char x; pthread_cond_t y; } ac__type_alignof_;
int
main ()
{
static int test_array [1 - 2 * !(((long int) offsetof (ac__type_alignof_, y)) <= $ac_mid)];
test_array [0] = 0
;
return 0;
}
_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$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
$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_objext; then
ac_hi=$ac_mid
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_lo=`expr '(' $ac_mid ')' + 1`
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
done
case $ac_lo in
?*) ac_cv_alignof_pthread_cond_t=$ac_lo;;
'') if test "$ac_cv_type_pthread_cond_t" = yes; then
{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
{ { $as_echo "$as_me:$LINENO: error: cannot compute alignment of pthread_cond_t
See \`config.log' for more details." >&5
$as_echo "$as_me: error: cannot compute alignment of pthread_cond_t
See \`config.log' for more details." >&2;}
{ (exit 77); exit 77; }; }; }
else
ac_cv_alignof_pthread_cond_t=0
fi ;;
esac
else
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
#ifndef offsetof
# define offsetof(type, member) ((char *) &((type *) 0)->member - (char *) 0)
#endif
typedef struct { char x; pthread_cond_t y; } ac__type_alignof_;
static long int longval () { return (long int) offsetof (ac__type_alignof_, y); }
static unsigned long int ulongval () { return (long int) offsetof (ac__type_alignof_, y); }
#include <stdio.h>
#include <stdlib.h>
int
main ()
{
FILE *f = fopen ("conftest.val", "w");
if (! f)
return 1;
if (((long int) offsetof (ac__type_alignof_, y)) < 0)
{
long int i = longval ();
if (i != ((long int) offsetof (ac__type_alignof_, y)))
return 1;
fprintf (f, "%ld", i);
}
else
{
unsigned long int i = ulongval ();
if (i != ((long int) offsetof (ac__type_alignof_, y)))
return 1;
fprintf (f, "%lu", i);
}
/* Do not output a trailing newline, as this causes \r\n confusion
on some platforms. */
return ferror (f) || fclose (f) != 0;
;
return 0;
}
_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_link") 2>&5
ac_status=$?
$as_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_try") 2>&5
ac_status=$?
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_alignof_pthread_cond_t=`cat conftest.val`
else
$as_echo "$as_me: program exited with status $ac_status" >&5
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
if test "$ac_cv_type_pthread_cond_t" = yes; then
{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
{ { $as_echo "$as_me:$LINENO: error: cannot compute alignment of pthread_cond_t
See \`config.log' for more details." >&5
$as_echo "$as_me: error: cannot compute alignment of pthread_cond_t
See \`config.log' for more details." >&2;}
{ (exit 77); exit 77; }; }; }
else
ac_cv_alignof_pthread_cond_t=0
fi
fi
rm -rf conftest.dSYM
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
rm -f conftest.val
fi
{ $as_echo "$as_me:$LINENO: result: $ac_cv_alignof_pthread_cond_t" >&5
$as_echo "$ac_cv_alignof_pthread_cond_t" >&6; }
cat >>confdefs.h <<_ACEOF
#define ALIGNOF_PTHREAD_COND_T $ac_cv_alignof_pthread_cond_t
_ACEOF
if test $ac_cv_alignof_pthread_cond_t = 0 ; then
{ { $as_echo "$as_me:$LINENO: error: Unable to find align of pthread_cond_t (required)." >&5
$as_echo "$as_me: error: Unable to find align of pthread_cond_t (required)." >&2;}
{ (exit 1); exit 1; }; }
fi
GS_ALIGNOF_COND_T=$ac_cv_alignof_pthread_cond_t
else
{ { $as_echo "$as_me:$LINENO: error: Unable to find pthread.h (needed for thread support)." >&5
$as_echo "$as_me: error: Unable to find pthread.h (needed for thread support)." >&2;}

View file

@ -1788,6 +1788,20 @@ if test $ac_cv_header_pthread_h = yes ; then
fi
GS_SIZEOF_COND_T=$ac_cv_sizeof_pthread_cond_t
AC_SUBST(GS_SIZEOF_COND_T)
AC_CHECK_ALIGNOF(pthread_mutex_t,,[AC_INCLUDES_DEFAULT
#include <pthread.h>])
GS_ALIGNOF_MUTEX_T=$ac_cv_alignof_pthread_mutex_t
if test $ac_cv_alignof_pthread_mutex_t = 0 ; then
AC_MSG_ERROR([Unable to find align of pthread_mutex_t (required).])
fi
AC_SUBST(GS_ALIGNOF_MUTEX_T)
AC_CHECK_ALIGNOF(pthread_cond_t,,[AC_INCLUDES_DEFAULT
#include <pthread.h>])
if test $ac_cv_alignof_pthread_cond_t = 0 ; then
AC_MSG_ERROR([Unable to find align of pthread_cond_t (required).])
fi
GS_ALIGNOF_COND_T=$ac_cv_alignof_pthread_cond_t
AC_SUBST(GS_ALIGNOF_COND_T)
else
AC_MSG_ERROR([Unable to find pthread.h (needed for thread support).])
fi