1 dnl #############################################################
3 dnl # For information about autoconf, see:
5 dnl # http://www.gnu.org/software/autoconf/
7 dnl # The recommended order is:
10 dnl # 0. checks for compiler, libtool, and command line options
11 dnl # 1. checks for programs
12 dnl # 2. checks for libraries
13 dnl # 3. checks for header files
14 dnl # 4. checks for typedefs
15 dnl # 5. checks for structures and functions
16 dnl # 6. checks for compiler characteristics
17 dnl # 7. checks for library functions
18 dnl # 8. checks for system services
19 dnl # AC_OUTPUT([file...])
21 dnl #############################################################
24 export CFLAGS LIBS LDFLAGS CPPFLAGS
26 AC_INIT([freeradius],[$]Id[$],[http://bugs.freeradius.org],,[http://www.freeradius.org])
27 AC_CONFIG_SRCDIR([src/main/radiusd.c])
28 AC_CONFIG_HEADER([src/include/autoconf.h])
29 m4_include([m4/ax_cc.m4])
31 dnl #############################################################
33 dnl # Custom hackery to discover version at configure time
35 dnl #############################################################
36 RADIUSD_MAJOR_VERSION=`cat VERSION | cut -f1 -d.`
37 RADIUSD_MINOR_VERSION=`cat VERSION | cut -f2 -d.`
38 RADIUSD_INCRM_VERSION=`cat VERSION | cut -f3 -d. | sed 's/[[\.-]].*$//'`
40 RADIUSD_VERSION=`echo | awk -v major="$RADIUSD_MAJOR_VERSION" \
41 -v minor="$RADIUSD_MINOR_VERSION" \
42 -v incrm="$RADIUSD_INCRM_VERSION" \
43 '{ printf "%02i%02i%02i", major, minor, incrm }'`
46 dnl # Still useful for custom builds
48 RADIUSD_VERSION_STRING=`cat VERSION`
51 dnl # Add definitions to Make.inc as it's used by various build targets
53 AC_SUBST([RADIUSD_VERSION_STRING])
56 dnl # Add definitions to autoconf.h, so that the headers that we install
57 dnl # contain the version number of the server.
59 AC_DEFINE_UNQUOTED([RADIUSD_VERSION], [${RADIUSD_VERSION}], [Version integer in format <ma><ma><mi><mi><in><in>])
60 AC_DEFINE_UNQUOTED([RADIUSD_VERSION_STRING], ["${RADIUSD_VERSION_STRING}"], [Raw version string from VERSION file])
62 dnl #############################################################
64 dnl # Override some of the default autoconf variables such as
65 dnl # CFLAGS if were building in developer mode
67 dnl #############################################################
70 dnl # Enable developer features like debugging symbols.
71 dnl # These checks must be done before expanding the AC_PROG_CC
72 dnl # and AC_PROG_CXX macros.
74 AC_ARG_ENABLE(developer,
75 [ --enable-developer enables features of interest to developers.],
76 [ case "$enableval" in
86 dnl # Turn on the developer flag when taken from a git checkout (not a release)
88 if test -d $srcdir/.git; then
89 if test "x$developer" != "xno"; then
90 AC_MSG_NOTICE([found .git directory, enabling developer build implicitly, disable with --disable-developer])
96 dnl # Autoconf sets -O2 and -g by default, but this is a PITA for debugging
97 dnl # so we remove the defaults if were building in developer mode, and set
98 dnl # -g3 so nice things like macro values are included. Other arguments are
99 dnl # added later when we know what compiler were using.
101 if test "x$developer" = "xyes"; then
105 dnl #############################################################
107 dnl # 0. Checks for compiler, libtool, and command line options.
109 dnl #############################################################
112 dnl # Get system information
117 dnl # Check for GNU cc
123 dnl # check for AIX, to allow us to use some BSD functions
124 dnl # must be before macros that call the compiler.
128 AC_PROG_GCC_TRADITIONAL
133 dnl # Definitive check for whether the compiler is clang
136 if test "x$ax_cv_cc_clang" = "xyes"; then
137 AC_SUBST(clang_path, "$CC")
139 AC_SUBST(clang_path, "")
144 dnl # Set Default CFLAGS for GCC compatible compilers
146 if test "x$GCC" = "xyes"; then
147 CFLAGS="$CFLAGS -Wall -std=c99 -D_GNU_SOURCE"
151 dnl # -Qunused-arguments means the compiler won't complain about unsupported arguments
153 AX_CC_QUNUSED_ARGUMENTS_FLAG
154 if test "x$ax_cv_cc_qunused_arguments_flag" = "xyes"; then
155 CFLAGS="$CFLAGS -Qunused-arguments"
156 LDFLAGS="$LDFLAGS -Qunused-arguments"
160 dnl # Compile in large (2G+) file support.
165 dnl # check for system bytesex
166 dnl # AC_DEFINES WORDS_BIGENDIAN
169 [AC_DEFINE(FR_BIG_ENDIAN, 1, [Define if your processor stores words with the most significant byte first])],
170 [AC_DEFINE(FR_LITTLE_ENDIAN, 1, [Define if your processor stores words with the least significant byte first])]
176 AC_CHECK_PROG(GMAKE, gmake, yes, no)
177 if test $GMAKE = no; then
178 AC_PATH_PROG(MAKE, make, /usr/local/bin/make)
180 AC_PATH_PROG(MAKE, gmake, /usr/local/gnu/bin/make)
182 makever=`$ac_cv_path_MAKE --version 2>&1 | grep "GNU Make"`
183 if test -z "$makever"; then
184 AC_MSG_ERROR([GNU Make is not installed. Please download and install it from ftp://prep.ai.mit.edu/pub/gnu/make/ before continuing.])
188 dnl # autoconf explicitly sets MAKEFLAGS and MFLAGS to '' even though we
189 dnl # didn't tell it to, so we have to use FR_MAKEFLAGS.
191 dnl # determine the number of cores available and set the number of build
192 dnl # processes appropriately.
196 dnl # Temporarily disabled because test and installation targets do not
197 dnl # have dependencies set up correctly for multiple build processes.
198 dnl if test "x$ax_cv_system_cores" != "x"; then
199 dnl : ${FR_MAKEFLAGS=-j$ax_cv_system_cores}
201 AC_SUBST(FR_MAKEFLAGS)
204 dnl # See if we have Git.
206 AC_CHECK_PROG(GIT, git, yes, no)
208 dnl Put this in later, when all distributed modules use autoconf.
209 dnl AC_ARG_WITH(disablemodulefoo,
210 dnl [ --without-rlm_foo Disables module compilation. Module list:]
211 dnl esyscmd([find src/modules -type d -name rlm_\* -print |\
212 dnl sed -e 's%src/modules/.*/% (sub)- %; s%.*/%- %' |\
213 dnl awk '{print " "$0}']))
215 AC_ARG_ENABLE(strict-dependencies,
216 [ --enable-strict-dependencies fail configure on lack of module dependancy.])
218 AC_ARG_ENABLE(werror,
219 [ --enable-werror causes the build to fail if any warnings are generated.],
220 [ case "$enableval" in
230 dnl # extra argument: --with-docdir
232 docdir='${datadir}/doc/freeradius'
233 AC_MSG_CHECKING([docdir])
235 [ --with-docdir=DIR directory for documentation [DATADIR/doc/freeradius] ],
242 [[\\/$]]* | ?:[[\\/]]* )
246 AC_MSG_ERROR([expected an absolute directory name for --with-docdir: $withval])
251 AC_MSG_RESULT($docdir)
252 if test "x$docdir" = xno; then
253 AC_MSG_WARN([Documentation files will NOT be installed.])
257 dnl # extra argument: --with-logdir
259 logdir='${localstatedir}/log/radius'
260 AC_MSG_CHECKING(logdir)
262 [ --with-logdir=DIR directory for logfiles [LOCALSTATEDIR/log/radius] ],
265 AC_MSG_ERROR([Need logdir])
269 [[\\/$]]* | ?:[[\\/]]* )
273 AC_MSG_ERROR([expected an absolute directory name for --with-logdir: $withval])
278 AC_MSG_RESULT($logdir)
281 dnl # extra argument: --with-radacctdir
283 radacctdir='${logdir}/radacct'
284 AC_MSG_CHECKING(radacctdir)
285 AC_ARG_WITH(radacctdir,
286 [ --with-radacctdir=DIR directory for detail files [LOGDIR/radacct] ],
289 AC_MSG_ERROR([Need radacctdir])
293 [[\\/$]]* | ?:[[\\/]]* )
294 radacctdir="$withval"
297 AC_MSG_ERROR([expected an absolute directory name for --with-radacctdir: $withval])
302 AC_MSG_RESULT($radacctdir)
305 dnl # extra argument: --with-raddbdir
307 raddbdir='${sysconfdir}/raddb'
308 AC_MSG_CHECKING(raddbdir)
309 AC_ARG_WITH(raddbdir,
310 [ --with-raddbdir=DIR directory for config files [SYSCONFDIR/raddb] ],
313 AC_MSG_ERROR([Need raddbdir])
317 [[\\/$]]* | ?:[[\\/]]* )
321 AC_MSG_ERROR([expected an absolute directory name for --with-raddbdir: $withval])
326 AC_MSG_RESULT($raddbdir)
329 dnl # extra argument: --with-dictdir
331 dictdir='${datarootdir}/freeradius'
332 AC_MSG_CHECKING(dictdir)
334 [ --with-dictdir=DIR directory for dictionary files [DATAROOTDIR/freeradius] ],
337 AC_MSG_ERROR([Need dictdir])
341 [[\\/$]]* | ?:[[\\/]]* )
345 AC_MSG_ERROR([expected an absolute directory name for --with-dictdir: $withval])
350 AC_MSG_RESULT($dictdir)
352 modconfdir='${raddbdir}/mods-config'
356 dnl # extra argument: --with-ascend-binary
358 WITH_ASCEND_BINARY=yes
359 AC_ARG_WITH(ascend-binary,
360 [ --with-ascend-binary include support for Ascend binary filter attributes (default=yes)],
365 WITH_ASCEND_BINARY=no
368 if test "x$WITH_ASCEND_BINARY" = "xyes"; then
369 AC_DEFINE(WITH_ASCEND_BINARY, [1], [include support for Ascend binary filter attributes])
373 dnl # extra argument: --with-threads
377 [ --with-threads use threads, if available. (default=yes) ],
387 dnl # extra argument: --with-tcp
391 [ --with-tcp compile in TCP support. (default=yes)],
399 if test "x$WITH_TCP" = "xyes"; then
400 AC_DEFINE(WITH_TCP, [1], [define if you want TCP support (For RADSec et al)])
404 dnl # extra argument: --with-vmps
408 [ --with-vmps compile in VMPS support. (default=yes)],
416 if test "x$WITH_VMPS" = "xyes"; then
417 AC_DEFINE(WITH_VMPS, [1], [define if you want VMPS support])
421 dnl # extra argument: --with-dhcp
425 [ --with-dhcp compile in DHCP support. (default=yes)],
433 if test "x$WITH_DHCP" = "xyes"; then
434 AC_DEFINE(WITH_DHCP, [1], [define if you want DHCP support])
438 dnl # Allow the user to specify a list of modules to be linked
439 dnl # statically to the server.
442 AC_ARG_WITH(static_modules,
443 [ --with-static-modules=QUOTED-MODULE-LIST],[
444 for i in $withval; do
445 STATIC_MODULES="$STATIC_MODULES -dlpreopen ../modules/rlm_$i/rlm_$i.la"
450 AC_ARG_WITH(shared-libs,
451 [AS_HELP_STRING([--with-shared-libs ],
452 [build dynamic libraries and link against them. (default=yes)])],
463 [ --with-modules=QUOTED-MODULE-LIST],[
464 for i in $withval; do
465 MODULES="$MODULES $i"
470 dnl # extra argument: --with-experimental-modules
473 AC_ARG_WITH(experimental-modules,
474 [AS_HELP_STRING([--with-experimental-modules],
475 [use experimental and unstable modules. (default=no, unless --enable-developer=yes)])],
488 dnl # extra argument: --with-udpfromto
491 AC_ARG_WITH(udpfromto,
492 [ --with-udpfromto compile in UDPFROMTO support. (default=yes)],
502 if test "x$WITH_UDPFROMTO" = "xyes"; then
503 AC_DEFINE(WITH_UDPFROMTO, [], [define if you want udpfromto])
507 dnl # These next two arguments don't actually do anything. They're
508 dnl # place holders so that the top-level configure script can tell
509 dnl # the user how to configure lower-level modules
513 dnl # extra argument: --with-rlm-FOO-lib-dir
515 AC_ARG_WITH(rlm-FOO-lib-dir,
516 [AS_HELP_STRING([--with-rlm-FOO-lib-dir=DIR],
517 [directory in which to look for library files used by module FOO])],
525 dnl # extra argument: --with-rlm-FOO-include-dir
527 AC_ARG_WITH(rlm-FOO-include-dir,
528 [AS_HELP_STRING([--with-rlm-FOO-include-dir=DIR],
529 [directory in which to look for include files used by module FOO])],
537 dnl # extra argument: --with-openssl
541 [ --with-openssl use OpenSSL. (default=yes)],
553 dnl # extra argument: --with-openssl-lib-dir=dir
556 AC_ARG_WITH(openssl-lib-dir,
557 [AS_HELP_STRING([--with-openssl-lib-dir=DIR],
558 [directory to look for OpenSSL library files])],
560 *) openssl_lib_dir="$withval"
566 dnl # extra argument: --with-openssl-includes=dir
569 AC_ARG_WITH(openssl-include-dir,
570 [AS_HELP_STRING([--with-openssl-include-dir=DIR],
571 [directory to look for OpenSSL include files])],
573 *) openssl_include_dir="$withval"
579 dnl # extra argument: --disable-openssl-version-check
581 AC_ARG_ENABLE(openssl-version-check,
582 [AS_HELP_STRING([--disable-openssl-version-check],
583 [disable vulnerable OpenSSL version check])]
585 if test "x$enable_openssl_version_check" != "xno"; then
586 AC_DEFINE(ENABLE_OPENSSL_VERSION_CHECK, [1],
587 [Define to 1 to have OpenSSL version check enabled])
588 openssl_version_check_config="\
590 # allow_vulnerable_openssl: Allow the server to start with
591 # versions of OpenSSL known to have critical vulnerabilities.
593 # This check is based on the version number reported by libssl
594 # and may not reflect patches applied to libssl by
595 # distribution maintainers.
597 allow_vulnerable_openssl = no"
599 openssl_version_check_config=
601 AC_SUBST([openssl_version_check_config])
604 dnl #############################################################
606 dnl # 1. Checks for programs
608 dnl #############################################################
611 AC_PATH_PROG(PERL, perl, /usr/local/bin/perl)
612 if test "x$ac_cv_path_PERL" = "x"; then
613 AC_MSG_WARN([perl not found - Simultaneous-Use and checkrad may not work])
615 AC_PATH_PROG(SNMPGET, snmpget)
616 if test "x$ac_cv_path_SNMPGET" = "x"; then
617 AC_MSG_WARN([snmpget not found - Simultaneous-Use and checkrad may not work])
620 AC_PATH_PROG(SNMPWALK, snmpwalk)
621 if test "x$ac_cv_path_SNMPWALK" = "x"; then
622 AC_MSG_WARN([snmpwalk not found - Simultaneous-Use and checkrad may not work])
625 AC_PATH_PROG(RUSERS, rusers, /usr/bin/rusers)
628 dnl # FIXME This is truly gross.
630 missing_dir=`cd $ac_aux_dir && pwd`
631 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
632 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
633 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
635 AC_PATH_PROG(LOCATE,locate)
636 AC_PATH_PROG(DIRNAME,dirname)
637 AC_PATH_PROG(GREP,grep)
639 dnl #############################################################
641 dnl # 2. Checks for libraries
643 dnl #############################################################
646 dnl extra argument: --with-talloc-lib-dir=DIR
648 AC_ARG_WITH(talloc-lib-dir,
649 [AS_HELP_STRING([--with-talloc-lib-dir=DIR],
650 [directory in which to look for talloc library files])],
653 AC_MSG_ERROR([Need talloc-lib-dir])
658 talloc_lib_dir="$withval"
662 dnl extra argument: --with-talloc-include-dir=DIR
664 AC_ARG_WITH(talloc-include-dir,
665 [AS_HELP_STRING([--with-talloc-include-dir=DIR],
666 [directory in which to look for talloc include files])],
669 AC_MSG_ERROR([Need talloc-include-dir])
674 talloc_include_dir="$withval"
678 smart_try_dir="$talloc_lib_dir"
679 FR_SMART_CHECK_LIB(talloc, _talloc)
680 if test "x$ac_cv_lib_talloc__talloc" != "xyes"; then
681 AC_MSG_WARN([talloc library not found. Use --with-talloc-lib-dir=<path>.])
682 AC_MSG_ERROR([FreeRADIUS requires libtalloc])
685 TALLOC_LIBS="${smart_lib}"
686 TALLOC_LDFLAGS="${smart_ldflags}"
687 AC_SUBST(TALLOC_LIBS)
688 AC_SUBST(TALLOC_LDFLAGS)
692 dnl # If using pthreads, check for -lpthread (posix) or -lc_r (*BSD)
695 if test "x$WITH_THREADS" = "xyes"; then
696 if test $ac_cv_prog_suncc = "yes"; then
700 AC_CHECK_HEADERS(pthread.h, [],
707 dnl # pthread stuff is usually in -lpthread
708 dnl # or in -lc_r, on *BSD
710 dnl # On Some systems, we need extra pre-processor flags, to get them to
711 dnl # to do the threading properly.
713 if test "x$WITH_THREADS" != "xno"; then
714 AC_CHECK_LIB(pthread, pthread_create,
717 CFLAGS="$CFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS"
718 LIBS="-lpthread $LIBS"
721 dnl # -pthread should add all required CPP definitions and linker
722 dnl # arguments. But not all compilers support it, or some compilers
723 dnl # only support it on certain platforms.
726 if test "x$ax_cv_cc_pthread_flag" != 'xyes'; then
727 CFLAGS="$CFLAGS -pthread"
733 dnl # Check for libc_r which used to be the threading library used
734 dnl # for FreeBSD. Internet says it may be deprecated, but if we
735 dnl # can't find lpthread it's probably worth checking.
737 if test "x$HAVE_LPTHREAD" != "xyes"; then
738 AC_CHECK_LIB(c_r, pthread_create,
740 CFLAGS="$CFLAGS -D_THREAD_SAFE"
743 dnl # -pthread should add all required CPP definitions and linker
744 dnl # arguments. But not all compilers support it, or some compilers
745 dnl # only support it on certain platforms.
748 if test "x$ax_cv_cc_pthread_flag" != 'xyes'; then
751 CFLAGS="$CFLAGS -pthread"
754 [ fail=[-lc_r or -lpthread] ]
759 if test "x$WITH_THREADS" != "xyes"; then
760 AC_MSG_WARN([silently not building with thread support.])
761 AC_MSG_WARN([FAILURE: thread support requires: $fail.])
763 AC_DEFINE(WITH_THREADS, [1], [define if you want thread support])
768 dnl # If we have NO pthread libraries, remove any knowledge of threads.
770 if test "x$WITH_THREADS" != "xyes"; then
772 ac_cv_header_pthread_h="no"
776 dnl # We need sem_init() and friends, as they're the friendliest
777 dnl # semaphore functions for threading.
779 dnl # HP/UX requires linking with librt, too, to get the sem_* symbols.
780 dnl # Some systems have them in -lsem
781 dnl # Solaris has them in -lposix4
782 dnl # NetBSD has them in -lsemaphore
785 AC_SEARCH_LIBS(sem_init, pthread sem posix4 rt semaphore,
787 [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]])]
792 dnl # Check if we need -lsocket
794 AC_CHECK_LIB(dl, dlopen)
797 dnl # Check if we need -lsocket
799 AC_CHECK_LIB(socket, getsockname)
802 dnl # Check for -lresolv
803 dnl # This library may be needed later.
805 AC_CHECK_LIB(resolv, inet_aton)
808 dnl # Check if we need -lnsl. Usually if we want to
809 dnl # link against -lsocket we need to include -lnsl as well.
811 AC_CHECK_LIB(nsl, inet_ntoa)
812 AC_CHECK_LIB(ws2_32, htonl)
815 dnl # Check the pcap library for the RADIUS sniffer.
817 dnl extra argument: --with-pcap-lib-dir=DIR
819 AC_ARG_WITH(pcap-lib-dir,
820 [AS_HELP_STRING([--with-pcap-lib-dir=DIR],
821 [directory in which to look for pcap library files])],
824 AC_MSG_ERROR([Need pcap-lib-dir])
829 pcap_lib_dir="$withval"
833 dnl extra argument: --with-pcap-include-dir=DIR
835 AC_ARG_WITH(pcap-include-dir,
836 [AS_HELP_STRING([--with-pcap-include-dir=DIR],
837 [directory in which to look for pcap include files])],
840 AC_MSG_ERROR([Need pcap-include-dir])
845 pcap_include_dir="$withval"
849 smart_try_dir="$pcap_lib_dir"
850 FR_SMART_CHECK_LIB(pcap, pcap_open_live)
851 if test "x$ac_cv_lib_pcap_pcap_open_live" != "xyes"; then
852 AC_MSG_WARN([pcap library not found, silently disabling the RADIUS sniffer, and ARP listener. Use --with-pcap-lib-dir=<path>.])
854 AC_DEFINE(HAVE_LIBPCAP, 1,
855 [Define to 1 if you have the `pcap' library (-lpcap).]
865 PCAP_LIBS="${smart_lib}"
866 PCAP_LDFLAGS="${smart_ldflags}"
868 dnl Set by FR_SMART_CHECK_LIB
871 dnl Check for collectdclient
872 dnl extra argument: --with-collectdclient-lib-dir=DIR
873 collectdclient_lib_dir=
874 AC_ARG_WITH(collectdclient-lib-dir,
875 [AS_HELP_STRING([--with-collectdclient-lib-dir=DIR],
876 [directory in which to look for collectdclient library files])],
879 AC_MSG_ERROR([Need collectdclient-lib-dir])
884 collectdclient_lib_dir="$withval"
888 dnl extra argument: --with-collectdclient-include-dir=DIR
889 collectdclient_include_dir=
890 AC_ARG_WITH(collectdclient-include-dir,
891 [AS_HELP_STRING([--with-collectdclient-include-dir=DIR],
892 [directory in which to look for collectdclient include files])],
895 AC_MSG_ERROR([Need collectdclient-include-dir])
900 collectdclient_include_dir="$withval"
904 smart_try_dir="$collectdclient_lib_dir"
905 FR_SMART_CHECK_LIB(collectdclient, lcc_connect)
906 if test "x$ac_cv_lib_collectdclient_lcc_connect" != "xyes"; then
907 AC_MSG_WARN([collectdclient library not found. Use --with-collectdclient-lib-dir=<path>.])
909 COLLECTDC_LIBS="${smart_lib}"
910 COLLECTDC_LDFLAGS="${smart_ldflags}"
912 dnl Set by FR_SMART_CHECKLIB
916 dnl extra argument: --with-cap-lib-dir=DIR
918 AC_ARG_WITH(cap-lib-dir,
919 [AS_HELP_STRING([--with-cap-lib-dir=DIR],
920 [directory in which to look for cap library files])],
923 AC_MSG_ERROR([Need cap-lib-dir])
928 cap_lib_dir="$withval"
932 dnl extra argument: --with-cap-include-dir=DIR
934 AC_ARG_WITH(cap-include-dir,
935 [AS_HELP_STRING([--with-cap-include-dir=DIR],
936 [directory in which to look for cap include files])],
939 AC_MSG_ERROR([Need cap-include-dir])
944 cap_include_dir="$withval"
948 smart_try_dir="$cap_lib_dir"
949 FR_SMART_CHECK_LIB(cap, cap_get_proc)
950 if test "x$ac_cv_lib_cap_cap_get_proc" != "xyes"; then
951 AC_MSG_WARN([cap library not found, debugger checks will not be enabled. Use --with-cap-lib-dir=<path>.])
953 AC_DEFINE(HAVE_LIBCAP, 1,
954 [Define to 1 if you have the `cap' library (-lcap).]
961 dnl #############################################################
963 dnl # 3. Checks for header files
965 dnl #############################################################
968 dnl # Check for talloc header files
970 smart_try_dir="$talloc_include_dir"
971 FR_SMART_CHECK_INCLUDE([talloc.h])
972 if test "x$ac_cv_header_talloc_h" != "xyes"; then
973 AC_MSG_WARN([talloc headers not found. Use --with-talloc-include-dir=<path>.])
974 AC_MSG_ERROR([FreeRADIUS requires libtalloc])
978 dnl # Interix requires us to set -D_ALL_SOURCE, otherwise
979 dnl # getopt will be #included, but won't link. <sigh>
983 CFLAGS="$CFLAGS -D_ALL_SOURCE"
986 CFLAGS="$CFLAGS -DDARWIN"
987 LIBS="-framework DirectoryService $LIBS"
988 AC_DEFINE([__APPLE_USE_RFC_3542], 1, [Force OSX >= 10.7 Lion to use RFC2292 IPv6 socket options])
1045 dnl # FreeBSD requires sys/socket.h before net/if.h
1047 AC_CHECK_HEADERS(net/if.h, [], [],
1049 #ifdef HAVE_SYS_SOCKET_H
1050 # include <sys/socket.h>
1056 dnl # other checks which require headers
1058 if test "x$ac_cv_header_sys_security_h" = "xyes" && test "x$ac_cv_header_prot_h" = "xyes"
1060 AC_DEFINE(OSFC2, [], [define if you have OSFC2 authentication])
1063 if test "x$ac_cv_header_sia_h" = "xyes" && test "x$ac_cv_header_siad_h" = "xyes"
1065 AC_DEFINE(OSFSIA, [], [define if you have OSFSIA authentication])
1069 dnl # Were we told to use OpenSSL, if we were and we find an error, call AC_MSG_FAILURE and exit
1071 if test "x$WITH_OPENSSL" = xyes; then
1075 dnl # Apparently OpenSSL will attempt to build with kerberos if we don't pass this?!
1077 CFLAGS="$CFLAGS -DOPENSSL_NO_KRB5"
1080 dnl # Check we can link to libcrypto and libssl
1082 smart_try_dir="$openssl_lib_dir"
1083 FR_SMART_CHECK_LIB(crypto, DH_new)
1084 if test "x$ac_cv_lib_crypto_DH_new" = "xyes"; then
1085 AC_DEFINE(HAVE_LIBCRYPTO, 1, [Define to 1 if you have the `crypto' library (-lcrypto).])
1086 OPENSSL_LIBS="$smart_lib"
1087 OPENSSL_LDFLAGS="$smart_ldflags"
1089 FR_SMART_CHECK_LIB(ssl, SSL_new)
1090 if test "x$ac_cv_lib_ssl_SSL_new" != "xyes"; then
1091 AC_MSG_FAILURE([failed linking to libssl. Use --with-openssl-lib-dir=<path>, or --with-openssl=no (builds without OpenSSL)])
1093 AC_DEFINE(HAVE_LIBSSL, 1, [Define to 1 if you have the `ssl' library (-lssl).])
1094 OPENSSL_LIBS="$OPENSSL_LIBS $smart_lib"
1096 if test "$OPENSSL_LDFLAGS" != "$smart_ldflags"; then
1097 AC_MSG_FAILURE(["inconsistent LDFLAGS between -lssl '$smart_ldflags' and -lcrypto '$OPENSSL_LDFLAGS'"])
1101 AC_MSG_FAILURE([failed linking to libcrypto. Use --with-openssl-lib-dir=<path>, or --with-openssl=no (builds without OpenSSL)])
1104 smart_try_dir="$openssl_include_dir"
1105 FR_SMART_CHECK_INCLUDE(openssl/ssl.h)
1106 if test "x$ac_cv_header_openssl_ssl_h" = "xyes"; then
1107 AC_DEFINE(HAVE_OPENSSL_SSL_H, 1, [Define to 1 if you have the <openssl/ssl.h> header file.])
1119 [ OPENSSL_CPPFLAGS="$smart_include" ],
1121 AC_MSG_FAILURE([failed locating OpenSSL headers. Use --with-openssl-include-dir=<path>, or --with-openssl=no (builds without OpenSSL)])
1125 AC_MSG_CHECKING([for OpenSSL version >= 0.9.7])
1127 [#include <openssl/crypto.h>
1128 #if (OPENSSL_VERSION_NUMBER >= 0x00907000L)
1137 AC_MSG_FAILURE([OpenSSL version too old])
1142 dnl # CPPFLAGS are passed to the compiler first, so we use
1143 dnl # them to ensure things like --sysroot don't override the
1144 dnl # library location we discovered previously.
1146 old_CPPFLAGS="$CPPFLAGS"
1147 CPPFLAGS="$OPENSSL_CPPFLAGS $CPPFLAGS"
1150 dnl # Now check that the header versions match the library
1152 AC_MSG_CHECKING([OpenSSL library and header version consistency])
1157 #include <openssl/opensslv.h>
1158 #include <openssl/crypto.h>
1161 printf("library: %lx header: %lx... ", (unsigned long) SSLeay(), (unsigned long) OPENSSL_VERSION_NUMBER);
1162 if (SSLeay() == OPENSSL_VERSION_NUMBER) {
1174 AC_MSG_FAILURE([OpenSSL library version does not match header version])
1177 CPPFLAGS="$old_CPPFLAGS"
1181 AC_SUBST(OPENSSL_LIBS)
1182 AC_SUBST(OPENSSL_LDFLAGS)
1183 AC_SUBST(OPENSSL_CPPFLAGS)
1184 export OPENSSL_LIBS OPENSSL_LDFLAGS OPENSSL_CPPFLAGS
1188 dnl # Check the pcap includes for the RADIUS sniffer.
1190 if test "x$PCAP_LIBS" = x; then
1191 AC_MSG_NOTICE([skipping test for pcap.h.])
1194 dnl # Check for pcap header files
1196 smart_try_dir="$pcap_include_dir"
1197 FR_SMART_CHECK_INCLUDE([pcap.h])
1198 if test "x$ac_cv_header_pcap_h" == "xyes"; then
1199 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
1201 AC_SUBST(PCAP_LDFLAGS)
1203 AC_MSG_WARN([pcap headers not found, silently disabling the RADIUS sniffer, and ARP listener. Use --with-pcap-include-dir=<path>.])
1207 dnl Check for collectd-client
1208 if test "x$COLLECTDC_LIBS" = x; then
1209 AC_MSG_NOTICE([skipping test for collectd/client.h.])
1212 dnl # Check for collectd-client header files
1214 smart_try_dir="$collectdclient_include_dir"
1215 FR_SMART_CHECK_INCLUDE([collectd/client.h])
1216 if test "x$ac_cv_header_collectd_client_h" == "xyes"; then
1217 AC_DEFINE(HAVE_COLLECTDC_H, 1, [Define to 1 if you have the `collectdclient' library (-lcollectdclient).])
1218 AC_SUBST(COLLECTDC_LIBS)
1219 AC_SUBST(COLLECTDC_LDFLAGS)
1221 AC_MSG_WARN([collectdclient headers not found. Use --with-collectdclient-include-dir=<path>.])
1226 dnl # Check the CAP includes for debugger checks
1228 if test "x$HAVE_LIBCAP" = x; then
1229 AC_MSG_NOTICE([skipping test for cap.h.])
1232 dnl # Check for CAP header files
1234 smart_try_dir="$cap_include_dir"
1235 FR_SMART_CHECK_INCLUDE([sys/capability.h])
1236 if test "x$ac_cv_header_sys_capability_h" == "xyes"; then
1237 AC_DEFINE(HAVE_CAPABILITY_H, 1, [Define to 1 if you have the <sys/capability.h> header file.])
1239 AC_MSG_WARN([cap headers not found, will not perform debugger checks. Use --with-cap-include-dir=<path>.])
1243 dnl #############################################################
1245 dnl # 4. Checks for typedefs
1247 dnl #############################################################
1250 dnl # Ensure that these are defined
1258 dnl # Check for socklen_t
1260 FR_CHECK_TYPE_INCLUDE(
1262 #ifdef HAVE_SYS_TYPES_H
1263 # include <sys/types.h>
1266 #ifdef HAVE_SYS_SOCKET_H
1267 # include <sys/socket.h>
1270 socklen_t, int, [socklen_t is generally 'int' on systems which don't use it]
1274 dnl # Check for uint8_t
1276 FR_CHECK_TYPE_INCLUDE(
1278 #ifdef HAVE_INTTYPES_H
1279 # include <inttypes.h>
1282 #ifdef HAVE_STDINT_H
1283 # include <stdint.h>
1286 uint8_t, unsigned char, [uint8_t should be the canonical 'octet' for network traffic]
1290 dnl # Check for uint16_t
1292 FR_CHECK_TYPE_INCLUDE(
1294 #ifdef HAVE_INTTYPES_H
1295 # include <inttypes.h>
1298 #ifdef HAVE_STDINT_H
1299 # include <stdint.h>
1302 uint16_t, unsigned short, [uint16_t should be the canonical '2 octets' for network traffic]
1306 dnl # Check for uint32_t
1308 FR_CHECK_TYPE_INCLUDE(
1310 #ifdef HAVE_INTTYPES_H
1311 # include <inttypes.h>
1314 #ifdef HAVE_STDINT_H
1315 # include <stdint.h>
1318 uint32_t, unsigned int, [uint32_t should be the canonical 'network integer']
1322 dnl # Check for uint64_t
1324 FR_CHECK_TYPE_INCLUDE(
1326 #ifdef HAVE_INTTYPES_H
1327 # include <inttypes.h>
1330 #ifdef HAVE_STDINT_H
1331 # include <stdint.h>
1334 uint64_t, unsigned long long, [uint64_t is required for larger counters]
1338 dnl # Check for __uint128_t (compiler builtin)
1340 AC_CHECK_TYPE(__uint128_t, AC_DEFINE(HAVE___UINT128_T, 1, [compiler specific 128 bit unsigned integer]), [], [])
1343 dnl # Check for uint128_t (fictitious future data type)
1345 AC_CHECK_TYPE(uint128_t, AC_DEFINE(HAVE_UINT128_T, 1, [128 bit unsigned integer]), [],
1347 #ifdef HAVE_INTTYPES_H
1348 # include <inttypes.h>
1351 #ifdef HAVE_STDINT_H
1352 # include <stdint.h>
1357 AC_CHECK_TYPE(struct in6_addr, AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1, [IPv6 address structure]), [],
1359 #ifdef HAVE_NETINET_IN_H
1360 # include <netinet/in.h>
1365 AC_CHECK_TYPE(struct sockaddr_storage, AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1, [Generic socket addresses]), [],
1367 #ifdef HAVE_NETINET_IN_H
1368 # include <netinet/in.h>
1371 #ifdef HAVE_SYS_SOCKET_H
1372 # include <sys/socket.h>
1376 AC_CHECK_TYPE(struct sockaddr_in6, AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1, [IPv6 socket addresses]), [],
1378 #ifdef HAVE_NETINET_IN_H
1379 # include <netinet/in.h>
1383 AC_CHECK_TYPE(struct addrinfo, AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1, [Generic DNS lookups]), [],
1385 #ifdef HAVE_SYS_TYPES_H
1386 # include <sys/types.h>
1389 #ifdef HAVE_SYS_SOCKET_H
1390 # include <sys/socket.h>
1400 dnl # Check for sig_t
1402 dnl # FR_CHECK_TYPE_INCLUDE doesn't work for callbacks as it doesn't produce typedefs
1404 AC_MSG_CHECKING([if sig_t is defined])
1408 #ifdef HAVE_SIGNAL_H
1409 # include <signal.h>
1419 AC_DEFINE(HAVE_SIG_T, 1, [Define if the type sig_t is defined by signal.h])
1426 dnl #############################################################
1428 dnl # 5. Checks for structures and functions
1430 dnl #############################################################
1475 dnl # Check if we have utmpx.h
1476 dnl # if so, check if struct utmpx has entry ut_xtime
1477 dnl # if not, set it to define ut_xtime == ut_tv.tv_sec
1479 if test "x$ac_cv_header_utmpx_h" = "xyes"; then
1480 FR_CHECK_STRUCT_HAS_MEMBER([#include <utmpx.h>], [struct utmpx], ut_xtime)
1481 if test "x$ac_cv_type_struct_utmpx_has_ut_xtime" = "x"; then
1482 AC_DEFINE(ut_xtime, ut_tv.tv_sec, [define to something if you don't have ut_xtime in struct utmpx])
1487 dnl # struct ip_pktinfo
1489 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in_pktinfo], ipi_addr)
1490 if test "x$ac_cv_type_struct_in_pktinfo_has_ipi_addr" = "xyes"; then
1491 AC_DEFINE(HAVE_IP_PKTINFO, [], [define if you have IP_PKTINFO (Linux)])
1495 dnl # struct in6_pktinfo
1497 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in6_pktinfo], ipi6_addr)
1498 if test "x$ac_cv_type_struct_in6_pktinfo_has_ipi6_addr" = "xyes"; then
1499 AC_DEFINE(HAVE_IN6_PKTINFO, [], [define if you have IN6_PKTINFO (Linux)])
1503 dnl # Check for htonll and htonlll
1505 AC_MSG_CHECKING([if htonll is defined])
1509 #include <sys/types.h>
1510 #include <netinet/in.h>
1518 AC_DEFINE(HAVE_HTONLL, 1, [Define if the function (or macro) htonll exists.])
1525 AC_MSG_CHECKING([if htonlll is defined])
1529 #include <sys/types.h>
1530 #include <netinet/in.h>
1538 AC_DEFINE(HAVE_HTONLLL, 1, [Define if the function (or macro) htonlll exists.])
1545 dnl #############################################################
1547 dnl # 6. Checks for compiler characteristics
1549 dnl #############################################################
1552 dnl # Ensure that these are defined
1557 dnl # See if this is OS/2
1559 AC_MSG_CHECKING([type of OS])
1562 if test "$OS" = "OS/2"; then
1569 if test "x$developer" = "xyes"; then
1570 AC_MSG_NOTICE([Setting additional developer CFLAGS])
1573 dnl # Tell the compiler to parse doxygen documentation and verify it against function and variable declarations
1575 AX_CC_WDOCUMENTATION_FLAG
1576 if test "x$ax_cv_cc_wdocumentation_flag" = "xyes"; then
1577 devflags="-Wdocumentation"
1581 dnl # If we have -Weverything, it really means *everything* unlike -Wall
1582 dnl # It's so verbose we need to turn off warnings which aren't useful.
1584 AX_CC_WEVERYTHING_FLAG
1585 if test "x$ax_cv_cc_weverything_flag" = "xyes"; then
1586 devflags="$devflags -W -Weverything -Wformat=2 -Wno-date-time -Wno-padded -Wno-gnu-zero-variadic-macro-arguments -Wno-shorten-64-to-32 -Wno-sign-conversion -Wno-conversion -Wno-switch-enum -Wno-gnu-statement-expression -Wno-extended-offsetof -Wno-cast-align -Wno-documentation-unknown-command -Wno-covered-switch-default -Wno-packed -DWITH_VERIFY_PTR=1"
1588 if test "x$GCC" = "xyes"; then
1589 devflags="$devflags -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -W -Wredundant-decls -Wundef -Wformat-y2k -Wno-format-extra-args -Wno-format-zero-length -Wno-cast-align -Wformat-nonliteral -Wformat-security -Wformat=2 -DWITH_VERIFY_PTR=1"
1594 AC_MSG_NOTICE([Developer CFLAGS are "$devflags"])
1596 CFLAGS="$CFLAGS $devflags"
1598 dnl # Enable experimental modules (we want to know if code changes breaks one of them)
1600 if test "x$EXPERIMENTAL" != "xno"; then
1601 AC_MSG_NOTICE([is developer build, enabling experimental modules implicitly, disable with --without-experimental-modules])
1606 CFLAGS="$CFLAGS -DNDEBUG"
1611 dnl # May of been set outside of this configure script
1613 AC_MSG_CHECKING([if building with -DNDEBUG])
1614 if echo "$CFLAGS" | grep '\-DNDEBUG' > /dev/null; then
1615 AC_MSG_RESULT([yes])
1616 AC_DEFINE([WITH_NDEBUG], [1], [define if the server was built with -DNDEBUG])
1624 dnl # append the current git hash onto the version string
1626 if test -d $srcdir/.git -a "x$GIT" = "xyes"; then
1627 RADIUSD_VERSION_COMMIT=`git log --pretty=format:'%h' -n 1`
1628 AC_DEFINE_UNQUOTED([RADIUSD_VERSION_COMMIT],[${RADIUSD_VERSION_COMMIT}],[Commit HEAD at time of configuring])
1632 dnl # check for some compiler features
1635 FR_HAVE_BUILTIN_CHOOSE_EXPR
1636 FR_HAVE_BUILTIN_TYPES_COMPATIBLE_P
1637 FR_HAVE_BUILTIN_BSWAP64
1638 FR_HAVE_BOUNDED_ATTRIBUTE
1640 dnl #############################################################
1642 dnl # 7. Checks for library functions
1644 dnl #############################################################
1647 dnl # Check for talloc_set_memlimit
1648 dnl # This was only included in version 2.0.8
1650 AC_CHECK_LIB(talloc, talloc_set_memlimit,
1652 AC_DEFINE(HAVE_TALLOC_SET_MEMLIMIT, 1, [Define to 1 if you have the function talloc_set_memlimit.])
1657 dnl # Check for libcrypt
1658 dnl # We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
1660 AC_CHECK_LIB(crypt, crypt,
1664 if test "$CRYPTLIB" != ""; then
1665 AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function])
1667 AC_CHECK_FUNC(crypt, AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function]))
1670 dnl Check for libcipher
1671 AC_CHECK_LIB(cipher, setkey,
1672 CRYPTLIB="${CRYPTLIB} -lcipher"
1677 dnl # Check for libexecinfo support, on some systems this is built into libc
1678 dnl # on others it's a separate library.
1680 dnl extra argument: --with-execinfo-lib-dir
1682 AC_ARG_WITH(execinfo-lib-dir,
1683 [AS_HELP_STRING([--with-execinfo-lib-dir=DIR],
1684 [directory in which to look for execinfo library files])],
1685 [ case "$withval" in
1687 AC_MSG_ERROR([Need execinfo-lib-dir])
1692 execinfo_lib_dir="$withval"
1697 dnl extra argument: --with-execinfo-include-dir
1698 execinfo_include_dir=
1699 AC_ARG_WITH(execinfo-include-dir,
1700 [AS_HELP_STRING([--with-execinfo-include-dir=DIR],
1701 [directory in which to look for execinfo include files])],
1702 [ case "$withval" in
1704 AC_MSG_ERROR([Need execinfo-include-dir])
1709 execinfo_include_dir="$withval"
1715 dnl # Look for execinfo.h and symbols
1717 smart_try_dir=$execinfo_include_dir
1718 FR_SMART_CHECK_INCLUDE(execinfo.h)
1719 if test "x$ac_cv_header_execinfo_h" = "xyes"; then
1720 smart_try_dir=$execinfo_lib_dir
1721 FR_SMART_CHECK_LIB(execinfo, backtrace_symbols)
1722 if test "x$ac_cv_lib_execinfo_backtrace_symbols" != "xyes"; then
1723 dnl # Might be provided as part of libc
1724 AC_MSG_CHECKING([if execinfo provided as part of libc])
1727 #include <execinfo.h>
1731 backtrace_symbols(&sym, sizeof(sym)) ],
1734 ac_cv_lib_execinfo_backtrace_symbols="yes"
1742 if test "x$ac_cv_lib_execinfo_backtrace_symbols" = "xyes"; then
1743 AC_DEFINE(HAVE_EXECINFO, [1], [define this if we have <execinfo.h> and symbols])
1748 dnl # Check for regular expression support.
1750 dnl extra argument: --with-pcre
1753 [AS_HELP_STRING([--with-pcre],
1754 [use libpcre (if available). (default=yes)])],
1755 [ case "$withval" in
1765 dnl extra argument: --with-pcre-lib-dir
1767 AC_ARG_WITH(pcre-lib-dir,
1768 [AS_HELP_STRING([--with-pcre-lib-dir=DIR],
1769 [directory in which to look for pcre library files])],
1770 [ case "$withval" in
1772 AC_MSG_ERROR(Need pcre-lib-dir)
1777 pcre_lib_dir="$withval"
1782 dnl extra argument: --with-pcre-include-dir
1784 AC_ARG_WITH(pcre-include-dir,
1785 [AS_HELP_STRING([--with-pcre-include-dir=DIR],
1786 [directory in which to look for pcre include files])],
1787 [ case "$withval" in
1789 AC_MSG_ERROR(Need pcre-include-dir)
1794 pcre_include_dir="$withval"
1799 dnl extra argument: --with-regex
1802 [AS_HELP_STRING([--with-regex],
1803 [Whether to build with regular expressions (default=yes)])],
1804 [ case "$withval" in
1814 dnl # First look for PCRE
1816 if test "x$REGEX" != "xno" && test "x$PCRE" != "xno"; then
1817 smart_try_dir=$pcre_include_dir
1818 FR_SMART_CHECK_INCLUDE(pcre.h)
1819 if test "x$ac_cv_header_pcre_h" = "xyes"; then
1820 smart_try_dir=$pcre_lib_dir
1821 FR_SMART_CHECK_LIB(pcre, pcre_compile)
1822 if test "x$ac_cv_lib_pcre_pcre_compile" = "xyes"; then
1824 AC_DEFINE(HAVE_PCRE, [1], [define this if we have libpcre])
1825 AC_DEFINE(HAVE_BINSAFE_REGEX, 1, [Define if we have a binary safe regular expression library])
1831 dnl # If no PCRE, fallback to POSIX regular expressions
1833 if test "x$REGEX" = "x"; then
1835 FR_SMART_CHECK_INCLUDE(regex.h)
1836 if test "x$ac_cv_header_regex_h" = "xyes"; then
1838 AC_MSG_CHECKING([for extended regular expressions])
1848 AC_DEFINE(HAVE_REG_EXTENDED, [1], [define this if we have REG_EXTENDED (from <regex.h>)])
1856 dnl # Some platforms require the regex library to be linked explicitly
1858 AC_CHECK_LIB(regex, regcomp,
1860 LIBS="-lregex $LIBS"
1865 dnl # Check for some BSD extensions which allow normal regexes to be
1872 if test x"$ac_cv_func_regncomp" = x"yes" && test x"$ac_cv_func_regnexec" = x"yes"; then
1873 AC_DEFINE(HAVE_BINSAFE_REGEX, 1, [Define if we have a binary safe regular expression library])
1878 if test "x$REGEX" = "xyes"; then
1879 AC_DEFINE(HAVE_REGEX, 1, [Define if we have any regular expression library])
1883 dnl # Check the style of gethostbyaddr, in order of preference
1884 dnl # GNU (_r eight args)
1886 AC_DEFINE(GNUSTYLE, [1], [GNU-Style get*byaddr_r])
1889 dnl # SYSV (_r six args)
1891 AC_DEFINE(SYSVSTYLE, [2], [SYSV-Style get*byaddr_r])
1894 dnl # BSD (three args, may not be thread safe)
1896 AC_DEFINE(BSDSTYLE, [3], [BSD-Style get*byaddr_r])
1899 dnl # Tru64 has BSD version, but it is thread safe
1900 dnl # http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1739____.HTM
1901 dnl # We need #stdio.h to define NULL on FreeBSD (at least)
1903 gethostbyaddrrstyle=""
1904 AC_MSG_CHECKING([gethostbyaddr_r() syntax])
1908 dnl # With FreeBSD, check if there's a prototype for gethostbyaddr_r.
1909 dnl # Some versions (FreeBSD 5.1?) have a symbol but no prototype - so we
1910 dnl # override this test to BSDSTYLE. FreeBSD 6.2 and up have proper GNU
1911 dnl # style support.
1913 AC_CHECK_DECLS([gethostbyaddr_r], [],
1915 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE,
1916 [style of gethostbyaddr_r functions ])
1917 gethostbyaddrrstyle=BSD
1918 AC_MSG_WARN([FreeBSD overridden to BSD-style])
1928 if test "x$gethostbyaddrrstyle" = "x"; then
1934 [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL, NULL) ],
1936 AC_DEFINE(GETHOSTBYADDRRSTYLE, GNUSTYLE, [style of gethostbyaddr_r functions ])
1937 gethostbyaddrrstyle=GNU
1942 if test "x$gethostbyaddrrstyle" = "x"; then
1948 [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL) ] ,
1950 AC_DEFINE(GETHOSTBYADDRRSTYLE, SYSVSTYLE, [style of gethostbyaddr_r functions ])
1951 gethostbyaddrrstyle=SYSV
1957 if test "x$gethostbyaddrrstyle" = "x"; then
1963 [ gethostbyaddr(NULL, 0, 0) ],
1965 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE, [style of gethostbyaddr_r functions ])
1966 gethostbyaddrrstyle=BSD
1971 if test "x$gethostbyaddrrstyle" = "x"; then
1972 AC_MSG_RESULT([none! It must not exist, here.])
1974 AC_MSG_RESULT([${gethostbyaddrrstyle}-style])
1977 if test "x$gethostbyaddrrstyle" = "xBSD"; then
1978 AC_MSG_WARN([ ****** BSD-style gethostbyaddr might NOT be thread-safe! ****** ])
1982 dnl # Check the style of gethostbyname, in order of preference
1983 dnl # GNU (_r seven args)
1984 dnl # SYSV (_r five args)
1985 dnl # BSD (two args, may not be thread safe)
1986 dnl # Tru64 has BSD version, but it _is_ thread safe
1987 dnl # http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1946____.HTM
1988 dnl # We need #stdio.h to define NULL on FreeBSD (at least)
1990 gethostbynamerstyle=""
1991 AC_MSG_CHECKING([gethostbyname_r() syntax])
1997 [ gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL) ],
1999 AC_DEFINE(GETHOSTBYNAMERSTYLE, GNUSTYLE, [style of gethostbyname_r functions ])
2000 gethostbynamerstyle=GNU
2004 if test "x$gethostbynamerstyle" = "x"; then
2010 [ gethostbyname_r(NULL, NULL, NULL, 0, NULL) ] ,
2012 AC_DEFINE(GETHOSTBYNAMERSTYLE, SYSVSTYLE, [style of gethostbyname_r functions ])
2013 gethostbynamerstyle=SYSV
2018 if test "x$gethostbynamerstyle" = "x"; then
2024 [ gethostbyname(NULL) ],
2026 AC_DEFINE(GETHOSTBYNAMERSTYLE, BSDSTYLE, [style of gethostbyname_r functions ])
2027 gethostbynamerstyle=BSD
2032 if test "x$gethostbynamerstyle" = "x"; then
2033 AC_MSG_RESULT([none! It must not exist, here.])
2035 AC_MSG_RESULT([${gethostbynamerstyle}-style])
2038 if test "x$gethostbynamerstyle" = "xBSD"; then
2039 AC_MSG_WARN([ ****** BSD-style gethostbyname might NOT be thread-safe! ****** ])
2043 dnl # Check for thread-safe getpwnam_r and getgrnam_r
2045 if test "x$ac_cv_header_pwd_h" = "xyes"; then
2046 AC_MSG_CHECKING([getpwnam_r])
2050 #include <sys/types.h>
2053 [ getpwnam_r(NULL, NULL, NULL, 0, NULL) ],
2055 AC_MSG_RESULT([yes])
2056 AC_DEFINE(HAVE_GETPWNAM_R, 1,
2057 [Define to 1 if you have the getpwnam_r.]
2066 if test "x$ac_cv_header_grp_h" = "xyes"; then
2067 AC_MSG_CHECKING([getgrnam_r])
2071 #include <sys/types.h>
2074 [ getgrnam_r(NULL, NULL, NULL, 0, NULL) ],
2076 AC_MSG_RESULT([yes])
2077 AC_DEFINE(HAVE_GETGRNAM_R, 1,
2078 [Define to 1 if you have the getgrnam_r.]
2089 dnl # Check for non-posix solaris ctime_r (extra buflen int arg)
2091 AC_DEFINE(POSIXSTYLE, [1], [Posix-Style ctime_r])
2092 AC_DEFINE(SOLARISSTYLE, [2], [Solaris-Style ctime_r])
2094 AC_MSG_CHECKING([ctime_r() syntax])
2099 [ ctime_r(NULL, NULL, 0) ],
2101 AC_DEFINE(CTIMERSTYLE, SOLARISSTYLE, [style of ctime_r function])
2102 ctimerstyle="SOLARIS"
2106 if test "x$ctimerstyle" = "x"; then
2111 [ ctime_r(NULL, NULL) ],
2113 AC_DEFINE(CTIMERSTYLE, POSIXSTYLE, [style of ctime_r function])
2119 if test "x$ctimerstyle" = "x"; then
2120 AC_MSG_RESULT([none! It must not exist, here.])
2122 AC_MSG_RESULT([${ctimerstyle}-style])
2125 AC_SUBST(HOSTINFO, $host)
2127 dnl #############################################################
2129 dnl # 8. Checks for system services
2131 dnl #############################################################
2134 dnl # Figure out where libtool is located,
2138 AC_MSG_RESULT([top_builddir=$top_builddir])
2139 dnl # AC_SUBST(top_builddir)
2142 dnl # import libtool stuff
2144 dnl #############################################################
2146 dnl # Configure in any module directories.
2148 dnl #############################################################
2150 dnl ############################################################
2151 dnl # Remove any conflicting definitions if autoconf.h
2152 dnl # is being included by a module.
2153 dnl #############################################################
2154 AH_BOTTOM([#include <freeradius-devel/automask.h>])
2156 dnl ############################################################
2157 dnl # make modules by list
2158 dnl #############################################################
2159 if test "x$EXPERIMENTAL" = "xyes"; then
2160 for foo in `ls -1 "${srcdir}"/src/modules | grep rlm_`; do
2161 MODULES="$MODULES $foo"
2165 dnl # make ONLY the stable modules
2167 for foo in `cat "${srcdir}"/src/modules/stable`; do
2168 MODULES="$MODULES $foo"
2172 dnl ############################################################
2173 dnl # Add autoconf subdirs, based on the module list we
2174 dnl # previously created.
2175 dnl #############################################################
2177 for bar in $MODULES; do
2178 if test -f "${srcdir}"/src/modules/$bar/configure; then
2179 mysubdirs="$mysubdirs src/modules/$bar"
2184 dnl # Don't change the variable name here. Autoconf goes bonkers
2187 AC_CONFIG_SUBDIRS($mysubdirs)
2190 dnl #############################################################
2192 dnl # Add -Werror last, so it doesn't interfere with autoconf's
2193 dnl # test programs.
2195 dnl #############################################################
2196 if test "x$werror" == "xyes"; then
2197 CFLAGS="-Werror $CFLAGS"
2200 dnl #############################################################
2202 dnl # And finally, output the results.
2204 dnl #############################################################
2205 AC_CONFIG_COMMANDS([stamp-h], [echo timestamp > src/include/stamp-h])
2206 AC_CONFIG_COMMANDS([build-radpaths-h], [(cd ./src/include && /bin/sh ./build-radpaths-h)])
2207 AC_CONFIG_COMMANDS([main-chmod], [(cd ./src/main && chmod +x checkrad radlast radtest)])
2208 AC_CONFIG_COMMANDS([scripts-chmod], [(cd ./scripts && chmod +x rc.radiusd cron/radiusd.cron.daily cron/radiusd.cron.monthly cryptpasswd)])
2211 dnl # Substitute whatever libraries we found to be necessary
2214 AC_SUBST(INSTALLSTRIP)
2216 AC_SUBST(USE_SHARED_LIBS)
2217 USE_STATIC_LIBS="yes"
2218 AC_SUBST(USE_STATIC_LIBS)
2219 AC_SUBST(STATIC_MODULES)
2223 ./src/include/build-radpaths-h \
2224 ./src/main/radsniff.mk \
2225 ./src/main/checkrad \
2226 ./src/main/radlast \
2227 ./src/main/radtest \
2228 ./scripts/rc.radiusd \
2229 ./scripts/cron/radiusd.cron.daily \
2230 ./scripts/cron/radiusd.cron.monthly \
2231 ./scripts/cryptpasswd \
2232 ./raddb/radrelay.conf \
2233 ./raddb/radiusd.conf