configure.in 37.1 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
m4_define([gnumeric_version_epoch], [1])
7
m4_define([gnumeric_version_major], [10])
Morten Welinder's avatar
Morten Welinder committed
8
m4_define([gnumeric_version_minor], [15])
9
m4_define([gnumeric_version_extra], [])
10
m4_define([gnumeric_version_full],
11
    [gnumeric_version_epoch.gnumeric_version_major.gnumeric_version_minor[]gnumeric_version_extra])
12

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

17
AC_INIT([gnumeric], [gnumeric_version_full],
18
	[http://bugzilla.gnome.org/enter_bug.cgi?product=gnumeric])
Arturo Espinosa's avatar
Arturo Espinosa committed
19

Jody Goldberg's avatar
Jody Goldberg committed
20
AC_CONFIG_SRCDIR(src/sheet.h)
Jody Goldberg's avatar
Jody Goldberg committed
21
AM_INIT_AUTOMAKE([dist-bzip2])
22

23 24 25 26 27 28 29 30 31 32 33
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],
34
	m4_eval(100 * gnumeric_version_epoch + gnumeric_version_major))
35 36 37 38 39 40

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

dnl Almost like epoch.major but development versions look forward to the next
dnl stable release.
Jody Goldberg's avatar
Jody Goldberg committed
41
AC_SUBST([GNUMERIC_API_VER], [1.10])
42

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

46 47 48 49 50 51 52 53
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])

Arturo Espinosa's avatar
Arturo Espinosa committed
54 55
AM_MAINTAINER_MODE

56 57
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])

58 59 60
# Make --disable-static the default
AC_DISABLE_STATIC

61
dnl We use a LINGUAS file, so we need intltool >= 0.35:
62
IT_PROG_INTLTOOL([0.35.0])
63
IT_PO_SUBDIR(po-functions)
64

65 66 67 68 69 70 71
if test `expr gnumeric_version_major % 2` -eq 1; then
    AC_MSG_NOTICE([NOTE: This is a development release])
    gnumeric_devel=yes
else
    gnumeric_devel=no
fi

Stepan Kasal's avatar
Stepan Kasal committed
72 73 74
dnl We use $host and $host_os:
AC_CANONICAL_HOST

Arturo Espinosa's avatar
Arturo Espinosa committed
75 76
AC_ISC_POSIX
AC_PROG_CC
Arturo Espinosa's avatar
Arturo Espinosa committed
77
AC_PROG_YACC
78
AM_PROG_LEX
Jody Goldberg's avatar
Jody Goldberg committed
79
AC_PROG_LN_S
Jody Goldberg's avatar
Jody Goldberg committed
80
AM_PROG_LIBTOOL
81
DOLT
Stepan Kasal's avatar
Stepan Kasal committed
82
AC_HEADER_STDC
Arturo Espinosa's avatar
Arturo Espinosa committed
83

84 85
dnl Propagate Gnome-specific variable ACLOCAL_FLAGS to Makefile.
AC_SUBST(ACLOCAL_AMFLAGS, $ACLOCAL_FLAGS)
86

Jody Goldberg's avatar
Jody Goldberg committed
87 88
dnl *****************************
# Check for zlib.
89 90 91
dnl
dnl zlib is needed for the excel plugin; see plugins/excel/Makefile.am
dnl
Jody Goldberg's avatar
Jody Goldberg committed
92 93 94 95
_cppflags="${CPPFLAGS}"
_ldflags="${LDFLAGS}"

AC_ARG_WITH(zlib,
96
	AS_HELP_STRING([--with-zlib=DIR], [use libz in DIR]),
97 98
	[case $withval in
	 yes|no) ;;
Jody Goldberg's avatar
Jody Goldberg committed
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
	 *)	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}

129 130 131 132 133 134 135
dnl **********
dnl * Goffice 
dnl **********
# Goffice releases are parallel installable, which do we depend on
GOFFICE_API_VER="0.8"
AC_SUBST(GOFFICE_API_VER)
# Components
136
GOFFICE_PLUGINS_DIR=`pkg-config --variable=PluginDir libgoffice-${GOFFICE_API_VER}`
137
AC_SUBST(GOFFICE_PLUGINS_DIR)
138 139 140
GOFFICE_VERSION=`pkg-config --modversion libgoffice-${GOFFICE_API_VER}`
AC_SUBST(GOFFICE_VERSION)

141

