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 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.pl 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.pl 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.pl 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"
704 dnl FreeBSD requires sys/socket.h before net/if.h
705 AC_CHECK_HEADERS(net/if.h, [], [],
706 [#ifdef HAVE_SYS_SOCKET_H
707 # include <sys/socket.h>
712 AC_CHECK_HEADER(pcreposix.h, AC_DEFINE(HAVE_PCREPOSIX_H, [], [define this if we have the <pcreposix.h> header file]))
713 if test "x$ac_cv_header_pcreposix_h" = "xyes"; then
714 AC_DEFINE(HAVE_REGEX_H, [], [define if we have any regex])
718 LIBS="$LIBS -lpcreposix"
721 AC_CHECK_HEADER(regex.h, AC_DEFINE(HAVE_REGEX_H, [], [define this if we have the <regex.h> header file]))
722 if test "x$ac_cv_header_regex_h" = "xyes"; then
731 ], [AC_DEFINE(HAVE_REG_EXTENDED, [], [define this if we have REG_EXTENDED (from <regex.h>)]) REGEX_EXTENDED=yes])
737 AC_SUBST(REGEX_EXTENDED)
740 dnl # other checks which require headers
742 if test "x$ac_cv_header_sys_security_h" = "xyes" && test "x$ac_cv_header_prot_h" = "xyes"
744 AC_DEFINE(OSFC2, [], [define if you have OSFC2 authentication])
747 if test "x$ac_cv_header_sia_h" = "xyes" && test "x$ac_cv_header_siad_h" = "xyes"
749 AC_DEFINE(OSFSIA, [], [define if you have OSFSIA authentication])
752 dnl Check for OpenSSL includes.
753 OPENSSL_INCLUDE="-DNO_OPENSSL"
754 if test "x$WITH_OPENSSL" = xyes; then
755 if test "x$OPENSSL_LIBS" = "x"; then
756 AC_MSG_NOTICE([skipping test for openssl/ssl.h])
758 old_CPPFLAGS=$CPPFLAGS
759 if test "x$OPENSSL_INCLUDE_DIR" != "x"; then
760 CPPFLAGS="$CPPFLAGS -I$OPENSSL_INCLUDE_DIR"
762 dnl # stupid RedHat shit
763 CPPFLAGS="$CPPFLAGS -DOPENSSL_NO_KRB5"
777 if test "x$OPENSSL_LIBS" != "x"; then
778 AC_MSG_CHECKING([for OpenSSL version >= 0.9.7])
780 [#include <openssl/crypto.h>
781 #if (OPENSSL_VERSION_NUMBER >= 0x00907000L)
785 if test "x$goodssl" != "xyes"; then
790 if test "x$OPENSSL_INCLUDE_DIR" != "x"; then
791 OPENSSL_INCLUDE="-I$OPENSSL_INCLUDE_DIR -DOPENSSL_NO_KRB5"
793 OPENSSL_INCLUDE="-DOPENSSL_NO_KRB5"
797 CPPFLAGS=$old_CPPFLAGS
800 AC_SUBST(OPENSSL_INCLUDE)
801 AC_SUBST(OPENSSL_LIBS)
804 dnl Check the pcap includes for the RADIUS sniffer.
805 if test "x$PCAP_LIBS" = x; then
806 AC_MSG_NOTICE([skipping test for pcap.h.])
808 AC_CHECK_HEADER(pcap.h,
809 AC_DEFINE(HAVE_PCAP_H, 1,
810 [Define to 1 if you have the <pcap.h> header file.]),
812 AC_MSG_WARN([pcap.h not found, silently disabling the RADIUS sniffer.])
815 AC_CHECK_LIB(pcap, pcap_fopen_offline,
816 [ AC_DEFINE(HAVE_PCAP_FOPEN_OFFLINE, 1,
817 [Define to 1 if you have the function pcap_fopen_offline.])
819 AC_CHECK_LIB(pcap, pcap_dump_fopen,
820 [ AC_DEFINE(HAVE_PCAP_DUMP_FOPEN, 1,
821 [Define to 1 if you have the function pcap_dump_fopen.])
826 dnl #############################################################
828 dnl # 4. Checks for typedefs
830 dnl #############################################################
833 dnl # Ensure that these are defined
840 dnl check for socklen_t
841 FR_CHECK_TYPE_INCLUDE([
842 #ifdef HAVE_SYS_TYPES_H
843 #include <sys/types.h>
845 #ifdef HAVE_SYS_SOCKET_H
846 #include <sys/socket.h>
848 ],socklen_t, int, [socklen_t is generally 'int' on systems which don't use it])
850 dnl check for uint8_t
851 FR_CHECK_TYPE_INCLUDE([
852 #ifdef HAVE_INTTYPES_H
853 #include <inttypes.h>
858 ],uint8_t, unsigned char, [uint8_t should be the canonical 'octet' for network traffic])
860 dnl check for uint16_t
861 FR_CHECK_TYPE_INCLUDE([
862 #ifdef HAVE_INTTYPES_H
863 #include <inttypes.h>
868 ],uint16_t, unsigned short, [uint16_t should be the canonical '2 octets' for network traffic])
870 dnl check for uint32_t
871 FR_CHECK_TYPE_INCLUDE([
872 #ifdef HAVE_INTTYPES_H
873 #include <inttypes.h>
878 ],uint32_t, unsigned int, [uint32_t should be the canonical 'network integer])
880 AC_CHECK_TYPE(struct in6_addr, AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1, [IPv6 address structure]), [], [
881 #ifdef HAVE_NETINET_IN_H
882 #include <netinet/in.h>
886 AC_CHECK_TYPE(struct sockaddr_storage, AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1, [Generic socket addresses]), [], [
887 #ifdef HAVE_NETINET_IN_H
888 #include <netinet/in.h>
890 #ifdef HAVE_SYS_SOCKET_H
891 #include <sys/socket.h>
895 AC_CHECK_TYPE(struct sockaddr_in6, AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1, [IPv6 socket addresses]), [], [
896 #ifdef HAVE_NETINET_IN_H
897 #include <netinet/in.h>
901 AC_CHECK_TYPE(struct addrinfo, AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1, [Generic DNS lookups]), [], [
902 #ifdef HAVE_SYS_TYPES_H
903 #include <sys/types.h>
905 #ifdef HAVE_SYS_SOCKET_H
906 #include <sys/socket.h>
913 dnl #############################################################
915 dnl # 5. Checks for structures and functions
917 dnl #############################################################
952 RADIUSD_NEED_DECLARATIONS( \
964 dnl # check if we have utmpx.h
965 dnl # if so, check if struct utmpx has entry ut_xtime
966 dnl # if not, set it to define ut_xtime == ut_tv.tv_sec
967 if test "x$ac_cv_header_utmpx_h" = "xyes"
969 FR_CHECK_STRUCT_HAS_MEMBER([#include <utmpx.h>], [struct utmpx], ut_xtime)
970 if test "x$ac_cv_type_struct_utmpx_has_ut_xtime" = "x"
972 AC_DEFINE(ut_xtime,ut_tv.tv_sec, [define to something if you don't have ut_xtime in struct utmpx])
976 dnl # struct ip_pktinfo
977 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in_pktinfo], ipi_addr)
978 if test "x$ac_cv_type_struct_in_pktinfo_has_ipi_addr" = "xyes"
980 AC_DEFINE(HAVE_IP_PKTINFO, [], [define if you have IP_PKTINFO (Linux)])
983 dnl # struct in6_pktinfo
984 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in6_pktinfo], ipi6_addr)
985 if test "x$ac_cv_type_struct_in6_pktinfo_has_ipi6_addr" = "xyes"
987 AC_DEFINE(HAVE_IN6_PKTINFO, [], [define if you have IN6_PKTINFO (Linux)])
990 dnl #############################################################
992 dnl # 6. Checks for compiler characteristics
994 dnl #############################################################
997 dnl # Ensure that these are defined
1002 dnl # See if this is OS/2
1004 AC_MSG_CHECKING(type of OS)
1007 if test "$OS" = "OS/2"; then
1014 AC_MSG_CHECKING(for developer gcc flags)
1017 if test "x$developer" = "xyes"; then
1018 if test "x$GCC" = "xyes"; then
1019 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"
1020 CFLAGS="$CFLAGS $devflags"
1022 AC_MSG_RESULT(yes. Using $devflags)
1025 if test "x$EXPERIMENTAL" != "xno"; then
1029 dnl append the current git hash onto the version string
1030 if test "x$GIT" = "xyes"; then
1031 RADIUSD_VERSION_COMMIT=`git log --pretty=format:'%h' -n 1`
1035 CFLAGS="$CFLAGS -DNDEBUG"
1042 dnl #############################################################
1044 dnl # 7. Checks for library functions
1046 dnl #############################################################
1049 LIBS="$LIBS $LIBLTDL"
1050 AC_CHECK_FUNC(lt_dladvise_init, AC_DEFINE(HAVE_LT_DLADVISE_INIT, [], [Do we have the lt_dladvise_init function]))
1053 dnl Check for libcrypt
1054 dnl We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
1055 AC_CHECK_LIB(crypt, crypt,
1058 if test "$CRYPTLIB" != ""; then
1059 AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function])
1061 AC_CHECK_FUNC(crypt, AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function]))
1064 dnl Check for libcipher
1065 AC_CHECK_LIB(cipher, setkey,
1066 CRYPTLIB="${CRYPTLIB} -lcipher"
1070 dnl Check the style of gethostbyaddr, in order of preference
1071 dnl GNU (_r eight args)
1072 AC_DEFINE(GNUSTYLE, [1], [GNU-Style get*byaddr_r])
1073 dnl SYSV (_r six args)
1074 AC_DEFINE(SYSVSTYLE, [2], [SYSV-Style get*byaddr_r])
1075 dnl BSD (three args, may not be thread safe)
1076 AC_DEFINE(BSDSTYLE, [3], [BSD-Style get*byaddr_r])
1077 dnl Tru64 has BSD version, but it is thread safe
1078 dnl http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1739____.HTM
1079 dnl We need #stdio.h to define NULL on FreeBSD (at least)
1080 gethostbyaddrrstyle=""
1081 AC_MSG_CHECKING([gethostbyaddr_r() syntax])
1084 dnl With FreeBSD, check if there's a prototype for gethostbyaddr_r.
1085 dnl Some versions (FreeBSD 5.1?) have a symbol but no prototype - so we
1086 dnl override this test to BSDSTYLE. FreeBSD 6.2 and up have proper GNU
1088 AC_CHECK_DECLS([gethostbyaddr_r], [], [
1089 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE,
1090 [style of gethostbyaddr_r functions ])
1091 gethostbyaddrrstyle=BSD
1092 AC_MSG_WARN([FreeBSD overridden to BSD-style])
1100 if test "x$gethostbyaddrrstyle" = "x"; then
1104 ], [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL, NULL) ], [
1105 AC_DEFINE(GETHOSTBYADDRRSTYLE, GNUSTYLE, [style of gethostbyaddr_r functions ])
1106 gethostbyaddrrstyle=GNU
1109 if test "x$gethostbyaddrrstyle" = "x"; then
1113 ], [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL) ] , [
1114 AC_DEFINE(GETHOSTBYADDRRSTYLE, SYSVSTYLE, [style of gethostbyaddr_r functions ])
1115 gethostbyaddrrstyle=SYSV
1118 if test "x$gethostbyaddrrstyle" = "x"; then
1122 ], [ gethostbyaddr(NULL, 0, 0) ], [
1123 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE, [style of gethostbyaddr_r functions ])
1124 gethostbyaddrrstyle=BSD
1128 if test "x$gethostbyaddrrstyle" = "x"; then
1129 AC_MSG_RESULT([none! It must not exist, here.])
1131 AC_MSG_RESULT([${gethostbyaddrrstyle}-style])
1134 if test "x$gethostbyaddrrstyle" = "xBSD"; then
1135 AC_MSG_WARN([ ****** BSD-style gethostbyaddr might NOT be thread-safe! ****** ])
1138 dnl Check the style of gethostbyname, in order of preference
1139 dnl GNU (_r seven args)
1140 dnl SYSV (_r five args)
1141 dnl BSD (two args, may not be thread safe)
1142 dnl Tru64 has BSD version, but it _is_ thread safe
1143 dnl http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1946____.HTM
1144 dnl We need #stdio.h to define NULL on FreeBSD (at least)
1145 gethostbynamerstyle=""
1146 AC_MSG_CHECKING([gethostbyname_r() syntax])
1150 ], [ gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL) ], [
1151 AC_DEFINE(GETHOSTBYNAMERSTYLE, GNUSTYLE, [style of gethostbyname_r functions ])
1152 gethostbynamerstyle=GNU
1154 if test "x$gethostbynamerstyle" = "x"; then
1158 ], [ gethostbyname_r(NULL, NULL, NULL, 0, NULL) ] , [
1159 AC_DEFINE(GETHOSTBYNAMERSTYLE, SYSVSTYLE, [style of gethostbyname_r functions ])
1160 gethostbynamerstyle=SYSV
1163 if test "x$gethostbynamerstyle" = "x"; then
1167 ], [ gethostbyname(NULL) ], [
1168 AC_DEFINE(GETHOSTBYNAMERSTYLE, BSDSTYLE, [style of gethostbyname_r functions ])
1169 gethostbynamerstyle=BSD
1173 if test "x$gethostbynamerstyle" = "x"; then
1174 AC_MSG_RESULT([none! It must not exist, here.])
1176 AC_MSG_RESULT([${gethostbynamerstyle}-style])
1179 if test "x$gethostbynamerstyle" = "xBSD"; then
1180 AC_MSG_WARN([ ****** BSD-style gethostbyname might NOT be thread-safe! ****** ])
1183 dnl check for non-posix solaris ctime_r (extra buflen int arg)
1184 AC_DEFINE(POSIXSTYLE, [1], [Posix-Style ctime_r])
1185 AC_DEFINE(SOLARISSTYLE, [2], [Solaris-Style ctime_r])
1187 AC_MSG_CHECKING([ctime_r() syntax])
1190 ], [ ctime_r(NULL, NULL, 0) ], [
1191 AC_DEFINE(CTIMERSTYLE, SOLARISSTYLE, [style of ctime_r function])
1192 ctimerstyle="SOLARIS"
1194 if test "x$ctimerstyle" = "x"; then
1197 ], [ ctime_r(NULL, NULL) ], [
1198 AC_DEFINE(CTIMERSTYLE, POSIXSTYLE, [style of ctime_r function])
1203 if test "x$ctimerstyle" = "x"; then
1204 AC_MSG_RESULT([none! It must not exist, here.])
1206 AC_MSG_RESULT([${ctimerstyle}-style])
1209 AC_SUBST(HOSTINFO, $host)
1211 dnl #############################################################
1213 dnl # 8. Checks for system services
1215 dnl #############################################################
1218 dnl # Figure out where libtool is located,
1222 AC_MSG_RESULT([top_builddir=$top_builddir])
1223 dnl # AC_SUBST(top_builddir)
1227 dnl import libtool stuff
1229 dnl #############################################################
1231 dnl # Configure in any module directories.
1233 dnl #############################################################
1235 dnl ############################################################
1236 dnl # Remove any conflicting definitions if autoconf.h
1237 dnl # is being included by a module.
1238 dnl #############################################################
1239 AH_BOTTOM([#include <freeradius-devel/automask.h>])
1242 if test "x$EXPERIMENTAL" = "xyes"; then
1243 bar=`ls -1 "${srcdir}"/src/modules/rlm_*/configure | sed 's%/configure%%'`
1244 dnl # get rid of LF's.
1245 mysubdirs=`echo $mysubdirs $bar`
1248 dnl # Find 'configure' in ONLY the stable modules
1250 for bar in `cat "${srcdir}"/src/modules/stable`; do
1251 if test -f "${srcdir}"/src/modules/$bar/configure; then
1252 mysubdirs="$mysubdirs src/modules/$bar"
1257 dnl ############################################################
1258 dnl # make modules by list
1259 dnl #############################################################
1260 if test "x$EXPERIMENTAL" = "xyes"; then
1261 for foo in `ls -1 "${srcdir}"/src/modules | grep rlm_`; do
1262 MODULES="$MODULES $foo"
1266 dnl # make ONLY the stable modules
1268 for foo in `cat "${srcdir}"/src/modules/stable`; do
1269 MODULES="$MODULES $foo"
1274 dnl # Don't change the variable name here. Autoconf goes bonkers
1277 AC_CONFIG_SUBDIRS($mysubdirs)
1280 dnl #############################################################
1282 dnl # And finally, output the results.
1284 dnl #############################################################
1286 AC_CONFIG_COMMANDS([stamp-h], [echo timestamp > src/include/stamp-h])
1287 AC_CONFIG_COMMANDS([build-radpaths-h], [(cd ./src/include && /bin/sh ./build-radpaths-h)])
1288 AC_CONFIG_COMMANDS([main-chmod], [(cd ./src/main && chmod +x checkrad.pl radlast radtest)])
1289 AC_CONFIG_COMMANDS([scripts-chmod], [(cd ./scripts && chmod +x rc.radiusd radiusd.cron.daily radiusd.cron.monthly cryptpasswd)])
1292 dnl # Substitute whatever libraries we found to be necessary
1295 AC_SUBST(INSTALLSTRIP)
1297 USE_SHARED_LIBS=$enable_shared
1298 AC_SUBST(USE_SHARED_LIBS)
1299 USE_STATIC_LIBS=$enable_static
1300 AC_SUBST(USE_STATIC_LIBS)
1301 AC_SUBST(STATIC_MODULES)
1302 AC_SUBST(RADIUSD_MAJOR_VERSION)
1303 AC_SUBST(RADIUSD_MINOR_VERSION)
1304 AC_SUBST(RADIUSD_INCRM_VERSION)
1305 AC_SUBST(RADIUSD_VERSION)
1306 AC_SUBST(RADIUSD_VERSION_STRING)
1307 AC_SUBST(RADIUSD_VERSION_COMMIT)
1311 ./src/include/build-radpaths-h \
1312 ./src/main/Makefile \
1313 ./src/main/radsniff.mk \
1314 ./src/main/checkrad.pl \
1315 ./src/main/radlast \
1316 ./src/main/radtest \
1317 ./scripts/rc.radiusd \
1318 ./scripts/radiusd.cron.daily \
1319 ./scripts/radiusd.cron.monthly \
1320 ./scripts/cryptpasswd \
1321 ./raddb/dictionary \
1322 ./raddb/radrelay.conf \
1323 ./raddb/radiusd.conf