File: configure.in

package info (click to toggle)
mnogosearch 3.3.7-3
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 17,484 kB
  • ctags: 4,565
  • sloc: ansic: 94,097; xml: 16,864; sh: 8,915; makefile: 1,727; perl: 801; php: 561; sql: 15
file content (1736 lines) | stat: -rw-r--r-- 47,378 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
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
dnl Process this file with autoconf to produce a configure script.
AC_INIT(TODO)
AC_CANONICAL_SYSTEM
dnl AM_INIT_AUTOMAKE(mnogosearch, 3.2.33-`date "+%Y%m%d"`)
AM_INIT_AUTOMAKE(mnogosearch, 3.3.7)
AM_MAINTAINER_MODE
AM_CONFIG_HEADER(include/udm_autoconf.h)
AC_PROG_MAKE_SET

# Set all version vars based on $VERSION. How do we do this more elegant ?
# Remember that regexps needs to quote [ and ] since this is run through m4
UDM_TRIM_VERSION=`echo $VERSION | sed -e "s|\.*pre[[0-9]]*$||"`
UDM_TRIM_VERSION=`echo $UDM_TRIM_VERSION | sed -e "s|\.*-[[0-9]]*$||"`
UDM_BASE_VERSION=`echo $UDM_TRIM_VERSION | sed -e "s|\.[[^.]]*$||" | sed -e "s|^\(.\)\.\(.\)$|\\1\.0\\2|" | sed -e "s|\.||g"`
UDM_TAIL_VERSION=`echo $UDM_TRIM_VERSION | sed -e "s|^[[0-9]]\.[[0-9]]*\.||" | sed -e "s|^\(.\)$|0\\1|"`
UDM_VERSION_ID=${UDM_BASE_VERSION}${UDM_TAIL_VERSION}

AC_DEFINE_UNQUOTED([UDM_VERSION_ID], [$UDM_VERSION_ID], [Define VERSION_ID])
AC_SUBST(UDM_VERSION_ID)

dnl Installation prefix by default
AC_PREFIX_DEFAULT(/usr/local/mnogosearch)

dnl Check if build env is sane
AM_SANITY_CHECK

dnl Check for programs.
AC_PROG_CC
AC_PROG_INSTALL

dnl Enable shared libs by default (to disable - place AM_DISABLE_SHARED)
AM_PROG_LIBTOOL
AC_SUBST(LIBTOOL_DEPS)

AC_PATH_PROG(RM, rm, rm)

dnl Check if we are little or big endian
AC_C_BIGENDIAN

dnl OS specific flags and options
case "$host" in
        *-*-irix*)
            CFLAGS="$CFLAGS -D_BSD_COMPAT"
            LDADD="$LDADD -lbsd"
            ;;
esac

dnl Checks for header files.
AC_STDC_HEADERS
AC_CHECK_HEADERS(sys/types.h fcntl.h unistd.h sys/cdefs.h libutil.h \
sys/ioctl.h sys/time.h sys/times.h sys/param.h sys/wait.h locale.h \
getopt.h syslog.h select.h sys/select.h sys/socket.h arpa/inet.h netdb.h \
netinet/in.h netinet/in_systm.h netinet/tcp.h arpa/nameser.h sys/ipc.h)

AC_CHECK_HEADERS(netinet/ip.h resolv.h,,,
[
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#if HAVE_NETINET_IN_SYSTM_H
#include <netinet/in_systm.h>
#endif
#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
]
)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
# Check if we have socklen_t
AC_CACHE_CHECK([for socklen_t], ac_cv_have_socklen_t,
AC_TRY_COMPILE(
[#include <sys/types.h>
#include <sys/socket.h>],
[socklen_t s;],
ac_cv_have_socklen_t=yes, ac_cv_have_socklen_t=no))

if test "$ac_cv_have_socklen_t" = "no"
then
  AC_DEFINE([socklen_t], [int], [Define if you havnt socklen_t type])
fi


dnl Check for tm_gmtoff in struct tm
AC_MSG_CHECKING(for tm_gmtoff in struct tm)
AC_TRY_COMPILE([#include <time.h>],
[struct tm tm;
tm.tm_gmtoff=0;
],
AC_DEFINE([HAVE_TM_GMTOFF], [1], [Define if you have tm_gmtoff in struct tm])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))

dnl Check for library functions
AC_CHECK_FUNCS(strdup strndup strstr strnlen strcasecmp strncasecmp bzero strtok_r strcasestr timegm)
AC_CHECK_FUNCS(regcomp socket vsnprintf snprintf mergesort setvbuf)
AC_CHECK_FUNCS(setenv putenv, break)
AC_CHECK_FUNCS(unsetenv atexit)
AC_CHECK_FUNC(inet_addr, , AC_CHECK_LIB(xnet, inet_addr, LIBS="-lxnet $LIBS"))
AC_CHECK_FUNC(setproctitle, , AC_CHECK_LIB(util, setproctitle, LIBS="-lutil $LIBS"))
AC_CHECK_FUNC(sqrt, , AC_CHECK_LIB(m, sqrt, LIBS="$LIBS -lm"))

dnl Check sizeof_type
AC_CHECK_SIZEOF(char*)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
AC_CHECK_SIZEOF(short)

dnl Check for libraries
dnl Next line was commented out by Kir 
dnl Does inet_addr and inet_aton belongs to one lib? 
dnl If so we don't need to check for inet_aton
dnl AC_CHECK_FUNCS(inet_addr inet_aton)
AC_LIBRARY_NET

dnl Determine signal handling standard
AC_TYPE_SIGNAL
AC_MSG_CHECKING(for POSIX signals)
AC_TRY_LINK([#include <signal.h>],
[   sigset_t ss;
    struct sigaction sa;
    sigemptyset(&ss); sigsuspend(&ss);
    sigaction(SIGINT, &sa, (struct sigaction *) 0);
    sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0);
],
    AC_DEFINE([HAVE_POSIX_SIGNALS], [1], [Define if you have POSIX type signal handling routines])
    AC_MSG_RESULT(yes),
    AC_MSG_RESULT(no))


AC_MSG_CHECKING(for debug)
AC_ARG_WITH(debug,
    [  --without-debug         Build a production version without debugging code],
    [with_debug=$withval],
    [with_debug=no])
if test "$with_debug" = "yes"
then
  AC_DEFINE([HAVE_DEBUG], [1], [Define if you want debugging code])
  AC_MSG_RESULT(yes)
else
  # Optimized version. No debug
  AC_MSG_RESULT(no)
fi


dnl check for paranoia support
paranoia=no
AC_MSG_CHECKING(for paranoia support)
AC_ARG_ENABLE(paranoia,
[  --enable-paranoia       Enable paranoia support. Stack will be checked like with libparanoia 
                            This works only on Intel architecture using gcc. Optimization should be switched off.],
[
  if test "$withval" != "no"; then
    AC_MSG_RESULT($withval)
    AC_DEFINE([USE_PARANOIA], [1], [libparanoia usage])
  else
    AC_MSG_RESULT(no)
  fi
],[
  AC_MSG_RESULT(no)
])


dnl check needs for -lc
sharedmem=no
cok=no
if test "$sharedmem" = no; then
	AC_MSG_CHECKING(for POSIX shared memory library)
	AC_TRY_LINK([
#include <sys/types.h>
#include <sys/mman.h>
],
[
 shm_open("/tmp", 0, 0644);
], cok=yes 
   sharedmem=posix
   AC_DEFINE([HAVE_SYS_MMAN_H], [1], [Define if you have the <sys/mman.h> header file.])
   AC_MSG_RESULT(ok)
)
	if test "$cok" = no; then
		ac_save_libs="$LIBS"
		LIBS="$LIBS -lc" 
		AC_TRY_LINK([
#include <sys/types.h>
#include <sys/mman.h>
],
[
 shm_open("/tmp", 0, 0644);
], cok=yes 
   sharedmem=posix
   AC_DEFINE([HAVE_SYS_MMAN_H], [1], [Define if you have the <sys/mman.h> header file.])
   AC_MSG_RESULT(-lc), 
   LIBS="$ac_save_libs"
)
	fi
	if test "$cok" = no; then
		ac_save_libs="$LIBS"
		LIBS="$LIBS -lrt" 
		AC_TRY_LINK([
#include <sys/types.h>
#include <sys/mman.h>
],
[
 shm_open("/tmp", 0, 0644);
], cok=yes 
   sharedmem=posix
   AC_DEFINE([HAVE_SYS_MMAN_H], [1], [Define if you have the <sys/mman.h> header file.])
   AC_MSG_RESULT(-lrt), 
   LIBS="$ac_save_libs"
)
	fi
fi 

if test "$sharedmem" = no; then
	AC_MSG_CHECKING(for SystemV shared memory library)
	AC_TRY_LINK([
#include <sys/types.h>
#include <sys/shm.h>
],
[
 shmat(1, 0, 0);
],cok=yes
  sharedmem=sysV
  AC_DEFINE([HAVE_SYS_SHM_H], [1], [Define if you have the <sys/shm.h> header file.])
  AC_MSG_RESULT(ok))
	if test "$cok" = no; then
		ac_save_libs="$LIBS"
		LIBS="$LIBS -lc" 
		AC_TRY_LINK([
#include <sys/types.h>
#include <sys/shm.h>
],
[
 shmat(1, 0, 0);
],cok=yes 
  sharedmem=sysV
  AC_DEFINE([HAVE_SYS_SHM_H], [1], [Define if you have the <sys/shm.h> header file.])
  AC_MSG_RESULT(-lc), 
  LIBS="$ac_save_libs"
)
	fi
	if test "$cok" = no; then
		ac_save_libs="$LIBS"
		LIBS="$LIBS -lrt" 
		AC_TRY_LINK([
#include <sys/types.h>
#include <sys/shm.h>
],
[
 shmat(1, 0, 0);
],cok=yes 
  sharedmem=sysV
  AC_DEFINE([HAVE_SYS_SHM_H], [1], [Define if you have the <sys/shm.h> header file.])
  AC_MSG_RESULT(-lrt), 
  LIBS="$ac_save_libs"
)
	fi
fi 

if test "$sharedmem" = no; then
	AC_MSG_ERROR([No shared memory support found])
fi


syslog=yes
AC_MSG_CHECKING(for syslog support)
AC_ARG_ENABLE(syslog,
[How to log messages:
  --enable-syslog         Use syslog (default)
  --enable-syslog=LOG_FACILITY
                          Use syslog facility LOG_FACILITY, which should be
			  valid name defined in /usr/include/sys/syslog.h
  --disable-syslog        Use stdout/stderr]
,
syslog=$enableval)

if test "$syslog" != no; then
    AC_DEFINE([USE_SYSLOG], [1], [Define if you want to use syslog for logging indexer messages])
    if test "$syslog" != yes; then
	AC_DEFINE_UNQUOTED(LOG_FACILITY, $syslog, syslog facility)
	AC_TRY_RUN([
	    #include <sys/syslog.h>
	    int main(void){
	    openlog("Test", LOG_NDELAY, LOG_FACILITY);
	    closelog();
	    return 0;
	}
	],
	AC_MSG_RESULT([enabled (will use $syslog facility)]),
	[
	AC_MSG_RESULT(error)
	echo "You probably gave wrong facility argument ($syslog)"
	echo "to --enable-syslog. This argument should be one defined in"
	echo "/usr/include/sys/syslog.h, for example LOG_DAEMON or LOG_LOCAL7."
	AC_MSG_ERROR([** Unknown syslog facility given **])
	],
	[echo $ac_n "cross compiling; assumed OK... $ac_c"]
	)
    else
	AC_MSG_RESULT(enabled)
    fi
else
    AC_MSG_RESULT([disabled (will use stdout/stderr)])
fi

trace=no
AC_MSG_CHECKING(for tracing support)
AC_ARG_ENABLE(trace,
[ --enable-trace         Use tracing (for debug purpose)
                         disabled by default
]
,
trace=$enableval)

if test "$trace" != no; then
	AC_DEFINE([USE_TRACE], [1], [Define if you want tracing for debugging])
	AC_MSG_RESULT(enabled)
else
	AC_MSG_RESULT(disable)
fi


dnl Hack to build statically linked binary distributions
STATIC_LFLAGS=""
static_lflags=no
AC_MSG_CHECKING(for -all-static linker flags)
AC_ARG_ENABLE(all-static,
[  --enable-all-static     build statically linked binaries],static_lflags=$enableval)
if test "$static_lflags" != no; then
	AC_MSG_RESULT(enabled)
	STATIC_LFLAGS="-all-static"
	LINKING="static"
else
	AC_MSG_RESULT([disabled])
	LINKING="dynamic"
fi
AC_SUBST(STATIC_LFLAGS)
AC_SUBST(LINKING)

PTHREAD_CFLAGS=""
PTHREAD_LFLAGS=""
PTHREAD_LDADD=""

pthreads=yes
AC_MSG_CHECKING(for pthreads)
AC_ARG_ENABLE(pthreads,
[  --disable-pthreads      disable POSIX pthreads],pthreads=$enableval)

if test "$pthreads" != no; then

    case "$host" in
        *-*-bsdi*)
            PTHREAD_CFLAGS="-D_REENTRANT -D_THREAD_SAFE"
            ;;
        *-*-darwin*)
            PTHREAD_CFLAGS="-D_THREAD_SAFE"
