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