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])
30 dnl #############################################################
32 dnl # Custom hackery to discover version at configure time
34 dnl #############################################################
36 RADIUSD_MAJOR_VERSION=`cat VERSION | sed 's/\..*//'`
37 RADIUSD_MINOR_VERSION=`cat VERSION | sed 's/^[[^\.]]*\.//' | sed 's/\..*$//'`
38 RADIUSD_INCRM_VERSION=`cat VERSION | sed 's/^.*\..*\.//' | 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 }'`
45 dnl # Still useful for custom builds
46 RADIUSD_VERSION_STRING=`cat VERSION`
49 dnl # Add definitions to Make.inc as it's used by various build targets
51 AC_SUBST([RADIUSD_VERSION_STRING])
54 dnl # Add definitions to autoconf.h, so that the headers that we install
55 dnl # contain the version number of the server.
57 AC_DEFINE_UNQUOTED([RADIUSD_VERSION], [${RADIUSD_VERSION}], [Version integer in format <ma><ma><mi><mi><in><in>])
58 AC_DEFINE_UNQUOTED([RADIUSD_VERSION_STRING], ["${RADIUSD_VERSION_STRING}"], [Raw version string from VERSION file])
60 dnl #############################################################
62 dnl # Override some of the default autoconf variables such as
63 dnl # CFLAGS if were building in developer mode
65 dnl #############################################################
68 dnl # Enable developer features like debugging symbols.
69 dnl # These checks must be done before expanding the AC_PROG_CC
70 dnl # and AC_PROG_CXX macros.
72 AC_ARG_ENABLE(developer,
73 [ --enable-developer enables features of interest to developers.],
74 [ case "$enableval" in
83 if test -d $srcdir/.git; then
84 if test "x$developer" != "xno"; then
85 dnl turn on the developer flag when taken from a git checkout (not a release)
91 dnl # Autoconf sets -O2 and -g by default, but this is a PITA for debugging
92 dnl # so we remove the defaults if were building in developer mode, and set
93 dnl # -g3 so nice things like macro values are included. Other arguments are
94 dnl # added later when we know what compiler were using.
96 if test "x$developer" = "xyes"; then
103 dnl #############################################################
105 dnl # 0. Checks for compiler, libtool, and command line options.
107 dnl #############################################################
114 dnl # check for AIX, to allow us to use some BSD functions
115 dnl # must be before macros that call the compiler.
119 AC_PROG_GCC_TRADITIONAL
124 dnl # Set Default CFLAGS
126 if test "x$GCC" = "xyes"; then
127 CFLAGS="$CFLAGS -Wall -D_GNU_SOURCE"
130 dnl Compile in large (2G+) file support.
133 dnl # check for system bytesex
134 dnl # AC_DEFINES WORDS_BIGENDIAN
138 AC_CHECK_PROG(GMAKE, gmake, yes, no)
139 if test $GMAKE = no; then
140 AC_PATH_PROG(MAKE, make, /usr/local/bin/make)
142 AC_PATH_PROG(MAKE, gmake, /usr/local/gnu/bin/make)
144 makever=`$ac_cv_path_MAKE --version 2>&1 | grep "GNU Make"`
145 if test -z "$makever"; then
146 AC_MSG_ERROR(GNU Make is not installed. Please download and install it
147 from ftp://prep.ai.mit.edu/pub/gnu/make/ before continuing.)
150 dnl See if we have Git.
151 AC_CHECK_PROG(GIT, git, yes, no)
153 AC_ARG_WITH(system-libltdl,
154 [ --with-system-libltdl Use the libltdl installed in your system (default=use dlopen)],
156 [with_system_libltdl=no])
158 AS_IF([test "x$with_system_libltdl" = "xyes" ],
160 INCLTDL=-DWITH_SYSTEM_LTDL])
162 dnl use system-wide libtool, if it exists
163 AC_ARG_WITH(system-libtool,
164 [ --with-system-libtool Use the libtool installed in your system (default=use our own)],
166 [with_system_libtool=no])
168 AS_IF([test "x$with_system_libtool" = "xyes" ],
169 [ AC_PATH_PROG(LIBTOOL, libtool,,$PATH:/usr/local/bin) AC_LIBTOOL_DLOPEN
172 LIBTOOL='${top_srcdir}/scripts/jlibtool'
174 dnl ensure that we're looking for dlopen
179 dnl Put this in later, when all distributed modules use autoconf.
180 dnl AC_ARG_WITH(disablemodulefoo,
181 dnl [ --without-rlm_foo Disables module compilation. Module list:]
182 dnl esyscmd([find src/modules -type d -name rlm_\* -print |\
183 dnl sed -e 's%src/modules/.*/% (sub)- %; s%.*/%- %' |\
184 dnl awk '{print " "$0}']))
186 AC_ARG_ENABLE(strict-dependencies,
187 [ --enable-strict-dependencies Fail configure on lack of module dependancy.])
189 dnl # Build using the new boilermake system
191 AC_ARG_ENABLE(boilermake,
192 [ --enable-boilermake use the boilermake build system (default=yes).],
193 [ case "$enableval" in
204 if test "x$boilermake" == "xyes"; then
208 dnl extra argument: --with-docdir
209 docdir='${datadir}/doc/freeradius'
210 AC_MSG_CHECKING(docdir)
212 [ --with-docdir=DIR Directory for documentation [DATADIR/doc/freeradius] ],
219 [[\\/$]]* | ?:[[\\/]]* )
223 AC_MSG_ERROR([expected an absolute directory name for --with-docdir: $withval])
228 AC_MSG_RESULT($docdir)
229 if test "x$docdir" = xno; then
230 AC_MSG_WARN(Documentation files will NOT be installed.)
233 dnl extra argument: --with-logdir
234 logdir='${localstatedir}/log/radius'
235 AC_MSG_CHECKING(logdir)
237 [ --with-logdir=DIR Directory for logfiles [LOCALSTATEDIR/log/radius] ],
240 AC_MSG_ERROR(Need logdir)
244 [[\\/$]]* | ?:[[\\/]]* )
248 AC_MSG_ERROR([expected an absolute directory name for --with-logdir: $withval])
253 AC_MSG_RESULT($logdir)
255 dnl extra argument: --with-radacctdir
256 radacctdir='${logdir}/radacct'
257 AC_MSG_CHECKING(radacctdir)
258 AC_ARG_WITH(radacctdir,
259 [ --with-radacctdir=DIR Directory for detail files [LOGDIR/radacct] ],
262 AC_MSG_ERROR(Need radacctdir)
266 [[\\/$]]* | ?:[[\\/]]* )
267 radacctdir="$withval"
270 AC_MSG_ERROR([expected an absolute directory name for --with-radacctdir: $withval])
275 AC_MSG_RESULT($radacctdir)
277 dnl extra argument: --with-raddbdir
278 raddbdir='${sysconfdir}/raddb'
279 AC_MSG_CHECKING(raddbdir)
280 AC_ARG_WITH(raddbdir,
281 [ --with-raddbdir=DIR Directory for config files [SYSCONFDIR/raddb] ],
284 AC_MSG_ERROR(Need raddbdir)
288 [[\\/$]]* | ?:[[\\/]]* )
292 AC_MSG_ERROR([expected an absolute directory name for --with-raddbdir: $withval])
297 AC_MSG_RESULT($raddbdir)
299 dnl extra argument: --with-ascend-binary
300 WITH_ASCEND_BINARY=yes
301 AC_ARG_WITH(ascend-binary,
302 [ --with-ascend-binary Include support for Ascend binary filter attributes (default=yes)],
307 WITH_ASCEND_BINARY=no
310 if test "x$WITH_ASCEND_BINARY" = "xyes"; then
311 AC_DEFINE(WITH_ASCEND_BINARY, [1], [Include support for Ascend binary filter attributes])
314 dnl extra argument: --with-threads
317 [ --with-threads Use threads, if available. (default=yes) ],
326 dnl extra argument: --with-tcp
329 [ --with-tcp Compile in TCP support. (default=yes)],
337 if test "x$WITH_TCP" = "xyes"; then
338 AC_DEFINE(WITH_TCP, [1], [define if you want TCP support (For RADSec et al)])
341 dnl extra argument: --with-vmps
344 [ --with-vmps Compile in VMPS support. (default=yes)],
352 if test "x$WITH_VMPS" = "xyes"; then
353 AC_DEFINE(WITH_VMPS, [1], [define if you want VMPS support])
356 dnl extra argument: --with-dhcp
359 [ --with-dhcp Compile in DHCP support. (default=yes)],
367 if test "x$WITH_DHCP" = "xyes"; then
368 AC_DEFINE(WITH_DHCP, [1], [define if you want DHCP support])
372 dnl # Allow the user to specify a list of modules to be linked
373 dnl # statically to the server.
376 AC_ARG_WITH(static_modules,
377 [ --with-static-modules=QUOTED-MODULE-LIST],[
378 for i in $withval; do
379 STATIC_MODULES="$STATIC_MODULES -dlpreopen ../modules/rlm_$i/rlm_$i.la"
385 [ --with-modules=QUOTED-MODULE-LIST],[
386 for i in $withval; do
387 MODULES="$MODULES $i"
391 dnl extra argument: --with-experimental-modules
393 AC_ARG_WITH(experimental-modules,
394 [ --with-experimental-modules Use experimental and unstable modules. (default=no, unless --enable-developer=yes) ],
406 dnl extra argument: --with-openssl
409 [ --with-openssl Use OpenSSL. (default=yes)],
421 dnl # extra argument: --with-openssl-includes=dir
424 AC_ARG_WITH(openssl-includes,
425 [ --with-openssl-includes=DIR Directory to look for OpenSSL include files],
427 *) OPENSSL_INCLUDE_DIR="$withval"
433 dnl # extra argument: --with-openssl-libraries=dir
436 AC_ARG_WITH(openssl-libraries,
437 [ --with-openssl-libraries=DIR Directory to look for OpenSSL library files],
439 *) OPENSSL_LIB_DIR="$withval"
445 dnl # These next two arguments don't actually do anything. They're
446 dnl # place holders so that the top-level configure script can tell
447 dnl # the user how to configure lower-level modules
451 dnl # extra argument: --with-rlm-FOO-lib-dir
453 AC_ARG_WITH(rlm-FOO-lib-dir,
454 [ --with-rlm-FOO-lib-dir=DIR Directory to look for library files used by module FOO],
462 dnl # extra argument: --with-rlm-FOO-include-dir
464 AC_ARG_WITH(rlm-FOO-include-dir,
465 [ --with-rlm-FOO-include-dir=DIR Directory to look for include files used by module FOO],
472 dnl See what include-style is used by the make program.
473 dnl AC_MSG_CHECKING(include style for make)
474 dnl echo "include /dev/null" > testmake.$$
475 dnl echo "all:" >> testmake.$$
476 dnl make -f testmake.$$ >/dev/null 2>&1
485 dnl rm -f testmake.$$
486 dnl AC_MSG_RESULT(" $INCLUDE")
487 dnl AC_SUBST(INCLUDE)
490 dnl extra argument: --with-udpfromto
492 AC_ARG_WITH(udpfromto,
493 [ --with-udpfromto Compile in UDPFROMTO support. (default=no)],
503 if test "x$WITH_UDPFROMTO" = "xyes"; then
504 AC_DEFINE(WITH_UDPFROMTO, [], [define if you want udpfromto])
507 dnl #############################################################
509 dnl # 1. Checks for programs
511 dnl #############################################################
514 AC_PATH_PROG(PERL, perl, /usr/local/bin/perl)
515 if test "x$ac_cv_path_PERL" = "x"; then
516 AC_MSG_WARN(perl not found - Simultaneous-Use and checkrad may not work)
518 AC_PATH_PROG(SNMPGET, snmpget)
519 if test "x$ac_cv_path_SNMPGET" = "x"; then
520 AC_MSG_WARN(snmpget not found - Simultaneous-Use and checkrad may not work)
523 AC_PATH_PROG(SNMPWALK, snmpwalk)
524 if test "x$ac_cv_path_SNMPWALK" = "x"; then
525 AC_MSG_WARN(snmpwalk not found - Simultaneous-Use and checkrad may not work)
528 AC_PATH_PROG(RUSERS, rusers, /usr/bin/rusers)
530 dnl FIXME This is truly gross.
531 missing_dir=`cd $ac_aux_dir && pwd`
532 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
533 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
534 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
536 AC_PATH_PROG(LOCATE,locate)
537 AC_PATH_PROG(DIRNAME,dirname)
538 AC_PATH_PROG(GREP,grep)
540 dnl #############################################################
542 dnl # 2. Checks for libraries
544 dnl #############################################################
546 dnl If using pthreads, check for -lpthread (posix) or -lc_r (*BSD)
548 if test "x$WITH_THREADS" = "xyes"; then
549 if test $ac_cv_prog_suncc = "yes"; then
553 AC_CHECK_HEADERS(pthread.h, [], [ WITH_THREADS="no" ])
556 dnl # pthread stuff is usually in -lpthread
557 dnl # or in -lc_r, on *BSD
559 dnl # On Some systems, we need extra pre-processor flags, to get them to
560 dnl # to do the threading properly.
562 AC_CHECK_LIB(pthread, pthread_create,
563 [ CFLAGS="$CFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS"
564 LIBS="-lpthread $LIBS" ],
565 [ AC_CHECK_LIB(c_r, pthread_create,
566 [ CFLAGS="$CFLAGS -pthread -D_THREAD_SAFE" ],
567 [ WITH_THREADS="no" ]
573 dnl # If we have NO pthread libraries, remove any knowledge of threads.
575 if test "x$WITH_THREADS" != "xyes"; then
577 ac_cv_header_pthread_h="no"
581 dnl # We need sem_init() and friends, as they're the friendliest
582 dnl # semaphore functions for threading.
584 dnl # HP/UX requires linking with librt, too, to get the sem_* symbols.
585 dnl # Some systems have them in -lsem
586 dnl # Solaris has them in -lposix4
587 dnl # NetBSD has them in -lsemaphore
589 AC_SEARCH_LIBS(sem_init, pthread sem posix4 rt semaphore,
591 [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)]
595 if test "x$WITH_THREADS" = "xyes"; then
596 AC_DEFINE(WITH_THREADS, [1], [define if you want thread support])
599 dnl Check if we need -lsocket
600 AC_CHECK_LIB(dl, dlopen)
602 dnl Check if we need -lsocket
603 AC_CHECK_LIB(socket, getsockname)
605 dnl Check for -lresolv
606 dnl This library may be needed later.
607 AC_CHECK_LIB(resolv, inet_aton)
609 dnl Check if we need -lnsl. Usually if we want to
610 dnl link against -lsocket we need to include -lnsl as well.
611 AC_CHECK_LIB(nsl, inet_ntoa)
613 dnl Check for OpenSSL libraries.
615 if test "x$WITH_OPENSSL" = xyes; then
617 old_LDFLAGS="$LDFLAGS"
618 if test "x$OPENSSL_LIB_DIR" != "x"; then
619 LDFLAGS="$LDFLAGS -L$OPENSSL_LIB_DIR"
621 AC_CHECK_LIB(crypto, DH_new,
623 LIBS="-lcrypto $LIBS"
624 AC_DEFINE(HAVE_LIBCRYPTO, 1,
625 [Define to 1 if you have the `crypto' library (-lcrypto).])
626 AC_CHECK_LIB(ssl, SSL_new,
628 AC_DEFINE(HAVE_LIBSSL, 1,
629 [Define to 1 if you have the `ssl' library (-lssl).])
630 if test "x$OPENSSL_LIB_DIR" != "x"; then
631 OPENSSL_LIBS="-L$OPENSSL_LIB_DIR"
633 OPENSSL_LIBS="$OPENSSL_LIBS -lcrypto -lssl -lcrypto"
637 LDFLAGS="$old_LDFLAGS"
640 AC_CHECK_LIB(ws2_32, htonl)
642 dnl Check the pcap library for the RADIUS sniffer.
644 AC_CHECK_LIB(pcap, pcap_open_live,
646 AC_DEFINE(HAVE_LIBPCAP, 1,
647 [Define to 1 if you have the `pcap' library (-lpcap).])
649 [ AC_MSG_WARN([pcap library not found, silently disabling the RADIUS sniffer.]) ])
653 dnl #############################################################
655 dnl # 3. Checks for header files
657 dnl #############################################################
660 dnl # Interix requires us to set -D_ALL_SOURCE, otherwise
661 dnl # getopt will be #included, but won't link. <sigh>
666 CFLAGS="$CFLAGS -D_ALL_SOURCE"
669 CFLAGS="$CFLAGS -DDARWIN"
670 LIBS="-framework DirectoryService $LIBS"
720 dnl FreeBSD requires sys/socket.h before net/if.h
721 AC_CHECK_HEADERS(net/if.h, [], [],
722 [#ifdef HAVE_SYS_SOCKET_H
723 # include <sys/socket.h>
728 AC_CHECK_HEADER(pcreposix.h, AC_DEFINE(HAVE_PCREPOSIX_H, [], [define this if we have the <pcreposix.h> header file]))
729 if test "x$ac_cv_header_pcreposix_h" = "xyes"; then
730 AC_DEFINE(HAVE_REGEX_H, [], [define if we have any regex])
734 LIBS="$LIBS -lpcreposix"
737 AC_CHECK_HEADER(regex.h, AC_DEFINE(HAVE_REGEX_H, [], [define this if we have the <regex.h> header file]))
738 if test "x$ac_cv_header_regex_h" = "xyes"; then
747 ], [AC_DEFINE(HAVE_REG_EXTENDED, [], [define this if we have REG_EXTENDED (from <regex.h>)]) REGEX_EXTENDED=yes])
753 AC_SUBST(REGEX_EXTENDED)
756 dnl # other checks which require headers
758 if test "x$ac_cv_header_sys_security_h" = "xyes" && test "x$ac_cv_header_prot_h" = "xyes"
760 AC_DEFINE(OSFC2, [], [define if you have OSFC2 authentication])
763 if test "x$ac_cv_header_sia_h" = "xyes" && test "x$ac_cv_header_siad_h" = "xyes"
765 AC_DEFINE(OSFSIA, [], [define if you have OSFSIA authentication])
768 dnl Check for OpenSSL includes.
769 OPENSSL_INCLUDE="-DNO_OPENSSL"
770 if test "x$WITH_OPENSSL" = xyes; then
771 if test "x$OPENSSL_LIBS" = "x"; then
772 AC_MSG_NOTICE([skipping test for openssl/ssl.h])
774 old_CPPFLAGS=$CPPFLAGS
775 if test "x$OPENSSL_INCLUDE_DIR" != "x"; then
776 CPPFLAGS="$CPPFLAGS -I$OPENSSL_INCLUDE_DIR"
778 dnl # stupid RedHat shit
779 CPPFLAGS="$CPPFLAGS -DOPENSSL_NO_KRB5"
793 if test "x$OPENSSL_LIBS" != "x"; then
794 AC_MSG_CHECKING([for OpenSSL version >= 0.9.7])
796 [#include <openssl/crypto.h>
797 #if (OPENSSL_VERSION_NUMBER >= 0x00907000L)
801 if test "x$goodssl" != "xyes"; then
806 if test "x$OPENSSL_INCLUDE_DIR" != "x"; then
807 OPENSSL_INCLUDE="-I$OPENSSL_INCLUDE_DIR -DOPENSSL_NO_KRB5"
809 OPENSSL_INCLUDE="-DOPENSSL_NO_KRB5"
813 CPPFLAGS=$old_CPPFLAGS
816 AC_SUBST(OPENSSL_INCLUDE)
817 AC_SUBST(OPENSSL_LIBS)
820 dnl Check the pcap includes for the RADIUS sniffer.
821 if test "x$PCAP_LIBS" = x; then
822 AC_MSG_NOTICE([skipping test for pcap.h.])
824 AC_CHECK_HEADER(pcap.h,
825 AC_DEFINE(HAVE_PCAP_H, 1,
826 [Define to 1 if you have the <pcap.h> header file.]),
828 AC_MSG_WARN([pcap.h not found, silently disabling the RADIUS sniffer.])
831 AC_CHECK_LIB(pcap, pcap_fopen_offline,
832 [ AC_DEFINE(HAVE_PCAP_FOPEN_OFFLINE, 1,
833 [Define to 1 if you have the function pcap_fopen_offline.])
835 AC_CHECK_LIB(pcap, pcap_dump_fopen,
836 [ AC_DEFINE(HAVE_PCAP_DUMP_FOPEN, 1,
837 [Define to 1 if you have the function pcap_dump_fopen.])
842 dnl #############################################################
844 dnl # 4. Checks for typedefs
846 dnl #############################################################
849 dnl # Ensure that these are defined
856 dnl check for socklen_t
857 FR_CHECK_TYPE_INCLUDE([
858 #ifdef HAVE_SYS_TYPES_H
859 #include <sys/types.h>
861 #ifdef HAVE_SYS_SOCKET_H
862 #include <sys/socket.h>
864 ],socklen_t, int, [socklen_t is generally 'int' on systems which don't use it])
866 dnl check for uint8_t
867 FR_CHECK_TYPE_INCLUDE([
868 #ifdef HAVE_INTTYPES_H
869 #include <inttypes.h>
874 ],uint8_t, unsigned char, [uint8_t should be the canonical 'octet' for network traffic])
876 dnl check for uint16_t
877 FR_CHECK_TYPE_INCLUDE([
878 #ifdef HAVE_INTTYPES_H
879 #include <inttypes.h>
884 ],uint16_t, unsigned short, [uint16_t should be the canonical '2 octets' for network traffic])
886 dnl check for uint32_t
887 FR_CHECK_TYPE_INCLUDE([
888 #ifdef HAVE_INTTYPES_H
889 #include <inttypes.h>
894 ],uint32_t, unsigned int, [uint32_t should be the canonical 'network integer])
896 AC_CHECK_TYPE(struct in6_addr, AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1, [IPv6 address structure]), [], [
897 #ifdef HAVE_NETINET_IN_H
898 #include <netinet/in.h>
902 AC_CHECK_TYPE(struct sockaddr_storage, AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1, [Generic socket addresses]), [], [
903 #ifdef HAVE_NETINET_IN_H
904 #include <netinet/in.h>
906 #ifdef HAVE_SYS_SOCKET_H
907 #include <sys/socket.h>
911 AC_CHECK_TYPE(struct sockaddr_in6, AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1, [IPv6 socket addresses]), [], [
912 #ifdef HAVE_NETINET_IN_H
913 #include <netinet/in.h>
917 AC_CHECK_TYPE(struct addrinfo, AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1, [Generic DNS lookups]), [], [
918 #ifdef HAVE_SYS_TYPES_H
919 #include <sys/types.h>
921 #ifdef HAVE_SYS_SOCKET_H
922 #include <sys/socket.h>
929 dnl #############################################################
931 dnl # 5. Checks for structures and functions
933 dnl #############################################################
968 RADIUSD_NEED_DECLARATIONS( \
980 dnl # check if we have utmpx.h
981 dnl # if so, check if struct utmpx has entry ut_xtime
982 dnl # if not, set it to define ut_xtime == ut_tv.tv_sec
983 if test "x$ac_cv_header_utmpx_h" = "xyes"
985 FR_CHECK_STRUCT_HAS_MEMBER([#include <utmpx.h>], [struct utmpx], ut_xtime)
986 if test "x$ac_cv_type_struct_utmpx_has_ut_xtime" = "x"
988 AC_DEFINE(ut_xtime,ut_tv.tv_sec, [define to something if you don't have ut_xtime in struct utmpx])
992 dnl # struct ip_pktinfo
993 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in_pktinfo], ipi_addr)
994 if test "x$ac_cv_type_struct_in_pktinfo_has_ipi_addr" = "xyes"
996 AC_DEFINE(HAVE_IP_PKTINFO, [], [define if you have IP_PKTINFO (Linux)])
999 dnl # struct in6_pktinfo
1000 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in6_pktinfo], ipi6_addr)
1001 if test "x$ac_cv_type_struct_in6_pktinfo_has_ipi6_addr" = "xyes"
1003 AC_DEFINE(HAVE_IN6_PKTINFO, [], [define if you have IN6_PKTINFO (Linux)])
1006 dnl #############################################################
1008 dnl # 6. Checks for compiler characteristics
1010 dnl #############################################################
1013 dnl # Ensure that these are defined
1018 dnl # See if this is OS/2
1020 AC_MSG_CHECKING(type of OS)
1023 if test "$OS" = "OS/2"; then
1030 AC_MSG_CHECKING(for developer gcc flags)
1033 if test "x$developer" = "xyes"; then
1034 if test "x$GCC" = "xyes"; then
1035 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 -Wformat-nonliteral -Wformat-security -Wformat=2"
1036 CFLAGS="$CFLAGS $devflags"
1038 AC_MSG_RESULT(yes. Using $devflags)
1041 if test "x$EXPERIMENTAL" != "xno"; then
1046 CFLAGS="$CFLAGS -DNDEBUG"
1051 dnl append the current git hash onto the version string
1052 if test -d $srcdir/.git -a "x$GIT" = "xyes"; then
1053 RADIUSD_VERSION_COMMIT=`git log --pretty=format:'%h' -n 1`
1054 AC_DEFINE_UNQUOTED([RADIUSD_VERSION_COMMIT],["${RADIUSD_VERSION_COMMIT}"],[Commit HEAD at time of configuring])
1059 dnl #############################################################
1061 dnl # 7. Checks for library functions
1063 dnl #############################################################
1066 LIBS="$LIBS $LIBLTDL"
1067 AC_CHECK_FUNC(lt_dladvise_init, AC_DEFINE(HAVE_LT_DLADVISE_INIT, [], [Do we have the lt_dladvise_init function]))
1070 dnl Check for talloc
1071 dnl extra argument: --with-talloc-include-dir=DIR
1073 AC_ARG_WITH(talloc-include-dir,
1074 [AS_HELP_STRING([--with-talloc-include-dir=DIR],
1075 [Directory where the talloc includes may be found])],
1078 AC_MSG_ERROR(Need talloc-include-dir)
1083 talloc_include_dir="$withval"
1087 dnl Check for talloc header files
1089 smart_try_dir="$talloc_include_dir"
1090 FR_SMART_CHECK_INCLUDE([talloc.h])
1091 if test "x$ac_cv_header_talloc_h" != "xyes"; then
1092 AC_MSG_WARN([talloc headers not found. Use --with-talloc-include-dir=<path>.])
1093 AC_MSG_ERROR([FreeRADIUS requires libtalloc])
1095 INCLUDE="${SMART_CFLAGS} ${INCLUDE}"
1096 LIBS="-ltalloc ${LIBS}"
1099 dnl Check for libcrypt
1100 dnl We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
1101 AC_CHECK_LIB(crypt, crypt,
1104 if test "$CRYPTLIB" != ""; then
1105 AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function])
1107 AC_CHECK_FUNC(crypt, AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function]))
1110 dnl Check for libcipher
1111 AC_CHECK_LIB(cipher, setkey,
1112 CRYPTLIB="${CRYPTLIB} -lcipher"
1116 dnl Check the style of gethostbyaddr, in order of preference
1117 dnl GNU (_r eight args)
1118 AC_DEFINE(GNUSTYLE, [1], [GNU-Style get*byaddr_r])
1119 dnl SYSV (_r six args)
1120 AC_DEFINE(SYSVSTYLE, [2], [SYSV-Style get*byaddr_r])
1121 dnl BSD (three args, may not be thread safe)
1122 AC_DEFINE(BSDSTYLE, [3], [BSD-Style get*byaddr_r])
1123 dnl Tru64 has BSD version, but it is thread safe
1124 dnl http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1739____.HTM
1125 dnl We need #stdio.h to define NULL on FreeBSD (at least)
1126 gethostbyaddrrstyle=""
1127 AC_MSG_CHECKING([gethostbyaddr_r() syntax])
1130 dnl With FreeBSD, check if there's a prototype for gethostbyaddr_r.
1131 dnl Some versions (FreeBSD 5.1?) have a symbol but no prototype - so we
1132 dnl override this test to BSDSTYLE. FreeBSD 6.2 and up have proper GNU
1134 AC_CHECK_DECLS([gethostbyaddr_r], [], [
1135 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE,
1136 [style of gethostbyaddr_r functions ])
1137 gethostbyaddrrstyle=BSD
1138 AC_MSG_WARN([FreeBSD overridden to BSD-style])
1146 if test "x$gethostbyaddrrstyle" = "x"; then
1150 ], [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL, NULL) ], [
1151 AC_DEFINE(GETHOSTBYADDRRSTYLE, GNUSTYLE, [style of gethostbyaddr_r functions ])
1152 gethostbyaddrrstyle=GNU
1155 if test "x$gethostbyaddrrstyle" = "x"; then
1159 ], [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL) ] , [
1160 AC_DEFINE(GETHOSTBYADDRRSTYLE, SYSVSTYLE, [style of gethostbyaddr_r functions ])
1161 gethostbyaddrrstyle=SYSV
1164 if test "x$gethostbyaddrrstyle" = "x"; then
1168 ], [ gethostbyaddr(NULL, 0, 0) ], [
1169 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE, [style of gethostbyaddr_r functions ])
1170 gethostbyaddrrstyle=BSD
1174 if test "x$gethostbyaddrrstyle" = "x"; then
1175 AC_MSG_RESULT([none! It must not exist, here.])
1177 AC_MSG_RESULT([${gethostbyaddrrstyle}-style])
1180 if test "x$gethostbyaddrrstyle" = "xBSD"; then
1181 AC_MSG_WARN([ ****** BSD-style gethostbyaddr might NOT be thread-safe! ****** ])
1184 dnl Check the style of gethostbyname, in order of preference
1185 dnl GNU (_r seven args)
1186 dnl SYSV (_r five args)
1187 dnl BSD (two args, may not be thread safe)
1188 dnl Tru64 has BSD version, but it _is_ thread safe
1189 dnl http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1946____.HTM
1190 dnl We need #stdio.h to define NULL on FreeBSD (at least)
1191 gethostbynamerstyle=""
1192 AC_MSG_CHECKING([gethostbyname_r() syntax])
1196 ], [ gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL) ], [
1197 AC_DEFINE(GETHOSTBYNAMERSTYLE, GNUSTYLE, [style of gethostbyname_r functions ])
1198 gethostbynamerstyle=GNU
1200 if test "x$gethostbynamerstyle" = "x"; then
1204 ], [ gethostbyname_r(NULL, NULL, NULL, 0, NULL) ] , [
1205 AC_DEFINE(GETHOSTBYNAMERSTYLE, SYSVSTYLE, [style of gethostbyname_r functions ])
1206 gethostbynamerstyle=SYSV
1209 if test "x$gethostbynamerstyle" = "x"; then
1213 ], [ gethostbyname(NULL) ], [
1214 AC_DEFINE(GETHOSTBYNAMERSTYLE, BSDSTYLE, [style of gethostbyname_r functions ])
1215 gethostbynamerstyle=BSD
1219 if test "x$gethostbynamerstyle" = "x"; then
1220 AC_MSG_RESULT([none! It must not exist, here.])
1222 AC_MSG_RESULT([${gethostbynamerstyle}-style])
1225 if test "x$gethostbynamerstyle" = "xBSD"; then
1226 AC_MSG_WARN([ ****** BSD-style gethostbyname might NOT be thread-safe! ****** ])
1229 dnl check for non-posix solaris ctime_r (extra buflen int arg)
1230 AC_DEFINE(POSIXSTYLE, [1], [Posix-Style ctime_r])
1231 AC_DEFINE(SOLARISSTYLE, [2], [Solaris-Style ctime_r])
1233 AC_MSG_CHECKING([ctime_r() syntax])
1236 ], [ ctime_r(NULL, NULL, 0) ], [
1237 AC_DEFINE(CTIMERSTYLE, SOLARISSTYLE, [style of ctime_r function])
1238 ctimerstyle="SOLARIS"
1240 if test "x$ctimerstyle" = "x"; then
1243 ], [ ctime_r(NULL, NULL) ], [
1244 AC_DEFINE(CTIMERSTYLE, POSIXSTYLE, [style of ctime_r function])
1249 if test "x$ctimerstyle" = "x"; then
1250 AC_MSG_RESULT([none! It must not exist, here.])
1252 AC_MSG_RESULT([${ctimerstyle}-style])
1255 AC_SUBST(HOSTINFO, $host)
1257 dnl #############################################################
1259 dnl # 8. Checks for system services
1261 dnl #############################################################
1264 dnl # Figure out where libtool is located,
1268 AC_MSG_RESULT([top_builddir=$top_builddir])
1269 dnl # AC_SUBST(top_builddir)
1273 dnl import libtool stuff
1275 dnl #############################################################
1277 dnl # Configure in any module directories.
1279 dnl #############################################################
1281 dnl ############################################################
1282 dnl # Remove any conflicting definitions if autoconf.h
1283 dnl # is being included by a module.
1284 dnl #############################################################
1285 AH_BOTTOM([#include <freeradius-devel/automask.h>])
1287 dnl ############################################################
1288 dnl # make modules by list
1289 dnl #############################################################
1290 if test "x$EXPERIMENTAL" = "xyes"; then
1291 for foo in `ls -1 "${srcdir}"/src/modules | grep rlm_`; do
1292 MODULES="$MODULES $foo"
1296 dnl # make ONLY the stable modules
1298 for foo in `cat "${srcdir}"/src/modules/stable`; do
1299 MODULES="$MODULES $foo"
1303 dnl ############################################################
1304 dnl # Add autoconf subdirs, based on the module list we
1305 dnl # previously created.
1306 dnl #############################################################
1308 for bar in $MODULES; do
1309 if test -f "${srcdir}"/src/modules/$bar/configure; then
1310 mysubdirs="$mysubdirs src/modules/$bar"
1315 dnl # Don't change the variable name here. Autoconf goes bonkers
1318 AC_CONFIG_SUBDIRS($mysubdirs)
1321 dnl #############################################################
1323 dnl # And finally, output the results.
1325 dnl #############################################################
1327 AC_CONFIG_COMMANDS([stamp-h], [echo timestamp > src/include/stamp-h])
1328 AC_CONFIG_COMMANDS([build-radpaths-h], [(cd ./src/include && /bin/sh ./build-radpaths-h)])
1329 AC_CONFIG_COMMANDS([main-chmod], [(cd ./src/main && chmod +x checkrad radlast radtest)])
1330 AC_CONFIG_COMMANDS([scripts-chmod], [(cd ./scripts && chmod +x rc.radiusd radiusd.cron.daily radiusd.cron.monthly cryptpasswd)])
1333 dnl # Substitute whatever libraries we found to be necessary
1336 AC_SUBST(INSTALLSTRIP)
1338 USE_SHARED_LIBS=$enable_shared
1339 AC_SUBST(USE_SHARED_LIBS)
1340 USE_STATIC_LIBS=$enable_static
1341 AC_SUBST(USE_STATIC_LIBS)
1342 AC_SUBST(STATIC_MODULES)
1346 ./src/include/build-radpaths-h \
1347 ./src/main/Makefile \
1348 ./src/main/radsniff.mk \
1349 ./src/main/checkrad \
1350 ./src/main/radlast \
1351 ./src/main/radtest \
1352 ./scripts/rc.radiusd \
1353 ./scripts/radiusd.cron.daily \
1354 ./scripts/radiusd.cron.monthly \
1355 ./scripts/cryptpasswd \
1356 ./raddb/dictionary \
1357 ./raddb/radrelay.conf \
1358 ./raddb/radiusd.conf