File: configure.in

package info (click to toggle)
gnumeric 1.6.3-5.1%2Betch2
  • links: PTS
  • area: main
  • in suites: etch
  • size: 70,644 kB
  • ctags: 18,973
  • sloc: ansic: 204,271; xml: 47,128; sh: 8,917; makefile: 2,540; yacc: 1,137; perl: 179; python: 86
file content (1047 lines) | stat: -rw-r--r-- 30,937 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
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
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
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
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
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
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
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
1046
1047
-*- mode: m4 -*-
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)

m4_define([gnumeric_version_epoch], [1])
m4_define([gnumeric_version_major], [6])
m4_define([gnumeric_version_minor], [3])
m4_define([gnumeric_version_extra], [])
m4_define([gnumeric_full_version],
    [gnumeric_version_epoch.gnumeric_version_major.gnumeric_version_minor[]gnumeric_version_extra])

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

AC_INIT([gnumeric], [gnumeric_full_version],
	[http://bugzilla.gnome.org/enter_bug.cgi?product=gnumeric])

AC_CONFIG_SRCDIR(src/sheet.h)
AM_INIT_AUTOMAKE([dist-bzip2])
AC_CONFIG_HEADERS(gnumeric-config.h)

AM_MAINTAINER_MODE

# Make --disable-static the default
AC_DISABLE_STATIC

dnl We use the XGETTEXT_KEYWORDS variable, thus we need intltool >= 0.29:
AC_PROG_INTLTOOL([0.29])

dnl We use $host and $host_os:
AC_CANONICAL_HOST

AC_ISC_POSIX
AC_PROG_CC
AC_PROG_YACC
AM_PROG_LEX
AC_PROG_LN_S
AM_PROG_LIBTOOL
AC_HEADER_STDC

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

if test "$GCC" = "yes"; then
  gcc_check=`$CC -v 2>&1 | grep '^gcc version 2\.96'`
  if test "$gcc_check" != ""; then
    # I know a dead parrot when I see one, and I am looking at
    # one now.
    AC_MSG_ERROR([You cannot compile Gnumeric with RedHat gcc 2.96.
We have seen too many subtle compiler errors.
Please use another compiler, for example a gcc 2.95 series compiler.])
    # Mate, this parrot wouldn't "vooom!" if you put four million
    # Volts through it!
    #
    # Actually, the real problem here is that there are so many
    # different compilers calling themselves 2.96.  RedHat, listen
    # up!  That's a MAJOR BLUNDER!  If the user just thinks of it
    # as "gcc 2.96" then how the H*** are we going to get bug
    # reports we can use?  Chances are the newer 2.96 compilers
    # are just fine, but how can we know?
  fi
fi

dnl *****************************
# Check for zlib.
dnl
dnl zlib is needed for the excel plugin; see plugins/excel/Makefile.am
dnl
_cppflags="${CPPFLAGS}"
_ldflags="${LDFLAGS}"

AC_ARG_WITH(zlib,
	[[  --with-zlib=DIR       use libz in DIR]],
	[case $withval in
	 yes|no) ;;
	 *)	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}

dnl PKG_PROG_PKG_CONFIG is expanded just before the first occurence of
dnl PKG_CHECK_MODULES.  Since this is inside an `if,' it can escape
dnl execution.  Thus we need an explicite call:
PKG_PROG_PKG_CONFIG

dnl *****************************
gnumeric_reqs="
	glib-2.0		>= 2.6.0
	gobject-2.0		>= 2.6.0
	gmodule-2.0		>= 2.6.0
	libgsf-1		>= 1.13.2
	libgoffice-1		>= 0.2.1
	libgoffice-1		 < 0.3.0
	libxml-2.0		>= 2.4.12
	pango			>= 1.8.1
	pangoft2		>= 1.8.1
"
gnumeric_gtk_reqs="
	gtk+-2.0		>= 2.6.0
	libglade-2.0		>= 2.3.6
	libgnomeprint-2.2	>= 2.8.2
	libgnomeprintui-2.2	>= 2.8.2
	libart-2.0		>= 2.3.11
"
gnumeric_gnome_reqs="
	gconf-2.0
	libbonobo-2.0		>= 2.2.0
	libbonoboui-2.0		>= 2.2.0
	libgnome-2.0		>= 2.0.0
	libgnomeui-2.0		>= 2.0.0
	libgsf-gnome-1		>= 1.13.0
"

ui_msg=

dnl *******************
dnl Should we use gtk ?
dnl *******************
gnumeric_with_gtk=true
AC_ARG_WITH(gtk, [--without-gtk    Build without UI])
if test "x$with_gtk" = xno; then
	ui_msg="None (Gtk disabled by request)"
	gnumeric_with_gtk=false
else
	dnl We shouldn't silently default to --without-gtk.
	dnl If the requirements are not met, fail.
	ui_msg="Gtk"
	PKG_CHECK_MODULES(GTK, [$gnumeric_gtk_reqs])
fi 

gnumeric_with_gnome=$gnumeric_with_gtk
if test "x$gnumeric_with_gtk" = "xtrue" ; then
	AC_DEFINE(WITH_GTK, 1, [Define if UI is built])
	gnumeric_reqs="$gnumeric_reqs $gnumeric_gtk_reqs"

	dnl ************************************
	dnl Are the GNOME extensions available ?
	dnl ************************************

	gnumeric_with_gnome=true
	AC_ARG_WITH(gnome,
		[--{with,without}-gnome    Use GNOME extensions],
		if test "x$withval" = xno; then
			gnumeric_with_gnome=false
			ui_msg="Gtk+ (Gnome disabled by request)"
		fi
	)
	if test "x$gnumeric_with_gnome" = "xtrue"; then
		PKG_CHECK_MODULES(GNOME, [$gnumeric_gnome_reqs],
			[ui_msg="Gnome"],
			[ui_msg="Gtk (missing gnome dependencies)" ; gnumeric_with_gnome=false])
	fi

	if test "x$gnumeric_with_gnome" = "xtrue"; then
		AC_DEFINE(WITH_GNOME, 1, [Define if GNOME extensions are available])
		gnumeric_reqs="$gnumeric_reqs $gnumeric_gnome_reqs"
	fi
fi
AM_CONDITIONAL(WITH_GTK,   $gnumeric_with_gtk)
AM_CONDITIONAL(WITH_GNOME, $gnumeric_with_gnome)

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 ****************************

PKG_CHECK_MODULES(GNUMERIC, $gnumeric_reqs)
AC_SUBST(GNUMERIC_LIBS)
AC_SUBST(GNUMERIC_CFLAGS)

with_win32=no
case $host_os in
mingw* | pw32* | cygwin*)
    with_win32=yes
    GNUMERIC_PLUGIN_LDFLAGS="-no-undefined $GNUMERIC_LIBS -Wl,--enable-runtime-pseudo-relo,--export-all-symbols \$(top_builddir)/src/libspreadsheet.la -s"
    AC_ARG_VAR(WINDRES, [The windres executable (used by win32 builds only).])
    AC_CHECK_TOOL(WINDRES, windres, :)
    ;;
esac
AM_CONDITIONAL(WITH_WIN32, test $with_win32 = yes)
AM_CONDITIONAL(CROSS_COMPILING, test x"$cross_compiling" != "xno")

GNUMERIC_PLUGIN_LDFLAGS="-avoid-version $GNUMERIC_PLUGIN_LDFLAGS"
AC_SUBST(GNUMERIC_PLUGIN_LDFLAGS)

dnl disable for in stable release, re-enable for development series
dnl CFLAGS="$CFLAGS -DG_DISABLE_DEPRECATED"
dnl CFLAGS="$CFLAGS -DPANGO_DISABLE_DEPRECATED"
dnl if test "x$gnumeric_with_gtk" = "xtrue"; then
dnl 	CFLAGS="$CFLAGS -DGDK_PIXBUF_DISABLE_DEPRECATED"
dnl 	CFLAGS="$CFLAGS -DGDK_DISABLE_DEPRECATED"
dnl 	CFLAGS="$CFLAGS -DGDK_MULTIHEAD_SAFE"
dnl 	CFLAGS="$CFLAGS -DGTK_DISABLE_DEPRECATED"
dnl 	CFLAGS="$CFLAGS -DLIBGLADE_DISABLE_DEPRECATED"
dnl fi
dnl if test "x$gnumeric_with_gnome" = "xtrue"; then
dnl 	CFLAGS="$CFLAGS -DGNOME_DISABLE_DEPRECATED"
dnl 	CFLAGS="$CFLAGS -DBONOBO_DISABLE_DEPRECATED"
dnl 	CFLAGS="$CFLAGS -DBONOBO_UI_DISABLE_DEPRECATED"
dnl fi

# CHECK HILDON
# -------------------------
# AC_DEFUN([ABI_HILDON_QUICK], [

dnl Quick&Easy HILDON Detection

hildon=false

HILDON_CFLAGS=""
HILDON_LIBS=""

AC_ARG_ENABLE(hildon,
	AC_HELP_STRING([--enable-hildon],[Compile with hildon support]),[
	if test "x$enableval" = "xyes"; then
		hildon=true
	fi
])

AM_CONDITIONAL(USE_HILDON, $hildon)

if test "$hildon" = true ; then
PKG_CHECK_MODULES(HILDON, hildon-libs dbus-1, USE_HILDON=yes,USE_HILDON=no)
	PKG_CHECK_MODULES(HILDON,[
		hildon-libs
		libosso
	])
	HILDON_CFLAGS="$HILDON_CFLAGS -DUSE_HILDON=1"
	HILDON_LIBS="$HILDON_LIBS"
fi

AC_SUBST(HILDON_CFLAGS)
AC_SUBST(HILDON_LIBS)

CFLAGS="$CFLAGS $HILDON_CFLAGS"
LIBS="$LIBS $HILDON_LIBS"

AM_CONDITIONAL(WITH_HILDON, test "x$hildon" = "xtrue")

# ])

# END HILDON
# --------------------------------------------------------------

dnl ==============================================
dnl GNOME Specific extensions

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.
AM_CONDITIONAL([GCONF_SCHEMAS_INSTALL], [false])

with_corba=false
if test "x${gnumeric_with_gnome}" = "xtrue"; then

	dnl ==============================================
	dnl Special GConf section  (stolen from libgnome)
	dnl ==============================================

	dnl Don't publish the GCONFTOOL variable, AM_GCONF_SOURCE_2 has ``gconftool-2'' hardwired.
	GCONFTOOL=""
	AC_CHECK_PROG(GCONFTOOL, gconftool-2, gconftool-2)
	if test x"$GCONFTOOL" = x; then
		AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
	fi
	AM_GCONF_SOURCE_2

	dnl *************
	dnl Corba support
	dnl *************
	PKG_CHECK_MODULES(CORBA_LIBS,
		[ORBit-2.0 >= 2.4.2
		libbonobo-2.0 >= 2.0.0
		bonobo-activation-2.0 >= 1.0.2],
		[with_corba=true],
		[with_corba=false])
	if test "x$with_corba" = "xtrue" ; then
		ORBIT="`$PKG_CONFIG --variable=orbit_idl ORBit-2.0`"
		BONOBO_IDL_DIR="`$PKG_CONFIG --variable=idldir libbonobo-2.0`"
		BONOBO_ACTIVATION_IDL_DIR="`$PKG_CONFIG --variable=idldir bonobo-activation-2.0`"
		ORBIT_IDL="${ORBIT} -I${BONOBO_IDL_DIR} -I${BONOBO_ACTIVATION_IDL_DIR}"
		AC_SUBST(ORBIT_IDL)
	fi
fi
AM_CONDITIONAL(WITH_CORBA, $with_corba)


dnl ****************************
dnl prep the pixmap generator
dnl ****************************

AC_ARG_VAR(GLIB_GENMARSHAL, [The glib-genmarshal executable.])
AC_CHECK_PROG(GLIB_GENMARSHAL, glib-genmarshal, glib-genmarshal)

AC_ARG_VAR(GDK_PIXBUF_CSOURCE, [The gdk-pixbuf-csource executable.])
AC_CHECK_PROG(GDK_PIXBUF_CSOURCE, gdk-pixbuf-csource, gdk-pixbuf-csource)

## this should come after `AC_PROG_CC'
ifdef([GNOME_COMPILE_WARNINGS],
	[GNOME_COMPILE_WARNINGS] CFLAGS="$CFLAGS $WARN_CFLAGS",
	[]
)
set_more_warnings=yes
if test "$GCC" = "yes" -a "x$set_more_warnings" != "xno"; then
	for option in -Wsign-compare -Wpointer-arith -Wnested-externs -Wchar-subscripts -Wwrite-strings -Wdeclaration-after-statement -Wnested-externs -Wmissing-noreturn -Wstrict-prototypes -Wmissing-prototypes -Wmissing-format-attribute -Wmissing-declarations -Wno-pointer-sign; do
		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
AC_SUBST(WARN_CFLAGS)

AC_ARG_ENABLE(ssconvert,
  [--disable-ssconvert		Do not build ssconvert (cmd line spreadsheet conversion tool)],
  [], [enable_ssconvert=yes])
AM_CONDITIONAL(ENABLE_SSCONVERT, test x"$enable_ssconvert" = "xyes")
AC_ARG_ENABLE(ssindex,
  [--enable-ssindex		Build ssindex (spreadsheet indexer for beagle)],
  [], [enable_ssindex=no])
AM_CONDITIONAL(ENABLE_SSINDEX, test x"$enable_ssindex" = "xyes")

dnl ****************************
dnl GDA Plugin
dnl ****************************
try_gda=true
gda_msg=yes
gnomedb_msg=no
AC_ARG_WITH(gda,
	[--{with,without}-gda      Compile the Gnome Database Access plugin],
	if test "x$withval" != xyes; then
		try_gda=false
		gda_msg="Disabled by request"
	fi
)
if test "$try_gda" = "true"; then
	PKG_CHECK_MODULES(GDA, [libgda-2.0 >= 1.3.0],
		[gda_msg=yes],
		[gda_msg="NO.  libgda problem"])
	if test "$gda_msg" = "yes"; then
		PKG_CHECK_MODULES(GNOMEDB, [libgnomedb-2.0 >= 1.3.0],
			[gnomedb_msg="yes"],
			[gnomedb_msg="NO. libgnomedb problem"])
		if test "$gnomedb_msg" = "yes"; then
			AC_DEFINE(HAVE_LIBGNOMEDB, 1, [ Define if libgnomedb support is compiled in])
		fi
	fi
fi
AM_CONDITIONAL(WITH_GDA, test x"$gda_msg" = "xyes")
AC_SUBST(GDA_CFLAGS)
AC_SUBST(GDA_LIBS)

AM_CONDITIONAL(WITH_GNOMEDB, test x"$gnomedb_msg" = "xyes")
AC_SUBST(GNOMEDB_CFLAGS)
AC_SUBST(GNOMEDB_LIBS)

dnl ****************************
dnl GB Plugin
dnl ****************************
#try_gda=true
#gb_msg=yes
try_gb=no
gb_msg="disabled due to lack of gb maintenance"
AC_ARG_WITH(gb,
	[--{with,without}-gb       Compile the Gnome Basic plugin],
	if test "x$withval" = xyes; then
		#try_gb=true
		gb_msg="We are not joking.  There is no upstream maintainer for GB"
		#gb_msg="Disabled by request"
	fi
)
if test "$try_gb" = "true"; then
	PKG_CHECK_MODULES(GB, [libgb == 1.17],
		[gb_msg=yes],
		[gb_msg="NO.  gb problem"])
fi
AM_CONDITIONAL(WITH_GB, test x"$gb_msg" = "xyes")
AC_SUBST(GB_CFLAGS)
AC_SUBST(GB_LIBS)

dnl ****************************

AC_CHECK_DECL(fdopen, fdopen_works=yes, fdopen_works=no)

if test $fdopen_works = no ; then
	unset ac_cv_have_decl_fdopen
	CFLAGS="$CFLAGS -D_POSIX_SOURCE"
	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

# 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])
	fi
fi

AC_CHECK_FUNC(gettimeofday,
	[AC_DEFINE(HAVE_GETTIMEOFDAY, 1,
		[Define if the gettimeofday function is available]
	)])

dnl src/functions/fn-math.c uses M_PI

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
	CFLAGS="$CFLAGS -D_BSD_SOURCE"
	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
fi

AC_SUBST(GUILE_LIBS)
AC_SUBST(GUILE_INCS)

dnl Comment out the guile block:
ifelse([
dnl check for guile 1.5
try_guile=false
guile_msg="disabled pending some guile developer interest"
enable_guile=false
AC_ARG_WITH(guile,
	[--{with,without}-guile    Compile with Guile support or without it],
	if test "x$withval" = xyes; then
		try_guile=true
	fi
)
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
AM_CONDITIONAL(WITH_GUILE, $enable_guile)
])

dnl **************************************************
dnl * psiconv support
dnl **************************************************

AC_ARG_WITH(psiconv,
	[--{with,without}-psiconv  Compile with Psiconv support or without it])
AC_ARG_VAR(PSICONV_CONFIG, [The psiconv-config executable.])
if test "x$with_psiconv" != xno; then
    AC_CHECK_PROG(PSICONV_CONFIG,psiconv-config,psiconv-config)
    if test x"$PSICONV_CONFIG" = x; then
	psiconv_msg="missing dependencies"
    else
	AC_MSG_CHECKING(for psiconv >= 0.9.3)
	if $PSICONV_CONFIG --version | awk -F. \
		'{exit !($1 > 0 || $2 > 9 || ($2 == 9 && $3 >= 3))}'
	then
	    PSICONV_CFLAGS=`$PSICONV_CONFIG --cflags`
            PSICONV_LIBS=`$PSICONV_CONFIG --libs`
	    psiconv_msg=yes
        else
	    psiconv_msg=no
        fi
	AC_MSG_RESULT($psiconv_msg)
    fi
else
    psiconv_msg=no
fi
AM_CONDITIONAL(WITH_PSICONV, test "x$psiconv_msg" = "xyes")
AC_SUBST(PSICONV_LIBS)
AC_SUBST(PSICONV_CFLAGS)

try_paradox=true
enable_paradox=false
AC_ARG_WITH(paradox,
	[--{with,without}-paradox  Compile with Paradox support or without it],
	if test "x$withval" = xno; then
		try_paradox=false
	fi
)

if $try_paradox; then
	PKG_CHECK_MODULES(PARADOX,
		[pxlib >= 0.4.0],
		[paradox_msg="yes"],
		[paradox_msg="missing dependencies"])
fi

if test "x$paradox_msg" = "xyes"; then
	enable_paradox=true
fi
AM_CONDITIONAL(WITH_PARADOX, $enable_paradox)
AC_SUBST(PARADOX_LIBS)
AC_SUBST(PARADOX_CFLAGS)

AC_ARG_ENABLE(solver, [--disable-solver  Don't compile the solver])
if test "x$enable_solver" = xno; then
	enable_solver=false
else
	enable_solver=true
	AC_DEFINE(ENABLE_SOLVER, 1, [Define if SOLVER is compiled])
fi
AM_CONDITIONAL(ENABLE_SOLVER, $enable_solver)

plugin_list_given=false
PLUGIN_LIST=""
AC_ARG_ENABLE(plugins,
	[--enable-plugins="text html"  Compile only the listed plugins],
	[plugin_list_given=true
	 test "x$enableval" != xno && PLUGIN_LIST=$enableval
])
AM_CONDITIONAL(PLUGIN_LIST_GIVEN, $plugin_list_given)
AC_SUBST(PLUGIN_LIST)


# i18n stuff
ifelse([

  TRANSLATORS:
  Please note that gnumeric has both po/ and po-functions/ directories.
  If you add a new language to ALL_LINGUAS, please make sure that both
  po/ and po-functions/ have .po files that correspond to your language.
  If you only add one to po/, the build will break in po-functions/.
])
AC_SUBST(ALL_LINGUAS, "am az bg ca cs da de el en_CA en_GB es et fi fr ga gl he hr hu it ja ko lv lt ml mr ms nb nl nn pl pt pt_BR ro ru rw sk sr sr@Latn sv te tr uk vi zh_CN zh_TW")

POFILES_FULL=
for lang in $ALL_LINGUAS; do
    POFILES_FULL="$POFILES_FULL \$(top_srcdir)/po/$lang.po"
done
AC_SUBST(POFILES_FULL)

AC_SUBST(GETTEXT_PACKAGE, gnumeric)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",
	[The package name, for gettext])
AM_GLIB_GNU_GETTEXT
dnl
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
	.)  top_srcdir=.. ;;
	[\\/]* | ?:[\\/]* )  # Absolute name.
		top_srcdir="$srcdir" ;;
	*)  top_srcdir="../$srcdir" ;;
