File: configure.in

package info (click to toggle)
firebird2.5 2.5.2.26540.ds4-1~deb7u2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 43,624 kB
  • sloc: ansic: 373,110; cpp: 291,289; sql: 17,678; fortran: 6,818; sh: 5,772; yacc: 5,709; pascal: 1,153; makefile: 725; perl: 88; sed: 84; csh: 15
file content (1509 lines) | stat: -rw-r--r-- 50,986 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
dnl ############################# INITIALISATION ###############################

AC_PREREQ(2.56)
AC_INIT(src)

AC_CONFIG_AUX_DIR(builds/make.new/config)
AC_CACHE_VAL(ac_cv_prog_make_set, [AC_PROG_MAKE_SET])
AC_PREFIX_DEFAULT(/usr/local/firebird)

m4_ifdef([AC_CONFIG_MACRO_DIR],
         [],
         [m4_define([AC_CONFIG_MACRO_DIR], [])])
AC_CONFIG_MACRO_DIR(m4)

AC_CONFIG_HEADER(src/include/gen/autoconfig.h:builds/make.new/config/config.h.in)

dnl XE_APPEND(value, varname)
define([XE_APPEND],[[$2]="$[$2] [$1]"])

dnl XE_PREPEND(value, varname)
define([XE_PREPEND],[[$2]="[$1] $[$2]"])

dnl XE_CONF_DIR(param, help, variable, default)
define([XE_CONF_DIR],[
AC_ARG_WITH([$1], 
	[AC_HELP_STRING([--with-$1], [$2])], 
	[[$3]="$withval"
	 AC_DEFINE_UNQUOTED([$3], "$[$3]", [$2])], 
	[[$3]="[`if test ""x$prefix"" = ""xNONE"" ; then echo ""$ac_default_prefix""; else echo ""$prefix""; fi`][$4]"
	 AC_DEFINE_UNQUOTED([$3], [""], [$2])]
)
AC_SUBST([$3])
])

sinclude(acx_pthread.m4)
sinclude(binreloc.m4)

dnl ############################# ADD TESTS BELOW ##############################

AC_CANONICAL_SYSTEM
CPU_TYPE=$target_cpu
AC_SUBST(CPU_TYPE)


dnl EKU: set appropiate defaults for each platform
dnl      EDITLINE_FLG     : support fancy command line editing in isql
dnl      SHRLIB_EXT       : suffix of shared library files

RAW_DEVICES_FLG=Y
INSTALL_PREFIX=""

dnl Use /usr/lib for library links on most platforms except some 64-bit ones
libdir=/usr/lib
ICU_PLATFORM=LinuxRedHat

dnl Should system editline and/or icu be used
STD_EDITLINE=false
STD_ICU=false
RPM64=

dnl Test for special ar options?
AR_OPT_CHECK=false

case "$target" in
  i*86-*-darwin*)
dnl    MAKEFILE_PREFIX=darwin_i386
    MAKEFILE_PREFIX=darwin_x86_64
    MAKEFILE_POSTFIX=darwin
    PLATFORM=DARWIN
    INSTALL_PREFIX=darwin
    AC_DEFINE(DARWIN, 1, [Define this if OS is DARWIN])
	XE_APPEND(-framework CoreFoundation,LIBS)
    EDITLINE_FLG=Y
    SHRLIB_EXT=dylib
    ICU_PLATFORM=MacOSX
    CPU_TYPE=x86_64
    ;;

  powerpc-*-darwin*)
    MAKEFILE_PREFIX=darwin_powerpc
dnl MAKEFILE_PREFIX=darwin_ppc64
    MAKEFILE_POSTFIX=darwin
    PLATFORM=DARWIN
    INSTALL_PREFIX=darwin
    AC_DEFINE(DARWIN, 1, [Define this if OS is DARWIN])
	XE_APPEND(-framework CoreFoundation,LIBS)
    EDITLINE_FLG=Y
    SHRLIB_EXT=dylib
    ICU_PLATFORM=MacOSX
