1dnl Process this file with autoconf to produce a configure script.
2
3AC_PREREQ(2.52)
4
5AC_INIT([StarDict], 3.0.6, [http://www.stardict.org])
6AC_CONFIG_SRCDIR(src/stardict.cpp)
7AC_CONFIG_AUX_DIR([.])
8AM_INIT_AUTOMAKE([1.9 tar-ustar dist-bzip2])
9
10AC_CONFIG_HEADERS([config.h])
11AH_BOTTOM([#include <../lib/config-custom.h>])
12AM_DISABLE_STATIC
13
14AC_PATH_PROG(GCONFTOOL, gconftool-2)
15IT_PROG_INTLTOOL([0.22])
16PKG_PROG_PKG_CONFIG
17
18AC_CONFIG_MACRO_DIR(m4)
19LT_INIT
20GNOME_DOC_INIT
21
22AC_ISC_POSIX
23AC_PROG_CC
24AC_PROG_CXX
25AC_LANG([C++])
26AC_PROG_INSTALL
27AC_PROG_MAKE_SET
28AC_PROG_LIBTOOL
29
30AC_FUNC_MMAP
31AC_CHECK_FUNC(gethostbyname_r, AC_DEFINE([HAVE_GETHOSTBYNAME_R], [], [Have gethostbyname_r function.]))
32AC_CHECK_FUNC(memrchr, AC_DEFINE([HAVE_MEMRCHR], [], [Have memrchr function.]))
33
34
35dnl ================================================================
36dnl Gettext stuff.
37dnl ================================================================
38GETTEXT_PACKAGE=stardict
39AC_SUBST(GETTEXT_PACKAGE)
40AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
41AM_GLIB_GNU_GETTEXT
42
43
44dnl ================================================================
45dnl spell plugin checks: enchant.
46dnl ================================================================
47
48ENCHANT_REQUIRED=1.2.0
49AC_ARG_ENABLE([spell],
50	AS_HELP_STRING([--disable-spell],[Disable spell plugin (default: enabled)]),
51	[enable_enchant=$enableval],
52	[enable_enchant=yes])
53
54if test "x$enable_enchant" = "xyes" ; then
55	PKG_CHECK_MODULES(ENCHANT, enchant >= $ENCHANT_REQUIRED, \
56			have_enchant=yes, have_enchant=no)
57	if test "x$have_enchant" = "xyes"; then
58		ENCHANT_CFLAGS="${ENCHANT_CFLAGS}"
59		ENCHANT_LIBS="${ENCHANT_LIBS}"
60		SPELL_PLUGIN_DIR="stardict-spell-plugin"
61	else
62		AC_MSG_ERROR([Enchant library not found or too old. Use --disable-spell to build without spell plugin.])
63	fi
64else
65	ENCHANT_CFLAGS=
66	ENCHANT_LIBS=
67	SPELL_PLUGIN_DIR=
68fi
69
70AC_SUBST(ENCHANT_CFLAGS)
71AC_SUBST(ENCHANT_LIBS)
72AC_SUBST(SPELL_PLUGIN_DIR)
73
74dnl ================================================================
75dnl gucharmap plugin checks.
76dnl ================================================================
77
78AC_ARG_ENABLE([gucharmap],
79	AS_HELP_STRING([--disable-gucharmap],[Disable gucharmap plugin (default: enabled)]),
80	[enable_gucharmap=$enableval],
81	[enable_gucharmap=yes])
82
83if test "x$enable_gucharmap" = "xyes" ; then
84	PKG_CHECK_MODULES(GUCHARMAP, [gucharmap-2], have_gucharmap=yes, have_gucharmap=no)
85	if test "x$have_gucharmap" = "xyes"; then
86		GUCHARMAP_CFLAGS="${GUCHARMAP_CFLAGS}"
87		GUCHARMAP_LIBS="${GUCHARMAP_LIBS}"
88		GUCHARMAP_PLUGIN_DIR="stardict-gucharmap-plugin"
89	else
90		AC_MSG_ERROR([Gucharmap library not found or too old. Use --disable-gucharmap to build without gucharmap plugin.])
91	fi
92else
93	GUCHARMAP_CFLAGS=
94	GUCHARMAP_LIBS=
95	GUCHARMAP_PLUGIN_DIR=
96fi
97
98AC_SUBST(GUCHARMAP_CFLAGS)
99AC_SUBST(GUCHARMAP_LIBS)
100AC_SUBST(GUCHARMAP_PLUGIN_DIR)
101
102dnl ================================================================
103dnl festival tts plugin checks.
104dnl ================================================================
105
106AC_ARG_ENABLE([festival],
107	AS_HELP_STRING([--disable-festival],[Disable festival tts plugin (default: enabled)]),
108	[enable_festival=$enableval],
109	[enable_festival=yes])
110
111if test "x$enable_festival" = "xyes" ; then
112	dnl festival.h includes EST.h, it must be in include path
113	CPPFLAGS="${CPPFLAGS} -I/usr/include/speech_tools"
114	AC_CHECK_HEADERS([festival/festival.h],
115		[
116			FESTIVAL_LIBS="-lFestival -lestools -lestbase -leststring"
117			FESTIVAL_CFLAGS="-I/usr/include/speech_tools -ffriend-injection -Wno-deprecated"
118			FESTIVAL_PLUGIN_DIR="stardict-festival-tts-plugin"
119		],
120		[
121			AC_MSG_ERROR([Festival library not found. Use --disable-festival to build without festival plugin.])
122		],
123		[]
124	)
125else
126	FESTIVAL_CFLAGS=
127	FESTIVAL_LIBS=
128	FESTIVAL_PLUGIN_DIR=
129fi
130
131AC_SUBST(FESTIVAL_CFLAGS)
132AC_SUBST(FESTIVAL_LIBS)
133AC_SUBST(FESTIVAL_PLUGIN_DIR)
134
135dnl ================================================================
136dnl espeak tts plugin checks.
137dnl ================================================================
138
139AC_ARG_ENABLE([espeak],
140	AS_HELP_STRING([--disable-espeak],[Disable espeak tts plugin (default: enabled)]),
141	[enable_espeak=$enableval],
142	[enable_espeak=yes])
143
144if test "x$enable_espeak" = "xyes" ; then
145	AC_CHECK_HEADERS([espeak/speak_lib.h],
146		[
147			ESPEAK_LIBS="-lespeak"
148			ESPEAK_CFLAGS=
149			ESPEAK_PLUGIN_DIR="stardict-espeak-tts-plugin"
150		],
151		[
152			AC_MSG_ERROR([Espeak library not found. Use --disable-espeak to build without espeak plugin.])
153		],
154		[]
155	)
156else
157	ESPEAK_CFLAGS=
158	ESPEAK_LIBS=
159	ESPEAK_PLUGIN_DIR=
160fi
161
162AC_SUBST(ESPEAK_CFLAGS)
163AC_SUBST(ESPEAK_LIBS)
164AC_SUBST(ESPEAK_PLUGIN_DIR)
165
166dnl ================================================================
167dnl other plugin checks.
168dnl ================================================================
169
170AC_ARG_ENABLE([dictdotcn],
171	AS_HELP_STRING([--disable-dictdotcn],[Disable dictdotcn netdict plugin (default: enabled)]),
172	[enable_dictdotcn=$enableval],
173	[enable_dictdotcn=yes])
174if test "x$enable_dictdotcn" = "xyes" ; then
175	DICTDOTCN_PLUGIN_DIR="stardict-dictdotcn-plugin"
176else
177	DICTDOTCN_PLUGIN_DIR=
178fi
179AC_SUBST(DICTDOTCN_PLUGIN_DIR)
180
181AC_ARG_ENABLE([advertisement],
182	AS_HELP_STRING([--disable-advertisement],[Disable advertisement virtual dict plugin (default: enabled)]),
183	[enable_advertisement=$enableval],
184	[enable_advertisement=yes])
185if test "x$enable_advertisement" = "xyes" ; then
186	ADVERTISEMENT_PLUGIN_DIR="stardict-advertisement-plugin"
187else
188	ADVERTISEMENT_PLUGIN_DIR=
189fi
190AC_SUBST(ADVERTISEMENT_PLUGIN_DIR)
191
192AC_ARG_ENABLE([man],
193	AS_HELP_STRING([--disable-man],[Disable man virtual dict plugin (default: enabled)]),
194	[enable_man=$enableval],
195	[enable_man=yes])
196if test "x$enable_man" = "xyes" ; then
197	MAN_PLUGIN_DIR="stardict-man-plugin"
198else
199	MAN_PLUGIN_DIR=
200fi
201AC_SUBST(MAN_PLUGIN_DIR)
202
203AC_ARG_ENABLE([qqwry],
204	AS_HELP_STRING([--disable-qqwry],[Disable qqwry virtual dict plugin (default: enabled)]),
205	[enable_qqwry=$enableval],
206	[enable_qqwry=yes])
207if test "x$enable_qqwry" = "xyes" ; then
208	QQWRY_PLUGIN_DIR="stardict-qqwry-plugin"
209else
210	QQWRY_PLUGIN_DIR=
211fi
212AC_SUBST(QQWRY_PLUGIN_DIR)
213
214AC_ARG_ENABLE([updateinfo],
215	AS_HELP_STRING([--disable-updateinfo],[Disable update-info plugin (default: enabled)]),
216	[enable_updateinfo=$enableval],
217	[enable_updateinfo=yes])
218if test "x$enable_updateinfo" = "xyes" ; then
219	UPDATE_INFO_PLUGIN_DIR="stardict-update-info-plugin"
220else
221	UPDATE_INFO_PLUGIN_DIR=
222fi
223AC_SUBST(UPDATE_INFO_PLUGIN_DIR)
224
225AC_ARG_ENABLE([htmlparse],
226	AS_HELP_STRING([--disable-htmlparse],[Disable html parse plugin (default: enabled)]),
227	[enable_htmlparse=$enableval],
228	[enable_htmlparse=yes])
229if test "x$enable_htmlparse" = "xyes" ; then
230	HTML_PARSEDATA_PLUGIN_DIR="stardict-html-parsedata-plugin"
231else
232	HTML_PARSEDATA_PLUGIN_DIR=
233fi
234AC_SUBST(HTML_PARSEDATA_PLUGIN_DIR)
235
236AC_ARG_ENABLE([xdxfparse],
237	AS_HELP_STRING([--disable-xdxfparse],[Disable xdxf parse plugin (default: enabled)]),
238	[enable_xdxfparse=$enableval],
239	[enable_xdxfparse=yes])
240if test "x$enable_xdxfparse" = "xyes" ; then
241	XDXF_PARSEDATA_PLUGIN_DIR="stardict-xdxf-parsedata-plugin"
242else
243	XDXF_PARSEDATA_PLUGIN_DIR=
244fi
245AC_SUBST(XDXF_PARSEDATA_PLUGIN_DIR)
246
247AC_ARG_ENABLE([wordnet],
248	AS_HELP_STRING([--disable-wordnet],[Disable wordnet plugin (default: enabled)]),
249	[enable_wordnet=$enableval],
250	[enable_wordnet=yes])
251if test "x$enable_wordnet" = "xyes" ; then
252	WORDNET_PLUGIN_DIR="stardict-wordnet-plugin"
253else
254	WORDNET_PLUGIN_DIR=
255fi
256AC_SUBST(WORDNET_PLUGIN_DIR)
257
258AC_ARG_ENABLE([powerwordparse],
259	AS_HELP_STRING([--disable-powerwordparse],[Disable powerword parse plugin (default: enabled)]),
260	[enable_powerwordparse=$enableval],
261	[enable_powerwordparse=yes])
262if test "x$enable_powerwordparse" = "xyes" ; then
263	POWERWORD_PARSEDATA_PLUGIN_DIR="stardict-powerword-parsedata-plugin"
264else
265	POWERWORD_PARSEDATA_PLUGIN_DIR=
266fi
267AC_SUBST(POWERWORD_PARSEDATA_PLUGIN_DIR)
268
269AC_ARG_ENABLE([wikiparse],
270	AS_HELP_STRING([--disable-wikiparse],[Disable wiki parse plugin (default: enabled)]),
271	[enable_wikiparse=$enableval],
272	[enable_wikiparse=yes])
273if test "x$enable_wikiparse" = "xyes" ; then
274	WIKI_PARSEDATA_PLUGIN_DIR="stardict-wiki-parsedata-plugin"
275else
276	WIKI_PARSEDATA_PLUGIN_DIR=
277fi
278AC_SUBST(WIKI_PARSEDATA_PLUGIN_DIR)
279
280dnl ================================================================
281dnl main program checks.
282dnl ================================================================
283
284AC_ARG_ENABLE(gnome-support, AC_HELP_STRING([--disable-gnome-support], [Disable gnome support]))
285AC_ARG_ENABLE(gpe-support, AC_HELP_STRING([--enable-gpe-support], [Enable gpe support]))
286AC_ARG_ENABLE(maemo-support, AC_HELP_STRING([--enable-maemo-support], [Enable maemo support]))
287AC_ARG_ENABLE(darwin-support, AC_HELP_STRING([--enable-darwin-support], [Enable darwin support]))
288AM_CONDITIONAL(GNOME_SUPPORT, test "x${enable_gpe_support}" != "xyes" && test "x${enable_maemo_support}" != "xyes" && test "x${enable_darwin_support}" != "xyes" && test "x${enable_gnome_support}" != "xno")
289AM_CONDITIONAL(GPE_SUPPORT, test "x${enable_gpe_support}" = "xyes")
290AM_CONDITIONAL(MAEMO_SUPPORT, test "x${enable_maemo_support}" = "xyes")
291AM_CONDITIONAL(DARWIN_SUPPORT, test "x${enable_darwin_support}" = "xyes")
292
293if test "x${enable_gpe_support}" = "xyes" ; then
294  DEP_MODULES="gtk+-2.0 glib-2.0 >= 2.32 gmodule-2.0 gthread-2.0 libgpewidget >= 0.109"
295elif test "x${enable_maemo_support}" = "xyes" ; then
296  DEP_MODULES="gtk+-2.0 glib-2.0 >= 2.32 gmodule-2.0 gthread-2.0 gconf-2.0 >= 2.6 hildon-libs >= 0.12"
297elif test "x${enable_darwin_support}" = "xyes" ; then
298  DEP_MODULES="gtk+-2.0 glib-2.0 >= 2.32 gmodule-2.0 gthread-2.0"
299elif test "x${enable_gnome_support}" = "xno" ; then
300  DEP_MODULES="gtk+-2.0 glib-2.0 >= 2.32 gmodule-2.0 gthread-2.0"
301else
302  DEP_MODULES="gtk+-2.0 glib-2.0 >= 2.32 gmodule-2.0 gthread-2.0 libgnome-2.0 libbonobo-2.0 gconf-2.0"
303fi
304
305dnl
306dnl Start of pkg-config checks
307dnl
308PKG_CHECK_MODULES(STARDICT, $DEP_MODULES)
309
310if test "x${enable_gpe_support}" = "xyes" ; then
311        echo "Enable gpe suppport";
312	AC_DEFINE([CONFIG_GPE],[], [Compile with gpe support])
313	AM_CONDITIONAL(GCONF_SCHEMAS_INSTALL, test "x${enable_gpe_support}" != "xyes")
314elif test "x${enable_maemo_support}" = "xyes" ; then
315        echo "Enable maemo suppport";
316	AC_DEFINE([CONFIG_MAEMO],[], [Compile with maemo support])
317	AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
318	if test x"$GCONFTOOL" = xno; then
319        	AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
320	fi
321	AM_GCONF_SOURCE_2
322elif test "x${enable_darwin_support}" = "xyes" ; then
323        echo "Enable darwin suppport";
324	AC_DEFINE([CONFIG_DARWIN],[], [Compile with darwin support])
325	AM_CONDITIONAL(GCONF_SCHEMAS_INSTALL, test "x${enable_darwin_support}" != "xyes")
326elif test "x${enable_gnome_support}" = "xno" ; then
327	echo "Disable gnome support";
328	AC_DEFINE([CONFIG_GTK],[], [Compile without gnome support])
329	AM_CONDITIONAL(GCONF_SCHEMAS_INSTALL, test "x${enable_gnome_support}" != "xno")
330else
331	echo "Enable gnome suppport";
332	AC_DEFINE([CONFIG_GNOME],[], [Compile with gnome support])
333
334dnl *********************************************
335dnl for anything which calls gconftool-2 correctly
336dnl *********************************************
337
338	AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
339	if test x"$GCONFTOOL" = xno; then
340        	AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
341	fi
342	AM_GCONF_SOURCE_2
343
344dnl ==========================================================================
345dnl stuff for the CORBA interface
346
347	ORBIT_IDL="`$PKG_CONFIG --variable=orbit_idl ORBit-2.0`"
348	AC_SUBST(ORBIT_IDL)
349
350	LIBBONOBO_IDL="`$PKG_CONFIG --variable=idldir libbonobo-2.0`"
351	AC_SUBST(LIBBONOBO_IDL)
352
353	BONOBO_ACTIVATION_IDL="`$PKG_CONFIG --variable=idldir bonobo-activation-2.0`"
354	AC_SUBST(BONOBO_ACTIVATION_IDL)
355fi
356
357
358AC_ARG_ENABLE([deprecations],
359	AS_HELP_STRING([--disable-deprecations],[Disable deprecated gtk functions (default: enabled)]),
360	[enable_deprecations=$enableval],
361	[enable_deprecations=yes])
362
363if test "x$enable_deprecations" = "xno" ; then
364	STARDICT_CFLAGS="$STARDICT_CFLAGS -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGNOME_DISABLE_DEPRECATED"
365	STARDICT_CFLAGS="$STARDICT_CFLAGS -DG_DISABLE_SINGLE_INCLUDES -DATK_DISABLE_SINGLE_INCLUDES -DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_SINGLE_INCLUDES"
366fi
367
368STARDICT_CFLAGS="-Wall $STARDICT_CFLAGS"
369
370
371dnl
372dnl Start of zlib checks
373dnl
374AC_CHECK_LIB(z,zlibVersion,STARDICT_LIBS="$STARDICT_LIBS -lz",[AC_MSG_ERROR([zlib not found, or gcc-c++ not installed])])
375# For the first AC_CHECK_LIB, if failed, it may because of compiler didn't installed. So add this warning for the first AC_CHECK_LIB macro.
376
377
378dnl ================================================================
379dnl libsigc++20 checks.
380dnl ================================================================
381
382PKG_CHECK_MODULES(SIGCPP, "sigc++-2.0", [use_system_sigcpp=yes], [use_system_sigcpp=no])
383AM_CONDITIONAL(USE_SYSTEM_SIGCPP, test "x${use_system_sigcpp}" = "xyes")
384if test "x${use_system_sigcpp}" = "xyes" ; then
385echo "Use system libsigc++20";
386STARDICT_CFLAGS="$SIGCPP_CFLAGS $STARDICT_CFLAGS"
387STARDICT_LIBS="$SIGCPP_LIBS $STARDICT_LIBS"
388else
389echo "Use local libsigc++20";
390SIGC_CXX_GCC_TEMPLATE_SPECIALIZATION_OPERATOR_OVERLOAD()
391SIGC_CXX_MSVC_TEMPLATE_SPECIALIZATION_OPERATOR_OVERLOAD()
392SIGC_CXX_SELF_REFERENCE_IN_MEMBER_INITIALIZATION()
393SIGC_CXX_HAS_NAMESPACE_STD()
394SIGC_CXX_HAS_SUN_REVERSE_ITERATOR()
395
396if test "X$config_error" = "Xyes" ; then
397  AC_ERROR(
398[One or more of the required compiler features is missing.
399If you believe this is in error, please consult the config.log file
400for further details.
401])
402fi
403
404fi
405
406dnl ================================================================
407dnl scrollkeeper checks.
408dnl It is used in help subdir
409dnl ================================================================
410if test "x$enable_scrollkeeper" = "xyes" ; then
411	AC_CHECK_PROG([SCROLLKEEPER], [scrollkeeper-config], [yes])
412	if test x"$SCROLLKEEPER" != xyes; then
413		AC_MSG_ERROR([scrollkeeper-config executable is not found in your path - should be installed with scrollkeeper])
414	fi
415fi
416
417dnl ==========================================================================
418
419if test "x${enable_darwin_support}" != "xyes" ; then
420# Checks for header files. need by Solaris.
421AC_PATH_XTRA
422if test -n "$X_CFLAGS"; then
423CPPFLAGS="$CPPFLAGS $X_CFLAGS"
424fi
425if test -n "$X_LIBS"; then
426LDFLAGS="$LDFLAGS $X_LIBS"
427fi
428if test -n "$X_PRE_LIBS"; then
429LDFLAGS="$LDFLAGS $X_PRE_LIBS"
430fi
431if test -n "$X_EXTRA_LIBS"; then
432LDFLAGS="$LDFLAGS $X_EXTRA_LIBS"
433fi
434
435# Checks for libraries.
436AC_CHECK_LIB([X11], [main], , [AC_MSG_ERROR([X11 lib not found])])
437fi
438
439AC_SUBST(STARDICT_LIBS)
440AC_SUBST(STARDICT_CFLAGS)
441
442
443dnl common lib
444dnl path relative to $(top_srcdir)
445COMMONLIB_INCLUDE_DIR=../lib/src
446AC_SUBST(COMMONLIB_INCLUDE_DIR)
447dnl path relative to $(top_builddir)
448COMMONLIB_LIBRARY=../lib/src/libcommon.la
449AC_SUBST(COMMONLIB_LIBRARY)
450
451dnl ==========================================================================
452
453AC_CONFIG_FILES([
454Makefile
455stardict.spec
456stardict-withoutgnome.spec
457data/Makefile
458doc/Makefile
459debian-upstream/Makefile
460mac_dist/Makefile
461mac_dist/zh_CN.lproj/Makefile
462msvc_2008/Makefile
463po/Makefile.in
464m4/Makefile
465src/Makefile
466src/sigc++/Makefile
467src/sigc++config/Makefile
468src/lib/Makefile
469src/pixmaps/Makefile
470src/sounds/Makefile
471src/dic/Makefile
472src/dic/stardict-dict/Makefile
473src/dic/stardict-dict/res/Makefile
474src/skins/Makefile
475src/treedict/Makefile
476src/win32/Makefile
477src/win32/acrobat/Makefile
478src/win32/acrobat/sources/Makefile
479src/win32/acrobat/win32/Makefile
480src/win32/nsis/Makefile
481src/win32/PortableApps.com/Makefile
482stardict-plugins/Makefile
483stardict-plugins/stardict-advertisement-plugin/Makefile
484stardict-plugins/stardict-advertisement-plugin/data/Makefile
485stardict-plugins/stardict-man-plugin/Makefile
486stardict-plugins/stardict-qqwry-plugin/Makefile
487stardict-plugins/stardict-dictdotcn-plugin/Makefile
488stardict-plugins/stardict-update-info-plugin/Makefile
489stardict-plugins/stardict-spell-plugin/Makefile
490stardict-plugins/stardict-gucharmap-plugin/Makefile
491stardict-plugins/stardict-festival-tts-plugin/Makefile
492stardict-plugins/stardict-espeak-tts-plugin/Makefile
493stardict-plugins/stardict-wiki-parsedata-plugin/Makefile
494stardict-plugins/stardict-powerword-parsedata-plugin/Makefile
495stardict-plugins/stardict-xdxf-parsedata-plugin/Makefile
496stardict-plugins/stardict-wordnet-plugin/Makefile
497stardict-plugins/stardict-html-parsedata-plugin/Makefile
498stardict-plugins/stardict-sapi-tts-plugin/Makefile
499tests/Makefile
500pixmaps/Makefile
501help/Makefile
502])
503AC_OUTPUT
504