Git Repositories

2006-03-21 Benedikt Meurer <benny@xfce.org>
[thunar.git] / acinclude.m4
1 dnl $Id$
2 dnl
3 dnl Copyright (c) 2004-2006
4 dnl         The Thunar development team. All rights reserved.
5 dnl
6 dnl Written for Thunar by Benedikt Meurer <benny@xfce.org>.
7 dnl
8
9
10
11 dnl # BM_THUNAR_PLUGIN_SBR()
12 dnl #
13 dnl # Check whether the "Simple Builtin Renamers" plugin
14 dnl # should be built and installed.
15 dnl #
16 AC_DEFUN([BM_THUNAR_PLUGIN_SBR],
17 [
18 AC_ARG_ENABLE([sbr-plugin], AC_HELP_STRING([--disable-sbr-plugin], [Don't build the thunar-sbr plugin, see plugins/thunar-sbr/README]),
19   [ac_bm_thunar_plugin_sbr=$enable_val], [ac_bm_thunar_plugin_sbr=yes])
20 AC_MSG_CHECKING([whether to build the thunar-sbr plugin])
21 AM_CONDITIONAL([THUNAR_PLUGIN_SBR], [test x"$ac_bm_thunar_plugin_sbr" = x"yes"])
22 AC_MSG_RESULT([$ac_bm_thunar_plugin_sbr])
23
24 dnl Check for PCRE (for the "Search & Replace" renamer)
25 XDT_CHECK_OPTIONAL_PACKAGE([PCRE], [libpcre], [6.0], [pcre], [Regular expression support])
26 ])
27
28
29
30 dnl # BM_THUNAR_PLUGIN_UCA()
31 dnl #
32 dnl # Check whether the "User Customizable Actions" plugin
33 dnl # should be built and installed.
34 dnl #
35 AC_DEFUN([BM_THUNAR_PLUGIN_UCA],
36 [
37 AC_ARG_ENABLE([uca-plugin], AC_HELP_STRING([--disable-uca-plugin], [Don't build the thunar-uca plugin, see plugins/thunar-uca/README]),
38   [ac_bm_thunar_plugin_uca=$enable_val], [ac_bm_thunar_plugin_uca=yes])
39 AC_MSG_CHECKING([whether to build the thunar-uca plugin])
40 AM_CONDITIONAL([THUNAR_PLUGIN_UCA], [test x"$ac_bm_thunar_plugin_uca" = x"yes"])
41 AC_MSG_RESULT([$ac_bm_thunar_plugin_uca])
42 ])
43
44
45
46 dnl # BM_THUNAR_VFS_MONITOR_IMPL()
47 dnl #
48 dnl # Determine the file system monitoring to use for
49 dnl # thunar-vfs.
50 dnl #
51 dnl # Sets LIBFAM_CFLAGS and LIBFAM_LIBS and defines
52 dnl # HAVE_FAM_H and HAVE_LIBFAM if FAM/Gamin were
53 dnl # found.
54 dnl #
55 dnl # Sets $ac_bm_thunar_vfs_monitor_impl to "FAM",
56 dnl # "Gamin" or "none".
57 dnl #
58 AC_DEFUN([BM_THUNAR_VFS_MONITOR_IMPL],
59 [
60 LIBFAM_CFLAGS=""
61 LIBFAM_LIBS=""
62 have_libfam=no
63 ac_bm_thunar_vfs_monitor_impl="none"
64 XDT_CHECK_PACKAGE([LIBFAM], [gamin], [0.1.0],
65 [
66   have_libfam=yes
67   ac_bm_thunar_vfs_monitor_impl="Gamin"
68 ],
69 [
70   dnl Fallback to a generic FAM check
71   AC_CHECK_HEADERS([fam.h],
72   [
73     AC_CHECK_LIB([fam], [FAMOpen],
74     [
75       have_libfam="yes" LIBFAM_LIBS="-lfam"
76       ac_bm_thunar_vfs_monitor_impl="FAM"
77     ])
78   ])
79 ])
80 if test x"$have_libfam" = x"yes"; then
81   dnl Define appropriate symbols
82   AC_DEFINE([HAVE_FAM_H], [1], [Define to 1 if you have the <fam.h> header file.])
83   AC_DEFINE([HAVE_LIBFAM], [1], [Define to 1 if the File Alteration Monitor is available.])
84
85   dnl Check for FAMNoExists (currently Gamin only)
86   save_LIBS="$LIBS"
87   LIBS="$LIBS $LIBFAM_LIBS"
88   AC_CHECK_FUNCS([FAMNoExists])
89   LIBS="$save_LIBS"
90 fi
91 AC_SUBST([LIBFAM_CFLAGS])
92 AC_SUBST([LIBFAM_LIBS])
93 ])
94
95
96
97 dnl # BM_THUNAR_VFS_VOLUME_IMPL()
98 dnl #
99 dnl # Determines the volume manager implementation to
100 dnl # use for thunar-vfs.
101 dnl #
102 dnl # Sets ac_bm_thunar_vfs_volume_impl to "freebsd",
103 dnl # "hal" or "none".
104 dnl #
105 AC_DEFUN([BM_THUNAR_VFS_VOLUME_IMPL],
106 [
107   dnl The --with-volume-manager option
108   AC_ARG_WITH([volume-manager],
109 AC_HELP_STRING([--with-volume-manager=@<:@auto/freebsd/hal/none@:>@], [The volume manager implementation @<:@default=auto@:>@]),
110     [], [with_volume_manager=auto])
111
112   dnl # Check if we should try to auto-detect
113   if test x"$with_volume_manager" = x"freebsd"; then
114     ac_bm_thunar_vfs_volume_impl=freebsd
115   elif test x"$with_volume_manager" = x"hal"; then
116     ac_bm_thunar_vfs_volume_impl=hal
117   elif test x"$with_volume_manager" = x"none"; then
118     ac_bm_thunar_vfs_volume_impl=none
119   else
120     dnl # Check target platform (auto-detection)
121     case "$target_os" in
122     freebsd*)
123       dnl # FreeBSD is fully supported
124       ac_bm_thunar_vfs_volume_impl=freebsd
125       ;;
126     *)
127       dnl # Otherwise, check if we have HAL
128       XDT_CHECK_PACKAGE([HAL], [hal-storage], [0.5.0], [ac_bm_thunar_vfs_volume_impl=hal], [ac_bm_thunar_vfs_volume_impl=none])
129       ;;
130     esac
131   fi
132
133   dnl # We need HAL >= 0.5.x and D-BUS >= 0.23 for the HAL volume manager
134   if test x"$ac_bm_thunar_vfs_volume_impl" = x"hal"; then
135     XDT_CHECK_PACKAGE([HAL], [hal-storage], [0.5.0])
136     XDT_CHECK_PACKAGE([HAL_DBUS], [dbus-glib-1], [0.23])
137   fi
138
139   dnl # Set config.h variables depending on what we're going to use
140   AC_MSG_CHECKING([for the volume manager implemenation])
141   case "$ac_bm_thunar_vfs_volume_impl" in
142   freebsd)
143     AC_DEFINE([THUNAR_VFS_VOLUME_IMPL_FREEBSD], [1], [Define to 1 if the FreeBSD volume manager implementation should be used])
144     ;;
145
146   hal)
147     AC_DEFINE([THUNAR_VFS_VOLUME_IMPL_HAL], [1], [Define to 1 if the HAL volume manager implementation should be used])
148     ;;
149
150   *)
151     AC_DEFINE([THUNAR_VFS_VOLUME_IMPL_NONE], [1], [Define to 1 if no volume manager implementation should be used])
152     ;;
153   esac
154   AC_MSG_RESULT([$ac_bm_thunar_vfs_volume_impl])
155
156   dnl # Set automake conditionals appropriately
157   AM_CONDITIONAL([THUNAR_VFS_VOLUME_IMPL_FREEBSD], [test x"$ac_bm_thunar_vfs_volume_impl" = x"freebsd"])
158   AM_CONDITIONAL([THUNAR_VFS_VOLUME_IMPL_HAL], [test x"$ac_bm_thunar_vfs_volume_impl" = x"hal"])
159   AM_CONDITIONAL([THUNAR_VFS_VOLUME_IMPL_NONE], [test x"$ac_bm_thunar_vfs_volume_impl" = x"none"])
160 ])