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 # The version of the software
34 RADIUSD_MAJOR_VERSION=`cat VERSION | sed 's/\..*//'`
35 RADIUSD_MINOR_VERSION=`cat VERSION | sed 's/^[^\.]*\.//' | sed 's/\..*$//'`
36 RADIUSD_INCRM_VERSION=`cat VERSION | sed 's/^.*\..*\.//' | sed 's/-.*$//'`
38 RADIUSD_VERSION=`echo | awk -v major="$RADIUSD_MAJOR_VERSION" \
39 -v minor="$RADIUSD_MINOR_VERSION" \
40 -v incrm="$RADIUSD_INCRM_VERSION" \
41 '{ printf "%02i%02i%02i", major, minor, incrm }'`
43 dnl # Still useful for custom builds
44 RADIUSD_VERSION_STRING=`cat VERSION`
47 dnl #############################################################
49 dnl # 0. Checks for compiler, libtool, and command line options.
51 dnl #############################################################
58 dnl # check for AIX, to allow us to use some BSD functions
59 dnl # must be before macros that call the compiler.
63 AC_PROG_GCC_TRADITIONAL
68 dnl # Set Default CFLAGS
70 if test "x$GCC" = "xyes"; then
71 CFLAGS="$CFLAGS -Wall -D_GNU_SOURCE"
74 dnl Compile in large (2G+) file support.
77 dnl # check for system bytesex
78 dnl # AC_DEFINES WORDS_BIGENDIAN
82 AC_CHECK_PROG(GMAKE, gmake, yes, no)
83 if test $GMAKE = no; then
84 AC_PATH_PROG(MAKE, make, /usr/local/bin/make)
86 AC_PATH_PROG(MAKE, gmake, /usr/local/gnu/bin/make)
88 makever=`$ac_cv_path_MAKE --version 2>&1 | grep "GNU Make"`
89 if test -z "$makever"; then
90 AC_MSG_ERROR(GNU Make is not installed. Please download and install it
91 from ftp://prep.ai.mit.edu/pub/gnu/make/ before continuing.)
94 dnl See if we have Git.
95 AC_CHECK_PROG(GIT, git, yes, no)
97 AC_ARG_WITH(system-libltdl,
98 [ --with-system-libltdl Use the libltdl installed in your system (default=use dlopen)],
100 [with_system_libltdl=no])
102 AS_IF([test "x$with_system_libltdl" = "xyes" ],
104 INCLTDL=-DWITH_SYSTEM_LTDL])
106 dnl use system-wide libtool, if it exists
107 AC_ARG_WITH(system-libtool,
108 [ --with-system-libtool Use the libtool installed in your system (default=use our own)],
110 [with_system_libtool=no])
112 AS_IF([test "x$with_system_libtool" = "xyes" ],
113 [ AC_PATH_PROG(LIBTOOL, libtool,,$PATH:/usr/local/bin) AC_LIBTOOL_DLOPEN
116 LIBTOOL='${top_srcdir}/scripts/jlibtool'
118 dnl ensure that we're looking for dlopen
123 dnl Put this in later, when all distributed modules use autoconf.
124 dnl AC_ARG_WITH(disablemodulefoo,
125 dnl [ --without-rlm_foo Disables module compilation. Module list:]
126 dnl esyscmd([find src/modules -type d -name rlm_\* -print |\
127 dnl sed -e 's%src/modules/.*/% (sub)- %; s%.*/%- %' |\
128 dnl awk '{print " "$0}']))
130 AC_ARG_ENABLE(strict-dependencies,
131 [ --enable-strict-dependencies Fail configure on lack of module dependancy.])
133 dnl extra argument: --with-docdir
134 docdir='${datadir}/doc/freeradius'
135 AC_MSG_CHECKING(docdir)
137 [ --with-docdir=DIR Directory for documentation [DATADIR/doc/freeradius] ],
144 [[\\/$]]* | ?:[[\\/]]* )
148 AC_MSG_ERROR([expected an absolute directory name for --with-docdir: $withval])
153 AC_MSG_RESULT($docdir)
154 if test "x$docdir" = xno; then
155 AC_MSG_WARN(Documentation files will NOT be installed.)
158 dnl extra argument: --with-logdir
159 logdir='${localstatedir}/log/radius'
160 AC_MSG_CHECKING(logdir)
162 [ --with-logdir=DIR Directory for logfiles [LOCALSTATEDIR/log/radius] ],
165 AC_MSG_ERROR(Need logdir)
169 [[\\/$]]* | ?:[[\\/]]* )
173 AC_MSG_ERROR([expected an absolute directory name for --with-logdir: $withval])
178 AC_MSG_RESULT($logdir)
180 dnl extra argument: --with-radacctdir
181 radacctdir='${logdir}/radacct'
182 AC_MSG_CHECKING(radacctdir)
183 AC_ARG_WITH(radacctdir,
184 [ --with-radacctdir=DIR Directory for detail files [LOGDIR/radacct] ],
187 AC_MSG_ERROR(Need radacctdir)
191 [[\\/$]]* | ?:[[\\/]]* )
192 radacctdir="$withval"
195 AC_MSG_ERROR([expected an absolute directory name for --with-radacctdir: $withval])
200 AC_MSG_RESULT($radacctdir)
202 dnl extra argument: --with-raddbdir
203 raddbdir='${sysconfdir}/raddb'
204 AC_MSG_CHECKING(raddbdir)
205 AC_ARG_WITH(raddbdir,
206 [ --with-raddbdir=DIR Directory for config files [SYSCONFDIR/raddb] ],
209 AC_MSG_ERROR(Need raddbdir)
213 [[\\/$]]* | ?:[[\\/]]* )
217 AC_MSG_ERROR([expected an absolute directory name for --with-raddbdir: $withval])
222 AC_MSG_RESULT($raddbdir)
224 dnl extra argument: --with-ascend-binary
226 AC_ARG_WITH(ascend-binary,
227 [ --with-ascend-binary Include support for Ascend binary filter attributes (default=yes)],
235 if test "X$ASCEND_BINARY" = "Xyes"; then
236 AC_DEFINE(ASCEND_BINARY, [], [Include support for Ascend binary filter attributes])
239 dnl extra argument: --with-threads
242 [ --with-threads Use threads, if available. (default=yes) ],
251 dnl extra argument: --with-vmps
254 [ --with-vmps Compile in VMPS support. (default=yes)],
262 if test "x$WITH_VMPS" = "xyes"; then
263 AC_DEFINE(WITH_VMPS, [1], [define if you want VMPS support])
266 dnl extra argument: --with-dhcp
269 [ --with-dhcp Compile in DHCP support. (default=yes)],
277 if test "x$WITH_DHCP" = "xyes"; then
278 AC_DEFINE(WITH_DHCP, [1], [define if you want DHCP support])
283 dnl # Allow the user to specify a list of modules to be linked
284 dnl # statically to the server.
287 AC_ARG_WITH(static_modules,
288 [ --with-static-modules=QUOTED-MODULE-LIST],[
289 for i in $withval; do
290 STATIC_MODULES="$STATIC_MODULES -dlpreopen ../modules/rlm_$i/rlm_$i.la"
296 [ --with-modules=QUOTED-MODULE-LIST],[
297 for i in $withval; do
298 MODULES="$MODULES $i"
303 dnl # Enable developer C compiler warnings
305 AC_ARG_ENABLE(developer,
306 [ --enable-developer Enables features of interest to developers.],
307 [ case "$enableval" in
316 if test -d $srcdir/.git; then
317 if test "x$developer" != "xno"; then
318 dnl turn on the developer flag when taken from a git checkout (not a release)
322 dnl append the current git hash onto the version string
323 if test $GIT = yes; then
324 RADIUSD_VERSION_COMMIT=`git log --pretty=format:'%h' -n 1`
328 dnl extra argument: --with-experimental-modules
330 AC_ARG_WITH(experimental-modules,
331 [ --with-experimental-modules Use experimental and unstable modules. (default=no) ],
340 dnl extra argument: --with-openssl
343 [ --with-openssl Use OpenSSL. (default=yes)],
355 dnl # extra argument: --with-openssl-includes=dir
358 AC_ARG_WITH(openssl-includes,
359 [ --with-openssl-includes=DIR Directory to look for OpenSSL include files],
361 *) OPENSSL_INCLUDE_DIR="$withval"
367 dnl # extra argument: --with-openssl-libraries=dir
370 AC_ARG_WITH(openssl-libraries,
371 [ --with-openssl-libraries=DIR Directory to look for OpenSSL library files],
373 *) OPENSSL_LIB_DIR="$withval"
379 dnl # These next two arguments don't actually do anything. They're
380 dnl # place holders so that the top-level configure script can tell
381 dnl # the user how to configure lower-level modules
385 dnl # extra argument: --with-rlm-FOO-lib-dir
387 AC_ARG_WITH(rlm-FOO-lib-dir,
388 [ --with-rlm-FOO-lib-dir=DIR Directory to look for library files used by module FOO],
396 dnl # extra argument: --with-rlm-FOO-include-dir
398 AC_ARG_WITH(rlm-FOO-include-dir,
399 [ --with-rlm-FOO-include-dir=DIR Directory to look for include files used by module FOO],
406 dnl See what include-style is used by the make program.
407 dnl AC_MSG_CHECKING(include style for make)
408 dnl echo "include /dev/null" > testmake.$$
409 dnl echo "all:" >> testmake.$$
410 dnl make -f testmake.$$ >/dev/null 2>&1
419 dnl rm -f testmake.$$
420 dnl AC_MSG_RESULT(" $INCLUDE")
421 dnl AC_SUBST(INCLUDE)
424 dnl extra argument: --with-udpfromto
426 AC_ARG_WITH(udpfromto,
427 [ --with-udpfromto Compile in UDPFROMTO support. (default=no)],
437 if test "x$WITH_UDPFROMTO" = "xyes"; then
438 AC_DEFINE(WITH_UDPFROMTO, [], [define if you want udpfromto])
441 dnl #############################################################
443 dnl # 1. Checks for programs
445 dnl #############################################################
448 AC_PATH_PROG(PERL, perl, /usr/local/bin/perl)
449 if test "x$ac_cv_path_PERL" = "x"; then
450 AC_MSG_WARN(perl not found - Simultaneous-Use and checkrad.pl may not work)
452 AC_PATH_PROG(SNMPGET, snmpget)
453 if test "x$ac_cv_path_SNMPGET" = "x"; then
454 AC_MSG_WARN(snmpget not found - Simultaneous-Use and checkrad.pl may not work)
457 AC_PATH_PROG(SNMPWALK, snmpwalk)
458 if test "x$ac_cv_path_SNMPWALK" = "x"; then
459 AC_MSG_WARN(snmpwalk not found - Simultaneous-Use and checkrad.pl may not work)
462 AC_PATH_PROG(RUSERS, rusers, /usr/bin/rusers)
464 dnl FIXME This is truly gross.
465 missing_dir=`cd $ac_aux_dir && pwd`
466 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
467 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
468 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
470 AC_PATH_PROG(LOCATE,locate)
471 AC_PATH_PROG(DIRNAME,dirname)
472 AC_PATH_PROG(GREP,grep)
474 dnl #############################################################
476 dnl # 2. Checks for libraries
478 dnl #############################################################
480 dnl If using pthreads, check for -lpthread (posix) or -lc_r (*BSD)
482 if test "x$WITH_THREADS" = "xyes"; then
483 if test $ac_cv_prog_suncc = "yes"; then
487 AC_CHECK_HEADERS(pthread.h, [], [ WITH_THREADS="no" ])
490 dnl # pthread stuff is usually in -lpthread
491 dnl # or in -lc_r, on *BSD
493 dnl # On Some systems, we need extra pre-processor flags, to get them to
494 dnl # to do the threading properly.
496 AC_CHECK_LIB(pthread, pthread_create,
497 [ CFLAGS="$CFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS"
498 LIBS="-lpthread $LIBS" ],
499 AC_CHECK_LIB(c_r, pthread_create,
500 [ CFLAGS="$CFLAGS -pthread -D_THREAD_SAFE" ],
501 [ WITH_THREADS="no" ]
507 dnl # If we have NO pthread libraries, remove any knowledge of threads.
509 if test "x$WITH_THREADS" != "xyes"; then
511 ac_cv_header_pthread_h="no"
515 dnl # We need sem_init() and friends, as they're the friendliest
516 dnl # semaphore functions for threading.
518 dnl # HP/UX requires linking with librt, too, to get the sem_* symbols.
519 dnl # Some systems have them in -lsem
520 dnl # Solaris has them in -lposix4
521 dnl # NetBSD has them in -lsemaphore
523 AC_SEARCH_LIBS(sem_init, pthread sem posix4 rt semaphore,
525 [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)]
529 dnl Check if we need -lsocket
530 AC_CHECK_LIB(dl, dlopen)
532 dnl Check if we need -lsocket
533 AC_CHECK_LIB(socket, getsockname)
535 dnl Check for -lresolv
536 dnl This library may be needed later.
537 AC_CHECK_LIB(resolv, inet_aton)
539 dnl Check if we need -lnsl. Usually if we want to
540 dnl link against -lsocket we need to include -lnsl as well.
541 AC_CHECK_LIB(nsl, inet_ntoa)
543 dnl Check for OpenSSL libraries.
545 if test "x$WITH_OPENSSL" = xyes; then
547 old_LDFLAGS="$LDFLAGS"
548 if test "x$OPENSSL_LIB_DIR" != "x"; then
549 LDFLAGS="$LDFLAGS -L$OPENSSL_LIB_DIR"
551 AC_CHECK_LIB(crypto, DH_new,
553 LIBS="-lcrypto $LIBS"
554 AC_DEFINE(HAVE_LIBCRYPTO, 1,
555 [Define to 1 if you have the `crypto' library (-lcrypto).])
556 AC_CHECK_LIB(ssl, SSL_new,
558 AC_DEFINE(HAVE_LIBSSL, 1,
559 [Define to 1 if you have the `ssl' library (-lssl).])
560 if test "x$OPENSSL_LIB_DIR" != "x"; then
561 OPENSSL_LIBS="-L$OPENSSL_LIB_DIR"
563 OPENSSL_LIBS="$OPENSSL_LIBS -lcrypto -lssl -lcrypto"
567 LDFLAGS="$old_LDFLAGS"
570 AC_CHECK_LIB(ws2_32, htonl)
572 dnl Check the pcap library for the RADIUS sniffer.
574 AC_CHECK_LIB(pcap, pcap_open_live,
576 AC_DEFINE(HAVE_LIBPCAP, 1,
577 [Define to 1 if you have the `pcap' library (-lpcap).])
579 [ AC_MSG_WARN([pcap library not found, silently disabling the RADIUS sniffer.]) ])
583 dnl #############################################################
585 dnl # 3. Checks for header files
587 dnl #############################################################
590 dnl # Interix requires us to set -D_ALL_SOURCE, otherwise
591 dnl # getopt will be #included, but won't link. <sigh>
596 CFLAGS="$CFLAGS -D_ALL_SOURCE"
599 CFLAGS="$CFLAGS -DDARWIN"
600 LIBS="-framework DirectoryService $LIBS"
650 dnl FreeBSD requires sys/socket.h before net/if.h
651 AC_CHECK_HEADERS(net/if.h, [], [],
652 [#ifdef HAVE_SYS_SOCKET_H
653 # include <sys/socket.h>
658 AC_CHECK_HEADER(pcreposix.h, AC_DEFINE(HAVE_PCREPOSIX_H, [], [define this if we have the <pcreposix.h> header file]))
659 if test "x$ac_cv_header_pcreposix_h" = "xyes"; then
660 AC_DEFINE(HAVE_REGEX_H, [], [define if we have any regex])
664 LIBS="$LIBS -lpcreposix"
667 AC_CHECK_HEADER(regex.h, AC_DEFINE(HAVE_REGEX_H, [], [define this if we have the <regex.h> header file]))
668 if test "x$ac_cv_header_regex_h" = "xyes"; then
677 ], [AC_DEFINE(HAVE_REG_EXTENDED, [], [define this if we have REG_EXTENDED (from <regex.h>)]) REGEX_EXTENDED=yes])
683 AC_SUBST(REGEX_EXTENDED)
686 dnl # other checks which require headers
688 if test "x$ac_cv_header_sys_security_h" = "xyes" && test "x$ac_cv_header_prot_h" = "xyes"
690 AC_DEFINE(OSFC2, [], [define if you have OSFC2 authentication])
693 if test "x$ac_cv_header_sia_h" = "xyes" && test "x$ac_cv_header_siad_h" = "xyes"
695 AC_DEFINE(OSFSIA, [], [define if you have OSFSIA authentication])
698 dnl Check for OpenSSL includes.
699 OPENSSL_INCLUDE="-DNO_OPENSSL"
700 if test "x$WITH_OPENSSL" = xyes; then
701 if test "x$OPENSSL_LIBS" = "x"; then
702 AC_MSG_NOTICE([skipping test for openssl/ssl.h])
704 old_CPPFLAGS=$CPPFLAGS
705 if test "x$OPENSSL_INCLUDE_DIR" != "x"; then
706 CPPFLAGS="$CPPFLAGS -I$OPENSSL_INCLUDE_DIR"
708 dnl # stupid RedHat shit
709 CPPFLAGS="$CPPFLAGS -DOPENSSL_NO_KRB5"
723 if test "x$OPENSSL_LIBS" != "x"; then
724 AC_MSG_CHECKING([for OpenSSL version >= 0.9.7])
726 [#include <openssl/crypto.h>
727 #if (OPENSSL_VERSION_NUMBER >= 0x00907000L)
731 if test "x$goodssl" != "xyes"; then
736 if test "x$OPENSSL_INCLUDE_DIR" != "x"; then
737 OPENSSL_INCLUDE="-I$OPENSSL_INCLUDE_DIR -DOPENSSL_NO_KRB5"
739 OPENSSL_INCLUDE="-DOPENSSL_NO_KRB5"
743 CPPFLAGS=$old_CPPFLAGS
746 AC_SUBST(OPENSSL_INCLUDE)
747 AC_SUBST(OPENSSL_LIBS)
750 dnl Check the pcap includes for the RADIUS sniffer.
751 if test "x$PCAP_LIBS" = x; then
752 AC_MSG_NOTICE([skipping test for pcap.h.])
754 AC_CHECK_HEADER(pcap.h,
755 AC_DEFINE(HAVE_PCAP_H, 1,
756 [Define to 1 if you have the <pcap.h> header file.]),
758 AC_MSG_WARN([pcap.h not found, silently disabling the RADIUS sniffer.])
761 AC_CHECK_LIB(pcap, pcap_fopen_offline,
762 [ AC_DEFINE(HAVE_PCAP_FOPEN_OFFLINE, 1,
763 [Define to 1 if you have the function pcap_fopen_offline.])
765 AC_CHECK_LIB(pcap, pcap_dump_fopen,
766 [ AC_DEFINE(HAVE_PCAP_DUMP_FOPEN, 1,
767 [Define to 1 if you have the function pcap_dump_fopen.])
772 dnl #############################################################
774 dnl # 4. Checks for typedefs
776 dnl #############################################################
779 dnl # Ensure that these are defined
786 dnl check for socklen_t
787 FR_CHECK_TYPE_INCLUDE([
788 #ifdef HAVE_SYS_TYPES_H
789 #include <sys/types.h>
791 #ifdef HAVE_SYS_SOCKET_H
792 #include <sys/socket.h>
794 ],socklen_t, int, [socklen_t is generally 'int' on systems which don't use it])
796 dnl check for uint8_t
797 FR_CHECK_TYPE_INCLUDE([
798 #ifdef HAVE_INTTYPES_H
799 #include <inttypes.h>
804 ],uint8_t, unsigned char, [uint8_t should be the canonical 'octet' for network traffic])
806 dnl check for uint16_t
807 FR_CHECK_TYPE_INCLUDE([
808 #ifdef HAVE_INTTYPES_H
809 #include <inttypes.h>
814 ],uint16_t, unsigned short, [uint16_t should be the canonical '2 octets' for network traffic])
816 dnl check for uint32_t
817 FR_CHECK_TYPE_INCLUDE([
818 #ifdef HAVE_INTTYPES_H
819 #include <inttypes.h>
824 ],uint32_t, unsigned int, [uint32_t should be the canonical 'network integer])
826 AC_CHECK_TYPE(struct in6_addr, AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1, [IPv6 address structure]), [], [
827 #ifdef HAVE_NETINET_IN_H
828 #include <netinet/in.h>
832 AC_CHECK_TYPE(struct sockaddr_storage, AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1, [Generic socket addresses]), [], [
833 #ifdef HAVE_NETINET_IN_H
834 #include <netinet/in.h>
836 #ifdef HAVE_SYS_SOCKET_H
837 #include <sys/socket.h>
841 AC_CHECK_TYPE(struct sockaddr_in6, AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1, [IPv6 socket addresses]), [], [
842 #ifdef HAVE_NETINET_IN_H
843 #include <netinet/in.h>
847 AC_CHECK_TYPE(struct addrinfo, AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1, [Generic DNS lookups]), [], [
848 #ifdef HAVE_SYS_TYPES_H
849 #include <sys/types.h>
851 #ifdef HAVE_SYS_SOCKET_H
852 #include <sys/socket.h>
859 dnl #############################################################
861 dnl # 5. Checks for structures and functions
863 dnl #############################################################
898 RADIUSD_NEED_DECLARATIONS( \
910 dnl # check if we have utmpx.h
911 dnl # if so, check if struct utmpx has entry ut_xtime
912 dnl # if not, set it to define ut_xtime == ut_tv.tv_sec
913 if test "x$ac_cv_header_utmpx_h" = "xyes"
915 FR_CHECK_STRUCT_HAS_MEMBER([#include <utmpx.h>], [struct utmpx], ut_xtime)
916 if test "x$ac_cv_type_struct_utmpx_has_ut_xtime" = "x"
918 AC_DEFINE(ut_xtime,ut_tv.tv_sec, [define to something if you don't have ut_xtime in struct utmpx])
922 dnl # struct ip_pktinfo
923 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in_pktinfo], ipi_addr)
924 if test "x$ac_cv_type_struct_in_pktinfo_has_ipi_addr" = "xyes"
926 AC_DEFINE(HAVE_IP_PKTINFO, [], [define if you have IP_PKTINFO (Linux)])
929 dnl # struct in6_pktinfo
930 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in6_pktinfo], ipi6_addr)
931 if test "x$ac_cv_type_struct_in6_pktinfo_has_ipi6_addr" = "xyes"
933 AC_DEFINE(HAVE_IN6_PKTINFO, [], [define if you have IN6_PKTINFO (Linux)])
936 dnl #############################################################
938 dnl # 6. Checks for compiler characteristics
940 dnl #############################################################
943 dnl # Ensure that these are defined
948 dnl # See if this is OS/2
950 AC_MSG_CHECKING(type of OS)
953 if test "$OS" = "OS/2"; then
960 AC_MSG_CHECKING(for developer gcc flags)
961 if test "x$developer" = "xyes" -a "x$GCC" = "xyes"; then
962 devflags="-g -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"
963 CFLAGS="$CFLAGS $devflags"
965 AC_MSG_RESULT(yes. Using $devflags)
968 CFLAGS="$CFLAGS -DNDEBUG"
975 dnl #############################################################
977 dnl # 7. Checks for library functions
979 dnl #############################################################
982 LIBS="$LIBS $LIBLTDL"
983 AC_CHECK_FUNC(lt_dladvise_init, AC_DEFINE(HAVE_LT_DLADVISE_INIT, [], [Do we have the lt_dladvise_init function]))
986 dnl Check for libcrypt
987 dnl We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
988 AC_CHECK_LIB(crypt, crypt,
991 if test "$CRYPTLIB" != ""; then
992 AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function])
994 AC_CHECK_FUNC(crypt, AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function]))
997 dnl Check for libcipher
998 AC_CHECK_LIB(cipher, setkey,
999 CRYPTLIB="${CRYPTLIB} -lcipher"
1003 dnl Check the style of gethostbyaddr, in order of preference
1004 dnl GNU (_r eight args)
1005 AC_DEFINE(GNUSTYLE, [1], [GNU-Style get*byaddr_r])
1006 dnl SYSV (_r six args)
1007 AC_DEFINE(SYSVSTYLE, [2], [SYSV-Style get*byaddr_r])
1008 dnl BSD (three args, may not be thread safe)
1009 AC_DEFINE(BSDSTYLE, [3], [BSD-Style get*byaddr_r])
1010 dnl Tru64 has BSD version, but it is thread safe
1011 dnl http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1739____.HTM
1012 dnl We need #stdio.h to define NULL on FreeBSD (at least)
1013 gethostbyaddrrstyle=""
1014 AC_MSG_CHECKING([gethostbyaddr_r() syntax])
1017 dnl With FreeBSD, check if there's a prototype for gethostbyaddr_r.
1018 dnl Some versions (FreeBSD 5.1?) have a symbol but no prototype - so we
1019 dnl override this test to BSDSTYLE. FreeBSD 6.2 and up have proper GNU
1021 AC_CHECK_DECLS([gethostbyaddr_r], [], [
1022 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE,
1023 [style of gethostbyaddr_r functions ])
1024 gethostbyaddrrstyle=BSD
1025 AC_MSG_WARN([FreeBSD overridden to BSD-style])
1033 if test "x$gethostbyaddrrstyle" = "x"; then
1037 ], [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL, NULL) ], [
1038 AC_DEFINE(GETHOSTBYADDRRSTYLE, GNUSTYLE, [style of gethostbyaddr_r functions ])
1039 gethostbyaddrrstyle=GNU
1042 if test "x$gethostbyaddrrstyle" = "x"; then
1046 ], [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL) ] , [
1047 AC_DEFINE(GETHOSTBYADDRRSTYLE, SYSVSTYLE, [style of gethostbyaddr_r functions ])
1048 gethostbyaddrrstyle=SYSV
1051 if test "x$gethostbyaddrrstyle" = "x"; then
1055 ], [ gethostbyaddr(NULL, 0, 0) ], [
1056 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE, [style of gethostbyaddr_r functions ])
1057 gethostbyaddrrstyle=BSD
1061 if test "x$gethostbyaddrrstyle" = "x"; then
1062 AC_MSG_RESULT([none! It must not exist, here.])
1064 AC_MSG_RESULT([${gethostbyaddrrstyle}-style])
1067 if test "x$gethostbyaddrrstyle" = "xBSD"; then
1068 AC_MSG_WARN([ ****** BSD-style gethostbyaddr might NOT be thread-safe! ****** ])
1071 dnl Check the style of gethostbyname, in order of preference
1072 dnl GNU (_r seven args)
1073 dnl SYSV (_r five args)
1074 dnl BSD (two args, may not be thread safe)
1075 dnl Tru64 has BSD version, but it _is_ thread safe
1076 dnl http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1946____.HTM
1077 dnl We need #stdio.h to define NULL on FreeBSD (at least)
1078 gethostbynamerstyle=""
1079 AC_MSG_CHECKING([gethostbyname_r() syntax])
1083 ], [ gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL) ], [
1084 AC_DEFINE(GETHOSTBYNAMERSTYLE, GNUSTYLE, [style of gethostbyname_r functions ])
1085 gethostbynamerstyle=GNU
1087 if test "x$gethostbynamerstyle" = "x"; then
1091 ], [ gethostbyname_r(NULL, NULL, NULL, 0, NULL) ] , [
1092 AC_DEFINE(GETHOSTBYNAMERSTYLE, SYSVSTYLE, [style of gethostbyname_r functions ])
1093 gethostbynamerstyle=SYSV
1096 if test "x$gethostbynamerstyle" = "x"; then
1100 ], [ gethostbyname(NULL) ], [
1101 AC_DEFINE(GETHOSTBYNAMERSTYLE, BSDSTYLE, [style of gethostbyname_r functions ])
1102 gethostbynamerstyle=BSD
1106 if test "x$gethostbynamerstyle" = "x"; then
1107 AC_MSG_RESULT([none! It must not exist, here.])
1109 AC_MSG_RESULT([${gethostbynamerstyle}-style])
1112 if test "x$gethostbynamerstyle" = "xBSD"; then
1113 AC_MSG_WARN([ ****** BSD-style gethostbyname might NOT be thread-safe! ****** ])
1116 dnl check for non-posix solaris ctime_r (extra buflen int arg)
1117 AC_DEFINE(POSIXSTYLE, [1], [Posix-Style ctime_r])
1118 AC_DEFINE(SOLARISSTYLE, [2], [Solaris-Style ctime_r])
1120 AC_MSG_CHECKING([ctime_r() syntax])
1123 ], [ ctime_r(NULL, NULL, 0) ], [
1124 AC_DEFINE(CTIMERSTYLE, SOLARISSTYLE, [style of ctime_r function])
1125 ctimerstyle="SOLARIS"
1127 if test "x$ctimerstyle" = "x"; then
1130 ], [ ctime_r(NULL, NULL) ], [
1131 AC_DEFINE(CTIMERSTYLE, POSIXSTYLE, [style of ctime_r function])
1136 if test "x$ctimerstyle" = "x"; then
1137 AC_MSG_RESULT([none! It must not exist, here.])
1139 AC_MSG_RESULT([${ctimerstyle}-style])
1142 AC_SUBST(HOSTINFO, $host)
1144 dnl #############################################################
1146 dnl # 8. Checks for system services
1148 dnl #############################################################
1151 dnl # Figure out where libtool is located,
1155 AC_MSG_RESULT([top_builddir=$top_builddir])
1156 dnl # AC_SUBST(top_builddir)
1160 dnl import libtool stuff
1162 dnl #############################################################
1164 dnl # Configure in any module directories.
1166 dnl #############################################################
1169 if test "x$EXPERIMENTAL" = "xyes"; then
1170 bar=`ls -1 "${srcdir}"/src/modules/rlm_*/configure | sed 's%/configure%%'`
1171 dnl # get rid of LF's.
1172 mysubdirs=`echo $mysubdirs $bar`
1175 dnl # Find 'configure' in ONLY the stable modules
1177 for bar in `cat "${srcdir}"/src/modules/stable`; do
1178 if test -f "${srcdir}"/src/modules/$bar/configure; then
1179 mysubdirs="$mysubdirs src/modules/$bar"
1184 dnl ############################################################
1185 dnl # make modules by list
1186 dnl #############################################################
1187 if test "x$EXPERIMENTAL" = "xyes"; then
1188 for foo in `ls -1 "${srcdir}"/src/modules | grep rlm_`; do
1189 MODULES="$MODULES $foo"
1193 dnl # make ONLY the stable modules
1195 for foo in `cat "${srcdir}"/src/modules/stable`; do
1196 MODULES="$MODULES $foo"
1201 dnl # Don't change the variable name here. Autoconf goes bonkers
1204 AC_CONFIG_SUBDIRS($mysubdirs)
1207 dnl #############################################################
1209 dnl # And finally, output the results.
1211 dnl #############################################################
1213 AC_CONFIG_COMMANDS([stamp-h], [echo timestamp > src/include/stamp-h])
1214 AC_CONFIG_COMMANDS([build-radpaths-h], [(cd ./src/include && /bin/sh ./build-radpaths-h)])
1215 AC_CONFIG_COMMANDS([main-chmod], [(cd ./src/main && chmod +x checkrad.pl radlast radtest)])
1216 AC_CONFIG_COMMANDS([scripts-chmod], [(cd ./scripts && chmod +x rc.radiusd radiusd.cron.daily radiusd.cron.monthly cryptpasswd)])
1219 dnl # Substitute whatever libraries we found to be necessary
1222 AC_SUBST(INSTALLSTRIP)
1224 USE_SHARED_LIBS=$enable_shared
1225 AC_SUBST(USE_SHARED_LIBS)
1226 USE_STATIC_LIBS=$enable_static
1227 AC_SUBST(USE_STATIC_LIBS)
1228 AC_SUBST(STATIC_MODULES)
1229 AC_SUBST(RADIUSD_MAJOR_VERSION)
1230 AC_SUBST(RADIUSD_MINOR_VERSION)
1231 AC_SUBST(RADIUSD_INCRM_VERSION)
1232 AC_SUBST(RADIUSD_VERSION)
1233 AC_SUBST(RADIUSD_VERSION_STRING)
1234 AC_SUBST(RADIUSD_VERSION_COMMIT)
1238 ./src/include/build-radpaths-h \
1239 ./src/main/Makefile \
1240 ./src/main/radsniff.mk \
1241 ./src/main/checkrad.pl \
1242 ./src/main/radlast \
1243 ./src/main/radtest \
1244 ./scripts/rc.radiusd \
1245 ./scripts/radiusd.cron.daily \
1246 ./scripts/radiusd.cron.monthly \
1247 ./scripts/cryptpasswd \
1248 ./raddb/dictionary \
1249 ./raddb/radrelay.conf \
1250 ./raddb/radiusd.conf