Autoconf: Tidy up resolver retrans retry test
authorSimon Wilkinson <sxw@inf.ed.ac.uk>
Sat, 22 May 2010 08:40:05 +0000 (09:40 +0100)
committerDerrick Brashear <shadow@dementia.org>
Sun, 23 May 2010 14:24:58 +0000 (07:24 -0700)
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 <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

src/cf/ressearch.m4

index d2cab43..2abd444 100644 (file)
@@ -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 <sys/types.h>
 #if defined(__sun__)
 #include <inet/ip.h>
 #endif
 #include <resolv.h>
-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], [