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