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 | egrep -o '^[[0-9]]+\.[[0-9]]+') 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="$CFLAGS --sysroot=$osx_sdk_path "
83 export CPPFLAGS="$CPPFLAGS --sysroot=$osx_sdk_path "
84 export LDFLAGS="$LDFLAGS -L$osx_sdk_path/usr/lib/ "
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 set this shit so it doesn't force CFLAGS...
158 dnl use system-wide libtool, if it exists
159 AC_ARG_WITH(system-libtool,
160 [ --with-system-libtool Use the libtool installed in your system (default=use our own)],
161 [ AC_PATH_PROG(LIBTOOL, libtool,,$PATH:/usr/local/bin) AC_LIBTOOL_DLOPEN
164 LIBTOOL="`pwd`/libtool"
166 dnl ensure that we're looking for dlopen
169 dnl Figure out how to build shared libraries
174 dnl Put this in later, when all distributed modules use autoconf.
175 dnl AC_ARG_WITH(disablemodulefoo,
176 dnl [ --without-rlm_foo Disables module compilation. Module list:]
177 dnl esyscmd([find src/modules -type d -name rlm_\* -print |\
178 dnl sed -e 's%src/modules/.*/% (sub)- %; s%.*/%- %' |\
179 dnl awk '{print " "$0}']))
181 AC_ARG_ENABLE(strict-dependencies,
182 [ --enable-strict-dependencies Fail configure on lack of module dependancy.])
184 dnl extra argument: --with-docdir
185 docdir='${datadir}/doc/freeradius'
186 AC_MSG_CHECKING(docdir)
188 [ --with-docdir=DIR Directory for documentation [DATADIR/doc/freeradius] ],
195 [[\\/$]]* | ?:[[\\/]]* )
199 AC_MSG_ERROR([expected an absolute directory name for --with-docdir: $withval])
204 AC_MSG_RESULT($docdir)
205 if test "x$docdir" = xno; then
206 AC_MSG_WARN(Documentation files will NOT be installed.)
209 dnl extra argument: --with-logdir
210 logdir='${localstatedir}/log/radius'
211 AC_MSG_CHECKING(logdir)
213 [ --with-logdir=DIR Directory for logfiles [LOCALSTATEDIR/log/radius] ],
216 AC_MSG_ERROR(Need logdir)
220 [[\\/$]]* | ?:[[\\/]]* )
224 AC_MSG_ERROR([expected an absolute directory name for --with-logdir: $withval])
229 AC_MSG_RESULT($logdir)
231 dnl extra argument: --with-radacctdir
232 radacctdir='${logdir}/radacct'
233 AC_MSG_CHECKING(radacctdir)
234 AC_ARG_WITH(radacctdir,
235 [ --with-radacctdir=DIR Directory for detail files [LOGDIR/radacct] ],
238 AC_MSG_ERROR(Need radacctdir)
242 [[\\/$]]* | ?:[[\\/]]* )
243 radacctdir="$withval"
246 AC_MSG_ERROR([expected an absolute directory name for --with-radacctdir: $withval])
251 AC_MSG_RESULT($radacctdir)
253 dnl extra argument: --with-raddbdir
254 raddbdir='${sysconfdir}/raddb'
255 AC_MSG_CHECKING(raddbdir)
256 AC_ARG_WITH(raddbdir,
257 [ --with-raddbdir=DIR Directory for config files [SYSCONFDIR/raddb] ],
260 AC_MSG_ERROR(Need raddbdir)
264 [[\\/$]]* | ?:[[\\/]]* )
268 AC_MSG_ERROR([expected an absolute directory name for --with-raddbdir: $withval])
273 AC_MSG_RESULT($raddbdir)
275 dnl extra argument: --with-ascend-binary
277 AC_ARG_WITH(ascend-binary,
278 [ --with-ascend-binary Include support for Ascend binary filter attributes (default=yes)],
286 if test "X$ASCEND_BINARY" = "Xyes"; then
287 AC_DEFINE(ASCEND_BINARY, [], [Include support for Ascend binary filter attributes])
290 dnl extra argument: --with-threads
293 [ --with-threads Use threads, if available. (default=yes) ],
302 dnl extra argument: --with-vmps
305 [ --with-vmps Compile in VMPS support. (default=yes)],
313 if test "x$WITH_VMPS" = "xyes"; then
314 AC_DEFINE(WITH_VMPS, [1], [define if you want VMPS support])
317 dnl extra argument: --with-dhcp
320 [ --with-dhcp Compile in DHCP support. (default=yes)],
328 if test "x$WITH_DHCP" = "xyes"; then
329 AC_DEFINE(WITH_DHCP, [1], [define if you want DHCP support])
333 dnl extra argument: --with-post-proxy-authorize
334 WITH_POST_PROXY_AUTHORIZE=
335 AC_ARG_WITH(post-proxy-authorize,
336 [ --with-post-proxy-authorize 1.x compatibility (default=no) ],
339 WITH_POST_PROXY_AUTHORIZE=""
347 dnl # Allow the user to specify a list of modules to be linked
348 dnl # statically to the server.
351 AC_ARG_WITH(static_modules,
352 [ --with-static-modules=QUOTED-MODULE-LIST],[
353 for i in $withval; do
354 STATIC_MODULES="$STATIC_MODULES -dlpreopen ../modules/rlm_$i/rlm_$i.la"
360 [ --with-modules=QUOTED-MODULE-LIST],[
361 for i in $withval; do
362 MODULES="$MODULES $i"
367 dnl # Enable developer C compiler warnings
369 AC_ARG_ENABLE(developer,
370 [ --enable-developer Enables features of interest to developers.],
371 [ case "$enableval" in
380 if test -d $srcdir/.git; then
381 if test "x$developer" != "xno"; then
382 dnl turn on the developer flag when taken from a git checkout (not a release)
386 dnl append the current git hash onto the version string
387 if test "x$GIT" = "xyes"; then
388 RADIUSD_VERSION_COMMIT=`git log --pretty=format:'%h' -n 1`
392 dnl extra argument: --with-experimental-modules
394 AC_ARG_WITH(experimental-modules,
395 [ --with-experimental-modules Use experimental and unstable modules. (default=no) ],
404 dnl extra argument: --with-openssl
407 [ --with-openssl Use OpenSSL. (default=yes)],
419 dnl # extra argument: --with-openssl-includes=dir
422 AC_ARG_WITH(openssl-includes,
423 [ --with-openssl-includes=DIR Directory to look for OpenSSL include files],
425 *) OPENSSL_INCLUDE_DIR="$withval"
431 dnl # extra argument: --with-openssl-libraries=dir
434 AC_ARG_WITH(openssl-libraries,
435 [ --with-openssl-libraries=DIR Directory to look for OpenSSL library files],
437 *) OPENSSL_LIB_DIR="$withval"
443 dnl # These next two arguments don't actually do anything. They're
444 dnl # place holders so that the top-level configure script can tell
445 dnl # the user how to configure lower-level modules
449 dnl # extra argument: --with-rlm-FOO-lib-dir
451 AC_ARG_WITH(rlm-FOO-lib-dir,
452 [ --with-rlm-FOO-lib-dir=DIR Directory to look for library files used by module FOO],
460 dnl # extra argument: --with-rlm-FOO-include-dir
462 AC_ARG_WITH(rlm-FOO-include-dir,
463 [ --with-rlm-FOO-include-dir=DIR Directory to look for include files used by module FOO],
470 dnl See what include-style is used by the make program.
471 dnl AC_MSG_CHECKING(include style for make)
472 dnl echo "include /dev/null" > testmake.$$
473 dnl echo "all:" >> testmake.$$
474 dnl make -f testmake.$$ >/dev/null 2>&1
483 dnl rm -f testmake.$$
484 dnl AC_MSG_RESULT(" $INCLUDE")
485 dnl AC_SUBST(INCLUDE)
488 dnl extra argument: --with-udpfromto
490 AC_ARG_WITH(udpfromto,
491 [ --with-udpfromto Compile in UDPFROMTO support. (default=no)],
501 if test "x$WITH_UDPFROMTO" = "xyes"; then
502 AC_DEFINE(WITH_UDPFROMTO, [], [define if you want udpfromto])
505 dnl #############################################################
507 dnl # 1. Checks for programs
509 dnl #############################################################
512 AC_PATH_PROG(PERL, perl, /usr/local/bin/perl)
513 if test "x$ac_cv_path_PERL" = "x"; then
514 AC_MSG_WARN(perl not found - Simultaneous-Use and checkrad.pl may not work)
516 AC_PATH_PROG(SNMPGET, snmpget)
517 if test "x$ac_cv_path_SNMPGET" = "x"; then
518 AC_MSG_WARN(snmpget not found - Simultaneous-Use and checkrad.pl may not work)
521 AC_PATH_PROG(SNMPWALK, snmpwalk)
522 if test "x$ac_cv_path_SNMPWALK" = "x"; then
523 AC_MSG_WARN(snmpwalk not found - Simultaneous-Use and checkrad.pl may not work)
526 AC_PATH_PROG(RUSERS, rusers, /usr/bin/rusers)
528 dnl FIXME This is truly gross.
529 missing_dir=`cd $ac_aux_dir && pwd`
530 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
531 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
532 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
534 AC_PATH_PROG(LOCATE,locate)
535 AC_PATH_PROG(DIRNAME,dirname)
536 AC_PATH_PROG(GREP,grep)
538 dnl #############################################################
540 dnl # 2. Checks for libraries
542 dnl #############################################################
544 dnl If using pthreads, check for -lpthread (posix) or -lc_r (*BSD)
546 if test "x$WITH_THREADS" = "xyes"; then
547 if test $ac_cv_prog_suncc = "yes"; then
551 AC_CHECK_HEADERS(pthread.h, [], [ WITH_THREADS="no" ])
554 dnl # pthread stuff is usually in -lpthread
555 dnl # or in -lc_r, on *BSD
557 dnl # On Some systems, we need extra pre-processor flags, to get them to
558 dnl # to do the threading properly.
560 AC_CHECK_LIB(pthread, pthread_create,
561 [ CFLAGS="$CFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS"
562 LIBS="-lpthread $LIBS" ],
563 AC_CHECK_LIB(c_r, pthread_create,
564 [ CFLAGS="$CFLAGS -pthread -D_THREAD_SAFE" ],
565 [ WITH_THREADS="no" ]
571 dnl # If we have NO pthread libraries, remove any knowledge of threads.
573 if test "x$WITH_THREADS" != "xyes"; then
575 ac_cv_header_pthread_h="no"
579 dnl # We need sem_init() and friends, as they're the friendliest
580 dnl # semaphore functions for threading.
582 dnl # HP/UX requires linking with librt, too, to get the sem_* symbols.
583 dnl # Some systems have them in -lsem
584 dnl # Solaris has them in -lposix4
585 dnl # NetBSD has them in -lsemaphore
587 AC_SEARCH_LIBS(sem_init, pthread sem posix4 rt semaphore,
589 [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)]
593 dnl Check if we need -lsocket
594 AC_CHECK_LIB(socket, getsockname)
596 dnl Check for -lresolv
597 dnl This library may be needed later.
598 AC_CHECK_LIB(resolv, inet_aton)
600 dnl Check if we need -lnsl. Usually if we want to
601 dnl link against -lsocket we need to include -lnsl as well.
602 AC_CHECK_LIB(nsl, inet_ntoa)
604 dnl Check for OpenSSL libraries.
606 if test "x$WITH_OPENSSL" = xyes; then
608 old_LDFLAGS="$LDFLAGS"
609 if test "x$OPENSSL_LIB_DIR" != "x"; then
610 LDFLAGS="-L$OPENSSL_LIB_DIR $LDFLAGS"
612 AC_CHECK_LIB(crypto, DH_new,
614 LIBS="-lcrypto $LIBS"
615 AC_DEFINE(HAVE_LIBCRYPTO, 1,
616 [Define to 1 if you have the `crypto' library (-lcrypto).])
617 AC_CHECK_LIB(ssl, SSL_new,
619 AC_DEFINE(HAVE_LIBSSL, 1,
620 [Define to 1 if you have the `ssl' library (-lssl).])
621 if test "x$OPENSSL_LIB_DIR" != "x"; then
622 OPENSSL_LIBS="-L$OPENSSL_LIB_DIR"
624 OPENSSL_LIBS="$OPENSSL_LIBS -lcrypto -lssl -lcrypto"
628 LDFLAGS="$old_LDFLAGS"
631 AC_CHECK_LIB(ws2_32, htonl)
633 dnl Check the pcap library for the RADIUS sniffer.
635 AC_CHECK_LIB(pcap, pcap_open_live,
637 AC_DEFINE(HAVE_LIBPCAP, 1,
638 [Define to 1 if you have the `pcap' library (-lpcap).])
640 [ AC_MSG_WARN([pcap library not found, silently disabling the RADIUS sniffer.]) ])
644 dnl #############################################################
646 dnl # 3. Checks for header files
648 dnl #############################################################
651 dnl # Interix requires us to set -D_ALL_SOURCE, otherwise
652 dnl # getopt will be #included, but won't link. <sigh>
657 CFLAGS="$CFLAGS -D_ALL_SOURCE"
660 CFLAGS="$CFLAGS -DDARWIN"
661 LIBS="-framework DirectoryService $LIBS"
710 dnl FreeBSD requires sys/socket.h before net/if.h
711 AC_CHECK_HEADERS(net/if.h, [], [],
712 [#ifdef HAVE_SYS_SOCKET_H
713 # include <sys/socket.h>
718 AC_CHECK_HEADER(regex.h, AC_DEFINE(HAVE_REGEX_H, [], [define this if we have the <regex.h> header file]))
719 if test "x$ac_cv_header_regex_h" = "xyes"; then
727 ], [AC_DEFINE(HAVE_REG_EXTENDED, [], [define this if we have REG_EXTENDED (from <regex.h>)]) REGEX_EXTENDED=yes])
730 AC_SUBST(REGEX_EXTENDED)
733 dnl # other checks which require headers
735 if test "x$ac_cv_header_sys_security_h" = "xyes" && test "x$ac_cv_header_prot_h" = "xyes"
737 AC_DEFINE(OSFC2, [], [define if you have OSFC2 authentication])
740 if test "x$ac_cv_header_sia_h" = "xyes" && test "x$ac_cv_header_siad_h" = "xyes"
742 AC_DEFINE(OSFSIA, [], [define if you have OSFSIA authentication])
746 dnl # Were we told to use OpenSSL, if we were and we find an error, call AC_MSG_FAILURE and exit
748 if test "x$WITH_OPENSSL" = xyes; then
750 old_LDFLAGS="$LDFLAGS"
752 OPENSSL_INCLUDE="-DNO_OPENSSL"
754 if test "x$OPENSSL_LIB_DIR" != "x"; then
755 LDFLAGS="-L$OPENSSL_LIB_DIR $LDFLAGS"
759 dnl # Check we can link to libssl
761 AC_CHECK_LIB(crypto, DH_new,
763 LIBS="-lcrypto $LIBS"
764 AC_DEFINE(HAVE_LIBCRYPTO, 1, [Define to 1 if you have the `crypto' library (-lcrypto).])
765 AC_CHECK_LIB(ssl, SSL_new,
767 AC_DEFINE(HAVE_LIBSSL, 1, [Define to 1 if you have the `ssl' library (-lssl).])
768 if test "x$OPENSSL_LIB_DIR" != "x"; then
769 OPENSSL_LIBS="-L$OPENSSL_LIB_DIR"
771 OPENSSL_LIBS="$OPENSSL_LIBS -lcrypto -lssl -lcrypto"
772 LIBS="$OPENSSL_LIBS $LIBS"
775 AC_MSG_FAILURE([failed linking to libssl])
783 dnl # Check we can find required headers
785 old_CPPFLAGS=$CPPFLAGS
787 if test "x$OPENSSL_INCLUDE_DIR" != "x"; then
788 CPPFLAGS="-I$OPENSSL_INCLUDE_DIR $CPPFLAGS"
789 CFLAGS="-I$OPENSSL_INCLUDE_DIR $CFLAGS"
793 dnl # Stupid RedHat shit
795 CPPFLAGS="$CPPFLAGS -DOPENSSL_NO_KRB5"
808 AC_MSG_FAILURE([failed locating OpenSSL headers])
812 AC_MSG_CHECKING([for OpenSSL version >= 0.9.7])
814 [#include <openssl/crypto.h>
815 #if (OPENSSL_VERSION_NUMBER >= 0x00907000L)
824 AC_MSG_FAILURE([OpenSSL version too old])
828 if test "x$OPENSSL_INCLUDE_DIR" != "x"; then
829 OPENSSL_INCLUDE="-I$OPENSSL_INCLUDE_DIR -DOPENSSL_NO_KRB5"
831 OPENSSL_INCLUDE="-DOPENSSL_NO_KRB5"
835 dnl # Now check that the header versions match the library
837 AC_MSG_CHECKING([OpenSSL library and header version consistency])
842 #include <openssl/opensslv.h>
843 #include <openssl/crypto.h>
846 if (SSLeay() == OPENSSL_VERSION_NUMBER) {
849 printf("library: %lx header: %lx... ", (unsigned long) SSLeay(), (unsigned long) OPENSSL_VERSION_NUMBER);
859 AC_MSG_FAILURE([OpenSSL library version does not match header version])
863 if test "x$OPENSSL_LIBS" = x; then
865 LDFLAGS="$old_LDFLAGS"
867 if test "x$OPENSSL_INCLUDE" = x; then
868 CPPFLAGS=$old_CPPFLAGS
873 AC_SUBST(OPENSSL_INCLUDE)
874 AC_SUBST(OPENSSL_LIBS)
877 dnl Check the pcap includes for the RADIUS sniffer.
878 if test "x$PCAP_LIBS" = x; then
879 AC_MSG_NOTICE([skipping test for pcap.h.])
881 AC_CHECK_HEADER(pcap.h,
882 AC_DEFINE(HAVE_PCAP_H, 1,
883 [Define to 1 if you have the <pcap.h> header file.]),
885 AC_MSG_WARN([pcap.h not found, silently disabling the RADIUS sniffer.])
888 AC_CHECK_LIB(pcap, pcap_fopen_offline,
889 [ AC_DEFINE(HAVE_PCAP_FOPEN_OFFLINE, 1,
890 [Define to 1 if you have the function pcap_fopen_offline.])
892 AC_CHECK_LIB(pcap, pcap_dump_fopen,
893 [ AC_DEFINE(HAVE_PCAP_DUMP_FOPEN, 1,
894 [Define to 1 if you have the function pcap_dump_fopen.])
899 dnl #############################################################
901 dnl # 4. Checks for typedefs
903 dnl #############################################################
906 dnl # Ensure that these are defined
913 dnl check for socklen_t
914 FR_CHECK_TYPE_INCLUDE([
915 #ifdef HAVE_SYS_TYPES_H
916 #include <sys/types.h>
918 #ifdef HAVE_SYS_SOCKET_H
919 #include <sys/socket.h>
921 ],socklen_t, int, [socklen_t is generally 'int' on systems which don't use it])
923 dnl check for uint8_t
924 FR_CHECK_TYPE_INCLUDE([
925 #ifdef HAVE_INTTYPES_H
926 #include <inttypes.h>
931 ],uint8_t, unsigned char, [uint8_t should be the canonical 'octet' for network traffic])
933 dnl check for uint16_t
934 FR_CHECK_TYPE_INCLUDE([
935 #ifdef HAVE_INTTYPES_H
936 #include <inttypes.h>
941 ],uint16_t, unsigned short, [uint16_t should be the canonical '2 octets' for network traffic])
943 dnl check for uint32_t
944 FR_CHECK_TYPE_INCLUDE([
945 #ifdef HAVE_INTTYPES_H
946 #include <inttypes.h>
951 ],uint32_t, unsigned int, [uint32_t should be the canonical 'network integer])
953 AC_CHECK_TYPE(struct in6_addr, AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1, [IPv6 address structure]), [], [
954 #ifdef HAVE_NETINET_IN_H
955 #include <netinet/in.h>
959 AC_CHECK_TYPE(struct sockaddr_storage, AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1, [Generic socket addresses]), [], [
960 #ifdef HAVE_NETINET_IN_H
961 #include <netinet/in.h>
963 #ifdef HAVE_SYS_SOCKET_H
964 #include <sys/socket.h>
968 AC_CHECK_TYPE(struct sockaddr_in6, AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1, [IPv6 socket addresses]), [], [
969 #ifdef HAVE_NETINET_IN_H
970 #include <netinet/in.h>
974 AC_CHECK_TYPE(struct addrinfo, AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1, [Generic DNS lookups]), [], [
975 #ifdef HAVE_SYS_TYPES_H
976 #include <sys/types.h>
978 #ifdef HAVE_SYS_SOCKET_H
979 #include <sys/socket.h>
986 dnl #############################################################
988 dnl # 5. Checks for structures and functions
990 dnl #############################################################
1025 RADIUSD_NEED_DECLARATIONS( \
1037 dnl # check if we have utmpx.h
1038 dnl # if so, check if struct utmpx has entry ut_xtime
1039 dnl # if not, set it to define ut_xtime == ut_tv.tv_sec
1040 if test "x$ac_cv_header_utmpx_h" = "xyes"
1042 FR_CHECK_STRUCT_HAS_MEMBER([#include <utmpx.h>], [struct utmpx], ut_xtime)
1043 if test "x$ac_cv_type_struct_utmpx_has_ut_xtime" = "x"
1045 AC_DEFINE(ut_xtime,ut_tv.tv_sec, [define to something if you don't have ut_xtime in struct utmpx])
1049 dnl # struct ip_pktinfo
1050 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in_pktinfo], ipi_addr)
1051 if test "x$ac_cv_type_struct_in_pktinfo_has_ipi_addr" = "xyes"
1053 AC_DEFINE(HAVE_IP_PKTINFO, [], [define if you have IP_PKTINFO (Linux)])
1056 dnl # struct in6_pktinfo
1057 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in6_pktinfo], ipi6_addr)
1058 if test "x$ac_cv_type_struct_in6_pktinfo_has_ipi6_addr" = "xyes"
1060 AC_DEFINE(HAVE_IN6_PKTINFO, [], [define if you have IN6_PKTINFO (Linux)])
1063 dnl #############################################################
1065 dnl # 6. Checks for compiler characteristics
1067 dnl #############################################################
1070 dnl # Ensure that these are defined
1075 dnl # See if this is OS/2
1077 AC_MSG_CHECKING(type of OS)
1080 if test "$OS" = "OS/2"; then
1087 AC_MSG_CHECKING(for developer gcc flags)
1088 if test "x$developer" = "xyes" -a "x$GCC" = "xyes"; then
1089 devflags="-g -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -W -Wredundant-decls -Wundef"
1090 CFLAGS="$CFLAGS $devflags"
1092 AC_MSG_RESULT(yes. Using $devflags)
1095 CFLAGS="$CFLAGS -DNDEBUG"
1102 dnl #############################################################
1104 dnl # 7. Checks for library functions
1106 dnl #############################################################
1109 LIBS="$LIBS $LIBLTDL"
1110 AC_CHECK_FUNC(lt_dladvise_init, AC_DEFINE(HAVE_LT_DLADVISE_INIT, [], [Do we have the lt_dladvise_init function]))
1113 dnl Check for libcrypt
1114 dnl We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
1115 AC_CHECK_LIB(crypt, crypt,
1118 if test "$CRYPTLIB" != ""; then
1119 AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function])
1121 AC_CHECK_FUNC(crypt, AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function]))
1124 dnl Check for libcipher
1125 AC_CHECK_LIB(cipher, setkey,
1126 CRYPTLIB="${CRYPTLIB} -lcipher"
1130 dnl Check the style of gethostbyaddr, in order of preference
1131 dnl GNU (_r eight args)
1132 AC_DEFINE(GNUSTYLE, [1], [GNU-Style get*byaddr_r])
1133 dnl SYSV (_r six args)
1134 AC_DEFINE(SYSVSTYLE, [2], [SYSV-Style get*byaddr_r])
1135 dnl BSD (three args, may not be thread safe)
1136 AC_DEFINE(BSDSTYLE, [3], [BSD-Style get*byaddr_r])
1137 dnl Tru64 has BSD version, but it is thread safe
1138 dnl http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1739____.HTM
1139 dnl We need #stdio.h to define NULL on FreeBSD (at least)
1140 gethostbyaddrrstyle=""
1141 AC_MSG_CHECKING([gethostbyaddr_r() syntax])
1144 dnl With FreeBSD, check if there's a prototype for gethostbyaddr_r.
1145 dnl Some versions (FreeBSD 5.1?) have a symbol but no prototype - so we
1146 dnl override this test to BSDSTYLE. FreeBSD 6.2 and up have proper GNU
1148 AC_CHECK_DECLS([gethostbyaddr_r], [], [
1149 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE,
1150 [style of gethostbyaddr_r functions ])
1151 gethostbyaddrrstyle=BSD
1152 AC_MSG_WARN([FreeBSD overridden to BSD-style])
1160 if test "x$gethostbyaddrrstyle" = "x"; then
1164 ], [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL, NULL) ], [
1165 AC_DEFINE(GETHOSTBYADDRRSTYLE, GNUSTYLE, [style of gethostbyaddr_r functions ])
1166 gethostbyaddrrstyle=GNU
1169 if test "x$gethostbyaddrrstyle" = "x"; then
1173 ], [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL) ] , [
1174 AC_DEFINE(GETHOSTBYADDRRSTYLE, SYSVSTYLE, [style of gethostbyaddr_r functions ])
1175 gethostbyaddrrstyle=SYSV
1178 if test "x$gethostbyaddrrstyle" = "x"; then
1182 ], [ gethostbyaddr(NULL, 0, 0) ], [
1183 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE, [style of gethostbyaddr_r functions ])
1184 gethostbyaddrrstyle=BSD
1188 if test "x$gethostbyaddrrstyle" = "x"; then
1189 AC_MSG_RESULT([none! It must not exist, here.])
1191 AC_MSG_RESULT([${gethostbyaddrrstyle}-style])
1194 if test "x$gethostbyaddrrstyle" = "xBSD"; then
1195 AC_MSG_WARN([ ****** BSD-style gethostbyaddr might NOT be thread-safe! ****** ])
1198 dnl Check the style of gethostbyname, in order of preference
1199 dnl GNU (_r seven args)
1200 dnl SYSV (_r five args)
1201 dnl BSD (two args, may not be thread safe)
1202 dnl Tru64 has BSD version, but it _is_ thread safe
1203 dnl http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1946____.HTM
1204 dnl We need #stdio.h to define NULL on FreeBSD (at least)
1205 gethostbynamerstyle=""
1206 AC_MSG_CHECKING([gethostbyname_r() syntax])
1210 ], [ gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL) ], [
1211 AC_DEFINE(GETHOSTBYNAMERSTYLE, GNUSTYLE, [style of gethostbyname_r functions ])
1212 gethostbynamerstyle=GNU
1214 if test "x$gethostbynamerstyle" = "x"; then
1218 ], [ gethostbyname_r(NULL, NULL, NULL, 0, NULL) ] , [
1219 AC_DEFINE(GETHOSTBYNAMERSTYLE, SYSVSTYLE, [style of gethostbyname_r functions ])
1220 gethostbynamerstyle=SYSV
1223 if test "x$gethostbynamerstyle" = "x"; then
1227 ], [ gethostbyname(NULL) ], [
1228 AC_DEFINE(GETHOSTBYNAMERSTYLE, BSDSTYLE, [style of gethostbyname_r functions ])
1229 gethostbynamerstyle=BSD
1233 if test "x$gethostbynamerstyle" = "x"; then
1234 AC_MSG_RESULT([none! It must not exist, here.])
1236 AC_MSG_RESULT([${gethostbynamerstyle}-style])
1239 if test "x$gethostbynamerstyle" = "xBSD"; then
1240 AC_MSG_WARN([ ****** BSD-style gethostbyname might NOT be thread-safe! ****** ])
1243 dnl check for non-posix solaris ctime_r (extra buflen int arg)
1244 AC_DEFINE(POSIXSTYLE, [1], [Posix-Style ctime_r])
1245 AC_DEFINE(SOLARISSTYLE, [2], [Solaris-Style ctime_r])
1247 AC_MSG_CHECKING([ctime_r() syntax])
1250 ], [ ctime_r(NULL, NULL, 0) ], [
1251 AC_DEFINE(CTIMERSTYLE, SOLARISSTYLE, [style of ctime_r function])
1252 ctimerstyle="SOLARIS"
1254 if test "x$ctimerstyle" = "x"; then
1257 ], [ ctime_r(NULL, NULL) ], [
1258 AC_DEFINE(CTIMERSTYLE, POSIXSTYLE, [style of ctime_r function])
1263 if test "x$ctimerstyle" = "x"; then
1264 AC_MSG_RESULT([none! It must not exist, here.])
1266 AC_MSG_RESULT([${ctimerstyle}-style])
1269 AC_SUBST(HOSTINFO, $host)
1271 if test "x$WITH_POST_PROXY_AUTHORIZE" != "x"; then
1272 AC_DEFINE(WITH_POST_PROXY_AUTHORIZE, 1, [1.x compatibility])
1275 dnl #############################################################
1277 dnl # 8. Checks for system services
1279 dnl #############################################################
1282 dnl # Figure out where libtool is located,
1286 AC_MSG_RESULT([top_builddir=$top_builddir])
1287 dnl # AC_SUBST(top_builddir)
1291 dnl import libtool stuff
1293 dnl #############################################################
1295 dnl # Configure in any module directories.
1297 dnl #############################################################
1299 mysubdirs="$LIBLTDLPATH"
1300 if test "x$EXPERIMENTAL" = "xyes"; then
1301 bar=`ls -1 "${srcdir}"/src/modules/rlm_*/configure | sed 's%/configure%%'`
1302 dnl # get rid of LF's.
1303 mysubdirs=`echo $mysubdirs $bar`
1306 dnl # Find 'configure' in ONLY the stable modules
1308 for bar in `cat "${srcdir}"/src/modules/stable`; do
1309 if test -f "${srcdir}"/src/modules/$bar/configure; then
1310 mysubdirs="$mysubdirs src/modules/$bar"
1315 dnl ############################################################
1316 dnl # make modules by list
1317 dnl #############################################################
1318 if test "x$EXPERIMENTAL" = "xyes"; then
1319 for foo in `ls -1 "${srcdir}"/src/modules | grep rlm_`; do
1320 MODULES="$MODULES $foo"
1324 dnl # make ONLY the stable modules
1326 for foo in `cat "${srcdir}"/src/modules/stable`; do
1327 MODULES="$MODULES $foo"
1332 dnl # Don't change the variable name here. Autoconf goes bonkers
1335 AC_CONFIG_SUBDIRS($LTDL_SUBDIRS $mysubdirs)
1338 dnl #############################################################
1340 dnl # And finally, output the results.
1342 dnl #############################################################
1344 AC_CONFIG_COMMANDS([stamp-h], [echo timestamp > src/include/stamp-h])
1345 AC_CONFIG_COMMANDS([build-radpaths-h], [(cd ./src/include && /bin/sh ./build-radpaths-h)])
1346 AC_CONFIG_COMMANDS([main-chmod], [(cd ./src/main && chmod +x checkrad.pl radlast radtest)])
1347 AC_CONFIG_COMMANDS([scripts-chmod], [(cd ./scripts && chmod +x rc.radiusd radwatch radiusd.cron.daily radiusd.cron.monthly cryptpasswd)])
1350 dnl # Substitute whatever libraries we found to be necessary
1353 AC_SUBST(INSTALLSTRIP)
1355 USE_SHARED_LIBS=$enable_shared
1356 AC_SUBST(USE_SHARED_LIBS)
1357 USE_STATIC_LIBS=$enable_static
1358 AC_SUBST(USE_STATIC_LIBS)
1359 AC_SUBST(STATIC_MODULES)
1360 AC_SUBST(RADIUSD_MAJOR_VERSION)
1361 AC_SUBST(RADIUSD_MINOR_VERSION)
1362 AC_SUBST(RADIUSD_INCRM_VERSION)
1363 AC_SUBST(RADIUSD_VERSION)
1364 AC_SUBST(RADIUSD_VERSION_STRING)
1365 AC_SUBST(RADIUSD_VERSION_COMMIT)
1369 ./src/include/build-radpaths-h \
1370 ./src/main/Makefile \
1371 ./src/main/checkrad.pl \
1372 ./src/main/radlast \
1373 ./src/main/radtest \
1374 ./scripts/rc.radiusd \
1375 ./scripts/radwatch \
1376 ./scripts/radiusd.cron.daily \
1377 ./scripts/radiusd.cron.monthly \
1378 ./scripts/cryptpasswd \
1379 ./raddb/dictionary \
1380 ./raddb/radrelay.conf \
1381 ./raddb/radiusd.conf