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

#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.56)
AC_INIT(WeeChat, m4_esyscmd([./version.sh devel-full | tr -d '\n']), flashcode@flashtux.org)
AC_CONFIG_SRCDIR([configure.ac])
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE([foreign])
LICENSE="GPL3"

# Checks for programs
AC_PROG_CC
AC_PROG_CXX
AC_PROG_MAKE_SET
AC_GNU_SOURCE
AC_PROG_LN_S
AM_PROG_LIBTOOL

# Files to generate
AC_CONFIG_FILES([weechat.pc])
AC_CONFIG_FILES([weechat-${VERSION}-1.cygport:weechat.cygport.in])

# Add some flags for some OS
case "$host_os" in
freebsd* | openbsd*)
        CFLAGS="$CFLAGS -I/usr/local/include"
        LDFLAGS="$LDFLAGS -L/usr/local/lib"
        ;;
netbsd*)
        CFLAGS="$CFLAGS -I/usr/pkg/include"
        LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
        ;;
solaris*)
        LDFLAGS="$LDFLAGS -lsocket -lxnet"
        ;;
darwin*)
        LDFLAGS="$LDFLAGS -lresolv"
        ;;
esac

# Gettext
ALL_LINGUAS="cs de es fr hu it ja pl pt pt_BR ru tr"
AM_GNU_GETTEXT
AM_GNU_GETTEXT_VERSION([0.18])

# Checks for libraries
AC_CHECK_LIB(ncurses, initscr, LIBNCURSES_FOUND=1, LIBNCURSES_FOUND=0)
AC_CHECK_LIB(ncursesw, initscr, LIBNCURSESW_FOUND=1, LIBNCURSESW_FOUND=0)

# Checks for header files
AC_HEADER_STDC
AC_CHECK_HEADERS([libintl.h sys/resource.h])

# Checks for typedefs, structures, and compiler characteristics
AC_HEADER_TIME
AC_STRUCT_TM

