File: configure.ac

package info (click to toggle)
xml-security-c 1.4.0-3%2Blenny3
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 6,652 kB
  • ctags: 5,754
  • sloc: cpp: 44,620; sh: 8,359; makefile: 680
file content (964 lines) | stat: -rw-r--r-- 27,088 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
# Copyright 2002-2006 The Apache Software Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# All these setting come from the configure script
# We use configure to do most of the hard work as it is more
# designed to handle different system complexity than make
#

# Process this file with autoconf to produce a configure script

AC_INIT([[XML-Security-C]], [1.4.0], [security-dev@xml.apache.org], [xml-security-c])
AC_CONFIG_AUX_DIR([config])

# kick off automake

AM_INIT_AUTOMAKE(xml-security-c, 1.4.0)
sinclude(m4/acx_pthread.m4)
AM_PROG_LIBTOOL

# We want to control the autotools invocation

AM_MAINTAINER_MODE

# framework is a unique directory in src/ - allows configure to check
# it is running in the correct directory

AC_CONFIG_SRCDIR(src)

# Define the files we wish to generate

AC_CONFIG_FILES([Makefile\
  lib/Makefile \
  include/Makefile \
  bin/Makefile ])

# AC_CONFIG_FILES([Makefile canon/Makefile transformers/Makefile dsig/Makefile enc/Makefile enc/OpenSSL/Makefile framework/Makefile utils/Makefile utils/unixutils/Makefile tools/Makefile samples/Makefile])
AC_CONFIG_HEADERS([src/framework/XSECConfig.hpp])

# Get user options

AC_ARG_WITH(xerces, 
	AC_HELP_STRING(--with-xerces, 
		[Define Xerces directory.  Values = 'yes' or installation directory. 'No' is not permitted (Default = yes)]), 
	use_xerces=$withval, use_xerces=yes)

if test x"$use_xerces" != "xyes" ; then
  if test x"$use_xerces" != "xno" ; then
    XERCESCROOT=$use_xerces
  else
    AC_MSG_ERROR([Cannot configure without Xerces])
  fi
fi


AC_ARG_WITH(xalan, 
	AC_HELP_STRING(--with-xalan, 
		[Enable Xalan integration.  Values = 'yes' or installation directory (Default = yes)]), 
	use_xalan=$withval, use_xalan=yes)

if test x"$use_xalan" != "xyes" ; then
  if test x"$use_xalan" != "xno" ; then
    XALANCROOT=$use_xalan
  fi
fi

AC_ARG_WITH(openssl,
    AC_HELP_STRING(--with-openssl,
        [Use Openssl.  Values = 'yes' or installation directory (Default = yes)]),
    use_openssl=$withval, use_openssl=yes)

if test x"$use_openssl" != "xyes" ; then
  if test x"$use_openssl" != "xno" ; then
    # Must be the source directory
    OPENSSL=$use_openssl
  fi
fi

AC_ARG_ENABLE(debug,
	AC_HELP_STRING(--enable-debug,
		[Compile a version of the library with symbols (Default = no)]),
	enable_debug=$enableval, enable_debug=no)

# As of version 1.3, by default treat warnings as errors

AC_ARG_ENABLE(warnerror,
	AC_HELP_STRING(--enable-warnerrer,
		[Treat warnings as errors during compile (Default = no)]),
	enable_warnerror=$enableval, enable_warnerror=no)

# Check for basic programs

AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_AWK
AC_CHECK_PROG(AUTOCONF, autoconf, autoconf, true)

# AC_PROG_CC Defines the OBJEXT
objsuffix=".${OBJEXT}"

# pthreads
ACX_PTHREAD
CXXFLAGS="${CXXFLAGS} ${PTHREAD_CFLAGS}"
LIBS="${LIBS} ${PTHREAD_LIBS}"

# Set up versions

package_version_major=`echo ${PACKAGE_VERSION} | ${AWK} -F '.' '{print $1}'`
package_version_medium=`echo ${PACKAGE_VERSION} | ${AWK} -F '.' '{print $2}'`
package_version_minor=`echo ${PACKAGE_VERSION} | ${AWK} -F '.' '{print $3}'`

package_lib_major=${package_version_major}${package_version_medium}
package_lib_minor=${package_version_minor}
package_lib_version=${package_lib_major}.${package_lib_minor}

# "cache" the check for gcc -E

AC_TRY_CPP()
AC_LANG(C++)
AC_TRY_CPP()

# Need to reset CXXFLAGS if defaults have been set
if test "$ac_test_CXXFLAGS" != set; then
  CXXFLAGS=""
fi

