2018-08-14 Julian Sikorski <belegdol@fedoraproject.org>
[gnome-chemistry-utils.git] / gchemutils / configure.ac
blob5e8c8e743ed6b3c26ba1e3ad14852c0a62449c6e
1 AC_PREREQ(2.64)
3 AC_INIT([gnome-chemistry-utils], [0.15.2], [http://savannah.nongnu.org/bugs/?group=gchemutils],[gnome-chemistry-utils],[http://gchemutils.nongnu.org/])
4 AC_CONFIG_SRCDIR([libs/gcugtk/gcuperiodic.c])
5 AM_INIT_AUTOMAKE([1.11.1 tar-ustar no-dist-gzip dist-bzip2 dist-xz])
6 AM_MAINTAINER_MODE([enable])
7 AC_CANONICAL_HOST
8 AC_CONFIG_MACRO_DIR([m4])
9 GCU_VERSION=$VERSION
11 AM_SILENT_RULES([yes])
13 AC_CONFIG_HEADERS([config.h])
15 AC_SUBST([CFLAGS])
16 AC_SUBST([CXXFLAGS])
17 AC_SUBST([CPPFLAGS])
18 AC_SUBST([LDFLAGS])
20 AC_ISC_POSIX
21 AC_PROG_CXX
22 AC_HEADER_STDC
24 LT_PREREQ([2.2.6])
25 LT_INIT([disable-static])
27 AC_PROG_LN_S
28 AM_PROG_CC_C_O
29 IT_PROG_INTLTOOL([0.40.6])
30 GNOME_DOC_INIT
32 GNOME_COMPILE_WARNINGS([maximum])
33 GNOME_CXX_WARNINGS([yes])
34 GNOME_MAINTAINER_MODE_DEFINES
36 AC_ARG_VAR(GLIB_GENMARSHAL, [The glib-genmarshal executable.])
37 AC_CHECK_PROG(GLIB_GENMARSHAL, glib-genmarshal, glib-genmarshal)
39 GCU_VERSION_INFO=`echo $GCU_VERSION | awk -F . '{ print $1+$2":"$3":"$2 }'`
40 AC_SUBST([GCU_VERSION_INFO])
42 GCU_MAJOR_VERSION=`echo $GCU_VERSION | awk -F . '{ print $1}'`
43 GCU_MINOR_VERSION=`echo $GCU_VERSION | awk -F . '{ print $2}'`
44 GCU_MICRO_VERSION=`echo $GCU_VERSION | awk -F . '{ print $3}'`
45 GCU_API_MINOR_VERSION=$(((GCU_MINOR_VERSION+1)/2*2))
47 GCU_API_VER="$GCU_MAJOR_VERSION.$GCU_API_MINOR_VERSION"
48 AC_SUBST([GCU_API_VER])
49 AC_DEFINE_UNQUOTED([API_VERSION], ["$GCU_API_VER"], [API version])
51 if test "$GCU_API_MINOR_VERSION" = "$GCU_MINOR_VERSION" -o $GCU_MICRO_VERSION -ge 90; then
52         gcu_is_stable="yes"
53         STABILITY_POSTFIX=""
54         STABILITY=""
55 else
56         gcu_is_stable="no"
57         STABILITY_POSTFIX=" ($GCU_API_VER unstable)"
58         STABILITY="-unstable"
60 AC_SUBST([STABILITY])
61 AC_SUBST([STABILITY_POSTFIX])
62 AM_CONDITIONAL([GCU_IS_STABLE], [test "x$gcu_is_stable" = "xyes"])
64 AM_GLIB_GNU_GETTEXT
65 GETTEXT_PACKAGE="gchemutils-$GCU_API_VER"
66 AC_SUBST([GETTEXT_PACKAGE])
67 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"], [Package name for internationalization])
69 AC_ARG_ENABLE(
70         [update-databases],
71         AS_HELP_STRING(
72                 [--enable-update-databases],
73                 [
74                  enable (or disable) the running of the update-desktop-database and update-mime-database
75                  utilities (mostly useful for package maintainers) @<:@default=yes@:>@
76                 ]
77         ),
78         [
79          if test "x$enableval" != "xno"; then
80                 AC_PATH_PROG([UPDATE_DESKTOP_DATABASE], [update-desktop-database], [no])
81                 AC_PATH_PROG([UPDATE_MIME_DATABASE], [update-mime-database], [no])
82          else
83                 UPDATE_DESKTOP_DATABASE=no
84                 UPDATE_MIME_DATABASE=no
85          fi
86         ],
87         [
88          AC_PATH_PROG([UPDATE_DESKTOP_DATABASE], [update-desktop-database], [no])
89          AC_PATH_PROG([UPDATE_MIME_DATABASE], [update-mime-database], [no])
90         ]
93 AM_CONDITIONAL([WITH_UPDATE_DESKTOP], [test "x$UPDATE_DESKTOP_DATABASE" != "xno"])
94 AM_CONDITIONAL([WITH_UPDATE_MIME], [test "x$UPDATE_MIME_DATABASE" != "xno"])
96 dnl install desktop files for kde if needed
97 AC_ARG_WITH(
98         [kde-mime-dir],
99         AS_HELP_STRING(
100                 [--with-kde-mime-dir],
101                 [
102                  path to KDE's directory containing MIME .desktop files
103                  (automatically detected via kde-config) @<:@default=auto or ${datadir}/mimelnk@:>@
104                 ]
105         ),
106         [KDEMIMEDIR=$withval],
107         [
108          AC_PATH_PROG([KDECONFIG], [kde-config], [no])
109          if test "x$KDECONFIG" != "xno"; then
110                 KDEMIMEDIR="`$KDECONFIG --install mime`"
111          else
112                 KDEMIMEDIR="${datadir}/mimelnk"
113          fi     
114         ]
116 AC_MSG_CHECKING([for KDE MIME files (.desktop) installation location])
117 AC_MSG_RESULT([$KDEMIMEDIR])
118 AM_CONDITIONAL([WITH_KDE_MIME], [test "x$KDEMIMEDIR" != "xno"])
119 AC_SUBST([KDEMIMEDIR])
121 AC_PATH_PROG([DOXYGEN], [doxygen], [no])
122 AM_CONDITIONAL([DOXYGEN_AVAILABLE], [test "x$DOXYGEN" != "xno"])
124 lasem=
125 for ver in 0.6 0.4 ; do
126   if test "x$lasem" = x; then
127     if pkg-config --exists lasem-$ver; then
128       lasem=lasem-$ver
129     fi
130   fi
131 done
132 if test "x$lasem" = x; then
133   # Not important.  Things will fail below.
134   lasem=lasem-0.4
137 libgoffice=
138 dnl Only 0.10.0, or later will work
139 for ver in 0.10 ; do
140   if test "x$libgoffice" = x; then
141     if pkg-config --exists libgoffice-$ver; then
142       libgoffice=libgoffice-$ver
143     fi
144   fi
145 done
146 if test "x$libgoffice" = x; then
147   # Not important.  Things will fail below.
148   libgoffice=libgoffice-0.10
151 PKG_CHECK_MODULES(shared_mime_info, [shared-mime-info >= 0.12])
152 PKG_CHECK_MODULES(cairo, [cairo >= 1.6.0])
153 PKG_CHECK_MODULES(glib, [glib-2.0 >= 2.36.0])
154 PKG_CHECK_MODULES(gio, [gio-2.0 >= 2.36.0])
155 PKG_CHECK_MODULES(gdk_pixbuf, [gdk-pixbuf-2.0 >= 2.22.0])
156 PKG_CHECK_MODULES(gtk, [gtk+-3.0 >= 3.4.0])
157 PKG_CHECK_MODULES(xml, [libxml-2.0 >= 2.4.16])
158 PKG_CHECK_MODULES(lasem, $lasem >= 0.4.1,)
159 PKG_CHECK_MODULES(gsf, [libgsf-1 >= 1.14.9])
160 PKG_CHECK_MODULES(goffice, [$libgoffice >= 0.10.12])
161 PKG_CHECK_MODULES(chemical_mime_data, [chemical-mime-data >= 0.1.94])
162 PKG_CHECK_MODULES(bodr, [bodr >= 5])
163 PKG_CHECK_MODULES(openbabel, [openbabel-2.0 >= 2.3.0])
164 PKG_CHECK_MODULES(x11, [x11 >= 1.0.0])
166 dnl Not sure we need to test for glu.h and glx.h
167 AC_CHECK_HEADER(GL/glu.h,,[AC_MSG_ERROR([Error, GL/glu.h not found.])])
168 AC_CHECK_HEADER(GL/glx.h,,[AC_MSG_ERROR([Error, GL/glx.h not found.])])
170 dnl check if OpenGL rendering to memory should be direct
171 AC_ARG_ENABLE(
172         [opengl-direct-rendering],
173         AS_HELP_STRING(
174                 [--enable-opengl-direct-rendering],
175                 [ask if OpenGL rendering to memory (when exporting an image or for printing) should be direct @<:@default=yes@:>@]
176         ),
177         []
179 if test "x$enableval" = "xyes"; then
180 DIRECT_RENDERING="true"
181 else
182 DIRECT_RENDERING="false"
184 AC_SUBST([DIRECT_RENDERING])
186 dnl check for lsm_itex_to_mathml
187 saved_LIBS=$LIBS
188 LIBS="$LIBS $lasem_LIBS"
189 AC_CHECK_FUNCS(lsm_itex_to_mathml)
190 LIBS=$saved_LIBS
192 dnl GSettings related stuff
193 GLIB_GSETTINGS
195 dnl retrieve BODR data directory
196 bodr_pkgdatadir=`pkg-config --variable=pkgdatadir bodr`
197 AC_DEFINE_UNQUOTED([BODR_PKGDATADIR], ["$bodr_pkgdatadir"], [Path to Blue Obelisk Data Repository])
199 if test "x$gcu_is_stable" = "xyes"; then
200         GCU_CFLAGS="-Wall -Wextra -Werror=format-security"
201 else
202         GCU_CFLAGS="-DG_DISABLE_DEPRECATED -Wall -Wextra -Werror=format-security"
204 AC_SUBST([GCU_CFLAGS])
206 dnl --without is not handled
207 GOFFICE_PLUGINS_DIR=`pkg-config --variable=PluginDir $libgoffice`
208 AC_ARG_WITH(
209         [goffice-plugins-dir],
210         AS_HELP_STRING(
211                 [--with-goffice-plugins-dir],
212                 [path to GOffice plugins directory [default=auto]]
213         ),
214         [
215          if test "x$withval" != "xyes" -a "x$withval" != "xno" ; then
216                 GOFFICE_PLUGINS_DIR=$withval
217          fi
218         ]
221 dnl test some functions if needed
223 AC_SUBST([GOFFICE_PLUGINS_DIR])
225 ##################################################
226 # Check for xulrunner plugin
227 ##################################################
228 xulclient=
229 for pack in npapi-sdk xulrunner seamonkey iceape firefox mozilla; do
230   if test "x$xulclient" = x; then
231     if pkg-config --exists $pack-plugin; then
232       xulclient=$pack-plugin
233     fi
234   fi
235 done
236 if test "x$xulclient" = x; then
237   # Not important.  Things will fail below.
238   xulclient=mozilla-plugin
240 MOZILLA_CFLAGS=
241 build_mozilla_plugin=no
243 test_mozilla_plugin=true
244 AC_ARG_ENABLE(
245         [mozilla-plugin],
246         AS_HELP_STRING(
247                 [--enable-mozilla-plugin],
248                 [build a Mozilla/Firefox chemistry files viewing plugin @<:@default=auto@:>@]
249         ),
250         [test_mozilla_plugin="$enableval"]
253 if test "x$test_mozilla_plugin" != "xno"; then
254         if test -z "$MOZILLA_CONFIG"; then
255                 AC_PATH_PROG([MOZILLA_CONFIG], [mozilla-config], [no])
256         fi
257         
258         if test "x$MOZILLA_CONFIG" != "xno"; then
259                 MOZILLA_CFLAGS=`mozilla-config --cflags`
260                 mozlibdir=`mozilla-config --libs | sed 's/-L//'`
261         else
262                 PKG_CHECK_MODULES(
263                         [MOZILLA],
264                         [$xulclient],
265                         [build_mozilla_plugin=yes],
266                         [AC_MSG_WARN([mozilla-config not found. Mozilla/Netscape plugin will not be built])]
267                 )
268                 mozlibdir=`pkg-config --variable=libdir $xulclient`
269         fi
270         
271         if test "x$MOZILLA_CFLAGS" != "x"; then
272                 build_mozilla_plugin=yes
274                 dnl test for npfunctions.h
275                 saved_CPPFLAGS=$CPPFLAGS
276                 CPPFLAGS=$MOZILLA_CFLAGS
277                 AC_CHECK_HEADERS([npfunctions.h])
278                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <npfunctions.h>], [char const *NP_GetMIMEDescription (void);])],
279                                         [ac_moz_mime_const_char=yes], [ac_moz_mime_const_char=no])
280                 CPPFLAGS=$saved_CPPFLAGS
281         fi
284 AC_ARG_WITH(
285         [mozilla-libdir],
286         AS_HELP_STRING(
287                 [--with-mozilla-libdir],
288                 [path to mozilla/firefox/... libdir @<:@default=auto@:>@]
289         ),
290         [mozlibdir=$withval]
293 if test -z "$mozlibdir"; then
294                 build_mozilla_plugin=no
295                 AS_WARN([Mozilla plugins directory has not been set, the plugin will not be built])
297 AM_CONDITIONAL([WITH_MOZILLA], [test "x$build_mozilla_plugin" = "xyes"])
298 AC_SUBST([MOZILLA_CFLAGS])
299 AC_SUBST([mozlibdir])
300 if test "x$ac_moz_mime_const_char" = "xyes"; then
301         AC_DEFINE_UNQUOTED([MOZILLA_USES_CONST_CHAR], [1], [Whether NP_GetMIMEDescription returns const char*])
305 ##################################################
306 # Check for gnumeric
307 ##################################################
309 libspreadsheet=
310 for ver in 1.12 ; do
311   if test "x$libspreadsheet" = x; then
312     if pkg-config --exists libspreadsheet-$ver; then
313       libspreadsheet=libspreadsheet-$ver
314     fi
315   fi
316 done
317 if test "x$libspreadsheet" = x; then
318   # Not important.  Things will fail below.
319   libspreadsheet=libspreadsheet-1.12
322 PKG_CHECK_MODULES(gnumeric, [$libspreadsheet >= 1.12.42], [build_gnumeric_plugin=yes],
323                 [build_gnumeric_plugin=no])
324 dnl --without is not handled
326 if test "x$build_gnumeric_plugin" = "xyes"; then
327 GNUMERIC_PLUGINS_DIR=`pkg-config --variable=PluginDir $libspreadsheet`
328 gnm_version=`pkg-config --modversion $libspreadsheet`
329 AC_ARG_WITH(
330         [gnumeric-plugins-dir],
331         AS_HELP_STRING(
332                 [--with-gnumeric-plugins-dir],
333                 [path to Gnumeric plugins directory [default=auto]]
334         ),
335         [
336          if test "x$withval" != "xyes" -a "x$withval" != "xno" ; then
337                 GNUMERIC_PLUGINS_DIR=$withval
338          fi
339         ]
342                 
343 AM_CONDITIONAL([WITH_GNUMERIC], [test "x$build_gnumeric_plugin" = "xyes"])
344 AC_SUBST([GNUMERIC_PLUGINS_DIR])
345 AC_SUBST([gnm_version])
348 ##################################################
349 # Check for various functions
350 ##################################################
351 SAVE_LIBS=$LIBS
352 LIBS="-lm $LIBS"
353 AC_CHECK_FUNCS(exp10)
354 LIBS=$SAVE_LIBS
356 ##################################################
357 # Check for manpage target applications
358 ##################################################
360 GCU_PROG_XMLLINT
361 GCU_PROG_XSLTPROC
362 GCU_PROG_MAN
364 AC_ARG_VAR(GDK_PIXBUF_CSOURCE, [The gdk-pixbuf-csource executable.])
365 AC_CHECK_PROG(GDK_PIXBUF_CSOURCE, gdk-pixbuf-csource, gdk-pixbuf-csource)
367 ##################################################
368 # Path checks
369 ##################################################
371 case $srcdir in
372         /*)
373                 TESTSSRCDIR="$srcdir/tests"
374         ;;
375         *)
376                 TESTSSRCDIR=`pwd`"/$srcdir/tests"
377         ;;
378 esac
380 AC_SUBST([TESTSSRCDIR])
382 AC_CONFIG_FILES([
383 Makefile
384 database/Makefile
385 docs/Makefile
386 docs/help/Makefile
387 docs/help/3d/Makefile
388 docs/help/calc/Makefile
389 docs/help/crystal/Makefile
390 docs/help/paint/Makefile
391 docs/help/spectra/Makefile
392 docs/help/table/Makefile
393 docs/man/gcu_entities.dtd
394 docs/man/Makefile
395 docs/reference/Makefile
396 docs/reference/Doxyfile
397 dtds/Makefile
398 libs/Makefile
399 libs/gccv/Makefile
400 libs/gcp/Makefile
401 libs/gcr/Makefile
402 libs/gcu/Makefile
403 libs/gcugtk/Makefile
404 plugins/Makefile
405 plugins/loaders/Makefile
406 plugins/loaders/cdx/Makefile
407 plugins/loaders/cdxml/Makefile
408 plugins/loaders/cif/Makefile
409 plugins/loaders/cml/Makefile
410 plugins/loaders/ctfiles/Makefile
411 plugins/loaders/nuts/Makefile
412 plugins/paint/Makefile
413 plugins/paint/arrows/Makefile
414 plugins/paint/arrows/org.gnome.gchemutils.paint.plugins.arrows.gschema.xml.in
415 plugins/paint/atoms/Makefile
416 plugins/paint/bonds/Makefile
417 plugins/paint/cycles/Makefile
418 plugins/paint/residues/Makefile
419 plugins/paint/selection/Makefile
420 plugins/paint/templates/Makefile
421 plugins/paint/text/Makefile
422 mozilla-plugin/Makefile
423 gnumeric/Makefile
424 gnumeric/plugin.xml.in
425 goffice/Makefile
426 openbabel/Makefile
427 pixmaps/Makefile
428 po/Makefile.in
429 samples/Makefile
430 schemas/Makefile
431 schemas/org.gnome.gchemutils.gschema.xml.in
432 schemas/org.gnome.gchemutils.crystal.gschema.xml.in
433 schemas/org.gnome.gchemutils.paint.gschema.xml.in
434 programs/Makefile
435 programs/3d/Makefile
436 programs/3d/gchem3d.desktop.in
437 programs/calc/Makefile
438 programs/calc/gchemcalc.desktop.in
439 programs/crystal/Makefile
440 programs/crystal/gcrystal.desktop.in
441 programs/paint/Makefile
442 programs/paint/gchempaint.desktop.in
443 programs/spectra/Makefile
444 programs/spectra/gspectrum.desktop.in
445 programs/table/Makefile
446 programs/table/gchemtable.desktop.in
447 templates/Makefile
448 templates/paint/Makefile
449 themes/Makefile
450 themes/paint/Makefile
451 tests/Makefile
452 ui/Makefile
453 ui/calc/Makefile
454 ui/crystal/Makefile
455 ui/libgcu/Makefile
456 ui/paint/Makefile
457 ui/table/Makefile
459 AC_OUTPUT