File: configure.in

package info (click to toggle)
libgda3 3.0.2-5
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 24,328 kB
  • ctags: 15,602
  • sloc: ansic: 143,317; xml: 29,226; sh: 8,875; makefile: 1,385; yacc: 509; lex: 396; sql: 118; cpp: 73
file content (1136 lines) | stat: -rw-r--r-- 29,224 bytes parent folder | download
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
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
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
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
m4_define(major, 3)
m4_define(minor, 0)
m4_define(micro, 2)

AC_INIT(GNU Data Access, major.minor.micro, gnome-db-list@gnome.org, libgda)
AC_PREREQ(2.59)
AC_CONFIG_SRCDIR(libgda/libgda.h)
AM_INIT_AUTOMAKE(1.8 -Wall no-define dist-bzip2)

AC_SUBST(GDA_VERSION, major.minor.micro)

# ABI version:
# Careful. Changing these will break ABI, because it is used for the library name and header install path:
# This allows us to do a 3.2 version that is ABI-compatible with 3.0, but with API additions.
AC_SUBST(GDA_ABI_MAJOR_VERSION, 3)
AC_SUBST(GDA_ABI_MINOR_VERSION, 0)
#AC_SUBST(GDA_MICRO_VERSION, micro)


m4_undefine([major])
m4_undefine([minor])
m4_undefine([micro])

dnl required versions of other tools.
m4_define([req_ver_glib],	[2.8.0])

#
# Making releases:
# - If interfaces have been changed or added, set GDA_CURRENT += 1 and GDA_AGE += 1, set GDA_REVISION to 0.
# - If binary compatibility has been broken (e.g. removed or changed interfaces), set GDA_CURRENT += 1, GDA_REVISION and GDA_AGE to 0
# - If interfaces is the same as the previous version, set GDA_REVISION += 1
#
GDA_CURRENT=3
GDA_REVISION=0
GDA_AGE=0

AC_SUBST(GDA_CURRENT)
AC_SUBST(GDA_REVISION)
AC_SUBST(GDA_AGE)

AC_PROG_INTLTOOL([0.30])

AC_DEFINE_UNQUOTED(BONOBO_EXPLICIT_TRANSLATION_DOMAIN, "libgda-3.0")

dnl ******************************
dnl Checks for programs
dnl ******************************
AC_ISC_POSIX
AC_PROG_CC
AC_PROG_CXX
AM_PROG_CC_C_O
AC_STDC_HEADERS
AC_ARG_PROGRAM
AM_PROG_LIBTOOL
AM_PROG_LEX
AC_PROG_YACC
AC_PROG_MAKE_SET

dnl ******************************
dnl glib-genmarshal
dnl ******************************
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)

dnl ******************************
dnl Translations
dnl ******************************
GETTEXT_PACKAGE=libgda-3.0
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE")
ALL_LINGUAS="ar az ca cs da de dz el en_CA en_GB es eu fa fi fr ga gl hr hu it ja ko lt ml ms nb ne nl pl pt pt_BR ru rw sk sl sq sr sr@Latn sv tr uk vi zh_CN zh_HK zh_TW"
AM_GLIB_GNU_GETTEXT

dnl ******************************
dnl Checks for libraries
dnl ******************************

PKG_CHECK_MODULES(LIBGDA, [
	glib-2.0	>= req_ver_glib
	gobject-2.0	>= req_ver_glib
	gthread-2.0	>= req_ver_glib
	gmodule-2.0	>= req_ver_glib
	libxml-2.0
])
AC_SUBST(LIBGDA_CFLAGS)
AC_SUBST(LIBGDA_LIBS)

dnl ******************************
dnl Check for Win32
dnl ******************************

AC_MSG_CHECKING([for some Win32 platform])
case "$host" in
*-cygwin*)
    platform_win32=yes
    NO_UNDEFINED='-no-undefined'
    SOPREFIX='cyg'
    ;;
*-mingw*)
    platform_win32=yes
    NO_UNDEFINED='-no-undefined'
    SOPREFIX='lib'
    ;;
*)
    platform_win32=no
    NO_UNDEFINED=''
    SOPREFIX='lib'
    ;;
esac
AC_MSG_RESULT([$platform_win32])
AM_CONDITIONAL(PLATFORM_WIN32, [test $platform_win32 = yes])
AC_SUBST(NO_UNDEFINED)
AC_SUBST(SOPREFIX)

dnl ******************************
dnl Checking for FAM or gamin
dnl ******************************
FAM_LIBS=
FAM_CFLAGS=
FAM_MISSING_WARNING="Libgda depends on FAM to provide notification when configuration files are changed, without FAM support any application using Libgda will have to be restarted when configuration files are changed to take into account those changes"
PKG_CHECK_MODULES(GAMIN, gamin >= 0.1.8, have_fam=yes, have_fam=no)
if test x"$have_fam" = "xyes"
then
        FAM_CFLAGS="$GAMIN_CFLAGS"
        FAM_LIBS="$GAMIN_LIBS"
	AC_DEFINE(HAVE_FAM, [], [Define if we have FAM])
