[tor-commits] [torsocks/osx] Improve compile-time detection of the res* family of system calls
hoganrobert at torproject.org
hoganrobert at torproject.org
Sun Oct 23 18:27:12 UTC 2011
commit a4d3828cfd09e16d5933e6cb763bc76cd3259035
Author: Robert Hogan <robert at webkit.org>
Date: Tue Jul 6 21:50:29 2010 +0100
Improve compile-time detection of the res* family of system calls
Some platforms need to explicitly include resolv.h so cater for
that.
Thanks to SwissTorExit for reporting and debugging assistance.
---
configure.in | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/configure.in b/configure.in
index b447fe3..04703e4 100644
--- a/configure.in
+++ b/configure.in
@@ -129,11 +129,20 @@ if test "$tempdso" = "no"; then
"Check your system for libc.so and/or libdl.so."))
fi
-AC_CHECK_LIB(resolv, res_query, [ tempres="yes" ],tempres="no")
-if test "$tempres" = "no"; then
- AC_CHECK_LIB(c, res_query,,AC_MSG_ERROR("res_query() not found in libc or libresolve." \
- "Check your system for libc.so and/or libresolve.so."))
-fi
+AC_CHECK_FUNC(res_query, ,
+ [AC_CHECK_LIB(resolv, res_query, [],
+ [ save_libs="$LIBS"
+ LIBS="-lresolv $LIBS"
+ AC_MSG_CHECKING([for res_query in -lresolv (alternate version)])
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([[#include <resolv.h>]], [[res_query(0,0,0,0,0)]])],
+ [ AC_MSG_RESULT(yes) ],
+ [ AC_MSG_RESULT(no)
+ LIBS="$save_libs"
+ AC_CHECK_LIB(resolv, res_query,
+ [], [ AC_MSG_ERROR(res_query not found in libc or libresolve. Check your system for libc.so and/or libresolve.so.) ] ) ] ) ] )
+ ]
+)
AC_DEFINE([SUPPORT_RES_API],[],[Support the res_query family of calls])
More information about the tor-commits
mailing list