summaryrefslogtreecommitdiff
path: root/configure.ac
blob: bb5611f9c2689860821843de152ce4e36ddbdbfe (plain)
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
AC_INIT([zeitgeist-datasources],
	[0.8.0],
	[https://bugs.launchpad.net/zeitgeist-datasources/])

AC_PREFIX_DEFAULT([/usr])

AM_INIT_AUTOMAKE([1.9 foreign])

# Enable silent build when available (Automake 1.11)
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])

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_PROG_LIBTOOL
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 for Mono
dnl ==============================================

AC_ARG_WITH([mono],
	AS_HELP_STRING([--without-mono],
		[Disables Mono plugins]),
	[],[with_mono=yes])

AM_CONDITIONAL(ENABLE_MONO, test "x$with_mono" = "xyes")

AC_PATH_PROG(GMCS, gmcs, no)
AC_PATH_PROG(XBUILD, xbuild, no)

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

PKG_CHECK_MODULES(ZEITGEIST, zeitgeist-1.0, [HAVE_LIBZG=yes], [HAVE_LIBZG=no])
PKG_CHECK_MODULES(GTK, gtk+-2.0, [HAVE_GTK=yes], [HAVE_GTK=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_NOTICE([Requested to enable all plugins: ${all_plugins}])

# The full list of plugins
allowed_plugins="bzr chrome eog geany gedit vim emacs tomboy telepathy xchat rhythmbox firefox totem-libzg firefox-36-libzg"
# currently disabled = "epiphany firefox-40-libzg"

# npapi-plugin has a template Makefile.am, but don't use it directly
#   - see chrome's Makefile.am for how to compile it

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)
		;;
		gedit)
		;;
		rhythmbox)
		;;
		rhythmbox-popular)
			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
			if test "${HAVE_GTK}" != "yes" ; then
				plugin_error_or_ignore "gtk+-2.0 not found"
				continue
			fi
			PKG_CHECK_MODULES([LIBXML], [libxml-2.0],
				[HAVE_LIBXML=yes], [HAVE_LIBXML=no])
			if test "${HAVE_LIBXML}" != "yes" ; then
				plugin_error_or_ignore "libxml package not found"
				continue
			fi
		;;
		epiphany)
			# not supported atm
			continue
		;;
		firefox)
		;;
		firefox-40-libzg)
			if test "${HAVE_LIBZG}" != "yes" ; then
				plugin_error_or_ignore "libzeitgeist not found"
				continue
			fi
			PKG_CHECK_MODULES(LIBXUL_2_0, libxul >= 2.0,
				[HAVE_LIBXUL=yes], [HAVE_LIBXUL=no])
			if test "${HAVE_LIBXUL}" != "yes" ; then
				plugin_error_or_ignore "libxul 2.0+ for firefox-40-libzg not found"
				continue
			fi
			XPIDL_BIN="`$PKG_CONFIG --variable=sdkdir libxul`/bin/xpidl"
			AC_SUBST(XPIDL_BIN)
			XUL_IDLDIR="`$PKG_CONFIG --variable=idldir libxul`"
			AC_SUBST(XUL_IDLDIR)
                        AC_DEFINE(MOZ_NO_MOZALLOC, ["For Mozilla Firefox 4"])
		;;
		firefox-36-libzg)
			if test "${HAVE_LIBZG}" != "yes" ; then
				plugin_error_or_ignore "libzeitgeist not found"
				continue
			fi
			PKG_CHECK_MODULES(LIBXUL_1_9_2, [libxul >= 1.9.2 libxul < 2.0],
				[HAVE_LIBXUL=yes], [HAVE_LIBXUL=no])
			if test "${HAVE_LIBXUL}" != "yes" ; then
				plugin_error_or_ignore "libxul 1.92 for firefox-36-libzg not found"
				continue
			fi
			XPIDL_BIN="`$PKG_CONFIG --variable=sdkdir libxul`/bin/xpidl"
			AC_SUBST(XPIDL_BIN)
			XUL_IDLDIR="`$PKG_CONFIG --variable=idldir libxul`"
			AC_SUBST(XUL_IDLDIR)
		;;
		geany)
			if test "${HAVE_LIBZG}" != "yes" ; then
				plugin_error_or_ignore "libzeitgeist not found"
				continue
			fi
        	        if test "x$HAVE_GTK" = "xno"; then
				plugin_error_or_ignore "You need to install gtk development headers"
				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
		;;
		npapi-plugin)
			if test "${HAVE_LIBZG}" != "yes" ; then
				plugin_error_or_ignore "libzeitgeist not found"
				continue
			fi
		;;
		tomboy)
			if test "${with_mono}" != "yes" ; then
				continue
			fi
			PKG_CHECK_MODULES(ZEITGEIST_SHARP, zeitgeist-sharp,
				ENABLE_ZEITGEIST_SHARP=yes, ENABLE_ZEITGEIST_SHARP=no)
			PKG_CHECK_MODULES(TOMBOY_ADDINS, tomboy-addins,
               			 HAS_TOMBOY_ADDINS=yes, HAS_TOMBOY_ADDINS=no)
			PKG_CHECK_MODULES(GTK_SHARP, gtk-sharp-2.0, 
				HAS_GTK_SHARP=yes, GTK_SHARP=no)
			if test "${ENABLE_ZEITGEIST_SHARP}" = "no" ; then
				plugin_error_or_ignore "zeitgeist-sharp package not found"
				continue
			fi
			AC_PATH_PROG(TOMBOY, tomboy, no)
			if test "x$TOMBOY_ADDINS" = "xno"; then
				plugin_error_or_ignore "You need to install tomboy"
				continue
			fi
			if test "x$GMCS" = "xno"; then
				plugin_error_or_ignore "You need to install gmcs"
				continue
			fi
			if test "x$XBUILD" = "xno"; then
			  plugin_error_or_ignore "You need to install xbuild for tomboy"
				continue
			fi
			if test "x$GTK_SHARP" = "xno"; then
				plugin_error_or_ignore "You need to install gtk-sharp"
				continue
			fi
			AC_SUBST(ZEITGEIST_SHARP_LIBS)
		;;
		totem*)
			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
			if test "${HAVE_GTK}" != "yes" ; then
				plugin_error_or_ignore "gtk+-2.0 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
		;;
		vim)
		;;
		emacs)
			AM_PATH_LISPDIR
		;;
		telepathy)
		;;
		xchat)
			if test "${HAVE_LIBZG}" != "yes" ; then
				plugin_error_or_ignore "libzeitgeist 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_CONFIG_FILES([Makefile])

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

