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