galeb

Једноставна статичка дистрибуција заснована на musl-у
git clone https://git.sr.ht/~strahinja/galeb
Дневник | Датотеке | Референце | ПРОЧИТАЈМЕ | ЛИЦЕНЦА

0033-gcc-go-link-to-libucontext.patch (3033B)


      1 From ecc2a2e70e44fa76a75b12d0893bc1702b72a1b4 Mon Sep 17 00:00:00 2001
      2 From: Ian Lance Taylor <iant@golang.org>
      3 Date: Mon, 19 Dec 2022 10:37:06 -0800
      4 Subject: [PATCH] libgo: check for makecontext in -lucontext
      5 MIME-Version: 1.0
      6 Content-Type: text/plain; charset=UTF-8
      7 Content-Transfer-Encoding: 8bit
      8 
      9 Patch from Sören Tempel.
     10 
     11 Change-Id: I74b4052cc7aca19224afd6d9a2739c3fae46b722
     12 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/458396
     13 Reviewed-by: Cherry Mui <cherryyz@google.com>
     14 Reviewed-by: Than McIntosh <thanm@google.com>
     15 ---
     16  libgo/configure    | 57 ++++++++++++++++++++++++++++++++++++++++++++++
     17  libgo/configure.ac |  3 +++
     18  2 files changed, 60 insertions(+)
     19 
     20 diff --git a/libgo/configure b/libgo/configure
     21 index 460fdad7..a607dbff 100755
     22 --- a/libgo/configure
     23 +++ b/libgo/configure
     24 @@ -14818,6 +14818,63 @@ fi
     25  
     26  
     27  
     28 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing makecontext" >&5
     29 +$as_echo_n "checking for library containing makecontext... " >&6; }
     30 +if ${ac_cv_search_makecontext+:} false; then :
     31 +  $as_echo_n "(cached) " >&6
     32 +else
     33 +  ac_func_search_save_LIBS=$LIBS
     34 +cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     35 +/* end confdefs.h.  */
     36 +
     37 +/* Override any GCC internal prototype to avoid an error.
     38 +   Use char because int might match the return type of a GCC
     39 +   builtin and then its argument prototype would still apply.  */
     40 +#ifdef __cplusplus
     41 +extern "C"
     42 +#endif
     43 +char makecontext ();
     44 +int
     45 +main ()
     46 +{
     47 +return makecontext ();
     48 +  ;
     49 +  return 0;
     50 +}
     51 +_ACEOF
     52 +for ac_lib in '' ucontext; do
     53 +  if test -z "$ac_lib"; then
     54 +    ac_res="none required"
     55 +  else
     56 +    ac_res=-l$ac_lib
     57 +    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
     58 +  fi
     59 +  if ac_fn_c_try_link "$LINENO"; then :
     60 +  ac_cv_search_makecontext=$ac_res
     61 +fi
     62 +rm -f core conftest.err conftest.$ac_objext \
     63 +    conftest$ac_exeext
     64 +  if ${ac_cv_search_makecontext+:} false; then :
     65 +  break
     66 +fi
     67 +done
     68 +if ${ac_cv_search_makecontext+:} false; then :
     69 +
     70 +else
     71 +  ac_cv_search_makecontext=no
     72 +fi
     73 +rm conftest.$ac_ext
     74 +LIBS=$ac_func_search_save_LIBS
     75 +fi
     76 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_makecontext" >&5
     77 +$as_echo "$ac_cv_search_makecontext" >&6; }
     78 +ac_res=$ac_cv_search_makecontext
     79 +if test "$ac_res" != no; then :
     80 +  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
     81 +
     82 +fi
     83 +
     84 +
     85  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sched_yield" >&5
     86  $as_echo_n "checking for library containing sched_yield... " >&6; }
     87  if ${ac_cv_search_sched_yield+:} false; then :
     88 diff --git a/libgo/configure.ac b/libgo/configure.ac
     89 index 09554a37..a59aa091 100644
     90 --- a/libgo/configure.ac
     91 +++ b/libgo/configure.ac
     92 @@ -570,6 +570,9 @@ PTHREAD_LIBS=
     93  AC_CHECK_LIB([pthread], [pthread_create], PTHREAD_LIBS=-lpthread)
     94  AC_SUBST(PTHREAD_LIBS)
     95  
     96 +dnl Test if -lucontext is required for makecontext.
     97 +AC_SEARCH_LIBS([makecontext], [ucontext])
     98 +
     99  dnl Test if -lrt is required for sched_yield or nanosleep or clock_gettime.
    100  AC_SEARCH_LIBS([sched_yield], [rt])
    101  AC_SEARCH_LIBS([nanosleep], [rt])