1 dnl #############################################################
3 dnl # For information about autoconf, see:
5 dnl # http://www.primate.wisc.edu/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 #############################################################
23 AC_INIT(src/main/radiusd.c)
24 AC_CONFIG_HEADER(src/include/autoconf.h)
25 AC_REVISION($Revision$)dnl
26 dnl AC_PREFIX_DEFAULT(/usr/local)
28 dnl #############################################################
30 dnl # 0. Checks for compiler, libtool, and command line options.
32 dnl #############################################################
36 AC_PROG_GCC_TRADITIONAL
42 AC_CHECK_PROG(GMAKE, gmake, yes, no)
43 if test $GMAKE = no; then
44 AC_PATH_PROG(MAKE, make, /usr/local/bin/make)
46 AC_PATH_PROG(MAKE, gmake, /usr/local/gnu/bin/make)
48 makever=`$ac_cv_path_MAKE --version 2>&1 | grep "GNU Make"`
49 if test -z "$makever"; then
50 AC_MSG_ERROR(GNU Make is not installed. Please download and install it
51 from ftp://prep.ai.mit.edu/pub/gnu/make/ before continuing.)
54 dnl ensure that we're looking for dlopen
57 dnl Figure out how to build shared libraries
60 dnl extra argument: --with-logdir
61 logdir='${localstatedir}/log'
62 AC_MSG_CHECKING(logdir)
64 [ --with-logdir=DIR Directory for logfiles [LOCALSTATEDIR/log] ],
67 AC_MSG_ERROR(Need logdir)
77 AC_MSG_RESULT($logdir)
79 dnl extra argument: --with-radacctdir
80 radacctdir='${logdir}/radacct'
81 AC_MSG_CHECKING(radacctdir)
82 AC_ARG_WITH(radacctdir,
83 [ --with-radacctdir=PATH Directory for detail files [LOGDIR/radacct] ],
86 AC_MSG_ERROR(Need radacctdir)
96 AC_MSG_RESULT($radacctdir)
98 dnl extra argument: --with-raddbdir
99 raddbdir='${sysconfdir}/raddb'
100 AC_MSG_CHECKING(raddbdir)
101 AC_ARG_WITH(raddbdir,
102 [ --with-raddbdir=DIR Directory for config files [SYSCONFDIR/raddb] ],
105 AC_MSG_ERROR(Need raddbdir)
115 AC_MSG_RESULT($raddbdir)
117 dnl extra argument: --with-dbm
121 [ --with-dbm Compile in DBM support],
132 dnl extra argument: --with-ndbm
134 [ --with-ndbm Compile in NDBM support],
148 dnl extra argument: --with-ascend-hack
149 AC_ARG_WITH(ascend-hack,
150 [ --with-ascend-hack Include Ascend hacks],
155 AC_DEFINE(WITH_ASCEND_HACK)
156 dnl if they haven't said to use it, do so.
157 if test "${with_ascend_cpl+set}" != "set"; then
163 dnl extra argument: --with-ascend-cpl=N
164 AC_ARG_WITH(ascend-cpl,
165 [ --with-ascend-cpl=N Set Ascend Channels Per Line to N [23] ],
168 AC_DEFINE_UNQUOTED(ASCEND_CHANNELS_PER_LINE, $withval)
172 dnl extra argument: --with-ntdomain-hack
173 AC_ARG_WITH(ntdomain-hack,
174 [ --with-ntdomain-hack Include NT Domain hack],
179 AC_DEFINE(WITH_NTDOMAIN_HACK)
183 dnl extra argument: --with-spcj-hack
184 AC_ARG_WITH(spcj-hack,
185 [ --with-spcj-hack Include Specialix Jetstream hacks],
190 AC_DEFINE(WITH_SPECIALIX_JETSTREAM_HACK)
194 dnl extra argument: --with-dict-nocase
195 AC_ARG_WITH(dict-nocase,
196 [ --with-dict-nocase Make dictionary case-independant],
201 AC_DEFINE(WITH_DICT_NOCASE)
205 dnl extra argument: --with-attrib-nmc
207 AC_ARG_WITH(attrib-nmc,
208 [ --with-attrib-nmc Include USR-style vendor specific attributes (default=yes)],
209 [ ATTRIB_NMC=$withval
214 AC_DEFINE(ATTRIB_NMC)
217 dnl if they haven't said to use it, do so.
218 if test "$ATTRIB_NMC" = "";then
219 AC_DEFINE(ATTRIB_NMC)
222 dnl extra argument: --with-ascend-binary
224 AC_ARG_WITH(ascend-binary,
225 [ --with-ascend-binary Include support for Ascend binary filter attributes (default=yes)],
226 [ ASCEND_BINARY=$withval
231 AC_DEFINE(ASCEND_BINARY)
234 dnl if they haven't said to use it, do so.
235 if test "X$ASCEND_BINARY" = "X";then
236 AC_DEFINE(ASCEND_BINARY)
239 dnl extra argument: --with-threads
242 [ --with-threads Use threads, if available. (default=yes) ],
245 WITH_THREADS=$withval
249 dnl extra argument: --with-thread-pool
251 AC_ARG_WITH(thread-pool,
252 [ --with-thread-pool Use a pool of threads for high-load systems. (default=no) ],
255 WITH_THREAD_POOL=$withval
259 AC_ARG_ENABLE(ltdl-install,
260 [ --disable-ltdl-install do not install libltdl])
261 if test x"${enable_ltdl_install+set}" != xset; then
262 enable_ltdl_install=yes
263 ac_configure_args="$ac_configure_args --enable-ltdl-install"
265 AC_CONFIG_SUBDIRS(src/libltdl)
267 dnl See what include-style is used by the make program.
268 dnl AC_MSG_CHECKING(include style for make)
269 dnl echo "include /dev/null" > testmake.$$
270 dnl echo "all:" >> testmake.$$
271 dnl make -f testmake.$$ >/dev/null 2>&1
280 dnl rm -f testmake.$$
281 dnl AC_MSG_RESULT(" $INCLUDE")
282 dnl AC_SUBST(INCLUDE)
285 dnl #############################################################
287 dnl # 1. Checks for programs
289 dnl #############################################################
291 AC_PATH_PROG(PERL, perl, /usr/local/bin/perl)
292 if test ! -x $ac_cv_path_PERL; then
293 AC_MSG_ERROR(perl not found - fatal)
295 AC_PATH_PROG(SNMPGET, snmpget, /usr/local/bin/snmpget)
296 AC_PATH_PROG(SNMPWALK, snmpwalk, /usr/local/bin/snmpwalk)
297 AC_PATH_PROG(RUSERS, rusers, /usr/bin/rusers)
299 dnl FIXME This is truly gross.
300 missing_dir=`cd $ac_aux_dir && pwd`
301 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
302 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
303 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
306 dnl # check for AIX, to allow us to use some BSD functions
307 dnl # must be before macros that call the compiler.
311 dnl #############################################################
313 dnl # 2. Checks for libraries
315 dnl #############################################################
317 dnl If using pthreads, check for -lpthread (posix) or -lc_r (*BSD)
319 if test "$WITH_THREADS" = "yes"; then
320 AC_CHECK_HEADERS(pthread.h)
321 AC_CHECK_LIB(pthread, pthread_create,
322 PTHREADLIB="-lpthread"
324 if test "X$PTHREADLIB" = "X"; then
325 AC_CHECK_LIB(c_r, pthread_create,
329 LIBS="$LIBS $PTHREADLIB"
333 dnl # Checks to ensure that the thread pool code can build.
335 if test "$WITH_THREAD_POOL" = "yes"; then
337 dnl # If using thread pools, check that threading is enabled
339 if test "$WITH_THREADS" != "yes"; then
340 AC_MSG_ERROR(You must have threads enabled for thread pools to work.)
344 dnl # If using thread pools, check that we have thread libraries
346 if test "X$PTHREADLIB" = "X"; then
347 AC_MSG_ERROR(You must have threading libraries for thread pools to work.)
351 dnl # Check for sem_init all by itself
353 AC_CHECK_FUNC(sem_init)
354 if test "X$ac_cv_func_sem_init" = "Xno"; then
357 dnl # If not found, sem_init is in -lposix4 on Solaris
359 AC_CHECK_LIB(posix4, sem_init)
361 if test "X$ac_cv_lib_posix4_sem_init" = "X"; then
362 AC_MSG_WARN(You do not have posix semaphores. Disabling thread pools)
368 dnl # Finally, after all of the checks above, we see if
369 dnl # we can REALLY use the thread pools.
371 if test "$WITH_THREAD_POOL" = "yes"; then
372 AC_DEFINE(WITH_THREAD_POOL,1)
376 dnl Check if we need -lsocket
377 AC_CHECK_LIB(socket, getsockname)
379 dnl Check for -lresolv
380 dnl This library may be needed later.
381 AC_CHECK_LIB(resolv, inet_aton)
383 dnl Check if we need -lnsl. Usually if we want to
384 dnl link against -lsocket we need to include -lnsl as well.
385 AC_CHECK_LIB(nsl, inet_ntoa)
387 dnl #############################################################
389 dnl # 3. Checks for header files
391 dnl #############################################################
417 dnl #############################################################
419 dnl # 4. Checks for typedefs
421 dnl #############################################################
424 dnl # Ensure that these are defined
431 dnl Check for socklen_t
432 AC_CACHE_CHECK(for socklen_t,
435 AC_TRY_COMPILE([#include <sys/types.h>
436 #include <sys/socket.h>],
438 AC_DEFINE(HAVE_SOCKLEN_T) fr_cv_socklen_t=yes,
443 dnl Check for uint8_t
444 AC_CACHE_CHECK(for uint8_t,
448 #ifdef HAVE_INTTYPES_H
449 #include <inttypes.h>
461 if test "$fr_cv_uint8_t" != "yes"; then
462 AC_DEFINE(uint8_t, unsigned char)
465 dnl Check for uint32_t
466 AC_CACHE_CHECK(for uint32_t,
470 #ifdef HAVE_INTTYPES_H
471 #include <inttypes.h>
483 if test "$fr_cv_uint32_t" != "yes"; then
484 AC_DEFINE(uint32_t, unsigned int)
489 dnl # If we don't have uint32_t, then verify that sizeof(unsigned int)==4
490 dnl # If the integers are NOT 4 octets long, then the previous definition
491 dnl # won't work, and we won't produce correct RADIUS packets.
493 if test "x$UINT32_T_AS_INT" != "x"; then
494 AC_CHECK_SIZEOF(unsigned int, [4])
497 dnl #############################################################
499 dnl # 5. Checks for structures and functions
501 dnl #############################################################
518 RADIUSD_NEED_DECLARATIONS( \
531 dnl #############################################################
533 dnl # 6. Checks for compiler characteristics
535 dnl #############################################################
538 dnl # Ensure that these are defined
543 dnl # See if this is OS/2
545 AC_MSG_CHECKING(type of OS)
548 if test "$OS" = "OS/2"; then
556 dnl # Set Default CFLAGS
558 if test "$GCC" = "yes"; then
559 CFLAGS="$CFLAGS -Wall -D_GNU_SOURCE"
562 dnl #############################################################
564 dnl # 7. Checks for library functions
566 dnl #############################################################
568 dnl Check for libcrypt
569 dnl We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
570 AC_CHECK_LIB(crypt, crypt,
574 if test "$CRYPTLIB" != ""; then
575 AC_DEFINE(HAVE_CRYPT)
577 AC_CHECK_FUNC(crypt, AC_DEFINE(HAVE_CRYPT))
580 AC_SUBST(MODULE_LIBS)
581 AC_SUBST(MODULE_CFLAGS)
582 AC_SUBST(MODULE_LDFLAGS)
584 dnl #############################################################
586 dnl # 8. Checks for system services
588 dnl #############################################################
591 dnl # Figure out where libtool is located,
593 LIBTOOL="`pwd`/libtool"
596 dnl #############################################################
598 dnl # And finally, output the results.
600 dnl #############################################################
603 dnl # Substitute whatever libraries we found to be necessary
609 ./src/include/build-radpaths-h \
610 ./src/main/checkrad.pl \
613 ./scripts/rc.radiusd \
615 ./scripts/check-radiusd-config
618 AC_OUTPUT_COMMANDS([echo timestamp > src/include/stamp-h])
619 AC_OUTPUT_COMMANDS([(cd ./src/include && /bin/sh ./build-radpaths-h)])
620 AC_OUTPUT_COMMANDS([(cd ./src/main && chmod +x checkrad.pl radlast radtest)])
621 AC_OUTPUT_COMMANDS([(cd ./scripts && chmod +x rc.radiusd radwatch check-radiusd-config)])