esac
sed <$srcdir/po-functions/POTFILES.in -e '/^#/d' -e 's/^[[].*[]] *//' \
	 -e '/^[   ]*$/d' -e "s,^,       $top_srcdir/," | \
        sed -e '$!s/$/ \\/' >po-functions/POTFILES
]
dnl Finally, register for creation of po-functions/Makefile:
AC_CONFIG_COMMANDS(po-functions/Makefile,
  [sed -e "/POTFILES =/r po-functions/POTFILES" \
	po-functions/Makefile.in > po-functions/Makefile])

SAVE_LIBS="$LIBS"
LIBS="$LIBS $GNUMERIC_LIBS"
AC_CHECK_FUNCS(mkfifo)
LIBS="$SAVE_LIBS"
unset SAVE_LIBS

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

dnl Check for some functions
AC_CHECK_FUNCS(memmove mkdtemp uname times sysconf)

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

dnl check for complete locale implementation
AC_CHECK_HEADERS(langinfo.h)

dnl We supply our own lgamma and lgamma_r when missing.
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]
	 )
         LIBS="$LIBS -lm"])
fi
AC_CHECK_FUNCS(lgamma)

AC_C_LONG_DOUBLE
float_msg=double
AC_ARG_WITH(long_double,
	[--{with,without}-long-double		Use long double for floating point],
	[if test "x$withval" = xyes; then
		SAVE_CFLAGS="$CFLAGS"
		SAVE_LIBS="$LIBS"
		CFLAGS="$GNUMERIC_CFLAGS"
		LIBS="$GNUMERIC_LIBS"

		AC_CHECK_HEADERS(sunmath.h)

		AC_CHECK_FUNCS(go_render_numberl,
			       ,
			       AC_MSG_ERROR([libgoffice needs to be compiled with long double support.]))

		AC_CHECK_FUNCS(fabsl sqrtl expl expm1l logl log10l log1pl ceill floorl powl hypotl \
				sinl cosl tanl asinl acosl atanl atan2l fmodl lgammal lgammal_r \
				sinhl coshl tanhl asinhl acoshl atanhl \
				isnanl finitel,
				,
				AC_MSG_ERROR([Long doubles require the $ldfunc function.]))

		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)])

		CFLAGS="$SAVE_CFLAGS"
		LIBS="$SAVE_LIBS"

		float_msg="long double (EXPERIMENTAL)"
		AC_MSG_WARN([Long double support is experimental -- expect problems])
		AC_DEFINE(WITH_LONG_DOUBLE, 1,
			[Define if the long double type is to be used]
		)
	fi]
)

