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 m4_define(PACKAGE_MAIN, freeradius)
28 AC_INIT(PACKAGE_MAIN,[$]Id[$],http://bugs.freeradius.org,,http://www.freeradius.org)
29 AC_CONFIG_SRCDIR(src/main/radiusd.c)
30 AC_CONFIG_HEADER(src/include/autoconf.h)
32 dnl #############################################################
34 dnl # Custom hackery to discover version at configure time
36 dnl #############################################################
38 RADIUSD_MAJOR_VERSION=`cat VERSION | sed 's/\..*//'`
39 RADIUSD_MINOR_VERSION=`cat VERSION | sed 's/^[[^\.]]*\.//' | sed 's/\..*$//'`
40 RADIUSD_INCRM_VERSION=`cat VERSION | sed 's/^.*\..*\.//' | sed 's/[[\.-]].*$//'`
42 RADIUSD_VERSION=`echo | awk -v major="$RADIUSD_MAJOR_VERSION" \
43 -v minor="$RADIUSD_MINOR_VERSION" \
44 -v incrm="$RADIUSD_INCRM_VERSION" \
45 '{ printf "%02i%02i%02i", major, minor, incrm }'`
47 dnl # Still useful for custom builds
48 RADIUSD_VERSION_STRING=`cat VERSION`
51 dnl #############################################################
53 dnl # Override some of the default autoconf variables such as
54 dnl # CFLAGS if were building in developer mode
56 dnl #############################################################
59 dnl # Enable developer features like debugging symbols.
60 dnl # These checks must be done before expanding the AC_PROG_CC
61 dnl # and AC_PROG_CXX macros.
63 AC_ARG_ENABLE(developer,
64 [ --enable-developer enables features of interest to developers.],
65 [ case "$enableval" in
74 if test -d $srcdir/.git; then
75 if test "x$developer" != "xno"; then
76 dnl turn on the developer flag when taken from a git checkout (not a release)
82 dnl # Autoconf sets -O2 and -g by default, but this is a PITA for debugging
83 dnl # so we remove the defaults if were building in developer mode, and set
84 dnl # -g3 so nice things like macro values are included. Other arguments are
85 dnl # added later when we know what compiler were using.
87 if test "x$developer" = "xyes"; then
91 dnl #############################################################
93 dnl # 0. Checks for compiler, libtool, and command line options.
95 dnl #############################################################
102 dnl # check for AIX, to allow us to use some BSD functions
103 dnl # must be before macros that call the compiler.
107 AC_PROG_GCC_TRADITIONAL
112 dnl # Set Default CFLAGS
114 if test "x$GCC" = "xyes"; then
115 CFLAGS="$CFLAGS -Wall -D_GNU_SOURCE"
118 dnl Compile in large (2G+) file support.
121 dnl # check for system bytesex
122 dnl # AC_DEFINES WORDS_BIGENDIAN
126 AC_CHECK_PROG(GMAKE, gmake, yes, no)
127 if test $GMAKE = no; then
128 AC_PATH_PROG(MAKE, make, /usr/local/bin/make)
130 AC_PATH_PROG(MAKE, gmake, /usr/local/gnu/bin/make)
132 makever=`$ac_cv_path_MAKE --version 2>&1 | grep "GNU Make"`
133 if test -z "$makever"; then
134 AC_MSG_ERROR(GNU Make is not installed. Please download and install it
135 from ftp://prep.ai.mit.edu/pub/gnu/make/ before continuing.)
138 dnl See if we have Git.
139 AC_CHECK_PROG(GIT, git, yes, no)
141 AC_ARG_WITH(system-libltdl,
142 [ --with-system-libltdl Use the libltdl installed in your system (default=use dlopen)],
144 [with_system_libltdl=no])
146 AS_IF([test "x$with_system_libltdl" = "xyes" ],
148 INCLTDL=-DWITH_SYSTEM_LTDL])
150 dnl use system-wide libtool, if it exists
151 AC_ARG_WITH(system-libtool,
152 [ --with-system-libtool Use the libtool installed in your system (default=use our own)],
154 [with_system_libtool=no])
156 AS_IF([test "x$with_system_libtool" = "xyes" ],
157 [ AC_PATH_PROG(LIBTOOL, libtool,,$PATH:/usr/local/bin) AC_LIBTOOL_DLOPEN
160 LIBTOOL='${top_srcdir}/scripts/jlibtool'
162 dnl ensure that we're looking for dlopen
167 dnl Put this in later, when all distributed modules use autoconf.
168 dnl AC_ARG_WITH(disablemodulefoo,
169 dnl [ --without-rlm_foo Disables module compilation. Module list:]
170 dnl esyscmd([find src/modules -type d -name rlm_\* -print |\
171 dnl sed -e 's%src/modules/.*/% (sub)- %; s%.*/%- %' |\
172 dnl awk '{print " "$0}']))
174 AC_ARG_ENABLE(strict-dependencies,
175 [ --enable-strict-dependencies Fail configure on lack of module dependancy.])
177 dnl # Build using the new boilermake system
179 AC_ARG_ENABLE(boilermake,
180 [ --enable-boilermake use the boilermake build system (experimental default=no).],
181 [ case "$enableval" in
192 if test "x$boilermake" == "xyes"; then
196 dnl extra argument: --with-docdir
197 docdir='${datadir}/doc/freeradius'
198 AC_MSG_CHECKING(docdir)
200 [ --with-docdir=DIR Directory for documentation [DATADIR/doc/freeradius] ],
207 [[\\/$]]* | ?:[[\\/]]* )
211 AC_MSG_ERROR([expected an absolute directory name for --with-docdir: $withval])
216 AC_MSG_RESULT($docdir)
217 if test "x$docdir" = xno; then
218 AC_MSG_WARN(Documentation files will NOT be installed.)
221 dnl extra argument: --with-logdir
222 logdir='${localstatedir}/log/radius'
223 AC_MSG_CHECKING(logdir)
225 [ --with-logdir=DIR Directory for logfiles [LOCALSTATEDIR/log/radius] ],
228 AC_MSG_ERROR(Need logdir)
232 [[\\/$]]* | ?:[[\\/]]* )
236 AC_MSG_ERROR([expected an absolute directory name for --with-logdir: $withval])
241 AC_MSG_RESULT($logdir)
243 dnl extra argument: --with-radacctdir
244 radacctdir='${logdir}/radacct'
245 AC_MSG_CHECKING(radacctdir)
246 AC_ARG_WITH(radacctdir,
247 [ --with-radacctdir=DIR Directory for detail files [LOGDIR/radacct] ],
250 AC_MSG_ERROR(Need radacctdir)
254 [[\\/$]]* | ?:[[\\/]]* )
255 radacctdir="$withval"
258 AC_MSG_ERROR([expected an absolute directory name for --with-radacctdir: $withval])
263 AC_MSG_RESULT($radacctdir)
265 dnl extra argument: --with-raddbdir
266 raddbdir='${sysconfdir}/raddb'
267 AC_MSG_CHECKING(raddbdir)
268 AC_ARG_WITH(raddbdir,
269 [ --with-raddbdir=DIR Directory for config files [SYSCONFDIR/raddb] ],
272 AC_MSG_ERROR(Need raddbdir)
276 [[\\/$]]* | ?:[[\\/]]* )
280 AC_MSG_ERROR([expected an absolute directory name for --with-raddbdir: $withval])
285 AC_MSG_RESULT($raddbdir)
287 dnl extra argument: --with-ascend-binary
288 WITH_ASCEND_BINARY=yes
289 AC_ARG_WITH(ascend-binary,
290 [ --with-ascend-binary Include support for Ascend binary filter attributes (default=yes)],
295 WITH_ASCEND_BINARY=no
298 if test "x$WITH_ASCEND_BINARY" = "xyes"; then
299 AC_DEFINE(WITH_ASCEND_BINARY, [1], [Include support for Ascend binary filter attributes])
302 dnl extra argument: --with-threads
305 [ --with-threads Use threads, if available. (default=yes) ],
314 dnl extra argument: --with-tcp
317 [ --with-tcp Compile in TCP support. (default=yes)],
325 if test "x$WITH_TCP" = "xyes"; then
326 AC_DEFINE(WITH_TCP, [1], [define if you want TCP support (For RADSec et al)])
329 dnl extra argument: --with-vmps
332 [ --with-vmps Compile in VMPS support. (default=yes)],
340 if test "x$WITH_VMPS" = "xyes"; then
341 AC_DEFINE(WITH_VMPS, [1], [define if you want VMPS support])
344 dnl extra argument: --with-dhcp
347 [ --with-dhcp Compile in DHCP support. (default=yes)],
355 if test "x$WITH_DHCP" = "xyes"; then
356 AC_DEFINE(WITH_DHCP, [1], [define if you want DHCP support])
360 dnl # Allow the user to specify a list of modules to be linked
361 dnl # statically to the server.
364 AC_ARG_WITH(static_modules,
365 [ --with-static-modules=QUOTED-MODULE-LIST],[
366 for i in $withval; do
367 STATIC_MODULES="$STATIC_MODULES -dlpreopen ../modules/rlm_$i/rlm_$i.la"
373 [ --with-modules=QUOTED-MODULE-LIST],[
374 for i in $withval; do
375 MODULES="$MODULES $i"
379 dnl extra argument: --with-experimental-modules
381 AC_ARG_WITH(experimental-modules,
382 [ --with-experimental-modules Use experimental and unstable modules. (default=no, unless --enable-developer=yes) ],
394 dnl extra argument: --with-openssl
397 [ --with-openssl Use OpenSSL. (default=yes)],
409 dnl # extra argument: --with-openssl-includes=dir
412 AC_ARG_WITH(openssl-includes,
413 [ --with-openssl-includes=DIR Directory to look for OpenSSL include files],
415 *) OPENSSL_INCLUDE_DIR="$withval"
421 dnl # extra argument: --with-openssl-libraries=dir
424 AC_ARG_WITH(openssl-libraries,
425 [ --with-openssl-libraries=DIR Directory to look for OpenSSL library files],
427 *) OPENSSL_LIB_DIR="$withval"
433 dnl # These next two arguments don't actually do anything. They're
434 dnl # place holders so that the top-level configure script can tell
435 dnl # the user how to configure lower-level modules
439 dnl # extra argument: --with-rlm-FOO-lib-dir
441 AC_ARG_WITH(rlm-FOO-lib-dir,
442 [ --with-rlm-FOO-lib-dir=DIR Directory to look for library files used by module FOO],
450 dnl # extra argument: --with-rlm-FOO-include-dir
452 AC_ARG_WITH(rlm-FOO-include-dir,
453 [ --with-rlm-FOO-include-dir=DIR Directory to look for include files used by module FOO],
460 dnl See what include-style is used by the make program.
461 dnl AC_MSG_CHECKING(include style for make)
462 dnl echo "include /dev/null" > testmake.$$
463 dnl echo "all:" >> testmake.$$
464 dnl make -f testmake.$$ >/dev/null 2>&1
473 dnl rm -f testmake.$$
474 dnl AC_MSG_RESULT(" $INCLUDE")
475 dnl AC_SUBST(INCLUDE)
478 dnl extra argument: --with-udpfromto
480 AC_ARG_WITH(udpfromto,
481 [ --with-udpfromto Compile in UDPFROMTO support. (default=no)],
491 if test "x$WITH_UDPFROMTO" = "xyes"; then
492 AC_DEFINE(WITH_UDPFROMTO, [], [define if you want udpfromto])
495 dnl #############################################################
497 dnl # 1. Checks for programs
499 dnl #############################################################
502 AC_PATH_PROG(PERL, perl, /usr/local/bin/perl)
503 if test "x$ac_cv_path_PERL" = "x"; then
504 AC_MSG_WARN(perl not found - Simultaneous-Use and checkrad may not work)
506 AC_PATH_PROG(SNMPGET, snmpget)
507 if test "x$ac_cv_path_SNMPGET" = "x"; then
508 AC_MSG_WARN(snmpget not found - Simultaneous-Use and checkrad may not work)
511 AC_PATH_PROG(SNMPWALK, snmpwalk)
512 if test "x$ac_cv_path_SNMPWALK" = "x"; then
513 AC_MSG_WARN(snmpwalk not found - Simultaneous-Use and checkrad may not work)
516 AC_PATH_PROG(RUSERS, rusers, /usr/bin/rusers)
518 dnl FIXME This is truly gross.
519 missing_dir=`cd $ac_aux_dir && pwd`
520 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
521 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
522 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
524 AC_PATH_PROG(LOCATE,locate)
525 AC_PATH_PROG(DIRNAME,dirname)
526 AC_PATH_PROG(GREP,grep)
528 dnl #############################################################
530 dnl # 2. Checks for libraries
532 dnl #############################################################
534 dnl If using pthreads, check for -lpthread (posix) or -lc_r (*BSD)
536 if test "x$WITH_THREADS" = "xyes"; then
537 if test $ac_cv_prog_suncc = "yes"; then
541 AC_CHECK_HEADERS(pthread.h, [], [ WITH_THREADS="no" ])
544 dnl # pthread stuff is usually in -lpthread
545 dnl # or in -lc_r, on *BSD
547 dnl # On Some systems, we need extra pre-processor flags, to get them to
548 dnl # to do the threading properly.
550 AC_CHECK_LIB(pthread, pthread_create,
551 [ CFLAGS="$CFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS"
552 LIBS="-lpthread $LIBS" ],
553 [ AC_CHECK_LIB(c_r, pthread_create,
554 [ CFLAGS="$CFLAGS -pthread -D_THREAD_SAFE" ],
555 [ WITH_THREADS="no" ]
561 dnl # If we have NO pthread libraries, remove any knowledge of threads.
563 if test "x$WITH_THREADS" != "xyes"; then
565 ac_cv_header_pthread_h="no"
569 dnl # We need sem_init() and friends, as they're the friendliest
570 dnl # semaphore functions for threading.
572 dnl # HP/UX requires linking with librt, too, to get the sem_* symbols.
573 dnl # Some systems have them in -lsem
574 dnl # Solaris has them in -lposix4
575 dnl # NetBSD has them in -lsemaphore
577 AC_SEARCH_LIBS(sem_init, pthread sem posix4 rt semaphore,
579 [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)]
583 if test "x$WITH_THREADS" = "xyes"; then
584 AC_DEFINE(WITH_THREADS, [1], [define if you want thread support])
587 dnl Check if we need -lsocket
588 AC_CHECK_LIB(dl, dlopen)
590 dnl Check if we need -lsocket
591 AC_CHECK_LIB(socket, getsockname)
593 dnl Check for -lresolv
594 dnl This library may be needed later.
595 AC_CHECK_LIB(resolv, inet_aton)
597 dnl Check if we need -lnsl. Usually if we want to
598 dnl link against -lsocket we need to include -lnsl as well.
599 AC_CHECK_LIB(nsl, inet_ntoa)
601 dnl Check for OpenSSL libraries.
603 if test "x$WITH_OPENSSL" = xyes; then
605 old_LDFLAGS="$LDFLAGS"
606 if test "x$OPENSSL_LIB_DIR" != "x"; then
607 LDFLAGS="$LDFLAGS -L$OPENSSL_LIB_DIR"
609 AC_CHECK_LIB(crypto, DH_new,
611 LIBS="-lcrypto $LIBS"
612 AC_DEFINE(HAVE_LIBCRYPTO, 1,
613 [Define to 1 if you have the `crypto' library (-lcrypto).])
614 AC_CHECK_LIB(ssl, SSL_new,
616 AC_DEFINE(HAVE_LIBSSL, 1,
617 [Define to 1 if you have the `ssl' library (-lssl).])
618 if test "x$OPENSSL_LIB_DIR" != "x"; then
619 OPENSSL_LIBS="-L$OPENSSL_LIB_DIR"
621 OPENSSL_LIBS="$OPENSSL_LIBS -lcrypto -lssl -lcrypto"
625 LDFLAGS="$old_LDFLAGS"
628 AC_CHECK_LIB(ws2_32, htonl)
630 dnl Check the pcap library for the RADIUS sniffer.
632 AC_CHECK_LIB(pcap, pcap_open_live,
634 AC_DEFINE(HAVE_LIBPCAP, 1,
635 [Define to 1 if you have the `pcap' library (-lpcap).])
637 [ AC_MSG_WARN([pcap library not found, silently disabling the RADIUS sniffer.]) ])
641 dnl #############################################################
643 dnl # 3. Checks for header files
645 dnl #############################################################
648 dnl # Interix requires us to set -D_ALL_SOURCE, otherwise
649 dnl # getopt will be #included, but won't link. <sigh>
654 CFLAGS="$CFLAGS -D_ALL_SOURCE"
657 CFLAGS="$CFLAGS -DDARWIN"
658 LIBS="-framework DirectoryService $LIBS"
708 dnl FreeBSD requires sys/socket.h before net/if.h
709 AC_CHECK_HEADERS(net/if.h, [], [],
710 [#ifdef HAVE_SYS_SOCKET_H
711 # include <sys/socket.h>
716 AC_CHECK_HEADER(pcreposix.h, AC_DEFINE(HAVE_PCREPOSIX_H, [], [define this if we have the <pcreposix.h> header file]))
717 if test "x$ac_cv_header_pcreposix_h" = "xyes"; then
718 AC_DEFINE(HAVE_REGEX_H, [], [define if we have any regex])
722 LIBS="$LIBS -lpcreposix"
725 AC_CHECK_HEADER(regex.h, AC_DEFINE(HAVE_REGEX_H, [], [define this if we have the <regex.h> header file]))
726 if test "x$ac_cv_header_regex_h" = "xyes"; then
735 ], [AC_DEFINE(HAVE_REG_EXTENDED, [], [define this if we have REG_EXTENDED (from <regex.h>)]) REGEX_EXTENDED=yes])
741 AC_SUBST(REGEX_EXTENDED)
744 dnl # other checks which require headers
746 if test "x$ac_cv_header_sys_security_h" = "xyes" && test "x$ac_cv_header_prot_h" = "xyes"
748 AC_DEFINE(OSFC2, [], [define if you have OSFC2 authentication])
751 if test "x$ac_cv_header_sia_h" = "xyes" && test "x$ac_cv_header_siad_h" = "xyes"
753 AC_DEFINE(OSFSIA, [], [define if you have OSFSIA authentication])
756 dnl Check for OpenSSL includes.
757 OPENSSL_INCLUDE="-DNO_OPENSSL"
758 if test "x$WITH_OPENSSL" = xyes; then
759 if test "x$OPENSSL_LIBS" = "x"; then
760 AC_MSG_NOTICE([skipping test for openssl/ssl.h])
762 old_CPPFLAGS=$CPPFLAGS
763 if test "x$OPENSSL_INCLUDE_DIR" != "x"; then
764 CPPFLAGS="$CPPFLAGS -I$OPENSSL_INCLUDE_DIR"
766 dnl # stupid RedHat shit
767 CPPFLAGS="$CPPFLAGS -DOPENSSL_NO_KRB5"
781 if test "x$OPENSSL_LIBS" != "x"; then
782 AC_MSG_CHECKING([for OpenSSL version >= 0.9.7])
784 [#include <openssl/crypto.h>
785 #if (OPENSSL_VERSION_NUMBER >= 0x00907000L)
789 if test "x$goodssl" != "xyes"; then
794 if test "x$OPENSSL_INCLUDE_DIR" != "x"; then
795 OPENSSL_INCLUDE="-I$OPENSSL_INCLUDE_DIR -DOPENSSL_NO_KRB5"
797 OPENSSL_INCLUDE="-DOPENSSL_NO_KRB5"
801 CPPFLAGS=$old_CPPFLAGS
804 AC_SUBST(OPENSSL_INCLUDE)
805 AC_SUBST(OPENSSL_LIBS)
808 dnl Check the pcap includes for the RADIUS sniffer.
809 if test "x$PCAP_LIBS" = x; then
810 AC_MSG_NOTICE([skipping test for pcap.h.])
812 AC_CHECK_HEADER(pcap.h,
813 AC_DEFINE(HAVE_PCAP_H, 1,
814 [Define to 1 if you have the <pcap.h> header file.]),
816 AC_MSG_WARN([pcap.h not found, silently disabling the RADIUS sniffer.])
819 AC_CHECK_LIB(pcap, pcap_fopen_offline,
820 [ AC_DEFINE(HAVE_PCAP_FOPEN_OFFLINE, 1,
821 [Define to 1 if you have the function pcap_fopen_offline.])
823 AC_CHECK_LIB(pcap, pcap_dump_fopen,
824 [ AC_DEFINE(HAVE_PCAP_DUMP_FOPEN, 1,
825 [Define to 1 if you have the function pcap_dump_fopen.])
830 dnl #############################################################
832 dnl # 4. Checks for typedefs
834 dnl #############################################################
837 dnl # Ensure that these are defined
844 dnl check for socklen_t
845 FR_CHECK_TYPE_INCLUDE([
846 #ifdef HAVE_SYS_TYPES_H
847 #include <sys/types.h>
849 #ifdef HAVE_SYS_SOCKET_H
850 #include <sys/socket.h>
852 ],socklen_t, int, [socklen_t is generally 'int' on systems which don't use it])
854 dnl check for uint8_t
855 FR_CHECK_TYPE_INCLUDE([
856 #ifdef HAVE_INTTYPES_H
857 #include <inttypes.h>
862 ],uint8_t, unsigned char, [uint8_t should be the canonical 'octet' for network traffic])
864 dnl check for uint16_t
865 FR_CHECK_TYPE_INCLUDE([
866 #ifdef HAVE_INTTYPES_H
867 #include <inttypes.h>
872 ],uint16_t, unsigned short, [uint16_t should be the canonical '2 octets' for network traffic])
874 dnl check for uint32_t
875 FR_CHECK_TYPE_INCLUDE([
876 #ifdef HAVE_INTTYPES_H
877 #include <inttypes.h>
882 ],uint32_t, unsigned int, [uint32_t should be the canonical 'network integer])
884 AC_CHECK_TYPE(struct in6_addr, AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1, [IPv6 address structure]), [], [
885 #ifdef HAVE_NETINET_IN_H
886 #include <netinet/in.h>
890 AC_CHECK_TYPE(struct sockaddr_storage, AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1, [Generic socket addresses]), [], [
891 #ifdef HAVE_NETINET_IN_H
892 #include <netinet/in.h>
894 #ifdef HAVE_SYS_SOCKET_H
895 #include <sys/socket.h>
899 AC_CHECK_TYPE(struct sockaddr_in6, AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1, [IPv6 socket addresses]), [], [
900 #ifdef HAVE_NETINET_IN_H
901 #include <netinet/in.h>
905 AC_CHECK_TYPE(struct addrinfo, AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1, [Generic DNS lookups]), [], [
906 #ifdef HAVE_SYS_TYPES_H
907 #include <sys/types.h>
909 #ifdef HAVE_SYS_SOCKET_H
910 #include <sys/socket.h>
917 dnl #############################################################
919 dnl # 5. Checks for structures and functions
921 dnl #############################################################
956 RADIUSD_NEED_DECLARATIONS( \
968 dnl # check if we have utmpx.h
969 dnl # if so, check if struct utmpx has entry ut_xtime
970 dnl # if not, set it to define ut_xtime == ut_tv.tv_sec
971 if test "x$ac_cv_header_utmpx_h" = "xyes"
973 FR_CHECK_STRUCT_HAS_MEMBER([#include <utmpx.h>], [struct utmpx], ut_xtime)
974 if test "x$ac_cv_type_struct_utmpx_has_ut_xtime" = "x"
976 AC_DEFINE(ut_xtime,ut_tv.tv_sec, [define to something if you don't have ut_xtime in struct utmpx])
980 dnl # struct ip_pktinfo
981 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in_pktinfo], ipi_addr)
982 if test "x$ac_cv_type_struct_in_pktinfo_has_ipi_addr" = "xyes"
984 AC_DEFINE(HAVE_IP_PKTINFO, [], [define if you have IP_PKTINFO (Linux)])
987 dnl # struct in6_pktinfo
988 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in6_pktinfo], ipi6_addr)
989 if test "x$ac_cv_type_struct_in6_pktinfo_has_ipi6_addr" = "xyes"
991 AC_DEFINE(HAVE_IN6_PKTINFO, [], [define if you have IN6_PKTINFO (Linux)])
994 dnl #############################################################
996 dnl # 6. Checks for compiler characteristics
998 dnl #############################################################
1001 dnl # Ensure that these are defined
1006 dnl # See if this is OS/2
1008 AC_MSG_CHECKING(type of OS)
1011 if test "$OS" = "OS/2"; then
1018 AC_MSG_CHECKING(for developer gcc flags)
1021 if test "x$developer" = "xyes"; then
1022 if test "x$GCC" = "xyes"; then
1023 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"
1024 CFLAGS="$CFLAGS $devflags"
1026 AC_MSG_RESULT(yes. Using $devflags)
1029 if test "x$EXPERIMENTAL" != "xno"; then
1034 CFLAGS="$CFLAGS -DNDEBUG"
1039 dnl append the current git hash onto the version string
1040 if test -d $srcdir/.git -a "x$GIT" = "xyes"; then
1041 RADIUSD_VERSION_COMMIT=`git log --pretty=format:'%h' -n 1`
1046 dnl #############################################################
1048 dnl # 7. Checks for library functions
1050 dnl #############################################################
1053 LIBS="$LIBS $LIBLTDL"
1054 AC_CHECK_FUNC(lt_dladvise_init, AC_DEFINE(HAVE_LT_DLADVISE_INIT, [], [Do we have the lt_dladvise_init function]))
1057 dnl Check for libcrypt
1058 dnl We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
1059 AC_CHECK_LIB(crypt, crypt,
1062 if test "$CRYPTLIB" != ""; then
1063 AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function])
1065 AC_CHECK_FUNC(crypt, AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function]))
1068 dnl Check for libcipher
1069 AC_CHECK_LIB(cipher, setkey,
1070 CRYPTLIB="${CRYPTLIB} -lcipher"
1074 dnl Check the style of gethostbyaddr, in order of preference
1075 dnl GNU (_r eight args)
1076 AC_DEFINE(GNUSTYLE, [1], [GNU-Style get*byaddr_r])
1077 dnl SYSV (_r six args)
1078 AC_DEFINE(SYSVSTYLE, [2], [SYSV-Style get*byaddr_r])
1079 dnl BSD (three args, may not be thread safe)
1080 AC_DEFINE(BSDSTYLE, [3], [BSD-Style get*byaddr_r])
1081 dnl Tru64 has BSD version, but it is thread safe
1082 dnl http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1739____.HTM
1083 dnl We need #stdio.h to define NULL on FreeBSD (at least)
1084 gethostbyaddrrstyle=""
1085 AC_MSG_CHECKING([gethostbyaddr_r() syntax])
1088 dnl With FreeBSD, check if there's a prototype for gethostbyaddr_r.
1089 dnl Some versions (FreeBSD 5.1?) have a symbol but no prototype - so we
1090 dnl override this test to BSDSTYLE. FreeBSD 6.2 and up have proper GNU
1092 AC_CHECK_DECLS([gethostbyaddr_r], [], [
1093 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE,
1094 [style of gethostbyaddr_r functions ])
1095 gethostbyaddrrstyle=BSD
1096 AC_MSG_WARN([FreeBSD overridden to BSD-style])
1104 if test "x$gethostbyaddrrstyle" = "x"; then
1108 ], [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL, NULL) ], [
1109 AC_DEFINE(GETHOSTBYADDRRSTYLE, GNUSTYLE, [style of gethostbyaddr_r functions ])
1110 gethostbyaddrrstyle=GNU
1113 if test "x$gethostbyaddrrstyle" = "x"; then
1117 ], [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL) ] , [
1118 AC_DEFINE(GETHOSTBYADDRRSTYLE, SYSVSTYLE, [style of gethostbyaddr_r functions ])
1119 gethostbyaddrrstyle=SYSV
1122 if test "x$gethostbyaddrrstyle" = "x"; then
1126 ], [ gethostbyaddr(NULL, 0, 0) ], [
1127 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE, [style of gethostbyaddr_r functions ])
1128 gethostbyaddrrstyle=BSD
1132 if test "x$gethostbyaddrrstyle" = "x"; then
1133 AC_MSG_RESULT([none! It must not exist, here.])
1135 AC_MSG_RESULT([${gethostbyaddrrstyle}-style])
1138 if test "x$gethostbyaddrrstyle" = "xBSD"; then
1139 AC_MSG_WARN([ ****** BSD-style gethostbyaddr might NOT be thread-safe! ****** ])
1142 dnl Check the style of gethostbyname, in order of preference
1143 dnl GNU (_r seven args)
1144 dnl SYSV (_r five args)
1145 dnl BSD (two args, may not be thread safe)
1146 dnl Tru64 has BSD version, but it _is_ thread safe
1147 dnl http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1946____.HTM
1148 dnl We need #stdio.h to define NULL on FreeBSD (at least)
1149 gethostbynamerstyle=""
1150 AC_MSG_CHECKING([gethostbyname_r() syntax])
1154 ], [ gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL) ], [
1155 AC_DEFINE(GETHOSTBYNAMERSTYLE, GNUSTYLE, [style of gethostbyname_r functions ])
1156 gethostbynamerstyle=GNU
1158 if test "x$gethostbynamerstyle" = "x"; then
1162 ], [ gethostbyname_r(NULL, NULL, NULL, 0, NULL) ] , [
1163 AC_DEFINE(GETHOSTBYNAMERSTYLE, SYSVSTYLE, [style of gethostbyname_r functions ])
1164 gethostbynamerstyle=SYSV
1167 if test "x$gethostbynamerstyle" = "x"; then
1171 ], [ gethostbyname(NULL) ], [
1172 AC_DEFINE(GETHOSTBYNAMERSTYLE, BSDSTYLE, [style of gethostbyname_r functions ])
1173 gethostbynamerstyle=BSD
1177 if test "x$gethostbynamerstyle" = "x"; then
1178 AC_MSG_RESULT([none! It must not exist, here.])
1180 AC_MSG_RESULT([${gethostbynamerstyle}-style])
1183 if test "x$gethostbynamerstyle" = "xBSD"; then
1184 AC_MSG_WARN([ ****** BSD-style gethostbyname might NOT be thread-safe! ****** ])
1187 dnl check for non-posix solaris ctime_r (extra buflen int arg)
1188 AC_DEFINE(POSIXSTYLE, [1], [Posix-Style ctime_r])
1189 AC_DEFINE(SOLARISSTYLE, [2], [Solaris-Style ctime_r])
1191 AC_MSG_CHECKING([ctime_r() syntax])
1194 ], [ ctime_r(NULL, NULL, 0) ], [
1195 AC_DEFINE(CTIMERSTYLE, SOLARISSTYLE, [style of ctime_r function])
1196 ctimerstyle="SOLARIS"
1198 if test "x$ctimerstyle" = "x"; then
1201 ], [ ctime_r(NULL, NULL) ], [
1202 AC_DEFINE(CTIMERSTYLE, POSIXSTYLE, [style of ctime_r function])
1207 if test "x$ctimerstyle" = "x"; then
1208 AC_MSG_RESULT([none! It must not exist, here.])
1210 AC_MSG_RESULT([${ctimerstyle}-style])
1213 AC_SUBST(HOSTINFO, $host)
1215 dnl #############################################################
1217 dnl # 8. Checks for system services
1219 dnl #############################################################
1222 dnl # Figure out where libtool is located,
1226 AC_MSG_RESULT([top_builddir=$top_builddir])
1227 dnl # AC_SUBST(top_builddir)
1231 dnl import libtool stuff
1233 dnl #############################################################
1235 dnl # Configure in any module directories.
1237 dnl #############################################################
1239 dnl ############################################################
1240 dnl # Remove any conflicting definitions if autoconf.h
1241 dnl # is being included by a module.
1242 dnl #############################################################
1243 AH_BOTTOM([#include <freeradius-devel/automask.h>])
1245 dnl ############################################################
1246 dnl # make modules by list
1247 dnl #############################################################
1248 if test "x$EXPERIMENTAL" = "xyes"; then
1249 for foo in `ls -1 "${srcdir}"/src/modules | grep rlm_`; do
1250 MODULES="$MODULES $foo"
1254 dnl # make ONLY the stable modules
1256 for foo in `cat "${srcdir}"/src/modules/stable`; do
1257 MODULES="$MODULES $foo"
1261 dnl ############################################################
1262 dnl # Add autoconf subdirs, based on the module list we
1263 dnl # previously created.
1264 dnl #############################################################
1266 for bar in $MODULES; do
1267 if test -f "${srcdir}"/src/modules/$bar/configure; then
1268 mysubdirs="$mysubdirs src/modules/$bar"
1273 dnl # Don't change the variable name here. Autoconf goes bonkers
1276 AC_CONFIG_SUBDIRS($mysubdirs)
1279 dnl #############################################################
1281 dnl # And finally, output the results.
1283 dnl #############################################################
1285 AC_CONFIG_COMMANDS([stamp-h], [echo timestamp > src/include/stamp-h])
1286 AC_CONFIG_COMMANDS([build-radpaths-h], [(cd ./src/include && /bin/sh ./build-radpaths-h)])
1287 AC_CONFIG_COMMANDS([main-chmod], [(cd ./src/main && chmod +x checkrad radlast radtest)])
1288 AC_CONFIG_COMMANDS([scripts-chmod], [(cd ./scripts && chmod +x rc.radiusd radiusd.cron.daily radiusd.cron.monthly cryptpasswd)])
1291 dnl # Substitute whatever libraries we found to be necessary
1294 AC_SUBST(INSTALLSTRIP)
1296 USE_SHARED_LIBS=$enable_shared
1297 AC_SUBST(USE_SHARED_LIBS)
1298 USE_STATIC_LIBS=$enable_static
1299 AC_SUBST(USE_STATIC_LIBS)
1300 AC_SUBST(STATIC_MODULES)
1301 AC_SUBST(RADIUSD_MAJOR_VERSION)
1302 AC_SUBST(RADIUSD_MINOR_VERSION)
1303 AC_SUBST(RADIUSD_INCRM_VERSION)
1304 AC_SUBST(RADIUSD_VERSION)
1305 AC_SUBST(RADIUSD_VERSION_STRING)
1306 AC_SUBST(RADIUSD_VERSION_COMMIT)
1310 ./src/include/build-radpaths-h \
1311 ./src/main/Makefile \
1312 ./src/main/radsniff.mk \
1313 ./src/main/checkrad \
1314 ./src/main/radlast \
1315 ./src/main/radtest \
1316 ./scripts/rc.radiusd \
1317 ./scripts/radiusd.cron.daily \
1318 ./scripts/radiusd.cron.monthly \
1319 ./scripts/cryptpasswd \
1320 ./raddb/dictionary \
1321 ./raddb/radrelay.conf \
1322 ./raddb/radiusd.conf