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
This commit is contained in:
Rainer Orth 2015-01-20 09:26:50 +00:00 committed by Rainer Orth
parent 42df23a65e
commit 5bd8d5c12c
5 changed files with 131 additions and 6 deletions

View File

@ -1,3 +1,11 @@
2015-01-20 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* 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 <iant@google.com>
* configure.ac: Check for networking libraries; see NET_LIBS.

View File

@ -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

View File

@ -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

113
gotools/configure vendored
View File

@ -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"

View File

@ -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