AC_MSG_CHECKING([for socklen_t])
AC_CACHE_VAL(ac_cv_type_socklen_t,
[AC_LINK_IFELSE([AC_LANG_PROGRAM(
[[ #include <sys/types.h>
#include <sys/socket.h> ]],
[[ socklen_t t; ]])],
[ ac_cv_type_socklen_t=yes ],
[ ac_cv_type_socklen_t=no ],
)])
if test $ac_cv_type_socklen_t = no; then
AC_DEFINE(socklen_t, int, Define to 'int' if <sys/socket.h> doesn't define.)
fi
AC_MSG_RESULT($ac_cv_type_socklen_t)

# Checks for library functions.
AC_FUNC_SELECT_ARGTYPES
AC_TYPE_SIGNAL
AC_CHECK_FUNCS([mallinfo])

# Variables in config.h

AH_VERBATIM([PREFIX], [#undef PREFIX])
AH_VERBATIM([WEECHAT_LIBDIR], [#undef WEECHAT_LIBDIR])
AH_VERBATIM([WEECHAT_SHAREDIR], [#undef WEECHAT_SHAREDIR])
AH_VERBATIM([HAVE_GNUTLS], [#undef HAVE_GNUTLS])
AH_VERBATIM([HAVE_FLOCK], [#undef HAVE_FLOCK])
AH_VERBATIM([HAVE_EAT_NEWLINE_GLITCH], [#undef HAVE_EAT_NEWLINE_GLITCH])
AH_VERBATIM([HAVE_ASPELL_VERSION_STRING], [#undef HAVE_ASPELL_VERSION_STRING])
AH_VERBATIM([HAVE_ENCHANT_GET_VERSION], [#undef HAVE_ENCHANT_GET_VERSION])
AH_VERBATIM([HAVE_GUILE_GMP_MEMORY_FUNCTIONS], [#undef HAVE_GUILE_GMP_MEMORY_FUNCTIONS])
AH_VERBATIM([PLUGIN_ALIAS], [#undef PLUGIN_ALIAS])
AH_VERBATIM([PLUGIN_BUFLIST], [#undef PLUGIN_BUFLIST])
AH_VERBATIM([PLUGIN_CHARSET], [#undef PLUGIN_CHARSET])
AH_VERBATIM([PLUGIN_EXEC], [#undef PLUGIN_EXEC])
AH_VERBATIM([PLUGIN_FIFO], [#undef PLUGIN_FIFO])
AH_VERBATIM([PLUGIN_FSET], [#undef PLUGIN_FSET])
AH_VERBATIM([PLUGIN_IRC], [#undef PLUGIN_IRC])
AH_VERBATIM([PLUGIN_LOGGER], [#undef PLUGIN_LOGGER])
AH_VERBATIM([PLUGIN_RELAY], [#undef PLUGIN_RELAY])
AH_VERBATIM([PLUGIN_SCRIPT], [#undef PLUGIN_SCRIPT])
AH_VERBATIM([PLUGIN_PERL], [#undef PLUGIN_PERL])
AH_VERBATIM([PLUGIN_PYTHON], [#undef PLUGIN_PYTHON])
AH_VERBATIM([PLUGIN_RUBY], [#undef PLUGIN_RUBY])
AH_VERBATIM([PLUGIN_LUA], [#undef PLUGIN_LUA])
AH_VERBATIM([PLUGIN_PHP], [#undef PLUGIN_PHP])
AH_VERBATIM([PLUGIN_TCL], [#undef PLUGIN_TCL])
AH_VERBATIM([PLUGIN_GUILE], [#undef PLUGIN_GUILE])
AH_VERBATIM([PLUGIN_JAVASCRIPT], [#undef PLUGIN_JAVASCRIPT])
AH_VERBATIM([PLUGIN_SPELL], [#undef PLUGIN_SPELL])
AH_VERBATIM([PLUGIN_TRIGGER], [#undef PLUGIN_TRIGGER])
AH_VERBATIM([PLUGIN_XFER], [#undef PLUGIN_XFER])
AH_VERBATIM([TESTS], [#undef TESTS])
AH_VERBATIM([MAN], [#undef MAN])
AH_VERBATIM([DOC], [#undef DOC])
AH_VERBATIM([WEECHAT_HOME], [#define WEECHAT_HOME "~/.weechat"])
AH_VERBATIM([CA_FILE], [#define CA_FILE "/etc/ssl/certs/ca-certificates.crt"])

# Arguments for ./configure

AC_ARG_ENABLE(ncurses,      [  --disable-ncurses       turn off ncurses interface (default=compiled if found)],enable_ncurses=$enableval,enable_ncurses=yes)
AC_ARG_ENABLE(headless,     [  --disable-headless      turn off headless binary (default=compiled), this is required for tests],enable_headless=$enableval,enable_headless=yes)
AC_ARG_ENABLE(gnutls,       [  --disable-gnutls        turn off gnutls support (default=compiled if found)],enable_gnutls=$enableval,enable_gnutls=yes)
AC_ARG_ENABLE(largefile,    [  --disable-largefile     turn off Large File Support (default=on)],enable_largefile=$enableval,enable_largefile=yes)
AC_ARG_ENABLE(alias,        [  --disable-alias         turn off Alias plugin (default=compiled)],enable_alias=$enableval,enable_alias=yes)
AC_ARG_ENABLE(buflist,      [  --disable-buflist       turn off Buflist plugin (default=compiled)],enable_buflist=$enableval,enable_buflist=yes)
AC_ARG_ENABLE(charset,      [  --disable-charset       turn off Charset plugin (default=compiled)],enable_charset=$enableval,enable_charset=yes)
AC_ARG_ENABLE(exec,         [  --disable-exec          turn off Exec plugin (default=compiled)],enable_exec=$enableval,enable_exec=yes)
AC_ARG_ENABLE(fifo,         [  --disable-fifo          turn off Fifo plugin (default=compiled)],enable_fifo=$enableval,enable_fifo=yes)
AC_ARG_ENABLE(fset,         [  --disable-fset          turn off Fast Set plugin (default=compiled)],enable_fset=$enableval,enable_fset=yes)
AC_ARG_ENABLE(irc,          [  --disable-irc           turn off IRC plugin (default=compiled)],enable_irc=$enableval,enable_irc=yes)
AC_ARG_ENABLE(logger,       [  --disable-logger        turn off Logger plugin (default=compiled)],enable_logger=$enableval,enable_logger=yes)
AC_ARG_ENABLE(relay,        [  --disable-relay         turn off Relay plugin (default=compiled)],enable_relay=$enableval,enable_relay=yes)
AC_ARG_ENABLE(script,       [  --disable-script        turn off Script plugin (default=compiled)],enable_script=$enableval,enable_script=yes)
AC_ARG_ENABLE(scripts,      [  --disable-scripts       turn off script plugins (perl, python, ...) (default=compiled if found)],enable_scripts=$enableval,enable_scripts=yes)
AC_ARG_ENABLE(perl,         [  --disable-perl          turn off Perl script plugin (default=compiled if found)],enable_perl=$enableval,enable_perl=yes)
AC_ARG_ENABLE(python,       [  --disable-python        turn off Python script plugin (default=compiled if found)],enable_python=$enableval,enable_python=yes)
AC_ARG_ENABLE(python3,      [  --enable-python3        use Python 3.x if found (NOT recommended because many "official" scripts won't work) (default=off)],enable_python3=$enableval,enable_python3=no)
AC_ARG_ENABLE(ruby,         [  --disable-ruby          turn off Ruby script plugin (default=compiled if found)],enable_ruby=$enableval,enable_ruby=yes)
AC_ARG_ENABLE(lua,          [  --disable-lua           turn off Lua script plugin (default=compiled if found)],enable_lua=$enableval,enable_lua=yes)
AC_ARG_ENABLE(tcl,          [  --disable-tcl           turn off Tcl script plugin (default=compiled if found)],enable_tcl=$enableval,enable_tcl=yes)
AC_ARG_ENABLE(guile,        [  --disable-guile         turn off Guile (scheme) script plugin (default=compiled if found)],enable_guile=$enableval,enable_guile=yes)
AC_ARG_ENABLE(javascript,   [  --disable-javascript    turn off JavaScript script plugin (default=compiled if found)],enable_javascript=$enableval,enable_javascript=yes)
AC_ARG_ENABLE(php,          [  --disable-php           turn off PHP script plugin (default=compiled if found)],enable_php=$enableval,enable_php=yes)
AC_ARG_ENABLE(spell,        [  --disable-spell         turn off Spell checker plugin (default=compiled)],enable_spell=$enableval,enable_spell=yes)
AC_ARG_ENABLE(enchant,      [  --enable-enchant        turn on Enchant lib for Spell checker plugin (default=off)],enable_enchant=$enableval,enable_enchant=no)
AC_ARG_ENABLE(trigger,      [  --disable-trigger       turn off Trigger plugin (default=compiled)],enable_trigger=$enableval,enable_trigger=yes)
AC_ARG_ENABLE(xfer,         [  --disable-xfer          turn off Xfer (file transfer) plugin (default=compiled)],enable_xfer=$enableval,enable_xfer=yes)
AC_ARG_WITH(tclconfig,      [  --with-tclconfig=DIR    directory containing tcl configuration (tclConfig.sh)],tclconfig=$withval,tclconfig='')
AC_ARG_WITH(debug,          [  --with-debug            debugging: 0=no debug, 1=debug compilation (default=1)],debug=$withval,debug=1)
AC_ARG_ENABLE(tests,        [  --enable-tests          turn on build of tests (default=not built)],enable_tests=$enableval,enable_tests=no)
AC_ARG_ENABLE(man,          [  --enable-man            turn on build of man page (default=not built)],enable_man=$enableval,enable_man=no)
AC_ARG_ENABLE(doc,          [  --enable-doc            turn on build of documentation (default=not built)],enable_doc=$enableval,enable_doc=no)

AC_ARG_VAR(WEECHAT_HOME, [WeeChat home directory for config, logs, scripts.. (default is "~/.weechat")])
AC_ARG_VAR(CA_FILE, [File containing the certificate authorities (default is "/etc/ssl/certs/ca-certificates.crt"). This is the default value of option "weechat.network.gnutls_ca_file".])

if test "x$WEECHAT_HOME" = "x" ; then
    WEECHAT_HOME="~/.weechat"
fi
AC_DEFINE_UNQUOTED(WEECHAT_HOME, "$WEECHAT_HOME")

if test "x$CA_FILE" = "x" ; then
    CA_FILE="/etc/ssl/certs/ca-certificates.crt"
fi
AC_DEFINE_UNQUOTED(CA_FILE, "$CA_FILE")

not_asked=""
not_found=""

if test "x$enable_headless" != "xyes" && test "x$enable_tests" = "xyes"; then
    AC_MSG_ERROR([*** Headless mode is required for tests.])
fi

# ------------------------------------------------------------------------------
#                                  pkg-config
# ------------------------------------------------------------------------------

PKGCONFIG=""
AC_CHECK_PROGS(PKGCONFIG, pkg-config)
if test "x$PKGCONFIG" = "x"; then
    AC_MSG_ERROR([
*** "pkg-config" couldn't be found on your system.
*** Try to install it with your software package manager.])
fi

# ------------------------------------------------------------------------------
#                                dynamic loader
# ------------------------------------------------------------------------------

PLUGINS_LFLAGS=

AC_CHECK_FUNCS(dlopen, LIBDL_FOUND=yes, LIBDL_FOUND=no)
if test "$LIBDL_FOUND" != "yes"; then
    AC_CHECK_LIB(dl, dlopen, [LIBDL_FOUND=yes; PLUGINS_LFLAGS=-ldl], LIBDL_FOUND=no)
fi
if test "$LIBDL_FOUND" != "yes"; then
    AC_MSG_ERROR([
*** "dl" library (dynamic library loader) couldn't be found on your system.
*** Try to install it with your software package manager.])
fi
AC_SUBST(PLUGINS_LFLAGS)

# ------------------------------------------------------------------------------
#                                    gui
# ------------------------------------------------------------------------------

if test "x$enable_ncurses" = "xyes" ; then
    if test "$LIBNCURSESW_FOUND" = "0" ; then
        if test "$LIBNCURSES_FOUND" = "0" ; then
            AC_MSG_WARN([
*** ncurses library not found!
*** WeeChat will be built without ncurses support.])
            enable_ncurses="no"
            not_found="$not_found ncurses"
        else
            AC_MSG_WARN([
*** ncursesw library not found! Falling back to "ncurses"
*** Be careful, UTF-8 display may not work properly if your locale is UTF-8.])
            NCURSES_LFLAGS="-lncurses"
        fi
    else
        NCURSES_LFLAGS="-lncursesw"
    fi
    AC_CHECK_HEADERS([ncurses.h ncursesw/curses.h])
    AC_SUBST(NCURSES_LFLAGS)
else
    not_asked="$not_asked ncurses"
fi

# ------------------------------------------------------------------------------
#                                   headless
# ------------------------------------------------------------------------------

if test "x$enable_headless" != "xyes" ; then
    not_asked="$not_asked headless"
fi

# ------------------------------------------------------------------------------
#                                    iconv
# ------------------------------------------------------------------------------

ICONV_LFLAGS=""

iconv_found="no"
AC_CHECK_HEADER(iconv.h,ac_found_iconv_header="yes",ac_found_iconv_header="no")
if test "x$ac_found_iconv_header" = "xyes" ; then
   AC_CHECK_LIB(iconv,iconv_open,ac_found_iconv_lib="yes",ac_found_iconv_lib="no")
   if test "x$ac_found_iconv_lib" = "xno" ; then
      AC_CHECK_LIB(iconv,libiconv_open,ac_found_iconv_lib="yes",ac_found_iconv_lib="no")
   fi
   if test "x$ac_found_iconv_lib" = "xyes" ; then
      ICONV_LFLAGS="-liconv"
      LIBS="$LIBS $ICONV_LFLAGS"
   fi
   AC_MSG_CHECKING(for iconv usability in programs)
   AC_TRY_RUN([
        #include <iconv.h>
        int main(int argc, char **argv) {
            iconv_t conv = iconv_open("ISO8859-1", "UTF-8");
            if (conv != (iconv_t) -1) {
                return 0;
            }
            return 1;
      }],iconv_found="yes", iconv_found="no", iconv_found="assume-yes")
  if test "x$iconv_found" = "xno" ; then
     AC_MSG_RESULT(no)
  else
     AC_MSG_RESULT(yes)
  fi
fi

if test "x$iconv_found" = "xno" ; then
   AC_MSG_ERROR([
*** Iconv headers and/or libraries couldn't be found on your system.
*** Try to install them with your software package manager.
*** WeeChat can't be built without Iconv support.])
fi

# ------------------------------------------------------------------------------
#                                   plugins
# ------------------------------------------------------------------------------

if test "x$enable_scripts" = "xno" ; then
    enable_perl="no"
    enable_python="no"
    enable_ruby="no"
    enable_lua="no"
    enable_tcl="no"
    enable_guile="no"
    enable_javascript="no"
    enable_php="no"
fi

# ---------------------------------- alias -------------------------------------

if test "x$enable_alias" = "xyes" ; then
    ALIAS_CFLAGS=""
    ALIAS_LFLAGS=""
    AC_SUBST(ALIAS_CFLAGS)
    AC_SUBST(ALIAS_LFLAGS)
    AC_DEFINE(PLUGIN_ALIAS)
else
    not_asked="$not_asked alias"
fi

# --------------------------------- buflist ------------------------------------

if test "x$enable_buflist" = "xyes" ; then
    AC_DEFINE(PLUGIN_BUFLIST)
else
    not_asked="$not_asked buflist"
fi

# --------------------------------- charset ------------------------------------

if test "x$enable_charset" = "xyes" ; then
    CHARSET_CFLAGS=""
    CHARSET_LFLAGS="$ICONV_LFLAGS"
    AC_SUBST(CHARSET_CFLAGS)
    AC_SUBST(CHARSET_LFLAGS)
    AC_DEFINE(PLUGIN_CHARSET)
else
    not_asked="$not_asked charset"
fi

# ---------------------------------- exec --------------------------------------

if test "x$enable_exec" = "xyes" ; then
    EXEC_CFLAGS=""
    EXEC_LFLAGS=""
    AC_SUBST(EXEC_CFLAGS)
    AC_SUBST(EXEC_LFLAGS)
    AC_DEFINE(PLUGIN_EXEC)
else
    not_asked="$not_asked exec"
fi

# ---------------------------------- fifo --------------------------------------

if test "x$enable_fifo" = "xyes" ; then
    FIFO_CFLAGS=""
    FIFO_LFLAGS=""
    AC_SUBST(FIFO_CFLAGS)
    AC_SUBST(FIFO_LFLAGS)
    AC_DEFINE(PLUGIN_FIFO)
else
    not_asked="$not_asked fifo"
fi

# --------------------------------- fset ---------------------------------------

if test "x$enable_fset" = "xyes" ; then
    AC_DEFINE(PLUGIN_FSET)
else
    not_asked="$not_asked fset"
fi

# ----------------------------------- irc --------------------------------------

if test "x$enable_irc" = "xyes" ; then
    AC_DEFINE(PLUGIN_IRC)
else
    not_asked="$not_asked irc"
fi

# --------------------------------- logger -------------------------------------

if test "x$enable_logger" = "xyes" ; then
    LOGGER_CFLAGS=""
    LOGGER_LFLAGS=""
    AC_SUBST(LOGGER_CFLAGS)
    AC_SUBST(LOGGER_LFLAGS)
    AC_DEFINE(PLUGIN_LOGGER)
else
    not_asked="$not_asked logger"
fi

# --------------------------------- relay --------------------------------------

if test "x$enable_relay" = "xyes" ; then
    RELAY_CFLAGS=""
    RELAY_LFLAGS=""
    AC_SUBST(RELAY_CFLAGS)
    AC_SUBST(RELAY_LFLAGS)
    AC_DEFINE(PLUGIN_RELAY)
else
    not_asked="$not_asked relay"
fi

# --------------------------------- script -------------------------------------

if test "x$enable_script" = "xyes" ; then
    AC_DEFINE(PLUGIN_SCRIPT)
else
    not_asked="$not_asked script"
fi

# ---------------------------------- perl --------------------------------------

PERL_VERSION=

if test "x$enable_perl" = "xyes" ; then
    AC_PATH_PROGS(PERL, perl perl5)
    if test -z $PERL ; then
        AC_MSG_WARN([
*** Perl must be installed on your system but perl interpreter couldn't be found in path.
*** Please check that perl is in path, or install it with your software package manager.
*** WeeChat will be built without Perl support.])
        enable_perl="no"
        not_found="$not_found perl"
    else
        PERL_VERSION=`perl -V:version | sed "s/version='\(.*\)';/\1/"`
        AC_MSG_CHECKING(for Perl headers files)

        PERL_HEADER_TEST=`PT=perltest.c ; echo "#include <EXTERN.h>" > $PT;  echo "#include <perl.h>" >> $PT;  echo "#include <XSUB.h>" >> $PT ;  echo "int main() { return 0; }" >> $PT ; $CC -Wall $PT -o $PT.out $($PERL -MExtUtils::Embed -e ccopts -e ldopts) 1>/dev/null 2>&1; echo $?; rm -f $PT $PT.out 1>/dev/null 2>&1`

        if test "x$PERL_HEADER_TEST" = "x0" ; then
            PERL_CFLAGS=`$PERL -MExtUtils::Embed -e ccopts`
            AC_MSG_RESULT(found)
            AC_MSG_CHECKING(for Perl library)
            PERL_LIB_TEST=`PT=perltest.c ; echo "int main() { return 0; }" > $PT ; $CC -Wall $PT -o $PT.out $($PERL -MExtUtils::Embed -e ldopts) 1>/dev/null 2>&1; echo $?; rm -f $PT $PT.out 1>/dev/null 2>&1`
            if test "x$PERL_LIB_TEST" = "x0" ; then
                PERL_LFLAGS=`$PERL -MExtUtils::Embed -e ldopts`
                AC_MSG_RESULT(found)
            else
                AC_MSG_WARN([
*** Perl library couldn't be found on your system.
*** Try to install it with your software package manager.
*** WeeChat will be built without Perl support.])
                enable_perl="no"
                not_found="$not_found perl"
            fi
        else
            AC_MSG_WARN([
*** Perl headers couldn't be found on your system.
*** Try to install it with your software package manager.
*** WeeChat will be built without Perl support.])
            enable_perl="no"
            not_found="$not_found perl"
        fi
    fi
else
    not_asked="$not_asked perl"
fi

if test "x$enable_perl" = "xyes" ; then
    AC_SUBST(PERL_CFLAGS)
    AC_SUBST(PERL_LFLAGS)
    AC_DEFINE(PLUGIN_PERL)
fi

# --------------------------------- python -------------------------------------

PYTHON_VERSION=

if test "x$enable_python" = "xyes" ; then
    if test "x$enable_python3" = "xyes" ; then
        AC_PATH_PROGS(PYTHON, python3.7 python3.6 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0 python3 python2.7 python2.6 python2.5 python2 python)
    else
        AC_PATH_PROGS(PYTHON, python2.7 python2.6 python2.5 python2 python)
    fi
    if test -z $PYTHON ; then
        AC_MSG_WARN([
*** Python must be installed on your system but python interpreter couldn't be found in path.
*** Please check that python is in path, or install it with your software package manager.
*** WeeChat will be built without Python support.])
        enable_python="no"
        not_found="$not_found python"
    else
        PYTHON_SYSPREFIX=`$PYTHON -c 'import sys; sys.stdout.write("%s" % sys.prefix)'`
        PYTHON_VERSION=`$PYTHON -c 'import sys; sys.stdout.write(sys.version[[:3]])'`
        PYTHON_INCLUDE=`$PYTHON -c "import sys, distutils.sysconfig, string; sys.stdout.write(distutils.sysconfig.get_config_var('INCLUDEPY'))"`
        PYTHON_OLD_VERSION=`$PYTHON -c "import sys; sys.stdout.write(str(sys.version_info < (2,5)))"`
        if test "x$PYTHON_OLD_VERSION" = "xTrue" ; then
            AC_MSG_WARN([
*** Python >= 2.5 is needed to build Python plugin, version found: $PYTHON_VERSION.
*** WeeChat will be built without Python support.])
            enable_python="no"
            not_found="$not_found python"
        else
            AC_MSG_CHECKING(for Python header files)
            if test -r "$PYTHON_INCLUDE/Python.h"; then
                PYTHON_CFLAGS="-I$PYTHON_INCLUDE"
                AC_MSG_RESULT(found)
                PYTHON_LIB=`$PYTHON -c "import sys, distutils.sysconfig; sys.stdout.write(distutils.sysconfig.get_config_var('LIBPL'))"`
                PYTHON_LFLAGS="-lpython$PYTHON_VERSION "`$PYTHON -c "import sys, distutils.sysconfig; sys.stdout.write(distutils.sysconfig.get_config_var('LIBS')+' '+distutils.sysconfig.get_config_var('SYSLIBS')+' '+distutils.sysconfig.get_config_var('LINKFORSHARED'))"`
                AC_MSG_CHECKING(for Python library)
                if test -r "$PYTHON_LIB/libpython$PYTHON_VERSION.so"; then
                   PYTHON_LFLAGS="-L$PYTHON_LIB $PYTHON_LFLAGS"
                   AC_MSG_RESULT(found)
                elif test -r "$PYTHON_LIB/libpython$PYTHON_VERSION.a"; then
                   PYTHON_LFLAGS="-L$PYTHON_LIB $PYTHON_LFLAGS"
                   AC_MSG_RESULT(found)
                elif test -r "$PYTHON_LIB/libpython$PYTHON_VERSION.dll.a"; then
                   PYTHON_LFLAGS="-L$PYTHON_LIB $PYTHON_LFLAGS"
                   AC_MSG_RESULT(found)
                elif test -r "$PYTHON_SYSPREFIX/lib/libpython$PYTHON_VERSION.so"; then
                   PYTHON_LFLAGS="-L$PYTHON_SYSPREFIX/lib/ $PYTHON_LFLAGS"
                   AC_MSG_RESULT(found)
                else
                    AC_MSG_WARN([
*** Python library couldn't be found on your system.
*** Try to install it with your software package manager.
*** WeeChat will be built without Python support.])
                    enable_python="no"
                    not_found="$not_found python"
                fi
            else
                AC_MSG_WARN([
*** Python header files couldn't be found on your system.
*** Try to install them with your software package manager.
*** WeeChat will be built without Python support.])
                enable_python="no"
                not_found="$not_found python"
            fi
        fi
    fi
else
    not_asked="$not_asked python"
fi

if test "x$enable_python" = "xyes" ; then
    AC_SUBST(PYTHON_CFLAGS)
    AC_SUBST(PYTHON_LFLAGS)
    AC_DEFINE(PLUGIN_PYTHON)
fi

# ---------------------------------- ruby --------------------------------------

RUBY_VERSION=

if test "x$enable_ruby" = "xyes" ; then
    RUBY_CFLAGS=""
    RUBY_LFLAGS=""
    for v in "2.5" "2.4" "2.3" "2.2" "2.1" "2.0" "1.9" "1.8" ; do
        pkgconfig_ruby_found=`$PKGCONFIG --exists ruby-$v 2>/dev/null`
        if test "x$?" = "x0" ; then
            RUBY_VERSION=`$PKGCONFIG --modversion ruby-$v`
            RUBY_CFLAGS=`$PKGCONFIG --cflags ruby-$v`
            RUBY_LFLAGS=`$PKGCONFIG --libs ruby-$v`
            break
        fi
    done

    # detect old Ruby versions
    if test "x$RUBY_CFLAGS" = "x" -o "x$RUBY_LFLAGS" = "x" ; then
        AC_PATH_PROGS(RUBY, ruby1.9.3 ruby1.9.2 ruby1.9.1 ruby1.9 ruby1.8 ruby)
        if test -z $RUBY ; then
            AC_MSG_WARN([
*** Ruby must be installed on your system but ruby interpreter couldn't be found in path.
*** Please check that ruby is in path, or install it with your software package manager.
*** WeeChat will be built without Ruby support.])
            enable_ruby="no"
            not_found="$not_found ruby"
        else
            RUBY_VERSION=`$RUBY -rrbconfig -e "puts RbConfig::CONFIG[['MAJOR']] + '.' + RbConfig::CONFIG[['MINOR']] + '.' + RbConfig::CONFIG[['TEENY']]"`
            RUBY_INCLUDE=`$RUBY -rrbconfig -e "puts RbConfig::CONFIG[['rubyhdrdir']] || RbConfig::CONFIG[['archdir']]"`
            RUBY_ARCH=`$RUBY -rrbconfig -e 'print RbConfig::CONFIG[["arch"]]'`
            AC_MSG_CHECKING(for Ruby header files)
            if test -d "$RUBY_INCLUDE/"; then
                RUBY_CFLAGS="-I$RUBY_INCLUDE/ -I$RUBY_INCLUDE/$RUBY_ARCH"
            else
                AC_MSG_WARN([
*** Ruby header files couldn't be found on your system.
*** Try to install them with your software package manager.
*** WeeChat will be built without Ruby support.])
                enable_ruby="no"
                not_found="$not_found ruby"
            fi
            AC_MSG_RESULT(found)
            RUBY_LFLAGS=`$RUBY -rrbconfig -e "puts RbConfig::CONFIG[['LIBRUBYARG_SHARED']]"`
        fi
    fi
else
    not_asked="$not_asked ruby"
fi

if test "x$enable_ruby" = "xyes" ; then
    AC_SUBST(RUBY_CFLAGS)
    AC_SUBST(RUBY_LFLAGS)
    AC_DEFINE(PLUGIN_RUBY)
fi

# ---------------------------------- lua --------------------------------------

LUA_VERSION=

if test "x$enable_lua" = "xyes" ; then
    ac_save_CPPFLAGS="$CPPFLAGS"
    ac_save_CFLAGS="$CFLAGS"
    ac_save_LDFLAGS="$LDFLAGS"

    LUA_CFLAGS=""
    LUA_LFLAGS=""

    if test -n "$lua_inc"; then
       CFLAGS="$CFLAGS -I$lua_inc"
       CPPFLAGS="$CPPFLAGS -I$lua_inc"
    fi
    if test -n "$lua_lib"; then
       LDFLAGS="$LDFLAGS -L$lua_lib"
    fi

    if test "x$LUA_CFLAGS" = "x" -o "x$LUA_LFLAGS" = "x" ; then
        AC_MSG_CHECKING(for Lua headers and libraries with pkg-config)
        echo
        for l in "53" "5.3" "52" "5.2" "51" "5.1" "50" "5.0" "$lua_suffix" "" ; do
            pkgconfig_lua_found=`$PKGCONFIG --exists lua$l 2>/dev/null`
            if test "x$?" = "x0" ; then
                LUA_VERSION=`$PKGCONFIG --modversion lua$l`
                LUA_CFLAGS="$LUA_CFLAGS "`$PKGCONFIG --cflags lua$l`
                LUA_LFLAGS="$LUA_LFLAGS "`$PKGCONFIG --libs lua$l`

                pkgconfig_lualib_found=`$PKGCONFIG --exists lualib$l 2>/dev/null`
                if test  "x$?" = "x0"; then
                    LUA_CFLAGS="$LUA_CFLAGS "`$PKGCONFIG --cflags lualib$l`
                    LUA_LFLAGS="$LUA_LFLAGS "`$PKGCONFIG --libs lualib$l`
                fi
                break
            fi
        done
    fi

    if test "x$LUA_CFLAGS" = "x" -o "x$LUA_LFLAGS" = "x" ; then
        LUACONFIG=""
        AC_CHECK_PROGS(LUACONFIG, lua-config53 lua-config5.3 lua-config52 lua-config5.2 lua-config51 lua-config5.1 lua-config50 lua-config5.0 lua-config)
        if test "x$LUACONFIG" != "x" ; then
            AC_MSG_CHECKING(for Lua headers and libraries with lua-config)
            echo
            LUA_CFLAGS=`$LUACONFIG --include`
            LUA_LFLAGS=`$LUACONFIG --libs`
            LUA_VERSION="5.0.x"
        fi
    fi

    if test "x$LUA_CFLAGS" = "x" -o "x$LUA_LFLAGS" = "x" ; then
        AC_MSG_CHECKING(for Lua headers and libraries)
        echo
        AC_CHECK_HEADER(lua.h,ac_found_lua_header="yes",ac_found_lua_header="no")
        AC_CHECK_HEADER(lualib.h,ac_found_liblua_header="yes",ac_found_liblua_header="no")
        if test "x$ac_found_lua_header" = "xyes" -a "x$ac_found_liblua_header" = "xyes"; then
            LUA_CFLAGS="$CFLAGS"
        fi
        for l in "53" "5.3" "52" "5.2" "51" "5.1" "50" "5.0" "$lua_suffix" "" ; do
            AC_CHECK_LIB(lua$l,lua_call,ac_found_lua_lib="yes",ac_found_lua_lib="no")
            if test "x$ac_found_lua_lib" = "xyes" ; then
                LUA_VERSION=">=5.1.0"

                LUA_LFLAGS="$LDFLAGS -llua$l -lm"

                ac2_save_LDFLAGS="$LDFLAGS"
                LDFLAGS="$LDFLAGS -llua$l -lm"

                if echo "$host_os" | grep "^linux" 1>/dev/null 2>&1 ; then
                    LDFLAGS="$LDFLAGS -ldl"
                fi

                AC_CHECK_LIB(lualib$l,luaL_openlib,ac_found_liblua_lib="yes",ac_found_liblua_lib="no")
                if test "x$ac_found_liblua_lib" = "xyes" ; then
                    LUA_VERSION="5.0.x"

                    LUA_LFLAGS="$LUA_LFLAGS -llualib$l"

                    if echo "$host_os" | grep "^linux" 1>/dev/null 2>&1 ; then
                        LUA_LFLAGS="$LUA_LFLAGS -ldl"
                    fi
                fi

                LDFLAGS="$ac2_save_LDFLAGS"
                break
            fi
        done
    fi

    AC_MSG_CHECKING(for Lua compiling and linking)
    LUA_TEST=`LT=luatest.c ; echo "#include <lua.h>" > $LT;  echo "#include <lualib.h>" >> $LT; echo "int main() { luaopen_base((lua_State *)lua_open()); return 0; }" >> $LT ; $CC -Wall $LT -o $LT.out $LUA_CFLAGS $LUA_LFLAGS $CFLAGS $LDFLAGS 1>/dev/null 2>&1 ; echo $?; rm -f $LT $LT.out 1>/dev/null 2>&1`
    if test "x$LUA_TEST" != "x0" ; then
        LUA52_TEST=`LT=luatest.c ; echo "#include <lua.h>" > $LT;  echo "#include <lualib.h>" >> $LT; echo "int main() { luaopen_base((lua_State *)luaL_newstate()); return 0; }" >> $LT ; $CC -Wall $LT -o $LT.out $LUA_CFLAGS $LUA_LFLAGS $CFLAGS $LDFLAGS 1>/dev/null 2>&1 ; echo $?; rm -f $LT $LT.out 1>/dev/null 2>&1`
        if test "x$LUA52_TEST" != "x0" ; then
            AC_MSG_RESULT(no)
            AC_MSG_WARN([
*** Lua (>=5.0) headers and/or libraries couldn't be found on your system.
*** Try to install liblua, liblualib and liblua-dev with your software package manager.
*** WeeChat will be built without Lua support.])
            enable_lua="no"
            not_found="$not_found lua"
        else
            AC_MSG_RESULT(yes)
        fi
    else
        AC_MSG_RESULT(yes)
    fi

    CFLAGS="$ac_save_CFLAGS"
    CPPFLAGS="$ac_save_CPPFLAGS"
    LDFLAGS="$ac_save_LDFLAGS"
else
    not_asked="$not_asked lua"
fi

if test "x$enable_lua" = "xyes" ; then
    AC_SUBST(LUA_CFLAGS)
    AC_SUBST(LUA_LFLAGS)
    AC_DEFINE(PLUGIN_LUA)
fi

# --------------------------------- tcl -------------------------------------

TCL_VERSION=

if test "x$enable_tcl" = "xyes" ; then
    enable_plugins="yes"

    AC_MSG_CHECKING(for tclConfig.sh)
    tcl_found="no"
    tcl_dirs="/usr/lib/tcl8.6 /usr/lib64/tcl8.6 /usr/lib/tcl8.5 /usr/lib64/tcl8.5 /lib /lib64 /usr/lib /usr/lib64 /usr/tcl/lib /usr/tcl/lib64 /usr/local/tcl-8.6/lib /usr/local/tcl-8.6/lib64 /usr/local/tcl-8.5/lib /usr/local/tcl-8.5/lib64 /usr/local/lib /usr/local/lib64 /usr/local/tcl/lib /usr/local/tcl/lib64 /opt/lib /opt/lib64"
    if test "x$tclconfig" != "x" ; then
      tcl_dirs="${tclconfig} ${tcl_dirs}"
    fi
    for tcl_dir in $tcl_dirs ; do
        if test -f ${tcl_dir}/tclConfig.sh ; then
            . ${tcl_dir}/tclConfig.sh
            TCL_CFLAGS="-I${TCL_PREFIX}/include $TCL_INCLUDE_SPEC"
            TCL_LFLAGS="$TCL_LIB_SPEC $TCL_LIBS"
            tcl_found="yes"
            AC_MSG_RESULT(${tcl_dir}/tclConfig.sh)
            break
        fi
    done
    if test "x$tcl_found" = "xno" ; then
        AC_MSG_WARN([
*** Script tclConfig.sh couldn't be found on your system.
*** WeeChat will be built without Tcl support.])
        enable_tcl="no"
        not_found="$not_found tcl"
    fi
else
    not_asked="$not_asked tcl"
fi

if test "x$enable_tcl" = "xyes" ; then
    AC_SUBST(TCL_CFLAGS)
    AC_SUBST(TCL_LFLAGS)
    AC_DEFINE(PLUGIN_TCL)
fi

# --------------------------------- guile -------------------------------------

GUILE_VERSION=

if test "x$enable_guile" = "xyes" ; then
    enable_plugins="yes"

    guile_found="no"
    AC_MSG_CHECKING(for Guile headers and libraries)
    echo
    for v in "2.0" ; do
        pkgconfig_guile_found=`$PKGCONFIG --exists guile-$v 2>/dev/null`
        if test "x$?" = "x0" ; then
            GUILE_VERSION=`$PKGCONFIG --modversion guile-$v`
            GUILE_CFLAGS=`$PKGCONFIG --cflags guile-$v`
            GUILE_LFLAGS=`$PKGCONFIG --libs guile-$v`
            guile_found="yes"
            break
        fi
    done

    if test "x$guile_found" = "xyes" ; then
        # check if variable "scm_install_gmp_memory_functions" exists
        ac_save_CFLAGS="$CFLAGS"
        ac_save_LDFLAGS="$LDFLAGS"
        CFLAGS="$CFLAGS $GUILE_CFLAGS"
        LDFLAGS="$LDFLAGS $GUILE_LFLAGS"
        AC_CACHE_CHECK([for variable scm_install_gmp_memory_functions], ac_cv_have_guile_gmp_memory_functions, [
        AC_LINK_IFELSE([AC_LANG_PROGRAM(
            [[ #include <libguile.h>]],
            [[ scm_install_gmp_memory_functions = 0; ]])],
            [ ac_have_guile_gmp_memory_functions="yes" ],
            [ ac_have_guile_gmp_memory_functions="no" ])])
        CFLAGS="$ac_save_CFLAGS"
        LDFLAGS="$ac_save_LDFLAGS"
        if test "x$ac_have_guile_gmp_memory_functions" = "xyes"; then
            AC_DEFINE(HAVE_GUILE_GMP_MEMORY_FUNCTIONS)
        fi
    else
        AC_MSG_WARN([
*** Guile >= 2.0 couldn't be found on your system.
*** WeeChat will be built without Guile (scheme) support.])
        enable_guile="no"
        not_found="$not_found guile"
    fi
else
    not_asked="$not_asked guile"
fi

if test "x$enable_guile" = "xyes" ; then
    AC_SUBST(GUILE_CFLAGS)
    AC_SUBST(GUILE_LFLAGS)
    AC_DEFINE(PLUGIN_GUILE)
fi

# ------------------------------ javascript -----------------------------------

AC_LANG_PUSH([C++])

if test "x$enable_javascript" = "xyes" ; then
    enable_plugins="yes"

    v8_found="no"
    AC_CHECK_HEADER(v8.h,ac_found_v8_header="yes",ac_found_v8_header="no")
    if test "x$ac_found_v8_header" = "xyes" ; then
        #AC_CHECK_LIB(v8,v8,ac_found_v8_lib="yes",ac_found_v8_lib="no")
        ac_save_LIBS="$LIBS"
        LIBS="$LIBS -lv8 -lpthread"
        AC_MSG_CHECKING(for v8 usability in programs)
        AC_TRY_RUN([
            #include <v8.h>
            using namespace v8;
            int main(int argc, char **argv) {
                const char *version = V8::GetVersion();
                return 0;
            }],ac_found_v8_lib="yes", ac_found_v8_lib="no", ac_found_v8_lib="assume-yes")
        LIBS="$ac_save_LIBS"
        if test "x$ac_found_v8_lib" = "xyes" ; then
            AC_MSG_RESULT(yes)
            v8_found="yes"
            V8_CFLAGS=""
            V8_LFLAGS="-lv8 -lpthread"
        else
            AC_MSG_RESULT(no)
            AC_MSG_WARN([
*** V8 library couldn't be found on your system.
*** WeeChat will be built without JavaScript support.])
            enable_javascript="no"
            not_found="$not_found javascript/v8"
        fi
    else
        AC_MSG_WARN([
*** V8 header files couldn't be found on your system.
*** WeeChat will be built without JavaScript support.])
        enable_javascript="no"
        not_found="$not_found javascript/v8"
    fi
else
    not_asked="$not_asked javascript"
fi

if test "x$enable_javascript" = "xyes" ; then
    AC_SUBST(V8_CFLAGS)
    AC_SUBST(V8_LFLAGS)
    AC_DEFINE(PLUGIN_JAVASCRIPT)
fi

AC_LANG_POP

# ---------------------------------- php --------------------------------------

PHP_VERSION=

if test "x$enable_php" = "xyes" ; then
    ac_save_CPPFLAGS="$CPPFLAGS"
    ac_save_CFLAGS="$CFLAGS"
    ac_save_LDFLAGS="$LDFLAGS"

    PHP_CFLAGS=""
    PHP_LFLAGS=""

    if test -n "$php_inc"; then
       CFLAGS="$CFLAGS -I$php_inc"
       CPPFLAGS="$CPPFLAGS -I$php_inc"
    fi
    if test -n "$php_lib"; then
       LDFLAGS="$LDFLAGS -L$php_lib"
    fi

    if test "x$PHP_CFLAGS" = "x" -o "x$PHP_LFLAGS" = "x" ; then
        AC_MSG_CHECKING(for PHP headers and libraries with pkg-config)
        echo
        for l in "7.3" "73" "7.2" "72" "7.1" "71" "7.0" "70" "7" "$php_suffix" "" ; do
            pkgconfig_php_found=`$PKGCONFIG --exists php$l 2>/dev/null`
            if test "x$?" = "x0" ; then
                pkgconfig_php_found=`$PKGCONFIG --atleast-version=7 php$l 2>/dev/null`
                if test "x$?" = "x0" ; then
                    PHP_VERSION=`$PKGCONFIG --modversion php$l`
                    PHP_CFLAGS="$PHP_CFLAGS "`$PKGCONFIG --cflags php$l`
                    PHP_LFLAGS="$PHP_LFLAGS "`$PKGCONFIG --libs php$l`
                    break
                fi
            fi
        done
    fi

    if test "x$PHP_CFLAGS" = "x" -o "x$PHP_LFLAGS" = "x" ; then
        PHPCONFIG=""
        AC_MSG_CHECKING(for PHP headers and libraries with php-config)
        for l in "7.3" "73" "7.2" "72" "7.1" "71" "7.0" "70" "7" "$php_suffix" "" ; do
            AC_CHECK_PROG(PHPCONFIG, "php-config$l", "php-config$l")
            if test "x$PHPCONFIG" != "x" ; then
                php_config_version=`$PHPCONFIG --version`
                if test "x${php_config_version#7}" != "x${php_config_version}" ; then
                    PHP_VERSION=$php_config_version
                    PHP_CFLAGS=`$PHPCONFIG --includes`
                    PHP_LFLAGS="-L$($PHPCONFIG --prefix)/lib/ $($PHPCONFIG --libs) -lphp$l"
                    break
                fi
            fi
        done
    fi

    if test "x$PHP_CFLAGS" = "x" -o "x$PHP_LFLAGS" = "x" ; then
        AC_MSG_CHECKING(for PHP headers and libraries)
        echo
        AC_CHECK_HEADER(php.h,ac_found_php_header="yes",ac_found_php_header="no")
        if test "x$ac_found_php_header" = "xyes" ; then
            PHP_CFLAGS="$CFLAGS"
        fi
        for l in "7.3" "73" "7.2" "72" "7.1" "71" "7.0" "70" "7" "$php_suffix" "" ; do
            AC_CHECK_LIB(php$l,php_execute_script,ac_found_php_lib="yes",ac_found_php_lib="no")
            if test "x$ac_found_php_lib" = "xyes" ; then
                PHP_VERSION=">=7.0.0"

                PHP_LFLAGS="$LDFLAGS -lphp7 -lm"

                ac2_save_LDFLAGS="$LDFLAGS"
                LDFLAGS="$LDFLAGS -lphp7 -lm"

                if echo "$host_os" | grep "^linux" 1>/dev/null 2>&1 ; then
                    LDFLAGS="$LDFLAGS -ldl"
                fi

                LDFLAGS="$ac2_save_LDFLAGS"
                break
            fi
        done
    fi

    AC_MSG_CHECKING(for PHP compiling and linking)
    PHP_TEST=`LT=phptest.c ; echo "#include <sapi/embed/php_embed.h>" > $LT; echo "int main() { php_embed_init(0, NULL); php_embed_shutdown(); return 0; }" >> $LT ; $CC -Wall $LT -o $LT.out $PHP_CFLAGS $PHP_LFLAGS $CFLAGS $LDFLAGS 1>/dev/null 2>&1 ; echo $?; rm -f $LT $LT.out 1>/dev/null 2>&1`
    if test "x$PHP_TEST" != "x0" ; then
        AC_MSG_RESULT(no)
        AC_MSG_WARN([
*** PHP (>=7.0) headers and/or libraries couldn't be found on your system.
*** Try to install libphp-embed with your software package manager.
*** WeeChat will be built without PHP support.])
        enable_php="no"
        not_found="$not_found php"
    else
        AC_MSG_RESULT(yes)
    fi

    CFLAGS="$ac_save_CFLAGS"
    CPPFLAGS="$ac_save_CPPFLAGS"
    LDFLAGS="$ac_save_LDFLAGS"
else
    not_asked="$not_asked php"
fi

if test "x$enable_php" = "xyes" ; then
    AC_SUBST(PHP_CFLAGS)
    AC_SUBST(PHP_LFLAGS)
    AC_DEFINE(PLUGIN_PHP)
fi

# ----------------------------------- spell ------------------------------------

if test "x$enable_spell" = "xyes" ; then
    ac_found_enchant_lib="no"
    if test "x$enable_enchant" = "xyes" ; then
        PKG_CHECK_MODULES(ENCHANT, [enchant], ac_found_enchant_lib="yes", ac_found_enchant_lib="no")
    fi
    if test "x$ac_found_enchant_lib" = "xyes" ; then
        CFLAGS="$CFLAGS -DUSE_ENCHANT"
        SPELL_LIB_USED="enchant"

        # check if function enchant_get_version() exists
        ac_save_CFLAGS="$CFLAGS"
        ac_save_LDFLAGS="$LDFLAGS"
        CFLAGS="$CFLAGS $ENCHANT_CFLAGS"
        LDFLAGS="$LDFLAGS $ENCHANT_LIBS"
        AC_CACHE_CHECK([for enchant_get_version() support], ac_cv_have_enchant_get_version, [
        AC_LINK_IFELSE([AC_LANG_PROGRAM(
            [[ #include <enchant.h>]],
            [[ const char *version = enchant_get_version(); ]])],
            [ ac_have_enchant_get_version="yes" ],
            [ ac_have_enchant_get_version="no" ])])
        CFLAGS="$ac_save_CFLAGS"
        LDFLAGS="$ac_save_LDFLAGS"
        if test "x$ac_have_enchant_get_version" = "xyes"; then
            AC_DEFINE(HAVE_ENCHANT_GET_VERSION)
        fi
    else
        ASPELL_CFLAGS=""
        ASPELL_LFLAGS=""

        AC_CHECK_HEADER(aspell.h,ac_found_aspell_header="yes",ac_found_aspell_header="no")
        AC_CHECK_LIB(aspell,new_aspell_speller,ac_found_aspell_lib="yes",ac_found_aspell_lib="no")

        AC_MSG_CHECKING(for aspell headers and libraries)
        if test "x$ac_found_aspell_header" = "xno" -o "x$ac_found_aspell_lib" = "xno" ; then
            AC_MSG_RESULT(no)
            AC_MSG_WARN([
*** Aspell headers and/or libraries couldn't be found on your system.
*** Try to install them with your software package manager.
*** WeeChat will be built without Aspell support.])
            enable_spell="no"
            not_found="$not_found spell"
        else
            AC_MSG_RESULT(yes)
            ASPELL_LFLAGS="$ASPELL_LFLAGS -laspell"
            SPELL_LIB_USED="aspell"

            # check if function aspell_version_string() exists
            ac_save_LDFLAGS="$LDFLAGS"
            LDFLAGS="$LDFLAGS $ASPELL_LFLAGS"
            AC_CACHE_CHECK([for aspell_version_string() support], ac_cv_have_aspell_version_string, [
            AC_LINK_IFELSE([AC_LANG_PROGRAM(
                [[ #include <aspell.h>]],
                [[ const char *version = aspell_version_string(); ]])],
                [ ac_have_aspell_version_string="yes" ],
                [ ac_have_aspell_version_string="no" ])])
            LDFLAGS="$ac_save_LDFLAGS"
            if test "x$ac_have_aspell_version_string" = "xyes"; then
                AC_DEFINE(HAVE_ASPELL_VERSION_STRING)
            fi
        fi
    fi
else
    not_asked="$not_asked spell"
fi

if test "x$enable_spell" = "xyes" ; then
    AC_SUBST(ASPELL_CFLAGS)
    AC_SUBST(ASPELL_LFLAGS)
    AC_DEFINE(PLUGIN_SPELL)
fi

# --------------------------------- trigger ------------------------------------

if test "x$enable_trigger" = "xyes" ; then
    TRIGGER_CFLAGS=""
    TRIGGER_LFLAGS=""
    AC_SUBST(TRIGGER_CFLAGS)
    AC_SUBST(TRIGGER_LFLAGS)
    AC_DEFINE(PLUGIN_TRIGGER)
else
    not_asked="$not_asked trigger"
fi

# ---------------------------------- xfer --------------------------------------

if test "x$enable_xfer" = "xyes" ; then
    XFER_CFLAGS=""
    XFER_LFLAGS=""
    AC_SUBST(XFER_CFLAGS)
    AC_SUBST(XFER_LFLAGS)
    AC_DEFINE(PLUGIN_XFER)
else
    not_asked="$not_asked xfer"
fi

# ------------------------------------------------------------------------------
#                                   gcrypt
# ------------------------------------------------------------------------------

AC_CHECK_HEADER(gcrypt.h,ac_found_gcrypt_header="yes",ac_found_gcrypt_header="no")
AC_CHECK_LIB(gcrypt,gcry_check_version,ac_found_gcrypt_lib="yes",ac_found_gcrypt_lib="no")

AC_MSG_CHECKING(for gcrypt headers and libraries)
if test "x$ac_found_gcrypt_header" = "xno" -o "x$ac_found_gcrypt_lib" = "xno" ; then
    AC_MSG_RESULT(no)
    AC_MSG_ERROR([
*** libgcrypt was not found. You may want to get it from ftp://ftp.gnupg.org/gcrypt/libgcrypt/
*** or try to install libgcrypt-dev with your software package manager.])
else
    AC_MSG_RESULT(yes)
    GCRYPT_CFLAGS=`libgcrypt-config --cflags`
    GCRYPT_LFLAGS=`libgcrypt-config --libs`
    AC_SUBST(GCRYPT_CFLAGS)
    AC_SUBST(GCRYPT_LFLAGS)
fi

# ------------------------------------------------------------------------------
#                                   gnutls
# ------------------------------------------------------------------------------

if test "x$enable_gnutls" = "xyes" ; then
    AC_CHECK_HEADER(gnutls/gnutls.h,ac_found_gnutls_header="yes",ac_found_gnutls_header="no")
    AC_CHECK_LIB(gnutls,gnutls_global_init,ac_found_gnutls_lib="yes",ac_found_gnutls_lib="no")

    AC_MSG_CHECKING(for gnutls headers and libraries)
    if test "x$ac_found_gnutls_header" = "xno" -o "x$ac_found_gnutls_lib" = "xno" ; then
        AC_MSG_RESULT(no)
        AC_MSG_WARN([
*** libgnutls was not found. You may want to get it from ftp://ftp.gnutls.org/pub/gnutls/
*** WeeChat will be built without GnuTLS support.])
        enable_gnutls="no"
        not_found="$not_found gnutls"
    else
        AC_MSG_RESULT(yes)
        GNUTLS_CFLAGS=`pkg-config gnutls --cflags`
        GNUTLS_LFLAGS=`pkg-config gnutls --libs`
        AC_SUBST(GNUTLS_CFLAGS)
        AC_SUBST(GNUTLS_LFLAGS)
        AC_DEFINE(HAVE_GNUTLS)
        CFLAGS="$CFLAGS -DHAVE_GNUTLS"
    fi
else
    not_asked="$not_asked gnutls"
fi

# ------------------------------------------------------------------------------
#                                   flock
# ------------------------------------------------------------------------------

enable_flock="no"
AC_CACHE_CHECK([for flock() support], ac_cv_have_flock, [
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[[ #include <sys/file.h>]],
[[ flock(0, LOCK_SH); ]])],
[ ac_cv_have_flock="yes" ],
[ ac_cv_have_flock="no" ])])

if test "x$ac_cv_have_flock" = "xyes"; then
    enable_flock="yes"
    AC_DEFINE(HAVE_FLOCK)
else
    not_found="$not_found flock"
fi

# ------------------------------------------------------------------------------
#                               large file support
# ------------------------------------------------------------------------------

if test "x$enable_largefile" = "xyes" ; then
   CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_LARGE_FILES"
else
   not_asked="$not_asked largefile"
fi

# ------------------------------------------------------------------------------
#                                  backtrace
# ------------------------------------------------------------------------------

enable_backtrace="no"
if test "x$debug" != "x0" ; then
    AC_CACHE_CHECK([for execinfo.h and backtrace], ac_cv_have_backtrace, [
        AC_LINK_IFELSE([AC_LANG_PROGRAM(
            [[ #include <execinfo.h> ]],
            [[ void *trace[128]; int n = backtrace(trace, 128); ]])],
            [ ac_cv_have_backtrace="yes" ],
            [ ac_cv_have_backtrace="no"  ])])
    if test "x$ac_cv_have_backtrace" = "xyes"; then
        enable_backtrace="yes"
        AC_DEFINE(HAVE_BACKTRACE,1,[glibc backtrace function])
    else
        not_found="$not_found backtrace"
    fi
fi

# ------------------------------------------------------------------------------
#                             eat_newline_glitch
# ------------------------------------------------------------------------------

enable_eatnewlineglitch="no"
AC_CACHE_CHECK([for eat_newline_glitch support], ac_cv_have_eatnewlineglitch, [
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[ #include <term.h> ]],
[[ eat_newline_glitch = 0; ]])],
[ ac_cv_have_eatnewlineglitch="yes" ],
[ ac_cv_have_eatnewlineglitch="no" ])])

if test "x$ac_cv_have_eatnewlineglitch" = "xyes"; then
    enable_eatnewlineglitch="yes"
    AC_DEFINE(HAVE_EAT_NEWLINE_GLITCH)
else
    not_found="$not_found eat_newline_glitch"
fi

# ------------------------------------------------------------------------------
#                                     zlib
# ------------------------------------------------------------------------------

AC_CHECK_HEADER(zlib.h,ac_found_zlib_header="yes",ac_found_zlib_header="no")
AC_CHECK_LIB(z,compress2,ac_found_zlib_lib="yes",ac_found_zlib_lib="no")

AC_MSG_CHECKING(for zlib headers and libraries)
if test "x$ac_found_zlib_header" = "xno" -o "x$ac_found_zlib_lib" = "xno" ; then
    AC_MSG_RESULT(no)
    AC_MSG_ERROR([
*** zlib was not found. You may want to get it from https://zlib.net/
*** or try to install zlib1g-dev with your software package manager.])
else
    AC_MSG_RESULT(yes)
    ZLIB_CFLAGS=`pkg-config zlib --cflags`
    ZLIB_LFLAGS=`pkg-config zlib --libs`
    AC_SUBST(ZLIB_CFLAGS)
    AC_SUBST(ZLIB_LFLAGS)
fi

# ------------------------------------------------------------------------------
#                                     curl
# ------------------------------------------------------------------------------

AC_PATH_PROG(CURL_CONFIG, curl-config)
if test "x$CURL_CONFIG" = "x" ; then
    AC_MSG_ERROR([
*** "curl-config" couldn't be found on your system.
*** Try to install libcurl-dev with your software package manager.])
fi
CURL_CFLAGS=`$CURL_CONFIG --cflags`
CURL_LFLAGS=`$CURL_CONFIG --libs`
AC_SUBST(CURL_CFLAGS)
AC_SUBST(CURL_LFLAGS)

# ------------------------------------------------------------------------------
#                                    tests
# ------------------------------------------------------------------------------

if test "x$enable_tests" = "xyes" ; then
    cpputest_found="no"
    AC_MSG_CHECKING(for CppUTest headers and libraries)
    echo
    pkgconfig_cpputest_found=`$PKGCONFIG --exists cpputest 2>/dev/null`
    if test "x$?" = "x0" ; then
        CPPUTEST_VERSION=`$PKGCONFIG --modversion cpputest`
        CPPUTEST_CFLAGS=`$PKGCONFIG --cflags cpputest`
        CPPUTEST_LFLAGS=`$PKGCONFIG --libs cpputest`
    else
        AC_MSG_WARN([
*** CppUTest couldn't be found on your system.
*** WeeChat will be built without tests.])
        enable_tests="no"
        not_found="$not_found tests"
    fi
else
    not_asked="$not_asked tests"
fi

if test "x$enable_tests" = "xyes" ; then
    AC_SUBST(CPPUTEST_CFLAGS)
    AC_SUBST(CPPUTEST_LFLAGS)
    AC_DEFINE(TESTS)
fi

# ------------------------------------------------------------------------------
#                           man page / documentation
# ------------------------------------------------------------------------------

msg_man=""
msg_doc=""

if test "x$enable_man" = "xno"; then
    not_asked="$not_asked man"
fi
if test "x$enable_doc" = "xno"; then
    not_asked="$not_asked doc"
fi

if test "x$enable_man" = "xyes" -o "x$enable_doc" = "xyes"; then
    AC_CHECK_PROGS(ASCIIDOCTOR, [asciidoctor])
    if test -n "$ASCIIDOCTOR"; then
        AC_MSG_CHECKING([for asciidoctor version])
        asciidoctor_version=`$ASCIIDOCTOR --version 2>/dev/null | head -n 1 | cut -d" " -f2`
        case "${asciidoctor_version}" in
        Asciidoctor' '0.*|Asciidoctor' '1.5.[0-3]*)
                AC_MSG_RESULT([${asciidoctor_version} (too old)])
                not_found="$not_found asciidoctor"
                enable_man="no"
                enable_doc="no"
                ;;
        *)
                AC_MSG_RESULT([${asciidoctor_version}])
                if test "x$enable_man" = "xyes"; then
                    msg_man="asciidoctor(${asciidoctor_version}) $msg_man"
                    AC_DEFINE(MAN)
                fi
                if test "x$enable_doc" = "xyes"; then
                    msg_doc="asciidoctor(${asciidoctor_version}) $msg_doc"
                    AC_DEFINE(DOC)
                fi
                ;;
        esac
    else
        not_found="$not_found asciidoctor"
        enable_man="no"
        enable_doc="no"
    fi
    AC_SUBST(ASCIIDOCTOR)
fi

# ------------------------------------------------------------------------------
#                                general vars
# ------------------------------------------------------------------------------

if test "x$prefix" = "xNONE" ; then
    prefix="$ac_default_prefix"
fi

if test "x$exec_prefix" = "xNONE" ; then
    exec_prefix="$prefix"
fi

AC_DEFINE_UNQUOTED(PREFIX, "${prefix}")

WEECHAT_LIBDIR=`eval eval echo ${libdir}/weechat`
AC_DEFINE_UNQUOTED(WEECHAT_LIBDIR, "$WEECHAT_LIBDIR")

WEECHAT_SHAREDIR=`eval eval echo ${datadir}/weechat`
AC_DEFINE_UNQUOTED(WEECHAT_SHAREDIR, "$WEECHAT_SHAREDIR")

weechat_libdir=${libdir}/weechat
AC_SUBST(weechat_libdir)

COMMON_CFLAGS="-fsigned-char -Wall -Wextra -Werror-implicit-function-declaration"
AC_MSG_CHECKING([whether we have GNU assembler])
GAS=`as --version < /dev/null 2>/dev/null | grep GNU`
if test "$GAS"; then
    COMMON_CFLAGS="${COMMON_CFLAGS} -pipe"
    AC_MSG_RESULT(yes)
else
    AC_MSG_RESULT(no)
fi

CFLAGS=`echo $CFLAGS | sed 's/ -g / /g'`
CFLAGS=`echo $CFLAGS | sed 's/^-g //g'`
CFLAGS=`echo $CFLAGS | sed 's/ -g$//g'`
CFLAGS=`echo $CFLAGS | sed 's/^-g$//g'`
if test "x$debug" = "x0" ; then
    CFLAGS="$COMMON_CFLAGS $CFLAGS"
else
    CFLAGS="$COMMON_CFLAGS $CFLAGS -g -O0"
fi

LIBS="$LIBS $INTLLIBS"

case "$host_os" in
freebsd*)
        if test "x$enable_perl" = "xyes" -o "x$enable_python" = "xyes" ; then
            CFLAGS="$CFLAGS -pthread"
        fi
        CFLAGS="$CFLAGS $CPPFLAGS"
        ;;
openbsd*)
        if test "x$enable_python" = "xyes" ; then
            CFLAGS="$CFLAGS -pthread"
        fi
        ;;
netbsd*)
        if test "x$enable_perl" = "xyes" -o "x$enable_python" = "xyes" ; then
            CFLAGS="$CFLAGS -pthread"
        fi
        CFLAGS="$CFLAGS $CPPFLAGS"
        ;;
gnu*)
        LDFLAGS="$LDFLAGS -lpthread"
        ;;
*)
        ;;
esac

CFLAGS="$CFLAGS -DWEECHAT_VERSION=\\\"$VERSION\\\" -DWEECHAT_LICENSE=\\\"$LICENSE\\\""
CPPFLAGS="$CPPFLAGS -DWEECHAT_VERSION=\\\"$VERSION\\\" -DWEECHAT_LICENSE=\\\"$LICENSE\\\""

# ------------------------------------------------------------------------------
#                                output Makefiles
# ------------------------------------------------------------------------------

AM_CONDITIONAL(HAVE_GNUTLS,             test "$enable_gnutls" = "yes")
AM_CONDITIONAL(HAVE_FLOCK,              test "$enable_flock" = "yes")
AM_CONDITIONAL(HAVE_EAT_NEWLINE_GLITCH, test "$enable_eatnewlineglitch" = "yes")
AM_CONDITIONAL(GUI_NCURSES,             test "$enable_ncurses" = "yes")
AM_CONDITIONAL(HEADLESS,                test "$enable_headless" = "yes")
AM_CONDITIONAL(PLUGIN_ALIAS,            test "$enable_alias" = "yes")
AM_CONDITIONAL(PLUGIN_BUFLIST,          test "$enable_buflist" = "yes")
AM_CONDITIONAL(PLUGIN_CHARSET,          test "$enable_charset" = "yes")
AM_CONDITIONAL(PLUGIN_EXEC,             test "$enable_exec" = "yes")
AM_CONDITIONAL(PLUGIN_FIFO,             test "$enable_fifo" = "yes")
AM_CONDITIONAL(PLUGIN_FSET,             test "$enable_fset" = "yes")
AM_CONDITIONAL(PLUGIN_IRC,              test "$enable_irc" = "yes")
AM_CONDITIONAL(PLUGIN_LOGGER,           test "$enable_logger" = "yes")
AM_CONDITIONAL(PLUGIN_RELAY,            test "$enable_relay" = "yes")
AM_CONDITIONAL(PLUGIN_SCRIPT,           test "$enable_script" = "yes")
AM_CONDITIONAL(PLUGIN_PERL,             test "$enable_perl" = "yes")
AM_CONDITIONAL(PLUGIN_PYTHON,           test "$enable_python" = "yes")
AM_CONDITIONAL(PLUGIN_RUBY,             test "$enable_ruby" = "yes")
AM_CONDITIONAL(PLUGIN_LUA,              test "$enable_lua" = "yes")
AM_CONDITIONAL(PLUGIN_TCL,              test "$enable_tcl" = "yes")
AM_CONDITIONAL(PLUGIN_GUILE,            test "$enable_guile" = "yes")
AM_CONDITIONAL(PLUGIN_JAVASCRIPT,       test "$enable_javascript" = "yes")
AM_CONDITIONAL(PLUGIN_PHP,              test "$enable_php" = "yes")
AM_CONDITIONAL(PLUGIN_SPELL,            test "$enable_spell" = "yes")
AM_CONDITIONAL(PLUGIN_TRIGGER,          test "$enable_trigger" = "yes")
AM_CONDITIONAL(PLUGIN_XFER,             test "$enable_xfer" = "yes")
AM_CONDITIONAL(TESTS,                   test "$enable_tests" = "yes")
AM_CONDITIONAL(MAN,                     test "$enable_man" = "yes")
AM_CONDITIONAL(DOC,                     test "$enable_doc" = "yes")

AC_OUTPUT([Makefile
           doc/Makefile
           doc/en/Makefile
           doc/fr/Makefile
           doc/it/Makefile
           doc/de/Makefile
           doc/pl/Makefile
           doc/es/Makefile
           doc/ru/Makefile
           doc/ja/Makefile
           doc/cs/Makefile
           src/Makefile
           src/core/Makefile
           src/plugins/Makefile
           src/plugins/alias/Makefile
           src/plugins/buflist/Makefile
           src/plugins/charset/Makefile
           src/plugins/exec/Makefile
           src/plugins/fifo/Makefile
           src/plugins/fset/Makefile
           src/plugins/irc/Makefile
           src/plugins/logger/Makefile
           src/plugins/relay/Makefile
           src/plugins/script/Makefile
           src/plugins/perl/Makefile
           src/plugins/python/Makefile
           src/plugins/ruby/Makefile
           src/plugins/lua/Makefile
           src/plugins/tcl/Makefile
           src/plugins/guile/Makefile
           src/plugins/javascript/Makefile
           src/plugins/php/Makefile
           src/plugins/spell/Makefile
           src/plugins/trigger/Makefile
           src/plugins/xfer/Makefile
           src/gui/Makefile
           src/gui/curses/Makefile
           src/gui/curses/normal/Makefile
           src/gui/curses/headless/Makefile
           tests/Makefile
           intl/Makefile
           po/Makefile.in])

# ------------------------------------------------------------------------------
#                                  end message
# ------------------------------------------------------------------------------

listgui=""
if test "x$enable_ncurses" = "xyes" ; then
    listgui="$listgui ncurses"
fi
if test "x$enable_headless" = "xyes" ; then
    listgui="$listgui headless"
fi

if test "x$listgui" = "x" ; then
    AC_MSG_ERROR([
*** No interface specified...
*** Please enable at least ncurses or headless.])
fi

listplugins=""
if test "x$enable_alias" = "xyes"; then
    listplugins="$listplugins alias"
fi
if test "x$enable_buflist" = "xyes"; then
    listplugins="$listplugins buflist"
fi
if test "x$enable_charset" = "xyes"; then
    listplugins="$listplugins charset"
fi
if test "x$enable_exec" = "xyes"; then
    listplugins="$listplugins exec"
fi
if test "x$enable_fifo" = "xyes"; then
    listplugins="$listplugins fifo"
fi
if test "x$enable_fset" = "xyes"; then
    listplugins="$listplugins fset"
fi
if test "x$enable_irc" = "xyes" ; then
    listplugins="$listplugins irc"
fi
if test "x$enable_logger" = "xyes"; then
    listplugins="$listplugins logger"
fi
if test "x$enable_relay" = "xyes"; then
    listplugins="$listplugins relay"
fi
if test "x$enable_script" = "xyes"; then
    listplugins="$listplugins script"
fi
if test "x$enable_perl" = "xyes"; then
    listplugins="$listplugins perl($PERL_VERSION)"
fi
if test "x$enable_python" = "xyes"; then
    listplugins="$listplugins python($PYTHON_VERSION)"
fi
if test "x$enable_ruby" = "xyes"; then
    listplugins="$listplugins ruby($RUBY_VERSION)"
fi
if test "x$enable_lua" = "xyes"; then
    listplugins="$listplugins lua($LUA_VERSION)"
fi
if test "x$enable_tcl" = "xyes"; then
    listplugins="$listplugins tcl($TCL_VERSION)"
fi
if test "x$enable_guile" = "xyes"; then
    listplugins="$listplugins guile($GUILE_VERSION)"
fi
if test "x$enable_javascript" = "xyes"; then
    listplugins="$listplugins javascript/v8"
fi
if test "x$enable_php" = "xyes"; then
    listplugins="$listplugins php($PHP_VERSION)"
fi
if test "x$enable_spell" = "xyes"; then
    listplugins="$listplugins spell($SPELL_LIB_USED)"
fi
if test "x$enable_trigger" = "xyes"; then
    listplugins="$listplugins trigger"
fi
if test "x$enable_xfer" = "xyes"; then
    listplugins="$listplugins xfer"
fi

listoptional=""
if test "x$enable_gnutls" = "xyes"; then
    listoptional="$listoptional gnutls"
fi
if test "x$enable_flock" = "xyes"; then
    listoptional="$listoptional flock"
fi
if test "x$enable_largefile" = "xyes"; then
    listoptional="$listoptional largefile"
fi
if test "x$enable_backtrace" = "xyes"; then
    listoptional="$listoptional backtrace"
fi

msg_debug="no"
if test "x$debug" != "x0"; then
    msg_debug="yes"
fi

msg_tests="no"
if test "x$enable_tests" = "xyes"; then
    msg_tests="yes"
fi

if test "x$msg_man" = "x"; then
    msg_man="no"
else
    msg_man="yes: $msg_man"
fi
if test "x$msg_doc" = "x"; then
    msg_doc="no"
else
    msg_doc="yes: $msg_doc"
fi

echo ""
echo "Enabled features:"
echo "   Interfaces............. :$listgui"
echo "   Plugins................ :$listplugins"
echo "   Optional features...... :$listoptional"
echo "   Compile with debug..... : $msg_debug"
echo "   Compile tests.......... : $msg_tests"
echo "   Man page............... : $msg_man"
echo "   Documentation.......... : $msg_doc"
echo "   Certificate authorities : ${CA_FILE}"

if test "x$not_asked" != "x" || test "x$not_found" != "x"; then
    echo ""
    echo "Disabled features:"
    if test "x$not_asked" != "x"; then
        echo "   - not asked:$not_asked"
    fi
    if test "x$not_found" != "x"; then
        echo "   - not found:$not_found"
    fi
fi

echo ""
echo "WeeChat home directory is ${WEECHAT_HOME}"
echo ""
eval echo "WeeChat will be installed in $bindir"
echo ""
echo "configure complete, now type 'make' to build WeeChat $VERSION"
echo ""