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.
This commit is contained in:
Iain Buclaw 2020-04-27 02:09:43 +02:00
parent 873b5de87c
commit 5e7f8c55c2
2 changed files with 73 additions and 83 deletions

105
libphobos/configure vendored
View File

@ -14932,25 +14932,14 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket libraries" >&5 druntime_check_both=no
$as_echo_n "checking for socket libraries... " >&6; } ac_fn_c_check_func "$LINENO" "connect" "ac_cv_func_connect"
if ${druntime_cv_lib_sockets+:} false; then :
$as_echo_n "(cached) " >&6
else
druntime_cv_lib_sockets=
druntime_check_both=no
ac_fn_c_check_func "$LINENO" "connect" "ac_cv_func_connect"
if test "x$ac_cv_func_connect" = xyes; then : if test "x$ac_cv_func_connect" = xyes; then :
druntime_check_socket=no
else
druntime_check_socket=yes
fi
if test "$druntime_check_socket" = "yes"; then else
unset ac_cv_func_connect { $as_echo "$as_me:${as_lineno-$LINENO}: checking for connect in -lsocket" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lsocket" >&5 $as_echo_n "checking for connect in -lsocket... " >&6; }
$as_echo_n "checking for main in -lsocket... " >&6; } if ${ac_cv_lib_socket_connect+:} false; then :
if ${ac_cv_lib_socket_main+:} false; then :
$as_echo_n "(cached) " >&6 $as_echo_n "(cached) " >&6
else else
ac_check_lib_save_LIBS=$LIBS ac_check_lib_save_LIBS=$LIBS
@ -14958,55 +14947,58 @@ LIBS="-lsocket $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* 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 connect ();
int int
main () main ()
{ {
return main (); return connect ();
; ;
return 0; return 0;
} }
_ACEOF _ACEOF
if ac_fn_c_try_link "$LINENO"; then : if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_socket_main=yes ac_cv_lib_socket_connect=yes
else else
ac_cv_lib_socket_main=no ac_cv_lib_socket_connect=no
fi fi
rm -f core conftest.err conftest.$ac_objext \ rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS LIBS=$ac_check_lib_save_LIBS
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_main" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_connect" >&5
$as_echo "$ac_cv_lib_socket_main" >&6; } $as_echo "$ac_cv_lib_socket_connect" >&6; }
if test "x$ac_cv_lib_socket_main" = xyes; then : if test "x$ac_cv_lib_socket_connect" = xyes; then :
druntime_cv_lib_sockets="-lsocket" LIBS="$LIBS -lsocket"
else else
druntime_check_both=yes druntime_check_both=yes
fi fi
fi
if test "$druntime_check_both" = "yes"; then
druntime_old_libs=$LIBS
LIBS="$LIBS -lsocket -lnsl"
unset ac_cv_func_accept
ac_fn_c_check_func "$LINENO" "accept" "ac_cv_func_accept"
if test "x$ac_cv_func_accept" = xyes; then :
druntime_check_nsl=no
druntime_cv_lib_sockets="-lsocket -lnsl"
fi fi
unset ac_cv_func_accept if test "$druntime_check_both" = "yes"; then
LIBS=$druntime_old_libs druntime_old_libs=$LIBS
fi LIBS="$LIBS -lsocket -lnsl"
unset ac_cv_func_gethostbyname ac_fn_c_check_func "$LINENO" "accept" "ac_cv_func_accept"
druntime_old_libs="$LIBS" if test "x$ac_cv_func_accept" = xyes; then :
ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname"
else
LIBS=$druntime_old_libs
fi
fi
ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname"
if test "x$ac_cv_func_gethostbyname" = xyes; then : if test "x$ac_cv_func_gethostbyname" = xyes; then :
else else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lnsl" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5
$as_echo_n "checking for main in -lnsl... " >&6; } $as_echo_n "checking for gethostbyname in -lnsl... " >&6; }
if ${ac_cv_lib_nsl_main+:} false; then : if ${ac_cv_lib_nsl_gethostbyname+:} false; then :
$as_echo_n "(cached) " >&6 $as_echo_n "(cached) " >&6
else else
ac_check_lib_save_LIBS=$LIBS ac_check_lib_save_LIBS=$LIBS
@ -15014,38 +15006,39 @@ LIBS="-lnsl $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* 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 gethostbyname ();
int int
main () main ()
{ {
return main (); return gethostbyname ();
; ;
return 0; return 0;
} }
_ACEOF _ACEOF
if ac_fn_c_try_link "$LINENO"; then : if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_nsl_main=yes ac_cv_lib_nsl_gethostbyname=yes
else else
ac_cv_lib_nsl_main=no ac_cv_lib_nsl_gethostbyname=no
fi fi
rm -f core conftest.err conftest.$ac_objext \ rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS LIBS=$ac_check_lib_save_LIBS
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_main" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_gethostbyname" >&5
$as_echo "$ac_cv_lib_nsl_main" >&6; } $as_echo "$ac_cv_lib_nsl_gethostbyname" >&6; }
if test "x$ac_cv_lib_nsl_main" = xyes; then : if test "x$ac_cv_lib_nsl_gethostbyname" = xyes; then :
druntime_cv_lib_sockets="$druntime_cv_lib_sockets -lnsl" LIBS="$LIBS -lnsl"
fi fi
fi fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $druntime_cv_lib_sockets" >&5
$as_echo "$druntime_cv_lib_sockets" >&6; }
LIBS="$LIBS $druntime_cv_lib_sockets"
# Keep this in sync with core/thread.d, set druntime_fiber_asm_external to # Keep this in sync with core/thread.d, set druntime_fiber_asm_external to
# "yes" for targets that have 'version = AsmExternal'. # "yes" for targets that have 'version = AsmExternal'.

