File: configure.ac

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

dnl should be "yes" only within the released distribution
ISRELEASED=yes
version=2.5.18
VERSIONINFO=""

dnl date of the released version (please zero pad the day in the last 2 dates)
dnl for example: "4 February 2003", "04 Feb 2003", "2003-02-04"
RELDATELONG="11 September 2006"
RELDATESHORT="11-09-2006"
RELDATENUM="2006-09-11"

# constant variable settings
FVWMNAMEUCASE="FVWM"
FVWMNAMELONG="F? Virtual Window Manager"
FVWMHOMEPAGE="http://fvwm.org/"
FVWMFTP="ftp.fvwm.org"
FVWMFTPDIR="/pub/ftp"
FVWMALTFTP="metalab.unc.edu"
FVWMALTFTPDIR="/pub/Linux/X11/window-managers/"
FVWMLIST="fvwm@fvwm.org"
FVWMWORKERSLIST="fvwm-workers@fvwm.org"
FVWMWORKERSLISTLONG="fvwm workers list <fvwm-workers@fvwm.org>"
MANPAGE_PREAMBLE='.\" WARNING: This file was automatically generated.  Edit the .in file instead.'

if test x"$ISRELEASED" != xyes; then
	VERSIONINFO=" (from cvs)"
	RELDATELONG="(not released yet)"
	RELDATESHORT="(not released yet)"
	RELDATENUM="(not released yet)"
#	# migo: unfortunately this nice idea can not work, it is not updated.
#	# I will think more about this, maybe autoconf-2.50+ has a solution.
#	if test -d CVS/ -a -f CVS/Entries && \
#		date +%Y-%m-%d -d 'Wed Sep  4 12:36:50 2002' >/dev/null 2>&1
#	then
#		# this is not the exact date, but better than the current date
#		for file in CVS/Entries */CVS/Entries; do
#			changelog_date="`cat $file | grep /ChangeLog/ \
#				| cut -d/ -f4`"
#			test x"$changelog_date" != x && \
#			date +%Y-%m-%d -d "$changelog_date" >>changelog_dates
#		done
#		changelog_date=`cat changelog_dates | sort -r -u | head -1`
#		VERSIONINFO=" (from cvs $changelog_date)"
#		rm -f changelog_dates
#	fi
fi

AC_SUBST(ISRELEASED)
AH_TEMPLATE([VERSIONINFO],[Additional version information, like date])
AC_DEFINE_UNQUOTED(VERSIONINFO, "$VERSIONINFO")
AC_SUBST(VERSIONINFO)
AC_SUBST(RELDATELONG)
AC_SUBST(RELDATESHORT)
AC_SUBST(RELDATENUM)
AC_SUBST(FVWMNAMEUCASE)
AC_SUBST(FVWMNAMELONG)
AC_SUBST(FVWMHOMEPAGE)
AC_SUBST(FVWMFTP)
AC_SUBST(FVWMFTPDIR)
AC_SUBST(FVWMALTFTP)
AC_SUBST(FVWMALTFTPDIR)
AC_SUBST(FVWMLIST)
AC_SUBST(FVWMWORKERSLIST)
AC_SUBST(FVWMWORKERSLISTLONG)
AC_SUBST(MANPAGE_PREAMBLE)

AM_INIT_AUTOMAKE(fvwm, ${version})
AM_CONFIG_HEADER(config.h)

# installation paths
FVWM_MODULESUBDIR=/${PACKAGE}/${VERSION}
FVWM_DATASUBDIR=/${PACKAGE}

AC_ARG_ENABLE(package-subdirs,
  [  --disable-package-subdirs  do not create subdirs for modules and data],
  [if test x"$enableval" = xno; then FVWM_MODULESUBDIR=""; FVWM_DATASUBDIR="";
  fi], [])

FVWM_MODULEDIR='${libexecdir}'"$FVWM_MODULESUBDIR"
FVWM_DATADIR='${datadir}'"$FVWM_DATASUBDIR"
FVWM_PERLLIBDIR='${datadir}'"$FVWM_DATASUBDIR/perllib"
FVWM_CONFDIR='${sysconfdir}'dnl used _only_ to search for system.fvwm2rc

AC_SUBST(FVWM_MODULEDIR)
AC_SUBST(FVWM_DATADIR)
AC_SUBST(FVWM_PERLLIBDIR)
AC_SUBST(FVWM_CONFDIR)

AH_TEMPLATE([FVWM_CONFIG],
  [Name of config filenames in FVWM_USERDIR and FVWM_DATADIR])
AC_DEFINE(FVWM_CONFIG, "config")

AH_TEMPLATE([FVWM2RC],[Suffix for old (to be deprecated) config filenames])
AC_DEFINE(FVWM2RC, ".fvwm2rc")

# Various configure-time options

AC_ARG_ENABLE(dmalloc,
  [  --enable-dmalloc        enable support for the dmalloc debugging library],
  [ac_cv_dmalloc="$enableval"],
  [ac_cv_dmalloc="no"])

AC_ARG_ENABLE(efence,
  [  --enable-efence         enable support for the efence debugging library],
  [ac_cv_efence="$enableval"],
  [ac_cv_efence="no"])