142
dnl PKG_PROG_PKG_CONFIG is expanded just before the first occurrence of
Stepan Kasal's avatar
Stepan Kasal committed
143
dnl PKG_CHECK_MODULES.  Since this is inside an `if,' it can escape
144
dnl execution.  Thus we need an explicit call:
145
PKG_PROG_PKG_CONFIG(0.18)
146

147
dnl *****************************
148
libspreadsheet_reqs="
149
	libgoffice-${GOFFICE_API_VER}	>= 0.8.15
150
	libgsf-1		>= 1.14.18
151 152 153
	libxml-2.0		>= 2.4.12
"
gnumeric_reqs="$libspreadsheet_reqs
154
	glib-2.0		>= 2.12.0
Morten Welinder's avatar
Morten Welinder committed
155 156 157
	gobject-2.0		>= 2.10.0
	gmodule-2.0		>= 2.10.0
	gthread-2.0		>= 2.10.0
158
	pango			>= 1.12.0
159
	pangocairo		>= 1.10.0
160
"
161
libspreadsheet_gtk_reqs="
162
	gtk+-2.0		>= 2.12.0
163
"
164

165
gnumeric_gtk_reqs="$libspreadsheet_gtk_reqs"
166

167
libspreadsheet_gnome_reqs="
168
	libbonobo-2.0		>= 2.2.0
169
"
170

171
gnumeric_gnome_reqs="$libspreadsheet_gnome_reqs
172
	libgnomeui-2.0		>= 2.0.0
173 174
	libbonoboui-2.0		>= 2.2.0
	libgnome-2.0		>= 2.0.0
175
	libgsf-gnome-1		>= 1.14.2
176
"
177

178 179
ui_msg=

180 181 182 183 184 185 186
with_win32=no
case $host_os in
mingw* | pw32* | cygwin*)
    with_win32=yes
    ;;
esac

187 188 189 190
dnl *******************
dnl Should we use gtk ?
dnl *******************
gnumeric_with_gtk=true
191
AC_ARG_WITH(gtk, AS_HELP_STRING([--without-gtk], [Build without UI]))
192 193 194
if test "x$with_gtk" = xno; then
	ui_msg="None (Gtk disabled by request)"
	gnumeric_with_gtk=false
Stepan Kasal's avatar
Stepan Kasal committed
195 196 197 198
else
	dnl We shouldn't silently default to --without-gtk.
	dnl If the requirements are not met, fail.
	ui_msg="Gtk"
199
	PKG_CHECK_MODULES(GTK, [$libspreadsheet_gtk_reqs])
Stepan Kasal's avatar
Stepan Kasal committed
200
	PKG_CHECK_MODULES(GTK, [$gnumeric_gtk_reqs])
201 202
fi 

203
if test "x$gnumeric_with_gtk" = xtrue ; then
204
	AC_DEFINE(GNM_WITH_GTK, 1, [Define if UI is built])
205
	libspreadsheet_reqs="$libspreadsheet_reqs $libspreadsheet_gtk_reqs"
206
	gnumeric_reqs="$gnumeric_reqs $gnumeric_gtk_reqs"
207
fi
208

209 210
gnumeric_with_gnome=false
if test "x$gnumeric_with_gtk" = xtrue -a "x$with_win32" = xno ; then
211 212 213 214
	dnl ************************************
	dnl Are the GNOME extensions available ?
	dnl ************************************

215
	ui_msg="Gtk+ (Gnome disabled)"
216
	AC_ARG_WITH(gnome,
217
		AS_HELP_STRING([--with-gnome], [Use GNOME extensions]),
218 219 220
		if test "x$withval" == xyes; then
			ui_msg="Gnome"
			gnumeric_with_gnome=true
221 222
		fi
	)
223
	if test "x$gnumeric_with_gnome" = xtrue; then
224 225
		PKG_CHECK_MODULES(GNOME, [$libspreadsheet_gnome_reqs],
			[ui_msg="Gnome"],
226
			[ui_msg="Gtk (missing Gnome dependencies)" ; gnumeric_with_gnome=false])
227 228
		PKG_CHECK_MODULES(GNOME, [$gnumeric_gnome_reqs],
			[ui_msg="Gnome"],
229
			[ui_msg="Gtk (missing Gnome dependencies)" ; gnumeric_with_gnome=false])
230 231
	fi

232
	if test "x$gnumeric_with_gnome" = xtrue; then
233
		AC_DEFINE(GNM_WITH_GNOME, 1, [Define if GNOME extensions are available])
234
		libspreadsheet_reqs="$libspreadsheet_reqs $libspreadsheet_gnome_reqs"
235 236
		gnumeric_reqs="$gnumeric_reqs $gnumeric_gnome_reqs"
	fi
237
fi
238
AM_CONDITIONAL(WITH_GTK,   $gnumeric_with_gtk)
239 240
AM_CONDITIONAL(WITH_GNOME, $gnumeric_with_gnome)

241 242 243 244 245
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 ****************************

246 247 248 249
PKG_CHECK_MODULES(LIBSPREADSHEET, $libspreadsheet_reqs)
AC_SUBST(LIBSPREADSHEET_LIBS)
AC_SUBST(LIBSPREADSHEET_CFLAGS)

250
PKG_CHECK_MODULES(GNUMERIC, $gnumeric_reqs)
Jody Goldberg's avatar
Jody Goldberg committed
251 252 253
AC_SUBST(GNUMERIC_LIBS)
AC_SUBST(GNUMERIC_CFLAGS)

254 255 256 257
with_native_win32=no
case $host_os in
mingw* | pw32*)
    with_native_win32=yes
Stepan Kasal's avatar
Stepan Kasal committed
258
    AC_ARG_VAR(WINDRES, [The windres executable (used by win32 builds only).])
259 260 261
    AC_CHECK_TOOL(WINDRES, windres, :)
    ;;
esac
Stepan Kasal's avatar
Stepan Kasal committed
262
AM_CONDITIONAL(WITH_WIN32, test $with_win32 = yes)
263
AM_CONDITIONAL(WITH_NATIVE_WIN32, test $with_native_win32 = yes)
264
AM_CONDITIONAL(CROSS_COMPILING, test x"$cross_compiling" != xno)
265

266
if test "x$with_win32" = "xyes"; then
267
    GNUMERIC_PLUGIN_LDFLAGS="-avoid-version -no-undefined $GNUMERIC_LIBS -Wl,--enable-runtime-pseudo-reloc,--export-all-symbols \$(top_builddir)/src/libspreadsheet.la -s"
268 269 270
else
    GNUMERIC_PLUGIN_LDFLAGS="-avoid-version"
fi
271 272
AC_SUBST(GNUMERIC_PLUGIN_LDFLAGS)

273 274 275 276
dnl disable for in stable release, enable for development series
if test $gnumeric_devel = yes; then
    CFLAGS="$CFLAGS -DG_DISABLE_DEPRECATED"
    CFLAGS="$CFLAGS -DPANGO_DISABLE_DEPRECATED"
277
    if test "x$gnumeric_with_gtk" = xtrue; then
278 279 280 281
	    CFLAGS="$CFLAGS -DGDK_PIXBUF_DISABLE_DEPRECATED"
	    CFLAGS="$CFLAGS -DGDK_DISABLE_DEPRECATED"
	    CFLAGS="$CFLAGS -DGDK_MULTIHEAD_SAFE"
	    CFLAGS="$CFLAGS -DGTK_DISABLE_DEPRECATED"
282
	    # CFLAGS="$CFLAGS -DGSEAL_ENABLE"
283
    fi
284
    if test "x$gnumeric_with_gnome" = xtrue; then
285 286 287 288
	    CFLAGS="$CFLAGS -DGNOME_DISABLE_DEPRECATED"
	    CFLAGS="$CFLAGS -DBONOBO_DISABLE_DEPRECATED"
	    CFLAGS="$CFLAGS -DBONOBO_UI_DISABLE_DEPRECATED"
    fi
289
fi
290

291 292
dnl ==============================================
dnl Maemo/Hildon based User Interface
Jody Goldberg's avatar
Jody Goldberg committed
293

294
AC_ARG_ENABLE(hildon,
295
	AS_HELP_STRING([--enable-hildon],[Build with Maemo/Hildon support]),
296 297 298
    enable_hildon="$enableval",
    enable_hildon=no)

299
if test "x$enable_hildon" = xyes ; then
300 301 302
    PKG_CHECK_MODULES(HILDON,
                      hildon-libs hildon-fm libosso,
                      HAVE_HILDON=yes, HAVE_HILDON=no)
Jody Goldberg's avatar
Jody Goldberg committed
303 304
fi

305
if test "x$HAVE_HILDON" = xyes ; then
306
    AC_DEFINE(GNM_USE_HILDON, 1, [Build with Maemo/Hildon support])
307
fi
Jody Goldberg's avatar
Jody Goldberg committed
308

309
AM_CONDITIONAL(USE_HILDON, test "x$HAVE_HILDON" = xyes)
310 311
AC_SUBST(HILDON_CFLAGS)
AC_SUBST(HILDON_LIBS)
Jody Goldberg's avatar
Jody Goldberg committed
312

313 314
dnl The following conditional is set in AM_GCONF_SOURCE_2.
dnl Because we may skip its execution, we have to set a default here.
315
m4_pattern_allow([^AM_GCONF_SOURCE_2$])
316 317
AM_CONDITIONAL([GCONF_SCHEMAS_INSTALL], [false])

318 319 320 321 322
dnl *******************
dnl Do we need gconf ?
dnl *******************
gnumeric_with_gconf=false
if test ! -z "`echo $GNUMERIC_CFLAGS|grep gconf`"; then
323 324 325 326
	dnl ==============================================
	dnl Special GConf section  (stolen from libgnome)
	dnl ==============================================

327 328 329
	dnl Don't publish the GCONFTOOL variable, AM_GCONF_SOURCE_2 has ``gconftool-2'' hardwired.
	GCONFTOOL=""
	AC_CHECK_PROG(GCONFTOOL, gconftool-2, gconftool-2)
330
	if test x"$GCONFTOOL" = x; then
331 332 333
		AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
	fi
	AM_GCONF_SOURCE_2
334
	gnumeric_with_gconf=true
335
fi
336 337 338
AM_CONDITIONAL(WITH_GCONF, $gnumeric_with_gconf)

with_corba=false
339 340
AM_CONDITIONAL(WITH_CORBA, $with_corba)

341

342 343 344 345
dnl ****************************
dnl prep the pixmap generator
dnl ****************************

346
AC_ARG_VAR(GLIB_GENMARSHAL, [The glib-genmarshal executable.])
347
AC_CHECK_PROG(GLIB_GENMARSHAL, glib-genmarshal$ac_exeext, glib-genmarshal$ac_exeext)
348 349

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

Arturo Espinosa's avatar
Arturo Espinosa committed
352
## this should come after `AC_PROG_CC'
353 354 355 356
ifdef([GNOME_COMPILE_WARNINGS],
	[GNOME_COMPILE_WARNINGS] CFLAGS="$CFLAGS $WARN_CFLAGS",
	[]
)
357
set_more_warnings=yes
358
if test "$GCC" = yes -a "x$set_more_warnings" != xno; then
359 360 361 362 363 364 365 366 367 368 369 370 371
	warning_options="-Wsign-compare -Wpointer-arith -Wnested-externs \
			 -Wchar-subscripts -Wwrite-strings \
			 -Wdeclaration-after-statement -Wnested-externs \
			 -Wmissing-noreturn -Wmissing-prototypes \
			 -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"
	if test $gnumeric_devel = yes; then
		dnl Avoid triggering a warning in gtk+ headers for stable.
		warning_options="$warning_options -Wstrict-prototypes"
	fi
	for option in $warning_options ; do
