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 #############################################################
37 RADIUSD_MAJOR_VERSION=`cat VERSION | sed 's/\..*//'`
38 RADIUSD_MINOR_VERSION=`cat VERSION | sed 's/^[[^\.]]*\.//' | sed 's/\..*$//'`
39 RADIUSD_INCRM_VERSION=`cat VERSION | sed 's/^.*\..*\.//' | sed 's/[[\.-]].*$//'`
41 RADIUSD_VERSION=`echo | awk -v major="$RADIUSD_MAJOR_VERSION" \
42 -v minor="$RADIUSD_MINOR_VERSION" \
43 -v incrm="$RADIUSD_INCRM_VERSION" \
44 '{ printf "%02i%02i%02i", major, minor, incrm }'`
47 dnl # Still useful for custom builds
49 RADIUSD_VERSION_STRING=`cat VERSION`
52 dnl # Add definitions to Make.inc as it's used by various build targets
54 AC_SUBST([RADIUSD_VERSION_STRING])
57 dnl # Add definitions to autoconf.h, so that the headers that we install
58 dnl # contain the version number of the server.
60 AC_DEFINE_UNQUOTED([RADIUSD_VERSION], [${RADIUSD_VERSION}], [Version integer in format <ma><ma><mi><mi><in><in>])
61 AC_DEFINE_UNQUOTED([RADIUSD_VERSION_STRING], ["${RADIUSD_VERSION_STRING}"], [Raw version string from VERSION file])
63 dnl #############################################################
65 dnl # Override some of the default autoconf variables such as
66 dnl # CFLAGS if were building in developer mode
68 dnl #############################################################
71 dnl # Enable developer features like debugging symbols.
72 dnl # These checks must be done before expanding the AC_PROG_CC
73 dnl # and AC_PROG_CXX macros.
75 AC_ARG_ENABLE(developer,
76 [ --enable-developer enables features of interest to developers.],
77 [ case "$enableval" in
87 dnl # Turn on the developer flag when taken from a git checkout (not a release)
89 if test -d $srcdir/.git; then
90 if test "x$developer" != "xno"; then
91 AC_MSG_NOTICE([found .git directory, enabling developer build implicitly, disable with --disable-developer])
97 dnl # Autoconf sets -O2 and -g by default, but this is a PITA for debugging
98 dnl # so we remove the defaults if were building in developer mode, and set
99 dnl # -g3 so nice things like macro values are included. Other arguments are
100 dnl # added later when we know what compiler were using.
102 if test "x$developer" = "xyes"; then
106 dnl #############################################################
108 dnl # 0. Checks for compiler, libtool, and command line options.
110 dnl #############################################################
113 dnl # Get system information
118 dnl # Check for GNU cc
124 dnl # check for AIX, to allow us to use some BSD functions
125 dnl # must be before macros that call the compiler.
129 AC_PROG_GCC_TRADITIONAL
134 dnl # Definitive check for whether the compiler is clang
137 if test "x$ax_cv_cc_clang" = "xyes"; then
138 AC_SUBST(clang_path, "$CC")
140 AC_SUBST(clang_path, "")
144 if test "x$ax_cv_cc_std_c11_flag" != x; then
145 CFLAGS="$CFLAGS $ax_cv_cc_std_c11_flag"
147 AC_MSG_ERROR([FreeRADIUS requires a C11 compiler])
151 dnl # Set Default CFLAGS for GCC compatible compilers
153 if test "x$GCC" = "xyes"; then
154 CFLAGS="$CFLAGS -Wall -D_GNU_SOURCE"
158 dnl # -Qunused-arguments means the compiler won't complain about unsupported arguments
160 AX_CC_QUNUSED_ARGUMENTS_FLAG
161 if test "x$ax_cv_cc_qunused_arguments_flag" = "xyes"; then
162 CFLAGS="$CFLAGS -Qunused-arguments"
163 LDFLAGS="$LDFLAGS -Qunused-arguments"
167 dnl # Compile in large (2G+) file support.
172 dnl # check for system bytesex
173 dnl # AC_DEFINES WORDS_BIGENDIAN
176 [AC_DEFINE(RADIUS_BIG_ENDIAN, 1, [Define if your processor stores words with the most significant byte first])],
177 [AC_DEFINE(RADIUS_LITTLE_ENDIAN, 1, [Define if your processor stores words with the least significant byte first])]
183 AC_CHECK_PROG(GMAKE, gmake, yes, no)
184 if test $GMAKE = no; then
185 AC_PATH_PROG(MAKE, make, /usr/local/bin/make)
187 AC_PATH_PROG(MAKE, gmake, /usr/local/gnu/bin/make)
189 makever=`$ac_cv_path_MAKE --version 2>&1 | grep "GNU Make"`
190 if test -z "$makever"; then
191 AC_MSG_ERROR([GNU Make is not installed. Please download and install it from ftp://prep.ai.mit.edu/pub/gnu/make/ before continuing.])
195 dnl # autoconf explicitly sets MAKEFLAGS and MFLAGS to '' even though we
196 dnl # didn't tell it to, so we have to use FR_MAKEFLAGS.
198 dnl # determine the number of cores available and set the number of build
199 dnl # processes appropriately.
203 dnl # Temporarily disabled because test and installation targets do not
204 dnl # have dependencies set up correctly for multiple build processes.
205 dnl if test "x$ax_cv_system_cores" != "x"; then
206 dnl : ${FR_MAKEFLAGS=-j$ax_cv_system_cores}
208 AC_SUBST(FR_MAKEFLAGS)
211 dnl # See if we have Git.
213 AC_CHECK_PROG(GIT, git, yes, no)
215 dnl Put this in later, when all distributed modules use autoconf.
216 dnl AC_ARG_WITH(disablemodulefoo,
217 dnl [ --without-rlm_foo Disables module compilation. Module list:]
218 dnl esyscmd([find src/modules -type d -name rlm_\* -print |\
219 dnl sed -e 's%src/modules/.*/% (sub)- %; s%.*/%- %' |\
220 dnl awk '{print " "$0}']))
222 AC_ARG_ENABLE(strict-dependencies,
223 [ --enable-strict-dependencies fail configure on lack of module dependancy.])
225 AC_ARG_ENABLE(werror,
226 [ --enable-werror causes the build to fail if any warnings are generated.],
227 [ case "$enableval" in
237 dnl # extra argument: --with-docdir
239 docdir='${datadir}/doc/freeradius'
240 AC_MSG_CHECKING([docdir])
242 [ --with-docdir=DIR directory for documentation [DATADIR/doc/freeradius] ],
249 [[\\/$]]* | ?:[[\\/]]* )
253 AC_MSG_ERROR([expected an absolute directory name for --with-docdir: $withval])
258 AC_MSG_RESULT($docdir)
259 if test "x$docdir" = xno; then
260 AC_MSG_WARN([Documentation files will NOT be installed.])
264 dnl # extra argument: --with-logdir
266 logdir='${localstatedir}/log/radius'
267 AC_MSG_CHECKING(logdir)
269 [ --with-logdir=DIR directory for logfiles [LOCALSTATEDIR/log/radius] ],
272 AC_MSG_ERROR([Need logdir])
276 [[\\/$]]* | ?:[[\\/]]* )
280 AC_MSG_ERROR([expected an absolute directory name for --with-logdir: $withval])
285 AC_MSG_RESULT($logdir)
288 dnl # extra argument: --with-radacctdir
290 radacctdir='${logdir}/radacct'
291 AC_MSG_CHECKING(radacctdir)
292 AC_ARG_WITH(radacctdir,
293 [ --with-radacctdir=DIR directory for detail files [LOGDIR/radacct] ],
296 AC_MSG_ERROR([Need radacctdir])
300 [[\\/$]]* | ?:[[\\/]]* )
301 radacctdir="$withval"
304 AC_MSG_ERROR([expected an absolute directory name for --with-radacctdir: $withval])
309 AC_MSG_RESULT($radacctdir)
312 dnl # extra argument: --with-raddbdir
314 raddbdir='${sysconfdir}/raddb'
315 AC_MSG_CHECKING(raddbdir)
316 AC_ARG_WITH(raddbdir,
317 [ --with-raddbdir=DIR directory for config files [SYSCONFDIR/raddb] ],
320 AC_MSG_ERROR([Need raddbdir])
324 [[\\/$]]* | ?:[[\\/]]* )
328 AC_MSG_ERROR([expected an absolute directory name for --with-raddbdir: $withval])
333 AC_MSG_RESULT($raddbdir)
336 dnl # extra argument: --with-dictdir
338 dictdir='${datarootdir}/freeradius'
339 AC_MSG_CHECKING(dictdir)
341 [ --with-dictdir=DIR directory for dictionary files [DATAROOTDIR/freeradius] ],
344 AC_MSG_ERROR([Need dictdir])
348 [[\\/$]]* | ?:[[\\/]]* )
352 AC_MSG_ERROR([expected an absolute directory name for --with-dictdir: $withval])
357 AC_MSG_RESULT($dictdir)
359 modconfdir='${raddbdir}/mods-config'
363 dnl # extra argument: --with-ascend-binary
365 WITH_ASCEND_BINARY=yes
366 AC_ARG_WITH(ascend-binary,
367 [ --with-ascend-binary include support for Ascend binary filter attributes (default=yes)],
372 WITH_ASCEND_BINARY=no
375 if test "x$WITH_ASCEND_BINARY" = "xyes"; then
376 AC_DEFINE(WITH_ASCEND_BINARY, [1], [include support for Ascend binary filter attributes])
380 dnl # extra argument: --with-threads
384 [ --with-threads use threads, if available. (default=yes) ],
394 dnl # extra argument: --with-tcp
398 [ --with-tcp compile in TCP support. (default=yes)],
406 if test "x$WITH_TCP" = "xyes"; then
407 AC_DEFINE(WITH_TCP, [1], [define if you want TCP support (For RADSec et al)])
411 dnl # extra argument: --with-vmps
415 [ --with-vmps compile in VMPS support. (default=yes)],
423 if test "x$WITH_VMPS" = "xyes"; then
424 AC_DEFINE(WITH_VMPS, [1], [define if you want VMPS support])
428 dnl # extra argument: --with-dhcp
432 [ --with-dhcp compile in DHCP support. (default=yes)],
440 if test "x$WITH_DHCP" = "xyes"; then
441 AC_DEFINE(WITH_DHCP, [1], [define if you want DHCP support])
445 dnl # Allow the user to specify a list of modules to be linked
446 dnl # statically to the server.
449 AC_ARG_WITH(static_modules,
450 [ --with-static-modules=QUOTED-MODULE-LIST],[
451 for i in $withval; do
452 STATIC_MODULES="$STATIC_MODULES -dlpreopen ../modules/rlm_$i/rlm_$i.la"
457 AC_ARG_WITH(shared-libs,
458 [AS_HELP_STRING([--with-shared-libs ],
459 [build dynamic libraries and link against them. (default=yes)])],
470 [ --with-modules=QUOTED-MODULE-LIST],[
471 for i in $withval; do
472 MODULES="$MODULES $i"
477 dnl # extra argument: --with-experimental-modules
480 AC_ARG_WITH(experimental-modules,
481 [AS_HELP_STRING([--with-experimental-modules],
482 [use experimental and unstable modules. (default=no, unless --enable-developer=yes)])],
495 dnl # extra argument: --with-udpfromto
498 AC_ARG_WITH(udpfromto,
499 [ --with-udpfromto compile in UDPFROMTO support. (default=yes)],
509 if test "x$WITH_UDPFROMTO" = "xyes"; then
510 AC_DEFINE(WITH_UDPFROMTO, [], [define if you want udpfromto])
514 dnl # These next two arguments don't actually do anything. They're
515 dnl # place holders so that the top-level configure script can tell
516 dnl # the user how to configure lower-level modules
520 dnl # extra argument: --with-rlm-FOO-lib-dir
522 AC_ARG_WITH(rlm-FOO-lib-dir,
523 [AS_HELP_STRING([--with-rlm-FOO-lib-dir=DIR],
524 [directory in which to look for library files used by module FOO])],
532 dnl # extra argument: --with-rlm-FOO-include-dir
534 AC_ARG_WITH(rlm-FOO-include-dir,
535 [AS_HELP_STRING([--with-rlm-FOO-include-dir=DIR],
536 [directory in which to look for include files used by module FOO])],
544 dnl # extra argument: --with-openssl
548 [ --with-openssl use OpenSSL. (default=yes)],
560 dnl # extra argument: --with-openssl-lib-dir=dir
563 AC_ARG_WITH(openssl-lib-dir,
564 [AS_HELP_STRING([--with-openssl-lib-dir=DIR],
565 [directory to look for OpenSSL library files])],
567 *) openssl_lib_dir="$withval"
573 dnl # extra argument: --with-openssl-includes=dir
576 AC_ARG_WITH(openssl-include-dir,
577 [AS_HELP_STRING([--with-openssl-include-dir=DIR],
578 [directory to look for OpenSSL include files])],
580 *) openssl_include_dir="$withval"
586 dnl # extra argument: --disable-openssl-version-check
588 AC_ARG_ENABLE(openssl-version-check,
589 [AS_HELP_STRING([--disable-openssl-version-check],
590 [disable vulnerable OpenSSL version check])]
592 if test "x$enable_openssl_version_check" != "xno"; then
593 AC_DEFINE(ENABLE_OPENSSL_VERSION_CHECK, [1],
594 [Define to 1 to have OpenSSL version check enabled])
595 openssl_version_check_config="\
597 # allow_vulnerable_openssl: Allow the server to start with
598 # versions of OpenSSL known to have critical vulnerabilities.
600 # This check is based on the version number reported by libssl
601 # and may not reflect patches applied to libssl by
602 # distribution maintainers.
604 allow_vulnerable_openssl = no"
606 openssl_version_check_config=
608 AC_SUBST([openssl_version_check_config])
611 dnl #############################################################
613 dnl # 1. Checks for programs
615 dnl #############################################################
618 AC_PATH_PROG(PERL, perl, /usr/local/bin/perl)
619 if test "x$ac_cv_path_PERL" = "x"; then
620 AC_MSG_WARN([perl not found - Simultaneous-Use and checkrad may not work])
622 AC_PATH_PROG(SNMPGET, snmpget)
623 if test "x$ac_cv_path_SNMPGET" = "x"; then
624 AC_MSG_WARN([snmpget not found - Simultaneous-Use and checkrad may not work])
627 AC_PATH_PROG(SNMPWALK, snmpwalk)
628 if test "x$ac_cv_path_SNMPWALK" = "x"; then
629 AC_MSG_WARN([snmpwalk not found - Simultaneous-Use and checkrad may not work])
632 AC_PATH_PROG(RUSERS, rusers, /usr/bin/rusers)
635 dnl # FIXME This is truly gross.
637 missing_dir=`cd $ac_aux_dir && pwd`
638 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
639 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
640 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
642 AC_PATH_PROG(LOCATE,locate)
643 AC_PATH_PROG(DIRNAME,dirname)
644 AC_PATH_PROG(GREP,grep)
646 dnl #############################################################
648 dnl # 2. Checks for libraries
650 dnl #############################################################
653 dnl extra argument: --with-talloc-lib-dir=DIR
655 AC_ARG_WITH(talloc-lib-dir,
656 [AS_HELP_STRING([--with-talloc-lib-dir=DIR],
657 [directory in which to look for talloc library files])],
660 AC_MSG_ERROR([Need talloc-lib-dir])
665 talloc_lib_dir="$withval"
669 dnl extra argument: --with-talloc-include-dir=DIR
671 AC_ARG_WITH(talloc-include-dir,
672 [AS_HELP_STRING([--with-talloc-include-dir=DIR],
673 [directory in which to look for talloc include files])],
676 AC_MSG_ERROR([Need talloc-include-dir])
681 talloc_include_dir="$withval"
685 smart_try_dir="$talloc_lib_dir"
686 FR_SMART_CHECK_LIB(talloc, _talloc)
687 if test "x$ac_cv_lib_talloc__talloc" != "xyes"; then
688 AC_MSG_WARN([talloc library not found. Use --with-talloc-lib-dir=<path>.])
689 AC_MSG_ERROR([FreeRADIUS requires libtalloc])
692 TALLOC_LIBS="${smart_lib}"
693 TALLOC_LDFLAGS="${smart_ldflags}"
694 AC_SUBST(TALLOC_LIBS)
695 AC_SUBST(TALLOC_LDFLAGS)
699 dnl # If using pthreads, check for -lpthread (posix) or -lc_r (*BSD)
702 if test "x$WITH_THREADS" = "xyes"; then
703 if test $ac_cv_prog_suncc = "yes"; then
707 AC_CHECK_HEADERS(pthread.h, [],
714 dnl # pthread stuff is usually in -lpthread
715 dnl # or in -lc_r, on *BSD
717 dnl # On Some systems, we need extra pre-processor flags, to get them to
718 dnl # to do the threading properly.
720 AC_CHECK_LIB(pthread, pthread_create,
722 CFLAGS="$CFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS"
723 LIBS="-lpthread $LIBS"
727 dnl # -pthread is not a typo, it's a GCC option which sets additional flags required
728 dnl # for multithreading with the pthreads library.
730 AC_CHECK_LIB(c_r, pthread_create,
731 [ CFLAGS="$CFLAGS -pthread -D_THREAD_SAFE" ],
740 if test "x$WITH_THREADS" != "xyes"; then
741 AC_MSG_WARN([silently not building with thread support.])
742 AC_MSG_WARN([FAILURE: thread support requires: $fail.])
744 AC_DEFINE(WITH_THREADS, [1], [define if you want thread support])
749 dnl # If we have NO pthread libraries, remove any knowledge of threads.
751 if test "x$WITH_THREADS" != "xyes"; then
753 ac_cv_header_pthread_h="no"
757 dnl # We need sem_init() and friends, as they're the friendliest
758 dnl # semaphore functions for threading.
760 dnl # HP/UX requires linking with librt, too, to get the sem_* symbols.
761 dnl # Some systems have them in -lsem
762 dnl # Solaris has them in -lposix4
763 dnl # NetBSD has them in -lsemaphore
766 AC_SEARCH_LIBS(sem_init, pthread sem posix4 rt semaphore,
768 [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]])]
773 dnl # Check if we need -lsocket
775 AC_CHECK_LIB(dl, dlopen)
778 dnl # Check if we need -lsocket
780 AC_CHECK_LIB(socket, getsockname)
783 dnl # Check for -lresolv
784 dnl # This library may be needed later.
786 AC_CHECK_LIB(resolv, inet_aton)
789 dnl # Check if we need -lnsl. Usually if we want to
790 dnl # link against -lsocket we need to include -lnsl as well.
792 AC_CHECK_LIB(nsl, inet_ntoa)
793 AC_CHECK_LIB(ws2_32, htonl)
796 dnl # Check the pcap library for the RADIUS sniffer.
798 dnl extra argument: --with-pcap-lib-dir=DIR
800 AC_ARG_WITH(pcap-lib-dir,
801 [AS_HELP_STRING([--with-pcap-lib-dir=DIR],
802 [directory in which to look for pcap library files])],
805 AC_MSG_ERROR([Need pcap-lib-dir])
810 pcap_lib_dir="$withval"
814 dnl extra argument: --with-pcap-include-dir=DIR
816 AC_ARG_WITH(pcap-include-dir,
817 [AS_HELP_STRING([--with-pcap-include-dir=DIR],
818 [directory in which to look for pcap include files])],
821 AC_MSG_ERROR([Need pcap-include-dir])
826 pcap_include_dir="$withval"
830 smart_try_dir="$pcap_lib_dir"
831 FR_SMART_CHECK_LIB(pcap, pcap_open_live)
832 if test "x$ac_cv_lib_pcap_pcap_open_live" != "xyes"; then
833 AC_MSG_WARN([pcap library not found, silently disabling the RADIUS sniffer, and ARP listener. Use --with-pcap-lib-dir=<path>.])
835 AC_DEFINE(HAVE_LIBPCAP, 1,
836 [Define to 1 if you have the `pcap' library (-lpcap).]
846 PCAP_LIBS="${smart_lib}"
847 PCAP_LDFLAGS="${smart_ldflags}"
849 dnl Set by FR_SMART_CHECK_LIB
852 dnl Check for collectdclient
853 dnl extra argument: --with-collectdclient-lib-dir=DIR
854 collectdclient_lib_dir=
855 AC_ARG_WITH(collectdclient-lib-dir,
856 [AS_HELP_STRING([--with-collectdclient-lib-dir=DIR],
857 [directory in which to look for collectdclient library files])],
860 AC_MSG_ERROR([Need collectdclient-lib-dir])
865 collectdclient_lib_dir="$withval"
869 dnl extra argument: --with-collectdclient-include-dir=DIR
870 collectdclient_include_dir=
871 AC_ARG_WITH(collectdclient-include-dir,
872 [AS_HELP_STRING([--with-collectdclient-include-dir=DIR],
873 [directory in which to look for collectdclient include files])],
876 AC_MSG_ERROR([Need collectdclient-include-dir])
881 collectdclient_include_dir="$withval"
885 smart_try_dir="$collectdclient_lib_dir"
886 FR_SMART_CHECK_LIB(collectdclient, lcc_connect)
887 if test "x$ac_cv_lib_collectdclient_lcc_connect" != "xyes"; then
888 AC_MSG_WARN([collectdclient library not found. Use --with-collectdclient-lib-dir=<path>.])
890 COLLECTDC_LIBS="${smart_lib}"
891 COLLECTDC_LDFLAGS="${smart_ldflags}"
893 dnl Set by FR_SMART_CHECKLIB
897 dnl extra argument: --with-cap-lib-dir=DIR
899 AC_ARG_WITH(cap-lib-dir,
900 [AS_HELP_STRING([--with-cap-lib-dir=DIR],
901 [directory in which to look for cap library files])],
904 AC_MSG_ERROR([Need cap-lib-dir])
909 cap_lib_dir="$withval"
913 dnl extra argument: --with-cap-include-dir=DIR
915 AC_ARG_WITH(cap-include-dir,
916 [AS_HELP_STRING([--with-cap-include-dir=DIR],
917 [directory in which to look for cap include files])],
920 AC_MSG_ERROR([Need cap-include-dir])
925 cap_include_dir="$withval"
929 smart_try_dir="$cap_lib_dir"
930 FR_SMART_CHECK_LIB(cap, cap_get_proc)
931 if test "x$ac_cv_lib_cap_cap_get_proc" != "xyes"; then
932 AC_MSG_WARN([cap library not found, debugger checks will not be enabled. Use --with-cap-lib-dir=<path>.])
934 AC_DEFINE(HAVE_LIBCAP, 1,
935 [Define to 1 if you have the `cap' library (-lcap).]
942 dnl #############################################################
944 dnl # 3. Checks for header files
946 dnl #############################################################
949 dnl # Check for talloc header files
951 smart_try_dir="$talloc_include_dir"
952 FR_SMART_CHECK_INCLUDE([talloc.h])
953 if test "x$ac_cv_header_talloc_h" != "xyes"; then
954 AC_MSG_WARN([talloc headers not found. Use --with-talloc-include-dir=<path>.])
955 AC_MSG_ERROR([FreeRADIUS requires libtalloc])
959 dnl # Interix requires us to set -D_ALL_SOURCE, otherwise
960 dnl # getopt will be #included, but won't link. <sigh>
964 CFLAGS="$CFLAGS -D_ALL_SOURCE"
967 CFLAGS="$CFLAGS -DDARWIN"
968 LIBS="-framework DirectoryService $LIBS"
969 AC_DEFINE([__APPLE_USE_RFC_3542], 1, [Force OSX >= 10.7 Lion to use RFC2292 IPv6 socket options])
1026 dnl # FreeBSD requires sys/socket.h before net/if.h
1028 AC_CHECK_HEADERS(net/if.h, [], [],
1030 #ifdef HAVE_SYS_SOCKET_H
1031 # include <sys/socket.h>
1037 dnl # other checks which require headers
1039 if test "x$ac_cv_header_sys_security_h" = "xyes" && test "x$ac_cv_header_prot_h" = "xyes"
1041 AC_DEFINE(OSFC2, [], [define if you have OSFC2 authentication])
1044 if test "x$ac_cv_header_sia_h" = "xyes" && test "x$ac_cv_header_siad_h" = "xyes"
1046 AC_DEFINE(OSFSIA, [], [define if you have OSFSIA authentication])
1050 dnl # Were we told to use OpenSSL, if we were and we find an error, call AC_MSG_FAILURE and exit
1052 if test "x$WITH_OPENSSL" = xyes; then
1056 dnl # Apparently OpenSSL will attempt to build with kerberos if we don't pass this?!
1058 CFLAGS="$CFLAGS -DOPENSSL_NO_KRB5"
1061 dnl # Check we can link to libcrypto and libssl
1063 smart_try_dir="$openssl_lib_dir"
1064 FR_SMART_CHECK_LIB(crypto, DH_new)
1065 if test "x$ac_cv_lib_crypto_DH_new" = "xyes"; then
1066 AC_DEFINE(HAVE_LIBCRYPTO, 1, [Define to 1 if you have the `crypto' library (-lcrypto).])
1067 OPENSSL_LIBS="$smart_lib"
1068 OPENSSL_LDFLAGS="$smart_ldflags"
1070 FR_SMART_CHECK_LIB(ssl, SSL_new)
1071 if test "x$ac_cv_lib_ssl_SSL_new" != "xyes"; then
1072 AC_MSG_FAILURE([failed linking to libssl. Use --with-openssl-lib-dir=<path>, or --with-openssl=no (builds without OpenSSL)])
1074 AC_DEFINE(HAVE_LIBSSL, 1, [Define to 1 if you have the `ssl' library (-lssl).])
1075 OPENSSL_LIBS="$OPENSSL_LIBS $smart_lib"
1077 if test "$OPENSSL_LDFLAGS" != "$smart_ldflags"; then
1078 AC_MSG_FAILURE(["inconsistent LDFLAGS between -lssl '$smart_ldflags' and -lcrypto '$OPENSSL_LDFLAGS'"])
1082 AC_MSG_FAILURE([failed linking to libcrypto. Use --with-openssl-lib-dir=<path>, or --with-openssl=no (builds without OpenSSL)])
1085 smart_try_dir="$openssl_include_dir"
1086 FR_SMART_CHECK_INCLUDE(openssl/ssl.h)
1087 if test "x$ac_cv_header_openssl_ssl_h" = "xyes"; then
1088 AC_DEFINE(HAVE_OPENSSL_SSL_H, 1, [Define to 1 if you have the <openssl/ssl.h> header file.])
1099 [ OPENSSL_CPPFLAGS="$smart_include" ],
1101 AC_MSG_FAILURE([failed locating OpenSSL headers. Use --with-openssl-include-dir=<path>, or --with-openssl=no (builds without OpenSSL)])
1105 AC_MSG_CHECKING([for OpenSSL version >= 0.9.7])
1107 [#include <openssl/crypto.h>
1108 #if (OPENSSL_VERSION_NUMBER >= 0x00907000L)
1117 AC_MSG_FAILURE([OpenSSL version too old])
1122 dnl # CPPFLAGS are passed to the compiler first, so we use
1123 dnl # them to ensure things like --sysroot don't override the
1124 dnl # library location we discovered previously.
1126 old_CPPFLAGS="$CPPFLAGS"
1127 CPPFLAGS="$OPENSSL_CPPFLAGS $CPPFLAGS"
1130 dnl # Now check that the header versions match the library
1132 AC_MSG_CHECKING([OpenSSL library and header version consistency])
1137 #include <openssl/opensslv.h>
1138 #include <openssl/crypto.h>
1141 printf("library: %lx header: %lx... ", (unsigned long) SSLeay(), (unsigned long) OPENSSL_VERSION_NUMBER);
1142 if (SSLeay() == OPENSSL_VERSION_NUMBER) {
1154 AC_MSG_FAILURE([OpenSSL library version does not match header version])
1157 CPPFLAGS="$old_CPPFLAGS"
1161 AC_SUBST(OPENSSL_LIBS)
1162 AC_SUBST(OPENSSL_LDFLAGS)
1163 AC_SUBST(OPENSSL_CPPFLAGS)
1164 export OPENSSL_LIBS OPENSSL_LDFLAGS OPENSSL_CPPFLAGS
1168 dnl # Check the pcap includes for the RADIUS sniffer.
1170 if test "x$PCAP_LIBS" = x; then
1171 AC_MSG_NOTICE([skipping test for pcap.h.])
1174 dnl # Check for pcap header files
1176 smart_try_dir="$pcap_include_dir"
1177 FR_SMART_CHECK_INCLUDE([pcap.h])
1178 if test "x$ac_cv_header_pcap_h" == "xyes"; then
1179 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
1181 AC_SUBST(PCAP_LDFLAGS)
1183 AC_MSG_WARN([pcap headers not found, silently disabling the RADIUS sniffer, and ARP listener. Use --with-pcap-include-dir=<path>.])
1187 dnl Check for collectd-client
1188 if test "x$COLLECTDC_LIBS" = x; then
1189 AC_MSG_NOTICE([skipping test for collectd/client.h.])
1192 dnl # Check for collectd-client header files
1194 smart_try_dir="$collectdclient_include_dir"
1195 FR_SMART_CHECK_INCLUDE([collectd/client.h])
1196 if test "x$ac_cv_header_collectd_client_h" == "xyes"; then
1197 AC_DEFINE(HAVE_COLLECTDC_H, 1, [Define to 1 if you have the `collectdclient' library (-lcollectdclient).])
1198 AC_SUBST(COLLECTDC_LIBS)
1199 AC_SUBST(COLLECTDC_LDFLAGS)
1201 AC_MSG_WARN([collectdclient headers not found. Use --with-collectdclient-include-dir=<path>.])
1206 dnl # Check the CAP includes for debugger checks
1208 if test "x$HAVE_LIBCAP" = x; then
1209 AC_MSG_NOTICE([skipping test for cap.h.])
1212 dnl # Check for CAP header files
1214 smart_try_dir="$cap_include_dir"
1215 FR_SMART_CHECK_INCLUDE([sys/capability.h])
1216 if test "x$ac_cv_header_sys_capability_h" == "xyes"; then
1217 AC_DEFINE(HAVE_CAPABILITY_H, 1, [Define to 1 if you have the <sys/capability.h> header file.])
1219 AC_MSG_WARN([cap headers not found, will not perform debugger checks. Use --with-cap-include-dir=<path>.])
1223 dnl #############################################################
1225 dnl # 4. Checks for typedefs
1227 dnl #############################################################
1230 dnl # Ensure that these are defined
1238 dnl # Check for socklen_t
1240 FR_CHECK_TYPE_INCLUDE(
1242 #ifdef HAVE_SYS_TYPES_H
1243 # include <sys/types.h>
1246 #ifdef HAVE_SYS_SOCKET_H
1247 # include <sys/socket.h>
1250 socklen_t, int, [socklen_t is generally 'int' on systems which don't use it]
1254 dnl # Check for uint8_t
1256 FR_CHECK_TYPE_INCLUDE(
1258 #ifdef HAVE_INTTYPES_H
1259 # include <inttypes.h>
1262 #ifdef HAVE_STDINT_H
1263 # include <stdint.h>
1266 uint8_t, unsigned char, [uint8_t should be the canonical 'octet' for network traffic]
1270 dnl # Check for uint16_t
1272 FR_CHECK_TYPE_INCLUDE(
1274 #ifdef HAVE_INTTYPES_H
1275 # include <inttypes.h>
1278 #ifdef HAVE_STDINT_H
1279 # include <stdint.h>
1282 uint16_t, unsigned short, [uint16_t should be the canonical '2 octets' for network traffic]
1286 dnl # Check for uint32_t
1288 FR_CHECK_TYPE_INCLUDE(
1290 #ifdef HAVE_INTTYPES_H
1291 # include <inttypes.h>
1294 #ifdef HAVE_STDINT_H
1295 # include <stdint.h>
1298 uint32_t, unsigned int, [uint32_t should be the canonical 'network integer']
1302 dnl # Check for uint64_t
1304 FR_CHECK_TYPE_INCLUDE(
1306 #ifdef HAVE_INTTYPES_H
1307 # include <inttypes.h>
1310 #ifdef HAVE_STDINT_H
1311 # include <stdint.h>
1314 uint64_t, unsigned long long, [uint64_t is required for larger counters]
1318 dnl # Check for __uint128_t (compiler builtin)
1320 AC_CHECK_TYPE(__uint128_t, AC_DEFINE(HAVE___UINT128_T, 1, [compiler specific 128 bit unsigned integer]), [], [])
1323 dnl # Check for uint128_t (fictitious future data type)
1325 AC_CHECK_TYPE(uint128_t, AC_DEFINE(HAVE_UINT128_T, 1, [128 bit unsigned integer]), [],
1327 #ifdef HAVE_INTTYPES_H
1328 # include <inttypes.h>
1331 #ifdef HAVE_STDINT_H
1332 # include <stdint.h>
1337 AC_CHECK_TYPE(struct in6_addr, AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1, [IPv6 address structure]), [],
1339 #ifdef HAVE_NETINET_IN_H
1340 # include <netinet/in.h>
1345 AC_CHECK_TYPE(struct sockaddr_storage, AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1, [Generic socket addresses]), [],
1347 #ifdef HAVE_NETINET_IN_H
1348 # include <netinet/in.h>
1351 #ifdef HAVE_SYS_SOCKET_H
1352 # include <sys/socket.h>
1356 AC_CHECK_TYPE(struct sockaddr_in6, AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1, [IPv6 socket addresses]), [],
1358 #ifdef HAVE_NETINET_IN_H
1359 # include <netinet/in.h>
1363 AC_CHECK_TYPE(struct addrinfo, AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1, [Generic DNS lookups]), [],
1365 #ifdef HAVE_SYS_TYPES_H
1366 # include <sys/types.h>
1369 #ifdef HAVE_SYS_SOCKET_H
1370 # include <sys/socket.h>
1380 dnl # Check for sig_t
1382 dnl # FR_CHECK_TYPE_INCLUDE doesn't work for callbacks as it doesn't produce typedefs
1384 AC_MSG_CHECKING([if sig_t is defined])
1388 #ifdef HAVE_SIGNAL_H
1389 # include <signal.h>
1399 AC_DEFINE(HAVE_SIG_T, 1, [Define if the type sig_t is defined by signal.h])
1406 dnl #############################################################
1408 dnl # 5. Checks for structures and functions
1410 dnl #############################################################
1451 dnl # Check if we have utmpx.h
1452 dnl # if so, check if struct utmpx has entry ut_xtime
1453 dnl # if not, set it to define ut_xtime == ut_tv.tv_sec
1455 if test "x$ac_cv_header_utmpx_h" = "xyes"; then
1456 FR_CHECK_STRUCT_HAS_MEMBER([#include <utmpx.h>], [struct utmpx], ut_xtime)
1457 if test "x$ac_cv_type_struct_utmpx_has_ut_xtime" = "x"; then
1458 AC_DEFINE(ut_xtime, ut_tv.tv_sec, [define to something if you don't have ut_xtime in struct utmpx])
1463 dnl # struct ip_pktinfo
1465 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in_pktinfo], ipi_addr)
1466 if test "x$ac_cv_type_struct_in_pktinfo_has_ipi_addr" = "xyes"; then
1467 AC_DEFINE(HAVE_IP_PKTINFO, [], [define if you have IP_PKTINFO (Linux)])
1471 dnl # struct in6_pktinfo
1473 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in6_pktinfo], ipi6_addr)
1474 if test "x$ac_cv_type_struct_in6_pktinfo_has_ipi6_addr" = "xyes"; then
1475 AC_DEFINE(HAVE_IN6_PKTINFO, [], [define if you have IN6_PKTINFO (Linux)])
1479 dnl # Check for htonll and htonlll
1481 AC_MSG_CHECKING([if htonll is defined])
1485 #include <sys/types.h>
1486 #include <netinet/in.h>
1494 AC_DEFINE(HAVE_HTONLL, 1, [Define if the function (or macro) htonll exists.])
1501 AC_MSG_CHECKING([if htonlll is defined])
1505 #include <sys/types.h>
1506 #include <netinet/in.h>
1514 AC_DEFINE(HAVE_HTONLLL, 1, [Define if the function (or macro) htonlll exists.])
1521 dnl #############################################################
1523 dnl # 6. Checks for compiler characteristics
1525 dnl #############################################################
1528 dnl # Ensure that these are defined
1533 dnl # See if this is OS/2
1535 AC_MSG_CHECKING([type of OS])
1538 if test "$OS" = "OS/2"; then
1545 if test "x$developer" = "xyes"; then
1546 AC_MSG_NOTICE([Setting additional developer CFLAGS])
1549 dnl # Tell the compiler to parse doxygen documentation and verify it against function and variable declarations
1551 AX_CC_WDOCUMENTATION_FLAG
1552 if test "x$ax_cv_cc_wdocumentation_flag" = "xyes"; then
1553 devflags="-Wdocumentation"
1557 dnl # If we have -Weverything, it really means *everything* unlike -Wall
1558 dnl # It's so verbose we need to turn off warnings which aren't useful.
1560 AX_CC_WEVERYTHING_FLAG
1561 if test "x$ax_cv_cc_weverything_flag" = "xyes"; then
1562 devflags="$devflags -Weverything -Wformat=2 -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"
1564 if test "x$GCC" = "xyes"; then
1565 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"
1570 AC_MSG_NOTICE([Developer CFLAGS are "$devflags"])
1572 CFLAGS="$CFLAGS $devflags"
1574 dnl # Enable experimental modules (we want to know if code changes breaks one of them)
1576 if test "x$EXPERIMENTAL" != "xno"; then
1577 AC_MSG_NOTICE([is developer build, enabling experimental modules implicitly, disable with --without-experimental-modules])
1582 CFLAGS="$CFLAGS -DNDEBUG"
1587 dnl # May of been set outside of this configure script
1589 AC_MSG_CHECKING([if building with -DNDEBUG])
1590 if echo "$CFLAGS" | grep '\-DNDEBUG' > /dev/null; then
1591 AC_MSG_RESULT([yes])
1592 AC_DEFINE([WITH_NDEBUG], [1], [define if the server was built with -DNDEBUG])
1600 dnl # append the current git hash onto the version string
1602 if test -d $srcdir/.git -a "x$GIT" = "xyes"; then
1603 RADIUSD_VERSION_COMMIT=`git log --pretty=format:'%h' -n 1`
1604 AC_DEFINE_UNQUOTED([RADIUSD_VERSION_COMMIT],[${RADIUSD_VERSION_COMMIT}],[Commit HEAD at time of configuring])
1608 dnl # check for some compiler features
1611 FR_HAVE_BUILTIN_CHOOSE_EXPR
1612 FR_HAVE_BUILTIN_TYPES_COMPATIBLE_P
1613 FR_HAVE_BUILTIN_BSWAP_64
1615 dnl #############################################################
1617 dnl # 7. Checks for library functions
1619 dnl #############################################################
1622 dnl # Check for talloc_set_memlimit
1623 dnl # This was only included in version 2.0.8
1625 AC_CHECK_LIB(talloc, talloc_set_memlimit,
1627 AC_DEFINE(HAVE_TALLOC_SET_MEMLIMIT, 1, [Define to 1 if you have the function talloc_set_memlimit.])
1632 dnl # Check for libcrypt
1633 dnl # We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
1635 AC_CHECK_LIB(crypt, crypt,
1639 if test "$CRYPTLIB" != ""; then
1640 AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function])
1642 AC_CHECK_FUNC(crypt, AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function]))
1645 dnl Check for libcipher
1646 AC_CHECK_LIB(cipher, setkey,
1647 CRYPTLIB="${CRYPTLIB} -lcipher"
1652 dnl # Check for libexecinfo support, on some systems this is built into libc
1653 dnl # on others it's a separate library.
1655 dnl extra argument: --with-execinfo-lib-dir
1657 AC_ARG_WITH(execinfo-lib-dir,
1658 [AS_HELP_STRING([--with-execinfo-lib-dir=DIR],
1659 [directory in which to look for execinfo library files])],
1660 [ case "$withval" in
1662 AC_MSG_ERROR([Need execinfo-lib-dir])
1667 execinfo_lib_dir="$withval"
1672 dnl extra argument: --with-execinfo-include-dir
1673 execinfo_include_dir=
1674 AC_ARG_WITH(execinfo-include-dir,
1675 [AS_HELP_STRING([--with-execinfo-include-dir=DIR],
1676 [directory in which to look for execinfo include files])],
1677 [ case "$withval" in
1679 AC_MSG_ERROR([Need execinfo-include-dir])
1684 execinfo_include_dir="$withval"
1690 dnl # Look for execinfo.h and symbols
1692 smart_try_dir=$execinfo_include_dir
1693 FR_SMART_CHECK_INCLUDE(execinfo.h)
1694 if test "x$ac_cv_header_execinfo_h" = "xyes"; then
1695 smart_try_dir=$execinfo_lib_dir
1696 FR_SMART_CHECK_LIB(execinfo, backtrace_symbols)
1697 if test "x$ac_cv_lib_execinfo_backtrace_symbols" != "xyes"; then
1698 dnl # Might be provided as part of libc
1699 AC_MSG_CHECKING([if execinfo provided as part of libc])
1702 #include <execinfo.h>
1706 backtrace_symbols(&sym, sizeof(sym)) ],
1709 ac_cv_lib_execinfo_backtrace_symbols="yes"
1717 if test "x$ac_cv_lib_execinfo_backtrace_symbols" = "xyes"; then
1718 AC_DEFINE(HAVE_EXECINFO, [1], [define this if we have <execinfo.h> and symbols])
1723 dnl # Check for regular expression support.
1725 dnl extra argument: --with-pcre
1728 [AS_HELP_STRING([--with-pcre],
1729 [use libpcre (if available). (default=yes)])],
1730 [ case "$withval" in
1740 dnl extra argument: --with-pcre-lib-dir
1742 AC_ARG_WITH(pcre-lib-dir,
1743 [AS_HELP_STRING([--with-pcre-lib-dir=DIR],
1744 [directory in which to look for pcre library files])],
1745 [ case "$withval" in
1747 AC_MSG_ERROR(Need pcre-lib-dir)
1752 pcre_lib_dir="$withval"
1757 dnl extra argument: --with-pcre-include-dir
1759 AC_ARG_WITH(pcre-include-dir,
1760 [AS_HELP_STRING([--with-pcre-include-dir=DIR],
1761 [directory in which to look for pcre include files])],
1762 [ case "$withval" in
1764 AC_MSG_ERROR(Need pcre-include-dir)
1769 pcre_include_dir="$withval"
1774 dnl extra argument: --with-regex
1777 [AS_HELP_STRING([--with-regex],
1778 [Whether to build with regular expressions (default=yes)])],
1779 [ case "$withval" in
1789 dnl # First look for PCRE
1791 if test "x$REGEX" != "xno" && test "x$PCRE" != "xno"; then
1792 smart_try_dir=$pcre_include_dir
1793 FR_SMART_CHECK_INCLUDE(pcre.h)
1794 if test "x$ac_cv_header_pcre_h" = "xyes"; then
1795 smart_try_dir=$pcre_lib_dir
1796 FR_SMART_CHECK_LIB(pcre, pcre_compile)
1797 if test "x$ac_cv_lib_pcre_pcre_compile" = "xyes"; then
1799 AC_DEFINE(HAVE_PCRE, [1], [define this if we have libpcre])
1800 AC_DEFINE(HAVE_BINSAFE_REGEX, 1, [Define if we have a binary safe regular expression library])
1806 dnl # If no PCRE, fallback to POSIX regular expressions
1808 if test "x$REGEX" = "x"; then
1810 FR_SMART_CHECK_INCLUDE(regex.h)
1811 if test "x$ac_cv_header_regex_h" = "xyes"; then
1813 AC_MSG_CHECKING([for extended regular expressions])
1823 AC_DEFINE(HAVE_REG_EXTENDED, [1], [define this if we have REG_EXTENDED (from <regex.h>)])
1831 dnl # Some platforms require the regex library to be linked explicitly
1833 AC_CHECK_LIB(regex, regcomp,
1835 LIBS="-lregex $LIBS"
1840 dnl # Check for some BSD extensions which allow normal regexes to be
1847 if test x"$ac_cv_func_regncomp" = x"yes" && test x"$ac_cv_func_regnexec" = x"yes"; then
1848 AC_DEFINE(HAVE_BINSAFE_REGEX, 1, [Define if we have a binary safe regular expression library])
1853 if test "x$REGEX" = "xyes"; then
1854 AC_DEFINE(HAVE_REGEX, 1, [Define if we have any regular expression library])
1858 dnl # Check the style of gethostbyaddr, in order of preference
1859 dnl # GNU (_r eight args)
1861 AC_DEFINE(GNUSTYLE, [1], [GNU-Style get*byaddr_r])
1864 dnl # SYSV (_r six args)
1866 AC_DEFINE(SYSVSTYLE, [2], [SYSV-Style get*byaddr_r])
1869 dnl # BSD (three args, may not be thread safe)
1871 AC_DEFINE(BSDSTYLE, [3], [BSD-Style get*byaddr_r])
1874 dnl # Tru64 has BSD version, but it is thread safe
1875 dnl # http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1739____.HTM
1876 dnl # We need #stdio.h to define NULL on FreeBSD (at least)
1878 gethostbyaddrrstyle=""
1879 AC_MSG_CHECKING([gethostbyaddr_r() syntax])
1883 dnl # With FreeBSD, check if there's a prototype for gethostbyaddr_r.
1884 dnl # Some versions (FreeBSD 5.1?) have a symbol but no prototype - so we
1885 dnl # override this test to BSDSTYLE. FreeBSD 6.2 and up have proper GNU
1886 dnl # style support.
1888 AC_CHECK_DECLS([gethostbyaddr_r], [],
1890 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE,
1891 [style of gethostbyaddr_r functions ])
1892 gethostbyaddrrstyle=BSD
1893 AC_MSG_WARN([FreeBSD overridden to BSD-style])
1903 if test "x$gethostbyaddrrstyle" = "x"; then
1909 [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL, NULL) ],
1911 AC_DEFINE(GETHOSTBYADDRRSTYLE, GNUSTYLE, [style of gethostbyaddr_r functions ])
1912 gethostbyaddrrstyle=GNU
1917 if test "x$gethostbyaddrrstyle" = "x"; then
1923 [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL) ] ,
1925 AC_DEFINE(GETHOSTBYADDRRSTYLE, SYSVSTYLE, [style of gethostbyaddr_r functions ])
1926 gethostbyaddrrstyle=SYSV
1932 if test "x$gethostbyaddrrstyle" = "x"; then
1938 [ gethostbyaddr(NULL, 0, 0) ],
1940 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE, [style of gethostbyaddr_r functions ])
1941 gethostbyaddrrstyle=BSD
1946 if test "x$gethostbyaddrrstyle" = "x"; then
1947 AC_MSG_RESULT([none! It must not exist, here.])
1949 AC_MSG_RESULT([${gethostbyaddrrstyle}-style])
1952 if test "x$gethostbyaddrrstyle" = "xBSD"; then
1953 AC_MSG_WARN([ ****** BSD-style gethostbyaddr might NOT be thread-safe! ****** ])
1957 dnl # Check the style of gethostbyname, in order of preference
1958 dnl # GNU (_r seven args)
1959 dnl # SYSV (_r five args)
1960 dnl # BSD (two args, may not be thread safe)
1961 dnl # Tru64 has BSD version, but it _is_ thread safe
1962 dnl # http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1946____.HTM
1963 dnl # We need #stdio.h to define NULL on FreeBSD (at least)
1965 gethostbynamerstyle=""
1966 AC_MSG_CHECKING([gethostbyname_r() syntax])
1972 [ gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL) ],
1974 AC_DEFINE(GETHOSTBYNAMERSTYLE, GNUSTYLE, [style of gethostbyname_r functions ])
1975 gethostbynamerstyle=GNU
1979 if test "x$gethostbynamerstyle" = "x"; then
1985 [ gethostbyname_r(NULL, NULL, NULL, 0, NULL) ] ,
1987 AC_DEFINE(GETHOSTBYNAMERSTYLE, SYSVSTYLE, [style of gethostbyname_r functions ])
1988 gethostbynamerstyle=SYSV
1993 if test "x$gethostbynamerstyle" = "x"; then
1999 [ gethostbyname(NULL) ],
2001 AC_DEFINE(GETHOSTBYNAMERSTYLE, BSDSTYLE, [style of gethostbyname_r functions ])
2002 gethostbynamerstyle=BSD
2007 if test "x$gethostbynamerstyle" = "x"; then
2008 AC_MSG_RESULT([none! It must not exist, here.])
2010 AC_MSG_RESULT([${gethostbynamerstyle}-style])
2013 if test "x$gethostbynamerstyle" = "xBSD"; then
2014 AC_MSG_WARN([ ****** BSD-style gethostbyname might NOT be thread-safe! ****** ])
2018 dnl # Check for thread-safe getpwnam_r and getgrnam_r
2020 if test "x$ac_cv_header_pwd_h" = "xyes"; then
2021 AC_MSG_CHECKING([getpwnam_r])
2025 #include <sys/types.h>
2028 [ getpwnam_r(NULL, NULL, NULL, 0, NULL) ],
2030 AC_MSG_RESULT([yes])
2031 AC_DEFINE(HAVE_GETPWNAM_R, 1,
2032 [Define to 1 if you have the getpwnam_r.]
2041 if test "x$ac_cv_header_grp_h" = "xyes"; then
2042 AC_MSG_CHECKING([getgrnam_r])
2046 #include <sys/types.h>
2049 [ getgrnam_r(NULL, NULL, NULL, 0, NULL) ],
2051 AC_MSG_RESULT([yes])
2052 AC_DEFINE(HAVE_GETGRNAM_R, 1,
2053 [Define to 1 if you have the getgrnam_r.]
2064 dnl # Check for non-posix solaris ctime_r (extra buflen int arg)
2066 AC_DEFINE(POSIXSTYLE, [1], [Posix-Style ctime_r])
2067 AC_DEFINE(SOLARISSTYLE, [2], [Solaris-Style ctime_r])
2069 AC_MSG_CHECKING([ctime_r() syntax])
2074 [ ctime_r(NULL, NULL, 0) ],
2076 AC_DEFINE(CTIMERSTYLE, SOLARISSTYLE, [style of ctime_r function])
2077 ctimerstyle="SOLARIS"
2081 if test "x$ctimerstyle" = "x"; then
2086 [ ctime_r(NULL, NULL) ],
2088 AC_DEFINE(CTIMERSTYLE, POSIXSTYLE, [style of ctime_r function])
2094 if test "x$ctimerstyle" = "x"; then
2095 AC_MSG_RESULT([none! It must not exist, here.])
2097 AC_MSG_RESULT([${ctimerstyle}-style])
2100 AC_SUBST(HOSTINFO, $host)
2102 dnl #############################################################
2104 dnl # 8. Checks for system services
2106 dnl #############################################################
2109 dnl # Figure out where libtool is located,
2113 AC_MSG_RESULT([top_builddir=$top_builddir])
2114 dnl # AC_SUBST(top_builddir)
2117 dnl # import libtool stuff
2119 dnl #############################################################
2121 dnl # Configure in any module directories.
2123 dnl #############################################################
2125 dnl ############################################################
2126 dnl # Remove any conflicting definitions if autoconf.h
2127 dnl # is being included by a module.
2128 dnl #############################################################
2129 AH_BOTTOM([#include <freeradius-devel/automask.h>])
2131 dnl ############################################################
2132 dnl # make modules by list
2133 dnl #############################################################
2134 if test "x$EXPERIMENTAL" = "xyes"; then
2135 for foo in `ls -1 "${srcdir}"/src/modules | grep rlm_`; do
2136 MODULES="$MODULES $foo"
2140 dnl # make ONLY the stable modules
2142 for foo in `cat "${srcdir}"/src/modules/stable`; do
2143 MODULES="$MODULES $foo"
2147 dnl ############################################################
2148 dnl # Add autoconf subdirs, based on the module list we
2149 dnl # previously created.
2150 dnl #############################################################
2152 for bar in $MODULES; do
2153 if test -f "${srcdir}"/src/modules/$bar/configure; then
2154 mysubdirs="$mysubdirs src/modules/$bar"
2159 dnl # Don't change the variable name here. Autoconf goes bonkers
2162 AC_CONFIG_SUBDIRS($mysubdirs)
2165 dnl #############################################################
2167 dnl # Add -Werror last, so it doesn't interfere with autoconf's
2168 dnl # test programs.
2170 dnl #############################################################
2171 if test "x$werror" == "xyes"; then
2172 CFLAGS="-Werror $CFLAGS"
2175 dnl #############################################################
2177 dnl # And finally, output the results.
2179 dnl #############################################################
2180 AC_CONFIG_COMMANDS([stamp-h], [echo timestamp > src/include/stamp-h])
2181 AC_CONFIG_COMMANDS([build-radpaths-h], [(cd ./src/include && /bin/sh ./build-radpaths-h)])
2182 AC_CONFIG_COMMANDS([main-chmod], [(cd ./src/main && chmod +x checkrad radlast radtest)])
2183 AC_CONFIG_COMMANDS([scripts-chmod], [(cd ./scripts && chmod +x rc.radiusd cron/radiusd.cron.daily cron/radiusd.cron.monthly cryptpasswd)])
2186 dnl # Substitute whatever libraries we found to be necessary
2189 AC_SUBST(INSTALLSTRIP)
2191 AC_SUBST(USE_SHARED_LIBS)
2192 USE_STATIC_LIBS="yes"
2193 AC_SUBST(USE_STATIC_LIBS)
2194 AC_SUBST(STATIC_MODULES)
2198 ./src/include/build-radpaths-h \
2199 ./src/main/radsniff.mk \
2200 ./src/main/checkrad \
2201 ./src/main/radlast \
2202 ./src/main/radtest \
2203 ./scripts/rc.radiusd \
2204 ./scripts/cron/radiusd.cron.daily \
2205 ./scripts/cron/radiusd.cron.monthly \
2206 ./scripts/cryptpasswd \
2207 ./raddb/radrelay.conf \
2208 ./raddb/radiusd.conf