Import Upstream version 1.8.5
[hcoop/debian/openafs.git] / src / cf / solaris-renamepath.m4
1 dnl This checks for the existence of the vn_renamepath function, added in
2 dnl Solaris 11 and Solaris 10u8.
3 dnl
4 dnl Just trying to use the function is not sufficient for a configure test,
5 dnl since using an undeclared function is just a warning, and we want an error.
6 dnl Rather than try to rely on making warnings generate errors (which may
7 dnl change depending on what compiler version we're using, or in the future
8 dnl different compilers entirely), we detect the function by declaring an
9 dnl incompatible prototype. If that successfully compiles, vn_renamepath
10 dnl does not exist in the system headers, so we know it's not there. If it
11 dnl fails, we try to compile again without the incompatible prototype, to
12 dnl make sure we didn't fail for some other reason. If that succeeds, we know
13 dnl we have vn_renamepath available; if it fails, something else is wrong and
14 dnl we just try to proceed, assuming we don't have it.
15 dnl
16 AC_DEFUN([SOLARIS_HAVE_VN_RENAMEPATH],
17
18 [AC_CACHE_CHECK([for vn_renamepath],
19 [ac_cv_solaris_have_vn_renamepath],
20 [AC_COMPILE_IFELSE(
21 [AC_LANG_PROGRAM(
22 [[#define _KERNEL
23 #include <sys/vnode.h>]],
24 [[void vn_renamepath(void);]])],
25 [ac_cv_solaris_have_vn_renamepath=no],
26 [AC_COMPILE_IFELSE(
27 [AC_LANG_PROGRAM(
28 [[#define _KERNEL
29 #include <sys/vnode.h>]])],
30 [ac_cv_solaris_have_vn_renamepath=yes],
31 [ac_cv_solaris_have_vn_renamepath=no])])])
32
33 AS_IF([test "x$ac_cv_solaris_have_vn_renamepath" = "xyes"],
34 [AC_DEFINE([HAVE_VN_RENAMEPATH], [1],
35 [define if the function vn_renamepath exists])])])