mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-30 13:58:05 +00:00
More complete test for getaddrinfo() that doesn't rely on the network
libraries already being added to LIBS.
This commit is contained in:
parent
13561805d9
commit
b1882a7945
152
configure
vendored
152
configure
vendored
@ -17070,6 +17070,147 @@ if test -n "$NEED_SNPRINTF"; then
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
fi
|
||||||
|
found=no
|
||||||
|
for ac_func in getaddrinfo
|
||||||
|
do :
|
||||||
|
ac_fn_c_check_func "$LINENO" "getaddrinfo" "ac_cv_func_getaddrinfo"
|
||||||
|
if test "x$ac_cv_func_getaddrinfo" = xyes; then :
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define HAVE_GETADDRINFO 1
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
else
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for getaddrinfo in -lsocket" >&5
|
||||||
|
$as_echo_n "checking for getaddrinfo in -lsocket... " >&6; }
|
||||||
|
if ${ac_cv_lib_socket_getaddrinfo+:} false; then :
|
||||||
|
$as_echo_n "(cached) " >&6
|
||||||
|
else
|
||||||
|
ac_check_lib_save_LIBS=$LIBS
|
||||||
|
LIBS="-lsocket $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 getaddrinfo ();
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
return getaddrinfo ();
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_c_try_link "$LINENO"; then :
|
||||||
|
ac_cv_lib_socket_getaddrinfo=yes
|
||||||
|
else
|
||||||
|
ac_cv_lib_socket_getaddrinfo=no
|
||||||
|
fi
|
||||||
|
rm -f core conftest.err conftest.$ac_objext \
|
||||||
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
|
LIBS=$ac_check_lib_save_LIBS
|
||||||
|
fi
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_getaddrinfo" >&5
|
||||||
|
$as_echo "$ac_cv_lib_socket_getaddrinfo" >&6; }
|
||||||
|
if test "x$ac_cv_lib_socket_getaddrinfo" = xyes; then :
|
||||||
|
NET_LIBS="${NET_LIBS} -lsocket"; LIBS="${LIBS} -lsocket"; found=yes
|
||||||
|
else
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for getaddrinfo in -linet" >&5
|
||||||
|
$as_echo_n "checking for getaddrinfo in -linet... " >&6; }
|
||||||
|
if ${ac_cv_lib_inet_getaddrinfo+:} false; then :
|
||||||
|
$as_echo_n "(cached) " >&6
|
||||||
|
else
|
||||||
|
ac_check_lib_save_LIBS=$LIBS
|
||||||
|
LIBS="-linet $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 getaddrinfo ();
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
return getaddrinfo ();
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_c_try_link "$LINENO"; then :
|
||||||
|
ac_cv_lib_inet_getaddrinfo=yes
|
||||||
|
else
|
||||||
|
ac_cv_lib_inet_getaddrinfo=no
|
||||||
|
fi
|
||||||
|
rm -f core conftest.err conftest.$ac_objext \
|
||||||
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
|
LIBS=$ac_check_lib_save_LIBS
|
||||||
|
fi
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_inet_getaddrinfo" >&5
|
||||||
|
$as_echo "$ac_cv_lib_inet_getaddrinfo" >&6; }
|
||||||
|
if test "x$ac_cv_lib_inet_getaddrinfo" = xyes; then :
|
||||||
|
NET_LIBS="${NET_LIBS} -linet"; LIBS="${LIBS} -linet"; found=yes
|
||||||
|
else
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unable to find getaddrinfo() trying -lsocket -lnsl" >&5
|
||||||
|
$as_echo "$as_me: WARNING: unable to find getaddrinfo() trying -lsocket -lnsl" >&2;}
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for getaddrinfo in -lsocket" >&5
|
||||||
|
$as_echo_n "checking for getaddrinfo in -lsocket... " >&6; }
|
||||||
|
if ${ac_cv_lib_socket_getaddrinfo_lnsl+:} false; then :
|
||||||
|
$as_echo_n "(cached) " >&6
|
||||||
|
else
|
||||||
|
ac_check_lib_save_LIBS=$LIBS
|
||||||
|
LIBS="-lsocket -lnsl $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 getaddrinfo ();
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
return getaddrinfo ();
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_c_try_link "$LINENO"; then :
|
||||||
|
ac_cv_lib_socket_getaddrinfo_lnsl=yes
|
||||||
|
else
|
||||||
|
ac_cv_lib_socket_getaddrinfo_lnsl=no
|
||||||
|
fi
|
||||||
|
rm -f core conftest.err conftest.$ac_objext \
|
||||||
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
|
LIBS=$ac_check_lib_save_LIBS
|
||||||
|
fi
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_getaddrinfo_lnsl" >&5
|
||||||
|
$as_echo "$ac_cv_lib_socket_getaddrinfo_lnsl" >&6; }
|
||||||
|
if test "x$ac_cv_lib_socket_getaddrinfo_lnsl" = xyes; then :
|
||||||
|
NET_LIBS="${NET_LIBS} -lsocket -lnsl"; LIBS="${LIBS} -lsocket -lnsl"; found=yes
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if test X"$found" != X"no"; then
|
||||||
|
$as_echo "#define HAVE_GETADDRINFO 1" >>confdefs.h
|
||||||
|
|
||||||
fi
|
fi
|
||||||
ac_fn_c_check_func "$LINENO" "socket" "ac_cv_func_socket"
|
ac_fn_c_check_func "$LINENO" "socket" "ac_cv_func_socket"
|
||||||
if test "x$ac_cv_func_socket" = xyes; then :
|
if test "x$ac_cv_func_socket" = xyes; then :
|
||||||
@ -17465,17 +17606,6 @@ fi
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for ac_func in getaddrinfo
|
|
||||||
do :
|
|
||||||
ac_fn_c_check_func "$LINENO" "getaddrinfo" "ac_cv_func_getaddrinfo"
|
|
||||||
if test "x$ac_cv_func_getaddrinfo" = xyes; then :
|
|
||||||
cat >>confdefs.h <<_ACEOF
|
|
||||||
#define HAVE_GETADDRINFO 1
|
|
||||||
_ACEOF
|
|
||||||
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
for ac_func in getprogname
|
for ac_func in getprogname
|
||||||
do :
|
do :
|
||||||
ac_fn_c_check_func "$LINENO" "getprogname" "ac_cv_func_getprogname"
|
ac_fn_c_check_func "$LINENO" "getprogname" "ac_cv_func_getprogname"
|
||||||
|
10
configure.in
10
configure.in
@ -2188,9 +2188,15 @@ dnl If syslog(3) not in libc, check -lsocket, -lnsl and -linet
|
|||||||
dnl
|
dnl
|
||||||
AC_CHECK_FUNC(syslog, , [AC_CHECK_LIB(socket, syslog, [NET_LIBS="${NET_LIBS} -lsocket"; LIBS="${LIBS} -lsocket"], AC_CHECK_LIB(nsl, syslog, [NET_LIBS="${NET_LIBS} -lnsl"; LIBS="${LIBS} -lnsl"], AC_CHECK_LIB(inet, syslog, [NET_LIBS="${NET_LIBS} -linet"; LIBS="${LIBS} -linet"])))])
|
AC_CHECK_FUNC(syslog, , [AC_CHECK_LIB(socket, syslog, [NET_LIBS="${NET_LIBS} -lsocket"; LIBS="${LIBS} -lsocket"], AC_CHECK_LIB(nsl, syslog, [NET_LIBS="${NET_LIBS} -lnsl"; LIBS="${LIBS} -lnsl"], AC_CHECK_LIB(inet, syslog, [NET_LIBS="${NET_LIBS} -linet"; LIBS="${LIBS} -linet"])))])
|
||||||
dnl
|
dnl
|
||||||
dnl Defer getaddrinfo(3) check until after network libs are added to LIBS
|
dnl If getaddrinfo(3) not in libc, check -lsocket and -linet
|
||||||
|
dnl May need to link with *both* -lnsl and -lsocket due to unresolved symbols.
|
||||||
dnl
|
dnl
|
||||||
AC_CHECK_FUNCS(getaddrinfo)
|
found=no
|
||||||
|
AC_CHECK_FUNCS(getaddrinfo, [], [AC_CHECK_LIB(socket, getaddrinfo, [NET_LIBS="${NET_LIBS} -lsocket"; LIBS="${LIBS} -lsocket"; found=yes], AC_CHECK_LIB(inet, getaddrinfo, [NET_LIBS="${NET_LIBS} -linet"; LIBS="${LIBS} -linet"; found=yes], AC_MSG_WARN(unable to find getaddrinfo() trying -lsocket -lnsl)
|
||||||
|
AC_CHECK_LIB(socket, getaddrinfo, [NET_LIBS="${NET_LIBS} -lsocket -lnsl"; LIBS="${LIBS} -lsocket -lnsl"; found=yes], [], -lnsl)))])
|
||||||
|
if test X"$found" != X"no"; then
|
||||||
|
AC_DEFINE(HAVE_GETADDRINFO)
|
||||||
|
fi
|
||||||
dnl
|
dnl
|
||||||
dnl Check for getprogname() or __progname
|
dnl Check for getprogname() or __progname
|
||||||
dnl
|
dnl
|
||||||
|
Loading…
x
Reference in New Issue
Block a user