else
        AC_CHECK_LIB(fam, FAMOpen,
          [AC_CHECK_HEADERS(fam.h,
            [AC_DEFINE(HAVE_FAM, [], [Define if we have FAM])
             FAM_LIBS="-lfam"],
            AC_MSG_WARN(*** FAM support will not be built (header files not found) $FAM_MISSING_WARNING ***))],
          AC_MSG_WARN(*** FAM support will not be built (FAM library not found) $FAM_MISSING_WARNING ***))
fi
AC_SUBST(FAM_LIBS)
AC_SUBST(FAM_CFLAGS)

dnl ******************************
dnl gtk-doc
dnl ******************************

GTK_DOC_CHECK([1.0])

dnl ******************************
dnl Checks for providers
dnl ******************************

dnl Test for lib64 architectures
dnl FIXME: should really check target
case $host_cpu in
x86_64* | sparc64*) lib="lib64";;
*) lib="lib";;
esac

dnl this is the shared link library extension, which varies by platform
case $host_os in
	cygwin*) libext=".dll.a" ;;
	*) libext=".so" ;;
esac

dnl Test for Berkeley DB
try_bdb=true
AC_ARG_WITH(bdb,
[  --with-bdb=<directory>	use bdb library in <directory>],[
if test $withval = no
then
	try_bdb=false
elif test $withval = yes
then
	dir="/usr"
else
	dir=$withval
fi
])
bdbdir=""
if test $try_bdb = true
then
	AC_CHECK_HEADER(db.h, bdb_ok=yes, bdb_ok=no, [])
	if test $bdb_ok = yes ; then
		bdbdir=yes
		BDB_LIBS="-ldb"
	else
		AC_MSG_CHECKING(for Berkeley DB files)
		for d in $dir /usr /usr/local
		do
			if test -f $d/$lib/libdb$libext -a -f $d/include/db.h
			then
				AC_MSG_RESULT(found Berkeley DB in $d)
				bdblib="-ldb"
				bdbdir=$d
				break
			fi
			dnl FIXME: check for db1 (non-sleepycat implementation)
		done
		if test x$bdbdir = x
		then
			AC_MSG_WARN(Berkeley DB backend not used)
		else
			AC_DEFINE(HAVE_BDB, 1, [Have Berkeley DB])
			BDB_CFLAGS="-I${bdbdir}/include"
			BDB_LIBS="-L${bdbdir}/lib ${bdblib}"
		fi
	fi
fi

AM_CONDITIONAL(BDB, test x$bdbdir != x)

dnl Test for ODBC
try_odbc=true
AC_ARG_WITH(odbc,
[  --with-odbc=<directory>	use ODBC libraries in <directory>],[
if test $withval = no
then
	try_odbc=false
elif test $withval = yes
then
	dir="/usr/local"
else
	dir=$withval
fi
])
odbcdir=""
if test $try_odbc = true
then
	AC_MSG_CHECKING(for ODBC files)
	for d in $dir /usr /usr/local
	do
		if test -f $d/$lib/libodbc$libext -a -f $d/include/sql.h
		then
			AC_MSG_RESULT(found ODBC in $d)
			odbclib="-lodbc"
			odbcdir=$d
			break
		fi
		if test -f $d/$lib/libiodbc$libext -a -f $d/include/sql.h
		then
			AC_MSG_RESULT(found iODBC in $d)
			odbclib="-liodbc"
			odbcdir=$d
			break
		fi
		if test -f $d/$lib/w32api/libodbc32.a -a -f $d/include/w32api/sql.h
		then
			AC_MSG_RESULT(found ODBC32 in $d)
			odbclib="-lodbc32"
			odbcdir=$d
			break
		fi
	done
	if test x$odbcdir = x
	then
		AC_MSG_WARN(ODBC backend not used)
	else
		AC_DEFINE(HAVE_ODBC, 1, [Have ODBC])
		ODBC_CFLAGS="-I${odbcdir}/include"
		ODBC_LIBS="-L${odbcdir}/lib ${odbclib}"
	fi
fi

AM_CONDITIONAL(ODBC, test x$odbcdir != x)

dnl Test for MySQL
try_mysql=true
AC_ARG_WITH(mysql,
[  --with-mysql=<directory>	use mysql backend in <directory>],[
if test $withval = no
then
	try_mysql=false
elif test $withval = yes
then
	dir="/usr/local"
else
	dir=$withval
fi
])
mysqldir=""
if test $try_mysql = true
then
	AC_PATH_PROG(MYSQL_CONFIG, mysql_config)

	if test x$MYSQL_CONFIG = x; then
		AC_MSG_CHECKING(for MySQL files)
		for d in $dir /usr /usr/local /usr/local/mysql /opt/mysql /opt/packages/mysql
		do
			if test -f $d/include/mysql/mysql.h
			then
				mysqldir_suffix=/mysql
			else
				mysqldir_suffix=
			fi
			if test -f $d/$lib/mysql/libmysqlclient.a -o -f $d/$lib/mysql/libmysqlclient$libext
			then
				AC_MSG_RESULT(found mysql in $d)
				mysqldir=$d
				mysqllibdir_suffix=/mysql
				break
			fi
			if test -f $d/$lib/libmysqlclient.a -o -f $d/$lib/libmysqlclient$libext
			then
				AC_MSG_RESULT(found mysql in $d)
				mysqldir=$d
				mysqllibdir_suffix=
				break
			fi
		done
		if test x$mysqldir = x
		then
			AC_MSG_WARN(MySQL backend not used)
		else
			AC_DEFINE(HAVE_MYSQL, 1, [Have MySQL])
			MYSQL_CFLAGS="-I${mysqldir}/include${mysqldir_suffix}"
			MYSQL_LIBS="-L${mysqldir}/lib${mysqllibdir_suffix} -lmysqlclient"
		fi
	else
		mysqldir=yes
		AC_DEFINE(HAVE_MYSQL, 1, [Have MySQL])
		MYSQL_CFLAGS=`$MYSQL_CONFIG --cflags`
		MYSQL_LIBS=`$MYSQL_CONFIG --libs`
	fi
