configure.ac 37.2 KB
Newer Older
Jody Goldberg's avatar
Jody Goldberg committed
1
-*- mode: m4 -*-
Stepan Kasal's avatar
Stepan Kasal committed
2 3 4
dnl We require Automake 1.7.2, which requires Autoconf 2.54.
dnl (It needs _AC_AM_CONFIG_HEADER_HOOK, for example.)
AC_PREREQ(2.54)
5 6
AC_CONFIG_MACRO_DIR([m4])
AX_IS_RELEASE([git-directory])
7

8
m4_define([gnumeric_version_epoch], [1])
9
m4_define([gnumeric_version_major], [12])
Morten Welinder's avatar
Morten Welinder committed
10
m4_define([gnumeric_version_minor], [42])
11
m4_define([gnumeric_version_extra], [])
12
m4_define([gnumeric_version_full],
13
    [gnumeric_version_epoch.gnumeric_version_major.gnumeric_version_minor[]gnumeric_version_extra])
14

15 16 17 18
dnl Emphasize some of the checks.
m4_define([BIG_CHECKING], [AC_MSG_CHECKING([
======== $1])])

19
AC_INIT([gnumeric], [gnumeric_version_full],
Morten Welinder's avatar
Morten Welinder committed
20
	[https://gitlab.gnome.org/GNOME/gnumeric/issues],,
21
	[http://www.gnumeric.org/])
Arturo Espinosa's avatar
Arturo Espinosa committed
22

Jody Goldberg's avatar
Jody Goldberg committed
23
AC_CONFIG_SRCDIR(src/sheet.h)
Jody Goldberg's avatar
Jody Goldberg committed
24
AM_INIT_AUTOMAKE([dist-bzip2])
25

26 27 28 29 30 31 32 33 34 35 36
dnl Version info for libraries = CURRENT:REVISION:AGE
dnl
dnl Within each x.y.*, ABI is maintained backward and _forward_ compatible.
dnl (As a consequence, no exported function may be added.)
dnl So it's enough to have one interface number per each x.y.* branch.
dnl
dnl OTOH, we are not able to keep ABI strictly backward compatible throughout
dnl the whole x.*.*.
dnl The easiest way is to declare no ABI compatibility, ie. AGE is always 0.
dnl
m4_define([version_iface],
37
	m4_eval(100 * gnumeric_version_epoch + gnumeric_version_major))
38 39 40 41

AC_SUBST([VERSION_INFO], [version_iface:gnumeric_version_minor:0])
AC_SUBST([VERSION_IFACE], [version_iface])

42 43 44 45 46 47
if test `expr gnumeric_version_major % 2` -eq 1; then
    AC_MSG_NOTICE([NOTE: This is a development release])
    gnumeric_devel=yes
    gnumeric_api_ver=gnumeric_version_epoch.`expr gnumeric_version_major + 1`
    dnl An explicit version number should be used in place of the above
    dnl if the epoch is to change.
48
    dnl gnumeric_api_ver=2.0
49 50 51 52 53 54
else
    gnumeric_devel=no
    gnumeric_api_ver=gnumeric_version_epoch.gnumeric_version_major
fi
gnumeric_api_ver_=`echo $gnumeric_api_ver | sed -e 's/\./_/g'`

55 56
dnl Almost like epoch.major but development versions look forward to the next
dnl stable release.
57 58
AC_SUBST([GNUMERIC_API_VER], [$gnumeric_api_ver])
AC_SUBST([GNUMERIC_API_VER_], [$gnumeric_api_ver_])
59

60
dnl This one is created by autoheader, ...
Stepan Kasal's avatar
Stepan Kasal committed
61
AC_CONFIG_HEADERS(gnumeric-config.h)
Jody Goldberg's avatar
Jody Goldberg committed
62

63 64 65 66 67 68 69 70
dnl ... and this one is a small subset, maintained manually,
dnl which will be installed.
AC_CONFIG_HEADERS(gnumeric-features.h)
dnl
dnl Make sure these two won't clash.  Put the following to gnumeric-config.h:
AH_BOTTOM([/* Don't include gnumeric-features.h, it's a subset of gnumeric-config.h. */
#define GNUMERIC_FEATURES_H])

71
AM_MAINTAINER_MODE([enable])
Arturo Espinosa's avatar
Arturo Espinosa committed
72

73 74
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])

75
dnl AX_REQUIRE_DEFINED([GTK_DOC_CHECK])
76 77
GTK_DOC_CHECK

78
dnl We use a LINGUAS file, so we need intltool >= 0.35:
79
IT_PROG_INTLTOOL([0.35.0])
80
IT_PO_SUBDIR(po-functions)
81

Stepan Kasal's avatar
Stepan Kasal committed
82 83 84
dnl We use $host and $host_os:
AC_CANONICAL_HOST

Arturo Espinosa's avatar
Arturo Espinosa committed
85 86
AC_ISC_POSIX
AC_PROG_CC
87 88 89 90 91
AC_PROG_CC_C99
if test "$ac_cv_prog_cc_c99" = no; then
	AC_MSG_ERROR([*** c99 is required])
fi

Arturo Espinosa's avatar
Arturo Espinosa committed
92
AC_PROG_YACC
93 94 95 96
if test "x$ac_cv_prog_YACC" = x; then
	AC_MSG_ERROR([*** bison or equivalent is required])
fi

Jody Goldberg's avatar
Jody Goldberg committed
97
AC_PROG_LN_S
Stepan Kasal's avatar
Stepan Kasal committed
98
AC_HEADER_STDC
Arturo Espinosa's avatar
Arturo Espinosa committed
99

100 101 102 103
LT_PREREQ([2.2.6])
# Make --disable-static the default
LT_INIT([disable-static])

104 105
dnl Propagate Gnome-specific variable ACLOCAL_FLAGS to Makefile.
AC_SUBST(ACLOCAL_AMFLAGS, $ACLOCAL_FLAGS)
106

Jody Goldberg's avatar
Jody Goldberg committed
107 108
dnl *****************************
# Check for zlib.
109 110 111
dnl
dnl zlib is needed for the excel plugin; see plugins/excel/Makefile.am
dnl
Jody Goldberg's avatar
Jody Goldberg committed
112 113 114 115
_cppflags="${CPPFLAGS}"
_ldflags="${LDFLAGS}"

AC_ARG_WITH(zlib,
116
	AS_HELP_STRING([--with-zlib=DIR], [use libz in DIR]),
117 118
	[case $withval in
	 yes|no) ;;
Jody Goldberg's avatar
Jody Goldberg committed
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
	 *)	Z_DIR=$withval
		CPPFLAGS="${CPPFLAGS} -I$withval/include"
		LDFLAGS="${LDFLAGS} -L$withval/lib"
		;;
	 esac])

if test "x$with_zlib" != xno; then
	with_zlib=no
	AC_CHECK_HEADER(zlib.h, [AC_CHECK_LIB(z, gzread, [with_zlib=yes])])
fi

if test "$with_zlib" = no; then
	AC_MSG_ERROR([*** zlib is required])
fi

if test "x${Z_DIR}" != "x"; then
	Z_CPPFLAGS="-I${Z_DIR}/include"
	case ${host} in
	*-*-solaris*)	Z_LIBS="-L${Z_DIR}/lib -R${Z_DIR}/lib -lz" ;;
	*)		Z_LIBS="-L${Z_DIR}/lib -lz" ;;
	esac
else
	Z_LIBS="-lz"
fi
AC_SUBST(Z_CPPFLAGS)
AC_SUBST(Z_LIBS)

CPPFLAGS=${_cppflags}
LDFLAGS=${_ldflags}