Morten Welinder's avatar
Morten Welinder committed
372 373 374 375 376 377 378 379 380 381 382 383 384 385 386
		SAVE_CFLAGS="$CFLAGS"
		CFLAGS="$CFLAGS $option"
		AC_MSG_CHECKING([whether gcc understands $option])
		AC_TRY_COMPILE([], [],
			has_option=yes,
			has_option=no,)
		if test $has_option = no; then
		  CFLAGS="$SAVE_CFLAGS"
		fi
		AC_MSG_RESULT($has_option)
		unset has_option
		unset SAVE_CFLAGS
	done
	unset option
fi
387
AC_SUBST(WARN_CFLAGS)
Morten Welinder's avatar
Morten Welinder committed
388

389
AC_ARG_ENABLE(ssconvert,
390
  AS_HELP_STRING([--disable-ssconvert], [Do not build ssconvert (command line spreadsheet conversion tool)]),
391
  [], [enable_ssconvert=yes])
392
AM_CONDITIONAL(ENABLE_SSCONVERT, test x"$enable_ssconvert" = xyes)
393

394
AC_ARG_ENABLE(ssindex,
395
  AS_HELP_STRING([--disable-ssindex], [Do not build ssindex (spreadsheet indexer for beagle)]),
396
  [], [enable_ssindex=yes])
397
AM_CONDITIONAL(ENABLE_SSINDEX, test x"$enable_ssindex" = xyes)
398

399
AC_ARG_ENABLE(ssgrep,
400
  AS_HELP_STRING([--disable-ssgrep], [Do not build ssgrep (search for supplied strings in spreadsheet)]),
401
  [], [enable_ssgrep=yes])
402
AM_CONDITIONAL(ENABLE_SSGREP, test x"$enable_ssgrep" = xyes)
403

404 405 406 407 408 409 410 411 412 413 414
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)

415 416 417 418 419
dnl ****************************
dnl GDA Plugin
dnl ****************************
try_gda=true
gda_msg=yes
420
gnomedb_msg=no
421
AC_ARG_WITH(gda,
422
	AS_HELP_STRING([--with-gda], [Compile the Gnome Database Access plugin]),
423 424
	if test "x$withval" != xyes; then
		try_gda=false
425 426 427
		gda_msg="Disabled by request"
	fi
)
428
if test "$try_gda" = true; then
429
	PKG_CHECK_MODULES(GDA, [libgda-4.0 >= 4.1.1],
430
		[gda_msg=yes],
431
		[gda_msg="NO.  libgda problem"])
432 433 434
	AC_CHECK_HEADER(libgda/control-center/gdaui-login-dialog.h,
			[],
			[gda_msg="NO.  libgda problem"])
435
	if test "$gda_msg" = yes; then
Jody Goldberg's avatar
Jody Goldberg committed
436
		PKG_CHECK_MODULES(GNOMEDB, [libgnomedb-4.0 >= 3.99.6],
437 438
			[gnomedb_msg="yes"],
			[gnomedb_msg="NO. libgnomedb problem"])
439
		if test "$gnomedb_msg" = yes; then
440 441 442
			AC_DEFINE(HAVE_LIBGNOMEDB, 1, [ Define if libgnomedb support is compiled in])
		fi
	fi
443
fi
444
AM_CONDITIONAL(WITH_GDA, test x"$gda_msg" = xyes)
445 446 447
AC_SUBST(GDA_CFLAGS)
AC_SUBST(GDA_LIBS)

448
AM_CONDITIONAL(WITH_GNOMEDB, test x"$gnomedb_msg" = xyes)
449 450 451
AC_SUBST(GNOMEDB_CFLAGS)
AC_SUBST(GNOMEDB_LIBS)

452
dnl ****************************
Morten Welinder's avatar
Morten Welinder committed
453

454 455 456 457
AC_CHECK_DECL(fdopen, fdopen_works=yes, fdopen_works=no)

if test $fdopen_works = no ; then
	unset ac_cv_have_decl_fdopen
458
	CFLAGS="$CFLAGS -D_POSIX_SOURCE"
459 460 461 462 463 464
	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
465

