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 # These next two arguments don't actually do anything. They're
407 dnl # place holders so that the top-level configure script can tell
408 dnl # the user how to configure lower-level modules
412 dnl # extra argument: --with-rlm-FOO-lib-dir
414 AC_ARG_WITH(rlm-FOO-lib-dir,
415 [ --with-rlm-FOO-lib-dir=DIR Directory to look for library files used by module FOO],
423 dnl # extra argument: --with-rlm-FOO-include-dir
425 AC_ARG_WITH(rlm-FOO-include-dir,
426 [ --with-rlm-FOO-include-dir=DIR Directory to look for include files used by module FOO],
433 dnl See what include-style is used by the make program.
434 dnl AC_MSG_CHECKING(include style for make)
435 dnl echo "include /dev/null" > testmake.$$
436 dnl echo "all:" >> testmake.$$
437 dnl make -f testmake.$$ >/dev/null 2>&1
446 dnl rm -f testmake.$$
447 dnl AC_MSG_RESULT(" $INCLUDE")
448 dnl AC_SUBST(INCLUDE)
451 dnl extra argument: --with-udpfromto
453 AC_ARG_WITH(udpfromto,
454 [ --with-udpfromto Compile in UDPFROMTO support. (default=no)],
464 if test "x$WITH_UDPFROMTO" = "xyes"; then
465 AC_DEFINE(WITH_UDPFROMTO, [], [define if you want udpfromto])
468 dnl #############################################################
470 dnl # 1. Checks for programs
472 dnl #############################################################
475 AC_PATH_PROG(PERL, perl, /usr/local/bin/perl)
476 if test "x$ac_cv_path_PERL" = "x"; then
477 AC_MSG_WARN(perl not found - Simultaneous-Use and checkrad.pl may not work)
479 AC_PATH_PROG(SNMPGET, snmpget)
480 if test "x$ac_cv_path_SNMPGET" = "x"; then
481 AC_MSG_WARN(snmpget not found - Simultaneous-Use and checkrad.pl may not work)
484 AC_PATH_PROG(SNMPWALK, snmpwalk)
485 if test "x$ac_cv_path_SNMPWALK" = "x"; then
486 AC_MSG_WARN(snmpwalk not found - Simultaneous-Use and checkrad.pl may not work)
489 AC_PATH_PROG(RUSERS, rusers, /usr/bin/rusers)
491 dnl FIXME This is truly gross.
492 missing_dir=`cd $ac_aux_dir && pwd`
493 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
494 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
495 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
497 AC_PATH_PROG(LOCATE,locate)
498 AC_PATH_PROG(DIRNAME,dirname)
499 AC_PATH_PROG(GREP,grep)
501 dnl #############################################################
503 dnl # 2. Checks for libraries
505 dnl #############################################################
507 dnl If using pthreads, check for -lpthread (posix) or -lc_r (*BSD)
509 if test "x$WITH_THREADS" = "xyes"; then
510 if test $ac_cv_prog_suncc = "yes"; then
514 AC_CHECK_HEADERS(pthread.h, [], [ WITH_THREADS="no" ])
517 dnl # pthread stuff is usually in -lpthread
518 dnl # or in -lc_r, on *BSD
520 dnl # On Some systems, we need extra pre-processor flags, to get them to
521 dnl # to do the threading properly.
523 AC_CHECK_LIB(pthread, pthread_create,
524 [ CFLAGS="$CFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS"
525 LIBS="-lpthread $LIBS" ],
526 AC_CHECK_LIB(c_r, pthread_create,
527 [ CFLAGS="$CFLAGS -pthread -D_THREAD_SAFE" ],
528 [ WITH_THREADS="no" ]
534 dnl # If we have NO pthread libraries, remove any knowledge of threads.
536 if test "x$WITH_THREADS" != "xyes"; then
538 ac_cv_header_pthread_h="no"
542 dnl # We need sem_init() and friends, as they're the friendliest
543 dnl # semaphore functions for threading.
545 dnl # HP/UX requires linking with librt, too, to get the sem_* symbols.
546 dnl # Some systems have them in -lsem
547 dnl # Solaris has them in -lposix4
548 dnl # NetBSD has them in -lsemaphore
550 AC_SEARCH_LIBS(sem_init, pthread sem posix4 rt semaphore,
552 [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)]
556 dnl Check if we need -lsocket
557 AC_CHECK_LIB(socket, getsockname)
559 dnl Check for -lresolv
560 dnl This library may be needed later.
561 AC_CHECK_LIB(resolv, inet_aton)
563 dnl Check if we need -lnsl. Usually if we want to
564 dnl link against -lsocket we need to include -lnsl as well.
565 AC_CHECK_LIB(nsl, inet_ntoa)
567 dnl Check for OpenSSL libraries.
569 if test "x$WITH_OPENSSL" = xyes; then
571 old_LDFLAGS="$LDFLAGS"
572 if test "x$OPENSSL_LIB_DIR" != "x"; then
573 LDFLAGS="-L$OPENSSL_LIB_DIR $LDFLAGS"
575 AC_CHECK_LIB(crypto, DH_new,
577 LIBS="-lcrypto $LIBS"
578 AC_DEFINE(HAVE_LIBCRYPTO, 1,
579 [Define to 1 if you have the `crypto' library (-lcrypto).])
580 AC_CHECK_LIB(ssl, SSL_new,
582 AC_DEFINE(HAVE_LIBSSL, 1,
583 [Define to 1 if you have the `ssl' library (-lssl).])
584 if test "x$OPENSSL_LIB_DIR" != "x"; then
585 OPENSSL_LIBS="-L$OPENSSL_LIB_DIR"
587 OPENSSL_LIBS="$OPENSSL_LIBS -lcrypto -lssl -lcrypto"
591 LDFLAGS="$old_LDFLAGS"
594 AC_CHECK_LIB(ws2_32, htonl)
596 dnl Check the pcap library for the RADIUS sniffer.
598 AC_CHECK_LIB(pcap, pcap_open_live,
600 AC_DEFINE(HAVE_LIBPCAP, 1,
601 [Define to 1 if you have the `pcap' library (-lpcap).])
603 [ AC_MSG_WARN([pcap library not found, silently disabling the RADIUS sniffer.]) ])
607 dnl #############################################################
609 dnl # 3. Checks for header files
611 dnl #############################################################
614 dnl # Interix requires us to set -D_ALL_SOURCE, otherwise
615 dnl # getopt will be #included, but won't link. <sigh>
620 CFLAGS="$CFLAGS -D_ALL_SOURCE"
623 CFLAGS="$CFLAGS -DDARWIN"
624 LIBS="-framework DirectoryService $LIBS"
625 AC_DEFINE([__APPLE_USE_RFC_3542], 1, [Force OSX >= 10.7 Lion to use RFC2292 IPv6 socket options])
675 dnl FreeBSD requires sys/socket.h before net/if.h
676 AC_CHECK_HEADERS(net/if.h, [], [],
677 [#ifdef HAVE_SYS_SOCKET_H
678 # include <sys/socket.h>
683 AC_CHECK_HEADER(regex.h, AC_DEFINE(HAVE_REGEX_H, [], [define this if we have the <regex.h> header file]))
684 if test "x$ac_cv_header_regex_h" = "xyes"; then
692 ], [AC_DEFINE(HAVE_REG_EXTENDED, [], [define this if we have REG_EXTENDED (from <regex.h>)]) REGEX_EXTENDED=yes])
695 AC_SUBST(REGEX_EXTENDED)
698 dnl # other checks which require headers
700 if test "x$ac_cv_header_sys_security_h" = "xyes" && test "x$ac_cv_header_prot_h" = "xyes"
702 AC_DEFINE(OSFC2, [], [define if you have OSFC2 authentication])
705 if test "x$ac_cv_header_sia_h" = "xyes" && test "x$ac_cv_header_siad_h" = "xyes"
707 AC_DEFINE(OSFSIA, [], [define if you have OSFSIA authentication])
711 dnl # Were we told to use OpenSSL, if we were and we find an error, call AC_MSG_FAILURE and exit
713 if test "x$WITH_OPENSSL" = xyes; then
715 old_LDFLAGS="$LDFLAGS"
717 OPENSSL_INCLUDE="-DNO_OPENSSL"
719 if test "x$OPENSSL_LIB_DIR" != "x"; then
720 LDFLAGS="-L$OPENSSL_LIB_DIR $LDFLAGS"
724 dnl # Check we can link to libssl
726 AC_CHECK_LIB(crypto, DH_new,
728 LIBS="-lcrypto $LIBS"
729 AC_DEFINE(HAVE_LIBCRYPTO, 1, [Define to 1 if you have the `crypto' library (-lcrypto).])
730 AC_CHECK_LIB(ssl, SSL_new,
732 AC_DEFINE(HAVE_LIBSSL, 1, [Define to 1 if you have the `ssl' library (-lssl).])
733 if test "x$OPENSSL_LIB_DIR" != "x"; then
734 OPENSSL_LIBS="-L$OPENSSL_LIB_DIR"
736 OPENSSL_LIBS="$OPENSSL_LIBS -lcrypto -lssl -lcrypto"
737 LIBS="$OPENSSL_LIBS $LIBS"
740 AC_MSG_FAILURE([failed linking to libssl])
748 dnl # Check we can find required headers
750 old_CPPFLAGS=$CPPFLAGS
752 if test "x$OPENSSL_INCLUDE_DIR" != "x"; then
753 CPPFLAGS="-I$OPENSSL_INCLUDE_DIR $CPPFLAGS"
754 CFLAGS="-I$OPENSSL_INCLUDE_DIR $CFLAGS"
758 dnl # Stupid RedHat shit
760 CPPFLAGS="$CPPFLAGS -DOPENSSL_NO_KRB5"
773 AC_MSG_FAILURE([failed locating OpenSSL headers])
777 AC_MSG_CHECKING([for OpenSSL version >= 0.9.7])
779 [#include <openssl/crypto.h>
780 #if (OPENSSL_VERSION_NUMBER >= 0x00907000L)
789 AC_MSG_FAILURE([OpenSSL version too old])
793 if test "x$OPENSSL_INCLUDE_DIR" != "x"; then
794 OPENSSL_INCLUDE="-I$OPENSSL_INCLUDE_DIR -DOPENSSL_NO_KRB5"
796 OPENSSL_INCLUDE="-DOPENSSL_NO_KRB5"
800 dnl # Now check that the header versions match the library
802 AC_MSG_CHECKING([OpenSSL library and header version consistency])
807 #include <openssl/opensslv.h>
808 #include <openssl/crypto.h>
811 if (SSLeay() == OPENSSL_VERSION_NUMBER) {
814 printf("library: %lx header: %lx... ", (unsigned long) SSLeay(), (unsigned long) OPENSSL_VERSION_NUMBER);
824 AC_MSG_FAILURE([OpenSSL library version does not match header version])
828 if test "x$OPENSSL_LIBS" = x; then
830 LDFLAGS="$old_LDFLAGS"
832 if test "x$OPENSSL_INCLUDE" = x; then
833 CPPFLAGS=$old_CPPFLAGS
838 AC_SUBST(OPENSSL_INCLUDE)
839 AC_SUBST(OPENSSL_LIBS)
842 dnl Check the pcap includes for the RADIUS sniffer.
843 if test "x$PCAP_LIBS" = x; then
844 AC_MSG_NOTICE([skipping test for pcap.h.])
846 AC_CHECK_HEADER(pcap.h,
847 AC_DEFINE(HAVE_PCAP_H, 1,
848 [Define to 1 if you have the <pcap.h> header file.]),
850 AC_MSG_WARN([pcap.h not found, silently disabling the RADIUS sniffer.])
853 AC_CHECK_LIB(pcap, pcap_fopen_offline,
854 [ AC_DEFINE(HAVE_PCAP_FOPEN_OFFLINE, 1,
855 [Define to 1 if you have the function pcap_fopen_offline.])
857 AC_CHECK_LIB(pcap, pcap_dump_fopen,
858 [ AC_DEFINE(HAVE_PCAP_DUMP_FOPEN, 1,
859 [Define to 1 if you have the function pcap_dump_fopen.])
864 dnl #############################################################
866 dnl # 4. Checks for typedefs
868 dnl #############################################################
871 dnl # Ensure that these are defined
878 dnl check for socklen_t
879 FR_CHECK_TYPE_INCLUDE([
880 #ifdef HAVE_SYS_TYPES_H
881 #include <sys/types.h>
883 #ifdef HAVE_SYS_SOCKET_H
884 #include <sys/socket.h>
886 ],socklen_t, int, [socklen_t is generally 'int' on systems which don't use it])
888 dnl check for uint8_t
889 FR_CHECK_TYPE_INCLUDE([
890 #ifdef HAVE_INTTYPES_H
891 #include <inttypes.h>
896 ],uint8_t, unsigned char, [uint8_t should be the canonical 'octet' for network traffic])
898 dnl check for uint16_t
899 FR_CHECK_TYPE_INCLUDE([
900 #ifdef HAVE_INTTYPES_H
901 #include <inttypes.h>
906 ],uint16_t, unsigned short, [uint16_t should be the canonical '2 octets' for network traffic])
908 dnl check for uint32_t
909 FR_CHECK_TYPE_INCLUDE([
910 #ifdef HAVE_INTTYPES_H
911 #include <inttypes.h>
916 ],uint32_t, unsigned int, [uint32_t should be the canonical 'network integer])
918 AC_CHECK_TYPE(sig_t, AC_DEFINE(HAVE_SIG_T, 1, [signal action callback function]), [], [
924 AC_CHECK_TYPE(struct in6_addr, AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1, [IPv6 address structure]), [], [
925 #ifdef HAVE_NETINET_IN_H
926 #include <netinet/in.h>
930 AC_CHECK_TYPE(struct sockaddr_storage, AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1, [Generic socket addresses]), [], [
931 #ifdef HAVE_NETINET_IN_H
932 #include <netinet/in.h>
934 #ifdef HAVE_SYS_SOCKET_H
935 #include <sys/socket.h>
939 AC_CHECK_TYPE(struct sockaddr_in6, AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1, [IPv6 socket addresses]), [], [
940 #ifdef HAVE_NETINET_IN_H
941 #include <netinet/in.h>
945 AC_CHECK_TYPE(struct addrinfo, AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1, [Generic DNS lookups]), [], [
946 #ifdef HAVE_SYS_TYPES_H
947 #include <sys/types.h>
949 #ifdef HAVE_SYS_SOCKET_H
950 #include <sys/socket.h>
957 dnl #############################################################
959 dnl # 5. Checks for structures and functions
961 dnl #############################################################
996 RADIUSD_NEED_DECLARATIONS( \
1008 dnl # check if we have utmpx.h
1009 dnl # if so, check if struct utmpx has entry ut_xtime
1010 dnl # if not, set it to define ut_xtime == ut_tv.tv_sec
1011 if test "x$ac_cv_header_utmpx_h" = "xyes"
1013 FR_CHECK_STRUCT_HAS_MEMBER([#include <utmpx.h>], [struct utmpx], ut_xtime)
1014 if test "x$ac_cv_type_struct_utmpx_has_ut_xtime" = "x"
1016 AC_DEFINE(ut_xtime,ut_tv.tv_sec, [define to something if you don't have ut_xtime in struct utmpx])
1020 dnl # struct ip_pktinfo
1021 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in_pktinfo], ipi_addr)
1022 if test "x$ac_cv_type_struct_in_pktinfo_has_ipi_addr" = "xyes"
1024 AC_DEFINE(HAVE_IP_PKTINFO, [], [define if you have IP_PKTINFO (Linux)])
1027 dnl # struct in6_pktinfo
1028 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in6_pktinfo], ipi6_addr)
1029 if test "x$ac_cv_type_struct_in6_pktinfo_has_ipi6_addr" = "xyes"
1031 AC_DEFINE(HAVE_IN6_PKTINFO, [], [define if you have IN6_PKTINFO (Linux)])
1034 dnl #############################################################
1036 dnl # 6. Checks for compiler characteristics
1038 dnl #############################################################
1041 dnl # Ensure that these are defined
1046 dnl # See if this is OS/2
1048 AC_MSG_CHECKING(type of OS)
1051 if test "$OS" = "OS/2"; then
1058 AC_MSG_CHECKING(for developer gcc flags)
1059 if test "x$developer" = "xyes" -a "x$GCC" = "xyes"; then
1060 devflags="-g -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -W -Wredundant-decls -Wundef"
1061 CFLAGS="$CFLAGS $devflags"
1063 AC_MSG_RESULT(yes. Using $devflags)
1066 CFLAGS="$CFLAGS -DNDEBUG"
1073 dnl #############################################################
1075 dnl # 7. Checks for library functions
1077 dnl #############################################################
1080 LIBS="$LIBS $LIBLTDL"
1081 AC_CHECK_FUNC(lt_dladvise_init, AC_DEFINE(HAVE_LT_DLADVISE_INIT, [], [Do we have the lt_dladvise_init function]))
1084 dnl Check for libcrypt
1085 dnl We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
1086 AC_CHECK_LIB(crypt, crypt,
1089 if test "$CRYPTLIB" != ""; then
1090 AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function])
1092 AC_CHECK_FUNC(crypt, AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function]))
1095 dnl Check for libcipher
1096 AC_CHECK_LIB(cipher, setkey,
1097 CRYPTLIB="${CRYPTLIB} -lcipher"
1101 dnl Check the style of gethostbyaddr, in order of preference
1102 dnl GNU (_r eight args)
1103 AC_DEFINE(GNUSTYLE, [1], [GNU-Style get*byaddr_r])
1104 dnl SYSV (_r six args)
1105 AC_DEFINE(SYSVSTYLE, [2], [SYSV-Style get*byaddr_r])
1106 dnl BSD (three args, may not be thread safe)
1107 AC_DEFINE(BSDSTYLE, [3], [BSD-Style get*byaddr_r])
1108 dnl Tru64 has BSD version, but it is thread safe
1109 dnl http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1739____.HTM
1110 dnl We need #stdio.h to define NULL on FreeBSD (at least)
1111 gethostbyaddrrstyle=""
1112 AC_MSG_CHECKING([gethostbyaddr_r() syntax])
1115 dnl With FreeBSD, check if there's a prototype for gethostbyaddr_r.
1116 dnl Some versions (FreeBSD 5.1?) have a symbol but no prototype - so we
1117 dnl override this test to BSDSTYLE. FreeBSD 6.2 and up have proper GNU
1119 AC_CHECK_DECLS([gethostbyaddr_r], [], [
1120 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE,
1121 [style of gethostbyaddr_r functions ])
1122 gethostbyaddrrstyle=BSD
1123 AC_MSG_WARN([FreeBSD overridden to BSD-style])
1131 if test "x$gethostbyaddrrstyle" = "x"; then
1135 ], [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL, NULL) ], [
1136 AC_DEFINE(GETHOSTBYADDRRSTYLE, GNUSTYLE, [style of gethostbyaddr_r functions ])
1137 gethostbyaddrrstyle=GNU
1140 if test "x$gethostbyaddrrstyle" = "x"; then
1144 ], [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL) ] , [
1145 AC_DEFINE(GETHOSTBYADDRRSTYLE, SYSVSTYLE, [style of gethostbyaddr_r functions ])
1146 gethostbyaddrrstyle=SYSV
1149 if test "x$gethostbyaddrrstyle" = "x"; then
1153 ], [ gethostbyaddr(NULL, 0, 0) ], [
1154 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE, [style of gethostbyaddr_r functions ])
1155 gethostbyaddrrstyle=BSD
1159 if test "x$gethostbyaddrrstyle" = "x"; then
1160 AC_MSG_RESULT([none! It must not exist, here.])
1162 AC_MSG_RESULT([${gethostbyaddrrstyle}-style])
1165 if test "x$gethostbyaddrrstyle" = "xBSD"; then
1166 AC_MSG_WARN([ ****** BSD-style gethostbyaddr might NOT be thread-safe! ****** ])
1169 dnl Check the style of gethostbyname, in order of preference
1170 dnl GNU (_r seven args)
1171 dnl SYSV (_r five args)
1172 dnl BSD (two args, may not be thread safe)
1173 dnl Tru64 has BSD version, but it _is_ thread safe
1174 dnl http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1946____.HTM
1175 dnl We need #stdio.h to define NULL on FreeBSD (at least)
1176 gethostbynamerstyle=""
1177 AC_MSG_CHECKING([gethostbyname_r() syntax])
1181 ], [ gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL) ], [
1182 AC_DEFINE(GETHOSTBYNAMERSTYLE, GNUSTYLE, [style of gethostbyname_r functions ])
1183 gethostbynamerstyle=GNU
1185 if test "x$gethostbynamerstyle" = "x"; then
1189 ], [ gethostbyname_r(NULL, NULL, NULL, 0, NULL) ] , [
1190 AC_DEFINE(GETHOSTBYNAMERSTYLE, SYSVSTYLE, [style of gethostbyname_r functions ])
1191 gethostbynamerstyle=SYSV
1194 if test "x$gethostbynamerstyle" = "x"; then
1198 ], [ gethostbyname(NULL) ], [
1199 AC_DEFINE(GETHOSTBYNAMERSTYLE, BSDSTYLE, [style of gethostbyname_r functions ])
1200 gethostbynamerstyle=BSD
1204 if test "x$gethostbynamerstyle" = "x"; then
1205 AC_MSG_RESULT([none! It must not exist, here.])
1207 AC_MSG_RESULT([${gethostbynamerstyle}-style])
1210 if test "x$gethostbynamerstyle" = "xBSD"; then
1211 AC_MSG_WARN([ ****** BSD-style gethostbyname might NOT be thread-safe! ****** ])
1214 dnl check for non-posix solaris ctime_r (extra buflen int arg)
1215 AC_DEFINE(POSIXSTYLE, [1], [Posix-Style ctime_r])
1216 AC_DEFINE(SOLARISSTYLE, [2], [Solaris-Style ctime_r])
1218 AC_MSG_CHECKING([ctime_r() syntax])
1221 ], [ ctime_r(NULL, NULL, 0) ], [
1222 AC_DEFINE(CTIMERSTYLE, SOLARISSTYLE, [style of ctime_r function])
1223 ctimerstyle="SOLARIS"
1225 if test "x$ctimerstyle" = "x"; then
1228 ], [ ctime_r(NULL, NULL) ], [
1229 AC_DEFINE(CTIMERSTYLE, POSIXSTYLE, [style of ctime_r function])
1234 if test "x$ctimerstyle" = "x"; then
1235 AC_MSG_RESULT([none! It must not exist, here.])
1237 AC_MSG_RESULT([${ctimerstyle}-style])
1240 AC_SUBST(HOSTINFO, $host)
1242 if test "x$WITH_POST_PROXY_AUTHORIZE" != "x"; then
1243 AC_DEFINE(WITH_POST_PROXY_AUTHORIZE, 1, [1.x compatibility])
1246 dnl #############################################################
1248 dnl # 8. Checks for system services
1250 dnl #############################################################
1253 dnl # Figure out where libtool is located,
1257 AC_MSG_RESULT([top_builddir=$top_builddir])
1258 dnl # AC_SUBST(top_builddir)
1262 dnl import libtool stuff
1264 dnl #############################################################
1266 dnl # Configure in any module directories.
1268 dnl #############################################################
1270 mysubdirs="$LIBLTDLPATH"
1271 if test "x$EXPERIMENTAL" = "xyes"; then
1272 bar=`ls -1 "${srcdir}"/src/modules/rlm_*/configure | sed 's%/configure%%'`
1273 dnl # get rid of LF's.
1274 mysubdirs=`echo $mysubdirs $bar`
1277 dnl # Find 'configure' in ONLY the stable modules
1279 for bar in `cat "${srcdir}"/src/modules/stable`; do
1280 if test -f "${srcdir}"/src/modules/$bar/configure; then
1281 mysubdirs="$mysubdirs src/modules/$bar"
1286 dnl ############################################################
1287 dnl # make modules by list
1288 dnl #############################################################
1289 if test "x$EXPERIMENTAL" = "xyes"; then
1290 for foo in `ls -1 "${srcdir}"/src/modules | grep rlm_`; do
1291 MODULES="$MODULES $foo"
1295 dnl # make ONLY the stable modules
1297 for foo in `cat "${srcdir}"/src/modules/stable`; do
1298 MODULES="$MODULES $foo"
1303 dnl # Don't change the variable name here. Autoconf goes bonkers
1306 AC_CONFIG_SUBDIRS($LTDL_SUBDIRS $mysubdirs)
1309 dnl #############################################################
1311 dnl # And finally, output the results.
1313 dnl #############################################################
1315 AC_CONFIG_COMMANDS([stamp-h], [echo timestamp > src/include/stamp-h])
1316 AC_CONFIG_COMMANDS([build-radpaths-h], [(cd ./src/include && /bin/sh ./build-radpaths-h)])
1317 AC_CONFIG_COMMANDS([main-chmod], [(cd ./src/main && chmod +x checkrad.pl radlast radtest)])
1318 AC_CONFIG_COMMANDS([scripts-chmod], [(cd ./scripts && chmod +x rc.radiusd radwatch radiusd.cron.daily radiusd.cron.monthly cryptpasswd)])
1321 dnl # Substitute whatever libraries we found to be necessary
1324 AC_SUBST(INSTALLSTRIP)
1326 USE_SHARED_LIBS=$enable_shared
1327 AC_SUBST(USE_SHARED_LIBS)
1328 USE_STATIC_LIBS=$enable_static
1329 AC_SUBST(USE_STATIC_LIBS)
1330 AC_SUBST(STATIC_MODULES)
1331 AC_SUBST(RADIUSD_MAJOR_VERSION)
1332 AC_SUBST(RADIUSD_MINOR_VERSION)
1333 AC_SUBST(RADIUSD_INCRM_VERSION)
1334 AC_SUBST(RADIUSD_VERSION)
1335 AC_SUBST(RADIUSD_VERSION_STRING)
1336 AC_SUBST(RADIUSD_VERSION_COMMIT)
1340 ./src/include/build-radpaths-h \
1341 ./src/main/Makefile \
1342 ./src/main/checkrad.pl \
1343 ./src/main/radlast \
1344 ./src/main/radtest \
1345 ./scripts/rc.radiusd \
1346 ./scripts/radwatch \
1347 ./scripts/radiusd.cron.daily \
1348 ./scripts/radiusd.cron.monthly \
1349 ./scripts/cryptpasswd \
1350 ./raddb/dictionary \
1351 ./raddb/radrelay.conf \
1352 ./raddb/radiusd.conf