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
94 dnl #############################################################
96 dnl # 0. Checks for compiler, libtool, and command line options.
98 dnl #############################################################
105 dnl # check for AIX, to allow us to use some BSD functions
106 dnl # must be before macros that call the compiler.
110 AC_PROG_GCC_TRADITIONAL
115 dnl # Set Default CFLAGS
117 if test "x$GCC" = "xyes"; then
118 CFLAGS="$CFLAGS -Wall -D_GNU_SOURCE"
121 dnl Compile in large (2G+) file support.
124 dnl # check for system bytesex
125 dnl # AC_DEFINES WORDS_BIGENDIAN
129 AC_CHECK_PROG(GMAKE, gmake, yes, no)
130 if test $GMAKE = no; then
131 AC_PATH_PROG(MAKE, make, /usr/local/bin/make)
133 AC_PATH_PROG(MAKE, gmake, /usr/local/gnu/bin/make)
135 makever=`$ac_cv_path_MAKE --version 2>&1 | grep "GNU Make"`
136 if test -z "$makever"; then
137 AC_MSG_ERROR(GNU Make is not installed. Please download and install it
138 from ftp://prep.ai.mit.edu/pub/gnu/make/ before continuing.)
141 dnl See if we have Git.
142 AC_CHECK_PROG(GIT, git, yes, no)
144 AC_ARG_WITH(system-libltdl,
145 [ --with-system-libltdl Use the libltdl installed in your system (default=use dlopen)],
147 [with_system_libltdl=no])
149 AS_IF([test "x$with_system_libltdl" = "xyes" ],
151 INCLTDL=-DWITH_SYSTEM_LTDL])
153 dnl use system-wide libtool, if it exists
154 AC_ARG_WITH(system-libtool,
155 [ --with-system-libtool Use the libtool installed in your system (default=use our own)],
157 [with_system_libtool=no])
159 AS_IF([test "x$with_system_libtool" = "xyes" ],
160 [ AC_PATH_PROG(LIBTOOL, libtool,,$PATH:/usr/local/bin) AC_LIBTOOL_DLOPEN
163 LIBTOOL='${top_srcdir}/scripts/jlibtool'
165 dnl ensure that we're looking for dlopen
170 dnl Put this in later, when all distributed modules use autoconf.
171 dnl AC_ARG_WITH(disablemodulefoo,
172 dnl [ --without-rlm_foo Disables module compilation. Module list:]
173 dnl esyscmd([find src/modules -type d -name rlm_\* -print |\
174 dnl sed -e 's%src/modules/.*/% (sub)- %; s%.*/%- %' |\
175 dnl awk '{print " "$0}']))
177 AC_ARG_ENABLE(strict-dependencies,
178 [ --enable-strict-dependencies Fail configure on lack of module dependancy.])
180 dnl # Build using the new boilermake system
182 AC_ARG_ENABLE(boilermake,
183 [ --enable-boilermake use the boilermake build system (experimental default=no).],
184 [ case "$enableval" in
195 if test "x$boilermake" == "xyes"; then
199 dnl extra argument: --with-docdir
200 docdir='${datadir}/doc/freeradius'
201 AC_MSG_CHECKING(docdir)
203 [ --with-docdir=DIR Directory for documentation [DATADIR/doc/freeradius] ],
210 [[\\/$]]* | ?:[[\\/]]* )
214 AC_MSG_ERROR([expected an absolute directory name for --with-docdir: $withval])
219 AC_MSG_RESULT($docdir)
220 if test "x$docdir" = xno; then
221 AC_MSG_WARN(Documentation files will NOT be installed.)
224 dnl extra argument: --with-logdir
225 logdir='${localstatedir}/log/radius'
226 AC_MSG_CHECKING(logdir)
228 [ --with-logdir=DIR Directory for logfiles [LOCALSTATEDIR/log/radius] ],
231 AC_MSG_ERROR(Need logdir)
235 [[\\/$]]* | ?:[[\\/]]* )
239 AC_MSG_ERROR([expected an absolute directory name for --with-logdir: $withval])
244 AC_MSG_RESULT($logdir)
246 dnl extra argument: --with-radacctdir
247 radacctdir='${logdir}/radacct'
248 AC_MSG_CHECKING(radacctdir)
249 AC_ARG_WITH(radacctdir,
250 [ --with-radacctdir=DIR Directory for detail files [LOGDIR/radacct] ],
253 AC_MSG_ERROR(Need radacctdir)
257 [[\\/$]]* | ?:[[\\/]]* )
258 radacctdir="$withval"
261 AC_MSG_ERROR([expected an absolute directory name for --with-radacctdir: $withval])
266 AC_MSG_RESULT($radacctdir)
268 dnl extra argument: --with-raddbdir
269 raddbdir='${sysconfdir}/raddb'
270 AC_MSG_CHECKING(raddbdir)
271 AC_ARG_WITH(raddbdir,
272 [ --with-raddbdir=DIR Directory for config files [SYSCONFDIR/raddb] ],
275 AC_MSG_ERROR(Need raddbdir)
279 [[\\/$]]* | ?:[[\\/]]* )
283 AC_MSG_ERROR([expected an absolute directory name for --with-raddbdir: $withval])
288 AC_MSG_RESULT($raddbdir)
290 dnl extra argument: --with-ascend-binary
291 WITH_ASCEND_BINARY=yes
292 AC_ARG_WITH(ascend-binary,
293 [ --with-ascend-binary Include support for Ascend binary filter attributes (default=yes)],
298 WITH_ASCEND_BINARY=no
301 if test "x$WITH_ASCEND_BINARY" = "xyes"; then
302 AC_DEFINE(WITH_ASCEND_BINARY, [1], [Include support for Ascend binary filter attributes])
305 dnl extra argument: --with-threads
308 [ --with-threads Use threads, if available. (default=yes) ],
317 dnl extra argument: --with-tcp
320 [ --with-tcp Compile in TCP support. (default=yes)],
328 if test "x$WITH_TCP" = "xyes"; then
329 AC_DEFINE(WITH_TCP, [1], [define if you want TCP support (For RADSec et al)])
332 dnl extra argument: --with-vmps
335 [ --with-vmps Compile in VMPS support. (default=yes)],
343 if test "x$WITH_VMPS" = "xyes"; then
344 AC_DEFINE(WITH_VMPS, [1], [define if you want VMPS support])
347 dnl extra argument: --with-dhcp
350 [ --with-dhcp Compile in DHCP support. (default=yes)],
358 if test "x$WITH_DHCP" = "xyes"; then
359 AC_DEFINE(WITH_DHCP, [1], [define if you want DHCP support])
363 dnl # Allow the user to specify a list of modules to be linked
364 dnl # statically to the server.
367 AC_ARG_WITH(static_modules,
368 [ --with-static-modules=QUOTED-MODULE-LIST],[
369 for i in $withval; do
370 STATIC_MODULES="$STATIC_MODULES -dlpreopen ../modules/rlm_$i/rlm_$i.la"
376 [ --with-modules=QUOTED-MODULE-LIST],[
377 for i in $withval; do
378 MODULES="$MODULES $i"
382 dnl extra argument: --with-experimental-modules
384 AC_ARG_WITH(experimental-modules,
385 [ --with-experimental-modules Use experimental and unstable modules. (default=no, unless --enable-developer=yes) ],
397 dnl extra argument: --with-openssl
400 [ --with-openssl Use OpenSSL. (default=yes)],
412 dnl # extra argument: --with-openssl-includes=dir
415 AC_ARG_WITH(openssl-includes,
416 [ --with-openssl-includes=DIR Directory to look for OpenSSL include files],
418 *) OPENSSL_INCLUDE_DIR="$withval"
424 dnl # extra argument: --with-openssl-libraries=dir
427 AC_ARG_WITH(openssl-libraries,
428 [ --with-openssl-libraries=DIR Directory to look for OpenSSL library files],
430 *) OPENSSL_LIB_DIR="$withval"
436 dnl # These next two arguments don't actually do anything. They're
437 dnl # place holders so that the top-level configure script can tell
438 dnl # the user how to configure lower-level modules
442 dnl # extra argument: --with-rlm-FOO-lib-dir
444 AC_ARG_WITH(rlm-FOO-lib-dir,
445 [ --with-rlm-FOO-lib-dir=DIR Directory to look for library files used by module FOO],
453 dnl # extra argument: --with-rlm-FOO-include-dir
455 AC_ARG_WITH(rlm-FOO-include-dir,
456 [ --with-rlm-FOO-include-dir=DIR Directory to look for include files used by module FOO],
463 dnl See what include-style is used by the make program.
464 dnl AC_MSG_CHECKING(include style for make)
465 dnl echo "include /dev/null" > testmake.$$
466 dnl echo "all:" >> testmake.$$
467 dnl make -f testmake.$$ >/dev/null 2>&1
476 dnl rm -f testmake.$$
477 dnl AC_MSG_RESULT(" $INCLUDE")
478 dnl AC_SUBST(INCLUDE)
481 dnl extra argument: --with-udpfromto
483 AC_ARG_WITH(udpfromto,
484 [ --with-udpfromto Compile in UDPFROMTO support. (default=no)],
494 if test "x$WITH_UDPFROMTO" = "xyes"; then
495 AC_DEFINE(WITH_UDPFROMTO, [], [define if you want udpfromto])
498 dnl #############################################################
500 dnl # 1. Checks for programs
502 dnl #############################################################
505 AC_PATH_PROG(PERL, perl, /usr/local/bin/perl)
506 if test "x$ac_cv_path_PERL" = "x"; then
507 AC_MSG_WARN(perl not found - Simultaneous-Use and checkrad may not work)
509 AC_PATH_PROG(SNMPGET, snmpget)
510 if test "x$ac_cv_path_SNMPGET" = "x"; then
511 AC_MSG_WARN(snmpget not found - Simultaneous-Use and checkrad may not work)
514 AC_PATH_PROG(SNMPWALK, snmpwalk)
515 if test "x$ac_cv_path_SNMPWALK" = "x"; then
516 AC_MSG_WARN(snmpwalk not found - Simultaneous-Use and checkrad may not work)
519 AC_PATH_PROG(RUSERS, rusers, /usr/bin/rusers)
521 dnl FIXME This is truly gross.
522 missing_dir=`cd $ac_aux_dir && pwd`
523 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
524 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
525 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
527 AC_PATH_PROG(LOCATE,locate)
528 AC_PATH_PROG(DIRNAME,dirname)
529 AC_PATH_PROG(GREP,grep)
531 dnl #############################################################
533 dnl # 2. Checks for libraries
535 dnl #############################################################
537 dnl If using pthreads, check for -lpthread (posix) or -lc_r (*BSD)
539 if test "x$WITH_THREADS" = "xyes"; then
540 if test $ac_cv_prog_suncc = "yes"; then
544 AC_CHECK_HEADERS(pthread.h, [], [ WITH_THREADS="no" ])
547 dnl # pthread stuff is usually in -lpthread
548 dnl # or in -lc_r, on *BSD
550 dnl # On Some systems, we need extra pre-processor flags, to get them to
551 dnl # to do the threading properly.
553 AC_CHECK_LIB(pthread, pthread_create,
554 [ CFLAGS="$CFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS"
555 LIBS="-lpthread $LIBS" ],
556 [ AC_CHECK_LIB(c_r, pthread_create,
557 [ CFLAGS="$CFLAGS -pthread -D_THREAD_SAFE" ],
558 [ WITH_THREADS="no" ]
564 dnl # If we have NO pthread libraries, remove any knowledge of threads.
566 if test "x$WITH_THREADS" != "xyes"; then
568 ac_cv_header_pthread_h="no"
572 dnl # We need sem_init() and friends, as they're the friendliest
573 dnl # semaphore functions for threading.
575 dnl # HP/UX requires linking with librt, too, to get the sem_* symbols.
576 dnl # Some systems have them in -lsem
577 dnl # Solaris has them in -lposix4
578 dnl # NetBSD has them in -lsemaphore
580 AC_SEARCH_LIBS(sem_init, pthread sem posix4 rt semaphore,
582 [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)]
586 if test "x$WITH_THREADS" = "xyes"; then
587 AC_DEFINE(WITH_THREADS, [1], [define if you want thread support])
590 dnl Check if we need -lsocket
591 AC_CHECK_LIB(dl, dlopen)
593 dnl Check if we need -lsocket
594 AC_CHECK_LIB(socket, getsockname)
596 dnl Check for -lresolv
597 dnl This library may be needed later.
598 AC_CHECK_LIB(resolv, inet_aton)
600 dnl Check if we need -lnsl. Usually if we want to
601 dnl link against -lsocket we need to include -lnsl as well.
602 AC_CHECK_LIB(nsl, inet_ntoa)
604 dnl Check for OpenSSL libraries.
606 if test "x$WITH_OPENSSL" = xyes; then
608 old_LDFLAGS="$LDFLAGS"
609 if test "x$OPENSSL_LIB_DIR" != "x"; then
610 LDFLAGS="$LDFLAGS -L$OPENSSL_LIB_DIR"
612 AC_CHECK_LIB(crypto, DH_new,
614 LIBS="-lcrypto $LIBS"
615 AC_DEFINE(HAVE_LIBCRYPTO, 1,
616 [Define to 1 if you have the `crypto' library (-lcrypto).])
617 AC_CHECK_LIB(ssl, SSL_new,
619 AC_DEFINE(HAVE_LIBSSL, 1,
620 [Define to 1 if you have the `ssl' library (-lssl).])
621 if test "x$OPENSSL_LIB_DIR" != "x"; then
622 OPENSSL_LIBS="-L$OPENSSL_LIB_DIR"
624 OPENSSL_LIBS="$OPENSSL_LIBS -lcrypto -lssl -lcrypto"
628 LDFLAGS="$old_LDFLAGS"
631 AC_CHECK_LIB(ws2_32, htonl)
633 dnl Check the pcap library for the RADIUS sniffer.
635 AC_CHECK_LIB(pcap, pcap_open_live,
637 AC_DEFINE(HAVE_LIBPCAP, 1,
638 [Define to 1 if you have the `pcap' library (-lpcap).])
640 [ AC_MSG_WARN([pcap library not found, silently disabling the RADIUS sniffer.]) ])
644 dnl #############################################################
646 dnl # 3. Checks for header files
648 dnl #############################################################
651 dnl # Interix requires us to set -D_ALL_SOURCE, otherwise
652 dnl # getopt will be #included, but won't link. <sigh>
657 CFLAGS="$CFLAGS -D_ALL_SOURCE"
660 CFLAGS="$CFLAGS -DDARWIN"
661 LIBS="-framework DirectoryService $LIBS"
711 dnl FreeBSD requires sys/socket.h before net/if.h
712 AC_CHECK_HEADERS(net/if.h, [], [],
713 [#ifdef HAVE_SYS_SOCKET_H
714 # include <sys/socket.h>
719 AC_CHECK_HEADER(pcreposix.h, AC_DEFINE(HAVE_PCREPOSIX_H, [], [define this if we have the <pcreposix.h> header file]))
720 if test "x$ac_cv_header_pcreposix_h" = "xyes"; then
721 AC_DEFINE(HAVE_REGEX_H, [], [define if we have any regex])
725 LIBS="$LIBS -lpcreposix"
728 AC_CHECK_HEADER(regex.h, AC_DEFINE(HAVE_REGEX_H, [], [define this if we have the <regex.h> header file]))
729 if test "x$ac_cv_header_regex_h" = "xyes"; then
738 ], [AC_DEFINE(HAVE_REG_EXTENDED, [], [define this if we have REG_EXTENDED (from <regex.h>)]) REGEX_EXTENDED=yes])
744 AC_SUBST(REGEX_EXTENDED)
747 dnl # other checks which require headers
749 if test "x$ac_cv_header_sys_security_h" = "xyes" && test "x$ac_cv_header_prot_h" = "xyes"
751 AC_DEFINE(OSFC2, [], [define if you have OSFC2 authentication])
754 if test "x$ac_cv_header_sia_h" = "xyes" && test "x$ac_cv_header_siad_h" = "xyes"
756 AC_DEFINE(OSFSIA, [], [define if you have OSFSIA authentication])
759 dnl Check for OpenSSL includes.
760 OPENSSL_INCLUDE="-DNO_OPENSSL"
761 if test "x$WITH_OPENSSL" = xyes; then
762 if test "x$OPENSSL_LIBS" = "x"; then
763 AC_MSG_NOTICE([skipping test for openssl/ssl.h])
765 old_CPPFLAGS=$CPPFLAGS
766 if test "x$OPENSSL_INCLUDE_DIR" != "x"; then
767 CPPFLAGS="$CPPFLAGS -I$OPENSSL_INCLUDE_DIR"
769 dnl # stupid RedHat shit
770 CPPFLAGS="$CPPFLAGS -DOPENSSL_NO_KRB5"
784 if test "x$OPENSSL_LIBS" != "x"; then
785 AC_MSG_CHECKING([for OpenSSL version >= 0.9.7])
787 [#include <openssl/crypto.h>
788 #if (OPENSSL_VERSION_NUMBER >= 0x00907000L)
792 if test "x$goodssl" != "xyes"; then
797 if test "x$OPENSSL_INCLUDE_DIR" != "x"; then
798 OPENSSL_INCLUDE="-I$OPENSSL_INCLUDE_DIR -DOPENSSL_NO_KRB5"
800 OPENSSL_INCLUDE="-DOPENSSL_NO_KRB5"
804 CPPFLAGS=$old_CPPFLAGS
807 AC_SUBST(OPENSSL_INCLUDE)
808 AC_SUBST(OPENSSL_LIBS)
811 dnl Check the pcap includes for the RADIUS sniffer.
812 if test "x$PCAP_LIBS" = x; then
813 AC_MSG_NOTICE([skipping test for pcap.h.])
815 AC_CHECK_HEADER(pcap.h,
816 AC_DEFINE(HAVE_PCAP_H, 1,
817 [Define to 1 if you have the <pcap.h> header file.]),
819 AC_MSG_WARN([pcap.h not found, silently disabling the RADIUS sniffer.])
822 AC_CHECK_LIB(pcap, pcap_fopen_offline,
823 [ AC_DEFINE(HAVE_PCAP_FOPEN_OFFLINE, 1,
824 [Define to 1 if you have the function pcap_fopen_offline.])
826 AC_CHECK_LIB(pcap, pcap_dump_fopen,
827 [ AC_DEFINE(HAVE_PCAP_DUMP_FOPEN, 1,
828 [Define to 1 if you have the function pcap_dump_fopen.])
833 dnl #############################################################
835 dnl # 4. Checks for typedefs
837 dnl #############################################################
840 dnl # Ensure that these are defined
847 dnl check for socklen_t
848 FR_CHECK_TYPE_INCLUDE([
849 #ifdef HAVE_SYS_TYPES_H
850 #include <sys/types.h>
852 #ifdef HAVE_SYS_SOCKET_H
853 #include <sys/socket.h>
855 ],socklen_t, int, [socklen_t is generally 'int' on systems which don't use it])
857 dnl check for uint8_t
858 FR_CHECK_TYPE_INCLUDE([
859 #ifdef HAVE_INTTYPES_H
860 #include <inttypes.h>
865 ],uint8_t, unsigned char, [uint8_t should be the canonical 'octet' for network traffic])
867 dnl check for uint16_t
868 FR_CHECK_TYPE_INCLUDE([
869 #ifdef HAVE_INTTYPES_H
870 #include <inttypes.h>
875 ],uint16_t, unsigned short, [uint16_t should be the canonical '2 octets' for network traffic])
877 dnl check for uint32_t
878 FR_CHECK_TYPE_INCLUDE([
879 #ifdef HAVE_INTTYPES_H
880 #include <inttypes.h>
885 ],uint32_t, unsigned int, [uint32_t should be the canonical 'network integer])
887 AC_CHECK_TYPE(struct in6_addr, AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1, [IPv6 address structure]), [], [
888 #ifdef HAVE_NETINET_IN_H
889 #include <netinet/in.h>
893 AC_CHECK_TYPE(struct sockaddr_storage, AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1, [Generic socket addresses]), [], [
894 #ifdef HAVE_NETINET_IN_H
895 #include <netinet/in.h>
897 #ifdef HAVE_SYS_SOCKET_H
898 #include <sys/socket.h>
902 AC_CHECK_TYPE(struct sockaddr_in6, AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1, [IPv6 socket addresses]), [], [
903 #ifdef HAVE_NETINET_IN_H
904 #include <netinet/in.h>
908 AC_CHECK_TYPE(struct addrinfo, AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1, [Generic DNS lookups]), [], [
909 #ifdef HAVE_SYS_TYPES_H
910 #include <sys/types.h>
912 #ifdef HAVE_SYS_SOCKET_H
913 #include <sys/socket.h>
920 dnl #############################################################
922 dnl # 5. Checks for structures and functions
924 dnl #############################################################
959 RADIUSD_NEED_DECLARATIONS( \
971 dnl # check if we have utmpx.h
972 dnl # if so, check if struct utmpx has entry ut_xtime
973 dnl # if not, set it to define ut_xtime == ut_tv.tv_sec
974 if test "x$ac_cv_header_utmpx_h" = "xyes"
976 FR_CHECK_STRUCT_HAS_MEMBER([#include <utmpx.h>], [struct utmpx], ut_xtime)
977 if test "x$ac_cv_type_struct_utmpx_has_ut_xtime" = "x"
979 AC_DEFINE(ut_xtime,ut_tv.tv_sec, [define to something if you don't have ut_xtime in struct utmpx])
983 dnl # struct ip_pktinfo
984 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in_pktinfo], ipi_addr)
985 if test "x$ac_cv_type_struct_in_pktinfo_has_ipi_addr" = "xyes"
987 AC_DEFINE(HAVE_IP_PKTINFO, [], [define if you have IP_PKTINFO (Linux)])
990 dnl # struct in6_pktinfo
991 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in6_pktinfo], ipi6_addr)
992 if test "x$ac_cv_type_struct_in6_pktinfo_has_ipi6_addr" = "xyes"
994 AC_DEFINE(HAVE_IN6_PKTINFO, [], [define if you have IN6_PKTINFO (Linux)])
997 dnl #############################################################
999 dnl # 6. Checks for compiler characteristics
1001 dnl #############################################################
1004 dnl # Ensure that these are defined
1009 dnl # See if this is OS/2
1011 AC_MSG_CHECKING(type of OS)
1014 if test "$OS" = "OS/2"; then
1021 AC_MSG_CHECKING(for developer gcc flags)
1024 if test "x$developer" = "xyes"; then
1025 if test "x$GCC" = "xyes"; then
1026 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"
1027 CFLAGS="$CFLAGS $devflags"
1029 AC_MSG_RESULT(yes. Using $devflags)
1032 if test "x$EXPERIMENTAL" != "xno"; then
1037 CFLAGS="$CFLAGS -DNDEBUG"
1042 dnl append the current git hash onto the version string
1043 if test -d $srcdir/.git -a "x$GIT" = "xyes"; then
1044 RADIUSD_VERSION_COMMIT=`git log --pretty=format:'%h' -n 1`
1049 dnl #############################################################
1051 dnl # 7. Checks for library functions
1053 dnl #############################################################
1056 LIBS="$LIBS $LIBLTDL"
1057 AC_CHECK_FUNC(lt_dladvise_init, AC_DEFINE(HAVE_LT_DLADVISE_INIT, [], [Do we have the lt_dladvise_init function]))
1060 dnl Check for libcrypt
1061 dnl We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
1062 AC_CHECK_LIB(crypt, crypt,
1065 if test "$CRYPTLIB" != ""; then
1066 AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function])
1068 AC_CHECK_FUNC(crypt, AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function]))
1071 dnl Check for libcipher
1072 AC_CHECK_LIB(cipher, setkey,
1073 CRYPTLIB="${CRYPTLIB} -lcipher"
1077 dnl Check the style of gethostbyaddr, in order of preference
1078 dnl GNU (_r eight args)
1079 AC_DEFINE(GNUSTYLE, [1], [GNU-Style get*byaddr_r])
1080 dnl SYSV (_r six args)
1081 AC_DEFINE(SYSVSTYLE, [2], [SYSV-Style get*byaddr_r])
1082 dnl BSD (three args, may not be thread safe)
1083 AC_DEFINE(BSDSTYLE, [3], [BSD-Style get*byaddr_r])
1084 dnl Tru64 has BSD version, but it is thread safe
1085 dnl http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1739____.HTM
1086 dnl We need #stdio.h to define NULL on FreeBSD (at least)
1087 gethostbyaddrrstyle=""
1088 AC_MSG_CHECKING([gethostbyaddr_r() syntax])
1091 dnl With FreeBSD, check if there's a prototype for gethostbyaddr_r.
1092 dnl Some versions (FreeBSD 5.1?) have a symbol but no prototype - so we
1093 dnl override this test to BSDSTYLE. FreeBSD 6.2 and up have proper GNU
1095 AC_CHECK_DECLS([gethostbyaddr_r], [], [
1096 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE,
1097 [style of gethostbyaddr_r functions ])
1098 gethostbyaddrrstyle=BSD
1099 AC_MSG_WARN([FreeBSD overridden to BSD-style])
1107 if test "x$gethostbyaddrrstyle" = "x"; then
1111 ], [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL, NULL) ], [
1112 AC_DEFINE(GETHOSTBYADDRRSTYLE, GNUSTYLE, [style of gethostbyaddr_r functions ])
1113 gethostbyaddrrstyle=GNU
1116 if test "x$gethostbyaddrrstyle" = "x"; then
1120 ], [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL) ] , [
1121 AC_DEFINE(GETHOSTBYADDRRSTYLE, SYSVSTYLE, [style of gethostbyaddr_r functions ])
1122 gethostbyaddrrstyle=SYSV
1125 if test "x$gethostbyaddrrstyle" = "x"; then
1129 ], [ gethostbyaddr(NULL, 0, 0) ], [
1130 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE, [style of gethostbyaddr_r functions ])
1131 gethostbyaddrrstyle=BSD
1135 if test "x$gethostbyaddrrstyle" = "x"; then
1136 AC_MSG_RESULT([none! It must not exist, here.])
1138 AC_MSG_RESULT([${gethostbyaddrrstyle}-style])
1141 if test "x$gethostbyaddrrstyle" = "xBSD"; then
1142 AC_MSG_WARN([ ****** BSD-style gethostbyaddr might NOT be thread-safe! ****** ])
1145 dnl Check the style of gethostbyname, in order of preference
1146 dnl GNU (_r seven args)
1147 dnl SYSV (_r five args)
1148 dnl BSD (two args, may not be thread safe)
1149 dnl Tru64 has BSD version, but it _is_ thread safe
1150 dnl http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1946____.HTM
1151 dnl We need #stdio.h to define NULL on FreeBSD (at least)
1152 gethostbynamerstyle=""
1153 AC_MSG_CHECKING([gethostbyname_r() syntax])
1157 ], [ gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL) ], [
1158 AC_DEFINE(GETHOSTBYNAMERSTYLE, GNUSTYLE, [style of gethostbyname_r functions ])
1159 gethostbynamerstyle=GNU
1161 if test "x$gethostbynamerstyle" = "x"; then
1165 ], [ gethostbyname_r(NULL, NULL, NULL, 0, NULL) ] , [
1166 AC_DEFINE(GETHOSTBYNAMERSTYLE, SYSVSTYLE, [style of gethostbyname_r functions ])
1167 gethostbynamerstyle=SYSV
1170 if test "x$gethostbynamerstyle" = "x"; then
1174 ], [ gethostbyname(NULL) ], [
1175 AC_DEFINE(GETHOSTBYNAMERSTYLE, BSDSTYLE, [style of gethostbyname_r functions ])
1176 gethostbynamerstyle=BSD
1180 if test "x$gethostbynamerstyle" = "x"; then
1181 AC_MSG_RESULT([none! It must not exist, here.])
1183 AC_MSG_RESULT([${gethostbynamerstyle}-style])
1186 if test "x$gethostbynamerstyle" = "xBSD"; then
1187 AC_MSG_WARN([ ****** BSD-style gethostbyname might NOT be thread-safe! ****** ])
1190 dnl check for non-posix solaris ctime_r (extra buflen int arg)
1191 AC_DEFINE(POSIXSTYLE, [1], [Posix-Style ctime_r])
1192 AC_DEFINE(SOLARISSTYLE, [2], [Solaris-Style ctime_r])
1194 AC_MSG_CHECKING([ctime_r() syntax])
1197 ], [ ctime_r(NULL, NULL, 0) ], [
1198 AC_DEFINE(CTIMERSTYLE, SOLARISSTYLE, [style of ctime_r function])
1199 ctimerstyle="SOLARIS"
1201 if test "x$ctimerstyle" = "x"; then
1204 ], [ ctime_r(NULL, NULL) ], [
1205 AC_DEFINE(CTIMERSTYLE, POSIXSTYLE, [style of ctime_r function])
1210 if test "x$ctimerstyle" = "x"; then
1211 AC_MSG_RESULT([none! It must not exist, here.])
1213 AC_MSG_RESULT([${ctimerstyle}-style])
1216 AC_SUBST(HOSTINFO, $host)
1218 dnl #############################################################
1220 dnl # 8. Checks for system services
1222 dnl #############################################################
1225 dnl # Figure out where libtool is located,
1229 AC_MSG_RESULT([top_builddir=$top_builddir])
1230 dnl # AC_SUBST(top_builddir)
1234 dnl import libtool stuff
1236 dnl #############################################################
1238 dnl # Configure in any module directories.
1240 dnl #############################################################
1242 dnl ############################################################
1243 dnl # Remove any conflicting definitions if autoconf.h
1244 dnl # is being included by a module.
1245 dnl #############################################################
1246 AH_BOTTOM([#include <freeradius-devel/automask.h>])
1248 dnl ############################################################
1249 dnl # make modules by list
1250 dnl #############################################################
1251 if test "x$EXPERIMENTAL" = "xyes"; then
1252 for foo in `ls -1 "${srcdir}"/src/modules | grep rlm_`; do
1253 MODULES="$MODULES $foo"
1257 dnl # make ONLY the stable modules
1259 for foo in `cat "${srcdir}"/src/modules/stable`; do
1260 MODULES="$MODULES $foo"
1264 dnl ############################################################
1265 dnl # Add autoconf subdirs, based on the module list we
1266 dnl # previously created.
1267 dnl #############################################################
1269 for bar in $MODULES; do
1270 if test -f "${srcdir}"/src/modules/$bar/configure; then
1271 mysubdirs="$mysubdirs src/modules/$bar"
1276 dnl # Don't change the variable name here. Autoconf goes bonkers
1279 AC_CONFIG_SUBDIRS($mysubdirs)
1282 dnl #############################################################
1284 dnl # And finally, output the results.
1286 dnl #############################################################
1288 AC_CONFIG_COMMANDS([stamp-h], [echo timestamp > src/include/stamp-h])
1289 AC_CONFIG_COMMANDS([build-radpaths-h], [(cd ./src/include && /bin/sh ./build-radpaths-h)])
1290 AC_CONFIG_COMMANDS([main-chmod], [(cd ./src/main && chmod +x checkrad radlast radtest)])
1291 AC_CONFIG_COMMANDS([scripts-chmod], [(cd ./scripts && chmod +x rc.radiusd radiusd.cron.daily radiusd.cron.monthly cryptpasswd)])
1294 dnl # Substitute whatever libraries we found to be necessary
1297 AC_SUBST(INSTALLSTRIP)
1299 USE_SHARED_LIBS=$enable_shared
1300 AC_SUBST(USE_SHARED_LIBS)
1301 USE_STATIC_LIBS=$enable_static
1302 AC_SUBST(USE_STATIC_LIBS)
1303 AC_SUBST(STATIC_MODULES)
1304 AC_SUBST(RADIUSD_MAJOR_VERSION)
1305 AC_SUBST(RADIUSD_MINOR_VERSION)
1306 AC_SUBST(RADIUSD_INCRM_VERSION)
1307 AC_SUBST(RADIUSD_VERSION)
1308 AC_SUBST(RADIUSD_VERSION_STRING)
1309 AC_SUBST(RADIUSD_VERSION_COMMIT)
1313 ./src/include/build-radpaths-h \
1314 ./src/main/Makefile \
1315 ./src/main/radsniff.mk \
1316 ./src/main/checkrad \
1317 ./src/main/radlast \
1318 ./src/main/radtest \
1319 ./scripts/rc.radiusd \
1320 ./scripts/radiusd.cron.daily \
1321 ./scripts/radiusd.cron.monthly \
1322 ./scripts/cryptpasswd \
1323 ./raddb/dictionary \
1324 ./raddb/radrelay.conf \
1325 ./raddb/radiusd.conf