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
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
|
dnl Process this file with autoconf to produce a configure script.
AC_INIT([xmlsec1],[1.2.19],[http://www.aleksey.com/xmlsec])
XMLSEC_PACKAGE=xmlsec1
XMLSEC_VERSION_MAJOR=1
XMLSEC_VERSION_MINOR=2
XMLSEC_VERSION_SUBMINOR=19
XMLSEC_VERSION="$XMLSEC_VERSION_MAJOR.$XMLSEC_VERSION_MINOR.$XMLSEC_VERSION_SUBMINOR"
XMLSEC_VERSION_INFO=`echo $XMLSEC_VERSION | awk -F. '{ printf "%d:%d:%d", $1+$2, $3, $2 }'`
XMLSEC_VERSION_SAFE=`echo $XMLSEC_VERSION | sed 's/\./_/g'`
AC_PREREQ([2.52g])
AC_CANONICAL_HOST
AC_SUBST(XMLSEC_VERSION)
AC_SUBST(XMLSEC_PACKAGE)
AC_SUBST(XMLSEC_VERSION_SAFE)
AC_SUBST(XMLSEC_VERSION_MAJOR)
AC_SUBST(XMLSEC_VERSION_MINOR)
AC_SUBST(XMLSEC_VERSION_SUBMINOR)
AC_SUBST(XMLSEC_VERSION_INFO)
AC_CONFIG_MACRO_DIR(m4)
AM_INIT_AUTOMAKE([1.7 tar-ustar])
AC_CONFIG_HEADERS([config.h])
AM_MAINTAINER_MODE
# Support silent build rules, requires at least automake-1.11. Disable
# by either passing --disable-silent-rules to configure or passing V=1
# to make
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
dnl
dnl Check the environment
dnl
AC_PROG_CC
AC_PROG_INSTALL
AC_HEADER_STDC
AC_PROG_LIBTOOL
LT_INIT
dnl
dnl Find programs
dnl
if test "z$RM" == "z" ; then
AC_PATH_PROG(RM, rm, /bin/rm)
fi
AC_PATH_PROG(CP, cp, /bin/cp)
AC_PATH_PROG(MV, mv, /bin/mv)
AC_PATH_PROG(TAR, tar, /bin/tar)
AC_PATH_PROG(HELP2MAN, help2man)
AC_PATH_PROG(MAN2HTML, man2html)
dnl Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS([stdio.h])
AC_CHECK_HEADERS([stdlib.h])
AC_CHECK_HEADERS([string.h])
AC_CHECK_HEADERS([ctype.h])
AC_CHECK_HEADERS([errno.h])
AC_CHECK_HEADERS([ansidecl.h])
AC_CHECK_HEADERS([time.h])
AC_CHECK_FUNCS(strchr strrchr printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscanf timegm)
XMLSEC_DEFINES=""
dnl ==========================================================================
dnl Specific setup for Aleksey's development environment:
dnl - with debug
dnl - with pedantic compiler flags
dnl - with static binaries
dnl - without dynamic xmlsec-crypto loading
dnl ==========================================================================
AC_MSG_CHECKING(for development environment)
AC_ARG_ENABLE(development, [ --enable-development enable development environment (no)])
if test "z$enable_development" = "zyes" ; then
enable_debugging="yes"
enable_pedantic="yes"
enable_static_linking="yes"
enable_crypto_dl="no"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl ==========================================================================
dnl Perform host specific configuration
dnl ==========================================================================
XMLSEC_EXTRA_LDFLAGS=
XMLSEC_CRYPTO_EXTRA_LDFLAGS=
dnl should separate extra LDFLAGS for xmlsec and crypto libs ?
dnl should --enable-runtime-pseudo-reloc for mingw and cygwin ?
xmlsec_sharedlib_hack="no"
if test -n "$shrext"; then
XMLSEC_SHLIBSFX="$shrext"
else
dnl changed in libtool (between 1.5.2 and 1.5.14)
XMLSEC_SHLIBSFX="$shrext_cmds"
fi
case "${host}" in
*aix* )
CFLAGS="${CFLAGS} -D_ALL_SOURCE"
;;
*-*-mingw*)
dnl use libtool flags "-avoid-version" to create shared
dnl libraries without version suffix, i.e. libxmlsec1.dll
dnl instead libxmlsec1-NN.dll, where NN is a number.
XMLSEC_EXTRA_LDFLAGS="-no-undefined -avoid-version"
XMLSEC_CRYPTO_EXTRA_LDFLAGS="-no-undefined -avoid-version"
XMLSEC_SHLIBSFX=".dll.a"
xmlsec_sharedlib_hack="yes"
;;
*-*-cygwin*)
XMLSEC_EXTRA_LDFLAGS="-no-undefined"
XMLSEC_CRYPTO_EXTRA_LDFLAGS="-no-undefined"
;;
esac
# To avoid problem with loading of a shared library (dlopen or equivalent)
# at run time on some platforms we need to link crypto modules with extra
# source. It's work without hack on 9x and under emulation.
# On nt 5.x (w2k,xp) the error is 998("Invalid access to memory location").
AM_CONDITIONAL(SHAREDLIB_HACK, [test "z$xmlsec_sharedlib_hack" = "zyes"])
dnl ==========================================================================
dnl Hack for autoconf version mismatch
dnl ==========================================================================
if test "z$shrext" == "z" ; then
shrext=$shrext_cmds
fi
dnl ==========================================================================
dnl Check for __FUNCTION__ or __FUNCTION__
dnl ==========================================================================
AC_MSG_CHECKING(for __FUNCTION__ or __func__)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
[[char *foo = __FUNCTION__;]])],
[ac_function_exists=yes],
[ac_function_exists=no])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
[[char *foo = __func__;]])],
[ac_func_exists=yes],
[ac_func_exists=no])
if test "z$ac_function_exists" = "zyes" ; then
AC_MSG_RESULT(__FUNCTION__)
XMLSEC_DEFINES="$XMLSEC_DEFINES -D__XMLSEC_FUNCTION__=__FUNCTION__"
elif test "z$ac_func_exists" = "zyes" ; then
AC_MSG_RESULT(__func__)
XMLSEC_DEFINES="$XMLSEC_DEFINES -D__XMLSEC_FUNCTION__=__func__"
else
AC_MSG_RESULT("no")
fi
dnl ==========================================================================
dnl check do we have size_t and its size,
dnl TODO: will need to replace this and the xmlSecSize define with
dnl typedef on next ABI refresh
dnl ==========================================================================
AC_CHECK_SIZEOF(size_t)
if test "$ac_cv_sizeof_size_t" -ne "4" ; then
XMLSEC_DEFINES="$XMLSEC_DEFINES -DXMLSEC_NO_SIZE_T"
fi
dnl ==========================================================================
dnl Check if pkg-config enabled and installed
dnl ==========================================================================
PKG_CONFIG="pkg-config"
PKGCONFIG_FOUND="no"
AC_ARG_ENABLE(pkgconfig, [ --enable-pkgconfig enable pkgconfig for configuration (yes)])
if test "z$enable_pkgconfig" != "zno" ; then
AC_CHECK_PROG(PKGCONFIG_PRESENT, $PKG_CONFIG, yes, no)
if test "z$PKGCONFIG_PRESENT" = "zyes" ; then
if $PKG_CONFIG --atleast-pkgconfig-version 0.9 ; then
PKGCONFIG_FOUND="yes"
fi
fi
fi
dnl ==========================================================================
dnl find libxml
dnl ==========================================================================
LIBXML_MIN_VERSION="2.7.4"
LIBXML_CONFIG="xml2-config"
LIBXML_CFLAGS=""
LIBXML_LIBS=""
LIBXML_FOUND="no"
AC_ARG_WITH(libxml,
[ --with-libxml=[PFX] libxml2 location]
)
AC_ARG_WITH(libxml-src,
[ --with-libxml-src=[PFX] not installed yet libxml2 location]
)
if test "z$with_libxml" = "zno" -o "z$with_libxml_src" = "zno"; then
AC_MSG_CHECKING(for libxml2 libraries >= $LIBXML_MIN_VERSION)
AC_MSG_ERROR(libxml2 >= $LIBXML_MIN_VERSION is required for $XMLSEC_PACKAGE)
elif test "z$with_libxml_src" != "z" ; then
AC_MSG_CHECKING(for libxml2 libraries >= $LIBXML_MIN_VERSION)
CWD=`pwd`
if cd "$with_libxml_src" ; then
SRC_DIR=`pwd`
LIBXML_CONFIG=${SRC_DIR}/xml2-config
LIBXML_LIBS="-L${SRC_DIR}/.libs -lxml2"
LIBXML_CFLAGS="-I${SRC_DIR}/include"
LIBXML_FOUND="yes"
cd $CWD
AC_MSG_RESULT([yes (source)])
else
AC_MSG_ERROR([libxml source dir not found (${with_libxml_src}), typo?])
fi
elif test "z$with_libxml" = "z" -a "z$PKGCONFIG_FOUND" = "zyes" ; then
PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= $LIBXML_MIN_VERSION,
[LIBXML_FOUND=yes],
[LIBXML_FOUND=no])
fi
if test "z$LIBXML_FOUND" = "zno" ; then
if test "z$with_libxml" != "zyes" ; then
if test "z$with_libxml" != "z" ; then
AC_PATH_PROG([LIBXML_CONFIG], [$LIBXML_CONFIG], [],
[$with_libxml/bin:$PATH])
else
AC_PATH_PROG([LIBXML_CONFIG], [$LIBXML_CONFIG], [],
[$PATH])
fi
fi
AC_MSG_CHECKING([libxml2 $LIBXML_CONFIG ])
if ! LIBXML_VERSION=`$LIBXML_CONFIG --version 2>/dev/null`; then
AC_MSG_ERROR(Could not find libxml2 anywhere.)
fi
vers=`echo $LIBXML_VERSION | awk -F. '{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
minvers=`echo $LIBXML_MIN_VERSION | awk -F. '{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
if test "$vers" -ge "$minvers" ; then
LIBXML_LIBS="`$LIBXML_CONFIG --libs`"
LIBXML_CFLAGS="`$LIBXML_CONFIG --cflags`"
LIBXML_FOUND="yes"
AC_MSG_RESULT([yes ('$LIBXML_VERSION')])
else
AC_MSG_ERROR(You need at least libxml2 $LIBXML_MIN_VERSION for this version of $XMLSEC_PACKAGE)
fi
fi
AC_SUBST(LIBXML_CFLAGS)
AC_SUBST(LIBXML_LIBS)
AC_SUBST(LIBXML_CONFIG)
AC_SUBST(LIBXML_MIN_VERSION)
dnl ==========================================================================
dnl find libxslt
dnl ==========================================================================
XMLSEC_NO_LIBXSLT="1"
LIBXSLT_MIN_VERSION=1.0.20
LIBXSLT_CONFIG="xslt-config"
LIBXSLT_CFLAGS=""
LIBXSLT_LIBS=""
LIBXSLT_FOUND="no"
AC_ARG_WITH(libxslt,
[ --with-libxslt=[PFX] libxslt location]
)
AC_ARG_WITH(libxslt-src,
[ --with-libxslt-src=[PFX] not installed yet libxslt location]
)
if test "z$with_libxslt" = "zno" -o "z$with_libxslt_src" = "zno" ; then
AC_MSG_CHECKING(for libxslt libraries >= $LIBXSLT_MIN_VERSION)
AC_MSG_RESULT(no)
LIBXSLT_FOUND="without"
elif test "z$with_libxslt_src" != "z" ; then
AC_MSG_CHECKING(for libxslt libraries >= $LIBXSLT_MIN_VERSION)
CWD=`pwd`
if cd "$with_libxslt_src" ; then
SRC_DIR=`pwd`
LIBXSLT_CONFIG=${SRC_DIR}/xslt-config
LIBXSLT_LIBS="-L${SRC_DIR}/libxslt/.libs -lxslt"
LIBXSLT_CFLAGS="-I${SRC_DIR}"
LIBXSLT_FOUND="yes"
cd $CWD
AC_MSG_RESULT([yes (source)])
else
AC_MSG_ERROR([libxslt source dir not found (${with_libxslt_src}), typo?])
fi
elif test "z$with_libxslt" = "z" -a "z$PKGCONFIG_FOUND" = "zyes" ; then
PKG_CHECK_MODULES(LIBXSLT, libxslt >= $LIBXSLT_MIN_VERSION,
[LIBXSLT_FOUND=yes],
[LIBXSLT_FOUND=no])
fi
if test "z$LIBXSLT_FOUND" = "zno" ; then
if test "z$with_libxslt" != "zyes" ; then
if test "z$with_libxslt" != "z" ; then
AC_PATH_PROG([LIBXSLT_CONFIG], [$LIBXSLT_CONFIG], [],
[$with_libxslt/bin:$PATH])
else
AC_PATH_PROG([LIBXSLT_CONFIG], [$LIBXSLT_CONFIG], [],
[$PATH])
fi
fi
AC_MSG_CHECKING(for libxslt libraries >= $LIBXSLT_MIN_VERSION)
if ! LIBXSLT_VERSION=`$LIBXSLT_CONFIG --version 2>/dev/null`; then
if test "z$with_libxslt" != "zyes" ; then
AC_MSG_ERROR(Unable to find libxslt at '$with_libxslt')
else
AC_MSG_RESULT(no)
fi
else
vers=`echo $LIBXSLT_VERSION | awk -F. '{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
minvers=`echo $LIBXSLT_MIN_VERSION | awk -F. '{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
if test "$vers" -ge "$minvers" ; then
LIBXSLT_LIBS="`$LIBXSLT_CONFIG --libs`"
LIBXSLT_CFLAGS="`$LIBXSLT_CONFIG --cflags`"
LIBXSLT_FOUND="yes"
AC_MSG_RESULT([yes ('$LIBXSLT_VERSION')])
else
AC_MSG_ERROR(You need at least libxslt $LIBXSLT_MIN_VERSION for this version of $XMLSEC_PACKAGE)
fi
fi
fi
if test "z$LIBXSLT_FOUND" = "zyes" ; then
XMLSEC_NO_LIBXSLT="0"
else
XMLSEC_DEFINES="$XMLSEC_DEFINES -DXMLSEC_NO_XSLT=1"
fi
AC_SUBST(XMLSEC_NO_LIBXSLT)
AC_SUBST(LIBXSLT_CFLAGS)
AC_SUBST(LIBXSLT_LIBS)
AC_SUBST(LIBXSLT_CONFIG)
AC_SUBST(LIBXSLT_MIN_VERSION)
dnl ==========================================================================
dnl See if we can find a crypto library
dnl ==========================================================================
XMLSEC_CRYPTO_LIST=""
XMLSEC_CRYPTO_DISABLED_LIST=""
dnl ==========================================================================
dnl OpenSSL
dnl ==========================================================================
ac_openssl_lib_dir="/usr/local/lib /usr/lib /usr/lib64 /usr/local /usr/local/ssl /usr/local/ssl/lib /usr/pkg"
ac_openssl_inc_dir="/usr/local/include /usr/include /usr/local /usr/local/ssl /usr/pkg /usr/local/ssl/include"
XMLSEC_NO_OPENSSL="1"
OPENSSL_MIN_VERSION="0.9.6"
OPENSSL_VERSION=""
OPENSSL_CFLAGS=""
OPENSSL_LIBS=""
OPENSSL_CRYPTO_LIB="$XMLSEC_PACKAGE-openssl"
OPENSSL_FOUND=no
AC_ARG_WITH(openssl, [ --with-openssl=[PFX] openssl location])
if test "z$with_openssl" = "zno" ; then
OPENSSL_FOUND=without
AC_MSG_CHECKING(for openssl libraries >= $OPENSSL_MIN_VERSION)
AC_MSG_RESULT(no)
elif test "z$with_openssl" != "z" ; then
case $host in
*-*-mingw*) openssl_exlibs=;;
*-*-osf5*) openssl_exlibs=;;
*-*-openbsd*) openssl_exlibs=;;
*-*-netbsd*) openssl_exlibs=;;
#FIXME: check if lib "dl" is required
*) openssl_exlibs=-ldl;;
esac
OPENSSL_CFLAGS="$OPENSSL_CFLAGS -I$with_openssl/include"
if test -f "$with_openssl/lib/libcrypto${XMLSEC_SHLIBSFX}" ; then
OPENSSL_LIBS="-L$with_openssl/lib -lcrypto $openssl_exlibs"
else
OPENSSL_LIBS="$with_openssl/lib/libcrypto.a $openssl_exlibs"
fi
OPENSSL_FOUND="yes"
elif test "z$PKGCONFIG_FOUND" = "zyes" ; then
if test "z$OPENSSL_VERSION" = "z" ; then
PKG_CHECK_MODULES(OPENSSL, openssl >= 1.0.0,
[OPENSSL_VERSION="1.0.0"],
[OPENSSL_VERSION=""])
fi
if test "z$OPENSSL_VERSION" = "z" ; then
PKG_CHECK_MODULES(OPENSSL, openssl >= 0.9.8,
[OPENSSL_VERSION="0.9.8"],
[OPENSSL_VERSION=""])
fi
if test "z$OPENSSL_VERSION" = "z" ; then
PKG_CHECK_MODULES(OPENSSL, openssl >= 0.9.7,
[OPENSSL_VERSION="0.9.7"],
[OPENSSL_VERSION=""])
fi
if test "z$OPENSSL_VERSION" = "z" ; then
PKG_CHECK_MODULES(OPENSSL, openssl >= $OPENSSL_MIN_VERSION,
[OPENSSL_VERSION="$OPENSSL_MIN_VERSION"],
[OPENSSL_VERSION=""])
fi
if test "z$OPENSSL_VERSION" != "z" ; then
OPENSSL_FOUND="yes"
fi
fi
if test "z$OPENSSL_FOUND" = "zno" ; then
OPENSSL_INCLUDES_FOUND="no"
OPENSSL_LIBS_FOUND="no"
for dir in $ac_openssl_inc_dir ; do
if test -f $dir/openssl/ssl.h ; then
dnl do not add -I/usr/include because compiler does it anyway
if test "z$dir" = "z/usr/include" ; then
OPENSSL_CFLAGS="$OPENSSL_CFLAGS "
else
OPENSSL_CFLAGS="$OPENSSL_CFLAGS -I$dir"
fi
OPENSSL_INCLUDES_FOUND="yes"
break
fi
done
for dir in $ac_openssl_lib_dir ; do
if test -f $dir/libcrypto.a ; then
dnl do not add -L/usr/lib because compiler does it anyway
if test "z$dir" = "z/usr/lib" ; then
OPENSSL_LIBS="-lcrypto -ldl"
else
OPENSSL_LIBS="-L$dir -lcrypto -ldl"
fi
OPENSSL_LIBS_FOUND="yes"
ac_found_openssl_lib_dir=$dir
break;
fi
done
if test "z$OPENSSL_INCLUDES_FOUND" = "zyes" -a "z$OPENSSL_LIBS_FOUND" = "zyes" ; then
OPENSSL_FOUND="yes"
fi
fi
if test "z$OPENSSL_FOUND" = "zyes" -a "z$OPENSSL_VERSION" = "z" ; then
AC_MSG_CHECKING(for openssl libraries >= $OPENSSL_MIN_VERSION)
dnl Check the OpenSSL version
OLD_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$OPENSSL_CFLAGS"
if test "z$OPENSSL_VERSION" = "z" ; then
AC_EGREP_CPP(yes,[
#include <openssl/opensslv.h>
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
yes
#endif
],[
OPENSSL_VERSION="1.0.0"
],[
OPENSSL_VERSION=""
])
fi
if test "z$OPENSSL_VERSION" = "z" ; then
AC_EGREP_CPP(yes,[
#include <openssl/opensslv.h>
#if OPENSSL_VERSION_NUMBER >= 0x00908000L
yes
#endif
],[
OPENSSL_VERSION="0.9.8"
],[
OPENSSL_VERSION=""
])
fi
if test "z$OPENSSL_VERSION" = "z" ; then
AC_EGREP_CPP(yes,[
#include <openssl/opensslv.h>
#if OPENSSL_VERSION_NUMBER >= 0x00907000L
yes
#endif
],[
OPENSSL_VERSION="0.9.7"
],[
OPENSSL_VERSION=""
])
fi
if test "z$OPENSSL_VERSION" = "z" ; then
AC_EGREP_CPP(yes,[
#include <openssl/opensslv.h>
#if OPENSSL_VERSION_NUMBER >= 0x00906000L
yes
#endif
],[
OPENSSL_VERSION="0.9.6"
],[
OPENSSL_VERSION=""
])
fi
if test "z$OPENSSL_VERSION" = "z" ; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT([yes ('$OPENSSL_VERSION')])
fi
CPPFLAGS=$OLD_CPPFLAGS
fi
if test "z$OPENSSL_FOUND" = "zyes" ; then
XMLSEC_NO_OPENSSL="0"
if test "z$OPENSSL_VERSION" = "z0.9.6" ; then
OPENSSL_CFLAGS="$OPENSSL_CFLAGS -DXMLSEC_OPENSSL_096=1 -DXMLSEC_NO_ECDSA=1"
fi
if test "z$OPENSSL_VERSION" = "z0.9.7" ; then
OPENSSL_CFLAGS="$OPENSSL_CFLAGS -DXMLSEC_OPENSSL_097=1 -DXMLSEC_NO_ECDSA=1"
fi
if test "z$OPENSSL_VERSION" = "z0.9.8" ; then
OPENSSL_CFLAGS="$OPENSSL_CFLAGS -DXMLSEC_OPENSSL_098=1 -DXMLSEC_NO_ECDSA=1"
fi
if test "z$OPENSSL_VERSION" = "z1.0.0" ; then
OPENSSL_CFLAGS="$OPENSSL_CFLAGS -DXMLSEC_OPENSSL_100=1"
fi
OPENSSL_CFLAGS="$OPENSSL_CFLAGS -DXMLSEC_CRYPTO_OPENSSL=1"
XMLSEC_CRYPTO_LIST="$XMLSEC_CRYPTO_LIST openssl"
else
XMLSEC_CRYPTO_DISABLED_LIST="$XMLSEC_CRYPTO_DISABLED_LIST openssl"
fi
AM_CONDITIONAL(XMLSEC_NO_OPENSSL, test "z$XMLSEC_NO_OPENSSL" == "z1")
AC_SUBST(XMLSEC_NO_OPENSSL)
AC_SUBST(OPENSSL_CFLAGS)
AC_SUBST(OPENSSL_LIBS)
AC_SUBST(OPENSSL_CRYPTO_LIB)
AC_SUBST(OPENSSL_MIN_VERSION)
dnl ==========================================================================
dnl See if we can find NSS and NSPR
dnl Allow the use of:
dnl 1. Mozilla style distribution where all mozilla components (NSS, NSPR
dnl are just 2 of over 100 components) are under one directory.
dnl options: [--with-mozilla-ver=<VERSION>]
dnl
dnl Using the version number, various directories are searched
dnl for NSS & NSPR
dnl
dnl AND / OR
dnl
dnl 2. separate NSS & NSPR distributions
dnl options: [--with-nss=<PFX>] [--with-nspr=<PFX>]
dnl
dnl 2 overrides 1
dnl
dnl ==========================================================================
XMLSEC_NO_NSS="1"
SEAMONKEY_MIN_VERSION="1.0"
MOZILLA_MIN_VERSION="1.4"
NSS_MIN_VERSION="3.9"
NSPR_MIN_VERSION="4.4.1"
NSS_CFLAGS=""
NSS_LIBS=""
NSS_LIBS_LIST="-lnss3 -lsmime3"
NSPR_LIBS_LIST="-lnspr4 -lplds4 -lplc4"
NSS_CRYPTO_LIB="$XMLSEC_PACKAGE-nss"
NSS_FOUND="no"
NSPR_PACKAGE=mozilla-nspr
NSS_PACKAGE=mozilla-nss
dnl if nss is disabled, bail out early
AC_ARG_WITH(nss, [ --with-nss=[PFX] nss location])
AC_ARG_WITH(nspr, [ --with-nspr=[PFX] nspr location (needed for NSS)])
AC_ARG_WITH(seamonkey_ver, [ --with-seamonkey-ver=[VER] mozilla version (alt to --with-nss, --with-nspr)])
AC_ARG_WITH(mozilla_ver, [ --with-mozilla-ver=[VER] mozilla version (alt to --with-nss, --with-nspr)])
if test "z$with_nss" = "zno" -o "z$with_nspr" = "zno" ; then
AC_MSG_CHECKING(for NSS libraries)
AC_MSG_RESULT(no)
NSS_FOUND="without"
elif test "z$with_nss" = "z" -a "z$with_nspr" = "z" -a "z$with_mozilla_ver" = "z" -a "z$with_seamonkey_ver" = "z" -a "z$PKGCONFIG_FOUND" = "zyes" ; then
dnl
dnl Mozilla's NSS/NSPR are distributed under different names
dnl in different distribution:
dnl seamonkey-nspr and seamonkey-nss
dnl mozilla-nspr and mozilla-nss
dnl xulrunner-nspr and xulrunner-nss
dnl nspr and nss
dnl We are going to try all options
dnl
if test "z$NSS_FOUND" = "zno" ; then
PKG_CHECK_MODULES(NSS, seamonkey-nspr >= $NSPR_MIN_VERSION seamonkey-nss >= $SEAMONKEY_MIN_VERSION,
[NSS_FOUND=yes NSPR_PACKAGE=seamonkey-nspr NSS_PACKAGE=seamonkey-nss],
[NSS_FOUND=no])
fi
if test "z$NSS_FOUND" = "zno" ; then
PKG_CHECK_MODULES(NSS, mozilla-nspr >= $MOZILLA_MIN_VERSION mozilla-nss >= $MOZILLA_MIN_VERSION,
[NSS_FOUND=yes NSPR_PACKAGE=mozilla-nspr NSS_PACKAGE=mozilla-nss],
[NSS_FOUND=no])
fi
if test "z$NSS_FOUND" = "zno" ; then
PKG_CHECK_MODULES(NSS, xulrunner-nspr >= $NSPR_MIN_VERSION xulrunner-nss >= $NSS_MIN_VERSION,
[NSS_FOUND=yes NSPR_PACKAGE=xulrunner-nspr NSS_PACKAGE=xulrunner-nss],
[NSS_FOUND=no])
fi
if test "z$NSS_FOUND" = "zno" ; then
PKG_CHECK_MODULES(NSS, nspr >= $NSPR_MIN_VERSION nss >= $NSS_MIN_VERSION,
[NSS_FOUND=yes NSPR_PACKAGE=nspr NSS_PACKAGE=nss],
[NSS_FOUND=no])
fi
fi
if test "z$NSS_FOUND" = "zno" ; then
dnl process the mozilla options if any
if test "z$with_seamonkey_ver" != "z" ; then
ac_mozilla_name=seamonkey-$with_seamonkey_ver
elif test "z$with_mozilla_ver" != "z" ; then
ac_mozilla_name=mozilla-$with_mozilla_ver
else
ac_mozilla_name=mozilla-$MOZILLA_MIN_VERSION
fi
ac_nss_lib_dir="/usr/lib /usr/lib64 /usr/local/lib /usr/lib/$ac_mozilla_name /usr/local/lib/$ac_mozilla_name"
ac_nss_inc_dir="/usr/include /usr/include/mozilla /usr/local/include /usr/local/include/mozilla /usr/include/$ac_mozilla_name /usr/local/include/$ac_mozilla_name"
AC_MSG_CHECKING(for nspr libraries >= $NSPR_MIN_VERSION)
NSPR_INCLUDES_FOUND="no"
NSPR_LIBS_FOUND="no"
NSPR_FOUND="no"
NSPR_PRINIT_H=""
if test "z$with_nspr" != "z" ; then
NSPR_PREFIX="$with_nspr"
NSPR_CFLAGS="-I$with_nspr/include -I$with_nspr/include/nspr"
if test "z$with_gnu_ld" = "zyes" ; then
NSPR_LIBS="-Wl,-rpath-link -Wl,$with_nspr/lib -L$with_nspr/lib $NSPR_LIBS_LIST"
else
NSPR_LIBS="-L$with_nspr/lib $NSPR_LIBS_LIST"
fi
NSPR_INCLUDES_FOUND="yes"
NSPR_LIBS_FOUND="yes"
NSPR_PRINIT_H="$with_nspr/include/prinit.h"
else
for dir in $ac_nss_inc_dir ; do
if test -f $dir/nspr/prinit.h ; then
dnl do not add -I/usr/include because compiler does it anyway
if test "z$dir" = "z/usr/include" ; then
NSPR_CFLAGS=""
else
NSPR_CFLAGS="-I$dir/nspr"
fi
NSPR_INCLUDES_FOUND="yes"
NSPR_PRINIT_H="$dir/nspr/prinit.h"
break
fi
done
for dir in $ac_nss_lib_dir ; do
if test -f $dir/libnspr4$shrext ; then
dnl do not add -L/usr/lib because compiler does it anyway
if test "z$dir" = "z/usr/lib" ; then
NSPR_LIBS="$NSPR_LIBS_LIST"
else
if test "z$with_gnu_ld" = "zyes" ; then
NSPR_LIBS="-Wl,-rpath-link -Wl,$dir -L$dir $NSPR_LIBS_LIST"
else
NSPR_LIBS="-L$dir $NSPR_LIBS_LIST"
fi
fi
NSPR_LIBS_FOUND="yes"
break
fi
done
fi
if test "z$NSPR_INCLUDES_FOUND" = "zyes" -a "z$NSPR_LIBS_FOUND" = "zyes" ; then
OLD_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$NSPR_CFLAGS"
AC_EGREP_CPP(yes,[
#include <prinit.h>
#if PR_VMAJOR >= 4
yes
#endif
],[
NSPR_FOUND=yes
],[
NSPR_FOUND=no
])
CPPFLAGS="$OLD_CPPFLAGS"
fi
if test "z$NSPR_FOUND" = "zyes" ; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl look for nss
AC_MSG_CHECKING(for nss libraries >= $NSS_MIN_VERSION)
NSS_INCLUDES_FOUND="no"
NSS_LIBS_FOUND="no"
NSS_NSS_H=""
if test "z$with_nss" != "z" ; then
NSS_CFLAGS="$NSS_CFLAGS -I$with_nss/include -I$with_nss/include/nss"
if test "z$with_gnu_ld" = "zyes" ; then
NSS_LIBS="$NSS_LIBS -Wl,-rpath-link -Wl,$with_nss/lib -L$with_nss/lib $NSS_LIBS_LIST"
else
NSS_LIBS="$NSS_LIBS -L$with_nss/lib $NSS_LIBS_LIST"
fi
NSS_INCLUDES_FOUND="yes"
NSS_LIBS_FOUND="yes"
NSS_NSS_H="$with_nss/include/nss.h"
else
for dir in $ac_nss_inc_dir ; do
if test -f $dir/nss/nss.h ; then
dnl do not add -I/usr/include because compiler does it anyway
if test "z$dir" = "z/usr/include" ; then
NSS_CFLAGS="$NSS_CFLAGS"
else
NSS_CFLAGS="$NSS_CFLAGS -I$dir/nss"
fi
NSS_INCLUDES_FOUND="yes"
NSS_NSS_H="$dir/nss/nss.h"
break
fi
done
for dir in $ac_nss_lib_dir ; do
if test -f $dir/libnss3$shrext ; then
dnl do not add -L/usr/lib because compiler does it anyway
if test "z$dir" = "z/usr/lib" ; then
NSS_LIBS="$NSS_LIBS_LIST"
else
if test "z$with_gnu_ld" = "zyes" ; then
NSS_LIBS="-Wl,-rpath-link -Wl,$dir -L$dir $NSS_LIBS_LIST"
else
NSS_LIBS="-L$dir $NSS_LIBS_LIST"
fi
fi
NSS_LIBS_FOUND="yes"
break
fi
done
fi
if test "z$NSS_INCLUDES_FOUND" = "zyes" -a "z$NSS_LIBS_FOUND" = "zyes" ; then
OLD_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$NSS_CFLAGS"
AC_EGREP_CPP(yes,[
#include <nss.h>
#if NSS_VMAJOR >= 3 && NSS_VMINOR >= 2
yes
#endif
],[
NSS_FOUND=yes
],[
NSS_FOUND=no
])
CPPFLAGS="$OLD_CPPFLAGS"
fi
if test "z$NSS_FOUND" = "zyes" ; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl check that we have found both NSS and NSPR
if test "z$NSPR_FOUND" = "zyes" -a "z$NSS_FOUND" = "zyes" ; then
NSS_CFLAGS="$NSS_CFLAGS $NSPR_CFLAGS"
NSS_LIBS="$NSS_LIBS $NSPR_LIBS"
elif test "z$NSPR_FOUND" != "zyes" -a "z$NSS_FOUND" = "zyes" ; then
NSS_FOUND="no"
AC_MSG_RESULT(NSPR library is required for NSS, ignoring NSS library we have found)
fi
fi
if test "z$NSS_FOUND" = "zyes" ; then
XMLSEC_NO_NSS="0"
NSS_CFLAGS="$NSS_CFLAGS -DXMLSEC_CRYPTO_NSS=1"
XMLSEC_CRYPTO_LIST="$XMLSEC_CRYPTO_LIST nss"
else
XMLSEC_CRYPTO_DISABLED_LIST="$XMLSEC_CRYPTO_DISABLED_LIST nss"
fi
AM_CONDITIONAL(XMLSEC_NO_NSS, test "z$XMLSEC_NO_NSS" = "z1")
AC_SUBST(XMLSEC_NO_NSS)
AC_SUBST(NSPR_PACKAGE)
AC_SUBST(NSS_PACKAGE)
AC_SUBST(NSS_CFLAGS)
AC_SUBST(NSS_LIBS)
AC_SUBST(NSS_CRYPTO_LIB)
AC_SUBST(NSS_MIN_VERSION)
AC_SUBST(NSPR_MIN_VERSION)
AC_SUBST(MOZILLA_MIN_VERSION)
dnl ==========================================================================
dnl See if we can find GCrypt
dnl ==========================================================================
GCRYPT_CONFIG="libgcrypt-config"
XMLSEC_NO_GCRYPT="1"
GCRYPT_MIN_VERSION="1.4.0"
GCRYPT_VERSION=""
GCRYPT_CFLAGS=""
GCRYPT_LIBS=""
GCRYPT_CRYPTO_LIB="$XMLSEC_PACKAGE-gcrypt"
GCRYPT_FOUND="no"
AC_ARG_WITH(gcrypt, [ --with-gcrypt=[PFX] gcrypt location])
if test "z$with_gcrypt" = "zno" ; then
AC_MSG_CHECKING(for gcrypt libraries >= $GCRYPT_MIN_VERSION)
AC_MSG_RESULT(no)
GCRYPT_FOUND="without"
elif test "z$with_gcrypt" = "z" -a "z$PKGCONFIG_FOUND" = "zyes" ; then
PKG_CHECK_MODULES(GCRYPT, gcrypt >= $GCRYPT_MIN_VERSION,
[GCRYPT_FOUND=yes],
[GCRYPT_FOUND=no])
if test "z$GCRYPT_FOUND" = "zno" ; then
PKG_CHECK_MODULES(GCRYPT, libgcrypt >= $GCRYPT_MIN_VERSION,
[GCRYPT_FOUND=yes],
[GCRYPT_FOUND=no])
fi
if test "z$GCRYPT_FOUND" = "zno" ; then
PKG_CHECK_MODULES(GCRYPT, libgcrypt11 >= $GCRYPT_MIN_VERSION,
[GCRYPT_FOUND=yes],
[GCRYPT_FOUND=no])
fi
fi
if test "z$GCRYPT_FOUND" = "zno" ; then
AC_MSG_CHECKING(for gcrypt libraries >= $GCRYPT_MIN_VERSION)
if test "z$with_gcrypt" != "z" ; then
GCRYPT_CONFIG=$with_gcrypt/bin/$GCRYPT_CONFIG
fi
if ! $GCRYPT_CONFIG --version > /dev/null 2>&1 ; then
if test "z$with_gcrypt" != "z" ; then
AC_MSG_ERROR(Unable to find gcrypt at '$with_gcrypt')
else
AC_MSG_RESULT(no)
fi
else
vers=`$GCRYPT_CONFIG --version | awk -F. '{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
minvers=`echo $GCRYPT_MIN_VERSION | awk -F. '{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
if test "$vers" -ge "$minvers" ; then
GCRYPT_CFLAGS="$GCRYPT_CFLAGS `$GCRYPT_CONFIG --cflags`"
GCRYPT_LIBS="$GCRYPT_LIBS `$GCRYPT_CONFIG --libs`"
GCRYPT_FOUND=yes
else
AC_MSG_ERROR(You need at least gcrypt $GCRYPT_MIN_VERSION for this version of $XMLSEC_PACKAGE)
fi
fi
fi
if test "z$GCRYPT_FOUND" = "zyes" ; then
XMLSEC_NO_GCRYPT="0"
GCRYPT_CFLAGS="$GCRYPT_CFLAGS -DXMLSEC_CRYPTO_GCRYPT=1"
XMLSEC_CRYPTO_LIST="$XMLSEC_CRYPTO_LIST gcrypt"
else
XMLSEC_CRYPTO_DISABLED_LIST="$XMLSEC_CRYPTO_DISABLED_LIST gcrypt"
fi
AM_CONDITIONAL(XMLSEC_NO_GCRYPT, test "z$XMLSEC_NO_GCRYPT" = "z1")
AC_SUBST(XMLSEC_NO_GCRYPT)
AC_SUBST(GCRYPT_CFLAGS)
AC_SUBST(GCRYPT_LIBS)
AC_SUBST(GCRYPT_CRYPTO_LIB)
AC_SUBST(GCRYPT_MIN_VERSION)
dnl ==========================================================================
dnl See if we can find GnuTLS
dnl ==========================================================================
GNUTLS_CONFIG="libgnutls-config"
XMLSEC_NO_GNUTLS="1"
GNUTLS_MIN_VERSION="2.8.0"
GNUTLS_VERSION=""
GNUTLS_CFLAGS=""
GNUTLS_LIBS=""
GNUTLS_CRYPTO_LIB="$XMLSEC_PACKAGE-gnutls"
GNUTLS_FOUND="no"
AC_ARG_WITH(gnutls, [ --with-gnutls=[PFX] gnutls location])
if test "z$with_gnutls" = "zno" ; then
AC_MSG_CHECKING(for gnutls libraries >= $GNUTLS_MIN_VERSION)
AC_MSG_RESULT(no)
GNUTLS_FOUND="without"
elif test "z$with_gnutls" = "z" -a "z$PKGCONFIG_FOUND" = "zyes" ; then
PKG_CHECK_MODULES(GNUTLS, gnutls >= $GNUTLS_MIN_VERSION,
[GNUTLS_FOUND=yes],
[GNUTLS_FOUND=no])
if test "z$GNUTLS_FOUND" = "zno" ; then
PKG_CHECK_MODULES(GNUTLS, libgnutls >= $GNUTLS_MIN_VERSION,
[GNUTLS_FOUND=yes],
[GNUTLS_FOUND=no])
fi
fi
if test "z$GNUTLS_FOUND" = "zno" ; then
AC_MSG_CHECKING(for gnutls libraries >= $GNUTLS_MIN_VERSION)
if test "z$with_gnutls" != "z" ; then
GNUTLS_CONFIG=$with_gnutls/bin/$GNUTLS_CONFIG
fi
if ! $GNUTLS_CONFIG --version > /dev/null 2>&1 ; then
if test "z$with_gnutls" != "z" ; then
AC_MSG_ERROR(Unable to find gnutls at '$with_gnutls')
else
AC_MSG_RESULT(no)
fi
else
vers=`$GNUTLS_CONFIG --version | awk -F. '{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
minvers=`echo $GNUTLS_MIN_VERSION | awk -F. '{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
if test "$vers" -ge "$minvers" ; then
GNUTLS_CFLAGS="$GNUTLS_CFLAGS `$GNUTLS_CONFIG --cflags`"
GNUTLS_LIBS="$GNUTLS_LIBS `$GNUTLS_CONFIG --libs`"
GNUTLS_FOUND=yes
else
AC_MSG_ERROR(You need at least gnutls $GNUTLS_MIN_VERSION for this version of $XMLSEC_PACKAGE)
fi
fi
fi
if test "z$GNUTLS_FOUND" = "zyes" ; then
XMLSEC_NO_GNUTLS="0"
GNUTLS_CFLAGS="$GNUTLS_CFLAGS -DXMLSEC_CRYPTO_GNUTLS=1"
XMLSEC_CRYPTO_LIST="$XMLSEC_CRYPTO_LIST gnutls"
dnl xmlsec-gnutls is using xmlsec-gcrypt
if test "z$GCRYPT_FOUND" != "zyes" ; then
AC_MSG_ERROR(xmlsec-gnutls library requires xmlsec-gcrypt library which is disabled or missing)
fi
else
XMLSEC_CRYPTO_DISABLED_LIST="$XMLSEC_CRYPTO_DISABLED_LIST gnutls"
fi
AM_CONDITIONAL(XMLSEC_NO_GNUTLS, test "z$XMLSEC_NO_GNUTLS" = "z1")
AC_SUBST(XMLSEC_NO_GNUTLS)
AC_SUBST(GNUTLS_CFLAGS)
AC_SUBST(GNUTLS_LIBS)
AC_SUBST(GNUTLS_CRYPTO_LIB)
AC_SUBST(GNUTLS_MIN_VERSION)
dnl ==========================================================================
dnl See if we can find MSCrypto
dnl ==========================================================================
XMLSEC_NO_MSCRYPTO="1"
MSCRYPTO_CFLAGS=""
MSCRYPTO_LIBS=""
MSCRYPTO_CRYPTO_LIB="$XMLSEC_PACKAGE-mscrypto"
MSCRYPTO_ENABLE='none'
AC_ARG_ENABLE(mscrypto,
[ --enable-mscrypto enable mscrypto (no)],
[MSCRYPTO_ENABLE=$enableval])
if test "z$MSCRYPTO_ENABLE" != "zyes" ; then
AC_MSG_CHECKING(for mscrypto libraries)
AC_MSG_RESULT([$MSCRYPTO_ENABLE])
else
dnl cannot detect __stdcall functions
dnl AC_CHECK_LIB(crypt32, CertOpenStore, ....
LIBS_SAVE="$LIBS"
LIBS="$LIBS -lcrypt32"
AC_MSG_CHECKING(for mscrypto libraries)
AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include <windows.h>
#include <wincrypt.h>],[
int main () { CertOpenStore(0,0,0,0,0);; return(0); }
])],
[],
[MSCRYPTO_ENABLE="no"])
AC_MSG_RESULT([$MSCRYPTO_ENABLE])
LIBS="$LIBS_SAVE"
fi
if test "z$MSCRYPTO_ENABLE" = "zyes" ; then
XMLSEC_NO_MSCRYPTO="0"
MSCRYPTO_CFLAGS="$MSCRYPTO_CFLAGS -DXMLSEC_CRYPTO_MSCRYPTO=1"
case $host in
*-*-mingw*)
dnl since mingw crypt32 library is limited
dnl we use own def-file
MSCRYPTO_LIBS='-Wl,$(srcdir)/mingw-crypt32.def';;
*)
MSCRYPTO_LIBS="-lcrypt32";;
esac
XMLSEC_CRYPTO_LIST="$XMLSEC_CRYPTO_LIST mscrypto"
else
XMLSEC_CRYPTO_DISABLED_LIST="$XMLSEC_CRYPTO_DISABLED_LIST mscrypto"
fi
AM_CONDITIONAL(XMLSEC_NO_MSCRYPTO, [test "z$XMLSEC_NO_MSCRYPTO" = "z1"])
AC_SUBST(XMLSEC_NO_MSCRYPTO)
AC_SUBST(MSCRYPTO_CFLAGS)
AC_SUBST(MSCRYPTO_LIBS)
AC_SUBST(MSCRYPTO_CRYPTO_LIB)
dnl ==========================================================================
dnl Figure out the default crypt - the first crypto library wins
dnl ==========================================================================
XMLSEC_CRYPTO=""
XMLSEC_CRYPTO_LIB=""
XMLSEC_CRYPTO_CFLAGS=""
XMLSEC_CRYPTO_LIBS=""
AC_MSG_CHECKING(for default crypto library)
AC_ARG_WITH(default_crypto, [ --with-default-crypto=name default crypto name])
# check the argument
case "z$with_default_crypto" in
'zmscrypto')
if test "z$XMLSEC_NO_MSCRYPTO" != "z1" ; then
XMLSEC_CRYPTO="mscrypto"
else
AC_MSG_ERROR('$with_default_crypto' is specified as default crypto library but it is not configured or found)
fi
;;
'zopenssl')
if test "z$XMLSEC_NO_OPENSSL" != "z1" ; then
XMLSEC_CRYPTO="openssl"
else
AC_MSG_ERROR('$with_default_crypto' is specified as default crypto library but it is not configured or found)
fi
;;
'znss')
if test "z$XMLSEC_NO_NSS" != "z1" ; then
XMLSEC_CRYPTO="nss"
else
AC_MSG_ERROR('$with_default_crypto' is specified as default crypto library but it is not configured or found)
fi
;;
'zgnutls')
if test "z$XMLSEC_NO_GNUTLS" != "z1" ; then
XMLSEC_CRYPTO="gnutls"
else
AC_MSG_ERROR('$with_default_crypto' is specified as default crypto library but it is not configured or found)
fi
;;
'zgcrypt')
if test "z$XMLSEC_NO_GCRYPT" != "z1" ; then
XMLSEC_CRYPTO="gcrypt"
else
AC_MSG_ERROR('$with_default_crypto' is specified as default crypto library but it is not configured or found)
fi
;;
'z')
dnl The first crypto library wins
if test "z$XMLSEC_NO_MSCRYPTO" != "z1" ; then
XMLSEC_CRYPTO="mscrypto"
elif test "z$XMLSEC_NO_OPENSSL" != "z1" ; then
XMLSEC_CRYPTO="openssl"
elif test "z$XMLSEC_NO_NSS" != "z1" ; then
XMLSEC_CRYPTO="nss"
elif test "z$XMLSEC_NO_GNUTLS" != "z1" ; then
XMLSEC_CRYPTO="gnutls"
elif test "z$XMLSEC_NO_GCRYPT" != "z1" ; then
XMLSEC_CRYPTO="gcrypt"
else
AC_MSG_ERROR(At least one crypto library should exist for $XMLSEC_PACKAGE)
fi
;;
*)
AC_MSG_ERROR(The value '$with_default_crypto' is not a recongnized crypto library name)
;;
esac
dnl Set the flags for default crypto lib
case "$XMLSEC_CRYPTO" in
'mscrypto')
XMLSEC_CRYPTO_LIB="$MSCRYPTO_CRYPTO_LIB"
XMLSEC_CRYPTO_CFLAGS="$MSCRYPTO_CFLAGS"
XMLSEC_CRYPTO_LIBS="$MSCRYPTO_LIBS"
;;
'openssl')
XMLSEC_CRYPTO_LIB="$OPENSSL_CRYPTO_LIB"
XMLSEC_CRYPTO_CFLAGS="$OPENSSL_CFLAGS"
XMLSEC_CRYPTO_LIBS="$OPENSSL_LIBS"
;;
'nss')
XMLSEC_CRYPTO_LIB="$NSS_CRYPTO_LIB"
XMLSEC_CRYPTO_CFLAGS="$NSS_CFLAGS"
XMLSEC_CRYPTO_LIBS="$NSS_LIBS"
;;
'gnutls')
XMLSEC_CRYPTO_LIB="$GNUTLS_CRYPTO_LIB"
XMLSEC_CRYPTO_CFLAGS="$GNUTLS_CFLAGS"
XMLSEC_CRYPTO_LIBS="$GNUTLS_LIBS"
;;
'gcrypt')
XMLSEC_CRYPTO_LIB="$GCRYPT_CRYPTO_LIB"
XMLSEC_CRYPTO_CFLAGS="$GCRYPT_CFLAGS"
XMLSEC_CRYPTO_LIBS="$GCRYPT_LIBS"
;;
*)
AC_MSG_ERROR(The value \"$XMLSEC_CRYPTO\" is not a recongnized crypto library name)
;;
esac
AC_MSG_RESULT(yes ('$XMLSEC_CRYPTO'))
dnl ==========================================================================
dnl See do we need MD5 support
dnl ==========================================================================
AC_MSG_CHECKING(for MD5 support)
AC_ARG_ENABLE(md5, [ --enable-md5 enable MD5 support (yes)])
if test "z$enable_md5" = "zno" ; then
XMLSEC_DEFINES="$XMLSEC_DEFINES -DXMLSEC_NO_MD5=1"
XMLSEC_NO_MD5="1"
AC_MSG_RESULT(no)
else
XMLSEC_NO_MD5="0"
AC_MSG_RESULT(yes)
fi
AM_CONDITIONAL(XMLSEC_NO_MD5, test "z$XMLSEC_NO_MD5" = "z1")
AC_SUBST(XMLSEC_NO_MD5)
dnl ==========================================================================
dnl See do we need RIPEMD-160 support
dnl ==========================================================================
AC_MSG_CHECKING(for RIPEMD-160 support)
AC_ARG_ENABLE(ripemd160, [ --enable-ripemd160 enable RIPEMD-160 support (yes)])
if test "z$enable_ripemd160" = "zno" ; then
XMLSEC_DEFINES="$XMLSEC_DEFINES -DXMLSEC_NO_RIPEMD160=1"
XMLSEC_NO_RIPEMD160="1"
AC_MSG_RESULT(no)
else
XMLSEC_NO_RIPEMD160="0"
AC_MSG_RESULT(yes)
fi
AM_CONDITIONAL(XMLSEC_NO_RIPEMD160, test "z$XMLSEC_NO_RIPEMD160" = "z1")
AC_SUBST(XMLSEC_NO_RIPEMD160)
dnl ==========================================================================
dnl See do we need SHA1 support
dnl ==========================================================================
AC_MSG_CHECKING(for SHA1 support)
AC_ARG_ENABLE(sha1, [ --enable-sha1 enable SHA1 support (yes)])
if test "z$enable_sha1" = "zno" ; then
XMLSEC_DEFINES="$XMLSEC_DEFINES -DXMLSEC_NO_SHA1=1"
XMLSEC_NO_SHA1="1"
AC_MSG_RESULT(no)
else
XMLSEC_NO_SHA1="0"
AC_MSG_RESULT(yes)
fi
AM_CONDITIONAL(XMLSEC_NO_SHA1, test "z$XMLSEC_NO_SHA1" = "z1")
AC_SUBST(XMLSEC_NO_SHA1)
dnl ==========================================================================
dnl See do we need SHA224 support
dnl ==========================================================================
AC_MSG_CHECKING(for SHA224 support)
AC_ARG_ENABLE(sha224, [ --enable-sha224 enable SHA224 support (yes)])
if test "z$enable_sha224" = "zno" ; then
XMLSEC_DEFINES="$XMLSEC_DEFINES -DXMLSEC_NO_SHA224=1"
XMLSEC_NO_SHA224="1"
AC_MSG_RESULT(no)
else
XMLSEC_NO_SHA224="0"
AC_MSG_RESULT(yes)
fi
AM_CONDITIONAL(XMLSEC_NO_SHA224, test "z$XMLSEC_NO_SHA224" = "z1")
AC_SUBST(XMLSEC_NO_SHA224)
dnl ==========================================================================
dnl See do we need SHA256 support
dnl ==========================================================================
AC_MSG_CHECKING(for SHA256 support)
AC_ARG_ENABLE(sha256, [ --enable-sha256 enable SHA256 support (yes)])
if test "z$enable_sha256" = "zno" ; then
XMLSEC_DEFINES="$XMLSEC_DEFINES -DXMLSEC_NO_SHA256=1"
XMLSEC_NO_SHA256="1"
AC_MSG_RESULT(no)
else
XMLSEC_NO_SHA256="0"
AC_MSG_RESULT(yes)
fi
AM_CONDITIONAL(XMLSEC_NO_SHA256, test "z$XMLSEC_NO_SHA256" = "z1")
AC_SUBST(XMLSEC_NO_SHA256)
dnl ==========================================================================
dnl See do we need SHA384 support
dnl ==========================================================================
AC_MSG_CHECKING(for SHA384 support)
AC_ARG_ENABLE(sha384, [ --enable-sha384 enable SHA384 support (yes)])
if test "z$enable_sha384" = "zno" ; then
XMLSEC_DEFINES="$XMLSEC_DEFINES -DXMLSEC_NO_SHA384=1"
XMLSEC_NO_SHA384="1"
AC_MSG_RESULT(no)
else
XMLSEC_NO_SHA384="0"
AC_MSG_RESULT(yes)
fi
AM_CONDITIONAL(XMLSEC_NO_SHA384, test "z$XMLSEC_NO_SHA384" = "z1")
AC_SUBST(XMLSEC_NO_SHA384)
dnl ==========================================================================
dnl See do we need SHA512 support
dnl ==========================================================================
AC_MSG_CHECKING(for SHA512 support)
AC_ARG_ENABLE(sha512, [ --enable-sha512 enable SHA512 support (yes)])
if test "z$enable_sha512" = "zno" ; then
XMLSEC_DEFINES="$XMLSEC_DEFINES -DXMLSEC_NO_SHA512=1"
XMLSEC_NO_SHA512="1"
AC_MSG_RESULT(no)
else
XMLSEC_NO_SHA512="0"
AC_MSG_RESULT(yes)
fi
AM_CONDITIONAL(XMLSEC_NO_SHA512, test "z$XMLSEC_NO_SHA512" = "z1")
AC_SUBST(XMLSEC_NO_SHA512)
dnl ==========================================================================
dnl See do we need HMAC support
dnl ==========================================================================
AC_MSG_CHECKING(for HMAC support)
AC_ARG_ENABLE(hmac, [ --enable-hmac enable HMAC support (yes)])
if test "z$enable_hmac" = "zno" ; then
XMLSEC_DEFINES="$XMLSEC_DEFINES -DXMLSEC_NO_HMAC=1"
XMLSEC_NO_HMAC="1"
AC_MSG_RESULT(no)
else
XMLSEC_NO_HMAC="0"
AC_MSG_RESULT(yes)
fi
AM_CONDITIONAL(XMLSEC_NO_HMAC, test "z$XMLSEC_NO_HMAC" = "z1")
AC_SUBST(XMLSEC_NO_HMAC)
dnl ==========================================================================
dnl See do we need DSA support
dnl ==========================================================================
AC_MSG_CHECKING(for DSA support)
AC_ARG_ENABLE(dsa, [ --enable-dsa enable DSA support (yes)])
if test "z$enable_dsa" = "zno" ; then
XMLSEC_DEFINES="$XMLSEC_DEFINES -DXMLSEC_NO_DSA=1"
XMLSEC_NO_DSA="1"
AC_MSG_RESULT(no)
else
XMLSEC_NO_DSA="0"
AC_MSG_RESULT(yes)
fi
AM_CONDITIONAL(XMLSEC_NO_DSA, test "z$XMLSEC_NO_DSA" = "z1")
AC_SUBST(XMLSEC_NO_DSA)
dnl ==========================================================================
dnl See do we need RSA support
dnl ==========================================================================
AC_MSG_CHECKING(for RSA support)
AC_ARG_ENABLE(rsa, [ --enable-rsa enable RSA support (yes)])
if test "z$enable_rsa" = "zno" ; then
XMLSEC_DEFINES="$XMLSEC_DEFINES -DXMLSEC_NO_RSA=1"
XMLSEC_NO_RSA="1"
AC_MSG_RESULT(no)
else
XMLSEC_NO_RSA="0"
AC_MSG_RESULT(yes)
fi
AM_CONDITIONAL(XMLSEC_NO_RSA, test "z$XMLSEC_NO_RSA" = "z1")
AC_SUBST(XMLSEC_NO_RSA)
dnl ==========================================================================
dnl See do we need x509 support
dnl ==========================================================================
AC_MSG_CHECKING(for x509 support)
AC_ARG_ENABLE(x509, [ --enable-x509 enable x509 support (yes)])
if test "z$enable_x509" = "zno" ; then
XMLSEC_DEFINES="$XMLSEC_DEFINES -DXMLSEC_NO_X509=1"
XMLSEC_NO_X509="1"
AC_MSG_RESULT(no)
else
XMLSEC_NO_X509="0"
AC_MSG_RESULT(yes)
fi
AM_CONDITIONAL(XMLSEC_NO_X509, test "z$XMLSEC_NO_X509" = "z1")
AC_SUBST(XMLSEC_NO_X509)
dnl ==========================================================================
dnl See do we need DES support
dnl ==========================================================================
AC_MSG_CHECKING(for DES support)
AC_ARG_ENABLE(des, [ --enable-des enable DES support (yes)])
if test "z$enable_des" = "zno" ; then
XMLSEC_DEFINES="$XMLSEC_DEFINES -DXMLSEC_NO_DES=1"
XMLSEC_NO_DES="1"
AC_MSG_RESULT(no)
else
XMLSEC_NO_DES="0"
AC_MSG_RESULT(yes)
fi
AM_CONDITIONAL(XMLSEC_NO_DES, test "z$XMLSEC_NO_DES" = "z1")
AC_SUBST(XMLSEC_NO_DES)
dnl ==========================================================================
dnl See do we need AES support
dnl ==========================================================================
AC_MSG_CHECKING(for AES support)
AC_ARG_ENABLE(aes, [ --enable-aes enable AES support (OpenSSL >= 0.9.7 is required)])
if test "z$enable_aes" = "zno" ; then
XMLSEC_DEFINES="$XMLSEC_DEFINES -DXMLSEC_NO_AES=1"
XMLSEC_NO_AES="1"
AC_MSG_RESULT(no)
else
XMLSEC_NO_AES="0"
AC_MSG_RESULT(yes)
fi
AM_CONDITIONAL(XMLSEC_NO_AES, test "z$XMLSEC_NO_AES" = "z1")
AC_SUBST(XMLSEC_NO_AES)
dnl ==========================================================================
dnl See do we need GOST support
dnl ==========================================================================
AC_MSG_CHECKING(for GOST support)
AC_ARG_ENABLE(gost, [ --enable-gost enable GOST support (no)])
if test "z$enable_gost" != "zyes" ; then
XMLSEC_DEFINES="$XMLSEC_DEFINES -DXMLSEC_NO_GOST=1"
XMLSEC_NO_GOST="1"
AC_MSG_RESULT(no)
else
XMLSEC_NO_GOST="0"
AC_MSG_RESULT(yes)
fi
AM_CONDITIONAL(XMLSEC_NO_GOST, test "z$XMLSEC_NO_GOST" = "z1")
AC_SUBST(XMLSEC_NO_GOST)
dnl ==========================================================================
dnl See do we need XMLDSig support
dnl ==========================================================================
AC_MSG_CHECKING(for XMLDSig support)
AC_ARG_ENABLE(xmldsig, [ --enable-xmldsig enable XMLDSig support (yes)])
if test "z$enable_xmldsig" = "zno" ; then
XMLSEC_DEFINES="$XMLSEC_DEFINES -DXMLSEC_NO_XMLDSIG=1"
XMLSEC_NO_XMLDSIG="1"
AC_MSG_RESULT(no)
else
XMLSEC_NO_XMLDSIG="0"
AC_MSG_RESULT(yes)
fi
AM_CONDITIONAL(XMLSEC_NO_XMLDSIG, test "z$XMLSEC_NO_XMLDSIG" = "z1")
AC_SUBST(XMLSEC_NO_XMLDSIG)
dnl ==========================================================================
dnl See do we need XMLEnc support
dnl ==========================================================================
AC_MSG_CHECKING(for XMLEnc support)
AC_ARG_ENABLE(xmlenc, [ --enable-xmlenc enable XMLEnc support (yes)])
if test "z$enable_xmlenc" = "zno" ; then
XMLSEC_DEFINES="$XMLSEC_DEFINES -DXMLSEC_NO_XMLENC=1"
XMLSEC_NO_XMLENC="1"
AC_MSG_RESULT(no)
else
XMLSEC_NO_XMLENC="0"
AC_MSG_RESULT(yes)
fi
AM_CONDITIONAL(XMLSEC_NO_XMLENC, test "z$XMLSEC_NO_XMLENC" = "z1")
AC_SUBST(XMLSEC_NO_XMLENC)
dnl ==========================================================================
dnl See do we need XKMS support
dnl ==========================================================================
AC_MSG_CHECKING(for XMKMS support - under development, not stable yet)
AC_ARG_ENABLE(xkms, [ --enable-xkms enable XKMS support - under development (no)])
if test "z$enable_xkms" = "zyes" ; then
XMLSEC_NO_XKMS="0"
AC_MSG_RESULT(yes)
else
XMLSEC_DEFINES="$XMLSEC_DEFINES -DXMLSEC_NO_XKMS=1"
XMLSEC_NO_XKMS="1"
AC_MSG_RESULT(no)
fi
AM_CONDITIONAL(XMLSEC_NO_XKMS, test "z$XMLSEC_NO_XKMS" = "z1")
AC_SUBST(XMLSEC_NO_XKMS)
dnl ==========================================================================
dnl check if we need dynamic loading support
dnl ==========================================================================
XMLSEC_DL_INCLUDES=""
XMLSEC_DL_LIBS=""
AC_MSG_CHECKING(for xmlsec-crypto dynamic loading support)
AC_ARG_ENABLE(crypto_dl, [ --enable-crypto-dl enable dynamic loading support for xmlsec-crypto libraries (yes)])
if test "z$enable_crypto_dl" = "zno" ; then
XMLSEC_DEFINES="$XMLSEC_DEFINES -DXMLSEC_NO_CRYPTO_DYNAMIC_LOADING=1"
XMLSEC_NO_CRYPTO_DYNAMIC_LOADING="1"
AC_MSG_RESULT(no)
else
AC_CHECK_HEADER([ltdl.h],
[
XMLSEC_DEFINES="$XMLSEC_DEFINES -DXMLSEC_DL_LIBLTDL=1"
AC_CHECK_LIB(
[ltdl],
[lt_dlopenext],
[LIBLTDL=-lltdl],
[LIBLTDL=]
)],
[LIBLTDL=]
)
if test "z$LIBLTDL" != "z" ; then
XMLSEC_DL_INCLUDES="$INCLTDL"
XMLSEC_DL_LIBS="$LIBLTDL"
XMLSEC_NO_CRYPTO_DYNAMIC_LOADING="0"
AC_MSG_RESULT(yes)
else
AC_MSG_ERROR([libltdl is required for xmlsec-crypto dynamic loading])
fi
fi
AM_CONDITIONAL(XMLSEC_NO_CRYPTO_DYNAMIC_LOADING, test "z$XMLSEC_NO_CRYPTO_DYNAMIC_LOADING" = "z1")
AC_SUBST(XMLSEC_NO_CRYPTO_DYNAMIC_LOADING)
AC_SUBST(XMLSEC_DL_INCLUDES)
AC_SUBST(XMLSEC_DL_LIBS)
dnl ==========================================================================
dnl check if we need dynamic loading in the xmlsec apps
dnl ==========================================================================
AC_MSG_CHECKING(for xmlsec-crypto dynamic loading support in command line tool)
AC_ARG_ENABLE(apps_crypto_dl, [ --enable-apps-crypto-dl enable dynamic loading support for xmlsec-crypto libraries in xmlsec command line tool (yes)])
if test "z$enable_apps_crypto_dl" = "z" ; then
enable_apps_crypto_dl="$enable_crypto_dl"
fi
if test "z$enable_apps_crypto_dl" = "zno" ; then
XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING="1"
AC_MSG_RESULT(no)
elif test "z$enable_crypto_dl" = "zno" ; then
AC_MSG_RESULT(no)
AC_MSG_ERROR(xmlsec-crypto libraries dynamic loading support in xmlsec command line tool is requested but no dynamic loading in xmlsec itself is disabled)
else
XMLSEC_APP_DEFINES="$XMLSEC_APP_DEFINES -DXMLSEC_CRYPTO_DYNAMIC_LOADING=1"
XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING="0"
AC_MSG_RESULT(yes)
fi
AM_CONDITIONAL(XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING,
test "z$XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING" = "z1")
AC_SUBST(XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING)
dnl ==========================================================================
dnl Where do we want to install docs
dnl ==========================================================================
AC_MSG_CHECKING(for docs folder)
AC_ARG_WITH(html-dir, [ --with-html-dir=PATH path to installed docs ])
if test "z$with_html_dir" != "z" ; then
XMLSEC_DOCDIR=$with_html_dir
else
XMLSEC_DOCDIR='$(datadir)/doc/xmlsec1'
fi
AC_MSG_RESULT($XMLSEC_DOCDIR)
AC_SUBST(XMLSEC_DOCDIR)
dnl ==========================================================================
dnl See do we need Simple Keys Manager
dnl ==========================================================================
AC_MSG_CHECKING(for Simple Keys Manager testing)
AC_ARG_ENABLE(skm, [ --enable-skm enable Simple Keys Manager testing (yes)])
if test "z$enable_skm" = "zno" ; then
XMLSEC_DEFINES="$XMLSEC_DEFINES -DXMLSEC_NO_SKM_TEST=1"
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
fi
dnl ==========================================================================
dnl See do we need templates tests
dnl ==========================================================================
AC_MSG_CHECKING(for templates testing)
AC_ARG_ENABLE(tmpl_tests, [ --enable-tmpl-tests enable templates testing in xmlsec utility (yes)])
if test "z$enable_tmpl_tests" = "zyes" ; then
XMLSEC_DEFINES="$XMLSEC_DEFINES -DXMLSEC_NO_TMPL_TEST=1"
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
fi
dnl ==========================================================================
dnl Debug
dnl ==========================================================================
AC_MSG_CHECKING(for debugging)
AC_ARG_ENABLE(debugging, [ --enable-debugging enable debugging compilation flags (no)])
if test "z$enable_debugging" = "zyes" ; then
CFLAGS="$CFLAGS -g"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl ==========================================================================
dnl Profiling
dnl ==========================================================================
AC_MSG_CHECKING(for profiling)
AC_ARG_ENABLE(profiling, [ --enable-profiling enable profiling compilation flags (no)])
if test "z$enable_profiling" = "zyes" ; then
CFLAGS="$CFLAGS -pg"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl ==========================================================================
dnl Pedantic compilation
dnl ==========================================================================
AC_MSG_CHECKING(for pedantic)
AC_ARG_ENABLE(pedantic, [ --enable-pedantic enable pedantic compilation flags (no)])
if test "z$enable_pedantic" = "zyes" ; then
dnl CFLAGS="$CFLAGS -pedantic -Wall -ansi -W -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls"
CFLAGS="$CFLAGS -O -pedantic -Wall -ansi -fno-inline -W -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl ==========================================================================
dnl Static linking
dnl ==========================================================================
XMLSEC_STATIC_BINARIES=""
AC_MSG_CHECKING(for static linking)
AC_ARG_ENABLE(static_linking, [ --enable-static-linking enable static linking (no)])
if test "z$enable_static_linking" = "zyes" ; then
XMLSEC_STATIC_BINARIES="-static"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_SUBST(XMLSEC_STATIC_BINARIES)
dnl ==========================================================================
dnl Final steps: xmlsec config
dnl ==========================================================================
XMLSEC_CORE_CFLAGS="$XMLSEC_DEFINES -I${includedir}/xmlsec1 $XMLSEC_DL_INCLUDES"
XMLSEC_CORE_LIBS="-lxmlsec1 $XMLSEC_DL_LIBS "
AC_SUBST(XMLSEC_CORE_CFLAGS)
AC_SUBST(XMLSEC_CORE_LIBS)
dnl used in xmlsecConf.sh*
XMLSEC_LIBDIR="${libdir}"
AC_SUBST(XMLSEC_LIBDIR)
XMLSEC_OPENSSL_CFLAGS="$XMLSEC_CORE_CFLAGS $OPENSSL_CFLAGS"
XMLSEC_OPENSSL_LIBS="-L${libdir} -l$OPENSSL_CRYPTO_LIB $XMLSEC_CORE_LIBS $OPENSSL_LIBS"
AC_SUBST(XMLSEC_OPENSSL_CFLAGS)
AC_SUBST(XMLSEC_OPENSSL_LIBS)
XMLSEC_GCRYPT_CFLAGS="$XMLSEC_CORE_CFLAGS $GCRYPT_CFLAGS"
XMLSEC_GCRYPT_LIBS="-L${libdir} -l$GCRYPT_CRYPTO_LIB $XMLSEC_CORE_LIBS $GCRYPT_LIBS"
AC_SUBST(XMLSEC_GCRYPT_CFLAGS)
AC_SUBST(XMLSEC_GCRYPT_LIBS)
# xmlsec-gnutls is using xmlsec-gcrypt
XMLSEC_GNUTLS_CFLAGS="$XMLSEC_CORE_CFLAGS $GNUTLS_CFLAGS"
XMLSEC_GNUTLS_LIBS="-L${libdir} -l$GNUTLS_CRYPTO_LIB -l$GCRYPT_CRYPTO_LIB $XMLSEC_CORE_LIBS $GNUTLS_LIBS"
AC_SUBST(XMLSEC_GNUTLS_CFLAGS)
AC_SUBST(XMLSEC_GNUTLS_LIBS)
XMLSEC_NSS_CFLAGS="$XMLSEC_CORE_CFLAGS $NSS_CFLAGS"
XMLSEC_NSS_LIBS="-L${libdir} -l$NSS_CRYPTO_LIB $XMLSEC_CORE_LIBS $NSS_LIBS"
AC_SUBST(XMLSEC_NSS_CFLAGS)
AC_SUBST(XMLSEC_NSS_LIBS)
dnl No we will not generate pkg-config file for mscrypto !
dnl XMLSEC_MSCRYPTO_CFLAGS="$XMLSEC_CORE_CFLAGS $MSCRYPTO_CFLAGS"
dnl XMLSEC_MSCRYPTO_LIBS="-L${libdir} -l$MSCRYPTO_CRYPTO_LIB $XMLSEC_CORE_LIBS $MSCRYPTO_LIBS";;
dnl AC_SUBST(XMLSEC_MSCRYPTO_CFLAGS)
dnl AC_SUBST(XMLSEC_MSCRYPTO_LIBS)
XMLSEC_CFLAGS="$XMLSEC_CORE_CFLAGS $LIBXML_CFLAGS $LIBXSLT_CFLAGS $XMLSEC_CRYPTO_CFLAGS"
XMLSEC_LIBS="-L${libdir} -l$XMLSEC_CRYPTO_LIB $XMLSEC_CORE_LIBS $LIBXML_LIBS $LIBXSLT_LIBS $XMLSEC_CRYPTO_LIBS"
AC_SUBST(XMLSEC_CFLAGS)
AC_SUBST(XMLSEC_LIBS)
AC_SUBST(XMLSEC_DEFINES)
AC_SUBST(XMLSEC_APP_DEFINES)
AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(XMLSEC_EXTRA_LDFLAGS)
AC_SUBST(XMLSEC_CRYPTO_EXTRA_LDFLAGS)
AC_SUBST(XMLSEC_CRYPTO)
AC_SUBST(XMLSEC_CRYPTO_LIST)
AC_SUBST(XMLSEC_CRYPTO_DISABLED_LIST)
AC_SUBST(XMLSEC_CRYPTO_LIB)
AC_SUBST(XMLSEC_CRYPTO_CFLAGS)
AC_SUBST(XMLSEC_CRYPTO_LIBS)
XMLSEC_CRYPTO_PC_FILES_LIST=""
for i in $XMLSEC_CRYPTO_LIST ; do
dnl skip pkg-config file for mscrypto
test x$i = xmscrypto && continue
XMLSEC_CRYPTO_PC_FILES_LIST="$XMLSEC_CRYPTO_PC_FILES_LIST $XMLSEC_PACKAGE-$i.pc"
done
AC_SUBST(XMLSEC_CRYPTO_PC_FILES_LIST)
dnl ==========================================================================
dnl Writing result files
dnl ==========================================================================
if test "z$XMLSEC_NO_OPENSSL" != "z1" ; then
AC_CONFIG_FILES([include/xmlsec/openssl/Makefile src/openssl/Makefile])
fi
if test "z$XMLSEC_NO_GNUTLS" != "z1" ; then
AC_CONFIG_FILES([include/xmlsec/gnutls/Makefile src/gnutls/Makefile])
fi
if test "z$XMLSEC_NO_GCRYPT" != "z1" ; then
AC_CONFIG_FILES([include/xmlsec/gcrypt/Makefile src/gcrypt/Makefile])
fi
if test "z$XMLSEC_NO_NSS" != "z1" ; then
AC_CONFIG_FILES([include/xmlsec/nss/Makefile src/nss/Makefile])
fi
if test "z$XMLSEC_NO_MSCRYPTO" != "z1" ; then
AC_CONFIG_FILES([include/xmlsec/mscrypto/Makefile src/mscrypto/Makefile])
fi
if test "z$XMLSEC_NO_CRYPTO_DYNAMIC_LOADING" = "z1" ; then
(rm -f xmlsec1.pc && $LN_S xmlsec1-$XMLSEC_CRYPTO.pc xmlsec1.pc)
else
AC_CONFIG_FILES([xmlsec1.pc:xmlsec.pc.in])
fi
AC_CONFIG_FILES([
include/xmlsec/version.h
Makefile
include/Makefile
include/xmlsec/Makefile
include/xmlsec/private/Makefile
src/Makefile
apps/Makefile
docs/Makefile
docs/api/Makefile
man/Makefile
xmlsec1Conf.sh:xmlsecConf.sh.in
xmlsec1-config:xmlsec-config.in
xmlsec1-openssl.pc:xmlsec-openssl.pc.in
xmlsec1-gnutls.pc:xmlsec-gnutls.pc.in
xmlsec1-gcrypt.pc:xmlsec-gcrypt.pc.in
xmlsec1-nss.pc:xmlsec-nss.pc.in
xmlsec1.spec:xmlsec.spec.in
])
AC_OUTPUT
dnl COPYING should be in "srcdir" not in "builddir"
(cd $srcdir && rm -f COPYING.LIB COPYING && $LN_S Copyright COPYING)
|