From 5bd8d5c12cf5bdef08a24dd6223bdf30cc0a03d3 Mon Sep 17 00:00:00 2001 From: Rainer Orth Date: Tue, 20 Jan 2015 09:26:50 +0000 Subject: [PATCH] Link with -lrt on Solaris 10 * configure.ac: Check if sched_yield and/or nanosleep need -lrt. * configure: Regenerate. * Makefile.am (go$(EXEEXT), gofmt$(EXEEXT), cgo$(EXEEXT)): Link with $(LIBS). * Makefile.in: Regenerate. From-SVN: r219882 --- gotools/ChangeLog | 8 +++ gotools/Makefile.am | 6 +-- gotools/Makefile.in | 6 +-- gotools/configure | 113 +++++++++++++++++++++++++++++++++++++++++++ gotools/configure.ac | 4 ++ 5 files changed, 131 insertions(+), 6 deletions(-) diff --git a/gotools/ChangeLog b/gotools/ChangeLog index 5746d2c725f..11cb109f5e3 100644 --- a/gotools/ChangeLog +++ b/gotools/ChangeLog @@ -1,3 +1,11 @@ +2015-01-20 Rainer Orth + + * configure.ac: Check if sched_yield and/or nanosleep need -lrt. + * configure: Regenerate. + * Makefile.am (go$(EXEEXT), gofmt$(EXEEXT), cgo$(EXEEXT)): Link + with $(LIBS). + * Makefile.in: Regenerate. + 2015-01-15 Ian Lance Taylor * configure.ac: Check for networking libraries; see NET_LIBS. diff --git a/gotools/Makefile.am b/gotools/Makefile.am index 41802efb891..5e044d29056 100644 --- a/gotools/Makefile.am +++ b/gotools/Makefile.am @@ -108,11 +108,11 @@ bin_PROGRAMS = go$(EXEEXT) gofmt$(EXEEXT) libexecsub_PROGRAMS = cgo$(EXEEXT) go$(EXEEXT): $(go_cmd_go_files) zdefaultcc.go $(LIBGODEP) - $(GOLINK) $(go_cmd_go_files) zdefaultcc.go $(NET_LIBS) + $(GOLINK) $(go_cmd_go_files) zdefaultcc.go $(LIBS) $(NET_LIBS) gofmt$(EXEEXT): $(go_cmd_gofmt_files) $(LIBGODEP) - $(GOLINK) $(go_cmd_gofmt_files) $(NET_LIBS) + $(GOLINK) $(go_cmd_gofmt_files) $(LIBS) $(NET_LIBS) cgo$(EXEEXT): $(go_cmd_cgo_files) zdefaultcc.go $(LIBGODEP) - $(GOLINK) $(go_cmd_cgo_files) zdefaultcc.go $(NET_LIBS) + $(GOLINK) $(go_cmd_cgo_files) zdefaultcc.go $(LIBS) $(NET_LIBS) else diff --git a/gotools/Makefile.in b/gotools/Makefile.in index 295c68d9844..8279d9a7dce 100644 --- a/gotools/Makefile.in +++ b/gotools/Makefile.in @@ -590,11 +590,11 @@ s-zdefaultcc: Makefile $(STAMP) $@ @NATIVE_TRUE@go$(EXEEXT): $(go_cmd_go_files) zdefaultcc.go $(LIBGODEP) -@NATIVE_TRUE@ $(GOLINK) $(go_cmd_go_files) zdefaultcc.go $(NET_LIBS) +@NATIVE_TRUE@ $(GOLINK) $(go_cmd_go_files) zdefaultcc.go $(LIBS) $(NET_LIBS) @NATIVE_TRUE@gofmt$(EXEEXT): $(go_cmd_gofmt_files) $(LIBGODEP) -@NATIVE_TRUE@ $(GOLINK) $(go_cmd_gofmt_files) $(NET_LIBS) +@NATIVE_TRUE@ $(GOLINK) $(go_cmd_gofmt_files) $(LIBS) $(NET_LIBS) @NATIVE_TRUE@cgo$(EXEEXT): $(go_cmd_cgo_files) zdefaultcc.go $(LIBGODEP) -@NATIVE_TRUE@ $(GOLINK) $(go_cmd_cgo_files) zdefaultcc.go $(NET_LIBS) +@NATIVE_TRUE@ $(GOLINK) $(go_cmd_cgo_files) zdefaultcc.go $(LIBS) $(NET_LIBS) # For a non-native build we have to build the programs using a # previously built host (or build -> host) Go compiler. We should diff --git a/gotools/configure b/gotools/configure index bc9332e1ed2..21be4655a3f 100755 --- a/gotools/configure +++ b/gotools/configure @@ -3907,6 +3907,119 @@ $as_echo "$gotools_cv_lib_sockets" >&6; } NET_LIBS="$gotools_cv_lib_sockets" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sched_yield" >&5 +$as_echo_n "checking for library containing sched_yield... " >&6; } +if test "${ac_cv_search_sched_yield+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* 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 sched_yield (); +int +main () +{ +return sched_yield (); + ; + return 0; +} +_ACEOF +for ac_lib in '' rt; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_sched_yield=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if test "${ac_cv_search_sched_yield+set}" = set; then : + break +fi +done +if test "${ac_cv_search_sched_yield+set}" = set; then : + +else + ac_cv_search_sched_yield=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_sched_yield" >&5 +$as_echo "$ac_cv_search_sched_yield" >&6; } +ac_res=$ac_cv_search_sched_yield +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing nanosleep" >&5 +$as_echo_n "checking for library containing nanosleep... " >&6; } +if test "${ac_cv_search_nanosleep+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* 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 nanosleep (); +int +main () +{ +return nanosleep (); + ; + return 0; +} +_ACEOF +for ac_lib in '' rt; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_nanosleep=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if test "${ac_cv_search_nanosleep+set}" = set; then : + break +fi +done +if test "${ac_cv_search_nanosleep+set}" = set; then : + +else + ac_cv_search_nanosleep=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_nanosleep" >&5 +$as_echo "$ac_cv_search_nanosleep" >&6; } +ac_res=$ac_cv_search_nanosleep +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + + ac_config_files="$ac_config_files Makefile" diff --git a/gotools/configure.ac b/gotools/configure.ac index 24f4498d279..e4528a4f31e 100644 --- a/gotools/configure.ac +++ b/gotools/configure.ac @@ -79,6 +79,10 @@ AC_CACHE_CHECK([for socket libraries], gotools_cv_lib_sockets, NET_LIBS="$gotools_cv_lib_sockets" AC_SUBST(NET_LIBS) +dnl Test if -lrt is required for sched_yield and/or nanosleep. +AC_SEARCH_LIBS([sched_yield], [rt]) +AC_SEARCH_LIBS([nanosleep], [rt]) + AC_CONFIG_FILES(Makefile) AC_OUTPUT -- 2.30.2