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