aboutsummaryrefslogtreecommitdiff
path: root/libphobos/m4
diff options
context:
space:
mode:
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>2019-02-19 09:24:50 +0000
committerRainer Orth <ro@gcc.gnu.org>2019-02-19 09:24:50 +0000
commit1d679134724ae4baf615a90b1ab10ef734305f71 (patch)
treef45e307344fd941d9c177fe1e694585763c1dac9 /libphobos/m4
parent0db1a7c2e9eec808d271c1ad5c326713f9816dd3 (diff)
downloadgcc-1d679134724ae4baf615a90b1ab10ef734305f71.zip
gcc-1d679134724ae4baf615a90b1ab10ef734305f71.tar.gz
gcc-1d679134724ae4baf615a90b1ab10ef734305f71.tar.bz2
Fix libphobos linking on Solaris 11
* m4/druntime/libraries.m4 (DRUNTIME_LIBRARIES_NET): New macro. * configure.ac: Invoke it. * configure: Regenerate. From-SVN: r269012
Diffstat (limited to 'libphobos/m4')
-rw-r--r--libphobos/m4/druntime/libraries.m434
1 files changed, 34 insertions, 0 deletions
diff --git a/libphobos/m4/druntime/libraries.m4 b/libphobos/m4/druntime/libraries.m4
index 35a791d..41c8880 100644
--- a/libphobos/m4/druntime/libraries.m4
+++ b/libphobos/m4/druntime/libraries.m4
@@ -42,6 +42,40 @@ AC_DEFUN([DRUNTIME_LIBRARIES_DLOPEN],
])
+# DRUNTIME_LIBRARIES_NET
+# -----------------------
+# Autodetect and add networking library to LIBS if necessary.
+AC_DEFUN([DRUNTIME_LIBRARIES_NET],
+[
+ dnl Test for -lsocket and -lnsl. Copied from libjava/configure.ac.
+ AC_CACHE_CHECK([for socket libraries], druntime_cv_lib_sockets,
+ [druntime_cv_lib_sockets=
+ druntime_check_both=no
+ AC_CHECK_FUNC(connect, druntime_check_socket=no, druntime_check_socket=yes)
+ if test "$druntime_check_socket" = "yes"; then
+ unset ac_cv_func_connect
+ AC_CHECK_LIB(socket, main, druntime_cv_lib_sockets="-lsocket",
+ druntime_check_both=yes)
+ fi
+ if test "$druntime_check_both" = "yes"; then
+ druntime_old_libs=$LIBS
+ LIBS="$LIBS -lsocket -lnsl"
+ unset ac_cv_func_accept
+ AC_CHECK_FUNC(accept,
+ [druntime_check_nsl=no
+ druntime_cv_lib_sockets="-lsocket -lnsl"])
+ unset ac_cv_func_accept
+ LIBS=$druntime_old_libs
+ fi
+ unset ac_cv_func_gethostbyname
+ druntime_old_libs="$LIBS"
+ AC_CHECK_FUNC(gethostbyname, ,
+ [AC_CHECK_LIB(nsl, main,
+ [druntime_cv_lib_sockets="$druntime_cv_lib_sockets -lnsl"])])
+ ])
+ LIBS="$LIBS $druntime_cv_lib_sockets"
+])
+
# DRUNTIME_LIBRARIES_ZLIB
# -----------------------
# Allow specifying whether to use the system zlib or