~zeitgeist-dataproviders/zeitgeist-datasources/git

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
AC_INIT([zeitgeist-dataproviders],
	[0.1.0],
	[https://bugs.launchpad.net/zeitgeist-dataproviders/])

AM_INIT_AUTOMAKE([1.9 foreign])

dnl pkg-config
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
if test "x$PKG_CONFIG" = "xno"; then
	AC_MSG_ERROR([You need to install pkg-config])
fi

AC_PROG_INSTALL
AC_PROG_CC
AC_PROG_CXX
AC_STDC_HEADERS

dnl ==============================================
dnl Check for vala
dnl ==============================================
AC_ARG_WITH([vala],
	AS_HELP_STRING([--without-vala],
		[Disables Vala plugins]),
	[],[with_vala=yes])

if test "$with_vala" != "no"; then
  AM_PROG_VALAC([0.7.10])
fi
AM_CONDITIONAL(ENABLE_VALA, test "x$with_vala" = "xyes")

dnl ==============================================
dnl Check commonly used packages
dnl ==============================================

PKG_CHECK_MODULES(ZEITGEIST, zeitgeist-1.0, [HAVE_LIBZG=yes], [HAVE_LIBZG=no])

dnl ==============================================
dnl Enable building only supported plugins
dnl ==============================================
AC_ARG_ENABLE([all-plugins],
	[AS_HELP_STRING([--enable-all-plugins],[Enable building of all plugins without checking for their support])],
        [all_plugins=$enableval], [all_plugins=no])

AC_MSG_RESULT($all_plugins)

# The full list of plugins
allowed_plugins="bzr chrome eog firefox-libzg geany gedit npapi-plugin rhythmbox totem-libzg"
# currently disabled = "epiphany tomboy"

plugin_error_or_ignore()
{
	if test "${error_on_bad_plugin}" = "1" ; then
		AC_MSG_ERROR([$1])
	else
		AC_MSG_WARN([$1 (disabling plugin)])
	fi
}

used_plugins="${allowed_plugins}"
used_plugins2=""
if test "x${all_plugins}" = "xyes" ; then
	error_on_bad_plugin="1"
else
	error_on_bad_plugin="0"
fi

# Check for plugin-specific requirements and error if necessary
for plugin in ${used_plugins}; do
	add_plugin="1"

	case ${plugin} in
		bzr)
		;;
		chrome)
			if test "${HAVE_LIBZG}" != "yes" ; then
				plugin_error_or_ignore "libzeitgeist not found"
				continue
			fi
		;;
		eog)
		;;
		epiphany)
			# not supported atm
			continue
		;;
		firefox-libzg)
			if test "${HAVE_LIBZG}" != "yes" ; then
				plugin_error_or_ignore "libzeitgeist not found"
				continue
			fi
		;;
		geany)
			if test "${HAVE_LIBZG}" != "yes" ; then
				plugin_error_or_ignore "libzeitgeist not found"
				continue
			fi
			PKG_CHECK_MODULES(GEANY, geany,
				[HAVE_GEANY=yes], [HAVE_GEANY=no])
			if test "${HAVE_GEANY}" != "yes" ; then
				plugin_error_or_ignore "geany not found"
				continue
			fi
		;;
		gedit)
		;;
		npapi-plugin)
			if test "${HAVE_LIBZG}" != "yes" ; then
				plugin_error_or_ignore "libzeitgeist not found"
				continue
			fi
		;;
		rhythmbox)
		;;
		tomboy)
			# not supported atm
			continue
		;;
		totem-libzg)
			if test "${with_vala}" != "yes" ; then
				plugin_error_or_ignore "you need vala installed to use the ${plugin} plugin"
				continue
			fi
			if test "${HAVE_LIBZG}" != "yes" ; then
				plugin_error_or_ignore "libzeitgeist not found"
				continue
			fi
			PKG_CHECK_MODULES(TOTEM_PLPARSER, totem-plparser,
				[HAVE_TOTEM_PLPARSER=yes], [HAVE_TOTEM_PLPARSER=no])
			if test "${HAVE_TOTEM_PLPARSER}" != "yes" ; then
				plugin_error_or_ignore "totem-plparser package not found"
				continue
			fi
		;;
		*)
			plugin_error_or_ignore "${plugin} is not handled"
			continue
		;;
        esac

	# Add the specified plugin
	used_plugins2="${used_plugins2} ${plugin}"
done

ALL_PLUGINS=$allowed_plugins
PLUGINS=$used_plugins2

AC_MSG_CHECKING([which plugins to compile])
AC_MSG_RESULT([$PLUGINS])

AC_SUBST([PLUGINS])

AC_SUBST([AM_CPPFLAGS])
AC_SUBST([AM_CFLAGS])
AC_SUBST([AM_CXXFLAGS])
AC_SUBST([AM_LDFLAGS])

AC_OUTPUT([
Makefile
chrome/Makefile
])

AC_MSG_NOTICE([Zeitgeist-dataproviders was configured with the following options:])

if test "x${PLUGINS}" != "x" ; then
        for allowed_plugin in ${ALL_PLUGINS}; do
                for plugin in ${PLUGINS}; do
                        case ${allowed_plugin} in
                                ${plugin})
                                        AC_MSG_NOTICE([** ${allowed_plugin} plugin enabled])
                                        continue 2
                                ;;
                                *);;
                        esac
                done
                AC_MSG_NOTICE([   ${allowed_plugin} plugin disabled])
        done
else
        AC_MSG_NOTICE([   No plugins enabled])
fi