AC_CHECK_LIB() doesn't work to check for Windows API functions due to calling

conventions, so use AC_LINK_IFELSE() instead.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@200 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
Kevin Easton
2012-05-30 12:26:44 +00:00
parent 27c4333ef5
commit dd51b53e7d
2 changed files with 20 additions and 2 deletions

View File

@@ -165,7 +165,25 @@ if test x"$bx_cv_lib_resolver" != x"not found"; then
LIBS="$bx_cv_lib_resolver $LIBS"
fi
dnl This is for getting the DNS servers on Windows
AC_CHECK_HEADER([iphlpapi.h], [AC_CHECK_LIB(iphlpapi, GetNetworkParams, [], [])], [], [#include <windows.h>])
AC_MSG_CHECKING([for the iphlpapi library])
OLDLIBS="$LIBS"
LIBS="-liphlpapi $LIBS"
AC_LINK_IFELSE([[
#include <windows.h>
#include <iphlpapi.h>
int main()
{
ULONG buflen;
GetNetworkParams(0, &buflen);
return buflen;
}]], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_LIBIPHLPAPI, 1, [Define to 1 if you have the Windows iphlpapi library])
],[
AC_MSG_RESULT(no)
LIBS="$OLDLIBS"
])
else
AC_MSG_WARN([No resolver library found, /nslookup will be disabled.])
fi

View File

@@ -129,7 +129,7 @@
/* Define to 1 if you have the `killpg' function. */
#undef HAVE_KILLPG
/* Define to 1 if you have the `iphlpapi' library (-liphlpapi). */
/* Define to 1 if you have the Windows iphlpapi library */
#undef HAVE_LIBIPHLPAPI
/* Define to 1 if you have the `ssl' library (-lssl). */