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, "")
145 dnl # Set Default CFLAGS for GCC compatible compilers
147 if test "x$GCC" = "xyes"; then
148 CFLAGS="$CFLAGS -Wall -std=c99 -D_GNU_SOURCE"
152 dnl # -Qunused-arguments means the compiler won't complain about unsupported arguments
154 AX_CC_QUNUSED_ARGUMENTS_FLAG
155 if test "x$ax_cv_cc_qunused_arguments_flag" = "xyes"; then
156 CFLAGS="$CFLAGS -Qunused-arguments"
157 LDFLAGS="$LDFLAGS -Qunused-arguments"
161 dnl # Compile in large (2G+) file support.
166 dnl # check for system bytesex
167 dnl # AC_DEFINES WORDS_BIGENDIAN
170 [AC_DEFINE(RADIUS_BIG_ENDIAN, 1, [Define if your processor stores words with the most significant byte first])],
171 [AC_DEFINE(RADIUS_LITTLE_ENDIAN, 1, [Define if your processor stores words with the least significant byte first])]
177 AC_CHECK_PROG(GMAKE, gmake, yes, no)
178 if test $GMAKE = no; then
179 AC_PATH_PROG(MAKE, make, /usr/local/bin/make)
181 AC_PATH_PROG(MAKE, gmake, /usr/local/gnu/bin/make)
183 makever=`$ac_cv_path_MAKE --version 2>&1 | grep "GNU Make"`
184 if test -z "$makever"; then
185 AC_MSG_ERROR([GNU Make is not installed. Please download and install it from ftp://prep.ai.mit.edu/pub/gnu/make/ before continuing.])
189 dnl # autoconf explicitly sets MAKEFLAGS and MFLAGS to '' even though we
190 dnl # didn't tell it to, so we have to use FR_MAKEFLAGS.
192 dnl # determine the number of cores available and set the number of build
193 dnl # processes appropriately.
197 dnl # Temporarily disabled because test and installation targets do not
198 dnl # have dependencies set up correctly for multiple build processes.
199 dnl if test "x$ax_cv_system_cores" != "x"; then
200 dnl : ${FR_MAKEFLAGS=-j$ax_cv_system_cores}
202 AC_SUBST(FR_MAKEFLAGS)
205 dnl # See if we have Git.
207 AC_CHECK_PROG(GIT, git, yes, no)
209 dnl Put this in later, when all distributed modules use autoconf.
210 dnl AC_ARG_WITH(disablemodulefoo,
211 dnl [ --without-rlm_foo Disables module compilation. Module list:]
212 dnl esyscmd([find src/modules -type d -name rlm_\* -print |\
213 dnl sed -e 's%src/modules/.*/% (sub)- %; s%.*/%- %' |\
214 dnl awk '{print " "$0}']))
216 AC_ARG_ENABLE(strict-dependencies,
217 [ --enable-strict-dependencies fail configure on lack of module dependancy.])
219 AC_ARG_ENABLE(werror,
220 [ --enable-werror causes the build to fail if any warnings are generated.],
221 [ case "$enableval" in
231 dnl # extra argument: --with-docdir
233 docdir='${datadir}/doc/freeradius'
234 AC_MSG_CHECKING([docdir])
236 [ --with-docdir=DIR directory for documentation [DATADIR/doc/freeradius] ],
243 [[\\/$]]* | ?:[[\\/]]* )
247 AC_MSG_ERROR([expected an absolute directory name for --with-docdir: $withval])
252 AC_MSG_RESULT($docdir)
253 if test "x$docdir" = xno; then
254 AC_MSG_WARN([Documentation files will NOT be installed.])
258 dnl # extra argument: --with-logdir
260 logdir='${localstatedir}/log/radius'
261 AC_MSG_CHECKING(logdir)
263 [ --with-logdir=DIR directory for logfiles [LOCALSTATEDIR/log/radius] ],
266 AC_MSG_ERROR([Need logdir])
270 [[\\/$]]* | ?:[[\\/]]* )
274 AC_MSG_ERROR([expected an absolute directory name for --with-logdir: $withval])
279 AC_MSG_RESULT($logdir)
282 dnl # extra argument: --with-radacctdir
284 radacctdir='${logdir}/radacct'
285 AC_MSG_CHECKING(radacctdir)
286 AC_ARG_WITH(radacctdir,
287 [ --with-radacctdir=DIR directory for detail files [LOGDIR/radacct] ],
290 AC_MSG_ERROR([Need radacctdir])
294 [[\\/$]]* | ?:[[\\/]]* )
295 radacctdir="$withval"
298 AC_MSG_ERROR([expected an absolute directory name for --with-radacctdir: $withval])
303 AC_MSG_RESULT($radacctdir)
306 dnl # extra argument: --with-raddbdir
308 raddbdir='${sysconfdir}/raddb'
309 AC_MSG_CHECKING(raddbdir)
310 AC_ARG_WITH(raddbdir,
311 [ --with-raddbdir=DIR directory for config files [SYSCONFDIR/raddb] ],
314 AC_MSG_ERROR([Need raddbdir])
318 [[\\/$]]* | ?:[[\\/]]* )
322 AC_MSG_ERROR([expected an absolute directory name for --with-raddbdir: $withval])
327 AC_MSG_RESULT($raddbdir)
330 dnl # extra argument: --with-dictdir
332 dictdir='${datarootdir}/freeradius'
333 AC_MSG_CHECKING(dictdir)
335 [ --with-dictdir=DIR directory for dictionary files [DATAROOTDIR/freeradius] ],
338 AC_MSG_ERROR([Need dictdir])
342 [[\\/$]]* | ?:[[\\/]]* )
346 AC_MSG_ERROR([expected an absolute directory name for --with-dictdir: $withval])
351 AC_MSG_RESULT($dictdir)
353 modconfdir='${raddbdir}/mods-config'
357 dnl # extra argument: --with-ascend-binary
359 WITH_ASCEND_BINARY=yes
360 AC_ARG_WITH(ascend-binary,
361 [ --with-ascend-binary include support for Ascend binary filter attributes (default=yes)],
366 WITH_ASCEND_BINARY=no
369 if test "x$WITH_ASCEND_BINARY" = "xyes"; then
370 AC_DEFINE(WITH_ASCEND_BINARY, [1], [include support for Ascend binary filter attributes])
374 dnl # extra argument: --with-threads
378 [ --with-threads use threads, if available. (default=yes) ],
388 dnl # extra argument: --with-tcp
392 [ --with-tcp compile in TCP support. (default=yes)],
400 if test "x$WITH_TCP" = "xyes"; then
401 AC_DEFINE(WITH_TCP, [1], [define if you want TCP support (For RADSec et al)])
405 dnl # extra argument: --with-vmps
409 [ --with-vmps compile in VMPS support. (default=yes)],
417 if test "x$WITH_VMPS" = "xyes"; then
418 AC_DEFINE(WITH_VMPS, [1], [define if you want VMPS support])
422 dnl # extra argument: --with-dhcp
426 [ --with-dhcp compile in DHCP support. (default=yes)],
434 if test "x$WITH_DHCP" = "xyes"; then
435 AC_DEFINE(WITH_DHCP, [1], [define if you want DHCP support])
439 dnl # Allow the user to specify a list of modules to be linked
440 dnl # statically to the server.
443 AC_ARG_WITH(static_modules,
444 [ --with-static-modules=QUOTED-MODULE-LIST],[
445 for i in $withval; do
446 STATIC_MODULES="$STATIC_MODULES -dlpreopen ../modules/rlm_$i/rlm_$i.la"
451 AC_ARG_WITH(shared-libs,
452 [AS_HELP_STRING([--with-shared-libs ],
453 [build dynamic libraries and link against them. (default=yes)])],
464 [ --with-modules=QUOTED-MODULE-LIST],[
465 for i in $withval; do
466 MODULES="$MODULES $i"
471 dnl # extra argument: --with-experimental-modules
474 AC_ARG_WITH(experimental-modules,
475 [AS_HELP_STRING([--with-experimental-modules],
476 [use experimental and unstable modules. (default=no, unless --enable-developer=yes)])],
489 dnl # extra argument: --with-udpfromto
492 AC_ARG_WITH(udpfromto,
493 [ --with-udpfromto compile in UDPFROMTO support. (default=yes)],
503 if test "x$WITH_UDPFROMTO" = "xyes"; then
504 AC_DEFINE(WITH_UDPFROMTO, [], [define if you want udpfromto])
508 dnl # These next two arguments don't actually do anything. They're
509 dnl # place holders so that the top-level configure script can tell
510 dnl # the user how to configure lower-level modules
514 dnl # extra argument: --with-rlm-FOO-lib-dir
516 AC_ARG_WITH(rlm-FOO-lib-dir,
517 [AS_HELP_STRING([--with-rlm-FOO-lib-dir=DIR],
518 [directory in which to look for library files used by module FOO])],
526 dnl # extra argument: --with-rlm-FOO-include-dir
528 AC_ARG_WITH(rlm-FOO-include-dir,
529 [AS_HELP_STRING([--with-rlm-FOO-include-dir=DIR],
530 [directory in which to look for include files used by module FOO])],
538 dnl # extra argument: --with-openssl
542 [ --with-openssl use OpenSSL. (default=yes)],
554 dnl # extra argument: --with-openssl-lib-dir=dir
557 AC_ARG_WITH(openssl-lib-dir,
558 [AS_HELP_STRING([--with-openssl-lib-dir=DIR],
559 [directory to look for OpenSSL library files])],
561 *) openssl_lib_dir="$withval"
567 dnl # extra argument: --with-openssl-includes=dir
570 AC_ARG_WITH(openssl-include-dir,
571 [AS_HELP_STRING([--with-openssl-include-dir=DIR],
572 [directory to look for OpenSSL include files])],
574 *) openssl_include_dir="$withval"
580 dnl # extra argument: --disable-openssl-version-check
582 AC_ARG_ENABLE(openssl-version-check,
583 [AS_HELP_STRING([--disable-openssl-version-check],
584 [disable vulnerable OpenSSL version check])]
586 if test "x$enable_openssl_version_check" != "xno"; then
587 AC_DEFINE(ENABLE_OPENSSL_VERSION_CHECK, [1],
588 [Define to 1 to have OpenSSL version check enabled])
589 openssl_version_check_config="\
591 # allow_vulnerable_openssl: Allow the server to start with
592 # versions of OpenSSL known to have critical vulnerabilities.
594 # This check is based on the version number reported by libssl
595 # and may not reflect patches applied to libssl by
596 # distribution maintainers.
598 allow_vulnerable_openssl = no"
600 openssl_version_check_config=
602 AC_SUBST([openssl_version_check_config])
605 dnl #############################################################
607 dnl # 1. Checks for programs
609 dnl #############################################################
612 AC_PATH_PROG(PERL, perl, /usr/local/bin/perl)
613 if test "x$ac_cv_path_PERL" = "x"; then
614 AC_MSG_WARN([perl not found - Simultaneous-Use and checkrad may not work])
616 AC_PATH_PROG(SNMPGET, snmpget)
617 if test "x$ac_cv_path_SNMPGET" = "x"; then
618 AC_MSG_WARN([snmpget not found - Simultaneous-Use and checkrad may not work])
621 AC_PATH_PROG(SNMPWALK, snmpwalk)
622 if test "x$ac_cv_path_SNMPWALK" = "x"; then
623 AC_MSG_WARN([snmpwalk not found - Simultaneous-Use and checkrad may not work])
626 AC_PATH_PROG(RUSERS, rusers, /usr/bin/rusers)
629 dnl # FIXME This is truly gross.
631 missing_dir=`cd $ac_aux_dir && pwd`
632 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
633 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
634 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
636 AC_PATH_PROG(LOCATE,locate)
637 AC_PATH_PROG(DIRNAME,dirname)
638 AC_PATH_PROG(GREP,grep)
640 dnl #############################################################
642 dnl # 2. Checks for libraries
644 dnl #############################################################
647 dnl extra argument: --with-talloc-lib-dir=DIR
649 AC_ARG_WITH(talloc-lib-dir,
650 [AS_HELP_STRING([--with-talloc-lib-dir=DIR],
651 [directory in which to look for talloc library files])],
654 AC_MSG_ERROR([Need talloc-lib-dir])
659 talloc_lib_dir="$withval"
663 dnl extra argument: --with-talloc-include-dir=DIR
665 AC_ARG_WITH(talloc-include-dir,
666 [AS_HELP_STRING([--with-talloc-include-dir=DIR],
667 [directory in which to look for talloc include files])],
670 AC_MSG_ERROR([Need talloc-include-dir])
675 talloc_include_dir="$withval"
679 smart_try_dir="$talloc_lib_dir"
680 FR_SMART_CHECK_LIB(talloc, _talloc)
681 if test "x$ac_cv_lib_talloc__talloc" != "xyes"; then
682 AC_MSG_WARN([talloc library not found. Use --with-talloc-lib-dir=<path>.])
683 AC_MSG_ERROR([FreeRADIUS requires libtalloc])
686 TALLOC_LIBS="${smart_lib}"
687 TALLOC_LDFLAGS="${smart_ldflags}"
688 AC_SUBST(TALLOC_LIBS)
689 AC_SUBST(TALLOC_LDFLAGS)
693 dnl # If using pthreads, check for -lpthread (posix) or -lc_r (*BSD)
696 if test "x$WITH_THREADS" = "xyes"; then
697 if test $ac_cv_prog_suncc = "yes"; then
701 AC_CHECK_HEADERS(pthread.h, [],
708 dnl # pthread stuff is usually in -lpthread
709 dnl # or in -lc_r, on *BSD
711 dnl # On Some systems, we need extra pre-processor flags, to get them to
712 dnl # to do the threading properly.
714 AC_CHECK_LIB(pthread, pthread_create,
716 CFLAGS="$CFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS"
717 LIBS="-lpthread $LIBS"
721 dnl # -pthread is not a typo, it's a GCC option which sets additional flags required
722 dnl # for multithreading with the pthreads library.
724 AC_CHECK_LIB(c_r, pthread_create,
725 [ CFLAGS="$CFLAGS -pthread -D_THREAD_SAFE" ],
734 if test "x$WITH_THREADS" != "xyes"; then
735 AC_MSG_WARN([silently not building with thread support.])
736 AC_MSG_WARN([FAILURE: thread support requires: $fail.])
738 AC_DEFINE(WITH_THREADS, [1], [define if you want thread support])
743 dnl # If we have NO pthread libraries, remove any knowledge of threads.
745 if test "x$WITH_THREADS" != "xyes"; then
747 ac_cv_header_pthread_h="no"
751 dnl # We need sem_init() and friends, as they're the friendliest
752 dnl # semaphore functions for threading.
754 dnl # HP/UX requires linking with librt, too, to get the sem_* symbols.
755 dnl # Some systems have them in -lsem
756 dnl # Solaris has them in -lposix4
757 dnl # NetBSD has them in -lsemaphore
760 AC_SEARCH_LIBS(sem_init, pthread sem posix4 rt semaphore,
762 [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]])]
767 dnl # Check if we need -lsocket
769 AC_CHECK_LIB(dl, dlopen)
772 dnl # Check if we need -lsocket
774 AC_CHECK_LIB(socket, getsockname)
777 dnl # Check for -lresolv
778 dnl # This library may be needed later.
780 AC_CHECK_LIB(resolv, inet_aton)
783 dnl # Check if we need -lnsl. Usually if we want to
784 dnl # link against -lsocket we need to include -lnsl as well.
786 AC_CHECK_LIB(nsl, inet_ntoa)
787 AC_CHECK_LIB(ws2_32, htonl)
790 dnl # Check the pcap library for the RADIUS sniffer.
792 dnl extra argument: --with-pcap-lib-dir=DIR
794 AC_ARG_WITH(pcap-lib-dir,
795 [AS_HELP_STRING([--with-pcap-lib-dir=DIR],
796 [directory in which to look for pcap library files])],
799 AC_MSG_ERROR([Need pcap-lib-dir])
804 pcap_lib_dir="$withval"
808 dnl extra argument: --with-pcap-include-dir=DIR
810 AC_ARG_WITH(pcap-include-dir,
811 [AS_HELP_STRING([--with-pcap-include-dir=DIR],
812 [directory in which to look for pcap include files])],
815 AC_MSG_ERROR([Need pcap-include-dir])
820 pcap_include_dir="$withval"
824 smart_try_dir="$pcap_lib_dir"
825 FR_SMART_CHECK_LIB(pcap, pcap_open_live)
826 if test "x$ac_cv_lib_pcap_pcap_open_live" != "xyes"; then
827 AC_MSG_WARN([pcap library not found, silently disabling the RADIUS sniffer, and ARP listener. Use --with-pcap-lib-dir=<path>.])
829 AC_DEFINE(HAVE_LIBPCAP, 1,
830 [Define to 1 if you have the `pcap' library (-lpcap).]
840 PCAP_LIBS="${smart_lib}"
841 PCAP_LDFLAGS="${smart_ldflags}"
843 dnl Set by FR_SMART_CHECK_LIB
846 dnl Check for collectdclient
847 dnl extra argument: --with-collectdclient-lib-dir=DIR
848 collectdclient_lib_dir=
849 AC_ARG_WITH(collectdclient-lib-dir,
850 [AS_HELP_STRING([--with-collectdclient-lib-dir=DIR],
851 [directory in which to look for collectdclient library files])],
854 AC_MSG_ERROR([Need collectdclient-lib-dir])
859 collectdclient_lib_dir="$withval"
863 dnl extra argument: --with-collectdclient-include-dir=DIR
864 collectdclient_include_dir=
865 AC_ARG_WITH(collectdclient-include-dir,
866 [AS_HELP_STRING([--with-collectdclient-include-dir=DIR],
867 [directory in which to look for collectdclient include files])],
870 AC_MSG_ERROR([Need collectdclient-include-dir])
875 collectdclient_include_dir="$withval"
879 smart_try_dir="$collectdclient_lib_dir"
880 FR_SMART_CHECK_LIB(collectdclient, lcc_connect)
881 if test "x$ac_cv_lib_collectdclient_lcc_connect" != "xyes"; then
882 AC_MSG_WARN([collectdclient library not found. Use --with-collectdclient-lib-dir=<path>.])
884 COLLECTDC_LIBS="${smart_lib}"
885 COLLECTDC_LDFLAGS="${smart_ldflags}"
887 dnl Set by FR_SMART_CHECKLIB
892 dnl #############################################################
894 dnl # 3. Checks for header files
896 dnl #############################################################
899 dnl # Check for talloc header files
901 smart_try_dir="$talloc_include_dir"
902 FR_SMART_CHECK_INCLUDE([talloc.h])
903 if test "x$ac_cv_header_talloc_h" != "xyes"; then
904 AC_MSG_WARN([talloc headers not found. Use --with-talloc-include-dir=<path>.])
905 AC_MSG_ERROR([FreeRADIUS requires libtalloc])
909 dnl # Interix requires us to set -D_ALL_SOURCE, otherwise
910 dnl # getopt will be #included, but won't link. <sigh>
914 CFLAGS="$CFLAGS -D_ALL_SOURCE"
917 CFLAGS="$CFLAGS -DDARWIN"
918 LIBS="-framework DirectoryService $LIBS"
919 AC_DEFINE([__APPLE_USE_RFC_3542], 1, [Force OSX >= 10.7 Lion to use RFC2292 IPv6 socket options])
975 dnl # FreeBSD requires sys/socket.h before net/if.h
977 AC_CHECK_HEADERS(net/if.h, [], [],
979 #ifdef HAVE_SYS_SOCKET_H
980 # include <sys/socket.h>
986 dnl # other checks which require headers
988 if test "x$ac_cv_header_sys_security_h" = "xyes" && test "x$ac_cv_header_prot_h" = "xyes"
990 AC_DEFINE(OSFC2, [], [define if you have OSFC2 authentication])
993 if test "x$ac_cv_header_sia_h" = "xyes" && test "x$ac_cv_header_siad_h" = "xyes"
995 AC_DEFINE(OSFSIA, [], [define if you have OSFSIA authentication])
999 dnl # Were we told to use OpenSSL, if we were and we find an error, call AC_MSG_FAILURE and exit
1001 if test "x$WITH_OPENSSL" = xyes; then
1005 dnl # Apparently OpenSSL will attempt to build with kerberos if we don't pass this?!
1007 CFLAGS="$CFLAGS -DOPENSSL_NO_KRB5"
1010 dnl # Check we can link to libcrypto and libssl
1012 smart_try_dir="$openssl_lib_dir"
1013 FR_SMART_CHECK_LIB(crypto, DH_new)
1014 if test "x$ac_cv_lib_crypto_DH_new" = "xyes"; then
1015 AC_DEFINE(HAVE_LIBCRYPTO, 1, [Define to 1 if you have the `crypto' library (-lcrypto).])
1016 OPENSSL_LIBS="$smart_lib"
1017 OPENSSL_LDFLAGS="$smart_ldflags"
1019 FR_SMART_CHECK_LIB(ssl, SSL_new)
1020 if test "x$ac_cv_lib_ssl_SSL_new" != "xyes"; then
1021 AC_MSG_FAILURE([failed linking to libssl. Use --with-openssl-lib-dir=<path>, or --with-openssl=no (builds without OpenSSL)])
1023 AC_DEFINE(HAVE_LIBSSL, 1, [Define to 1 if you have the `ssl' library (-lssl).])
1024 OPENSSL_LIBS="$OPENSSL_LIBS $smart_lib"
1026 if test "$OPENSSL_LDFLAGS" != "$smart_ldflags"; then
1027 AC_MSG_FAILURE(["inconsistent LDFLAGS between -lssl '$smart_ldflags' and -lcrypto '$OPENSSL_LDFLAGS'"])
1031 AC_MSG_FAILURE([failed linking to libcrypto. Use --with-openssl-lib-dir=<path>, or --with-openssl=no (builds without OpenSSL)])
1034 smart_try_dir="$openssl_include_dir"
1035 FR_SMART_CHECK_INCLUDE(openssl/ssl.h)
1036 if test "x$ac_cv_header_openssl_ssl_h" = "xyes"; then
1037 AC_DEFINE(HAVE_OPENSSL_SSL_H, 1, [Define to 1 if you have the <openssl/ssl.h> header file.])
1050 AC_MSG_FAILURE([failed locating OpenSSL headers. Use --with-openssl-include-dir=<path>, or --with-openssl=no (builds without OpenSSL)])
1054 AC_MSG_CHECKING([for OpenSSL version >= 0.9.7])
1056 [#include <openssl/crypto.h>
1057 #if (OPENSSL_VERSION_NUMBER >= 0x00907000L)
1066 AC_MSG_FAILURE([OpenSSL version too old])
1071 dnl # CPPFLAGS are passed to the compiler first, so we use
1072 dnl # them to ensure things like --sysroot don't override the
1073 dnl # library location we discovered previously.
1075 old_CPPFLAGS="$CPPFLAGS"
1076 CPPFLAGS="$OPENSSL_LDFLAGS $CPPFLAGS"
1079 dnl # Now check that the header versions match the library
1081 AC_MSG_CHECKING([OpenSSL library and header version consistency])
1086 #include <openssl/opensslv.h>
1087 #include <openssl/crypto.h>
1090 printf("library: %lx header: %lx... ", (unsigned long) SSLeay(), (unsigned long) OPENSSL_VERSION_NUMBER);
1091 if (SSLeay() == OPENSSL_VERSION_NUMBER) {
1103 AC_MSG_FAILURE([OpenSSL library version does not match header version])
1106 CPPFLAGS="$old_CPPFLAGS"
1110 AC_SUBST(OPENSSL_LIBS)
1111 AC_SUBST(OPENSSL_LDFLAGS)
1112 export OPENSSL_LIBS OPENSSL_LDFLAGS
1116 dnl # Check the pcap includes for the RADIUS sniffer.
1118 if test "x$PCAP_LIBS" = x; then
1119 AC_MSG_NOTICE([skipping test for pcap.h.])
1122 dnl # Check for pcap header files
1124 smart_try_dir="$pcap_include_dir"
1125 FR_SMART_CHECK_INCLUDE([pcap.h])
1126 if test "x$ac_cv_header_pcap_h" == "xyes"; then
1127 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
1129 AC_SUBST(PCAP_LDFLAGS)
1131 AC_MSG_WARN([pcap headers not found, silently disabling the RADIUS sniffer, and ARP listener. Use --with-pcap-include-dir=<path>.])
1135 dnl Check for collectd-client
1136 if test "x$COLLECTDC_LIBS" = x; then
1137 AC_MSG_NOTICE([skipping test for collectd/client.h.])
1140 dnl # Check for collectd-client header files
1142 smart_try_dir="$collectdclient_include_dir"
1143 FR_SMART_CHECK_INCLUDE([collectd/client.h])
1144 if test "x$ac_cv_header_collectd_client_h" == "xyes"; then
1145 AC_DEFINE(HAVE_COLLECTDC_H, 1, [Define to 1 if you have the `collectdclient' library (-lcollectdclient).])
1146 AC_SUBST(COLLECTDC_LIBS)
1147 AC_SUBST(COLLECTDC_LDFLAGS)
1149 AC_MSG_WARN([collectdclient headers not found. Use --with-collectdclient-include-dir=<path>.])
1153 dnl #############################################################
1155 dnl # 4. Checks for typedefs
1157 dnl #############################################################
1160 dnl # Ensure that these are defined
1168 dnl # Check for socklen_t
1170 FR_CHECK_TYPE_INCLUDE(
1172 #ifdef HAVE_SYS_TYPES_H
1173 # include <sys/types.h>
1176 #ifdef HAVE_SYS_SOCKET_H
1177 # include <sys/socket.h>
1180 socklen_t, int, [socklen_t is generally 'int' on systems which don't use it]
1184 dnl # Check for uint8_t
1186 FR_CHECK_TYPE_INCLUDE(
1188 #ifdef HAVE_INTTYPES_H
1189 # include <inttypes.h>
1192 #ifdef HAVE_STDINT_H
1193 # include <stdint.h>
1196 uint8_t, unsigned char, [uint8_t should be the canonical 'octet' for network traffic]
1200 dnl # Check for uint16_t
1202 FR_CHECK_TYPE_INCLUDE(
1204 #ifdef HAVE_INTTYPES_H
1205 # include <inttypes.h>
1208 #ifdef HAVE_STDINT_H
1209 # include <stdint.h>
1212 uint16_t, unsigned short, [uint16_t should be the canonical '2 octets' for network traffic]
1216 dnl # Check for uint32_t
1218 FR_CHECK_TYPE_INCLUDE(
1220 #ifdef HAVE_INTTYPES_H
1221 # include <inttypes.h>
1224 #ifdef HAVE_STDINT_H
1225 # include <stdint.h>
1228 uint32_t, unsigned int, [uint32_t should be the canonical 'network integer']
1232 dnl # Check for uint64_t
1234 FR_CHECK_TYPE_INCLUDE(
1236 #ifdef HAVE_INTTYPES_H
1237 # include <inttypes.h>
1240 #ifdef HAVE_STDINT_H
1241 # include <stdint.h>
1244 uint64_t, unsigned long long, [uint64_t is required for larger counters]
1248 dnl # Check for __uint128_t (compiler builtin)
1250 AC_CHECK_TYPE(__uint128_t, AC_DEFINE(HAVE___UINT128_T, 1, [compiler specific 128 bit unsigned integer]), [], [])
1253 dnl # Check for uint128_t (fictitious future data type)
1255 AC_CHECK_TYPE(uint128_t, AC_DEFINE(HAVE_UINT128_T, 1, [128 bit unsigned integer]), [],
1257 #ifdef HAVE_INTTYPES_H
1258 # include <inttypes.h>
1261 #ifdef HAVE_STDINT_H
1262 # include <stdint.h>
1267 AC_CHECK_TYPE(struct in6_addr, AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1, [IPv6 address structure]), [],
1269 #ifdef HAVE_NETINET_IN_H
1270 # include <netinet/in.h>
1275 AC_CHECK_TYPE(struct sockaddr_storage, AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1, [Generic socket addresses]), [],
1277 #ifdef HAVE_NETINET_IN_H
1278 # include <netinet/in.h>
1281 #ifdef HAVE_SYS_SOCKET_H
1282 # include <sys/socket.h>
1286 AC_CHECK_TYPE(struct sockaddr_in6, AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1, [IPv6 socket addresses]), [],
1288 #ifdef HAVE_NETINET_IN_H
1289 # include <netinet/in.h>
1293 AC_CHECK_TYPE(struct addrinfo, AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1, [Generic DNS lookups]), [],
1295 #ifdef HAVE_SYS_TYPES_H
1296 # include <sys/types.h>
1299 #ifdef HAVE_SYS_SOCKET_H
1300 # include <sys/socket.h>
1310 dnl # Check for sig_t
1312 dnl # FR_CHECK_TYPE_INCLUDE doesn't work for callbacks as it doesn't produce typedefs
1314 AC_MSG_CHECKING([if sig_t is defined])
1318 #ifdef HAVE_SIGNAL_H
1319 # include <signal.h>
1329 AC_DEFINE(HAVE_SIG_T, 1, [Define if the type sig_t is defined by signal.h])
1336 dnl #############################################################
1338 dnl # 5. Checks for structures and functions
1340 dnl #############################################################
1380 dnl # Check if we have utmpx.h
1381 dnl # if so, check if struct utmpx has entry ut_xtime
1382 dnl # if not, set it to define ut_xtime == ut_tv.tv_sec
1384 if test "x$ac_cv_header_utmpx_h" = "xyes"; then
1385 FR_CHECK_STRUCT_HAS_MEMBER([#include <utmpx.h>], [struct utmpx], ut_xtime)
1386 if test "x$ac_cv_type_struct_utmpx_has_ut_xtime" = "x"; then
1387 AC_DEFINE(ut_xtime, ut_tv.tv_sec, [define to something if you don't have ut_xtime in struct utmpx])
1392 dnl # struct ip_pktinfo
1394 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in_pktinfo], ipi_addr)
1395 if test "x$ac_cv_type_struct_in_pktinfo_has_ipi_addr" = "xyes"; then
1396 AC_DEFINE(HAVE_IP_PKTINFO, [], [define if you have IP_PKTINFO (Linux)])
1400 dnl # struct in6_pktinfo
1402 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in6_pktinfo], ipi6_addr)
1403 if test "x$ac_cv_type_struct_in6_pktinfo_has_ipi6_addr" = "xyes"; then
1404 AC_DEFINE(HAVE_IN6_PKTINFO, [], [define if you have IN6_PKTINFO (Linux)])
1408 dnl # Check for htonll and htonlll
1410 AC_MSG_CHECKING([if htonll is defined])
1414 #include <sys/types.h>
1415 #include <netinet/in.h>
1423 AC_DEFINE(HAVE_HTONLL, 1, [Define if the function (or macro) htonll exists.])
1430 AC_MSG_CHECKING([if htonlll is defined])
1434 #include <sys/types.h>
1435 #include <netinet/in.h>
1443 AC_DEFINE(HAVE_HTONLLL, 1, [Define if the function (or macro) htonlll exists.])
1450 dnl #############################################################
1452 dnl # 6. Checks for compiler characteristics
1454 dnl #############################################################
1457 dnl # Ensure that these are defined
1462 dnl # See if this is OS/2
1464 AC_MSG_CHECKING([type of OS])
1467 if test "$OS" = "OS/2"; then
1474 if test "x$developer" = "xyes"; then
1475 AC_MSG_NOTICE([Setting additional developer CFLAGS])
1478 dnl # Tell the compiler to parse doxygen documentation and verify it against function and variable declarations
1480 AX_CC_WDOCUMENTATION_FLAG
1481 if test "x$ax_cv_cc_wdocumentation_flag" = "xyes"; then
1482 devflags="-Wdocumentation"
1485 if test "x$GCC" = "xyes"; then
1486 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"
1490 AC_MSG_NOTICE([Developer CFLAGS are "$devflags"])
1492 CFLAGS="$CFLAGS $devflags"
1494 dnl # Enable experimental modules (we want to know if code changes breaks one of them)
1496 if test "x$EXPERIMENTAL" != "xno"; then
1497 AC_MSG_NOTICE([is developer build, enabling experimental modules implicitly, disable with --without-experimental-modules])
1502 CFLAGS="$CFLAGS -DNDEBUG"
1507 dnl # May of been set outside of this configure script
1509 AC_MSG_CHECKING([if building with -DNDEBUG])
1510 if echo "$CFLAGS" | grep '\-DNDEBUG' > /dev/null; then
1511 AC_MSG_RESULT([yes])
1512 AC_DEFINE([WITH_NDEBUG], [1], [define if the server was built with -DNDEBUG])
1520 dnl # append the current git hash onto the version string
1522 if test -d $srcdir/.git -a "x$GIT" = "xyes"; then
1523 RADIUSD_VERSION_COMMIT=`git log --pretty=format:'%h' -n 1`
1524 AC_DEFINE_UNQUOTED([RADIUSD_VERSION_COMMIT],[${RADIUSD_VERSION_COMMIT}],[Commit HEAD at time of configuring])
1528 dnl # check for some compiler features
1531 FR_HAVE_BUILTIN_CHOOSE_EXPR
1532 FR_HAVE_BUILTIN_TYPES_COMPATIBLE_P
1533 FR_HAVE_BUILTIN_BSWAP_64
1535 dnl #############################################################
1537 dnl # 7. Checks for library functions
1539 dnl #############################################################
1542 dnl # Check for talloc_set_memlimit
1543 dnl # This was only included in version 2.0.8
1545 AC_CHECK_LIB(talloc, talloc_set_memlimit,
1547 AC_DEFINE(HAVE_TALLOC_SET_MEMLIMIT, 1, [Define to 1 if you have the function talloc_set_memlimit.])
1552 dnl # Check for libcrypt
1553 dnl # We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
1555 AC_CHECK_LIB(crypt, crypt,
1559 if test "$CRYPTLIB" != ""; then
1560 AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function])
1562 AC_CHECK_FUNC(crypt, AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function]))
1565 dnl Check for libcipher
1566 AC_CHECK_LIB(cipher, setkey,
1567 CRYPTLIB="${CRYPTLIB} -lcipher"
1572 dnl # Check for libexecinfo support, on some systems this is built into libc
1573 dnl # on others it's a separate library.
1575 dnl extra argument: --with-execinfo-lib-dir
1577 AC_ARG_WITH(execinfo-lib-dir,
1578 [AS_HELP_STRING([--with-execinfo-lib-dir=DIR],
1579 [directory in which to look for execinfo library files])],
1580 [ case "$withval" in
1582 AC_MSG_ERROR([Need execinfo-lib-dir])
1587 execinfo_lib_dir="$withval"
1592 dnl extra argument: --with-execinfo-include-dir
1593 execinfo_include_dir=
1594 AC_ARG_WITH(execinfo-include-dir,
1595 [AS_HELP_STRING([--with-execinfo-include-dir=DIR],
1596 [directory in which to look for execinfo include files])],
1597 [ case "$withval" in
1599 AC_MSG_ERROR([Need execinfo-include-dir])
1604 execinfo_include_dir="$withval"
1610 dnl # Look for execinfo.h and symbols
1612 smart_try_dir=$execinfo_include_dir
1613 FR_SMART_CHECK_INCLUDE(execinfo.h)
1614 if test "x$ac_cv_header_execinfo_h" = "xyes"; then
1615 smart_try_dir=$execinfo_lib_dir
1616 FR_SMART_CHECK_LIB(execinfo, backtrace_symbols)
1617 if test "x$ac_cv_lib_execinfo_backtrace_symbols" != "xyes"; then
1618 dnl # Might be provided as part of libc
1619 AC_MSG_CHECKING([if execinfo provided as part of libc])
1622 #include <execinfo.h>
1626 backtrace_symbols(&sym, sizeof(sym)) ],
1629 ac_cv_lib_execinfo_backtrace_symbols="yes"
1637 if test "x$ac_cv_lib_execinfo_backtrace_symbols" = "xyes"; then
1638 AC_DEFINE(HAVE_EXECINFO, [1], [define this if we have <execinfo.h> and symbols])
1643 dnl # Check for regular expression support, if were using PCRE it MUST be included
1644 dnl # before all others, else we seem to still pickup the posix symbols for regcomp
1645 dnl # and regexec, which results in crashes as soon as we call any posix regex
1648 dnl extra argument: --with-pcre-lib-dir
1650 AC_ARG_WITH(pcre-lib-dir,
1651 [AS_HELP_STRING([--with-pcre-lib-dir=DIR],
1652 [directory in which to look for pcre library files])],
1653 [ case "$withval" in
1655 AC_MSG_ERROR(Need pcre-lib-dir)
1660 pcre_lib_dir="$withval"
1665 dnl extra argument: --with-pcre-include-dir
1667 AC_ARG_WITH(pcre-include-dir,
1668 [AS_HELP_STRING([--with-pcre-include-dir=DIR],
1669 [directory in which to look for pcre include files])],
1670 [ case "$withval" in
1672 AC_MSG_ERROR(Need pcre-include-dir)
1677 pcre_include_dir="$withval"
1682 dnl extra argument: --with-regex
1685 [AS_HELP_STRING([--with-regex],
1686 [Whether to build with regular expressions (default=yes)])],
1687 [ case "$withval" in
1697 dnl # First look for PCRE
1699 if test "x$REGEX" = "x"; then
1700 smart_try_dir=$pcre_include_dir
1701 FR_SMART_CHECK_INCLUDE(pcreposix.h)
1702 if test "x$ac_cv_header_pcreposix_h" = "xyes"; then
1703 smart_try_dir=$pcre_lib_dir
1704 FR_SMART_CHECK_LIB(pcre, pcre_compile)
1705 if test "x$ac_cv_lib_pcre_pcre_compile" = "xyes"; then
1708 smart_try_dir=$pcre_lib_dir
1709 AC_DEFINE(HAVE_PCRE, [1], [define this if we have libpcre])
1712 dnl # Hack to get -L<path> and -lpcreposix at the start
1713 dnl # of the linker arguments.
1715 LIBS=$(echo "$LIBS" | sed -e 's/-lpcre/-lpcre -lpcreposix/')
1721 dnl # If no PCRE, fallback to POSIX regular expressions
1723 if test "x$REGEX" = "x"; then
1725 FR_SMART_CHECK_INCLUDE(regex.h)
1726 if test "x$ac_cv_header_regex_h" = "xyes"; then
1728 AC_MSG_CHECKING([for extended regular expressions])
1738 AC_DEFINE(HAVE_REG_EXTENDED, [1], [define this if we have REG_EXTENDED (from <regex.h>)])
1746 dnl # Some platforms require the regex library to be linked explicitly
1748 AC_CHECK_LIB(regex, regcomp,
1750 LIBS="-lregex $LIBS"
1756 if test "x$REGEX" = "xyes"; then
1757 AC_DEFINE(HAVE_REGEX, 1, [Define if we have any regular expression library])
1761 dnl # Check the style of gethostbyaddr, in order of preference
1762 dnl # GNU (_r eight args)
1764 AC_DEFINE(GNUSTYLE, [1], [GNU-Style get*byaddr_r])
1767 dnl # SYSV (_r six args)
1769 AC_DEFINE(SYSVSTYLE, [2], [SYSV-Style get*byaddr_r])
1772 dnl # BSD (three args, may not be thread safe)
1774 AC_DEFINE(BSDSTYLE, [3], [BSD-Style get*byaddr_r])
1777 dnl # Tru64 has BSD version, but it is thread safe
1778 dnl # http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1739____.HTM
1779 dnl # We need #stdio.h to define NULL on FreeBSD (at least)
1781 gethostbyaddrrstyle=""
1782 AC_MSG_CHECKING([gethostbyaddr_r() syntax])
1786 dnl # With FreeBSD, check if there's a prototype for gethostbyaddr_r.
1787 dnl # Some versions (FreeBSD 5.1?) have a symbol but no prototype - so we
1788 dnl # override this test to BSDSTYLE. FreeBSD 6.2 and up have proper GNU
1789 dnl # style support.
1791 AC_CHECK_DECLS([gethostbyaddr_r], [],
1793 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE,
1794 [style of gethostbyaddr_r functions ])
1795 gethostbyaddrrstyle=BSD
1796 AC_MSG_WARN([FreeBSD overridden to BSD-style])
1806 if test "x$gethostbyaddrrstyle" = "x"; then
1812 [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL, NULL) ],
1814 AC_DEFINE(GETHOSTBYADDRRSTYLE, GNUSTYLE, [style of gethostbyaddr_r functions ])
1815 gethostbyaddrrstyle=GNU
1820 if test "x$gethostbyaddrrstyle" = "x"; then
1826 [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL) ] ,
1828 AC_DEFINE(GETHOSTBYADDRRSTYLE, SYSVSTYLE, [style of gethostbyaddr_r functions ])
1829 gethostbyaddrrstyle=SYSV
1835 if test "x$gethostbyaddrrstyle" = "x"; then
1841 [ gethostbyaddr(NULL, 0, 0) ],
1843 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE, [style of gethostbyaddr_r functions ])
1844 gethostbyaddrrstyle=BSD
1849 if test "x$gethostbyaddrrstyle" = "x"; then
1850 AC_MSG_RESULT([none! It must not exist, here.])
1852 AC_MSG_RESULT([${gethostbyaddrrstyle}-style])
1855 if test "x$gethostbyaddrrstyle" = "xBSD"; then
1856 AC_MSG_WARN([ ****** BSD-style gethostbyaddr might NOT be thread-safe! ****** ])
1860 dnl # Check the style of gethostbyname, in order of preference
1861 dnl # GNU (_r seven args)
1862 dnl # SYSV (_r five args)
1863 dnl # BSD (two args, may not be thread safe)
1864 dnl # Tru64 has BSD version, but it _is_ thread safe
1865 dnl # http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1946____.HTM
1866 dnl # We need #stdio.h to define NULL on FreeBSD (at least)
1868 gethostbynamerstyle=""
1869 AC_MSG_CHECKING([gethostbyname_r() syntax])
1875 [ gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL) ],
1877 AC_DEFINE(GETHOSTBYNAMERSTYLE, GNUSTYLE, [style of gethostbyname_r functions ])
1878 gethostbynamerstyle=GNU
1882 if test "x$gethostbynamerstyle" = "x"; then
1888 [ gethostbyname_r(NULL, NULL, NULL, 0, NULL) ] ,
1890 AC_DEFINE(GETHOSTBYNAMERSTYLE, SYSVSTYLE, [style of gethostbyname_r functions ])
1891 gethostbynamerstyle=SYSV
1896 if test "x$gethostbynamerstyle" = "x"; then
1902 [ gethostbyname(NULL) ],
1904 AC_DEFINE(GETHOSTBYNAMERSTYLE, BSDSTYLE, [style of gethostbyname_r functions ])
1905 gethostbynamerstyle=BSD
1910 if test "x$gethostbynamerstyle" = "x"; then
1911 AC_MSG_RESULT([none! It must not exist, here.])
1913 AC_MSG_RESULT([${gethostbynamerstyle}-style])
1916 if test "x$gethostbynamerstyle" = "xBSD"; then
1917 AC_MSG_WARN([ ****** BSD-style gethostbyname might NOT be thread-safe! ****** ])
1921 dnl # Check for thread-safe getpwnam_r and getgrnam_r
1923 if test "x$ac_cv_header_pwd_h" = "xyes"; then
1924 AC_MSG_CHECKING([getpwnam_r])
1928 #include <sys/types.h>
1931 [ getpwnam_r(NULL, NULL, NULL, 0, NULL) ],
1933 AC_MSG_RESULT([yes])
1934 AC_DEFINE(HAVE_GETPWNAM_R, 1,
1935 [Define to 1 if you have the getpwnam_r.]
1944 if test "x$ac_cv_header_grp_h" = "xyes"; then
1945 AC_MSG_CHECKING([getgrnam_r])
1949 #include <sys/types.h>
1952 [ getgrnam_r(NULL, NULL, NULL, 0, NULL) ],
1954 AC_MSG_RESULT([yes])
1955 AC_DEFINE(HAVE_GETGRNAM_R, 1,
1956 [Define to 1 if you have the getgrnam_r.]
1967 dnl # Check for non-posix solaris ctime_r (extra buflen int arg)
1969 AC_DEFINE(POSIXSTYLE, [1], [Posix-Style ctime_r])
1970 AC_DEFINE(SOLARISSTYLE, [2], [Solaris-Style ctime_r])
1972 AC_MSG_CHECKING([ctime_r() syntax])
1977 [ ctime_r(NULL, NULL, 0) ],
1979 AC_DEFINE(CTIMERSTYLE, SOLARISSTYLE, [style of ctime_r function])
1980 ctimerstyle="SOLARIS"
1984 if test "x$ctimerstyle" = "x"; then
1989 [ ctime_r(NULL, NULL) ],
1991 AC_DEFINE(CTIMERSTYLE, POSIXSTYLE, [style of ctime_r function])
1997 if test "x$ctimerstyle" = "x"; then
1998 AC_MSG_RESULT([none! It must not exist, here.])
2000 AC_MSG_RESULT([${ctimerstyle}-style])
2003 AC_SUBST(HOSTINFO, $host)
2005 dnl #############################################################
2007 dnl # 8. Checks for system services
2009 dnl #############################################################
2012 dnl # Figure out where libtool is located,
2016 AC_MSG_RESULT([top_builddir=$top_builddir])
2017 dnl # AC_SUBST(top_builddir)
2020 dnl # import libtool stuff
2022 dnl #############################################################
2024 dnl # Configure in any module directories.
2026 dnl #############################################################
2028 dnl ############################################################
2029 dnl # Remove any conflicting definitions if autoconf.h
2030 dnl # is being included by a module.
2031 dnl #############################################################
2032 AH_BOTTOM([#include <freeradius-devel/automask.h>])
2034 dnl ############################################################
2035 dnl # make modules by list
2036 dnl #############################################################
2037 if test "x$EXPERIMENTAL" = "xyes"; then
2038 for foo in `ls -1 "${srcdir}"/src/modules | grep rlm_`; do
2039 MODULES="$MODULES $foo"
2043 dnl # make ONLY the stable modules
2045 for foo in `cat "${srcdir}"/src/modules/stable`; do
2046 MODULES="$MODULES $foo"
2050 dnl ############################################################
2051 dnl # Add autoconf subdirs, based on the module list we
2052 dnl # previously created.
2053 dnl #############################################################
2055 for bar in $MODULES; do
2056 if test -f "${srcdir}"/src/modules/$bar/configure; then
2057 mysubdirs="$mysubdirs src/modules/$bar"
2062 dnl # Don't change the variable name here. Autoconf goes bonkers
2065 AC_CONFIG_SUBDIRS($mysubdirs)
2068 dnl #############################################################
2070 dnl # Add -Werror last, so it doesn't interfere with autoconf's
2071 dnl # test programs.
2073 dnl #############################################################
2074 if test "x$werror" == "xyes"; then
2075 CFLAGS="-Werror $CFLAGS"
2078 dnl #############################################################
2080 dnl # And finally, output the results.
2082 dnl #############################################################
2083 AC_CONFIG_COMMANDS([stamp-h], [echo timestamp > src/include/stamp-h])
2084 AC_CONFIG_COMMANDS([build-radpaths-h], [(cd ./src/include && /bin/sh ./build-radpaths-h)])
2085 AC_CONFIG_COMMANDS([main-chmod], [(cd ./src/main && chmod +x checkrad radlast radtest)])
2086 AC_CONFIG_COMMANDS([scripts-chmod], [(cd ./scripts && chmod +x rc.radiusd cron/radiusd.cron.daily cron/radiusd.cron.monthly cryptpasswd)])
2089 dnl # Substitute whatever libraries we found to be necessary
2092 AC_SUBST(INSTALLSTRIP)
2094 AC_SUBST(USE_SHARED_LIBS)
2095 USE_STATIC_LIBS="yes"
2096 AC_SUBST(USE_STATIC_LIBS)
2097 AC_SUBST(STATIC_MODULES)
2101 ./src/include/build-radpaths-h \
2102 ./src/main/radsniff.mk \
2103 ./src/main/checkrad \
2104 ./src/main/radlast \
2105 ./src/main/radtest \
2106 ./scripts/rc.radiusd \
2107 ./scripts/cron/radiusd.cron.daily \
2108 ./scripts/cron/radiusd.cron.monthly \
2109 ./scripts/cryptpasswd \
2110 ./raddb/radrelay.conf \
2111 ./raddb/radiusd.conf