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 use system-wide libtool, if it exists
119 AC_ARG_WITH(system-libtool,
120 [ --with-system-libtool Use the libtool installed in your system (default=use our own)],
121 [ AC_PATH_PROG(LIBTOOL, libtool,,$PATH:/usr/local/bin) AC_LIBTOOL_DLOPEN
124 LIBTOOL="`pwd`/libtool"
126 dnl ensure that we're looking for dlopen
129 dnl Figure out how to build shared libraries
134 dnl Put this in later, when all distributed modules use autoconf.
135 dnl AC_ARG_WITH(disablemodulefoo,
136 dnl [ --without-rlm_foo Disables module compilation. Module list:]
137 dnl esyscmd([find src/modules -type d -name rlm_\* -print |\
138 dnl sed -e 's%src/modules/.*/% (sub)- %; s%.*/%- %' |\
139 dnl awk '{print " "$0}']))
141 AC_ARG_ENABLE(strict-dependencies,
142 [ --enable-strict-dependencies Fail configure on lack of module dependancy.])
144 dnl extra argument: --with-docdir
145 docdir='${datadir}/doc/freeradius'
146 AC_MSG_CHECKING(docdir)
148 [ --with-docdir=DIR Directory for documentation [DATADIR/doc/freeradius] ],
155 [[\\/$]]* | ?:[[\\/]]* )
159 AC_MSG_ERROR([expected an absolute directory name for --with-docdir: $withval])
164 AC_MSG_RESULT($docdir)
165 if test "x$docdir" = xno; then
166 AC_MSG_WARN(Documentation files will NOT be installed.)
169 dnl extra argument: --with-logdir
170 logdir='${localstatedir}/log/radius'
171 AC_MSG_CHECKING(logdir)
173 [ --with-logdir=DIR Directory for logfiles [LOCALSTATEDIR/log/radius] ],
176 AC_MSG_ERROR(Need logdir)
180 [[\\/$]]* | ?:[[\\/]]* )
184 AC_MSG_ERROR([expected an absolute directory name for --with-logdir: $withval])
189 AC_MSG_RESULT($logdir)
191 dnl extra argument: --with-radacctdir
192 radacctdir='${logdir}/radacct'
193 AC_MSG_CHECKING(radacctdir)
194 AC_ARG_WITH(radacctdir,
195 [ --with-radacctdir=DIR Directory for detail files [LOGDIR/radacct] ],
198 AC_MSG_ERROR(Need radacctdir)
202 [[\\/$]]* | ?:[[\\/]]* )
203 radacctdir="$withval"
206 AC_MSG_ERROR([expected an absolute directory name for --with-radacctdir: $withval])
211 AC_MSG_RESULT($radacctdir)
213 dnl extra argument: --with-raddbdir
214 raddbdir='${sysconfdir}/raddb'
215 AC_MSG_CHECKING(raddbdir)
216 AC_ARG_WITH(raddbdir,
217 [ --with-raddbdir=DIR Directory for config files [SYSCONFDIR/raddb] ],
220 AC_MSG_ERROR(Need raddbdir)
224 [[\\/$]]* | ?:[[\\/]]* )
228 AC_MSG_ERROR([expected an absolute directory name for --with-raddbdir: $withval])
233 AC_MSG_RESULT($raddbdir)
235 dnl extra argument: --with-ascend-binary
237 AC_ARG_WITH(ascend-binary,
238 [ --with-ascend-binary Include support for Ascend binary filter attributes (default=yes)],
246 if test "X$ASCEND_BINARY" = "Xyes"; then
247 AC_DEFINE(ASCEND_BINARY, [], [Include support for Ascend binary filter attributes])
250 dnl extra argument: --with-threads
253 [ --with-threads Use threads, if available. (default=yes) ],
262 dnl extra argument: --with-vmps
265 [ --with-vmps Compile in VMPS support. (default=yes)],
273 if test "x$WITH_VMPS" = "xyes"; then
274 AC_DEFINE(WITH_VMPS, [1], [define if you want VMPS support])
277 dnl extra argument: --with-dhcp
280 [ --with-dhcp Compile in DHCP support. (default=yes)],
288 if test "x$WITH_DHCP" = "xyes"; then
289 AC_DEFINE(WITH_DHCP, [1], [define if you want DHCP support])
293 dnl extra argument: --with-post-proxy-authorize
294 WITH_POST_PROXY_AUTHORIZE=
295 AC_ARG_WITH(post-proxy-authorize,
296 [ --with-post-proxy-authorize 1.x compatibility (default=no) ],
299 WITH_POST_PROXY_AUTHORIZE=""
307 dnl # Allow the user to specify a list of modules to be linked
308 dnl # statically to the server.
311 AC_ARG_WITH(static_modules,
312 [ --with-static-modules=QUOTED-MODULE-LIST],[
313 for i in $withval; do
314 STATIC_MODULES="$STATIC_MODULES -dlpreopen ../modules/rlm_$i/rlm_$i.la"
320 [ --with-modules=QUOTED-MODULE-LIST],[
321 for i in $withval; do
322 MODULES="$MODULES $i"
327 dnl # Enable developer C compiler warnings
329 AC_ARG_ENABLE(developer,
330 [ --enable-developer Enables features of interest to developers.],
331 [ case "$enableval" in
340 if test -d $srcdir/.git; then
341 if test "x$developer" != "xno"; then
342 dnl turn on the developer flag when taken from a git checkout (not a release)
346 dnl append the current git hash onto the version string
347 if test "x$GIT" = "xyes"; then
348 RADIUSD_VERSION_COMMIT=`git log --pretty=format:'%h' -n 1`
352 dnl extra argument: --with-experimental-modules
354 AC_ARG_WITH(experimental-modules,
355 [ --with-experimental-modules Use experimental and unstable modules. (default=no) ],
364 dnl extra argument: --with-openssl
367 [ --with-openssl Use OpenSSL. (default=yes)],
379 dnl # extra argument: --with-openssl-includes=dir
382 AC_ARG_WITH(openssl-includes,
383 [ --with-openssl-includes=DIR Directory to look for OpenSSL include files],
385 *) OPENSSL_INCLUDE_DIR="$withval"
391 dnl # extra argument: --with-openssl-libraries=dir
394 AC_ARG_WITH(openssl-libraries,
395 [ --with-openssl-libraries=DIR Directory to look for OpenSSL library files],
397 *) OPENSSL_LIB_DIR="$withval"
403 dnl # These next two arguments don't actually do anything. They're
404 dnl # place holders so that the top-level configure script can tell
405 dnl # the user how to configure lower-level modules
409 dnl # extra argument: --with-rlm-FOO-lib-dir
411 AC_ARG_WITH(rlm-FOO-lib-dir,
412 [ --with-rlm-FOO-lib-dir=DIR Directory to look for library files used by module FOO],
420 dnl # extra argument: --with-rlm-FOO-include-dir
422 AC_ARG_WITH(rlm-FOO-include-dir,
423 [ --with-rlm-FOO-include-dir=DIR Directory to look for include files used by module FOO],
430 dnl See what include-style is used by the make program.
431 dnl AC_MSG_CHECKING(include style for make)
432 dnl echo "include /dev/null" > testmake.$$
433 dnl echo "all:" >> testmake.$$
434 dnl make -f testmake.$$ >/dev/null 2>&1
443 dnl rm -f testmake.$$
444 dnl AC_MSG_RESULT(" $INCLUDE")
445 dnl AC_SUBST(INCLUDE)
448 dnl extra argument: --with-udpfromto
450 AC_ARG_WITH(udpfromto,
451 [ --with-udpfromto Compile in UDPFROMTO support. (default=no)],
461 if test "x$WITH_UDPFROMTO" = "xyes"; then
462 AC_DEFINE(WITH_UDPFROMTO, [], [define if you want udpfromto])
465 dnl #############################################################
467 dnl # 1. Checks for programs
469 dnl #############################################################
472 AC_PATH_PROG(PERL, perl, /usr/local/bin/perl)
473 if test "x$ac_cv_path_PERL" = "x"; then
474 AC_MSG_WARN(perl not found - Simultaneous-Use and checkrad.pl may not work)
476 AC_PATH_PROG(SNMPGET, snmpget)
477 if test "x$ac_cv_path_SNMPGET" = "x"; then
478 AC_MSG_WARN(snmpget not found - Simultaneous-Use and checkrad.pl may not work)
481 AC_PATH_PROG(SNMPWALK, snmpwalk)
482 if test "x$ac_cv_path_SNMPWALK" = "x"; then
483 AC_MSG_WARN(snmpwalk not found - Simultaneous-Use and checkrad.pl may not work)
486 AC_PATH_PROG(RUSERS, rusers, /usr/bin/rusers)
488 dnl FIXME This is truly gross.
489 missing_dir=`cd $ac_aux_dir && pwd`
490 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
491 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
492 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
494 AC_PATH_PROG(LOCATE,locate)
495 AC_PATH_PROG(DIRNAME,dirname)
496 AC_PATH_PROG(GREP,grep)
498 dnl #############################################################
500 dnl # 2. Checks for libraries
502 dnl #############################################################
504 dnl If using pthreads, check for -lpthread (posix) or -lc_r (*BSD)
506 if test "x$WITH_THREADS" = "xyes"; then
507 if test $ac_cv_prog_suncc = "yes"; then
511 AC_CHECK_HEADERS(pthread.h, [], [ WITH_THREADS="no" ])
514 dnl # pthread stuff is usually in -lpthread
515 dnl # or in -lc_r, on *BSD
517 dnl # On Some systems, we need extra pre-processor flags, to get them to
518 dnl # to do the threading properly.
520 AC_CHECK_LIB(pthread, pthread_create,
521 [ CFLAGS="$CFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS"
522 LIBS="-lpthread $LIBS" ],
523 AC_CHECK_LIB(c_r, pthread_create,
524 [ CFLAGS="$CFLAGS -pthread -D_THREAD_SAFE" ],
525 [ WITH_THREADS="no" ]
531 dnl # If we have NO pthread libraries, remove any knowledge of threads.
533 if test "x$WITH_THREADS" != "xyes"; then
535 ac_cv_header_pthread_h="no"
539 dnl # We need sem_init() and friends, as they're the friendliest
540 dnl # semaphore functions for threading.
542 dnl # HP/UX requires linking with librt, too, to get the sem_* symbols.
543 dnl # Some systems have them in -lsem
544 dnl # Solaris has them in -lposix4
545 dnl # NetBSD has them in -lsemaphore
547 AC_SEARCH_LIBS(sem_init, pthread sem posix4 rt semaphore,
549 [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)]
553 dnl Check if we need -lsocket
554 AC_CHECK_LIB(socket, getsockname)
556 dnl Check for -lresolv
557 dnl This library may be needed later.
558 AC_CHECK_LIB(resolv, inet_aton)
560 dnl Check if we need -lnsl. Usually if we want to
561 dnl link against -lsocket we need to include -lnsl as well.
562 AC_CHECK_LIB(nsl, inet_ntoa)
564 dnl Check for OpenSSL libraries.
566 if test "x$WITH_OPENSSL" = xyes; then
568 old_LDFLAGS="$LDFLAGS"
569 if test "x$OPENSSL_LIB_DIR" != "x"; then
570 LDFLAGS="$LDFLAGS -L$OPENSSL_LIB_DIR"
572 AC_CHECK_LIB(crypto, DH_new,
574 LIBS="-lcrypto $LIBS"
575 AC_DEFINE(HAVE_LIBCRYPTO, 1,
576 [Define to 1 if you have the `crypto' library (-lcrypto).])
577 AC_CHECK_LIB(ssl, SSL_new,
579 AC_DEFINE(HAVE_LIBSSL, 1,
580 [Define to 1 if you have the `ssl' library (-lssl).])
581 if test "x$OPENSSL_LIB_DIR" != "x"; then
582 OPENSSL_LIBS="-L$OPENSSL_LIB_DIR"
584 OPENSSL_LIBS="$OPENSSL_LIBS -lcrypto -lssl -lcrypto"
588 LDFLAGS="$old_LDFLAGS"
591 AC_CHECK_LIB(ws2_32, htonl)
593 dnl Check the pcap library for the RADIUS sniffer.
595 AC_CHECK_LIB(pcap, pcap_open_live,
597 AC_DEFINE(HAVE_LIBPCAP, 1,
598 [Define to 1 if you have the `pcap' library (-lpcap).])
600 [ AC_MSG_WARN([pcap library not found, silently disabling the RADIUS sniffer.]) ])
604 dnl #############################################################
606 dnl # 3. Checks for header files
608 dnl #############################################################
611 dnl # Interix requires us to set -D_ALL_SOURCE, otherwise
612 dnl # getopt will be #included, but won't link. <sigh>
617 CFLAGS="$CFLAGS -D_ALL_SOURCE"
620 CFLAGS="$CFLAGS -DDARWIN"
621 LIBS="-framework DirectoryService $LIBS"
670 dnl FreeBSD requires sys/socket.h before net/if.h
671 AC_CHECK_HEADERS(net/if.h, [], [],
672 [#ifdef HAVE_SYS_SOCKET_H
673 # include <sys/socket.h>
678 AC_CHECK_HEADER(regex.h, AC_DEFINE(HAVE_REGEX_H, [], [define this if we have the <regex.h> header file]))
679 if test "x$ac_cv_header_regex_h" = "xyes"; then
687 ], [AC_DEFINE(HAVE_REG_EXTENDED, [], [define this if we have REG_EXTENDED (from <regex.h>)]) REGEX_EXTENDED=yes])
690 AC_SUBST(REGEX_EXTENDED)
693 dnl # other checks which require headers
695 if test "x$ac_cv_header_sys_security_h" = "xyes" && test "x$ac_cv_header_prot_h" = "xyes"
697 AC_DEFINE(OSFC2, [], [define if you have OSFC2 authentication])
700 if test "x$ac_cv_header_sia_h" = "xyes" && test "x$ac_cv_header_siad_h" = "xyes"
702 AC_DEFINE(OSFSIA, [], [define if you have OSFSIA authentication])
705 dnl Check for OpenSSL includes.
706 OPENSSL_INCLUDE="-DNO_OPENSSL"
707 if test "x$WITH_OPENSSL" = xyes; then
708 if test "x$OPENSSL_LIBS" = "x"; then
709 AC_MSG_NOTICE([skipping test for openssl/ssl.h])
711 old_CPPFLAGS=$CPPFLAGS
712 if test "x$OPENSSL_INCLUDE_DIR" != "x"; then
713 CPPFLAGS="$CPPFLAGS -I$OPENSSL_INCLUDE_DIR"
715 dnl # stupid RedHat shit
716 CPPFLAGS="$CPPFLAGS -DOPENSSL_NO_KRB5"
727 if test "x$OPENSSL_LIBS" != "x"; then
728 AC_MSG_CHECKING([for OpenSSL version >= 0.9.7])
730 [#include <openssl/crypto.h>
731 #if (OPENSSL_VERSION_NUMBER >= 0x00907000L)
735 if test "x$goodssl" != "xyes"; then
740 if test "x$OPENSSL_INCLUDE_DIR" != "x"; then
741 OPENSSL_INCLUDE="-I$OPENSSL_INCLUDE_DIR -DOPENSSL_NO_KRB5"
743 OPENSSL_INCLUDE="-DOPENSSL_NO_KRB5"
747 CPPFLAGS=$old_CPPFLAGS
750 AC_SUBST(OPENSSL_INCLUDE)
751 AC_SUBST(OPENSSL_LIBS)
754 dnl Check the pcap includes for the RADIUS sniffer.
755 if test "x$PCAP_LIBS" = x; then
756 AC_MSG_NOTICE([skipping test for pcap.h.])
758 AC_CHECK_HEADER(pcap.h,
759 AC_DEFINE(HAVE_PCAP_H, 1,
760 [Define to 1 if you have the <pcap.h> header file.]),
762 AC_MSG_WARN([pcap.h not found, silently disabling the RADIUS sniffer.])
765 AC_CHECK_LIB(pcap, pcap_fopen_offline,
766 [ AC_DEFINE(HAVE_PCAP_FOPEN_OFFLINE, 1,
767 [Define to 1 if you have the function pcap_fopen_offline.])
769 AC_CHECK_LIB(pcap, pcap_dump_fopen,
770 [ AC_DEFINE(HAVE_PCAP_DUMP_FOPEN, 1,
771 [Define to 1 if you have the function pcap_dump_fopen.])
776 dnl #############################################################
778 dnl # 4. Checks for typedefs
780 dnl #############################################################
783 dnl # Ensure that these are defined
790 dnl check for socklen_t
791 FR_CHECK_TYPE_INCLUDE([
792 #ifdef HAVE_SYS_TYPES_H
793 #include <sys/types.h>
795 #ifdef HAVE_SYS_SOCKET_H
796 #include <sys/socket.h>
798 ],socklen_t, int, [socklen_t is generally 'int' on systems which don't use it])
800 dnl check for uint8_t
801 FR_CHECK_TYPE_INCLUDE([
802 #ifdef HAVE_INTTYPES_H
803 #include <inttypes.h>
808 ],uint8_t, unsigned char, [uint8_t should be the canonical 'octet' for network traffic])
810 dnl check for uint16_t
811 FR_CHECK_TYPE_INCLUDE([
812 #ifdef HAVE_INTTYPES_H
813 #include <inttypes.h>
818 ],uint16_t, unsigned short, [uint16_t should be the canonical '2 octets' for network traffic])
820 dnl check for uint32_t
821 FR_CHECK_TYPE_INCLUDE([
822 #ifdef HAVE_INTTYPES_H
823 #include <inttypes.h>
828 ],uint32_t, unsigned int, [uint32_t should be the canonical 'network integer])
830 AC_CHECK_TYPE(struct in6_addr, AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1, [IPv6 address structure]), [], [
831 #ifdef HAVE_NETINET_IN_H
832 #include <netinet/in.h>
836 AC_CHECK_TYPE(struct sockaddr_storage, AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1, [Generic socket addresses]), [], [
837 #ifdef HAVE_NETINET_IN_H
838 #include <netinet/in.h>
840 #ifdef HAVE_SYS_SOCKET_H
841 #include <sys/socket.h>
845 AC_CHECK_TYPE(struct sockaddr_in6, AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1, [IPv6 socket addresses]), [], [
846 #ifdef HAVE_NETINET_IN_H
847 #include <netinet/in.h>
851 AC_CHECK_TYPE(struct addrinfo, AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1, [Generic DNS lookups]), [], [
852 #ifdef HAVE_SYS_TYPES_H
853 #include <sys/types.h>
855 #ifdef HAVE_SYS_SOCKET_H
856 #include <sys/socket.h>
863 dnl #############################################################
865 dnl # 5. Checks for structures and functions
867 dnl #############################################################
902 RADIUSD_NEED_DECLARATIONS( \
914 dnl # check if we have utmpx.h
915 dnl # if so, check if struct utmpx has entry ut_xtime
916 dnl # if not, set it to define ut_xtime == ut_tv.tv_sec
917 if test "x$ac_cv_header_utmpx_h" = "xyes"
919 FR_CHECK_STRUCT_HAS_MEMBER([#include <utmpx.h>], [struct utmpx], ut_xtime)
920 if test "x$ac_cv_type_struct_utmpx_has_ut_xtime" = "x"
922 AC_DEFINE(ut_xtime,ut_tv.tv_sec, [define to something if you don't have ut_xtime in struct utmpx])
926 dnl # struct ip_pktinfo
927 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in_pktinfo], ipi_addr)
928 if test "x$ac_cv_type_struct_in_pktinfo_has_ipi_addr" = "xyes"
930 AC_DEFINE(HAVE_IP_PKTINFO, [], [define if you have IP_PKTINFO (Linux)])
933 dnl # struct in6_pktinfo
934 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in6_pktinfo], ipi6_addr)
935 if test "x$ac_cv_type_struct_in6_pktinfo_has_ipi6_addr" = "xyes"
937 AC_DEFINE(HAVE_IN6_PKTINFO, [], [define if you have IN6_PKTINFO (Linux)])
940 dnl #############################################################
942 dnl # 6. Checks for compiler characteristics
944 dnl #############################################################
947 dnl # Ensure that these are defined
952 dnl # See if this is OS/2
954 AC_MSG_CHECKING(type of OS)
957 if test "$OS" = "OS/2"; then
964 AC_MSG_CHECKING(for developer gcc flags)
965 if test "x$developer" = "xyes" -a "x$GCC" = "xyes"; then
966 devflags="-g -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -W -Wredundant-decls -Wundef"
967 CFLAGS="$CFLAGS $devflags"
969 AC_MSG_RESULT(yes. Using $devflags)
972 CFLAGS="$CFLAGS -DNDEBUG"
979 dnl #############################################################
981 dnl # 7. Checks for library functions
983 dnl #############################################################
986 LIBS="$LIBS $LIBLTDL"
987 AC_CHECK_FUNC(lt_dladvise_init, AC_DEFINE(HAVE_LT_DLADVISE_INIT, [], [Do we have the lt_dladvise_init function]))
990 dnl Check for libcrypt
991 dnl We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
992 AC_CHECK_LIB(crypt, crypt,
995 if test "$CRYPTLIB" != ""; then
996 AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function])
998 AC_CHECK_FUNC(crypt, AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function]))
1001 dnl Check for libcipher
1002 AC_CHECK_LIB(cipher, setkey,
1003 CRYPTLIB="${CRYPTLIB} -lcipher"
1007 dnl Check the style of gethostbyaddr, in order of preference
1008 dnl GNU (_r eight args)
1009 AC_DEFINE(GNUSTYLE, [1], [GNU-Style get*byaddr_r])
1010 dnl SYSV (_r six args)
1011 AC_DEFINE(SYSVSTYLE, [2], [SYSV-Style get*byaddr_r])
1012 dnl BSD (three args, may not be thread safe)
1013 AC_DEFINE(BSDSTYLE, [3], [BSD-Style get*byaddr_r])
1014 dnl Tru64 has BSD version, but it is thread safe
1015 dnl http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1739____.HTM
1016 dnl We need #stdio.h to define NULL on FreeBSD (at least)
1017 gethostbyaddrrstyle=""
1018 AC_MSG_CHECKING([gethostbyaddr_r() syntax])
1021 dnl With FreeBSD, check if there's a prototype for gethostbyaddr_r.
1022 dnl Some versions (FreeBSD 5.1?) have a symbol but no prototype - so we
1023 dnl override this test to BSDSTYLE. FreeBSD 6.2 and up have proper GNU
1025 AC_CHECK_DECLS([gethostbyaddr_r], [], [
1026 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE,
1027 [style of gethostbyaddr_r functions ])
1028 gethostbyaddrrstyle=BSD
1029 AC_MSG_WARN([FreeBSD overridden to BSD-style])
1037 if test "x$gethostbyaddrrstyle" = "x"; then
1041 ], [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL, NULL) ], [
1042 AC_DEFINE(GETHOSTBYADDRRSTYLE, GNUSTYLE, [style of gethostbyaddr_r functions ])
1043 gethostbyaddrrstyle=GNU
1046 if test "x$gethostbyaddrrstyle" = "x"; then
1050 ], [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL) ] , [
1051 AC_DEFINE(GETHOSTBYADDRRSTYLE, SYSVSTYLE, [style of gethostbyaddr_r functions ])
1052 gethostbyaddrrstyle=SYSV
1055 if test "x$gethostbyaddrrstyle" = "x"; then
1059 ], [ gethostbyaddr(NULL, 0, 0) ], [
1060 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE, [style of gethostbyaddr_r functions ])
1061 gethostbyaddrrstyle=BSD
1065 if test "x$gethostbyaddrrstyle" = "x"; then
1066 AC_MSG_RESULT([none! It must not exist, here.])
1068 AC_MSG_RESULT([${gethostbyaddrrstyle}-style])
1071 if test "x$gethostbyaddrrstyle" = "xBSD"; then
1072 AC_MSG_WARN([ ****** BSD-style gethostbyaddr might NOT be thread-safe! ****** ])
1075 dnl Check the style of gethostbyname, in order of preference
1076 dnl GNU (_r seven args)
1077 dnl SYSV (_r five args)
1078 dnl BSD (two args, may not be thread safe)
1079 dnl Tru64 has BSD version, but it _is_ thread safe
1080 dnl http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1946____.HTM
1081 dnl We need #stdio.h to define NULL on FreeBSD (at least)
1082 gethostbynamerstyle=""
1083 AC_MSG_CHECKING([gethostbyname_r() syntax])
1087 ], [ gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL) ], [
1088 AC_DEFINE(GETHOSTBYNAMERSTYLE, GNUSTYLE, [style of gethostbyname_r functions ])
1089 gethostbynamerstyle=GNU
1091 if test "x$gethostbynamerstyle" = "x"; then
1095 ], [ gethostbyname_r(NULL, NULL, NULL, 0, NULL) ] , [
1096 AC_DEFINE(GETHOSTBYNAMERSTYLE, SYSVSTYLE, [style of gethostbyname_r functions ])
1097 gethostbynamerstyle=SYSV
1100 if test "x$gethostbynamerstyle" = "x"; then
1104 ], [ gethostbyname(NULL) ], [
1105 AC_DEFINE(GETHOSTBYNAMERSTYLE, BSDSTYLE, [style of gethostbyname_r functions ])
1106 gethostbynamerstyle=BSD
1110 if test "x$gethostbynamerstyle" = "x"; then
1111 AC_MSG_RESULT([none! It must not exist, here.])
1113 AC_MSG_RESULT([${gethostbynamerstyle}-style])
1116 if test "x$gethostbynamerstyle" = "xBSD"; then
1117 AC_MSG_WARN([ ****** BSD-style gethostbyname might NOT be thread-safe! ****** ])
1120 dnl check for non-posix solaris ctime_r (extra buflen int arg)
1121 AC_DEFINE(POSIXSTYLE, [1], [Posix-Style ctime_r])
1122 AC_DEFINE(SOLARISSTYLE, [2], [Solaris-Style ctime_r])
1124 AC_MSG_CHECKING([ctime_r() syntax])
1127 ], [ ctime_r(NULL, NULL, 0) ], [
1128 AC_DEFINE(CTIMERSTYLE, SOLARISSTYLE, [style of ctime_r function])
1129 ctimerstyle="SOLARIS"
1131 if test "x$ctimerstyle" = "x"; then
1134 ], [ ctime_r(NULL, NULL) ], [
1135 AC_DEFINE(CTIMERSTYLE, POSIXSTYLE, [style of ctime_r function])
1140 if test "x$ctimerstyle" = "x"; then
1141 AC_MSG_RESULT([none! It must not exist, here.])
1143 AC_MSG_RESULT([${ctimerstyle}-style])
1146 AC_SUBST(HOSTINFO, $host)
1148 if test "x$WITH_POST_PROXY_AUTHORIZE" != "x"; then
1149 AC_DEFINE(WITH_POST_PROXY_AUTHORIZE, 1, [1.x compatibility])
1152 dnl #############################################################
1154 dnl # 8. Checks for system services
1156 dnl #############################################################
1159 dnl # Figure out where libtool is located,
1163 AC_MSG_RESULT([top_builddir=$top_builddir])
1164 dnl # AC_SUBST(top_builddir)
1168 dnl import libtool stuff
1170 dnl #############################################################
1172 dnl # Configure in any module directories.
1174 dnl #############################################################
1176 mysubdirs="$LIBLTDLPATH"
1177 if test "x$EXPERIMENTAL" = "xyes"; then
1178 bar=`ls -1 "${srcdir}"/src/modules/rlm_*/configure | sed 's%/configure%%'`
1179 dnl # get rid of LF's.
1180 mysubdirs=`echo $mysubdirs $bar`
1183 dnl # Find 'configure' in ONLY the stable modules
1185 for bar in `cat "${srcdir}"/src/modules/stable`; do
1186 if test -f "${srcdir}"/src/modules/$bar/configure; then
1187 mysubdirs="$mysubdirs src/modules/$bar"
1192 dnl ############################################################
1193 dnl # make modules by list
1194 dnl #############################################################
1195 if test "x$EXPERIMENTAL" = "xyes"; then
1196 for foo in `ls -1 "${srcdir}"/src/modules | grep rlm_`; do
1197 MODULES="$MODULES $foo"
1201 dnl # make ONLY the stable modules
1203 for foo in `cat "${srcdir}"/src/modules/stable`; do
1204 MODULES="$MODULES $foo"
1209 dnl # Don't change the variable name here. Autoconf goes bonkers
1212 AC_CONFIG_SUBDIRS($LTDL_SUBDIRS $mysubdirs)
1215 dnl #############################################################
1217 dnl # And finally, output the results.
1219 dnl #############################################################
1221 AC_CONFIG_COMMANDS([stamp-h], [echo timestamp > src/include/stamp-h])
1222 AC_CONFIG_COMMANDS([build-radpaths-h], [(cd ./src/include && /bin/sh ./build-radpaths-h)])
1223 AC_CONFIG_COMMANDS([main-chmod], [(cd ./src/main && chmod +x checkrad.pl radlast radtest)])
1224 AC_CONFIG_COMMANDS([scripts-chmod], [(cd ./scripts && chmod +x rc.radiusd radwatch radiusd.cron.daily radiusd.cron.monthly cryptpasswd)])
1227 dnl # Substitute whatever libraries we found to be necessary
1230 AC_SUBST(INSTALLSTRIP)
1232 USE_SHARED_LIBS=$enable_shared
1233 AC_SUBST(USE_SHARED_LIBS)
1234 USE_STATIC_LIBS=$enable_static
1235 AC_SUBST(USE_STATIC_LIBS)
1236 AC_SUBST(STATIC_MODULES)
1237 AC_SUBST(RADIUSD_MAJOR_VERSION)
1238 AC_SUBST(RADIUSD_MINOR_VERSION)
1239 AC_SUBST(RADIUSD_INCRM_VERSION)
1240 AC_SUBST(RADIUSD_VERSION)
1241 AC_SUBST(RADIUSD_VERSION_STRING)
1242 AC_SUBST(RADIUSD_VERSION_COMMIT)
1246 ./src/include/build-radpaths-h \
1247 ./src/main/Makefile \
1248 ./src/main/checkrad.pl \
1249 ./src/main/radlast \
1250 ./src/main/radtest \
1251 ./scripts/rc.radiusd \
1252 ./scripts/radwatch \
1253 ./scripts/radiusd.cron.daily \
1254 ./scripts/radiusd.cron.monthly \
1255 ./scripts/cryptpasswd \
1256 ./raddb/dictionary \
1257 ./raddb/radrelay.conf \
1258 ./raddb/radiusd.conf