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 extra argument: --with-docdir
190 docdir='${datadir}/doc/freeradius'
191 AC_MSG_CHECKING(docdir)
193 [ --with-docdir=DIR Directory for documentation [DATADIR/doc/freeradius] ],
200 [[\\/$]]* | ?:[[\\/]]* )
204 AC_MSG_ERROR([expected an absolute directory name for --with-docdir: $withval])
209 AC_MSG_RESULT($docdir)
210 if test "x$docdir" = xno; then
211 AC_MSG_WARN(Documentation files will NOT be installed.)
214 dnl extra argument: --with-logdir
215 logdir='${localstatedir}/log/radius'
216 AC_MSG_CHECKING(logdir)
218 [ --with-logdir=DIR Directory for logfiles [LOCALSTATEDIR/log/radius] ],
221 AC_MSG_ERROR(Need logdir)
225 [[\\/$]]* | ?:[[\\/]]* )
229 AC_MSG_ERROR([expected an absolute directory name for --with-logdir: $withval])
234 AC_MSG_RESULT($logdir)
236 dnl extra argument: --with-radacctdir
237 radacctdir='${logdir}/radacct'
238 AC_MSG_CHECKING(radacctdir)
239 AC_ARG_WITH(radacctdir,
240 [ --with-radacctdir=DIR Directory for detail files [LOGDIR/radacct] ],
243 AC_MSG_ERROR(Need radacctdir)
247 [[\\/$]]* | ?:[[\\/]]* )
248 radacctdir="$withval"
251 AC_MSG_ERROR([expected an absolute directory name for --with-radacctdir: $withval])
256 AC_MSG_RESULT($radacctdir)
258 dnl extra argument: --with-raddbdir
259 raddbdir='${sysconfdir}/raddb'
260 AC_MSG_CHECKING(raddbdir)
261 AC_ARG_WITH(raddbdir,
262 [ --with-raddbdir=DIR Directory for config files [SYSCONFDIR/raddb] ],
265 AC_MSG_ERROR(Need raddbdir)
269 [[\\/$]]* | ?:[[\\/]]* )
273 AC_MSG_ERROR([expected an absolute directory name for --with-raddbdir: $withval])
278 AC_MSG_RESULT($raddbdir)
280 dnl extra argument: --with-ascend-binary
281 WITH_ASCEND_BINARY=yes
282 AC_ARG_WITH(ascend-binary,
283 [ --with-ascend-binary Include support for Ascend binary filter attributes (default=yes)],
288 WITH_ASCEND_BINARY=no
291 if test "x$WITH_ASCEND_BINARY" = "xyes"; then
292 AC_DEFINE(WITH_ASCEND_BINARY, [1], [Include support for Ascend binary filter attributes])
295 dnl extra argument: --with-threads
298 [ --with-threads Use threads, if available. (default=yes) ],
307 dnl extra argument: --with-tcp
310 [ --with-tcp Compile in TCP support. (default=yes)],
318 if test "x$WITH_TCP" = "xyes"; then
319 AC_DEFINE(WITH_TCP, [1], [define if you want TCP support (For RADSec et al)])
322 dnl extra argument: --with-vmps
325 [ --with-vmps Compile in VMPS support. (default=yes)],
333 if test "x$WITH_VMPS" = "xyes"; then
334 AC_DEFINE(WITH_VMPS, [1], [define if you want VMPS support])
337 dnl extra argument: --with-dhcp
340 [ --with-dhcp Compile in DHCP support. (default=yes)],
348 if test "x$WITH_DHCP" = "xyes"; then
349 AC_DEFINE(WITH_DHCP, [1], [define if you want DHCP support])
353 dnl # Allow the user to specify a list of modules to be linked
354 dnl # statically to the server.
357 AC_ARG_WITH(static_modules,
358 [ --with-static-modules=QUOTED-MODULE-LIST],[
359 for i in $withval; do
360 STATIC_MODULES="$STATIC_MODULES -dlpreopen ../modules/rlm_$i/rlm_$i.la"
366 [ --with-modules=QUOTED-MODULE-LIST],[
367 for i in $withval; do
368 MODULES="$MODULES $i"
372 dnl extra argument: --with-experimental-modules
374 AC_ARG_WITH(experimental-modules,
375 [ --with-experimental-modules Use experimental and unstable modules. (default=no, unless --enable-developer=yes) ],
387 dnl extra argument: --with-openssl
390 [ --with-openssl Use OpenSSL. (default=yes)],
402 dnl # extra argument: --with-openssl-includes=dir
405 AC_ARG_WITH(openssl-includes,
406 [ --with-openssl-includes=DIR Directory to look for OpenSSL include files],
408 *) OPENSSL_INCLUDE_DIR="$withval"
414 dnl # extra argument: --with-openssl-libraries=dir
417 AC_ARG_WITH(openssl-libraries,
418 [ --with-openssl-libraries=DIR Directory to look for OpenSSL library files],
420 *) OPENSSL_LIB_DIR="$withval"
426 dnl # These next two arguments don't actually do anything. They're
427 dnl # place holders so that the top-level configure script can tell
428 dnl # the user how to configure lower-level modules
432 dnl # extra argument: --with-rlm-FOO-lib-dir
434 AC_ARG_WITH(rlm-FOO-lib-dir,
435 [ --with-rlm-FOO-lib-dir=DIR Directory to look for library files used by module FOO],
443 dnl # extra argument: --with-rlm-FOO-include-dir
445 AC_ARG_WITH(rlm-FOO-include-dir,
446 [ --with-rlm-FOO-include-dir=DIR Directory to look for include files used by module FOO],
453 dnl See what include-style is used by the make program.
454 dnl AC_MSG_CHECKING(include style for make)
455 dnl echo "include /dev/null" > testmake.$$
456 dnl echo "all:" >> testmake.$$
457 dnl make -f testmake.$$ >/dev/null 2>&1
466 dnl rm -f testmake.$$
467 dnl AC_MSG_RESULT(" $INCLUDE")
468 dnl AC_SUBST(INCLUDE)
471 dnl extra argument: --with-udpfromto
473 AC_ARG_WITH(udpfromto,
474 [ --with-udpfromto Compile in UDPFROMTO support. (default=no)],
484 if test "x$WITH_UDPFROMTO" = "xyes"; then
485 AC_DEFINE(WITH_UDPFROMTO, [], [define if you want udpfromto])
488 dnl #############################################################
490 dnl # 1. Checks for programs
492 dnl #############################################################
495 AC_PATH_PROG(PERL, perl, /usr/local/bin/perl)
496 if test "x$ac_cv_path_PERL" = "x"; then
497 AC_MSG_WARN(perl not found - Simultaneous-Use and checkrad may not work)
499 AC_PATH_PROG(SNMPGET, snmpget)
500 if test "x$ac_cv_path_SNMPGET" = "x"; then
501 AC_MSG_WARN(snmpget not found - Simultaneous-Use and checkrad may not work)
504 AC_PATH_PROG(SNMPWALK, snmpwalk)
505 if test "x$ac_cv_path_SNMPWALK" = "x"; then
506 AC_MSG_WARN(snmpwalk not found - Simultaneous-Use and checkrad may not work)
509 AC_PATH_PROG(RUSERS, rusers, /usr/bin/rusers)
511 dnl FIXME This is truly gross.
512 missing_dir=`cd $ac_aux_dir && pwd`
513 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
514 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
515 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
517 AC_PATH_PROG(LOCATE,locate)
518 AC_PATH_PROG(DIRNAME,dirname)
519 AC_PATH_PROG(GREP,grep)
521 dnl #############################################################
523 dnl # 2. Checks for libraries
525 dnl #############################################################
527 dnl If using pthreads, check for -lpthread (posix) or -lc_r (*BSD)
529 if test "x$WITH_THREADS" = "xyes"; then
530 if test $ac_cv_prog_suncc = "yes"; then
534 AC_CHECK_HEADERS(pthread.h, [], [ WITH_THREADS="no" ])
537 dnl # pthread stuff is usually in -lpthread
538 dnl # or in -lc_r, on *BSD
540 dnl # On Some systems, we need extra pre-processor flags, to get them to
541 dnl # to do the threading properly.
543 AC_CHECK_LIB(pthread, pthread_create,
544 [ CFLAGS="$CFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS"
545 LIBS="-lpthread $LIBS" ],
546 [ AC_CHECK_LIB(c_r, pthread_create,
547 [ CFLAGS="$CFLAGS -pthread -D_THREAD_SAFE" ],
548 [ WITH_THREADS="no" ]
554 dnl # If we have NO pthread libraries, remove any knowledge of threads.
556 if test "x$WITH_THREADS" != "xyes"; then
558 ac_cv_header_pthread_h="no"
562 dnl # We need sem_init() and friends, as they're the friendliest
563 dnl # semaphore functions for threading.
565 dnl # HP/UX requires linking with librt, too, to get the sem_* symbols.
566 dnl # Some systems have them in -lsem
567 dnl # Solaris has them in -lposix4
568 dnl # NetBSD has them in -lsemaphore
570 AC_SEARCH_LIBS(sem_init, pthread sem posix4 rt semaphore,
572 [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)]
576 if test "x$WITH_THREADS" = "xyes"; then
577 AC_DEFINE(WITH_THREADS, [1], [define if you want thread support])
580 dnl Check if we need -lsocket
581 AC_CHECK_LIB(dl, dlopen)
583 dnl Check if we need -lsocket
584 AC_CHECK_LIB(socket, getsockname)
586 dnl Check for -lresolv
587 dnl This library may be needed later.
588 AC_CHECK_LIB(resolv, inet_aton)
590 dnl Check if we need -lnsl. Usually if we want to
591 dnl link against -lsocket we need to include -lnsl as well.
592 AC_CHECK_LIB(nsl, inet_ntoa)
594 dnl Check for OpenSSL libraries.
596 if test "x$WITH_OPENSSL" = xyes; then
598 old_LDFLAGS="$LDFLAGS"
599 if test "x$OPENSSL_LIB_DIR" != "x"; then
600 LDFLAGS="$LDFLAGS -L$OPENSSL_LIB_DIR"
602 AC_CHECK_LIB(crypto, DH_new,
604 LIBS="-lcrypto $LIBS"
605 AC_DEFINE(HAVE_LIBCRYPTO, 1,
606 [Define to 1 if you have the `crypto' library (-lcrypto).])
607 AC_CHECK_LIB(ssl, SSL_new,
609 AC_DEFINE(HAVE_LIBSSL, 1,
610 [Define to 1 if you have the `ssl' library (-lssl).])
611 if test "x$OPENSSL_LIB_DIR" != "x"; then
612 OPENSSL_LIBS="-L$OPENSSL_LIB_DIR"
614 OPENSSL_LIBS="$OPENSSL_LIBS -lcrypto -lssl -lcrypto"
618 LDFLAGS="$old_LDFLAGS"
621 AC_CHECK_LIB(ws2_32, htonl)
623 dnl Check the pcap library for the RADIUS sniffer.
625 AC_CHECK_LIB(pcap, pcap_open_live,
627 AC_DEFINE(HAVE_LIBPCAP, 1,
628 [Define to 1 if you have the `pcap' library (-lpcap).])
630 [ AC_MSG_WARN([pcap library not found, silently disabling the RADIUS sniffer.]) ])
634 dnl #############################################################
636 dnl # 3. Checks for header files
638 dnl #############################################################
641 dnl # Interix requires us to set -D_ALL_SOURCE, otherwise
642 dnl # getopt will be #included, but won't link. <sigh>
647 CFLAGS="$CFLAGS -D_ALL_SOURCE"
650 CFLAGS="$CFLAGS -DDARWIN"
651 LIBS="-framework DirectoryService $LIBS"
701 dnl FreeBSD requires sys/socket.h before net/if.h
702 AC_CHECK_HEADERS(net/if.h, [], [],
703 [#ifdef HAVE_SYS_SOCKET_H
704 # include <sys/socket.h>
709 AC_CHECK_HEADER(pcreposix.h, AC_DEFINE(HAVE_PCREPOSIX_H, [], [define this if we have the <pcreposix.h> header file]))
710 if test "x$ac_cv_header_pcreposix_h" = "xyes"; then
711 AC_DEFINE(HAVE_REGEX_H, [], [define if we have any regex])
715 LIBS="$LIBS -lpcreposix"
718 AC_CHECK_HEADER(regex.h, AC_DEFINE(HAVE_REGEX_H, [], [define this if we have the <regex.h> header file]))
719 if test "x$ac_cv_header_regex_h" = "xyes"; then
728 ], [AC_DEFINE(HAVE_REG_EXTENDED, [], [define this if we have REG_EXTENDED (from <regex.h>)]) REGEX_EXTENDED=yes])
734 AC_SUBST(REGEX_EXTENDED)
737 dnl # other checks which require headers
739 if test "x$ac_cv_header_sys_security_h" = "xyes" && test "x$ac_cv_header_prot_h" = "xyes"
741 AC_DEFINE(OSFC2, [], [define if you have OSFC2 authentication])
744 if test "x$ac_cv_header_sia_h" = "xyes" && test "x$ac_cv_header_siad_h" = "xyes"
746 AC_DEFINE(OSFSIA, [], [define if you have OSFSIA authentication])
749 dnl Check for OpenSSL includes.
750 OPENSSL_INCLUDE="-DNO_OPENSSL"
751 if test "x$WITH_OPENSSL" = xyes; then
752 if test "x$OPENSSL_LIBS" = "x"; then
753 AC_MSG_NOTICE([skipping test for openssl/ssl.h])
755 old_CPPFLAGS=$CPPFLAGS
756 if test "x$OPENSSL_INCLUDE_DIR" != "x"; then
757 CPPFLAGS="$CPPFLAGS -I$OPENSSL_INCLUDE_DIR"
759 dnl # stupid RedHat shit
760 CPPFLAGS="$CPPFLAGS -DOPENSSL_NO_KRB5"
774 if test "x$OPENSSL_LIBS" != "x"; then
775 AC_MSG_CHECKING([for OpenSSL version >= 0.9.7])
777 [#include <openssl/crypto.h>
778 #if (OPENSSL_VERSION_NUMBER >= 0x00907000L)
782 if test "x$goodssl" != "xyes"; then
787 if test "x$OPENSSL_INCLUDE_DIR" != "x"; then
788 OPENSSL_INCLUDE="-I$OPENSSL_INCLUDE_DIR -DOPENSSL_NO_KRB5"
790 OPENSSL_INCLUDE="-DOPENSSL_NO_KRB5"
794 CPPFLAGS=$old_CPPFLAGS
797 AC_SUBST(OPENSSL_INCLUDE)
798 AC_SUBST(OPENSSL_LIBS)
801 dnl Check the pcap includes for the RADIUS sniffer.
802 if test "x$PCAP_LIBS" = x; then
803 AC_MSG_NOTICE([skipping test for pcap.h.])
805 AC_CHECK_HEADER(pcap.h,
806 AC_DEFINE(HAVE_PCAP_H, 1,
807 [Define to 1 if you have the <pcap.h> header file.]),
809 AC_MSG_WARN([pcap.h not found, silently disabling the RADIUS sniffer.])
812 AC_CHECK_LIB(pcap, pcap_fopen_offline,
813 [ AC_DEFINE(HAVE_PCAP_FOPEN_OFFLINE, 1,
814 [Define to 1 if you have the function pcap_fopen_offline.])
816 AC_CHECK_LIB(pcap, pcap_dump_fopen,
817 [ AC_DEFINE(HAVE_PCAP_DUMP_FOPEN, 1,
818 [Define to 1 if you have the function pcap_dump_fopen.])
823 dnl #############################################################
825 dnl # 4. Checks for typedefs
827 dnl #############################################################
830 dnl # Ensure that these are defined
837 dnl check for socklen_t
838 FR_CHECK_TYPE_INCLUDE([
839 #ifdef HAVE_SYS_TYPES_H
840 #include <sys/types.h>
842 #ifdef HAVE_SYS_SOCKET_H
843 #include <sys/socket.h>
845 ],socklen_t, int, [socklen_t is generally 'int' on systems which don't use it])
847 dnl check for uint8_t
848 FR_CHECK_TYPE_INCLUDE([
849 #ifdef HAVE_INTTYPES_H
850 #include <inttypes.h>
855 ],uint8_t, unsigned char, [uint8_t should be the canonical 'octet' for network traffic])
857 dnl check for uint16_t
858 FR_CHECK_TYPE_INCLUDE([
859 #ifdef HAVE_INTTYPES_H
860 #include <inttypes.h>
865 ],uint16_t, unsigned short, [uint16_t should be the canonical '2 octets' for network traffic])
867 dnl check for uint32_t
868 FR_CHECK_TYPE_INCLUDE([
869 #ifdef HAVE_INTTYPES_H
870 #include <inttypes.h>
875 ],uint32_t, unsigned int, [uint32_t should be the canonical 'network integer])
877 AC_CHECK_TYPE(struct in6_addr, AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1, [IPv6 address structure]), [], [
878 #ifdef HAVE_NETINET_IN_H
879 #include <netinet/in.h>
883 AC_CHECK_TYPE(struct sockaddr_storage, AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1, [Generic socket addresses]), [], [
884 #ifdef HAVE_NETINET_IN_H
885 #include <netinet/in.h>
887 #ifdef HAVE_SYS_SOCKET_H
888 #include <sys/socket.h>
892 AC_CHECK_TYPE(struct sockaddr_in6, AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1, [IPv6 socket addresses]), [], [
893 #ifdef HAVE_NETINET_IN_H
894 #include <netinet/in.h>
898 AC_CHECK_TYPE(struct addrinfo, AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1, [Generic DNS lookups]), [], [
899 #ifdef HAVE_SYS_TYPES_H
900 #include <sys/types.h>
902 #ifdef HAVE_SYS_SOCKET_H
903 #include <sys/socket.h>
910 dnl #############################################################
912 dnl # 5. Checks for structures and functions
914 dnl #############################################################
949 RADIUSD_NEED_DECLARATIONS( \
961 dnl # check if we have utmpx.h
962 dnl # if so, check if struct utmpx has entry ut_xtime
963 dnl # if not, set it to define ut_xtime == ut_tv.tv_sec
964 if test "x$ac_cv_header_utmpx_h" = "xyes"
966 FR_CHECK_STRUCT_HAS_MEMBER([#include <utmpx.h>], [struct utmpx], ut_xtime)
967 if test "x$ac_cv_type_struct_utmpx_has_ut_xtime" = "x"
969 AC_DEFINE(ut_xtime,ut_tv.tv_sec, [define to something if you don't have ut_xtime in struct utmpx])
973 dnl # struct ip_pktinfo
974 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in_pktinfo], ipi_addr)
975 if test "x$ac_cv_type_struct_in_pktinfo_has_ipi_addr" = "xyes"
977 AC_DEFINE(HAVE_IP_PKTINFO, [], [define if you have IP_PKTINFO (Linux)])
980 dnl # struct in6_pktinfo
981 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in6_pktinfo], ipi6_addr)
982 if test "x$ac_cv_type_struct_in6_pktinfo_has_ipi6_addr" = "xyes"
984 AC_DEFINE(HAVE_IN6_PKTINFO, [], [define if you have IN6_PKTINFO (Linux)])
987 dnl #############################################################
989 dnl # 6. Checks for compiler characteristics
991 dnl #############################################################
994 dnl # Ensure that these are defined
999 dnl # See if this is OS/2
1001 AC_MSG_CHECKING(type of OS)
1004 if test "$OS" = "OS/2"; then
1011 AC_MSG_CHECKING(for developer gcc flags)
1014 if test "x$developer" = "xyes"; then
1015 if test "x$GCC" = "xyes"; then
1016 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"
1017 CFLAGS="$CFLAGS $devflags"
1019 AC_MSG_RESULT(yes. Using $devflags)
1022 if test "x$EXPERIMENTAL" != "xno"; then
1027 CFLAGS="$CFLAGS -DNDEBUG"
1032 dnl append the current git hash onto the version string
1033 if test -d $srcdir/.git -a "x$GIT" = "xyes"; then
1034 RADIUSD_VERSION_COMMIT=`git log --pretty=format:'%h' -n 1`
1035 AC_DEFINE_UNQUOTED([RADIUSD_VERSION_COMMIT],["${RADIUSD_VERSION_COMMIT}"],[Commit HEAD at time of configuring])
1040 dnl #############################################################
1042 dnl # 7. Checks for library functions
1044 dnl #############################################################
1047 LIBS="$LIBS $LIBLTDL"
1048 AC_CHECK_FUNC(lt_dladvise_init, AC_DEFINE(HAVE_LT_DLADVISE_INIT, [], [Do we have the lt_dladvise_init function]))
1051 dnl Check for talloc
1052 dnl extra argument: --with-talloc-include-dir=DIR
1054 AC_ARG_WITH(talloc-include-dir,
1055 [AS_HELP_STRING([--with-talloc-include-dir=DIR],
1056 [Directory where the talloc includes may be found])],
1059 AC_MSG_ERROR(Need talloc-include-dir)
1064 talloc_include_dir="$withval"
1068 dnl Check for talloc header files
1070 smart_try_dir="$talloc_include_dir"
1071 FR_SMART_CHECK_INCLUDE([talloc.h])
1072 if test "x$ac_cv_header_talloc_h" != "xyes"; then
1073 AC_MSG_WARN([talloc headers not found. Use --with-talloc-include-dir=<path>.])
1074 AC_MSG_ERROR([FreeRADIUS requires libtalloc])
1076 INCLUDE="${SMART_CFLAGS} ${INCLUDE}"
1077 LIBS="-ltalloc ${LIBS}"
1080 dnl Check for libcrypt
1081 dnl We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
1082 AC_CHECK_LIB(crypt, crypt,
1085 if test "$CRYPTLIB" != ""; then
1086 AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function])
1088 AC_CHECK_FUNC(crypt, AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function]))
1091 dnl Check for libcipher
1092 AC_CHECK_LIB(cipher, setkey,
1093 CRYPTLIB="${CRYPTLIB} -lcipher"
1097 dnl Check the style of gethostbyaddr, in order of preference
1098 dnl GNU (_r eight args)
1099 AC_DEFINE(GNUSTYLE, [1], [GNU-Style get*byaddr_r])
1100 dnl SYSV (_r six args)
1101 AC_DEFINE(SYSVSTYLE, [2], [SYSV-Style get*byaddr_r])
1102 dnl BSD (three args, may not be thread safe)
1103 AC_DEFINE(BSDSTYLE, [3], [BSD-Style get*byaddr_r])
1104 dnl Tru64 has BSD version, but it is thread safe
1105 dnl http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1739____.HTM
1106 dnl We need #stdio.h to define NULL on FreeBSD (at least)
1107 gethostbyaddrrstyle=""
1108 AC_MSG_CHECKING([gethostbyaddr_r() syntax])
1111 dnl With FreeBSD, check if there's a prototype for gethostbyaddr_r.
1112 dnl Some versions (FreeBSD 5.1?) have a symbol but no prototype - so we
1113 dnl override this test to BSDSTYLE. FreeBSD 6.2 and up have proper GNU
1115 AC_CHECK_DECLS([gethostbyaddr_r], [], [
1116 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE,
1117 [style of gethostbyaddr_r functions ])
1118 gethostbyaddrrstyle=BSD
1119 AC_MSG_WARN([FreeBSD overridden to BSD-style])
1127 if test "x$gethostbyaddrrstyle" = "x"; then
1131 ], [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL, NULL) ], [
1132 AC_DEFINE(GETHOSTBYADDRRSTYLE, GNUSTYLE, [style of gethostbyaddr_r functions ])
1133 gethostbyaddrrstyle=GNU
1136 if test "x$gethostbyaddrrstyle" = "x"; then
1140 ], [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL) ] , [
1141 AC_DEFINE(GETHOSTBYADDRRSTYLE, SYSVSTYLE, [style of gethostbyaddr_r functions ])
1142 gethostbyaddrrstyle=SYSV
1145 if test "x$gethostbyaddrrstyle" = "x"; then
1149 ], [ gethostbyaddr(NULL, 0, 0) ], [
1150 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE, [style of gethostbyaddr_r functions ])
1151 gethostbyaddrrstyle=BSD
1155 if test "x$gethostbyaddrrstyle" = "x"; then
1156 AC_MSG_RESULT([none! It must not exist, here.])
1158 AC_MSG_RESULT([${gethostbyaddrrstyle}-style])
1161 if test "x$gethostbyaddrrstyle" = "xBSD"; then
1162 AC_MSG_WARN([ ****** BSD-style gethostbyaddr might NOT be thread-safe! ****** ])
1165 dnl Check the style of gethostbyname, in order of preference
1166 dnl GNU (_r seven args)
1167 dnl SYSV (_r five args)
1168 dnl BSD (two args, may not be thread safe)
1169 dnl Tru64 has BSD version, but it _is_ thread safe
1170 dnl http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1946____.HTM
1171 dnl We need #stdio.h to define NULL on FreeBSD (at least)
1172 gethostbynamerstyle=""
1173 AC_MSG_CHECKING([gethostbyname_r() syntax])
1177 ], [ gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL) ], [
1178 AC_DEFINE(GETHOSTBYNAMERSTYLE, GNUSTYLE, [style of gethostbyname_r functions ])
1179 gethostbynamerstyle=GNU
1181 if test "x$gethostbynamerstyle" = "x"; then
1185 ], [ gethostbyname_r(NULL, NULL, NULL, 0, NULL) ] , [
1186 AC_DEFINE(GETHOSTBYNAMERSTYLE, SYSVSTYLE, [style of gethostbyname_r functions ])
1187 gethostbynamerstyle=SYSV
1190 if test "x$gethostbynamerstyle" = "x"; then
1194 ], [ gethostbyname(NULL) ], [
1195 AC_DEFINE(GETHOSTBYNAMERSTYLE, BSDSTYLE, [style of gethostbyname_r functions ])
1196 gethostbynamerstyle=BSD
1200 if test "x$gethostbynamerstyle" = "x"; then
1201 AC_MSG_RESULT([none! It must not exist, here.])
1203 AC_MSG_RESULT([${gethostbynamerstyle}-style])
1206 if test "x$gethostbynamerstyle" = "xBSD"; then
1207 AC_MSG_WARN([ ****** BSD-style gethostbyname might NOT be thread-safe! ****** ])
1210 dnl check for non-posix solaris ctime_r (extra buflen int arg)
1211 AC_DEFINE(POSIXSTYLE, [1], [Posix-Style ctime_r])
1212 AC_DEFINE(SOLARISSTYLE, [2], [Solaris-Style ctime_r])
1214 AC_MSG_CHECKING([ctime_r() syntax])
1217 ], [ ctime_r(NULL, NULL, 0) ], [
1218 AC_DEFINE(CTIMERSTYLE, SOLARISSTYLE, [style of ctime_r function])
1219 ctimerstyle="SOLARIS"
1221 if test "x$ctimerstyle" = "x"; then
1224 ], [ ctime_r(NULL, NULL) ], [
1225 AC_DEFINE(CTIMERSTYLE, POSIXSTYLE, [style of ctime_r function])
1230 if test "x$ctimerstyle" = "x"; then
1231 AC_MSG_RESULT([none! It must not exist, here.])
1233 AC_MSG_RESULT([${ctimerstyle}-style])
1236 AC_SUBST(HOSTINFO, $host)
1238 dnl #############################################################
1240 dnl # 8. Checks for system services
1242 dnl #############################################################
1245 dnl # Figure out where libtool is located,
1249 AC_MSG_RESULT([top_builddir=$top_builddir])
1250 dnl # AC_SUBST(top_builddir)
1254 dnl import libtool stuff
1256 dnl #############################################################
1258 dnl # Configure in any module directories.
1260 dnl #############################################################
1262 dnl ############################################################
1263 dnl # Remove any conflicting definitions if autoconf.h
1264 dnl # is being included by a module.
1265 dnl #############################################################
1266 AH_BOTTOM([#include <freeradius-devel/automask.h>])
1268 dnl ############################################################
1269 dnl # make modules by list
1270 dnl #############################################################
1271 if test "x$EXPERIMENTAL" = "xyes"; then
1272 for foo in `ls -1 "${srcdir}"/src/modules | grep rlm_`; do
1273 MODULES="$MODULES $foo"
1277 dnl # make ONLY the stable modules
1279 for foo in `cat "${srcdir}"/src/modules/stable`; do
1280 MODULES="$MODULES $foo"
1284 dnl ############################################################
1285 dnl # Add autoconf subdirs, based on the module list we
1286 dnl # previously created.
1287 dnl #############################################################
1289 for bar in $MODULES; do
1290 if test -f "${srcdir}"/src/modules/$bar/configure; then
1291 mysubdirs="$mysubdirs src/modules/$bar"
1296 dnl # Don't change the variable name here. Autoconf goes bonkers
1299 AC_CONFIG_SUBDIRS($mysubdirs)
1302 dnl #############################################################
1304 dnl # And finally, output the results.
1306 dnl #############################################################
1308 AC_CONFIG_COMMANDS([stamp-h], [echo timestamp > src/include/stamp-h])
1309 AC_CONFIG_COMMANDS([build-radpaths-h], [(cd ./src/include && /bin/sh ./build-radpaths-h)])
1310 AC_CONFIG_COMMANDS([main-chmod], [(cd ./src/main && chmod +x checkrad radlast radtest)])
1311 AC_CONFIG_COMMANDS([scripts-chmod], [(cd ./scripts && chmod +x rc.radiusd radiusd.cron.daily radiusd.cron.monthly cryptpasswd)])
1314 dnl # Substitute whatever libraries we found to be necessary
1317 AC_SUBST(INSTALLSTRIP)
1319 USE_SHARED_LIBS=$enable_shared
1320 AC_SUBST(USE_SHARED_LIBS)
1321 USE_STATIC_LIBS=$enable_static
1322 AC_SUBST(USE_STATIC_LIBS)
1323 AC_SUBST(STATIC_MODULES)
1327 ./src/include/build-radpaths-h \
1328 ./src/main/radsniff.mk \
1329 ./src/main/checkrad \
1330 ./src/main/radlast \
1331 ./src/main/radtest \
1332 ./scripts/rc.radiusd \
1333 ./scripts/radiusd.cron.daily \
1334 ./scripts/radiusd.cron.monthly \
1335 ./scripts/cryptpasswd \
1336 ./raddb/dictionary \
1337 ./raddb/radrelay.conf \
1338 ./raddb/radiusd.conf