-
Notifications
You must be signed in to change notification settings - Fork 100
/
configure.ac
2644 lines (2429 loc) · 95 KB
/
configure.ac
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
dnl Process this file with autoconf to produce a configure script.
AC_INIT([xmlsec1],[1.3.1],[http://www.aleksey.com/xmlsec])
XMLSEC_PACKAGE=xmlsec1
XMLSEC_VERSION_MAJOR=1
XMLSEC_VERSION_MINOR=3
XMLSEC_VERSION_SUBMINOR=1
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.69])
AC_LANG(C)
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 subdir-objects -Wno-portability foreign])
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
LT_INIT
AC_PROG_EGREP
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(PERL, perl)
dnl Programs for man pahes and html docs
AC_PATH_PROG(HELP2MAN, help2man)
AC_PATH_PROG(XSLTPROC, xsltproc)
AC_PATH_PROG(MAN2HTML, man2html)
AC_PATH_PROG(GTKDOC_MKHTML, gtkdoc-mkhtml)
AC_PATH_PROG(GTKDOC_MKDB, gtkdoc-mkdb)
AC_PATH_PROG(GTKDOC_SCAN, gtkdoc-scan)
AM_CONDITIONAL(HAS_HELP2MAN, [test x"$HELP2MAN" != x])
AM_CONDITIONAL(HAS_MAN2HTML, [test x"$MAN2HTML" != x])
AM_CONDITIONAL(HAS_XSLTPROC, [test x"$XSLTPROC" != x])
dnl Checks for header files.
AC_HEADER_DIRENT
dnl ==========================================================================
dnl XMLSec configs
dnl ==========================================================================
XMLSEC_DEFINES=
XMLSEC_APP_DEFINES=
XMLSEC_EXTRA_LDFLAGS=
XMLSEC_CRYPTO_EXTRA_LDFLAGS=
dnl ==========================================================================
dnl Perform host specific configuration
dnl ==========================================================================
build_on_aix=no
build_on_windows=no
build_on_mac=no
build_on_linux=no
AC_MSG_CHECKING(for build OS)
dnl should separate extra LDFLAGS for xmlsec and crypto libs ?
dnl should --enable-runtime-pseudo-reloc for mingw and cygwin ?
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
#
# prevent weird behaviour on gcc (see https://news.ycombinator.com/item?id=33770277)
#
CFLAGS="$CFLAGS -fno-strict-overflow -fno-strict-aliasing"
case "${host}" in
*aix* )
CFLAGS="${CFLAGS} -D_ALL_SOURCE"
build_on_aix=yes
AC_MSG_RESULT("AIX")
;;
*-*-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="$XMLSEC_EXTRA_LDFLAGS -no-undefined -avoid-version"
XMLSEC_CRYPTO_EXTRA_LDFLAGS="$XMLSEC_CRYPTO_EXTRA_LDFLAGS -no-undefined -avoid-version"
XMLSEC_SHLIBSFX=".dll.a"
build_on_windows=yes
AC_MSG_RESULT("Windows (MinGW)")
;;
*-*-cygwin*)
XMLSEC_EXTRA_LDFLAGS="$XMLSEC_EXTRA_LDFLAGS -no-undefined"
XMLSEC_CRYPTO_EXTRA_LDFLAGS="$XMLSEC_CRYPTO_EXTRA_LDFLAGS -no-undefined"
build_on_windows=yes
AC_MSG_RESULT("Windows (Cygwin)")
;;
*-*-darwin*)
XMLSEC_SHLIBSFX=".dylib"
build_on_mac=yes
AC_MSG_RESULT("MacOSX")
;;
*-*-linux*)
build_on_linux=yes
AC_MSG_RESULT("Linux")
;;
*)
AC_MSG_RESULT("Other")
;;
esac
dnl ==========================================================================
dnl Specific setup for Aleksey's development environment:
dnl - with debug
dnl - with pedantic compiler flags
dnl - with docs build
dnl - with static binaries
dnl - without dynamic xmlsec-crypto loading
dnl ==========================================================================
AC_MSG_CHECKING(for development environment)
AC_ARG_ENABLE([development], [AS_HELP_STRING([--enable-development],[enable development environment (no)])])
if test "z$enable_development" = "zyes" ; then
enable_debugging="yes"
enable_pedantic="yes"
enable_static_linking="yes"
enable_manpages_build="no"
enable_docs_build="no"
enable_crypto_dl="no"
dnl legacy crypto
enable_md5="yes"
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([disabled])
fi
dnl ==========================================================================
dnl Do we want to build manpages?
dnl ==========================================================================
AC_MSG_CHECKING(for man pages build)
AC_ARG_ENABLE([manpages_build], [AS_HELP_STRING([--enable-manpages-build],[man pages build (no)])])
if test "z$enable_manpages_build" = "zyes" ; then
AM_CONDITIONAL(BUILD_MANPAGES, [test x"$HELP2MAN" != x])
AC_MSG_RESULT([yes])
else
AM_CONDITIONAL(BUILD_MANPAGES, [test "x" = "y"])
AC_MSG_RESULT([disabled])
fi
dnl ==========================================================================
dnl Do we want to build docs?
dnl ==========================================================================
AC_MSG_CHECKING(for docs build)
AC_ARG_ENABLE([docs_build], [AS_HELP_STRING([--enable-docs-build],[docs build (no)])])
if test "z$enable_docs_build" = "zyes" ; then
AM_CONDITIONAL(BUILD_MAN_DOCS, [test x"$PERL" != x && test x"$XSLTPROC" != x && test x"$MAN2HTML" != x])
AM_CONDITIONAL(BUILD_API_DOCS, [test x"$PERL" != x && test x"$XSLTPROC" != x && test x"$GTKDOC_MKHTML" != x && test x"$GTKDOC_MKDB" != x && test x"$GTKDOC_SCAN" != x])
AC_MSG_RESULT([yes])
else
AM_CONDITIONAL(BUILD_MAN_DOCS, [test "x" = "y"])
AM_CONDITIONAL(BUILD_API_DOCS, [test "x" = "y"])
AC_MSG_RESULT([disabled])
fi
dnl ==========================================================================
dnl Hack for autoconf version mismatch
dnl ==========================================================================
if test "z$shrext" = "z" ; then
AC_MSG_CHECKING(for shared library suffix)
module=no
eval shrext=$shrext_cmds
AC_MSG_RESULT($shrext)
fi
dnl ==========================================================================
dnl Check for __FUNCTION__ or __func__
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_func_exists" = "zyes" ; then
AC_MSG_RESULT([__func__])
XMLSEC_DEFINES="$XMLSEC_DEFINES -D__XMLSEC_FUNCTION__=__func__"
elif test "z$ac_function_exists" = "zyes" ; then
AC_MSG_RESULT([__FUNCTION__])
XMLSEC_DEFINES="$XMLSEC_DEFINES -D__XMLSEC_FUNCTION__=__FUNCTION__"
else
AC_MSG_RESULT("no")
fi
dnl ==========================================================================
dnl Check if pkg-config is enabled and installed
dnl ==========================================================================
PKGCONFIG_FOUND="no"
AC_ARG_ENABLE([pkgconfig], [AS_HELP_STRING([--enable-pkgconfig],[enable pkgconfig for configuration (yes)])])
if test "z$enable_pkgconfig" != "zno" ; then
PKG_PROG_PKG_CONFIG
PKGCONFIG_FOUND="yes"
else
PKGCONFIG_FOUND="no"
fi
dnl ==========================================================================
dnl Check if packages custom config scripts are enabled
dnl ==========================================================================
ENABLE_CUSTOM_CONFIGS="no"
AC_ARG_ENABLE([custom-configs], [AS_HELP_STRING([--enable-custom-configs],[enable package-specific custom scripts for configuration (yes)])])
if test "z$enable_custom_configs" != "zno" ; then
ENABLE_CUSTOM_CONFIGS="yes"
else
ENABLE_CUSTOM_CONFIGS="no"
fi
dnl ==========================================================================
dnl Check searching for typical packages folders is enabled
dnl ==========================================================================
ENABLE_FOLDERS_SEARCH="no"
AC_ARG_ENABLE([folders-search], [AS_HELP_STRING([--enable-folders-search],[enable searching for package installation in typical folders (yes)])])
if test "z$enable_folders_search" != "zno" ; then
ENABLE_FOLDERS_SEARCH="yes"
else
ENABLE_FOLDERS_SEARCH="no"
fi
dnl ==========================================================================
dnl Common installation locations
dnl ==========================================================================
COMMON_INCLUDE_DIR="/usr/include /usr/local/include"
COMMON_LIB_DIR="/usr/lib /usr/lib64 /usr/local/lib"
case $host in
i*86-*-linux-gnu) COMMON_LIB_DIR="$COMMON_LIB_DIR /usr/lib/i386-linux-gnu" ;;
x86_64-*-linux-gnu) COMMON_LIB_DIR="$COMMON_LIB_DIR /usr/lib/x86_64-linux-gnu" ;;
*) COMMON_LIB_DIR="$COMMON_LIB_DIR /usr/lib/$host" ;;
esac
dnl Macro to help find the folder that contains marker file.
dnl Usage: AX_FIND_FOLDER(RESULT_VARIABLE, MARKER_FILE, FOLDERS_LIST)
AC_DEFUN([AX_FIND_FOLDER],[
for dir in $3 ; do
if test -f "$dir/$2" ; then
$1="$dir"
break;
fi
done
])
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)
XMLSEC_USE_SIZE_T="no"
AC_ARG_ENABLE([size-t], [AS_HELP_STRING([--enable-size-t],[enable xmsSecSize typedef to size_t (yes)])])
AC_MSG_CHECKING(for using size_t)
if test "z$enable_size_t" = "zno" ; then
XMLSEC_USE_SIZE_T="no"
AC_MSG_RESULT([no (deprecated)])
else
XMLSEC_USE_SIZE_T="yes"
AC_MSG_RESULT([yes])
fi
if test "z$XMLSEC_USE_SIZE_T" != "zyes" -a "$ac_cv_sizeof_size_t" -ne "4" ; then
XMLSEC_DEFINES="$XMLSEC_DEFINES -DXMLSEC_NO_SIZE_T"
fi
dnl ==========================================================================
dnl find libxml
dnl ==========================================================================
LIBXML_MIN_VERSION="2.8.0"
LIBXML_INCLUDE_DIR="$COMMON_INCLUDE_DIR /usr/include/libxml2 /usr/local/include/libxml2 /usr/local/libxml2/include"
LIBXML_LIB_DIR="$COMMON_LIB_DIR /usr/local/libxml2/lib"
LIBXML_INCLUDE_MARKER="libxml/xmlversion.h"
LIBXML_SHARED_LIB_MARKER="libxml2$shrext"
LIBXML_STATIC_LIB_MARKER="libxml2.$libext"
LIBXML_LIBS_LIST="-lxml2"
LIBXML_CONFIG="xml2-config"
LIBXML_INCLUDE_PATH=
LIBXML_LIB_PATH=
LIBXML_CONFIG_PATH=
LIBXML_FOUND="no"
AC_ARG_WITH([libxml], [AS_HELP_STRING([--with-libxml@<:@=PFX@:>@],[libxml2 location])])
AC_ARG_WITH([libxml-src], [AS_HELP_STRING([--with-libxml-src@<:@=PFX@:>@],[libxml2 source tree location])])
dnl Priority 0: LibXML2 is disabled: hard error.
if test "z$with_libxml" = "zno" -o "z$with_libxml_src" = "zno"; then
LIBXML_FOUND="disabled"
fi
dnl Priority 1: User specifies the path to source code
if test "z$LIBXML_FOUND" = "zno" -a "z$with_libxml_src" != "z" -a "z$with_libxml_src" != "zyes" ; then
AC_MSG_CHECKING(for libxml2 library source tree in "$with_libxml_src" folder)
if test [ -f "$with_libxml_src/include/$LIBXML_INCLUDE_MARKER" ] -a [ -f "$with_libxml_src/.libs/$LIBXML_SHARED_LIB_MARKER" -o -f "$with_libxml_src/.libs/$LIBXML_STATIC_LIB_MARKER"] ; then
LIBXML_INCLUDE_PATH="$with_libxml_src/include"
LIBXML_LIB_PATH="$with_libxml_src/.libs"
LIBXML_FOUND="yes"
AC_MSG_RESULT([yes])
else
AC_MSG_ERROR([not found: "$with_libxml_src/include/$LIBXML_INCLUDE_MARKER" or "$with_libxml_src/.libs/$LIBXML_SHARED_LIB_MARKER" or "$with_libxml_src/.libs/$LIBXML_STATIC_LIB_MARKER" files don't exist), typo?])
fi
fi
dnl Priority 2: User specifies path to installation
if test "z$LIBXML_FOUND" = "zno" -a "z$with_libxml" != "z" -a "z$with_libxml" != "zyes" ; then
AC_MSG_CHECKING(for libxml2 library installation in "$with_libxml" folder)
if test "z$ENABLE_CUSTOM_CONFIGS" = "zyes" -a -f "$with_libxml/bin/$LIBXML_CONFIG" ; then
LIBXML_CONFIG_PATH="$with_libxml/bin/$LIBXML_CONFIG"
LIBXML_FOUND="yes"
AC_MSG_RESULT([yes])
elif test [ -f "$with_libxml/include/libxml2/$LIBXML_INCLUDE_MARKER" ] -a [ -f "$with_libxml/lib/$LIBXML_SHARED_LIB_MARKER" -o -f "$with_libxml/lib/$LIBXML_STATIC_LIB_MARKER" ] ; then
LIBXML_INCLUDE_PATH="$with_libxml/include/libxml2"
LIBXML_LIB_PATH="$with_libxml/lib"
LIBXML_FOUND="yes"
AC_MSG_RESULT([yes])
else
AC_MSG_ERROR([not found: "$with_libxml/bin/$LIBXML_CONFIG" tool, or "$with_libxml/include/libxml2/$LIBXML_INCLUDE_MARKER" and/or "$with_libxml/lib/$LIBXML_SHARED_LIB_MARKER" or "$with_libxml/lib/$LIBXML_STATIC_LIB_MARKER" files don't exist), typo?])
fi
fi
dnl Priority 3: User sets both CFLAGS and LIBS flags
if test "z$LIBXML_FOUND" = "zno" -a "z$LIBXML_CFLAGS" != "z" -a "z$LIBXML_LIBS" != "z" ; then
LIBXML_FOUND="yes"
fi
dnl Priority 4: Guess with pkg_config
if test "z$LIBXML_FOUND" = "zno" -a "z$PKGCONFIG_FOUND" = "zyes" ; then
PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= $LIBXML_MIN_VERSION,
[LIBXML_FOUND=yes],
[LIBXML_FOUND=no])
fi
dnl Priority 5: Guess the config tool location
if test "z$LIBXML_FOUND" = "zno" -a "z$ENABLE_CUSTOM_CONFIGS" = "zyes" ; then
AC_PATH_PROG(LIBXML_CONFIG_PATH, [$LIBXML_CONFIG], [], [$PATH])
if test "z$LIBXML_CONFIG_PATH" != "z" ; then
LIBXML_FOUND="yes"
fi
fi
dnl Priority 6: Guess using a list of folders.
if test "z$LIBXML_FOUND" = "zno" -a "z$ENABLE_FOLDERS_SEARCH" = "zyes" ; then
AC_MSG_CHECKING(for libxml2 library installation in the typical folders)
if test "z$LIBXML_INCLUDE_PATH" = "z" ; then
AX_FIND_FOLDER(LIBXML_INCLUDE_PATH, $LIBXML_INCLUDE_MARKER, $LIBXML_INCLUDE_DIR)
fi
if test "z$LIBXML_LIB_PATH" = "z" ; then
AX_FIND_FOLDER(LIBXML_LIB_PATH, $LIBXML_SHARED_LIB_MARKER, $LIBXML_LIB_DIR)
fi
if test "z$LIBXML_LIB_PATH" = "z" ; then
AX_FIND_FOLDER(LIBXML_LIB_PATH, $LIBXML_STATIC_LIB_MARKER, $LIBXML_LIB_DIR)
fi
if test "z$LIBXML_INCLUDE_PATH" != "z" -a "z$LIBXML_LIB_PATH" != "z" ; then
LIBXML_FOUND="yes"
AC_MSG_RESULT([yes ("-I$LIBXML_INCLUDE_PATH -L$LIBXML_LIB_PATH")])
else
AC_MSG_RESULT([not found])
fi
fi
dnl Priority 7: Just try to compile/link and hope for the best
if test "z$LIBXML_FOUND" = "zno" ; then
AC_MSG_CHECKING(for libxml2 library installation)
OLD_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $LIBXML_CFLAGS"
OLD_LIBS=$LIBS
LIBS="$LIBS $LIBXML_LIBS $LIBXML_LIBS_LIST"
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
#include <libxml/xmlversion.h>
]],[[
int main () { xmlCheckVersion(0);; return(0); }
]])
],[
LIBXML_FOUND=yes
LIBXML_LIBS="$LIBXML_LIBS $LIBXML_LIBS_LIST"
AC_MSG_RESULT([yes])
],[
LIBXML_FOUND=no
AC_MSG_RESULT([not found])
])
CPPFLAGS=$OLD_CPPFLAGS
LIBS=$OLD_LIBS
fi
dnl Set CFLAGS/LIBS flags
if test "z$LIBXML_FOUND" = "zyes" ; then
if test "z$LIBXML_CONFIG_PATH" != "z" -a "z$ENABLE_CUSTOM_CONFIGS" = "zyes" ; then
dnl Get the values using config tool (overwrite CFLAGS/LIBS!)
if test "z$LIBXML_CFLAGS" = "z" ; then
LIBXML_CFLAGS="`$LIBXML_CONFIG_PATH --cflags`"
fi
if test "z$LIBXML_LIBS" = "z"; then
LIBXML_LIBS="`$LIBXML_CONFIG_PATH --libs`"
fi
LIBXML_CONFIG=$LIBXML_CONFIG_PATH
LIBXML_FOUND="yes"
else
dnl Set flags if INCLUDE_PATH or LIB_PATH are set (do NOT overwrite CFLAGS/LIBS!)
if test "z$LIBXML_INCLUDE_PATH" != "z" ; then
LIBXML_CFLAGS="$LIBXML_CFLAGS -I$LIBXML_INCLUDE_PATH"
fi
if test "z$LIBXML_LIB_PATH" != "z" ; then
if test "z$with_gnu_ld" = "zyes" ; then
LIBXML_LIBS="$LIBXML_LIBS -Wl,-rpath-link -Wl,$LIBXML_LIB_PATH"
fi
LIBXML_LIBS="$LIBXML_LIBS -L$LIBXML_LIB_PATH $LIBXML_LIBS_LIST"
fi
fi
fi
dnl Verify the version.
AC_MSG_CHECKING(for libxml2 library >= $LIBXML_MIN_VERSION)
if test "z$LIBXML_FOUND" = "zyes" ; then
OLD_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $LIBXML_CFLAGS"
minvers=`echo $LIBXML_MIN_VERSION | awk -F. '{ printf "%d", ($1 * 100 + $2) * 100 + $3;}'`
AC_EGREP_CPP(greater-than-minvers, [
#include <libxml/xmlversion.h>
#if LIBXML_VERSION >= $minvers
greater-than-minvers
#endif
],[
LIBXML_FOUND=yes
],[
LIBXML_FOUND=no
])
CPPFLAGS=$OLD_CPPFLAGS
fi
AC_MSG_RESULT([$LIBXML_FOUND])
dnl LibXML2 is required so if we didn't find it then it is a fatal error.
if test "z$LIBXML_FOUND" != "zyes" ; then
AC_MSG_ERROR([libxml2 library >= $LIBXML_MIN_VERSION is required for this version of $XMLSEC_PACKAGE])
fi
dnl Finally set variables
AC_SUBST(LIBXML_CFLAGS)
AC_SUBST(LIBXML_LIBS)
AC_SUBST(LIBXML_CONFIG)
AC_SUBST(LIBXML_MIN_VERSION)
dnl ==========================================================================
dnl find libxslt
dnl ==========================================================================
LIBXSLT_MIN_VERSION=1.0.20
LIBXSLT_INCLUDE_DIR="$COMMON_INCLUDE_DIR /usr/local/libxslt/include"
LIBXSLT_LIB_DIR="$COMMON_LIB_DIR /usr/local/libxslt/lib"
LIBXSLT_CONFIG="xslt-config"
LIBXSLT_INCLUDE_MARKER="libxslt/xsltconfig.h"
LIBXSLT_SHARED_LIB_MARKER="libxslt$shrext"
LIBXSLT_STATIC_LIB_MARKER="libxslt.$libext"
LIBXSLT_LIBS_LIST="-lxslt"
XMLSEC_NO_LIBXSLT="1"
LIBXSLT_INCLUDE_PATH=
LIBXSLT_LIB_PATH=
LIBXSLT_CONFIG_PATH=
LIBXSLT_FOUND="no"
AC_ARG_WITH([libxslt], [AS_HELP_STRING([--with-libxslt@<:@=PFX@:>@],[libxslt location])])
AC_ARG_WITH([libxslt-src], [AS_HELP_STRING([--with-libxslt-src@<:@=PFX@:>@],[libxslt source tree location])])
dnl Priority 0: Check if library is not needed
if test "z$with_libxslt" = "zno" -o "z$with_libxslt_src" = "zno" ; then
LIBXSLT_FOUND="disabled"
fi
dnl Priority 1: User specifies the path to source code
if test "z$LIBXSLT_FOUND" = "zno" -a "z$with_libxslt_src" != "z" -a "z$with_libxslt_src" != "zyes" ; then
AC_MSG_CHECKING(for libxslt library source tree in "$with_libxslt_src" folder)
if test [ -f "$with_libxslt_src/$LIBXSLT_INCLUDE_MARKER" ] -a [ -f "$with_libxslt_src/libxslt/.libs/$LIBXSLT_SHARED_LIB_MARKER" -o -f "$with_libxslt_src/libxslt/.libs/$LIBXSLT_STATIC_LIB_MARKER" ] ; then
LIBXSLT_INCLUDE_PATH="$with_libxslt_src"
LIBXSLT_LIB_PATH="$with_libxslt_src/libxslt/.libs"
LIBXSLT_FOUND="yes"
AC_MSG_RESULT([yes])
else
AC_MSG_ERROR([not found: "$with_libxslt_src/$LIBXSLT_INCLUDE_MARKER" and/or "$with_libxslt_src/libxslt/.libs/$LIBXSLT_SHARED_LIB_MARKER" or "$with_libxslt_src/libxslt/.libs/$LIBXSLT_STATIC_LIB_MARKER" files don't exist), typo?])
fi
fi
dnl Priority 2: User specifies path to installation
if test "z$LIBXSLT_FOUND" = "zno" -a "z$with_libxslt" != "z" -a "z$with_libxslt" != "zyes" ; then
AC_MSG_CHECKING(for libxslt library installation in "$with_libxslt" folder)
if test "z$ENABLE_CUSTOM_CONFIGS" = "zyes" -a -f "$with_libxslt/bin/$LIBXSLT_CONFIG" ; then
LIBXSLT_CONFIG_PATH="$with_libxslt/bin/$LIBXSLT_CONFIG"
LIBXSLT_FOUND="yes"
AC_MSG_RESULT([yes])
elif test [ -f "$with_libxslt/include/$LIBXSLT_INCLUDE_MARKER" ] -a [ -f "$with_libxslt/lib/$LIBXSLT_SHARED_LIB_MARKER" -o -f "$with_libxslt/lib/$LIBXSLT_STATIC_LIB_MARKER" ] ; then
LIBXSLT_INCLUDE_PATH="$with_libxslt/include"
LIBXSLT_LIB_PATH="$with_libxslt/lib"
LIBXSLT_FOUND="yes"
AC_MSG_RESULT([yes])
else
AC_MSG_ERROR([not found: "$with_libxslt/bin/$LIBXSLT_CONFIG" tool, or "$with_libxslt/include/$LIBXSLT_INCLUDE_MARKER" and/or "$with_libxslt/lib/$LIBXSLT_SHARED_LIB_MARKER" or "$with_libxslt/lib/$LIBXSLT_STATIC_LIB_MARKER" files don't exist), typo?])
fi
fi
dnl Priority 3: User sets both CFLAGS and LIBS flags
if test "z$LIBXSLT_FOUND" = "zno" -a "z$LIBXSLT_CFLAGS" != "z" -a "z$LIBXSLT_LIBS" != "z" ; then
LIBXSLT_FOUND="yes"
fi
dnl Priority 4: Guess with pkg_config
if test "z$LIBXSLT_FOUND" = "zno" -a "z$PKGCONFIG_FOUND" = "zyes" ; then
PKG_CHECK_MODULES(LIBXSLT, libxslt >= $LIBXSLT_MIN_VERSION,
[LIBXSLT_FOUND=yes],
[LIBXSLT_FOUND=no])
fi
dnl Priority 5: Guess the config tool location
if test "z$LIBXSLT_FOUND" = "zno" -a "z$ENABLE_CUSTOM_CONFIGS" = "zyes" ; then
AC_PATH_PROG(LIBXSLT_CONFIG_PATH, [$LIBXSLT_CONFIG], [], [$PATH])
if test "z$LIBXSLT_CONFIG_PATH" != "z" ; then
LIBXSLT_FOUND="yes"
fi
fi
dnl Priority 6: Guess using a list of folders.
if test "z$LIBXSLT_FOUND" = "zno" -a "z$ENABLE_FOLDERS_SEARCH" = "zyes" ; then
AC_MSG_CHECKING(for libxslt library installation in the typical folders)
if test "z$LIBXSLT_INCLUDE_PATH" = "z" ; then
AX_FIND_FOLDER(LIBXSLT_INCLUDE_PATH, $LIBXSLT_INCLUDE_MARKER, $LIBXSLT_INCLUDE_DIR)
fi
if test "z$LIBXSLT_LIB_PATH" = "z" ; then
AX_FIND_FOLDER(LIBXSLT_LIB_PATH, $LIBXSLT_SHARED_LIB_MARKER, $LIBXSLT_LIB_DIR)
fi
if test "z$LIBXSLT_LIB_PATH" = "z" ; then
AX_FIND_FOLDER(LIBXSLT_LIB_PATH, $LIBXSLT_STATIC_LIB_MARKER, $LIBXSLT_LIB_DIR)
fi
if test "z$LIBXSLT_INCLUDE_PATH" != "z" -a "z$LIBXSLT_LIB_PATH" != "z" ; then
LIBXSLT_FOUND="yes"
AC_MSG_RESULT([yes ("-I$LIBXSLT_INCLUDE_PATH -L$LIBXSLT_LIB_PATH")])
else
AC_MSG_RESULT([not found])
fi
fi
dnl Priority 7: Just try to compile/link and hope for the best
if test "z$LIBXSLT_FOUND" = "zno" ; then
AC_MSG_CHECKING(for libxslt library installation)
OLD_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $LIBXML_CFLAGS $LIBXSLT_CFLAGS"
OLD_LIBS=$LIBS
LIBS="$LIBS $LIBXML_LIBS $LIBXSLT_LIBS $LIBXSLT_LIBS_LIST"
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
#include <libxslt/xslt.h>
]],[[
int main () { xsltInit(); return(0); }
]])
],[
LIBXSLT_FOUND=yes
LIBXSLT_LIBS="$LIBXSLT_LIBS $LIBXSLT_LIBS_LIST"
AC_MSG_RESULT([yes])
],[
LIBXSLT_FOUND=no
AC_MSG_RESULT([not found])
])
CPPFLAGS=$OLD_CPPFLAGS
LIBS=$OLD_LIBS
fi
dnl Set CFLAGS/LIBS flags
if test "z$LIBXSLT_FOUND" = "zyes" ; then
if test "z$LIBXSLT_CONFIG_PATH" != "z" -a "z$ENABLE_CUSTOM_CONFIGS" = "zyes" ; then
dnl Get the values using config tool (overwrite CFLAGS/LIBS!)
if test "z$LIBXSLT_CFLAGS" = "z" ; then
LIBXSLT_CFLAGS="`$LIBXSLT_CONFIG_PATH --cflags`"
fi
if test "z$LIBXSLT_LIBS" = "z"; then
LIBXSLT_LIBS="`$LIBXSLT_CONFIG_PATH --libs`"
fi
LIBXSLT_CONFIG=$LIBXSLT_CONFIG_PATH
LIBXSLT_FOUND="yes"
else
dnl Set flags if INCLUDE_PATH or LIB_PATH are set (do NOT overwrite CFLAGS/LIBS!)
if test "z$LIBXSLT_INCLUDE_PATH" != "z" ; then
LIBXSLT_CFLAGS="$LIBXSLT_CFLAGS -I$LIBXSLT_INCLUDE_PATH"
fi
if test "z$LIBXSLT_LIB_PATH" != "z" ; then
if test "z$with_gnu_ld" = "zyes" ; then
LIBXSLT_LIBS="$LIBXSLT_LIBS -Wl,-rpath-link -Wl,$LIBXSLT_LIB_PATH"
fi
LIBXSLT_LIBS="$LIBXSLT_LIBS -L$LIBXSLT_LIB_PATH $LIBXSLT_LIBS_LIST"
fi
fi
fi
dnl Verify the version
AC_MSG_CHECKING(for libxslt library >= $LIBXSLT_MIN_VERSION)
if test "z$LIBXSLT_FOUND" = "zyes" ; then
OLD_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $LIBXSLT_CFLAGS"
minvers=`echo $LIBXSLT_MIN_VERSION | awk -F. '{ printf "%d", ($1 * 100 + $2) * 100 + $3;}'`
AC_EGREP_CPP(greater-than-minvers, [
#include <libxslt/xsltconfig.h>
#if LIBXSLT_VERSION >= $minvers
greater-than-minvers
#endif
],[
LIBXSLT_FOUND=yes
],[
LIBXSLT_FOUND=no
])
CPPFLAGS=$OLD_CPPFLAGS
fi
AC_MSG_RESULT([$LIBXSLT_FOUND])
dnl Finally set variables
if test "z$LIBXSLT_FOUND" = "zyes" ; then
XMLSEC_NO_LIBXSLT="0"
LIBXSLT_PC_FILE_COND="libxslt >= $LIBXSLT_MIN_VERSION"
else
XMLSEC_NO_LIBXSLT="1"
LIBXSLT_PC_FILE_COND=""
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)
AC_SUBST(LIBXSLT_PC_FILE_COND)
dnl ==========================================================================
dnl See if we can find a crypto library
dnl ==========================================================================
XMLSEC_CRYPTO_LIST=""
XMLSEC_CRYPTO_DISABLED_LIST=""
dnl ==========================================================================
dnl OpenSSL
dnl ==========================================================================
OPENSSL_MIN_VERSION="1.1.0"
OPENSSL_INCLUDE_DIR="$COMMON_INCLUDE_DIR /usr/local/ssl/include"
OPENSSL_LIB_DIR="$COMMON_LIB_DIR /usr/local/ssl/lib /usr/local/ssl/lib64"
OPENSSL_CRYPTO_LIB="$XMLSEC_PACKAGE-openssl"
OPENSSL_INCLUDE_MARKER="openssl/opensslv.h"
OPENSSL_LIB_SHARED_MARKER="libcrypto$shrext"
OPENSSL_LIB_STATIC_MARKER="libcrypto.a"
OPENSSL_LIBS_LIST="-lcrypto"
case $host in
*-*-mingw*) OPENSSL_EXTRA_LIBS=;;
*-*-osf5*) OPENSSL_EXTRA_LIBS=;;
*-*-openbsd*) OPENSSL_EXTRA_LIBS=;;
*-*-netbsd*) OPENSSL_EXTRA_LIBS=;;
*-*-freebsd*|*-*-dragonfly*) OPENSSL_EXTRA_LIBS=;;
*-*-darwin*) OPENSSL_EXTRA_LIBS=;;
#FIXME: check if lib "dl" is required
*) OPENSSL_EXTRA_LIBS=-ldl;;
esac
XMLSEC_NO_OPENSSL="1"
OPENSSL_VERSION=""
OPENSSL_INCLUDE_PATH=
OPENSSL_LIB_PATH=
OPENSSL_TEST_CONFIG=
OPENSSL_FOUND=no
AC_ARG_WITH([openssl], [AS_HELP_STRING([--with-openssl@<:@=PFX@:>@],[openssl location])])
dnl Priority 0: Check if library is disabled
if test "z$with_openssl" = "zno" ; then
OPENSSL_FOUND=disabled
fi
dnl Priority 1: User specifies the path to installation
if test "z$OPENSSL_FOUND" = "zno" -a "z$with_openssl" != "z" -a "z$with_openssl" != "zyes" ; then
AC_MSG_CHECKING(for openssl library installation in "$with_openssl" folder)
if test -f "$with_openssl/include/$OPENSSL_INCLUDE_MARKER" -a -f "$with_openssl/lib/$OPENSSL_LIB_SHARED_MARKER" ; then
OPENSSL_INCLUDE_PATH="$with_openssl/include"
OPENSSL_LIB_PATH="$with_openssl/lib"
OPENSSL_FOUND="yes"
AC_MSG_RESULT([yes])
elif test -f "$with_openssl/include/$OPENSSL_INCLUDE_MARKER" -a -f "$with_openssl/lib64/$OPENSSL_LIB_SHARED_MARKER" ; then
OPENSSL_INCLUDE_PATH="$with_openssl/include"
OPENSSL_LIB_PATH="$with_openssl/lib64"
OPENSSL_FOUND="yes"
AC_MSG_RESULT([yes])
elif test -f "$with_openssl/include/$OPENSSL_INCLUDE_MARKER" -a -f "$with_openssl/lib/$OPENSSL_LIB_STATIC_MARKER" ; then
OPENSSL_INCLUDE_PATH="$with_openssl/include"
OPENSSL_LIB_PATH="$with_openssl/lib"
OPENSSL_FOUND="yes"
AC_MSG_RESULT([yes])
elif test -f "$with_openssl/include/$OPENSSL_INCLUDE_MARKER" -a -f "$with_openssl/libi64/$OPENSSL_LIB_STATIC_MARKER" ; then
OPENSSL_INCLUDE_PATH="$with_openssl/include"
OPENSSL_LIB_PATH="$with_openssl/lib64"
OPENSSL_FOUND="yes"
AC_MSG_RESULT([yes])
else
AC_MSG_ERROR([not found: "$with_openssl/include/$OPENSSL_INCLUDE_MARKER" or "$with_openssl/lib(64)/$OPENSSL_LIB_SHARED_MARKER" or "$with_openssl/lib(64)/$OPENSSL_LIB_STATIC_MARKER" files don't exist), typo?])
fi
fi
dnl Priority 2: User sets both CFLAGS and LIBS flags
if test "z$OPENSSL_FOUND" = "zno" -a "z$OPENSSL_CFLAGS" != "z" -a "z$OPENSSL_LIBS" != "z" ; then
OPENSSL_FOUND="yes"
fi
dnl Priority 3: Guess with pkg_config
if test "z$OPENSSL_FOUND" = "zno" -a "z$PKGCONFIG_FOUND" = "zyes" ; then
PKG_CHECK_MODULES(OPENSSL, openssl >= $OPENSSL_MIN_VERSION,
[OPENSSL_FOUND=yes],
[OPENSSL_FOUND=no])
fi
dnl Priority 4: Guess using a list of folders (do not overwrite CFLAGS/LIBS flags).
if test "z$OPENSSL_FOUND" = "zno" -a "z$ENABLE_FOLDERS_SEARCH" = "zyes" ; then
AC_MSG_CHECKING(for openssl library installation in the typical folders)
if test "z$OPENSSL_INCLUDE_PATH" = "z" ; then
AX_FIND_FOLDER(OPENSSL_INCLUDE_PATH, $OPENSSL_INCLUDE_MARKER, $OPENSSL_INCLUDE_DIR)
fi
if test "z$OPENSSL_LIB_PATH" = "z" ; then
AX_FIND_FOLDER(OPENSSL_LIB_PATH, $OPENSSL_LIB_SHARED_MARKER, $OPENSSL_LIB_DIR)
fi
if test "z$OPENSSL_LIB_PATH" = "z" ; then
AX_FIND_FOLDER(OPENSSL_LIB_PATH, $OPENSSL_LIB_STATIC_MARKER, $OPENSSL_LIB_DIR)
fi
if test "z$OPENSSL_INCLUDE_PATH" != "z" -a "z$OPENSSL_LIB_PATH" != "z" ; then
OPENSSL_FOUND="yes"
AC_MSG_RESULT([yes ("-I$OPENSSL_INCLUDE_PATH -L$OPENSSL_LIB_PATH")])
else
AC_MSG_RESULT([not found])
fi
fi
dnl Priority 5: Just try to compile/link and hope for the best
if test "z$OPENSSL_FOUND" = "zno" ; then
AC_MSG_CHECKING(for openssl library installation)
OLD_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $OPENSSL_CFLAGS"
OLD_LIBS=$LIBS
LIBS="$LIBS $OPENSSL_LIBS $OPENSSL_LIBS_LIST"
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
#include <openssl/ssl.h>
]],[[
int main () {
OPENSSL_init_ssl(0, NULL);
return(0);
}
]])
],[
OPENSSL_FOUND=yes
OPENSSL_LIBS="$OPENSSL_LIBS $OPENSSL_LIBS_LIST"
AC_MSG_RESULT([yes])
],[
OPENSSL_FOUND=no
AC_MSG_RESULT([not found])
])
CPPFLAGS=$OLD_CPPFLAGS
LIBS=$OLD_LIBS
fi
dnl Set flags if INCLUDE_PATH or LIB_PATH are set
if test "z$OPENSSL_FOUND" = "zyes" -a "z$OPENSSL_INCLUDE_PATH" != "z" ; then
OPENSSL_CFLAGS="$OPENSSL_CFLAGS -I$OPENSSL_INCLUDE_PATH -I$OPENSSL_INCLUDE_PATH/openssl"
fi
if test "z$OPENSSL_FOUND" = "zyes" -a "z$OPENSSL_LIB_PATH" != "z" ; then
if test -f "$OPENSSL_LIB_PATH/$OPENSSL_LIB_SHARED_MARKER" ; then
if test "z$with_gnu_ld" = "zyes" ; then
OPENSSL_LIBS="$OPENSSL_LIBS -Wl,-rpath-link -Wl,$OPENSSL_LIB_PATH"
fi
fi
OPENSSL_LIBS="$OPENSSL_LIBS -L$OPENSSL_LIB_PATH $OPENSSL_LIBS_LIST $OPENSSL_EXTRA_LIBS"
fi
dnl Check the OpenSSL version; if you change this code then you probably want to
dnl change include/xmlsec/openssl/crypto.h as well.
AC_MSG_CHECKING(for openssl library >= $OPENSSL_MIN_VERSION)
if test "z$OPENSSL_FOUND" = "zyes" ; then
OLD_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $OPENSSL_CFLAGS"
if test "z$OPENSSL_VERSION" = "z" ; then
AC_EGREP_CPP(greater-than-minvers, [
#include <openssl/opensslv.h>
#if defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x20700000L
greater-than-minvers
#endif
],[
OPENSSL_VERSION="1.1.0 (LibreSSL >= 2.7)"
],[
OPENSSL_VERSION=""
])
fi
if test "z$OPENSSL_VERSION" = "z" ; then
AC_EGREP_CPP(greater-than-minvers, [
#include <openssl/opensslv.h>
#include <openssl/crypto.h>
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
#ifdef OPENSSL_IS_BORINGSSL
greater-than-minvers
#endif
#endif
],[
OPENSSL_VERSION="1.1.0 (BoringSSL)"
enable_ripemd160=no
enable_dsa=no
],[
OPENSSL_VERSION=""
])
fi
if test "z$OPENSSL_VERSION" = "z" ; then
AC_EGREP_CPP(greater-than-minvers, [
#include <openssl/opensslv.h>
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
greater-than-minvers
#endif
],[
OPENSSL_VERSION="3.0.0"
OPENSSL_TEST_CONFIG="openssl3.cnf"
],[
OPENSSL_VERSION=""
])
fi
if test "z$OPENSSL_VERSION" = "z" ; then
AC_EGREP_CPP(greater-than-minvers, [
#include <openssl/opensslv.h>
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
greater-than-minvers
#endif
],[
OPENSSL_VERSION="1.1.0"
],[
OPENSSL_VERSION=""
])
fi
CPPFLAGS=$OLD_CPPFLAGS
if test "z$OPENSSL_VERSION" != "z" ; then
OPENSSL_FOUND=yes
else
OPENSSL_FOUND=no
fi
fi
if test "z$OPENSSL_FOUND" = "zyes" ; then
AC_MSG_RESULT([yes (openssl version '$OPENSSL_VERSION')])
else
AC_MSG_RESULT([$OPENSSL_FOUND])
fi
dnl Finally set all the flags
if test "z$OPENSSL_FOUND" = "zyes" ; then
XMLSEC_NO_OPENSSL="0"
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_TEST_CONFIG)
AC_SUBST(OPENSSL_MIN_VERSION)
dnl See if we should build OpenSSL 3+ with engines support
AC_ARG_ENABLE([openssl3_engines],[AS_HELP_STRING([--enable-openssl3-engines],[enable engines support for OpenSSL 3+ (no)])])
if test "z$OPENSSL_VERSION" = "z3.0.0" ; then
AC_MSG_CHECKING(for OpenSSL 3+ engines support)
if test "z$enable_openssl3_engines" = "zyes" ; then
XMLSEC_DEFINES="$XMLSEC_DEFINES -DXMLSEC_OPENSSL3_ENGINES=1"
AC_MSG_RESULT([enabled])
else
AC_MSG_RESULT([disabled])
fi
fi
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 ==========================================================================
dnl After upgrading min ver >= 3.59, remove the check in include/nss/crypto.h (search for NSS_VMAJOR)
NSS_MIN_VERSION="3.49"
NSPR_MIN_VERSION="4.25.0"
SEAMONKEY_MIN_VERSION="1.0"
MOZILLA_MIN_VERSION="1.4"
NSS_CRYPTO_LIB="$XMLSEC_PACKAGE-nss"
NSPR_PACKAGE=mozilla-nspr
NSS_PACKAGE=mozilla-nss
NSPR_INCLUDE_MARKER="nspr/nspr.h"
NSPR_LIB_MARKER="libnspr4$shrext"
NSPR_LIBS_LIST="-lnspr4 -lplds4 -lplc4"
NSS_INCLUDE_MARKER="nss/nss.h"
NSS_LIB_MARKER="libnss3$shrext"
NSS_LIBS_LIST="-lnss3 -lsmime3"
XMLSEC_NO_NSS="1"
NSPR_INCLUDE_PATH=
NSPR_LIB_PATH=
NSS_INCLUDE_PATH=
NSS_LIB_PATH=
NSS_FOUND="no"
NSPR_FOUND="no"
AC_ARG_WITH([nss], [AS_HELP_STRING([--with-nss@<:@=PFX@:>@],[nss location])])
AC_ARG_WITH([nspr], [AS_HELP_STRING([--with-nspr@<:@=PFX@:>@],[nspr location (needed for NSS)])])
AC_ARG_WITH([seamonkey_ver], [AS_HELP_STRING([--with-seamonkey-ver@<:@=VER@:>@],[mozilla version (alt to --with-nss, --with-nspr)])])
AC_ARG_WITH([mozilla_ver], [AS_HELP_STRING([--with-mozilla-ver@<:@=VER@:>@],[mozilla version (alt to --with-nss, --with-nspr)])])
dnl Priority 0: Check if library is disabled
if test "z$with_nss" = "zno" -o "z$with_nspr" = "zno" ; then
NSS_FOUND="disabled"
NSPR_FOUND="disabled"
fi
dnl Priority 1: User specifies the path to installation
if test "z$NSPR_FOUND" = "zno" -a "z$with_nspr" != "z" -a "z$with_nspr" != "zyes" ; then
AC_MSG_CHECKING(for nspr library installation in "$with_nspr" folder)
if test -f "$with_nspr/include/$NSPR_INCLUDE_MARKER" -a -f "$with_nspr/lib/$NSPR_LIB_MARKER" ; then
NSPR_INCLUDE_PATH="$with_nspr/include"
NSPR_LIB_PATH="$with_nspr/lib"
NSPR_FOUND="yes"
AC_MSG_RESULT([yes])
else
AC_MSG_ERROR([not found: "$with_nspr/include/$NSPR_INCLUDE_MARKER" and/or "$with_nspr/lib/$NSPR_LIB_MARKER" files don't exist), typo?])
fi
fi
if test "z$NSS_FOUND" = "zno" -a "z$with_nss" != "z" -a "z$with_nss" != "zyes" ; then
AC_MSG_CHECKING(for nss library installation in "$with_nss" folder)
if test -f "$with_nss/include/$NSS_INCLUDE_MARKER" -a -f "$with_nss/lib/$NSS_LIB_MARKER" ; then
NSS_INCLUDE_PATH="$with_nss/include"
NSS_LIB_PATH="$with_nss/lib"
NSS_FOUND="yes"
AC_MSG_RESULT([yes])
else
AC_MSG_ERROR([not found: "$with_nss/include/$NSS_INCLUDE_MARKER" and/or "$with_nss/lib/$NSS_LIB_MARKER" files don't exist), typo?])
fi
fi
dnl Priority 2: User sets both CFLAGS and LIBS flags
if test "z$NSPR_FOUND" = "zno" -a "z$NSPR_CFLAGS" != "z" -a "z$NSPR_LIBS" != "z" ; then
NSPR_FOUND="yes"
fi
if test "z$NSS_FOUND" = "zno" -a "z$NSS_CFLAGS" != "z" -a "z$NSS_LIBS" != "z" ; then
NSS_FOUND="yes"
fi
dnl Priority 3: Guess with pkg_config
dnl
dnl Mozilla's NSS/NSPR are distributed under different names in different distribution,
dnl we are going to try all options: