void closevol(afpvol_t *vol)
{
- if (vol->vol->v_cdb) {
- cnid_close(vol->vol->v_cdb);
- vol->vol->v_cdb = NULL;
+ if (vol->vol) {
+ if (vol->vol->v_cdb) {
+ cnid_close(vol->vol->v_cdb);
+ vol->vol->v_cdb = NULL;
+ }
}
memset(vol, 0, sizeof(afpvol_t));
}
return 0;
}
-/*!
- * ResolvesCNID of a given paths
- *
- * path might be:
- * (a) relative:
- * "dir/subdir" with cwd: "/afp_volume/topdir"
- * (b) absolute:
- * "/afp_volume/dir/subdir"
- *
- * path MUST be pointing inside vol, this is usually the case as vol has been build from
- * path using loadvolinfo and friends.
- *
- * @param vol (r) pointer to afpvol_t
- * @param path (r) path, see above
- * @param did (rw) parent CNID of returned CNID
- *
- * @returns CNID of path
- */
-cnid_t cnid_for_path(const afpvol_t *vol,
- const char *path,
- cnid_t *did)
-{
- EC_INIT;
-
- cnid_t cnid;
- bstring rpath = NULL;
- bstring statpath = NULL;
- struct bstrList *l = NULL;
- struct stat st;
-
- cnid = htonl(2);
-
- EC_NULL(rpath = rel_path_in_vol(path, vol->vol->v_path));
- EC_NULL(statpath = bfromcstr(vol->vol->v_path));
- EC_ZERO(bcatcstr(statpath, "/"));
-
- l = bsplit(rpath, '/');
- for (int i = 0; i < l->qty ; i++) {
- *did = cnid;
-
- EC_ZERO(bconcat(statpath, l->entry[i]));
- EC_ZERO_LOGSTR(lstat(cfrombstr(statpath), &st),
- "lstat(rpath: %s, elem: %s): %s: %s",
- cfrombstr(rpath), cfrombstr(l->entry[i]),
- cfrombstr(statpath), strerror(errno));
-
- if ((cnid = cnid_add(vol->vol->v_cdb,
- &st,
- *did,
- cfrombstr(l->entry[i]),
- blength(l->entry[i]),
- 0)) == CNID_INVALID) {
- EC_FAIL;
- }
- EC_ZERO(bcatcstr(statpath, "/"));
- }
-
-EC_CLEANUP:
- bdestroy(rpath);
- bstrListDestroy(l);
- bdestroy(statpath);
- if (ret != 0)
- return CNID_INVALID;
-
- return cnid;
-}
-
/*!
* Resolves CNID of a given paths parent directory
*
AM_CONDITIONAL(DEVELOPER, test x"$enable_dev" = x"yes")
])
+dnl Tracker, for Spotlight
+AC_DEFUN([AC_NETATALK_SPOTLIGHT], [
+ ac_cv_have_tracker=no
+ dnl Tracker SPARQL
+ ac_cv_tracker_pkg_default=tracker-sparql-0.12
+ AC_ARG_WITH([tracker-pkg-config],
+ [AS_HELP_STRING([--with-tracker-pkg-config],[name of the Tracker SPARQL pkg in pkg-config])],
+ [ac_cv_tracker_pkg=$withval],
+ [ac_cv_tracker_pkg=$ac_cv_tracker_pkg_default])
+
+ PKG_CHECK_MODULES([TRACKER], [$ac_cv_tracker_pkg >= 0.12], [ac_cv_have_tracker_sparql=yes], [ac_cv_have_tracker_sparql=no])
+
+ if test x"$ac_cv_have_tracker_sparql" = x"no" ; then
+ if test x"$need_tracker" = x"yes" ; then
+ AC_MSG_ERROR([$ac_cv_tracker_pkg not found])
+ fi
+ else
+ AC_DEFINE(HAVE_TRACKER, 1, [Define if Tracker is available])
+ AC_DEFINE(HAVE_TRACKER_SPARQL, 1, [Define if Tracker SPARQL is available])
+ ac_cv_tracker_prefix=`pkg-config --variable=prefix $ac_cv_tracker_pkg`
+ AC_DEFINE_UNQUOTED(TRACKER_PREFIX, ["$ac_cv_tracker_prefix"], [Path to Tracker])
+ fi
+
+ ac_cv_tracker_miner_pkg_default=tracker-miner-0.12
+ AC_ARG_WITH([tracker-miner-pkg-config],
+ [AS_HELP_STRING([--with-tracker-miner-pkg-config],[name of the Tracker miner pkg in pkg-config])],
+ [ac_cv_tracker_miner_pkg=$withval],
+ [ac_cv_tracker_miner_pkg=$ac_cv_tracker_miner_pkg_default])
+
+ PKG_CHECK_MODULES([TRACKER_MINER], [$ac_cv_tracker_miner_pkg >= 0.12], [ac_cv_have_tracker_miner=yes], [ac_cv_have_tracker_miner=no])
+
+ if test x"$ac_cv_have_tracker_miner" = x"yes" ; then
+ AC_DEFINE(HAVE_TRACKER_MINER, 1, [Define if Tracker miner library is available])
+ AC_SUBST(TRACKER_MINER_CFLAGS)
+ AC_SUBST(TRACKER_MINER_LIBS)
+ fi
+
+ dnl Test for Tracker 0.6 on Solaris and derived platforms
+ if test x"$this_os" = x"solaris" ; then
+ PKG_CHECK_MODULES([TRACKER], [tracker >= 0.6], [ac_cv_have_tracker_rdf=yes], [ac_cv_have_tracker_rdf=no])
+ if test x"$ac_cv_have_tracker_rdf" = x"yes" ; then
+ AC_DEFINE(HAVE_TRACKER, 1, [Define if Tracker is available])
+ AC_DEFINE(HAVE_TRACKER_RDF, 1, [Define if Tracker 0.6 with support for RDF queries is available])
+ ac_cv_tracker_prefix=`pkg-config --variable=prefix tracker`
+ AC_DEFINE_UNQUOTED(TRACKER_RDF_PREFIX, ["$ac_cv_tracker_prefix"], [Path to Tracker])
+ fi
+ fi
+
+ if test x"$ac_cv_have_tracker_sparql" = x"yes" -o x"$ac_cv_have_tracker_rdf" = x"yes" ; then
+ ac_cv_have_tracker=yes
+ fi
+ AC_SUBST(TRACKER_CFLAGS)
+ AC_SUBST(TRACKER_LIBS)
+ AM_CONDITIONAL(HAVE_TRACKER_SPARQL, [test x"$ac_cv_have_tracker_sparql" = x"yes"])
+ AM_CONDITIONAL(HAVE_TRACKER_RDF, [test x"$ac_cv_have_tracker_rdf" = x"yes"])
+])
+
dnl Whether to disable bundled libevent
AC_DEFUN([AC_NETATALK_LIBEVENT], [
AC_MSG_CHECKING([whether to use bundled libevent])
AC_MSG_ERROR([--with-libevent requires a path])
fi
AC_MSG_RESULT([$use_bundled_libevent])
- AC_CONFIG_SUBDIRS([libevent])
+ if test x"$use_bundled_libevent" = x"yes" ; then
+ AC_CONFIG_SUBDIRS([libevent])
+ fi
AC_SUBST(LIBEVENT_CFLAGS)
AC_SUBST(LIBEVENT_LDFLAGS)
AM_CONDITIONAL(USE_BUILTIN_LIBEVENT, test x"$use_bundled_libevent" = x"yes")
)
])
- dnl Check for optional sysv initscript install
+ dnl Check for optional initscript install
AC_DEFUN([AC_NETATALK_INIT_STYLE], [
AC_ARG_WITH(init-style,
[ --with-init-style use OS specific init config [[redhat-sysv|redhat-systemd|suse-sysv|suse-systemd|gentoo|netbsd|debian|solaris|systemd]]],
;;
"redhat-sysv")
AC_MSG_RESULT([enabling redhat-style sysv initscript support])
+ ac_cv_init_dir="/etc/rc.d/init.d"
;;
"redhat-systemd")
AC_MSG_RESULT([enabling redhat-style systemd support])
+ ac_cv_init_dir="/lib/systemd/system"
;;
"suse")
AC_MSG_ERROR([--with-init-style=suse is obsoleted. Use suse-sysv or suse-systemd.])
;;
"suse-sysv")
AC_MSG_RESULT([enabling suse-style sysv initscript support])
+ ac_cv_init_dir="/etc/init.d"
;;
"suse-systemd")
AC_MSG_RESULT([enabling suse-style systemd support (>=openSUSE12.1)])
+ ac_cv_init_dir="/lib/systemd/system"
;;
"gentoo")
AC_MSG_RESULT([enabling gentoo-style initscript support])
+ ac_cv_init_dir="/etc/init.d"
;;
"netbsd")
AC_MSG_RESULT([enabling netbsd-style initscript support])
+ ac_cv_init_dir="/etc/rc.d"
;;
"debian")
AC_MSG_RESULT([enabling debian-style initscript support])
+ ac_cv_init_dir="/etc/init.d"
;;
"solaris")
AC_MSG_RESULT([enabling solaris-style SMF support])
+ ac_cv_init_dir="/lib/svc/manifest/network/"
;;
"systemd")
AC_MSG_RESULT([enabling general systemd support])
+ ac_cv_init_dir="/lib/systemd/system"
;;
"none")
AC_MSG_RESULT([disabling init-style support])
+ ac_cv_init_dir="none"
;;
*)
AC_MSG_ERROR([illegal init-style])
AM_CONDITIONAL(USE_SYSTEMD, test x$init_style = xsystemd || test x$init_style = xredhat-systemd || test x$init_style = xsuse-systemd)
AM_CONDITIONAL(USE_UNDEF, test x$init_style = xnone)
+ AC_ARG_WITH(init-dir,
+ [ --with-init-dir=PATH path to OS specific init directory],
+ ac_cv_init_dir="$withval", ac_cv_init_dir="$ac_cv_init_dir"
+ )
+ INIT_DIR="$ac_cv_init_dir"
+ AC_SUBST(INIT_DIR, ["$ac_cv_init_dir"])
])
dnl OS specific configuration