Define top_srcdir, too, for new libtool.
[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 #
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; 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
307 if test ! -x $ac_cv_path_SNMPGET; then
308   AC_MSG_WARN(snmpget not found - Simultaneous-Use and checkrad.pl may not work)
309 fi
310
311 AC_PATH_PROG(SNMPWALK, snmpwalk)
312 if test ! -x $ac_cv_path_SNMPWALK; then
313   AC_MSG_WARN(snmpwalk not found - Simultaneous-Use and checkrad.pl may not work)
314 fi
315
316 AC_PATH_PROG(RUSERS, rusers, /usr/bin/rusers)
317
318 dnl FIXME This is truly gross.
319 missing_dir=`cd $ac_aux_dir && pwd`
320 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
321 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
322 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
323
324 AC_PATH_PROG(LOCATE,locate)
325 AC_PATH_PROG(DIRNAME,dirname)
326 AC_PATH_PROG(GREP,grep)
327
328 dnl #############################################################
329 dnl #
330 dnl #  2. Checks for libraries
331 dnl #
332 dnl #############################################################
333
334 dnl If using pthreads, check for -lpthread (posix) or -lc_r (*BSD)
335 PTHREADLIB=
336 if test "$WITH_THREADS" = "yes"; then 
337   if test $ac_cv_prog_suncc = "yes"; then
338     CFLAGS="$CFLAGS -mt"
339   fi
340
341   AC_CHECK_HEADERS(pthread.h)
342
343   if test "X$ac_cv_header_pthread_h" = "X"; then
344     AC_MSG_ERROR("You are trying to use threads without a POSIX <pthread.h>")
345   fi
346
347   dnl #
348   dnl #  If pthread_create is in the standard libs (e.g. libc),
349   dnl #  then don't do anything magical.
350   dnl #
351   AC_CHECK_FUNC(pthread_join, PTHREADLIB=" ")
352
353 dnl # 
354 dnl # pthread stuff is usually in -lpthread
355 dnl # 
356   AC_CHECK_LIB(pthread, pthread_join,
357     PTHREADLIB="-lpthread"
358   )
359
360 dnl # HP/UX requires linking with librt, too, to get the sem_* symbols.  :\
361
362   AC_SEARCH_LIBS(sem_init, pthread rt,
363         [ 
364         dnl    Er, this usage of $ac_cv_search_sem_init may be unfounded 
365         dnl    chumminess with the autoconf internals.  -chad
366         dnl PTHREADLIB="$PTHREADLIB $ac_cv_search_sem_init"
367         ],
368         [],
369         "-lpthread"
370   )
371
372 dnl # 
373 dnl # Except for *BSD, where it's in -lc_r,
374 dnl # and where we've got to add extra CFLAGS.
375 dnl # 
376   if test "X$PTHREADLIB" = "X"; then
377     SAVED_CFLAGS=$CFLAGS
378     CFLAGS="$CFLAGS -pthread -D_THREAD_SAFE"
379     AC_CHECK_LIB(c_r, pthread_create,
380       PTHREADLIB="-lc_r"
381     )
382   fi
383
384 dnl # Set libs, etc, if we have them.
385   if test "x$PTHREADLIB" != "x"; then
386     LIBS="$LIBS $PTHREADLIB"
387     CFLAGS="$CFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS"
388   fi
389 fi
390
391 dnl # 
392 dnl # If we have NO pthread libraries, remove any knowledge of threads.
393 dnl # 
394 if test "x$PTHREADLIB" = "x"; then
395   CFLAGS=$SAVED_CFLAGS
396   ac_cv_header_pthread_h="no"
397   WITH_THREADS=no
398   WITH_THREAD_POOL=no
399 fi
400
401 dnl Check if we need -lsocket
402 AC_CHECK_LIB(socket, getsockname)
403
404 dnl Check for -lresolv
405 dnl This library may be needed later.
406 AC_CHECK_LIB(resolv, inet_aton)
407
408 dnl Check if we need -lnsl. Usually if we want to
409 dnl link against -lsocket we need to include -lnsl as well.
410 AC_CHECK_LIB(nsl, inet_ntoa)
411
412 dnl #############################################################
413 dnl #
414 dnl #  3. Checks for header files
415 dnl #
416 dnl #############################################################
417
418 AC_HEADER_DIRENT
419 AC_HEADER_STDC
420 AC_HEADER_TIME
421 AC_HEADER_SYS_WAIT
422
423 AC_CHECK_HEADERS( \
424         unistd.h \
425         crypt.h \
426         errno.h \
427         resource.h \
428         getopt.h \
429         malloc.h \
430         utmp.h \
431         utmpx.h \
432         signal.h \
433         sys/select.h \
434         syslog.h \
435         inttypes.h \
436         stdint.h \
437         stdio.h \
438         netdb.h \
439         semaphore.h \
440         arpa/inet.h \
441         netinet/in.h \
442         sys/types.h \
443         sys/socket.h \
444         sys/time.h \
445         sys/wait.h \
446         sys/security.h \
447         prot.h \
448         sia.h \
449         siad.h
450 )
451
452 REGEX=no
453 AC_CHECK_HEADER(regex.h, AC_DEFINE(HAVE_REGEX_H))
454 if test "x$ac_cv_header_regex_h" = "xyes"; then
455   REGEX_EXTENDED=no
456   REGEX=yes
457   AC_EGREP_CPP(yes,
458     [#include <regex.h>
459      #ifdef REG_EXTENDED
460        yes
461      #endif
462      ], [AC_DEFINE(HAVE_REG_EXTENDED) REGEX_EXTENDED=yes])
463 fi
464 AC_SUBST(REGEX)
465 AC_SUBST(REGEX_EXTENDED)
466
467 dnl #
468 dnl #  other checks which require headers
469 dnl #
470 if test "x$ac_cv_header_sys_security_h" = "xyes" && test "x$ac_cv_header_prot_h" = "xyes"
471 then
472   AC_DEFINE(OSFC2)
473 fi
474
475 if test "x$ac_cv_header_sia_h" = "xyes" && test "x$ac_cv_header_siad_h" = "xyes"
476 then
477   AC_DEFINE(OSFSIA)
478 fi
479
480
481 dnl #############################################################
482 dnl #
483 dnl #  4. Checks for typedefs
484 dnl #
485 dnl #############################################################
486
487 dnl #
488 dnl # Ensure that these are defined
489 dnl #
490 AC_TYPE_OFF_T 
491 AC_TYPE_PID_T
492 AC_TYPE_SIZE_T
493 AC_TYPE_UID_T
494
495 dnl check for socklen_t
496 AC_CHECK_TYPE_INCLUDE([
497 #ifdef HAVE_SYS_TYPES_H
498 #include <sys/types.h>
499 #endif
500 #ifdef HAVE_SYS_SOCKET_H
501 #include <sys/socket.h>
502 #endif
503 ],socklen_t, int)
504
505 dnl check for uint8_t
506 AC_CHECK_TYPE_INCLUDE([
507 #ifdef HAVE_INTTYPES_H
508 #include <inttypes.h>
509 #endif
510 #ifdef HAVE_STDINT_H
511 #include <stdint.h>
512 #endif
513 ],uint8_t, unsigned char)
514
515 dnl check for uint16_t
516 AC_CHECK_TYPE_INCLUDE([
517 #ifdef HAVE_INTTYPES_H
518 #include <inttypes.h>
519 #endif
520 #ifdef HAVE_STDINT_H
521 #include <stdint.h>
522 #endif
523 ],uint16_t, unsigned short)
524
525 dnl check for uint32_t
526 AC_CHECK_TYPE_INCLUDE([
527 #ifdef HAVE_INTTYPES_H
528 #include <inttypes.h>
529 #endif
530 #ifdef HAVE_STDINT_H
531 #include <stdint.h>
532 #endif
533 ],uint32_t, unsigned int)
534
535 dnl #############################################################
536 dnl #
537 dnl #  5. Checks for structures and functions
538 dnl #
539 dnl #############################################################
540 AC_CHECK_FUNCS( \
541         getopt_long \
542         lockf \
543         strsignal \
544         sigaction \
545         sigprocmask \
546         pthread_sigmask \
547         snprintf \
548         vsnprintf \
549         setsid \
550         strncasecmp \
551         strcasecmp \
552         localtime_r \
553         ctime_r \
554         gmtime_r \
555         strsep \
556         inet_aton \
557         gethostname \
558         setlinebuf \
559         setvbuf \
560         sem_init \
561         getusershell
562 )
563 RADIUSD_NEED_DECLARATIONS( \
564         crypt \
565         strncasecmp \
566         strcasecmp \
567         inet_aton \
568         gethostname \
569         setlinebuf \
570         getusershell \
571         endusershell
572 )
573
574 AC_TYPE_SIGNAL
575
576 dnl # check if we have utmpx.h
577 dnl # if so, check if struct utmpx has entry ut_xtime
578 dnl # if not, set it to define ut_xtime == ut_tv.tv_sec
579 if test "x$ac_cv_header_utmpx_h" = "xyes"
580 then
581  AC_CHECK_STRUCT_HAS_MEMBER([#include <utmpx.h>], [struct utmpx], ut_xtime)
582  if test "x$ac_cv_type_struct_utmpx_ut_xtime" = "x"
583  then
584    AC_DEFINE(ut_xtime,ut_tv.tv_sec)
585  fi
586 fi
587
588 dnl #############################################################
589 dnl #
590 dnl #  6. Checks for compiler characteristics
591 dnl #
592 dnl #############################################################
593
594 dnl #
595 dnl # Ensure that these are defined
596 dnl #
597 AC_C_CONST 
598
599 dnl #
600 dnl # See if this is OS/2
601 dnl #
602 AC_MSG_CHECKING(type of OS)
603 OS=`uname -s`
604 AC_MSG_RESULT($OS)
605 if test "$OS" = "OS/2"; then
606         LIBPREFIX=
607 else
608         LIBPREFIX=lib
609 fi
610 AC_SUBST(LIBPREFIX)
611
612 dnl #
613 dnl # Set Default CFLAGS
614 dnl #
615 if test "x$GCC" = "xyes"; then
616     CFLAGS="$CFLAGS -Wall -D_GNU_SOURCE"
617 fi
618
619 AC_MSG_CHECKING(for developer gcc flags)
620 if test "x$developer" = "xyes" -a "x$GCC" = "xyes"; then
621   devflags="-g -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs"
622   CFLAGS="$CFLAGS $devflags"
623   INSTALLSTRIP=""
624   AC_MSG_RESULT(yes.  Using $devflags)
625 else
626   devflags=""
627   CFLAGS="$CFLAGS -DNDEBUG"
628   INSTALLSTRIP="-s"
629   AC_MSG_RESULT(no.)
630 fi
631
632 dnl #############################################################
633 dnl #
634 dnl #  7. Checks for library functions
635 dnl #
636 dnl #############################################################
637
638 dnl Check for libcrypt
639 dnl We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
640 AC_CHECK_LIB(crypt, crypt,
641   CRYPTLIB="-lcrypt"
642 )
643 if test "$CRYPTLIB" != ""; then
644   AC_DEFINE(HAVE_CRYPT)
645 else
646   AC_CHECK_FUNC(crypt, AC_DEFINE(HAVE_CRYPT))
647 fi
648
649 dnl Check for libcipher
650 AC_CHECK_LIB(cipher, setkey,
651    CRYPTLIB="${CRYPTLIB} -lcipher"
652 )
653 AC_SUBST(CRYPTLIB)
654
655 if test "x$WITH_SNMP" = "xyes"; then
656   SNMP_CHECKS
657 fi
658
659 dnl #
660 dnl #  Check for sem_init all by itself
661 dnl #
662 if test "X$ac_cv_func_sem_init" = "Xno"; then
663
664 dnl #
665 dnl #  If not found, sem_init is in -lposix4 on Solaris
666 dnl #
667  AC_CHECK_LIB(posix4, sem_init)
668
669   if test "X$ac_cv_lib_posix4_sem_init" = "X"; then
670     if test "$WITH_THREAD_POOL" = "yes"; then
671       AC_MSG_WARN(You do not have posix semaphores.  Disabling thread pools)
672     fi
673     WITH_THREAD_POOL=no
674   fi
675 fi
676
677
678 gethostbyaddrrstyle=""
679 AC_MSG_CHECKING([gethostbyaddr_r() syntax])
680 AC_TRY_COMPILE([#include <netdb.h>], [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL) ] , [
681         AC_DEFINE(GETHOSTBYADDRRSTYLE, SYSVSTYLE)
682         gethostbyaddrrstyle=SYSV
683 ])
684 AC_TRY_COMPILE([#include <netdb.h>], [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL, NULL) ], [
685         AC_DEFINE(GETHOSTBYADDRRSTYLE, GNUSTYLE)
686         gethostbyaddrrstyle=GNU
687 ])
688
689 AC_TRY_COMPILE([#include <netdb.h>], [ gethostbyaddr(NULL, 0, 0)  ], [
690         AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE)
691         gethostbyaddrrstyle=BSD
692 ])
693
694 if test "x$gethostbyaddrrstyle" = "x"; then
695         AC_MSG_RESULT([none!  It must not exist, here.])
696 else
697         AC_MSG_RESULT([${gethostbyaddrrstyle}-style])
698 fi
699
700
701 dnl #############################################################
702 dnl #
703 dnl #  8. Checks for system services
704 dnl #
705 dnl #############################################################
706
707 dnl #
708 dnl # Figure out where libtool is located,
709 dnl #
710 LIBTOOL="`pwd`/libtool"
711 AC_SUBST(LIBTOOL)
712 AC_SUBST(LIBLTDL)
713 AC_SUBST(INCLTDL)
714 top_builddir=`pwd`
715 top_srcdir="$top_builddir"
716 AC_SUBST(top_builddir)
717 AC_SUBST(top_srcdir)
718
719 dnl import libtool stuff
720
721 dnl #
722 dnl #  Checks to ensure that the thread pool code can build.
723 dnl #
724 if test "$WITH_THREAD_POOL" = "yes"; then
725   dnl #
726   dnl # If using thread pools, check that threading is enabled
727   dnl #
728   if test "$WITH_THREADS" != "yes"; then
729     AC_MSG_ERROR(You must have threads enabled for thread pools to work.)
730   fi
731
732   dnl #
733   dnl # If using thread pools, check that we have thread libraries
734   dnl #
735   if test "X$PTHREADLIB" = "X"; then
736     AC_MSG_ERROR(You must have threading libraries for thread pools to work.)
737   fi
738
739 fi
740
741 dnl #############################################################
742 dnl #
743 dnl #  Configure in any module directories.
744 dnl #
745 dnl #############################################################
746
747 mysubdirs=
748 if test "x$EXPERIMENTAL" = "xyes"; then
749   for foo in `find src/modules -name configure -print`; do
750     bar=`echo $foo | sed 's%/configure$%%g'`
751     mysubdirs="$mysubdirs $bar"
752   done
753 else
754    dnl # 
755    dnl # Find 'configure' in ONLY the stable modules
756    dnl # 
757    for foo in `find \`cat src/modules/stable | sed 's%rlm%src/modules/rlm%g'\` -name configure -print`; do
758     bar=`echo $foo | sed 's%/configure$%%g'`
759     mysubdirs="$mysubdirs $bar"
760   done
761 fi
762
763 dnl ############################################################
764 dnl # make modules by list
765 dnl #############################################################
766 MODULES=
767 if test "x$EXPERIMENTAL" = "xyes"; then
768   for foo in `ls src/modules | grep rlm_`; do
769     MODULES="$MODULES $foo"
770   done
771 else
772    dnl #
773    dnl # make ONLY the stable modules
774    dnl #
775    for foo in `cat src/modules/stable`; do
776     MODULES="$MODULES $foo"
777    done
778 fi
779
780 dnl #
781 dnl #  Don't change the variable name here.  Autoconf goes bonkers
782 dnl #  if you do.
783 dnl #
784 AC_CONFIG_SUBDIRS($mysubdirs)
785 AC_SUBST(MODULES)
786
787 dnl #############################################################
788 dnl #
789 dnl #  And finally, output the results.
790 dnl #
791 dnl #############################################################
792
793 dnl #
794 dnl #  Substitute whatever libraries we found to be necessary
795 dnl #
796 AC_SUBST(LIBS)
797 AC_SUBST(INSTALLSTRIP)
798
799 USE_SHARED_LIBS=$enable_shared
800 AC_SUBST(USE_SHARED_LIBS)
801 USE_STATIC_LIBS=$enable_static
802 AC_SUBST(USE_STATIC_LIBS)
803 AC_SUBST(STATIC_MODULES)
804 AC_SUBST(RADIUSD_MAJOR_VERSION)
805 AC_SUBST(RADIUSD_MINOR_VERSION)
806 AC_SUBST(RADIUSD_VERSION)
807 export CFLAGS LIBS
808
809 AC_OUTPUT(\
810         ./Make.inc \
811         ./src/include/build-radpaths-h \
812         ./src/main/checkrad.pl \
813         ./src/main/radlast \
814         ./src/main/radtest \
815         ./scripts/rc.radiusd \
816         ./scripts/radwatch \
817         ./scripts/check-radiusd-config \
818         ./scripts/radiusd.cron.daily \
819         ./scripts/radiusd.cron.monthly \
820         ./scripts/cryptpasswd \
821         ./raddb/radiusd.conf
822 )
823
824 AC_OUTPUT_COMMANDS([echo timestamp > src/include/stamp-h])
825 AC_OUTPUT_COMMANDS([(cd ./src/include && /bin/sh ./build-radpaths-h)])
826 AC_OUTPUT_COMMANDS([(cd ./src/main   && chmod +x checkrad.pl radlast radtest)])
827 AC_OUTPUT_COMMANDS([(cd ./scripts    && chmod +x rc.radiusd radwatch check-radiusd-config radiusd.cron.daily radiusd.cron.monthly cryptpasswd)])
828 AC_OUTPUT_COMMANDS([
829 cat >> src/include/autoconf.h <<EOF
830
831 #define HOSTINFO        "$host"
832 #define RADIUSD_VERSION "$RADIUSD_VERSION"
833 EOF
834 ],host=$host)