dnl **************************************************
dnl * Check for Perl
dnl **************************************************
want_perl=auto
have_perl=no
perl_reason=""
AC_ARG_WITH(perl, [--{with,without}-perl   Compile the Perl plugin loader],
	[case $withval in
	yes) want_perl=yes;;
	no) want_perl=no;;
	esac])
AC_ARG_VAR(PERL, [The Perl executable.])
if test "x$want_perl" = xno ; then
    perl_reason="disabled by request"
else
    AC_CHECK_PROG(PERL, perl, perl)
    if test "x$PERL" != x; then
	BIG_CHECKING([for perl ExtUtils::Embed module])
	if $PERL -e 'eval { require ExtUtils::Embed }; if ($@) { exit(1); } else { exit(0); }'
	then
	    AC_MSG_RESULT(yes)

	    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])
	    rm -f testperl$ac_exeext testperl.$ac_objext testperl.c testperl.err
	    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"
		cat testperl.err testperl.c >&AS_MESSAGE_LOG_FD
	    fi

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

	else
	    AC_MSG_RESULT(no)
	    perl_reason="missing parts of perl"
	fi
    else
	perl_reason="missing perl"
    fi
fi

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

AM_CONDITIONAL(WITH_PERL, test "x$have_perl" = xyes)
if test "x$have_perl" = xyes ; then
    perl_msg="yes (using $PERL)"