extra_subdirs=""

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])
                                        case ${allowed_plugin} in
                                        	bzr)
                                        		AC_CONFIG_FILES([bzr/Makefile])
                                        		continue 2
                                        	;;
                                        	chrome)
                                        		AC_CONFIG_FILES([chrome/Makefile])
                                        		extra_subdirs="${extra_subdirs} npapi-plugin"
                                        		continue 2
                                        	;;
                                        	eog)
                                        		AC_CONFIG_FILES([eog/Makefile])
                                        		continue 2
                                        	;;
                                        	firefox)
												AC_CONFIG_FILES([
													firefox/Makefile
													firefox/extension/Makefile
												])
												continue 2
											;;
                                        	firefox-40-libzg)
                                        		AC_CONFIG_FILES([
                                        			firefox-40-libzg/Makefile
                                        			firefox-40-libzg/extension/Makefile
                                        			firefox-40-libzg/extension/components/Makefile
                                        		])
                                        		continue 2
                                        	;;
											firefox-36-libzg)
                                        		AC_CONFIG_FILES([
                                        			firefox-36-libzg/Makefile
                                        			firefox-36-libzg/extension/Makefile
                                        			firefox-36-libzg/extension/components/Makefile
                                        		])
                                        		continue 2
                                        	;;
                                        	geany)
                                        		AC_CONFIG_FILES([geany/Makefile])
                                        		continue 2
                                        	;;
											gedit)
                                        		AC_CONFIG_FILES([gedit/Makefile])
                                        		continue 2
											;;
                                        	tomboy)
                                        		AC_CONFIG_FILES([tomboy/Makefile])
                                        		continue 2
                                        	;;
											rhythmbox)
                                        		AC_CONFIG_FILES([rhythmbox/Makefile])
                                        		continue 2
											;;
											totem-libzg)
                                        		AC_CONFIG_FILES([totem-libzg/Makefile])
                                        		continue 2
                                        	;;
                                        	vim)
                                        		AC_CONFIG_FILES([vim/Makefile])
                                        		continue 2
                                        	;;
                                        	emacs)
                                        		AC_CONFIG_FILES([emacs/Makefile])
                                        		continue 2
                                        	;;
											telepathy)
												AC_CONFIG_FILES([telepathy/Makefile])
												continue 2
											;;
						                    xchat)
                                        		AC_CONFIG_FILES([xchat/Makefile])
                                        		continue 2
                                        	;;
                                        	*)
                                        		AC_MSG_ERROR([cannot configure ${allowed_plugin}])
                                        		continue 2
                                        	;;
                                        esac
                                        continue 2
                                ;;
                                *);;
                        esac
                done
                AC_MSG_NOTICE([   ${allowed_plugin} plugin disabled])
        done
else
        AC_MSG_NOTICE([   No plugins enabled])
fi

EXTRA_SUBDIRS=$extra_subdirs
AC_SUBST([EXTRA_SUBDIRS])
AC_OUTPUT