]> arthur.barton.de Git - netatalk.git/blobdiff - macros/netatalk.m4
Merge branch 'v3-cleanup' into v3.1.6-alex
[netatalk.git] / macros / netatalk.m4
index 27c30322dcd248e870e21321d6999e0d0073fefb..12a1fecbc3660ad684e2f94f9a34f5edde8ef299 100644 (file)
@@ -77,16 +77,19 @@ AC_DEFUN([AC_NETATALK_DTRACE], [
 
 dnl Check for dbus-glib, for AFP stats
 AC_DEFUN([AC_NETATALK_DBUS_GLIB], [
-    atalk_cv_with_dbus=no
+  atalk_cv_with_dbus=no
+
+  AC_ARG_WITH(afpstats,
+    AS_HELP_STRING(
+      [--with-afpstats],
+      [Enable AFP statistics via dbus (default: enabled if dbus found)]
+    ),,[withval=auto]
+  )
+
+  if test x"$withval" != x"no" ; then
     PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.1, have_dbus=yes, have_dbus=no)
     PKG_CHECK_MODULES(DBUS_GLIB, dbus-glib-1, have_dbus_glib=yes, have_dbus_glib=no)
     PKG_CHECK_MODULES(DBUS_GTHREAD, gthread-2.0, have_dbus_gthread=yes, have_dbus_gthread=no)
-    AC_SUBST(DBUS_CFLAGS)
-    AC_SUBST(DBUS_LIBS)
-    AC_SUBST(DBUS_GLIB_CFLAGS)
-    AC_SUBST(DBUS_GLIB_LIBS)
-    AC_SUBST(DBUS_GTHREAD_CFLAGS)
-    AC_SUBST(DBUS_GTHREAD_LIBS)
     if test x$have_dbus_glib = xyes -a x$have_dbus = xyes -a x$have_dbus_gthread = xyes ; then
         saved_CFLAGS=$CFLAGS
         saved_LIBS=$LIBS
@@ -96,20 +99,32 @@ AC_DEFUN([AC_NETATALK_DBUS_GLIB], [
         CFLAGS="$saved_CFLAGS"
         LIBS="$saved_LIBS"
     fi
-    AM_CONDITIONAL(HAVE_DBUS_GLIB, test x$atalk_cv_with_dbus = xyes)
+  fi
 
-    AC_ARG_WITH(
-        dbus-sysconf-dir,
-        [AS_HELP_STRING([--with-dbus-sysconf-dir=PATH],[Path to dbus system bus security configuration directory (default: ${sysconfdir}/dbus-1/system.d/)])],
-        ac_cv_dbus_sysdir=$withval,
-        ac_cv_dbus_sysdir='${sysconfdir}/dbus-1/system.d'
-    )
+  if test x"$withval" = x"yes" -a x"$atalk_cv_with_dbus" = x"no"; then
+    AC_MSG_ERROR([afpstats requested but dbus-glib not found])
+  fi
 
-    if test x$atalk_cv_with_dbus = xyes ; then
-        AC_DEFINE(HAVE_DBUS_GLIB, 1, [Define if support for dbus-glib was found])
-        DBUS_SYS_DIR="$ac_cv_dbus_sysdir"
-        AC_SUBST(DBUS_SYS_DIR)
-    fi
+  AC_ARG_WITH(
+      dbus-sysconf-dir,
+      [AS_HELP_STRING([--with-dbus-sysconf-dir=PATH],[Path to dbus system bus security configuration directory (default: ${sysconfdir}/dbus-1/system.d/)])],
+      ac_cv_dbus_sysdir=$withval,
+      ac_cv_dbus_sysdir='${sysconfdir}/dbus-1/system.d'
+  )
+  DBUS_SYS_DIR=""
+  if test x$atalk_cv_with_dbus = xyes ; then
+      AC_DEFINE(HAVE_DBUS_GLIB, 1, [Define if support for dbus-glib was found])
+      DBUS_SYS_DIR="$ac_cv_dbus_sysdir"
+  fi
+
+  AC_SUBST(DBUS_SYS_DIR)
+  AC_SUBST(DBUS_CFLAGS)
+  AC_SUBST(DBUS_LIBS)
+  AC_SUBST(DBUS_GLIB_CFLAGS)
+  AC_SUBST(DBUS_GLIB_LIBS)
+  AC_SUBST(DBUS_GTHREAD_CFLAGS)
+  AC_SUBST(DBUS_GTHREAD_LIBS)
+  AM_CONDITIONAL(HAVE_DBUS_GLIB, test x$atalk_cv_with_dbus = xyes)
 ])
 
 dnl Whether to enable developer build
@@ -125,6 +140,46 @@ AC_DEFUN([AC_DEVELOPER], [
     AM_CONDITIONAL(DEVELOPER, test x"$enable_dev" = x"yes")
 ])
 
+dnl Tracker, for Spotlight
+AC_DEFUN([AC_NETATALK_SPOTLIGHT], [
+    ac_cv_have_tracker=no
+    ac_cv_tracker_pkg_version_default=0.12
+    ac_cv_tracker_pkg_version_min=0.12
+
+    dnl Tracker SPARQL
+    AC_ARG_WITH([tracker-pkgconfig-version],
+      [AS_HELP_STRING([--with-tracker-pkgconfig-version=VERSION],[Version suffix of the Tracker SPARQL pkg-config (default: 0.12)])],
+      [ac_cv_tracker_pkg_version=$withval],
+      [ac_cv_tracker_pkg_version=$ac_cv_tracker_pkg_version_default]
+    )
+
+    AC_ARG_WITH([tracker-prefix],
+      [AS_HELP_STRING([--with-tracker-prefix=PATH],[Prefix of Tracker installation (default: none)])],
+      [ac_cv_tracker_prefix=$withval],
+      [ac_cv_tracker_prefix="`pkg-config --variable=prefix tracker-sparql-$ac_cv_tracker_pkg_version`"]
+    )
+
+    AC_ARG_VAR([PKG_CONFIG_PATH], [Path to additional pkg-config packages])
+    PKG_CHECK_MODULES([TRACKER], [tracker-sparql-$ac_cv_tracker_pkg_version >= $ac_cv_tracker_pkg_version_min], [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_sparql" = x"yes" ; then
+            AC_MSG_ERROR([$ac_cv_tracker_pkg not found])
+        fi
+    else
+        ac_cv_have_tracker=yes
+        AC_DEFINE(HAVE_TRACKER, 1, [Define if Tracker is available])
+        AC_DEFINE_UNQUOTED(TRACKER_PREFIX, ["$ac_cv_tracker_prefix"], [Path to Tracker])
+        AC_DEFINE([DBUS_DAEMON_PATH], ["/bin/dbus-daemon"], [Path to dbus-daemon])
+    fi
+
+    AC_SUBST(TRACKER_CFLAGS)
+    AC_SUBST(TRACKER_LIBS)
+    AC_SUBST(TRACKER_MINER_CFLAGS)
+    AC_SUBST(TRACKER_MINER_LIBS)
+    AM_CONDITIONAL(HAVE_TRACKER, [test x"$ac_cv_have_tracker" = x"yes"])
+])
+
 dnl Whether to disable bundled libevent
 AC_DEFUN([AC_NETATALK_LIBEVENT], [
     AC_MSG_CHECKING([whether to use bundled libevent])
@@ -156,6 +211,31 @@ AC_DEFUN([AC_NETATALK_LIBEVENT], [
     AM_CONDITIONAL(USE_BUILTIN_LIBEVENT, test x"$use_bundled_libevent" = x"yes")
 ])
 
+dnl Whether to disable bundled tdb
+AC_DEFUN([AC_NETATALK_TDB], [
+    AC_ARG_WITH(
+        tdb,
+        [AS_HELP_STRING([--with-tdb],[whether to use the bundled tdb (default: yes)])],
+        use_bundled_tdb=$withval,
+        use_bundled_tdb=yes
+    )
+    AC_MSG_CHECKING([whether to use bundled tdb])
+    AC_MSG_RESULT([$use_bundled_tdb])
+
+    if test x"$use_bundled_tdb" = x"yes" ; then
+        AC_DEFINE(USE_BUILTIN_TDB, 1, [Use internal tbd])
+    else
+        if test -z "$TDB_LIBS" ; then
+            PKG_CHECK_MODULES(TDB, tdb, , [AC_MSG_ERROR([couldn't find tdb with pkg-config])])
+        fi
+        use_bundled_tdb=no
+    fi        
+
+    AC_SUBST(TDB_CFLAGS)
+    AC_SUBST(TDB_LIBS)
+    AM_CONDITIONAL(USE_BUILTIN_TDB, test x"$use_bundled_tdb" = x"yes")
+])
+
 dnl Filesystem Hierarchy Standard (FHS) compatibility
 AC_DEFUN([AC_NETATALK_FHS], [
 AC_MSG_CHECKING([whether to use Filesystem Hierarchy Standard (FHS) compatibility])
@@ -400,7 +480,7 @@ AC_ARG_ENABLE(shell-check,
 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]]],
+                [  --with-init-style       use OS specific init config [[redhat-sysv|redhat-systemd|suse-sysv|suse-systemd|gentoo|netbsd|debian-sysv|debian-systemd|solaris|systemd]]],
                 init_style="$withval", init_style=none
     )
     case "$init_style" in 
@@ -435,9 +515,16 @@ AC_DEFUN([AC_NETATALK_INIT_STYLE], [
            ac_cv_init_dir="/etc/rc.d"
         ;;
     "debian")
-           AC_MSG_RESULT([enabling debian-style initscript support])
+           AC_MSG_ERROR([--with-init-style=debian is obsoleted. Use debian-sysv or debian-systemd.])
+        ;;
+    "debian-sysv")
+           AC_MSG_RESULT([enabling debian-style sysv initscript support])
            ac_cv_init_dir="/etc/init.d"
         ;;
+    "debian-systemd")
+           AC_MSG_RESULT([enabling debian-style systemd support])
+           ac_cv_init_dir="/lib/systemd/system"
+           ;;
     "solaris")
            AC_MSG_RESULT([enabling solaris-style SMF support])
            ac_cv_init_dir="/lib/svc/manifest/network/"
@@ -459,8 +546,9 @@ AC_DEFUN([AC_NETATALK_INIT_STYLE], [
     AM_CONDITIONAL(USE_SUSE_SYSV, test x$init_style = xsuse-sysv)
     AM_CONDITIONAL(USE_SOLARIS, test x$init_style = xsolaris)
     AM_CONDITIONAL(USE_GENTOO, test x$init_style = xgentoo)
-    AM_CONDITIONAL(USE_DEBIAN, test x$init_style = xdebian)
+    AM_CONDITIONAL(USE_DEBIAN_SYSV, test x$init_style = xdebian-sysv)
     AM_CONDITIONAL(USE_SYSTEMD, test x$init_style = xsystemd || test x$init_style = xredhat-systemd || test x$init_style = xsuse-systemd)
+    AM_CONDITIONAL(USE_DEBIAN_SYSTEMD, test x$init_style = xdebian-systemd)
     AM_CONDITIONAL(USE_UNDEF, test x$init_style = xnone)
 
     AC_ARG_WITH(init-dir,
@@ -1042,7 +1130,7 @@ dnl ------ Check for sendfile() --------
 AC_DEFUN([AC_NETATALK_SENDFILE], [
 netatalk_cv_search_sendfile=yes
 AC_ARG_ENABLE(sendfile,
-    [  --disable-sendfile       disable sendfile syscall],
+    [  --disable-sendfile      disable sendfile syscall],
     [if test x"$enableval" = x"no"; then
             netatalk_cv_search_sendfile=no
         fi]
@@ -1078,6 +1166,23 @@ if test x"$netatalk_cv_search_sendfile" = x"yes"; then
 fi
 ])
 
+dnl ------ Check for recvfile() --------
+AC_DEFUN([AC_NETATALK_RECVFILE], [
+case "$host_os" in
+*linux*)
+    AC_CHECK_FUNCS([splice], [atalk_cv_use_recvfile=yes])
+    ;;
+
+*)
+    ;;
+
+esac
+
+if test x"$atalk_cv_use_recvfile" = x"yes"; then
+    AC_DEFINE(WITH_RECVFILE, 1, [Whether recvfile should be used])
+fi
+])
+
 dnl --------------------- Check if realpath() takes NULL
 AC_DEFUN([AC_NETATALK_REALPATH], [
 AC_CACHE_CHECK([if the realpath function allows a NULL argument],