else
    perl_msg="no ($perl_reason)"
fi
AC_SUBST(PERL_CCCDLFLAGS)
AC_SUBST(PERL_LDDLFLAGS)
AC_SUBST(PERL_CC)
AC_SUBST(PERL_LD)
AC_SUBST(PERL_CCOPTS)
AC_SUBST(PERL_LDOPTS)

dnl **************************************************
dnl * Check for Python
dnl **************************************************
python_msg="yes"
AC_ARG_WITH(python, [--{with,without}-python   Compile the Python plugin loader])
AC_ARG_VAR(PYTHON, [The Python executable.])
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
if test "x$with_python" != xno; then
    AC_CHECK_PROGS(PYTHON, python python2 python2.4 python2.3 python2.2 python2.1 python2.0)
    if test "x$PYTHON" = x; then
	python_msg="could not find python"
    fi
else
    python_msg="Disabled by request"
fi

if test "x$python_msg" = xyes; then
    BIG_CHECKING([for python >= 2.0])
    PY_PREFIX=`$PYTHON -c 'import sys ; print sys.prefix'`
    PY_EXEC_PREFIX=`$PYTHON -c 'import sys ; print sys.exec_prefix'`
    PY_MAKEFILE=`$PYTHON -c 'from distutils.sysconfig import get_makefile_filename; print get_makefile_filename()'`
    [PY_VERSION=`$PYTHON -c 'import sys ; print sys.version[0:3]'`
    broken_py_initialize=`$PYTHON -c \
'import sys
if int(sys.version[0]) < 2:
    print "yes"
else:
    print "no"'`]
    if test "x$broken_py_initialize" != "xyes"; then
	AC_MSG_RESULT(yes)
    else
	AC_MSG_RESULT(no)
	python_msg="NO.  Python version is too old."
    fi
