File: configure.ac

package info (click to toggle)
mrxvt 0.5.4-2
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 3,056 kB
  • ctags: 3,446
  • sloc: ansic: 30,620; sh: 3,345; makefile: 294; perl: 198
file content (1570 lines) | stat: -rw-r--r-- 43,400 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
dnl# All portions of code are copyright by their respective author/s.
dnl#
dnl#  Copyright (c) 1998-2001   Geoff Wing <gcw@pobox.com>
dnl#  Copyright (c) 2003-2004   Marc Lehmann <pcg@goof.com>
dnl#  Copyright (c) 2004        Hiramatsu Yoshifumi
dnl#  Copyright (c) 2004-2006   Jingmin Zhou <jimmyzhou@users.sourceforge.net>
dnl#  Copyright (c) 2006	Gautam Iyer <gi1242@users.sourceforge.net>
dnl#	Copyright (c) 2007	Jehan Hysseo <hysseo@users.sourceforge.net>
dnl#
dnl# This program is free software; you can redistribute it and/or
dnl# modify it under the terms of the GNU General Public License as
dnl# published by the Free Software Foundation; either version 2 of
dnl# the License, or (at your option) any later version.
dnl# 
dnl# This program 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
dnl# GNU General Public License for more details.
dnl# 
dnl# You should have received a copy of the GNU General Public License
dnl# along with this program; if not, write to the Free Software
dnl# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
dnl#

dnl 2006-02-20 gi1242: If the version contains a letter, then it sometimes
dnl produces spurious results when programs use an escape sequence to query the
dnl terminal version.
AC_INIT(mrxvt, 0.5.4, [jimmyzhou@users.sourceforge.net])
AM_INIT_AUTOMAKE(mrxvt, 0.5.4)

AM_CONFIG_HEADER(config.h)
AC_CONFIG_SRCDIR([src/main.c])


AM_MAINTAINER_MODE

dnl Check OS
AC_CANONICAL_HOST
local_os_type="unknown"
case "$host" in
*-cygwin*)
    AC_DEFINE(OS_CYGWIN, [], [set OS to cygwin])
    local_os_type="cygwin"
    ;;
*-linux*)
    AC_DEFINE(OS_LINUX, [], [set OS to linux])
	dnl hack for some 64-bit systems
	AC_DEFINE(_GNU_SOURCE, [], [set GNU source flag for linux])
    local_os_type="linux"
    ;;
*-irix*)
    AC_DEFINE(OS_IRIX, [], [set OS to irix])
    local_os_type="irix"
    ;;
*-sunos*)
    AC_DEFINE(OS_SUNOS, [], [set OS to sunos])
    local_os_type="sunos"
    ;;
*-solaris*)
    AC_DEFINE(OS_SOLARIS, [], [set OS to solaris])
    local_os_type="solaris"
    ;;
*-aix*)
    AC_DEFINE(OS_AIX, [], [set OS to aix])
    local_os_type="aix"
    ;;
*-hpux*)
    AC_DEFINE(OS_HPUX, [], [set OS to hp-ux])
    local_os_type="hpux"
    ;;
*-freebsd*)
    AC_DEFINE(OS_BSD, [], [set OS to bsd])
    AC_DEFINE(OS_FREEBSD, [], [set OS to freebsd])
    local_os_type="freebsd"

    dnl our hack for freebsd system
    CFLAGS="$CFLAGS -I/usr/local/include"
    LIBS="$LIBS -L/usr/local/lib"
    ;;
*-netbsd*)
    AC_DEFINE(OS_BSD, [], [set OS to bsd])
    AC_DEFINE(OS_NETBSD, [], [set OS to netbsd])
    local_os_type="netbsd"

    dnl our hack for netbsd system
    CFLAGS="$CFLAGS -I/usr/local/include"
    LIBS="$LIBS -L/usr/local/lib"
    ;;