dnl CPU_TYPE=ppc64
    ;;

  powerpc-*-aix*)
    dnl ibm xlC has many invocations, like xlC, xlc++, or xlc_r7
    comp=`echo "$CXX" | cut -c1-3 | dd conv=lcase 2>/dev/null`
    if test "$comp" = "xlc"; then
        AR_OPT_CHECK=true
        TLS_OPTIONS="-qtls=default"
        MAKEFILE_PREFIX=aix_powerpc_xlc
        ICU_PLATFORM=AIX4.3VA
    else
        MAKEFILE_PREFIX=aix_powerpc
        ICU_PLATFORM=AIXGCC
    fi
    MAKEFILE_POSTFIX=aix
    PLATFORM=AIX
    INSTALL_PREFIX=aix
    AC_DEFINE(AIX, 1, [Define this if OS is AIX])
    EDITLINE_FLG=N
    SHRLIB_EXT=so
    ;;

  amd64-*-freebsd* | x86_64*-*-freebsd* | x86_64*-*-k*bsd*-gnu)
    MAKEFILE_PREFIX=freebsd_amd64
    case "$target" in
        x86_64*-*-k*bsd-gnu)      # Debian/kFreeBSD
            PLATFORM=GENTOOFREEBSD
            INSTALL_PREFIX=linux
            ;;
		*)
            PLATFORM=FREEBSD
            INSTALL_PREFIX=freebsd
            ;;
    esac
    AC_DEFINE(FREEBSD, 1, [Define this if OS is FreeBSD])
    AC_DEFINE(AMD64, 1, [Define this if CPU is amd64])
    EDITLINE_FLG=Y
    SHRLIB_EXT=so
    ;;

  *-gentoo-freebsd*)
    MAKEFILE_PREFIX=freebsd
    PLATFORM=GENTOOFREEBSD
    AC_DEFINE(FREEBSD, 1, [Define this if OS is FreeBSD])
    EDITLINE_FLG=Y
    SHRLIB_EXT=so
    ;;

  *-*-freebsd* | *-*-k*bsd*-gnu)
    MAKEFILE_PREFIX=freebsd
    case "$target" in
        *-*-k*bsd-gnu)      # Debian/kFreeBSD
            PLATFORM=GENTOOFREEBSD
            INSTALL_PREFIX=linux
            ;;
        *)
            PLATFORM=FREEBSD
            ;;
    esac
    AC_DEFINE(FREEBSD, 1, [Define this if OS is FreeBSD])
    EDITLINE_FLG=Y
    SHRLIB_EXT=so
    ;;

  mips-*-linux*)
    MAKEFILE_PREFIX=linux_mips
    INSTALL_PREFIX=linux
    PLATFORM=LINUX
    AC_DEFINE(LINUX)
    EDITLINE_FLG=Y
    SHRLIB_EXT=so
    PTHREAD_CFLAGS=-pthread
    PTHREAD_LIBS=-lpthread
    ;;

  mipsel-*-linux*)
    MAKEFILE_PREFIX=linux_mipsel
    INSTALL_PREFIX=linux
    PLATFORM=LINUX
    AC_DEFINE(LINUX)
    EDITLINE_FLG=Y
    SHRLIB_EXT=so
    PTHREAD_CFLAGS=-pthread
    PTHREAD_LIBS=-lpthread
    ;;

  x86_64*-*-linux* | x86_64*-*-gnu*)
    MAKEFILE_PREFIX=linux_amd64
    INSTALL_PREFIX=linux
    PLATFORM=LINUX
    AC_DEFINE(LINUX, 1, [Define this if OS is Linux])
    EDITLINE_FLG=Y
    SHRLIB_EXT=so
	if test -L /usr/lib64; then
		libdir=/usr/lib
	else
		libdir=/usr/lib64
	fi
    CPU_TYPE=amd64
	RPM64='()(64bit)'
    ;;

  ia64*-*-linux*)
    MAKEFILE_PREFIX=linux_ia64
    INSTALL_PREFIX=linux
    PLATFORM=LINUX
    AC_DEFINE(LINUX, 1, [Define this if OS is Linux])
    EDITLINE_FLG=Y
    SHRLIB_EXT=so
    libdir=/usr/lib
    CPU_TYPE=ia64
    RPM64='()(64bit)'
    ;;

  arm*-*-linux*)
    MAKEFILE_PREFIX=linux_arm
    INSTALL_PREFIX=linux
    PLATFORM=LINUX
    AC_DEFINE(LINUX, 1, [Define this if OS is Linux])
    EDITLINE_FLG=Y
    SHRLIB_EXT=so
    STD_EDITLINE=true
    STD_ICU=true
    ATOMIC_LIBS=-latomic_ops
    ;;

  sparc*-*-linux* | sparc*-*-gnu* | sparc*-*-k*bsd*-gnu)
    MAKEFILE_PREFIX=linux_sparc32
    INSTALL_PREFIX=linux
    PLATFORM=LINUX
    AC_DEFINE(LINUX, 1, [Define this if OS is Linux])
    EDITLINE_FLG=Y
    SHRLIB_EXT=so
    ATOMIC_LIBS=-latomic_ops
    ;;

  powerpc*-*-linux*)
    MAKEFILE_PREFIX=linux_powerpc
    INSTALL_PREFIX=linux
    PLATFORM=LINUX
    AC_DEFINE(LINUX, 1, [Define this if OS is Linux])
    EDITLINE_FLG=Y
    SHRLIB_EXT=so
    ;;

  i*86*-*-linux*)
    MAKEFILE_PREFIX=linux
    PLATFORM=LINUX
    AC_DEFINE(LINUX)
    EDITLINE_FLG=Y
    SHRLIB_EXT=so
    ;;

  s390*-*-linux*)
    MAKEFILE_PREFIX=linux_s390x
    INSTALL_PREFIX=linux
    PLATFORM=LINUX
    AC_DEFINE(LINUX, 1, [Define this if OS is Linux])
    EDITLINE_FLG=Y
    SHRLIB_EXT=so
    ;;

  sh*eb-*-linux*)
    MAKEFILE_PREFIX=linux_generic
    INSTALL_PREFIX=linux
    PLATFORM=LINUX
    AC_DEFINE(LINUX, 1, [Define this if OS is Linux])
    AC_DEFINE(SHEB, 1, [Architecture is big-edian sh4])
    LOCK_MANAGER_FLG=Y
    EDITLINE_FLG=Y
    SHRLIB_EXT=so
    ATOMIC_LIBS=-latomic_ops
    ;;


  sh*-*-linux*)
    MAKEFILE_PREFIX=linux_generic
    INSTALL_PREFIX=linux
    PLATFORM=LINUX
    AC_DEFINE(LINUX, 1, [Define this if OS is Linux])
    AC_DEFINE(SH, 1, [Architecture is little-endian sh4])
    LOCK_MANAGER_FLG=Y
    EDITLINE_FLG=Y
    SHRLIB_EXT=so
    ATOMIC_LIBS=-latomic_ops
    ;;

  hppa*-*-linux*)
    MAKEFILE_PREFIX=linux_generic
    INSTALL_PREFIX=linux
    PLATFORM=LINUX
    AC_DEFINE(LINUX, 1, [Define this if OS is Linux])
    AC_DEFINE(HPPA, 1, [Define this if CPU is HPPA])
    LOCK_MANAGER_FLG=Y
    EDITLINE_FLG=Y
    SHRLIB_EXT=so
    ;;

  alpha*-*-linux*)
   MAKEFILE_PREFIX=linux_generic
   INSTALL_PREFIX=linux
   PLATFORM=LINUX
   AC_DEFINE(LINUX, 1, [Define this if OS is Linux])
   AC_DEFINE(ALPHA, 1, [Define this if CPU is Alpha])
   LOCK_MANAGER_FLG=Y
   EDITLINE_FLG=Y
   SHRLIB_EXT=so
   ;;

  *-*-linux* | *-*-gnu*)
    MAKEFILE_PREFIX=linux_generic
    INSTALL_PREFIX=linux
    PLATFORM=LINUX
    AC_DEFINE(LINUX, 1, [Define this if OS is Linux])
    EDITLINE_FLG=Y
    SHRLIB_EXT=so
    ;;

  *-*-netbsd*)
    MAKEFILE_PREFIX=netbsd
    PLATFORM=NETBSD
    AC_DEFINE(NETBSD, 1, [Define this if OS is NetBSD])
    EDITLINE_FLG=Y
    SHRLIB_EXT=so
    ;;

  ia64-*-hpux*)
    comp=`echo "$CXX" | cut -c1-3`
    case $comp in
       aCC) MAKEFILE_PREFIX=hpux_aCC ;
           ICU_PLATFORM=HP-UX11ACC ;
           PTHREAD_CFLAGS=-mt
           ;;
       *)  MAKEFILE_PREFIX=hpux_ia64 ;
           ;;
    esac
    INSTALL_PREFIX=hpux
    PLATFORM=HPUX
    AC_DEFINE(HPUX, 1, [Define this if OS is HP-UX])
    EDITLINE_FLG=Y
    SHRLIB_EXT=so
    libdir=/usr/lib/pa20_64
    ;;

  hppa*-*-hpux*)
    comp=`echo "$CXX" | cut -c1-3`
    case $comp in
       aCC) MAKEFILE_PREFIX=hpux_aCC ;
           ICU_PLATFORM=HP-UX11ACC ;
           PTHREAD_CFLAGS=-mt
           ;;
       *)  MAKEFILE_PREFIX=hpux ;
           ;;
    esac
    INSTALL_PREFIX=hpux
    PLATFORM=HPUX
    AC_DEFINE(HPUX, 1, [Define this if OS is HP-UX])
    EDITLINE_FLG=Y
    SHRLIB_EXT=sl
    libdir=/usr/lib/pa20_64
    ;;

  i386-pc-solaris*)
    dnl detect native compiler, Sun Studio Pro
    comp=`echo "$CXX" | cut -c1-2`
    case $comp in
       CC) MAKEFILE_PREFIX=solaris
           ICU_PLATFORM=SOLARISX86
           PTHREAD_CFLAGS=-mt
           PTHREAD_LIBS=-lpthread
           ;;
       *)  MAKEFILE_PREFIX=solx86gcc ;
           ICU_PLATFORM=SOLARISX86GCC ;
           PTHREAD_CFLAGS=-pthreads ;;
    esac
    dnl if this is amd64 system, we should install our libraries in /usr/lib/amd64
    isa=`isainfo -k`
    if test "$isa" = "amd64"; then
        libdir=/usr/lib/amd64
    fi
    INSTALL_PREFIX=solaris
    PLATFORM=solx86
    AC_DEFINE(solx86, 1, [Define this if OS is Solarix x86])
    EDITLINE_FLG=Y
    SHRLIB_EXT=so
    ;;

  sparc-sun-solaris*)
    dnl detect native compiler, Sun Studio Pro
    comp=`echo "$CXX" | cut -c1-3`
    case $comp in
       CC) MAKEFILE_PREFIX=solaris ;
           ICU_PLATFORM=SOLARISCC 
           dnl inline assembly for atomic operations on Solaris 9 w SSPRO
           PTHREAD_CFLAGS=-mt
           PTHREAD_LIBS=-lpthread
           if test "${target#*solaris}" = "2.9"; then
             ATOMIC_OPTIONS="../src/common/classes/fb_atomic.il";
           fi
           ;;
       *)  MAKEFILE_PREFIX=solaris-64gcc ;
           ICU_PLATFORM=SOLARISGCC ;;
    esac
    INSTALL_PREFIX=solaris
    PLATFORM=SOLARIS
    AC_DEFINE(SOLARIS, 1, [Define this if OS is Solaris Sparc])
    EDITLINE_FLG=Y
    SHRLIB_EXT=so
    ;;

  *-*-mingw*)
    MAKEFILE_PREFIX=mingw
    PLATFORM=win32
    AC_DEFINE(WIN_NT, 1, [Define this if OS is Windows NT])
    AC_DEFINE(HAVE_MULTI_THREAD, 1, [Define this if multi-threading should be supported])
    EDITLINE_FLG=N
    RAW_DEVICES_FLG=N
    SHRLIB_EXT=dll
	ICU_PLATFORM=MinGW
    ;;

  *)
    AC_MSG_ERROR(unsupported platform ${target})
    ;;
esac

if test "$INSTALL_PREFIX" = ""; then
  INSTALL_PREFIX=$MAKEFILE_PREFIX
fi

AM_BINRELOC

AC_SUBST(MAKEFILE_PREFIX)
AC_SUBST(AR_OPTIONS)
AC_SUBST(PLATFORM)
AC_SUBST(SHRLIB_EXT)
AC_SUBST(ICU_PLATFORM)
AC_DEFINE(CASE_SENSITIVITY, false, [Define this if paths are case sensitive])
AC_SUBST(RPM64)
AC_SUBST(ATOMIC_LIBS)


dnl Some controllable options
FIREBIRD_ARCH_TYPE=classic
AC_ARG_ENABLE(superserver,
  [  --enable-superserver    build SuperServer architecture (default=no)],
  [case "$enableval" in
     yes) FIREBIRD_ARCH_TYPE=super;;
     no)  FIREBIRD_ARCH_TYPE=classic;;
     *)   AC_MSG_ERROR(bad value '${enableval}' for --enable-superserver);;
   esac])
AC_SUBST(FIREBIRD_ARCH_TYPE)

case $FIREBIRD_ARCH_TYPE in
  super)   AC_SUBST(ARCH_TYPE_SUFFIX,SS);;
  classic) AC_SUBST(ARCH_TYPE_SUFFIX,CS);;
esac

PROD_BUILD_FLG=Y
AC_ARG_ENABLE(debug,
  [  --enable-debug          build debug version (default=no)],
  [case "$enableval" in
     yes) PROD_BUILD_FLG=N;;
     no)  PROD_BUILD_FLG=Y;;
     *)   AC_MSG_ERROR(bad value '${enableval}' for --enable-debug);;
   esac])
AC_SUBST(PROD_BUILD_FLG)

dnl Avoid dumb '-g -O2' autoconf's default
dnl Debugging information and optimization flags should be set in prefix.$platform file
dnl Should be replaced with AC_PROG_GCC_DEFAULT_FLAGS() when available
if test "$CFLAGS" = "-g -O2" -o "$CFLAGS" = "-g" -o "$CFLAGS" = "-O2"; then
	CFLAGS=
fi

dnl Find out how to use threads on this platform
pre_acx_pthread_cflags=$CFLAGS
pre_acx_pthread_cxxflags=$CXXFLAGS
pre_acx_pthread_libs=$LIBS
ACX_PTHREAD([
  AC_DEFINE(HAVE_MULTI_THREAD, 1,
    [Define this if multi-threading should be supported])])
