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