466 467 468 469 470 471 472 473 474 475 476 477
# Unfortunately, -D_POSIX_SOURCE turns off struct timeval on Solaris
AC_MSG_CHECKING([whether struct timeval is available])
AC_TRY_COMPILE([#include <sys/time.h>], [struct timeval tv;], struct_timeval_works=yes, struct_timeval_works=no)
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__])
	AC_TRY_COMPILE([#include <sys/time.h>], [struct timeval tv;], struct_timeval_works=yes, struct_timeval_works=no)
	AC_MSG_RESULT($struct_timeval_works)
	if test $struct_timeval_works = no ; then
		AC_MSG_ERROR([struct timeval is not available])
478 479 480
	fi
fi

481 482 483 484 485
AC_CHECK_FUNC(gettimeofday,
	[AC_DEFINE(HAVE_GETTIMEOFDAY, 1,
		[Define if the gettimeofday function is available]
	)])

Andreas J. Guelzow's avatar
Andreas J. Guelzow committed
486
dnl src/functions/fn-math.c uses M_PI
487 488 489 490 491 492

AC_MSG_CHECKING([whether M_PI is available])
AC_TRY_COMPILE([#include <math.h>], [double f = M_PI], works_without_bsd_source=yes, works_without_bsd_source=no)
AC_MSG_RESULT($works_without_bsd_source)

if test $works_without_bsd_source = no ; then
Andreas J. Guelzow's avatar
Andreas J. Guelzow committed
493
	CFLAGS="$CFLAGS -D_BSD_SOURCE"
494 495 496 497 498 499
	AC_MSG_CHECKING([whether M_PI is available with -D_BSD_SOURCE])
	AC_TRY_COMPILE([#include <math.h>], [double f = M_PI], m_pi_works=yes, m_pi_works=no)
	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
500 501
fi

Arturo Espinosa's avatar
Arturo Espinosa committed
502 503
AC_SUBST(GUILE_LIBS)
AC_SUBST(GUILE_INCS)
504

505 506
dnl Comment out the guile block:
ifelse([
507
dnl check for guile 1.5
508
try_guile=false
509
guile_msg="disabled pending some guile developer interest"
510
enable_guile=false
511
AC_ARG_WITH(guile,
512
	AS_HELP_STRING([--with-guile], [Compile with Guile support or without it]),
513
	if test "x$withval" = xyes; then
514
		try_guile=true
515 516
	fi
)
517 518 519 520 521 522 523 524 525 526 527 528 529
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
530
AM_CONDITIONAL(WITH_GUILE, $enable_guile)
531
])
Arturo Espinosa's avatar
Arturo Espinosa committed
532

Jody Goldberg's avatar
Jody Goldberg committed
533 534 535
dnl **************************************************
dnl * psiconv support
dnl **************************************************
536

537
AC_ARG_WITH(psiconv,
538
	AS_HELP_STRING([--without-psiconv], [Compile without Psiconv support]))
539 540
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
541
    AC_CHECK_PROG(PSICONV_CONFIG,psiconv-config,psiconv-config)
542 543
    if test x"$PSICONV_CONFIG" = x; then
	psiconv_msg="missing dependencies"
544 545
    else
	AC_MSG_CHECKING(for psiconv >= 0.9.3)
546 547 548
	if $PSICONV_CONFIG --version | awk -F. \
		'{exit !($1 > 0 || $2 > 9 || ($2 == 9 && $3 >= 3))}'
	then
549 550 551 552 553 554 555 556
	    PSICONV_CFLAGS=`$PSICONV_CONFIG --cflags`
            PSICONV_LIBS=`$PSICONV_CONFIG --libs`
	    psiconv_msg=yes
        else
	    psiconv_msg=no
        fi
	AC_MSG_RESULT($psiconv_msg)
    fi
557 558
else
    psiconv_msg=no
559
fi
560
AM_CONDITIONAL(WITH_PSICONV, test "x$psiconv_msg" = xyes)
561 562
AC_SUBST(PSICONV_LIBS)
AC_SUBST(PSICONV_CFLAGS)
Jody Goldberg's avatar
Jody Goldberg committed
563

564 565 566
try_paradox=true
enable_paradox=false
AC_ARG_WITH(paradox,
567
	AS_HELP_STRING([--without-paradox], [Compile without Paradox support]),
568 569 570 571 572 573
	if test "x$withval" = xno; then
		try_paradox=false
	fi
)

if $try_paradox; then
574 575
	PKG_CHECK_MODULES(PARADOX,
		[pxlib >= 0.4.0],
576 577 578 579
		[paradox_msg="yes"],
		[paradox_msg="missing dependencies"])
fi

580
if test "x$paradox_msg" = xyes; then
581 582 583 584 585 586
	enable_paradox=true
fi
AM_CONDITIONAL(WITH_PARADOX, $enable_paradox)
AC_SUBST(PARADOX_LIBS)
AC_SUBST(PARADOX_CFLAGS)

587
AC_ARG_ENABLE(solver, AS_HELP_STRING([--disable-solver], [Don't compile the solver]))
588 589 590 591
if test "x$enable_solver" = xno; then
	enable_solver=false
else
	enable_solver=true
592
	AC_DEFINE(GNM_ENABLE_SOLVER, 1, [Define if SOLVER is compiled])
593 594 595 596 597 598
fi
AM_CONDITIONAL(ENABLE_SOLVER, $enable_solver)

plugin_list_given=false
PLUGIN_LIST=""
AC_ARG_ENABLE(plugins,
599
	AS_HELP_STRING([--enable-plugins="text html"], [Compile only the listed plugins]),
Stepan Kasal's avatar
Stepan Kasal committed
600 601 602
	[plugin_list_given=true
	 test "x$enableval" != xno && PLUGIN_LIST=$enableval
])
603 604 605
AM_CONDITIONAL(PLUGIN_LIST_GIVEN, $plugin_list_given)
AC_SUBST(PLUGIN_LIST)

606 607
POFILES_FULL=
for lang in $ALL_LINGUAS; do
Stepan Kasal's avatar
Stepan Kasal committed
608
    POFILES_FULL="$POFILES_FULL \$(top_srcdir)/po/$lang.po"
609 610
done
AC_SUBST(POFILES_FULL)
611 612

AC_SUBST(GETTEXT_PACKAGE, gnumeric)
613
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",
614
	[The package name, for gettext])
Jody Goldberg's avatar
Jody Goldberg committed
615
AM_GLIB_GNU_GETTEXT
616
dnl
617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646
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.
dnl 
[# Create po-functions/POTFILES:
if test -d po-functions; then
	rm -f po-functions/POTFILES
else
	mkdir po-functions
fi
case "$srcdir" in
647 648 649 650
	.)  top_srcdir=.. ;;
	[\\/]* | ?:[\\/]* )  # Absolute name.
		top_srcdir="$srcdir" ;;
	*)  top_srcdir="../$srcdir" ;;
651 652
esac
sed <$srcdir/po-functions/POTFILES.in -e '/^#/d' -e 's/^[[].*[]] *//' \
653 654 655
	 -e '/^[   ]*$/d' -e "s,^,       $top_srcdir/," | \
        sed -e '$!s/$/ \\/' >po-functions/POTFILES
]
656
dnl Finally, register for creation of po-functions/Makefile:
657
dnl We do not currently do anything here.
658
AC_CONFIG_COMMANDS(po-functions/Makefile,
659
  [cp po-functions/Makefile.in po-functions/Makefile])
Jody Goldberg's avatar
Jody Goldberg committed
660

661 662
SAVE_LIBS="$LIBS"
LIBS="$LIBS $GNUMERIC_LIBS"
663
AC_CHECK_FUNCS(mkfifo)
664 665 666
LIBS="$SAVE_LIBS"
unset SAVE_LIBS

667 668
dnl Either of these seem to signal IEEE754 math, see mathfunc.c
AC_CHECK_HEADERS(ieeefp.h ieee754.h)
669

670 671
AC_HEADER_SYS_WAIT

Morten Welinder's avatar
Morten Welinder committed
672
dnl Check for some functions
673
AC_CHECK_FUNCS(memmove mkdtemp uname times sysconf)
674

675 676 677
dnl FIXME: Does this really belong here?
AC_CHECK_FUNC(bind_textdomain_codeset,,[AC_CHECK_LIB(intl,bind_textdomain_codeset)])

678 679
dnl check for complete locale implementation
AC_CHECK_HEADERS(langinfo.h)
Jon Kåre Hellan's avatar
Jon Kåre Hellan committed
680

681 682 683
dnl check for rlimit
AC_CHECK_HEADERS(sys/resource.h)

684 685 686 687
SAVE_CFLAGS=$CFLAGS
SAVE_LIBS=$LIBS
CFLAGS="$CFLAGS $GNUMERIC_CFLAGS"
LIBS="$GNUMERIC_LIBS $LIBS"
688

689
AC_CHECK_FUNCS(g_option_context_set_delocalize g_hash_table_get_keys)
690
AC_CHECK_FUNCS(gdk_cairo_set_source_rgba gdk_window_get_screen)
691
AC_CHECK_FUNCS(gtk_adjustment_configure gtk_adjustment_get_page_increment gtk_adjustment_get_page_size gtk_adjustment_get_lower gtk_adjustment_get_upper gtk_adjustment_get_step_increment gtk_adjustment_set_lower gtk_adjustment_set_upper gtk_adjustment_set_page_increment gtk_adjustment_set_step_increment)
692 693
AC_CHECK_FUNCS(gtk_cell_renderer_get_alignment gtk_cell_renderer_get_padding)
AC_CHECK_FUNCS(gtk_cell_renderer_text_get_background_set gtk_cell_renderer_text_get_foreground_set gtk_cell_renderer_text_get_editable)
694
AC_CHECK_FUNCS(gtk_dialog_get_content_area gtk_dialog_get_action_area)
695
AC_CHECK_FUNCS(gtk_entry_get_text_length gtk_entry_set_icon_from_stock gtk_entry_get_buffer gtk_entry_get_text_area gtk_entry_set_editing_cancelled gtk_entry_get_overwrite_mode)
696
AC_CHECK_FUNCS(gtk_layout_get_bin_window)
697
AC_CHECK_FUNCS(gtk_object_destroy)
698
AC_CHECK_FUNCS(gtk_orientable_set_orientation)
699
AC_CHECK_FUNCS(gtk_selection_data_get_data gtk_selection_data_get_length gtk_selection_data_get_target)
700 701
AC_CHECK_FUNCS(gtk_table_get_size)
AC_CHECK_FUNCS(gtk_tree_view_column_get_button)
702
AC_CHECK_FUNCS(gtk_widget_get_visible gtk_widget_set_visible gtk_widget_get_state gtk_widget_is_toplevel gtk_widget_get_window gtk_widget_get_can_focus gtk_widget_has_focus gtk_widget_get_style gtk_widget_get_allocation gtk_widget_is_sensitive gtk_widget_set_can_focus gtk_widget_set_can_default gtk_widget_get_realized gtk_widget_render_icon_pixbuf)
703
AC_CHECK_FUNCS(gtk_window_get_default_widget)
704
AC_CHECK_FUNCS(gsf_infile_msvba_steal_modules gsf_open_pkg_foreach_rel )
705
AC_CHECK_FUNCS(pango_font_map_create_context)
706

707
AC_MSG_CHECKING([for working GTK_WIDGET_REALIZED.])
708 709 710 711 712 713 714 715 716 717 718 719 720 721 722
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gtk/gtk.h>]],
				[[GtkWidget *w = NULL;
				(void)(GTK_WIDGET_REALIZED (w));]])],
               [AC_DEFINE(HAVE_WORKING_GTK_WIDGET_REALIZED, 1, [Define if GTK_WIDGET_REALIZED exists and works])
		AC_MSG_RESULT(yes)],
	       [AC_MSG_RESULT(no)])

