diff options
author | Ian Lance Taylor <iant@google.com> | 2015-01-15 21:10:09 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2015-01-15 21:10:09 +0000 |
commit | 85d7b5d5c5b7d1f104ed4dc2715161af433dc623 (patch) | |
tree | d7791736c11d37fedba56b5a8151135228f45634 /gotools/configure.ac | |
parent | 199b7a3586061f951fa737656217206164456910 (diff) | |
download | gcc-85d7b5d5c5b7d1f104ed4dc2715161af433dc623.zip gcc-85d7b5d5c5b7d1f104ed4dc2715161af433dc623.tar.gz gcc-85d7b5d5c5b7d1f104ed4dc2715161af433dc623.tar.bz2 |
configure.ac: Check for networking libraries; see NET_LIBS.
* configure.ac: Check for networking libraries; see NET_LIBS.
* Makefile.am (go$(EXEEXT)): Link against NET_LIBS.
(gofmt$(EXEEXT), cgo$(EXEEXT)): Likewise.
* configure, Makefile.in: Rebuild.
From-SVN: r219690
Diffstat (limited to 'gotools/configure.ac')
-rw-r--r-- | gotools/configure.ac | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/gotools/configure.ac b/gotools/configure.ac index ddc26fb..24f4498 100644 --- a/gotools/configure.ac +++ b/gotools/configure.ac @@ -48,6 +48,37 @@ AC_PROG_GO AM_CONDITIONAL(NATIVE, test "$cross_compiling" = no) +dnl Test for -lsocket and -lnsl. Copied from libjava/configure.ac. +AC_CACHE_CHECK([for socket libraries], gotools_cv_lib_sockets, + [gotools_cv_lib_sockets= + gotools_check_both=no + AC_CHECK_FUNC(connect, gotools_check_socket=no, gotools_check_socket=yes) + if test "$gotools_check_socket" = "yes"; then + unset ac_cv_func_connect + AC_CHECK_LIB(socket, main, gotools_cv_lib_sockets="-lsocket", + gotools_check_both=yes) + fi + if test "$gotools_check_both" = "yes"; then + gotools_old_libs=$LIBS + LIBS="$LIBS -lsocket -lnsl" + unset ac_cv_func_accept + AC_CHECK_FUNC(accept, + [gotools_check_nsl=no + gotools_cv_lib_sockets="-lsocket -lnsl"]) + unset ac_cv_func_accept + LIBS=$gotools_old_libs + fi + unset ac_cv_func_gethostbyname + gotools_old_libs="$LIBS" + AC_CHECK_FUNC(gethostbyname, , + [AC_CHECK_LIB(nsl, main, + [gotools_cv_lib_sockets="$gotools_cv_lib_sockets -lnsl"])]) + unset ac_cv_func_gethostbyname + LIBS=$gotools_old_libs +]) +NET_LIBS="$gotools_cv_lib_sockets" +AC_SUBST(NET_LIBS) + AC_CONFIG_FILES(Makefile) AC_OUTPUT |