# Check for Intel > 8.0 (which fools configure into thinking it is GNU
if test "x${ac_cv_cxx_compiler_gnu}" = "xyes"; then
	AC_MSG_CHECKING([for Intel compiler disguised as GNU])
	intel_check=`${CXX} -v 2>&1 | ${AWK} '{print $1}'`
	if test "x${intel_check}" = "xVersion"; then
		AC_MSG_RESULT([yes])
		ac_cv_cxx_compiler_gnu="no"
	else
		AC_MSG_RESULT([no])
	fi
fi

AC_LANG(C)

# Checks for required libraries
AC_CHECK_LIB(m, floor)
AC_CHECK_LIB(socket, getservent)

# Determine the host system and Makefile fragment

# Check for required includes
AC_CHECK_HEADERS(unistd.h direct.h)

# As a part of the automake process, AM_CHECK_LIBTOOL calls
# this automatically.  Adding here causes spurious warning messages
#AC_CANONICAL_HOST

# Ensure we are always compiling using library defs

CFLAGS="${CFLAGS} -DXSEC_LIBRARY_BUILD"
CXXFLAGS="${CXXFLAGS} -DXSEC_LIBRARY_BUILD"


# Platform-specific Makefile setup
# We have put most of the platform specific configuration here rather than
# in the Makefile.  Autoconf is designed with platform portability in mind,
# so by putting the complexity here we should be able to create a more
# portable makefile.

case "${host}" in
  *-*-solaris*)   
    platform=SOLARIS 
    shlibsuffix=.so
    lib_name="lib${PACKAGE_TARNAME}.so.${package_lib_version}"
    lib_major_name="lib${PACKAGE_TARNAME}.so.${package_lib_major}"
    lib_short_name="lib${PACKAGE_TARNAME}.so"

    if test "x${ac_cv_cxx_compiler_gnu}" != "xyes"; then
      # Flags for warnings as errors
      cxxflags_warnerror="-xwe -errtags"
      # Flags for Optimise
      cxxflags_optimise="-xO2"
      # Flags for debug
      cxxflags_debug="-g"
    fi

    # Should use -D_REENTRANT - but not yet OK
    PLATFORM_OPTIONS=["${PLATFORM_OPTIONS} -DSOLARIS"]
    SHARED_OPTIONS="-G -DSOLARIS"
    LINK_OPTIONS="-DSOLARIS"
						;;

  *-*-netbsd*)   platform=NETBSD 
    shlibsuffix=.so
    lib_name="lib${PACKAGE_TARNAME}.so.${package_lib_version}"
    lib_major_name="lib${PACKAGE_TARNAME}.so.${package_lib_major}"
    lib_short_name="lib${PACKAGE_TARNAME}.so"

    PLATFORM_OPTIONS=["${PLATFORM_OPTIONS} -DFREEBSD"]
    SHARED_OPTIONS=["-DNETBSD -shared"]
	LINK_OPTIONS=["-DNETBSD"]

    # NetBSD puts packages in /usr/pkg
    CPPFLAGS="${CPPFLAGS} -I/usr/pkg/include"
    LIBS="${LIBS} -L/usr/pkg/lib"
						;;

  *-*-freebsd*)   platform=FREEBSD 
    shlibsuffix=.so
    lib_name="lib${PACKAGE_TARNAME}.so.${package_lib_version}"
    lib_major_name="lib${PACKAGE_TARNAME}.so.${package_version_major}"
    lib_short_name="lib${PACKAGE_TARNAME}.so"

    # Should use -D_REENTRANT - but not yet OK
    PLATFORM_OPTIONS=["${PLATFORM_OPTIONS} -DFREEBSD"]
    SHARED_OPTIONS="-DFREEBSD -shared -pthread -lc_r"
    LINK_OPTIONS="-DFREEBSD -pthread -lc_r"

						;;

  *-*-linux*|*-*-k*bsd*-gnu|*-*-gnu*)     platform=LINUX ;
    shlibsuffix=.so
    lib_name="lib${PACKAGE_TARNAME}.so.${package_lib_version}"
    lib_major_name="lib${PACKAGE_TARNAME}.so.${package_lib_major}"
    lib_short_name="lib${PACKAGE_TARNAME}.so"

    if test "x${ac_cv_cxx_compiler_gnu}" != "xyes"; then
      # Assume Intel CC
      PLATFORM_OPTIONS=["-w1 -mp -prec_div"]
    fi

    # Should use -D_REENTRANT - but not yet OK
    PLATFORM_OPTIONS=["${PLATFORM_OPTIONS} -DLINUX"]
    SHARED_OPTIONS=["-Wl,-soname,\$(LIBMAJORNAME) -DLINUX -shared"]
    LINK_OPTIONS=["-DLINUX -ldl"]

						;;

  *-*-cygwin*)	
    platform=CYGWIN
    shlibsuffix=.dll
    lib_name="cyg${PACKAGE_TARNAME}-${package_lib_version}.dll"
    lib_major_name="lib${PACKAGE_TARNAME}.dll.a"
    lib_short_name="cyg${PACKAGE_TARNAME}.dll"

    # Assume g++
    PLATFORM_OPTIONS=["-Wall"]
    PLATFORM_OPTIONS=["${PLATFORM_OPTIONS} -DCYGWIN"]
    PIC=""
    SHARED_OPTIONS="-Wl,-soname,\$(LIBNAME) -DCYGWIN -shared -Xlinker --warn-once -Xlinker -Map -Xlinker ../lib/lib${PACKAGE_TARNAME}.map -Xlinker --output-def -Xlinker ../lib/lib${PACKAGE_TARNAME}.def -Xlinker --out-implib -Xlinker ../lib/\$(LIBMAJORNAME)"
    LINK_OPTIONS=["-DCYGWIN"]

    # Define installation commands as cygwin uses different defaults
    INSTALL_COMMAND_1=["\$(INSTALL) -d \$(DESTDIR)\${bindir} && \$(INSTALL) \${THISLIB} \$(DESTDIR)\${bindir}"]
    INSTALL_COMMAND_2=["\$(INSTALL) -d \$(DESTDIR)\${libdir} && \$(INSTALL) \$(LIB_DIR)/\$(LIBMAJORNAME) \$(DESTDIR)\${libdir}"]

    # Define this to kill the link commands
    LINK_COMMAND_1=true
    ;;
						
