forked from FreeRADIUS/freeradius-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
2325 lines (2098 loc) · 59.7 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 #############################################################
dnl #
dnl # For information about autoconf, see:
dnl #
dnl # http://www.gnu.org/software/autoconf/
dnl #
dnl # The recommended order is:
dnl #
dnl # AC_INIT(file)
dnl # 0. checks for compiler, libtool, and command line options
dnl # 1. checks for programs
dnl # 2. checks for libraries
dnl # 3. checks for header files
dnl # 4. checks for typedefs
dnl # 5. checks for structures and functions
dnl # 6. checks for compiler characteristics
dnl # 7. checks for library functions
dnl # 8. checks for system services
dnl # AC_OUTPUT([file...])
dnl #
dnl #############################################################
AC_PREREQ([2.59])
export CFLAGS LIBS LDFLAGS CPPFLAGS
AC_INIT([freeradius],[$]Id[$],[http://bugs.freeradius.org],,[http://www.freeradius.org])
AC_CONFIG_SRCDIR([src/bin/radiusd.c])
AC_CONFIG_HEADER([src/include/autoconf.h])
m4_include([m4/ax_cc.m4])
m4_include([m4/ax_with_lib_args.m4])
m4_include([m4/ax_with_feature_args.m4])
dnl #############################################################
dnl #
dnl # Custom hackery to discover version at configure time
dnl #
dnl #############################################################
RADIUSD_VERSION_MAJOR=`cat VERSION | cut -f1 -d.`
RADIUSD_VERSION_MINOR=`cat VERSION | cut -f2 -d.`
RADIUSD_VERSION_INCRM=`cat VERSION | cut -f3 -d. | sed 's/[[\.-]].*$//'`
AC_MSG_CHECKING([build version])
RADIUSD_VERSION=`printf "%02i%02i%02i" $RADIUSD_VERSION_MAJOR $RADIUSD_VERSION_MINOR $RADIUSD_VERSION_INCRM`
AC_MSG_RESULT($RADIUSD_VERSION)
dnl #
dnl # Still useful for custom builds
dnl #
AC_MSG_CHECKING([build version string])
RADIUSD_VERSION_STRING=`cat VERSION`
AC_MSG_RESULT($RADIUSD_VERSION_STRING)
dnl #
dnl # Add definitions to Make.inc as it's used by various build targets
dnl #
AC_SUBST([RADIUSD_VERSION_STRING])
dnl #
dnl # Add definitions to autoconf.h, so that the headers that we install
dnl # contain the version number of the server.
dnl #
AC_DEFINE_UNQUOTED([RADIUSD_VERSION], [${RADIUSD_VERSION}], [Version integer in format <ma><ma><mi><mi><in><in>])
AC_DEFINE_UNQUOTED([RADIUSD_VERSION_STRING], ["${RADIUSD_VERSION_STRING}"], [Raw version string from VERSION file])
dnl #############################################################
dnl #
dnl # Override some of the default autoconf variables such as
dnl # CFLAGS if were building in developer mode
dnl #
dnl #############################################################
dnl #
dnl # Unset ASAN_OPTIONS and LSAN_OPTIONS so they don't interfere
dnl # with the build process.
dnl #
unset ASAN_OPTIONS
unset LSAN_OPTIONS
dnl #
dnl # See if we have Git.
dnl #
AC_CHECK_PROG(GIT, git, yes, no)
dnl #
dnl # Enable developer features like debugging symbols.
dnl # These checks must be done before expanding the AC_PROG_CC
dnl # and AC_PROG_CXX macros.
dnl #
AC_ARG_ENABLE(developer,
[ --enable-developer enables features of interest to developers.],
[ case "$enableval" in
no)
developer=no
;;
*)
developer=yes
esac ]
)
dnl #
dnl # Turn on the developer flag when taken from a git checkout (not a release)
dnl #
if test "x$GIT" = "xyes" && git status 2>&1 > /dev/null; then
if test "x$RADIUSD_VERSION_RELEASE" = "x"; then
AC_MSG_CHECKING([build release])
RADIUSD_VERSION_RELEASE=`git describe | sed -e 's/^.*-\([[0-9]]*\)-g[[0-9a-f]]*/\1/'`
AC_MSG_RESULT($RADIUSD_VERSION_RELEASE)
fi
if test "x$RADIUSD_VERSION_COMMIT" = "x"; then
AC_MSG_CHECKING([build commit])
RADIUSD_VERSION_COMMIT=`git log --pretty=format:'%h' -n 1`
AC_MSG_RESULT($RADIUSD_VERSION_COMMIT)
fi
if test "x$developer" != "xno"; then
AC_MSG_NOTICE([in git repository, enabling developer build implicitly, disable with --disable-developer])
developer="yes"
fi
fi
if test "x$RADIUSD_VERSION_RELEASE" != "x"; then
AC_DEFINE_UNQUOTED([RADIUSD_VERSION_RELEASE],[${RADIUSD_VERSION_RELEASE}],[Version release number at time of configuring])
fi
if test "x$RADIUSD_VERSION_COMMIT" != "x"; then
AC_DEFINE_UNQUOTED([RADIUSD_VERSION_COMMIT],[${RADIUSD_VERSION_COMMIT}],[Commit HEAD at time of configuring])
fi
dnl #
dnl # Autoconf sets -O2 and -g by default, but this is a PITA for debugging
dnl # so we remove the defaults if were building in developer mode, and set
dnl # -g3 so nice things like macro values are included. Other arguments are
dnl # added later when we know what compiler were using.
dnl #
if test "x$developer" = "xyes"; then
: ${CFLAGS=-g3}
fi
dnl #############################################################
dnl #
dnl # 0. Checks for compiler
dnl #
dnl #############################################################
dnl #
dnl # Get system information
dnl #
AC_CANONICAL_SYSTEM
AC_SUBST(TARGET_SYSTEM, "$target")
dnl # Check for GNU cc
dnl #
AC_PROG_CC
AC_PROG_CXX
dnl #
dnl # check for AIX, to allow us to use some BSD functions
dnl # must be before macros that call the compiler.
dnl #
AC_AIX
AC_PROG_GCC_TRADITIONAL
AC_PROG_CC_SUNPRO
AC_PROG_RANLIB
dnl #
dnl # Definitive check for whether the compiler is clang
dnl #
AX_CC_IS_CLANG
if test "x$ax_cv_cc_clang" = "xyes"; then
AC_SUBST(clang_path, "$CC")
else
AC_SUBST(clang_path, "")
fi
AX_CC_STD_C11
if test "x$ax_cv_cc_std_c11_flag" != x; then
CFLAGS="$CFLAGS $ax_cv_cc_std_c11_flag"
else
AC_MSG_ERROR([FreeRADIUS requires a C11 compiler])
fi
dnl #
dnl # Set Default CFLAGS for GCC compatible compilers
dnl #
if test "x$GCC" = "xyes"; then
CFLAGS="$CFLAGS -Wall -D_GNU_SOURCE"
fi
dnl #
dnl # -Wno-unknown-warning-option means the compiler doesn't complain about diag pragmas
dnl # for warnings it doesn't understand. This may sound like a bad idea, but consider
dnl # the number of different compiler versions we build under, and the fact that the
dnl # more anally retentive warnings are likely to be added in later versions.
dnl #
AX_CC_NO_UNKNOWN_WARNING_OPTION_FLAG
if test "x$ax_cv_cc_no_unknown_warning_option_flag" = "xyes"; then
CFLAGS="$CFLAGS -Wno-unknown-warning-option"
fi
dnl #
dnl # -Qunused-arguments means the compiler won't complain about unsupported arguments
dnl #
AX_CC_QUNUSED_ARGUMENTS_FLAG
if test "x$ax_cv_cc_qunused_arguments_flag" = "xyes"; then
CFLAGS="$CFLAGS -Qunused-arguments"
LDFLAGS="$LDFLAGS -Qunused-arguments"
fi
dnl #
dnl # Check for presence of -Wno-date-time warning. Older compilers
dnl # don't have it, and newer compilers warn without it...
dnl #
AX_CC_NO_DATE_TIME_FLAG
dnl #
dnl # Compile in large (2G+) file support.
dnl #
AC_SYS_LARGEFILE
dnl #
dnl # check for system bytesex
dnl # AC_DEFINES WORDS_BIGENDIAN
dnl #
AC_C_BIGENDIAN(
[AC_DEFINE(FR_BIG_ENDIAN, 1, [Define if your processor stores words with the most significant byte first])],
[AC_DEFINE(FR_LITTLE_ENDIAN, 1, [Define if your processor stores words with the least significant byte first])]
)
dnl #
dnl # Find GNU Make.
dnl #
AC_CHECK_PROG(GMAKE, gmake, yes, no)
if test $GMAKE = no; then
AC_PATH_PROG(MAKE, make, /usr/local/bin/make)
else
AC_PATH_PROG(MAKE, gmake, /usr/local/gnu/bin/make)
fi
makever=`$ac_cv_path_MAKE --version 2>&1 | grep "GNU Make"`
if test -z "$makever"; then
AC_MSG_ERROR([GNU Make is not installed. Please download and install it from ftp://prep.ai.mit.edu/pub/gnu/make/ before continuing.])
fi
dnl #
dnl # autoconf explicitly sets MAKEFLAGS and MFLAGS to '' even though we
dnl # didn't tell it to, so we have to use FR_MAKEFLAGS.
dnl #
dnl # determine the number of cores available and set the number of build
dnl # processes appropriately.
dnl #
AX_SYSTEM_CORES
dnl # Temporarily disabled because test and installation targets do not
dnl # have dependencies set up correctly for multiple build processes.
dnl if test "x$ax_cv_system_cores" != "x"; then
dnl : ${FR_MAKEFLAGS=-j$ax_cv_system_cores}
dnl fi
AC_SUBST(FR_MAKEFLAGS)
dnl #############################################################
dnl #
dnl # 0a. Enable/disable compiler checks and library checks
dnl #
dnl #############################################################
dnl # Put this in later, when all distributed modules use autoconf.
dnl AC_ARG_WITH(disablemodulefoo,
dnl [ --without-rlm_foo Disables module compilation. Module list:]
dnl esyscmd([find src/modules -type d -name rlm_\* -print |\
dnl sed -e 's%src/modules/.*/% (sub)- %; s%.*/%- %' |\
dnl awk '{print " "$0}']))
AC_ARG_ENABLE(strict-dependencies,
[ --enable-strict-dependencies fail configure on lack of module dependancy.])
AC_ARG_ENABLE(werror,
[ --enable-werror causes the build to fail if any warnings are generated.],
[ case "$enableval" in
no)
werror=no
;;
*)
werror=yes
esac ]
)
dnl #
dnl # Enable the -fsanitize=address and link in the address sanitizer
dnl # libraries.
dnl #
AC_ARG_ENABLE(llvm-address-sanitizer,
[AS_HELP_STRING([--enable-llvm-address-sanitizer],
[build with support for LLVM's address sanitizer (if building with clang).])],
[ case "$enableval" in
no)
llvm_address_sanitizer=no
;;
*)
llvm_address_sanitizer=yes
esac ]
)
dnl #
dnl # extra argument: --disable-openssl-version-check
dnl #
AC_ARG_ENABLE(openssl-version-check,
[AS_HELP_STRING([--disable-openssl-version-check],
[disable vulnerable OpenSSL version check])]
)
if test "x$enable_openssl_version_check" != "xno"; then
AC_DEFINE(ENABLE_OPENSSL_VERSION_CHECK, [1],
[Define to 1 to have OpenSSL version check enabled])
openssl_version_check_config="\
#
# allow_vulnerable_openssl: Allow the server to start with
# versions of OpenSSL known to have critical vulnerabilities.
#
# This check is based on the version number reported by libssl
# and may not reflect patches applied to libssl by
# distribution maintainers.
#
allow_vulnerable_openssl = no"
else
openssl_version_check_config=
fi
AC_SUBST([openssl_version_check_config])
dnl #
dnl # extra argument: --enable-reproducible-builds
dnl #
AC_ARG_ENABLE(reproducible-builds,
[AS_HELP_STRING([--enable-reproducible-builds],
[ensure the build does not change each time])],
[ case "$enableval" in
yes)
AC_DEFINE(ENABLE_REPRODUCIBLE_BUILDS, [1],
[Define to ensure each build is the same])
reproducible_builds=yes
;;
*)
reproducible_builds=no
esac ]
)
dnl #############################################################
dnl #
dnl # 0b. Enable/disable modules
dnl #
dnl #############################################################
dnl #
dnl # These next two arguments don't actually do anything. They're
dnl # place holders so that the top-level configure script can tell
dnl # the user how to configure lower-level modules
dnl #
dnl #
dnl # extra argument: --with-rlm-FOO-lib-dir
dnl #
AC_ARG_WITH(rlm-FOO-lib-dir,
[AS_HELP_STRING([--with-rlm-FOO-lib-dir=DIR],
[directory in which to look for library files used by module FOO])],
[ case "$withval" in
*)
;;
esac ]
)
dnl #
dnl # extra argument: --with-rlm-FOO-include-dir
dnl #
AC_ARG_WITH(rlm-FOO-include-dir,
[AS_HELP_STRING([--with-rlm-FOO-include-dir=DIR],
[directory in which to look for include files used by module FOO])],
[ case "$withval" in
*)
;;
esac ]
)
MODULES=
AC_ARG_WITH(modules,
[ --with-modules=QUOTED-MODULE-LIST],[
for i in $withval; do
MODULES="$MODULES $i"
done
])
dnl #
dnl # extra argument: --with-experimental-modules
dnl #
EXPERIMENTAL=
AC_ARG_WITH(experimental-modules,
[AS_HELP_STRING([--with-experimental-modules],
[use experimental and unstable modules. (default=no, unless --enable-developer=yes)])],
[ case "$withval" in
yes)
EXPERIMENTAL=yes
;;
no)
EXPERIMENTAL=no
;;
*)
esac ]
)
dnl #############################################################
dnl #
dnl # 0c. Set build/install directories
dnl #
dnl #############################################################
dnl #
dnl # extra argument: --with-docdir
dnl #
docdir='${datadir}/doc/freeradius'
AC_MSG_CHECKING([docdir])
AC_ARG_WITH(docdir,
[ --with-docdir=DIR directory for documentation [DATADIR/doc/freeradius] ],
[ case "$withval" in
no)
docdir=no
;;
yes)
;;
[[\\/$]]* | ?:[[\\/]]* )
docdir="$withval"
;;
*)
AC_MSG_ERROR([expected an absolute directory name for --with-docdir: $withval])
;;
esac ]
)
AC_SUBST(docdir)
AC_MSG_RESULT($docdir)
if test "x$docdir" = xno; then
AC_MSG_WARN([Documentation files will NOT be installed.])
fi
dnl #
dnl # extra argument: --with-logdir
dnl #
logdir='${localstatedir}/log/radius'
AC_MSG_CHECKING(logdir)
AC_ARG_WITH(logdir,
[ --with-logdir=DIR directory for logfiles [LOCALSTATEDIR/log/radius] ],
[ case "$withval" in
no)
AC_MSG_ERROR([Need logdir])
;;
yes)
;;
[[\\/$]]* | ?:[[\\/]]* )
logdir="$withval"
;;
*)
AC_MSG_ERROR([expected an absolute directory name for --with-logdir: $withval])
;;
esac ]
)
AC_SUBST(logdir)
AC_MSG_RESULT($logdir)
dnl #
dnl # extra argument: --with-radacctdir
dnl #
radacctdir='${logdir}/radacct'
AC_MSG_CHECKING(radacctdir)
AC_ARG_WITH(radacctdir,
[ --with-radacctdir=DIR directory for detail files [LOGDIR/radacct] ],
[ case "$withval" in
no)
AC_MSG_ERROR([Need radacctdir])
;;
yes)
;;
[[\\/$]]* | ?:[[\\/]]* )
radacctdir="$withval"
;;
*)
AC_MSG_ERROR([expected an absolute directory name for --with-radacctdir: $withval])
;;
esac ]
)
AC_SUBST(radacctdir)
AC_MSG_RESULT($radacctdir)
dnl #
dnl # extra argument: --with-raddbdir
dnl #
raddbdir='${sysconfdir}/raddb'
AC_MSG_CHECKING(raddbdir)
AC_ARG_WITH(raddbdir,
[ --with-raddbdir=DIR directory for config files [SYSCONFDIR/raddb] ],
[ case "$withval" in
no)
AC_MSG_ERROR([Need raddbdir])
;;
yes)
;;
[[\\/$]]* | ?:[[\\/]]* )
raddbdir="$withval"
;;
*)
AC_MSG_ERROR([expected an absolute directory name for --with-raddbdir: $withval])
;;
esac ]
)
AC_SUBST(raddbdir)
AC_MSG_RESULT($raddbdir)
dnl #
dnl # extra argument: --with-dictdir
dnl #
dictdir='${datarootdir}/freeradius/dictionary'
AC_MSG_CHECKING(dictdir)
AC_ARG_WITH(dictdir,
[ --with-dictdir=DIR directory for dictionary files [DATAROOTDIR/freeradius] ],
[ case "$withval" in
no)
AC_MSG_ERROR([Need dictdir])
;;
yes)
;;
[[\\/$]]* | ?:[[\\/]]* )
dictdir="$withval"
;;
*)
AC_MSG_ERROR([expected an absolute directory name for --with-dictdir: $withval])
;;
esac ]
)
AC_SUBST(dictdir)
AC_MSG_RESULT($dictdir)
modconfdir='${raddbdir}/mods-config'
AC_SUBST(modconfdir)
dnl #############################################################
dnl #
dnl # 0d. Enable/disable build time features
dnl #
dnl #############################################################
dnl #
dnl # extra argument: --with-ascend-binary
dnl #
WITH_ASCEND_BINARY=yes
AC_ARG_WITH(ascend-binary,
[ --with-ascend-binary include support for Ascend binary filter attributes (default=yes)],
[ case "$withval" in
yes)
;;
*)
WITH_ASCEND_BINARY=no
esac ]
)
if test "x$WITH_ASCEND_BINARY" = "xyes"; then
AC_DEFINE(WITH_ASCEND_BINARY, [1], [include support for Ascend binary filter attributes])
fi
AX_WITH_FEATURE_ARGS([tcp],[yes])
AX_WITH_FEATURE_ARGS([vmps],[yes])
AX_WITH_FEATURE_ARGS([dhcp],[yes])
AX_WITH_FEATURE_ARGS([tacacs],[yes])
AX_WITH_FEATURE_ARGS([udpfromto],[yes])
dnl #############################################################
dnl #
dnl # 0e. Library/include paths
dnl #
dnl #############################################################
AX_WITH_LIB_ARGS_OPT([cap],[yes])
AX_WITH_LIB_ARGS_OPT([collectdclient],[yes])
AX_WITH_LIB_ARGS_OPT([execinfo],[yes])
AX_WITH_LIB_ARGS_OPT([gperftools],[yes])
AX_WITH_LIB_ARGS_OPT([openssl],[yes])
AX_WITH_LIB_ARGS([kqueue])
AX_WITH_LIB_ARGS_OPT([pcap],[yes])
AX_WITH_LIB_ARGS_OPT([pcre],[yes])
AX_WITH_LIB_ARGS_OPT([systemd],[yes])
AX_WITH_LIB_ARGS([talloc])
dnl #
dnl # extra argument: --with-regex
dnl #
WITH_REGEX=
AC_ARG_WITH(regex,
[AS_HELP_STRING([--with-regex],
[build with regular expressions if available(default=yes)])],
[ case "$withval" in
no)
WITH_REGEX=no
;;
*)
;;
esac ]
)
dnl #############################################################
dnl #
dnl # 1. Checks for programs
dnl #
dnl #############################################################
CHECKRAD=checkrad
AC_PATH_PROG(PERL, perl, /usr/local/bin/perl)
if test "x$ac_cv_path_PERL" = "x"; then
AC_MSG_WARN([perl not found - Simultaneous-Use and checkrad may not work])
fi
AC_PATH_PROG(SNMPGET, snmpget)
if test "x$ac_cv_path_SNMPGET" = "x"; then
AC_MSG_WARN([snmpget not found - Simultaneous-Use and checkrad may not work])
fi
AC_PATH_PROG(SNMPWALK, snmpwalk)
if test "x$ac_cv_path_SNMPWALK" = "x"; then
AC_MSG_WARN([snmpwalk not found - Simultaneous-Use and checkrad may not work])
fi
AC_PATH_PROG(RUSERS, rusers, /usr/bin/rusers)
dnl #
dnl # FIXME This is truly gross.
dnl #
missing_dir=`cd $ac_aux_dir && pwd`
AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
AC_PATH_PROG(LOCATE,locate)
AC_PATH_PROG(DIRNAME,dirname)
AC_PATH_PROG(GREP,grep)
dnl #############################################################
dnl #
dnl # 2a. Checks for system libraries
dnl #
dnl #############################################################
dnl #
dnl # If using pthreads, check for -lpthread (posix) or -lc_r (*BSD)
dnl #
old_CFLAGS=$CFLAGS
if test $ac_cv_prog_suncc = "yes"; then
CFLAGS="$CFLAGS -mt"
fi
HAVE_THREADS=
AC_CHECK_HEADERS(pthread.h, [],
[
HAVE_THREADS="no"
fail=[pthread.h]
])
if test "x$HAVE_THREADS" != "xno"; then
dnl #
dnl # pthread stuff is usually in -lpthread
dnl # or in -lc_r, on *BSD
dnl #
dnl # On Some systems, we need extra pre-processor flags, to get them to
dnl # to do the threading properly.
dnl #
AC_CHECK_LIB(pthread, pthread_create,
[
HAVE_THREADS="yes"
CFLAGS="$CFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS"
LIBS="-lpthread $LIBS"
dnl #
dnl # -pthread should add all required CPP definitions and linker
dnl # arguments. But not all compilers support it, or some compilers
dnl # only support it on certain platforms.
dnl #
AX_CC_PTHREAD_FLAG
if test "x$ax_cv_cc_pthread_flag" = 'xyes'; then
CFLAGS="$CFLAGS -pthread"
fi
]
)
fi
dnl #
dnl # Check for libc_r which used to be the threading library used
dnl # for FreeBSD. Internet says it may be deprecated, but if we
dnl # can't find lpthread it's probably worth checking.
dnl #
if test "x$HAVE_THREADS" != "xyes"; then
AC_CHECK_LIB(c_r, pthread_create,
[
HAVE_THREADS="yes"
CFLAGS="$CFLAGS -D_THREAD_SAFE"
dnl #
dnl # -pthread should add all required CPP definitions and linker
dnl # arguments. But not all compilers support it, or some compilers
dnl # only support it on certain platforms.
dnl #
AX_CC_PTHREAD_FLAG
if test "x$ax_cv_cc_pthread_flag" != 'xyes'; then
LIBS="-lc_r $LIBS"
else
CFLAGS="$CFLAGS -pthread"
fi
],
[ fail=[-lc_r or -lpthread] ]
)
fi
if test "x$HAVE_THREADS" != "xyes"; then
AC_MSG_ERROR([FreeRADIUS requires thread support, missing: $fail])
fi
dnl #
dnl # We need sem_init() and friends, as they're the friendliest
dnl # semaphore functions for threading.
dnl #
dnl # HP/UX requires linking with librt, too, to get the sem_* symbols.
dnl # Some systems have them in -lsem
dnl # Solaris has them in -lposix4
dnl # NetBSD has them in -lsemaphore
dnl #
AC_SEARCH_LIBS(sem_init, pthread sem posix4 rt semaphore,
[],
[AC_MSG_ERROR([[-lsem not found. You may want to download it from ftp://ftp.to.gd-es.com/pub/BSDI/libsem.tar.bz2 or ftp://ftp.freeradius.org/pub/radius/contrib/libsem.tar.gz]])]
)
dnl #
dnl # Check if we have -ldl
dnl #
AC_CHECK_LIB(dl, dlopen)
dnl #
dnl # Check if we need -lsocket
dnl #
AC_CHECK_LIB(socket, getsockname)
dnl #
dnl # Check for -lresolv
dnl # This library may be needed later.
dnl #
AC_CHECK_LIB(resolv, inet_aton)
dnl #
dnl # Check if we need -lnsl. Usually if we want to
dnl # link against -lsocket we need to include -lnsl as well.
dnl #
AC_CHECK_LIB(nsl, inet_ntoa)
AC_CHECK_LIB(ws2_32, htonl)
dnl #
dnl # Check if we need -lrt, this is required on
dnl # older Linuxes for clock_gettime.
dnl #
AC_CHECK_LIB(rt, clock_gettime)
dnl #############################################################
dnl #
dnl # 2b. Checks for system header files
dnl #
dnl #############################################################
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_TIME
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS( \
arpa/inet.h \
crypt.h \
dlfcn.h \
errno.h \
fcntl.h \
features.h \
fnmatch.h \
getopt.h \
glob.h \
grp.h \
inttypes.h \
limits.h \
linux/if_packet.h \
malloc.h \
netdb.h \
netinet/in.h \
prot.h \
pwd.h \
resource.h \
semaphore.h \
sia.h \
siad.h \
signal.h \
stdatomic.h \
stdbool.h \
stddef.h \
stdint.h \
stdio.h \
sys/event.h \
sys/fcntl.h \
sys/event.h \
sys/prctl.h \
sys/ptrace.h \
sys/resource.h \
sys/security.h \
sys/select.h \
sys/socket.h \
sys/time.h \
sys/types.h \
sys/un.h \
sys/wait.h \
syslog.h \
unistd.h \
utime.h \
utmp.h \
utmpx.h \
valgrind.h \
winsock.h
)
dnl #
dnl # FreeBSD requires sys/socket.h before net/if.h
dnl #
AC_CHECK_HEADERS(net/if.h, [], [],
[
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
]
)
dnl #
dnl # other checks which require headers
dnl #
if test "x$ac_cv_header_sys_security_h" = "xyes" && test "x$ac_cv_header_prot_h" = "xyes"
then
AC_DEFINE(OSFC2, [], [define if you have OSFC2 authentication])
fi
if test "x$ac_cv_header_sia_h" = "xyes" && test "x$ac_cv_header_siad_h" = "xyes"
then
AC_DEFINE(OSFSIA, [], [define if you have OSFSIA authentication])
fi
dnl #############################################################
dnl #
dnl # 3a. Checks for user libraries
dnl #
dnl #############################################################
dnl #
dnl # Check for libtalloc
dnl #
smart_try_dir="$talloc_lib_dir"
FR_SMART_CHECK_LIB(talloc, _talloc)
if test "x$ac_cv_lib_talloc__talloc" != "xyes"; then
AC_MSG_WARN([talloc library not found. Use --with-talloc-lib-dir=<path>.])
AC_MSG_ERROR([FreeRADIUS requires libtalloc. Please read doc/developer/dependencies.rst for further instructions.])
fi
TALLOC_LIBS="${smart_lib}"
TALLOC_LDFLAGS="${smart_ldflags}"
AC_SUBST(TALLOC_LIBS)
AC_SUBST(TALLOC_LDFLAGS)
LIBS="$old_LIBS"
dnl #
dnl # Check for libkqueue (or system kqueue present on OSX and the BSDs)
dnl #
AC_CHECK_FUNC([kqueue])
if test "x$ac_cv_func_kqueue" != "xyes"; then
smart_try_dir="$kqueue_lib_dir"
FR_SMART_CHECK_LIB(kqueue, kqueue)
if test "x$ac_cv_lib_kqueue_kqueue" != "xyes"; then
AC_MSG_WARN([kqueue library not found. Use --with-kqueue-lib-dir=<path>.])
AC_MSG_ERROR([FreeRADIUS requires libkqueue (or system kqueue). Please read doc/developer/dependencies.rst for further instructions.])
fi
fi
KQUEUE_LIBS="${smart_lib}"
KQUEUE_LDFLAGS="${smart_ldflags}"
AC_SUBST(KQUEUE_LIBS)
AC_SUBST(KQUEUE_LDFLAGS)
LIBS="$old_LIBS"
dnl #
dnl # Check for libpcap
dnl #
smart_try_dir="$pcap_lib_dir"
FR_SMART_CHECK_LIB(pcap, pcap_open_live)
if test "x$ac_cv_lib_pcap_pcap_open_live" != "xyes"; then
AC_MSG_WARN([pcap library not found, silently disabling the RADIUS sniffer, and ARP listener. Use --with-pcap-lib-dir=<path>.])
else
AC_CHECK_FUNCS(\
pcap_fopen_offline \
pcap_dump_fopen \
pcap_create \
pcap_activate
)
PCAP_LIBS="${smart_lib}"
PCAP_LDFLAGS="${smart_ldflags}"
fi
dnl Set by FR_SMART_CHECK_LIB
LIBS="${old_LIBS}"
dnl #
dnl # Check for collectdclient
dnl #
smart_try_dir="$collectdclient_lib_dir"
FR_SMART_CHECK_LIB(collectdclient, lcc_connect)
if test "x$ac_cv_lib_collectdclient_lcc_connect" != "xyes"; then
AC_MSG_WARN([collectdclient library not found. Use --with-collectdclient-lib-dir=<path>.])
else
COLLECTDC_LIBS="${smart_lib}"
COLLECTDC_LDFLAGS="${smart_ldflags}"
fi
dnl Set by FR_SMART_CHECKLIB
LIBS="${old_LIBS}"
dnl #
dnl # Check for cap (Linux capabilities)
dnl #
smart_try_dir="$cap_lib_dir"
FR_SMART_CHECK_LIB(cap, cap_get_proc)
if test "x$ac_cv_lib_cap_cap_get_proc" != "xyes"; then
AC_MSG_WARN([cap library not found, debugger checks will not be enabled. Use --with-cap-lib-dir=<path>.])
else
AC_DEFINE(HAVE_LIBCAP, 1,
[Define to 1 if you have the `cap' library (-lcap).]
)
HAVE_LIBCAP=1
fi
dnl #
dnl # Look for gperftools, we could just ldpreload it, but google recommends linking
dnl # it in properly.
dnl #
if test "x$WITH_GPERFTOOLS" = xyes; then
smart_try_dir="$gperftools_lib_dir"
FR_SMART_CHECK_LIB(profiler, ProfilerStart)
if test "x$ac_cv_lib_profiler_ProfilerStart" != "xyes"; then
AC_MSG_WARN([libprofiler (gperftools) library not found. Use --with-gperftools-lib-dir=<path>.])
else
GPERFTOOLS_LIBS="${smart_lib}"
GPERFTOOLS_LDFLAGS="${smart_ldflags}"
fi
dnl Set by FR_SMART_CHECKLIB
LIBS="${old_LIBS}"
fi
dnl #
dnl # Check for systemd
dnl #
if test "x$WITH_SYSTEMD" = xyes; then
smart_try_dir="$systemd_lib_dir"
FR_SMART_CHECK_LIB(systemd, sd_notify)
if test "x$ac_cv_lib_systemd_sd_notify" != "xyes"; then
AC_MSG_WARN([systemd library not found. Use --with-systemd-lib-dir=<path>.])
else
AC_DEFINE(HAVE_SYSTEMD, 1,
[Define to 1 if you have the `systemd' library (-lsystemd).]
)
HAVE_SYSTEMD=1
SYSTEMD_LIBS="${smart_lib}"
SYSTEMD_LDFLAGS="${smart_ldflags}"
fi
dnl Set by FR_SMART_CHECKLIB
LIBS="${old_LIBS}"
fi
if test "x$HAVE_SYSTEMD" = x; then
AC_MSG_NOTICE([skipping test for systemd watchdog])
else
smart_try_dir="$systemd_lib_dir"
FR_SMART_CHECK_LIB(systemd, sd_watchdog_enabled)
if test "x$ac_cv_lib_systemd_sd_watchdog_enabled" != "xyes"; then
AC_MSG_WARN([systemd watchdog is only available from systemd 209.])
else
AC_DEFINE(HAVE_SYSTEMD_WATCHDOG, 1,
[Define to 1 if you have watchdog support in the `systemd' library (-lsystemd).]
)
fi
dnl Set by FR_SMART_CHECKLIB
LIBS="${old_LIBS}"
fi
dnl #
dnl # Check for libreadline
dnl #
VL_LIB_READLINE
dnl #############################################################
dnl #
dnl # 3b. Checks for header files
dnl #
dnl #############################################################