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(src/main/radiusd.c)
29 AC_CONFIG_HEADER(src/include/autoconf.h)
31 dnl # The version of the software
33 RADIUSD_MAJOR_VERSION=`cat VERSION | sed 's/\..*//'`
34 RADIUSD_MINOR_VERSION=`cat VERSION | sed 's/^[[^\.]]*\.//' | sed 's/\..*$//'`
35 RADIUSD_INCRM_VERSION=`cat VERSION | sed 's/^.*\..*\.//' | sed 's/[[\.-]].*$//'`
37 RADIUSD_VERSION=`echo | awk -v major="$RADIUSD_MAJOR_VERSION" \
38 -v minor="$RADIUSD_MINOR_VERSION" \
39 -v incrm="$RADIUSD_INCRM_VERSION" \
40 '{ printf "%02i%02i%02i", major, minor, incrm }'`
42 dnl # Still useful for custom builds
43 RADIUSD_VERSION_STRING=`cat VERSION`
46 dnl #############################################################
48 dnl # 0. Checks for compiler, libtool, and command line options.
50 dnl #############################################################
52 dnl Get system information
60 dnl # check for AIX, to allow us to use some BSD functions
61 dnl # must be before macros that call the compiler.
65 AC_PROG_GCC_TRADITIONAL
70 dnl # Set Default CFLAGS
72 if test "x$GCC" = "xyes"; then
73 CFLAGS="$CFLAGS -Wall -D_GNU_SOURCE"
76 dnl Compile in large (2G+) file support.
79 dnl # check for system bytesex
80 dnl # AC_DEFINES WORDS_BIGENDIAN
84 AC_CHECK_PROG(GMAKE, gmake, yes, no)
85 if test $GMAKE = no; then
86 AC_PATH_PROG(MAKE, make, /usr/local/bin/make)
88 AC_PATH_PROG(MAKE, gmake, /usr/local/gnu/bin/make)
90 makever=`$ac_cv_path_MAKE --version 2>&1 | grep "GNU Make"`
91 if test -z "$makever"; then
92 AC_MSG_ERROR(GNU Make is not installed. Please download and install it
93 from ftp://prep.ai.mit.edu/pub/gnu/make/ before continuing.)
96 dnl See if we have Git.
97 AC_CHECK_PROG(GIT, git, yes, no)
99 AC_ARG_WITH(system-libltdl,
100 [ --with-system-libltdl Use the libltdl installed in your system (default=use our own)],
103 INCLTDL=-DWITH_SYSTEM_LTDL
107 dnl If libltdl isn't installable, set it to be installable.
108 [test x"$enable_ltdl_install" = x && enable_ltdl_install=yes]
109 AC_LIBLTDL_INSTALLABLE
111 dnl tell Makefile to build ltdl if needed
112 if test x"$enable_ltdl_install" = x"yes"; then
116 AC_SUBST(LTDL_SUBDIRS)
118 dnl set this shit so it doesn't force CFLAGS...
121 dnl use system-wide libtool, if it exists
122 AC_ARG_WITH(system-libtool,
123 [ --with-system-libtool Use the libtool installed in your system (default=use our own)],
124 [ AC_PATH_PROG(LIBTOOL, libtool,,$PATH:/usr/local/bin) AC_LIBTOOL_DLOPEN
127 LIBTOOL="`pwd`/libtool"
129 dnl ensure that we're looking for dlopen
132 dnl Figure out how to build shared libraries
137 dnl Put this in later, when all distributed modules use autoconf.
138 dnl AC_ARG_WITH(disablemodulefoo,
139 dnl [ --without-rlm_foo Disables module compilation. Module list:]
140 dnl esyscmd([find src/modules -type d -name rlm_\* -print |\
141 dnl sed -e 's%src/modules/.*/% (sub)- %; s%.*/%- %' |\
142 dnl awk '{print " "$0}']))
144 AC_ARG_ENABLE(strict-dependencies,
145 [ --enable-strict-dependencies Fail configure on lack of module dependancy.])
147 dnl extra argument: --with-docdir
148 docdir='${datadir}/doc/freeradius'
149 AC_MSG_CHECKING(docdir)
151 [ --with-docdir=DIR Directory for documentation [DATADIR/doc/freeradius] ],
158 [[\\/$]]* | ?:[[\\/]]* )
162 AC_MSG_ERROR([expected an absolute directory name for --with-docdir: $withval])
167 AC_MSG_RESULT($docdir)
168 if test "x$docdir" = xno; then
169 AC_MSG_WARN(Documentation files will NOT be installed.)
172 dnl extra argument: --with-logdir
173 logdir='${localstatedir}/log/radius'
174 AC_MSG_CHECKING(logdir)
176 [ --with-logdir=DIR Directory for logfiles [LOCALSTATEDIR/log/radius] ],
179 AC_MSG_ERROR(Need logdir)
183 [[\\/$]]* | ?:[[\\/]]* )
187 AC_MSG_ERROR([expected an absolute directory name for --with-logdir: $withval])
192 AC_MSG_RESULT($logdir)
194 dnl extra argument: --with-radacctdir
195 radacctdir='${logdir}/radacct'
196 AC_MSG_CHECKING(radacctdir)
197 AC_ARG_WITH(radacctdir,
198 [ --with-radacctdir=DIR Directory for detail files [LOGDIR/radacct] ],
201 AC_MSG_ERROR(Need radacctdir)
205 [[\\/$]]* | ?:[[\\/]]* )
206 radacctdir="$withval"
209 AC_MSG_ERROR([expected an absolute directory name for --with-radacctdir: $withval])
214 AC_MSG_RESULT($radacctdir)
216 dnl extra argument: --with-raddbdir
217 raddbdir='${sysconfdir}/raddb'
218 AC_MSG_CHECKING(raddbdir)
219 AC_ARG_WITH(raddbdir,
220 [ --with-raddbdir=DIR Directory for config files [SYSCONFDIR/raddb] ],
223 AC_MSG_ERROR(Need raddbdir)
227 [[\\/$]]* | ?:[[\\/]]* )
231 AC_MSG_ERROR([expected an absolute directory name for --with-raddbdir: $withval])
236 AC_MSG_RESULT($raddbdir)
238 dnl extra argument: --with-ascend-binary
240 AC_ARG_WITH(ascend-binary,
241 [ --with-ascend-binary Include support for Ascend binary filter attributes (default=yes)],
249 if test "X$ASCEND_BINARY" = "Xyes"; then
250 AC_DEFINE(ASCEND_BINARY, [], [Include support for Ascend binary filter attributes])
253 dnl extra argument: --with-threads
256 [ --with-threads Use threads, if available. (default=yes) ],
265 dnl extra argument: --with-vmps
268 [ --with-vmps Compile in VMPS support. (default=yes)],
276 if test "x$WITH_VMPS" = "xyes"; then
277 AC_DEFINE(WITH_VMPS, [1], [define if you want VMPS support])
280 dnl extra argument: --with-dhcp
283 [ --with-dhcp Compile in DHCP support. (default=yes)],
291 if test "x$WITH_DHCP" = "xyes"; then
292 AC_DEFINE(WITH_DHCP, [1], [define if you want DHCP support])
296 dnl extra argument: --with-post-proxy-authorize
297 WITH_POST_PROXY_AUTHORIZE=
298 AC_ARG_WITH(post-proxy-authorize,
299 [ --with-post-proxy-authorize 1.x compatibility (default=no) ],
302 WITH_POST_PROXY_AUTHORIZE=""
310 dnl # Allow the user to specify a list of modules to be linked
311 dnl # statically to the server.
314 AC_ARG_WITH(static_modules,
315 [ --with-static-modules=QUOTED-MODULE-LIST],[
316 for i in $withval; do
317 STATIC_MODULES="$STATIC_MODULES -dlpreopen ../modules/rlm_$i/rlm_$i.la"
323 [ --with-modules=QUOTED-MODULE-LIST],[
324 for i in $withval; do
325 MODULES="$MODULES $i"
330 dnl # Enable developer C compiler warnings
332 AC_ARG_ENABLE(developer,
333 [ --enable-developer Enables features of interest to developers.],
334 [ case "$enableval" in
343 if test -d $srcdir/.git; then
344 if test "x$developer" != "xno"; then
345 dnl turn on the developer flag when taken from a git checkout (not a release)
349 dnl append the current git hash onto the version string
350 if test "x$GIT" = "xyes"; then
351 RADIUSD_VERSION_COMMIT=`git log --pretty=format:'%h' -n 1`
355 dnl extra argument: --with-experimental-modules
357 AC_ARG_WITH(experimental-modules,
358 [ --with-experimental-modules Use experimental and unstable modules. (default=no) ],
367 dnl extra argument: --with-openssl
370 [ --with-openssl Use OpenSSL. (default=yes)],
382 dnl # extra argument: --with-openssl-includes=dir
385 AC_ARG_WITH(openssl-includes,
386 [ --with-openssl-includes=DIR Directory to look for OpenSSL include files],
388 *) OPENSSL_INCLUDE_DIR="$withval"
394 dnl # extra argument: --with-openssl-libraries=dir
397 AC_ARG_WITH(openssl-libraries,
398 [ --with-openssl-libraries=DIR Directory to look for OpenSSL library files],
400 *) OPENSSL_LIB_DIR="$withval"
406 dnl # extra argument: --disable-openssl-version-check
408 AC_ARG_ENABLE(openssl-version-check,
409 [ --disable-openssl-version-check Disable vulnerable OpenSSL version check.]
411 if test "x$enable_openssl_version_check" != "xno"; then
412 AC_DEFINE(ENABLE_OPENSSL_VERSION_CHECK, [1],
413 [Define to 1 to have OpenSSL version check enabled])
414 openssl_version_check_config="\
416 # allow_vulnerable_openssl: Allow the server to start with
417 # versions of OpenSSL known to have critical vulnerabilities.
419 # This check is based on the version number reported by libssl
420 # and may not reflect patches applied to libssl by
421 # distribution maintainers.
423 allow_vulnerable_openssl = no"
425 openssl_version_check_config=
427 AC_SUBST([openssl_version_check_config])
430 dnl # These next two arguments don't actually do anything. They're
431 dnl # place holders so that the top-level configure script can tell
432 dnl # the user how to configure lower-level modules
436 dnl # extra argument: --with-rlm-FOO-lib-dir
438 AC_ARG_WITH(rlm-FOO-lib-dir,
439 [ --with-rlm-FOO-lib-dir=DIR Directory to look for library files used by module FOO],
447 dnl # extra argument: --with-rlm-FOO-include-dir
449 AC_ARG_WITH(rlm-FOO-include-dir,
450 [ --with-rlm-FOO-include-dir=DIR Directory to look for include files used by module FOO],
457 dnl See what include-style is used by the make program.
458 dnl AC_MSG_CHECKING(include style for make)
459 dnl echo "include /dev/null" > testmake.$$
460 dnl echo "all:" >> testmake.$$
461 dnl make -f testmake.$$ >/dev/null 2>&1
470 dnl rm -f testmake.$$
471 dnl AC_MSG_RESULT(" $INCLUDE")
472 dnl AC_SUBST(INCLUDE)
475 dnl extra argument: --with-udpfromto
477 AC_ARG_WITH(udpfromto,
478 [ --with-udpfromto Compile in UDPFROMTO support. (default=no)],
488 if test "x$WITH_UDPFROMTO" = "xyes"; then
489 AC_DEFINE(WITH_UDPFROMTO, [], [define if you want udpfromto])
492 dnl #############################################################
494 dnl # 1. Checks for programs
496 dnl #############################################################
499 AC_PATH_PROG(PERL, perl, /usr/local/bin/perl)
500 if test "x$ac_cv_path_PERL" = "x"; then
501 AC_MSG_WARN(perl not found - Simultaneous-Use and checkrad.pl may not work)
503 AC_PATH_PROG(SNMPGET, snmpget)
504 if test "x$ac_cv_path_SNMPGET" = "x"; then
505 AC_MSG_WARN(snmpget not found - Simultaneous-Use and checkrad.pl may not work)
508 AC_PATH_PROG(SNMPWALK, snmpwalk)
509 if test "x$ac_cv_path_SNMPWALK" = "x"; then
510 AC_MSG_WARN(snmpwalk not found - Simultaneous-Use and checkrad.pl may not work)
513 AC_PATH_PROG(RUSERS, rusers, /usr/bin/rusers)
515 dnl FIXME This is truly gross.
516 missing_dir=`cd $ac_aux_dir && pwd`
517 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
518 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
519 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
521 AC_PATH_PROG(LOCATE,locate)
522 AC_PATH_PROG(DIRNAME,dirname)
523 AC_PATH_PROG(GREP,grep)
525 dnl #############################################################
527 dnl # 2. Checks for libraries
529 dnl #############################################################
531 dnl If using pthreads, check for -lpthread (posix) or -lc_r (*BSD)
533 if test "x$WITH_THREADS" = "xyes"; then
534 if test $ac_cv_prog_suncc = "yes"; then
538 AC_CHECK_HEADERS(pthread.h, [], [ WITH_THREADS="no" ])
541 dnl # pthread stuff is usually in -lpthread
542 dnl # or in -lc_r, on *BSD
544 dnl # On Some systems, we need extra pre-processor flags, to get them to
545 dnl # to do the threading properly.
547 AC_CHECK_LIB(pthread, pthread_create,
548 [ CFLAGS="$CFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS"
549 LIBS="-lpthread $LIBS" ],
550 AC_CHECK_LIB(c_r, pthread_create,
551 [ CFLAGS="$CFLAGS -pthread -D_THREAD_SAFE" ],
552 [ WITH_THREADS="no" ]
558 dnl # If we have NO pthread libraries, remove any knowledge of threads.
560 if test "x$WITH_THREADS" != "xyes"; then
562 ac_cv_header_pthread_h="no"
566 dnl # We need sem_init() and friends, as they're the friendliest
567 dnl # semaphore functions for threading.
569 dnl # HP/UX requires linking with librt, too, to get the sem_* symbols.
570 dnl # Some systems have them in -lsem
571 dnl # Solaris has them in -lposix4
572 dnl # NetBSD has them in -lsemaphore
574 AC_SEARCH_LIBS(sem_init, pthread sem posix4 rt semaphore,
576 [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)]
580 dnl Check if we need -lsocket
581 AC_CHECK_LIB(socket, getsockname)
583 dnl Check for -lresolv
584 dnl This library may be needed later.
585 AC_CHECK_LIB(resolv, inet_aton)
587 dnl Check if we need -lnsl. Usually if we want to
588 dnl link against -lsocket we need to include -lnsl as well.
589 AC_CHECK_LIB(nsl, inet_ntoa)
591 dnl Check for OpenSSL libraries.
593 if test "x$WITH_OPENSSL" = xyes; then
595 old_LDFLAGS="$LDFLAGS"
596 if test "x$OPENSSL_LIB_DIR" != "x"; then
597 LDFLAGS="-L$OPENSSL_LIB_DIR $LDFLAGS"
599 AC_CHECK_LIB(crypto, DH_new,
601 LIBS="-lcrypto $LIBS"
602 AC_DEFINE(HAVE_LIBCRYPTO, 1,
603 [Define to 1 if you have the `crypto' library (-lcrypto).])
604 AC_CHECK_LIB(ssl, SSL_new,
606 AC_DEFINE(HAVE_LIBSSL, 1,
607 [Define to 1 if you have the `ssl' library (-lssl).])
608 if test "x$OPENSSL_LIB_DIR" != "x"; then
609 OPENSSL_LIBS="-L$OPENSSL_LIB_DIR"
611 OPENSSL_LIBS="$OPENSSL_LIBS -lcrypto -lssl -lcrypto"
615 LDFLAGS="$old_LDFLAGS"
618 AC_CHECK_LIB(ws2_32, htonl)
620 dnl Check the pcap library for the RADIUS sniffer.
622 AC_CHECK_LIB(pcap, pcap_open_live,
624 AC_DEFINE(HAVE_LIBPCAP, 1,
625 [Define to 1 if you have the `pcap' library (-lpcap).])
627 [ AC_MSG_WARN([pcap library not found, silently disabling the RADIUS sniffer.]) ])
631 dnl #############################################################
633 dnl # 3. Checks for header files
635 dnl #############################################################
638 dnl # Interix requires us to set -D_ALL_SOURCE, otherwise
639 dnl # getopt will be #included, but won't link. <sigh>
644 CFLAGS="$CFLAGS -D_ALL_SOURCE"
647 CFLAGS="$CFLAGS -DDARWIN"
648 LIBS="-framework DirectoryService $LIBS"
649 AC_DEFINE([__APPLE_USE_RFC_3542], 1, [Force OSX >= 10.7 Lion to use RFC2292 IPv6 socket options])
699 dnl FreeBSD requires sys/socket.h before net/if.h
700 AC_CHECK_HEADERS(net/if.h, [], [],
701 [#ifdef HAVE_SYS_SOCKET_H
702 # include <sys/socket.h>
707 AC_CHECK_HEADER(regex.h, AC_DEFINE(HAVE_REGEX_H, [], [define this if we have the <regex.h> header file]))
708 if test "x$ac_cv_header_regex_h" = "xyes"; then
716 ], [AC_DEFINE(HAVE_REG_EXTENDED, [], [define this if we have REG_EXTENDED (from <regex.h>)]) REGEX_EXTENDED=yes])
719 AC_SUBST(REGEX_EXTENDED)
722 dnl # other checks which require headers
724 if test "x$ac_cv_header_sys_security_h" = "xyes" && test "x$ac_cv_header_prot_h" = "xyes"
726 AC_DEFINE(OSFC2, [], [define if you have OSFC2 authentication])
729 if test "x$ac_cv_header_sia_h" = "xyes" && test "x$ac_cv_header_siad_h" = "xyes"
731 AC_DEFINE(OSFSIA, [], [define if you have OSFSIA authentication])
735 dnl # Were we told to use OpenSSL, if we were and we find an error, call AC_MSG_FAILURE and exit
737 if test "x$WITH_OPENSSL" = xyes; then
739 old_LDFLAGS="$LDFLAGS"
741 OPENSSL_INCLUDE="-DNO_OPENSSL"
743 if test "x$OPENSSL_LIB_DIR" != "x"; then
744 LDFLAGS="-L$OPENSSL_LIB_DIR $LDFLAGS"
748 dnl # Check we can link to libssl
750 AC_CHECK_LIB(crypto, DH_new,
752 LIBS="-lcrypto $LIBS"
753 AC_DEFINE(HAVE_LIBCRYPTO, 1, [Define to 1 if you have the `crypto' library (-lcrypto).])
754 AC_CHECK_LIB(ssl, SSL_new,
756 AC_DEFINE(HAVE_LIBSSL, 1, [Define to 1 if you have the `ssl' library (-lssl).])
757 if test "x$OPENSSL_LIB_DIR" != "x"; then
758 OPENSSL_LIBS="-L$OPENSSL_LIB_DIR"
760 OPENSSL_LIBS="$OPENSSL_LIBS -lcrypto -lssl -lcrypto"
761 LIBS="$OPENSSL_LIBS $LIBS"
764 AC_MSG_FAILURE([failed linking to libssl])
772 dnl # Check we can find required headers
774 old_CPPFLAGS=$CPPFLAGS
776 if test "x$OPENSSL_INCLUDE_DIR" != "x"; then
777 CPPFLAGS="-I$OPENSSL_INCLUDE_DIR $CPPFLAGS"
778 CFLAGS="-I$OPENSSL_INCLUDE_DIR $CFLAGS"
782 dnl # Stupid RedHat shit
784 CPPFLAGS="$CPPFLAGS -DOPENSSL_NO_KRB5"
797 AC_MSG_FAILURE([failed locating OpenSSL headers])
801 AC_MSG_CHECKING([for OpenSSL version >= 0.9.7])
803 [#include <openssl/crypto.h>
804 #if (OPENSSL_VERSION_NUMBER >= 0x00907000L)
813 AC_MSG_FAILURE([OpenSSL version too old])
817 if test "x$OPENSSL_INCLUDE_DIR" != "x"; then
818 OPENSSL_INCLUDE="-I$OPENSSL_INCLUDE_DIR -DOPENSSL_NO_KRB5"
820 OPENSSL_INCLUDE="-DOPENSSL_NO_KRB5"
824 dnl # Now check that the header versions match the library
826 AC_MSG_CHECKING([OpenSSL library and header version consistency])
831 #include <openssl/opensslv.h>
832 #include <openssl/crypto.h>
835 if (SSLeay() == OPENSSL_VERSION_NUMBER) {
838 printf("library: %lx header: %lx... ", (unsigned long) SSLeay(), (unsigned long) OPENSSL_VERSION_NUMBER);
848 AC_MSG_FAILURE([OpenSSL library version does not match header version])
852 if test "x$OPENSSL_LIBS" = x; then
854 LDFLAGS="$old_LDFLAGS"
856 if test "x$OPENSSL_INCLUDE" = x; then
857 CPPFLAGS=$old_CPPFLAGS
862 AC_SUBST(OPENSSL_INCLUDE)
863 AC_SUBST(OPENSSL_LIBS)
866 dnl Check the pcap includes for the RADIUS sniffer.
867 if test "x$PCAP_LIBS" = x; then
868 AC_MSG_NOTICE([skipping test for pcap.h.])
870 AC_CHECK_HEADER(pcap.h,
871 AC_DEFINE(HAVE_PCAP_H, 1,
872 [Define to 1 if you have the <pcap.h> header file.]),
874 AC_MSG_WARN([pcap.h not found, silently disabling the RADIUS sniffer.])
877 AC_CHECK_LIB(pcap, pcap_fopen_offline,
878 [ AC_DEFINE(HAVE_PCAP_FOPEN_OFFLINE, 1,
879 [Define to 1 if you have the function pcap_fopen_offline.])
881 AC_CHECK_LIB(pcap, pcap_dump_fopen,
882 [ AC_DEFINE(HAVE_PCAP_DUMP_FOPEN, 1,
883 [Define to 1 if you have the function pcap_dump_fopen.])
888 dnl #############################################################
890 dnl # 4. Checks for typedefs
892 dnl #############################################################
895 dnl # Ensure that these are defined
902 dnl check for socklen_t
903 FR_CHECK_TYPE_INCLUDE([
904 #ifdef HAVE_SYS_TYPES_H
905 #include <sys/types.h>
907 #ifdef HAVE_SYS_SOCKET_H
908 #include <sys/socket.h>
910 ],socklen_t, int, [socklen_t is generally 'int' on systems which don't use it])
912 dnl check for uint8_t
913 FR_CHECK_TYPE_INCLUDE([
914 #ifdef HAVE_INTTYPES_H
915 #include <inttypes.h>
920 ],uint8_t, unsigned char, [uint8_t should be the canonical 'octet' for network traffic])
922 dnl check for uint16_t
923 FR_CHECK_TYPE_INCLUDE([
924 #ifdef HAVE_INTTYPES_H
925 #include <inttypes.h>
930 ],uint16_t, unsigned short, [uint16_t should be the canonical '2 octets' for network traffic])
932 dnl check for uint32_t
933 FR_CHECK_TYPE_INCLUDE([
934 #ifdef HAVE_INTTYPES_H
935 #include <inttypes.h>
940 ],uint32_t, unsigned int, [uint32_t should be the canonical 'network integer])
942 AC_CHECK_TYPE(sig_t, AC_DEFINE(HAVE_SIG_T, 1, [signal action callback function]), [], [
948 AC_CHECK_TYPE(struct in6_addr, AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1, [IPv6 address structure]), [], [
949 #ifdef HAVE_NETINET_IN_H
950 #include <netinet/in.h>
954 AC_CHECK_TYPE(struct sockaddr_storage, AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1, [Generic socket addresses]), [], [
955 #ifdef HAVE_NETINET_IN_H
956 #include <netinet/in.h>
958 #ifdef HAVE_SYS_SOCKET_H
959 #include <sys/socket.h>
963 AC_CHECK_TYPE(struct sockaddr_in6, AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1, [IPv6 socket addresses]), [], [
964 #ifdef HAVE_NETINET_IN_H
965 #include <netinet/in.h>
969 AC_CHECK_TYPE(struct addrinfo, AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1, [Generic DNS lookups]), [], [
970 #ifdef HAVE_SYS_TYPES_H
971 #include <sys/types.h>
973 #ifdef HAVE_SYS_SOCKET_H
974 #include <sys/socket.h>
981 dnl #############################################################
983 dnl # 5. Checks for structures and functions
985 dnl #############################################################
1020 RADIUSD_NEED_DECLARATIONS( \
1032 dnl # check if we have utmpx.h
1033 dnl # if so, check if struct utmpx has entry ut_xtime
1034 dnl # if not, set it to define ut_xtime == ut_tv.tv_sec
1035 if test "x$ac_cv_header_utmpx_h" = "xyes"
1037 FR_CHECK_STRUCT_HAS_MEMBER([#include <utmpx.h>], [struct utmpx], ut_xtime)
1038 if test "x$ac_cv_type_struct_utmpx_has_ut_xtime" = "x"
1040 AC_DEFINE(ut_xtime,ut_tv.tv_sec, [define to something if you don't have ut_xtime in struct utmpx])
1044 dnl # struct ip_pktinfo
1045 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in_pktinfo], ipi_addr)
1046 if test "x$ac_cv_type_struct_in_pktinfo_has_ipi_addr" = "xyes"
1048 AC_DEFINE(HAVE_IP_PKTINFO, [], [define if you have IP_PKTINFO (Linux)])
1051 dnl # struct in6_pktinfo
1052 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in6_pktinfo], ipi6_addr)
1053 if test "x$ac_cv_type_struct_in6_pktinfo_has_ipi6_addr" = "xyes"
1055 AC_DEFINE(HAVE_IN6_PKTINFO, [], [define if you have IN6_PKTINFO (Linux)])
1058 dnl #############################################################
1060 dnl # 6. Checks for compiler characteristics
1062 dnl #############################################################
1065 dnl # Ensure that these are defined
1070 dnl # See if this is OS/2
1072 AC_MSG_CHECKING(type of OS)
1075 if test "$OS" = "OS/2"; then
1082 AC_MSG_CHECKING(for developer gcc flags)
1083 if test "x$developer" = "xyes" -a "x$GCC" = "xyes"; then
1084 devflags="-g -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -W -Wredundant-decls -Wundef"
1085 CFLAGS="$CFLAGS $devflags"
1087 AC_MSG_RESULT(yes. Using $devflags)
1090 CFLAGS="$CFLAGS -DNDEBUG"
1097 dnl #############################################################
1099 dnl # 7. Checks for library functions
1101 dnl #############################################################
1104 LIBS="$LIBS $LIBLTDL"
1105 AC_CHECK_FUNC(lt_dladvise_init, AC_DEFINE(HAVE_LT_DLADVISE_INIT, [], [Do we have the lt_dladvise_init function]))
1108 dnl Check for libcrypt
1109 dnl We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
1110 AC_CHECK_LIB(crypt, crypt,
1113 if test "$CRYPTLIB" != ""; then
1114 AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function])
1116 AC_CHECK_FUNC(crypt, AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function]))
1119 dnl Check for libcipher
1120 AC_CHECK_LIB(cipher, setkey,
1121 CRYPTLIB="${CRYPTLIB} -lcipher"
1125 dnl Check the style of gethostbyaddr, in order of preference
1126 dnl GNU (_r eight args)
1127 AC_DEFINE(GNUSTYLE, [1], [GNU-Style get*byaddr_r])
1128 dnl SYSV (_r six args)
1129 AC_DEFINE(SYSVSTYLE, [2], [SYSV-Style get*byaddr_r])
1130 dnl BSD (three args, may not be thread safe)
1131 AC_DEFINE(BSDSTYLE, [3], [BSD-Style get*byaddr_r])
1132 dnl Tru64 has BSD version, but it is thread safe
1133 dnl http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1739____.HTM
1134 dnl We need #stdio.h to define NULL on FreeBSD (at least)
1135 gethostbyaddrrstyle=""
1136 AC_MSG_CHECKING([gethostbyaddr_r() syntax])
1139 dnl With FreeBSD, check if there's a prototype for gethostbyaddr_r.
1140 dnl Some versions (FreeBSD 5.1?) have a symbol but no prototype - so we
1141 dnl override this test to BSDSTYLE. FreeBSD 6.2 and up have proper GNU
1143 AC_CHECK_DECLS([gethostbyaddr_r], [], [
1144 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE,
1145 [style of gethostbyaddr_r functions ])
1146 gethostbyaddrrstyle=BSD
1147 AC_MSG_WARN([FreeBSD overridden to BSD-style])
1155 if test "x$gethostbyaddrrstyle" = "x"; then
1159 ], [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL, NULL) ], [
1160 AC_DEFINE(GETHOSTBYADDRRSTYLE, GNUSTYLE, [style of gethostbyaddr_r functions ])
1161 gethostbyaddrrstyle=GNU
1164 if test "x$gethostbyaddrrstyle" = "x"; then
1168 ], [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL) ] , [
1169 AC_DEFINE(GETHOSTBYADDRRSTYLE, SYSVSTYLE, [style of gethostbyaddr_r functions ])
1170 gethostbyaddrrstyle=SYSV
1173 if test "x$gethostbyaddrrstyle" = "x"; then
1177 ], [ gethostbyaddr(NULL, 0, 0) ], [
1178 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE, [style of gethostbyaddr_r functions ])
1179 gethostbyaddrrstyle=BSD
1183 if test "x$gethostbyaddrrstyle" = "x"; then
1184 AC_MSG_RESULT([none! It must not exist, here.])
1186 AC_MSG_RESULT([${gethostbyaddrrstyle}-style])
1189 if test "x$gethostbyaddrrstyle" = "xBSD"; then
1190 AC_MSG_WARN([ ****** BSD-style gethostbyaddr might NOT be thread-safe! ****** ])
1193 dnl Check the style of gethostbyname, in order of preference
1194 dnl GNU (_r seven args)
1195 dnl SYSV (_r five args)
1196 dnl BSD (two args, may not be thread safe)
1197 dnl Tru64 has BSD version, but it _is_ thread safe
1198 dnl http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1946____.HTM
1199 dnl We need #stdio.h to define NULL on FreeBSD (at least)
1200 gethostbynamerstyle=""
1201 AC_MSG_CHECKING([gethostbyname_r() syntax])
1205 ], [ gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL) ], [
1206 AC_DEFINE(GETHOSTBYNAMERSTYLE, GNUSTYLE, [style of gethostbyname_r functions ])
1207 gethostbynamerstyle=GNU
1209 if test "x$gethostbynamerstyle" = "x"; then
1213 ], [ gethostbyname_r(NULL, NULL, NULL, 0, NULL) ] , [
1214 AC_DEFINE(GETHOSTBYNAMERSTYLE, SYSVSTYLE, [style of gethostbyname_r functions ])
1215 gethostbynamerstyle=SYSV
1218 if test "x$gethostbynamerstyle" = "x"; then
1222 ], [ gethostbyname(NULL) ], [
1223 AC_DEFINE(GETHOSTBYNAMERSTYLE, BSDSTYLE, [style of gethostbyname_r functions ])
1224 gethostbynamerstyle=BSD
1228 if test "x$gethostbynamerstyle" = "x"; then
1229 AC_MSG_RESULT([none! It must not exist, here.])
1231 AC_MSG_RESULT([${gethostbynamerstyle}-style])
1234 if test "x$gethostbynamerstyle" = "xBSD"; then
1235 AC_MSG_WARN([ ****** BSD-style gethostbyname might NOT be thread-safe! ****** ])
1238 dnl check for non-posix solaris ctime_r (extra buflen int arg)
1239 AC_DEFINE(POSIXSTYLE, [1], [Posix-Style ctime_r])
1240 AC_DEFINE(SOLARISSTYLE, [2], [Solaris-Style ctime_r])
1242 AC_MSG_CHECKING([ctime_r() syntax])
1245 ], [ ctime_r(NULL, NULL, 0) ], [
1246 AC_DEFINE(CTIMERSTYLE, SOLARISSTYLE, [style of ctime_r function])
1247 ctimerstyle="SOLARIS"
1249 if test "x$ctimerstyle" = "x"; then
1252 ], [ ctime_r(NULL, NULL) ], [
1253 AC_DEFINE(CTIMERSTYLE, POSIXSTYLE, [style of ctime_r function])
1258 if test "x$ctimerstyle" = "x"; then
1259 AC_MSG_RESULT([none! It must not exist, here.])
1261 AC_MSG_RESULT([${ctimerstyle}-style])
1264 AC_SUBST(HOSTINFO, $host)
1266 if test "x$WITH_POST_PROXY_AUTHORIZE" != "x"; then
1267 AC_DEFINE(WITH_POST_PROXY_AUTHORIZE, 1, [1.x compatibility])
1270 dnl #############################################################
1272 dnl # 8. Checks for system services
1274 dnl #############################################################
1277 dnl # Figure out where libtool is located,
1281 AC_MSG_RESULT([top_builddir=$top_builddir])
1282 dnl # AC_SUBST(top_builddir)
1286 dnl import libtool stuff
1288 dnl #############################################################
1290 dnl # Configure in any module directories.
1292 dnl #############################################################
1294 mysubdirs="$LIBLTDLPATH"
1295 if test "x$EXPERIMENTAL" = "xyes"; then
1296 bar=`ls -1 "${srcdir}"/src/modules/rlm_*/configure | sed 's%/configure%%'`
1297 dnl # get rid of LF's.
1298 mysubdirs=`echo $mysubdirs $bar`
1301 dnl # Find 'configure' in ONLY the stable modules
1303 for bar in `cat "${srcdir}"/src/modules/stable`; do
1304 if test -f "${srcdir}"/src/modules/$bar/configure; then
1305 mysubdirs="$mysubdirs src/modules/$bar"
1310 dnl ############################################################
1311 dnl # make modules by list
1312 dnl #############################################################
1313 if test "x$EXPERIMENTAL" = "xyes"; then
1314 for foo in `ls -1 "${srcdir}"/src/modules | grep rlm_`; do
1315 MODULES="$MODULES $foo"
1319 dnl # make ONLY the stable modules
1321 for foo in `cat "${srcdir}"/src/modules/stable`; do
1322 MODULES="$MODULES $foo"
1327 dnl # Don't change the variable name here. Autoconf goes bonkers
1330 AC_CONFIG_SUBDIRS($LTDL_SUBDIRS $mysubdirs)
1333 dnl #############################################################
1335 dnl # And finally, output the results.
1337 dnl #############################################################
1339 AC_CONFIG_COMMANDS([stamp-h], [echo timestamp > src/include/stamp-h])
1340 AC_CONFIG_COMMANDS([build-radpaths-h], [(cd ./src/include && /bin/sh ./build-radpaths-h)])
1341 AC_CONFIG_COMMANDS([main-chmod], [(cd ./src/main && chmod +x checkrad.pl radlast radtest)])
1342 AC_CONFIG_COMMANDS([scripts-chmod], [(cd ./scripts && chmod +x rc.radiusd radwatch radiusd.cron.daily radiusd.cron.monthly cryptpasswd)])
1345 dnl # Substitute whatever libraries we found to be necessary
1348 AC_SUBST(INSTALLSTRIP)
1350 USE_SHARED_LIBS=$enable_shared
1351 AC_SUBST(USE_SHARED_LIBS)
1352 USE_STATIC_LIBS=$enable_static
1353 AC_SUBST(USE_STATIC_LIBS)
1354 AC_SUBST(STATIC_MODULES)
1355 AC_SUBST(RADIUSD_MAJOR_VERSION)
1356 AC_SUBST(RADIUSD_MINOR_VERSION)
1357 AC_SUBST(RADIUSD_INCRM_VERSION)
1358 AC_SUBST(RADIUSD_VERSION)
1359 AC_SUBST(RADIUSD_VERSION_STRING)
1360 AC_SUBST(RADIUSD_VERSION_COMMIT)
1364 ./src/include/build-radpaths-h \
1365 ./src/main/Makefile \
1366 ./src/main/checkrad.pl \
1367 ./src/main/radlast \
1368 ./src/main/radtest \
1369 ./scripts/rc.radiusd \
1370 ./scripts/radwatch \
1371 ./scripts/radiusd.cron.daily \
1372 ./scripts/radiusd.cron.monthly \
1373 ./scripts/cryptpasswd \
1374 ./raddb/dictionary \
1375 ./raddb/radrelay.conf \
1376 ./raddb/radiusd.conf