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 dnl Put this in later, when all distributed modules use autoconf.
154 dnl AC_ARG_WITH(disablemodulefoo,
155 dnl [ --without-rlm_foo Disables module compilation. Module list:]
156 dnl esyscmd([find src/modules -type d -name rlm_\* -print |\
157 dnl sed -e 's%src/modules/.*/% (sub)- %; s%.*/%- %' |\
158 dnl awk '{print " "$0}']))
160 AC_ARG_ENABLE(strict-dependencies,
161 [ --enable-strict-dependencies Fail configure on lack of module dependancy.])
163 dnl extra argument: --with-docdir
164 docdir='${datadir}/doc/freeradius'
165 AC_MSG_CHECKING(docdir)
167 [ --with-docdir=DIR Directory for documentation [DATADIR/doc/freeradius] ],
174 [[\\/$]]* | ?:[[\\/]]* )
178 AC_MSG_ERROR([expected an absolute directory name for --with-docdir: $withval])
183 AC_MSG_RESULT($docdir)
184 if test "x$docdir" = xno; then
185 AC_MSG_WARN(Documentation files will NOT be installed.)
188 dnl extra argument: --with-logdir
189 logdir='${localstatedir}/log/radius'
190 AC_MSG_CHECKING(logdir)
192 [ --with-logdir=DIR Directory for logfiles [LOCALSTATEDIR/log/radius] ],
195 AC_MSG_ERROR(Need logdir)
199 [[\\/$]]* | ?:[[\\/]]* )
203 AC_MSG_ERROR([expected an absolute directory name for --with-logdir: $withval])
208 AC_MSG_RESULT($logdir)
210 dnl extra argument: --with-radacctdir
211 radacctdir='${logdir}/radacct'
212 AC_MSG_CHECKING(radacctdir)
213 AC_ARG_WITH(radacctdir,
214 [ --with-radacctdir=DIR Directory for detail files [LOGDIR/radacct] ],
217 AC_MSG_ERROR(Need radacctdir)
221 [[\\/$]]* | ?:[[\\/]]* )
222 radacctdir="$withval"
225 AC_MSG_ERROR([expected an absolute directory name for --with-radacctdir: $withval])
230 AC_MSG_RESULT($radacctdir)
232 dnl extra argument: --with-raddbdir
233 raddbdir='${sysconfdir}/raddb'
234 AC_MSG_CHECKING(raddbdir)
235 AC_ARG_WITH(raddbdir,
236 [ --with-raddbdir=DIR Directory for config files [SYSCONFDIR/raddb] ],
239 AC_MSG_ERROR(Need raddbdir)
243 [[\\/$]]* | ?:[[\\/]]* )
247 AC_MSG_ERROR([expected an absolute directory name for --with-raddbdir: $withval])
252 AC_MSG_RESULT($raddbdir)
254 dnl extra argument: --with-ascend-binary
255 WITH_ASCEND_BINARY=yes
256 AC_ARG_WITH(ascend-binary,
257 [ --with-ascend-binary Include support for Ascend binary filter attributes (default=yes)],
262 WITH_ASCEND_BINARY=no
265 if test "x$WITH_ASCEND_BINARY" = "xyes"; then
266 AC_DEFINE(WITH_ASCEND_BINARY, [1], [Include support for Ascend binary filter attributes])
269 dnl extra argument: --with-threads
272 [ --with-threads Use threads, if available. (default=yes) ],
281 dnl extra argument: --with-tcp
284 [ --with-tcp Compile in TCP support. (default=yes)],
292 if test "x$WITH_TCP" = "xyes"; then
293 AC_DEFINE(WITH_TCP, [1], [define if you want TCP support (For RADSec et al)])
296 dnl extra argument: --with-vmps
299 [ --with-vmps Compile in VMPS support. (default=yes)],
307 if test "x$WITH_VMPS" = "xyes"; then
308 AC_DEFINE(WITH_VMPS, [1], [define if you want VMPS support])
311 dnl extra argument: --with-dhcp
314 [ --with-dhcp Compile in DHCP support. (default=yes)],
322 if test "x$WITH_DHCP" = "xyes"; then
323 AC_DEFINE(WITH_DHCP, [1], [define if you want DHCP support])
327 dnl # Allow the user to specify a list of modules to be linked
328 dnl # statically to the server.
331 AC_ARG_WITH(static_modules,
332 [ --with-static-modules=QUOTED-MODULE-LIST],[
333 for i in $withval; do
334 STATIC_MODULES="$STATIC_MODULES -dlpreopen ../modules/rlm_$i/rlm_$i.la"
340 [ --with-modules=QUOTED-MODULE-LIST],[
341 for i in $withval; do
342 MODULES="$MODULES $i"
346 dnl extra argument: --with-experimental-modules
348 AC_ARG_WITH(experimental-modules,
349 [ --with-experimental-modules Use experimental and unstable modules. (default=no, unless --enable-developer=yes) ],
361 dnl extra argument: --with-openssl
364 [ --with-openssl Use OpenSSL. (default=yes)],
376 dnl # extra argument: --with-openssl-includes=dir
379 AC_ARG_WITH(openssl-includes,
380 [ --with-openssl-includes=DIR Directory to look for OpenSSL include files],
382 *) OPENSSL_INCLUDE_DIR="$withval"
388 dnl # extra argument: --with-openssl-libraries=dir
391 AC_ARG_WITH(openssl-libraries,
392 [ --with-openssl-libraries=DIR Directory to look for OpenSSL library files],
394 *) OPENSSL_LIB_DIR="$withval"
400 dnl # These next two arguments don't actually do anything. They're
401 dnl # place holders so that the top-level configure script can tell
402 dnl # the user how to configure lower-level modules
406 dnl # extra argument: --with-rlm-FOO-lib-dir
408 AC_ARG_WITH(rlm-FOO-lib-dir,
409 [ --with-rlm-FOO-lib-dir=DIR Directory to look for library files used by module FOO],
417 dnl # extra argument: --with-rlm-FOO-include-dir
419 AC_ARG_WITH(rlm-FOO-include-dir,
420 [ --with-rlm-FOO-include-dir=DIR Directory to look for include files used by module FOO],
427 dnl See what include-style is used by the make program.
428 dnl AC_MSG_CHECKING(include style for make)
429 dnl echo "include /dev/null" > testmake.$$
430 dnl echo "all:" >> testmake.$$
431 dnl make -f testmake.$$ >/dev/null 2>&1
440 dnl rm -f testmake.$$
441 dnl AC_MSG_RESULT(" $INCLUDE")
442 dnl AC_SUBST(INCLUDE)
445 dnl extra argument: --with-udpfromto
447 AC_ARG_WITH(udpfromto,
448 [ --with-udpfromto Compile in UDPFROMTO support. (default=no)],
458 if test "x$WITH_UDPFROMTO" = "xyes"; then
459 AC_DEFINE(WITH_UDPFROMTO, [], [define if you want udpfromto])
462 dnl #############################################################
464 dnl # 1. Checks for programs
466 dnl #############################################################
469 AC_PATH_PROG(PERL, perl, /usr/local/bin/perl)
470 if test "x$ac_cv_path_PERL" = "x"; then
471 AC_MSG_WARN(perl not found - Simultaneous-Use and checkrad may not work)
473 AC_PATH_PROG(SNMPGET, snmpget)
474 if test "x$ac_cv_path_SNMPGET" = "x"; then
475 AC_MSG_WARN(snmpget not found - Simultaneous-Use and checkrad may not work)
478 AC_PATH_PROG(SNMPWALK, snmpwalk)
479 if test "x$ac_cv_path_SNMPWALK" = "x"; then
480 AC_MSG_WARN(snmpwalk not found - Simultaneous-Use and checkrad may not work)
483 AC_PATH_PROG(RUSERS, rusers, /usr/bin/rusers)
485 dnl FIXME This is truly gross.
486 missing_dir=`cd $ac_aux_dir && pwd`
487 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
488 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
489 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
491 AC_PATH_PROG(LOCATE,locate)
492 AC_PATH_PROG(DIRNAME,dirname)
493 AC_PATH_PROG(GREP,grep)
495 dnl #############################################################
497 dnl # 2. Checks for libraries
499 dnl #############################################################
501 dnl If using pthreads, check for -lpthread (posix) or -lc_r (*BSD)
503 if test "x$WITH_THREADS" = "xyes"; then
504 if test $ac_cv_prog_suncc = "yes"; then
508 AC_CHECK_HEADERS(pthread.h, [], [ WITH_THREADS="no" ])
511 dnl # pthread stuff is usually in -lpthread
512 dnl # or in -lc_r, on *BSD
514 dnl # On Some systems, we need extra pre-processor flags, to get them to
515 dnl # to do the threading properly.
517 AC_CHECK_LIB(pthread, pthread_create,
518 [ CFLAGS="$CFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS"
519 LIBS="-lpthread $LIBS" ],
520 [ AC_CHECK_LIB(c_r, pthread_create,
521 [ CFLAGS="$CFLAGS -pthread -D_THREAD_SAFE" ],
522 [ WITH_THREADS="no" ]
528 dnl # If we have NO pthread libraries, remove any knowledge of threads.
530 if test "x$WITH_THREADS" != "xyes"; then
532 ac_cv_header_pthread_h="no"
536 dnl # We need sem_init() and friends, as they're the friendliest
537 dnl # semaphore functions for threading.
539 dnl # HP/UX requires linking with librt, too, to get the sem_* symbols.
540 dnl # Some systems have them in -lsem
541 dnl # Solaris has them in -lposix4
542 dnl # NetBSD has them in -lsemaphore
544 AC_SEARCH_LIBS(sem_init, pthread sem posix4 rt semaphore,
546 [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)]
550 if test "x$WITH_THREADS" = "xyes"; then
551 AC_DEFINE(WITH_THREADS, [1], [define if you want thread support])
554 dnl Check if we need -lsocket
555 AC_CHECK_LIB(dl, dlopen)
557 dnl Check if we need -lsocket
558 AC_CHECK_LIB(socket, getsockname)
560 dnl Check for -lresolv
561 dnl This library may be needed later.
562 AC_CHECK_LIB(resolv, inet_aton)
564 dnl Check if we need -lnsl. Usually if we want to
565 dnl link against -lsocket we need to include -lnsl as well.
566 AC_CHECK_LIB(nsl, inet_ntoa)
568 dnl Check for OpenSSL libraries.
570 if test "x$WITH_OPENSSL" = xyes; then
572 old_LDFLAGS="$LDFLAGS"
573 if test "x$OPENSSL_LIB_DIR" != "x"; then
574 LDFLAGS="$LDFLAGS -L$OPENSSL_LIB_DIR"
576 AC_CHECK_LIB(crypto, DH_new,
578 LIBS="-lcrypto $LIBS"
579 AC_DEFINE(HAVE_LIBCRYPTO, 1,
580 [Define to 1 if you have the `crypto' library (-lcrypto).])
581 AC_CHECK_LIB(ssl, SSL_new,
583 AC_DEFINE(HAVE_LIBSSL, 1,
584 [Define to 1 if you have the `ssl' library (-lssl).])
585 if test "x$OPENSSL_LIB_DIR" != "x"; then
586 OPENSSL_LIBS="-L$OPENSSL_LIB_DIR"
588 OPENSSL_LIBS="$OPENSSL_LIBS -lcrypto -lssl -lcrypto"
592 LDFLAGS="$old_LDFLAGS"
595 AC_CHECK_LIB(ws2_32, htonl)
597 dnl Check the pcap library for the RADIUS sniffer.
599 AC_CHECK_LIB(pcap, pcap_open_live,
601 AC_DEFINE(HAVE_LIBPCAP, 1,
602 [Define to 1 if you have the `pcap' library (-lpcap).])
604 [ AC_MSG_WARN([pcap library not found, silently disabling the RADIUS sniffer.]) ])
608 dnl #############################################################
610 dnl # 3. Checks for header files
612 dnl #############################################################
615 dnl # Interix requires us to set -D_ALL_SOURCE, otherwise
616 dnl # getopt will be #included, but won't link. <sigh>
621 CFLAGS="$CFLAGS -D_ALL_SOURCE"
624 CFLAGS="$CFLAGS -DDARWIN"
625 LIBS="-framework DirectoryService $LIBS"
676 dnl FreeBSD requires sys/socket.h before net/if.h
677 AC_CHECK_HEADERS(net/if.h, [], [],
678 [#ifdef HAVE_SYS_SOCKET_H
679 # include <sys/socket.h>
684 AC_CHECK_HEADER(pcreposix.h, AC_DEFINE(HAVE_PCREPOSIX_H, [], [define this if we have the <pcreposix.h> header file]))
685 if test "x$ac_cv_header_pcreposix_h" = "xyes"; then
686 AC_DEFINE(HAVE_REGEX_H, [], [define if we have any regex])
690 LIBS="$LIBS -lpcreposix"
693 AC_CHECK_HEADER(regex.h, AC_DEFINE(HAVE_REGEX_H, [], [define this if we have the <regex.h> header file]))
694 if test "x$ac_cv_header_regex_h" = "xyes"; then
703 ], [AC_DEFINE(HAVE_REG_EXTENDED, [], [define this if we have REG_EXTENDED (from <regex.h>)]) REGEX_EXTENDED=yes])
709 AC_SUBST(REGEX_EXTENDED)
712 dnl # other checks which require headers
714 if test "x$ac_cv_header_sys_security_h" = "xyes" && test "x$ac_cv_header_prot_h" = "xyes"
716 AC_DEFINE(OSFC2, [], [define if you have OSFC2 authentication])
719 if test "x$ac_cv_header_sia_h" = "xyes" && test "x$ac_cv_header_siad_h" = "xyes"
721 AC_DEFINE(OSFSIA, [], [define if you have OSFSIA authentication])
724 dnl Check for OpenSSL includes.
725 OPENSSL_INCLUDE="-DNO_OPENSSL"
726 if test "x$WITH_OPENSSL" = xyes; then
727 if test "x$OPENSSL_LIBS" = "x"; then
728 AC_MSG_NOTICE([skipping test for openssl/ssl.h])
730 old_CPPFLAGS=$CPPFLAGS
731 if test "x$OPENSSL_INCLUDE_DIR" != "x"; then
732 CPPFLAGS="$CPPFLAGS -I$OPENSSL_INCLUDE_DIR"
734 dnl # stupid RedHat shit
735 CPPFLAGS="$CPPFLAGS -DOPENSSL_NO_KRB5"
749 if test "x$OPENSSL_LIBS" != "x"; then
750 AC_MSG_CHECKING([for OpenSSL version >= 0.9.7])
752 [#include <openssl/crypto.h>
753 #if (OPENSSL_VERSION_NUMBER >= 0x00907000L)
757 if test "x$goodssl" != "xyes"; then
762 if test "x$OPENSSL_INCLUDE_DIR" != "x"; then
763 OPENSSL_INCLUDE="-I$OPENSSL_INCLUDE_DIR -DOPENSSL_NO_KRB5"
765 OPENSSL_INCLUDE="-DOPENSSL_NO_KRB5"
769 CPPFLAGS=$old_CPPFLAGS
772 AC_SUBST(OPENSSL_INCLUDE)
773 AC_SUBST(OPENSSL_LIBS)
776 dnl Check the pcap includes for the RADIUS sniffer.
777 if test "x$PCAP_LIBS" = x; then
778 AC_MSG_NOTICE([skipping test for pcap.h.])
780 AC_CHECK_HEADER(pcap.h,
781 AC_DEFINE(HAVE_PCAP_H, 1,
782 [Define to 1 if you have the <pcap.h> header file.]),
784 AC_MSG_WARN([pcap.h not found, silently disabling the RADIUS sniffer.])
787 AC_CHECK_LIB(pcap, pcap_fopen_offline,
788 [ AC_DEFINE(HAVE_PCAP_FOPEN_OFFLINE, 1,
789 [Define to 1 if you have the function pcap_fopen_offline.])
791 AC_CHECK_LIB(pcap, pcap_dump_fopen,
792 [ AC_DEFINE(HAVE_PCAP_DUMP_FOPEN, 1,
793 [Define to 1 if you have the function pcap_dump_fopen.])
798 dnl #############################################################
800 dnl # 4. Checks for typedefs
802 dnl #############################################################
805 dnl # Ensure that these are defined
812 dnl check for socklen_t
813 FR_CHECK_TYPE_INCLUDE([
814 #ifdef HAVE_SYS_TYPES_H
815 #include <sys/types.h>
817 #ifdef HAVE_SYS_SOCKET_H
818 #include <sys/socket.h>
820 ],socklen_t, int, [socklen_t is generally 'int' on systems which don't use it])
822 dnl check for uint8_t
823 FR_CHECK_TYPE_INCLUDE([
824 #ifdef HAVE_INTTYPES_H
825 #include <inttypes.h>
830 ],uint8_t, unsigned char, [uint8_t should be the canonical 'octet' for network traffic])
832 dnl check for uint16_t
833 FR_CHECK_TYPE_INCLUDE([
834 #ifdef HAVE_INTTYPES_H
835 #include <inttypes.h>
840 ],uint16_t, unsigned short, [uint16_t should be the canonical '2 octets' for network traffic])
842 dnl check for uint32_t
843 FR_CHECK_TYPE_INCLUDE([
844 #ifdef HAVE_INTTYPES_H
845 #include <inttypes.h>
850 ],uint32_t, unsigned int, [uint32_t should be the canonical 'network integer])
852 AC_CHECK_TYPE(struct in6_addr, AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1, [IPv6 address structure]), [], [
853 #ifdef HAVE_NETINET_IN_H
854 #include <netinet/in.h>
858 AC_CHECK_TYPE(struct sockaddr_storage, AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1, [Generic socket addresses]), [], [
859 #ifdef HAVE_NETINET_IN_H
860 #include <netinet/in.h>
862 #ifdef HAVE_SYS_SOCKET_H
863 #include <sys/socket.h>
867 AC_CHECK_TYPE(struct sockaddr_in6, AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1, [IPv6 socket addresses]), [], [
868 #ifdef HAVE_NETINET_IN_H
869 #include <netinet/in.h>
873 AC_CHECK_TYPE(struct addrinfo, AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1, [Generic DNS lookups]), [], [
874 #ifdef HAVE_SYS_TYPES_H
875 #include <sys/types.h>
877 #ifdef HAVE_SYS_SOCKET_H
878 #include <sys/socket.h>
885 dnl #############################################################
887 dnl # 5. Checks for structures and functions
889 dnl #############################################################
924 RADIUSD_NEED_DECLARATIONS( \
936 dnl # check if we have utmpx.h
937 dnl # if so, check if struct utmpx has entry ut_xtime
938 dnl # if not, set it to define ut_xtime == ut_tv.tv_sec
939 if test "x$ac_cv_header_utmpx_h" = "xyes"
941 FR_CHECK_STRUCT_HAS_MEMBER([#include <utmpx.h>], [struct utmpx], ut_xtime)
942 if test "x$ac_cv_type_struct_utmpx_has_ut_xtime" = "x"
944 AC_DEFINE(ut_xtime,ut_tv.tv_sec, [define to something if you don't have ut_xtime in struct utmpx])
948 dnl # struct ip_pktinfo
949 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in_pktinfo], ipi_addr)
950 if test "x$ac_cv_type_struct_in_pktinfo_has_ipi_addr" = "xyes"
952 AC_DEFINE(HAVE_IP_PKTINFO, [], [define if you have IP_PKTINFO (Linux)])
955 dnl # struct in6_pktinfo
956 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in6_pktinfo], ipi6_addr)
957 if test "x$ac_cv_type_struct_in6_pktinfo_has_ipi6_addr" = "xyes"
959 AC_DEFINE(HAVE_IN6_PKTINFO, [], [define if you have IN6_PKTINFO (Linux)])
962 dnl #############################################################
964 dnl # 6. Checks for compiler characteristics
966 dnl #############################################################
969 dnl # Ensure that these are defined
974 dnl # See if this is OS/2
976 AC_MSG_CHECKING(type of OS)
979 if test "$OS" = "OS/2"; then
986 AC_MSG_CHECKING(for developer gcc flags)
989 if test "x$developer" = "xyes"; then
990 if test "x$GCC" = "xyes"; then
991 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"
992 CFLAGS="$CFLAGS $devflags"
994 AC_MSG_RESULT(yes. Using $devflags)
997 if test "x$EXPERIMENTAL" != "xno"; then
1002 CFLAGS="$CFLAGS -DNDEBUG"
1009 dnl append the current git hash onto the version string
1010 if test -d $srcdir/.git -a "x$GIT" = "xyes"; then
1011 RADIUSD_VERSION_COMMIT=`git log --pretty=format:'%h' -n 1`
1012 AC_DEFINE_UNQUOTED([RADIUSD_VERSION_COMMIT],["${RADIUSD_VERSION_COMMIT}"],[Commit HEAD at time of configuring])
1017 dnl #############################################################
1019 dnl # 7. Checks for library functions
1021 dnl #############################################################
1023 dnl Check for talloc
1024 dnl extra argument: --with-talloc-include-dir=DIR
1026 AC_ARG_WITH(talloc-include-dir,
1027 [AS_HELP_STRING([--with-talloc-include-dir=DIR],
1028 [Directory where the talloc includes may be found])],
1031 AC_MSG_ERROR(Need talloc-include-dir)
1036 talloc_include_dir="$withval"
1040 dnl Check for talloc header files
1042 smart_try_dir="$talloc_include_dir"
1043 FR_SMART_CHECK_INCLUDE([talloc.h])
1044 if test "x$ac_cv_header_talloc_h" != "xyes"; then
1045 AC_MSG_WARN([talloc headers not found. Use --with-talloc-include-dir=<path>.])
1046 AC_MSG_ERROR([FreeRADIUS requires libtalloc])
1048 INCLUDE="${SMART_CFLAGS} ${INCLUDE}"
1049 LIBS="-ltalloc ${LIBS}"
1052 dnl Check for libcrypt
1053 dnl We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
1054 AC_CHECK_LIB(crypt, crypt,
1057 if test "$CRYPTLIB" != ""; then
1058 AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function])
1060 AC_CHECK_FUNC(crypt, AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function]))
1063 dnl Check for libcipher
1064 AC_CHECK_LIB(cipher, setkey,
1065 CRYPTLIB="${CRYPTLIB} -lcipher"
1069 dnl Check the style of gethostbyaddr, in order of preference
1070 dnl GNU (_r eight args)
1071 AC_DEFINE(GNUSTYLE, [1], [GNU-Style get*byaddr_r])
1072 dnl SYSV (_r six args)
1073 AC_DEFINE(SYSVSTYLE, [2], [SYSV-Style get*byaddr_r])
1074 dnl BSD (three args, may not be thread safe)
1075 AC_DEFINE(BSDSTYLE, [3], [BSD-Style get*byaddr_r])
1076 dnl Tru64 has BSD version, but it is thread safe
1077 dnl http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1739____.HTM
1078 dnl We need #stdio.h to define NULL on FreeBSD (at least)
1079 gethostbyaddrrstyle=""
1080 AC_MSG_CHECKING([gethostbyaddr_r() syntax])
1083 dnl With FreeBSD, check if there's a prototype for gethostbyaddr_r.
1084 dnl Some versions (FreeBSD 5.1?) have a symbol but no prototype - so we
1085 dnl override this test to BSDSTYLE. FreeBSD 6.2 and up have proper GNU
1087 AC_CHECK_DECLS([gethostbyaddr_r], [], [
1088 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE,
1089 [style of gethostbyaddr_r functions ])
1090 gethostbyaddrrstyle=BSD
1091 AC_MSG_WARN([FreeBSD overridden to BSD-style])
1099 if test "x$gethostbyaddrrstyle" = "x"; then
1103 ], [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL, NULL) ], [
1104 AC_DEFINE(GETHOSTBYADDRRSTYLE, GNUSTYLE, [style of gethostbyaddr_r functions ])
1105 gethostbyaddrrstyle=GNU
1108 if test "x$gethostbyaddrrstyle" = "x"; then
1112 ], [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL) ] , [
1113 AC_DEFINE(GETHOSTBYADDRRSTYLE, SYSVSTYLE, [style of gethostbyaddr_r functions ])
1114 gethostbyaddrrstyle=SYSV
1117 if test "x$gethostbyaddrrstyle" = "x"; then
1121 ], [ gethostbyaddr(NULL, 0, 0) ], [
1122 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE, [style of gethostbyaddr_r functions ])
1123 gethostbyaddrrstyle=BSD
1127 if test "x$gethostbyaddrrstyle" = "x"; then
1128 AC_MSG_RESULT([none! It must not exist, here.])
1130 AC_MSG_RESULT([${gethostbyaddrrstyle}-style])
1133 if test "x$gethostbyaddrrstyle" = "xBSD"; then
1134 AC_MSG_WARN([ ****** BSD-style gethostbyaddr might NOT be thread-safe! ****** ])
1137 dnl Check the style of gethostbyname, in order of preference
1138 dnl GNU (_r seven args)
1139 dnl SYSV (_r five args)
1140 dnl BSD (two args, may not be thread safe)
1141 dnl Tru64 has BSD version, but it _is_ thread safe
1142 dnl http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1946____.HTM
1143 dnl We need #stdio.h to define NULL on FreeBSD (at least)
1144 gethostbynamerstyle=""
1145 AC_MSG_CHECKING([gethostbyname_r() syntax])
1149 ], [ gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL) ], [
1150 AC_DEFINE(GETHOSTBYNAMERSTYLE, GNUSTYLE, [style of gethostbyname_r functions ])
1151 gethostbynamerstyle=GNU
1153 if test "x$gethostbynamerstyle" = "x"; then
1157 ], [ gethostbyname_r(NULL, NULL, NULL, 0, NULL) ] , [
1158 AC_DEFINE(GETHOSTBYNAMERSTYLE, SYSVSTYLE, [style of gethostbyname_r functions ])
1159 gethostbynamerstyle=SYSV
1162 if test "x$gethostbynamerstyle" = "x"; then
1166 ], [ gethostbyname(NULL) ], [
1167 AC_DEFINE(GETHOSTBYNAMERSTYLE, BSDSTYLE, [style of gethostbyname_r functions ])
1168 gethostbynamerstyle=BSD
1172 if test "x$gethostbynamerstyle" = "x"; then
1173 AC_MSG_RESULT([none! It must not exist, here.])
1175 AC_MSG_RESULT([${gethostbynamerstyle}-style])
1178 if test "x$gethostbynamerstyle" = "xBSD"; then
1179 AC_MSG_WARN([ ****** BSD-style gethostbyname might NOT be thread-safe! ****** ])
1182 dnl check for non-posix solaris ctime_r (extra buflen int arg)
1183 AC_DEFINE(POSIXSTYLE, [1], [Posix-Style ctime_r])
1184 AC_DEFINE(SOLARISSTYLE, [2], [Solaris-Style ctime_r])
1186 AC_MSG_CHECKING([ctime_r() syntax])
1189 ], [ ctime_r(NULL, NULL, 0) ], [
1190 AC_DEFINE(CTIMERSTYLE, SOLARISSTYLE, [style of ctime_r function])
1191 ctimerstyle="SOLARIS"
1193 if test "x$ctimerstyle" = "x"; then
1196 ], [ ctime_r(NULL, NULL) ], [
1197 AC_DEFINE(CTIMERSTYLE, POSIXSTYLE, [style of ctime_r function])
1202 if test "x$ctimerstyle" = "x"; then
1203 AC_MSG_RESULT([none! It must not exist, here.])
1205 AC_MSG_RESULT([${ctimerstyle}-style])
1208 AC_SUBST(HOSTINFO, $host)
1210 dnl #############################################################
1212 dnl # 8. Checks for system services
1214 dnl #############################################################
1217 dnl # Figure out where libtool is located,
1221 AC_MSG_RESULT([top_builddir=$top_builddir])
1222 dnl # AC_SUBST(top_builddir)
1224 dnl import libtool stuff
1226 dnl #############################################################
1228 dnl # Configure in any module directories.
1230 dnl #############################################################
1232 dnl ############################################################
1233 dnl # Remove any conflicting definitions if autoconf.h
1234 dnl # is being included by a module.
1235 dnl #############################################################
1236 AH_BOTTOM([#include <freeradius-devel/automask.h>])
1238 dnl ############################################################
1239 dnl # make modules by list
1240 dnl #############################################################
1241 if test "x$EXPERIMENTAL" = "xyes"; then
1242 for foo in `ls -1 "${srcdir}"/src/modules | grep rlm_`; do
1243 MODULES="$MODULES $foo"
1247 dnl # make ONLY the stable modules
1249 for foo in `cat "${srcdir}"/src/modules/stable`; do
1250 MODULES="$MODULES $foo"
1254 dnl ############################################################
1255 dnl # Add autoconf subdirs, based on the module list we
1256 dnl # previously created.
1257 dnl #############################################################
1259 for bar in $MODULES; do
1260 if test -f "${srcdir}"/src/modules/$bar/configure; then
1261 mysubdirs="$mysubdirs src/modules/$bar"
1266 dnl # Don't change the variable name here. Autoconf goes bonkers
1269 AC_CONFIG_SUBDIRS($mysubdirs)
1272 dnl #############################################################
1274 dnl # And finally, output the results.
1276 dnl #############################################################
1278 AC_CONFIG_COMMANDS([stamp-h], [echo timestamp > src/include/stamp-h])
1279 AC_CONFIG_COMMANDS([build-radpaths-h], [(cd ./src/include && /bin/sh ./build-radpaths-h)])
1280 AC_CONFIG_COMMANDS([main-chmod], [(cd ./src/main && chmod +x checkrad radlast radtest)])
1281 AC_CONFIG_COMMANDS([scripts-chmod], [(cd ./scripts && chmod +x rc.radiusd radiusd.cron.daily radiusd.cron.monthly cryptpasswd)])
1284 dnl # Substitute whatever libraries we found to be necessary
1287 AC_SUBST(INSTALLSTRIP)
1289 USE_SHARED_LIBS=$enable_shared
1290 AC_SUBST(USE_SHARED_LIBS)
1291 USE_STATIC_LIBS=$enable_static
1292 AC_SUBST(USE_STATIC_LIBS)
1293 AC_SUBST(STATIC_MODULES)
1297 ./src/include/build-radpaths-h \
1298 ./src/main/radsniff.mk \
1299 ./src/main/checkrad \
1300 ./src/main/radlast \
1301 ./src/main/radtest \
1302 ./scripts/rc.radiusd \
1303 ./scripts/radiusd.cron.daily \
1304 ./scripts/radiusd.cron.monthly \
1305 ./scripts/cryptpasswd \
1306 ./raddb/dictionary \
1307 ./raddb/radrelay.conf \
1308 ./raddb/radiusd.conf