aboutsummaryrefslogtreecommitdiffstats
path: root/configure.in
blob: 48c3d2e0b013d9ac8aded3c89a9b5a147f2f004f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
dnl  configure.in for linux strongSwan
dnl  Copyright (C) 2006 Martin Willi
dnl  Hochschule fuer Technik Rapperswil
dnl 
dnl  This program is free software; you can redistribute it and/or modify it
dnl  under the terms of the GNU General Public License as published by the
dnl  Free Software Foundation; either version 2 of the License, or (at your
dnl  option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
dnl 
dnl  This program is distributed in the hope that it will be useful, but
dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
dnl  for more details.

dnl ===========================
dnl  initialize & set some vars
dnl ===========================

AC_INIT(strongSwan,4.3.1)
AM_INIT_AUTOMAKE(tar-ustar)
AC_SUBST(confdir, '${sysconfdir}')
PKG_PROG_PKG_CONFIG

dnl =================================
dnl  check --enable-xxx & --with-xxx
dnl =================================

AC_ARG_WITH(
	[default-pkcs11],
	AS_HELP_STRING([--with-default-pkcs11=lib],[set the default PKCS11 library other than "/usr/lib/opensc-pkcs11.so"]),
	[AC_DEFINE_UNQUOTED(PKCS11_DEFAULT_LIB, "$withval")],
	[AC_DEFINE_UNQUOTED(PKCS11_DEFAULT_LIB, "/usr/lib/opensc-pkcs11.so")]
)

AC_ARG_WITH(
	[xauth-module],
	AS_HELP_STRING([--with-xauth-module=lib],[set the path to the XAUTH module]),
	[AC_DEFINE_UNQUOTED(XAUTH_DEFAULT_LIB, "$withval")],
)

AC_ARG_WITH(
	[random-device],
	AS_HELP_STRING([--with-random-device=dev],[set the device for real random data other than "/dev/random"]),
	[AC_DEFINE_UNQUOTED(DEV_RANDOM, "$withval")],
	[AC_DEFINE_UNQUOTED(DEV_RANDOM, "/dev/random")]
)
AC_ARG_WITH(
	[resolv-conf],
	AS_HELP_STRING([--with-resolv-conf=file],[set the file to use in DNS handler plugin other than "sysconfdir/resolv.conf"]),
	[AC_SUBST(resolv_conf, "$withval")],
	[AC_SUBST(resolv_conf, "${sysconfdir}/resolv.conf")]
)

AC_ARG_WITH(
	[strongswan-conf],
	AS_HELP_STRING([--with-strongswan-conf=file],[strongswan.conf file other than "sysconfdir/strongswan.conf"]),
	[AC_SUBST(strongswan_conf, "$withval")],
	[AC_SUBST(strongswan_conf, "${sysconfdir}/strongswan.conf")]
)

AC_ARG_WITH(
	[urandom-device],
	AS_HELP_STRING([--with-urandom-device=dev],[set the device for pseudo random data other than "/dev/urandom"]),
	[AC_DEFINE_UNQUOTED(DEV_URANDOM, "$withval")],
	[AC_DEFINE_UNQUOTED(DEV_URANDOM, "/dev/urandom")]
)

AC_ARG_WITH(
	[piddir],
	AS_HELP_STRING([--with-piddir=dir],[path for PID and UNIX socket files other than "/var/run"]),
	[AC_SUBST(piddir, "$withval")],
	[AC_SUBST(piddir, "/var/run")]
)

AC_ARG_WITH(
	[ipsecdir],
	AS_HELP_STRING([--with-ipsecdir=dir],[installation path for ipsec tools other than "libexecdir/ipsec"]),
	[AC_SUBST(ipsecdir, "$withval")],
	[AC_SUBST(ipsecdir, "${libexecdir%/}/ipsec")]
)
AC_SUBST(plugindir, "${ipsecdir%/}/plugins")

AC_ARG_WITH(
	[plugindir],
	AS_HELP_STRING([--with-plugindir=dir],[installation path for plugins other than "ipsecdir/plugins"]),
	[AC_SUBST(plugindir, "$withval")],
	[AC_SUBST(plugindir, "${ipsecdir%/}/plugins")]
)

AC_ARG_WITH(
	[sim-reader],
	AS_HELP_STRING([--with-sim-reader=library.so],[library containing the sim_run_alg()/sim_get_triplet() function for EAP-SIM]),
	[AC_SUBST(simreader, "$withval")],
	[AC_SUBST(simreader, "${plugindir%/}/libeapsim-file.so")]
)

AC_ARG_WITH(
	[linux-headers],
	AS_HELP_STRING([--with-linux-headers=dir],[use the linux header files in dir instead of the supplied ones in "src/include"]),
	[AC_SUBST(linuxdir, "$withval")], [AC_SUBST(linuxdir, "\${top_srcdir}/src/include")]
)
AC_SUBST(LINUX_HEADERS)

AC_ARG_WITH(
	[routing-table],
	AS_HELP_STRING([--with-routing-table=num],[use routing table for IPsec routes (default: 220)]),
	[AC_DEFINE_UNQUOTED(IPSEC_ROUTING_TABLE, $withval) AC_SUBST(IPSEC_ROUTING_TABLE, "$withval")], 
	[AC_DEFINE_UNQUOTED(IPSEC_ROUTING_TABLE, 220) AC_SUBST(IPSEC_ROUTING_TABLE, "220")]
)

AC_ARG_WITH(
	[routing-table-prio],
	AS_HELP_STRING([--with-routing-table-prio=prio],[priority for IPsec routing table (default: 220)]),
	[AC_DEFINE_UNQUOTED(IPSEC_ROUTING_TABLE_PRIO, $withval) AC_SUBST(IPSEC_ROUTING_TABLE_PRIO, "$withval")], 
	[AC_DEFINE_UNQUOTED(IPSEC_ROUTING_TABLE_PRIO, 220) AC_SUBST(IPSEC_ROUTING_TABLE_PRIO, "220")]
)

AC_ARG_WITH(
	[uid],,[AC_MSG_ERROR([--with-uid is gone, use --with-user instead!])]
)

AC_ARG_WITH(
	[gid],,[AC_MSG_ERROR([--with-gid is gone, use --with-group instead!])]
)

AC_ARG_WITH(
	[user],
	AS_HELP_STRING([--with-user=user],[change user of the daemons to "user" after startup (default is 0).]),
	[AC_DEFINE_UNQUOTED(IPSEC_USER, "$withval") AC_SUBST(ipsecuser, "$withval")],
	[AC_SUBST(ipsecuser, "root")]
)

AC_ARG_WITH(
	[group],
	AS_HELP_STRING([--with-group=group],[change group of the daemons to "group" after startup (default is 0).]),
	[AC_DEFINE_UNQUOTED(IPSEC_GROUP, "$withval") AC_SUBST(ipsecgroup, "$withval")],
	[AC_SUBST(ipsecgroup, "root")]
)

dnl Will be extended to --with-capabilities=libcap|libcap2
AC_ARG_WITH(
	[capabilities],
	AS_HELP_STRING([--with-capabilities=libcap],[capability dropping using libcap. Currenlty only the value "libcap" is supported (default is NO).]),
	[capabilities="$withval"],
	[capabilities=no]
)

AC_ARG_ENABLE(
	[curl],
	AS_HELP_STRING([--enable-curl],[enable CURL fetcher plugin to fetch files via libcurl (default is NO). Requires libcurl.]),
	[if test x$enableval = xyes; then
		curl=true
	fi]
)

AC_ARG_ENABLE(
	[ldap],
	AS_HELP_STRING([--enable-ldap],[enable LDAP fetching plugin to fetch files via libldap (default is NO). Requires openLDAP.]),
	[if test x$enableval = xyes; then
		ldap=true
	fi]
)

AC_ARG_ENABLE(
	[aes],
	AS_HELP_STRING([--disable-aes],[disable own AES software implementation plugin. (default is NO).]),
	[if test x$enableval = xyes; then
		aes=true
	 else
		aes=false
	fi],
	aes=true
)

AC_ARG_ENABLE(
	[des],
	AS_HELP_STRING([--disable-des],[disable own DES/3DES software implementation plugin. (default is NO).]),
	[if test x$enableval = xyes; then
		des=true
	 else
		des=false
	fi],
	des=true
)

AC_ARG_ENABLE(
	[md4],
	AS_HELP_STRING([--enable-md4],[enable MD4 software implementation plugin (default is NO).]),
	[if test x$enableval = xyes; then
		md4=true
	fi]
)

AC_ARG_ENABLE(
	[md5],
	AS_HELP_STRING([--disable-md5],[disable own MD5 software implementation plugin. (default is NO).]),
	[if test x$enableval = xyes; then
		md5=true
	 else
		md5=false
	fi],
	md5=true
)

AC_ARG_ENABLE(
	[sha1],
	AS_HELP_STRING([--disable-sha1],[disable own SHA1 software implementation plugin. (default is NO).]),
	[if test x$enableval = xyes; then
		sha1=true
	 else
		sha1=false
	fi],
	sha1=true
)

AC_ARG_ENABLE(
	[sha2],
	AS_HELP_STRING([--disable-sha2],[disable own SHA256/SHA384/SHA512 software implementation plugin. (default is NO).]),
	[if test x$enableval = xyes; then
		sha2=true
	 else
		sha2=false
	fi],
	sha2=true
)

AC_ARG_ENABLE(
	[fips-prf],
	AS_HELP_STRING([--disable-fips-prf],[disable FIPS PRF software implementation plugin. (default is NO).]),
	[if test x$enableval = xyes; then
		fips_prf=true
	 else
		fips_prf=false
	fi],
	fips_prf=true
)

AC_ARG_ENABLE(
	[gmp],
	AS_HELP_STRING([--disable-gmp],[disable own GNU MP (libgmp) based crypto implementation plugin. (default is NO).]),
	[if test x$enableval = xyes; then
		gmp=true
	 else
		gmp=false
	fi],
	gmp=true
)

AC_ARG_ENABLE(
	[random],
	AS_HELP_STRING([--disable-random],[disable RNG implementation on top of /dev/(u)random. (default is NO).]),
	[if test x$enableval = xyes; then
		random=true
	 else
		random=false
	fi],
	random=true
)

AC_ARG_ENABLE(
	[x509],
	AS_HELP_STRING([--disable-x509],[disable own X509 certificate implementation plugin. (default is NO).]),
	[if test x$enableval = xyes; then
		x509=true
	 else
		x509=false
	fi],
	x509=true
)

AC_ARG_ENABLE(
	[pubkey],
	AS_HELP_STRING([--disable-pubkey],[disable RAW public key support plugin. (default is NO).]),
	[if test x$enableval = xyes; then
		pubkey=true
	 else
		pubkey=false
	fi],
	pubkey=true
)

AC_ARG_ENABLE(
	[hmac],
	AS_HELP_STRING([--disable-hmac],[disable HMAC crypto implementation plugin. (default is NO).]),
	[if test x$enableval = xyes; then
		hmac=true
	 else
		hmac=false
	fi],
	hmac=true
)

AC_ARG_ENABLE(
	[xcbc],
	AS_HELP_STRING([--disable-xcbc],[disable xcbc crypto implementation plugin. (default is NO).]),
	[if test x$enableval = xyes; then
		xcbc=true
	 else
		xcbc=false
	fi],
	xcbc=true
)

AC_ARG_ENABLE(
	[mysql],
	AS_HELP_STRING([--enable-mysql],[enable MySQL database support (default is NO). Requires libmysqlclient_r.]),
	[if test x$enableval = xyes; then
		mysql=true
	fi]
)

AC_ARG_ENABLE(
	[sqlite],
	AS_HELP_STRING([--enable-sqlite],[enable SQLite database support (default is NO). Requires libsqlite3.]),
	[if test x$enableval = xyes; then
		sqlite=true
	fi]
)

AC_ARG_ENABLE(
	[stroke],
	AS_HELP_STRING([--disable-stroke],[disable charons stroke (pluto compatibility) configuration backend. (default is NO).]),
	[if test x$enableval = xyes; then
		stroke=true
	 else
		stroke=false
	fi],
	stroke=true
)

AC_ARG_ENABLE(
	[medsrv],
	AS_HELP_STRING([--enable-medsrv],[enable mediation server web frontend and daemon plugin (default is NO).]),
	[if test x$enableval = xyes; then
		medsrv=true
	fi]
)

AC_ARG_ENABLE(
	[medcli],
	AS_HELP_STRING([--enable-medcli],[enable mediation client configuration database plugin (default is NO).]),
	[if test x$enableval = xyes; then
		medcli=true
	fi]
)

AC_ARG_ENABLE(
	[smp],
	AS_HELP_STRING([--enable-smp],[enable SMP configuration and control interface (default is NO). Requires libxml.]),
	[if test x$enableval = xyes; then
		smp=true
	fi]
)

AC_ARG_ENABLE(
	[sql],
	AS_HELP_STRING([--enable-sql],[enable SQL database configuration backend (default is NO).]),
	[if test x$enableval = xyes; then
		sql=true
	fi]
)

AC_ARG_ENABLE(
	[smartcard],
	AS_HELP_STRING([--enable-smartcard],[enable smartcard support (default is NO).]),
	[if test x$enableval = xyes; then
		smartcard=true
	fi]
)

AC_ARG_ENABLE(
	[cisco-quirks],
	AS_HELP_STRING([--enable-cisco-quirks],[enable support of Cisco VPN client (default is NO).]),
	[if test x$enableval = xyes; then
		cisco_quirks=true
	fi]
)

AC_ARG_ENABLE(
	[leak-detective],
	AS_HELP_STRING([--enable-leak-detective],[enable malloc hooks to find memory leaks (default is NO).]),
	[if test x$enableval = xyes; then
		leak_detective=true
	fi]
)

AC_ARG_ENABLE(
	[lock-profiler],
	AS_HELP_STRING([--enable-lock-profiler],[enable lock/mutex profiling code (default is NO).]),
	[if test x$enableval = xyes; then
		lock_profiler=true
	fi]
)

AC_ARG_ENABLE(
	[unit-tests],
	AS_HELP_STRING([--enable-unit-tests],[enable unit tests on IKEv2 daemon startup (default is NO).]),
	[if test x$enableval = xyes; then
		unittest=true
	fi]
)

AC_ARG_ENABLE(
	[load-tests],
	AS_HELP_STRING([--enable-load-tests],[enable load testing plugin for IKEv2 daemon (default is NO).]),
	[if test x$enableval = xyes; then
		loadtest=true
	fi]
)

AC_ARG_ENABLE(
	[eap-sim],
	AS_HELP_STRING([--enable-eap-sim],[build SIM authenication module for EAP (default is NO).]),
	[if test x$enableval = xyes; then
		eap_sim=true
	fi]
)

AC_ARG_ENABLE(
	[eap-sim-file],
	AS_HELP_STRING([--enable-eap-sim-file],[build EAP-SIM backend based on a triplet file (default is NO).]),
	[if test x$enableval = xyes; then
		eap_sim_file=true
	fi]
)

AC_ARG_ENABLE(
	[eap-identity],
	AS_HELP_STRING([--enable-eap-identity],[build EAP module providing EAP-Identity helper (default is NO).]),
	[if test x$enableval = xyes; then
		eap_identity=true
	fi]
)

AC_ARG_ENABLE(
	[eap-md5],
	AS_HELP_STRING([--enable-eap-md5],[build MD5 (CHAP) authenication module for EAP (default is NO).]),
	[if test x$enableval = xyes; then
		eap_md5=true
	fi]
)

AC_ARG_ENABLE(
	[eap-gtc],
	AS_HELP_STRING([--enable-eap-gtc],[build PAM based GTC authenication module for EAP (default is NO).]),
	[if test x$enableval = xyes; then
		eap_gtc=true
	fi]
)

AC_ARG_ENABLE(
	[eap-aka],
	AS_HELP_STRING([--enable-eap-aka],[build AKA authentication module for EAP (default is NO).]),
	[if test x$enableval = xyes; then
		eap_aka=true
	fi]
)

AC_ARG_ENABLE(
	[eap-mschapv2],
	AS_HELP_STRING([--enable-eap-mschapv2],[build MS-CHAPv2 authenication module for EAP (default is NO).]),
	[if test x$enableval = xyes; then
		eap_mschapv2=true
	fi]
)

AC_ARG_ENABLE(
	[eap-radius],
	AS_HELP_STRING([--enable-eap-radius],[build RADIUS proxy authenication module for EAP (default is NO).]),
	[if test x$enableval = xyes; then
		eap_radius=true
	fi]
)

AC_ARG_ENABLE(
	[kernel-netlink],
	AS_HELP_STRING([--disable-kernel-netlink],[disable the netlink kernel interface. (default is NO).]),
	[if test x$enableval = xyes; then
		kernel_netlink=true
	 else
		kernel_netlink=false
	fi],
	kernel_netlink=true
)

AC_ARG_ENABLE(
	[kernel-pfkey],
	AS_HELP_STRING([--enable-kernel-pfkey],[enable the PF_KEY kernel interface. (default is NO).]),
	[if test x$enableval = xyes; then
		kernel_pfkey=true
	fi]
)

AC_ARG_ENABLE(
	[kernel-klips],
	AS_HELP_STRING([--enable-kernel-klips],[enable the KLIPS kernel interface. (default is NO).]),
	[if test x$enableval = xyes; then
		kernel_klips=true
	fi]
)

AC_ARG_ENABLE(
	[nat-transport],
	AS_HELP_STRING([--enable-nat-transport],[enable NAT traversal with IPsec transport mode (default is NO).]),
	[if test x$enableval = xyes; then
		nat_transport=true
	fi]
)

AC_ARG_ENABLE(
	[vendor-id],
	AS_HELP_STRING([--disable-vendor-id],[disable the sending of the strongSwan vendor ID (default is NO).]),
	[if test x$enableval = xyes; then
		vendor_id=true
	 else
		vendor_id=false
	fi],
	vendor_id=true
)

AC_ARG_ENABLE(
	[xauth-vid],
	AS_HELP_STRING([--disable-xauth-vid],[disable the sending of the XAUTH vendor ID (default is NO).]),
	[if test x$enableval = xyes; then
		xauth_vid=true
	 else
		xauth_vid=false
	fi],
	xauth_vid=true
)

AC_ARG_ENABLE(
	[dumm],
	AS_HELP_STRING([--enable-dumm],[build the DUMM UML test framework (default is NO).]),
	[if test x$enableval = xyes; then
		dumm=true
	fi]
)

AC_ARG_ENABLE(
	[fast],
	AS_HELP_STRING([--enable-fast],[build libfast (FastCGI Application Server w/ templates (default is NO).]),
	[if test x$enableval = xyes; then
		fast=true
	fi]
)

AC_ARG_ENABLE(
	[manager],
	AS_HELP_STRING([--enable-manager],[build web management console (default is NO).]),
	[if test x$enableval = xyes; then
		manager=true
		xml=true
	fi]
)

AC_ARG_ENABLE(
	[mediation],
	AS_HELP_STRING([--enable-mediation],[enable IKEv2 Mediation Extension (default is NO).]),
	[if test x$enableval = xyes; then
		me=true
	fi]
)

AC_ARG_ENABLE(
	[integrity-test],
	AS_HELP_STRING([--enable-integrity-test],[enable the integrity test of the crypto library (default is NO).]),
	[if test x$enableval = xyes; then
		integrity_test=true 
	fi]
)

AC_ARG_ENABLE(
	[self-test],
	AS_HELP_STRING([--disable-self-test],[disable the self-test of the crypto library (default is NO).]),
	[if test x$enableval = xyes; then
		self_test=true
	 else
		self_test=false
	fi],
	self_test=true
)

AC_ARG_ENABLE(
	[pluto],
	AS_HELP_STRING([--disable-pluto],[disable the IKEv1 keying daemon pluto. (default is NO).]),
	[if test x$enableval = xyes; then
		pluto=true
	 else
		pluto=false
	fi],
	pluto=true
)

AC_ARG_ENABLE(
	[threads],
	AS_HELP_STRING([--disable-threads],[disable the use of threads in pluto. Charon always uses threads. (default is NO).]),
	[if test x$enableval = xyes; then
		threads=true
	 else
		threads=false
	fi],
	threads=true
)

AC_ARG_ENABLE(
	[charon],
	AS_HELP_STRING([--disable-charon],[disable the IKEv2 keying daemon charon. (default is NO).]),
	[if test x$enableval = xyes; then
		charon=true
	 else
		charon=false
	fi],
	charon=true
)

AC_ARG_ENABLE(
	[tools],
	AS_HELP_STRING([--disable-tools],[disable additional utilities (openac and scepclient). (default is NO).]),
	[if test x$enableval = xyes; then
		tools=true
	 else
		tools=false
	fi],
	tools=true
)

AC_ARG_ENABLE(
	[updown],
	AS_HELP_STRING([--disable-updown],[disable updown firewall script plugin. (default is NO).]),
	[if test x$enableval = xyes; then
		updown=true
	 else
		updown=false
	fi],
	updown=true
)

AC_ARG_ENABLE(
	[attr],
	AS_HELP_STRING([--disable-attr],[disable strongswan.conf based configuration attribute plugin. (default is NO).]),
	[if test x$enableval = xyes; then
		attr=true
	 else
		attr=false
	fi],
	attr=true
)

AC_ARG_ENABLE(
	[resolv-conf],
	AS_HELP_STRING([--disable-resolv-conf],[disable resolv.conf DNS handler plugin. (default is NO).]),
	[if test x$enableval = xyes; then
		resolvconf=true
	 else
		resolvconf=false
	fi],
	resolvconf=true
)

AC_ARG_ENABLE(
	[padlock],
	AS_HELP_STRING([--enable-padlock],[enables VIA Padlock crypto plugin. (default is NO).]),
	[if test x$enableval = xyes; then
		padlock=true
	 else
		padlock=false
	fi],
)

AC_ARG_ENABLE(
	[openssl],
	AS_HELP_STRING([--enable-openssl],[enables the OpenSSL crypto plugin. (default is NO).]),
	[if test x$enableval = xyes; then
		openssl=true
	 else
		openssl=false
	fi],
)

AC_ARG_ENABLE(
	[agent],
	AS_HELP_STRING([--enable-agent],[enables the ssh-agent signing plugin. (default is NO).]),
	[if test x$enableval = xyes; then
		agent=true
	 else
		agent=false
	fi],
)

AC_ARG_ENABLE(
	[uci],
	AS_HELP_STRING([--enable-uci],[enable OpenWRT UCI configuration plugin (default is NO).]),
	[if test x$enableval = xyes; then
		uci=true
	fi]
)

AC_ARG_ENABLE(
	[nm],
	AS_HELP_STRING([--enable-nm],[enable NetworkManager plugin (default is NO).]),
	[if test x$enableval = xyes; then
		nm=true
	fi]
)

dnl =========================
dnl  set up compiler and flags
dnl =========================

if test -z "$CFLAGS"; then
	AC_SUBST(CFLAGS, "-g -O2 -Wall -Wno-format -Wno-pointer-sign -Wno-strict-aliasing")
fi
AC_PROG_CC
AC_C_BIGENDIAN

dnl =========================
dnl  check required programs
dnl =========================

AC_PROG_INSTALL
AC_PROG_LIBTOOL
AC_PROG_LEX
AC_PROG_YACC
AC_PATH_PROG([GPERF], [gperf], [], [$PATH:/bin:/usr/bin:/usr/local/bin])
AC_PATH_PROG([PERL], [perl], [], [$PATH:/bin:/usr/bin:/usr/local/bin])

dnl =========================
dnl  dependency calculation
dnl =========================

if test x$pluto = xtrue; then
	gmp=true;
fi

if test x$tools = xtrue; then
	gmp=true;
fi

if test x$smp = xtrue; then
	xml=true
fi

if test x$manager = xtrue; then
	fast=true
fi

if test x$medsrv = xtrue; then
	me=true
	fast=true
fi

if test x$medcli = xtrue; then
	me=true
fi

dnl ==========================================
dnl  check required libraries and header files
dnl ==========================================

AC_HAVE_LIBRARY(dl)
AC_CHECK_FUNCS(backtrace)
AC_CHECK_FUNCS(dladdr)

AC_MSG_CHECKING([for gcc atomic operations])
AC_TRY_RUN(
[
	int main() {
		volatile int ref = 1;
		__sync_fetch_and_add (&ref, 1);
		__sync_sub_and_fetch (&ref, 1);
		/* Make sure test fails if operations are not supported */
		__sync_val_compare_and_swap(&ref, 1, 0);
		return ref;
	}
],
[AC_MSG_RESULT([yes]); AC_DEFINE(HAVE_GCC_ATOMIC_OPERATIONS)],
[AC_MSG_RESULT([no])],
[AC_MSG_RESULT([no])])

AC_CHECK_FUNC(
	[register_printf_function],
	[AC_DEFINE(HAVE_PRINTF_HOOKS)],
	[
		AC_MSG_NOTICE([printf does not support custom format specifiers!])
		AC_HAVE_LIBRARY([vstr],[LIBS="$LIBS"]; vstr=true,[AC_MSG_ERROR([Vstr string library not found])])
	])

if test x$gmp = xtrue; then
	AC_HAVE_LIBRARY([gmp],[LIBS="$LIBS"],[AC_MSG_ERROR([GNU Multi Precision library gmp not found])])
	AC_MSG_CHECKING([gmp.h version >= 4.1.4])
	AC_TRY_COMPILE(
		[#include "gmp.h"],
		[
			#if (__GNU_MP_VERSION*100 +  __GNU_MP_VERSION_MINOR*10 + __GNU_MP_VERSION_PATCHLEVEL) < 414
				#error bad gmp
			#endif
		], 
		[AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]); AC_MSG_ERROR([No usable gmp.h found!])]
	)
fi

if test x$ldap = xtrue; then
	AC_HAVE_LIBRARY([ldap],[LIBS="$LIBS"],[AC_MSG_ERROR([LDAP library ldap not found])])
	AC_HAVE_LIBRARY([lber],[LIBS="$LIBS"],[AC_MSG_ERROR([LDAP library lber not found])])
	AC_CHECK_HEADER([ldap.h],,[AC_MSG_ERROR([LDAP header ldap.h not found!])])
fi

if test x$curl = xtrue; then
	AC_HAVE_LIBRARY([curl],[LIBS="$LIBS"],[AC_MSG_ERROR([CURL library curl not found])])
	AC_CHECK_HEADER([curl/curl.h],,[AC_MSG_ERROR([CURL header curl/curl.h not found!])])
fi

if test x$xml = xtrue; then
	PKG_CHECK_MODULES(xml, [libxml-2.0])
	AC_SUBST(xml_CFLAGS)
	AC_SUBST(xml_LIBS)
fi

if test x$dumm = xtrue; then
	PKG_CHECK_MODULES(gtk, [gtk+-2.0 vte])
	AC_SUBST(gtk_CFLAGS)
	AC_SUBST(gtk_LIBS)
fi

if test x$fast = xtrue; then
	AC_HAVE_LIBRARY([neo_cgi],[LIBS="$LIBS"],[AC_MSG_ERROR([ClearSilver library neo_cgi not found!])])
	AC_HAVE_LIBRARY([neo_utl],[LIBS="$LIBS"],[AC_MSG_ERROR([ClearSilver library neo_utl not found!])])
	AC_HAVE_LIBRARY([z],[LIBS="$LIBS"],[AC_MSG_ERROR([ClearSilver dependency zlib not found!])])
dnl autoconf does not like CamelCase!? How to fix this?
dnl	AC_CHECK_HEADER([ClearSilver/ClearSilver.h],,[AC_MSG_ERROR([ClearSilver header file ClearSilver/ClearSilver.h not found!])])
	
	AC_HAVE_LIBRARY([fcgi],[LIBS="$LIBS"],[AC_MSG_ERROR([FastCGI library fcgi not found!])])
	AC_CHECK_HEADER([fcgiapp.h],,[AC_MSG_ERROR([FastCGI header file fcgiapp.h not found!])])
fi

if test x$mysql = xtrue; then
	AC_HAVE_LIBRARY([mysqlclient_r],[LIBS="$LIBS"],[AC_MSG_ERROR([MySQL library mysqlclient_r not found])])
	AC_CHECK_HEADER([mysql/mysql.h],,[AC_MSG_ERROR([MySQL header mysql/mysql.h not found!])])
fi

if test x$sqlite = xtrue; then
	AC_HAVE_LIBRARY([sqlite3],[LIBS="$LIBS"],[AC_MSG_ERROR([SQLite library sqlite3 not found])])
	AC_CHECK_HEADER([sqlite3.h],,[AC_MSG_ERROR([SQLite header sqlite3.h not found!])])
	AC_MSG_CHECKING([sqlite3_prepare_v2])
	AC_TRY_COMPILE(
		[#include <sqlite3.h>],
		[
			void *test = sqlite3_prepare_v2;
		], 
		[AC_MSG_RESULT([yes])]; AC_DEFINE_UNQUOTED(HAVE_SQLITE3_PREPARE_V2, 1), [AC_MSG_RESULT([no])])
	AC_MSG_CHECKING([sqlite3.h version >= 3.3.1])
	AC_TRY_COMPILE(
		[#include <sqlite3.h>],
		[
			#if SQLITE_VERSION_NUMBER < 3003001
				#error bad sqlite
			#endif
		], 
		[AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]); AC_MSG_ERROR([SQLite version >= 3.3.1 required!])])
fi

if test x$openssl = xtrue; then
	AC_HAVE_LIBRARY([crypto],[LIBS="$LIBS"],[AC_MSG_ERROR([OpenSSL crypto library not found])])
	AC_CHECK_HEADER([openssl/evp.h],,[AC_MSG_ERROR([OpenSSL header openssl/evp.h not found!])])
fi

if test x$uci = xtrue; then
	AC_HAVE_LIBRARY([uci],[LIBS="$LIBS"],[AC_MSG_ERROR([UCI library libuci not found])])
	AC_CHECK_HEADER([uci.h],,[AC_MSG_ERROR([UCI header uci.h not found!])])
fi

if test x$nm = xtrue; then
	PKG_CHECK_MODULES(nm, [NetworkManager libnm_glib_vpn gthread-2.0])
	AC_SUBST(nm_CFLAGS)
	AC_SUBST(nm_LIBS)
fi

if test x$eap_gtc = xtrue; then
	AC_HAVE_LIBRARY([pam],[LIBS="$LIBS"],[AC_MSG_ERROR([PAM library not found])])
	AC_CHECK_HEADER([security/pam_appl.h],,[AC_MSG_ERROR([PAM header security/pam_appl.h not found!])])
fi

if test x$capabilities = xlibcap; then
	AC_HAVE_LIBRARY([cap],[LIBS="$LIBS"],[AC_MSG_ERROR([libcap library not found])])
	AC_CHECK_HEADER([sys/capability.h],,[AC_MSG_ERROR([libcap header sys/capability.h not found!])])
fi

dnl ======================================
dnl  collect all plugins for libstrongswan
dnl ======================================

libstrongswan_plugins=
pluto_plugins=

if test x$curl = xtrue; then
	libstrongswan_plugins=${libstrongswan_plugins}" curl"
	pluto_plugins=${pluto_plugins}" curl"
fi
if test x$ldap = xtrue; then
	libstrongswan_plugins=${libstrongswan_plugins}" ldap"
	pluto_plugins=${pluto_plugins}" ldap"
fi
if test x$aes = xtrue; then
	libstrongswan_plugins=${libstrongswan_plugins}" aes"
fi
if test x$des = xtrue; then
	libstrongswan_plugins=${libstrongswan_plugins}" des"
fi
if test x$sha1 = xtrue; then
	libstrongswan_plugins=${libstrongswan_plugins}" sha1"
fi
if test x$sha2 = xtrue; then
	libstrongswan_plugins=${libstrongswan_plugins}" sha2"
fi
if test x$md4 = xtrue; then
	libstrongswan_plugins=${libstrongswan_plugins}" md4"
fi
if test x$md5 = xtrue; then
	libstrongswan_plugins=${libstrongswan_plugins}" md5"
fi
if test x$fips_prf = xtrue; then
	libstrongswan_plugins=${libstrongswan_plugins}" fips-prf"
fi
if test x$random = xtrue; then
	libstrongswan_plugins=${libstrongswan_plugins}" random"
fi
if test x$x509 = xtrue; then
	libstrongswan_plugins=${libstrongswan_plugins}" x509"
fi
if test x$pubkey = xtrue; then
	libstrongswan_plugins=${libstrongswan_plugins}" pubkey"
fi
if test x$xcbc = xtrue; then
	libstrongswan_plugins=${libstrongswan_plugins}" xcbc"
fi
if test x$hmac = xtrue; then
	libstrongswan_plugins=${libstrongswan_plugins}" hmac"
fi
if test x$mysql = xtrue; then
	libstrongswan_plugins=${libstrongswan_plugins}" mysql"
fi
if test x$sqlite = xtrue; then
	libstrongswan_plugins=${libstrongswan_plugins}" sqlite"
fi
if test x$padlock = xtrue; then
	libstrongswan_plugins=${libstrongswan_plugins}" padlock"
fi
if test x$openssl = xtrue; then
	libstrongswan_plugins=${libstrongswan_plugins}" openssl"
fi
if test x$agent = xtrue; then
	libstrongswan_plugins=${libstrongswan_plugins}" agent"
fi
if test x$gmp = xtrue; then
	libstrongswan_plugins=${libstrongswan_plugins}" gmp"
fi

AC_SUBST(libstrongswan_plugins)
AC_SUBST(pluto_plugins)

dnl =========================
dnl  set Makefile.am vars
dnl =========================

dnl libstrongswan plugins
dnl =====================
AM_CONDITIONAL(USE_CURL, test x$curl = xtrue)
AM_CONDITIONAL(USE_LDAP, test x$ldap = xtrue)
AM_CONDITIONAL(USE_AES, test x$aes = xtrue)
AM_CONDITIONAL(USE_DES, test x$des = xtrue)
AM_CONDITIONAL(USE_MD4, test x$md4 = xtrue)
AM_CONDITIONAL(USE_MD5, test x$md5 = xtrue)
AM_CONDITIONAL(USE_SHA1, test x$sha1 = xtrue)
AM_CONDITIONAL(USE_SHA2, test x$sha2 = xtrue)
AM_CONDITIONAL(USE_FIPS_PRF, test x$fips_prf = xtrue)
AM_CONDITIONAL(USE_GMP, test x$gmp = xtrue)
AM_CONDITIONAL(USE_RANDOM, test x$random = xtrue)
AM_CONDITIONAL(USE_X509, test x$x509 = xtrue)
AM_CONDITIONAL(USE_PUBKEY, test x$pubkey = xtrue)
AM_CONDITIONAL(USE_HMAC, test x$hmac = xtrue)
AM_CONDITIONAL(USE_XCBC, test x$xcbc = xtrue)
AM_CONDITIONAL(USE_MYSQL, test x$mysql = xtrue)
AM_CONDITIONAL(USE_SQLITE, test x$sqlite = xtrue)
AM_CONDITIONAL(USE_PADLOCK, test x$padlock = xtrue)
AM_CONDITIONAL(USE_OPENSSL, test x$openssl = xtrue)
AM_CONDITIONAL(USE_AGENT, test x$agent = xtrue)

dnl charon plugins
dnl ==============
AM_CONDITIONAL(USE_STROKE, test x$stroke = xtrue)
AM_CONDITIONAL(USE_MEDSRV, test x$medsrv = xtrue)
AM_CONDITIONAL(USE_MEDCLI, test x$medcli = xtrue)
AM_CONDITIONAL(USE_NM, test x$nm = xtrue)
AM_CONDITIONAL(USE_UCI, test x$uci = xtrue)
AM_CONDITIONAL(USE_SMP, test x$smp = xtrue)
AM_CONDITIONAL(USE_SQL, test x$sql = xtrue)
AM_CONDITIONAL(USE_UPDOWN, test x$updown = xtrue)
AM_CONDITIONAL(USE_ATTR, test x$attr = xtrue)
AM_CONDITIONAL(USE_RESOLV_CONF, test x$resolvconf = xtrue)
AM_CONDITIONAL(USE_UNIT_TESTS, test x$unittest = xtrue)
AM_CONDITIONAL(USE_LOAD_TESTS, test x$loadtest = xtrue)
AM_CONDITIONAL(USE_EAP_SIM, test x$eap_sim = xtrue)
AM_CONDITIONAL(USE_EAP_SIM_FILE, test x$eap_sim_file = xtrue)
AM_CONDITIONAL(USE_EAP_IDENTITY, test x$eap_identity = xtrue)
AM_CONDITIONAL(USE_EAP_MD5, test x$eap_md5 = xtrue)
AM_CONDITIONAL(USE_EAP_GTC, test x$eap_gtc = xtrue)
AM_CONDITIONAL(USE_EAP_AKA, test x$eap_aka = xtrue)
AM_CONDITIONAL(USE_EAP_MSCHAPV2, test x$eap_mschapv2 = xtrue)
AM_CONDITIONAL(USE_EAP_RADIUS, test x$eap_radius = xtrue)
AM_CONDITIONAL(USE_KERNEL_NETLINK, test x$kernel_netlink = xtrue)
AM_CONDITIONAL(USE_KERNEL_PFKEY, test x$kernel_pfkey = xtrue)
AM_CONDITIONAL(USE_KERNEL_KLIPS, test x$kernel_klips = xtrue)

dnl other options
dnl =============
AM_CONDITIONAL(USE_SMARTCARD, test x$smartcard = xtrue)
AM_CONDITIONAL(USE_CISCO_QUIRKS, test x$cisco_quirks = xtrue)
AM_CONDITIONAL(USE_LEAK_DETECTIVE, test x$leak_detective = xtrue)
AM_CONDITIONAL(USE_LOCK_PROFILER, test x$lock_profiler = xtrue)
AM_CONDITIONAL(USE_NAT_TRANSPORT, test x$nat_transport = xtrue)
AM_CONDITIONAL(USE_VENDORID, test x$vendor_id = xtrue)
AM_CONDITIONAL(USE_XAUTH_VID, test x$xauth_vid = xtrue)
AM_CONDITIONAL(USE_DUMM, test x$dumm = xtrue)
AM_CONDITIONAL(USE_FAST, test x$fast = xtrue)
AM_CONDITIONAL(USE_MANAGER, test x$manager = xtrue)
AM_CONDITIONAL(USE_ME, test x$me = xtrue)
AM_CONDITIONAL(USE_INTEGRITY_TEST, test x$integrity_test = xtrue)
AM_CONDITIONAL(USE_SELF_TEST, test x$self_test = xtrue)
AM_CONDITIONAL(USE_CAPABILITIES, test x$capabilities = xlibcap)
AM_CONDITIONAL(USE_PLUTO, test x$pluto = xtrue)
AM_CONDITIONAL(USE_THREADS, test x$threads = xtrue)
AM_CONDITIONAL(USE_CHARON, test x$charon = xtrue)
AM_CONDITIONAL(USE_TOOLS, test x$tools = xtrue)
AM_CONDITIONAL(USE_LIBSTRONGSWAN, test x$charon = xtrue -o x$pluto = xtrue -o x$tools = xtrue)
AM_CONDITIONAL(USE_FILE_CONFIG, test x$pluto = xtrue -o x$stroke = xtrue)
AM_CONDITIONAL(USE_VSTR, test x$vstr = xtrue)

dnl ==============================
dnl  set global definitions
dnl ==============================

if test x$me = xtrue; then
	AC_DEFINE(ME)
fi
if test x$capabilities = xlibcap; then
	AC_DEFINE(CAPABILITIES)
fi

dnl ==============================
dnl  build Makefiles
dnl ==============================

AC_OUTPUT(
	Makefile
	src/Makefile
	src/include/Makefile
	src/libstrongswan/Makefile
	src/libstrongswan/plugins/aes/Makefile
	src/libstrongswan/plugins/des/Makefile
	src/libstrongswan/plugins/md4/Makefile
	src/libstrongswan/plugins/md5/Makefile
	src/libstrongswan/plugins/sha1/Makefile
	src/libstrongswan/plugins/sha2/Makefile
	src/libstrongswan/plugins/fips_prf/Makefile
	src/libstrongswan/plugins/gmp/Makefile
	src/libstrongswan/plugins/random/Makefile
	src/libstrongswan/plugins/hmac/Makefile
	src/libstrongswan/plugins/xcbc/Makefile
	src/libstrongswan/plugins/x509/Makefile
	src/libstrongswan/plugins/pubkey/Makefile
	src/libstrongswan/plugins/curl/Makefile
	src/libstrongswan/plugins/ldap/Makefile
	src/libstrongswan/plugins/mysql/Makefile
	src/libstrongswan/plugins/sqlite/Makefile
	src/libstrongswan/plugins/padlock/Makefile
	src/libstrongswan/plugins/openssl/Makefile
	src/libstrongswan/plugins/agent/Makefile
	src/libstrongswan/fips/Makefile
	src/libcrypto/Makefile
	src/libfreeswan/Makefile
	src/pluto/Makefile
	src/whack/Makefile
	src/charon/Makefile
	src/charon/plugins/eap_aka/Makefile
	src/charon/plugins/eap_identity/Makefile
	src/charon/plugins/eap_md5/Makefile
	src/charon/plugins/eap_gtc/Makefile
	src/charon/plugins/eap_sim/Makefile
	src/charon/plugins/eap_sim_file/Makefile
	src/charon/plugins/eap_mschapv2/Makefile
	src/charon/plugins/eap_radius/Makefile
	src/charon/plugins/kernel_netlink/Makefile
	src/charon/plugins/kernel_pfkey/Makefile
	src/charon/plugins/kernel_klips/Makefile
	src/charon/plugins/smp/Makefile
	src/charon/plugins/sql/Makefile
	src/charon/plugins/medsrv/Makefile
	src/charon/plugins/medcli/Makefile
	src/charon/plugins/nm/Makefile
	src/charon/plugins/uci/Makefile
	src/charon/plugins/stroke/Makefile
	src/charon/plugins/updown/Makefile
	src/charon/plugins/attr/Makefile
	src/charon/plugins/resolv_conf/Makefile
	src/charon/plugins/unit_tester/Makefile
	src/charon/plugins/load_tester/Makefile
	src/stroke/Makefile
	src/ipsec/Makefile
	src/starter/Makefile
	src/_updown/Makefile
	src/_updown_espmark/Makefile
	src/_copyright/Makefile
	src/openac/Makefile
	src/scepclient/Makefile
	src/dumm/Makefile
	src/libfast/Makefile
	src/manager/Makefile
	src/medsrv/Makefile
	scripts/Makefile
	testing/Makefile
)