Skip to content

Commit ae0b1ba

Browse files
committed
libstdc++-v3: update configure for std::thread via gthr-posix.h
Regenerate the ./configure script with zephyr-specific conditions to enable std::thread, std::mutex, std::condition_variable, std::binary_semaphore, std::counting_semaphore, etc. Signed-off-by: Chris Friedt <[email protected]>
1 parent c009159 commit ae0b1ba

File tree

2 files changed

+71
-3
lines changed

2 files changed

+71
-3
lines changed

libstdc++-v3/acinclude.m4

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1602,10 +1602,15 @@ AC_DEFUN([GLIBCXX_CHECK_GETTIMEOFDAY], [
16021602
16031603
AC_MSG_CHECKING([for gettimeofday])
16041604
1605+
runtests=yes
16051606
ac_has_gettimeofday=no
1607+
ac_has_sys_time_h=no
1608+
16061609
case "${target}" in
16071610
*zephyr*)
1611+
runtests=no
16081612
ac_has_gettimeofday=yes
1613+
ac_has_sys_time_h=yes
16091614
;;
16101615
esac
16111616
@@ -1614,13 +1619,17 @@ AC_DEFUN([GLIBCXX_CHECK_GETTIMEOFDAY], [
16141619
ac_save_CXXFLAGS="$CXXFLAGS"
16151620
CXXFLAGS="$CXXFLAGS -fno-exceptions"
16161621
1617-
if test x"$ac_has_gettimeofday" != x"yes"; then
1622+
if test x"$runtests" = x"yes"; then
16181623
AC_CHECK_HEADERS(sys/time.h, ac_has_sys_time_h=yes, ac_has_sys_time_h=no)
1624+
fi
1625+
16191626
if test x"$ac_has_sys_time_h" = x"yes"; then
16201627
AC_MSG_CHECKING([for gettimeofday])
1628+
if test x"$runtests" = x"yes"; then
16211629
GCC_TRY_COMPILE_OR_LINK([#include <sys/time.h>],
16221630
[timeval tv; gettimeofday(&tv, 0);],
16231631
[ac_has_gettimeofday=yes], [ac_has_gettimeofday=no])
1632+
fi
16241633
16251634
AC_MSG_RESULT($ac_has_gettimeofday)
16261635
fi

libstdc++-v3/configure

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20396,6 +20396,17 @@ fi
2039620396
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gettimeofday" >&5
2039720397
$as_echo_n "checking for gettimeofday... " >&6; }
2039820398

20399+
runtests=yes
20400+
ac_has_gettimeofday=no
20401+
ac_has_sys_time_h=no
20402+
20403+
case "${target}" in
20404+
*zephyr*)
20405+
runtests=no
20406+
ac_has_gettimeofday=yes
20407+
ac_has_sys_time_h=yes
20408+
;;
20409+
esac
2039920410

2040020411
ac_ext=cpp
2040120412
ac_cpp='$CXXCPP $CPPFLAGS'
@@ -20406,7 +20417,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
2040620417
ac_save_CXXFLAGS="$CXXFLAGS"
2040720418
CXXFLAGS="$CXXFLAGS -fno-exceptions"
2040820419

20409-
ac_has_gettimeofday=no;
20420+
if test x"$runtests" = x"yes"; then
2041020421
for ac_header in sys/time.h
2041120422
do :
2041220423
ac_fn_cxx_check_header_mongrel "$LINENO" "sys/time.h" "ac_cv_header_sys_time_h" "$ac_includes_default"
@@ -20420,10 +20431,12 @@ else
2042020431
fi
2042120432

2042220433
done
20434+
fi
2042320435

2042420436
if test x"$ac_has_sys_time_h" = x"yes"; then
2042520437
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gettimeofday" >&5
2042620438
$as_echo_n "checking for gettimeofday... " >&6; }
20439+
if test x"$runtests" = x"yes"; then
2042720440
if test x$gcc_no_link = xyes; then
2042820441
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2042920442
/* end confdefs.h. */
@@ -20464,11 +20477,12 @@ else
2046420477
fi
2046520478
rm -f core conftest.err conftest.$ac_objext \
2046620479
conftest$ac_exeext conftest.$ac_ext
20480+
fi
20481+
fi
2046720482
fi
2046820483

2046920484
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_has_gettimeofday" >&5
2047020485
$as_echo "$ac_has_gettimeofday" >&6; }
20471-
fi
2047220486

2047320487
if test x"$ac_has_gettimeofday" = x"yes"; then
2047420488

@@ -20517,6 +20531,8 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
2051720531
ac_has_clock_realtime=no
2051820532
ac_has_nanosleep=no
2051920533
ac_has_sched_yield=no
20534+
ac_has_sleep=no
20535+
ac_has_usleep=no
2052020536

2052120537
if test x"$enable_libstdcxx_time" = x"auto"; then
2052220538

@@ -20626,6 +20642,17 @@ fi
2062620642
ac_has_sched_yield=yes
2062720643
esac
2062820644

