1dnl Document  $Id: configure.ac,v 1.22 2007/02/04 03:12:29 dleidert Exp $
2dnl Summary   Configure script for the chemical-mime-data project.
3dnl
4dnl Copyright (C) 2004-2007 Daniel Leidert <daniel.leidert@wgdd.de>.
5dnl Copyright (C) 2004-2006 Egon Willighagen <e.willighagen@science.ru.nl>.
6dnl All rights reserved.
7dnl
8dnl This file is free software. The copyright owner gives unlimited
9dnl permission to copy, distribute and modify it.
10
11dnl --------------------------------------------------------------------------
12dnl initialization
13dnl --------------------------------------------------------------------------
14
15AC_INIT([chemical-mime-data],[0.1.94],[http://sourceforge.net/projects/chemical-mime/])
16AM_INIT_AUTOMAKE([-Wall])
17AC_REVISION($Revision: 1.22 $)
18AC_CONFIG_SRCDIR(src/chemical-mime-database.xml.in)
19
20dnl --------------------------------------------------------------------------
21dnl intltool/gettext
22dnl --------------------------------------------------------------------------
23
24ALL_LINGUAS="de fr"
25GETTEXT_PACKAGE=AC_PACKAGE_NAME
26AC_SUBST([GETTEXT_PACKAGE])
27AM_PO_SUBDIRS
28IT_PROG_INTLTOOL
29ITPROG_VERSION=`intltoolize --version | awk '{print $4}'`
30ITPROG_VERSION_MILES=`echo $ITPROG_VERSION | cut -f1 -d.`
31ITPROG_VERSION_MAJOR=`echo $ITPROG_VERSION | cut -f2 -d.`
32ITPROG_VERSION_MINOR=`echo $ITPROG_VERSION | cut -f3 -d.`
33test -n "$ITPROG_VERSION_MILES" || ITPROG_VERSION_MILES=0
34test -n "$ITPROG_VERSION_MAJOR" || ITPROG_VERSION_MAJOR=0
35test -n "$ITPROG_VERSION_MINOR" || ITPROG_VERSION_MINOR=0
36ITPROG_VERSION_ALL=`expr $ITPROG_VERSION_MILES '*' 1000000 + $ITPROG_VERSION_MAJOR '*' 1000 + $ITPROG_VERSION_MINOR`
37AC_MSG_CHECKING([for intltool >= 0.35.0])
38if test "$ITPROG_VERSION_ALL" -lt 35000; then
39	AC_MSG_RESULT([no])
40	USE_NLS=no
41	AC_SUBST([USE_NLS])
42	CATOBJEXT=.gmo
43	AC_SUBST([CATOBJEXT])
44else
45	AC_MSG_RESULT([yes])
46fi
47
48dnl --------------------------------------------------------------------------
49dnl necessary applications
50dnl --------------------------------------------------------------------------
51
52AC_PROG_INSTALL
53PKG_PROG_PKG_CONFIG
54MP_PROG_XMLLINT
55MP_PROG_XSLTPROC
56
57dnl --------------------------------------------------------------------------
58dnl configure options
59dnl --------------------------------------------------------------------------
60
61dnl Choose to run update-mime-database
62AC_ARG_ENABLE(
63	[update-database],
64	AC_HELP_STRING(
65		[--enable-update-database],
66		[
67		 enable (or disable) the running of the update-mime-database utility after installation
68		 @<:@default=yes@:>@
69		]
70	),
71	[enable_update_database=$enableval],
72	[enable_update_database=yes]
73)
74
75dnl Choose to run rsvg or convert if both are installed
76AC_ARG_ENABLE(
77	[convert],
78	AC_HELP_STRING(
79		[--enable-convert],
80		[
81		 enable or disable the usage of convert (imagemagick) if both rsvg and convert are available
82		 @<:@default=no@:>@
83		]
84	),
85	[enable_convert=$enableval],
86	[enable_convert=no]
87)
88
89dnl --------------------------------------------------------------------------
90dnl rsvg or convert (imagemagick)
91dnl --------------------------------------------------------------------------
92
93AC_ARG_VAR(
94	[CONVERT],
95	[The 'convert' binary with path. Use it to define or override the location of 'convert'.]
96)
97AC_PATH_PROG([CONVERT], [convert], [no])
98AC_SUBST([CONVERT])
99
100if test "x$enable_convert" != "xyes" -a "x$CONVERT" = "xno" ; then
101	AC_ARG_VAR(
102		[RSVG],
103		[The 'rsvg' binary with path. Use it to define or override the location of 'rsvg'.]
104	)
105	AC_PATH_PROG([RSVG], [rsvg], [no])
106	AC_SUBST([RSVG])
107fi
108
109if test "x$RSVG" = "xno" -a "x$CONVERT" = "xno" ; then
110	AC_MSG_ERROR([Cannot find rsvg (librsvg binary) or convert (imagemagick). Please install one of them.])
111fi
112
113dnl --------------------------------------------------------------------------
114dnl install locations
115dnl --------------------------------------------------------------------------
116
117AC_ARG_WITH(
118	[freedesktop-mime],
119	AC_HELP_STRING(
120		[--with-freedesktop-mime@<:@=PATH@:>@],
121		[
122		 enable, disable or override the installation directory of the freedesktop.org shared MIME info support files
123		 @<:@default=$datadir/mime@:>@
124		]
125	),
126	[
127	 if test "x$withval" = "xyes" ; then
128		 with_freedesktop_mime=${datadir}/mime
129	 fi
130	],
131	[with_freedesktop_mime=${datadir}/mime]
132)
133AC_SUBST([with_freedesktop_mime])
134
135AC_ARG_WITH(
136	[gnome-mime],
137	AC_HELP_STRING(
138		[--with-gnome-mime@<:@=PATH@:>@],
139		[
140		 enable, disable or override the installation directory of the old GNOME 2.4 MIME support files
141		 @<:@default=$datadir/mime-info@:>@
142		]
143	),
144	[
145	 if test "x$withval" = "xyes" ; then
146		 with_gnome_mime=${datadir}/mime-info
147	 fi
148	],
149	[with_gnome_mime=${datadir}/mime-info]
150)
151AC_SUBST([with_gnome_mime])
152
153AC_ARG_WITH(
154	[pixmaps],
155	AC_HELP_STRING(
156		[--with-pixmaps@<:@=PATH@:>@],
157		[
158		 enable, disable or override the default installation directory of non-themed icons
159		 @<:@default=$datadir/pixmaps@:>@
160		]
161	),
162	[
163	 if test "x$withval" = "xyes" ; then
164		 with_pixmaps=${datadir}/pixmaps
165	 fi
166	],
167	[with_pixmaps=${datadir}/pixmaps]
168)
169AC_SUBST([with_pixmaps])
170
171AC_ARG_WITH(
172	[hicolor-theme],
173	AC_HELP_STRING(
174		[--with-hicolor-theme@<:@=PATH@:>@],
175		[
176		 enable, disable or override the theme-directory, where icons should be
177		 installed by default (following the standards, this is the hicolor theme)
178		 @<:@default=$datadir/icons/hicolor@:>@
179		]
180	),
181	[
182	 if test "x$withval" = "xyes" ; then
183		 with_hicolor_theme=${datadir}/icons/hicolor
184	 fi
185	],
186	[with_hicolor_theme=${datadir}/icons/hicolor]
187)
188AC_SUBST([with_hicolor_theme])
189
190AC_PATH_PROG([KDE_CONFIG], [kde-config], [no])
191
192AC_ARG_WITH(
193	[kde-mime],
194	AC_HELP_STRING(
195		[--with-kde-mime@<:@=PATH@:>@],
196		[
197		 enable, disable or override the installation directory of the KDE 3.x MIME support files
198		 @<:@default=$datadir/mimelnk@:>@
199		]
200	),
201	[
202	 if test "x$withval" = "xyes" ; then
203		 if test "x$KDE_CONFIG" != "xno" ; then
204			 with_kde_mime=`$KDE_CONFIG --install mime`
205		 else
206			 with_kde_mime=${datadir}/mimelnk
207		 fi
208	 fi
209	],
210	[
211	 if test "x$KDE_CONFIG" != "xno" ; then
212		 with_kde_mime=`$KDE_CONFIG --install mime`
213	 else
214		 with_kde_mime=${datadir}/mimelnk
215	 fi
216	]
217)
218AC_SUBST([with_kde_mime])
219
220dnl --------------------------------------------------------------------------
221dnl necessary checks
222dnl --------------------------------------------------------------------------
223
224dnl necessary checks and additions for freedesktop.org shared-mime-info
225if test "x$with_freedesktop_mime" != "xno" ; then
226	AC_MSG_CHECKING([for shared-mime-info >= 0.12])
227	m4_ifdef(
228		[PKG_CHECK_EXISTS],
229		[PKG_CHECK_EXISTS(
230			[shared-mime-info >= 0.12],
231			[
232			 AC_MSG_RESULT([yes])
233			 CHEMICAL_MIME_DEPS="$CHEMICAL_MIME_DEPS shared-mime-info"
234			],
235			[
236			 AC_MSG_RESULT([no])
237			 AC_MSG_ERROR([shared-mime-info package missing.])
238			]
239		 )
240		],
241		[
242		 if ( $PKG_CONFIG shared-mime-info --atleast-version=0.12 ); then
243			AC_MSG_RESULT([yes])
244			CHEMICAL_MIME_DEPS="$CHEMICAL_MIME_DEPS shared-mime-info"
245		 else
246			AC_MSG_RESULT([no])
247			AC_MSG_ERROR([shared-mime-info package missing.])
248		 fi
249		]
250	)
251	AC_ARG_VAR(
252		[UPDATE_MIME_DATABASE],
253		[
254		 The update-mime-database binary with path.
255		 Use it to define or override the location of update-mime-database.
256		]
257	)
258	AC_PATH_PROG([UPDATE_MIME_DATABASE], [update-mime-database], [no])
259	AC_SUBST([UPDATE_MIME_DATABASE])
260fi
261
262dnl necessary checks and additions for old gnome 2.4 mime support
263if test "x$with_gnome_mime" != "xno" ; then
264	AC_MSG_CHECKING([for gnome-mime-data])
265	m4_ifdef(
266		[PKG_CHECK_EXISTS],
267		[PKG_CHECK_EXISTS(
268			[gnome-mime-data-2.0],
269			[
270			 AC_MSG_RESULT([yes])
271			 CHEMICAL_MIME_DEPS="$CHEMICAL_MIME_DEPS gnome-mime-data-2.0"
272			],
273			[
274			 AC_MSG_RESULT([no])
275			 AC_MSG_ERROR([gnome-mime-data package missing.])
276			]
277		 )
278		],
279		[
280		 if ( $PKG_CONFIG gnome-mime-data-2.0 --exists ); then
281			AC_MSG_RESULT([yes])
282			CHEMICAL_MIME_DEPS="$CHEMICAL_MIME_DEPS gnome-mime-data-2.0"
283		 else
284			AC_MSG_RESULT([no])
285			AC_MSG_ERROR([gnome-mime-data package missing.])
286		 fi
287		]
288	)
289fi
290AC_SUBST([CHEMICAL_MIME_DEPS])
291
292dnl --------------------------------------------------------------------------
293dnl conditions
294dnl --------------------------------------------------------------------------
295
296AM_CONDITIONAL([BOOL_FREEDESKTOP_MIME], [test "x$with_freedesktop_mime" != "xno"])
297AC_MSG_CHECKING([if freedesktop.org shared MIME-info database file will be installed])
298if test "x$with_freedesktop_mime" != "xno" ; then
299	AC_MSG_RESULT([yes])
300	AC_MSG_CHECKING([for installation path of the freedesktop.org shared MIME-info database files])
301	AC_MSG_RESULT([$with_freedesktop_mime])
302else
303	AC_MSG_RESULT([no])
304fi
305
306AM_CONDITIONAL([BOOL_UPDATE_DATABASE], [test "x$enable_update_database" = "xyes" -a "x$UPDATE_MIME_DATABASE" != "xno" -a "x$with_freedesktop_mime" != "xno"])
307AC_MSG_CHECKING([if update-mime-database will run])
308if test "x$enable_update_database" = "xyes" \
309     -a "x$UPDATE_MIME_DATABASE" != "xno" \
310     -a "x$with_freedesktop_mime" != "xno" ; then
311	AC_MSG_RESULT([yes])
312else
313	AC_MSG_RESULT([no])
314fi
315
316AM_CONDITIONAL([BOOL_GNOME_MIME], [test "x$with_gnome_mime" != "xno"])
317AC_MSG_CHECKING([if old GNOME 2.4 MIME support files will be installed])
318if test "x$with_gnome_mime" != "xno" ; then
319	AC_MSG_RESULT([yes])
320	AC_MSG_CHECKING([for installation path of the GNOME 2.4 support files])
321	AC_MSG_RESULT([$with_gnome_mime])
322else
323	AC_MSG_RESULT([no])
324fi
325
326AM_CONDITIONAL([BOOL_KDE_MIME], [test "x$with_kde_mime" != "xno"])
327AC_MSG_CHECKING([if KDE 3.x support files will be installed])
328if test "x$with_kde_mime" != "xno" ; then
329	AC_MSG_RESULT([yes])
330	AC_MSG_CHECKING([for installation path of the KDE 3.x support files])
331	AC_MSG_RESULT([$with_kde_mime])
332else
333	AC_MSG_RESULT([no])
334fi
335
336AM_CONDITIONAL([BOOL_HICOLOR_THEME], [test "x$with_hicolor_theme" != "xno"])
337AC_MSG_CHECKING([if theme icons will be installed])
338if test "x$with_hicolor_theme" != "xno" ; then
339	AC_MSG_RESULT([yes])
340	AC_MSG_CHECKING([for installation path of theme icons])
341	AC_MSG_RESULT([$with_hicolor_theme])
342else
343	AC_MSG_RESULT([no])
344fi
345
346AM_CONDITIONAL([BOOL_PIXMAPS], [test "x$with_pixmaps" != "xno"])
347AC_MSG_CHECKING([if non-themed icons will be installed])
348if test "x$with_pixmaps" != "xno" ; then
349	AC_MSG_RESULT([yes])
350	AC_MSG_CHECKING([for installation path of non-theme icons])
351	AC_MSG_RESULT([$with_pixmaps])
352else
353	AC_MSG_RESULT([no])
354fi
355
356dnl --------------------------------------------------------------------------
357dnl location determination
358dnl --------------------------------------------------------------------------
359
360if test "x$datarootdir" = "x" ; then
361	AC_SUBST(
362		[datarootdir],
363		[${datadir}]
364	)
365fi
366
367if test "x$docdir" = "x" ; then
368	AC_SUBST(
369		[docdir],
370		[m4_ifset(
371			[AC_PACKAGE_TARNAME],
372			[${datadir}'/doc/${PACKAGE_TARNAME}'],
373			[${datadir}'/doc/${PACKAGE}']
374		 )
375		]
376	)
377fi
378
379if test "x$htmldir" = "x" ; then
380	AC_SUBST(
381		[htmldir],
382		['${docdir}']
383	)
384fi
385
386dnl --------------------------------------------------------------------------
387dnl output
388dnl --------------------------------------------------------------------------
389
390AC_CONFIG_FILES([
391	chemical-mime-data.pc
392	Makefile
393	freedesktop.org/Makefile
394	gnome/Makefile
395	html_docs/Makefile
396	icons/Makefile
397	icons/hicolor/Makefile
398	icons/pixmaps/Makefile
399	kde/Makefile
400	po/Makefile.in
401	src/Makefile
402	xsl/Makefile
403	xsl/cmd_entities.dtd
404])
405AC_OUTPUT
406