smr_SWITCH(command-log, command logging, off, FVWM_COMMAND_LOG,, [Produces a log of all executed commands and their times on stderr.])
AH_VERBATIM([_FVWM_COMMAND_LOG],
[#ifdef FVWM_COMMAND_LOG
#   define FVWM_DEBUG_TIME 1
#endif])

smr_SWITCH(debug-msgs, debugging messages, off, FVWM_DEBUG_MSGS,, [if you would like to see lots of debug messages from fvwm, for debugging
   purposes, uncomment the next line])
AH_VERBATIM([_FVWM_DEBUG_MSGS],
[#ifdef FVWM_DEBUG_MSGS
#   define DBUG(x,y) fvwm_msg(DBG,x,y)
#else
#   define DBUG(x,y) /* no messages */
#endif])

dnl dummy: smr_SWITCH(sm, dummy for test script, on, SESSION)

# Need to know where X is, for finding some libraries (e.g. xpm)
no_x=""
AC_PATH_XTRA
if test x"$no_x" = x"yes"; then
  echo
  echo "X11 libraries or header files could not be found.  Please make"
  echo "sure the X11 development package is installed on your system."
  echo "If it is definitely installed, try setting the include and library"
  echo "paths with the --x-include and --x-libraries options of configure."
  echo "Fvwm can not be compiled without the X11 development environment."
  echo
  echo "Aborting."
  echo
  exit 1
fi

# FIXME: default value should be derived from computed path to X
# includes.  Actually, this should probably not appear in configure
# at all: it is settable at runtime, and only confuses the issue to
# have it settable here too.
#
AC_MSG_CHECKING(imagepath)
val="/usr/include/X11/bitmaps:/usr/include/X11/pixmaps"
AC_ARG_WITH(imagepath,
[  --with-imagepath=PATH   colon-delimited search path for images],
[ case "$withval" in
  no)
    AC_MSG_ERROR([Can not disable image path.])
    ;;
  yes)
    ;;
  *)
    val="$withval"
    ;;
  esac ])
AH_TEMPLATE([FVWM_IMAGEPATH],[Where to search for images.])
AC_DEFINE_UNQUOTED(FVWM_IMAGEPATH, "$val")

FVWM_IMAGEPATH="$val"
AC_SUBST(FVWM_IMAGEPATH)
AC_MSG_RESULT($val)

# Minimal checks for programs: enough to enable checking for
# optional libraries.
AC_PROG_CC
AC_PROG_CPP

# added -Wall for gcc, what about for others?
if test "x$GCC" = "xyes"; then
  CFLAGS="-Wall -Wno-implicit-int $CFLAGS"
fi

# Help finding POSIX functions on some systems
AC_ISC_POSIX
AC_MINIX

# catch -Werror and similar options when running configure
AC_TRY_COMPILE([#include <stdio.h>],
[int i; static j; int *p; char *c;
  switch (*p = p = *c) { case 0: printf("%Q", c, p); }
  *c = &i; c = p;
  while (1 || (unsigned int)3 >= 0 || ((int)-1) == ((unsigned int)1));
  return;], , AC_MSG_ERROR("
configure is not able to compile programs with warnings.  Please
remove all offending options like -Werror from the CFLAGS and
CPPFLAGS variables and run configure again."))

# check size of some types
ac_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $X_CFLAGS"
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(Window, , [#include <stdio.h>
#include <X11/X.h>])
AC_CHECK_SIZEOF(Pixel, , [#include <stdio.h>
#include <X11/Intrinsic.h>])
AC_CHECK_SIZEOF(void *)
CFLAGS="$ac_save_CFLAGS"
size_check_failed=""
if test "$ac_cv_sizeof_void_p" -gt "$ac_cv_sizeof_long"; then
  echo "The type void * is bigger than long."
  size_check_failed=1
fi
if test "$ac_cv_sizeof_Window" -gt "$ac_cv_sizeof_long"; then
  echo "The type Window is bigger than long."
  size_check_failed=1
fi
if test "$ac_cv_sizeof_Pixel" -gt "$ac_cv_sizeof_long"; then
  echo "The type Pixel is bigger than long."
  size_check_failed=1
fi
if test x"$size_check_failed" = x1; then
  echo "This is not supported by the module interface yet (make_new_vpacket)."
  echo "Detected type sizes are: int($ac_cv_sizeof_int), long($ac_cv_sizeof_long), void*($ac_cv_sizeof_void_p), Window($ac_cv_sizeof_Window), Pixel($ac_cv_sizeof_Pixel)"
  echo "Please report details of your system and this message to ${FVWMWORKERSLIST}."
  echo
  exit 1
fi

# 'unset' is not portable, but setting to null is not enough to avoid using
# the cached value!  For ancient shells "rm config.cache" is a solution.
UNSET=true
if unset UNSET 2>/dev/null; then UNSET=unset; fi


# ********* multibyte
# FreeBSD has libxpg4, check this and use if found.
AC_CANONICAL_HOST
case $host_os in
freebsd*)
	AC_CHECK_LIB(xpg4, setlocale, [LIBS="$LIBS -lxpg4"]);;
*)
	;;
esac

# *** pkg-config
# unfortunately, we need pkg-config for the detection of certain libs:
# - certain version of fontconfig (without fontconfig-config
AM_CHECK_PKG_CONFIG

# ********* session management
# Check the availability of SM; we don't have to add any extra libraries,
# since -lSM -lICE are in X_PRE_LIBS when they exist.
dnl [old check] AC_CHECK_LIB(SM, SmcOpenConnection, AC_DEFINE(SESSION), ,
dnl [old check]            [$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])

problem_sm=""

AC_ARG_ENABLE(sm,
  [  --disable-sm            disable session management support],
  [ if test x"$enableval" = xyes; then
    with_sm="yes, check"
  else
    with_sm="no"
    problem_sm=": Explicitly disabled"
  fi ],
  [ with_sm="not specified, check" ]
)

if test x"$with_sm" != xno; then
  dnl Uncomment the following and comment out AC_CHECK_LIB to get --with-sm-*
  dnl $UNSET ac_cv_lib_SM_SmcOpenConnection
  dnl $UNSET ac_cv_header_X11_SM_SMlib_h
  dnl smr_CHECK_LIB(sm, SM, adds session management support, SmcOpenConnection,
  dnl   X11/SM/SMlib.h,
  dnl   [$X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS], $X_CFLAGS)
  dnl test "$sm_LIBS" && AC_DEFINE(SESSION)

  $UNSET ac_cv_lib_SM_SmcOpenConnection
  AH_TEMPLATE([SESSION],[Enables session management functionality.])
  AC_CHECK_LIB(SM, SmcOpenConnection, with_sm=yes; AC_DEFINE(SESSION),
    with_sm=no; problem_sm=": Failed to detect libSM",
    [$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
fi
dnl AC_SUBST(sm_LIBS)
dnl AC_SUBST(sm_CFLAGS)


# Checking for optional libraries
# Default is to use them if found; can be disable using --without
# These are put up front so that if they are requested, but
# configure fails to find them, we fail early.


# ********* shape extension
dnl smr_SWITCH(shape, shape extensions, on, SHAPE)
AC_ARG_ENABLE(shape,
  [  --disable-shape         disable shaped window support],
  [ if test x"$enableval" = xyes; then
    with_shape="yes, check"
  else
    with_shape="no"
    problem_shape=": Explicitly disabled"
  fi ],
  [ with_shape="not specified, check" ]
)

AH_TEMPLATE(SHAPE,
[   Define if you want the Shaped window extensions.
   Shaped window extensions seem to increase the window managers RSS
   by about 60 Kbytes. They provide for leaving a title-bar on the window
   without a border.
   If you don't use shaped window extension, you can either make your
   shaped windows undecorated, or live with a border and backdrop around
   all your shaped windows (oclock, xeyes)

   If you normally use a shaped window (xeyes or oclock), you might as
   well compile this extension in, since the memory cost is  minimal in
   this case (The shaped window shared libs will be loaded anyway). If you
   don't normally use a shaped window, you have to decide for yourself.

   Note: if it is compiled in, run time detection is used to make sure that
   the currently running X server supports it.])
if test x"$with_shape" != xno; then
  $UNSET ac_cv_lib_Xext_XShapeQueryExtension
  AC_CHECK_LIB(Xext, XShapeQueryExtension,
               with_shape=yes; AC_DEFINE(SHAPE),
               with_shape=no;
               problem_shape=": Failed to detect Shape extension",
               [$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
fi

# ********* MIT Shared Memory Extension
AC_ARG_ENABLE(shm,
  [  --disable-shm           disable MIT Shared Memory Extension],
  [ if test x"$enableval" = xyes; then
    with_shm="yes, check"
  else
    with_shm="no"
    problem_shm=": Explicitly disabled"
  fi ],
  [ with_shm="not specified, check" ]
)

AH_TEMPLATE([HAVE_XSHM],[Define if  MIT Shared Memory extension is used.])
if test x"$with_shm" != xno; then
  $UNSET ac_cv_lib_Xext_XShmQueryExtension
  AC_CHECK_LIB(Xext, XShmQueryExtension,
               with_shm=yes; AC_DEFINE(HAVE_XSHM),
               with_shm=no;
               problem_shm=": Can't detect MIT Shared Memory ext.",
               [$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
fi

# ********* xinerama
problem_xinerama=""

AC_ARG_ENABLE(xinerama,
  [  --disable-xinerama      disable Xinerama multi screen support],
  [ if test x"$enableval" = xyes; then
    with_xinerama="yes, check"
  else
    with_xinerama="no"
    problem_xinerama=": Explicitly disabled"
  fi ],
  [ with_xinerama="not specified, check" ]
)

AH_TEMPLATE([HAVE_XINERAMA],[Define if Xinerama library is used.])
AH_TEMPLATE([HAVE_SOLARIS_XINERAMA],
  [Define if Solaris' Xinerama calls are being used.
  (Solaris 7 11/99 and later)])
AH_TEMPLATE([HAVE_SOLARIS_XINERAMA_H],
  [Define if Solaris' X11/extensions/xinerama.h header is provided.
  (Solaris 9 and later)])
if test x"$with_xinerama" != xno; then
  $UNSET ac_cv_lib_Xinerama_XineramaIsActive
  _check_solaris_xinerama=no
  AC_CHECK_LIB(Xinerama, XineramaIsActive,
    with_xinerama=yes; Xinerama_LIBS=-lXinerama; AC_DEFINE(HAVE_XINERAMA),
    _check_solaris_xinerama=yes,
    [$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS])
  if test x"$_check_solaris_xinerama" = xyes; then
    AC_CHECK_LIB(Xext, XineramaGetState,
      [ AC_DEFINE(HAVE_XINERAMA) AC_DEFINE(HAVE_SOLARIS_XINERAMA)
      with_xinerama=yes; Xinerama_LIBS=-lXext
      my_CPPFLAGS="$CPPFLAGS"; CPPFLAGS="$X_CPPFLAGS $CPPFLAGS"
      my_hdr="X11/extensions/xinerama.h"
      AC_CHECK_HEADER($my_hdr, AC_DEFINE(HAVE_SOLARIS_XINERAMA_H)
	problem_xinerama=" (Using Solaris Xinerama calls)",
	problem_xinerama=" (Using Solaris 9 prototypes for missing header)")
      CPPFLAGS="$my_CPPFLAGS"],
    with_xinerama=no; Xinerama_LIBS=
    problem_xinerama=": Failed to detect libXinerama",
    [$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
  fi
  $UNSET _check_solaris_xinerama
fi
AC_SUBST(Xinerama_LIBS)
AC_SUBST(Xinerama_CFLAGS)

# ********* xinerama-emulation
smr_SWITCH(
  xinerama-emulation,
  [Xinerama emulation on one screen (useful only for developers)], off,
  USE_XINERAMA_EMULATION,,
  [Define if Xinerama should be emulated on a single screen.])
if test x"$enable_xinerama_emulation" = xyes; then
  with_xinerama_emulation=yes
else
  with_xinerama_emulation=no
fi

# ********* xrender
problem_xrender=""
AC_ARG_ENABLE(xrender,
  [  --disable-xrender       disable Xrender alpha-blend rendering ],
  [ if test x"$enableval" = xyes; then
    with_xrender="yes, check"
  else
    with_xrender="no"
    problem_xrender=": Explicitly disabled"
  fi ],
  [ with_xrender="not specified, check" ]
)

AH_TEMPLATE([HAVE_XRENDER],[Define if Xrender library is used.])
if test x"$with_xrender" != xno; then
  $UNSET ac_cv_lib_Xrender_XRenderComposite
  AC_CHECK_LIB(Xrender, XRenderComposite,
    with_xrender=yes; Xrender_LIBS=-lXrender;
    AC_DEFINE(HAVE_XRENDER),
    with_xrender=no; Xrender_LIBS=
    problem_xrender=": Failed to detect libXrender",
    [$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS])
fi
AC_SUBST(Xrender_LIBS)
AC_SUBST(Xrender_CFLAGS)

# ********* xft
problem_xft=""

AC_ARG_ENABLE(xft,
  [  --disable-xft           disable Xft anti-aliased font rendering],
  [ if test x"$enableval" = xyes; then
    with_xft="yes, check"
  else
    with_xft="no"
    problem_xft=": Explicitly disabled"
  fi ],
  [
    with_xft="not specified, check"
  ]
)

AH_TEMPLATE([HAVE_XFT],[Define if Xft library is used.])
AH_TEMPLATE([HAVE_XFT2],[Define if Xft 2 library is used.])
AH_TEMPLATE([HAVE_XFT_UTF8],[Define if Xft library can handle utf8 encoding])
if test x"$with_xft" != xno; then

  # first check for freetype2
  have_freetype=no
  AM_CHECK_FT2(6.1.0)
  if test x"$no_ft" = x; then
    have_freetype=yes
  else
    have_freetype=no
    problem_xft=": Can't detect freetype2 >= 6.1.0/2.0.6"
  fi

  # check for fontconfig for Xft 2
  have_fontconfig=no
  if test x"$have_freetype" != xno ; then
    AM_CHECK_FC(1.0.1)
    if test x"$no_fc" = x ; then
      have_fontconfig=yes
    else
      have_fontconfig=no
      problem_xft=": Can't detect fontconfig >= 1.0.1"
    fi
  fi

  # now check for Xft 2
  with_xft=no
  if test x"$have_fontconfig" != xno ; then
    # Xft 2
    AM_CHECK_XFT(2.0.0)
    if test x"$no_xft" = x; then
      with_xft=yes
      problem_xft=" (version 2)"
      AC_DEFINE(HAVE_XFT2)
      AC_DEFINE(HAVE_XFT)
      AC_DEFINE(HAVE_XFT_UTF8)
      Xft_LIBS=$XFT_LIBS
      Xft_CFLAGS=$XFT_CFLAGS
    else
      problem_xft=": Can't detect Xft2, detected fontconfig"
    fi
  fi

  # if Xft2 not detected check for Xft1
  if test x"$have_freetype" != xno -a x"$with_xft" != xyes; then
    #Xft 1
    $UNSET ac_cv_lib_XftConfigSubstitute
    $UNSET ac_cv_lib_Xft_XftFontOpen
    $UNSET ac_cv_lib_Xft_XftDrawStringUtf8
    AC_CHECK_LIB(Xft, XftFontOpen,
      with_xft=yes, with_xft=no,
      [$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS $FT2_LIBS $Xrender_LIBS])
    if test x"$with_xft" = xyes ; then
      AC_CHECK_LIB(Xft, XftConfigSubstitute, is_xft1=yes, is_xft1=no,
        [$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS $FT2_LIBS $Xrender_LIBS])
      if test x"$is_xft1" = xyes; then
        Xft_LIBS="-lXft $FT2_LIBS"
	Xft_CFLAGS="$Xft_CFLAGS $FT2_CFLAGS"
        problem_xft=" (version 1)"
        AC_DEFINE(HAVE_XFT)
      else
        with_xft=no
        problem_xft=": Can't detect Xft 1 or fontconfig"
      fi
    else
      problem_xft=": Can't detect Xft 1 or 2 and fontconfig"
    fi
    if test x"$with_xft" = xyes; then
      AC_CHECK_LIB(Xft, XftDrawStringUtf8,
        AC_DEFINE(HAVE_XFT_UTF8),,
        [$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS $FT2_LIBS $Xrender_LIBS])
    fi
  fi

fi
AC_SUBST(Xft_LIBS)
AC_SUBST(Xft_CFLAGS)

# ********* xpm
problem_xpm=": Xpm library or header not found"

$UNSET ac_cv_header_X11_xpm_h
$UNSET ac_cv_lib_Xpm_XpmReadFileToXpmImage
smr_CHECK_LIB(xpm, Xpm, for coloured or shaped icons,
    XpmReadFileToXpmImage, X11/xpm.h,
    [$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS], $X_CFLAGS)

if test x"$xpm_LIBS" != x; then
  # Check for proper version of Xpm -- from XEmacs 21.x configure.in
  AC_MSG_CHECKING([for Xpm 3.4g or better])
  my_CPPFLAGS="$CPPFLAGS"
  my_LIBS="$LIBS"
  CPPFLAGS="$CPPFLAGS $xpm_CFLAGS $X_CFLAGS"
  LIBS="$LIBS $xpm_LIBS $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
  AC_TRY_RUN([#include <X11/xpm.h>
   int main(int c, char **v) {
   return c == 1 ? 0 :
     XpmIncludeVersion != XpmLibraryVersion() ? 1 :
     XpmIncludeVersion < 30407 ? 2 : 0 ;}],
    [./conftest dummy_arg; xpm_status=$?;
     if test x"$xpm_status" = x0; then
       with_xpm=yes
       problem_xpm=""
     else
       with_xpm=no;
       if test x"$xpm_status" = x1; then
	 problem_xpm=": Xpm library and header versions don't match"
       elif test x"$xpm_status" = x2x; then
	 problem_xpm=": Xpm library version is too old"
       else
	 problem_xpm=": Internal xpm detection logic error"
       fi
     fi],
   [with_xpm=no; problem_xpm=": Xpm test error, see config.log"])
  AC_MSG_RESULT($with_xpm)
  CPPFLAGS="$my_CPPFLAGS"
  LIBS="$my_LIBS"

  AH_TEMPLATE([XPM],[Define if Xpm library is used.])
  if test x"$with_xpm" = xyes; then
    AC_DEFINE(XPM)
    # FVWMBANNER=FvwmBanner AC_SUBST(FVWMBANNER)
    # XPMROOT=xpmroot AC_SUBST(XPMROOT)
    # FVWMSCRIPT=FvwmScript AC_SUBST(FVWMSCRIPT)
  else
    xpm_LIBS=
    xpm_CFLAGS=
  fi
fi
AC_SUBST(xpm_LIBS)
AC_SUBST(xpm_CFLAGS)

# ********* png
problem_png=": png library or header not found"

$UNSET ac_cv_header_png_h
$UNSET ac_cv_lib_png_png_read_info
smr_CHECK_LIB(png, png, for coloured or shaped icons,
    png_read_info, png.h, -lz -lm,)

if test x"$png_LIBS" != x; then
  # Check for proper version of png
  AC_MSG_CHECKING([for libpng 1.0.4a or better])
  my_CPPFLAGS="$CPPFLAGS"
  my_LIBS="$LIBS"
  CPPFLAGS="$CPPFLAGS $png_CFLAGS"
  LIBS="$LIBS $png_LIBS -lz -lm"
  AC_TRY_RUN([#include <png.h>
   int main(int c, char **v) {
   return c == 1 ? 0 : (PNG_LIBPNG_VER < 10005) ? 2 : 0 ;}],
    [./conftest dummy_arg; png_status=$?;
     if test x"$png_status" = x0; then
       with_png=yes;
     else
       with_png=no;
       if test x"$png_status" = x2; then
	 problem_png=": png library version is too old"
       else
	 problem_png=": Internal png detection logic error"
       fi
     fi],
   [with_png="no"; problem_png=": png test error, see config.log"])
  AC_MSG_RESULT($with_png)
  CPPFLAGS="$my_CPPFLAGS"
  LIBS="$my_LIBS"
fi

AH_TEMPLATE([HAVE_PNG],[Define if ppm library is used.])
if test x"$with_png" = xyes; then
  AC_DEFINE(HAVE_PNG)
  png_LIBS="-lpng -lz"
  problem_png=""
else
  with_png=no
fi
AC_SUBST(png_LIBS)
AC_SUBST(png_CFLAGS)

# ** needed by the png support
AC_C_BIGENDIAN

# ********* rplay
$UNSET ac_cv_header_rplay_h
$UNSET ac_cv_lib_rplay_rplay_create
# Add in X_EXTRA_LIBS here to get things like connect().
smr_CHECK_LIB(rplay, , adds audio capability, rplay_create, rplay.h,
	      $X_EXTRA_LIBS)
AH_TEMPLATE([HAVE_RPLAY],[Define if rplay library is used.])
test x"$rplay_LIBS" != x && AC_DEFINE(HAVE_RPLAY)
AC_SUBST(rplay_LIBS)
AC_SUBST(rplay_CFLAGS)


# ********* stroke
$UNSET ac_cv_header_stroke_h
$UNSET ac_cv_lib_stroke_stroke_init
dnl Add in X_LIBS for MOUSE_DROPPINGS?
dnl As of 23/Mar/2000 the only libstroke RPM has /usr/X11R6/include/stroke.h
AH_TEMPLATE([HAVE_STROKE],[Define if stroke library is used.])
smr_CHECK_LIB(stroke, , mouse strokes recognition,
	stroke_init, stroke.h,
	[$X_LIBS -lX11], $X_CFLAGS -I/usr/X11R6/include)
test x"$stroke_LIBS" != x &&
AC_DEFINE(HAVE_STROKE)
AH_VERBATIM([_HAVE_STROKE],
[#ifdef HAVE_STROKE
#    define STROKE_ARG(x) x,
#    define STROKE_CODE(x) x
#else
#    define STROKE_ARG(x)
#    define STROKE_CODE(x)
#endif])
AC_SUBST(stroke_LIBS)
AC_SUBST(stroke_CFLAGS)


# ********* readline
with_readline=no
problem_readline=": Both termcap and ncurses disabled"

smr_ARG_WITHLIB(termcap, , to accomplish readline)
AH_TEMPLATE([HAVE_READLINE],[Define if readline is available.])
if test x"$with_termcap" != xno; then
  # Forget cached values, so user can re-run configure
  $UNSET ac_cv_header_readline_history_h
  $UNSET ac_cv_lib_readline_readline
  AC_MSG_CHECKING([with termcap])
  smr_CHECK_LIB(readline, , line editing/history, readline, readline/history.h,
    $termcap_LIBS)
  if test x"$readline_LIBS" != x; then
    with_readline=yes
    readline_LIBS="$readline_LIBS $termcap_LIBS"
    AC_DEFINE(HAVE_READLINE)
  fi
fi
smr_ARG_WITHLIB(ncurses, , to accomplish readline)
if test x"$with_ncurses" != xno -a ! "$readline_LIBS"; then
  # We couldn't use readline with termcap; try with ncurses?
  # Doesn't this seem a hacky way to do this??
  # unset cached values from last check...
  $UNSET ac_cv_header_readline_history_h
  $UNSET ac_cv_lib_readline_readline
  AC_MSG_CHECKING([with ncurses])
  dnl We can not call smr_CHECK_LIB twice here without having the usage twice.
  dnl old_LIBS=$LIBS
  dnl AC_CHECK_LIB(readline, readline, , , $ncurses_LIBS)
  dnl LIBS=$old_LIBS
  dnl if test x"$ac_cv_lib_readline_readline" = xyes; then
  dnl   AC_CHECK_HEADERS(readline/history.h)
  dnl   if test x"$ac_cv_header_readline_history_h" = xyes; then
  dnl     with_readline=yes
  dnl     readline_LIBS="$readline_LIBS $ncurses_LIBS"
  dnl     AC_DEFINE(HAVE_READLINE)
  dnl   fi
  dnl fi
  smr_CHECK_LIB(readline, , line editing/history, readline, readline/history.h,
    $ncurses_LIBS)
  if test x"$readline_LIBS" != x; then
    with_readline=yes
    readline_LIBS="$readline_LIBS $ncurses_LIBS"
    AC_DEFINE(HAVE_READLINE)
  fi
fi
AC_SUBST(readline_LIBS)
AC_SUBST(readline_CFLAGS)


# Check if Xsetlocale() is available or not.
AH_TEMPLATE([X_LOCALE],[Enables to use setlocale() provided by X])
AC_CHECK_LIB(X11, _Xsetlocale, AC_DEFINE(X_LOCALE),, $X_LIBS -lX11)

# Check if Xsetlocale() is available or not.
AH_TEMPLATE([HAVE_XOUTPUT_METHOD],[Enable X output method])
AC_CHECK_LIB(X11, XOpenOM, AC_DEFINE(HAVE_XOUTPUT_METHOD),, $X_LIBS -lX11)

# ******** iconv
with_iconv=no
with_iconv_type=no
with_lib_iconv=no
with_sys_iconv=no
problem_iconv=": Explicitly disabled"

AC_ARG_ENABLE(iconv,
  [  --disable-iconv         disable support for iconv character conversion],
  [ac_cv_iconv="$enableval"],
  [ac_cv_iconv="yes"])

AH_TEMPLATE([USE_LIBICONV],
  [define if we use libiconv (not needed in general: for example iconv is
  native with recent glibc)])
AH_TEMPLATE([HAVE_ICONV],
  [Define if iconv (in the libc) or libiconv is available])
if test x"$ac_cv_iconv" != xno; then
  # * first check for gnu libiconv
  $UNSET ac_cv_header_libiconv_h
  $UNSET ac_cv_lib_libiconv_libiconv_open
  smr_CHECK_LIB(
  	iconv, , if not found sys iconv is used, libiconv_open, iconv.h)
  if test x"$iconv_LIBS" != x; then
     AC_DEFINE(USE_LIBICONV)
     with_lib_iconv=yes
  fi
  AC_SUBST(iconv_LIBS)
  AC_SUBST(iconv_CFLAGS)

  # * check for system iconv

  AC_CHECK_FUNC(iconv_open, with_sys_iconv=yes)

  if test x"$with_lib_iconv" = xyes -a x"$with_sys_iconv" = xyes; then
     AC_MSG_WARN([***  Both system iconv and libiconv found: use libiconv])
     AC_MSG_WARN([***  Use --with-iconv-library=no to use the system iconv])
  fi

  # * libiconv found check for libcharset to get the good iconv charset
  if test x"$with_lib_iconv" = xyes; then
     CHECK_LIBCHARSET
  fi

  test x"$with_lib_iconv" = xyes -o x"$with_sys_iconv" = xyes &&
	 with_iconv=yes && problem_iconv=""
  test x"$with_lib_iconv" = xyes && with_iconv_type="yes (libiconv)"
  test x"$with_sys_iconv" = xyes && with_iconv_type="yes (from C library)"

  if test x"$with_iconv" = xno; then
    AC_MSG_WARN([*** ])
    AC_MSG_WARN([*** No iconv() implementation found in C library or libiconv])
    AC_MSG_WARN([*** Please install libiconv ftp://ftp.gnu.org/pub/gnu/libiconv/])
    AC_MSG_WARN([*** ])
  fi

  if test x"$with_iconv" = xyes; then
     AC_DEFINE(HAVE_ICONV)
     ICONV_SECOND_ARG
  fi
fi
AH_VERBATIM([_HAVE_LIBCHARSET],
[#ifdef USE_LIBICONV
/* define to use locale_charset in the place of nl_langinfog if libiconv
 * is used */
#undef HAVE_LIBCHARSET
#endif])


# ******** nl_langinfo and CODESET
AH_TEMPLATE([HAVE_CODESET],[Have nl_langinfo (CODESET)])
AC_MSG_CHECKING([for nl_langinfo (CODESET)])
AC_TRY_COMPILE([#include <langinfo.h>
#include <locale.h>],
[char *codeset = nl_langinfo(CODESET); setlocale(LC_CTYPE, "");],
   AC_DEFINE(HAVE_CODESET)
   have_codeset=yes,
   have_codeset=no)
AC_MSG_RESULT($have_codeset)


# ********* fribidi
AC_ARG_ENABLE(bidi,
	[  --disable-bidi          disable bi-directional text support],
	[ if test x"$enableval" = xyes; then
		with_bidi="yes, check"
	else
		with_bidi="no"
		problem_bidi=": Explicitly disabled"
	fi ],
	[ with_bidi="not specified, check" ]
)

if test x"$with_bidi" != xno; then
	AC_ARG_WITH(fribidi-bindir,
		[  --with-fribidi-bindir=DIR  directory of fribidi-config if not in PATH],
		FRIBIDI_BINDIR="$withval", FRIBIDI_BINDIR=".")
	AC_PATH_PROG(FRIBIDI_CONFIG, fribidi-config,, [$FRIBIDI_BINDIR:$PATH])

	if test x"$FRIBIDI_CONFIG" = x; then
		with_bidi=no
		problem_bidi=": No fribidi-config found in PATH"
	else
		Bidi_CFLAGS=`$FRIBIDI_CONFIG --cflags`
		Bidi_LIBS=`$FRIBIDI_CONFIG --libs`
		AC_CHECK_LIB(fribidi, fribidi_log2vis,
			with_bidi=yes; problem_bidi=,
			with_bidi=no; problem_bidi=": No good libs via fribidi-config",
			[$Bidi_LIBS $Bidi_CFLAGS])
	fi
fi

if test x"$with_bidi" != xno; then
	fribidi_in_path=yes
	ac_save_LIBS="$LIBS"
	LIBS="$LIBS $Bidi_LIBS"
	AC_TRY_RUN([#include <stdlib.h>
#include <fribidi/fribidi.h>
int main()
{
	FriBidiChar *logical_unicode_str =
		(FriBidiChar *)malloc((4 + 1) * sizeof(FriBidiChar));
	fribidi_charset_to_unicode(
		fribidi_parse_charset("iso8859-8"), "test", 4,
		logical_unicode_str);
	return 0;
}
], [:], [fribidi_in_path=no])
	LIBS="$ac_save_LIBS"
	if test x"$fribidi_in_path" != xyes; then
		ac_save_CFLAGS="$CFLAGS"
		ac_save_LIBS="$LIBS"
		CFLAGS="$CFLAGS $Bidi_CFLAGS"
		LIBS="$LIBS $Bidi_LIBS"
	AC_TRY_RUN([#include <stdlib.h>
#include <fribidi/fribidi.h>
int main()
{
	FriBidiChar *logical_unicode_str =
		(FriBidiChar *)malloc((4 + 1) * sizeof(FriBidiChar));
	fribidi_charset_to_unicode(
		fribidi_parse_charset("iso8859-8"), "test", 4,
		logical_unicode_str);
	return 0;
}
], [:], [with_bidi=no; problem_bidi=": Bad fribidi version, see config.log"])
		CFLAGS="$ac_save_CFLAGS"
		LIBS="$ac_save_LIBS"
	fi
	if test x"$fribidi_in_path" != xno; then
		Bidi_CFLAGS=
		Bidi_LIBS=-lfribidi
	fi
fi

AH_TEMPLATE([HAVE_BIDI],[Define if fribidi library is used.])
AH_TEMPLATE([FRIBIDI_CHARSET_SPELLING],
  [Support fribidi-0.10.4 and older with "CHARSET" spelling.])
if test x"$with_bidi" = xno; then
	Bidi_CFLAGS=
	Bidi_LIBS=
else
	AC_DEFINE(HAVE_BIDI)
	AC_TRY_RUN([#include <fribidi/fribidi.h>
		int main(int c, char **v) {
			return FRIBIDI_CHARSET_NOT_FOUND * 0;
		}
	], [AC_DEFINE(FRIBIDI_CHARSET_SPELLING)])
fi
AH_VERBATIM([_FRIBIDI_CHARSET_SPELLING],
[#ifdef FRIBIDI_CHARSET_SPELLING
#  define FRIBIDI_CHAR_SET_NOT_FOUND FRIBIDI_CHARSET_NOT_FOUND
#endif])

AC_SUBST(Bidi_LIBS)
AC_SUBST(Bidi_CFLAGS)


# ********* perllib
with_perllib="yes"
problem_perllib=""
FVWM_PERLLIB=perllib
AC_ARG_ENABLE(perllib,
	[  --disable-perllib       disable installing FVWM perl library],
	[ if test x"$enableval" = xno; then
		with_perllib="no"
		problem_perllib=": Explicitly disabled"
		FVWM_PERLLIB=""
	fi ],
)
AC_SUBST(FVWM_PERLLIB)

# ******* gettext
ALL_LINGUAS="ar de fr sv_SE zh_CN"
FVWM_DOMAIN="fvwm"
FVWMTASKBAR_DOMAIN="FvwmTaskBar"
FVWMSCRIPT_DOMAIN="FvwmScript"
ALL_DOMAINS="$FVWM_DOMAIN $FVWMTASKBAR_DOMAIN $FVWMSCRIPT_DOMAIN"

AC_SUBST(ALL_LINGUAS)
AC_SUBST(FVWM_DOMAIN)
AC_SUBST(FVWMTASKBAR_DOMAIN)
AC_SUBST(FVWMSCRIPT_DOMAIN)
AC_SUBST(ALL_DOMAINS)

LOCALEDIR='${datadir}'"/locale"
with_gettext="yes"
problem_gettext=""

AC_ARG_ENABLE(nls,
	[  --disable-nls           do not use Native Language Support],
	[ if test x"$enableval" = xno; then
		with_gettext="no"
		problem_gettext=": Explicitly disabled"
	fi ],
)

AH_TEMPLATE([HAVE_NLS],
  [Define to 1 if translation of program messages to the user's native
  language is requested.])
if test x"$with_gettext" != xno; then
  AM_GNU_FGETTEXT
  if test x"$USE_NLS" = "xyes"; then
    AC_DEFINE(HAVE_NLS, 1)
  else
    with_gettext="no"
    problem_gettext=": Failed to detected GNU gettext"
  fi
else
  USE_NLS=no
fi

# libs and buil
AC_SUBST(intl_LIBS)
AC_SUBST(intl_CFLAGS)
AC_SUBST(USE_NLS)
AC_SUBST(POSUB)
AC_SUBST(LOCALEDIR)
AC_SUBST(MKINSTALLDIRS)
# programs for devel
AC_SUBST(XGETTEXT)
AC_SUBST(GMSGFMT)
AC_SUBST(MSGMERGE)
AC_SUBST(MSGFMT)
AC_SUBST(MSGUNIQ)
#catalogs
AC_SUBST(INST_LINGUAS)
AC_SUBST(CATALOGS)
AC_SUBST(POFILES)
AC_SUBST(GMOFILES)
AC_SUBST(UPDATEPOFILES)
AC_SUBST(DUMMYPOFILES)
AC_SUBST(CATOBJEXT)

# Check for REQUIRED headers and functions before going any
# further.

# The module interface uses variadic functions for message passing.
AC_CHECK_HEADERS(stdarg.h)
AC_CHECK_FUNCS(vfprintf)
if test x$ac_cv_header_stdarg_h = xno -o \
        $ac_cv_func_vfprintf = no; then
     AC_MSG_ERROR([stdarg.h and vfprintf required])
fi

# For reaping children, fvwm needs either waitpid() or wait3()
# Some extra modules may need wait4() too
AC_CHECK_FUNCS(waitpid)
if test x$ac_cv_func_waitpid = xno; then
    AC_CHECK_FUNCS(wait3 wait4)
    if test x$ac_cv_func_wait3 = xno; then
        AC_MSG_ERROR([Either waitpid or wait3 function is required])
    fi
fi

# C89/C99 signal handling
AC_CHECK_FUNCS(sigsetjmp siglongjmp)

# Look harder for a C preprocessor for FvwmCpp
AC_PATH_PROG(FVWM_CPP, cpp, no, $PATH:/lib:/usr/lib:/usr/ccs/lib)
if test x"$FVWM_CPP" = xno; then
  FVWM_CPP=
  AC_MSG_WARN([cannot locate a C preprocessor: run FvwmCpp with -cppprog])
fi
dnl FIXME: make sure the cpp we found actually works...

# Finish checking for programs.
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_RANLIB
dnl lex+yacc now only needed for FvwmScript developers when syntax is changed
dnl AM_PROG_LEX
dnl AC_PROG_YACC

REQUIRED_PERL_VERSION=5.004
AC_SUBST(REQUIRED_PERL_VERSION)

if test x"$PERL" = x; then
	AC_PATH_PROG(PERL, perl)
fi
if test x"$PERL" != x; then
	AC_MSG_CHECKING([for perl $REQUIRED_PERL_VERSION or better])
	if ("$PERL" -e "require $REQUIRED_PERL_VERSION;") 2>/dev/null; then
		AC_MSG_RESULT(yes)
	else
		AC_MSG_RESULT(no)
		AC_MSG_WARN([$PERL not found or too old])
	fi
else
	AC_MSG_WARN([perl is not found, it is required for some scripts and modules])
	AC_MSG_WARN([It is recommended to install perl $REQUIRED_PERL_VERSION or better later])
	PERL=/usr/bin/perl
fi
AC_MSG_RESULT([assuming $PERL as perl location])
AC_SUBST(PERL)

# Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(stdlib.h fcntl.h limits.h malloc.h string.h memory.h unistd.h)
AC_CHECK_HEADERS(getopt.h sys/select.h sys/systeminfo.h sys/time.h)

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
dnl AC_STRUCT_TM
AC_TYPE_SIGNAL

# Checks for library functions.
AC_FUNC_ALLOCA
AC_FUNC_STRFTIME
AC_FUNC_SETPGRP
AC_CHECK_FUNCS(gettimeofday mkfifo putenv setvbuf socket waitpid)
AC_CHECK_FUNCS(strdup strstr strtol memmove memcpy strchr sysconf uname div)
AC_CHECK_FUNCS(sigaction siginterrupt getpwuid)
AC_CHECK_FUNCS(setpgrp setpgid)
AC_CHECK_FUNCS(lstat)



pds_CHECK_TYPE(sig_atomic_t, int, [#include <signal.h>], [Specify a type for sig_atomic_t if it's not available.])

if test x$ac_cv_func_setvbuf = xyes; then
  AC_FUNC_SETVBUF_REVERSED
fi

AC_FUNC_SELECT
if test x$ac_cv_func_select != xyes; then
  AC_MSG_ERROR([select required])
fi

# Check for standard functions that we have replacements for.
AC_REPLACE_FUNCS(gethostname strcasecmp strncasecmp strdup strerror usleep atexit)
dnl dv: this is harmful with autoconf 2.53 and is done automatically anyway
dnl AC_SUBST(LIBOBJS)

# check for mkstemp, see the discution on this subject on the fvwm workers
# list (2001-02-16 and 2001-02-24)
AM_SAFETY_CHECK_MKSTEMP

# If we do not have atexit(), then check for on_exit()
if test x$ac_cv_func_atexit = xno; then
  AC_CHECK_FUNCS(on_exit)
fi

# Check for unsetenv function
AC_CHECK_FUNCS(unsetenv)


# ********* GTK, IMLIB, GNOME
# Check the availability of gtk
FVWMGTK=""
MANFVWMGTK=""
AC_ARG_ENABLE(
	gtk,
	[  --disable-gtk           do not build modules using gtk library],
	enable_gtktest="$enableval", enable_gtktest=yes)
if test x"$enable_gtktest" = xyes; then
	AM_PATH_GTK(1.1.0,[
		FVWMGTK="FvwmGtk$EXEEXT" AC_SUBST(FVWMGTK)
		MANFVWMGTK=FvwmGtk.1 AC_SUBST(MANFVWMGTK)
	],)
	if test x"$no_gtk" = x; then
		with_gtk=yes
		problem_gtk=""
	else
		with_gtk=no
		problem_gtk=": Failed to detect GTK, see config.log"
	fi
else
	with_gtk=no
	problem_gtk=": Explicitly disabled"
fi
AC_SUBST(FVWMGTK)
AC_SUBST(MANFVWMGTK)

# Check the availability of gdk-imlib
AH_TEMPLATE([GDK_IMLIB],[Define if gdk-imlib is used])
AM_PATH_GDK_IMLIB(1.8.0, AC_DEFINE(GDK_IMLIB))
if test x"$no_imlib" = x; then
  with_gdkimlib=yes
  problem_gdkimlib=""
else
  with_gdkimlib=no
  problem_gdkimlib=": Failed on gdk-imlib, see config.log"
fi

GNOME_INIT_HOOK

# Unfortunately we have 2 gnome supports: WM hints and gnome libs.
# The $with_gnomehints below refers to the first, not GNOME_INIT_HOOK.
if test x"$enable_gnome_hints" != xno; then
  with_gnomehints=yes
  problem_gnomehints=""
else
  with_gnomehints=no
  problem_gnomehints=": Explicitly disabled"
fi

# Define some compatibility macros needed for config.h.
mg_DEFINE_IF_NOT([#include <X11/keysym.h>],
  [defined XK_Page_Up && defined XK_Page_Down],
  [COMPAT_OLD_KEYSYMDEF], [$X_CFLAGS],
  [Old AIX systems (3.2.5) don't define some common keysyms.])
AH_VERBATIM([_COMPAT_OLD_KEYSYMDEF],
[#ifdef COMPAT_OLD_KEYSYMDEF
#  define XK_Page_Up   XK_Prior
#  define XK_Page_Down XK_Next
#endif])

if test x"$with_stroke" = xyes; then
  mg_DEFINE_IF_NOT([#include <stroke.h>],
    [defined STROKE_MAX_SEQUENCE],
    [COMPAT_OLD_LIBSTROKE], [$stroke_CFLAGS],
    [Old libstroke <= 0.4 does not use STROKE_ prefix for constants.])
fi
AH_VERBATIM([_COMPAT_OLD_LIBSTROKE],
[#ifdef COMPAT_OLD_LIBSTROKE
/* currently we only use one constant */
#  define STROKE_MAX_SEQUENCE MAX_SEQUENCE
#endif])


# Allow building with dmalloc.  Do this last to avoid screwing up any
# other checks above.
case "$ac_cv_dmalloc" in
  yes) AC_CHECK_HEADERS(dmalloc.h)
       AC_CHECK_LIB(dmalloc, dmalloc_shutdown)
       CPPFLAGS="$CPPFLAGS -DDMALLOC_FUNC_CHECK" ;;
esac


# Allow building with efence.
case "$ac_cv_efence" in
  yes) AC_CHECK_LIB(efence, malloc) ;;
esac

# some explicit definitions for config.h file
AH_VERBATIM([_ZEND_EXPLICIT_DEFINITIONS],
[
/**
 * The next few defines are options that are only changed from their values
 * shown here on systems that _don't_ use the configure script.
 **/

/* Enable tests for missing too many XEvents.  Usually you want this. */
#define WORRY_ABOUT_MISSED_XEVENTS 1

/* Define if the X11 ConnectionNumber is actually a file descriptor. */
#define HAVE_X11_FD 1

/* Define if fork() has unix semantics.  On VMS, no child process is created
   until after a successful exec(). */
#define FORK_CREATES_CHILD 1

/* Suffix for executable filenames; NULL if no extension needed. */
#define EXECUTABLE_EXTENSION NULL

/* Define to remove the extension from executable pathnames before calling
   exec(). */
#undef REMOVE_EXECUTABLE_EXTENSION

/* Enables the "MiniIcon" Style option to specify a small pixmap which
 * can be used as one of the title-bar buttons, shown in window list,
 * utilized by modules, etc.  Requires PIXMAP_BUTTONS to be defined
 * (see below). */
/* #undef MINI_ICONS */
/* NOTE: hard coded to 1 */
#if 1
#define FMiniIconsSupported 1
#else
#define FMiniIconsSupported 0
#endif

/* Enables tagged general decoration styles which can be assigned to
 * windows using the UseDecor Style option, or dynamically updated
 * with ChangeDecor.  To create and destroy "decor" definitions, see
 * the man page entries for AddToDecor and DestroyDecor.  There is a
 * slight memory penalty for each additionally defined decor. */
/* #undef USEDECOR */
/* NOTE: hard coded to 1 */
#define USEDECOR 1

#if RETSIGTYPE != void
#define SIGNAL_RETURN return 0
#else
#define SIGNAL_RETURN return
#endif

/* Allow GCC extensions to work, if you have GCC. */
#ifndef __attribute__
/* This feature is available in gcc versions 2.5 and later. */
#  if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
#    define __attribute__(x)
#  endif
/* The __-protected variants of `format' and `printf' attributes
 * are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
#  if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
#    define __format__ format
#    define __printf__ printf
#  endif
#endif

#if HAVE_ALLOCA_H
#  include <alloca.h>
#else
#  ifdef _AIX
       #pragma alloca
#  else
#    ifndef alloca /* predefined by HP cc +Olibcalls */
	 char *alloca ();
#    endif
#  endif
#endif

#ifdef HAVE_STRING_H
#  include <string.h>
#endif
#ifdef HAVE_STRINGS_H
#  include <strings.h>
#endif
#ifdef HAVE_MEMORY_H
#  include <memory.h>
#endif
#ifdef HAVE_STDLIB_H
#  include <stdlib.h>
#endif
#ifdef HAVE_MALLOC_H
#  include <malloc.h>
#endif
#ifdef HAVE_FCNTL_H
#  include <fcntl.h>
#endif
#ifndef HAVE_STRCHR
#  define strchr(_s,_c)   index((_s),(_c))
#  define strrchr(_s,_c)  rindex((_s),(_c))
#endif

#ifndef HAVE_MEMCPY
#  define memcpy(_d,_s,_l)  bcopy((_s),(_d),(_l))
#endif
#ifndef HAVE_MEMMOVE
#  define memmove(_d,_s,_l) bcopy((_s),(_d),(_l))
#endif

#if HAVE_SYS_TYPES_H
#  include <sys/types.h>
#endif

#if HAVE_UNISTD_H
#  include <unistd.h>
#endif

#ifndef min
#  define min(a,b) (((a)<(b)) ? (a) : (b))
#endif
#ifndef max
#  define max(a,b) (((a)>(b)) ? (a) : (b))
#endif
#ifndef abs
#  define abs(a) (((a)>=0)?(a):-(a))
#endif

#include "libs/defaults.h"

#ifndef FEVENT_C
#include <X11/Xlib.h>
#include "libs/FEvent.h"
#endif

#ifndef O_NOFOLLOW
#define O_NOFOLLOW 0
#endif

#ifdef HAVE_LSTAT
#define DO_USE_LSTAT 1
#define fvwm_lstat(x,y) lstat(x,y)
#else
#define DO_USE_LSTAT 0
#define fvwm_lstat(x,y) -1
#endif

])

# mainly for fvwm-config
AC_SUBST(with_bidi)
AC_SUBST(with_gtk)
AC_SUBST(with_gdkimlib)
AC_SUBST(with_gettext)
AC_SUBST(with_gnomelibs)
AC_SUBST(with_iconv)
AC_SUBST(with_perllib)
AC_SUBST(with_png)
AC_SUBST(with_readline)
AC_SUBST(with_rplay)
AC_SUBST(with_shape)
AC_SUBST(with_shm)
AC_SUBST(with_sm)
AC_SUBST(with_stroke)
AC_SUBST(with_xft)
AC_SUBST(with_xinerama)
AC_SUBST(with_xrender)
AC_SUBST(with_xpm)

LOCAL_BUGADDR=${FVWM_BUGADDR-${USER-${LOGNAME-`whoami`}}}
AC_SUBST(LOCAL_BUGADDR)

AC_OUTPUT(
	Makefile
	libs/Makefile
	fvwm/Makefile
	modules/Makefile
dnl
	bin/fvwm-bug.1
	bin/fvwm-config.1
	bin/fvwm-convert-2.2.1
	bin/fvwm-convert-2.4.1
	bin/fvwm-convert-2.6.1
	bin/fvwm-menu-desktop.1
dnl	bin/fvwm-menu-directory.1
dnl	bin/fvwm-menu-headlines.1
dnl	bin/fvwm-menu-xlock.1
dnl	bin/fvwm-perllib.1
	bin/fvwm-root.1
	fvwm/fvwm.1
	modules/FvwmAnimate/FvwmAnimate.1
	modules/FvwmAuto/FvwmAuto.1
	modules/FvwmBacker/FvwmBacker.1
	modules/FvwmBanner/FvwmBanner.1
	modules/FvwmButtons/FvwmButtons.1
	modules/FvwmCommand/FvwmCommand.1
	modules/FvwmConsole/FvwmConsole.1
	modules/FvwmConsole/FvwmConsoleC.pl.1
	modules/FvwmCpp/FvwmCpp.1
dnl	modules/FvwmDebug/FvwmDebug.1
dnl	modules/FvwmDebug/FvwmGtkDebug.1
dnl	modules/FvwmDebug/FvwmOldDebug.1
	modules/FvwmDragWell/FvwmDragWell.1
	modules/FvwmEvent/FvwmEvent.1
	modules/FvwmForm/FvwmForm.1
	modules/FvwmGtk/FvwmGtk.1
	modules/FvwmIconBox/FvwmIconBox.1
	modules/FvwmIconMan/FvwmIconMan.1
	modules/FvwmIdent/FvwmIdent.1
	modules/FvwmM4/FvwmM4.1
	modules/FvwmPager/FvwmPager.1
dnl	modules/FvwmPerl/FvwmPerl.1
	modules/FvwmProxy/FvwmProxy.1
	modules/FvwmRearrange/FvwmRearrange.1
	modules/FvwmSave/FvwmSave.1
	modules/FvwmSaveDesk/FvwmSaveDesk.1
	modules/FvwmScript/FvwmScript.1
	modules/FvwmScroll/FvwmScroll.1
	modules/FvwmTaskBar/FvwmTaskBar.1
	modules/FvwmTheme/FvwmTheme.1
	modules/FvwmWharf/FvwmWharf.1
	modules/FvwmWinList/FvwmWinList.1
dnl	modules/FvwmWindowMenu/FvwmWindowMenu.1
dnl
	bin/Makefile
	bin/fvwm-config
	bin/fvwm-bug
	bin/fvwm-perllib
	bin/fvwm-menu-xlock
	bin/fvwm-menu-directory
	bin/fvwm-menu-desktop
	bin/fvwm-menu-headlines
	bin/fvwm-convert-2.4
	bin/fvwm-convert-2.6
dnl
	utils/Makefile
	perllib/Makefile
	perllib/General/Makefile
	perllib/FVWM/Makefile
	perllib/FVWM/Module/Makefile
	perllib/FVWM/Tracker/Makefile
	perllib/FVWM/Module.pm
	rpm/Makefile
	rpm/fvwm.spec
	docs/fvwm.lsm
	docs/Makefile
	sample.fvwmrc/Makefile
	tests/Makefile
	tests/hints/Makefile
	po/Makefile
dnl
	modules/FvwmAnimate/Makefile
	modules/FvwmAuto/Makefile
	modules/FvwmBacker/Makefile
	modules/FvwmBanner/Makefile
	modules/FvwmButtons/Makefile
	modules/FvwmCommand/Makefile
	modules/FvwmCommand/scripts/Makefile
	modules/FvwmConsole/Makefile
	modules/FvwmConsole/FvwmConsoleC.pl
	modules/FvwmCpp/Makefile
	modules/FvwmDebug/Makefile
	modules/FvwmDebug/FvwmDebug
	modules/FvwmDebug/FvwmGtkDebug
	modules/FvwmDragWell/Makefile
	modules/FvwmEvent/Makefile
	modules/FvwmForm/Makefile
	modules/FvwmIconBox/Makefile
	modules/FvwmIconMan/Makefile
	modules/FvwmIdent/Makefile
	modules/FvwmM4/Makefile
	modules/FvwmPager/Makefile
	modules/FvwmPerl/Makefile
	modules/FvwmPerl/FvwmPerl
	modules/FvwmProxy/Makefile
	modules/FvwmRearrange/Makefile
	modules/FvwmSave/Makefile
	modules/FvwmSaveDesk/Makefile
	modules/FvwmScript/Makefile
	modules/FvwmScript/Scripts/Makefile
	modules/FvwmScript/Widgets/Makefile
	modules/FvwmScroll/Makefile
	modules/FvwmTabs/Makefile
	modules/FvwmTabs/FvwmTabs
	modules/FvwmTaskBar/Makefile
	modules/FvwmTheme/Makefile
	modules/FvwmWharf/Makefile
	modules/FvwmWinList/Makefile
	modules/FvwmWindowMenu/Makefile
	modules/FvwmWindowMenu/FvwmWindowMenu
	modules/FvwmGtk/Makefile
)

# ---------------------------------------------------------------------------
# Original config.status is patched to make generated scripts executable.
sed 's/> $ac_file/> $ac_file; test x"`head -1 $ac_file | cut -c1-2`" = x"#!" \&\& chmod a+rx $ac_file/' <config.status >config.status-t && \
mv config.status-t config.status
chmod +x config.status
# ---------------------------------------------------------------------------

# ---------------------------------------------------------------------------
cat >config.status-t <<EOF
#! /bin/sh

# Original config.status is patched to satisfy processing *.in with 'make -j'.
# This bug seems to be partially fixed in autoconf-2.50 (not in all places).
UNIQUE_POSTFIX=\$\$

EOF
sed 's/conftest/conftest\${UNIQUE_POSTFIX}/g' <config.status >>config.status-t && \
mv config.status-t config.status
chmod +x config.status
# ---------------------------------------------------------------------------

eval my_bindir="`eval echo ${bindir}`"
eval my_mandir="`eval echo ${mandir}`"
eval my_moddir="`eval echo ${FVWM_MODULEDIR}`"; eval my_moddir="$my_moddir"
eval my_datdir="`eval echo ${FVWM_DATADIR}`"
eval my_plldir="`eval echo ${FVWM_PERLLIBDIR}`"
test x"$FVWM_PERLLIB" = x && my_plldir="(Not installed) $my_plldir"
eval my_localedir="`eval echo ${LOCALEDIR}`"
test x"$USE_NLS" = xno && my_localedir="(Not installed) $my_localdir"

case "$with_gtk" in
  yes) fvwmgtk_msg="
  With GDK image support in FvwmGtk?  $with_gdkimlib$problem_gdkimlib
  With GNOME libs support in FvwmGtk? $with_gnomelibs$problem_gnomelibs" ;;
  no) fvwmgtk_msg="" ;;
esac

echo "
FVWM Configuration:

  Version:     $VERSION$VERSIONINFO

  Executables: $my_bindir
  Man pages:   $my_mandir
  Modules:     $my_moddir
  Data files:  $my_datdir
  Perl lib:    $my_plldir
  Locale msg:  $my_localedir $INST_LINGUAS

  With Asian bi-direct. text support? $with_bidi$problem_bidi
  With Gettext Native Lang support?   $with_gettext$problem_gettext
  With GTK+ required for FvwmGtk?     $with_gtk$problem_gtk$fvwmgtk_msg
  With Iconv support?                 $with_iconv_type$problem_iconv
  With Mouse strokes (gestures)?      $with_stroke$problem_stroke
  With PNG image support?             $with_png$problem_png
  With ReadLine sup. in FvwmConsole?  $with_readline$problem_readline
  With RPlay support in FvwmEvent?    $with_rplay$problem_rplay
  With Shaped window support?         $with_shape$problem_shape
  With Shared memory for XImage?      $with_shm$problem_shm
  With Session Management support?    $with_sm$problem_sm
  With Xinerama multi-head support?   $with_xinerama$problem_xinerama
  With Xft anti-alias font support?   $with_xft$problem_xft
  With XPM image support?             $with_xpm$problem_xpm
  With Xrender image support?         $with_xrender$problem_xrender

See INSTALL.fvwm for the description of what this may mean."

case "$with_xinerama_emulation" in
  yes) echo "  Xinerama emulation enabled." ;;
esac
case "$ac_cv_dmalloc" in
  yes) echo "  DMALLOC heap debugging library enabled." ;;
esac
case "$ac_cv_efence" in
  yes) echo "  EFENCE debugging library enabled." ;;
esac