1AC_PREREQ(2.64) 2 3AC_INIT([gnome-chemistry-utils], [0.14.16], [http://savannah.nongnu.org/bugs/?group=gchemutils],[gnome-chemistry-utils],[http://gchemutils.nongnu.org/]) 4AC_CONFIG_SRCDIR([libs/gcugtk/gcuperiodic.c]) 5AM_INIT_AUTOMAKE([1.11.1 tar-ustar no-dist-gzip dist-bzip2 dist-xz]) 6AM_MAINTAINER_MODE([enable]) 7AC_CANONICAL_HOST 8AC_CONFIG_MACRO_DIR([m4]) 9GCU_VERSION=$VERSION 10 11AM_SILENT_RULES([yes]) 12 13AC_CONFIG_HEADERS([config.h]) 14 15AC_SUBST([CFLAGS]) 16AC_SUBST([CXXFLAGS]) 17AC_SUBST([CPPFLAGS]) 18AC_SUBST([LDFLAGS]) 19 20AC_ISC_POSIX 21AC_PROG_CXX 22AC_HEADER_STDC 23 24LT_PREREQ([2.2.6]) 25LT_INIT([disable-static]) 26 27AC_PROG_LN_S 28AM_PROG_CC_C_O 29IT_PROG_INTLTOOL([0.40.6]) 30GNOME_DOC_INIT 31 32GNOME_COMPILE_WARNINGS([maximum]) 33GNOME_CXX_WARNINGS([yes]) 34GNOME_MAINTAINER_MODE_DEFINES 35 36AC_ARG_VAR(GLIB_GENMARSHAL, [The glib-genmarshal executable.]) 37AC_CHECK_PROG(GLIB_GENMARSHAL, glib-genmarshal, glib-genmarshal) 38 39GCU_VERSION_INFO=`echo $GCU_VERSION | awk -F . '{ print $1+$2":"$3":"$2 }'` 40AC_SUBST([GCU_VERSION_INFO]) 41 42GCU_MAJOR_VERSION=`echo $GCU_VERSION | awk -F . '{ print $1}'` 43GCU_MINOR_VERSION=`echo $GCU_VERSION | awk -F . '{ print $2}'` 44GCU_MICRO_VERSION=`echo $GCU_VERSION | awk -F . '{ print $3}'` 45GCU_API_MINOR_VERSION=$(((GCU_MINOR_VERSION+1)/2*2)) 46 47GCU_API_VER="$GCU_MAJOR_VERSION.$GCU_API_MINOR_VERSION" 48AC_SUBST([GCU_API_VER]) 49AC_DEFINE_UNQUOTED([API_VERSION], ["$GCU_API_VER"], [API version]) 50 51if 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="" 55else 56 gcu_is_stable="no" 57 STABILITY_POSTFIX=" ($GCU_API_VER unstable)" 58 STABILITY="-unstable" 59fi 60AC_SUBST([STABILITY]) 61AC_SUBST([STABILITY_POSTFIX]) 62AM_CONDITIONAL([GCU_IS_STABLE], [test "x$gcu_is_stable" = "xyes"]) 63 64AM_GLIB_GNU_GETTEXT 65GETTEXT_PACKAGE="gchemutils-$GCU_API_VER" 66AC_SUBST([GETTEXT_PACKAGE]) 67AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"], [Package name for internationalization]) 68 69AC_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 ] 91) 92 93AM_CONDITIONAL([WITH_UPDATE_DESKTOP], [test "x$UPDATE_DESKTOP_DATABASE" != "xno"]) 94AM_CONDITIONAL([WITH_UPDATE_MIME], [test "x$UPDATE_MIME_DATABASE" != "xno"]) 95 96dnl install desktop files for kde if needed 97AC_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 ] 115) 116AC_MSG_CHECKING([for KDE MIME files (.desktop) installation location]) 117AC_MSG_RESULT([$KDEMIMEDIR]) 118AM_CONDITIONAL([WITH_KDE_MIME], [test "x$KDEMIMEDIR" != "xno"]) 119AC_SUBST([KDEMIMEDIR]) 120 121AC_PATH_PROG([DOXYGEN], [doxygen], [no]) 122AM_CONDITIONAL([DOXYGEN_AVAILABLE], [test "x$DOXYGEN" != "xno"]) 123dnl *********************** 124dnl Should we use lasem ? 125dnl *********************** 126 127gcu_with_lasem=false 128lasem= 129for ver in 0.6 0.4 ; do 130 if test "x$lasem" = x; then 131 if pkg-config --exists lasem-$ver; then 132 lasem=lasem-$ver 133 fi 134 fi 135done 136if test "x$lasem" = x; then 137 # Not important. Things will fail below. 138 lasem=lasem-0.4 139fi 140AC_ARG_WITH(lasem, 141 AS_HELP_STRING([--with-lasem[=@<:@no/auto/yes@:>@]], 142 [Build with lasem use (default=auto)]), 143 ,[with_lasem=auto]) 144 145AS_CASE([$with_lasem], 146 [no],[found_lasem="disabled by request"], 147 [auto], [ 148 PKG_CHECK_MODULES(lasem, $lasem >= 0.4.1, 149 [found_lasem="yes";gcu_with_lasem=true], [found_lasem="no, missing or too old lasem library"]) 150 ], 151 [yes],[found_lasem="yes"; 152 PKG_CHECK_MODULES(lasem, $lasem >= 0.4.1); 153 gcu_with_lasem=true 154 ],[AC_MSG_ERROR([invalid argument passed to --with-lasem, should be one of @<:@no/auto/yes@:>@])]) 155if test "x$gcu_with_lasem" = "xtrue" ; then 156 AC_DEFINE(GCU_WITH_LASEM, 1, [Define if Lasem is used]) 157 EXTRA_DEPS="$EXTRA_DEPS $lasem" 158dnl check for lsm_itex_to_mathml 159 saved_CFLAGS=$CFLAGS 160 saved_LIBS=$LIBS 161 CFLAGS="$CFLAGS $lasem_CFLAGS" 162 LIBS="$LIBS $lasem_LIBS" 163 AC_CHECK_FUNCS(lsm_itex_to_mathml) 164 CFLAGS=$saved_CFLAGS 165 LIBS=$saved_LIBS 166fi 167 168AM_CONDITIONAL([GCU_WITH_LASEM], [test "x$gcu_with_lasem" = "xtrue"]) 169 170 171libgoffice= 172dnl Only 0.10.0, or later will work 173for ver in 0.10 ; do 174 if test "x$libgoffice" = x; then 175 if pkg-config --exists libgoffice-$ver; then 176 libgoffice=libgoffice-$ver 177 fi 178 fi 179done 180if test "x$libgoffice" = x; then 181 # Not important. Things will fail below. 182 libgoffice=libgoffice-0.10 183fi 184 185PKG_CHECK_MODULES(shared_mime_info, [shared-mime-info >= 0.12]) 186PKG_CHECK_MODULES(cairo, [cairo >= 1.6.0]) 187PKG_CHECK_MODULES(glib, [glib-2.0 >= 2.36.0]) 188PKG_CHECK_MODULES(gio, [gio-2.0 >= 2.26.0]) 189PKG_CHECK_MODULES(gdk_pixbuf, [gdk-pixbuf-2.0 >= 2.22.0]) 190PKG_CHECK_MODULES(gtk, [gtk+-3.0 >= 3.0.0]) 191PKG_CHECK_MODULES(xml, [libxml-2.0 >= 2.4.16]) 192PKG_CHECK_MODULES(gsf, [libgsf-1 >= 1.14.9]) 193PKG_CHECK_MODULES(goffice, [$libgoffice >= 0.10.12]) 194PKG_CHECK_MODULES(chemical_mime_data, [chemical-mime-data >= 0.1.94]) 195PKG_CHECK_MODULES(bodr, [bodr >= 5]) 196PKG_CHECK_MODULES(openbabel, [openbabel-2.0 >= 2.3.0]) 197PKG_CHECK_MODULES(x11, [x11 >= 1.0.0]) 198 199dnl Not sure we need to test for glu.h and glx.h 200AC_CHECK_HEADER(GL/glu.h,,[AC_MSG_ERROR([Error, GL/glu.h not found.])]) 201AC_CHECK_HEADER(GL/glx.h,,[AC_MSG_ERROR([Error, GL/glx.h not found.])]) 202 203dnl check if OpenGL rendering to memory should be direct 204AC_ARG_ENABLE( 205 [opengl-direct-rendering], 206 AS_HELP_STRING( 207 [--enable-opengl-direct-rendering], 208 [ask if OpenGL rendering to memory (when exporting an image or for printing) should be direct @<:@default=yes@:>@] 209 ), 210 [] 211) 212if test "x$enableval" = "xyes"; then 213DIRECT_RENDERING="true" 214else 215DIRECT_RENDERING="false" 216fi 217AC_SUBST([DIRECT_RENDERING]) 218 219dnl check for lsm_itex_to_mathml 220saved_LIBS=$LIBS 221LIBS="$LIBS $lasem_LIBS" 222AC_CHECK_FUNCS(lsm_itex_to_mathml) 223LIBS=$saved_LIBS 224 225dnl GSettings related stuff 226GLIB_GSETTINGS 227 228dnl retrieve BODR data directory 229bodr_pkgdatadir=`pkg-config --variable=pkgdatadir bodr` 230AC_DEFINE_UNQUOTED([BODR_PKGDATADIR], ["$bodr_pkgdatadir"], [Path to Blue Obelisk Data Repository]) 231 232if test "x$gcu_is_stable" = "xyes"; then 233 GCU_CFLAGS="-Wall -Wextra -Werror=format-security" 234else 235 GCU_CFLAGS="-DG_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGSEAL_ENABLE -Wall -Wextra -Werror=format-security" 236fi 237AC_SUBST([GCU_CFLAGS]) 238 239dnl --without is not handled 240GOFFICE_PLUGINS_DIR=`pkg-config --variable=PluginDir $libgoffice` 241AC_ARG_WITH( 242 [goffice-plugins-dir], 243 AS_HELP_STRING( 244 [--with-goffice-plugins-dir], 245 [path to GOffice plugins directory [default=auto]] 246 ), 247 [ 248 if test "x$withval" != "xyes" -a "x$withval" != "xno" ; then 249 GOFFICE_PLUGINS_DIR=$withval 250 fi 251 ] 252) 253 254dnl test some functions if needed 255 256AC_SUBST([GOFFICE_PLUGINS_DIR]) 257 258################################################## 259# Check for xulrunner plugin 260################################################## 261xulclient= 262for pack in npapi-sdk xulrunner seamonkey iceape firefox mozilla; do 263 if test "x$xulclient" = x; then 264 if pkg-config --exists $pack-plugin; then 265 xulclient=$pack-plugin 266 fi 267 fi 268done 269if test "x$xulclient" = x; then 270 # Not important. Things will fail below. 271 xulclient=mozilla-plugin 272fi 273MOZILLA_CFLAGS= 274build_mozilla_plugin=no 275 276test_mozilla_plugin=true 277AC_ARG_ENABLE( 278 [mozilla-plugin], 279 AS_HELP_STRING( 280 [--enable-mozilla-plugin], 281 [build a Mozilla/Firefox chemistry files viewing plugin @<:@default=auto@:>@] 282 ), 283 [test_mozilla_plugin="$enableval"] 284) 285 286if test "x$test_mozilla_plugin" != "xno"; then 287 if test -z "$MOZILLA_CONFIG"; then 288 AC_PATH_PROG([MOZILLA_CONFIG], [mozilla-config], [no]) 289 fi 290 291 if test "x$MOZILLA_CONFIG" != "xno"; then 292 MOZILLA_CFLAGS=`mozilla-config --cflags` 293 mozlibdir=`mozilla-config --libs | sed 's/-L//'` 294 else 295 PKG_CHECK_MODULES( 296 [MOZILLA], 297 [$xulclient], 298 [build_mozilla_plugin=yes], 299 [AC_MSG_WARN([mozilla-config not found. Mozilla/Netscape plugin will not be built])] 300 ) 301 mozlibdir=`pkg-config --variable=libdir $xulclient` 302 fi 303 304 if test "x$MOZILLA_CFLAGS" != "x"; then 305 build_mozilla_plugin=yes 306 307 dnl test for npfunctions.h 308 saved_CPPFLAGS=$CPPFLAGS 309 CPPFLAGS=$MOZILLA_CFLAGS 310 AC_CHECK_HEADERS([npfunctions.h]) 311 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <npfunctions.h>], [char const *NP_GetMIMEDescription (void);])], 312 [ac_moz_mime_const_char=yes], [ac_moz_mime_const_char=no]) 313 CPPFLAGS=$saved_CPPFLAGS 314 fi 315fi 316 317AC_ARG_WITH( 318 [mozilla-libdir], 319 AS_HELP_STRING( 320 [--with-mozilla-libdir], 321 [path to mozilla/firefox/... libdir @<:@default=auto@:>@] 322 ), 323 [mozlibdir=$withval] 324) 325 326if test -z "$mozlibdir"; then 327 build_mozilla_plugin=no 328 AS_WARN([Mozilla plugins directory has not been set, the plugin will not be built]) 329fi 330AM_CONDITIONAL([WITH_MOZILLA], [test "x$build_mozilla_plugin" = "xyes"]) 331AC_SUBST([MOZILLA_CFLAGS]) 332AC_SUBST([mozlibdir]) 333if test "x$ac_moz_mime_const_char" = "xyes"; then 334 AC_DEFINE_UNQUOTED([MOZILLA_USES_CONST_CHAR], [1], [Whether NP_GetMIMEDescription returns const char*]) 335fi 336 337 338################################################## 339# Check for gnumeric 340################################################## 341 342libspreadsheet= 343for ver in 1.12 ; do 344 if test "x$libspreadsheet" = x; then 345 if pkg-config --exists libspreadsheet-$ver; then 346 libspreadsheet=libspreadsheet-$ver 347 fi 348 fi 349done 350if test "x$libspreadsheet" = x; then 351 # Not important. Things will fail below. 352 libspreadsheet=libspreadsheet-1.12 353fi 354 355PKG_CHECK_MODULES(gnumeric, [$libspreadsheet >= 1.11.6], [build_gnumeric_plugin=yes], 356 [build_gnumeric_plugin=no]) 357dnl --without is not handled 358 359if test "x$build_gnumeric_plugin" = "xyes"; then 360GNUMERIC_PLUGINS_DIR=`pkg-config --variable=PluginDir $libspreadsheet` 361gnm_version=`pkg-config --modversion $libspreadsheet` 362AC_ARG_WITH( 363 [gnumeric-plugins-dir], 364 AS_HELP_STRING( 365 [--with-gnumeric-plugins-dir], 366 [path to Gnumeric plugins directory [default=auto]] 367 ), 368 [ 369 if test "x$withval" != "xyes" -a "x$withval" != "xno" ; then 370 GNUMERIC_PLUGINS_DIR=$withval 371 fi 372 ] 373) 374fi 375 376AM_CONDITIONAL([WITH_GNUMERIC], [test "x$build_gnumeric_plugin" = "xyes"]) 377AC_SUBST([GNUMERIC_PLUGINS_DIR]) 378AC_SUBST([gnm_version]) 379 380 381################################################## 382# Check for various functions 383################################################## 384SAVE_LIBS=$LIBS 385LIBS="-lm $LIBS" 386AC_CHECK_FUNCS(exp10) 387LIBS=$SAVE_LIBS 388 389################################################## 390# Check for manpage target applications 391################################################## 392 393GCU_PROG_XMLLINT 394GCU_PROG_XSLTPROC 395GCU_PROG_MAN 396 397AC_ARG_VAR(GDK_PIXBUF_CSOURCE, [The gdk-pixbuf-csource executable.]) 398AC_CHECK_PROG(GDK_PIXBUF_CSOURCE, gdk-pixbuf-csource, gdk-pixbuf-csource) 399 400################################################## 401# Path checks 402################################################## 403 404case $srcdir in 405 /*) 406 TESTSSRCDIR="$srcdir/tests" 407 ;; 408 *) 409 TESTSSRCDIR=`pwd`"/$srcdir/tests" 410 ;; 411esac 412 413AC_SUBST([TESTSSRCDIR]) 414 415AC_CONFIG_FILES([ 416Makefile 417database/Makefile 418docs/Makefile 419docs/help/Makefile 420docs/help/3d/Makefile 421docs/help/calc/Makefile 422docs/help/crystal/Makefile 423docs/help/paint/Makefile 424docs/help/spectra/Makefile 425docs/help/table/Makefile 426docs/man/gcu_entities.dtd 427docs/man/Makefile 428docs/reference/Makefile 429docs/reference/Doxyfile 430dtds/Makefile 431libs/Makefile 432libs/gccv/Makefile 433libs/gcp/Makefile 434libs/gcr/Makefile 435libs/gcu/Makefile 436libs/gcugtk/Makefile 437plugins/Makefile 438plugins/loaders/Makefile 439plugins/loaders/cdx/Makefile 440plugins/loaders/cdxml/Makefile 441plugins/loaders/cif/Makefile 442plugins/loaders/cml/Makefile 443plugins/loaders/nuts/Makefile 444plugins/paint/Makefile 445plugins/paint/arrows/Makefile 446plugins/paint/arrows/org.gnome.gchemutils.paint.plugins.arrows.gschema.xml.in 447plugins/paint/atoms/Makefile 448plugins/paint/bonds/Makefile 449plugins/paint/cycles/Makefile 450plugins/paint/residues/Makefile 451plugins/paint/selection/Makefile 452plugins/paint/templates/Makefile 453plugins/paint/text/Makefile 454mozilla-plugin/Makefile 455gnumeric/Makefile 456gnumeric/plugin.xml.in 457goffice/Makefile 458openbabel/Makefile 459pixmaps/Makefile 460po/Makefile.in 461samples/Makefile 462schemas/Makefile 463schemas/org.gnome.gchemutils.gschema.xml.in 464schemas/org.gnome.gchemutils.crystal.gschema.xml.in 465schemas/org.gnome.gchemutils.paint.gschema.xml.in 466programs/Makefile 467programs/3d/Makefile 468programs/3d/gchem3d.desktop.in 469programs/calc/Makefile 470programs/calc/gchemcalc.desktop.in 471programs/crystal/Makefile 472programs/crystal/gcrystal.desktop.in 473programs/paint/Makefile 474programs/paint/gchempaint.desktop.in 475programs/spectra/Makefile 476programs/spectra/gspectrum.desktop.in 477programs/table/Makefile 478programs/table/gchemtable.desktop.in 479templates/Makefile 480templates/paint/Makefile 481themes/Makefile 482themes/paint/Makefile 483tests/Makefile 484ui/Makefile 485ui/calc/Makefile 486ui/crystal/Makefile 487ui/libgcu/Makefile 488ui/paint/Makefile 489ui/table/Makefile 490]) 491AC_OUTPUT 492