*-openbsd*)
    AC_DEFINE(OS_BSD, [], [set OS to bsd])
    AC_DEFINE(OS_OPENBSD, [], [set OS to openbsd])
    local_os_type="openbsd"

	dnl get openbsd release number, remove `.' from release number
	OBSD_REL=`/usr/bin/uname -r | sed 's/\.//g'`
	AC_DEFINE_UNQUOTED(OS_OPENBSD_REL, ${OBSD_REL}, [set openbsd release number])

    dnl our hack for openbsd system
    CFLAGS="$CFLAGS -I/usr/local/include"
    LIBS="$LIBS -L/usr/local/lib"
    ;;
*-osf*)
    AC_DEFINE(OS_OSF, [], [set OS to osf])
    local_os_type="osf"
    ;;
*-darwin*)
    AC_DEFINE(OS_BSD, [], [set OS to bsd])
    AC_DEFINE(OS_DARWIN, [], [set OS to darwin])
    local_os_type="darwin"
    ;;
*-sco*)
    AC_DEFINE(OS_SCO, [], [set OS to sco])
    AC_DEFINE(OS_SVR4, [], [set OS to svr4])
    local_os_type="sco"
    AC_MSG_ERROR([Mrxvt does not support f*cking SCO's products!])
esac


dnl Configuration options
support_everything=no
support_minimal=no
support_debug=no
support_ourstrings=no
support_frills=yes
support_keepscrolling=yes
support_selectionscrolling=yes
support_mousewheel=yes
support_mouseslipwheel=no
support_scroll_rxvt=yes
support_scroll_next=yes
support_scroll_xterm=yes
support_scroll_plain=yes
support_scroll_sgi=yes
support_half_shadow=yes
support_utmp=yes
support_wtmp=yes
support_lastlog=yes
support_sessionmgr=yes
support_utempter=no
support_linespace=yes
support_24bits=no
support_256colors=yes
support_cursor_blink=yes
support_pointer_blank=yes
support_text_shadow=no
support_smart_resize=no
support_menubar=no
support_background_image=yes
support_transparency=yes
dnl: support_fading=yes
support_tinting=yes
support_xrender=yes
support_xpm=yes
support_jpeg=yes
support_png=yes
support_xft=no
support_xim=no
support_greek=no
support_cjk=no
support_ttygid=yes
support_backspace_key=yes
support_delete_key=yes
use_fifo=yes
support_resources=yes
support_xgetdefault=no
support_swapscreen=yes
support_old_selection=no



AC_ARG_ENABLE(
    everything,
    AC_HELP_STRING([--enable-everything],[enable all options [[no]]]),
    [support_everything=$enableval],
    [support_everything=no]
)
if test "x$support_everything" = "xyes"; then
    support_debug=yes
    support_ourstrings=no
    support_frills=yes
    support_keepscrolling=yes
    support_selectionscrolling=yes
    support_mousewheel=yes
    support_mouseslipwheel=yes
    support_scroll_rxvt=yes
    support_scroll_next=yes
    support_scroll_sgi=yes
    support_scroll_xterm=yes
    support_scroll_plain=yes
    support_half_shadow=yes
    support_utmp=yes
    support_wtmp=yes
    support_lastlog=yes
    support_sessionmgr=yes
    support_utempter=yes
    support_linespace=yes
    support_24bits=yes
    support_256colors=yes
    support_cursor_blink=yes
    support_pointer_blank=yes
    support_text_shadow=yes
    support_smart_resize=yes
    support_menubar=yes
    support_background_image=yes
    support_transparency=yes
    dnl: support_fading=yes
    support_tinting=yes
    support_xrender=yes
    support_xpm=yes
    support_jpeg=yes
    support_png=yes
    support_xft=yes
    support_xim=yes
    support_greek=yes
    support_cjk=yes
    support_ttygid=yes
    support_backspace_key=yes
    support_delete_key=yes
    use_fifo=yes
    support_resources=yes
    support_xgetdefault=no
    support_swapscreen=yes
    support_old_selection=no
fi

AC_ARG_ENABLE(
    minimal,
    AC_HELP_STRING([--enable-minimal],[enable minimal options [[no]]]),
    [support_minimal=$enableval],
    [support_minimal=no]
)
if test "x$support_minimal" = "xyes"; then
    support_debug=no
    support_ourstrings=no
    support_frills=no
    support_keepscrolling=no
    support_selectionscrolling=no
    support_mousewheel=no
    support_mouseslipwheel=no
    support_scroll_rxvt=no
    support_scroll_next=no
    support_scroll_sgi=no
    support_scroll_xterm=yes
    support_scroll_plain=no
    support_half_shadow=no
    support_utmp=no
    support_wtmp=no
    support_lastlog=no
    support_sessionmgr=no
    support_utempter=no
    support_linespace=no
    support_24bits=no
    support_256colors=no
    support_cursor_blink=no
    support_pointer_blank=no
    support_text_shadow=no
    support_smart_resize=no
    support_menubar=no
    support_background_image=no
    support_transparency=no
    dnl: support_fading=no
    support_tinting=no
    support_xrender=no
    support_xpm=no
    support_jpeg=no
    support_png=no
    support_xft=no
    support_xim=no
    support_greek=no
    support_cjk=no
    support_ttygid=yes
    support_backspace_key=yes
    support_delete_key=yes
    use_fifo=no
    support_resources=yes
    support_xgetdefault=no
    support_swapscreen=yes
    support_old_selection=no
fi


AC_ARG_ENABLE(
    debug,
    AC_HELP_STRING([--enable-debug],[enable debug mode - for developper [[no]]]),
    [support_debug=$enableval]
)
if test "x$support_debug" = "xyes"; then
    AC_DEFINE(DEBUG, [], [set DEBUG mode])
    CFLAGS="$CFLAGS -g"
else
    AC_DEFINE(NDEBUG, [], [unset DEBUG mode])
fi


AC_ARG_ENABLE(
    ourstrings,
    AC_HELP_STRING([--enable-ourstrings],[enable our strings functions [[no]]]),
    [support_ourstrings=$enableval]
)
if test "x$support_ourstrings" = "xyes"; then
    AC_DEFINE(OUR_STRINGS, [], [use our own string functions])
fi


AC_ARG_ENABLE(
    frills,
    AC_HELP_STRING([--enable-frills],[enable internal borders / smart resizing [[yes]]]),
    [support_frills=$enableval]
)
if test "x$support_frills" != "xyes"; then
    AC_DEFINE(NO_FRILLS, [], [enable internal borders / smart resizing])
fi


AC_ARG_ENABLE(
    keepscrolling,
    AC_HELP_STRING([--enable-keepscrolling],[enable continual scrolling on scrollbar arrow press [[yes]]]),
    [support_keepscrolling=$enableval]
)
if test "x$support_keepscrolling" != "xyes"; then
    AC_DEFINE(NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING, [], [enable continual scrolling on scrollbar arrow press])
fi


AC_ARG_ENABLE(
    selectionscrolling,
    AC_HELP_STRING([--enable-selectionscrolling],[enable continual scrolling on selection [[yes]]]),
    [support_selectionscrolling=$enableval]
)
if test "x$support_selectionscrolling" = "xyes"; then
    AC_DEFINE(SELECTION_SCROLLING, [], [enable continual scrolling on selection])
fi


AC_ARG_ENABLE(
    mousewheel,
    AC_HELP_STRING([--enable-mousewheel],[enable scrolling via mouse wheel or buttons 4 & 5 [[yes]]]),
    [support_mousewheel=$enableval]
)
if test "x$support_mousewheel" = "xyes"; then
    AC_DEFINE(MOUSE_WHEEL, [], [enable scrolling via mouse wheel])
fi


AC_ARG_ENABLE(
    mouseslipwheel,
    AC_HELP_STRING([--enable-mouseslipwheel],[enable slip scrolling via mouse wheel or buttons 4 & 5 [[no]]]),
    [support_mouseslipwheel=$enableval]
)
if test "x$support_mousewheel x$support_mouseslipwheel" = "xyes xyes"; then
    AC_DEFINE(MOUSE_SLIP_WHEELING, [], [enable slip scrolling via mouse wheel])
fi


AC_ARG_ENABLE(
    rxvt-scroll,
    AC_HELP_STRING([--enable-rxvt-scroll],[enable rxvt style scrollbar [[yes]]]),
    [support_scroll_rxvt=$enableval]
)
if test "x$support_scroll_rxvt" = "xyes"; then
    AC_DEFINE(RXVT_SCROLLBAR, [], [set rxvt style scroll bar])
    AC_DEFINE(HAVE_SCROLLBARS, [], [set scroll bar support])
    support_scroll="yes"
fi


AC_ARG_ENABLE(
    next-scroll,
    AC_HELP_STRING([--enable-next-scroll],[enable NeXT style scrollbar [[yes]]]),
    [support_scroll_next=$enableval]
)
if test "x$support_scroll_next" = "xyes"; then
    AC_DEFINE(NEXT_SCROLLBAR, [], [set next style scroll bar])
    AC_DEFINE(HAVE_SCROLLBARS, [], [set scroll bar support])
    support_scroll="yes"
fi


AC_ARG_ENABLE(
    xterm-scroll,
    AC_HELP_STRING([--enable-xterm-scroll],[enable Xterm style scrollbar [[yes]]]),
    [support_scroll_xterm=$enableval]
)
if test "x$support_scroll_xterm" = "xyes"; then
    AC_DEFINE(XTERM_SCROLLBAR, [], [set xterm style scroll bar])
    AC_DEFINE(HAVE_SCROLLBARS, [], [set scroll bar support])
    support_scroll="yes"
fi


AC_ARG_ENABLE(
    plain-scroll,
    AC_HELP_STRING([--enable-plain-scroll],[enable plain style scrollbar [[yes]]]),
    [support_scroll_plain=$enableval]
)
if test "x$support_scroll_plain" = "xyes"; then
    AC_DEFINE(PLAIN_SCROLLBAR, [], [set plain style scroll bar])
    AC_DEFINE(HAVE_SCROLLBARS, [], [set scroll bar support])
    support_scroll="yes"
fi


AC_ARG_ENABLE(
    sgi-scroll,
    AC_HELP_STRING([--enable-sgi-scroll],[enable SGI IRIX style scrollbar [[yes]]]),
    [support_scroll_sgi=$enableval]
)
if test "x$support_scroll_sgi" = "xyes"; then
    AC_DEFINE(SGI_SCROLLBAR, [], [set sgi style scroll bar])
    AC_DEFINE(HAVE_SCROLLBARS, [], [set scroll bar support])
    support_scroll="yes"
fi


AM_CONDITIONAL(RXVT_SCROLLBAR, test "x$support_scroll_rxvt" = "xyes")
AM_CONDITIONAL(NEXT_SCROLLBAR, test "x$support_scroll_next" = "xyes")
AM_CONDITIONAL(XTERM_SCROLLBAR, test "x$support_scroll_xterm" = "xyes")
AM_CONDITIONAL(PLAIN_SCROLLBAR, test "x$support_scroll_plain" = "xyes")
AM_CONDITIONAL(SGI_SCROLLBAR, test "x$support_scroll_sgi" = "xyes")



AC_ARG_ENABLE(
    half-shadow,
    AC_HELP_STRING([--enable-half-shadow],[enable half width/height shadow on rxvt scrollbar [[yes]]]),
    [support_half_shadow=$enableval]
)
if test "x$support_scroll_rxvt x$support_half_shadow" = "xyes xyes"; then
    AC_DEFINE(HALFSHADOW, [], [set half shadow rxvt scrollbar support])
fi


AC_ARG_ENABLE(
    utmp,
    AC_HELP_STRING([--enable-utmp],[enable utmp/utmpx support [[yes]]]),
    [support_utmp=$enableval]
)
if test "x$support_utmp" = "xyes"; then
    AC_DEFINE(UTMP_SUPPORT, [], [set utmp support])
fi


AC_ARG_ENABLE(
    wtmp,
    AC_HELP_STRING([--enable-wtmp],[enable wtmp support (need utmp support) [[yes]]]),
    [support_wtmp=$enableval]
)
dnl depends on utmp support
if test "x$support_utmp x$support_wtmp" = "xyes xyes"; then
    AC_DEFINE(WTMP_SUPPORT, [], [set wtmp support])
fi


AC_ARG_ENABLE(
    lastlog,
    AC_HELP_STRING([--enable-lastlog],[enable lastlog support [[yes]]]),
    [support_lastlog=$enableval]
)
dnl depends on utmp support
if test "x$support_utmp x$support_lastlog" = "xyes xyes"; then
    AC_DEFINE(LASTLOG_SUPPORT, [], [set lastlog support])
fi
AM_CONDITIONAL(UTMP_SUPPORT, test "x$support_utmp" = "xyes")


AC_ARG_ENABLE(
    sessionmgr,
    AC_HELP_STRING([--enable-sessionmgr],[enable X session manager [[yes]]]),
    [support_sessionmgr=$enableval],
)


AC_ARG_ENABLE(
    utempter,
    AC_HELP_STRING([--enable-utempter],[enable utempter library for utmp/wtmp/lastlog [[no]]]),
    [support_utempter=$enableval],
)


AC_ARG_ENABLE(
    linespace,
    AC_HELP_STRING([--enable-linespace],[enable linespace support [[yes]]]),
    [support_linespace=$enableval]
)
if test "x$support_linespace" != "xyes"; then
    AC_DEFINE(NO_LINESPACE, [], [unset linespace support])
fi


AC_ARG_ENABLE(
    24bits,
    AC_HELP_STRING([--enable-24bits],[prefer 24 bits color [[no]]]),
    [support_24bits=$enableval]
)
if test "x$support_24bits" = "xyes"; then
    AC_DEFINE(PREFER_24BIT, [], [set 24 bits color support])
fi


AC_ARG_ENABLE(
    256colors,
    AC_HELP_STRING([--enable-256colors],[use 256 color [[yes]]]),
    [support_256colors=$enableval]
)
if test "x$support_256colors" = "xyes"; then
    AC_DEFINE(TTY_256COLOR, [], [set 256 color support])
fi


AC_ARG_ENABLE(
    cursor-blink,
    AC_HELP_STRING([--enable-cursor-blink],[enable cursor blinking [[yes]]]),
    [support_cursor_blink=$enableval]
)
if test "x$support_cursor_blink" = "xyes"; then
    AC_DEFINE(CURSOR_BLINK, [], [set cursor blinking support])
fi


AC_ARG_ENABLE(
    pointer-blank,
    AC_HELP_STRING([--enable-pointer-blank],[enable blank pointer [[yes]]]),
    [support_pointer_blank=$enableval]
)
if test "x$support_pointer_blank" = "xyes"; then
    AC_DEFINE(POINTER_BLANK, [], [set blank pointer support])
fi


AC_ARG_ENABLE(
    text-shadow,
    AC_HELP_STRING([--enable-text-shadow],[enable colors shadow for text [[no]]]),
    [support_text_shadow=$enableval]
)
if test "x$support_text_shadow" = "xyes"; then
    AC_DEFINE(TEXT_SHADOW, [], [set text shadow support])
fi


dnl# Make an option instead of a feature
dnl# AC_ARG_ENABLE(
dnl#     smart-resize,
dnl#     AC_HELP_STRING([--enable-smart-resize],[enable smart resizing [[no]]]),
dnl#     [support_smart_resize=$enableval]
dnl# )
dnl# if test "x$support_smart_resize" = "xyes"; then
dnl#     AC_DEFINE(SMART_RESIZE, [], [set smart resizing support])
dnl# fi


AC_ARG_ENABLE(
    menubar,
    AC_HELP_STRING([--enable-menubar],[enable menu bar [[no]]]),
    [support_menubar=$enableval]
)
if test "x$support_menubar" = "xyes"; then
    AC_DEFINE(HAVE_MENUBAR, [], [set menu bar])
fi


AC_ARG_ENABLE(
    transparency,
    AC_HELP_STRING([--enable-transparency],[enable transparent background [[yes]]]),
    [support_transparency=$enableval]
)
if test "x$support_transparency" = "xyes"; then
    AC_DEFINE(TRANSPARENT, [], [set transparent background])
fi


dnl: No longer a compile time option, and OFF_FOCUS_FADING is now always
dnl: enabled. 2006-09-14 gi1242.
dnl:
dnl: AC_ARG_ENABLE(
dnl:     fading,
dnl:     AC_HELP_STRING([--enable-fading],[enable colors fading when off focus [[yes]]]),
dnl:     [support_fading=$enableval]
dnl: )
dnl: if test "x$support_fading" = "xyes"; then
dnl:     AC_DEFINE(OFF_FOCUS_FADING, [], [set fading support])
dnl: fi


AC_ARG_ENABLE(
    tinting,
    AC_HELP_STRING([--enable-tinting],[enable colors tinting [[yes]]]),
    [support_tinting=$enableval]
)

AC_ARG_ENABLE(
    xrender,
    AC_HELP_STRING([--enable-xrender],[tint using XRender (slower but nicer results) [[yes]]]),
    [support_xrender=$enableval]
)


AC_ARG_ENABLE(
    xpm,
    AC_HELP_STRING([--enable-xpm],[enable XPM background pixmaps [[yes]]]),
    [support_xpm=$enableval],
)


AC_ARG_ENABLE(
    jpeg,
    AC_HELP_STRING([--enable-jpeg],[enable JPEG background pixmaps [[yes]]]),
    [support_jpeg=$enableval],
)


AC_ARG_ENABLE(
    png,
    AC_HELP_STRING([--enable-png],[enable PNG background pixmaps [[yes]]]),
    [support_png=$enableval],
)


AC_ARG_ENABLE(
    xft,
    AC_HELP_STRING([--enable-xft],[enable freetype font support [[no]]]),
    [support_xft=$enableval]
)


AC_ARG_ENABLE(
    xim,
    AC_HELP_STRING([--enable-xim],[enable XIM support [[no]]]),
    [support_xim=$enableval]
)


AC_ARG_ENABLE(
    greek,
    AC_HELP_STRING([--enable-greek],[enable Greek keyboard support [[no]]]),
    [support_greek=$enableval]
)
if test "x$support_greek" = "xyes"; then
    AC_DEFINE(GREEK_SUPPORT, [], [set Greek keyboard support])
fi
AM_CONDITIONAL(GREEK, test "x$support_greek" = "xyes")


AC_ARG_ENABLE(
    cjk,
    AC_HELP_STRING([--enable-cjk],[enable CJK multichar language support [[no]]]),
    [support_cjk=$enableval]
)


AC_ARG_ENABLE(
    ttygid,
    AC_HELP_STRING([--enable-ttygid],[enable ttygid to group tty [[yes]]]),
    [support_ttygid=$enableval]
)
if test "x$support_ttygid" = "xyes"; then
    AC_DEFINE(TTY_GID_SUPPORT, [], [set ttygid support])
fi


AC_ARG_ENABLE(
    backspace-key,
    AC_HELP_STRING([--enable-backspace-key],[enable handling of the backspace key [[yes]]]),
    [support_backspace_key=$enableval]
)
if test "x$support_backspace_key" != "xyes"; then
    AC_DEFINE(NO_BACKSPACE_KEY, [], [disable handling of backspace key])
fi


AC_ARG_ENABLE(
    delete-key,
    AC_HELP_STRING([--enable-delete-key],[enable handling of the delete key [[yes]]]),
    [support_delete_key=$enableval]
)
if test "x$support_delete_key" != "xyes"; then
    AC_DEFINE(NO_DELETE_KEY, [], [disable handling of the delete key])
fi

AC_ARG_ENABLE(
    use-fifo,
    AC_HELP_STRING([--enable-use-fifo],[Enable listening for macros on a fifo [[yes]]]),
    [use_fifo=$enableval]
)
if test "x$use_fifo" = "xyes"; then
    AC_DEFINE(USE_FIFO, [], [Enable listening for macros on a fifo])
fi


AC_ARG_ENABLE(
    resources,
    AC_HELP_STRING([--enable-resources],[enable all resource checking [[yes]]]),
    [support_resources=$enableval]
)
if test "x$support_resources" != "xyes"; then
    AC_DEFINE(NO_RESOURCES, [], [disable all resource checking])
fi


AC_ARG_ENABLE(
    swapscreen,
    AC_HELP_STRING([--enable-swapscreen],[enable swap screen support [[yes]]]),
    [support_swapscreen=$enableval]
)
if test "x$support_swapscreen" != "xyes"; then
    AC_DEFINE(NO_SECONDARY_SCREEN, [], [disable swap screen support])
fi


AC_ARG_ENABLE(
    old-selection,
    AC_HELP_STRING([--enable-old-selection],[enable old mouse selection code [[no]]]),
    [support_old_selection=$enableval]
)
if test "x$support_old_selection" = "xyes"; then
    AC_DEFINE(NO_NEW_SELECTION, [], [enable old mouse selection])
else
    AC_DEFINE(NO_OLD_SELECTION, [], [disable old mouse selection])
fi


AC_ARG_WITH(
    term,
    AC_HELP_STRING([--with-term=NAME],[set the terminal to NAME [[rxvt]]]),
    [term_name_option=$withval],
    [term_name_option=rxvt]
)
AC_DEFINE_UNQUOTED(TERMENV, "$term_name_option", [default TERM name])


AC_ARG_WITH(
    line-space,
    AC_HELP_STRING([--with-line-space=NUM],[set the space between lines [[0]]]),
    [line_space_option=$withval],
    [line_space_option=0]
)
AC_DEFINE_UNQUOTED(LINESPACE, $line_space_option, [the space between lines])


AC_ARG_WITH(
    int-border,
    AC_HELP_STRING([--with-int-border=NUM],[set the width of internal border, frills option must be enabled [[0]]]),
    [int_border_option=$withval],
    [int_border_option=0]
)
AC_DEFINE_UNQUOTED(INTERNALBORDERWIDTH, $int_border_option, [the width of internal border])


AC_ARG_WITH(
    ext-border,
    AC_HELP_STRING([--with-ext-border=NUM],[set the width of external border, frills option must be enabled [[0]]]),
    [ext_border_option=$withval],
    [ext_border_option=0]
)
AC_DEFINE_UNQUOTED(EXTERNALBORDERWIDTH, $ext_border_option, [the width of external border])


AC_ARG_WITH(
    save-lines,
    AC_HELP_STRING([--with-save-lines=NUM],[set the lines to save in scroll [[100]]]),
    [save_lines_option=$withval],
    [save_lines_option=100]
)
AC_DEFINE_UNQUOTED(SAVELINES, $save_lines_option, [the lines to save in scroll])


AC_ARG_WITH(
    max-profiles,
    AC_HELP_STRING([--with-max-profiles=NUM],[set the max number of terminal [[5]]]),
    [max_prof_option=$withval],
    [max_prof_option=5]
)
AC_DEFINE_UNQUOTED(MAX_PROFILES, $max_prof_option, [the max number of profiles])


AC_ARG_WITH(
    max-term,
    AC_HELP_STRING([--with-max-term=NUM],[set the max number of terminal [[15]]]),
    [max_term_option=$withval],
    [max_term_option=15]
)
AC_DEFINE_UNQUOTED(MAX_PAGES, $max_term_option, [the max number of vt that can be open])

AC_ARG_WITH(
	atab-extra,
	AC_HELP_STRING( [--with-atab-extra=%], [The extra height (as a % of the font height) active tabs should have] ),
	[atab_extra_option=$withval],
	[atab_extra_option=20]
)
AC_DEFINE_UNQUOTED( ATAB_EXTRA_PERCENT, $atab_extra_option, [The extra height (as a % of the font height) active tabs should have])

AC_ARG_WITH(
	tab-radius,
	AC_HELP_STRING( [--with-tab-radius=%], [The radius (as a % of the font X offset) of tab corners]),
	[tab_radius_option=$withval],
	[tab_radius_option=100],
)
AC_DEFINE_UNQUOTED( TAB_RADIUS_PERCENT, $tab_radius_option, [The radius (as a % of the font X offset) of tab corners])


withval=""
AC_ARG_WITH(
    terminfo,
    AC_HELP_STRING([--with-terminfo=PATH],[set the path to the terminfo tree to PATH]),
    [terminfo_option=$withval],
    [terminfo_option="/usr/share/terminfo"]
)
if test "x$withval" != "x"; then
    AC_DEFINE_UNQUOTED(RXVT_TERMINFO, "$terminfo_option", [terminfo path])
fi


AC_ARG_WITH(
    encoding,
    AC_HELP_STRING([--with-encoding=NAME],[set language default encoding (eucj|sjis|big5|gb|gbk|kr|noenc) to NAME (default is noenc)]),
    [encoding_option=$withval],
    [encoding_option="noenc"]
)



dnl Checks for programs.
AC_PROG_CC(gcc cc egcs)
dnl AX_CFLAGS_WARN_ALL
if test "x$GCC" = "xyes"; then
    CFLAGS="$CFLAGS -Wall -fPIC"
fi
AC_PROG_MAKE_SET
AC_PROG_INSTALL
#AM_PROG_LIBTOOL



dnl Checks for libraries.

dnl FreeBSD needs to link libutil for openpty and libxpg4 for
dnl setlocale. Why this looks only necessary after FreeBSD
dnl 5.2.1?!!!
if test "x$local_os_type" = "xfreebsd" -o \
        "x$local_os_type" = "xopenbsd" -o \
        "x$local_os_type" = "xnetbsd"; then
    AC_CHECK_LIB(xpg4, setlocale)
    AC_CHECK_LIB(util, openpty)
fi


AC_PATH_X
if test "x$no_x" = "xyes"; then
    AC_MSG_ERROR([Mrxvt requires the X Window System libraries and headers.])
fi

dnl Warn if the detected path differs from the supplied
if test "x$x_includes" != "x" -a \
        "x$ac_x_includes" != "x" -a \
        "$x_includes" != "$ac_x_includes"; then
	AC_MSG_WARN([X includes path detected differs from the supplied!])
fi
if test "x$x_libraries" != "x" -a \
        "x$ac_x_libraries" != "x" -a \
        "$x_libraries" != "$ac_x_libraries"; then
	AC_MSG_WARN([X libraries path detected differs from the supplied!])
fi

dnl In case x_includes and x_libraries are not empty
test "x$x_includes" = "x" && x_includes="$ac_x_includes"
test "x$x_libraries" = "x" && x_libraries="$ac_x_libraries"

test "x$x_includes" != "x" && CFLAGS="$CFLAGS -I$x_includes"
dnl To pass linking, we must define both LDFLAGS and LIBS
test "x$x_libraries" != "x" && LDFLAGS="$LDFLAGS -L$x_libraries"
test "x$x_libraries" != "x" && LIBS="$LIBS -L$x_libraries"


AC_CHECK_LIB(
    X11,
    XOpenDisplay,
    [],
    AC_MSG_ERROR([Mrxvt requires the libX11 libraries.])
)

dnl AC_CHECK_LIB(
dnl     Xext,
dnl     XextAddDisplay,
dnl     [],
dnl     AC_MSG_ERROR([Mrxvt requires the libXext libraries.])
dnl )


if test "x$support_xim" = "xyes"; then
    AC_CHECK_LIB(
        X11,
        XRegisterIMInstantiateCallback,
        AC_DEFINE(USE_XIM, [], [set XIM support]),
        [support_xim=no]
    )
fi


if test "x$support_sessionmgr" = "xyes"; then
    AC_CHECK_LIB(
        SM,
        SmcOpenConnection,
        [],
        [support_sessionmgr=no]
    )
    AC_CHECK_LIB(
        ICE,
        IceConnectionNumber,
        [],
        [support_sessionmgr=no]
    )
fi
AM_CONDITIONAL(SESSION_SUPPORT, test "x$support_sessionmgr" = "xyes")


if test "x$support_utempter" = "xyes"; then
    AC_CHECK_LIB(
        utempter,
        utempter_add_record,
        [],
        [support_utempter=no]
    )
fi
if test "x$support_utempter" = "xyes"; then
    AC_DEFINE(UTEMPTER_SUPPORT, [], [set utempter library support])
fi


if test "x$support_xpm" = "xyes"; then
    AC_CHECK_LIB(
        Xpm,
        XpmCreateImageFromXpmImage,
        [],
        [support_xpm=no]
    )
fi


if test "x$support_jpeg" = "xyes"; then
    AC_CHECK_LIB(
        jpeg,
        jpeg_read_header,
        [],
        [support_jpeg=no]
    )
fi
if test "x$support_jpeg" = "xyes"; then
    AC_DEFINE(USE_JPEG, [], [set JPEG background])
fi
AM_CONDITIONAL(USE_JPEG, test "x$support_jpeg" = "xyes")


if test "x$support_png" = "xyes"; then
    AC_CHECK_LIB(
        png,
        png_check_sig,
        [],
        [support_png=no],
        [-lz -lm]
    )
fi
if test "x$support_png" = "xyes"; then
    AC_DEFINE(USE_PNG, [], [set PNG background])
    LIBS="$LIBS -lz -lm"
fi
AM_CONDITIONAL(USE_PNG, test "x$support_png" = "xyes")


if test "x$support_xpm" != "xyes" -a "x$support_jpeg" != "xyes" -a "x$support_png" != "xyes"; then
    support_background_image=no
    if test "x$support_transparency" = "xno"; then
	dnl Need either background or transparency for tinting.
	support_tinting=no
    fi
fi
if test "x$support_background_image" = "xyes"; then
    AC_DEFINE(BACKGROUND_IMAGE, [], [set background image])
fi
if test "x$support_tinting" = "xyes"; then
    AC_DEFINE(TINTING_SUPPORT, [], [set tinting support])
fi


if test "x$support_xrender" = "xyes" -a "x$support_tinting" = "xyes"; then
    AC_CHECK_LIB(
	Xrender,
	XRenderCreatePicture,
    )
    dnl AC_DEFINE(HAVE_XRENDER, [], [XRender tinting support])
fi

if test "x$support_xft" = "xyes"; then
    dnl Backup variables
    OLD_LIBS="$LIBS"
    OLD_CFLAGS="$CFLAGS"
    OLD_LDFLAGS="$LDFLAGS"

    dnl Get new variables.
    if which pkg-config >/dev/null 2>&1 && pkg-config --exists xft; then
        LIBS="$LIBS `pkg-config --libs xft`"
        CFLAGS="$CFLAGS `pkg-config --cflags xft`"
        LDFLAGS="$LDFLAGS `pkg-config --libs xft`"
    else
	if which xft-config >/dev/null 2>&1; then
	    dnl If xft-config is not found, try pkg-config instead
	    LIBS="$LIBS `xft-config --libs`"
	    CFLAGS="$CFLAGS `xft-config --cflags`"
	    LDFLAGS="$LDFLAGS `xft-config --libs`"
	else
	    support_xft="no"
	fi
    fi

    dnl Solaris has wired include directory for freetype.h
    if test "x$local_os_type" = "xsolaris"; then
        CFLAGS="$CFLAGS -I/usr/sfw/include -I/usr/sfw/include/freetype2"
    fi

    AC_CHECK_HEADERS(fontconfig/fontconfig.h X11/Xft/Xft.h, ,
        [support_xft=no],
        [[#include <X11/Xlib.h>
        #include <fontconfig/fontconfig.h>
        ]]
    )
    AC_CHECK_LIB(
        fontconfig,
        FcPatternAddInteger,
        [],
        [support_xft=no]
    )
    AC_CHECK_LIB(
        Xft,
        XftDrawString16,
        [],
        [support_xft=no]
    )

    if test "x$support_xft x$support_cjk" = "xyes xyes"; then
        dnl BSD and Cygwin needs libiconv
        AC_CHECK_LIB(iconv, iconv_open)
        dnl hack for Mac OS X
        if test "x$local_os_type" = "xdarwin"; then
            LIBS="$LIBS -liconv"
        fi
        dnl hack for Cygwin
        if test "x$local_os_type" = "xcygwin"; then
            LIBS="$LIBS -liconv"
        fi
        dnl hack for Cygwin
        if test "x$local_os_type" = "xopenbsd"; then
            LIBS="$LIBS -liconv"
        fi
    fi

    if test "x$support_xft" = "xyes"; then
        AC_DEFINE(XFT_SUPPORT, [], [set XFT support])
    else
        dnl Restore backup copy variables
        LIBS="$OLD_LIBS"
        CFLAGS="$OLD_CFLAGS"
        LDFLAGS="$OLD_LDFLAGS"
    fi
fi
AM_CONDITIONAL(XFT_SUPPORT, test "x$support_xft" = "xyes")

if test "x$support_cjk" = "xyes"; then
    AC_DEFINE(MULTICHAR_SET, [], [set CJK multichar set support])
    AC_DEFINE_UNQUOTED(MULTICHAR_ENCODING, "$encoding_option", [default encoding])
fi



AC_HEADER_STDC
AC_HEADER_SYS_WAIT

AC_CHECK_HEADERS([stdlib.h], [], [],
    [#include <stdio.h>
    ])

AC_CHECK_HEADERS([sys/socket.h], [], [],
    [#include <stdio.h>
    #ifdef STDC_HEADERS
    # include <stdlib.h>
    # include <stddef.h>
    #else
    # ifdef HAVE_STDLIB_H
    #  include <stdlib.h>
    # endif
    #endif
    ])

AC_CHECK_HEADERS( \
    arpa/inet.h \
    assert.h \
    fcntl.h \
    iconv.h \
    lastlog.h \
    limits.h \
    locale.h \
    langinfo.h \
    netinet/in.h \
    pty.h \
    sgtty.h \
    stdarg.h \
    stdlib.h \
    string.h \
    sys/byteorder.h \
    sys/ioctl.h \
    sys/select.h \
    sys/sockio.h \
    sys/stropts.h \
    sys/strredir.h \
    sys/stat.h \
    sys/time.h \
    sys/times.h \
    sys/types.h \
    sys/wait.h \
    time.h \
    termios.h \
    unistd.h \
    utmp.h \
    utmpx.h \
    wordexp.h \
    wchar.h \
)

if test "x$support_sessionmgr" = "xyes"; then
    AC_CHECK_HEADERS(X11/SM/SMlib.h)
fi

AC_CHECK_HEADERS([net/if.h], [], [],
    [#include <stdio.h>
    #ifdef STDC_HEADERS
    # include <stdlib.h>
    # include <stddef.h>
    #else
    # ifdef HAVE_STDLIB_H
    #  include <stdlib.h>
    # endif
    #endif
    #if HAVE_SYS_SOCKET_H
    # include <sys/socket.h>
    #endif
    ])

AC_CHECK_HEADERS([net/if_arp.h], [], [],
    [#include <stdio.h>
    #ifdef STDC_HEADERS
    # include <stdlib.h>
    # include <stddef.h>
    #else
    # ifdef HAVE_STDLIB_H
    #  include <stdlib.h>
    # endif
    #endif
    #if HAVE_SYS_SOCKET_H
    # include <sys/socket.h>
    #endif
    ])

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_HEADER_TIME


AC_STRUCT_TM

AC_TYPE_MODE_T
AC_TYPE_UID_T
AC_TYPE_PID_T
AC_TYPE_SIGNAL


AC_CACHE_CHECK(for working nl_langinfo, rxvt_cv_func_nl_langinfo,
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]], [[nl_langinfo(CODESET);]])],[rxvt_cv_func_nl_langinfo=yes],[rxvt_cv_func_nl_langinfo=no])])
if test "x$rxvt_cv_func_nl_langinfo" = "xyes"; then
  AC_DEFINE(HAVE_NL_LANGINFO, 1, Define if nl_langinfo(CODESET) works)
fi

AC_CACHE_CHECK([for XPointer], rxvt_cv_xpointer,
[AC_TRY_COMPILE([#include <X11/Xlib.h>], [XPointer dummy;],
rxvt_cv_xpointer=yes, rxvt_cv_xpointer=no)])
if test "x$rxvt_cv_xpointer" = "xyes"; then
  AC_DEFINE(HAVE_XPOINTER, 1, Define if you have XPointer typedef)
fi


if test "x$support_utmp" = "xyes"; then
    AC_CACHE_CHECK([for struct utmp], rxvt_cv_struct_utmp,
        [AC_TRY_COMPILE([#include <sys/types.h>
        #include <utmp.h>],
        [struct utmp ut;],
        rxvt_cv_struct_utmp=yes, rxvt_cv_struct_utmp=no)])
    if test "x$rxvt_cv_struct_utmp" = "xyes"; then
        AC_DEFINE(HAVE_STRUCT_UTMP, 1, Define if utmp.h has struct utmp)
    fi

    AC_CACHE_CHECK(for ut_host in utmp struct, rxvt_cv_struct_utmp_host,
        [AC_TRY_COMPILE([#include <sys/types.h>
        #include <utmp.h>],
        [struct utmp ut; ut.ut_host;],
        rxvt_cv_struct_utmp_host=yes, rxvt_cv_struct_utmp_host=no)])
    if test "x$rxvt_cv_struct_utmp_host" = "xyes"; then
        AC_DEFINE(HAVE_UTMP_HOST, 1, Define if struct utmp contains ut_host)
    fi

    AC_CACHE_CHECK(for ut_pid in utmp struct, rxvt_cv_struct_utmp_pid,
        [AC_TRY_COMPILE([#include <sys/types.h>
        #include <utmp.h>],
        [struct utmp ut; ut.ut_pid;],
        rxvt_cv_struct_utmp_pid=yes, rxvt_cv_struct_utmp_pid=no)])
    if test "x$rxvt_cv_struct_utmp_pid" = "xyes"; then
        AC_DEFINE(HAVE_UTMP_PID, 1, Define if struct utmp contains ut_pid)
    fi

    AC_CACHE_CHECK([for struct utmpx], rxvt_cv_struct_utmpx,
        [AC_TRY_COMPILE([#include <sys/types.h>
        #include <utmpx.h>],
        [struct utmpx ut;],
        rxvt_cv_struct_utmpx=yes, rxvt_cv_struct_utmpx=no)])
    if test "x$rxvt_cv_struct_utmpx" = "xyes"; then
        AC_DEFINE(HAVE_STRUCT_UTMPX, 1, Define if utmpx.h has struct utmpx)
    fi

    AC_CACHE_CHECK(for ut_host in utmpx struct, rxvt_cv_struct_utmpx_host,
        [AC_TRY_COMPILE([#include <sys/types.h>
        #include <utmpx.h>],
        [struct utmpx utx; utx.ut_host;],
        rxvt_cv_struct_utmpx_host=yes, rxvt_cv_struct_utmpx_host=no)])
    if test "x$rxvt_cv_struct_utmpx_host" = "xyes"; then
        AC_DEFINE(HAVE_UTMPX_HOST, 1, Define if struct utmpx contains ut_host)
    fi

    AC_CACHE_CHECK(for ut_session in utmpx struct, rxvt_cv_struct_utmpx_session,
        [AC_TRY_COMPILE([#include <sys/types.h>
        #include <utmpx.h>],
        [struct utmpx utx; utx.ut_session;],
        rxvt_cv_struct_utmpx_session=yes, rxvt_cv_struct_utmpx_session=no)])
    if test "x$rxvt_cv_struct_utmpx_session" = "xyes"; then
        AC_DEFINE(HAVE_UTMPX_SESSION, 1, Define if struct utmpx contains ut_session)
    fi
fi


if test "x$support_utmp x$support_lastlog" = "xyes xyes"; then
    AC_CACHE_CHECK(for struct lastlog, rxvt_cv_struct_lastlog,
        [AC_TRY_COMPILE([#include <sys/types.h>
        #include <utmp.h>
        #ifdef HAVE_LASTLOG_H
        #include <lastlog.h>
        #endif
        ],
        [struct lastlog ll;],
        rxvt_cv_struct_lastlog=yes, rxvt_cv_struct_lastlog=no)])
    if test "x$rxvt_cv_struct_lastlog" = "xyes"; then
        AC_DEFINE(HAVE_STRUCT_LASTLOG, 1, Define if utmp.h or lastlog.h has struct lastlog)
    fi
fi




AC_CHECK_SIZEOF(char, 1)
AC_CHECK_SIZEOF(short, 2)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long, 4)
AC_CHECK_SIZEOF(long long, 8)
AC_CHECK_SIZEOF(int *, 4)


if test $ac_cv_sizeof_char -ge 2; then
  RINT16T=char
  AC_DEFINE(RINT16T,  char,[typedef])
  AC_DEFINE(RUINT16T, unsigned char,[typedef])
else
  if test $ac_cv_sizeof_short -ge 2; then
    RINT16T=short
    AC_DEFINE(RINT16T,  short,[typedef])
    AC_DEFINE(RUINT16T, unsigned short,[typedef])
  else
    if test $ac_cv_sizeof_int -ge 2; then
      RINT16T=int
      AC_DEFINE(RINT16T,  int,[typedef])
      AC_DEFINE(RUINT16T, unsigned int,[typedef])
    else    dnl What a fantastic system ?
      RINT16T=long
      AC_DEFINE(RINT16T,  long,[typedef])
      AC_DEFINE(RUINT16T, unsigned long,[typedef])
    fi
  fi
fi
if test $ac_cv_sizeof_char -ge 4; then
  RINT32T=char
  AC_DEFINE(RINT32T,  char,[typedef])
  AC_DEFINE(RUINT32T, unsigned char,[typedef])
else
  if test $ac_cv_sizeof_short -ge 4; then
    RINT32T=short
    AC_DEFINE(RINT32T,  short,[typedef])
    AC_DEFINE(RUINT32T, unsigned short,[typedef])
  else
    if test $ac_cv_sizeof_int -ge 4; then
      RINT32T=int
      AC_DEFINE(RINT32T,  int,[typedef])
      AC_DEFINE(RUINT32T, unsigned int,[typedef])
    else    dnl What a fantastic system ?
      RINT32T=long
      AC_DEFINE(RINT32T,  long,[typedef])
      AC_DEFINE(RUINT32T, unsigned long,[typedef])
    fi
  fi
fi
if test $ac_cv_sizeof_char -eq $ac_cv_sizeof_int_p; then
  RINTPT=char
  AC_DEFINE(RINTPT,  char,[typedef])
  AC_DEFINE(RUINTPT, unsigned char,[typedef])
else
  if test $ac_cv_sizeof_short -eq $ac_cv_sizeof_int_p; then
    RINTPT=short
    AC_DEFINE(RINTPT,  short,[typedef])
    AC_DEFINE(RUINTPT, unsigned short,[typedef])
  else
    if test $ac_cv_sizeof_int -eq $ac_cv_sizeof_int_p; then
      RINTPT=int
      AC_DEFINE(RINTPT,  int,[typedef])
      AC_DEFINE(RUINTPT, unsigned int,[typedef])
    else    dnl what next? long long? quad?
      RINTPT=long
      AC_DEFINE(RINTPT,  long,[typedef])
      AC_DEFINE(RUINTPT, unsigned long,[typedef])
    fi
  fi
fi



dnl Checks for library functions.
AC_FUNC_CHOWN
AC_FUNC_FORK
AC_PROG_GCC_TRADITIONAL
AC_FUNC_LSTAT
dnl AC_FUNC_MALLOC
AC_FUNC_SETPGRP
AC_FUNC_VPRINTF


dnl Now to check functions
AC_CHECK_FUNCS(
    getcwd \
    getpt \
    _getpty \
    getpwuid \
    grantpt \
    isastream \
    nanosleep \
    openpty \
    putenv \
    revoke \
    select \
    setlocale \
    seteuid \
    setpgrp \
    setpgid \
    setreuid \
    setsid \
    setutent \
    socket \
    strcasestr \
    strchr \
    strdup \
    strndup \
    strrchr \
    ttyslot \
    unlockpt \
    unsetenv \
    updwtmp \
    updwtmpx \
    xsetlocale \
)


dnl Now to set tty options
dnl echo "*** ac_cv_func_getpt = $ac_cv_func_getpt"
dnl Check PTY/TTY types
if test "x$ac_cv_func_openpty" = "xyes"; then
    rxvt_cv_ptys=OPENPTY
else if test "x$ac_cv_func__getpty" = "xyes"; then
    rxvt_cv_ptys=SGI4
else if test -c /dev/ttyp20; then
    rxvt_cv_ptys=SCO
else if test -c /dev/ptym/clone; then
    rxvt_cv_ptys=HPUX
else if test "x$ac_cv_func_getpt" = "xyes"; then
    rxvt_cv_ptys=GLIBC
else if test -c /dev/ptc -a -c /dev/pts; then
    rxvt_cv_ptys=PTC
else if test -c /dev/ptc -a -d /dev/pts; then
    rxvt_cv_ptys=PTC
else if test -c /dev/ptmx -a -c /dev/pts/0; then
    rxvt_cv_ptys=STREAMS
else if test "x$ac_cv_func_grantpt x$ac_cv_func_unlockpt" = "xyes xyes"; then
    rxvt_cv_ptys=STREAMS
else
    rxvt_cv_ptys=BSD
fi
fi
fi
fi
fi
fi
fi
fi
fi


dnl echo "*** rxvt_cv_ptys = $rxvt_cv_ptys"
if test "x$rxvt_cv_ptys" = "xOPENPTY"; then
  AC_DEFINE(PTYS_ARE_OPENPTY, 1, Define for this pty type)
fi
if test "x$rxvt_cv_ptys" = "xSCO"; then
  AC_DEFINE(PTYS_ARE_NUMERIC, 1, Define for this pty type)
fi
if test "x$rxvt_cv_ptys" = "xSTREAMS"; then
  AC_DEFINE(PTYS_ARE_PTMX, 1, Define for this pty type)
fi
if test "x$rxvt_cv_ptys" = "xPTC"; then
  AC_DEFINE(PTYS_ARE_PTC, 1, Define for this pty type)
fi
if test "x$rxvt_cv_ptys" = "xSGI4"; then
  AC_DEFINE(PTYS_ARE__GETPTY, 1, Define for this pty type)
fi
if test "x$rxvt_cv_ptys" = "xCONVEX"; then
  AC_DEFINE(PTYS_ARE_GETPTY, 1, Define for this pty type)
fi
if test "x$rxvt_cv_ptys" = "xGLIBC"; then
  AC_DEFINE(PTYS_ARE_GETPT, 1, Define for this pty type)
fi
if test "x$rxvt_cv_ptys" = "xHPUX"; then
  AC_DEFINE(PTYS_ARE_CLONE, 1, Define for this pty type)
fi
if test "x$rxvt_cv_ptys" = "xBSD" -o "x$rxvt_cv_ptys" = "xHPUX" -o "x$rxvt_cv_ptys" = "xGLIBC"; then
  AC_DEFINE(PTYS_ARE_SEARCHED, 1, Define for this pty type)
fi

AC_CHECKING(for pty ranges)
ptys=`echo /dev/pty??`
pch1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'`
pch2=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'`
if test x$pch1 != x; then
  AC_DEFINE_UNQUOTED(PTYCHAR1, "$pch1", Define for first char in devptyXX)
