Merge pull request #897 from spbnick/strlcpy_fix
[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_PREREQ([2.59])
24 export CFLAGS LIBS LDFLAGS CPPFLAGS
25
26 m4_define(PACKAGE_MAIN, freeradius)
27
28 AC_INIT(src/main/radiusd.c)
29 AC_CONFIG_HEADER(src/include/autoconf.h)
30
31 dnl # The version of the software
32
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/[[\.-]].*$//'`
36
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 }'`
41
42 dnl # Still useful for custom builds
43 RADIUSD_VERSION_STRING=`cat VERSION`
44 PACKAGE=PACKAGE_MAIN
45
46 dnl #############################################################
47 dnl #
48 dnl #  0. Checks for compiler, libtool, and command line options.
49 dnl #
50 dnl #############################################################
51
52 dnl Get system information
53 AC_CANONICAL_SYSTEM
54
55 dnl Check for GNU cc
56 AC_PROG_CC
57 AC_PROG_CXX
58
59 dnl #
60 dnl # check for AIX, to allow us to use some BSD functions
61 dnl # must be before macros that call the compiler.
62 dnl #
63 AC_AIX
64
65 AC_PROG_GCC_TRADITIONAL
66 AC_PROG_CC_SUNPRO
67 AC_PROG_RANLIB
68
69 dnl #
70 dnl # Set Default CFLAGS
71 dnl #
72 if test "x$GCC" = "xyes"; then
73     CFLAGS="$CFLAGS -Wall -D_GNU_SOURCE"
74 fi
75
76 dnl Compile in large (2G+) file support.
77 AC_SYS_LARGEFILE
78
79 dnl # check for system bytesex
80 dnl # AC_DEFINES WORDS_BIGENDIAN
81 AC_C_BIGENDIAN
82
83 dnl Find GNU Make.
84 AC_CHECK_PROG(GMAKE, gmake, yes, no)
85 if test $GMAKE = no; then
86   AC_PATH_PROG(MAKE, make, /usr/local/bin/make)
87 else
88   AC_PATH_PROG(MAKE, gmake, /usr/local/gnu/bin/make)
89 fi
90 makever=`$ac_cv_path_MAKE --version 2>&1 | grep "GNU Make"`
91 if test -z "$makever"; then
92   AC_MSG_ERROR(GNU Make is not installed.  Please download and install it
93                 from ftp://prep.ai.mit.edu/pub/gnu/make/ before continuing.)
94 fi
95
96 dnl See if we have Git.
97 AC_CHECK_PROG(GIT, git, yes, no)
98
99 AC_ARG_WITH(system-libltdl,
100 [  --with-system-libltdl   Use the libltdl installed in your system (default=use our own)],
101 [
102 LIBLTDL="-lltdl"
103 INCLTDL=-DWITH_SYSTEM_LTDL
104 LTDL_SUBDIRS=
105 ],
106 [
107 dnl If libltdl isn't installable, set it to be installable.
108 [test x"$enable_ltdl_install" = x && enable_ltdl_install=yes]
109 AC_LIBLTDL_INSTALLABLE
110
111 dnl tell Makefile to build ltdl if needed
112 if test x"$enable_ltdl_install" = x"yes"; then
113   LTDL_SUBDIRS=libltdl
114 fi
115 ])
116 AC_SUBST(LTDL_SUBDIRS)
117
118 dnl set this shit so it doesn't force CFLAGS...
119 LTCFLAGS=" "
120
121 dnl use system-wide libtool, if it exists
122 AC_ARG_WITH(system-libtool,
123 [  --with-system-libtool   Use the libtool installed in your system (default=use our own)],
124 [ AC_PATH_PROG(LIBTOOL, libtool,,$PATH:/usr/local/bin) AC_LIBTOOL_DLOPEN
125  AC_PROG_LIBTOOL],
126 [
127   LIBTOOL="`pwd`/libtool"
128   AC_SUBST(LIBTOOL)
129   dnl ensure that we're looking for dlopen
130   AC_LIBTOOL_DLOPEN
131
132   dnl Figure out how to build shared libraries
133   AC_PROG_LIBTOOL
134 ])
135
136
137 dnl Put this in later, when all distributed modules use autoconf.
138 dnl AC_ARG_WITH(disablemodulefoo,
139 dnl [  --without-rlm_foo       Disables module compilation.  Module list:]
140 dnl esyscmd([find src/modules -type d -name rlm_\* -print |\
141 dnl     sed -e 's%src/modules/.*/% (sub)- %; s%.*/%- %' |\
142 dnl     awk '{print "                            "$0}']))
143
144 AC_ARG_ENABLE(strict-dependencies,
145 [  --enable-strict-dependencies  Fail configure on lack of module dependancy.])
146
147 dnl extra argument: --with-docdir
148 docdir='${datadir}/doc/freeradius'
149 AC_MSG_CHECKING(docdir)
150 AC_ARG_WITH(docdir,
151 [  --with-docdir=DIR       Directory for documentation [DATADIR/doc/freeradius] ],
152 [ case "$withval" in
153     no)
154         docdir=no
155         ;;
156     yes)
157         ;;
158     [[\\/$]]* | ?:[[\\/]]* )
159         docdir="$withval"
160         ;;
161     *)
162         AC_MSG_ERROR([expected an absolute directory name for --with-docdir: $withval])
163         ;;
164   esac ]
165 )
166 AC_SUBST(docdir)
167 AC_MSG_RESULT($docdir)
168 if test "x$docdir" = xno; then
169         AC_MSG_WARN(Documentation files will NOT be installed.)
170 fi
171
172 dnl extra argument: --with-logdir
173 logdir='${localstatedir}/log/radius'
174 AC_MSG_CHECKING(logdir)
175 AC_ARG_WITH(logdir,
176 [  --with-logdir=DIR       Directory for logfiles [LOCALSTATEDIR/log/radius] ],
177 [ case "$withval" in
178     no)
179         AC_MSG_ERROR(Need logdir)
180         ;;
181     yes)
182         ;;
183     [[\\/$]]* | ?:[[\\/]]* )
184         logdir="$withval"
185         ;;
186     *)
187         AC_MSG_ERROR([expected an absolute directory name for --with-logdir: $withval])
188         ;;
189   esac ]
190 )
191 AC_SUBST(logdir)
192 AC_MSG_RESULT($logdir)
193
194 dnl extra argument: --with-radacctdir
195 radacctdir='${logdir}/radacct'
196 AC_MSG_CHECKING(radacctdir)
197 AC_ARG_WITH(radacctdir,
198 [  --with-radacctdir=DIR   Directory for detail files [LOGDIR/radacct] ],
199 [ case "$withval" in
200     no)
201         AC_MSG_ERROR(Need radacctdir)
202         ;;
203     yes)
204         ;;
205     [[\\/$]]* | ?:[[\\/]]* )
206         radacctdir="$withval"
207         ;;
208     *)
209         AC_MSG_ERROR([expected an absolute directory name for --with-radacctdir: $withval])
210         ;;
211   esac ]
212 )
213 AC_SUBST(radacctdir)
214 AC_MSG_RESULT($radacctdir)
215
216 dnl extra argument: --with-raddbdir
217 raddbdir='${sysconfdir}/raddb'
218 AC_MSG_CHECKING(raddbdir)
219 AC_ARG_WITH(raddbdir,
220 [  --with-raddbdir=DIR     Directory for config files [SYSCONFDIR/raddb] ],
221 [ case "$withval" in
222     no)
223         AC_MSG_ERROR(Need raddbdir)
224         ;;
225     yes)
226         ;;
227     [[\\/$]]* | ?:[[\\/]]* )
228         raddbdir="$withval"
229         ;;
230     *)
231         AC_MSG_ERROR([expected an absolute directory name for --with-raddbdir: $withval])
232         ;;
233   esac ]
234 )
235 AC_SUBST(raddbdir)
236 AC_MSG_RESULT($raddbdir)
237
238 dnl extra argument: --with-ascend-binary
239 ASCEND_BINARY=yes
240 AC_ARG_WITH(ascend-binary,
241 [  --with-ascend-binary    Include support for Ascend binary filter attributes (default=yes)],
242 [ case "$withval" in
243     yes)
244         ;;
245     *)
246         ASCEND_BINARY=""
247   esac ]
248 )
249 if test "X$ASCEND_BINARY" = "Xyes"; then
250   AC_DEFINE(ASCEND_BINARY, [], [Include support for Ascend binary filter attributes])
251 fi
252
253 dnl extra argument: --with-threads
254 WITH_THREADS=yes
255 AC_ARG_WITH(threads,
256 [  --with-threads          Use threads, if available.  (default=yes) ],
257 [ case "$withval" in
258     yes)
259         ;;
260     *)
261         WITH_THREADS=""
262   esac ]
263 )
264
265 dnl extra argument: --with-vmps
266 WITH_VMPS=yes
267 AC_ARG_WITH(vmps,
268 [  --with-vmps             Compile in VMPS support. (default=yes)],
269 [ case "$withval" in
270     yes)
271         ;;
272     *)
273         WITH_VMPS=no
274   esac ]
275 )
276 if test "x$WITH_VMPS" = "xyes"; then
277         AC_DEFINE(WITH_VMPS, [1], [define if you want VMPS support])
278 fi
279
280 dnl extra argument: --with-dhcp
281 WITH_DHCP=yes
282 AC_ARG_WITH(dhcp,
283 [  --with-dhcp             Compile in DHCP support. (default=yes)],
284 [ case "$withval" in
285     yes)
286         ;;
287     *)
288         WITH_DHCP=no
289   esac ]
290 )
291 if test "x$WITH_DHCP" = "xyes"; then
292         AC_DEFINE(WITH_DHCP, [1], [define if you want DHCP support])
293 fi
294
295
296 dnl extra argument: --with-post-proxy-authorize
297 WITH_POST_PROXY_AUTHORIZE=
298 AC_ARG_WITH(post-proxy-authorize,
299 [  --with-post-proxy-authorize  1.x compatibility  (default=no) ],
300 [ case "$withval" in
301     yes)
302         WITH_POST_PROXY_AUTHORIZE=""
303         ;;
304     *)
305         ;;
306   esac ]
307 )
308
309 dnl #
310 dnl #  Allow the user to specify a list of modules to be linked
311 dnl #  statically to the server.
312 dnl #
313 STATIC_MODULES=
314 AC_ARG_WITH(static_modules,
315 [  --with-static-modules=QUOTED-MODULE-LIST],[
316   for i in $withval; do
317     STATIC_MODULES="$STATIC_MODULES -dlpreopen ../modules/rlm_$i/rlm_$i.la"
318   done
319 ])
320
321 MODULES=
322 AC_ARG_WITH(modules,
323 [ --with-modules=QUOTED-MODULE-LIST],[
324  for i in $withval; do
325    MODULES="$MODULES $i"
326  done
327 ])
328
329 dnl #
330 dnl #  Enable developer C compiler warnings
331 dnl #
332 AC_ARG_ENABLE(developer,
333 [  --enable-developer               Enables features of interest to developers.],
334 [ case "$enableval" in
335     no)
336         developer=no
337         ;;
338     *)
339         developer=yes
340   esac ]
341 )
342
343 if test -d $srcdir/.git; then
344   if test "x$developer" != "xno"; then
345     dnl turn on the developer flag when taken from a git checkout (not a release)
346     developer="yes"
347   fi
348
349   dnl append the current git hash onto the version string
350   if test "x$GIT" = "xyes"; then
351         RADIUSD_VERSION_COMMIT=`git log --pretty=format:'%h' -n 1`
352   fi
353 fi
354
355 dnl extra argument: --with-experimental-modules
356 EXPERIMENTAL=
357 AC_ARG_WITH(experimental-modules,
358 [  --with-experimental-modules      Use experimental and unstable modules. (default=no) ],
359 [ case "$withval" in
360     yes)
361         EXPERIMENTAL=yes
362         ;;
363     *)
364   esac ]
365 )
366
367 dnl extra argument: --with-openssl
368 WITH_OPENSSL=yes
369 AC_ARG_WITH(openssl,
370 [  --with-openssl                   Use OpenSSL. (default=yes)],
371 [ case "$withval" in
372     no)
373         WITH_OPENSSL=no
374         ;;
375     *)
376         WITH_OPENSSL=yes
377         ;;
378   esac ]
379 )
380
381 dnl #
382 dnl # extra argument: --with-openssl-includes=dir
383 dnl #
384 OPENSSL_INCLUDE_DIR=
385 AC_ARG_WITH(openssl-includes,
386 [  --with-openssl-includes=DIR      Directory to look for OpenSSL include files],
387 [ case "$withval" in
388     *) OPENSSL_INCLUDE_DIR="$withval"
389         ;;
390   esac ]
391 )
392
393 dnl #
394 dnl # extra argument: --with-openssl-libraries=dir
395 dnl #
396 OPENSSL_LIB_DIR=
397 AC_ARG_WITH(openssl-libraries,
398 [  --with-openssl-libraries=DIR     Directory to look for OpenSSL library files],
399 [ case "$withval" in
400     *) OPENSSL_LIB_DIR="$withval"
401         ;;
402   esac ]
403 )
404
405 dnl #
406 dnl #  These next two arguments don't actually do anything.  They're
407 dnl #  place holders so that the top-level configure script can tell
408 dnl #  the user how to configure lower-level modules
409 dnl #
410
411 dnl #
412 dnl # extra argument: --with-rlm-FOO-lib-dir
413 dnl #
414 AC_ARG_WITH(rlm-FOO-lib-dir,
415 [  --with-rlm-FOO-lib-dir=DIR       Directory to look for library files used by module FOO],
416 [ case "$withval" in
417     *)
418         ;;
419   esac ]
420 )
421
422 dnl #
423 dnl # extra argument: --with-rlm-FOO-include-dir
424 dnl #
425 AC_ARG_WITH(rlm-FOO-include-dir,
426 [  --with-rlm-FOO-include-dir=DIR   Directory to look for include files used by module FOO],
427 [ case "$withval" in
428     *)
429         ;;
430   esac ]
431 )
432
433 dnl See what include-style is used by the make program.
434 dnl AC_MSG_CHECKING(include style for make)
435 dnl echo "include /dev/null" > testmake.$$
436 dnl echo "all:" >> testmake.$$
437 dnl make -f testmake.$$ >/dev/null 2>&1
438 dnl if test $? = 0
439 dnl then
440 dnl     INCLUDE=include
441 dnl     IQUOTE=
442 dnl else
443 dnl     INCLUDE=.include
444 dnl     IQUOTE='"'
445 dnl fi
446 dnl rm -f testmake.$$
447 dnl AC_MSG_RESULT(" $INCLUDE")
448 dnl AC_SUBST(INCLUDE)
449 dnl AC_SUBST(IQUOTE)
450
451 dnl extra argument: --with-udpfromto
452 WITH_UDPFROMTO=no
453 AC_ARG_WITH(udpfromto,
454 [  --with-udpfromto        Compile in UDPFROMTO support. (default=no)],
455 [ case "$withval" in
456     yes)
457         WITH_UDPFROMTO=yes
458         ;;
459     *)
460         WITH_UDPFROMTO=no
461   esac ]
462 )
463
464 if test "x$WITH_UDPFROMTO" = "xyes"; then
465         AC_DEFINE(WITH_UDPFROMTO, [], [define if you want udpfromto])
466 fi
467
468 dnl #############################################################
469 dnl #
470 dnl #  1. Checks for programs
471 dnl #
472 dnl #############################################################
473
474 CHECKRAD=checkrad.pl
475 AC_PATH_PROG(PERL, perl, /usr/local/bin/perl)
476 if test "x$ac_cv_path_PERL" = "x"; then
477   AC_MSG_WARN(perl not found - Simultaneous-Use and checkrad.pl may not work)
478 fi
479 AC_PATH_PROG(SNMPGET, snmpget)
480 if test "x$ac_cv_path_SNMPGET" = "x"; then
481   AC_MSG_WARN(snmpget not found - Simultaneous-Use and checkrad.pl may not work)
482 fi
483
484 AC_PATH_PROG(SNMPWALK, snmpwalk)
485 if test "x$ac_cv_path_SNMPWALK" = "x"; then
486   AC_MSG_WARN(snmpwalk not found - Simultaneous-Use and checkrad.pl may not work)
487 fi
488
489 AC_PATH_PROG(RUSERS, rusers, /usr/bin/rusers)
490
491 dnl FIXME This is truly gross.
492 missing_dir=`cd $ac_aux_dir && pwd`
493 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
494 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
495 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
496
497 AC_PATH_PROG(LOCATE,locate)
498 AC_PATH_PROG(DIRNAME,dirname)
499 AC_PATH_PROG(GREP,grep)
500
501 dnl #############################################################
502 dnl #
503 dnl #  2. Checks for libraries
504 dnl #
505 dnl #############################################################
506
507 dnl If using pthreads, check for -lpthread (posix) or -lc_r (*BSD)
508 old_CFLAGS=$CFLAGS
509 if test "x$WITH_THREADS" = "xyes"; then
510   if test $ac_cv_prog_suncc = "yes"; then
511     CFLAGS="$CFLAGS -mt"
512   fi
513
514   AC_CHECK_HEADERS(pthread.h, [], [ WITH_THREADS="no" ])
515
516 dnl #
517 dnl # pthread stuff is usually in -lpthread
518 dnl # or in -lc_r, on *BSD
519 dnl #
520 dnl # On Some systems, we need extra pre-processor flags, to get them to
521 dnl # to do the threading properly.
522 dnl #
523   AC_CHECK_LIB(pthread, pthread_create,
524                 [ CFLAGS="$CFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS"
525                   LIBS="-lpthread $LIBS" ],
526                 AC_CHECK_LIB(c_r, pthread_create,
527                             [ CFLAGS="$CFLAGS -pthread -D_THREAD_SAFE" ],
528                             [ WITH_THREADS="no" ]
529                             )
530                 )
531 fi
532
533 dnl #
534 dnl # If we have NO pthread libraries, remove any knowledge of threads.
535 dnl #
536 if test "x$WITH_THREADS" != "xyes"; then
537   CFLAGS=$old_CFLAGS
538   ac_cv_header_pthread_h="no"
539   WITH_THREADS=no
540 else
541   dnl #
542   dnl #  We need sem_init() and friends, as they're the friendliest
543   dnl #  semaphore functions for threading.
544   dnl #
545   dnl # HP/UX requires linking with librt, too, to get the sem_* symbols.
546   dnl # Some systems have them in -lsem
547   dnl # Solaris has them in -lposix4
548   dnl # NetBSD has them in -lsemaphore
549
550   AC_SEARCH_LIBS(sem_init, pthread sem posix4 rt semaphore,
551         [],
552         [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)]
553    )
554 fi
555
556 dnl Check if we need -lsocket
557 AC_CHECK_LIB(socket, getsockname)
558
559 dnl Check for -lresolv
560 dnl This library may be needed later.
561 AC_CHECK_LIB(resolv, inet_aton)
562
563 dnl Check if we need -lnsl. Usually if we want to
564 dnl link against -lsocket we need to include -lnsl as well.
565 AC_CHECK_LIB(nsl, inet_ntoa)
566
567 dnl Check for OpenSSL libraries.
568 OPENSSL_LIBS=
569 if test "x$WITH_OPENSSL" = xyes; then
570   old_LIBS=$LIBS
571   old_LDFLAGS="$LDFLAGS"
572   if test "x$OPENSSL_LIB_DIR" != "x"; then
573     LDFLAGS="-L$OPENSSL_LIB_DIR $LDFLAGS"
574   fi
575   AC_CHECK_LIB(crypto, DH_new,
576     [
577         LIBS="-lcrypto $LIBS"
578         AC_DEFINE(HAVE_LIBCRYPTO, 1,
579             [Define to 1 if you have the `crypto' library (-lcrypto).])
580         AC_CHECK_LIB(ssl, SSL_new,
581             [
582                 AC_DEFINE(HAVE_LIBSSL, 1,
583                     [Define to 1 if you have the `ssl' library (-lssl).])
584                 if test "x$OPENSSL_LIB_DIR" != "x"; then
585                     OPENSSL_LIBS="-L$OPENSSL_LIB_DIR"
586                 fi
587                 OPENSSL_LIBS="$OPENSSL_LIBS -lcrypto -lssl -lcrypto"
588             ], [])
589     ], [])
590   LIBS=$old_LIBS
591   LDFLAGS="$old_LDFLAGS"
592 fi
593
594 AC_CHECK_LIB(ws2_32, htonl)
595
596 dnl Check the pcap library for the RADIUS sniffer.
597 PCAP_LIBS=
598 AC_CHECK_LIB(pcap, pcap_open_live,
599         [ PCAP_LIBS="-lpcap"
600         AC_DEFINE(HAVE_LIBPCAP, 1,
601                 [Define to 1 if you have the `pcap' library (-lpcap).])
602         ],
603         [ AC_MSG_WARN([pcap library not found, silently disabling the RADIUS sniffer.]) ])
604
605 AC_LIB_READLINE
606
607 dnl #############################################################
608 dnl #
609 dnl #  3. Checks for header files
610 dnl #
611 dnl #############################################################
612
613 dnl #
614 dnl # Interix requires us to set -D_ALL_SOURCE, otherwise
615 dnl # getopt will be #included, but won't link.  <sigh>
616 dnl #
617 dnl #
618 case "$host" in
619 *-interix*)
620         CFLAGS="$CFLAGS -D_ALL_SOURCE"
621         ;;
622 *-darwin*)
623         CFLAGS="$CFLAGS -DDARWIN"
624         LIBS="-framework DirectoryService $LIBS"
625         AC_DEFINE([__APPLE_USE_RFC_3542], 1, [Force OSX >= 10.7 Lion to use RFC2292 IPv6 socket options])
626         ;;
627 esac
628
629 AC_HEADER_DIRENT
630 AC_HEADER_STDC
631 AC_HEADER_TIME
632 AC_HEADER_SYS_WAIT
633
634 AC_CHECK_HEADERS( \
635         unistd.h \
636         crypt.h \
637         errno.h \
638         execinfo.h \
639         resource.h \
640         sys/resource.h \
641         getopt.h \
642         malloc.h \
643         utmp.h \
644         utmpx.h \
645         signal.h \
646         sys/select.h \
647         syslog.h \
648         inttypes.h \
649         stdint.h \
650         stdio.h \
651         netdb.h \
652         semaphore.h \
653         arpa/inet.h \
654         netinet/in.h \
655         sys/types.h \
656         sys/socket.h \
657         winsock.h \
658         sys/time.h \
659         sys/wait.h \
660         sys/security.h \
661         fcntl.h \
662         sys/fcntl.h \
663         sys/prctl.h \
664         sys/un.h \
665         glob.h \
666         prot.h \
667         pwd.h \
668         grp.h \
669         stddef.h \
670         fnmatch.h \
671         sia.h \
672         siad.h
673 )
674
675 dnl FreeBSD requires sys/socket.h before net/if.h
676 AC_CHECK_HEADERS(net/if.h, [], [],
677 [#ifdef HAVE_SYS_SOCKET_H
678 # include <sys/socket.h>
679 # endif
680 ])
681
682 REGEX=no
683 AC_CHECK_HEADER(regex.h, AC_DEFINE(HAVE_REGEX_H, [], [define this if we have the <regex.h> header file]))
684 if test "x$ac_cv_header_regex_h" = "xyes"; then
685   REGEX_EXTENDED=no
686   REGEX=yes
687   AC_EGREP_CPP(yes,
688     [#include <regex.h>
689      #ifdef REG_EXTENDED
690        yes
691      #endif
692      ], [AC_DEFINE(HAVE_REG_EXTENDED, [], [define this if we have REG_EXTENDED (from <regex.h>)]) REGEX_EXTENDED=yes])
693 fi
694 AC_SUBST(REGEX)
695 AC_SUBST(REGEX_EXTENDED)
696
697 dnl #
698 dnl #  other checks which require headers
699 dnl #
700 if test "x$ac_cv_header_sys_security_h" = "xyes" && test "x$ac_cv_header_prot_h" = "xyes"
701 then
702   AC_DEFINE(OSFC2, [], [define if you have OSFC2 authentication])
703 fi
704
705 if test "x$ac_cv_header_sia_h" = "xyes" && test "x$ac_cv_header_siad_h" = "xyes"
706 then
707   AC_DEFINE(OSFSIA, [], [define if you have OSFSIA authentication])
708 fi
709
710 dnl #
711 dnl #  Were we told to use OpenSSL, if we were and we find an error, call AC_MSG_FAILURE and exit
712 dnl #
713 if test "x$WITH_OPENSSL" = xyes; then
714   old_LIBS=$LIBS
715   old_LDFLAGS="$LDFLAGS"
716
717   OPENSSL_INCLUDE="-DNO_OPENSSL"
718   OPENSSL_LIBS=
719   if test "x$OPENSSL_LIB_DIR" != "x"; then
720     LDFLAGS="-L$OPENSSL_LIB_DIR $LDFLAGS"
721   fi
722
723   dnl #
724   dnl #  Check we can link to libssl
725   dnl #
726   AC_CHECK_LIB(crypto, DH_new,
727     [
728       LIBS="-lcrypto $LIBS"
729       AC_DEFINE(HAVE_LIBCRYPTO, 1, [Define to 1 if you have the `crypto' library (-lcrypto).])
730       AC_CHECK_LIB(ssl, SSL_new,
731         [
732           AC_DEFINE(HAVE_LIBSSL, 1, [Define to 1 if you have the `ssl' library (-lssl).])
733           if test "x$OPENSSL_LIB_DIR" != "x"; then
734             OPENSSL_LIBS="-L$OPENSSL_LIB_DIR"
735           fi
736           OPENSSL_LIBS="$OPENSSL_LIBS -lcrypto -lssl -lcrypto"
737           LIBS="$OPENSSL_LIBS $LIBS"
738         ],
739         [
740           AC_MSG_FAILURE([failed linking to libssl])
741         ]
742       )
743     ],
744     []
745   )
746
747   dnl #
748   dnl #  Check we can find required headers
749   dnl #
750   old_CPPFLAGS=$CPPFLAGS
751   old_CFLAGS=$CFLAGS
752   if test "x$OPENSSL_INCLUDE_DIR" != "x"; then
753     CPPFLAGS="-I$OPENSSL_INCLUDE_DIR $CPPFLAGS"
754     CFLAGS="-I$OPENSSL_INCLUDE_DIR $CFLAGS"
755   fi
756
757   dnl #
758   dnl #  Stupid RedHat shit
759   dnl #
760   CPPFLAGS="$CPPFLAGS -DOPENSSL_NO_KRB5"
761   AC_CHECK_HEADERS( \
762     openssl/ssl.h \
763     openssl/crypto.h \
764     openssl/err.h \
765     openssl/evp.h \
766     openssl/md5.h \
767     openssl/md4.h \
768     openssl/sha.h \
769     openssl/ocsp.h \
770     openssl/engine.h,
771     [],
772     [
773       AC_MSG_FAILURE([failed locating OpenSSL headers])
774     ]
775   )
776
777   AC_MSG_CHECKING([for OpenSSL version >= 0.9.7])
778   AC_EGREP_CPP(yes,
779     [#include <openssl/crypto.h>
780      #if (OPENSSL_VERSION_NUMBER >= 0x00907000L)
781      yes
782      #endif
783     ],
784     [
785       AC_MSG_RESULT(yes)
786     ],
787     [
788       AC_MSG_RESULT(no)
789       AC_MSG_FAILURE([OpenSSL version too old])
790     ]
791   )
792
793   if test "x$OPENSSL_INCLUDE_DIR" != "x"; then
794     OPENSSL_INCLUDE="-I$OPENSSL_INCLUDE_DIR -DOPENSSL_NO_KRB5"
795   else
796     OPENSSL_INCLUDE="-DOPENSSL_NO_KRB5"
797   fi
798
799   dnl #
800   dnl #  Now check that the header versions match the library
801   dnl #
802   AC_MSG_CHECKING([OpenSSL library and header version consistency])
803   AC_RUN_IFELSE(
804     [AC_LANG_PROGRAM(
805       [[
806         #include <stdio.h>
807         #include <openssl/opensslv.h>
808         #include <openssl/crypto.h>
809       ]],
810       [[
811         if (SSLeay() == OPENSSL_VERSION_NUMBER) {
812           return 0;
813         } else {
814           printf("library: %lx header: %lx... ", (unsigned long) SSLeay(), (unsigned long) OPENSSL_VERSION_NUMBER);
815           return 1;
816         }
817       ]]
818     )],
819     [
820       AC_MSG_RESULT(yes)
821     ],
822     [
823       AC_MSG_RESULT(no)
824       AC_MSG_FAILURE([OpenSSL library version does not match header version])
825     ]
826   )
827
828   if test "x$OPENSSL_LIBS" = x; then
829     LIBS=$old_LIBS
830     LDFLAGS="$old_LDFLAGS"
831   fi
832   if test "x$OPENSSL_INCLUDE" = x; then
833     CPPFLAGS=$old_CPPFLAGS
834     CFLAGS=$old_CFLAGS
835   fi
836 fi
837
838 AC_SUBST(OPENSSL_INCLUDE)
839 AC_SUBST(OPENSSL_LIBS)
840 export OPENSSL_LIBS
841
842 dnl Check the pcap includes for the RADIUS sniffer.
843 if test "x$PCAP_LIBS" = x; then
844     AC_MSG_NOTICE([skipping test for pcap.h.])
845 else
846     AC_CHECK_HEADER(pcap.h,
847         AC_DEFINE(HAVE_PCAP_H, 1,
848                 [Define to 1 if you have the <pcap.h> header file.]),
849         [ PCAP_LIBS=
850         AC_MSG_WARN([pcap.h not found, silently disabling the RADIUS sniffer.])
851         ])
852
853     AC_CHECK_LIB(pcap, pcap_fopen_offline,
854         [ AC_DEFINE(HAVE_PCAP_FOPEN_OFFLINE, 1,
855                 [Define to 1 if you have the function pcap_fopen_offline.])
856         ])
857     AC_CHECK_LIB(pcap, pcap_dump_fopen,
858         [ AC_DEFINE(HAVE_PCAP_DUMP_FOPEN, 1,
859                 [Define to 1 if you have the function pcap_dump_fopen.])
860         ])
861 fi
862 AC_SUBST(PCAP_LIBS)
863
864 dnl #############################################################
865 dnl #
866 dnl #  4. Checks for typedefs
867 dnl #
868 dnl #############################################################
869
870 dnl #
871 dnl # Ensure that these are defined
872 dnl #
873 AC_TYPE_OFF_T
874 AC_TYPE_PID_T
875 AC_TYPE_SIZE_T
876 AC_TYPE_UID_T
877
878 dnl check for socklen_t
879 FR_CHECK_TYPE_INCLUDE([
880 #ifdef HAVE_SYS_TYPES_H
881 #include <sys/types.h>
882 #endif
883 #ifdef HAVE_SYS_SOCKET_H
884 #include <sys/socket.h>
885 #endif
886 ],socklen_t, int, [socklen_t is generally 'int' on systems which don't use it])
887
888 dnl check for uint8_t
889 FR_CHECK_TYPE_INCLUDE([
890 #ifdef HAVE_INTTYPES_H
891 #include <inttypes.h>
892 #endif
893 #ifdef HAVE_STDINT_H
894 #include <stdint.h>
895 #endif
896 ],uint8_t, unsigned char, [uint8_t should be the canonical 'octet' for network traffic])
897
898 dnl check for uint16_t
899 FR_CHECK_TYPE_INCLUDE([
900 #ifdef HAVE_INTTYPES_H
901 #include <inttypes.h>
902 #endif
903 #ifdef HAVE_STDINT_H
904 #include <stdint.h>
905 #endif
906 ],uint16_t, unsigned short, [uint16_t should be the canonical '2 octets' for network traffic])
907
908 dnl check for uint32_t
909 FR_CHECK_TYPE_INCLUDE([
910 #ifdef HAVE_INTTYPES_H
911 #include <inttypes.h>
912 #endif
913 #ifdef HAVE_STDINT_H
914 #include <stdint.h>
915 #endif
916 ],uint32_t, unsigned int, [uint32_t should be the canonical 'network integer])
917
918 AC_CHECK_TYPE(sig_t, AC_DEFINE(HAVE_SIG_T, 1, [signal action callback function]), [], [
919     #ifdef HAVE_SIGNAL_H
920     #  include <signal.h>
921     #endif
922 ])
923
924 AC_CHECK_TYPE(struct in6_addr, AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1, [IPv6 address structure]), [], [
925 #ifdef HAVE_NETINET_IN_H
926 #include <netinet/in.h>
927 #endif
928 ])
929
930 AC_CHECK_TYPE(struct sockaddr_storage, AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1, [Generic socket addresses]), [], [
931 #ifdef HAVE_NETINET_IN_H
932 #include <netinet/in.h>
933 #endif
934 #ifdef HAVE_SYS_SOCKET_H
935 #include <sys/socket.h>
936 #endif
937 ])
938
939 AC_CHECK_TYPE(struct sockaddr_in6, AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1, [IPv6 socket addresses]), [], [
940 #ifdef HAVE_NETINET_IN_H
941 #include <netinet/in.h>
942 #endif
943 ])
944
945 AC_CHECK_TYPE(struct addrinfo, AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1, [Generic DNS lookups]), [], [
946 #ifdef HAVE_SYS_TYPES_H
947 #include <sys/types.h>
948 #endif
949 #ifdef HAVE_SYS_SOCKET_H
950 #include <sys/socket.h>
951 #endif
952 #ifdef HAVE_NETDB_H
953 #include <netdb.h>
954 #endif
955 ])
956
957 dnl #############################################################
958 dnl #
959 dnl #  5. Checks for structures and functions
960 dnl #
961 dnl #############################################################
962 AC_CHECK_FUNCS( \
963         getopt_long \
964         lockf \
965         strsignal \
966         sigaction \
967         sigprocmask \
968         pthread_sigmask \
969         snprintf \
970         vsnprintf \
971         setsid \
972         strncasecmp \
973         strcasecmp \
974         localtime_r \
975         ctime_r \
976         gmtime_r \
977         strsep \
978         inet_aton \
979         inet_pton \
980         inet_ntop \
981         setlinebuf \
982         setvbuf \
983         getusershell \
984         initgroups \
985         getaddrinfo \
986         getnameinfo \
987         closefrom \
988         gettimeofday \
989         getpeereid \
990         setuid \
991         setresuid \
992         getresuid \
993         strlcat \
994         strlcpy
995 )
996 RADIUSD_NEED_DECLARATIONS( \
997         crypt \
998         strncasecmp \
999         strcasecmp \
1000         inet_aton \
1001         setlinebuf \
1002         getusershell \
1003         endusershell
1004 )
1005
1006 AC_TYPE_SIGNAL
1007
1008 dnl # check if we have utmpx.h
1009 dnl # if so, check if struct utmpx has entry ut_xtime
1010 dnl # if not, set it to define ut_xtime == ut_tv.tv_sec
1011 if test "x$ac_cv_header_utmpx_h" = "xyes"
1012 then
1013  FR_CHECK_STRUCT_HAS_MEMBER([#include <utmpx.h>], [struct utmpx], ut_xtime)
1014  if test "x$ac_cv_type_struct_utmpx_has_ut_xtime" = "x"
1015  then
1016    AC_DEFINE(ut_xtime,ut_tv.tv_sec, [define to something if you don't have ut_xtime in struct utmpx])
1017  fi
1018 fi
1019
1020 dnl # struct ip_pktinfo
1021 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in_pktinfo], ipi_addr)
1022 if test "x$ac_cv_type_struct_in_pktinfo_has_ipi_addr" = "xyes"
1023 then
1024         AC_DEFINE(HAVE_IP_PKTINFO, [], [define if you have IP_PKTINFO (Linux)])
1025 fi
1026
1027 dnl # struct in6_pktinfo
1028 FR_CHECK_STRUCT_HAS_MEMBER([#include <netinet/in.h>], [struct in6_pktinfo], ipi6_addr)
1029 if test "x$ac_cv_type_struct_in6_pktinfo_has_ipi6_addr" = "xyes"
1030 then
1031         AC_DEFINE(HAVE_IN6_PKTINFO, [], [define if you have IN6_PKTINFO (Linux)])
1032 fi
1033
1034 dnl #############################################################
1035 dnl #
1036 dnl #  6. Checks for compiler characteristics
1037 dnl #
1038 dnl #############################################################
1039
1040 dnl #
1041 dnl # Ensure that these are defined
1042 dnl #
1043 AC_C_CONST
1044
1045 dnl #
1046 dnl # See if this is OS/2
1047 dnl #
1048 AC_MSG_CHECKING(type of OS)
1049 OS=`uname -s`
1050 AC_MSG_RESULT($OS)
1051 if test "$OS" = "OS/2"; then
1052         LIBPREFIX=
1053 else
1054         LIBPREFIX=lib
1055 fi
1056 AC_SUBST(LIBPREFIX)
1057
1058 AC_MSG_CHECKING(for developer gcc flags)
1059 if test "x$developer" = "xyes" -a "x$GCC" = "xyes"; then
1060   devflags="-g -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -W -Wredundant-decls -Wundef"
1061   CFLAGS="$CFLAGS $devflags"
1062   INSTALLSTRIP=""
1063   AC_MSG_RESULT(yes.  Using $devflags)
1064 else
1065   devflags=""
1066   CFLAGS="$CFLAGS -DNDEBUG"
1067   INSTALLSTRIP=""
1068   AC_MSG_RESULT(no.)
1069 fi
1070
1071 FR_TLS
1072
1073 dnl #############################################################
1074 dnl #
1075 dnl #  7. Checks for library functions
1076 dnl #
1077 dnl #############################################################
1078
1079 old_LIBS="$LIBS"
1080 LIBS="$LIBS $LIBLTDL"
1081 AC_CHECK_FUNC(lt_dladvise_init, AC_DEFINE(HAVE_LT_DLADVISE_INIT, [], [Do we have the lt_dladvise_init function]))
1082 LIBS="$old_LIBS"
1083
1084 dnl Check for libcrypt
1085 dnl We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
1086 AC_CHECK_LIB(crypt, crypt,
1087   CRYPTLIB="-lcrypt"
1088 )
1089 if test "$CRYPTLIB" != ""; then
1090   AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function])
1091 else
1092   AC_CHECK_FUNC(crypt, AC_DEFINE(HAVE_CRYPT, [], [Do we have the crypt function]))
1093 fi
1094
1095 dnl Check for libcipher
1096 AC_CHECK_LIB(cipher, setkey,
1097    CRYPTLIB="${CRYPTLIB} -lcipher"
1098 )
1099 AC_SUBST(CRYPTLIB)
1100
1101 dnl Check the style of gethostbyaddr, in order of preference
1102 dnl GNU (_r eight args)
1103 AC_DEFINE(GNUSTYLE, [1], [GNU-Style get*byaddr_r])
1104 dnl SYSV (_r six args)
1105 AC_DEFINE(SYSVSTYLE, [2], [SYSV-Style get*byaddr_r])
1106 dnl BSD (three args, may not be thread safe)
1107 AC_DEFINE(BSDSTYLE, [3], [BSD-Style get*byaddr_r])
1108 dnl Tru64 has BSD version, but it is thread safe
1109 dnl     http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1739____.HTM
1110 dnl We need #stdio.h to define NULL on FreeBSD (at least)
1111 gethostbyaddrrstyle=""
1112 AC_MSG_CHECKING([gethostbyaddr_r() syntax])
1113 case "$host" in
1114 *-freebsd*)
1115 dnl With FreeBSD, check if there's a prototype for gethostbyaddr_r.
1116 dnl Some versions (FreeBSD 5.1?) have a symbol but no prototype - so we
1117 dnl override this test to BSDSTYLE. FreeBSD 6.2 and up have proper GNU
1118 dnl style support.
1119         AC_CHECK_DECLS([gethostbyaddr_r], [], [
1120                 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE,
1121                         [style of gethostbyaddr_r functions ])
1122                 gethostbyaddrrstyle=BSD
1123                 AC_MSG_WARN([FreeBSD overridden to BSD-style])
1124         ], [
1125 #ifdef HAVE_NETDB_H
1126 #include <netdb.h>
1127 #endif
1128 ])
1129         ;;
1130 esac
1131 if test "x$gethostbyaddrrstyle" = "x"; then
1132         AC_TRY_LINK([
1133 #include <stdio.h>
1134 #include <netdb.h>
1135 ], [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL, NULL) ], [
1136         AC_DEFINE(GETHOSTBYADDRRSTYLE, GNUSTYLE, [style of gethostbyaddr_r functions ])
1137         gethostbyaddrrstyle=GNU
1138 ])
1139 fi
1140 if test "x$gethostbyaddrrstyle" = "x"; then
1141         AC_TRY_LINK([
1142 #include <stdio.h>
1143 #include <netdb.h>
1144 ], [ gethostbyaddr_r(NULL, 0, 0, NULL, NULL, 0, NULL) ] , [
1145                 AC_DEFINE(GETHOSTBYADDRRSTYLE, SYSVSTYLE, [style of gethostbyaddr_r functions ])
1146                 gethostbyaddrrstyle=SYSV
1147         ])
1148 fi
1149 if test "x$gethostbyaddrrstyle" = "x"; then
1150         AC_TRY_LINK([
1151 #include <stdio.h>
1152 #include <netdb.h>
1153 ], [ gethostbyaddr(NULL, 0, 0)  ], [
1154                 AC_DEFINE(GETHOSTBYADDRRSTYLE, BSDSTYLE, [style of gethostbyaddr_r functions ])
1155                 gethostbyaddrrstyle=BSD
1156         ])
1157 fi
1158
1159 if test "x$gethostbyaddrrstyle" = "x"; then
1160         AC_MSG_RESULT([none!  It must not exist, here.])
1161 else
1162         AC_MSG_RESULT([${gethostbyaddrrstyle}-style])
1163 fi
1164
1165 if test "x$gethostbyaddrrstyle" = "xBSD"; then
1166         AC_MSG_WARN([ ****** BSD-style gethostbyaddr might NOT be thread-safe! ****** ])
1167 fi
1168
1169 dnl Check the style of gethostbyname, in order of preference
1170 dnl GNU (_r seven args)
1171 dnl SYSV (_r five args)
1172 dnl BSD (two args, may not be thread safe)
1173 dnl Tru64 has BSD version, but it _is_ thread safe
1174 dnl     http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1946____.HTM
1175 dnl We need #stdio.h to define NULL on FreeBSD (at least)
1176 gethostbynamerstyle=""
1177 AC_MSG_CHECKING([gethostbyname_r() syntax])
1178 AC_TRY_LINK([
1179 #include <stdio.h>
1180 #include <netdb.h>
1181 ], [ gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL) ], [
1182         AC_DEFINE(GETHOSTBYNAMERSTYLE, GNUSTYLE, [style of gethostbyname_r functions ])
1183         gethostbynamerstyle=GNU
1184 ])
1185 if test "x$gethostbynamerstyle" = "x"; then
1186         AC_TRY_LINK([
1187 #include <stdio.h>
1188 #include <netdb.h>
1189 ], [ gethostbyname_r(NULL, NULL, NULL, 0, NULL) ] , [
1190                 AC_DEFINE(GETHOSTBYNAMERSTYLE, SYSVSTYLE, [style of gethostbyname_r functions ])
1191                 gethostbynamerstyle=SYSV
1192         ])
1193 fi
1194 if test "x$gethostbynamerstyle" = "x"; then
1195         AC_TRY_LINK([
1196 #include <stdio.h>
1197 #include <netdb.h>
1198 ], [ gethostbyname(NULL)  ], [
1199                 AC_DEFINE(GETHOSTBYNAMERSTYLE, BSDSTYLE, [style of gethostbyname_r functions ])
1200                 gethostbynamerstyle=BSD
1201         ])
1202 fi
1203
1204 if test "x$gethostbynamerstyle" = "x"; then
1205         AC_MSG_RESULT([none!  It must not exist, here.])
1206 else
1207         AC_MSG_RESULT([${gethostbynamerstyle}-style])
1208 fi
1209
1210 if test "x$gethostbynamerstyle" = "xBSD"; then
1211         AC_MSG_WARN([ ****** BSD-style gethostbyname might NOT be thread-safe! ****** ])
1212 fi
1213
1214 dnl check for non-posix solaris ctime_r (extra buflen int arg)
1215 AC_DEFINE(POSIXSTYLE, [1], [Posix-Style ctime_r])
1216 AC_DEFINE(SOLARISSTYLE, [2], [Solaris-Style ctime_r])
1217 ctimerstyle=""
1218 AC_MSG_CHECKING([ctime_r() syntax])
1219 AC_TRY_LINK([
1220 #include <time.h>
1221 ], [ ctime_r(NULL, NULL, 0) ], [
1222         AC_DEFINE(CTIMERSTYLE, SOLARISSTYLE, [style of ctime_r function])
1223         ctimerstyle="SOLARIS"
1224 ])
1225 if test "x$ctimerstyle" = "x"; then
1226         AC_TRY_LINK([
1227 #include <time.h>
1228 ], [ ctime_r(NULL, NULL) ], [
1229                 AC_DEFINE(CTIMERSTYLE, POSIXSTYLE, [style of ctime_r function])
1230                 ctimerstyle="POSIX"
1231         ])
1232 fi
1233
1234 if test "x$ctimerstyle" = "x"; then
1235         AC_MSG_RESULT([none!  It must not exist, here.])
1236 else
1237         AC_MSG_RESULT([${ctimerstyle}-style])
1238 fi
1239
1240 AC_SUBST(HOSTINFO, $host)
1241
1242 if test "x$WITH_POST_PROXY_AUTHORIZE" != "x"; then
1243         AC_DEFINE(WITH_POST_PROXY_AUTHORIZE, 1, [1.x compatibility])
1244 fi
1245
1246 dnl #############################################################
1247 dnl #
1248 dnl #  8. Checks for system services
1249 dnl #
1250 dnl #############################################################
1251
1252 dnl #
1253 dnl # Figure out where libtool is located,
1254 dnl #
1255 top_builddir=`pwd`
1256 export top_builddir
1257 AC_MSG_RESULT([top_builddir=$top_builddir])
1258 dnl # AC_SUBST(top_builddir)
1259 AC_SUBST(LIBLTDL)
1260 AC_SUBST(INCLTDL)
1261
1262 dnl import libtool stuff
1263
1264 dnl #############################################################
1265 dnl #
1266 dnl #  Configure in any module directories.
1267 dnl #
1268 dnl #############################################################
1269
1270 mysubdirs="$LIBLTDLPATH"
1271 if test "x$EXPERIMENTAL" = "xyes"; then
1272   bar=`ls -1 "${srcdir}"/src/modules/rlm_*/configure | sed 's%/configure%%'`
1273   dnl # get rid of LF's.
1274   mysubdirs=`echo $mysubdirs $bar`
1275 else
1276   dnl #
1277   dnl # Find 'configure' in ONLY the stable modules
1278   dnl #
1279   for bar in `cat "${srcdir}"/src/modules/stable`; do
1280     if test -f "${srcdir}"/src/modules/$bar/configure; then
1281       mysubdirs="$mysubdirs src/modules/$bar"
1282     fi
1283   done
1284 fi
1285
1286 dnl ############################################################
1287 dnl # make modules by list
1288 dnl #############################################################
1289 if test "x$EXPERIMENTAL" = "xyes"; then
1290   for foo in `ls -1 "${srcdir}"/src/modules | grep rlm_`; do
1291     MODULES="$MODULES $foo"
1292   done
1293 else
1294    dnl #
1295    dnl # make ONLY the stable modules
1296    dnl #
1297    for foo in `cat "${srcdir}"/src/modules/stable`; do
1298     MODULES="$MODULES $foo"
1299    done
1300 fi
1301
1302 dnl #
1303 dnl #  Don't change the variable name here.  Autoconf goes bonkers
1304 dnl #  if you do.
1305 dnl #
1306 AC_CONFIG_SUBDIRS($LTDL_SUBDIRS $mysubdirs)
1307 AC_SUBST(MODULES)
1308
1309 dnl #############################################################
1310 dnl #
1311 dnl #  And finally, output the results.
1312 dnl #
1313 dnl #############################################################
1314
1315 AC_CONFIG_COMMANDS([stamp-h], [echo timestamp > src/include/stamp-h])
1316 AC_CONFIG_COMMANDS([build-radpaths-h], [(cd ./src/include && /bin/sh ./build-radpaths-h)])
1317 AC_CONFIG_COMMANDS([main-chmod], [(cd ./src/main   && chmod +x checkrad.pl radlast radtest)])
1318 AC_CONFIG_COMMANDS([scripts-chmod], [(cd ./scripts    && chmod +x rc.radiusd radwatch radiusd.cron.daily radiusd.cron.monthly cryptpasswd)])
1319
1320 dnl #
1321 dnl #  Substitute whatever libraries we found to be necessary
1322 dnl #
1323 AC_SUBST(LIBS)
1324 AC_SUBST(INSTALLSTRIP)
1325
1326 USE_SHARED_LIBS=$enable_shared
1327 AC_SUBST(USE_SHARED_LIBS)
1328 USE_STATIC_LIBS=$enable_static
1329 AC_SUBST(USE_STATIC_LIBS)
1330 AC_SUBST(STATIC_MODULES)
1331 AC_SUBST(RADIUSD_MAJOR_VERSION)
1332 AC_SUBST(RADIUSD_MINOR_VERSION)
1333 AC_SUBST(RADIUSD_INCRM_VERSION)
1334 AC_SUBST(RADIUSD_VERSION)
1335 AC_SUBST(RADIUSD_VERSION_STRING)
1336 AC_SUBST(RADIUSD_VERSION_COMMIT)
1337
1338 AC_OUTPUT(\
1339         ./Make.inc \
1340         ./src/include/build-radpaths-h \
1341         ./src/main/Makefile \
1342         ./src/main/checkrad.pl \
1343         ./src/main/radlast \
1344         ./src/main/radtest \
1345         ./scripts/rc.radiusd \
1346         ./scripts/radwatch \
1347         ./scripts/radiusd.cron.daily \
1348         ./scripts/radiusd.cron.monthly \
1349         ./scripts/cryptpasswd \
1350         ./raddb/dictionary \
1351         ./raddb/radrelay.conf \
1352         ./raddb/radiusd.conf
1353 )