fi

AM_CONDITIONAL(MYSQL, test x$mysqldir != x)

dnl Test for mSQL
try_msql=true
AC_ARG_WITH(msql,
[  --with-mSQL=<directory>	use mSQL backend in <directory>],[
if test $withval = no
then
	try_msql=false
elif test $withval = yes
then
	dir="/usr/local"
else
	dir=$withval
fi
])
msqldir=""
if test $try_msql = true
then
	AC_MSG_CHECKING(for mSQL files)
	for d in $dir /usr /usr/local /usr/local/msql /opt/msql /opt/packages/msql
	do
		if test -f $d/include/msql/msql.h
		then
			msqldir_suffix=/msql
		else
			msqldir_suffix=
		fi
		if test -f $d/$lib/msql/libmsql.a -o -f $d/$lib/msql/libmsql$libext
		then
			AC_MSG_RESULT(found mSQL in $d)
			msqldir=$d
			msqllibdir_suffix=/msql
			break
		fi
		if test -f $d/$lib/libmsql.a -o -f $d/$lib/libmsql$libext
		then
			AC_MSG_RESULT(found mSQL in $d)
			msqldir=$d
			msqllibdir_suffix=
			break
		fi
	done
	if test x$msqldir = x
	then
		AC_MSG_WARN(mSQL backend not used)
	else
		AC_DEFINE(HAVE_MSQL, 1, [Have mSQL])
		MSQL_CFLAGS="-I${msqldir}/include${msqldir_suffix}"
		MSQL_LIBS="-L${msqldir}/lib${msqllibdir_suffix} -lmsql"
                AC_MSG_CHECKING(for mSQL 3.x API)
                AC_TRY_RUN([
                  #include "${msqldir}/include${msqldir_suffix}/msql.h"
                  int main() {
                    int rc = INT64_TYPE;
                    return (rc>0) ? 0 : -1;
                  }
                ], AC_DEFINE(HAVE_MSQL3, 1, [Have mSQL 3.x API]) AC_MSG_RESULT(found),
                AC_MSG_RESULT(not found))
	fi
fi

AM_CONDITIONAL(MSQL, test x$msqldir != x)


dnl Test for PostgreSQL
try_postgres=true
AC_ARG_WITH(postgres,
[  --with-postgres=<directory>	use postgres backend in <directory>],[
if test $withval = no
then
	try_postgres=false
elif test $withval = yes
then
	dir="/usr/local"
else
	dir=$withval
fi
])
postgresdir=""
if test $try_postgres = true
then
	AC_MSG_CHECKING(for Postgres files)
	for d in $dir /usr /usr/local/postgres /opt/postgres /opt/packages/postgres /disk/postgres /usr/local/pgsql
	do
		if test -f $d/$lib/libpq.a -o -f $d/$lib/libpq$libext
		then
			AC_MSG_RESULT(found Postgres in $d)
			postgresdir=$d
			break
		fi
	done
	if test x$postgresdir = x
	then
		AC_MSG_WARN(Postgres backend not used)
	else
		if test -f ${postgresdir}/include/libpq-fe.h
		then
			POSTGRES_CFLAGS=-I${postgresdir}/include
		elif test -f ${postgresdir}/include/pgsql/libpq-fe.h
		then
			POSTGRES_CFLAGS=-I${postgresdir}/include/pgsql
		elif test -f ${postgresdir}/include/postgresql/libpq-fe.h
		then
			POSTGRES_CFLAGS=-I${postgresdir}/include/postgresql
                elif test -f ${postgresdir}/include/postgresql/8.0/libpq-fe.h
		then
			POSTGRES_CFLAGS=-I${postgresdir}/include/8.0/postgresql
                elif test -f ${postgresdir}/include/postgresql/7.4/libpq-fe.h
		then
			POSTGRES_CFLAGS=-I${postgresdir}/include/7.4/postgresql
		else
			AC_MSG_WARN(Postgres include files not found, backend not used)
			postgresdir=""
		fi
		POSTGRES_LIBS="-L${postgresdir}/lib -lpq"
		AC_DEFINE(HAVE_POSTGRES, 1, [Have PostgreSQL])
	fi
fi

AM_CONDITIONAL(POSTGRES, test x$postgresdir != x)

