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
56 dnl # As of OSX 10.9 (Mavericks), /usr is no longer populated with the
57 dnl # standard set of headers and libraries, instead were meant to use
58 dnl # one of the SDKs which contains system headers and libraries for
59 dnl # different versions of OSX and iOS.
64 dnl # The version of GCC apple ships with Mavericks works out of the
65 dnl # box, and presumably selects the highest version SDK for OSX.
67 AC_MSG_CHECKING([if cc is apple llvm])
68 if ! $CC --version 2>&1 | grep -I 'Apple LLVM' > /dev/null; then
70 AC_CHECK_PROG(SW_VERS, sw_vers, yes, no)
71 AC_CHECK_PROG(XCODEBUILD, xcodebuild, yes, no)
73 if test "x$SW_VERS" = "xyes" && test "x$XCODEBUILD" = "xyes"; then
74 AC_MSG_NOTICE([determining OSX SDK path])
75 osx_sdk_path=$(xcodebuild -version -sdk macosx$(sw_vers -productVersion) Path)
76 AC_MSG_RESULT([$osx_sdk_path])
79 dnl # We need to export these, else the child configure scripts all fail
80 dnl # their compiler checks.
82 export CFLAGS="--sysroot=$osx_sdk_path $CFLAGS"
83 export CPPFLAGS="--sysroot=$osx_sdk_path $CPPFLAGS"
84 export LDFLAGS="-L$osx_sdk_path/usr/lib/ $LDFLAGS"
97 dnl # check for AIX, to allow us to use some BSD functions
98 dnl # must be before macros that call the compiler.
102 AC_PROG_GCC_TRADITIONAL
107 dnl # Set Default CFLAGS
109 if test "x$GCC" = "xyes"; then
110 CFLAGS="$CFLAGS -Wall -D_GNU_SOURCE"
113 dnl Compile in large (2G+) file support.
116 dnl # check for system bytesex
117 dnl # AC_DEFINES WORDS_BIGENDIAN
121 AC_CHECK_PROG(GMAKE, gmake, yes, no)
122 if test $GMAKE = no; then
123 AC_PATH_PROG(MAKE, make, /usr/local/bin/make)
125 AC_PATH_PROG(MAKE, gmake, /usr/local/gnu/bin/make)
127 makever=`$ac_cv_path_MAKE --version 2>&1 | grep "GNU Make"`
128 if test -z "$makever"; then
129 AC_MSG_ERROR(GNU Make is not installed. Please download and install it
130 from ftp://prep.ai.mit.edu/pub/gnu/make/ before continuing.)
133 dnl See if we have Git.
134 AC_CHECK_PROG(GIT, git, yes, no)
136 AC_ARG_WITH(system-libltdl,
137 [ --with-system-libltdl Use the libltdl installed in your system (default=use our own)],
140 INCLTDL=-DWITH_SYSTEM_LTDL
144 dnl If libltdl isn't installable, set it to be installable.
145 [test x"$enable_ltdl_install" = x && enable_ltdl_install=yes]
146 AC_LIBLTDL_INSTALLABLE
148 dnl tell Makefile to build ltdl if needed
149 if test x"$enable_ltdl_install" = x"yes"; then
153 AC_SUBST(LTDL_SUBDIRS)
155 dnl use system-wide libtool, if it exists
156 AC_ARG_WITH(system-libtool,
157 [ --with-system-libtool Use the libtool installed in your system (default=use our own)],
158 [ AC_PATH_PROG(LIBTOOL, libtool,,$PATH:/usr/local/bin) AC_LIBTOOL_DLOPEN
161 LIBTOOL="`pwd`/libtool"
163 dnl ensure that we're looking for dlopen
166 dnl Figure out how to build shared libraries
171 dnl Put this in later, when all distributed modules use autoconf.
172 dnl AC_ARG_WITH(disablemodulefoo,
173 dnl [ --without-rlm_foo Disables module compilation. Module list:]
174 dnl esyscmd([find src/modules -type d -name rlm_\* -print |\
175 dnl sed -e 's%src/modules/.*/% (sub)- %; s%.*/%- %' |\
176 dnl awk '{print " "$0}']))
178 AC_ARG_ENABLE(strict-dependencies,
179 [ --enable-strict-dependencies Fail configure on lack of module dependancy.])
181 dnl extra argument: --with-docdir
182 docdir='${datadir}/doc/freeradius'
183 AC_MSG_CHECKING(docdir)
185 [ --with-docdir=DIR Directory for documentation [DATADIR/doc/freeradius] ],
192 [[\\/$]]* | ?:[[\\/]]* )
196 AC_MSG_ERROR([expected an absolute directory name for --with-docdir: $withval])
201 AC_MSG_RESULT($docdir)
202 if test "x$docdir" = xno; then
203 AC_MSG_WARN(Documentation files will NOT be installed.)
206 dnl extra argument: --with-logdir
207 logdir='${localstatedir}/log/radius'
208 AC_MSG_CHECKING(logdir)
210 [ --with-logdir=DIR Directory for logfiles [LOCALSTATEDIR/log/radius] ],
213 AC_MSG_ERROR(Need logdir)
217 [[\\/$]]* | ?:[[\\/]]* )
221 AC_MSG_ERROR([expected an absolute directory name for --with-logdir: $withval])
226 AC_MSG_RESULT($logdir)
228 dnl extra argument: --with-radacctdir
229 radacctdir='${logdir}/radacct'
230 AC_MSG_CHECKING(radacctdir)
231 AC_ARG_WITH(radacctdir,
232 [ --with-radacctdir=DIR Directory for detail files [LOGDIR/radacct] ],
235 AC_MSG_ERROR(Need radacctdir)
239 [[\\/$]]* | ?:[[\\/]]* )
240 radacctdir="$withval"
243 AC_MSG_ERROR([expected an absolute directory name for --with-radacctdir: $withval])
248 AC_MSG_RESULT($radacctdir)
250 dnl extra argument: --with-raddbdir
251 raddbdir='${sysconfdir}/raddb'
252 AC_MSG_CHECKING(raddbdir)
253 AC_ARG_WITH(raddbdir,
254 [ --with-raddbdir=DIR Directory for config files [SYSCONFDIR/raddb] ],
257 AC_MSG_ERROR(Need raddbdir)
261 [[\\/$]]* | ?:[[\\/]]* )
265 AC_MSG_ERROR([expected an absolute directory name for --with-raddbdir: $withval])
270 AC_MSG_RESULT($raddbdir)
272 dnl extra argument: --with-ascend-binary
274 AC_ARG_WITH(ascend-binary,
275 [ --with-ascend-binary Include support for Ascend binary filter attributes (default=yes)],
283 if test "X$ASCEND_BINARY" = "Xyes"; then
284 AC_DEFINE(ASCEND_BINARY, [], [Include support for Ascend binary filter attributes])
287 dnl extra argument: --with-threads
290 [ --with-threads Use threads, if available. (default=yes) ],
299 dnl extra argument: --with-vmps
302 [ --with-vmps Compile in VMPS support. (default=yes)],
310 if test "x$WITH_VMPS" = "xyes"; then
311 AC_DEFINE(WITH_VMPS, [1], [define if you want VMPS support])
314 dnl extra argument: --with-dhcp
317 [ --with-dhcp Compile in DHCP support. (default=yes)],
325 if test "x$WITH_DHCP" = "xyes"; then
326 AC_DEFINE(WITH_DHCP, [1], [define if you want DHCP support])
330 dnl extra argument: --with-post-proxy-authorize
331 WITH_POST_PROXY_AUTHORIZE=
332 AC_ARG_WITH(post-proxy-authorize,
333 [ --with-post-proxy-authorize 1.x compatibility (default=no) ],
336 WITH_POST_PROXY_AUTHORIZE=""
344 dnl # Allow the user to specify a list of modules to be linked
345 dnl # statically to the server.
348 AC_ARG_WITH(static_modules,
349 [ --with-static-modules=QUOTED-MODULE-LIST],[
350 for i in $withval; do
351 STATIC_MODULES="$STATIC_MODULES -dlpreopen ../modules/rlm_$i/rlm_$i.la"
357 [ --with-modules=QUOTED-MODULE-LIST],[
358 for i in $withval; do
359 MODULES="$MODULES $i"
364 dnl # Enable developer C compiler warnings
366 AC_ARG_ENABLE(developer,
367 [ --enable-developer Enables features of interest to developers.],
368 [ case "$enableval" in
377 if test -d $srcdir/.git; then
378 if test "x$developer" != "xno"; then
379 dnl turn on the developer flag when taken from a git checkout (not a release)
383 dnl append the current git hash onto the version string
384 if test "x$GIT" = "xyes"; then
385 RADIUSD_VERSION_COMMIT=`git log --pretty=format:'%h' -n 1`
389 dnl extra argument: --with-experimental-modules
391 AC_ARG_WITH(experimental-modules,
392 [ --with-experimental-modules Use experimental and unstable modules. (default=no) ],
401 dnl extra argument: --with-openssl
404 [ --with-openssl Use OpenSSL. (default=yes)],
416 dnl # extra argument: --with-openssl-includes=dir
419 AC_ARG_WITH(openssl-includes,
420 [ --with-openssl-includes=DIR Directory to look for OpenSSL include files],
422 *) OPENSSL_INCLUDE_DIR="$withval"
428 dnl # extra argument: --with-openssl-libraries=dir
431 AC_ARG_WITH(openssl-libraries,
432 [ --with-openssl-libraries=DIR Directory to look for OpenSSL library files],
434 *) OPENSSL_LIB_DIR="$withval"
440 dnl # These next two arguments don't actually do anything. They're
441 dnl # place holders so that the top-level configure script can tell
442 dnl # the user how to configure lower-level modules
446 dnl # extra argument: --with-rlm-FOO-lib-dir
448 AC_ARG_WITH(rlm-FOO-lib-dir,
449 [ --with-rlm-FOO-lib-dir=DIR Directory to look for library files used by module FOO],
457 dnl # extra argument: --with-rlm-FOO-include-dir
459 AC_ARG_WITH(rlm-FOO-include-dir,
460 [ --with-rlm-FOO-include-dir=DIR Directory to look for include files used by module FOO],
467 dnl See what include-style is used by the make program.
468 dnl AC_MSG_CHECKING(include style for make)
469 dnl echo "include /dev/null" > testmake.$$
470 dnl echo "all:" >> testmake.$$
471 dnl make -f testmake.$$ >/dev/null 2>&1
480 dnl rm -f testmake.$$
481 dnl AC_MSG_RESULT(" $INCLUDE")
482 dnl AC_SUBST(INCLUDE)
485 dnl extra argument: --with-udpfromto
487 AC_ARG_WITH(udpfromto,
488 [ --with-udpfromto Compile in UDPFROMTO support. (default=no)],
498 if test "x$WITH_UDPFROMTO" = "xyes"; then
499 AC_DEFINE(WITH_UDPFROMTO, [], [define if you want udpfromto])
502 dnl #############################################################
504 dnl # 1. Checks for programs
506 dnl #############################################################
509 AC_PATH_PROG(PERL, perl, /usr/local/bin/perl)
510 if test "x$ac_cv_path_PERL" = "x"; then
511 AC_MSG_WARN(perl not found - Simultaneous-Use and checkrad.pl may not work)
513 AC_PATH_PROG(SNMPGET, snmpget)
514 if test "x$ac_cv_path_SNMPGET" = "x"; then
515 AC_MSG_WARN(snmpget not found - Simultaneous-Use and checkrad.pl may not work)
518 AC_PATH_PROG(SNMPWALK, snmpwalk)
519 if test "x$ac_cv_path_SNMPWALK" = "x"; then
520 AC_MSG_WARN(snmpwalk not found - Simultaneous-Use and checkrad.pl may not work)
523 AC_PATH_PROG(RUSERS, rusers, /usr/bin/rusers)
525 dnl FIXME This is truly gross.
526 missing_dir=`cd $ac_aux_dir && pwd`
527 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
528 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
529 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
531 AC_PATH_PROG(LOCATE,locate)
532 AC_PATH_PROG(DIRNAME,dirname)
533 AC_PATH_PROG(GREP,grep)
535 dnl #############################################################
537 dnl # 2. Checks for libraries
539 dnl #############################################################
541 dnl If using pthreads, check for -lpthread (posix) or -lc_r (*BSD)
543 if test "x$WITH_THREADS" = "xyes"; then
544 if test $ac_cv_prog_suncc = "yes"; then
548 AC_CHECK_HEADERS(pthread.h, [], [ WITH_THREADS="no" ])
551 dnl # pthread stuff is usually in -lpthread
552 dnl # or in -lc_r, on *BSD
554 dnl # On Some systems, we need extra pre-processor flags, to get them to
555 dnl # to do the threading properly.
557 AC_CHECK_LIB(pthread, pthread_create,
558 [ CFLAGS="$CFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS"
559 LIBS="-lpthread $LIBS" ],
560 AC_CHECK_LIB(c_r, pthread_create,
561 [ CFLAGS="$CFLAGS -pthread -D_THREAD_SAFE" ],
562 [ WITH_THREADS="no" ]
568 dnl # If we have NO pthread libraries, remove any knowledge of threads.
570 if test "x$WITH_THREADS" != "xyes"; then
572 ac_cv_header_pthread_h="no"
576 dnl # We need sem_init() and friends, as they're the friendliest
577 dnl # semaphore functions for threading.
579 dnl # HP/UX requires linking with librt, too, to get the sem_* symbols.
580 dnl # Some systems have them in -lsem
581 dnl # Solaris has them in -lposix4
582 dnl # NetBSD has them in -lsemaphore
584 AC_SEARCH_LIBS(sem_init, pthread sem posix4 rt semaphore,
586 [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)]
590 dnl Check if we need -lsocket
591 AC_CHECK_LIB(socket, getsockname)
593 dnl Check for -lresolv
594 dnl This library may be needed later.
595 AC_CHECK_LIB(resolv, inet_aton)
597 dnl Check if we need -lnsl. Usually if we want to
598 dnl link against -lsocket we need to include -lnsl as well.
599 AC_CHECK_LIB(nsl, inet_ntoa)
601 dnl Check for OpenSSL libraries.
603 if test "x$WITH_OPENSSL" = xyes; then
605 old_LDFLAGS="$LDFLAGS"
606 if test "x$OPENSSL_LIB_DIR" != "x"; then
607 LDFLAGS="$LDFLAGS -L$OPENSSL_LIB_DIR"
609 AC_CHECK_LIB(crypto, DH_new,
611 LIBS="-lcrypto $LIBS"
612 AC_DEFINE(HAVE_LIBCRYPTO, 1,
613 [Define to 1 if you have the `crypto' library (-lcrypto).])
614 AC_CHECK_LIB(ssl, SSL_new,
616 AC_DEFINE(HAVE_LIBSSL, 1,
617 [Define to 1 if you have the `ssl' library (-lssl).])
618 if test "x$OPENSSL_LIB_DIR" != "x"; then
619 OPENSSL_LIBS="-L$OPENSSL_LIB_DIR"
621 OPENSSL_LIBS="$OPENSSL_LIBS -lcrypto -lssl -lcrypto"
625 LDFLAGS="$old_LDFLAGS"
628 AC_CHECK_LIB(ws2_32, htonl)
630 dnl Check the pcap library for the RADIUS sniffer.
632 AC_CHECK_LIB(pcap, pcap_open_live,
634 AC_DEFINE(HAVE_LIBPCAP, 1,
635 [Define to 1 if you have the `pcap' library (-lpcap).])
637 [ AC_MSG_WARN([pcap library not found, silently disabling the RADIUS sniffer.]) ])
641 dnl #############################################################
643 dnl # 3. Checks for header files
645 dnl #############################################################
648 dnl # Interix requires us to set -D_ALL_SOURCE, otherwise
649 dnl # getopt will be #included, but won't link. <sigh>
654 CFLAGS="$CFLAGS -D_ALL_SOURCE"
657 CFLAGS="$CFLAGS -DDARWIN"
658 LIBS="-framework DirectoryService $LIBS"
707 dnl FreeBSD requires sys/socket.h before net/if.h
708 AC_CHECK_HEADERS(net/if.h, [], [],
709 [#ifdef HAVE_SYS_SOCKET_H
710 # include <sys/socket.h>
715 AC_CHECK_HEADER(regex.h, AC_DEFINE(HAVE_REGEX_H, [], [define this if we have the <regex.h> header file]))
716 if test "x$ac_cv_header_regex_h" = "xyes"; then
724 ], [AC_DEFINE(HAVE_REG_EXTENDED, [], [define this if we have REG_EXTENDED (from <regex.h>)]) REGEX_EXTENDED=yes])
727 AC_SUBST(REGEX_EXTENDED)
730 dnl # other checks which require headers
732 if test "x$ac_cv_header_sys_security_h" = "xyes" && test "x$ac_cv_header_prot_h" = "xyes"
734 AC_DEFINE(OSFC2, [], [define if you have OSFC2 authentication])
737 if test "x$ac_cv_header_sia_h" = "xyes" && test "x$ac_cv_header_siad_h" = "xyes"
739 AC_DEFINE(OSFSIA, [], [define if you have OSFSIA authentication])
742 dnl Check for OpenSSL includes.
743 OPENSSL_INCLUDE="-DNO_OPENSSL"
744 if test "x$WITH_OPENSSL" = xyes; then
745 if test "x$OPENSSL_LIBS" = "x"; then
746 AC_MSG_NOTICE([skipping test for openssl/ssl.h])
748 old_CPPFLAGS=$CPPFLAGS
749 if test "x$OPENSSL_INCLUDE_DIR" != "x"; then
750 CPPFLAGS="$CPPFLAGS -I$OPENSSL_INCLUDE_DIR"
752 dnl # stupid RedHat shit
753 CPPFLAGS="$CPPFLAGS -DOPENSSL_NO_KRB5"
764 if test "x$OPENSSL_LIBS" != "x"; then
765 AC_MSG_CHECKING([for OpenSSL version >= 0.9.7])
767 [#include <openssl/crypto.h>
768 #if (OPENSSL_VERSION_NUMBER >= 0x00907000L)
772 if test "x$goodssl" != "xyes"; then
777 if test "x$OPENSSL_INCLUDE_DIR" != "x"; then
778 OPENSSL_INCLUDE="-I$OPENSSL_INCLUDE_DIR -DOPENSSL_NO_KRB5"
780 OPENSSL_INCLUDE="-DOPENSSL_NO_KRB5"
784 CPPFLAGS=$old_CPPFLAGS
787 AC_SUBST(OPENSSL_INCLUDE)
788 AC_SUBST(OPENSSL_LIBS)
791 dnl Check the pcap includes for the RADIUS sniffer.
792 if test "x$PCAP_LIBS" = x; then
793 AC_MSG_NOTICE([skipping test for pcap.h.])
795 AC_CHECK_HEADER(pcap.h,
796 AC_DEFINE(HAVE_PCAP_H, 1,
797 [Define to 1 if you have the <pcap.h> header file.]),
799 AC_MSG_WARN([pcap.h not found, silently disabling the RADIUS sniffer.])
802 AC_CHECK_LIB(pcap, pcap_fopen_offline,
803 [ AC_DEFINE(HAVE_PCAP_FOPEN_OFFLINE, 1,
804 [Define to 1 if you have the function pcap_fopen_offline.])
806 AC_CHECK_LIB(pcap, pcap_dump_fopen,
807 [ AC_DEFINE(HAVE_PCAP_DUMP_FOPEN, 1,
808 [Define to 1 if you have the function pcap_dump_fopen.])
813 dnl #############################################################
815 dnl # 4. Checks for typedefs
817 dnl #############################################################
820 dnl # Ensure that these are defined
827 dnl check for socklen_t
828 FR_CHECK_TYPE_INCLUDE([
829 #ifdef HAVE_SYS_TYPES_H
830 #include <sys/types.h>
832 #ifdef HAVE_SYS_SOCKET_H
833 #include <sys/socket.h>
835 ],socklen_t, int, [socklen_t is generally 'int' on systems which don't use it])
837 dnl check for uint8_t
838 FR_CHECK_TYPE_INCLUDE([
839 #ifdef HAVE_INTTYPES_H
840 #include <inttypes.h>
845 ],uint8_t, unsigned char, [uint8_t should be the canonical 'octet' for network traffic])
847 dnl check for uint16_t
848 FR_CHECK_TYPE_INCLUDE([
849 #ifdef HAVE_INTTYPES_H
850 #include <inttypes.h>
855 ],uint16_t, unsigned short, [uint16_t should be the canonical '2 octets' for network traffic])
857 dnl check for uint32_t
858 FR_CHECK_TYPE_INCLUDE([
859 #ifdef HAVE_INTTYPES_H
860 #include <inttypes.h>
865 ],uint32_t, unsigned int, [uint32_t should be the canonical 'network integer])
867 AC_CHECK_TYPE(struct in6_addr, AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1, [IPv6 address structure]), [], [
868 #ifdef HAVE_NETINET_IN_H
869 #include <netinet/in.h>
873 AC_CHECK_TYPE(struct sockaddr_storage, AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1, [Generic socket addresses]), [], [
874 #ifdef HAVE_NETINET_IN_H
875 #include <netinet/in.h>
877 #ifdef HAVE_SYS_SOCKET_H
878 #include <sys/socket.h>
882 AC_CHECK_TYPE(struct sockaddr_in6, AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1, [IPv6 socket addresses]), [], [
883 #ifdef HAVE_NETINET_IN_H
884 #include <netinet/in.h>
888 AC_CHECK_TYPE(struct addrinfo, AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1, [Generic DNS lookups]), [], [
889 #ifdef HAVE_SYS_TYPES_H
890 #include <sys/types.h>
892 #ifdef HAVE_SYS_SOCKET_H
893 #include <sys/socket.h>
900 dnl #############################################################
902 dnl # 5. Checks for structures and functions
904 dnl #############################################################
939 RADIUSD_NEED_DECLARATIONS( \
951 dnl # check if we have utmpx.h
952 dnl # if so, check if struct utmpx has entry ut_xtime
953 dnl # if not, set it to define ut_xtime == ut_tv.tv_sec
954 if test "x$ac_cv_header_utmpx_h" = "xyes"
956 FR_CHECK_STRUCT_HAS_MEMBER([#include <utmpx.h>], [struct utmpx], ut_xtime)
957 if test "x$ac_cv_type_struct_utmpx_has_ut_xtime" = "x"
959 AC_DEFINE(ut_xtime,ut_tv.tv_sec, [define to something if you don't have ut_xtime in struct utmpx])
963 dnl # struct ip_pktinfo
964 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in_pktinfo], ipi_addr)
965 if test "x$ac_cv_type_struct_in_pktinfo_has_ipi_addr" = "xyes"
967 AC_DEFINE(HAVE_IP_PKTINFO, [], [define if you have IP_PKTINFO (Linux)])
970 dnl # struct in6_pktinfo
971 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in6_pktinfo], ipi6_addr)
972 if test "x$ac_cv_type_struct_in6_pktinfo_has_ipi6_addr" = "xyes"
974 AC_DEFINE(HAVE_IN6_PKTINFO, [], [define if you have IN6_PKTINFO (Linux)])
977 dnl #############################################################
979 dnl # 6. Checks for compiler characteristics
981 dnl #############################################################
984 dnl # Ensure that these are defined
989 dnl # See if this is OS/2
991 AC_MSG_CHECKING(type of OS)
994 if test "$OS" = "OS/2"; then
1001 AC_MSG_CHECKING(for developer gcc flags)
1002 if test "x$developer" = "xyes" -a "x$GCC" = "xyes"; then
1003 devflags="-g -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -W -Wredundant-decls -Wundef"
1004 CFLAGS="$CFLAGS $devflags"
1006 AC_MSG_RESULT(yes. Using $devflags)
1009 CFLAGS="$CFLAGS -DNDEBUG"
1016 dnl #############################################################
1018 dnl # 7. Checks for library functions
1020 dnl #############################################################
1023 LIBS="$LIBS $LIBLTDL"
1024 AC_CHECK_FUNC(lt_dladvise_init, AC_DEFINE(HAVE_LT_DLADVISE_INIT, [], [Do we have the lt_dladvise_init function]))
1027 dnl Check for libcrypt
1028 dnl We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
1029 AC_CHECK_LIB(crypt, crypt,
1032 if test "$CRYPTLIB" != ""; then
1033 AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function])
1035 AC_CHECK_FUNC(crypt, AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function]))
1038 dnl Check for libcipher
1039 AC_CHECK_LIB(cipher, setkey,
1040 CRYPTLIB="${CRYPTLIB} -lcipher"
1044 dnl Check the style of gethostbyaddr, in order of preference
1045 dnl GNU (_r eight args)
1046 AC_DEFINE(GNUSTYLE, [1], [GNU-Style get*byaddr_r])
1047 dnl SYSV (_r six args)
1048 AC_DEFINE(SYSVSTYLE, [2], [SYSV-Style get*byaddr_r])
1049 dnl BSD (three args, may not be thread safe)
1050 AC_DEFINE(BSDSTYLE, [3], [BSD-Style get*byaddr_r])
1051 dnl Tru64 has BSD version, but it is thread safe
1052 dnl http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1739____.HTM
1053 dnl We need #stdio.h to define NULL on FreeBSD (at least)
1054 gethostbyaddrrstyle=""
1055 AC_MSG_CHECKING([gethostbyaddr_r() syntax])
1058 dnl With FreeBSD, check if there's a prototype for gethostbyaddr_r.
1059 dnl Some versions (FreeBSD 5.1?) have a symbol but no prototype - so we
1060 dnl override this test to BSDSTYLE. FreeBSD 6.2 and up have proper GNU
1062 AC_CHECK_DECLS([gethostbyaddr_r], [], [
1063 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE,
1064 [style of gethostbyaddr_r functions ])
1065 gethostbyaddrrstyle=BSD
1066 AC_MSG_WARN([FreeBSD overridden to BSD-style])
1074 if test "x$gethostbyaddrrstyle" = "x"; then
1078 ], [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL, NULL) ], [
1079 AC_DEFINE(GETHOSTBYADDRRSTYLE, GNUSTYLE, [style of gethostbyaddr_r functions ])
1080 gethostbyaddrrstyle=GNU
1083 if test "x$gethostbyaddrrstyle" = "x"; then
1087 ], [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL) ] , [
1088 AC_DEFINE(GETHOSTBYADDRRSTYLE, SYSVSTYLE, [style of gethostbyaddr_r functions ])
1089 gethostbyaddrrstyle=SYSV
1092 if test "x$gethostbyaddrrstyle" = "x"; then
1096 ], [ gethostbyaddr(NULL, 0, 0) ], [
1097 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE, [style of gethostbyaddr_r functions ])
1098 gethostbyaddrrstyle=BSD
1102 if test "x$gethostbyaddrrstyle" = "x"; then
1103 AC_MSG_RESULT([none! It must not exist, here.])
1105 AC_MSG_RESULT([${gethostbyaddrrstyle}-style])
1108 if test "x$gethostbyaddrrstyle" = "xBSD"; then
1109 AC_MSG_WARN([ ****** BSD-style gethostbyaddr might NOT be thread-safe! ****** ])
1112 dnl Check the style of gethostbyname, in order of preference
1113 dnl GNU (_r seven args)
1114 dnl SYSV (_r five args)
1115 dnl BSD (two args, may not be thread safe)
1116 dnl Tru64 has BSD version, but it _is_ thread safe
1117 dnl http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1946____.HTM
1118 dnl We need #stdio.h to define NULL on FreeBSD (at least)
1119 gethostbynamerstyle=""
1120 AC_MSG_CHECKING([gethostbyname_r() syntax])
1124 ], [ gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL) ], [
1125 AC_DEFINE(GETHOSTBYNAMERSTYLE, GNUSTYLE, [style of gethostbyname_r functions ])
1126 gethostbynamerstyle=GNU
1128 if test "x$gethostbynamerstyle" = "x"; then
1132 ], [ gethostbyname_r(NULL, NULL, NULL, 0, NULL) ] , [
1133 AC_DEFINE(GETHOSTBYNAMERSTYLE, SYSVSTYLE, [style of gethostbyname_r functions ])
1134 gethostbynamerstyle=SYSV
1137 if test "x$gethostbynamerstyle" = "x"; then
1141 ], [ gethostbyname(NULL) ], [
1142 AC_DEFINE(GETHOSTBYNAMERSTYLE, BSDSTYLE, [style of gethostbyname_r functions ])
1143 gethostbynamerstyle=BSD
1147 if test "x$gethostbynamerstyle" = "x"; then
1148 AC_MSG_RESULT([none! It must not exist, here.])
1150 AC_MSG_RESULT([${gethostbynamerstyle}-style])
1153 if test "x$gethostbynamerstyle" = "xBSD"; then
1154 AC_MSG_WARN([ ****** BSD-style gethostbyname might NOT be thread-safe! ****** ])
1157 dnl check for non-posix solaris ctime_r (extra buflen int arg)
1158 AC_DEFINE(POSIXSTYLE, [1], [Posix-Style ctime_r])
1159 AC_DEFINE(SOLARISSTYLE, [2], [Solaris-Style ctime_r])
1161 AC_MSG_CHECKING([ctime_r() syntax])
1164 ], [ ctime_r(NULL, NULL, 0) ], [
1165 AC_DEFINE(CTIMERSTYLE, SOLARISSTYLE, [style of ctime_r function])
1166 ctimerstyle="SOLARIS"
1168 if test "x$ctimerstyle" = "x"; then
1171 ], [ ctime_r(NULL, NULL) ], [
1172 AC_DEFINE(CTIMERSTYLE, POSIXSTYLE, [style of ctime_r function])
1177 if test "x$ctimerstyle" = "x"; then
1178 AC_MSG_RESULT([none! It must not exist, here.])
1180 AC_MSG_RESULT([${ctimerstyle}-style])
1183 AC_SUBST(HOSTINFO, $host)
1185 if test "x$WITH_POST_PROXY_AUTHORIZE" != "x"; then
1186 AC_DEFINE(WITH_POST_PROXY_AUTHORIZE, 1, [1.x compatibility])
1189 dnl #############################################################
1191 dnl # 8. Checks for system services
1193 dnl #############################################################
1196 dnl # Figure out where libtool is located,
1200 AC_MSG_RESULT([top_builddir=$top_builddir])
1201 dnl # AC_SUBST(top_builddir)
1205 dnl import libtool stuff
1207 dnl #############################################################
1209 dnl # Configure in any module directories.
1211 dnl #############################################################
1213 mysubdirs="$LIBLTDLPATH"
1214 if test "x$EXPERIMENTAL" = "xyes"; then
1215 bar=`ls -1 "${srcdir}"/src/modules/rlm_*/configure | sed 's%/configure%%'`
1216 dnl # get rid of LF's.
1217 mysubdirs=`echo $mysubdirs $bar`
1220 dnl # Find 'configure' in ONLY the stable modules
1222 for bar in `cat "${srcdir}"/src/modules/stable`; do
1223 if test -f "${srcdir}"/src/modules/$bar/configure; then
1224 mysubdirs="$mysubdirs src/modules/$bar"
1229 dnl ############################################################
1230 dnl # make modules by list
1231 dnl #############################################################
1232 if test "x$EXPERIMENTAL" = "xyes"; then
1233 for foo in `ls -1 "${srcdir}"/src/modules | grep rlm_`; do
1234 MODULES="$MODULES $foo"
1238 dnl # make ONLY the stable modules
1240 for foo in `cat "${srcdir}"/src/modules/stable`; do
1241 MODULES="$MODULES $foo"
1246 dnl # Don't change the variable name here. Autoconf goes bonkers
1249 AC_CONFIG_SUBDIRS($LTDL_SUBDIRS $mysubdirs)
1252 dnl #############################################################
1254 dnl # And finally, output the results.
1256 dnl #############################################################
1258 AC_CONFIG_COMMANDS([stamp-h], [echo timestamp > src/include/stamp-h])
1259 AC_CONFIG_COMMANDS([build-radpaths-h], [(cd ./src/include && /bin/sh ./build-radpaths-h)])
1260 AC_CONFIG_COMMANDS([main-chmod], [(cd ./src/main && chmod +x checkrad.pl radlast radtest)])
1261 AC_CONFIG_COMMANDS([scripts-chmod], [(cd ./scripts && chmod +x rc.radiusd radwatch radiusd.cron.daily radiusd.cron.monthly cryptpasswd)])
1264 dnl # Substitute whatever libraries we found to be necessary
1267 AC_SUBST(INSTALLSTRIP)
1269 USE_SHARED_LIBS=$enable_shared
1270 AC_SUBST(USE_SHARED_LIBS)
1271 USE_STATIC_LIBS=$enable_static
1272 AC_SUBST(USE_STATIC_LIBS)
1273 AC_SUBST(STATIC_MODULES)
1274 AC_SUBST(RADIUSD_MAJOR_VERSION)
1275 AC_SUBST(RADIUSD_MINOR_VERSION)
1276 AC_SUBST(RADIUSD_INCRM_VERSION)
1277 AC_SUBST(RADIUSD_VERSION)
1278 AC_SUBST(RADIUSD_VERSION_STRING)
1279 AC_SUBST(RADIUSD_VERSION_COMMIT)
1283 ./src/include/build-radpaths-h \
1284 ./src/main/Makefile \
1285 ./src/main/checkrad.pl \
1286 ./src/main/radlast \
1287 ./src/main/radtest \
1288 ./scripts/rc.radiusd \
1289 ./scripts/radwatch \
1290 ./scripts/radiusd.cron.daily \
1291 ./scripts/radiusd.cron.monthly \
1292 ./scripts/cryptpasswd \
1293 ./raddb/dictionary \
1294 ./raddb/radrelay.conf \
1295 ./raddb/radiusd.conf