AC_MSG_CHECKING([for GtkEntry::text_area])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gtk/gtk.h>]],
				[[GtkEntry *e = NULL;
				(void)(e->text_area);]])],
               [AC_DEFINE(HAVE_GTK_ENTRY_TEXT_AREA, 1, [Define if GtkEntry::text_area exists])
		AC_MSG_RESULT(yes)],
	       [AC_MSG_RESULT(no)])

723 724 725 726 727 728 729 730
AC_MSG_CHECKING([for GtkHandleBox::float_window])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gtk/gtk.h>]],
				[[GtkHandleBox *hb = NULL;
				(void)(hb->float_window);]])],
               [AC_DEFINE(HAVE_GTK_HANDLE_BOX_FLOAT_WINDOW, 1, [Define if GtkHandleBox::float_window exists])
		AC_MSG_RESULT(yes)],
	       [AC_MSG_RESULT(no)])

731 732 733 734 735 736 737 738
AC_MSG_CHECKING([for GtkTable::nrows])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gtk/gtk.h>]],
				[[GtkTable *t = NULL;
				(void)(t->nrows == t->ncols);]])],
               [AC_DEFINE(HAVE_GTK_TABLE_NROWS, 1, [Define if GtkTable::nrows exists])
		AC_MSG_RESULT(yes)],
	       [AC_MSG_RESULT(no)])

739 740 741 742 743 744 745 746
AC_MSG_CHECKING([for GtkTreeViewColumn::button])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gtk/gtk.h>]],
				[[GtkTreeViewColumn *c = NULL;
				(void)(c->button);]])],
               [AC_DEFINE(HAVE_GTK_TREE_VIEW_COLUMN_BUTTON, 1, [Define if GtkTreeViewColumn::button exists])
		AC_MSG_RESULT(yes)],
	       [AC_MSG_RESULT(no)])

