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
270 AC_ARG_WITH(ascend-binary,
271 [ --with-ascend-binary Include support for Ascend binary filter attributes (default=yes)],
279 if test "X$ASCEND_BINARY" = "Xyes"; then
280 AC_DEFINE(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) ],
358 dnl extra argument: --with-openssl
361 [ --with-openssl Use OpenSSL. (default=yes)],
373 dnl # extra argument: --with-openssl-includes=dir
376 AC_ARG_WITH(openssl-includes,
377 [ --with-openssl-includes=DIR Directory to look for OpenSSL include files],
379 *) OPENSSL_INCLUDE_DIR="$withval"
385 dnl # extra argument: --with-openssl-libraries=dir
388 AC_ARG_WITH(openssl-libraries,
389 [ --with-openssl-libraries=DIR Directory to look for OpenSSL library files],
391 *) OPENSSL_LIB_DIR="$withval"
397 dnl # These next two arguments don't actually do anything. They're
398 dnl # place holders so that the top-level configure script can tell
399 dnl # the user how to configure lower-level modules
403 dnl # extra argument: --with-rlm-FOO-lib-dir
405 AC_ARG_WITH(rlm-FOO-lib-dir,
406 [ --with-rlm-FOO-lib-dir=DIR Directory to look for library files used by module FOO],
414 dnl # extra argument: --with-rlm-FOO-include-dir
416 AC_ARG_WITH(rlm-FOO-include-dir,
417 [ --with-rlm-FOO-include-dir=DIR Directory to look for include files used by module FOO],
424 dnl See what include-style is used by the make program.
425 dnl AC_MSG_CHECKING(include style for make)
426 dnl echo "include /dev/null" > testmake.$$
427 dnl echo "all:" >> testmake.$$
428 dnl make -f testmake.$$ >/dev/null 2>&1
437 dnl rm -f testmake.$$
438 dnl AC_MSG_RESULT(" $INCLUDE")
439 dnl AC_SUBST(INCLUDE)
442 dnl extra argument: --with-udpfromto
444 AC_ARG_WITH(udpfromto,
445 [ --with-udpfromto Compile in UDPFROMTO support. (default=no)],
455 if test "x$WITH_UDPFROMTO" = "xyes"; then
456 AC_DEFINE(WITH_UDPFROMTO, [], [define if you want udpfromto])
459 dnl #############################################################
461 dnl # 1. Checks for programs
463 dnl #############################################################
466 AC_PATH_PROG(PERL, perl, /usr/local/bin/perl)
467 if test "x$ac_cv_path_PERL" = "x"; then
468 AC_MSG_WARN(perl not found - Simultaneous-Use and checkrad.pl may not work)
470 AC_PATH_PROG(SNMPGET, snmpget)
471 if test "x$ac_cv_path_SNMPGET" = "x"; then
472 AC_MSG_WARN(snmpget not found - Simultaneous-Use and checkrad.pl may not work)
475 AC_PATH_PROG(SNMPWALK, snmpwalk)
476 if test "x$ac_cv_path_SNMPWALK" = "x"; then
477 AC_MSG_WARN(snmpwalk not found - Simultaneous-Use and checkrad.pl may not work)
480 AC_PATH_PROG(RUSERS, rusers, /usr/bin/rusers)
482 dnl FIXME This is truly gross.
483 missing_dir=`cd $ac_aux_dir && pwd`
484 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
485 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
486 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
488 AC_PATH_PROG(LOCATE,locate)
489 AC_PATH_PROG(DIRNAME,dirname)
490 AC_PATH_PROG(GREP,grep)
492 dnl #############################################################
494 dnl # 2. Checks for libraries
496 dnl #############################################################
498 dnl If using pthreads, check for -lpthread (posix) or -lc_r (*BSD)
500 if test "x$WITH_THREADS" = "xyes"; then
501 if test $ac_cv_prog_suncc = "yes"; then
505 AC_CHECK_HEADERS(pthread.h, [], [ WITH_THREADS="no" ])
508 dnl # pthread stuff is usually in -lpthread
509 dnl # or in -lc_r, on *BSD
511 dnl # On Some systems, we need extra pre-processor flags, to get them to
512 dnl # to do the threading properly.
514 AC_CHECK_LIB(pthread, pthread_create,
515 [ CFLAGS="$CFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS"
516 LIBS="-lpthread $LIBS" ],
517 AC_CHECK_LIB(c_r, pthread_create,
518 [ CFLAGS="$CFLAGS -pthread -D_THREAD_SAFE" ],
519 [ WITH_THREADS="no" ]
525 dnl # If we have NO pthread libraries, remove any knowledge of threads.
527 if test "x$WITH_THREADS" != "xyes"; then
529 ac_cv_header_pthread_h="no"
533 dnl # We need sem_init() and friends, as they're the friendliest
534 dnl # semaphore functions for threading.
536 dnl # HP/UX requires linking with librt, too, to get the sem_* symbols.
537 dnl # Some systems have them in -lsem
538 dnl # Solaris has them in -lposix4
539 dnl # NetBSD has them in -lsemaphore
541 AC_SEARCH_LIBS(sem_init, pthread sem posix4 rt semaphore,
543 [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)]
547 dnl Check if we need -lsocket
548 AC_CHECK_LIB(dl, dlopen)
550 dnl Check if we need -lsocket
551 AC_CHECK_LIB(socket, getsockname)
553 dnl Check for -lresolv
554 dnl This library may be needed later.
555 AC_CHECK_LIB(resolv, inet_aton)
557 dnl Check if we need -lnsl. Usually if we want to
558 dnl link against -lsocket we need to include -lnsl as well.
559 AC_CHECK_LIB(nsl, inet_ntoa)
561 dnl Check for OpenSSL libraries.
563 if test "x$WITH_OPENSSL" = xyes; then
565 old_LDFLAGS="$LDFLAGS"
566 if test "x$OPENSSL_LIB_DIR" != "x"; then
567 LDFLAGS="$LDFLAGS -L$OPENSSL_LIB_DIR"
569 AC_CHECK_LIB(crypto, DH_new,
571 LIBS="-lcrypto $LIBS"
572 AC_DEFINE(HAVE_LIBCRYPTO, 1,
573 [Define to 1 if you have the `crypto' library (-lcrypto).])
574 AC_CHECK_LIB(ssl, SSL_new,
576 AC_DEFINE(HAVE_LIBSSL, 1,
577 [Define to 1 if you have the `ssl' library (-lssl).])
578 if test "x$OPENSSL_LIB_DIR" != "x"; then
579 OPENSSL_LIBS="-L$OPENSSL_LIB_DIR"
581 OPENSSL_LIBS="$OPENSSL_LIBS -lcrypto -lssl -lcrypto"
585 LDFLAGS="$old_LDFLAGS"
588 AC_CHECK_LIB(ws2_32, htonl)
590 dnl Check the pcap library for the RADIUS sniffer.
592 AC_CHECK_LIB(pcap, pcap_open_live,
594 AC_DEFINE(HAVE_LIBPCAP, 1,
595 [Define to 1 if you have the `pcap' library (-lpcap).])
597 [ AC_MSG_WARN([pcap library not found, silently disabling the RADIUS sniffer.]) ])
601 dnl #############################################################
603 dnl # 3. Checks for header files
605 dnl #############################################################
608 dnl # Interix requires us to set -D_ALL_SOURCE, otherwise
609 dnl # getopt will be #included, but won't link. <sigh>
614 CFLAGS="$CFLAGS -D_ALL_SOURCE"
617 CFLAGS="$CFLAGS -DDARWIN"
618 LIBS="-framework DirectoryService $LIBS"
668 dnl FreeBSD requires sys/socket.h before net/if.h
669 AC_CHECK_HEADERS(net/if.h, [], [],
670 [#ifdef HAVE_SYS_SOCKET_H
671 # include <sys/socket.h>
676 AC_CHECK_HEADER(pcreposix.h, AC_DEFINE(HAVE_PCREPOSIX_H, [], [define this if we have the <pcreposix.h> header file]))
677 if test "x$ac_cv_header_pcreposix_h" = "xyes"; then
678 AC_DEFINE(HAVE_REGEX_H, [], [define if we have any regex])
682 LIBS="$LIBS -lpcreposix"
685 AC_CHECK_HEADER(regex.h, AC_DEFINE(HAVE_REGEX_H, [], [define this if we have the <regex.h> header file]))
686 if test "x$ac_cv_header_regex_h" = "xyes"; then
695 ], [AC_DEFINE(HAVE_REG_EXTENDED, [], [define this if we have REG_EXTENDED (from <regex.h>)]) REGEX_EXTENDED=yes])
701 AC_SUBST(REGEX_EXTENDED)
704 dnl # other checks which require headers
706 if test "x$ac_cv_header_sys_security_h" = "xyes" && test "x$ac_cv_header_prot_h" = "xyes"
708 AC_DEFINE(OSFC2, [], [define if you have OSFC2 authentication])
711 if test "x$ac_cv_header_sia_h" = "xyes" && test "x$ac_cv_header_siad_h" = "xyes"
713 AC_DEFINE(OSFSIA, [], [define if you have OSFSIA authentication])
716 dnl Check for OpenSSL includes.
717 OPENSSL_INCLUDE="-DNO_OPENSSL"
718 if test "x$WITH_OPENSSL" = xyes; then
719 if test "x$OPENSSL_LIBS" = "x"; then
720 AC_MSG_NOTICE([skipping test for openssl/ssl.h])
722 old_CPPFLAGS=$CPPFLAGS
723 if test "x$OPENSSL_INCLUDE_DIR" != "x"; then
724 CPPFLAGS="$CPPFLAGS -I$OPENSSL_INCLUDE_DIR"
726 dnl # stupid RedHat shit
727 CPPFLAGS="$CPPFLAGS -DOPENSSL_NO_KRB5"
741 if test "x$OPENSSL_LIBS" != "x"; then
742 AC_MSG_CHECKING([for OpenSSL version >= 0.9.7])
744 [#include <openssl/crypto.h>
745 #if (OPENSSL_VERSION_NUMBER >= 0x00907000L)
749 if test "x$goodssl" != "xyes"; then
754 if test "x$OPENSSL_INCLUDE_DIR" != "x"; then
755 OPENSSL_INCLUDE="-I$OPENSSL_INCLUDE_DIR -DOPENSSL_NO_KRB5"
757 OPENSSL_INCLUDE="-DOPENSSL_NO_KRB5"
761 CPPFLAGS=$old_CPPFLAGS
764 AC_SUBST(OPENSSL_INCLUDE)
765 AC_SUBST(OPENSSL_LIBS)
768 dnl Check the pcap includes for the RADIUS sniffer.
769 if test "x$PCAP_LIBS" = x; then
770 AC_MSG_NOTICE([skipping test for pcap.h.])
772 AC_CHECK_HEADER(pcap.h,
773 AC_DEFINE(HAVE_PCAP_H, 1,
774 [Define to 1 if you have the <pcap.h> header file.]),
776 AC_MSG_WARN([pcap.h not found, silently disabling the RADIUS sniffer.])
779 AC_CHECK_LIB(pcap, pcap_fopen_offline,
780 [ AC_DEFINE(HAVE_PCAP_FOPEN_OFFLINE, 1,
781 [Define to 1 if you have the function pcap_fopen_offline.])
783 AC_CHECK_LIB(pcap, pcap_dump_fopen,
784 [ AC_DEFINE(HAVE_PCAP_DUMP_FOPEN, 1,
785 [Define to 1 if you have the function pcap_dump_fopen.])
790 dnl #############################################################
792 dnl # 4. Checks for typedefs
794 dnl #############################################################
797 dnl # Ensure that these are defined
804 dnl check for socklen_t
805 FR_CHECK_TYPE_INCLUDE([
806 #ifdef HAVE_SYS_TYPES_H
807 #include <sys/types.h>
809 #ifdef HAVE_SYS_SOCKET_H
810 #include <sys/socket.h>
812 ],socklen_t, int, [socklen_t is generally 'int' on systems which don't use it])
814 dnl check for uint8_t
815 FR_CHECK_TYPE_INCLUDE([
816 #ifdef HAVE_INTTYPES_H
817 #include <inttypes.h>
822 ],uint8_t, unsigned char, [uint8_t should be the canonical 'octet' for network traffic])
824 dnl check for uint16_t
825 FR_CHECK_TYPE_INCLUDE([
826 #ifdef HAVE_INTTYPES_H
827 #include <inttypes.h>
832 ],uint16_t, unsigned short, [uint16_t should be the canonical '2 octets' for network traffic])
834 dnl check for uint32_t
835 FR_CHECK_TYPE_INCLUDE([
836 #ifdef HAVE_INTTYPES_H
837 #include <inttypes.h>
842 ],uint32_t, unsigned int, [uint32_t should be the canonical 'network integer])
844 AC_CHECK_TYPE(struct in6_addr, AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1, [IPv6 address structure]), [], [
845 #ifdef HAVE_NETINET_IN_H
846 #include <netinet/in.h>
850 AC_CHECK_TYPE(struct sockaddr_storage, AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1, [Generic socket addresses]), [], [
851 #ifdef HAVE_NETINET_IN_H
852 #include <netinet/in.h>
854 #ifdef HAVE_SYS_SOCKET_H
855 #include <sys/socket.h>
859 AC_CHECK_TYPE(struct sockaddr_in6, AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1, [IPv6 socket addresses]), [], [
860 #ifdef HAVE_NETINET_IN_H
861 #include <netinet/in.h>
865 AC_CHECK_TYPE(struct addrinfo, AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1, [Generic DNS lookups]), [], [
866 #ifdef HAVE_SYS_TYPES_H
867 #include <sys/types.h>
869 #ifdef HAVE_SYS_SOCKET_H
870 #include <sys/socket.h>
877 dnl #############################################################
879 dnl # 5. Checks for structures and functions
881 dnl #############################################################
916 RADIUSD_NEED_DECLARATIONS( \
928 dnl # check if we have utmpx.h
929 dnl # if so, check if struct utmpx has entry ut_xtime
930 dnl # if not, set it to define ut_xtime == ut_tv.tv_sec
931 if test "x$ac_cv_header_utmpx_h" = "xyes"
933 FR_CHECK_STRUCT_HAS_MEMBER([#include <utmpx.h>], [struct utmpx], ut_xtime)
934 if test "x$ac_cv_type_struct_utmpx_has_ut_xtime" = "x"
936 AC_DEFINE(ut_xtime,ut_tv.tv_sec, [define to something if you don't have ut_xtime in struct utmpx])
940 dnl # struct ip_pktinfo
941 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in_pktinfo], ipi_addr)
942 if test "x$ac_cv_type_struct_in_pktinfo_has_ipi_addr" = "xyes"
944 AC_DEFINE(HAVE_IP_PKTINFO, [], [define if you have IP_PKTINFO (Linux)])
947 dnl # struct in6_pktinfo
948 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in6_pktinfo], ipi6_addr)
949 if test "x$ac_cv_type_struct_in6_pktinfo_has_ipi6_addr" = "xyes"
951 AC_DEFINE(HAVE_IN6_PKTINFO, [], [define if you have IN6_PKTINFO (Linux)])
954 dnl #############################################################
956 dnl # 6. Checks for compiler characteristics
958 dnl #############################################################
961 dnl # Ensure that these are defined
966 dnl # See if this is OS/2
968 AC_MSG_CHECKING(type of OS)
971 if test "$OS" = "OS/2"; then
978 AC_MSG_CHECKING(for developer gcc flags)
981 if test "x$developer" = "xyes"; then
982 if test "x$GCC" = "xyes"; then
983 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"
984 CFLAGS="$CFLAGS $devflags"
986 AC_MSG_RESULT(yes. Using $devflags)
989 dnl append the current git hash onto the version string
990 if test "x$GIT" = "xyes"; then
991 RADIUSD_VERSION_COMMIT=`git log --pretty=format:'%h' -n 1`
995 CFLAGS="$CFLAGS -DNDEBUG"
1002 dnl #############################################################
1004 dnl # 7. Checks for library functions
1006 dnl #############################################################
1009 LIBS="$LIBS $LIBLTDL"
1010 AC_CHECK_FUNC(lt_dladvise_init, AC_DEFINE(HAVE_LT_DLADVISE_INIT, [], [Do we have the lt_dladvise_init function]))
1013 dnl Check for libcrypt
1014 dnl We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
1015 AC_CHECK_LIB(crypt, crypt,
1018 if test "$CRYPTLIB" != ""; then
1019 AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function])
1021 AC_CHECK_FUNC(crypt, AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function]))
1024 dnl Check for libcipher
1025 AC_CHECK_LIB(cipher, setkey,
1026 CRYPTLIB="${CRYPTLIB} -lcipher"
1030 dnl Check the style of gethostbyaddr, in order of preference
1031 dnl GNU (_r eight args)
1032 AC_DEFINE(GNUSTYLE, [1], [GNU-Style get*byaddr_r])
1033 dnl SYSV (_r six args)
1034 AC_DEFINE(SYSVSTYLE, [2], [SYSV-Style get*byaddr_r])
1035 dnl BSD (three args, may not be thread safe)
1036 AC_DEFINE(BSDSTYLE, [3], [BSD-Style get*byaddr_r])
1037 dnl Tru64 has BSD version, but it is thread safe
1038 dnl http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1739____.HTM
1039 dnl We need #stdio.h to define NULL on FreeBSD (at least)
1040 gethostbyaddrrstyle=""
1041 AC_MSG_CHECKING([gethostbyaddr_r() syntax])
1044 dnl With FreeBSD, check if there's a prototype for gethostbyaddr_r.
1045 dnl Some versions (FreeBSD 5.1?) have a symbol but no prototype - so we
1046 dnl override this test to BSDSTYLE. FreeBSD 6.2 and up have proper GNU
1048 AC_CHECK_DECLS([gethostbyaddr_r], [], [
1049 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE,
1050 [style of gethostbyaddr_r functions ])
1051 gethostbyaddrrstyle=BSD
1052 AC_MSG_WARN([FreeBSD overridden to BSD-style])
1060 if test "x$gethostbyaddrrstyle" = "x"; then
1064 ], [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL, NULL) ], [
1065 AC_DEFINE(GETHOSTBYADDRRSTYLE, GNUSTYLE, [style of gethostbyaddr_r functions ])
1066 gethostbyaddrrstyle=GNU
1069 if test "x$gethostbyaddrrstyle" = "x"; then
1073 ], [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL) ] , [
1074 AC_DEFINE(GETHOSTBYADDRRSTYLE, SYSVSTYLE, [style of gethostbyaddr_r functions ])
1075 gethostbyaddrrstyle=SYSV
1078 if test "x$gethostbyaddrrstyle" = "x"; then
1082 ], [ gethostbyaddr(NULL, 0, 0) ], [
1083 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE, [style of gethostbyaddr_r functions ])
1084 gethostbyaddrrstyle=BSD
1088 if test "x$gethostbyaddrrstyle" = "x"; then
1089 AC_MSG_RESULT([none! It must not exist, here.])
1091 AC_MSG_RESULT([${gethostbyaddrrstyle}-style])
1094 if test "x$gethostbyaddrrstyle" = "xBSD"; then
1095 AC_MSG_WARN([ ****** BSD-style gethostbyaddr might NOT be thread-safe! ****** ])
1098 dnl Check the style of gethostbyname, in order of preference
1099 dnl GNU (_r seven args)
1100 dnl SYSV (_r five args)
1101 dnl BSD (two args, may not be thread safe)
1102 dnl Tru64 has BSD version, but it _is_ thread safe
1103 dnl http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1946____.HTM
1104 dnl We need #stdio.h to define NULL on FreeBSD (at least)
1105 gethostbynamerstyle=""
1106 AC_MSG_CHECKING([gethostbyname_r() syntax])
1110 ], [ gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL) ], [
1111 AC_DEFINE(GETHOSTBYNAMERSTYLE, GNUSTYLE, [style of gethostbyname_r functions ])
1112 gethostbynamerstyle=GNU
1114 if test "x$gethostbynamerstyle" = "x"; then
1118 ], [ gethostbyname_r(NULL, NULL, NULL, 0, NULL) ] , [
1119 AC_DEFINE(GETHOSTBYNAMERSTYLE, SYSVSTYLE, [style of gethostbyname_r functions ])
1120 gethostbynamerstyle=SYSV
1123 if test "x$gethostbynamerstyle" = "x"; then
1127 ], [ gethostbyname(NULL) ], [
1128 AC_DEFINE(GETHOSTBYNAMERSTYLE, BSDSTYLE, [style of gethostbyname_r functions ])
1129 gethostbynamerstyle=BSD
1133 if test "x$gethostbynamerstyle" = "x"; then
1134 AC_MSG_RESULT([none! It must not exist, here.])
1136 AC_MSG_RESULT([${gethostbynamerstyle}-style])
1139 if test "x$gethostbynamerstyle" = "xBSD"; then
1140 AC_MSG_WARN([ ****** BSD-style gethostbyname might NOT be thread-safe! ****** ])
1143 dnl check for non-posix solaris ctime_r (extra buflen int arg)
1144 AC_DEFINE(POSIXSTYLE, [1], [Posix-Style ctime_r])
1145 AC_DEFINE(SOLARISSTYLE, [2], [Solaris-Style ctime_r])
1147 AC_MSG_CHECKING([ctime_r() syntax])
1150 ], [ ctime_r(NULL, NULL, 0) ], [
1151 AC_DEFINE(CTIMERSTYLE, SOLARISSTYLE, [style of ctime_r function])
1152 ctimerstyle="SOLARIS"
1154 if test "x$ctimerstyle" = "x"; then
1157 ], [ ctime_r(NULL, NULL) ], [
1158 AC_DEFINE(CTIMERSTYLE, POSIXSTYLE, [style of ctime_r function])
1163 if test "x$ctimerstyle" = "x"; then
1164 AC_MSG_RESULT([none! It must not exist, here.])
1166 AC_MSG_RESULT([${ctimerstyle}-style])
1169 AC_SUBST(HOSTINFO, $host)
1171 dnl #############################################################
1173 dnl # 8. Checks for system services
1175 dnl #############################################################
1178 dnl # Figure out where libtool is located,
1182 AC_MSG_RESULT([top_builddir=$top_builddir])
1183 dnl # AC_SUBST(top_builddir)
1187 dnl import libtool stuff
1189 dnl #############################################################
1191 dnl # Configure in any module directories.
1193 dnl #############################################################
1196 if test "x$EXPERIMENTAL" = "xyes"; then
1197 bar=`ls -1 "${srcdir}"/src/modules/rlm_*/configure | sed 's%/configure%%'`
1198 dnl # get rid of LF's.
1199 mysubdirs=`echo $mysubdirs $bar`
1202 dnl # Find 'configure' in ONLY the stable modules
1204 for bar in `cat "${srcdir}"/src/modules/stable`; do
1205 if test -f "${srcdir}"/src/modules/$bar/configure; then
1206 mysubdirs="$mysubdirs src/modules/$bar"
1211 dnl ############################################################
1212 dnl # make modules by list
1213 dnl #############################################################
1214 if test "x$EXPERIMENTAL" = "xyes"; then
1215 for foo in `ls -1 "${srcdir}"/src/modules | grep rlm_`; do
1216 MODULES="$MODULES $foo"
1220 dnl # make ONLY the stable modules
1222 for foo in `cat "${srcdir}"/src/modules/stable`; do
1223 MODULES="$MODULES $foo"
1228 dnl # Don't change the variable name here. Autoconf goes bonkers
1231 AC_CONFIG_SUBDIRS($mysubdirs)
1234 dnl #############################################################
1236 dnl # And finally, output the results.
1238 dnl #############################################################
1240 AC_CONFIG_COMMANDS([stamp-h], [echo timestamp > src/include/stamp-h])
1241 AC_CONFIG_COMMANDS([build-radpaths-h], [(cd ./src/include && /bin/sh ./build-radpaths-h)])
1242 AC_CONFIG_COMMANDS([main-chmod], [(cd ./src/main && chmod +x checkrad.pl radlast radtest)])
1243 AC_CONFIG_COMMANDS([scripts-chmod], [(cd ./scripts && chmod +x rc.radiusd radiusd.cron.daily radiusd.cron.monthly cryptpasswd)])
1246 dnl # Substitute whatever libraries we found to be necessary
1249 AC_SUBST(INSTALLSTRIP)
1251 USE_SHARED_LIBS=$enable_shared
1252 AC_SUBST(USE_SHARED_LIBS)
1253 USE_STATIC_LIBS=$enable_static
1254 AC_SUBST(USE_STATIC_LIBS)
1255 AC_SUBST(STATIC_MODULES)
1256 AC_SUBST(RADIUSD_MAJOR_VERSION)
1257 AC_SUBST(RADIUSD_MINOR_VERSION)
1258 AC_SUBST(RADIUSD_INCRM_VERSION)
1259 AC_SUBST(RADIUSD_VERSION)
1260 AC_SUBST(RADIUSD_VERSION_STRING)
1261 AC_SUBST(RADIUSD_VERSION_COMMIT)
1265 ./src/include/build-radpaths-h \
1266 ./src/main/Makefile \
1267 ./src/main/radsniff.mk \
1268 ./src/main/checkrad.pl \
1269 ./src/main/radlast \
1270 ./src/main/radtest \
1271 ./scripts/rc.radiusd \
1272 ./scripts/radiusd.cron.daily \
1273 ./scripts/radiusd.cron.monthly \
1274 ./scripts/cryptpasswd \
1275 ./raddb/dictionary \
1276 ./raddb/radrelay.conf \
1277 ./raddb/radiusd.conf