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 extra argument: --with-docdir
178 docdir='${datadir}/doc/freeradius'
179 AC_MSG_CHECKING(docdir)
181 [ --with-docdir=DIR Directory for documentation [DATADIR/doc/freeradius] ],
188 [[\\/$]]* | ?:[[\\/]]* )
192 AC_MSG_ERROR([expected an absolute directory name for --with-docdir: $withval])
197 AC_MSG_RESULT($docdir)
198 if test "x$docdir" = xno; then
199 AC_MSG_WARN(Documentation files will NOT be installed.)
202 dnl extra argument: --with-logdir
203 logdir='${localstatedir}/log/radius'
204 AC_MSG_CHECKING(logdir)
206 [ --with-logdir=DIR Directory for logfiles [LOCALSTATEDIR/log/radius] ],
209 AC_MSG_ERROR(Need logdir)
213 [[\\/$]]* | ?:[[\\/]]* )
217 AC_MSG_ERROR([expected an absolute directory name for --with-logdir: $withval])
222 AC_MSG_RESULT($logdir)
224 dnl extra argument: --with-radacctdir
225 radacctdir='${logdir}/radacct'
226 AC_MSG_CHECKING(radacctdir)
227 AC_ARG_WITH(radacctdir,
228 [ --with-radacctdir=DIR Directory for detail files [LOGDIR/radacct] ],
231 AC_MSG_ERROR(Need radacctdir)
235 [[\\/$]]* | ?:[[\\/]]* )
236 radacctdir="$withval"
239 AC_MSG_ERROR([expected an absolute directory name for --with-radacctdir: $withval])
244 AC_MSG_RESULT($radacctdir)
246 dnl extra argument: --with-raddbdir
247 raddbdir='${sysconfdir}/raddb'
248 AC_MSG_CHECKING(raddbdir)
249 AC_ARG_WITH(raddbdir,
250 [ --with-raddbdir=DIR Directory for config files [SYSCONFDIR/raddb] ],
253 AC_MSG_ERROR(Need raddbdir)
257 [[\\/$]]* | ?:[[\\/]]* )
261 AC_MSG_ERROR([expected an absolute directory name for --with-raddbdir: $withval])
266 AC_MSG_RESULT($raddbdir)
268 dnl extra argument: --with-ascend-binary
269 WITH_ASCEND_BINARY=yes
270 AC_ARG_WITH(ascend-binary,
271 [ --with-ascend-binary Include support for Ascend binary filter attributes (default=yes)],
276 WITH_ASCEND_BINARY=""
279 if test "X$WITH_ASCEND_BINARY" = "Xyes"; then
280 AC_DEFINE(WITH_ASCEND_BINARY, [], [Include support for Ascend binary filter attributes])
283 dnl extra argument: --with-threads
286 [ --with-threads Use threads, if available. (default=yes) ],
295 dnl extra argument: --with-vmps
298 [ --with-vmps Compile in VMPS support. (default=yes)],
306 if test "x$WITH_VMPS" = "xyes"; then
307 AC_DEFINE(WITH_VMPS, [1], [define if you want VMPS support])
310 dnl extra argument: --with-dhcp
313 [ --with-dhcp Compile in DHCP support. (default=yes)],
321 if test "x$WITH_DHCP" = "xyes"; then
322 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.pl 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.pl 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.pl 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 dnl Check if we need -lsocket
551 AC_CHECK_LIB(dl, dlopen)
553 dnl Check if we need -lsocket
554 AC_CHECK_LIB(socket, getsockname)
556 dnl Check for -lresolv
557 dnl This library may be needed later.
558 AC_CHECK_LIB(resolv, inet_aton)
560 dnl Check if we need -lnsl. Usually if we want to
561 dnl link against -lsocket we need to include -lnsl as well.
562 AC_CHECK_LIB(nsl, inet_ntoa)
564 dnl Check for OpenSSL libraries.
566 if test "x$WITH_OPENSSL" = xyes; then
568 old_LDFLAGS="$LDFLAGS"
569 if test "x$OPENSSL_LIB_DIR" != "x"; then
570 LDFLAGS="$LDFLAGS -L$OPENSSL_LIB_DIR"
572 AC_CHECK_LIB(crypto, DH_new,
574 LIBS="-lcrypto $LIBS"
575 AC_DEFINE(HAVE_LIBCRYPTO, 1,
576 [Define to 1 if you have the `crypto' library (-lcrypto).])
577 AC_CHECK_LIB(ssl, SSL_new,
579 AC_DEFINE(HAVE_LIBSSL, 1,
580 [Define to 1 if you have the `ssl' library (-lssl).])
581 if test "x$OPENSSL_LIB_DIR" != "x"; then
582 OPENSSL_LIBS="-L$OPENSSL_LIB_DIR"
584 OPENSSL_LIBS="$OPENSSL_LIBS -lcrypto -lssl -lcrypto"
588 LDFLAGS="$old_LDFLAGS"
591 AC_CHECK_LIB(ws2_32, htonl)
593 dnl Check the pcap library for the RADIUS sniffer.
595 AC_CHECK_LIB(pcap, pcap_open_live,
597 AC_DEFINE(HAVE_LIBPCAP, 1,
598 [Define to 1 if you have the `pcap' library (-lpcap).])
600 [ AC_MSG_WARN([pcap library not found, silently disabling the RADIUS sniffer.]) ])
604 dnl #############################################################
606 dnl # 3. Checks for header files
608 dnl #############################################################
611 dnl # Interix requires us to set -D_ALL_SOURCE, otherwise
612 dnl # getopt will be #included, but won't link. <sigh>
617 CFLAGS="$CFLAGS -D_ALL_SOURCE"
620 CFLAGS="$CFLAGS -DDARWIN"
621 LIBS="-framework DirectoryService $LIBS"
671 dnl FreeBSD requires sys/socket.h before net/if.h
672 AC_CHECK_HEADERS(net/if.h, [], [],
673 [#ifdef HAVE_SYS_SOCKET_H
674 # include <sys/socket.h>
679 AC_CHECK_HEADER(pcreposix.h, AC_DEFINE(HAVE_PCREPOSIX_H, [], [define this if we have the <pcreposix.h> header file]))
680 if test "x$ac_cv_header_pcreposix_h" = "xyes"; then
681 AC_DEFINE(HAVE_REGEX_H, [], [define if we have any regex])
685 LIBS="$LIBS -lpcreposix"
688 AC_CHECK_HEADER(regex.h, AC_DEFINE(HAVE_REGEX_H, [], [define this if we have the <regex.h> header file]))
689 if test "x$ac_cv_header_regex_h" = "xyes"; then
698 ], [AC_DEFINE(HAVE_REG_EXTENDED, [], [define this if we have REG_EXTENDED (from <regex.h>)]) REGEX_EXTENDED=yes])
704 AC_SUBST(REGEX_EXTENDED)
707 dnl # other checks which require headers
709 if test "x$ac_cv_header_sys_security_h" = "xyes" && test "x$ac_cv_header_prot_h" = "xyes"
711 AC_DEFINE(OSFC2, [], [define if you have OSFC2 authentication])
714 if test "x$ac_cv_header_sia_h" = "xyes" && test "x$ac_cv_header_siad_h" = "xyes"
716 AC_DEFINE(OSFSIA, [], [define if you have OSFSIA authentication])
719 dnl Check for OpenSSL includes.
720 OPENSSL_INCLUDE="-DNO_OPENSSL"
721 if test "x$WITH_OPENSSL" = xyes; then
722 if test "x$OPENSSL_LIBS" = "x"; then
723 AC_MSG_NOTICE([skipping test for openssl/ssl.h])
725 old_CPPFLAGS=$CPPFLAGS
726 if test "x$OPENSSL_INCLUDE_DIR" != "x"; then
727 CPPFLAGS="$CPPFLAGS -I$OPENSSL_INCLUDE_DIR"
729 dnl # stupid RedHat shit
730 CPPFLAGS="$CPPFLAGS -DOPENSSL_NO_KRB5"
744 if test "x$OPENSSL_LIBS" != "x"; then
745 AC_MSG_CHECKING([for OpenSSL version >= 0.9.7])
747 [#include <openssl/crypto.h>
748 #if (OPENSSL_VERSION_NUMBER >= 0x00907000L)
752 if test "x$goodssl" != "xyes"; then
757 if test "x$OPENSSL_INCLUDE_DIR" != "x"; then
758 OPENSSL_INCLUDE="-I$OPENSSL_INCLUDE_DIR -DOPENSSL_NO_KRB5"
760 OPENSSL_INCLUDE="-DOPENSSL_NO_KRB5"
764 CPPFLAGS=$old_CPPFLAGS
767 AC_SUBST(OPENSSL_INCLUDE)
768 AC_SUBST(OPENSSL_LIBS)
771 dnl Check the pcap includes for the RADIUS sniffer.
772 if test "x$PCAP_LIBS" = x; then
773 AC_MSG_NOTICE([skipping test for pcap.h.])
775 AC_CHECK_HEADER(pcap.h,
776 AC_DEFINE(HAVE_PCAP_H, 1,
777 [Define to 1 if you have the <pcap.h> header file.]),
779 AC_MSG_WARN([pcap.h not found, silently disabling the RADIUS sniffer.])
782 AC_CHECK_LIB(pcap, pcap_fopen_offline,
783 [ AC_DEFINE(HAVE_PCAP_FOPEN_OFFLINE, 1,
784 [Define to 1 if you have the function pcap_fopen_offline.])
786 AC_CHECK_LIB(pcap, pcap_dump_fopen,
787 [ AC_DEFINE(HAVE_PCAP_DUMP_FOPEN, 1,
788 [Define to 1 if you have the function pcap_dump_fopen.])
793 dnl #############################################################
795 dnl # 4. Checks for typedefs
797 dnl #############################################################
800 dnl # Ensure that these are defined
807 dnl check for socklen_t
808 FR_CHECK_TYPE_INCLUDE([
809 #ifdef HAVE_SYS_TYPES_H
810 #include <sys/types.h>
812 #ifdef HAVE_SYS_SOCKET_H
813 #include <sys/socket.h>
815 ],socklen_t, int, [socklen_t is generally 'int' on systems which don't use it])
817 dnl check for uint8_t
818 FR_CHECK_TYPE_INCLUDE([
819 #ifdef HAVE_INTTYPES_H
820 #include <inttypes.h>
825 ],uint8_t, unsigned char, [uint8_t should be the canonical 'octet' for network traffic])
827 dnl check for uint16_t
828 FR_CHECK_TYPE_INCLUDE([
829 #ifdef HAVE_INTTYPES_H
830 #include <inttypes.h>
835 ],uint16_t, unsigned short, [uint16_t should be the canonical '2 octets' for network traffic])
837 dnl check for uint32_t
838 FR_CHECK_TYPE_INCLUDE([
839 #ifdef HAVE_INTTYPES_H
840 #include <inttypes.h>
845 ],uint32_t, unsigned int, [uint32_t should be the canonical 'network integer])
847 AC_CHECK_TYPE(struct in6_addr, AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1, [IPv6 address structure]), [], [
848 #ifdef HAVE_NETINET_IN_H
849 #include <netinet/in.h>
853 AC_CHECK_TYPE(struct sockaddr_storage, AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1, [Generic socket addresses]), [], [
854 #ifdef HAVE_NETINET_IN_H
855 #include <netinet/in.h>
857 #ifdef HAVE_SYS_SOCKET_H
858 #include <sys/socket.h>
862 AC_CHECK_TYPE(struct sockaddr_in6, AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1, [IPv6 socket addresses]), [], [
863 #ifdef HAVE_NETINET_IN_H
864 #include <netinet/in.h>
868 AC_CHECK_TYPE(struct addrinfo, AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1, [Generic DNS lookups]), [], [
869 #ifdef HAVE_SYS_TYPES_H
870 #include <sys/types.h>
872 #ifdef HAVE_SYS_SOCKET_H
873 #include <sys/socket.h>
880 dnl #############################################################
882 dnl # 5. Checks for structures and functions
884 dnl #############################################################
919 RADIUSD_NEED_DECLARATIONS( \
931 dnl # check if we have utmpx.h
932 dnl # if so, check if struct utmpx has entry ut_xtime
933 dnl # if not, set it to define ut_xtime == ut_tv.tv_sec
934 if test "x$ac_cv_header_utmpx_h" = "xyes"
936 FR_CHECK_STRUCT_HAS_MEMBER([#include <utmpx.h>], [struct utmpx], ut_xtime)
937 if test "x$ac_cv_type_struct_utmpx_has_ut_xtime" = "x"
939 AC_DEFINE(ut_xtime,ut_tv.tv_sec, [define to something if you don't have ut_xtime in struct utmpx])
943 dnl # struct ip_pktinfo
944 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in_pktinfo], ipi_addr)
945 if test "x$ac_cv_type_struct_in_pktinfo_has_ipi_addr" = "xyes"
947 AC_DEFINE(HAVE_IP_PKTINFO, [], [define if you have IP_PKTINFO (Linux)])
950 dnl # struct in6_pktinfo
951 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in6_pktinfo], ipi6_addr)
952 if test "x$ac_cv_type_struct_in6_pktinfo_has_ipi6_addr" = "xyes"
954 AC_DEFINE(HAVE_IN6_PKTINFO, [], [define if you have IN6_PKTINFO (Linux)])
957 dnl #############################################################
959 dnl # 6. Checks for compiler characteristics
961 dnl #############################################################
964 dnl # Ensure that these are defined
969 dnl # See if this is OS/2
971 AC_MSG_CHECKING(type of OS)
974 if test "$OS" = "OS/2"; then
981 AC_MSG_CHECKING(for developer gcc flags)
984 if test "x$developer" = "xyes"; then
985 if test "x$GCC" = "xyes"; then
986 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"
987 CFLAGS="$CFLAGS $devflags"
989 AC_MSG_RESULT(yes. Using $devflags)
992 if test "x$EXPERIMENTAL" != "xno"; then
996 dnl append the current git hash onto the version string
997 if test "x$GIT" = "xyes"; then
998 RADIUSD_VERSION_COMMIT=`git log --pretty=format:'%h' -n 1`
1002 CFLAGS="$CFLAGS -DNDEBUG"
1009 dnl #############################################################
1011 dnl # 7. Checks for library functions
1013 dnl #############################################################
1016 LIBS="$LIBS $LIBLTDL"
1017 AC_CHECK_FUNC(lt_dladvise_init, AC_DEFINE(HAVE_LT_DLADVISE_INIT, [], [Do we have the lt_dladvise_init function]))
1020 dnl Check for libcrypt
1021 dnl We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
1022 AC_CHECK_LIB(crypt, crypt,
1025 if test "$CRYPTLIB" != ""; then
1026 AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function])
1028 AC_CHECK_FUNC(crypt, AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function]))
1031 dnl Check for libcipher
1032 AC_CHECK_LIB(cipher, setkey,
1033 CRYPTLIB="${CRYPTLIB} -lcipher"
1037 dnl Check the style of gethostbyaddr, in order of preference
1038 dnl GNU (_r eight args)
1039 AC_DEFINE(GNUSTYLE, [1], [GNU-Style get*byaddr_r])
1040 dnl SYSV (_r six args)
1041 AC_DEFINE(SYSVSTYLE, [2], [SYSV-Style get*byaddr_r])
1042 dnl BSD (three args, may not be thread safe)
1043 AC_DEFINE(BSDSTYLE, [3], [BSD-Style get*byaddr_r])
1044 dnl Tru64 has BSD version, but it is thread safe
1045 dnl http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1739____.HTM
1046 dnl We need #stdio.h to define NULL on FreeBSD (at least)
1047 gethostbyaddrrstyle=""
1048 AC_MSG_CHECKING([gethostbyaddr_r() syntax])
1051 dnl With FreeBSD, check if there's a prototype for gethostbyaddr_r.
1052 dnl Some versions (FreeBSD 5.1?) have a symbol but no prototype - so we
1053 dnl override this test to BSDSTYLE. FreeBSD 6.2 and up have proper GNU
1055 AC_CHECK_DECLS([gethostbyaddr_r], [], [
1056 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE,
1057 [style of gethostbyaddr_r functions ])
1058 gethostbyaddrrstyle=BSD
1059 AC_MSG_WARN([FreeBSD overridden to BSD-style])
1067 if test "x$gethostbyaddrrstyle" = "x"; then
1071 ], [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL, NULL) ], [
1072 AC_DEFINE(GETHOSTBYADDRRSTYLE, GNUSTYLE, [style of gethostbyaddr_r functions ])
1073 gethostbyaddrrstyle=GNU
1076 if test "x$gethostbyaddrrstyle" = "x"; then
1080 ], [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL) ] , [
1081 AC_DEFINE(GETHOSTBYADDRRSTYLE, SYSVSTYLE, [style of gethostbyaddr_r functions ])
1082 gethostbyaddrrstyle=SYSV
1085 if test "x$gethostbyaddrrstyle" = "x"; then
1089 ], [ gethostbyaddr(NULL, 0, 0) ], [
1090 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE, [style of gethostbyaddr_r functions ])
1091 gethostbyaddrrstyle=BSD
1095 if test "x$gethostbyaddrrstyle" = "x"; then
1096 AC_MSG_RESULT([none! It must not exist, here.])
1098 AC_MSG_RESULT([${gethostbyaddrrstyle}-style])
1101 if test "x$gethostbyaddrrstyle" = "xBSD"; then
1102 AC_MSG_WARN([ ****** BSD-style gethostbyaddr might NOT be thread-safe! ****** ])
1105 dnl Check the style of gethostbyname, in order of preference
1106 dnl GNU (_r seven args)
1107 dnl SYSV (_r five args)
1108 dnl BSD (two args, may not be thread safe)
1109 dnl Tru64 has BSD version, but it _is_ thread safe
1110 dnl http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1946____.HTM
1111 dnl We need #stdio.h to define NULL on FreeBSD (at least)
1112 gethostbynamerstyle=""
1113 AC_MSG_CHECKING([gethostbyname_r() syntax])
1117 ], [ gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL) ], [
1118 AC_DEFINE(GETHOSTBYNAMERSTYLE, GNUSTYLE, [style of gethostbyname_r functions ])
1119 gethostbynamerstyle=GNU
1121 if test "x$gethostbynamerstyle" = "x"; then
1125 ], [ gethostbyname_r(NULL, NULL, NULL, 0, NULL) ] , [
1126 AC_DEFINE(GETHOSTBYNAMERSTYLE, SYSVSTYLE, [style of gethostbyname_r functions ])
1127 gethostbynamerstyle=SYSV
1130 if test "x$gethostbynamerstyle" = "x"; then
1134 ], [ gethostbyname(NULL) ], [
1135 AC_DEFINE(GETHOSTBYNAMERSTYLE, BSDSTYLE, [style of gethostbyname_r functions ])
1136 gethostbynamerstyle=BSD
1140 if test "x$gethostbynamerstyle" = "x"; then
1141 AC_MSG_RESULT([none! It must not exist, here.])
1143 AC_MSG_RESULT([${gethostbynamerstyle}-style])
1146 if test "x$gethostbynamerstyle" = "xBSD"; then
1147 AC_MSG_WARN([ ****** BSD-style gethostbyname might NOT be thread-safe! ****** ])
1150 dnl check for non-posix solaris ctime_r (extra buflen int arg)
1151 AC_DEFINE(POSIXSTYLE, [1], [Posix-Style ctime_r])
1152 AC_DEFINE(SOLARISSTYLE, [2], [Solaris-Style ctime_r])
1154 AC_MSG_CHECKING([ctime_r() syntax])
1157 ], [ ctime_r(NULL, NULL, 0) ], [
1158 AC_DEFINE(CTIMERSTYLE, SOLARISSTYLE, [style of ctime_r function])
1159 ctimerstyle="SOLARIS"
1161 if test "x$ctimerstyle" = "x"; then
1164 ], [ ctime_r(NULL, NULL) ], [
1165 AC_DEFINE(CTIMERSTYLE, POSIXSTYLE, [style of ctime_r function])
1170 if test "x$ctimerstyle" = "x"; then
1171 AC_MSG_RESULT([none! It must not exist, here.])
1173 AC_MSG_RESULT([${ctimerstyle}-style])
1176 AC_SUBST(HOSTINFO, $host)
1178 dnl #############################################################
1180 dnl # 8. Checks for system services
1182 dnl #############################################################
1185 dnl # Figure out where libtool is located,
1189 AC_MSG_RESULT([top_builddir=$top_builddir])
1190 dnl # AC_SUBST(top_builddir)
1194 dnl import libtool stuff
1196 dnl #############################################################
1198 dnl # Configure in any module directories.
1200 dnl #############################################################
1203 if test "x$EXPERIMENTAL" = "xyes"; then
1204 bar=`ls -1 "${srcdir}"/src/modules/rlm_*/configure | sed 's%/configure%%'`
1205 dnl # get rid of LF's.
1206 mysubdirs=`echo $mysubdirs $bar`
1209 dnl # Find 'configure' in ONLY the stable modules
1211 for bar in `cat "${srcdir}"/src/modules/stable`; do
1212 if test -f "${srcdir}"/src/modules/$bar/configure; then
1213 mysubdirs="$mysubdirs src/modules/$bar"
1218 dnl ############################################################
1219 dnl # make modules by list
1220 dnl #############################################################
1221 if test "x$EXPERIMENTAL" = "xyes"; then
1222 for foo in `ls -1 "${srcdir}"/src/modules | grep rlm_`; do
1223 MODULES="$MODULES $foo"
1227 dnl # make ONLY the stable modules
1229 for foo in `cat "${srcdir}"/src/modules/stable`; do
1230 MODULES="$MODULES $foo"
1235 dnl # Don't change the variable name here. Autoconf goes bonkers
1238 AC_CONFIG_SUBDIRS($mysubdirs)
1241 dnl #############################################################
1243 dnl # And finally, output the results.
1245 dnl #############################################################
1247 AC_CONFIG_COMMANDS([stamp-h], [echo timestamp > src/include/stamp-h])
1248 AC_CONFIG_COMMANDS([build-radpaths-h], [(cd ./src/include && /bin/sh ./build-radpaths-h)])
1249 AC_CONFIG_COMMANDS([main-chmod], [(cd ./src/main && chmod +x checkrad.pl radlast radtest)])
1250 AC_CONFIG_COMMANDS([scripts-chmod], [(cd ./scripts && chmod +x rc.radiusd radiusd.cron.daily radiusd.cron.monthly cryptpasswd)])
1253 dnl # Substitute whatever libraries we found to be necessary
1256 AC_SUBST(INSTALLSTRIP)
1258 USE_SHARED_LIBS=$enable_shared
1259 AC_SUBST(USE_SHARED_LIBS)
1260 USE_STATIC_LIBS=$enable_static
1261 AC_SUBST(USE_STATIC_LIBS)
1262 AC_SUBST(STATIC_MODULES)
1263 AC_SUBST(RADIUSD_MAJOR_VERSION)
1264 AC_SUBST(RADIUSD_MINOR_VERSION)
1265 AC_SUBST(RADIUSD_INCRM_VERSION)
1266 AC_SUBST(RADIUSD_VERSION)
1267 AC_SUBST(RADIUSD_VERSION_STRING)
1268 AC_SUBST(RADIUSD_VERSION_COMMIT)
1272 ./src/include/build-radpaths-h \
1273 ./src/main/Makefile \
1274 ./src/main/radsniff.mk \
1275 ./src/main/checkrad.pl \
1276 ./src/main/radlast \
1277 ./src/main/radtest \
1278 ./scripts/rc.radiusd \
1279 ./scripts/radiusd.cron.daily \
1280 ./scripts/radiusd.cron.monthly \
1281 ./scripts/cryptpasswd \
1282 ./raddb/dictionary \
1283 ./raddb/radrelay.conf \
1284 ./raddb/radiusd.conf