CFLAGS=$pre_acx_pthread_cflags
LIBS=$pre_acx_pthread_libs

AC_SUBST(PTHREAD_LIBS)
AC_SUBST(PTHREAD_CFLAGS)

AC_ARG_ENABLE(raw-devices,
  [  --enable-raw-devices    enable databases on raw devices (default on POSIX)],
  [case "$enableval" in
     yes) RAW_DEVICES_FLG=Y;;
     no)  RAW_DEVICES_FLG=N;;
     *)   AC_MSG_ERROR(bad value '${enableval}' for --enable-raw-devices);;
   esac])
if test "$RAW_DEVICES_FLG" = "Y"; then
  AC_DEFINE(SUPPORT_RAW_DEVICES, 1,
    [Define this if databases on raw devices should be supported])
fi

AC_ARG_WITH(editline,
  [  --with-editline         support fancy command line editing],
  [case "$withval" in
     yes) EDITLINE_FLG=Y;;
     no)  EDITLINE_FLG=N;;
     *)   AC_MSG_ERROR(bad value '${withval}' for --with-editline);;
   esac])
AC_ARG_WITH(system-editline,
  [  --with-system-editline  use OS supplied libeditline],
  [case "$withval" in
     yes) STD_EDITLINE=true;;
     no)  STD_EDITLINE=false;;
     *)   AC_MSG_ERROR(bad value '${withval}' for --with-system-editline);;
   esac])

# not need editline in default libs, but need to test for its presence
READLINE=edit	# builtin default
saveLIBS=$LIBS
if test "$STD_EDITLINE" = "true"; then
  AC_CHECK_LIB(edit, readline, [READLINE=edit EDITLINE_FLG=Y],
    AC_CHECK_LIB(editline, readline, [READLINE=editline EDITLINE_FLG=Y],
      AC_CHECK_LIB(readline, readline, [READLINE=readline EDITLINE_FLG=Y],
        [STD_EDITLINE=false
         if test "$EDITLINE_FLG" = "Y"; then
           AC_MSG_WARN([[[--with-system-editline specified, not found. Using bundled editline]]])])))
		 fi
fi
LIBS=$saveLIBS

AC_SUBST(READLINE)
AC_SUBST(STD_EDITLINE)
AC_SUBST(EDITLINE_FLG)

AC_ARG_WITH(system-icu,
  [  --with-system-icu       use OS supplied ICU],
  [case "$withval" in
     yes) STD_ICU=true;;
     no)  STD_ICU=false;;
     *)   AC_MSG_ERROR(bad value '${withval}' for --with-system-icu);;
   esac])
AC_SUBST(STD_ICU)

FB_SERVICE_NAME=gds_db
FB_SERVICE_PORT=3050
FB_IPC_NAME=FirebirdIPI
AC_ARG_WITH(service-name,
  [  --with-service-name     specify inet service name (default=gds_db)],
  [FB_SERVICE_NAME=${withval}])
AC_ARG_WITH(service-port,
  [  --with-service-port     specify inet service port (default=3050)],
  [FB_SERVICE_PORT=${withval}])
AC_ARG_WITH(ipc-name,
  [  --with-ipc-name         specify local IPC name (default=FirebirdIPI)],
  [FB_IPC_NAME=${withval}])
AC_DEFINE_UNQUOTED(FB_SERVICE_NAME,"$FB_SERVICE_NAME", [Inet service name])
AC_DEFINE_UNQUOTED(FB_SERVICE_PORT,$FB_SERVICE_PORT, [Inet service port])
AC_DEFINE_UNQUOTED(FB_IPC_NAME,"$FB_IPC_NAME", [Local IPC name])
AC_SUBST(FB_SERVICE_NAME)
AC_SUBST(FB_SERVICE_PORT)
AC_SUBST(FB_IPC_NAME)

dnl Use non-standard directory placement control
dnl Sorry - GNU standard is not Ok for us
XE_CONF_DIR(fbbin, [executables DIR (PREFIX/bin)], FB_BINDIR, /bin)
XE_CONF_DIR(fbsbin, [system admin executables DIR (PREFIX/bin)], FB_SBINDIR, /bin)
XE_CONF_DIR(fbconf, [config files DIR (PREFIX)], FB_CONFDIR)
XE_CONF_DIR(fblib, [object code libraries DIR (PREFIX/lib)], FB_LIBDIR, /lib)
XE_CONF_DIR(fbinclude, [C/C++ header files DIR (PREFIX/include)], FB_INCDIR, /include)
XE_CONF_DIR(fbdoc, [documentation root DIR (PREFIX/doc)], FB_DOCDIR, /doc)
XE_CONF_DIR(fbudf, [UDF DIR (PREFIX/UDF)], FB_UDFDIR, /UDF)
XE_CONF_DIR(fbsample, [examples DIR (PREFIX/examples)], FB_SAMPLEDIR, /examples)
XE_CONF_DIR(fbsample-db, [examples database DIR (PREFIX/examples/empbuild)], FB_SAMPLEDBDIR, /examples/empbuild)
XE_CONF_DIR(fbhelp, [QLI help DIR (PREFIX/help)], FB_HELPDIR, /help)
XE_CONF_DIR(fbintl, [international DIR (PREFIX/intl)], FB_INTLDIR, /intl)
XE_CONF_DIR(fbmisc, [misc DIR (PREFIX/misc)], FB_MISCDIR, /misc)
XE_CONF_DIR(fbsecure-db, [security database DIR (PREFIX)], FB_SECDBDIR)
XE_CONF_DIR(fbmsg, [message files DIR (PREFIX)], FB_MSGDIR)
XE_CONF_DIR(fblog, [log files DIR (PREFIX)], FB_LOGDIR)
XE_CONF_DIR(fbglock, [guardian lock DIR (PREFIX)], FB_GUARDDIR)
XE_CONF_DIR(fbplugins, [plugins DIR (PREFIX)], FB_PLUGDIR, /plugins)

dnl gpre built-in language support (C/C++ are mandatory)
GPRE_LANGUAGE_MODULES=""
AC_ARG_WITH(gpre-ada,
  [  --with-gpre-ada         support ADA in gpre (default=no)],
  [case "$withval" in
     yes) XE_APPEND(ada.cpp,GPRE_LANGUAGE_MODULES)
          AC_DEFINE(GPRE_ADA, 1, [Define this if GPRE should support ADA]);;
     no)  ;;
     *)   AC_MSG_ERROR(bad value '${withval}' for --with-gpre-ada);;
   esac])
AC_ARG_WITH(gpre-cobol,
  [  --with-gpre-cobol       support COBOL in gpre (default=no)],
  [case "$withval" in
     yes) XE_APPEND(cob.cpp rmc.cpp,GPRE_LANGUAGE_MODULES)
          AC_DEFINE(GPRE_COBOL, 1, [Define this if GPRE should support COBOL]);;
     no)  ;;
     *)   AC_MSG_ERROR(bad value '${withval}' for --with-gpre-cobol);;
   esac])
AC_ARG_WITH(gpre-fortran,
  [  --with-gpre-fortran     support FORTRAN in gpre (default=no)],
  [case "$withval" in
     yes) XE_APPEND(ftn.cpp,GPRE_LANGUAGE_MODULES)
          AC_DEFINE(GPRE_FORTRAN, 1, [Define this if GPRE should support FORTRAN]);;
     no)  ;;
     *)   AC_MSG_ERROR(bad value '${withval}' for --with-gpre-fortran);;
   esac])
AC_ARG_WITH(gpre-pascal,
  [  --with-gpre-pascal      support PASCAL in gpre (default=no)],
  [case "$withval" in
     yes) XE_APPEND(pas.cpp,GPRE_LANGUAGE_MODULES)
          AC_DEFINE(GPRE_PASCAL, 1, [Define this if GPRE should support PASCAL]);;
     no)  ;;
     *)   AC_MSG_ERROR(bad value '${withval}' for --with-gpre-pascal);;
   esac])
AC_SUBST(GPRE_LANGUAGE_MODULES)



dnl Checks for programs.
AC_PROG_AWK
AC_PROG_CC_STDC
AC_PROG_GCC_TRADITIONAL
AC_PROG_CXX
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_LIBTOOL_DLOPEN
AC_LIBTOOL_WIN32_DLL
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL

dnl Check for system header files
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(assert.h)
AC_CHECK_HEADERS(ctype.h)
AC_CHECK_HEADERS(errno.h)
AC_CHECK_HEADERS(fcntl.h)
AC_CHECK_HEADERS(grp.h)
AC_CHECK_HEADERS(pwd.h)
AC_CHECK_HEADERS(libio.h)
AC_CHECK_HEADERS(locale.h)
AC_CHECK_HEADERS(math.h)
AC_CHECK_HEADERS(pthread.h)
AC_CHECK_HEADERS(sys/types.h)
AC_CHECK_HEADERS(sys/stat.h)
AC_CHECK_HEADERS(sys/uio.h)
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
AC_CHECK_HEADERS(sys/time.h)
AC_CHECK_HEADERS(sys/timeb.h)
AC_CHECK_HEADERS(sys/param.h)
AC_CHECK_HEADERS(sys/mount.h)
AC_CHECK_HEADERS(sys/ioctl.h)
AC_CHECK_HEADERS(sys/select.h)
AC_CHECK_HEADERS(limits.h)
AC_CHECK_HEADERS(setjmp.h)
AC_CHECK_HEADERS(stdarg.h)
AC_CHECK_HEADERS(stdlib.h)
AC_CHECK_HEADERS(string.h)
AC_CHECK_HEADERS(signal.h sys/signal.h sys/siginfo.h)
AC_CHECK_HEADERS(termio.h termios.h)
if test "$EDITLINE_FLG" = "Y"; then
  AC_HEADER_DIRENT
  AC_DEFINE(HAVE_EDITLINE_H, 1, [Define this if editline is in use])