dnl Test for freetds provider
dnl
try_freetds=true
AC_ARG_WITH(tds,
[  --with-tds=<directory>	use freetds library in <directory>],[
if test $withval = no
then
	try_freetds=false
elif test $withval = yes
then
	dir="/usr/local/freetds"
else
	dir=$withval
fi
])
freetdsdir=""
freetds_incdir=""
freetdsvercheck=""
if test $try_freetds = true
then
	AC_MSG_CHECKING(for freetds files)
	for d in $dir /usr/local/freetds /usr /opt/freetds /opt/packages/freetds /opt/freetds-0.50
	do
		if test -f "$d/include/tds.h" -a -e "$d/$lib/libtds$libext" -a -f "$d/include/tdsver.h"
		then
			AC_MSG_RESULT(found freetds in $d)
			freetdsdir="$d"
			freetds_incdir="$d/include"
			break
		elif test -f "$d/include/freetds/tds.h" -a -e "$d/$lib/libtds$libext" -a -f "$d/include/freetds/tdsver.h"
		then
			AC_MSG_RESULT(found freetds in $d and includes in $d/include/freetds)
			freetdsdir="$d"
			freetds_incdir="$d/include/freetds"
			break
		fi
	done
	if test "x$freetdsdir" = "x"
	then
		AC_MSG_WARN(tds backend not used)
	else
		AC_MSG_CHECKING(for freetds version)
		freetdsvercheck="`grep \"^#define \(VERSION_NO \|TDS_VERSION_NO \)\" $freetds_incdir/tdsver.h|sed 's|^.*".*v\(.*\)"|\1|'`"
		if test "x$freetdsvercheck" = "x"
		then
			AC_MSG_WARN(freetds version check failed - backend not used)
			freetdsdir=""
			freetds_incdir=""
		else
			AC_MSG_RESULT($freetdsvercheck)
			FREETDS_CFLAGS="-I${freetds_incdir}"
			FREETDS_LIBS="-L${freetdsdir}/lib -ltds"
			AC_DEFINE(HAVE_FREETDS, 1, [Have freetds])

			freetds_version_major="`echo $freetdsvercheck|sed 's:^\([[^.]]*\).*:\1:'`"
			freetds_version_minor="`echo $freetdsvercheck|sed 's:^[[^.]]*\.\([[^.]]*\).*:\1:'`"

			AC_DEFINE_UNQUOTED(FREETDS_VERSION_MAJOR, [$freetds_version_major])
			AC_DEFINE_UNQUOTED(FREETDS_VERSION_MINOR, [$freetds_version_minor])
		fi	
	fi
fi

AM_CONDITIONAL(FREETDS, test x$freetdsdir != x)

dnl Test for IBM DB2
try_ibmdb2=true
AC_ARG_WITH(ibmdb2,
[  --with-ibmdb2=<directory>	use IBM DB2 backend in <directory>],[
if test $withval = no
then
	try_ibmdb2=false
elif test $withval = yes
then
	if test -z "$DB2DIR"
	then
		dir="/usr/IBMdb2/V7.1"
	else
		dir="$DB2DIR"
	fi
else
	dir=$withval
fi
])
if test $try_ibmdb2 = true
then
	AC_MSG_CHECKING(for IBM DB2 files)
	if test -f "$dir/include/sqlcli1.h"
	then
		if test -e "$dir/lib/libdb2.so"
		then
			ibmdb2dir="$dir"
			ibmdb2libdir="lib"
			break
		fi
		if test -e "$dir/lib32/libdb2.so"
		then
			ibmdb2dir="$dir"
                        ibmdb2libdir="lib32"
                        break
		fi
	else
		for d in /usr/IBMdb2 /usr/local/IBMdb2 /opt/IBMdb2 /opt/packages/IBMdb2 /opt/ibm/db2
		do
			for v in V5.0 V.6.1 V7.1 V9.1
			do
				if test -f "$d/$v/include/sqlcli1.h" -a -e "$d/$v/lib/libdb2.so"
				then
					ibmdb2dir="$d/$v"
					ibmdb2libdir="lib"
					break
				fi
				if test -f "$d/$v/include/sqlcli1.h" -a -e "$d/$v/lib32/libdb2.so"
                                then
                                        ibmdb2dir="$d/$v"
                                        ibmdb2libdir="lib32"
                                        break
                                fi
			done
		done
	fi
	if test x$ibmdb2dir = x
	then
		AC_MSG_WARN(IBM DB2 backend not used)
	else
		AC_MSG_RESULT(found IBM DB2 in $ibmdb2dir)
		AC_DEFINE(HAVE_IBMDB2, 1, [Have IBM DB2])
		IBMDB2_CFLAGS="-DIBMDB2_DIR=\\\"${ibmdb2dir}\\\" -I${ibmdb2dir}/include"
		IBMDB2_LIBS="-L${ibmdb2dir}/${ibmdb2libdir} -Wl,-rpath,${ibmdb2dir}/${ibmdb2libdir} -ldb2"
	fi
fi

AM_CONDITIONAL(IBMDB2, test x$ibmdb2dir != x)

