From 3313e7499642c39b0be1574102b8cdf6bfa565b5 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Sat, 22 May 2010 09:40:05 +0100 Subject: [PATCH 1/1] Autoconf: Tidy up resolver retrans retry test There's no need for the retrans retry test to be a TRY_RUN test, TRY_COMPILE will pick up the existence of the '_res' structure and its elements. Also, clean up the use of the cache variable to set the result. In the old implementation a true test result would print '1', not 'yes', a false result would result in bad output in the config.log, and a cross compiling output would give #define HAVE_RES_RETRANSRETRY no which will give unexpected results with #ifdef tests. Change-Id: If78c1b01ee89242c67f87238ca502ce43718c6a2 Reviewed-on: http://gerrit.openafs.org/2014 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- src/cf/ressearch.m4 | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/cf/ressearch.m4 b/src/cf/ressearch.m4 index d2cab43..2abd444 100644 --- a/src/cf/ressearch.m4 +++ b/src/cf/ressearch.m4 @@ -1,24 +1,23 @@ AC_DEFUN([AC_CHECK_RESOLV_RETRANS],[ - AC_CACHE_CHECK([for retransmit support in res_state], [ac_cv_res_retransretry],[ - AC_TRY_RUN( [ + AC_CACHE_CHECK([for retransmit support in res_state], + [ac_cv_res_retransretry],[ + AC_TRY_COMPILE( [ #include #if defined(__sun__) #include #endif #include -int main(void) { +],[ _res.retrans = 2; _res.retry = 1; - exit(0); -} -],[ - ac_cv_res_retransretry=1 -],[ - ac_cv_res_retransretry= -],[ - ac_cv_res_retransretry="no" -])]) -AC_DEFINE_UNQUOTED([HAVE_RES_RETRANSRETRY], [$ac_cv_res_retransretry], [Define if resolv.h's res_state has the fields retrans/rety]) +], + [ac_cv_res_retransretry="yes"], + [ac_cv_res_retransretry="no"]) + ]) + AS_IF([test "$ac_cv_res_retransretry" = "yes"], + [AC_DEFINE([HAVE_RES_RETRANSRETRY], 1, + [Define if resolv.h's res_state has the fields retrans/retry]) + ]) ]) AC_DEFUN([AC_FUNC_RES_SEARCH], [ -- 1.9.4