From d72d0f4a81764d0cfc0f145185bbaa91b52873b2 Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Thu, 17 Jan 2013 15:37:06 -0600 Subject: [PATCH] Improve libroken configure check It is not sufficient to just check if libroken is available; we need to check if the specific functionality we want is there. So, try to compile and link while referencing specific functions. As mentioned in the comments, testing every single function we use may not be practical, and we should perhaps just add functions to test as we find breakage. This commit tests rk_rename, which is missing in at least the Debian package heimdal-dev, version 1.4.0~git20100726.dfsg.1-2+squeeze1. Change-Id: I0ac6c9aea1f8598bb1b1315544683b2403de5f69 Reviewed-on: http://gerrit.openafs.org/8916 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- src/cf/roken.m4 | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/cf/roken.m4 b/src/cf/roken.m4 index ee1f0959e..8f692d3c7 100644 --- a/src/cf/roken.m4 +++ b/src/cf/roken.m4 @@ -24,17 +24,36 @@ AC_DEFUN([_OPENAFS_ROKEN_CHECK], [ save_LIBS=$LIBS AS_IF([test x"$roken_path" != x], [CPPFLAGS="-I$roken_path/include $CPPFLAGS" - LDFLAGS="-L$roken_path/lib $LDFLAGS"]) + LDFLAGS="-L$roken_path/lib $LDFLAGS" + checkstr=" in $roken_path"]) + AC_MSG_CHECKING([for usable system libroken$checkstr]) + + LIBS="$LIBS -lroken" dnl Need to be careful what we check for here, as libroken contains - dnl different symbols on different platforms. - AC_CHECK_LIB([roken], [ct_memcmp], [roken_foundlib=true]) - AC_CHECK_HEADER([roken.h], [roken_foundheader=true]) + dnl different symbols on different platforms. We cannot simply check + dnl if e.g. rk_rename is a symbol or not, since on most platforms it + dnl will be a preprocessor define, but on others it will be a symbol. + dnl + dnl Also note that we need to check for the specific functionality in + dnl roken that we use, not just the existence of the library itself, + dnl since older versions of roken do not contain all of the functions + dnl we need. It may not be practical to check everything we use, so + dnl just add functions to check here as we find installations where + dnl this breaks. + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include ]], + [[ct_memcmp(NULL, NULL, 0); rk_rename(NULL, NULL);]])], + [roken_found=true + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])]) + CPPFLAGS=$save_CPPFLAGS LDFLAGS=$save_LDFLAGS LIBS=$save_LIBS - AS_IF([test x"$roken_foundlib" = xtrue && test x"$roken_foundheader" = xtrue], + AS_IF([test x"$roken_found" = xtrue], [AS_IF([test x"$roken_path" != x], [CPPFLAGS_roken="-I$roken_path/include" LDFLAGS_roken="-L$roken_path/lib"]) -- 2.39.5