fi
AC_CHECK_HEADERS(unistd.h)
AC_CHECK_HEADERS(varargs.h)
AC_CHECK_HEADERS(crypt.h)
AC_CHECK_HEADERS(netinet/in.h rpc/rpc.h netconfig.h)
AC_CHECK_HEADERS(rpc/xdr.h,,,[#include <rpc/rpc.h>])
AC_CHECK_HEADERS(aio.h)
AC_CHECK_HEADERS(mntent.h mnttab.h sys/mntent.h sys/mnttab.h)
AC_CHECK_HEADERS(sys/ipc.h sys/file.h)
AC_CHECK_HEADERS(socket.h sys/socket.h sys/sockio.h winsock2.h)
AC_CHECK_HEADERS(sys/resource.h)
AC_CHECK_HEADERS(sys/sem.h)
AC_CHECK_HEADERS(semaphore.h)
AC_CHECK_HEADERS(float.h)
AC_CHECK_HEADERS(atomic.h)
AC_CHECK_HEADERS(atomic_ops.h)
AC_CHECK_HEADERS(utime.h)
AC_CHECK_HEADERS(poll.h)

dnl Check for libraries
AC_SEARCH_LIBS(dlopen, dl)
AC_CHECK_LIB(m, main)
if test "$EDITLINE_FLG" = "Y"; then
	AC_CHECK_LIB(curses, tgetent, TERMLIB=curses, \
		AC_CHECK_LIB(ncurses, tgetent, TERMLIB=ncurses, \
			AC_CHECK_LIB(termcap, tgetent, TERMLIB=termcap, \
				AC_CHECK_LIB(tinfo, tgetent, TERMLIB=tinfo, \
					AC_MSG_ERROR(termcap support not found)))))
	AC_SUBST(TERMLIB)
fi

AC_SEARCH_LIBS(inet_aton, resolv)

dnl HP-UX atomic routines are in atomic library, not standard C library.
dnl If we can't find atomic routines in vendor library, look for atomic_ops.
AC_SEARCH_LIBS(atomic_inc, atomic,,
	AC_CHECK_LIB(atomic_ops, main))

dnl Check for libraries for static C++ runtime linking
AC_CHECK_LIB(supc++, main, XE_APPEND(-lsupc++, STATIC_CXXSUPPORT_LIB))
AC_CHECK_LIB(gcc_eh, main, XE_APPEND(-lgcc_eh, STATIC_CXXSUPPORT_LIB))
AC_SUBST(STATIC_CXXSUPPORT_LIB)

AC_LANG_PUSH(C++)
dnl check for INFINITY in math.h
AC_COMPILE_IFELSE(
	[AC_LANG_PROGRAM([[#include <math.h>]], [[double x = INFINITY;]])],
	AC_DEFINE(HAVE_INFINITY, 1, [Define this if INFINITY is defined in math.h]))

dnl check for va_copy() in stdarg.h
AC_COMPILE_IFELSE(
	[AC_LANG_PROGRAM([[#include <stdarg.h>
		void vafun(const char* fmt, ...) {va_list par, par2; va_start(par, fmt); va_copy(par2, par); va_end(par2); va_end(par);}]], 
		[[return 0;]])],
	AC_DEFINE(HAVE_VA_COPY, 1, [Define this if va_copy() is defined in stdarg.h]))

if test "$AR_OPT_CHECK" = "true"; then
dnl if 64-bit mode, then archive tool, ar, needs -X64 option
    AC_COMPILE_IFELSE(
        [AC_LANG_PROGRAM(,[[int lp64 = __64BIT__; ]])],
        [AR_OPTIONS=-X64],)
fi
AC_LANG_POP(C++)

dnl Check for functions
AC_CHECK_FUNCS(gettimeofday)
if test "$ac_cv_func_gettimeofday" = "yes"; then
    AC_MSG_CHECKING(if gettimeofday accepts second (timezone) argument)
    AC_TRY_COMPILE([#include <sys/time.h>],
    [struct timeval tp; gettimeofday(&tp, (struct timezone *)0);],
    [AC_DEFINE(GETTIMEOFDAY_RETURNS_TIMEZONE, 1,
       [Define this if gettimeofday accepts second (timezone) argument])
     AC_MSG_RESULT(yes)],
    [AC_MSG_RESULT(no)])
  AH_BOTTOM([#ifdef GETTIMEOFDAY_RETURNS_TIMEZONE
#define GETTIMEOFDAY(x) gettimeofday((x), (struct timezone *)0)
#else
#define GETTIMEOFDAY(x) gettimeofday((x))
#endif])
fi
AC_CHECK_FUNCS(time times)
AC_CHECK_FUNCS(nanosleep)
AC_SEARCH_LIBS(gethostname,nsl)
AC_SEARCH_LIBS(gethostbyname,nsl)
AC_SEARCH_LIBS(connect,socket)
AC_CHECK_FUNCS(strcasecmp stricmp)
AC_CHECK_FUNCS(strncasecmp strnicmp)
if test "$ac_cv_func_strcasecmp" = "no" -a "$ac_cv_func_stricmp" = "no"; then
  dnl EKU: On SINIX-Z strcasecmp is in libresolv.
  dnl CVC: Maybe other platforms need this, too? Otherwise, delete the block.
  AC_CHECK_LIB(resolv, strcasecmp,
    [XE_APPEND(-lresolv,LIBS)
     unset ac_cv_func_strcasecmp
     AC_CHECK_FUNCS(strcasecmp)],, $LIBS)
fi
AC_SEARCH_LIBS(dirname, gen)
AC_CHECK_FUNCS(dirname)
AC_CHECK_FUNCS(sigaction setitimer)
AC_CHECK_FUNCS(snprintf vsnprintf)
AC_CHECK_FUNCS(swab _swab)
AC_FUNC_MMAP
AC_FUNC_FORK
AC_FUNC_SETPGRP
AC_CHECK_FUNCS(setpgid)
AC_FUNC_GETPGRP
AC_CHECK_FUNCS(flock)
AC_CHECK_FUNCS(dladdr)
AC_CHECK_FUNCS(initgroups)
AC_CHECK_FUNCS(getpagesize)
AC_CHECK_FUNCS(pread pwrite)
AC_CHECK_FUNCS(getcwd getwd)
AC_CHECK_FUNCS(setmntent getmntent)
if test "$ac_cv_func_getmntent" = "yes"; then
  AC_MSG_CHECKING(if getmntent needs second argument)
  AC_TRY_COMPILE([#include <stdio.h>
#include <sys/mnttab.h>],
  [FILE *f; struct mntent *m; getmntent(f, m);],
  [AC_DEFINE(GETMNTENT_TAKES_TWO_ARGUMENTS, 1,
    [Define this if getmntent needs second argument])
   AC_MSG_RESULT(yes)],
  [AC_MSG_RESULT(no)])
fi
AC_CHECK_FUNCS(setrlimit getrlimit)
AC_CHECK_FUNCS(tcgetattr strdup)
AC_CHECK_FUNCS(mkstemp)
AC_CHECK_FUNCS(pthread_keycreate pthread_key_create)
AC_CHECK_FUNCS(llrint)
AC_CHECK_FUNCS(localtime_r)
AC_CHECK_FUNCS(gmtime_r)
AC_CHECK_FUNCS(fchmod)
AC_CHECK_FUNCS(semtimedop)
AC_CHECK_FUNCS(fegetenv)
AC_CHECK_FUNCS(strerror_r)
case $host in
	*-darwin*)
	ac_cv_func_fdatasync=no
	;;
	*)
AC_CHECK_FUNCS(fdatasync fsync)
	;;
esac
AC_CHECK_FUNCS(poll)
dnl AC_CHECK_FUNCS(AO_compare_and_swap_full)
AC_COMPILE_IFELSE(
	[AC_LANG_PROGRAM([[#include <atomic_ops.h>]], [[AO_T x; AO_compare_and_swap_full(&x, 0, 0); return 0;]])],
	AC_DEFINE(HAVE_AO_COMPARE_AND_SWAP_FULL, 1, [Define this if AO_compare_and_swap_full() is defined in atomic_ops.h]))

dnl Checks for pthread functions
AC_CHECK_FUNCS(pthread_mutexattr_setprotocol)
AC_CHECK_FUNCS(pthread_mutexattr_setrobust_np)
AC_CHECK_FUNCS(pthread_mutex_consistent_np)

dnl Semaphores
if test "$ac_cv_header_semaphore_h" = "yes"; then
    save_sem_libs=$LIBS
    save_sem_cflags=$CFLAGS
    LIBS="$LIBS $PTHREAD_LIBS"
    CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
AC_SEARCH_LIBS(sem_init, rt)
AC_CHECK_FUNCS(sem_timedwait)
AC_CHECK_FUNCS(sem_init)
if test "$ac_cv_func_sem_init" = "yes"; then
AC_MSG_CHECKING(for working sem_init())
AC_TRY_RUN([#include <semaphore.h>
	main () {
		sem_t s;
		exit(sem_init(&s,0,0));
		}
	],
[AC_DEFINE(WORKING_SEM_INIT,1,[Define this if sem_init() works on the platform])
AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
AC_SEARCH_LIBS(sem_open, rt)])
fi
LIBS=$save_sem_libs
CFLAGS=$save_sem_cflags
fi

dnl HPUX has a bug in .h files. To detect it we need C++ here.
AC_LANG_PUSH(C++)
AC_LINK_IFELSE(
	[AC_LANG_PROGRAM([[#include <fcntl.h>]], [[posix_fadvise(0, 0, 0, 0);]])],
	AC_DEFINE(HAVE_POSIX_FADVISE, 1, [Define this if posix_fadvise() is present on the platform]))
AC_LANG_POP(C++)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_BIGENDIAN
AC_C_VOLATILE
AC_TYPE_SIGNAL
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_TYPE_UID_T
AC_SYS_LARGEFILE
if test "$ac_cv_sys_file_offset_bits" = "no"; then
  AC_MSG_CHECKING(for native large file support)
  AC_TRY_RUN([#include <unistd.h>
    main () {
    exit(!(sizeof(off_t) == 8));
  }],
  [ac_cv_sys_file_offset_bits=64; AC_DEFINE(_FILE_OFFSET_BITS,64)
   AC_MSG_RESULT(yes)],
  [AC_MSG_RESULT(no)])
fi

AC_CHECK_SIZEOF(void *)
VOID_PTR_SIZE=$ac_cv_sizeof_void_p
AC_SUBST(VOID_PTR_SIZE)

AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(size_t)
AC_CHECK_TYPES([socklen_t],,,[#include <sys/socket.h>])
AH_BOTTOM([#ifndef HAVE_SOCKLEN_T
typedef int socklen_t;
#endif])
AC_CHECK_TYPES([semun])
if test "$ac_cv_type_semun" = "no"; then
  AC_MSG_CHECKING(if sem.h defines semun)
  AC_TRY_COMPILE([#include <sys/types.h>
      #include <sys/ipc.h>
      #include <sys/sem.h>],
  [union semun s;],
  [ac_cv_type_semun=yes; AC_DEFINE(HAVE_SEMUN) AC_MSG_RESULT(yes)],
  [AC_MSG_RESULT(no)])
fi

AC_CHECK_TYPES([struct XDR::xdr_ops],,,[#include <rpc/rpc.h>
#include <rpc/xdr.h>])
AC_CHECK_TYPES([struct xdr_ops],,,[#include <rpc/rpc.h>
#include <rpc/xdr.h>])

dnl AC_STRUCT_DIRENT_D_TYPE
AC_CHECK_MEMBER([struct dirent.d_type],
				AC_DEFINE(HAVE_STRUCT_DIRENT_D_TYPE,1,[Define this if struct dirent has d_type]),,
				[#include <dirent.h>])

dnl EKU: try to determine the alignment of long and double
dnl      replaces FB_ALIGNMENT and FB_DOUBLE_ALIGN in src/jrd/common.h
AC_MSG_CHECKING(alignment of long)
AC_TRY_RUN([main () {
  struct s {
    char a;
    long long b;
  };
  exit((int)&((struct s*)0)->b);
}], ac_cv_c_alignment=$ac_status, ac_cv_c_alignment=$ac_status)
AC_MSG_RESULT($ac_cv_c_alignment)
AC_DEFINE_UNQUOTED(FB_ALIGNMENT, $ac_cv_c_alignment, [Alignment of long])

AC_MSG_CHECKING(alignment of double)
AC_TRY_RUN([main () {
  struct s {
    char a;
    double b;
  };
  exit((int)&((struct s*)0)->b);
}], ac_cv_c_double_align=$ac_status, ac_cv_c_double_align=$ac_status)
AC_MSG_RESULT($ac_cv_c_double_align)
AC_DEFINE_UNQUOTED(FB_DOUBLE_ALIGN, $ac_cv_c_double_align, [Alignment of double])

dnl EKU: don't know how to convert this into an autoconf test:
dnl      #define FB_ALIGN(n,b) ...
dnl
dnl      VMS           (n)                       -> no
dnl      sun_68k       ((n+1) & ~1)              -> even
dnl      XENIX         ((n+1) & ~1)              -> even
dnl      netware_386   ((n+1) & ~1)              -> even
dnl      all others    ((n + b - 1) & ~(b - 1))  -> multiple of b
dnl
dnl      volunters are welcome!



dnl EKU: Add any platform specific tests below
case "$PLATFORM" in
  LINUX)
    dnl MOD: Check for /proc/self/exe mainly used on linux systems
    dnl      this is used to determine path to executable file.
    AC_CHECK_FILES(/proc/self/exe)
    ;;

  FREEBSD|GENTOOFREEBSD)
    dnl the AC_CHECK_TYPES for socklen_t doesn't include sys/socket.h
    dnl so test for socklen_t with sys/socket.h included
    AC_MSG_CHECKING(if sys/socket.h defines socklen_t)
    AC_TRY_COMPILE([#include <sys/types.h>
       #include <sys/socket.h>],
    [socklen_t s;],
    [AC_DEFINE(HAVE_SOCKLEN_T) AC_MSG_RESULT(yes)],
    [AC_MSG_RESULT(no)])
    ;;

  SOLARIS|solx86)
    if test "$EDITLINE_FLG" = "Y"; then
       AC_CHECK_LIB(termcap, main, XE_APPEND(-ltermcap,EDITLINE_A))
    fi

    AC_CHECK_TYPES([caddr_t])

    AC_ARG_WITH(sfio,
      AC_HELP_STRING([--with-sfio=PATH],
        [use sfio (replacement stdio on Solaris) (default=no)]),
		[ac_cv_use_sfio=$withval],[ac_cv_use_sfio=no])

    if test "$ac_cv_use_sfio" = "no"; then
      SFIO_DIR=""
      SFIO_FLAGS=""
      SFIO_LDFLAGS=""
    else
      AC_CHECK_LIB(sfio, main)
      dnl Kkuznetsov: using sfio-mt looks like double protecting of FILE*
      dnl and I avoid to use vthread based on posix threading
      #AC_CHECK_LIB(sfio-mt, main,,
      #AC_MSG_ERROR([sfio library not found]),-lvthread)
      #XE_PREPEND(-lvthread,LIBS)

      SFIO_DIR="$ac_cv_use_sfio"
      SFIO_FLAGS="-DSFIO -I$ac_cv_use_sfio/include"
      SFIO_LDFLAGS="-L$ac_cv_use_sfio/lib"
      SFIO_EXAMPLES="Y"
    fi
    ;;

  win32)
    FB_PIPE_NAME=interbas
    AC_ARG_WITH(pipe-name,
      [  --with-pipe-name        specify wnet pipe name (default=interbas)],
      [FB_PIPE_NAME=${withval}])
    AH_VERBATIM(FB_PIPE_NAME,
[/* Wnet pipe name */
#define FB_PIPE_NAME "interbas"])
    AC_DEFINE_UNQUOTED(FB_PIPE_NAME,"$FB_PIPE_NAME")
    AC_SUBST(FB_PIPE_NAME)
    XE_PREPEND( -mno-cygwin -mthreads -lmpr -lversion -lws2_32 -lole32,LIBS)
    ;;

  *)
    ;;
esac

dnl Detect support for ISO syntax for thread-locals
pre_tls_cxxflags=$CXXFLAGS
CXXFLAGS=$TLS_OPTIONS
AC_COMPILE_IFELSE(
  [AC_LANG_PROGRAM([[__thread int a = 42;]],[[a = a + 1;]])],
  AC_DEFINE(HAVE___THREAD, 1, [Define it if compiler supports ISO syntax for thread-local storage]),)
CXXFLAGS=$pre_tls_cxxflags
AC_SUBST(TLS_OPTIONS)
AC_SUBST(ATOMIC_OPTIONS)

dnl ##################### DO NOT ADD ANY TESTS BELOW ###########################

AC_SUBST(SFIO_DIR)
AC_SUBST(SFIO_FLAGS)
AC_SUBST(SFIO_LDFLAGS)
AC_SUBST(SFIO_EXAMPLES)

dnl The following file defines the version number strings. Specially for install/uninstall routines
. ./src/misc/writeBuildNum.sh

AC_SUBST(FIREBIRD_VERSION)
AC_SUBST(FIREBIRD_PACKAGE_VERSION)
AC_SUBST(FB_BUILD_NUM, $BuildNum)

BUILD_ROOT_DIR=`pwd`
SRC_ROOT=$BUILD_ROOT_DIR/src
GEN_ROOT=$BUILD_ROOT_DIR/gen
NEW_FIREBIRD_DIR=$GEN_ROOT/firebird

AC_SUBST(BUILD_ROOT_DIR)
AC_SUBST(NEW_FIREBIRD_DIR)

AC_DEFINE_UNQUOTED(FB_PREFIX, $(if test "x$prefix" = "xNONE" ; then echo \"$ac_default_prefix\"; else echo \"$prefix\"; fi), [Installation path prefix])

AC_CONFIG_COMMANDS(,,[
dnl ### GEN ### directories for preprocessed cpp, databases and output
mkdir -p gen/alice
mkdir -p gen/burp
mkdir -p gen/dsql
mkdir -p gen/dudley
mkdir -p gen/gpre
mkdir -p gen/iscguard
mkdir -p gen/isql
mkdir -p gen/jrd
mkdir -p gen/jrd/extds
mkdir -p gen/jrd/trace
mkdir -p gen/msgs
mkdir -p gen/qli
mkdir -p gen/utilities
mkdir -p gen/examples

dnl # some .o and .d in this directory (to be removed)
mkdir -p gen/remote/os/win32
mkdir -p gen/remote/os/sun

dnl # databases and output
mkdir -p gen/refDatabases
mkdir -p gen/firebird/include
mkdir -p gen/firebird/intl
mkdir -p gen/firebird/UDF
mkdir -p gen/firebird/bin
mkdir -p gen/firebird/plugins
mkdir -p gen/firebird/examples/api
mkdir -p gen/firebird/examples/dyn
dnl # mkdir -p gen/firebird/examples/build_unix
dnl # mkdir -p gen/firebird/examples/build_win32
mkdir -p gen/firebird/examples/empbuild
mkdir -p gen/firebird/examples/include
mkdir -p gen/firebird/examples/stat
mkdir -p gen/firebird/examples/udf
mkdir -p gen/firebird/lib
mkdir -p gen/firebird/misc
mkdir -p gen/firebird/help

dnl # rebuild version header if needed
./src/misc/writeBuildNum.sh rebuildHeader

dnl #### TEMP ######### directories for .o and .d
dnl # by module name

mkdir -p temp/boot/alice
mkdir -p temp/boot/auth/trusted
mkdir -p temp/boot/burp
mkdir -p temp/boot/common/classes
mkdir -p temp/boot/common/config
mkdir -p temp/boot/config
mkdir -p temp/boot/dsql
mkdir -p temp/boot/dudley
mkdir -p temp/boot/extlib
mkdir -p temp/boot/extlib/fbudf
mkdir -p temp/boot/gpre
mkdir -p temp/boot/intl
mkdir -p temp/boot/ipserver
mkdir -p temp/boot/iscguard
mkdir -p temp/boot/isql
mkdir -p temp/boot/jrd
mkdir -p temp/boot/jrd/extds
mkdir -p temp/boot/jrd/trace
mkdir -p temp/boot/jrd/os/posix
mkdir -p temp/boot/jrd/os/win32
mkdir -p temp/boot/jrd/os/darwin
mkdir -p temp/boot/lock
mkdir -p temp/boot/misc
mkdir -p temp/boot/msgs
mkdir -p temp/boot/qli
mkdir -p temp/boot/remote
mkdir -p temp/boot/remote/os/win32
mkdir -p temp/boot/remote/os/sun
mkdir -p temp/boot/remote/os/darwin
mkdir -p temp/boot/utilities/common
mkdir -p temp/boot/utilities/fbtracemgr
mkdir -p temp/boot/utilities/gsec
mkdir -p temp/boot/utilities/gstat
mkdir -p temp/boot/utilities/guard
mkdir -p temp/boot/utilities/ibmgr
mkdir -p temp/boot/utilities/install
mkdir -p temp/boot/utilities/nbackup
mkdir -p temp/boot/utilities/rebuild
mkdir -p temp/boot/utilities/ntrace
mkdir -p temp/boot/vulcan

mkdir -p temp/extern/binreloc
mkdir -p temp/std/alice
mkdir -p temp/std/auth/trusted
mkdir -p temp/std/burp
mkdir -p temp/std/common/classes
mkdir -p temp/std/common/config
mkdir -p temp/std/config
mkdir -p temp/std/dsql
mkdir -p temp/std/dudley
mkdir -p temp/std/extlib
mkdir -p temp/std/extlib/fbudf
mkdir -p temp/std/gpre
mkdir -p temp/std/intl
mkdir -p temp/std/ipserver
mkdir -p temp/std/iscguard
mkdir -p temp/std/isql
mkdir -p temp/std/jrd
mkdir -p temp/std/jrd/extds
mkdir -p temp/std/jrd/trace
mkdir -p temp/std/jrd/os/posix
mkdir -p temp/std/jrd/os/win32
mkdir -p temp/std/jrd/os/darwin
mkdir -p temp/std/lock
mkdir -p temp/std/misc
mkdir -p temp/std/msgs
mkdir -p temp/std/qli
mkdir -p temp/std/remote
mkdir -p temp/std/remote/os/win32
mkdir -p temp/std/remote/os/sun
mkdir -p temp/std/remote/os/darwin
mkdir -p temp/std/utilities/common
mkdir -p temp/std/utilities/fbtracemgr
mkdir -p temp/std/utilities/gsec
mkdir -p temp/std/utilities/gstat
mkdir -p temp/std/utilities/guard
mkdir -p temp/std/utilities/ibmgr
mkdir -p temp/std/utilities/install
mkdir -p temp/std/utilities/nbackup
mkdir -p temp/std/utilities/rebuild
mkdir -p temp/std/utilities/ntrace
mkdir -p temp/std/vulcan

mkdir -p temp/superclient/alice
mkdir -p temp/superclient/auth/trusted
mkdir -p temp/superclient/burp
mkdir -p temp/superclient/common/classes
mkdir -p temp/superclient/common/config
mkdir -p temp/superclient/config
mkdir -p temp/superclient/dsql
mkdir -p temp/superclient/dudley
mkdir -p temp/superclient/extlib
mkdir -p temp/superclient/extlib/fbudf
mkdir -p temp/superclient/gpre
mkdir -p temp/superclient/intl
mkdir -p temp/superclient/ipserver
mkdir -p temp/superclient/iscguard
mkdir -p temp/superclient/isql
mkdir -p temp/superclient/jrd
mkdir -p temp/superclient/jrd/extds
mkdir -p temp/superclient/jrd/trace
mkdir -p temp/superclient/jrd/os/posix
mkdir -p temp/superclient/jrd/os/win32
mkdir -p temp/superclient/jrd/os/darwin
mkdir -p temp/superclient/lock
mkdir -p temp/superclient/misc
mkdir -p temp/superclient/msgs
mkdir -p temp/superclient/qli
mkdir -p temp/superclient/remote
mkdir -p temp/superclient/remote/os/win32
mkdir -p temp/superclient/remote/os/sun
mkdir -p temp/superclient/remote/os/darwin
mkdir -p temp/superclient/utilities/common
mkdir -p temp/superclient/utilities/fbtracemgr
mkdir -p temp/superclient/utilities/gsec
mkdir -p temp/superclient/utilities/gstat
mkdir -p temp/superclient/utilities/guard
mkdir -p temp/superclient/utilities/ibmgr
mkdir -p temp/superclient/utilities/install
mkdir -p temp/superclient/utilities/nbackup
mkdir -p temp/superclient/utilities/rebuild
mkdir -p temp/superclient/utilities/ntrace
mkdir -p temp/superclient/vulcan

mkdir -p temp/superserver/alice
mkdir -p temp/superserver/auth/trusted
mkdir -p temp/superserver/burp
mkdir -p temp/superserver/common/classes
mkdir -p temp/superserver/common/config
mkdir -p temp/superserver/config
mkdir -p temp/superserver/dsql
mkdir -p temp/superserver/dudley
mkdir -p temp/superserver/extlib
mkdir -p temp/superserver/extlib/fbudf
mkdir -p temp/superserver/gpre
mkdir -p temp/superserver/intl
mkdir -p temp/superserver/ipserver
mkdir -p temp/superserver/iscguard
mkdir -p temp/superserver/isql
mkdir -p temp/superserver/jrd
mkdir -p temp/superserver/jrd/extds
mkdir -p temp/superserver/jrd/trace
mkdir -p temp/superserver/jrd/os/posix
mkdir -p temp/superserver/jrd/os/win32
mkdir -p temp/superserver/jrd/os/darwin
mkdir -p temp/superserver/lock
mkdir -p temp/superserver/misc
mkdir -p temp/superserver/msgs
mkdir -p temp/superserver/qli
mkdir -p temp/superserver/remote
mkdir -p temp/superserver/remote/os/win32
mkdir -p temp/superserver/remote/os/sun
mkdir -p temp/superserver/remote/os/darwin
mkdir -p temp/superserver/utilities/common
mkdir -p temp/superserver/utilities/fbtracemgr
mkdir -p temp/superserver/utilities/gsec
mkdir -p temp/superserver/utilities/gstat
mkdir -p temp/superserver/utilities/guard
mkdir -p temp/superserver/utilities/ibmgr
mkdir -p temp/superserver/utilities/install
mkdir -p temp/superserver/utilities/nbackup
mkdir -p temp/superserver/utilities/rebuild
mkdir -p temp/superserver/utilities/ntrace
mkdir -p temp/superserver/vulcan

])


MAKE_SRC_DIR=builds/posix

dnl common files for all posix hosts
dnl TODO: fix "arch-specific/linux/" paths for common posix scripts with SVN
AC_CONFIG_FILES([gen/install/misc/firebird.conf:builds/install/misc/firebird.conf.in
gen/install/misc/aliases.conf:builds/install/misc/aliases.conf.in
gen/install/misc/fbintl.conf:builds/install/misc/fbintl.conf
gen/install/misc/fbtrace.conf:src/utilities/ntrace/fbtrace.conf
gen/firebird/bin/fb_config:builds/install/misc/fb_config.in
gen/firebird/bin/posixLibrary.sh:builds/install/misc/posixLibrary.sh.in
gen/firebird/bin/classicLibrary.sh:builds/install/misc/classicLibrary.sh.in
gen/firebird/bin/superLibrary.sh:builds/install/misc/superLibrary.sh.in
gen/firebird/bin/changeRunUser.sh:builds/install/misc/changeRunUser.sh.in
gen/firebird/bin/restoreRootRunUser.sh:builds/install/misc/restoreRootRunUser.sh.in
gen/firebird/bin/tarMainInstall.sh:builds/install/arch-specific/linux/misc/tarMainInstall.sh.in
gen/firebird/bin/tarinstall.sh:builds/install/arch-specific/linux/misc/tarinstall.sh.in
gen/firebird/bin/preinstall.sh:builds/install/arch-specific/linux/misc/preinstall.sh.in
gen/firebird/bin/postinstall.sh:builds/install/arch-specific/linux/misc/postinstall.sh.in
gen/firebird/bin/preuninstall.sh:builds/install/arch-specific/linux/misc/preuninstall.sh.in
gen/firebird/bin/postuninstall.sh:builds/install/arch-specific/linux/misc/postuninstall.sh.in
gen/firebird/bin/taruninstall.sh:builds/install/arch-specific/linux/misc/taruninstall.sh.in
gen/firebird/bin/tarMainUninstall.sh:builds/install/arch-specific/linux/misc/tarMainUninstall.sh.in
gen/firebird/bin/changeDBAPassword.sh:builds/install/misc/changeDBAPassword.sh.in
gen/firebird/bin/changeGdsLibraryCompatibleLink.sh:builds/install/misc/changeGdsLibraryCompatibleLink.sh.in
gen/firebird/bin/createAliasDB.sh:builds/install/misc/createAliasDB.sh.in],
[chmod a+x gen/install/scripts/*.sh gen/install/*sh 2>/dev/null])

if test $FIREBIRD_ARCH_TYPE = classic; then
	AC_CONFIG_FILES([gen/firebird/bin/changeMultiConnectMode.sh:builds/install/misc/changeMultiConnectMode.sh.in],
	[chmod a+x gen/install/scripts/*.sh gen/install/*sh 2>/dev/null])
fi

dnl: Platform Specific Files

case "$PLATFORM" in
  LINUX|GENTOOFREEBSD)
    AC_CONFIG_COMMANDS(,,[
        mkdir -p gen/install/scripts
        mkdir -p gen/install/misc
        mkdir -p gen/RPM/RPMS/i686
        mkdir -p gen/RPM/BUILD])

    INSTALL_SRC_DIR=builds/install/arch-specific/linux/${FIREBIRD_ARCH_TYPE}
    AC_CONFIG_FILES([gen/install/makeInstallImage.sh:builds/install/arch-specific/linux/misc/makeInstallImage.sh.in
                     gen/install/scripts/rpmheader.txt:${INSTALL_SRC_DIR}/rpmheader.txt.in
                     gen/install/scripts/rpmfiles.txt:${INSTALL_SRC_DIR}/rpmfiles.txt.in
                     gen/install/misc/firebird.xinetd:builds/install/arch-specific/linux/misc/firebird.xinetd.in
                     gen/install/misc/firebird.init.d.generic:builds/install/arch-specific/linux/misc/firebird.init.d.generic.in
                     gen/install/misc/firebird.init.d.mandrake:builds/install/arch-specific/linux/misc/firebird.init.d.mandrake.in
                     gen/install/misc/firebird.init.d.suse:builds/install/arch-specific/linux/misc/firebird.init.d.suse.in
                     gen/install/misc/firebird.init.d.debian:builds/install/arch-specific/linux/misc/firebird.init.d.debian.in
                     gen/install/misc/firebird.init.d.gentoo:builds/install/arch-specific/linux/misc/firebird.init.d.gentoo.in
                     gen/install/misc/firebird.init.d.slackware:builds/install/arch-specific/linux/misc/firebird.init.d.slackware.in
                     gen/install/misc/rc.config.firebird:builds/install/arch-specific/linux/misc/rc.config.firebird.in
                     gen/firebird/bin/linuxLibrary.sh:builds/install/arch-specific/linux/misc/linuxLibrary.sh.in]
      ,[chmod a+x gen/install/scripts/*.sh gen/install/*sh 2>/dev/null])
    ;;

  HPUX)
    HP_INSTALL_SRC_DIR=builds/install/arch-specific/hpux/${FIREBIRD_ARCH_TYPE}
    AC_CONFIG_FILES([gen/install/makeinstallImage.sh:${HP_INSTALL_SRC_DIR}/makeinstallImage.sh.in
    gen/firebirdCS.psf:${HP_INSTALL_SRC_DIR}/firebirdCS.psf.in
    gen/firebird/bin/preInstall.sh:${HP_INSTALL_SRC_DIR}/preInstall.sh.in
    gen/firebird/bin/tarInstall.sh:${HP_INSTALL_SRC_DIR}/tarInstall.sh.in
    gen/firebird/bin/tarmainInstall.sh:${HP_INSTALL_SRC_DIR}/tarmainInstall.sh.in
    gen/firebird/bin/tarUninstall.sh:${HP_INSTALL_SRC_DIR}/tarUninstall.sh.in
    gen/firebird/bin/tarmainUninstall.sh:${HP_INSTALL_SRC_DIR}/tarmainUninstall.sh.in
    gen/firebird/bin/postInstall.sh:${HP_INSTALL_SRC_DIR}/postInstall.sh.in
    gen/firebird/bin/preUninstall.sh:${HP_INSTALL_SRC_DIR}/preUninstall.sh.in
    gen/firebird/bin/postUninstall.sh:${HP_INSTALL_SRC_DIR}/postUninstall.sh.in
    gen/install/misc/firebird.init.d.hpux:builds/install/arch-specific/hpux/misc/firebird.init.d.hpux.in
    gen/install/misc/rc.config.firebird.hpux:builds/install/arch-specific/hpux/misc/rc.config.firebird.hpux.in
    gen/firebird/bin/changedbaPassword.sh:builds/install/arch-specific/hpux/misc/changedbaPassword.sh.in
    gen/firebird/bin/changegdslibrarycompatibleLink.sh:builds/install/arch-specific/hpux/misc/changegdslibrarycompatibleLink.sh.in
    gen/firebird/bin/hpuxLibrary.sh:builds/install/arch-specific/hpux/misc/hpuxLibrary.sh.in
    gen/firebird/bin/createaliasDB.sh:builds/install/arch-specific/hpux/misc/createaliasDB.sh.in],
    [chmod a+x gen/install/scripts/*.sh gen/install/*.sh 2>/dev/null])
    ;;

  AIX)
    AIX_INSTALL_SRC_DIR=builds/install/arch-specific/aix/${FIREBIRD_ARCH_TYPE}
    AC_CONFIG_FILES([gen/install/scripts/rpmheader.aix.txt:${AIX_INSTALL_SRC_DIR}/rpmheader.txt.in
    gen/install/scripts/rpmfiles.aix.txt:${AIX_INSTALL_SRC_DIR}/rpmfiles.txt.in
    gen/install/makeInstallImage.aix.sh:${AIX_INSTALL_SRC_DIR}/makeInstallImage.sh.in
    gen/firebird/bin/preinstall.aix.sh:builds/install/arch-specific/aix/misc/preinstall.sh.in
    gen/firebird/bin/tarinstall.aix.sh:builds/install/arch-specific/aix/misc/tarinstall.sh.in
    gen/firebird/bin/tarmaininstall.aix.sh:builds/install/arch-specific/aix/misc/tarmaininstall.sh.in
    gen/firebird/bin/taruninstall.aix.sh:builds/install/arch-specific/aix/misc/taruninstall.sh.in
    gen/firebird/bin/tarmainuninstall.aix.sh:builds/install/arch-specific/aix/misc/tarmainuninstall.sh.in
    gen/firebird/bin/postinstall.aix.sh:builds/install/arch-specific/aix/misc/postinstall.sh.in
    gen/firebird/bin/preuninstall.aix.sh:builds/install/arch-specific/aix/misc/preuninstall.sh.in
    gen/firebird/bin/postuninstall.aix.sh:builds/install/arch-specific/aix/misc/postuninstall.sh.in
    gen/install/misc/firebird.init.d.aix:builds/install/arch-specific/aix/misc/firebird.init.d.aix.in
    gen/install/misc/rc.config.firebird.aix:builds/install/arch-specific/aix/misc/rc.config.firebird.aix.in
    gen/firebird/bin/changedbapassword.aix.sh:builds/install/misc/changeDBAPassword.sh.in
    gen/firebird/bin/changemulticonnectmode.aix.sh:builds/install/misc/changeMultiConnectMode.sh.in
    gen/firebird/bin/changegdslibrarycompatiblelink.aix.sh:builds/install/misc/changeGdsLibraryCompatibleLink.sh.in
    gen/firebird/bin/createaliasdb.aix.sh:builds/install/misc/createAliasDB.sh.in
    gen/firebird/bin/aixLibrary.sh:builds/install/arch-specific/aix/misc/aixLibrary.sh.in],
    [chmod a+x gen/install/scripts/*.sh gen/install/*.sh 2>/dev/null])
    ;;
  FREEBSD)
    AC_CONFIG_FILES([gen/install/install.sh:builds/install/arch-specific/freebsd/install.sh.in
                     gen/install/misc/firebird_daemon_startup_script:builds/install/arch-specific/freebsd/firebird_daemon_startup_script.in
                     gen/firebird/bin/freebsdLibrary.sh:builds/install/arch-specific/freebsd/freebsdLibrary.sh.in]
      ,[chmod a+x gen/install/*.sh gen/firebird/bin/*sh 2>/dev/null])
    ;;


  NETBSD)
    AC_CONFIG_FILES([gen/install/install.netbsd.sh:builds/install/arch-specific/netbsd/install.sh.in]
      ,[chmod a+x gen/install/install.netbsd.sh 2>/dev/null])
    ;;


  solx86|SOLARIS)
    AC_CONFIG_FILES([gen/install/Pkginfo:builds/install/arch-specific/solaris/${ARCH_TYPE_SUFFIX}/pkginfo.in
                     gen/install/prototype.main:builds/install/arch-specific/solaris/${ARCH_TYPE_SUFFIX}/prototype.in
                     gen/install/prototype.icu:builds/install/arch-specific/solaris/${ARCH_TYPE_SUFFIX}/prototype.icu.in
                     gen/install/Preinstall:builds/install/arch-specific/solaris/${ARCH_TYPE_SUFFIX}/preinstall.in
                     gen/install/Postinstall:builds/install/arch-specific/solaris/${ARCH_TYPE_SUFFIX}/postinstall.in
                     gen/install/Postremove:builds/install/arch-specific/solaris/${ARCH_TYPE_SUFFIX}/postremove.in
                     gen/install/prototypelg:builds/install/arch-specific/solaris/libgcc/prototypelg.in
                     gen/install/pkginfolg:builds/install/arch-specific/solaris/libgcc/pkginfolg.in
      ],[chmod a+x gen/install/Pre* gen/install/Post* 2>/dev/null])
    ;;

  DARWIN)
    ;;
esac
if test -f ${MAKE_SRC_DIR}/postfix.${MAKEFILE_POSTFIX};then
	POSTFIX_FILE=gen/make.platform.postfix:${MAKE_SRC_DIR}/postfix.${MAKEFILE_POSTFIX}
	POSTFIX_INCLUDE='include $(ROOT)/gen/make.platform.postfix'
else
	POSTFIX_FILE=
	POSTFIX_INCLUDE=
fi
AC_SUBST(POSTFIX_INCLUDE)

UDF_COMMENT="#"
if test -n "${with_fbudf}"; then
	UDF_COMMENT="#
#  #  For this build Restrict UDF means Restrict ${with_fbudf}
#"
fi
AC_SUBST(UDF_COMMENT)

AC_CONFIG_FILES(
gen/make.rules:${MAKE_SRC_DIR}/make.rules
gen/make.defaults:${MAKE_SRC_DIR}/make.defaults
gen/make.platform:${MAKE_SRC_DIR}/prefix.${MAKEFILE_PREFIX}
gen/darwin.defaults:${MAKE_SRC_DIR}/darwin.defaults
${POSTFIX_FILE}
gen/make.shared.variables:${MAKE_SRC_DIR}/make.shared.variables
gen/make.shared.targets:${MAKE_SRC_DIR}/make.shared.targets
gen/Makefile:${MAKE_SRC_DIR}/Makefile.in.firebird
gen/Makefile.codes:${MAKE_SRC_DIR}/Makefile.in.codes
gen/Makefile.boot.gpre:${MAKE_SRC_DIR}/Makefile.in.boot.gpre
gen/Makefile.libfbstatic:${MAKE_SRC_DIR}/Makefile.in.libfbstatic
gen/Makefile.static.gpre:${MAKE_SRC_DIR}/Makefile.in.static.gpre
gen/Makefile.static.gbak:${MAKE_SRC_DIR}/Makefile.in.static.gbak
gen/Makefile.static.isql:${MAKE_SRC_DIR}/Makefile.in.static.isql
gen/Makefile.static.createdb:${MAKE_SRC_DIR}/Makefile.in.static.createdb
gen/Makefile.refDatabases:${MAKE_SRC_DIR}/Makefile.in.refDatabases
gen/Makefile.fbserver:${MAKE_SRC_DIR}/Makefile.in.fbserver
gen/Makefile.smp_server:${MAKE_SRC_DIR}/Makefile.in.smp_server
gen/Makefile.libfbclient:${MAKE_SRC_DIR}/Makefile.in.libfbclient
gen/Makefile.client.fbudf:${MAKE_SRC_DIR}/Makefile.in.client.fbudf
gen/Makefile.client.gbak:${MAKE_SRC_DIR}/Makefile.in.client.gbak
gen/Makefile.client.gfix:${MAKE_SRC_DIR}/Makefile.in.client.gfix
gen/Makefile.client.gdef:${MAKE_SRC_DIR}/Makefile.in.client.gdef
gen/Makefile.client.qli:${MAKE_SRC_DIR}/Makefile.in.client.qli
gen/Makefile.client.isql:${MAKE_SRC_DIR}/Makefile.in.client.isql
gen/Makefile.client.gpre:${MAKE_SRC_DIR}/Makefile.in.client.gpre
gen/Makefile.client.util:${MAKE_SRC_DIR}/Makefile.in.client.util
gen/Makefile.client.gsec:${MAKE_SRC_DIR}/Makefile.in.client.gsec
gen/Makefile.intl:${MAKE_SRC_DIR}/Makefile.in.intl
gen/Makefile.msgs:${MAKE_SRC_DIR}/Makefile.in.msgs
gen/Makefile.extlib:${MAKE_SRC_DIR}/Makefile.in.extlib
gen/examples/Makefile.examples:${MAKE_SRC_DIR}/Makefile.in.examples
gen/Makefile.libfbembed:${MAKE_SRC_DIR}/Makefile.in.libfbembed
gen/Makefile.inet_server:${MAKE_SRC_DIR}/Makefile.in.inet_server
gen/Makefile.embed.util:${MAKE_SRC_DIR}/Makefile.in.embed.util
gen/Makefile.embed.fbudf:${MAKE_SRC_DIR}/Makefile.in.embed.fbudf
gen/Makefile.embed.gfix:${MAKE_SRC_DIR}/Makefile.in.embed.gfix
gen/Makefile.embed.gbak:${MAKE_SRC_DIR}/Makefile.in.embed.gbak
gen/Makefile.embed.isql:${MAKE_SRC_DIR}/Makefile.in.embed.isql
gen/Makefile.embed.gdef:${MAKE_SRC_DIR}/Makefile.in.embed.gdef
gen/Makefile.embed.qli:${MAKE_SRC_DIR}/Makefile.in.embed.qli
gen/Makefile.embed.gpre:${MAKE_SRC_DIR}/Makefile.in.embed.gpre
gen/Makefile.fbtrace:${MAKE_SRC_DIR}/Makefile.in.fbtrace
gen/Makefile.install:builds/install/arch-specific/${INSTALL_PREFIX}/Makefile.in
Makefile:Makefile.in
)
if test "$STD_EDITLINE" = "false"; then
  AC_CONFIG_FILES(gen/Makefile.extern.editline:${MAKE_SRC_DIR}/Makefile.in.extern.editline)
fi
if test "$STD_ICU" = "false"; then
  AC_CONFIG_FILES(gen/Makefile.extern.icu:${MAKE_SRC_DIR}/Makefile.in.extern.icu)
fi


if test "$PROD_BUILD_FLG" = N; then
  DEBUG_ICU=--enable-debug
fi

case "$PLATFORM" in
  SOLARIS | solx86 )
AC_CONFIG_FILES(
gen/make.platform.solaris.examples:${MAKE_SRC_DIR}/make.platform.solaris.examples
)
;;
esac

if test "$STD_ICU" = "true"; then
AC_OUTPUT
else
AC_OUTPUT
(cd extern/icu/source
chmod +x runConfigureICU configure install-sh
./runConfigureICU "$ICU_PLATFORM" "$DEBUG_ICU" --prefix=`pwd`/..)
fi

dnl Print out the build configuration (the most interesting thing)
echo
echo
echo The Firebird2 package has been configured with the following options:
echo

case $FIREBIRD_ARCH_TYPE in
 super)   echo "                   Architecture : SuperServer";;
 classic) echo "                   Architecture : ClassicServer";;
esac

case $PROD_BUILD_FLG in
 Y)       echo "                          Debug : disabled";;
 N)       echo "                          Debug : enabled";;
esac

if test $ac_cv_sizeof_void_p -lt 8; then
  case $ac_cv_sys_file_offset_bits in
   no)      echo "64 bit I/O for 32-bit platforms : disabled";;
   64)      echo "64 bit I/O for 32-bit platforms : enabled";;
  esac
fi

case $RAW_DEVICES_FLG in
 Y)       echo "                    Raw devices : enabled";;
 N)       echo "                    Raw devices : disabled";;
esac

echo           "                   Service name : $FB_SERVICE_NAME"
echo           "                   Service port : $FB_SERVICE_PORT"

case "$PLATFORM" in
 win32)   echo "                      Pipe name : $FB_PIPE_NAME";;
esac

echo           "                   GPRE modules : c_cxx.cpp$GPRE_LANGUAGE_MODULES"
echo

echo           "                    Install Dir : $prefix"
echo

dnl EOF