fi

if test "x$python_msg" = xyes; then
    BIG_CHECKING(Look for $PY_PREFIX/include/python$PY_VERSION/Python.h)
    if test -f $PY_PREFIX/include/python$PY_VERSION/Python.h; then
	AC_MSG_RESULT(yes)
	PY_LIBS="python$PY_VERSION"
    	PY_LIB_LOC=`$PYTHON -c 'from distutils.sysconfig import get_config_var; print get_config_var("LIBPL")'`
    	PY_LIB_LOC="-L$PY_LIB_LOC"
	PY_CFLAGS="-I$PY_PREFIX/include/python$PY_VERSION"
	[echo 'echo_python_libs:
	@echo $(MODLIBS) $(LIBS)' >confmake.tmp
	PY_EXTRA_LIBS=`make -s -f confmake.tmp -f "$PY_MAKEFILE"`
	rm -f confmake.tmp]
    else
	AC_MSG_RESULT(no)
	python_msg="unable to find Python.h"
    fi
fi

if test "x$python_msg" = xyes; then
    BIG_CHECKING(if we can build a shared library depending on libpython)
    rm -rf testpython
    mkdir testpython
    cd testpython
    cat > testpython.c <<EOF
#include <Python.h>
int testpython (void)
{
    Py_Exit (0);
}
EOF
    if /bin/sh ../libtool --mode=compile ${CC} $PY_CFLAGS -c testpython.c >/dev/null 2>&1 && \
       /bin/sh ../libtool --mode=link ${CC} -o testpython.la -rpath `pwd` -module -avoid-version $PY_LIB_LOC testpython.lo -l$PY_LIBS $PY_EXTRA_LIBS >/dev/null 2>&1 && \
       grep 'dlname.*testpython' testpython.la >/dev/null 2>&1; then
	AC_MSG_RESULT(yes)
    else
	AC_MSG_RESULT(no)
	python_msg="unable to link to python"
    fi
    cd ..
    rm -rf testpython