dnl Test for Sybase
try_sybase=true
dir=""
AC_ARG_WITH(sybase,
[  --with-sybase=<directory>	use Sybase backend in <directory>],[
AC_MSG_CHECKING(for Sybase files)
if test $withval = no
then
	try_sybase=false
elif test $withval = yes
then
	dir="/opt2/sybase"
else
	dir=$withval
fi
])
sybasedir=""
if test $try_sybase = true
then
	AC_MSG_CHECKING(for Sybase files)
	for d in $dir /usr/local/sybase /opt/sybase /opt/packages/sybase
	do
		if test -f "$d/include/ctpublic.h"
		then
			AC_MSG_RESULT(found Sybase in $d)
			sybasedir="$d"
			break
		fi
		for v in 11.9.2 12.5 11.0.3.3
		do
			if test -f "$d-$v/include/ctpublic.h"
			then
				AC_MSG_RESULT(found Sybase in $d-$v)
				sybasedir="$d-$v"
				break
			elif test -f "$d-$v/OCS/include/ctpublic.h"
			then
				AC_MSG_RESULT(found Sybase in $d-$v)
				sybasedir="$d-$v/OCS"
				break
			fi
		done
	done
	if test x$sybasedir = x
	then
		AC_MSG_WARN(Sybase backend not used)
	else
		SYBASE_DIR=${sybasedir}
		SYBASE_CFLAGS="-I${sybasedir}/include"
		SYBASE_LIBS="-lnsl -ldl -lm"
		AC_MSG_CHECKING(for Sybase host system type)
		AC_MSG_RESULT($host)
		case "$host" in
		*linux*) sybase_ctlibs="-L${sybasedir}/lib -lct -lcs -lsybtcl -lcomn -lintl"
			sybase_blklibs="-L${sybasedir}/lib -lblk ${sybase_ctlibs}"
			SYBASE_LIBS="${SYBASE_LIBS} ${sybase_blklibs}"
			AC_CHECK_LIB(ct,tdsdump_on,[
			AC_MSG_WARN(linking against freetds libct)
			AC_DEFINE(HAVE_SYBASE, 1, [Have Sybase])
			], AC_DEFINE(HAVE_SYBASE, 1, [Have Sybase]))
			;;
		*) AC_MSG_WARN(this host type is unsupported; sybase backend not used)
			sybasedir=""
			;;
		esac
	fi
fi

AM_CONDITIONAL(SYBASE, test x$sybasedir != x)

dnl Link gda-sybase-srv against debugable libs
AC_ARG_ENABLE(sybase-debug,
    [  --enable-sybase-debug=[no/min/max]      no=none, min=debug msgs, max=min and link against sybase devlibs (which are static!).],,enable_sybase_debug=no)
if test "x$sybasedir" != "x"
then
       AC_MSG_CHECKING(for Sybase debugging level)
       if test "x$enable_sybase_debug" = "xmax"
       then
               AC_DEFINE(SYBASE_DEBUG, 1, [Enable Sybase debugging level])
               if test -f $sybasedir/devlib/libct.a
               then
                       AC_MSG_RESULT(max)
                       AC_MSG_WARN(erase passwords in bug-buddy debug output before sending bugreports)
                       SYBASE_LIBS=${sybasedir}/devlib
               else
                       AC_MSG_RESULT(min)
                       AC_MSG_WARN(no debug libraries found, using --enable-sybase-debug=min)
                       enable_sybase_debug=min
               fi
       else
               AC_MSG_RESULT($enable_sybase_debug)
               if test "x$enable_sybase_debug" != "x"
               then
                       if test "x$enable_sybase_debug" != "xno"
                       then
                               AC_DEFINE(SYBASE_DEBUG)
                       fi
               fi
       fi
else
       if test "x$enable_sybase_debug" != "xno"
       then
               AC_MSG_WARN(you applied sybase debugging options, but sybase has not been found or is unsupported, disabling debug options)
       fi
       enable_sybase_debug=no
fi

dnl test for ORACLE
try_oracle=true
AC_ARG_WITH(oracle,
[  --with-oracle=<directory>	use ORACLE backend in <directoty>],[
if test $withval = no
then
	try_oracle=false
elif test $withval = yes
then
	dir="/usr/local"
else
	dir=$withval
fi
])
if test $try_oracle = true
then
	AC_MSG_CHECKING(for ORACLE installation)
	for d in $dir $ORACLE_HOME /opt/oracle /usr
	do
		if test -f $d/$lib/libclntsh.so
		then
			AC_MSG_RESULT(found ORACLE in $d)
			oracledir=$d
			break
		fi
	done
	if test x$oracledir = x
	then
		AC_MSG_WARN(ORACLE backend not used)
	else
		AC_DEFINE(HAVE_ORACLE, 1, [Have ORACLE])
		ORACLE_CFLAGS=" -I$oracledir/include/oracle/client -I$oracledir/rdbms/demo -I${ORACLE_HOME}/rdbms/public -I${ORACLE_HOME}/plsql/public -I$oracledir/network/public"
		ORACLE_LIBS="-L$oracledir/lib -lm -ldl -lclntsh"
	fi
fi

AM_CONDITIONAL(ORACLE, test x$oracledir != x)

