diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2020-04-27 02:09:43 +0200 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2020-04-27 02:47:27 +0200 |
commit | 5e7f8c55c2ca634cec729d2d3fa0f2c13614168c (patch) | |
tree | 7d4caa43c42855c73bb46372b810b4d726dfd7e5 /libphobos/m4 | |
parent | 873b5de87c3186d85bb497b0f9c13b8c5e425712 (diff) | |
download | gcc-5e7f8c55c2ca634cec729d2d3fa0f2c13614168c.zip gcc-5e7f8c55c2ca634cec729d2d3fa0f2c13614168c.tar.gz gcc-5e7f8c55c2ca634cec729d2d3fa0f2c13614168c.tar.bz2 |
libphobos: Remove AC_CACHE_CHECK from network library tests.
libphobos/ChangeLog:
* configure: Regenerate.
* m4/druntime/libraries.m4 (DRUNTIME_LIBRARIES_NET): Remove
AC_CACHE_CHECK, simplify by setting LIBS directly.
Diffstat (limited to 'libphobos/m4')
-rw-r--r-- | libphobos/m4/druntime/libraries.m4 | 51 |
1 files changed, 24 insertions, 27 deletions
diff --git a/libphobos/m4/druntime/libraries.m4 b/libphobos/m4/druntime/libraries.m4 index 957bf98..743d3e3 100644 --- a/libphobos/m4/druntime/libraries.m4 +++ b/libphobos/m4/druntime/libraries.m4 @@ -21,33 +21,30 @@ AC_DEFUN([DRUNTIME_LIBRARIES_DLOPEN], # 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" + dnl Check for the existence of the -lsocket and -lnsl libraries. + dnl The order here is important, so that they end up in the right + dnl order in the command line generated by make. Here are some + dnl special considerations: + dnl 1. Use "connect" and "accept" to check for -lsocket, and + dnl "gethostbyname" to check for -lnsl. + dnl 2. Use each function name only once: can't redo a check because + dnl autoconf caches the results of the last check and won't redo it. + dnl 3. Use -lnsl and -lsocket only if they supply procedures that + dnl aren't already present in the normal libraries. + dnl 4. On some systems, can't use -lsocket without -lnsl too. + dnl To get around this problem, check for both libraries together + dnl if -lsocket doesn't work by itself. + druntime_check_both=no + AC_CHECK_FUNC(connect, , + [AC_CHECK_LIB(socket, connect, + LIBS="$LIBS -lsocket", druntime_check_both=yes)]) + if test "$druntime_check_both" = "yes"; then + druntime_old_libs=$LIBS + LIBS="$LIBS -lsocket -lnsl" + AC_CHECK_FUNC(accept, , LIBS=$druntime_old_libs) + fi + AC_CHECK_FUNC(gethostbyname, , + [AC_CHECK_LIB(nsl, gethostbyname, LIBS="$LIBS -lnsl")]) ]) # DRUNTIME_LIBRARIES_ZLIB |