fi
if test "x$python_msg" = xyes; then
    PKG_CHECK_MODULES(PYGTK, pygtk-2.0 >= 1.99.10,
	    [],
	    [python_msg="NO.  pygtk problem"])
fi

AM_CONDITIONAL(WITH_PYTHON, test "x$python_msg" = xyes)
if test "x$python_msg" = xyes; then
    python_msg="yes (using $PYTHON)"
fi
AC_SUBST(PYGTK_CFLAGS)
AC_SUBST(PY_LIBS)
AC_SUBST(PY_LIB_LOC)
AC_SUBST(PY_CFLAGS)
AC_SUBST(PY_EXTRA_LIBS)

dnl A tricky way to comment out in m4:
ifelse([
dnl **************************************************
dnl * Check for mono
dnl **************************************************
with_mono=no
mono_msg="disabled, still experimental"

AC_ARG_WITH(mono, [--{with,without}-mono     Compile the mono scripting engine])
case $with_mono in
no)	mono_msg="Disabled by request";;
*)
    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
AM_CONDITIONAL(WITH_MONO, test "x$with_mono" = "xyes")
AC_SUBST(MONO_CFLAGS)
AC_SUBST(MONO_LIBS)
])

dnl **************************************************
dnl * Config defaults (Must be after bonobo)
dnl **************************************************
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')