dnl test for FireBird
try_firebird=true
AC_ARG_WITH(firebird,
[  --with-firebird=<directory>	use FireBird backend in <directoty>],[
if test $withval = no
then
	try_firebird=false
elif test $withval = yes
then
	dir="/usr/local"
else
	dir=$withval
fi
])
if test $try_firebird = true
then
	AC_MSG_CHECKING(for FireBird installation)
	for d in $dir /usr/local/firebird /usr/local /usr /opt/firebird
	do
		if test -f $d/include/ibase.h
		then
			AC_MSG_RESULT(found FireBird in $d)
			firebirddir=$d
			break
		fi
	done
	if test x$firebirddir = x
	then
		AC_MSG_WARN(FireBird backend not used)
	else
		AC_DEFINE(HAVE_FIREBIRD, 1, [Have FireBird])
		FIREBIRD_CFLAGS="-I${firebirddir}/include"
		FIREBIRD_LIBS="-L${firebirddir}/lib -lgds -ldl -lcrypt"
	fi
fi

AM_CONDITIONAL(FIREBIRD, test x$firebirddir != x)

dnl Test for Xbase
try_xbase=true
AC_ARG_WITH(xbase,
[  --with-xbase=<directory>     use Xbase files in <directory>],[
if test $withval = no
then
	try_xbase=false
elif test $withval = yes
then
	dir="/usr/local"
else
	dir=$withval
fi
])
if test $try_xbase = true
then
	AC_MSG_CHECKING(for Xbase files)
	xbasedir=""
	for d in $dir /usr /usr/local /opt/xbase
	do
		if test -f $d/include/xbase/xbase.h
		then
			AC_MSG_RESULT(found Xbase in $d)
			xbasedir=$d
			break
		fi
	done
	if test x$xbasedir = x
	then
		AC_MSG_WARN(Xbase backend not used)
	else
		XBASE_CFLAGS=-I${xbasedir}/include
		XBASE_LIBS="-L${xbasedir}/lib -lxbase"
		AC_DEFINE(HAVE_XBASE, 1, [Have Xbase])
	fi
fi

AM_CONDITIONAL(XBASE, test x$xbasedir != x)

dnl SQLite provider is included in the sources now,
dnl so it's always built.

dnl Test for MDB Tools (for MS Access files)
try_mdb=true
AC_ARG_WITH(mdb,
[  --with-mdb=<directory>     use MDB tools library in <directory>],[
if test $withval = no
then
	try_mdb=false
elif test $withval = yes
then
	dir="/usr/local"
else
	dir=$withval
fi
])
if test $try_mdb = true
then
	AC_MSG_CHECKING(for MDB Tools files)
	mdbdir=""
	for d in $dir /usr /usr/local /opt/gnome
	do
		if test -f $d/include/mdbtools.h -a -f $d/$lib/libmdbsql$libext -o -f $d/include/mdbtools.h -a -f $d/$lib/libmdbsql.a
		then
			AC_MSG_RESULT(found MDB Tools in $d)
			mdbdir=$d
			break
		fi
	done
	if test x$mdbdir = x
	then
		AC_MSG_WARN(MDB backend not used)
	else
		MDB_CFLAGS=-I${mdbdir}/include
		MDB_LIBS="-L${mdbdir}/lib -lmdb -lmdbsql"
		AC_DEFINE(HAVE_MDB, 1, [Have MDB])

		save_CFLAGS="$CFLAGS"
		CFLAGS="$CFLAGS $LIBGDA_CFLAGS"

		AC_MSG_CHECKING([whether mdb_open takes one or two arguments])

		AC_COMPILE_IFELSE([[
#include <mdbtools.h>
int main() {
    const char *filename;
	mdb_open(filename, MDB_WRITABLE);
	return 0;
}
]], mdb_open_args=two, mdb_open_args=one)

		AC_MSG_RESULT($mdb_open_args)
		if test "$mdb_open_args" = "two"; then
			AC_DEFINE(MDB_WITH_WRITE_SUPPORT, 1, [define if mdb_open accepts MDB_WRITABLE])
		fi

		AC_MSG_CHECKING([whether mdb_sql_bind_column takes three or four arguments])

		AC_COMPILE_IFELSE([[
#include <mdbsql.h>
int main() {
	extern MdbSQL *mdb_SQL;
	int c;
	char *bound_data[256];
	int len;
	mdb_sql_bind_column(mdb_SQL, c, bound_data[c], &len);
	return 0;
}
]], mdb_sql_bind_column_args=four, mdb_sql_bind_column_args=three)

		AC_MSG_RESULT($mdb_sql_bind_column_args)
		if test "$mdb_sql_bind_column_args" = "four"; then
			AC_DEFINE(MDB_SQL_BIND_COLUMN_FOUR_ARGS, 1, [define if mdb_sql_bind_column accepts four args])
		fi

		CFLAGS="$save_CFLAGS"
	fi
fi

AM_CONDITIONAL(MDB, test x$mdbdir != x)

