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