# causes Carbon.p complaints?
#           PTHREAD_CFLAGS="-D_REENTRANT -D_THREAD_SAFE"
            ;;
        *-*-freebsd*)
            PTHREAD_CFLAGS="-D_REENTRANT -D_THREAD_SAFE"
            PTHREAD_LFLAGS="-pthread"
            ;;
        *-*-netbsd*)
            PTHREAD_CFLAGS="-I/usr/pkg/include -D_REENTRANT"
            PTHREAD_LDADD="-L/usr/pkg/lib -lpthread -lsem"
            ;;
        *-*-openbsd*)
            PTHREAD_CFLAGS="-D_REENTRANT"
            PTHREAD_LFLAGS="-pthread"
            ;;
        *-*-solaris*)
            PTHREAD_CFLAGS="-D_REENTRANT"
            PTHREAD_LDADD="-lpthread -lposix4"
            ;;
        *-*-sysv5*)
            PTHREAD_CFLAGS="-D_REENTRANT -Kthread"
            PTHREAD_LDADD=""
            ;;
        *-*-irix*)
            PTHREAD_CFLAGS="-D_SGI_MP_SOURCE -D_POSIX_C_SOURCE=199506L -D_XOPEN_SOURCE=500"
            PTHREAD_LDADD="-lpthread"
            ;;
        *-*-aix*)
            PTHREAD_CFLAGS="-D_REENTRANT -mthreads"
            PTHREAD_LDADD="-lpthread"
            ;;
        *-*-qnx*)
            PTHREAD_CFLAGS=""
            PTHREAD_LDADD=""
            ;;
        *)
            PTHREAD_CFLAGS="-D_REENTRANT"
            PTHREAD_LDADD="-lpthread"
            ;;
    esac

    ac_save_libs="$LIBS"
    LIBS="$LIBS $PTHREAD_LFLAGS $PTHREAD_LDADD"
    CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
    
    AC_TRY_LINK([#include <pthread.h>],
	[
		pthread_attr_t type;
		pthread_attr_init(&type);
        ],AC_MSG_RESULT([yes]), 
          AC_MSG_ERROR([POSIX thread support not found])
    )

    LIBS="$ac_save_libs"
    AC_DEFINE([HAVE_PTHREAD], [1], [Define if you want to use threaded indexer])

else
    AC_MSG_RESULT([disabled])
fi


AC_SUBST(PTHREAD_CFLAGS)
AC_SUBST(PTHREAD_LFLAGS)
AC_SUBST(PTHREAD_LDADD)


if test "$pthreads" = yes ; then
  _CFLAGS="$CFLAGS"
  _LIBS="$LIBS"
  CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
  LIBS="$LIBS $PTHREAD_LFLAGS $PTHREAD_LDADD"
  
  AC_MSG_CHECKING(for gethostbyname_r)
  
  if test -z "$ac_cv_gethostbyname_args"; then
    AC_TRY_LINK(
[
#include <sys/types.h>
#include <netdb.h>
],
[
struct hostent *hp;
struct hostent h;
char *name;
char buffer[10];
int  h_errno;
hp= gethostbyname_r(name, &h, buffer, 10, &h_errno);
], ac_cv_gethostbyname_args=5)
  fi


  if test -z "$ac_cv_gethostbyname_args"; then
    AC_TRY_LINK(
[
#include <sys/types.h>
#include <netdb.h>
],
[
struct hostent h;
struct hostent_data hdata;
char *name;
int  rc;
rc= gethostbyname_r(name, &h, &hdata);
], ac_cv_gethostbyname_args=3)
  fi


  if test -z "$ac_cv_gethostbyname_args"; then
    AC_TRY_LINK(
[
#include <sys/types.h>
#include <netdb.h>
],
[
struct hostent h;
struct hostent *hp;
char *name;
char buf[10];
int rc;
int h_errno;

rc= gethostbyname_r(name, &h, buf, 10, &hp, &h_errno);
], ac_cv_gethostbyname_args=6)
  fi

  if test -z "$ac_cv_gethostbyname_args"; then
    AC_MSG_RESULT(no)
  else
    if test "$ac_cv_gethostbyname_args" = 3; then
      AC_DEFINE([HAVE_GETHOSTBYNAME_R_3], [1], [Define if you have gethostbyname_r() with three arguments (AIX, HPUX, Tru64)])
    elif test "$ac_cv_gethostbyname_args" = 5; then
      AC_DEFINE([HAVE_GETHOSTBYNAME_R_5], [1], [Define if you have gethostbyname_r() with five arguments (Solaris, IRIX, QNX)])
    elif test "$ac_cv_gethostbyname_args" = 6; then
      AC_DEFINE([HAVE_GETHOSTBYNAME_R_6], [1], [Define if you have gethostbyname_r() with six arguments (Linux)])
    fi
    AC_MSG_RESULT([yes (with $ac_cv_gethostbyname_args arguments)])
  fi

  CFLAGS="$_CFLAGS"
  LIBS="$_LIBS"
fi


parser=yes
AC_MSG_CHECKING(for external parsers support)
AC_ARG_ENABLE(parser,
[  --disable-parser        disable external parsers support], parser=$enableval)

if test "$parser" != no; then
    AC_DEFINE([USE_PARSER], [1], [Define if you want to use external parser])
    AC_MSG_RESULT(yes)
else
    AC_MSG_RESULT([no])
fi


mp3=yes
AC_MSG_CHECKING(for MP3 ID3 tags support)
AC_ARG_ENABLE(mp3,
[  --disable-mp3           disable MP3 tags support ], mp3=$enableval)

if test "$mp3" != no; then
    AC_DEFINE([USE_MP3], [1], [Define if you want mp3 id3 tags support])
    AC_MSG_RESULT(yes)
else
    AC_MSG_RESULT([no])
fi


file=yes
AC_MSG_CHECKING(for file: URL schema support)
AC_ARG_ENABLE(file,
[  --disable-file          disable file:/ URL scheme support], file=$enableval)

if test "$file" != no; then
    AC_DEFINE([USE_FILE], [1], [Define if you want to support file:// URL schema])
    AC_MSG_RESULT(yes)
else
    AC_MSG_RESULT([no])
fi


http=yes
AC_MSG_CHECKING([for http: (and ftp: - via proxy) URL schema support])
AC_ARG_ENABLE(http,
[  --disable-http          disable http:// URL scheme support], http=$enableval)

if test "$http" != no; then
    AC_DEFINE([USE_HTTP], [1], [Define if you want to support http:// URL schema])
    AC_MSG_RESULT(yes)
else
    AC_MSG_RESULT([no])
fi


ftp=yes
AC_MSG_CHECKING(for ftp: URL schema support)
AC_ARG_ENABLE(ftp,
[  --disable-ftp           disable ftp:// URL scheme support], ftp=$enableval)

if test "$ftp" != no; then
    AC_DEFINE([USE_FTP], [1], [Define if you want to support ftp:// URL schema])
    AC_MSG_RESULT(yes)
else
    AC_MSG_RESULT([no])
fi




news=yes
AC_MSG_CHECKING(for news: URL schema support)
AC_ARG_ENABLE(news,
[  --disable-news          disable news:// URL schema support], news=$enableval)

if test "$news" != no; then
    AC_DEFINE([USE_NEWS], [1], [Define if you want to support news:// URL schema])
    AC_MSG_RESULT(yes)
else
    AC_MSG_RESULT([no])
fi


efence=no
AC_MSG_CHECKING(for Electricfence memory debugger support)
AC_ARG_ENABLE(efence,
[  --enable-efence         enable Electricfence memory debugger support],efence=$enableval)

if test "$efence" != no; then
	if test "$pthreads" != no; then
		LIBS="$LIBS -L/usr/local/lib -lefence_r"
	else
		LIBS="$LIBS -L/usr/local/lib -lefence"
	fi
	AC_MSG_RESULT(yes)
else
	AC_MSG_RESULT([no])
fi

memdebug=no
AC_MSG_CHECKING(for internal memory debugger support)
AC_ARG_ENABLE(memdebug,
[  --enable-memdebug       enable internal memory debugger support],memdebug=$enableval)

if test "$memdebug" != no; then
        AC_DEFINE([EFENCE], [1], [Define if you want internal memory debugger based on Electric Fence 2.2])
        efOBJ="efence.o ef_page.o ef_print.o"
        AC_MSG_RESULT(yes)
else
        AC_MSG_RESULT([no])
fi
AC_SUBST(efOBJ)


dnl check for MySQL fulltext plugin support
AC_MSG_CHECKING(for MySQL fulltext plugin support)
AC_ARG_ENABLE(mysql-fulltext-plugin,
[  --enable-mysql-fulltext-plugin  enable MySQL-5.1 fulltext plugin interface],
[
  if test "$enableval" != "no"; then
    AC_MSG_RESULT(yes)
    AC_DEFINE([HAVE_MYSQL_FULLTEXT_PLUGIN], [1], [MySQL fulltext plugin])
  else
    AC_MSG_RESULT(no)
  fi
],[
  AC_MSG_RESULT(no)
])


# Shall we build the docs?
AC_ARG_WITH(docs,
    [  --with-docs             Build the documentation.],
    [with_docs=$withval],
    [with_docs=no]
)

if test "$with_docs" = "yes"
then
  # Check for DocBook and tools
  PGAC_PROG_JADE
  #PGAC_CHECK_DOCBOOK([4.1])
  have_docbook=yes
  PGAC_PATH_DOCBOOK_STYLESHEETS

  if test "x$JADE" != "x" && test x$have_docbook != "xno" ; then
    AC_MSG_CHECKING(for collateindex.pl)
    for  ci_prefix in /usr/bin /usr/local/bin $DOCBOOKSTYLE/bin; do
      ci_candidate=$ci_prefix/collateindex.pl
      if test -f "$ci_candidate"
      then
        COLLATEINDEX=$ci_candidate
        break
      fi
    done
    AC_SUBST([COLLATEINDEX])
    if test -n "$COLLATEINDEX"; then
      AC_MSG_RESULT([$COLLATEINDEX])
      doc_FILES="HTML_ALL"
    else
      AC_MSG_ERROR([Unable to find collateindex.pl])
    fi
#    if test -f $DOCBOOKSTYLE/bin/collateindex.pl; then
#      doc_FILES="HTML_ALL"
#    fi
  fi
else
  doc_FILES="HTML_ALL_NOJADE"
fi
AC_SUBST(doc_FILES)




AC_MSG_CHECKING(for Openssl support)
AC_ARG_WITH(openssl,
[  --with-openssl[=DIR]      Include Openssl support.  DIR is the Openssl 
                          base install directory, defaults to /usr/local/ssl.],
[
  if test "$withval" != "no"; then
        if test "$withval" = "yes"; then
                if test -f /usr/include/openssl/ssl.h; then
                        SSL_INCDIR=/usr/include
                else
                        SSL_INCDIR=/usr/local/ssl/include
                fi
                if test -f /usr/lib/libssl.a; then
                        SSL_LIBDIR=/usr/lib
                else
                        SSL_LIBDIR=/usr/local/ssl/lib
                fi
        else
                SSL_INCDIR=$withval/include
                test -d $withval/include/openssl && SSL_INCDIR=$withval/include
                SSL_LIBDIR=$withval/lib
        fi
    SSL_INCLUDE="-I$SSL_INCDIR"
    SSL_LFLAGS="-L$SSL_LIBDIR -lssl -lcrypto"
    # On RedHat 9 we need kerberos to compile openssl
    for d in /usr/kerberos/include
    do
      if test -f $d/krb5.h; then
        SSL_INCLUDE="-I$d $SSL_INCLUDE"
      fi
    done
    AC_MSG_RESULT(yes)
    AC_DEFINE([USE_HTTPS], [1], [Define if you want to support https:// URL schema])
  else
    AC_MSG_RESULT(no)
  fi
],[
  AC_MSG_RESULT(no)
])

AC_SUBST(SSL_INCLUDE)
AC_SUBST(SSL_LFLAGS)


AC_MSG_CHECKING(for DMALLOC memory debugger support)
AC_ARG_WITH(dmalloc,
[  --with-dmalloc          enable DMALLOC memory debugger support],
[
if test "$withval" != "no"; then
  if test "$withval" = "yes" ; then
    if test -f /usr/include/dmalloc.h; then
      withval="/usr"
      AC_MSG_RESULT([$withval])
    elif test -f /usr/local/include/dmalloc.h; then
      withval="/usr/local"
      AC_MSG_RESULT([$withval])
    else
      AC_MSG_RESULT([no])
      AC_MSG_ERROR([Unknown dmalloc directory - unable to find dmalloc.h])
    fi
  fi
  
  if test "$pthreads" != no; then
    dmalloc_libname="dmallocth"
  else
    dmalloc_libname="dmalloc"
  fi

  CFLAGS="$CFLAGS -I$withval/include"
  LIBS="$LIBS -L$withval/lib -l$dmalloc_libname"
  AC_CHECK_LIB($dmalloc_libname, dmalloc_shutdown, 
               AC_DEFINE([DMALLOC], [1], [ Define if you want DMALLOC]),
               AC_MSG_ERROR([Unable to find working dmalloc library under $withval/lib]))
else
  AC_MSG_RESULT([no])
fi
],
[
  AC_MSG_RESULT([no])
])



AC_MSG_CHECKING(for zlib for HTTP Content-Encoding support)
AC_ARG_WITH(zlib,
[  --with-zlib             for HTTP Content-Encoding support],
[zlib=$withval],
[zlib=yes])
  
AC_MSG_RESULT([$zlib])
  
if test "$zlib" = "no" ; then
  dnl to avoid bash error
  x=$x
elif test "$zlib" = "yes" ; then
  AC_CHECK_LIB(z, inflate, AC_DEFINE([HAVE_ZLIB], [1], [Define if you want HTTP Content Encoding support]) LIBS="$LIBS -lz",
	LIBS_save="$LIBS"
	LIBS="$LIBS /usr/local/lib"
	AC_CHECK_LIB(z,inflate,AC_DEFINE([HAVE_ZLIB], [1], [ Define if you want HTTP Content Encoding support]) LIBS="$LIBS -lz",
		LIBS="$LIBS_save"
		AC_MSG_ERROR([Unable to find working zlib library])
		)
	)
else
  ZLIB_INCDIR="$zlib/include"
  ZLIB_LIBDIR="$zlib/lib"
  CFLAGS="-I$zlib/include $CFLAGS"
  LIBS="$LIBS -L$zlib/lib -lz"
  AC_CHECK_LIB(z,inflate,AC_DEFINE([HAVE_ZLIB], [1], [ Define if you want HTTP Content Encoding support]),AC_MSG_ERROR([Unable to find working zlib library under $zlib]))
fi


AC_MSG_CHECKING(for readline support)
AC_ARG_WITH(readline,
[  --with-readline         enable readline support for SQL monitor],
[
  AC_DEFINE([HAVE_READLINE], [1], [Define if you want readline support])
  AC_MSG_RESULT(yes)
  AC_CHECK_FUNC(tgetnum, ,
    AC_CHECK_LIB(tinfo,  tgetnum, READLINE_LDADD="-ltinfo",
    AC_CHECK_LIB(ncurses,tgetnum, READLINE_LDADD="-lncurses",
    AC_CHECK_LIB(termcap,tgetnum, READLINE_LDADD="-ltermcap",
    AC_MSG_ERROR([Unable to find tgetnum needed for readline])))))
  READLINE_LDADD="-lreadline $READLINE_LDADD"
],
[
  REALINE_LDADD=""
  AC_MSG_RESULT([no])
]
)
AC_SUBST(READLINE_LDADD)


ADDCHARSETS=""
AC_MSG_CHECKING(for chasen)
AC_ARG_WITH(chasen,
[  --with-chasen           enable chasen Japanese morphological system support],
[
  AC_DEFINE([CHASEN], [1], [Define if you want chasen support])
  if test "$withval" = "yes"; then
    dd="/usr /usr/local"
  else
    dd="$withval"
  fi

  for d in $dd; do
    if test -f $d/include/chasen.h; then
      path=$d
      break
    fi
  done

  if test "$path" = ""; then
    AC_MSG_RESULT(no)
    AC_MSG_ERROR(Invalid chasen directory - unable to find chasen.h)
  fi

  AC_MSG_RESULT($path)
  CHASEN_INCLUDE="-I$path/include"
  CHASEN_LFLAGS="-L$path/lib -lstdc++ -lchasen"
  AC_DEFINE([HAVE_CHARSET_japanese], [1], [Define if you want Japanese support])
  ADDCHARSETS="japanese"
],
[AC_MSG_RESULT([no])]
)
AC_SUBST(CHASEN_INCLUDE)
AC_SUBST(CHASEN_LFLAGS)

AC_MSG_CHECKING(for mecab)
AC_ARG_WITH(mecab,
[  --with-mecab            enable mecab Japanese morphological system support],
[
  AC_DEFINE([MECAB], [1], [Define if you want mecab support])
  if test "$withval" = "yes"; then
    dd="/usr /usr/local"
  else
    dd="$withval"
  fi

  for d in $dd; do
    if test -f $d/include/mecab.h; then
      path=$d
      break
    fi
  done

  if test "$path" = ""; then
    AC_MSG_RESULT(no)
    AC_MSG_ERROR(Invalid mecab directory - unable to find mecab.h)
  fi

  AC_MSG_RESULT($path)
  LIBS="$LIBS -L$path/lib -lstdc++ -lmecab"
  CFLAGS="$CFLAGS -I$path/include"
  AC_DEFINE([HAVE_CHARSET_japanese], [1], [Define if you want Japanese support])
  ADDCHARSETS="japanese"
],
[AC_MSG_RESULT([no])]
)



dnl Check for some DBMS backend
dnl NOTE: we can use several different backend at the same time

have_db=no
DBTYPE=

AC_MSG_CHECKING(for MySQL support)
AC_ARG_WITH(mysql,
[
What DBMS support do you want (you may select several):
  --with-mysql[=DIR]      Include MySQL support.  DIR is the MySQL base
                          install directory, default is to search through
                          a number of common places for the MySQL files.],
[
  if test "$withval" != "no"; then
  	if test "$withval" = "yes"; then
		if test -f /usr/local/mysql/include/mysql/mysql.h; then
			MYSQL_INCDIR=/usr/local/mysql/include/mysql
			MYSQL_LIBDIR=/usr/local/mysql/lib/mysql
			withval="/usr/local/mysql"
		elif test -f /usr/include/mysql/mysql.h; then
			MYSQL_INCDIR=/usr/include/mysql
			MYSQL_LIBDIR=/usr/lib/mysql
			withval="/usr"
		elif test -f /usr/local/mysql/include/mysql.h; then
			MYSQL_INCDIR=/usr/local/mysql/include/
			MYSQL_LIBDIR=/usr/local/mysql/lib/
			withval="/usr/local/mysql"
		elif test -f /usr/include/mysql.h; then
			MYSQL_INCDIR=/usr/include
			MYSQL_LIBDIR=/usr/lib
			withval="/usr"
		elif test -f /usr/local/include/mysql/mysql.h; then
			MYSQL_INCDIR=/usr/local/include/mysql
			MYSQL_LIBDIR=/usr/local/lib/mysql
			withval="/usr/local"
		elif test -f /usr/local/include/mysql.h; then
			MYSQL_INCDIR=/usr/local/include
			MYSQL_LIBDIR=/usr/local/lib
			withval="/usr/local"
		elif test -f /Library/MySQL/include/mysql/mysql.h; then
			MYSQL_INCDIR=/Library/MySQL/include/mysql
			MYSQL_LIBDIR=/Library/MySQL/lib/mysql
			withval="/Library/MySQL"
		else
			AC_MSG_RESULT(no)
			AC_MSG_ERROR(Unknown MySQL directory - unable to find mysql.h)
		fi
   	else
		if test -f $withval/include/mysql/mysql.h; then
   			MYSQL_INCDIR=$withval/include/mysql
   			MYSQL_LIBDIR=$withval/lib/mysql
		elif test -f $withval/include/mysql.h; then
   			MYSQL_INCDIR=$withval/include
   			MYSQL_LIBDIR=$withval/lib
		else
			AC_MSG_RESULT(no)
			AC_MSG_ERROR(Invalid MySQL directory - unable to find mysql.h under $withval)
		fi
   	fi
    MYSQL_INCLUDE="-I$MYSQL_INCDIR"
    MYSQL_LFLAGS="-L$MYSQL_LIBDIR -lmysqlclient"

    AC_DEFINE([HAVE_MYSQL], [1], [Define if you want to use MySQL])
    AC_MSG_RESULT($withval)
    have_db=yes
    dnl MySQL requires -lm sometime
    AC_CHECK_FUNC(floor, , AC_CHECK_LIB(m, floor, MYSQL_LFLAGS="$MYSQL_LFLAGS -lm"))
    dnl MySQL 3.23 requires -lz sometime
    AC_CHECK_FUNC(compress, , AC_CHECK_LIB(z, compress, MYSQL_LFLAGS="$MYSQL_LFLAGS -lz"))
    if test "x$DBTYPE" = "x" ; then
       DBTYPE="mysql"
    else
       DBTYPE="$DBTYPE-mysql"
    fi

  else
  	AC_MSG_RESULT(no)
  fi
],[
  AC_MSG_RESULT(no)
])
AC_SUBST(MYSQL_LFLAGS)
AC_SUBST(MYSQL_INCLUDE)


AC_MSG_CHECKING(for PostgreSQL support)
AC_ARG_WITH(pgsql,
[  --with-pgsql[=DIR]      Include PostgreSQL support.  DIR is the PostgreSQL
                          base install directory, defaults to /usr/local/pgsql.],
[
  if test "$withval" != "no"; then
  	if test "$withval" = "yes"; then
		PGSQL_INCDIR=/usr/local/include/pgsql
		test -f /usr/include/pgsql/libpq-fe.h && PGSQL_INCDIR=/usr/include/pgsql
		test -f /usr/local/pgsql/include/libpq-fe.h && PGSQL_INCDIR=/usr/local/pgsql/include
		test -f /usr/include/postgresql/libpq-fe.h && PGSQL_INCDIR=/usr/include/postgresql
                test -f /usr/local/include/postgresql/libpq-fe.h && PGSQL_INCDIR=/usr/local/include/postgresql
		test -f /usr/local/include/libpq-fe.h && PGSQL_INCDIR=/usr/local/include
		PGSQL_LIBDIR=/usr/local/lib
		test -f /usr/lib/libpq.a && PGSQL_LIBDIR=/usr/lib
		test -f /usr/local/pgsql/lib/libpq.a && PGSQL_LIBDIR=/usr/local/pgsql/lib
   	else
   		PGSQL_INCDIR=$withval/include
   		test -d $withval/include/pgsql && PGSQL_INCDIR=$withval/include/pgsql
   		PGSQL_LIBDIR=$withval/lib
   		test -d $withval/lib/pgsql && PGSQL_LIBDIR=$withval/lib/pgsql
   	fi
    PGSQL_INCLUDE="-I$PGSQL_INCDIR"
    PGSQL_LFLAGS="-L$PGSQL_LIBDIR -lpq"
    AC_DEFINE([HAVE_PGSQL], [1], [Define if you want to use PostgreSQL])
    AC_MSG_RESULT(yes)
    have_db=yes
    
    AC_CHECK_FUNC(crypt, , AC_CHECK_LIB(crypt, crypt, PGSQL_LFLAGS="$PGSQL_LFLAGS -lcrypt"))

    if test "x$DBTYPE" = "x" ; then
       DBTYPE="pqsql"
    else
       DBTYPE="$DBTYPE-pqsql"
    fi

  else
    AC_MSG_RESULT(no)
  fi
],[
  AC_MSG_RESULT(no)
])
AC_SUBST(PGSQL_LFLAGS)
AC_SUBST(PGSQL_INCLUDE)



AC_MSG_CHECKING(for iODBC support)
AC_ARG_WITH(iodbc,
[  --with-iodbc[=DIR]      Include iODBC support.  DIR is the iODBC base
                          install directory, defaults to /usr/local.],
[
	if test "$withval" = "yes"; then
		withval=/usr/local
	fi

	if test "$withval" != "no"; then
		if test -f $withval/include/isql.h; then
			IODBC_INCDIR=$withval/include
			IODBC_LIBDIR=$withval/lib
		else
    			AC_MSG_RESULT(no)
			AC_MSG_ERROR(Invalid iODBC directory - unable to find isql.h)
		fi
		IODBC_LFLAGS="-L$IODBC_LIBDIR -liodbc"
		IODBC_INCLUDE="-I$IODBC_INCDIR"
		AC_DEFINE([HAVE_IODBC], [1], [Define if you want to use iODBC])
		AC_MSG_RESULT(yes)
		have_db=yes
		if test "x$DBTYPE" = "x" ; then
			DBTYPE="iODBC"
		else
			DBTYPE="$DBTYPE-iODBC"
		fi
	fi
],[
	AC_MSG_RESULT(no)
])
AC_SUBST(IODBC_LFLAGS)
AC_SUBST(IODBC_INCLUDE)


AC_MSG_CHECKING(for unixODBC support)
AC_ARG_WITH(unixODBC,
[  --with-unixODBC[=DIR]   Include unixODBC support.  DIR is the unixODBC base
                          install directory, defaults to /usr/local.],
[

if test "$withval" != "no"; then
	if test "$withval" = "yes"; then
		if test -f /usr/include/sql.h; then
			UNIXODBC_INCDIR=/usr/include
			UNIXODBC_LIBDIR=/usr/lib
			withval="/usr"
		elif test -f /usr/local/include/sql.h; then
			UNIXODBC_INCDIR=/usr/local/include
			UNIXODBC_LIBDIR=/usr/local/lib
			withval="/usr/local"
		else
			AC_MSG_RESULT(no)
			AC_MSG_ERROR(Unknown unixODBC directory - unable to find sql.h)
		fi
	else
		if test -f $withval/include/sql.h; then
			UNIXODBC_INCDIR=$withval/include
			UNIXODBC_LIBDIR=$withval/lib
		else
    			AC_MSG_RESULT(no)
			AC_MSG_ERROR(Invalid unixODBC directory - unable to find sql.h)
		fi
	fi
	have_db=yes
	UNIXODBC_LFLAGS="-L$UNIXODBC_LIBDIR -lodbc"
	UNIXODBC_INCLUDE="-I$UNIXODBC_INCDIR"
	AC_DEFINE([HAVE_UNIXODBC], [1], [Define if you want to use unixODBC])
	AC_MSG_RESULT($withval)
	if test "x$DBTYPE" = "x" ; then
		DBTYPE="unixODBC"
	else
		DBTYPE="$DBTYPE-unixODBC"
	fi
fi

],[
	AC_MSG_RESULT(no)
])
AC_SUBST(UNIXODBC_LFLAGS)
AC_SUBST(UNIXODBC_INCLUDE)

AC_MSG_CHECKING(for IBM DB2 support)
AC_ARG_WITH(db2,
[  --with-db2[=DIR]        Include db2 support.  DIR is the DB2 base
                          install directory, defaults to /home/db2],
[
	if test "$withval" = "yes"; then
		withval=/usr/local
	fi

	if test "$withval" != "no"; then
		if test -f $withval/include/sqlcli1.h; then
			DB2_INCDIR=$withval/include
			DB2_LIBDIR=$withval/lib
		else
    			AC_MSG_RESULT(no)
			AC_MSG_ERROR(Invalid DB2 directory - unable to find sqlcli1.h)
		fi
		DB2_LFLAGS="-L$DB2_LIBDIR -ldb2"
		DB2_INCLUDE="-I$DB2_INCDIR"
		AC_DEFINE([HAVE_DB2], [1], [Define if you want to use IBM DB2])
		AC_MSG_RESULT(yes)
		have_db=yes
	fi
    if test "x$DBTYPE" = "x" ; then
       DBTYPE="DB2"
    else
       DBTYPE="$DBTYPE-DB2"
    fi

],[
	AC_MSG_RESULT(no)
])
AC_SUBST(DB2_LFLAGS)
AC_SUBST(DB2_INCLUDE)


AC_MSG_CHECKING(for Solid support)
AC_ARG_WITH(solid,
[  --with-solid[=DIR]      Include Solid support.  DIR is the Solid base
                          install directory, defaults to /usr/local.],
[
	if test "$withval" = "yes"; then
		withval=/usr/local
	fi

	if test "$withval" != "no"; then
		if test -f $withval/include/cli0cli.h; then
			SOLID_INCDIR=$withval/include
			SOLID_LIBDIR=$withval/lib
		else
    			AC_MSG_RESULT(no)
			AC_MSG_ERROR(Invalid Solid directory - unable to find cli0cli.h)
		fi
		SOLID_LFLAGS="-L$SOLID_LIBDIR -lsolcli -lm"
		SOLID_INCLUDE="-I$SOLID_INCDIR"
		AC_DEFINE([HAVE_SOLID], [1], [Define if you want to use Solid SQL Server])
		AC_MSG_RESULT(yes)
		have_db=yes
	fi
    if test "x$DBTYPE" = "x" ; then
       DBTYPE="solid"
    else
       DBTYPE="$DBTYPE-solid"
    fi

],[
	AC_MSG_RESULT(no)
])
AC_SUBST(SOLID_LFLAGS)
AC_SUBST(SOLID_INCLUDE)

AC_MSG_CHECKING(for OpenLink ODBC support)
AC_ARG_WITH(openlink,
[  --with-openlink[=DIR]   Include OpenLink ODBC support. 
                          DIR is the base OpenLink ODBC install directory],
[
  if test "$withval" != "no"; then
  	if test "$withval" = "yes"; then

		if test -f /usr/local/virtuoso-ent/odbcsdk/include/isql.h; then
			VIRT_INCDIR=/usr/local/virtuoso-ent/odbcsdk/include/
			VIRT_LIBDIR=/usr/local/virtuoso-ent/odbcsdk/lib/
		elif test -f /usr/local/virtuoso-lite/odbcsdk/include/isql.h; then
			VIRT_INCDIR=/usr/local/virtuoso-lite/odbcsdk/include/
			VIRT_LIBDIR=/usr/local/virtuoso-lite/odbcsdk/lib/
		elif test -f /usr/local/virtuoso/odbcsdk/include/isql.h; then
			VIRT_INCDIR=/usr/local/virtuoso/odbcsdk/include/
			VIRT_LIBDIR=/usr/local/virtuoso/odbcsdk/lib/
		else
    		AC_MSG_RESULT(no)
    		AC_MSG_ERROR(Invalid OpenLink ODBC directory - unable to find isql.h)
		fi
   	else
		if test -f $withval/odbcsdk/include/isql.h; then
   			VIRT_INCDIR=$withval/odbcsdk/include/
   			VIRT_LIBDIR=$withval/odbcsdk/lib/
		elif test -f $withval/include/isql.h; then
			VIRT_INCDIR=$withval/include/
			VIRT_LIBDIR=$withval/lib/
		else
    		AC_MSG_RESULT(no)
    		AC_MSG_ERROR(Invalid OpenLink ODBC directory - unable to find isql.h under $withval)
		fi
   	fi
    VIRT_INCLUDE="-I$VIRT_INCDIR"
    VIRT_LFLAGS="-L$VIRT_LIBDIR -liodbc"

    AC_DEFINE([HAVE_VIRT], [1], [Define if you want to use OpenLink ODBC (Virtuoso)])
    AC_MSG_RESULT(yes)
    have_db=yes
    if test "x$DBTYPE" = "x" ; then
       DBTYPE="OpenLinkODBC"
    else
       DBTYPE="$DBTYPE-OpenLinkODBC"
    fi

  else
  	AC_MSG_RESULT(no)
  fi
],[
  AC_MSG_RESULT(no)
])
AC_SUBST(VIRT_LFLAGS)
AC_SUBST(VIRT_INCLUDE)


AC_MSG_CHECKING(for EasySoft ODBC support)
AC_ARG_WITH(easysoft,
[  --with-easysoft[=DIR]   Include EasySoft ODBC support. 
                          DIR is the base EasySoft ODBC install directory],
[
  if test "$withval" != "no"; then
  	if test "$withval" = "yes"; then

		if test -f /usr/local/easysoft/oob/client/include/sql.h; then
			EASYSOFT_INCDIR=/usr/local/easysoft/oob/client/include/
			EASYSOFT_LFLAGS="-L/usr/local/easysoft/oob/client/lib/ -L/usr/local/easysoft/lib"
		else
    		AC_MSG_RESULT(no)
    		AC_MSG_ERROR(Invalid EasySoft ODBC directory - unable to find sql.h)
		fi
   	else
		if test -f $withval/easysoft/oob/client/include/sql.h; then
			EASYSOFT_INCDIR=$withval/easysoft/oob/client/include/
			EASYSOFT_LFLAGS="-L$withval/easysoft/oob/client/lib/ -L$withval/easysoft/lib"
		else
		AC_MSG_RESULT(no)
		AC_MSG_ERROR(Invalid EasySoft ODBC directory - unable to find sql.h under $withval)
		fi
	fi
    EASYSOFT_INCLUDE="-I$EASYSOFT_INCDIR"
    EASYSOFT_LFLAGS="$EASYSOFT_LFLAGS -lesoobclient -lesrpc -lessupp -lesextra"

    AC_DEFINE([HAVE_EASYSOFT], [1], [Define if you want to use EasySoft ODBC])
    AC_MSG_RESULT(yes)
    have_db=yes
    if test "x$DBTYPE" = "x" ; then
       DBTYPE="EasySoftODBC"
    else
       DBTYPE="$DBTYPE-EasySoftODBC"
    fi

  else
  	AC_MSG_RESULT(no)
  fi
],[
  AC_MSG_RESULT(no)
])
AC_SUBST(EASYSOFT_LFLAGS)
AC_SUBST(EASYSOFT_INCLUDE)

AC_MSG_CHECKING(for SAPDB ODBC support)
AC_ARG_WITH(sapdb,
[  --with-sapdb[=DIR]      Include SAPDB support.  DIR is the SAPDB base
                          install directory, defaults to /usr/sapdb.],
[
	if test "$withval" = "yes"; then
		withval=/usr/sapdb
	fi

	if test "$withval" != "no"; then
		if test -f $withval/incl/sql.h; then
			SAPDB_INCDIR=$withval/incl
			SAPDB_LIBDIR=$withval/lib
		else
    			AC_MSG_RESULT(no)
			AC_MSG_ERROR(Invalid SAPDB directory - unable to find sql.h)
		fi
		SAPDB_LFLAGS="-L$SAPDB_LIBDIR -lpthread -lsqlod -lsqlrte -lm"
		SAPDB_INCLUDE="-I$SAPDB_INCDIR"
		AC_DEFINE([HAVE_SAPDB], [1], [Define if you want to use SAPDB ODBC library])
		AC_MSG_RESULT(yes)
		have_db=yes
	fi
    if test "x$DBTYPE" = "x" ; then
       DBTYPE="SAPDB"
    else
       DBTYPE="$DBTYPE-SAPDB"
    fi

],[
	AC_MSG_RESULT(no)
])
AC_SUBST(SAPDB_LFLAGS)
AC_SUBST(SAPDB_INCLUDE)


AC_MSG_CHECKING(for InterBase support)
AC_ARG_WITH(ibase,
[  --with-ibase[=DIR]      Include InterBase support.  DIR is the InterBase
                          install directory, defaults to /usr/interbase.],
[
	if test "$withval" = "yes"; then
		for d in /usr/interbase /opt/firebird /usr/local/firebird /usr; do
			if test -f $d/include/ibase.h; then
				withval=$d
				break
			fi
		done
		if test "$withval" = "yes"; then
			AC_MSG_RESULT(no)
			AC_MSG_ERROR(Invalid ibase directory - unable to find ibase.h)
		fi
	fi

	if test "$withval" != "no"; then
		if test -f $withval/include/ibase.h; then
			IBASE_INCDIR=$withval/include
			IBASE_LIBDIR=$withval/lib
		else
    			AC_MSG_RESULT(no)
			AC_MSG_ERROR(Invalid InterBase directory - unable to find ibase.h)
		fi
		if test $withval/lib/libfbclient.so; then
			
			IBASE_LFLAGS="-L$IBASE_LIBDIR -lfbclient"
		else
			IBASE_LFLAGS="-L$IBASE_LIBDIR -lgds"
		fi
		IBASE_INCLUDE="-I$IBASE_INCDIR"
		AC_DEFINE([HAVE_IBASE], [1], [Define if you want to use Interbase SQL Server])
		AC_MSG_RESULT($withval)
		have_db=yes
		dnl IB requires -lcrypt sometime
		AC_CHECK_FUNC(crypt, , AC_CHECK_LIB(crypt, crypt, IBASE_LFLAGS="$IBASE_LFLAGS -lcrypt"))
		dnl IB requires -ldl sometime
		AC_CHECK_FUNC(dlopen, , AC_CHECK_LIB(dl, dlopen, IBASE_LFLAGS="$IBASE_LFLAGS -ldl"))

		dnl InterBase lib on FreeBSD is in old aout format              
		dnl so we need to pass -aout flag to ranlib
		dnl if echo $build_os | grep -q freebsdelf; then
		dnl	RANLIB="$RANLIB -aout"
		dnl	CFLAGS="$CFLAGS -aout"
		dnl	AM_PROG_LIBTOOL
		dnl fi
	fi
    if test "x$DBTYPE" = "x" ; then
       DBTYPE="ibase"
    else
       DBTYPE="$DBTYPE-ibase"
    fi

],[
	AC_MSG_RESULT(no)
])
AC_SUBST(IBASE_LFLAGS)
AC_SUBST(IBASE_INCLUDE)

AC_MSG_CHECKING(for Ct-Lib support)
AC_ARG_WITH(ctlib,
[  --with-ctlib[=DIR]      Include Ct-Lib support.  DIR is the Ct-Lib
                          install directory, defaults to /opt/sybase.],
[
	if test "$withval" = "yes"; then
		withval=/opt/sybase
	fi

	if test "$withval" != "no"; then
		if test -f $withval/include/ctpublic.h; then
			CTLIB_INCDIR=$withval/include
			CTLIB_LIBDIR=$withval/lib
		else
    			AC_MSG_RESULT(no)
			AC_MSG_ERROR(Invalid Ct-Lib directory - unable to find ctpublic.h)
		fi
		if test -f $withval/lib/libsybct.a; then
			CTLIB_LFLAGS="-L$CTLIB_LIBDIR -lsybct -lsybcs -lsybtcl -lsybcomn -lsybintl -lsybunic"
		else
			CTLIB_LFLAGS="-L$CTLIB_LIBDIR -lct -lcs -lsybtcl -lcomn -lintl"
		fi
		CTLIB_INCLUDE="-I$CTLIB_INCDIR"
		AC_DEFINE([HAVE_CTLIB], [1], [Define if you want to use CT-LIB SyBase SQL Server])
		AC_MSG_RESULT(yes)
		have_db=yes
		dnl ctlib requires -ldl sometime
		AC_CHECK_FUNC(dlopen, , AC_CHECK_LIB(dl, dlopen, CTLIB_LFLAGS="$CTLIB_LFLAGS -ldl"))
	fi
    if test "x$DBTYPE" = "x" ; then
       DBTYPE="ctlib"
    else
       DBTYPE="$DBTYPE-ctlib"
    fi

],[
	AC_MSG_RESULT(no)
])
AC_SUBST(CTLIB_LFLAGS)
AC_SUBST(CTLIB_INCLUDE)


AC_MSG_CHECKING(for FreeTDS Ct-Lib support)
AC_ARG_WITH(freetds,
[  --with-freetds[=DIR]    Include FreeTDS Ct-Lib support.  DIR is the FreeTDS
                          install directory, defaults to /usr/local.],
[
	if test "$withval" = "yes"; then
		withval=/usr/local
	fi

	if test "$withval" != "no"; then
		if test -f $withval/include/ctpublic.h; then
			CTLIB_INCDIR=$withval/include
			CTLIB_LIBDIR=$withval/lib
		elif test -f $withval/include/freetds/ctpublic.h; then
			CTLIB_INCDIR=$withval/include/freetds
			CTLIB_LIBDIR=$withval/lib
		else
    			AC_MSG_RESULT(no)
			AC_MSG_ERROR(Invalid FreeTDS directory - unable to find ctpublic.h)
		fi
		CTLIB_LFLAGS="-L$CTLIB_LIBDIR -lct"
		CTLIB_INCLUDE="-I$CTLIB_INCDIR"
		AC_DEFINE([HAVE_CTLIB], [1], [Define if you want to use CT-LIB SyBase SQL Server])
		AC_MSG_RESULT(yes)
		have_db=yes
		AC_CHECK_FUNC(dlopen, , AC_CHECK_LIB(dl, dlopen, CTLIB_LFLAGS="$CTLIB_LFLAGS -ldl"))
	fi
    if test "x$DBTYPE" = "x" ; then
       DBTYPE="freetds"
    else
       DBTYPE="$DBTYPE-freetds"
    fi

],[
	AC_MSG_RESULT(no)
])
AC_SUBST(CTLIB_LFLAGS)
AC_SUBST(CTLIB_INCLUDE)


AC_MSG_CHECKING(for sqlite support)
AC_ARG_WITH(sqlite,
[  --with-sqlite[=DIR]     Include sqlite support.  DIR is the sqlite
                          install directory, default to search through
                          a number of common places for SQLite files,],
[
	path=""

	if test "$withval" = "yes"; then
		withval="/usr /usr/local"
	fi

	for d in $withval; do
		if test -f $d/include/sqlite.h; then
			SQLITE_INCDIR=$d/include
			SQLITE_LIBDIR=$d/lib
			SQLITE_LFLAGS="-L$SQLITE_LIBDIR -lsqlite"
			SQLITE_INCLUDE="-I$SQLITE_INCDIR"		
			path=$d
			AC_MSG_RESULT($d)
			AC_DEFINE([HAVE_SQLITE], [1], [Define if you want to use sqlite])
			break
		fi
	done

	if test "$path" = ""; then
		AC_MSG_RESULT(no)
		AC_MSG_ERROR(Invalid sqlite directory - unable to find sqlite.h or sqlite3.h)
	fi

	have_db=yes

	if test "x$DBTYPE" = "x" ; then
		DBTYPE="sqlite"
	else
		DBTYPE="$DBTYPE-sqlite"
	fi

],[
	AC_MSG_RESULT(no)
])
AC_SUBST(SQLITE_LFLAGS)
AC_SUBST(SQLITE_INCLUDE)


AC_MSG_CHECKING(for sqlite3 support)
AC_ARG_WITH(sqlite3,
[  --with-sqlite3[=DIR]    Include sqlite3 support.  DIR is the sqlite
                          install directory, default to search through
                          a number of common places for SQLite files,],
[
	path=""

	if test "$withval" = "yes"; then
		withval="/usr /usr/local"
	fi

	for d in $withval; do
		if test -f $d/include/sqlite3.h; then
			SQLITE3_INCDIR=$d/include
			SQLITE3_LIBDIR=$d/lib
			SQLITE3_LFLAGS="-L$SQLITE3_LIBDIR -lsqlite3"
			SQLITE3_INCLUDE="-I$SQLITE3_INCDIR"
			path=$d
			AC_MSG_RESULT($d)
			AC_DEFINE([HAVE_SQLITE3], [1], [Define if you want to use sqlite3])
			break
		fi
	done

	if test "$path" = ""; then
		AC_MSG_RESULT(no)
		AC_MSG_ERROR(Invalid sqlite directory - unable to find sqlite.h or sqlite3.h)
	fi

	have_db=yes

	if test "x$DBTYPE" = "x" ; then
		DBTYPE="sqlite"
	else
		DBTYPE="$DBTYPE-sqlite3"
	fi

],[
	AC_MSG_RESULT(no)
])
AC_SUBST(SQLITE3_LFLAGS)
AC_SUBST(SQLITE3_INCLUDE)


AC_MSG_CHECKING(for Oracle8 support)
AC_ARG_WITH(oracle8,
[  --with-oracle8[=DIR]    Include Oracle8 support.  DIR is the Oracle
                          home directory, defaults to $ORACLE_HOME or
                          /oracle8/app/oracle/product/8.0.5.],
[
	if test "$withval" = "yes"; then
		withval="$ORACLE_HOME"
		if test "$withval" = ""; then
			withval=/oracle8/app/oracle/product/8.0.5
		fi
	fi

	if test "$withval" != "no"; then
		if test -f $withval/rdbms/demo/oci.h; then
			ORACLE8_INCDIR1=$withval/rdbms/demo/
			ORACLE8_INCDIR2=$withval/rdbms/public/
			ORACLE8_INCDIR3=$withval/network/public/
			ORACLE8_INCDIR4=$withval/plsql/public/
			ORACLE8_LIBDIR1=$withval/lib
			ORACLE8_LIBDIR2=$withval/rdbms/lib
		else
    			AC_MSG_RESULT(no)
			AC_MSG_ERROR(Invalid ORACLE directory - unable to find oci.h)
		fi
                if test -f $withval/lib/libwtc8.so; then
                         ORACLE8_LIBS="-lwtc8"
                fi

		ORACLE8_LFLAGS="-L$ORACLE8_LIBDIR1 -L$ORACLE8_LIBDIR2$ORACLE8_LIBS  -lclntsh -lmm -lepc -lclient -lvsn -lcommon -lgeneric -lcore4 -lnlsrtl3 -lm -lnetv2 -lnttcp -lnetwork -lncr -lsql"
		ORACLE8_INCLUDE="-I$ORACLE8_INCDIR1 -I$ORACLE8_INCDIR2 -I$ORACLE8_INCDIR3 -I$ORACLE8_INCDIR4"
 		AC_DEFINE([HAVE_ORACLE8], [1], [Define if you want to use Oracle 8 SQL Server])
		AC_MSG_RESULT(yes)
		have_db=yes
	fi
    if test "x$DBTYPE" = "x" ; then
       DBTYPE="oracle8"
    else
       DBTYPE="$DBTYPE-oracle8"
    fi

],[
	AC_MSG_RESULT(no)
])
AC_SUBST(ORACLE8_LFLAGS)
AC_SUBST(ORACLE8_INCLUDE)


AC_MSG_CHECKING(for Oracle8i support)
AC_ARG_WITH(oracle8i,
[  --with-oracle8i[=DIR]   Include Oracle8i support.  DIR is the Oracle
                          home directory, defaults to $ORACLE_HOME],
[
	if test "$withval" = "yes"; then
		withval="$ORACLE_HOME"
	fi

	if test "$withval" != "no"; then
		if test -f $withval/rdbms/demo/oci.h; then
			ORACLE8_INCDIR1=$withval/rdbms/demo/
			ORACLE8_INCDIR2=$withval/rdbms/public/
			ORACLE8_INCDIR3=$withval/network/public/
			ORACLE8_INCDIR4=$withval/plsql/public/
			ORACLE8_LIBDIR1=$withval/lib
			ORACLE8_LIBDIR2=$withval/rdbms/lib

			ORACLE8_LFLAGS="-L$ORACLE8_LIBDIR1 -L$ORACLE8_LIBDIR2 -lclntsh -lmm -lm"
			ORACLE8_INCLUDE="-I$ORACLE8_INCDIR1 -I$ORACLE8_INCDIR2 -I$ORACLE8_INCDIR3 -I$ORACLE8_INCDIR4"
 			AC_DEFINE([HAVE_ORACLE8], [1], [Define if you want to use Oracle 8 SQL Server])
			AC_MSG_RESULT($withval)
			have_db=yes
		elif test -f $withval/rdbms/public/oci.h; then
			ORACLE8_INCDIR1=$withval/rdbms/public/
			ORACLE8_LIBDIR1=$withval/lib
			ORACLE8_LIBDIR2=$withval/rdbms/lib

			ORACLE8_LFLAGS="-L$ORACLE8_LIBDIR1 -L$ORACLE8_LIBDIR2 -lclntsh -lnnz10 -lm"
			ORACLE8_INCLUDE="-I$ORACLE8_INCDIR1"
 			AC_DEFINE([HAVE_ORACLE8], [1], [Define if you want to use Oracle 8 SQL Server])
			AC_MSG_RESULT($withval)
			have_db=yes
		else
    			AC_MSG_RESULT(no)
			AC_MSG_ERROR(Invalid ORACLE directory - unable to find oci.h)
		fi
	fi
    if test "x$DBTYPE" = "x" ; then
       DBTYPE="oracle8i"
    else
       DBTYPE="$DBTYPE-oracle8i"
    fi

],[
	AC_MSG_RESULT(no)
])
AC_SUBST(ORACLE8_LFLAGS)
AC_SUBST(ORACLE8_INCLUDE)



AC_DIVERT_PUSH(0)
define(DCHARSETS_AVAILABLE,big5 gb2312 gbk japanese euc-kr gujarati tscii)
CHARSETS_AVAILABLE="DCHARSETS_AVAILABLE"
AC_DIVERT_POP

AC_ARG_WITH(extra-charsets,
  [  --with-extra-charsets=CHARSET[,CHARSET,...]
                          Use additional non-default charsets:
                          none, all or a comma separated list from this set:
                          DCHARSETS_AVAILABLE],
  [extra_charsets="$withval"],
  [extra_charsets="none"])

AC_MSG_CHECKING(for additional character sets)

if test "$extra_charsets" = no; then
  CHARSETS=""
elif test "$extra_charsets" = none; then
  CHARSETS=""
else
  if test "$extra_charsets" = all; then
    CHARSETS="$CHARSETS_AVAILABLE"
  else
    CHARSETS=`echo $extra_charsets | sed -e 's/,/ /g'`
  fi
fi

for cs in $CHARSETS
do
  case $cs in 
    big5)
      AC_DEFINE([HAVE_CHARSET_big5], [1], [Define if you want Chinese big5 support])
      ;;
    euc-kr)
      AC_DEFINE([HAVE_CHARSET_euc_kr], [1], [Define if you want Korean euc-kr support])
      ;;
    gb2312)
      AC_DEFINE([HAVE_CHARSET_gb2312], [1], [Define if you want Chinese gb2312 support])
      ;;
    japanese)
      AC_DEFINE([HAVE_CHARSET_japanese], [1], [Define if you want Japanese support])
      ;;
    gbk)
      AC_DEFINE([HAVE_CHARSET_gbk], [1], [Define if you want Chinese gbk support])
      ;;
    gujarati)
      AC_DEFINE([HAVE_CHARSET_gujarati], [1], [Define if you want gujarati support])
      ;;
    tscii)
      AC_DEFINE([HAVE_CHARSET_tscii], [1], [Define if you want tscii support])
      ;;
    *)
      AC_MSG_ERROR([Charset $cs not available. (Available: $CHARSETS_AVAILABLE).]);
  esac
  ADDCHARSETS="$ADDCHARSETS $cs"
done

AC_MSG_RESULT($ADDCHARSETS)


dnl Check if one of databases was selected
if test "$have_db" != "yes"; then
	db_PROGS=""
else	
	db_PROGS="indexer"
fi

AC_SUBST(db_PROGS)
AC_DEFINE_UNQUOTED([UDM_DBTYPE], ["$DBTYPE"], [Define UDM_DBTYPE])
AC_SUBST(DBTYPE)
CDIR=`pwd`
AC_SUBST(CDIR)
AC_OUTPUT(Makefile include/Makefile src/Makefile doc/Makefile etc/Makefile dnl
  misc/Makefile scripts/Makefile create/Makefile dnl
  create/db2/Makefile create/ibase/Makefile dnl
  create/mssql/Makefile create/mysql/Makefile create/oracle/Makefile dnl
  create/pgsql/Makefile create/sapdb/Makefile create/solid/Makefile dnl
  create/sybase/Makefile create/virtuoso/Makefile create/sqlite/Makefile dnl
  create/mimer/Makefile create/cache/Makefile dnl
  scripts/udm-config dnl
  perl/Makefile.PL msearch-test/Makefile)


if test "$have_db" != "yes"; then
	echo
	echo
	echo "No database selected! indexering part will not be compiled"
	echo "If it's incorrect, use --with-XXX where XXX is your preferred database type"
fi

echo
echo "***********************************************************"
echo "*                                                         *"
echo "*     Now run make && make install                        *"
echo "*     If it fails, try to use GNU make,                   *"
echo "*     often installed as gmake.                           *"
echo "*                                                         *"
echo "*                                                         *"
echo "*            Thank you for using mnoGoSearch!             *"
echo "***********************************************************"
echo