Add check for libresolv

This commit is contained in:
rfm 2025-05-25 17:49:32 +01:00
parent fdc155eccc
commit 85bda73bbb
3 changed files with 75 additions and 0 deletions

View file

@ -397,6 +397,9 @@
/* Define to 1 if you have the `m' library (-lm). */
#undef HAVE_LIBM
/* Define to 1 if you have the `resolv' library (-lresolv). */
#undef HAVE_LIBRESOLV
/* Define to 1 if you have the `rt' library (-lrt). */
#undef HAVE_LIBRT
@ -544,6 +547,9 @@
/* Define to 1 if you have the `register_printf_specifier' function. */
#undef HAVE_REGISTER_PRINTF_SPECIFIER
/* Define to 1 if you have the <resolv.h> header file. */
#undef HAVE_RESOLV_H
/* Define to 1 if you have the `rint' function. */
#undef HAVE_RINT

58
configure vendored
View file

@ -7660,6 +7660,64 @@ then :
fi
ac_fn_c_check_header_compile "$LINENO" "resolv.h" "ac_cv_header_resolv_h" "$ac_includes_default"
if test "x$ac_cv_header_resolv_h" = xyes
then :
printf "%s\n" "#define HAVE_RESOLV_H 1" >>confdefs.h
fi
if test $ac_cv_header_resolv_h = yes; then
saveLIBS="$LIBS"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for res_query in -lresolv" >&5
printf %s "checking for res_query in -lresolv... " >&6; }
if test ${ac_cv_lib_resolv_res_query+y}
then :
printf %s "(cached) " >&6
else $as_nop
ac_check_lib_save_LIBS=$LIBS
LIBS="-lresolv $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. */
char res_query ();
int
main (void)
{
return res_query ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
ac_cv_lib_resolv_res_query=yes
else $as_nop
ac_cv_lib_resolv_res_query=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolv_res_query" >&5
printf "%s\n" "$ac_cv_lib_resolv_res_query" >&6; }
if test "x$ac_cv_lib_resolv_res_query" = xyes
then :
resolv_ok=yes
else $as_nop
resolv_ok=no
fi
if test "$resolv_ok" = yes; then
LIBS="$saveLIBS -lresolv";
else
LIBS="$saveLIBS"
fi
fi
#--------------------------------------------------------------------
# Windows: check if we have native threading APIs and SRW locks
#--------------------------------------------------------------------

View file

@ -1705,6 +1705,17 @@ fi
AC_CHECK_FUNCS(getaddrinfo)
AC_CHECK_HEADERS([resolv.h])
if test $ac_cv_header_resolv_h = yes; then
saveLIBS="$LIBS"
AC_CHECK_LIB(resolv, res_query, resolv_ok=yes, resolv_ok=no)
if test "$resolv_ok" = yes; then
LIBS="$saveLIBS -lresolv";
else
LIBS="$saveLIBS"
fi
fi
#--------------------------------------------------------------------
# Windows: check if we have native threading APIs and SRW locks
#--------------------------------------------------------------------