747 748 749 750 751 752 753 754 755
AC_MSG_CHECKING([for PANGO_WEIGHT_THIN etc.])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pango/pango.h>]],
				[[(void)(PANGO_WEIGHT_THIN == 42);
				(void)(PANGO_WEIGHT_MEDIUM == 42);
				(void)(PANGO_WEIGHT_ULTRAHEAVY == 42);]])],
               [AC_DEFINE(HAVE_PANGO_WEIGHT_THIN_ETC, 1, [Define if PANGO_WEIGHT_THIN etc are available])
		AC_MSG_RESULT(yes)],
	       [AC_MSG_RESULT(no)])

756 757 758 759 760 761 762
AC_MSG_CHECKING([for OO_NS_CHART_OOO])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gsf/gsf-opendoc-utils.h>]],
				[[(void)((int)OO_NS_CHART_OOO == 42);]])],
               [AC_DEFINE(HAVE_OO_NS_CHART_OOO, 1, [Define if OO_NS_CHART_OOO is available])
		AC_MSG_RESULT(yes)],
	       [AC_MSG_RESULT(no)])

763 764 765
CFLAGS=$SAVE_CFLAGS
LIBS=$SAVE_LIBS

766
dnl We supply our own lgamma and lgamma_r when missing.
767 768 769 770 771
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
772 773 774
	 )
         LIBS="$LIBS -lm"])
fi
775
AC_CHECK_FUNCS(lgamma)
Jody Goldberg's avatar
Jody Goldberg committed
776

777
AC_C_LONG_DOUBLE
778 779
float_msg=double
AC_ARG_WITH(long_double,
780
	AS_HELP_STRING([--with-long-double], [Use long double for floating point]),
781
	[if test "x$withval" = xyes; then
782 783 784 785 786
		SAVE_CFLAGS="$CFLAGS"
		SAVE_LIBS="$LIBS"
		CFLAGS="$GNUMERIC_CFLAGS"
		LIBS="$GNUMERIC_LIBS"

787 788
		AC_CHECK_HEADERS(sunmath.h)

789
		AC_CHECK_FUNCS(go_render_generall,
790 791
			       ,
			       AC_MSG_ERROR([libgoffice needs to be compiled with long double support.]))
792

793
		AC_CHECK_FUNCS(fabsl sqrtl expl expm1l logl log10l log1pl ceill floorl powl hypotl \
Morten Welinder's avatar
Morten Welinder committed
794
				sinl cosl tanl asinl acosl atanl atan2l fmodl lgammal lgammal_r \
795
				sinhl coshl tanhl asinhl acoshl atanhl \
796 797 798
				isnanl finitel,
				,
				AC_MSG_ERROR([Long doubles require the $ldfunc function.]))
799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834

		AC_MSG_CHECKING([checking for working ynl])
		AC_TRY_RUN([
			#include <math.h>
			#ifdef HAVE_SUNMATH_H
			#include <sunmath.h>
			#endif
			int main ()
			{
				long double l = ynl (2, 4.0L);
				return !(l >= 0.21 && l <= 0.22);
			}],
			[AC_DEFINE(HAVE_YNL)
			AC_MSG_RESULT(yes)],
			AC_MSG_RESULT(no),
			[AC_CHECK_FUNCS(ynl)])

		AC_MSG_CHECKING([checking for working erfl and erfcl])
		AC_TRY_RUN([
			#include <math.h>
			#ifdef HAVE_SUNMATH_H
			#include <sunmath.h>
			#endif
			int main ()
			{
				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);
			}],
			[AC_DEFINE(HAVE_ERFL)
			 AC_DEFINE(HAVE_ERFCL)
			AC_MSG_RESULT(yes)],
			AC_MSG_RESULT(no),
			[AC_CHECK_FUNCS(erfl erfcl)])

835 836 837
		CFLAGS="$SAVE_CFLAGS"
		LIBS="$SAVE_LIBS"

838 839
		float_msg="long double (EXPERIMENTAL)"
		AC_MSG_WARN([Long double support is experimental -- expect problems])
840
		AC_DEFINE(GNM_WITH_LONG_DOUBLE, 1,
841 842
			[Define if the long double type is to be used]
		)
843 844 845
	fi]
)

Jean Bréfort's avatar
Jean Bréfort committed
846 847 848
dnl **************************************************
dnl * Check for GSettings
dnl **************************************************
849 850 851 852 853 854 855 856 857
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
858

859 860 861
dnl **************************************************
dnl * Check for Perl
dnl **************************************************
862 863 864 865

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

866 867 868
want_perl=auto
have_perl=no
perl_reason=""
869
AC_ARG_WITH(perl, AS_HELP_STRING([--without-perl], [Do not build the Perl plugin loader]),
870
	[case $withval in
871 872
	yes) want_perl=yes;;
	no) want_perl=no;;
873
	esac])
874 875 876
if test "x$want_perl" = xno ; then
    perl_reason="disabled by request"
else
877
    if test "x$PERL" != x; then
878
	BIG_CHECKING([for perl ExtUtils::Embed module])
879 880
	if $PERL -e 'eval { require ExtUtils::Embed }; if ($@) { exit(1); } else { exit(0); }'
	then
881
	    AC_MSG_RESULT(yes)
882 883 884 885 886 887 888 889 890 891

	    dnl Use ExtUtils::Embed to figure out the other options.
	    PERL_CCCDLFLAGS=`$PERL -MConfig -e 'print $Config{cccdlflags},"\n";'`
	    PERL_LDDLFLAGS=`$PERL -MConfig -e 'print $Config{lddlflags},"\n";'`
	    PERL_CC=`$PERL -MConfig -e 'print $Config{cc},"\n";'`
	    PERL_LD=`$PERL -MConfig -e 'print $Config{ld},"\n";'`
	    PERL_CCOPTS=`$PERL -MExtUtils::Embed -e ccopts`
	    PERL_LDOPTS=`$PERL -MExtUtils::Embed -e ldopts`

	    AC_MSG_CHECKING([Checking for perl compiler, linker, libraries and headers])
892
	    rm -f testperl$ac_exeext testperl.$ac_objext testperl.c testperl.err
893 894 895 896 897 898 899 900 901 902 903 904 905 906
	    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 &&
	    $PERL_LD -o testperl testperl.o $PERL_LDOPTS >testperl.err 2>&1 &&
	    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"
907
		cat testperl.err testperl.c >&AS_MESSAGE_LOG_FD
908 909
	    fi

910
	    rm -f testperl$ac_exeext testperl.$ac_objext testperl.c testperl.err
911

Jody Goldberg's avatar
Jody Goldberg committed
912
	else