149
dnl **********
Morten Welinder's avatar
Morten Welinder committed
150
dnl * Goffice
151 152
dnl **********
# Goffice releases are parallel installable, which do we depend on
Morten Welinder's avatar
Morten Welinder committed
153
GOFFICE_API_VER="0.10"
154 155
AC_SUBST(GOFFICE_API_VER)
# Components
156
GOFFICE_PLUGINS_DIR=`pkg-config --variable=PluginDir libgoffice-${GOFFICE_API_VER}`
157
AC_SUBST(GOFFICE_PLUGINS_DIR)
158 159 160
GOFFICE_VERSION=`pkg-config --modversion libgoffice-${GOFFICE_API_VER}`
AC_SUBST(GOFFICE_VERSION)

161

162
dnl PKG_PROG_PKG_CONFIG is expanded just before the first occurrence of
Stepan Kasal's avatar
Stepan Kasal committed
163
dnl PKG_CHECK_MODULES.  Since this is inside an `if,' it can escape
164
dnl execution.  Thus we need an explicit call:
165
PKG_PROG_PKG_CONFIG(0.18)
166

167
dnl *****************************
168
libspreadsheet_reqs="
169
	libgoffice-${GOFFICE_API_VER}	>= 0.10.42
170
	libgsf-1		>= 1.14.33
171 172 173
	libxml-2.0		>= 2.4.12
"
gnumeric_reqs="$libspreadsheet_reqs
174 175 176 177
	glib-2.0		>= 2.40.0
	gobject-2.0		>= 2.40.0
	gmodule-2.0		>= 2.40.0
	gthread-2.0		>= 2.40.0
178 179
	pango			>= 1.24.0
	pangocairo		>= 1.24.0
180
"
181
libspreadsheet_gtk_reqs="
182
	gtk+-3.0		>= 3.8.7
183
"
184

185
gnumeric_gtk_reqs="$libspreadsheet_gtk_reqs"
186

187 188
ui_msg=

189 190 191 192 193 194 195
with_win32=no
case $host_os in
mingw* | pw32* | cygwin*)
    with_win32=yes
    ;;
esac

196 197 198 199
dnl *******************
dnl Should we use gtk ?
dnl *******************
gnumeric_with_gtk=true
200
AC_ARG_WITH(gtk, AS_HELP_STRING([--without-gtk], [Build without UI]))
201 202 203
if test "x$with_gtk" = xno; then
	ui_msg="None (Gtk disabled by request)"
	gnumeric_with_gtk=false
204
	AC_MSG_ERROR([configuration without gtk+ currently does not work])
Stepan Kasal's avatar
Stepan Kasal committed
205 206 207 208
else
	dnl We shouldn't silently default to --without-gtk.
	dnl If the requirements are not met, fail.
	ui_msg="Gtk"
209
	PKG_CHECK_MODULES(GTK, [$libspreadsheet_gtk_reqs])
Stepan Kasal's avatar
Stepan Kasal committed
210
	PKG_CHECK_MODULES(GTK, [$gnumeric_gtk_reqs])
Morten Welinder's avatar
Morten Welinder committed
211
fi
212

213
if test "x$gnumeric_with_gtk" = xtrue ; then
214
	AC_DEFINE(GNM_WITH_GTK, 1, [Define if UI is built])
215
	libspreadsheet_reqs="$libspreadsheet_reqs $libspreadsheet_gtk_reqs"
216
	gnumeric_reqs="$gnumeric_reqs $gnumeric_gtk_reqs"
217
fi
218 219

AM_CONDITIONAL(WITH_GTK,   $gnumeric_with_gtk)
220

221 222 223 224 225
dnl ****************************
dnl now that we have selected out libraries the whole collection in one
dnl shot so that we can have a nice neat compile/link line
dnl ****************************

226 227 228 229
PKG_CHECK_MODULES(LIBSPREADSHEET, $libspreadsheet_reqs)
AC_SUBST(LIBSPREADSHEET_LIBS)
AC_SUBST(LIBSPREADSHEET_CFLAGS)

230
PKG_CHECK_MODULES(GNUMERIC, $gnumeric_reqs)
Jody Goldberg's avatar
Jody Goldberg committed
231 232 233
AC_SUBST(GNUMERIC_LIBS)
AC_SUBST(GNUMERIC_CFLAGS)

234 235 236
# We don't attempt to track gtk+4, so disable the very noise warnings
CFLAGS="$CFLAGS -DGDK_DISABLE_DEPRECATION_WARNINGS -DGTK_DISABLE_DEPRECATION_WARNINGS"

237 238 239 240
with_native_win32=no
case $host_os in
mingw* | pw32*)
    with_native_win32=yes
Stepan Kasal's avatar
Stepan Kasal committed
241
    AC_ARG_VAR(WINDRES, [The windres executable (used by win32 builds only).])
242 243 244
    AC_CHECK_TOOL(WINDRES, windres, :)
    ;;
esac
Stepan Kasal's avatar
Stepan Kasal committed
245
AM_CONDITIONAL(WITH_WIN32, test $with_win32 = yes)
246
AM_CONDITIONAL(WITH_NATIVE_WIN32, test $with_native_win32 = yes)
247
AM_CONDITIONAL(CROSS_COMPILING, test x"$cross_compiling" != xno)
248

249
if test "x$with_win32" = "xyes"; then
250
    GNUMERIC_PLUGIN_LDFLAGS="-avoid-version -no-undefined $GNUMERIC_LIBS -Wl,--enable-runtime-pseudo-reloc,--export-all-symbols \$(top_builddir)/src/libspreadsheet.la -s"
251 252 253
else
    GNUMERIC_PLUGIN_LDFLAGS="-avoid-version"
fi
254 255
AC_SUBST(GNUMERIC_PLUGIN_LDFLAGS)

256 257 258
dnl **************************************************
dnl This needs to be done before we add aggressive -Werror=foo flags
dnl below.
259
AC_SUBST(GETTEXT_PACKAGE, gnumeric-${VERSION})
260 261 262 263
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",
	[The package name, for gettext])
AM_GLIB_GNU_GETTEXT

264 265 266 267
dnl ****************************
dnl prep the pixmap generator
dnl ****************************

268
AC_ARG_VAR(GLIB_GENMARSHAL, [The glib-genmarshal executable.])
269
AC_CHECK_PROG(GLIB_GENMARSHAL, glib-genmarshal$ac_exeext, glib-genmarshal$ac_exeext)
270 271
GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable=glib_compile_resources gio-2.0`
AC_SUBST(GLIB_COMPILE_RESOURCES)
272 273

AC_ARG_VAR(GDK_PIXBUF_CSOURCE, [The gdk-pixbuf-csource executable.])
274
AC_CHECK_PROG(GDK_PIXBUF_CSOURCE, gdk-pixbuf-csource$ac_exeext, gdk-pixbuf-csource$ac_exeext)
275

276 277 278 279 280 281 282 283 284 285 286
AC_ARG_ENABLE(component,
  AS_HELP_STRING([--disable-component], [Do not build the goffice component]),
  [], [enable_component=yes])
component_dir=""
if test x"$enable_component" = xyes; then
	component_dir="component"
else
	component_dir=""
fi
AC_SUBST(COMPONENT_DIR, $component_dir)

287 288 289 290 291
dnl ****************************
dnl GDA Plugin
dnl ****************************
try_gda=true
gda_msg=yes
292
gnomedb_msg=no
293
AC_ARG_WITH(gda,
294
	AS_HELP_STRING([--with-gda], [Compile the Gnome Database Access plugin]),
295 296
	if test "x$withval" != xyes; then
		try_gda=false
297 298 299
		gda_msg="Disabled by request"
	fi
)
300
if test "$try_gda" = true; then
301
	PKG_CHECK_MODULES(GDA, [libgda-5.0 >= 5.0.0, libgda-ui-5.0 >= 5.0.0],
302
		[gda_msg=yes],
303
		[gda_msg="NO.  libgda problem"])
304
	if test "$gda_msg" = yes; then
Jody Goldberg's avatar
Jody Goldberg committed
305
		PKG_CHECK_MODULES(GNOMEDB, [libgnomedb-4.0 >= 3.99.6],
306 307
			[gnomedb_msg="yes"],
			[gnomedb_msg="NO. libgnomedb problem"])