dnl Test for LDAP
try_ldap=true
AC_ARG_WITH(ldap,
[  --with-ldap=<directory>     use LDAP library in <directory>],[
if test $withval = no
then
	try_ldap=false
elif test $withval = yes
then
	dir="/usr/local"
else
	dir=$withval
fi
])
if test $try_ldap = true
then
	AC_MSG_CHECKING(for LDAP files)
	ldapdir=""
	for d in $dir /usr /usr/local /opt/openldap
	do
		if test -f $d/include/ldap.h -a -f $d/include/lber.h
		then
			AC_MSG_RESULT(found LDAP in $d)
			ldapdir=$d
			break
		fi
	done
	if test x$ldapdir = x
	then
		AC_MSG_WARN(LDAP backend not used)
	else
		LDAP_CFLAGS="-I${ldapdir}/include"
		LDAP_LIBS="-L${ldapdir}/lib -lldap -llber"
		AC_DEFINE(HAVE_LDAP, 1, [Have LDAP])
	fi
fi

AM_CONDITIONAL(LDAP, test x$ldapdir != x)

dnl test for system-installed SQLite
dnl note: while SQLite does not have extra PRAGMA directives,
dnl embedded SQLite version will continue to be used
SQLITE_MODULES="sqlite3 >= 3.3"
PKG_CHECK_MODULES(SQLITE, $SQLITE_MODULES, have_sqlite=yes, have_sqlite=no)
if test x"$have_sqlite" = "xyes"
then
        realvers=`sqlite3 -version` 
        microvers=`sqlite3 -version | cut -d '.' -f 3`
        AC_MSG_CHECKING(for sqlite version)
        if test $microvers -lt 100
        then
                AC_MSG_RESULT(Version $realvers of SQLite does not implement required pragmas, using embedded SQLite)
                have_sqlite=no
        else
                AC_MSG_RESULT(Version $realvers)
                SQLITE_CFLAGS="$SQLITE_CFLAGS -DHAVE_SQLITE"
                AC_SUBST(SQLITE_CFLAGS)
                AC_SUBST(SQLITE_LIBS)
                SQLITE_VERS=$realvers
                AC_SUBST(SQLITE_VERS)
        fi
fi
AM_CONDITIONAL(HAVE_SQLITE, test x"$have_sqlite" = "xyes")


dnl **************************
dnl Check for readline/history
dnl **************************
AC_CHECK_LIB(readline,readline, READLINE_LIB='-lreadline -lcurses', , -lcurses)
AM_CONDITIONAL(READLINE_LIB, test ! "x$READLINE_LIB" = "x")
AC_SUBST(READLINE_LIB)

AC_CHECK_LIB(history,add_history,HISTORY_LIB=-lhistory)
AM_CONDITIONAL(HISTORY_LIB, test ! "x$HISTORY_LIB" = "x")
AC_SUBST(HISTORY_LIB)

AC_CHECK_HEADERS([readline/readline.h readline/history.h],,
		CONFIG_TOOL_HEADERS="wrong" && \
		echo Not building gda-config-tool)
AM_CONDITIONAL(BUILD_CONFIG_TOOL, 
		(test ! "x$CONFIG_TOOL_HEADERS" = "xwrong" -a \
		      ! "x$READLINE_LIB" = "x" -a \
		      ! "x$HISTORY_LIB" = "x" ))
AC_SUBST(BUILD_CONFIG_TOOL)


AC_SUBST(LIB_PREFIX)
AC_SUBST(LIB_SONAME)
AC_SUBST(LIB_SUFFIX)


dnl
dnl where to install DTD files
dnl
LIBGDA_DTDDIR=${datadir}/libgda-3.0/dtd
AC_SUBST(LIBGDA_DTDDIR)


dnl ******************************
dnl Variables
dnl ******************************
AC_SUBST(BDB_LIBS)
AC_SUBST(BDB_CFLAGS)
AC_SUBST(ODBC_LIBS)
AC_SUBST(ODBC_CFLAGS)
AC_SUBST(MYSQL_LIBS)
AC_SUBST(MYSQL_CFLAGS)
AC_SUBST(MSQL_LIBS)
AC_SUBST(HAVE_MSQL3)
AC_SUBST(MSQL_CFLAGS)
AC_SUBST(POSTGRES_LIBS)
AC_SUBST(POSTGRES_CFLAGS)
AC_SUBST(PRIMEBASE_LIBS)
AC_SUBST(PRIMEBASE_CFLAGS)
AC_SUBST(FREETDS_LIBS)
AC_SUBST(FREETDS_CFLAGS)
AC_SUBST(IBMDB2_LIBS)
AC_SUBST(IBMDB2_CFLAGS)
AC_SUBST(SYBASE_DIR)
AC_SUBST(SYBASE_LIBS)
AC_SUBST(SYBASE_CFLAGS)
AC_SUBST(LDAP_LIBS)
AC_SUBST(LDAP_CFLAGS)
AC_SUBST(ORACLE_LIBS)
AC_SUBST(ORACLE_CFLAGS)
AC_SUBST(FIREBIRD_LIBS)
AC_SUBST(FIREBIRD_CFLAGS)
AC_SUBST(MDB_LIBS)
AC_SUBST(MDB_CFLAGS)
AC_SUBST(CAMEL_LIBS)
AC_SUBST(CAMEL_CFLAGS)
AC_SUBST(XBASE_LIBS)
AC_SUBST(XBASE_CFLAGS)