dnl Export to gnumeric-config.h
AC_DEFINE(GNUMERIC_VERSION, "gnumeric_full_version",
	[The version number of this release, possibly suffixed for bonobo])
AC_DEFINE(GNM_VERSION_EPOCH, gnumeric_version_epoch,
	[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])

AC_OUTPUT([
gnumeric.spec
Makefile
icons/Makefile
src/Makefile
src/dialogs/Makefile
src/pixmaps/Makefile
src/widgets/Makefile
src/tools/Makefile
src/tools/solver/Makefile
src/tools/solver/glpk/Makefile
src/tools/solver/glpk/source/Makefile
src/tools/solver/glpk/include/Makefile
src/tools/solver/lp_solve/Makefile
src/cut-n-paste-code/Makefile
doc/Makefile
doc/C/Makefile
doc/C/figures/Makefile
doc/developer/Makefile
plugins/Makefile
plugins/numtheory/Makefile
plugins/fn-complex/Makefile
plugins/fn-database/Makefile
plugins/fn-date/Makefile
plugins/fn-eng/Makefile
plugins/fn-erlang/Makefile
plugins/fn-financial/Makefile
plugins/fn-info/Makefile
plugins/fn-logical/Makefile
plugins/fn-lookup/Makefile
plugins/fn-math/Makefile
plugins/fn-r/Makefile
plugins/fn-stat/Makefile
plugins/fn-string/Makefile
plugins/fn-random/Makefile
plugins/derivatives/Makefile
plugins/sc/Makefile
plugins/sylk/Makefile
plugins/excel/Makefile
plugins/gda/Makefile
plugins/gnome-db/Makefile
plugins/lotus-123/Makefile
plugins/oleo/Makefile
plugins/python-loader/Makefile
plugins/gnome-glossary/Makefile
plugins/py-func/Makefile
plugins/corba/Makefile
plugins/perl-func/Makefile
plugins/perl-loader/Makefile
plugins/xbase/Makefile
plugins/html/Makefile
plugins/dif/Makefile
plugins/qpro/Makefile
plugins/plan-perfect/Makefile
plugins/applix/Makefile
plugins/openoffice/Makefile
plugins/psiconv/Makefile
plugins/mps/Makefile
plugins/sample_datasource/Makefile
plugins/paradox/Makefile
plugins/uihello/Makefile
po/Makefile.in
po-functions/Makefile.in
schemas/Makefile
templates/Makefile
templates/english/Makefile
templates/autoformat/Makefile
tools/Makefile
])

echo "

Configuration:

	Source code location:	${srcdir}
	Compiler:		${CC}
	Compiler flags:		${CFLAGS}
	Floating point type:	${float_msg}

	UI:			${ui_msg}

	Perl Support:		${perl_msg}
	Python Support:		${python_msg}

	GDA support:		${gda_msg}
	GNOME-DB support:	${gnomedb_msg}
	Psiconv support:        ${psiconv_msg}
"
#	Mono support:		${mono_msg}
#	Guile Support:		${guile_msg}