Don't export getaddrinfo symbols if we found the function in a library.

This commit is contained in:
Todd C. Miller
2014-07-30 15:08:05 -06:00
parent 7a988d489c
commit 0a9e9016f1
2 changed files with 71 additions and 61 deletions

67
configure vendored
View File

@@ -19370,7 +19370,8 @@ $as_echo "no" >&6; }
fi fi
# #
# Check for getaddrinfo and add any required libs to NET_LIBS # Check for getaddrinfo and add any required libs to NET_LIBS.
# If it was added to LIBOBJS we need to export the symbols.
# #
OLIBS="$LIBS" OLIBS="$LIBS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for getaddrinfo" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getaddrinfo" >&5
@@ -19465,42 +19466,37 @@ esac
fi fi
fi fi
for lib in $LIBS; do case " $LIBOBJS " in
case "$OLIBS" in *" getaddrinfo.$ac_objext "* )
*"$lib"*) ;;
*) NET_LIBS="$NET_LIBS $lib";;
esac
done
if test X"$ax_cv_func_getaddrinfo" = X"no"; then
for _sym in sudo_getaddrinfo sudo_freeaddrinfo sudo_gai_strerror; do for _sym in sudo_getaddrinfo sudo_freeaddrinfo sudo_gai_strerror; do
COMPAT_EXP="${COMPAT_EXP}${_sym} COMPAT_EXP="${COMPAT_EXP}${_sym}
" "
done done
# We need libsudo_util to pull in dependent libraries for # We need libsudo_util to pull in dependent libraries for
# inet_pton(), gethostbyname(), and getservbyname() # inet_pton(), gethostbyname(), and getservbyname()
if test -n "${INET_PTON_LIBS}"; then if test -n "${INET_PTON_LIBS}"; then
LT_DEP_LIBS="${LT_DEP_LIBS}${LT_DEP_LIBS+ }${INET_PTON_LIBS}" LT_DEP_LIBS="${LT_DEP_LIBS}${LT_DEP_LIBS+ }${INET_PTON_LIBS}"
LIBS="${LIBS}${LIBS+ }${INET_PTON_LIBS}" LIBS="${LIBS}${LIBS+ }${INET_PTON_LIBS}"
fi fi
ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname" 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
for libs in "-lsocket" "-linet" "-lsocket -lnsl"; do for libs in "-lsocket" "-linet" "-lsocket -lnsl"; do
_libs= _libs=
for lib in $libs; do for lib in $libs; do
case "$LT_DEP_LIBS" in case "$LT_DEP_LIBS" in
*"$lib"*) ;; *"$lib"*) ;;
*) _libs="$_libs $lib";; *) _libs="$_libs $lib";;
esac esac
done done
libs="${_libs# }" libs="${_libs# }"
test -z "$libs" && continue test -z "$libs" && continue
lib="`echo \"$libs\"|sed -e 's/^-l//' -e 's/ .*$//'`" lib="`echo \"$libs\"|sed -e 's/^-l//' -e 's/ .*$//'`"
extralibs="`echo \"$libs\"|sed 's/^-l[^ ]*//'`" extralibs="`echo \"$libs\"|sed 's/^-l[^ ]*//'`"
_sudo_check_lib_extras=`echo "$extralibs"|sed -e 's/ *//g' -e 's/-l/_/g'` _sudo_check_lib_extras=`echo "$extralibs"|sed -e 's/ *//g' -e 's/-l/_/g'`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -l$lib${5+ }$extralibs" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -l$lib${5+ }$extralibs" >&5
@@ -19551,11 +19547,20 @@ $as_echo "no" >&6; }
fi fi
done
fi
;;
*)
for lib in $LIBS; do
case "$OLIBS" in
*"$lib"*) ;;
*) NET_LIBS="${NET_LIBS} $lib";;
esac
done done
;;
fi esac
fi
LIBS="$OLIBS" LIBS="$OLIBS"
for ac_func in getprogname for ac_func in getprogname

View File

@@ -2746,41 +2746,46 @@ AC_CHECK_FUNC(syslog, [], [
done done
]) ])
# #
# Check for getaddrinfo and add any required libs to NET_LIBS # Check for getaddrinfo and add any required libs to NET_LIBS.
# If it was added to LIBOBJS we need to export the symbols.
# #
OLIBS="$LIBS" OLIBS="$LIBS"
AX_FUNC_GETADDRINFO AX_FUNC_GETADDRINFO
for lib in $LIBS; do case " $LIBOBJS " in
case "$OLIBS" in *" getaddrinfo.$ac_objext "* )
*"$lib"*) ;; SUDO_APPEND_COMPAT_EXP(sudo_getaddrinfo sudo_freeaddrinfo sudo_gai_strerror)
*) NET_LIBS="$NET_LIBS $lib";; # We need libsudo_util to pull in dependent libraries for
esac # inet_pton(), gethostbyname(), and getservbyname()
done if test -n "${INET_PTON_LIBS}"; then
if test X"$ax_cv_func_getaddrinfo" = X"no"; then LT_DEP_LIBS="${LT_DEP_LIBS}${LT_DEP_LIBS+ }${INET_PTON_LIBS}"
SUDO_APPEND_COMPAT_EXP(sudo_getaddrinfo sudo_freeaddrinfo sudo_gai_strerror) LIBS="${LIBS}${LIBS+ }${INET_PTON_LIBS}"
# We need libsudo_util to pull in dependent libraries for fi
# inet_pton(), gethostbyname(), and getservbyname() AC_CHECK_FUNC(gethostbyname, [], [
if test -n "${INET_PTON_LIBS}"; then for libs in "-lsocket" "-linet" "-lsocket -lnsl"; do
LT_DEP_LIBS="${LT_DEP_LIBS}${LT_DEP_LIBS+ }${INET_PTON_LIBS}" _libs=
LIBS="${LIBS}${LIBS+ }${INET_PTON_LIBS}" for lib in $libs; do
fi case "$LT_DEP_LIBS" in
AC_CHECK_FUNC(gethostbyname, [], [ *"$lib"*) ;;
for libs in "-lsocket" "-linet" "-lsocket -lnsl"; do *) _libs="$_libs $lib";;
_libs= esac
for lib in $libs; do done
case "$LT_DEP_LIBS" in libs="${_libs# }"
*"$lib"*) ;; test -z "$libs" && continue
*) _libs="$_libs $lib";; lib="`echo \"$libs\"|sed -e 's/^-l//' -e 's/ .*$//'`"
esac extralibs="`echo \"$libs\"|sed 's/^-l[[^ ]]*//'`"
SUDO_CHECK_LIB($lib, gethostbyname, [LT_DEP_LIBS="${LT_DEP_LIBS} $libs"; break], [], [$extralibs])
done done
libs="${_libs# }" ])
test -z "$libs" && continue ;;
lib="`echo \"$libs\"|sed -e 's/^-l//' -e 's/ .*$//'`" *)
extralibs="`echo \"$libs\"|sed 's/^-l[[^ ]]*//'`" for lib in $LIBS; do
SUDO_CHECK_LIB($lib, gethostbyname, [LT_DEP_LIBS="${LT_DEP_LIBS} $libs"; break], [], [$extralibs]) case "$OLIBS" in
*"$lib"*) ;;
*) NET_LIBS="${NET_LIBS} $lib";;
esac
done done
]) ;;
fi esac
LIBS="$OLIBS" LIBS="$OLIBS"
dnl dnl