View File

@ -21,33 +21,30 @@ AC_DEFUN([DRUNTIME_LIBRARIES_DLOPEN],
# Autodetect and add networking library to LIBS if necessary. # Autodetect and add networking library to LIBS if necessary.
AC_DEFUN([DRUNTIME_LIBRARIES_NET], AC_DEFUN([DRUNTIME_LIBRARIES_NET],
[ [
dnl Test for -lsocket and -lnsl. Copied from libjava/configure.ac. dnl Check for the existence of the -lsocket and -lnsl libraries.
AC_CACHE_CHECK([for socket libraries], druntime_cv_lib_sockets, dnl The order here is important, so that they end up in the right
[druntime_cv_lib_sockets= dnl order in the command line generated by make. Here are some
druntime_check_both=no dnl special considerations:
AC_CHECK_FUNC(connect, druntime_check_socket=no, druntime_check_socket=yes) dnl 1. Use "connect" and "accept" to check for -lsocket, and
if test "$druntime_check_socket" = "yes"; then dnl "gethostbyname" to check for -lnsl.
unset ac_cv_func_connect dnl 2. Use each function name only once: can't redo a check because
AC_CHECK_LIB(socket, main, druntime_cv_lib_sockets="-lsocket", dnl autoconf caches the results of the last check and won't redo it.
druntime_check_both=yes) dnl 3. Use -lnsl and -lsocket only if they supply procedures that
fi dnl aren't already present in the normal libraries.
if test "$druntime_check_both" = "yes"; then dnl 4. On some systems, can't use -lsocket without -lnsl too.
druntime_old_libs=$LIBS dnl To get around this problem, check for both libraries together
LIBS="$LIBS -lsocket -lnsl" dnl if -lsocket doesn't work by itself.
unset ac_cv_func_accept druntime_check_both=no
AC_CHECK_FUNC(accept, AC_CHECK_FUNC(connect, ,
[druntime_check_nsl=no [AC_CHECK_LIB(socket, connect,
druntime_cv_lib_sockets="-lsocket -lnsl"]) LIBS="$LIBS -lsocket", druntime_check_both=yes)])
unset ac_cv_func_accept if test "$druntime_check_both" = "yes"; then
LIBS=$druntime_old_libs druntime_old_libs=$LIBS
fi LIBS="$LIBS -lsocket -lnsl"
unset ac_cv_func_gethostbyname AC_CHECK_FUNC(accept, , LIBS=$druntime_old_libs)
druntime_old_libs="$LIBS" fi
AC_CHECK_FUNC(gethostbyname, , AC_CHECK_FUNC(gethostbyname, ,
[AC_CHECK_LIB(nsl, main, [AC_CHECK_LIB(nsl, gethostbyname, LIBS="$LIBS -lnsl")])
[druntime_cv_lib_sockets="$druntime_cv_lib_sockets -lnsl"])])
])
LIBS="$LIBS $druntime_cv_lib_sockets"
]) ])
# DRUNTIME_LIBRARIES_ZLIB # DRUNTIME_LIBRARIES_ZLIB