File: acinclude.m4

package info (click to toggle)
hk-classes 0.8.2-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 10,872 kB
  • ctags: 16,819
  • sloc: cpp: 90,990; ansic: 78,016; sh: 8,385; python: 3,793; makefile: 292
file content (1390 lines) | stat: -rw-r--r-- 33,333 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
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
dnl    This file is part of the hk_classes libraries/packages
dnl    Copyright (C) 2001-2003 Horst Knorr (hk_classes@knoda.org)

dnl    This file is free software; you can redistribute it and/or
dnl    modify it under the terms of the GNU Library General Public
dnl    License as published by the Free Software Foundation;
dnl    version 2 of the License.

dnl    This library is distributed in the hope that it will be useful,
dnl    but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
dnl    Library General Public License for more details.

dnl    You should have received a copy of the GNU Library General Public License
dnl    along with this library; see the file COPYING.LIB.  If not, write to
dnl    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
dnl    Boston, MA 02111-1307, USA.

dnl 	$Id: acinclude.m4,v 1.75 2006/10/03 10:33:07 knorr Exp $







AC_DEFUN([HK_CLASSESINIT],
[
AC_MSG_CHECKING([HK_CLASSES INIT])
AC_MSG_RESULT(OK)

AC_MSG_CHECKING([whether this is a 64bit system])
AC_TRY_LINK([],[#ifndef __LP64__ 
#error "no 64 bit system" 
#endif
],[x64bit=yes],[x64bit=no])
AC_MSG_RESULT($x64bit)


if test "$prefix" = "NONE"; then
  if test $x64bit = "yes"; then
  HK_CLASSESDIR=/usr/lib64/hk_classes
  BITARCHITECTURE="-m64"
  
    else
  HK_CLASSESDIR=/usr/lib/hk_classes
  BITARCHITECTURE="-m32"
  
  fi
  
 HK_CLASSESINCDIR=/usr/include/hk_classes
else
 HK_CLASSESDIR=$libdir/hk_classes
 HK_CLASSESINCDIR=$includedir/hk_classes
fi
if test "$with_hk_classes_incdir" != ""; then
HK_CLASSESINCDIR=$with_hk_classes_incdir
fi

HKPYTHONDIR=""
UTILITIESDIR=""
AC_SUBST(HK_CLASSESDIR)
AC_SUBST(HK_CLASSESINCDIR)
NODRIVER=true
POSSIBLE_DRIVERS="FIREBIRD,MYSQL,ODBC,PARADOX,POSTGRESQL,SQLITE2,SQLITE3,MDB,XBASE"
dnl AC_DEFINE_UNQUOTED(HKCLASSES, "$HK_CLASSESDIR",[PREPROCESSOR DEFINITION])
AC_SUBST(BITARCHITECTURE)
])