913
	    AC_MSG_RESULT(no)
914
	    perl_reason="missing parts of perl"
Jody Goldberg's avatar
Jody Goldberg committed
915 916
	fi
    else
917
	perl_reason="missing perl"
Jody Goldberg's avatar
Jody Goldberg committed
918 919
    fi
fi
920

921 922 923
if test "$want_perl" = xyes -a "x$have_perl" != xyes; then
    AC_MSG_ERROR([Perl requested, but not available: $perl_reason])
fi
924

925
AM_CONDITIONAL(WITH_PERL, test "x$have_perl" = xyes)
926
if test "x$have_perl" = xyes ; then
927
    perl_msg="yes (using $PERL)"
928 929
else
    perl_msg="no ($perl_reason)"
930
fi
931 932 933 934 935 936
AC_SUBST(PERL_CCCDLFLAGS)
AC_SUBST(PERL_LDDLFLAGS)
AC_SUBST(PERL_CC)
AC_SUBST(PERL_LD)
AC_SUBST(PERL_CCOPTS)
AC_SUBST(PERL_LDOPTS)
937

938 939 940
dnl **************************************************
dnl * Check for Python
dnl **************************************************
941
python_msg="yes"
942
GNM_PY_CFLAGS=
943
GNM_PY_LDFLAGS=
944 945
GNM_PY_LIBADD=

946
AC_ARG_WITH(python, AS_HELP_STRING([--without-python], [Do not build the Python plugin loader]))
947
AC_ARG_VAR(PYTHON, [The Python executable.])
Stepan Kasal's avatar
Stepan Kasal committed
948 949 950 951 952 953
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
954
if test "x$with_python" != xno; then
955
    AC_CHECK_PROGS(PYTHON, python python2 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0)
956 957
    if test "x$PYTHON" = x; then
	python_msg="could not find python"
958 959 960 961 962 963
    fi
else
    python_msg="Disabled by request"
fi

if test "x$python_msg" = xyes; then
964
    BIG_CHECKING([for python = 2.x])
965
    [PY_VERSION=`$PYTHON -c 'import sys ; sys.stdout.write(sys.version[0:3])'`
966
     major_ver=`$PYTHON -c 'import sys ; sys.stdout.write(sys.version[0:1])'`]
967
    if test "x$major_ver" = "x2"; then
968
	AC_MSG_RESULT(yes)
969
	if test "x$with_native_win32" = xyes ; then
970 971 972
	    # 2.x on linux, 2x on win32
	    PY_VERSION=`echo $PY_VERSION | sed -e 's/\\.//'`
	fi
973
    else
974
	AC_MSG_RESULT(no)
975
	python_msg="NO.  Python version \"${PY_VERSION}\" is too old."
976 977 978 979
    fi
fi

if test "x$python_msg" = xyes; then
980
    if test "x$PY_PREFIX" = x; then
981 982
	PY_PREFIX=`$PYTHON -c 'import sys ; sys.stdout.write(sys.prefix)'`
    fi
983
    if test "x$PY_INCLUDE_DIR" = x; then
984
	if test "x$with_native_win32" = xyes ; then
985 986
	    PY_INCLUDE_DIR="$PY_PREFIX/include"
	else
987
	    PY_INCLUDE_DIR=`$PYTHON -c 'import sys ; import distutils.sysconfig ; sys.stdout.write(distutils.sysconfig.get_python_inc())'`
988
	fi
989 990
    fi

991 992
    BIG_CHECKING(Look for $PY_INCLUDE_DIR/Python.h)
    if test -f $PY_INCLUDE_DIR/Python.h; then
993
	AC_MSG_RESULT(yes)
994
    else
995
	AC_MSG_RESULT(no)
996 997 998 999 1000
	python_msg="unable to find Python.h"
    fi
fi

if test "x$python_msg" = xyes; then
1001 1002 1003
    m4_define([pygobject_required_version], [2.12.0])
    PKG_CHECK_MODULES(PYGOBJECT, pygobject-2.0 >= pygobject_required_version,,
      [python_msg="Missing pygobject"])
1004 1005 1006 1007
fi

AM_CONDITIONAL(WITH_PYTHON, test "x$python_msg" = xyes)
if test "x$python_msg" = xyes; then
1008
    if test "x$PY_LIB_DIR" = x; then
1009
	if test "x$with_native_win32" = xyes ; then
1010 1011
	    PY_LIB_DIR="$PY_PREFIX/libs"
	else
1012
	    PY_LIB_DIR=`$PYTHON -c 'import sys ; import distutils.sysconfig ; sys.stdout.write(distutils.sysconfig.get_config_var("LIBPL"))'`
1013 1014 1015
	fi
    fi

1016 1017
    GNM_PY_CFLAGS="-I$PY_INCLUDE_DIR $PYGOBJECT_CFLAGS"
    GNM_PY_LDFLAGS="-L$PY_LIB_DIR -lpython$PY_VERSION $PYGOBJECT_LIBS"
1018
    python_msg="yes (using $PYTHON)"
1019
fi
1020 1021 1022
AC_SUBST(GNM_PY_CFLAGS)
AC_SUBST(GNM_PY_LDFLAGS)
AC_SUBST(GNM_PY_LIBADD)
1023

1024 1025 1026 1027 1028
# 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])
1029
pdf_msg="No, not requested.";
1030
if test x"$enable_pdfdocs" = xyes; then
1031
	pdfroute=""
1032
	AC_CHECK_PROG(DBCONTEXT, [dbcontext], [dbcontext], [])
1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043
	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
1044
		AC_MSG_ERROR([
1045 1046
Did not find a suitable tool for generating Portable Document Format from
DocBook XML - aborting.
1047

1048 1049
Both the DocBook to ConTeXt and the DocBook to LaTeX conversion tool can be
obtained from
1050 1051
	http://dblatex.sourceforge.net/
])
Morten Welinder's avatar
Morten Welinder committed
1052
		exit 1
1053 1054
	fi
fi
1055
AM_CONDITIONAL(ENABLE_PDFDOCS, test x"$enable_pdfdocs" = xyes)
1056 1057
AM_CONDITIONAL(ENABLE_PDF_VIA_DBCONTEXT, test x"$pdfroute" = x"dbcontext")
AM_CONDITIONAL(ENABLE_PDF_VIA_DBLATEX, test x"$pdfroute" = x"dblatex")
1058 1059


1060 1061
dnl A tricky way to comment out in m4:
ifelse([
1062
dnl **************************************************
Jody Goldberg's avatar
Jody Goldberg committed
1063 1064 1065 1066 1067
dnl * Check for mono
dnl **************************************************
with_mono=no
mono_msg="disabled, still experimental"

1068
AC_ARG_WITH(mono, AS_HELP_STRING([--with-mono], [Compile the mono scripting engine]))
1069 1070
case $with_mono in
no)	mono_msg="Disabled by request";;
Jody Goldberg's avatar
Jody Goldberg committed
1071 1072 1073 1074 1075 1076 1077 1078
*)
    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