#        *-*-irix*)      platform=IRIX ;;
#        *-*-aix*)       platform=AIX ;;
#        *-*-hp*)        platform=HPUX ;
#                        case "${host}" in
#                            *-*-hpux11*)  osver=HPUX11;;
#                            *-*-hpux10*)  osver=HPUX10;;
#                            *)            osver=HPUX11;;
#                        esac;;
#        *-*-mvs*)       platform=OS390 ;;
#        *-*-osf*)       platform=TRU64 ;;

  *-apple-darwin*)
    platform=MACOSX 
    shlibsuffix=.dylib
    lib_name="lib${PACKAGE_TARNAME}.${package_lib_version}.dylib"
    lib_major_name="lib${PACKAGE_TARNAME}.${package_lib_major}.dylib"
    lib_short_name="lib${PACKAGE_TARNAME}.dylib"

    if test "x${ac_cv_cxx_compiler_gnu}" != "xyes"; then
      # Not sure if these will work - only tested with g++
      PLATFORM_OPTIONS=["-w1 -mp -prec_div"]
    fi

    PLATFORM_OPTIONS=["${PLATFORM_OPTIONS} -DMACOSX"]
    SHARED_OPTIONS=["-Xlinker -install_name -Xlinker \$(LIBNAME) -DMACOSX -dynamiclib"]
    LINK_OPTIONS=["-DMACOSX"]
                        ;;

  *)              platform=UNKNOWN 
    AC_MSG_ERROR([Unknown Platform.  Aborting])
						;;
esac

# Now we should have all compiler specific flags.  So set up specific flags
# we need

# First if we are using gcc then...
if test "x${ac_cv_cxx_compiler_gnu}" = "xyes" ; then

  CXXFLAGS=["${CXXFLAGS} ${PLATFORM_OPTIONS} -Wall"]

  if test "$enable_debug" = "yes" ; then
	CXXFLAGS="${CXXFLAGS} -g"
  else
	CXXFLAGS="${CXXFLAGS} -O2 -DNDEBUG"
  fi

  if test "x${enable_warnerror}" = "xyes" ; then
    AC_MSG_WARN([Enabling error on warnings])
	CXXFLAGS="${CXXFLAGS} -Werror -Wno-deprecated"
  fi
else

  if test "$enable_debug" = "yes" ; then
	CXXFLAGS="${CXXFLAGS} ${cxxflags_debug}"
  else
	CXXFLAGS="${CXXFLAGS} ${cxxflags_optimise} -DNDEBUG"
  fi

  if test "x${enable_warnerror}" = "xyes" ; then
    AC_MSG_WARN([Enabling error on warnings])
	CXXFLAGS="${CXXFLAGS} ${cxxflags_warnerror}"
  fi

fi

# How do we run the C++ compiler?
CC1=["${CXX} ${CXXFLAGS}"]
# Command to make the shared library
MAKE_SHARED=["${CXX} ${CXXFLAGS} ${SHARED_OPTIONS}"]
# Command to link an executable
LINK=["${CXX} ${CXXFLAGS} ${LINK_OPTIONS}"]

# Default commands to create the library in the correct place