AC_DEFUN([HK_MYSQLTEST],
[
if test "$want_mysql" = "yes"; then
AC_MSG_CHECKING([whether MYSQL is available])
if test "$with_mysql_dir" = ""; then
  if test "$want_64bit" = "yes"; then
   MYSQLLIBDIR=/usr/lib64/mysql
   else
   MYSQLLIBDIR=/usr/lib/mysql
   fi
   MYSQLINCDIR=/usr/include/mysql
else MYSQLLIBDIR=$with_mysql_dir/lib
MYSQLINCDIR=$with_mysql_dir/include
fi

if test "x$with_mysql_incdir" != "x"; then
 MYSQLINCDIR=$with_mysql_incdir
fi

if test "x$with_mysql_libdir" != "x"; then
 MYSQLLIBDIR=$with_mysql_libdir
fi


ac_save_LIBS="$LIBS"
ac_save_CPPFLAGS="$CPPFLAGS"
ac_save_CXXLIBS="$CXXLIBS"

CXXLIBS="$ac_save_CXXLIBS -L${MYSQLLIBDIR} -lmysqlclient"
LIBS="$ac_save_LIBS -L${MYSQLLIBDIR} -lmysqlclient"
CPPFLAGS="$ac_save_CPPFLAGS -I$MYSQLINCDIR"

AC_TRY_LINK([#include <mysql.h>],[;],[mysql_lib=yes],[mysql_lib=no])

AC_MSG_RESULT($mysql_lib)
if test $mysql_lib = yes ; then
NODRIVER=false
DRIVERSDIR="$DRIVERSDIR hk_mysqlclasses"
AC_SUBST(MYSQLLIBDIR)
AC_SUBST(MYSQLINCDIR)

CXXLIBS="$ac_save_CXXLIBS "
LIBS="$ac_save_LIBS "
CPPFLAGS="$ac_save_CPPFLAGS "


MYSQLREALESCAPE
fi


LIBS="$ac_save_LIBS"
CPPFLAGS="$ac_save_CPPFLAGS"
CXXLIBS="$ac_save_CXXLIBS"

fi
])

AC_DEFUN([MYSQLREALESCAPE],
[

AC_MSG_CHECKING([MYSQL has mysql_real_escape_string function])


AC_TRY_LINK([#include <mysql.h>],[
MYSQL* m;
char* to;
 mysql_real_escape_string(m,to,"test",4);
],[mysql_real=yes],[mysql_real=no])

AC_MSG_RESULT($mysql_real)
if test $mysql_real = yes ; then
AC_DEFINE(HAVE_MYSQL_REAL_ESCAPE_STRING,1,Defines if Mysql has the mysql_real_escape_string function)
fi


])




AC_DEFUN([HK_POSTGRESTEST],
[
if test "$want_postgres" = "yes"; then
AC_MSG_CHECKING([whether POSTGRES is available])
if test "$with_postgres_dir" = ""; then
  if test "$want_64bit" = "yes"; then
   POSTGRESLIBDIR=/usr/local/pgsql/lib64
   else
   POSTGRESLIBDIR=/usr/local/pgsql/lib
   fi
   POSTGRESINCDIR=/usr/include/pgsql
else
   POSTGRESLIBDIR=$with_postgres_dir/lib
   POSTGRESINCDIR=$with_postgres_dir/include
fi

if test "x$with_postgres_incdir" != "x"; then
 POSTGRESINCDIR=$with_postgres_incdir
fi

if test "x$with_postgres_libdir" != "x"; then
 POSTGRESLIBDIR=$with_postgres_libdir
fi


ac_save_LIBS="$LIBS"
ac_save_CPPFLAGS="$CPPFLAGS"
ac_save_CXXLIBS="$CXXLIBS"

CXXLIBS="$ac_save_CXXLIBS -L${POSTGRESLIBDIR} -lpq"
LIBS="$ac_save_LIBS -L${POSTGRESLIBDIR} -lpq"
CPPFLAGS="$ac_save_CPPFLAGS -I$POSTGRESINCDIR"

AC_TRY_LINK([#include <libpq-fe.h>],[;],[postgres_lib=yes],[postgres_lib=no])

AC_MSG_RESULT($postgres_lib)
if test $postgres_lib = yes ; then
NODRIVER=false
DRIVERSDIR="$DRIVERSDIR hk_postgresclasses"
AC_SUBST(POSTGRESLIBDIR)
AC_SUBST(POSTGRESINCDIR)
fi


LIBS="$ac_save_LIBS"
CPPFLAGS="$ac_save_CPPFLAGS"
CXXLIBS="$ac_save_CXXLIBS"
echo "POSTGRES LIBS" $LIBS "CPPFLAGS=" $CPPFLAGS "CXXFLAGS=" $CXXFLAGS
fi


])








AC_DEFUN([HK_ODBCTEST],
[
if test "$want_odbc" = "yes"; then
AC_MSG_CHECKING([whether ODBC is available])
if test "$ODBCDIR" = ""; then
  if test "$want_64bit" = "yes"; then
   ODBCLIBDIR=/usr/local/lib64
   else
   ODBCLIBDIR=/usr/local/lib
   fi
   ODBCINCDIR=/usr/local/include
else ODBCLIBDIR=$ODBCDIR/lib
ODBCLINCDIR=$ODBCDIR/include
fi
ac_save_LIBS="$LIBS"
ac_save_CPPFLAGS="$CPPFLAGS"
ac_save_CXXLIBS="$CXXLIBS"

if test "$with_odbc_incdir" != ""; then

ODBCINCDIR=$with_odbc_incdir

fi

if test "$with_odbc_libdir" != ""; then

ODBCLIBDIR=$with_odbc_libdir

fi



CXXLIBS="$ac_save_CXXLIBS -L${ODBCLIBDIR} -lodbc"
LIBS="$ac_save_LIBS -L${ODBCLIBDIR} -lodbc"
CPPFLAGS="$ac_save_CPPFLAGS -I$ODBCINCDIR"




AC_TRY_LINK([#include <sql.h>],[;],[odbc_lib=yes],[odbc_lib=no])
if test x$odbc_lib = xno ; then
if test "$ODBCDIR" = ""; then
  if test "$want_64bit" = "yes"; then
   ODBCLIBDIR=/usr/local/lib64
   else
   ODBCLIBDIR=/usr/local/lib
   fi
   ODBCINCDIR=/usr/include/
fi



LIBS="$ac_save_LIBS -L${ODBCLIBDIR} -lodbc"
CPPFLAGS="$ac_save_CPPFLAGS -I$ODBCINCDIR"

AC_TRY_LINK([#include <sql.h>],[;],[odbc_lib=yes],[odbc_lib=no])
fi


if test x$odbc_lib = xyes ; then
ODBCLIBRARY="odbc"
else
LIBS="$ac_save_LIBS -L${ODBCLIBDIR} -liodbc"
CPPFLAGS="$ac_save_CPPFLAGS -I$ODBCINCDIR"
 AC_TRY_LINK([#include <sql.h>],[;],[odbc_lib=yes],[odbc_lib=no])
 if test x$odbc_lib = xyes ; then
 ODBCLIBRARY="iodbc"
 fi
fi

AC_MSG_RESULT($odbc_lib)
if test x$odbc_lib = xyes ; then
NODRIVER=false
DRIVERSDIR="$DRIVERSDIR hk_odbcclasses"
AC_SUBST(ODBCLIBDIR)
AC_SUBST(ODBCINCDIR)
AC_SUBST(ODBCLIBRARY)

CXXLIBS="$ac_save_CXXLIBS "
LIBS="$ac_save_LIBS "
CPPFLAGS="$ac_save_CPPFLAGS "



AC_DEFINE_UNQUOTED(ODBCLIBRARY,"$ODBCLIBRARY",[DEFINES THE NAME OF THE ODBC LIBRARY])
dnl else
dnl  AC_MSG_ERROR( ODBC not found )

fi
LIBS="$ac_save_LIBS"
CPPFLAGS="$ac_save_CPPFLAGS"
CXXLIBS="$ac_save_CXXLIBS"
fi

])







AC_DEFUN([HK_DEFINEDRIVERS],
[
AC_SUBST(DRIVERSDIR)
AC_SUBST(NODRIVER)
AC_SUBST(POSSIBLE_DRIVERS)
AC_SUBST(HKPYTHONDIR)

])

AC_DEFUN([AC_SSTREAM_EXISTS],
[

AC_MSG_CHECKING([whether <sstream> exists])
AC_TRY_LINK([#include <sstream>],[;],[sstream_exists=yes],[sstream_exists=no])
AC_MSG_RESULT($sstream_exists)
if test $sstream_exists = yes ; then
AC_DEFINE(HAVE_SSTREAM,1,Defines if stdc++ library contains a sstream implementation)
else
AC_DEFINE(HAVE_NO_SSTREAM,1,Defined if stdc++ library does not contain a sstream implementation)
fi

])

AC_DEFUN([AC_IOSTREAM_EXISTS],
[

AC_MSG_CHECKING([whether <iostream> exists])
AC_TRY_LINK([#include <iostream>],[;],[iostream_exists=yes],[iostream_exists=no])
AC_MSG_RESULT($iostream_exists)
if test $iostream_exists = yes ; then
AC_DEFINE(HAVE_IOSTREAM,1,Defines if stdc++ library contains a <iostream> implementation)
else
AC_DEFINE(NO_IOSTREAM,1,Defines that stdc++ library does not have a new <iostream> implementation , using <iostream.h> instead)

fi

])


AC_DEFUN([AC_MAGIC_EXISTS],
[

AC_MSG_CHECKING([whether the <magic> library exists])

ac_save_LIBS="$LIBS"

LIBS="$ac_save_LIBS -lmagic"

AC_TRY_LINK([#include <magic.h>],[magic_set *magic;],[magic_exists=yes],[magic_exists=no])
AC_MSG_RESULT($magic_exists)
if test $magic_exists = no ; then
	   AC_MSG_ERROR([
  Could not link to the 'magic' library
  ============================================================================
   ERROR!
   You probably have to install the development version of the 'magic' package
   for your distribution (don't mix it up with libmagick, that's a different package).  
   The exact name of this package varies among them (some distributions have it in 'file-yxx.rpm').
  ============================================================================
	   ])

fi

LIBS="$ac_save_LIBS "


])




AC_DEFUN([HK_CLEARENV_EXISTS],
[
AC_MSG_CHECKING([whether clearenv() is available])
AC_TRY_LINK([#include <stdlib.h>],[clearenv();],[ac_clearenv=yes],[ac_clearenv=no])
if test $ac_clearenv = yes ; then
AC_DEFINE(HAVE_CLEARENV,1,Defines if stdlib has function clearenv)
fi
AC_MSG_RESULT($ac_clearenv)
])


AC_DEFUN([HK_CHECK_ARGP_EXISTS],
[
dnl argp.h is not available on FreeBSD !
AC_MSG_CHECKING([whether argp.h is available])
AC_TRY_LINK([#include <argp.h>],[;],[ac_argp=yes],[ac_argp=no])
if test $ac_argp = yes ; then
AC_DEFINE(HAVE_ARGP,1,Defines whether argp.h exists)
 UTILITIESDIR="utilities"

fi
AC_SUBST(UTILITIESDIR)
AC_MSG_RESULT($ac_argp)

])


dnl the following makro has been taken from GNU gettext
dnl and modified to fit for HK_CLASSES
dnl 17.02.2002 Horst Knorr


dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License.  As a special exception to the GNU General
dnl Public License, this file may be distributed as part of a program
dnl that contains a configuration script generated by Autoconf, under
dnl the same distribution terms as the rest of that program.

dnl From Bruno Haible.

AC_DEFUN([AM_ICONV_LINK],
[
  dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
  dnl those with the standalone portable GNU libiconv installed).

  dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
  dnl AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
  dnl AC_REQUIRE([AC_LIB_RPATH])

  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
  dnl accordingly.
  dnl AC_LIB_LINKFLAGS_BODY([iconv])

  AC_MSG_CHECKING([if libiconv is present])
  ac_save_LIBS="$LIBS"
  LIBS="$ac_save_LIBS -liconv"
  AC_TRY_LINK(,
    [;],
    LIBICONV="-liconv"
    ac_liconv="yes",
    LIBS="$ac_save_LIBS"
    ac_liconv="no")
  AC_MSG_RESULT($ac_liconv)
  dnl Add $INCICONV to CPPFLAGS before performing the following checks,
  dnl because if the user has installed libiconv and not disabled its use
  dnl via --without-libiconv-prefix, he wants to use it. The first
  dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
  am_save_CPPFLAGS="$CPPFLAGS"
  dnl AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])

  AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
    am_cv_func_iconv="no, consider installing GNU libiconv"
    am_cv_lib_iconv=no
    AC_TRY_LINK([#include <stdlib.h>
#include <iconv.h>],
      [iconv_t cd = iconv_open("","");
       iconv(cd,NULL,NULL,NULL,NULL);
       iconv_close(cd);],
      am_cv_func_iconv=yes)
    if test "$am_cv_func_iconv" != yes; then
      am_save_LIBS="$LIBS"
      LIBS="$LIBS $LIBICONV"
      AC_TRY_LINK([#include <stdlib.h>
#include <iconv.h>],
        [iconv_t cd = iconv_open("","");
         iconv(cd,NULL,NULL,NULL,NULL);
         iconv_close(cd);],
        am_cv_lib_iconv=yes
        am_cv_func_iconv=yes)
      LIBS="$am_save_LIBS"
    fi
  ])
  if test "$am_cv_func_iconv" = yes; then
    AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
  fi
  if test "$am_cv_lib_iconv" = yes; then
    AC_MSG_CHECKING([how to link with libiconv])
    AC_MSG_RESULT([$LIBICONV])
  else
    dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
    dnl either.
    CPPFLAGS="$am_save_CPPFLAGS"
    LIBICONV=
    LTLIBICONV=
  fi
  if test "$am_cv_func_iconv" != "yes" ; then
   if  test "$am_cv_lib_iconv" != "yes" ; then
      AC_MSG_ERROR(
        No iconv installation found. Either you have a very old libc or a system that doesn't support
        this function. Perhaps you should install the library libiconv from Bruno Haible.
       )
   fi
  fi



LIBS="$ac_save_LIBS "


  AC_SUBST(LIBICONV)
  AC_SUBST(LTLIBICONV)
])

AC_DEFUN([AM_ICONV],
[
  AC_REQUIRE([AM_ICONV_LINK])
  if test "$am_cv_func_iconv" = yes; then
    AC_MSG_CHECKING([for iconv declaration])
    AC_CACHE_VAL(am_cv_proto_iconv, [
      AC_TRY_COMPILE([
#include <stdlib.h>
#include <iconv.h>
extern
#ifdef __cplusplus
"C"
#endif
#if defined(__STDC__) || defined(__cplusplus)
size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
#else
size_t iconv();
#endif
], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
      am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
    am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
    AC_MSG_RESULT([$]{ac_t:-
         }[$]am_cv_proto_iconv)
    AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
      [Define as const if the declaration of iconv() needs const.])
  fi
])














AC_DEFUN([HK_SQLITE2TEST],
[
if test "$want_sqlite" = "yes"; then

if test "x$want_sqlite2library" != "xno"; then


AC_MSG_CHECKING([whether SQLITE2 is available])
if test "$with_sqlite_dir" = ""; then
  if test "$want_64bit" = "yes"; then
   SQLITELIBDIR=/usr/local/lib64
  else
   SQLITELIBDIR=/usr/local/lib
  fi
   SQLITEINCDIR=/usr/local/include
else SQLITELIBDIR=$with_sqlite_dir/lib
SQLITEINCDIR=$with_sqlite_dir/include
fi

if test "x$with_sqlite_incdir" != "x"; then
 SQLITEINCDIR=$with_sqlite_incdir
fi

if test "x$with_sqlite_libdir" != "x"; then
 SQLITELIBDIR=$with_sqlite_libdir
fi


ac_save_LIBS="$LIBS"
ac_save_CPPFLAGS="$CPPFLAGS"
ac_save_CXXLIBS="$CXXLIBS"

CXXLIBS="$ac_save_CXXLIBS -L${SQLITELIBDIR} -lsqlite"
LIBS="$ac_save_LIBS -L${SQLITELIBDIR} -lsqlite"
CPPFLAGS="$ac_save_CPPFLAGS -I$SQLITEINCDIR"

AC_TRY_LINK([#include <sqlite.h>],[char* errormsg=0;
sqlite* mydb=sqlite_open("",0,&errormsg);
sqlite_vm *vm=0;
int result =sqlite_compile(mydb,"",0,&vm,&errormsg);
;],[sqlite_lib=yes],[sqlite_lib=no])

AC_MSG_RESULT($sqlite_lib)
if test $sqlite_lib = yes ; then
NODRIVER=false
DRIVERSDIR="$DRIVERSDIR hk_sqliteclasses"
AC_SUBST(SQLITELIBDIR)
AC_SUBST(SQLITEINCDIR)


LIBS="$ac_save_LIBS"
CPPFLAGS="$ac_save_CPPFLAGS"
CXXLIBS="$ac_save_CXXLIBS"
fi




else
AC_MSG_CHECKING([whether the SQLITE2 driver will be installed])

NODRIVER=false
DRIVERSDIR="$DRIVERSDIR hk_sqliteclasses"
AC_MSG_RESULT(yes)
fi

fi
AM_CONDITIONAL(USESQLITE2LIBRARY,test x$sqlite_lib = xyes )

])




















AC_DEFUN([HK_SQLITE3TEST],
[
if test "$want_sqlite3" = "yes"; then

if test "x$want_sqlite3library" != "xno"; then


AC_MSG_CHECKING([whether SQLITE3 is available])
if test "$with_sqlite3_dir" = ""; then
   
  if test "$want_64bit" = "yes"; then
   SQLITE3LIBDIR=/usr/local/lib64
   else
   SQLITE3LIBDIR=/usr/local/lib
   fi
   SQLITE3INCDIR=/usr/local/include
else SQLITE3LIBDIR=$with_sqlite3_dir/lib
SQLITE3INCDIR=$with_sqlite3_dir/include
fi

if test "x$with_sqlite3_incdir" != "x"; then
 SQLITE3INCDIR=$with_sqlite3_incdir
fi

if test "x$with_sqlite3_libdir" != "x"; then
 SQLITE3LIBDIR=$with_sqlite3_libdir
fi


ac_save_LIBS="$LIBS"
ac_save_CPPFLAGS="$CPPFLAGS"
ac_save_CXXLIBS="$CXXLIBS"

CXXLIBS="$ac_save_CXXLIBS -L${SQLITE3LIBDIR} -lsqlite3"
LIBS="$ac_save_LIBS -L${SQLITE3LIBDIR} -lsqlite3"
CPPFLAGS="$ac_save_CPPFLAGS -I$SQLITE3INCDIR"

AC_TRY_LINK([#include <sqlite3.h>],[
sqlite3* mydb;
sqlite3_open("",&mydb);
sqlite3_stmt *vm=0;
int result =sqlite3_prepare(mydb,"",0,&vm,0);
;],[sqlite3_lib=yes],[sqlite3_lib=no])

AC_MSG_RESULT($sqlite3_lib)
if test $sqlite3_lib = yes ; then
NODRIVER=false
DRIVERSDIR="$DRIVERSDIR hk_sqlite3classes"
AC_SUBST(SQLITE3LIBDIR)
AC_SUBST(SQLITE3INCDIR)


LIBS="$ac_save_LIBS"
CPPFLAGS="$ac_save_CPPFLAGS"
CXXLIBS="$ac_save_CXXLIBS"
fi




else
AC_MSG_CHECKING([whether the SQLITE3 driver will be installed])

NODRIVER=false
DRIVERSDIR="$DRIVERSDIR hk_sqlite3classes"
AC_MSG_RESULT(yes)
fi

fi
AM_CONDITIONAL(USESQLITE3LIBRARY,test x$sqlite3_lib = xyes )

])



AC_DEFUN([HK_PGKCONFIG],[
if test "$want_mdb" = "yes"; then

dnl Check for pkg-config
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)

if test "$PKG_CONFIG" = "no"; then
  AC_MSG_ERROR([This package requires pkg-config.])
fi

dnl Check for Glib-2.0
# GLIB_CFLAGS:  cflags for compiling glib dependant sources
# GLIB_LIBADD:  glib libraries (-l options)
# GLIB_LDFLAGS: flags containing path to glib libraries (-L options)

GLIB_PACKAGES="glib-2.0"
GLIB_VERSION="2.4"
AC_MSG_CHECKING(whether the MDB/ACCESS driver will be installed)

if $PKG_CONFIG --atleast-pkgconfig-version 0.15 ; then
  if $PKG_CONFIG --atleast-version $GLIB_VERSION $GLIB_PACKAGES >/dev/null 2>&1 ; then
    GLIB_CFLAGS="`$PKG_CONFIG --cflags $GLIB_PACKAGES`"
    GLIB_LIBADD="`$PKG_CONFIG --libs-only-l --libs-only-other $GLIB_PACKAGES`"
    GLIB_LDFLAGS="`$PKG_CONFIG --libs-only-L $GLIB_PACKAGES`"
    AC_MSG_RESULT(yes)
  fi
else
  if $PKG_CONFIG --atleast-version $GLIB_VERSION $GLIB_PACKAGES >/dev/null 2>&1 ; then
    GLIB_CFLAGS="`$PKG_CONFIG --cflags $GLIB_PACKAGES`"
    GLIB_LIBADD="`$PKG_CONFIG --libs-only-l $GLIB_PACKAGES`"
    GLIB_LDFLAGS="`$PKG_CONFIG --libs-only-L $GLIB_PACKAGES`"
  fi
fi

if test -z "$GLIB_LIBADD"; then
  AC_MSG_RESULT( GLib-2.0 (at least $GLIB_VERSION) is missing)
else
CPPFLAGS="$CPPFLAGS $GLIB_CFLAGS"
CFLAGS="$CFLAGS $GLIB_CFLAGS"

AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBADD)
AC_SUBST(GLIB_LDFLAGS)

CXXLIBS="$ac_save_CXXLIBS "
LIBS="$ac_save_LIBS "
CPPFLAGS="$ac_save_CPPFLAGS "

NODRIVER=false
DRIVERSDIR="$DRIVERSDIR hk_mdbclasses"
AC_MSG_RESULT(yes)

fi
fi

])



AC_DEFUN([HK_MDBTEST],
[
AC_REQUIRE([HK_PGKCONFIG])

])






AC_DEFUN([HK_XBASETEST],
[

if test "$want_xbase" = "yes"; then
AC_MSG_CHECKING([whether XBASE is available])
if test "$with_xbase_dir" = ""; then
  if test "$want_64bit" = "yes"; then
   XBASELIBDIR=/usr/local/lib64
  else
   XBASELIBDIR=/usr/local/lib
  fi
   XBASEINCDIR=/usr/local/include
else XBASELIBDIR=$with_xbase_dir/lib
XBASEINCDIR=$with_xbase_dir/include
fi

if test "x$with_xbase_incdir" != "x"; then
 XBASEINCDIR=$with_xbase_incdir
fi

if test "x$with_xbase_libdir" != "x"; then
 XBASELIBDIR=$with_xbase_libdir
fi

ac_save_LIBS="$LIBS"
ac_save_CPPFLAGS="$CPPFLAGS"
ac_save_CXXLIBS="$CXXLIBS"

CXXLIBS="$ac_save_CXXLIBS -L${XBASELIBDIR}"
LIBS="$ac_save_LIBS -L${XBASELIBDIR}  -lxbsql "
CPPFLAGS="$ac_save_CPPFLAGS -I .  -I $XBASEINCDIR  "

AC_TRY_LINK([#include <xbsql.h>],[
XBaseSQL xb ("tst");

;],[xbase_lib=yes],[xbase_lib=no])

AC_MSG_RESULT($xbase_lib)
if test $xbase_lib = yes ; then
NODRIVER=false
DRIVERSDIR="$DRIVERSDIR hk_xbaseclasses"
AC_SUBST(XBASELIBDIR)
AC_SUBST(XBASEINCDIR)
fi


LIBS="$ac_save_LIBS"
CPPFLAGS="$ac_save_CPPFLAGS"
CXXLIBS="$ac_save_CXXLIBS"
fi

])







AC_DEFUN([HK_PARADOXTEST],
[

AC_MSG_CHECKING([whether the PARADOX (pxlib) driver will be installed])
if test "$want_paradox" = "yes"; then
NODRIVER=false
DRIVERSDIR="$DRIVERSDIR hk_paradoxclasses"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi

])






AC_DEFUN([HK_DBASETEST],
[

AC_MSG_CHECKING([whether the DBASE driver will be installed])
if test "$want_dbase" = "yes"; then
NODRIVER=false
DRIVERSDIR="$DRIVERSDIR hk_dbaseclasses"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi

])






AC_DEFUN([HK_FIREBIRDTEST],
[

if test "$want_firebird" = "yes"; then
AC_MSG_CHECKING([whether FIREBIRD is available])
if test "$with_firebird_dir" = ""; then
  if test "$want_64bit" = "yes"; then
   FIREBIRDLIBDIR=/opt/firebird/lib64
   else
   FIREBIRDLIBDIR=/opt/firebird/lib
   fi
   FIREBIRDINCDIR=/opt/firebird/include
else FIREBIRDLIBDIR=$with_firebird_dir/lib
FIREBIRDINCDIR=$with_firebird_dir/include
fi

if test "x$with_firebird_incdir" != "x"; then
 FIREBIRDINCDIR=$with_firebird_incdir
fi

if test "x$with_firebird_libdir" != "x"; then
 FIREBIRDLIBDIR=$with_firebird_libdir
fi

ac_save_LIBS="$LIBS"
ac_save_CPPFLAGS="$CPPFLAGS"
ac_save_CXXLIBS="$CXXLIBS"

CXXLIBS="$ac_save_CXXLIBS -L${FIREBIRDLIBDIR}"
LIBS="$ac_save_LIBS -L${FIREBIRDLIBDIR}  -lfbclient "
CPPFLAGS="$ac_save_CPPFLAGS -I .  -I $FIREBIRDINCDIR  "

AC_TRY_LINK([
#include <ibase.h>
],[
isc_db_handle   newdb;
;],[firebird_lib=yes],[firebird_lib=no])

AC_MSG_RESULT($firebird_lib)
if test $firebird_lib = yes ; then
NODRIVER=false
DRIVERSDIR="$DRIVERSDIR hk_firebirdclasses"
AC_SUBST(FIREBIRDLIBDIR)
AC_SUBST(FIREBIRDINCDIR)
fi


LIBS="$ac_save_LIBS"
CPPFLAGS="$ac_save_CPPFLAGS"
CXXLIBS="$ac_save_CXXLIBS"
fi

])



AC_DEFUN([HK_FIREBIRD2TEST],
[

if test "$want_firebird" = "yes"; then
AC_MSG_CHECKING([whether FIREBIRD2 is available])
if test "$with_firebird_dir" = ""; then
  if test "$want_64bit" = "yes"; then
   FIREBIRDLIBDIR=/opt/firebird/lib64
   else
   FIREBIRDLIBDIR=/opt/firebird/lib
   fi
   FIREBIRDINCDIR=/opt/firebird/include
else FIREBIRDLIBDIR=$with_firebird_dir/lib
FIREBIRDINCDIR=$with_firebird_dir/include
fi

if test "x$with_firebird_incdir" != "x"; then
 FIREBIRDINCDIR=$with_firebird_incdir
fi

if test "x$with_firebird_libdir" != "x"; then
 FIREBIRDLIBDIR=$with_firebird_libdir
fi

ac_save_LIBS="$LIBS"
ac_save_CPPFLAGS="$CPPFLAGS"
ac_save_CXXLIBS="$CXXLIBS"

CXXLIBS="$ac_save_CXXLIBS -L${FIREBIRDLIBDIR}"
LIBS="$ac_save_LIBS -L${FIREBIRDLIBDIR}  -lfbclient "
CPPFLAGS="$ac_save_CPPFLAGS -I .  -I $FIREBIRDINCDIR  "

AC_TRY_LINK([
#include <ibase.h>
],[
isc_db_handle   newdb;
  const ISC_STATUS* pvector;
  char msg[512];
  fb_interpret(msg,512,&pvector);

;],[firebird2_lib=yes],[firebird2_lib=no])

AC_MSG_RESULT($firebird2_lib)
if test $firebird2_lib = yes ; then
AC_DEFINE(HAVE_FIREBIRD2,1,Defines whether Firebird 2.x is installed)
fi


LIBS="$ac_save_LIBS"
CPPFLAGS="$ac_save_CPPFLAGS"
CXXLIBS="$ac_save_CXXLIBS"
fi

])



AC_DEFUN([HK_CHECK_FONTCONFIG],
[
AC_MSG_CHECKING([whether FONTCONFIG is available])
if test "$with_fontconfig_dir" = ""; then
  if test "$want_64bit" = "yes"; then
   FONTCONFIGLIBDIR=/usr/lib64
  else
   FONTCONFIGLIBDIR=/usr/lib
  fi
   FONTCONFIGINCDIR=/usr/include/fontconfig
else FONTCONFIGLIBDIR=$with_fontconfig_dir/lib
FONTCONFIGINCDIR=$with_fontconfig_dir/include
fi

if test "x$with_fontconfig_incdir" != "x"; then
 FONTCONFIGINCDIR=$with_fontconfig_incdir
fi

if test "x$with_fontconfig_libdir" != "x"; then
 FONTCONFIGLIBDIR=$with_fontconfig_libdir
fi

ac_save_LIBS="$LIBS"
ac_save_CPPFLAGS="$CPPFLAGS"
ac_save_CXXLIBS="$CXXLIBS"

CXXLIBS="$ac_save_CXXLIBS -L${FONTCONFIGLIBDIR}"
LIBS="$ac_save_LIBS -L${FONTCONFIGLIBDIR}  -lfontconfig "
CPPFLAGS="$ac_save_CPPFLAGS -I .  -I $FONTCONFIGINCDIR  "

AC_TRY_LINK([
#include <fontconfig.h>
],[

FcInit();
FcFontSet* fs;
 FcObjectSet *os = 0;
 FcChar8* fontformat;
 FcPattern* pat= FcPatternCreate ();
    
 os = FcObjectSetBuild (FC_FAMILY, FC_STYLE, (char *) 0);
 fs = FcFontList (0, pat, os);
 
;],[fontconfig_lib=yes],[fontconfig_lib=no])

AC_MSG_RESULT($fontconfig_lib)


if test ! "$fontconfig_lib" = yes ; then
  AC_MSG_ERROR(
  fontconfig not available or the version is too old!!!
  ============================================================================
   ERROR!
   You probably have to install the fontconfig-devel.rpm of your distribution.
   The exact name of this rpm is distribution specific.
  ============================================================================

  )
fi
AC_SUBST(FONTCONFIGLIBDIR)
AC_SUBST(FONTCONFIGINCDIR)

CXXLIBS="$ac_save_CXXLIBS "
LIBS="$ac_save_LIBS "
CPPFLAGS="$ac_save_CPPFLAGS "


])





AC_DEFUN([HK_CHECK_FREETYPE],
[
AC_MSG_CHECKING([whether FREETYPE is available])
   FREETYPEINC=`freetype-config --cflags`
   FREETYPELIB=`freetype-config --libs`


ac_save_LIBS="$LIBS"
ac_save_CPPFLAGS="$CPPFLAGS"
ac_save_CXXLIBS="$CXXLIBS"

CXXLIBS="$ac_save_CXXLIBS "
LIBS="$ac_save_LIBS   $FREETYPELIB "
CPPFLAGS="$ac_save_CPPFLAGS -I .  $FREETYPEINC  "

AC_TRY_LINK([
#include <ft2build.h>
#include FT_FREETYPE_H
],[
FT_Library  ftlibrary;
;],[freetype_lib=yes],[freetype_lib=no])

AC_MSG_RESULT($freetype_lib)


if test ! "$freetype_lib" = yes ; then
  AC_MSG_ERROR(
  freetype not available!!!
  ============================================================================
   ERROR!
   You probably have to install the freetype-devel.rpm of your distribution.
   The exact name of this rpm is distribution specific.
  ============================================================================

  )
fi
CXXLIBS="$ac_save_CXXLIBS "
LIBS="$ac_save_LIBS "
CPPFLAGS="$ac_save_CPPFLAGS "
AC_SUBST(FREETYPELIB)
AC_SUBST(FREETYPEINC)

])

AC_DEFUN([HK_CHECK_LIBXML2],[
AC_MSG_CHECKING([whether LIBXML2 is available])
XMLLIB=`xml2-config --libs`
XMLINCLUDE=`xml2-config --cflags|cut -b 3-`

ac_save_LIBS="$LIBS"
ac_save_CPPFLAGS="$CPPFLAGS"
ac_save_CXXLIBS="$CXXLIBS"

CXXLIBS="$ac_save_CXXLIBS "
LIBS="$ac_save_LIBS   $XMLLIB "
CPPFLAGS="$ac_save_CPPFLAGS -I .  -I$XMLINCLUDE  "


AC_TRY_LINK([
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>],[
xmlDocPtr doc;],[xml2_lib=yes],[xml2_lib=no])

AC_MSG_RESULT($xml2_lib)

if test ! "$xml2_lib" = yes ; then
  AC_MSG_ERROR(
  libxml2 not available!!!
  ============================================================================
   ERROR!
   You probably have to install the libxml2-devel.rpm of your distribution.
   The exact name of this rpm is distribution specific.
  ============================================================================

  )
fi

CXXLIBS="$ac_save_CXXLIBS "
LIBS="$ac_save_LIBS "
CPPFLAGS="$ac_save_CPPFLAGS "

AC_SUBST(XMLLIB)
AC_SUBST(XMLINCLUDE)

])

dnl @synopsis AC_PYTHON_DEVEL([version])
dnl
dnl Checks for Python and tries to get the include path to 'Python.h'.
dnl It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LDFLAGS) output
dnl variables.
dnl Also exports $(PYTHON_EXTRA_LIBS) and $(PYTHON_EXTRA_LDFLAGS)
dnl for embedding Python in your code.
dnl
dnl You can search for some particular version of Python by passing a
dnl parameter to this macro, for example ">= '2.3.1'", or "== '2.4'".
dnl Please note that you *have* to pass also an operator along
dnl with the version to match, and pay special attention to the 
dnl single quotes surrounding the version number.
dnl
dnl If the user wants to employ a particular version of Python, she can
dnl now pass to configure the PYTHON_VERSION environment variable.
dnl This is only limited by the macro parameter set by the packager.
dnl
dnl This macro should work for all versions of Python >= 2.1.0. You can 
dnl disable the check for the python version by setting the 
dnl PYTHON_NOVERSIONCHECK environment variable to something else
dnl than the empty string.
dnl
dnl If you need to use this macro for an older Python version, please 
dnl contact the authors. We're always open for feedback.
dnl
dnl @category InstalledPackages
dnl @author Sebastian Huber <sebastian-huber@web.de>
dnl @author Alan W. Irwin <irwin@beluga.phys.uvic.ca>
dnl @author Rafael Laboissiere <laboissiere@psy.mpg.de>
dnl @author Andrew Collier <colliera@nu.ac.za>
dnl @author Matteo Settenvini <matteo@member.fsf.org>
dnl @author Horst Knorr <hk_classes@knoda.org> 
dnl @version 2006-02-05
dnl @license GPLWithACException

AC_DEFUN([AC_PYTHON_DEVEL],[
	#
	# Allow the use of a (user set) custom python version
	#
	AC_ARG_VAR([PYTHON_VERSION],[The installed Python
		version to use, for example '2.3'. This string 
		will be appended to the Python interpreter
		canonical name.])

	AC_PATH_PROG([PYTHON],[python[$PYTHON_VERSION]])
	if test -z "$PYTHON"; then
	   AC_MSG_ERROR([Cannot find python$PYTHON_VERSION in your system path])
	fi

	#
	# Check for a version of Python >= 2.1.0
	#
	AC_MSG_CHECKING([for a version of Python >= '2.1.0'])
	ac_supports_python_ver=`$PYTHON -c "import sys, string; \
		ver = string.split(sys.version)[[0]]; \
		print ver >= '2.1.0'"`
	if test "$ac_supports_python_ver" != "True" -a  "$ac_supports_python_ver" != "1"; then
		if test -z "$PYTHON_NOVERSIONCHECK"; then
			AC_MSG_RESULT([no])
			AC_MSG_FAILURE([
This version of the AC@&t@_PYTHON_DEVEL macro
doesn't work properly with versions of Python before
2.1.0. You may need to re-run configure, setting the
variables PYTHON_CPPFLAGS, PYTHON_LDFLAGS, PYTHON_SITE_PKG,
PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand.
Moreover, to disable this check, set PYTHON_NOVERSIONCHECK
to something else than an empty string.
])dnl
		else
			AC_MSG_RESULT([skip at user request])
		fi
	else 
		AC_MSG_RESULT([yes])
	fi
	
	#
	# if the macro parameter ``version'' is set, honour it
	#
	if test -n "$1"; then
		AC_MSG_CHECKING([for a version of Python $1])
		ac_supports_python_ver=`$PYTHON -c "import sys, string; \
			ver = string.split(sys.version)[[0]]; \
			print ver $1"`
		if test "$ac_supports_python_ver" = "True" -a "$ac_supports_python_ver" = "1"; then
	   	   AC_MSG_RESULT([yes])
		else
			AC_MSG_RESULT([no])
			AC_MSG_ERROR([this package requires Python $1. 
If you have it installed, but it isn't the default Python
interpreter in your system path, please pass the PYTHON_VERSION 
variable to configure. See ``configure --help'' for reference.
])dnl
		fi
	fi

	#
	# Check if you have distutils, else fail
	#
	AC_MSG_CHECKING([for the distutils Python package])
	ac_distutils_result=`$PYTHON -c "import distutils" 2>&1`
	if test -z "$ac_distutils_result"; then
		AC_MSG_RESULT([yes])
	else
		AC_MSG_RESULT([no])
		AC_MSG_ERROR([cannot import Python module "distutils".
Please check your Python installation. The error was:
$ac_distutils_result])
	fi

	#
	# Check for Python include path
	#
	AC_MSG_CHECKING([for Python include path])
	if test -z "$PYTHON_CPPFLAGS"; then
		python_path=`$PYTHON -c "import distutils.sysconfig; \
           		print distutils.sysconfig.get_python_inc();"`
		if test -n "${python_path}"; then
		   	python_path="-I$python_path"
		fi
		PYTHON_CPPFLAGS=$python_path
	fi
	if test "$with_python_incdir" != ""; then
	PYTHON_CPPFLAGS="-I$with_python_incdir "
	fi
	AC_MSG_RESULT([$PYTHON_CPPFLAGS])
	AC_SUBST([PYTHON_CPPFLAGS])

	#
	# Check for Python library path
	#
	AC_MSG_CHECKING([for Python library path])
	if test -z "$PYTHON_LDFLAGS"; then
		# (makes two attempts to ensure we've got a version number
		# from the interpreter)
		py_version=`$PYTHON -c "from distutils.sysconfig import *; \
			from string import join; \
			print join(get_config_vars('VERSION'))"`
		if test "$py_version" == "[None]"; then
			if test -n "$PYTHON_VERSION"; then
				py_version=$PYTHON_VERSION
			else
				py_version=`$PYTHON -c "import sys; \
					print sys.version[[:3]]"`
			fi
		fi

		PYTHON_LDFLAGS=`$PYTHON -c "from distutils.sysconfig import *; \
			from string import join; \
			print '-L' + get_python_lib(0,1), \
		      	'-lpython';"`$py_version
	fi		
	if test "$with_python_libdir" != ""; then
	PYTHON_LDFLAGS="-L$with_python_libdir -lpython$py_version"
	fi
	AC_MSG_RESULT([$PYTHON_LDFLAGS])
	AC_SUBST([PYTHON_LDFLAGS])

	#
	# Check for site packages
	#
	AC_MSG_CHECKING([for Python site-packages path])
	if test -z "$PYTHON_SITE_PKG"; then
		PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \
		        print distutils.sysconfig.get_python_lib(0,0);"`
	fi
	AC_MSG_RESULT([$PYTHON_SITE_PKG])
	AC_SUBST([PYTHON_SITE_PKG])

	#
	# libraries which must be linked in when embedding
	#
	AC_MSG_CHECKING(python extra libraries)
	if test -z "$PYTHON_EXTRA_LIBS"; then
	   PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \
                conf = distutils.sysconfig.get_config_var; \
                print conf('LOCALMODLIBS'), conf('LIBS')"`
	fi
	AC_MSG_RESULT([$PYTHON_EXTRA_LIBS])
	AC_SUBST(PYTHON_EXTRA_LIBS)

	#
	# linking flags needed when embedding
	#
	AC_MSG_CHECKING(python extra linking flags)
	if test -z "$PYTHON_EXTRA_LDFLAGS"; then
		PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \
			conf = distutils.sysconfig.get_config_var; \
			print conf('LINKFORSHARED')"`
	fi
	AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS])
	AC_SUBST(PYTHON_EXTRA_LDFLAGS)

	#	
	# final check to see if everything compiles alright
	#
	AC_MSG_CHECKING([whether collected informations are consistent])
	AC_LANG_PUSH([C])
	# save current global flags
	LIBS="$ac_save_LIBS $PYTHON_LDFLAGS  $PYTHON_EXTRA_LDFLAGS $PYTHON_EXTRA_LIBS "
	CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS"
	AC_TRY_LINK([
		#include <Python.h>
	],[
		Py_Initialize();
	],[pythonexists=yes],[pythonexists=no])

	AC_MSG_RESULT([$pythonexists])

        if test ! "$pythonexists" = "yes"; then
	   AC_MSG_ERROR([
  Could not link test program to Python. Maybe the main Python library has been
  installed in some non-standard library path. If so, pass it to configure, 
  via the LDFLAGS environment variable,
  or use the --with-python-incdir and --with-python-libdir directices respectively.
  ============================================================================
   ERROR!
   You probably have to install the development version of the Python package
   for your distribution.  The exact name of this package varies among them.
  ============================================================================
	   ])
	fi
	AC_LANG_POP
	# turn back to default flags
	CPPFLAGS="$ac_save_CPPFLAGS"
	LIBS="$ac_save_LIBS"
	AC_DEFINE(HAVE_PYTHON, 1, [Define if you have the development files for python])

	#
	# all done!
	#
])