308
		if test "$gnomedb_msg" = yes; then
309 310 311
			AC_DEFINE(HAVE_LIBGNOMEDB, 1, [ Define if libgnomedb support is compiled in])
		fi
	fi
312
fi
313
AM_CONDITIONAL(WITH_GDA, test x"$gda_msg" = xyes)
314 315 316
AC_SUBST(GDA_CFLAGS)
AC_SUBST(GDA_LIBS)

317
AM_CONDITIONAL(WITH_GNOMEDB, test x"$gnomedb_msg" = xyes)
318 319 320
AC_SUBST(GNOMEDB_CFLAGS)
AC_SUBST(GNOMEDB_LIBS)

321
dnl ****************************
Morten Welinder's avatar
Morten Welinder committed
322

323 324 325 326
AC_CHECK_DECL(fdopen, fdopen_works=yes, fdopen_works=no)

if test $fdopen_works = no ; then
	unset ac_cv_have_decl_fdopen
327
	CFLAGS="$CFLAGS -D_POSIX_SOURCE"
328 329 330 331 332 333
	AC_MSG_NOTICE([adding -D_POSIX_SOURCE to CFLAGS])
	AC_CHECK_DECL(fdopen, fdopen_works=yes, fdopen_works=no)
	if test $fdopen_works = no ; then
		AC_MSG_ERROR([fdopen is not available])
	fi
fi
334

