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 }'`
46 dnl # Still useful for custom builds
47 RADIUSD_VERSION_STRING=`cat VERSION`
50 dnl # Add definitions to Make.inc as it's used by various build targets
52 AC_SUBST([RADIUSD_VERSION_STRING])
55 dnl # Add definitions to autoconf.h, so that the headers that we install
56 dnl # contain the version number of the server.
58 AC_DEFINE_UNQUOTED([RADIUSD_VERSION], [${RADIUSD_VERSION}], [Version integer in format <ma><ma><mi><mi><in><in>])
59 AC_DEFINE_UNQUOTED([RADIUSD_VERSION_STRING], ["${RADIUSD_VERSION_STRING}"], [Raw version string from VERSION file])
61 dnl #############################################################
63 dnl # Override some of the default autoconf variables such as
64 dnl # CFLAGS if were building in developer mode
66 dnl #############################################################
69 dnl # Enable developer features like debugging symbols.
70 dnl # These checks must be done before expanding the AC_PROG_CC
71 dnl # and AC_PROG_CXX macros.
73 AC_ARG_ENABLE(developer,
74 [ --enable-developer enables features of interest to developers.],
75 [ case "$enableval" in
85 dnl # Turn on the developer flag when taken from a git checkout (not a release)
87 if test -d $srcdir/.git; then
88 if test "x$developer" != "xno"; then
89 AC_MSG_NOTICE([found .git directory, enabling developer build implicitly, disable with --enable-developer=no])
95 dnl # Autoconf sets -O2 and -g by default, but this is a PITA for debugging
96 dnl # so we remove the defaults if were building in developer mode, and set
97 dnl # -g3 so nice things like macro values are included. Other arguments are
98 dnl # added later when we know what compiler were using.
100 if test "x$developer" = "xyes"; then
107 dnl #############################################################
109 dnl # 0. Checks for compiler, libtool, and command line options.
111 dnl #############################################################
113 dnl Get system information
121 dnl # check for AIX, to allow us to use some BSD functions
122 dnl # must be before macros that call the compiler.
126 AC_PROG_GCC_TRADITIONAL
133 dnl # Set Default CFLAGS for GCC compatible compilers
135 if test "x$GCC" = "xyes"; then
136 CFLAGS="$CFLAGS -Wall -D_GNU_SOURCE"
140 dnl # -Qunused-arguments means the compiler won't complain about unsupported arguments
142 AX_QUNUSED_ARGUMENTS_FLAG
143 if test "x$ax_cv_qunused_arguments_flag" = "xyes"; then
144 CFLAGS="$CFLAGS -Qunused-arguments"
145 LDFLAGS="$LDFLAGS -Qunused-arguments"
148 dnl Compile in large (2G+) file support.
151 dnl # check for system bytesex
152 dnl # AC_DEFINES WORDS_BIGENDIAN
156 AC_CHECK_PROG(GMAKE, gmake, yes, no)
157 if test $GMAKE = no; then
158 AC_PATH_PROG(MAKE, make, /usr/local/bin/make)
160 AC_PATH_PROG(MAKE, gmake, /usr/local/gnu/bin/make)
162 makever=`$ac_cv_path_MAKE --version 2>&1 | grep "GNU Make"`
163 if test -z "$makever"; then
164 AC_MSG_ERROR(GNU Make is not installed. Please download and install it
165 from ftp://prep.ai.mit.edu/pub/gnu/make/ before continuing.)
168 dnl See if we have Git.
169 AC_CHECK_PROG(GIT, git, yes, no)
171 dnl Put this in later, when all distributed modules use autoconf.
172 dnl AC_ARG_WITH(disablemodulefoo,
173 dnl [ --without-rlm_foo Disables module compilation. Module list:]
174 dnl esyscmd([find src/modules -type d -name rlm_\* -print |\
175 dnl sed -e 's%src/modules/.*/% (sub)- %; s%.*/%- %' |\
176 dnl awk '{print " "$0}']))
178 AC_ARG_ENABLE(strict-dependencies,
179 [ --enable-strict-dependencies Fail configure on lack of module dependancy.])
181 AC_ARG_ENABLE(werror,
182 [ --enable-werror causes the build to fail if any warnings are generated.],
183 [ case "$enableval" in
192 dnl extra argument: --with-docdir
193 docdir='${datadir}/doc/freeradius'
194 AC_MSG_CHECKING(docdir)
196 [ --with-docdir=DIR Directory for documentation [DATADIR/doc/freeradius] ],
203 [[\\/$]]* | ?:[[\\/]]* )
207 AC_MSG_ERROR([expected an absolute directory name for --with-docdir: $withval])
212 AC_MSG_RESULT($docdir)
213 if test "x$docdir" = xno; then
214 AC_MSG_WARN(Documentation files will NOT be installed.)
217 dnl extra argument: --with-logdir
218 logdir='${localstatedir}/log/radius'
219 AC_MSG_CHECKING(logdir)
221 [ --with-logdir=DIR Directory for logfiles [LOCALSTATEDIR/log/radius] ],
224 AC_MSG_ERROR(Need logdir)
228 [[\\/$]]* | ?:[[\\/]]* )
232 AC_MSG_ERROR([expected an absolute directory name for --with-logdir: $withval])
237 AC_MSG_RESULT($logdir)
239 dnl extra argument: --with-radacctdir
240 radacctdir='${logdir}/radacct'
241 AC_MSG_CHECKING(radacctdir)
242 AC_ARG_WITH(radacctdir,
243 [ --with-radacctdir=DIR Directory for detail files [LOGDIR/radacct] ],
246 AC_MSG_ERROR(Need radacctdir)
250 [[\\/$]]* | ?:[[\\/]]* )
251 radacctdir="$withval"
254 AC_MSG_ERROR([expected an absolute directory name for --with-radacctdir: $withval])
259 AC_MSG_RESULT($radacctdir)
261 dnl extra argument: --with-raddbdir
262 raddbdir='${sysconfdir}/raddb'
263 AC_MSG_CHECKING(raddbdir)
264 AC_ARG_WITH(raddbdir,
265 [ --with-raddbdir=DIR Directory for config files [SYSCONFDIR/raddb] ],
268 AC_MSG_ERROR(Need raddbdir)
272 [[\\/$]]* | ?:[[\\/]]* )
276 AC_MSG_ERROR([expected an absolute directory name for --with-raddbdir: $withval])
281 AC_MSG_RESULT($raddbdir)
283 dnl extra argument: --with-ascend-binary
284 WITH_ASCEND_BINARY=yes
285 AC_ARG_WITH(ascend-binary,
286 [ --with-ascend-binary Include support for Ascend binary filter attributes (default=yes)],
291 WITH_ASCEND_BINARY=no
294 if test "x$WITH_ASCEND_BINARY" = "xyes"; then
295 AC_DEFINE(WITH_ASCEND_BINARY, [1], [Include support for Ascend binary filter attributes])
298 dnl extra argument: --with-threads
301 [ --with-threads Use threads, if available. (default=yes) ],
310 dnl extra argument: --with-tcp
313 [ --with-tcp Compile in TCP support. (default=yes)],
321 if test "x$WITH_TCP" = "xyes"; then
322 AC_DEFINE(WITH_TCP, [1], [define if you want TCP support (For RADSec et al)])
325 dnl extra argument: --with-vmps
328 [ --with-vmps Compile in VMPS support. (default=yes)],
336 if test "x$WITH_VMPS" = "xyes"; then
337 AC_DEFINE(WITH_VMPS, [1], [define if you want VMPS support])
340 dnl extra argument: --with-dhcp
343 [ --with-dhcp Compile in DHCP support. (default=yes)],
351 if test "x$WITH_DHCP" = "xyes"; then
352 AC_DEFINE(WITH_DHCP, [1], [define if you want DHCP support])
356 dnl # Allow the user to specify a list of modules to be linked
357 dnl # statically to the server.
360 AC_ARG_WITH(static_modules,
361 [ --with-static-modules=QUOTED-MODULE-LIST],[
362 for i in $withval; do
363 STATIC_MODULES="$STATIC_MODULES -dlpreopen ../modules/rlm_$i/rlm_$i.la"
369 [ --with-modules=QUOTED-MODULE-LIST],[
370 for i in $withval; do
371 MODULES="$MODULES $i"
375 dnl extra argument: --with-experimental-modules
377 AC_ARG_WITH(experimental-modules,
378 [ --with-experimental-modules Use experimental and unstable modules. (default=no, unless --enable-developer=yes) ],
390 dnl extra argument: --with-openssl
393 [ --with-openssl Use OpenSSL. (default=yes)],
405 dnl # extra argument: --with-openssl-includes=dir
408 AC_ARG_WITH(openssl-includes,
409 [ --with-openssl-includes=DIR Directory to look for OpenSSL include files],
411 *) OPENSSL_INCLUDE_DIR="$withval"
417 dnl # extra argument: --with-openssl-libraries=dir
420 AC_ARG_WITH(openssl-libraries,
421 [ --with-openssl-libraries=DIR Directory to look for OpenSSL library files],
423 *) OPENSSL_LIB_DIR="$withval"
429 dnl # These next two arguments don't actually do anything. They're
430 dnl # place holders so that the top-level configure script can tell
431 dnl # the user how to configure lower-level modules
435 dnl # extra argument: --with-rlm-FOO-lib-dir
437 AC_ARG_WITH(rlm-FOO-lib-dir,
438 [ --with-rlm-FOO-lib-dir=DIR Directory to look for library files used by module FOO],
446 dnl # extra argument: --with-rlm-FOO-include-dir
448 AC_ARG_WITH(rlm-FOO-include-dir,
449 [ --with-rlm-FOO-include-dir=DIR Directory to look for include files used by module FOO],
456 dnl See what include-style is used by the make program.
457 dnl AC_MSG_CHECKING(include style for make)
458 dnl echo "include /dev/null" > testmake.$$
459 dnl echo "all:" >> testmake.$$
460 dnl make -f testmake.$$ >/dev/null 2>&1
469 dnl rm -f testmake.$$
470 dnl AC_MSG_RESULT(" $INCLUDE")
471 dnl AC_SUBST(INCLUDE)
474 dnl extra argument: --with-udpfromto
476 AC_ARG_WITH(udpfromto,
477 [ --with-udpfromto Compile in UDPFROMTO support. (default=no)],
487 if test "x$WITH_UDPFROMTO" = "xyes"; then
488 AC_DEFINE(WITH_UDPFROMTO, [], [define if you want udpfromto])
491 dnl #############################################################
493 dnl # 1. Checks for programs
495 dnl #############################################################
498 AC_PATH_PROG(PERL, perl, /usr/local/bin/perl)
499 if test "x$ac_cv_path_PERL" = "x"; then
500 AC_MSG_WARN(perl not found - Simultaneous-Use and checkrad may not work)
502 AC_PATH_PROG(SNMPGET, snmpget)
503 if test "x$ac_cv_path_SNMPGET" = "x"; then
504 AC_MSG_WARN(snmpget not found - Simultaneous-Use and checkrad may not work)
507 AC_PATH_PROG(SNMPWALK, snmpwalk)
508 if test "x$ac_cv_path_SNMPWALK" = "x"; then
509 AC_MSG_WARN(snmpwalk not found - Simultaneous-Use and checkrad may not work)
512 AC_PATH_PROG(RUSERS, rusers, /usr/bin/rusers)
514 dnl FIXME This is truly gross.
515 missing_dir=`cd $ac_aux_dir && pwd`
516 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
517 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
518 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
520 AC_PATH_PROG(LOCATE,locate)
521 AC_PATH_PROG(DIRNAME,dirname)
522 AC_PATH_PROG(GREP,grep)
524 dnl #############################################################
526 dnl # 2. Checks for libraries
528 dnl #############################################################
530 dnl If using pthreads, check for -lpthread (posix) or -lc_r (*BSD)
532 if test "x$WITH_THREADS" = "xyes"; then
533 if test $ac_cv_prog_suncc = "yes"; then
537 AC_CHECK_HEADERS(pthread.h, [], [ WITH_THREADS="no" ])
540 dnl # pthread stuff is usually in -lpthread
541 dnl # or in -lc_r, on *BSD
543 dnl # On Some systems, we need extra pre-processor flags, to get them to
544 dnl # to do the threading properly.
546 AC_CHECK_LIB(pthread, pthread_create,
547 [ CFLAGS="$CFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS"
548 LIBS="-lpthread $LIBS" ],
549 [ AC_CHECK_LIB(c_r, pthread_create,
550 [ CFLAGS="$CFLAGS -pthread -D_THREAD_SAFE" ],
551 [ WITH_THREADS="no" ]
557 dnl # If we have NO pthread libraries, remove any knowledge of threads.
559 if test "x$WITH_THREADS" != "xyes"; then
561 ac_cv_header_pthread_h="no"
565 dnl # We need sem_init() and friends, as they're the friendliest
566 dnl # semaphore functions for threading.
568 dnl # HP/UX requires linking with librt, too, to get the sem_* symbols.
569 dnl # Some systems have them in -lsem
570 dnl # Solaris has them in -lposix4
571 dnl # NetBSD has them in -lsemaphore
573 AC_SEARCH_LIBS(sem_init, pthread sem posix4 rt semaphore,
575 [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)]
579 if test "x$WITH_THREADS" = "xyes"; then
580 AC_DEFINE(WITH_THREADS, [1], [define if you want thread support])
583 dnl Check if we need -lsocket
584 AC_CHECK_LIB(dl, dlopen)
586 dnl Check if we need -lsocket
587 AC_CHECK_LIB(socket, getsockname)
589 dnl Check for -lresolv
590 dnl This library may be needed later.
591 AC_CHECK_LIB(resolv, inet_aton)
593 dnl Check if we need -lnsl. Usually if we want to
594 dnl link against -lsocket we need to include -lnsl as well.
595 AC_CHECK_LIB(nsl, inet_ntoa)
597 dnl Check for OpenSSL libraries.
599 if test "x$WITH_OPENSSL" = xyes; then
601 old_LDFLAGS="$LDFLAGS"
602 if test "x$OPENSSL_LIB_DIR" != "x"; then
603 LDFLAGS="$LDFLAGS -L$OPENSSL_LIB_DIR"
605 AC_CHECK_LIB(crypto, DH_new,
607 LIBS="-lcrypto $LIBS"
608 AC_DEFINE(HAVE_LIBCRYPTO, 1,
609 [Define to 1 if you have the `crypto' library (-lcrypto).])
610 AC_CHECK_LIB(ssl, SSL_new,
612 AC_DEFINE(HAVE_LIBSSL, 1,
613 [Define to 1 if you have the `ssl' library (-lssl).])
614 if test "x$OPENSSL_LIB_DIR" != "x"; then
615 OPENSSL_LIBS="-L$OPENSSL_LIB_DIR"
617 OPENSSL_LIBS="$OPENSSL_LIBS -lcrypto -lssl -lcrypto"
621 LDFLAGS="$old_LDFLAGS"
624 AC_CHECK_LIB(ws2_32, htonl)
626 dnl Check the pcap library for the RADIUS sniffer.
628 AC_CHECK_LIB(pcap, pcap_open_live,
630 AC_DEFINE(HAVE_LIBPCAP, 1,
631 [Define to 1 if you have the `pcap' library (-lpcap).])
633 [ AC_MSG_WARN([pcap library not found, silently disabling the RADIUS sniffer.]) ])
637 dnl #############################################################
639 dnl # 3. Checks for header files
641 dnl #############################################################
644 dnl # Interix requires us to set -D_ALL_SOURCE, otherwise
645 dnl # getopt will be #included, but won't link. <sigh>
650 CFLAGS="$CFLAGS -D_ALL_SOURCE"
653 CFLAGS="$CFLAGS -DDARWIN"
654 LIBS="-framework DirectoryService $LIBS"
705 dnl FreeBSD requires sys/socket.h before net/if.h
706 AC_CHECK_HEADERS(net/if.h, [], [],
707 [#ifdef HAVE_SYS_SOCKET_H
708 # include <sys/socket.h>
713 AC_CHECK_HEADER(pcreposix.h, AC_DEFINE(HAVE_PCREPOSIX_H, [], [define this if we have the <pcreposix.h> header file]))
714 if test "x$ac_cv_header_pcreposix_h" = "xyes"; then
715 AC_DEFINE(HAVE_REGEX_H, [], [define if we have any regex])
719 LIBS="$LIBS -lpcreposix"
722 AC_CHECK_HEADER(regex.h, AC_DEFINE(HAVE_REGEX_H, [], [define this if we have the <regex.h> header file]))
723 if test "x$ac_cv_header_regex_h" = "xyes"; then
732 ], [AC_DEFINE(HAVE_REG_EXTENDED, [], [define this if we have REG_EXTENDED (from <regex.h>)]) REGEX_EXTENDED=yes])
738 AC_SUBST(REGEX_EXTENDED)
741 dnl # other checks which require headers
743 if test "x$ac_cv_header_sys_security_h" = "xyes" && test "x$ac_cv_header_prot_h" = "xyes"
745 AC_DEFINE(OSFC2, [], [define if you have OSFC2 authentication])
748 if test "x$ac_cv_header_sia_h" = "xyes" && test "x$ac_cv_header_siad_h" = "xyes"
750 AC_DEFINE(OSFSIA, [], [define if you have OSFSIA authentication])
753 dnl Check for OpenSSL includes.
754 OPENSSL_INCLUDE="-DNO_OPENSSL"
755 if test "x$WITH_OPENSSL" = xyes; then
756 if test "x$OPENSSL_LIBS" = "x"; then
757 AC_MSG_NOTICE([skipping test for openssl/ssl.h])
759 old_CPPFLAGS=$CPPFLAGS
760 if test "x$OPENSSL_INCLUDE_DIR" != "x"; then
761 CPPFLAGS="$CPPFLAGS -I$OPENSSL_INCLUDE_DIR"
763 dnl # stupid RedHat shit
764 CPPFLAGS="$CPPFLAGS -DOPENSSL_NO_KRB5"
778 if test "x$OPENSSL_LIBS" != "x"; then
779 AC_MSG_CHECKING([for OpenSSL version >= 0.9.7])
781 [#include <openssl/crypto.h>
782 #if (OPENSSL_VERSION_NUMBER >= 0x00907000L)
786 if test "x$goodssl" != "xyes"; then
791 if test "x$OPENSSL_INCLUDE_DIR" != "x"; then
792 OPENSSL_INCLUDE="-I$OPENSSL_INCLUDE_DIR -DOPENSSL_NO_KRB5"
794 OPENSSL_INCLUDE="-DOPENSSL_NO_KRB5"
798 CPPFLAGS=$old_CPPFLAGS
801 AC_SUBST(OPENSSL_INCLUDE)
802 AC_SUBST(OPENSSL_LIBS)
805 dnl Check the pcap includes for the RADIUS sniffer.
806 if test "x$PCAP_LIBS" = x; then
807 AC_MSG_NOTICE([skipping test for pcap.h.])
809 AC_CHECK_HEADER(pcap.h,
810 AC_DEFINE(HAVE_PCAP_H, 1,
811 [Define to 1 if you have the <pcap.h> header file.]),
813 AC_MSG_WARN([pcap.h not found, silently disabling the RADIUS sniffer.])
816 AC_CHECK_LIB(pcap, pcap_fopen_offline,
817 [ AC_DEFINE(HAVE_PCAP_FOPEN_OFFLINE, 1,
818 [Define to 1 if you have the function pcap_fopen_offline.])
820 AC_CHECK_LIB(pcap, pcap_dump_fopen,
821 [ AC_DEFINE(HAVE_PCAP_DUMP_FOPEN, 1,
822 [Define to 1 if you have the function pcap_dump_fopen.])
827 dnl #############################################################
829 dnl # 4. Checks for typedefs
831 dnl #############################################################
834 dnl # Ensure that these are defined
841 dnl check for socklen_t
842 FR_CHECK_TYPE_INCLUDE([
843 #ifdef HAVE_SYS_TYPES_H
844 #include <sys/types.h>
846 #ifdef HAVE_SYS_SOCKET_H
847 #include <sys/socket.h>
849 ],socklen_t, int, [socklen_t is generally 'int' on systems which don't use it])
851 dnl check for uint8_t
852 FR_CHECK_TYPE_INCLUDE([
853 #ifdef HAVE_INTTYPES_H
854 #include <inttypes.h>
859 ],uint8_t, unsigned char, [uint8_t should be the canonical 'octet' for network traffic])
861 dnl check for uint16_t
862 FR_CHECK_TYPE_INCLUDE([
863 #ifdef HAVE_INTTYPES_H
864 #include <inttypes.h>
869 ],uint16_t, unsigned short, [uint16_t should be the canonical '2 octets' for network traffic])
871 dnl check for uint32_t
872 FR_CHECK_TYPE_INCLUDE([
873 #ifdef HAVE_INTTYPES_H
874 #include <inttypes.h>
879 ],uint32_t, unsigned int, [uint32_t should be the canonical 'network integer])
881 AC_CHECK_TYPE(struct in6_addr, AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1, [IPv6 address structure]), [], [
882 #ifdef HAVE_NETINET_IN_H
883 #include <netinet/in.h>
887 AC_CHECK_TYPE(struct sockaddr_storage, AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1, [Generic socket addresses]), [], [
888 #ifdef HAVE_NETINET_IN_H
889 #include <netinet/in.h>
891 #ifdef HAVE_SYS_SOCKET_H
892 #include <sys/socket.h>
896 AC_CHECK_TYPE(struct sockaddr_in6, AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1, [IPv6 socket addresses]), [], [
897 #ifdef HAVE_NETINET_IN_H
898 #include <netinet/in.h>
902 AC_CHECK_TYPE(struct addrinfo, AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1, [Generic DNS lookups]), [], [
903 #ifdef HAVE_SYS_TYPES_H
904 #include <sys/types.h>
906 #ifdef HAVE_SYS_SOCKET_H
907 #include <sys/socket.h>
914 dnl #############################################################
916 dnl # 5. Checks for structures and functions
918 dnl #############################################################
956 dnl # check if we have utmpx.h
957 dnl # if so, check if struct utmpx has entry ut_xtime
958 dnl # if not, set it to define ut_xtime == ut_tv.tv_sec
959 if test "x$ac_cv_header_utmpx_h" = "xyes"
961 FR_CHECK_STRUCT_HAS_MEMBER([#include <utmpx.h>], [struct utmpx], ut_xtime)
962 if test "x$ac_cv_type_struct_utmpx_has_ut_xtime" = "x"
964 AC_DEFINE(ut_xtime,ut_tv.tv_sec, [define to something if you don't have ut_xtime in struct utmpx])
968 dnl # struct ip_pktinfo
969 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in_pktinfo], ipi_addr)
970 if test "x$ac_cv_type_struct_in_pktinfo_has_ipi_addr" = "xyes"
972 AC_DEFINE(HAVE_IP_PKTINFO, [], [define if you have IP_PKTINFO (Linux)])
975 dnl # struct in6_pktinfo
976 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in6_pktinfo], ipi6_addr)
977 if test "x$ac_cv_type_struct_in6_pktinfo_has_ipi6_addr" = "xyes"
979 AC_DEFINE(HAVE_IN6_PKTINFO, [], [define if you have IN6_PKTINFO (Linux)])
982 dnl #############################################################
984 dnl # 6. Checks for compiler characteristics
986 dnl #############################################################
989 dnl # Ensure that these are defined
994 dnl # See if this is OS/2
996 AC_MSG_CHECKING(type of OS)
999 if test "$OS" = "OS/2"; then
1006 if test "x$developer" = "xyes"; then
1007 AC_MSG_NOTICE([Setting additional developer CFLAGS])
1010 dnl # Tell the compiler to parse doxygen documentation and verify it against function and variable declarations
1012 AX_WDOCUMENTATION_FLAG
1013 if test "x$ax_cv_wdocumentation_flag" = "xyes"; then
1014 devflags="-Wdocumentation"
1017 if test "x$GCC" = "xyes"; then
1018 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"
1022 AC_MSG_NOTICE([Developer CFLAGS are "$devflags"])
1024 CFLAGS="$CFLAGS $devflags"
1026 dnl # Enable experimental modules (we want to know if code changes breaks one of them)
1028 if test "x$EXPERIMENTAL" != "xno"; then
1029 AC_MSG_NOTICE([is developer build, enabling experimental modules implicitly, disable with --without-experimental-modules])
1034 CFLAGS="$CFLAGS -DNDEBUG"
1036 AC_MSG_RESULT([no.])
1041 dnl append the current git hash onto the version string
1042 if test -d $srcdir/.git -a "x$GIT" = "xyes"; then
1043 RADIUSD_VERSION_COMMIT=`git log --pretty=format:'%h' -n 1`
1044 AC_DEFINE_UNQUOTED([RADIUSD_VERSION_COMMIT],["${RADIUSD_VERSION_COMMIT}"],[Commit HEAD at time of configuring])
1049 dnl #############################################################
1051 dnl # 7. Checks for library functions
1053 dnl #############################################################
1055 dnl Check for talloc
1056 dnl extra argument: --with-talloc-include-dir=DIR
1058 AC_ARG_WITH(talloc-include-dir,
1059 [AS_HELP_STRING([--with-talloc-include-dir=DIR],
1060 [Directory where the talloc includes may be found])],
1063 AC_MSG_ERROR(Need talloc-include-dir)
1068 talloc_include_dir="$withval"
1072 dnl Check for talloc header files
1074 smart_try_dir="$talloc_include_dir"
1075 FR_SMART_CHECK_INCLUDE([talloc.h])
1076 if test "x$ac_cv_header_talloc_h" != "xyes"; then
1077 AC_MSG_WARN([talloc headers not found. Use --with-talloc-include-dir=<path>.])
1078 AC_MSG_ERROR([FreeRADIUS requires libtalloc])
1080 INCLUDE="${SMART_CFLAGS} ${INCLUDE}"
1081 LIBS="-ltalloc ${LIBS}"
1084 dnl Check for libcrypt
1085 dnl We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
1086 AC_CHECK_LIB(crypt, crypt,
1089 if test "$CRYPTLIB" != ""; then
1090 AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function])
1092 AC_CHECK_FUNC(crypt, AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function]))
1095 dnl Check for libcipher
1096 AC_CHECK_LIB(cipher, setkey,
1097 CRYPTLIB="${CRYPTLIB} -lcipher"
1101 dnl Check the style of gethostbyaddr, in order of preference
1102 dnl GNU (_r eight args)
1103 AC_DEFINE(GNUSTYLE, [1], [GNU-Style get*byaddr_r])
1104 dnl SYSV (_r six args)
1105 AC_DEFINE(SYSVSTYLE, [2], [SYSV-Style get*byaddr_r])
1106 dnl BSD (three args, may not be thread safe)
1107 AC_DEFINE(BSDSTYLE, [3], [BSD-Style get*byaddr_r])
1108 dnl Tru64 has BSD version, but it is thread safe
1109 dnl http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1739____.HTM
1110 dnl We need #stdio.h to define NULL on FreeBSD (at least)
1111 gethostbyaddrrstyle=""
1112 AC_MSG_CHECKING([gethostbyaddr_r() syntax])
1115 dnl With FreeBSD, check if there's a prototype for gethostbyaddr_r.
1116 dnl Some versions (FreeBSD 5.1?) have a symbol but no prototype - so we
1117 dnl override this test to BSDSTYLE. FreeBSD 6.2 and up have proper GNU
1119 AC_CHECK_DECLS([gethostbyaddr_r], [], [
1120 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE,
1121 [style of gethostbyaddr_r functions ])
1122 gethostbyaddrrstyle=BSD
1123 AC_MSG_WARN([FreeBSD overridden to BSD-style])
1131 if test "x$gethostbyaddrrstyle" = "x"; then
1135 ], [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL, NULL) ], [
1136 AC_DEFINE(GETHOSTBYADDRRSTYLE, GNUSTYLE, [style of gethostbyaddr_r functions ])
1137 gethostbyaddrrstyle=GNU
1140 if test "x$gethostbyaddrrstyle" = "x"; then
1144 ], [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL) ] , [
1145 AC_DEFINE(GETHOSTBYADDRRSTYLE, SYSVSTYLE, [style of gethostbyaddr_r functions ])
1146 gethostbyaddrrstyle=SYSV
1149 if test "x$gethostbyaddrrstyle" = "x"; then
1153 ], [ gethostbyaddr(NULL, 0, 0) ], [
1154 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE, [style of gethostbyaddr_r functions ])
1155 gethostbyaddrrstyle=BSD
1159 if test "x$gethostbyaddrrstyle" = "x"; then
1160 AC_MSG_RESULT([none! It must not exist, here.])
1162 AC_MSG_RESULT([${gethostbyaddrrstyle}-style])
1165 if test "x$gethostbyaddrrstyle" = "xBSD"; then
1166 AC_MSG_WARN([ ****** BSD-style gethostbyaddr might NOT be thread-safe! ****** ])
1169 dnl Check the style of gethostbyname, in order of preference
1170 dnl GNU (_r seven args)
1171 dnl SYSV (_r five args)
1172 dnl BSD (two args, may not be thread safe)
1173 dnl Tru64 has BSD version, but it _is_ thread safe
1174 dnl http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1946____.HTM
1175 dnl We need #stdio.h to define NULL on FreeBSD (at least)
1176 gethostbynamerstyle=""
1177 AC_MSG_CHECKING([gethostbyname_r() syntax])
1181 ], [ gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL) ], [
1182 AC_DEFINE(GETHOSTBYNAMERSTYLE, GNUSTYLE, [style of gethostbyname_r functions ])
1183 gethostbynamerstyle=GNU
1185 if test "x$gethostbynamerstyle" = "x"; then
1189 ], [ gethostbyname_r(NULL, NULL, NULL, 0, NULL) ] , [
1190 AC_DEFINE(GETHOSTBYNAMERSTYLE, SYSVSTYLE, [style of gethostbyname_r functions ])
1191 gethostbynamerstyle=SYSV
1194 if test "x$gethostbynamerstyle" = "x"; then
1198 ], [ gethostbyname(NULL) ], [
1199 AC_DEFINE(GETHOSTBYNAMERSTYLE, BSDSTYLE, [style of gethostbyname_r functions ])
1200 gethostbynamerstyle=BSD
1204 if test "x$gethostbynamerstyle" = "x"; then
1205 AC_MSG_RESULT([none! It must not exist, here.])
1207 AC_MSG_RESULT([${gethostbynamerstyle}-style])
1210 if test "x$gethostbynamerstyle" = "xBSD"; then
1211 AC_MSG_WARN([ ****** BSD-style gethostbyname might NOT be thread-safe! ****** ])
1214 dnl check for non-posix solaris ctime_r (extra buflen int arg)
1215 AC_DEFINE(POSIXSTYLE, [1], [Posix-Style ctime_r])
1216 AC_DEFINE(SOLARISSTYLE, [2], [Solaris-Style ctime_r])
1218 AC_MSG_CHECKING([ctime_r() syntax])
1221 ], [ ctime_r(NULL, NULL, 0) ], [
1222 AC_DEFINE(CTIMERSTYLE, SOLARISSTYLE, [style of ctime_r function])
1223 ctimerstyle="SOLARIS"
1225 if test "x$ctimerstyle" = "x"; then
1228 ], [ ctime_r(NULL, NULL) ], [
1229 AC_DEFINE(CTIMERSTYLE, POSIXSTYLE, [style of ctime_r function])
1234 if test "x$ctimerstyle" = "x"; then
1235 AC_MSG_RESULT([none! It must not exist, here.])
1237 AC_MSG_RESULT([${ctimerstyle}-style])
1240 AC_SUBST(HOSTINFO, $host)
1242 dnl #############################################################
1244 dnl # 8. Checks for system services
1246 dnl #############################################################
1249 dnl # Figure out where libtool is located,
1253 AC_MSG_RESULT([top_builddir=$top_builddir])
1254 dnl # AC_SUBST(top_builddir)
1256 dnl import libtool stuff
1258 dnl #############################################################
1260 dnl # Configure in any module directories.
1262 dnl #############################################################
1264 dnl ############################################################
1265 dnl # Remove any conflicting definitions if autoconf.h
1266 dnl # is being included by a module.
1267 dnl #############################################################
1268 AH_BOTTOM([#include <freeradius-devel/automask.h>])
1270 dnl ############################################################
1271 dnl # make modules by list
1272 dnl #############################################################
1273 if test "x$EXPERIMENTAL" = "xyes"; then
1274 for foo in `ls -1 "${srcdir}"/src/modules | grep rlm_`; do
1275 MODULES="$MODULES $foo"
1279 dnl # make ONLY the stable modules
1281 for foo in `cat "${srcdir}"/src/modules/stable`; do
1282 MODULES="$MODULES $foo"
1286 dnl ############################################################
1287 dnl # Add autoconf subdirs, based on the module list we
1288 dnl # previously created.
1289 dnl #############################################################
1291 for bar in $MODULES; do
1292 if test -f "${srcdir}"/src/modules/$bar/configure; then
1293 mysubdirs="$mysubdirs src/modules/$bar"
1298 dnl # Don't change the variable name here. Autoconf goes bonkers
1301 AC_CONFIG_SUBDIRS($mysubdirs)
1304 dnl #############################################################
1306 dnl # Add -Werror last, so it doesn't interfere with autoconf's
1307 dnl # test programs.
1309 dnl #############################################################
1311 if test "x$werror" == "xyes"; then
1312 CFLAGS="-Werror $CFLAGS"
1315 dnl #############################################################
1317 dnl # And finally, output the results.
1319 dnl #############################################################
1321 AC_CONFIG_COMMANDS([stamp-h], [echo timestamp > src/include/stamp-h])
1322 AC_CONFIG_COMMANDS([build-radpaths-h], [(cd ./src/include && /bin/sh ./build-radpaths-h)])
1323 AC_CONFIG_COMMANDS([main-chmod], [(cd ./src/main && chmod +x checkrad radlast radtest)])
1324 AC_CONFIG_COMMANDS([scripts-chmod], [(cd ./scripts && chmod +x rc.radiusd radiusd.cron.daily radiusd.cron.monthly cryptpasswd)])
1327 dnl # Substitute whatever libraries we found to be necessary
1330 AC_SUBST(INSTALLSTRIP)
1332 USE_SHARED_LIBS=$enable_shared
1333 AC_SUBST(USE_SHARED_LIBS)
1334 USE_STATIC_LIBS=$enable_static
1335 AC_SUBST(USE_STATIC_LIBS)
1336 AC_SUBST(STATIC_MODULES)
1340 ./src/include/build-radpaths-h \
1341 ./src/main/radsniff.mk \
1342 ./src/main/checkrad \
1343 ./src/main/radlast \
1344 ./src/main/radtest \
1345 ./scripts/rc.radiusd \
1346 ./scripts/radiusd.cron.daily \
1347 ./scripts/radiusd.cron.monthly \
1348 ./scripts/cryptpasswd \
1349 ./raddb/dictionary \
1350 ./raddb/radrelay.conf \
1351 ./raddb/radiusd.conf