if test -z "$LINK_COMMAND_1" ; then 
    LINK_COMMAND_1=["(cd \$(LIB_DIR) ; rm -f \$(LIBMAJORNAME) ; \$(LN_S) \$(LIBNAME) \$(LIBMAJORNAME))"]
    LINK_COMMAND_2=["(cd \$(LIB_DIR) ; rm -f \$(LIBSHORTNAME) ; \$(LN_S) \$(LIBNAME) \$(LIBSHORTNAME))"]
fi

# Default commands to install

if test -z "$INSTALL_COMMAND_1" ; then
    INSTALL_COMMAND_1=["\$(INSTALL) -d \$(DESTDIR)\${libdir} && \$(INSTALL) \${THISLIB} \$(DESTDIR)\${libdir}"]
    INSTALL_COMMAND_2=["\$(RM) \$(DESTDIR)\${libdir}/\${LIBMAJORNAME} && \$(LN_S) \${LIBNAME} \$(DESTDIR)\${libdir}/\${LIBMAJORNAME}"]
    INSTALL_COMMAND_3=["\$(RM) \$(DESTDIR)\${libdir}/\${LIBSHORTNAME} && \$(LN_S) \${LIBNAME} \$(DESTDIR)\${libdir}/\${LIBSHORTNAME}"]
fi


# Find Xerces

# Check for Xerces using XERCESCROOT (override any system version)

AC_LANG(C++)

if test $XERCESCROOT; then

  OLDCPPFLAGS=$CPPFLAGS
  CPPFLAGS=["${CPPFLAGS} -I${XERCESCROOT}/include"]

  AC_MSG_CHECKING([for Xerces 2.x or 3.x headers in XERCESCROOT/include])
  AC_TRY_RUN([#include <xercesc/util/XercesVersion.hpp>
    int main(int argc, char **argv) {
      if (XERCES_VERSION_MAJOR < 2)
        return 1;
      else
        return 0;
    }],
    xerces_lib_base=${XERCESCROOT}
    xerces_found=yes
    [AC_MSG_RESULT([found])],
    CPPFLAGS=$OLD_CPPFLAGS
    [AC_MSG_RESULT([no])])

fi

if test -z $xerces_found ; then

  # Xerces was not found

  AC_MSG_CHECKING([for Xerces 2.x or 3.x headers in system includes])

  AC_TRY_RUN([#include <xercesc/util/XercesVersion.hpp>
    int main(int argc, char **argv) {
      if (XERCES_VERSION_MAJOR < 2)
        return 1;
      else
        return 0;
    }],
    [AC_MSG_RESULT([found])],
    [AC_MSG_ERROR([Xerces 2.0 not found.  Ensure XERCESCROOT points to base directory of Xerces and Xerces 2.0 or later is available])])

fi

# Where is the Xerces lib?
AC_MSG_CHECKING([for Xerces 2.x or 3.x library naming convention])
OLD_LIBS=$LIBS
if test -z xerces_lib_base; then
  LIBS="${LIBS} -lxerces-c"
else
  LIBS="-L${xerces_lib_base}/lib -lxerces-c ${LIBS}"
fi

