diff --git a/Headers/GNUstepBase/config.h.in b/Headers/GNUstepBase/config.h.in index 6ec1de27d..cee5baaac 100644 --- a/Headers/GNUstepBase/config.h.in +++ b/Headers/GNUstepBase/config.h.in @@ -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 header file. */ +#undef HAVE_RESOLV_H + /* Define to 1 if you have the `rint' function. */ #undef HAVE_RINT diff --git a/configure b/configure index 4a0c042e5..31b6aa82a 100755 --- a/configure +++ b/configure @@ -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 #-------------------------------------------------------------------- diff --git a/configure.ac b/configure.ac index 691188e29..fdb3c19da 100644 --- a/configure.ac +++ b/configure.ac @@ -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 #--------------------------------------------------------------------