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 <roken.h>]],
+ [[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"])