335 336
# Unfortunately, -D_POSIX_SOURCE turns off struct timeval on Solaris
AC_MSG_CHECKING([whether struct timeval is available])
337 338 339 340
AC_COMPILE_IFELSE(
	[AC_LANG_PROGRAM([[#include <sys/time.h>]], [[struct timeval tv;]])],
	[struct_timeval_works=yes],
	[struct_timeval_works=no])
341 342 343 344 345
AC_MSG_RESULT($struct_timeval_works)

if test $struct_timeval_works = no ; then
	CFLAGS="$CFLAGS -D__EXTENSIONS__"
	AC_MSG_CHECKING([whether struct timeval is available with -D__EXTENSIONS__])
346 347 348 349
	AC_COMPILE_IFELSE(
		[AC_LANG_PROGRAM([[#include <sys/time.h>]], [[struct timeval tv;]])],
		[struct_timeval_works=yes],
		[struct_timeval_works=no])
350 351 352
	AC_MSG_RESULT($struct_timeval_works)
	if test $struct_timeval_works = no ; then
		AC_MSG_ERROR([struct timeval is not available])
353 354 355
	fi
fi

Andreas J. Guelzow's avatar
Andreas J. Guelzow committed
356
dnl src/functions/fn-math.c uses M_PI
357 358

AC_MSG_CHECKING([whether M_PI is available])
359 360 361 362
AC_COMPILE_IFELSE(
	[AC_LANG_PROGRAM([[#include <math.h>]], [[double f = M_PI]])],
	[works_without_bsd_source=yes],
	[works_without_bsd_source=no])
363 364 365
AC_MSG_RESULT($works_without_bsd_source)

if test $works_without_bsd_source = no ; then
Andreas J. Guelzow's avatar
Andreas J. Guelzow committed
366
	CFLAGS="$CFLAGS -D_BSD_SOURCE"
367
	AC_MSG_CHECKING([whether M_PI is available with -D_BSD_SOURCE])
368 369 370 371
	AC_COMPILE_IFELSE(
		[AC_LANG_PROGRAM([[#include <math.h>]], [[double f = M_PI]])],
		[m_pi_works=yes],
		[m_pi_works=no])
372 373 374 375
	AC_MSG_RESULT($m_pi_works)
	if test $m_pi_works = no ; then
		AC_MSG_ERROR([M_PI is not available])
	fi
Andreas J. Guelzow's avatar
Andreas J. Guelzow committed
376 377
fi

378

Arturo Espinosa's avatar
Arturo Espinosa committed
379 380
AC_SUBST(GUILE_LIBS)
AC_SUBST(GUILE_INCS)
381

382 383
dnl Comment out the guile block:
ifelse([
384
dnl check for guile 1.5
385
try_guile=false
386
guile_msg="disabled pending some guile developer interest"
387
enable_guile=false
388
AC_ARG_WITH(guile,
389
	AS_HELP_STRING([--with-guile], [Compile with Guile support or without it]),
390
	if test "x$withval" = xyes; then
391
		try_guile=true
392 393
	fi
)
394 395 396 397 398 399 400 401 402 403 404 405 406
if $try_guile; then
	AC_MSG_CHECKING(for guile >= 1.5)
	if test "`guile -c '(display (string>=? (version) "1.4.1"))'`" != "#t"; then
  		AC_MSG_RESULT([Your Guile is too old.  You need Guile 1.5 or later.])
	else
	        AC_MSG_RESULT(found)
		guile_msg="yes"
		enable_guile=true
	fi
fi
if $enable_guile; then
	GNOME_CHECK_GUILE
fi
407
AM_CONDITIONAL(WITH_GUILE, $enable_guile)
408
])
Arturo Espinosa's avatar
Arturo Espinosa committed
409

Jody Goldberg's avatar
Jody Goldberg committed
410 411 412
dnl **************************************************
dnl * psiconv support
dnl **************************************************
413

414
AC_ARG_WITH(psiconv,
415
	AS_HELP_STRING([--without-psiconv], [Compile without Psiconv support]))
416 417
AC_ARG_VAR(PSICONV_CONFIG, [The psiconv-config executable.])
if test "x$with_psiconv" != xno; then
Jon Kåre Hellan's avatar
Jon Kåre Hellan committed
418
    AC_CHECK_PROG(PSICONV_CONFIG,psiconv-config,psiconv-config)
419 420
    if test x"$PSICONV_CONFIG" = x; then
	psiconv_msg="missing dependencies"
421 422
    else
	AC_MSG_CHECKING(for psiconv >= 0.9.3)
423 424 425
	if $PSICONV_CONFIG --version | awk -F. \
		'{exit !($1 > 0 || $2 > 9 || ($2 == 9 && $3 >= 3))}'
	then
426 427 428 429 430 431 432 433
	    PSICONV_CFLAGS=`$PSICONV_CONFIG --cflags`
            PSICONV_LIBS=`$PSICONV_CONFIG --libs`
	    psiconv_msg=yes
        else
	    psiconv_msg=no
        fi
	AC_MSG_RESULT($psiconv_msg)
    fi
434 435
else
    psiconv_msg=no
436
fi
437
AM_CONDITIONAL(WITH_PSICONV, test "x$psiconv_msg" = xyes)
438 439
AC_SUBST(PSICONV_LIBS)
AC_SUBST(PSICONV_CFLAGS)
Jody Goldberg's avatar
Jody Goldberg committed
440

441 442 443
try_paradox=true
enable_paradox=false
AC_ARG_WITH(paradox,
444
	AS_HELP_STRING([--without-paradox], [Compile without Paradox support]),
445 446 447 448 449 450
	if test "x$withval" = xno; then
		try_paradox=false
	fi
)

if $try_paradox; then
451 452
	PKG_CHECK_MODULES(PARADOX,
		[pxlib >= 0.4.0],
453 454 455 456
		[paradox_msg="yes"],
		[paradox_msg="missing dependencies"])
fi

457
if test "x$paradox_msg" = xyes; then
458 459 460 461 462
	SAVE_LIBS="$LIBS"
	LIBS="$LIBS $PARADOX_LIBS"
	AC_CHECK_FUNC(PX_open_gsf,[ enable_paradox=true ],)
	LIBS="$SAVE_LIBS"
	unset SAVE_LIBS
463 464 465 466 467
fi
AM_CONDITIONAL(WITH_PARADOX, $enable_paradox)
AC_SUBST(PARADOX_LIBS)
AC_SUBST(PARADOX_CFLAGS)

468 469 470
plugin_list_given=false
PLUGIN_LIST=""
AC_ARG_ENABLE(plugins,
471
	AS_HELP_STRING([--enable-plugins="text html"], [Compile only the listed plugins]),
Stepan Kasal's avatar
Stepan Kasal committed
472 473 474
	[plugin_list_given=true
	 test "x$enableval" != xno && PLUGIN_LIST=$enableval
])
475 476 477
AM_CONDITIONAL(PLUGIN_LIST_GIVEN, $plugin_list_given)
AC_SUBST(PLUGIN_LIST)

478 479
POFILES_FULL=
for lang in $ALL_LINGUAS; do
Stepan Kasal's avatar
Stepan Kasal committed
480
    POFILES_FULL="$POFILES_FULL \$(top_srcdir)/po/$lang.po"
481 482
done
AC_SUBST(POFILES_FULL)
483 484

dnl
485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506
dnl Code to handle po-functions/Makefile* and po-functions/POTFILES*
dnl
dnl First, let me document how the po/ directory is dealt with.
dnl Dark mysteries here, so skip the next paragraph if you don't have enough
dnl holy water at your hand.  You have been warned.
dnl
dnl AM_GLIB_GNU_GETTEXT creates an incorrect incarnation of po/POTFILES, as
dnl glib-gettext.m4 doesn't know about intltool tags.  Later on, just before
dnl config.status is created, a code originating from intltool.m4 creates
dnl POTFILES again, this time correctly removing the intltool tags.
dnl config.status then creates po/Makefile, again in two steps.  First,
dnl po/Makefile.in is created from po/Makefile.in.in the usual way, and then
dnl a code registered via the obsolete macro AC_OUTPUT_COMMANDS insterts the
dnl contents of file POTFILES to po/Makefile.
dnl
dnl But both glib-gettext and intltool have the dirname "po/" hardwired, so
dnl we are on our own with po-functions.
dnl
dnl We use a more straightforward approach for po-functions:
dnl 1) We create POTFILES immediately here.
dnl 2) We let config.status to create Makefile.in.
dnl 3) We use AC_CONFIG_COMMANDS to create Makefile.
Morten Welinder's avatar
Morten Welinder committed
507
dnl
508 509 510 511 512 513 514
[# Create po-functions/POTFILES:
if test -d po-functions; then
	rm -f po-functions/POTFILES
else
	mkdir po-functions
fi
case "$srcdir" in
515 516 517 518
	.)  top_srcdir=.. ;;
	[\\/]* | ?:[\\/]* )  # Absolute name.
		top_srcdir="$srcdir" ;;
	*)  top_srcdir="../$srcdir" ;;
519 520
esac
sed <$srcdir/po-functions/POTFILES.in -e '/^#/d' -e 's/^[[].*[]] *//' \
521 522 523
	 -e '/^[   ]*$/d' -e "s,^,       $top_srcdir/," | \
        sed -e '$!s/$/ \\/' >po-functions/POTFILES
]
524
dnl Finally, register for creation of po-functions/Makefile:
525
dnl We do not currently do anything here.
526
AC_CONFIG_COMMANDS(po-functions/Makefile,
527
  [cp po-functions/Makefile.in po-functions/Makefile])
Jody Goldberg's avatar
Jody Goldberg committed
528

529 530
SAVE_LIBS="$LIBS"
LIBS="$LIBS $GNUMERIC_LIBS"
531
AC_CHECK_FUNCS(mkfifo)
532 533 534
LIBS="$SAVE_LIBS"
unset SAVE_LIBS

535 536
AC_HEADER_SYS_WAIT

Morten Welinder's avatar
Morten Welinder committed
537
dnl Check for some functions
538
AC_CHECK_FUNCS(uname setenv putenv)
539

540 541 542
dnl FIXME: Does this really belong here?
AC_CHECK_FUNC(bind_textdomain_codeset,,[AC_CHECK_LIB(intl,bind_textdomain_codeset)])

543 544
dnl check for complete locale implementation
AC_CHECK_HEADERS(langinfo.h)
Jon Kåre Hellan's avatar
Jon Kåre Hellan committed
545

546 547 548
dnl check for rlimit
AC_CHECK_HEADERS(sys/resource.h)

549 550 551
dnl we need to check fpu mode
AC_CHECK_HEADERS(fpu_control.h)

552 553 554 555
SAVE_CFLAGS=$CFLAGS
SAVE_LIBS=$LIBS
CFLAGS="$CFLAGS $GNUMERIC_CFLAGS"
LIBS="$GNUMERIC_LIBS $LIBS"
556

557
AC_CHECK_FUNCS(gtk_cell_renderer_text_get_background_set gtk_cell_renderer_text_get_foreground_set gtk_cell_renderer_text_get_editable)
558
AC_CHECK_FUNCS(gtk_entry_set_editing_cancelled gtk_icon_theme_add_resource_path)
559

560
AC_MSG_CHECKING([for OO_NS_LOCALC_EXT])
Morten Welinder's avatar
Morten Welinder committed
561
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gsf/gsf.h>]],
562 563 564 565 566
				[[(void)(OO_NS_LOCALC_EXT == OO_NS_LOCALC_EXT);]])],
               [AC_DEFINE(HAVE_OO_NS_LOCALC_EXT, 1, [Define if OO_NS_LOCALC_EXT is available])
		AC_MSG_RESULT(yes)],
	       [AC_MSG_RESULT(no)])

567 568 569
CFLAGS=$SAVE_CFLAGS
LIBS=$SAVE_LIBS

570
dnl We supply our own lgamma and lgamma_r when missing.
571
supply_lgamma_r=yes
572 573 574 575 576
AC_CHECK_FUNCS(lgamma_r)
if test $ac_cv_func_lgamma_r = no; then
  AC_CHECK_LIB(m, lgamma_r,
        [AC_DEFINE(HAVE_LGAMMA_R, 1,
		[Define if the lgamma_r function is available]
Morten Welinder's avatar
Morten Welinder committed
577
	 )
578
	 supply_lgamma_r=no
Morten Welinder's avatar
Morten Welinder committed
579
         LIBS="$LIBS -lm"])
580 581 582 583 584 585 586
else
  supply_lgamma_r=no
fi
if test $supply_lgamma_r = yes; then
   AC_DEFINE(GNM_SUPPLIES_LGAMMA_R, 1,
	[Define if Gnumeric supplies the lgamma_r function]
	)
Morten Welinder's avatar
Morten Welinder committed
587
fi
588
AC_CHECK_FUNCS(lgamma)
589 590 591 592 593
if test $ac_cv_func_lgamma = no; then
   AC_DEFINE(GNM_SUPPLIES_LGAMMA, 1,
	[Define if Gnumeric supplies the lgamma function]
	)
fi
Jody Goldberg's avatar
Jody Goldberg committed
594

595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615
cos_works=yes
AC_MSG_CHECKING([cos is reliable])
AC_RUN_IFELSE(
	[AC_LANG_PROGRAM([[
			#include <stdlib.h>
			#include <math.h>
		]],
		[[
			const char *s = "1.5689793435451356";
			double x = atof (s);
			double c = cos (x);
			int ok = (c > 0 && c < 0.05);
			return ok ? 0 : 1;
		]])],
	[AC_MSG_RESULT(yes)
	 cos_works=yes],
	[AC_MSG_RESULT(no)
	 cos_works=no],
	[AC_MSG_RESULT(assuming it is)])

if test "x$with_win32" = "xyes" -o "x$cos_works" = "xno"; then
616 617 618 619 620
   AC_DEFINE(GNM_REDUCES_TRIG_RANGE, 1,
	[Define if Gnumeric reduces the argument range of sin/cos/tan]
	)
fi

621 622
float_msg=double
AC_ARG_WITH(long_double,
623
	AS_HELP_STRING([--with-long-double], [Use long double for floating point]),
624
	[if test "x$withval" = xyes; then
625 626 627
		SAVE_CFLAGS="$CFLAGS"
		SAVE_LIBS="$LIBS"
		CFLAGS="$GNUMERIC_CFLAGS"
628
		LIBS="$GNUMERIC_LIBS -lm"
629

630 631
		AC_CHECK_HEADERS(sunmath.h)

632
		AC_CHECK_FUNCS(go_render_generall,
633 634
			       ,
			       AC_MSG_ERROR([libgoffice needs to be compiled with long double support.]))
635

636
		AC_CHECK_FUNCS(fabsl sqrtl expl expm1l logl log2l log10l log1pl ceill floorl powl hypotl \
Morten Welinder's avatar
Morten Welinder committed
637
				sinl cosl tanl asinl acosl atanl atan2l fmodl lgammal lgammal_r \
638
				sinhl coshl tanhl asinhl acoshl atanhl \
639 640 641
				isnanl finitel,
				,
				AC_MSG_ERROR([Long doubles require the $ldfunc function.]))
642 643

		AC_MSG_CHECKING([checking for working erfl and erfcl])
644 645
		have_erfl=no
		have_erfcl=no
646 647 648 649 650
		AC_RUN_IFELSE(
			[AC_LANG_PROGRAM([[
				#include <math.h>
				#ifdef HAVE_SUNMATH_H
				#include <sunmath.h>
651 652
				#endif
				]],
653 654 655 656 657 658
				[[
					long double l1 = erfl (1.2L);
					long double l2 = erfcl (1.2L);
					return !(l1 >= 0.91 && l1 <= 0.92 &&
						 l2 >= 0.08 && l2 <= 0.09);
				]])],
659
			[AC_DEFINE(HAVE_ERFL)
660
			 have_erfl=yes
661
			 AC_DEFINE(HAVE_ERFCL)
662
			 have_erfcl=yes
663 664
			AC_MSG_RESULT(yes)],
			AC_MSG_RESULT(no),
665 666 667 668 669 670 671 672 673 674 675 676 677 678 679
			[AC_CHECK_FUNCS(erfl erfcl)
			have_erfl=$ac_cv_func_erfl
			have_erfcl=$ac_cv_func_erfcl
			])

		if $have_erfl = no; then
			AC_DEFINE(GNM_SUPPLIES_ERFL, 1,
				 [Define if Gnumeric supplies the erfl function]
				 )
		fi
		if $have_erfcl = no; then
			AC_DEFINE(GNM_SUPPLIES_ERFCL, 1,
				 [Define if Gnumeric supplies the erfcl function]
				 )
		fi
680

681 682 683
		CFLAGS="$SAVE_CFLAGS"
		LIBS="$SAVE_LIBS"

684 685
		float_msg="long double (EXPERIMENTAL)"
		AC_MSG_WARN([Long double support is experimental -- expect problems])
686
		AC_DEFINE(GNM_WITH_LONG_DOUBLE, 1,
687 688
			[Define if the long double type is to be used]
		)
689 690 691
	fi]
)

692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741
## this should come after `AC_PROG_CC'
set_more_warnings=yes
if test "$GCC" = yes -a "x$set_more_warnings" != xno; then
	dnl Clang needs this option, or else it will appear to support any
	dnl warning option, only to spew warnings about them later.
	uwoption="-Werror=unknown-warning-option"
	SAVE_CFLAGS="$CFLAGS"
	CFLAGS="$CFLAGS $uwoption"
	AC_MSG_CHECKING([whether gcc understands $uwoption])
	AC_COMPILE_IFELSE(
		[AC_LANG_PROGRAM([], [])],
		[has_unknown_warning_option=yes],
		[has_unknown_warning_option=no; uwoption=""])
	AC_MSG_RESULT($has_unknown_warning_option)
	CFLAGS="$SAVE_CFLAGS"

	warning_options="-Wall -Werror=init-self -Werror=missing-include-dirs \
			 -Wsign-compare -Werror=pointer-arith \
			 -Wchar-subscripts -Wwrite-strings \
			 -Wdeclaration-after-statement -Wnested-externs \
			 -Wmissing-noreturn \
			 -Werror=missing-prototypes -Werror=nested-externs \
			 -Werror=implicit-function-declaration \
			 -Wmissing-declarations -Wno-pointer-sign \
			 -Werror=format-security -Wbitwise -Wcast-to-as \
			 -Wdefault-bitfield-sign -Wdo-while -Wparen-string \
			 -Wptr-subtraction-blows -Wreturn-void -Wtypesign \
			 -Wstrict-prototypes -Wno-error=format-nonliteral "
	for option in $warning_options ; do
		SAVE_CFLAGS="$CFLAGS"
		CFLAGS="$CFLAGS $uwoption $option"
		AC_MSG_CHECKING([whether gcc understands $option])
		dnl Include a system header so we ignore Werror=... flags
		dnl that cause trouble.
		AC_COMPILE_IFELSE(
			[AC_LANG_PROGRAM([[#include <stdio.h>]], [])],
			[has_option=yes],
			[has_option=no])
		CFLAGS="$SAVE_CFLAGS"
		if test $has_option = yes; then
			CFLAGS="$CFLAGS $option"
		fi
		AC_MSG_RESULT($has_option)
		unset has_option
		unset SAVE_CFLAGS
	done
	unset option
fi
AC_SUBST(WARN_CFLAGS)

Jean Bréfort's avatar
Jean Bréfort committed
742 743 744
dnl **************************************************
dnl * Check for GSettings
dnl **************************************************
745 746 747 748 749 750 751 752 753
have_gsettings=no
AC_CHECK_LIB(gio-2.0,[g_settings_new],
	[AC_DEFINE(HAVE_G_SETTINGS_NEW, 1,
		[Define if the g_settings_new function is available])
        GLIB_GSETTINGS
        have_gsettings=yes],
	[GSETTINGS_RULES=""
	AC_SUBST(GSETTINGS_RULES)])
AM_CONDITIONAL(HAVE_GSETTINGS, test $have_gsettings=yes)
Jean Bréfort's avatar
Jean Bréfort committed
754

755 756 757
dnl **************************************************
dnl * Check for Perl
dnl **************************************************
758 759 760 761

AC_ARG_VAR(PERL, [The Perl executable.])
AC_CHECK_PROG(PERL, perl, perl)

762 763 764
want_perl=auto
have_perl=no
perl_reason=""
765
AC_ARG_WITH(perl, AS_HELP_STRING([--without-perl], [Do not build the Perl plugin loader]),
766
	[case $withval in
767 768
	yes) want_perl=yes;;
	no) want_perl=no;;
769
	esac])
770 771 772
if test "x$want_perl" = xno ; then
    perl_reason="disabled by request"
else
773
    if test "x$PERL" != x; then
774
	BIG_CHECKING([for perl ExtUtils::Embed module])
775 776
	if $PERL -e 'eval { require ExtUtils::Embed }; if ($@) { exit(1); } else { exit(0); }'
	then
777
	    AC_MSG_RESULT(yes)
778 779

	    dnl Use ExtUtils::Embed to figure out the other options.
780 781 782 783 784 785
	    PERL_CCCDLFLAGS=`$PERL -MConfig -e 'print $Config{cccdlflags};'`
	    PERL_LDDLFLAGS=`$PERL -MConfig -e 'print $Config{lddlflags};'`
	    PERL_CC=`$PERL -MConfig -e 'print $Config{cc};'`
	    PERL_LD=`$PERL -MConfig -e 'print $Config{ld};'`
	    perlinc=`$PERL -MConfig -e 'print "$Config{archlib}/CORE";'`
	    PERL_CCOPTS="`$PERL -MExtUtils::Embed -e ccopts` -I$perlinc"
786 787 788
	    PERL_LDOPTS=`$PERL -MExtUtils::Embed -e ldopts`

	    AC_MSG_CHECKING([Checking for perl compiler, linker, libraries and headers])
789
	    rm -f testperl$ac_exeext testperl.$ac_objext testperl.c testperl.err
790 791 792 793 794 795 796
	    cat > testperl.c <<EOF
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
int main () { (void)&perl_construct; return 0; }
EOF
	    $PERL_CC $PERL_CCOPTS -c testperl.c >testperl.err 2>&1 &&
797
	    $PERL_LD -o testperl testperl.$ac_objext $PERL_LDOPTS >testperl.err 2>&1 &&
798 799 800 801 802 803
	    test -x testperl &&
	    have_perl=yes
	    AC_MSG_RESULT($have_perl)

	    if test "x$have_perl" != xyes; then
		perl_reason="failed to compile test program"
804
		cat testperl.err testperl.c >&AS_MESSAGE_LOG_FD
805 806
	    fi

807
	    rm -f testperl$ac_exeext testperl.$ac_objext testperl.c testperl.err
808

Jody Goldberg's avatar
Jody Goldberg committed
809
	else
810
	    AC_MSG_RESULT(no)
811
	    perl_reason="missing parts of perl"
Jody Goldberg's avatar
Jody Goldberg committed
812 813
	fi
    else
814
	perl_reason="missing perl"
Jody Goldberg's avatar
Jody Goldberg committed
815 816
    fi
fi
817

818 819 820
if test "$want_perl" = xyes -a "x$have_perl" != xyes; then
    AC_MSG_ERROR([Perl requested, but not available: $perl_reason])
fi
821

822
AM_CONDITIONAL(WITH_PERL, test "x$have_perl" = xyes)
823
if test "x$have_perl" = xyes ; then
824
    perl_msg="yes (using $PERL)"
825 826
else
    perl_msg="no ($perl_reason)"
827
fi
828 829 830 831 832 833
AC_SUBST(PERL_CCCDLFLAGS)
AC_SUBST(PERL_LDDLFLAGS)
AC_SUBST(PERL_CC)
AC_SUBST(PERL_LD)
AC_SUBST(PERL_CCOPTS)
AC_SUBST(PERL_LDOPTS)
834

835 836 837
dnl **************************************************
dnl * Check for Python
dnl **************************************************
838
python_msg="yes"
839
GNM_PY_CFLAGS=
840
GNM_PY_LDFLAGS=
841 842
GNM_PY_LIBADD=

843
AC_ARG_WITH(python, AS_HELP_STRING([--without-python], [Do not build the Python plugin loader]))
844
AC_ARG_VAR(PYTHON, [The Python executable.])
Stepan Kasal's avatar
Stepan Kasal committed
845 846 847 848 849 850
case $with_python in
yes|no) ;;
?*) AC_MSG_ERROR([You cannot use --with-python with an argument.
If you want to specify a path to your Python executable, use:
	$srcdir/configure PYTHON=/path/to/your/python ...]);;
esac
851
if test "x$with_python" != xno; then
852
    AC_PATH_PROGS(PYTHON, python python2 python2.7)
853 854
    if test "x$PYTHON" = x; then
	python_msg="could not find python"
855 856 857 858 859
    fi
else
    python_msg="Disabled by request"
fi

860 861 862 863
# A bit of a mess.  We really ought to separate the Python interpreter
# and the Python plugin
have_python=no
have_python_gi=no
Morten Welinder's avatar
Morten Welinder committed
864
PYTHON_GIOVERRIDESDIR=
865 866 867 868 869 870 871 872
if test "x$PYTHON" != x; then
    AC_DEFINE_UNQUOTED(PYTHON_INTERPRETER, ["$PYTHON"],
		       [The Python interpreter to use])
    have_python=yes

    AC_MSG_CHECKING([for python module gi])
    if $PYTHON -c 'import gi' 2>/dev/null; then
        have_python_gi=yes
Morten Welinder's avatar
Morten Welinder committed
873
	[PYTHON_GIOVERRIDESDIR=`python -c 'import gi; import os.path; print(os.path.dirname(gi.__file__)+"/overrides")'`]
874 875 876 877 878 879
    fi
    AC_MSG_RESULT($have_python_gi)
fi
AM_CONDITIONAL(HAVE_PYTHON_GI, test "x$have_python_gi" = "xyes")


880
if test "x$python_msg" = xyes; then
881
    BIG_CHECKING([for python = 2.x])
882
    [PY_VERSION=`$PYTHON -c 'import sys ; sys.stdout.write(sys.version[0:3])'`
883
     major_ver=`$PYTHON -c 'import sys ; sys.stdout.write(sys.version[0:1])'`]
884
    if test "x$major_ver" = "x2"; then
885
	AC_MSG_RESULT(yes)
886
	if test "x$with_native_win32" = xyes ; then
887 888 889
	    # 2.x on linux, 2x on win32
	    PY_VERSION=`echo $PY_VERSION | sed -e 's/\\.//'`
	fi
890
    else
891
	AC_MSG_RESULT(no)
892
	python_msg="NO.  Python version \"${PY_VERSION}\" is too old."
893 894 895 896
    fi
fi

if test "x$python_msg" = xyes; then
897
    if test "x$PY_PREFIX" = x; then
898 899
	PY_PREFIX=`$PYTHON -c 'import sys ; sys.stdout.write(sys.prefix)'`
    fi
900
    if test "x$PY_INCLUDE_DIR" = x; then
901
	if test "x$with_native_win32" = xyes ; then
Colin Watson's avatar
Colin Watson committed
902
	    PY_INCLUDES="-I$PY_PREFIX/include"
903
	else
Colin Watson's avatar
Colin Watson committed
904
	    PY_INCLUDES=`$PYTHON -c 'import sys ; import distutils.sysconfig ; sys.stdout.write("-I" + distutils.sysconfig.get_python_inc()) ; sys.stdout.write(" -I" + distutils.sysconfig.get_python_inc(plat_specific=True))'`
905
	fi
906
    else
Colin Watson's avatar
Colin Watson committed
907
	PY_INCLUDES="-I$PY_INCLUDE_DIR"
908
    fi
Colin Watson's avatar
Colin Watson committed
909 910 911 912 913 914 915 916 917 918 919 920 921

    python_msg="unable to find Python.h"
    for py_include in $PY_INCLUDES; do
	py_include_dir="${py_include#-I}"
	BIG_CHECKING(Look for $py_include_dir/Python.h)
	if test -f $py_include_dir/Python.h; then
	    AC_MSG_RESULT(yes)
	    python_msg="yes"
	    break
	else
	    AC_MSG_RESULT(no)
	fi
    done
922 923 924
fi

if test "x$python_msg" = xyes; then
925 926
    m4_define([pygobject_required_version], [3.0.0])
    PKG_CHECK_MODULES(PYGOBJECT, pygobject-3.0 >= pygobject_required_version,,
927
      [python_msg="Missing pygobject"])
928 929 930 931
fi

AM_CONDITIONAL(WITH_PYTHON, test "x$python_msg" = xyes)
if test "x$python_msg" = xyes; then
932
    if test "x$PY_LIB_DIR" = x; then
933
	if test "x$with_native_win32" = xyes ; then
934 935
	    PY_LIB_DIR="$PY_PREFIX/libs"
	else
936
	    PY_LIB_DIR=`$PYTHON -c 'import sys ; import distutils.sysconfig ; sys.stdout.write(distutils.sysconfig.get_config_var("LIBPL"))'`
937 938 939
	fi
    fi

Colin Watson's avatar
Colin Watson committed
940
    GNM_PY_CFLAGS="$PY_INCLUDES $PYGOBJECT_CFLAGS"
941
    GNM_PY_LDFLAGS="-L$PY_LIB_DIR -lpython$PY_VERSION $PYGOBJECT_LIBS"
942
    python_msg="yes (using $PYTHON)"
943 944
elif test "x$with_python" = "xyes"; then
		AC_MSG_ERROR([$python_msg])
945
fi
946

947 948 949
AC_SUBST(GNM_PY_CFLAGS)
AC_SUBST(GNM_PY_LDFLAGS)
AC_SUBST(GNM_PY_LIBADD)
950

Morten Welinder's avatar
Morten Welinder committed
951
YELP_HELP_INIT(no-lc-dist)
952

953 954 955 956 957
# Support for PDF docs
AC_ARG_ENABLE(pdfdocs,
  AS_HELP_STRING([--enable-pdfdocs],[Generate documentation in Portable Document Format]),
  [enable_pdfdocs=$enableval],
  [enable_pdfdocs=no])
958
pdf_msg="No, not requested.";
959
if test x"$enable_pdfdocs" = xyes; then
960
	pdfroute=""
961
	AC_CHECK_PROG(DBCONTEXT, [dbcontext], [dbcontext], [])
962 963 964 965 966 967 968 969 970 971 972
	AC_CHECK_PROG(DBLATEX, [dblatex], [dblatex], [])
	if test x"$DBCONTEXT" = x"dbcontext"; then
		pdfroute=dbcontext
	else
		if test x"$DBLATEX" = x"dblatex"; then
			pdfroute=dblatex
		fi
	fi
	if test x"$pdfroute" != x""; then
		pdf_msg="Yes, through $pdfroute."
	else
973
		AC_MSG_ERROR([
974 975
Did not find a suitable tool for generating Portable Document Format from
DocBook XML - aborting.
976

977 978
Both the DocBook to ConTeXt and the DocBook to LaTeX conversion tool can be
obtained from
979 980
	http://dblatex.sourceforge.net/
])
Morten Welinder's avatar
Morten Welinder committed
981
		exit 1
982 983
	fi
fi
984
AM_CONDITIONAL(ENABLE_PDFDOCS, test x"$enable_pdfdocs" = xyes)
985 986
AM_CONDITIONAL(ENABLE_PDF_VIA_DBCONTEXT, test x"$pdfroute" = x"dbcontext")
AM_CONDITIONAL(ENABLE_PDF_VIA_DBLATEX, test x"$pdfroute" = x"dblatex")
987 988


989 990
dnl A tricky way to comment out in m4:
ifelse([
991
dnl **************************************************
Jody Goldberg's avatar
Jody Goldberg committed
992 993 994 995 996
dnl * Check for mono
dnl **************************************************
with_mono=no
mono_msg="disabled, still experimental"

997
AC_ARG_WITH(mono, AS_HELP_STRING([--with-mono], [Compile the mono scripting engine]))
998 999
case $with_mono in
no)	mono_msg="Disabled by request";;
Jody Goldberg's avatar
Jody Goldberg committed
1000 1001 1002 1003 1004 1005 1006 1007
*)
    PKG_CHECK_MODULES(MONO, mono,
	[with_mono=yes
	 AC_DEFINE(WITH_MONO, 1, [Define if mono .NET engine is available])],
	[with_mono=no])
    mono_msg=$with_mono
    ;;
esac
1008
AM_CONDITIONAL(WITH_MONO, test "x$with_mono" = xyes)
Jody Goldberg's avatar
Jody Goldberg committed
1009 1010
AC_SUBST(MONO_CFLAGS)
AC_SUBST(MONO_LIBS)
1011 1012
])

1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045
# GObject Introspection
GIR_REQ=1.0.0
AC_ARG_ENABLE(introspection,
          AS_HELP_STRING([--enable-introspection[=@<:@no/auto/yes@:>@]],
                         [Enable introspection for this build]),, 
                         [enable_introspection=no])

AC_MSG_CHECKING([for gobject-introspection])

dnl presence/version checking
AS_CASE([$enable_introspection],
[no], [
    found_introspection="no (disabled, use --enable-introspection to enable)"
],
[yes],[
    PKG_CHECK_EXISTS([gobject-introspection-1.0],,
                     AC_MSG_ERROR([gobject-introspection-1.0 is not installed]))
    PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $GIR_REQ],
                     found_introspection=yes,
                     AC_MSG_ERROR([You need to have gobject-introspection >= $1 installed to build AC_PACKAGE_NAME]))
],
[auto],[
    PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $GIR_REQ], found_introspection=yes, found_introspection=no)
dnl Canonicalize enable_introspection
enable_introspection=$found_introspection
],
[	
    AC_MSG_ERROR([invalid argument passed to --enable-introspection, should be one of @<:@no/auto/yes@:>@])
])

