From c5da685240c4a9d85eae2ce34f4c1254c925c6f6 Mon Sep 17 00:00:00 2001 From: Diego 'Flameeyes' Pettenò Date: Tue, 28 Oct 2008 19:47:21 +0100 Subject: Create an improved function search macro, and use it to look for res_query. Instead of using AC_SEARCH_LIBS or AC_CHECK_LIB, create a new macro to search for function in different libraries; this is needed since the function name might just be a (preprocessor) macro for another symbol. The new macro is released under GPL2 (or later) + exception, and allows to provide a custom source code to use to test for the function. --- configure.ac | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index c8f8941..09e3518 100644 --- a/configure.ac +++ b/configure.ac @@ -78,20 +78,12 @@ AC_CHECK_FUNCS([memset select strndup setresuid setreuid strerror]) AC_CHECK_LIB(nsl, gethostbyname) AC_CHECK_LIB(socket, connect) -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 ]], [[res_query(0,0,0,0,0)]])], - [ AC_MSG_RESULT(yes) ], - [ AC_MSG_RESULT(no) - LIBS="$save_libs" - AC_CHECK_LIB(bind, res_query, - [], [ AC_MSG_ERROR(res_query not found) ] ) ] ) ] ) - ] -) +ACF_SEARCH_FUNCTION([res_query], [-lresolv, -lbind], + [], [AC_MSG_ERROR([res_query not found])], + [AC_LANG_PROGRAM([[ + #include + ]], [[res_query(0, 0, 0, 0, 0);]]) + ]) ACX_PTHREAD -- cgit