2 AC_DEFUN([_OPENAFS_ROKEN_INTERNAL], [
5 LDFLAGS_roken="-L\$(TOP_LIBDIR)"
9 dnl _OPENAFS_ROKEN_PATHS()
10 dnl Set CPPFLAGS_roken, LDFLAGS_roken, and LIB_roken based on the values
11 dnl of roken_root, roken_libdir, and roken_includedir.
12 AC_DEFUN([_OPENAFS_ROKEN_PATHS], [
13 AS_IF([test x"$roken_libdir" != x],
14 [LDFLAGS_roken="-L$roken_libdir"],
15 [AS_IF([test x"$roken_root" != x],
16 [LDFLAGS_roken="-L$roken_root/lib"])])
17 AS_IF([test x"$roken_includedir" != x],
18 [CPPFLAGS_roken="-I$roken_includedir"],
19 [AS_IF([test x"$roken_root" != x],
20 [CPPFLAGS_roken="-I$roken_root/include"])])
23 dnl _OPENAFS_ROKEN_CHECK($action-if-found,
24 dnl $action-if-not-found)
25 dnl Find a roken library using $roken_root, $roken_libdir, and $roken_includedir
27 dnl If none of the three paths are specified,
28 dnl try to find one in the standard locations on the system.
30 dnl If we fail, and at least one path was given, then error out. Otherwise,
31 dnl fall back to the internal roken implementation.
32 AC_DEFUN([_OPENAFS_ROKEN_CHECK], [
35 save_CPPFLAGS=$CPPFLAGS
38 AS_IF([test x"$CPPFLAGS_roken" != x],
39 [CPPFLAGS="$CPPFLAGS_roken $CPPFLAGS"])
40 AS_IF([test x"$LDFLAGS_roken" != x],
41 [LDFLAGS="$LDFLAGS_roken $LDFLAGS"])
42 AS_IF([test x"$roken_libdir" != x || test x"$roken_includedir" != x],
43 [checkstr=" with specified include and lib paths"],
44 [AS_IF([test x"$roken_root" != x],
45 [checkstr=" in $roken_root"])])
47 AC_MSG_CHECKING([for usable system libroken$checkstr])
49 LIBS="$LIBS $LIB_roken"
50 dnl Need to be careful what we check for here, as libroken contains
51 dnl different symbols on different platforms. We cannot simply check
52 dnl if e.g. rk_rename is a symbol or not, since on most platforms it
53 dnl will be a preprocessor define, but on others it will be a symbol.
55 dnl Also note that we need to check for the specific functionality in
56 dnl roken that we use, not just the existence of the library itself,
57 dnl since older versions of roken do not contain all of the functions
58 dnl we need. It may not be practical to check everything we use, so
59 dnl just add functions to check here as we find installations where
63 [[#include <roken.h>]],
64 [[ct_memcmp(NULL, NULL, 0); rk_rename(NULL, NULL);]])],
66 AC_MSG_RESULT([yes])],
67 [AC_MSG_RESULT([no])])
69 CPPFLAGS=$save_CPPFLAGS
73 AS_IF([test x"$roken_found" = xtrue],
77 AC_DEFUN([OPENAFS_ROKEN], [
80 AC_SUBST(CPPFLAGS_roken)
81 AC_SUBST(LDFLAGS_roken)
85 [AS_HELP_STRING([--with-roken=DIR],
86 [Location of the roken library, or 'internal'])],
87 [AS_IF([test x"$withval" = xno],
88 [AC_ERROR("OpenAFS requires roken to build")],
89 [AS_IF([test x"$withval" != xyes],
90 [roken_root="$withval"])
93 AC_ARG_WITH([roken-include],
94 [AS_HELP_STRING([--with-roken-include=DIR],
95 [Location of roken headers])],
96 [AS_IF([test x"$withval" != xyes && test x"$withval" != xno],
97 [roken_includedir="$withval"])])
98 AC_ARG_WITH([roken-lib],
99 [AS_HELP_STRING([--with-roken-lib=DIR],
100 [Location of roken libraries])],
101 [AS_IF([test x"$withval" != xyes && test x"$withval" != xno],
102 [roken_libdir="$withval"])])
104 AS_IF([test x"$roken_root" = xinternal],
105 [_OPENAFS_ROKEN_INTERNAL()],
106 [AS_IF([test x"$roken_root" = x && test x"$roken_libdir" = x &&
107 test x"$roken_includedir" = x],
108 [_OPENAFS_ROKEN_CHECK([], [_OPENAFS_ROKEN_INTERNAL()])],
109 [_OPENAFS_ROKEN_CHECK([],
110 [AC_MSG_ERROR([Cannot find roken at that location])])