AC_MSG_RESULT([$found_introspection])

if test "x$found_introspection" = "xyes"; then
1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057
   dnl You can override INTROSPECTION_GIRDIR and INTROSPECTION_TYPELIBDIR
   dnl if you wish.  If you override the latter, you might want to set
   dnl GI_TYPELIB_PATH to include the same directory.  For example
   dnl
   dnl GI_TYPELIB_PATH=$PREFIX/lib64/girepository-1.0
   dnl INTROSPECTION_TYPELIBDIR=$GI_TYPELIB_PATH
   dnl INTROSPECTION_GIRDIR=$PREFIX/share/gir-1.0
   dnl
   dnl Note, that unlike gnumeric's binaries, nothing tells python where
   dnl to find gnumeric libraries, so you might also need to set
   dnl LD_LIBRARY_PATH.

1058 1059 1060
   INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
   INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
   INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0`
1061 1062 1063 1064 1065 1066
   if test "x$INTROSPECTION_GIRDIR" = x; then
     INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0`
   fi
   if test "x$INTROSPECTION_TYPELIBDIR" = x; then
     INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"
   fi
1067 1068 1069
   INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0`
   INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0`
   INTROSPECTION_MAKEFILE=`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection
1070 1071 1072 1073 1074 1075 1076 1077 1078
else
   INTROSPECTION_SCANNER=
   INTROSPECTION_COMPILER=
   INTROSPECTION_GENERATE=
   INTROSPECTION_GIRDIR=
   INTROSPECTION_TYPELIBDIR=
   INTROSPECTION_CFLAGS=
   INTROSPECTION_LIBS=
   INTROSPECTION_MAKEFILE=
1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114
fi
AC_SUBST(INTROSPECTION_SCANNER)
AC_SUBST(INTROSPECTION_COMPILER)
AC_SUBST(INTROSPECTION_GENERATE)
AC_SUBST(INTROSPECTION_GIRDIR)
AC_SUBST(INTROSPECTION_TYPELIBDIR)
AC_SUBST(INTROSPECTION_CFLAGS)
AC_SUBST(INTROSPECTION_LIBS)
AC_SUBST(INTROSPECTION_MAKEFILE)

AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = "xyes")
dnl we need to change the install directories for distcheck
AC_ARG_WITH([gir-dir],
	AS_HELP_STRING(
		[--with-gir-dir],
		[
		 path to gir repository
		 (automatically detected via pkg-config)
		]
	),
	[GIRDIR=$withval],
	[GIRDIR=$INTROSPECTION_GIRDIR]
)
AC_SUBST(GIRDIR)
AC_ARG_WITH([typelib-dir],
	AS_HELP_STRING(
		[--with-typelib-dir],
		[
		 path to typelibs repository
		 (automatically detected via pkg-config)
		]
	),
	[TYPELIBDIR=$withval],
	[TYPELIBDIR=$INTROSPECTION_TYPELIBDIR]
)
AC_SUBST(TYPELIBDIR)
Morten Welinder's avatar
Morten Welinder committed
1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126
AC_ARG_WITH([gi-overrides-dir],
	AS_HELP_STRING(
		[--with-gi-overrides-dir],
		[
		 path to introspection overrides repository
		 (automatically detected via python)
		]
	),
	[GIOVERRIDESDIR=$withval],
	[GIOVERRIDESDIR=$PYTHON_GIOVERRIDESDIR]
)
AC_SUBST(GIOVERRIDESDIR)
1127

1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139
AC_ARG_WITH([goffice-plugins-dir],
	AS_HELP_STRING(
		[--with-goffice-plugins-dir],
		[
		 path to goffice plugins
		 (automatically detected via pkg-config)
		]
	),
	[GOFFICE_PLUGINS_DIR=$withval],
	[:]
)

1140

Jody Goldberg's avatar
Jody Goldberg committed
1141
dnl **************************************************
1142
dnl * Config defaults
1143
dnl **************************************************
1144 1145 1146 1147 1148 1149 1150 1151
dnl
dnl These are changed in gutils.c for WIN32 packages
AC_SUBST(gnumeric_datadir, '${datadir}/gnumeric/${VERSION}')
AC_SUBST(gnumeric_libdir, '${libdir}/gnumeric/${VERSION}')
AC_SUBST(gnumeric_icondir, '${datadir}/pixmaps/gnumeric')
AC_SUBST(gnumeric_localedir, '${prefix}/${DATADIRNAME}/locale')
dnl
AC_SUBST(gnumeric_plugindir, '${gnumeric_libdir}/plugins')
1152
AC_SUBST(gnumeric_externplugindir, '${libdir}/gnumeric/${GNUMERIC_API_VER}/plugins')
1153

1154 1155
AC_SUBST(YYYYMMDD, `date +%Y%m%d`)

Jody Goldberg's avatar
Jody Goldberg committed
1156
dnl Export to gnumeric-config.h
1157 1158
AC_DEFINE(GNM_VERSION_FULL, "gnumeric_version_full",
	[The version number of this release, with optional extra suffix])
1159
AC_DEFINE(GNM_VERSION_EPOCH, gnumeric_version_epoch,
1160 1161 1162 1163 1164 1165 1166
	[The Epoch of this release])
AC_DEFINE(GNM_VERSION_MAJOR, gnumeric_version_major,
	[The Major version number of this release])
AC_DEFINE(GNM_VERSION_MINOR, gnumeric_version_minor,
	[The Minor version number of this release])
AC_DEFINE(GNM_VERSION_EXTRA, "gnumeric_version_extra",
	[Extra, possibly empty tag for this release])
1167 1168
AC_DEFINE(GNM_API_VERSION, "GNUMERIC_API_VER",
	[The API version number of this release])
1169

1170
AC_OUTPUT([
1171
gnumeric.spec
Arturo Espinosa's avatar
Arturo Espinosa committed
1172
Makefile
1173
libspreadsheet.pc
1174
icons/Makefile
1175
icons/16x16/Makefile
1176 1177
icons/16x16/actions/Makefile
icons/16x16/apps/Makefile
1178
icons/22x22/Makefile
1179 1180
icons/22x22/actions/Makefile
icons/22x22/apps/Makefile
1181
icons/24x24/Makefile
1182 1183
icons/24x24/actions/Makefile
icons/24x24/apps/Makefile
1184
icons/32x32/Makefile
Morten Welinder's avatar
Morten Welinder committed
1185
icons/32x32/actions/Makefile
1186
icons/32x32/apps/Makefile
1187
icons/48x48/Makefile
Morten Welinder's avatar
Morten Welinder committed
1188
icons/48x48/actions/Makefile
1189
icons/48x48/apps/Makefile
1190
icons/256x256/Makefile
1191
icons/256x256/apps/Makefile
1192
introspection/Makefile
1193
src/Makefile
1194
doc/Makefile
Arturo Espinosa's avatar
Arturo Espinosa committed
1195
plugins/Makefile
1196
plugins/fn-christian-date/Makefile
jpekka's avatar
jpekka committed
1197
plugins/fn-complex/Makefile
1198
plugins/fn-database/Makefile
Morten Welinder's avatar
Morten Welinder committed
1199
plugins/fn-date/Makefile
1200
plugins/fn-derivatives/Makefile
1201
plugins/fn-eng/Makefile
1202
plugins/fn-erlang/Makefile
1203
plugins/fn-financial/Makefile
1204
plugins/fn-hebrew-date/Makefile
Morten Welinder's avatar
Morten Welinder committed
1205
plugins/fn-info/Makefile
1206
plugins/fn-logical/Makefile
1207
plugins/fn-lookup/Makefile
Morten Welinder's avatar
Morten Welinder committed
1208
plugins/fn-math/Makefile
1209
plugins/fn-numtheory/Makefile
1210
plugins/fn-r/Makefile
1211
plugins/fn-stat/Makefile
1212
plugins/fn-string/Makefile
jpekka's avatar
jpekka committed
1213
plugins/fn-random/Makefile
1214
plugins/fn-tsa/Makefile
1215 1216
plugins/applix/Makefile
plugins/dif/Makefile
1217
plugins/excel/Makefile
Morten Welinder's avatar
Morten Welinder committed
1218
plugins/excelplugins/Makefile
Jody Goldberg's avatar
Jody Goldberg committed
1219
plugins/gda/Makefile
1220
plugins/gnome-db/Makefile
1221 1222
plugins/gnome-glossary/Makefile
plugins/html/Makefile
1223
plugins/lotus-123/Makefile
1224
plugins/lpsolve/Makefile
1225
plugins/nlsolve/Makefile
1226
plugins/glpk/Makefile
1227
plugins/mps/Makefile
1228
plugins/oleo/Makefile
1229 1230
plugins/openoffice/Makefile
plugins/paradox/Makefile
Jody Goldberg's avatar
Jody Goldberg committed
1231 1232
plugins/perl-func/Makefile
plugins/perl-loader/Makefile
1233
plugins/plan-perfect/Makefile
Jody Goldberg's avatar
Jody Goldberg committed
1234
plugins/psiconv/Makefile
1235 1236 1237
plugins/py-func/Makefile
plugins/python-loader/Makefile
plugins/qpro/Makefile
Jody Goldberg's avatar
Jody Goldberg committed
1238
plugins/sample_datasource/Makefile
1239 1240
plugins/sc/Makefile
plugins/sylk/Makefile
Jody Goldberg's avatar
Jody Goldberg committed
1241
plugins/uihello/Makefile
1242
plugins/xbase/Makefile
Arturo Espinosa's avatar
Arturo Espinosa committed
1243
po/Makefile.in
1244
po-functions/Makefile.in
Jody Goldberg's avatar
Jody Goldberg committed
1245
schemas/Makefile
Jean Bréfort's avatar
Jean Bréfort committed
1246 1247 1248
schemas/org.gnome.gnumeric.gschema.xml.in
schemas/org.gnome.gnumeric.dialogs.gschema.xml.in
schemas/org.gnome.gnumeric.plugin.gschema.xml.in
Jody Goldberg's avatar
Jody Goldberg committed
1249 1250
templates/Makefile
templates/english/Makefile
1251
templates/autoformat/Makefile
1252
test/Makefile
1253
tools/Makefile
1254
tools/win32/Makefile
1255 1256
tools/win32/moduleset
tools/win32/gnumeric.nsi
1257
component/Makefile
Fatih Demir's avatar
Fatih Demir committed
1258
])
1259

1260 1261 1262 1263 1264
echo "

Configuration:

	Source code location:	${srcdir}
Morten Welinder's avatar
Morten Welinder committed
1265
	Compiler:		${CC}
Morten Welinder's avatar
Morten Welinder committed
1266
	Compiler flags:		${CFLAGS}
Morten Welinder's avatar
Morten Welinder committed
1267
	Floating point type:	${float_msg}
1268

Stepan Kasal's avatar
Stepan Kasal committed
1269
	UI:			${ui_msg}
1270

Jody Goldberg's avatar
Jody Goldberg committed
1271
	Perl Support:		${perl_msg}
1272
	Python Support:		${python_msg}
Jody Goldberg's avatar
Jody Goldberg committed
1273

1274
	GDA support:		${gda_msg}
1275
	GNOME-DB support:	${gnomedb_msg}
1276
	Psiconv support:        ${psiconv_msg}
1277 1278

	PDF documentation:	${pdf_msg}
1279
"
1280
#	Mono support:		${mono_msg}
1281
#	Guile Support:		${guile_msg}