AC_TRY_LINK([#include <xercesc/util/PlatformUtils.hpp>],
   [XERCES_CPP_NAMESPACE_USE XMLPlatformUtils::Initialize(); return 0; ],
   [AC_MSG_RESULT([xerces-c])]
   xerceslib_found=yes,
   [LIBS=$OLD_LIBS])

if test -z $xerceslib_found; then
  if test -z xerces_lib_base; then
    LIBS="${LIBS} -lxerces-3.0"
  else
    LIBS="-L${xerces_lib_base}/lib -lxerces-3.0 ${LIBS}"
  fi

  AC_TRY_LINK([#include <xercesc/util/PlatformUtils.hpp>],
     [XERCES_CPP_NAMESPACE_USE XMLPlatformUtils::Initialize(); return 0; ],
     [AC_MSG_RESULT([xerces-3.0])]
     xerceslib_found=yes,
     [AC_MSG_RESULT([unable to determine])]
     [AC_MSG_ERROR([cannot link to Xerces library])])
fi

# Find out some properties of the version of Xerces we have

AC_MSG_CHECKING([whether Xerces XMLFormatter requires a version])

AC_TRY_COMPILE([#include <xercesc/framework/XMLFormatter.hpp>
	#include <xercesc/util/XercesDefs.hpp>
	#include <xercesc/util/XMLUniDefs.hpp>],
	[using namespace XERCES_CPP_NAMESPACE;
	  XMLCh s_encoding[] = {
		chLatin_U, chLatin_T, chLatin_F, chDash, chDigit_8, chNull
	  };
	  XMLFormatter f(s_encoding,
		NULL,
		NULL, 
		XMLFormatter::NoEscapes, 
		XMLFormatter::UnRep_CharRef);
	],
	[AC_MSG_RESULT([yes])]
	[AC_DEFINE(XSEC_XERCES_REQUIRES_MEMMGR)]
	[AC_DEFINE(XSEC_XERCES_FORMATTER_REQUIRES_VERSION)],
	[AC_MSG_RESULT([no])])
	
AC_MSG_CHECKING([whether Xerces XMLString has ::release])

AC_TRY_COMPILE([#include <xercesc/util/XMLString.hpp>],
	[using namespace XERCES_CPP_NAMESPACE;
		XMLCh * tst;
		XMLString::release(&tst);
	],
	[AC_MSG_RESULT([yes])]
	[AC_DEFINE(XSEC_XERCES_XMLSTRING_HAS_RELEASE)],
	[AC_MSG_RESULT([no])])

AC_MSG_CHECKING([whether Xerces XMLElement has ::setIdAttribute(XMLCh*)])

AC_TRY_COMPILE([#include <xercesc/dom/DOM.hpp>],
	[using namespace XERCES_CPP_NAMESPACE;
		DOMElement * elt;
		elt->setIdAttribute(NULL);
	],
	[AC_MSG_RESULT([yes])]
    xerces_has_setidattribute=yes
	[AC_DEFINE(XSEC_XERCES_HAS_SETIDATTRIBUTE)],
	[AC_MSG_RESULT([no])])

if test -z $xerces_has_setidattribute; then

  AC_MSG_CHECKING([whether Xerces XMLElement has ::setIdAttribute(XMLCh*, bool)])
  AC_TRY_COMPILE([#include <xercesc/dom/DOM.hpp>],
	  [using namespace XERCES_CPP_NAMESPACE;
		  DOMElement * elt;
		  elt->setIdAttribute(NULL, false);
	  ],
	  [AC_MSG_RESULT([yes])]
      xerces_has_setidattribute=yes
	  [AC_DEFINE(XSEC_XERCES_HAS_BOOLSETIDATTRIBUTE)],
	  [AC_MSG_RESULT([no])])

fi

# For Xerces 3.x we now have a stricter DOM L3 implementation
AC_MSG_CHECKING([whether Xerces DOMImplementationLS has DOMLSSerializer])

AC_TRY_COMPILE([#include <xercesc/dom/DOM.hpp>],
    [using namespace XERCES_CPP_NAMESPACE;
        DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(NULL);
        DOMLSSerializer *ls = ((DOMImplementationLS*)impl)->createLSSerializer();
    ],
    [AC_MSG_RESULT([yes])]
    [AC_DEFINE(XSEC_XERCES_DOMLSSERIALIZER)],
    [AC_MSG_RESULT([no])])

AC_MSG_CHECKING([whether Xerces DOMEntity uses getInputEncoding()])

AC_TRY_COMPILE([#include <xercesc/dom/DOM.hpp>],
    [using namespace XERCES_CPP_NAMESPACE;
        DOMEntity *t;
        t->getInputEncoding();
    ],
    [AC_MSG_RESULT([yes])]
    [AC_DEFINE(XSEC_XERCES_DOMENTITYINPUTENCODING)],
    [AC_MSG_RESULT([no])])


# Now check for Xalan

if test x"$use_xalan" != x"no" ; then

  if test $XALANCROOT; then

    AC_MSG_CHECKING([for Xalan headers in XALANCROOT])

    OLD_CPPFLAGS=$CPPFLAGS
    # Updated to include nls/include as this is generally needed for
    # compilation against non-installed xalan.
    # Also now include XALANCROOT/include to cater for installed xalan
    CPPFLAGS=["-I${XALANCROOT}/src -I${XALANCROOT}/include -I${XALANCROOT}/nls/include ${CPPFLAGS}"]

    AC_TRY_CPP([#include <xalanc/Include/XalanVersion.hpp>], 
      xalan_found=yes 
      LIBS="-L${XALANCROOT}/lib -lxalan-c ${LIBS}"
      [AC_MSG_RESULT([found])], 
      CPPFLAGS=$OLD_CPPFLAGS
      [AC_MSG_RESULT([no])]);

  fi

  if test -z $xalan_found ; then

    AC_MSG_CHECKING([for Xalan in system includes])
    AC_TRY_CPP([#include <xalanc/Include/XalanVersion.hpp>], 
      xalan_found=yes 
      LIBS="${LIBS} -lxalan-c"
      [AC_MSG_RESULT([found])],
      [AC_DEFINE(XSEC_NO_XALAN)] 
      [AC_MSG_RESULT([no - WARNING - configuring for no Xalan])]);

  fi

else

  # NO_XALAN is defined - so we skip

  AC_MSG_NOTICE([Warning - Xalan being configured out - XPath and XSLT will not be available])
  AC_DEFINE(XSEC_NO_XALAN)

fi

if test "${xalan_found}" = "yes" ; then
  # Do we need xalanMsg.so?
  AC_MSG_CHECKING([if libxalanMsg is required])
  old_libs=$LIBS
  LIBS="${LIBS} -lxalanMsg"
  AC_TRY_LINK([],[
    int test=1;
  ],
  AC_MSG_RESULT([yes]),
  AC_MSG_RESULT([no])
  LIBS=${old_libs});
fi

# Check for handling of XSLException types
if test "$xalan_found" = "yes" ; then

  AC_MSG_CHECKING([whether XSLException::getType() returns XalanDOMString])

  AC_TRY_COMPILE([#include <xalanc/PlatformSupport/XSLException.hpp>], 
    [ try {
          int x = 1;
      } 
      catch (XALAN_CPP_NAMESPACE_QUALIFIER XSLException &e) {
        e.getType().c_str();
      }
    ],
    AC_DEFINE(XSEC_XSLEXCEPTION_RETURNS_DOMSTRING)
    [AC_MSG_RESULT([yes])], 
    [AC_MSG_RESULT([no])]);

  AC_MSG_CHECKING([whether XercesParserLiaison ctor takes XercesDOMSupport])

  AC_TRY_COMPILE([#include <xalanc/XercesParserLiaison/XercesDOMSupport.hpp>
    #include <xalanc/XercesParserLiaison/XercesParserLiaison.hpp>],
	[ 	XALAN_CPP_NAMESPACE_QUALIFIER XercesDOMSupport 
           theDOMSupport;
	    XALAN_CPP_NAMESPACE_QUALIFIER XercesParserLiaison 
           theParserLiaison(theDOMSupport);
	],
	AC_DEFINE(XSEC_XERCESPARSERLIAISON_REQS_DOMSUPPORT)
	[AC_MSG_RESULT([yes])],
	[AC_MSG_RESULT([no])]);

  AC_MSG_CHECKING([whether XPathEvaluator::selectNodeList reqs NodeRefList])

  AC_TRY_COMPILE([#include <xalanc/XercesParserLiaison/XercesDOMSupport.hpp>
	#include <xalanc/XPath/XPathEvaluator.hpp>
	#include <xalanc/XPath/NodeRefList.hpp>
    #include <xalanc/XercesParserLiaison/XercesParserLiaison.hpp>],
	[ 	XALAN_CPP_NAMESPACE_QUALIFIER XercesDOMSupport 
           theDOMSupport;
		XALAN_CPP_NAMESPACE_QUALIFIER XPathEvaluator	theEvaluator;
		XALAN_CPP_NAMESPACE_QUALIFIER NodeRefList	theResult(
			theEvaluator.selectNodeList(
			theDOMSupport,
			NULL,
			NULL,
			NULL));
	],
	[AC_MSG_RESULT([no])],
	AC_DEFINE(XSEC_SELECTNODELIST_REQS_NODEREFLIST)
	[AC_MSG_RESULT([yes])]);

  AC_MSG_CHECKING([whether Xalan classes req MemoryManager])

  AC_TRY_COMPILE([
 	#include <xalanc/XPath/XPathDefinitions.hpp>
    #include <xalanc/XPath/Function.hpp>],
    [
    }
	XALAN_CPP_NAMESPACE_BEGIN

	class FunctionTest : public Function
	{
		public:
 	       typedef Function        ParentType;

    	    FunctionTest();

        	virtual ~FunctionTest();      
	        virtual XObjectPtr
    	    execute(
        	   XPathExecutionContext& executionContext,
               XalanNode* context,
               const XObjectArgVectorType& args,
               const LocatorType* locator) const;

            XObjectPtr
            execute(
                XPathExecutionContext&          executionContext,
                XalanNode*                                      context,
                const XObjectPtr                        arg1,
                const XObjectPtr                        arg2,
                const LocatorType*                      locator) const;

            XObjectPtr
            execute(
                XPathExecutionContext&          executionContext,
                XalanNode*                                      context,
                   
                const XObjectPtr                        arg1,
                const XObjectPtr                        arg2,
                const XObjectPtr                        arg3,
                const LocatorType*                      locator) const;

	#if !defined(XALAN_NO_USING_DECLARATION)
        using ParentType::execute;
	#endif

	#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
        virtual Function*
	#else
        virtual FunctionTest*
	#endif
        clone() const;

	protected:

        virtual const XalanDOMString
        getError() const;

    private:

        // Not implemented...
        FunctionTest&
        operator=(const FunctionTest&);

        bool
        operator==(const FunctionTest&) const;
	};

  void main2(void){

	FunctionTest t;

  }

XALAN_CPP_NAMESPACE_END
  int main3(void) {

	],
	[AC_MSG_RESULT([no])],
	AC_DEFINE(XSEC_XALAN_REQS_MEMORYMANAGER)
	[AC_MSG_RESULT([yes])]);

fi

# AC_LANG(C)

# Check for OpenSSL
if test $OPENSSL ; then

# First check includes

AC_MSG_CHECKING([for OpenSSL headers in $OPENSSL])

OLD_CPPFLAGS=$CPPFLAGS
CPPFLAGS=["${CPPFLAGS} -I${OPENSSL}/include"]

AC_TRY_CPP([#include <openssl/opensslv.h>], 
   openssl_found=yes 
   AC_DEFINE(HAVE_OPENSSL)
   [AC_MSG_RESULT([found])], 
   [AC_MSG_ERROR(["Unable to find OpenSSL headers"])]);

# Now check libs
# Note we keep both the base OPENSSL dir and /lib to handle
# both an installed version or a source dir

OLD_LIBS=$LIBS
LIBS=["${LIBS} -L${OPENSSL} -lcrypto"]

# As of 1.3 - use AC_TRY_LINK to check as AC_CHECK_LIB does
# the wrong thing

AC_MSG_CHECKING([for libcrypto])
AC_TRY_LINK([#include <openssl/evp.h>],
   [EVP_EncryptInit(NULL, NULL, NULL, NULL) ; return 0; ],
   [AC_MSG_RESULT([found])]
   openssllib_found=yes,
   [LIBS=$OLD_LIBS])

   if test -z $openssllib_found ; then

   LIBS=["${LIBS} -L${OPENSSL}/lib -lcrypto"]
   AC_TRY_LINK([#include <openssl/evp.h>],
     [EVP_EncryptInit(NULL, NULL, NULL, NULL) ; return 0; ],
      [AC_MSG_RESULT([found])]
      openssllib_found=yes,
      [LIBS=$OLD_LIBS]
          [AC_MSG_RESULT([no])]
	  [AC_MSG_ERROR(["Unable to find libcrypto"])])

  fi

fi

if test -z $openssl_found ; then

    AC_PATH_PROG(PKG_CONFIG, pkg-config)
    if test "x$PKG_CONFIG" != x && test "x$PKG_CONFIG" != "xno" ; then
        if pkg-config openssl ; then
            CPPFLAGS="$CPPFLAGS `$PKG_CONFIG --cflags openssl`"
            LIBS="$LIBS `$PKG_CONFIG --libs openssl`"
        else
            AC_MSG_WARN([OpenSSL not supported by pkg-config, using default settings])
            LIBS="${LIBS} -lcrypto"
        fi
    else
        LIBS="${LIBS} -lcrypto"
    fi

    AC_MSG_CHECKING([for OpenSSL in system includes])
    AC_TRY_CPP([#include <openssl/opensslv.h>], 
       openssl_found=yes 
       AC_DEFINE(HAVE_OPENSSL)
       [AC_MSG_RESULT([found])],
       [AC_MSG_RESULT([no])]
       [AC_MSG_ERROR([OpenSSL header files not found.  Please define OPENSSL])]);

fi

# Now try to find out some things about this version of OpenSSL

AC_LANG(C++)

AC_MSG_CHECKING([for const input buffers in OpenSSL])
AC_TRY_COMPILE([#include <openssl/rsa.h>],
	[ const unsigned char * buf;
	  unsigned char * outbuf;
	  RSA rsa;

		RSA_private_decrypt(1,
							buf,
							outbuf,
							&rsa,
							RSA_PKCS1_PADDING);

	],
	[AC_MSG_RESULT([yes])]
	[AC_DEFINE(XSEC_OPENSSL_CONST_BUFFERS)],
	[AC_MSG_RESULT([no])])

# Check for full strength AES - Solaris 10 install is broken
# and only supports low end AES.  As the library does not have
# this granularity, we have to disable AES in this instance.

# AC_CHECK_DECL(EVP_aes_256_cbc,
# 	[AC_DEFINE(XSEC_OPENSSL_HAVE_AES)],
# 	,[#include <openssl/evp.h>])

AC_MSG_CHECKING([for non-broken AES support])
AC_TRY_LINK([#include <openssl/evp.h>],
	[ EVP_aes_256_cbc();
	],
	[AC_MSG_RESULT([yes])]
	[AC_DEFINE(XSEC_OPENSSL_HAVE_AES)],
	[AC_MSG_RESULT([no])])

AC_CHECK_DECL(EVP_CIPHER_CTX_set_padding,
	[AC_DEFINE(XSEC_OPENSSL_CANSET_PADDING)],
	,[#include <openssl/evp.h>])

AC_CHECK_DECL(CRYPTO_cleanup_all_ex_data,
	[AC_DEFINE(XSEC_OPENSSL_HAVE_CRYPTO_CLEANUP_ALL_EX_DATA)],
	,[#include <openssl/crypto.h>])

AC_MSG_CHECKING([for const input buffer in loadX509Base64Bin])
AC_TRY_COMPILE([#include <openssl/x509.h>],
	[ const unsigned char * buf;
	  d2i_X509(NULL, &buf, 1);
	],
	[AC_MSG_RESULT([yes])]
	[AC_DEFINE(XSEC_OPENSSL_D2IX509_CONST_BUFFER)],
	[AC_MSG_RESULT([no])])

# String functions
AC_CHECK_DECL(_strdup,
	[AC_DEFINE(XSEC_HAVE__STRDUP)],
	,[#include <string.h>])

AC_CHECK_DECL(_stricmp,
	[AC_DEFINE(XSEC_HAVE__STRDUP)],
	,[#include <string.h>])

AC_CHECK_DECL(_getcwd,
	[AC_DEFINE(XSEC_HAVE__GETCWD)],
	,[#include <string.h>])

AC_CHECK_DECL(_getcwd,
	[AC_DEFINE(XSEC_HAVE__GETCWD)],
	,[#include <string.h>])

AC_CHECK_DECL(stricmp,
	[AC_DEFINE(XSEC_HAVE_STRICMP)],
	,[#include <string.h>])

AC_CHECK_DECL(strcasecmp,
	[AC_DEFINE(XSEC_HAVE_STRCASECMP)],
	,[#include <string.h>])

# Populate Install directories

AC_SUBST(prefix)
AC_SUBST(exec_prefix)
AC_SUBST(includedir)
AC_SUBST(libdir)
AC_SUBST(bindir)

# Populate special platform specific make commands

AC_SUBST(LINK_COMMAND_1)
AC_SUBST(LINK_COMMAND_2)
AC_SUBST(INSTALL_COMMAND_1)
AC_SUBST(INSTALL_COMMAND_2)
AC_SUBST(INSTALL_COMMAND_3)

# Now populate the platform and Compiler related variables.

AC_SUBST(platform)

cxx=${CXX}
AC_SUBST(cxx)

cc=${CC}
AC_SUBST(cc)

AC_SUBST(prefix)
AC_SUBST(osver)

cxxflags=${CXXFLAGS}
AC_SUBST(cxxflags)

cppflags=${CPPFLAGS}
AC_SUBST(cppflags)

cflags=${CFLAGS}
AC_SUBST(cflags)

ldflags=${LDFLAGS}
AC_SUBST(ldflags)

libs=${LIBS}
AC_SUBST(libs)

transcoder=${TRANSCODER}
AC_SUBST(transcoder)

threads=${THREADS}
AC_SUBST(threads)

bitstobuild=${BITSTOBUILD}
AC_SUBST(bitstobuild)

cc1=${CC1}
AC_SUBST(cc1)

cc4=${CC4}
AC_SUBST(cc4)

ln_s=${LN_S}
AC_SUBST(ln_s)

install=${INSTALL}
install_data=${INSTALL_DATA}

AC_SUBST(install)
AC_SUBST(install_data)

make_shared=${MAKE_SHARED}
AC_SUBST(make_shared)

link=${LINK}
AC_SUBST(link)

AC_SUBST(objsuffix)
AC_SUBST(shlibsuffix)

# Populate the Makefile conditionals
AM_CONDITIONAL(XSEC_AM_HAVE_OPENSSL, test x$openssl_found = xyes)

# Versioning
package_version=${PACKAGE_VERSION}
package_libtool_version="${package_version_major}${package_version_medium}:${package_version_minor}"
AC_SUBST(package_version)
AC_SUBST(package_version_major)
AC_SUBST(package_libtool_version)
AC_DEFINE_UNQUOTED(XSEC_VERSION, "$package_version")
AC_DEFINE_UNQUOTED(XSEC_VERSION_MAJOR, $package_version_major)
AC_DEFINE_UNQUOTED(XSEC_VERSION_MEDIUM, $package_version_medium)
AC_DEFINE_UNQUOTED(XSEC_VERSION_MINOR, $package_version_minor)

package_name=${PACKAGE_NAME}
AC_SUBST(package_name)
package_tarname=${PACKAGE_TARNAME}
AC_SUBST(package_tarname)

# Library names
AC_SUBST(lib_name)
AC_SUBST(lib_major_name)
AC_SUBST(lib_short_name)

# output the Makefiles
AC_OUTPUT()