c3b3bfb84c96a58c75a8bcae7c46287e4b32220d
[freeradius.git] / configure.in
1 dnl #############################################################
2 dnl #
3 dnl #  For information about autoconf, see:
4 dnl #
5 dnl #  http://www.gnu.org/software/autoconf/
6 dnl #  
7 dnl #  The recommended order is:
8 dnl #
9 dnl #  AC_INIT(file)
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...])
20 dnl #
21 dnl #############################################################
22
23 AC_INIT(src/main/radiusd.c)
24 AC_CONFIG_HEADER(src/include/autoconf.h)
25 AC_REVISION($Revision$)dnl
26
27 dnl # The version of the software
28 RADIUSD_MAJOR_VERSION=0
29 RADIUSD_MINOR_VERSION=7-pre
30 RADIUSD_VERSION="${RADIUSD_MAJOR_VERSION}.${RADIUSD_MINOR_VERSION}"
31
32 dnl #############################################################
33 dnl #
34 dnl #  0. Checks for compiler, libtool, and command line options.
35 dnl #
36 dnl #############################################################
37
38 dnl Check for GNU cc
39 AC_PROG_CC
40 AC_PROG_GCC_TRADITIONAL
41 AC_PROG_CC_SUNPRO
42 AC_PROG_RANLIB
43
44 PACKAGE=freeradius
45
46 dnl #
47 dnl # check for AIX, to allow us to use some BSD functions
48 dnl # must be before macros that call the compiler.
49 dnl #
50 AC_AIX
51
52 dnl Find GNU Make.
53 AC_CHECK_PROG(GMAKE, gmake, yes, no)
54 if test $GMAKE = no; then
55   AC_PATH_PROG(MAKE, make, /usr/local/bin/make)
56 else
57   AC_PATH_PROG(MAKE, gmake, /usr/local/gnu/bin/make)
58 fi
59 makever=`$ac_cv_path_MAKE --version 2>&1 | grep "GNU Make"`
60 if test -z "$makever"; then
61   AC_MSG_ERROR(GNU Make is not installed.  Please download and install it
62                 from ftp://prep.ai.mit.edu/pub/gnu/make/ before continuing.)
63 fi
64
65 dnl libltdl is installable
66 AC_LIBLTDL_INSTALLABLE
67
68 dnl ensure that we're looking for dlopen
69 AC_LIBTOOL_DLOPEN
70
71 dnl Figure out how to build shared libraries
72 AC_PROG_LIBTOOL
73
74 dnl Put this in later, when all distributed modules use autoconf.
75 dnl AC_ARG_WITH(disablemodulefoo,
76 dnl [  --without-rlm_foo       Disables module compilation.  Module list:]
77 dnl esyscmd([find src/modules -type d -name rlm_\* -print |\
78 dnl     sed -e 's%src/modules/.*/% (sub)- %; s%.*/%- %' |\
79 dnl     awk '{print "                            "$0}']))
80
81 AC_ARG_ENABLE(strict-dependencies,
82 [  --enable-strict-dependencies  Fail configure on lack of module dependancy.])
83
84 dnl extra argument: --with-logdir
85 logdir='${localstatedir}/log/radius'
86 AC_MSG_CHECKING(logdir)
87 AC_ARG_WITH(logdir,
88 [  --with-logdir=DIR       Directory for logfiles [LOCALSTATEDIR/log/radius] ],
89 [ case "$withval" in
90     no)
91         AC_MSG_ERROR(Need logdir)
92         ;;
93     yes)
94         ;;
95     *)
96         logdir="$withval"
97         ;;
98   esac ]
99 )
100 AC_SUBST(logdir)
101 AC_MSG_RESULT($logdir)
102
103 dnl extra argument: --with-radacctdir
104 radacctdir='${logdir}/radacct'
105 AC_MSG_CHECKING(radacctdir)
106 AC_ARG_WITH(radacctdir,
107 [  --with-radacctdir=PATH  Directory for detail files [LOGDIR/radacct] ],
108 [ case "$withval" in
109     no)
110         AC_MSG_ERROR(Need radacctdir)
111         ;;
112     yes)
113         ;;
114     *)
115         radacctdir="$withval"
116         ;;
117   esac ]
118 )
119 AC_SUBST(radacctdir)
120 AC_MSG_RESULT($radacctdir)
121
122 dnl extra argument: --with-raddbdir
123 raddbdir='${sysconfdir}/raddb'
124 AC_MSG_CHECKING(raddbdir)
125 AC_ARG_WITH(raddbdir,
126 [  --with-raddbdir=DIR     Directory for config files [SYSCONFDIR/raddb] ],
127 [ case "$withval" in
128     no)
129         AC_MSG_ERROR(Need raddbdir)
130         ;;
131     yes)
132         ;;
133     *)
134         raddbdir="$withval"
135         ;;
136   esac ]
137 )
138 AC_SUBST(raddbdir)
139 AC_MSG_RESULT($raddbdir)
140
141 dnl extra argument: --with-dict-nocase
142 WITH_DICT_NOCASE=yes
143 AC_ARG_WITH(dict-nocase,
144 [  --with-dict-nocase      Make dictionary case-independant (default=yes)],
145 [  case "$withval" in
146     yes)
147         ;;
148     *)
149         WITH_DICT_NOCASE=""
150   esac ]
151 )
152 if test "X$WITH_DICT_NOCASE" = "Xyes"; then
153   AC_DEFINE(WITH_DICT_NOCASE)
154 fi
155
156 dnl extra argument: --with-ascend-binary
157 ASCEND_BINARY=yes
158 AC_ARG_WITH(ascend-binary,
159 [  --with-ascend-binary    Include support for Ascend binary filter attributes (default=yes)],
160 [ case "$withval" in
161     yes)
162         ;;
163     *)
164         ASCEND_BINARY=""
165   esac ]
166 )
167 if test "X$ASCEND_BINARY" = "Xyes"; then
168   AC_DEFINE(ASCEND_BINARY)
169 fi
170
171 dnl extra argument: --with-threads
172 WITH_THREADS=yes
173 WITH_THREAD_POOL=yes
174 AC_ARG_WITH(threads,
175 [  --with-threads          Use threads, if available.  (default=yes) ],
176 [ case "$withval" in
177     yes)
178         ;;
179     *)
180         WITH_THREADS=""
181         WITH_THREAD_POOL=""
182   esac ]
183 )
184
185 dnl extra argument: --with-snmp
186 WITH_SNMP=yes
187 AC_ARG_WITH(snmp,
188 [  --with-snmp             Compile in SNMP support. (default=yes)],
189 [ case "$withval" in
190     yes)
191         ;;
192     *)
193         WITH_SNMP=no
194   esac ]
195 )
196
197 AC_ARG_ENABLE(ltdl-install,
198 [  --disable-ltdl-install  do not install libltdl])
199 if test x"${enable_ltdl_install+set}" != xset; then
200   enable_ltdl_install=yes
201   ac_configure_args="$ac_configure_args --enable-ltdl-install"
202 fi
203 AC_CONFIG_SUBDIRS(libltdl)
204
205 dnl #
206 dnl #  Allow the user to specify a list of modules to be linked
207 dnl #  statically to the server.
208 dnl #
209 STATIC_MODULES=
210 AC_ARG_WITH(static_modules,
211 [  --with-static-modules=QUOTED-MODULE-LIST],[
212   for i in $withval; do
213     STATIC_MODULES="$STATIC_MODULES -dlpreopen ../modules/rlm_$i/rlm_$i.la"
214   done
215 ])
216
217 dnl #
218 dnl #  Enable developer C compiler warnings
219 dnl #
220 AC_ARG_ENABLE(developer,
221 [  --enable-developer               Enables features of interest to developers.],
222 [ case "$withval" in
223     *)
224         developer=no
225         ;;
226     yes)
227         developer=yes
228   esac ]
229 )
230
231 if test "x$developer" != "xno" -a -d $srcdir/CVS; then
232   dnl turn on the developer flag when taken from a CVS checkout (not a release)
233   developer="yes"
234 fi
235
236 dnl extra argument: --with-experimental-modules
237 EXPERIMENTAL=
238 AC_ARG_WITH(experimental-modules,
239 [  --with-experimental-modules      Use experimental and unstable modules. (default=no) ],
240 [ case "$withval" in
241     yes)
242         EXPERIMENTAL=yes
243         ;;
244     *)
245   esac ]
246 )
247
248 dnl #
249 dnl #  These next two arguments don't actually do anything.  They're
250 dnl #  place holders so that the top-level configure script can tell
251 dnl #  the user how to configure lower-level modules
252 dnl #
253
254 dnl #
255 dnl # extra argument: --with-rlm-FOO-lib-dir
256 dnl #
257 AC_ARG_WITH(rlm-FOO-lib-dir,
258 [  --with-rlm-FOO-lib-dir=DIR       Directory to look for library files used by module FOO],
259 [ case "$withval" in
260     *)
261         ;;
262   esac ]
263 )
264
265 dnl #
266 dnl # extra argument: --with-rlm-FOO-include-dir
267 dnl #
268 AC_ARG_WITH(rlm-FOO-include-dir,
269 [  --with-rlm-FOO-include-dir=DIR   Directory to look for include files used by module FOO],
270 [ case "$withval" in
271     *)
272         ;;
273   esac ]
274 )
275
276 dnl See what include-style is used by the make program.
277 dnl AC_MSG_CHECKING(include style for make)
278 dnl echo "include /dev/null" > testmake.$$
279 dnl echo "all:" >> testmake.$$
280 dnl make -f testmake.$$ >/dev/null 2>&1
281 dnl if test $? = 0
282 dnl then
283 dnl     INCLUDE=include
284 dnl     IQUOTE=
285 dnl else
286 dnl     INCLUDE=.include
287 dnl     IQUOTE='"'
288 dnl fi
289 dnl rm -f testmake.$$
290 dnl AC_MSG_RESULT(" $INCLUDE")
291 dnl AC_SUBST(INCLUDE)
292 dnl AC_SUBST(IQUOTE)
293
294 dnl #############################################################
295 dnl #
296 dnl #  1. Checks for programs
297 dnl #
298 dnl #############################################################
299
300 CHECKRAD=checkrad.pl
301 AC_PATH_PROG(PERL, perl, /usr/local/bin/perl)
302 if test "x$ac_cv_path_PERL" = "x"; then
303   AC_MSG_WARN(perl not found - Simultaneous-Use and checkrad.pl may not work)
304 fi
305 AC_PATH_PROG(SNMPGET, snmpget)
306 if test "x$ac_cv_path_SNMPGET" = "x"; then
307   AC_MSG_WARN(snmpget not found - Simultaneous-Use and checkrad.pl may not work)
308 fi
309
310 AC_PATH_PROG(SNMPWALK, snmpwalk)
311 if test "x$ac_cv_path_SNMPWALK" = "x"; then
312   AC_MSG_WARN(snmpwalk not found - Simultaneous-Use and checkrad.pl may not work)
313 fi
314
315 AC_PATH_PROG(RUSERS, rusers, /usr/bin/rusers)
316
317 dnl FIXME This is truly gross.
318 missing_dir=`cd $ac_aux_dir && pwd`
319 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
320 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
321 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
322
323 AC_PATH_PROG(LOCATE,locate)
324 AC_PATH_PROG(DIRNAME,dirname)
325 AC_PATH_PROG(GREP,grep)
326
327 dnl #############################################################
328 dnl #
329 dnl #  2. Checks for libraries
330 dnl #
331 dnl #############################################################
332
333 dnl If using pthreads, check for -lpthread (posix) or -lc_r (*BSD)
334 PTHREADLIB=
335 if test "$WITH_THREADS" = "yes"; then 
336   if test $ac_cv_prog_suncc = "yes"; then
337     CFLAGS="$CFLAGS -mt"
338   fi
339
340   AC_CHECK_HEADERS(pthread.h)
341
342   if test "X$ac_cv_header_pthread_h" = "X"; then
343     AC_MSG_ERROR("You are trying to use threads without a POSIX <pthread.h>")
344   fi
345
346   dnl #
347   dnl #  If pthread_create is in the standard libs (e.g. libc),
348   dnl #  then don't do anything magical.
349   dnl #
350   AC_CHECK_FUNC(pthread_join, PTHREADLIB=" ")
351
352 dnl # 
353 dnl # pthread stuff is usually in -lpthread
354 dnl # 
355   AC_CHECK_LIB(pthread, pthread_join,
356     PTHREADLIB="-lpthread"
357   )
358
359 dnl # HP/UX requires linking with librt, too, to get the sem_* symbols.  :\
360
361   AC_SEARCH_LIBS(sem_init, pthread rt,
362         [ 
363         dnl    Er, this usage of $ac_cv_search_sem_init may be unfounded 
364         dnl    chumminess with the autoconf internals.  -chad
365         dnl PTHREADLIB="$PTHREADLIB $ac_cv_search_sem_init"
366         ],
367         [],
368         "-lpthread"
369   )
370
371 dnl # 
372 dnl # Except for *BSD, where it's in -lc_r,
373 dnl # and where we've got to add extra CFLAGS.
374 dnl # 
375   if test "X$PTHREADLIB" = "X"; then
376     SAVED_CFLAGS=$CFLAGS
377     CFLAGS="$CFLAGS -pthread -D_THREAD_SAFE"
378     AC_CHECK_LIB(c_r, pthread_create,
379       PTHREADLIB="-lc_r"
380     )
381   fi
382
383 dnl # Set libs, etc, if we have them.
384   if test "x$PTHREADLIB" != "x"; then
385     LIBS="$LIBS $PTHREADLIB"
386     CFLAGS="$CFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS"
387   fi
388 fi
389
390 dnl # 
391 dnl # If we have NO pthread libraries, remove any knowledge of threads.
392 dnl # 
393 if test "x$PTHREADLIB" = "x"; then
394   CFLAGS=$SAVED_CFLAGS
395   ac_cv_header_pthread_h="no"
396   WITH_THREADS=no
397   WITH_THREAD_POOL=no
398 fi
399
400 dnl Check if we need -lsocket
401 AC_CHECK_LIB(socket, getsockname)
402
403 dnl Check for -lresolv
404 dnl This library may be needed later.
405 AC_CHECK_LIB(resolv, inet_aton)
406
407 dnl Check if we need -lnsl. Usually if we want to
408 dnl link against -lsocket we need to include -lnsl as well.
409 AC_CHECK_LIB(nsl, inet_ntoa)
410
411 dnl #############################################################
412 dnl #
413 dnl #  3. Checks for header files
414 dnl #
415 dnl #############################################################
416
417 AC_HEADER_DIRENT
418 AC_HEADER_STDC
419 AC_HEADER_TIME
420 AC_HEADER_SYS_WAIT
421
422 AC_CHECK_HEADERS( \
423         unistd.h \
424         crypt.h \
425         errno.h \
426         resource.h \
427         getopt.h \
428         malloc.h \
429         utmp.h \
430         utmpx.h \
431         signal.h \
432         sys/select.h \
433         syslog.h \
434         inttypes.h \
435         stdint.h \
436         stdio.h \
437         netdb.h \
438         semaphore.h \
439         arpa/inet.h \
440         netinet/in.h \
441         sys/types.h \
442         sys/socket.h \
443         sys/time.h \
444         sys/wait.h \
445         sys/security.h \
446         prot.h \
447         sia.h \
448         siad.h
449 )
450
451 REGEX=no
452 AC_CHECK_HEADER(regex.h, AC_DEFINE(HAVE_REGEX_H))
453 if test "x$ac_cv_header_regex_h" = "xyes"; then
454   REGEX_EXTENDED=no
455   REGEX=yes
456   AC_EGREP_CPP(yes,
457     [#include <regex.h>
458      #ifdef REG_EXTENDED
459        yes
460      #endif
461      ], [AC_DEFINE(HAVE_REG_EXTENDED) REGEX_EXTENDED=yes])
462 fi
463 AC_SUBST(REGEX)
464 AC_SUBST(REGEX_EXTENDED)
465
466 dnl #
467 dnl #  other checks which require headers
468 dnl #
469 if test "x$ac_cv_header_sys_security_h" = "xyes" && test "x$ac_cv_header_prot_h" = "xyes"
470 then
471   AC_DEFINE(OSFC2)
472 fi
473
474 if test "x$ac_cv_header_sia_h" = "xyes" && test "x$ac_cv_header_siad_h" = "xyes"
475 then
476   AC_DEFINE(OSFSIA)
477 fi
478
479
480 dnl #############################################################
481 dnl #
482 dnl #  4. Checks for typedefs
483 dnl #
484 dnl #############################################################
485
486 dnl #
487 dnl # Ensure that these are defined
488 dnl #
489 AC_TYPE_OFF_T 
490 AC_TYPE_PID_T
491 AC_TYPE_SIZE_T
492 AC_TYPE_UID_T
493
494 dnl check for socklen_t
495 AC_CHECK_TYPE_INCLUDE([
496 #ifdef HAVE_SYS_TYPES_H
497 #include <sys/types.h>
498 #endif
499 #ifdef HAVE_SYS_SOCKET_H
500 #include <sys/socket.h>
501 #endif
502 ],socklen_t, int)
503
504 dnl check for uint8_t
505 AC_CHECK_TYPE_INCLUDE([
506 #ifdef HAVE_INTTYPES_H
507 #include <inttypes.h>
508 #endif
509 #ifdef HAVE_STDINT_H
510 #include <stdint.h>
511 #endif
512 ],uint8_t, unsigned char)
513
514 dnl check for uint16_t
515 AC_CHECK_TYPE_INCLUDE([
516 #ifdef HAVE_INTTYPES_H
517 #include <inttypes.h>
518 #endif
519 #ifdef HAVE_STDINT_H
520 #include <stdint.h>
521 #endif
522 ],uint16_t, unsigned short)
523
524 dnl check for uint32_t
525 AC_CHECK_TYPE_INCLUDE([
526 #ifdef HAVE_INTTYPES_H
527 #include <inttypes.h>
528 #endif
529 #ifdef HAVE_STDINT_H
530 #include <stdint.h>
531 #endif
532 ],uint32_t, unsigned int)
533
534 dnl #############################################################
535 dnl #
536 dnl #  5. Checks for structures and functions
537 dnl #
538 dnl #############################################################
539 AC_CHECK_FUNCS( \
540         getopt_long \
541         lockf \
542         strsignal \
543         sigaction \
544         sigprocmask \
545         pthread_sigmask \
546         snprintf \
547         vsnprintf \
548         setsid \
549         strncasecmp \
550         strcasecmp \
551         localtime_r \
552         ctime_r \
553         gmtime_r \
554         strsep \
555         inet_aton \
556         gethostname \
557         setlinebuf \
558         setvbuf \
559         sem_init \
560         getusershell
561 )
562 RADIUSD_NEED_DECLARATIONS( \
563         crypt \
564         strncasecmp \
565         strcasecmp \
566         inet_aton \
567         gethostname \
568         setlinebuf \
569         getusershell \
570         endusershell
571 )
572
573 AC_TYPE_SIGNAL
574
575 dnl # check if we have utmpx.h
576 dnl # if so, check if struct utmpx has entry ut_xtime
577 dnl # if not, set it to define ut_xtime == ut_tv.tv_sec
578 if test "x$ac_cv_header_utmpx_h" = "xyes"
579 then
580  AC_CHECK_STRUCT_HAS_MEMBER([#include <utmpx.h>], [struct utmpx], ut_xtime)
581  if test "x$ac_cv_type_struct_utmpx_ut_xtime" = "x"
582  then
583    AC_DEFINE(ut_xtime,ut_tv.tv_sec)
584  fi
585 fi
586
587 dnl #############################################################
588 dnl #
589 dnl #  6. Checks for compiler characteristics
590 dnl #
591 dnl #############################################################
592
593 dnl #
594 dnl # Ensure that these are defined
595 dnl #
596 AC_C_CONST 
597
598 dnl #
599 dnl # See if this is OS/2
600 dnl #
601 AC_MSG_CHECKING(type of OS)
602 OS=`uname -s`
603 AC_MSG_RESULT($OS)
604 if test "$OS" = "OS/2"; then
605         LIBPREFIX=
606 else
607         LIBPREFIX=lib
608 fi
609 AC_SUBST(LIBPREFIX)
610
611 dnl #
612 dnl # Set Default CFLAGS
613 dnl #
614 if test "x$GCC" = "xyes"; then
615     CFLAGS="$CFLAGS -Wall -D_GNU_SOURCE"
616 fi
617
618 AC_MSG_CHECKING(for developer gcc flags)
619 if test "x$developer" = "xyes" -a "x$GCC" = "xyes"; then
620   devflags="-g -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs"
621   CFLAGS="$CFLAGS $devflags"
622   INSTALLSTRIP=""
623   AC_MSG_RESULT(yes.  Using $devflags)
624 else
625   devflags=""
626   CFLAGS="$CFLAGS -DNDEBUG"
627   INSTALLSTRIP="-s"
628   AC_MSG_RESULT(no.)
629 fi
630
631 dnl #############################################################
632 dnl #
633 dnl #  7. Checks for library functions
634 dnl #
635 dnl #############################################################
636
637 dnl Check for libcrypt
638 dnl We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
639 AC_CHECK_LIB(crypt, crypt,
640   CRYPTLIB="-lcrypt"
641 )
642 if test "$CRYPTLIB" != ""; then
643   AC_DEFINE(HAVE_CRYPT)
644 else
645   AC_CHECK_FUNC(crypt, AC_DEFINE(HAVE_CRYPT))
646 fi
647
648 dnl Check for libcipher
649 AC_CHECK_LIB(cipher, setkey,
650    CRYPTLIB="${CRYPTLIB} -lcipher"
651 )
652 AC_SUBST(CRYPTLIB)
653
654 if test "x$WITH_SNMP" = "xyes"; then
655   SNMP_CHECKS
656 fi
657
658 dnl #
659 dnl #  Check for sem_init all by itself
660 dnl #
661 if test "X$ac_cv_func_sem_init" = "Xno"; then
662
663 dnl #
664 dnl #  If not found, sem_init is in -lposix4 on Solaris
665 dnl #
666  AC_CHECK_LIB(posix4, sem_init)
667
668   if test "X$ac_cv_lib_posix4_sem_init" = "X"; then
669     if test "$WITH_THREAD_POOL" = "yes"; then
670       AC_MSG_WARN(You do not have posix semaphores.  Disabling thread pools)
671     fi
672     WITH_THREAD_POOL=no
673   fi
674 fi
675
676
677 gethostbyaddrrstyle=""
678 AC_MSG_CHECKING([gethostbyaddr_r() syntax])
679 AC_TRY_COMPILE([#include <netdb.h>], [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL) ] , [
680         AC_DEFINE(GETHOSTBYADDRRSTYLE, SYSVSTYLE)
681         gethostbyaddrrstyle=SYSV
682 ])
683 AC_TRY_COMPILE([#include <netdb.h>], [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL, NULL) ], [
684         AC_DEFINE(GETHOSTBYADDRRSTYLE, GNUSTYLE)
685         gethostbyaddrrstyle=GNU
686 ])
687
688 AC_TRY_COMPILE([#include <netdb.h>], [ gethostbyaddr(NULL, 0, 0)  ], [
689         AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE)
690         gethostbyaddrrstyle=BSD
691 ])
692
693 if test "x$gethostbyaddrrstyle" = "x"; then
694         AC_MSG_RESULT([none!  It must not exist, here.])
695 else
696         AC_MSG_RESULT([${gethostbyaddrrstyle}-style])
697 fi
698
699
700 dnl #############################################################
701 dnl #
702 dnl #  8. Checks for system services
703 dnl #
704 dnl #############################################################
705
706 dnl #
707 dnl # Figure out where libtool is located,
708 dnl #
709 LIBTOOL="`pwd`/libtool"
710 AC_SUBST(LIBTOOL)
711 AC_SUBST(LIBLTDL)
712 AC_SUBST(INCLTDL)
713 top_builddir=`pwd`
714 AC_SUBST(top_builddir)
715
716 dnl #
717 dnl #  Work around stupid autoconf crap
718 dnl #
719 if test "x$INCLTDL" != "x";then
720   INCLTDL='-I${top_builddir}/''libltdl'
721 fi
722
723 dnl import libtool stuff
724
725 dnl #
726 dnl #  Checks to ensure that the thread pool code can build.
727 dnl #
728 if test "$WITH_THREAD_POOL" = "yes"; then
729   dnl #
730   dnl # If using thread pools, check that threading is enabled
731   dnl #
732   if test "$WITH_THREADS" != "yes"; then
733     AC_MSG_ERROR(You must have threads enabled for thread pools to work.)
734   fi
735
736   dnl #
737   dnl # If using thread pools, check that we have thread libraries
738   dnl #
739   if test "X$PTHREADLIB" = "X"; then
740     AC_MSG_ERROR(You must have threading libraries for thread pools to work.)
741   fi
742
743 fi
744
745 dnl #############################################################
746 dnl #
747 dnl #  Configure in any module directories.
748 dnl #
749 dnl #############################################################
750
751 mysubdirs=
752 if test "x$EXPERIMENTAL" = "xyes"; then
753   for foo in `find src/modules -name configure -print`; do
754     bar=`echo $foo | sed 's%/configure$%%g'`
755     mysubdirs="$mysubdirs $bar"
756   done
757 else
758    dnl # 
759    dnl # Find 'configure' in ONLY the stable modules
760    dnl # 
761    for foo in `find \`cat src/modules/stable | sed 's%rlm%src/modules/rlm%g'\` -name configure -print`; do
762     bar=`echo $foo | sed 's%/configure$%%g'`
763     mysubdirs="$mysubdirs $bar"
764   done
765 fi
766
767 dnl ############################################################
768 dnl # make modules by list
769 dnl #############################################################
770 MODULES=
771 if test "x$EXPERIMENTAL" = "xyes"; then
772   for foo in `ls src/modules | grep rlm_`; do
773     MODULES="$MODULES $foo"
774   done
775 else
776    dnl #
777    dnl # make ONLY the stable modules
778    dnl #
779    for foo in `cat src/modules/stable`; do
780     MODULES="$MODULES $foo"
781    done
782 fi
783
784 dnl #
785 dnl #  Don't change the variable name here.  Autoconf goes bonkers
786 dnl #  if you do.
787 dnl #
788 AC_CONFIG_SUBDIRS($mysubdirs)
789 AC_SUBST(MODULES)
790
791 dnl #############################################################
792 dnl #
793 dnl #  And finally, output the results.
794 dnl #
795 dnl #############################################################
796
797 dnl #
798 dnl #  Substitute whatever libraries we found to be necessary
799 dnl #
800 AC_SUBST(LIBS)
801 AC_SUBST(INSTALLSTRIP)
802
803 USE_SHARED_LIBS=$enable_shared
804 AC_SUBST(USE_SHARED_LIBS)
805 USE_STATIC_LIBS=$enable_static
806 AC_SUBST(USE_STATIC_LIBS)
807 AC_SUBST(STATIC_MODULES)
808 AC_SUBST(RADIUSD_MAJOR_VERSION)
809 AC_SUBST(RADIUSD_MINOR_VERSION)
810 AC_SUBST(RADIUSD_VERSION)
811 export CFLAGS LIBS
812
813 AC_OUTPUT(\
814         ./Make.inc \
815         ./src/include/build-radpaths-h \
816         ./src/main/Makefile \
817         ./src/main/checkrad.pl \
818         ./src/main/radlast \
819         ./src/main/radtest \
820         ./scripts/rc.radiusd \
821         ./scripts/radwatch \
822         ./scripts/check-radiusd-config \
823         ./scripts/radiusd.cron.daily \
824         ./scripts/radiusd.cron.monthly \
825         ./scripts/cryptpasswd \
826         ./raddb/radiusd.conf
827 )
828
829 AC_OUTPUT_COMMANDS([echo timestamp > src/include/stamp-h])
830 AC_OUTPUT_COMMANDS([(cd ./src/include && /bin/sh ./build-radpaths-h)])
831 AC_OUTPUT_COMMANDS([(cd ./src/main   && chmod +x checkrad.pl radlast radtest)])
832 AC_OUTPUT_COMMANDS([(cd ./scripts    && chmod +x rc.radiusd radwatch check-radiusd-config radiusd.cron.daily radiusd.cron.monthly cryptpasswd)])
833 AC_OUTPUT_COMMANDS([
834 cat >> src/include/autoconf.h <<EOF
835
836 #define HOSTINFO        "$host"
837 #define RADIUSD_VERSION "$RADIUSD_VERSION"
838 EOF
839 ],host=$host)