fi
if test x$pch2 != x; then
  AC_DEFINE_UNQUOTED(PTYCHAR2, "$pch2", Define for second char in devptyXX)
fi



dnl Now to generate Makefiles
AC_SUBST(CC)
AC_SUBST(CFLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(LIBS)
AC_CONFIG_FILES([Makefile doc/Makefile src/Makefile share/Makefile])
AC_OUTPUT


dnl Now to dump configuration options
dnl echo "CFLAGS: $CFLAGS"
dnl echo "LDFLAGS: $LDFLAGS"
dnl echo "LIBS: $LIBS"

echo
echo
echo "Configurations:"
echo
echo
echo "Maintenance:"
echo "Debug mode                  : $support_debug"
echo "Private string functions    : $support_ourstrings"
echo "Rarely used features        : $support_frills"
echo 
echo "Scroll features:"
echo "Keep scroll                 : $support_keepscrolling"
echo "Scroll on selection         : $support_selectionscrolling"
echo "Mouse wheel scroll          : $support_mousewheel"
if test "x$support_mousewheel" = "xyes"; then
    echo "Slip mouse wheel scroll     : $support_mouseslipwheel"
fi
if test "x$support_scroll" = "xyes"; then
    echo "RXVT style scrollbar        : $support_scroll_rxvt"
    echo "NeXT style scrollbar        : $support_scroll_next"
    echo "Xterm style scrollbar       : $support_scroll_xterm"
    echo "Plain style scrollbar       : $support_scroll_plain"
    echo "SGI IRIX style scrollbar    : $support_scroll_sgi"
	if test "x$support_scroll_rxvt" = "xyes"; then
        echo "Half shadow scrollbar       : $support_half_shadow"
	fi
fi
echo
echo "Logging features:"
echo "Support utmp records        : $support_utmp"
echo "Support wtmp records        : $support_wtmp"
echo "Support lastlog records     : $support_lastlog"
echo "Support X session manager   : $support_sessionmgr"
echo "Use utempter library        : $support_utempter"
echo
echo "Visual features:"
echo "Support line space          : $support_linespace"
echo "24 bits color mode          : $support_24bits"
echo "256 color mode              : $support_256colors"
echo "Blink cursor                : $support_cursor_blink"
echo "Blank pointer               : $support_pointer_blank"
echo "Color text shadow           : $support_text_shadow"
echo "Smart resize                : $support_smart_resize"
echo "Menu bar                    : $support_menubar"
echo
echo "Background features:"
echo "Background image            : $support_background_image"
echo "XPM background image        : $support_xpm"
echo "JPEG background image       : $support_jpeg"
echo "PNG background image        : $support_png"
echo "Transparent background      : $support_transparency"
dnl: echo "Off focus fading            : $support_fading"
if test "x$support_tinting" = "xno"; then
    echo "Background tinting          : $support_tinting"
else
    if test "x$support_xrender" = "xyes"; then
	echo "Background tinting          : $support_tinting (XRender)"
    else
	echo "Background tinting          : $support_tinting (Fast)"
    fi
fi
echo
echo "Multi-language and font features:"
echo "Freetype Font               : $support_xft"
echo "X Input Method              : $support_xim"
echo "Greek keyboard              : $support_greek"
echo "CJK multichar language      : $support_cjk"
if test "x$support_cjk" = "xyes"; then
    echo "Default encoding method     : $encoding_option"
fi
echo
echo "System features:"
echo "TTY/PTY type                : $rxvt_cv_ptys"
echo "TTY gid                     : $support_ttygid"
echo "Backspace key               : $support_backspace_key"
echo "Delete key                  : $support_delete_key"
echo "Use fifo                    : $use_fifo"
echo "X resources                 : $support_resources"
echo "X default resources         : $support_xgetdefault"
echo "Swap screen                 : $support_swapscreen"
echo "Old selection               : $support_old_selection"
echo
echo "Options:"
echo "Terminal name               : $term_name_option"
echo "Maximal profiles            : $max_prof_option"
echo "Maximal tabs                : $max_term_option"
echo "Extra height% of active tab : $atab_extra_option"
echo "Radius% of tab corners      : $tab_radius_option"
if test "x$support_linespace" = "xyes"; then
    echo "Line space                  : $line_space_option"
fi
if test "x$support_frills" = "xyes"; then
    echo "Internal border width       : $int_border_option"
    echo "External border width       : $ext_border_option"
fi
if test "x$support_scroll" = "xyes"; then
    echo "Saved lines in scroll       : $save_lines_option"
fi
echo