dnl
dnl Check if the "check" testing unit is found (http://check.sourceforge.net/)
dnl
Check_MODULES="check"
PKG_CHECK_MODULES(CHECK, $Check_MODULES, have_check=yes, have_check=no)
AM_CONDITIONAL(HAVE_CHECK, test x"$have_check" = "xyes")
if test x"$have_check" = "xyes"
then
	CHECK_CFLAGS="$CHECK_CFLAGS -DHAVE_CHECK"
fi
AC_SUBST(CHECK_CFLAGS)
AC_SUBST(CHECK_LIBS)

dnl
dnl Check if lib should be build with the debug mode
dnl
AC_ARG_ENABLE(debug,
        [  --enable-debug          debug [default=no]],
        use_debug="Yes", use_debug="No")

if test "x$use_debug" = "xYes"; then
	AC_DEFINE(GDA_DEBUG)
	GDA_DEBUG_FLAGS=-DGDA_DEBUG
	AC_SUBST(GDA_DEBUG_FLAGS)
fi

dnl Disable rebuild of glib-mkenum -generated source code:
AC_ARG_ENABLE(rebuilds, [  --disable-rebuilds      disable all source autogeneration rules],,enable_rebuilds=yes)

# define a MAINT-like variable REBUILD which is set if Perl
# is found, so autogenerated sources can be rebuilt
AC_CHECK_PROGS(PERL, perl5 perl)

REBUILD=\#
if test "x$enable_rebuilds" = "xyes" && \
     test -n "$PERL" && \
     $PERL -e 'exit !($] >= 5.002)' > /dev/null 2>&1 ; then
  REBUILD=
fi
AC_SUBST(REBUILD)


AC_OUTPUT([
Makefile
libgda.spec
libgda-3.0.pc
po/Makefile.in
libsql/Makefile
libgda/Makefile
libgda/handlers/Makefile
libgda/sql-delimiter/Makefile
libgda/sql-transaction/Makefile
libgda/graph/Makefile
providers/Makefile
providers/bdb/Makefile
providers/bdb/libgda-bdb-3.0.pc
providers/freetds/Makefile
providers/freetds/libgda-freetds-3.0.pc
providers/firebird/Makefile
providers/firebird/libgda-firebird-3.0.pc
providers/ibmdb2/Makefile
providers/ibmdb2/libgda-ibmdb2-3.0.pc
providers/ldap/Makefile
providers/ldap/libgda-ldap-3.0.pc
providers/mdb/Makefile
providers/mdb/libgda-mdb-3.0.pc
providers/mysql/Makefile
providers/mysql/libgda-mysql-3.0.pc
providers/msql/Makefile
providers/msql/libgda-msql-3.0.pc
providers/odbc/Makefile
providers/odbc/libgda-odbc-3.0.pc
providers/oracle/Makefile
providers/oracle/libgda-oracle-3.0.pc
providers/postgres/Makefile
providers/postgres/libgda-postgres-3.0.pc
providers/sqlite/Makefile
providers/sqlite/sqlite-src/Makefile
providers/sqlite/libgda-sqlite-3.0.pc
providers/sybase/Makefile
providers/sybase/libgda-sybase-3.0.pc
providers/xbase/Makefile
providers/xbase/libgda-xbase-3.0.pc
report/Makefile
report/gda-report.dtd
report/libgda-report/Makefile
report/testing/Makefile
tools/Makefile
testing/Makefile
tests/Makefile
tests/queries/Makefile
tests/queries/dict_pg.xml
tests/queries/bug_param_sql_dict.xml
tests/data-models/Makefile
tests/providers/Makefile
doc/Makefile
doc/C/Makefile
data/Makefile
stamp.h
])

dnl Print configuration summary
echo ""
echo " Configuration summary"
echo "   Installation prefix = $prefix"
echo "   Providers:"
echo "      Berkeley DB = `if test x$bdbdir != x; then echo yes; else echo no; fi`"
echo "      FireBird = `if test x$firebirddir != x; then echo yes; else echo no; fi`"
echo "      FreeTDS = `if test x$freetdsdir != x; then echo yes; else echo no; fi`"
echo "      IBM DB2 = `if test x$ibmdb2dir != x; then echo yes; else echo no; fi`"
echo "      MDB (MS Access) = `if test x$mdbdir != x; then echo yes; else echo no; fi`"
echo "      MySQL = `if test x$mysqldir != x; then echo yes; else echo no; fi`"
echo "      mSQL = `if test x$msqldir != x; then echo yes; else echo no; fi`"
echo "      ODBC = `if test x$odbcdir != x; then echo yes; else echo no; fi`"
echo "      Oracle = `if test x$oracledir != x; then echo yes; else echo no; fi`"
echo "      PostgreSQL = `if test x$postgresdir != x; then echo yes; else echo no; fi`"
echo "      SQLite = yes `if test x$have_sqlite = xyes; then echo '(from system installation)'; else echo '(embedded)'; fi`"
echo "      Sybase = `if test x$sybasedir != x; then echo yes; else echo no; fi`"
echo "      xBase (dBase, Clipper, FoxPro) = `if test x$xbasedir != x; then echo yes; else echo no; fi`"
echo "      LDAP = `if test x$ldapdir != x; then echo yes; else echo no; fi`"
echo ""