1079
AM_CONDITIONAL(WITH_MONO, test "x$with_mono" = xyes)
Jody Goldberg's avatar
Jody Goldberg committed
1080 1081
AC_SUBST(MONO_CFLAGS)
AC_SUBST(MONO_LIBS)
1082 1083
])

Jody Goldberg's avatar
Jody Goldberg committed
1084
dnl **************************************************
1085 1086
dnl * Config defaults (Must be after bonobo)
dnl **************************************************
1087 1088 1089 1090 1091 1092 1093 1094
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')
1095

1096 1097
AC_SUBST(YYYYMMDD, `date +%Y%m%d`)

Jody Goldberg's avatar
Jody Goldberg committed
1098
dnl Export to gnumeric-config.h
1099 1100
AC_DEFINE(GNM_VERSION_FULL, "gnumeric_version_full",
	[The version number of this release, with optional extra suffix])
1101
AC_DEFINE(GNM_VERSION_EPOCH, gnumeric_version_epoch,
1102 1103 1104 1105 1106 1107 1108
	[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])
1109

1110
AC_OUTPUT([
1111
gnumeric.spec
Arturo Espinosa's avatar
Arturo Espinosa committed
1112
Makefile
1113
libspreadsheet.pc
1114
icons/Makefile
1115 1116 1117 1118 1119 1120
icons/16x16/Makefile
icons/22x22/Makefile
icons/24x24/Makefile
icons/32x32/Makefile
icons/48x48/Makefile
icons/scalable/Makefile
1121
src/Makefile
1122
src/dialogs/Makefile
Jody Goldberg's avatar
Jody Goldberg committed
1123 1124
src/pixmaps/Makefile
src/widgets/Makefile
1125
src/tools/Makefile
1126
src/cut-n-paste-code/Makefile
1127
doc/Makefile
1128
doc/C/Makefile
1129
doc/C/figures/Makefile
Jon Kåre Hellan's avatar
Jon Kåre Hellan committed
1130
doc/C/figures/icons/Makefile
1131
doc/developer/Makefile
Arturo Espinosa's avatar
Arturo Espinosa committed
1132
plugins/Makefile
1133
plugins/fn-christian-date/Makefile
jpekka's avatar
jpekka committed
1134
plugins/fn-complex/Makefile
1135
plugins/fn-database/Makefile
Morten Welinder's avatar
Morten Welinder committed
1136
plugins/fn-date/Makefile
1137
plugins/fn-derivatives/Makefile
1138
plugins/fn-eng/Makefile
1139
plugins/fn-erlang/Makefile
1140
plugins/fn-financial/Makefile
1141
plugins/fn-hebrew-date/Makefile
Morten Welinder's avatar
Morten Welinder committed
1142
plugins/fn-info/Makefile
1143
plugins/fn-logical/Makefile
1144
plugins/fn-lookup/Makefile
Morten Welinder's avatar
Morten Welinder committed
1145
plugins/fn-math/Makefile
1146
plugins/fn-numtheory/Makefile
1147
plugins/fn-r/Makefile
1148
plugins/fn-stat/Makefile
1149
plugins/fn-string/Makefile
jpekka's avatar
jpekka committed
1150
plugins/fn-random/Makefile
1151
plugins/fn-tsa/Makefile
1152 1153 1154
plugins/applix/Makefile
plugins/corba/Makefile
plugins/dif/Makefile
1155
plugins/excel/Makefile
Morten Welinder's avatar
Morten Welinder committed
1156
plugins/excelplugins/Makefile
Jody Goldberg's avatar
Jody Goldberg committed
1157
plugins/gda/Makefile
1158
plugins/gnome-db/Makefile
1159 1160
plugins/gnome-glossary/Makefile
plugins/html/Makefile
1161
plugins/lotus-123/Makefile
1162
plugins/lpsolve/Makefile
1163
plugins/nlsolve/Makefile
1164
plugins/glpk/Makefile
1165
plugins/mps/Makefile
1166
plugins/oleo/Makefile
1167 1168
plugins/openoffice/Makefile
plugins/paradox/Makefile
Jody Goldberg's avatar
Jody Goldberg committed
1169 1170
plugins/perl-func/Makefile
plugins/perl-loader/Makefile
1171
plugins/plan-perfect/Makefile
Jody Goldberg's avatar
Jody Goldberg committed
1172
plugins/psiconv/Makefile
1173 1174 1175
plugins/py-func/Makefile
plugins/python-loader/Makefile
plugins/qpro/Makefile
Jody Goldberg's avatar
Jody Goldberg committed
1176
plugins/sample_datasource/Makefile
1177 1178
plugins/sc/Makefile
plugins/sylk/Makefile
Jody Goldberg's avatar
Jody Goldberg committed
1179
plugins/uihello/Makefile
1180
plugins/xbase/Makefile
Arturo Espinosa's avatar
Arturo Espinosa committed
1181
po/Makefile.in
1182
po-functions/Makefile.in
Jody Goldberg's avatar
Jody Goldberg committed
1183
schemas/Makefile
Jean Bréfort's avatar
Jean Bréfort committed
1184 1185 1186
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
1187 1188
templates/Makefile
templates/english/Makefile
1189
templates/autoformat/Makefile
1190
test/Makefile
1191
tools/Makefile
1192
tools/win32/Makefile
1193 1194
tools/win32/moduleset
tools/win32/gnumeric.nsi
1195
component/Makefile
Fatih Demir's avatar
Fatih Demir committed
1196
])
1197

1198 1199 1200 1201 1202
echo "

Configuration:

	Source code location:	${srcdir}
Morten Welinder's avatar
Morten Welinder committed
1203
	Compiler:		${CC}
Morten Welinder's avatar
Morten Welinder committed
1204
	Compiler flags:		${CFLAGS}
Morten Welinder's avatar
Morten Welinder committed
1205
	Floating point type:	${float_msg}
1206

Stepan Kasal's avatar
Stepan Kasal committed
1207
	UI:			${ui_msg}
1208

Jody Goldberg's avatar
Jody Goldberg committed
1209
	Perl Support:		${perl_msg}
1210
	Python Support:		${python_msg}
Jody Goldberg's avatar
Jody Goldberg committed
1211

1212
	GDA support:		${gda_msg}
1213
	GNOME-DB support:	${gnomedb_msg}
1214
	Psiconv support:        ${psiconv_msg}
1215 1216

	PDF documentation:	${pdf_msg}
1217
"
1218
#	Mono support:		${mono_msg}
1219
#	Guile Support:		${guile_msg}