20645+
case "${target}" in
20646+
*zephyr*)
20647+
ac_has_clock_monotonic=yes
20648+
ac_has_clock_realtime=yes
20649+
ac_has_nanosleep=yes
20650+
ac_has_sched_yield=yes
20651+
ac_has_sleep=yes
20652+
ac_has_usleep=yes
20653+
;;
20654+
esac
20655+
2062920656
elif test x"$enable_libstdcxx_time" != x"no"; then
2063020657

2063120658
if test x"$enable_libstdcxx_time" = x"rt"; then
@@ -76041,6 +76068,23 @@ else
7604176068
fi
7604276069

7604376070

76071+
runtests=yes
76072+
ac_gthread_use_mutex_timedlock=no
76073+
ac_has_gthreads=no
76074+
ac_gthread_use_pthreads=no
76075+
ac_have_posix_semaphore=no
76076+
ac_gthread_use_pthreads_rwlock_t=no
76077+
76078+
case "${target}" in
76079+
*zephyr*)
76080+
runtests=no
76081+
ac_gthread_use_mutex_timedlock=yes
76082+
ac_has_gthreads=yes
76083+
ac_gthread_use_pthreads=yes
76084+
ac_have_posix_semaphore=yes
76085+
ac_gthread_use_pthreads_rwlock_t=yes
76086+
;;
76087+
esac
7604476088

7604576089
if test x$enable_libstdcxx_threads = xauto ||
7604676090
test x$enable_libstdcxx_threads = xyes; then
@@ -76066,6 +76110,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
7606676110
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it can be safely assumed that mutex_timedlock is available" >&5
7606776111
$as_echo_n "checking whether it can be safely assumed that mutex_timedlock is available... " >&6; }
7606876112

76113+
if x"$runtests" = x"yes"; then
7606976114
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
7607076115
/* end confdefs.h. */
7607176116
#include <unistd.h>
@@ -76089,6 +76134,7 @@ else
7608976134
ac_gthread_use_mutex_timedlock=0
7609076135
fi
7609176136
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
76137+
fi
7609276138

7609376139

7609476140
cat >>confdefs.h <<_ACEOF
@@ -76104,6 +76150,7 @@ $as_echo "$res_mutex_timedlock" >&6; }
7610476150
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gthreads library" >&5
7610576151
$as_echo_n "checking for gthreads library... " >&6; }
7610676152

76153+
if x"$runtests" = x"yes"; then
7610776154
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
7610876155
/* end confdefs.h. */
7610976156
#include "gthr.h"
@@ -76128,6 +76175,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
7612876175
else
7612976176
ac_has_gthreads=no
7613076177
fi
76178+
fi
7613176179

7613276180
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_has_gthreads" >&5
7613376181
$as_echo "$ac_has_gthreads" >&6; }
@@ -76142,6 +76190,7 @@ $as_echo "#define _GLIBCXX_HAS_GTHREADS 1" >>confdefs.h
7614276190
# On VxWorks for example, pthread_rwlock_t is defined in sys/types.h
7614376191
# but the pthread library is not there by default and the gthread library
7614476192
# does not use it.
76193+
if x"$runtests" = x"yes"; then
7614576194
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
7614676195
/* end confdefs.h. */
7614776196
#include "gthr.h"
@@ -76163,18 +76212,27 @@ else
7616376212
ac_gthread_use_pthreads=no
7616476213
fi
7616576214
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
76215+
fi
7616676216
if test x"$ac_gthread_use_pthreads" = x"yes"; then
76217+
if x"$runtests" = x"yes"; then
7616776218
ac_fn_cxx_check_type "$LINENO" "pthread_rwlock_t" "ac_cv_type_pthread_rwlock_t" "#include \"gthr.h\"
7616876219
"
7616976220
if test "x$ac_cv_type_pthread_rwlock_t" = xyes; then :
7617076221

7617176222
$as_echo "#define _GLIBCXX_USE_PTHREAD_RWLOCK_T 1" >>confdefs.h
7617276223

7617376224
fi
76225+
else
76226+
if test "x$ac_cv_type_pthread_rwlock_t" = xyes; then :
7617476227

76228+
$as_echo "#define _GLIBCXX_USE_PTHREAD_RWLOCK_T 1" >>confdefs.h
76229+
76230+
fi
76231+
fi
7617576232
fi
7617676233
fi
7617776234

76235+
if x"$runtests" = x"yes"; then
7617876236
ac_fn_cxx_check_header_mongrel "$LINENO" "semaphore.h" "ac_cv_header_semaphore_h" "$ac_includes_default"
7617976237
if test "x$ac_cv_header_semaphore_h" = xyes; then :
7618076238

@@ -76222,6 +76280,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
7622276280
else
7622376281
ac_have_posix_semaphore=no
7622476282
fi
76283+
fi
7622576284

7622676285

7622776286

0 commit comments

Comments
 (0)